@crvouga/mockingbird-service-oauth 1.10.2 → 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-MIWUE2CX.js";
7
- import "./chunk-UPHZJZII.js";
6
+ } from "./chunk-2BINFVVC.js";
7
+ import "./chunk-I76SEED6.js";
8
8
 
9
9
  // src/cli.ts
10
10
  var code = await runCli(
package/dist/index.d.ts CHANGED
@@ -207,6 +207,15 @@ type FaultCandidate = {
207
207
  namespace: string;
208
208
  };
209
209
  type FaultRegistry = {
210
+ isolateNamespaces(): void;
211
+ snapshot(namespace: string): {
212
+ rules: (FaultRule & {
213
+ remaining: number | null;
214
+ hits: number;
215
+ position: number;
216
+ })[];
217
+ rngState: number;
218
+ };
210
219
  add(rule: FaultRule): FaultRule;
211
220
  list(): (FaultRule & {
212
221
  remaining: number | null;
@@ -214,6 +223,14 @@ type FaultRegistry = {
214
223
  })[];
215
224
  remove(id: string): boolean;
216
225
  clear(): void;
226
+ restore(namespace: string, state: {
227
+ rules: (FaultRule & {
228
+ remaining: number | null;
229
+ hits: number;
230
+ position: number;
231
+ })[];
232
+ rngState: number;
233
+ }): void;
217
234
  /**
218
235
  * Every fault this request should get, in rule order, stopping at the first that answers
219
236
  * or drops (effect-only and delay-only rules let later rules match too). Consumes one of
@@ -391,8 +408,8 @@ type MetricsReport = {
391
408
  };
392
409
  type Metrics = {
393
410
  record(entry: RequestLog): void;
394
- report(): MetricsReport;
395
- reset(): void;
411
+ report(namespace?: string): MetricsReport;
412
+ reset(namespace?: string): void;
396
413
  };
397
414
 
398
415
  /** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
@@ -546,6 +563,9 @@ type PublishInput = {
546
563
  id?: string;
547
564
  };
548
565
  type WebhookHub = {
566
+ pending(namespace: string): number;
567
+ snapshot(namespace: string): unknown;
568
+ restore(namespace: string, snapshot: unknown): void;
549
569
  publish(input: PublishInput): WebhookMessage;
550
570
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
551
571
  setEndpoints(namespace: string, endpoints: WebhookEndpoint[]): WebhookEndpoint[];
@@ -573,6 +593,8 @@ type ServiceTimelineState = Readonly<{
573
593
  }>;
574
594
  type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
575
595
  type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
596
+ /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
597
+ stop?(): void;
576
598
  readonly name: string;
577
599
  readonly sqlite: SqliteClient$1;
578
600
  readonly clock: Clock;
@@ -583,6 +605,13 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
583
605
  readonly credentials: CredentialRegistry;
584
606
  /** The webhook hub, when the service has outbound webhooks. */
585
607
  readonly webhooks: WebhookHub | undefined;
608
+ /** Enable independent namespace clocks and PRNGs before serving a fleet. */
609
+ isolateNamespaces(): void;
610
+ namespaceClock(namespace?: string): Clock;
611
+ namespaceOf(request: Request): string;
612
+ /** Opaque in-process checkpoint including records, controls and webhook history. */
613
+ fleetSnapshot(namespace: string): object;
614
+ fleetRestore(snapshot: unknown, namespace: string): void;
586
615
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
587
616
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
588
617
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
@@ -1083,6 +1112,7 @@ declare const supportedOperationIds: readonly ["Discovery", "Jwks", "Authorize",
1083
1112
  declare const OAUTH_PRESETS: Record<string, FaultPreset>;
1084
1113
  type OAuthRuntimeOptions = Omit<OAuthAPIOptions, "namespace" | "now" | "publicNamespace"> & {
1085
1114
  clock?: Clock;
1115
+ adminPrefix?: string;
1086
1116
  adminKey?: string;
1087
1117
  seed?: number | string;
1088
1118
  sqlite?: SqliteClient;
@@ -1101,6 +1131,7 @@ type OAuthMultiRuntimeOptions = {
1101
1131
  mounts: OAuthMount[];
1102
1132
  clock?: Clock;
1103
1133
  sqlite?: SqliteClient;
1134
+ adminPrefix?: string;
1104
1135
  adminKey?: string;
1105
1136
  seed?: number | string;
1106
1137
  };
@@ -1125,6 +1156,7 @@ type OAuthAPIOptions = APIOptions & CredentialOptions & {
1125
1156
  issuer?: string;
1126
1157
  /** Path at which a composed runtime is publicly mounted. */
1127
1158
  mountPath?: string;
1159
+ adminPrefix?: string;
1128
1160
  publicNamespace?: string;
1129
1161
  accounts?: Account[];
1130
1162
  clients?: Client[];
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  document,
8
8
  operationIds,
9
9
  supportedOperationIds
10
- } from "./chunk-UPHZJZII.js";
10
+ } from "./chunk-I76SEED6.js";
11
11
  export {
12
12
  OAUTH_PRESETS,
13
13
  OAUTH_SCENARIOS,
package/dist/server.d.ts CHANGED
@@ -154,6 +154,15 @@ type FaultCandidate$1 = {
154
154
  namespace: string;
155
155
  };
156
156
  type FaultRegistry$1 = {
157
+ isolateNamespaces(): void;
158
+ snapshot(namespace: string): {
159
+ rules: (FaultRule$1 & {
160
+ remaining: number | null;
161
+ hits: number;
162
+ position: number;
163
+ })[];
164
+ rngState: number;
165
+ };
157
166
  add(rule: FaultRule$1): FaultRule$1;
158
167
  list(): (FaultRule$1 & {
159
168
  remaining: number | null;
@@ -161,6 +170,14 @@ type FaultRegistry$1 = {
161
170
  })[];
162
171
  remove(id: string): boolean;
163
172
  clear(): void;
173
+ restore(namespace: string, state: {
174
+ rules: (FaultRule$1 & {
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
@@ -325,8 +342,8 @@ type MetricsReport$1 = {
325
342
  };
326
343
  type Metrics$1 = {
327
344
  record(entry: RequestLog$1): void;
328
- report(): MetricsReport$1;
329
- reset(): void;
345
+ report(namespace?: string): MetricsReport$1;
346
+ reset(namespace?: string): void;
330
347
  };
331
348
 
332
349
  /** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
@@ -480,6 +497,9 @@ type PublishInput$1 = {
480
497
  id?: string;
481
498
  };
482
499
  type WebhookHub$1 = {
500
+ pending(namespace: string): number;
501
+ snapshot(namespace: string): unknown;
502
+ restore(namespace: string, snapshot: unknown): void;
483
503
  publish(input: PublishInput$1): WebhookMessage$1;
484
504
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
485
505
  setEndpoints(namespace: string, endpoints: WebhookEndpoint$1[]): WebhookEndpoint$1[];
@@ -507,6 +527,8 @@ type ServiceTimelineState$1 = Readonly<{
507
527
  }>;
508
528
  type ServiceCheckpoint$1 = Checkpoint$1<ServiceTimelineState$1>;
509
529
  type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$1 & {
530
+ /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
531
+ stop?(): void;
510
532
  readonly name: string;
511
533
  readonly sqlite: SqliteClient$2;
512
534
  readonly clock: Clock$1;
@@ -517,6 +539,13 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$1 & {
517
539
  readonly credentials: CredentialRegistry$1;
518
540
  /** The webhook hub, when the service has outbound webhooks. */
519
541
  readonly webhooks: WebhookHub$1 | undefined;
542
+ /** Enable independent namespace clocks and PRNGs before serving a fleet. */
543
+ isolateNamespaces(): void;
544
+ namespaceClock(namespace?: string): Clock$1;
545
+ namespaceOf(request: Request): string;
546
+ /** Opaque in-process checkpoint including records, controls and webhook history. */
547
+ fleetSnapshot(namespace: string): object;
548
+ fleetRestore(snapshot: unknown, namespace: string): void;
520
549
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
521
550
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule$1>): FaultRule$1[];
522
551
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
@@ -563,6 +592,7 @@ type CliOption = {
563
592
  };
564
593
  type CliValues = Record<string, string | boolean | undefined>;
565
594
  type CommonServeOptions = {
595
+ adminPrefix?: string;
566
596
  adminKey: string | undefined;
567
597
  seed: string | undefined;
568
598
  onLog: ((entry: RequestLog$1) => void) | undefined;
@@ -780,6 +810,15 @@ type FaultCandidate = {
780
810
  namespace: string;
781
811
  };
782
812
  type FaultRegistry = {
813
+ isolateNamespaces(): void;
814
+ snapshot(namespace: string): {
815
+ rules: (FaultRule & {
816
+ remaining: number | null;
817
+ hits: number;
818
+ position: number;
819
+ })[];
820
+ rngState: number;
821
+ };
783
822
  add(rule: FaultRule): FaultRule;
784
823
  list(): (FaultRule & {
785
824
  remaining: number | null;
@@ -787,6 +826,14 @@ type FaultRegistry = {
787
826
  })[];
788
827
  remove(id: string): boolean;
789
828
  clear(): void;
829
+ restore(namespace: string, state: {
830
+ rules: (FaultRule & {
831
+ remaining: number | null;
832
+ hits: number;
833
+ position: number;
834
+ })[];
835
+ rngState: number;
836
+ }): void;
790
837
  /**
791
838
  * Every fault this request should get, in rule order, stopping at the first that answers
792
839
  * or drops (effect-only and delay-only rules let later rules match too). Consumes one of
@@ -964,8 +1011,8 @@ type MetricsReport = {
964
1011
  };
965
1012
  type Metrics = {
966
1013
  record(entry: RequestLog): void;
967
- report(): MetricsReport;
968
- reset(): void;
1014
+ report(namespace?: string): MetricsReport;
1015
+ reset(namespace?: string): void;
969
1016
  };
970
1017
 
971
1018
  /** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
@@ -1119,6 +1166,9 @@ type PublishInput = {
1119
1166
  id?: string;
1120
1167
  };
1121
1168
  type WebhookHub = {
1169
+ pending(namespace: string): number;
1170
+ snapshot(namespace: string): unknown;
1171
+ restore(namespace: string, snapshot: unknown): void;
1122
1172
  publish(input: PublishInput): WebhookMessage;
1123
1173
  /** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
1124
1174
  setEndpoints(namespace: string, endpoints: WebhookEndpoint[]): WebhookEndpoint[];
@@ -1146,6 +1196,8 @@ type ServiceTimelineState = Readonly<{
1146
1196
  }>;
1147
1197
  type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
1148
1198
  type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
1199
+ /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
1200
+ stop?(): void;
1149
1201
  readonly name: string;
1150
1202
  readonly sqlite: SqliteClient$1;
1151
1203
  readonly clock: Clock;
@@ -1156,6 +1208,13 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
1156
1208
  readonly credentials: CredentialRegistry;
1157
1209
  /** The webhook hub, when the service has outbound webhooks. */
1158
1210
  readonly webhooks: WebhookHub | undefined;
1211
+ /** Enable independent namespace clocks and PRNGs before serving a fleet. */
1212
+ isolateNamespaces(): void;
1213
+ namespaceClock(namespace?: string): Clock;
1214
+ namespaceOf(request: Request): string;
1215
+ /** Opaque in-process checkpoint including records, controls and webhook history. */
1216
+ fleetSnapshot(namespace: string): object;
1217
+ fleetRestore(snapshot: unknown, namespace: string): void;
1159
1218
  /** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
1160
1219
  applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
1161
1220
  /** The instance behind `namespace` (the default one when omitted), created on first use. */
@@ -1495,6 +1554,7 @@ type OAuthAPIOptions = APIOptions & CredentialOptions & {
1495
1554
  issuer?: string;
1496
1555
  /** Path at which a composed runtime is publicly mounted. */
1497
1556
  mountPath?: string;
1557
+ adminPrefix?: string;
1498
1558
  publicNamespace?: string;
1499
1559
  accounts?: Account[];
1500
1560
  clients?: Client[];
@@ -1594,6 +1654,7 @@ declare class OAuthAPI {
1594
1654
 
1595
1655
  type OAuthRuntimeOptions = Omit<OAuthAPIOptions, "namespace" | "now" | "publicNamespace"> & {
1596
1656
  clock?: Clock;
1657
+ adminPrefix?: string;
1597
1658
  adminKey?: string;
1598
1659
  seed?: number | string;
1599
1660
  sqlite?: SqliteClient;
@@ -1611,6 +1672,7 @@ type OAuthMultiRuntimeOptions = {
1611
1672
  mounts: OAuthMount[];
1612
1673
  clock?: Clock;
1613
1674
  sqlite?: SqliteClient;
1675
+ adminPrefix?: string;
1614
1676
  adminKey?: string;
1615
1677
  seed?: number | string;
1616
1678
  };
package/dist/server.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createMultiServer,
4
4
  createServer,
5
5
  serveTarget
6
- } from "./chunk-MIWUE2CX.js";
7
- import "./chunk-UPHZJZII.js";
6
+ } from "./chunk-2BINFVVC.js";
7
+ import "./chunk-I76SEED6.js";
8
8
  export {
9
9
  DEFAULT_PORT,
10
10
  createMultiServer,