@zveltio/sdk 3.0.0-beta.1 → 3.0.0-beta.100

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.
Files changed (151) hide show
  1. package/README.md +17 -4
  2. package/dist/client.d.ts +103 -7
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +117 -27
  5. package/dist/core.d.ts.map +1 -1
  6. package/dist/core.js +21 -3
  7. package/dist/crdt.d.ts.map +1 -1
  8. package/dist/crdt.js +11 -2
  9. package/dist/ddl/index.d.ts +20 -0
  10. package/dist/ddl/index.d.ts.map +1 -1
  11. package/dist/errors.d.ts +58 -0
  12. package/dist/errors.d.ts.map +1 -0
  13. package/dist/errors.js +124 -0
  14. package/dist/extension/action-refusal.d.ts +27 -0
  15. package/dist/extension/action-refusal.d.ts.map +1 -0
  16. package/dist/extension/action-refusal.js +29 -0
  17. package/dist/extension/capabilities.d.ts +71 -0
  18. package/dist/extension/capabilities.d.ts.map +1 -0
  19. package/dist/extension/capabilities.js +79 -0
  20. package/dist/extension/dates.d.ts +7 -0
  21. package/dist/extension/dates.d.ts.map +1 -0
  22. package/dist/extension/dates.js +14 -0
  23. package/dist/extension/index.d.ts +1086 -38
  24. package/dist/extension/index.d.ts.map +1 -1
  25. package/dist/extension/index.js +16 -0
  26. package/dist/extension/jsonb.d.ts +62 -0
  27. package/dist/extension/jsonb.d.ts.map +1 -0
  28. package/dist/extension/jsonb.js +64 -0
  29. package/dist/extension/multipart.d.ts +58 -0
  30. package/dist/extension/multipart.d.ts.map +1 -0
  31. package/dist/extension/multipart.js +61 -0
  32. package/dist/extension/numeric.d.ts +94 -0
  33. package/dist/extension/numeric.d.ts.map +1 -0
  34. package/dist/extension/numeric.js +162 -0
  35. package/dist/extension/permission-gate.d.ts +15 -0
  36. package/dist/extension/permission-gate.d.ts.map +1 -1
  37. package/dist/extension/permission-gate.js +33 -1
  38. package/dist/extension/reserved-paths.d.ts +10 -0
  39. package/dist/extension/reserved-paths.d.ts.map +1 -0
  40. package/dist/extension/reserved-paths.js +23 -0
  41. package/dist/index.d.ts +3 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +1 -0
  44. package/dist/local-store.d.ts +14 -1
  45. package/dist/local-store.d.ts.map +1 -1
  46. package/dist/local-store.js +92 -13
  47. package/dist/offline/index.d.ts +25 -55
  48. package/dist/offline/index.d.ts.map +1 -1
  49. package/dist/offline/index.js +173 -157
  50. package/dist/publish/index.d.ts.map +1 -1
  51. package/dist/publish/index.js +6 -1
  52. package/dist/realtime.d.ts +25 -1
  53. package/dist/realtime.d.ts.map +1 -1
  54. package/dist/realtime.js +47 -3
  55. package/dist/rpc/index.d.ts.map +1 -1
  56. package/dist/rpc/index.js +2 -0
  57. package/dist/schema-codegen.d.ts +25 -1
  58. package/dist/schema-codegen.d.ts.map +1 -1
  59. package/dist/schema-codegen.js +141 -7
  60. package/dist/schema-watcher.d.ts +10 -2
  61. package/dist/schema-watcher.d.ts.map +1 -1
  62. package/dist/schema-watcher.js +25 -10
  63. package/dist/studio/index.d.ts +1 -0
  64. package/dist/studio/index.d.ts.map +1 -1
  65. package/dist/studio/index.js +3 -0
  66. package/dist/studio/slot-owner-registry.d.ts +13 -0
  67. package/dist/studio/slot-owner-registry.d.ts.map +1 -0
  68. package/dist/studio/slot-owner-registry.js +21 -0
  69. package/dist/svelte.d.ts +1 -1
  70. package/dist/svelte.d.ts.map +1 -1
  71. package/dist/svelte.js +4 -2
  72. package/dist/sync-manager.d.ts +49 -4
  73. package/dist/sync-manager.d.ts.map +1 -1
  74. package/dist/sync-manager.js +173 -15
  75. package/dist/testing/index.d.ts.map +1 -1
  76. package/dist/testing/index.js +23 -1
  77. package/dist/testing/with-test-db.d.ts +1 -1
  78. package/dist/testing/with-test-db.d.ts.map +1 -1
  79. package/dist/testing/with-test-db.js +22 -15
  80. package/dist/tests/action-refusal.test.d.ts +2 -0
  81. package/dist/tests/action-refusal.test.d.ts.map +1 -0
  82. package/dist/tests/action-refusal.test.js +13 -0
  83. package/dist/tests/client.test.d.ts +2 -0
  84. package/dist/tests/client.test.d.ts.map +1 -0
  85. package/dist/tests/client.test.js +164 -0
  86. package/dist/tests/crdt-orset.test.d.ts +2 -0
  87. package/dist/tests/crdt-orset.test.d.ts.map +1 -0
  88. package/dist/tests/crdt-orset.test.js +23 -0
  89. package/dist/tests/local-store.test.js +44 -0
  90. package/dist/tests/migration-parse.test.d.ts +2 -0
  91. package/dist/tests/migration-parse.test.d.ts.map +1 -0
  92. package/dist/tests/migration-parse.test.js +17 -0
  93. package/dist/tests/multipart.test.d.ts +2 -0
  94. package/dist/tests/multipart.test.d.ts.map +1 -0
  95. package/dist/tests/multipart.test.js +37 -0
  96. package/dist/tests/offline-provider-crdt.test.d.ts +2 -0
  97. package/dist/tests/offline-provider-crdt.test.d.ts.map +1 -0
  98. package/dist/tests/offline-provider-crdt.test.js +206 -0
  99. package/dist/tests/realtime.test.d.ts +2 -0
  100. package/dist/tests/realtime.test.d.ts.map +1 -0
  101. package/dist/tests/realtime.test.js +220 -0
  102. package/dist/tests/reserved-paths.test.d.ts +2 -0
  103. package/dist/tests/reserved-paths.test.d.ts.map +1 -0
  104. package/dist/tests/reserved-paths.test.js +21 -0
  105. package/dist/tests/sync-manager.test.d.ts +2 -0
  106. package/dist/tests/sync-manager.test.d.ts.map +1 -0
  107. package/dist/tests/sync-manager.test.js +123 -0
  108. package/dist/tests/today-in.test.d.ts +2 -0
  109. package/dist/tests/today-in.test.d.ts.map +1 -0
  110. package/dist/tests/today-in.test.js +14 -0
  111. package/dist/tests/validate-manifest-actions.test.d.ts +2 -0
  112. package/dist/tests/validate-manifest-actions.test.d.ts.map +1 -0
  113. package/dist/tests/validate-manifest-actions.test.js +82 -0
  114. package/dist/tests/validate-manifest-dependencies.test.d.ts +2 -0
  115. package/dist/tests/validate-manifest-dependencies.test.d.ts.map +1 -0
  116. package/dist/tests/validate-manifest-dependencies.test.js +27 -0
  117. package/dist/tests/validate-manifest-forward-credentials.test.d.ts +2 -0
  118. package/dist/tests/validate-manifest-forward-credentials.test.d.ts.map +1 -0
  119. package/dist/tests/validate-manifest-forward-credentials.test.js +35 -0
  120. package/dist/tests/validate-sdui-data-endpoints.test.d.ts +2 -0
  121. package/dist/tests/validate-sdui-data-endpoints.test.d.ts.map +1 -0
  122. package/dist/tests/validate-sdui-data-endpoints.test.js +41 -0
  123. package/dist/tests/with-test-db.test.d.ts +2 -0
  124. package/dist/tests/with-test-db.test.d.ts.map +1 -0
  125. package/dist/tests/with-test-db.test.js +57 -0
  126. package/dist/types/index.d.ts.map +1 -1
  127. package/dist/validate/index.d.ts +53 -0
  128. package/dist/validate/index.d.ts.map +1 -1
  129. package/dist/validate/index.js +693 -7
  130. package/dist/validate/migration-parse.d.ts +10 -5
  131. package/dist/validate/migration-parse.d.ts.map +1 -1
  132. package/dist/validate/migration-parse.js +1 -1
  133. package/dist/validate/shared-message-keys.d.ts +16 -0
  134. package/dist/validate/shared-message-keys.d.ts.map +1 -0
  135. package/dist/validate/shared-message-keys.js +227 -0
  136. package/package.json +8 -8
  137. package/dist/client/Auth.d.ts +0 -19
  138. package/dist/client/Auth.d.ts.map +0 -1
  139. package/dist/client/Auth.js +0 -45
  140. package/dist/client/QueryBuilder.d.ts +0 -17
  141. package/dist/client/QueryBuilder.d.ts.map +0 -1
  142. package/dist/client/QueryBuilder.js +0 -85
  143. package/dist/client/RealtimeClient.d.ts +0 -22
  144. package/dist/client/RealtimeClient.d.ts.map +0 -1
  145. package/dist/client/RealtimeClient.js +0 -98
  146. package/dist/client/ZveltioClient.d.ts +0 -20
  147. package/dist/client/ZveltioClient.d.ts.map +0 -1
  148. package/dist/client/ZveltioClient.js +0 -78
  149. package/dist/generate-types.d.ts +0 -37
  150. package/dist/generate-types.d.ts.map +0 -1
  151. package/dist/generate-types.js +0 -157
@@ -26,6 +26,36 @@
26
26
  *
27
27
  * Place AFTER the auth-guard middleware that sets `c.set('user', ...)`.
28
28
  */
29
+ async function refuse(ctx, c, resource, action) {
30
+ let denial = null;
31
+ try {
32
+ denial = (await ctx.describeDenial?.(resource, action)) ?? null;
33
+ }
34
+ catch {
35
+ /* the refusal matters more than the suggestion */
36
+ }
37
+ const names = denial?.canGrant.map((g) => g.name) ?? [];
38
+ const who = names.length === 0
39
+ ? 'An administrator of this workspace'
40
+ : names.length === 1
41
+ ? names[0]
42
+ : `${names.slice(0, -1).join(', ')} or ${names[names.length - 1]}`;
43
+ const what = denial?.confidential
44
+ ? `${resource} is confidential`
45
+ : `you do not have access to ${resource}`;
46
+ const detail = names.length === 0 ? `${what}. ${who} can grant it.` : `${what}. ${who} can give you access.`;
47
+ return c.json({
48
+ type: 'about:blank',
49
+ title: 'Forbidden',
50
+ status: 403,
51
+ code: 'permission_required',
52
+ detail,
53
+ resource,
54
+ action,
55
+ confidential: denial?.confidential ?? false,
56
+ can_grant: names.map((name) => ({ name })),
57
+ }, 403);
58
+ }
29
59
  function methodToAction(method) {
30
60
  const m = method.toUpperCase();
31
61
  switch (m) {
@@ -56,10 +86,12 @@ function methodToAction(method) {
56
86
  * Strict (default) is the secure posture and what the SDK ships with.
57
87
  */
58
88
  function rbacMode() {
89
+ // biome-ignore lint/suspicious/noExplicitAny: legacy any; tracked in hardening plan item H-01
59
90
  const v = globalThis.process?.env?.EXTENSION_RBAC;
60
91
  return v === 'permissive' ? 'permissive' : 'strict';
61
92
  }
62
93
  export function permissionGate(ctx, resource, opts = {}) {
94
+ // biome-ignore lint/suspicious/noExplicitAny: legacy any; tracked in hardening plan item H-01
63
95
  return async (c, next) => {
64
96
  // CORS preflight (OPTIONS) must never be authorization-gated —
65
97
  // browsers send it without credentials and a 401/403 here breaks
@@ -86,7 +118,7 @@ export function permissionGate(ctx, resource, opts = {}) {
86
118
  await next();
87
119
  return;
88
120
  }
89
- return c.json({ error: `Forbidden: missing ${resource}:${action} permission` }, 403);
121
+ return refuse(ctx, c, resource, action);
90
122
  }
91
123
  await next();
92
124
  };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * First path segments the engine and the App own: no extension may mint a public
3
+ * URL under them (a site page slug, a base path). `content/pages` refuses a slug
4
+ * that starts with one; any extension that mints public URLs reads this list.
5
+ * Root files (`robots.txt`, `sitemap.xml`, `favicon.*`) are reserved too.
6
+ */
7
+ export declare const RESERVED_PATH_SEGMENTS: readonly string[];
8
+ /** Whether `path` (`/admin/x`, `admin`, `favicon.ico`) starts with a reserved segment. */
9
+ export declare function isReservedPath(path: string): boolean;
10
+ //# sourceMappingURL=reserved-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reserved-paths.d.ts","sourceRoot":"","sources":["../../src/extension/reserved-paths.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAWlD,CAAC;AAEH,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * First path segments the engine and the App own: no extension may mint a public
3
+ * URL under them (a site page slug, a base path). `content/pages` refuses a slug
4
+ * that starts with one; any extension that mints public URLs reads this list.
5
+ * Root files (`robots.txt`, `sitemap.xml`, `favicon.*`) are reserved too.
6
+ */
7
+ export const RESERVED_PATH_SEGMENTS = Object.freeze([
8
+ 'api',
9
+ 'ext',
10
+ 'admin',
11
+ 'app',
12
+ 'auth',
13
+ '_app',
14
+ '_server',
15
+ '.well-known',
16
+ 'robots.txt',
17
+ 'sitemap.xml',
18
+ ]);
19
+ /** Whether `path` (`/admin/x`, `admin`, `favicon.ico`) starts with a reserved segment. */
20
+ export function isReservedPath(path) {
21
+ const first = path.replace(/^\/+/, '').split('/')[0]?.toLowerCase() ?? '';
22
+ return RESERVED_PATH_SEGMENTS.includes(first) || first.startsWith('favicon.');
23
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { ZveltioClient, createZveltioClient } from './client.js';
2
- export type { ZveltioClientConfig, ListParams, ListResult } from './client.js';
2
+ export type { ApiKeySelf, MemberApiKey, MemberApiKeyInput, ZveltioClientConfig, ListParams, ListResult, } from './client.js';
3
+ export { ZveltioApiError, PROBLEM_CONTENT_TYPE } from './errors.js';
4
+ export type { ProblemDetails } from './errors.js';
3
5
  export { ZveltioRealtime } from './realtime.js';
4
6
  export { LocalStore } from './local-store.js';
5
7
  export { SyncManager } from './sync-manager.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { ZveltioClient, createZveltioClient } from './client.js';
2
+ export { ZveltioApiError, PROBLEM_CONTENT_TYPE } from './errors.js';
2
3
  export { ZveltioRealtime } from './realtime.js';
3
4
  export { LocalStore } from './local-store.js';
4
5
  export { SyncManager } from './sync-manager.js';
@@ -51,6 +51,19 @@ export declare class LocalStore {
51
51
  markFailed(queueItemId: string, error: string): Promise<void>;
52
52
  /** Apply data from server (via WebSocket or pull) */
53
53
  applyServerUpdate(collection: string, id: string, data: Record<string, any>, serverVersion: number): Promise<void>;
54
+ /**
55
+ * The server deleted a record: drop the local copy WITHOUT queueing a delete.
56
+ * `delete()` would queue one, echoing the server's own deletion back at it.
57
+ */
58
+ applyServerDelete(collection: string, id: string): Promise<void>;
59
+ /**
60
+ * Drop every copy the server confirmed, keeping local edits not yet pushed
61
+ * (`pending`) and unresolved `conflict`s. For a pull that restarts a
62
+ * collection from nothing: a synced row it does not send again is gone.
63
+ */
64
+ dropSynced(collection: string): Promise<void>;
65
+ getMeta<T>(key: string): Promise<T | undefined>;
66
+ setMeta(key: string, value: unknown): Promise<void>;
54
67
  /** Get records with conflicts for UI resolution */
55
68
  getConflicts(collection?: string): Promise<LocalRecord[]>;
56
69
  /** Resolve a conflict (user decides which version wins) */
@@ -61,7 +74,7 @@ export declare class LocalStore {
61
74
  getPendingBlobs(): Promise<OfflineBlob[]>;
62
75
  /** Delete an offline blob after successful upload */
63
76
  deleteBlob(id: string): Promise<void>;
64
- /** Clear all local data */
77
+ /** Clear all local data; a closed store is opened for it and closed again. */
65
78
  clear(): Promise<void>;
66
79
  close(): Promise<void>;
67
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"local-store.d.ts","sourceRoot":"","sources":["../src/local-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAoD,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAG/F,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CA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E,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAK/C,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzD,mDAAmD;IAC7C,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAW/D,2DAA2D;IACrD,eAAe,CACnB,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EAEV,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC;IA4BhB,wEAAwE;IAClE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAehG,wCAAwC;IAClC,eAAe,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAK/C,qDAAqD;IAC/C,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3C,8EAA8E;IACxE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAatB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
@@ -46,6 +46,7 @@ export class LocalStore {
46
46
  await this.db.put('meta', { key: 'crdt_lamport', value: this.clock.current });
47
47
  }
48
48
  /** Write a local record and add to sync queue */
49
+ // biome-ignore lint/suspicious/noExplicitAny: legacy any; tracked in hardening plan item H-01
49
50
  async put(collection, id, data) {
50
51
  if (!this.db)
51
52
  throw new Error('LocalStore not opened');
@@ -155,14 +156,33 @@ export class LocalStore {
155
156
  }
156
157
  }
157
158
  /** Apply data from server (via WebSocket or pull) */
158
- async applyServerUpdate(collection, id, data, serverVersion) {
159
+ async applyServerUpdate(collection, id,
160
+ // biome-ignore lint/suspicious/noExplicitAny: legacy any; tracked in hardening plan item H-01
161
+ data, serverVersion) {
159
162
  if (!this.db)
160
163
  throw new Error('LocalStore not opened');
161
164
  const existing = (await this.db.get('records', [collection, id]));
162
- // Conflict detection: local has changes not yet confirmed by server
163
- if (existing && existing._localVersion > existing._serverVersion) {
165
+ // Conflict detection: local has changes not yet confirmed by server.
166
+ //
167
+ // `_syncStatus` is the signal that survives contact with the SyncManager.
168
+ // The version comparison alone does not: `syncNow()` and `pull()` both pass
169
+ // `Date.now()` as the server version, because the collections API returns no
170
+ // version column — so after the first ACK `_serverVersion` is an epoch
171
+ // millisecond count while `_localVersion` is still a small counter, and
172
+ // `2 > 1790144009198` is false forever. Every local edit made after that
173
+ // first sync was overwritten in silence: status `synced`, no `_conflictData`,
174
+ // nothing in `getConflicts()`. The unit tests missed it because they hand
175
+ // this method versions on the same scale as the counter (1, 2, 3, 5).
176
+ //
177
+ // The version comparison is kept as a second signal: it still catches the
178
+ // race where an ACK for an earlier operation marks the record synced while a
179
+ // later one is queued.
180
+ if (existing &&
181
+ (existing._syncStatus !== 'synced' || existing._localVersion > existing._serverVersion)) {
164
182
  // CRDT field-level merge if both sides have CRDT docs
183
+ // biome-ignore lint/suspicious/noExplicitAny: legacy any; tracked in hardening plan item H-01
165
184
  if (existing._crdtDoc && data.__crdt) {
185
+ // biome-ignore lint/suspicious/noExplicitAny: legacy any; tracked in hardening plan item H-01
166
186
  const remoteCrdtDoc = data.__crdt;
167
187
  const merged = mergeLWW(existing._crdtDoc, remoteCrdtDoc);
168
188
  const mergedData = fromDocument(merged);
@@ -192,9 +212,47 @@ export class LocalStore {
192
212
  _serverVersion: serverVersion,
193
213
  _syncStatus: 'synced',
194
214
  _updatedAt: Date.now(),
215
+ // Carried over: rebuilding the record from scratch dropped the CRDT
216
+ // document, so the next merge had nothing on the local side to merge with
217
+ // and fell through to the manual-conflict branch.
218
+ ...(existing?._crdtDoc ? { _crdtDoc: existing._crdtDoc } : {}),
195
219
  };
196
220
  await this.db.put('records', record);
197
221
  }
222
+ /**
223
+ * The server deleted a record: drop the local copy WITHOUT queueing a delete.
224
+ * `delete()` would queue one, echoing the server's own deletion back at it.
225
+ */
226
+ async applyServerDelete(collection, id) {
227
+ if (!this.db)
228
+ throw new Error('LocalStore not opened');
229
+ await this.db.delete('records', [collection, id]);
230
+ }
231
+ /**
232
+ * Drop every copy the server confirmed, keeping local edits not yet pushed
233
+ * (`pending`) and unresolved `conflict`s. For a pull that restarts a
234
+ * collection from nothing: a synced row it does not send again is gone.
235
+ */
236
+ async dropSynced(collection) {
237
+ if (!this.db)
238
+ throw new Error('LocalStore not opened');
239
+ const tx = this.db.transaction('records', 'readwrite');
240
+ for (const r of (await tx.store.index('by-collection').getAll(collection))) {
241
+ if (r._syncStatus === 'synced')
242
+ await tx.store.delete([collection, r.id]);
243
+ }
244
+ await tx.done;
245
+ }
246
+ async getMeta(key) {
247
+ if (!this.db)
248
+ throw new Error('LocalStore not opened');
249
+ return (await this.db.get('meta', key))?.value;
250
+ }
251
+ async setMeta(key, value) {
252
+ if (!this.db)
253
+ throw new Error('LocalStore not opened');
254
+ await this.db.put('meta', { key, value });
255
+ }
198
256
  /** Get records with conflicts for UI resolution */
199
257
  async getConflicts(collection) {
200
258
  if (!this.db)
@@ -205,16 +263,35 @@ export class LocalStore {
205
263
  return all;
206
264
  }
207
265
  /** Resolve a conflict (user decides which version wins) */
208
- async resolveConflict(collection, id, resolvedData) {
266
+ async resolveConflict(collection, id,
267
+ // biome-ignore lint/suspicious/noExplicitAny: legacy any; tracked in hardening plan item H-01
268
+ resolvedData) {
209
269
  if (!this.db)
210
270
  throw new Error('LocalStore not opened');
211
271
  const record = (await this.db.get('records', [collection, id]));
212
- if (record) {
213
- record.data = resolvedData;
214
- record._syncStatus = 'pending'; // Re-sync with server
215
- record._localVersion += 1;
216
- await this.db.put('records', record);
217
- }
272
+ if (!record)
273
+ return;
274
+ record.data = resolvedData;
275
+ record._syncStatus = 'pending'; // Re-sync with server
276
+ record._localVersion += 1;
277
+ record._conflictData = undefined;
278
+ // Nothing re-synced it. The status said `pending` and the queue held no
279
+ // operation carrying the resolved data, so a resolution — whether a person
280
+ // chose it in the UI or the CRDT merge produced it — stayed on the device.
281
+ // The only operation for this record was the one the server had already
282
+ // rejected.
283
+ const tx = this.db.transaction(['records', 'sync_queue'], 'readwrite');
284
+ await tx.objectStore('records').put(record);
285
+ await tx.objectStore('sync_queue').add({
286
+ id: `${Date.now()}-${Math.random().toString(36).slice(2)}`,
287
+ collection,
288
+ recordId: id,
289
+ operation: 'update',
290
+ payload: resolvedData,
291
+ attempts: 0,
292
+ createdAt: Date.now(),
293
+ });
294
+ await tx.done;
218
295
  }
219
296
  /** Save an offline blob — returns a temporary ID 'local_blob_<UUID>' */
220
297
  async saveBlob(blob, collection, recordId, field) {
@@ -244,10 +321,12 @@ export class LocalStore {
244
321
  throw new Error('LocalStore not opened');
245
322
  await this.db.delete('offline_blobs', id);
246
323
  }
247
- /** Clear all local data */
324
+ /** Clear all local data; a closed store is opened for it and closed again. */
248
325
  async clear() {
249
- if (!this.db)
250
- throw new Error('LocalStore not opened');
326
+ if (!this.db) {
327
+ await this.open();
328
+ return this.clear().finally(() => this.close());
329
+ }
251
330
  const tx = this.db.transaction(['records', 'sync_queue', 'meta', 'offline_blobs'], 'readwrite');
252
331
  await tx.objectStore('records').clear();
253
332
  await tx.objectStore('sync_queue').clear();
@@ -1,76 +1,48 @@
1
1
  /**
2
2
  * Offline-sync provider abstraction.
3
3
  *
4
- * The SDK ships TWO sync strategies for the Postgres ↔ client-SQLite
4
+ * The SDK ships TWO sync strategies for the Postgres ↔ client store
5
5
  * loop, picked at construction time:
6
6
  *
7
7
  * - **`crdt`** (default) — bespoke field-level Last-Write-Wins merge on
8
- * top of IndexedDB / SQLite via `LocalStore` + `SyncManager`. Works
9
- * offline, applies on reconnect, handles conflicts. No external
10
- * dependency beyond the SDK + engine.
8
+ * top of IndexedDB via `LocalStore` + `SyncManager`. Works offline,
9
+ * applies on reconnect, handles conflicts. No external dependency beyond
10
+ * the SDK + engine. Browser only: there is no store for React Native or
11
+ * Node (no SQLite backend).
11
12
  *
12
- * - **`electric`** — Electric SQL replication. Postgres logical-
13
- * replication slot → Electric service → client. Conflicts are
14
- * resolved server-side via CRDTs Electric implements internally.
15
- * Requires an Electric service running alongside Postgres + the
16
- * engine routes from `routes/electric.ts` that mint short-lived
17
- * JWTs the client uses to authenticate.
13
+ * - **`electric`** — Electric 1.x shapes, served THROUGH the engine:
14
+ * `GET {engineUrl}/api/electric/v1/shape?collection=…`. The engine decides
15
+ * the table, rows and columns from the caller's grants, tenant, row rules
16
+ * and column permissions, and proxies Electric's Shape protocol (initial
17
+ * snapshot, then long-poll `live=true`). Read-only: writes go through the
18
+ * data API, and Electric streams them back. Requires the engine's
19
+ * ELECTRIC_URL + ELECTRIC_SECRET; the client never talks to Electric.
18
20
  *
19
- * Auth flow for the electric provider
20
- * -----------------------------------
21
- * 1. Provider calls `POST {engineUrl}/api/electric/auth` (with
22
- * credentials; the engine reads the better-auth session).
23
- * 2. Engine returns `{ token, expiresAt, electricUrl }`.
24
- * 3. Provider opens a websocket to `${electricUrl}?token=<jwt>`.
25
- * 4. Before each token expires, the provider re-requests a fresh one
26
- * (no user interaction).
27
- *
28
- * Pull/push semantics
29
- * -------------------
30
- * Electric replicates continuously over the websocket — there's no
31
- * explicit "pull" call. The provider's `pull()` is a no-op that returns
32
- * once the initial sync handshake completes. `push()` is the same: local
33
- * writes go through Electric's normal replication path automatically.
34
- * Both shims exist so the OfflineProvider interface stays uniform across
35
- * crdt/electric.
36
- *
37
- * Subscriptions
38
- * -------------
39
- * `subscribe('zvd_contacts', cb)` registers a callback fired whenever
40
- * Electric pushes a change for that table. The implementation uses the
41
- * websocket's `message` event with a routing table; one socket, many
42
- * subscriptions.
21
+ * `subscribe('contacts', cb)` keeps one live shape per collection and calls
22
+ * `cb` with every current row after each change. `pull()` brings each of
23
+ * `tables` up to date once.
43
24
  */
44
25
  export type OfflineProviderKind = 'crdt' | 'electric';
45
26
  export interface OfflineProviderConfig {
46
27
  /** Which sync engine to use. Default: 'crdt'. */
47
28
  provider?: OfflineProviderKind;
48
- /** Engine base URL — used for the token-mint call AND CRDT push/pull. */
29
+ /** Engine base URL — for CRDT push/pull and the Electric shape endpoint. */
49
30
  engineUrl: string;
50
- /**
51
- * Override the Electric websocket URL. When omitted, the provider asks
52
- * the engine via `GET /api/electric/config` so operators have a single
53
- * place to configure it. Useful for tests + dev setups.
54
- */
55
- electricUrl?: string;
56
- /**
57
- * Tables to record on the audit token claim. Does NOT restrict what
58
- * Electric replicates — Electric enforces that via its own config.
59
- */
31
+ /** Collections to replicate. */
60
32
  tables?: string[];
61
33
  /**
62
34
  * Override the `fetch` impl — handy for tests + SSR. Default: globalThis.fetch.
63
35
  */
64
36
  fetch?: typeof fetch;
65
37
  /**
66
- * Override the WebSocket constructor — handy for tests + non-browser
67
- * runtimes. Default: globalThis.WebSocket.
38
+ * Extra request headers for the Electric shape requests — an `X-API-Key` or
39
+ * `X-Tenant-Slug`. A browser session's cookie is sent without this.
68
40
  */
69
- websocket?: typeof WebSocket;
41
+ headers?: Record<string, string>;
70
42
  }
71
43
  /**
72
- * Public interface every provider implements. Today the CRDT provider
73
- * wraps `SyncManager`; the Electric provider wraps a websocket. Both
44
+ * Public interface every provider implements. The CRDT provider wraps
45
+ * `SyncManager`; the Electric provider follows the engine's shape endpoint. Both
74
46
  * expose the same surface.
75
47
  */
76
48
  export interface OfflineProvider {
@@ -95,11 +67,9 @@ export declare class ElectricUnavailable extends Error {
95
67
  *
96
68
  * For `crdt` (default): returns a thin adapter around `SyncManager`.
97
69
  *
98
- * For `electric`: returns the real Electric provider. Throws
99
- * `ElectricNotConfigured` synchronously when required config is missing
100
- * (no electricUrl AND no way to discover one), or `ElectricUnavailable`
101
- * lazily on the first network op when the engine reports Electric is
102
- * disabled.
70
+ * For `electric`: syncs `tables` once before resolving. Throws
71
+ * `ElectricNotConfigured` when there is no `fetch`, and `ElectricUnavailable`
72
+ * when the engine refuses a shape (401, 403, 409 with its reason, 503).
103
73
  */
104
74
  export declare function createOfflineProvider(config: OfflineProviderConfig): Promise<OfflineProvider>;
105
75
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/offline/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,uEAAuE;IACvE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,0EAA0E;IAC1E,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,uEAAuE;IACvE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACpE,gDAAgD;IAChD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,MAAM,EAAE,MAAM;CAQ3B;AAED,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,MAAM,EAAE,MAAM;CAQ3B;AAED;;;;;;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