@crvouga/mockingbird-service-paddle 2.4.0 → 2.6.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
@@ -3,8 +3,8 @@ import {
3
3
  runCli,
4
4
  serveCommand,
5
5
  serveTarget
6
- } from "./chunk-G7ZB7TLE.js";
7
- import "./chunk-ZGB3MUMB.js";
6
+ } from "./chunk-DT7SM67W.js";
7
+ import "./chunk-YR23IQKW.js";
8
8
 
9
9
  // src/cli.ts
10
10
  var code = await runCli(
package/dist/index.d.ts CHANGED
@@ -522,6 +522,8 @@ type SnapshotDocument = {
522
522
  faults?: unknown;
523
523
  latency?: unknown;
524
524
  virtualTime?: boolean;
525
+ /** Quiescent webhook endpoints, delivery history and fault state. Contains private configuration. */
526
+ webhooks?: unknown;
525
527
  };
526
528
  /** Controls for one namespace. */
527
529
  type NamespaceControls = {
@@ -735,6 +737,8 @@ type CredentialRegistry = {
735
737
  }[];
736
738
  };
737
739
 
740
+ type OwnedTransport = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
741
+
738
742
  /**
739
743
  * A point-in-time copy of everything a service namespace holds.
740
744
  *
@@ -884,8 +888,16 @@ type PublishInput = {
884
888
  id?: string;
885
889
  };
886
890
  type WebhookHub = {
891
+ observeDeliveries(listener: (event: {
892
+ namespace: string;
893
+ state: string;
894
+ deliveryId: string;
895
+ }) => void): () => void;
896
+ setTransportPolicy(policy: OwnedTransport): void;
887
897
  pending(namespace: string): number;
888
898
  snapshot(namespace: string): unknown;
899
+ exportSnapshot(handle: unknown): unknown;
900
+ importSnapshot(namespace: string, document: unknown): unknown;
889
901
  restore(namespace: string, snapshot: unknown): void;
890
902
  publish(input: PublishInput): WebhookMessage;
891
903
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
@@ -898,7 +910,7 @@ type WebhookHub = {
898
910
  /** Run every pending retry (and release held reordered messages) now, and every retry those attempts schedule, until nothing is pending. */
899
911
  flush(): Promise<void>;
900
912
  /** Resolve once nothing is in flight. */
901
- idle(): Promise<void>;
913
+ idle(namespace?: string): Promise<void>;
902
914
  fault(namespace: string, fault: WebhookFault): void;
903
915
  clear(namespace?: string): void;
904
916
  };
@@ -942,6 +954,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
942
954
  /** Opaque in-process checkpoint including records, controls and webhook history. */
943
955
  fleetSnapshot(namespace: string): object;
944
956
  fleetRestore(snapshot: unknown, namespace: string): void;
957
+ fleetExport(snapshot: unknown): SnapshotDocument;
958
+ fleetImport(namespace: string, document: unknown): object;
945
959
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
946
960
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
947
961
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  operationIds,
12
12
  paddleSigner,
13
13
  supportedOperationIds
14
- } from "./chunk-ZGB3MUMB.js";
14
+ } from "./chunk-YR23IQKW.js";
15
15
  export {
16
16
  AUTH_TOKEN_TTL_MS,
17
17
  ID_PREFIX,
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. */
@@ -1435,6 +1450,8 @@ type SnapshotDocument = {
1435
1450
  faults?: unknown;
1436
1451
  latency?: unknown;
1437
1452
  virtualTime?: boolean;
1453
+ /** Quiescent webhook endpoints, delivery history and fault state. Contains private configuration. */
1454
+ webhooks?: unknown;
1438
1455
  };
1439
1456
  /** Controls for one namespace. */
1440
1457
  type NamespaceControls = {
@@ -1648,6 +1665,8 @@ type CredentialRegistry = {
1648
1665
  }[];
1649
1666
  };
1650
1667
 
1668
+ type OwnedTransport = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
1669
+
1651
1670
  /**
1652
1671
  * A point-in-time copy of everything a service namespace holds.
1653
1672
  *
@@ -1765,8 +1784,16 @@ type PublishInput = {
1765
1784
  id?: string;
1766
1785
  };
1767
1786
  type WebhookHub = {
1787
+ observeDeliveries(listener: (event: {
1788
+ namespace: string;
1789
+ state: string;
1790
+ deliveryId: string;
1791
+ }) => void): () => void;
1792
+ setTransportPolicy(policy: OwnedTransport): void;
1768
1793
  pending(namespace: string): number;
1769
1794
  snapshot(namespace: string): unknown;
1795
+ exportSnapshot(handle: unknown): unknown;
1796
+ importSnapshot(namespace: string, document: unknown): unknown;
1770
1797
  restore(namespace: string, snapshot: unknown): void;
1771
1798
  publish(input: PublishInput): WebhookMessage;
1772
1799
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
@@ -1779,7 +1806,7 @@ type WebhookHub = {
1779
1806
  /** Run every pending retry (and release held reordered messages) now, and every retry those attempts schedule, until nothing is pending. */
1780
1807
  flush(): Promise<void>;
1781
1808
  /** Resolve once nothing is in flight. */
1782
- idle(): Promise<void>;
1809
+ idle(namespace?: string): Promise<void>;
1783
1810
  fault(namespace: string, fault: WebhookFault): void;
1784
1811
  clear(namespace?: string): void;
1785
1812
  };
@@ -1823,6 +1850,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1823
1850
  /** Opaque in-process checkpoint including records, controls and webhook history. */
1824
1851
  fleetSnapshot(namespace: string): object;
1825
1852
  fleetRestore(snapshot: unknown, namespace: string): void;
1853
+ fleetExport(snapshot: unknown): SnapshotDocument;
1854
+ fleetImport(namespace: string, document: unknown): object;
1826
1855
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
1827
1856
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
1828
1857
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
package/dist/server.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  DEFAULT_PORT,
3
3
  createServer,
4
4
  serveTarget
5
- } from "./chunk-G7ZB7TLE.js";
6
- import "./chunk-ZGB3MUMB.js";
5
+ } from "./chunk-DT7SM67W.js";
6
+ import "./chunk-YR23IQKW.js";
7
7
  export {
8
8
  DEFAULT_PORT,
9
9
  createServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-paddle",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "Stateful emulator of the Paddle Billing API (customers, addresses, businesses, products, prices, transactions with computed totals, subscriptions with pause/resume/cancel and renewals, events) with Paddle-Signature webhooks and admin routes that simulate checkout, renewals and failed payments (Mockingbird service contract).",
5
5
  "license": "MIT",
6
6
  "type": "module",