@adcp/sdk 12.1.1 → 13.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -3
- package/bin/adcp-fuzz.js +3 -1
- package/dist/lib/adapters/content-standards-adapter.d.mts +9 -9
- package/dist/lib/adapters/content-standards-adapter.d.ts +9 -9
- package/dist/lib/adapters/content-standards-adapter.d.ts.map +1 -1
- package/dist/lib/adapters/content-standards-adapter.js +22 -22
- package/dist/lib/adapters/content-standards-adapter.js.map +1 -1
- package/dist/lib/adapters/content-standards-adapter.mjs +18 -18
- package/dist/lib/adapters/content-standards-adapter.mjs.map +1 -1
- package/dist/lib/adapters/index.d.mts +2 -2
- package/dist/lib/adapters/index.d.ts +2 -2
- package/dist/lib/adapters/index.d.ts.map +1 -1
- package/dist/lib/adapters/index.js +10 -10
- package/dist/lib/adapters/index.js.map +1 -1
- package/dist/lib/adapters/index.mjs +9 -9
- package/dist/lib/adapters/index.mjs.map +1 -1
- package/dist/lib/auth/oauth/provider-cache.d.mts +7 -0
- package/dist/lib/auth/oauth/provider-cache.d.ts +8 -0
- package/dist/lib/auth/oauth/provider-cache.d.ts.map +1 -0
- package/dist/lib/auth/oauth/provider-cache.js +44 -0
- package/dist/lib/auth/oauth/provider-cache.js.map +1 -0
- package/dist/lib/auth/oauth/provider-cache.mjs +19 -0
- package/dist/lib/auth/oauth/provider-cache.mjs.map +1 -0
- package/dist/lib/conformance/invariants/uniformError.js +1 -1
- package/dist/lib/conformance/invariants/uniformError.js.map +1 -1
- package/dist/lib/conformance/invariants/uniformError.mjs +1 -1
- package/dist/lib/conformance/invariants/uniformError.mjs.map +1 -1
- package/dist/lib/conformance/runners.js +1 -1
- package/dist/lib/conformance/runners.js.map +1 -1
- package/dist/lib/conformance/runners.mjs +1 -1
- package/dist/lib/conformance/runners.mjs.map +1 -1
- package/dist/lib/conformance/seeder.js +5 -5
- package/dist/lib/conformance/seeder.js.map +1 -1
- package/dist/lib/conformance/seeder.mjs +5 -5
- package/dist/lib/conformance/seeder.mjs.map +1 -1
- package/dist/lib/core/ADCPMultiAgentClient.d.mts +26 -29
- package/dist/lib/core/ADCPMultiAgentClient.d.ts +26 -29
- package/dist/lib/core/ADCPMultiAgentClient.d.ts.map +1 -1
- package/dist/lib/core/ADCPMultiAgentClient.js +27 -19
- package/dist/lib/core/ADCPMultiAgentClient.js.map +1 -1
- package/dist/lib/core/ADCPMultiAgentClient.mjs +27 -19
- package/dist/lib/core/ADCPMultiAgentClient.mjs.map +1 -1
- package/dist/lib/core/AgentClient.d.mts +148 -138
- package/dist/lib/core/AgentClient.d.ts +148 -138
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/AgentClient.js +174 -85
- package/dist/lib/core/AgentClient.js.map +1 -1
- package/dist/lib/core/AgentClient.mjs +174 -85
- package/dist/lib/core/AgentClient.mjs.map +1 -1
- package/dist/lib/core/AsyncHandler.d.mts +18 -16
- package/dist/lib/core/AsyncHandler.d.ts +18 -16
- package/dist/lib/core/AsyncHandler.d.ts.map +1 -1
- package/dist/lib/core/AsyncHandler.js +22 -1
- package/dist/lib/core/AsyncHandler.js.map +1 -1
- package/dist/lib/core/AsyncHandler.mjs +22 -1
- package/dist/lib/core/AsyncHandler.mjs.map +1 -1
- package/dist/lib/core/ConversationTypes.d.mts +6 -2
- package/dist/lib/core/ConversationTypes.d.ts +6 -2
- package/dist/lib/core/ConversationTypes.d.ts.map +1 -1
- package/dist/lib/core/ConversationTypes.js.map +1 -1
- package/dist/lib/core/CreativeAgentClient.d.mts +41 -17
- package/dist/lib/core/CreativeAgentClient.d.ts +41 -17
- package/dist/lib/core/CreativeAgentClient.d.ts.map +1 -1
- package/dist/lib/core/CreativeAgentClient.js +39 -12
- package/dist/lib/core/CreativeAgentClient.js.map +1 -1
- package/dist/lib/core/CreativeAgentClient.mjs +39 -12
- package/dist/lib/core/CreativeAgentClient.mjs.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.mts +127 -50
- package/dist/lib/core/SingleAgentClient.d.ts +127 -50
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +1617 -177
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/core/SingleAgentClient.mjs +1627 -177
- package/dist/lib/core/SingleAgentClient.mjs.map +1 -1
- package/dist/lib/core/TaskExecutor.d.mts +9 -0
- package/dist/lib/core/TaskExecutor.d.ts +9 -0
- package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
- package/dist/lib/core/TaskExecutor.js +136 -43
- package/dist/lib/core/TaskExecutor.js.map +1 -1
- package/dist/lib/core/TaskExecutor.mjs +136 -43
- package/dist/lib/core/TaskExecutor.mjs.map +1 -1
- package/dist/lib/index.d.mts +111 -17
- package/dist/lib/index.d.ts +111 -17
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +94 -94
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +93 -94
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +6 -15
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/protocols/index.mjs +6 -16
- package/dist/lib/protocols/index.mjs.map +1 -1
- package/dist/lib/protocols/mcp-modern.d.ts.map +1 -1
- package/dist/lib/protocols/mcp-modern.js +87 -12
- package/dist/lib/protocols/mcp-modern.js.map +1 -1
- package/dist/lib/protocols/mcp-modern.mjs +89 -12
- package/dist/lib/protocols/mcp-modern.mjs.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/create-adcp-server.d.mts +6 -0
- package/dist/lib/server/create-adcp-server.d.ts +6 -0
- package/dist/lib/server/create-adcp-server.d.ts.map +1 -1
- package/dist/lib/server/create-adcp-server.js +295 -48
- package/dist/lib/server/create-adcp-server.js.map +1 -1
- package/dist/lib/server/create-adcp-server.mjs +301 -50
- package/dist/lib/server/create-adcp-server.mjs.map +1 -1
- package/dist/lib/server/decisioning/assembly-helpers.d.mts +27 -13
- package/dist/lib/server/decisioning/assembly-helpers.d.ts +27 -13
- package/dist/lib/server/decisioning/assembly-helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/assembly-helpers.js +136 -14
- package/dist/lib/server/decisioning/assembly-helpers.js.map +1 -1
- package/dist/lib/server/decisioning/assembly-helpers.mjs +134 -13
- package/dist/lib/server/decisioning/assembly-helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/index.d.mts +13 -12
- package/dist/lib/server/decisioning/index.d.ts +13 -12
- package/dist/lib/server/decisioning/index.d.ts.map +1 -1
- package/dist/lib/server/decisioning/index.js +6 -0
- package/dist/lib/server/decisioning/index.js.map +1 -1
- package/dist/lib/server/decisioning/index.mjs +9 -3
- package/dist/lib/server/decisioning/index.mjs.map +1 -1
- package/dist/lib/server/decisioning/list-helpers.d.mts +13 -3
- package/dist/lib/server/decisioning/list-helpers.d.ts +13 -3
- package/dist/lib/server/decisioning/list-helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/list-helpers.js +13 -3
- package/dist/lib/server/decisioning/list-helpers.js.map +1 -1
- package/dist/lib/server/decisioning/list-helpers.mjs +11 -2
- package/dist/lib/server/decisioning/list-helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.d.mts +5 -3
- package/dist/lib/server/decisioning/manifest-helpers.d.ts +5 -3
- package/dist/lib/server/decisioning/manifest-helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.js.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/dispatch.d.mts +2 -2
- package/dist/lib/server/decisioning/proposal/dispatch.d.ts +2 -2
- package/dist/lib/server/decisioning/proposal/dispatch.d.ts.map +1 -1
- package/dist/lib/server/decisioning/proposal/dispatch.js.map +1 -1
- package/dist/lib/server/decisioning/proposal/dispatch.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/index.d.mts +1 -1
- package/dist/lib/server/decisioning/proposal/index.d.ts +1 -1
- package/dist/lib/server/decisioning/proposal/index.d.ts.map +1 -1
- package/dist/lib/server/decisioning/proposal/index.js.map +1 -1
- package/dist/lib/server/decisioning/proposal/index.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/lifecycle.d.mts +3 -2
- package/dist/lib/server/decisioning/proposal/lifecycle.d.ts +3 -2
- package/dist/lib/server/decisioning/proposal/lifecycle.d.ts.map +1 -1
- package/dist/lib/server/decisioning/proposal/lifecycle.js.map +1 -1
- package/dist/lib/server/decisioning/proposal/lifecycle.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/mock-manager.d.mts +3 -3
- package/dist/lib/server/decisioning/proposal/mock-manager.d.ts +3 -3
- package/dist/lib/server/decisioning/proposal/mock-manager.d.ts.map +1 -1
- package/dist/lib/server/decisioning/proposal/mock-manager.js.map +1 -1
- package/dist/lib/server/decisioning/proposal/mock-manager.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/types.d.mts +10 -6
- package/dist/lib/server/decisioning/proposal/types.d.ts +10 -6
- package/dist/lib/server/decisioning/proposal/types.d.ts.map +1 -1
- package/dist/lib/server/decisioning/proposal/types.js.map +1 -1
- package/dist/lib/server/decisioning/proposal/types.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +21 -2
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +21 -2
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.js +754 -81
- package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +763 -81
- package/dist/lib/server/decisioning/runtime/from-platform.mjs.map +1 -1
- package/dist/lib/server/decisioning/specialisms/brand-rights.d.mts +9 -9
- package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts +9 -9
- package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/brand-rights.js.map +1 -1
- package/dist/lib/server/decisioning/specialisms/content-standards.d.mts +16 -16
- package/dist/lib/server/decisioning/specialisms/content-standards.d.ts +16 -16
- package/dist/lib/server/decisioning/specialisms/content-standards.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/content-standards.js.map +1 -1
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.mts +15 -13
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts +15 -13
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.js.map +1 -1
- package/dist/lib/server/decisioning/specialisms/creative.d.mts +12 -11
- package/dist/lib/server/decisioning/specialisms/creative.d.ts +12 -11
- package/dist/lib/server/decisioning/specialisms/creative.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/creative.js.map +1 -1
- package/dist/lib/server/decisioning/specialisms/sales.d.mts +25 -15
- package/dist/lib/server/decisioning/specialisms/sales.d.ts +25 -15
- package/dist/lib/server/decisioning/specialisms/sales.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/sales.js.map +1 -1
- package/dist/lib/server/index.d.mts +3 -3
- package/dist/lib/server/index.d.ts +3 -3
- package/dist/lib/server/index.d.ts.map +1 -1
- package/dist/lib/server/index.js +72 -72
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/server/index.mjs +36 -36
- package/dist/lib/server/index.mjs.map +1 -1
- package/dist/lib/server/legacy/v5/index.d.mts +1 -0
- package/dist/lib/server/legacy/v5/index.d.ts +1 -0
- package/dist/lib/server/legacy/v5/index.d.ts.map +1 -1
- package/dist/lib/server/legacy/v5/index.js +74 -1
- package/dist/lib/server/legacy/v5/index.js.map +1 -1
- package/dist/lib/server/legacy/v5/index.mjs +75 -1
- package/dist/lib/server/legacy/v5/index.mjs.map +1 -1
- package/dist/lib/server/responses.d.mts +2 -2
- package/dist/lib/server/responses.d.ts +2 -2
- package/dist/lib/server/responses.js.map +1 -1
- package/dist/lib/server/responses.mjs.map +1 -1
- package/dist/lib/testing/client.js +1 -1
- package/dist/lib/testing/client.js.map +1 -1
- package/dist/lib/testing/client.mjs +1 -1
- package/dist/lib/testing/client.mjs.map +1 -1
- package/dist/lib/testing/scenarios/brand-rights.js +6 -6
- package/dist/lib/testing/scenarios/brand-rights.js.map +1 -1
- package/dist/lib/testing/scenarios/brand-rights.mjs +6 -6
- package/dist/lib/testing/scenarios/brand-rights.mjs.map +1 -1
- package/dist/lib/testing/scenarios/creative.js +7 -7
- package/dist/lib/testing/scenarios/creative.js.map +1 -1
- package/dist/lib/testing/scenarios/creative.mjs +7 -7
- package/dist/lib/testing/scenarios/creative.mjs.map +1 -1
- package/dist/lib/testing/scenarios/discovery.js +2 -2
- package/dist/lib/testing/scenarios/discovery.js.map +1 -1
- package/dist/lib/testing/scenarios/discovery.mjs +2 -2
- package/dist/lib/testing/scenarios/discovery.mjs.map +1 -1
- package/dist/lib/testing/scenarios/edge-cases.js +11 -11
- package/dist/lib/testing/scenarios/edge-cases.js.map +1 -1
- package/dist/lib/testing/scenarios/edge-cases.mjs +11 -11
- package/dist/lib/testing/scenarios/edge-cases.mjs.map +1 -1
- package/dist/lib/testing/scenarios/governance.d.ts.map +1 -1
- package/dist/lib/testing/scenarios/governance.js +16 -22
- package/dist/lib/testing/scenarios/governance.js.map +1 -1
- package/dist/lib/testing/scenarios/governance.mjs +16 -22
- package/dist/lib/testing/scenarios/governance.mjs.map +1 -1
- package/dist/lib/testing/scenarios/media-buy.js +5 -5
- package/dist/lib/testing/scenarios/media-buy.js.map +1 -1
- package/dist/lib/testing/scenarios/media-buy.mjs +5 -5
- package/dist/lib/testing/scenarios/media-buy.mjs.map +1 -1
- package/dist/lib/testing/scenarios/schema-compliance.js +1 -1
- package/dist/lib/testing/scenarios/schema-compliance.js.map +1 -1
- package/dist/lib/testing/scenarios/schema-compliance.mjs +1 -1
- package/dist/lib/testing/scenarios/schema-compliance.mjs.map +1 -1
- package/dist/lib/testing/scenarios/trusted-match.d.ts.map +1 -1
- package/dist/lib/testing/scenarios/trusted-match.js +4 -3
- package/dist/lib/testing/scenarios/trusted-match.js.map +1 -1
- package/dist/lib/testing/scenarios/trusted-match.mjs +4 -3
- package/dist/lib/testing/scenarios/trusted-match.mjs.map +1 -1
- package/dist/lib/testing/storyboard/shape-drift-hints.d.mts +3 -4
- package/dist/lib/testing/storyboard/shape-drift-hints.d.ts +3 -4
- package/dist/lib/testing/storyboard/shape-drift-hints.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/shape-drift-hints.js +27 -27
- package/dist/lib/testing/storyboard/shape-drift-hints.js.map +1 -1
- package/dist/lib/testing/storyboard/shape-drift-hints.mjs +27 -27
- package/dist/lib/testing/storyboard/shape-drift-hints.mjs.map +1 -1
- package/dist/lib/testing/storyboard/task-map.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/task-map.js +43 -5
- package/dist/lib/testing/storyboard/task-map.js.map +1 -1
- package/dist/lib/testing/storyboard/task-map.mjs +43 -5
- package/dist/lib/testing/storyboard/task-map.mjs.map +1 -1
- package/dist/lib/testing/test-helpers.d.mts +2 -2
- package/dist/lib/testing/test-helpers.d.ts +2 -2
- package/dist/lib/testing/test-helpers.js.map +1 -1
- package/dist/lib/testing/test-helpers.mjs.map +1 -1
- package/dist/lib/types/adcp.d.mts +14 -14
- package/dist/lib/types/adcp.d.ts +14 -14
- package/dist/lib/types/adcp.d.ts.map +1 -1
- package/dist/lib/types/adcp.js.map +1 -1
- package/dist/lib/types/adcp.mjs.map +1 -1
- package/dist/lib/types/index.d.mts +2 -2
- package/dist/lib/types/index.d.ts +2 -2
- package/dist/lib/types/index.d.ts.map +1 -1
- package/dist/lib/types/index.js.map +1 -1
- package/dist/lib/types/index.mjs.map +1 -1
- package/dist/lib/utils/capabilities.d.mts +6 -0
- package/dist/lib/utils/capabilities.d.ts +6 -0
- package/dist/lib/utils/capabilities.d.ts.map +1 -1
- package/dist/lib/utils/capabilities.js +4 -0
- package/dist/lib/utils/capabilities.js.map +1 -1
- package/dist/lib/utils/capabilities.mjs +4 -0
- package/dist/lib/utils/capabilities.mjs.map +1 -1
- package/dist/lib/utils/creative-delivery.d.mts +52 -10
- package/dist/lib/utils/creative-delivery.d.ts +52 -10
- package/dist/lib/utils/creative-delivery.d.ts.map +1 -1
- package/dist/lib/utils/creative-delivery.js +104 -9
- package/dist/lib/utils/creative-delivery.js.map +1 -1
- package/dist/lib/utils/creative-delivery.mjs +104 -8
- package/dist/lib/utils/creative-delivery.mjs.map +1 -1
- package/dist/lib/utils/format-assets.d.mts +41 -38
- package/dist/lib/utils/format-assets.d.ts +41 -38
- package/dist/lib/utils/format-assets.d.ts.map +1 -1
- package/dist/lib/utils/format-assets.js +3 -1
- package/dist/lib/utils/format-assets.js.map +1 -1
- package/dist/lib/utils/format-assets.mjs +3 -1
- package/dist/lib/utils/format-assets.mjs.map +1 -1
- package/dist/lib/utils/index.d.mts +8 -8
- package/dist/lib/utils/index.d.ts +8 -8
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/index.js +11 -9
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/index.mjs +9 -8
- package/dist/lib/utils/index.mjs.map +1 -1
- package/dist/lib/utils/preview-utils.d.mts +11 -8
- package/dist/lib/utils/preview-utils.d.ts +11 -8
- package/dist/lib/utils/preview-utils.d.ts.map +1 -1
- package/dist/lib/utils/preview-utils.js +4 -4
- package/dist/lib/utils/preview-utils.js.map +1 -1
- package/dist/lib/utils/preview-utils.mjs +3 -3
- package/dist/lib/utils/preview-utils.mjs.map +1 -1
- package/dist/lib/utils/tool-request-schemas.d.mts +2 -2
- package/dist/lib/utils/tool-request-schemas.d.ts +2 -2
- package/dist/lib/v2/projection/aao-reference-formats.json +492 -0
- package/dist/lib/v2/projection/augment-response.d.mts +31 -11
- package/dist/lib/v2/projection/augment-response.d.ts +31 -11
- package/dist/lib/v2/projection/augment-response.d.ts.map +1 -1
- package/dist/lib/v2/projection/augment-response.js +233 -27
- package/dist/lib/v2/projection/augment-response.js.map +1 -1
- package/dist/lib/v2/projection/augment-response.mjs +232 -27
- package/dist/lib/v2/projection/augment-response.mjs.map +1 -1
- package/dist/lib/v2/projection/builders.d.mts +7 -6
- package/dist/lib/v2/projection/builders.d.ts +7 -6
- package/dist/lib/v2/projection/builders.d.ts.map +1 -1
- package/dist/lib/v2/projection/builders.js +11 -8
- package/dist/lib/v2/projection/builders.js.map +1 -1
- package/dist/lib/v2/projection/builders.mjs +9 -6
- package/dist/lib/v2/projection/builders.mjs.map +1 -1
- package/dist/lib/v2/projection/catalog-snapshot.d.mts +47 -0
- package/dist/lib/v2/projection/catalog-snapshot.d.ts +48 -0
- package/dist/lib/v2/projection/catalog-snapshot.d.ts.map +1 -0
- package/dist/lib/v2/projection/catalog-snapshot.js +291 -0
- package/dist/lib/v2/projection/catalog-snapshot.js.map +1 -0
- package/dist/lib/v2/projection/catalog-snapshot.mjs +265 -0
- package/dist/lib/v2/projection/catalog-snapshot.mjs.map +1 -0
- package/dist/lib/v2/projection/catalog.d.mts +23 -2
- package/dist/lib/v2/projection/catalog.d.ts +23 -2
- package/dist/lib/v2/projection/catalog.d.ts.map +1 -1
- package/dist/lib/v2/projection/catalog.js +34 -10
- package/dist/lib/v2/projection/catalog.js.map +1 -1
- package/dist/lib/v2/projection/catalog.mjs +33 -10
- package/dist/lib/v2/projection/catalog.mjs.map +1 -1
- package/dist/lib/v2/projection/creative-delivery.d.mts +157 -0
- package/dist/lib/v2/projection/creative-delivery.d.ts +158 -0
- package/dist/lib/v2/projection/creative-delivery.d.ts.map +1 -0
- package/dist/lib/v2/projection/creative-delivery.js +967 -0
- package/dist/lib/v2/projection/creative-delivery.js.map +1 -0
- package/dist/lib/v2/projection/creative-delivery.mjs +941 -0
- package/dist/lib/v2/projection/creative-delivery.mjs.map +1 -0
- package/dist/lib/v2/projection/index.d.mts +8 -6
- package/dist/lib/v2/projection/index.d.ts +8 -6
- package/dist/lib/v2/projection/index.d.ts.map +1 -1
- package/dist/lib/v2/projection/index.js +26 -4
- package/dist/lib/v2/projection/index.js.map +1 -1
- package/dist/lib/v2/projection/index.mjs +28 -4
- package/dist/lib/v2/projection/index.mjs.map +1 -1
- package/dist/lib/v2/projection/legacy-metadata.d.mts +21 -0
- package/dist/lib/v2/projection/legacy-metadata.d.ts +22 -0
- package/dist/lib/v2/projection/legacy-metadata.d.ts.map +1 -0
- package/dist/lib/v2/projection/legacy-metadata.js +73 -0
- package/dist/lib/v2/projection/legacy-metadata.js.map +1 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs +45 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs.map +1 -0
- package/dist/lib/v2/projection/types.d.mts +29 -23
- package/dist/lib/v2/projection/types.d.ts +29 -23
- package/dist/lib/v2/projection/types.d.ts.map +1 -1
- package/dist/lib/v2/projection/types.js.map +1 -1
- package/dist/lib/v2/projection/v1-to-v2.d.mts +29 -6
- package/dist/lib/v2/projection/v1-to-v2.d.ts +29 -6
- package/dist/lib/v2/projection/v1-to-v2.d.ts.map +1 -1
- package/dist/lib/v2/projection/v1-to-v2.js +218 -9
- package/dist/lib/v2/projection/v1-to-v2.js.map +1 -1
- package/dist/lib/v2/projection/v1-to-v2.mjs +219 -10
- package/dist/lib/v2/projection/v1-to-v2.mjs.map +1 -1
- package/dist/lib/v2/projection/v2-to-v1.d.mts +31 -2
- package/dist/lib/v2/projection/v2-to-v1.d.ts +31 -2
- package/dist/lib/v2/projection/v2-to-v1.d.ts.map +1 -1
- package/dist/lib/v2/projection/v2-to-v1.js +138 -7
- package/dist/lib/v2/projection/v2-to-v1.js.map +1 -1
- package/dist/lib/v2/projection/v2-to-v1.mjs +135 -6
- package/dist/lib/v2/projection/v2-to-v1.mjs.map +1 -1
- package/dist/lib/v2/projection/write-side.d.mts +12 -13
- package/dist/lib/v2/projection/write-side.d.ts +12 -13
- package/dist/lib/v2/projection/write-side.d.ts.map +1 -1
- package/dist/lib/v2/projection/write-side.js +16 -12
- package/dist/lib/v2/projection/write-side.js.map +1 -1
- package/dist/lib/v2/projection/write-side.mjs +16 -12
- package/dist/lib/v2/projection/write-side.mjs.map +1 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.d.ts.map +1 -1
- 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/guides/BUILD-AN-AGENT.md +7 -2
- package/docs/guides/PREVIEW-ASSET-DURABILITY.md +6 -2
- package/docs/llms.txt +1 -0
- package/examples/README.md +1 -1
- package/examples/batch-preview-test.ts +3 -3
- package/examples/conversation-client.ts +2 -2
- package/examples/debug-preview-response.ts +1 -1
- package/examples/decisioning-platform-broadcast-tv.ts +10 -4
- package/examples/decisioning-platform-mock-seller.ts +16 -9
- package/examples/decisioning-platform-programmatic.ts +18 -7
- package/examples/error-compliant-server.ts +26 -16
- package/examples/generative-creative-demo.ts +7 -19
- package/examples/hello_creative_adapter_ad_server.ts +37 -16
- package/examples/hello_creative_adapter_template.ts +12 -10
- package/examples/hello_seller_adapter_guaranteed.ts +52 -23
- package/examples/hello_seller_adapter_multi_tenant.ts +6 -3
- package/examples/hello_seller_adapter_non_guaranteed.ts +54 -26
- package/examples/hello_seller_adapter_proposal_mode.ts +40 -14
- package/examples/hello_seller_adapter_social.ts +2 -7
- package/examples/inspect-card-formats.ts +1 -1
- package/examples/simple-getting-started.ts +1 -1
- package/examples/test-helpers-demo.ts +1 -1
- package/package.json +2 -2
- package/skills/build-decisioning-creative-template/SKILL.md +11 -11
- package/skills/build-decisioning-platform/advanced/REFERENCE.md +8 -2
|
@@ -65,6 +65,101 @@ import { isSandboxOrMockAccount } from "../../account-mode.mjs";
|
|
|
65
65
|
import { recordResolvedAccountMode, hasObservedLiveMode } from "./observed-modes.mjs";
|
|
66
66
|
import { normalizeErrors } from "../../normalize-errors.mjs";
|
|
67
67
|
import { redactCredentialPatterns } from "../../redact.mjs";
|
|
68
|
+
import {
|
|
69
|
+
CreativeFormatProjectionError,
|
|
70
|
+
projectCreativeForDelivery,
|
|
71
|
+
projectMediaBuyCreativesForDelivery,
|
|
72
|
+
stripLegacyCreativeIdentity
|
|
73
|
+
} from "../../../v2/projection/creative-delivery.mjs";
|
|
74
|
+
import { toCanonicalOnlyResponse } from "../../../v2/projection/augment-response.mjs";
|
|
75
|
+
import {
|
|
76
|
+
CanonicalFormatLegacyResolutionError,
|
|
77
|
+
projectV2ProductToV1,
|
|
78
|
+
resolveCanonicalFormatLegacyRefs
|
|
79
|
+
} from "../../../v2/projection/v2-to-v1.mjs";
|
|
80
|
+
import { legacyFormatRefsForDeclaration } from "../../../v2/projection/legacy-metadata.mjs";
|
|
81
|
+
import { ADCP_VERSION } from "../../../version.mjs";
|
|
82
|
+
function supportsCanonicalCreativeCapability(version) {
|
|
83
|
+
if (typeof version !== "string") return false;
|
|
84
|
+
const match = /^v?(\d+)\.(\d+)(?:\.|-|$)/.exec(version.trim());
|
|
85
|
+
if (!match) return false;
|
|
86
|
+
const major = Number(match[1]);
|
|
87
|
+
const minor = Number(match[2]);
|
|
88
|
+
return major > 3 || major === 3 && minor >= 1;
|
|
89
|
+
}
|
|
90
|
+
function requiresCanonicalCreativeWire(version) {
|
|
91
|
+
if (typeof version !== "string") return false;
|
|
92
|
+
const match = /^v?(\d+)\.(\d+)(?:\.|-|$)/.exec(version.trim());
|
|
93
|
+
if (!match) return false;
|
|
94
|
+
const major = Number(match[1]);
|
|
95
|
+
const minor = Number(match[2]);
|
|
96
|
+
return major > 3 || major === 3 && minor >= 2;
|
|
97
|
+
}
|
|
98
|
+
function creativeWireEvidenceForRequest(request) {
|
|
99
|
+
let canonical = false;
|
|
100
|
+
let legacy = false;
|
|
101
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
102
|
+
if (request !== null && typeof request === "object") {
|
|
103
|
+
const ext = Object.getOwnPropertyDescriptor(request, "ext");
|
|
104
|
+
if (ext && "value" in ext && ext.value !== null && typeof ext.value === "object") {
|
|
105
|
+
const adcp = Object.getOwnPropertyDescriptor(ext.value, "adcp");
|
|
106
|
+
if (adcp && "value" in adcp && adcp.value !== null && typeof adcp.value === "object") {
|
|
107
|
+
const wire = Object.getOwnPropertyDescriptor(adcp.value, "creative_wire");
|
|
108
|
+
if (wire && "value" in wire) {
|
|
109
|
+
if (wire.value === "canonical") canonical = true;
|
|
110
|
+
if (wire.value === "legacy") legacy = true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const visit = (value) => {
|
|
116
|
+
if (value === null || typeof value !== "object" || seen.has(value)) return;
|
|
117
|
+
seen.add(value);
|
|
118
|
+
const arrayValue = Array.isArray(value);
|
|
119
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
120
|
+
for (const [key, descriptor] of Object.entries(descriptors)) {
|
|
121
|
+
if (!descriptor.enumerable || !("value" in descriptor)) continue;
|
|
122
|
+
const child = descriptor.value;
|
|
123
|
+
if (key === "context" || key === "ext") continue;
|
|
124
|
+
if (/(^|_)(?:format_ids?|v1_format_ref)($|_)/.test(key)) legacy = true;
|
|
125
|
+
if (key === "format_kind" || key === "format_options" || key === "format_option_ref" || key === "format_option_refs") {
|
|
126
|
+
canonical = true;
|
|
127
|
+
}
|
|
128
|
+
if (arrayValue && typeof child === "string") {
|
|
129
|
+
if (child === "format_id" || child === "format_ids") legacy = true;
|
|
130
|
+
if (child === "format_kind" || child === "format_options" || child === "format_option_ref") canonical = true;
|
|
131
|
+
}
|
|
132
|
+
visit(child);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
visit(request);
|
|
136
|
+
if (canonical && legacy) return "mixed";
|
|
137
|
+
if (canonical) return "canonical";
|
|
138
|
+
if (legacy) return "legacy";
|
|
139
|
+
return "unknown";
|
|
140
|
+
}
|
|
141
|
+
function creativeWireModeForRequest(ctx, fallback, request) {
|
|
142
|
+
if (ctx.servedAdcpVersion === void 0) return fallback;
|
|
143
|
+
if (!supportsCanonicalCreativeCapability(ctx.servedAdcpVersion)) return "legacy";
|
|
144
|
+
if (requiresCanonicalCreativeWire(ctx.servedAdcpVersion)) return "canonical";
|
|
145
|
+
const evidence = creativeWireEvidenceForRequest(request);
|
|
146
|
+
if (evidence === "canonical" || evidence === "mixed") return "canonical";
|
|
147
|
+
if (evidence === "legacy") return "legacy";
|
|
148
|
+
return fallback;
|
|
149
|
+
}
|
|
150
|
+
function parseAdcpRelease(version) {
|
|
151
|
+
if (typeof version !== "string") return void 0;
|
|
152
|
+
const match = /^v?(\d+)\.(\d+)(?:\.(\d+))?(?:-|$)/.exec(version.trim());
|
|
153
|
+
if (!match) return void 0;
|
|
154
|
+
return [Number(match[1]), Number(match[2]), Number(match[3] ?? 0)];
|
|
155
|
+
}
|
|
156
|
+
function compareAdcpReleases(left, right) {
|
|
157
|
+
for (let index = 0; index < left.length; index++) {
|
|
158
|
+
const delta = left[index] - right[index];
|
|
159
|
+
if (delta !== 0) return delta;
|
|
160
|
+
}
|
|
161
|
+
return 0;
|
|
162
|
+
}
|
|
68
163
|
function isPlainObject(v) {
|
|
69
164
|
if (v === null || typeof v !== "object") return false;
|
|
70
165
|
if (Array.isArray(v)) return false;
|
|
@@ -94,6 +189,414 @@ function normalizeRowErrors(row) {
|
|
|
94
189
|
if (row?.errors == null) return row;
|
|
95
190
|
return { ...row, errors: normalizeErrors(row.errors) };
|
|
96
191
|
}
|
|
192
|
+
function asCanonicalServerResponse(response) {
|
|
193
|
+
return stripLegacyCreativeIdentity(response);
|
|
194
|
+
}
|
|
195
|
+
function ownEnumerableDataRecord(value, operation) {
|
|
196
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
197
|
+
const entries = Object.entries(descriptors).filter(([, descriptor]) => descriptor.enumerable);
|
|
198
|
+
if (entries.length === 0) return void 0;
|
|
199
|
+
const record = {};
|
|
200
|
+
for (const [key, descriptor] of entries) {
|
|
201
|
+
if (!("value" in descriptor)) {
|
|
202
|
+
throw new CreativeFormatProjectionError(
|
|
203
|
+
operation,
|
|
204
|
+
`(response:${key})`,
|
|
205
|
+
"enumerable accessors cannot cross the creative format boundary safely"
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
record[key] = descriptor.value;
|
|
209
|
+
}
|
|
210
|
+
return record;
|
|
211
|
+
}
|
|
212
|
+
function assertSafeSemanticPayload(value, operation) {
|
|
213
|
+
const active = /* @__PURE__ */ new WeakSet();
|
|
214
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
215
|
+
const visit = (current, path) => {
|
|
216
|
+
if (current === null || typeof current !== "object") return;
|
|
217
|
+
if (Array.isArray(current) && Object.getPrototypeOf(current) !== Array.prototype) {
|
|
218
|
+
throw new CreativeFormatProjectionError(
|
|
219
|
+
operation,
|
|
220
|
+
`(payload:${path})`,
|
|
221
|
+
"array subclasses cannot cross the creative format boundary safely"
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
for (let owner = current; owner !== null; owner = Object.getPrototypeOf(owner)) {
|
|
225
|
+
const toJSON = Object.getOwnPropertyDescriptor(owner, "toJSON");
|
|
226
|
+
if (!toJSON) continue;
|
|
227
|
+
if (!("value" in toJSON) || typeof toJSON.value === "function") {
|
|
228
|
+
throw new CreativeFormatProjectionError(
|
|
229
|
+
operation,
|
|
230
|
+
`(payload:${path}.toJSON)`,
|
|
231
|
+
"custom or accessor toJSON hooks cannot cross the creative format boundary safely"
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (active.has(current)) {
|
|
236
|
+
throw new CreativeFormatProjectionError(
|
|
237
|
+
operation,
|
|
238
|
+
`(payload:${path})`,
|
|
239
|
+
"cyclic values cannot cross the creative format boundary"
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
if (visited.has(current)) return;
|
|
243
|
+
active.add(current);
|
|
244
|
+
try {
|
|
245
|
+
const descriptors = Object.getOwnPropertyDescriptors(current);
|
|
246
|
+
for (const [key, descriptor] of Object.entries(descriptors)) {
|
|
247
|
+
if (!("value" in descriptor)) {
|
|
248
|
+
throw new CreativeFormatProjectionError(
|
|
249
|
+
operation,
|
|
250
|
+
`(payload:${path}.${key})`,
|
|
251
|
+
"accessors cannot cross the creative format boundary safely"
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
if (!descriptor.enumerable) continue;
|
|
255
|
+
visit(descriptor.value, `${path}.${key}`);
|
|
256
|
+
}
|
|
257
|
+
} finally {
|
|
258
|
+
active.delete(current);
|
|
259
|
+
}
|
|
260
|
+
visited.add(current);
|
|
261
|
+
};
|
|
262
|
+
visit(value, "$");
|
|
263
|
+
}
|
|
264
|
+
function projectResponseCreativeIdentities(value, operation, legacyFormatConverter, canonicalFormatLegacyResolver, wireMode, selectorContainer = {}) {
|
|
265
|
+
if (Array.isArray(value)) {
|
|
266
|
+
return value.map(
|
|
267
|
+
(item) => projectResponseCreativeIdentities(
|
|
268
|
+
item,
|
|
269
|
+
operation,
|
|
270
|
+
legacyFormatConverter,
|
|
271
|
+
canonicalFormatLegacyResolver,
|
|
272
|
+
wireMode,
|
|
273
|
+
selectorContainer
|
|
274
|
+
)
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
if (value === null || typeof value !== "object") return value;
|
|
278
|
+
const inspectedRecord = ownEnumerableDataRecord(value, operation);
|
|
279
|
+
if (inspectedRecord === void 0) return value;
|
|
280
|
+
const dataRecord = isPlainObject(value) ? value : inspectedRecord;
|
|
281
|
+
let projected = dataRecord;
|
|
282
|
+
const isProduct = typeof projected.product_id === "string" && ("name" in projected || "description" in projected) && (Array.isArray(projected.format_ids) || Array.isArray(projected.format_options));
|
|
283
|
+
if (isProduct) {
|
|
284
|
+
if (wireMode === "canonical") {
|
|
285
|
+
const canonical = toCanonicalOnlyResponse(
|
|
286
|
+
{ products: [projected] },
|
|
287
|
+
{ legacyFormatConverter }
|
|
288
|
+
);
|
|
289
|
+
if (canonical.diagnostics.length > 0 || canonical.response.products.length !== 1) {
|
|
290
|
+
throw new CreativeFormatProjectionError(
|
|
291
|
+
operation,
|
|
292
|
+
`(product:${String(projected.product_id)})`,
|
|
293
|
+
"legacy product formats in the platform response have no complete canonical representation"
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
projected = canonical.response.products[0];
|
|
297
|
+
} else if (Array.isArray(projected.format_options)) {
|
|
298
|
+
const legacy = projectV2ProductToV1(projected, { canonicalFormatLegacyResolver });
|
|
299
|
+
if (legacy.diagnostics.length > 0 || legacy.v1.format_ids.length === 0 && projected.format_options.length > 0) {
|
|
300
|
+
throw new CreativeFormatProjectionError(
|
|
301
|
+
operation,
|
|
302
|
+
`(product:${String(projected.product_id)})`,
|
|
303
|
+
"canonical product formats in the platform response have no complete legacy representation"
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
projected = legacy.v1;
|
|
307
|
+
}
|
|
308
|
+
} else if ((typeof projected.package_id === "string" || typeof projected.product_id === "string") && (Array.isArray(projected.format_ids) || Array.isArray(projected.format_option_refs) || typeof projected.format_kind === "string")) {
|
|
309
|
+
projected = projectMediaBuyCreativesForDelivery(
|
|
310
|
+
{ packages: [projected] },
|
|
311
|
+
wireMode,
|
|
312
|
+
"create_media_buy",
|
|
313
|
+
legacyFormatConverter,
|
|
314
|
+
canonicalFormatLegacyResolver
|
|
315
|
+
).packages[0];
|
|
316
|
+
}
|
|
317
|
+
if (typeof projected.creative_id === "string" && (projected.format_id !== void 0 || typeof projected.format_kind === "string")) {
|
|
318
|
+
projected = projectCreativeForDelivery(
|
|
319
|
+
projected,
|
|
320
|
+
selectorContainer,
|
|
321
|
+
wireMode,
|
|
322
|
+
operation,
|
|
323
|
+
legacyFormatConverter,
|
|
324
|
+
canonicalFormatLegacyResolver
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
const nextSelector = Array.isArray(projected.format_ids) || Array.isArray(projected.format_options) || Array.isArray(projected.format_option_refs) ? projected : selectorContainer;
|
|
328
|
+
let changed = projected !== value;
|
|
329
|
+
const next = { ...projected };
|
|
330
|
+
for (const [key, child] of Object.entries(projected)) {
|
|
331
|
+
const childProjected = projectResponseCreativeIdentities(
|
|
332
|
+
child,
|
|
333
|
+
operation,
|
|
334
|
+
legacyFormatConverter,
|
|
335
|
+
canonicalFormatLegacyResolver,
|
|
336
|
+
wireMode,
|
|
337
|
+
nextSelector
|
|
338
|
+
);
|
|
339
|
+
if (childProjected !== child) {
|
|
340
|
+
next[key] = childProjected;
|
|
341
|
+
changed = true;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return changed ? next : projected;
|
|
345
|
+
}
|
|
346
|
+
function asCanonicalSemanticServerResponse(response, operation, legacyFormatConverter, canonicalFormatLegacyResolver) {
|
|
347
|
+
try {
|
|
348
|
+
assertSafeSemanticPayload(response, operation);
|
|
349
|
+
return asCanonicalServerResponse(
|
|
350
|
+
projectResponseCreativeIdentities(
|
|
351
|
+
response,
|
|
352
|
+
operation,
|
|
353
|
+
legacyFormatConverter,
|
|
354
|
+
canonicalFormatLegacyResolver,
|
|
355
|
+
"canonical"
|
|
356
|
+
)
|
|
357
|
+
);
|
|
358
|
+
} catch (error) {
|
|
359
|
+
if (!(error instanceof CreativeFormatProjectionError)) throw error;
|
|
360
|
+
throw new AdcpError("INVALID_REQUEST", {
|
|
361
|
+
message: `${operation} platform response contains a legacy creative format that cannot be represented canonically.`,
|
|
362
|
+
field: "response",
|
|
363
|
+
suggestion: "Return canonical format_kind values, or configure legacyCreativeFormatConverter for custom legacy formats."
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function asSemanticServerResponseForWire(response, operation, legacyFormatConverter, canonicalFormatLegacyResolver, wireMode) {
|
|
368
|
+
if (wireMode === "canonical") {
|
|
369
|
+
return attachCanonicalCustomFormatWireRefs(
|
|
370
|
+
asCanonicalSemanticServerResponse(response, operation, legacyFormatConverter, canonicalFormatLegacyResolver),
|
|
371
|
+
canonicalFormatLegacyResolver,
|
|
372
|
+
operation
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
try {
|
|
376
|
+
assertSafeSemanticPayload(response, operation);
|
|
377
|
+
return projectResponseCreativeIdentities(
|
|
378
|
+
response,
|
|
379
|
+
operation,
|
|
380
|
+
legacyFormatConverter,
|
|
381
|
+
canonicalFormatLegacyResolver,
|
|
382
|
+
"legacy"
|
|
383
|
+
);
|
|
384
|
+
} catch (error) {
|
|
385
|
+
if (!(error instanceof CreativeFormatProjectionError)) throw error;
|
|
386
|
+
throw new AdcpError("INVALID_REQUEST", {
|
|
387
|
+
message: `${operation} platform response contains a canonical creative format that cannot be represented on the configured legacy wire.`,
|
|
388
|
+
field: "response",
|
|
389
|
+
suggestion: "Return an explicit legacy mapping for the canonical format, or configure this server for AdCP 3.1 or newer."
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function legacyIdentityContext(ownerKey) {
|
|
394
|
+
if (typeof ownerKey !== "string") return "default";
|
|
395
|
+
if (ownerKey === "signal_id" || ownerKey === "signal_ids") return "signal";
|
|
396
|
+
if (/(^|_)(?:property_lists?|collection_lists?)($|_)/.test(ownerKey)) return "list";
|
|
397
|
+
if (!/(^|_)(?:creative|format|legacy|placement)($|_)/.test(ownerKey) && /(^|_)(?:agents?|agent_details|agent_info)($|_)/.test(ownerKey)) {
|
|
398
|
+
return "agent";
|
|
399
|
+
}
|
|
400
|
+
return "default";
|
|
401
|
+
}
|
|
402
|
+
function allowsNonCreativeAgentUrl(owner, context) {
|
|
403
|
+
return context === "agent" || context === "list" && typeof owner.list_id === "string" || context === "signal" && owner.source === "agent";
|
|
404
|
+
}
|
|
405
|
+
function findLegacyCreativeIdentity(value, seen = {
|
|
406
|
+
agent: /* @__PURE__ */ new WeakSet(),
|
|
407
|
+
signal: /* @__PURE__ */ new WeakSet(),
|
|
408
|
+
list: /* @__PURE__ */ new WeakSet(),
|
|
409
|
+
default: /* @__PURE__ */ new WeakSet()
|
|
410
|
+
}, ownerKey) {
|
|
411
|
+
if (value === null || typeof value !== "object") return void 0;
|
|
412
|
+
const owner = value;
|
|
413
|
+
const context = legacyIdentityContext(ownerKey);
|
|
414
|
+
const policySeen = seen[context];
|
|
415
|
+
if (policySeen.has(value)) return void 0;
|
|
416
|
+
policySeen.add(value);
|
|
417
|
+
if (Array.isArray(value)) {
|
|
418
|
+
for (const item of value) {
|
|
419
|
+
const nested = findLegacyCreativeIdentity(item, seen, ownerKey);
|
|
420
|
+
if (nested) return nested;
|
|
421
|
+
}
|
|
422
|
+
return void 0;
|
|
423
|
+
}
|
|
424
|
+
for (const [key, child] of Object.entries(owner)) {
|
|
425
|
+
if (/(^|_)(?:format_ids?|v1_format_ref)($|_)/.test(key)) return key;
|
|
426
|
+
if (key === "agent_url" && (typeof owner.id === "string" || typeof owner.list_id === "string") && !allowsNonCreativeAgentUrl(owner, context)) {
|
|
427
|
+
return key;
|
|
428
|
+
}
|
|
429
|
+
const nested = findLegacyCreativeIdentity(child, seen, key);
|
|
430
|
+
if (nested) return nested;
|
|
431
|
+
}
|
|
432
|
+
return void 0;
|
|
433
|
+
}
|
|
434
|
+
function asCanonicalSemanticServerRequest(request, operation, legacyFormatConverter) {
|
|
435
|
+
try {
|
|
436
|
+
assertSafeSemanticPayload(request, operation);
|
|
437
|
+
const projected = projectResponseCreativeIdentities(
|
|
438
|
+
request,
|
|
439
|
+
operation,
|
|
440
|
+
legacyFormatConverter,
|
|
441
|
+
void 0,
|
|
442
|
+
"canonical"
|
|
443
|
+
);
|
|
444
|
+
const forbidden = findLegacyCreativeIdentity(projected);
|
|
445
|
+
if (forbidden) {
|
|
446
|
+
throw new CreativeFormatProjectionError(
|
|
447
|
+
operation,
|
|
448
|
+
"(request extension)",
|
|
449
|
+
`legacy creative identity ${forbidden} has no recognized canonical container`
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
return projected;
|
|
453
|
+
} catch (error) {
|
|
454
|
+
if (!(error instanceof CreativeFormatProjectionError)) throw error;
|
|
455
|
+
throw new AdcpError("INVALID_REQUEST", {
|
|
456
|
+
message: `${operation} request contains a legacy creative format that cannot be represented canonically.`,
|
|
457
|
+
field: "request",
|
|
458
|
+
suggestion: "Send canonical format_kind values, or configure legacyCreativeFormatConverter for custom legacy formats."
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function asCanonicalGetProductsRequest(request) {
|
|
463
|
+
if (!Array.isArray(request["fields"])) return request;
|
|
464
|
+
const fields = [
|
|
465
|
+
...new Set(
|
|
466
|
+
request["fields"].flatMap(
|
|
467
|
+
(field) => field === "format_ids" ? ["format_options"] : typeof field === "string" ? [field] : []
|
|
468
|
+
)
|
|
469
|
+
)
|
|
470
|
+
];
|
|
471
|
+
return { ...request, fields };
|
|
472
|
+
}
|
|
473
|
+
function asCanonicalListCreativesRequest(request, legacyFormatConverter) {
|
|
474
|
+
const filters = request["filters"] !== null && typeof request["filters"] === "object" && !Array.isArray(request["filters"]) ? request["filters"] : void 0;
|
|
475
|
+
const legacyFormatIds = filters?.["format_ids"];
|
|
476
|
+
if (Array.isArray(legacyFormatIds) && legacyFormatIds.length > 0) {
|
|
477
|
+
throw new AdcpError("INVALID_REQUEST", {
|
|
478
|
+
message: "list_creatives legacy format_ids filters are unavailable on the canonical platform surface.",
|
|
479
|
+
field: "filters.format_ids",
|
|
480
|
+
suggestion: "Filter by canonical creative fields, or use an explicit legacy wire handler during migration."
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
const { format_ids: _dropLegacyFormatIds, ...canonicalFilters } = filters ?? {};
|
|
484
|
+
void _dropLegacyFormatIds;
|
|
485
|
+
const withoutLegacyFilter = filters === void 0 ? request : { ...request, filters: canonicalFilters };
|
|
486
|
+
const projected = asCanonicalSemanticServerRequest(
|
|
487
|
+
withoutLegacyFilter,
|
|
488
|
+
"list_creatives",
|
|
489
|
+
legacyFormatConverter
|
|
490
|
+
);
|
|
491
|
+
if (!Array.isArray(projected["fields"])) return projected;
|
|
492
|
+
const fields = [
|
|
493
|
+
...new Set(
|
|
494
|
+
projected["fields"].flatMap(
|
|
495
|
+
(field) => field === "format_id" ? ["format_kind"] : typeof field === "string" ? [field] : []
|
|
496
|
+
)
|
|
497
|
+
)
|
|
498
|
+
];
|
|
499
|
+
return { ...projected, fields };
|
|
500
|
+
}
|
|
501
|
+
function asCanonicalProductResponse(response, legacyFormatConverter) {
|
|
502
|
+
try {
|
|
503
|
+
assertSafeSemanticPayload(response, "get_products");
|
|
504
|
+
} catch (error) {
|
|
505
|
+
if (!(error instanceof CreativeFormatProjectionError)) throw error;
|
|
506
|
+
throw new AdcpError("INVALID_REQUEST", {
|
|
507
|
+
message: "get_products platform response cannot be represented safely at the canonical boundary.",
|
|
508
|
+
field: "response",
|
|
509
|
+
suggestion: "Return an acyclic data-only product response without enumerable accessors."
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
const projected = toCanonicalOnlyResponse(response, {
|
|
513
|
+
legacyFormatConverter
|
|
514
|
+
});
|
|
515
|
+
if (projected.diagnostics.length > 0) {
|
|
516
|
+
const first = projected.diagnostics[0];
|
|
517
|
+
throw new AdcpError("INVALID_REQUEST", {
|
|
518
|
+
message: "get_products returned a legacy format that cannot be represented canonically.",
|
|
519
|
+
field: first.field,
|
|
520
|
+
suggestion: "Declare canonical format_options or configure legacyCreativeFormatConverter for the legacy format."
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
return asCanonicalServerResponse(projected.response);
|
|
524
|
+
}
|
|
525
|
+
function attachCanonicalCustomFormatWireRefs(value, canonicalFormatLegacyResolver, operation) {
|
|
526
|
+
const visit = (current) => {
|
|
527
|
+
if (Array.isArray(current)) return current.map(visit);
|
|
528
|
+
if (current === null || typeof current !== "object") return current;
|
|
529
|
+
const record = current;
|
|
530
|
+
const hasFormatDeclarations = Array.isArray(record.format_options);
|
|
531
|
+
const declarationOwner = typeof record.product_id === "string" ? record.product_id : typeof record.placement_id === "string" ? record.placement_id : "(response)";
|
|
532
|
+
let projected = record;
|
|
533
|
+
if (hasFormatDeclarations) {
|
|
534
|
+
const formatOptions = record.format_options.map((value2, index) => {
|
|
535
|
+
if (value2 === null || typeof value2 !== "object" || Array.isArray(value2)) return value2;
|
|
536
|
+
const declaration = value2;
|
|
537
|
+
if (declaration.format_kind !== "custom" || declaration.canonical_formats_only === true) return declaration;
|
|
538
|
+
let refs = [...legacyFormatRefsForDeclaration(declaration)];
|
|
539
|
+
if (refs.length === 0) {
|
|
540
|
+
try {
|
|
541
|
+
refs = resolveCanonicalFormatLegacyRefs(canonicalFormatLegacyResolver, {
|
|
542
|
+
source: "product",
|
|
543
|
+
declaration,
|
|
544
|
+
productId: declarationOwner,
|
|
545
|
+
field: `${declarationOwner}.format_options[${index}]`
|
|
546
|
+
}) ?? [];
|
|
547
|
+
} catch (error) {
|
|
548
|
+
if (!(error instanceof CanonicalFormatLegacyResolutionError)) throw error;
|
|
549
|
+
throw new CreativeFormatProjectionError(
|
|
550
|
+
operation,
|
|
551
|
+
`(format owner:${declarationOwner})`,
|
|
552
|
+
"canonical format legacy resolver returned an invalid custom declaration mapping"
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (refs.length === 0) {
|
|
557
|
+
throw new CreativeFormatProjectionError(
|
|
558
|
+
operation,
|
|
559
|
+
`(format owner:${declarationOwner})`,
|
|
560
|
+
"custom canonical declaration must set canonical_formats_only or provide an explicit legacy mapping"
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
return { ...declaration, v1_format_ref: refs.map((ref) => ({ ...ref })) };
|
|
564
|
+
});
|
|
565
|
+
projected = { ...record, format_options: formatOptions };
|
|
566
|
+
}
|
|
567
|
+
let changed = projected !== record;
|
|
568
|
+
const next = { ...projected };
|
|
569
|
+
for (const [key, child] of Object.entries(projected)) {
|
|
570
|
+
if (hasFormatDeclarations && key === "format_options") continue;
|
|
571
|
+
const visited = visit(child);
|
|
572
|
+
if (visited !== child) {
|
|
573
|
+
next[key] = visited;
|
|
574
|
+
changed = true;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return changed ? next : projected;
|
|
578
|
+
};
|
|
579
|
+
return visit(value);
|
|
580
|
+
}
|
|
581
|
+
function asProductResponseForWire(canonicalResponse, wireMode, canonicalFormatLegacyResolver) {
|
|
582
|
+
if (wireMode === "canonical") {
|
|
583
|
+
return attachCanonicalCustomFormatWireRefs(canonicalResponse, canonicalFormatLegacyResolver, "get_products");
|
|
584
|
+
}
|
|
585
|
+
if (!Array.isArray(canonicalResponse.products)) return canonicalResponse;
|
|
586
|
+
const products = canonicalResponse.products.map((product) => {
|
|
587
|
+
const projected = projectV2ProductToV1(product, { canonicalFormatLegacyResolver });
|
|
588
|
+
if (projected.diagnostics.length > 0) {
|
|
589
|
+
const first = projected.diagnostics[0];
|
|
590
|
+
throw new AdcpError("INVALID_REQUEST", {
|
|
591
|
+
message: "get_products returned a canonical format that cannot be represented on the configured legacy wire.",
|
|
592
|
+
field: first.field,
|
|
593
|
+
suggestion: "Add an explicit legacy format mapping to the canonical declaration, or configure this server for AdCP 3.1 or newer."
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
return projected.v1;
|
|
597
|
+
});
|
|
598
|
+
return { ...canonicalResponse, products };
|
|
599
|
+
}
|
|
97
600
|
function refuseInlineAccountIdWhenForbidden(resolution, ref) {
|
|
98
601
|
if (resolution !== "implicit" && resolution !== "derived") return;
|
|
99
602
|
if (refAccountId(ref) === void 0) return;
|
|
@@ -122,6 +625,13 @@ function warnIfTruncatedMultiIdResponse(toolName, idFieldName, requestedIds, res
|
|
|
122
625
|
}
|
|
123
626
|
function createAdcpServerFromPlatform(platform, opts) {
|
|
124
627
|
validatePlatform(platform);
|
|
628
|
+
const runtimeLegacyOptions = opts;
|
|
629
|
+
const legacyHandlers = {
|
|
630
|
+
mediaBuy: opts.legacyHandlers?.mediaBuy ?? runtimeLegacyOptions.mediaBuy,
|
|
631
|
+
creative: opts.legacyHandlers?.creative ?? runtimeLegacyOptions.creative,
|
|
632
|
+
governance: opts.legacyHandlers?.governance ?? runtimeLegacyOptions.governance,
|
|
633
|
+
brandRights: opts.legacyHandlers?.brandRights ?? runtimeLegacyOptions.brandRights
|
|
634
|
+
};
|
|
125
635
|
{
|
|
126
636
|
const specialisms = platform.capabilities.specialisms;
|
|
127
637
|
const issues = validateSpecialismRequiredTools(platform, specialisms);
|
|
@@ -193,6 +703,28 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
193
703
|
const hasSalesPlatform = platform.sales != null || platform.proposalManager != null;
|
|
194
704
|
const supportsProposals = platform.capabilities.supportsProposals ?? (platform.proposalManager != null ? true : hasSalesPlatform ? false : void 0);
|
|
195
705
|
const hasMediaBuyProjection = hasSalesPlatform || at != null || ct != null || cs != null || som != null || fc != null || targeting != null || supportsProposals !== void 0;
|
|
706
|
+
const configuredAdcpVersion = opts.adcpVersion ?? ADCP_VERSION;
|
|
707
|
+
const configuredRelease = parseAdcpRelease(configuredAdcpVersion);
|
|
708
|
+
if (!configuredRelease) {
|
|
709
|
+
throw new PlatformConfigError(
|
|
710
|
+
`Configured AdCP version '${configuredAdcpVersion}' is not a valid release identifier`
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
for (const advertisedVersion of platform.capabilities.supported_versions ?? []) {
|
|
714
|
+
const advertisedRelease = parseAdcpRelease(advertisedVersion);
|
|
715
|
+
if (!advertisedRelease) {
|
|
716
|
+
throw new PlatformConfigError(
|
|
717
|
+
`capabilities.supported_versions contains invalid release identifier '${advertisedVersion}'`
|
|
718
|
+
);
|
|
719
|
+
}
|
|
720
|
+
if (compareAdcpReleases(advertisedRelease, configuredRelease) > 0) {
|
|
721
|
+
throw new PlatformConfigError(
|
|
722
|
+
`capabilities.supported_versions advertises AdCP ${advertisedVersion}, newer than the configured server schema ${configuredAdcpVersion}`
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
const canonicalCreativeCapability = supportsCanonicalCreativeCapability(configuredAdcpVersion);
|
|
727
|
+
const defaultCreativeWireMode = canonicalCreativeCapability ? "canonical" : "legacy";
|
|
196
728
|
const mediaBuyOverrides = {
|
|
197
729
|
...hasSalesPlatform && {
|
|
198
730
|
buying_modes: supportsProposals ? ["brief", "refine"] : ["brief"]
|
|
@@ -204,12 +736,11 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
204
736
|
...fc != null && { frequency_capping: fc },
|
|
205
737
|
...targeting != null && { execution: { targeting } },
|
|
206
738
|
...supportsProposals !== void 0 && { supports_proposals: supportsProposals },
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
739
|
+
features: {
|
|
740
|
+
...canonicalCreativeCapability && { canonical_creatives: true },
|
|
741
|
+
...at != null && { audience_targeting: true },
|
|
742
|
+
...ct != null && { conversion_tracking: true },
|
|
743
|
+
...cs != null && { content_standards: true }
|
|
213
744
|
}
|
|
214
745
|
};
|
|
215
746
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -260,19 +791,23 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
260
791
|
const hasSpecialisms = platformSpecialisms.length > 0;
|
|
261
792
|
const claimsSignedSpecialism = platformSpecialisms.includes("signed-requests");
|
|
262
793
|
const hasOverridesProjection = hasMediaBuyProjection || hasBrandProjection || hasAccountProjection || hasComplianceTestingProjection;
|
|
263
|
-
const
|
|
794
|
+
const { canonicalCreatives: _adopterCanonicalCreatives, ...adopterFeatureBase } = platform.capabilities.features ?? {};
|
|
795
|
+
void _adopterCanonicalCreatives;
|
|
796
|
+
const adopterFeatures = {
|
|
797
|
+
...adopterFeatureBase,
|
|
798
|
+
...canonicalCreativeCapability && { canonicalCreatives: true }
|
|
799
|
+
};
|
|
264
800
|
const adopterCreative = platform.capabilities.creative;
|
|
265
801
|
const adopterAccount = platform.capabilities.account;
|
|
266
802
|
const adopterOverrides = platform.capabilities.overrides;
|
|
267
803
|
const adopterSupportedVersions = platform.capabilities.supported_versions;
|
|
268
|
-
const hasAdopterPassthroughs = adopterFeatures !== void 0 || adopterCreative !== void 0 || adopterAccount !== void 0 || adopterOverrides !== void 0 || adopterSupportedVersions !== void 0;
|
|
269
804
|
const hasOverridesObject = hasOverridesProjection || adopterOverrides !== void 0;
|
|
270
|
-
const projectedCapabilitiesConfig =
|
|
805
|
+
const projectedCapabilitiesConfig = {
|
|
271
806
|
...hasSpecialisms && {
|
|
272
807
|
specialisms: [...platformSpecialisms]
|
|
273
808
|
},
|
|
274
809
|
...claimsSignedSpecialism && { request_signing: { supported: true } },
|
|
275
|
-
|
|
810
|
+
features: adopterFeatures,
|
|
276
811
|
...adopterCreative !== void 0 && { creative: adopterCreative },
|
|
277
812
|
...adopterAccount !== void 0 && { account: adopterAccount },
|
|
278
813
|
...adopterSupportedVersions !== void 0 && {
|
|
@@ -281,9 +816,7 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
281
816
|
...hasOverridesObject && {
|
|
282
817
|
overrides: {
|
|
283
818
|
...adopterOverrides ?? {},
|
|
284
|
-
|
|
285
|
-
media_buy: mergeCapabilityOverride(adopterOverrides?.media_buy, mediaBuyOverrides)
|
|
286
|
-
},
|
|
819
|
+
media_buy: mergeCapabilityOverride(adopterOverrides?.media_buy, mediaBuyOverrides),
|
|
287
820
|
...hasBrandProjection && {
|
|
288
821
|
brand: mergeCapabilityOverride(adopterOverrides?.brand, brandOverrides)
|
|
289
822
|
},
|
|
@@ -293,7 +826,7 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
293
826
|
...hasComplianceTestingProjection && complianceTestingOverrides != null && { compliance_testing: complianceTestingOverrides }
|
|
294
827
|
}
|
|
295
828
|
}
|
|
296
|
-
}
|
|
829
|
+
};
|
|
297
830
|
const ctxFor = makeCtxFor(effectiveCtxMetadata);
|
|
298
831
|
if (opts.resolveIdempotencyPrincipal === void 0) {
|
|
299
832
|
const env = process.env.NODE_ENV;
|
|
@@ -419,7 +952,7 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
419
952
|
// See `CreateAdcpServerFromPlatformOptions` JSDoc for the migration-seam
|
|
420
953
|
// contract.
|
|
421
954
|
mediaBuy: mergeHandlers(
|
|
422
|
-
|
|
955
|
+
legacyHandlers.mediaBuy,
|
|
423
956
|
buildMediaBuyHandlers(
|
|
424
957
|
platform,
|
|
425
958
|
taskRegistry,
|
|
@@ -433,13 +966,16 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
433
966
|
ctxFor,
|
|
434
967
|
effectiveCtxMetadata,
|
|
435
968
|
opts.mediaBuyStore,
|
|
436
|
-
opts.proposalStore
|
|
969
|
+
opts.proposalStore,
|
|
970
|
+
opts.legacyCreativeFormatConverter,
|
|
971
|
+
opts.canonicalFormatLegacyResolver,
|
|
972
|
+
defaultCreativeWireMode
|
|
437
973
|
),
|
|
438
974
|
"mediaBuy",
|
|
439
975
|
mergeOpts
|
|
440
976
|
),
|
|
441
977
|
creative: mergeHandlers(
|
|
442
|
-
|
|
978
|
+
legacyHandlers.creative,
|
|
443
979
|
buildCreativeHandlers(
|
|
444
980
|
platform,
|
|
445
981
|
taskRegistry,
|
|
@@ -450,7 +986,10 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
450
986
|
allowPrivateWebhookUrls: opts.allowPrivateWebhookUrls === true,
|
|
451
987
|
autoEmitCompletionWebhooks: opts.autoEmitCompletionWebhooks !== false
|
|
452
988
|
},
|
|
453
|
-
ctxFor
|
|
989
|
+
ctxFor,
|
|
990
|
+
opts.legacyCreativeFormatConverter,
|
|
991
|
+
opts.canonicalFormatLegacyResolver,
|
|
992
|
+
defaultCreativeWireMode
|
|
454
993
|
),
|
|
455
994
|
"creative",
|
|
456
995
|
mergeOpts
|
|
@@ -485,10 +1024,15 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
485
1024
|
"sponsoredIntelligence",
|
|
486
1025
|
mergeOpts
|
|
487
1026
|
),
|
|
488
|
-
governance: mergeHandlers(
|
|
1027
|
+
governance: mergeHandlers(
|
|
1028
|
+
legacyHandlers.governance,
|
|
1029
|
+
buildGovernanceHandlers(platform, ctxFor),
|
|
1030
|
+
"governance",
|
|
1031
|
+
mergeOpts
|
|
1032
|
+
),
|
|
489
1033
|
accounts: mergeHandlers(opts.accounts, buildAccountHandlers(platform, ctxFor), "accounts", mergeOpts),
|
|
490
1034
|
brandRights: mergeHandlers(
|
|
491
|
-
|
|
1035
|
+
legacyHandlers.brandRights,
|
|
492
1036
|
buildBrandRightsHandlers(platform, ctxFor, effectiveCtxMetadata, fwLogger),
|
|
493
1037
|
"brandRights",
|
|
494
1038
|
mergeOpts
|
|
@@ -1038,7 +1582,7 @@ function mergeHandlers(custom, platform, domain, opts) {
|
|
|
1038
1582
|
if (collisions.length > 0) {
|
|
1039
1583
|
const dedupeKey = `${domain}|${[...collisions].sort().join(",")}`;
|
|
1040
1584
|
const shouldLog = opts.mode !== "log-once" || !mergeSeamLoggedKeys.has(dedupeKey);
|
|
1041
|
-
const message = `[adcp/decisioning] opts.${domain}.{${collisions.join(", ")}} ${collisions.length === 1 ? "is" : "are"} shadowed by platform-derived handlers. The merge seam is for tools the platform doesn't model yet \u2014 once a tool has a native platform method, move the logic there and remove the opts override.`;
|
|
1585
|
+
const message = `[adcp/decisioning] opts.legacyHandlers.${domain}.{${collisions.join(", ")}} ${collisions.length === 1 ? "is" : "are"} shadowed by platform-derived handlers. The merge seam is for tools the platform doesn't model yet \u2014 once a tool has a native platform method, move the logic there and remove the opts override.`;
|
|
1042
1586
|
if (opts.mode === "strict") {
|
|
1043
1587
|
throw new PlatformConfigError(message);
|
|
1044
1588
|
}
|
|
@@ -1550,7 +2094,7 @@ async function backfillTargetingOverlay(store, accountId, result, logger) {
|
|
|
1550
2094
|
logger.warn(`[adcp/decisioning] mediaBuyStore.backfill failed: ${msg}`);
|
|
1551
2095
|
}
|
|
1552
2096
|
}
|
|
1553
|
-
async function hydratePackagesWithProducts(store, accountId, packages, logger) {
|
|
2097
|
+
async function hydratePackagesWithProducts(store, accountId, packages, logger, legacyFormatConverter) {
|
|
1554
2098
|
if (!store || !accountId || !packages || packages.length === 0) return;
|
|
1555
2099
|
const refs = [];
|
|
1556
2100
|
for (const pkg of packages) {
|
|
@@ -1575,7 +2119,15 @@ async function hydratePackagesWithProducts(store, accountId, packages, logger) {
|
|
|
1575
2119
|
if (typeof productId !== "string") continue;
|
|
1576
2120
|
const entry = entries.get(`product:${productId}`);
|
|
1577
2121
|
if (!entry?.resource || typeof entry.resource !== "object") continue;
|
|
1578
|
-
|
|
2122
|
+
let hydrated;
|
|
2123
|
+
try {
|
|
2124
|
+
hydrated = asCanonicalSemanticServerRequest(entry.resource, "hydrate_product", legacyFormatConverter);
|
|
2125
|
+
} catch {
|
|
2126
|
+
logger.warn(
|
|
2127
|
+
`[adcp/decisioning] auto-hydrate product:${productId} skipped: stored creative format has no canonical representation`
|
|
2128
|
+
);
|
|
2129
|
+
continue;
|
|
2130
|
+
}
|
|
1579
2131
|
if (entry.value !== null && entry.value !== void 0) {
|
|
1580
2132
|
hydrated["ctx_metadata"] = entry.value;
|
|
1581
2133
|
}
|
|
@@ -1593,7 +2145,7 @@ async function hydratePackagesWithProducts(store, accountId, packages, logger) {
|
|
|
1593
2145
|
});
|
|
1594
2146
|
}
|
|
1595
2147
|
}
|
|
1596
|
-
async function hydrateSingleResource(store, accountId, kind, id, attachField, target, logger) {
|
|
2148
|
+
async function hydrateSingleResource(store, accountId, kind, id, attachField, target, logger, legacyFormatConverter) {
|
|
1597
2149
|
if (!store || !accountId || !id || target == null || typeof target !== "object") return;
|
|
1598
2150
|
let entry;
|
|
1599
2151
|
try {
|
|
@@ -1604,7 +2156,19 @@ async function hydrateSingleResource(store, accountId, kind, id, attachField, ta
|
|
|
1604
2156
|
return;
|
|
1605
2157
|
}
|
|
1606
2158
|
if (!entry?.resource || typeof entry.resource !== "object") return;
|
|
1607
|
-
|
|
2159
|
+
let hydrated;
|
|
2160
|
+
if (legacyFormatConverter !== void 0 || kind === "media_buy" || kind === "package" || kind === "creative") {
|
|
2161
|
+
try {
|
|
2162
|
+
hydrated = asCanonicalSemanticServerRequest(entry.resource, `hydrate_${kind}`, legacyFormatConverter);
|
|
2163
|
+
} catch {
|
|
2164
|
+
logger.warn(
|
|
2165
|
+
`[adcp/decisioning] auto-hydrate ${kind}:${id} skipped: stored creative format has no canonical representation`
|
|
2166
|
+
);
|
|
2167
|
+
return;
|
|
2168
|
+
}
|
|
2169
|
+
} else {
|
|
2170
|
+
hydrated = { ...entry.resource };
|
|
2171
|
+
}
|
|
1608
2172
|
if (entry.value !== null && entry.value !== void 0) {
|
|
1609
2173
|
hydrated["ctx_metadata"] = entry.value;
|
|
1610
2174
|
}
|
|
@@ -1678,7 +2242,7 @@ function deriveAttachField(toolName, field) {
|
|
|
1678
2242
|
if (override) return override;
|
|
1679
2243
|
return field.endsWith("_id") ? field.slice(0, -3) : field;
|
|
1680
2244
|
}
|
|
1681
|
-
async function hydrateForTool(store, accountId, toolName, params, logger) {
|
|
2245
|
+
async function hydrateForTool(store, accountId, toolName, params, logger, legacyFormatConverter) {
|
|
1682
2246
|
if (!store || !accountId || params == null || typeof params !== "object") return;
|
|
1683
2247
|
const fields = TOOL_ENTITY_FIELDS[toolName];
|
|
1684
2248
|
if (!fields || fields.length === 0) return;
|
|
@@ -1689,7 +2253,7 @@ async function hydrateForTool(store, accountId, toolName, params, logger) {
|
|
|
1689
2253
|
const kind = ENTITY_TO_RESOURCE_KIND[xEntity];
|
|
1690
2254
|
if (!kind) continue;
|
|
1691
2255
|
const attachField = deriveAttachField(toolName, field);
|
|
1692
|
-
await hydrateSingleResource(store, accountId, kind, id, attachField, params, logger);
|
|
2256
|
+
await hydrateSingleResource(store, accountId, kind, id, attachField, params, logger, legacyFormatConverter);
|
|
1693
2257
|
}
|
|
1694
2258
|
}
|
|
1695
2259
|
function extractPushConfig(params, _logger, opts = {}) {
|
|
@@ -1836,17 +2400,19 @@ function validatePushNotificationOperationId(operationId) {
|
|
|
1836
2400
|
}
|
|
1837
2401
|
return { ok: true };
|
|
1838
2402
|
}
|
|
1839
|
-
function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observability, logger, pushOpts, ctxFor, ctxMetadataStore, mediaBuyStore, proposalStore) {
|
|
2403
|
+
function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observability, logger, pushOpts, ctxFor, ctxMetadataStore, mediaBuyStore, proposalStore, legacyFormatConverter, canonicalFormatLegacyResolver, creativeWireMode) {
|
|
1840
2404
|
const sales = platform.sales;
|
|
1841
2405
|
const proposalManager = platform.proposalManager;
|
|
1842
2406
|
if (!sales && !proposalManager) return void 0;
|
|
1843
2407
|
return {
|
|
1844
2408
|
...(sales?.getProducts || proposalManager) && {
|
|
1845
2409
|
getProducts: async (params, ctx) => {
|
|
2410
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2411
|
+
const canonicalParams = asCanonicalGetProductsRequest(params);
|
|
1846
2412
|
const reqCtx = ctxFor(ctx, params);
|
|
1847
2413
|
if (proposalManager && proposalStore) {
|
|
1848
2414
|
const intercept = await maybeInterceptFinalize({
|
|
1849
|
-
request:
|
|
2415
|
+
request: canonicalParams,
|
|
1850
2416
|
manager: proposalManager,
|
|
1851
2417
|
store: proposalStore,
|
|
1852
2418
|
ctx: reqCtx
|
|
@@ -1891,16 +2457,17 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
1891
2457
|
let result;
|
|
1892
2458
|
if (proposalManager) {
|
|
1893
2459
|
const useRefine = buyingMode === "refine" && proposalManager.capabilities.refine === true && typeof proposalManager.refineProducts === "function";
|
|
1894
|
-
result = useRefine ? await proposalManager.refineProducts(
|
|
2460
|
+
result = useRefine ? await proposalManager.refineProducts(canonicalParams, reqCtx) : await proposalManager.getProducts(canonicalParams, reqCtx);
|
|
1895
2461
|
} else {
|
|
1896
|
-
result = await sales.getProducts(
|
|
2462
|
+
result = await sales.getProducts(canonicalParams, reqCtx);
|
|
1897
2463
|
}
|
|
1898
2464
|
const projectProducts = async (terminalResult) => {
|
|
2465
|
+
const canonicalResult = asCanonicalProductResponse(terminalResult, legacyFormatConverter);
|
|
1899
2466
|
await autoStoreResources(
|
|
1900
2467
|
ctxMetadataStore,
|
|
1901
2468
|
reqCtx.account?.id,
|
|
1902
2469
|
"product",
|
|
1903
|
-
|
|
2470
|
+
canonicalResult?.products,
|
|
1904
2471
|
"product_id",
|
|
1905
2472
|
logger
|
|
1906
2473
|
);
|
|
@@ -1911,7 +2478,11 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
1911
2478
|
ctx: reqCtx
|
|
1912
2479
|
});
|
|
1913
2480
|
}
|
|
1914
|
-
return
|
|
2481
|
+
return asProductResponseForWire(
|
|
2482
|
+
canonicalResult,
|
|
2483
|
+
responseWireMode,
|
|
2484
|
+
canonicalFormatLegacyResolver
|
|
2485
|
+
);
|
|
1915
2486
|
};
|
|
1916
2487
|
const isHandoff = isTaskHandoff(result);
|
|
1917
2488
|
if (buyingMode === "wholesale" && isHandoff) {
|
|
@@ -1957,12 +2528,15 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
1957
2528
|
},
|
|
1958
2529
|
...sales?.createMediaBuy && {
|
|
1959
2530
|
createMediaBuy: async (params, ctx) => {
|
|
2531
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2532
|
+
params = asCanonicalSemanticServerRequest(params, "create_media_buy", legacyFormatConverter);
|
|
1960
2533
|
const reqCtx = ctxFor(ctx, params);
|
|
1961
2534
|
await hydratePackagesWithProducts(
|
|
1962
2535
|
ctxMetadataStore,
|
|
1963
2536
|
reqCtx.account?.id,
|
|
1964
2537
|
params?.packages,
|
|
1965
|
-
logger
|
|
2538
|
+
logger,
|
|
2539
|
+
legacyFormatConverter
|
|
1966
2540
|
);
|
|
1967
2541
|
let reservation = null;
|
|
1968
2542
|
if (proposalStore) {
|
|
@@ -2021,7 +2595,13 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2021
2595
|
result,
|
|
2022
2596
|
async (r) => {
|
|
2023
2597
|
await persistTargetingOverlayFromCreate(mediaBuyStore, reqCtx.account?.id, params, r, logger);
|
|
2024
|
-
return
|
|
2598
|
+
return asSemanticServerResponseForWire(
|
|
2599
|
+
r,
|
|
2600
|
+
"create_media_buy",
|
|
2601
|
+
legacyFormatConverter,
|
|
2602
|
+
canonicalFormatLegacyResolver,
|
|
2603
|
+
responseWireMode
|
|
2604
|
+
);
|
|
2025
2605
|
}
|
|
2026
2606
|
);
|
|
2027
2607
|
},
|
|
@@ -2031,6 +2611,8 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2031
2611
|
},
|
|
2032
2612
|
...sales?.updateMediaBuy && {
|
|
2033
2613
|
updateMediaBuy: async (params, ctx) => {
|
|
2614
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2615
|
+
params = asCanonicalSemanticServerRequest(params, "update_media_buy", legacyFormatConverter);
|
|
2034
2616
|
const reqCtx = ctxFor(ctx, params);
|
|
2035
2617
|
const { media_buy_id } = params;
|
|
2036
2618
|
if (!media_buy_id) {
|
|
@@ -2039,7 +2621,14 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2039
2621
|
field: "media_buy_id"
|
|
2040
2622
|
});
|
|
2041
2623
|
}
|
|
2042
|
-
await hydrateForTool(
|
|
2624
|
+
await hydrateForTool(
|
|
2625
|
+
ctxMetadataStore,
|
|
2626
|
+
reqCtx.account?.id,
|
|
2627
|
+
"update_media_buy",
|
|
2628
|
+
params,
|
|
2629
|
+
logger,
|
|
2630
|
+
legacyFormatConverter
|
|
2631
|
+
);
|
|
2043
2632
|
if (proposalStore) {
|
|
2044
2633
|
const record = await maybeHydrateRecipesForMediaBuyId({
|
|
2045
2634
|
mediaBuyId: media_buy_id,
|
|
@@ -2056,7 +2645,11 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2056
2645
|
const push = extractPushConfig(params, logger, {
|
|
2057
2646
|
allowPrivateWebhookUrls: pushOpts.allowPrivateWebhookUrls
|
|
2058
2647
|
});
|
|
2059
|
-
const result = await sales.updateMediaBuy(
|
|
2648
|
+
const result = await sales.updateMediaBuy(
|
|
2649
|
+
media_buy_id,
|
|
2650
|
+
params,
|
|
2651
|
+
reqCtx
|
|
2652
|
+
);
|
|
2060
2653
|
return routeIfHandoff(
|
|
2061
2654
|
taskRegistry,
|
|
2062
2655
|
{
|
|
@@ -2080,7 +2673,13 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2080
2673
|
params,
|
|
2081
2674
|
logger
|
|
2082
2675
|
);
|
|
2083
|
-
return
|
|
2676
|
+
return asSemanticServerResponseForWire(
|
|
2677
|
+
r,
|
|
2678
|
+
"update_media_buy",
|
|
2679
|
+
legacyFormatConverter,
|
|
2680
|
+
canonicalFormatLegacyResolver,
|
|
2681
|
+
responseWireMode
|
|
2682
|
+
);
|
|
2084
2683
|
}
|
|
2085
2684
|
);
|
|
2086
2685
|
},
|
|
@@ -2089,6 +2688,8 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2089
2688
|
}
|
|
2090
2689
|
},
|
|
2091
2690
|
syncCreatives: async (params, ctx) => {
|
|
2691
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2692
|
+
params = asCanonicalSemanticServerRequest(params, "sync_creatives", legacyFormatConverter);
|
|
2092
2693
|
const reqCtx = ctxFor(ctx, params);
|
|
2093
2694
|
const creatives = params.creatives ?? [];
|
|
2094
2695
|
if (!sales?.syncCreatives) {
|
|
@@ -2115,7 +2716,13 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2115
2716
|
logger
|
|
2116
2717
|
},
|
|
2117
2718
|
result,
|
|
2118
|
-
(rows) => (
|
|
2719
|
+
(rows) => asSemanticServerResponseForWire(
|
|
2720
|
+
{ creatives: rows.map(normalizeRowErrors) },
|
|
2721
|
+
"sync_creatives",
|
|
2722
|
+
legacyFormatConverter,
|
|
2723
|
+
canonicalFormatLegacyResolver,
|
|
2724
|
+
responseWireMode
|
|
2725
|
+
)
|
|
2119
2726
|
);
|
|
2120
2727
|
},
|
|
2121
2728
|
(r) => r
|
|
@@ -2123,6 +2730,7 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2123
2730
|
},
|
|
2124
2731
|
...sales?.getMediaBuyDelivery && {
|
|
2125
2732
|
getMediaBuyDelivery: async (params, ctx) => {
|
|
2733
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2126
2734
|
const reqCtx = ctxFor(ctx, params);
|
|
2127
2735
|
if (proposalStore) {
|
|
2128
2736
|
const ids = params.media_buy_ids;
|
|
@@ -2148,7 +2756,13 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2148
2756
|
result?.media_buy_deliveries,
|
|
2149
2757
|
logger
|
|
2150
2758
|
);
|
|
2151
|
-
return
|
|
2759
|
+
return asSemanticServerResponseForWire(
|
|
2760
|
+
result,
|
|
2761
|
+
"get_media_buy_delivery",
|
|
2762
|
+
legacyFormatConverter,
|
|
2763
|
+
canonicalFormatLegacyResolver,
|
|
2764
|
+
responseWireMode
|
|
2765
|
+
);
|
|
2152
2766
|
},
|
|
2153
2767
|
(actuals) => actuals
|
|
2154
2768
|
);
|
|
@@ -2156,19 +2770,20 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2156
2770
|
},
|
|
2157
2771
|
// Optional methods — return UNSUPPORTED_FEATURE when the platform omits
|
|
2158
2772
|
// them. Adopters that haven't migrated to the v6 platform interface for
|
|
2159
|
-
// these specific tools can still pass raw handlers via opts.mediaBuy
|
|
2773
|
+
// these specific tools can still pass raw handlers via opts.legacyHandlers.mediaBuy
|
|
2160
2774
|
// (merge seam) — the merge runs AFTER buildMediaBuyHandlers, so opts
|
|
2161
2775
|
// handlers fill in for the methods this platform omits.
|
|
2162
2776
|
// `getMediaBuys` is REQUIRED at the type level, but we keep a runtime
|
|
2163
2777
|
// guard for the merge-seam migration path: legacy adopters wire it via
|
|
2164
|
-
// `opts.mediaBuy.getMediaBuys` rather than on the platform interface.
|
|
2778
|
+
// `opts.legacyHandlers.mediaBuy.getMediaBuys` rather than on the platform interface.
|
|
2165
2779
|
// Once the migration completes (every adopter implements it natively),
|
|
2166
2780
|
// this conditional spreads can collapse — but for now, omitting the
|
|
2167
2781
|
// platform-derived handler when absent lets `mergeHandlers` pick up the
|
|
2168
|
-
// adopter's custom handler from `opts.mediaBuy` instead of throwing
|
|
2782
|
+
// adopter's custom handler from `opts.legacyHandlers.mediaBuy` instead of throwing
|
|
2169
2783
|
// `sales.getMediaBuys is not a function`.
|
|
2170
2784
|
...sales?.getMediaBuys && {
|
|
2171
2785
|
getMediaBuys: async (params, ctx) => {
|
|
2786
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2172
2787
|
const reqCtx = ctxFor(ctx, params);
|
|
2173
2788
|
return projectSync(
|
|
2174
2789
|
async () => {
|
|
@@ -2180,16 +2795,29 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2180
2795
|
result?.media_buys,
|
|
2181
2796
|
logger
|
|
2182
2797
|
);
|
|
2798
|
+
const canonicalResult = asCanonicalSemanticServerResponse(
|
|
2799
|
+
result,
|
|
2800
|
+
"get_media_buys",
|
|
2801
|
+
legacyFormatConverter,
|
|
2802
|
+
canonicalFormatLegacyResolver
|
|
2803
|
+
);
|
|
2183
2804
|
await autoStoreResources(
|
|
2184
2805
|
ctxMetadataStore,
|
|
2185
2806
|
reqCtx.account?.id,
|
|
2186
2807
|
"media_buy",
|
|
2187
|
-
|
|
2808
|
+
canonicalResult?.media_buys,
|
|
2188
2809
|
"media_buy_id",
|
|
2189
2810
|
logger
|
|
2190
2811
|
);
|
|
2191
|
-
|
|
2192
|
-
|
|
2812
|
+
const wireResult = responseWireMode === "canonical" ? attachCanonicalCustomFormatWireRefs(canonicalResult, canonicalFormatLegacyResolver, "get_media_buys") : asSemanticServerResponseForWire(
|
|
2813
|
+
result,
|
|
2814
|
+
"get_media_buys",
|
|
2815
|
+
legacyFormatConverter,
|
|
2816
|
+
canonicalFormatLegacyResolver,
|
|
2817
|
+
responseWireMode
|
|
2818
|
+
);
|
|
2819
|
+
await backfillTargetingOverlay(mediaBuyStore, reqCtx.account?.id, wireResult, logger);
|
|
2820
|
+
return wireResult;
|
|
2193
2821
|
},
|
|
2194
2822
|
(r) => r
|
|
2195
2823
|
);
|
|
@@ -2197,37 +2825,64 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2197
2825
|
},
|
|
2198
2826
|
...sales?.providePerformanceFeedback && {
|
|
2199
2827
|
providePerformanceFeedback: async (params, ctx) => {
|
|
2828
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2829
|
+
params = asCanonicalSemanticServerRequest(params, "provide_performance_feedback", legacyFormatConverter);
|
|
2200
2830
|
const reqCtx = ctxFor(ctx, params);
|
|
2201
|
-
await hydrateForTool(
|
|
2831
|
+
await hydrateForTool(
|
|
2832
|
+
ctxMetadataStore,
|
|
2833
|
+
reqCtx.account?.id,
|
|
2834
|
+
"provide_performance_feedback",
|
|
2835
|
+
params,
|
|
2836
|
+
logger,
|
|
2837
|
+
legacyFormatConverter
|
|
2838
|
+
);
|
|
2202
2839
|
return projectSync(
|
|
2203
2840
|
() => sales.providePerformanceFeedback(params, reqCtx),
|
|
2204
|
-
(
|
|
2841
|
+
(result) => asSemanticServerResponseForWire(
|
|
2842
|
+
result,
|
|
2843
|
+
"provide_performance_feedback",
|
|
2844
|
+
legacyFormatConverter,
|
|
2845
|
+
canonicalFormatLegacyResolver,
|
|
2846
|
+
responseWireMode
|
|
2847
|
+
)
|
|
2205
2848
|
);
|
|
2206
2849
|
}
|
|
2207
2850
|
},
|
|
2208
|
-
...sales?.
|
|
2851
|
+
...sales?.listCreativeFormatsLegacy && {
|
|
2209
2852
|
listCreativeFormats: async (params, ctx) => {
|
|
2210
2853
|
const reqCtx = ctxFor(ctx, params);
|
|
2211
2854
|
return projectSync(
|
|
2212
|
-
() => sales.
|
|
2855
|
+
() => sales.listCreativeFormatsLegacy(params, reqCtx),
|
|
2213
2856
|
(r) => r
|
|
2214
2857
|
);
|
|
2215
2858
|
}
|
|
2216
2859
|
},
|
|
2217
2860
|
...sales?.listCreatives && {
|
|
2218
2861
|
listCreatives: async (params, ctx) => {
|
|
2219
|
-
const
|
|
2862
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2863
|
+
const canonicalParams = asCanonicalListCreativesRequest(
|
|
2864
|
+
params,
|
|
2865
|
+
legacyFormatConverter
|
|
2866
|
+
);
|
|
2867
|
+
const reqCtx = ctxFor(ctx, canonicalParams);
|
|
2220
2868
|
return projectSync(
|
|
2221
2869
|
async () => {
|
|
2222
|
-
const result = await sales.listCreatives(
|
|
2870
|
+
const result = await sales.listCreatives(canonicalParams, reqCtx);
|
|
2871
|
+
const canonicalResult = asSemanticServerResponseForWire(
|
|
2872
|
+
result,
|
|
2873
|
+
"list_creatives",
|
|
2874
|
+
legacyFormatConverter,
|
|
2875
|
+
canonicalFormatLegacyResolver,
|
|
2876
|
+
responseWireMode
|
|
2877
|
+
);
|
|
2223
2878
|
warnIfTruncatedMultiIdResponse(
|
|
2224
2879
|
"listCreatives",
|
|
2225
2880
|
"creative_ids",
|
|
2226
2881
|
params.creative_ids,
|
|
2227
|
-
|
|
2882
|
+
canonicalResult?.creatives,
|
|
2228
2883
|
logger
|
|
2229
2884
|
);
|
|
2230
|
-
return
|
|
2885
|
+
return canonicalResult;
|
|
2231
2886
|
},
|
|
2232
2887
|
(r) => r
|
|
2233
2888
|
);
|
|
@@ -2245,26 +2900,26 @@ function projectBuildCreativeReturn(ret) {
|
|
|
2245
2900
|
}
|
|
2246
2901
|
return { creative_manifest: ret };
|
|
2247
2902
|
}
|
|
2248
|
-
function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observability, logger, pushOpts, ctxFor) {
|
|
2903
|
+
function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observability, logger, pushOpts, ctxFor, legacyFormatConverter, canonicalFormatLegacyResolver, creativeWireMode) {
|
|
2249
2904
|
const creative = platform.creative;
|
|
2250
2905
|
if (!creative) return void 0;
|
|
2251
2906
|
return {
|
|
2252
2907
|
buildCreative: async (params, ctx) => {
|
|
2253
2908
|
const reqCtx = ctxFor(ctx, params);
|
|
2254
2909
|
return projectSync(
|
|
2255
|
-
() => creative.
|
|
2910
|
+
() => creative.buildCreativeLegacy(params, reqCtx),
|
|
2256
2911
|
(ret) => projectBuildCreativeReturn(ret)
|
|
2257
2912
|
);
|
|
2258
2913
|
},
|
|
2259
2914
|
previewCreative: async (params, ctx) => {
|
|
2260
|
-
if (!("
|
|
2915
|
+
if (!("previewCreativeLegacy" in creative) || creative.previewCreativeLegacy == null) {
|
|
2261
2916
|
return adcpError("UNSUPPORTED_FEATURE", {
|
|
2262
|
-
message: "preview_creative: this creative platform did not implement
|
|
2917
|
+
message: "preview_creative: this creative platform did not implement previewCreativeLegacy. Add `previewCreativeLegacy(req, ctx)` to your CreativeBuilderPlatform / CreativeAdServerPlatform literal."
|
|
2263
2918
|
});
|
|
2264
2919
|
}
|
|
2265
2920
|
const reqCtx = ctxFor(ctx, params);
|
|
2266
2921
|
return projectSync(
|
|
2267
|
-
() => creative.
|
|
2922
|
+
() => creative.previewCreativeLegacy(params, reqCtx),
|
|
2268
2923
|
(preview) => preview
|
|
2269
2924
|
);
|
|
2270
2925
|
},
|
|
@@ -2274,14 +2929,14 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2274
2929
|
// undefined per `NoAccountCtx`. Wired identically on both
|
|
2275
2930
|
// `CreativeBuilderPlatform` and `CreativeAdServerPlatform`.
|
|
2276
2931
|
listCreativeFormats: async (params, ctx) => {
|
|
2277
|
-
if (!("
|
|
2932
|
+
if (!("listCreativeFormatsLegacy" in creative) || creative.listCreativeFormatsLegacy == null) {
|
|
2278
2933
|
return adcpError("UNSUPPORTED_FEATURE", {
|
|
2279
|
-
message: "list_creative_formats: this creative platform did not implement
|
|
2934
|
+
message: "list_creative_formats: this creative platform did not implement listCreativeFormatsLegacy. Add `listCreativeFormatsLegacy(req, ctx)` to your CreativeBuilderPlatform / CreativeAdServerPlatform literal, or delegate via `capabilities.creative_agents`."
|
|
2280
2935
|
});
|
|
2281
2936
|
}
|
|
2282
2937
|
const reqCtx = ctxFor(ctx, params);
|
|
2283
2938
|
return projectSync(
|
|
2284
|
-
() => creative.
|
|
2939
|
+
() => creative.listCreativeFormatsLegacy(params, reqCtx),
|
|
2285
2940
|
(r) => r
|
|
2286
2941
|
);
|
|
2287
2942
|
},
|
|
@@ -2292,6 +2947,8 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2292
2947
|
// buildAccountHandlers — see comment at line 4544.
|
|
2293
2948
|
...creative.syncCreatives != null && {
|
|
2294
2949
|
syncCreatives: async (params, ctx) => {
|
|
2950
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2951
|
+
params = asCanonicalSemanticServerRequest(params, "sync_creatives", legacyFormatConverter);
|
|
2295
2952
|
const reqCtx = ctxFor(ctx, params);
|
|
2296
2953
|
const creatives = params.creatives ?? [];
|
|
2297
2954
|
return projectSync(
|
|
@@ -2315,7 +2972,13 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2315
2972
|
logger
|
|
2316
2973
|
},
|
|
2317
2974
|
result,
|
|
2318
|
-
(rows) => (
|
|
2975
|
+
(rows) => asSemanticServerResponseForWire(
|
|
2976
|
+
{ creatives: rows.map(normalizeRowErrors) },
|
|
2977
|
+
"sync_creatives",
|
|
2978
|
+
legacyFormatConverter,
|
|
2979
|
+
canonicalFormatLegacyResolver,
|
|
2980
|
+
responseWireMode
|
|
2981
|
+
)
|
|
2319
2982
|
);
|
|
2320
2983
|
},
|
|
2321
2984
|
(r) => r
|
|
@@ -2329,18 +2992,30 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2329
2992
|
// every call. Only emit handlers when the platform method is present.
|
|
2330
2993
|
..."listCreatives" in creative && creative.listCreatives != null && {
|
|
2331
2994
|
listCreatives: async (params, ctx) => {
|
|
2332
|
-
const
|
|
2995
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2996
|
+
const canonicalParams = asCanonicalListCreativesRequest(
|
|
2997
|
+
params,
|
|
2998
|
+
legacyFormatConverter
|
|
2999
|
+
);
|
|
3000
|
+
const reqCtx = ctxFor(ctx, canonicalParams);
|
|
2333
3001
|
return projectSync(
|
|
2334
3002
|
async () => {
|
|
2335
|
-
const result = await creative.listCreatives(
|
|
3003
|
+
const result = await creative.listCreatives(canonicalParams, reqCtx);
|
|
3004
|
+
const canonicalResult = asSemanticServerResponseForWire(
|
|
3005
|
+
result,
|
|
3006
|
+
"list_creatives",
|
|
3007
|
+
legacyFormatConverter,
|
|
3008
|
+
canonicalFormatLegacyResolver,
|
|
3009
|
+
responseWireMode
|
|
3010
|
+
);
|
|
2336
3011
|
warnIfTruncatedMultiIdResponse(
|
|
2337
3012
|
"listCreatives",
|
|
2338
3013
|
"creative_ids",
|
|
2339
3014
|
params.creative_ids,
|
|
2340
|
-
|
|
3015
|
+
canonicalResult?.creatives,
|
|
2341
3016
|
logger
|
|
2342
3017
|
);
|
|
2343
|
-
return
|
|
3018
|
+
return canonicalResult;
|
|
2344
3019
|
},
|
|
2345
3020
|
(r) => r
|
|
2346
3021
|
);
|
|
@@ -2348,6 +3023,7 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2348
3023
|
},
|
|
2349
3024
|
..."getCreativeDelivery" in creative && creative.getCreativeDelivery != null && {
|
|
2350
3025
|
getCreativeDelivery: async (params, ctx) => {
|
|
3026
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2351
3027
|
const reqCtx = ctxFor(ctx, params);
|
|
2352
3028
|
return projectSync(
|
|
2353
3029
|
async () => {
|
|
@@ -2359,7 +3035,13 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2359
3035
|
result?.creative_deliveries,
|
|
2360
3036
|
logger
|
|
2361
3037
|
);
|
|
2362
|
-
return
|
|
3038
|
+
return asSemanticServerResponseForWire(
|
|
3039
|
+
result,
|
|
3040
|
+
"get_creative_delivery",
|
|
3041
|
+
legacyFormatConverter,
|
|
3042
|
+
canonicalFormatLegacyResolver,
|
|
3043
|
+
responseWireMode
|
|
3044
|
+
);
|
|
2363
3045
|
},
|
|
2364
3046
|
(r) => r
|
|
2365
3047
|
);
|
|
@@ -2605,7 +3287,7 @@ function buildBrandRightsHandlers(platform, ctxFor, ctxMetadataStore, logger) {
|
|
|
2605
3287
|
const reqCtx = ctxFor(ctx, params);
|
|
2606
3288
|
return projectSync(
|
|
2607
3289
|
async () => {
|
|
2608
|
-
const result = await br.
|
|
3290
|
+
const result = await br.getRightsLegacy(params, reqCtx);
|
|
2609
3291
|
await autoStoreResources(
|
|
2610
3292
|
ctxMetadataStore,
|
|
2611
3293
|
reqCtx.account?.id,
|
|
@@ -2628,7 +3310,7 @@ function buildBrandRightsHandlers(platform, ctxFor, ctxMetadataStore, logger) {
|
|
|
2628
3310
|
const reqCtx = ctxFor(ctx, params);
|
|
2629
3311
|
await hydrateForTool(ctxMetadataStore, reqCtx.account?.id, "acquire_rights", params, logger);
|
|
2630
3312
|
return projectSync(
|
|
2631
|
-
() => br.
|
|
3313
|
+
() => br.acquireRightsLegacy(params, reqCtx),
|
|
2632
3314
|
(r) => r
|
|
2633
3315
|
);
|
|
2634
3316
|
},
|
|
@@ -2646,7 +3328,7 @@ function buildBrandRightsHandlers(platform, ctxFor, ctxMetadataStore, logger) {
|
|
|
2646
3328
|
const reqCtx = ctxFor(ctx, params);
|
|
2647
3329
|
await hydrateForTool(ctxMetadataStore, reqCtx.account?.id, "update_rights", params, logger);
|
|
2648
3330
|
return projectSync(
|
|
2649
|
-
() => br.
|
|
3331
|
+
() => br.updateRightsLegacy(params, reqCtx),
|
|
2650
3332
|
(r) => r
|
|
2651
3333
|
);
|
|
2652
3334
|
}
|
|
@@ -2767,59 +3449,59 @@ function buildGovernanceHandlers(platform, ctxFor) {
|
|
|
2767
3449
|
handlers.listContentStandards = async (params, ctx) => {
|
|
2768
3450
|
const reqCtx = ctxFor(ctx, params);
|
|
2769
3451
|
return projectSync(
|
|
2770
|
-
() => cs.
|
|
3452
|
+
() => cs.listContentStandardsLegacy(params, reqCtx),
|
|
2771
3453
|
(r) => r
|
|
2772
3454
|
);
|
|
2773
3455
|
};
|
|
2774
3456
|
handlers.getContentStandards = async (params, ctx) => {
|
|
2775
3457
|
const reqCtx = ctxFor(ctx, params);
|
|
2776
3458
|
return projectSync(
|
|
2777
|
-
() => cs.
|
|
3459
|
+
() => cs.getContentStandardsLegacy(params, reqCtx),
|
|
2778
3460
|
(r) => r
|
|
2779
3461
|
);
|
|
2780
3462
|
};
|
|
2781
3463
|
handlers.createContentStandards = async (params, ctx) => {
|
|
2782
3464
|
const reqCtx = ctxFor(ctx, params);
|
|
2783
3465
|
return projectSync(
|
|
2784
|
-
() => cs.
|
|
3466
|
+
() => cs.createContentStandardsLegacy(params, reqCtx),
|
|
2785
3467
|
(r) => r
|
|
2786
3468
|
);
|
|
2787
3469
|
};
|
|
2788
3470
|
handlers.updateContentStandards = async (params, ctx) => {
|
|
2789
3471
|
const reqCtx = ctxFor(ctx, params);
|
|
2790
3472
|
return projectSync(
|
|
2791
|
-
() => cs.
|
|
3473
|
+
() => cs.updateContentStandardsLegacy(params, reqCtx),
|
|
2792
3474
|
(r) => r
|
|
2793
3475
|
);
|
|
2794
3476
|
};
|
|
2795
3477
|
handlers.calibrateContent = async (params, ctx) => {
|
|
2796
3478
|
const reqCtx = ctxFor(ctx, params);
|
|
2797
3479
|
return projectSync(
|
|
2798
|
-
() => cs.
|
|
3480
|
+
() => cs.calibrateContentLegacy(params, reqCtx),
|
|
2799
3481
|
(r) => r
|
|
2800
3482
|
);
|
|
2801
3483
|
};
|
|
2802
3484
|
handlers.validateContentDelivery = async (params, ctx) => {
|
|
2803
3485
|
const reqCtx = ctxFor(ctx, params);
|
|
2804
3486
|
return projectSync(
|
|
2805
|
-
() => cs.
|
|
3487
|
+
() => cs.validateContentDeliveryLegacy(params, reqCtx),
|
|
2806
3488
|
(r) => r
|
|
2807
3489
|
);
|
|
2808
3490
|
};
|
|
2809
|
-
if (cs.
|
|
3491
|
+
if (cs.getMediaBuyArtifactsLegacy) {
|
|
2810
3492
|
handlers.getMediaBuyArtifacts = async (params, ctx) => {
|
|
2811
3493
|
const reqCtx = ctxFor(ctx, params);
|
|
2812
3494
|
return projectSync(
|
|
2813
|
-
() => cs.
|
|
3495
|
+
() => cs.getMediaBuyArtifactsLegacy(params, reqCtx),
|
|
2814
3496
|
(r) => r
|
|
2815
3497
|
);
|
|
2816
3498
|
};
|
|
2817
3499
|
}
|
|
2818
|
-
if (cs.
|
|
3500
|
+
if (cs.getCreativeFeaturesLegacy) {
|
|
2819
3501
|
handlers.getCreativeFeatures = async (params, ctx) => {
|
|
2820
3502
|
const reqCtx = ctxFor(ctx, params);
|
|
2821
3503
|
return projectSync(
|
|
2822
|
-
() => cs.
|
|
3504
|
+
() => cs.getCreativeFeaturesLegacy(params, reqCtx),
|
|
2823
3505
|
(r) => r
|
|
2824
3506
|
);
|
|
2825
3507
|
};
|