@crvouga/mockingbird-service-junction 0.2.0 → 0.4.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.
@@ -1,18 +1,23 @@
1
1
  // src/sealed-corpus.ts
2
- var SEALED_CORPUS_VERSION = 1;
2
+ var SEALED_CORPUS_VERSION = 2;
3
+ var SUPPORTED_SEALED_CORPUS_VERSIONS = [1, 2];
3
4
  var parseSealedCorpus = (value) => {
4
5
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
5
6
  throw new Error("sealed corpus must be an object");
6
7
  }
7
8
  const record = value;
8
- if (record.version !== SEALED_CORPUS_VERSION) {
9
+ if (!SUPPORTED_SEALED_CORPUS_VERSIONS.includes(record.version)) {
9
10
  throw new Error(`unsupported sealed corpus version: ${String(record.version)}`);
10
11
  }
12
+ if (record.teamId !== void 0 && typeof record.teamId !== "string") {
13
+ throw new Error("sealed corpus teamId must be a string");
14
+ }
11
15
  return record;
12
16
  };
13
17
 
14
18
  export {
15
19
  SEALED_CORPUS_VERSION,
20
+ SUPPORTED_SEALED_CORPUS_VERSIONS,
16
21
  parseSealedCorpus
17
22
  };
18
- //# sourceMappingURL=chunk-4C6VYRJN.js.map
23
+ //# sourceMappingURL=chunk-ISDNA2TU.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/sealed-corpus.ts"],
4
+ "sourcesContent": ["import type { ExpectedResult, LabTestRecord } from \"./catalog.js\"\nimport type { GetCacheEntry } from \"./state.js\"\n\n/**\n * Version of the sealed-corpus on-disk format. Bumped whenever the shape changes so a\n * stale recording is rejected instead of half-applied.\n *\n * - 1: observations, catalog and lab accounts.\n * - 2: adds `teamId`, the recording team, so lab-account allowlists load verbatim.\n */\nexport const SEALED_CORPUS_VERSION = 2\n\n/** Versions `parseSealedCorpus` still loads. A version-1 corpus behaves as it did in 0.2.0. */\nexport const SUPPORTED_SEALED_CORPUS_VERSIONS: readonly number[] = [1, 2]\n\n/**\n * Exact sandbox recording of the provider-owned reads a drop-in consumer depends on:\n * parameter-stable GET observations (area/PSC inventory), the lab catalog, team labs, and\n * lab accounts. Availability is intentionally absent \u2014 its slot dates and single-use\n * `booking_key`s can never match a live cache key, so it stays with the generator.\n */\nexport type SealedCorpus = {\n version: 1 | typeof SEALED_CORPUS_VERSION\n recordedAt: string\n source: string\n /**\n * The recording team's id (version 2+). When present it is the mock's default team,\n * and each lab account's `team_id_allowlist` is kept exactly as recorded.\n */\n teamId?: string\n /** SHA-256 of the recording's content, written by `corpus pull`. Identifies it in logs. */\n fingerprint?: string\n observations: Record<string, GetCacheEntry>\n catalog: {\n labTests: LabTestRecord[]\n labs: Record<string, unknown>[]\n expectedResults: Record<string, ExpectedResult[]>\n }\n labAccounts: Record<string, unknown>[]\n}\n\n/** Throws on a non-object or an unrecognized `version`. */\nexport const parseSealedCorpus = (value: unknown): SealedCorpus => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(\"sealed corpus must be an object\")\n }\n const record = value as Record<string, unknown>\n if (!SUPPORTED_SEALED_CORPUS_VERSIONS.includes(record.version as number)) {\n throw new Error(`unsupported sealed corpus version: ${String(record.version)}`)\n }\n if (record.teamId !== undefined && typeof record.teamId !== \"string\") {\n throw new Error(\"sealed corpus teamId must be a string\")\n }\n return record as unknown as SealedCorpus\n}\n"],
5
+ "mappings": ";AAUO,IAAM,wBAAwB;AAG9B,IAAM,mCAAsD,CAAC,GAAG,CAAC;AA6BjE,IAAM,oBAAoB,CAAC,UAAiC;AACjE,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG;AACvE,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AACA,QAAM,SAAS;AACf,MAAI,CAAC,iCAAiC,SAAS,OAAO,OAAiB,GAAG;AACxE,UAAM,IAAI,MAAM,sCAAsC,OAAO,OAAO,OAAO,CAAC,EAAE;AAAA,EAChF;AACA,MAAI,OAAO,WAAW,UAAa,OAAO,OAAO,WAAW,UAAU;AACpE,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AACA,SAAO;AACT;",
6
+ "names": []
7
+ }
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  runCli,
5
5
  serveCommand,
6
6
  serveTarget
7
- } from "./chunk-KKNULV7X.js";
7
+ } from "./chunk-CR35KYXY.js";
8
8
  import {
9
9
  DEFAULT_JUNCTION_BASE_URL,
10
10
  createRuntime,
@@ -12,13 +12,13 @@ import {
12
12
  isSandboxKey,
13
13
  pullCorpus,
14
14
  verifyAgainstReal
15
- } from "./chunk-MA3HSUVD.js";
15
+ } from "./chunk-ICINEQ7D.js";
16
16
  import {
17
17
  defaultCorpus
18
- } from "./chunk-MD4KYEIM.js";
18
+ } from "./chunk-C2UGIPPM.js";
19
19
  import {
20
20
  parseSealedCorpus
21
- } from "./chunk-4C6VYRJN.js";
21
+ } from "./chunk-ISDNA2TU.js";
22
22
 
23
23
  // src/cli.ts
24
24
  import { readFile, writeFile } from "node:fs/promises";
package/dist/corpus.d.ts CHANGED
@@ -59,8 +59,11 @@ type GetCacheEntry = {
59
59
  /**
60
60
  * Version of the sealed-corpus on-disk format. Bumped whenever the shape changes so a
61
61
  * stale recording is rejected instead of half-applied.
62
+ *
63
+ * - 1: observations, catalog and lab accounts.
64
+ * - 2: adds `teamId`, the recording team, so lab-account allowlists load verbatim.
62
65
  */
63
- declare const SEALED_CORPUS_VERSION = 1;
66
+ declare const SEALED_CORPUS_VERSION = 2;
64
67
  /**
65
68
  * Exact sandbox recording of the provider-owned reads a drop-in consumer depends on:
66
69
  * parameter-stable GET observations (area/PSC inventory), the lab catalog, team labs, and
@@ -68,9 +71,14 @@ declare const SEALED_CORPUS_VERSION = 1;
68
71
  * `booking_key`s can never match a live cache key, so it stays with the generator.
69
72
  */
70
73
  type SealedCorpus = {
71
- version: typeof SEALED_CORPUS_VERSION;
74
+ version: 1 | typeof SEALED_CORPUS_VERSION;
72
75
  recordedAt: string;
73
76
  source: string;
77
+ /**
78
+ * The recording team's id (version 2+). When present it is the mock's default team,
79
+ * and each lab account's `team_id_allowlist` is kept exactly as recorded.
80
+ */
81
+ teamId?: string;
74
82
  /** SHA-256 of the recording's content, written by `corpus pull`. Identifies it in logs. */
75
83
  fingerprint?: string;
76
84
  observations: Record<string, GetCacheEntry>;
package/dist/corpus.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defaultCorpus
3
- } from "./chunk-MD4KYEIM.js";
4
- import "./chunk-4C6VYRJN.js";
3
+ } from "./chunk-C2UGIPPM.js";
4
+ import "./chunk-ISDNA2TU.js";
5
5
  export {
6
6
  defaultCorpus
7
7
  };