@grovemotorco/manifold 0.0.0-stage → 0.0.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.
@@ -0,0 +1,922 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Schema from "effect/Schema";
3
+ // src/core/ids.ts
4
+ const ID_PREFIXES = [
5
+ "req",
6
+ "dlv",
7
+ "att",
8
+ "rly",
9
+ "rte",
10
+ "lcl",
11
+ "lsn",
12
+ "ltk"
13
+ ];
14
+ /** The prefix of local ids: what a local target sees in `manifold-delivery-id` (§4.2 of LOCAL-RELAY.md). */
15
+ const LOCAL_ID_PREFIX = "lcl";
16
+ const ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
17
+ const TIME_LENGTH = 10;
18
+ const RANDOM_LENGTH = 16;
19
+ const MAX_TIME = 2 ** 48 - 1;
20
+ /** A ULID body: 26 Crockford base32 characters. */
21
+ const ULID_PATTERN = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
22
+ const idPattern = (prefix) => new RegExp(`^${prefix}_[0-7][0-9A-HJKMNP-TV-Z]{25}$`);
23
+ const isId = (prefix, value) => idPattern(prefix).test(value);
24
+ const encodeTime = (time) => {
25
+ let out = "";
26
+ let rest = time;
27
+ for (let i = 0; i < TIME_LENGTH; i++) {
28
+ out = ALPHABET[rest % 32] + out;
29
+ rest = Math.floor(rest / 32);
30
+ }
31
+ return out;
32
+ };
33
+ /** 80 random bits as 16 base32 digits (values 0..31), most significant first. */
34
+ const randomDigits = (random) => Array.from(random(RANDOM_LENGTH), (byte) => byte & 31);
35
+ /** Adds one to the 80-bit random part. Returns false on overflow. */
36
+ const increment = (digits) => {
37
+ for (let i = digits.length - 1; i >= 0; i--) {
38
+ const digit = digits[i];
39
+ if (digit < 31) {
40
+ digits[i] = digit + 1;
41
+ return true;
42
+ }
43
+ digits[i] = 0;
44
+ }
45
+ return false;
46
+ };
47
+ const makeIdGenerator = (options = {}) => {
48
+ const now = options.now ?? Date.now;
49
+ const random = options.random ?? ((length) => crypto.getRandomValues(new Uint8Array(length)));
50
+ let lastTime = -1;
51
+ let lastDigits = [];
52
+ const ulid = () => {
53
+ let time = Math.max(now(), lastTime);
54
+ if (time > MAX_TIME) throw new RangeError("ULID time out of range");
55
+ if (time === lastTime) {
56
+ if (!increment(lastDigits)) {
57
+ time += 1;
58
+ lastDigits = randomDigits(random);
59
+ }
60
+ } else lastDigits = randomDigits(random);
61
+ lastTime = time;
62
+ return encodeTime(time) + lastDigits.map((digit) => ALPHABET[digit]).join("");
63
+ };
64
+ return {
65
+ ulid,
66
+ make: (prefix) => `${prefix}_${ulid()}`
67
+ };
68
+ };
69
+ const defaultGenerator = makeIdGenerator();
70
+ /** A new id with this prefix stamped at `time` (random within that millisecond), e.g. for back-dated fixtures. */
71
+ const idAt = (prefix, time) => makeIdGenerator({ now: () => time }).make(prefix);
72
+ /** A new prefixed id from the process-wide generator. */
73
+ const newId = (prefix) => defaultGenerator.make(prefix);
74
+ /** A new local id (`lcl_…`), minted per request sent to a listener or forwarded by `manifold replay`. */
75
+ const newLocalId = () => defaultGenerator.make("lcl");
76
+ /** True for an `lcl_…` id. */
77
+ const isLocalId = (value) => isId("lcl", value);
78
+ /** The smallest id of `prefix` at `time`: every id made at or after `time` sorts at or after it. */
79
+ const minIdAt = (prefix, time) => `${prefix}_${encodeTime(Math.max(0, Math.floor(time)))}${"0".repeat(RANDOM_LENGTH)}`;
80
+ /** The millisecond timestamp encoded in a ULID or prefixed id, or `undefined` if malformed. */
81
+ const idTime = (id) => {
82
+ const body = id.includes("_") ? id.slice(id.indexOf("_") + 1) : id;
83
+ if (!ULID_PATTERN.test(body)) return void 0;
84
+ let time = 0;
85
+ for (const char of body.slice(0, TIME_LENGTH)) time = time * 32 + ALPHABET.indexOf(char);
86
+ return time;
87
+ };
88
+ // src/core/domain.ts
89
+ /**
90
+ * Domain schemas (§2, §5, §8, §9.3). Every config, record and stats shape is
91
+ * defined here once, as plain-data `Schema.Struct`s (no classes), so values
92
+ * cross Durable Object RPC and JSON unchanged.
93
+ *
94
+ * Conventions:
95
+ * - Times are epoch milliseconds (`Millis`), never `Date`.
96
+ * - Absent SQL values are `null` (`Schema.NullOr`), not missing keys.
97
+ * - Config structs carry their defaults: `typeof X.Encoded` is the input shape
98
+ * (defaulted keys optional), `typeof X.Type` the decoded shape.
99
+ */
100
+ const KiB = 1024;
101
+ const MiB = 1024 * KiB;
102
+ const LIMITS = {
103
+ /** Bodies above this are stored in R2 at `{owner}/{requestId}`. */
104
+ inlineBodyBytes: 16 * KiB,
105
+ defaultMaxBodyBytes: 1 * MiB,
106
+ hardMaxBodyBytes: 10 * MiB,
107
+ /** Attempt response bodies are truncated to this. */
108
+ responseBodyBytes: 16 * KiB,
109
+ /** Per-source SQLite capacity reported in stats. */
110
+ sqliteBytes: 10240 * MiB,
111
+ rejectionRing: 50,
112
+ rejectionRecordsPerMinute: 60,
113
+ releaseBatch: 100,
114
+ replayRangeMax: 500,
115
+ pageDefault: 50,
116
+ pageMax: 200,
117
+ /** Extracted event types and idempotency keys longer than this are dropped. */
118
+ extractedValueChars: 512,
119
+ defaultRelayTimeoutMs: 3e4,
120
+ maxRelayTimeoutMs: 12e4
121
+ };
122
+ const TIMINGS = {
123
+ /** Lease on a `dispatched` delivery (§6.2). */
124
+ dispatchLeaseMs: 3e5,
125
+ /** Added to the relay timeout for the lease on a `running` delivery (§6.3). */
126
+ runningLeaseSlackMs: 6e4,
127
+ /** A failed queue send puts rows back to `pending`, due this much later. */
128
+ sendRetryMs: 5e3,
129
+ /** The alarm re-arms this much later after an internal error. */
130
+ alarmErrorRetryMs: 5e3,
131
+ maintenanceIntervalMs: 36e5,
132
+ /** Worker-side verify config cache (§4 step 3). */
133
+ verifyCacheTtlMs: 15e3,
134
+ /** Minimum age before a failed verification refreshes the cache (§4 step 4). */
135
+ verifyRefreshMinMs: 2e3,
136
+ /** A rotated relay signing secret keeps signing this long (§5.5). */
137
+ signingSecretOverlapMs: 864e5,
138
+ retryAfterCapMs: 36e5,
139
+ cronSweepMs: 3e5
140
+ };
141
+ const withDefault = (value) => Schema.withDecodingDefaultKey(Effect.succeed(value));
142
+ const Millis = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).annotate({ identifier: "Millis" });
143
+ const Count = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
144
+ const Revision = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).annotate({ identifier: "Revision" });
145
+ const prefixedId = (prefix, identifier) => Schema.String.check(Schema.isPattern(idPattern(prefix))).annotate({ identifier });
146
+ const RequestId = prefixedId("req", "RequestId");
147
+ const DeliveryId = prefixedId("dlv", "DeliveryId");
148
+ const AttemptId = prefixedId("att", "AttemptId");
149
+ const RelayId = prefixedId("rly", "RelayId");
150
+ const RouteId = prefixedId("rte", "RouteId");
151
+ /** A request sent to a local target (docs/LOCAL-RELAY.md): sent as `manifold-delivery-id` instead of a `dlv_` id. */
152
+ const LocalId = prefixedId("lcl", "LocalId");
153
+ /** One connected `manifold listen` session. */
154
+ const ListenerSessionId = prefixedId("lsn", "ListenerSessionId");
155
+ /** A listen token's id. The token itself (`mfl_…`) is never stored or returned after creation. */
156
+ const ListenTokenId = prefixedId("ltk", "ListenTokenId");
157
+ /** A source's key, which is also its ingest path segment: `/in/{key}`. */
158
+ const SourceKey = Schema.String.check(Schema.isPattern(/^[a-z0-9][a-z0-9_-]{0,62}$/)).annotate({
159
+ identifier: "SourceKey",
160
+ description: "Lowercase letters, digits, '_' and '-', starting with a letter or digit, at most 63 characters"
161
+ });
162
+ /** An HTTP header name (matched case-insensitively). */
163
+ const HeaderName = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/)).annotate({ identifier: "HeaderName" });
164
+ /** A JSON body field, as a dot path (`event.type`). Numeric segments index arrays. */
165
+ const BodyPath = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_$-]+(\.[A-Za-z0-9_$-]+)*$/)).annotate({ identifier: "BodyPath" });
166
+ /** An event-type glob: `*` matches any run of characters, everything else is literal. */
167
+ const EventTypeGlob = Schema.String.check(Schema.isBetweenLength(1, 256)).annotate({ identifier: "EventTypeGlob" });
168
+ const Fingerprint = Schema.String.check(Schema.isPattern(/^[0-9a-f]{8}$/)).annotate({ identifier: "Fingerprint" });
169
+ /** A plaintext secret as supplied by an operator. Only ever accepted, never returned (except signing secrets once). */
170
+ const SecretValue = Schema.String.check(Schema.isBetweenLength(1, 4096)).annotate({ identifier: "SecretValue" });
171
+ const AbsoluteUrl = Schema.String.check(Schema.makeFilter((value) => URL.canParse(value) || "must be an absolute URL"));
172
+ const StringOrStrings = Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]);
173
+ const RequestStatus = Schema.Literals([
174
+ "accepted",
175
+ "duplicate",
176
+ "unrouted"
177
+ ]).annotate({ identifier: "RequestStatus" });
178
+ const DeliveryStatus = Schema.Literals([
179
+ "pending",
180
+ "dispatched",
181
+ "running",
182
+ "succeeded",
183
+ "failed",
184
+ "cancelled"
185
+ ]).annotate({ identifier: "DeliveryStatus" });
186
+ /** Statuses that end a delivery. Retention only deletes requests whose deliveries are all finished. */
187
+ const FINISHED_DELIVERY_STATUSES = [
188
+ "succeeded",
189
+ "failed",
190
+ "cancelled"
191
+ ];
192
+ const AttemptStatus = Schema.Literals([
193
+ "started",
194
+ "succeeded",
195
+ "failed",
196
+ "lost"
197
+ ]).annotate({ identifier: "AttemptStatus" });
198
+ const PauseReason = Schema.Literals(["manual", "consecutive_failures"]).annotate({ identifier: "PauseReason" });
199
+ /** Why a request failed verification. Counted per source per minute (§5.4). */
200
+ const RejectionReason = Schema.Literals([
201
+ "missing_signature",
202
+ "malformed",
203
+ "bad_signature",
204
+ "missing_timestamp",
205
+ "timestamp_out_of_tolerance",
206
+ "missing_id",
207
+ "no_secrets",
208
+ "missing_token",
209
+ "bad_token",
210
+ "unverified_not_allowed",
211
+ "jwt_missing",
212
+ "jwt_malformed",
213
+ "jwt_unsupported_alg",
214
+ "jwt_unknown_kid",
215
+ "jwt_bad_signature",
216
+ "jwt_expired",
217
+ "jwt_not_yet_valid",
218
+ "jwt_bad_issuer",
219
+ "jwt_bad_audience",
220
+ "jwt_claim_mismatch",
221
+ "jwks_unavailable"
222
+ ]).annotate({ identifier: "RejectionReason" });
223
+ const HashAlgorithm = Schema.Literals([
224
+ "sha1",
225
+ "sha256",
226
+ "sha512"
227
+ ]);
228
+ const SignatureEncoding = Schema.Literals(["hex", "base64"]);
229
+ /**
230
+ * - `plain`: the header is the signature.
231
+ * - `prefixed`: `{prefix}{signature}`, e.g. `sha256=…` (`prefix` required).
232
+ * - `kv-list`: `t=…,v1=…,v1=…`; signatures are the entries named `key`.
233
+ * - `space-list`: `v1,… v1,…`; signatures are the entries versioned `key`.
234
+ */
235
+ const SignatureFormat = Schema.Literals([
236
+ "plain",
237
+ "prefixed",
238
+ "kv-list",
239
+ "space-list"
240
+ ]);
241
+ /** How a secret string becomes HMAC key bytes. `whsec`: strip `whsec_`, then base64. */
242
+ const SecretEncoding = Schema.Literals([
243
+ "utf8",
244
+ "base64",
245
+ "whsec"
246
+ ]);
247
+ /**
248
+ * The signed payload. `{body}` must appear exactly once; `{timestamp}`, `{id}`
249
+ * and `{url}` are optional. Examples: `{body}`, `{timestamp}.{body}`,
250
+ * `v0:{timestamp}:{body}`, `{id}.{timestamp}.{body}`.
251
+ */
252
+ const PayloadTemplate = Schema.String.check(Schema.makeFilter((template) => {
253
+ if (template.split("{body}").length !== 2) return "must contain {body} exactly once";
254
+ const unknown = template.replace(/\{(body|timestamp|id|url)\}/g, "").match(/\{[^}]*\}/);
255
+ return unknown === null || `unknown placeholder ${unknown[0]}`;
256
+ })).annotate({ identifier: "PayloadTemplate" });
257
+ /** Where a timestamp or id comes from: a request header, or an entry of a `kv-list` signature header. */
258
+ const ValueSource = Schema.Union([Schema.Struct({ header: HeaderName }), Schema.Struct({ signatureKey: Schema.String.check(Schema.isBetweenLength(1, 32)) })]).annotate({ identifier: "ValueSource" });
259
+ const ToleranceSeconds = Schema.Int.check(Schema.isBetween({
260
+ minimum: 0,
261
+ maximum: 86400
262
+ }));
263
+ const Tolerance = Schema.Struct({
264
+ pastSeconds: ToleranceSeconds.pipe(withDefault(300)),
265
+ futureSeconds: ToleranceSeconds.pipe(withDefault(300))
266
+ }).annotate({ identifier: "Tolerance" });
267
+ const hmacConsistency = Schema.makeFilter((spec) => {
268
+ if (spec.format === "prefixed" && !spec.prefix) return "format 'prefixed' needs 'prefix'";
269
+ if ((spec.format === "kv-list" || spec.format === "space-list") && !spec.key) return `format '${spec.format}' needs 'key'`;
270
+ if (spec.payload.includes("{timestamp}") && spec.timestamp === void 0) return "payload uses {timestamp} but no 'timestamp' source is set";
271
+ if (spec.payload.includes("{id}") && spec.id === void 0) return "payload uses {id} but no 'id' source is set";
272
+ });
273
+ const HmacVerify = Schema.Struct({
274
+ type: Schema.Literal("hmac"),
275
+ algorithm: HashAlgorithm.pipe(withDefault("sha256")),
276
+ header: HeaderName,
277
+ encoding: SignatureEncoding.pipe(withDefault("hex")),
278
+ format: SignatureFormat.pipe(withDefault("plain")),
279
+ prefix: Schema.optionalKey(Schema.String.check(Schema.isBetweenLength(1, 32))),
280
+ key: Schema.optionalKey(Schema.String.check(Schema.isBetweenLength(1, 32))),
281
+ payload: PayloadTemplate.pipe(withDefault("{body}")),
282
+ timestamp: Schema.optionalKey(ValueSource),
283
+ id: Schema.optionalKey(ValueSource),
284
+ /** Applies only when a timestamp source is set. */
285
+ tolerance: Tolerance.pipe(withDefault({})),
286
+ secretEncoding: SecretEncoding.pipe(withDefault("utf8"))
287
+ }).check(hmacConsistency).annotate({ identifier: "HmacVerify" });
288
+ const TokenVerify = Schema.Struct({
289
+ type: Schema.Literal("token"),
290
+ header: HeaderName,
291
+ /** When set (e.g. `Bearer`), the header must be `{scheme} {token}`; the scheme matches case-insensitively. */
292
+ scheme: Schema.optionalKey(Schema.String.check(Schema.isBetweenLength(1, 32)))
293
+ }).annotate({ identifier: "TokenVerify" });
294
+ const JwtAlgorithm = Schema.Literals(["RS256", "ES256"]);
295
+ const ClaimScalar = Schema.Union([
296
+ Schema.String,
297
+ Schema.Finite,
298
+ Schema.Boolean
299
+ ]);
300
+ /** A required claim: equal to the value, or to one of the values when a list is given. */
301
+ const ClaimRequirement = Schema.Union([ClaimScalar, Schema.NonEmptyArray(ClaimScalar)]);
302
+ const JwtVerify = Schema.Struct({
303
+ type: Schema.Literal("jwt"),
304
+ header: HeaderName.pipe(withDefault("authorization")),
305
+ scheme: Schema.optionalKey(Schema.String.check(Schema.isBetweenLength(1, 32))),
306
+ jwksUrl: AbsoluteUrl,
307
+ algorithms: Schema.NonEmptyArray(JwtAlgorithm).pipe(withDefault(["RS256", "ES256"])),
308
+ /** Accepted `iss` values. */
309
+ issuer: StringOrStrings,
310
+ /** Accepted `aud` values; the token must carry at least one. */
311
+ audience: StringOrStrings,
312
+ claims: Schema.Record(Schema.String, ClaimRequirement).pipe(withDefault({})),
313
+ clockToleranceSeconds: Schema.Int.check(Schema.isBetween({
314
+ minimum: 0,
315
+ maximum: 600
316
+ })).pipe(withDefault(60))
317
+ }).annotate({ identifier: "JwtVerify" });
318
+ const NoneVerify = Schema.Struct({ type: Schema.Literal("none") }).annotate({ identifier: "NoneVerify" });
319
+ const VerifySpec = Schema.Union([
320
+ HmacVerify,
321
+ TokenVerify,
322
+ JwtVerify,
323
+ NoneVerify
324
+ ]).annotate({ identifier: "VerifySpec" });
325
+ /**
326
+ * A partial verify spec: a preset's template, or a source's override of it.
327
+ * Fields from all verifier types share one flat struct; the merged result is
328
+ * decoded with `VerifySpec` (see `resolveVerifySpec` in presets.ts).
329
+ */
330
+ const VerifyOverride = Schema.Struct({
331
+ type: Schema.optionalKey(Schema.Literals([
332
+ "hmac",
333
+ "token",
334
+ "jwt",
335
+ "none"
336
+ ])),
337
+ header: Schema.optionalKey(HeaderName),
338
+ algorithm: Schema.optionalKey(HashAlgorithm),
339
+ encoding: Schema.optionalKey(SignatureEncoding),
340
+ format: Schema.optionalKey(SignatureFormat),
341
+ prefix: Schema.optionalKey(Schema.String),
342
+ key: Schema.optionalKey(Schema.String),
343
+ payload: Schema.optionalKey(Schema.String),
344
+ timestamp: Schema.optionalKey(ValueSource),
345
+ id: Schema.optionalKey(ValueSource),
346
+ tolerance: Schema.optionalKey(Schema.Struct({
347
+ pastSeconds: Schema.optionalKey(Schema.Int),
348
+ futureSeconds: Schema.optionalKey(Schema.Int)
349
+ })),
350
+ secretEncoding: Schema.optionalKey(SecretEncoding),
351
+ scheme: Schema.optionalKey(Schema.String),
352
+ jwksUrl: Schema.optionalKey(Schema.String),
353
+ algorithms: Schema.optionalKey(Schema.NonEmptyArray(JwtAlgorithm)),
354
+ issuer: Schema.optionalKey(StringOrStrings),
355
+ audience: Schema.optionalKey(StringOrStrings),
356
+ claims: Schema.optionalKey(Schema.Record(Schema.String, ClaimRequirement)),
357
+ clockToleranceSeconds: Schema.optionalKey(Schema.Int)
358
+ }).annotate({ identifier: "VerifyOverride" });
359
+ const ExtractorPart = Schema.Union([Schema.Struct({ header: HeaderName }), Schema.Struct({ body: BodyPath })]).annotate({ identifier: "ExtractorPart" });
360
+ /**
361
+ * The first part of `from` that yields a value wins. When `suffix` yields a
362
+ * value too, it is appended after a `.` (GitHub: `pull_request` + `.opened`).
363
+ * JSON strings, numbers and booleans count as values.
364
+ */
365
+ const Extractor = Schema.Struct({
366
+ from: Schema.NonEmptyArray(ExtractorPart),
367
+ suffix: Schema.optionalKey(ExtractorPart)
368
+ }).annotate({ identifier: "Extractor" });
369
+ /**
370
+ * Answers a challenge in a JSON body: when the value at `path` equals
371
+ * `equals`, the response is the string at `challenge` as `text/plain`, and the
372
+ * request is not stored (Slack `url_verification`).
373
+ */
374
+ const JsonChallengeHandshake = Schema.Struct({
375
+ type: Schema.Literal("json-challenge"),
376
+ path: BodyPath,
377
+ equals: Schema.String,
378
+ challenge: BodyPath
379
+ }).annotate({ identifier: "JsonChallengeHandshake" });
380
+ const HandshakeSpec = Schema.Union([JsonChallengeHandshake]).annotate({ identifier: "HandshakeSpec" });
381
+ /** The answer a sender expects instead of the default `202 { id, status }`. */
382
+ const PresetResponse = Schema.Struct({
383
+ status: Schema.Int.check(Schema.isBetween({
384
+ minimum: 200,
385
+ maximum: 299
386
+ })),
387
+ body: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(4096))),
388
+ contentType: Schema.optionalKey(Schema.String)
389
+ }).annotate({ identifier: "PresetResponse" });
390
+ const PresetId = Schema.Literals([
391
+ "github",
392
+ "stripe",
393
+ "slack",
394
+ "shopify",
395
+ "gitlab",
396
+ "linear",
397
+ "standard-webhooks",
398
+ "google-oidc",
399
+ "hmac",
400
+ "bearer",
401
+ "none"
402
+ ]).annotate({ identifier: "PresetId" });
403
+ const VerifyTemplateSchema = VerifyOverride.mapFields((fields) => ({
404
+ ...fields,
405
+ type: Schema.Literals([
406
+ "hmac",
407
+ "token",
408
+ "jwt",
409
+ "none"
410
+ ])
411
+ }));
412
+ const Preset = Schema.Struct({
413
+ id: PresetId,
414
+ description: Schema.String,
415
+ verify: VerifyTemplateSchema,
416
+ eventType: Schema.optionalKey(Extractor),
417
+ idempotencyKey: Schema.optionalKey(Extractor),
418
+ handshake: Schema.optionalKey(HandshakeSpec),
419
+ response: Schema.optionalKey(PresetResponse),
420
+ /** Extra headers never stored or forwarded. */
421
+ redactHeaders: Schema.Array(HeaderName)
422
+ }).annotate({ identifier: "Preset" });
423
+ /** A source's verification after its preset and overrides are merged. Holds no secrets. */
424
+ const ResolvedVerification = Schema.Struct({
425
+ verify: VerifySpec,
426
+ eventType: Schema.NullOr(Extractor),
427
+ idempotencyKey: Schema.NullOr(Extractor),
428
+ handshake: Schema.NullOr(HandshakeSpec),
429
+ response: Schema.NullOr(PresetResponse),
430
+ /** Preset, source and credential headers; stored as `[redacted:…]` and never forwarded. */
431
+ redactHeaders: Schema.Array(Schema.String)
432
+ }).annotate({ identifier: "ResolvedVerification" });
433
+ /** Who a verifier proved sent the request. Only `jwt` yields one in v1. */
434
+ const Principal = Schema.Struct({
435
+ kind: Schema.Literal("jwt"),
436
+ iss: Schema.String,
437
+ sub: Schema.NullOr(Schema.String),
438
+ email: Schema.NullOr(Schema.String),
439
+ /** The audience that matched the verifier's `audience`. */
440
+ aud: Schema.NullOr(Schema.String)
441
+ }).annotate({ identifier: "Principal" });
442
+ const RetryPolicy = Schema.Struct({
443
+ strategy: Schema.Literals(["exponential", "linear"]).pipe(withDefault("exponential")),
444
+ baseSeconds: Schema.Finite.check(Schema.isBetween({
445
+ minimum: 1,
446
+ maximum: 3600
447
+ })).pipe(withDefault(30)),
448
+ factor: Schema.Finite.check(Schema.isBetween({
449
+ minimum: 1,
450
+ maximum: 10
451
+ })).pipe(withDefault(2)),
452
+ capSeconds: Schema.Finite.check(Schema.isBetween({
453
+ minimum: 1,
454
+ maximum: 86400
455
+ })).pipe(withDefault(3600)),
456
+ maxAttempts: Schema.Int.check(Schema.isBetween({
457
+ minimum: 1,
458
+ maximum: 100
459
+ })).pipe(withDefault(10)),
460
+ /** Fraction of the delay added or removed at random: 0.2 is ±20%. */
461
+ jitter: Schema.Finite.check(Schema.isBetween({
462
+ minimum: 0,
463
+ maximum: 1
464
+ })).pipe(withDefault(.2))
465
+ }).annotate({ identifier: "RetryPolicy" });
466
+ const Description = Schema.String.check(Schema.isMaxLength(500));
467
+ const DedupeWindowSeconds = Schema.Int.check(Schema.isBetween({
468
+ minimum: 0,
469
+ maximum: 2592e3
470
+ }));
471
+ const MaxBodyBytes = Schema.Int.check(Schema.isBetween({
472
+ minimum: 1,
473
+ maximum: LIMITS.hardMaxBodyBytes
474
+ }));
475
+ const RetentionDays = Schema.Int.check(Schema.isBetween({
476
+ minimum: 1,
477
+ maximum: 365
478
+ }));
479
+ const RelayTimeoutMs = Schema.Int.check(Schema.isBetween({
480
+ minimum: 1e3,
481
+ maximum: LIMITS.maxRelayTimeoutMs
482
+ }));
483
+ const AutoPauseThreshold = Schema.Int.check(Schema.isBetween({
484
+ minimum: 0,
485
+ maximum: 1e5
486
+ }));
487
+ /** Whether `manifold listen` may attach to a source (docs/LOCAL-RELAY.md §7). Default `on`. */
488
+ const ListenersSetting = Schema.Literals(["on", "off"]).annotate({ identifier: "ListenersSetting" });
489
+ const sourceConfigFields = {
490
+ key: SourceKey,
491
+ description: Schema.optionalKey(Description),
492
+ preset: PresetId,
493
+ enabled: Schema.Boolean.pipe(withDefault(true)),
494
+ /** Required for the `none` verifier. */
495
+ allowUnverified: Schema.Boolean.pipe(withDefault(false)),
496
+ /** Merged over the preset's verify template. */
497
+ verify: Schema.optionalKey(VerifyOverride),
498
+ /** Replaces the preset's extractor. */
499
+ eventType: Schema.optionalKey(Extractor),
500
+ idempotencyKey: Schema.optionalKey(Extractor),
501
+ handshake: Schema.optionalKey(HandshakeSpec),
502
+ response: Schema.optionalKey(PresetResponse),
503
+ /** Added to the preset's list. */
504
+ redactHeaders: Schema.Array(HeaderName).pipe(withDefault([])),
505
+ /** 0 turns dedupe off. */
506
+ dedupeWindowSeconds: DedupeWindowSeconds.pipe(withDefault(86400)),
507
+ maxBodyBytes: MaxBodyBytes.pipe(withDefault(LIMITS.defaultMaxBodyBytes)),
508
+ retentionDays: RetentionDays.pipe(withDefault(14)),
509
+ /** `off` refuses listeners and listen tokens for this source (docs/LOCAL-RELAY.md §7). */
510
+ listeners: ListenersSetting.pipe(withDefault("on"))
511
+ };
512
+ const SourceConfig = Schema.Struct(sourceConfigFields).annotate({ identifier: "SourceConfig" });
513
+ const SecretInfo = Schema.Struct({
514
+ fingerprint: Fingerprint,
515
+ addedAt: Millis
516
+ }).annotate({ identifier: "SecretInfo" });
517
+ const relayConfigFields = {
518
+ /** Unique across relays; the identity of a relay in a declarative config. */
519
+ name: Schema.String.check(Schema.isBetweenLength(1, 100)),
520
+ description: Schema.optionalKey(Description),
521
+ url: AbsoluteUrl,
522
+ /** Extra headers sent on every attempt. Not secret: shown in the API. */
523
+ headers: Schema.Record(HeaderName, Schema.String.check(Schema.isMaxLength(4096))).pipe(withDefault({})),
524
+ timeoutMs: RelayTimeoutMs.pipe(withDefault(LIMITS.defaultRelayTimeoutMs)),
525
+ retry: RetryPolicy.pipe(withDefault({})),
526
+ /** Sign attempts with a manifold-generated `whsec_` secret (§6.6). */
527
+ signing: Schema.Boolean.pipe(withDefault(true))
528
+ };
529
+ const RelayConfig = Schema.Struct(relayConfigFields).annotate({ identifier: "RelayConfig" });
530
+ /** Secret extra headers (for example the relay's own `authorization`). Write-only. */
531
+ const SecretHeaders = Schema.Record(HeaderName, SecretValue);
532
+ const SecretHeaderInfo = Schema.Struct({
533
+ name: Schema.String,
534
+ fingerprint: Fingerprint
535
+ }).annotate({ identifier: "SecretHeaderInfo" });
536
+ const SigningSecretInfo = Schema.Struct({
537
+ fingerprint: Fingerprint,
538
+ createdAt: Millis,
539
+ /** Set on the previous secret after a rotation. */
540
+ expiresAt: Schema.NullOr(Millis)
541
+ }).annotate({ identifier: "SigningSecretInfo" });
542
+ const routeConfigFields = {
543
+ source: SourceKey,
544
+ relay: RelayId,
545
+ description: Schema.optionalKey(Description),
546
+ eventTypes: Schema.NonEmptyArray(EventTypeGlob).pipe(withDefault(["*"])),
547
+ /** A disabled route creates no deliveries; a paused one holds them. */
548
+ enabled: Schema.Boolean.pipe(withDefault(true)),
549
+ /** Consecutive failed attempts that pause the route; 0 never pauses. */
550
+ autoPauseThreshold: AutoPauseThreshold.pipe(withDefault(20))
551
+ };
552
+ const RouteConfig = Schema.Struct(routeConfigFields).annotate({ identifier: "RouteConfig" });
553
+ /** A route's live state, kept by its SourceDO. */
554
+ const RouteState = Schema.Struct({
555
+ routeId: RouteId,
556
+ consecutiveFailures: Count,
557
+ paused: Schema.Boolean,
558
+ pausedAt: Schema.NullOr(Millis),
559
+ pauseReason: Schema.NullOr(PauseReason)
560
+ }).annotate({ identifier: "RouteState" });
561
+ const HeaderMap = Schema.Record(Schema.String, Schema.String).annotate({
562
+ identifier: "HeaderMap",
563
+ description: "Lowercase header names"
564
+ });
565
+ const RequestRecord = Schema.Struct({
566
+ id: RequestId,
567
+ sourceKey: SourceKey,
568
+ receivedAt: Millis,
569
+ status: RequestStatus,
570
+ method: Schema.String,
571
+ path: Schema.String,
572
+ /** The query string without `?`; empty when none. */
573
+ query: Schema.String,
574
+ /** As stored: credentials redacted as `[redacted:<fingerprint>]`. */
575
+ headers: HeaderMap,
576
+ bodySize: Count,
577
+ bodySha256: Schema.String,
578
+ bodyStorage: Schema.Literals(["inline", "r2"]),
579
+ contentType: Schema.NullOr(Schema.String),
580
+ eventType: Schema.NullOr(Schema.String),
581
+ idempotencyKey: Schema.NullOr(Schema.String),
582
+ principal: Schema.NullOr(Principal),
583
+ duplicateOf: Schema.NullOr(RequestId),
584
+ /** A duplicate whose body digest differs from the original's. */
585
+ conflict: Schema.Boolean,
586
+ remoteIp: Schema.NullOr(Schema.String),
587
+ userAgent: Schema.NullOr(Schema.String)
588
+ }).annotate({ identifier: "RequestRecord" });
589
+ const DeliveryRecord = Schema.Struct({
590
+ id: DeliveryId,
591
+ requestId: RequestId,
592
+ routeId: RouteId,
593
+ relayId: RelayId,
594
+ status: DeliveryStatus,
595
+ /** `pending` on a paused route. Derived, not stored. */
596
+ held: Schema.Boolean,
597
+ generation: Count,
598
+ attemptCount: Count,
599
+ maxAttempts: Count,
600
+ dueAt: Millis,
601
+ leaseExpiresAt: Schema.NullOr(Millis),
602
+ lastStatusCode: Schema.NullOr(Schema.Int),
603
+ lastError: Schema.NullOr(Schema.String),
604
+ createdAt: Millis,
605
+ completedAt: Schema.NullOr(Millis),
606
+ /** Created by a replay; sends `manifold-replay: true`. */
607
+ replay: Schema.Boolean,
608
+ /** The latest earlier delivery of the same request on the same route, when this is a replay. */
609
+ replayOf: Schema.NullOr(DeliveryId)
610
+ }).annotate({ identifier: "DeliveryRecord" });
611
+ const AttemptRecord = Schema.Struct({
612
+ id: AttemptId,
613
+ deliveryId: DeliveryId,
614
+ number: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
615
+ generation: Count,
616
+ status: AttemptStatus,
617
+ /** Made after a manual retry. */
618
+ manual: Schema.Boolean,
619
+ startedAt: Millis,
620
+ durationMs: Schema.NullOr(Count),
621
+ url: Schema.String,
622
+ relayRevision: Revision,
623
+ statusCode: Schema.NullOr(Schema.Int),
624
+ error: Schema.NullOr(Schema.String),
625
+ /** `set-cookie` and `authorization` redacted. */
626
+ responseHeaders: Schema.NullOr(HeaderMap),
627
+ /** UTF-8 decoded, at most `LIMITS.responseBodyBytes`. */
628
+ responseBody: Schema.NullOr(Schema.String),
629
+ responseBodyTruncated: Schema.Boolean
630
+ }).annotate({ identifier: "AttemptRecord" });
631
+ const DeliveryDetail = DeliveryRecord.mapFields((fields) => ({
632
+ ...fields,
633
+ attempts: Schema.Array(AttemptRecord)
634
+ })).annotate({ identifier: "DeliveryDetail" });
635
+ /** Why a request was sent to a listener: as it was accepted, on request, or to catch up after a reconnect. */
636
+ const LocalAttemptKind = Schema.Literals([
637
+ "live",
638
+ "replay",
639
+ "resume"
640
+ ]).annotate({ identifier: "LocalAttemptKind" });
641
+ /** A listener's display name (`--name`, default `user@host`). */
642
+ const ListenerName = Schema.String.check(Schema.isBetweenLength(1, 100)).annotate({ identifier: "ListenerName" });
643
+ /**
644
+ * The label of a local target as the CLI reports it, never the full URL:
645
+ * `:{port}{path}` for loopback targets, `{host}{path}` otherwise (see
646
+ * `targetLabel` in src/api/listen.ts).
647
+ */
648
+ const TargetLabel = Schema.String.check(Schema.isBetweenLength(1, 200)).annotate({ identifier: "TargetLabel" });
649
+ /**
650
+ * One forward of one request to one local target, reported by the CLI in a
651
+ * `result` frame and kept in the SourceDO's capped `local_attempts` table
652
+ * (debugging information, not ledger state).
653
+ */
654
+ const LocalAttemptRecord = Schema.Struct({
655
+ /** Row id, increasing. */
656
+ id: Schema.Int,
657
+ requestId: RequestId,
658
+ /** The `lcl_` id the request was sent with; shared by every target and retry of one send. */
659
+ localId: LocalId,
660
+ sessionId: ListenerSessionId,
661
+ /** The listener's name when the result was recorded. */
662
+ listener: ListenerName,
663
+ target: TargetLabel,
664
+ kind: LocalAttemptKind,
665
+ /** 1 for the first try; higher after `--retries` on connection refused. */
666
+ attempt: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
667
+ /** `null` when no response arrived (`error` says why). */
668
+ statusCode: Schema.NullOr(Schema.Int),
669
+ error: Schema.NullOr(Schema.String),
670
+ durationMs: Count,
671
+ /** When the SourceDO recorded the result. */
672
+ at: Millis
673
+ }).annotate({ identifier: "LocalAttemptRecord" });
674
+ /** A connected listener, as `GET /sources/{key}/listeners` shows it. */
675
+ const ListenerInfo = Schema.Struct({
676
+ sessionId: ListenerSessionId,
677
+ name: ListenerName,
678
+ /** The effective filter: the `hello` frame's globs, or a copy of the `likeRoute` route's filter. */
679
+ eventTypes: Schema.Array(EventTypeGlob),
680
+ likeRoute: Schema.NullOr(RouteId),
681
+ /** False for a `--no-live` session (replay only). */
682
+ live: Schema.Boolean,
683
+ connectedAt: Millis,
684
+ /** The audit actor that opened it: `listen:<tokenId>`, `token` or `access:<email>`. */
685
+ actor: Schema.String,
686
+ /** The listen token it authenticated with; `null` for the admin token or Cloudflare Access. */
687
+ tokenId: Schema.NullOr(ListenTokenId),
688
+ counts: Schema.Struct({
689
+ /** `request` frames sent to it. */
690
+ sent: Count,
691
+ /** `result` frames reporting a `2xx`. */
692
+ succeeded: Count,
693
+ /** Every other `result` frame. */
694
+ failed: Count
695
+ }),
696
+ /** The newest request id sent to it (live or resume); its resume cursor. */
697
+ lastSeenRequestId: Schema.NullOr(RequestId)
698
+ }).annotate({ identifier: "ListenerInfo" });
699
+ /** A listen token as the API shows it. The token itself is shown once, on creation. */
700
+ const ListenTokenInfo = Schema.Struct({
701
+ id: ListenTokenId,
702
+ name: Schema.String.check(Schema.isBetweenLength(1, 100)),
703
+ sourceKey: SourceKey,
704
+ /** First 8 hex characters of the token's SHA-256 (§5.5). */
705
+ fingerprint: Fingerprint,
706
+ createdAt: Millis,
707
+ expiresAt: Millis,
708
+ /** Best effort, updated at most hourly. */
709
+ lastUsedAt: Schema.NullOr(Millis)
710
+ }).annotate({ identifier: "ListenTokenInfo" });
711
+ const RequestDetail = Schema.Struct({
712
+ request: RequestRecord,
713
+ deliveries: Schema.Array(DeliveryDetail),
714
+ /** Forwards to listeners' local targets, newest first (docs/LOCAL-RELAY.md §5.1). */
715
+ localAttempts: Schema.Array(LocalAttemptRecord).pipe(withDefault([]))
716
+ }).annotate({ identifier: "RequestDetail" });
717
+ /** One rejected request: metadata only, no body and no credentials (§5.4). */
718
+ const RejectionRecord = Schema.Struct({
719
+ at: Millis,
720
+ reason: RejectionReason,
721
+ verifyRevision: Revision,
722
+ remoteIp: Schema.NullOr(Schema.String),
723
+ userAgent: Schema.NullOr(Schema.String),
724
+ contentLength: Schema.NullOr(Count),
725
+ /** Lowercase names of the headers sent, never their values. */
726
+ headerNames: Schema.Array(Schema.String)
727
+ }).annotate({ identifier: "RejectionRecord" });
728
+ const RejectionCounter = Schema.Struct({
729
+ /** Start of the minute. */
730
+ minute: Millis,
731
+ reason: RejectionReason,
732
+ count: Count
733
+ }).annotate({ identifier: "RejectionCounter" });
734
+ const Rejections = Schema.Struct({
735
+ /** Newest first, at most `LIMITS.rejectionRing`. */
736
+ items: Schema.Array(RejectionRecord),
737
+ /** Per-minute counts, newest first. */
738
+ counters: Schema.Array(RejectionCounter)
739
+ }).annotate({ identifier: "Rejections" });
740
+ /** The numbers of §9.3 for one source. */
741
+ const SourceStats = Schema.Struct({
742
+ sourceKey: SourceKey,
743
+ generatedAt: Millis,
744
+ requests: Schema.Struct({
745
+ accepted: Count,
746
+ duplicate: Count,
747
+ unrouted: Count
748
+ }),
749
+ deliveries: Schema.Struct({
750
+ pending: Count,
751
+ dispatched: Count,
752
+ running: Count,
753
+ succeeded: Count,
754
+ failed: Count,
755
+ cancelled: Count,
756
+ /** Pending on a paused route (included in `pending`). */
757
+ held: Count
758
+ }),
759
+ oldestPendingAt: Schema.NullOr(Millis),
760
+ oldestPendingAgeMs: Schema.NullOr(Count),
761
+ /** Pending on unpaused routes with `dueAt` in the past. */
762
+ overdue: Count,
763
+ alarm: Schema.Struct({
764
+ scheduledAt: Schema.NullOr(Millis),
765
+ overdue: Schema.Boolean
766
+ }),
767
+ storage: Schema.Struct({
768
+ sqliteBytes: Count,
769
+ limitBytes: Count
770
+ }),
771
+ /** Rejections in the last hour, by reason. Reasons with no rejections are omitted. */
772
+ rejectionsLastHour: Schema.Record(Schema.String, Count),
773
+ routes: Schema.Array(RouteState)
774
+ }).annotate({ identifier: "SourceStats" });
775
+ const AuditAction = Schema.Literals([
776
+ "source.create",
777
+ "source.update",
778
+ "source.delete",
779
+ "source.secret.add",
780
+ "source.secret.remove",
781
+ "relay.create",
782
+ "relay.update",
783
+ "relay.delete",
784
+ "relay.rotate_secret",
785
+ "route.create",
786
+ "route.update",
787
+ "route.delete",
788
+ "route.pause",
789
+ "route.resume",
790
+ "config.apply",
791
+ "request.body_read",
792
+ "request.replay",
793
+ "request.replay_range",
794
+ "delivery.retry",
795
+ "delivery.cancel",
796
+ "maintenance.reencrypt",
797
+ "listener.connect",
798
+ "listener.disconnect",
799
+ "listener.send",
800
+ "listen_token.create",
801
+ "listen_token.revoke"
802
+ ]).annotate({ identifier: "AuditAction" });
803
+ const AuditRecord = Schema.Struct({
804
+ id: Schema.Int,
805
+ at: Millis,
806
+ /** `token`; `access:<email>` for a Cloudflare Access identity; `listen:<tokenId>` for a listen token; `system`. */
807
+ actor: Schema.String,
808
+ action: AuditAction,
809
+ /** What was acted on: a source key, relay or route id, request or delivery id. */
810
+ target: Schema.String,
811
+ /** Small structured context. Never secrets. */
812
+ detail: Schema.NullOr(Schema.Json)
813
+ }).annotate({ identifier: "AuditRecord" });
814
+ /** The default `202` body for an accepted webhook. An `unrouted` request answers `accepted`. */
815
+ const IngestAck = Schema.Struct({
816
+ id: RequestId,
817
+ status: Schema.Literals(["accepted", "duplicate"])
818
+ }).annotate({ identifier: "IngestAck" });
819
+ const ErrorCode = Schema.Literals([
820
+ "bad_request",
821
+ "unauthorized",
822
+ "not_found",
823
+ "conflict",
824
+ "payload_too_large",
825
+ "unavailable"
826
+ ]).annotate({ identifier: "ErrorCode" });
827
+ /** Every error body, from the admin API and from ingest: `{ error: { code, message } }`. */
828
+ const ErrorBody = Schema.Struct({ error: Schema.Struct({
829
+ code: ErrorCode,
830
+ message: Schema.String
831
+ }) }).annotate({ identifier: "ErrorBody" });
832
+ const ERROR_STATUS = {
833
+ bad_request: 400,
834
+ unauthorized: 401,
835
+ not_found: 404,
836
+ conflict: 409,
837
+ payload_too_large: 413,
838
+ unavailable: 503
839
+ };
840
+ /** `{ items, nextCursor }`; `nextCursor` is opaque and `null` on the last page. */
841
+ const Page = (item) => Schema.Struct({
842
+ items: Schema.Array(item),
843
+ nextCursor: Schema.NullOr(Schema.String)
844
+ });
845
+ const viewMeta = {
846
+ revision: Revision,
847
+ /** Created by a declarative config (`PUT /config`); the dashboard shows it read-only. */
848
+ managed: Schema.Boolean,
849
+ createdAt: Millis,
850
+ updatedAt: Millis
851
+ };
852
+ const SourceView = Schema.Struct({
853
+ ...SourceConfig.fields,
854
+ ...viewMeta,
855
+ /** Bumped whenever verification config or secrets change. */
856
+ verifyRevision: Revision,
857
+ secrets: Schema.Array(SecretInfo),
858
+ /** `/in/{key}`; prefix with the service origin for the full ingest URL. */
859
+ ingestPath: Schema.String,
860
+ /** The preset merged with this source's overrides. */
861
+ effective: ResolvedVerification
862
+ }).annotate({ identifier: "SourceView" });
863
+ const RelayView = Schema.Struct({
864
+ id: RelayId,
865
+ ...RelayConfig.fields,
866
+ ...viewMeta,
867
+ secretHeaders: Schema.Array(SecretHeaderInfo),
868
+ /** The current signing secret first; a rotated-out one while it still signs. Empty when `signing` is off. */
869
+ signingSecrets: Schema.Array(SigningSecretInfo)
870
+ }).annotate({ identifier: "RelayView" });
871
+ const RouteView = Schema.Struct({
872
+ id: RouteId,
873
+ ...RouteConfig.fields,
874
+ ...viewMeta,
875
+ /** From the source's SourceDO; `null` when it could not be read. */
876
+ state: Schema.NullOr(RouteState)
877
+ }).annotate({ identifier: "RouteView" });
878
+ const ConfigSource = Schema.Struct({
879
+ ...sourceConfigFields,
880
+ /** The complete set of verification secrets (read from the environment). */
881
+ secrets: Schema.Array(SecretValue).pipe(withDefault([]))
882
+ }).annotate({ identifier: "ConfigSource" });
883
+ const ConfigRelay = Schema.Struct({
884
+ ...relayConfigFields,
885
+ /** The complete set of secret extra headers. */
886
+ secretHeaders: SecretHeaders.pipe(withDefault({}))
887
+ }).annotate({ identifier: "ConfigRelay" });
888
+ /** A route in a config file. Identity is `(source, relay)`; `relay` names a relay by its `name`. */
889
+ const ConfigRoute = Schema.Struct({
890
+ ...routeConfigFields,
891
+ relay: Schema.String.check(Schema.isBetweenLength(1, 100))
892
+ }).annotate({ identifier: "ConfigRoute" });
893
+ const ConfigDocument = Schema.Struct({
894
+ sources: Schema.Array(ConfigSource).pipe(withDefault([])),
895
+ relays: Schema.Array(ConfigRelay).pipe(withDefault([])),
896
+ routes: Schema.Array(ConfigRoute).pipe(withDefault([])),
897
+ /** Delete managed items that are not listed. Default true. */
898
+ prune: Schema.Boolean.pipe(withDefault(true))
899
+ }).annotate({ identifier: "ConfigDocument" });
900
+ /** Identities touched by an apply: source keys, relay ids, route ids. */
901
+ const ApplyChanges = Schema.Struct({
902
+ created: Schema.Array(Schema.String),
903
+ updated: Schema.Array(Schema.String),
904
+ deleted: Schema.Array(Schema.String),
905
+ unchanged: Schema.Array(Schema.String)
906
+ }).annotate({ identifier: "ApplyChanges" });
907
+ const IssuedSigningSecret = Schema.Struct({
908
+ relayId: RelayId,
909
+ relayName: Schema.String,
910
+ /** Shown once. */
911
+ signingSecret: Schema.String
912
+ }).annotate({ identifier: "IssuedSigningSecret" });
913
+ const ApplyResult = Schema.Struct({
914
+ sources: ApplyChanges,
915
+ relays: ApplyChanges,
916
+ routes: ApplyChanges,
917
+ /** Signing secrets of relays created by this apply. */
918
+ signingSecrets: Schema.Array(IssuedSigningSecret),
919
+ /** Sources whose snapshot push failed; the cron sweep retries them. */
920
+ pendingPushes: Schema.Array(SourceKey)
921
+ }).annotate({ identifier: "ApplyResult" });
922
+ export { NoneVerify as $, idPattern as $t, HashAlgorithm as A, SecretInfo as At, LIMITS as B, TargetLabel as Bt, ErrorCode as C, RouteConfig as Ct, FINISHED_DELIVERY_STATUSES as D, SecretEncoding as Dt, ExtractorPart as E, RouteView as Et, IssuedSigningSecret as F, SourceConfig as Ft, ListenerSessionId as G, VerifySpec as Gt, ListenTokenInfo as H, Tolerance as Ht, JsonChallengeHandshake as I, SourceKey as It, LocalAttemptRecord as J, sourceConfigFields as Jt, ListenersSetting as K, relayConfigFields as Kt, JwtAlgorithm as L, SourceStats as Lt, HeaderName as M, SignatureEncoding as Mt, HmacVerify as N, SignatureFormat as Nt, Fingerprint as O, SecretHeaderInfo as Ot, IngestAck as P, SigningSecretInfo as Pt, Millis as Q, idAt as Qt, JwtVerify as R, SourceView as Rt, ErrorBody as S, Revision as St, Extractor as T, RouteState as Tt, ListenerInfo as U, ValueSource as Ut, ListenTokenId as V, TokenVerify as Vt, ListenerName as W, VerifyOverride as Wt, MaxBodyBytes as X, LOCAL_ID_PREFIX as Xt, LocalId as Y, ID_PREFIXES as Yt, MiB as Z, ULID_PATTERN as Zt, DeliveryDetail as _, RequestRecord as _t, AttemptStatus as a, newId as an, PresetResponse as at, DeliveryStatus as b, RetentionDays as bt, AutoPauseThreshold as c, RejectionReason as ct, ConfigDocument as d, RelayConfig as dt, idTime as en, Page as et, ConfigRelay as f, RelayId as ft, DedupeWindowSeconds as g, RequestId as gt, Count as h, RequestDetail as ht, AttemptRecord as i, minIdAt as in, PresetId as it, HeaderMap as j, SecretValue as jt, HandshakeSpec as k, SecretHeaders as kt, BodyPath as l, RejectionRecord as lt, ConfigSource as m, RelayView as mt, ApplyResult as n, isLocalId as nn, PayloadTemplate as nt, AuditAction as o, newLocalId as on, Principal as ot, ConfigRoute as p, RelayTimeoutMs as pt, LocalAttemptKind as q, routeConfigFields as qt, AttemptId as r, makeIdGenerator as rn, Preset as rt, AuditRecord as s, RejectionCounter as st, ApplyChanges as t, isId as tn, PauseReason as tt, ClaimRequirement as u, Rejections as ut, DeliveryId as v, RequestStatus as vt, EventTypeGlob as w, RouteId as wt, ERROR_STATUS as x, RetryPolicy as xt, DeliveryRecord as y, ResolvedVerification as yt, KiB as z, TIMINGS as zt };