@fabricorg/webhook-delivery 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -9,7 +9,7 @@ import { FabricModule } from "@fabricorg/platform";
9
9
  * arrays are frozen, so no caller can widen a set at runtime.
10
10
  */
11
11
  /** Reasons an admission port may give for `deny`. */
12
- export declare const WEBHOOK_ADMISSION_DENIAL_CODES: readonly ["actor_not_permitted", "scope_not_permitted", "event_type_not_permitted", "classification_not_permitted", "policy_denied"];
12
+ export declare const WEBHOOK_ADMISSION_DENIAL_CODES: readonly ["actor_not_permitted", "scope_not_permitted", "event_type_not_permitted", "classification_not_permitted", "policy_denied", "event_erased"];
13
13
  /** A reason code carried by an admission `deny` decision and stored on its denial record. */
14
14
  type WebhookAdmissionDenialCode = (typeof WEBHOOK_ADMISSION_DENIAL_CODES)[number];
15
15
  /** Reasons a delivery authorization port may give for `revoked`. */
@@ -150,7 +150,7 @@ type WebhookDeliveryErrorCode = (typeof WEBHOOK_DELIVERY_ERROR_CODES)[number];
150
150
  * active subscription that was paused and resumed after the intent's
151
151
  * eligibility revision; dispatch would cancel it (decision 3).
152
152
  * - `not_found`, `stale`, `not_dead_letter`, `past_replay_horizon`: the
153
- * delivery store refused a requeue or enrichment (decision 10, R5).
153
+ * delivery store refused a requeue, enrichment or replay range (decision 10, R5).
154
154
  * - `not_enrichable`, `actor_present`, `actor_suppressed`: enrichment of a
155
155
  * completed job, or of a job whose actor is not `legacy` (decision 5).
156
156
  * `actor_withheld`, `actor_not_found`, `actor_unavailable`: the
@@ -163,10 +163,18 @@ type WebhookDeliveryErrorCode = (typeof WEBHOOK_DELIVERY_ERROR_CODES)[number];
163
163
  * intent requeue whose evidence predates `subscriptionId` and whose intent
164
164
  * can no longer be read, so the applied requeue has no event (README,
165
165
  * "Atomicity and re-runs").
166
+ * - `replay_not_supported`: replay was not explicitly enabled; operator
167
+ * authorization is not asked. `invocation_required`: replay lacks a trusted
168
+ * action invocation ID to key its immutable acceptance receipt.
169
+ * - `replay_range_invalid`: the historical range is empty or reversed.
170
+ * `replay_range_in_future`: its exclusive upper bound exceeds the store clock.
171
+ * - `replay_limit_exceeded`: fixed membership exceeds the configured cap;
172
+ * no receipt or partial work is accepted. `replay_request_conflict`: an
173
+ * invocation ID was reused with different action parameters or action ID.
166
174
  * - `action_failed`: anything else, such as a failing clock; nothing it
167
175
  * threw is read.
168
176
  */
169
- export declare const WEBHOOK_ACTION_REFUSAL_CODES: readonly ["admission_not_enforced", "scope_invalid", "actor_invalid", "secret_ref_invalid", "secret_ref_unverified", "secret_ref_unchanged", "destination_refused", "destination_unresolved", "subscription_not_found", "subscription_exists", "subscription_deleted", "subscription_not_active", "paused_since_intent", "invalid_transition", "revision_conflict", "version_conflict", "not_found", "stale", "not_dead_letter", "past_replay_horizon", "not_enrichable", "actor_present", "actor_suppressed", "actor_withheld", "actor_not_found", "actor_unavailable", "store_unavailable", "store_outcome_unknown", "action_failed"];
177
+ export declare const WEBHOOK_ACTION_REFUSAL_CODES: readonly ["replay_not_supported", "invocation_required", "replay_range_invalid", "replay_range_in_future", "replay_limit_exceeded", "replay_request_conflict", "admission_not_enforced", "scope_invalid", "actor_invalid", "secret_ref_invalid", "secret_ref_unverified", "secret_ref_unchanged", "destination_refused", "destination_unresolved", "subscription_not_found", "subscription_exists", "subscription_deleted", "subscription_not_active", "paused_since_intent", "invalid_transition", "revision_conflict", "version_conflict", "not_found", "stale", "not_dead_letter", "past_replay_horizon", "not_enrichable", "actor_present", "actor_suppressed", "actor_withheld", "actor_not_found", "actor_unavailable", "store_unavailable", "store_outcome_unknown", "action_failed"];
170
178
  /** Why a governed action refused. */
171
179
  type WebhookActionRefusalCode = (typeof WEBHOOK_ACTION_REFUSAL_CODES)[number];
172
180
  /**
@@ -250,6 +258,150 @@ export declare class WebhookGovernedActionError extends Error {
250
258
  constructor(code: WebhookGovernedActionErrorCode, field: string);
251
259
  }
252
260
  //#endregion
261
+ //#region src/action-parameters.d.ts
262
+ /** The governed actions, by the name after the module namespace (`<namespace>.<name>`). */
263
+ export declare const WEBHOOK_DELIVERY_ACTION_NAMES: readonly ["create_subscription", "update_subscription", "pause_subscription", "resume_subscription", "delete_subscription", "rotate_secret_staged", "rotate_secret_emergency", "requeue_delivery_intent", "requeue_fan_out_job", "enrich_fan_out_job_actor", "replay_events"];
264
+ /** One governed action name. */
265
+ type WebhookDeliveryActionName = (typeof WEBHOOK_DELIVERY_ACTION_NAMES)[number];
266
+ /**
267
+ * Why parameters were refused. `parameters_invalid`: not a plain-data
268
+ * object, a field missing or malformed, or an id breaking the store
269
+ * identifier rule. `unknown_parameter`: a key the action does not declare
270
+ * (named in no message). `secret_ref_invalid`: a `secretRef` that is not a
271
+ * secret reference. `destination_invalid`: a destination URL breaking the
272
+ * URL rules (README, "URL rules"). `event_type_pattern_invalid`: a pattern
273
+ * outside the pattern grammar. `update_ambiguous`: an update naming both or
274
+ * neither of patterns and destination.
275
+ */
276
+ export declare const WEBHOOK_ACTION_PARAMETER_CODES: readonly ["parameters_invalid", "unknown_parameter", "secret_ref_invalid", "destination_invalid", "event_type_pattern_invalid", "update_ambiguous"];
277
+ /** Why an action's parameters were refused. */
278
+ type WebhookActionParameterCode = (typeof WEBHOOK_ACTION_PARAMETER_CODES)[number];
279
+ /** `<namespace>.create_subscription` */
280
+ interface WebhookCreateSubscriptionParameters {
281
+ readonly subscriptionId: string;
282
+ readonly eventTypePatterns: readonly string[];
283
+ readonly destinationUrl: string;
284
+ /** A secret reference, not key material or ciphertext (`isWebhookSecretReference`, then the verifier). */
285
+ readonly secretRef: string;
286
+ /** Only `v1` exists (decision 7); the default. */
287
+ readonly signatureScheme?: "v1";
288
+ }
289
+ /** `<namespace>.update_subscription`: exactly one of the two changes per invocation. */
290
+ type WebhookUpdateSubscriptionParameters = {
291
+ readonly subscriptionId: string;
292
+ readonly eventTypePatterns: readonly string[];
293
+ readonly expectedRevision?: number;
294
+ } | {
295
+ readonly subscriptionId: string;
296
+ readonly destinationUrl: string;
297
+ readonly expectedVersion?: number;
298
+ };
299
+ /** `<namespace>.pause_subscription`, `resume_subscription` and `delete_subscription`. */
300
+ interface WebhookSubscriptionTransitionParameters {
301
+ readonly subscriptionId: string;
302
+ readonly expectedRevision?: number;
303
+ }
304
+ /** `<namespace>.rotate_secret_staged` */
305
+ interface WebhookStagedRotationParameters {
306
+ readonly subscriptionId: string;
307
+ /** The next secret's reference, not key material or ciphertext (`isWebhookSecretReference`, then the verifier). */
308
+ readonly secretRef: string;
309
+ /** The configuration version the operator read; the rotation applies only on it. */
310
+ readonly expectedVersion: number;
311
+ /** The operator's statement that the receiver already accepts the next secret (decision 8). */
312
+ readonly receiverAcceptsNextSecret: true;
313
+ }
314
+ /** `<namespace>.rotate_secret_emergency` */
315
+ interface WebhookEmergencyRotationParameters {
316
+ readonly subscriptionId: string;
317
+ readonly secretRef: string;
318
+ readonly expectedVersion?: number;
319
+ }
320
+ /** `<namespace>.requeue_delivery_intent` */
321
+ interface WebhookIntentRequeueParameters {
322
+ readonly deliveryId: string;
323
+ /** The intent's `fence` as the operator read it. */
324
+ readonly expectedFence: number;
325
+ }
326
+ /** `<namespace>.requeue_fan_out_job` and `enrich_fan_out_job_actor`. */
327
+ interface WebhookJobParameters {
328
+ readonly eventId: string;
329
+ /** The job's `fence` as the operator read it. */
330
+ readonly expectedFence: number;
331
+ }
332
+ /** Explicit historical range; from inclusive, to exclusive. */
333
+ interface WebhookReplayEventsParameters {
334
+ readonly subscriptionId: string;
335
+ readonly eventTypePatterns?: readonly string[];
336
+ readonly from: string;
337
+ readonly to: string;
338
+ }
339
+ /** The parameters of each action, by name. */
340
+ interface WebhookDeliveryActionParameters {
341
+ readonly replay_events: WebhookReplayEventsParameters;
342
+ readonly create_subscription: WebhookCreateSubscriptionParameters;
343
+ readonly update_subscription: WebhookUpdateSubscriptionParameters;
344
+ readonly pause_subscription: WebhookSubscriptionTransitionParameters;
345
+ readonly resume_subscription: WebhookSubscriptionTransitionParameters;
346
+ readonly delete_subscription: WebhookSubscriptionTransitionParameters;
347
+ readonly rotate_secret_staged: WebhookStagedRotationParameters;
348
+ readonly rotate_secret_emergency: WebhookEmergencyRotationParameters;
349
+ readonly requeue_delivery_intent: WebhookIntentRequeueParameters;
350
+ readonly requeue_fan_out_job: WebhookJobParameters;
351
+ readonly enrich_fan_out_job_actor: WebhookJobParameters;
352
+ }
353
+ /** What reading one action's parameters found. */
354
+ type WebhookActionParameterRead<N extends WebhookDeliveryActionName> = {
355
+ readonly ok: true;
356
+ readonly value: WebhookDeliveryActionParameters[N];
357
+ } | {
358
+ readonly ok: false;
359
+ readonly code: WebhookActionParameterCode;
360
+ readonly field: string;
361
+ };
362
+ /** The longest secret reference accepted. */
363
+ export declare const WEBHOOK_SECRET_REF_MAX_LENGTH = 256;
364
+ /** The longest run of characters between two separators (`:`, `/`, `@`, `#`) in a secret reference. */
365
+ export declare const WEBHOOK_SECRET_REF_MAX_SEGMENT = 64;
366
+ /**
367
+ * Whether `value` has the shape of a secret reference (ADR 0018 decision 8):
368
+ * a lower-case scheme and `:` (`kms:`, `vault:`, `arn:`, `secret:` …), then
369
+ * only `A–Z a–z 0–9 . _ ~ : / @ # -`, at most
370
+ * {@link WEBHOOK_SECRET_REF_MAX_LENGTH} characters, with no run longer than
371
+ * {@link WEBHOOK_SECRET_REF_MAX_SEGMENT} between separators.
372
+ *
373
+ * That refuses raw key bytes and their usual encodings: hex, base64 and
374
+ * `whsec_…` values (no scheme), padded or standard base64 (`=`, `+`), PEM
375
+ * armour and anything with whitespace or control characters, and long
376
+ * encoded runs such as wrapped ciphertext. It cannot recognise key material
377
+ * deliberately shaped like a reference (`x:` followed by 64 hex digits
378
+ * passes), which is why the actions also require the application's
379
+ * `secretReferences.verify` port to confirm the reference resolves in the
380
+ * tenant's secret store.
381
+ */
382
+ export declare function isWebhookSecretReference(value: unknown): value is string;
383
+ /** The most patterns one subscription takes. */
384
+ export declare const WEBHOOK_MAX_EVENT_TYPE_PATTERNS = 64;
385
+ /**
386
+ * Whether `value` is an event type pattern the matcher understands: `*`,
387
+ * `prefix.*`, or an exact type, built from `A–Z a–z 0–9 _ : -` segments
388
+ * joined by `.`, at most 256 characters. A `*` anywhere else is refused,
389
+ * since the matcher would treat it as a literal.
390
+ */
391
+ export declare function isWebhookEventTypePattern(value: unknown): value is string;
392
+ /**
393
+ * Read one action's parameters. Never throws: the only thrown value whose
394
+ * properties are read is the package's own `Refusal` (recognized by
395
+ * `Refusal.is`, which runs none of a value's code); anything else thrown
396
+ * while the input is read (an accessor, a Proxy trap, a look-alike refusal)
397
+ * is dropped unread and reported as `parameters_invalid`. The code and field
398
+ * returned are each checked against their fixed set (`fixedRefusal`). Tests:
399
+ * "forged refusals: …".
400
+ */
401
+ export declare function readWebhookActionParameters<N extends WebhookDeliveryActionName>(name: N, input: unknown): WebhookActionParameterRead<N>;
402
+ /** The default module namespace. */
403
+ export declare const DEFAULT_WEBHOOK_DELIVERY_NAMESPACE = "webhook-delivery";
404
+ //#endregion
253
405
  //#region src/types.d.ts
254
406
  /** A JSON value. Every record this package defines is built from these. */
255
407
  type WebhookJsonValue = null | boolean | number | string | readonly WebhookJsonValue[] | {
@@ -341,6 +493,8 @@ interface WebhookFanOutJobDraft {
341
493
  readonly payloadProjected: boolean;
342
494
  /** Declared admission and scope facts; empty when none are declared or allowed. */
343
495
  readonly facts: WebhookJsonObject;
496
+ /** Store-owned erasure marker; undecided subscriptions must fail closed. */
497
+ readonly erased?: boolean;
344
498
  readonly actor: WebhookJobActor;
345
499
  }
346
500
  /** A fenced lease. A write carrying an older `fence` than the record's is refused. */
@@ -525,8 +679,9 @@ type WebhookDeliveryAttemptLogEntry = WebhookDeliveryAttemptRecord | WebhookDeli
525
679
  * with that record, when a purge finds the event older than the replay
526
680
  * horizon (R5). `retainUntil` is the event's `recordedAt` plus the store's
527
681
  * horizon: until then any insert for the pair is `already_present`, and
528
- * after it every insert for the pair is `past_horizon`, so a replay cannot
529
- * re-deliver whether or not a purge has run (the "cleanup racing" cases in
682
+ * after it every insert for the pair is `past_horizon`, so governed replay
683
+ * cannot create a second intent whether or not a purge has run. Dispatch
684
+ * remains at-least-once (the "cleanup racing" cases in
530
685
  * `tests/store-contract.ts`).
531
686
  */
532
687
  interface WebhookTombstone {
@@ -862,7 +1017,9 @@ type WebhookRequeueResult = {
862
1017
  * The result of an actor enrichment (decision 5), checked in this order.
863
1018
  * `not_found`: no such job in this scope. `stale`: the job's fence is no
864
1019
  * longer the request's `expectedFence`. `not_enrichable`: the job is
865
- * `completed`, which is final (README, "Completeness boundary").
1020
+ * `completed`, which remains final for ordinary fan-out's historical selection
1021
+ * (README, "Completeness boundary"); a governed replay request does not reopen
1022
+ * or enrich that completed source job.
866
1023
  * `actor_present`: the job already carries an actor. `actor_suppressed`:
867
1024
  * Host's `includeActor` hook withheld the actor, which enrichment never
868
1025
  * overrides. `past_horizon`: the event is older than the replay horizon.
@@ -911,6 +1068,11 @@ type WebhookDeliveryLeaseCheck = {
911
1068
  readonly valid: false;
912
1069
  readonly reason: "lease_lost" | "intent_not_pending" | "not_found";
913
1070
  };
1071
+ interface WebhookRedactionResult {
1072
+ readonly jobsRedacted: number;
1073
+ readonly intentsRedacted: number;
1074
+ readonly markersRecorded: number;
1075
+ }
914
1076
  /**
915
1077
  * Durable state for both stages (decisions 2, 3 and 10): fan-out jobs keyed
916
1078
  * by `eventId`, intents keyed by (subscriptionId, eventId), fenced leases,
@@ -951,6 +1113,19 @@ type WebhookDeliveryLeaseCheck = {
951
1113
  * proves its check-to-write atomicity separately (README, "Contract suite").
952
1114
  */
953
1115
  interface WebhookDeliveryStore {
1116
+ /**
1117
+ * In one atomic step, scrub jobs and intents scoped to tenant and space for
1118
+ * 1–100 distinct event identifiers. Durable markers scrub late inserts.
1119
+ * Repeated calls repair rows written by older versions, counting and fencing
1120
+ * only rows whose content changes; a no-op leaves fences and leases alone.
1121
+ * Erased jobs deny undecided subscriptions with `event_erased`.
1122
+ * Changed jobs and pending intents advance fences and clear leases.
1123
+ * An attempt begun before this step can still send its old body afterward;
1124
+ * its settlement loses the advanced fence and metadata-only delivery retries.
1125
+ */
1126
+ redactEventRecords(input: WebhookScope & {
1127
+ readonly eventIds: readonly string[];
1128
+ }, options: WebhookCallOptions): Promise<WebhookRedactionResult>;
954
1129
  /**
955
1130
  * Insert a pending job, available at `createdAt`, unless one exists for
956
1131
  * `eventId` or the event is past the replay horizon.
@@ -1422,6 +1597,153 @@ interface WebhookScopeInput {
1422
1597
  */
1423
1598
  type WebhookScopePredicate = (input: WebhookScopeInput) => boolean;
1424
1599
  //#endregion
1600
+ //#region src/replay.d.ts
1601
+ /** Opt-in current-head read; revision and active interval must share one snapshot. */
1602
+ interface WebhookReplaySubscriptionReader {
1603
+ readReplaySubscription(input: WebhookScope & {
1604
+ readonly subscriptionId: string;
1605
+ }, options: WebhookCallOptions): Promise<{
1606
+ readonly revision: WebhookEligibilityRevision;
1607
+ readonly statusSinceRevision: number;
1608
+ } | null>;
1609
+ }
1610
+ interface WebhookReplayKey extends WebhookScope {
1611
+ readonly actionInvocationId: string;
1612
+ }
1613
+ interface WebhookReplayJobKey extends WebhookReplayKey {
1614
+ readonly eventId: string;
1615
+ }
1616
+ interface WebhookReplayRequestInput extends WebhookReplayKey {
1617
+ readonly actionId: string;
1618
+ readonly requestedBy: {
1619
+ readonly actorId: string;
1620
+ readonly actorType: string;
1621
+ };
1622
+ readonly parameters: WebhookReplayEventsParameters;
1623
+ readonly observedRevision: WebhookEligibilityRevision;
1624
+ readonly observedStatusSinceRevision: number;
1625
+ readonly maxEvents: number;
1626
+ readonly processingLifetimeMs: number;
1627
+ }
1628
+ interface WebhookReplayReceipt extends WebhookReplayKey {
1629
+ readonly actionId: string;
1630
+ readonly requestedBy: {
1631
+ readonly actorId: string;
1632
+ readonly actorType: string;
1633
+ };
1634
+ readonly parameters: WebhookReplayEventsParameters;
1635
+ readonly observedRevision: WebhookEligibilityRevision;
1636
+ readonly observedStatusSinceRevision: number;
1637
+ readonly acceptedAt: string;
1638
+ readonly processingDeadline: string;
1639
+ readonly selected: readonly {
1640
+ readonly eventId: string;
1641
+ readonly recordedAt: string;
1642
+ }[];
1643
+ readonly count: number;
1644
+ }
1645
+ type WebhookReplayRefusal = "replay_range_invalid" | "replay_range_in_future" | "replay_limit_exceeded" | "replay_request_conflict" | "past_replay_horizon";
1646
+ type WebhookReplayRequestResult = {
1647
+ readonly applied: true;
1648
+ readonly receipt: WebhookReplayReceipt;
1649
+ readonly replayed?: true;
1650
+ } | {
1651
+ readonly applied: false;
1652
+ readonly code: WebhookReplayRefusal;
1653
+ };
1654
+ type WebhookReplaySkipReason = "subscription_not_found" | "subscription_not_active" | "active_interval_ended" | "patterns_no_longer_match";
1655
+ type WebhookReplayOutcome = {
1656
+ readonly kind: "intent";
1657
+ readonly deliveryId: string;
1658
+ } | {
1659
+ readonly kind: "denial";
1660
+ readonly code: WebhookAdmissionDenialCode;
1661
+ } | {
1662
+ readonly kind: "already_decided";
1663
+ } | {
1664
+ readonly kind: "skipped";
1665
+ readonly reason: WebhookReplaySkipReason;
1666
+ } | {
1667
+ readonly kind: "past_replay_horizon";
1668
+ } | {
1669
+ readonly kind: "dead_lettered";
1670
+ readonly diagnostic: WebhookDiagnosticCode | "source_missing";
1671
+ };
1672
+ interface WebhookReplayItem extends WebhookReplayJobKey {
1673
+ /** Fixed acceptance-time active interval and bounded pattern lists, independent of membership size. */
1674
+ readonly observedStatusSinceRevision: number;
1675
+ readonly eventTypePatterns: readonly string[];
1676
+ readonly observedEventTypePatterns: readonly string[];
1677
+ readonly subscriptionId: string;
1678
+ readonly recordedAt: string;
1679
+ readonly processingDeadline: string;
1680
+ readonly availableAt: string;
1681
+ readonly attemptCount: number;
1682
+ readonly fence: number;
1683
+ readonly lease?: WebhookLease;
1684
+ readonly outcome?: WebhookReplayOutcome;
1685
+ readonly evaluatedRevision?: number;
1686
+ readonly settledAt?: string;
1687
+ }
1688
+ type WebhookReplaySettlement = {
1689
+ readonly kind: "intent";
1690
+ readonly sourceFence: number;
1691
+ readonly evaluatedRevision: number;
1692
+ readonly deliveryId: string;
1693
+ readonly body: string;
1694
+ readonly deliveryLifetimeMs: number;
1695
+ } | {
1696
+ readonly kind: "denial";
1697
+ readonly sourceFence: number;
1698
+ readonly evaluatedRevision: number;
1699
+ readonly code: WebhookAdmissionDenialCode;
1700
+ } | {
1701
+ readonly kind: "already_decided";
1702
+ } | {
1703
+ readonly kind: "skip";
1704
+ readonly reason: WebhookReplaySkipReason;
1705
+ readonly evaluatedRevision?: number;
1706
+ } | {
1707
+ readonly kind: "retry";
1708
+ readonly availableAt: string;
1709
+ readonly diagnostic: WebhookDiagnosticCode;
1710
+ } | {
1711
+ readonly kind: "dead_letter";
1712
+ readonly diagnostic: WebhookDiagnosticCode | "source_missing";
1713
+ };
1714
+ type WebhookReplaySettlementResult = "settled" | "rescheduled" | "lease_lost" | "source_changed" | "pair_not_decided";
1715
+ /** Separate capability: existing custom delivery ports do not implement replay implicitly. */
1716
+ interface WebhookReplayStore {
1717
+ readReplayRequest(input: WebhookReplayKey, options: WebhookCallOptions): Promise<WebhookReplayReceipt | null>;
1718
+ createReplayRequest(input: WebhookReplayRequestInput, options: WebhookCallOptions): Promise<WebhookReplayRequestResult>;
1719
+ claimReplayJobs(request: WebhookClaimRequest, options: WebhookCallOptions): Promise<readonly WebhookReplayItem[]>;
1720
+ renewReplayJobLease(input: WebhookReplayJobKey & WebhookFencedWrite & {
1721
+ readonly leaseDurationMs: number;
1722
+ }, options: WebhookCallOptions): Promise<boolean>;
1723
+ settleReplayJob(input: WebhookReplayJobKey & WebhookFencedWrite & {
1724
+ readonly settlement: WebhookReplaySettlement;
1725
+ }, options: WebhookCallOptions): Promise<WebhookReplaySettlementResult>;
1726
+ listReplayItems(input: WebhookReplayKey & {
1727
+ readonly afterEventId?: string;
1728
+ readonly limit: number;
1729
+ }, options: WebhookCallOptions): Promise<{
1730
+ readonly items: readonly WebhookReplayItem[];
1731
+ readonly more: boolean;
1732
+ }>;
1733
+ }
1734
+ interface WebhookReplayOptions {
1735
+ readonly store: WebhookReplayStore;
1736
+ readonly subscriptions: WebhookReplaySubscriptionReader;
1737
+ /** Default 10,000. Requests above the cap are refused atomically. */
1738
+ readonly maxEvents?: number;
1739
+ /** Default one hour; persisted at acceptance and unchanged on reclaim. */
1740
+ readonly processingLifetimeMs?: number;
1741
+ }
1742
+ export declare const DEFAULT_WEBHOOK_REPLAY: Readonly<{
1743
+ maxEvents: 10000;
1744
+ processingLifetimeMs: 3600000;
1745
+ }>;
1746
+ //#endregion
1425
1747
  //#region src/memory-delivery-store.d.ts
1426
1748
  /** Options for {@link MemoryWebhookDeliveryStore}. */
1427
1749
  interface MemoryWebhookDeliveryStoreOptions {
@@ -1446,11 +1768,14 @@ interface MemoryWebhookDeliveryStoreOptions {
1446
1768
  * positive whole number of milliseconds within `WEBHOOK_MAX_REPLAY_HORIZON_MS`.
1447
1769
  * @throws {WebhookStoreError} `clock_invalid` when `clock` has no `now` function.
1448
1770
  */
1449
- export declare class MemoryWebhookDeliveryStore implements WebhookDeliveryStore {
1771
+ export declare class MemoryWebhookDeliveryStore implements WebhookDeliveryStore, WebhookReplayStore {
1450
1772
  #private;
1451
1773
  constructor(options: MemoryWebhookDeliveryStoreOptions);
1452
1774
  /** The replay horizon this store enforces, in milliseconds. */
1453
1775
  get replayHorizonMs(): number;
1776
+ redactEventRecords(input: WebhookScope & {
1777
+ readonly eventIds: readonly string[];
1778
+ }, options: WebhookCallOptions): Promise<WebhookRedactionResult>;
1454
1779
  insertFanOutJob(job: WebhookFanOutJobDraft & {
1455
1780
  readonly processingDeadline: string;
1456
1781
  readonly createdAt: string;
@@ -1530,6 +1855,22 @@ export declare class MemoryWebhookDeliveryStore implements WebhookDeliveryStore
1530
1855
  readonly subscriptionId: string;
1531
1856
  readonly eventId: string;
1532
1857
  }, options: WebhookCallOptions): Promise<WebhookTombstone | null>;
1858
+ readReplayRequest(input: WebhookReplayKey, options: WebhookCallOptions): Promise<WebhookReplayReceipt | null>;
1859
+ createReplayRequest(input: WebhookReplayRequestInput, options: WebhookCallOptions): Promise<WebhookReplayRequestResult>;
1860
+ claimReplayJobs(request: WebhookClaimRequest, options: WebhookCallOptions): Promise<readonly WebhookReplayItem[]>;
1861
+ renewReplayJobLease(input: WebhookReplayJobKey & WebhookFencedWrite & {
1862
+ readonly leaseDurationMs: number;
1863
+ }, options: WebhookCallOptions): Promise<boolean>;
1864
+ settleReplayJob(input: WebhookReplayJobKey & WebhookFencedWrite & {
1865
+ readonly settlement: WebhookReplaySettlement;
1866
+ }, options: WebhookCallOptions): Promise<WebhookReplaySettlementResult>;
1867
+ listReplayItems(input: WebhookReplayKey & {
1868
+ readonly afterEventId?: string;
1869
+ readonly limit: number;
1870
+ }, options: WebhookCallOptions): Promise<{
1871
+ readonly items: readonly WebhookReplayItem[];
1872
+ readonly more: boolean;
1873
+ }>;
1533
1874
  purgeExpiredRecords(input: {
1534
1875
  readonly limit: number;
1535
1876
  }, options: WebhookCallOptions): Promise<WebhookPurgeResult>;
@@ -1565,6 +1906,12 @@ export declare class MemoryWebhookSubscriptionStore implements WebhookSubscripti
1565
1906
  readSubscription(input: WebhookScope & {
1566
1907
  readonly subscriptionId: string;
1567
1908
  }, options: WebhookCallOptions): Promise<WebhookSubscriptionSnapshot | null>;
1909
+ readReplaySubscription(input: WebhookScope & {
1910
+ readonly subscriptionId: string;
1911
+ }, options: WebhookCallOptions): Promise<{
1912
+ readonly revision: WebhookEligibilityRevision;
1913
+ readonly statusSinceRevision: number;
1914
+ } | null>;
1568
1915
  listEligibilityHistory(input: WebhookScope & {
1569
1916
  readonly subscriptionId: string;
1570
1917
  }, options: WebhookCallOptions): Promise<readonly WebhookEligibilityRevision[]>;
@@ -1647,7 +1994,7 @@ interface PostgresWebhookDeliveryStoreOptions {
1647
1994
  * @throws {WebhookStoreError} `clock_invalid` when `clock` has no `now`
1648
1995
  * function; `input_invalid` when `pool`, `schema` or a test seam is not usable.
1649
1996
  */
1650
- export declare class PostgresWebhookDeliveryStore implements WebhookDeliveryStore {
1997
+ export declare class PostgresWebhookDeliveryStore implements WebhookDeliveryStore, WebhookReplayStore {
1651
1998
  #private;
1652
1999
  constructor(options: PostgresWebhookDeliveryStoreOptions);
1653
2000
  /** The replay horizon this store enforces, in milliseconds. */
@@ -1659,6 +2006,9 @@ export declare class PostgresWebhookDeliveryStore implements WebhookDeliveryStor
1659
2006
  * (`applyWebhookMigrations` in src/postgres-sql.ts).
1660
2007
  */
1661
2008
  ensureSchema(): Promise<void>;
2009
+ redactEventRecords(input: WebhookScope & {
2010
+ readonly eventIds: readonly string[];
2011
+ }, options: WebhookCallOptions): Promise<WebhookRedactionResult>;
1662
2012
  insertFanOutJob(job: WebhookFanOutJobDraft & {
1663
2013
  readonly processingDeadline: string;
1664
2014
  readonly createdAt: string;
@@ -1738,6 +2088,22 @@ export declare class PostgresWebhookDeliveryStore implements WebhookDeliveryStor
1738
2088
  readonly subscriptionId: string;
1739
2089
  readonly eventId: string;
1740
2090
  }, options: WebhookCallOptions): Promise<WebhookTombstone | null>;
2091
+ readReplayRequest(input: WebhookReplayKey, options: WebhookCallOptions): Promise<WebhookReplayReceipt | null>;
2092
+ createReplayRequest(input: WebhookReplayRequestInput, options: WebhookCallOptions): Promise<WebhookReplayRequestResult>;
2093
+ claimReplayJobs(request: WebhookClaimRequest, options: WebhookCallOptions): Promise<readonly WebhookReplayItem[]>;
2094
+ renewReplayJobLease(input: WebhookReplayJobKey & WebhookFencedWrite & {
2095
+ readonly leaseDurationMs: number;
2096
+ }, options: WebhookCallOptions): Promise<boolean>;
2097
+ settleReplayJob(input: WebhookReplayJobKey & WebhookFencedWrite & {
2098
+ readonly settlement: WebhookReplaySettlement;
2099
+ }, options: WebhookCallOptions): Promise<WebhookReplaySettlementResult>;
2100
+ listReplayItems(input: WebhookReplayKey & {
2101
+ readonly afterEventId?: string;
2102
+ readonly limit: number;
2103
+ }, options: WebhookCallOptions): Promise<{
2104
+ readonly items: readonly WebhookReplayItem[];
2105
+ readonly more: boolean;
2106
+ }>;
1741
2107
  purgeExpiredRecords(input: {
1742
2108
  readonly limit: number;
1743
2109
  }, options: WebhookCallOptions): Promise<WebhookPurgeResult>;
@@ -1775,6 +2141,12 @@ export declare class PostgresWebhookSubscriptionStore implements WebhookSubscrip
1775
2141
  readSubscription(input: WebhookScope & {
1776
2142
  readonly subscriptionId: string;
1777
2143
  }, options: WebhookCallOptions): Promise<WebhookSubscriptionSnapshot | null>;
2144
+ readReplaySubscription(input: WebhookScope & {
2145
+ readonly subscriptionId: string;
2146
+ }, options: WebhookCallOptions): Promise<{
2147
+ readonly revision: WebhookEligibilityRevision;
2148
+ readonly statusSinceRevision: number;
2149
+ } | null>;
1778
2150
  listEligibilityHistory(input: WebhookScope & {
1779
2151
  readonly subscriptionId: string;
1780
2152
  }, options: WebhookCallOptions): Promise<readonly WebhookEligibilityRevision[]>;
@@ -2265,7 +2637,7 @@ interface WebhookFanOutPublisherOptions {
2265
2637
  * 2. inserts the job with `createdAt` now and a processing deadline
2266
2638
  * `fanOutDeadlineMs` later, bounded by `portTimeoutMs` and the caller's
2267
2639
  * signal;
2268
- * 3. resolves on `inserted` or `already_present` (a replay or a bridge
2640
+ * 3. resolves on `inserted` or `already_present` (Host outbox re-publication or a bridge
2269
2641
  * overlap: the first insert wins, and the stored job is not changed).
2270
2642
  *
2271
2643
  * It rejects, so the Host relay retries the record and eventually
@@ -2358,6 +2730,14 @@ interface WebhookCompositePublisherOptions {
2358
2730
  */
2359
2731
  export declare function createWebhookCompositePublisher(options: WebhookCompositePublisherOptions): EnterpriseEventPublisher;
2360
2732
  //#endregion
2733
+ //#region src/cycle-options.d.ts
2734
+ /** Defaults for the cycle's own options. */
2735
+ export declare const DEFAULT_WEBHOOK_FAN_OUT_CYCLE: Readonly<{
2736
+ batchSize: 25;
2737
+ leaseDurationMs: 60000;
2738
+ eligibilitySettleMs: 5000;
2739
+ }>;
2740
+ //#endregion
2361
2741
  //#region src/fan-out-cycle.d.ts
2362
2742
  /** What decides whether a subscription revision needs the event's actor identity. */
2363
2743
  interface WebhookActorRequirementInput {
@@ -2450,12 +2830,6 @@ interface WebhookFanOutCycleResult {
2450
2830
  /** Denial inserts the store confirmed, counted like `intentsInserted`. */
2451
2831
  readonly denialsRecorded: number;
2452
2832
  }
2453
- /** Defaults for the cycle's own options. */
2454
- export declare const DEFAULT_WEBHOOK_FAN_OUT_CYCLE: Readonly<{
2455
- batchSize: 25;
2456
- leaseDurationMs: 60000;
2457
- eligibilitySettleMs: 5000;
2458
- }>;
2459
2833
  /**
2460
2834
  * Whether an event type matches one subscription pattern. `*` matches every
2461
2835
  * type; a pattern ending in `.*` matches every type that starts with the
@@ -2626,148 +3000,12 @@ export declare const DEFAULT_WEBHOOK_DELIVERY_CYCLE: Readonly<{
2626
3000
  export declare function runWebhookDeliveryCycle(options: WebhookDeliveryCycleOptions): Promise<WebhookDeliveryCycleResult>;
2627
3001
  //#endregion
2628
3002
  //#region src/action-events.d.ts
2629
- export declare const WEBHOOK_DELIVERY_ACTION_EVENT_TYPES: readonly ["WebhookSubscriptionCreated", "WebhookSubscriptionUpdated", "WebhookSubscriptionPaused", "WebhookSubscriptionResumed", "WebhookSubscriptionDeleted", "WebhookSecretRotated", "WebhookDeliveryIntentRequeued", "WebhookFanOutJobRequeued", "WebhookFanOutJobActorEnriched"];
3003
+ export declare const WEBHOOK_DELIVERY_ACTION_EVENT_TYPES: readonly ["WebhookReplayRequested", "WebhookSubscriptionCreated", "WebhookSubscriptionUpdated", "WebhookSubscriptionPaused", "WebhookSubscriptionResumed", "WebhookSubscriptionDeleted", "WebhookSecretRotated", "WebhookDeliveryIntentRequeued", "WebhookFanOutJobRequeued", "WebhookFanOutJobActorEnriched"];
2630
3004
  /** An event type one of the package's governed actions emits. */
2631
3005
  type WebhookDeliveryActionEventType = (typeof WEBHOOK_DELIVERY_ACTION_EVENT_TYPES)[number];
2632
3006
  /** `true` when `eventType` is emitted by one of the package's governed actions. */
2633
3007
  export declare function isWebhookDeliveryActionEventType(eventType: unknown): eventType is WebhookDeliveryActionEventType;
2634
3008
  //#endregion
2635
- //#region src/action-parameters.d.ts
2636
- /** The governed actions, by the name after the module namespace (`<namespace>.<name>`). */
2637
- export declare const WEBHOOK_DELIVERY_ACTION_NAMES: readonly ["create_subscription", "update_subscription", "pause_subscription", "resume_subscription", "delete_subscription", "rotate_secret_staged", "rotate_secret_emergency", "requeue_delivery_intent", "requeue_fan_out_job", "enrich_fan_out_job_actor"];
2638
- /** One governed action name. */
2639
- type WebhookDeliveryActionName = (typeof WEBHOOK_DELIVERY_ACTION_NAMES)[number];
2640
- /**
2641
- * Why parameters were refused. `parameters_invalid`: not a plain-data
2642
- * object, a field missing or malformed, or an id breaking the store
2643
- * identifier rule. `unknown_parameter`: a key the action does not declare
2644
- * (named in no message). `secret_ref_invalid`: a `secretRef` that is not a
2645
- * secret reference. `destination_invalid`: a destination URL breaking the
2646
- * URL rules (README, "URL rules"). `event_type_pattern_invalid`: a pattern
2647
- * outside the pattern grammar. `update_ambiguous`: an update naming both or
2648
- * neither of patterns and destination.
2649
- */
2650
- export declare const WEBHOOK_ACTION_PARAMETER_CODES: readonly ["parameters_invalid", "unknown_parameter", "secret_ref_invalid", "destination_invalid", "event_type_pattern_invalid", "update_ambiguous"];
2651
- /** Why an action's parameters were refused. */
2652
- type WebhookActionParameterCode = (typeof WEBHOOK_ACTION_PARAMETER_CODES)[number];
2653
- /** `<namespace>.create_subscription` */
2654
- interface WebhookCreateSubscriptionParameters {
2655
- readonly subscriptionId: string;
2656
- readonly eventTypePatterns: readonly string[];
2657
- readonly destinationUrl: string;
2658
- /** A secret reference, not key material or ciphertext (`isWebhookSecretReference`, then the verifier). */
2659
- readonly secretRef: string;
2660
- /** Only `v1` exists (decision 7); the default. */
2661
- readonly signatureScheme?: "v1";
2662
- }
2663
- /** `<namespace>.update_subscription`: exactly one of the two changes per invocation. */
2664
- type WebhookUpdateSubscriptionParameters = {
2665
- readonly subscriptionId: string;
2666
- readonly eventTypePatterns: readonly string[];
2667
- readonly expectedRevision?: number;
2668
- } | {
2669
- readonly subscriptionId: string;
2670
- readonly destinationUrl: string;
2671
- readonly expectedVersion?: number;
2672
- };
2673
- /** `<namespace>.pause_subscription`, `resume_subscription` and `delete_subscription`. */
2674
- interface WebhookSubscriptionTransitionParameters {
2675
- readonly subscriptionId: string;
2676
- readonly expectedRevision?: number;
2677
- }
2678
- /** `<namespace>.rotate_secret_staged` */
2679
- interface WebhookStagedRotationParameters {
2680
- readonly subscriptionId: string;
2681
- /** The next secret's reference, not key material or ciphertext (`isWebhookSecretReference`, then the verifier). */
2682
- readonly secretRef: string;
2683
- /** The configuration version the operator read; the rotation applies only on it. */
2684
- readonly expectedVersion: number;
2685
- /** The operator's statement that the receiver already accepts the next secret (decision 8). */
2686
- readonly receiverAcceptsNextSecret: true;
2687
- }
2688
- /** `<namespace>.rotate_secret_emergency` */
2689
- interface WebhookEmergencyRotationParameters {
2690
- readonly subscriptionId: string;
2691
- readonly secretRef: string;
2692
- readonly expectedVersion?: number;
2693
- }
2694
- /** `<namespace>.requeue_delivery_intent` */
2695
- interface WebhookIntentRequeueParameters {
2696
- readonly deliveryId: string;
2697
- /** The intent's `fence` as the operator read it. */
2698
- readonly expectedFence: number;
2699
- }
2700
- /** `<namespace>.requeue_fan_out_job` and `enrich_fan_out_job_actor`. */
2701
- interface WebhookJobParameters {
2702
- readonly eventId: string;
2703
- /** The job's `fence` as the operator read it. */
2704
- readonly expectedFence: number;
2705
- }
2706
- /** The parameters of each action, by name. */
2707
- interface WebhookDeliveryActionParameters {
2708
- readonly create_subscription: WebhookCreateSubscriptionParameters;
2709
- readonly update_subscription: WebhookUpdateSubscriptionParameters;
2710
- readonly pause_subscription: WebhookSubscriptionTransitionParameters;
2711
- readonly resume_subscription: WebhookSubscriptionTransitionParameters;
2712
- readonly delete_subscription: WebhookSubscriptionTransitionParameters;
2713
- readonly rotate_secret_staged: WebhookStagedRotationParameters;
2714
- readonly rotate_secret_emergency: WebhookEmergencyRotationParameters;
2715
- readonly requeue_delivery_intent: WebhookIntentRequeueParameters;
2716
- readonly requeue_fan_out_job: WebhookJobParameters;
2717
- readonly enrich_fan_out_job_actor: WebhookJobParameters;
2718
- }
2719
- /** What reading one action's parameters found. */
2720
- type WebhookActionParameterRead<N extends WebhookDeliveryActionName> = {
2721
- readonly ok: true;
2722
- readonly value: WebhookDeliveryActionParameters[N];
2723
- } | {
2724
- readonly ok: false;
2725
- readonly code: WebhookActionParameterCode;
2726
- readonly field: string;
2727
- };
2728
- /** The longest secret reference accepted. */
2729
- export declare const WEBHOOK_SECRET_REF_MAX_LENGTH = 256;
2730
- /** The longest run of characters between two separators (`:`, `/`, `@`, `#`) in a secret reference. */
2731
- export declare const WEBHOOK_SECRET_REF_MAX_SEGMENT = 64;
2732
- /**
2733
- * Whether `value` has the shape of a secret reference (ADR 0018 decision 8):
2734
- * a lower-case scheme and `:` (`kms:`, `vault:`, `arn:`, `secret:` …), then
2735
- * only `A–Z a–z 0–9 . _ ~ : / @ # -`, at most
2736
- * {@link WEBHOOK_SECRET_REF_MAX_LENGTH} characters, with no run longer than
2737
- * {@link WEBHOOK_SECRET_REF_MAX_SEGMENT} between separators.
2738
- *
2739
- * That refuses raw key bytes and their usual encodings: hex, base64 and
2740
- * `whsec_…` values (no scheme), padded or standard base64 (`=`, `+`), PEM
2741
- * armour and anything with whitespace or control characters, and long
2742
- * encoded runs such as wrapped ciphertext. It cannot recognise key material
2743
- * deliberately shaped like a reference (`x:` followed by 64 hex digits
2744
- * passes), which is why the actions also require the application's
2745
- * `secretReferences.verify` port to confirm the reference resolves in the
2746
- * tenant's secret store.
2747
- */
2748
- export declare function isWebhookSecretReference(value: unknown): value is string;
2749
- /** The most patterns one subscription takes. */
2750
- export declare const WEBHOOK_MAX_EVENT_TYPE_PATTERNS = 64;
2751
- /**
2752
- * Whether `value` is an event type pattern the matcher understands: `*`,
2753
- * `prefix.*`, or an exact type, built from `A–Z a–z 0–9 _ : -` segments
2754
- * joined by `.`, at most 256 characters. A `*` anywhere else is refused,
2755
- * since the matcher would treat it as a literal.
2756
- */
2757
- export declare function isWebhookEventTypePattern(value: unknown): value is string;
2758
- /**
2759
- * Read one action's parameters. Never throws: the only thrown value whose
2760
- * properties are read is the package's own `Refusal` (recognized by
2761
- * `Refusal.is`, which runs none of a value's code); anything else thrown
2762
- * while the input is read (an accessor, a Proxy trap, a look-alike refusal)
2763
- * is dropped unread and reported as `parameters_invalid`. The code and field
2764
- * returned are each checked against their fixed set (`fixedRefusal`). Tests:
2765
- * "forged refusals: …".
2766
- */
2767
- export declare function readWebhookActionParameters<N extends WebhookDeliveryActionName>(name: N, input: unknown): WebhookActionParameterRead<N>;
2768
- /** The default module namespace. */
2769
- export declare const DEFAULT_WEBHOOK_DELIVERY_NAMESPACE = "webhook-delivery";
2770
- //#endregion
2771
3009
  //#region src/governed-actions.d.ts
2772
3010
  /** What the module's operator policy asks the application about one invocation. */
2773
3011
  interface WebhookOperatorAuthorizationInput {
@@ -2778,6 +3016,12 @@ interface WebhookOperatorAuthorizationInput {
2778
3016
  readonly spaceId: string;
2779
3017
  readonly actorId: string;
2780
3018
  readonly actorType: string;
3019
+ /** Normalized historical range/filter metadata for replay authorization; no event data or secrets. */
3020
+ readonly replay?: {
3021
+ readonly from: string;
3022
+ readonly to: string;
3023
+ readonly eventTypePatterns?: readonly string[];
3024
+ };
2781
3025
  /** The ids the action names, copied from three id fields by `operatorPolicy`; no URL or secret reference. */
2782
3026
  readonly target: {
2783
3027
  readonly subscriptionId?: string;
@@ -2830,6 +3074,7 @@ interface WebhookEventActorReader {
2830
3074
  }
2831
3075
  /** Options for {@link createWebhookDeliveryModule}. */
2832
3076
  interface WebhookDeliveryModuleOptions {
3077
+ readonly replay?: WebhookReplayOptions;
2833
3078
  /** The module namespace; actions are `<namespace>.<name>`. Default `webhook-delivery`. */
2834
3079
  readonly namespace?: string;
2835
3080
  readonly subscriptions: WebhookSubscriptionStore & WebhookSubscriptionWriter;
@@ -2863,4 +3108,16 @@ export declare function webhookOperatorPolicyId(namespace?: string): `${string}.
2863
3108
  */
2864
3109
  export declare function createWebhookDeliveryModule<TDb = unknown>(options: WebhookDeliveryModuleOptions): FabricModule<TDb>;
2865
3110
  //#endregion
2866
- export type { MemoryWebhookDeliveryStoreOptions, MemoryWebhookSubscriptionStoreOptions, PostgresWebhookDeliveryStoreOptions, PostgresWebhookSubscriptionStoreOptions, WebhookActionParameterCode, WebhookActionParameterRead, WebhookActionRefusalCode, WebhookActorEnrichmentRequest, WebhookActorEnrichmentResult, WebhookActorRequirementInput, WebhookAdmissionDecision, WebhookAdmissionDenialCode, WebhookAdmissionDenialRecord, WebhookAdmissionInput, WebhookAttemptBeginResult, WebhookAttemptOutcome, WebhookAttemptReasonCode, WebhookCallOptions, WebhookClaimRequest, WebhookClassifyOptions, WebhookClock, WebhookCompositePublisherOptions, WebhookCompositeSink, WebhookConfigErrorCode, WebhookConfigurationWriteResult, WebhookCreateSubscriptionParameters, WebhookDeliveryActionEventType, WebhookDeliveryActionName, WebhookDeliveryActionParameters, WebhookDeliveryAttemptFinish, WebhookDeliveryAttemptInFlight, WebhookDeliveryAttemptLogEntry, WebhookDeliveryAttemptRecord, WebhookDeliveryAttemptStart, WebhookDeliveryAuthorization, WebhookDeliveryAuthorizationDecision, WebhookDeliveryAuthorizationInput, WebhookDeliveryBodyV1, WebhookDeliveryClassification, WebhookDeliveryConfiguration, WebhookDeliveryConfigurationInput, WebhookDeliveryCycleEvent, WebhookDeliveryCycleOptions, WebhookDeliveryCycleResult, WebhookDeliveryCycleResultKind, WebhookDeliveryErrorCode, WebhookDeliveryIntent, WebhookDeliveryIntentStatus, WebhookDeliveryLeaseCheck, WebhookDeliveryLimits, WebhookDeliveryModuleOptions, WebhookDeliveryObservation, WebhookDeliveryStore, WebhookDestinationResolution, WebhookDestinationResolver, WebhookDestinationResolverOptions, WebhookDestinationUrlCheck, WebhookDiagnosticCode, WebhookDnsLookup, WebhookEgressPayload, WebhookEgressProjectionInput, WebhookEgressSubscription, WebhookEligibilityRevision, WebhookEmergencyRotationParameters, WebhookEventActorReader, WebhookEventActorReading, WebhookEventAdmission, WebhookEventMetadata, WebhookEventTypePolicy, WebhookFanOutCycleOptions, WebhookFanOutCycleResult, WebhookFanOutErrorCode, WebhookFanOutJob, WebhookFanOutJobDraft, WebhookFanOutJobFence, WebhookFanOutJobStatus, WebhookFanOutPublisherOptions, WebhookFencedInsertResult, WebhookFencedWrite, WebhookGovernedActionErrorCode, WebhookInputErrorCode, WebhookInsertResult, WebhookIntentRequeueParameters, WebhookJobActor, WebhookJobParameters, WebhookJsonObject, WebhookJsonValue, WebhookLease, WebhookOperatorAuthorization, WebhookOperatorAuthorizationInput, WebhookPayloadPolicy, WebhookPersistenceProjectionOptions, WebhookPostgresConnection, WebhookPostgresPool, WebhookPostgresQueryable, WebhookPostgresResult, WebhookProjectionErrorCode, WebhookPurgeResult, WebhookRandomSource, WebhookRenderInput, WebhookRenderedBody, WebhookRequestHeaderInput, WebhookRequeueEvidence, WebhookRequeueRequest, WebhookRequeueResult, WebhookResolvedAddress, WebhookRetryDelay, WebhookRetryDelayOptions, WebhookRevocationCode, WebhookScope, WebhookScopeInput, WebhookScopePredicate, WebhookSecretReferenceVerifier, WebhookSignRequest, WebhookSignatureScheme, WebhookSigner, WebhookSourceEnvelope, WebhookStagedRotationParameters, WebhookStoreErrorCode, WebhookSubscriptionSnapshot, WebhookSubscriptionStatus, WebhookSubscriptionStore, WebhookSubscriptionTransitionInput, WebhookSubscriptionTransitionParameters, WebhookSubscriptionWriteRefusal, WebhookSubscriptionWriteResult, WebhookSubscriptionWriter, WebhookTombstone, WebhookTransactionCheckpointStage, WebhookTransport, WebhookTransportRequest, WebhookTransportResult, WebhookUpdateSubscriptionParameters, WebhookVettedDestination };
3111
+ //#region src/replay-cycle.d.ts
3112
+ interface WebhookReplayCycleOptions extends Omit<WebhookFanOutCycleOptions, "subscriptions" | "eligibilitySettleMs"> {
3113
+ readonly replay: WebhookReplayStore;
3114
+ readonly subscriptions: WebhookReplaySubscriptionReader;
3115
+ }
3116
+ /** Processes fixed replay membership; dispatch uses the ordinary delivery worker. */
3117
+ export declare function runWebhookReplayCycle(options: WebhookReplayCycleOptions): Promise<{
3118
+ readonly claimed: number;
3119
+ readonly settled: number;
3120
+ readonly abandoned: number;
3121
+ }>;
3122
+ //#endregion
3123
+ export type { MemoryWebhookDeliveryStoreOptions, MemoryWebhookSubscriptionStoreOptions, PostgresWebhookDeliveryStoreOptions, PostgresWebhookSubscriptionStoreOptions, WebhookActionParameterCode, WebhookActionParameterRead, WebhookActionRefusalCode, WebhookActorEnrichmentRequest, WebhookActorEnrichmentResult, WebhookActorRequirementInput, WebhookAdmissionDecision, WebhookAdmissionDenialCode, WebhookAdmissionDenialRecord, WebhookAdmissionInput, WebhookAttemptBeginResult, WebhookAttemptOutcome, WebhookAttemptReasonCode, WebhookCallOptions, WebhookClaimRequest, WebhookClassifyOptions, WebhookClock, WebhookCompositePublisherOptions, WebhookCompositeSink, WebhookConfigErrorCode, WebhookConfigurationWriteResult, WebhookCreateSubscriptionParameters, WebhookDeliveryActionEventType, WebhookDeliveryActionName, WebhookDeliveryActionParameters, WebhookDeliveryAttemptFinish, WebhookDeliveryAttemptInFlight, WebhookDeliveryAttemptLogEntry, WebhookDeliveryAttemptRecord, WebhookDeliveryAttemptStart, WebhookDeliveryAuthorization, WebhookDeliveryAuthorizationDecision, WebhookDeliveryAuthorizationInput, WebhookDeliveryBodyV1, WebhookDeliveryClassification, WebhookDeliveryConfiguration, WebhookDeliveryConfigurationInput, WebhookDeliveryCycleEvent, WebhookDeliveryCycleOptions, WebhookDeliveryCycleResult, WebhookDeliveryCycleResultKind, WebhookDeliveryErrorCode, WebhookDeliveryIntent, WebhookDeliveryIntentStatus, WebhookDeliveryLeaseCheck, WebhookDeliveryLimits, WebhookDeliveryModuleOptions, WebhookDeliveryObservation, WebhookDeliveryStore, WebhookDestinationResolution, WebhookDestinationResolver, WebhookDestinationResolverOptions, WebhookDestinationUrlCheck, WebhookDiagnosticCode, WebhookDnsLookup, WebhookEgressPayload, WebhookEgressProjectionInput, WebhookEgressSubscription, WebhookEligibilityRevision, WebhookEmergencyRotationParameters, WebhookEventActorReader, WebhookEventActorReading, WebhookEventAdmission, WebhookEventMetadata, WebhookEventTypePolicy, WebhookFanOutCycleOptions, WebhookFanOutCycleResult, WebhookFanOutErrorCode, WebhookFanOutJob, WebhookFanOutJobDraft, WebhookFanOutJobFence, WebhookFanOutJobStatus, WebhookFanOutPublisherOptions, WebhookFencedInsertResult, WebhookFencedWrite, WebhookGovernedActionErrorCode, WebhookInputErrorCode, WebhookInsertResult, WebhookIntentRequeueParameters, WebhookJobActor, WebhookJobParameters, WebhookJsonObject, WebhookJsonValue, WebhookLease, WebhookOperatorAuthorization, WebhookOperatorAuthorizationInput, WebhookPayloadPolicy, WebhookPersistenceProjectionOptions, WebhookPostgresConnection, WebhookPostgresPool, WebhookPostgresQueryable, WebhookPostgresResult, WebhookProjectionErrorCode, WebhookPurgeResult, WebhookRandomSource, WebhookRedactionResult, WebhookRenderInput, WebhookRenderedBody, WebhookReplayCycleOptions, WebhookReplayEventsParameters, WebhookReplayItem, WebhookReplayJobKey, WebhookReplayKey, WebhookReplayOptions, WebhookReplayOutcome, WebhookReplayReceipt, WebhookReplayRefusal, WebhookReplayRequestInput, WebhookReplayRequestResult, WebhookReplaySettlement, WebhookReplaySettlementResult, WebhookReplaySkipReason, WebhookReplayStore, WebhookReplaySubscriptionReader, WebhookRequestHeaderInput, WebhookRequeueEvidence, WebhookRequeueRequest, WebhookRequeueResult, WebhookResolvedAddress, WebhookRetryDelay, WebhookRetryDelayOptions, WebhookRevocationCode, WebhookScope, WebhookScopeInput, WebhookScopePredicate, WebhookSecretReferenceVerifier, WebhookSignRequest, WebhookSignatureScheme, WebhookSigner, WebhookSourceEnvelope, WebhookStagedRotationParameters, WebhookStoreErrorCode, WebhookSubscriptionSnapshot, WebhookSubscriptionStatus, WebhookSubscriptionStore, WebhookSubscriptionTransitionInput, WebhookSubscriptionTransitionParameters, WebhookSubscriptionWriteRefusal, WebhookSubscriptionWriteResult, WebhookSubscriptionWriter, WebhookTombstone, WebhookTransactionCheckpointStage, WebhookTransport, WebhookTransportRequest, WebhookTransportResult, WebhookUpdateSubscriptionParameters, WebhookVettedDestination };