@crvouga/mockingbird-service-junction 1.8.2 → 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/CHANGELOG.md +15 -0
- package/dist/{chunk-4QHCRJO4.js → chunk-S4CJ5QWE.js} +497 -30
- package/dist/chunk-S4CJ5QWE.js.map +7 -0
- package/dist/{chunk-ADSZBAJZ.js → chunk-WL4WPDHG.js} +166 -27
- package/dist/chunk-WL4WPDHG.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +1 -1
- package/dist/server.d.ts +62 -4
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4QHCRJO4.js.map +0 -7
- package/dist/chunk-ADSZBAJZ.js.map +0 -7
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
runCli,
|
|
5
5
|
serveCommand,
|
|
6
6
|
serveTarget
|
|
7
|
-
} from "./chunk-
|
|
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-
|
|
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. */
|
package/dist/index.js
CHANGED
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-junction",
|
|
3
|
-
"version": "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",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/server.ts", "../../../adapters/node/src/cli.ts", "../../../adapters/node/src/serve.ts", "../../../adapters/node/src/listen.ts"],
|
|
4
|
-
"sourcesContent": ["/// <reference types=\"node\" />\nimport { readFile } from \"node:fs/promises\"\nimport {\n type CliValues,\n type Listening,\n listen,\n type ServeTarget,\n} from \"@crvouga/mockingbird-adapter-node\"\nimport { defaultCorpus } from \"./corpus.js\"\nimport { pullCorpus } from \"./corpus-tools.js\"\nimport { IDENTITY_MODES, type IdentityMode, type JunctionFixtures } from \"./fixtures.js\"\nimport type { LabAccountLayout } from \"./lab-account-presets.js\"\nimport { type BillingType, defaultBillingTypesFrom } from \"./lab-accounts.js\"\nimport { createRuntime, type JunctionRuntime, type JunctionRuntimeOptions } from \"./runtime.js\"\nimport { parseSealedCorpus, type SealedCorpus } from \"./sealed-corpus.js\"\nimport type { GeoMode } from \"./state.js\"\n\n/** Port `mockingbird-junction serve` listens on when none is given. */\nexport const DEFAULT_PORT = 8787\n\n/** A corpus to serve: the shipped one, none (synthetic), a file path, or a loaded corpus. */\nexport type CorpusSource = \"default\" | \"none\" | (string & {}) | SealedCorpus\n\nexport type JunctionServerOptions = Omit<JunctionRuntimeOptions, \"corpus\"> & {\n /** Default `0`: the OS picks a free port (read it from `url` / `port`). */\n port?: number\n /** Default `127.0.0.1`. */\n host?: string\n /** Default `\"default\"`: the corpus shipped with this package. */\n corpus?: CorpusSource\n}\n\nexport type JunctionServer = Listening & { runtime: JunctionRuntime }\n\n/** Resolve a {@link CorpusSource} to a corpus, or `undefined` for synthetic data. */\nexport const loadCorpus = async (source: CorpusSource): Promise<SealedCorpus | undefined> => {\n if (typeof source !== \"string\") return source\n if (source === \"none\") return undefined\n if (source === \"default\") return defaultCorpus\n const raw = await readFile(source, \"utf8\").catch(() => undefined)\n if (raw === undefined) throw new Error(`junction mock corpus not found: ${source}`)\n return parseSealedCorpus(JSON.parse(raw))\n}\n\n/**\n * Serve the Junction mock over `node:http`. Resolves once it is listening.\n *\n * const server = await createServer()\n * // point the Vital SDK at server.url; await server.close() when done\n */\nexport const createServer = async (\n options: JunctionServerOptions = {},\n): Promise<JunctionServer> => {\n const { port, host, corpus: source, ...rest } = options\n const corpus = await loadCorpus(source ?? \"default\")\n const runtime = createRuntime({ ...rest, ...(corpus ? { corpus } : {}) })\n const listening = await listen(runtime, {\n port: port ?? 0,\n ...(host !== undefined ? { host } : {}),\n })\n return { ...listening, runtime }\n}\n\nconst asString = (value: string | boolean | undefined): string | undefined =>\n typeof value === \"string\" && value !== \"\" ? value : undefined\n\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i\n\nconst count = (value: string | undefined, flag: string): number | undefined => {\n if (value === undefined) return undefined\n if (!/^\\d+$/.test(value)) throw new Error(`${flag} must be a non-negative integer (got ${value})`)\n return Number.parseInt(value, 10)\n}\n\nconst readJson = async <T>(path: string): Promise<T> => {\n const raw = await readFile(path, \"utf8\").catch(() => undefined)\n if (raw === undefined) throw new Error(`junction mock: file not found: ${path}`)\n try {\n return JSON.parse(raw) as T\n } catch (error) {\n throw new Error(`junction mock: ${path} is not JSON (${(error as Error).message})`)\n }\n}\n\nconst retryDelays = (value: string | undefined): number[] | undefined => {\n if (value === undefined) return undefined\n const delays = value.split(\",\").map((part) => Number.parseInt(part.trim(), 10))\n if (delays.some((delay) => !Number.isFinite(delay) || delay < 0)) {\n throw new Error(`--webhook-retry-delays must be comma-separated milliseconds (got ${value})`)\n }\n return delays\n}\n\n/** `--default-billing-type bioreference=patient_bill_passthrough,quest=client_bill`. */\nconst billingDefaults = (value: string | undefined): Record<string, BillingType> | undefined => {\n if (value === undefined) return undefined\n const entries = value.split(\",\").map((part) => part.split(\"=\").map((side) => side.trim()))\n if (entries.some((entry) => entry.length !== 2 || !entry[0] || !entry[1])) {\n throw new Error(`--default-billing-type must be lab=billing_type pairs (got ${value})`)\n }\n try {\n return defaultBillingTypesFrom(Object.fromEntries(entries))\n } catch (error) {\n throw new Error(`--default-billing-type: ${(error as Error).message}`)\n }\n}\n\n/** How `serve` (and `serve --config`) builds the Junction mock from flags. */\nexport const serveTarget: ServeTarget = {\n name: \"junction\",\n defaultPort: DEFAULT_PORT,\n options: {\n corpus: {\n type: \"string\",\n value: \"<default|none|file>\",\n description: \"Corpus to serve: the shipped one, none (synthetic), or a pulled file\",\n default: \"default\",\n },\n geo: {\n type: \"string\",\n value: \"<corpus|synthetic>\",\n description: \"Unknown ZIPs: refuse (corpus) or invent coverage (synthetic)\",\n },\n \"lab-accounts\": {\n type: \"string\",\n value: \"<file>\",\n description:\n 'Lab accounts to route orders through: a JSON array, or { \"presets\": [...], \"accounts\": [...] }',\n },\n \"team-id\": {\n type: \"string\",\n value: \"<uuid>\",\n description: \"Team the mock answers as (default: the corpus's recorded team)\",\n },\n \"max-users\": {\n type: \"string\",\n value: \"<n>\",\n description: \"Enforce the sandbox's live-user cap (default: unlimited)\",\n },\n identity: {\n type: \"string\",\n value: \"<strict|adopt-users>\",\n description: \"Unknown user ids: 404 (strict) or create on first use\",\n default: \"strict\",\n },\n \"default-billing-type\": {\n type: \"string\",\n value: \"<lab=type,\u2026>\",\n description:\n \"billing_type an order for that lab gets when it omits one (default: client_bill), e.g. bioreference=patient_bill_passthrough\",\n },\n fixtures: {\n type: \"string\",\n value: \"<file>\",\n description:\n 'Users and orders every namespace starts with: { \"users\": [...], \"orders\": [...] }',\n },\n \"journal-size\": {\n type: \"string\",\n value: \"<n>\",\n description: \"Requests each namespace's journal keeps (GET /__admin/requests)\",\n default: \"1000\",\n },\n \"seed-url\": {\n type: \"string\",\n value: \"<url>\",\n description: \"Pull a corpus from this Junction team at boot (prefer a committed corpus)\",\n },\n \"seed-key\": {\n type: \"string\",\n value: \"<key>\",\n description: \"API key for --seed-url (env MOCKINGBIRD_JUNCTION_SEED_KEY)\",\n },\n \"webhook-url\": { type: \"string\", value: \"<url>\", description: \"Deliver signed webhooks here\" },\n \"webhook-secret\": {\n type: \"string\",\n value: \"<whsec_\u2026>\",\n description: \"Svix signing secret (env MOCKINGBIRD_JUNCTION_WEBHOOK_SECRET)\",\n },\n \"webhook-retry-delays\": {\n type: \"string\",\n value: \"<ms,ms,\u2026>\",\n description: \"Delay before each delivery attempt (default: Svix's schedule)\",\n },\n \"webhook-scope\": {\n type: \"string\",\n value: \"<scope>\",\n description: \"Sent as x-mockingbird-scope on every delivery\",\n },\n },\n async create(values: CliValues, common) {\n const seedUrl = asString(values[\"seed-url\"])\n const seedKey = asString(values[\"seed-key\"]) ?? process.env.MOCKINGBIRD_JUNCTION_SEED_KEY\n let corpus: SealedCorpus | undefined\n if (seedUrl !== undefined) {\n if (seedKey === undefined) throw new Error(\"--seed-url needs --seed-key\")\n console.log(\n `junction pulling a corpus from ${seedUrl} (commit one with \\`corpus pull\\` to skip this)`,\n )\n corpus = await pullCorpus({ baseUrl: seedUrl, apiKey: seedKey })\n } else {\n corpus = await loadCorpus(asString(values.corpus) ?? \"default\")\n }\n const geo = asString(values.geo)\n if (geo !== undefined && geo !== \"corpus\" && geo !== \"synthetic\") {\n throw new Error(`--geo must be corpus or synthetic (got ${geo})`)\n }\n const accountsFile = asString(values[\"lab-accounts\"])\n const labAccounts =\n accountsFile === undefined ? undefined : await readJson<LabAccountLayout>(accountsFile)\n const fixturesFile = asString(values.fixtures)\n const fixtures =\n fixturesFile === undefined ? undefined : await readJson<JunctionFixtures>(fixturesFile)\n const teamId = asString(values[\"team-id\"])\n if (teamId !== undefined && !UUID.test(teamId)) {\n throw new Error(`--team-id must be a UUID (got ${teamId})`)\n }\n const maxUsers = count(asString(values[\"max-users\"]), \"--max-users\")\n const journalSize = count(asString(values[\"journal-size\"]), \"--journal-size\")\n const identity = asString(values.identity)\n if (identity !== undefined && !IDENTITY_MODES.includes(identity as IdentityMode)) {\n throw new Error(`--identity must be one of ${IDENTITY_MODES.join(\", \")} (got ${identity})`)\n }\n const defaultBillingTypes = billingDefaults(asString(values[\"default-billing-type\"]))\n const webhookUrl = asString(values[\"webhook-url\"])\n const webhookSecret =\n asString(values[\"webhook-secret\"]) ?? process.env.MOCKINGBIRD_JUNCTION_WEBHOOK_SECRET\n if (webhookUrl !== undefined && webhookSecret === undefined) {\n throw new Error(\"--webhook-url needs --webhook-secret (the whsec_\u2026 your receiver verifies)\")\n }\n const delays = retryDelays(asString(values[\"webhook-retry-delays\"]))\n const scope = asString(values[\"webhook-scope\"])\n return createRuntime({\n ...(corpus ? { corpus } : {}),\n ...(geo ? { geo: geo as GeoMode } : {}),\n ...(labAccounts ? { labAccounts } : {}),\n ...(fixtures ? { fixtures } : {}),\n ...(teamId !== undefined ? { teamId } : {}),\n ...(maxUsers !== undefined ? { limits: { maxUsers } } : {}),\n ...(identity !== undefined ? { identity: identity as IdentityMode } : {}),\n ...(defaultBillingTypes ? { defaultBillingTypes } : {}),\n ...(journalSize !== undefined ? { journalSize } : {}),\n ...(webhookUrl !== undefined && webhookSecret !== undefined\n ? {\n webhooks: {\n url: webhookUrl,\n secret: webhookSecret,\n ...(delays ? { retryDelaysMs: delays } : {}),\n ...(scope ? { headers: { \"x-mockingbird-scope\": scope } } : {}),\n },\n }\n : {}),\n ...(common.adminKey !== undefined ? { adminKey: common.adminKey } : {}),\n ...(common.seed !== undefined ? { seed: common.seed } : {}),\n ...(common.onLog ? { onLog: common.onLog } : {}),\n })\n },\n banner(runtime) {\n const junction = runtime as JunctionRuntime\n const api = junction.instance()\n const info = api.corpusInfo()\n return [\n info\n ? `corpus ${info.label}: ${info.observations} observations, ${info.zips} ZIPs, ${info.labTests} lab tests, ${info.labAccounts} lab accounts (recorded ${info.recordedAt} from ${info.source})`\n : \"corpus none: synthetic catalog and coverage\",\n `geo ${api.geoMode}${api.geoMode === \"corpus\" ? \" (unknown ZIPs answer 424 MOCKINGBIRD_UNKNOWN_ZIP)\" : \"\"}`,\n `team ${api.teamId}`,\n `lab accounts: ${api.labAccounts().length}`,\n `limits: ${\n Object.entries(api.limits)\n .filter(([, value]) => value !== null && value !== false)\n .map(([key, value]) => `${key}=${String(value)}`)\n .join(\", \") || \"none (sandbox caps off)\"\n }`,\n `identity ${api.identity}`,\n `webhooks: ${junction.webhooks ? \"signed delivery on\" : \"off\"}`,\n \"auth: any x-vital-api-key value (e.g. sk_us_mockingbird)\",\n ]\n },\n}\n", "import { readFile } from \"node:fs/promises\"\nimport { type ParseArgsConfig, parseArgs } from \"node:util\"\nimport type { RequestLog, ServiceInstance, ServiceRuntime } from \"@crvouga/mockingbird-service\"\nimport { type Listening, listen } from \"./listen.js\"\n\nexport type CliOption = {\n type: \"string\" | \"boolean\"\n description: string\n /** Shown in help; the value placeholder, e.g. `<port>`. */\n value?: string\n default?: string | boolean\n}\n\nexport type CliValues = Record<string, string | boolean | undefined>\n\nexport type CliCommand = {\n summary: string\n usage?: string\n options?: Record<string, CliOption>\n /** Resolves to an exit code; a server command resolves only when it stops. */\n run(values: CliValues, positionals: string[]): Promise<number>\n}\n\nexport type CliSpec = {\n bin: string\n description: string\n commands: Record<string, CliCommand>\n}\n\nconst optionHelp = (options: Record<string, CliOption>): string[] =>\n Object.entries(options).map(([name, option]) => {\n const flag = `--${name}${option.type === \"string\" ? ` ${option.value ?? \"<value>\"}` : \"\"}`\n const fallback = option.default !== undefined ? ` (default: ${String(option.default)})` : \"\"\n return ` ${flag.padEnd(30)} ${option.description}${fallback}`\n })\n\nconst help = (spec: CliSpec): string =>\n [\n `${spec.bin} \u2014 ${spec.description}`,\n \"\",\n \"Usage:\",\n ` ${spec.bin} <command> [options]`,\n \"\",\n \"Commands:\",\n ...Object.entries(spec.commands).map(([name, c]) => ` ${name.padEnd(30)} ${c.summary}`),\n \"\",\n `Run \\`${spec.bin} <command> --help\\` for a command's options.`,\n ].join(\"\\n\")\n\nconst commandHelp = (spec: CliSpec, name: string, command: CliCommand): string =>\n [\n `${spec.bin} ${name} \u2014 ${command.summary}`,\n \"\",\n \"Usage:\",\n ` ${command.usage ?? `${spec.bin} ${name} [options]`}`,\n ...(command.options ? [\"\", \"Options:\", ...optionHelp(command.options)] : []),\n ].join(\"\\n\")\n\n/** Parse `argv` against `spec` and run the chosen command. Resolves to an exit code. */\nexport const runCli = async (spec: CliSpec, argv: string[]): Promise<number> => {\n // Two-word commands (`corpus pull`) win over one-word ones.\n const pair = argv.length >= 2 ? `${argv[0]} ${argv[1]}` : undefined\n const words = pair !== undefined && spec.commands[pair] ? 2 : 1\n const name = words === 2 ? pair : argv[0]\n const rest = argv.slice(words)\n if (name === undefined || name === \"--help\" || name === \"-h\" || name === \"help\") {\n console.log(help(spec))\n return 0\n }\n const command = spec.commands[name]\n if (!command) {\n console.error(`${spec.bin}: unknown command ${JSON.stringify(name)}\\n\\n${help(spec)}`)\n return 2\n }\n if (rest.includes(\"--help\") || rest.includes(\"-h\")) {\n console.log(commandHelp(spec, name, command))\n return 0\n }\n let parsed: { values: CliValues; positionals: string[] }\n try {\n parsed = parseArgs({\n args: rest,\n allowPositionals: true,\n strict: true,\n options: Object.fromEntries(\n Object.entries(command.options ?? {}).map(([key, option]) => [\n key,\n {\n type: option.type,\n ...(option.default !== undefined ? { default: option.default } : {}),\n },\n ]),\n ) as ParseArgsConfig[\"options\"],\n }) as { values: CliValues; positionals: string[] }\n } catch (error) {\n console.error(\n `${spec.bin} ${name}: ${error instanceof Error ? error.message : String(error)}\\n\\n${commandHelp(spec, name, command)}`,\n )\n return 2\n }\n return command.run(parsed.values, parsed.positionals)\n}\n\n// \u2500\u2500 serve \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport type LogFormat = \"pretty\" | \"json\" | \"off\"\n\nexport type CommonServeOptions = {\n adminKey: string | undefined\n seed: string | undefined\n onLog: ((entry: RequestLog) => void) | undefined\n}\n\n/**\n * What a service contributes to `serve`: how to build its runtime from CLI flags,\n * and what to say at startup. Every service's `./server` entry exports one as\n * `serveTarget`, which is also how `serve --config` finds services by name.\n */\nexport type ServeTarget = {\n name: string\n defaultPort: number\n /** Serve flags beyond the common ones. */\n options?: Record<string, CliOption>\n create(\n values: CliValues,\n common: CommonServeOptions,\n ): Promise<ServiceRuntime<ServiceInstance>> | ServiceRuntime<ServiceInstance>\n /** Startup lines after the listen address, e.g. the loaded corpus version. */\n banner?(runtime: ServiceRuntime<ServiceInstance>): string[]\n /** After the HTTP server is bound. A service that speaks more than HTTP attaches it here. */\n listening?(server: Listening): void\n}\n\nconst COMMON_SERVE_OPTIONS: Record<string, CliOption> = {\n port: { type: \"string\", value: \"<port>\", description: \"Port to listen on\" },\n host: { type: \"string\", value: \"<host>\", description: \"Interface to bind\", default: \"127.0.0.1\" },\n \"admin-key\": {\n type: \"string\",\n value: \"<key>\",\n description: \"Require x-mockingbird-admin-key on /__admin/* (env MOCKINGBIRD_ADMIN_KEY)\",\n },\n seed: { type: \"string\", value: \"<seed>\", description: \"Seed for every random choice\" },\n log: {\n type: \"string\",\n value: \"<pretty|json|off>\",\n description: \"Request log format\",\n default: \"pretty\",\n },\n \"log-requests\": {\n type: \"boolean\",\n description:\n \"One JSON line per request: namespace, operationId, status, ids touched (never bodies). Same as --log json\",\n },\n config: {\n type: \"string\",\n value: \"<file>\",\n description: \"Serve every service in a mockingbird.json config instead\",\n },\n}\n\nconst formatLog = (format: LogFormat) => {\n if (format === \"off\") return undefined\n if (format === \"json\") return (entry: RequestLog) => console.log(JSON.stringify(entry))\n return (entry: RequestLog) => {\n const op = entry.operationId ?? (entry.unmatched ? \"UNMATCHED\" : \"-\")\n const ns = entry.namespace === \"default\" ? \"\" : ` [${entry.namespace}]`\n const fault = entry.faultId ? ` fault=${entry.faultId}` : \"\"\n const adopted = entry.adopted ? \" adopted\" : \"\"\n // A rejection says what arrived (never the body) and why the service refused it.\n const received = entry.request\n ? ` received=${entry.request.bodyBytes === null ? \"?\" : `${entry.request.bodyBytes}B`} ct=${entry.request.contentType ?? \"-\"}${\n entry.request.transferEncoding ? ` te=${entry.request.transferEncoding}` : \"\"\n }`\n : \"\"\n const issues = entry.issues?.length\n ? ` issues=${entry.issues\n .slice(0, 3)\n .map((issue) => `${issue.path || \"$\"}: ${issue.message}`)\n .join(\"; \")}${entry.issues.length > 3 ? ` (+${entry.issues.length - 3})` : \"\"}`\n : \"\"\n console.log(\n `${entry.service} ${entry.method} ${entry.path} ${entry.status} ${op} ${entry.durationMs}ms${ns}${fault}${adopted}${received}${issues}`,\n )\n }\n}\n\nconst asString = (value: string | boolean | undefined): string | undefined =>\n typeof value === \"string\" ? value : undefined\n\n/** A service entry in `mockingbird.json`. */\nexport type ConfigService = {\n port?: number\n host?: string\n adminKey?: string\n seed?: string\n /** Service-specific serve flags, by long name: `{ \"webhook-url\": \"\u2026\" }`. */\n options?: Record<string, string | boolean>\n}\n\nexport type MockingbirdConfig = {\n /** Keyed by service name: `junction` loads `@crvouga/mockingbird-service-junction`. */\n services: Record<string, ConfigService>\n log?: LogFormat\n}\n\nconst loadTarget = async (name: string, own: ServeTarget): Promise<ServeTarget> => {\n if (name === own.name) return own\n const specifier = `@crvouga/mockingbird-service-${name}/server`\n try {\n const mod = (await import(specifier)) as { serveTarget?: ServeTarget }\n if (!mod.serveTarget) throw new Error(`${specifier} exports no serveTarget`)\n return mod.serveTarget\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n throw new Error(\n `cannot load service \"${name}\": ${reason}. Install @crvouga/mockingbird-service-${name}.`,\n )\n }\n}\n\nconst start = async (\n target: ServeTarget,\n values: CliValues,\n config: { port: number; host: string; adminKey?: string; seed?: string; log: LogFormat },\n): Promise<Listening> => {\n const runtime = await target.create(values, {\n adminKey: config.adminKey,\n seed: config.seed,\n onLog: formatLog(config.log),\n })\n const listening = await listen(runtime, { port: config.port, host: config.host })\n target.listening?.(listening)\n console.log(`${target.name} mock listening on ${listening.url}`)\n console.log(`${target.name} health: GET ${listening.url}/health`)\n console.log(\n `${target.name} admin: ${listening.url}/__admin (${config.adminKey ? \"x-mockingbird-admin-key required\" : \"open \u2014 pass --admin-key to lock\"})`,\n )\n console.log(`${target.name} admin ui: ${listening.url}/__admin/ui`)\n for (const line of target.banner?.(runtime) ?? []) console.log(`${target.name} ${line}`)\n return listening\n}\n\nconst untilSignal = async (servers: Listening[]): Promise<number> =>\n new Promise((resolve) => {\n const stop = async () => {\n await Promise.allSettled(servers.map((s) => s.close()))\n resolve(0)\n }\n process.once(\"SIGINT\", stop)\n process.once(\"SIGTERM\", stop)\n })\n\n/** The standard `serve` command for a service, including multi-service `--config`. */\nexport const serveCommand = (target: ServeTarget): CliCommand => ({\n summary: `Serve the ${target.name} mock over HTTP`,\n options: { ...COMMON_SERVE_OPTIONS, ...target.options },\n async run(values) {\n const log = (\n values[\"log-requests\"] === true ? \"json\" : (asString(values.log) ?? \"pretty\")\n ) as LogFormat\n if (![\"pretty\", \"json\", \"off\"].includes(log)) {\n console.error(`--log must be pretty, json or off (got ${log})`)\n return 2\n }\n const configPath = asString(values.config)\n if (configPath !== undefined) {\n const config = JSON.parse(await readFile(configPath, \"utf8\")) as MockingbirdConfig\n const servers: Listening[] = []\n try {\n for (const [name, entry] of Object.entries(config.services ?? {})) {\n const each = await loadTarget(name, target)\n servers.push(\n await start(each, entry.options ?? {}, {\n port: entry.port ?? each.defaultPort,\n host: entry.host ?? \"127.0.0.1\",\n ...(entry.adminKey !== undefined ? { adminKey: entry.adminKey } : {}),\n ...(entry.seed !== undefined ? { seed: entry.seed } : {}),\n log: config.log ?? log,\n }),\n )\n }\n } catch (error) {\n await Promise.allSettled(servers.map((s) => s.close()))\n console.error(error instanceof Error ? error.message : String(error))\n return 1\n }\n return untilSignal(servers)\n }\n const port = asString(values.port)\n const adminKey = asString(values[\"admin-key\"]) ?? process.env.MOCKINGBIRD_ADMIN_KEY\n const seed = asString(values.seed)\n let listening: Listening\n try {\n listening = await start(target, values, {\n port: port === undefined ? target.defaultPort : Number.parseInt(port, 10),\n host: asString(values.host) ?? \"127.0.0.1\",\n ...(adminKey !== undefined ? { adminKey } : {}),\n ...(seed !== undefined ? { seed } : {}),\n log,\n })\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error))\n return 1\n }\n return untilSignal([listening])\n },\n})\n", "import { createServer } from \"node:http\"\nimport type { FetchAPI } from \"@crvouga/mockingbird-core\"\n\n/** Options for {@link serve}. */\nexport type NodeServeOptions = {\n port?: number\n host?: string\n}\n\n/**\n * Serve any Mockingbird {@link FetchAPI} over `node:http`.\n * Port defaults to `0`, so the OS assigns an ephemeral port (read from `server.address()`).\n */\nexport const serve = async (api: FetchAPI, options: NodeServeOptions = {}) => {\n const server = createServer(async (req, res) => {\n const chunks: Buffer[] = []\n for await (const chunk of req) {\n chunks.push(Buffer.from(chunk))\n }\n const body = Buffer.concat(chunks)\n const address = server.address()\n const port = typeof address === \"object\" && address !== null ? address.port : undefined\n const base = `http://${req.headers.host ?? `localhost:${port ?? 80}`}`\n const raw = req.url ?? \"/\"\n const url = new URL(raw.replace(/^\\/+/, \"/\"), base)\n const method = req.method ?? \"GET\"\n const init: RequestInit = { method, headers: req.headers as Record<string, string> }\n if (method !== \"GET\" && method !== \"HEAD\" && body.length > 0) {\n init.body = body\n }\n const aborted = new AbortController()\n res.once(\"close\", () => {\n if (!res.writableFinished) aborted.abort()\n })\n init.signal = aborted.signal\n const request = new Request(url, init)\n let response: Response\n try {\n response = await api.fetch(request)\n } catch (error) {\n // A `drop` fault: destroy the socket so the client sees the connection die.\n if ((error as { code?: string }).code === \"MOCKINGBIRD_DROP\") {\n req.socket.destroy()\n return\n }\n res.writeHead(500, { \"content-type\": \"application/json\" })\n res.end(\n JSON.stringify({\n error: {\n type: \"mockingbird_internal\",\n message: error instanceof Error ? error.message : String(error),\n },\n }),\n )\n return\n }\n // Headers#entries() joins repeated headers; Set-Cookie must stay one header per cookie.\n const headers: Record<string, string | string[]> = Object.fromEntries(response.headers)\n const cookies = response.headers.getSetCookie()\n if (cookies.length > 0) headers[\"set-cookie\"] = cookies\n if (!response.body) {\n res.writeHead(response.status, headers)\n res.end()\n return\n }\n // Stream the body chunk by chunk: event streams and long-polls must not be buffered.\n res.writeHead(response.status, headers)\n res.flushHeaders()\n const reader = response.body.getReader()\n try {\n for (;;) {\n const { done, value } = await reader.read()\n if (done) break\n if (!res.write(value)) await new Promise<void>((resolve) => res.once(\"drain\", resolve))\n }\n res.end()\n } catch {\n res.destroy()\n } finally {\n reader.releaseLock()\n }\n })\n await new Promise<void>((resolve, reject) => {\n server.once(\"error\", reject)\n server.listen(options.port ?? 0, options.host, resolve)\n })\n return server\n}\n", "import type { Server } from \"node:http\"\nimport type { FetchAPI } from \"@crvouga/mockingbird-core\"\nimport { serve } from \"./serve.js\"\n\nexport type ListenOptions = {\n /** Default `0`: the OS picks a free port. */\n port?: number\n /** Default `127.0.0.1`: a mock should not be reachable off the machine by accident. */\n host?: string\n}\n\n/** A running server, with the address it actually bound. */\nexport type Listening = {\n url: string\n port: number\n host: string\n server: Server\n close(): Promise<void>\n}\n\nexport const listen = async (api: FetchAPI, options: ListenOptions = {}): Promise<Listening> => {\n const host = options.host ?? \"127.0.0.1\"\n const server = await serve(api, { port: options.port ?? 0, host })\n const address = server.address()\n const port = typeof address === \"object\" && address !== null ? address.port : (options.port ?? 0)\n const shown = host.includes(\":\") ? `[${host}]` : host\n return {\n url: `http://${shown}:${port}`,\n port,\n host,\n server,\n close: () =>\n new Promise<void>((resolve, reject) => {\n // Stop accepting first, then drop keep-alive sockets so close() can finish.\n server.close((error) => {\n if (error && (error as { code?: string }).code !== \"ERR_SERVER_NOT_RUNNING\") reject(error)\n else resolve()\n })\n server.closeAllConnections?.()\n }),\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AACA,SAAS,YAAAA,iBAAgB;;;ACDzB,SAAS,gBAAgB;AACzB,SAA+B,iBAAiB;;;ACDhD,SAAS,oBAAoB;AAatB,IAAM,QAAQ,OAAO,KAAe,UAA4B,CAAA,MAAM;AAC3E,QAAM,SAAS,aAAa,OAAO,KAAK,QAAO;AAC7C,UAAM,SAAmB,C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