Skip to content

Commit 374979e

Browse files
committed
Updated Durable Object fetch method to be optional.
1 parent d7cf375 commit 374979e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

worker-build/src/js/durable_objects_shim.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ const globalStorePrefix = "__DO_WRAPPED_"; // For globalThis storage
66
if (typeof __WORKER_BUILD_DO_NAMES__ !== 'undefined' && Array.isArray(__WORKER_BUILD_DO_NAMES__)) {
77
__WORKER_BUILD_DO_NAMES__.forEach(className => {
88
const OriginalClass = imports[className];
9-
if (typeof OriginalClass === 'function' && OriginalClass.prototype && typeof OriginalClass.prototype.fetch === 'function') {
10-
console.log(`[shim.js] Wrapping DO (identified by worker-build): ${className}`);
9+
if (typeof OriginalClass === 'function' && OriginalClass.prototype) {
10+
console.log(`[shim.js] Wrapping DO: ${className}`);
1111
successfullyWrappedDONames.push(className);
1212
const WrappedClass = class extends DurableObject {
1313
constructor(state, env) { super(state, env); this._inner = new OriginalClass(state, env); }
14-
async fetch(request) { return this._inner.fetch(request); }
1514
};
1615
Object.getOwnPropertyNames(OriginalClass.prototype).forEach(methodName => {
17-
if (methodName !== 'constructor' && methodName !== 'fetch') {
16+
if (methodName !== 'constructor') {
1817
if (typeof OriginalClass.prototype[methodName] === 'function') {
1918
WrappedClass.prototype[methodName] = function(...args) { return this._inner[methodName](...args); };
2019
}

0 commit comments

Comments
 (0)