zitejs 0.9.27 → 0.9.28

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.
@@ -264,8 +264,14 @@ function createAliasPlugin(opts) {
264
264
  };
265
265
  }
266
266
  function generateEndpointWrapper(endpointName, usedImports, sdkExportKinds, sdkSource) {
267
+ // Always import the prebundled runtime to ensure globalThis.__wrapSdkCall
268
+ // is available for createTableClient/createSqlClient from zitejs/runtime.
269
+ const runtimeInit = `import { __wrapSdkCall, initRuntime } from '@zite/endpoints-runtime-sdk';
270
+ globalThis.__wrapSdkCall = __wrapSdkCall;
271
+ initRuntime();`;
267
272
  if (usedImports === null) {
268
273
  return `
274
+ ${runtimeInit}
269
275
  import * as sdk from '${sdkSource}';
270
276
  Object.assign(globalThis, sdk);
271
277
  import endpoint from './api/${endpointName}';
@@ -274,6 +280,7 @@ globalThis.__endpoint = endpoint;
274
280
  }
275
281
  if (usedImports.length === 0) {
276
282
  return `
283
+ ${runtimeInit}
277
284
  import endpoint from './api/${endpointName}';
278
285
  globalThis.__endpoint = endpoint;
279
286
  `;
@@ -299,6 +306,7 @@ globalThis.__endpoint = endpoint;
299
306
  ? `Object.assign(globalThis, { ${valueImports.join(', ')} });`
300
307
  : '';
301
308
  return `
309
+ ${runtimeInit}
302
310
  ${importStatements.join('\n')}
303
311
  ${globalAssign}
304
312
  import endpoint from './api/${endpointName}';
@@ -228,8 +228,14 @@ function createAliasPlugin(opts) {
228
228
  };
229
229
  }
230
230
  function generateEndpointWrapper(endpointName, usedImports, sdkExportKinds, sdkSource) {
231
+ // Always import the prebundled runtime to ensure globalThis.__wrapSdkCall
232
+ // is available for createTableClient/createSqlClient from zitejs/runtime.
233
+ const runtimeInit = `import { __wrapSdkCall, initRuntime } from '@zite/endpoints-runtime-sdk';
234
+ globalThis.__wrapSdkCall = __wrapSdkCall;
235
+ initRuntime();`;
231
236
  if (usedImports === null) {
232
237
  return `
238
+ ${runtimeInit}
233
239
  import * as sdk from '${sdkSource}';
234
240
  Object.assign(globalThis, sdk);
235
241
  import endpoint from './api/${endpointName}';
@@ -238,6 +244,7 @@ globalThis.__endpoint = endpoint;
238
244
  }
239
245
  if (usedImports.length === 0) {
240
246
  return `
247
+ ${runtimeInit}
241
248
  import endpoint from './api/${endpointName}';
242
249
  globalThis.__endpoint = endpoint;
243
250
  `;
@@ -263,6 +270,7 @@ globalThis.__endpoint = endpoint;
263
270
  ? `Object.assign(globalThis, { ${valueImports.join(', ')} });`
264
271
  : '';
265
272
  return `
273
+ ${runtimeInit}
266
274
  ${importStatements.join('\n')}
267
275
  ${globalAssign}
268
276
  import endpoint from './api/${endpointName}';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.27",
3
+ "version": "0.9.28",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/runtime/index.js",