@crvouga/mockingbird-service-junction 1.8.1 → 1.9.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-HTA5IZVB.js";
7
+ } from "./chunk-S4CJ5QWE.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-GDU23FW6.js";
15
+ } from "./chunk-WL4WPDHG.js";
16
16
  import {
17
17
  defaultCorpus
18
18
  } from "./chunk-C2UGIPPM.js";
package/dist/index.d.ts CHANGED
@@ -154,6 +154,15 @@ type FaultCandidate = {
154
154
  namespace: string;
155
155
  };
156
156
  type FaultRegistry = {
157
+ isolateNamespaces(): void;
158
+ snapshot(namespace: string): {
159
+ rules: (FaultRule & {
160
+ remaining: number | null;
161
+ hits: number;
162
+ position: number;
163
+ })[];
164
+ rngState: number;
165
+ };
157
166
  add(rule: FaultRule): FaultRule;
158
167
  list(): (FaultRule & {
159
168
  remaining: number | null;
@@ -161,6 +170,14 @@ type FaultRegistry = {
161
170
  })[];
162
171
  remove(id: string): boolean;
163
172
  clear(): void;
173
+ restore(namespace: string, state: {
174
+ rules: (FaultRule & {
175
+ remaining: number | null;
176
+ hits: number;
177
+ position: number;
178
+ })[];
179
+ rngState: number;
180
+ }): void;
164
181
  /**
165
182
  * Every fault this request should get, in rule order, stopping at the first that answers
166
183
  * or drops (effect-only and delay-only rules let later rules match too). Consumes one of
@@ -338,8 +355,8 @@ type MetricsReport = {
338
355
  };
339
356
  type Metrics = {
340
357
  record(entry: RequestLog): void;
341
- report(): MetricsReport;
342
- reset(): void;
358
+ report(namespace?: string): MetricsReport;
359
+ reset(namespace?: string): void;
343
360
  };
344
361
 
345
362
  /** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
@@ -493,6 +510,9 @@ type PublishInput = {
493
510
  id?: string;
494
511
  };
495
512
  type WebhookHub = {
513
+ pending(namespace: string): number;
514
+ snapshot(namespace: string): unknown;
515
+ restore(namespace: string, snapshot: unknown): void;
496
516
  publish(input: PublishInput): WebhookMessage;
497
517
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
498
518
  setEndpoints(namespace: string, endpoints: WebhookEndpoint$1[]): WebhookEndpoint$1[];
@@ -520,6 +540,8 @@ type ServiceTimelineState = Readonly<{
520
540
  }>;
521
541
  type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
522
542
  type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
543
+ /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
544
+ stop?(): void;
523
545
  readonly name: string;
524
546
  readonly sqlite: SqliteClient$1;
525
547
  readonly clock: Clock;
@@ -530,6 +552,13 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
530
552
  readonly credentials: CredentialRegistry;
531
553
  /** The webhook hub, when the service has outbound webhooks. */
532
554
  readonly webhooks: WebhookHub | undefined;
555
+ /** Enable independent namespace clocks and PRNGs before serving a fleet. */
556
+ isolateNamespaces(): void;
557
+ namespaceClock(namespace?: string): Clock;
558
+ namespaceOf(request: Request): string;
559
+ /** Opaque in-process checkpoint including records, controls and webhook history. */
560
+ fleetSnapshot(namespace: string): object;
561
+ fleetRestore(snapshot: unknown, namespace: string): void;
533
562
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
534
563
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
535
564
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
@@ -1464,7 +1493,7 @@ type ExploreRng = ReturnType<typeof createExploreRng>;
1464
1493
 
1465
1494
  /** Stable address fields so availability observation-cache keys match prefetch (85004). */
1466
1495
  declare const AVAILABILITY_ADDRESS: {
1467
- readonly first_line: "1 N Central Ave";
1496
+ readonly first_line: "West Lincoln Street";
1468
1497
  readonly second_line: string | null;
1469
1498
  readonly city: "Phoenix";
1470
1499
  readonly state: "AZ";
package/dist/index.js CHANGED
@@ -53,7 +53,7 @@ import {
53
53
  supportedOperationIds,
54
54
  verifyAgainstReal,
55
55
  verifySvix
56
- } from "./chunk-GDU23FW6.js";
56
+ } from "./chunk-WL4WPDHG.js";
57
57
  import {
58
58
  SEALED_CORPUS_VERSION,
59
59
  SUPPORTED_SEALED_CORPUS_VERSIONS,
package/dist/server.d.ts CHANGED
@@ -155,6 +155,15 @@ type FaultCandidate$1 = {
155
155
  namespace: string;
156
156
  };
157
157
  type FaultRegistry$1 = {
158
+ isolateNamespaces(): void;
159
+ snapshot(namespace: string): {
160
+ rules: (FaultRule$1 & {
161
+ remaining: number | null;
162
+ hits: number;
163
+ position: number;
164
+ })[];
165
+ rngState: number;
166
+ };
158
167
  add(rule: FaultRule$1): FaultRule$1;
159
168
  list(): (FaultRule$1 & {
160
169
  remaining: number | null;
@@ -162,6 +171,14 @@ type FaultRegistry$1 = {
162
171
  })[];
163
172
  remove(id: string): boolean;
164
173
  clear(): void;
174
+ restore(namespace: string, state: {
175
+ rules: (FaultRule$1 & {
176
+ remaining: number | null;
177
+ hits: number;
178
+ position: number;
179
+ })[];
180
+ rngState: number;
181
+ }): void;
165
182
  /**
166
183
  * Every fault this request should get, in rule order, stopping at the first that answers
167
184
  * or drops (effect-only and delay-only rules let later rules match too). Consumes one of
@@ -326,8 +343,8 @@ type MetricsReport$1 = {
326
343
  };
327
344
  type Metrics$1 = {
328
345
  record(entry: RequestLog$1): void;
329
- report(): MetricsReport$1;
330
- reset(): void;
346
+ report(namespace?: string): MetricsReport$1;
347
+ reset(namespace?: string): void;
331
348
  };
332
349
 
333
350
  /** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
@@ -481,6 +498,9 @@ type PublishInput$1 = {
481
498
  id?: string;
482
499
  };
483
500
  type WebhookHub$1 = {
501
+ pending(namespace: string): number;
502
+ snapshot(namespace: string): unknown;
503
+ restore(namespace: string, snapshot: unknown): void;
484
504
  publish(input: PublishInput$1): WebhookMessage$1;
485
505
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
486
506
  setEndpoints(namespace: string, endpoints: WebhookEndpoint$2[]): WebhookEndpoint$2[];
@@ -508,6 +528,8 @@ type ServiceTimelineState$1 = Readonly<{
508
528
  }>;
509
529
  type ServiceCheckpoint$1 = Checkpoint$1<ServiceTimelineState$1>;
510
530
  type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
531
+ /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
532
+ stop?(): void;
511
533
  readonly name: string;
512
534
  readonly sqlite: SqliteClient$2;
513
535
  readonly clock: Clock$1;
@@ -518,6 +540,13 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
518
540
  readonly credentials: CredentialRegistry$1;
519
541
  /** The webhook hub, when the service has outbound webhooks. */
520
542
  readonly webhooks: WebhookHub$1 | undefined;
543
+ /** Enable independent namespace clocks and PRNGs before serving a fleet. */
544
+ isolateNamespaces(): void;
545
+ namespaceClock(namespace?: string): Clock$1;
546
+ namespaceOf(request: Request): string;
547
+ /** Opaque in-process checkpoint including records, controls and webhook history. */
548
+ fleetSnapshot(namespace: string): object;
549
+ fleetRestore(snapshot: unknown, namespace: string): void;
521
550
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
522
551
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule$1>): FaultRule$1[];
523
552
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
@@ -739,6 +768,15 @@ type FaultCandidate = {
739
768
  namespace: string;
740
769
  };
741
770
  type FaultRegistry = {
771
+ isolateNamespaces(): void;
772
+ snapshot(namespace: string): {
773
+ rules: (FaultRule & {
774
+ remaining: number | null;
775
+ hits: number;
776
+ position: number;
777
+ })[];
778
+ rngState: number;
779
+ };
742
780
  add(rule: FaultRule): FaultRule;
743
781
  list(): (FaultRule & {
744
782
  remaining: number | null;
@@ -746,6 +784,14 @@ type FaultRegistry = {
746
784
  })[];
747
785
  remove(id: string): boolean;
748
786
  clear(): void;
787
+ restore(namespace: string, state: {
788
+ rules: (FaultRule & {
789
+ remaining: number | null;
790
+ hits: number;
791
+ position: number;
792
+ })[];
793
+ rngState: number;
794
+ }): void;
749
795
  /**
750
796
  * Every fault this request should get, in rule order, stopping at the first that answers
751
797
  * or drops (effect-only and delay-only rules let later rules match too). Consumes one of
@@ -923,8 +969,8 @@ type MetricsReport = {
923
969
  };
924
970
  type Metrics = {
925
971
  record(entry: RequestLog): void;
926
- report(): MetricsReport;
927
- reset(): void;
972
+ report(namespace?: string): MetricsReport;
973
+ reset(namespace?: string): void;
928
974
  };
929
975
 
930
976
  /** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
@@ -1078,6 +1124,9 @@ type PublishInput = {
1078
1124
  id?: string;
1079
1125
  };
1080
1126
  type WebhookHub = {
1127
+ pending(namespace: string): number;
1128
+ snapshot(namespace: string): unknown;
1129
+ restore(namespace: string, snapshot: unknown): void;
1081
1130
  publish(input: PublishInput): WebhookMessage;
1082
1131
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
1083
1132
  setEndpoints(namespace: string, endpoints: WebhookEndpoint$1[]): WebhookEndpoint$1[];
@@ -1105,6 +1154,8 @@ type ServiceTimelineState = Readonly<{
1105
1154
  }>;
1106
1155
  type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
1107
1156
  type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1157
+ /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
1158
+ stop?(): void;
1108
1159
  readonly name: string;
1109
1160
  readonly sqlite: SqliteClient$1;
1110
1161
  readonly clock: Clock;
@@ -1115,6 +1166,13 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1115
1166
  readonly credentials: CredentialRegistry;
1116
1167
  /** The webhook hub, when the service has outbound webhooks. */
1117
1168
  readonly webhooks: WebhookHub | undefined;
1169
+ /** Enable independent namespace clocks and PRNGs before serving a fleet. */
1170
+ isolateNamespaces(): void;
1171
+ namespaceClock(namespace?: string): Clock;
1172
+ namespaceOf(request: Request): string;
1173
+ /** Opaque in-process checkpoint including records, controls and webhook history. */
1174
+ fleetSnapshot(namespace: string): object;
1175
+ fleetRestore(snapshot: unknown, namespace: string): void;
1118
1176
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
1119
1177
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
1120
1178
  /** 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-HTA5IZVB.js";
7
- import "./chunk-GDU23FW6.js";
6
+ } from "./chunk-S4CJ5QWE.js";
7
+ import "./chunk-WL4WPDHG.js";
8
8
  import "./chunk-C2UGIPPM.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": "1.8.1",
3
+ "version": "1.9.0",
4
4
  "description": "Stateful mock 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",