zitejs 0.9.36 → 0.9.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -406,7 +406,14 @@ async function bundleOneOffScriptImpl(scriptPath, sdkPath) {
406
406
  }
407
407
  }
408
408
  catch { }
409
- const wrappedScript = `${importSection}
409
+ // Initialize the worker runtime (sets globalThis.__wrapSdkCall) like the
410
+ // endpoint wrapper does — otherwise createTableClient/createSqlClient from
411
+ // zitejs/db throw "Zite SDK runtime not initialized" at the worker.
412
+ const runtimeInit = `import { __wrapSdkCall, initRuntime } from '@zite/endpoints-runtime-sdk';
413
+ globalThis.__wrapSdkCall = __wrapSdkCall;
414
+ initRuntime();`;
415
+ const wrappedScript = `${runtimeInit}
416
+ ${importSection}
410
417
  export async function execute() {
411
418
  ${bodySection}
412
419
  }`;
@@ -370,7 +370,14 @@ async function bundleOneOffScriptImpl(scriptPath, sdkPath) {
370
370
  }
371
371
  }
372
372
  catch { }
373
- const wrappedScript = `${importSection}
373
+ // Initialize the worker runtime (sets globalThis.__wrapSdkCall) like the
374
+ // endpoint wrapper does — otherwise createTableClient/createSqlClient from
375
+ // zitejs/db throw "Zite SDK runtime not initialized" at the worker.
376
+ const runtimeInit = `import { __wrapSdkCall, initRuntime } from '@zite/endpoints-runtime-sdk';
377
+ globalThis.__wrapSdkCall = __wrapSdkCall;
378
+ initRuntime();`;
379
+ const wrappedScript = `${runtimeInit}
380
+ ${importSection}
374
381
  export async function execute() {
375
382
  ${bodySection}
376
383
  }`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.36",
3
+ "version": "0.9.37",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/runtime/index.js",