zitejs 0.9.30 → 0.9.32

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.
@@ -40,7 +40,7 @@ function createCaller(endpoint, name, flowId) {
40
40
  ...(token ? { Authorization: `Bearer ${token}` } : {}),
41
41
  'Content-Type': 'application/json',
42
42
  },
43
- body: JSON.stringify({ ...input, mode: 'preview', usageToken: token }),
43
+ body: JSON.stringify({ inputs: input, mode: 'preview', usageToken: token }),
44
44
  });
45
45
  if (!res.ok) {
46
46
  const text = await res.text().catch(() => '');
@@ -10,37 +10,52 @@ function getSdkCall() {
10
10
  }
11
11
  return fn;
12
12
  }
13
+ function getBaseId() {
14
+ try {
15
+ return globalThis.__ZITE_EXECUTION_CONFIG__?.baseId
16
+ ?? (typeof process !== 'undefined' ? process.env?.ZITE_BASE_ID : undefined);
17
+ }
18
+ catch {
19
+ return undefined;
20
+ }
21
+ }
13
22
  function createTableClient(integrationId, className) {
14
23
  return {
15
24
  findAll: (options) => getSdkCall()(integrationId, className, 'findAll', {
25
+ baseId: getBaseId(),
16
26
  tableId: className,
17
27
  ...options,
18
28
  }),
19
29
  findOne: (recordId) => getSdkCall()(integrationId, className, 'findOne', {
30
+ baseId: getBaseId(),
20
31
  tableId: className,
21
32
  ...(typeof recordId === 'string' ? { id: recordId } : recordId),
22
33
  }),
23
34
  create: (data) => getSdkCall()(integrationId, className, 'create', {
35
+ baseId: getBaseId(),
24
36
  tableId: className,
25
37
  record: data,
26
38
  }),
27
39
  update: (id, data) => getSdkCall()(integrationId, className, 'update', {
40
+ baseId: getBaseId(),
28
41
  tableId: className,
29
42
  id,
30
43
  record: data,
31
44
  }),
32
45
  delete: (id) => getSdkCall()(integrationId, className, 'delete', {
46
+ baseId: getBaseId(),
33
47
  tableId: className,
34
48
  id,
35
49
  }),
36
50
  bulkCreate: (records) => getSdkCall()(integrationId, className, 'bulkCreate', {
51
+ baseId: getBaseId(),
37
52
  tableId: className,
38
53
  records,
39
54
  }),
40
55
  };
41
56
  }
42
57
  function createSqlClient(integrationId) {
43
- return (params) => getSdkCall()(integrationId, 'Db', 'executeSql', params);
58
+ return (params) => getSdkCall()(integrationId, 'Db', 'executeSql', { baseId: getBaseId(), ...params });
44
59
  }
45
60
  var index_js_1 = require("../caller/index.js");
46
61
  Object.defineProperty(exports, "createCaller", { enumerable: true, get: function () { return index_js_1.createCaller; } });
@@ -37,7 +37,7 @@ export function createCaller(endpoint, name, flowId) {
37
37
  ...(token ? { Authorization: `Bearer ${token}` } : {}),
38
38
  'Content-Type': 'application/json',
39
39
  },
40
- body: JSON.stringify({ ...input, mode: 'preview', usageToken: token }),
40
+ body: JSON.stringify({ inputs: input, mode: 'preview', usageToken: token }),
41
41
  });
42
42
  if (!res.ok) {
43
43
  const text = await res.text().catch(() => '');
@@ -5,36 +5,51 @@ function getSdkCall() {
5
5
  }
6
6
  return fn;
7
7
  }
8
+ function getBaseId() {
9
+ try {
10
+ return globalThis.__ZITE_EXECUTION_CONFIG__?.baseId
11
+ ?? (typeof process !== 'undefined' ? process.env?.ZITE_BASE_ID : undefined);
12
+ }
13
+ catch {
14
+ return undefined;
15
+ }
16
+ }
8
17
  export function createTableClient(integrationId, className) {
9
18
  return {
10
19
  findAll: (options) => getSdkCall()(integrationId, className, 'findAll', {
20
+ baseId: getBaseId(),
11
21
  tableId: className,
12
22
  ...options,
13
23
  }),
14
24
  findOne: (recordId) => getSdkCall()(integrationId, className, 'findOne', {
25
+ baseId: getBaseId(),
15
26
  tableId: className,
16
27
  ...(typeof recordId === 'string' ? { id: recordId } : recordId),
17
28
  }),
18
29
  create: (data) => getSdkCall()(integrationId, className, 'create', {
30
+ baseId: getBaseId(),
19
31
  tableId: className,
20
32
  record: data,
21
33
  }),
22
34
  update: (id, data) => getSdkCall()(integrationId, className, 'update', {
35
+ baseId: getBaseId(),
23
36
  tableId: className,
24
37
  id,
25
38
  record: data,
26
39
  }),
27
40
  delete: (id) => getSdkCall()(integrationId, className, 'delete', {
41
+ baseId: getBaseId(),
28
42
  tableId: className,
29
43
  id,
30
44
  }),
31
45
  bulkCreate: (records) => getSdkCall()(integrationId, className, 'bulkCreate', {
46
+ baseId: getBaseId(),
32
47
  tableId: className,
33
48
  records,
34
49
  }),
35
50
  };
36
51
  }
37
52
  export function createSqlClient(integrationId) {
38
- return (params) => getSdkCall()(integrationId, 'Db', 'executeSql', params);
53
+ return (params) => getSdkCall()(integrationId, 'Db', 'executeSql', { baseId: getBaseId(), ...params });
39
54
  }
40
55
  export { createCaller } from '../caller/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.30",
3
+ "version": "0.9.32",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/runtime/index.js",