zitejs 0.9.57 → 0.9.59

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.
@@ -65,6 +65,9 @@ function buildFetchOptions(name, input, extra) {
65
65
  mode: getMode(),
66
66
  usageToken: token,
67
67
  ...(ziteAuthToken ? { ziteAuthToken } : {}),
68
+ ...(typeof window !== "undefined" && window.__ziteSnapshotId
69
+ ? { snapshotId: window.__ziteSnapshotId }
70
+ : {}),
68
71
  ...extra,
69
72
  }),
70
73
  },
@@ -0,0 +1,14 @@
1
+ export type ZiteProjectUser = {
2
+ uuid: string;
3
+ firstName: string | null;
4
+ lastName: string | null;
5
+ email: string;
6
+ profilePictureUrl: string | null;
7
+ };
8
+ export type MetaListUsersResult = {
9
+ users: ZiteProjectUser[];
10
+ };
11
+ export declare class ZiteMeta {
12
+ static listUsers(): Promise<MetaListUsersResult>;
13
+ }
14
+ export declare const Meta: typeof ZiteMeta;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Meta = exports.ZiteMeta = void 0;
4
+ const sdkCall_js_1 = require("../internal/sdkCall.js");
5
+ const META_SDK_INTEGRATION_ID = '__meta__';
6
+ class ZiteMeta {
7
+ static listUsers() {
8
+ return (0, sdkCall_js_1.getSdkCall)()(META_SDK_INTEGRATION_ID, 'ZiteMeta', 'listUsers', {});
9
+ }
10
+ }
11
+ exports.ZiteMeta = ZiteMeta;
12
+ exports.Meta = ZiteMeta;
@@ -0,0 +1,38 @@
1
+ export type NotificationLink = {
2
+ type: 'record';
3
+ basePublicId: string;
4
+ tableId: string;
5
+ recordId: string;
6
+ } | {
7
+ type: 'app';
8
+ appId: string;
9
+ path?: string;
10
+ params?: Record<string, string>;
11
+ } | {
12
+ type: 'route';
13
+ path: string;
14
+ } | {
15
+ type: 'external';
16
+ url: string;
17
+ };
18
+ export type NotificationsCreateParams = {
19
+ recipients: string[];
20
+ title: string;
21
+ body?: string;
22
+ link?: NotificationLink;
23
+ path?: string;
24
+ params?: Record<string, string>;
25
+ payload?: Record<string, unknown>;
26
+ idempotencyKey?: string;
27
+ };
28
+ export type NotificationsCreateResult = {
29
+ created: number;
30
+ } | {
31
+ created: 0;
32
+ preview: true;
33
+ wouldCreate: number;
34
+ };
35
+ export declare class ZiteNotifications {
36
+ static create(params: NotificationsCreateParams): Promise<NotificationsCreateResult>;
37
+ }
38
+ export declare const Notifications: typeof ZiteNotifications;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Notifications = exports.ZiteNotifications = void 0;
4
+ const sdkCall_js_1 = require("../internal/sdkCall.js");
5
+ const NOTIFICATIONS_SDK_INTEGRATION_ID = '__notifications__';
6
+ class ZiteNotifications {
7
+ static create(params) {
8
+ return (0, sdkCall_js_1.getSdkCall)()(NOTIFICATIONS_SDK_INTEGRATION_ID, 'ZiteNotifications', 'create', params);
9
+ }
10
+ }
11
+ exports.ZiteNotifications = ZiteNotifications;
12
+ exports.Notifications = ZiteNotifications;
@@ -1,3 +1,5 @@
1
+ import type { NotificationsCreateParams, NotificationsCreateResult } from "../notifications/index.js";
2
+ import type { MetaListUsersResult } from "../meta/index.js";
1
3
  export interface TableClient<T> {
2
4
  findAll(options?: {
3
5
  limit?: number;
@@ -65,5 +67,13 @@ export interface AirtableTableClient<T> {
65
67
  }>;
66
68
  }
67
69
  export declare function createAirtableClient<T>(integrationId: string, className: string, implicitParams: Record<string, unknown>): AirtableTableClient<T>;
70
+ export declare function createNotificationsClient(): {
71
+ create(params: NotificationsCreateParams): Promise<NotificationsCreateResult>;
72
+ };
73
+ export declare function createMetaClient(): {
74
+ listUsers(): Promise<MetaListUsersResult>;
75
+ };
76
+ export type { NotificationLink, NotificationsCreateParams, NotificationsCreateResult, } from "../notifications/index.js";
77
+ export type { MetaListUsersResult, ZiteProjectUser } from "../meta/index.js";
68
78
  export { createCaller } from "../caller/index.js";
69
79
  export type { EndpointConfig } from "../caller/index.js";
@@ -4,6 +4,8 @@ exports.createCaller = void 0;
4
4
  exports.createTableClient = createTableClient;
5
5
  exports.createSqlClient = createSqlClient;
6
6
  exports.createAirtableClient = createAirtableClient;
7
+ exports.createNotificationsClient = createNotificationsClient;
8
+ exports.createMetaClient = createMetaClient;
7
9
  const sdkCall_js_1 = require("../internal/sdkCall.js");
8
10
  const DB_INTEGRATION_ID = "databases";
9
11
  function getBaseId() {
@@ -100,5 +102,17 @@ function createAirtableClient(integrationId, className, implicitParams) {
100
102
  }),
101
103
  };
102
104
  }
105
+ const NOTIFICATIONS_SDK_INTEGRATION_ID = "__notifications__";
106
+ const META_SDK_INTEGRATION_ID = "__meta__";
107
+ function createNotificationsClient() {
108
+ return {
109
+ create: (params) => (0, sdkCall_js_1.getSdkCall)()(NOTIFICATIONS_SDK_INTEGRATION_ID, "ZiteNotifications", "create", params),
110
+ };
111
+ }
112
+ function createMetaClient() {
113
+ return {
114
+ listUsers: () => (0, sdkCall_js_1.getSdkCall)()(META_SDK_INTEGRATION_ID, "ZiteMeta", "listUsers", {}),
115
+ };
116
+ }
103
117
  var index_js_1 = require("../caller/index.js");
104
118
  Object.defineProperty(exports, "createCaller", { enumerable: true, get: function () { return index_js_1.createCaller; } });
@@ -204,6 +204,43 @@ function generateSchema(database, existingSchema) {
204
204
  }
205
205
  return { tables };
206
206
  }
207
+ function generateSentinelSdkTypes() {
208
+ return [
209
+ "export type NotificationLink =",
210
+ " | { type: 'record'; basePublicId: string; tableId: string; recordId: string }",
211
+ " | { type: 'app'; appId: string; path?: string; params?: Record<string, string> }",
212
+ " | { type: 'route'; path: string }",
213
+ " | { type: 'external'; url: string };",
214
+ "",
215
+ "export interface NotificationsCreateParams {",
216
+ " recipients: string[];",
217
+ " title: string;",
218
+ " body?: string;",
219
+ " link?: NotificationLink;",
220
+ " path?: string;",
221
+ " params?: Record<string, string>;",
222
+ " payload?: Record<string, unknown>;",
223
+ " idempotencyKey?: string;",
224
+ "}",
225
+ "",
226
+ "export type NotificationsCreateResult =",
227
+ " | { created: number }",
228
+ " | { created: 0; preview: true; wouldCreate: number };",
229
+ "",
230
+ "export interface ZiteProjectUser {",
231
+ " uuid: string;",
232
+ " firstName: string | null;",
233
+ " lastName: string | null;",
234
+ " email: string;",
235
+ " profilePictureUrl: string | null;",
236
+ "}",
237
+ "",
238
+ "export interface MetaListUsersResult {",
239
+ " users: ZiteProjectUser[];",
240
+ "}",
241
+ "",
242
+ ];
243
+ }
207
244
  /**
208
245
  * Generate .zite/db.ts purely from ZiteSchema.
209
246
  * Pure function — no external data needed beyond what's in the schema file.
@@ -240,7 +277,7 @@ function generateDbTs(schema) {
240
277
  lines.push("// - Soft-deleted rows are excluded automatically — no WHERE deleted_at IS NULL");
241
278
  lines.push("// - SELECT only — use .create/.update/.delete for writes");
242
279
  lines.push('// - Load the "zite:sql" skill for full SQL reference (formulas, lookups, etc.)');
243
- lines.push("import { createTableClient, createSqlClient } from 'zitejs/runtime';");
280
+ lines.push("import { createTableClient, createSqlClient, createNotificationsClient, createMetaClient } from 'zitejs/runtime';");
244
281
  lines.push("");
245
282
  for (const table of schema.tables) {
246
283
  const className = toPascalCase(table.sdkName);
@@ -260,12 +297,15 @@ function generateDbTs(schema) {
260
297
  lines.push("};");
261
298
  lines.push("");
262
299
  }
300
+ lines.push(...generateSentinelSdkTypes());
263
301
  lines.push("export const zite = {");
264
302
  for (const table of schema.tables) {
265
303
  const className = toPascalCase(table.sdkName);
266
304
  lines.push(` ${table.sdkName}: createTableClient<${className}RecordType>('${className}'),`);
267
305
  }
268
306
  lines.push(` sql: createSqlClient(),`);
307
+ lines.push(` notifications: createNotificationsClient(),`);
308
+ lines.push(` meta: createMetaClient(),`);
269
309
  lines.push("};");
270
310
  lines.push("");
271
311
  return lines.join("\n");
@@ -61,6 +61,9 @@ function buildFetchOptions(name, input, extra) {
61
61
  mode: getMode(),
62
62
  usageToken: token,
63
63
  ...(ziteAuthToken ? { ziteAuthToken } : {}),
64
+ ...(typeof window !== "undefined" && window.__ziteSnapshotId
65
+ ? { snapshotId: window.__ziteSnapshotId }
66
+ : {}),
64
67
  ...extra,
65
68
  }),
66
69
  },
@@ -0,0 +1,14 @@
1
+ export type ZiteProjectUser = {
2
+ uuid: string;
3
+ firstName: string | null;
4
+ lastName: string | null;
5
+ email: string;
6
+ profilePictureUrl: string | null;
7
+ };
8
+ export type MetaListUsersResult = {
9
+ users: ZiteProjectUser[];
10
+ };
11
+ export declare class ZiteMeta {
12
+ static listUsers(): Promise<MetaListUsersResult>;
13
+ }
14
+ export declare const Meta: typeof ZiteMeta;
@@ -0,0 +1,8 @@
1
+ import { getSdkCall } from '../internal/sdkCall.js';
2
+ const META_SDK_INTEGRATION_ID = '__meta__';
3
+ export class ZiteMeta {
4
+ static listUsers() {
5
+ return getSdkCall()(META_SDK_INTEGRATION_ID, 'ZiteMeta', 'listUsers', {});
6
+ }
7
+ }
8
+ export const Meta = ZiteMeta;
@@ -0,0 +1,38 @@
1
+ export type NotificationLink = {
2
+ type: 'record';
3
+ basePublicId: string;
4
+ tableId: string;
5
+ recordId: string;
6
+ } | {
7
+ type: 'app';
8
+ appId: string;
9
+ path?: string;
10
+ params?: Record<string, string>;
11
+ } | {
12
+ type: 'route';
13
+ path: string;
14
+ } | {
15
+ type: 'external';
16
+ url: string;
17
+ };
18
+ export type NotificationsCreateParams = {
19
+ recipients: string[];
20
+ title: string;
21
+ body?: string;
22
+ link?: NotificationLink;
23
+ path?: string;
24
+ params?: Record<string, string>;
25
+ payload?: Record<string, unknown>;
26
+ idempotencyKey?: string;
27
+ };
28
+ export type NotificationsCreateResult = {
29
+ created: number;
30
+ } | {
31
+ created: 0;
32
+ preview: true;
33
+ wouldCreate: number;
34
+ };
35
+ export declare class ZiteNotifications {
36
+ static create(params: NotificationsCreateParams): Promise<NotificationsCreateResult>;
37
+ }
38
+ export declare const Notifications: typeof ZiteNotifications;
@@ -0,0 +1,8 @@
1
+ import { getSdkCall } from '../internal/sdkCall.js';
2
+ const NOTIFICATIONS_SDK_INTEGRATION_ID = '__notifications__';
3
+ export class ZiteNotifications {
4
+ static create(params) {
5
+ return getSdkCall()(NOTIFICATIONS_SDK_INTEGRATION_ID, 'ZiteNotifications', 'create', params);
6
+ }
7
+ }
8
+ export const Notifications = ZiteNotifications;
@@ -1,3 +1,5 @@
1
+ import type { NotificationsCreateParams, NotificationsCreateResult } from "../notifications/index.js";
2
+ import type { MetaListUsersResult } from "../meta/index.js";
1
3
  export interface TableClient<T> {
2
4
  findAll(options?: {
3
5
  limit?: number;
@@ -65,5 +67,13 @@ export interface AirtableTableClient<T> {
65
67
  }>;
66
68
  }
67
69
  export declare function createAirtableClient<T>(integrationId: string, className: string, implicitParams: Record<string, unknown>): AirtableTableClient<T>;
70
+ export declare function createNotificationsClient(): {
71
+ create(params: NotificationsCreateParams): Promise<NotificationsCreateResult>;
72
+ };
73
+ export declare function createMetaClient(): {
74
+ listUsers(): Promise<MetaListUsersResult>;
75
+ };
76
+ export type { NotificationLink, NotificationsCreateParams, NotificationsCreateResult, } from "../notifications/index.js";
77
+ export type { MetaListUsersResult, ZiteProjectUser } from "../meta/index.js";
68
78
  export { createCaller } from "../caller/index.js";
69
79
  export type { EndpointConfig } from "../caller/index.js";
@@ -94,4 +94,16 @@ export function createAirtableClient(integrationId, className, implicitParams) {
94
94
  }),
95
95
  };
96
96
  }
97
+ const NOTIFICATIONS_SDK_INTEGRATION_ID = "__notifications__";
98
+ const META_SDK_INTEGRATION_ID = "__meta__";
99
+ export function createNotificationsClient() {
100
+ return {
101
+ create: (params) => getSdkCall()(NOTIFICATIONS_SDK_INTEGRATION_ID, "ZiteNotifications", "create", params),
102
+ };
103
+ }
104
+ export function createMetaClient() {
105
+ return {
106
+ listUsers: () => getSdkCall()(META_SDK_INTEGRATION_ID, "ZiteMeta", "listUsers", {}),
107
+ };
108
+ }
97
109
  export { createCaller } from "../caller/index.js";
@@ -193,6 +193,43 @@ export function generateSchema(database, existingSchema) {
193
193
  }
194
194
  return { tables };
195
195
  }
196
+ function generateSentinelSdkTypes() {
197
+ return [
198
+ "export type NotificationLink =",
199
+ " | { type: 'record'; basePublicId: string; tableId: string; recordId: string }",
200
+ " | { type: 'app'; appId: string; path?: string; params?: Record<string, string> }",
201
+ " | { type: 'route'; path: string }",
202
+ " | { type: 'external'; url: string };",
203
+ "",
204
+ "export interface NotificationsCreateParams {",
205
+ " recipients: string[];",
206
+ " title: string;",
207
+ " body?: string;",
208
+ " link?: NotificationLink;",
209
+ " path?: string;",
210
+ " params?: Record<string, string>;",
211
+ " payload?: Record<string, unknown>;",
212
+ " idempotencyKey?: string;",
213
+ "}",
214
+ "",
215
+ "export type NotificationsCreateResult =",
216
+ " | { created: number }",
217
+ " | { created: 0; preview: true; wouldCreate: number };",
218
+ "",
219
+ "export interface ZiteProjectUser {",
220
+ " uuid: string;",
221
+ " firstName: string | null;",
222
+ " lastName: string | null;",
223
+ " email: string;",
224
+ " profilePictureUrl: string | null;",
225
+ "}",
226
+ "",
227
+ "export interface MetaListUsersResult {",
228
+ " users: ZiteProjectUser[];",
229
+ "}",
230
+ "",
231
+ ];
232
+ }
196
233
  /**
197
234
  * Generate .zite/db.ts purely from ZiteSchema.
198
235
  * Pure function — no external data needed beyond what's in the schema file.
@@ -229,7 +266,7 @@ export function generateDbTs(schema) {
229
266
  lines.push("// - Soft-deleted rows are excluded automatically — no WHERE deleted_at IS NULL");
230
267
  lines.push("// - SELECT only — use .create/.update/.delete for writes");
231
268
  lines.push('// - Load the "zite:sql" skill for full SQL reference (formulas, lookups, etc.)');
232
- lines.push("import { createTableClient, createSqlClient } from 'zitejs/runtime';");
269
+ lines.push("import { createTableClient, createSqlClient, createNotificationsClient, createMetaClient } from 'zitejs/runtime';");
233
270
  lines.push("");
234
271
  for (const table of schema.tables) {
235
272
  const className = toPascalCase(table.sdkName);
@@ -249,12 +286,15 @@ export function generateDbTs(schema) {
249
286
  lines.push("};");
250
287
  lines.push("");
251
288
  }
289
+ lines.push(...generateSentinelSdkTypes());
252
290
  lines.push("export const zite = {");
253
291
  for (const table of schema.tables) {
254
292
  const className = toPascalCase(table.sdkName);
255
293
  lines.push(` ${table.sdkName}: createTableClient<${className}RecordType>('${className}'),`);
256
294
  }
257
295
  lines.push(` sql: createSqlClient(),`);
296
+ lines.push(` notifications: createNotificationsClient(),`);
297
+ lines.push(` meta: createMetaClient(),`);
258
298
  lines.push("};");
259
299
  lines.push("");
260
300
  return lines.join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.57",
3
+ "version": "0.9.59",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -62,6 +62,16 @@
62
62
  "import": "./dist/esm/schedules/index.js",
63
63
  "require": "./dist/cjs/schedules/index.js"
64
64
  },
65
+ "./notifications": {
66
+ "types": "./dist/esm/notifications/index.d.ts",
67
+ "import": "./dist/esm/notifications/index.js",
68
+ "require": "./dist/cjs/notifications/index.js"
69
+ },
70
+ "./meta": {
71
+ "types": "./dist/esm/meta/index.d.ts",
72
+ "import": "./dist/esm/meta/index.js",
73
+ "require": "./dist/cjs/meta/index.js"
74
+ },
65
75
  "./sync": {
66
76
  "types": "./dist/esm/sync/index.d.ts",
67
77
  "import": "./dist/esm/sync/index.js",
@@ -109,6 +119,12 @@
109
119
  ],
110
120
  "schedules": [
111
121
  "dist/esm/schedules/index.d.ts"
122
+ ],
123
+ "notifications": [
124
+ "dist/esm/notifications/index.d.ts"
125
+ ],
126
+ "meta": [
127
+ "dist/esm/meta/index.d.ts"
112
128
  ]
113
129
  }
114
130
  },