@crvouga/mockingbird-service-junction 1.4.0 → 1.6.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.
@@ -42,30 +42,30 @@ var createClock = (source = Date.now) => {
42
42
  var Collection = class {
43
43
  sqlite;
44
44
  namespace;
45
- name;
46
- constructor(sqlite, namespace, name) {
45
+ collectionName;
46
+ constructor(sqlite, namespace, collectionName) {
47
47
  this.sqlite = sqlite;
48
48
  this.namespace = namespace;
49
- this.name = name;
49
+ this.collectionName = collectionName;
50
50
  }
51
51
  bumpCollectionSeq() {
52
- const row = this.sqlite.prepare("SELECT value FROM mockingbird_sequences WHERE namespace = ? AND name = ? AND kind = 'collection'").get(this.namespace, this.name);
52
+ const row = this.sqlite.prepare("SELECT value FROM mockingbird_sequences WHERE namespace = ? AND name = ? AND kind = 'collection'").get(this.namespace, this.collectionName);
53
53
  const next = (row?.value ?? 0) + 1;
54
54
  this.sqlite.prepare(`INSERT INTO mockingbird_sequences (namespace, name, kind, value) VALUES (?, ?, 'collection', ?)
55
- ON CONFLICT(namespace, name, kind) DO UPDATE SET value = excluded.value`).run(this.namespace, this.name, next);
55
+ ON CONFLICT(namespace, name, kind) DO UPDATE SET value = excluded.value`).run(this.namespace, this.collectionName, next);
56
56
  return next;
57
57
  }
58
58
  nextSequence() {
59
59
  return this.sqlite.transaction(() => this.bumpCollectionSeq());
60
60
  }
61
61
  get(id) {
62
- const row = this.sqlite.prepare("SELECT value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.name, id);
62
+ const row = this.sqlite.prepare("SELECT value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
63
63
  if (!row)
64
64
  return void 0;
65
65
  return JSON.parse(row.value).value;
66
66
  }
67
67
  has(id) {
68
- const row = this.sqlite.prepare("SELECT 1 AS ok FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.name, id);
68
+ const row = this.sqlite.prepare("SELECT 1 AS ok FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
69
69
  return row !== void 0;
70
70
  }
71
71
  /** Insert a new record, assigning it the next sequence number. */
@@ -75,32 +75,32 @@ var Collection = class {
75
75
  const stored = { seq, value };
76
76
  this.sqlite.prepare(`INSERT INTO mockingbird_records (namespace, collection, id, seq, value)
77
77
  VALUES (?, ?, ?, ?, ?)
78
- ON CONFLICT(namespace, collection, id) DO UPDATE SET seq = excluded.seq, value = excluded.value`).run(this.namespace, this.name, id, seq, JSON.stringify(stored));
78
+ ON CONFLICT(namespace, collection, id) DO UPDATE SET seq = excluded.seq, value = excluded.value`).run(this.namespace, this.collectionName, id, seq, JSON.stringify(stored));
79
79
  return stored;
80
80
  });
81
81
  }
82
82
  /** Replace an existing record's value, keeping its position. */
83
83
  update(id, value) {
84
84
  return this.sqlite.transaction(() => {
85
- const row = this.sqlite.prepare("SELECT seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.name, id);
85
+ const row = this.sqlite.prepare("SELECT seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
86
86
  if (!row)
87
87
  return void 0;
88
88
  const stored = { seq: row.seq, value };
89
- this.sqlite.prepare("UPDATE mockingbird_records SET value = ? WHERE namespace = ? AND collection = ? AND id = ?").run(JSON.stringify(stored), this.namespace, this.name, id);
89
+ this.sqlite.prepare("UPDATE mockingbird_records SET value = ? WHERE namespace = ? AND collection = ? AND id = ?").run(JSON.stringify(stored), this.namespace, this.collectionName, id);
90
90
  return stored;
91
91
  });
92
92
  }
93
93
  delete(id) {
94
- const result = this.sqlite.prepare("DELETE FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").run(this.namespace, this.name, id);
94
+ const result = this.sqlite.prepare("DELETE FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").run(this.namespace, this.collectionName, id);
95
95
  return result.changes > 0;
96
96
  }
97
97
  /** How many records the collection holds, without reading them. */
98
98
  count() {
99
- const row = this.sqlite.prepare("SELECT COUNT(*) AS n FROM mockingbird_records WHERE namespace = ? AND collection = ?").get(this.namespace, this.name);
99
+ const row = this.sqlite.prepare("SELECT COUNT(*) AS n FROM mockingbird_records WHERE namespace = ? AND collection = ?").get(this.namespace, this.collectionName);
100
100
  return Number(row?.n ?? 0);
101
101
  }
102
102
  list(options = {}) {
103
- const rows = this.sqlite.prepare("SELECT id, seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ?").all(this.namespace, this.name);
103
+ const rows = this.sqlite.prepare("SELECT id, seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ?").all(this.namespace, this.collectionName);
104
104
  const out = [];
105
105
  for (const row of rows) {
106
106
  const stored = JSON.parse(row.value);
@@ -357,16 +357,18 @@ var createControlPlane = (context) => {
357
357
  uptimeMs: context.wallNow() - context.startedAt,
358
358
  clock: context.clock.state(),
359
359
  namespaces: context.namespaces().length,
360
+ adminUi: `${ADMIN_PREFIX}/ui`,
360
361
  ...context.describe()
361
362
  });
362
363
  }
363
364
  if (url.pathname !== ADMIN_PREFIX && !url.pathname.startsWith(`${ADMIN_PREFIX}/`)) {
364
365
  return void 0;
365
366
  }
366
- if (context.adminKey !== void 0 && request2.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
367
+ const path = url.pathname.slice(ADMIN_PREFIX.length) || "/";
368
+ const shell = request2.method === "GET" && (path === "/ui" || path === "/ui/");
369
+ if (!shell && context.adminKey !== void 0 && request2.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
367
370
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
368
371
  }
369
- const path = url.pathname.slice(ADMIN_PREFIX.length) || "/";
370
372
  for (const route of routes) {
371
373
  if (route.method !== request2.method)
372
374
  continue;
@@ -535,10 +537,10 @@ var OpenAPIReferenceError = class extends Error {
535
537
  };
536
538
  var unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
537
539
  var isReference = (value) => typeof value === "object" && value !== null && typeof value.$ref === "string";
538
- var resolveRef = (document2, ref) => {
540
+ var resolveRef = (document3, ref) => {
539
541
  if (!ref.startsWith("#/"))
540
542
  throw new OpenAPIReferenceError(ref);
541
- let cursor = document2;
543
+ let cursor = document3;
542
544
  for (const raw of ref.slice(2).split("/")) {
543
545
  const segment = unescapePointer(raw);
544
546
  if (typeof cursor !== "object" || cursor === null || !(segment in cursor)) {
@@ -550,14 +552,14 @@ var resolveRef = (document2, ref) => {
550
552
  throw new OpenAPIReferenceError(ref);
551
553
  return cursor;
552
554
  };
553
- var deref = (document2, value) => {
555
+ var deref = (document3, value) => {
554
556
  let current = value;
555
557
  const seen = /* @__PURE__ */ new Set();
556
558
  while (isReference(current)) {
557
559
  if (seen.has(current.$ref))
558
560
  throw new OpenAPIReferenceError(`${current.$ref} (cycle)`);
559
561
  seen.add(current.$ref);
560
- current = resolveRef(document2, current.$ref);
562
+ current = resolveRef(document3, current.$ref);
561
563
  }
562
564
  return current;
563
565
  };
@@ -575,36 +577,36 @@ var HTTP_METHODS = [
575
577
  ];
576
578
 
577
579
  // ../../openapi/core/dist/document.js
578
- var mergeParameters = (document2, item, own) => {
580
+ var mergeParameters = (document3, item, own) => {
579
581
  const merged = /* @__PURE__ */ new Map();
580
582
  for (const raw of item.parameters ?? []) {
581
- const parameter = deref(document2, raw);
583
+ const parameter = deref(document3, raw);
582
584
  merged.set(`${parameter.in}:${parameter.name}`, parameter);
583
585
  }
584
586
  for (const raw of own ?? []) {
585
- const parameter = deref(document2, raw);
587
+ const parameter = deref(document3, raw);
586
588
  merged.set(`${parameter.in}:${parameter.name}`, parameter);
587
589
  }
588
590
  return [...merged.values()];
589
591
  };
590
- var listOperations = (document2) => {
592
+ var listOperations = (document3) => {
591
593
  const operations = [];
592
- for (const [path, item] of Object.entries(document2.paths)) {
594
+ for (const [path, item] of Object.entries(document3.paths)) {
593
595
  for (const method of HTTP_METHODS) {
594
596
  const operation = item[method];
595
597
  if (operation?.operationId === void 0)
596
598
  continue;
597
599
  const responses = {};
598
600
  for (const [status, response] of Object.entries(operation.responses)) {
599
- responses[status] = deref(document2, response);
601
+ responses[status] = deref(document3, response);
600
602
  }
601
603
  operations.push({
602
604
  operationId: operation.operationId,
603
605
  method,
604
606
  path,
605
607
  operation,
606
- parameters: mergeParameters(document2, item, operation.parameters),
607
- requestBody: operation.requestBody === void 0 ? void 0 : deref(document2, operation.requestBody),
608
+ parameters: mergeParameters(document3, item, operation.parameters),
609
+ requestBody: operation.requestBody === void 0 ? void 0 : deref(document3, operation.requestBody),
608
610
  responses
609
611
  });
610
612
  }
@@ -1140,6 +1142,1737 @@ var clearNamespace = (sqlite, namespace) => {
1140
1142
  });
1141
1143
  };
1142
1144
 
1145
+ // ../../ui/dist/reset.js
1146
+ var CSS_RESET = `*,
1147
+ *::before,
1148
+ *::after {
1149
+ box-sizing: border-box;
1150
+ margin: 0;
1151
+ padding: 0;
1152
+ }
1153
+
1154
+ * {
1155
+ scrollbar-width: thin;
1156
+ scrollbar-color: color-mix(in srgb, CanvasText 35%, Canvas) Canvas;
1157
+ }
1158
+
1159
+ *::-webkit-scrollbar {
1160
+ width: 12px;
1161
+ height: 12px;
1162
+ }
1163
+
1164
+ *::-webkit-scrollbar-track,
1165
+ *::-webkit-scrollbar-corner {
1166
+ background: Canvas;
1167
+ }
1168
+
1169
+ *::-webkit-scrollbar-thumb {
1170
+ background: color-mix(in srgb, CanvasText 35%, Canvas);
1171
+ border: 3px solid Canvas;
1172
+ border-radius: 999px;
1173
+ }
1174
+
1175
+ html {
1176
+ hanging-punctuation: first allow-end last;
1177
+ -webkit-text-size-adjust: none;
1178
+ text-size-adjust: none;
1179
+ tab-size: 4;
1180
+ font-family:
1181
+ ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI",
1182
+ "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
1183
+ font-size: 16px;
1184
+ line-height: 1.5;
1185
+ -webkit-font-smoothing: antialiased;
1186
+ -moz-osx-font-smoothing: grayscale;
1187
+ text-rendering: optimizeLegibility;
1188
+ -webkit-tap-highlight-color: transparent;
1189
+ scroll-behavior: smooth;
1190
+ background: Canvas;
1191
+ color: CanvasText;
1192
+ }
1193
+
1194
+ body {
1195
+ min-height: 100svh;
1196
+ line-height: 1.5;
1197
+ background: Canvas;
1198
+ color: CanvasText;
1199
+ }
1200
+
1201
+ h1 {
1202
+ font-size: 2em;
1203
+ }
1204
+
1205
+ h2 {
1206
+ font-size: 1.5em;
1207
+ }
1208
+
1209
+ h3 {
1210
+ font-size: 1.17em;
1211
+ }
1212
+
1213
+ h4 {
1214
+ font-size: 1em;
1215
+ }
1216
+
1217
+ h5 {
1218
+ font-size: 0.83em;
1219
+ }
1220
+
1221
+ h6 {
1222
+ font-size: 0.67em;
1223
+ }
1224
+
1225
+ h1,
1226
+ h2,
1227
+ h3,
1228
+ h4,
1229
+ h5,
1230
+ h6 {
1231
+ font-weight: 700;
1232
+ line-height: 1.2;
1233
+ text-wrap: balance;
1234
+ overflow-wrap: break-word;
1235
+ }
1236
+
1237
+ p,
1238
+ li,
1239
+ figcaption,
1240
+ dd,
1241
+ dt,
1242
+ blockquote {
1243
+ overflow-wrap: break-word;
1244
+ }
1245
+
1246
+ p,
1247
+ li,
1248
+ figcaption,
1249
+ blockquote {
1250
+ text-wrap: pretty;
1251
+ }
1252
+
1253
+ ul,
1254
+ ol,
1255
+ menu {
1256
+ list-style: none;
1257
+ }
1258
+
1259
+ a {
1260
+ color: inherit;
1261
+ text-decoration: underline;
1262
+ text-decoration-thickness: 1px;
1263
+ text-underline-offset: 0.15em;
1264
+ text-decoration-skip-ink: auto;
1265
+ }
1266
+
1267
+ b,
1268
+ strong {
1269
+ font-weight: 700;
1270
+ }
1271
+
1272
+ small {
1273
+ font-size: 0.875em;
1274
+ }
1275
+
1276
+ code,
1277
+ kbd,
1278
+ samp,
1279
+ pre {
1280
+ font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
1281
+ font-size: 1em;
1282
+ }
1283
+
1284
+ sub,
1285
+ sup {
1286
+ font-size: 75%;
1287
+ line-height: 0;
1288
+ position: relative;
1289
+ vertical-align: baseline;
1290
+ }
1291
+
1292
+ sub {
1293
+ bottom: -0.25em;
1294
+ }
1295
+
1296
+ sup {
1297
+ top: -0.5em;
1298
+ }
1299
+
1300
+ abbr[title] {
1301
+ text-decoration: underline dotted;
1302
+ text-underline-offset: 0.15em;
1303
+ }
1304
+
1305
+ mark {
1306
+ background: Mark;
1307
+ color: MarkText;
1308
+ }
1309
+
1310
+ hr {
1311
+ height: 0;
1312
+ border: 0;
1313
+ border-top: 1px solid color-mix(in srgb, CanvasText 20%, transparent);
1314
+ color: inherit;
1315
+ }
1316
+
1317
+ img,
1318
+ picture,
1319
+ video,
1320
+ canvas {
1321
+ display: block;
1322
+ max-width: 100%;
1323
+ }
1324
+
1325
+ img,
1326
+ video {
1327
+ height: auto;
1328
+ }
1329
+
1330
+ svg {
1331
+ overflow: hidden;
1332
+ }
1333
+
1334
+ iframe {
1335
+ border: 0;
1336
+ max-width: 100%;
1337
+ }
1338
+
1339
+ table {
1340
+ border-collapse: collapse;
1341
+ border-spacing: 0;
1342
+ }
1343
+
1344
+ fieldset {
1345
+ border: 0;
1346
+ min-inline-size: 0;
1347
+ }
1348
+
1349
+ legend {
1350
+ padding: 0;
1351
+ }
1352
+
1353
+ button,
1354
+ input,
1355
+ select,
1356
+ textarea,
1357
+ optgroup {
1358
+ font: inherit;
1359
+ letter-spacing: inherit;
1360
+ color: inherit;
1361
+ margin: 0;
1362
+ vertical-align: middle;
1363
+ }
1364
+
1365
+ button,
1366
+ input[type="button"],
1367
+ input[type="submit"],
1368
+ input[type="reset"] {
1369
+ appearance: none;
1370
+ background: none;
1371
+ border: 0;
1372
+ padding: 0;
1373
+ cursor: pointer;
1374
+ text-align: center;
1375
+ }
1376
+
1377
+ input,
1378
+ textarea,
1379
+ select {
1380
+ background-color: Canvas;
1381
+ border: 1px solid color-mix(in srgb, CanvasText 28%, transparent);
1382
+ border-radius: 0;
1383
+ padding: 0.5em 0.65em;
1384
+ }
1385
+
1386
+ input[type="checkbox"],
1387
+ input[type="radio"],
1388
+ input[type="range"],
1389
+ input[type="file"],
1390
+ input[type="color"],
1391
+ input[type="button"],
1392
+ input[type="submit"],
1393
+ input[type="reset"],
1394
+ input[type="image"],
1395
+ input[type="hidden"] {
1396
+ background: none;
1397
+ border: 0;
1398
+ padding: 0;
1399
+ border-radius: 0;
1400
+ }
1401
+
1402
+ input[type="checkbox"],
1403
+ input[type="radio"] {
1404
+ accent-color: CanvasText;
1405
+ }
1406
+
1407
+ input[type="search"] {
1408
+ appearance: none;
1409
+ background-color: Canvas;
1410
+ border: 1px solid color-mix(in srgb, CanvasText 28%, transparent);
1411
+ }
1412
+
1413
+ input[type="search"]::-webkit-search-decoration,
1414
+ input[type="search"]::-webkit-search-cancel-button,
1415
+ input[type="search"]::-webkit-search-results-button,
1416
+ input[type="search"]::-webkit-search-results-decoration {
1417
+ -webkit-appearance: none;
1418
+ display: none;
1419
+ }
1420
+
1421
+ input[type="number"] {
1422
+ appearance: textfield;
1423
+ background-color: Canvas;
1424
+ border: 1px solid color-mix(in srgb, CanvasText 28%, transparent);
1425
+ }
1426
+
1427
+ input[type="number"]::-webkit-inner-spin-button,
1428
+ input[type="number"]::-webkit-outer-spin-button {
1429
+ -webkit-appearance: none;
1430
+ margin: 0;
1431
+ }
1432
+
1433
+ textarea {
1434
+ resize: vertical;
1435
+ }
1436
+
1437
+ ::placeholder {
1438
+ opacity: 1;
1439
+ color: color-mix(in srgb, CanvasText 45%, transparent);
1440
+ }
1441
+
1442
+ :focus-visible {
1443
+ outline: 2px solid CanvasText;
1444
+ outline-offset: 2px;
1445
+ }
1446
+
1447
+ :focus:not(:focus-visible) {
1448
+ outline: none;
1449
+ }
1450
+
1451
+ :disabled,
1452
+ [disabled] {
1453
+ cursor: default;
1454
+ opacity: 0.6;
1455
+ }
1456
+
1457
+ label,
1458
+ summary,
1459
+ select,
1460
+ [role="button"] {
1461
+ cursor: pointer;
1462
+ }
1463
+
1464
+ summary {
1465
+ display: list-item;
1466
+ }
1467
+
1468
+ details {
1469
+ display: block;
1470
+ }
1471
+
1472
+ dialog {
1473
+ margin: auto;
1474
+ padding: 1rem;
1475
+ border: 1px solid color-mix(in srgb, CanvasText 20%, transparent);
1476
+ background: Canvas;
1477
+ color: CanvasText;
1478
+ max-width: calc(100vw - 2rem);
1479
+ max-height: calc(100svh - 2rem);
1480
+ }
1481
+
1482
+ dialog:not([open]) {
1483
+ display: none;
1484
+ }
1485
+
1486
+ ::backdrop {
1487
+ background: color-mix(in srgb, CanvasText 40%, transparent);
1488
+ }
1489
+
1490
+ [hidden] {
1491
+ display: none !important;
1492
+ }
1493
+
1494
+ ::selection {
1495
+ background: Highlight;
1496
+ color: HighlightText;
1497
+ }
1498
+
1499
+ @media (prefers-reduced-motion: reduce) {
1500
+ *,
1501
+ *::before,
1502
+ *::after {
1503
+ animation-duration: 0.01ms !important;
1504
+ animation-iteration-count: 1 !important;
1505
+ transition-duration: 0.01ms !important;
1506
+ scroll-behavior: auto !important;
1507
+ }
1508
+ }
1509
+
1510
+ @media (pointer: coarse) {
1511
+ input,
1512
+ select,
1513
+ textarea {
1514
+ font-size: max(16px, 1em);
1515
+ }
1516
+ }`;
1517
+
1518
+ // ../core/dist/admin-client.js
1519
+ function isRecord2(value) {
1520
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1521
+ }
1522
+ function mountAdminBrand(doc, host, service, catalog) {
1523
+ const clip = (value, max) => {
1524
+ if (typeof value !== "string")
1525
+ return null;
1526
+ const trimmed = value.trim();
1527
+ if (trimmed === "")
1528
+ return null;
1529
+ return trimmed.length > max ? trimmed.slice(0, max) : trimmed;
1530
+ };
1531
+ const httpUrl = (value) => {
1532
+ if (typeof value !== "string" || value.length > 2e3)
1533
+ return null;
1534
+ try {
1535
+ const url = new URL(value);
1536
+ if (url.protocol !== "https:" && url.protocol !== "http:")
1537
+ return null;
1538
+ return url.href;
1539
+ } catch {
1540
+ return null;
1541
+ }
1542
+ };
1543
+ const hexColor = (value) => {
1544
+ if (typeof value !== "string")
1545
+ return null;
1546
+ const raw = value.trim();
1547
+ return /^#[0-9a-fA-F]{3,8}$/.test(raw) ? raw : null;
1548
+ };
1549
+ const hostname = (value) => {
1550
+ try {
1551
+ return new URL(value).hostname.replace(/^www\./, "");
1552
+ } catch {
1553
+ return value;
1554
+ }
1555
+ };
1556
+ host.replaceChildren();
1557
+ host.hidden = true;
1558
+ if (!isRecord2(catalog) || !Object.hasOwn(catalog, service))
1559
+ return;
1560
+ const row = catalog[service];
1561
+ if (!isRecord2(row))
1562
+ return;
1563
+ const vendor = clip(row.vendor, 80);
1564
+ const website = httpUrl(row.website);
1565
+ const guide = httpUrl(row.guide);
1566
+ const docs = httpUrl(row.docs);
1567
+ const logo = httpUrl(row.logo);
1568
+ const color = hexColor(row.color);
1569
+ const description = clip(row.description, 280);
1570
+ if (vendor === null || website === null && guide === null && docs === null)
1571
+ return;
1572
+ const add = (node) => {
1573
+ host.append(node);
1574
+ return node;
1575
+ };
1576
+ if (logo !== null) {
1577
+ const img = doc.createElement("img");
1578
+ img.alt = "";
1579
+ img.src = logo;
1580
+ img.width = 16;
1581
+ img.height = 16;
1582
+ img.decoding = "async";
1583
+ img.referrerPolicy = "no-referrer";
1584
+ if (color !== null)
1585
+ img.style.borderColor = color;
1586
+ add(img);
1587
+ }
1588
+ const name = doc.createElement("span");
1589
+ name.className = "vendor-name";
1590
+ name.textContent = vendor;
1591
+ if (description !== null)
1592
+ name.title = description;
1593
+ add(name);
1594
+ const sep = () => {
1595
+ const node = doc.createElement("span");
1596
+ node.className = "vendor-sep";
1597
+ node.setAttribute("aria-hidden", "true");
1598
+ node.textContent = "\xB7";
1599
+ return node;
1600
+ };
1601
+ const link = (href, label, title) => {
1602
+ const node = doc.createElement("a");
1603
+ node.className = "vendor-link";
1604
+ node.href = href;
1605
+ node.target = "_blank";
1606
+ node.rel = "noopener noreferrer";
1607
+ node.referrerPolicy = "no-referrer";
1608
+ node.textContent = label;
1609
+ node.title = title;
1610
+ return node;
1611
+ };
1612
+ if (website !== null) {
1613
+ add(sep());
1614
+ add(link(website, hostname(website), `${vendor} website`));
1615
+ }
1616
+ if (guide !== null) {
1617
+ add(sep());
1618
+ add(link(guide, "Docs", `Docs for ${vendor}`));
1619
+ }
1620
+ if (docs !== null) {
1621
+ add(sep());
1622
+ add(link(docs, "API", `${vendor} API reference`));
1623
+ }
1624
+ host.removeAttribute("hidden");
1625
+ host.hidden = false;
1626
+ }
1627
+ function startAdminBrand(env) {
1628
+ const requested = env.params.get("brands");
1629
+ let brandsUrl = env.brandsUrl;
1630
+ if (requested) {
1631
+ try {
1632
+ const url = new URL(requested, env.location.href);
1633
+ const local = url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "::1" || url.hostname === "[::1]" || url.origin === env.location.origin;
1634
+ if ((url.protocol === "https:" || url.protocol === "http:") && local)
1635
+ brandsUrl = url.href;
1636
+ } catch {
1637
+ brandsUrl = env.brandsUrl;
1638
+ }
1639
+ }
1640
+ const vendorHost = env.$("vendor");
1641
+ const brandRoot = env.document.querySelector("[data-mockingbird-admin]");
1642
+ const brandService = brandRoot?.getAttribute("data-service") || "";
1643
+ if (vendorHost === null)
1644
+ return;
1645
+ env.fetch(brandsUrl, {
1646
+ headers: { accept: "application/json" },
1647
+ signal: AbortSignal.timeout(5e3)
1648
+ }).then(async (response) => {
1649
+ if (!response.ok)
1650
+ return null;
1651
+ const catalog = await response.json();
1652
+ return catalog;
1653
+ }).then((catalog) => {
1654
+ mountAdminBrand(env.document, vendorHost, brandService, catalog);
1655
+ }).catch(() => {
1656
+ });
1657
+ }
1658
+ function faultPresetList(value) {
1659
+ if (!isRecord2(value))
1660
+ throw new Error("Fault presets response was not an object");
1661
+ if (!Object.hasOwn(value, "presets") || value.presets === void 0 || value.presets === null) {
1662
+ return { presets: [] };
1663
+ }
1664
+ if (!Array.isArray(value.presets))
1665
+ throw new Error("Fault presets response was not a list");
1666
+ return {
1667
+ presets: value.presets.flatMap((item) => {
1668
+ if (!isRecord2(item) || typeof item.name !== "string")
1669
+ return [];
1670
+ return [{ name: item.name }];
1671
+ })
1672
+ };
1673
+ }
1674
+ function bootAdmin(config) {
1675
+ const fieldKinds = ["string", "number", "boolean", "null", "object", "array", "unknown"];
1676
+ const sources = ["declared", "inferred", "mixed"];
1677
+ const isFieldKind = (value) => typeof value === "string" && fieldKinds.some((kind) => kind === value);
1678
+ const isSource = (value) => typeof value === "string" && sources.some((source) => source === value);
1679
+ const readJson3 = (text) => {
1680
+ const value = JSON.parse(text);
1681
+ return value;
1682
+ };
1683
+ const esc = (value) => String(value ?? "").replace(/[&<>"']/g, (char) => {
1684
+ switch (char) {
1685
+ case "&":
1686
+ return "&amp;";
1687
+ case "<":
1688
+ return "&lt;";
1689
+ case ">":
1690
+ return "&gt;";
1691
+ case '"':
1692
+ return "&quot;";
1693
+ default:
1694
+ return "&#39;";
1695
+ }
1696
+ });
1697
+ const el = (id, kind) => {
1698
+ const node = document.getElementById(id);
1699
+ if (!(node instanceof kind))
1700
+ throw new Error(`admin shell is missing #${id}`);
1701
+ return node;
1702
+ };
1703
+ const errorMessage = (data, fallback) => {
1704
+ if (!isRecord2(data))
1705
+ return fallback;
1706
+ const error = data.error;
1707
+ if (!isRecord2(error) || typeof error.message !== "string" || error.message === "") {
1708
+ return fallback;
1709
+ }
1710
+ return error.message;
1711
+ };
1712
+ const requireList = (value, label) => {
1713
+ if (value === void 0 || value === null)
1714
+ return [];
1715
+ if (!Array.isArray(value))
1716
+ throw new Error(`${label} was not a list`);
1717
+ return value;
1718
+ };
1719
+ const state = {
1720
+ namespace: "default",
1721
+ key: sessionStorage.getItem("mockingbird-admin-key") || "",
1722
+ view: "overview",
1723
+ collection: "",
1724
+ shape: null,
1725
+ route: null,
1726
+ editing: null
1727
+ };
1728
+ const standard = new Set(config.standardRoutes);
1729
+ const banner = el("banner", HTMLElement);
1730
+ const keyInput = el("admin-key", HTMLInputElement);
1731
+ keyInput.value = state.key;
1732
+ const params = new URLSearchParams(location.search);
1733
+ const queryKey = params.get("key");
1734
+ if (queryKey) {
1735
+ state.key = queryKey;
1736
+ keyInput.value = state.key;
1737
+ sessionStorage.setItem("mockingbird-admin-key", state.key);
1738
+ params.delete("key");
1739
+ const next = params.toString();
1740
+ history.replaceState(null, "", location.pathname + (next ? `?${next}` : ""));
1741
+ }
1742
+ const queryNamespace = params.get("namespace");
1743
+ if (queryNamespace)
1744
+ state.namespace = queryNamespace;
1745
+ const showError = (error) => {
1746
+ banner.textContent = error instanceof Error ? error.message : String(error);
1747
+ banner.classList.add("show");
1748
+ };
1749
+ const clearError = () => {
1750
+ banner.classList.remove("show");
1751
+ };
1752
+ const api = async (method, path, body) => {
1753
+ const headers = { accept: "application/json" };
1754
+ if (state.key !== "")
1755
+ headers[config.adminKeyHeader] = state.key;
1756
+ if (state.namespace !== "")
1757
+ headers["x-mockingbird-namespace"] = state.namespace;
1758
+ if (body !== void 0)
1759
+ headers["content-type"] = "application/json";
1760
+ const init = { method, headers };
1761
+ if (body !== void 0)
1762
+ init.body = JSON.stringify(body);
1763
+ const response = await fetch(config.adminPrefix + path, init);
1764
+ const text = await response.text();
1765
+ let data = null;
1766
+ if (text !== "") {
1767
+ try {
1768
+ data = readJson3(text);
1769
+ } catch {
1770
+ data = { raw: text };
1771
+ }
1772
+ }
1773
+ if (response.status === 401) {
1774
+ keyInput.focus();
1775
+ throw new Error(errorMessage(data, "Admin key required"));
1776
+ }
1777
+ if (!response.ok) {
1778
+ throw new Error(errorMessage(data, `${response.status} ${method} ${path}`));
1779
+ }
1780
+ return data;
1781
+ };
1782
+ const originGet = async (path) => {
1783
+ const response = await fetch(path, { headers: { accept: "application/json" } });
1784
+ if (!response.ok)
1785
+ throw new Error(`${response.status} ${path}`);
1786
+ const value = await response.json();
1787
+ return value;
1788
+ };
1789
+ const panelApi = {
1790
+ get: (path) => api("GET", path),
1791
+ send: (method, path, body) => api(method, path, body),
1792
+ namespace: () => state.namespace
1793
+ };
1794
+ const isPanelScript = (value) => typeof value === "function";
1795
+ const setTheme = (theme) => {
1796
+ if (theme)
1797
+ document.documentElement.dataset.theme = theme;
1798
+ else
1799
+ delete document.documentElement.dataset.theme;
1800
+ };
1801
+ const storedTheme = localStorage.getItem("mockingbird-admin-theme");
1802
+ if (storedTheme)
1803
+ setTheme(storedTheme);
1804
+ el("theme", HTMLButtonElement).addEventListener("click", () => {
1805
+ const current = document.documentElement.dataset.theme;
1806
+ const dark = current ? current === "dark" : matchMedia("(prefers-color-scheme: dark)").matches;
1807
+ const next = dark ? "light" : "dark";
1808
+ localStorage.setItem("mockingbird-admin-theme", next);
1809
+ setTheme(next);
1810
+ });
1811
+ const show = (view) => {
1812
+ state.view = view;
1813
+ for (const button of document.querySelectorAll("#nav button")) {
1814
+ if (!(button instanceof HTMLButtonElement))
1815
+ continue;
1816
+ button.setAttribute("aria-current", button.dataset.view === view ? "true" : "false");
1817
+ }
1818
+ for (const section of document.querySelectorAll("main .view")) {
1819
+ if (!(section instanceof HTMLElement))
1820
+ continue;
1821
+ section.hidden = section.id !== `view-${view}`;
1822
+ }
1823
+ };
1824
+ el("nav", HTMLElement).addEventListener("click", (event) => {
1825
+ const target = event.target;
1826
+ if (!(target instanceof Element))
1827
+ return;
1828
+ const button = target.closest("button[data-view]");
1829
+ if (!(button instanceof HTMLButtonElement))
1830
+ return;
1831
+ const view = button.dataset.view;
1832
+ if (view === void 0)
1833
+ return;
1834
+ show(view);
1835
+ refresh().catch(showError);
1836
+ });
1837
+ const cards = (items) => `<div class="grid">${items.map((item) => `<article class="card"><div class="k">${item.k}</div><div class="v">${item.v}</div></article>`).join("")}</div>`;
1838
+ const table = (columns, rows) => {
1839
+ if (rows.length === 0)
1840
+ return '<p class="empty">Nothing here yet.</p>';
1841
+ const head = `<tr>${columns.map((column) => `<th>${column.label}</th>`).join("")}</tr>`;
1842
+ const body = rows.map((row) => {
1843
+ const cells = columns.map((column) => `<td data-label="${column.label}">${column.cell(row)}</td>`).join("");
1844
+ const attrs = "attrs" in row && typeof row.attrs === "string" ? row.attrs : "";
1845
+ return `<tr${attrs}>${cells}</tr>`;
1846
+ }).join("");
1847
+ return `<table><thead>${head}</thead><tbody>${body}</tbody></table>`;
1848
+ };
1849
+ const preview = (value) => {
1850
+ const text = JSON.stringify(value) ?? "null";
1851
+ return esc(text.length > 180 ? `${text.slice(0, 180)}\u2026` : text);
1852
+ };
1853
+ const when = (epoch) => {
1854
+ const date = new Date(epoch);
1855
+ return Number.isNaN(date.getTime()) ? String(epoch) : date.toISOString();
1856
+ };
1857
+ const clockCard = (epoch) => {
1858
+ const date = new Date(epoch);
1859
+ if (Number.isNaN(date.getTime()))
1860
+ return esc(String(epoch));
1861
+ const iso = date.toISOString();
1862
+ return `${esc(iso.slice(0, 10))}<span class="clock-time">${esc(iso.slice(11, 19))} UTC</span>`;
1863
+ };
1864
+ const decodeClock = (value) => {
1865
+ if (!isRecord2(value) || typeof value.now !== "number" || typeof value.offsetMs !== "number" || typeof value.frozen !== "boolean") {
1866
+ throw new Error("Clock response was not a clock");
1867
+ }
1868
+ return { now: value.now, offsetMs: value.offsetMs, frozen: value.frozen };
1869
+ };
1870
+ const decodeField = (value) => {
1871
+ if (!isRecord2(value) || typeof value.name !== "string" || !isFieldKind(value.kind)) {
1872
+ return void 0;
1873
+ }
1874
+ const field = {
1875
+ name: value.name,
1876
+ kind: value.kind,
1877
+ optional: value.optional === true
1878
+ };
1879
+ if (typeof value.description === "string")
1880
+ field.description = value.description;
1881
+ if (Array.isArray(value.fields)) {
1882
+ field.fields = value.fields.flatMap((item) => {
1883
+ const child = decodeField(item);
1884
+ return child === void 0 ? [] : [child];
1885
+ });
1886
+ }
1887
+ return field;
1888
+ };
1889
+ const decodeCollection = (value) => {
1890
+ if (!isRecord2(value) || typeof value.name !== "string")
1891
+ return void 0;
1892
+ const fields = Array.isArray(value.fields) ? value.fields.flatMap((item) => {
1893
+ const field = decodeField(item);
1894
+ return field === void 0 ? [] : [field];
1895
+ }) : [];
1896
+ const collection = {
1897
+ name: value.name,
1898
+ label: typeof value.label === "string" ? value.label : value.name,
1899
+ count: typeof value.count === "number" ? value.count : 0,
1900
+ source: isSource(value.source) ? value.source : "inferred",
1901
+ fields
1902
+ };
1903
+ if (typeof value.description === "string")
1904
+ collection.description = value.description;
1905
+ return collection;
1906
+ };
1907
+ const decodeState = (value) => {
1908
+ if (!isRecord2(value) || !Array.isArray(value.collections)) {
1909
+ throw new Error("State response has no collection list");
1910
+ }
1911
+ return {
1912
+ namespace: typeof value.namespace === "string" ? value.namespace : state.namespace,
1913
+ storageNamespace: typeof value.storageNamespace === "string" ? value.storageNamespace : "",
1914
+ collections: value.collections.flatMap((item) => {
1915
+ const collection = decodeCollection(item);
1916
+ return collection === void 0 ? [] : [collection];
1917
+ })
1918
+ };
1919
+ };
1920
+ const decodeRecords = (value) => requireList(isRecord2(value) ? value.records : void 0, "Records").flatMap((item) => {
1921
+ if (!isRecord2(item) || typeof item.id !== "string")
1922
+ return [];
1923
+ return [
1924
+ {
1925
+ id: item.id,
1926
+ seq: typeof item.seq === "number" ? item.seq : 0,
1927
+ value: item.value,
1928
+ attrs: ` class="clickable" data-id="${esc(item.id)}"`
1929
+ }
1930
+ ];
1931
+ });
1932
+ const textOf = (value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : "";
1933
+ const decodeJournal = (value) => requireList(isRecord2(value) ? value.requests : void 0, "Journal").flatMap((item) => {
1934
+ if (!isRecord2(item))
1935
+ return [];
1936
+ return [
1937
+ {
1938
+ at: textOf(item.at),
1939
+ method: textOf(item.method),
1940
+ path: textOf(item.path),
1941
+ status: textOf(item.status),
1942
+ durationMs: textOf(item.durationMs),
1943
+ operationId: textOf(item.operationId)
1944
+ }
1945
+ ];
1946
+ });
1947
+ const decodeFaults = (value) => requireList(isRecord2(value) ? value.faults : void 0, "Faults").flatMap((item) => {
1948
+ if (!isRecord2(item))
1949
+ return [];
1950
+ return [
1951
+ {
1952
+ id: textOf(item.id),
1953
+ method: typeof item.method === "string" ? item.method : void 0,
1954
+ pathPrefix: typeof item.pathPrefix === "string" ? item.pathPrefix : void 0,
1955
+ operationId: typeof item.operationId === "string" ? item.operationId : void 0,
1956
+ status: typeof item.status === "number" ? item.status : void 0,
1957
+ effect: typeof item.effect === "string" ? item.effect : void 0,
1958
+ drop: typeof item.drop === "boolean" ? item.drop : void 0,
1959
+ latencyMs: typeof item.latencyMs === "number" ? item.latencyMs : void 0
1960
+ }
1961
+ ];
1962
+ });
1963
+ const loadNamespaces = async () => {
1964
+ const data = await api("GET", "/namespaces");
1965
+ const select = el("namespace", HTMLSelectElement);
1966
+ const listed = requireList(isRecord2(data) ? data.namespaces : void 0, "Namespaces");
1967
+ const fallback = isRecord2(data) && typeof data.default === "string" && data.default !== "" ? data.default : "default";
1968
+ const names = (listed.length > 0 ? listed.map((name) => String(name)) : [fallback]).slice();
1969
+ if (!names.includes(state.namespace))
1970
+ names.unshift(state.namespace);
1971
+ select.innerHTML = names.map((name) => `<option value="${esc(name)}">${esc(name)}</option>`).join("");
1972
+ select.value = state.namespace;
1973
+ };
1974
+ const renderOverview = async () => {
1975
+ const [health, shape, clock, journal] = await Promise.all([
1976
+ originGet("/health"),
1977
+ api("GET", "/state"),
1978
+ api("GET", "/clock"),
1979
+ api("GET", "/requests?limit=8")
1980
+ ]);
1981
+ if (!isRecord2(health))
1982
+ throw new Error("Health response was not an object");
1983
+ const decoded = decodeState(shape);
1984
+ state.shape = decoded;
1985
+ const time = decodeClock(clock);
1986
+ el("overview-cards", HTMLElement).innerHTML = cards([
1987
+ {
1988
+ k: "Service",
1989
+ v: esc(typeof health.service === "string" && health.service !== "" ? health.service : config.service)
1990
+ },
1991
+ {
1992
+ k: "Status",
1993
+ v: esc(typeof health.status === "string" && health.status !== "" ? health.status : "ok")
1994
+ },
1995
+ { k: "Namespace", v: esc(state.namespace) },
1996
+ { k: "Collections", v: String(decoded.collections.length) },
1997
+ {
1998
+ k: "Records",
1999
+ v: String(decoded.collections.reduce((sum, item) => sum + item.count, 0))
2000
+ },
2001
+ { k: "Clock", v: clockCard(time.now) }
2002
+ ]);
2003
+ el("overview-requests", HTMLElement).innerHTML = table([
2004
+ { label: "Method", cell: (row) => esc(row.method) },
2005
+ { label: "Path", cell: (row) => esc(row.path) },
2006
+ {
2007
+ label: "Status",
2008
+ cell: (row) => `<span class="status-${row.status.charAt(0)}">${esc(row.status)}</span>`
2009
+ },
2010
+ { label: "Operation", cell: (row) => esc(row.operationId) }
2011
+ ], decodeJournal(journal));
2012
+ };
2013
+ const schemaChips = (collection) => {
2014
+ if (collection.fields.length === 0) {
2015
+ return '<p class="empty">No fields yet. Add a record or declare the collection on the service.</p>';
2016
+ }
2017
+ return `<div class="chips">${collection.fields.map((field) => `<span class="chip">${esc(field.name)} <i>${esc(field.kind)}${field.optional ? "?" : ""}</i></span>`).join("")}</div>`;
2018
+ };
2019
+ const renderState = async () => {
2020
+ const shape = decodeState(await api("GET", "/state"));
2021
+ state.shape = shape;
2022
+ const host = el("collections", HTMLElement);
2023
+ if (shape.collections.length === 0) {
2024
+ host.innerHTML = '<p class="empty">This namespace has no collections yet.</p>';
2025
+ el("schema", HTMLElement).innerHTML = "";
2026
+ el("records", HTMLElement).innerHTML = "";
2027
+ return;
2028
+ }
2029
+ if (!shape.collections.some((item) => item.name === state.collection)) {
2030
+ const first = shape.collections[0];
2031
+ if (first === void 0)
2032
+ return;
2033
+ state.collection = first.name;
2034
+ }
2035
+ host.innerHTML = shape.collections.map((item) => `<button type="button" class="collection" data-collection="${esc(item.name)}" aria-current="${item.name === state.collection ? "true" : "false"}"><strong>${esc(item.label)}</strong><small>${esc(item.count)} \xB7 ${esc(item.source)}</small></button>`).join("");
2036
+ const selected = shape.collections.find((item) => item.name === state.collection);
2037
+ if (selected === void 0)
2038
+ return;
2039
+ const description = selected.description ? `<p class="lede">${esc(selected.description)}</p>` : "";
2040
+ el("schema", HTMLElement).innerHTML = `<h3>${esc(selected.label)}</h3>${description}${schemaChips(selected)}`;
2041
+ const page = await api("GET", `/state/${encodeURIComponent(state.collection)}?limit=50`);
2042
+ el("records", HTMLElement).innerHTML = table([
2043
+ { label: "Id", cell: (row) => `<code>${esc(row.id)}</code>` },
2044
+ { label: "Seq", cell: (row) => esc(row.seq) },
2045
+ { label: "Value", cell: (row) => preview(row.value) }
2046
+ ], decodeRecords(page));
2047
+ };
2048
+ const renderClock = async () => {
2049
+ const clock = decodeClock(await api("GET", "/clock"));
2050
+ el("clock-readout", HTMLElement).innerHTML = `<div class="k">Now</div><div class="v">${esc(when(clock.now))}</div><p>${esc(clock.now)} ms \xB7 offset ${esc(clock.offsetMs)} ms ${clock.frozen ? "<span class='badge warn'>frozen</span>" : "<span class='badge ok'>live</span>"}</p>`;
2051
+ const freeze = el("freeze", HTMLButtonElement);
2052
+ freeze.textContent = clock.frozen ? "Unfreeze" : "Freeze";
2053
+ freeze.dataset.frozen = clock.frozen ? "1" : "0";
2054
+ };
2055
+ const renderFaults = async () => {
2056
+ const [faults, presets] = await Promise.all([
2057
+ api("GET", "/faults"),
2058
+ api("GET", "/faults/presets").catch(() => ({ presets: [] }))
2059
+ ]);
2060
+ const select = el("fault-preset", HTMLSelectElement);
2061
+ const current = select.value;
2062
+ const list = faultPresetList(presets).presets;
2063
+ select.innerHTML = `<option value="">Custom rule</option>${list.map((preset) => `<option value="${esc(preset.name)}">${esc(preset.name)}</option>`).join("")}`;
2064
+ select.value = current;
2065
+ el("fault-list", HTMLElement).innerHTML = table([
2066
+ { label: "Id", cell: (row) => esc(row.id) },
2067
+ {
2068
+ label: "Match",
2069
+ cell: (row) => esc([row.method, row.pathPrefix, row.operationId].filter((part) => Boolean(part)).join(" ") || "all")
2070
+ },
2071
+ {
2072
+ label: "Effect",
2073
+ cell: (row) => esc(row.status ?? row.effect ?? (row.drop ? "drop" : row.latencyMs || ""))
2074
+ }
2075
+ ], decodeFaults(faults));
2076
+ };
2077
+ const renderJournal = async () => {
2078
+ const journal = await api("GET", "/requests?limit=100");
2079
+ el("journal", HTMLElement).innerHTML = table([
2080
+ { label: "When", cell: (row) => esc(row.at) },
2081
+ { label: "Method", cell: (row) => esc(row.method) },
2082
+ { label: "Path", cell: (row) => esc(row.path) },
2083
+ { label: "Status", cell: (row) => esc(row.status) },
2084
+ { label: "ms", cell: (row) => esc(row.durationMs) }
2085
+ ], decodeJournal(journal));
2086
+ };
2087
+ const renderRoutes = async () => {
2088
+ const data = await api("GET", "/");
2089
+ if (!isRecord2(data))
2090
+ throw new Error("Route list was not an object");
2091
+ const routes = requireList(data.routes, "Routes").map((route) => String(route));
2092
+ el("route-list", HTMLElement).innerHTML = routes.map((route) => {
2093
+ const extra = standard.has(route) ? "" : " <span class='badge'>extension</span>";
2094
+ const parts = route.split(" ");
2095
+ const method = parts[0] ?? "";
2096
+ const path = parts.slice(1).join(" ");
2097
+ return `<div class="route"><span class="method">${esc(method)}</span><span>${esc(path)}${extra}</span><button class="btn" type="button" data-route="${esc(route)}">Use</button></div>`;
2098
+ }).join("");
2099
+ };
2100
+ const renderers = {
2101
+ overview: renderOverview,
2102
+ state: renderState,
2103
+ clock: renderClock,
2104
+ faults: renderFaults,
2105
+ journal: renderJournal,
2106
+ routes: renderRoutes
2107
+ };
2108
+ async function refresh() {
2109
+ clearError();
2110
+ const render2 = renderers[state.view];
2111
+ if (render2)
2112
+ await render2();
2113
+ }
2114
+ el("namespace", HTMLSelectElement).addEventListener("change", () => {
2115
+ state.namespace = el("namespace", HTMLSelectElement).value;
2116
+ refresh().catch(showError);
2117
+ });
2118
+ keyInput.addEventListener("change", () => {
2119
+ state.key = keyInput.value.trim();
2120
+ sessionStorage.setItem("mockingbird-admin-key", state.key);
2121
+ refresh().catch(showError);
2122
+ });
2123
+ el("refresh", HTMLButtonElement).addEventListener("click", () => {
2124
+ refresh().catch(showError);
2125
+ });
2126
+ el("collections", HTMLElement).addEventListener("click", (event) => {
2127
+ const target = event.target;
2128
+ if (!(target instanceof Element))
2129
+ return;
2130
+ const button = target.closest("[data-collection]");
2131
+ if (!(button instanceof HTMLElement))
2132
+ return;
2133
+ const collection = button.dataset.collection;
2134
+ if (collection === void 0)
2135
+ return;
2136
+ state.collection = collection;
2137
+ renderState().catch(showError);
2138
+ });
2139
+ el("records", HTMLElement).addEventListener("click", (event) => {
2140
+ const target = event.target;
2141
+ if (!(target instanceof Element))
2142
+ return;
2143
+ const row = target.closest("[data-id]");
2144
+ if (!(row instanceof HTMLElement))
2145
+ return;
2146
+ const id = row.dataset.id;
2147
+ if (id === void 0)
2148
+ return;
2149
+ openEditor(id).catch(showError);
2150
+ });
2151
+ const editor = el("editor", HTMLDialogElement);
2152
+ const editorId = el("editor-id", HTMLInputElement);
2153
+ const editorValue = el("editor-value", HTMLTextAreaElement);
2154
+ const editorDelete = el("editor-delete", HTMLButtonElement);
2155
+ async function openEditor(id) {
2156
+ state.editing = id;
2157
+ el("editor-title", HTMLElement).textContent = id ? "Edit record" : "New record";
2158
+ editorId.value = id ?? "";
2159
+ editorId.readOnly = id !== null;
2160
+ editorDelete.hidden = id === null;
2161
+ if (id) {
2162
+ const record = await api("GET", `/state/${encodeURIComponent(state.collection)}/${encodeURIComponent(id)}`);
2163
+ if (!isRecord2(record))
2164
+ throw new Error("Record response was not an object");
2165
+ editorValue.value = JSON.stringify(record.value, null, 2) ?? "";
2166
+ } else {
2167
+ editorValue.value = "{\n \n}";
2168
+ }
2169
+ editor.showModal();
2170
+ }
2171
+ el("new-record", HTMLButtonElement).addEventListener("click", () => {
2172
+ openEditor(null).catch(showError);
2173
+ });
2174
+ el("editor-form", HTMLFormElement).addEventListener("submit", (event) => {
2175
+ const submitter = event.submitter;
2176
+ if (!(submitter instanceof HTMLButtonElement) || submitter.value !== "save")
2177
+ return;
2178
+ event.preventDefault();
2179
+ let value;
2180
+ try {
2181
+ value = readJson3(editorValue.value);
2182
+ } catch {
2183
+ showError(new Error("Value is not JSON"));
2184
+ return;
2185
+ }
2186
+ const id = editorId.value.trim();
2187
+ const path = `/state/${encodeURIComponent(state.collection)}`;
2188
+ const request2 = state.editing ? api("PUT", `${path}/${encodeURIComponent(id)}`, { value }) : api("POST", path, { id: id || void 0, value });
2189
+ request2.then(() => {
2190
+ editor.close();
2191
+ return renderState();
2192
+ }).catch(showError);
2193
+ });
2194
+ editorDelete.addEventListener("click", () => {
2195
+ const id = state.editing;
2196
+ if (!id)
2197
+ return;
2198
+ api("DELETE", `/state/${encodeURIComponent(state.collection)}/${encodeURIComponent(id)}`).then(() => {
2199
+ editor.close();
2200
+ return renderState();
2201
+ }).catch(showError);
2202
+ });
2203
+ for (const button of document.querySelectorAll("[data-advance]")) {
2204
+ if (!(button instanceof HTMLButtonElement))
2205
+ continue;
2206
+ button.addEventListener("click", () => {
2207
+ const raw = button.dataset.advance;
2208
+ if (raw === void 0)
2209
+ return;
2210
+ api("POST", "/clock", { advance: Number(raw) }).then(() => renderClock()).catch(showError);
2211
+ });
2212
+ }
2213
+ el("freeze", HTMLButtonElement).addEventListener("click", () => {
2214
+ const frozen = el("freeze", HTMLButtonElement).dataset.frozen === "1";
2215
+ api("POST", "/clock", { freeze: !frozen }).then(() => renderClock()).catch(showError);
2216
+ });
2217
+ el("clock-reset", HTMLButtonElement).addEventListener("click", () => {
2218
+ api("POST", "/clock", { reset: true }).then(() => renderClock()).catch(showError);
2219
+ });
2220
+ el("clock-set", HTMLFormElement).addEventListener("submit", (event) => {
2221
+ event.preventDefault();
2222
+ const raw = el("clock-instant", HTMLInputElement).value.trim();
2223
+ const set = /^-?\d+$/.test(raw) ? Number(raw) : raw;
2224
+ api("POST", "/clock", { set }).then(() => renderClock()).catch(showError);
2225
+ });
2226
+ el("fault-form", HTMLFormElement).addEventListener("submit", (event) => {
2227
+ event.preventDefault();
2228
+ const preset = el("fault-preset", HTMLSelectElement).value;
2229
+ if (preset !== "") {
2230
+ api("POST", "/faults", { preset }).then(() => renderFaults()).catch(showError);
2231
+ return;
2232
+ }
2233
+ const status = Number(el("fault-status", HTMLInputElement).value);
2234
+ if (!Number.isFinite(status)) {
2235
+ showError(new Error("Status must be a number, or choose a preset"));
2236
+ return;
2237
+ }
2238
+ const path = el("fault-path", HTMLInputElement).value;
2239
+ const method = el("fault-method", HTMLInputElement).value;
2240
+ api("POST", "/faults", {
2241
+ status,
2242
+ ...path !== "" ? { pathPrefix: path } : {},
2243
+ ...method !== "" ? { method } : {}
2244
+ }).then(() => renderFaults()).catch(showError);
2245
+ });
2246
+ el("fault-clear", HTMLButtonElement).addEventListener("click", () => {
2247
+ api("DELETE", "/faults").then(() => renderFaults()).catch(showError);
2248
+ });
2249
+ el("journal-clear", HTMLButtonElement).addEventListener("click", () => {
2250
+ api("DELETE", "/requests").then(() => renderJournal()).catch(showError);
2251
+ });
2252
+ el("route-list", HTMLElement).addEventListener("click", (event) => {
2253
+ const target = event.target;
2254
+ if (!(target instanceof Element))
2255
+ return;
2256
+ const button = target.closest("[data-route]");
2257
+ if (!(button instanceof HTMLElement))
2258
+ return;
2259
+ const route = button.dataset.route;
2260
+ if (route === void 0)
2261
+ return;
2262
+ state.route = route;
2263
+ el("route-title", HTMLElement).textContent = route;
2264
+ const method = route.split(" ")[0] ?? "";
2265
+ el("route-body", HTMLTextAreaElement).disabled = method === "GET" || method === "DELETE";
2266
+ });
2267
+ el("route-form", HTMLFormElement).addEventListener("submit", (event) => {
2268
+ event.preventDefault();
2269
+ const send = async () => {
2270
+ if (state.route === null)
2271
+ throw new Error("Choose a route first");
2272
+ const parts = state.route.split(" ");
2273
+ const method = parts[0];
2274
+ const path = parts.slice(1).join(" ");
2275
+ if (method === void 0)
2276
+ throw new Error("Choose a route first");
2277
+ const concrete = path.replace(/:([A-Za-z0-9_]+)/g, (_match, key) => prompt(`Value for ${key}`) || "");
2278
+ let body;
2279
+ const routeBody = el("route-body", HTMLTextAreaElement);
2280
+ if (method !== "GET" && method !== "DELETE" && routeBody.value.trim() !== "") {
2281
+ try {
2282
+ body = readJson3(routeBody.value);
2283
+ } catch {
2284
+ throw new Error("Body is not JSON");
2285
+ }
2286
+ }
2287
+ const data = await api(method, concrete, body);
2288
+ el("route-result", HTMLElement).textContent = JSON.stringify(data, null, 2);
2289
+ };
2290
+ send().catch(showError);
2291
+ });
2292
+ const decodePanel = (value) => {
2293
+ if (!isRecord2(value) || typeof value.id !== "string" || typeof value.title !== "string") {
2294
+ return void 0;
2295
+ }
2296
+ const panel = {
2297
+ id: value.id,
2298
+ title: value.title,
2299
+ description: typeof value.description === "string" ? value.description : "",
2300
+ html: typeof value.html === "string" ? value.html : ""
2301
+ };
2302
+ if (typeof value.script === "string")
2303
+ panel.script = value.script;
2304
+ return panel;
2305
+ };
2306
+ const mountPanels = (panels) => {
2307
+ const nav = el("nav", HTMLElement);
2308
+ const views = el("views", HTMLElement);
2309
+ for (const panel of panels) {
2310
+ const button = document.createElement("button");
2311
+ button.type = "button";
2312
+ button.dataset.view = panel.id;
2313
+ button.textContent = panel.title;
2314
+ nav.append(button);
2315
+ const section = document.createElement("section");
2316
+ section.className = "view";
2317
+ section.id = `view-${panel.id}`;
2318
+ section.hidden = true;
2319
+ const title = document.createElement("h2");
2320
+ title.textContent = panel.title;
2321
+ const lede = document.createElement("p");
2322
+ lede.className = "lede";
2323
+ lede.textContent = panel.description;
2324
+ const body = document.createElement("div");
2325
+ body.className = "panel-body";
2326
+ body.id = `panel-${panel.id}`;
2327
+ body.innerHTML = panel.html;
2328
+ section.append(title, lede, body);
2329
+ views.append(section);
2330
+ if (panel.script === void 0)
2331
+ continue;
2332
+ try {
2333
+ const compiled = new Function("root", "api", panel.script);
2334
+ if (!isPanelScript(compiled))
2335
+ throw new Error("panel script did not compile");
2336
+ compiled(body, panelApi);
2337
+ } catch (error) {
2338
+ const note = document.createElement("p");
2339
+ note.className = "banner show";
2340
+ note.textContent = error instanceof Error ? error.message : String(error);
2341
+ body.append(note);
2342
+ }
2343
+ }
2344
+ };
2345
+ startAdminBrand({
2346
+ document,
2347
+ $: (id) => document.getElementById(id),
2348
+ params,
2349
+ location: { href: location.href, origin: location.origin },
2350
+ fetch,
2351
+ brandsUrl: config.brandsUrl
2352
+ });
2353
+ loadNamespaces().then(() => api("GET", "/ui/manifest")).then((manifest) => {
2354
+ const panels = requireList(isRecord2(manifest) ? manifest.panels : void 0, "Panels").flatMap((panel) => {
2355
+ const decoded = decodePanel(panel);
2356
+ return decoded === void 0 ? [] : [decoded];
2357
+ });
2358
+ mountPanels(panels);
2359
+ return refresh();
2360
+ }).catch(showError);
2361
+ }
2362
+ var clientPrelude = [isRecord2, mountAdminBrand, startAdminBrand, faultPresetList, bootAdmin].map((fn) => fn.toString()).join("\n");
2363
+ var adminClientSource = (config) => {
2364
+ const payload = JSON.stringify(config).replace(/</g, "\\u003c");
2365
+ return `<script>
2366
+ ${clientPrelude}
2367
+ bootAdmin(${payload});
2368
+ </script>`;
2369
+ };
2370
+
2371
+ // ../core/dist/surface.js
2372
+ var defineMock = (runtime) => runtime;
2373
+ var STANDARD_ADMIN_ROUTES = [
2374
+ "GET /",
2375
+ "POST /reset",
2376
+ "GET /namespaces",
2377
+ "GET /clock",
2378
+ "POST /clock",
2379
+ "GET /faults",
2380
+ "POST /faults",
2381
+ "DELETE /faults",
2382
+ "POST /snapshots",
2383
+ "POST /snapshots/:id/restore",
2384
+ "DELETE /snapshots/:id",
2385
+ "GET /timeline",
2386
+ "POST /checkpoints",
2387
+ "POST /branches/:name",
2388
+ "POST /branches/:name/checkout",
2389
+ "GET /requests",
2390
+ "DELETE /requests",
2391
+ "GET /metrics",
2392
+ "DELETE /metrics",
2393
+ "GET /credentials",
2394
+ "PUT /credentials",
2395
+ "DELETE /credentials",
2396
+ "GET /state",
2397
+ "GET /state/:collection",
2398
+ "GET /state/:collection/:id",
2399
+ "POST /state/:collection",
2400
+ "PUT /state/:collection/:id",
2401
+ "PATCH /state/:collection/:id",
2402
+ "DELETE /state/:collection/:id",
2403
+ "GET /ui",
2404
+ "GET /ui/",
2405
+ "GET /ui/manifest"
2406
+ ];
2407
+ var PANEL_ID = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
2408
+ var assertAdminUi = (ui) => {
2409
+ if (!ui?.panels)
2410
+ return;
2411
+ const seen = /* @__PURE__ */ new Set();
2412
+ for (const panel of ui.panels) {
2413
+ if (!PANEL_ID.test(panel.id)) {
2414
+ throw new RangeError(`admin panel id must match ${PANEL_ID}: ${JSON.stringify(panel.id)}`);
2415
+ }
2416
+ if (seen.has(panel.id))
2417
+ throw new RangeError(`duplicate admin panel id ${panel.id}`);
2418
+ seen.add(panel.id);
2419
+ if (panel.title.trim() === "")
2420
+ throw new RangeError(`admin panel ${panel.id} needs a title`);
2421
+ }
2422
+ };
2423
+
2424
+ // ../core/dist/admin-ui.js
2425
+ var escapeHtml = (value) => value.replace(/[&<>"']/g, (char) => {
2426
+ switch (char) {
2427
+ case "&":
2428
+ return "&amp;";
2429
+ case "<":
2430
+ return "&lt;";
2431
+ case ">":
2432
+ return "&gt;";
2433
+ case '"':
2434
+ return "&quot;";
2435
+ default:
2436
+ return "&#39;";
2437
+ }
2438
+ });
2439
+ var ADMIN_BRANDS_URL = "https://mockingbird.chrisvouga.dev/brands.json";
2440
+ var renderAdminDocument = (service) => {
2441
+ const name = escapeHtml(service);
2442
+ const script = adminClientSource({
2443
+ standardRoutes: STANDARD_ADMIN_ROUTES,
2444
+ adminPrefix: ADMIN_PREFIX,
2445
+ adminKeyHeader: ADMIN_KEY_HEADER,
2446
+ brandsUrl: ADMIN_BRANDS_URL,
2447
+ service
2448
+ });
2449
+ return `<!DOCTYPE html>
2450
+ <html lang="en">
2451
+ <head>
2452
+ <meta charset="utf-8">
2453
+ <meta name="viewport" content="width=device-width, initial-scale=1">
2454
+ <meta name="color-scheme" content="light dark">
2455
+ <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='2' fill='%2327272a'/%3E%3C/svg%3E">
2456
+ <title>${name} admin</title>
2457
+ <style>
2458
+ ${CSS_RESET}
2459
+ :root {
2460
+ color-scheme: light;
2461
+ --bg: #fafafa;
2462
+ --bg-elev: #ffffff;
2463
+ --bg-muted: #f4f4f5;
2464
+ --bg-inset: #f4f4f5;
2465
+ --line: #dedee3;
2466
+ --line-strong: #c4c4cc;
2467
+ --ink: #18181b;
2468
+ --muted: #62626b;
2469
+ --faint: #71717a;
2470
+ --accent: #27272a;
2471
+ --accent-ink: #ffffff;
2472
+ --accent-soft: #f4f4f5;
2473
+ --ok: #166534;
2474
+ --ok-soft: #f0fdf4;
2475
+ --warn: #a16207;
2476
+ --warn-soft: #fefce8;
2477
+ --err: #a82d32;
2478
+ --err-soft: #fef2f2;
2479
+ --shadow: none;
2480
+ --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
2481
+ --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
2482
+ --radius: 10px;
2483
+ --header: 56px;
2484
+ --nav: 200px;
2485
+ }
2486
+ :root[data-theme="dark"] {
2487
+ color-scheme: dark;
2488
+ --bg: #111113;
2489
+ --bg-elev: #19191c;
2490
+ --bg-muted: #242428;
2491
+ --bg-inset: #111113;
2492
+ --line: #36363c;
2493
+ --line-strong: #52525b;
2494
+ --ink: #f4f4f5;
2495
+ --muted: #a9a9b2;
2496
+ --faint: #71717a;
2497
+ --accent: #e4e4e7;
2498
+ --accent-ink: #18181b;
2499
+ --accent-soft: #242428;
2500
+ --ok: #86efac;
2501
+ --ok-soft: #14241b;
2502
+ --warn: #fde68a;
2503
+ --warn-soft: #2a2410;
2504
+ --err: #ffaaaa;
2505
+ --err-soft: #2c1516;
2506
+ --shadow: none;
2507
+ }
2508
+ @media (prefers-color-scheme: dark) {
2509
+ :root:not([data-theme="light"]) {
2510
+ color-scheme: dark;
2511
+ --bg: #111113;
2512
+ --bg-elev: #19191c;
2513
+ --bg-muted: #242428;
2514
+ --bg-inset: #111113;
2515
+ --line: #36363c;
2516
+ --line-strong: #52525b;
2517
+ --ink: #f4f4f5;
2518
+ --muted: #a9a9b2;
2519
+ --faint: #71717a;
2520
+ --accent: #e4e4e7;
2521
+ --accent-ink: #18181b;
2522
+ --accent-soft: #242428;
2523
+ --ok: #86efac;
2524
+ --ok-soft: #14241b;
2525
+ --warn: #fde68a;
2526
+ --warn-soft: #2a2410;
2527
+ --err: #ffaaaa;
2528
+ --err-soft: #2c1516;
2529
+ --shadow: none;
2530
+ }
2531
+ }
2532
+ /* Fill the viewport, then grow with the content so the background covers the scroll. */
2533
+ html { height: 100%; }
2534
+ body {
2535
+ margin: 0;
2536
+ min-height: 100%;
2537
+ display: flex;
2538
+ flex-direction: column;
2539
+ font-family: var(--sans);
2540
+ background: var(--bg);
2541
+ color: var(--ink);
2542
+ line-height: 1.45;
2543
+ padding-left: env(safe-area-inset-left);
2544
+ padding-right: env(safe-area-inset-right);
2545
+ -webkit-text-size-adjust: 100%;
2546
+ }
2547
+ :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
2548
+ .app { flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; width: 100%; }
2549
+ header.top {
2550
+ position: sticky; top: 0; z-index: 5;
2551
+ display: flex; align-items: center; gap: 12px;
2552
+ min-height: var(--header); padding: 10px 16px;
2553
+ background: var(--bg-elev);
2554
+ border-bottom: 1px solid var(--line);
2555
+ min-width: 0; max-width: 100%;
2556
+ }
2557
+ .brand {
2558
+ display: flex; flex-flow: row wrap; align-items: center; gap: 14px;
2559
+ min-width: 0; max-width: 100%; margin-right: auto;
2560
+ }
2561
+ .brand-id { display: flex; flex-direction: column; min-width: 0; flex: none; }
2562
+ .brand-id strong { font-size: 15px; letter-spacing: -0.01em; }
2563
+ .brand-id span { color: var(--faint); font-size: 12px; }
2564
+ .vendor {
2565
+ display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
2566
+ min-width: 0; max-width: 100%; font-size: 12px; color: var(--muted);
2567
+ }
2568
+ .vendor[hidden] { display: none; }
2569
+ /* Logos are drawn for a light tile, same as the docs site, so the plate stays white. */
2570
+ .vendor img {
2571
+ width: 16px; height: 16px; padding: 2px; box-sizing: content-box;
2572
+ border-radius: 4px; border: 1px solid var(--line); background: #fff; object-fit: contain;
2573
+ }
2574
+ .vendor-name { color: var(--ink); font-weight: 600; }
2575
+ .vendor-sep { color: var(--faint); }
2576
+ .vendor-link { color: inherit; text-decoration: none; }
2577
+ .vendor-link:hover { color: var(--ink); text-decoration: underline; }
2578
+ .controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
2579
+ label.field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--faint); }
2580
+ label.field input, label.field select, .controls input[type="password"] {
2581
+ background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
2582
+ padding: 7px 8px; min-height: 36px;
2583
+ }
2584
+ .icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger {
2585
+ border-radius: 9px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line);
2586
+ background: var(--bg-elev);
2587
+ }
2588
+ .btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
2589
+ .btn-quiet { background: transparent; }
2590
+ .btn-danger { color: var(--err); }
2591
+ /* minmax(0, 1fr): a 1fr column will not shrink below its content, so a long
2592
+ record or the full nav row would widen the page past the viewport. */
2593
+ .layout {
2594
+ display: grid; grid-template-columns: var(--nav) minmax(0, 1fr);
2595
+ flex: 1 0 auto; min-width: 0;
2596
+ }
2597
+ nav.side {
2598
+ border-right: 1px solid var(--line); padding: 12px;
2599
+ display: flex; flex-direction: column; gap: 4px;
2600
+ background: var(--bg-elev);
2601
+ }
2602
+ nav.side button {
2603
+ text-align: left; border: 0; background: transparent; border-radius: 9px;
2604
+ padding: 9px 10px; min-height: 40px; color: var(--muted);
2605
+ }
2606
+ nav.side button[aria-current="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
2607
+ main { padding: 20px; max-width: 1100px; width: 100%; min-width: 0; }
2608
+ .view h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.02em; }
2609
+ .lede { margin: 0 0 16px; color: var(--muted); }
2610
+ .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
2611
+ .card {
2612
+ background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
2613
+ padding: 14px 16px; box-shadow: var(--shadow);
2614
+ }
2615
+ .card .k { color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
2616
+ .card .v { display: flex; flex-direction: column; gap: 2px; font-size: 22px; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
2617
+ .card .v .clock-time { font-size: 14px; color: var(--muted); }
2618
+ .split { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 16px; align-items: start; }
2619
+ .collection {
2620
+ width: 100%; text-align: left; border: 1px solid transparent; background: transparent;
2621
+ border-radius: 10px; padding: 8px 10px; min-height: 44px;
2622
+ }
2623
+ .collection[aria-current="true"] { background: var(--bg-elev); border-color: var(--line); }
2624
+ .collection small { display: block; color: var(--faint); }
2625
+ .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
2626
+ .chip {
2627
+ font-family: var(--mono); font-size: 12px; background: var(--bg-muted);
2628
+ border-radius: 999px; padding: 4px 8px;
2629
+ }
2630
+ .chip i { color: var(--faint); font-style: normal; }
2631
+ table { width: 100%; border-collapse: collapse; font-size: 14px; }
2632
+ th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
2633
+ th { color: var(--faint); font-weight: 600; font-size: 12px; }
2634
+ tr.clickable { cursor: pointer; }
2635
+ tr.clickable:hover { background: var(--bg-muted); }
2636
+ pre, code, .mono { font-family: var(--mono); overflow-wrap: anywhere; }
2637
+ pre {
2638
+ margin: 0; white-space: pre-wrap; word-break: break-word;
2639
+ background: var(--bg-inset); border-radius: 10px; padding: 12px; font-size: 12px;
2640
+ }
2641
+ .row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
2642
+ .banner {
2643
+ display: none; margin-bottom: 12px; padding: 10px 12px; border-radius: 10px;
2644
+ background: var(--err-soft); color: var(--err);
2645
+ }
2646
+ .banner.show { display: block; }
2647
+ .empty { color: var(--muted); padding: 24px 8px; }
2648
+ dialog {
2649
+ border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: var(--bg-elev);
2650
+ color: var(--ink); width: min(640px, calc(100vw - 24px)); box-shadow: none;
2651
+ }
2652
+ dialog::backdrop { background: rgb(20 19 17 / 0.45); }
2653
+ dialog form, .dialog-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
2654
+ textarea {
2655
+ width: 100%; min-height: 180px; resize: vertical; border-radius: 10px;
2656
+ border: 1px solid var(--line); background: var(--bg-inset); padding: 10px;
2657
+ font-family: var(--mono); font-size: 12px;
2658
+ }
2659
+ .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
2660
+ .badge { font-size: 11px; border-radius: 999px; padding: 2px 7px; background: var(--bg-muted); color: var(--muted); }
2661
+ .badge.ok { background: var(--ok-soft); color: var(--ok); }
2662
+ .badge.warn { background: var(--warn-soft); color: var(--warn); }
2663
+ .status-2 { color: var(--ok); }
2664
+ .status-4, .status-5, .status-0 { color: var(--err); }
2665
+ .stack { display: flex; flex-direction: column; gap: 12px; }
2666
+ .route {
2667
+ display: grid; grid-template-columns: 88px 1fr auto; gap: 8px; align-items: center;
2668
+ padding: 8px 0; border-bottom: 1px solid var(--line);
2669
+ }
2670
+ .method { font-family: var(--mono); font-size: 12px; font-weight: 700; }
2671
+ @media (max-width: 800px) {
2672
+ header.top {
2673
+ align-items: stretch; flex-direction: column;
2674
+ padding-top: max(10px, env(safe-area-inset-top));
2675
+ }
2676
+ input, select, textarea { font-size: 16px; }
2677
+ .brand, .vendor, .controls { width: 100%; }
2678
+ label.field, label.field select, label.field input { flex: 1; min-width: 0; }
2679
+ .layout { grid-template-columns: minmax(0, 1fr); }
2680
+ nav.side {
2681
+ flex-direction: row; align-items: center; overflow-x: auto; min-width: 0;
2682
+ border-right: 0; border-bottom: 1px solid var(--line);
2683
+ padding: 8px;
2684
+ }
2685
+ nav.side button { white-space: nowrap; flex: none; }
2686
+ .split { grid-template-columns: minmax(0, 1fr); }
2687
+ main { padding: 14px; }
2688
+ table, thead, tbody, tr, th, td { display: block; }
2689
+ thead { display: none; }
2690
+ tr {
2691
+ border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; padding: 6px;
2692
+ background: var(--bg-elev); min-width: 0;
2693
+ }
2694
+ td {
2695
+ border: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px;
2696
+ min-width: 0; overflow-wrap: anywhere;
2697
+ }
2698
+ td::before { content: attr(data-label); color: var(--faint); font-size: 12px; flex: none; }
2699
+ .route { grid-template-columns: 72px 1fr; }
2700
+ .route button { grid-column: 1 / -1; }
2701
+ }
2702
+ </style>
2703
+ </head>
2704
+ <body>
2705
+ <div class="app" data-service="${name}" data-mockingbird-admin>
2706
+ <header class="top">
2707
+ <div class="brand">
2708
+ <div class="brand-id">
2709
+ <strong>${name}</strong>
2710
+ <span>Admin</span>
2711
+ </div>
2712
+ <div class="vendor" id="vendor" hidden></div>
2713
+ </div>
2714
+ <div class="controls">
2715
+ <label class="field">Namespace
2716
+ <select id="namespace" aria-label="Namespace"></select>
2717
+ </label>
2718
+ <label class="field">Admin key
2719
+ <input id="admin-key" type="password" autocomplete="off" spellcheck="false" aria-label="Admin key">
2720
+ </label>
2721
+ <button class="icon-btn" id="theme" type="button" aria-label="Toggle color theme">Theme</button>
2722
+ <button class="btn" id="refresh" type="button">Refresh</button>
2723
+ </div>
2724
+ </header>
2725
+ <div class="layout">
2726
+ <nav class="side" id="nav" aria-label="Admin sections">
2727
+ <button type="button" data-view="overview" aria-current="true">Overview</button>
2728
+ <button type="button" data-view="state">State</button>
2729
+ <button type="button" data-view="clock">Clock</button>
2730
+ <button type="button" data-view="faults">Faults</button>
2731
+ <button type="button" data-view="journal">Journal</button>
2732
+ <button type="button" data-view="routes">Routes</button>
2733
+ </nav>
2734
+ <main id="views">
2735
+ <p class="banner" id="banner" role="alert"></p>
2736
+ <section class="view" id="view-overview">
2737
+ <h2>Overview</h2>
2738
+ <p class="lede">Health, clock, and the collections this namespace is holding.</p>
2739
+ <div class="grid" id="overview-cards"></div>
2740
+ <h3>Recent requests</h3>
2741
+ <div id="overview-requests"></div>
2742
+ </section>
2743
+ <section class="view" id="view-state" hidden>
2744
+ <h2>State</h2>
2745
+ <p class="lede">Every collection in this namespace. Declared fields stay visible before any row exists; stored rows add whatever else they contain.</p>
2746
+ <div class="split">
2747
+ <div id="collections"></div>
2748
+ <div>
2749
+ <div id="schema"></div>
2750
+ <div class="row-actions">
2751
+ <button class="btn-primary" id="new-record" type="button">New record</button>
2752
+ </div>
2753
+ <div id="records"></div>
2754
+ </div>
2755
+ </div>
2756
+ </section>
2757
+ <section class="view" id="view-clock" hidden>
2758
+ <h2>Clock</h2>
2759
+ <p class="lede">The clock every timestamp in this mock reads.</p>
2760
+ <div class="card" id="clock-readout"></div>
2761
+ <div class="row-actions">
2762
+ <button class="btn" type="button" data-advance="60000">+1m</button>
2763
+ <button class="btn" type="button" data-advance="900000">+15m</button>
2764
+ <button class="btn" type="button" data-advance="3600000">+1h</button>
2765
+ <button class="btn" type="button" data-advance="86400000">+1d</button>
2766
+ <button class="btn" type="button" data-advance="-3600000">\u22121h</button>
2767
+ <button class="btn" id="freeze" type="button">Freeze</button>
2768
+ <button class="btn-quiet" id="clock-reset" type="button">Reset</button>
2769
+ </div>
2770
+ <form id="clock-set" class="row-actions">
2771
+ <label class="field">Set instant
2772
+ <input id="clock-instant" type="text" placeholder="2026-01-01T00:00:00Z or epoch ms" size="32">
2773
+ </label>
2774
+ <button class="btn-primary" type="submit">Set</button>
2775
+ </form>
2776
+ </section>
2777
+ <section class="view" id="view-faults" hidden>
2778
+ <h2>Faults</h2>
2779
+ <p class="lede">Inject a response, a delay, or a named preset. Rules apply to this namespace.</p>
2780
+ <form id="fault-form" class="card stack">
2781
+ <label class="field">Preset
2782
+ <select id="fault-preset"><option value="">Custom rule</option></select>
2783
+ </label>
2784
+ <label class="field">Status
2785
+ <input id="fault-status" inputmode="numeric" placeholder="503">
2786
+ </label>
2787
+ <label class="field">Path prefix
2788
+ <input id="fault-path" placeholder="/v1">
2789
+ </label>
2790
+ <label class="field">Method
2791
+ <input id="fault-method" placeholder="GET">
2792
+ </label>
2793
+ <div class="dialog-actions">
2794
+ <button class="btn-primary" type="submit">Add fault</button>
2795
+ <button class="btn-danger" id="fault-clear" type="button">Clear all</button>
2796
+ </div>
2797
+ </form>
2798
+ <div id="fault-list"></div>
2799
+ </section>
2800
+ <section class="view" id="view-journal" hidden>
2801
+ <h2>Journal</h2>
2802
+ <p class="lede">Requests this namespace has seen. Bodies are not stored.</p>
2803
+ <div class="row-actions">
2804
+ <button class="btn-danger" id="journal-clear" type="button">Clear journal</button>
2805
+ </div>
2806
+ <div id="journal"></div>
2807
+ </section>
2808
+ <section class="view" id="view-routes" hidden>
2809
+ <h2>Routes</h2>
2810
+ <p class="lede">Shared controls, plus any routes this mock adds. Extra routes are how a bespoke workflow shows up beside the default UI.</p>
2811
+ <div id="route-list"></div>
2812
+ <form id="route-form" class="card stack">
2813
+ <strong id="route-title">Select a route</strong>
2814
+ <label class="field">JSON body
2815
+ <textarea id="route-body" placeholder="{ }"></textarea>
2816
+ </label>
2817
+ <div class="dialog-actions">
2818
+ <button class="btn-primary" type="submit">Send</button>
2819
+ </div>
2820
+ <pre id="route-result">Response will show here.</pre>
2821
+ </form>
2822
+ </section>
2823
+ </main>
2824
+ </div>
2825
+ </div>
2826
+ <dialog id="editor">
2827
+ <form method="dialog" id="editor-form">
2828
+ <strong id="editor-title">Record</strong>
2829
+ <label class="field">Id
2830
+ <input id="editor-id" required>
2831
+ </label>
2832
+ <label class="field">JSON value
2833
+ <textarea id="editor-value"></textarea>
2834
+ </label>
2835
+ <div class="dialog-actions">
2836
+ <button class="btn-danger" id="editor-delete" type="button" value="delete">Delete</button>
2837
+ <button class="btn-quiet" type="submit" value="cancel">Cancel</button>
2838
+ <button class="btn-primary" type="submit" value="save">Save</button>
2839
+ </div>
2840
+ </form>
2841
+ </dialog>
2842
+ ${script}
2843
+ </body>
2844
+ </html>`;
2845
+ };
2846
+ var htmlResponse = (body) => new Response(body, {
2847
+ status: 200,
2848
+ headers: {
2849
+ "content-type": "text/html; charset=utf-8",
2850
+ "cache-control": "no-store"
2851
+ }
2852
+ });
2853
+ var json2 = (body) => new Response(JSON.stringify(body), {
2854
+ status: 200,
2855
+ headers: { "content-type": "application/json; charset=utf-8" }
2856
+ });
2857
+ var adminUiRoutes = (service, ui) => {
2858
+ const shell = () => renderAdminDocument(service);
2859
+ const document3 = () => ui?.render ? ui.render({ service, defaultHtml: shell }) : shell();
2860
+ return {
2861
+ "GET /ui": () => htmlResponse(document3()),
2862
+ "GET /ui/": () => htmlResponse(document3()),
2863
+ "GET /ui/manifest": () => json2({
2864
+ service,
2865
+ panels: (ui?.panels ?? []).map((panel) => ({
2866
+ id: panel.id,
2867
+ title: panel.title,
2868
+ ...panel.description !== void 0 ? { description: panel.description } : {},
2869
+ html: panel.html,
2870
+ ...panel.script !== void 0 ? { script: panel.script } : {}
2871
+ }))
2872
+ })
2873
+ };
2874
+ };
2875
+
1143
2876
  // ../../openapi/metadata/dist/types.js
1144
2877
  var EXTENSION_KEYS = {
1145
2878
  operation: "x-mockingbird",
@@ -1152,11 +2885,11 @@ var EXTENSION_KEYS = {
1152
2885
  };
1153
2886
 
1154
2887
  // ../../openapi/metadata/dist/read.js
1155
- var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
2888
+ var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1156
2889
  var extensionOf = (holder, key) => holder[key];
1157
2890
  var operationMetadata = (operation) => {
1158
2891
  const raw = extensionOf(operation, EXTENSION_KEYS.operation);
1159
- const ext = isRecord2(raw) ? raw : {};
2892
+ const ext = isRecord3(raw) ? raw : {};
1160
2893
  const supported = ext.supported ?? true;
1161
2894
  const parity = ext.parity ?? {};
1162
2895
  return {
@@ -1192,9 +2925,9 @@ ${problems.map((p) => ` - ${p}`).join("\n")}`);
1192
2925
  this.name = "OperationRegistryError";
1193
2926
  }
1194
2927
  };
1195
- var verifyOperations = (document2, handlers) => {
2928
+ var verifyOperations = (document3, handlers) => {
1196
2929
  const problems = [];
1197
- const operations = listOperations(document2);
2930
+ const operations = listOperations(document3);
1198
2931
  const seen = /* @__PURE__ */ new Set();
1199
2932
  for (const operation of operations) {
1200
2933
  if (seen.has(operation.operationId))
@@ -1303,15 +3036,449 @@ var restoreNamespace = (sqlite, namespace, snapshot) => {
1303
3036
  });
1304
3037
  };
1305
3038
 
3039
+ // ../core/dist/state-view.js
3040
+ var COLLECTION_NAME = /^[A-Za-z0-9_.@:-]{1,200}$/;
3041
+ var RECORD_ID = /^[^\s/]{1,256}$/;
3042
+ var SAMPLE = 25;
3043
+ var WALK_LIMIT = 1e4;
3044
+ var SKIP_CTORS = /* @__PURE__ */ new Set(["Hono", "HonoRequest", "Router"]);
3045
+ var fail = (status, message) => ({ ok: false, status, message });
3046
+ var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3047
+ var kindOf = (value) => {
3048
+ if (value === null)
3049
+ return "null";
3050
+ if (Array.isArray(value))
3051
+ return "array";
3052
+ switch (typeof value) {
3053
+ case "string":
3054
+ return "string";
3055
+ case "number":
3056
+ return Number.isFinite(value) ? "number" : "unknown";
3057
+ case "boolean":
3058
+ return "boolean";
3059
+ case "object":
3060
+ return "object";
3061
+ default:
3062
+ return "unknown";
3063
+ }
3064
+ };
3065
+ var humanize = (name) => {
3066
+ const words = name.replace(/[@:_-]+/g, " ").trim();
3067
+ if (words === "")
3068
+ return name;
3069
+ return words.charAt(0).toUpperCase() + words.slice(1);
3070
+ };
3071
+ var jsonValue = (value) => {
3072
+ if (value === void 0)
3073
+ return fail(400, "value is required");
3074
+ try {
3075
+ return { ok: true, value: JSON.parse(JSON.stringify(value)) };
3076
+ } catch {
3077
+ return fail(400, "value must be JSON");
3078
+ }
3079
+ };
3080
+ var ctorName = (value) => {
3081
+ const ctor = value.constructor;
3082
+ return typeof ctor?.name === "string" ? ctor.name : "";
3083
+ };
3084
+ var isSqlite = (value) => "prepare" in value && typeof value.prepare === "function" && "transaction" in value;
3085
+ var discoverCollections = (root) => {
3086
+ const found = [];
3087
+ const seen = /* @__PURE__ */ new Set();
3088
+ const visit = (value, depth) => {
3089
+ if (found.length + seen.size > WALK_LIMIT)
3090
+ return;
3091
+ if (value === null || typeof value !== "object")
3092
+ return;
3093
+ if (seen.has(value))
3094
+ return;
3095
+ seen.add(value);
3096
+ if (value instanceof Collection) {
3097
+ found.push(value);
3098
+ return;
3099
+ }
3100
+ if (value instanceof Map) {
3101
+ for (const child of value.values())
3102
+ visit(child, depth + 1);
3103
+ return;
3104
+ }
3105
+ if (value instanceof Set) {
3106
+ for (const child of value.values())
3107
+ visit(child, depth + 1);
3108
+ return;
3109
+ }
3110
+ if (depth > 6 || isSqlite(value) || SKIP_CTORS.has(ctorName(value)))
3111
+ return;
3112
+ if (Array.isArray(value)) {
3113
+ const cap = Math.min(value.length, 32);
3114
+ for (let i = 0; i < cap; i++)
3115
+ visit(value[i], depth + 1);
3116
+ return;
3117
+ }
3118
+ let children;
3119
+ try {
3120
+ children = Object.values(value);
3121
+ } catch {
3122
+ return;
3123
+ }
3124
+ for (const child of children)
3125
+ visit(child, depth + 1);
3126
+ };
3127
+ visit(root, 0);
3128
+ return found;
3129
+ };
3130
+ var storedNames = (sqlite, namespace) => {
3131
+ const records = sqlite.prepare("SELECT DISTINCT collection AS name FROM mockingbird_records WHERE namespace = ?").all(namespace);
3132
+ const sequences = sqlite.prepare("SELECT DISTINCT name FROM mockingbird_sequences WHERE namespace = ? AND kind = 'collection'").all(namespace);
3133
+ return [...records, ...sequences].map((row) => row.name);
3134
+ };
3135
+ var blankAccum = (name) => ({
3136
+ name,
3137
+ kinds: /* @__PURE__ */ new Set(),
3138
+ present: 0,
3139
+ nested: /* @__PURE__ */ new Map()
3140
+ });
3141
+ var absorb = (accum, value) => {
3142
+ const kind = kindOf(value);
3143
+ accum.kinds.add(kind);
3144
+ accum.present++;
3145
+ if (!isRecord4(value))
3146
+ return;
3147
+ for (const [key, child] of Object.entries(value)) {
3148
+ const nested = accum.nested.get(key) ?? blankAccum(key);
3149
+ absorb(nested, child);
3150
+ accum.nested.set(key, nested);
3151
+ }
3152
+ };
3153
+ var finishField = (accum, samples) => {
3154
+ const kinds = [...accum.kinds];
3155
+ const kind = kinds.length === 1 ? kinds[0] : "unknown";
3156
+ const field = {
3157
+ name: accum.name,
3158
+ kind,
3159
+ optional: accum.present < samples || kinds.includes("null")
3160
+ };
3161
+ if (accum.nested.size > 0) {
3162
+ field.fields = [...accum.nested.values()].sort((a, b) => a.name.localeCompare(b.name)).map((child) => finishField(child, accum.present));
3163
+ }
3164
+ return field;
3165
+ };
3166
+ var inferFields = (records) => {
3167
+ if (records.length === 0)
3168
+ return [];
3169
+ const sample = records.slice(0, SAMPLE);
3170
+ const objects = sample.filter((record) => isRecord4(record.value));
3171
+ if (objects.length === 0) {
3172
+ const kinds = new Set(sample.map((record) => kindOf(record.value)));
3173
+ const list = [...kinds];
3174
+ return [
3175
+ {
3176
+ name: "(value)",
3177
+ kind: list.length === 1 ? list[0] : "unknown",
3178
+ optional: false
3179
+ }
3180
+ ];
3181
+ }
3182
+ const root = /* @__PURE__ */ new Map();
3183
+ for (const record of objects) {
3184
+ for (const [key, value] of Object.entries(record.value)) {
3185
+ const accum = root.get(key) ?? blankAccum(key);
3186
+ absorb(accum, value);
3187
+ root.set(key, accum);
3188
+ }
3189
+ }
3190
+ return [...root.values()].sort((a, b) => a.name.localeCompare(b.name)).map((accum) => finishField(accum, objects.length));
3191
+ };
3192
+ var mergeFields = (declared, inferred) => {
3193
+ const byName = /* @__PURE__ */ new Map();
3194
+ for (const field of inferred)
3195
+ byName.set(field.name, field);
3196
+ const ordered = [];
3197
+ const seen = /* @__PURE__ */ new Set();
3198
+ for (const field of declared ?? []) {
3199
+ const found = byName.get(field.name);
3200
+ seen.add(field.name);
3201
+ if (!found) {
3202
+ ordered.push({ ...field, optional: field.optional });
3203
+ continue;
3204
+ }
3205
+ ordered.push({
3206
+ ...found,
3207
+ kind: field.kind === "unknown" ? found.kind : field.kind,
3208
+ optional: field.optional || found.optional,
3209
+ ...field.description !== void 0 ? { description: field.description } : {},
3210
+ ...field.meta !== void 0 ? { meta: field.meta } : {},
3211
+ ...field.fields !== void 0 ? { fields: mergeFields(field.fields, found.fields ?? []) } : {}
3212
+ });
3213
+ }
3214
+ for (const field of inferred) {
3215
+ if (!seen.has(field.name))
3216
+ ordered.push(field);
3217
+ }
3218
+ return ordered;
3219
+ };
3220
+ var collectionOf = (sqlite, namespace, name) => new Collection(sqlite, namespace, name);
3221
+ var readRecord = (collection, id) => {
3222
+ const rows = collection.list({ where: (_value, _seq) => true, order: "oldest" });
3223
+ const row = rows.find((entry) => entry.id === id);
3224
+ return row ? { id: row.id, seq: row.seq, value: row.value } : void 0;
3225
+ };
3226
+ var inspectState = (scope) => {
3227
+ const declared = /* @__PURE__ */ new Map();
3228
+ for (const declaration of scope.declarations ?? []) {
3229
+ if (COLLECTION_NAME.test(declaration.name))
3230
+ declared.set(declaration.name, declaration);
3231
+ }
3232
+ const names = new Set(declared.keys());
3233
+ for (const name of storedNames(scope.sqlite, scope.storageNamespace))
3234
+ names.add(name);
3235
+ for (const collection of discoverCollections(scope.root)) {
3236
+ if (collection.namespace === scope.storageNamespace)
3237
+ names.add(collection.collectionName);
3238
+ }
3239
+ const collections = [];
3240
+ for (const name of names) {
3241
+ if (!COLLECTION_NAME.test(name))
3242
+ continue;
3243
+ const declaration = declared.get(name);
3244
+ const collection = collectionOf(scope.sqlite, scope.storageNamespace, name);
3245
+ const records = collection.list({ order: "newest" }).slice(0, SAMPLE).map((row) => ({ id: row.id, seq: row.seq, value: row.value }));
3246
+ const inferred = inferFields(records);
3247
+ const fields = mergeFields(declaration?.fields, inferred);
3248
+ const source = declaration && records.length > 0 ? "mixed" : declaration ? "declared" : "inferred";
3249
+ collections.push({
3250
+ name,
3251
+ label: declaration?.label ?? humanize(name),
3252
+ ...declaration?.description !== void 0 ? { description: declaration.description } : {},
3253
+ count: collection.count(),
3254
+ source,
3255
+ fields,
3256
+ ...declaration?.meta !== void 0 ? { meta: declaration.meta } : {}
3257
+ });
3258
+ }
3259
+ const order = /* @__PURE__ */ new Map();
3260
+ for (const [index, item] of (scope.declarations ?? []).entries())
3261
+ order.set(item.name, index);
3262
+ collections.sort((a, b) => {
3263
+ const left = order.get(a.name);
3264
+ const right = order.get(b.name);
3265
+ if (left !== void 0 && right !== void 0)
3266
+ return left - right;
3267
+ if (left !== void 0)
3268
+ return -1;
3269
+ if (right !== void 0)
3270
+ return 1;
3271
+ return a.name.localeCompare(b.name);
3272
+ });
3273
+ return {
3274
+ namespace: scope.namespace,
3275
+ storageNamespace: scope.storageNamespace,
3276
+ collections
3277
+ };
3278
+ };
3279
+ var pageOf = (sqlite, storageNamespace, name, query) => {
3280
+ if (!COLLECTION_NAME.test(name))
3281
+ return fail(400, "collection name is not allowed");
3282
+ const limit = query.limit ?? 50;
3283
+ if (!Number.isInteger(limit) || limit < 1 || limit > 200) {
3284
+ return fail(400, "limit must be an integer from 1 to 200");
3285
+ }
3286
+ const order = query.order ?? "newest";
3287
+ if (order !== "newest" && order !== "oldest")
3288
+ return fail(400, 'order must be "newest" or "oldest"');
3289
+ const collection = collectionOf(sqlite, storageNamespace, name);
3290
+ const rows = collection.list({ order }).filter((row) => {
3291
+ if (query.after === void 0)
3292
+ return true;
3293
+ return order === "newest" ? row.seq < query.after : row.seq > query.after;
3294
+ });
3295
+ const slice = rows.slice(0, limit);
3296
+ const last = slice.at(-1);
3297
+ return {
3298
+ ok: true,
3299
+ value: {
3300
+ collection: name,
3301
+ count: collection.count(),
3302
+ records: slice.map((row) => ({ id: row.id, seq: row.seq, value: row.value })),
3303
+ next: rows.length > limit && last ? last.seq : null
3304
+ }
3305
+ };
3306
+ };
3307
+ var readStatePage = (scope, name, query = {}) => pageOf(scope.sqlite, scope.storageNamespace, name, query);
3308
+ var readStateRecord = (scope, name, id) => {
3309
+ if (!COLLECTION_NAME.test(name))
3310
+ return fail(400, "collection name is not allowed");
3311
+ if (!RECORD_ID.test(id))
3312
+ return fail(400, "record id is not allowed");
3313
+ const record = readRecord(collectionOf(scope.sqlite, scope.storageNamespace, name), id);
3314
+ return record ? { ok: true, value: record } : fail(404, `no record ${id} in ${name}`);
3315
+ };
3316
+ var requireId = (id) => RECORD_ID.test(id) ? { ok: true, value: id } : fail(400, "id must be a single path segment");
3317
+ var createStateRecord = (scope, name, input) => {
3318
+ if (!COLLECTION_NAME.test(name))
3319
+ return fail(400, "collection name is not allowed");
3320
+ const parsed = jsonValue(input.value);
3321
+ if (!parsed.ok)
3322
+ return parsed;
3323
+ const collection = collectionOf(scope.sqlite, scope.storageNamespace, name);
3324
+ const id = input.id ?? `${name}_${collection.nextSequence()}`;
3325
+ const checked = requireId(id);
3326
+ if (!checked.ok)
3327
+ return checked;
3328
+ if (collection.has(checked.value))
3329
+ return fail(409, `record ${checked.value} already exists`);
3330
+ const stored = collection.insert(checked.value, parsed.value);
3331
+ return { ok: true, value: { id: checked.value, seq: stored.seq, value: stored.value } };
3332
+ };
3333
+ var replaceStateRecord = (scope, name, id, value) => {
3334
+ if (!COLLECTION_NAME.test(name))
3335
+ return fail(400, "collection name is not allowed");
3336
+ const checked = requireId(id);
3337
+ if (!checked.ok)
3338
+ return checked;
3339
+ const parsed = jsonValue(value);
3340
+ if (!parsed.ok)
3341
+ return parsed;
3342
+ const collection = collectionOf(scope.sqlite, scope.storageNamespace, name);
3343
+ if (!collection.has(checked.value))
3344
+ return fail(404, `no record ${checked.value} in ${name}`);
3345
+ const stored = collection.update(checked.value, parsed.value);
3346
+ if (!stored)
3347
+ return fail(404, `no record ${checked.value} in ${name}`);
3348
+ return { ok: true, value: { id: checked.value, seq: stored.seq, value: stored.value } };
3349
+ };
3350
+ var patchStateRecord = (scope, name, id, value) => {
3351
+ const current = readStateRecord(scope, name, id);
3352
+ if (!current.ok)
3353
+ return current;
3354
+ const parsed = jsonValue(value);
3355
+ if (!parsed.ok)
3356
+ return parsed;
3357
+ const next = isRecord4(current.value.value) && isRecord4(parsed.value) ? { ...current.value.value, ...parsed.value } : parsed.value;
3358
+ return replaceStateRecord(scope, name, id, next);
3359
+ };
3360
+ var deleteStateRecord = (scope, name, id) => {
3361
+ if (!COLLECTION_NAME.test(name))
3362
+ return fail(400, "collection name is not allowed");
3363
+ const checked = requireId(id);
3364
+ if (!checked.ok)
3365
+ return checked;
3366
+ const collection = collectionOf(scope.sqlite, scope.storageNamespace, name);
3367
+ return collection.delete(checked.value) ? { ok: true, value: { id: checked.value } } : fail(404, `no record ${checked.value} in ${name}`);
3368
+ };
3369
+ var json3 = (status, body) => new Response(JSON.stringify(body), {
3370
+ status,
3371
+ headers: { "content-type": "application/json; charset=utf-8" }
3372
+ });
3373
+ var adminError2 = (status, message) => json3(status, { error: { type: "mockingbird_admin", message } });
3374
+ var fromResult = (result, status) => result.ok ? json3(status, result.value) : adminError2(result.status, result.message);
3375
+ var integerParam = (value) => {
3376
+ if (value === null)
3377
+ return void 0;
3378
+ if (!/^-?\d+$/.test(value))
3379
+ return "bad";
3380
+ return Number(value);
3381
+ };
3382
+ var stateAdminRoutes = (routes) => {
3383
+ const open = (namespace) => {
3384
+ try {
3385
+ return { ok: true, value: routes.open(namespace) };
3386
+ } catch (error) {
3387
+ return fail(400, error instanceof Error ? error.message : String(error));
3388
+ }
3389
+ };
3390
+ const wrote = (namespace) => {
3391
+ routes.afterWrite?.(namespace);
3392
+ };
3393
+ return {
3394
+ "GET /state": ({ namespace }) => {
3395
+ const scope = open(namespace);
3396
+ return fromResult(scope.ok ? { ok: true, value: inspectState(scope.value) } : scope, 200);
3397
+ },
3398
+ "GET /state/:collection": ({ namespace, params, url }) => {
3399
+ const scope = open(namespace);
3400
+ if (!scope.ok)
3401
+ return fromResult(scope, 200);
3402
+ const limit = integerParam(url.searchParams.get("limit"));
3403
+ const after = integerParam(url.searchParams.get("after"));
3404
+ if (limit === "bad")
3405
+ return adminError2(400, "limit: expected an integer");
3406
+ if (after === "bad")
3407
+ return adminError2(400, "after: expected a sequence number");
3408
+ const order = url.searchParams.get("order");
3409
+ return fromResult(readStatePage(scope.value, params.collection ?? "", {
3410
+ ...limit !== void 0 ? { limit } : {},
3411
+ ...after !== void 0 ? { after } : {},
3412
+ ...order === "newest" || order === "oldest" ? { order } : {}
3413
+ }), 200);
3414
+ },
3415
+ "GET /state/:collection/:id": ({ namespace, params }) => {
3416
+ const scope = open(namespace);
3417
+ if (!scope.ok)
3418
+ return fromResult(scope, 200);
3419
+ return fromResult(readStateRecord(scope.value, params.collection ?? "", params.id ?? ""), 200);
3420
+ },
3421
+ "POST /state/:collection": ({ namespace, params, body }) => {
3422
+ const scope = open(namespace);
3423
+ if (!scope.ok)
3424
+ return fromResult(scope, 201);
3425
+ if (!isRecord4(body) || !("value" in body)) {
3426
+ return adminError2(400, 'expected {"id?": "<id>", "value": <json>}');
3427
+ }
3428
+ const id = body.id;
3429
+ if (id !== void 0 && typeof id !== "string")
3430
+ return adminError2(400, "id must be a string");
3431
+ const created = createStateRecord(scope.value, params.collection ?? "", {
3432
+ ...typeof id === "string" ? { id } : {},
3433
+ value: body.value
3434
+ });
3435
+ if (created.ok)
3436
+ wrote(namespace);
3437
+ return fromResult(created, 201);
3438
+ },
3439
+ "PUT /state/:collection/:id": ({ namespace, params, body }) => {
3440
+ const scope = open(namespace);
3441
+ if (!scope.ok)
3442
+ return fromResult(scope, 200);
3443
+ if (!isRecord4(body) || !("value" in body))
3444
+ return adminError2(400, 'expected {"value": <json>}');
3445
+ const replaced = replaceStateRecord(scope.value, params.collection ?? "", params.id ?? "", body.value);
3446
+ if (replaced.ok)
3447
+ wrote(namespace);
3448
+ return fromResult(replaced, 200);
3449
+ },
3450
+ "PATCH /state/:collection/:id": ({ namespace, params, body }) => {
3451
+ const scope = open(namespace);
3452
+ if (!scope.ok)
3453
+ return fromResult(scope, 200);
3454
+ if (!isRecord4(body) || !("value" in body))
3455
+ return adminError2(400, 'expected {"value": <json>}');
3456
+ const patched = patchStateRecord(scope.value, params.collection ?? "", params.id ?? "", body.value);
3457
+ if (patched.ok)
3458
+ wrote(namespace);
3459
+ return fromResult(patched, 200);
3460
+ },
3461
+ "DELETE /state/:collection/:id": ({ namespace, params }) => {
3462
+ const scope = open(namespace);
3463
+ if (!scope.ok)
3464
+ return fromResult(scope, 200);
3465
+ const removed = deleteStateRecord(scope.value, params.collection ?? "", params.id ?? "");
3466
+ if (removed.ok)
3467
+ wrote(namespace);
3468
+ return fromResult(removed, 200);
3469
+ }
3470
+ };
3471
+ };
3472
+
1306
3473
  // ../core/dist/version.js
1307
- var PACKAGE_VERSION = true ? "1.4.0" : UNRELEASED_VERSION;
3474
+ var PACKAGE_VERSION = true ? "1.6.0" : UNRELEASED_VERSION;
1308
3475
 
1309
3476
  // ../core/dist/webhooks.js
1310
- var json2 = (status, body) => new Response(JSON.stringify(body), { status, headers: { "content-type": "application/json" } });
1311
- var adminError2 = (status, message) => json2(status, { error: { type: "mockingbird_admin", message } });
1312
- var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3477
+ var json4 = (status, body) => new Response(JSON.stringify(body), { status, headers: { "content-type": "application/json" } });
3478
+ var adminError3 = (status, message) => json4(status, { error: { type: "mockingbird_admin", message } });
3479
+ var isRecord5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1313
3480
  var parseEndpoint = (value) => {
1314
- if (!isRecord3(value) || typeof value.url !== "string")
3481
+ if (!isRecord5(value) || typeof value.url !== "string")
1315
3482
  return "each endpoint needs a url";
1316
3483
  try {
1317
3484
  new URL(value.url);
@@ -1328,18 +3495,18 @@ var parseEndpoint = (value) => {
1328
3495
  const events = value.events ?? value.enabledEvents;
1329
3496
  if (Array.isArray(events))
1330
3497
  endpoint.events = events.map(String);
1331
- if (isRecord3(value.tags)) {
3498
+ if (isRecord5(value.tags)) {
1332
3499
  endpoint.tags = Object.fromEntries(Object.entries(value.tags).map(([k, v]) => [k, String(v)]));
1333
3500
  }
1334
3501
  if (typeof value.account === "string")
1335
3502
  endpoint.tags = { ...endpoint.tags, account: value.account };
1336
- if (isRecord3(value.headers)) {
3503
+ if (isRecord5(value.headers)) {
1337
3504
  endpoint.headers = Object.fromEntries(Object.entries(value.headers).map(([k, v]) => [k, String(v)]));
1338
3505
  }
1339
3506
  return endpoint;
1340
3507
  };
1341
3508
  var webhookAdminRoutes = (hub) => ({
1342
- "GET /webhooks": ({ url, namespace }) => json2(200, {
3509
+ "GET /webhooks": ({ url, namespace }) => json4(200, {
1343
3510
  deliveries: hub.deliveries(url.searchParams.get("all") === "1" ? void 0 : namespace).filter((d) => {
1344
3511
  const type = url.searchParams.get("type");
1345
3512
  return type === null || d.type === type;
@@ -1347,51 +3514,51 @@ var webhookAdminRoutes = (hub) => ({
1347
3514
  }),
1348
3515
  "GET /webhooks/events": ({ url, namespace }) => {
1349
3516
  const type = url.searchParams.get("type");
1350
- return json2(200, {
3517
+ return json4(200, {
1351
3518
  events: hub.messages(url.searchParams.get("all") === "1" ? void 0 : namespace).filter((m) => type === null || m.type === type).map((m) => ({ ...m, payload: parsePayload(m) }))
1352
3519
  });
1353
3520
  },
1354
3521
  "POST /webhooks/:id/replay": async ({ params }) => {
1355
3522
  const replayed = await hub.replay(params.id);
1356
- return replayed ? json2(200, replayed) : adminError2(404, `no delivery ${params.id}`);
3523
+ return replayed ? json4(200, replayed) : adminError3(404, `no delivery ${params.id}`);
1357
3524
  },
1358
3525
  "POST /webhooks/flush": async () => {
1359
3526
  await hub.flush();
1360
- return json2(200, { status: "ok" });
3527
+ return json4(200, { status: "ok" });
1361
3528
  },
1362
3529
  "POST /webhooks/faults": ({ body, namespace }) => {
1363
- if (!isRecord3(body) || !["duplicate", "reorder", "drop"].includes(String(body.mode))) {
1364
- return adminError2(400, "mode must be duplicate, reorder or drop");
3530
+ if (!isRecord5(body) || !["duplicate", "reorder", "drop"].includes(String(body.mode))) {
3531
+ return adminError3(400, "mode must be duplicate, reorder or drop");
1365
3532
  }
1366
3533
  const fault = { mode: body.mode };
1367
3534
  if (typeof body.count === "number")
1368
3535
  fault.count = body.count;
1369
3536
  hub.fault(namespace, fault);
1370
- return json2(201, { namespace, ...fault });
3537
+ return json4(201, { namespace, ...fault });
1371
3538
  },
1372
- "GET /webhook-endpoints": ({ namespace }) => json2(200, {
3539
+ "GET /webhook-endpoints": ({ namespace }) => json4(200, {
1373
3540
  endpoints: hub.endpoints(namespace).map(({ secret, ...rest }) => ({
1374
3541
  ...rest,
1375
3542
  secret: secret ? "(set)" : null
1376
3543
  }))
1377
3544
  }),
1378
3545
  "PUT /webhook-endpoints": ({ body, namespace }) => {
1379
- const list = Array.isArray(body) ? body : isRecord3(body) ? body.endpoints : void 0;
3546
+ const list = Array.isArray(body) ? body : isRecord5(body) ? body.endpoints : void 0;
1380
3547
  if (!Array.isArray(list))
1381
- return adminError2(400, "expected [{url, secret?, events?}]");
3548
+ return adminError3(400, "expected [{url, secret?, events?}]");
1382
3549
  const parsed = [];
1383
3550
  for (const each of list) {
1384
3551
  const endpoint = parseEndpoint(each);
1385
3552
  if (typeof endpoint === "string")
1386
- return adminError2(400, endpoint);
3553
+ return adminError3(400, endpoint);
1387
3554
  parsed.push(endpoint);
1388
3555
  }
1389
3556
  const set = hub.setEndpoints(namespace, parsed);
1390
- return json2(200, { endpoints: set.map((e) => ({ ...e, secret: e.secret ? "(set)" : null })) });
3557
+ return json4(200, { endpoints: set.map((e) => ({ ...e, secret: e.secret ? "(set)" : null })) });
1391
3558
  },
1392
3559
  "DELETE /webhook-endpoints": ({ namespace }) => {
1393
3560
  hub.setEndpoints(namespace, []);
1394
- return json2(200, { status: "ok" });
3561
+ return json4(200, { status: "ok" });
1395
3562
  }
1396
3563
  });
1397
3564
  var parsePayload = (message) => {
@@ -1444,8 +3611,8 @@ var DroppedConnectionError = class extends TypeError {
1444
3611
  this.name = "TypeError";
1445
3612
  }
1446
3613
  };
1447
- var operationMatcher = (document2) => {
1448
- const matchers = listOperations(document2).map((operation) => ({
3614
+ var operationMatcher = (document3) => {
3615
+ const matchers = listOperations(document3).map((operation) => ({
1449
3616
  operationId: operation.operationId,
1450
3617
  method: operation.method.toUpperCase(),
1451
3618
  pattern: new RegExp(`^${operation.path.split("/").map((segment) => segment.startsWith("{") ? "[^/]+" : segment.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("/")}/?$`),
@@ -1454,6 +3621,7 @@ var operationMatcher = (document2) => {
1454
3621
  return (request2, path) => matchers.find((m) => m.method === request2.method && m.pattern.test(path))?.operationId;
1455
3622
  };
1456
3623
  var createRuntime = (options) => {
3624
+ assertAdminUi(options.adminUi);
1457
3625
  const sqlite = bootSqlite(options.sqlite);
1458
3626
  const clock = options.clock ?? createClock();
1459
3627
  const rng = createRng(options.seed ?? 0);
@@ -1539,10 +3707,10 @@ var createRuntime = (options) => {
1539
3707
  const ensureBranch = (namespace, branch2, at) => {
1540
3708
  if (!BRANCH_PATTERN2.test(branch2))
1541
3709
  throw new RangeError(`branch must match ${BRANCH_PATTERN2}`);
1542
- const history = timeline(namespace);
3710
+ const history2 = timeline(namespace);
1543
3711
  if (branch2 === "main") {
1544
3712
  if (at !== void 0) {
1545
- const point = history.checkout("main", at);
3713
+ const point = history2.checkout("main", at);
1546
3714
  restoreNamespace(sqlite, storageNamespace(namespace), point.value.snapshot);
1547
3715
  captured.set(namespace, point.value.snapshot);
1548
3716
  rng.setState(point.value.rngState);
@@ -1555,10 +3723,10 @@ var createRuntime = (options) => {
1555
3723
  return namespace;
1556
3724
  }
1557
3725
  const storage = physicalBranch(namespace, branch2);
1558
- if (!history.hasBranch(branch2)) {
3726
+ if (!history2.hasBranch(branch2)) {
1559
3727
  if (at === void 0)
1560
- history.commit(capture(namespace));
1561
- const point = history.fork(branch2, at === void 0 ? {} : { from: at });
3728
+ history2.commit(capture(namespace));
3729
+ const point = history2.fork(branch2, at === void 0 ? {} : { from: at });
1562
3730
  const branchRng = createRng(options.seed ?? 0);
1563
3731
  if (point)
1564
3732
  branchRng.setState(point.value.rngState);
@@ -1567,8 +3735,8 @@ var createRuntime = (options) => {
1567
3735
  restoreNamespace(sqlite, storageNamespace(storage), point.value.snapshot);
1568
3736
  if (point)
1569
3737
  captured.set(storage, point.value.snapshot);
1570
- } else if (at !== void 0 && history.head(branch2)?.id !== at) {
1571
- const point = history.checkout(branch2, at);
3738
+ } else if (at !== void 0 && history2.head(branch2)?.id !== at) {
3739
+ const point = history2.checkout(branch2, at);
1572
3740
  if (!instances.has(storage)) {
1573
3741
  const branchRng = createRng(options.seed ?? 0);
1574
3742
  branchRng.setState(point.value.rngState);
@@ -1579,7 +3747,7 @@ var createRuntime = (options) => {
1579
3747
  captured.set(storage, point.value.snapshot);
1580
3748
  } else {
1581
3749
  if (!instances.has(storage)) {
1582
- const point = history.head(branch2);
3750
+ const point = history2.head(branch2);
1583
3751
  const branchRng = createRng(options.seed ?? 0);
1584
3752
  if (point)
1585
3753
  branchRng.setState(point.value.rngState);
@@ -1603,8 +3771,8 @@ var createRuntime = (options) => {
1603
3771
  const checkout = (checkpointId, checkoutOptions = {}) => {
1604
3772
  const namespace = checkoutOptions.namespace ?? DEFAULT_NAMESPACE;
1605
3773
  const branchName = checkoutOptions.branch ?? "main";
1606
- const history = timeline(namespace);
1607
- const point = history.checkout(branchName, checkpointId);
3774
+ const history2 = timeline(namespace);
3775
+ const point = history2.checkout(branchName, checkpointId);
1608
3776
  const storage = ensureBranch(namespace, branchName);
1609
3777
  restoreNamespace(sqlite, storageNamespace(storage), point.value.snapshot);
1610
3778
  captured.set(storage, point.value.snapshot);
@@ -1654,12 +3822,25 @@ var createRuntime = (options) => {
1654
3822
  instance(name);
1655
3823
  restoreNamespace(sqlite, storageNamespace(name), from);
1656
3824
  captured.set(name, from);
1657
- const history = timelines.get(name);
1658
- if (history)
1659
- history.commit(capture(name), { branch: "main" });
3825
+ const history2 = timelines.get(name);
3826
+ if (history2)
3827
+ history2.commit(capture(name), { branch: "main" });
1660
3828
  else
1661
3829
  timeline(name);
1662
3830
  };
3831
+ const declarationsFor = (namespace) => {
3832
+ const declared = options.state;
3833
+ if (!declared)
3834
+ return [];
3835
+ return typeof declared === "function" ? declared(instance(namespace), namespace) : declared;
3836
+ };
3837
+ const stateScope = (namespace) => ({
3838
+ sqlite,
3839
+ namespace,
3840
+ storageNamespace: storageNamespace(namespace),
3841
+ root: instance(namespace),
3842
+ declarations: declarationsFor(namespace)
3843
+ });
1663
3844
  const runtime = {
1664
3845
  name: options.name,
1665
3846
  sqlite,
@@ -1698,6 +3879,7 @@ var createRuntime = (options) => {
1698
3879
  branch,
1699
3880
  checkout,
1700
3881
  timeline,
3882
+ state: (namespace = DEFAULT_NAMESPACE) => inspectState(stateScope(namespace)),
1701
3883
  fetch: async (incoming) => {
1702
3884
  let request2 = incoming;
1703
3885
  const prefixed = PATH_PREFIX.exec(new URL(request2.url).pathname);
@@ -1871,10 +4053,10 @@ var createRuntime = (options) => {
1871
4053
  },
1872
4054
  release: (name, checkpointId) => timeline(name).release(checkpointId),
1873
4055
  inspect: (name) => {
1874
- const history = timeline(name);
4056
+ const history2 = timeline(name);
1875
4057
  return {
1876
- branches: history.branches(),
1877
- checkpoints: history.checkpoints().map(({ id, branch: branchName, parent, at }) => ({
4058
+ branches: history2.branches(),
4059
+ checkpoints: history2.checkpoints().map(({ id, branch: branchName, parent, at }) => ({
1878
4060
  id,
1879
4061
  branch: branchName,
1880
4062
  parent,
@@ -1889,13 +4071,22 @@ var createRuntime = (options) => {
1889
4071
  } : {},
1890
4072
  routes: {
1891
4073
  ...credentialRoutes(credentials),
1892
- ...options.presets ? presetRoutes(options.presets, runtime) : {},
1893
4074
  ...options.webhooks ? webhookAdminRoutes(options.webhooks) : {},
1894
- ...options.admin?.(runtime) ?? {}
4075
+ ...options.admin?.(runtime) ?? {},
4076
+ // Shell routes win a colliding key. Fault presets are one of them: the admin page
4077
+ // maps `presets`, and a service route must not replace that list with a record.
4078
+ ...options.presets ? presetRoutes(options.presets, runtime) : {},
4079
+ ...stateAdminRoutes({
4080
+ open: stateScope,
4081
+ afterWrite: (namespace) => {
4082
+ checkpoint(namespace, "main");
4083
+ }
4084
+ }),
4085
+ ...adminUiRoutes(options.name, options.adminUi)
1895
4086
  },
1896
4087
  adminKey: options.adminKey
1897
4088
  });
1898
- return runtime;
4089
+ return defineMock(runtime);
1899
4090
  };
1900
4091
  var mutableResponse = (response) => {
1901
4092
  try {
@@ -1959,9 +4150,12 @@ var credentialRoutes = (registry) => ({
1959
4150
  }
1960
4151
  });
1961
4152
  var presetRoutes = (presets, runtime) => ({
1962
- "GET /faults/presets": () => adminJson(200, {
1963
- presets: Object.entries(presets).map(([name, preset]) => ({ name, ...preset }))
1964
- }),
4153
+ "GET /faults/presets": () => {
4154
+ const body = {
4155
+ presets: Object.entries(presets).map(([name, preset]) => ({ name, ...preset }))
4156
+ };
4157
+ return adminJson(200, body);
4158
+ },
1965
4159
  "POST /faults/presets/:name": ({ params, body, namespace }) => {
1966
4160
  const name = params.name;
1967
4161
  if (!presets[name])
@@ -3020,7 +5214,7 @@ var JunctionState = class {
3020
5214
  const zip = /^\d{5}/.test(zipCode) ? zipCode.slice(0, 5) : "00000";
3021
5215
  const zipPrefix = Number(zip.slice(0, 3));
3022
5216
  const cityState = zipPrefix >= 850 && zipPrefix <= 865 ? { city: "Phoenix", state: "AZ" } : zipPrefix >= 900 ? { city: "Los Angeles", state: "CA" } : zipPrefix >= 800 ? { city: "Denver", state: "CO" } : zipPrefix >= 600 ? { city: "Chicago", state: "IL" } : zipPrefix >= 300 && zipPrefix < 400 ? { city: "Atlanta", state: "GA" } : { city: "New York", state: "NY" };
3023
- const location = zip === "85004" ? { lat: 33.6242904, lng: -111.9283407 } : {
5217
+ const location2 = zip === "85004" ? { lat: 33.6242904, lng: -111.9283407 } : {
3024
5218
  lat: 30 + zipPrefix % 20 * 0.4,
3025
5219
  lng: -120 + zipPrefix % 30 * 0.5
3026
5220
  };
@@ -3053,7 +5247,7 @@ var JunctionState = class {
3053
5247
  unit: null,
3054
5248
  access_notes: null
3055
5249
  },
3056
- location,
5250
+ location: location2,
3057
5251
  consumed_by_order_id: null,
3058
5252
  created_at: new Date(nowMs).toISOString()
3059
5253
  });
@@ -3418,7 +5612,7 @@ var renderLabAccount = (entry) => ({
3418
5612
  ),
3419
5613
  team_id_allowlist: [...entry.team_id_allowlist]
3420
5614
  });
3421
- var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5615
+ var isRecord6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3422
5616
  var DELEGATED_FLOWS = [
3423
5617
  "order_delegated",
3424
5618
  "result_delegated",
@@ -3434,7 +5628,7 @@ var checkStates = (value, where) => {
3434
5628
  };
3435
5629
  var stringList = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string") ? [...value] : void 0;
3436
5630
  var labAccountFromInput = (input, teamId = MOCK_TEAM_ID) => {
3437
- if (!isRecord4(input)) throw new TypeError("lab account must be an object");
5631
+ if (!isRecord6(input)) throw new TypeError("lab account must be an object");
3438
5632
  if (typeof input.id !== "string" || input.id === "")
3439
5633
  throw new TypeError("lab account needs a non-empty id");
3440
5634
  const where = `lab account ${input.id}`;
@@ -3446,7 +5640,7 @@ var labAccountFromInput = (input, teamId = MOCK_TEAM_ID) => {
3446
5640
  throw new TypeError(`${where}: delegated_flow must be one of ${DELEGATED_FLOWS.join(", ")}`);
3447
5641
  if (input.states !== void 0) checkStates(input.states, `${where}: states`);
3448
5642
  if (input.allowed_billing !== void 0) {
3449
- if (!isRecord4(input.allowed_billing))
5643
+ if (!isRecord6(input.allowed_billing))
3450
5644
  throw new TypeError(`${where}: allowed_billing must map billing types to state lists`);
3451
5645
  for (const [type, states] of Object.entries(input.allowed_billing)) {
3452
5646
  if (!BILLING_TYPES.includes(type))
@@ -3485,7 +5679,7 @@ var labAccountFromInput = (input, teamId = MOCK_TEAM_ID) => {
3485
5679
  };
3486
5680
  };
3487
5681
  var patchLabAccount = (existing, patch, teamId) => {
3488
- if (!isRecord4(patch)) throw new TypeError("lab account patch must be an object");
5682
+ if (!isRecord6(patch)) throw new TypeError("lab account patch must be an object");
3489
5683
  if (patch.id !== void 0 && patch.id !== existing.id)
3490
5684
  throw new TypeError(`lab account ${existing.id}: id cannot be changed`);
3491
5685
  const { states, ...rest } = patch;
@@ -3505,7 +5699,7 @@ var patchLabAccount = (existing, patch, teamId) => {
3505
5699
  var labAccountFromClientFacing = (value, recordedTeamId) => {
3506
5700
  if (typeof value.id !== "string" || typeof value.lab !== "string") return void 0;
3507
5701
  const billing = {};
3508
- if (isRecord4(value.allowed_billing)) {
5702
+ if (isRecord6(value.allowed_billing)) {
3509
5703
  for (const [type, states] of Object.entries(value.allowed_billing)) {
3510
5704
  const list = stringList(states);
3511
5705
  if (list) billing[type] = list;
@@ -3734,7 +5928,7 @@ var RESULT_FIXTURES = {
3734
5928
  critical: { interpretation: "critical" },
3735
5929
  missing_results: { interpretation: "normal", has_missing_results: true }
3736
5930
  };
3737
- var FAULT_PRESETS = {
5931
+ var FAULT_PRESET_RULES = {
3738
5932
  sandbox_user_quota: {
3739
5933
  operationId: "create_user_v2_user_post",
3740
5934
  status: 400,
@@ -3749,6 +5943,24 @@ var FAULT_PRESETS = {
3749
5943
  bad_gateway: { status: 502, body: { detail: "Bad Gateway" } },
3750
5944
  unavailable: { status: 503, body: { detail: "Service Unavailable" } }
3751
5945
  };
5946
+ var FAULT_PRESETS = FAULT_PRESET_RULES;
5947
+ var FAULT_PRESET_DESCRIPTIONS = {
5948
+ sandbox_user_quota: "create_user answers 400 when the sandbox user quota is full",
5949
+ rate_limited: "Every request answers 429 Too Many Requests",
5950
+ server_error: "Every request answers 500 Internal Server Error",
5951
+ bad_gateway: "Every request answers 502 Bad Gateway",
5952
+ unavailable: "Every request answers 503 Service Unavailable"
5953
+ };
5954
+ var faultPresetDescriptions = FAULT_PRESET_DESCRIPTIONS;
5955
+ var junctionFaultPresets = () => {
5956
+ const presets = {};
5957
+ for (const [name, rule] of Object.entries(FAULT_PRESET_RULES)) {
5958
+ const description = faultPresetDescriptions[name];
5959
+ if (description === void 0) continue;
5960
+ presets[name] = { description, rules: [rule] };
5961
+ }
5962
+ return presets;
5963
+ };
3752
5964
  var methodOf = (order) => typeof order.lab_test.method === "string" && order.lab_test.method !== "" ? order.lab_test.method : typeof order.details?.type === "string" && order.details.type !== "" ? order.details.type : "at_home_phlebotomy";
3753
5965
  var resolveTransition = (method, target) => {
3754
5966
  const allowed = ORDER_STATUSES_BY_METHOD[method];
@@ -3768,18 +5980,18 @@ var resolveTransition = (method, target) => {
3768
5980
  error: `${JSON.stringify(target)} is not a ${method} status. Use one of: ${names.join(", ")}, or a full status such as ${allowed.slice(0, 2).map((s) => `${s.split(".")[0]}.${method}.${s.split(".")[1]}`).join(", ")}`
3769
5981
  };
3770
5982
  };
3771
- var adminError3 = (status, message) => jsonRes(status, { error: { type: "mockingbird_admin", message } });
3772
- var isRecord5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5983
+ var adminError4 = (status, message) => jsonRes(status, { error: { type: "mockingbird_admin", message } });
5984
+ var isRecord7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3773
5985
  var guarded = (run) => {
3774
5986
  try {
3775
5987
  return run();
3776
5988
  } catch (error) {
3777
- if (error instanceof TypeError) return adminError3(400, error.message);
5989
+ if (error instanceof TypeError) return adminError4(400, error.message);
3778
5990
  if (error instanceof Error && error.name === "LabAccountConflict") {
3779
- return adminError3(409, error.message);
5991
+ return adminError4(409, error.message);
3780
5992
  }
3781
5993
  const { status, message } = fixtureErrorMessage(error);
3782
- return adminError3(status, message);
5994
+ return adminError4(status, message);
3783
5995
  }
3784
5996
  };
3785
5997
  var junctionAdminRoutes = (options) => (runtime) => {
@@ -3796,20 +6008,20 @@ var junctionAdminRoutes = (options) => (runtime) => {
3796
6008
  }))
3797
6009
  }),
3798
6010
  "POST /orders/:id/transition": (request2) => {
3799
- const body = isRecord5(request2.body) ? request2.body : {};
6011
+ const body = isRecord7(request2.body) ? request2.body : {};
3800
6012
  const order = api(request2).order(request2.params.id);
3801
- if (!order) return adminError3(404, `no order ${request2.params.id} in ${request2.namespace}`);
6013
+ if (!order) return adminError4(404, `no order ${request2.params.id} in ${request2.namespace}`);
3802
6014
  if (typeof body.to !== "string") {
3803
- return adminError3(400, 'body needs "to": a status like "completed" or "at_lab"');
6015
+ return adminError4(400, 'body needs "to": a status like "completed" or "at_lab"');
3804
6016
  }
3805
6017
  const method = methodOf(order);
3806
6018
  const resolved = resolveTransition(method, body.to);
3807
- if ("error" in resolved) return adminError3(400, resolved.error);
3808
- let flags = isRecord5(body.flags) ? body.flags : null;
6019
+ if ("error" in resolved) return adminError4(400, resolved.error);
6020
+ let flags = isRecord7(body.flags) ? body.flags : null;
3809
6021
  if (typeof body.result === "string") {
3810
6022
  const named = RESULT_FIXTURES[body.result];
3811
6023
  if (!named) {
3812
- return adminError3(
6024
+ return adminError4(
3813
6025
  400,
3814
6026
  `no result fixture ${body.result}; one of ${Object.keys(RESULT_FIXTURES).join(", ")}`
3815
6027
  );
@@ -3829,23 +6041,23 @@ var junctionAdminRoutes = (options) => (runtime) => {
3829
6041
  "GET /result-fixtures": () => jsonRes(200, { fixtures: RESULT_FIXTURES }),
3830
6042
  "GET /results/:id": (request2) => {
3831
6043
  const fixture = api(request2).resultFixture(request2.params.id);
3832
- return fixture ? jsonRes(200, fixture) : adminError3(404, "no result fixture for that order");
6044
+ return fixture ? jsonRes(200, fixture) : adminError4(404, "no result fixture for that order");
3833
6045
  },
3834
6046
  "PUT /results/:id": (request2) => {
3835
- if (!isRecord5(request2.body)) return adminError3(400, "expected a result fixture object");
6047
+ if (!isRecord7(request2.body)) return adminError4(400, "expected a result fixture object");
3836
6048
  const fixture = { name: "custom", ...request2.body };
3837
6049
  if (fixture.results !== void 0 && !Array.isArray(fixture.results)) {
3838
- return adminError3(400, "results must be an array of result lines");
6050
+ return adminError4(400, "results must be an array of result lines");
3839
6051
  }
3840
- return api(request2).installResultFixture(request2.params.id, fixture) ? jsonRes(200, fixture) : adminError3(404, `no order ${request2.params.id} in ${request2.namespace}`);
6052
+ return api(request2).installResultFixture(request2.params.id, fixture) ? jsonRes(200, fixture) : adminError4(404, `no order ${request2.params.id} in ${request2.namespace}`);
3841
6053
  },
3842
6054
  "GET /lab-accounts": (request2) => jsonRes(200, { data: api(request2).labAccounts() }),
3843
6055
  "PUT /lab-accounts": (request2) => {
3844
- const body = isRecord5(request2.body) ? request2.body : {};
6056
+ const body = isRecord7(request2.body) ? request2.body : {};
3845
6057
  const accounts = body.accounts;
3846
6058
  const presets = body.presets;
3847
6059
  if (accounts === void 0 && presets === void 0 || accounts !== void 0 && accounts !== null && !Array.isArray(accounts) || presets !== void 0 && !Array.isArray(presets)) {
3848
- return adminError3(
6060
+ return adminError4(
3849
6061
  400,
3850
6062
  'body needs "accounts": an array (or null to restore the default), and/or "presets": an array of preset names'
3851
6063
  );
@@ -3857,20 +6069,20 @@ var junctionAdminRoutes = (options) => (runtime) => {
3857
6069
  return guarded(() => jsonRes(200, { data: api(request2).configureLabAccounts(layout) }));
3858
6070
  },
3859
6071
  "POST /lab-accounts": (request2) => {
3860
- if (!isRecord5(request2.body)) return adminError3(400, "expected one lab account object");
6072
+ if (!isRecord7(request2.body)) return adminError4(400, "expected one lab account object");
3861
6073
  const input = request2.body;
3862
6074
  return guarded(() => jsonRes(201, api(request2).addLabAccount(input)));
3863
6075
  },
3864
6076
  "PATCH /lab-accounts/:id": (request2) => {
3865
- if (!isRecord5(request2.body))
3866
- return adminError3(400, "expected an object of fields to change");
6077
+ if (!isRecord7(request2.body))
6078
+ return adminError4(400, "expected an object of fields to change");
3867
6079
  const patch = request2.body;
3868
6080
  return guarded(() => {
3869
6081
  const updated = api(request2).patchLabAccount(request2.params.id, patch);
3870
- return updated ? jsonRes(200, updated) : adminError3(404, `no lab account ${request2.params.id} in ${request2.namespace}`);
6082
+ return updated ? jsonRes(200, updated) : adminError4(404, `no lab account ${request2.params.id} in ${request2.namespace}`);
3871
6083
  });
3872
6084
  },
3873
- "DELETE /lab-accounts/:id": (request2) => api(request2).removeLabAccount(request2.params.id) ? jsonRes(200, { status: "ok" }) : adminError3(404, `no lab account ${request2.params.id} in ${request2.namespace}`),
6085
+ "DELETE /lab-accounts/:id": (request2) => api(request2).removeLabAccount(request2.params.id) ? jsonRes(200, { status: "ok" }) : adminError4(404, `no lab account ${request2.params.id} in ${request2.namespace}`),
3874
6086
  "GET /lab-accounts/presets": (request2) => jsonRes(200, {
3875
6087
  presets: Object.fromEntries(
3876
6088
  Object.keys(LAB_ACCOUNT_PRESETS).map((name) => {
@@ -3882,14 +6094,14 @@ var junctionAdminRoutes = (options) => (runtime) => {
3882
6094
  synthetic: SYNTHETIC_LAB_ACCOUNT_PRESETS
3883
6095
  }),
3884
6096
  "POST /lab-accounts/presets/:name": (request2) => {
3885
- const body = isRecord5(request2.body) ? request2.body : {};
6097
+ const body = isRecord7(request2.body) ? request2.body : {};
3886
6098
  if (body.id !== void 0 && typeof body.id !== "string") {
3887
- return adminError3(400, "id must be a string");
6099
+ return adminError4(400, "id must be a string");
3888
6100
  }
3889
6101
  const name = request2.params.name;
3890
6102
  return guarded(() => {
3891
6103
  const record = api(request2).addLabAccountPreset(name, body.id);
3892
- return record ? jsonRes(201, record) : adminError3(
6104
+ return record ? jsonRes(201, record) : adminError4(
3893
6105
  404,
3894
6106
  `no lab-account preset ${name}; one of ${Object.keys(LAB_ACCOUNT_PRESETS).join(", ")}`
3895
6107
  );
@@ -3898,15 +6110,15 @@ var junctionAdminRoutes = (options) => (runtime) => {
3898
6110
  "GET /team": (request2) => jsonRes(200, { teamId: api(request2).teamId }),
3899
6111
  "GET /limits": (request2) => jsonRes(200, { limits: api(request2).limits }),
3900
6112
  "PUT /limits": (request2) => {
3901
- if (!isRecord5(request2.body)) return adminError3(400, "expected an object of limits");
6113
+ if (!isRecord7(request2.body)) return adminError4(400, "expected an object of limits");
3902
6114
  const input = request2.body;
3903
6115
  return guarded(() => jsonRes(200, { limits: api(request2).configureLimits(input) }));
3904
6116
  },
3905
6117
  "GET /default-billing-types": (request2) => jsonRes(200, { defaultBillingTypes: api(request2).defaultBillingTypes }),
3906
6118
  "PUT /default-billing-types": (request2) => {
3907
- const input = isRecord5(request2.body) ? request2.body.defaultBillingTypes : void 0;
3908
- if (!isRecord5(input))
3909
- return adminError3(
6119
+ const input = isRecord7(request2.body) ? request2.body.defaultBillingTypes : void 0;
6120
+ if (!isRecord7(input))
6121
+ return adminError4(
3910
6122
  400,
3911
6123
  'body needs "defaultBillingTypes": { "<lab slug>": "<billing_type>" } ({} restores client_bill)'
3912
6124
  );
@@ -3917,28 +6129,28 @@ var junctionAdminRoutes = (options) => (runtime) => {
3917
6129
  },
3918
6130
  "GET /identity": (request2) => jsonRes(200, { identity: api(request2).identity }),
3919
6131
  "PUT /identity": (request2) => {
3920
- const mode = isRecord5(request2.body) ? request2.body.mode : void 0;
6132
+ const mode = isRecord7(request2.body) ? request2.body.mode : void 0;
3921
6133
  if (!IDENTITY_MODES.includes(mode)) {
3922
- return adminError3(400, `body needs "mode": one of ${IDENTITY_MODES.join(", ")}`);
6134
+ return adminError4(400, `body needs "mode": one of ${IDENTITY_MODES.join(", ")}`);
3923
6135
  }
3924
6136
  api(request2).identity = mode;
3925
6137
  return jsonRes(200, { identity: mode });
3926
6138
  },
3927
6139
  "POST /users": (request2) => {
3928
- if (!isRecord5(request2.body)) return adminError3(400, "expected one user object");
6140
+ if (!isRecord7(request2.body)) return adminError4(400, "expected one user object");
3929
6141
  const input = request2.body;
3930
6142
  return guarded(() => jsonRes(201, api(request2).insertUsers([input])[0]));
3931
6143
  },
3932
6144
  "POST /users/bulk": (request2) => {
3933
- const users = isRecord5(request2.body) ? request2.body.users : void 0;
3934
- if (!Array.isArray(users)) return adminError3(400, 'body needs "users": an array');
6145
+ const users = isRecord7(request2.body) ? request2.body.users : void 0;
6146
+ if (!Array.isArray(users)) return adminError4(400, 'body needs "users": an array');
3935
6147
  return guarded(
3936
6148
  () => jsonRes(201, { users: api(request2).insertUsers(users) })
3937
6149
  );
3938
6150
  },
3939
- "DELETE /users/:id": (request2) => api(request2).hardDeleteUser(request2.params.id) ? jsonRes(200, { status: "ok" }) : adminError3(404, `no user ${request2.params.id} in ${request2.namespace}`),
6151
+ "DELETE /users/:id": (request2) => api(request2).hardDeleteUser(request2.params.id) ? jsonRes(200, { status: "ok" }) : adminError4(404, `no user ${request2.params.id} in ${request2.namespace}`),
3940
6152
  "POST /orders": (request2) => {
3941
- if (!isRecord5(request2.body)) return adminError3(400, "expected one order object");
6153
+ if (!isRecord7(request2.body)) return adminError4(400, "expected one order object");
3942
6154
  const { emitWebhooks, ...input } = request2.body;
3943
6155
  return guarded(
3944
6156
  () => jsonRes(
@@ -3950,8 +6162,8 @@ var junctionAdminRoutes = (options) => (runtime) => {
3950
6162
  );
3951
6163
  },
3952
6164
  "POST /import": (request2) => {
3953
- if (!isRecord5(request2.body)) {
3954
- return adminError3(400, 'expected { "users": [...], "orders": [...] }');
6165
+ if (!isRecord7(request2.body)) {
6166
+ return adminError4(400, 'expected { "users": [...], "orders": [...] }');
3955
6167
  }
3956
6168
  const { emitWebhooks, ...fixtures } = request2.body;
3957
6169
  return guarded(() => {
@@ -3966,45 +6178,27 @@ var junctionAdminRoutes = (options) => (runtime) => {
3966
6178
  geo: api(request2).geoMode
3967
6179
  }),
3968
6180
  "PUT /geo": (request2) => {
3969
- const mode = isRecord5(request2.body) ? request2.body.mode : void 0;
6181
+ const mode = isRecord7(request2.body) ? request2.body.mode : void 0;
3970
6182
  if (mode !== "corpus" && mode !== "synthetic") {
3971
- return adminError3(400, 'body needs "mode": "corpus" or "synthetic"');
6183
+ return adminError4(400, 'body needs "mode": "corpus" or "synthetic"');
3972
6184
  }
3973
6185
  api(request2).geoMode = mode;
3974
6186
  return jsonRes(200, { geo: mode });
3975
6187
  },
3976
6188
  "GET /webhooks/events": (request2) => jsonRes(200, { events: api(request2).webhookEvents() }),
3977
- "GET /webhooks": (request2) => options.webhooks ? jsonRes(200, { deliveries: options.webhooks.deliveries(request2.namespace) }) : adminError3(
6189
+ "GET /webhooks": (request2) => options.webhooks ? jsonRes(200, { deliveries: options.webhooks.deliveries(request2.namespace) }) : adminError4(
3978
6190
  409,
3979
6191
  "webhook delivery is off; serve with --webhook-url and --webhook-secret"
3980
6192
  ),
3981
6193
  "POST /webhooks/:id/replay": async (request2) => {
3982
- if (!options.webhooks) return adminError3(409, "webhook delivery is off");
6194
+ if (!options.webhooks) return adminError4(409, "webhook delivery is off");
3983
6195
  const delivery = await options.webhooks.replay(request2.params.id);
3984
- return delivery ? jsonRes(200, delivery) : adminError3(404, `no message ${request2.params.id}`);
6196
+ return delivery ? jsonRes(200, delivery) : adminError4(404, `no message ${request2.params.id}`);
3985
6197
  },
3986
6198
  "POST /webhooks/flush": async () => {
3987
- if (!options.webhooks) return adminError3(409, "webhook delivery is off");
6199
+ if (!options.webhooks) return adminError4(409, "webhook delivery is off");
3988
6200
  await options.webhooks.flush();
3989
6201
  return jsonRes(200, { status: "ok" });
3990
- },
3991
- "GET /faults/presets": () => jsonRes(200, { presets: FAULT_PRESETS }),
3992
- "POST /faults/presets/:name": (request2) => {
3993
- const preset = FAULT_PRESETS[request2.params.name];
3994
- if (!preset) {
3995
- return adminError3(
3996
- 404,
3997
- `no preset ${request2.params.name}; one of ${Object.keys(FAULT_PRESETS).join(", ")}`
3998
- );
3999
- }
4000
- const overrides = isRecord5(request2.body) ? request2.body : {};
4001
- const rule = runtime.faults.add({
4002
- namespace: request2.namespace,
4003
- ...preset,
4004
- ...overrides,
4005
- id: typeof overrides.id === "string" ? overrides.id : request2.params.name
4006
- });
4007
- return jsonRes(201, rule);
4008
6202
  }
4009
6203
  };
4010
6204
  };
@@ -6688,7 +8882,7 @@ var FixtureError = class extends Error {
6688
8882
  }
6689
8883
  status;
6690
8884
  };
6691
- var isRecord6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
8885
+ var isRecord8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
6692
8886
  var instant = (value, field, fallback) => {
6693
8887
  if (value === void 0) return fallback;
6694
8888
  if (typeof value !== "string" || Number.isNaN(Date.parse(value)))
@@ -6712,7 +8906,7 @@ var DEFAULT_PATIENT_ADDRESS = {
6712
8906
  country: "US"
6713
8907
  };
6714
8908
  var buildUser = (state, input, now) => {
6715
- if (!isRecord6(input)) throw new FixtureError(400, "a user fixture must be an object");
8909
+ if (!isRecord8(input)) throw new FixtureError(400, "a user fixture must be an object");
6716
8910
  if (typeof input.client_user_id !== "string" || input.client_user_id === "")
6717
8911
  throw new FixtureError(400, "client_user_id must be a non-empty string");
6718
8912
  if (input.user_id !== void 0 && (typeof input.user_id !== "string" || !isUuid3(input.user_id)))
@@ -6762,7 +8956,7 @@ var insertOrders = (state, inputs, now, options = {}) => {
6762
8956
  const prepared = [];
6763
8957
  const ids = /* @__PURE__ */ new Set();
6764
8958
  for (const input of inputs) {
6765
- if (!isRecord6(input)) throw new FixtureError(400, "an order fixture must be an object");
8959
+ if (!isRecord8(input)) throw new FixtureError(400, "an order fixture must be an object");
6766
8960
  if (typeof input.user_id !== "string") throw new FixtureError(400, "user_id is required");
6767
8961
  if (typeof input.lab_test_id !== "string")
6768
8962
  throw new FixtureError(400, "lab_test_id is required");
@@ -6832,7 +9026,7 @@ var insertOrders = (state, inputs, now, options = {}) => {
6832
9026
  return prepared.flatMap(({ order }) => state.orders.get(order.id) ?? []);
6833
9027
  };
6834
9028
  var importFixtures = (state, fixtures, now, options = {}) => {
6835
- if (!isRecord6(fixtures))
9029
+ if (!isRecord8(fixtures))
6836
9030
  throw new FixtureError(400, 'fixtures must be { "users": [...], "orders": [...] }');
6837
9031
  const { users = [], orders = [] } = fixtures;
6838
9032
  if (!Array.isArray(users)) throw new FixtureError(400, "users must be an array");
@@ -6857,7 +9051,7 @@ var requireUser = (state, userId, context, detail = "User does not exist on this
6857
9051
  var fixtureErrorMessage = (error) => {
6858
9052
  if (error instanceof FixtureError) return { status: error.status, message: error.message };
6859
9053
  if (error instanceof HttpError) {
6860
- const detail = isRecord6(error.body) ? error.body.detail : error.body;
9054
+ const detail = isRecord8(error.body) ? error.body.detail : error.body;
6861
9055
  return {
6862
9056
  status: error.status,
6863
9057
  message: typeof detail === "string" ? detail : JSON.stringify(detail)
@@ -6867,7 +9061,7 @@ var fixtureErrorMessage = (error) => {
6867
9061
  };
6868
9062
 
6869
9063
  // src/generated/openapi.ts
6870
- var document = JSON.parse(`{"openapi":"3.1.0","info":{"title":"Junction API (Mockingbird subset)","description":"Stateful mock subset of the Junction (Vital) API.\\nDocs: https://docs.junction.com/\\nAuth: https://docs.junction.com/api-details/junction-api\\nCreate user: https://docs.junction.com/api-reference/user/create-user\\nGet user: https://docs.junction.com/api-reference/user/get-user\\nDelete user: https://docs.junction.com/api-reference/user/delete-user\\nResolve user: https://docs.junction.com/api-reference/user/resolve-user\\nUpdate user: https://docs.junction.com/api-reference/user/patch-user\\nGet users: https://docs.junction.com/api-reference/user/get-users\\nCreate order: https://docs.junction.com/api-reference/lab-testing/create-order\\nGet order: https://docs.junction.com/api-reference/lab-testing/get-order\\nGet orders: https://docs.junction.com/api-reference/lab-testing/get-orders\\nGet order transaction: https://docs.junction.com/api-reference/lab-testing/order-transactions/get-order-transaction\\nGet order transaction result: https://docs.junction.com/api-reference/lab-testing/results/get-order-transaction-results\\nLab tests: https://docs.junction.com/api-reference/lab-testing/tests-paginated\\nLab tests (deprecated, unpaged): https://docs.junction.com/api-reference/lab-testing/tests/get-lab-tests\\nAppointment availability: https://docs.junction.com/api-reference/lab-testing/appointments/get-appointment-availability\\nBook appointment: https://docs.junction.com/api-reference/lab-testing/appointments/book-appointment\\nGet appointment: https://docs.junction.com/api-reference/lab-testing/appointments/get-appointment\\nReschedule appointment: https://docs.junction.com/api-reference/lab-testing/appointments/reschedule-appointment\\nCancel appointment: https://docs.junction.com/api-reference/lab-testing/appointments/cancel-appointment\\nAppointment cancellation reasons: https://docs.junction.com/api-reference/lab-testing/appointments/get-appointment-cancellation-reasons\\nArea info: https://docs.junction.com/api-reference/lab-testing/service-areas/get-area-info\\nPSC info: https://docs.junction.com/api-reference/lab-testing/service-areas/get-psc-info\\nLab locations: https://docs.junction.com/api-reference/lab-testing/service-areas/get-lab-locations\\nRaw results: https://docs.junction.com/api-reference/lab-testing/results/get-lab-results\\nResult metadata: https://docs.junction.com/api-reference/lab-testing/results/get-lab-results-metadata\\nResult PDF: https://docs.junction.com/api-reference/lab-testing/results/get-lab-result-pdf\\nRequisition form PDF: https://docs.junction.com/api-reference/lab-testing/orders/get-requisition-form\\nList labs: https://docs.junction.com/api-reference/lab-testing/tests/get-labs\\nTest markers: https://docs.junction.com/api-reference/lab-testing/tests/get-markers-for-lab-test\\nOrder-set markers: https://docs.junction.com/api-reference/lab-testing/results/get-order-set-markers\\nLatest user info: https://docs.junction.com/api-reference/user/get-latest-user-info\\n","version":"0.4.758","x-mockingbird-upstream":{"docs":"https://docs.junction.com/","note":"Hand-authored subset from Junction public OpenAPI snippets in the docs."}},"servers":[{"url":"https://api.sandbox.us.junction.com"}],"security":[{"apiKeyAuth":[]}],"paths":{"/v2/user":{"post":{"operationId":"create_user_v2_user_post","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCreateBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingUser"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientUserIDConflictResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"operationId":"get_teams_users_v2_user_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedUsersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/v2/user/{user_id}":{"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_user_v2_user__user_id__get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingUser"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"operationId":"delete_user_v2_user__user_id__delete","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSuccessResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"operationId":"patch_user_v2_user__user_id__patch","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPatchBody"}}}},"responses":{"204":{"description":"Successful Response"},"400":{"description":"Nothing to patch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/user/resolve/{client_user_id}":{"parameters":[{"name":"client_user_id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"get":{"operationId":"get_user_by_client_user_id_v2_user_resolve__client_user_id__get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingUser"},{"$ref":"#/components/schemas/PaginatedUsersResponse"}]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/user/{user_id}/info":{"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user","missing":"00000000-0000-4000-8000-000000000000"}}}],"patch":{"operationId":"patch_user_info_v2_user__user_id__info_patch","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfoPatchBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfo"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/user/{user_id}/info/latest":{"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_latest_user_info_user_v2_user__user_id__info_latest_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfo"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/lab_test":{"get":{"operationId":"get_paginated_lab_tests_for_team_v3_lab_test_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabTestResourcesResponse"}}}}}}},"/v3/lab_test/lab_account":{"get":{"operationId":"get_team_lab_accounts_v3_lab_test_lab_account_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"lab-account inventory is fixture-owned; the mock models the documented shape, filters and routing rules, not a live account inventory"}},"parameters":[{"name":"lab_account_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/LabAccountStatus"},{"type":"null"}]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetTeamLabAccountsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/lab_tests":{"get":{"operationId":"get_lab_tests_for_team_v3_lab_tests_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"summary":"Get Lab Tests For Team","description":"GET all the lab tests the team has access to.","deprecated":true,"parameters":[{"name":"generation_method","in":"query","required":false,"schema":{"$ref":"#/components/schemas/LabTestGenerationMethodFilter","description":"Filter on whether auto-generated lab tests created by Vital, manually created lab tests, or all lab tests should be returned.","default":"manual"},"description":"Filter on whether auto-generated lab tests created by Vital, manually created lab tests, or all lab tests should be returned."},{"name":"lab_slug","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by the slug of the lab for these lab tests.","title":"Lab Slug"},"description":"Filter by the slug of the lab for these lab tests."},{"name":"collection_method","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/LabTestCollectionMethod"},{"type":"null"}],"description":"Filter by the collection method for these lab tests.","title":"Collection Method"},"description":"Filter by the collection method for these lab tests."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/LabTestStatus"},{"type":"null"}],"description":"Filter by the status of these lab tests.","title":"Status"},"description":"Filter by the status of these lab tests."},{"name":"marker_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"description":"Filter to only include lab tests containing these marker IDs.","title":"Marker Ids"},"description":"Filter to only include lab tests containing these marker IDs."},{"name":"provider_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Filter to only include lab tests containing these provider IDs.","title":"Provider Ids"},"description":"Filter to only include lab tests containing these provider IDs."},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by the name of the lab test (a case-insensitive substring search).","title":"Name"},"description":"Filter by the name of the lab test (a case-insensitive substring search)."},{"name":"order_key","in":"query","required":false,"schema":{"anyOf":[{"enum":["price","created_at","updated_at"],"type":"string"},{"type":"null"}],"title":"Order Key"}},{"name":"order_direction","in":"query","required":false,"schema":{"enum":["asc","desc"],"type":"string","default":"asc","title":"Order Direction"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingLabTest"},"title":"Response Get Lab Tests For Team V3 Lab Tests Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/lab_tests/{lab_test_id}":{"parameters":[{"name":"lab_test_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"lab_test","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_lab_test_for_team_v3_lab_tests__lab_test_id__get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingLabTest"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/lab_tests/labs":{"get":{"operationId":"get_labs_v3_lab_tests_labs_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingLab"}}}}}}}},"/v3/lab_tests/{lab_test_id}/markers":{"parameters":[{"name":"lab_test_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"lab_test","missing":"00000000-0000-4000-8000-000000000000"}}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"provider_id","in":"query","required":false,"schema":{"type":"string"}}],"get":{"operationId":"get_markers_for_lab_test_v3_lab_tests__lab_test_id__markers_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetMarkersResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/lab_tests/list_order_set_markers":{"post":{"operationId":"list_order_set_markers_v3_lab_tests_list_order_set_markers_post","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOrderSetMarkersRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetMarkersResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order":{"post":{"operationId":"create_order_v3_order_post","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostOrderResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"description":"Internal Server Error"}}}},"/v3/order/area/info":{"get":{"operationId":"get_area_info_v3_order_area_info_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"central_labs presence, within_radius counts and getlabs market coverage are provider-owned geo data that a mock cannot replicate per-zip; covered by the client-parity scenario shape checks instead"}},"parameters":[{"name":"zip_code","in":"query","required":true,"schema":{"type":"string","pattern":"^\\\\d{5}(?:-?\\\\d{4})?$"}},{"name":"radius","in":"query","required":false,"schema":{"$ref":"#/components/schemas/AllowedRadius"}},{"name":"lab_account_id","in":"query","required":false,"description":"Lab Account ID to use for availability checks","schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AreaInfo"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/psc/info":{"get":{"operationId":"get_psc_info_v3_order_psc_info_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"patient_service_centers are real site inventories per zip (thousands of sites, result-capped at 30) that a fixture mock cannot replicate per-zip; covered by the client-parity scenario shape checks instead"}},"parameters":[{"name":"zip_code","in":"query","required":true,"schema":{"type":"string","pattern":"^\\\\d{5}$"}},{"name":"lab_id","in":"query","required":true,"schema":{"type":"integer"}},{"name":"radius","in":"query","required":false,"schema":{"$ref":"#/components/schemas/AllowedRadius"}},{"name":"capabilities","in":"query","required":false,"schema":{"type":"array","items":{"$ref":"#/components/schemas/LabLocationCapability"}}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PscInfo"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/phlebotomy/appointment/availability":{"post":{"operationId":"get_phlebotomy_appointment_availability_v3_order_phlebotomy_appointment_availability_post","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"availability slots are provider-side data whose values shift between sandbox calls; covered by the mock-internal scheduling property suite instead"}},"parameters":[{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsAddress"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentAvailabilitySlots"}}}},"400":{"description":"Availability not bookable for this address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No availability found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/phlebotomy/appointment/cancellation-reasons":{"get":{"operationId":"get_phlebotomy_appointment_cancellation_reason_v3_order_phlebotomy_appointment_cancellation_reasons_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingAppointmentCancellationReason"}}}}}}}},"/v3/order/psc/appointment/availability":{"post":{"operationId":"get_psc_appointment_availability_v3_order_psc_appointment_availability_post","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"availability slots are provider-side data whose values shift between sandbox calls; covered by the mock-internal scheduling property suite instead"}},"parameters":[{"name":"lab","in":"query","required":true,"schema":{"$ref":"#/components/schemas/AppointmentPscLabs"}},{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"site_codes","in":"query","required":false,"schema":{"type":"string","description":"JSON-encoded array of site codes"}},{"name":"zip_code","in":"query","required":false,"schema":{"type":"string"}},{"name":"radius","in":"query","required":false,"schema":{"$ref":"#/components/schemas/AllowedRadius"}},{"name":"allow_stale","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentAvailabilitySlots"}}}},"400":{"description":"Availability not bookable for this address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No slots found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/psc/appointment/cancellation-reasons":{"get":{"operationId":"get_psc_appointment_cancellation_reason_v3_order_psc_appointment_cancellation_reasons_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingAppointmentCancellationReason"}}}}}}}},"/v3/order/{order_id}/phlebotomy/appointment":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"appointment payloads embed provider-side slot data; covered by the mock-internal scheduling property suite instead"}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/phlebotomy/appointment/book":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"post":{"operationId":"book_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_book_post","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"booking depends on live provider slot state; covered by the mock-internal scheduling property suite instead"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentBookingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Booking failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/phlebotomy/appointment/reschedule":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"patch":{"operationId":"reschedule_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_reschedule_patch","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"rescheduling depends on live provider slot state; covered by the mock-internal scheduling property suite instead"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentRescheduleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Invalid or expired booking key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/phlebotomy/appointment/cancel":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"patch":{"operationId":"cancel_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_cancel_patch","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"cancellation depends on live provider appointment state; covered by the mock-internal scheduling property suite instead"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhlebotomyAppointmentCancelRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Invalid cancellation reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/psc/appointment":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_psc_appointment_v3_order__order_id__psc_appointment_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"appointment payloads embed provider-side slot data; covered by the mock-internal scheduling property suite instead"}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/psc/appointment/book":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"post":{"operationId":"book_psc_appointment_v3_order__order_id__psc_appointment_book_post","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"booking depends on live provider slot state; covered by the mock-internal scheduling property suite instead"}},"parameters":[{"name":"x-idempotency-key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PscAppointmentBookingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Booking failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/psc/appointment/reschedule":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"patch":{"operationId":"reschedule_psc_appointment_v3_order__order_id__psc_appointment_reschedule_patch","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"rescheduling depends on live provider slot state; covered by the mock-internal scheduling property suite instead"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentRescheduleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Invalid or expired booking key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/psc/appointment/cancel":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"patch":{"operationId":"cancel_psc_appointment_v3_order__order_id__psc_appointment_cancel_patch","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"cancellation depends on live provider appointment state; covered by the mock-internal scheduling property suite instead"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PscAppointmentCancelRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Invalid cancellation reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_order_v3_order__order_id__get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingOrder"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/cancel":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"post":{"operationId":"cancel_order_v3_order__order_id__cancel_post","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostOrderResponse"}}}},"400":{"description":"Order is not in a cancellable status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/test":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"post":{"operationId":"simulate_order_v3_order__order_id__test_post","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"final_status","in":"query","required":true,"schema":{"type":"string","enum":["received.walk_in_test.ordered","received.walk_in_test.requisition_created","received.walk_in_test.requisition_bypassed","completed.walk_in_test.completed","sample_with_lab.walk_in_test.partial_results","failed.walk_in_test.sample_error","cancelled.walk_in_test.cancelled","collecting_sample.walk_in_test.appointment_pending","collecting_sample.walk_in_test.appointment_scheduled","collecting_sample.walk_in_test.appointment_cancelled","collecting_sample.walk_in_test.redraw_available","received.at_home_phlebotomy.ordered","received.at_home_phlebotomy.requisition_created","received.at_home_phlebotomy.requisition_bypassed","collecting_sample.at_home_phlebotomy.appointment_pending","collecting_sample.at_home_phlebotomy.appointment_scheduled","collecting_sample.at_home_phlebotomy.draw_completed","collecting_sample.at_home_phlebotomy.appointment_cancelled","completed.at_home_phlebotomy.completed","sample_with_lab.at_home_phlebotomy.partial_results","cancelled.at_home_phlebotomy.cancelled","failed.at_home_phlebotomy.sample_error","received.testkit.ordered","received.testkit.awaiting_registration","received.testkit.requisition_created","received.testkit.requisition_bypassed","received.testkit.registered","collecting_sample.testkit.transit_customer","collecting_sample.testkit.out_for_delivery","collecting_sample.testkit.with_customer","collecting_sample.testkit.transit_lab","sample_with_lab.testkit.delivered_to_lab","sample_with_lab.testkit.lab_processing_blocked","completed.testkit.completed","failed.testkit.failure_to_deliver_to_customer","failed.testkit.failure_to_deliver_to_lab","failed.testkit.sample_error","failed.testkit.lost","cancelled.testkit.cancelled","cancelled.testkit.do_not_process","collecting_sample.testkit.problem_in_transit_customer","collecting_sample.testkit.problem_in_transit_lab","received.on_site_collection.ordered","received.on_site_collection.requisition_created","received.on_site_collection.requisition_bypassed","sample_with_lab.on_site_collection.draw_completed","completed.on_site_collection.completed","cancelled.on_site_collection.cancelled","sample_with_lab.on_site_collection.partial_results","failed.on_site_collection.sample_error","completed.walk_in_test.corrected","completed.at_home_phlebotomy.corrected","completed.on_site_collection.corrected","completed.testkit.corrected"]}},{"name":"delay","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Seconds to defer the status transition"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimulationFlags"}}}},"responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string","examples":["Success"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/result":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_result_raw_v3_order__order_id__result_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"results carry provider-side specimen data; covered by the mock-internal results property suite instead"}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabResultsRaw"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/result/metadata":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_result_metadata_v3_order__order_id__result_metadata_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabResultsMetadata"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/result/pdf":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_result_pdf_v3_order__order_id__result_pdf_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"PDF bytes are provider-rendered; compared by shape (byteLength) only in the scenario script"}},"responses":{"200":{"description":"Successful Response","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/requisition/pdf":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_order_requisition_pdf_v3_order__order_id__requisition_pdf_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"PDF bytes are provider-rendered; compared by shape (byteLength) only in the scenario script"}},"responses":{"200":{"description":"Successful Response","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/orders":{"get":{"operationId":"get_orders_v3_orders_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user","missing":"00000000-0000-4000-8000-000000000000"}}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetOrdersResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order_transaction/{transaction_id}":{"parameters":[{"name":"transaction_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order_transaction","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_order_transaction_v3_order_transaction__transaction_id__get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"order transactions are not available to the sandbox team (feature not available)"}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetOrderTransactionResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order_transaction/{transaction_id}/result":{"parameters":[{"name":"transaction_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order_transaction","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_order_transaction_result_v3_order_transaction__transaction_id__result_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"lab results are not available to the sandbox team (feature not available)"}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabResultsRaw"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"x-vital-api-key"}},"schemas":{"UserCreateBody":{"type":"object","required":["client_user_id"],"properties":{"client_user_id":{"type":"string","minLength":1,"maxLength":64,"examples":["mbr_8891","patient-1042","user.profile_52"]},"fallback_time_zone":{"type":["string","null"],"enum":["America/Los_Angeles","America/New_York","Europe/London","UTC",null]}}},"ClientFacingUser":{"type":"object","required":["user_id","team_id","client_user_id","created_on","connected_sources","fallback_time_zone"],"properties":{"user_id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"user","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"team_id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"account"}},"client_user_id":{"type":"string"},"created_on":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"connected_sources":{"type":"array","items":{"type":"object","additionalProperties":true}},"fallback_time_zone":{"type":["object","null"],"properties":{"id":{"type":"string"},"source_slug":{"type":"string"},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}},"fallback_birth_date":{"type":["object","null"],"properties":{"value":{"type":"string"},"source_slug":{"type":"string"},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}},"ingestion_start":{"type":["string","null"]},"ingestion_end":{"type":["string","null"]}}},"UserInfoPatchBody":{"type":"object","properties":{"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"dob":{"type":["string","null"]},"gender":{"type":["string","null"]},"phone_number":{"type":["string","null"]},"email":{"type":["string","null"]},"address":{"type":["object","null"],"additionalProperties":true}}},"UserInfo":{"type":"object","additionalProperties":true},"ClientUserIDConflictResponse":{"type":"object","required":["detail"],"properties":{"detail":{"type":"object","required":["error_type","error_message","user_id","created_on"],"properties":{"error_type":{"type":"string"},"error_message":{"type":"string"},"user_id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"id"}},"created_on":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}}}},"UserSuccessResponse":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean"}}},"PaginatedUsersResponse":{"type":"object","required":["users","total","offset","limit"],"properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingUser"}},"total":{"type":"integer"},"offset":{"type":"integer"},"limit":{"type":"integer"}}},"UserPatchBody":{"type":"object","properties":{"fallback_time_zone":{"type":["string","null"]},"fallback_birth_date":{"type":["string","null"],"format":"date"},"ingestion_start":{"type":["string","null"],"format":"date"},"ingestion_end":{"type":["string","null"],"format":"date"},"client_user_id":{"type":["string","null"]}}},"LabTestCollectionMethod":{"type":"string","enum":["testkit","walk_in_test","at_home_phlebotomy","on_site_collection"]},"LabTestGenerationMethodFilter":{"type":"string","enum":["auto","manual","all"]},"LabTestSampleType":{"type":"string","enum":["dried_blood_spot","arm_collector","serum","saliva","urine","stool"]},"LabTestStatus":{"type":"string","enum":["active","pending_approval","inactive"]},"MarkerType":{"type":"string","enum":["biomarker","panel"]},"ClientFacingLab":{"type":"object","required":["id","slug","name","first_line_address","city","zipcode","collection_methods","sample_types"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"id"}},"slug":{"type":"string"},"name":{"type":"string"},"first_line_address":{"type":"string"},"city":{"type":"string"},"zipcode":{"type":"string"},"collection_methods":{"type":"array","items":{"$ref":"#/components/schemas/LabTestCollectionMethod"}},"sample_types":{"type":"array","items":{"$ref":"#/components/schemas/LabTestSampleType"}},"logo_url":{"type":["string","null"]}}},"ClientFacingMarker":{"type":"object","required":["id","name","slug"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"lab_id":{"type":["integer","null"]},"provider_id":{"type":["string","null"]},"type":{"anyOf":[{"$ref":"#/components/schemas/MarkerType"},{"type":"null"}]},"unit":{"type":["string","null"]},"price":{"type":["string","null"]},"aoe":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]},"a_la_carte_enabled":{"type":"boolean","default":false},"common_tat_days":{"type":["integer","null"]},"worst_case_tat_days":{"type":["integer","null"]},"is_orderable":{"type":["boolean","null"],"default":true}}},"ClientFacingLabTest":{"type":"object","required":["id","slug","name","sample_type","method","price","is_active","status","lab","markers"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"lab_test","identity":true}},"slug":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"name":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"sample_type":{"$ref":"#/components/schemas/LabTestSampleType"},"method":{"$ref":"#/components/schemas/LabTestCollectionMethod"},"price":{"type":"number"},"is_active":{"type":"boolean"},"status":{"$ref":"#/components/schemas/LabTestStatus"},"fasting":{"type":"boolean","default":false},"lab":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingLab"},{"type":"null"}]},"markers":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingMarker"}},{"type":"null"}]},"is_delegated":{"type":"boolean","default":false},"auto_generated":{"type":"boolean","default":false},"has_collection_instructions":{"type":["boolean","null"]},"common_tat_days":{"type":["integer","null"]},"worst_case_tat_days":{"type":["integer","null"]}}},"LabTestResourcesResponse":{"type":"object","required":["data","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingLabTest"}},"next_cursor":{"type":["string","null"]}}},"LabAccountStatus":{"type":"string","enum":["active","pending","suspended","ready_to_launch"]},"LabAccountDelegatedFlow":{"type":"string","enum":["order_delegated","result_delegated","fully_delegated","not_delegated"]},"USState":{"type":"string","enum":["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"]},"Labs":{"type":"string","enum":["ayumetrix","spiriplex","ussl","quest","sonora_quest","labcorp","bioreference","us_biotek","manual","sanocardio","ihd","nexus","my_uti","crl","mtl"]},"ClientFacingLabAccount":{"type":"object","required":["id","lab","status","delegated_flow","provider_account_id","allowed_billing","team_id_allowlist"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"lab_account","identity":true}},"lab":{"$ref":"#/components/schemas/Labs"},"org_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"status":{"$ref":"#/components/schemas/LabAccountStatus"},"delegated_flow":{"$ref":"#/components/schemas/LabAccountDelegatedFlow"},"provider_account_id":{"type":"string"},"account_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"default_clinical_notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"business_units":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"allowed_billing":{"type":"object","propertyNames":{"$ref":"#/components/schemas/Billing"},"additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/USState"}}},"team_id_allowlist":{"type":"array","items":{"type":"string","format":"uuid"}}}},"GetTeamLabAccountsResponse":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingLabAccount"}}}},"ClientFacingResult":{"type":"object","required":["name","slug","type"],"properties":{"name":{"type":"string"},"slug":{"type":"string"},"provider_id":{"type":["string","null"]},"type":{"$ref":"#/components/schemas/ResultType"},"value":{"type":["number","null"]},"unit":{"type":["string","null"]},"low_value":{"type":["number","null"]},"high_value":{"type":["number","null"]},"string_value":{"type":["string","null"]},"coded_value":{"type":["string","null"]},"is_abnormal":{"type":"boolean","default":false},"notes":{"type":["string","null"]}}},"GetMarkersResponse":{"type":"object","required":["markers"],"properties":{"markers":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingMarkerComplete"}},"total":{"type":["integer","null"]},"page":{"type":["integer","null"]},"size":{"type":["integer","null"]},"pages":{"type":["integer","null"]}}},"ClientFacingExpectedResult":{"type":"object","required":["id","name","slug","required"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"slug":{"type":"string"},"lab_id":{"type":["integer","null"]},"provider_id":{"type":["string","null"]},"required":{"type":"boolean"},"loinc":{"type":["object","null"],"required":["id","name","slug","code"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"slug":{"type":"string"},"code":{"type":"string"},"unit":{"type":["string","null"]}}}}},"ClientFacingMarkerComplete":{"type":"object","required":["id","name","slug","expected_results"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"lab_id":{"type":["integer","null"]},"provider_id":{"type":["string","null"]},"type":{"anyOf":[{"$ref":"#/components/schemas/MarkerType"},{"type":"null"}]},"unit":{"type":["string","null"]},"price":{"type":["string","null"]},"a_la_carte_enabled":{"type":"boolean","default":false},"common_tat_days":{"type":["integer","null"]},"worst_case_tat_days":{"type":["integer","null"]},"is_orderable":{"type":["boolean","null"],"default":true},"expected_results":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingExpectedResult"}}}},"ListOrderSetMarkersRequest":{"type":"object","required":["order_set_id"],"properties":{"order_set_id":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order_transaction","missing":"00000000-0000-4000-8000-000000000000"}},"provider_id":{"type":["string","null"]}}},"AllowedRadius":{"type":"integer","enum":[10,20,25,50,100]},"AppointmentPscLabs":{"type":"string","enum":["quest"]},"AppointmentProvider":{"type":"string","enum":["getlabs","phlebfinders","quest"]},"AppointmentType":{"type":"string","enum":["phlebotomy","patient_service_center"]},"AppointmentStatus":{"type":"string","enum":["confirmed","pending","reserved","in_progress","completed","cancelled"]},"AppointmentEventStatus":{"type":"string","enum":["pending","reserved","scheduled","completed","cancelled","in_progress"]},"AppointmentServiceType":{"type":"string","enum":["appointment-ready","appointment-request"]},"Billing":{"type":"string","enum":["client_bill","commercial_insurance","patient_bill_passthrough","patient_bill"]},"LabLocationCapability":{"type":"string","enum":["stat","appointment_scheduling_via_junction","appointment_scheduling_with_lab"]},"LngLat":{"type":"object","required":["lng","lat"],"properties":{"lng":{"type":"number"},"lat":{"type":"number"}}},"UsAddress":{"type":"object","required":["first_line","city","state","zip_code"],"properties":{"first_line":{"type":"string","minLength":1},"second_line":{"type":["string","null"]},"city":{"type":"string","minLength":1},"state":{"type":"string","minLength":1},"zip_code":{"type":"string","minLength":1},"unit":{"type":["string","null"]}}},"AppointmentLocation":{"type":"object","required":["location","address","code","name"],"properties":{"location":{"$ref":"#/components/schemas/LngLat"},"distance":{"type":["number","null"]},"address":{"$ref":"#/components/schemas/UsAddress"},"code":{"type":"string"},"name":{"type":"string"},"iana_timezone":{"type":["string","null"]}}},"TimeSlot":{"type":"object","required":["start","end","price","is_priority","num_appointments_available"],"properties":{"booking_key":{"type":["string","null"],"x-mockingbird-resource":{"type":"booking_key","identity":true},"x-mockingbird-volatile":{"kind":"token"}},"start":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"end":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"expires_at":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"timestamp"}},"price":{"type":"number"},"is_priority":{"type":"boolean"},"num_appointments_available":{"type":"integer"}}},"DaySlots":{"type":"object","required":["date","slots"],"properties":{"location":{"anyOf":[{"$ref":"#/components/schemas/AppointmentLocation"},{"type":"null"}]},"date":{"type":"string","format":"date"},"slots":{"type":"array","items":{"$ref":"#/components/schemas/TimeSlot"}}}},"AppointmentAvailabilitySlots":{"type":"object","required":["slots"],"properties":{"slots":{"type":"array","items":{"$ref":"#/components/schemas/DaySlots"}},"timezone":{"type":["string","null"]}}},"AppointmentBookingRequest":{"type":"object","required":["booking_key"],"properties":{"booking_key":{"type":"string","minLength":1,"x-mockingbird-resource-ref":{"type":"booking_key"}}}},"AppointmentRescheduleRequest":{"type":"object","required":["booking_key"],"properties":{"booking_key":{"type":"string","minLength":1,"x-mockingbird-resource-ref":{"type":"booking_key"}}}},"PscAppointmentBookingRequest":{"type":"object","required":["booking_key","site_code"],"properties":{"booking_key":{"type":"string","minLength":1,"x-mockingbird-resource-ref":{"type":"booking_key"}},"site_code":{"type":"string","minLength":1}}},"PhlebotomyAppointmentCancelRequest":{"type":"object","required":["cancellation_reason_id"],"properties":{"cancellation_reason_id":{"type":"string","minLength":1},"notes":{"type":["string","null"]}}},"PscAppointmentCancelRequest":{"type":"object","required":["cancellationReasonId"],"properties":{"cancellationReasonId":{"type":"string","minLength":1},"note":{"type":["string","null"]}}},"ClientFacingAppointmentEvent":{"type":"object","required":["created_at","status"],"properties":{"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"status":{"$ref":"#/components/schemas/AppointmentEventStatus"},"data":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]}}},"ClientFacingAppointment":{"type":"object","required":["id","user_id","order_id","address","location","type","provider","status","provider_id","can_reschedule","event_status","events"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"appointment","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"user_id":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user"}},"order_id":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order"}},"address":{"$ref":"#/components/schemas/UsAddress"},"location":{"$ref":"#/components/schemas/LngLat"},"start_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"end_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"iana_timezone":{"type":["string","null"]},"type":{"$ref":"#/components/schemas/AppointmentType"},"provider":{"$ref":"#/components/schemas/AppointmentProvider"},"status":{"$ref":"#/components/schemas/AppointmentStatus"},"provider_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"external_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"can_reschedule":{"type":"boolean"},"event_status":{"$ref":"#/components/schemas/AppointmentEventStatus"},"event_data":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]},"order_transaction_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"order_transaction"}},"appointment_notes":{"type":["string","null"]},"events":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingAppointmentEvent"}}}},"ClientFacingAppointmentCancellationReason":{"type":"object","required":["id","name","is_refundable"],"properties":{"id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"is_refundable":{"type":"boolean"}}},"PhlebotomyAreaInfo":{"type":"object","required":["is_served","providers"],"properties":{"is_served":{"type":"boolean"},"providers":{"type":"array","items":{"$ref":"#/components/schemas/PhlebotomyProviderInfo"}}}},"PhlebotomyProviderInfo":{"type":"object","required":["name","service_types"],"properties":{"name":{"$ref":"#/components/schemas/AppointmentProvider"},"service_types":{"type":"array","items":{"$ref":"#/components/schemas/AppointmentServiceType"}}}},"PscAreaInfoDetails":{"type":"object","required":["appointment_with_vital","within_radius","radius"],"properties":{"appointment_with_vital":{"type":"boolean"},"within_radius":{"type":"number"},"radius":{"type":"string"},"capabilities":{"type":["array","null"],"items":{"$ref":"#/components/schemas/LabLocationCapability"}}}},"PscAreaInfo":{"type":"object","required":["patient_service_centers","supported_bill_types","lab_id"],"properties":{"patient_service_centers":{"$ref":"#/components/schemas/PscAreaInfoDetails"},"supported_bill_types":{"type":"array","items":{"$ref":"#/components/schemas/Billing"}},"lab_id":{"type":"integer"}}},"AreaInfo":{"type":"object","required":["zip_code","phlebotomy","central_labs"],"properties":{"zip_code":{"type":"string"},"phlebotomy":{"$ref":"#/components/schemas/PhlebotomyAreaInfo"},"central_labs":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/PscAreaInfo"}}}},"LabLocationMetadata":{"type":"object","required":["name","state","city","zip_code","first_line"],"properties":{"name":{"type":"string"},"state":{"type":"string"},"city":{"type":"string"},"zip_code":{"type":"string"},"first_line":{"type":"string"},"second_line":{"type":["string","null"]},"phone_number":{"type":["string","null"]},"fax_number":{"type":["string","null"]},"hours":{"type":["object","null"],"additionalProperties":true}}},"ClientFacingLabLocation":{"type":"object","required":["metadata","distance","site_code","supported_bill_types","location","capabilities"],"properties":{"metadata":{"$ref":"#/components/schemas/LabLocationMetadata"},"distance":{"type":"number"},"site_code":{"type":"string"},"supported_bill_types":{"type":"array","items":{"$ref":"#/components/schemas/Billing"}},"location":{"$ref":"#/components/schemas/LngLat"},"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/LabLocationCapability"}}}},"PscInfo":{"type":"object","required":["lab_id","slug","patient_service_centers"],"properties":{"lab_id":{"type":"integer"},"slug":{"type":"string"},"patient_service_centers":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingLabLocation"}}}},"OrderTopLevelStatus":{"type":"string","enum":["received","collecting_sample","sample_with_lab","completed","cancelled","failed"]},"OrderLowLevelStatus":{"type":"string","enum":["ordered","requisition_created","requisition_bypassed","transit_customer","out_for_delivery","with_customer","transit_lab","delivered_to_lab","completed","failure_to_deliver_to_lab","failure_to_deliver_to_customer","problem_in_transit_lab","problem_in_transit_customer","sample_error","appointment_scheduled","appointment_cancelled","appointment_pending","draw_completed","cancelled","lost","do_not_process","partial_results","awaiting_registration","registered","redraw_available","corrected","lab_processing_blocked"]},"OrderStatus":{"type":"string","enum":["received.walk_in_test.ordered","received.walk_in_test.requisition_created","received.walk_in_test.requisition_bypassed","completed.walk_in_test.completed","sample_with_lab.walk_in_test.partial_results","failed.walk_in_test.sample_error","cancelled.walk_in_test.cancelled","collecting_sample.walk_in_test.appointment_pending","collecting_sample.walk_in_test.appointment_scheduled","collecting_sample.walk_in_test.appointment_cancelled","collecting_sample.walk_in_test.redraw_available","received.at_home_phlebotomy.ordered","received.at_home_phlebotomy.requisition_created","received.at_home_phlebotomy.requisition_bypassed","collecting_sample.at_home_phlebotomy.appointment_pending","collecting_sample.at_home_phlebotomy.appointment_scheduled","collecting_sample.at_home_phlebotomy.draw_completed","collecting_sample.at_home_phlebotomy.appointment_cancelled","completed.at_home_phlebotomy.completed","sample_with_lab.at_home_phlebotomy.partial_results","cancelled.at_home_phlebotomy.cancelled","failed.at_home_phlebotomy.sample_error","received.testkit.ordered","received.testkit.awaiting_registration","received.testkit.requisition_created","received.testkit.requisition_bypassed","received.testkit.registered","collecting_sample.testkit.transit_customer","collecting_sample.testkit.out_for_delivery","collecting_sample.testkit.with_customer","collecting_sample.testkit.transit_lab","sample_with_lab.testkit.delivered_to_lab","sample_with_lab.testkit.lab_processing_blocked","completed.testkit.completed","failed.testkit.failure_to_deliver_to_customer","failed.testkit.failure_to_deliver_to_lab","failed.testkit.sample_error","failed.testkit.lost","cancelled.testkit.cancelled","cancelled.testkit.do_not_process","collecting_sample.testkit.problem_in_transit_customer","collecting_sample.testkit.problem_in_transit_lab","received.on_site_collection.ordered","received.on_site_collection.requisition_created","received.on_site_collection.requisition_bypassed","sample_with_lab.on_site_collection.draw_completed","completed.on_site_collection.completed","cancelled.on_site_collection.cancelled","sample_with_lab.on_site_collection.partial_results","failed.on_site_collection.sample_error","completed.walk_in_test.corrected","completed.at_home_phlebotomy.corrected","completed.on_site_collection.corrected","completed.testkit.corrected"]},"OrderStatusDetail":{"type":"string","enum":["fulfillment_error","date_of_collection_unspecified","demographic_information_unspecified","demographic_information_mismatch","sample_quantity_not_sufficient","sample_contaminated","sample_stability_exceeded","sample_hemolyzed","sample_improper_collection"]},"OrderTransactionStatus":{"type":"string","enum":["active","completed","cancelled"]},"ClientFacingOrderEvent":{"type":"object","required":["id","created_at","status"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"opaque"}},"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"status":{"$ref":"#/components/schemas/OrderStatus"},"status_detail":{"anyOf":[{"$ref":"#/components/schemas/OrderStatusDetail"},{"type":"null"}]}}},"ShippingAddress":{"type":"object","required":["receiver_name","first_line","city","state","zip","country","phone_number"],"properties":{"receiver_name":{"type":"string"},"first_line":{"type":"string"},"second_line":{"type":["string","null"]},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"},"country":{"type":"string"},"phone_number":{"type":"string"}}},"ClientFacingPhysician":{"type":"object","required":["first_name","last_name","npi"],"properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"npi":{"type":"string"}}},"ClientFacingShipment":{"type":"object","required":["id","outbound_tracking_number","outbound_tracking_url","inbound_tracking_number","inbound_tracking_url","outbound_courier","inbound_courier","notes"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"id"}},"outbound_tracking_number":{"type":["string","null"]},"outbound_tracking_url":{"type":["string","null"]},"inbound_tracking_number":{"type":["string","null"]},"inbound_tracking_url":{"type":["string","null"]},"outbound_courier":{"type":["string","null"]},"inbound_courier":{"type":["string","null"]},"notes":{"type":["string","null"]}}},"ClientFacingTestkitOrder":{"type":"object","required":["id","shipment","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"id"}},"shipment":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingShipment"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"opaque"}},"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}},"ClientFacingWalkInOrder":{"type":"object","required":["id","appointment_id","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"id"}},"appointment_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}},"ClientFacingTestKitOrderDetails":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["testkit","walk_in_test","at_home_phlebotomy","on_site_collection"]},"data":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingTestkitOrder"},{"$ref":"#/components/schemas/ClientFacingWalkInOrder"},{"type":"null"}]}}},"ClientFacingPatientDetailsCompatible":{"type":"object","required":["first_name","last_name","dob","gender","phone_number","email"],"properties":{"first_name":{"type":"string","minLength":1,"pattern":"^[a-zA-Z0-9][a-zA-Z0-9 .,'-]*$","examples":["Ada","Chris","Maria","Jun"]},"last_name":{"type":"string","minLength":1,"pattern":"^[a-zA-Z0-9][a-zA-Z0-9 .,'-]*$","examples":["Lovelace","Vouga","Delgado","Park"]},"dob":{"type":"string","format":"date-time","examples":["1990-06-15T00:00:00.000Z","1983-02-02T00:00:00.000Z"]},"gender":{"type":"string","minLength":1,"pattern":"\\\\S","examples":["male","female","other","prefer_not_to_say"]},"phone_number":{"type":"string","minLength":1,"pattern":"^\\\\+1[2-9]\\\\d{9}$","examples":["+14155550123","+12125550987","+13105554444"]},"email":{"type":"string","format":"email","minLength":1,"examples":["ada@example.com","chris@example.com","maria@example.com"]}}},"PatientAddressCompatible":{"type":"object","required":["first_line","city","state","zip","country"],"properties":{"receiver_name":{"type":"string","default":"","examples":["Ada Lovelace","Chris Vouga"]},"first_line":{"type":"string","minLength":1,"pattern":"\\\\S","examples":["1 Main St","450 Market St","88 Kearny St"]},"second_line":{"type":["string","null"]},"city":{"type":"string","minLength":1,"pattern":"\\\\S","examples":["San Diego","San Francisco","New York"]},"state":{"type":"string","minLength":1,"enum":["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"]},"zip":{"type":"string","pattern":"^\\\\d{5}(-\\\\d{4})?$","examples":["92101","94105","10001"]},"country":{"type":"string","minLength":1,"pattern":"\\\\S","examples":["US"]},"access_notes":{"type":["string","null"],"examples":[null]},"phone_number":{"type":["string","null"],"examples":["+14155550123",null]}}},"AoeAnswerRequest":{"type":"object","required":["marker_id","question_id","answer"],"properties":{"marker_id":{"type":"integer","examples":[2075,1975]},"question_id":{"type":"integer","examples":[1]},"answer":{"type":"string","minLength":1,"examples":["No","Yes"]}}},"ClientFacingOrderInTransaction":{"type":"object","required":["id","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"low_level_status":{"anyOf":[{"$ref":"#/components/schemas/OrderLowLevelStatus"},{"type":"null"}]},"low_level_status_created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}},"ClientFacingOrderTransaction":{"type":"object","required":["id","status","orders"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"order_transaction","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"status":{"$ref":"#/components/schemas/OrderTransactionStatus"},"orders":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingOrderInTransaction"}}}},"OrderSummary":{"type":"object","required":["id","last_status","last_status_created_at","updated_at","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"origin":{"anyOf":[{"type":"string","enum":["initial","redraw","recreation"]},{"type":"null"}]},"parent_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"last_status":{"$ref":"#/components/schemas/OrderLowLevelStatus"},"last_status_created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"GetOrderTransactionResponse":{"type":"object","required":["id","team_id","status"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"order_transaction","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"team_id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"account"}},"status":{"$ref":"#/components/schemas/OrderTransactionStatus"},"orders":{"type":"array","items":{"$ref":"#/components/schemas/OrderSummary"}}}},"ClientFacingOrder":{"type":"object","required":["user_id","id","team_id","patient_details","patient_address","lab_test","details","sample_id","notes","created_at","updated_at","events","last_event","health_insurance_id","requisition_form_url","shipping_details","has_abn"],"properties":{"user_id":{"type":"string","format":"uuid"},"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"order","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"team_id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"account"}},"patient_details":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingPatientDetailsCompatible"},{"type":"null"}]},"patient_address":{"anyOf":[{"$ref":"#/components/schemas/PatientAddressCompatible"},{"type":"null"}]},"lab_test":{"$ref":"#/components/schemas/ClientFacingLabTest"},"details":{"$ref":"#/components/schemas/ClientFacingTestKitOrderDetails"},"sample_id":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"opaque"}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"clinical_notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"events":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingOrderEvent"}},"status":{"anyOf":[{"$ref":"#/components/schemas/OrderTopLevelStatus"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"opaque"}},"last_event":{"$ref":"#/components/schemas/ClientFacingOrderEvent"},"physician":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingPhysician"},{"type":"null"}]},"health_insurance_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"requisition_form_url":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"url"}},"priority":{"type":"boolean","default":false},"shipping_details":{"anyOf":[{"$ref":"#/components/schemas/ShippingAddress"},{"type":"null"}]},"activate_by":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"passthrough":{"anyOf":[{"type":"string"},{"type":"null"}]},"billing_type":{"type":"string","enum":["client_bill","commercial_insurance","patient_bill_passthrough","patient_bill","upfront_payment"],"default":"client_bill"},"icd_codes":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"has_abn":{"type":"boolean"},"interpretation":{"anyOf":[{"type":"string","enum":["normal","abnormal","critical","unknown"]},{"type":"null"}]},"has_missing_results":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"expected_result_by_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"worst_case_result_by_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"origin":{"anyOf":[{"type":"string","enum":["initial","redraw","recreation"]},{"type":"null"}]},"order_transaction":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingOrderTransaction"},{"type":"null"}]}}},"OrderSetRequest":{"type":"object","required":["lab_test_ids"],"properties":{"lab_test_ids":{"type":"array","minItems":1,"items":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"lab_test","missing":"00000000-0000-4000-8000-000000000000"}}}}},"CreateOrderRequest":{"type":"object","required":["user_id","patient_details","patient_address","order_set"],"properties":{"user_id":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user","missing":"00000000-0000-4000-8000-000000000000"}},"patient_details":{"$ref":"#/components/schemas/ClientFacingPatientDetailsCompatible"},"patient_address":{"$ref":"#/components/schemas/PatientAddressCompatible"},"order_set":{"$ref":"#/components/schemas/OrderSetRequest"},"clinical_notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"passthrough":{"anyOf":[{"type":"string"},{"type":"null"}]},"collection_method":{"$ref":"#/components/schemas/LabTestCollectionMethod"},"lab_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"idempotency_key":{"type":["string","null"]},"idempotency_error":{"type":["string","null"]},"aoe_answers":{"type":["array","null"],"items":{"$ref":"#/components/schemas/AoeAnswerRequest"}}}},"PostOrderResponse":{"type":"object","required":["order","status","message"],"properties":{"order":{"$ref":"#/components/schemas/ClientFacingOrder"},"status":{"type":"string"},"message":{"type":"string"}}},"ResultType":{"type":"string","enum":["numeric","range","comment","coded_value"]},"ParentBiomarkerData":{"type":"object","required":["marker_id","name","slug"],"properties":{"marker_id":{"type":"integer"},"name":{"type":"string"},"slug":{"type":"string"},"provider_id":{"type":["string","null"]}}},"BiomarkerResult":{"type":"object","required":["name","result","type"],"properties":{"name":{"type":"string"},"slug":{"type":"string","default":""},"value":{"anyOf":[{"type":"number"},{"type":"null"}]},"result":{"type":"string"},"type":{"$ref":"#/components/schemas/ResultType"},"unit":{"type":["string","null"]},"timestamp":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"notes":{"type":["string","null"]},"reference_range":{"type":["string","null"]},"min_range_value":{"type":["number","null"]},"max_range_value":{"type":["number","null"]},"is_above_max_range":{"type":["boolean","null"]},"is_below_min_range":{"type":["boolean","null"]},"interpretation":{"type":"string","default":"normal"},"source_interpretation":{"type":"string","default":""},"loinc":{"type":["string","null"]},"loinc_slug":{"type":["string","null"]},"provider_id":{"type":["string","null"]},"source_markers":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ParentBiomarkerData"}},{"type":"null"}]},"performing_laboratory":{"type":["string","null"]},"source_sample_id":{"type":["string","null"]}}},"FailureType":{"type":"string","enum":["quantity_not_sufficient_failure","collection_process_failure","drop_off_failure","internal_lab_failure","order_entry_failure","non_failure","unknown_failure","patient_condition_failure","missing_result_calc_failure","missing_demo_aoe_calc_failure","insufficient_volume"]},"MissingBiomarkerResult":{"type":"object","required":["name","slug","inferred_failure_type"],"properties":{"name":{"type":"string"},"slug":{"type":"string"},"inferred_failure_type":{"$ref":"#/components/schemas/FailureType"},"note":{"type":["string","null"]},"loinc":{"type":["string","null"]},"loinc_slug":{"type":["string","null"]},"provider_id":{"type":["string","null"]},"source_markers":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ParentBiomarkerData"}},{"type":"null"}]}}},"SampleData":{"type":"object","properties":{"sample_id":{"type":["string","null"]},"control_number":{"type":["string","null"]},"date_collected":{"type":["string","null"]},"date_received":{"type":["string","null"]},"date_reported":{"type":["string","null"]},"performing_laboratories":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]},"clinical_information":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]}}},"LabResultsMetadata":{"type":"object","required":["age","dob","patient","date_reported","specimen_number"],"properties":{"age":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"dob":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"clia_#":{"anyOf":[{"type":"string"},{"type":"null"}]},"patient":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"token"}},"laboratory":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"token"}},"date_reported":{"type":"string","x-mockingbird-volatile":{"kind":"timestamp"}},"date_collected":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"specimen_number":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"date_received":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"status":{"type":"string","default":"final"},"interpretation":{"anyOf":[{"type":"string"},{"type":"null"}]},"patient_id":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"id"}},"account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"id"}}}},"LabResultsRaw":{"type":"object","required":["metadata","results"],"properties":{"metadata":{"$ref":"#/components/schemas/LabResultsMetadata"},"results":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/BiomarkerResult"}},{"type":"object","additionalProperties":true}],"x-mockingbird-volatile":{"kind":"opaque"}},"missing_results":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/MissingBiomarkerResult"}},{"type":"null"}],"x-mockingbird-volatile":{"kind":"opaque"}},"sample_information":{"anyOf":[{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SampleData"}},{"type":"null"}],"x-mockingbird-volatile":{"kind":"opaque"}},"order_transaction":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingOrderTransaction"},{"type":"null"}]}}},"SimulationFlags":{"type":"object","properties":{"interpretation":{"anyOf":[{"type":"string","enum":["normal","abnormal","critical","unknown"]},{"type":"null"}]},"result_types":{"type":"array","items":{"$ref":"#/components/schemas/ResultType"}},"has_missing_results":{"type":"boolean"}}},"GetOrdersResponse":{"type":"object","required":["orders"],"properties":{"orders":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingOrder"}},"total":{"anyOf":[{"type":"integer"},{"type":"null"}]},"page":{"anyOf":[{"type":"integer"},{"type":"null"}]},"size":{"anyOf":[{"type":"integer"},{"type":"null"}]}}},"HTTPValidationError":{"type":"object","properties":{"detail":{"title":"Detail"}}}}}}`);
9064
+ var document2 = JSON.parse(`{"openapi":"3.1.0","info":{"title":"Junction API (Mockingbird subset)","description":"Stateful mock subset of the Junction (Vital) API.\\nDocs: https://docs.junction.com/\\nAuth: https://docs.junction.com/api-details/junction-api\\nCreate user: https://docs.junction.com/api-reference/user/create-user\\nGet user: https://docs.junction.com/api-reference/user/get-user\\nDelete user: https://docs.junction.com/api-reference/user/delete-user\\nResolve user: https://docs.junction.com/api-reference/user/resolve-user\\nUpdate user: https://docs.junction.com/api-reference/user/patch-user\\nGet users: https://docs.junction.com/api-reference/user/get-users\\nCreate order: https://docs.junction.com/api-reference/lab-testing/create-order\\nGet order: https://docs.junction.com/api-reference/lab-testing/get-order\\nGet orders: https://docs.junction.com/api-reference/lab-testing/get-orders\\nGet order transaction: https://docs.junction.com/api-reference/lab-testing/order-transactions/get-order-transaction\\nGet order transaction result: https://docs.junction.com/api-reference/lab-testing/results/get-order-transaction-results\\nLab tests: https://docs.junction.com/api-reference/lab-testing/tests-paginated\\nLab tests (deprecated, unpaged): https://docs.junction.com/api-reference/lab-testing/tests/get-lab-tests\\nAppointment availability: https://docs.junction.com/api-reference/lab-testing/appointments/get-appointment-availability\\nBook appointment: https://docs.junction.com/api-reference/lab-testing/appointments/book-appointment\\nGet appointment: https://docs.junction.com/api-reference/lab-testing/appointments/get-appointment\\nReschedule appointment: https://docs.junction.com/api-reference/lab-testing/appointments/reschedule-appointment\\nCancel appointment: https://docs.junction.com/api-reference/lab-testing/appointments/cancel-appointment\\nAppointment cancellation reasons: https://docs.junction.com/api-reference/lab-testing/appointments/get-appointment-cancellation-reasons\\nArea info: https://docs.junction.com/api-reference/lab-testing/service-areas/get-area-info\\nPSC info: https://docs.junction.com/api-reference/lab-testing/service-areas/get-psc-info\\nLab locations: https://docs.junction.com/api-reference/lab-testing/service-areas/get-lab-locations\\nRaw results: https://docs.junction.com/api-reference/lab-testing/results/get-lab-results\\nResult metadata: https://docs.junction.com/api-reference/lab-testing/results/get-lab-results-metadata\\nResult PDF: https://docs.junction.com/api-reference/lab-testing/results/get-lab-result-pdf\\nRequisition form PDF: https://docs.junction.com/api-reference/lab-testing/orders/get-requisition-form\\nList labs: https://docs.junction.com/api-reference/lab-testing/tests/get-labs\\nTest markers: https://docs.junction.com/api-reference/lab-testing/tests/get-markers-for-lab-test\\nOrder-set markers: https://docs.junction.com/api-reference/lab-testing/results/get-order-set-markers\\nLatest user info: https://docs.junction.com/api-reference/user/get-latest-user-info\\n","version":"0.4.758","x-mockingbird-upstream":{"docs":"https://docs.junction.com/","note":"Hand-authored subset from Junction public OpenAPI snippets in the docs."}},"servers":[{"url":"https://api.sandbox.us.junction.com"}],"security":[{"apiKeyAuth":[]}],"paths":{"/v2/user":{"post":{"operationId":"create_user_v2_user_post","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCreateBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingUser"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientUserIDConflictResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"operationId":"get_teams_users_v2_user_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedUsersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/v2/user/{user_id}":{"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_user_v2_user__user_id__get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingUser"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"operationId":"delete_user_v2_user__user_id__delete","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSuccessResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"operationId":"patch_user_v2_user__user_id__patch","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPatchBody"}}}},"responses":{"204":{"description":"Successful Response"},"400":{"description":"Nothing to patch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/user/resolve/{client_user_id}":{"parameters":[{"name":"client_user_id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"get":{"operationId":"get_user_by_client_user_id_v2_user_resolve__client_user_id__get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingUser"},{"$ref":"#/components/schemas/PaginatedUsersResponse"}]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/user/{user_id}/info":{"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user","missing":"00000000-0000-4000-8000-000000000000"}}}],"patch":{"operationId":"patch_user_info_v2_user__user_id__info_patch","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfoPatchBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfo"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/user/{user_id}/info/latest":{"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_latest_user_info_user_v2_user__user_id__info_latest_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfo"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/lab_test":{"get":{"operationId":"get_paginated_lab_tests_for_team_v3_lab_test_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabTestResourcesResponse"}}}}}}},"/v3/lab_test/lab_account":{"get":{"operationId":"get_team_lab_accounts_v3_lab_test_lab_account_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"lab-account inventory is fixture-owned; the mock models the documented shape, filters and routing rules, not a live account inventory"}},"parameters":[{"name":"lab_account_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/LabAccountStatus"},{"type":"null"}]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetTeamLabAccountsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/lab_tests":{"get":{"operationId":"get_lab_tests_for_team_v3_lab_tests_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"summary":"Get Lab Tests For Team","description":"GET all the lab tests the team has access to.","deprecated":true,"parameters":[{"name":"generation_method","in":"query","required":false,"schema":{"$ref":"#/components/schemas/LabTestGenerationMethodFilter","description":"Filter on whether auto-generated lab tests created by Vital, manually created lab tests, or all lab tests should be returned.","default":"manual"},"description":"Filter on whether auto-generated lab tests created by Vital, manually created lab tests, or all lab tests should be returned."},{"name":"lab_slug","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by the slug of the lab for these lab tests.","title":"Lab Slug"},"description":"Filter by the slug of the lab for these lab tests."},{"name":"collection_method","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/LabTestCollectionMethod"},{"type":"null"}],"description":"Filter by the collection method for these lab tests.","title":"Collection Method"},"description":"Filter by the collection method for these lab tests."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/LabTestStatus"},{"type":"null"}],"description":"Filter by the status of these lab tests.","title":"Status"},"description":"Filter by the status of these lab tests."},{"name":"marker_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"description":"Filter to only include lab tests containing these marker IDs.","title":"Marker Ids"},"description":"Filter to only include lab tests containing these marker IDs."},{"name":"provider_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Filter to only include lab tests containing these provider IDs.","title":"Provider Ids"},"description":"Filter to only include lab tests containing these provider IDs."},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by the name of the lab test (a case-insensitive substring search).","title":"Name"},"description":"Filter by the name of the lab test (a case-insensitive substring search)."},{"name":"order_key","in":"query","required":false,"schema":{"anyOf":[{"enum":["price","created_at","updated_at"],"type":"string"},{"type":"null"}],"title":"Order Key"}},{"name":"order_direction","in":"query","required":false,"schema":{"enum":["asc","desc"],"type":"string","default":"asc","title":"Order Direction"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingLabTest"},"title":"Response Get Lab Tests For Team V3 Lab Tests Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/lab_tests/{lab_test_id}":{"parameters":[{"name":"lab_test_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"lab_test","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_lab_test_for_team_v3_lab_tests__lab_test_id__get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingLabTest"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/lab_tests/labs":{"get":{"operationId":"get_labs_v3_lab_tests_labs_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingLab"}}}}}}}},"/v3/lab_tests/{lab_test_id}/markers":{"parameters":[{"name":"lab_test_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"lab_test","missing":"00000000-0000-4000-8000-000000000000"}}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"provider_id","in":"query","required":false,"schema":{"type":"string"}}],"get":{"operationId":"get_markers_for_lab_test_v3_lab_tests__lab_test_id__markers_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetMarkersResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/lab_tests/list_order_set_markers":{"post":{"operationId":"list_order_set_markers_v3_lab_tests_list_order_set_markers_post","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOrderSetMarkersRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetMarkersResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order":{"post":{"operationId":"create_order_v3_order_post","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostOrderResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"description":"Internal Server Error"}}}},"/v3/order/area/info":{"get":{"operationId":"get_area_info_v3_order_area_info_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"central_labs presence, within_radius counts and getlabs market coverage are provider-owned geo data that a mock cannot replicate per-zip; covered by the client-parity scenario shape checks instead"}},"parameters":[{"name":"zip_code","in":"query","required":true,"schema":{"type":"string","pattern":"^\\\\d{5}(?:-?\\\\d{4})?$"}},{"name":"radius","in":"query","required":false,"schema":{"$ref":"#/components/schemas/AllowedRadius"}},{"name":"lab_account_id","in":"query","required":false,"description":"Lab Account ID to use for availability checks","schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AreaInfo"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/psc/info":{"get":{"operationId":"get_psc_info_v3_order_psc_info_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"patient_service_centers are real site inventories per zip (thousands of sites, result-capped at 30) that a fixture mock cannot replicate per-zip; covered by the client-parity scenario shape checks instead"}},"parameters":[{"name":"zip_code","in":"query","required":true,"schema":{"type":"string","pattern":"^\\\\d{5}$"}},{"name":"lab_id","in":"query","required":true,"schema":{"type":"integer"}},{"name":"radius","in":"query","required":false,"schema":{"$ref":"#/components/schemas/AllowedRadius"}},{"name":"capabilities","in":"query","required":false,"schema":{"type":"array","items":{"$ref":"#/components/schemas/LabLocationCapability"}}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PscInfo"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/phlebotomy/appointment/availability":{"post":{"operationId":"get_phlebotomy_appointment_availability_v3_order_phlebotomy_appointment_availability_post","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"availability slots are provider-side data whose values shift between sandbox calls; covered by the mock-internal scheduling property suite instead"}},"parameters":[{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsAddress"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentAvailabilitySlots"}}}},"400":{"description":"Availability not bookable for this address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No availability found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/phlebotomy/appointment/cancellation-reasons":{"get":{"operationId":"get_phlebotomy_appointment_cancellation_reason_v3_order_phlebotomy_appointment_cancellation_reasons_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingAppointmentCancellationReason"}}}}}}}},"/v3/order/psc/appointment/availability":{"post":{"operationId":"get_psc_appointment_availability_v3_order_psc_appointment_availability_post","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"availability slots are provider-side data whose values shift between sandbox calls; covered by the mock-internal scheduling property suite instead"}},"parameters":[{"name":"lab","in":"query","required":true,"schema":{"$ref":"#/components/schemas/AppointmentPscLabs"}},{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"site_codes","in":"query","required":false,"schema":{"type":"string","description":"JSON-encoded array of site codes"}},{"name":"zip_code","in":"query","required":false,"schema":{"type":"string"}},{"name":"radius","in":"query","required":false,"schema":{"$ref":"#/components/schemas/AllowedRadius"}},{"name":"allow_stale","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentAvailabilitySlots"}}}},"400":{"description":"Availability not bookable for this address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No slots found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/psc/appointment/cancellation-reasons":{"get":{"operationId":"get_psc_appointment_cancellation_reason_v3_order_psc_appointment_cancellation_reasons_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingAppointmentCancellationReason"}}}}}}}},"/v3/order/{order_id}/phlebotomy/appointment":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"appointment payloads embed provider-side slot data; covered by the mock-internal scheduling property suite instead"}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/phlebotomy/appointment/book":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"post":{"operationId":"book_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_book_post","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"booking depends on live provider slot state; covered by the mock-internal scheduling property suite instead"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentBookingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Booking failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/phlebotomy/appointment/reschedule":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"patch":{"operationId":"reschedule_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_reschedule_patch","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"rescheduling depends on live provider slot state; covered by the mock-internal scheduling property suite instead"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentRescheduleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Invalid or expired booking key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/phlebotomy/appointment/cancel":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"patch":{"operationId":"cancel_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_cancel_patch","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"cancellation depends on live provider appointment state; covered by the mock-internal scheduling property suite instead"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhlebotomyAppointmentCancelRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Invalid cancellation reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/psc/appointment":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_psc_appointment_v3_order__order_id__psc_appointment_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"appointment payloads embed provider-side slot data; covered by the mock-internal scheduling property suite instead"}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/psc/appointment/book":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"post":{"operationId":"book_psc_appointment_v3_order__order_id__psc_appointment_book_post","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"booking depends on live provider slot state; covered by the mock-internal scheduling property suite instead"}},"parameters":[{"name":"x-idempotency-key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PscAppointmentBookingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Booking failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/psc/appointment/reschedule":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"patch":{"operationId":"reschedule_psc_appointment_v3_order__order_id__psc_appointment_reschedule_patch","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"rescheduling depends on live provider slot state; covered by the mock-internal scheduling property suite instead"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentRescheduleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Invalid or expired booking key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/psc/appointment/cancel":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"patch":{"operationId":"cancel_psc_appointment_v3_order__order_id__psc_appointment_cancel_patch","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"cancellation depends on live provider appointment state; covered by the mock-internal scheduling property suite instead"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PscAppointmentCancelRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingAppointment"}}}},"400":{"description":"Invalid cancellation reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"No appointment for this order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_order_v3_order__order_id__get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientFacingOrder"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/cancel":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"post":{"operationId":"cancel_order_v3_order__order_id__cancel_post","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostOrderResponse"}}}},"400":{"description":"Order is not in a cancellable status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/test":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"post":{"operationId":"simulate_order_v3_order__order_id__test_post","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"final_status","in":"query","required":true,"schema":{"type":"string","enum":["received.walk_in_test.ordered","received.walk_in_test.requisition_created","received.walk_in_test.requisition_bypassed","completed.walk_in_test.completed","sample_with_lab.walk_in_test.partial_results","failed.walk_in_test.sample_error","cancelled.walk_in_test.cancelled","collecting_sample.walk_in_test.appointment_pending","collecting_sample.walk_in_test.appointment_scheduled","collecting_sample.walk_in_test.appointment_cancelled","collecting_sample.walk_in_test.redraw_available","received.at_home_phlebotomy.ordered","received.at_home_phlebotomy.requisition_created","received.at_home_phlebotomy.requisition_bypassed","collecting_sample.at_home_phlebotomy.appointment_pending","collecting_sample.at_home_phlebotomy.appointment_scheduled","collecting_sample.at_home_phlebotomy.draw_completed","collecting_sample.at_home_phlebotomy.appointment_cancelled","completed.at_home_phlebotomy.completed","sample_with_lab.at_home_phlebotomy.partial_results","cancelled.at_home_phlebotomy.cancelled","failed.at_home_phlebotomy.sample_error","received.testkit.ordered","received.testkit.awaiting_registration","received.testkit.requisition_created","received.testkit.requisition_bypassed","received.testkit.registered","collecting_sample.testkit.transit_customer","collecting_sample.testkit.out_for_delivery","collecting_sample.testkit.with_customer","collecting_sample.testkit.transit_lab","sample_with_lab.testkit.delivered_to_lab","sample_with_lab.testkit.lab_processing_blocked","completed.testkit.completed","failed.testkit.failure_to_deliver_to_customer","failed.testkit.failure_to_deliver_to_lab","failed.testkit.sample_error","failed.testkit.lost","cancelled.testkit.cancelled","cancelled.testkit.do_not_process","collecting_sample.testkit.problem_in_transit_customer","collecting_sample.testkit.problem_in_transit_lab","received.on_site_collection.ordered","received.on_site_collection.requisition_created","received.on_site_collection.requisition_bypassed","sample_with_lab.on_site_collection.draw_completed","completed.on_site_collection.completed","cancelled.on_site_collection.cancelled","sample_with_lab.on_site_collection.partial_results","failed.on_site_collection.sample_error","completed.walk_in_test.corrected","completed.at_home_phlebotomy.corrected","completed.on_site_collection.corrected","completed.testkit.corrected"]}},{"name":"delay","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Seconds to defer the status transition"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimulationFlags"}}}},"responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string","examples":["Success"]}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/result":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_result_raw_v3_order__order_id__result_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"results carry provider-side specimen data; covered by the mock-internal results property suite instead"}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabResultsRaw"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/result/metadata":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_result_metadata_v3_order__order_id__result_metadata_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabResultsMetadata"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/result/pdf":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_result_pdf_v3_order__order_id__result_pdf_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"PDF bytes are provider-rendered; compared by shape (byteLength) only in the scenario script"}},"responses":{"200":{"description":"Successful Response","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order/{order_id}/requisition/pdf":{"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_order_requisition_pdf_v3_order__order_id__requisition_pdf_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"PDF bytes are provider-rendered; compared by shape (byteLength) only in the scenario script"}},"responses":{"200":{"description":"Successful Response","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/orders":{"get":{"operationId":"get_orders_v3_orders_get","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user","missing":"00000000-0000-4000-8000-000000000000"}}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetOrdersResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order_transaction/{transaction_id}":{"parameters":[{"name":"transaction_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order_transaction","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_order_transaction_v3_order_transaction__transaction_id__get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"order transactions are not available to the sandbox team (feature not available)"}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetOrderTransactionResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/order_transaction/{transaction_id}/result":{"parameters":[{"name":"transaction_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order_transaction","missing":"00000000-0000-4000-8000-000000000000"}}}],"get":{"operationId":"get_order_transaction_result_v3_order_transaction__transaction_id__result_get","x-mockingbird":{"supported":true,"parity":{"enabled":false,"safe":true,"reason":"lab results are not available to the sandbox team (feature not available)"}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabResultsRaw"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"x-vital-api-key"}},"schemas":{"UserCreateBody":{"type":"object","required":["client_user_id"],"properties":{"client_user_id":{"type":"string","minLength":1,"maxLength":64,"examples":["mbr_8891","patient-1042","user.profile_52"]},"fallback_time_zone":{"type":["string","null"],"enum":["America/Los_Angeles","America/New_York","Europe/London","UTC",null]}}},"ClientFacingUser":{"type":"object","required":["user_id","team_id","client_user_id","created_on","connected_sources","fallback_time_zone"],"properties":{"user_id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"user","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"team_id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"account"}},"client_user_id":{"type":"string"},"created_on":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"connected_sources":{"type":"array","items":{"type":"object","additionalProperties":true}},"fallback_time_zone":{"type":["object","null"],"properties":{"id":{"type":"string"},"source_slug":{"type":"string"},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}},"fallback_birth_date":{"type":["object","null"],"properties":{"value":{"type":"string"},"source_slug":{"type":"string"},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}},"ingestion_start":{"type":["string","null"]},"ingestion_end":{"type":["string","null"]}}},"UserInfoPatchBody":{"type":"object","properties":{"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"dob":{"type":["string","null"]},"gender":{"type":["string","null"]},"phone_number":{"type":["string","null"]},"email":{"type":["string","null"]},"address":{"type":["object","null"],"additionalProperties":true}}},"UserInfo":{"type":"object","additionalProperties":true},"ClientUserIDConflictResponse":{"type":"object","required":["detail"],"properties":{"detail":{"type":"object","required":["error_type","error_message","user_id","created_on"],"properties":{"error_type":{"type":"string"},"error_message":{"type":"string"},"user_id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"id"}},"created_on":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}}}},"UserSuccessResponse":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean"}}},"PaginatedUsersResponse":{"type":"object","required":["users","total","offset","limit"],"properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingUser"}},"total":{"type":"integer"},"offset":{"type":"integer"},"limit":{"type":"integer"}}},"UserPatchBody":{"type":"object","properties":{"fallback_time_zone":{"type":["string","null"]},"fallback_birth_date":{"type":["string","null"],"format":"date"},"ingestion_start":{"type":["string","null"],"format":"date"},"ingestion_end":{"type":["string","null"],"format":"date"},"client_user_id":{"type":["string","null"]}}},"LabTestCollectionMethod":{"type":"string","enum":["testkit","walk_in_test","at_home_phlebotomy","on_site_collection"]},"LabTestGenerationMethodFilter":{"type":"string","enum":["auto","manual","all"]},"LabTestSampleType":{"type":"string","enum":["dried_blood_spot","arm_collector","serum","saliva","urine","stool"]},"LabTestStatus":{"type":"string","enum":["active","pending_approval","inactive"]},"MarkerType":{"type":"string","enum":["biomarker","panel"]},"ClientFacingLab":{"type":"object","required":["id","slug","name","first_line_address","city","zipcode","collection_methods","sample_types"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"id"}},"slug":{"type":"string"},"name":{"type":"string"},"first_line_address":{"type":"string"},"city":{"type":"string"},"zipcode":{"type":"string"},"collection_methods":{"type":"array","items":{"$ref":"#/components/schemas/LabTestCollectionMethod"}},"sample_types":{"type":"array","items":{"$ref":"#/components/schemas/LabTestSampleType"}},"logo_url":{"type":["string","null"]}}},"ClientFacingMarker":{"type":"object","required":["id","name","slug"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"lab_id":{"type":["integer","null"]},"provider_id":{"type":["string","null"]},"type":{"anyOf":[{"$ref":"#/components/schemas/MarkerType"},{"type":"null"}]},"unit":{"type":["string","null"]},"price":{"type":["string","null"]},"aoe":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]},"a_la_carte_enabled":{"type":"boolean","default":false},"common_tat_days":{"type":["integer","null"]},"worst_case_tat_days":{"type":["integer","null"]},"is_orderable":{"type":["boolean","null"],"default":true}}},"ClientFacingLabTest":{"type":"object","required":["id","slug","name","sample_type","method","price","is_active","status","lab","markers"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"lab_test","identity":true}},"slug":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"name":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"sample_type":{"$ref":"#/components/schemas/LabTestSampleType"},"method":{"$ref":"#/components/schemas/LabTestCollectionMethod"},"price":{"type":"number"},"is_active":{"type":"boolean"},"status":{"$ref":"#/components/schemas/LabTestStatus"},"fasting":{"type":"boolean","default":false},"lab":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingLab"},{"type":"null"}]},"markers":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingMarker"}},{"type":"null"}]},"is_delegated":{"type":"boolean","default":false},"auto_generated":{"type":"boolean","default":false},"has_collection_instructions":{"type":["boolean","null"]},"common_tat_days":{"type":["integer","null"]},"worst_case_tat_days":{"type":["integer","null"]}}},"LabTestResourcesResponse":{"type":"object","required":["data","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingLabTest"}},"next_cursor":{"type":["string","null"]}}},"LabAccountStatus":{"type":"string","enum":["active","pending","suspended","ready_to_launch"]},"LabAccountDelegatedFlow":{"type":"string","enum":["order_delegated","result_delegated","fully_delegated","not_delegated"]},"USState":{"type":"string","enum":["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"]},"Labs":{"type":"string","enum":["ayumetrix","spiriplex","ussl","quest","sonora_quest","labcorp","bioreference","us_biotek","manual","sanocardio","ihd","nexus","my_uti","crl","mtl"]},"ClientFacingLabAccount":{"type":"object","required":["id","lab","status","delegated_flow","provider_account_id","allowed_billing","team_id_allowlist"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"lab_account","identity":true}},"lab":{"$ref":"#/components/schemas/Labs"},"org_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"status":{"$ref":"#/components/schemas/LabAccountStatus"},"delegated_flow":{"$ref":"#/components/schemas/LabAccountDelegatedFlow"},"provider_account_id":{"type":"string"},"account_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"default_clinical_notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"business_units":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"allowed_billing":{"type":"object","propertyNames":{"$ref":"#/components/schemas/Billing"},"additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/USState"}}},"team_id_allowlist":{"type":"array","items":{"type":"string","format":"uuid"}}}},"GetTeamLabAccountsResponse":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingLabAccount"}}}},"ClientFacingResult":{"type":"object","required":["name","slug","type"],"properties":{"name":{"type":"string"},"slug":{"type":"string"},"provider_id":{"type":["string","null"]},"type":{"$ref":"#/components/schemas/ResultType"},"value":{"type":["number","null"]},"unit":{"type":["string","null"]},"low_value":{"type":["number","null"]},"high_value":{"type":["number","null"]},"string_value":{"type":["string","null"]},"coded_value":{"type":["string","null"]},"is_abnormal":{"type":"boolean","default":false},"notes":{"type":["string","null"]}}},"GetMarkersResponse":{"type":"object","required":["markers"],"properties":{"markers":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingMarkerComplete"}},"total":{"type":["integer","null"]},"page":{"type":["integer","null"]},"size":{"type":["integer","null"]},"pages":{"type":["integer","null"]}}},"ClientFacingExpectedResult":{"type":"object","required":["id","name","slug","required"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"slug":{"type":"string"},"lab_id":{"type":["integer","null"]},"provider_id":{"type":["string","null"]},"required":{"type":"boolean"},"loinc":{"type":["object","null"],"required":["id","name","slug","code"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"slug":{"type":"string"},"code":{"type":"string"},"unit":{"type":["string","null"]}}}}},"ClientFacingMarkerComplete":{"type":"object","required":["id","name","slug","expected_results"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"lab_id":{"type":["integer","null"]},"provider_id":{"type":["string","null"]},"type":{"anyOf":[{"$ref":"#/components/schemas/MarkerType"},{"type":"null"}]},"unit":{"type":["string","null"]},"price":{"type":["string","null"]},"a_la_carte_enabled":{"type":"boolean","default":false},"common_tat_days":{"type":["integer","null"]},"worst_case_tat_days":{"type":["integer","null"]},"is_orderable":{"type":["boolean","null"],"default":true},"expected_results":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingExpectedResult"}}}},"ListOrderSetMarkersRequest":{"type":"object","required":["order_set_id"],"properties":{"order_set_id":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order_transaction","missing":"00000000-0000-4000-8000-000000000000"}},"provider_id":{"type":["string","null"]}}},"AllowedRadius":{"type":"integer","enum":[10,20,25,50,100]},"AppointmentPscLabs":{"type":"string","enum":["quest"]},"AppointmentProvider":{"type":"string","enum":["getlabs","phlebfinders","quest"]},"AppointmentType":{"type":"string","enum":["phlebotomy","patient_service_center"]},"AppointmentStatus":{"type":"string","enum":["confirmed","pending","reserved","in_progress","completed","cancelled"]},"AppointmentEventStatus":{"type":"string","enum":["pending","reserved","scheduled","completed","cancelled","in_progress"]},"AppointmentServiceType":{"type":"string","enum":["appointment-ready","appointment-request"]},"Billing":{"type":"string","enum":["client_bill","commercial_insurance","patient_bill_passthrough","patient_bill"]},"LabLocationCapability":{"type":"string","enum":["stat","appointment_scheduling_via_junction","appointment_scheduling_with_lab"]},"LngLat":{"type":"object","required":["lng","lat"],"properties":{"lng":{"type":"number"},"lat":{"type":"number"}}},"UsAddress":{"type":"object","required":["first_line","city","state","zip_code"],"properties":{"first_line":{"type":"string","minLength":1},"second_line":{"type":["string","null"]},"city":{"type":"string","minLength":1},"state":{"type":"string","minLength":1},"zip_code":{"type":"string","minLength":1},"unit":{"type":["string","null"]}}},"AppointmentLocation":{"type":"object","required":["location","address","code","name"],"properties":{"location":{"$ref":"#/components/schemas/LngLat"},"distance":{"type":["number","null"]},"address":{"$ref":"#/components/schemas/UsAddress"},"code":{"type":"string"},"name":{"type":"string"},"iana_timezone":{"type":["string","null"]}}},"TimeSlot":{"type":"object","required":["start","end","price","is_priority","num_appointments_available"],"properties":{"booking_key":{"type":["string","null"],"x-mockingbird-resource":{"type":"booking_key","identity":true},"x-mockingbird-volatile":{"kind":"token"}},"start":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"end":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"expires_at":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"timestamp"}},"price":{"type":"number"},"is_priority":{"type":"boolean"},"num_appointments_available":{"type":"integer"}}},"DaySlots":{"type":"object","required":["date","slots"],"properties":{"location":{"anyOf":[{"$ref":"#/components/schemas/AppointmentLocation"},{"type":"null"}]},"date":{"type":"string","format":"date"},"slots":{"type":"array","items":{"$ref":"#/components/schemas/TimeSlot"}}}},"AppointmentAvailabilitySlots":{"type":"object","required":["slots"],"properties":{"slots":{"type":"array","items":{"$ref":"#/components/schemas/DaySlots"}},"timezone":{"type":["string","null"]}}},"AppointmentBookingRequest":{"type":"object","required":["booking_key"],"properties":{"booking_key":{"type":"string","minLength":1,"x-mockingbird-resource-ref":{"type":"booking_key"}}}},"AppointmentRescheduleRequest":{"type":"object","required":["booking_key"],"properties":{"booking_key":{"type":"string","minLength":1,"x-mockingbird-resource-ref":{"type":"booking_key"}}}},"PscAppointmentBookingRequest":{"type":"object","required":["booking_key","site_code"],"properties":{"booking_key":{"type":"string","minLength":1,"x-mockingbird-resource-ref":{"type":"booking_key"}},"site_code":{"type":"string","minLength":1}}},"PhlebotomyAppointmentCancelRequest":{"type":"object","required":["cancellation_reason_id"],"properties":{"cancellation_reason_id":{"type":"string","minLength":1},"notes":{"type":["string","null"]}}},"PscAppointmentCancelRequest":{"type":"object","required":["cancellationReasonId"],"properties":{"cancellationReasonId":{"type":"string","minLength":1},"note":{"type":["string","null"]}}},"ClientFacingAppointmentEvent":{"type":"object","required":["created_at","status"],"properties":{"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"status":{"$ref":"#/components/schemas/AppointmentEventStatus"},"data":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]}}},"ClientFacingAppointment":{"type":"object","required":["id","user_id","order_id","address","location","type","provider","status","provider_id","can_reschedule","event_status","events"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"appointment","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"user_id":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user"}},"order_id":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"order"}},"address":{"$ref":"#/components/schemas/UsAddress"},"location":{"$ref":"#/components/schemas/LngLat"},"start_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"end_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"iana_timezone":{"type":["string","null"]},"type":{"$ref":"#/components/schemas/AppointmentType"},"provider":{"$ref":"#/components/schemas/AppointmentProvider"},"status":{"$ref":"#/components/schemas/AppointmentStatus"},"provider_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"external_id":{"type":["string","null"],"x-mockingbird-volatile":{"kind":"id"}},"can_reschedule":{"type":"boolean"},"event_status":{"$ref":"#/components/schemas/AppointmentEventStatus"},"event_data":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]},"order_transaction_id":{"type":["string","null"],"x-mockingbird-resource-ref":{"type":"order_transaction"}},"appointment_notes":{"type":["string","null"]},"events":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingAppointmentEvent"}}}},"ClientFacingAppointmentCancellationReason":{"type":"object","required":["id","name","is_refundable"],"properties":{"id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"name":{"type":"string"},"is_refundable":{"type":"boolean"}}},"PhlebotomyAreaInfo":{"type":"object","required":["is_served","providers"],"properties":{"is_served":{"type":"boolean"},"providers":{"type":"array","items":{"$ref":"#/components/schemas/PhlebotomyProviderInfo"}}}},"PhlebotomyProviderInfo":{"type":"object","required":["name","service_types"],"properties":{"name":{"$ref":"#/components/schemas/AppointmentProvider"},"service_types":{"type":"array","items":{"$ref":"#/components/schemas/AppointmentServiceType"}}}},"PscAreaInfoDetails":{"type":"object","required":["appointment_with_vital","within_radius","radius"],"properties":{"appointment_with_vital":{"type":"boolean"},"within_radius":{"type":"number"},"radius":{"type":"string"},"capabilities":{"type":["array","null"],"items":{"$ref":"#/components/schemas/LabLocationCapability"}}}},"PscAreaInfo":{"type":"object","required":["patient_service_centers","supported_bill_types","lab_id"],"properties":{"patient_service_centers":{"$ref":"#/components/schemas/PscAreaInfoDetails"},"supported_bill_types":{"type":"array","items":{"$ref":"#/components/schemas/Billing"}},"lab_id":{"type":"integer"}}},"AreaInfo":{"type":"object","required":["zip_code","phlebotomy","central_labs"],"properties":{"zip_code":{"type":"string"},"phlebotomy":{"$ref":"#/components/schemas/PhlebotomyAreaInfo"},"central_labs":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/PscAreaInfo"}}}},"LabLocationMetadata":{"type":"object","required":["name","state","city","zip_code","first_line"],"properties":{"name":{"type":"string"},"state":{"type":"string"},"city":{"type":"string"},"zip_code":{"type":"string"},"first_line":{"type":"string"},"second_line":{"type":["string","null"]},"phone_number":{"type":["string","null"]},"fax_number":{"type":["string","null"]},"hours":{"type":["object","null"],"additionalProperties":true}}},"ClientFacingLabLocation":{"type":"object","required":["metadata","distance","site_code","supported_bill_types","location","capabilities"],"properties":{"metadata":{"$ref":"#/components/schemas/LabLocationMetadata"},"distance":{"type":"number"},"site_code":{"type":"string"},"supported_bill_types":{"type":"array","items":{"$ref":"#/components/schemas/Billing"}},"location":{"$ref":"#/components/schemas/LngLat"},"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/LabLocationCapability"}}}},"PscInfo":{"type":"object","required":["lab_id","slug","patient_service_centers"],"properties":{"lab_id":{"type":"integer"},"slug":{"type":"string"},"patient_service_centers":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingLabLocation"}}}},"OrderTopLevelStatus":{"type":"string","enum":["received","collecting_sample","sample_with_lab","completed","cancelled","failed"]},"OrderLowLevelStatus":{"type":"string","enum":["ordered","requisition_created","requisition_bypassed","transit_customer","out_for_delivery","with_customer","transit_lab","delivered_to_lab","completed","failure_to_deliver_to_lab","failure_to_deliver_to_customer","problem_in_transit_lab","problem_in_transit_customer","sample_error","appointment_scheduled","appointment_cancelled","appointment_pending","draw_completed","cancelled","lost","do_not_process","partial_results","awaiting_registration","registered","redraw_available","corrected","lab_processing_blocked"]},"OrderStatus":{"type":"string","enum":["received.walk_in_test.ordered","received.walk_in_test.requisition_created","received.walk_in_test.requisition_bypassed","completed.walk_in_test.completed","sample_with_lab.walk_in_test.partial_results","failed.walk_in_test.sample_error","cancelled.walk_in_test.cancelled","collecting_sample.walk_in_test.appointment_pending","collecting_sample.walk_in_test.appointment_scheduled","collecting_sample.walk_in_test.appointment_cancelled","collecting_sample.walk_in_test.redraw_available","received.at_home_phlebotomy.ordered","received.at_home_phlebotomy.requisition_created","received.at_home_phlebotomy.requisition_bypassed","collecting_sample.at_home_phlebotomy.appointment_pending","collecting_sample.at_home_phlebotomy.appointment_scheduled","collecting_sample.at_home_phlebotomy.draw_completed","collecting_sample.at_home_phlebotomy.appointment_cancelled","completed.at_home_phlebotomy.completed","sample_with_lab.at_home_phlebotomy.partial_results","cancelled.at_home_phlebotomy.cancelled","failed.at_home_phlebotomy.sample_error","received.testkit.ordered","received.testkit.awaiting_registration","received.testkit.requisition_created","received.testkit.requisition_bypassed","received.testkit.registered","collecting_sample.testkit.transit_customer","collecting_sample.testkit.out_for_delivery","collecting_sample.testkit.with_customer","collecting_sample.testkit.transit_lab","sample_with_lab.testkit.delivered_to_lab","sample_with_lab.testkit.lab_processing_blocked","completed.testkit.completed","failed.testkit.failure_to_deliver_to_customer","failed.testkit.failure_to_deliver_to_lab","failed.testkit.sample_error","failed.testkit.lost","cancelled.testkit.cancelled","cancelled.testkit.do_not_process","collecting_sample.testkit.problem_in_transit_customer","collecting_sample.testkit.problem_in_transit_lab","received.on_site_collection.ordered","received.on_site_collection.requisition_created","received.on_site_collection.requisition_bypassed","sample_with_lab.on_site_collection.draw_completed","completed.on_site_collection.completed","cancelled.on_site_collection.cancelled","sample_with_lab.on_site_collection.partial_results","failed.on_site_collection.sample_error","completed.walk_in_test.corrected","completed.at_home_phlebotomy.corrected","completed.on_site_collection.corrected","completed.testkit.corrected"]},"OrderStatusDetail":{"type":"string","enum":["fulfillment_error","date_of_collection_unspecified","demographic_information_unspecified","demographic_information_mismatch","sample_quantity_not_sufficient","sample_contaminated","sample_stability_exceeded","sample_hemolyzed","sample_improper_collection"]},"OrderTransactionStatus":{"type":"string","enum":["active","completed","cancelled"]},"ClientFacingOrderEvent":{"type":"object","required":["id","created_at","status"],"properties":{"id":{"type":"integer","x-mockingbird-volatile":{"kind":"opaque"}},"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"status":{"$ref":"#/components/schemas/OrderStatus"},"status_detail":{"anyOf":[{"$ref":"#/components/schemas/OrderStatusDetail"},{"type":"null"}]}}},"ShippingAddress":{"type":"object","required":["receiver_name","first_line","city","state","zip","country","phone_number"],"properties":{"receiver_name":{"type":"string"},"first_line":{"type":"string"},"second_line":{"type":["string","null"]},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"},"country":{"type":"string"},"phone_number":{"type":"string"}}},"ClientFacingPhysician":{"type":"object","required":["first_name","last_name","npi"],"properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"npi":{"type":"string"}}},"ClientFacingShipment":{"type":"object","required":["id","outbound_tracking_number","outbound_tracking_url","inbound_tracking_number","inbound_tracking_url","outbound_courier","inbound_courier","notes"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"id"}},"outbound_tracking_number":{"type":["string","null"]},"outbound_tracking_url":{"type":["string","null"]},"inbound_tracking_number":{"type":["string","null"]},"inbound_tracking_url":{"type":["string","null"]},"outbound_courier":{"type":["string","null"]},"inbound_courier":{"type":["string","null"]},"notes":{"type":["string","null"]}}},"ClientFacingTestkitOrder":{"type":"object","required":["id","shipment","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"id"}},"shipment":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingShipment"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"opaque"}},"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}},"ClientFacingWalkInOrder":{"type":"object","required":["id","appointment_id","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"id"}},"appointment_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}},"ClientFacingTestKitOrderDetails":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["testkit","walk_in_test","at_home_phlebotomy","on_site_collection"]},"data":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingTestkitOrder"},{"$ref":"#/components/schemas/ClientFacingWalkInOrder"},{"type":"null"}]}}},"ClientFacingPatientDetailsCompatible":{"type":"object","required":["first_name","last_name","dob","gender","phone_number","email"],"properties":{"first_name":{"type":"string","minLength":1,"pattern":"^[a-zA-Z0-9][a-zA-Z0-9 .,'-]*$","examples":["Ada","Chris","Maria","Jun"]},"last_name":{"type":"string","minLength":1,"pattern":"^[a-zA-Z0-9][a-zA-Z0-9 .,'-]*$","examples":["Lovelace","Vouga","Delgado","Park"]},"dob":{"type":"string","format":"date-time","examples":["1990-06-15T00:00:00.000Z","1983-02-02T00:00:00.000Z"]},"gender":{"type":"string","minLength":1,"pattern":"\\\\S","examples":["male","female","other","prefer_not_to_say"]},"phone_number":{"type":"string","minLength":1,"pattern":"^\\\\+1[2-9]\\\\d{9}$","examples":["+14155550123","+12125550987","+13105554444"]},"email":{"type":"string","format":"email","minLength":1,"examples":["ada@example.com","chris@example.com","maria@example.com"]}}},"PatientAddressCompatible":{"type":"object","required":["first_line","city","state","zip","country"],"properties":{"receiver_name":{"type":"string","default":"","examples":["Ada Lovelace","Chris Vouga"]},"first_line":{"type":"string","minLength":1,"pattern":"\\\\S","examples":["1 Main St","450 Market St","88 Kearny St"]},"second_line":{"type":["string","null"]},"city":{"type":"string","minLength":1,"pattern":"\\\\S","examples":["San Diego","San Francisco","New York"]},"state":{"type":"string","minLength":1,"enum":["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"]},"zip":{"type":"string","pattern":"^\\\\d{5}(-\\\\d{4})?$","examples":["92101","94105","10001"]},"country":{"type":"string","minLength":1,"pattern":"\\\\S","examples":["US"]},"access_notes":{"type":["string","null"],"examples":[null]},"phone_number":{"type":["string","null"],"examples":["+14155550123",null]}}},"AoeAnswerRequest":{"type":"object","required":["marker_id","question_id","answer"],"properties":{"marker_id":{"type":"integer","examples":[2075,1975]},"question_id":{"type":"integer","examples":[1]},"answer":{"type":"string","minLength":1,"examples":["No","Yes"]}}},"ClientFacingOrderInTransaction":{"type":"object","required":["id","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"low_level_status":{"anyOf":[{"$ref":"#/components/schemas/OrderLowLevelStatus"},{"type":"null"}]},"low_level_status_created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}}}},"ClientFacingOrderTransaction":{"type":"object","required":["id","status","orders"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"order_transaction","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"status":{"$ref":"#/components/schemas/OrderTransactionStatus"},"orders":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingOrderInTransaction"}}}},"OrderSummary":{"type":"object","required":["id","last_status","last_status_created_at","updated_at","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"origin":{"anyOf":[{"type":"string","enum":["initial","redraw","recreation"]},{"type":"null"}]},"parent_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"last_status":{"$ref":"#/components/schemas/OrderLowLevelStatus"},"last_status_created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"GetOrderTransactionResponse":{"type":"object","required":["id","team_id","status"],"properties":{"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"order_transaction","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"team_id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"account"}},"status":{"$ref":"#/components/schemas/OrderTransactionStatus"},"orders":{"type":"array","items":{"$ref":"#/components/schemas/OrderSummary"}}}},"ClientFacingOrder":{"type":"object","required":["user_id","id","team_id","patient_details","patient_address","lab_test","details","sample_id","notes","created_at","updated_at","events","last_event","health_insurance_id","requisition_form_url","shipping_details","has_abn"],"properties":{"user_id":{"type":"string","format":"uuid"},"id":{"type":"string","format":"uuid","x-mockingbird-resource":{"type":"order","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"team_id":{"type":"string","format":"uuid","x-mockingbird-volatile":{"kind":"account"}},"patient_details":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingPatientDetailsCompatible"},{"type":"null"}]},"patient_address":{"anyOf":[{"$ref":"#/components/schemas/PatientAddressCompatible"},{"type":"null"}]},"lab_test":{"$ref":"#/components/schemas/ClientFacingLabTest"},"details":{"$ref":"#/components/schemas/ClientFacingTestKitOrderDetails"},"sample_id":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"opaque"}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"clinical_notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"updated_at":{"type":"string","format":"date-time","x-mockingbird-volatile":{"kind":"timestamp"}},"events":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingOrderEvent"}},"status":{"anyOf":[{"$ref":"#/components/schemas/OrderTopLevelStatus"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"opaque"}},"last_event":{"$ref":"#/components/schemas/ClientFacingOrderEvent"},"physician":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingPhysician"},{"type":"null"}]},"health_insurance_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"requisition_form_url":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"url"}},"priority":{"type":"boolean","default":false},"shipping_details":{"anyOf":[{"$ref":"#/components/schemas/ShippingAddress"},{"type":"null"}]},"activate_by":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"passthrough":{"anyOf":[{"type":"string"},{"type":"null"}]},"billing_type":{"type":"string","enum":["client_bill","commercial_insurance","patient_bill_passthrough","patient_bill","upfront_payment"],"default":"client_bill"},"icd_codes":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"has_abn":{"type":"boolean"},"interpretation":{"anyOf":[{"type":"string","enum":["normal","abnormal","critical","unknown"]},{"type":"null"}]},"has_missing_results":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"expected_result_by_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"worst_case_result_by_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"origin":{"anyOf":[{"type":"string","enum":["initial","redraw","recreation"]},{"type":"null"}]},"order_transaction":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingOrderTransaction"},{"type":"null"}]}}},"OrderSetRequest":{"type":"object","required":["lab_test_ids"],"properties":{"lab_test_ids":{"type":"array","minItems":1,"items":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"lab_test","missing":"00000000-0000-4000-8000-000000000000"}}}}},"CreateOrderRequest":{"type":"object","required":["user_id","patient_details","patient_address","order_set"],"properties":{"user_id":{"type":"string","format":"uuid","x-mockingbird-resource-ref":{"type":"user","missing":"00000000-0000-4000-8000-000000000000"}},"patient_details":{"$ref":"#/components/schemas/ClientFacingPatientDetailsCompatible"},"patient_address":{"$ref":"#/components/schemas/PatientAddressCompatible"},"order_set":{"$ref":"#/components/schemas/OrderSetRequest"},"clinical_notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"passthrough":{"anyOf":[{"type":"string"},{"type":"null"}]},"collection_method":{"$ref":"#/components/schemas/LabTestCollectionMethod"},"lab_account_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"idempotency_key":{"type":["string","null"]},"idempotency_error":{"type":["string","null"]},"aoe_answers":{"type":["array","null"],"items":{"$ref":"#/components/schemas/AoeAnswerRequest"}}}},"PostOrderResponse":{"type":"object","required":["order","status","message"],"properties":{"order":{"$ref":"#/components/schemas/ClientFacingOrder"},"status":{"type":"string"},"message":{"type":"string"}}},"ResultType":{"type":"string","enum":["numeric","range","comment","coded_value"]},"ParentBiomarkerData":{"type":"object","required":["marker_id","name","slug"],"properties":{"marker_id":{"type":"integer"},"name":{"type":"string"},"slug":{"type":"string"},"provider_id":{"type":["string","null"]}}},"BiomarkerResult":{"type":"object","required":["name","result","type"],"properties":{"name":{"type":"string"},"slug":{"type":"string","default":""},"value":{"anyOf":[{"type":"number"},{"type":"null"}]},"result":{"type":"string"},"type":{"$ref":"#/components/schemas/ResultType"},"unit":{"type":["string","null"]},"timestamp":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"notes":{"type":["string","null"]},"reference_range":{"type":["string","null"]},"min_range_value":{"type":["number","null"]},"max_range_value":{"type":["number","null"]},"is_above_max_range":{"type":["boolean","null"]},"is_below_min_range":{"type":["boolean","null"]},"interpretation":{"type":"string","default":"normal"},"source_interpretation":{"type":"string","default":""},"loinc":{"type":["string","null"]},"loinc_slug":{"type":["string","null"]},"provider_id":{"type":["string","null"]},"source_markers":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ParentBiomarkerData"}},{"type":"null"}]},"performing_laboratory":{"type":["string","null"]},"source_sample_id":{"type":["string","null"]}}},"FailureType":{"type":"string","enum":["quantity_not_sufficient_failure","collection_process_failure","drop_off_failure","internal_lab_failure","order_entry_failure","non_failure","unknown_failure","patient_condition_failure","missing_result_calc_failure","missing_demo_aoe_calc_failure","insufficient_volume"]},"MissingBiomarkerResult":{"type":"object","required":["name","slug","inferred_failure_type"],"properties":{"name":{"type":"string"},"slug":{"type":"string"},"inferred_failure_type":{"$ref":"#/components/schemas/FailureType"},"note":{"type":["string","null"]},"loinc":{"type":["string","null"]},"loinc_slug":{"type":["string","null"]},"provider_id":{"type":["string","null"]},"source_markers":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ParentBiomarkerData"}},{"type":"null"}]}}},"SampleData":{"type":"object","properties":{"sample_id":{"type":["string","null"]},"control_number":{"type":["string","null"]},"date_collected":{"type":["string","null"]},"date_received":{"type":["string","null"]},"date_reported":{"type":["string","null"]},"performing_laboratories":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]},"clinical_information":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}]}}},"LabResultsMetadata":{"type":"object","required":["age","dob","patient","date_reported","specimen_number"],"properties":{"age":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"dob":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"clia_#":{"anyOf":[{"type":"string"},{"type":"null"}]},"patient":{"type":"string","x-mockingbird-volatile":{"kind":"token"}},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"token"}},"laboratory":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"token"}},"date_reported":{"type":"string","x-mockingbird-volatile":{"kind":"timestamp"}},"date_collected":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"specimen_number":{"type":"string","x-mockingbird-volatile":{"kind":"id"}},"date_received":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"timestamp"}},"status":{"type":"string","default":"final"},"interpretation":{"anyOf":[{"type":"string"},{"type":"null"}]},"patient_id":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"id"}},"account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"x-mockingbird-volatile":{"kind":"id"}}}},"LabResultsRaw":{"type":"object","required":["metadata","results"],"properties":{"metadata":{"$ref":"#/components/schemas/LabResultsMetadata"},"results":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/BiomarkerResult"}},{"type":"object","additionalProperties":true}],"x-mockingbird-volatile":{"kind":"opaque"}},"missing_results":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/MissingBiomarkerResult"}},{"type":"null"}],"x-mockingbird-volatile":{"kind":"opaque"}},"sample_information":{"anyOf":[{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SampleData"}},{"type":"null"}],"x-mockingbird-volatile":{"kind":"opaque"}},"order_transaction":{"anyOf":[{"$ref":"#/components/schemas/ClientFacingOrderTransaction"},{"type":"null"}]}}},"SimulationFlags":{"type":"object","properties":{"interpretation":{"anyOf":[{"type":"string","enum":["normal","abnormal","critical","unknown"]},{"type":"null"}]},"result_types":{"type":"array","items":{"$ref":"#/components/schemas/ResultType"}},"has_missing_results":{"type":"boolean"}}},"GetOrdersResponse":{"type":"object","required":["orders"],"properties":{"orders":{"type":"array","items":{"$ref":"#/components/schemas/ClientFacingOrder"}},"total":{"anyOf":[{"type":"integer"},{"type":"null"}]},"page":{"anyOf":[{"type":"integer"},{"type":"null"}]},"size":{"anyOf":[{"type":"integer"},{"type":"null"}]}}},"HTTPValidationError":{"type":"object","properties":{"detail":{"title":"Detail"}}}}}}`);
6871
9065
  var operationIds = ["get_teams_users_v2_user_get", "create_user_v2_user_post", "get_user_v2_user__user_id__get", "delete_user_v2_user__user_id__delete", "patch_user_v2_user__user_id__patch", "get_user_by_client_user_id_v2_user_resolve__client_user_id__get", "patch_user_info_v2_user__user_id__info_patch", "get_latest_user_info_user_v2_user__user_id__info_latest_get", "get_paginated_lab_tests_for_team_v3_lab_test_get", "get_team_lab_accounts_v3_lab_test_lab_account_get", "get_lab_tests_for_team_v3_lab_tests_get", "get_lab_test_for_team_v3_lab_tests__lab_test_id__get", "get_labs_v3_lab_tests_labs_get", "get_markers_for_lab_test_v3_lab_tests__lab_test_id__markers_get", "list_order_set_markers_v3_lab_tests_list_order_set_markers_post", "create_order_v3_order_post", "get_area_info_v3_order_area_info_get", "get_psc_info_v3_order_psc_info_get", "get_phlebotomy_appointment_availability_v3_order_phlebotomy_appointment_availability_post", "get_phlebotomy_appointment_cancellation_reason_v3_order_phlebotomy_appointment_cancellation_reasons_get", "get_psc_appointment_availability_v3_order_psc_appointment_availability_post", "get_psc_appointment_cancellation_reason_v3_order_psc_appointment_cancellation_reasons_get", "get_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_get", "book_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_book_post", "reschedule_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_reschedule_patch", "cancel_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_cancel_patch", "get_psc_appointment_v3_order__order_id__psc_appointment_get", "book_psc_appointment_v3_order__order_id__psc_appointment_book_post", "reschedule_psc_appointment_v3_order__order_id__psc_appointment_reschedule_patch", "cancel_psc_appointment_v3_order__order_id__psc_appointment_cancel_patch", "get_order_v3_order__order_id__get", "cancel_order_v3_order__order_id__cancel_post", "simulate_order_v3_order__order_id__test_post", "get_result_raw_v3_order__order_id__result_get", "get_result_metadata_v3_order__order_id__result_metadata_get", "get_result_pdf_v3_order__order_id__result_pdf_get", "get_order_requisition_pdf_v3_order__order_id__requisition_pdf_get", "get_orders_v3_orders_get", "get_order_transaction_v3_order_transaction__transaction_id__get", "get_order_transaction_result_v3_order_transaction__transaction_id__result_get"];
6872
9066
  var supportedOperationIds = ["get_teams_users_v2_user_get", "create_user_v2_user_post", "get_user_v2_user__user_id__get", "delete_user_v2_user__user_id__delete", "patch_user_v2_user__user_id__patch", "get_user_by_client_user_id_v2_user_resolve__client_user_id__get", "patch_user_info_v2_user__user_id__info_patch", "get_latest_user_info_user_v2_user__user_id__info_latest_get", "get_paginated_lab_tests_for_team_v3_lab_test_get", "get_team_lab_accounts_v3_lab_test_lab_account_get", "get_lab_tests_for_team_v3_lab_tests_get", "get_lab_test_for_team_v3_lab_tests__lab_test_id__get", "get_labs_v3_lab_tests_labs_get", "get_markers_for_lab_test_v3_lab_tests__lab_test_id__markers_get", "list_order_set_markers_v3_lab_tests_list_order_set_markers_post", "create_order_v3_order_post", "get_area_info_v3_order_area_info_get", "get_psc_info_v3_order_psc_info_get", "get_phlebotomy_appointment_availability_v3_order_phlebotomy_appointment_availability_post", "get_phlebotomy_appointment_cancellation_reason_v3_order_phlebotomy_appointment_cancellation_reasons_get", "get_psc_appointment_availability_v3_order_psc_appointment_availability_post", "get_psc_appointment_cancellation_reason_v3_order_psc_appointment_cancellation_reasons_get", "get_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_get", "book_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_book_post", "reschedule_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_reschedule_patch", "cancel_phlebotomy_appointment_v3_order__order_id__phlebotomy_appointment_cancel_patch", "get_psc_appointment_v3_order__order_id__psc_appointment_get", "book_psc_appointment_v3_order__order_id__psc_appointment_book_post", "reschedule_psc_appointment_v3_order__order_id__psc_appointment_reschedule_patch", "cancel_psc_appointment_v3_order__order_id__psc_appointment_cancel_patch", "get_order_v3_order__order_id__get", "cancel_order_v3_order__order_id__cancel_post", "simulate_order_v3_order__order_id__test_post", "get_result_raw_v3_order__order_id__result_get", "get_result_metadata_v3_order__order_id__result_metadata_get", "get_result_pdf_v3_order__order_id__result_pdf_get", "get_order_requisition_pdf_v3_order__order_id__requisition_pdf_get", "get_orders_v3_orders_get", "get_order_transaction_v3_order_transaction__transaction_id__get", "get_order_transaction_result_v3_order_transaction__transaction_id__result_get"];
6873
9067
 
@@ -8877,7 +11071,7 @@ var createRuntime2 = (options = {}) => {
8877
11071
  const webhooks = options.webhooks ? createWebhookDispatcher(options.webhooks) : void 0;
8878
11072
  const runtime = createRuntime({
8879
11073
  name: JUNCTION_NAMESPACE,
8880
- document,
11074
+ document: document2,
8881
11075
  ...options.sqlite ? { sqlite: options.sqlite } : {},
8882
11076
  ...options.clock ? { clock: options.clock } : {},
8883
11077
  ...options.seed !== void 0 ? { seed: options.seed } : {},
@@ -8919,6 +11113,7 @@ var createRuntime2 = (options = {}) => {
8919
11113
  webhooks: webhooks ? "on" : "off"
8920
11114
  };
8921
11115
  },
11116
+ presets: junctionFaultPresets(),
8922
11117
  admin: junctionAdminRoutes({ webhooks })
8923
11118
  });
8924
11119
  return Object.assign(runtime, { webhooks });
@@ -9424,7 +11619,7 @@ var JunctionAPI = class {
9424
11619
  ...resultsHandlers(state)
9425
11620
  });
9426
11621
  this.service = createService({
9427
- document,
11622
+ document: document2,
9428
11623
  handlers,
9429
11624
  sqlite,
9430
11625
  namespace,
@@ -9770,7 +11965,7 @@ export {
9770
11965
  UNKNOWN_ZIP_ERROR_TYPE,
9771
11966
  IDENTITY_MODES,
9772
11967
  FixtureError,
9773
- document,
11968
+ document2 as document,
9774
11969
  operationIds,
9775
11970
  supportedOperationIds,
9776
11971
  PSC_AVAILABILITY_ZIPS,
@@ -9795,4 +11990,4 @@ export {
9795
11990
  JunctionAPI,
9796
11991
  LabAccountConflict
9797
11992
  };
9798
- //# sourceMappingURL=chunk-KSSFYWXV.js.map
11993
+ //# sourceMappingURL=chunk-LNHFCMWC.js.map