stellar-drive 1.0.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 (246) hide show
  1. package/README.md +607 -0
  2. package/dist/actions/remoteChange.d.ts +204 -0
  3. package/dist/actions/remoteChange.d.ts.map +1 -0
  4. package/dist/actions/remoteChange.js +424 -0
  5. package/dist/actions/remoteChange.js.map +1 -0
  6. package/dist/actions/truncateTooltip.d.ts +56 -0
  7. package/dist/actions/truncateTooltip.d.ts.map +1 -0
  8. package/dist/actions/truncateTooltip.js +312 -0
  9. package/dist/actions/truncateTooltip.js.map +1 -0
  10. package/dist/auth/crypto.d.ts +41 -0
  11. package/dist/auth/crypto.d.ts.map +1 -0
  12. package/dist/auth/crypto.js +50 -0
  13. package/dist/auth/crypto.js.map +1 -0
  14. package/dist/auth/deviceVerification.d.ts +283 -0
  15. package/dist/auth/deviceVerification.d.ts.map +1 -0
  16. package/dist/auth/deviceVerification.js +575 -0
  17. package/dist/auth/deviceVerification.js.map +1 -0
  18. package/dist/auth/displayUtils.d.ts +98 -0
  19. package/dist/auth/displayUtils.d.ts.map +1 -0
  20. package/dist/auth/displayUtils.js +145 -0
  21. package/dist/auth/displayUtils.js.map +1 -0
  22. package/dist/auth/loginGuard.d.ts +134 -0
  23. package/dist/auth/loginGuard.d.ts.map +1 -0
  24. package/dist/auth/loginGuard.js +276 -0
  25. package/dist/auth/loginGuard.js.map +1 -0
  26. package/dist/auth/offlineCredentials.d.ts +105 -0
  27. package/dist/auth/offlineCredentials.d.ts.map +1 -0
  28. package/dist/auth/offlineCredentials.js +176 -0
  29. package/dist/auth/offlineCredentials.js.map +1 -0
  30. package/dist/auth/offlineSession.d.ts +96 -0
  31. package/dist/auth/offlineSession.d.ts.map +1 -0
  32. package/dist/auth/offlineSession.js +145 -0
  33. package/dist/auth/offlineSession.js.map +1 -0
  34. package/dist/auth/resolveAuthState.d.ts +85 -0
  35. package/dist/auth/resolveAuthState.d.ts.map +1 -0
  36. package/dist/auth/resolveAuthState.js +249 -0
  37. package/dist/auth/resolveAuthState.js.map +1 -0
  38. package/dist/auth/singleUser.d.ts +498 -0
  39. package/dist/auth/singleUser.d.ts.map +1 -0
  40. package/dist/auth/singleUser.js +1282 -0
  41. package/dist/auth/singleUser.js.map +1 -0
  42. package/dist/bin/commands.d.ts +14 -0
  43. package/dist/bin/commands.d.ts.map +1 -0
  44. package/dist/bin/commands.js +68 -0
  45. package/dist/bin/commands.js.map +1 -0
  46. package/dist/bin/install-pwa.d.ts +41 -0
  47. package/dist/bin/install-pwa.d.ts.map +1 -0
  48. package/dist/bin/install-pwa.js +4594 -0
  49. package/dist/bin/install-pwa.js.map +1 -0
  50. package/dist/config.d.ts +249 -0
  51. package/dist/config.d.ts.map +1 -0
  52. package/dist/config.js +395 -0
  53. package/dist/config.js.map +1 -0
  54. package/dist/conflicts.d.ts +306 -0
  55. package/dist/conflicts.d.ts.map +1 -0
  56. package/dist/conflicts.js +807 -0
  57. package/dist/conflicts.js.map +1 -0
  58. package/dist/crdt/awareness.d.ts +128 -0
  59. package/dist/crdt/awareness.d.ts.map +1 -0
  60. package/dist/crdt/awareness.js +284 -0
  61. package/dist/crdt/awareness.js.map +1 -0
  62. package/dist/crdt/channel.d.ts +165 -0
  63. package/dist/crdt/channel.d.ts.map +1 -0
  64. package/dist/crdt/channel.js +522 -0
  65. package/dist/crdt/channel.js.map +1 -0
  66. package/dist/crdt/config.d.ts +58 -0
  67. package/dist/crdt/config.d.ts.map +1 -0
  68. package/dist/crdt/config.js +123 -0
  69. package/dist/crdt/config.js.map +1 -0
  70. package/dist/crdt/helpers.d.ts +104 -0
  71. package/dist/crdt/helpers.d.ts.map +1 -0
  72. package/dist/crdt/helpers.js +116 -0
  73. package/dist/crdt/helpers.js.map +1 -0
  74. package/dist/crdt/offline.d.ts +58 -0
  75. package/dist/crdt/offline.d.ts.map +1 -0
  76. package/dist/crdt/offline.js +130 -0
  77. package/dist/crdt/offline.js.map +1 -0
  78. package/dist/crdt/persistence.d.ts +65 -0
  79. package/dist/crdt/persistence.d.ts.map +1 -0
  80. package/dist/crdt/persistence.js +171 -0
  81. package/dist/crdt/persistence.js.map +1 -0
  82. package/dist/crdt/provider.d.ts +109 -0
  83. package/dist/crdt/provider.d.ts.map +1 -0
  84. package/dist/crdt/provider.js +543 -0
  85. package/dist/crdt/provider.js.map +1 -0
  86. package/dist/crdt/store.d.ts +111 -0
  87. package/dist/crdt/store.d.ts.map +1 -0
  88. package/dist/crdt/store.js +158 -0
  89. package/dist/crdt/store.js.map +1 -0
  90. package/dist/crdt/types.d.ts +281 -0
  91. package/dist/crdt/types.d.ts.map +1 -0
  92. package/dist/crdt/types.js +26 -0
  93. package/dist/crdt/types.js.map +1 -0
  94. package/dist/data.d.ts +502 -0
  95. package/dist/data.d.ts.map +1 -0
  96. package/dist/data.js +862 -0
  97. package/dist/data.js.map +1 -0
  98. package/dist/database.d.ts +153 -0
  99. package/dist/database.d.ts.map +1 -0
  100. package/dist/database.js +325 -0
  101. package/dist/database.js.map +1 -0
  102. package/dist/debug.d.ts +87 -0
  103. package/dist/debug.d.ts.map +1 -0
  104. package/dist/debug.js +135 -0
  105. package/dist/debug.js.map +1 -0
  106. package/dist/demo.d.ts +131 -0
  107. package/dist/demo.d.ts.map +1 -0
  108. package/dist/demo.js +168 -0
  109. package/dist/demo.js.map +1 -0
  110. package/dist/deviceId.d.ts +47 -0
  111. package/dist/deviceId.d.ts.map +1 -0
  112. package/dist/deviceId.js +106 -0
  113. package/dist/deviceId.js.map +1 -0
  114. package/dist/diagnostics.d.ts +292 -0
  115. package/dist/diagnostics.d.ts.map +1 -0
  116. package/dist/diagnostics.js +378 -0
  117. package/dist/diagnostics.js.map +1 -0
  118. package/dist/engine.d.ts +230 -0
  119. package/dist/engine.d.ts.map +1 -0
  120. package/dist/engine.js +2636 -0
  121. package/dist/engine.js.map +1 -0
  122. package/dist/entries/actions.d.ts +16 -0
  123. package/dist/entries/actions.d.ts.map +1 -0
  124. package/dist/entries/actions.js +29 -0
  125. package/dist/entries/actions.js.map +1 -0
  126. package/dist/entries/auth.d.ts +19 -0
  127. package/dist/entries/auth.d.ts.map +1 -0
  128. package/dist/entries/auth.js +50 -0
  129. package/dist/entries/auth.js.map +1 -0
  130. package/dist/entries/config.d.ts +15 -0
  131. package/dist/entries/config.d.ts.map +1 -0
  132. package/dist/entries/config.js +20 -0
  133. package/dist/entries/config.js.map +1 -0
  134. package/dist/entries/crdt.d.ts +32 -0
  135. package/dist/entries/crdt.d.ts.map +1 -0
  136. package/dist/entries/crdt.js +52 -0
  137. package/dist/entries/crdt.js.map +1 -0
  138. package/dist/entries/kit.d.ts +22 -0
  139. package/dist/entries/kit.d.ts.map +1 -0
  140. package/dist/entries/kit.js +58 -0
  141. package/dist/entries/kit.js.map +1 -0
  142. package/dist/entries/stores.d.ts +22 -0
  143. package/dist/entries/stores.d.ts.map +1 -0
  144. package/dist/entries/stores.js +57 -0
  145. package/dist/entries/stores.js.map +1 -0
  146. package/dist/entries/types.d.ts +23 -0
  147. package/dist/entries/types.d.ts.map +1 -0
  148. package/dist/entries/types.js +12 -0
  149. package/dist/entries/types.js.map +1 -0
  150. package/dist/entries/utils.d.ts +12 -0
  151. package/dist/entries/utils.d.ts.map +1 -0
  152. package/dist/entries/utils.js +42 -0
  153. package/dist/entries/utils.js.map +1 -0
  154. package/dist/entries/vite.d.ts +20 -0
  155. package/dist/entries/vite.d.ts.map +1 -0
  156. package/dist/entries/vite.js +26 -0
  157. package/dist/entries/vite.js.map +1 -0
  158. package/dist/index.d.ts +77 -0
  159. package/dist/index.d.ts.map +1 -0
  160. package/dist/index.js +234 -0
  161. package/dist/index.js.map +1 -0
  162. package/dist/kit/auth.d.ts +80 -0
  163. package/dist/kit/auth.d.ts.map +1 -0
  164. package/dist/kit/auth.js +75 -0
  165. package/dist/kit/auth.js.map +1 -0
  166. package/dist/kit/confirm.d.ts +111 -0
  167. package/dist/kit/confirm.d.ts.map +1 -0
  168. package/dist/kit/confirm.js +169 -0
  169. package/dist/kit/confirm.js.map +1 -0
  170. package/dist/kit/loads.d.ts +187 -0
  171. package/dist/kit/loads.d.ts.map +1 -0
  172. package/dist/kit/loads.js +208 -0
  173. package/dist/kit/loads.js.map +1 -0
  174. package/dist/kit/server.d.ts +175 -0
  175. package/dist/kit/server.d.ts.map +1 -0
  176. package/dist/kit/server.js +297 -0
  177. package/dist/kit/server.js.map +1 -0
  178. package/dist/kit/sw.d.ts +176 -0
  179. package/dist/kit/sw.d.ts.map +1 -0
  180. package/dist/kit/sw.js +320 -0
  181. package/dist/kit/sw.js.map +1 -0
  182. package/dist/queue.d.ts +306 -0
  183. package/dist/queue.d.ts.map +1 -0
  184. package/dist/queue.js +925 -0
  185. package/dist/queue.js.map +1 -0
  186. package/dist/realtime.d.ts +280 -0
  187. package/dist/realtime.d.ts.map +1 -0
  188. package/dist/realtime.js +1031 -0
  189. package/dist/realtime.js.map +1 -0
  190. package/dist/runtime/runtimeConfig.d.ts +110 -0
  191. package/dist/runtime/runtimeConfig.d.ts.map +1 -0
  192. package/dist/runtime/runtimeConfig.js +260 -0
  193. package/dist/runtime/runtimeConfig.js.map +1 -0
  194. package/dist/schema.d.ts +150 -0
  195. package/dist/schema.d.ts.map +1 -0
  196. package/dist/schema.js +891 -0
  197. package/dist/schema.js.map +1 -0
  198. package/dist/stores/authState.d.ts +204 -0
  199. package/dist/stores/authState.d.ts.map +1 -0
  200. package/dist/stores/authState.js +336 -0
  201. package/dist/stores/authState.js.map +1 -0
  202. package/dist/stores/factories.d.ts +140 -0
  203. package/dist/stores/factories.d.ts.map +1 -0
  204. package/dist/stores/factories.js +157 -0
  205. package/dist/stores/factories.js.map +1 -0
  206. package/dist/stores/network.d.ts +48 -0
  207. package/dist/stores/network.d.ts.map +1 -0
  208. package/dist/stores/network.js +261 -0
  209. package/dist/stores/network.js.map +1 -0
  210. package/dist/stores/remoteChanges.d.ts +417 -0
  211. package/dist/stores/remoteChanges.d.ts.map +1 -0
  212. package/dist/stores/remoteChanges.js +626 -0
  213. package/dist/stores/remoteChanges.js.map +1 -0
  214. package/dist/stores/sync.d.ts +165 -0
  215. package/dist/stores/sync.d.ts.map +1 -0
  216. package/dist/stores/sync.js +275 -0
  217. package/dist/stores/sync.js.map +1 -0
  218. package/dist/supabase/auth.d.ts +219 -0
  219. package/dist/supabase/auth.d.ts.map +1 -0
  220. package/dist/supabase/auth.js +459 -0
  221. package/dist/supabase/auth.js.map +1 -0
  222. package/dist/supabase/client.d.ts +88 -0
  223. package/dist/supabase/client.d.ts.map +1 -0
  224. package/dist/supabase/client.js +313 -0
  225. package/dist/supabase/client.js.map +1 -0
  226. package/dist/supabase/validate.d.ts +118 -0
  227. package/dist/supabase/validate.d.ts.map +1 -0
  228. package/dist/supabase/validate.js +208 -0
  229. package/dist/supabase/validate.js.map +1 -0
  230. package/dist/sw/build/vite-plugin.d.ts +149 -0
  231. package/dist/sw/build/vite-plugin.d.ts.map +1 -0
  232. package/dist/sw/build/vite-plugin.js +517 -0
  233. package/dist/sw/build/vite-plugin.js.map +1 -0
  234. package/dist/sw/sw.js +664 -0
  235. package/dist/types.d.ts +363 -0
  236. package/dist/types.d.ts.map +1 -0
  237. package/dist/types.js +18 -0
  238. package/dist/types.js.map +1 -0
  239. package/dist/utils.d.ts +85 -0
  240. package/dist/utils.d.ts.map +1 -0
  241. package/dist/utils.js +156 -0
  242. package/dist/utils.js.map +1 -0
  243. package/package.json +117 -0
  244. package/src/components/DeferredChangesBanner.svelte +477 -0
  245. package/src/components/DemoBanner.svelte +110 -0
  246. package/src/components/SyncStatus.svelte +1732 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stores.js","sourceRoot":"","sources":["../../src/entries/stores.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAChF,6EAA6E;AAC7E,4EAA4E;AAC5E,gFAAgF;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,gFAAgF;AAChF,wBAAwB;AACxB,gFAAgF;AAChF,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAC5E,kDAAkD;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,gFAAgF;AAChF,8BAA8B;AAC9B,gFAAgF;AAChF,4EAA4E;AAC5E,8EAA8E;AAE9E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAChF,wDAAwD;AACxD,sEAAsE;AACtE,6EAA6E;AAC7E,+EAA+E;AAE/E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAElF,gFAAgF;AAChF,iCAAiC;AACjC,gFAAgF;AAChF,2DAA2D;AAC3D,0EAA0E;AAC1E,2EAA2E;AAC3E,mCAAmC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAE7E,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @fileoverview Types subpath barrel — `stellar-drive/types`
3
+ *
4
+ * Aggregates all public TypeScript type exports from the stellar-drive package
5
+ * into a single, convenient entry point. Consumers can import any type from
6
+ * this path without needing to know the internal module structure.
7
+ *
8
+ * No runtime code is emitted from this file — it contains only `export type`
9
+ * statements and will be fully erased during compilation.
10
+ */
11
+ export type { SyncEngineConfig, TableConfig, InitEngineInput } from '../config';
12
+ export type { DatabaseConfig, DatabaseVersionConfig, SchemaVersionResult } from '../database';
13
+ export type { BatchOperation } from '../data';
14
+ export type { AuthStateResult } from '../auth/resolveAuthState';
15
+ export type { AppConfig } from '../runtime/runtimeConfig';
16
+ export type { SyncOperationItem, OperationType, OfflineCredentials, OfflineSession, ConflictHistoryEntry, SyncStatus, AuthMode, SingleUserConfig, SingleUserGateType, SchemaDefinition, SchemaTableConfig, AuthConfig, FieldType } from '../types';
17
+ export type { SyncError, RealtimeState } from '../stores/sync';
18
+ export type { RemoteActionType } from '../stores/remoteChanges';
19
+ export type { DiagnosticsSnapshot } from '../diagnostics';
20
+ export type { Session } from '@supabase/supabase-js';
21
+ export type { CRDTConfig, UserPresenceState } from '../crdt/types';
22
+ export type { SQLGenerationOptions, TypeScriptGenerationOptions } from '../schema';
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/entries/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAQhF,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQ9F,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAQ9C,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAOhE,YAAY,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAe1D,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,SAAS,EACV,MAAM,UAAU,CAAC;AASlB,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAOhE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAQ1D,YAAY,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQrD,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOnE,YAAY,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fileoverview Types subpath barrel — `stellar-drive/types`
3
+ *
4
+ * Aggregates all public TypeScript type exports from the stellar-drive package
5
+ * into a single, convenient entry point. Consumers can import any type from
6
+ * this path without needing to know the internal module structure.
7
+ *
8
+ * No runtime code is emitted from this file — it contains only `export type`
9
+ * statements and will be fully erased during compilation.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/entries/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fileoverview Utils subpath barrel — `stellar-drive/utils`
3
+ *
4
+ * Re-exports general-purpose utility functions, debug tooling, and the
5
+ * unified diagnostics API. These helpers are framework-agnostic and can
6
+ * be used anywhere in the application.
7
+ */
8
+ export { generateId, now, calculateNewOrder, snakeToCamel, formatBytes } from '../utils';
9
+ export { debug, isDebugMode, setDebugMode } from '../debug';
10
+ export { getDiagnostics, getSyncDiagnostics, getRealtimeDiagnostics, getQueueDiagnostics, getConflictDiagnostics, getEngineDiagnostics, getNetworkDiagnostics, getErrorDiagnostics } from '../diagnostics';
11
+ export { generateSupabaseSQL, inferColumnType, generateMigrationSQL, generateTypeScript } from '../schema';
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/entries/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,iBAAiB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAUzF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAS5D,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAUxB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @fileoverview Utils subpath barrel — `stellar-drive/utils`
3
+ *
4
+ * Re-exports general-purpose utility functions, debug tooling, and the
5
+ * unified diagnostics API. These helpers are framework-agnostic and can
6
+ * be used anywhere in the application.
7
+ */
8
+ // =============================================================================
9
+ // General Utilities
10
+ // =============================================================================
11
+ // Pure helper functions for common operations:
12
+ // - `generateId` — produces a unique identifier (UUID v4 or similar).
13
+ // - `now` — returns the current ISO 8601 timestamp string.
14
+ // - `calculateNewOrder` — computes a fractional order value for reorderable
15
+ // lists (inserts between two adjacent items without reindexing).
16
+ // - `snakeToCamel` — converts a `snake_case` string to `camelCase`.
17
+ // - `formatBytes` — formats a byte count into a human-readable string.
18
+ export { generateId, now, calculateNewOrder, snakeToCamel, formatBytes } from '../utils';
19
+ // =============================================================================
20
+ // Debug Utilities
21
+ // =============================================================================
22
+ // Development-time logging and debug mode management:
23
+ // - `debug` — conditional logger that only outputs when debug mode is active.
24
+ // - `isDebugMode` — returns whether debug mode is currently enabled.
25
+ // - `setDebugMode` — enables or disables debug mode at runtime.
26
+ export { debug, isDebugMode, setDebugMode } from '../debug';
27
+ // =============================================================================
28
+ // Diagnostics
29
+ // =============================================================================
30
+ // Unified diagnostics API for inspecting sync engine internal state:
31
+ // - `getDiagnostics` — returns a comprehensive JSON snapshot of all engine state.
32
+ // - Sub-category functions for lightweight access to specific sections.
33
+ export { getDiagnostics, getSyncDiagnostics, getRealtimeDiagnostics, getQueueDiagnostics, getConflictDiagnostics, getEngineDiagnostics, getNetworkDiagnostics, getErrorDiagnostics } from '../diagnostics';
34
+ // =============================================================================
35
+ // SQL Generation
36
+ // =============================================================================
37
+ // Generate complete Supabase SQL from a declarative schema definition:
38
+ // - `generateSupabaseSQL` — produces CREATE TABLE, RLS, triggers, indexes.
39
+ // - `inferColumnType` — maps field names to SQL types via naming conventions.
40
+ // - `generateMigrationSQL` — diffs two schemas and produces ALTER statements.
41
+ export { generateSupabaseSQL, inferColumnType, generateMigrationSQL, generateTypeScript } from '../schema';
42
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/entries/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAChF,+CAA+C;AAC/C,sEAAsE;AACtE,2DAA2D;AAC3D,4EAA4E;AAC5E,mEAAmE;AACnE,oEAAoE;AACpE,uEAAuE;AAEvE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,iBAAiB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzF,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAChF,sDAAsD;AACtD,8EAA8E;AAC9E,qEAAqE;AACrE,gEAAgE;AAEhE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE5D,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAChF,qEAAqE;AACrE,kFAAkF;AAClF,wEAAwE;AAExE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAExB,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAChF,uEAAuE;AACvE,2EAA2E;AAC3E,8EAA8E;AAC9E,8EAA8E;AAE9E,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @fileoverview Vite subpath barrel — `stellar-drive/vite`
3
+ *
4
+ * Provides the Vite plugin for building and configuring the service worker
5
+ * required by stellar-drive's PWA functionality. This entry point is intended
6
+ * for use in `vite.config.ts` only — it runs at build time, not in the browser.
7
+ *
8
+ * Usage:
9
+ * ```ts
10
+ * // vite.config.ts
11
+ * import { stellarPWA } from 'stellar-drive/vite';
12
+ *
13
+ * export default defineConfig({
14
+ * plugins: [stellarPWA({ /* SWConfig options *\/ })]
15
+ * });
16
+ * ```
17
+ */
18
+ export { stellarPWA } from '../sw/build/vite-plugin.js';
19
+ export type { SWConfig, SchemaConfig } from '../sw/build/vite-plugin.js';
20
+ //# sourceMappingURL=vite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/entries/vite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @fileoverview Vite subpath barrel — `stellar-drive/vite`
3
+ *
4
+ * Provides the Vite plugin for building and configuring the service worker
5
+ * required by stellar-drive's PWA functionality. This entry point is intended
6
+ * for use in `vite.config.ts` only — it runs at build time, not in the browser.
7
+ *
8
+ * Usage:
9
+ * ```ts
10
+ * // vite.config.ts
11
+ * import { stellarPWA } from 'stellar-drive/vite';
12
+ *
13
+ * export default defineConfig({
14
+ * plugins: [stellarPWA({ /* SWConfig options *\/ })]
15
+ * });
16
+ * ```
17
+ */
18
+ // =============================================================================
19
+ // Stellar PWA Vite Plugin
20
+ // =============================================================================
21
+ // - `stellarPWA` — Vite plugin factory that generates and injects a service
22
+ // worker with precaching, runtime caching strategies, and offline support.
23
+ // - `SWConfig` — configuration interface for customizing cache strategies,
24
+ // precache globs, network-first vs cache-first routes, and SW behaviour.
25
+ export { stellarPWA } from '../sw/build/vite-plugin.js';
26
+ //# sourceMappingURL=vite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.js","sourceRoot":"","sources":["../../src/entries/vite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAChF,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,2EAA2E;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @fileoverview Main entry point — `stellar-drive`
3
+ *
4
+ * This is the primary barrel export for the stellar-drive package. It
5
+ * re-exports the **full** public API surface, covering:
6
+ *
7
+ * - **Engine Configuration & Lifecycle** — initialize, start, and run the
8
+ * offline-first sync engine.
9
+ * - **Database Access** — get a handle to the IndexedDB instance or reset it.
10
+ * - **Generic CRUD & Query** — create, read, update, delete, batch write,
11
+ * increment, and query data in the local database.
12
+ * - **Authentication** — Single-user PIN/password gate auth, device
13
+ * verification, login guards, and session management.
14
+ * - **Reactive Stores** — Svelte-compatible stores for sync status, network
15
+ * state, remote changes, and auth state.
16
+ * - **Realtime Events** — lifecycle hooks for sync completion and realtime
17
+ * data updates.
18
+ * - **Runtime Configuration** — read and write app-level config at runtime.
19
+ * - **Debug & Utilities** — logging, ID generation, ordering, and string
20
+ * conversion helpers.
21
+ * - **Svelte Actions** — DOM-level directives for remote-change animations.
22
+ * - **Type Definitions** — all public TypeScript types and interfaces.
23
+ * - **Supabase Client** — direct access to the Supabase client for advanced
24
+ * or custom queries.
25
+ * - **Supabase Validation** — server-side credential and schema validation.
26
+ *
27
+ * For tree-shaking or smaller bundle sizes, prefer the subpath entry points
28
+ * (e.g. `stellar-drive/auth`, `stellar-drive/stores`)
29
+ * which expose focused subsets of this API.
30
+ */
31
+ export { initEngine } from './config';
32
+ export type { SyncEngineConfig, TableConfig, InitEngineInput } from './config';
33
+ export { getDb, resetDatabase } from './database';
34
+ export type { DatabaseConfig, DatabaseVersionConfig } from './database';
35
+ export { SYSTEM_INDEXES, computeSchemaVersion } from './database';
36
+ export type { SchemaVersionResult } from './database';
37
+ export { startSyncEngine, runFullSync } from './engine';
38
+ export { onSyncComplete } from './engine';
39
+ export { engineCreate, engineUpdate, engineDelete, engineBatchWrite, engineIncrement } from './data';
40
+ export type { BatchOperation } from './data';
41
+ export { engineGet, engineGetAll, engineQuery, engineQueryRange, engineGetOrCreate } from './data';
42
+ export { queryAll, queryOne, reorderEntity, prependOrder } from './data';
43
+ export { signOut, resendConfirmationEmail, getUserProfile, updateProfile, verifyOtp, getValidSession } from './supabase/auth';
44
+ export { resolveAuthState } from './auth/resolveAuthState';
45
+ export type { AuthStateResult } from './auth/resolveAuthState';
46
+ export { resetLoginGuard } from './auth/loginGuard';
47
+ export { isSingleUserSetUp, getSingleUserInfo, setupSingleUser, unlockSingleUser, lockSingleUser, changeSingleUserGate, updateSingleUserProfile, resetSingleUser, completeSingleUserSetup, completeDeviceVerification, pollDeviceVerification, padPin, changeSingleUserEmail, completeSingleUserEmailChange, fetchRemoteGateConfig, linkSingleUserDevice, resetSingleUserRemote } from './auth/singleUser';
48
+ export { resolveFirstName, resolveUserId, resolveAvatarInitial } from './auth/displayUtils';
49
+ export { isDeviceTrusted, trustCurrentDevice, trustPendingDevice, getTrustedDevices, removeTrustedDevice, maskEmail, sendDeviceVerification, getCurrentDeviceId, getDeviceLabel } from './auth/deviceVerification';
50
+ export { syncStatusStore } from './stores/sync';
51
+ export type { SyncError, RealtimeState } from './stores/sync';
52
+ export { remoteChangesStore } from './stores/remoteChanges';
53
+ export type { RemoteActionType } from './stores/remoteChanges';
54
+ export { isOnline } from './stores/network';
55
+ export { authState, isAuthenticated, userDisplayInfo } from './stores/authState';
56
+ export { createCollectionStore, createDetailStore } from './stores/factories';
57
+ export type { CollectionStore, CollectionStoreConfig, DetailStore, DetailStoreConfig } from './stores/factories';
58
+ export { onRealtimeDataUpdate } from './realtime';
59
+ export { supabase } from './supabase/client';
60
+ export { initConfig, getConfig, setConfig } from './runtime/runtimeConfig';
61
+ export type { AppConfig } from './runtime/runtimeConfig';
62
+ export { debug, isDebugMode, setDebugMode } from './debug';
63
+ export { generateId, now, calculateNewOrder, snakeToCamel, formatBytes } from './utils';
64
+ export { getDiagnostics, getSyncDiagnostics, getRealtimeDiagnostics, getQueueDiagnostics, getConflictDiagnostics, getEngineDiagnostics, getNetworkDiagnostics, getErrorDiagnostics } from './diagnostics';
65
+ export type { DiagnosticsSnapshot } from './diagnostics';
66
+ export { remoteChangeAnimation, trackEditing, triggerLocalAnimation } from './actions/remoteChange';
67
+ export { isDemoMode, setDemoMode, seedDemoData, cleanupDemoDatabase, getDemoConfig } from './demo';
68
+ export type { DemoConfig } from './demo';
69
+ export type { SyncOperationItem, OperationType, OfflineCredentials, OfflineSession, ConflictHistoryEntry, SyncStatus, AuthMode, SingleUserConfig, SingleUserGateType, TrustedDevice, SchemaDefinition, SchemaTableConfig, AuthConfig, FieldType } from './types';
70
+ export { generateSupabaseSQL, inferColumnType, generateMigrationSQL, generateTypeScript } from './schema';
71
+ export type { SQLGenerationOptions, TypeScriptGenerationOptions } from './schema';
72
+ export type { Session } from '@supabase/supabase-js';
73
+ export { validateSupabaseCredentials, validateSchema } from './supabase/validate';
74
+ export { isCRDTEnabled } from './crdt/config';
75
+ export type { CRDTConfig } from './crdt/types';
76
+ export type { UserPresenceState } from './crdt/types';
77
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AASH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAA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,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAUzD,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAYpG,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACnG,YAAY,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQzC,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,SAAS,EACV,MAAM,SAAS,CAAC;AAQjB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAQlF,YAAY,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAYrD,OAAO,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AASlF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,234 @@
1
+ /**
2
+ * @fileoverview Main entry point — `stellar-drive`
3
+ *
4
+ * This is the primary barrel export for the stellar-drive package. It
5
+ * re-exports the **full** public API surface, covering:
6
+ *
7
+ * - **Engine Configuration & Lifecycle** — initialize, start, and run the
8
+ * offline-first sync engine.
9
+ * - **Database Access** — get a handle to the IndexedDB instance or reset it.
10
+ * - **Generic CRUD & Query** — create, read, update, delete, batch write,
11
+ * increment, and query data in the local database.
12
+ * - **Authentication** — Single-user PIN/password gate auth, device
13
+ * verification, login guards, and session management.
14
+ * - **Reactive Stores** — Svelte-compatible stores for sync status, network
15
+ * state, remote changes, and auth state.
16
+ * - **Realtime Events** — lifecycle hooks for sync completion and realtime
17
+ * data updates.
18
+ * - **Runtime Configuration** — read and write app-level config at runtime.
19
+ * - **Debug & Utilities** — logging, ID generation, ordering, and string
20
+ * conversion helpers.
21
+ * - **Svelte Actions** — DOM-level directives for remote-change animations.
22
+ * - **Type Definitions** — all public TypeScript types and interfaces.
23
+ * - **Supabase Client** — direct access to the Supabase client for advanced
24
+ * or custom queries.
25
+ * - **Supabase Validation** — server-side credential and schema validation.
26
+ *
27
+ * For tree-shaking or smaller bundle sizes, prefer the subpath entry points
28
+ * (e.g. `stellar-drive/auth`, `stellar-drive/stores`)
29
+ * which expose focused subsets of this API.
30
+ */
31
+ // =============================================================================
32
+ // Engine Configuration
33
+ // =============================================================================
34
+ // `initEngine` bootstraps the sync engine with the provided configuration
35
+ // (Supabase credentials, table definitions, conflict strategies, etc.).
36
+ // `SyncEngineConfig` and `TableConfig` describe the configuration shape.
37
+ export { initEngine } from './config';
38
+ // =============================================================================
39
+ // Database Access
40
+ // =============================================================================
41
+ // Direct access to the underlying IndexedDB database:
42
+ // - `getDb` — returns a typed handle to the open database instance.
43
+ // - `resetDatabase` — deletes and re-creates the local database (destructive).
44
+ export { getDb, resetDatabase } from './database';
45
+ export { SYSTEM_INDEXES, computeSchemaVersion } from './database';
46
+ // =============================================================================
47
+ // Engine Lifecycle
48
+ // =============================================================================
49
+ // Controls for the sync engine's runtime lifecycle:
50
+ // - `startSyncEngine` — begins periodic background sync and realtime
51
+ // subscription after the engine has been initialized.
52
+ // - `runFullSync` — triggers an immediate full sync cycle (push + pull).
53
+ // - `onSyncComplete` — registers a callback that fires after each successful
54
+ // sync cycle (useful for refreshing UI or derived data).
55
+ export { startSyncEngine, runFullSync } from './engine';
56
+ export { onSyncComplete } from './engine';
57
+ // =============================================================================
58
+ // Generic CRUD Operations
59
+ // =============================================================================
60
+ // Framework-agnostic data mutation functions that write to IndexedDB and queue
61
+ // changes for the next sync cycle:
62
+ // - `engineCreate` — inserts a new entity.
63
+ // - `engineUpdate` — patches an existing entity.
64
+ // - `engineDelete` — marks an entity as deleted (soft-delete for sync).
65
+ // - `engineBatchWrite` — applies multiple operations atomically.
66
+ // - `engineIncrement` — atomically increments a numeric field.
67
+ export { engineCreate, engineUpdate, engineDelete, engineBatchWrite, engineIncrement } from './data';
68
+ // =============================================================================
69
+ // Generic Query Operations
70
+ // =============================================================================
71
+ // Read-only data access functions that query the local IndexedDB:
72
+ // - `engineGet` — retrieves a single entity by primary key.
73
+ // - `engineGetAll` — retrieves all entities in a table.
74
+ // - `engineQuery` — retrieves entities matching a key-value filter.
75
+ // - `engineQueryRange` — retrieves entities within an IDB key range.
76
+ // - `engineGetOrCreate` — retrieves an entity or creates it with defaults.
77
+ export { engineGet, engineGetAll, engineQuery, engineQueryRange, engineGetOrCreate } from './data';
78
+ // =============================================================================
79
+ // Query & Repository Helpers
80
+ // =============================================================================
81
+ // Convenience wrappers that eliminate repetitive query and repository patterns:
82
+ // - `queryAll` — fetches all non-deleted records, sorted by order.
83
+ // - `queryOne` — fetches a single non-deleted record by ID.
84
+ // - `reorderEntity` — updates just the order field on any entity.
85
+ // - `prependOrder` — computes the next prepend-order value.
86
+ export { queryAll, queryOne, reorderEntity, prependOrder } from './data';
87
+ // =============================================================================
88
+ // Supabase Auth — Core Authentication Utilities
89
+ // =============================================================================
90
+ // Sign-out with full teardown, session management, profile CRUD, email
91
+ // confirmation resend, OTP verification, and session validation.
92
+ export { signOut, resendConfirmationEmail, getUserProfile, updateProfile, verifyOtp, getValidSession } from './supabase/auth';
93
+ // =============================================================================
94
+ // Auth State Resolution
95
+ // =============================================================================
96
+ // Determines the user's authentication state during app initialization.
97
+ // Returns an `AuthStateResult` describing whether the user is authenticated,
98
+ // anonymous, has an expired session, or needs setup.
99
+ export { resolveAuthState } from './auth/resolveAuthState';
100
+ // =============================================================================
101
+ // Login Guard
102
+ // =============================================================================
103
+ // Prevents duplicate login attempts by maintaining a transient lock.
104
+ // `resetLoginGuard` clears the lock (e.g. after a failed attempt).
105
+ export { resetLoginGuard } from './auth/loginGuard';
106
+ // =============================================================================
107
+ // Single-User Auth (PIN/Password Gate)
108
+ // =============================================================================
109
+ // Full lifecycle for single-user (kiosk/personal device) authentication:
110
+ // setup, lock/unlock, profile management, device linking, and remote config.
111
+ export { isSingleUserSetUp, getSingleUserInfo, setupSingleUser, unlockSingleUser, lockSingleUser, changeSingleUserGate, updateSingleUserProfile, resetSingleUser, completeSingleUserSetup, completeDeviceVerification, pollDeviceVerification, padPin, changeSingleUserEmail, completeSingleUserEmailChange, fetchRemoteGateConfig, linkSingleUserDevice, resetSingleUserRemote } from './auth/singleUser';
112
+ // =============================================================================
113
+ // Auth Display Utilities
114
+ // =============================================================================
115
+ // Pure helper functions that resolve user-facing display values from the auth
116
+ // state. Each handles the full fallback chain across online (Supabase session)
117
+ // and offline (cached credential) modes.
118
+ export { resolveFirstName, resolveUserId, resolveAvatarInitial } from './auth/displayUtils';
119
+ // =============================================================================
120
+ // Device Verification
121
+ // =============================================================================
122
+ // Trust management for multi-device single-user setups:
123
+ // - `isDeviceTrusted` / `trustCurrentDevice` / `trustPendingDevice` — manage
124
+ // the trust status of the current or a pending device.
125
+ // - `getTrustedDevices` / `removeTrustedDevice` — list and revoke trusted devices.
126
+ // - `maskEmail` — partially masks an email for display during verification.
127
+ // - `sendDeviceVerification` — initiates the device verification email flow.
128
+ // - `getCurrentDeviceId` / `getDeviceLabel` — device identification helpers.
129
+ export { isDeviceTrusted, trustCurrentDevice, trustPendingDevice, getTrustedDevices, removeTrustedDevice, maskEmail, sendDeviceVerification, getCurrentDeviceId, getDeviceLabel } from './auth/deviceVerification';
130
+ // =============================================================================
131
+ // Reactive Stores
132
+ // =============================================================================
133
+ // Svelte-compatible stores providing real-time observability into the engine:
134
+ // - `syncStatusStore` — sync lifecycle state, pending count, errors, realtime state.
135
+ // - `remoteChangesStore` — incoming remote changes and deferred-change tracking.
136
+ // - `isOnline` — boolean reflecting browser online/offline status.
137
+ // - `authState` / `isAuthenticated` / `userDisplayInfo` — auth state stores.
138
+ export { syncStatusStore } from './stores/sync';
139
+ export { remoteChangesStore } from './stores/remoteChanges';
140
+ export { isOnline } from './stores/network';
141
+ export { authState, isAuthenticated, userDisplayInfo } from './stores/authState';
142
+ // =============================================================================
143
+ // Store Factories
144
+ // =============================================================================
145
+ // Generic factory functions for creating reactive stores with built-in loading
146
+ // state and sync-complete auto-refresh.
147
+ export { createCollectionStore, createDetailStore } from './stores/factories';
148
+ // =============================================================================
149
+ // Realtime Event Subscriptions
150
+ // =============================================================================
151
+ // Callback registration for app-specific event hooks. `onRealtimeDataUpdate`
152
+ // fires when a realtime payload is received and applied to the local database,
153
+ // allowing the app to react to cross-device changes.
154
+ export { onRealtimeDataUpdate } from './realtime';
155
+ // =============================================================================
156
+ // Supabase Client (Advanced / Custom Queries)
157
+ // =============================================================================
158
+ // Direct access to the initialized Supabase client instance. Use this for
159
+ // queries or operations not covered by the generic CRUD layer (e.g. RPC calls,
160
+ // storage operations, or custom PostgREST filters).
161
+ export { supabase } from './supabase/client';
162
+ // =============================================================================
163
+ // Runtime Configuration
164
+ // =============================================================================
165
+ // Application-level configuration store:
166
+ // - `initConfig` — initializes with defaults on app boot.
167
+ // - `getConfig` — reads the current configuration snapshot.
168
+ // - `setConfig` — merges partial updates into the active configuration.
169
+ export { initConfig, getConfig, setConfig } from './runtime/runtimeConfig';
170
+ // =============================================================================
171
+ // Debug Utilities
172
+ // =============================================================================
173
+ // Development-time logging and debug mode management:
174
+ // - `debug` — conditional logger (only outputs when debug mode is active).
175
+ // - `isDebugMode` / `setDebugMode` — query and toggle debug mode at runtime.
176
+ export { debug, isDebugMode, setDebugMode } from './debug';
177
+ // =============================================================================
178
+ // General Utilities
179
+ // =============================================================================
180
+ // Pure helper functions:
181
+ // - `generateId` — produces a unique identifier.
182
+ // - `now` — returns the current ISO 8601 timestamp.
183
+ // - `calculateNewOrder` — computes fractional order for reorderable lists.
184
+ // - `snakeToCamel` — converts `snake_case` to `camelCase`.
185
+ export { generateId, now, calculateNewOrder, snakeToCamel, formatBytes } from './utils';
186
+ // =============================================================================
187
+ // Diagnostics
188
+ // =============================================================================
189
+ // Unified diagnostics API for inspecting sync engine internal state.
190
+ // `getDiagnostics()` returns a comprehensive JSON snapshot; sub-category
191
+ // functions provide lightweight access to specific sections.
192
+ export { getDiagnostics, getSyncDiagnostics, getRealtimeDiagnostics, getQueueDiagnostics, getConflictDiagnostics, getEngineDiagnostics, getNetworkDiagnostics, getErrorDiagnostics } from './diagnostics';
193
+ // =============================================================================
194
+ // Svelte Actions
195
+ // =============================================================================
196
+ // DOM-level `use:action` directives for remote-change visual feedback:
197
+ // - `remoteChangeAnimation` — applies a highlight/pulse when a remote update arrives.
198
+ // - `trackEditing` — marks an element as actively being edited.
199
+ // - `triggerLocalAnimation` — manually fires the animation for local feedback.
200
+ export { remoteChangeAnimation, trackEditing, triggerLocalAnimation } from './actions/remoteChange';
201
+ // =============================================================================
202
+ // Demo Mode
203
+ // =============================================================================
204
+ // Demo mode provides a completely isolated sandbox for consumer apps:
205
+ // - `isDemoMode` — checks whether the app is running in demo mode.
206
+ // - `setDemoMode` — activates or deactivates demo mode (requires page reload).
207
+ // - `seedDemoData` — seeds the demo database with mock data (idempotent).
208
+ // - `cleanupDemoDatabase` — deletes the demo database entirely.
209
+ // - `DemoConfig` — configuration interface for demo mode.
210
+ export { isDemoMode, setDemoMode, seedDemoData, cleanupDemoDatabase, getDemoConfig } from './demo';
211
+ // =============================================================================
212
+ // SQL Generation
213
+ // =============================================================================
214
+ // Generate complete Supabase SQL from a declarative schema definition.
215
+ // These are also available via `stellar-drive/utils`.
216
+ export { generateSupabaseSQL, inferColumnType, generateMigrationSQL, generateTypeScript } from './schema';
217
+ // =============================================================================
218
+ // Supabase Credential Validation (Server-Side)
219
+ // =============================================================================
220
+ // Server-side utilities for validating Supabase credentials and database
221
+ // schema during initial app setup flows:
222
+ // - `validateSupabaseCredentials` — tests that the provided URL and anon key
223
+ // can successfully connect to a Supabase project.
224
+ // - `validateSchema` — verifies that the required database tables and columns
225
+ // exist in the connected Supabase project.
226
+ export { validateSupabaseCredentials, validateSchema } from './supabase/validate';
227
+ // =============================================================================
228
+ // CRDT Collaborative Editing
229
+ // =============================================================================
230
+ // Optional CRDT subsystem for real-time collaborative document editing.
231
+ // Only functional when `crdt` config is provided to `initEngine()`.
232
+ // For tree-shaking, prefer the subpath: `stellar-drive/crdt`.
233
+ export { isCRDTEnabled } from './crdt/config';
234
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,gFAAgF;AAChF,wBAAwB;AACxB,gFAAgF;AAChF,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAChF,sDAAsD;AACtD,oEAAoE;AACpE,+EAA+E;AAE/E,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGlE,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAChF,oDAAoD;AACpD,qEAAqE;AACrE,wDAAwD;AACxD,yEAAyE;AACzE,6EAA6E;AAC7E,2DAA2D;AAE3D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,C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AO,EAAE,qBAAqB,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpG,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAChF,sEAAsE;AACtE,mEAAmE;AACnE,+EAA+E;AAC/E,0EAA0E;AAC1E,gEAAgE;AAChE,0DAA0D;AAE1D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AA0BnG,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAChF,uEAAuE;AACvE,sDAAsD;AAEtD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAWlB,gFAAgF;AAChF,gDAAgD;AAChD,gFAAgF;AAChF,yEAAyE;AACzE,yCAAyC;AACzC,6EAA6E;AAC7E,oDAAoD;AACpD,8EAA8E;AAC9E,6CAA6C;AAE7C,OAAO,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAElF,gFAAgF;AAChF,8BAA8B;AAC9B,gFAAgF;AAChF,wEAAwE;AACxE,oEAAoE;AACpE,8DAA8D;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @fileoverview Auth hydration helper for the root layout component.
3
+ *
4
+ * This module bridges the gap between SvelteKit's server-side load data and
5
+ * the client-side reactive auth store (`authState`). When the root layout
6
+ * receives auth-related data from a load function, this helper inspects the
7
+ * `authMode` discriminator and calls the corresponding `authState.set*()`
8
+ * setter so that every downstream component gets reactive access to the
9
+ * current authentication state without needing to know the hydration details.
10
+ *
11
+ * @module kit/auth
12
+ *
13
+ * @example
14
+ * ```svelte
15
+ * <!-- +layout.svelte -->
16
+ * <script lang="ts">
17
+ * import { hydrateAuthState } from 'stellar-drive/kit/auth';
18
+ * let { data } = $props();
19
+ * $effect(() => { hydrateAuthState(data); });
20
+ * </script>
21
+ * ```
22
+ *
23
+ * @see {@link authState} for the reactive store being hydrated
24
+ * @see {@link resolveAuthState} in `auth/resolveAuthState.ts` for how auth
25
+ * state is determined on the server/load side
26
+ */
27
+ import type { AuthMode, OfflineCredentials } from '../types.js';
28
+ import type { Session } from '@supabase/supabase-js';
29
+ /**
30
+ * Shape of the layout data expected by `hydrateAuthState`.
31
+ *
32
+ * This interface mirrors the return type of the root layout load function,
33
+ * containing the three fields needed to fully reconstruct auth state on the
34
+ * client side.
35
+ */
36
+ export interface AuthLayoutData {
37
+ /**
38
+ * Discriminator indicating which authentication strategy is active.
39
+ * - `'supabase'` — cloud-hosted auth via Supabase
40
+ * - `'offline'` — local/offline credentials (single-user mode)
41
+ * - `'none'` — no active authentication
42
+ */
43
+ authMode: AuthMode;
44
+ /**
45
+ * The Supabase session object, present only when `authMode === 'supabase'`.
46
+ * Contains the access token, refresh token, and user metadata.
47
+ */
48
+ session: Session | null;
49
+ /**
50
+ * The offline profile credentials, present only when `authMode === 'offline'`.
51
+ * Contains locally-stored user identity information for single-user setups.
52
+ */
53
+ offlineProfile: OfflineCredentials | null;
54
+ }
55
+ /**
56
+ * Reads layout load data (`{ authMode, session, offlineProfile }`) and calls
57
+ * the appropriate `authState.set*()` method to hydrate the client-side
58
+ * reactive auth store.
59
+ *
60
+ * The function acts as a switchboard: it inspects `authMode` and delegates to
61
+ * the matching setter on the `authState` store. This keeps the root layout
62
+ * component free of branching logic and ensures a single source of truth for
63
+ * how layout data maps to reactive state.
64
+ *
65
+ * Call this from a Svelte 5 `$effect()` in your root `+layout.svelte` so it
66
+ * re-runs whenever the layout data changes (e.g. after a login or logout):
67
+ *
68
+ * @param layoutData - The auth-related subset of root layout load data.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * // In +layout.svelte
73
+ * $effect(() => { hydrateAuthState(data); });
74
+ * ```
75
+ *
76
+ * @see {@link AuthLayoutData} for the expected shape of `layoutData`
77
+ * @see {@link authState} for the store methods being invoked
78
+ */
79
+ export declare function hydrateAuthState(layoutData: AuthLayoutData): void;
80
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/kit/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMrD;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;;OAGG;IACH,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAExB;;;OAGG;IACH,cAAc,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC3C;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAgBjE"}