@crvouga/mockingbird-service-aha 1.7.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/CHANGELOG.md +37 -0
- package/DISCOVERY.md +55 -0
- package/README.md +2 -2
- package/SUPPORT.md +12 -0
- package/dist/chunk-EBYGZUZ6.js +889 -0
- package/dist/chunk-EBYGZUZ6.js.map +7 -0
- package/dist/{chunk-7PAR2NE6.js → chunk-OPYCBZYR.js} +822 -258
- package/dist/chunk-OPYCBZYR.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +34 -4
- package/dist/index.js +1 -1
- package/dist/server.d.ts +64 -4
- package/dist/server.js +2 -2
- package/openapi.yaml +384 -0
- package/package.json +29 -4
- package/dist/chunk-7PAR2NE6.js.map +0 -7
- package/dist/chunk-G44JFJSF.js +0 -402
- package/dist/chunk-G44JFJSF.js.map +0 -7
package/dist/cli.js
CHANGED
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. */
|
|
@@ -588,6 +605,9 @@ type PublishInput = {
|
|
|
588
605
|
id?: string;
|
|
589
606
|
};
|
|
590
607
|
type WebhookHub = {
|
|
608
|
+
pending(namespace: string): number;
|
|
609
|
+
snapshot(namespace: string): unknown;
|
|
610
|
+
restore(namespace: string, snapshot: unknown): void;
|
|
591
611
|
publish(input: PublishInput): WebhookMessage;
|
|
592
612
|
/** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
|
|
593
613
|
setEndpoints(namespace: string, endpoints: WebhookEndpoint[]): WebhookEndpoint[];
|
|
@@ -615,6 +635,8 @@ type ServiceTimelineState = Readonly<{
|
|
|
615
635
|
}>;
|
|
616
636
|
type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
|
|
617
637
|
type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
|
|
638
|
+
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
639
|
+
stop?(): void;
|
|
618
640
|
readonly name: string;
|
|
619
641
|
readonly sqlite: SqliteClient$1;
|
|
620
642
|
readonly clock: Clock;
|
|
@@ -625,6 +647,13 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
|
|
|
625
647
|
readonly credentials: CredentialRegistry;
|
|
626
648
|
/** The webhook hub, when the service has outbound webhooks. */
|
|
627
649
|
readonly webhooks: WebhookHub | undefined;
|
|
650
|
+
/** Enable independent namespace clocks and PRNGs before serving a fleet. */
|
|
651
|
+
isolateNamespaces(): void;
|
|
652
|
+
namespaceClock(namespace?: string): Clock;
|
|
653
|
+
namespaceOf(request: Request): string;
|
|
654
|
+
/** Opaque in-process checkpoint including records, controls and webhook history. */
|
|
655
|
+
fleetSnapshot(namespace: string): object;
|
|
656
|
+
fleetRestore(snapshot: unknown, namespace: string): void;
|
|
628
657
|
/** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
|
|
629
658
|
applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
|
|
630
659
|
/** The instance behind `namespace` (the default one when omitted), created on first use. */
|
|
@@ -965,6 +994,7 @@ type AhaRuntimeOptions = {
|
|
|
965
994
|
sqlite?: SqliteClient;
|
|
966
995
|
clock?: Clock;
|
|
967
996
|
seed?: number | string;
|
|
997
|
+
adminPrefix?: string;
|
|
968
998
|
adminKey?: string;
|
|
969
999
|
onLog?: (entry: RequestLog) => void;
|
|
970
1000
|
settings?: Partial<Settings>;
|
|
@@ -984,8 +1014,8 @@ type AhaRuntime = ServiceRuntime<AhaAPI> & {
|
|
|
984
1014
|
stop(): void;
|
|
985
1015
|
};
|
|
986
1016
|
/**
|
|
987
|
-
* The AHA mock with Mockingbird's full service contract: `/health`, `/__admin/*`, namespaces
|
|
988
|
-
* by header, by `/ns/<name>` prefix on `AHA_API_URL`, or by API key
|
|
1017
|
+
* The AHA mock with Mockingbird's full service contract: `/__admin/health`, `/__admin/*`, namespaces
|
|
1018
|
+
* by header, by `/__admin/ns/<name>` prefix on `AHA_API_URL`, or by API key
|
|
989
1019
|
* (`PUT /__admin/credentials {"credentials": {"<AHA_API_KEY>": "<namespace>"}}`), clock
|
|
990
1020
|
* control, fault presets, webhooks and a request journal.
|
|
991
1021
|
*/
|
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$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;
|
|
@@ -781,6 +811,15 @@ type FaultCandidate = {
|
|
|
781
811
|
namespace: string;
|
|
782
812
|
};
|
|
783
813
|
type FaultRegistry = {
|
|
814
|
+
isolateNamespaces(): void;
|
|
815
|
+
snapshot(namespace: string): {
|
|
816
|
+
rules: (FaultRule & {
|
|
817
|
+
remaining: number | null;
|
|
818
|
+
hits: number;
|
|
819
|
+
position: number;
|
|
820
|
+
})[];
|
|
821
|
+
rngState: number;
|
|
822
|
+
};
|
|
784
823
|
add(rule: FaultRule): FaultRule;
|
|
785
824
|
list(): (FaultRule & {
|
|
786
825
|
remaining: number | null;
|
|
@@ -788,6 +827,14 @@ type FaultRegistry = {
|
|
|
788
827
|
})[];
|
|
789
828
|
remove(id: string): boolean;
|
|
790
829
|
clear(): void;
|
|
830
|
+
restore(namespace: string, state: {
|
|
831
|
+
rules: (FaultRule & {
|
|
832
|
+
remaining: number | null;
|
|
833
|
+
hits: number;
|
|
834
|
+
position: number;
|
|
835
|
+
})[];
|
|
836
|
+
rngState: number;
|
|
837
|
+
}): void;
|
|
791
838
|
/**
|
|
792
839
|
* Every fault this request should get, in rule order, stopping at the first that answers
|
|
793
840
|
* or drops (effect-only and delay-only rules let later rules match too). Consumes one of
|
|
@@ -965,8 +1012,8 @@ type MetricsReport = {
|
|
|
965
1012
|
};
|
|
966
1013
|
type Metrics = {
|
|
967
1014
|
record(entry: RequestLog): void;
|
|
968
|
-
report(): MetricsReport;
|
|
969
|
-
reset(): void;
|
|
1015
|
+
report(namespace?: string): MetricsReport;
|
|
1016
|
+
reset(namespace?: string): void;
|
|
970
1017
|
};
|
|
971
1018
|
|
|
972
1019
|
/** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
|
|
@@ -1150,6 +1197,9 @@ type PublishInput = {
|
|
|
1150
1197
|
id?: string;
|
|
1151
1198
|
};
|
|
1152
1199
|
type WebhookHub = {
|
|
1200
|
+
pending(namespace: string): number;
|
|
1201
|
+
snapshot(namespace: string): unknown;
|
|
1202
|
+
restore(namespace: string, snapshot: unknown): void;
|
|
1153
1203
|
publish(input: PublishInput): WebhookMessage;
|
|
1154
1204
|
/** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
|
|
1155
1205
|
setEndpoints(namespace: string, endpoints: WebhookEndpoint[]): WebhookEndpoint[];
|
|
@@ -1177,6 +1227,8 @@ type ServiceTimelineState = Readonly<{
|
|
|
1177
1227
|
}>;
|
|
1178
1228
|
type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
|
|
1179
1229
|
type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
1230
|
+
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
1231
|
+
stop?(): void;
|
|
1180
1232
|
readonly name: string;
|
|
1181
1233
|
readonly sqlite: SqliteClient$1;
|
|
1182
1234
|
readonly clock: Clock;
|
|
@@ -1187,6 +1239,13 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
|
1187
1239
|
readonly credentials: CredentialRegistry;
|
|
1188
1240
|
/** The webhook hub, when the service has outbound webhooks. */
|
|
1189
1241
|
readonly webhooks: WebhookHub | undefined;
|
|
1242
|
+
/** Enable independent namespace clocks and PRNGs before serving a fleet. */
|
|
1243
|
+
isolateNamespaces(): void;
|
|
1244
|
+
namespaceClock(namespace?: string): Clock;
|
|
1245
|
+
namespaceOf(request: Request): string;
|
|
1246
|
+
/** Opaque in-process checkpoint including records, controls and webhook history. */
|
|
1247
|
+
fleetSnapshot(namespace: string): object;
|
|
1248
|
+
fleetRestore(snapshot: unknown, namespace: string): void;
|
|
1190
1249
|
/** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
|
|
1191
1250
|
applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
|
|
1192
1251
|
/** The instance behind `namespace` (the default one when omitted), created on first use. */
|
|
@@ -1417,6 +1476,7 @@ type AhaRuntimeOptions = {
|
|
|
1417
1476
|
sqlite?: SqliteClient;
|
|
1418
1477
|
clock?: Clock;
|
|
1419
1478
|
seed?: number | string;
|
|
1479
|
+
adminPrefix?: string;
|
|
1420
1480
|
adminKey?: string;
|
|
1421
1481
|
onLog?: (entry: RequestLog) => void;
|
|
1422
1482
|
settings?: Partial<Settings>;
|
package/dist/server.js
CHANGED
package/openapi.yaml
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
openapi: 3.1.0
|
|
2
|
+
info:
|
|
3
|
+
title: AHA (Advanced Health Academy) partner API (Mockingbird subset)
|
|
4
|
+
description: |
|
|
5
|
+
Stateful mock of the AHA at-home phlebotomy partner API: create-or-update order and cancel.
|
|
6
|
+
The vendor has no pull API; order state reaches the partner only as inbound webhooks, which
|
|
7
|
+
the mock emits from admin transitions (see the README). Hand-authored from the consumer's
|
|
8
|
+
wire shapes (the vendor publishes no spec).
|
|
9
|
+
version: "1"
|
|
10
|
+
x-mockingbird-upstream:
|
|
11
|
+
note: >-
|
|
12
|
+
Hand-authored from aha.service.ts, aha.types.ts (zod request/response schemas) and
|
|
13
|
+
aha.lab-provider.ts. Success responses come in one of two envelopes (raw, or
|
|
14
|
+
{success, data}) because our two clients disagree (G-A1); the mock serves either.
|
|
15
|
+
servers:
|
|
16
|
+
- url: https://stage-api.mobileaha.com
|
|
17
|
+
security:
|
|
18
|
+
- hmacKey: []
|
|
19
|
+
hmacTimestamp: []
|
|
20
|
+
hmacSignature: []
|
|
21
|
+
- legacyKey: []
|
|
22
|
+
paths:
|
|
23
|
+
/v1/{partner}/create-order:
|
|
24
|
+
post:
|
|
25
|
+
operationId: CreateOrder
|
|
26
|
+
description: >-
|
|
27
|
+
Create an order, or update it when partner_order_id already exists (the same
|
|
28
|
+
order_number is returned). Honors X-Idempotency-Key.
|
|
29
|
+
x-mockingbird:
|
|
30
|
+
supported: true
|
|
31
|
+
parity:
|
|
32
|
+
enabled: true
|
|
33
|
+
safe: false
|
|
34
|
+
parameters:
|
|
35
|
+
- $ref: "#/components/parameters/Partner"
|
|
36
|
+
- $ref: "#/components/parameters/IdempotencyKey"
|
|
37
|
+
requestBody:
|
|
38
|
+
required: true
|
|
39
|
+
content:
|
|
40
|
+
application/json:
|
|
41
|
+
schema:
|
|
42
|
+
$ref: "#/components/schemas/CreateOrderBody"
|
|
43
|
+
responses:
|
|
44
|
+
"200":
|
|
45
|
+
description: Order created or updated (raw or wrapped envelope, per namespace setting)
|
|
46
|
+
content:
|
|
47
|
+
application/json:
|
|
48
|
+
schema:
|
|
49
|
+
oneOf:
|
|
50
|
+
- $ref: "#/components/schemas/CreateOrderResponse"
|
|
51
|
+
- $ref: "#/components/schemas/WrappedCreateOrderResponse"
|
|
52
|
+
"400":
|
|
53
|
+
description: Invalid request body
|
|
54
|
+
content:
|
|
55
|
+
application/json:
|
|
56
|
+
schema:
|
|
57
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
58
|
+
"401":
|
|
59
|
+
description: Missing or invalid authentication
|
|
60
|
+
content:
|
|
61
|
+
application/json:
|
|
62
|
+
schema:
|
|
63
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
64
|
+
"409":
|
|
65
|
+
description: Idempotency key reused with a different request, or still in flight
|
|
66
|
+
content:
|
|
67
|
+
application/json:
|
|
68
|
+
schema:
|
|
69
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
70
|
+
"429":
|
|
71
|
+
description: Rate limited
|
|
72
|
+
content:
|
|
73
|
+
application/json:
|
|
74
|
+
schema:
|
|
75
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
76
|
+
"500":
|
|
77
|
+
description: Server error
|
|
78
|
+
content:
|
|
79
|
+
application/json:
|
|
80
|
+
schema:
|
|
81
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
82
|
+
/v1/{partner}/cancel:
|
|
83
|
+
post:
|
|
84
|
+
operationId: CancelOrder
|
|
85
|
+
description: >-
|
|
86
|
+
Cancel an order by partner_order_id. The mock also accepts the AHA order_number here,
|
|
87
|
+
because our lab-provider client sends it in that field (G-A1).
|
|
88
|
+
x-mockingbird:
|
|
89
|
+
supported: true
|
|
90
|
+
parity:
|
|
91
|
+
enabled: true
|
|
92
|
+
safe: false
|
|
93
|
+
parameters:
|
|
94
|
+
- $ref: "#/components/parameters/Partner"
|
|
95
|
+
- $ref: "#/components/parameters/IdempotencyKey"
|
|
96
|
+
requestBody:
|
|
97
|
+
required: true
|
|
98
|
+
content:
|
|
99
|
+
application/json:
|
|
100
|
+
schema:
|
|
101
|
+
$ref: "#/components/schemas/CancelOrderBody"
|
|
102
|
+
responses:
|
|
103
|
+
"200":
|
|
104
|
+
description: Cancel outcome (raw or wrapped envelope; status ERROR when not cancellable)
|
|
105
|
+
content:
|
|
106
|
+
application/json:
|
|
107
|
+
schema:
|
|
108
|
+
oneOf:
|
|
109
|
+
- $ref: "#/components/schemas/CancelOrderResponse"
|
|
110
|
+
- $ref: "#/components/schemas/WrappedCancelOrderResponse"
|
|
111
|
+
"400":
|
|
112
|
+
description: Invalid request body
|
|
113
|
+
content:
|
|
114
|
+
application/json:
|
|
115
|
+
schema:
|
|
116
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
117
|
+
"401":
|
|
118
|
+
description: Missing or invalid authentication
|
|
119
|
+
content:
|
|
120
|
+
application/json:
|
|
121
|
+
schema:
|
|
122
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
123
|
+
"404":
|
|
124
|
+
description: Unknown partner order
|
|
125
|
+
content:
|
|
126
|
+
application/json:
|
|
127
|
+
schema:
|
|
128
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
129
|
+
"409":
|
|
130
|
+
description: Idempotency key reused with a different request, or still in flight
|
|
131
|
+
content:
|
|
132
|
+
application/json:
|
|
133
|
+
schema:
|
|
134
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
135
|
+
"429":
|
|
136
|
+
description: Rate limited
|
|
137
|
+
content:
|
|
138
|
+
application/json:
|
|
139
|
+
schema:
|
|
140
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
141
|
+
"500":
|
|
142
|
+
description: Server error
|
|
143
|
+
content:
|
|
144
|
+
application/json:
|
|
145
|
+
schema:
|
|
146
|
+
$ref: "#/components/schemas/ErrorBody"
|
|
147
|
+
components:
|
|
148
|
+
securitySchemes:
|
|
149
|
+
hmacKey:
|
|
150
|
+
type: apiKey
|
|
151
|
+
in: header
|
|
152
|
+
name: X-API-KEY
|
|
153
|
+
hmacTimestamp:
|
|
154
|
+
type: apiKey
|
|
155
|
+
in: header
|
|
156
|
+
name: X-TIMESTAMP
|
|
157
|
+
description: Unix epoch milliseconds.
|
|
158
|
+
hmacSignature:
|
|
159
|
+
type: apiKey
|
|
160
|
+
in: header
|
|
161
|
+
name: X-SIGNATURE
|
|
162
|
+
description: base64(HMAC-SHA256(apiSecret, "<apiKey>:<path>:<timestamp>")).
|
|
163
|
+
legacyKey:
|
|
164
|
+
type: apiKey
|
|
165
|
+
in: header
|
|
166
|
+
name: X-Acme-Auth-Key
|
|
167
|
+
description: >-
|
|
168
|
+
Legacy mode (AHA_USE_LEGACY_AUTH=true), sent with X-API-Version 1.0. The real header
|
|
169
|
+
embeds the partner's name (`X-<Partner>-Auth-Key`); the mock accepts any partner name.
|
|
170
|
+
parameters:
|
|
171
|
+
Partner:
|
|
172
|
+
name: partner
|
|
173
|
+
in: path
|
|
174
|
+
required: true
|
|
175
|
+
description: The partner segment AHA assigns your account (its slug), e.g. `acme`.
|
|
176
|
+
schema:
|
|
177
|
+
type: string
|
|
178
|
+
pattern: "^[A-Za-z0-9_-]{1,64}$"
|
|
179
|
+
examples: [acme]
|
|
180
|
+
IdempotencyKey:
|
|
181
|
+
name: X-Idempotency-Key
|
|
182
|
+
in: header
|
|
183
|
+
required: false
|
|
184
|
+
description: Sent by the lab-provider client; the same key and body replays the stored response.
|
|
185
|
+
schema:
|
|
186
|
+
type: string
|
|
187
|
+
pattern: "^[A-Za-z0-9:_.-]{1,128}$"
|
|
188
|
+
schemas:
|
|
189
|
+
TestCode:
|
|
190
|
+
type: object
|
|
191
|
+
required: [test_code, test_description]
|
|
192
|
+
properties:
|
|
193
|
+
test_code:
|
|
194
|
+
type: string
|
|
195
|
+
minLength: 1
|
|
196
|
+
maxLength: 64
|
|
197
|
+
test_description:
|
|
198
|
+
type: string
|
|
199
|
+
maxLength: 200
|
|
200
|
+
CreateOrderBody:
|
|
201
|
+
type: object
|
|
202
|
+
required:
|
|
203
|
+
- partner_order_id
|
|
204
|
+
- patient_first_name
|
|
205
|
+
- patient_id
|
|
206
|
+
- patient_last_name
|
|
207
|
+
- biological_sex
|
|
208
|
+
- patient_dob
|
|
209
|
+
- patient_phone_number
|
|
210
|
+
- patient_address_line1
|
|
211
|
+
- patient_city
|
|
212
|
+
- patient_state
|
|
213
|
+
- patient_zipcode
|
|
214
|
+
- service_type
|
|
215
|
+
- npi
|
|
216
|
+
- ordering_physician
|
|
217
|
+
- test_codes
|
|
218
|
+
properties:
|
|
219
|
+
partner_order_id:
|
|
220
|
+
type: string
|
|
221
|
+
minLength: 1
|
|
222
|
+
maxLength: 64
|
|
223
|
+
patient_first_name:
|
|
224
|
+
type: string
|
|
225
|
+
minLength: 1
|
|
226
|
+
maxLength: 60
|
|
227
|
+
patient_id:
|
|
228
|
+
type: string
|
|
229
|
+
minLength: 1
|
|
230
|
+
maxLength: 64
|
|
231
|
+
patient_middle_initial:
|
|
232
|
+
type: string
|
|
233
|
+
maxLength: 5
|
|
234
|
+
patient_last_name:
|
|
235
|
+
type: string
|
|
236
|
+
minLength: 1
|
|
237
|
+
maxLength: 60
|
|
238
|
+
biological_sex:
|
|
239
|
+
type: string
|
|
240
|
+
enum: [Male, Female, Non-binary]
|
|
241
|
+
patient_dob:
|
|
242
|
+
type: string
|
|
243
|
+
description: YYYY-MM-DD
|
|
244
|
+
maxLength: 10
|
|
245
|
+
patient_phone_number:
|
|
246
|
+
type: string
|
|
247
|
+
description: 10 digits from AhaService; the lab-provider client may send +1XXXXXXXXXX.
|
|
248
|
+
maxLength: 20
|
|
249
|
+
patient_email_address:
|
|
250
|
+
type: string
|
|
251
|
+
maxLength: 120
|
|
252
|
+
patient_address_line1:
|
|
253
|
+
type: string
|
|
254
|
+
minLength: 1
|
|
255
|
+
maxLength: 120
|
|
256
|
+
patient_address_line2:
|
|
257
|
+
type: string
|
|
258
|
+
maxLength: 120
|
|
259
|
+
patient_city:
|
|
260
|
+
type: string
|
|
261
|
+
minLength: 1
|
|
262
|
+
maxLength: 60
|
|
263
|
+
patient_state:
|
|
264
|
+
type: string
|
|
265
|
+
minLength: 1
|
|
266
|
+
maxLength: 20
|
|
267
|
+
patient_zipcode:
|
|
268
|
+
type: string
|
|
269
|
+
minLength: 1
|
|
270
|
+
maxLength: 10
|
|
271
|
+
service_type:
|
|
272
|
+
type: string
|
|
273
|
+
enum: [Full Service, Draw Only, Pickup Only]
|
|
274
|
+
preferred_schedule_date:
|
|
275
|
+
type: string
|
|
276
|
+
description: YYYY-MM-DD
|
|
277
|
+
maxLength: 10
|
|
278
|
+
preferred_schedule_time:
|
|
279
|
+
type: string
|
|
280
|
+
description: HH:MM
|
|
281
|
+
maxLength: 8
|
|
282
|
+
patient_timezone:
|
|
283
|
+
type: string
|
|
284
|
+
description: IANA zone, e.g. America/New_York
|
|
285
|
+
maxLength: 64
|
|
286
|
+
npi:
|
|
287
|
+
type: string
|
|
288
|
+
minLength: 1
|
|
289
|
+
maxLength: 20
|
|
290
|
+
ordering_physician:
|
|
291
|
+
type: string
|
|
292
|
+
minLength: 1
|
|
293
|
+
maxLength: 120
|
|
294
|
+
test_codes:
|
|
295
|
+
type: array
|
|
296
|
+
maxItems: 20
|
|
297
|
+
items:
|
|
298
|
+
$ref: "#/components/schemas/TestCode"
|
|
299
|
+
CancelOrderBody:
|
|
300
|
+
type: object
|
|
301
|
+
required: [partner_order_id, notes]
|
|
302
|
+
properties:
|
|
303
|
+
partner_order_id:
|
|
304
|
+
type: string
|
|
305
|
+
minLength: 1
|
|
306
|
+
maxLength: 64
|
|
307
|
+
x-mockingbird-resource-ref:
|
|
308
|
+
type: order
|
|
309
|
+
missing: AC-999999999
|
|
310
|
+
notes:
|
|
311
|
+
type: array
|
|
312
|
+
maxItems: 5
|
|
313
|
+
items:
|
|
314
|
+
type: object
|
|
315
|
+
required: [note_type, notes]
|
|
316
|
+
properties:
|
|
317
|
+
note_type:
|
|
318
|
+
type: string
|
|
319
|
+
enum: [CANCELLATION]
|
|
320
|
+
notes:
|
|
321
|
+
type: string
|
|
322
|
+
maxLength: 500
|
|
323
|
+
CreateOrderResponse:
|
|
324
|
+
type: object
|
|
325
|
+
required: [content, message, status]
|
|
326
|
+
properties:
|
|
327
|
+
content:
|
|
328
|
+
type: object
|
|
329
|
+
required: [partner_order_id, order_number]
|
|
330
|
+
properties:
|
|
331
|
+
partner_order_id:
|
|
332
|
+
type: string
|
|
333
|
+
x-mockingbird-resource:
|
|
334
|
+
type: order
|
|
335
|
+
identity: true
|
|
336
|
+
order_number:
|
|
337
|
+
type: string
|
|
338
|
+
x-mockingbird-volatile:
|
|
339
|
+
kind: id
|
|
340
|
+
message:
|
|
341
|
+
type: string
|
|
342
|
+
status:
|
|
343
|
+
type: string
|
|
344
|
+
enum: [SUCCESS, ERROR]
|
|
345
|
+
WrappedCreateOrderResponse:
|
|
346
|
+
type: object
|
|
347
|
+
required: [success, data]
|
|
348
|
+
properties:
|
|
349
|
+
success:
|
|
350
|
+
type: boolean
|
|
351
|
+
data:
|
|
352
|
+
$ref: "#/components/schemas/CreateOrderResponse"
|
|
353
|
+
CancelOrderResponse:
|
|
354
|
+
type: object
|
|
355
|
+
required: [message, status]
|
|
356
|
+
properties:
|
|
357
|
+
message:
|
|
358
|
+
type: string
|
|
359
|
+
status:
|
|
360
|
+
type: string
|
|
361
|
+
enum: [SUCCESS, ERROR]
|
|
362
|
+
WrappedCancelOrderResponse:
|
|
363
|
+
type: object
|
|
364
|
+
required: [success, data]
|
|
365
|
+
properties:
|
|
366
|
+
success:
|
|
367
|
+
type: boolean
|
|
368
|
+
data:
|
|
369
|
+
$ref: "#/components/schemas/CancelOrderResponse"
|
|
370
|
+
ErrorBody:
|
|
371
|
+
type: object
|
|
372
|
+
required: [status, message]
|
|
373
|
+
properties:
|
|
374
|
+
status:
|
|
375
|
+
type: string
|
|
376
|
+
enum: [ERROR]
|
|
377
|
+
message:
|
|
378
|
+
type: string
|
|
379
|
+
errors:
|
|
380
|
+
type: object
|
|
381
|
+
additionalProperties:
|
|
382
|
+
type: array
|
|
383
|
+
items:
|
|
384
|
+
type: string
|