@gusto/baerly-storage 0.1.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 (115) hide show
  1. package/README.md +97 -0
  2. package/dist/API.md +850 -0
  3. package/dist/app-config-Cb5dO2s9.d.ts +480 -0
  4. package/dist/app-config.d.ts +2 -0
  5. package/dist/app-config.js +8 -0
  6. package/dist/app-config.js.map +1 -0
  7. package/dist/auth.d.ts +237 -0
  8. package/dist/auth.js +1335 -0
  9. package/dist/auth.js.map +1 -0
  10. package/dist/baerly.js +761 -0
  11. package/dist/baerly.js.map +1 -0
  12. package/dist/bucket-uri-BrDEYvzy.js +4922 -0
  13. package/dist/bucket-uri-BrDEYvzy.js.map +1 -0
  14. package/dist/chunk-EAsCxrDo.js +14 -0
  15. package/dist/client-BLf3Ae5s.d.ts +233 -0
  16. package/dist/client-react.d.ts +131 -0
  17. package/dist/client-react.js +559 -0
  18. package/dist/client-react.js.map +1 -0
  19. package/dist/client.d.ts +4 -0
  20. package/dist/client.js +160 -0
  21. package/dist/client.js.map +1 -0
  22. package/dist/cloudflare-CINJPKCW.js +911 -0
  23. package/dist/cloudflare-CINJPKCW.js.map +1 -0
  24. package/dist/cloudflare.d.ts +211 -0
  25. package/dist/cloudflare.js +445 -0
  26. package/dist/cloudflare.js.map +1 -0
  27. package/dist/config-Bsg8wgwo.js +198 -0
  28. package/dist/config-Bsg8wgwo.js.map +1 -0
  29. package/dist/context-Oj7ffwD-.js +187 -0
  30. package/dist/context-Oj7ffwD-.js.map +1 -0
  31. package/dist/cost-B1WiZxlf.js +203 -0
  32. package/dist/cost-B1WiZxlf.js.map +1 -0
  33. package/dist/current-json-BkatBzF7.js +252 -0
  34. package/dist/current-json-BkatBzF7.js.map +1 -0
  35. package/dist/db-D62JguBc.d.ts +336 -0
  36. package/dist/deploy-BB-wqbhf.js +83 -0
  37. package/dist/deploy-BB-wqbhf.js.map +1 -0
  38. package/dist/dev-banner-CWHIk8tH.d.ts +26 -0
  39. package/dist/dev-vite.d.ts +146 -0
  40. package/dist/dev-vite.js +223 -0
  41. package/dist/dev-vite.js.map +1 -0
  42. package/dist/dev.d.ts +3 -0
  43. package/dist/dev.js +2 -0
  44. package/dist/doctor-B8h9GCN9.js +331 -0
  45. package/dist/doctor-B8h9GCN9.js.map +1 -0
  46. package/dist/dump-BHo_sIMZ.js +116 -0
  47. package/dist/dump-BHo_sIMZ.js.map +1 -0
  48. package/dist/errors-DOdL95kK.js +58 -0
  49. package/dist/errors-DOdL95kK.js.map +1 -0
  50. package/dist/export-Dz2PZKSR.js +423 -0
  51. package/dist/export-Dz2PZKSR.js.map +1 -0
  52. package/dist/fsck-DEz9lyCy.js +293 -0
  53. package/dist/fsck-DEz9lyCy.js.map +1 -0
  54. package/dist/http-CjUO1Bec.js +1756 -0
  55. package/dist/http-CjUO1Bec.js.map +1 -0
  56. package/dist/http.d.ts +1619 -0
  57. package/dist/http.js +2 -0
  58. package/dist/index-BGC-ENnj.d.ts +1065 -0
  59. package/dist/index-BYv0hb8M.d.ts +1457 -0
  60. package/dist/index-BquQkhJi.d.ts +112 -0
  61. package/dist/index-COsQ-Mlz.d.ts +146 -0
  62. package/dist/index.d.ts +6 -0
  63. package/dist/index.js +6 -0
  64. package/dist/indexes-BXn7a06a.js +297 -0
  65. package/dist/indexes-BXn7a06a.js.map +1 -0
  66. package/dist/indexes-DwOXkn1Y.d.ts +22 -0
  67. package/dist/inspect-x02aFWnh.js +149 -0
  68. package/dist/inspect-x02aFWnh.js.map +1 -0
  69. package/dist/log-walk-DIru96UT.js +260 -0
  70. package/dist/log-walk-DIru96UT.js.map +1 -0
  71. package/dist/maintenance-Bn6ul9aV.js +758 -0
  72. package/dist/maintenance-Bn6ul9aV.js.map +1 -0
  73. package/dist/maintenance.d.ts +323 -0
  74. package/dist/maintenance.js +2 -0
  75. package/dist/node.d.ts +422 -0
  76. package/dist/node.js +2 -0
  77. package/dist/normalize-XWY25_sG.js +133 -0
  78. package/dist/normalize-XWY25_sG.js.map +1 -0
  79. package/dist/observability-2IDYRuZK.js +2333 -0
  80. package/dist/observability-2IDYRuZK.js.map +1 -0
  81. package/dist/observability.d.ts +3 -0
  82. package/dist/observability.js +3 -0
  83. package/dist/plan-Cs17VqjU.js +224 -0
  84. package/dist/plan-Cs17VqjU.js.map +1 -0
  85. package/dist/query-DcSbFLJt.js +1880 -0
  86. package/dist/query-DcSbFLJt.js.map +1 -0
  87. package/dist/rebuild-index-C5gTXryd.js +119 -0
  88. package/dist/rebuild-index-C5gTXryd.js.map +1 -0
  89. package/dist/rebuild-index-DwXM0WfA.js +104 -0
  90. package/dist/rebuild-index-DwXM0WfA.js.map +1 -0
  91. package/dist/request-BEF_OvMh.js +72 -0
  92. package/dist/request-BEF_OvMh.js.map +1 -0
  93. package/dist/restore-CbKVMMpm.js +847 -0
  94. package/dist/restore-CbKVMMpm.js.map +1 -0
  95. package/dist/shared-secret-BJdSwpgw.js +71 -0
  96. package/dist/shared-secret-BJdSwpgw.js.map +1 -0
  97. package/dist/snapshot-D7C4_FSl.js +71 -0
  98. package/dist/snapshot-D7C4_FSl.js.map +1 -0
  99. package/dist/snapshot-z_N9hpTe.js +917 -0
  100. package/dist/snapshot-z_N9hpTe.js.map +1 -0
  101. package/dist/src-Chafbw8r.js +522 -0
  102. package/dist/src-Chafbw8r.js.map +1 -0
  103. package/dist/src-DyET_VPP.js +6199 -0
  104. package/dist/src-DyET_VPP.js.map +1 -0
  105. package/dist/src-n0Te1r98.js +352 -0
  106. package/dist/src-n0Te1r98.js.map +1 -0
  107. package/dist/subcommand-BWs6K7zb.js +110 -0
  108. package/dist/subcommand-BWs6K7zb.js.map +1 -0
  109. package/dist/usage-RVUQMLop.js +339 -0
  110. package/dist/usage-RVUQMLop.js.map +1 -0
  111. package/dist/validate-DhH1lO8I.js +377 -0
  112. package/dist/validate-DhH1lO8I.js.map +1 -0
  113. package/dist/wire-izfGZDvr.js +7 -0
  114. package/dist/wire-izfGZDvr.js.map +1 -0
  115. package/package.json +189 -0
package/dist/node.d.ts ADDED
@@ -0,0 +1,422 @@
1
+ import { n as BaerlyAppConfig } from "./app-config-Cb5dO2s9.js";
2
+ import { _ as StorageListEntry, g as StorageGetResult, h as StorageGetOptions, m as Storage, r as Verifier, v as StoragePutOptions, y as StoragePutResult } from "./index-BGC-ENnj.js";
3
+ import { i as DevLandingOptions } from "./index-BquQkhJi.js";
4
+ import { d as ObservabilityConfig } from "./index-BYv0hb8M.js";
5
+
6
+ //#region packages/adapter-node/src/s3-http.d.ts
7
+ /**
8
+ * Construction-time options for {@link S3HttpStorage}. Everything is
9
+ * optional except `endpoint` and `bucket`; the consumer chooses how
10
+ * to satisfy `fetch` (browser/Node global vs. injected) and `sign`
11
+ * (anonymous Minio vs. SigV4-signed via aws4fetch).
12
+ */
13
+ interface S3HttpStorageOptions {
14
+ /**
15
+ * S3 endpoint URL, e.g. `https://s3.us-east-1.amazonaws.com` or
16
+ * `http://127.0.0.1:9102` (Minio). Trailing slashes are trimmed.
17
+ */
18
+ endpoint: string;
19
+ /** S3 bucket name. */
20
+ bucket: string;
21
+ /**
22
+ * `fetch` implementation. Defaults to `globalThis.fetch.bind(globalThis)`.
23
+ * Tests pass a `vi.fn()` stub.
24
+ */
25
+ fetch?: typeof fetch;
26
+ /**
27
+ * Signs requests before send. Pass `undefined` for anonymous
28
+ * (Minio without creds). The seam is `(req) => Promise<req>` so
29
+ * SigV4 implementations like `aws4fetch.AwsClient.sign` plug in
30
+ * directly.
31
+ */
32
+ sign?: (req: Request) => Promise<Request>;
33
+ /** Max retries for transient (non-permanent) failures. */
34
+ retries?: number;
35
+ /** Initial backoff in ms. */
36
+ backoffMs?: number;
37
+ }
38
+ /**
39
+ * `Storage` impl that speaks the S3 REST API directly. Works against
40
+ * any S3-compatible endpoint — AWS S3, R2 (S3-compat), GCS (S3-compat),
41
+ * Minio. Does not depend on any AWS SDK.
42
+ *
43
+ * Authentication is plugged in via the `sign` callback; this class
44
+ * itself does no SigV4. For Cloudflare Workers, the R2 binding fast
45
+ * path lives in `@baerly/adapter-cloudflare`.
46
+ */
47
+ declare class S3HttpStorage implements Storage {
48
+ #private;
49
+ constructor(options: S3HttpStorageOptions);
50
+ get(key: string, opts?: StorageGetOptions): Promise<StorageGetResult | null>;
51
+ put(key: string, body: Uint8Array, opts?: StoragePutOptions): Promise<StoragePutResult>;
52
+ delete(key: string, opts?: {
53
+ signal?: AbortSignal;
54
+ }): Promise<void>;
55
+ list(prefix: string, opts?: {
56
+ startAfter?: string;
57
+ maxKeys?: number;
58
+ signal?: AbortSignal;
59
+ }): AsyncIterable<StorageListEntry>;
60
+ }
61
+ //#endregion
62
+ //#region packages/adapter-node/src/server.d.ts
63
+ /**
64
+ * Options for {@link runMaintenanceTick}.
65
+ */
66
+ interface NodeMaintenanceOptions {
67
+ /** Any {@link Storage} impl — `S3HttpStorage`, `LocalFsStorage`, etc. */
68
+ readonly storage: Storage;
69
+ /** Full bucket-relative key of the CAS pointer for the target collection. */
70
+ readonly currentJsonKey: string;
71
+ /** Forwarded to both `compact()` and `runGc()` underneath. */
72
+ readonly signal?: AbortSignal;
73
+ }
74
+ /**
75
+ * Run one pass of compaction + GC for one collection. Node hosts have
76
+ * no subrequest cap, so this uses the engine defaults (unbounded) —
77
+ * a single pass folds the entire live tail and sweeps every aged-out
78
+ * candidate.
79
+ *
80
+ * Pair with `node-cron`, systemd timers, or k8s CronJobs — this
81
+ * function is a single-shot callable that does not loop. Errors
82
+ * propagate; the caller decides retry semantics.
83
+ *
84
+ * `compact()` and `runGc()` are each CAS-protected single-attempts:
85
+ * a crash or restart between phases is safe because the next tick
86
+ * picks up where the previous one left off.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * import cron from "node-cron";
91
+ * import { runMaintenanceTick } from "@gusto/baerly-storage/node";
92
+ *
93
+ * cron.schedule("0 * * * *", async () => { // hourly
94
+ * await runMaintenanceTick({ storage, currentJsonKey: "..." });
95
+ * });
96
+ * ```
97
+ */
98
+ declare const runMaintenanceTick: (opts: NodeMaintenanceOptions) => Promise<void>;
99
+ //#endregion
100
+ //#region packages/adapter-node/src/credentials/types.d.ts
101
+ /**
102
+ * Temporary or static AWS-shaped credentials. Field shape matches
103
+ * `@smithy/types`' `AwsCredentialIdentity` so callers can pass
104
+ * `@aws-sdk/credential-providers` output directly (e.g.
105
+ * `fromTokenFile()`) without an adapter.
106
+ *
107
+ * `expiration` is the absolute time at which `accessKeyId` /
108
+ * `secretAccessKey` / `sessionToken` stop being valid. When present,
109
+ * the signing layer re-resolves credentials some buffer before that
110
+ * time. When absent, credentials are treated as static.
111
+ */
112
+ type Credentials = {
113
+ readonly accessKeyId: string;
114
+ readonly secretAccessKey: string;
115
+ readonly sessionToken?: string;
116
+ readonly expiration?: Date;
117
+ };
118
+ /**
119
+ * Async credential resolver. Called by the signing layer on demand —
120
+ * once on first sign, then again when cached `expiration` is within
121
+ * the refresh buffer. Closure is the natural place to keep retry /
122
+ * fallback / fan-out logic; the signing layer only cares about the
123
+ * resolved shape.
124
+ *
125
+ * **Refresh is driven by `Credentials.expiration`.** If your provider
126
+ * returns no `expiration`, the signer will call this function
127
+ * **exactly once** for the lifetime of the storage handle and reuse
128
+ * those credentials forever. That's the right default for genuinely
129
+ * static creds (e.g. `process.env`), but it's a footgun if you're
130
+ * resolving rotating credentials and forgot to set `expiration` —
131
+ * the first 1 h works, then every request 403s with no retry. Set
132
+ * `expiration` on every refresh-eligible resolve.
133
+ *
134
+ * Implementations should be safe to call concurrently — the signing
135
+ * layer single-flights refresh, but tests and chained providers may
136
+ * call this in parallel.
137
+ */
138
+ type CredentialsProvider = () => Promise<Credentials>;
139
+ //#endregion
140
+ //#region packages/adapter-node/src/storage-factories.d.ts
141
+ /**
142
+ * AWS S3 `Storage` factory. Wraps `S3HttpStorage` with the standard
143
+ * `aws4fetch` SigV4 signer. The endpoint is derived from the region as
144
+ * `https://s3.<region>.amazonaws.com`.
145
+ *
146
+ * @example Static credentials
147
+ * ```ts
148
+ * import { s3Storage } from "@gusto/baerly-storage/node";
149
+ *
150
+ * const storage = s3Storage({
151
+ * region: process.env["AWS_REGION"] ?? "us-east-1",
152
+ * bucket: process.env["BUCKET"]!,
153
+ * credentials: {
154
+ * accessKeyId: process.env["AWS_ACCESS_KEY_ID"]!,
155
+ * secretAccessKey: process.env["AWS_SECRET_ACCESS_KEY"]!,
156
+ * },
157
+ * });
158
+ * ```
159
+ *
160
+ * @example EKS Pod Identity (refreshing)
161
+ * ```ts
162
+ * import { s3Storage, fromEksPodIdentity } from "@gusto/baerly-storage/node";
163
+ *
164
+ * const storage = s3Storage({
165
+ * region: process.env["AWS_REGION"] ?? "us-east-1",
166
+ * bucket: process.env["BUCKET"]!,
167
+ * credentials: fromEksPodIdentity(),
168
+ * });
169
+ * ```
170
+ */
171
+ declare function s3Storage(opts: {
172
+ region: string;
173
+ bucket: string;
174
+ credentials: Credentials | CredentialsProvider;
175
+ }): Storage;
176
+ /**
177
+ * Cloudflare R2 `Storage` factory (S3-compat endpoint). Derives the
178
+ * endpoint from `accountId` as
179
+ * `https://<accountId>.r2.cloudflarestorage.com` and pins region
180
+ * `"auto"` — R2 ignores region but `aws4fetch`'s signer requires
181
+ * the field to be set.
182
+ *
183
+ * For Workers that have a native R2 binding (no HTTP hop), see
184
+ * `r2BindingStorage` in `@baerly/adapter-cloudflare`. This factory
185
+ * is for Node hosts that talk to R2 over its public S3-compat URL.
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * import { r2Storage } from "@gusto/baerly-storage/node";
190
+ *
191
+ * const storage = r2Storage({
192
+ * accountId: process.env["R2_ACCOUNT_ID"]!,
193
+ * bucket: process.env["BUCKET"]!,
194
+ * credentials: {
195
+ * accessKeyId: process.env["AWS_ACCESS_KEY_ID"]!,
196
+ * secretAccessKey: process.env["AWS_SECRET_ACCESS_KEY"]!,
197
+ * },
198
+ * });
199
+ * ```
200
+ */
201
+ declare function r2Storage(opts: {
202
+ accountId: string;
203
+ bucket: string;
204
+ credentials: Credentials | CredentialsProvider;
205
+ }): Storage;
206
+ /**
207
+ * Minio `Storage` factory — for local-dev / self-hosted S3-compat.
208
+ * Endpoint is fully caller-supplied (e.g. `http://localhost:9102`)
209
+ * because Minio deployments don't follow a URL template. Region is
210
+ * pinned to `"us-east-1"`; Minio ignores it but `aws4fetch` requires
211
+ * a value.
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * import { minioStorage } from "@gusto/baerly-storage/node";
216
+ *
217
+ * const storage = minioStorage({
218
+ * endpoint: process.env["BAERLY_S3_ENDPOINT"] ?? "http://localhost:9102",
219
+ * bucket: "baerly",
220
+ * credentials: {
221
+ * accessKeyId: process.env["MINIO_ACCESS_KEY"]!,
222
+ * secretAccessKey: process.env["MINIO_SECRET_KEY"]!,
223
+ * },
224
+ * });
225
+ * ```
226
+ */
227
+ declare function minioStorage(opts: {
228
+ endpoint: string;
229
+ bucket: string;
230
+ credentials: Credentials | CredentialsProvider;
231
+ }): Storage;
232
+ /**
233
+ * Google Cloud Storage `Storage` factory via the S3-compat endpoint
234
+ * at `https://storage.googleapis.com`. Authentication uses GCS HMAC
235
+ * keys (Console → Settings → Interoperability) — the HMAC access key
236
+ * goes into `credentials.accessKeyId` and the HMAC secret goes into
237
+ * `credentials.secretAccessKey`. Region is pinned to `"auto"`.
238
+ *
239
+ * GCS's S3-compat surface supports the four `Storage` methods
240
+ * (`get`/`put`/`delete`/`list`) but not all of S3's optional
241
+ * features — stick to the kernel surface and you're fine.
242
+ *
243
+ * @example
244
+ * ```ts
245
+ * import { gcsStorage } from "@gusto/baerly-storage/node";
246
+ *
247
+ * const storage = gcsStorage({
248
+ * bucket: process.env["BUCKET"]!,
249
+ * credentials: {
250
+ * accessKeyId: process.env["GCS_HMAC_ACCESS_KEY_ID"]!,
251
+ * secretAccessKey: process.env["GCS_HMAC_SECRET"]!,
252
+ * },
253
+ * });
254
+ * ```
255
+ */
256
+ declare function gcsStorage(opts: {
257
+ bucket: string;
258
+ credentials: Credentials | CredentialsProvider;
259
+ }): Storage;
260
+ //#endregion
261
+ //#region packages/adapter-node/src/credentials/from-eks-pod-identity.d.ts
262
+ /**
263
+ * Resolve AWS credentials from the EKS Pod Identity agent (the 2023
264
+ * successor to IRSA). The agent runs on each EKS node and exchanges
265
+ * the pod's projected service-account token for short-lived AWS
266
+ * credentials, so the app just reads the token and asks the agent.
267
+ *
268
+ * Env vars (set by EKS when the pod has an associated IAM role):
269
+ * - `AWS_CONTAINER_CREDENTIALS_FULL_URI` — the agent endpoint
270
+ * (typically `http://169.254.170.23/v1/credentials`).
271
+ * - `AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE` — path to the
272
+ * projected SA token used to authorize the agent request.
273
+ *
274
+ * Both are required. Agent should respond instantly on the node-local
275
+ * link — 2 s timeout protects against hangs.
276
+ */
277
+ declare function fromEksPodIdentity(opts?: {
278
+ fetch?: typeof fetch;
279
+ readFile?: (path: string, encoding: "utf8") => Promise<string>;
280
+ }): CredentialsProvider;
281
+ //#endregion
282
+ //#region packages/adapter-node/src/baerly-node.d.ts
283
+ /**
284
+ * Multi-collection maintenance schedule. Each tick spawns one
285
+ * {@link runMaintenanceTick} call per `(tenant, collection)` pair. The
286
+ * cross-product is computed once at startup; deletions / additions
287
+ * at runtime require restarting the process.
288
+ *
289
+ * `intervalMs` defaults to one hour, matching the per-template
290
+ * `setInterval` cadence the helper replaces.
291
+ */
292
+ interface BaerlyNodeMaintenance {
293
+ readonly collections: readonly string[];
294
+ readonly tenants: readonly string[];
295
+ readonly intervalMs?: number;
296
+ }
297
+ /**
298
+ * Options for {@link baerlyNode}. Composes the {@link createApp}
299
+ * surface (same `app` / `storage` / `verifier` / `webRoot` / etc.)
300
+ * with optional maintenance scheduling and a `node:http` server
301
+ * lifecycle (`listen` / `close` + SIGTERM/SIGINT handling).
302
+ *
303
+ * Mirrors `baerlyWorker` in `@baerly/adapter-cloudflare`.
304
+ */
305
+ interface BaerlyNodeOptions {
306
+ /**
307
+ * Your `baerly.config.ts`. **Required.** Carries `auth`, `tenant`,
308
+ * `app`, and the declared `collections` (their schemas/indexes flow
309
+ * through to per-request `Db.create` automatically).
310
+ *
311
+ * The adapter resolves the per-request `Verifier` from
312
+ * `config.auth` when no `verifier:` override is supplied — see
313
+ * resolution order on {@link verifier} below. Only
314
+ * `app` / `tenant` / `auth` / `collections` are read for runtime
315
+ * kernel wiring; deploy-time fields (`target`, `domain`,
316
+ * `requiredSecrets`) are ignored here.
317
+ */
318
+ readonly config: BaerlyAppConfig;
319
+ readonly storage: Storage;
320
+ /**
321
+ * Per-request `Verifier`. **Optional.** When set, overrides
322
+ * `config.auth` (the "dev default in config, prod override via env"
323
+ * recipe). When unset, the adapter synthesizes one from
324
+ * `config.auth`:
325
+ *
326
+ * - `"shared-secret"` → `sharedSecret({ secret:
327
+ * process.env.SHARED_SECRET, tenantPrefix: config.tenant })`.
328
+ * Throws `BaerlyError("InvalidConfig", ...)` at factory time
329
+ * when `SHARED_SECRET` is missing/empty (Node can throw at
330
+ * startup unlike CF Workers).
331
+ * - `"none"` → pins every request to `config.tenant` with no
332
+ * header check.
333
+ *
334
+ * `GET /v1/healthz` always bypasses the verifier.
335
+ */
336
+ readonly verifier?: Verifier;
337
+ readonly observability?: ObservabilityConfig;
338
+ readonly dev?: DevLandingOptions;
339
+ readonly webRoot?: string;
340
+ readonly sinceTimeoutMs?: number;
341
+ readonly sincePollIntervalMs?: number;
342
+ /**
343
+ * Multi-collection maintenance schedule. Each tick fires one
344
+ * {@link runMaintenanceTick} per `(tenant, collection)` pair. Omit
345
+ * to skip the in-process maintenance loop (operator wires their own
346
+ * scheduler — k8s CronJob, systemd timer, etc).
347
+ */
348
+ readonly maintenance?: BaerlyNodeMaintenance;
349
+ }
350
+ /**
351
+ * Handle returned by {@link baerlyNode}. Composes a running
352
+ * `node:http` server lifecycle.
353
+ *
354
+ * - `fetch(request)` is the web-standard request handler. Use
355
+ * directly for in-process embedding (Vite middleware via
356
+ * `@hono/node-server.getRequestListener`, custom servers, tests).
357
+ * Calling `fetch` does not start the `node:http` server; the
358
+ * server lifecycle is owned by `listen(port)` / `close()`.
359
+ * Hono's optional `env`/`executionCtx` parameters are intentionally
360
+ * omitted from the signature — this is a Node-host handle, and
361
+ * those parameters are Workers-only.
362
+ * - `listen(port)` binds the server, installs SIGTERM/SIGINT
363
+ * handlers that call `close()` and exit `0`, and resolves once
364
+ * the server is actually listening (after Node's `'listening'`
365
+ * event fires). Throws on `'error'` from the server.
366
+ * - `close()` closes the server, clears the maintenance interval,
367
+ * and removes the signal handlers. Resolves once `Server.close`
368
+ * callback fires. Safe to call multiple times.
369
+ */
370
+ interface BaerlyNodeHandle {
371
+ readonly fetch: (request: Request) => Response | Promise<Response>;
372
+ listen(port: number): Promise<void>;
373
+ close(): Promise<void>;
374
+ }
375
+ /**
376
+ * Mount baerly on `node:http` with one call. Mirrors `baerlyWorker`
377
+ * from `@baerly/adapter-cloudflare`.
378
+ *
379
+ * Composes:
380
+ * - {@link createApp} → exposed as `handle.fetch` for in-process
381
+ * embedding; wrapped in `@hono/node-server.serve({ fetch, createServer })`
382
+ * lazily when `listen()` is called.
383
+ * - Optional maintenance loop: each `intervalMs` tick fires one
384
+ * {@link runMaintenanceTick} per `(tenant, collection)` pair
385
+ * (cross-product of `opts.maintenance.tenants` × `.collections`).
386
+ * The `currentJsonKey` is composed as
387
+ * `app/<app>/tenant/<tenant>/manifests/<collection>/current.json` —
388
+ * the canonical layout from the sync protocol.
389
+ * - SIGTERM + SIGINT handlers installed on `listen()` that call
390
+ * `close()` and `process.exit(0)`. On any error during close,
391
+ * `process.exit(1)`.
392
+ *
393
+ * Failures in a single `(tenant, collection)` maintenance tick log to
394
+ * stderr but do not block sibling pairs and do not crash the process —
395
+ * a transient storage hiccup must not take the whole server down.
396
+ *
397
+ * @example
398
+ * ```ts
399
+ * import { baerlyNode, s3Storage } from "@gusto/baerly-storage/node";
400
+ * import config from "./baerly.config.ts";
401
+ *
402
+ * const handle = baerlyNode({
403
+ * config,
404
+ * storage: s3Storage({
405
+ * region: "us-east-1",
406
+ * bucket: process.env["BUCKET"]!,
407
+ * credentials: {
408
+ * accessKeyId: process.env["AWS_ACCESS_KEY_ID"]!,
409
+ * secretAccessKey: process.env["AWS_SECRET_ACCESS_KEY"]!,
410
+ * },
411
+ * }),
412
+ * // No verifier needed when config.auth is "none" or "shared-secret".
413
+ * webRoot: "./dist/client",
414
+ * maintenance: { collections: ["tickets", "comments"], tenants: ["acme"] },
415
+ * });
416
+ * await handle.listen(Number(process.env["PORT"] ?? 8080));
417
+ * ```
418
+ */
419
+ declare function baerlyNode(opts: BaerlyNodeOptions): BaerlyNodeHandle;
420
+ //#endregion
421
+ export { type BaerlyNodeHandle, type BaerlyNodeMaintenance, type BaerlyNodeOptions, type Credentials, type CredentialsProvider, type NodeMaintenanceOptions, S3HttpStorage, type S3HttpStorageOptions, baerlyNode, fromEksPodIdentity, gcsStorage, minioStorage, r2Storage, runMaintenanceTick, s3Storage };
422
+ //# sourceMappingURL=node.d.ts.map
package/dist/node.js ADDED
@@ -0,0 +1,2 @@
1
+ import { a as minioStorage, c as runMaintenanceTick, i as gcsStorage, l as S3HttpStorage, o as r2Storage, r as fromEksPodIdentity, s as s3Storage, t as baerlyNode } from "./src-DyET_VPP.js";
2
+ export { S3HttpStorage, baerlyNode, fromEksPodIdentity, gcsStorage, minioStorage, r2Storage, runMaintenanceTick, s3Storage };
@@ -0,0 +1,133 @@
1
+ import { t as BaerlyError } from "./errors-DOdL95kK.js";
2
+ //#region packages/protocol/src/query/builder.ts
3
+ /**
4
+ * Build a fresh `PredicateBuilder<T>` along with the clause-list
5
+ * cell it appends to. Internal — `./normalize.ts` drives this.
6
+ *
7
+ * @internal
8
+ */
9
+ const makeBuilder = () => {
10
+ const clauses = [];
11
+ const push = (clause) => {
12
+ clauses.push(clause);
13
+ return builder;
14
+ };
15
+ const builder = {
16
+ eq: (field, value) => push({
17
+ op: "eq",
18
+ field: String(field),
19
+ value
20
+ }),
21
+ gt: (field, value) => push({
22
+ op: "gt",
23
+ field: String(field),
24
+ value
25
+ }),
26
+ gte: (field, value) => push({
27
+ op: "gte",
28
+ field: String(field),
29
+ value
30
+ }),
31
+ lt: (field, value) => push({
32
+ op: "lt",
33
+ field: String(field),
34
+ value
35
+ }),
36
+ lte: (field, value) => push({
37
+ op: "lte",
38
+ field: String(field),
39
+ value
40
+ }),
41
+ in: (field, values) => push({
42
+ op: "in",
43
+ field: String(field),
44
+ value: [...values]
45
+ })
46
+ };
47
+ return {
48
+ builder,
49
+ clauses
50
+ };
51
+ };
52
+ /**
53
+ * Tighter wire-form type after running through the builder helper —
54
+ * not part of the public surface; `./normalize.ts` returns a plain
55
+ * {@link PredicateWire}.
56
+ *
57
+ * @internal
58
+ */
59
+ const wireFromBuilder = (cb) => {
60
+ const { builder, clauses } = makeBuilder();
61
+ cb(builder);
62
+ return { clauses };
63
+ };
64
+ //#endregion
65
+ //#region packages/protocol/src/query/normalize.ts
66
+ /**
67
+ * Object-form → wire normaliser. Walks a `Predicate<T>` object
68
+ * literal, flattens nested sub-predicates to dotted-path `eq`
69
+ * clauses, and returns a {@link PredicateWire}. Rejects any
70
+ * `$`-prefixed key as `InvalidConfig` — the operator vocabulary
71
+ * lives on the callback DSL only.
72
+ *
73
+ * Semantic invariant: a sub-predicate object (every value is itself
74
+ * an object) flattens to one `eq` clause per leaf — the same
75
+ * open-world matching today's matcher delivers at
76
+ * `./matches.ts:matchesValue` for sub-predicates.
77
+ *
78
+ * Companion modules: `./builder.ts` (callback → wire),
79
+ * `./wire.ts` (types).
80
+ */
81
+ const formatPath = (path) => path.length === 0 ? "<root>" : path.map((p) => JSON.stringify(p)).join(".");
82
+ /**
83
+ * Walk an object-literal predicate, emit one `PredicateClause[]`.
84
+ * Pure primitive values become `eq` clauses at the current path;
85
+ * nested objects recurse, flattening to dotted-path clauses.
86
+ *
87
+ * @internal Tested via the public `normalizePredicateArg` and the
88
+ * normalize.test.ts suite.
89
+ */
90
+ const normalizeObject = (obj, basePath) => {
91
+ const out = [];
92
+ for (const key of Object.keys(obj)) {
93
+ const path = [...basePath, key];
94
+ if (key.startsWith("$")) throw new BaerlyError("InvalidConfig", `Unsupported predicate operator ${JSON.stringify(key)} at ${formatPath(basePath)} — operator vocabulary moved to the callback form (.where(q => q.gt(field, value))). $-keys are not accepted in object-form predicates.`);
95
+ if (key === "__proto__" || key === "constructor" || key === "prototype") throw new BaerlyError("InvalidConfig", `Reserved key ${JSON.stringify(key)} not allowed in a predicate at ${formatPath(basePath)}.`);
96
+ const value = obj[key];
97
+ if (value === null || value === void 0) throw new BaerlyError("InvalidConfig", `Predicate value at ${formatPath(path)} is ${value === null ? "null" : "undefined"} — terminal values must be string / number / boolean / nested object.`);
98
+ if (Array.isArray(value)) throw new BaerlyError("InvalidConfig", `Predicate value at ${formatPath(path)} is an array — match nested objects with a sub-predicate or use callback form (q.in(field, values)) for set membership.`);
99
+ const t = typeof value;
100
+ if (t === "object") {
101
+ const inner = normalizeObject(value, path);
102
+ for (const c of inner) out.push(c);
103
+ continue;
104
+ }
105
+ if (t !== "string" && t !== "number" && t !== "boolean") throw new BaerlyError("InvalidConfig", `Predicate value at ${formatPath(path)} has unsupported type ${JSON.stringify(t)} — must be string / number / boolean / nested object.`);
106
+ if (t === "number" && !Number.isFinite(value)) throw new BaerlyError("InvalidConfig", `Predicate value at ${formatPath(path)} is ${String(value)} — finite numbers only (NaN / Infinity do not round-trip through JSON).`);
107
+ out.push({
108
+ op: "eq",
109
+ field: path.join("."),
110
+ value
111
+ });
112
+ }
113
+ return out;
114
+ };
115
+ /**
116
+ * Dispatch the two-shape `.where(...)` argument to a
117
+ * {@link PredicateWire}. The object-form is walked by
118
+ * {@link normalizeObject}; the callback form is invoked with a
119
+ * fresh {@link PredicateBuilder}.
120
+ *
121
+ * @internal — every consumer (`Db.collection().where`,
122
+ * `ClientCollection.where`, `parseWhereParam`'s wire-arrival
123
+ * path) routes through this single seam so the wire
124
+ * format has exactly one parser path.
125
+ */
126
+ const normalizePredicateArg = (arg) => {
127
+ if (typeof arg === "function") return wireFromBuilder(arg);
128
+ return { clauses: normalizeObject(arg, []) };
129
+ };
130
+ //#endregion
131
+ export { normalizePredicateArg as t };
132
+
133
+ //# sourceMappingURL=normalize-XWY25_sG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-XWY25_sG.js","names":[],"sources":["../packages/protocol/src/query/builder.ts","../packages/protocol/src/query/normalize.ts"],"sourcesContent":["/**\n * Callback-form predicate DSL. `q.eq(\"status\", \"open\").gt(\"priority\",\n * 5)` builds a {@link PredicateWire} via methods on the\n * {@link PredicateBuilder} handle. Each method appends one\n * {@link PredicateClause} to a private list and returns the same\n * handle for chaining.\n *\n * Why a builder, not imported helpers? The methods that exist on\n * the type ARE the supported vocabulary — there is no\n * \"what we don't support\" page to maintain. The agent cannot call\n * `q.regex(...)` because there is no `regex` method; the compiler\n * surfaces the error before the request is sent.\n *\n * Companion modules: `./normalize.ts` (object → wire),\n * `./wire.ts` (wire types).\n */\n\nimport type { DocumentData, DocumentValue } from \"../json.ts\";\nimport type { Path, PathValue, Predicate } from \"../collection-api.ts\";\n\nimport type { PredicateClause, PredicateWire } from \"./wire.ts\";\n\n/**\n * Callback-form predicate builder. Methods append clauses and\n * return the same builder for chaining; chained calls AND-merge.\n *\n * The methods on this interface ARE the supported operator surface.\n * Vocabulary additions (`or`, `not`, `regex`, `ne`, `exists`, ...)\n * are intentionally absent — calling them is a TS2339 compile\n * error, not a runtime rejection. See ADR-002 amendment dated\n * 2026-05-26 for the algebra-lock policy.\n *\n * @template T - the document shape the predicate is keyed against.\n */\nexport interface PredicateBuilder<T extends DocumentData = DocumentData> {\n /**\n * Strict equality on `field`. Use this for the in-callback\n * equality clauses that the object-form would also support;\n * mixing `q.eq(...)` with range / `in` clauses in one call is\n * the canonical \"mixed equality + range\" pattern.\n */\n eq<K extends Path<T>>(field: K, value: PathValue<T, K>): PredicateBuilder<T>;\n\n /**\n * Strict greater. `value` must be `string` or `number`; the\n * intersection at the type level rejects `boolean` / `null`\n * fields at the call site (`q.gt(\"done\", true)` is a TS error\n * on a `done: boolean` field).\n */\n gt<K extends Path<T>>(field: K, value: PathValue<T, K> & (string | number)): PredicateBuilder<T>;\n\n /** Inclusive greater. See {@link gt} for the value-type constraint. */\n gte<K extends Path<T>>(field: K, value: PathValue<T, K> & (string | number)): PredicateBuilder<T>;\n\n /** Strict less. See {@link gt} for the value-type constraint. */\n lt<K extends Path<T>>(field: K, value: PathValue<T, K> & (string | number)): PredicateBuilder<T>;\n\n /** Inclusive less. See {@link gt} for the value-type constraint. */\n lte<K extends Path<T>>(field: K, value: PathValue<T, K> & (string | number)): PredicateBuilder<T>;\n\n /**\n * Set membership. Empty array is `UnsatisfiablePredicate` at\n * normalise time — the validator emits the error eagerly so the\n * caller sees it at the `.where(...)` call site, not later.\n */\n in<K extends Path<T>>(field: K, values: ReadonlyArray<PathValue<T, K>>): PredicateBuilder<T>;\n}\n\n/**\n * Argument shape accepted by `.where(...)`. Either the object-literal\n * equality form ({@link Predicate}) or a callback that drives a\n * {@link PredicateBuilder} and returns it (the chain terminator).\n */\nexport type PredicateArg<T extends DocumentData> =\n | Predicate<T>\n | ((q: PredicateBuilder<T>) => PredicateBuilder<T>);\n\n/**\n * Build a fresh `PredicateBuilder<T>` along with the clause-list\n * cell it appends to. Internal — `./normalize.ts` drives this.\n *\n * @internal\n */\nexport const makeBuilder = <T extends DocumentData>(): {\n builder: PredicateBuilder<T>;\n clauses: PredicateClause[];\n} => {\n const clauses: PredicateClause[] = [];\n const push = (clause: PredicateClause): PredicateBuilder<T> => {\n clauses.push(clause);\n return builder;\n };\n const builder: PredicateBuilder<T> = {\n eq: (field, value) => push({ op: \"eq\", field: String(field), value: value as DocumentValue }),\n gt: (field, value) => push({ op: \"gt\", field: String(field), value: value as DocumentValue }),\n gte: (field, value) => push({ op: \"gte\", field: String(field), value: value as DocumentValue }),\n lt: (field, value) => push({ op: \"lt\", field: String(field), value: value as DocumentValue }),\n lte: (field, value) => push({ op: \"lte\", field: String(field), value: value as DocumentValue }),\n in: (field, values) =>\n push({\n op: \"in\",\n field: String(field),\n value: [...(values as ReadonlyArray<DocumentValue>)],\n }),\n };\n return { builder, clauses };\n};\n\n/**\n * Tighter wire-form type after running through the builder helper —\n * not part of the public surface; `./normalize.ts` returns a plain\n * {@link PredicateWire}.\n *\n * @internal\n */\nexport const wireFromBuilder = <T extends DocumentData>(\n cb: (q: PredicateBuilder<T>) => PredicateBuilder<T>,\n): PredicateWire => {\n const { builder, clauses } = makeBuilder<T>();\n cb(builder);\n return { clauses };\n};\n","/**\n * Object-form → wire normaliser. Walks a `Predicate<T>` object\n * literal, flattens nested sub-predicates to dotted-path `eq`\n * clauses, and returns a {@link PredicateWire}. Rejects any\n * `$`-prefixed key as `InvalidConfig` — the operator vocabulary\n * lives on the callback DSL only.\n *\n * Semantic invariant: a sub-predicate object (every value is itself\n * an object) flattens to one `eq` clause per leaf — the same\n * open-world matching today's matcher delivers at\n * `./matches.ts:matchesValue` for sub-predicates.\n *\n * Companion modules: `./builder.ts` (callback → wire),\n * `./wire.ts` (types).\n */\n\nimport { BaerlyError } from \"../errors.ts\";\nimport type { DocumentData } from \"../json.ts\";\nimport type { Predicate } from \"../collection-api.ts\";\n\nimport { type PredicateArg, type PredicateBuilder, wireFromBuilder } from \"./builder.ts\";\nimport type { PredicateClause, PredicateWire } from \"./wire.ts\";\n\n// Inlined so the normaliser's chunk does not pull in `_internals.ts`\n// (which carries the merger/validator's heavier comparator helpers\n// the client never executes). Keeping a tiny local copy of formatPath\n// keeps the SPA bundle's predicate footprint to normalize+wire only.\nconst formatPath = (path: ReadonlyArray<string>): string =>\n path.length === 0 ? \"<root>\" : path.map((p) => JSON.stringify(p)).join(\".\");\n\n/**\n * Walk an object-literal predicate, emit one `PredicateClause[]`.\n * Pure primitive values become `eq` clauses at the current path;\n * nested objects recurse, flattening to dotted-path clauses.\n *\n * @internal Tested via the public `normalizePredicateArg` and the\n * normalize.test.ts suite.\n */\nexport const normalizeObject = (\n obj: DocumentData,\n basePath: ReadonlyArray<string>,\n): PredicateClause[] => {\n const out: PredicateClause[] = [];\n for (const key of Object.keys(obj)) {\n const path = [...basePath, key];\n if (key.startsWith(\"$\")) {\n throw new BaerlyError(\n \"InvalidConfig\",\n `Unsupported predicate operator ${JSON.stringify(key)} at ${formatPath(basePath)} — operator vocabulary moved to the callback form (.where(q => q.gt(field, value))). $-keys are not accepted in object-form predicates.`,\n );\n }\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\") {\n throw new BaerlyError(\n \"InvalidConfig\",\n `Reserved key ${JSON.stringify(key)} not allowed in a predicate at ${formatPath(basePath)}.`,\n );\n }\n const value: unknown = (obj as Record<string, unknown>)[key];\n if (value === null || value === undefined) {\n throw new BaerlyError(\n \"InvalidConfig\",\n `Predicate value at ${formatPath(path)} is ${value === null ? \"null\" : \"undefined\"} — terminal values must be string / number / boolean / nested object.`,\n );\n }\n if (Array.isArray(value)) {\n throw new BaerlyError(\n \"InvalidConfig\",\n `Predicate value at ${formatPath(path)} is an array — match nested objects with a sub-predicate or use callback form (q.in(field, values)) for set membership.`,\n );\n }\n const t = typeof value;\n if (t === \"object\") {\n // Sub-predicate — recurse, accumulating dotted path. Object-form\n // predicates have NO operator vocabulary, so a nested object is\n // unambiguously a literal sub-predicate. Empty object `{}` at a\n // nested position is a match-all sub-clause: it emits zero\n // clauses for that subtree, which matches the matcher's\n // pre-redesign behaviour for `{ assignee: {} }` (an empty\n // sub-predicate accepts any non-null object actual).\n const inner = normalizeObject(value as DocumentData, path);\n for (const c of inner) {\n out.push(c);\n }\n continue;\n }\n if (t !== \"string\" && t !== \"number\" && t !== \"boolean\") {\n throw new BaerlyError(\n \"InvalidConfig\",\n `Predicate value at ${formatPath(path)} has unsupported type ${JSON.stringify(t)} — must be string / number / boolean / nested object.`,\n );\n }\n if (t === \"number\" && !Number.isFinite(value as number)) {\n throw new BaerlyError(\n \"InvalidConfig\",\n `Predicate value at ${formatPath(path)} is ${String(value)} — finite numbers only (NaN / Infinity do not round-trip through JSON).`,\n );\n }\n out.push({ op: \"eq\", field: path.join(\".\"), value: value as string | number | boolean });\n }\n return out;\n};\n\n/**\n * Dispatch the two-shape `.where(...)` argument to a\n * {@link PredicateWire}. The object-form is walked by\n * {@link normalizeObject}; the callback form is invoked with a\n * fresh {@link PredicateBuilder}.\n *\n * @internal — every consumer (`Db.collection().where`,\n * `ClientCollection.where`, `parseWhereParam`'s wire-arrival\n * path) routes through this single seam so the wire\n * format has exactly one parser path.\n */\nexport const normalizePredicateArg = <T extends DocumentData>(\n arg: PredicateArg<T>,\n): PredicateWire => {\n if (typeof arg === \"function\") {\n return wireFromBuilder<T>(arg as (q: PredicateBuilder<T>) => PredicateBuilder<T>);\n }\n return { clauses: normalizeObject(arg as DocumentData, []) };\n};\n\n/**\n * Re-export the public `Predicate<T>` so callers downstream of this\n * module don't need a separate import. Mirrors the old\n * `./_internals.ts:PredicateOp` re-export the kernel used to lean\n * on.\n */\nexport type { Predicate };\n"],"mappings":";;;;;;;;AAmFA,MAAa,oBAGR;CACH,MAAM,UAA6B,CAAC;CACpC,MAAM,QAAQ,WAAiD;EAC7D,QAAQ,KAAK,MAAM;EACnB,OAAO;CACT;CACA,MAAM,UAA+B;EACnC,KAAK,OAAO,UAAU,KAAK;GAAE,IAAI;GAAM,OAAO,OAAO,KAAK;GAAU;EAAuB,CAAC;EAC5F,KAAK,OAAO,UAAU,KAAK;GAAE,IAAI;GAAM,OAAO,OAAO,KAAK;GAAU;EAAuB,CAAC;EAC5F,MAAM,OAAO,UAAU,KAAK;GAAE,IAAI;GAAO,OAAO,OAAO,KAAK;GAAU;EAAuB,CAAC;EAC9F,KAAK,OAAO,UAAU,KAAK;GAAE,IAAI;GAAM,OAAO,OAAO,KAAK;GAAU;EAAuB,CAAC;EAC5F,MAAM,OAAO,UAAU,KAAK;GAAE,IAAI;GAAO,OAAO,OAAO,KAAK;GAAU;EAAuB,CAAC;EAC9F,KAAK,OAAO,WACV,KAAK;GACH,IAAI;GACJ,OAAO,OAAO,KAAK;GACnB,OAAO,CAAC,GAAI,MAAuC;EACrD,CAAC;CACL;CACA,OAAO;EAAE;EAAS;CAAQ;AAC5B;;;;;;;;AASA,MAAa,mBACX,OACkB;CAClB,MAAM,EAAE,SAAS,YAAY,YAAe;CAC5C,GAAG,OAAO;CACV,OAAO,EAAE,QAAQ;AACnB;;;;;;;;;;;;;;;;;;AC9FA,MAAM,cAAc,SAClB,KAAK,WAAW,IAAI,WAAW,KAAK,KAAK,MAAM,KAAK,UAAU,CAAC,CAAC,EAAE,KAAK,GAAG;;;;;;;;;AAU5E,MAAa,mBACX,KACA,aACsB;CACtB,MAAM,MAAyB,CAAC;CAChC,KAAK,MAAM,OAAO,OAAO,KAAK,GAAG,GAAG;EAClC,MAAM,OAAO,CAAC,GAAG,UAAU,GAAG;EAC9B,IAAI,IAAI,WAAW,GAAG,GACpB,MAAM,IAAI,YACR,iBACA,kCAAkC,KAAK,UAAU,GAAG,EAAE,MAAM,WAAW,QAAQ,EAAE,wIACnF;EAEF,IAAI,QAAQ,eAAe,QAAQ,iBAAiB,QAAQ,aAC1D,MAAM,IAAI,YACR,iBACA,gBAAgB,KAAK,UAAU,GAAG,EAAE,iCAAiC,WAAW,QAAQ,EAAE,EAC5F;EAEF,MAAM,QAAkB,IAAgC;EACxD,IAAI,UAAU,QAAQ,UAAU,KAAA,GAC9B,MAAM,IAAI,YACR,iBACA,sBAAsB,WAAW,IAAI,EAAE,MAAM,UAAU,OAAO,SAAS,YAAY,sEACrF;EAEF,IAAI,MAAM,QAAQ,KAAK,GACrB,MAAM,IAAI,YACR,iBACA,sBAAsB,WAAW,IAAI,EAAE,wHACzC;EAEF,MAAM,IAAI,OAAO;EACjB,IAAI,MAAM,UAAU;GAQlB,MAAM,QAAQ,gBAAgB,OAAuB,IAAI;GACzD,KAAK,MAAM,KAAK,OACd,IAAI,KAAK,CAAC;GAEZ;EACF;EACA,IAAI,MAAM,YAAY,MAAM,YAAY,MAAM,WAC5C,MAAM,IAAI,YACR,iBACA,sBAAsB,WAAW,IAAI,EAAE,wBAAwB,KAAK,UAAU,CAAC,EAAE,sDACnF;EAEF,IAAI,MAAM,YAAY,CAAC,OAAO,SAAS,KAAe,GACpD,MAAM,IAAI,YACR,iBACA,sBAAsB,WAAW,IAAI,EAAE,MAAM,OAAO,KAAK,EAAE,wEAC7D;EAEF,IAAI,KAAK;GAAE,IAAI;GAAM,OAAO,KAAK,KAAK,GAAG;GAAU;EAAmC,CAAC;CACzF;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,MAAa,yBACX,QACkB;CAClB,IAAI,OAAO,QAAQ,YACjB,OAAO,gBAAmB,GAAsD;CAElF,OAAO,EAAE,SAAS,gBAAgB,KAAqB,CAAC,CAAC,EAAE;AAC7D"}