@crvouga/mockingbird-service-junction 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  runCli,
5
5
  serveCommand,
6
6
  serveTarget
7
- } from "./chunk-S2GN6HLD.js";
7
+ } from "./chunk-ZTMQ5RIL.js";
8
8
  import {
9
9
  DEFAULT_JUNCTION_BASE_URL,
10
10
  createRuntime,
@@ -12,7 +12,7 @@ import {
12
12
  isSandboxKey,
13
13
  pullCorpus,
14
14
  verifyAgainstReal
15
- } from "./chunk-7VCGZYMN.js";
15
+ } from "./chunk-SN6QTJKH.js";
16
16
  import {
17
17
  defaultCorpus
18
18
  } from "./chunk-2FZJPMTR.js";
package/dist/index.d.ts CHANGED
@@ -457,6 +457,8 @@ type SnapshotDocument = {
457
457
  faults?: unknown;
458
458
  latency?: unknown;
459
459
  virtualTime?: boolean;
460
+ /** Quiescent webhook endpoints, delivery history and fault state. Contains private configuration. */
461
+ webhooks?: unknown;
460
462
  };
461
463
  /** Controls for one namespace. */
462
464
  type NamespaceControls = {
@@ -670,6 +672,8 @@ type CredentialRegistry = {
670
672
  }[];
671
673
  };
672
674
 
675
+ type OwnedTransport = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
676
+
673
677
  /**
674
678
  * A point-in-time copy of everything a service namespace holds.
675
679
  *
@@ -787,8 +791,16 @@ type PublishInput = {
787
791
  id?: string;
788
792
  };
789
793
  type WebhookHub = {
794
+ observeDeliveries(listener: (event: {
795
+ namespace: string;
796
+ state: string;
797
+ deliveryId: string;
798
+ }) => void): () => void;
799
+ setTransportPolicy(policy: OwnedTransport): void;
790
800
  pending(namespace: string): number;
791
801
  snapshot(namespace: string): unknown;
802
+ exportSnapshot(handle: unknown): unknown;
803
+ importSnapshot(namespace: string, document: unknown): unknown;
792
804
  restore(namespace: string, snapshot: unknown): void;
793
805
  publish(input: PublishInput): WebhookMessage;
794
806
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
@@ -801,7 +813,7 @@ type WebhookHub = {
801
813
  /** Run every pending retry (and release held reordered messages) now, and every retry those attempts schedule, until nothing is pending. */
802
814
  flush(): Promise<void>;
803
815
  /** Resolve once nothing is in flight. */
804
- idle(): Promise<void>;
816
+ idle(namespace?: string): Promise<void>;
805
817
  fault(namespace: string, fault: WebhookFault): void;
806
818
  clear(namespace?: string): void;
807
819
  };
@@ -845,6 +857,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
845
857
  /** Opaque in-process checkpoint including records, controls and webhook history. */
846
858
  fleetSnapshot(namespace: string): object;
847
859
  fleetRestore(snapshot: unknown, namespace: string): void;
860
+ fleetExport(snapshot: unknown): SnapshotDocument;
861
+ fleetImport(namespace: string, document: unknown): object;
848
862
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
849
863
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
850
864
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
package/dist/index.js CHANGED
@@ -53,7 +53,7 @@ import {
53
53
  supportedOperationIds,
54
54
  verifyAgainstReal,
55
55
  verifySvix
56
- } from "./chunk-7VCGZYMN.js";
56
+ } from "./chunk-SN6QTJKH.js";
57
57
  import {
58
58
  SEALED_CORPUS_VERSION,
59
59
  SUPPORTED_SEALED_CORPUS_VERSIONS,
package/dist/server.d.ts CHANGED
@@ -445,6 +445,8 @@ type SnapshotDocument$1 = {
445
445
  faults?: unknown;
446
446
  latency?: unknown;
447
447
  virtualTime?: boolean;
448
+ /** Quiescent webhook endpoints, delivery history and fault state. Contains private configuration. */
449
+ webhooks?: unknown;
448
450
  };
449
451
  /** Controls for one namespace. */
450
452
  type NamespaceControls$1 = {
@@ -658,6 +660,8 @@ type CredentialRegistry$1 = {
658
660
  }[];
659
661
  };
660
662
 
663
+ type OwnedTransport$1 = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
664
+
661
665
  /**
662
666
  * A point-in-time copy of everything a service namespace holds.
663
667
  *
@@ -775,8 +779,16 @@ type PublishInput$1 = {
775
779
  id?: string;
776
780
  };
777
781
  type WebhookHub$1 = {
782
+ observeDeliveries(listener: (event: {
783
+ namespace: string;
784
+ state: string;
785
+ deliveryId: string;
786
+ }) => void): () => void;
787
+ setTransportPolicy(policy: OwnedTransport$1): void;
778
788
  pending(namespace: string): number;
779
789
  snapshot(namespace: string): unknown;
790
+ exportSnapshot(handle: unknown): unknown;
791
+ importSnapshot(namespace: string, document: unknown): unknown;
780
792
  restore(namespace: string, snapshot: unknown): void;
781
793
  publish(input: PublishInput$1): WebhookMessage$1;
782
794
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
@@ -789,7 +801,7 @@ type WebhookHub$1 = {
789
801
  /** Run every pending retry (and release held reordered messages) now, and every retry those attempts schedule, until nothing is pending. */
790
802
  flush(): Promise<void>;
791
803
  /** Resolve once nothing is in flight. */
792
- idle(): Promise<void>;
804
+ idle(namespace?: string): Promise<void>;
793
805
  fault(namespace: string, fault: WebhookFault$1): void;
794
806
  clear(namespace?: string): void;
795
807
  };
@@ -833,6 +845,8 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
833
845
  /** Opaque in-process checkpoint including records, controls and webhook history. */
834
846
  fleetSnapshot(namespace: string): object;
835
847
  fleetRestore(snapshot: unknown, namespace: string): void;
848
+ fleetExport(snapshot: unknown): SnapshotDocument$1;
849
+ fleetImport(namespace: string, document: unknown): object;
836
850
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
837
851
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule$1>): FaultRule$1[];
838
852
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
@@ -925,6 +939,7 @@ type CommonServeOptions = {
925
939
  * `serveTarget`, which is also how `serve --config` finds services by name.
926
940
  */
927
941
  type ServeTarget = {
942
+ packageVersion?: string;
928
943
  name: string;
929
944
  defaultPort: number;
930
945
  /** Serve flags beyond the common ones. */
@@ -1393,6 +1408,8 @@ type SnapshotDocument = {
1393
1408
  faults?: unknown;
1394
1409
  latency?: unknown;
1395
1410
  virtualTime?: boolean;
1411
+ /** Quiescent webhook endpoints, delivery history and fault state. Contains private configuration. */
1412
+ webhooks?: unknown;
1396
1413
  };
1397
1414
  /** Controls for one namespace. */
1398
1415
  type NamespaceControls = {
@@ -1606,6 +1623,8 @@ type CredentialRegistry = {
1606
1623
  }[];
1607
1624
  };
1608
1625
 
1626
+ type OwnedTransport = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
1627
+
1609
1628
  /**
1610
1629
  * A point-in-time copy of everything a service namespace holds.
1611
1630
  *
@@ -1723,8 +1742,16 @@ type PublishInput = {
1723
1742
  id?: string;
1724
1743
  };
1725
1744
  type WebhookHub = {
1745
+ observeDeliveries(listener: (event: {
1746
+ namespace: string;
1747
+ state: string;
1748
+ deliveryId: string;
1749
+ }) => void): () => void;
1750
+ setTransportPolicy(policy: OwnedTransport): void;
1726
1751
  pending(namespace: string): number;
1727
1752
  snapshot(namespace: string): unknown;
1753
+ exportSnapshot(handle: unknown): unknown;
1754
+ importSnapshot(namespace: string, document: unknown): unknown;
1728
1755
  restore(namespace: string, snapshot: unknown): void;
1729
1756
  publish(input: PublishInput): WebhookMessage;
1730
1757
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
@@ -1737,7 +1764,7 @@ type WebhookHub = {
1737
1764
  /** Run every pending retry (and release held reordered messages) now, and every retry those attempts schedule, until nothing is pending. */
1738
1765
  flush(): Promise<void>;
1739
1766
  /** Resolve once nothing is in flight. */
1740
- idle(): Promise<void>;
1767
+ idle(namespace?: string): Promise<void>;
1741
1768
  fault(namespace: string, fault: WebhookFault): void;
1742
1769
  clear(namespace?: string): void;
1743
1770
  };
@@ -1781,6 +1808,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1781
1808
  /** Opaque in-process checkpoint including records, controls and webhook history. */
1782
1809
  fleetSnapshot(namespace: string): object;
1783
1810
  fleetRestore(snapshot: unknown, namespace: string): void;
1811
+ fleetExport(snapshot: unknown): SnapshotDocument;
1812
+ fleetImport(namespace: string, document: unknown): object;
1784
1813
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
1785
1814
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
1786
1815
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
package/dist/server.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createServer,
4
4
  loadCorpus,
5
5
  serveTarget
6
- } from "./chunk-S2GN6HLD.js";
7
- import "./chunk-7VCGZYMN.js";
6
+ } from "./chunk-ZTMQ5RIL.js";
7
+ import "./chunk-SN6QTJKH.js";
8
8
  import "./chunk-2FZJPMTR.js";
9
9
  import "./chunk-ISDNA2TU.js";
10
10
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-junction",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
4
4
  "description": "Stateful emulator of the Junction (Vital) user API driven by its OpenAPI contract and verified by differential property tests against the Junction sandbox.",
5
5
  "license": "MIT",
6
6
  "type": "module",