@gusto/baerly-storage 0.2.0 → 0.4.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 (155) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +29 -0
  3. package/README.md +176 -70
  4. package/dist/API.md +213 -139
  5. package/dist/CHANGELOG.md +434 -0
  6. package/dist/RECIPES.md +125 -0
  7. package/dist/THIRD-PARTY-LICENSES.txt +238 -0
  8. package/dist/{app-config-C0Bbw_Z6.d.ts → app-config-DyiFK3_k.d.ts} +55 -11
  9. package/dist/app-config.d.ts +1 -1
  10. package/dist/auth.d.ts +1 -1
  11. package/dist/auth.js +301 -301
  12. package/dist/auth.js.map +1 -1
  13. package/dist/aws4fetch.esm-p7eEzLCs.js +1702 -0
  14. package/dist/aws4fetch.esm-p7eEzLCs.js.map +1 -0
  15. package/dist/baerly.js +35 -15
  16. package/dist/baerly.js.map +1 -1
  17. package/dist/baerly.spec.json +342 -0
  18. package/dist/bytes-BXdamO3L.js.map +1 -1
  19. package/dist/{client-DYZfoZb9.d.ts → client-Fe8CwB73.d.ts} +10 -10
  20. package/dist/client-react.d.ts +3 -3
  21. package/dist/client-react.js +4 -4
  22. package/dist/client-react.js.map +1 -1
  23. package/dist/client.d.ts +4 -4
  24. package/dist/client.js +3 -3
  25. package/dist/client.js.map +1 -1
  26. package/dist/{cloudflare-CINJPKCW.js → cloudflare-DzKBrUlg.js} +178 -2
  27. package/dist/cloudflare-DzKBrUlg.js.map +1 -0
  28. package/dist/cloudflare.d.ts +49 -6
  29. package/dist/cloudflare.js +59 -26
  30. package/dist/cloudflare.js.map +1 -1
  31. package/dist/config-1tv0-Yzm.js +2693 -0
  32. package/dist/config-1tv0-Yzm.js.map +1 -0
  33. package/dist/constants-CfeMWQWk.js +222 -0
  34. package/dist/constants-CfeMWQWk.js.map +1 -0
  35. package/dist/context-DRZ3tZ5l.js.map +1 -1
  36. package/dist/{cost-CQt1YRkA.js → cost-DSMIVqzL.js} +43 -42
  37. package/dist/cost-DSMIVqzL.js.map +1 -0
  38. package/dist/current-json-C6nhPOm1.js +190 -0
  39. package/dist/current-json-C6nhPOm1.js.map +1 -0
  40. package/dist/{db-BM3y2JQw.d.ts → db-DsPkOVEH.d.ts} +26 -108
  41. package/dist/{deploy-CrAbfgCq.js → deploy-DonTr-CV.js} +12 -5
  42. package/dist/deploy-DonTr-CV.js.map +1 -0
  43. package/dist/dev-vite.d.ts +11 -7
  44. package/dist/dev-vite.js +7 -6
  45. package/dist/dev-vite.js.map +1 -1
  46. package/dist/dev.d.ts +1 -1
  47. package/dist/dev.js +1 -1
  48. package/dist/{doctor-Db-hzPmE.js → doctor-DSIyCDg_.js} +14 -136
  49. package/dist/doctor-DSIyCDg_.js.map +1 -0
  50. package/dist/{dump-BYA55NLP.js → dump-Bh5k26VQ.js} +10 -31
  51. package/dist/dump-Bh5k26VQ.js.map +1 -0
  52. package/dist/{errors-DOdL95kK.js → errors-Dfa3p78c.js} +25 -5
  53. package/dist/errors-Dfa3p78c.js.map +1 -0
  54. package/dist/{export-Bhbz90-z.js → export-DtF5tDIM.js} +11 -32
  55. package/dist/{export-Bhbz90-z.js.map → export-DtF5tDIM.js.map} +1 -1
  56. package/dist/{fsck-CPPZWt9p.js → fsck-D_djMO5D.js} +28 -39
  57. package/dist/fsck-D_djMO5D.js.map +1 -0
  58. package/dist/{http-Cw8p6y5b.js → http-DxM9MflO.js} +151 -79
  59. package/dist/http-DxM9MflO.js.map +1 -0
  60. package/dist/http.d.ts +42 -26
  61. package/dist/http.js +3 -2
  62. package/dist/{index-DwDTWPSU.d.ts → index-0rZcMBwy.d.ts} +10 -7
  63. package/dist/{index-C3JAH1Yo.d.ts → index-B6oexfOB.d.ts} +9 -9
  64. package/dist/{index-cUY-36AN.d.ts → index-BNRh23K9.d.ts} +21 -5
  65. package/dist/{index-DSvwEUeF.d.ts → index-BYk9oCNf.d.ts} +240 -202
  66. package/dist/index.d.ts +6 -6
  67. package/dist/index.js +5 -5
  68. package/dist/{indexes-DAu2AkTW.d.ts → indexes-Dn9hbGQG.d.ts} +2 -2
  69. package/dist/{inspect-Bdbzvi-_.js → inspect-6WZ-pC7-.js} +21 -36
  70. package/dist/inspect-6WZ-pC7-.js.map +1 -0
  71. package/dist/key-Di6yyxFu.js +35 -0
  72. package/dist/key-Di6yyxFu.js.map +1 -0
  73. package/dist/{snapshot-SS8USDUF.js → log-tail-D98U1JBo.js} +179 -84
  74. package/dist/log-tail-D98U1JBo.js.map +1 -0
  75. package/dist/{maintenance-ClzBC1Vv.js → maintenance-B4Dki6Ig.js} +438 -176
  76. package/dist/maintenance-B4Dki6Ig.js.map +1 -0
  77. package/dist/{maintenance-BRrThz8V.d.ts → maintenance-B_e0T99L.d.ts} +114 -26
  78. package/dist/{maintenance-BvOv6BMM.js → maintenance-C7coQp4c.js} +217 -94
  79. package/dist/maintenance-C7coQp4c.js.map +1 -0
  80. package/dist/maintenance.d.ts +3 -2
  81. package/dist/maintenance.js +3 -2
  82. package/dist/node.d.ts +176 -68
  83. package/dist/node.js +3 -2
  84. package/dist/{normalize-XWY25_sG.js → normalize-rjnZLwS4.js} +2 -2
  85. package/dist/normalize-rjnZLwS4.js.map +1 -0
  86. package/dist/{observability-CpOiEN0k.js → observability-wzs3-BL_.js} +279 -109
  87. package/dist/observability-wzs3-BL_.js.map +1 -0
  88. package/dist/observability.d.ts +3 -3
  89. package/dist/observability.js +1 -1
  90. package/dist/{plan-DOTl21vq.js → plan-a7PJHBCy.js} +7 -4
  91. package/dist/plan-a7PJHBCy.js.map +1 -0
  92. package/dist/{query-BmiQy328.js → query-rAtXNQQB.js} +1063 -1202
  93. package/dist/query-rAtXNQQB.js.map +1 -0
  94. package/dist/{rebuild-index-DC_nR6wP.js → rebuild-index-BVzQSZlm.js} +10 -32
  95. package/dist/rebuild-index-BVzQSZlm.js.map +1 -0
  96. package/dist/{request-BEF_OvMh.js → request-u0M51mhJ.js} +3 -3
  97. package/dist/{request-BEF_OvMh.js.map → request-u0M51mhJ.js.map} +1 -1
  98. package/dist/restore-R-4rbciV.js +778 -0
  99. package/dist/restore-R-4rbciV.js.map +1 -0
  100. package/dist/runtime-spec-qL3_lTTU.js +391 -0
  101. package/dist/runtime-spec-qL3_lTTU.js.map +1 -0
  102. package/dist/s3-http-B-z8th6O.d.ts +60 -0
  103. package/dist/s3.d.ts +47 -0
  104. package/dist/s3.js +45 -0
  105. package/dist/s3.js.map +1 -0
  106. package/dist/{shared-secret-BJdSwpgw.js → shared-secret-DgEicd3x.js} +13 -5
  107. package/dist/shared-secret-DgEicd3x.js.map +1 -0
  108. package/dist/src-BG20LZs7.js +2271 -0
  109. package/dist/src-BG20LZs7.js.map +1 -0
  110. package/dist/{src-zhEAmmF7.js → src-CYHFDrKz.js} +82 -99
  111. package/dist/src-CYHFDrKz.js.map +1 -0
  112. package/dist/{src-QQ7jDeL2.js → src-DYZ4H1aF.js} +44 -23
  113. package/dist/src-DYZ4H1aF.js.map +1 -0
  114. package/dist/subcommand-DoDA-K7d.js +197 -0
  115. package/dist/subcommand-DoDA-K7d.js.map +1 -0
  116. package/dist/time-DUqvFMHq.js +119 -0
  117. package/dist/time-DUqvFMHq.js.map +1 -0
  118. package/dist/{usage-CLjirdD-.js → usage-DBV1eQHC.js} +7 -22
  119. package/dist/usage-DBV1eQHC.js.map +1 -0
  120. package/dist/{validate-DCq_0DIn.js → validate-DtljsCh1.js} +51 -51
  121. package/dist/{validate-DCq_0DIn.js.map → validate-DtljsCh1.js.map} +1 -1
  122. package/dist/wire-izfGZDvr.js.map +1 -1
  123. package/package.json +77 -42
  124. package/dist/cloudflare-CINJPKCW.js.map +0 -1
  125. package/dist/config-DVfDGyw1.js +0 -278
  126. package/dist/config-DVfDGyw1.js.map +0 -1
  127. package/dist/cost-CQt1YRkA.js.map +0 -1
  128. package/dist/current-json-C-EyJqs0.js +0 -354
  129. package/dist/current-json-C-EyJqs0.js.map +0 -1
  130. package/dist/deploy-CrAbfgCq.js.map +0 -1
  131. package/dist/doctor-Db-hzPmE.js.map +0 -1
  132. package/dist/dump-BYA55NLP.js.map +0 -1
  133. package/dist/errors-DOdL95kK.js.map +0 -1
  134. package/dist/fsck-CPPZWt9p.js.map +0 -1
  135. package/dist/http-Cw8p6y5b.js.map +0 -1
  136. package/dist/inspect-Bdbzvi-_.js.map +0 -1
  137. package/dist/maintenance-BvOv6BMM.js.map +0 -1
  138. package/dist/maintenance-ClzBC1Vv.js.map +0 -1
  139. package/dist/normalize-XWY25_sG.js.map +0 -1
  140. package/dist/observability-CpOiEN0k.js.map +0 -1
  141. package/dist/plan-DOTl21vq.js.map +0 -1
  142. package/dist/query-BmiQy328.js.map +0 -1
  143. package/dist/rebuild-index-DC_nR6wP.js.map +0 -1
  144. package/dist/restore-C6IcmLeA.js +0 -771
  145. package/dist/restore-C6IcmLeA.js.map +0 -1
  146. package/dist/shared-secret-BJdSwpgw.js.map +0 -1
  147. package/dist/snapshot-SS8USDUF.js.map +0 -1
  148. package/dist/src-DU1sCMlr.js +0 -6236
  149. package/dist/src-DU1sCMlr.js.map +0 -1
  150. package/dist/src-QQ7jDeL2.js.map +0 -1
  151. package/dist/src-zhEAmmF7.js.map +0 -1
  152. package/dist/subcommand-DZcHcsYp.js +0 -5122
  153. package/dist/subcommand-DZcHcsYp.js.map +0 -1
  154. package/dist/usage-CLjirdD-.js.map +0 -1
  155. /package/dist/{chunk-EAsCxrDo.js → rolldown-runtime-EAsCxrDo.js} +0 -0
@@ -1,5 +1,5 @@
1
- import { d as IndexDefinition, f as DocumentData, n as BaerlyAppConfig, r as BaerlyConfig, u as SchemaValidator } from "./app-config-C0Bbw_Z6.js";
2
- import { h as Storage, n as LogEntry, r as Verifier } from "./index-DSvwEUeF.js";
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
3
  //#region packages/server/src/config.d.ts
4
4
  /**
5
5
  * Flatten `BaerlyConfig.collections` into the per-collection
@@ -84,7 +84,7 @@ declare const snapshotKey: (collectionPrefix: string, minSeq: number, maxSeq: nu
84
84
  * leaves an orphan.
85
85
  */
86
86
  interface SnapshotBody {
87
- readonly schema_version: 1;
87
+ readonly schema_version: typeof SNAPSHOT_SCHEMA_VERSION;
88
88
  readonly min_seq: number;
89
89
  readonly max_seq: number;
90
90
  readonly collection: string;
@@ -142,5 +142,21 @@ declare const walkLogRange: (storage: Storage, logPrefix: string, fromSeq: numbe
142
142
  signal?: AbortSignal;
143
143
  }) => Promise<LogEntry[]>;
144
144
  //#endregion
145
- export { snapshotKey as a, loadSnapshotAsMap as i, SnapshotBody as n, resolveVerifier as o, encodeSnapshotBody as r, collectionsToMaps as s, walkLogRange as t };
146
- //# sourceMappingURL=index-cUY-36AN.d.ts.map
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
@@ -1,4 +1,165 @@
1
- import { f as DocumentData, m as JSONValue, p as DocumentValue } from "./app-config-C0Bbw_Z6.js";
1
+ import { f as DocumentData, m as JSONValue, p as DocumentValue } from "./app-config-DyiFK3_k.js";
2
+ //#region packages/protocol/src/errors.d.ts
3
+ /**
4
+ * Discriminator for {@link BaerlyError}. Strings (not subclasses) so they
5
+ * survive cross-realm boundaries (e.g. a Web Worker) and so callers can
6
+ * pattern-match with grep-friendly equality.
7
+ */
8
+ type BaerlyErrorCode = /** Caller-provided config or input is invalid (bad bucket, unsupported credential type, malformed URL, bucket not version-enabled when versioning was requested). */"InvalidConfig" /** Generic S3/HTTP transport failure (5xx, unexpected status, retries exhausted). */ | "NetworkError" /** S3 returned 403. Either credentials are wrong or the bucket policy denies the operation. */ | "AccessDenied" /** Server returned data that didn't parse (malformed XML, non-JSON body where JSON expected). */ | "InvalidResponse" /** Internal invariant violation — should not be reachable. File a bug. */ | "Internal"
9
+ /**
10
+ * Document body failed schema validation. Emitted by the table-API
11
+ * write verbs (`Collection.insert`, `Query.update`, `Collection.replace`) when
12
+ * the body is not valid JSON or contains an array where
13
+ * `DocumentValue` is required; also emitted when a collection has a
14
+ * declared `SchemaValidator` (via `Db.create({ collections })`) and
15
+ * the bound schema rejects the doc. In the schema-rejection case the
16
+ * error carries an `issues` array describing each failure. HTTP layer
17
+ * maps this to 400.
18
+ */
19
+ | "SchemaError"
20
+ /**
21
+ * Write conflicted with current state: CAS retry budget exhausted,
22
+ * duplicate caller-supplied `_id`, or an already-existing guarded
23
+ * storage key. Check `BaerlyError.retriable` to decide whether the
24
+ * same logical operation should be retried.
25
+ */
26
+ | "Conflict"
27
+ /**
28
+ * `Verifier` returned no identity. HTTP server maps to 401.
29
+ * Code is reserved here so the union locks.
30
+ */
31
+ | "Unauthorized"
32
+ /**
33
+ * The addressed resource does not exist. HTTP server maps to 404.
34
+ * Emitted by the row-by-id read / update / delete handlers in
35
+ * `packages/server/src/http/router.ts` when the predicate
36
+ * `{ _id }` matches zero rows. Not a protocol invariant —
37
+ * callers may retry after creating the resource or treat as a
38
+ * miss depending on intent. The CLI maps this to the generic
39
+ * exit-2 "storage error" bucket, not the exit-3 "protocol
40
+ * invariant" bucket.
41
+ */
42
+ | "NotFound"
43
+ /**
44
+ * Request body exceeded the server's size cap. HTTP server maps
45
+ * to 413. Cap is `MAX_BODY_BYTES` (1 MiB today; exported from
46
+ * `packages/server/src/http/router.ts`). The Node adapter
47
+ * enforces during the `node:http` stream pump so the process
48
+ * never materializes a multi-MiB body; Workers also rely on
49
+ * platform-side caps (16 MB free / 100 MB paid).
50
+ */
51
+ | "PayloadTooLarge"
52
+ /**
53
+ * A predicate is structurally well-formed but contradicts itself —
54
+ * no document can match. Emitted by `validateWire` and
55
+ * `mergePredicateWires`. Triggers:
56
+ * - `{ clauses: [{op:"in", field:"priority", value:[]}] }` (empty `in` set)
57
+ * - an `eq` clause with a value outside the residual interval
58
+ * established by range clauses on the same field
59
+ * - merging `{op:"gt", value:10}` with `{op:"lt", value:5}` on the
60
+ * same field (empty interval)
61
+ * - merging two `in` clauses on the same field with empty intersection
62
+ *
63
+ * Conflicting equality across clauses (`eq:"open"` + `eq:"closed"` on
64
+ * the same field) surfaces as `InvalidConfig` rather than this code —
65
+ * the merger treats it as a caller-side configuration bug, not an
66
+ * algebraic contradiction.
67
+ *
68
+ * The HTTP layer treats this as a 400 (caller error). The distinct
69
+ * code lets downstream code short-circuit empty-by-construction
70
+ * without re-running the validator or parsing messages.
71
+ */
72
+ | "UnsatisfiablePredicate"
73
+ /**
74
+ * A `useQuery` callback awaited a recorder terminal
75
+ * (`.get`/`.first`/`.all`/`.count`). The recorder runs once per
76
+ * render to capture the chain shape; it cannot survive an `await`
77
+ * because the proxy doesn't proxy across microtask boundaries. The
78
+ * recorder's terminal returns a thenable whose `.then` throws this
79
+ * error synchronously, converting what would otherwise be a silent
80
+ * spinner-hang into a render-time error the hook surfaces as
81
+ * `status: "error"`. Companion `baerly/no-await-in-use-query` lint
82
+ * flags the pattern at edit time. For compound reads, use
83
+ * `Promise.all` (parallel) or compose two `useQuery` calls with
84
+ * `useQuery.skip` (dependent).
85
+ */
86
+ | "UseQueryAwaitedRecorder"
87
+ /**
88
+ * A write method (`.insert`/`.update`/`.replace`/`.delete`) was
89
+ * called on the recorder inside a `useQuery` callback. Writes
90
+ * inside reads are a programming error; the recorder rejects them
91
+ * synchronously from the discovery pass, before any I/O fires. Use
92
+ * `useMutation()` instead.
93
+ */
94
+ | "UnexpectedWriteInQuery"
95
+ /**
96
+ * A `useMutation()` callback rejected with a non-`BaerlyError`
97
+ * throwable. The hook wraps the original throw under this code so
98
+ * the `error` slot is always a `BaerlyError`; the original value
99
+ * is preserved on `.cause`.
100
+ */
101
+ | "MutationFailed";
102
+ /**
103
+ * The single error class thrown by baerly-storage. Discriminate by `code`, not
104
+ * `instanceof`: the code string survives `JSON.stringify` round-trips
105
+ * across Worker / iframe / postMessage realm boundaries, where each
106
+ * realm has its own `BaerlyError` constructor identity. IDB-restored
107
+ * writes can replay across realms, so `instanceof` would spuriously
108
+ * fail on a structurally-identical error from another realm.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * try {
113
+ * await db.collection("tickets").insert({ title: "hi" });
114
+ * } catch (err) {
115
+ * if (err instanceof BaerlyError && err.code === "Conflict") {
116
+ * // Check err.retriable; CAS can retry, duplicate _id cannot.
117
+ * }
118
+ * throw err;
119
+ * }
120
+ * ```
121
+ */
122
+ declare class BaerlyError extends Error {
123
+ readonly code: BaerlyErrorCode;
124
+ readonly cause?: unknown;
125
+ /**
126
+ * Structured field-path issues, set only when `code === "SchemaError"`.
127
+ * Each entry's `path` is a dotted-key list (e.g. `["assignee", "team"]`
128
+ * or `["items", 3, "qty"]`) that targets the offending field on the
129
+ * input document. `message` is the validator-emitted human string.
130
+ *
131
+ * The HTTP layer's `mapError` renders these into the 400 body via
132
+ * the existing `HttpErrorEnvelope`; older callers that don't know
133
+ * about `issues` see a plain message-only error and stay correct.
134
+ */
135
+ readonly issues?: ReadonlyArray<{
136
+ readonly path: ReadonlyArray<string | number>;
137
+ readonly message: string;
138
+ }>;
139
+ /**
140
+ * Raw HTTP status, set only by the client-side wire decoder when
141
+ * inflating an `HttpErrorEnvelope` into this class. Server-side
142
+ * throws never set it (the HTTP layer's `mapError` derives the
143
+ * outbound status from `code`). Useful for diagnostics — e.g. to
144
+ * distinguish 404-as-"no such row" from 404-as-"route not found".
145
+ * Discriminate by `code` for behavior; reach for `status` only when
146
+ * you genuinely need the wire value.
147
+ */
148
+ readonly status?: number;
149
+ /** Canonical corrective action; crosses the wire via `HttpErrorEnvelope.error.resolution`. */
150
+ readonly resolution?: string;
151
+ private readonly retriableOverride;
152
+ /**
153
+ * Whether this error instance is retriable. Defaults from `code`, but
154
+ * context-sensitive throw sites can override it.
155
+ */
156
+ get retriable(): boolean;
157
+ constructor(code: BaerlyErrorCode, message: string, cause?: unknown, issues?: ReadonlyArray<{
158
+ readonly path: ReadonlyArray<string | number>;
159
+ readonly message: string;
160
+ }>, status?: number, resolution?: string, retriableOverride?: boolean);
161
+ }
162
+ //#endregion
2
163
  //#region packages/protocol/src/storage/types.d.ts
3
164
  /**
4
165
  * Object-storage abstraction. The protocol kernel writes through
@@ -123,11 +284,11 @@ interface StorageListEntry {
123
284
  /**
124
285
  * Per-collection control object. CAS-protected. One per
125
286
  * `(tenant, collection)` key — for example
126
- * `<tenant>/<collection>/current.json`. The compactor swaps
127
- * snapshot generations by CAS-writing this object; the
128
- * Writer reads it on every commit to find the snapshot
129
- * pointer; the sweeper reads `writer_fence` to decide which log
130
- * entries are eligible for GC.
287
+ * `<tenant>/<collection>/current.json`. The compactor swaps snapshot
288
+ * generations by CAS-writing this object; the Writer reads it on every
289
+ * commit to find the snapshot pointer and a non-authoritative
290
+ * tail-probe floor. The numbered log create mints the next integer
291
+ * `seq`; no commit-path code CAS-advances `current.json`.
131
292
  *
132
293
  * The schema is forward-compatible: adding a new optional field is
133
294
  * non-breaking. Renaming or removing a field requires bumping
@@ -136,11 +297,11 @@ interface StorageListEntry {
136
297
  */
137
298
  interface CurrentJson {
138
299
  /**
139
- * Schema version. Today: `2`. Bump on any breaking change to
300
+ * Schema version. Today: `3`. Bump on any breaking change to
140
301
  * field semantics; readers must reject unknown major versions
141
302
  * with `BaerlyError{code:"InvalidResponse"}`.
142
303
  */
143
- schema_version: 2;
304
+ schema_version: 3;
144
305
  /**
145
306
  * Pointer to the current snapshot generation. `null` before the
146
307
  * first compaction has produced a snapshot — readers fall back
@@ -149,23 +310,24 @@ interface CurrentJson {
149
310
  */
150
311
  snapshot: string | null;
151
312
  /**
152
- * Sequence number of the next log entry. Monotonic per
153
- * collection. The Writer reads this on commit to mint the
154
- * next log filename; CAS-write back with `next_seq + 1` ensures
155
- * no two writers pick the same sequence.
313
+ * Non-authoritative monotone lower bound on the committed log tail.
314
+ * The authoritative tail is discovered by forward-probe (log-tail.ts);
315
+ * never trust this as the head. Durable advancement is owned by
316
+ * compaction folds, write-tick tail refreshes, and explicit
317
+ * operator/import paths; ordinary writer commits do not refresh it.
156
318
  */
157
- next_seq: number;
319
+ tail_hint: number;
158
320
  /**
159
321
  * Lowest live log sequence number. Entries with `seq < log_seq_start`
160
322
  * have been folded into the snapshot at {@link snapshot} (or, if
161
323
  * `snapshot === null`, have been dropped because the collection was
162
- * truncated). Readers walk `[log_seq_start, next_seq)`. Always
324
+ * truncated). Readers walk `[log_seq_start, tail_hint)`. Always
163
325
  * present on disk — fresh `current.json` writes via
164
326
  * {@link createCurrentJson} set this to `0`; the compactor advances
165
327
  * it on every fold.
166
328
  *
167
329
  * Invariants the compactor maintains:
168
- * - `0 <= log_seq_start <= next_seq`
330
+ * - `0 <= log_seq_start <= tail_hint`
169
331
  * - `log_seq_start` advances monotonically (never decreases)
170
332
  * - `log_seq_start > 0` implies `snapshot !== null` (the snapshot
171
333
  * covers `[0, log_seq_start)`)
@@ -175,19 +337,27 @@ interface CurrentJson {
175
337
  * Embedded write-fence epoch. See {@link WriterFence}.
176
338
  */
177
339
  writer_fence: WriterFence;
178
- /** EXACT byte size of the live log tail [log_seq_start, next_seq). Maintained exactly
179
- * by the full-fence CAS on BOTH paths: each write adds its log bytes; a successful
180
- * fold (which proves no concurrent write) resets to 0 from a known-empty tail. */
181
- tail_bytes: number;
182
340
  /** Byte size of the snapshot pointed to by `snapshot`. */
183
341
  snapshot_bytes: number;
184
- /** Row count of the snapshot (= compactor `base.size`, free). With next_seq - log_seq_start
185
- * (tail entries) this gives the fold's entry count for the ENTRY ceiling `E`. Seeded 0. */
342
+ /**
343
+ * Row count of the snapshot (= compactor `base.size`, free). With
344
+ * `tail_hint - log_seq_start` (trusted tail entries) this gives the
345
+ * fold's entry count for the ENTRY ceiling `E`. Seeded 0.
346
+ */
186
347
  snapshot_rows: number;
187
- /** Baseline for rate-limiting the graduation defer-warn off SHARED durable state, not
188
- * per-isolate memory. The warn fires when next_seq - last_warned_seq >=
189
- * MAINTENANCE_WARN_INTERVAL_WRITES, and that firing CASes last_warned_seq = next_seq.
190
- * Absent → 0. */
348
+ /**
349
+ * Optional compactor-stamped mean folded-entry byte size. Maintenance
350
+ * derives live-tail bytes as `entry_count × mean_entry_bytes` without
351
+ * an exact stored counter; absent until first fold.
352
+ */
353
+ mean_entry_bytes?: number;
354
+ /**
355
+ * Baseline for rate-limiting the graduation defer-warn off SHARED
356
+ * durable state, not per-isolate memory. The warn fires when the
357
+ * observed/probed tail minus `last_warned_seq` reaches
358
+ * MAINTENANCE_WARN_INTERVAL_WRITES, and that firing CASes
359
+ * `last_warned_seq` to the observed/probed tail. Absent → 0.
360
+ */
191
361
  last_warned_seq?: number;
192
362
  }
193
363
  /**
@@ -195,23 +365,24 @@ interface CurrentJson {
195
365
  * monotonically-bumped `epoch` is the only safety-critical field —
196
366
  * `owner` is informational and may be missing in older records;
197
367
  * `claimed_at` is the server response date at claim time, NOT the
198
- * local clock; `lease_until` is reserved for manual rotation and
199
- * is not consumed by any ticket in this batch.
368
+ * local clock; `lease_until` is reserved for manual rotation and is not
369
+ * consumed by the current kernel. Log entries are not stamped with this
370
+ * epoch; the fence is dormant authority metadata, not a reader replay
371
+ * filter.
200
372
  *
201
373
  * Borrowed from FoundationDB's `recoveryCount` on cstate, IsleDB's
202
374
  * `writer_fence` on `manifest/CURRENT`, and TigerBeetle's VSR view
203
- * number. The mechanism is the same in all three: every commit
204
- * checks the epoch on the control object; an entry stamped with
205
- * a stale epoch is discarded at replay.
375
+ * number. In the earlier two-write commit design, every commit checked
376
+ * the epoch before continuing under `current.json` authority. Under
377
+ * single-write commit no production path reads or writes the fence.
206
378
  */
207
379
  interface WriterFence {
208
380
  /**
209
381
  * Monotonic unsigned integer. Bumped only by an explicit
210
382
  * {@link claimWriter} call — do NOT bump on every cold start, do
211
- * NOT bump on every commit. Triggers per design: (a) detected
212
- * CAS conflict the writer wants to claim through, (b) admin
213
- * rotation. The sweeper discards log entries whose stamped epoch
214
- * is `< current.writer_fence.epoch`.
383
+ * NOT bump on every commit. Under single-write commit this is retained
384
+ * as an explicit admin/testing primitive only; no production commit
385
+ * path claims or verifies the fence.
215
386
  */
216
387
  epoch: number;
217
388
  /**
@@ -257,8 +428,9 @@ interface CurrentJsonRead {
257
428
  * The methods on this interface ARE the supported operator surface.
258
429
  * Vocabulary additions (`or`, `not`, `regex`, `ne`, `exists`, ...)
259
430
  * are intentionally absent — calling them is a TS2339 compile
260
- * error, not a runtime rejection. See ADR-002 amendment dated
261
- * 2026-05-26 for the algebra-lock policy.
431
+ * error, not a runtime rejection. The algebra is conjunction-only in
432
+ * perpetuity — see the API surface lock in
433
+ * docs/contributing/conventions/change-discipline.md.
262
434
  *
263
435
  * @template T - the document shape the predicate is keyed against.
264
436
  */
@@ -494,7 +666,7 @@ type _StripIndex<T> = { [K in keyof T as string extends K ? never : K]: T[K] };
494
666
  * today's open-keyed default behavior.
495
667
  * @internal
496
668
  */
497
- type _AllPaths<T, D extends _PathDepth[number] = 4> = [D] extends [never] ? never : T extends object ? keyof _StripIndex<T> & string extends never ? string : { [K in keyof _StripIndex<T> & string]: _IsPathLeaf<T[K]> extends true ? K : K | `${K}.${_AllPaths<NonNullable<T[K]>, _PathDepth[D]>}` }[keyof _StripIndex<T> & string] : never;
669
+ type _AllPaths<T, D extends _PathDepth[number] = 4> = [D] extends [never] ? never : T extends object ? keyof _StripIndex<T> & string extends never ? string : { [K in keyof _StripIndex<T> & string]: _IsPathLeaf<NonNullable<T[K]>> extends true ? K : K | `${K}.${_AllPaths<NonNullable<T[K]>, _PathDepth[D]>}` }[keyof _StripIndex<T> & string] : never;
498
670
  /**
499
671
  * Legal dotted-path keys over `T`, with the root-level `_id` filtered
500
672
  * out so the top-level shape no longer accepts `{ _id: "x" }`. Nested
@@ -657,158 +829,16 @@ interface Query<T extends DocumentData = DocumentData> {
657
829
  }>;
658
830
  }
659
831
  //#endregion
660
- //#region packages/protocol/src/errors.d.ts
661
- /**
662
- * Discriminator for {@link BaerlyError}. Strings (not subclasses) so they
663
- * survive cross-realm boundaries (e.g. a Web Worker) and so callers can
664
- * pattern-match with grep-friendly equality.
665
- */
666
- type BaerlyErrorCode = /** Caller-provided config or input is invalid (bad bucket, unsupported credential type, malformed URL, bucket not version-enabled when versioning was requested). */"InvalidConfig" /** Generic S3/HTTP transport failure (5xx, unexpected status, retries exhausted). */ | "NetworkError" /** S3 returned 403. Either credentials are wrong or the bucket policy denies the operation. */ | "AccessDenied" /** Server returned data that didn't parse (malformed XML, non-JSON body where JSON expected). */ | "InvalidResponse" /** Internal invariant violation — should not be reachable. File a bug. */ | "Internal"
667
- /**
668
- * Document body failed schema validation. Emitted by the table-API
669
- * write verbs (`Collection.insert`, `Query.update`, `Collection.replace`) when
670
- * the body is not valid JSON or contains an array where
671
- * `DocumentValue` is required; also emitted when a collection has a
672
- * declared `SchemaValidator` (via `Db.create({ collections })`) and
673
- * the bound schema rejects the doc. In the schema-rejection case the
674
- * error carries an `issues` array describing each failure. HTTP layer
675
- * maps this to 422.
676
- */
677
- | "SchemaError"
678
- /**
679
- * CAS lost on `current.json`. Caller decides whether to retry.
680
- * Surfaces in the collection API and HTTP layer.
681
- */
682
- | "Conflict"
683
- /**
684
- * `Verifier` returned no identity. HTTP server maps to 401.
685
- * Code is reserved here so the union locks.
686
- */
687
- | "Unauthorized"
688
- /**
689
- * The addressed resource does not exist. HTTP server maps to 404.
690
- * Emitted by the row-by-id read / update / delete handlers in
691
- * `packages/server/src/http/router.ts` when the predicate
692
- * `{ _id }` matches zero rows. Not a protocol invariant —
693
- * callers may retry after creating the resource or treat as a
694
- * miss depending on intent. The CLI maps this to the generic
695
- * exit-2 "storage error" bucket, not the exit-3 "protocol
696
- * invariant" bucket.
697
- */
698
- | "NotFound"
699
- /**
700
- * Request body exceeded the server's size cap. HTTP server maps
701
- * to 413. Cap is `MAX_BODY_BYTES` (1 MiB today; exported from
702
- * `packages/server/src/http/router.ts`). The Node adapter
703
- * enforces during the `node:http` stream pump so the process
704
- * never materializes a multi-MiB body; Workers also rely on
705
- * platform-side caps (16 MB free / 100 MB paid).
706
- */
707
- | "PayloadTooLarge"
708
- /**
709
- * A predicate is structurally well-formed but contradicts itself —
710
- * no document can match. Emitted by `validateWire` and
711
- * `mergePredicateWires`. Triggers:
712
- * - `{ clauses: [{op:"in", field:"priority", value:[]}] }` (empty `in` set)
713
- * - an `eq` clause with a value outside the residual interval
714
- * established by range clauses on the same field
715
- * - merging `{op:"gt", value:10}` with `{op:"lt", value:5}` on the
716
- * same field (empty interval)
717
- * - merging two `in` clauses on the same field with empty intersection
718
- *
719
- * Conflicting equality across clauses (`eq:"open"` + `eq:"closed"` on
720
- * the same field) surfaces as `InvalidConfig` rather than this code —
721
- * the merger treats it as a caller-side configuration bug, not an
722
- * algebraic contradiction.
723
- *
724
- * The HTTP layer treats this as a 400 (caller error). The distinct
725
- * code lets downstream code short-circuit empty-by-construction
726
- * without re-running the validator or parsing messages.
727
- */
728
- | "UnsatisfiablePredicate"
729
- /**
730
- * A `useQuery` callback awaited a recorder terminal
731
- * (`.get`/`.first`/`.all`/`.count`). The recorder runs once per
732
- * render to capture the chain shape; it cannot survive an `await`
733
- * because the proxy doesn't proxy across microtask boundaries. The
734
- * recorder's terminal returns a thenable whose `.then` throws this
735
- * error synchronously, converting what would otherwise be a silent
736
- * spinner-hang into a render-time error the hook surfaces as
737
- * `status: "error"`. Companion `baerly/no-await-in-use-query` lint
738
- * flags the pattern at edit time. For compound reads, use
739
- * `Promise.all` (parallel) or compose two `useQuery` calls with
740
- * `useQuery.skip` (dependent).
741
- */
742
- | "UseQueryAwaitedRecorder"
743
- /**
744
- * A write method (`.insert`/`.update`/`.replace`/`.delete`) was
745
- * called on the recorder inside a `useQuery` callback. Writes
746
- * inside reads are a programming error; the recorder rejects them
747
- * synchronously from the discovery pass, before any I/O fires. Use
748
- * `useMutation()` instead.
749
- */
750
- | "UnexpectedWriteInQuery"
751
- /**
752
- * A `useMutation()` callback rejected with a non-`BaerlyError`
753
- * throwable. The hook wraps the original throw under this code so
754
- * the `error` slot is always a `BaerlyError`; the original value
755
- * is preserved on `.cause`.
756
- */
757
- | "MutationFailed";
758
- /**
759
- * The single error class thrown by Baerly. Discriminate by `code`, not
760
- * `instanceof`: the code string survives `JSON.stringify` round-trips
761
- * across Worker / iframe / postMessage realm boundaries, where each
762
- * realm has its own `BaerlyError` constructor identity. IDB-restored
763
- * writes can replay across realms, so `instanceof` would spuriously
764
- * fail on a structurally-identical error from another realm.
765
- *
766
- * @example
767
- * ```ts
768
- * try {
769
- * await db.collection("tickets").insert({ title: "hi" });
770
- * } catch (err) {
771
- * if (err instanceof BaerlyError && err.code === "Conflict") {
772
- * // ... CAS lost; retry
773
- * }
774
- * throw err;
775
- * }
776
- * ```
777
- */
778
- declare class BaerlyError extends Error {
779
- readonly code: BaerlyErrorCode;
780
- readonly cause?: unknown;
781
- /**
782
- * Structured field-path issues, set only when `code === "SchemaError"`.
783
- * Each entry's `path` is a dotted-key list (e.g. `["assignee", "team"]`
784
- * or `["items", 3, "qty"]`) that targets the offending field on the
785
- * input document. `message` is the validator-emitted human string.
786
- *
787
- * The HTTP layer's `mapError` renders these into the 400 body via
788
- * the existing `HttpErrorEnvelope`; older callers that don't know
789
- * about `issues` see a plain message-only error and stay correct.
790
- */
791
- readonly issues?: ReadonlyArray<{
792
- readonly path: ReadonlyArray<string | number>;
793
- readonly message: string;
794
- }>;
832
+ //#region packages/protocol/src/storage/memory.d.ts
833
+ /** Options for {@link MemoryStorage}. */
834
+ interface MemoryStorageOptions {
795
835
  /**
796
- * Raw HTTP status, set only by the client-side wire decoder when
797
- * inflating an `HttpErrorEnvelope` into this class. Server-side
798
- * throws never set it (the HTTP layer's `mapError` derives the
799
- * outbound status from `code`). Useful for diagnostics — e.g. to
800
- * distinguish 404-as-"no such row" from 404-as-"route not found".
801
- * Discriminate by `code` for behavior; reach for `status` only when
802
- * you genuinely need the wire value.
836
+ * Acknowledge the store is intentionally ephemeral — required to
837
+ * construct in a detected deployment ({@link isDeployedEnv}); ignored in
838
+ * dev/test. Env equivalent: `BAERLY_ALLOW_EPHEMERAL_STORAGE=true`.
803
839
  */
804
- readonly status?: number;
805
- constructor(code: BaerlyErrorCode, message: string, cause?: unknown, issues?: ReadonlyArray<{
806
- readonly path: ReadonlyArray<string | number>;
807
- readonly message: string;
808
- }>, status?: number);
840
+ ephemeral?: boolean;
809
841
  }
810
- //#endregion
811
- //#region packages/protocol/src/storage/memory.d.ts
812
842
  /**
813
843
  * In-memory `Storage`. The randomized property test runs against
814
844
  * this; it must be deterministic — no clocks beyond the caller's,
@@ -831,6 +861,7 @@ declare class BaerlyError extends Error {
831
861
  */
832
862
  declare class MemoryStorage implements Storage {
833
863
  #private;
864
+ constructor(opts?: MemoryStorageOptions);
834
865
  get(key: string, opts?: StorageGetOptions): Promise<StorageGetResult | null>;
835
866
  put(key: string, body: Uint8Array, opts?: StoragePutOptions): Promise<StoragePutResult>;
836
867
  delete(key: string, opts?: {
@@ -946,11 +977,13 @@ type Verifier = (req: Request) => Promise<VerifierResult | null>;
946
977
  /**
947
978
  * Debezium-style JSON CDC envelope using pgoutput's message-tag (`I`/`U`/`D`) vocabulary. One per mutation.
948
979
  *
949
- * **Pre-launch: the shape may still narrow.** Once the first production
950
- * consumer ships, this becomes a frozen migration contract behind
951
- * `baerly export --target=postgres` — the keys will be public, consumers
952
- * ack on `lsn`, and any rename / removal will be a major-version
953
- * migration.
980
+ * `LogEntry` is now a public, versionless/additive-only wire contract:
981
+ * 0.3.0 is the public early-access baseline. It is still pre-1.0 and
982
+ * soaking, so breaking changes remain possible, but only through an
983
+ * explicit compatibility decision, changelog/migration notes, and a
984
+ * versioned release. Assume external consumers may exist; do not
985
+ * silently rename, remove, or repurpose fields. Consumers must ignore
986
+ * unknown keys; new optional fields can be added in compatible releases.
954
987
  *
955
988
  * Field requirement matrix:
956
989
  * - Always: `lsn`, `commit_ts`, `op`, `collection`, `session`,
@@ -985,11 +1018,9 @@ interface LogEntry {
985
1018
  /** Insert / Update / Delete. */
986
1019
  op: "I" | "U" | "D";
987
1020
  /**
988
- * Collection name — the pgoutput RELATION analogue. Today derived
989
- * from the path segment immediately under the manifest prefix
990
- * (the part of `ref.key` before the first `/`); falls back to
991
- * `ref.bucket` for flat keys with no separator. The table API
992
- * makes collections first-class.
1021
+ * Collection name — the pgoutput RELATION analogue. Today this is
1022
+ * the collection bound to the `current.json` whose `tail_hint` minted
1023
+ * the entry. The table API makes collections first-class.
993
1024
  */
994
1025
  collection: string;
995
1026
  /**
@@ -1008,7 +1039,7 @@ interface LogEntry {
1008
1039
  before?: DocumentData;
1009
1040
  /**
1010
1041
  * Pre-image of the primary key. U/D always carry this when
1011
- * `replica_identity` is not `PATCH_ONLY`. (For Baerly today,
1042
+ * `replica_identity` is not `PATCH_ONLY`. (For baerly-storage today,
1012
1043
  * `_id` is the only PK.)
1013
1044
  */
1014
1045
  key_old?: {
@@ -1017,12 +1048,19 @@ interface LogEntry {
1017
1048
  /** ORIGIN analogue — the writer session id. */
1018
1049
  origin?: string;
1019
1050
  /**
1020
- * Causal metadata (Baerly-only; no pgoutput analogue). The
1051
+ * Causal metadata (baerly-storage-only; no pgoutput analogue). The
1021
1052
  * session id that built the `lsn`. Surfaces here so consumers
1022
1053
  * can dedupe / order without parsing the cursor.
1023
1054
  */
1024
1055
  session: string;
1025
- /** Per-session sequence number embedded in the `lsn`. */
1056
+ /**
1057
+ * The `log/<seq>` slot this entry occupies — the integer in its
1058
+ * `log/<seq>.json` key, minted by `Writer.commit` as the forward-probed
1059
+ * collection-log tail (the winning `If-None-Match: "*"` create). One
1060
+ * entry per `session`, so this is a per-collection slot, not a
1061
+ * per-session counter. Also encoded (descending base-32) as the LSN's
1062
+ * third segment — see `lsnParts`.
1063
+ */
1026
1064
  seq: number;
1027
1065
  }
1028
1066
  //#endregion
@@ -1041,7 +1079,7 @@ interface LogEntry {
1041
1079
  * stdout (one JSON object per HTTP request).
1042
1080
  *
1043
1081
  * **Naming convention** matches the load-bearing metrics:
1044
- * - `db.write.class_a_ops_per_logical_write` — histogram (p99 alert at 5).
1082
+ * - `db.write.class_a_ops_per_logical_write` — histogram (recommend p99 alert ~5; not gated).
1045
1083
  * Includes one Class A op per index PUT + index DELETE emitted
1046
1084
  * in the commit's fence. Idle-reader cost is unchanged.
1047
1085
  * - `db.r2.put.412_total` — counter (CAS conflict / If-Match-or-None-Match loss)
@@ -1070,5 +1108,5 @@ interface MetricsRecorder {
1070
1108
  histogram(name: string, value: number, labels?: Readonly<Record<string, string>>): void;
1071
1109
  }
1072
1110
  //#endregion
1073
- export { StorageGetResult as _, MemoryStorage as a, StoragePutResult as b, Collection as c, Query as d, PredicateArg as f, StorageGetOptions as g, Storage as h, VerifierResult as i, OrderSpec as l, CurrentJsonRead as m, LogEntry as n, BaerlyError as o, CurrentJson as p, Verifier as r, BaerlyErrorCode as s, MetricsRecorder as t, Predicate as u, StorageListEntry as v, StoragePutOptions as y };
1074
- //# sourceMappingURL=index-DSvwEUeF.d.ts.map
1111
+ export { StoragePutOptions as _, MemoryStorage as a, BaerlyErrorCode as b, Predicate as c, CurrentJson as d, CurrentJsonRead as f, StorageListEntry as g, StorageGetResult as h, VerifierResult as i, Query as l, StorageGetOptions as m, LogEntry as n, Collection as o, Storage as p, Verifier as r, OrderSpec as s, MetricsRecorder as t, PredicateArg as u, StoragePutResult as v, BaerlyError as y };
1112
+ //# sourceMappingURL=index-BYk9oCNf.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as CollectionNames, c as defineConfig, d as IndexDefinition, f as DocumentData, i as CollectionDefinition, l as SchemaIssue, n as BaerlyAppConfig, o as RowOf, r as BaerlyConfig, s as UnboundConfig, u as SchemaValidator } from "./app-config-C0Bbw_Z6.js";
2
- import { _ as StorageGetResult, a as MemoryStorage, b as StoragePutResult, c as Collection, d as Query, h as Storage, i as VerifierResult, o as BaerlyError, r as Verifier, s as BaerlyErrorCode, v as StorageListEntry } from "./index-DSvwEUeF.js";
3
- import { t as allIndexKeysFor } from "./indexes-DAu2AkTW.js";
4
- import { a as snapshotKey, i as loadSnapshotAsMap, n as SnapshotBody, o as resolveVerifier, r as encodeSnapshotBody, s as collectionsToMaps, t as walkLogRange } from "./index-cUY-36AN.js";
5
- import { n as validateOrThrow, t as Db } from "./db-BM3y2JQw.js";
6
- export { type BaerlyAppConfig, type BaerlyConfig, BaerlyError, type BaerlyErrorCode, type Collection, type CollectionDefinition, type CollectionNames, Db, type DocumentData, type IndexDefinition, MemoryStorage, type Query, type RowOf, type SchemaIssue, type SchemaValidator, type SnapshotBody, type Storage, type StorageGetResult, type StorageListEntry, type StoragePutResult, type UnboundConfig, type Verifier, type VerifierResult, allIndexKeysFor, collectionsToMaps, defineConfig, encodeSnapshotBody, loadSnapshotAsMap, resolveVerifier, snapshotKey, validateOrThrow, walkLogRange };
1
+ import { a as CollectionNames, c as defineConfig, d as IndexDefinition, f as DocumentData, i as CollectionDefinition, l as SchemaIssue, n as BaerlyAppConfig, o as RowOf, r as BaerlyConfig, s as UnboundConfig, u as SchemaValidator } from "./app-config-DyiFK3_k.js";
2
+ import { a as MemoryStorage, b as BaerlyErrorCode, c as Predicate, g as StorageListEntry, h as StorageGetResult, i as VerifierResult, l as Query, o as Collection, p as Storage, r as Verifier, u as PredicateArg, v as StoragePutResult, y as BaerlyError } from "./index-BYk9oCNf.js";
3
+ import { t as allIndexKeysFor } from "./indexes-Dn9hbGQG.js";
4
+ import { a as loadSnapshotAsMap, c as collectionsToMaps, i as encodeSnapshotBody, n as walkLogRange, o as snapshotKey, r as SnapshotBody, s as resolveVerifier, t as probeTailFrom } from "./index-BNRh23K9.js";
5
+ import { n as validateOrThrow, t as Db } from "./db-DsPkOVEH.js";
6
+ export { type BaerlyAppConfig, type BaerlyConfig, BaerlyError, type BaerlyErrorCode, type Collection, type CollectionDefinition, type CollectionNames, Db, type DocumentData, type IndexDefinition, MemoryStorage, type Predicate, type PredicateArg, type Query, type RowOf, type SchemaIssue, type SchemaValidator, type SnapshotBody, type Storage, type StorageGetResult, type StorageListEntry, type StoragePutResult, type UnboundConfig, type Verifier, type VerifierResult, allIndexKeysFor, collectionsToMaps, defineConfig, encodeSnapshotBody, loadSnapshotAsMap, probeTailFrom, resolveVerifier, snapshotKey, validateOrThrow, walkLogRange };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineConfig } from "./app-config.js";
2
- import { t as BaerlyError } from "./errors-DOdL95kK.js";
3
- import { d as loadSnapshotAsMap, f as snapshotKey, g as allIndexKeysFor, h as walkLogRange, u as encodeSnapshotBody } from "./maintenance-ClzBC1Vv.js";
4
- import { o as validateOrThrow } from "./query-BmiQy328.js";
5
- import { i as MemoryStorage, n as resolveVerifier, r as collectionsToMaps, t as Db } from "./src-zhEAmmF7.js";
6
- export { BaerlyError, Db, MemoryStorage, allIndexKeysFor, collectionsToMaps, defineConfig, encodeSnapshotBody, loadSnapshotAsMap, resolveVerifier, snapshotKey, validateOrThrow, walkLogRange };
2
+ import { t as BaerlyError } from "./errors-Dfa3p78c.js";
3
+ import { b as loadSnapshotAsMap, g as allIndexKeysFor, h as walkLogRange, w as probeTailFrom, x as snapshotKey, y as encodeSnapshotBody } from "./maintenance-B4Dki6Ig.js";
4
+ import { i as MemoryStorage, n as resolveVerifier, r as collectionsToMaps, t as Db } from "./src-CYHFDrKz.js";
5
+ import { o as validateOrThrow } from "./query-rAtXNQQB.js";
6
+ export { BaerlyError, Db, MemoryStorage, allIndexKeysFor, collectionsToMaps, defineConfig, encodeSnapshotBody, loadSnapshotAsMap, probeTailFrom, resolveVerifier, snapshotKey, validateOrThrow, walkLogRange };