@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/index-0rZcMBwy.d.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { _ as StoragePutOptions, g as StorageListEntry, h as StorageGetResult, m as StorageGetOptions, p as Storage, v as StoragePutResult } from "./index-BYk9oCNf.js";
|
|
2
|
-
|
|
3
|
-
//#region packages/dev/src/dev-landing.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Dev landing page for the API root (`GET /`).
|
|
6
|
-
*
|
|
7
|
-
* The HTTP surface is API-only: every path outside `/v1/*`
|
|
8
|
-
* returns the {@link HttpErrorEnvelope} 404 shape. That's correct for
|
|
9
|
-
* production but confusing in local dev — a user who clicks the
|
|
10
|
-
* `http://localhost:3000` link in their terminal sees a JSON 404 and
|
|
11
|
-
* assumes the server is broken.
|
|
12
|
-
*
|
|
13
|
-
* Adapters that wire the {@link DevLandingOptions} opt-in surface a
|
|
14
|
-
* small HTML page on `GET /` instead: app label, a clickable link to
|
|
15
|
-
* the UI, a `/v1/healthz` probe link, and a note that `/v1/c/*` is
|
|
16
|
-
* auth-gated. `GET /favicon.ico` answers 204 so browsers don't pin a
|
|
17
|
-
* second JSON 404 next to the landing page.
|
|
18
|
-
*
|
|
19
|
-
* Production deployments leave the option unset; the 404 falls
|
|
20
|
-
* through to the existing envelope.
|
|
21
|
-
*/
|
|
22
|
-
/** Options for {@link renderDevLanding}. */
|
|
23
|
-
interface DevLandingOptions {
|
|
24
|
-
/** Bucket-prefix / app name (typically passed through from the adapter's `app` option). */
|
|
25
|
-
readonly app: string;
|
|
26
|
-
/** URL of the human-facing UI (e.g., `"http://localhost:5173"`). */
|
|
27
|
-
readonly uiUrl: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Render the dev landing page HTML. Dependency-free; system fonts
|
|
31
|
-
* only; no JS. All substitutions are HTML-escaped to keep the page
|
|
32
|
-
* inert even when `app` / `uiUrl` come from env vars.
|
|
33
|
-
*/
|
|
34
|
-
declare const renderDevLanding: (opts: DevLandingOptions) => string;
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region packages/dev/src/ensure-table.d.ts
|
|
37
|
-
/**
|
|
38
|
-
* Optional pre-warm: idempotently create the `current.json` manifest
|
|
39
|
-
* for a single `(app, tenant, table)` triple. The kernel auto-creates
|
|
40
|
-
* this manifest on the first commit anyway (see `Db.create` and
|
|
41
|
-
* `Writer.commit`), so calling `ensureTable` is **not required** for
|
|
42
|
-
* correctness — it's a one-Class-A-PUT optimization for callers that
|
|
43
|
-
* want the manifest in place before the first request lands (seed
|
|
44
|
-
* scripts, deploy-time provisioning, CI fixtures that snapshot the
|
|
45
|
-
* bucket between phases, etc.).
|
|
46
|
-
*
|
|
47
|
-
* Wraps {@link createCurrentJson} with the canonical key shape
|
|
48
|
-
* (`app/<app>/tenant/<tenant>/manifests/<table>/current.json`) and
|
|
49
|
-
* swallows `BaerlyError{code:"Conflict"}` so re-runs are safe. An
|
|
50
|
-
* existing manifest is preserved verbatim — this function never
|
|
51
|
-
* overwrites a populated manifest. The seed shape matches the
|
|
52
|
-
* kernel's auto-create exactly, so a pre-warm and an
|
|
53
|
-
* auto-provisioned bucket are byte-identical.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```ts
|
|
57
|
-
* import { LocalFsStorage, ensureTable } from "@gusto/baerly-storage/dev";
|
|
58
|
-
*
|
|
59
|
-
* const storage = new LocalFsStorage({ root: "./.baerly-data" });
|
|
60
|
-
* // Pre-warm so the first request doesn't pay the bootstrap PUT.
|
|
61
|
-
* await ensureTable(storage, { app: "helpdesk", tenant: "demo", table: "tickets" });
|
|
62
|
-
* // …then `baerlyNode({ config, storage, verifier })`.
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
declare const ensureTable: (storage: Storage, args: {
|
|
66
|
-
app: string;
|
|
67
|
-
tenant: string;
|
|
68
|
-
table: string;
|
|
69
|
-
}) => Promise<void>;
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region packages/dev/src/local-fs.d.ts
|
|
72
|
-
interface LocalFsStorageOptions {
|
|
73
|
-
/** Root directory; treated as "the bucket". */
|
|
74
|
-
root: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* `Storage` backed by a directory tree. Keys may contain `/` and map
|
|
78
|
-
* to nested directories on disk so `ls`/`cat` work as expected.
|
|
79
|
-
*
|
|
80
|
-
* ETags are content-addressed: `"<sha-256-hex>"` (the surrounding
|
|
81
|
-
* double-quotes match S3's wire format for non-multipart objects).
|
|
82
|
-
* Identical bodies share an ETag across runs — the property that
|
|
83
|
-
* makes this adapter useful for fixture-based tests.
|
|
84
|
-
*
|
|
85
|
-
* Writes are atomic via `writeFile(temp) + rename(final)`; readers
|
|
86
|
-
* never see a partially-written file.
|
|
87
|
-
*
|
|
88
|
-
* `ifNoneMatch:"*"` uses a same-dir temp + `link(2)` (atomic exclusive
|
|
89
|
-
* create; `EEXIST` ⇒ key exists) so concurrent creates have exactly one
|
|
90
|
-
* winner. Same-dir avoids `EXDEV`; temp+`link` over `open(…,"wx")` keeps
|
|
91
|
-
* a partially-written new key invisible to a concurrent reader. `ifMatch`
|
|
92
|
-
* keeps the `rename` path (in-process TOCTOU only; cross-process
|
|
93
|
-
* contention uses the S3 / Minio `If-Match` path).
|
|
94
|
-
*
|
|
95
|
-
* Node-only — imports `node:fs`, `node:path`, `node:crypto`. Lives in
|
|
96
|
-
* `@baerly/dev` because the protocol kernel is pure-modules / no I/O
|
|
97
|
-
* and must remain Worker-bundleable.
|
|
98
|
-
*/
|
|
99
|
-
declare class LocalFsStorage implements Storage {
|
|
100
|
-
#private;
|
|
101
|
-
constructor(opts: LocalFsStorageOptions);
|
|
102
|
-
get(key: string, opts?: StorageGetOptions): Promise<StorageGetResult | null>;
|
|
103
|
-
put(key: string, body: Uint8Array, opts?: StoragePutOptions): Promise<StoragePutResult>;
|
|
104
|
-
delete(key: string, opts?: {
|
|
105
|
-
signal?: AbortSignal;
|
|
106
|
-
}): Promise<void>;
|
|
107
|
-
list(prefix: string, opts?: {
|
|
108
|
-
startAfter?: string;
|
|
109
|
-
maxKeys?: number;
|
|
110
|
-
signal?: AbortSignal;
|
|
111
|
-
}): AsyncIterable<StorageListEntry>;
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
|
-
export { renderDevLanding as a, DevLandingOptions as i, LocalFsStorageOptions as n, ensureTable as r, LocalFsStorage as t };
|
|
115
|
-
//# sourceMappingURL=index-0rZcMBwy.d.ts.map
|
package/dist/index-BNRh23K9.d.ts
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { d as IndexDefinition, f as DocumentData, n as BaerlyAppConfig, r as BaerlyConfig, u as SchemaValidator, v as SNAPSHOT_SCHEMA_VERSION } from "./app-config-DyiFK3_k.js";
|
|
2
|
-
import { n as LogEntry, p as Storage, r as Verifier } from "./index-BYk9oCNf.js";
|
|
3
|
-
//#region packages/server/src/config.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Flatten `BaerlyConfig.collections` into the per-collection
|
|
6
|
-
* `schemas` and `indexes` maps that {@link Db.create} consumes at
|
|
7
|
-
* runtime. Used by the Cloudflare and Node adapters to pipe a
|
|
8
|
-
* single `config` object through to the writer/planner.
|
|
9
|
-
*
|
|
10
|
-
* Both adapters import this helper rather than inlining the loop
|
|
11
|
-
* so the projection rule (drop empty index arrays; omit absent
|
|
12
|
-
* schemas) stays in one place. Future `CollectionDefinition`
|
|
13
|
-
* fields (lifecycle hooks, replica_identity) land here too.
|
|
14
|
-
*/
|
|
15
|
-
declare const collectionsToMaps: (collections: BaerlyConfig["collections"] | undefined) => {
|
|
16
|
-
schemas: ReadonlyMap<string, SchemaValidator>;
|
|
17
|
-
indexes: ReadonlyMap<string, ReadonlyArray<IndexDefinition>>;
|
|
18
|
-
};
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region packages/server/src/auth/internal/resolve-verifier.d.ts
|
|
21
|
-
/**
|
|
22
|
-
* Read env var lazily via a host-supplied accessor so the same
|
|
23
|
-
* resolver works in CF Workers (env binding) and Node
|
|
24
|
-
* (`process.env`). Returns `undefined` for an unset OR empty string —
|
|
25
|
-
* both branches mean "operator forgot to set it".
|
|
26
|
-
*/
|
|
27
|
-
type EnvAccessor = (name: string) => string | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Inputs to {@link resolveVerifier}. `factoryVerifier` is the
|
|
30
|
-
* adapter-factory `verifier:` option (may be undefined). `config`
|
|
31
|
-
* carries the typed `auth` posture + the `tenant` pin. `readEnv`
|
|
32
|
-
* is the per-host env accessor.
|
|
33
|
-
*/
|
|
34
|
-
interface ResolveVerifierInput {
|
|
35
|
-
readonly factoryVerifier: Verifier | undefined;
|
|
36
|
-
readonly config: BaerlyAppConfig;
|
|
37
|
-
readonly readEnv: EnvAccessor;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Resolve the per-request `Verifier` for an adapter factory using the
|
|
41
|
-
* fixed order:
|
|
42
|
-
*
|
|
43
|
-
* 1. `factoryVerifier` set → use as-is (highest precedence; enables
|
|
44
|
-
* env-aware construction via `cloudflareAccess(env)` etc).
|
|
45
|
-
* 2. else `config.auth === "shared-secret"` → read `SHARED_SECRET`
|
|
46
|
-
* via `readEnv`; throw `BaerlyError("InvalidConfig",
|
|
47
|
-
* SHARED_SECRET_MISSING_MESSAGE)` when unset/empty; else build
|
|
48
|
-
* `sharedSecret({ secret, tenantPrefix: config.tenant })`.
|
|
49
|
-
* 3. else `config.auth === "none"` → `noAuthVerifier(config.tenant)`.
|
|
50
|
-
* 4. else → throw `BaerlyError("InvalidConfig",
|
|
51
|
-
* NO_AUTH_CONFIGURED_MESSAGE)`.
|
|
52
|
-
*
|
|
53
|
-
* Pure function — no I/O, no side effects beyond `sharedSecret`'s
|
|
54
|
-
* own validation. Caller invokes once at adapter init time (or on
|
|
55
|
-
* first fetch, depending on platform `await`-at-top-level
|
|
56
|
-
* constraints).
|
|
57
|
-
*
|
|
58
|
-
* @throws BaerlyError code="InvalidConfig" — branches 2 and 4 above.
|
|
59
|
-
*
|
|
60
|
-
* @internal
|
|
61
|
-
*/
|
|
62
|
-
declare const resolveVerifier: (input: ResolveVerifierInput) => Verifier;
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region packages/server/src/snapshot.d.ts
|
|
65
|
-
/**
|
|
66
|
-
* Build the on-bucket key for a snapshot file. `sha256` must be the
|
|
67
|
-
* lowercase hex digest of the canonical body
|
|
68
|
-
* ({@link encodeSnapshotBody}); the filename embeds it so a crashed
|
|
69
|
-
* mid-PUT body that doesn't match its own filename hash is rejected
|
|
70
|
-
* by readers as "missing."
|
|
71
|
-
*
|
|
72
|
-
* @throws BaerlyError code="InvalidConfig" — `minSeq`/`maxSeq` are
|
|
73
|
-
* out of range or `sha256` is not 64 hex chars.
|
|
74
|
-
*/
|
|
75
|
-
declare const snapshotKey: (collectionPrefix: string, minSeq: number, maxSeq: number, sha256: string) => string;
|
|
76
|
-
/**
|
|
77
|
-
* On-bucket body of a snapshot file. The reader recomputes the SHA-256
|
|
78
|
-
* over the canonical serialisation ({@link encodeSnapshotBody}) and
|
|
79
|
-
* rejects any mismatch with the filename hash.
|
|
80
|
-
*
|
|
81
|
-
* `docs` is sorted by `_id` for deterministic byte output — two
|
|
82
|
-
* compactions over the same fold produce byte-identical snapshots,
|
|
83
|
-
* which means same filename, which means an idempotent re-run never
|
|
84
|
-
* leaves an orphan.
|
|
85
|
-
*/
|
|
86
|
-
interface SnapshotBody {
|
|
87
|
-
readonly schema_version: typeof SNAPSHOT_SCHEMA_VERSION;
|
|
88
|
-
readonly min_seq: number;
|
|
89
|
-
readonly max_seq: number;
|
|
90
|
-
readonly collection: string;
|
|
91
|
-
readonly docs: ReadonlyArray<{
|
|
92
|
-
readonly _id: string;
|
|
93
|
-
readonly body: DocumentData;
|
|
94
|
-
}>;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Canonical byte encoding of a {@link SnapshotBody}. Only the
|
|
98
|
-
* compactor produces snapshots, and only this function does the
|
|
99
|
-
* serialisation — so the byte output is deterministic for a given
|
|
100
|
-
* `SnapshotBody` (identical input ⇒ identical bytes ⇒ identical
|
|
101
|
-
* filename hash).
|
|
102
|
-
*/
|
|
103
|
-
declare const encodeSnapshotBody: (s: SnapshotBody) => Uint8Array;
|
|
104
|
-
/**
|
|
105
|
-
* Load a snapshot file as a `Map<_id, DocumentData>`. Verifies the
|
|
106
|
-
* body hash against the filename, checks the schema version, and
|
|
107
|
-
* cross-checks `body.collection` against the caller's expectation.
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* ```ts
|
|
111
|
-
* import { loadSnapshotAsMap } from "@gusto/baerly-storage";
|
|
112
|
-
*
|
|
113
|
-
* const map =
|
|
114
|
-
* srcCurrent.snapshot === null
|
|
115
|
-
* ? new Map<string, DocumentData>()
|
|
116
|
-
* : await loadSnapshotAsMap(src.storage, srcCurrent.snapshot, "tickets");
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* @throws BaerlyError code="Internal" — pointer resolves to no body,
|
|
120
|
-
* or the body's SHA-256 doesn't match the hash embedded in the
|
|
121
|
-
* filename. (Protocol invariant violation; a corrupted snapshot
|
|
122
|
-
* the reader cannot continue past.)
|
|
123
|
-
* @throws BaerlyError code="InvalidResponse" — body isn't valid JSON,
|
|
124
|
-
* isn't an object, has an unsupported `schema_version`, or carries a
|
|
125
|
-
* `collection` that doesn't match `expectedCollection`.
|
|
126
|
-
*/
|
|
127
|
-
declare const loadSnapshotAsMap: (storage: Storage, key: string, expectedCollection: string, signal?: AbortSignal) => Promise<Map<string, DocumentData>>;
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region packages/server/src/log-walk.d.ts
|
|
130
|
-
/**
|
|
131
|
-
* Walk `[fromSeq, toSeqExclusive)` of `${logPrefix}/log/<seq>.json`
|
|
132
|
-
* in chunks of {@link MAX_PARALLEL_LOG_READS} concurrent GETs.
|
|
133
|
-
* Returns the materialised entries in seq order.
|
|
134
|
-
*
|
|
135
|
-
* Empty range (`fromSeq >= toSeqExclusive`) returns `[]` and issues
|
|
136
|
-
* zero GETs.
|
|
137
|
-
*
|
|
138
|
-
* Same error semantics as {@link readLogEntry}: a missing entry
|
|
139
|
-
* throws `Internal`, a malformed body throws `InvalidResponse`.
|
|
140
|
-
*/
|
|
141
|
-
declare const walkLogRange: (storage: Storage, logPrefix: string, fromSeq: number, toSeqExclusive: number, opts?: {
|
|
142
|
-
signal?: AbortSignal;
|
|
143
|
-
}) => Promise<LogEntry[]>;
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region packages/server/src/log-tail.d.ts
|
|
146
|
-
/**
|
|
147
|
-
* Discover the true committed tail and fold entries in `[hint, tail)`.
|
|
148
|
-
* `tail` is the first empty seq (>= hint); `entries` are the
|
|
149
|
-
* LogEntries in `[hint, tail)` in seq order. `cap` bounds the walk;
|
|
150
|
-
* exhausting it THROWS `Internal` (never silently truncates) — see
|
|
151
|
-
* the cap-exhaustion comment below.
|
|
152
|
-
*/
|
|
153
|
-
declare const probeTailFrom: (storage: Storage, logPrefix: string, hint: number, opts?: {
|
|
154
|
-
signal?: AbortSignal;
|
|
155
|
-
cap?: number;
|
|
156
|
-
}) => Promise<{
|
|
157
|
-
tail: number;
|
|
158
|
-
entries: LogEntry[];
|
|
159
|
-
}>;
|
|
160
|
-
//#endregion
|
|
161
|
-
export { loadSnapshotAsMap as a, collectionsToMaps as c, encodeSnapshotBody as i, walkLogRange as n, snapshotKey as o, SnapshotBody as r, resolveVerifier as s, probeTailFrom as t };
|
|
162
|
-
//# sourceMappingURL=index-BNRh23K9.d.ts.map
|