@gusto/baerly-storage 0.1.0 → 0.1.1
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 +7 -4
- package/dist/API.md +102 -3
- package/dist/{app-config-Cb5dO2s9.d.ts → app-config-Dj_nGBfj.d.ts} +10 -1
- package/dist/app-config.d.ts +1 -1
- package/dist/app-config.js.map +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/{client-BLf3Ae5s.d.ts → client-CC5yVs1S.d.ts} +3 -3
- package/dist/client-react.d.ts +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/cloudflare.d.ts +4 -4
- package/dist/cloudflare.js +1 -1
- package/dist/{db-D62JguBc.d.ts → db-aRMK_0R0.d.ts} +3 -3
- package/dist/dev-vite.d.ts +3 -3
- package/dist/dev-vite.js +1 -1
- package/dist/dev.d.ts +1 -1
- package/dist/{http-CjUO1Bec.js → http-DeJEeUcO.js} +4 -4
- package/dist/{http-CjUO1Bec.js.map → http-DeJEeUcO.js.map} +1 -1
- package/dist/http.d.ts +6 -6
- package/dist/http.js +1 -1
- package/dist/{index-BGC-ENnj.d.ts → index-5lX_5NxZ.d.ts} +2 -2
- package/dist/{index-BquQkhJi.d.ts → index-DPaQhAro.d.ts} +2 -2
- package/dist/{index-BYv0hb8M.d.ts → index-m6pY8iRU.d.ts} +2 -2
- package/dist/{index-COsQ-Mlz.d.ts → index-spCBsIwm.d.ts} +3 -3
- package/dist/index.d.ts +5 -5
- package/dist/{indexes-DwOXkn1Y.d.ts → indexes-BIH73Uv4.d.ts} +2 -2
- package/dist/maintenance.d.ts +2 -2
- package/dist/node.d.ts +4 -4
- package/dist/node.js +1 -1
- package/dist/observability.d.ts +2 -2
- package/dist/{src-DyET_VPP.js → src-Cr9C7_tT.js} +2 -2
- package/dist/{src-DyET_VPP.js.map → src-Cr9C7_tT.js.map} +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
> _Currently a private Gusto preview, published as `@gusto/baerly-storage` to Gusto's private npm registry._
|
|
6
6
|
|
|
7
|
-
`baerly-storage` is a library that turns an S3-compatible bucket into a document database.
|
|
7
|
+
`baerly-storage` is a library that turns an S3-compatible bucket into a document database. **There is no runtime. None.** All coordination — fencing, commit, compaction, garbage collection — runs inside the HTTP request that triggered it: no daemon, no leader, no service bill, no on-call. The only persistent component is your bucket.
|
|
8
8
|
|
|
9
|
-
~100 KB gzipped on
|
|
9
|
+
Server bundle: ~100 KB gzipped on Cloudflare Workers, ~155 KB gzipped on Node. Browser client: ~5 KB gzipped. The whole public API fits in a single 850-line `dist/API.md` — small enough that an LLM can hold it in context.
|
|
10
10
|
|
|
11
|
-
[S3
|
|
11
|
+
[S3 does the hard parts](https://aws.amazon.com/blogs/aws/amazon-s3-update-strong-read-after-write-consistency/), `baerly-storage` is the coordination that fixes the API. Built like git: content-addressed documents, immutable log entries, and a single CAS-advanced pointer to HEAD. Document model, live queries, snapshot isolation — the whole surface in a `.d.ts` an LLM can use zero-shot.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Apps sized for this primitive — small, server-only writes, ~10 GB ceiling, mechanical exit to Postgres when they cross it — get a tool that matches their shape instead of a stack that doesn't.
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
Compute → FaaS
|
|
@@ -18,6 +18,8 @@ Tokens → LLM API
|
|
|
18
18
|
Storage → this.
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
Almost every team already has an S3-compatible bucket — for exports, backups, CSV graveyards. The security review happened years ago; the budget exists.
|
|
22
|
+
|
|
21
23
|
## The whole backend
|
|
22
24
|
|
|
23
25
|
```diff
|
|
@@ -66,6 +68,7 @@ const { rows } = useLiveQuery<Ticket>({
|
|
|
66
68
|
- **No hostage situation.** Log entries are shaped like Postgres
|
|
67
69
|
logical-replication messages. `baerly export --target=postgres`
|
|
68
70
|
graduates you out, mechanically, on the day an app outgrows this.
|
|
71
|
+
- **Honest about its envelope.** Sized for ~10 GB / tenant, ~30 writes/min/collection sustained, ~100 collections / tenant. Crossing any of those is the success signal to graduate.
|
|
69
72
|
|
|
70
73
|
## Quick start
|
|
71
74
|
|
package/dist/API.md
CHANGED
|
@@ -26,13 +26,19 @@ import {
|
|
|
26
26
|
MemoryStorage, // in-memory `Storage`; canonical for tests
|
|
27
27
|
type Collection, type Query,
|
|
28
28
|
type DocumentData,
|
|
29
|
+
type RowOf, type CollectionNames, // row-shape inference from a bound config
|
|
29
30
|
BaerlyError, type BaerlyErrorCode,
|
|
30
31
|
defineConfig, // narrower; root barrel
|
|
31
32
|
} from "@gusto/baerly-storage";
|
|
32
33
|
|
|
33
34
|
// Scaffold-aware config (`app`, `tenant`, `target`, `domain`, …)
|
|
34
|
-
import { defineConfig } from "@gusto/baerly-storage/config";
|
|
35
|
-
// → use this one inside `baerly.config.ts`.
|
|
35
|
+
import { defineConfig, type RowOf } from "@gusto/baerly-storage/config";
|
|
36
|
+
// → use this one inside `baerly.config.ts`. `RowOf` is exported here too
|
|
37
|
+
// so `baerly.config.ts` siblings (e.g. `types.ts`) can import the inferred
|
|
38
|
+
// row type without reaching into the server barrel.
|
|
39
|
+
|
|
40
|
+
// HTTP helpers — for embed-by-hand routers that don't mount `createRouter`
|
|
41
|
+
import { createRouter, mapError } from "@gusto/baerly-storage/http";
|
|
36
42
|
|
|
37
43
|
// Browser / Node client (HTTP)
|
|
38
44
|
import {
|
|
@@ -77,6 +83,14 @@ await db.collection("tickets").insert({ title: "first ticket", status: "open" })
|
|
|
77
83
|
const open = await db.collection("tickets").where({ status: "open" }).all();
|
|
78
84
|
```
|
|
79
85
|
|
|
86
|
+
**`MemoryStorage` is per-instance.** Each `new MemoryStorage()`
|
|
87
|
+
backs an independent in-process bucket — two `Db` instances built
|
|
88
|
+
against two `new MemoryStorage()`s see two empty, isolated stores.
|
|
89
|
+
This is what makes it the canonical test fixture: one fresh instance
|
|
90
|
+
per test gives a hermetic bucket without `beforeEach` cleanup. Pass
|
|
91
|
+
the *same* `MemoryStorage` instance to multiple `Db` constructors
|
|
92
|
+
when you want two writers contending on one bucket.
|
|
93
|
+
|
|
80
94
|
Full `Db.create` config:
|
|
81
95
|
|
|
82
96
|
```ts
|
|
@@ -88,6 +102,23 @@ Db.create<TConfig>({
|
|
|
88
102
|
});
|
|
89
103
|
```
|
|
90
104
|
|
|
105
|
+
**`Db<typeof config>` is a usable type.** `Db.create({ ..., config })`
|
|
106
|
+
returns `Db<typeof config>`, and that type is exported from the root
|
|
107
|
+
barrel — so a test or DI helper can pin it without inferring through
|
|
108
|
+
the factory call site:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import type { Db } from "@gusto/baerly-storage";
|
|
112
|
+
import type config from "./baerly.config";
|
|
113
|
+
|
|
114
|
+
let cached: Db<typeof config> | undefined;
|
|
115
|
+
export function setDbForTesting(db: Db<typeof config>) { cached = db; }
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The narrowed `Db<typeof config>` carries the same `collection(name)`
|
|
119
|
+
overloads as the inferred return; `Db` (no parameter) widens to
|
|
120
|
+
`Db<UnboundConfig>` and accepts any string collection name.
|
|
121
|
+
|
|
91
122
|
## `db.collection(name)` → `Collection<T>`
|
|
92
123
|
|
|
93
124
|
`Collection<T>` carries the common-case verbs directly (collection-level
|
|
@@ -232,6 +263,19 @@ Two ways to get a typed row:
|
|
|
232
263
|
`createBaerlyClient`. `db.collection("tickets")` returns
|
|
233
264
|
`Collection<RowOf<TConfig, "tickets">>`. No generic, no cast.
|
|
234
265
|
|
|
266
|
+
`RowOf<TConfig, "tickets">` is also a usable type when you need
|
|
267
|
+
to name the row shape outside the chain — route-handler return
|
|
268
|
+
types, response-schema bridges, helpers that take a row by hand:
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
import type { RowOf } from "@gusto/baerly-storage";
|
|
272
|
+
import type config from "./baerly.config";
|
|
273
|
+
|
|
274
|
+
type Ticket = RowOf<typeof config, "tickets">;
|
|
275
|
+
// ^ same shape as `db.collection("tickets").all()` row.
|
|
276
|
+
// `CollectionNames<typeof config>` is the union of valid names.
|
|
277
|
+
```
|
|
278
|
+
|
|
235
279
|
2. **Falls back to `DocumentData`** when no config is bound. Cast at
|
|
236
280
|
the construction site for a narrower row shape:
|
|
237
281
|
```ts
|
|
@@ -273,6 +317,39 @@ try {
|
|
|
273
317
|
| `PayloadTooLarge` | 413 | Body > 1 MiB cap |
|
|
274
318
|
| `UnsatisfiablePredicate` | 400 | Predicate is well-formed but contradicts itself (empty `in` set, etc.) |
|
|
275
319
|
|
|
320
|
+
### Mapping errors to HTTP yourself
|
|
321
|
+
|
|
322
|
+
`baerlyWorker` and `baerlyNode` already translate `BaerlyError` →
|
|
323
|
+
HTTP status + wire envelope; the table above is what they implement.
|
|
324
|
+
If you mount the kernel's router directly (`createRouter` from
|
|
325
|
+
`@gusto/baerly-storage/http`), you get the same translation for free
|
|
326
|
+
under `/v1/*`.
|
|
327
|
+
|
|
328
|
+
For an **embed-by-hand** router (your own Hono / Express / Fastify
|
|
329
|
+
app calling `Db` directly, layering custom routes on top), reach
|
|
330
|
+
for `mapError` from the same subpath — it consumes the table above
|
|
331
|
+
in one call and returns the envelope and status code, so handlers
|
|
332
|
+
don't grow a five-arm `if (err.code === ...)` ladder:
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
import { mapError } from "@gusto/baerly-storage/http";
|
|
336
|
+
|
|
337
|
+
app.post("/notes", async (c) => {
|
|
338
|
+
try {
|
|
339
|
+
const { _id } = await db.collection("notes").insert(await c.req.json());
|
|
340
|
+
return c.json({ _id }, 201);
|
|
341
|
+
} catch (err) {
|
|
342
|
+
const { status, envelope } = mapError(err);
|
|
343
|
+
return c.json(envelope, status);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
`mapError` accepts any thrown value — non-`BaerlyError` throws fall
|
|
349
|
+
through to `500 Internal` with the message redacted, and the
|
|
350
|
+
underlying error is logged via the observability channel. The HTTP
|
|
351
|
+
status / envelope shape is locked.
|
|
352
|
+
|
|
276
353
|
## `defineConfig({ app, tenant, target, collections })`
|
|
277
354
|
|
|
278
355
|
Scaffold-aware: lives at `@gusto/baerly-storage/config`. Holds both deploy
|
|
@@ -284,7 +361,7 @@ import { defineConfig } from "@gusto/baerly-storage/config";
|
|
|
284
361
|
import { z } from "zod";
|
|
285
362
|
|
|
286
363
|
const TicketSchema = z.object({
|
|
287
|
-
_id: z.string()
|
|
364
|
+
_id: z.string(), // required — see callout below
|
|
288
365
|
status: z.enum(["open", "closed"]),
|
|
289
366
|
title: z.string().min(1),
|
|
290
367
|
tags: z.array(z.string()).optional(),
|
|
@@ -309,6 +386,18 @@ post-image: `update` and `replace` see the full doc, not just the
|
|
|
309
386
|
patch. Failures → `BaerlyError{code:"SchemaError", issues:[…]}`,
|
|
310
387
|
mapped to HTTP 422.
|
|
311
388
|
|
|
389
|
+
**Author `_id` as required, not `.optional()`.** The validator runs
|
|
390
|
+
on the post-image — by the time it fires, the server has already
|
|
391
|
+
filled in a UUIDv7 `_id` for inserts that omit it, so every row the
|
|
392
|
+
validator sees has `_id` present. Declaring `_id: z.string()`
|
|
393
|
+
(required) matches that runtime invariant. `Collection<T>.insert`
|
|
394
|
+
still accepts a doc without `_id` (the public signature is
|
|
395
|
+
`insert(doc: Partial<T> & DocumentData)`), so authoring `_id` as
|
|
396
|
+
required does not break the "omit and let the server mint it" path.
|
|
397
|
+
The win is on the read side: `db.collection("tickets").all()` is
|
|
398
|
+
typed `Ticket[]` with `_id: string` (required), so route handlers
|
|
399
|
+
and response schemas don't need a parallel "_id-required" row type.
|
|
400
|
+
|
|
312
401
|
Indexes: declared here, threaded into `Db.create` automatically. The
|
|
313
402
|
read-path auto-planner picks an index when the predicate matches;
|
|
314
403
|
mismatches fall back to the full scan with a metric bump (correctness
|
|
@@ -521,6 +610,16 @@ custom `Verifier` on the factory) when you're ready to gate by wire
|
|
|
521
610
|
credentials. Production CF Worker recipes layer CF Access in front of
|
|
522
611
|
the Worker route; the verifier reads the resulting JWT:
|
|
523
612
|
|
|
613
|
+
**`auth` only gates the kernel's HTTP router.** `auth: "none"` /
|
|
614
|
+
`"shared-secret"` is read by `baerlyWorker` / `baerlyNode` / the
|
|
615
|
+
underlying `createRouter` — it controls who can hit `/v1/*`. If you
|
|
616
|
+
use `Db` directly (no `createRouter`, no `baerlyWorker`/`baerlyNode`,
|
|
617
|
+
e.g. server-internal jobs or your own Hono router), `auth` is
|
|
618
|
+
inert: every `Db.create` callsite already carries an explicit
|
|
619
|
+
`tenant:`, and your handler's own auth layer decides who reaches
|
|
620
|
+
the call. Set `auth: "none"` in the config to silence the typecheck
|
|
621
|
+
requirement in that case.
|
|
622
|
+
|
|
524
623
|
```ts
|
|
525
624
|
// baerly.config.ts
|
|
526
625
|
import { defineConfig } from "@gusto/baerly-storage/config";
|
|
@@ -304,6 +304,15 @@ interface BaerlyConfig {
|
|
|
304
304
|
* are set — this is the "dev default in config, prod override via
|
|
305
305
|
* env" recipe.
|
|
306
306
|
*
|
|
307
|
+
* **`auth` only gates the kernel's HTTP router.** It's consumed by
|
|
308
|
+
* `baerlyWorker` / `baerlyNode` / `createRouter` to decide who can
|
|
309
|
+
* hit `/v1/*`. If you use `Db` directly without mounting any of
|
|
310
|
+
* those (server-internal jobs, your own Hono/Express router, a CLI
|
|
311
|
+
* embedding the kernel), this field is inert — each `Db.create` call
|
|
312
|
+
* already carries an explicit `tenant:`, and your handler's own
|
|
313
|
+
* auth layer decides who reaches the call. Set `auth: "none"` to
|
|
314
|
+
* silence the typecheck requirement in that case.
|
|
315
|
+
*
|
|
307
316
|
* Field is required on `BaerlyAppConfig`. Omitting it causes both a
|
|
308
317
|
* TypeScript error at `defineConfig({...})` and (defensively) an
|
|
309
318
|
* `InvalidConfig` error at adapter module init.
|
|
@@ -477,4 +486,4 @@ type RowOf<C extends BaerlyConfig, N extends CollectionNames<C>> = C extends {
|
|
|
477
486
|
} ? S extends SchemaValidator<unknown, infer Out> ? Out : Record<string, unknown> : Record<string, unknown> : Record<string, unknown> : Record<string, unknown>;
|
|
478
487
|
//#endregion
|
|
479
488
|
export { CollectionNames as a, defineConfig as c, IndexDefinition as d, DocumentData as f, CollectionDefinition as i, SchemaIssue as l, JSONValue as m, BaerlyAppConfig as n, RowOf as o, DocumentValue as p, BaerlyConfig as r, UnboundConfig as s, AuthConfig as t, SchemaValidator as u };
|
|
480
|
-
//# sourceMappingURL=app-config-
|
|
489
|
+
//# sourceMappingURL=app-config-Dj_nGBfj.d.ts.map
|
package/dist/app-config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CollectionNames, c as defineConfig, f as DocumentData, i as CollectionDefinition, n as BaerlyAppConfig, o as RowOf, p as DocumentValue, r as BaerlyConfig, s as UnboundConfig, t as AuthConfig } from "./app-config-
|
|
1
|
+
import { a as CollectionNames, c as defineConfig, f as DocumentData, i as CollectionDefinition, n as BaerlyAppConfig, o as RowOf, p as DocumentValue, r as BaerlyConfig, s as UnboundConfig, t as AuthConfig } from "./app-config-Dj_nGBfj.js";
|
|
2
2
|
export { AuthConfig, BaerlyAppConfig, BaerlyConfig, CollectionDefinition, CollectionNames, type DocumentData, type DocumentValue, RowOf, UnboundConfig, defineConfig };
|
package/dist/app-config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-config.js","names":[],"sources":["../packages/protocol/src/app-config.ts"],"sourcesContent":["/**\n * Collection-config schema types + `defineConfig` identity helper.\n *\n * Lives in `@baerly/protocol` (the cross-platform package) so the\n * scaffold's `baerly.config.ts` and the client can reference these\n * types without transitively dragging Node-only server modules\n * (`AsyncLocalStorage` etc.) into their import graph.\n *\n * Runtime helpers that operate on these shapes —\n * `collectionsToMaps`, `validateIndexDefinition`, `validateOrThrow`\n * — stay in `@baerly/server`; they have impl detail that's allowed\n * to depend on Node-only modules.\n *\n * @see ./indexes.ts — `IndexDefinition` type.\n * @see ./schema.ts — `SchemaValidator` / `SchemaIssue` types.\n *\n * @example\n * ```ts\n * import { defineConfig } from \"@gusto/baerly-storage/config\";\n *\n * export default defineConfig({\n * app: \"tickets\",\n * tenant: \"acme\",\n * target: \"cloudflare\",\n * collections: {\n * tickets: {\n * indexes: [\n * { name: \"by_status\", on: \"status\" },\n * { name: \"by_assignee\", on: \"assignee\" },\n * ],\n * },\n * },\n * });\n * ```\n */\n\nimport type { AUTH_CONFIG_VALUES } from \"./constants.ts\";\nimport type { IndexDefinition } from \"./indexes.ts\";\nimport type { SchemaValidator } from \"./schema.ts\";\n\n// Cross-platform protocol types re-exported from `@gusto/baerly-storage/config`\n// so the scaffold's `baerly.config.ts` and its sibling `types.ts` can\n// pull every shape they need from one DOM-pure entry. `DocumentData`\n// is the row-shape constraint that scaffolded `interface Note extends\n// DocumentData {...}` declarations target; re-exporting here keeps the\n// example's typecheck graph from reaching into the server barrel.\nexport type { DocumentData, DocumentValue } from \"./json.ts\";\n\n/**\n * One collection's declarative config. Today `indexes` and `schema`\n * are consumed; future tickets add `replica_identity` and lifecycle\n * hooks.\n */\nexport interface CollectionDefinition {\n /**\n * Secondary indexes declared for this collection. Each declared\n * index produces one zero-byte PUT per commit (when the indexed\n * field is set on the doc) inside the same fence as the log\n * entry and content body. See `./indexes.ts` for the key shape.\n */\n readonly indexes?: ReadonlyArray<IndexDefinition>;\n /**\n * Optional schema for this collection. When set, every server-side\n * `insert` / `update` / `replace` validates the resulting post-image\n * before committing — invalid input throws\n * `BaerlyError{code:\"SchemaError\"}` carrying a `.issues` array of\n * `{ path, message }` entries.\n *\n * Adapter: StandardSchemaV1 (see `./schema.ts`). Compatible with\n * Zod 3.24+, Valibot 0.36+, ArkType 2.0+ today; any future library\n * implementing the spec works without a code change here.\n *\n * `undefined` means no validation — every write proceeds as today\n * (zero overhead, today's tests untouched).\n *\n * @remarks\n * **`.nullable()` is not supported.** baerly's `DocumentValue` excludes\n * `null` by design (see `packages/protocol/src/json.ts`). `null` is\n * reserved as the JSON-merge-patch (RFC 7386) field-deletion sentinel\n * in `update` patches. Use `.optional()` for absent values.\n *\n * Validation runs on the post-image: `update` and `replace` see the\n * full doc, not just the patch. Failures throw\n * `BaerlyError{ code: \"SchemaError\", issues: [...] }`.\n */\n readonly schema?: SchemaValidator;\n}\n\n/**\n * The full `baerly.config.ts` runtime shape. Re-exported from\n * `baerly-storage` and consumed by the day-1 `npm create baerly`\n * scaffold + the `baerly admin rebuild-index` CLI.\n */\nexport interface BaerlyConfig {\n /**\n * Per-collection declarations, keyed by collection name. Required\n * (declare `{}` when you have no collections yet) — this keeps the\n * config interface from being structurally empty, which would\n * trigger TypeScript's weak-type check when the adapter accepts\n * the literal as `BaerlyWorkerOptions.config` / `BaerlyNodeOptions.config`.\n */\n readonly collections: Readonly<Record<string, CollectionDefinition>>;\n}\n\n/**\n * Auth posture for the deployed app. REQUIRED on `BaerlyAppConfig`.\n *\n * - `\"none\"`: no header check; every request resolves to\n * `config.tenant`. Use for local dev, intranet deployments, CLI\n * tools — contexts where the network seam itself is the trust\n * boundary. The adapter logs one startup line so the state is not\n * silent.\n * - `\"shared-secret\"`: bearer-token check; the adapter reads\n * `SHARED_SECRET` from the runtime env and pins every request to\n * `config.tenant`. Module init throws `BaerlyError(\"InvalidConfig\", ...)`\n * on first `fetch` if the env var is missing/empty.\n *\n * For custom verifiers (Cloudflare Access, JWT, SigV4, …), pass a\n * `Verifier` directly to the adapter factory's `verifier:` option.\n * The factory `verifier:` silently overrides `config.auth` when both\n * are set — this is the \"dev default in config, prod override via\n * env\" recipe.\n *\n * Field is required on `BaerlyAppConfig`. Omitting it causes both a\n * TypeScript error at `defineConfig({...})` and (defensively) an\n * `InvalidConfig` error at adapter module init.\n *\n * The literal values come from\n * {@link AUTH_CONFIG_VALUES} so the runtime-only consumers (doctor,\n * adapter) share the same source of truth.\n */\nexport type AuthConfig = (typeof AUTH_CONFIG_VALUES)[number];\n\n/**\n * `BaerlyAppConfig` extends `BaerlyConfig` with scaffold-flavoured\n * deploy metadata (`target`, `domain`, `cloudflareAccess`, etc.).\n *\n * Exposed at `@gusto/baerly-storage/config`. Imported by the\n * `baerly.config.ts` that `npm create baerly` emits, and by anyone\n * who wants IDE/`tsgo` type inference on the full scaffold-aware\n * config shape on top of the runtime `BaerlyConfig.collections` map.\n *\n * One `baerly.config.ts` carries both scaffold metadata (consumed by\n * `baerly deploy` / `baerly doctor`) and the runtime schema\n * (consumed by `Db.create`). The literal-pinned return type of\n * {@link defineConfig} makes `collections` flow through to\n * `Db.create<TConfig>` and `createBaerlyClient<TConfig>`.\n */\nexport interface BaerlyAppConfig extends BaerlyConfig {\n /** Bucket-prefix for this baerly app. One bucket per app. */\n readonly app: string;\n /**\n * Default tenant pin for `Verifier`s that don't derive a tenant\n * from a claim. Production `Verifier`s (`bearerJwt`,\n * `cloudflareAccess`) ignore this and derive `tenantPrefix` from\n * the request.\n */\n readonly tenant: string;\n /**\n * Deploy target — `\"cloudflare\"` or `\"node\"`.\n * Read by `baerly deploy` to dispatch the correct deploy command.\n */\n readonly target: \"cloudflare\" | \"node\";\n /**\n * Optional. Custom domain for the deployed service. Cloudflare:\n * wired to the Worker as a route. Node: rendered into the\n * Dockerfile's `EXPOSE` and the emitted readme.\n */\n readonly domain?: string | undefined;\n /**\n * Names of secrets the deployed runtime needs. `baerly deploy`\n * and `baerly doctor` check each against the platform's secret\n * store and warn (deploy) / report (doctor) when missing.\n * Default treatment (when unset) is `[\"SHARED_SECRET\"]` — matches\n * the scaffolder's emitted Verifier wiring.\n */\n readonly requiredSecrets?: readonly string[];\n /**\n * Optional Cloudflare Access app config. When set, the production\n * CF template prefers `cloudflareAccess()` as the `Verifier` and\n * `baerly doctor --target=cloudflare` walks the CF Access app\n * config to confirm the audience tag matches.\n *\n * - `teamDomain` — CF Access team domain, e.g. `\"acme\"`.\n * - `audienceTag` — Application Audience (AUD) tag from the CF\n * Access app, 64 lowercase-hex characters.\n */\n readonly cloudflareAccess?: {\n readonly teamDomain: string;\n readonly audienceTag: string;\n };\n /**\n * Optional observability overrides. The templates already\n * read `LOG_LEVEL` from the runtime env; this field is a\n * typed-config alternative for deployments that prefer to pin\n * defaults in source. See `docs/guide/observability.md` for the\n * canonical-line shape and `docs/contributing/conventions/observability.md` for\n * the one-canonical-line-per-unit-of-work rule.\n *\n * - `level` — lowest record level reaching the sink. Falls back\n * to the `LOG_LEVEL` env var, then to `\"info\"`.\n */\n readonly observability?: {\n readonly level?: \"debug\" | \"info\" | \"warn\" | \"error\";\n };\n /**\n * Auth posture. See {@link AuthConfig} for the full per-value\n * semantics, the failure modes, and the \"dev default, prod override\"\n * recipe. Field is required — omission fails typecheck and (for\n * adapters that didn't supply a `verifier:` override) throws\n * `BaerlyError(\"InvalidConfig\", ...)` at first request.\n */\n readonly auth: AuthConfig;\n}\n\n/**\n * Identity helper that pins the config's TypeScript shape so IDEs\n * surface autocomplete and `tsgo --noEmit` catches typos at write\n * time. Returns its input verbatim — no runtime transformation.\n *\n * Two overloads: one for the scaffold-flavoured `BaerlyAppConfig`\n * (the shape `npm create baerly` emits, which carries `app`,\n * `tenant`, `target` deploy metadata) and one for the runtime\n * `BaerlyConfig` shape (just `collections`, used by tests and by\n * apps that wire deploy metadata in some other way). Both preserve\n * the literal shape of `cfg` via `<const C>` so `CollectionNames<C>`\n * and `RowOf<C, N>` resolve to literal unions.\n */\nexport function defineConfig<const C extends BaerlyAppConfig>(cfg: C): C;\nexport function defineConfig<const C extends BaerlyConfig>(cfg: C): C;\nexport function defineConfig<const C extends BaerlyConfig>(cfg: C): C {\n return cfg;\n}\n\n/**\n * Sentinel `BaerlyConfig` used as the default `TConfig` parameter\n * by consumers (`Db<TConfig>`, `BaerlyClient<TConfig>`). Setting\n * `collections` to `Record<string, CollectionDefinition>` makes\n * `CollectionNames<UnboundConfig>` widen to `string`, so the single\n * typed accessor `db.collection<N extends CollectionNames<TConfig>>(name: N)`\n * still resolves for kernel-internal paths (which carry no bound\n * config) — those callers see `name: string` and the row type\n * defaults to `DocumentData` via {@link RowOf}'s `Record<string, unknown>`\n * fallback. Consumers who bind a config via {@link defineConfig}\n * narrow `CollectionNames<TConfig>` to a literal union and lose the\n * string-typo accepting behaviour, which is the design intent.\n */\nexport type UnboundConfig = { readonly collections: Record<string, CollectionDefinition> };\n\n/**\n * Set of declared collection names on a `BaerlyConfig`, as a string\n * union. Resolves to `never` when no `collections` are declared\n * (notably for `UnboundConfig`), which the typed `Db` / client\n * overloads use to disable narrowing for unbound consumers.\n *\n * @example\n * ```ts\n * const config = defineConfig({\n * collections: {\n * tickets: { schema: TicketSchema },\n * audits: {},\n * },\n * });\n * type Names = CollectionNames<typeof config>; // \"tickets\" | \"audits\"\n * ```\n */\nexport type CollectionNames<C extends BaerlyConfig> = C extends {\n readonly collections: infer Cs;\n}\n ? Extract<keyof Cs, string>\n : never;\n\n/**\n * Row type for collection `N` on config `C`. Resolves to the\n * `StandardSchemaV1` output type of `C[\"collections\"][N][\"schema\"]`\n * when one is declared; otherwise falls back to\n * `Record<string, unknown>`.\n *\n * The fallback is intentionally wider than the protocol's\n * `DocumentData`. Downstream call sites that need\n * `DocumentData` (e.g. `Collection<T extends DocumentData>`)\n * apply the intersection at their own seam — keeping that\n * constraint local to the consumer keeps THIS file independent of\n * `@baerly/protocol/src/json.ts`.\n *\n * @example\n * ```ts\n * const config = defineConfig({\n * collections: {\n * tickets: { schema: TicketSchema },\n * audits: {},\n * },\n * });\n * type Ticket = RowOf<typeof config, \"tickets\">; // z.infer<typeof TicketSchema>\n * type Audit = RowOf<typeof config, \"audits\">; // Record<string, unknown>\n * ```\n */\nexport type RowOf<C extends BaerlyConfig, N extends CollectionNames<C>> = C extends {\n readonly collections: infer Cs;\n}\n ? N extends keyof Cs\n ? Cs[N] extends { readonly schema: infer S }\n ? S extends SchemaValidator<unknown, infer Out>\n ? Out\n : Record<string, unknown>\n : Record<string, unknown>\n : Record<string, unknown>\n : Record<string, unknown>;\n"],"mappings":";AAsOA,SAAgB,aAA2C,KAAW;CACpE,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"app-config.js","names":[],"sources":["../packages/protocol/src/app-config.ts"],"sourcesContent":["/**\n * Collection-config schema types + `defineConfig` identity helper.\n *\n * Lives in `@baerly/protocol` (the cross-platform package) so the\n * scaffold's `baerly.config.ts` and the client can reference these\n * types without transitively dragging Node-only server modules\n * (`AsyncLocalStorage` etc.) into their import graph.\n *\n * Runtime helpers that operate on these shapes —\n * `collectionsToMaps`, `validateIndexDefinition`, `validateOrThrow`\n * — stay in `@baerly/server`; they have impl detail that's allowed\n * to depend on Node-only modules.\n *\n * @see ./indexes.ts — `IndexDefinition` type.\n * @see ./schema.ts — `SchemaValidator` / `SchemaIssue` types.\n *\n * @example\n * ```ts\n * import { defineConfig } from \"@gusto/baerly-storage/config\";\n *\n * export default defineConfig({\n * app: \"tickets\",\n * tenant: \"acme\",\n * target: \"cloudflare\",\n * collections: {\n * tickets: {\n * indexes: [\n * { name: \"by_status\", on: \"status\" },\n * { name: \"by_assignee\", on: \"assignee\" },\n * ],\n * },\n * },\n * });\n * ```\n */\n\nimport type { AUTH_CONFIG_VALUES } from \"./constants.ts\";\nimport type { IndexDefinition } from \"./indexes.ts\";\nimport type { SchemaValidator } from \"./schema.ts\";\n\n// Cross-platform protocol types re-exported from `@gusto/baerly-storage/config`\n// so the scaffold's `baerly.config.ts` and its sibling `types.ts` can\n// pull every shape they need from one DOM-pure entry. `DocumentData`\n// is the row-shape constraint that scaffolded `interface Note extends\n// DocumentData {...}` declarations target; re-exporting here keeps the\n// example's typecheck graph from reaching into the server barrel.\nexport type { DocumentData, DocumentValue } from \"./json.ts\";\n\n/**\n * One collection's declarative config. Today `indexes` and `schema`\n * are consumed; future tickets add `replica_identity` and lifecycle\n * hooks.\n */\nexport interface CollectionDefinition {\n /**\n * Secondary indexes declared for this collection. Each declared\n * index produces one zero-byte PUT per commit (when the indexed\n * field is set on the doc) inside the same fence as the log\n * entry and content body. See `./indexes.ts` for the key shape.\n */\n readonly indexes?: ReadonlyArray<IndexDefinition>;\n /**\n * Optional schema for this collection. When set, every server-side\n * `insert` / `update` / `replace` validates the resulting post-image\n * before committing — invalid input throws\n * `BaerlyError{code:\"SchemaError\"}` carrying a `.issues` array of\n * `{ path, message }` entries.\n *\n * Adapter: StandardSchemaV1 (see `./schema.ts`). Compatible with\n * Zod 3.24+, Valibot 0.36+, ArkType 2.0+ today; any future library\n * implementing the spec works without a code change here.\n *\n * `undefined` means no validation — every write proceeds as today\n * (zero overhead, today's tests untouched).\n *\n * @remarks\n * **`.nullable()` is not supported.** baerly's `DocumentValue` excludes\n * `null` by design (see `packages/protocol/src/json.ts`). `null` is\n * reserved as the JSON-merge-patch (RFC 7386) field-deletion sentinel\n * in `update` patches. Use `.optional()` for absent values.\n *\n * Validation runs on the post-image: `update` and `replace` see the\n * full doc, not just the patch. Failures throw\n * `BaerlyError{ code: \"SchemaError\", issues: [...] }`.\n */\n readonly schema?: SchemaValidator;\n}\n\n/**\n * The full `baerly.config.ts` runtime shape. Re-exported from\n * `baerly-storage` and consumed by the day-1 `npm create baerly`\n * scaffold + the `baerly admin rebuild-index` CLI.\n */\nexport interface BaerlyConfig {\n /**\n * Per-collection declarations, keyed by collection name. Required\n * (declare `{}` when you have no collections yet) — this keeps the\n * config interface from being structurally empty, which would\n * trigger TypeScript's weak-type check when the adapter accepts\n * the literal as `BaerlyWorkerOptions.config` / `BaerlyNodeOptions.config`.\n */\n readonly collections: Readonly<Record<string, CollectionDefinition>>;\n}\n\n/**\n * Auth posture for the deployed app. REQUIRED on `BaerlyAppConfig`.\n *\n * - `\"none\"`: no header check; every request resolves to\n * `config.tenant`. Use for local dev, intranet deployments, CLI\n * tools — contexts where the network seam itself is the trust\n * boundary. The adapter logs one startup line so the state is not\n * silent.\n * - `\"shared-secret\"`: bearer-token check; the adapter reads\n * `SHARED_SECRET` from the runtime env and pins every request to\n * `config.tenant`. Module init throws `BaerlyError(\"InvalidConfig\", ...)`\n * on first `fetch` if the env var is missing/empty.\n *\n * For custom verifiers (Cloudflare Access, JWT, SigV4, …), pass a\n * `Verifier` directly to the adapter factory's `verifier:` option.\n * The factory `verifier:` silently overrides `config.auth` when both\n * are set — this is the \"dev default in config, prod override via\n * env\" recipe.\n *\n * **`auth` only gates the kernel's HTTP router.** It's consumed by\n * `baerlyWorker` / `baerlyNode` / `createRouter` to decide who can\n * hit `/v1/*`. If you use `Db` directly without mounting any of\n * those (server-internal jobs, your own Hono/Express router, a CLI\n * embedding the kernel), this field is inert — each `Db.create` call\n * already carries an explicit `tenant:`, and your handler's own\n * auth layer decides who reaches the call. Set `auth: \"none\"` to\n * silence the typecheck requirement in that case.\n *\n * Field is required on `BaerlyAppConfig`. Omitting it causes both a\n * TypeScript error at `defineConfig({...})` and (defensively) an\n * `InvalidConfig` error at adapter module init.\n *\n * The literal values come from\n * {@link AUTH_CONFIG_VALUES} so the runtime-only consumers (doctor,\n * adapter) share the same source of truth.\n */\nexport type AuthConfig = (typeof AUTH_CONFIG_VALUES)[number];\n\n/**\n * `BaerlyAppConfig` extends `BaerlyConfig` with scaffold-flavoured\n * deploy metadata (`target`, `domain`, `cloudflareAccess`, etc.).\n *\n * Exposed at `@gusto/baerly-storage/config`. Imported by the\n * `baerly.config.ts` that `npm create baerly` emits, and by anyone\n * who wants IDE/`tsgo` type inference on the full scaffold-aware\n * config shape on top of the runtime `BaerlyConfig.collections` map.\n *\n * One `baerly.config.ts` carries both scaffold metadata (consumed by\n * `baerly deploy` / `baerly doctor`) and the runtime schema\n * (consumed by `Db.create`). The literal-pinned return type of\n * {@link defineConfig} makes `collections` flow through to\n * `Db.create<TConfig>` and `createBaerlyClient<TConfig>`.\n */\nexport interface BaerlyAppConfig extends BaerlyConfig {\n /** Bucket-prefix for this baerly app. One bucket per app. */\n readonly app: string;\n /**\n * Default tenant pin for `Verifier`s that don't derive a tenant\n * from a claim. Production `Verifier`s (`bearerJwt`,\n * `cloudflareAccess`) ignore this and derive `tenantPrefix` from\n * the request.\n */\n readonly tenant: string;\n /**\n * Deploy target — `\"cloudflare\"` or `\"node\"`.\n * Read by `baerly deploy` to dispatch the correct deploy command.\n */\n readonly target: \"cloudflare\" | \"node\";\n /**\n * Optional. Custom domain for the deployed service. Cloudflare:\n * wired to the Worker as a route. Node: rendered into the\n * Dockerfile's `EXPOSE` and the emitted readme.\n */\n readonly domain?: string | undefined;\n /**\n * Names of secrets the deployed runtime needs. `baerly deploy`\n * and `baerly doctor` check each against the platform's secret\n * store and warn (deploy) / report (doctor) when missing.\n * Default treatment (when unset) is `[\"SHARED_SECRET\"]` — matches\n * the scaffolder's emitted Verifier wiring.\n */\n readonly requiredSecrets?: readonly string[];\n /**\n * Optional Cloudflare Access app config. When set, the production\n * CF template prefers `cloudflareAccess()` as the `Verifier` and\n * `baerly doctor --target=cloudflare` walks the CF Access app\n * config to confirm the audience tag matches.\n *\n * - `teamDomain` — CF Access team domain, e.g. `\"acme\"`.\n * - `audienceTag` — Application Audience (AUD) tag from the CF\n * Access app, 64 lowercase-hex characters.\n */\n readonly cloudflareAccess?: {\n readonly teamDomain: string;\n readonly audienceTag: string;\n };\n /**\n * Optional observability overrides. The templates already\n * read `LOG_LEVEL` from the runtime env; this field is a\n * typed-config alternative for deployments that prefer to pin\n * defaults in source. See `docs/guide/observability.md` for the\n * canonical-line shape and `docs/contributing/conventions/observability.md` for\n * the one-canonical-line-per-unit-of-work rule.\n *\n * - `level` — lowest record level reaching the sink. Falls back\n * to the `LOG_LEVEL` env var, then to `\"info\"`.\n */\n readonly observability?: {\n readonly level?: \"debug\" | \"info\" | \"warn\" | \"error\";\n };\n /**\n * Auth posture. See {@link AuthConfig} for the full per-value\n * semantics, the failure modes, and the \"dev default, prod override\"\n * recipe. Field is required — omission fails typecheck and (for\n * adapters that didn't supply a `verifier:` override) throws\n * `BaerlyError(\"InvalidConfig\", ...)` at first request.\n */\n readonly auth: AuthConfig;\n}\n\n/**\n * Identity helper that pins the config's TypeScript shape so IDEs\n * surface autocomplete and `tsgo --noEmit` catches typos at write\n * time. Returns its input verbatim — no runtime transformation.\n *\n * Two overloads: one for the scaffold-flavoured `BaerlyAppConfig`\n * (the shape `npm create baerly` emits, which carries `app`,\n * `tenant`, `target` deploy metadata) and one for the runtime\n * `BaerlyConfig` shape (just `collections`, used by tests and by\n * apps that wire deploy metadata in some other way). Both preserve\n * the literal shape of `cfg` via `<const C>` so `CollectionNames<C>`\n * and `RowOf<C, N>` resolve to literal unions.\n */\nexport function defineConfig<const C extends BaerlyAppConfig>(cfg: C): C;\nexport function defineConfig<const C extends BaerlyConfig>(cfg: C): C;\nexport function defineConfig<const C extends BaerlyConfig>(cfg: C): C {\n return cfg;\n}\n\n/**\n * Sentinel `BaerlyConfig` used as the default `TConfig` parameter\n * by consumers (`Db<TConfig>`, `BaerlyClient<TConfig>`). Setting\n * `collections` to `Record<string, CollectionDefinition>` makes\n * `CollectionNames<UnboundConfig>` widen to `string`, so the single\n * typed accessor `db.collection<N extends CollectionNames<TConfig>>(name: N)`\n * still resolves for kernel-internal paths (which carry no bound\n * config) — those callers see `name: string` and the row type\n * defaults to `DocumentData` via {@link RowOf}'s `Record<string, unknown>`\n * fallback. Consumers who bind a config via {@link defineConfig}\n * narrow `CollectionNames<TConfig>` to a literal union and lose the\n * string-typo accepting behaviour, which is the design intent.\n */\nexport type UnboundConfig = { readonly collections: Record<string, CollectionDefinition> };\n\n/**\n * Set of declared collection names on a `BaerlyConfig`, as a string\n * union. Resolves to `never` when no `collections` are declared\n * (notably for `UnboundConfig`), which the typed `Db` / client\n * overloads use to disable narrowing for unbound consumers.\n *\n * @example\n * ```ts\n * const config = defineConfig({\n * collections: {\n * tickets: { schema: TicketSchema },\n * audits: {},\n * },\n * });\n * type Names = CollectionNames<typeof config>; // \"tickets\" | \"audits\"\n * ```\n */\nexport type CollectionNames<C extends BaerlyConfig> = C extends {\n readonly collections: infer Cs;\n}\n ? Extract<keyof Cs, string>\n : never;\n\n/**\n * Row type for collection `N` on config `C`. Resolves to the\n * `StandardSchemaV1` output type of `C[\"collections\"][N][\"schema\"]`\n * when one is declared; otherwise falls back to\n * `Record<string, unknown>`.\n *\n * The fallback is intentionally wider than the protocol's\n * `DocumentData`. Downstream call sites that need\n * `DocumentData` (e.g. `Collection<T extends DocumentData>`)\n * apply the intersection at their own seam — keeping that\n * constraint local to the consumer keeps THIS file independent of\n * `@baerly/protocol/src/json.ts`.\n *\n * @example\n * ```ts\n * const config = defineConfig({\n * collections: {\n * tickets: { schema: TicketSchema },\n * audits: {},\n * },\n * });\n * type Ticket = RowOf<typeof config, \"tickets\">; // z.infer<typeof TicketSchema>\n * type Audit = RowOf<typeof config, \"audits\">; // Record<string, unknown>\n * ```\n */\nexport type RowOf<C extends BaerlyConfig, N extends CollectionNames<C>> = C extends {\n readonly collections: infer Cs;\n}\n ? N extends keyof Cs\n ? Cs[N] extends { readonly schema: infer S }\n ? S extends SchemaValidator<unknown, infer Out>\n ? Out\n : Record<string, unknown>\n : Record<string, unknown>\n : Record<string, unknown>\n : Record<string, unknown>;\n"],"mappings":";AA+OA,SAAgB,aAA2C,KAAW;CACpE,OAAO;AACT"}
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as CollectionNames, f as DocumentData, o as RowOf, r as BaerlyConfig, s as UnboundConfig } from "./app-config-
|
|
2
|
-
import { f as PredicateArg, l as OrderSpec } from "./index-
|
|
1
|
+
import { a as CollectionNames, f as DocumentData, o as RowOf, r as BaerlyConfig, s as UnboundConfig } from "./app-config-Dj_nGBfj.js";
|
|
2
|
+
import { f as PredicateArg, l as OrderSpec } from "./index-5lX_5NxZ.js";
|
|
3
3
|
|
|
4
4
|
//#region packages/client/src/request.d.ts
|
|
5
5
|
/**
|
|
@@ -230,4 +230,4 @@ interface BaerlyClient<TConfig extends BaerlyConfig = UnboundConfig> {
|
|
|
230
230
|
declare const createBaerlyClient: <TConfig extends BaerlyConfig = UnboundConfig>(options: BaerlyClientOptions<TConfig>) => BaerlyClient<TConfig>;
|
|
231
231
|
//#endregion
|
|
232
232
|
export { TerminalOptions as a, ClientQuery as i, BaerlyClientOptions as n, createBaerlyClient as o, ClientCollection as r, Fetcher as s, BaerlyClient as t };
|
|
233
|
-
//# sourceMappingURL=client-
|
|
233
|
+
//# sourceMappingURL=client-CC5yVs1S.d.ts.map
|
package/dist/client-react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as BaerlyConfig, s as UnboundConfig } from "./app-config-
|
|
2
|
-
import { o as BaerlyError } from "./index-
|
|
3
|
-
import { t as BaerlyClient } from "./client-
|
|
1
|
+
import { r as BaerlyConfig, s as UnboundConfig } from "./app-config-Dj_nGBfj.js";
|
|
2
|
+
import { o as BaerlyError } from "./index-5lX_5NxZ.js";
|
|
3
|
+
import { t as BaerlyClient } from "./client-CC5yVs1S.js";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
5
|
|
|
6
6
|
//#region packages/client/src/react/provider.d.ts
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as DocumentData } from "./app-config-
|
|
2
|
-
import { l as OrderSpec, n as LogEntry, o as BaerlyError, s as BaerlyErrorCode, u as Predicate } from "./index-
|
|
3
|
-
import { a as TerminalOptions, i as ClientQuery, n as BaerlyClientOptions, o as createBaerlyClient, r as ClientCollection, s as Fetcher, t as BaerlyClient } from "./client-
|
|
1
|
+
import { f as DocumentData } from "./app-config-Dj_nGBfj.js";
|
|
2
|
+
import { l as OrderSpec, n as LogEntry, o as BaerlyError, s as BaerlyErrorCode, u as Predicate } from "./index-5lX_5NxZ.js";
|
|
3
|
+
import { a as TerminalOptions, i as ClientQuery, n as BaerlyClientOptions, o as createBaerlyClient, r as ClientCollection, s as Fetcher, t as BaerlyClient } from "./client-CC5yVs1S.js";
|
|
4
4
|
export { type BaerlyClient, type BaerlyClientOptions, BaerlyError, type BaerlyErrorCode, type ClientCollection, type ClientQuery, type DocumentData, type Fetcher, type LogEntry, type OrderSpec, type Predicate, type TerminalOptions, createBaerlyClient };
|
package/dist/cloudflare.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as BaerlyAppConfig } from "./app-config-
|
|
2
|
-
import { m as Storage, r as Verifier } from "./index-
|
|
3
|
-
import { i as DevLandingOptions } from "./index-
|
|
4
|
-
import { d as ObservabilityConfig } from "./index-
|
|
1
|
+
import { n as BaerlyAppConfig } from "./app-config-Dj_nGBfj.js";
|
|
2
|
+
import { m as Storage, r as Verifier } from "./index-5lX_5NxZ.js";
|
|
3
|
+
import { i as DevLandingOptions } from "./index-DPaQhAro.js";
|
|
4
|
+
import { d as ObservabilityConfig } from "./index-m6pY8iRU.js";
|
|
5
5
|
|
|
6
6
|
//#region packages/adapter-cloudflare/src/r2-binding-storage.d.ts
|
|
7
7
|
/**
|
package/dist/cloudflare.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as BaerlyError } from "./errors-DOdL95kK.js";
|
|
2
2
|
import { n as resolveVerifier, t as Db } from "./src-Chafbw8r.js";
|
|
3
3
|
import { r as runWithContext, t as createObservabilityContext } from "./context-Oj7ffwD-.js";
|
|
4
|
-
import { n as createRouter } from "./http-
|
|
4
|
+
import { n as createRouter } from "./http-DeJEeUcO.js";
|
|
5
5
|
import { c as configureObservability, l as getLogger, n as flushCanonicalLine, o as deriveOutcome, r as flushUnauthorizedAndRespond, s as CATEGORY, t as observableStorage } from "./observability-2IDYRuZK.js";
|
|
6
6
|
import { r as renderDevLanding } from "./src-n0Te1r98.js";
|
|
7
7
|
//#region packages/adapter-cloudflare/src/r2-binding-storage.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as CollectionNames, d as IndexDefinition, f as DocumentData, o as RowOf, r as BaerlyConfig, s as UnboundConfig, u as SchemaValidator } from "./app-config-
|
|
2
|
-
import { c as Collection, m as Storage, n as LogEntry, p as CurrentJsonRead } from "./index-
|
|
1
|
+
import { a as CollectionNames, d as IndexDefinition, f as DocumentData, o as RowOf, r as BaerlyConfig, s as UnboundConfig, u as SchemaValidator } from "./app-config-Dj_nGBfj.js";
|
|
2
|
+
import { c as Collection, m as Storage, n as LogEntry, p as CurrentJsonRead } from "./index-5lX_5NxZ.js";
|
|
3
3
|
//#region packages/server/src/schema.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Run a validator and throw `BaerlyError{code:"SchemaError"}` on failure.
|
|
@@ -333,4 +333,4 @@ declare class Db<TConfig extends BaerlyConfig = UnboundConfig> {
|
|
|
333
333
|
}
|
|
334
334
|
//#endregion
|
|
335
335
|
export { validateOrThrow as n, Db as t };
|
|
336
|
-
//# sourceMappingURL=db-
|
|
336
|
+
//# sourceMappingURL=db-aRMK_0R0.d.ts.map
|
package/dist/dev-vite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as BaerlyAppConfig } from "./app-config-
|
|
2
|
-
import { r as Verifier } from "./index-
|
|
1
|
+
import { n as BaerlyAppConfig } from "./app-config-Dj_nGBfj.js";
|
|
2
|
+
import { r as Verifier } from "./index-5lX_5NxZ.js";
|
|
3
3
|
import { t as DevBannerHint } from "./dev-banner-CWHIk8tH.js";
|
|
4
|
-
import { t as Db } from "./db-
|
|
4
|
+
import { t as Db } from "./db-aRMK_0R0.js";
|
|
5
5
|
import { Plugin } from "vite";
|
|
6
6
|
|
|
7
7
|
//#region packages/dev/src/vite-plugin.d.ts
|
package/dist/dev-vite.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as resolveVerifier, t as Db } from "./src-Chafbw8r.js";
|
|
2
2
|
import { i as printDevBanner, n as ensureTable, t as LocalFsStorage } from "./src-n0Te1r98.js";
|
|
3
|
-
import { n as getRequestListener, t as baerlyNode } from "./src-
|
|
3
|
+
import { n as getRequestListener, t as baerlyNode } from "./src-Cr9C7_tT.js";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
//#region packages/dev/src/vite-plugin.ts
|
|
6
6
|
const isV1Path = (url) => url === "/v1" || url.startsWith("/v1/") || url.startsWith("/v1?");
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as DevBannerOpts, r as printDevBanner, t as DevBannerHint } from "./dev-banner-CWHIk8tH.js";
|
|
2
|
-
import { a as renderDevLanding, i as DevLandingOptions, n as LocalFsStorageOptions, r as ensureTable, t as LocalFsStorage } from "./index-
|
|
2
|
+
import { a as renderDevLanding, i as DevLandingOptions, n as LocalFsStorageOptions, r as ensureTable, t as LocalFsStorage } from "./index-DPaQhAro.js";
|
|
3
3
|
export { type DevBannerHint, type DevBannerOpts, type DevLandingOptions, LocalFsStorage, LocalFsStorageOptions, ensureTable, printDevBanner, renderDevLanding };
|
|
@@ -1695,9 +1695,9 @@ const ERROR_TO_STATUS = new Map([
|
|
|
1695
1695
|
* through to 500 by design — see the `NetworkError` / `InvalidResponse`
|
|
1696
1696
|
* / `Internal` comment in `ERROR_TO_STATUS`).
|
|
1697
1697
|
*
|
|
1698
|
-
*
|
|
1699
|
-
*
|
|
1700
|
-
*
|
|
1698
|
+
* Public via `@gusto/baerly-storage/http` for the embed-by-hand recipe
|
|
1699
|
+
* (your own Hono / Express / Fastify app calling `Db` directly).
|
|
1700
|
+
* The `HttpErrorEnvelope` shape is locked; do not mutate it.
|
|
1701
1701
|
*/
|
|
1702
1702
|
function mapError(err) {
|
|
1703
1703
|
if (err instanceof BaerlyError) return {
|
|
@@ -1753,4 +1753,4 @@ async function readJsonBody(c, maxBytes) {
|
|
|
1753
1753
|
//#endregion
|
|
1754
1754
|
export { longPollSince as a, listEventsSince as i, createRouter as n, Hono as o, mapError as r, MAX_BODY_BYTES as t };
|
|
1755
1755
|
|
|
1756
|
-
//# sourceMappingURL=http-
|
|
1756
|
+
//# sourceMappingURL=http-DeJEeUcO.js.map
|