@adcp/sdk 13.0.0-rc.10 → 13.0.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/core/AgentClient.d.mts +12 -3
- package/dist/lib/core/AgentClient.d.ts +12 -3
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/AgentClient.js +12 -3
- package/dist/lib/core/AgentClient.js.map +1 -1
- package/dist/lib/core/AgentClient.mjs +12 -3
- package/dist/lib/core/AgentClient.mjs.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.mts +13 -3
- package/dist/lib/core/SingleAgentClient.d.ts +13 -3
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +52 -31
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/core/SingleAgentClient.mjs +52 -31
- package/dist/lib/core/SingleAgentClient.mjs.map +1 -1
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +8 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +8 -0
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/registry/types.generated.d.mts +48 -1
- package/dist/lib/registry/types.generated.d.ts +48 -1
- package/dist/lib/registry/types.generated.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.js.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.js +389 -65
- package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +389 -65
- package/dist/lib/server/decisioning/runtime/from-platform.mjs.map +1 -1
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +8 -2
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/testing/compliance/comply.mjs +8 -2
- package/dist/lib/testing/compliance/comply.mjs.map +1 -1
- package/dist/lib/testing/compliance/spec-conformance.d.ts.map +1 -1
- package/dist/lib/testing/compliance/spec-conformance.js +2 -0
- package/dist/lib/testing/compliance/spec-conformance.js.map +1 -1
- package/dist/lib/testing/compliance/spec-conformance.mjs +2 -0
- package/dist/lib/testing/compliance/spec-conformance.mjs.map +1 -1
- package/dist/lib/testing/compliance/summary.d.mts +2 -0
- package/dist/lib/testing/compliance/summary.d.ts +2 -0
- package/dist/lib/testing/compliance/summary.d.ts.map +1 -1
- package/dist/lib/testing/compliance/summary.js +3 -2
- package/dist/lib/testing/compliance/summary.js.map +1 -1
- package/dist/lib/testing/compliance/summary.mjs +3 -2
- package/dist/lib/testing/compliance/summary.mjs.map +1 -1
- package/dist/lib/testing/compliance/types.d.mts +4 -0
- package/dist/lib/testing/compliance/types.d.ts +4 -0
- package/dist/lib/testing/compliance/types.d.ts.map +1 -1
- package/dist/lib/testing/compliance/types.js.map +1 -1
- package/dist/lib/testing/storyboard/junit.js +49 -32
- package/dist/lib/testing/storyboard/junit.js.map +1 -1
- package/dist/lib/testing/storyboard/junit.mjs +49 -32
- package/dist/lib/testing/storyboard/junit.mjs.map +1 -1
- package/dist/lib/testing/storyboard/loader.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/loader.js +26 -0
- package/dist/lib/testing/storyboard/loader.js.map +1 -1
- package/dist/lib/testing/storyboard/loader.mjs +26 -0
- package/dist/lib/testing/storyboard/loader.mjs.map +1 -1
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +66 -15
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/testing/storyboard/runner.mjs +70 -16
- package/dist/lib/testing/storyboard/runner.mjs.map +1 -1
- package/dist/lib/testing/storyboard/types.d.mts +26 -1
- package/dist/lib/testing/storyboard/types.d.ts +26 -1
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/types.js.map +1 -1
- package/dist/lib/testing/storyboard/types.mjs.map +1 -1
- package/dist/lib/testing/storyboard/validations.d.mts +11 -0
- package/dist/lib/testing/storyboard/validations.d.ts +11 -0
- package/dist/lib/testing/storyboard/validations.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/validations.js +30 -13
- package/dist/lib/testing/storyboard/validations.js.map +1 -1
- package/dist/lib/testing/storyboard/validations.mjs +27 -13
- package/dist/lib/testing/storyboard/validations.mjs.map +1 -1
- package/dist/lib/v2/projection/augment-response.d.mts +45 -0
- package/dist/lib/v2/projection/augment-response.d.ts +45 -0
- package/dist/lib/v2/projection/augment-response.d.ts.map +1 -1
- package/dist/lib/v2/projection/augment-response.js +54 -0
- package/dist/lib/v2/projection/augment-response.js.map +1 -1
- package/dist/lib/v2/projection/augment-response.mjs +52 -0
- package/dist/lib/v2/projection/augment-response.mjs.map +1 -1
- package/dist/lib/v2/projection/index.d.mts +7 -1
- package/dist/lib/v2/projection/index.d.ts +7 -1
- package/dist/lib/v2/projection/index.d.ts.map +1 -1
- package/dist/lib/v2/projection/index.js +9 -0
- package/dist/lib/v2/projection/index.js.map +1 -1
- package/dist/lib/v2/projection/index.mjs +10 -0
- package/dist/lib/v2/projection/index.mjs.map +1 -1
- package/dist/lib/v2/projection/legacy-routes.d.mts +24 -0
- package/dist/lib/v2/projection/legacy-routes.d.ts +25 -0
- package/dist/lib/v2/projection/legacy-routes.d.ts.map +1 -0
- package/dist/lib/v2/projection/legacy-routes.js +163 -0
- package/dist/lib/v2/projection/legacy-routes.js.map +1 -0
- package/dist/lib/v2/projection/legacy-routes.mjs +138 -0
- package/dist/lib/v2/projection/legacy-routes.mjs.map +1 -0
- package/dist/lib/v2/projection/v1-to-v2.d.mts +3 -0
- package/dist/lib/v2/projection/v1-to-v2.d.ts +3 -0
- package/dist/lib/v2/projection/v1-to-v2.d.ts.map +1 -1
- package/dist/lib/v2/projection/v1-to-v2.js +2 -1
- package/dist/lib/v2/projection/v1-to-v2.js.map +1 -1
- package/dist/lib/v2/projection/v1-to-v2.mjs +2 -1
- package/dist/lib/v2/projection/v1-to-v2.mjs.map +1 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.js.map +1 -1
- package/dist/lib/version.mjs +3 -3
- package/dist/lib/version.mjs.map +1 -1
- package/docs/migration-12-to-13.md +56 -2
- package/package.json +3 -1
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
"source_sha": "4e553ad955f83b49c7d221ab5c3ff78237ad02e3",
|
|
5
5
|
"source_tarball_sha256": "580656d6466ef9f0d1119985e6726c2efea718dc671e2ad30957fcb2fd54af0f",
|
|
6
6
|
"upstream_adcp_version": "2.5.3",
|
|
7
|
-
"synced_at": "2026-08-
|
|
7
|
+
"synced_at": "2026-08-10T05:48:43.171Z"
|
|
8
8
|
}
|
|
@@ -59,7 +59,7 @@ import type { PgQueryable } from '../../postgres-task-store.mjs';
|
|
|
59
59
|
import { type TaskRegistry, type TaskRecord } from './task-registry.mjs';
|
|
60
60
|
import { type StatusChangeBus } from '../status-changes.mjs';
|
|
61
61
|
import { type ComplyControllerConfig } from '../../../testing/comply-controller.mjs';
|
|
62
|
-
import type
|
|
62
|
+
import { type LegacyFormatConverter } from '../../../v2/projection/v1-to-v2.mjs';
|
|
63
63
|
import type { CanonicalFormatLegacyResolver } from '../../../v2/projection/v2-to-v1.mjs';
|
|
64
64
|
/**
|
|
65
65
|
* Lifecycle observability hooks the v6 runtime fires at well-known points.
|
|
@@ -59,7 +59,7 @@ import type { PgQueryable } from '../../postgres-task-store';
|
|
|
59
59
|
import { type TaskRegistry, type TaskRecord } from './task-registry';
|
|
60
60
|
import { type StatusChangeBus } from '../status-changes';
|
|
61
61
|
import { type ComplyControllerConfig } from '../../../testing/comply-controller';
|
|
62
|
-
import type
|
|
62
|
+
import { type LegacyFormatConverter } from '../../../v2/projection/v1-to-v2';
|
|
63
63
|
import type { CanonicalFormatLegacyResolver } from '../../../v2/projection/v2-to-v1';
|
|
64
64
|
/**
|
|
65
65
|
* Lifecycle observability hooks the v6 runtime fires at well-known points.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from-platform.d.ts","sourceRoot":"","sources":["../../../../../src/lib/server/decisioning/runtime/from-platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAEL,KAAK,gBAAgB,EASrB,KAAK,cAAc,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtG,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,KAAK,EAAE,OAAO,EAAoC,MAAM,YAAY,CAAC;AA6C5E,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EACV,aAAa,EAKd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAI7D,OAAO,EAA8B,KAAK,YAAY,EAAE,KAAK,UAAU,EAAmB,MAAM,iBAAiB,CAAC;AAkBlH,OAAO,EAAiC,KAAK,eAAe,EAAgC,MAAM,mBAAmB,CAAC;AACtH,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAoBzG,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"from-platform.d.ts","sourceRoot":"","sources":["../../../../../src/lib/server/decisioning/runtime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,KAAK,aAAa,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAqK/D;;;;;;;;;;;GAWG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|
|
@@ -57,9 +57,11 @@ var import_observed_modes = require('./observed-modes.js');
|
|
|
57
57
|
var import_normalize_errors = require('../../normalize-errors.js');
|
|
58
58
|
var import_redact = require('../../redact.js');
|
|
59
59
|
var import_creative_delivery = require('../../../v2/projection/creative-delivery.js');
|
|
60
|
+
var import_v1_to_v2 = require('../../../v2/projection/v1-to-v2.js');
|
|
60
61
|
var import_augment_response = require('../../../v2/projection/augment-response.js');
|
|
61
62
|
var import_v2_to_v1 = require('../../../v2/projection/v2-to-v1.js');
|
|
62
63
|
var import_legacy_metadata = require('../../../v2/projection/legacy-metadata.js');
|
|
64
|
+
var import_resolve_agent_properties = require('../../../discovery/resolve-agent-properties.js');
|
|
63
65
|
var import_version = require('../../../version.js');
|
|
64
66
|
const DEFAULT_FRAMEWORK_LOGGER = {
|
|
65
67
|
debug: () => {
|
|
@@ -87,6 +89,21 @@ function requiresCanonicalCreativeWire(version) {
|
|
|
87
89
|
const minor = Number(match[2]);
|
|
88
90
|
return major > 3 || major === 3 && minor >= 2;
|
|
89
91
|
}
|
|
92
|
+
function supportsTransitionalDualCreativeWire(version) {
|
|
93
|
+
if (typeof version !== "string") return false;
|
|
94
|
+
const match = /^v?(\d+)\.(\d+)(?:\.|-|$)/.exec(version.trim());
|
|
95
|
+
if (!match) return false;
|
|
96
|
+
return Number(match[1]) === 3 && Number(match[2]) === 1;
|
|
97
|
+
}
|
|
98
|
+
function shouldEmitTransitionalDualCreativeWire(version, request) {
|
|
99
|
+
if (!supportsTransitionalDualCreativeWire(version)) return false;
|
|
100
|
+
if (request === null || typeof request !== "object") return true;
|
|
101
|
+
const fields = Object.getOwnPropertyDescriptor(request, "fields");
|
|
102
|
+
if (!fields || !("value" in fields) || !Array.isArray(fields.value)) return true;
|
|
103
|
+
return Object.values(Object.getOwnPropertyDescriptors(fields.value)).some(
|
|
104
|
+
(descriptor) => descriptor.enumerable && "value" in descriptor && descriptor.value === "format_ids"
|
|
105
|
+
);
|
|
106
|
+
}
|
|
90
107
|
function creativeWireEvidenceForRequest(request) {
|
|
91
108
|
let canonical = false;
|
|
92
109
|
let legacy = false;
|
|
@@ -358,7 +375,7 @@ function asCanonicalSemanticServerResponse(response, operation, legacyFormatConv
|
|
|
358
375
|
}
|
|
359
376
|
function asSemanticServerResponseForWire(response, operation, legacyFormatConverter, canonicalFormatLegacyResolver, wireMode) {
|
|
360
377
|
if (wireMode === "canonical") {
|
|
361
|
-
return
|
|
378
|
+
return attachCanonicalFormatWireRefs(
|
|
362
379
|
asCanonicalSemanticServerResponse(response, operation, legacyFormatConverter, canonicalFormatLegacyResolver),
|
|
363
380
|
canonicalFormatLegacyResolver,
|
|
364
381
|
operation
|
|
@@ -462,10 +479,10 @@ function asCanonicalGetProductsRequest(request) {
|
|
|
462
479
|
];
|
|
463
480
|
return { ...request, fields };
|
|
464
481
|
}
|
|
465
|
-
function asCanonicalListCreativesRequest(request, legacyFormatConverter) {
|
|
482
|
+
function asCanonicalListCreativesRequest(request, legacyFormatConverter, responseWireMode) {
|
|
466
483
|
const filters = request["filters"] !== null && typeof request["filters"] === "object" && !Array.isArray(request["filters"]) ? request["filters"] : void 0;
|
|
467
484
|
const legacyFormatIds = filters?.["format_ids"];
|
|
468
|
-
if (Array.isArray(legacyFormatIds) && legacyFormatIds.length > 0) {
|
|
485
|
+
if (Array.isArray(legacyFormatIds) && legacyFormatIds.length > 0 && responseWireMode !== "legacy") {
|
|
469
486
|
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
470
487
|
message: "list_creatives legacy format_ids filters are unavailable on the canonical platform surface.",
|
|
471
488
|
field: "filters.format_ids",
|
|
@@ -480,15 +497,22 @@ function asCanonicalListCreativesRequest(request, legacyFormatConverter) {
|
|
|
480
497
|
"list_creatives",
|
|
481
498
|
legacyFormatConverter
|
|
482
499
|
);
|
|
483
|
-
|
|
500
|
+
const withLegacyFilter = responseWireMode === "legacy" && Array.isArray(legacyFormatIds) && legacyFormatIds.length > 0 ? {
|
|
501
|
+
...projected,
|
|
502
|
+
filters: {
|
|
503
|
+
...projected["filters"] ?? {},
|
|
504
|
+
format_ids: legacyFormatIds
|
|
505
|
+
}
|
|
506
|
+
} : projected;
|
|
507
|
+
if (!Array.isArray(withLegacyFilter["fields"])) return withLegacyFilter;
|
|
484
508
|
const fields = [
|
|
485
509
|
...new Set(
|
|
486
|
-
|
|
510
|
+
withLegacyFilter["fields"].flatMap(
|
|
487
511
|
(field) => field === "format_id" ? ["format_kind"] : typeof field === "string" ? [field] : []
|
|
488
512
|
)
|
|
489
513
|
)
|
|
490
514
|
];
|
|
491
|
-
return { ...
|
|
515
|
+
return { ...withLegacyFilter, fields };
|
|
492
516
|
}
|
|
493
517
|
function asCanonicalProductResponse(response, legacyFormatConverter) {
|
|
494
518
|
try {
|
|
@@ -501,41 +525,324 @@ function asCanonicalProductResponse(response, legacyFormatConverter) {
|
|
|
501
525
|
suggestion: "Return an acyclic data-only product response without enumerable accessors."
|
|
502
526
|
});
|
|
503
527
|
}
|
|
528
|
+
validateDualProductFormatDeclarations(response, legacyFormatConverter);
|
|
504
529
|
const projected = (0, import_augment_response.toCanonicalOnlyResponse)(response, {
|
|
505
530
|
legacyFormatConverter
|
|
506
531
|
});
|
|
507
|
-
|
|
508
|
-
|
|
532
|
+
const blockingDiagnostics = projected.diagnostics.filter(
|
|
533
|
+
(diagnostic) => diagnostic.code !== "LEGACY_FORMAT_ID_DROPPED_UNMAPPED"
|
|
534
|
+
);
|
|
535
|
+
if (blockingDiagnostics.length > 0) {
|
|
536
|
+
const first = blockingDiagnostics[0];
|
|
509
537
|
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
510
538
|
message: "get_products returned a legacy format that cannot be represented canonically.",
|
|
511
539
|
field: first.field,
|
|
512
540
|
suggestion: "Declare canonical format_options or configure legacyCreativeFormatConverter for the legacy format."
|
|
513
541
|
});
|
|
514
542
|
}
|
|
515
|
-
|
|
543
|
+
const canonicalResponse = asCanonicalServerResponse(projected.response);
|
|
544
|
+
const resolvedDropDiagnostics = projected.diagnostics.filter(
|
|
545
|
+
(diagnostic) => diagnostic.code === "LEGACY_FORMAT_ID_DROPPED_UNMAPPED"
|
|
546
|
+
);
|
|
547
|
+
if (resolvedDropDiagnostics.length > 0 && canonicalResponse !== null && typeof canonicalResponse === "object") {
|
|
548
|
+
resolvedLegacyDropDiagnosticsByResponse.set(canonicalResponse, resolvedDropDiagnostics);
|
|
549
|
+
}
|
|
550
|
+
preserveAuthoredFormatIds(response, canonicalResponse);
|
|
551
|
+
return canonicalResponse;
|
|
552
|
+
}
|
|
553
|
+
const authoredFormatIdsByOwner = /* @__PURE__ */ new WeakMap();
|
|
554
|
+
const resolvedLegacyDropDiagnosticsByResponse = /* @__PURE__ */ new WeakMap();
|
|
555
|
+
function ownArrayDataValues(value) {
|
|
556
|
+
const lengthDescriptor = Object.getOwnPropertyDescriptor(value, "length");
|
|
557
|
+
const length = lengthDescriptor && "value" in lengthDescriptor ? lengthDescriptor.value : 0;
|
|
558
|
+
if (typeof length !== "number" || !Number.isSafeInteger(length) || length < 0) return [];
|
|
559
|
+
const values = [];
|
|
560
|
+
for (let index = 0; index < length; index++) {
|
|
561
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
|
|
562
|
+
if (descriptor?.enumerable && "value" in descriptor) values.push(descriptor.value);
|
|
563
|
+
}
|
|
564
|
+
return values;
|
|
565
|
+
}
|
|
566
|
+
function cloneWireData(value) {
|
|
567
|
+
if (Array.isArray(value)) {
|
|
568
|
+
const cloned2 = [];
|
|
569
|
+
for (const entry of ownArrayDataValues(value)) cloned2.push(cloneWireData(entry));
|
|
570
|
+
return cloned2;
|
|
571
|
+
}
|
|
572
|
+
if (value === null || typeof value !== "object") return value;
|
|
573
|
+
const cloned = {};
|
|
574
|
+
for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
|
|
575
|
+
if (descriptor.enumerable && "value" in descriptor) cloned[key] = cloneWireData(descriptor.value);
|
|
576
|
+
}
|
|
577
|
+
return cloned;
|
|
578
|
+
}
|
|
579
|
+
function preserveAuthoredFormatIds(source, target) {
|
|
580
|
+
if (source === null || target === null || typeof source !== "object" || typeof target !== "object") return;
|
|
581
|
+
const sourceProducts = Object.getOwnPropertyDescriptor(source, "products");
|
|
582
|
+
const targetProducts = Object.getOwnPropertyDescriptor(target, "products");
|
|
583
|
+
if (!sourceProducts || !sourceProducts.enumerable || !("value" in sourceProducts) || !Array.isArray(sourceProducts.value) || !targetProducts || !targetProducts.enumerable || !("value" in targetProducts) || !Array.isArray(targetProducts.value)) {
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
const sourceValues = ownArrayDataValues(sourceProducts.value);
|
|
587
|
+
const targetValues = ownArrayDataValues(targetProducts.value);
|
|
588
|
+
const count = Math.min(sourceValues.length, targetValues.length);
|
|
589
|
+
for (let index = 0; index < count; index++)
|
|
590
|
+
preserveAuthoredFormatIdsForOwner(sourceValues[index], targetValues[index]);
|
|
591
|
+
}
|
|
592
|
+
function preserveAuthoredFormatIdsForOwner(source, target) {
|
|
593
|
+
if (source === null || target === null || typeof source !== "object" || typeof target !== "object") return;
|
|
594
|
+
const sourceProductId = Object.getOwnPropertyDescriptor(source, "product_id");
|
|
595
|
+
const sourcePlacementId = Object.getOwnPropertyDescriptor(source, "placement_id");
|
|
596
|
+
const recognizedOwner = sourceProductId?.enumerable && "value" in sourceProductId && typeof sourceProductId.value === "string" || sourcePlacementId?.enumerable && "value" in sourcePlacementId && typeof sourcePlacementId.value === "string";
|
|
597
|
+
if (!recognizedOwner) return;
|
|
598
|
+
const sourceFormatIds = Object.getOwnPropertyDescriptor(source, "format_ids");
|
|
599
|
+
const targetFormatOptions = Object.getOwnPropertyDescriptor(target, "format_options");
|
|
600
|
+
if (sourceFormatIds && sourceFormatIds.enumerable && "value" in sourceFormatIds && Array.isArray(sourceFormatIds.value) && targetFormatOptions && targetFormatOptions.enumerable && "value" in targetFormatOptions && Array.isArray(targetFormatOptions.value)) {
|
|
601
|
+
authoredFormatIdsByOwner.set(
|
|
602
|
+
target,
|
|
603
|
+
ownArrayDataValues(sourceFormatIds.value).map((ref) => cloneWireData(ref))
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
const sourcePlacements = Object.getOwnPropertyDescriptor(source, "placements");
|
|
607
|
+
const targetPlacements = Object.getOwnPropertyDescriptor(target, "placements");
|
|
608
|
+
if (sourcePlacements && sourcePlacements.enumerable && "value" in sourcePlacements && Array.isArray(sourcePlacements.value) && targetPlacements && targetPlacements.enumerable && "value" in targetPlacements && Array.isArray(targetPlacements.value)) {
|
|
609
|
+
const sourceValues = ownArrayDataValues(sourcePlacements.value);
|
|
610
|
+
const targetValues = ownArrayDataValues(targetPlacements.value);
|
|
611
|
+
const count = Math.min(sourceValues.length, targetValues.length);
|
|
612
|
+
for (let index = 0; index < count; index++) {
|
|
613
|
+
preserveAuthoredFormatIdsForOwner(sourceValues[index], targetValues[index]);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
516
616
|
}
|
|
517
|
-
function
|
|
617
|
+
function removeResolvedLegacyDropErrors(response, diagnostics) {
|
|
618
|
+
if (response === null || typeof response !== "object") return response;
|
|
619
|
+
const resolved = diagnostics.filter((diagnostic) => diagnostic.code === "LEGACY_FORMAT_ID_DROPPED_UNMAPPED");
|
|
620
|
+
if (resolved.length === 0) return response;
|
|
621
|
+
const record = response;
|
|
622
|
+
if (!Array.isArray(record.errors)) return response;
|
|
623
|
+
const retained = [];
|
|
624
|
+
for (const value of ownArrayDataValues(record.errors)) {
|
|
625
|
+
let matchesResolvedDiagnostic = false;
|
|
626
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
627
|
+
const error = value;
|
|
628
|
+
for (const diagnostic of resolved) {
|
|
629
|
+
if (error.code === diagnostic.code && error.field === diagnostic.field && error.source === diagnostic.source && error.sdk_id === diagnostic.sdk_id && jsonValuesEqual(error.details, diagnostic.error.details)) {
|
|
630
|
+
matchesResolvedDiagnostic = true;
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
if (!matchesResolvedDiagnostic) retained.push(value);
|
|
636
|
+
}
|
|
637
|
+
if (retained.length > 0) return { ...record, errors: retained };
|
|
638
|
+
const { errors: _resolvedErrors, ...withoutErrors } = record;
|
|
639
|
+
void _resolvedErrors;
|
|
640
|
+
return withoutErrors;
|
|
641
|
+
}
|
|
642
|
+
function legacyFormatRefKey(value) {
|
|
643
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
644
|
+
const ref = value;
|
|
645
|
+
if (typeof ref.agent_url !== "string" || typeof ref.id !== "string") return void 0;
|
|
646
|
+
const agentUrl = (0, import_resolve_agent_properties.canonicalizeAgentUrl)(ref.agent_url) ?? ref.agent_url;
|
|
647
|
+
return `${agentUrl}::${ref.id}::${String(ref.width ?? "")}x${String(ref.height ?? "")}::${String(ref.duration_ms ?? "")}`;
|
|
648
|
+
}
|
|
649
|
+
function jsonValuesEqual(left, right) {
|
|
650
|
+
if (Object.is(left, right)) return true;
|
|
651
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
652
|
+
if (!Array.isArray(left) || !Array.isArray(right)) return false;
|
|
653
|
+
const leftValues = ownArrayDataValues(left);
|
|
654
|
+
const rightValues = ownArrayDataValues(right);
|
|
655
|
+
if (leftValues.length !== rightValues.length) return false;
|
|
656
|
+
for (let index = 0; index < leftValues.length; index++) {
|
|
657
|
+
if (!jsonValuesEqual(leftValues[index], rightValues[index])) return false;
|
|
658
|
+
}
|
|
659
|
+
return true;
|
|
660
|
+
}
|
|
661
|
+
if (left === null || right === null || typeof left !== "object" || typeof right !== "object") return false;
|
|
662
|
+
const leftRecord = left;
|
|
663
|
+
const rightRecord = right;
|
|
664
|
+
const leftKeys = Object.keys(leftRecord);
|
|
665
|
+
const rightKeys = Object.keys(rightRecord);
|
|
666
|
+
return leftKeys.length === rightKeys.length && leftKeys.every((key) => Object.hasOwn(rightRecord, key) && jsonValuesEqual(leftRecord[key], rightRecord[key]));
|
|
667
|
+
}
|
|
668
|
+
function matchLegacyRefToDeclaration(declaration, ref, ownerId, legacyFormatConverter) {
|
|
669
|
+
const projected = (0, import_v1_to_v2.projectV1ProductToV2)(
|
|
670
|
+
{
|
|
671
|
+
product_id: ownerId,
|
|
672
|
+
name: ownerId,
|
|
673
|
+
description: ownerId,
|
|
674
|
+
format_ids: [ref]
|
|
675
|
+
},
|
|
676
|
+
{ legacyFormatConverter }
|
|
677
|
+
);
|
|
678
|
+
if (projected.diagnostics.length > 0 || projected.v2.format_options.length !== 1) return "unresolved";
|
|
679
|
+
const expected = projected.v2.format_options[0];
|
|
680
|
+
if (declaration.format_kind !== expected.format_kind) return "kind_mismatch";
|
|
681
|
+
const params = declaration.params !== null && typeof declaration.params === "object" && !Array.isArray(declaration.params) ? declaration.params : {};
|
|
682
|
+
for (const [key, expectedValue] of Object.entries(expected.params)) {
|
|
683
|
+
if (!Object.hasOwn(params, key) || !jsonValuesEqual(params[key], expectedValue)) return "params_mismatch";
|
|
684
|
+
}
|
|
685
|
+
return "match";
|
|
686
|
+
}
|
|
687
|
+
function validateLegacyRefNarrowing(declaration, ref, ownerId, field, legacyFormatConverter) {
|
|
688
|
+
const match = matchLegacyRefToDeclaration(declaration, ref, ownerId, legacyFormatConverter);
|
|
689
|
+
if (match === "kind_mismatch") {
|
|
690
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
691
|
+
message: "get_products returned divergent legacy and canonical format declarations.",
|
|
692
|
+
field,
|
|
693
|
+
suggestion: "Make format_ids and format_options.v1_format_ref describe the same canonical format."
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
if (match === "params_mismatch") {
|
|
697
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
698
|
+
message: "get_products returned a canonical declaration that does not narrow its v1_format_ref.",
|
|
699
|
+
field: `${field}.params`,
|
|
700
|
+
suggestion: "Align canonical format parameters with the referenced legacy format requirements."
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
function validateDualProductFormatDeclarations(value, legacyFormatConverter) {
|
|
705
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
706
|
+
const visit = (current, path) => {
|
|
707
|
+
if (current === null || typeof current !== "object" || seen.has(current)) return;
|
|
708
|
+
seen.add(current);
|
|
709
|
+
if (Array.isArray(current)) {
|
|
710
|
+
const entries = ownArrayDataValues(current);
|
|
711
|
+
for (let index = 0; index < entries.length; index++) visit(entries[index], `${path}[${index}]`);
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
const record = current;
|
|
715
|
+
const formatOptions = Array.isArray(record.format_options) ? record.format_options : void 0;
|
|
716
|
+
const ownerId = typeof record.product_id === "string" ? record.product_id : typeof record.placement_id === "string" ? record.placement_id : void 0;
|
|
717
|
+
if (formatOptions && ownerId !== void 0) {
|
|
718
|
+
const declarationRefs = [];
|
|
719
|
+
const declarations = ownArrayDataValues(formatOptions);
|
|
720
|
+
for (let index = 0; index < declarations.length; index++) {
|
|
721
|
+
const value2 = declarations[index];
|
|
722
|
+
if (value2 === null || typeof value2 !== "object" || Array.isArray(value2)) continue;
|
|
723
|
+
const declaration = value2;
|
|
724
|
+
const refs = ownArrayDataValues(
|
|
725
|
+
(0, import_legacy_metadata.legacyFormatRefsForDeclaration)(declaration)
|
|
726
|
+
);
|
|
727
|
+
const field = `${path}.format_options[${index}]`;
|
|
728
|
+
if (declaration.canonical_formats_only === true && refs.length > 0) {
|
|
729
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
730
|
+
message: "get_products returned canonical_formats_only together with v1_format_ref.",
|
|
731
|
+
field,
|
|
732
|
+
suggestion: "Remove v1_format_ref or set canonical_formats_only to false."
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
declarationRefs.push(...refs);
|
|
736
|
+
for (const ref of refs) {
|
|
737
|
+
validateLegacyRefNarrowing(declaration, ref, ownerId, field, legacyFormatConverter);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
if (Array.isArray(record.format_ids)) {
|
|
741
|
+
const formatIds = ownArrayDataValues(record.format_ids);
|
|
742
|
+
const formatIdKeys = /* @__PURE__ */ new Set();
|
|
743
|
+
for (const ref of formatIds) {
|
|
744
|
+
const key = legacyFormatRefKey(ref);
|
|
745
|
+
if (key !== void 0) formatIdKeys.add(key);
|
|
746
|
+
}
|
|
747
|
+
const declarationRefKeys = /* @__PURE__ */ new Set();
|
|
748
|
+
for (const ref of declarationRefs) {
|
|
749
|
+
const key = legacyFormatRefKey(ref);
|
|
750
|
+
if (key !== void 0) declarationRefKeys.add(key);
|
|
751
|
+
}
|
|
752
|
+
let divergent = false;
|
|
753
|
+
for (const key of declarationRefKeys) {
|
|
754
|
+
if (!formatIdKeys.has(key)) divergent = true;
|
|
755
|
+
}
|
|
756
|
+
for (const ref of formatIds) {
|
|
757
|
+
const key = legacyFormatRefKey(ref);
|
|
758
|
+
if (key !== void 0 && declarationRefKeys.has(key)) continue;
|
|
759
|
+
let matched = false;
|
|
760
|
+
for (const value2 of declarations) {
|
|
761
|
+
if (value2 !== null && typeof value2 === "object" && !Array.isArray(value2) && value2.canonical_formats_only !== true && matchLegacyRefToDeclaration(value2, ref, ownerId, legacyFormatConverter) === "match") {
|
|
762
|
+
matched = true;
|
|
763
|
+
break;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
if (!matched) divergent = true;
|
|
767
|
+
}
|
|
768
|
+
if (divergent) {
|
|
769
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
770
|
+
message: "get_products returned divergent format_ids and format_options.v1_format_ref values.",
|
|
771
|
+
field: path,
|
|
772
|
+
suggestion: "Dual-emitted product declarations must carry the same legacy format references."
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
for (const [key, child] of Object.entries(record)) {
|
|
778
|
+
if (key === "format_options") continue;
|
|
779
|
+
visit(child, `${path}.${key}`);
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
visit(value, "$");
|
|
783
|
+
}
|
|
784
|
+
function attachCanonicalFormatWireRefs(value, canonicalFormatLegacyResolver, operation, emitTransitionalLegacyRefs = false) {
|
|
518
785
|
const visit = (current) => {
|
|
519
|
-
if (Array.isArray(current))
|
|
786
|
+
if (Array.isArray(current)) {
|
|
787
|
+
const mapped = [];
|
|
788
|
+
for (const entry of ownArrayDataValues(current)) mapped.push(visit(entry));
|
|
789
|
+
return mapped;
|
|
790
|
+
}
|
|
520
791
|
if (current === null || typeof current !== "object") return current;
|
|
521
792
|
const record = current;
|
|
522
793
|
const hasFormatDeclarations = Array.isArray(record.format_options);
|
|
523
794
|
const declarationOwner = typeof record.product_id === "string" ? record.product_id : typeof record.placement_id === "string" ? record.placement_id : "(response)";
|
|
524
795
|
let projected = record;
|
|
525
796
|
if (hasFormatDeclarations) {
|
|
526
|
-
const
|
|
527
|
-
|
|
797
|
+
const wireLegacyRefs = [];
|
|
798
|
+
const wireLegacyRefKeys = /* @__PURE__ */ new Set();
|
|
799
|
+
const appendWireLegacyRefs = (refs) => {
|
|
800
|
+
for (const ref of refs) {
|
|
801
|
+
const key = legacyFormatRefKey(ref);
|
|
802
|
+
if (key === void 0 || wireLegacyRefKeys.has(key)) continue;
|
|
803
|
+
wireLegacyRefKeys.add(key);
|
|
804
|
+
wireLegacyRefs.push(cloneWireData(ref));
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
if (emitTransitionalLegacyRefs) {
|
|
808
|
+
const authoredRefs = authoredFormatIdsByOwner.get(record);
|
|
809
|
+
if (authoredRefs) appendWireLegacyRefs(authoredRefs);
|
|
810
|
+
}
|
|
811
|
+
const formatOptions = [];
|
|
812
|
+
const declarations = ownArrayDataValues(record.format_options);
|
|
813
|
+
for (let index = 0; index < declarations.length; index++) {
|
|
814
|
+
const value2 = declarations[index];
|
|
815
|
+
if (value2 === null || typeof value2 !== "object" || Array.isArray(value2)) {
|
|
816
|
+
formatOptions.push(value2);
|
|
817
|
+
continue;
|
|
818
|
+
}
|
|
528
819
|
const declaration = value2;
|
|
529
|
-
if (declaration.
|
|
530
|
-
|
|
820
|
+
if (declaration.canonical_formats_only === true) {
|
|
821
|
+
formatOptions.push(declaration);
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
let refs = ownArrayDataValues(
|
|
825
|
+
(0, import_legacy_metadata.legacyFormatRefsForDeclaration)(declaration)
|
|
826
|
+
);
|
|
827
|
+
if (emitTransitionalLegacyRefs && refs.length > 0) {
|
|
828
|
+
const clonedRefs2 = refs.map((ref) => cloneWireData(ref));
|
|
829
|
+
appendWireLegacyRefs(clonedRefs2);
|
|
830
|
+
formatOptions.push({ ...declaration, v1_format_ref: clonedRefs2 });
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
if (declaration.format_kind !== "custom") {
|
|
834
|
+
formatOptions.push(declaration);
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
531
837
|
if (refs.length === 0) {
|
|
532
838
|
try {
|
|
533
|
-
|
|
839
|
+
const resolved = (0, import_v2_to_v1.resolveCanonicalFormatLegacyRefs)(canonicalFormatLegacyResolver, {
|
|
534
840
|
source: "product",
|
|
535
841
|
declaration,
|
|
536
842
|
productId: declarationOwner,
|
|
537
843
|
field: `${declarationOwner}.format_options[${index}]`
|
|
538
|
-
})
|
|
844
|
+
});
|
|
845
|
+
refs = resolved ? ownArrayDataValues(resolved) : [];
|
|
539
846
|
} catch (error) {
|
|
540
847
|
if (!(error instanceof import_v2_to_v1.CanonicalFormatLegacyResolutionError)) throw error;
|
|
541
848
|
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
@@ -552,9 +859,15 @@ function attachCanonicalCustomFormatWireRefs(value, canonicalFormatLegacyResolve
|
|
|
552
859
|
"custom canonical declaration must set canonical_formats_only or provide an explicit legacy mapping"
|
|
553
860
|
);
|
|
554
861
|
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
862
|
+
const clonedRefs = refs.map((ref) => cloneWireData(ref));
|
|
863
|
+
if (emitTransitionalLegacyRefs) appendWireLegacyRefs(clonedRefs);
|
|
864
|
+
formatOptions.push({ ...declaration, v1_format_ref: clonedRefs });
|
|
865
|
+
}
|
|
866
|
+
projected = {
|
|
867
|
+
...record,
|
|
868
|
+
format_options: formatOptions,
|
|
869
|
+
...emitTransitionalLegacyRefs && wireLegacyRefs.length > 0 && { format_ids: wireLegacyRefs }
|
|
870
|
+
};
|
|
558
871
|
}
|
|
559
872
|
let changed = projected !== record;
|
|
560
873
|
const next = { ...projected };
|
|
@@ -570,9 +883,18 @@ function attachCanonicalCustomFormatWireRefs(value, canonicalFormatLegacyResolve
|
|
|
570
883
|
};
|
|
571
884
|
return visit(value);
|
|
572
885
|
}
|
|
573
|
-
function asProductResponseForWire(canonicalResponse, wireMode, canonicalFormatLegacyResolver) {
|
|
886
|
+
function asProductResponseForWire(canonicalResponse, wireMode, canonicalFormatLegacyResolver, emitTransitionalLegacyRefs = false) {
|
|
574
887
|
if (wireMode === "canonical") {
|
|
575
|
-
|
|
888
|
+
const responseForWire = emitTransitionalLegacyRefs && canonicalResponse !== null && typeof canonicalResponse === "object" ? removeResolvedLegacyDropErrors(
|
|
889
|
+
canonicalResponse,
|
|
890
|
+
resolvedLegacyDropDiagnosticsByResponse.get(canonicalResponse) ?? []
|
|
891
|
+
) : canonicalResponse;
|
|
892
|
+
return attachCanonicalFormatWireRefs(
|
|
893
|
+
responseForWire,
|
|
894
|
+
canonicalFormatLegacyResolver,
|
|
895
|
+
"get_products",
|
|
896
|
+
emitTransitionalLegacyRefs
|
|
897
|
+
);
|
|
576
898
|
}
|
|
577
899
|
if (!Array.isArray(canonicalResponse.products)) return canonicalResponse;
|
|
578
900
|
const products = canonicalResponse.products.map((product) => {
|
|
@@ -2484,7 +2806,8 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2484
2806
|
return asProductResponseForWire(
|
|
2485
2807
|
canonicalResult,
|
|
2486
2808
|
responseWireMode,
|
|
2487
|
-
canonicalFormatLegacyResolver
|
|
2809
|
+
canonicalFormatLegacyResolver,
|
|
2810
|
+
shouldEmitTransitionalDualCreativeWire(ctx.servedAdcpVersion, params)
|
|
2488
2811
|
);
|
|
2489
2812
|
};
|
|
2490
2813
|
const isHandoff = (0, import_async_outcome2.isTaskHandoff)(result);
|
|
@@ -2706,46 +3029,45 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2706
3029
|
);
|
|
2707
3030
|
}
|
|
2708
3031
|
},
|
|
2709
|
-
syncCreatives
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
return (
|
|
2716
|
-
|
|
2717
|
-
|
|
3032
|
+
...sales?.syncCreatives && {
|
|
3033
|
+
syncCreatives: async (params, ctx) => {
|
|
3034
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
3035
|
+
params = asCanonicalSemanticServerRequest(params, "sync_creatives", legacyFormatConverter);
|
|
3036
|
+
const reqCtx = ctxFor(ctx, params);
|
|
3037
|
+
const creatives = params.creatives ?? [];
|
|
3038
|
+
return projectSync(
|
|
3039
|
+
async () => {
|
|
3040
|
+
const push = extractPushConfig(params, logger, {
|
|
3041
|
+
allowPrivateWebhookUrls: pushOpts.allowPrivateWebhookUrls
|
|
3042
|
+
});
|
|
3043
|
+
const result = await sales.syncCreatives(creatives, reqCtx);
|
|
3044
|
+
return routeIfHandoff(
|
|
3045
|
+
taskRegistry,
|
|
3046
|
+
{
|
|
3047
|
+
tool: "sync_creatives",
|
|
3048
|
+
accountId: reqCtx.account.id,
|
|
3049
|
+
ownerScope: taskOwnerScopeFor(ctx, reqCtx.account.id),
|
|
3050
|
+
pushNotificationUrl: push.url,
|
|
3051
|
+
pushNotificationToken: push.token,
|
|
3052
|
+
pushNotificationOperationId: push.operationId,
|
|
3053
|
+
emitWebhook: taskWebhookEmit ?? ctx.emitWebhook,
|
|
3054
|
+
autoEmitCompletion: pushOpts.autoEmitCompletionWebhooks,
|
|
3055
|
+
observability,
|
|
3056
|
+
logger
|
|
3057
|
+
},
|
|
3058
|
+
result,
|
|
3059
|
+
(rows) => asSemanticServerResponseForWire(
|
|
3060
|
+
{ creatives: rows.map(normalizeRowErrors) },
|
|
3061
|
+
"sync_creatives",
|
|
3062
|
+
legacyFormatConverter,
|
|
3063
|
+
canonicalFormatLegacyResolver,
|
|
3064
|
+
responseWireMode
|
|
3065
|
+
)
|
|
3066
|
+
);
|
|
3067
|
+
},
|
|
3068
|
+
(r) => r
|
|
3069
|
+
);
|
|
2718
3070
|
}
|
|
2719
|
-
return projectSync(
|
|
2720
|
-
async () => {
|
|
2721
|
-
const push = extractPushConfig(params, logger, { allowPrivateWebhookUrls: pushOpts.allowPrivateWebhookUrls });
|
|
2722
|
-
const result = await sales.syncCreatives(creatives, reqCtx);
|
|
2723
|
-
return routeIfHandoff(
|
|
2724
|
-
taskRegistry,
|
|
2725
|
-
{
|
|
2726
|
-
tool: "sync_creatives",
|
|
2727
|
-
accountId: reqCtx.account.id,
|
|
2728
|
-
ownerScope: taskOwnerScopeFor(ctx, reqCtx.account.id),
|
|
2729
|
-
pushNotificationUrl: push.url,
|
|
2730
|
-
pushNotificationToken: push.token,
|
|
2731
|
-
pushNotificationOperationId: push.operationId,
|
|
2732
|
-
emitWebhook: taskWebhookEmit ?? ctx.emitWebhook,
|
|
2733
|
-
autoEmitCompletion: pushOpts.autoEmitCompletionWebhooks,
|
|
2734
|
-
observability,
|
|
2735
|
-
logger
|
|
2736
|
-
},
|
|
2737
|
-
result,
|
|
2738
|
-
(rows) => asSemanticServerResponseForWire(
|
|
2739
|
-
{ creatives: rows.map(normalizeRowErrors) },
|
|
2740
|
-
"sync_creatives",
|
|
2741
|
-
legacyFormatConverter,
|
|
2742
|
-
canonicalFormatLegacyResolver,
|
|
2743
|
-
responseWireMode
|
|
2744
|
-
)
|
|
2745
|
-
);
|
|
2746
|
-
},
|
|
2747
|
-
(r) => r
|
|
2748
|
-
);
|
|
2749
3071
|
},
|
|
2750
3072
|
...sales?.getMediaBuyDelivery && {
|
|
2751
3073
|
getMediaBuyDelivery: async (params, ctx) => {
|
|
@@ -2828,7 +3150,7 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2828
3150
|
"media_buy_id",
|
|
2829
3151
|
logger
|
|
2830
3152
|
);
|
|
2831
|
-
const wireResult = responseWireMode === "canonical" ?
|
|
3153
|
+
const wireResult = responseWireMode === "canonical" ? attachCanonicalFormatWireRefs(canonicalResult, canonicalFormatLegacyResolver, "get_media_buys") : asSemanticServerResponseForWire(
|
|
2832
3154
|
result,
|
|
2833
3155
|
"get_media_buys",
|
|
2834
3156
|
legacyFormatConverter,
|
|
@@ -2881,7 +3203,8 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2881
3203
|
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2882
3204
|
const canonicalParams = asCanonicalListCreativesRequest(
|
|
2883
3205
|
params,
|
|
2884
|
-
legacyFormatConverter
|
|
3206
|
+
legacyFormatConverter,
|
|
3207
|
+
responseWireMode
|
|
2885
3208
|
);
|
|
2886
3209
|
const reqCtx = ctxFor(ctx, canonicalParams);
|
|
2887
3210
|
return projectSync(
|
|
@@ -3014,7 +3337,8 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
3014
3337
|
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
3015
3338
|
const canonicalParams = asCanonicalListCreativesRequest(
|
|
3016
3339
|
params,
|
|
3017
|
-
legacyFormatConverter
|
|
3340
|
+
legacyFormatConverter,
|
|
3341
|
+
responseWireMode
|
|
3018
3342
|
);
|
|
3019
3343
|
const reqCtx = ctxFor(ctx, canonicalParams);
|
|
3020
3344
|
return projectSync(
|