@adcp/sdk 17.0.0-beta.30 → 17.0.0-beta.32

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.
Files changed (38) hide show
  1. package/dist/lib/identity-3.3/trust.js +10 -4
  2. package/dist/lib/identity-3.3/trust.mjs +10 -4
  3. package/dist/lib/server/create-adcp-server.js +7 -8
  4. package/dist/lib/server/create-adcp-server.mjs +9 -10
  5. package/dist/lib/server/error-arm-tools.d.mts +23 -14
  6. package/dist/lib/server/error-arm-tools.d.ts +23 -14
  7. package/dist/lib/server/error-arm-tools.js +82 -34
  8. package/dist/lib/server/error-arm-tools.mjs +81 -34
  9. package/dist/lib/testing/storyboard/compliance.js +53 -24
  10. package/dist/lib/testing/storyboard/compliance.mjs +53 -24
  11. package/dist/lib/testing/storyboard/context.js +14 -10
  12. package/dist/lib/testing/storyboard/context.mjs +14 -10
  13. package/dist/lib/testing/storyboard/loader.js +2 -2
  14. package/dist/lib/testing/storyboard/loader.mjs +2 -2
  15. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  16. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  17. package/dist/lib/testing/storyboard/yaml-cache.d.mts +21 -0
  18. package/dist/lib/testing/storyboard/yaml-cache.d.ts +21 -0
  19. package/dist/lib/testing/storyboard/yaml-cache.js +168 -0
  20. package/dist/lib/testing/storyboard/yaml-cache.mjs +139 -0
  21. package/dist/lib/validation/schema-diagnostic-origins.js +55 -25
  22. package/dist/lib/validation/schema-diagnostic-origins.mjs +55 -25
  23. package/dist/lib/validation/schema-loader.js +499 -44
  24. package/dist/lib/validation/schema-loader.mjs +499 -46
  25. package/dist/lib/validation/schema-validator.js +4 -6
  26. package/dist/lib/validation/schema-validator.mjs +6 -7
  27. package/dist/lib/validation/validator-cache.d.mts +45 -0
  28. package/dist/lib/validation/validator-cache.d.ts +45 -0
  29. package/dist/lib/validation/validator-cache.js +249 -0
  30. package/dist/lib/validation/validator-cache.mjs +227 -0
  31. package/dist/lib/version.d.mts +3 -3
  32. package/dist/lib/version.d.ts +3 -3
  33. package/dist/lib/version.js +3 -3
  34. package/dist/lib/version.mjs +3 -3
  35. package/docs/TYPE-SUMMARY.md +2 -2
  36. package/docs/llms.txt +2 -2
  37. package/docs/migration-14.x-rc-worksheet.md +4 -4
  38. package/package.json +1 -1
@@ -39,9 +39,9 @@ __export(compliance_exports, {
39
39
  });
40
40
  module.exports = __toCommonJS(compliance_exports);
41
41
  var import_fs = require("fs");
42
- var import_yaml = require("yaml");
43
42
  var import_path = require("path");
44
43
  var import_loader = require('./loader.js');
44
+ var import_yaml_cache = require('./yaml-cache.js');
45
45
  var import_version = require('../../version.js');
46
46
  var import_errors = require('../../errors/index.js');
47
47
  var import_adcp_version_config = require('../../utils/adcp-version-config.js');
@@ -345,7 +345,7 @@ function annotateStoryboardVersion(storyboard, adcpVersion, complianceDir) {
345
345
  function isUniversalMetadataFile(path) {
346
346
  try {
347
347
  const source = (0, import_fs.readFileSync)(path, "utf8");
348
- const document = (0, import_yaml.parse)(source);
348
+ const document = (0, import_yaml_cache.parseStoryboardYaml)(source);
349
349
  if (document === null && /^\s*#/m.test(source) && source.split(/\r?\n/).every((line) => /^\s*(?:#.*)?$/.test(line)))
350
350
  return true;
351
351
  if (!document || typeof document !== "object" || Array.isArray(document)) {
@@ -404,11 +404,12 @@ function withSynthesisErrorPhase(storyboard, err) {
404
404
  return { ...storyboard, phases: [errorPhase, ...storyboard.phases] };
405
405
  }
406
406
  function listBundles(options = {}) {
407
- const dir = getComplianceCacheDir(options);
408
- const index = loadComplianceIndex(options);
407
+ return scopeBundles(complianceScope(options), loadComplianceIndex(options), getComplianceCacheDir(options));
408
+ }
409
+ function scopeBundles(scope, index, dir) {
409
410
  const bundles = [];
410
411
  for (const name of index.universal) {
411
- if (isUniversalMetadataFile((0, import_path.join)(dir, "universal", `${name}.yaml`))) continue;
412
+ if (scopedUniversalMetadata(scope, name)) continue;
412
413
  bundles.push({
413
414
  kind: "universal",
414
415
  id: name,
@@ -436,7 +437,7 @@ function listBundles(options = {}) {
436
437
  return bundles;
437
438
  }
438
439
  const STORYBOARD_INDEX_CACHE_LIMIT = 8;
439
- const storyboardIndexes = /* @__PURE__ */ new Map();
440
+ const complianceScopes = /* @__PURE__ */ new Map();
440
441
  function customComplianceInventory(dir) {
441
442
  if (!(0, import_fs.existsSync)(dir)) return "missing";
442
443
  const entries = [];
@@ -453,7 +454,7 @@ function customComplianceInventory(dir) {
453
454
  visit(dir, "");
454
455
  return JSON.stringify(entries);
455
456
  }
456
- function complianceStoryboardIndex(options) {
457
+ function complianceScope(options) {
457
458
  const dir = (0, import_path.resolve)(getComplianceCacheDir(options));
458
459
  const indexPath = (0, import_path.join)(dir, "index.json");
459
460
  const stamp = (0, import_fs.existsSync)(indexPath) ? (0, import_fs.statSync)(indexPath) : void 0;
@@ -469,24 +470,52 @@ function complianceStoryboardIndex(options) {
469
470
  stamp?.size ?? null,
470
471
  inventory
471
472
  ]);
472
- const cached = storyboardIndexes.get(key);
473
+ const cached = complianceScopes.get(key);
473
474
  if (cached) {
474
- storyboardIndexes.delete(key);
475
- storyboardIndexes.set(key, cached);
475
+ complianceScopes.delete(key);
476
+ complianceScopes.set(key, cached);
476
477
  return cached;
477
478
  }
478
479
  if (customRoot) (0, import_vector_loader.invalidateRequestSigningVectorCache)(dir);
480
+ const scope = { dir, bundles: /* @__PURE__ */ new Map(), universalMetadata: /* @__PURE__ */ new Map() };
481
+ complianceScopes.set(key, scope);
482
+ while (complianceScopes.size > STORYBOARD_INDEX_CACHE_LIMIT) {
483
+ const oldest = complianceScopes.keys().next().value;
484
+ if (oldest !== void 0) complianceScopes.delete(oldest);
485
+ }
486
+ return scope;
487
+ }
488
+ function scopedUniversalMetadata(scope, name) {
489
+ let metadata = scope.universalMetadata.get(name);
490
+ if (metadata === void 0) {
491
+ metadata = isUniversalMetadataFile((0, import_path.join)(scope.dir, "universal", `${name}.yaml`));
492
+ scope.universalMetadata.set(name, metadata);
493
+ }
494
+ return metadata;
495
+ }
496
+ function bundlePath(dir, ref) {
497
+ if (ref.kind === "universal") return (0, import_path.join)(dir, "universal", `${ref.id}.yaml`);
498
+ return (0, import_path.join)(dir, ref.kind === "protocol" ? "protocols" : "specialisms", ref.id);
499
+ }
500
+ function scopedBundleStoryboards(scope, ref) {
501
+ const key = `${ref.kind}:${ref.id}`;
502
+ let storyboards = scope.bundles.get(key);
503
+ if (!storyboards) {
504
+ storyboards = loadBundleStoryboards({ ...ref, path: bundlePath(scope.dir, ref) });
505
+ scope.bundles.set(key, storyboards);
506
+ }
507
+ return storyboards;
508
+ }
509
+ function complianceStoryboardIndex(options) {
510
+ const scope = complianceScope(options);
511
+ if (scope.byId) return scope.byId;
479
512
  const indexed = /* @__PURE__ */ new Map();
480
- for (const ref of listBundles({ ...options, complianceDir: dir })) {
481
- for (const storyboard of loadBundleStoryboards(ref)) {
513
+ for (const ref of scopeBundles(scope, loadComplianceIndex(options), scope.dir)) {
514
+ for (const storyboard of scopedBundleStoryboards(scope, ref)) {
482
515
  if (!indexed.has(storyboard.id)) indexed.set(storyboard.id, storyboard);
483
516
  }
484
517
  }
485
- storyboardIndexes.set(key, indexed);
486
- while (storyboardIndexes.size > STORYBOARD_INDEX_CACHE_LIMIT) {
487
- const oldest = storyboardIndexes.keys().next().value;
488
- if (oldest !== void 0) storyboardIndexes.delete(oldest);
489
- }
518
+ scope.byId = indexed;
490
519
  return indexed;
491
520
  }
492
521
  function cloneComplianceStoryboard(storyboard) {
@@ -511,12 +540,11 @@ function loadSpecialismDetail(slug, options = {}) {
511
540
  const known = index.specialisms.map((s) => s.id).join(", ");
512
541
  throw new Error(`Unknown specialism "${slug}". Known specialisms: ${known}`);
513
542
  }
514
- const bundleStoryboards = loadBundleStoryboards({
543
+ const bundleStoryboards = scopedBundleStoryboards(complianceScope(options), {
515
544
  kind: "specialism",
516
545
  id: slug,
517
- path: (0, import_path.join)(getComplianceCacheDir(options), "specialisms", slug),
518
546
  adcp_version: index.adcp_version
519
- });
547
+ }).map(cloneComplianceStoryboard);
520
548
  const storyboard = bundleStoryboards.find((sb) => sb.category === entry.id.replace(/-/g, "_")) ?? bundleStoryboards[0];
521
549
  if (!storyboard) {
522
550
  throw new Error(
@@ -548,20 +576,21 @@ function listSpecialisms(options = {}) {
548
576
  }
549
577
  function resolveBundleOrStoryboard(id, options = {}) {
550
578
  const bundle = findBundleById(id, options);
551
- if (bundle) return loadBundleStoryboards(bundle);
579
+ if (bundle) return scopedBundleStoryboards(complianceScope(options), bundle).map(cloneComplianceStoryboard);
552
580
  const sb = getComplianceStoryboardById(id, options);
553
581
  return sb ? [sb] : [];
554
582
  }
555
583
  function resolveStoryboardsForCapabilities(caps, options = {}) {
556
584
  const index = loadComplianceIndex(options);
557
585
  assertSupportedComplianceVersion(index.adcp_version, caps.supported_versions, options);
558
- const cacheDir = getComplianceCacheDir(options);
586
+ const scope = complianceScope(options);
587
+ const cacheDir = scope.dir;
559
588
  const bundles = [];
560
589
  const storyboards = [];
561
590
  const notApplicable = [];
562
591
  const seenStoryboards = /* @__PURE__ */ new Set();
563
592
  const push = (ref) => {
564
- const sbs = loadBundleStoryboards(ref);
593
+ const sbs = scopedBundleStoryboards(scope, ref).map(cloneComplianceStoryboard);
565
594
  bundles.push({ ref, storyboards: sbs });
566
595
  for (const sb of sbs) {
567
596
  if (seenStoryboards.has(sb.id)) continue;
@@ -581,7 +610,7 @@ function resolveStoryboardsForCapabilities(caps, options = {}) {
581
610
  }
582
611
  };
583
612
  for (const name of index.universal) {
584
- if (isUniversalMetadataFile((0, import_path.join)(cacheDir, "universal", `${name}.yaml`))) continue;
613
+ if (scopedUniversalMetadata(scope, name)) continue;
585
614
  push({
586
615
  kind: "universal",
587
616
  id: name,
@@ -4,9 +4,9 @@ import { createRequire as __adcpCreateRequire } from "node:module";
4
4
  const __dirname = __adcpDirname(__adcpFileURLToPath(import.meta.url));
5
5
  const require2 = __adcpCreateRequire(import.meta.url);
6
6
  import { readFileSync, readdirSync, existsSync, statSync } from "fs";
7
- import { parse as parseYaml } from "yaml";
8
7
  import { basename, dirname, join, resolve } from "path";
9
8
  import { loadStoryboardFile } from "./loader.mjs";
9
+ import { parseStoryboardYaml } from "./yaml-cache.mjs";
10
10
  import { ADCP_VERSION } from "../../version.mjs";
11
11
  import { ADCPError } from "../../errors/index.mjs";
12
12
  import { isAdcpVersionSupported } from "../../utils/adcp-version-config.mjs";
@@ -310,7 +310,7 @@ function annotateStoryboardVersion(storyboard, adcpVersion, complianceDir) {
310
310
  function isUniversalMetadataFile(path) {
311
311
  try {
312
312
  const source = readFileSync(path, "utf8");
313
- const document = parseYaml(source);
313
+ const document = parseStoryboardYaml(source);
314
314
  if (document === null && /^\s*#/m.test(source) && source.split(/\r?\n/).every((line) => /^\s*(?:#.*)?$/.test(line)))
315
315
  return true;
316
316
  if (!document || typeof document !== "object" || Array.isArray(document)) {
@@ -369,11 +369,12 @@ function withSynthesisErrorPhase(storyboard, err) {
369
369
  return { ...storyboard, phases: [errorPhase, ...storyboard.phases] };
370
370
  }
371
371
  function listBundles(options = {}) {
372
- const dir = getComplianceCacheDir(options);
373
- const index = loadComplianceIndex(options);
372
+ return scopeBundles(complianceScope(options), loadComplianceIndex(options), getComplianceCacheDir(options));
373
+ }
374
+ function scopeBundles(scope, index, dir) {
374
375
  const bundles = [];
375
376
  for (const name of index.universal) {
376
- if (isUniversalMetadataFile(join(dir, "universal", `${name}.yaml`))) continue;
377
+ if (scopedUniversalMetadata(scope, name)) continue;
377
378
  bundles.push({
378
379
  kind: "universal",
379
380
  id: name,
@@ -401,7 +402,7 @@ function listBundles(options = {}) {
401
402
  return bundles;
402
403
  }
403
404
  const STORYBOARD_INDEX_CACHE_LIMIT = 8;
404
- const storyboardIndexes = /* @__PURE__ */ new Map();
405
+ const complianceScopes = /* @__PURE__ */ new Map();
405
406
  function customComplianceInventory(dir) {
406
407
  if (!existsSync(dir)) return "missing";
407
408
  const entries = [];
@@ -418,7 +419,7 @@ function customComplianceInventory(dir) {
418
419
  visit(dir, "");
419
420
  return JSON.stringify(entries);
420
421
  }
421
- function complianceStoryboardIndex(options) {
422
+ function complianceScope(options) {
422
423
  const dir = resolve(getComplianceCacheDir(options));
423
424
  const indexPath = join(dir, "index.json");
424
425
  const stamp = existsSync(indexPath) ? statSync(indexPath) : void 0;
@@ -434,24 +435,52 @@ function complianceStoryboardIndex(options) {
434
435
  stamp?.size ?? null,
435
436
  inventory
436
437
  ]);
437
- const cached = storyboardIndexes.get(key);
438
+ const cached = complianceScopes.get(key);
438
439
  if (cached) {
439
- storyboardIndexes.delete(key);
440
- storyboardIndexes.set(key, cached);
440
+ complianceScopes.delete(key);
441
+ complianceScopes.set(key, cached);
441
442
  return cached;
442
443
  }
443
444
  if (customRoot) invalidateRequestSigningVectorCache(dir);
445
+ const scope = { dir, bundles: /* @__PURE__ */ new Map(), universalMetadata: /* @__PURE__ */ new Map() };
446
+ complianceScopes.set(key, scope);
447
+ while (complianceScopes.size > STORYBOARD_INDEX_CACHE_LIMIT) {
448
+ const oldest = complianceScopes.keys().next().value;
449
+ if (oldest !== void 0) complianceScopes.delete(oldest);
450
+ }
451
+ return scope;
452
+ }
453
+ function scopedUniversalMetadata(scope, name) {
454
+ let metadata = scope.universalMetadata.get(name);
455
+ if (metadata === void 0) {
456
+ metadata = isUniversalMetadataFile(join(scope.dir, "universal", `${name}.yaml`));
457
+ scope.universalMetadata.set(name, metadata);
458
+ }
459
+ return metadata;
460
+ }
461
+ function bundlePath(dir, ref) {
462
+ if (ref.kind === "universal") return join(dir, "universal", `${ref.id}.yaml`);
463
+ return join(dir, ref.kind === "protocol" ? "protocols" : "specialisms", ref.id);
464
+ }
465
+ function scopedBundleStoryboards(scope, ref) {
466
+ const key = `${ref.kind}:${ref.id}`;
467
+ let storyboards = scope.bundles.get(key);
468
+ if (!storyboards) {
469
+ storyboards = loadBundleStoryboards({ ...ref, path: bundlePath(scope.dir, ref) });
470
+ scope.bundles.set(key, storyboards);
471
+ }
472
+ return storyboards;
473
+ }
474
+ function complianceStoryboardIndex(options) {
475
+ const scope = complianceScope(options);
476
+ if (scope.byId) return scope.byId;
444
477
  const indexed = /* @__PURE__ */ new Map();
445
- for (const ref of listBundles({ ...options, complianceDir: dir })) {
446
- for (const storyboard of loadBundleStoryboards(ref)) {
478
+ for (const ref of scopeBundles(scope, loadComplianceIndex(options), scope.dir)) {
479
+ for (const storyboard of scopedBundleStoryboards(scope, ref)) {
447
480
  if (!indexed.has(storyboard.id)) indexed.set(storyboard.id, storyboard);
448
481
  }
449
482
  }
450
- storyboardIndexes.set(key, indexed);
451
- while (storyboardIndexes.size > STORYBOARD_INDEX_CACHE_LIMIT) {
452
- const oldest = storyboardIndexes.keys().next().value;
453
- if (oldest !== void 0) storyboardIndexes.delete(oldest);
454
- }
483
+ scope.byId = indexed;
455
484
  return indexed;
456
485
  }
457
486
  function cloneComplianceStoryboard(storyboard) {
@@ -476,12 +505,11 @@ function loadSpecialismDetail(slug, options = {}) {
476
505
  const known = index.specialisms.map((s) => s.id).join(", ");
477
506
  throw new Error(`Unknown specialism "${slug}". Known specialisms: ${known}`);
478
507
  }
479
- const bundleStoryboards = loadBundleStoryboards({
508
+ const bundleStoryboards = scopedBundleStoryboards(complianceScope(options), {
480
509
  kind: "specialism",
481
510
  id: slug,
482
- path: join(getComplianceCacheDir(options), "specialisms", slug),
483
511
  adcp_version: index.adcp_version
484
- });
512
+ }).map(cloneComplianceStoryboard);
485
513
  const storyboard = bundleStoryboards.find((sb) => sb.category === entry.id.replace(/-/g, "_")) ?? bundleStoryboards[0];
486
514
  if (!storyboard) {
487
515
  throw new Error(
@@ -513,20 +541,21 @@ function listSpecialisms(options = {}) {
513
541
  }
514
542
  function resolveBundleOrStoryboard(id, options = {}) {
515
543
  const bundle = findBundleById(id, options);
516
- if (bundle) return loadBundleStoryboards(bundle);
544
+ if (bundle) return scopedBundleStoryboards(complianceScope(options), bundle).map(cloneComplianceStoryboard);
517
545
  const sb = getComplianceStoryboardById(id, options);
518
546
  return sb ? [sb] : [];
519
547
  }
520
548
  function resolveStoryboardsForCapabilities(caps, options = {}) {
521
549
  const index = loadComplianceIndex(options);
522
550
  assertSupportedComplianceVersion(index.adcp_version, caps.supported_versions, options);
523
- const cacheDir = getComplianceCacheDir(options);
551
+ const scope = complianceScope(options);
552
+ const cacheDir = scope.dir;
524
553
  const bundles = [];
525
554
  const storyboards = [];
526
555
  const notApplicable = [];
527
556
  const seenStoryboards = /* @__PURE__ */ new Set();
528
557
  const push = (ref) => {
529
- const sbs = loadBundleStoryboards(ref);
558
+ const sbs = scopedBundleStoryboards(scope, ref).map(cloneComplianceStoryboard);
530
559
  bundles.push({ ref, storyboards: sbs });
531
560
  for (const sb of sbs) {
532
561
  if (seenStoryboards.has(sb.id)) continue;
@@ -546,7 +575,7 @@ function resolveStoryboardsForCapabilities(caps, options = {}) {
546
575
  }
547
576
  };
548
577
  for (const name of index.universal) {
549
- if (isUniversalMetadataFile(join(cacheDir, "universal", `${name}.yaml`))) continue;
578
+ if (scopedUniversalMetadata(scope, name)) continue;
550
579
  push({
551
580
  kind: "universal",
552
581
  id: name,
@@ -59,6 +59,18 @@ function asRecord(value) {
59
59
  function readMediaBuyStatus(record) {
60
60
  return (0, import_media_buy_status.getAuthoritativeMediaBuyStatus)(record);
61
61
  }
62
+ const INTERIM_TASK_STATUSES = /* @__PURE__ */ new Set(["submitted", "working", "input-required"]);
63
+ function isInterimTaskEnvelope(data) {
64
+ return INTERIM_TASK_STATUSES.has(asRecord(data)?.status);
65
+ }
66
+ function extractTerminalMediaBuyFields(data, adcpVersion) {
67
+ if (isInterimTaskEnvelope(data)) return {};
68
+ const { mediaBuyId, status } = readMediaBuyFields(data, adcpVersion);
69
+ const extracted = {};
70
+ if (mediaBuyId) extracted.media_buy_id = mediaBuyId;
71
+ if (status) extracted.media_buy_status = status;
72
+ return extracted;
73
+ }
62
74
  function readMediaBuyFields(data, adcpVersion) {
63
75
  const outer = asRecord(data);
64
76
  const nested = asRecord(outer?.media_buy);
@@ -187,18 +199,10 @@ const CONTEXT_EXTRACTORS = {
187
199
  return readCompactMediaBuyFields(data);
188
200
  },
189
201
  create_media_buy(data, adcpVersion) {
190
- const { mediaBuyId, status } = readMediaBuyFields(data, adcpVersion);
191
- const extracted = {};
192
- if (mediaBuyId) extracted.media_buy_id = mediaBuyId;
193
- if (status) extracted.media_buy_status = status;
194
- return extracted;
202
+ return extractTerminalMediaBuyFields(data, adcpVersion);
195
203
  },
196
204
  update_media_buy(data, adcpVersion) {
197
- const { mediaBuyId, status } = readMediaBuyFields(data, adcpVersion);
198
- const extracted = {};
199
- if (mediaBuyId) extracted.media_buy_id = mediaBuyId;
200
- if (status) extracted.media_buy_status = status;
201
- return extracted;
205
+ return extractTerminalMediaBuyFields(data, adcpVersion);
202
206
  },
203
207
  get_media_buys(data) {
204
208
  const d = data;
@@ -26,6 +26,18 @@ function asRecord(value) {
26
26
  function readMediaBuyStatus(record) {
27
27
  return getAuthoritativeMediaBuyStatus(record);
28
28
  }
29
+ const INTERIM_TASK_STATUSES = /* @__PURE__ */ new Set(["submitted", "working", "input-required"]);
30
+ function isInterimTaskEnvelope(data) {
31
+ return INTERIM_TASK_STATUSES.has(asRecord(data)?.status);
32
+ }
33
+ function extractTerminalMediaBuyFields(data, adcpVersion) {
34
+ if (isInterimTaskEnvelope(data)) return {};
35
+ const { mediaBuyId, status } = readMediaBuyFields(data, adcpVersion);
36
+ const extracted = {};
37
+ if (mediaBuyId) extracted.media_buy_id = mediaBuyId;
38
+ if (status) extracted.media_buy_status = status;
39
+ return extracted;
40
+ }
29
41
  function readMediaBuyFields(data, adcpVersion) {
30
42
  const outer = asRecord(data);
31
43
  const nested = asRecord(outer?.media_buy);
@@ -154,18 +166,10 @@ const CONTEXT_EXTRACTORS = {
154
166
  return readCompactMediaBuyFields(data);
155
167
  },
156
168
  create_media_buy(data, adcpVersion) {
157
- const { mediaBuyId, status } = readMediaBuyFields(data, adcpVersion);
158
- const extracted = {};
159
- if (mediaBuyId) extracted.media_buy_id = mediaBuyId;
160
- if (status) extracted.media_buy_status = status;
161
- return extracted;
169
+ return extractTerminalMediaBuyFields(data, adcpVersion);
162
170
  },
163
171
  update_media_buy(data, adcpVersion) {
164
- const { mediaBuyId, status } = readMediaBuyFields(data, adcpVersion);
165
- const extracted = {};
166
- if (mediaBuyId) extracted.media_buy_id = mediaBuyId;
167
- if (status) extracted.media_buy_status = status;
168
- return extracted;
172
+ return extractTerminalMediaBuyFields(data, adcpVersion);
169
173
  },
170
174
  get_media_buys(data) {
171
175
  const d = data;
@@ -27,7 +27,7 @@ __export(loader_exports, {
27
27
  });
28
28
  module.exports = __toCommonJS(loader_exports);
29
29
  var import_fs = require("fs");
30
- var import_yaml = require("yaml");
30
+ var import_yaml_cache = require('./yaml-cache.js');
31
31
  var import_idempotency = require('../../utils/idempotency.js');
32
32
  var import_fixture_resolution = require('./fixture-resolution.js');
33
33
  var import_creative_build_probe = require('./creative-build-probe.js');
@@ -47,7 +47,7 @@ function hasOfflineFormatDirective(value) {
47
47
  return Object.values(object).some(hasOfflineFormatDirective);
48
48
  }
49
49
  function parseStoryboard(yamlContent) {
50
- const parsed = (0, import_yaml.parse)(yamlContent);
50
+ const parsed = (0, import_yaml_cache.parseStoryboardYaml)(yamlContent);
51
51
  if (!parsed?.id || !parsed?.phases) {
52
52
  throw new Error("Invalid storyboard YAML: missing required fields (id, phases)");
53
53
  }
@@ -1,5 +1,5 @@
1
1
  import { readFileSync } from "fs";
2
- import { parse } from "yaml";
2
+ import { parseStoryboardYaml } from "./yaml-cache.mjs";
3
3
  import { MUTATING_TASKS } from "../../utils/idempotency.mjs";
4
4
  import { validateFixtureResolutionDeclarations } from "./fixture-resolution.mjs";
5
5
  import { validateCreativeBuildProbeSpec } from "./creative-build-probe.mjs";
@@ -19,7 +19,7 @@ function hasOfflineFormatDirective(value) {
19
19
  return Object.values(object).some(hasOfflineFormatDirective);
20
20
  }
21
21
  function parseStoryboard(yamlContent) {
22
- const parsed = parse(yamlContent);
22
+ const parsed = parseStoryboardYaml(yamlContent);
23
23
  if (!parsed?.id || !parsed?.phases) {
24
24
  throw new Error("Invalid storyboard YAML: missing required fields (id, phases)");
25
25
  }
@@ -200,7 +200,7 @@ export interface UpstreamTrafficQueryResult {
200
200
  */
201
201
  export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
202
202
  /** Capability semver emitted in run summaries and used for advisory expiry. */
203
- export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.30";
203
+ export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.32";
204
204
  /** True when a failed validation contributes to the owning step's grade. */
205
205
  export declare function validationFailsStep(result: ValidationResult): boolean;
206
206
  /**
@@ -200,7 +200,7 @@ export interface UpstreamTrafficQueryResult {
200
200
  */
201
201
  export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
202
202
  /** Capability semver emitted in run summaries and used for advisory expiry. */
203
- export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.30";
203
+ export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.32";
204
204
  /** True when a failed validation contributes to the owning step's grade. */
205
205
  export declare function validationFailsStep(result: ValidationResult): boolean;
206
206
  /**
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Storyboard YAML parsing, with an opt-in cross-process cache.
3
+ *
4
+ * Every storyboard and discovery process parses the same compliance YAML. With
5
+ * `ADCP_VALIDATOR_CACHE_DIR` set to an absolute directory, the parsed document
6
+ * is stored there as a JSON data entry (see validation/validator-cache) and the
7
+ * next process reads it back instead of parsing. The entry key digests the
8
+ * document text, this module's code, the `yaml` package version and the SDK
9
+ * version, so a changed file or parser is a miss and an entry cannot go stale.
10
+ *
11
+ * Only clean parses are stored: a document with YAML errors or warnings goes
12
+ * through `parse` every time, so it throws or warns exactly as before. A value
13
+ * is stored only when it survives the JSON round trip unchanged; objects that
14
+ * YAML aliases share are recorded and shared again on read. Each call returns
15
+ * new objects. With the variable unset, empty or relative, this is `parse`.
16
+ */
17
+ /**
18
+ * Parse a storyboard YAML document: the result of `yaml`'s `parse(source)`,
19
+ * read from the opt-in cache when an earlier process stored it.
20
+ */
21
+ export declare function parseStoryboardYaml(source: string): unknown;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Storyboard YAML parsing, with an opt-in cross-process cache.
3
+ *
4
+ * Every storyboard and discovery process parses the same compliance YAML. With
5
+ * `ADCP_VALIDATOR_CACHE_DIR` set to an absolute directory, the parsed document
6
+ * is stored there as a JSON data entry (see validation/validator-cache) and the
7
+ * next process reads it back instead of parsing. The entry key digests the
8
+ * document text, this module's code, the `yaml` package version and the SDK
9
+ * version, so a changed file or parser is a miss and an entry cannot go stale.
10
+ *
11
+ * Only clean parses are stored: a document with YAML errors or warnings goes
12
+ * through `parse` every time, so it throws or warns exactly as before. A value
13
+ * is stored only when it survives the JSON round trip unchanged; objects that
14
+ * YAML aliases share are recorded and shared again on read. Each call returns
15
+ * new objects. With the variable unset, empty or relative, this is `parse`.
16
+ */
17
+ /**
18
+ * Parse a storyboard YAML document: the result of `yaml`'s `parse(source)`,
19
+ * read from the opt-in cache when an earlier process stored it.
20
+ */
21
+ export declare function parseStoryboardYaml(source: string): unknown;