syncorejs 0.1.0 → 0.2.0

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 (200) hide show
  1. package/dist/{core/src/cli.d.ts → _vendor/cli/app.d.mts} +4 -2
  2. package/dist/_vendor/cli/app.d.mts.map +1 -0
  3. package/dist/_vendor/cli/app.mjs +997 -0
  4. package/dist/_vendor/cli/app.mjs.map +1 -0
  5. package/dist/_vendor/cli/context.mjs +180 -0
  6. package/dist/_vendor/cli/context.mjs.map +1 -0
  7. package/dist/_vendor/cli/dev-session.mjs +49 -0
  8. package/dist/_vendor/cli/dev-session.mjs.map +1 -0
  9. package/dist/_vendor/cli/doctor.mjs +80 -0
  10. package/dist/_vendor/cli/doctor.mjs.map +1 -0
  11. package/dist/_vendor/cli/errors.mjs +22 -0
  12. package/dist/_vendor/cli/errors.mjs.map +1 -0
  13. package/dist/_vendor/cli/help.mjs +26 -0
  14. package/dist/_vendor/cli/help.mjs.map +1 -0
  15. package/dist/_vendor/cli/index.d.mts +2 -0
  16. package/dist/_vendor/cli/index.mjs +23 -0
  17. package/dist/_vendor/cli/index.mjs.map +1 -0
  18. package/dist/_vendor/cli/messages.mjs +32 -0
  19. package/dist/_vendor/cli/messages.mjs.map +1 -0
  20. package/dist/_vendor/cli/preflight.mjs +35 -0
  21. package/dist/_vendor/cli/preflight.mjs.map +1 -0
  22. package/dist/_vendor/cli/project.mjs +583 -0
  23. package/dist/_vendor/cli/project.mjs.map +1 -0
  24. package/dist/_vendor/cli/render.mjs +133 -0
  25. package/dist/_vendor/cli/render.mjs.map +1 -0
  26. package/dist/_vendor/cli/targets.mjs +87 -0
  27. package/dist/_vendor/cli/targets.mjs.map +1 -0
  28. package/dist/_vendor/core/cli.d.mts +59 -1
  29. package/dist/_vendor/core/cli.d.mts.map +1 -1
  30. package/dist/_vendor/core/cli.mjs +528 -75
  31. package/dist/_vendor/core/cli.mjs.map +1 -1
  32. package/dist/_vendor/core/index.d.mts +12 -4
  33. package/dist/_vendor/core/index.d.mts.map +1 -0
  34. package/dist/_vendor/core/index.mjs +4 -3
  35. package/dist/_vendor/core/index.mjs.map +1 -1
  36. package/dist/_vendor/core/runtime/devtools.d.mts +32 -6
  37. package/dist/_vendor/core/runtime/devtools.d.mts.map +1 -1
  38. package/dist/_vendor/core/runtime/devtools.mjs +397 -182
  39. package/dist/_vendor/core/runtime/devtools.mjs.map +1 -1
  40. package/dist/_vendor/core/runtime/functions.mjs.map +1 -1
  41. package/dist/_vendor/core/runtime/runtime.d.mts +89 -7
  42. package/dist/_vendor/core/runtime/runtime.d.mts.map +1 -1
  43. package/dist/_vendor/core/runtime/runtime.mjs +303 -32
  44. package/dist/_vendor/core/runtime/runtime.mjs.map +1 -1
  45. package/dist/_vendor/devtools-protocol/index.d.ts +189 -82
  46. package/dist/_vendor/devtools-protocol/index.d.ts.map +1 -1
  47. package/dist/_vendor/devtools-protocol/index.js +39 -0
  48. package/dist/_vendor/devtools-protocol/index.js.map +1 -0
  49. package/dist/_vendor/next/config.d.ts.map +1 -1
  50. package/dist/_vendor/next/config.js +2 -5
  51. package/dist/_vendor/next/config.js.map +1 -1
  52. package/dist/_vendor/platform-expo/index.d.ts +15 -5
  53. package/dist/_vendor/platform-expo/index.d.ts.map +1 -1
  54. package/dist/_vendor/platform-expo/index.js +33 -3
  55. package/dist/_vendor/platform-expo/index.js.map +1 -1
  56. package/dist/_vendor/platform-expo/react.js.map +1 -1
  57. package/dist/_vendor/platform-node/index.d.mts +10 -5
  58. package/dist/_vendor/platform-node/index.d.mts.map +1 -1
  59. package/dist/_vendor/platform-node/index.mjs +145 -35
  60. package/dist/_vendor/platform-node/index.mjs.map +1 -1
  61. package/dist/_vendor/platform-node/ipc-react.mjs.map +1 -1
  62. package/dist/_vendor/platform-web/external-change.d.ts +39 -0
  63. package/dist/_vendor/platform-web/external-change.d.ts.map +1 -0
  64. package/dist/_vendor/platform-web/external-change.js +61 -0
  65. package/dist/_vendor/platform-web/external-change.js.map +1 -0
  66. package/dist/_vendor/platform-web/index.d.ts +27 -5
  67. package/dist/_vendor/platform-web/index.d.ts.map +1 -1
  68. package/dist/_vendor/platform-web/index.js +310 -44
  69. package/dist/_vendor/platform-web/index.js.map +1 -1
  70. package/dist/_vendor/platform-web/indexeddb.js.map +1 -1
  71. package/dist/_vendor/platform-web/opfs.js.map +1 -1
  72. package/dist/_vendor/platform-web/persistence.js.map +1 -1
  73. package/dist/_vendor/platform-web/react.js.map +1 -1
  74. package/dist/_vendor/platform-web/sqljs.js +22 -2
  75. package/dist/_vendor/platform-web/sqljs.js.map +1 -1
  76. package/dist/_vendor/schema/definition.js.map +1 -1
  77. package/dist/_vendor/schema/planner.js.map +1 -1
  78. package/dist/_vendor/schema/validators.js.map +1 -1
  79. package/dist/browser-react.d.ts +1 -1
  80. package/dist/browser-react.js +1 -1
  81. package/dist/browser.d.ts +6 -7
  82. package/dist/browser.d.ts.map +1 -1
  83. package/dist/browser.js +4 -5
  84. package/dist/browser.js.map +1 -1
  85. package/dist/cli.d.ts +1 -1
  86. package/dist/cli.js +12 -3
  87. package/dist/cli.js.map +1 -1
  88. package/dist/expo-react.d.ts +1 -1
  89. package/dist/expo-react.js +1 -1
  90. package/dist/expo.d.ts +1 -2
  91. package/dist/expo.js +1 -2
  92. package/dist/index.d.ts +3 -7
  93. package/dist/index.js +3 -8
  94. package/dist/next-config.d.ts +1 -2
  95. package/dist/next-config.js +1 -2
  96. package/dist/next.d.ts +1 -3
  97. package/dist/next.js +1 -3
  98. package/dist/node-ipc-react.d.ts +1 -1
  99. package/dist/node-ipc-react.js +1 -1
  100. package/dist/node-ipc.d.ts +1 -2
  101. package/dist/node-ipc.js +1 -2
  102. package/dist/node.d.ts +1 -4
  103. package/dist/node.js +1 -3
  104. package/dist/react.d.ts +1 -2
  105. package/dist/react.js +1 -2
  106. package/dist/svelte.d.ts +1 -2
  107. package/dist/svelte.js +1 -2
  108. package/package.json +6 -3
  109. package/dist/core/src/cli.d.ts.map +0 -1
  110. package/dist/core/src/cli.js +0 -1196
  111. package/dist/core/src/cli.js.map +0 -1
  112. package/dist/core/src/index.js +0 -7
  113. package/dist/core/src/runtime/devtools.d.ts +0 -7
  114. package/dist/core/src/runtime/devtools.d.ts.map +0 -1
  115. package/dist/core/src/runtime/devtools.js +0 -300
  116. package/dist/core/src/runtime/devtools.js.map +0 -1
  117. package/dist/core/src/runtime/functions.d.ts +0 -123
  118. package/dist/core/src/runtime/functions.d.ts.map +0 -1
  119. package/dist/core/src/runtime/functions.js +0 -71
  120. package/dist/core/src/runtime/functions.js.map +0 -1
  121. package/dist/core/src/runtime/id.d.ts +0 -13
  122. package/dist/core/src/runtime/id.d.ts.map +0 -1
  123. package/dist/core/src/runtime/id.js +0 -28
  124. package/dist/core/src/runtime/id.js.map +0 -1
  125. package/dist/core/src/runtime/runtime.d.ts +0 -371
  126. package/dist/core/src/runtime/runtime.d.ts.map +0 -1
  127. package/dist/core/src/runtime/runtime.js +0 -1143
  128. package/dist/core/src/runtime/runtime.js.map +0 -1
  129. package/dist/devtools-protocol/src/index.d.ts +0 -201
  130. package/dist/devtools-protocol/src/index.d.ts.map +0 -1
  131. package/dist/next/src/config.d.ts +0 -17
  132. package/dist/next/src/config.d.ts.map +0 -1
  133. package/dist/next/src/config.js +0 -73
  134. package/dist/next/src/config.js.map +0 -1
  135. package/dist/next/src/index.d.ts +0 -80
  136. package/dist/next/src/index.d.ts.map +0 -1
  137. package/dist/next/src/index.js +0 -82
  138. package/dist/next/src/index.js.map +0 -1
  139. package/dist/platform-expo/src/index.d.ts +0 -96
  140. package/dist/platform-expo/src/index.d.ts.map +0 -1
  141. package/dist/platform-expo/src/index.js +0 -198
  142. package/dist/platform-expo/src/index.js.map +0 -1
  143. package/dist/platform-expo/src/react.d.ts +0 -26
  144. package/dist/platform-expo/src/react.d.ts.map +0 -1
  145. package/dist/platform-expo/src/react.js +0 -30
  146. package/dist/platform-expo/src/react.js.map +0 -1
  147. package/dist/platform-node/src/index.d.ts +0 -145
  148. package/dist/platform-node/src/index.d.ts.map +0 -1
  149. package/dist/platform-node/src/index.js +0 -407
  150. package/dist/platform-node/src/index.js.map +0 -1
  151. package/dist/platform-node/src/ipc-react.d.ts +0 -25
  152. package/dist/platform-node/src/ipc-react.d.ts.map +0 -1
  153. package/dist/platform-node/src/ipc-react.js +0 -21
  154. package/dist/platform-node/src/ipc-react.js.map +0 -1
  155. package/dist/platform-node/src/ipc.d.ts +0 -76
  156. package/dist/platform-node/src/ipc.d.ts.map +0 -1
  157. package/dist/platform-node/src/ipc.js +0 -344
  158. package/dist/platform-node/src/ipc.js.map +0 -1
  159. package/dist/platform-web/src/index.d.ts +0 -106
  160. package/dist/platform-web/src/index.d.ts.map +0 -1
  161. package/dist/platform-web/src/index.js +0 -311
  162. package/dist/platform-web/src/index.js.map +0 -1
  163. package/dist/platform-web/src/indexeddb.js +0 -125
  164. package/dist/platform-web/src/indexeddb.js.map +0 -1
  165. package/dist/platform-web/src/opfs.js +0 -146
  166. package/dist/platform-web/src/opfs.js.map +0 -1
  167. package/dist/platform-web/src/persistence.d.ts +0 -20
  168. package/dist/platform-web/src/persistence.d.ts.map +0 -1
  169. package/dist/platform-web/src/persistence.js +0 -23
  170. package/dist/platform-web/src/persistence.js.map +0 -1
  171. package/dist/platform-web/src/react.d.ts +0 -35
  172. package/dist/platform-web/src/react.d.ts.map +0 -1
  173. package/dist/platform-web/src/react.js +0 -42
  174. package/dist/platform-web/src/react.js.map +0 -1
  175. package/dist/platform-web/src/sqljs.js +0 -133
  176. package/dist/platform-web/src/sqljs.js.map +0 -1
  177. package/dist/platform-web/src/worker.d.ts +0 -79
  178. package/dist/platform-web/src/worker.d.ts.map +0 -1
  179. package/dist/platform-web/src/worker.js +0 -308
  180. package/dist/platform-web/src/worker.js.map +0 -1
  181. package/dist/react/src/index.d.ts +0 -59
  182. package/dist/react/src/index.d.ts.map +0 -1
  183. package/dist/react/src/index.js +0 -151
  184. package/dist/react/src/index.js.map +0 -1
  185. package/dist/schema/src/definition.d.ts +0 -98
  186. package/dist/schema/src/definition.d.ts.map +0 -1
  187. package/dist/schema/src/definition.js +0 -84
  188. package/dist/schema/src/definition.js.map +0 -1
  189. package/dist/schema/src/planner.d.ts +0 -42
  190. package/dist/schema/src/planner.d.ts.map +0 -1
  191. package/dist/schema/src/planner.js +0 -131
  192. package/dist/schema/src/planner.js.map +0 -1
  193. package/dist/schema/src/validators.d.ts +0 -194
  194. package/dist/schema/src/validators.d.ts.map +0 -1
  195. package/dist/schema/src/validators.js +0 -158
  196. package/dist/schema/src/validators.js.map +0 -1
  197. package/dist/svelte/src/index.d.ts +0 -44
  198. package/dist/svelte/src/index.d.ts.map +0 -1
  199. package/dist/svelte/src/index.js +0 -75
  200. package/dist/svelte/src/index.js.map +0 -1
@@ -1,82 +0,0 @@
1
- import { createManagedWebWorkerClient, createSyncoreWebWorkerClient } from "../../platform-web/src/worker.js";
2
- import "../../platform-web/src/index.js";
3
- import { SyncoreProvider } from "../../react/src/index.js";
4
- import { getSyncoreWorkerUrl } from "./config.js";
5
- import { useEffect, useState } from "react";
6
- import { jsx } from "react/jsx-runtime";
7
- //#region ../next/src/index.tsx
8
- /**
9
- * Register the Syncore service worker used by the Next integration.
10
- */
11
- async function registerSyncoreServiceWorker(options) {
12
- if (typeof window === "undefined" || !("serviceWorker" in navigator)) return null;
13
- const registration = await navigator.serviceWorker.register(options?.serviceWorkerUrl ?? "/sw.js");
14
- return {
15
- unregister: () => registration.unregister(),
16
- update: () => registration.update()
17
- };
18
- }
19
- /**
20
- * Resolve the public URL used by SQL.js to load its wasm file in a Next app.
21
- */
22
- function resolveSqlJsWasmUrl(options) {
23
- return options?.wasmAssetUrl ?? "/sql-wasm.wasm";
24
- }
25
- /**
26
- * Create a worker-backed Syncore client for a Next app.
27
- */
28
- function createNextSyncoreClient(options) {
29
- if (options.createWorker) return createManagedWebWorkerClient({ createWorker: options.createWorker });
30
- return createSyncoreWebWorkerClient({ workerUrl: options.workerUrl ?? options.workerAssetUrl ?? "/syncore.worker.js" });
31
- }
32
- /**
33
- * Register a service worker while rendering a React subtree.
34
- */
35
- function SyncoreServiceWorker({ children, serviceWorkerUrl, onRegistered }) {
36
- useEffect(() => {
37
- (async () => {
38
- if (typeof window === "undefined" || !("serviceWorker" in navigator)) return;
39
- const registration = await navigator.serviceWorker.register(serviceWorkerUrl ?? "/sw.js");
40
- onRegistered?.(registration);
41
- })();
42
- }, [onRegistered, serviceWorkerUrl]);
43
- return children;
44
- }
45
- /**
46
- * Provides a worker-backed Syncore client to a Next React tree.
47
- *
48
- * This is the shortest recommended integration for App Router pages that run
49
- * fully local in the browser.
50
- */
51
- function SyncoreNextProvider({ children, createWorker, serviceWorkerUrl, workerUrl, workerAssetUrl }) {
52
- const [managedClient, setManagedClient] = useState(null);
53
- const resolvedWorkerUrl = typeof workerUrl === "string" ? workerUrl : workerUrl?.toString();
54
- useEffect(() => {
55
- const nextClient = createNextSyncoreClient({
56
- ...createWorker ? { createWorker } : {},
57
- ...resolvedWorkerUrl ? { workerUrl: process.env.NODE_ENV === "production" ? getSyncoreWorkerUrl() : resolvedWorkerUrl } : {},
58
- ...workerAssetUrl ? { workerAssetUrl } : {}
59
- });
60
- setManagedClient(nextClient);
61
- return () => {
62
- nextClient.dispose();
63
- setManagedClient(null);
64
- };
65
- }, [
66
- createWorker,
67
- resolvedWorkerUrl,
68
- workerAssetUrl
69
- ]);
70
- if (!managedClient) return null;
71
- return /* @__PURE__ */ jsx(SyncoreServiceWorker, {
72
- ...serviceWorkerUrl ? { serviceWorkerUrl } : {},
73
- children: /* @__PURE__ */ jsx(SyncoreProvider, {
74
- client: managedClient.client,
75
- children
76
- })
77
- });
78
- }
79
- //#endregion
80
- export { SyncoreNextProvider, SyncoreServiceWorker, createNextSyncoreClient, registerSyncoreServiceWorker, resolveSqlJsWasmUrl };
81
-
82
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../next/src/index.tsx"],"sourcesContent":["import {\n createManagedWebWorkerClient,\n createSyncoreWebWorkerClient,\n type ManagedWebWorkerClient\n} from \"@syncore/platform-web\";\nimport { SyncoreProvider } from \"@syncore/react\";\nimport { useEffect, useState, type ReactNode } from \"react\";\nimport { getSyncoreWorkerUrl } from \"./config.js\";\n\nexport { getSyncoreWorkerUrl } from \"./config.js\";\nexport { createSyncoreNextWorkerUrl } from \"./config.js\";\n\nexport interface SyncoreNextOptions {\n /** Optional service worker URL used to cache the application shell. */\n serviceWorkerUrl?: string;\n\n /** Optional URL for the `sql.js` wasm asset. */\n wasmAssetUrl?: string;\n\n /** Optional URL for the worker asset used by the local Syncore runtime. */\n workerAssetUrl?: string;\n}\n\n/**\n * The result of registering the Syncore service worker in a Next app.\n */\nexport interface SyncoreServiceWorkerRegistration {\n /** Unregister the installed service worker. */\n unregister(): Promise<boolean>;\n\n /** Ask the browser to check for an updated service worker. */\n update(): Promise<ServiceWorkerRegistration>;\n}\n\n/**\n * Register the Syncore service worker used by the Next integration.\n */\nexport async function registerSyncoreServiceWorker(\n options?: SyncoreNextOptions\n): Promise<SyncoreServiceWorkerRegistration | null> {\n if (typeof window === \"undefined\" || !(\"serviceWorker\" in navigator)) {\n return null;\n }\n\n const registration = await navigator.serviceWorker.register(\n options?.serviceWorkerUrl ?? \"/sw.js\"\n );\n\n return {\n unregister: () => registration.unregister(),\n update: () => registration.update()\n };\n}\n\n/**\n * Resolve the public URL used by SQL.js to load its wasm file in a Next app.\n */\nexport function resolveSqlJsWasmUrl(options?: SyncoreNextOptions): string {\n return options?.wasmAssetUrl ?? \"/sql-wasm.wasm\";\n}\n\n/**\n * Create a worker-backed Syncore client for a Next app.\n */\nexport function createNextSyncoreClient(options: {\n /**\n * Optional custom worker factory for tests or framework-specific worker\n * bundling patterns such as Next App Router development.\n */\n createWorker?: () => Worker;\n\n /** Optional explicit module URL for an already-public worker asset. */\n workerUrl?: URL | string;\n\n /** Optional public worker asset path for production builds. */\n workerAssetUrl?: string;\n}): ManagedWebWorkerClient {\n if (options.createWorker) {\n return createManagedWebWorkerClient({\n createWorker: options.createWorker\n });\n }\n\n return createSyncoreWebWorkerClient({\n workerUrl:\n options.workerUrl ?? options.workerAssetUrl ?? \"/syncore.worker.js\"\n });\n}\n\n/**\n * Register a service worker while rendering a React subtree.\n */\nexport function SyncoreServiceWorker({\n children,\n serviceWorkerUrl,\n onRegistered\n}: {\n children: ReactNode;\n serviceWorkerUrl?: string;\n onRegistered?: (registration: ServiceWorkerRegistration) => void;\n}) {\n useEffect(() => {\n void (async () => {\n if (typeof window === \"undefined\" || !(\"serviceWorker\" in navigator)) {\n return;\n }\n const registration = await navigator.serviceWorker.register(\n serviceWorkerUrl ?? \"/sw.js\"\n );\n onRegistered?.(registration);\n })();\n }, [onRegistered, serviceWorkerUrl]);\n\n return children;\n}\n\n/**\n * Provides a worker-backed Syncore client to a Next React tree.\n *\n * This is the shortest recommended integration for App Router pages that run\n * fully local in the browser.\n */\nexport function SyncoreNextProvider({\n children,\n createWorker,\n serviceWorkerUrl,\n workerUrl,\n workerAssetUrl\n}: {\n /** The React subtree that should receive the Syncore client. */\n children: ReactNode;\n\n /**\n * Optional custom worker factory for tests or Next colocated worker modules.\n */\n createWorker?: () => Worker;\n\n /** Optional service worker URL used to cache the application shell. */\n serviceWorkerUrl?: string;\n\n /** Optional explicit module URL for an already-public worker asset. */\n workerUrl?: URL | string;\n\n /** Optional public worker asset path for production builds. */\n workerAssetUrl?: string;\n}) {\n const [managedClient, setManagedClient] =\n useState<ManagedWebWorkerClient | null>(null);\n const resolvedWorkerUrl =\n typeof workerUrl === \"string\" ? workerUrl : workerUrl?.toString();\n\n useEffect(() => {\n const nextClient = createNextSyncoreClient({\n ...(createWorker ? { createWorker } : {}),\n ...(resolvedWorkerUrl\n ? {\n workerUrl:\n process.env.NODE_ENV === \"production\"\n ? getSyncoreWorkerUrl()\n : resolvedWorkerUrl\n }\n : {}),\n ...(workerAssetUrl ? { workerAssetUrl } : {})\n });\n setManagedClient(nextClient);\n\n return () => {\n nextClient.dispose();\n setManagedClient(null);\n };\n }, [createWorker, resolvedWorkerUrl, workerAssetUrl]);\n\n if (!managedClient) {\n return null;\n }\n\n return (\n <SyncoreServiceWorker {...(serviceWorkerUrl ? { serviceWorkerUrl } : {})}>\n <SyncoreProvider client={managedClient.client}>\n {children}\n </SyncoreProvider>\n </SyncoreServiceWorker>\n );\n}\n"],"mappings":";;;;;;;;;;AAqCA,eAAsB,6BACpB,SACkD;AAClD,KAAI,OAAO,WAAW,eAAe,EAAE,mBAAmB,WACxD,QAAO;CAGT,MAAM,eAAe,MAAM,UAAU,cAAc,SACjD,SAAS,oBAAoB,SAC9B;AAED,QAAO;EACL,kBAAkB,aAAa,YAAY;EAC3C,cAAc,aAAa,QAAQ;EACpC;;;;;AAMH,SAAgB,oBAAoB,SAAsC;AACxE,QAAO,SAAS,gBAAgB;;;;;AAMlC,SAAgB,wBAAwB,SAYb;AACzB,KAAI,QAAQ,aACV,QAAO,6BAA6B,EAClC,cAAc,QAAQ,cACvB,CAAC;AAGJ,QAAO,6BAA6B,EAClC,WACE,QAAQ,aAAa,QAAQ,kBAAkB,sBAClD,CAAC;;;;;AAMJ,SAAgB,qBAAqB,EACnC,UACA,kBACA,gBAKC;AACD,iBAAgB;AACd,GAAM,YAAY;AAChB,OAAI,OAAO,WAAW,eAAe,EAAE,mBAAmB,WACxD;GAEF,MAAM,eAAe,MAAM,UAAU,cAAc,SACjD,oBAAoB,SACrB;AACD,kBAAe,aAAa;MAC1B;IACH,CAAC,cAAc,iBAAiB,CAAC;AAEpC,QAAO;;;;;;;;AAST,SAAgB,oBAAoB,EAClC,UACA,cACA,kBACA,WACA,kBAkBC;CACD,MAAM,CAAC,eAAe,oBACpB,SAAwC,KAAK;CAC/C,MAAM,oBACJ,OAAO,cAAc,WAAW,YAAY,WAAW,UAAU;AAEnE,iBAAgB;EACd,MAAM,aAAa,wBAAwB;GACzC,GAAI,eAAe,EAAE,cAAc,GAAG,EAAE;GACxC,GAAI,oBACA,EACE,WACE,QAAQ,IAAI,aAAa,eACrB,qBAAqB,GACrB,mBACP,GACD,EAAE;GACN,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;GAC7C,CAAC;AACF,mBAAiB,WAAW;AAE5B,eAAa;AACX,cAAW,SAAS;AACpB,oBAAiB,KAAK;;IAEvB;EAAC;EAAc;EAAmB;EAAe,CAAC;AAErD,KAAI,CAAC,cACH,QAAO;AAGT,QACE,oBAAC,sBAAD;EAAsB,GAAK,mBAAmB,EAAE,kBAAkB,GAAG,EAAE;YACrE,oBAAC,iBAAD;GAAiB,QAAQ,cAAc;GACpC;GACe,CAAA;EACG,CAAA"}
@@ -1,96 +0,0 @@
1
- import { AnySyncoreSchema, DevtoolsSink, SchedulerOptions, StorageObject, StorageWriteInput, SyncoreCapabilities, SyncoreClient, SyncoreExperimentalPlugin, SyncoreRuntime, SyncoreRuntimeOptions, SyncoreSqlDriver, SyncoreStorageAdapter } from "../../core/src/runtime/runtime.js";
2
- import { SQLiteDatabase } from "expo-sqlite";
3
-
4
- //#region ../platform-expo/src/index.d.ts
5
- type ExpoSyncoreSchema = AnySyncoreSchema;
6
- /**
7
- * Options for constructing an Expo Syncore runtime.
8
- *
9
- * Use this when you want Syncore to persist locally with `expo-sqlite` and the
10
- * Expo file system.
11
- */
12
- interface CreateExpoRuntimeOptions {
13
- /** The schema for the local Syncore app. */
14
- schema: ExpoSyncoreSchema;
15
- /** The generated function registry for the local Syncore app. */
16
- functions: SyncoreRuntimeOptions<ExpoSyncoreSchema>["functions"];
17
- /** Optional platform capabilities exposed to function handlers. */
18
- capabilities?: SyncoreCapabilities;
19
- /** Optional custom SQL driver. Defaults to `expo-sqlite`. */
20
- driver?: SyncoreSqlDriver;
21
- /** Optional experimental plugins for runtime hooks. */
22
- experimentalPlugins?: Array<SyncoreExperimentalPlugin<ExpoSyncoreSchema>>;
23
- /** Optional custom file/blob storage adapter. */
24
- storage?: SyncoreStorageAdapter;
25
- /** The SQLite database filename to open locally. */
26
- databaseName?: string;
27
- /** Optional directory for the SQLite database file. */
28
- databaseDirectory?: string;
29
- /** Directory name used for local file/blob storage. */
30
- storageDirectoryName?: string;
31
- /** Optional runtime platform label shown in devtools snapshots. */
32
- platform?: string;
33
- /** Optional devtools sink used during development. */
34
- devtools?: DevtoolsSink;
35
- /** Optional scheduler configuration for jobs and recurring work. */
36
- scheduler?: SchedulerOptions;
37
- }
38
- /**
39
- * A reusable bootstrap that lazily creates, starts, and stops an Expo Syncore runtime.
40
- */
41
- interface ExpoSyncoreBootstrap {
42
- /** Return the local runtime instance, creating it if needed. */
43
- getRuntime(): SyncoreRuntime<ExpoSyncoreSchema>;
44
- /** Start the runtime if needed and return a ready client. */
45
- getClient(): Promise<ReturnType<SyncoreRuntime<ExpoSyncoreSchema>["createClient"]>>;
46
- /** Stop the current runtime instance if one exists. */
47
- stop(): Promise<void>;
48
- /** Fully discard the runtime so the next call recreates it. */
49
- reset(): Promise<void>;
50
- }
51
- /**
52
- * Create an Expo Syncore runtime backed by `expo-sqlite` and local file storage.
53
- */
54
- declare function createExpoSyncoreRuntime(options: CreateExpoRuntimeOptions): SyncoreRuntime<ExpoSyncoreSchema>;
55
- /**
56
- * Create a same-process Syncore client from a started Expo runtime.
57
- */
58
- declare function createExpoSyncoreClient(runtime: SyncoreRuntime<ExpoSyncoreSchema>): SyncoreClient;
59
- /**
60
- * Create a reusable Expo bootstrap that lazily starts the local runtime.
61
- */
62
- declare function createExpoSyncoreBootstrap(options: CreateExpoRuntimeOptions): ExpoSyncoreBootstrap;
63
- /**
64
- * Syncore SQL driver implementation backed by `expo-sqlite`.
65
- */
66
- declare class ExpoSqliteDriver implements SyncoreSqlDriver {
67
- private readonly database;
68
- private transactionDepth;
69
- private closed;
70
- constructor(database: SQLiteDatabase);
71
- exec(sql: string): Promise<void>;
72
- run(sql: string, params?: unknown[]): Promise<{
73
- changes: number;
74
- lastInsertRowid?: number | string;
75
- }>;
76
- get<T>(sql: string, params?: unknown[]): Promise<T | undefined>;
77
- all<T>(sql: string, params?: unknown[]): Promise<T[]>;
78
- withTransaction<T>(callback: () => Promise<T>): Promise<T>;
79
- withSavepoint<T>(name: string, callback: () => Promise<T>): Promise<T>;
80
- close(): Promise<void>;
81
- private ensureOpen;
82
- }
83
- /**
84
- * Syncore file/blob storage backed by the Expo file system.
85
- */
86
- declare class ExpoFileStorageAdapter implements SyncoreStorageAdapter {
87
- private readonly rootDirectory;
88
- constructor(storageDirectoryName: string);
89
- put(id: string, input: StorageWriteInput): Promise<StorageObject>;
90
- get(id: string): Promise<StorageObject | null>;
91
- read(id: string): Promise<Uint8Array | null>;
92
- delete(id: string): Promise<void>;
93
- }
94
- //#endregion
95
- export { CreateExpoRuntimeOptions, ExpoFileStorageAdapter, ExpoSqliteDriver, ExpoSyncoreBootstrap, ExpoSyncoreSchema, createExpoSyncoreBootstrap, createExpoSyncoreClient, createExpoSyncoreRuntime };
96
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../../platform-expo/src/index.ts"],"mappings":";;;;KAoBY,iBAAA,GAAoB,gBAAA;;AAAhC;;;;;UAQiB,wBAAA;EAAwB;EAEvC,MAAA,EAAQ,iBAAA;EAAA;EAGR,SAAA,EAAW,qBAAA,CAAsB,iBAAA;EAAtB;EAGX,YAAA,GAAe,mBAAA;EAGN;EAAT,MAAA,GAAS,gBAAA;EAGmB;EAA5B,mBAAA,GAAsB,KAAA,CAAM,yBAAA,CAA0B,iBAAA;EAG5C;EAAV,OAAA,GAAU,qBAAA;EAkBE;EAfZ,YAAA;EAe4B;EAZ5B,iBAAA;EArBQ;EAwBR,oBAAA;EArBW;EAwBX,QAAA;EArBA;EAwBA,QAAA,GAAW,YAAA;EArBX;EAwBA,SAAA,GAAY,gBAAA;AAAA;;;;UAMG,oBAAA;EAxBL;EA0BV,UAAA,IAAc,cAAA,CAAe,iBAAA;EApB7B;EAuBA,SAAA,IAA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oreRuntime } from "../../core/src/runtime/runtime.js";
2
- import "../../core/src/index.js";
3
- import { Directory, File, Paths } from "expo-file-system";
4
- import { defaultDatabaseDirectory, openDatabaseSync } from "expo-sqlite";
5
- //#region ../platform-expo/src/index.ts
6
- /**
7
- * Create an Expo Syncore runtime backed by `expo-sqlite` and local file storage.
8
- */
9
- function createExpoSyncoreRuntime(options) {
10
- const databaseDirectory = options.databaseDirectory ?? (typeof defaultDatabaseDirectory === "string" ? defaultDatabaseDirectory : void 0);
11
- const driver = options.driver ?? new ExpoSqliteDriver(openDatabaseSync(options.databaseName ?? "syncore.db", void 0, databaseDirectory));
12
- const storage = options.storage ?? new ExpoFileStorageAdapter(options.storageDirectoryName ?? "syncore-storage");
13
- return new SyncoreRuntime({
14
- schema: options.schema,
15
- functions: options.functions,
16
- driver,
17
- storage,
18
- platform: options.platform ?? "expo",
19
- ...options.capabilities ? { capabilities: options.capabilities } : {},
20
- ...options.devtools ? { devtools: options.devtools } : {},
21
- ...options.experimentalPlugins ? { experimentalPlugins: options.experimentalPlugins } : {},
22
- ...options.scheduler ? { scheduler: options.scheduler } : {}
23
- });
24
- }
25
- /**
26
- * Create a same-process Syncore client from a started Expo runtime.
27
- */
28
- function createExpoSyncoreClient(runtime) {
29
- return runtime.createClient();
30
- }
31
- /**
32
- * Create a reusable Expo bootstrap that lazily starts the local runtime.
33
- */
34
- function createExpoSyncoreBootstrap(options) {
35
- let runtime = null;
36
- let started = null;
37
- const ensureRuntime = () => {
38
- runtime ??= createExpoSyncoreRuntime(options);
39
- return runtime;
40
- };
41
- return {
42
- getRuntime() {
43
- return ensureRuntime();
44
- },
45
- async getClient() {
46
- if (!started) {
47
- const activeRuntime = ensureRuntime();
48
- started = activeRuntime.start().then(() => activeRuntime.createClient());
49
- }
50
- return started;
51
- },
52
- async stop() {
53
- if (!runtime) return;
54
- await runtime.stop();
55
- started = null;
56
- },
57
- async reset() {
58
- if (runtime) await runtime.stop();
59
- runtime = null;
60
- started = null;
61
- }
62
- };
63
- }
64
- /**
65
- * Syncore SQL driver implementation backed by `expo-sqlite`.
66
- */
67
- var ExpoSqliteDriver = class {
68
- transactionDepth = 0;
69
- closed = false;
70
- constructor(database) {
71
- this.database = database;
72
- }
73
- async exec(sql) {
74
- this.ensureOpen();
75
- await this.database.execAsync(sql);
76
- }
77
- async run(sql, params = []) {
78
- this.ensureOpen();
79
- const result = await this.database.runAsync(sql, normalizeParams(params));
80
- return {
81
- changes: result.changes,
82
- lastInsertRowid: result.lastInsertRowId
83
- };
84
- }
85
- async get(sql, params = []) {
86
- this.ensureOpen();
87
- return await this.database.getFirstAsync(sql, normalizeParams(params)) ?? void 0;
88
- }
89
- async all(sql, params = []) {
90
- this.ensureOpen();
91
- return this.database.getAllAsync(sql, normalizeParams(params));
92
- }
93
- async withTransaction(callback) {
94
- this.ensureOpen();
95
- if (this.transactionDepth > 0) return this.withSavepoint(`nested_${this.transactionDepth}`, callback);
96
- this.transactionDepth += 1;
97
- await this.database.execAsync("BEGIN IMMEDIATE");
98
- try {
99
- const result = await callback();
100
- await this.database.execAsync("COMMIT");
101
- return result;
102
- } catch (error) {
103
- await this.database.execAsync("ROLLBACK");
104
- throw error;
105
- } finally {
106
- this.transactionDepth -= 1;
107
- }
108
- }
109
- async withSavepoint(name, callback) {
110
- this.ensureOpen();
111
- const safeName = name.replaceAll(/[^a-zA-Z0-9_]/g, "_");
112
- this.transactionDepth += 1;
113
- await this.database.execAsync(`SAVEPOINT ${safeName}`);
114
- try {
115
- const result = await callback();
116
- await this.database.execAsync(`RELEASE SAVEPOINT ${safeName}`);
117
- return result;
118
- } catch (error) {
119
- await this.database.execAsync(`ROLLBACK TO SAVEPOINT ${safeName}`);
120
- await this.database.execAsync(`RELEASE SAVEPOINT ${safeName}`);
121
- throw error;
122
- } finally {
123
- this.transactionDepth -= 1;
124
- }
125
- }
126
- async close() {
127
- if (this.closed) return;
128
- await this.database.closeAsync();
129
- this.closed = true;
130
- }
131
- ensureOpen() {
132
- if (this.closed) throw new Error("The Expo SQLite driver is already closed.");
133
- }
134
- };
135
- /**
136
- * Syncore file/blob storage backed by the Expo file system.
137
- */
138
- var ExpoFileStorageAdapter = class {
139
- rootDirectory;
140
- constructor(storageDirectoryName) {
141
- this.rootDirectory = new Directory(Paths.document, storageDirectoryName);
142
- if (!this.rootDirectory.exists) this.rootDirectory.create({
143
- idempotent: true,
144
- intermediates: true
145
- });
146
- }
147
- async put(id, input) {
148
- const file = new File(this.rootDirectory, id);
149
- if (!file.exists) file.create({
150
- intermediates: true,
151
- overwrite: true
152
- });
153
- const bytes = normalizeBinary(input.data);
154
- file.write(bytes);
155
- return {
156
- id,
157
- path: file.uri,
158
- size: bytes.byteLength,
159
- contentType: input.contentType ?? null
160
- };
161
- }
162
- async get(id) {
163
- const file = new File(this.rootDirectory, id);
164
- if (!file.exists) return null;
165
- return {
166
- id,
167
- path: file.uri,
168
- size: file.size,
169
- contentType: file.type || null
170
- };
171
- }
172
- async read(id) {
173
- const file = new File(this.rootDirectory, id);
174
- if (!file.exists) return null;
175
- return file.bytes();
176
- }
177
- async delete(id) {
178
- const file = new File(this.rootDirectory, id);
179
- if (file.exists) file.delete();
180
- }
181
- };
182
- function normalizeParams(values) {
183
- return values.map((value) => {
184
- if (typeof value === "boolean") return value ? 1 : 0;
185
- if (value === null || typeof value === "string" || typeof value === "number" || value instanceof Uint8Array) return value;
186
- if (value instanceof ArrayBuffer) return new Uint8Array(value);
187
- return JSON.stringify(value);
188
- });
189
- }
190
- function normalizeBinary(data) {
191
- if (typeof data === "string") return new TextEncoder().encode(data);
192
- if (data instanceof Uint8Array) return data;
193
- return new Uint8Array(data);
194
- }
195
- //#endregion
196
- export { ExpoFileStorageAdapter, ExpoSqliteDriver, createExpoSyncoreBootstrap, createExpoSyncoreClient, createExpoSyncoreRuntime };
197
-
198
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../platform-expo/src/index.ts"],"sourcesContent":["import { Directory, File, Paths } from \"expo-file-system\";\r\nimport {\r\n defaultDatabaseDirectory,\r\n openDatabaseSync,\r\n type SQLiteDatabase\r\n} from \"expo-sqlite\";\r\nimport {\r\n type AnySyncoreSchema,\r\n type DevtoolsSink,\r\n SyncoreRuntime,\r\n type SchedulerOptions,\r\n type SyncoreCapabilities,\r\n type SyncoreExperimentalPlugin,\r\n type SyncoreRuntimeOptions,\r\n type SyncoreSqlDriver,\r\n type SyncoreStorageAdapter,\r\n type StorageObject,\r\n type StorageWriteInput\r\n} from \"@syncore/core\";\r\n\r\nexport type ExpoSyncoreSchema = AnySyncoreSchema;\r\n\r\n/**\r\n * Options for constructing an Expo Syncore runtime.\r\n *\r\n * Use this when you want Syncore to persist locally with `expo-sqlite` and the\r\n * Expo file system.\r\n */\r\nexport interface CreateExpoRuntimeOptions {\r\n /** The schema for the local Syncore app. */\r\n schema: ExpoSyncoreSchema;\r\n\r\n /** The generated function registry for the local Syncore app. */\r\n functions: SyncoreRuntimeOptions<ExpoSyncoreSchema>[\"functions\"];\r\n\r\n /** Optional platform capabilities exposed to function handlers. */\r\n capabilities?: SyncoreCapabilities;\r\n\r\n /** Optional custom SQL driver. Defaults to `expo-sqlite`. */\r\n driver?: SyncoreSqlDriver;\r\n\r\n /** Optional experimental plugins for runtime hooks. */\r\n experimentalPlugins?: Array<SyncoreExperimentalPlugin<ExpoSyncoreSchema>>;\r\n\r\n /** Optional custom file/blob storage adapter. */\r\n storage?: SyncoreStorageAdapter;\r\n\r\n /** The SQLite database filename to open locally. */\r\n databaseName?: string;\r\n\r\n /** Optional directory for the SQLite database file. */\r\n databaseDirectory?: string;\r\n\r\n /** Directory name used for local file/blob storage. */\r\n storageDirectoryName?: string;\r\n\r\n /** Optional runtime platform label shown in devtools snapshots. */\r\n platform?: string;\r\n\r\n /** Optional devtools sink used during development. */\r\n devtools?: DevtoolsSink;\r\n\r\n /** Optional scheduler configuration for jobs and recurring work. */\r\n scheduler?: SchedulerOptions;\r\n}\r\n\r\n/**\r\n * A reusable bootstrap that lazily creates, starts, and stops an Expo Syncore runtime.\r\n */\r\nexport interface ExpoSyncoreBootstrap {\r\n /** Return the local runtime instance, creating it if needed. */\r\n getRuntime(): SyncoreRuntime<ExpoSyncoreSchema>;\r\n\r\n /** Start the runtime if needed and return a ready client. */\r\n getClient(): Promise<\r\n ReturnType<SyncoreRuntime<ExpoSyncoreSchema>[\"createClient\"]>\r\n >;\r\n\r\n /** Stop the current runtime instance if one exists. */\r\n stop(): Promise<void>;\r\n\r\n /** Fully discard the runtime so the next call recreates it. */\r\n reset(): Promise<void>;\r\n}\r\n\r\n/**\r\n * Create an Expo Syncore runtime backed by `expo-sqlite` and local file storage.\r\n */\r\nexport function createExpoSyncoreRuntime(\r\n options: CreateExpoRuntimeOptions\r\n): SyncoreRuntime<ExpoSyncoreSchema> {\r\n const databaseDirectory =\r\n options.databaseDirectory ??\r\n (typeof defaultDatabaseDirectory === \"string\"\r\n ? defaultDatabaseDirectory\r\n : undefined);\r\n const driver =\r\n options.driver ??\r\n new ExpoSqliteDriver(\r\n openDatabaseSync(\r\n options.databaseName ?? \"syncore.db\",\r\n undefined,\r\n databaseDirectory\r\n )\r\n );\r\n const storage =\r\n options.storage ??\r\n new ExpoFileStorageAdapter(\r\n options.storageDirectoryName ?? \"syncore-storage\"\r\n );\r\n\r\n return new SyncoreRuntime({\r\n schema: options.schema,\r\n functions: options.functions,\r\n driver,\r\n storage,\r\n platform: options.platform ?? \"expo\",\r\n ...(options.capabilities ? { capabilities: options.capabilities } : {}),\r\n ...(options.devtools ? { devtools: options.devtools } : {}),\r\n ...(options.experimentalPlugins\r\n ? { experimentalPlugins: options.experimentalPlugins }\r\n : {}),\r\n ...(options.scheduler ? { scheduler: options.scheduler } : {})\r\n });\r\n}\r\n\r\n/**\r\n * Create a same-process Syncore client from a started Expo runtime.\r\n */\r\nexport function createExpoSyncoreClient(\r\n runtime: SyncoreRuntime<ExpoSyncoreSchema>\r\n) {\r\n return runtime.createClient();\r\n}\r\n\r\n/**\r\n * Create a reusable Expo bootstrap that lazily starts the local runtime.\r\n */\r\nexport function createExpoSyncoreBootstrap(\r\n options: CreateExpoRuntimeOptions\r\n): ExpoSyncoreBootstrap {\r\n let runtime: SyncoreRuntime<ExpoSyncoreSchema> | null = null;\r\n let started: Promise<\r\n ReturnType<SyncoreRuntime<ExpoSyncoreSchema>[\"createClient\"]>\r\n > | null = null;\r\n\r\n const ensureRuntime = () => {\r\n runtime ??= createExpoSyncoreRuntime(options);\r\n return runtime;\r\n };\r\n\r\n return {\r\n getRuntime() {\r\n return ensureRuntime();\r\n },\r\n async getClient() {\r\n if (!started) {\r\n const activeRuntime = ensureRuntime();\r\n started = activeRuntime\r\n .start()\r\n .then(() => activeRuntime.createClient());\r\n }\r\n return started;\r\n },\r\n async stop() {\r\n if (!runtime) {\r\n return;\r\n }\r\n await runtime.stop();\r\n started = null;\r\n },\r\n async reset() {\r\n if (runtime) {\r\n await runtime.stop();\r\n }\r\n runtime = null;\r\n started = null;\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Syncore SQL driver implementation backed by `expo-sqlite`.\r\n */\r\nexport class ExpoSqliteDriver implements SyncoreSqlDriver {\r\n private transactionDepth = 0;\r\n private closed = false;\r\n\r\n constructor(private readonly database: SQLiteDatabase) {}\r\n\r\n async exec(sql: string): Promise<void> {\r\n this.ensureOpen();\r\n await this.database.execAsync(sql);\r\n }\r\n\r\n async run(\r\n sql: string,\r\n params: unknown[] = []\r\n ): Promise<{ changes: number; lastInsertRowid?: number | string }> {\r\n this.ensureOpen();\r\n const result = await this.database.runAsync(sql, normalizeParams(params));\r\n return {\r\n changes: result.changes,\r\n lastInsertRowid: result.lastInsertRowId\r\n };\r\n }\r\n\r\n async get<T>(sql: string, params: unknown[] = []): Promise<T | undefined> {\r\n this.ensureOpen();\r\n const row = await this.database.getFirstAsync<T>(\r\n sql,\r\n normalizeParams(params)\r\n );\r\n return row ?? undefined;\r\n }\r\n\r\n async all<T>(sql: string, params: unknown[] = []): Promise<T[]> {\r\n this.ensureOpen();\r\n return this.database.getAllAsync<T>(sql, normalizeParams(params));\r\n }\r\n\r\n async withTransaction<T>(callback: () => Promise<T>): Promise<T> {\r\n this.ensureOpen();\r\n if (this.transactionDepth > 0) {\r\n return this.withSavepoint(`nested_${this.transactionDepth}`, callback);\r\n }\r\n\r\n this.transactionDepth += 1;\r\n await this.database.execAsync(\"BEGIN IMMEDIATE\");\r\n try {\r\n const result = await callback();\r\n await this.database.execAsync(\"COMMIT\");\r\n return result;\r\n } catch (error) {\r\n await this.database.execAsync(\"ROLLBACK\");\r\n throw error;\r\n } finally {\r\n this.transactionDepth -= 1;\r\n }\r\n }\r\n\r\n async withSavepoint<T>(name: string, callback: () => Promise<T>): Promise<T> {\r\n this.ensureOpen();\r\n const safeName = name.replaceAll(/[^a-zA-Z0-9_]/g, \"_\");\r\n this.transactionDepth += 1;\r\n await this.database.execAsync(`SAVEPOINT ${safeName}`);\r\n try {\r\n const result = await callback();\r\n await this.database.execAsync(`RELEASE SAVEPOINT ${safeName}`);\r\n return result;\r\n } catch (error) {\r\n await this.database.execAsync(`ROLLBACK TO SAVEPOINT ${safeName}`);\r\n await this.database.execAsync(`RELEASE SAVEPOINT ${safeName}`);\r\n throw error;\r\n } finally {\r\n this.transactionDepth -= 1;\r\n }\r\n }\r\n\r\n async close(): Promise<void> {\r\n if (this.closed) {\r\n return;\r\n }\r\n await this.database.closeAsync();\r\n this.closed = true;\r\n }\r\n\r\n private ensureOpen(): void {\r\n if (this.closed) {\r\n throw new Error(\"The Expo SQLite driver is already closed.\");\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Syncore file/blob storage backed by the Expo file system.\r\n */\r\nexport class ExpoFileStorageAdapter implements SyncoreStorageAdapter {\r\n private readonly rootDirectory: Directory;\r\n\r\n constructor(storageDirectoryName: string) {\r\n this.rootDirectory = new Directory(Paths.document, storageDirectoryName);\r\n if (!this.rootDirectory.exists) {\r\n this.rootDirectory.create({ idempotent: true, intermediates: true });\r\n }\r\n }\r\n\r\n async put(id: string, input: StorageWriteInput): Promise<StorageObject> {\r\n const file = new File(this.rootDirectory, id);\r\n if (!file.exists) {\r\n file.create({ intermediates: true, overwrite: true });\r\n }\r\n const bytes = normalizeBinary(input.data);\r\n file.write(bytes);\r\n return {\r\n id,\r\n path: file.uri,\r\n size: bytes.byteLength,\r\n contentType: input.contentType ?? null\r\n };\r\n }\r\n\r\n async get(id: string): Promise<StorageObject | null> {\r\n const file = new File(this.rootDirectory, id);\r\n if (!file.exists) {\r\n return null;\r\n }\r\n return {\r\n id,\r\n path: file.uri,\r\n size: file.size,\r\n contentType: file.type || null\r\n };\r\n }\r\n\r\n async read(id: string): Promise<Uint8Array | null> {\r\n const file = new File(this.rootDirectory, id);\r\n if (!file.exists) {\r\n return null;\r\n }\r\n return file.bytes();\r\n }\r\n\r\n async delete(id: string): Promise<void> {\r\n const file = new File(this.rootDirectory, id);\r\n if (file.exists) {\r\n file.delete();\r\n }\r\n }\r\n}\r\n\r\nfunction normalizeParams(\r\n values: unknown[]\r\n): Array<string | number | Uint8Array | null> {\r\n return values.map((value) => {\r\n if (typeof value === \"boolean\") {\r\n return value ? 1 : 0;\r\n }\r\n if (\r\n value === null ||\r\n typeof value === \"string\" ||\r\n typeof value === \"number\" ||\r\n value instanceof Uint8Array\r\n ) {\r\n return value;\r\n }\r\n if (value instanceof ArrayBuffer) {\r\n return new Uint8Array(value);\r\n }\r\n return JSON.stringify(value);\r\n });\r\n}\r\n\r\nfunction normalizeBinary(data: StorageWriteInput[\"data\"]): Uint8Array {\r\n if (typeof data === \"string\") {\r\n return new TextEncoder().encode(data);\r\n }\r\n if (data instanceof Uint8Array) {\r\n return data;\r\n }\r\n return new Uint8Array(data);\r\n}\r\n"],"mappings":";;;;;;;;AAwFA,SAAgB,yBACd,SACmC;CACnC,MAAM,oBACJ,QAAQ,sBACP,OAAO,6BAA6B,WACjC,2BACA,KAAA;CACN,MAAM,SACJ,QAAQ,UACR,IAAI,iBAC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;AAET,MAAI,iBAAiB,YACnB,QAAO,IAAI,WAAW,MAAM;AAE9B,SAAO,KAAK,UAAU,MAAM;GAC5B;;AAGJ,SAAS,gBAAgB,MAA6C;AACpE,KAAI,OAAO,SAAS,SAClB,QAAO,IAAI,aAAa,CAAC,OAAO,KAAK;AAEvC,KAAI,gBAAgB,WAClB,QAAO;AAET,QAAO,IAAI,WAAW,KAAK"}
@@ -1,26 +0,0 @@
1
- import { ExpoSyncoreBootstrap } from "./index.js";
2
- import { ReactNode } from "react";
3
-
4
- //#region ../platform-expo/src/react.d.ts
5
- /**
6
- * Props for {@link SyncoreExpoProvider}.
7
- */
8
- interface SyncoreExpoProviderProps {
9
- /** The bootstrap created with `createExpoSyncoreBootstrap`. */
10
- bootstrap: ExpoSyncoreBootstrap;
11
- /** The React subtree that should receive the Syncore client. */
12
- children: ReactNode;
13
- /** Optional fallback content rendered while the local runtime starts. */
14
- fallback?: ReactNode;
15
- }
16
- /**
17
- * Start an Expo Syncore bootstrap and provide its client to React descendants.
18
- */
19
- declare function SyncoreExpoProvider({
20
- bootstrap,
21
- children,
22
- fallback
23
- }: SyncoreExpoProviderProps): ReactNode;
24
- //#endregion
25
- export { SyncoreExpoProvider, SyncoreExpoProviderProps };
26
- //# sourceMappingURL=react.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react.d.ts","names":[],"sources":["../../../../platform-expo/src/react.tsx"],"mappings":";;;;;;AAWA;UAAiB,wBAAA;;EAEf,SAAA,EAAW,oBAAA;EAGD;EAAV,QAAA,EAAU,SAAA;EAGU;EAApB,QAAA,GAAW,SAAA;AAAA;;;;iBAMG,mBAAA,CAAA;EACd,SAAA;EACA,QAAA;EACA;AAAA,GACC,wBAAA,GAA2B,SAAA"}
@@ -1,30 +0,0 @@
1
- import { SyncoreProvider } from "../../react/src/index.js";
2
- import { useEffect, useState } from "react";
3
- import { jsx } from "react/jsx-runtime";
4
- //#region ../platform-expo/src/react.tsx
5
- /**
6
- * Start an Expo Syncore bootstrap and provide its client to React descendants.
7
- */
8
- function SyncoreExpoProvider({ bootstrap, children, fallback = null }) {
9
- const [client, setClient] = useState(null);
10
- useEffect(() => {
11
- let cancelled = false;
12
- bootstrap.getClient().then((nextClient) => {
13
- if (!cancelled) setClient(nextClient);
14
- });
15
- return () => {
16
- cancelled = true;
17
- setClient(null);
18
- bootstrap.stop();
19
- };
20
- }, [bootstrap]);
21
- if (!client) return fallback;
22
- return /* @__PURE__ */ jsx(SyncoreProvider, {
23
- client,
24
- children
25
- });
26
- }
27
- //#endregion
28
- export { SyncoreExpoProvider };
29
-
30
- //# sourceMappingURL=react.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react.js","names":[],"sources":["../../../../platform-expo/src/react.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\r\nimport type { ReactNode } from \"react\";\r\nimport { SyncoreProvider } from \"@syncore/react\";\r\nimport type { SyncoreClient } from \"@syncore/core\";\r\nimport type { ExpoSyncoreBootstrap } from \"./index.js\";\r\n\r\ntype ExpoSyncoreClient = SyncoreClient;\r\n\r\n/**\r\n * Props for {@link SyncoreExpoProvider}.\r\n */\r\nexport interface SyncoreExpoProviderProps {\r\n /** The bootstrap created with `createExpoSyncoreBootstrap`. */\r\n bootstrap: ExpoSyncoreBootstrap;\r\n\r\n /** The React subtree that should receive the Syncore client. */\r\n children: ReactNode;\r\n\r\n /** Optional fallback content rendered while the local runtime starts. */\r\n fallback?: ReactNode;\r\n}\r\n\r\n/**\r\n * Start an Expo Syncore bootstrap and provide its client to React descendants.\r\n */\r\nexport function SyncoreExpoProvider({\r\n bootstrap,\r\n children,\r\n fallback = null\r\n}: SyncoreExpoProviderProps): ReactNode {\r\n const [client, setClient] = useState<ExpoSyncoreClient | null>(null);\r\n\r\n useEffect(() => {\r\n let cancelled = false;\r\n void bootstrap.getClient().then((nextClient: ExpoSyncoreClient) => {\r\n if (!cancelled) {\r\n setClient(nextClient);\r\n }\r\n });\r\n\r\n return () => {\r\n cancelled = true;\r\n setClient(null);\r\n void bootstrap.stop();\r\n };\r\n }, [bootstrap]);\r\n\r\n if (!client) {\r\n return fallback;\r\n }\r\n\r\n return <SyncoreProvider client={client}>{children}</SyncoreProvider>;\r\n}\r\n"],"mappings":";;;;;;;AAyBA,SAAgB,oBAAoB,EAClC,WACA,UACA,WAAW,QAC2B;CACtC,MAAM,CAAC,QAAQ,aAAa,SAAmC,KAAK;AAEpE,iBAAgB;EACd,IAAI,YAAY;AACX,YAAU,WAAW,CAAC,MAAM,eAAkC;AACjE,OAAI,CAAC,UACH,WAAU,WAAW;IAEvB;AAEF,eAAa;AACX,eAAY;AACZ,aAAU,KAAK;AACV,aAAU,MAAM;;IAEtB,CAAC,UAAU,CAAC;AAEf,KAAI,CAAC,OACH,QAAO;AAGT,QAAO,oBAAC,iBAAD;EAAyB;EAAS;EAA2B,CAAA"}
@@ -1,145 +0,0 @@
1
- import { SyncoreDevtoolsEvent, SyncoreDevtoolsSnapshot } from "../../devtools-protocol/src/index.js";
2
- import { AnySyncoreSchema, DevtoolsSink, SchedulerOptions, StorageObject, StorageWriteInput, SyncoreCapabilities, SyncoreClient, SyncoreExperimentalPlugin, SyncoreRuntime, SyncoreRuntimeOptions, SyncoreSqlDriver, SyncoreStorageAdapter } from "../../core/src/runtime/runtime.js";
3
- import { DevtoolsRequestHandler } from "../../core/src/runtime/devtools.js";
4
- import { AttachNodeIpcRuntimeOptions, AttachedNodeIpcRuntime, NodeIpcSyncoreSchema, RendererQueryWatch, SyncoreIpcMessageEndpoint, SyncoreMainProcessBridge, SyncoreRendererBridge, SyncoreRendererClient, SyncoreWindowBridge, attachNodeIpcRuntime, createNodeIpcMessageEndpoint, createRendererSyncoreBridgeClient, createRendererSyncoreClient, createRendererSyncoreWindowClient, installSyncoreWindowBridge } from "./ipc.js";
5
-
6
- //#region ../platform-node/src/index.d.ts
7
- type NodeSyncoreSchema = AnySyncoreSchema;
8
- declare class NodeSqliteDriver implements SyncoreSqlDriver {
9
- private readonly database;
10
- private transactionDepth;
11
- constructor(filename: string);
12
- exec(sql: string): Promise<void>;
13
- run(sql: string, params?: unknown[]): Promise<{
14
- changes: number;
15
- lastInsertRowid?: number | string;
16
- }>;
17
- get<T>(sql: string, params?: unknown[]): Promise<T | undefined>;
18
- all<T>(sql: string, params?: unknown[]): Promise<T[]>;
19
- withTransaction<T>(callback: () => Promise<T>): Promise<T>;
20
- withSavepoint<T>(name: string, callback: () => Promise<T>): Promise<T>;
21
- close(): Promise<void>;
22
- }
23
- declare class NodeFileStorageAdapter implements SyncoreStorageAdapter {
24
- private readonly directory;
25
- constructor(directory: string);
26
- private filePath;
27
- put(id: string, input: StorageWriteInput): Promise<StorageObject>;
28
- get(id: string): Promise<StorageObject | null>;
29
- read(id: string): Promise<Uint8Array | null>;
30
- delete(id: string): Promise<void>;
31
- list(): Promise<StorageObject[]>;
32
- }
33
- interface CreateNodeRuntimeOptions {
34
- databasePath: string;
35
- storageDirectory: string;
36
- schema: NodeSyncoreSchema;
37
- functions: SyncoreRuntimeOptions<NodeSyncoreSchema>["functions"];
38
- capabilities?: SyncoreCapabilities;
39
- experimentalPlugins?: Array<SyncoreExperimentalPlugin<NodeSyncoreSchema>>;
40
- appName?: string;
41
- origin?: string;
42
- sessionLabel?: string;
43
- platform?: string;
44
- devtools?: DevtoolsSink | false;
45
- devtoolsUrl?: string;
46
- scheduler?: SchedulerOptions;
47
- }
48
- /**
49
- * Options for creating a managed Node Syncore client.
50
- */
51
- type WithNodeSyncoreClientOptions = CreateNodeRuntimeOptions;
52
- /**
53
- * A started local Node runtime paired with its client and a dispose helper.
54
- */
55
- interface ManagedNodeSyncoreClient {
56
- runtime: SyncoreRuntime<NodeSyncoreSchema>;
57
- client: ReturnType<SyncoreRuntime<NodeSyncoreSchema>["createClient"]>;
58
- dispose(): Promise<void>;
59
- }
60
- interface SyncoreElectronIpcBinding {
61
- ready: Promise<void>;
62
- dispose(): Promise<void>;
63
- }
64
- interface SyncoreElectronBridgeWindow {
65
- isDestroyed(): boolean;
66
- webContents: {
67
- send(channel: string, message: unknown): void;
68
- };
69
- }
70
- interface CreateElectronSyncoreBridgeOptions {
71
- window: SyncoreElectronBridgeWindow;
72
- onRendererMessage(listener: (message: unknown) => void): () => void;
73
- channel?: string;
74
- }
75
- /**
76
- * The subset of Electron's `ipcMain` used by Syncore's main-process helper.
77
- */
78
- interface SyncoreElectronIpcMain {
79
- on(channel: string, listener: (event: unknown, message: unknown) => void): void;
80
- off(channel: string, listener: (event: unknown, message: unknown) => void): void;
81
- }
82
- interface CreateSyncoreRendererWindowClientOptions {
83
- bridgeName?: string;
84
- }
85
- /**
86
- * Create a Node or Electron runtime backed by SQLite and local file storage.
87
- */
88
- declare function createNodeSyncoreRuntime(options: CreateNodeRuntimeOptions): SyncoreRuntime<NodeSyncoreSchema>;
89
- /**
90
- * Create a same-process Syncore client from a started Node runtime.
91
- */
92
- declare function createNodeSyncoreClient(runtime: SyncoreRuntime<NodeSyncoreSchema>): SyncoreClient;
93
- /**
94
- * Start a Node Syncore runtime and return its client together with a dispose helper.
95
- */
96
- declare function createManagedNodeSyncoreClient(options: WithNodeSyncoreClientOptions): Promise<ManagedNodeSyncoreClient>;
97
- /**
98
- * Run a callback with a started local Node Syncore client and always stop the runtime.
99
- *
100
- * @example
101
- * ```ts
102
- * await withNodeSyncoreClient(options, async (client) => {
103
- * console.log(await client.query(api.tasks.list));
104
- * });
105
- * ```
106
- */
107
- declare function withNodeSyncoreClient<TResult>(options: WithNodeSyncoreClientOptions, callback: (client: ReturnType<SyncoreRuntime<NodeSyncoreSchema>["createClient"]>, runtime: SyncoreRuntime<NodeSyncoreSchema>) => Promise<TResult> | TResult): Promise<TResult>;
108
- /**
109
- * Create the default Electron main-process bridge used to connect a BrowserWindow
110
- * to a Syncore runtime.
111
- */
112
- declare function createElectronSyncoreBridge(options: CreateElectronSyncoreBridgeOptions): SyncoreIpcMessageEndpoint & {
113
- dispose(): void;
114
- };
115
- /**
116
- * Bind a BrowserWindow to a Syncore runtime with the default Electron IPC transport.
117
- */
118
- declare function bindElectronWindowToSyncoreRuntime(options: {
119
- runtime: SyncoreRuntime<NodeSyncoreSchema>;
120
- window: SyncoreElectronBridgeWindow;
121
- onRendererMessage(listener: (message: unknown) => void): () => void;
122
- channel?: string;
123
- }): SyncoreElectronIpcBinding;
124
- declare function bindElectronWindowToSyncoreRuntime(options: {
125
- runtime: SyncoreRuntime<NodeSyncoreSchema>;
126
- window: SyncoreElectronBridgeWindow;
127
- ipcMain: SyncoreElectronIpcMain;
128
- channel?: string;
129
- }): SyncoreElectronIpcBinding;
130
- interface NodeWebSocketDevtoolsSinkOptions {
131
- url: string;
132
- reconnectDelayMs?: number;
133
- appName?: string;
134
- origin?: string;
135
- sessionLabel?: string;
136
- }
137
- interface NodeWebSocketDevtoolsSink extends DevtoolsSink {
138
- attachRuntime(getSnapshot: () => SyncoreDevtoolsSnapshot): void;
139
- attachRequestHandler(handler: DevtoolsRequestHandler): void;
140
- dispose(): void;
141
- }
142
- declare function createNodeWebSocketDevtoolsSink(options: NodeWebSocketDevtoolsSinkOptions): NodeWebSocketDevtoolsSink;
143
- //#endregion
144
- export { CreateElectronSyncoreBridgeOptions, CreateNodeRuntimeOptions, CreateSyncoreRendererWindowClientOptions, ManagedNodeSyncoreClient, NodeFileStorageAdapter, NodeSqliteDriver, NodeSyncoreSchema, NodeWebSocketDevtoolsSink, NodeWebSocketDevtoolsSinkOptions, SyncoreElectronBridgeWindow, SyncoreElectronIpcBinding, SyncoreElectronIpcMain, WithNodeSyncoreClientOptions, bindElectronWindowToSyncoreRuntime, createElectronSyncoreBridge, createManagedNodeSyncoreClient, createNodeSyncoreClient, createNodeSyncoreRuntime, createNodeWebSocketDevtoolsSink, withNodeSyncoreClient };
145
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../../platform-node/src/index.ts"],"mappings":";;;;;;KAsCY,iBAAA,GAAoB,gBAAA;AAAA,cAgBnB,g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