@laboverwire/stitch 0.4.1 → 0.5.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 (68) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +8 -5
  3. package/dist/index.d.ts +1 -8
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +0 -7
  6. package/dist/index.js.map +1 -1
  7. package/dist/internal-list-apply.js.map +1 -1
  8. package/dist/react/context.js.map +1 -1
  9. package/dist/react/hooks/useChildCounts.js.map +1 -1
  10. package/dist/react/hooks/useConnectionStatus.js.map +1 -1
  11. package/dist/react/hooks/useEntitySnapshot.js.map +1 -1
  12. package/dist/react/hooks/useRootEntityList.js.map +1 -1
  13. package/dist/react/hooks/useScopedEntities.js.map +1 -1
  14. package/dist/react/hooks/useSyncScope.js.map +1 -1
  15. package/dist/react/hooks/useTopLevelEntities.js.map +1 -1
  16. package/dist/react/index.js.map +1 -1
  17. package/dist/react/provider.d.ts +2 -2
  18. package/dist/react/provider.d.ts.map +1 -1
  19. package/dist/react/provider.js.map +1 -1
  20. package/dist/store.d.ts +2 -2
  21. package/dist/store.d.ts.map +1 -1
  22. package/dist/store.js +190 -724
  23. package/dist/store.js.map +1 -1
  24. package/dist/types.d.ts +23 -161
  25. package/dist/types.d.ts.map +1 -1
  26. package/dist/types.js +1 -6
  27. package/dist/types.js.map +1 -1
  28. package/dist/vue/StitchAuth.js.map +1 -1
  29. package/dist/vue/StoreRoot.js.map +1 -1
  30. package/dist/vue/composables/useChildCounts.js.map +1 -1
  31. package/dist/vue/composables/useConnectionStatus.js.map +1 -1
  32. package/dist/vue/composables/useEntitySnapshot.js.map +1 -1
  33. package/dist/vue/composables/useRootEntityList.js.map +1 -1
  34. package/dist/vue/composables/useScopedEntities.js.map +1 -1
  35. package/dist/vue/composables/useStore.js.map +1 -1
  36. package/dist/vue/composables/useSyncScope.js.map +1 -1
  37. package/dist/vue/composables/useTopLevelEntities.js.map +1 -1
  38. package/dist/vue/index.js.map +1 -1
  39. package/dist/vue/injection-key.js.map +1 -1
  40. package/package.json +17 -8
  41. package/dist/internal-utils.d.ts +0 -3
  42. package/dist/internal-utils.d.ts.map +0 -1
  43. package/dist/internal-utils.js +0 -15
  44. package/dist/internal-utils.js.map +0 -1
  45. package/dist/internal-wasm-error.d.ts +0 -9
  46. package/dist/internal-wasm-error.d.ts.map +0 -1
  47. package/dist/internal-wasm-error.js +0 -48
  48. package/dist/internal-wasm-error.js.map +0 -1
  49. package/dist/memory-store.d.ts +0 -3
  50. package/dist/memory-store.d.ts.map +0 -1
  51. package/dist/memory-store.js +0 -572
  52. package/dist/memory-store.js.map +0 -1
  53. package/dist/offline-queue.d.ts +0 -6
  54. package/dist/offline-queue.d.ts.map +0 -1
  55. package/dist/offline-queue.js +0 -361
  56. package/dist/offline-queue.js.map +0 -1
  57. package/dist/persistence-layer.d.ts +0 -7
  58. package/dist/persistence-layer.d.ts.map +0 -1
  59. package/dist/persistence-layer.js +0 -409
  60. package/dist/persistence-layer.js.map +0 -1
  61. package/dist/remote-sync-layer.d.ts +0 -8
  62. package/dist/remote-sync-layer.d.ts.map +0 -1
  63. package/dist/remote-sync-layer.js +0 -439
  64. package/dist/remote-sync-layer.js.map +0 -1
  65. package/dist/sync-engine.d.ts +0 -3
  66. package/dist/sync-engine.d.ts.map +0 -1
  67. package/dist/sync-engine.js +0 -643
  68. package/dist/sync-engine.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useTopLevelEntities.js","sourceRoot":"","sources":["../../../src/vue/composables/useTopLevelEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAGzD,OAAO,EAAE,UAAU,EAAiB,MAAM,8BAA8B,CAAC;AAEzE,MAAM,UAAU,mBAAmB,CACjC,KAAY,EACZ,MAAc;IAKd,MAAM,KAAK,GAAG,UAAU,CAAa,EAAE,CAAC,C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M,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;gBACxC,OAAO;YACT,CAAC;YACD,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,QAAQ,EAAE,CAAC;QAEX,SAAS,CAAC,GAAG,EAAE;YACb,SAAS,GAAG,IAAI,CAAC;YACjB,WAAW,EAAE,EAAE,CAAC;YAChB,WAAW,GAAG,IAAI,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;IAEF,eAAe,CAAC,GAAG,EAAE;QACnB,WAAW,EAAE,EAAE,CAAC;QAChB,WAAW,GAAG,IAAI,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["import { shallowRef, watch, onBeforeUnmount } from 'vue';\nimport type { ShallowRef } from 'vue';\nimport type { Store } from '../../types.ts';\nimport { applyEvent, type ListItem } from '../../internal-list-apply.ts';\n\nexport function useTopLevelEntities(\n store: Store,\n entity: string\n): {\n items: ShallowRef<ListItem[]>;\n loading: ShallowRef<boolean>;\n} {\n const items = shallowRef<ListItem[]>([]);\n const loading = shallowRef(true);\n let unsubscribe: (() => void) | null = null;\n\n watch(\n () => [store, entity] as const,\n ([s, ent], _prev, onCleanup) => {\n unsubscribe?.();\n unsubscribe = null;\n\n let fetched = false;\n let cancelled = false;\n const buffer: Array<{ entity: unknown; op: 'insert' | 'update' | 'delete' }> = [];\n\n const fetchAll = () => {\n s.list(ent)\n .then((rows) => {\n if (cancelled) return;\n let result = rows as ListItem[];\n for (const { entity: e, op } of buffer) result = applyEvent(result, e, op);\n buffer.length = 0;\n fetched = true;\n items.value = result;\n loading.value = false;\n })\n .catch(() => {\n if (cancelled) return;\n fetched = true;\n buffer.length = 0;\n loading.value = false;\n });\n };\n\n unsubscribe = s.subscribeToEntity(ent, (entityData, op) => {\n if (entityData === null) {\n fetchAll();\n return;\n }\n if (!fetched) {\n buffer.push({ entity: entityData, op });\n return;\n }\n items.value = applyEvent(items.value, entityData, op);\n });\n\n fetchAll();\n\n onCleanup(() => {\n cancelled = true;\n unsubscribe?.();\n unsubscribe = null;\n });\n },\n { immediate: true }\n );\n\n onBeforeUnmount(() => {\n unsubscribe?.();\n unsubscribe = null;\n });\n\n return { items, loading };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC","sourcesContent":["export { STITCH_KEY } from './injection-key.ts';\nexport type { StitchContext } from './injection-key.ts';\nexport { StoreRoot } from './StoreRoot.ts';\nexport { StitchAuth } from './StitchAuth.ts';\nexport { useStore } from './composables/useStore.ts';\nexport { useEntitySnapshot, useEntitySnapshotAsMap } from './composables/useEntitySnapshot.ts';\nexport { useConnectionStatus } from './composables/useConnectionStatus.ts';\nexport { useSyncScope } from './composables/useSyncScope.ts';\nexport { useRootEntityList } from './composables/useRootEntityList.ts';\nexport { useScopedEntities } from './composables/useScopedEntities.ts';\nexport { useChildCounts } from './composables/useChildCounts.ts';\nexport { useTopLevelEntities } from './composables/useTopLevelEntities.ts';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"injection-key.js","sourceRoot":"","sources":["../../src/vue/injection-key.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,UAAU,GAAgC,MAAM,CAAC,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"injection-key.js","sourceRoot":"","sources":["../../src/vue/injection-key.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,UAAU,GAAgC,MAAM,CAAC,QAAQ,CAAC,CAAC","sourcesContent":["import type { InjectionKey } from 'vue';\nimport type { ConnectionStatus, Store } from '../types.ts';\n\nexport interface StitchContext {\n store: Store;\n initialized: boolean;\n connectionStatus: ConnectionStatus;\n error: Error | null;\n}\n\nexport const STITCH_KEY: InjectionKey<StitchContext> = Symbol('stitch');\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laboverwire/stitch",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Reactive state synchronization library bridging an in-memory store, IndexedDB persistence, and MQTT-based remote sync.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "LabOverWire",
@@ -74,8 +74,7 @@
74
74
  }
75
75
  },
76
76
  "dependencies": {
77
- "mqdb-wasm": "^0.3.2",
78
- "mqtt5-wasm": "^1.0.0"
77
+ "@laboverwire/stitch-wasm": "^0.2.1"
79
78
  },
80
79
  "peerDependencies": {
81
80
  "react": "^19.0.0",
@@ -91,10 +90,12 @@
91
90
  },
92
91
  "devDependencies": {
93
92
  "@eslint/js": "^10.0.1",
93
+ "@testing-library/react": "^16.3.2",
94
94
  "@types/react": "^19.2.14",
95
- "@vitest/browser": "^4.1.5",
96
- "@vitest/browser-playwright": "^4.1.5",
97
- "@vitest/ui": "^4.1.5",
95
+ "@vitest/browser": "^4.1.10",
96
+ "@vitest/browser-playwright": "^4.1.10",
97
+ "@vitest/ui": "^4.1.10",
98
+ "esbuild": "^0.28.1",
98
99
  "eslint": "^10.2.1",
99
100
  "eslint-config-prettier": "^10.1.8",
100
101
  "eslint-plugin-react-hooks": "^7.1.1",
@@ -103,9 +104,17 @@
103
104
  "lint-staged": "^16.4.0",
104
105
  "playwright": "^1.59.1",
105
106
  "prettier": "^3.8.3",
106
- "typescript": "^5.9.3",
107
+ "react": "^19.2.7",
108
+ "react-dom": "^19.2.7",
109
+ "rollup": "^4.62.2",
110
+ "typescript": "^6.0.3",
107
111
  "typescript-eslint": "^8.59.0",
108
- "vitest": "^4.1.5",
112
+ "vite-plugin-top-level-await": "^1.6.0",
113
+ "vite-plugin-wasm": "^3.6.0",
114
+ "vitest": "^4.1.10",
109
115
  "vue": "^3.3.0"
116
+ },
117
+ "overrides": {
118
+ "uuid": "^11.1.1"
110
119
  }
111
120
  }
@@ -1,3 +0,0 @@
1
- export declare function stripNulls(obj: Record<string, unknown>): Record<string, unknown>;
2
- export declare function isTransientSyncError(err: unknown): boolean;
3
- //# sourceMappingURL=internal-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal-utils.d.ts","sourceRoot":"","sources":["../src/internal-utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQhF;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAG1D"}
@@ -1,15 +0,0 @@
1
- export function stripNulls(obj) {
2
- const result = {};
3
- for (const [key, value] of Object.entries(obj)) {
4
- if (value != null) {
5
- result[key] = value;
6
- }
7
- }
8
- return result;
9
- }
10
- export function isTransientSyncError(err) {
11
- if (!(err instanceof Error))
12
- return false;
13
- return /timeout|disconnected|foreign key violation/i.test(err.message);
14
- }
15
- //# sourceMappingURL=internal-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal-utils.js","sourceRoot":"","sources":["../src/internal-utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,GAA4B;IACrD,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAY;IAC/C,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,6CAA6C,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzE,CAAC"}
@@ -1,9 +0,0 @@
1
- export declare class MqdbError extends Error {
2
- readonly method: string;
3
- constructor(method: string, cause: unknown);
4
- }
5
- export declare function wrapWasmError(method: string, cause: unknown): MqdbError;
6
- export declare function wrapSync<T>(method: string, fn: () => T): T;
7
- export declare function wrapAsync<T>(method: string, fn: () => Promise<T>): Promise<T>;
8
- export declare function isCorruptionError(err: unknown, extraPatterns?: readonly string[]): boolean;
9
- //# sourceMappingURL=internal-wasm-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal-wasm-error.d.ts","sourceRoot":"","sources":["../src/internal-wasm-error.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAM3C;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,CAGvE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAM1D;AAED,wBAAsB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAMnF;AAID,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,GAAE,SAAS,MAAM,EAAO,GAAG,OAAO,CAY9F"}
@@ -1,48 +0,0 @@
1
- export class MqdbError extends Error {
2
- method;
3
- constructor(method, cause) {
4
- const rawMessage = cause instanceof Error ? cause.message : String(cause);
5
- super(`mqdb.${method}: ${rawMessage}`, { cause });
6
- this.name = 'MqdbError';
7
- this.method = method;
8
- }
9
- }
10
- export function wrapWasmError(method, cause) {
11
- if (cause instanceof MqdbError)
12
- return cause;
13
- return new MqdbError(method, cause);
14
- }
15
- export function wrapSync(method, fn) {
16
- try {
17
- return fn();
18
- }
19
- catch (err) {
20
- throw wrapWasmError(method, err);
21
- }
22
- }
23
- export async function wrapAsync(method, fn) {
24
- try {
25
- return await fn();
26
- }
27
- catch (err) {
28
- throw wrapWasmError(method, err);
29
- }
30
- }
31
- const BASE_CORRUPTION_PATTERNS = ['arg0 is null', 'transaction error', 'unreachable'];
32
- export function isCorruptionError(err, extraPatterns = []) {
33
- const inner = err instanceof MqdbError ? err.cause : err;
34
- if (inner instanceof Error && inner.name === 'RuntimeError')
35
- return true;
36
- const msg = (inner instanceof Error ? inner.message : String(inner)).toLowerCase();
37
- for (const pattern of BASE_CORRUPTION_PATTERNS) {
38
- if (msg.includes(pattern))
39
- return true;
40
- }
41
- for (const pattern of extraPatterns) {
42
- if (msg.includes(pattern))
43
- return true;
44
- }
45
- const txIdx = msg.indexOf('transaction');
46
- return txIdx !== -1 && msg.indexOf('null', txIdx) !== -1;
47
- }
48
- //# sourceMappingURL=internal-wasm-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal-wasm-error.js","sourceRoot":"","sources":["../src/internal-wasm-error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,MAAM,CAAS;IAExB,YAAY,MAAc,EAAE,KAAc;QACxC,MAAM,UAAU,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1E,KAAK,CAAC,QAAQ,MAAM,KAAK,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;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,CAAC;IACzC,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE,CAAC;QACpC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;IACzC,CAAC;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACzC,OAAO,KAAK,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { StoreConfig, MemoryStore } from './types.ts';
2
- export declare function createMemoryStore(config: StoreConfig): MemoryStore;
3
- //# sourceMappingURL=memory-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../src/memory-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAiB,WAAW,EAAa,MAAM,YAAY,CAAC;AAumBrF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAElE"}