@saplings/offline 0.0.0-stage → 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sapling Unified SDK contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,38 @@
1
- # Temporary Holding Version
1
+ # @saplings/offline
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Ordered, dependency-free offline operation replay with a pluggable persistence contract.
4
+
5
+ ## Queue operations
6
+
7
+ ```ts
8
+ import { createMemoryOfflineStore, createOfflineQueue } from '@saplings/offline';
9
+
10
+ const queue = createOfflineQueue(createMemoryOfflineStore<{ title: string }>(), async (operation, signal) => {
11
+ const response = await fetch('/api/tasks', {
12
+ method: 'POST',
13
+ headers: { 'Content-Type': 'application/json', 'Idempotency-Key': operation.id },
14
+ body: JSON.stringify(operation.payload),
15
+ signal,
16
+ });
17
+ if (!response.ok) throw new Error('Delivery failed');
18
+ });
19
+ await queue.enqueue({ id: crypto.randomUUID(), payload: { title: 'Draft' } });
20
+ await queue.flush();
21
+ ```
22
+
23
+ The queue replays a snapshot in FIFO order, stops on failure, and removes only acknowledged operations. Concurrent flush calls on one queue share a promise. Server-side idempotency is mandatory because delivery can succeed before removal fails. The memory store is bounded but not persistent. Use the IndexedDB adapter for reload recovery. Coordinate multiple tabs externally; conflict resolution remains application-owned. Do not store secrets, and clear or isolate data on logout.
24
+
25
+ ## Durable browser storage
26
+
27
+ ```ts
28
+ import { createIndexedDbOfflineStore, createOfflineQueue } from '@saplings/offline';
29
+
30
+ const store = await createIndexedDbOfflineStore<{ title: string }>('opaque-account-scope');
31
+ const queue = createOfflineQueue(store, deliver);
32
+ await queue.enqueue({ id: crypto.randomUUID(), payload: { title: 'Draft' } });
33
+ // On logout, stop active replay before clearing the account queue.
34
+ await store.clear();
35
+ store.close();
36
+ ```
37
+
38
+ The adapter preserves FIFO order across reloads and atomically checks a pending-count limit and unique operation IDs. Use a different opaque account scope for each authenticated tenant and user. Browser quota and eviction policies still apply; this storage is not a security boundary. Cross-tab replay locking and server-side conflict resolution are not provided. Use server-side idempotency for all queued mutations.
@@ -0,0 +1,25 @@
1
+ export interface OfflineOperation<T> {
2
+ id: string;
3
+ payload: T;
4
+ }
5
+ export interface OfflineStore<T> {
6
+ /** Return operations in insertion order, scoped to one authenticated account. */
7
+ list(): Promise<readonly OfflineOperation<T>[]>;
8
+ /** Atomically add a unique ID; duplicate IDs must reject. */
9
+ add(operation: OfflineOperation<T>): Promise<void>;
10
+ remove(id: string): Promise<void>;
11
+ }
12
+ export interface FlushResult {
13
+ delivered: number;
14
+ stopped: 'empty' | 'failed' | 'aborted';
15
+ error?: unknown;
16
+ }
17
+ /** In-memory adapter for ephemeral queues and tests. Not durable across reloads. */
18
+ export declare function createMemoryOfflineStore<T>(maxPending?: number): OfflineStore<T>;
19
+ /** Ordered at-least-once replay. The server must deduplicate by operation ID. */
20
+ export declare function createOfflineQueue<T>(store: OfflineStore<T>, deliver: (operation: OfflineOperation<T>, signal?: AbortSignal) => Promise<void>): {
21
+ enqueue(operation: OfflineOperation<T>): Promise<void>;
22
+ flush(signal?: AbortSignal): Promise<FlushResult>;
23
+ };
24
+ export { createIndexedDbOfflineStore } from './indexeddb.js';
25
+ export type { IndexedDbOfflineStore } from './indexeddb.js';
package/dist/index.js ADDED
@@ -0,0 +1,59 @@
1
+ /** In-memory adapter for ephemeral queues and tests. Not durable across reloads. */
2
+ export function createMemoryOfflineStore(maxPending = 1000) {
3
+ if (!Number.isSafeInteger(maxPending) || maxPending < 1)
4
+ throw new Error('Invalid pending limit');
5
+ const operations = new Map();
6
+ return {
7
+ async list() {
8
+ return [...operations.values()].map((operation) => structuredClone(operation));
9
+ },
10
+ async add(operation) {
11
+ if (operations.has(operation.id))
12
+ throw new Error('Duplicate operation ID');
13
+ if (operations.size >= maxPending)
14
+ throw new Error('Offline queue full');
15
+ operations.set(operation.id, structuredClone(operation));
16
+ },
17
+ async remove(id) {
18
+ operations.delete(id);
19
+ },
20
+ };
21
+ }
22
+ /** Ordered at-least-once replay. The server must deduplicate by operation ID. */
23
+ export function createOfflineQueue(store, deliver) {
24
+ let running;
25
+ async function replay(signal) {
26
+ let delivered = 0;
27
+ try {
28
+ for (const operation of await store.list()) {
29
+ if (signal?.aborted)
30
+ return { delivered, stopped: 'aborted' };
31
+ await deliver(operation, signal);
32
+ // Acknowledged operations are removed even if cancellation races with delivery.
33
+ await store.remove(operation.id);
34
+ delivered++;
35
+ }
36
+ return { delivered, stopped: signal?.aborted ? 'aborted' : 'empty' };
37
+ }
38
+ catch (error) {
39
+ return { delivered, stopped: signal?.aborted ? 'aborted' : 'failed', error };
40
+ }
41
+ }
42
+ return {
43
+ async enqueue(operation) {
44
+ if (typeof operation.id !== 'string' || !operation.id.trim() || operation.id.length > 256)
45
+ throw new Error('Invalid operation ID');
46
+ await store.add(operation);
47
+ },
48
+ flush(signal) {
49
+ if (running)
50
+ return running;
51
+ running = replay(signal).finally(() => {
52
+ running = undefined;
53
+ });
54
+ return running;
55
+ },
56
+ };
57
+ }
58
+ export { createIndexedDbOfflineStore } from './indexeddb.js';
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,oFAAoF;AACpF,MAAM,UAAU,wBAAwB,CAAI,UAAU,GAAG,IAAI;IAC3D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAClG,MAAM,UAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;IAC1D,OAAO;QACL,KAAK,CAAC,IAAI;YACR,OAAO,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;QACjF,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,SAAS;YACjB,IAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;YAC5E,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU;gBAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACzE,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;QAC3D,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,EAAE;YACb,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,iFAAiF;AACjF,MAAM,U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AM,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;gBACpC,OAAO,GAAG,SAAS,CAAC;YACtB,CAAC,CAAC,CAAC;YACH,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { OfflineStore } from './index.js';
2
+ export interface IndexedDbOfflineStore<T> extends OfflineStore<T> {
3
+ clear(): Promise<void>;
4
+ close(): void;
5
+ }
6
+ /** One durable browser queue per opaque account scope. Never store credentials. */
7
+ export declare function createIndexedDbOfflineStore<T>(scope: string, options?: {
8
+ maxPending?: number;
9
+ factory?: IDBFactory;
10
+ }): Promise<IndexedDbOfflineStore<T>>;
@@ -0,0 +1,103 @@
1
+ function completed(tx) {
2
+ return new Promise((resolve, reject) => {
3
+ tx.oncomplete = () => resolve();
4
+ tx.onabort = () => reject(tx.error ?? new Error('Offline transaction aborted'));
5
+ tx.onerror = () => reject(tx.error ?? new Error('Offline transaction failed'));
6
+ });
7
+ }
8
+ function openDatabase(name, factory) {
9
+ return new Promise((resolve, reject) => {
10
+ const request = factory.open(name, 1);
11
+ let blocked = false;
12
+ request.onupgradeneeded = () => {
13
+ const store = request.result.createObjectStore('operations', {
14
+ keyPath: 'sequence',
15
+ autoIncrement: true,
16
+ });
17
+ store.createIndex('operationId', 'id', { unique: true });
18
+ };
19
+ request.onblocked = () => {
20
+ blocked = true;
21
+ reject(new Error('Offline database upgrade blocked'));
22
+ };
23
+ request.onerror = () => reject(request.error ?? new Error('Offline database unavailable'));
24
+ request.onsuccess = () => {
25
+ const db = request.result;
26
+ db.onversionchange = () => db.close();
27
+ if (blocked)
28
+ db.close();
29
+ else
30
+ resolve(db);
31
+ };
32
+ });
33
+ }
34
+ /** One durable browser queue per opaque account scope. Never store credentials. */
35
+ export async function createIndexedDbOfflineStore(scope, options = {}) {
36
+ const maxPending = options.maxPending ?? 1000;
37
+ if (typeof scope !== 'string' ||
38
+ !/^[A-Za-z0-9_.-]{1,128}$/.test(scope) ||
39
+ !Number.isSafeInteger(maxPending) ||
40
+ maxPending < 1 ||
41
+ maxPending > 10000)
42
+ throw new Error('Invalid offline database settings');
43
+ const factory = options.factory ?? globalThis.indexedDB;
44
+ if (!factory)
45
+ throw new Error('IndexedDB unavailable');
46
+ const db = await openDatabase('saplings-offline:' + scope, factory);
47
+ return {
48
+ async list() {
49
+ const tx = db.transaction('operations', 'readonly');
50
+ const done = completed(tx);
51
+ const request = tx.objectStore('operations').getAll();
52
+ await done;
53
+ return request.result.map(({ id, payload }) => ({ id, payload }));
54
+ },
55
+ async add(operation) {
56
+ if (typeof operation.id !== 'string' || !operation.id.trim() || operation.id.length > 256)
57
+ throw new Error('Invalid operation ID');
58
+ const value = structuredClone({ id: operation.id, payload: operation.payload });
59
+ const tx = db.transaction('operations', 'readwrite');
60
+ const done = completed(tx);
61
+ const store = tx.objectStore('operations');
62
+ let full = false;
63
+ const count = store.count();
64
+ count.onsuccess = () => {
65
+ if (count.result >= maxPending) {
66
+ full = true;
67
+ tx.abort();
68
+ return;
69
+ }
70
+ store.add(value);
71
+ };
72
+ try {
73
+ await done;
74
+ }
75
+ catch (error) {
76
+ if (full)
77
+ throw new Error('Offline queue full');
78
+ throw error;
79
+ }
80
+ },
81
+ async remove(id) {
82
+ const tx = db.transaction('operations', 'readwrite');
83
+ const done = completed(tx);
84
+ const store = tx.objectStore('operations');
85
+ const request = store.index('operationId').getKey(id);
86
+ request.onsuccess = () => {
87
+ if (request.result !== undefined)
88
+ store.delete(request.result);
89
+ };
90
+ await done;
91
+ },
92
+ async clear() {
93
+ const tx = db.transaction('operations', 'readwrite');
94
+ const done = completed(tx);
95
+ tx.objectStore('operations').clear();
96
+ await done;
97
+ },
98
+ close() {
99
+ db.close();
100
+ },
101
+ };
102
+ }
103
+ //# sourceMappingURL=indexeddb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexeddb.js","sourceRoot":"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KAAK,CAAC,oBAAoB,CAAC,CAAC;gBAChD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,EAAE;YACb,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;YACrD,MAAM,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;YAC3B,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACtD,OAAO,CAAC,SAAS,GAAG,GAAG,EAAE;gBACvB,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;oBAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACjE,CAAC,CAAC;YACF,MAAM,IAAI,CAAC;QACb,CAAC;QACD,KAAK,CAAC,KAAK;YACT,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;YACrD,MAAM,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;YAC3B,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,CAAC;YACrC,MAAM,IAAI,CAAC;QACb,CAAC;QACD,KAAK;YACH,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "@saplings/offline",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Offline operation replay primitives",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "engines": {
20
+ "node": ">=22"
21
+ },
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/snrakshith/saplings.git",
26
+ "directory": "packages/offline"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public",
30
+ "registry": "https://registry.npmjs.org/"
31
+ }
6
32
  }