{"_id":"@apislash/storage-sync","_rev":"3-43a45984c92936f941daed91bdc1ea6e","name":"@apislash/storage-sync","dist-tags":{"latest":"1.1.4"},"versions":{"1.1.2":{"name":"@apislash/storage-sync","version":"1.1.2","license":"MIT","_id":"@apislash/storage-sync@1.1.2","maintainers":[{"name":"jantheon","email":"vonhara@gmail.com"}],"dist":{"shasum":"66dd9d3cb31118d4c266b09a6fb08ff5f3411ba0","tarball":"https://registry.npmjs.org/@apislash/storage-sync/-/storage-sync-1.1.2.tgz","fileCount":8,"integrity":"sha512-3JZkJWD5vfSJWnL6RAH1DVQkKYtRmuBcfirZ5TNNw4NxQ4OZkcfrSAVr/k78rbQ93+Kr4flI4PSoesPxnL/i5w==","signatures":[{"sig":"MEUCIQCFjW4lrto552hvRkYL46sMK1n+b8cbAZ7KHlqFQQkj+wIgE58yLRSYnz32HtDH3+EMJn12dIv39FIELRhJ/fa19qY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":88758},"main":"dist/index.cjs","type":"module","_from":"file:apislash-storage-sync-1.1.2.tgz","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"pnpm exec vitest run --passWithNoTests","build":"pnpm exec tsup src/index.ts --format esm,cjs --dts --sourcemap --clean --out-dir dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"jantheon","email":"vonhara@gmail.com"},"_resolved":"/tmp/6b2f44251890f2444694791e7e8ec13e/apislash-storage-sync-1.1.2.tgz","_integrity":"sha512-3JZkJWD5vfSJWnL6RAH1DVQkKYtRmuBcfirZ5TNNw4NxQ4OZkcfrSAVr/k78rbQ93+Kr4flI4PSoesPxnL/i5w==","_npmVersion":"10.8.2","description":"Local-first durable outbox + background sync adapter for the Apislash storage core. Persist mutations (file uploads, form drafts) locally, encrypted, then deliver them to a REST backend in the background with ACK, retry and last-write-wins.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@apislash/storage-core":"^1.0.0"},"publishConfig":{"registry":"https://gitlab.com/api/v4/projects/80541835/packages/npm/"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/storage-sync_1.1.2_1781941966575_0.8539806031520603","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"name":"@apislash/storage-sync","version":"1.1.3","keywords":["apislash","storage","local-first","offline","encrypted","indexeddb","sync","typescript"],"author":{"name":"jantheon","email":"vonhara@gmail.com"},"license":"MIT","_id":"@apislash/storage-sync@1.1.3","maintainers":[{"name":"jantheon","email":"vonhara@gmail.com"}],"homepage":"https://gitlab.com/apislash/libs/client/storage/ts/-/tree/main/packages/sync#readme","bugs":{"url":"https://gitlab.com/apislash/libs/client/storage/ts/-/issues"},"dist":{"shasum":"3f0a9dccd679635535359cdcc83352e410e0fa1e","tarball":"https://registry.npmjs.org/@apislash/storage-sync/-/storage-sync-1.1.3.tgz","fileCount":9,"integrity":"sha512-OF/dJ34JUdQw223zwk271HCKxDLbCxqYlevZWzI/A0PJ2SxIjdYji8Rx+imfSVc8jnjpCHue6TeVBXaPNUS9RA==","signatures":[{"sig":"MEUCIAyP6e7s7tLFwVkaexFHrXQHbYfiTgLby3f2HeYS/6PSAiEArh9X5uWwFQWs4yWFSp/J7eo72l/+KMuYGpuFAKJ9oQw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":91319},"main":"dist/index.cjs","type":"module","_from":"file:apislash-storage-sync-1.1.3.tgz","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"pnpm exec vitest run --passWithNoTests","build":"pnpm exec tsup src/index.ts --format esm,cjs --dts --sourcemap --clean --out-dir dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"jantheon","email":"vonhara@gmail.com"},"_resolved":"/tmp/ac10b4337a345223a93b6fb827f3abbc/apislash-storage-sync-1.1.3.tgz","_integrity":"sha512-OF/dJ34JUdQw223zwk271HCKxDLbCxqYlevZWzI/A0PJ2SxIjdYji8Rx+imfSVc8jnjpCHue6TeVBXaPNUS9RA==","repository":{"url":"git+https://gitlab.com/apislash/libs/client/storage/ts.git","type":"git","directory":"packages/sync"},"_npmVersion":"10.8.2","description":"Local-first durable outbox + background sync adapter for the Apislash storage core. Persist mutations (file uploads, form drafts) locally, encrypted, then deliver them to a REST backend in the background with ACK, retry and last-write-wins.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@apislash/storage-core":"^1.0.0"},"publishConfig":{"registry":"https://gitlab.com/api/v4/projects/80541835/packages/npm/"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/storage-sync_1.1.3_1781942736717_0.39179806802831973","host":"s3://npm-registry-packages-npm-production"}},"1.1.4":{"name":"@apislash/storage-sync","version":"1.1.4","description":"Local-first durable outbox + background sync adapter for the Apislash storage core. Persist mutations (file uploads, form drafts) locally, encrypted, then deliver them to a REST backend in the background with ACK, retry and last-write-wins.","type":"module","main":"./src/index.ts","module":"./src/index.ts","types":"./src/index.ts","exports":{".":{"types":"./src/index.ts","default":"./src/index.ts"}},"publishConfig":{"main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}}},"sideEffects":false,"scripts":{"build":"pnpm exec tsup src/index.ts --format esm,cjs --dts --sourcemap --clean --out-dir dist","typecheck":"tsc -p tsconfig.json --noEmit","test":"pnpm exec vitest run --passWithNoTests"},"dependencies":{"@apislash/storage-core":"^1.0.0"},"license":"MIT","repository":{"type":"git","url":"git+https://gitlab.com/apislash/libs/client/storage/ts.git","directory":"packages/sync"},"homepage":"https://gitlab.com/apislash/libs/client/storage/ts/-/tree/main/packages/sync#readme","bugs":{"url":"https://gitlab.com/apislash/libs/client/storage/ts/-/issues"},"author":{"name":"jantheon","email":"vonhara@gmail.com"},"keywords":["apislash","storage","local-first","offline","encrypted","indexeddb","sync","typescript"],"gitHead":"6d6bb1da86f225323eec151e016f7db4c2356417","_id":"@apislash/storage-sync@1.1.4","_nodeVersion":"20.20.2","_npmVersion":"11.17.0","dist":{"integrity":"sha512-JiGqeAHBcrpCu3DY0ete7PYRAWcqB055am16DZJl0yHTrCSF8eicZsTIdytFYTsg5tjLFozc96KA+0E0wu6WcA==","shasum":"b44353e805de8895ec64f420a42d5ba0044bf909","tarball":"https://registry.npmjs.org/@apislash/storage-sync/-/storage-sync-1.1.4.tgz","fileCount":9,"unpackedSize":91454,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@apislash%2fstorage-sync@1.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBMcfQsz+OetItrssNsGx2+zh3o8MCE4Eni/UPH2cjFHAiEAw+CPQQ4oKzlg+d52ApcI9BONOlQ4KJ+HJa42ETXFy9o="}]},"_npmUser":{"name":"GitLab CI/CD","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"gitlab","oidcConfigId":"oidc:4e5f1542-3a86-4d1f-b8a2-588f20eb8e77"}},"directories":{},"maintainers":[{"name":"jantheon","email":"vonhara@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/storage-sync_1.1.4_1781948016988_0.33400743548157563"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-20T07:52:46.382Z","modified":"2026-06-20T09:33:37.425Z","1.1.2":"2026-06-20T07:52:46.702Z","1.1.3":"2026-06-20T08:05:36.854Z","1.1.4":"2026-06-20T09:33:37.126Z"},"bugs":{"url":"https://gitlab.com/apislash/libs/client/storage/ts/-/issues"},"author":{"name":"jantheon","email":"vonhara@gmail.com"},"license":"MIT","homepage":"https://gitlab.com/apislash/libs/client/storage/ts/-/tree/main/packages/sync#readme","keywords":["apislash","storage","local-first","offline","encrypted","indexeddb","sync","typescript"],"repository":{"type":"git","url":"git+https://gitlab.com/apislash/libs/client/storage/ts.git","directory":"packages/sync"},"description":"Local-first durable outbox + background sync adapter for the Apislash storage core. Persist mutations (file uploads, form drafts) locally, encrypted, then deliver them to a REST backend in the background with ACK, retry and last-write-wins.","maintainers":[{"name":"jantheon","email":"vonhara@gmail.com"}],"readme":"# @apislash/storage-sync\n\nLocal-first durable outbox + background sync adapter for the\n[`@apislash/storage`](https://gitlab.com/apislash/libs/client/storage/ts) core.\n\nPersist mutations (file uploads, form drafts) locally and **encrypted**, then deliver\nthem to a REST backend in the background with ACK, jittered retry and last-write-wins.\nThe user is freed immediately; delivery resumes on reconnect, tab focus, or app restart.\n\n## Install\n\n```sh\nnpm install @apislash/storage-sync @apislash/storage-core\n```\n\n## What it gives you\n\n- **SyncOutbox** — a durable queue on a storage-core `StructuredDbStore`. Each entry's\n  payload is encrypted at rest via a `CryptoProvider` (from\n  [`@apislash/cryptobox`](https://gitlab.com/apislash/libs/client/cryptobox/ts)); the\n  metadata stays queryable.\n- **SyncEngine** — drains due entries to a pluggable `Transport`, records the backend\n  ACK (canonical id), retries retryable failures with exponential backoff + jitter, and\n  marks terminal failures. Conflicts resolve **last-write-wins** by a clock-independent\n  revision counter.\n- **installWebTriggers** — flush the queue the moment connectivity returns or the tab\n  becomes visible. `subscribe()` surfaces `SyncStatus` (pending / inflight / acked /\n  failed) for UI badges.\n\nOne library serves both file uploads and form drafts.\n\n## Usage\n\n```ts\nimport { createSyncOutbox, PayloadCipher, SyncEngine, installWebTriggers } from \"@apislash/storage-sync\";\n\nconst store  = dbDriver.collection(\"outbox\");\nconst cipher = new PayloadCipher(cryptoProvider, key);            // always encrypt\nconst outbox = createSyncOutbox(store, cipher, { idGen: uuidV7 });\nconst engine = new SyncEngine(outbox, transport);                // you supply transport\nengine.start();\ninstallWebTriggers(engine);                                      // flush on online/visible\n\nawait outbox.enqueue(\"form\", listingDraft);                      // local-first; returns at once\nengine.subscribe((status) => render(status));\n```\n\n## License\n\nMIT © Apislash\n","readmeFilename":"README.md"}