@crvouga/mockingbird-service-junction 3.3.1 → 3.5.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 +18 -0
- package/DISCOVERY.md +2 -0
- package/README.md +27 -19
- package/SUPPORT.md +1 -1
- package/dist/{chunk-7VCGZYMN.js → chunk-KMCP67GK.js} +191 -16
- package/dist/chunk-KMCP67GK.js.map +7 -0
- package/dist/chunk-Y477MTXC.js +4948 -0
- package/dist/chunk-Y477MTXC.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +89 -62
- package/dist/index.js +1 -1
- package/dist/server.d.ts +74 -32
- package/dist/server.js +2 -2
- package/openapi.yaml +2 -2
- package/package.json +4 -2
- package/dist/chunk-7VCGZYMN.js.map +0 -7
- package/dist/chunk-S2GN6HLD.js +0 -1140
- package/dist/chunk-S2GN6HLD.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-Y477MTXC.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-KMCP67GK.js";
|
|
16
16
|
import {
|
|
17
17
|
defaultCorpus
|
|
18
18
|
} from "./chunk-2FZJPMTR.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
|
|
3
|
+
type LabAccountStatus = "active" | "pending" | "suspended" | "ready_to_launch";
|
|
4
|
+
type LabAccountDelegatedFlow = "order_delegated" | "result_delegated" | "fully_delegated" | "not_delegated";
|
|
5
|
+
type LabAccountRecord = {
|
|
6
|
+
id: string;
|
|
7
|
+
lab: string;
|
|
8
|
+
org_id: string | null;
|
|
9
|
+
status: LabAccountStatus;
|
|
10
|
+
delegated_flow: LabAccountDelegatedFlow;
|
|
11
|
+
provider_account_id: string;
|
|
12
|
+
account_name: string | null;
|
|
13
|
+
default_clinical_notes: string | null;
|
|
14
|
+
business_units: string[] | null;
|
|
15
|
+
allowed_billing: Record<string, readonly string[]>;
|
|
16
|
+
team_id_allowlist: readonly string[];
|
|
17
|
+
};
|
|
18
|
+
/** The 50 `USState` values from the docs, alphabetical by state name. */
|
|
19
|
+
declare const US_STATES: readonly string[];
|
|
20
|
+
/** `billing_type` values the vendored create-order body accepts. */
|
|
21
|
+
declare const BILLING_TYPES: readonly ["client_bill", "commercial_insurance", "patient_bill_passthrough", "patient_bill", "upfront_payment"];
|
|
22
|
+
type BillingType = (typeof BILLING_TYPES)[number];
|
|
23
|
+
/** A team the mock is not, for fixtures that model another team's account. */
|
|
24
|
+
declare const OTHER_TEAM_ID: string;
|
|
25
|
+
declare const TEAM_LAB_ACCOUNTS: readonly LabAccountRecord[];
|
|
26
|
+
/**
|
|
27
|
+
* Whether `teamId` may use an account. An empty `team_id_allowlist` counts as linked:
|
|
28
|
+
* a real team's listing returns such accounts (Junction's own Quest, Labcorp and
|
|
29
|
+
* BioReference accounts carry `[]`), and the sandbox places an order that names one by id
|
|
30
|
+
* (corpus/lab-account-probes.json), so the mock treats them as the team's.
|
|
31
|
+
*/
|
|
32
|
+
declare const isLinkedToTeam: (entry: LabAccountRecord, teamId: string) => boolean;
|
|
33
|
+
type LabAccountOmissionPolicy = "platform" | "reject";
|
|
34
|
+
/**
|
|
35
|
+
* A lab account as a consumer configures it. Mirrors `ClientFacingLabAccount`, with
|
|
36
|
+
* every field but `id` and `lab` optional, plus a `states` shorthand for the common
|
|
37
|
+
* case of an account that client-bills in a fixed set of states.
|
|
38
|
+
*/
|
|
39
|
+
type LabAccountInput = {
|
|
40
|
+
id: string;
|
|
41
|
+
/** Lab slug, e.g. `"quest"`, `"labcorp"`, `"bioreference"`. */
|
|
42
|
+
lab: string;
|
|
43
|
+
status?: LabAccountStatus;
|
|
44
|
+
delegated_flow?: LabAccountDelegatedFlow;
|
|
45
|
+
account_name?: string | null;
|
|
46
|
+
provider_account_id?: string;
|
|
47
|
+
org_id?: string | null;
|
|
48
|
+
business_units?: string[] | null;
|
|
49
|
+
default_clinical_notes?: string | null;
|
|
50
|
+
/** Billing type → states it is allowed in. Takes precedence over `states`. */
|
|
51
|
+
allowed_billing?: Record<string, readonly string[]>;
|
|
52
|
+
/** Shorthand for `allowed_billing: { client_bill: states }`. Default: every state. */
|
|
53
|
+
states?: readonly string[];
|
|
54
|
+
/** Teams the account is linked to. Default: the configured team, so it is selectable. */
|
|
55
|
+
team_id_allowlist?: readonly string[];
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Normalize a consumer's configuration into the record the ordering rules read.
|
|
59
|
+
* `teamId` is the default allowlist, so an account is selectable unless told otherwise.
|
|
60
|
+
*/
|
|
61
|
+
declare const labAccountFromInput: (input: LabAccountInput, teamId?: string) => LabAccountRecord;
|
|
62
|
+
|
|
3
63
|
type MountedAPI = FetchAPI$1 & {
|
|
4
64
|
readonly prefix: string;
|
|
5
65
|
GET: FetchHandler;
|
|
@@ -457,6 +517,8 @@ type SnapshotDocument = {
|
|
|
457
517
|
faults?: unknown;
|
|
458
518
|
latency?: unknown;
|
|
459
519
|
virtualTime?: boolean;
|
|
520
|
+
/** Quiescent webhook endpoints, delivery history and fault state. Contains private configuration. */
|
|
521
|
+
webhooks?: unknown;
|
|
460
522
|
};
|
|
461
523
|
/** Controls for one namespace. */
|
|
462
524
|
type NamespaceControls = {
|
|
@@ -670,6 +732,8 @@ type CredentialRegistry = {
|
|
|
670
732
|
}[];
|
|
671
733
|
};
|
|
672
734
|
|
|
735
|
+
type OwnedTransport = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
|
|
736
|
+
|
|
673
737
|
/**
|
|
674
738
|
* A point-in-time copy of everything a service namespace holds.
|
|
675
739
|
*
|
|
@@ -787,8 +851,16 @@ type PublishInput = {
|
|
|
787
851
|
id?: string;
|
|
788
852
|
};
|
|
789
853
|
type WebhookHub = {
|
|
854
|
+
observeDeliveries(listener: (event: {
|
|
855
|
+
namespace: string;
|
|
856
|
+
state: string;
|
|
857
|
+
deliveryId: string;
|
|
858
|
+
}) => void): () => void;
|
|
859
|
+
setTransportPolicy(policy: OwnedTransport): void;
|
|
790
860
|
pending(namespace: string): number;
|
|
791
861
|
snapshot(namespace: string): unknown;
|
|
862
|
+
exportSnapshot(handle: unknown): unknown;
|
|
863
|
+
importSnapshot(namespace: string, document: unknown): unknown;
|
|
792
864
|
restore(namespace: string, snapshot: unknown): void;
|
|
793
865
|
publish(input: PublishInput): WebhookMessage;
|
|
794
866
|
/** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
|
|
@@ -801,7 +873,7 @@ type WebhookHub = {
|
|
|
801
873
|
/** Run every pending retry (and release held reordered messages) now, and every retry those attempts schedule, until nothing is pending. */
|
|
802
874
|
flush(): Promise<void>;
|
|
803
875
|
/** Resolve once nothing is in flight. */
|
|
804
|
-
idle(): Promise<void>;
|
|
876
|
+
idle(namespace?: string): Promise<void>;
|
|
805
877
|
fault(namespace: string, fault: WebhookFault): void;
|
|
806
878
|
clear(namespace?: string): void;
|
|
807
879
|
};
|
|
@@ -845,6 +917,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
|
845
917
|
/** Opaque in-process checkpoint including records, controls and webhook history. */
|
|
846
918
|
fleetSnapshot(namespace: string): object;
|
|
847
919
|
fleetRestore(snapshot: unknown, namespace: string): void;
|
|
920
|
+
fleetExport(snapshot: unknown): SnapshotDocument;
|
|
921
|
+
fleetImport(namespace: string, document: unknown): object;
|
|
848
922
|
/** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
|
|
849
923
|
applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
|
|
850
924
|
/** The instance behind `namespace` (the default one when omitted), created on first use. */
|
|
@@ -1228,65 +1302,6 @@ interface FetchAPI {
|
|
|
1228
1302
|
fetch(request: Request): Promise<Response>;
|
|
1229
1303
|
}
|
|
1230
1304
|
|
|
1231
|
-
type LabAccountStatus = "active" | "pending" | "suspended" | "ready_to_launch";
|
|
1232
|
-
type LabAccountDelegatedFlow = "order_delegated" | "result_delegated" | "fully_delegated" | "not_delegated";
|
|
1233
|
-
type LabAccountRecord = {
|
|
1234
|
-
id: string;
|
|
1235
|
-
lab: string;
|
|
1236
|
-
org_id: string | null;
|
|
1237
|
-
status: LabAccountStatus;
|
|
1238
|
-
delegated_flow: LabAccountDelegatedFlow;
|
|
1239
|
-
provider_account_id: string;
|
|
1240
|
-
account_name: string | null;
|
|
1241
|
-
default_clinical_notes: string | null;
|
|
1242
|
-
business_units: string[] | null;
|
|
1243
|
-
allowed_billing: Record<string, readonly string[]>;
|
|
1244
|
-
team_id_allowlist: readonly string[];
|
|
1245
|
-
};
|
|
1246
|
-
/** The 50 `USState` values from the docs, alphabetical by state name. */
|
|
1247
|
-
declare const US_STATES: readonly string[];
|
|
1248
|
-
/** `billing_type` values the vendored create-order body accepts. */
|
|
1249
|
-
declare const BILLING_TYPES: readonly ["client_bill", "commercial_insurance", "patient_bill_passthrough", "patient_bill", "upfront_payment"];
|
|
1250
|
-
type BillingType = (typeof BILLING_TYPES)[number];
|
|
1251
|
-
/** A team the mock is not, for fixtures that model another team's account. */
|
|
1252
|
-
declare const OTHER_TEAM_ID: string;
|
|
1253
|
-
declare const TEAM_LAB_ACCOUNTS: readonly LabAccountRecord[];
|
|
1254
|
-
/**
|
|
1255
|
-
* Whether `teamId` may use an account. An empty `team_id_allowlist` counts as linked:
|
|
1256
|
-
* a real team's listing returns such accounts (Junction's own Quest, Labcorp and
|
|
1257
|
-
* BioReference accounts carry `[]`), and the sandbox places an order that names one by id
|
|
1258
|
-
* (corpus/lab-account-probes.json), so the mock treats them as the team's.
|
|
1259
|
-
*/
|
|
1260
|
-
declare const isLinkedToTeam: (entry: LabAccountRecord, teamId: string) => boolean;
|
|
1261
|
-
/**
|
|
1262
|
-
* A lab account as a consumer configures it. Mirrors `ClientFacingLabAccount`, with
|
|
1263
|
-
* every field but `id` and `lab` optional, plus a `states` shorthand for the common
|
|
1264
|
-
* case of an account that client-bills in a fixed set of states.
|
|
1265
|
-
*/
|
|
1266
|
-
type LabAccountInput = {
|
|
1267
|
-
id: string;
|
|
1268
|
-
/** Lab slug, e.g. `"quest"`, `"labcorp"`, `"bioreference"`. */
|
|
1269
|
-
lab: string;
|
|
1270
|
-
status?: LabAccountStatus;
|
|
1271
|
-
delegated_flow?: LabAccountDelegatedFlow;
|
|
1272
|
-
account_name?: string | null;
|
|
1273
|
-
provider_account_id?: string;
|
|
1274
|
-
org_id?: string | null;
|
|
1275
|
-
business_units?: string[] | null;
|
|
1276
|
-
default_clinical_notes?: string | null;
|
|
1277
|
-
/** Billing type → states it is allowed in. Takes precedence over `states`. */
|
|
1278
|
-
allowed_billing?: Record<string, readonly string[]>;
|
|
1279
|
-
/** Shorthand for `allowed_billing: { client_bill: states }`. Default: every state. */
|
|
1280
|
-
states?: readonly string[];
|
|
1281
|
-
/** Teams the account is linked to. Default: the configured team, so it is selectable. */
|
|
1282
|
-
team_id_allowlist?: readonly string[];
|
|
1283
|
-
};
|
|
1284
|
-
/**
|
|
1285
|
-
* Normalize a consumer's configuration into the record the ordering rules read.
|
|
1286
|
-
* `teamId` is the default allowlist, so an account is selectable unless told otherwise.
|
|
1287
|
-
*/
|
|
1288
|
-
declare const labAccountFromInput: (input: LabAccountInput, teamId?: string) => LabAccountRecord;
|
|
1289
|
-
|
|
1290
1305
|
/**
|
|
1291
1306
|
* Named lab accounts a suite can add in one call, modelled on a real team's recorded
|
|
1292
1307
|
* listing (a BioReference-linked team, recorded 2026-09-21 from the Junction sandbox).
|
|
@@ -1838,6 +1853,8 @@ type JunctionRuntimeOptions = {
|
|
|
1838
1853
|
geo?: GeoMode;
|
|
1839
1854
|
/** The team's lab accounts, or `{ presets, accounts }`; see {@link JunctionAPIOptions.labAccounts}. */
|
|
1840
1855
|
labAccounts?: LabAccountLayout;
|
|
1856
|
+
/** Per-lab multiple-account omission policy; default platform. */
|
|
1857
|
+
labAccountOmissionPolicies?: Record<string, LabAccountOmissionPolicy>;
|
|
1841
1858
|
/** The team the mock answers as. Default: the corpus's recorded team, else a fixed id. */
|
|
1842
1859
|
teamId?: string;
|
|
1843
1860
|
/** Sandbox-only restrictions, every one off by default; per namespace via `PUT /__admin/limits`. */
|
|
@@ -1996,6 +2013,8 @@ type JunctionAPIOptions = APIOptions & {
|
|
|
1996
2013
|
* default, `client_bill`.
|
|
1997
2014
|
*/
|
|
1998
2015
|
defaultBillingTypes?: Partial<Record<string, BillingType>>;
|
|
2016
|
+
/** Per-lab multiple-account routing policy; defaults to platform fallback. */
|
|
2017
|
+
labAccountOmissionPolicies?: Record<string, LabAccountOmissionPolicy>;
|
|
1999
2018
|
/** Users and orders to load into every namespace, re-applied on every `reset()`. */
|
|
2000
2019
|
fixtures?: JunctionFixtures;
|
|
2001
2020
|
};
|
|
@@ -2059,7 +2078,10 @@ declare class JunctionAPI implements FetchAPI {
|
|
|
2059
2078
|
get limits(): JunctionLimits;
|
|
2060
2079
|
/** Change some limits (`null` lifts a numeric one); kept across `reset()`. */
|
|
2061
2080
|
configureLimits(input: JunctionLimitsInput): JunctionLimits;
|
|
2062
|
-
/**
|
|
2081
|
+
/** Multiple-account routing policy per lab, kept across reset. */
|
|
2082
|
+
get labAccountOmissionPolicies(): Record<string, LabAccountOmissionPolicy>;
|
|
2083
|
+
set labAccountOmissionPolicies(input: Record<string, LabAccountOmissionPolicy>);
|
|
2084
|
+
/** Lab slug → the billing type an order gets when omitted. Kept across reset. */
|
|
2063
2085
|
get defaultBillingTypes(): Record<string, BillingType>;
|
|
2064
2086
|
/** Replace the per-lab default billing types (`{}` restores `client_bill` everywhere). */
|
|
2065
2087
|
set defaultBillingTypes(input: Partial<Record<string, BillingType>>);
|
|
@@ -2087,6 +2109,11 @@ declare class JunctionAPI implements FetchAPI {
|
|
|
2087
2109
|
* only place the mock reports it.
|
|
2088
2110
|
*/
|
|
2089
2111
|
orderLabAccount(id: string): string | null | undefined;
|
|
2112
|
+
/** Frozen provider number used by the synthetic requisition; null means unknown. */
|
|
2113
|
+
requisitionFixture(id: string): {
|
|
2114
|
+
provider_account_id: string | null;
|
|
2115
|
+
} | undefined;
|
|
2116
|
+
installRequisitionFixture(id: string, providerAccountId: string | null): boolean;
|
|
2090
2117
|
/**
|
|
2091
2118
|
* Put an order straight into a status (a full `<status>.<method>.<event>` value) and
|
|
2092
2119
|
* publish the webhook a real transition would. `flags` takes the same keys as
|
|
@@ -2113,4 +2140,4 @@ declare class LabAccountConflict extends Error {
|
|
|
2113
2140
|
}
|
|
2114
2141
|
|
|
2115
2142
|
export { AVAILABILITY_ADDRESS, AVAILABILITY_START_DATE, BILLING_TYPES, COVERAGE_ZIPS, DEFAULT_JUNCTION_BASE_URL, DEFAULT_LIMITS, DELEGATED_ACCOUNT_STATES, FAULT_PRESETS, FixtureError, IDENTITY_MODES, JUNCTION_NAMESPACE, JunctionAPI, KNOWN_HEADER, LAB_ACCOUNT_PRESETS, LAB_ACCOUNT_PRESET_ALIASES, LabAccountConflict, MISS_HEADER, MOCK_TEAM_ID, ORDER_NOT_FOUND, ORDER_STATUSES_BY_METHOD, OTHER_TEAM_ID, PHLEBOTOMY_AVAILABILITY_ZIPS, PLATFORM_ACCOUNT_STATES, PSC_AVAILABILITY_ZIPS, PSC_LAB_IDS, RESULT_FIXTURES, SANDBOX_KEY_PREFIXES, SEALED_CORPUS_VERSION, SUPPORTED_SEALED_CORPUS_VERSIONS, SYNTHETIC_LAB_ACCOUNT_PRESETS, TEAM_LAB_ACCOUNTS, TRANSITION_ALIASES, UNKNOWN_ZIP_ERROR_TYPE, UNKNOWN_ZIP_STATUS, US_STATES, corpusLabel, createRuntime, createWebhookDispatcher, diffCorpus, document, fingerprintCorpus, isLinkedToTeam, isSandboxKey, labAccountFromInput, observationCacheKey, operationIds, parseSealedCorpus, prefetchCoverageObservations, presetAccountId, pullCorpus, reshapeCoverageGeoCommand, resolveTransition, sandboxUserQuotaBody, signSvix, supportedOperationIds, verifyAgainstReal, verifySvix };
|
|
2116
|
-
export type { BillingType, CorpusDiff, CorpusInfo, Divergence, FetchAPI, GeoMode, GetCacheEntry, IdentityMode, InsertOptions, JunctionAPIOptions, JunctionAdminOptions, JunctionFixtures, JunctionLimits, JunctionLimitsInput, JunctionRuntime, JunctionRuntimeOptions, JunctionWebhookEvent, JunctionWebhookOptions, LabAccountDelegatedFlow, LabAccountInput, LabAccountLayout, LabAccountRecord, LabAccountStatus, OperationId, OrderFixture, OrderRecord, PullCorpusOptions, ResultFixture, SealedCorpus, SeedObservations, SeedReport, SeedSource, SetDiff, SqliteClient, StoredLabAccount, SupportedOperationId, UserFixture, UserRecord, VerifyOptions, VerifyReport, WebhookAttempt, WebhookDelivery, WebhookDispatcher, WebhookEndpoint, WebhookPublisher };
|
|
2143
|
+
export type { BillingType, CorpusDiff, CorpusInfo, Divergence, FetchAPI, GeoMode, GetCacheEntry, IdentityMode, InsertOptions, JunctionAPIOptions, JunctionAdminOptions, JunctionFixtures, JunctionLimits, JunctionLimitsInput, JunctionRuntime, JunctionRuntimeOptions, JunctionWebhookEvent, JunctionWebhookOptions, LabAccountDelegatedFlow, LabAccountInput, LabAccountLayout, LabAccountOmissionPolicy, LabAccountRecord, LabAccountStatus, OperationId, OrderFixture, OrderRecord, PullCorpusOptions, ResultFixture, SealedCorpus, SeedObservations, SeedReport, SeedSource, SetDiff, SqliteClient, StoredLabAccount, SupportedOperationId, UserFixture, UserRecord, VerifyOptions, VerifyReport, WebhookAttempt, WebhookDelivery, WebhookDispatcher, WebhookEndpoint, WebhookPublisher };
|
package/dist/index.js
CHANGED
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. */
|
|
@@ -1393,6 +1408,8 @@ type SnapshotDocument = {
|
|
|
1393
1408
|
faults?: unknown;
|
|
1394
1409
|
latency?: unknown;
|
|
1395
1410
|
virtualTime?: boolean;
|
|
1411
|
+
/** Quiescent webhook endpoints, delivery history and fault state. Contains private configuration. */
|
|
1412
|
+
webhooks?: unknown;
|
|
1396
1413
|
};
|
|
1397
1414
|
/** Controls for one namespace. */
|
|
1398
1415
|
type NamespaceControls = {
|
|
@@ -1606,6 +1623,8 @@ type CredentialRegistry = {
|
|
|
1606
1623
|
}[];
|
|
1607
1624
|
};
|
|
1608
1625
|
|
|
1626
|
+
type OwnedTransport = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
|
|
1627
|
+
|
|
1609
1628
|
/**
|
|
1610
1629
|
* A point-in-time copy of everything a service namespace holds.
|
|
1611
1630
|
*
|
|
@@ -1723,8 +1742,16 @@ type PublishInput = {
|
|
|
1723
1742
|
id?: string;
|
|
1724
1743
|
};
|
|
1725
1744
|
type WebhookHub = {
|
|
1745
|
+
observeDeliveries(listener: (event: {
|
|
1746
|
+
namespace: string;
|
|
1747
|
+
state: string;
|
|
1748
|
+
deliveryId: string;
|
|
1749
|
+
}) => void): () => void;
|
|
1750
|
+
setTransportPolicy(policy: OwnedTransport): void;
|
|
1726
1751
|
pending(namespace: string): number;
|
|
1727
1752
|
snapshot(namespace: string): unknown;
|
|
1753
|
+
exportSnapshot(handle: unknown): unknown;
|
|
1754
|
+
importSnapshot(namespace: string, document: unknown): unknown;
|
|
1728
1755
|
restore(namespace: string, snapshot: unknown): void;
|
|
1729
1756
|
publish(input: PublishInput): WebhookMessage;
|
|
1730
1757
|
/** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
|
|
@@ -1737,7 +1764,7 @@ type WebhookHub = {
|
|
|
1737
1764
|
/** Run every pending retry (and release held reordered messages) now, and every retry those attempts schedule, until nothing is pending. */
|
|
1738
1765
|
flush(): Promise<void>;
|
|
1739
1766
|
/** Resolve once nothing is in flight. */
|
|
1740
|
-
idle(): Promise<void>;
|
|
1767
|
+
idle(namespace?: string): Promise<void>;
|
|
1741
1768
|
fault(namespace: string, fault: WebhookFault): void;
|
|
1742
1769
|
clear(namespace?: string): void;
|
|
1743
1770
|
};
|
|
@@ -1781,6 +1808,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
|
1781
1808
|
/** Opaque in-process checkpoint including records, controls and webhook history. */
|
|
1782
1809
|
fleetSnapshot(namespace: string): object;
|
|
1783
1810
|
fleetRestore(snapshot: unknown, namespace: string): void;
|
|
1811
|
+
fleetExport(snapshot: unknown): SnapshotDocument;
|
|
1812
|
+
fleetImport(namespace: string, document: unknown): object;
|
|
1784
1813
|
/** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
|
|
1785
1814
|
applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
|
|
1786
1815
|
/** The instance behind `namespace` (the default one when omitted), created on first use. */
|
|
@@ -1868,6 +1897,36 @@ interface SqliteClient {
|
|
|
1868
1897
|
transaction<T>(fn: () => T): T;
|
|
1869
1898
|
}
|
|
1870
1899
|
|
|
1900
|
+
type LabAccountStatus = "active" | "pending" | "suspended" | "ready_to_launch";
|
|
1901
|
+
type LabAccountDelegatedFlow = "order_delegated" | "result_delegated" | "fully_delegated" | "not_delegated";
|
|
1902
|
+
/** `billing_type` values the vendored create-order body accepts. */
|
|
1903
|
+
declare const BILLING_TYPES: readonly ["client_bill", "commercial_insurance", "patient_bill_passthrough", "patient_bill", "upfront_payment"];
|
|
1904
|
+
type BillingType = (typeof BILLING_TYPES)[number];
|
|
1905
|
+
type LabAccountOmissionPolicy = "platform" | "reject";
|
|
1906
|
+
/**
|
|
1907
|
+
* A lab account as a consumer configures it. Mirrors `ClientFacingLabAccount`, with
|
|
1908
|
+
* every field but `id` and `lab` optional, plus a `states` shorthand for the common
|
|
1909
|
+
* case of an account that client-bills in a fixed set of states.
|
|
1910
|
+
*/
|
|
1911
|
+
type LabAccountInput = {
|
|
1912
|
+
id: string;
|
|
1913
|
+
/** Lab slug, e.g. `"quest"`, `"labcorp"`, `"bioreference"`. */
|
|
1914
|
+
lab: string;
|
|
1915
|
+
status?: LabAccountStatus;
|
|
1916
|
+
delegated_flow?: LabAccountDelegatedFlow;
|
|
1917
|
+
account_name?: string | null;
|
|
1918
|
+
provider_account_id?: string;
|
|
1919
|
+
org_id?: string | null;
|
|
1920
|
+
business_units?: string[] | null;
|
|
1921
|
+
default_clinical_notes?: string | null;
|
|
1922
|
+
/** Billing type → states it is allowed in. Takes precedence over `states`. */
|
|
1923
|
+
allowed_billing?: Record<string, readonly string[]>;
|
|
1924
|
+
/** Shorthand for `allowed_billing: { client_bill: states }`. Default: every state. */
|
|
1925
|
+
states?: readonly string[];
|
|
1926
|
+
/** Teams the account is linked to. Default: the configured team, so it is selectable. */
|
|
1927
|
+
team_id_allowlist?: readonly string[];
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1871
1930
|
/** Lab-test catalog mirrored from the Junction sandbox (`GET /v3/lab_test`). */
|
|
1872
1931
|
type CatalogMarker = {
|
|
1873
1932
|
id: number;
|
|
@@ -2143,35 +2202,6 @@ interface FetchAPI {
|
|
|
2143
2202
|
fetch(request: Request): Promise<Response>;
|
|
2144
2203
|
}
|
|
2145
2204
|
|
|
2146
|
-
type LabAccountStatus = "active" | "pending" | "suspended" | "ready_to_launch";
|
|
2147
|
-
type LabAccountDelegatedFlow = "order_delegated" | "result_delegated" | "fully_delegated" | "not_delegated";
|
|
2148
|
-
/** `billing_type` values the vendored create-order body accepts. */
|
|
2149
|
-
declare const BILLING_TYPES: readonly ["client_bill", "commercial_insurance", "patient_bill_passthrough", "patient_bill", "upfront_payment"];
|
|
2150
|
-
type BillingType = (typeof BILLING_TYPES)[number];
|
|
2151
|
-
/**
|
|
2152
|
-
* A lab account as a consumer configures it. Mirrors `ClientFacingLabAccount`, with
|
|
2153
|
-
* every field but `id` and `lab` optional, plus a `states` shorthand for the common
|
|
2154
|
-
* case of an account that client-bills in a fixed set of states.
|
|
2155
|
-
*/
|
|
2156
|
-
type LabAccountInput = {
|
|
2157
|
-
id: string;
|
|
2158
|
-
/** Lab slug, e.g. `"quest"`, `"labcorp"`, `"bioreference"`. */
|
|
2159
|
-
lab: string;
|
|
2160
|
-
status?: LabAccountStatus;
|
|
2161
|
-
delegated_flow?: LabAccountDelegatedFlow;
|
|
2162
|
-
account_name?: string | null;
|
|
2163
|
-
provider_account_id?: string;
|
|
2164
|
-
org_id?: string | null;
|
|
2165
|
-
business_units?: string[] | null;
|
|
2166
|
-
default_clinical_notes?: string | null;
|
|
2167
|
-
/** Billing type → states it is allowed in. Takes precedence over `states`. */
|
|
2168
|
-
allowed_billing?: Record<string, readonly string[]>;
|
|
2169
|
-
/** Shorthand for `allowed_billing: { client_bill: states }`. Default: every state. */
|
|
2170
|
-
states?: readonly string[];
|
|
2171
|
-
/** Teams the account is linked to. Default: the configured team, so it is selectable. */
|
|
2172
|
-
team_id_allowlist?: readonly string[];
|
|
2173
|
-
};
|
|
2174
|
-
|
|
2175
2205
|
/**
|
|
2176
2206
|
* Named lab accounts a suite can add in one call, modelled on a real team's recorded
|
|
2177
2207
|
* listing (a BioReference-linked team, recorded 2026-09-21 from the Junction sandbox).
|
|
@@ -2343,6 +2373,8 @@ type JunctionAPIOptions = APIOptions & {
|
|
|
2343
2373
|
* default, `client_bill`.
|
|
2344
2374
|
*/
|
|
2345
2375
|
defaultBillingTypes?: Partial<Record<string, BillingType>>;
|
|
2376
|
+
/** Per-lab multiple-account routing policy; defaults to platform fallback. */
|
|
2377
|
+
labAccountOmissionPolicies?: Record<string, LabAccountOmissionPolicy>;
|
|
2346
2378
|
/** Users and orders to load into every namespace, re-applied on every `reset()`. */
|
|
2347
2379
|
fixtures?: JunctionFixtures;
|
|
2348
2380
|
};
|
|
@@ -2404,7 +2436,10 @@ declare class JunctionAPI implements FetchAPI {
|
|
|
2404
2436
|
get limits(): JunctionLimits;
|
|
2405
2437
|
/** Change some limits (`null` lifts a numeric one); kept across `reset()`. */
|
|
2406
2438
|
configureLimits(input: JunctionLimitsInput): JunctionLimits;
|
|
2407
|
-
/**
|
|
2439
|
+
/** Multiple-account routing policy per lab, kept across reset. */
|
|
2440
|
+
get labAccountOmissionPolicies(): Record<string, LabAccountOmissionPolicy>;
|
|
2441
|
+
set labAccountOmissionPolicies(input: Record<string, LabAccountOmissionPolicy>);
|
|
2442
|
+
/** Lab slug → the billing type an order gets when omitted. Kept across reset. */
|
|
2408
2443
|
get defaultBillingTypes(): Record<string, BillingType>;
|
|
2409
2444
|
/** Replace the per-lab default billing types (`{}` restores `client_bill` everywhere). */
|
|
2410
2445
|
set defaultBillingTypes(input: Partial<Record<string, BillingType>>);
|
|
@@ -2432,6 +2467,11 @@ declare class JunctionAPI implements FetchAPI {
|
|
|
2432
2467
|
* only place the mock reports it.
|
|
2433
2468
|
*/
|
|
2434
2469
|
orderLabAccount(id: string): string | null | undefined;
|
|
2470
|
+
/** Frozen provider number used by the synthetic requisition; null means unknown. */
|
|
2471
|
+
requisitionFixture(id: string): {
|
|
2472
|
+
provider_account_id: string | null;
|
|
2473
|
+
} | undefined;
|
|
2474
|
+
installRequisitionFixture(id: string, providerAccountId: string | null): boolean;
|
|
2435
2475
|
/**
|
|
2436
2476
|
* Put an order straight into a status (a full `<status>.<method>.<event>` value) and
|
|
2437
2477
|
* publish the webhook a real transition would. `flags` takes the same keys as
|
|
@@ -2462,6 +2502,8 @@ type JunctionRuntimeOptions = {
|
|
|
2462
2502
|
geo?: GeoMode;
|
|
2463
2503
|
/** The team's lab accounts, or `{ presets, accounts }`; see {@link JunctionAPIOptions.labAccounts}. */
|
|
2464
2504
|
labAccounts?: LabAccountLayout;
|
|
2505
|
+
/** Per-lab multiple-account omission policy; default platform. */
|
|
2506
|
+
labAccountOmissionPolicies?: Record<string, LabAccountOmissionPolicy>;
|
|
2465
2507
|
/** The team the mock answers as. Default: the corpus's recorded team, else a fixed id. */
|
|
2466
2508
|
teamId?: string;
|
|
2467
2509
|
/** Sandbox-only restrictions, every one off by default; per namespace via `PUT /__admin/limits`. */
|
package/dist/server.js
CHANGED
package/openapi.yaml
CHANGED
|
@@ -1641,8 +1641,8 @@ paths:
|
|
|
1641
1641
|
enabled: false
|
|
1642
1642
|
safe: true
|
|
1643
1643
|
reason: >-
|
|
1644
|
-
PDF
|
|
1645
|
-
|
|
1644
|
+
Synthetic PDF includes persisted selected provider account number or unknown; admin
|
|
1645
|
+
evidence override supported; live comparison remains shape-only
|
|
1646
1646
|
responses:
|
|
1647
1647
|
"200":
|
|
1648
1648
|
description: Successful Response
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-junction",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Stateful emulator 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",
|
|
@@ -86,7 +86,9 @@
|
|
|
86
86
|
"GET /__admin/requests",
|
|
87
87
|
"GET /__admin/metrics",
|
|
88
88
|
"GET /__admin/faults/presets",
|
|
89
|
-
"GET /__admin/ui"
|
|
89
|
+
"GET /__admin/ui",
|
|
90
|
+
"GET/PUT /__admin/lab-account-omission-policies",
|
|
91
|
+
"GET/PUT /__admin/requisitions/:id"
|
|
90
92
|
],
|
|
91
93
|
"reporting": "https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md"
|
|
92
94
|
}
|