@gusto/baerly-storage 0.5.0 → 0.7.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/README.md +47 -124
- package/dist/API.md +161 -511
- package/dist/CHANGELOG.md +1148 -307
- package/dist/RECIPES.md +398 -80
- package/dist/THIRD-PARTY-LICENSES.txt +5 -26
- package/dist/{app-config-DyiFK3_k.d.ts → app-config-C6qW7m8S.d.ts} +119 -111
- package/dist/app-config.d.ts +31 -1
- package/dist/app-config.js +1 -2
- package/dist/app-config.js.map +1 -1
- package/dist/auth.d.ts +33 -28
- package/dist/auth.js +549 -985
- package/dist/auth.js.map +1 -1
- package/dist/baerly.js +130 -138
- package/dist/baerly.js.map +1 -1
- package/dist/baerly.spec.json +97 -22
- package/dist/capacity-warning-header-BlVopyiI.js +16 -0
- package/dist/capacity-warning-header-BlVopyiI.js.map +1 -0
- package/dist/{client-Fe8CwB73.d.ts → client-CHQTXpef.d.ts} +121 -36
- package/dist/client-react.d.ts +67 -20
- package/dist/client-react.js +240 -54
- package/dist/client-react.js.map +1 -1
- package/dist/client.d.ts +5 -4
- package/dist/client.js +51 -16
- package/dist/client.js.map +1 -1
- package/dist/{cloudflare-DzKBrUlg.js → cloudflare-CKHYXccw.js} +504 -124
- package/dist/cloudflare-CKHYXccw.js.map +1 -0
- package/dist/cloudflare.d.ts +106 -71
- package/dist/cloudflare.js +334 -271
- package/dist/cloudflare.js.map +1 -1
- package/dist/code-resolution-CL_7L0wS.js +22 -0
- package/dist/code-resolution-CL_7L0wS.js.map +1 -0
- package/dist/collection-api-DbyhLAY8.d.ts +1001 -0
- package/dist/config-DEzInG6M.js +4035 -0
- package/dist/config-DEzInG6M.js.map +1 -0
- package/dist/constants-D3GSH3tc.js +469 -0
- package/dist/constants-D3GSH3tc.js.map +1 -0
- package/dist/{context-DRZ3tZ5l.js → context-rlpSnHFA.js} +17 -17
- package/dist/context-rlpSnHFA.js.map +1 -0
- package/dist/cost-B52llVDx.js +330 -0
- package/dist/cost-B52llVDx.js.map +1 -0
- package/dist/{current-json-C6nhPOm1.js → current-json-CC6lE4Aj.js} +115 -32
- package/dist/current-json-CC6lE4Aj.js.map +1 -0
- package/dist/db-plFUNTSF.d.ts +130 -0
- package/dist/db-read-seams-BSs0m1z1.js +3261 -0
- package/dist/db-read-seams-BSs0m1z1.js.map +1 -0
- package/dist/{deploy-DonTr-CV.js → deploy-Obj4nE-Z.js} +12 -16
- package/dist/deploy-Obj4nE-Z.js.map +1 -0
- package/dist/{dev-banner-CWHIk8tH.d.ts → dev-banner-B5AUHmu1.d.ts} +1 -4
- package/dist/dev-landing-BI5UdmOb.d.ts +32 -0
- package/dist/dev-landing-CD-si4dW.js +50 -0
- package/dist/dev-landing-CD-si4dW.js.map +1 -0
- package/dist/dev-vite.d.ts +38 -39
- package/dist/dev-vite.js +67 -36
- package/dist/dev-vite.js.map +1 -1
- package/dist/dev.d.ts +3 -2
- package/dist/dev.js +2 -1
- package/dist/doctor-BA0i-YAN.js +270 -0
- package/dist/doctor-BA0i-YAN.js.map +1 -0
- package/dist/dump-D1vX8ozg.js +133 -0
- package/dist/dump-D1vX8ozg.js.map +1 -0
- package/dist/errors-7Rk1HGCE.js +160 -0
- package/dist/errors-7Rk1HGCE.js.map +1 -0
- package/dist/{validate-DtljsCh1.js → export-BVL2EvYE.js} +409 -19
- package/dist/export-BVL2EvYE.js.map +1 -0
- package/dist/fsck-BWkPgov4.js +145 -0
- package/dist/fsck-BWkPgov4.js.map +1 -0
- package/dist/gcs-admin-Dso1HWQj.d.ts +127 -0
- package/dist/gcs.d.ts +30 -0
- package/dist/gcs.js +1 -0
- package/dist/goog4-signer-CeLIABoE.js +331 -0
- package/dist/goog4-signer-CeLIABoE.js.map +1 -0
- package/dist/{http-DGd5tbNs.js → http-Z5rZyYMX.js} +898 -271
- package/dist/http-Z5rZyYMX.js.map +1 -0
- package/dist/http-transport-DNUM8kU-.js +1299 -0
- package/dist/http-transport-DNUM8kU-.js.map +1 -0
- package/dist/http.d.ts +366 -294
- package/dist/http.js +2 -2
- package/dist/index-JJrIu1pO.d.ts +135 -0
- package/dist/index-LEgHN0qJ.d.ts +50 -0
- package/dist/{index-CuA9Mi3K.d.ts → index-RiEYj8t0.d.ts} +291 -78
- package/dist/index.d.ts +27 -6
- package/dist/index.js +3 -5
- package/dist/inspect-BTsVYZKd.js +196 -0
- package/dist/inspect-BTsVYZKd.js.map +1 -0
- package/dist/{key-Di6yyxFu.js → key-C4FPZ9Io.js} +3 -4
- package/dist/{key-Di6yyxFu.js.map → key-C4FPZ9Io.js.map} +1 -1
- package/dist/ledger-Dj_bGgo0.js +192 -0
- package/dist/ledger-Dj_bGgo0.js.map +1 -0
- package/dist/legacy-names-DgZBtgOh.js +47 -0
- package/dist/legacy-names-DgZBtgOh.js.map +1 -0
- package/dist/log-C9W15Dfo.d.ts +94 -0
- package/dist/log-tail-DWJbneBF.js +142 -0
- package/dist/log-tail-DWJbneBF.js.map +1 -0
- package/dist/log-walk-C-vA-WGJ.js +111 -0
- package/dist/log-walk-C-vA-WGJ.js.map +1 -0
- package/dist/maintenance-Dd-Yakqj.js +1709 -0
- package/dist/maintenance-Dd-Yakqj.js.map +1 -0
- package/dist/maintenance-DevB6z4e.js +2237 -0
- package/dist/maintenance-DevB6z4e.js.map +1 -0
- package/dist/maintenance.d.ts +100 -3
- package/dist/maintenance.js +1 -3
- package/dist/node.d.ts +130 -142
- package/dist/node.js +4 -3
- package/dist/{observability-BmflLCdF.js → observability-C-ISCCLE.js} +1275 -332
- package/dist/observability-C-ISCCLE.js.map +1 -0
- package/dist/observability.d.ts +27 -3
- package/dist/observability.js +3 -3
- package/dist/path-segment-DBXG26PW.js +363 -0
- package/dist/path-segment-DBXG26PW.js.map +1 -0
- package/dist/{plan-a7PJHBCy.js → plan-BvQbaNMe.js} +19 -11
- package/dist/plan-BvQbaNMe.js.map +1 -0
- package/dist/request-CRWiTrza.js +272 -0
- package/dist/request-CRWiTrza.js.map +1 -0
- package/dist/restore-U6Im8V1V.js +1467 -0
- package/dist/restore-U6Im8V1V.js.map +1 -0
- package/dist/retry-OBtLB2GC.js +126 -0
- package/dist/retry-OBtLB2GC.js.map +1 -0
- package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
- package/dist/{runtime-spec-Dsw2-n8S.js → runtime-spec-B5mg3pHF.js} +189 -28
- package/dist/runtime-spec-B5mg3pHF.js.map +1 -0
- package/dist/{s3-http-B-z8th6O.d.ts → s3-http-DBC_wiCL.d.ts} +18 -10
- package/dist/s3.d.ts +20 -7
- package/dist/s3.js +4 -5
- package/dist/s3.js.map +1 -1
- package/dist/sha256-4FfGQNPw.js +22 -0
- package/dist/sha256-4FfGQNPw.js.map +1 -0
- package/dist/{shared-secret-DgEicd3x.js → shared-secret-Vkur-8r0.js} +27 -15
- package/dist/shared-secret-Vkur-8r0.js.map +1 -0
- package/dist/sigv4-sign-5IUflUD_.js +507 -0
- package/dist/sigv4-sign-5IUflUD_.js.map +1 -0
- package/dist/snapshot-CknzkDM0.js +148 -0
- package/dist/snapshot-CknzkDM0.js.map +1 -0
- package/dist/{src-BL_JoPTn.js → src-Actga-bO.js} +1004 -378
- package/dist/src-Actga-bO.js.map +1 -0
- package/dist/src-D0MQfvOp.js +812 -0
- package/dist/src-D0MQfvOp.js.map +1 -0
- package/dist/src-Dr9uo3dc.js +501 -0
- package/dist/src-Dr9uo3dc.js.map +1 -0
- package/dist/{subcommand-DoDA-K7d.js → subcommand-BLoF66dG.js} +89 -16
- package/dist/subcommand-BLoF66dG.js.map +1 -0
- package/dist/{time-DUqvFMHq.js → time-DRxTP9iv.js} +15 -34
- package/dist/time-DRxTP9iv.js.map +1 -0
- package/dist/types-suVbsEWS.d.ts +116 -0
- package/dist/{usage-DBV1eQHC.js → usage-CPzVhrQr.js} +40 -45
- package/dist/usage-CPzVhrQr.js.map +1 -0
- package/dist/uuid-BuT_c404.js +333 -0
- package/dist/uuid-BuT_c404.js.map +1 -0
- package/dist/verifier-Bmlmndzo.d.ts +95 -0
- package/dist/{wire-izfGZDvr.js → wire-DndvKU-K.js} +2 -3
- package/dist/wire-DndvKU-K.js.map +1 -0
- package/package.json +96 -69
- package/dist/aws4fetch.esm-p7eEzLCs.js +0 -1702
- package/dist/aws4fetch.esm-p7eEzLCs.js.map +0 -1
- package/dist/bytes-BXdamO3L.js +0 -11
- package/dist/bytes-BXdamO3L.js.map +0 -1
- package/dist/cloudflare-DzKBrUlg.js.map +0 -1
- package/dist/config-1tv0-Yzm.js +0 -2693
- package/dist/config-1tv0-Yzm.js.map +0 -1
- package/dist/constants-CfeMWQWk.js +0 -222
- package/dist/constants-CfeMWQWk.js.map +0 -1
- package/dist/context-DRZ3tZ5l.js.map +0 -1
- package/dist/cost-DSMIVqzL.js +0 -203
- package/dist/cost-DSMIVqzL.js.map +0 -1
- package/dist/current-json-C6nhPOm1.js.map +0 -1
- package/dist/db-DsPkOVEH.d.ts +0 -254
- package/dist/deploy-DonTr-CV.js.map +0 -1
- package/dist/doctor-DSIyCDg_.js +0 -346
- package/dist/doctor-DSIyCDg_.js.map +0 -1
- package/dist/dump-Bh5k26VQ.js +0 -94
- package/dist/dump-Bh5k26VQ.js.map +0 -1
- package/dist/errors-Dfa3p78c.js +0 -78
- package/dist/errors-Dfa3p78c.js.map +0 -1
- package/dist/export-DtF5tDIM.js +0 -401
- package/dist/export-DtF5tDIM.js.map +0 -1
- package/dist/fsck-D_djMO5D.js +0 -279
- package/dist/fsck-D_djMO5D.js.map +0 -1
- package/dist/http-DGd5tbNs.js.map +0 -1
- package/dist/index-0rZcMBwy.d.ts +0 -115
- package/dist/index-BNRh23K9.d.ts +0 -162
- package/dist/index-BYk9oCNf.d.ts +0 -1112
- package/dist/indexes-Dn9hbGQG.d.ts +0 -22
- package/dist/inspect-6WZ-pC7-.js +0 -133
- package/dist/inspect-6WZ-pC7-.js.map +0 -1
- package/dist/log-tail-D98U1JBo.js +0 -522
- package/dist/log-tail-D98U1JBo.js.map +0 -1
- package/dist/maintenance-B4Dki6Ig.js +0 -2157
- package/dist/maintenance-B4Dki6Ig.js.map +0 -1
- package/dist/maintenance-B_e0T99L.d.ts +0 -537
- package/dist/maintenance-C7coQp4c.js +0 -1418
- package/dist/maintenance-C7coQp4c.js.map +0 -1
- package/dist/normalize-rjnZLwS4.js +0 -133
- package/dist/normalize-rjnZLwS4.js.map +0 -1
- package/dist/observability-BmflLCdF.js.map +0 -1
- package/dist/plan-a7PJHBCy.js.map +0 -1
- package/dist/query-rAtXNQQB.js +0 -1773
- package/dist/query-rAtXNQQB.js.map +0 -1
- package/dist/rebuild-index-BVzQSZlm.js +0 -81
- package/dist/rebuild-index-BVzQSZlm.js.map +0 -1
- package/dist/request-u0M51mhJ.js +0 -72
- package/dist/request-u0M51mhJ.js.map +0 -1
- package/dist/restore-R-4rbciV.js +0 -778
- package/dist/restore-R-4rbciV.js.map +0 -1
- package/dist/rolldown-runtime-EAsCxrDo.js +0 -14
- package/dist/runtime-spec-Dsw2-n8S.js.map +0 -1
- package/dist/shared-secret-DgEicd3x.js.map +0 -1
- package/dist/src-BL_JoPTn.js.map +0 -1
- package/dist/src-CYHFDrKz.js +0 -536
- package/dist/src-CYHFDrKz.js.map +0 -1
- package/dist/src-DYZ4H1aF.js +0 -392
- package/dist/src-DYZ4H1aF.js.map +0 -1
- package/dist/subcommand-DoDA-K7d.js.map +0 -1
- package/dist/time-DUqvFMHq.js.map +0 -1
- package/dist/usage-DBV1eQHC.js.map +0 -1
- package/dist/validate-DtljsCh1.js.map +0 -1
- package/dist/wire-izfGZDvr.js.map +0 -1
package/dist/http.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as longPollSince, i as listEventsSince, n as createRouter, r as mapError, t as MAX_BODY_BYTES } from "./http-Z5rZyYMX.js";
|
|
2
|
+
import { m as errorEnvelope } from "./observability-C-ISCCLE.js";
|
|
3
3
|
export { MAX_BODY_BYTES, createRouter, errorEnvelope, listEventsSince, longPollSince, mapError };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { a as StoragePutOptions, i as StorageListEntry, n as StorageGetOptions, o as StoragePutResult, r as StorageGetResult, t as Storage } from "./types-suVbsEWS.js";
|
|
2
|
+
/**
|
|
3
|
+
* Optional pre-warm: idempotently create the `current.json` manifest
|
|
4
|
+
* for a single `(app, tenant, collection)` triple. The kernel auto-creates
|
|
5
|
+
* this manifest on the first commit anyway (see `Db.create` and
|
|
6
|
+
* `Writer.commit`), so calling `ensureTable` is **not required** for
|
|
7
|
+
* correctness — it's a one-Class-A-PUT optimization for callers that
|
|
8
|
+
* want the manifest in place before the first request lands (seed
|
|
9
|
+
* scripts, deploy-time provisioning, CI fixtures that snapshot the
|
|
10
|
+
* bucket between phases, etc.).
|
|
11
|
+
*
|
|
12
|
+
* Wraps {@link createCurrentJson} with the canonical key shape
|
|
13
|
+
* (`app/<app>/tenant/<tenant>/manifests/<collection>/current.json`) and
|
|
14
|
+
* swallows `BaerlyError{code:"WriteConflict"}` so re-runs are safe. The
|
|
15
|
+
* three names follow the same rule as `Db.create` / `db.collection`
|
|
16
|
+
* (including Unicode Normalization Form C), refused with
|
|
17
|
+
* `BaerlyError{code:"InvalidConfig"}` before any write. An
|
|
18
|
+
* existing manifest is preserved verbatim — this function never
|
|
19
|
+
* overwrites a populated manifest. The seed shape matches the kernel's
|
|
20
|
+
* auto-create, with one deliberate exception: `generation` is a fresh
|
|
21
|
+
* nonce, so a pre-warm and an auto-provision are equivalent rather than
|
|
22
|
+
* byte-identical. Only one of them can win the `If-None-Match` create,
|
|
23
|
+
* and a generation is only ever compared against a cursor minted from
|
|
24
|
+
* it, so the difference is unobservable.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { LocalFsStorage, ensureTable } from "@gusto/baerly-storage/dev";
|
|
29
|
+
*
|
|
30
|
+
* const storage = new LocalFsStorage({ root: "./.baerly-data" });
|
|
31
|
+
* // Pre-warm so the first request doesn't pay the bootstrap PUT.
|
|
32
|
+
* await ensureTable(storage, { app: "helpdesk", tenant: "demo", collection: "tickets" });
|
|
33
|
+
* // …then `baerlyNode({ config, storage, verifier })`.
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare const ensureTable: (storage: Storage, args: {
|
|
37
|
+
app: string;
|
|
38
|
+
tenant: string;
|
|
39
|
+
collection: string;
|
|
40
|
+
}) => Promise<void>;
|
|
41
|
+
interface LocalFsStorageOptions {
|
|
42
|
+
/** Root directory; treated as "the bucket". */
|
|
43
|
+
root: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* `Storage` backed by a directory tree. Keys may contain `/` and map
|
|
47
|
+
* to nested directories on disk so `ls`/`cat` work as expected.
|
|
48
|
+
*
|
|
49
|
+
* Keys are byte-exact, as on S3 and R2: keys that differ only by case or
|
|
50
|
+
* Unicode normalization are distinct objects even on a filesystem that
|
|
51
|
+
* folds both (default macOS APFS). Each segment is escaped into a
|
|
52
|
+
* fold-invariant alphabet on disk — `A` is stored as `%41`, NFC `é` as
|
|
53
|
+
* `%c3%a9` — while kernel-written segments (lowercase ids, base-32 index
|
|
54
|
+
* values, `current.json`) are stored verbatim. See
|
|
55
|
+
* `local-fs-key-codec.ts`.
|
|
56
|
+
*
|
|
57
|
+
* The root carries a `.baerly-localfs.json` marker naming that encoding.
|
|
58
|
+
* A directory written by an older release, before keys were escaped, is
|
|
59
|
+
* adopted as-is when every name in it already reads the same under the
|
|
60
|
+
* encoding; otherwise every operation refuses with `InvalidConfig`.
|
|
61
|
+
* Such a directory is dev data: move it aside or delete it. Collections
|
|
62
|
+
* worth keeping can be dumped with the older release (`baerly admin
|
|
63
|
+
* dump`, rows only) and restored into a fresh directory (`baerly admin
|
|
64
|
+
* restore`). Data a folding filesystem has already merged is not
|
|
65
|
+
* recoverable.
|
|
66
|
+
*
|
|
67
|
+
* ETags are content-addressed: `"<sha-256-hex>"` (the surrounding
|
|
68
|
+
* double-quotes match S3's wire format for non-multipart objects).
|
|
69
|
+
* Identical bodies share an ETag across runs — the property that
|
|
70
|
+
* makes this adapter useful for fixture-based tests.
|
|
71
|
+
*
|
|
72
|
+
* Writes are atomic via `writeFile(temp) + rename(final)`; readers
|
|
73
|
+
* never see a partially-written file. The temp is always a sibling of
|
|
74
|
+
* its destination — `rename(2)`/`link(2)` fail with `EXDEV` across
|
|
75
|
+
* filesystems, and the bucket root is routinely on a different volume
|
|
76
|
+
* from `os.tmpdir()` (see `tempPathFor`).
|
|
77
|
+
*
|
|
78
|
+
* `ifNoneMatch:"*"` uses `link(2)` (atomic exclusive create; `EEXIST` ⇒
|
|
79
|
+
* key exists) so concurrent creates have exactly one winner. temp+`link`
|
|
80
|
+
* over `open(…,"wx")` keeps a partially-written new key invisible to a
|
|
81
|
+
* concurrent reader.
|
|
82
|
+
*
|
|
83
|
+
* `ifMatch` is a read-compare-write, so it is made atomic by serializing
|
|
84
|
+
* every mutation of a key against every other — see `#lockKey`.
|
|
85
|
+
*
|
|
86
|
+
* Scope of that guarantee, precisely: **one loaded copy of this module**.
|
|
87
|
+
* Within it, concurrent CAS on one key admits exactly one winner and the
|
|
88
|
+
* losers get `WriteConflict`, across any number of `LocalFsStorage` instances
|
|
89
|
+
* whose roots resolve — through symlinks — to the same directory. That is
|
|
90
|
+
* one process in every normal setup, but the lock lives in a module-level
|
|
91
|
+
* map, so a process that somehow loads both this source and the bundled
|
|
92
|
+
* copy has two of them.
|
|
93
|
+
*
|
|
94
|
+
* Across processes it guarantees nothing: two `baerly` CLI runs, or two
|
|
95
|
+
* servers, sharing a directory can both win, because nothing in POSIX
|
|
96
|
+
* makes read-compare-write atomic without a lock file or a lease. That is
|
|
97
|
+
* why this adapter is for single-process dev and self-hosting;
|
|
98
|
+
* horizontally-scaled deploys need S3 / R2, whose server-side conditional
|
|
99
|
+
* write is what the no-lease maintenance fold actually relies on.
|
|
100
|
+
*
|
|
101
|
+
* Node-only — imports `node:fs`, `node:path`, `node:crypto`. Lives in
|
|
102
|
+
* `@baerly/dev` because the protocol kernel is pure-modules / no I/O
|
|
103
|
+
* and must remain Worker-bundleable.
|
|
104
|
+
*
|
|
105
|
+
* ⚠️ **Hard termination and temp files.**
|
|
106
|
+
*
|
|
107
|
+
* Writes stage a sibling `.baerly-tmp-*` file before atomic rename/link.
|
|
108
|
+
* Normal failures clean up the temp in `finally`, but hard termination
|
|
109
|
+
* (`SIGKILL`, OOM, power loss) can strand a temp inside the root directory.
|
|
110
|
+
*
|
|
111
|
+
* These files are hidden from `list`, `gc`, `fsck`, and usage reporting
|
|
112
|
+
* by design—the temp filter applies at every depth.
|
|
113
|
+
*
|
|
114
|
+
* **Manual cleanup procedure:**
|
|
115
|
+
* 1. Stop all writers using the root
|
|
116
|
+
* 2. Run: `find <root> -name '.baerly-tmp-*' -delete`
|
|
117
|
+
*
|
|
118
|
+
* Do not clean while writes are in progress—races with in-flight PUTs
|
|
119
|
+
* can delete a file that a concurrent operation is about to rename.
|
|
120
|
+
*/
|
|
121
|
+
declare class LocalFsStorage implements Storage {
|
|
122
|
+
#private;
|
|
123
|
+
constructor(opts: LocalFsStorageOptions);
|
|
124
|
+
get(key: string, opts?: StorageGetOptions): Promise<StorageGetResult | null>;
|
|
125
|
+
put(key: string, body: Uint8Array, opts?: StoragePutOptions): Promise<StoragePutResult>;
|
|
126
|
+
delete(key: string, opts?: {
|
|
127
|
+
signal?: AbortSignal;
|
|
128
|
+
}): Promise<void>;
|
|
129
|
+
list(prefix: string, opts?: {
|
|
130
|
+
startAfter?: string;
|
|
131
|
+
maxKeys?: number;
|
|
132
|
+
signal?: AbortSignal;
|
|
133
|
+
}): AsyncIterable<StorageListEntry>;
|
|
134
|
+
}
|
|
135
|
+
export { LocalFsStorageOptions as n, ensureTable as r, LocalFsStorage as t };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { a as StoragePutOptions, i as StorageListEntry, n as StorageGetOptions, o as StoragePutResult, r as StorageGetResult, t as Storage } from "./types-suVbsEWS.js";
|
|
2
|
+
/** Options for {@link MemoryStorage}. */
|
|
3
|
+
interface MemoryStorageOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Acknowledge the store is intentionally ephemeral — required to
|
|
6
|
+
* construct in a detected deployment ({@link isDeployedEnv}); ignored in
|
|
7
|
+
* dev/test. Env equivalent: `BAERLY_ALLOW_EPHEMERAL_STORAGE=true`.
|
|
8
|
+
*/
|
|
9
|
+
ephemeral?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* In-memory `Storage`. The randomized property test runs against
|
|
13
|
+
* this; it must be deterministic — no clocks beyond the caller's,
|
|
14
|
+
* no randomness, no I/O.
|
|
15
|
+
*
|
|
16
|
+
* ETags are a monotonically increasing hex counter formatted in the
|
|
17
|
+
* `"<hex>"` shape S3 returns (the surrounding double-quotes are part
|
|
18
|
+
* of the ETag header value). Keys are stored verbatim.
|
|
19
|
+
*
|
|
20
|
+
* **Test-confidence caveat:** every method resolves on the microtask
|
|
21
|
+
* queue with no real concurrency, so `put` reads `existing` and writes
|
|
22
|
+
* back with no interleaving. MemoryStorage therefore CANNOT exercise the
|
|
23
|
+
* compare-and-swap race the writer-fence model depends on — two writers
|
|
24
|
+
* contending on one `current.json` always serialize here, so a green run
|
|
25
|
+
* is necessary but not sufficient. That race is covered only by the
|
|
26
|
+
* randomized integration tests against real S3 / Minio
|
|
27
|
+
* (`tests/integration/randomized.test.ts`, `node-minio` variant).
|
|
28
|
+
* Relatedly, `serverDate` returns the local clock, not an independent
|
|
29
|
+
* server clock (see the `put` return below).
|
|
30
|
+
*/
|
|
31
|
+
declare class MemoryStorage implements Storage {
|
|
32
|
+
#private;
|
|
33
|
+
constructor(opts?: MemoryStorageOptions);
|
|
34
|
+
get(key: string, opts?: StorageGetOptions): Promise<StorageGetResult | null>;
|
|
35
|
+
put(key: string, body: Uint8Array, opts?: StoragePutOptions): Promise<StoragePutResult>;
|
|
36
|
+
delete(key: string, opts?: {
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
list(prefix: string, opts?: {
|
|
40
|
+
startAfter?: string;
|
|
41
|
+
maxKeys?: number;
|
|
42
|
+
signal?: AbortSignal;
|
|
43
|
+
}): AsyncIterable<StorageListEntry>;
|
|
44
|
+
/**
|
|
45
|
+
* Test-only: drop all objects.
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
_clear(): void;
|
|
49
|
+
}
|
|
50
|
+
export { MemoryStorage as t };
|