@crvouga/mockingbird-service-rxvortex 1.8.1 → 2.0.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-U5XXCFRO.js";
7
- import "./chunk-CNQMYSGI.js";
6
+ } from "./chunk-6OVK7IUG.js";
7
+ import "./chunk-MYXNLMD7.js";
8
8
 
9
9
  // src/cli.ts
10
10
  var code = await runCli(
package/dist/index.d.ts CHANGED
@@ -219,6 +219,15 @@ type FaultCandidate = {
219
219
  namespace: string;
220
220
  };
221
221
  type FaultRegistry = {
222
+ isolateNamespaces(): void;
223
+ snapshot(namespace: string): {
224
+ rules: (FaultRule & {
225
+ remaining: number | null;
226
+ hits: number;
227
+ position: number;
228
+ })[];
229
+ rngState: number;
230
+ };
222
231
  add(rule: FaultRule): FaultRule;
223
232
  list(): (FaultRule & {
224
233
  remaining: number | null;
@@ -226,6 +235,14 @@ type FaultRegistry = {
226
235
  })[];
227
236
  remove(id: string): boolean;
228
237
  clear(): void;
238
+ restore(namespace: string, state: {
239
+ rules: (FaultRule & {
240
+ remaining: number | null;
241
+ hits: number;
242
+ position: number;
243
+ })[];
244
+ rngState: number;
245
+ }): void;
229
246
  /**
230
247
  * Every fault this request should get, in rule order, stopping at the first that answers
231
248
  * or drops (effect-only and delay-only rules let later rules match too). Consumes one of
@@ -403,8 +420,8 @@ type MetricsReport = {
403
420
  };
404
421
  type Metrics = {
405
422
  record(entry: RequestLog): void;
406
- report(): MetricsReport;
407
- reset(): void;
423
+ report(namespace?: string): MetricsReport;
424
+ reset(namespace?: string): void;
408
425
  };
409
426
 
410
427
  /** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
@@ -570,6 +587,9 @@ type PublishInput = {
570
587
  id?: string;
571
588
  };
572
589
  type WebhookHub = {
590
+ pending(namespace: string): number;
591
+ snapshot(namespace: string): unknown;
592
+ restore(namespace: string, snapshot: unknown): void;
573
593
  publish(input: PublishInput): WebhookMessage;
574
594
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
575
595
  setEndpoints(namespace: string, endpoints: WebhookEndpoint[]): WebhookEndpoint[];
@@ -597,6 +617,8 @@ type ServiceTimelineState = Readonly<{
597
617
  }>;
598
618
  type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
599
619
  type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
620
+ /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
621
+ stop?(): void;
600
622
  readonly name: string;
601
623
  readonly sqlite: SqliteClient$1;
602
624
  readonly clock: Clock;
@@ -607,6 +629,13 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
607
629
  readonly credentials: CredentialRegistry;
608
630
  /** The webhook hub, when the service has outbound webhooks. */
609
631
  readonly webhooks: WebhookHub | undefined;
632
+ /** Enable independent namespace clocks and PRNGs before serving a fleet. */
633
+ isolateNamespaces(): void;
634
+ namespaceClock(namespace?: string): Clock;
635
+ namespaceOf(request: Request): string;
636
+ /** Opaque in-process checkpoint including records, controls and webhook history. */
637
+ fleetSnapshot(namespace: string): object;
638
+ fleetRestore(snapshot: unknown, namespace: string): void;
610
639
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
611
640
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
612
641
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
@@ -948,6 +977,7 @@ type RxVortexRuntimeOptions = {
948
977
  sqlite?: SqliteClient;
949
978
  clock?: Clock;
950
979
  seed?: number | string;
980
+ adminPrefix?: string;
951
981
  adminKey?: string;
952
982
  onLog?: (entry: RequestLog) => void;
953
983
  /**
@@ -975,8 +1005,8 @@ type RxVortexRuntime = ServiceRuntime<RxVortexAPI> & {
975
1005
  stop(): void;
976
1006
  };
977
1007
  /**
978
- * The RxVortex mock with Mockingbird's full service contract: `/health`, `/__admin/*`,
979
- * namespaces by header, by `/ns/<name>` path prefix, or by client id
1008
+ * The RxVortex mock with Mockingbird's full service contract: `/__admin/health`, `/__admin/*`,
1009
+ * namespaces by header, by `/__admin/ns/<name>` path prefix, or by client id
980
1010
  * (`PUT /__admin/credentials {"credentials": {"<RXVORTEX_CLIENT_ID>": "<namespace>"}}`),
981
1011
  * clock control, fault presets, signed status webhooks and a request journal.
982
1012
  */
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  parseCatalogItem,
12
12
  supportedOperationIds,
13
13
  tokenCredential
14
- } from "./chunk-CNQMYSGI.js";
14
+ } from "./chunk-MYXNLMD7.js";
15
15
  export {
16
16
  CUSTOM_CREAM_ANCHOR_PRESET_ID,
17
17
  DEFAULT_CATALOG,
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$1[]): WebhookEndpoint$1[];
@@ -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. */
@@ -564,6 +593,7 @@ type CliOption = {
564
593
  };
565
594
  type CliValues = Record<string, string | boolean | undefined>;
566
595
  type CommonServeOptions = {
596
+ adminPrefix?: string;
567
597
  adminKey: string | undefined;
568
598
  seed: string | undefined;
569
599
  onLog: ((entry: RequestLog$1) => void) | undefined;
@@ -795,6 +825,15 @@ type FaultCandidate = {
795
825
  namespace: string;
796
826
  };
797
827
  type FaultRegistry = {
828
+ isolateNamespaces(): void;
829
+ snapshot(namespace: string): {
830
+ rules: (FaultRule & {
831
+ remaining: number | null;
832
+ hits: number;
833
+ position: number;
834
+ })[];
835
+ rngState: number;
836
+ };
798
837
  add(rule: FaultRule): FaultRule;
799
838
  list(): (FaultRule & {
800
839
  remaining: number | null;
@@ -802,6 +841,14 @@ type FaultRegistry = {
802
841
  })[];
803
842
  remove(id: string): boolean;
804
843
  clear(): void;
844
+ restore(namespace: string, state: {
845
+ rules: (FaultRule & {
846
+ remaining: number | null;
847
+ hits: number;
848
+ position: number;
849
+ })[];
850
+ rngState: number;
851
+ }): void;
805
852
  /**
806
853
  * Every fault this request should get, in rule order, stopping at the first that answers
807
854
  * or drops (effect-only and delay-only rules let later rules match too). Consumes one of
@@ -979,8 +1026,8 @@ type MetricsReport = {
979
1026
  };
980
1027
  type Metrics = {
981
1028
  record(entry: RequestLog): void;
982
- report(): MetricsReport;
983
- reset(): void;
1029
+ report(namespace?: string): MetricsReport;
1030
+ reset(namespace?: string): void;
984
1031
  };
985
1032
 
986
1033
  /** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
@@ -1146,6 +1193,9 @@ type PublishInput = {
1146
1193
  id?: string;
1147
1194
  };
1148
1195
  type WebhookHub = {
1196
+ pending(namespace: string): number;
1197
+ snapshot(namespace: string): unknown;
1198
+ restore(namespace: string, snapshot: unknown): void;
1149
1199
  publish(input: PublishInput): WebhookMessage;
1150
1200
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
1151
1201
  setEndpoints(namespace: string, endpoints: WebhookEndpoint[]): WebhookEndpoint[];
@@ -1173,6 +1223,8 @@ type ServiceTimelineState = Readonly<{
1173
1223
  }>;
1174
1224
  type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
1175
1225
  type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1226
+ /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
1227
+ stop?(): void;
1176
1228
  readonly name: string;
1177
1229
  readonly sqlite: SqliteClient$1;
1178
1230
  readonly clock: Clock;
@@ -1183,6 +1235,13 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1183
1235
  readonly credentials: CredentialRegistry;
1184
1236
  /** The webhook hub, when the service has outbound webhooks. */
1185
1237
  readonly webhooks: WebhookHub | undefined;
1238
+ /** Enable independent namespace clocks and PRNGs before serving a fleet. */
1239
+ isolateNamespaces(): void;
1240
+ namespaceClock(namespace?: string): Clock;
1241
+ namespaceOf(request: Request): string;
1242
+ /** Opaque in-process checkpoint including records, controls and webhook history. */
1243
+ fleetSnapshot(namespace: string): object;
1244
+ fleetRestore(snapshot: unknown, namespace: string): void;
1186
1245
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
1187
1246
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
1188
1247
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
@@ -1393,6 +1452,7 @@ type RxVortexRuntimeOptions = {
1393
1452
  sqlite?: SqliteClient;
1394
1453
  clock?: Clock;
1395
1454
  seed?: number | string;
1455
+ adminPrefix?: string;
1396
1456
  adminKey?: string;
1397
1457
  onLog?: (entry: RequestLog) => void;
1398
1458
  /**
package/dist/server.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createServer,
4
4
  loadCatalogFile,
5
5
  serveTarget
6
- } from "./chunk-U5XXCFRO.js";
7
- import "./chunk-CNQMYSGI.js";
6
+ } from "./chunk-6OVK7IUG.js";
7
+ import "./chunk-MYXNLMD7.js";
8
8
  export {
9
9
  DEFAULT_PORT,
10
10
  createServer,