@adcp/sdk 12.1.0 → 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/authorization-required.d.mts +3 -0
- package/dist/lib/auth/oauth/authorization-required.d.ts +3 -0
- package/dist/lib/auth/oauth/authorization-required.d.ts.map +1 -1
- package/dist/lib/auth/oauth/authorization-required.js +12 -9
- package/dist/lib/auth/oauth/authorization-required.js.map +1 -1
- package/dist/lib/auth/oauth/authorization-required.mjs +12 -9
- package/dist/lib/auth/oauth/authorization-required.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 +129 -52
- package/dist/lib/core/SingleAgentClient.d.ts +129 -52
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +1748 -218
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/core/SingleAgentClient.mjs +1758 -218
- 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 +137 -44
- package/dist/lib/core/TaskExecutor.js.map +1 -1
- package/dist/lib/core/TaskExecutor.mjs +137 -44
- 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/net/ssrf-fetch.d.mts +13 -1
- package/dist/lib/net/ssrf-fetch.d.ts +13 -1
- package/dist/lib/net/ssrf-fetch.d.ts.map +1 -1
- package/dist/lib/net/ssrf-fetch.js +14 -7
- package/dist/lib/net/ssrf-fetch.js.map +1 -1
- package/dist/lib/net/ssrf-fetch.mjs +14 -7
- package/dist/lib/net/ssrf-fetch.mjs.map +1 -1
- package/dist/lib/protocols/a2a.d.mts +2 -2
- package/dist/lib/protocols/a2a.d.ts +2 -2
- package/dist/lib/protocols/a2a.d.ts.map +1 -1
- package/dist/lib/protocols/a2a.js +14 -9
- package/dist/lib/protocols/a2a.js.map +1 -1
- package/dist/lib/protocols/a2a.mjs +14 -9
- package/dist/lib/protocols/a2a.mjs.map +1 -1
- package/dist/lib/protocols/index.d.mts +20 -3
- package/dist/lib/protocols/index.d.ts +20 -3
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +44 -31
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/protocols/index.mjs +44 -32
- 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/protocols/mcp-tasks.d.mts +3 -0
- package/dist/lib/protocols/mcp-tasks.d.ts +3 -0
- package/dist/lib/protocols/mcp-tasks.d.ts.map +1 -1
- package/dist/lib/protocols/mcp-tasks.js +21 -11
- package/dist/lib/protocols/mcp-tasks.js.map +1 -1
- package/dist/lib/protocols/mcp-tasks.mjs +21 -11
- package/dist/lib/protocols/mcp-tasks.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.d.ts.map +1 -1
- package/dist/lib/testing/client.js +13 -5
- package/dist/lib/testing/client.js.map +1 -1
- package/dist/lib/testing/client.mjs +13 -5
- package/dist/lib/testing/client.mjs.map +1 -1
- package/dist/lib/testing/compliance/comply.d.mts +1 -1
- package/dist/lib/testing/compliance/comply.d.ts +1 -1
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +16 -6
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/testing/compliance/comply.mjs +16 -6
- package/dist/lib/testing/compliance/comply.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/probes.d.mts +6 -0
- package/dist/lib/testing/storyboard/probes.d.ts +6 -0
- package/dist/lib/testing/storyboard/probes.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/probes.js +16 -5
- package/dist/lib/testing/storyboard/probes.js.map +1 -1
- package/dist/lib/testing/storyboard/probes.mjs +16 -5
- package/dist/lib/testing/storyboard/probes.mjs.map +1 -1
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +6 -2
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/testing/storyboard/runner.mjs +6 -2
- package/dist/lib/testing/storyboard/runner.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/testing/types.d.mts +7 -1
- package/dist/lib/testing/types.d.ts +7 -1
- package/dist/lib/testing/types.d.ts.map +1 -1
- package/dist/lib/testing/types.js.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
|
@@ -56,6 +56,11 @@ var import_account_mode = require('../../account-mode.js');
|
|
|
56
56
|
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
|
+
var import_creative_delivery = require('../../../v2/projection/creative-delivery.js');
|
|
60
|
+
var import_augment_response = require('../../../v2/projection/augment-response.js');
|
|
61
|
+
var import_v2_to_v1 = require('../../../v2/projection/v2-to-v1.js');
|
|
62
|
+
var import_legacy_metadata = require('../../../v2/projection/legacy-metadata.js');
|
|
63
|
+
var import_version = require('../../../version.js');
|
|
59
64
|
const DEFAULT_FRAMEWORK_LOGGER = {
|
|
60
65
|
debug: () => {
|
|
61
66
|
},
|
|
@@ -66,6 +71,87 @@ const DEFAULT_FRAMEWORK_LOGGER = {
|
|
|
66
71
|
// eslint-disable-next-line no-console
|
|
67
72
|
error: console.error.bind(console)
|
|
68
73
|
};
|
|
74
|
+
function supportsCanonicalCreativeCapability(version) {
|
|
75
|
+
if (typeof version !== "string") return false;
|
|
76
|
+
const match = /^v?(\d+)\.(\d+)(?:\.|-|$)/.exec(version.trim());
|
|
77
|
+
if (!match) return false;
|
|
78
|
+
const major = Number(match[1]);
|
|
79
|
+
const minor = Number(match[2]);
|
|
80
|
+
return major > 3 || major === 3 && minor >= 1;
|
|
81
|
+
}
|
|
82
|
+
function requiresCanonicalCreativeWire(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 >= 2;
|
|
89
|
+
}
|
|
90
|
+
function creativeWireEvidenceForRequest(request) {
|
|
91
|
+
let canonical = false;
|
|
92
|
+
let legacy = false;
|
|
93
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
94
|
+
if (request !== null && typeof request === "object") {
|
|
95
|
+
const ext = Object.getOwnPropertyDescriptor(request, "ext");
|
|
96
|
+
if (ext && "value" in ext && ext.value !== null && typeof ext.value === "object") {
|
|
97
|
+
const adcp = Object.getOwnPropertyDescriptor(ext.value, "adcp");
|
|
98
|
+
if (adcp && "value" in adcp && adcp.value !== null && typeof adcp.value === "object") {
|
|
99
|
+
const wire = Object.getOwnPropertyDescriptor(adcp.value, "creative_wire");
|
|
100
|
+
if (wire && "value" in wire) {
|
|
101
|
+
if (wire.value === "canonical") canonical = true;
|
|
102
|
+
if (wire.value === "legacy") legacy = true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const visit = (value) => {
|
|
108
|
+
if (value === null || typeof value !== "object" || seen.has(value)) return;
|
|
109
|
+
seen.add(value);
|
|
110
|
+
const arrayValue = Array.isArray(value);
|
|
111
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
112
|
+
for (const [key, descriptor] of Object.entries(descriptors)) {
|
|
113
|
+
if (!descriptor.enumerable || !("value" in descriptor)) continue;
|
|
114
|
+
const child = descriptor.value;
|
|
115
|
+
if (key === "context" || key === "ext") continue;
|
|
116
|
+
if (/(^|_)(?:format_ids?|v1_format_ref)($|_)/.test(key)) legacy = true;
|
|
117
|
+
if (key === "format_kind" || key === "format_options" || key === "format_option_ref" || key === "format_option_refs") {
|
|
118
|
+
canonical = true;
|
|
119
|
+
}
|
|
120
|
+
if (arrayValue && typeof child === "string") {
|
|
121
|
+
if (child === "format_id" || child === "format_ids") legacy = true;
|
|
122
|
+
if (child === "format_kind" || child === "format_options" || child === "format_option_ref") canonical = true;
|
|
123
|
+
}
|
|
124
|
+
visit(child);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
visit(request);
|
|
128
|
+
if (canonical && legacy) return "mixed";
|
|
129
|
+
if (canonical) return "canonical";
|
|
130
|
+
if (legacy) return "legacy";
|
|
131
|
+
return "unknown";
|
|
132
|
+
}
|
|
133
|
+
function creativeWireModeForRequest(ctx, fallback, request) {
|
|
134
|
+
if (ctx.servedAdcpVersion === void 0) return fallback;
|
|
135
|
+
if (!supportsCanonicalCreativeCapability(ctx.servedAdcpVersion)) return "legacy";
|
|
136
|
+
if (requiresCanonicalCreativeWire(ctx.servedAdcpVersion)) return "canonical";
|
|
137
|
+
const evidence = creativeWireEvidenceForRequest(request);
|
|
138
|
+
if (evidence === "canonical" || evidence === "mixed") return "canonical";
|
|
139
|
+
if (evidence === "legacy") return "legacy";
|
|
140
|
+
return fallback;
|
|
141
|
+
}
|
|
142
|
+
function parseAdcpRelease(version) {
|
|
143
|
+
if (typeof version !== "string") return void 0;
|
|
144
|
+
const match = /^v?(\d+)\.(\d+)(?:\.(\d+))?(?:-|$)/.exec(version.trim());
|
|
145
|
+
if (!match) return void 0;
|
|
146
|
+
return [Number(match[1]), Number(match[2]), Number(match[3] ?? 0)];
|
|
147
|
+
}
|
|
148
|
+
function compareAdcpReleases(left, right) {
|
|
149
|
+
for (let index = 0; index < left.length; index++) {
|
|
150
|
+
const delta = left[index] - right[index];
|
|
151
|
+
if (delta !== 0) return delta;
|
|
152
|
+
}
|
|
153
|
+
return 0;
|
|
154
|
+
}
|
|
69
155
|
function isPlainObject(v) {
|
|
70
156
|
if (v === null || typeof v !== "object") return false;
|
|
71
157
|
if (Array.isArray(v)) return false;
|
|
@@ -95,6 +181,414 @@ function normalizeRowErrors(row) {
|
|
|
95
181
|
if (row?.errors == null) return row;
|
|
96
182
|
return { ...row, errors: (0, import_normalize_errors.normalizeErrors)(row.errors) };
|
|
97
183
|
}
|
|
184
|
+
function asCanonicalServerResponse(response) {
|
|
185
|
+
return (0, import_creative_delivery.stripLegacyCreativeIdentity)(response);
|
|
186
|
+
}
|
|
187
|
+
function ownEnumerableDataRecord(value, operation) {
|
|
188
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
189
|
+
const entries = Object.entries(descriptors).filter(([, descriptor]) => descriptor.enumerable);
|
|
190
|
+
if (entries.length === 0) return void 0;
|
|
191
|
+
const record = {};
|
|
192
|
+
for (const [key, descriptor] of entries) {
|
|
193
|
+
if (!("value" in descriptor)) {
|
|
194
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
195
|
+
operation,
|
|
196
|
+
`(response:${key})`,
|
|
197
|
+
"enumerable accessors cannot cross the creative format boundary safely"
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
record[key] = descriptor.value;
|
|
201
|
+
}
|
|
202
|
+
return record;
|
|
203
|
+
}
|
|
204
|
+
function assertSafeSemanticPayload(value, operation) {
|
|
205
|
+
const active = /* @__PURE__ */ new WeakSet();
|
|
206
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
207
|
+
const visit = (current, path) => {
|
|
208
|
+
if (current === null || typeof current !== "object") return;
|
|
209
|
+
if (Array.isArray(current) && Object.getPrototypeOf(current) !== Array.prototype) {
|
|
210
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
211
|
+
operation,
|
|
212
|
+
`(payload:${path})`,
|
|
213
|
+
"array subclasses cannot cross the creative format boundary safely"
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
for (let owner = current; owner !== null; owner = Object.getPrototypeOf(owner)) {
|
|
217
|
+
const toJSON = Object.getOwnPropertyDescriptor(owner, "toJSON");
|
|
218
|
+
if (!toJSON) continue;
|
|
219
|
+
if (!("value" in toJSON) || typeof toJSON.value === "function") {
|
|
220
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
221
|
+
operation,
|
|
222
|
+
`(payload:${path}.toJSON)`,
|
|
223
|
+
"custom or accessor toJSON hooks cannot cross the creative format boundary safely"
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (active.has(current)) {
|
|
228
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
229
|
+
operation,
|
|
230
|
+
`(payload:${path})`,
|
|
231
|
+
"cyclic values cannot cross the creative format boundary"
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
if (visited.has(current)) return;
|
|
235
|
+
active.add(current);
|
|
236
|
+
try {
|
|
237
|
+
const descriptors = Object.getOwnPropertyDescriptors(current);
|
|
238
|
+
for (const [key, descriptor] of Object.entries(descriptors)) {
|
|
239
|
+
if (!("value" in descriptor)) {
|
|
240
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
241
|
+
operation,
|
|
242
|
+
`(payload:${path}.${key})`,
|
|
243
|
+
"accessors cannot cross the creative format boundary safely"
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
if (!descriptor.enumerable) continue;
|
|
247
|
+
visit(descriptor.value, `${path}.${key}`);
|
|
248
|
+
}
|
|
249
|
+
} finally {
|
|
250
|
+
active.delete(current);
|
|
251
|
+
}
|
|
252
|
+
visited.add(current);
|
|
253
|
+
};
|
|
254
|
+
visit(value, "$");
|
|
255
|
+
}
|
|
256
|
+
function projectResponseCreativeIdentities(value, operation, legacyFormatConverter, canonicalFormatLegacyResolver, wireMode, selectorContainer = {}) {
|
|
257
|
+
if (Array.isArray(value)) {
|
|
258
|
+
return value.map(
|
|
259
|
+
(item) => projectResponseCreativeIdentities(
|
|
260
|
+
item,
|
|
261
|
+
operation,
|
|
262
|
+
legacyFormatConverter,
|
|
263
|
+
canonicalFormatLegacyResolver,
|
|
264
|
+
wireMode,
|
|
265
|
+
selectorContainer
|
|
266
|
+
)
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
if (value === null || typeof value !== "object") return value;
|
|
270
|
+
const inspectedRecord = ownEnumerableDataRecord(value, operation);
|
|
271
|
+
if (inspectedRecord === void 0) return value;
|
|
272
|
+
const dataRecord = isPlainObject(value) ? value : inspectedRecord;
|
|
273
|
+
let projected = dataRecord;
|
|
274
|
+
const isProduct = typeof projected.product_id === "string" && ("name" in projected || "description" in projected) && (Array.isArray(projected.format_ids) || Array.isArray(projected.format_options));
|
|
275
|
+
if (isProduct) {
|
|
276
|
+
if (wireMode === "canonical") {
|
|
277
|
+
const canonical = (0, import_augment_response.toCanonicalOnlyResponse)(
|
|
278
|
+
{ products: [projected] },
|
|
279
|
+
{ legacyFormatConverter }
|
|
280
|
+
);
|
|
281
|
+
if (canonical.diagnostics.length > 0 || canonical.response.products.length !== 1) {
|
|
282
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
283
|
+
operation,
|
|
284
|
+
`(product:${String(projected.product_id)})`,
|
|
285
|
+
"legacy product formats in the platform response have no complete canonical representation"
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
projected = canonical.response.products[0];
|
|
289
|
+
} else if (Array.isArray(projected.format_options)) {
|
|
290
|
+
const legacy = (0, import_v2_to_v1.projectV2ProductToV1)(projected, { canonicalFormatLegacyResolver });
|
|
291
|
+
if (legacy.diagnostics.length > 0 || legacy.v1.format_ids.length === 0 && projected.format_options.length > 0) {
|
|
292
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
293
|
+
operation,
|
|
294
|
+
`(product:${String(projected.product_id)})`,
|
|
295
|
+
"canonical product formats in the platform response have no complete legacy representation"
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
projected = legacy.v1;
|
|
299
|
+
}
|
|
300
|
+
} 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")) {
|
|
301
|
+
projected = (0, import_creative_delivery.projectMediaBuyCreativesForDelivery)(
|
|
302
|
+
{ packages: [projected] },
|
|
303
|
+
wireMode,
|
|
304
|
+
"create_media_buy",
|
|
305
|
+
legacyFormatConverter,
|
|
306
|
+
canonicalFormatLegacyResolver
|
|
307
|
+
).packages[0];
|
|
308
|
+
}
|
|
309
|
+
if (typeof projected.creative_id === "string" && (projected.format_id !== void 0 || typeof projected.format_kind === "string")) {
|
|
310
|
+
projected = (0, import_creative_delivery.projectCreativeForDelivery)(
|
|
311
|
+
projected,
|
|
312
|
+
selectorContainer,
|
|
313
|
+
wireMode,
|
|
314
|
+
operation,
|
|
315
|
+
legacyFormatConverter,
|
|
316
|
+
canonicalFormatLegacyResolver
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
const nextSelector = Array.isArray(projected.format_ids) || Array.isArray(projected.format_options) || Array.isArray(projected.format_option_refs) ? projected : selectorContainer;
|
|
320
|
+
let changed = projected !== value;
|
|
321
|
+
const next = { ...projected };
|
|
322
|
+
for (const [key, child] of Object.entries(projected)) {
|
|
323
|
+
const childProjected = projectResponseCreativeIdentities(
|
|
324
|
+
child,
|
|
325
|
+
operation,
|
|
326
|
+
legacyFormatConverter,
|
|
327
|
+
canonicalFormatLegacyResolver,
|
|
328
|
+
wireMode,
|
|
329
|
+
nextSelector
|
|
330
|
+
);
|
|
331
|
+
if (childProjected !== child) {
|
|
332
|
+
next[key] = childProjected;
|
|
333
|
+
changed = true;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return changed ? next : projected;
|
|
337
|
+
}
|
|
338
|
+
function asCanonicalSemanticServerResponse(response, operation, legacyFormatConverter, canonicalFormatLegacyResolver) {
|
|
339
|
+
try {
|
|
340
|
+
assertSafeSemanticPayload(response, operation);
|
|
341
|
+
return asCanonicalServerResponse(
|
|
342
|
+
projectResponseCreativeIdentities(
|
|
343
|
+
response,
|
|
344
|
+
operation,
|
|
345
|
+
legacyFormatConverter,
|
|
346
|
+
canonicalFormatLegacyResolver,
|
|
347
|
+
"canonical"
|
|
348
|
+
)
|
|
349
|
+
);
|
|
350
|
+
} catch (error) {
|
|
351
|
+
if (!(error instanceof import_creative_delivery.CreativeFormatProjectionError)) throw error;
|
|
352
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
353
|
+
message: `${operation} platform response contains a legacy creative format that cannot be represented canonically.`,
|
|
354
|
+
field: "response",
|
|
355
|
+
suggestion: "Return canonical format_kind values, or configure legacyCreativeFormatConverter for custom legacy formats."
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function asSemanticServerResponseForWire(response, operation, legacyFormatConverter, canonicalFormatLegacyResolver, wireMode) {
|
|
360
|
+
if (wireMode === "canonical") {
|
|
361
|
+
return attachCanonicalCustomFormatWireRefs(
|
|
362
|
+
asCanonicalSemanticServerResponse(response, operation, legacyFormatConverter, canonicalFormatLegacyResolver),
|
|
363
|
+
canonicalFormatLegacyResolver,
|
|
364
|
+
operation
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
try {
|
|
368
|
+
assertSafeSemanticPayload(response, operation);
|
|
369
|
+
return projectResponseCreativeIdentities(
|
|
370
|
+
response,
|
|
371
|
+
operation,
|
|
372
|
+
legacyFormatConverter,
|
|
373
|
+
canonicalFormatLegacyResolver,
|
|
374
|
+
"legacy"
|
|
375
|
+
);
|
|
376
|
+
} catch (error) {
|
|
377
|
+
if (!(error instanceof import_creative_delivery.CreativeFormatProjectionError)) throw error;
|
|
378
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
379
|
+
message: `${operation} platform response contains a canonical creative format that cannot be represented on the configured legacy wire.`,
|
|
380
|
+
field: "response",
|
|
381
|
+
suggestion: "Return an explicit legacy mapping for the canonical format, or configure this server for AdCP 3.1 or newer."
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function legacyIdentityContext(ownerKey) {
|
|
386
|
+
if (typeof ownerKey !== "string") return "default";
|
|
387
|
+
if (ownerKey === "signal_id" || ownerKey === "signal_ids") return "signal";
|
|
388
|
+
if (/(^|_)(?:property_lists?|collection_lists?)($|_)/.test(ownerKey)) return "list";
|
|
389
|
+
if (!/(^|_)(?:creative|format|legacy|placement)($|_)/.test(ownerKey) && /(^|_)(?:agents?|agent_details|agent_info)($|_)/.test(ownerKey)) {
|
|
390
|
+
return "agent";
|
|
391
|
+
}
|
|
392
|
+
return "default";
|
|
393
|
+
}
|
|
394
|
+
function allowsNonCreativeAgentUrl(owner, context) {
|
|
395
|
+
return context === "agent" || context === "list" && typeof owner.list_id === "string" || context === "signal" && owner.source === "agent";
|
|
396
|
+
}
|
|
397
|
+
function findLegacyCreativeIdentity(value, seen = {
|
|
398
|
+
agent: /* @__PURE__ */ new WeakSet(),
|
|
399
|
+
signal: /* @__PURE__ */ new WeakSet(),
|
|
400
|
+
list: /* @__PURE__ */ new WeakSet(),
|
|
401
|
+
default: /* @__PURE__ */ new WeakSet()
|
|
402
|
+
}, ownerKey) {
|
|
403
|
+
if (value === null || typeof value !== "object") return void 0;
|
|
404
|
+
const owner = value;
|
|
405
|
+
const context = legacyIdentityContext(ownerKey);
|
|
406
|
+
const policySeen = seen[context];
|
|
407
|
+
if (policySeen.has(value)) return void 0;
|
|
408
|
+
policySeen.add(value);
|
|
409
|
+
if (Array.isArray(value)) {
|
|
410
|
+
for (const item of value) {
|
|
411
|
+
const nested = findLegacyCreativeIdentity(item, seen, ownerKey);
|
|
412
|
+
if (nested) return nested;
|
|
413
|
+
}
|
|
414
|
+
return void 0;
|
|
415
|
+
}
|
|
416
|
+
for (const [key, child] of Object.entries(owner)) {
|
|
417
|
+
if (/(^|_)(?:format_ids?|v1_format_ref)($|_)/.test(key)) return key;
|
|
418
|
+
if (key === "agent_url" && (typeof owner.id === "string" || typeof owner.list_id === "string") && !allowsNonCreativeAgentUrl(owner, context)) {
|
|
419
|
+
return key;
|
|
420
|
+
}
|
|
421
|
+
const nested = findLegacyCreativeIdentity(child, seen, key);
|
|
422
|
+
if (nested) return nested;
|
|
423
|
+
}
|
|
424
|
+
return void 0;
|
|
425
|
+
}
|
|
426
|
+
function asCanonicalSemanticServerRequest(request, operation, legacyFormatConverter) {
|
|
427
|
+
try {
|
|
428
|
+
assertSafeSemanticPayload(request, operation);
|
|
429
|
+
const projected = projectResponseCreativeIdentities(
|
|
430
|
+
request,
|
|
431
|
+
operation,
|
|
432
|
+
legacyFormatConverter,
|
|
433
|
+
void 0,
|
|
434
|
+
"canonical"
|
|
435
|
+
);
|
|
436
|
+
const forbidden = findLegacyCreativeIdentity(projected);
|
|
437
|
+
if (forbidden) {
|
|
438
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
439
|
+
operation,
|
|
440
|
+
"(request extension)",
|
|
441
|
+
`legacy creative identity ${forbidden} has no recognized canonical container`
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
return projected;
|
|
445
|
+
} catch (error) {
|
|
446
|
+
if (!(error instanceof import_creative_delivery.CreativeFormatProjectionError)) throw error;
|
|
447
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
448
|
+
message: `${operation} request contains a legacy creative format that cannot be represented canonically.`,
|
|
449
|
+
field: "request",
|
|
450
|
+
suggestion: "Send canonical format_kind values, or configure legacyCreativeFormatConverter for custom legacy formats."
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
function asCanonicalGetProductsRequest(request) {
|
|
455
|
+
if (!Array.isArray(request["fields"])) return request;
|
|
456
|
+
const fields = [
|
|
457
|
+
...new Set(
|
|
458
|
+
request["fields"].flatMap(
|
|
459
|
+
(field) => field === "format_ids" ? ["format_options"] : typeof field === "string" ? [field] : []
|
|
460
|
+
)
|
|
461
|
+
)
|
|
462
|
+
];
|
|
463
|
+
return { ...request, fields };
|
|
464
|
+
}
|
|
465
|
+
function asCanonicalListCreativesRequest(request, legacyFormatConverter) {
|
|
466
|
+
const filters = request["filters"] !== null && typeof request["filters"] === "object" && !Array.isArray(request["filters"]) ? request["filters"] : void 0;
|
|
467
|
+
const legacyFormatIds = filters?.["format_ids"];
|
|
468
|
+
if (Array.isArray(legacyFormatIds) && legacyFormatIds.length > 0) {
|
|
469
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
470
|
+
message: "list_creatives legacy format_ids filters are unavailable on the canonical platform surface.",
|
|
471
|
+
field: "filters.format_ids",
|
|
472
|
+
suggestion: "Filter by canonical creative fields, or use an explicit legacy wire handler during migration."
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
const { format_ids: _dropLegacyFormatIds, ...canonicalFilters } = filters ?? {};
|
|
476
|
+
void _dropLegacyFormatIds;
|
|
477
|
+
const withoutLegacyFilter = filters === void 0 ? request : { ...request, filters: canonicalFilters };
|
|
478
|
+
const projected = asCanonicalSemanticServerRequest(
|
|
479
|
+
withoutLegacyFilter,
|
|
480
|
+
"list_creatives",
|
|
481
|
+
legacyFormatConverter
|
|
482
|
+
);
|
|
483
|
+
if (!Array.isArray(projected["fields"])) return projected;
|
|
484
|
+
const fields = [
|
|
485
|
+
...new Set(
|
|
486
|
+
projected["fields"].flatMap(
|
|
487
|
+
(field) => field === "format_id" ? ["format_kind"] : typeof field === "string" ? [field] : []
|
|
488
|
+
)
|
|
489
|
+
)
|
|
490
|
+
];
|
|
491
|
+
return { ...projected, fields };
|
|
492
|
+
}
|
|
493
|
+
function asCanonicalProductResponse(response, legacyFormatConverter) {
|
|
494
|
+
try {
|
|
495
|
+
assertSafeSemanticPayload(response, "get_products");
|
|
496
|
+
} catch (error) {
|
|
497
|
+
if (!(error instanceof import_creative_delivery.CreativeFormatProjectionError)) throw error;
|
|
498
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
499
|
+
message: "get_products platform response cannot be represented safely at the canonical boundary.",
|
|
500
|
+
field: "response",
|
|
501
|
+
suggestion: "Return an acyclic data-only product response without enumerable accessors."
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
const projected = (0, import_augment_response.toCanonicalOnlyResponse)(response, {
|
|
505
|
+
legacyFormatConverter
|
|
506
|
+
});
|
|
507
|
+
if (projected.diagnostics.length > 0) {
|
|
508
|
+
const first = projected.diagnostics[0];
|
|
509
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
510
|
+
message: "get_products returned a legacy format that cannot be represented canonically.",
|
|
511
|
+
field: first.field,
|
|
512
|
+
suggestion: "Declare canonical format_options or configure legacyCreativeFormatConverter for the legacy format."
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
return asCanonicalServerResponse(projected.response);
|
|
516
|
+
}
|
|
517
|
+
function attachCanonicalCustomFormatWireRefs(value, canonicalFormatLegacyResolver, operation) {
|
|
518
|
+
const visit = (current) => {
|
|
519
|
+
if (Array.isArray(current)) return current.map(visit);
|
|
520
|
+
if (current === null || typeof current !== "object") return current;
|
|
521
|
+
const record = current;
|
|
522
|
+
const hasFormatDeclarations = Array.isArray(record.format_options);
|
|
523
|
+
const declarationOwner = typeof record.product_id === "string" ? record.product_id : typeof record.placement_id === "string" ? record.placement_id : "(response)";
|
|
524
|
+
let projected = record;
|
|
525
|
+
if (hasFormatDeclarations) {
|
|
526
|
+
const formatOptions = record.format_options.map((value2, index) => {
|
|
527
|
+
if (value2 === null || typeof value2 !== "object" || Array.isArray(value2)) return value2;
|
|
528
|
+
const declaration = value2;
|
|
529
|
+
if (declaration.format_kind !== "custom" || declaration.canonical_formats_only === true) return declaration;
|
|
530
|
+
let refs = [...(0, import_legacy_metadata.legacyFormatRefsForDeclaration)(declaration)];
|
|
531
|
+
if (refs.length === 0) {
|
|
532
|
+
try {
|
|
533
|
+
refs = (0, import_v2_to_v1.resolveCanonicalFormatLegacyRefs)(canonicalFormatLegacyResolver, {
|
|
534
|
+
source: "product",
|
|
535
|
+
declaration,
|
|
536
|
+
productId: declarationOwner,
|
|
537
|
+
field: `${declarationOwner}.format_options[${index}]`
|
|
538
|
+
}) ?? [];
|
|
539
|
+
} catch (error) {
|
|
540
|
+
if (!(error instanceof import_v2_to_v1.CanonicalFormatLegacyResolutionError)) throw error;
|
|
541
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
542
|
+
operation,
|
|
543
|
+
`(format owner:${declarationOwner})`,
|
|
544
|
+
"canonical format legacy resolver returned an invalid custom declaration mapping"
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
if (refs.length === 0) {
|
|
549
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
550
|
+
operation,
|
|
551
|
+
`(format owner:${declarationOwner})`,
|
|
552
|
+
"custom canonical declaration must set canonical_formats_only or provide an explicit legacy mapping"
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
return { ...declaration, v1_format_ref: refs.map((ref) => ({ ...ref })) };
|
|
556
|
+
});
|
|
557
|
+
projected = { ...record, format_options: formatOptions };
|
|
558
|
+
}
|
|
559
|
+
let changed = projected !== record;
|
|
560
|
+
const next = { ...projected };
|
|
561
|
+
for (const [key, child] of Object.entries(projected)) {
|
|
562
|
+
if (hasFormatDeclarations && key === "format_options") continue;
|
|
563
|
+
const visited = visit(child);
|
|
564
|
+
if (visited !== child) {
|
|
565
|
+
next[key] = visited;
|
|
566
|
+
changed = true;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
return changed ? next : projected;
|
|
570
|
+
};
|
|
571
|
+
return visit(value);
|
|
572
|
+
}
|
|
573
|
+
function asProductResponseForWire(canonicalResponse, wireMode, canonicalFormatLegacyResolver) {
|
|
574
|
+
if (wireMode === "canonical") {
|
|
575
|
+
return attachCanonicalCustomFormatWireRefs(canonicalResponse, canonicalFormatLegacyResolver, "get_products");
|
|
576
|
+
}
|
|
577
|
+
if (!Array.isArray(canonicalResponse.products)) return canonicalResponse;
|
|
578
|
+
const products = canonicalResponse.products.map((product) => {
|
|
579
|
+
const projected = (0, import_v2_to_v1.projectV2ProductToV1)(product, { canonicalFormatLegacyResolver });
|
|
580
|
+
if (projected.diagnostics.length > 0) {
|
|
581
|
+
const first = projected.diagnostics[0];
|
|
582
|
+
throw new import_async_outcome.AdcpError("INVALID_REQUEST", {
|
|
583
|
+
message: "get_products returned a canonical format that cannot be represented on the configured legacy wire.",
|
|
584
|
+
field: first.field,
|
|
585
|
+
suggestion: "Add an explicit legacy format mapping to the canonical declaration, or configure this server for AdCP 3.1 or newer."
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
return projected.v1;
|
|
589
|
+
});
|
|
590
|
+
return { ...canonicalResponse, products };
|
|
591
|
+
}
|
|
98
592
|
function refuseInlineAccountIdWhenForbidden(resolution, ref) {
|
|
99
593
|
if (resolution !== "implicit" && resolution !== "derived") return;
|
|
100
594
|
if ((0, import_account.refAccountId)(ref) === void 0) return;
|
|
@@ -123,6 +617,13 @@ function warnIfTruncatedMultiIdResponse(toolName, idFieldName, requestedIds, res
|
|
|
123
617
|
}
|
|
124
618
|
function createAdcpServerFromPlatform(platform, opts) {
|
|
125
619
|
(0, import_validate_platform.validatePlatform)(platform);
|
|
620
|
+
const runtimeLegacyOptions = opts;
|
|
621
|
+
const legacyHandlers = {
|
|
622
|
+
mediaBuy: opts.legacyHandlers?.mediaBuy ?? runtimeLegacyOptions.mediaBuy,
|
|
623
|
+
creative: opts.legacyHandlers?.creative ?? runtimeLegacyOptions.creative,
|
|
624
|
+
governance: opts.legacyHandlers?.governance ?? runtimeLegacyOptions.governance,
|
|
625
|
+
brandRights: opts.legacyHandlers?.brandRights ?? runtimeLegacyOptions.brandRights
|
|
626
|
+
};
|
|
126
627
|
{
|
|
127
628
|
const specialisms = platform.capabilities.specialisms;
|
|
128
629
|
const issues = (0, import_validate_specialisms.validateSpecialismRequiredTools)(platform, specialisms);
|
|
@@ -194,6 +695,28 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
194
695
|
const hasSalesPlatform = platform.sales != null || platform.proposalManager != null;
|
|
195
696
|
const supportsProposals = platform.capabilities.supportsProposals ?? (platform.proposalManager != null ? true : hasSalesPlatform ? false : void 0);
|
|
196
697
|
const hasMediaBuyProjection = hasSalesPlatform || at != null || ct != null || cs != null || som != null || fc != null || targeting != null || supportsProposals !== void 0;
|
|
698
|
+
const configuredAdcpVersion = opts.adcpVersion ?? import_version.ADCP_VERSION;
|
|
699
|
+
const configuredRelease = parseAdcpRelease(configuredAdcpVersion);
|
|
700
|
+
if (!configuredRelease) {
|
|
701
|
+
throw new import_validate_platform.PlatformConfigError(
|
|
702
|
+
`Configured AdCP version '${configuredAdcpVersion}' is not a valid release identifier`
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
for (const advertisedVersion of platform.capabilities.supported_versions ?? []) {
|
|
706
|
+
const advertisedRelease = parseAdcpRelease(advertisedVersion);
|
|
707
|
+
if (!advertisedRelease) {
|
|
708
|
+
throw new import_validate_platform.PlatformConfigError(
|
|
709
|
+
`capabilities.supported_versions contains invalid release identifier '${advertisedVersion}'`
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
if (compareAdcpReleases(advertisedRelease, configuredRelease) > 0) {
|
|
713
|
+
throw new import_validate_platform.PlatformConfigError(
|
|
714
|
+
`capabilities.supported_versions advertises AdCP ${advertisedVersion}, newer than the configured server schema ${configuredAdcpVersion}`
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
const canonicalCreativeCapability = supportsCanonicalCreativeCapability(configuredAdcpVersion);
|
|
719
|
+
const defaultCreativeWireMode = canonicalCreativeCapability ? "canonical" : "legacy";
|
|
197
720
|
const mediaBuyOverrides = {
|
|
198
721
|
...hasSalesPlatform && {
|
|
199
722
|
buying_modes: supportsProposals ? ["brief", "refine"] : ["brief"]
|
|
@@ -205,12 +728,11 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
205
728
|
...fc != null && { frequency_capping: fc },
|
|
206
729
|
...targeting != null && { execution: { targeting } },
|
|
207
730
|
...supportsProposals !== void 0 && { supports_proposals: supportsProposals },
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
731
|
+
features: {
|
|
732
|
+
...canonicalCreativeCapability && { canonical_creatives: true },
|
|
733
|
+
...at != null && { audience_targeting: true },
|
|
734
|
+
...ct != null && { conversion_tracking: true },
|
|
735
|
+
...cs != null && { content_standards: true }
|
|
214
736
|
}
|
|
215
737
|
};
|
|
216
738
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -261,19 +783,23 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
261
783
|
const hasSpecialisms = platformSpecialisms.length > 0;
|
|
262
784
|
const claimsSignedSpecialism = platformSpecialisms.includes("signed-requests");
|
|
263
785
|
const hasOverridesProjection = hasMediaBuyProjection || hasBrandProjection || hasAccountProjection || hasComplianceTestingProjection;
|
|
264
|
-
const
|
|
786
|
+
const { canonicalCreatives: _adopterCanonicalCreatives, ...adopterFeatureBase } = platform.capabilities.features ?? {};
|
|
787
|
+
void _adopterCanonicalCreatives;
|
|
788
|
+
const adopterFeatures = {
|
|
789
|
+
...adopterFeatureBase,
|
|
790
|
+
...canonicalCreativeCapability && { canonicalCreatives: true }
|
|
791
|
+
};
|
|
265
792
|
const adopterCreative = platform.capabilities.creative;
|
|
266
793
|
const adopterAccount = platform.capabilities.account;
|
|
267
794
|
const adopterOverrides = platform.capabilities.overrides;
|
|
268
795
|
const adopterSupportedVersions = platform.capabilities.supported_versions;
|
|
269
|
-
const hasAdopterPassthroughs = adopterFeatures !== void 0 || adopterCreative !== void 0 || adopterAccount !== void 0 || adopterOverrides !== void 0 || adopterSupportedVersions !== void 0;
|
|
270
796
|
const hasOverridesObject = hasOverridesProjection || adopterOverrides !== void 0;
|
|
271
|
-
const projectedCapabilitiesConfig =
|
|
797
|
+
const projectedCapabilitiesConfig = {
|
|
272
798
|
...hasSpecialisms && {
|
|
273
799
|
specialisms: [...platformSpecialisms]
|
|
274
800
|
},
|
|
275
801
|
...claimsSignedSpecialism && { request_signing: { supported: true } },
|
|
276
|
-
|
|
802
|
+
features: adopterFeatures,
|
|
277
803
|
...adopterCreative !== void 0 && { creative: adopterCreative },
|
|
278
804
|
...adopterAccount !== void 0 && { account: adopterAccount },
|
|
279
805
|
...adopterSupportedVersions !== void 0 && {
|
|
@@ -282,9 +808,7 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
282
808
|
...hasOverridesObject && {
|
|
283
809
|
overrides: {
|
|
284
810
|
...adopterOverrides ?? {},
|
|
285
|
-
|
|
286
|
-
media_buy: mergeCapabilityOverride(adopterOverrides?.media_buy, mediaBuyOverrides)
|
|
287
|
-
},
|
|
811
|
+
media_buy: mergeCapabilityOverride(adopterOverrides?.media_buy, mediaBuyOverrides),
|
|
288
812
|
...hasBrandProjection && {
|
|
289
813
|
brand: mergeCapabilityOverride(adopterOverrides?.brand, brandOverrides)
|
|
290
814
|
},
|
|
@@ -294,7 +818,7 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
294
818
|
...hasComplianceTestingProjection && complianceTestingOverrides != null && { compliance_testing: complianceTestingOverrides }
|
|
295
819
|
}
|
|
296
820
|
}
|
|
297
|
-
}
|
|
821
|
+
};
|
|
298
822
|
const ctxFor = makeCtxFor(effectiveCtxMetadata);
|
|
299
823
|
if (opts.resolveIdempotencyPrincipal === void 0) {
|
|
300
824
|
const env = process.env.NODE_ENV;
|
|
@@ -420,7 +944,7 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
420
944
|
// See `CreateAdcpServerFromPlatformOptions` JSDoc for the migration-seam
|
|
421
945
|
// contract.
|
|
422
946
|
mediaBuy: mergeHandlers(
|
|
423
|
-
|
|
947
|
+
legacyHandlers.mediaBuy,
|
|
424
948
|
buildMediaBuyHandlers(
|
|
425
949
|
platform,
|
|
426
950
|
taskRegistry,
|
|
@@ -434,13 +958,16 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
434
958
|
ctxFor,
|
|
435
959
|
effectiveCtxMetadata,
|
|
436
960
|
opts.mediaBuyStore,
|
|
437
|
-
opts.proposalStore
|
|
961
|
+
opts.proposalStore,
|
|
962
|
+
opts.legacyCreativeFormatConverter,
|
|
963
|
+
opts.canonicalFormatLegacyResolver,
|
|
964
|
+
defaultCreativeWireMode
|
|
438
965
|
),
|
|
439
966
|
"mediaBuy",
|
|
440
967
|
mergeOpts
|
|
441
968
|
),
|
|
442
969
|
creative: mergeHandlers(
|
|
443
|
-
|
|
970
|
+
legacyHandlers.creative,
|
|
444
971
|
buildCreativeHandlers(
|
|
445
972
|
platform,
|
|
446
973
|
taskRegistry,
|
|
@@ -451,7 +978,10 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
451
978
|
allowPrivateWebhookUrls: opts.allowPrivateWebhookUrls === true,
|
|
452
979
|
autoEmitCompletionWebhooks: opts.autoEmitCompletionWebhooks !== false
|
|
453
980
|
},
|
|
454
|
-
ctxFor
|
|
981
|
+
ctxFor,
|
|
982
|
+
opts.legacyCreativeFormatConverter,
|
|
983
|
+
opts.canonicalFormatLegacyResolver,
|
|
984
|
+
defaultCreativeWireMode
|
|
455
985
|
),
|
|
456
986
|
"creative",
|
|
457
987
|
mergeOpts
|
|
@@ -486,10 +1016,15 @@ function createAdcpServerFromPlatform(platform, opts) {
|
|
|
486
1016
|
"sponsoredIntelligence",
|
|
487
1017
|
mergeOpts
|
|
488
1018
|
),
|
|
489
|
-
governance: mergeHandlers(
|
|
1019
|
+
governance: mergeHandlers(
|
|
1020
|
+
legacyHandlers.governance,
|
|
1021
|
+
buildGovernanceHandlers(platform, ctxFor),
|
|
1022
|
+
"governance",
|
|
1023
|
+
mergeOpts
|
|
1024
|
+
),
|
|
490
1025
|
accounts: mergeHandlers(opts.accounts, buildAccountHandlers(platform, ctxFor), "accounts", mergeOpts),
|
|
491
1026
|
brandRights: mergeHandlers(
|
|
492
|
-
|
|
1027
|
+
legacyHandlers.brandRights,
|
|
493
1028
|
buildBrandRightsHandlers(platform, ctxFor, effectiveCtxMetadata, fwLogger),
|
|
494
1029
|
"brandRights",
|
|
495
1030
|
mergeOpts
|
|
@@ -1039,7 +1574,7 @@ function mergeHandlers(custom, platform, domain, opts) {
|
|
|
1039
1574
|
if (collisions.length > 0) {
|
|
1040
1575
|
const dedupeKey = `${domain}|${[...collisions].sort().join(",")}`;
|
|
1041
1576
|
const shouldLog = opts.mode !== "log-once" || !mergeSeamLoggedKeys.has(dedupeKey);
|
|
1042
|
-
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.`;
|
|
1577
|
+
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.`;
|
|
1043
1578
|
if (opts.mode === "strict") {
|
|
1044
1579
|
throw new import_validate_platform.PlatformConfigError(message);
|
|
1045
1580
|
}
|
|
@@ -1551,7 +2086,7 @@ async function backfillTargetingOverlay(store, accountId, result, logger) {
|
|
|
1551
2086
|
logger.warn(`[adcp/decisioning] mediaBuyStore.backfill failed: ${msg}`);
|
|
1552
2087
|
}
|
|
1553
2088
|
}
|
|
1554
|
-
async function hydratePackagesWithProducts(store, accountId, packages, logger) {
|
|
2089
|
+
async function hydratePackagesWithProducts(store, accountId, packages, logger, legacyFormatConverter) {
|
|
1555
2090
|
if (!store || !accountId || !packages || packages.length === 0) return;
|
|
1556
2091
|
const refs = [];
|
|
1557
2092
|
for (const pkg of packages) {
|
|
@@ -1576,7 +2111,15 @@ async function hydratePackagesWithProducts(store, accountId, packages, logger) {
|
|
|
1576
2111
|
if (typeof productId !== "string") continue;
|
|
1577
2112
|
const entry = entries.get(`product:${productId}`);
|
|
1578
2113
|
if (!entry?.resource || typeof entry.resource !== "object") continue;
|
|
1579
|
-
|
|
2114
|
+
let hydrated;
|
|
2115
|
+
try {
|
|
2116
|
+
hydrated = asCanonicalSemanticServerRequest(entry.resource, "hydrate_product", legacyFormatConverter);
|
|
2117
|
+
} catch {
|
|
2118
|
+
logger.warn(
|
|
2119
|
+
`[adcp/decisioning] auto-hydrate product:${productId} skipped: stored creative format has no canonical representation`
|
|
2120
|
+
);
|
|
2121
|
+
continue;
|
|
2122
|
+
}
|
|
1580
2123
|
if (entry.value !== null && entry.value !== void 0) {
|
|
1581
2124
|
hydrated["ctx_metadata"] = entry.value;
|
|
1582
2125
|
}
|
|
@@ -1594,7 +2137,7 @@ async function hydratePackagesWithProducts(store, accountId, packages, logger) {
|
|
|
1594
2137
|
});
|
|
1595
2138
|
}
|
|
1596
2139
|
}
|
|
1597
|
-
async function hydrateSingleResource(store, accountId, kind, id, attachField, target, logger) {
|
|
2140
|
+
async function hydrateSingleResource(store, accountId, kind, id, attachField, target, logger, legacyFormatConverter) {
|
|
1598
2141
|
if (!store || !accountId || !id || target == null || typeof target !== "object") return;
|
|
1599
2142
|
let entry;
|
|
1600
2143
|
try {
|
|
@@ -1605,7 +2148,19 @@ async function hydrateSingleResource(store, accountId, kind, id, attachField, ta
|
|
|
1605
2148
|
return;
|
|
1606
2149
|
}
|
|
1607
2150
|
if (!entry?.resource || typeof entry.resource !== "object") return;
|
|
1608
|
-
|
|
2151
|
+
let hydrated;
|
|
2152
|
+
if (legacyFormatConverter !== void 0 || kind === "media_buy" || kind === "package" || kind === "creative") {
|
|
2153
|
+
try {
|
|
2154
|
+
hydrated = asCanonicalSemanticServerRequest(entry.resource, `hydrate_${kind}`, legacyFormatConverter);
|
|
2155
|
+
} catch {
|
|
2156
|
+
logger.warn(
|
|
2157
|
+
`[adcp/decisioning] auto-hydrate ${kind}:${id} skipped: stored creative format has no canonical representation`
|
|
2158
|
+
);
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
} else {
|
|
2162
|
+
hydrated = { ...entry.resource };
|
|
2163
|
+
}
|
|
1609
2164
|
if (entry.value !== null && entry.value !== void 0) {
|
|
1610
2165
|
hydrated["ctx_metadata"] = entry.value;
|
|
1611
2166
|
}
|
|
@@ -1679,7 +2234,7 @@ function deriveAttachField(toolName, field) {
|
|
|
1679
2234
|
if (override) return override;
|
|
1680
2235
|
return field.endsWith("_id") ? field.slice(0, -3) : field;
|
|
1681
2236
|
}
|
|
1682
|
-
async function hydrateForTool(store, accountId, toolName, params, logger) {
|
|
2237
|
+
async function hydrateForTool(store, accountId, toolName, params, logger, legacyFormatConverter) {
|
|
1683
2238
|
if (!store || !accountId || params == null || typeof params !== "object") return;
|
|
1684
2239
|
const fields = import_entity_hydration.TOOL_ENTITY_FIELDS[toolName];
|
|
1685
2240
|
if (!fields || fields.length === 0) return;
|
|
@@ -1690,7 +2245,7 @@ async function hydrateForTool(store, accountId, toolName, params, logger) {
|
|
|
1690
2245
|
const kind = ENTITY_TO_RESOURCE_KIND[xEntity];
|
|
1691
2246
|
if (!kind) continue;
|
|
1692
2247
|
const attachField = deriveAttachField(toolName, field);
|
|
1693
|
-
await hydrateSingleResource(store, accountId, kind, id, attachField, params, logger);
|
|
2248
|
+
await hydrateSingleResource(store, accountId, kind, id, attachField, params, logger, legacyFormatConverter);
|
|
1694
2249
|
}
|
|
1695
2250
|
}
|
|
1696
2251
|
function extractPushConfig(params, _logger, opts = {}) {
|
|
@@ -1837,17 +2392,19 @@ function validatePushNotificationOperationId(operationId) {
|
|
|
1837
2392
|
}
|
|
1838
2393
|
return { ok: true };
|
|
1839
2394
|
}
|
|
1840
|
-
function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observability, logger, pushOpts, ctxFor, ctxMetadataStore, mediaBuyStore, proposalStore) {
|
|
2395
|
+
function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observability, logger, pushOpts, ctxFor, ctxMetadataStore, mediaBuyStore, proposalStore, legacyFormatConverter, canonicalFormatLegacyResolver, creativeWireMode) {
|
|
1841
2396
|
const sales = platform.sales;
|
|
1842
2397
|
const proposalManager = platform.proposalManager;
|
|
1843
2398
|
if (!sales && !proposalManager) return void 0;
|
|
1844
2399
|
return {
|
|
1845
2400
|
...(sales?.getProducts || proposalManager) && {
|
|
1846
2401
|
getProducts: async (params, ctx) => {
|
|
2402
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2403
|
+
const canonicalParams = asCanonicalGetProductsRequest(params);
|
|
1847
2404
|
const reqCtx = ctxFor(ctx, params);
|
|
1848
2405
|
if (proposalManager && proposalStore) {
|
|
1849
2406
|
const intercept = await (0, import_proposal.maybeInterceptFinalize)({
|
|
1850
|
-
request:
|
|
2407
|
+
request: canonicalParams,
|
|
1851
2408
|
manager: proposalManager,
|
|
1852
2409
|
store: proposalStore,
|
|
1853
2410
|
ctx: reqCtx
|
|
@@ -1892,16 +2449,17 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
1892
2449
|
let result;
|
|
1893
2450
|
if (proposalManager) {
|
|
1894
2451
|
const useRefine = buyingMode === "refine" && proposalManager.capabilities.refine === true && typeof proposalManager.refineProducts === "function";
|
|
1895
|
-
result = useRefine ? await proposalManager.refineProducts(
|
|
2452
|
+
result = useRefine ? await proposalManager.refineProducts(canonicalParams, reqCtx) : await proposalManager.getProducts(canonicalParams, reqCtx);
|
|
1896
2453
|
} else {
|
|
1897
|
-
result = await sales.getProducts(
|
|
2454
|
+
result = await sales.getProducts(canonicalParams, reqCtx);
|
|
1898
2455
|
}
|
|
1899
2456
|
const projectProducts = async (terminalResult) => {
|
|
2457
|
+
const canonicalResult = asCanonicalProductResponse(terminalResult, legacyFormatConverter);
|
|
1900
2458
|
await autoStoreResources(
|
|
1901
2459
|
ctxMetadataStore,
|
|
1902
2460
|
reqCtx.account?.id,
|
|
1903
2461
|
"product",
|
|
1904
|
-
|
|
2462
|
+
canonicalResult?.products,
|
|
1905
2463
|
"product_id",
|
|
1906
2464
|
logger
|
|
1907
2465
|
);
|
|
@@ -1912,7 +2470,11 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
1912
2470
|
ctx: reqCtx
|
|
1913
2471
|
});
|
|
1914
2472
|
}
|
|
1915
|
-
return
|
|
2473
|
+
return asProductResponseForWire(
|
|
2474
|
+
canonicalResult,
|
|
2475
|
+
responseWireMode,
|
|
2476
|
+
canonicalFormatLegacyResolver
|
|
2477
|
+
);
|
|
1916
2478
|
};
|
|
1917
2479
|
const isHandoff = (0, import_async_outcome2.isTaskHandoff)(result);
|
|
1918
2480
|
if (buyingMode === "wholesale" && isHandoff) {
|
|
@@ -1958,12 +2520,15 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
1958
2520
|
},
|
|
1959
2521
|
...sales?.createMediaBuy && {
|
|
1960
2522
|
createMediaBuy: async (params, ctx) => {
|
|
2523
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2524
|
+
params = asCanonicalSemanticServerRequest(params, "create_media_buy", legacyFormatConverter);
|
|
1961
2525
|
const reqCtx = ctxFor(ctx, params);
|
|
1962
2526
|
await hydratePackagesWithProducts(
|
|
1963
2527
|
ctxMetadataStore,
|
|
1964
2528
|
reqCtx.account?.id,
|
|
1965
2529
|
params?.packages,
|
|
1966
|
-
logger
|
|
2530
|
+
logger,
|
|
2531
|
+
legacyFormatConverter
|
|
1967
2532
|
);
|
|
1968
2533
|
let reservation = null;
|
|
1969
2534
|
if (proposalStore) {
|
|
@@ -2022,7 +2587,13 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2022
2587
|
result,
|
|
2023
2588
|
async (r) => {
|
|
2024
2589
|
await persistTargetingOverlayFromCreate(mediaBuyStore, reqCtx.account?.id, params, r, logger);
|
|
2025
|
-
return
|
|
2590
|
+
return asSemanticServerResponseForWire(
|
|
2591
|
+
r,
|
|
2592
|
+
"create_media_buy",
|
|
2593
|
+
legacyFormatConverter,
|
|
2594
|
+
canonicalFormatLegacyResolver,
|
|
2595
|
+
responseWireMode
|
|
2596
|
+
);
|
|
2026
2597
|
}
|
|
2027
2598
|
);
|
|
2028
2599
|
},
|
|
@@ -2032,6 +2603,8 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2032
2603
|
},
|
|
2033
2604
|
...sales?.updateMediaBuy && {
|
|
2034
2605
|
updateMediaBuy: async (params, ctx) => {
|
|
2606
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2607
|
+
params = asCanonicalSemanticServerRequest(params, "update_media_buy", legacyFormatConverter);
|
|
2035
2608
|
const reqCtx = ctxFor(ctx, params);
|
|
2036
2609
|
const { media_buy_id } = params;
|
|
2037
2610
|
if (!media_buy_id) {
|
|
@@ -2040,7 +2613,14 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2040
2613
|
field: "media_buy_id"
|
|
2041
2614
|
});
|
|
2042
2615
|
}
|
|
2043
|
-
await hydrateForTool(
|
|
2616
|
+
await hydrateForTool(
|
|
2617
|
+
ctxMetadataStore,
|
|
2618
|
+
reqCtx.account?.id,
|
|
2619
|
+
"update_media_buy",
|
|
2620
|
+
params,
|
|
2621
|
+
logger,
|
|
2622
|
+
legacyFormatConverter
|
|
2623
|
+
);
|
|
2044
2624
|
if (proposalStore) {
|
|
2045
2625
|
const record = await (0, import_proposal.maybeHydrateRecipesForMediaBuyId)({
|
|
2046
2626
|
mediaBuyId: media_buy_id,
|
|
@@ -2057,7 +2637,11 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2057
2637
|
const push = extractPushConfig(params, logger, {
|
|
2058
2638
|
allowPrivateWebhookUrls: pushOpts.allowPrivateWebhookUrls
|
|
2059
2639
|
});
|
|
2060
|
-
const result = await sales.updateMediaBuy(
|
|
2640
|
+
const result = await sales.updateMediaBuy(
|
|
2641
|
+
media_buy_id,
|
|
2642
|
+
params,
|
|
2643
|
+
reqCtx
|
|
2644
|
+
);
|
|
2061
2645
|
return routeIfHandoff(
|
|
2062
2646
|
taskRegistry,
|
|
2063
2647
|
{
|
|
@@ -2081,7 +2665,13 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2081
2665
|
params,
|
|
2082
2666
|
logger
|
|
2083
2667
|
);
|
|
2084
|
-
return
|
|
2668
|
+
return asSemanticServerResponseForWire(
|
|
2669
|
+
r,
|
|
2670
|
+
"update_media_buy",
|
|
2671
|
+
legacyFormatConverter,
|
|
2672
|
+
canonicalFormatLegacyResolver,
|
|
2673
|
+
responseWireMode
|
|
2674
|
+
);
|
|
2085
2675
|
}
|
|
2086
2676
|
);
|
|
2087
2677
|
},
|
|
@@ -2090,6 +2680,8 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2090
2680
|
}
|
|
2091
2681
|
},
|
|
2092
2682
|
syncCreatives: async (params, ctx) => {
|
|
2683
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2684
|
+
params = asCanonicalSemanticServerRequest(params, "sync_creatives", legacyFormatConverter);
|
|
2093
2685
|
const reqCtx = ctxFor(ctx, params);
|
|
2094
2686
|
const creatives = params.creatives ?? [];
|
|
2095
2687
|
if (!sales?.syncCreatives) {
|
|
@@ -2116,7 +2708,13 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2116
2708
|
logger
|
|
2117
2709
|
},
|
|
2118
2710
|
result,
|
|
2119
|
-
(rows) => (
|
|
2711
|
+
(rows) => asSemanticServerResponseForWire(
|
|
2712
|
+
{ creatives: rows.map(normalizeRowErrors) },
|
|
2713
|
+
"sync_creatives",
|
|
2714
|
+
legacyFormatConverter,
|
|
2715
|
+
canonicalFormatLegacyResolver,
|
|
2716
|
+
responseWireMode
|
|
2717
|
+
)
|
|
2120
2718
|
);
|
|
2121
2719
|
},
|
|
2122
2720
|
(r) => r
|
|
@@ -2124,6 +2722,7 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2124
2722
|
},
|
|
2125
2723
|
...sales?.getMediaBuyDelivery && {
|
|
2126
2724
|
getMediaBuyDelivery: async (params, ctx) => {
|
|
2725
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2127
2726
|
const reqCtx = ctxFor(ctx, params);
|
|
2128
2727
|
if (proposalStore) {
|
|
2129
2728
|
const ids = params.media_buy_ids;
|
|
@@ -2149,7 +2748,13 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2149
2748
|
result?.media_buy_deliveries,
|
|
2150
2749
|
logger
|
|
2151
2750
|
);
|
|
2152
|
-
return
|
|
2751
|
+
return asSemanticServerResponseForWire(
|
|
2752
|
+
result,
|
|
2753
|
+
"get_media_buy_delivery",
|
|
2754
|
+
legacyFormatConverter,
|
|
2755
|
+
canonicalFormatLegacyResolver,
|
|
2756
|
+
responseWireMode
|
|
2757
|
+
);
|
|
2153
2758
|
},
|
|
2154
2759
|
(actuals) => actuals
|
|
2155
2760
|
);
|
|
@@ -2157,19 +2762,20 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2157
2762
|
},
|
|
2158
2763
|
// Optional methods — return UNSUPPORTED_FEATURE when the platform omits
|
|
2159
2764
|
// them. Adopters that haven't migrated to the v6 platform interface for
|
|
2160
|
-
// these specific tools can still pass raw handlers via opts.mediaBuy
|
|
2765
|
+
// these specific tools can still pass raw handlers via opts.legacyHandlers.mediaBuy
|
|
2161
2766
|
// (merge seam) — the merge runs AFTER buildMediaBuyHandlers, so opts
|
|
2162
2767
|
// handlers fill in for the methods this platform omits.
|
|
2163
2768
|
// `getMediaBuys` is REQUIRED at the type level, but we keep a runtime
|
|
2164
2769
|
// guard for the merge-seam migration path: legacy adopters wire it via
|
|
2165
|
-
// `opts.mediaBuy.getMediaBuys` rather than on the platform interface.
|
|
2770
|
+
// `opts.legacyHandlers.mediaBuy.getMediaBuys` rather than on the platform interface.
|
|
2166
2771
|
// Once the migration completes (every adopter implements it natively),
|
|
2167
2772
|
// this conditional spreads can collapse — but for now, omitting the
|
|
2168
2773
|
// platform-derived handler when absent lets `mergeHandlers` pick up the
|
|
2169
|
-
// adopter's custom handler from `opts.mediaBuy` instead of throwing
|
|
2774
|
+
// adopter's custom handler from `opts.legacyHandlers.mediaBuy` instead of throwing
|
|
2170
2775
|
// `sales.getMediaBuys is not a function`.
|
|
2171
2776
|
...sales?.getMediaBuys && {
|
|
2172
2777
|
getMediaBuys: async (params, ctx) => {
|
|
2778
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2173
2779
|
const reqCtx = ctxFor(ctx, params);
|
|
2174
2780
|
return projectSync(
|
|
2175
2781
|
async () => {
|
|
@@ -2181,16 +2787,29 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2181
2787
|
result?.media_buys,
|
|
2182
2788
|
logger
|
|
2183
2789
|
);
|
|
2790
|
+
const canonicalResult = asCanonicalSemanticServerResponse(
|
|
2791
|
+
result,
|
|
2792
|
+
"get_media_buys",
|
|
2793
|
+
legacyFormatConverter,
|
|
2794
|
+
canonicalFormatLegacyResolver
|
|
2795
|
+
);
|
|
2184
2796
|
await autoStoreResources(
|
|
2185
2797
|
ctxMetadataStore,
|
|
2186
2798
|
reqCtx.account?.id,
|
|
2187
2799
|
"media_buy",
|
|
2188
|
-
|
|
2800
|
+
canonicalResult?.media_buys,
|
|
2189
2801
|
"media_buy_id",
|
|
2190
2802
|
logger
|
|
2191
2803
|
);
|
|
2192
|
-
|
|
2193
|
-
|
|
2804
|
+
const wireResult = responseWireMode === "canonical" ? attachCanonicalCustomFormatWireRefs(canonicalResult, canonicalFormatLegacyResolver, "get_media_buys") : asSemanticServerResponseForWire(
|
|
2805
|
+
result,
|
|
2806
|
+
"get_media_buys",
|
|
2807
|
+
legacyFormatConverter,
|
|
2808
|
+
canonicalFormatLegacyResolver,
|
|
2809
|
+
responseWireMode
|
|
2810
|
+
);
|
|
2811
|
+
await backfillTargetingOverlay(mediaBuyStore, reqCtx.account?.id, wireResult, logger);
|
|
2812
|
+
return wireResult;
|
|
2194
2813
|
},
|
|
2195
2814
|
(r) => r
|
|
2196
2815
|
);
|
|
@@ -2198,37 +2817,64 @@ function buildMediaBuyHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2198
2817
|
},
|
|
2199
2818
|
...sales?.providePerformanceFeedback && {
|
|
2200
2819
|
providePerformanceFeedback: async (params, ctx) => {
|
|
2820
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2821
|
+
params = asCanonicalSemanticServerRequest(params, "provide_performance_feedback", legacyFormatConverter);
|
|
2201
2822
|
const reqCtx = ctxFor(ctx, params);
|
|
2202
|
-
await hydrateForTool(
|
|
2823
|
+
await hydrateForTool(
|
|
2824
|
+
ctxMetadataStore,
|
|
2825
|
+
reqCtx.account?.id,
|
|
2826
|
+
"provide_performance_feedback",
|
|
2827
|
+
params,
|
|
2828
|
+
logger,
|
|
2829
|
+
legacyFormatConverter
|
|
2830
|
+
);
|
|
2203
2831
|
return projectSync(
|
|
2204
2832
|
() => sales.providePerformanceFeedback(params, reqCtx),
|
|
2205
|
-
(
|
|
2833
|
+
(result) => asSemanticServerResponseForWire(
|
|
2834
|
+
result,
|
|
2835
|
+
"provide_performance_feedback",
|
|
2836
|
+
legacyFormatConverter,
|
|
2837
|
+
canonicalFormatLegacyResolver,
|
|
2838
|
+
responseWireMode
|
|
2839
|
+
)
|
|
2206
2840
|
);
|
|
2207
2841
|
}
|
|
2208
2842
|
},
|
|
2209
|
-
...sales?.
|
|
2843
|
+
...sales?.listCreativeFormatsLegacy && {
|
|
2210
2844
|
listCreativeFormats: async (params, ctx) => {
|
|
2211
2845
|
const reqCtx = ctxFor(ctx, params);
|
|
2212
2846
|
return projectSync(
|
|
2213
|
-
() => sales.
|
|
2847
|
+
() => sales.listCreativeFormatsLegacy(params, reqCtx),
|
|
2214
2848
|
(r) => r
|
|
2215
2849
|
);
|
|
2216
2850
|
}
|
|
2217
2851
|
},
|
|
2218
2852
|
...sales?.listCreatives && {
|
|
2219
2853
|
listCreatives: async (params, ctx) => {
|
|
2220
|
-
const
|
|
2854
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2855
|
+
const canonicalParams = asCanonicalListCreativesRequest(
|
|
2856
|
+
params,
|
|
2857
|
+
legacyFormatConverter
|
|
2858
|
+
);
|
|
2859
|
+
const reqCtx = ctxFor(ctx, canonicalParams);
|
|
2221
2860
|
return projectSync(
|
|
2222
2861
|
async () => {
|
|
2223
|
-
const result = await sales.listCreatives(
|
|
2862
|
+
const result = await sales.listCreatives(canonicalParams, reqCtx);
|
|
2863
|
+
const canonicalResult = asSemanticServerResponseForWire(
|
|
2864
|
+
result,
|
|
2865
|
+
"list_creatives",
|
|
2866
|
+
legacyFormatConverter,
|
|
2867
|
+
canonicalFormatLegacyResolver,
|
|
2868
|
+
responseWireMode
|
|
2869
|
+
);
|
|
2224
2870
|
warnIfTruncatedMultiIdResponse(
|
|
2225
2871
|
"listCreatives",
|
|
2226
2872
|
"creative_ids",
|
|
2227
2873
|
params.creative_ids,
|
|
2228
|
-
|
|
2874
|
+
canonicalResult?.creatives,
|
|
2229
2875
|
logger
|
|
2230
2876
|
);
|
|
2231
|
-
return
|
|
2877
|
+
return canonicalResult;
|
|
2232
2878
|
},
|
|
2233
2879
|
(r) => r
|
|
2234
2880
|
);
|
|
@@ -2246,26 +2892,26 @@ function projectBuildCreativeReturn(ret) {
|
|
|
2246
2892
|
}
|
|
2247
2893
|
return { creative_manifest: ret };
|
|
2248
2894
|
}
|
|
2249
|
-
function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observability, logger, pushOpts, ctxFor) {
|
|
2895
|
+
function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observability, logger, pushOpts, ctxFor, legacyFormatConverter, canonicalFormatLegacyResolver, creativeWireMode) {
|
|
2250
2896
|
const creative = platform.creative;
|
|
2251
2897
|
if (!creative) return void 0;
|
|
2252
2898
|
return {
|
|
2253
2899
|
buildCreative: async (params, ctx) => {
|
|
2254
2900
|
const reqCtx = ctxFor(ctx, params);
|
|
2255
2901
|
return projectSync(
|
|
2256
|
-
() => creative.
|
|
2902
|
+
() => creative.buildCreativeLegacy(params, reqCtx),
|
|
2257
2903
|
(ret) => projectBuildCreativeReturn(ret)
|
|
2258
2904
|
);
|
|
2259
2905
|
},
|
|
2260
2906
|
previewCreative: async (params, ctx) => {
|
|
2261
|
-
if (!("
|
|
2907
|
+
if (!("previewCreativeLegacy" in creative) || creative.previewCreativeLegacy == null) {
|
|
2262
2908
|
return (0, import_errors.adcpError)("UNSUPPORTED_FEATURE", {
|
|
2263
|
-
message: "preview_creative: this creative platform did not implement
|
|
2909
|
+
message: "preview_creative: this creative platform did not implement previewCreativeLegacy. Add `previewCreativeLegacy(req, ctx)` to your CreativeBuilderPlatform / CreativeAdServerPlatform literal."
|
|
2264
2910
|
});
|
|
2265
2911
|
}
|
|
2266
2912
|
const reqCtx = ctxFor(ctx, params);
|
|
2267
2913
|
return projectSync(
|
|
2268
|
-
() => creative.
|
|
2914
|
+
() => creative.previewCreativeLegacy(params, reqCtx),
|
|
2269
2915
|
(preview) => preview
|
|
2270
2916
|
);
|
|
2271
2917
|
},
|
|
@@ -2275,14 +2921,14 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2275
2921
|
// undefined per `NoAccountCtx`. Wired identically on both
|
|
2276
2922
|
// `CreativeBuilderPlatform` and `CreativeAdServerPlatform`.
|
|
2277
2923
|
listCreativeFormats: async (params, ctx) => {
|
|
2278
|
-
if (!("
|
|
2924
|
+
if (!("listCreativeFormatsLegacy" in creative) || creative.listCreativeFormatsLegacy == null) {
|
|
2279
2925
|
return (0, import_errors.adcpError)("UNSUPPORTED_FEATURE", {
|
|
2280
|
-
message: "list_creative_formats: this creative platform did not implement
|
|
2926
|
+
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`."
|
|
2281
2927
|
});
|
|
2282
2928
|
}
|
|
2283
2929
|
const reqCtx = ctxFor(ctx, params);
|
|
2284
2930
|
return projectSync(
|
|
2285
|
-
() => creative.
|
|
2931
|
+
() => creative.listCreativeFormatsLegacy(params, reqCtx),
|
|
2286
2932
|
(r) => r
|
|
2287
2933
|
);
|
|
2288
2934
|
},
|
|
@@ -2293,6 +2939,8 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2293
2939
|
// buildAccountHandlers — see comment at line 4544.
|
|
2294
2940
|
...creative.syncCreatives != null && {
|
|
2295
2941
|
syncCreatives: async (params, ctx) => {
|
|
2942
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2943
|
+
params = asCanonicalSemanticServerRequest(params, "sync_creatives", legacyFormatConverter);
|
|
2296
2944
|
const reqCtx = ctxFor(ctx, params);
|
|
2297
2945
|
const creatives = params.creatives ?? [];
|
|
2298
2946
|
return projectSync(
|
|
@@ -2316,7 +2964,13 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2316
2964
|
logger
|
|
2317
2965
|
},
|
|
2318
2966
|
result,
|
|
2319
|
-
(rows) => (
|
|
2967
|
+
(rows) => asSemanticServerResponseForWire(
|
|
2968
|
+
{ creatives: rows.map(normalizeRowErrors) },
|
|
2969
|
+
"sync_creatives",
|
|
2970
|
+
legacyFormatConverter,
|
|
2971
|
+
canonicalFormatLegacyResolver,
|
|
2972
|
+
responseWireMode
|
|
2973
|
+
)
|
|
2320
2974
|
);
|
|
2321
2975
|
},
|
|
2322
2976
|
(r) => r
|
|
@@ -2330,18 +2984,30 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2330
2984
|
// every call. Only emit handlers when the platform method is present.
|
|
2331
2985
|
..."listCreatives" in creative && creative.listCreatives != null && {
|
|
2332
2986
|
listCreatives: async (params, ctx) => {
|
|
2333
|
-
const
|
|
2987
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2988
|
+
const canonicalParams = asCanonicalListCreativesRequest(
|
|
2989
|
+
params,
|
|
2990
|
+
legacyFormatConverter
|
|
2991
|
+
);
|
|
2992
|
+
const reqCtx = ctxFor(ctx, canonicalParams);
|
|
2334
2993
|
return projectSync(
|
|
2335
2994
|
async () => {
|
|
2336
|
-
const result = await creative.listCreatives(
|
|
2995
|
+
const result = await creative.listCreatives(canonicalParams, reqCtx);
|
|
2996
|
+
const canonicalResult = asSemanticServerResponseForWire(
|
|
2997
|
+
result,
|
|
2998
|
+
"list_creatives",
|
|
2999
|
+
legacyFormatConverter,
|
|
3000
|
+
canonicalFormatLegacyResolver,
|
|
3001
|
+
responseWireMode
|
|
3002
|
+
);
|
|
2337
3003
|
warnIfTruncatedMultiIdResponse(
|
|
2338
3004
|
"listCreatives",
|
|
2339
3005
|
"creative_ids",
|
|
2340
3006
|
params.creative_ids,
|
|
2341
|
-
|
|
3007
|
+
canonicalResult?.creatives,
|
|
2342
3008
|
logger
|
|
2343
3009
|
);
|
|
2344
|
-
return
|
|
3010
|
+
return canonicalResult;
|
|
2345
3011
|
},
|
|
2346
3012
|
(r) => r
|
|
2347
3013
|
);
|
|
@@ -2349,6 +3015,7 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2349
3015
|
},
|
|
2350
3016
|
..."getCreativeDelivery" in creative && creative.getCreativeDelivery != null && {
|
|
2351
3017
|
getCreativeDelivery: async (params, ctx) => {
|
|
3018
|
+
const responseWireMode = creativeWireModeForRequest(ctx, creativeWireMode, params);
|
|
2352
3019
|
const reqCtx = ctxFor(ctx, params);
|
|
2353
3020
|
return projectSync(
|
|
2354
3021
|
async () => {
|
|
@@ -2360,7 +3027,13 @@ function buildCreativeHandlers(platform, taskRegistry, taskWebhookEmit, observab
|
|
|
2360
3027
|
result?.creative_deliveries,
|
|
2361
3028
|
logger
|
|
2362
3029
|
);
|
|
2363
|
-
return
|
|
3030
|
+
return asSemanticServerResponseForWire(
|
|
3031
|
+
result,
|
|
3032
|
+
"get_creative_delivery",
|
|
3033
|
+
legacyFormatConverter,
|
|
3034
|
+
canonicalFormatLegacyResolver,
|
|
3035
|
+
responseWireMode
|
|
3036
|
+
);
|
|
2364
3037
|
},
|
|
2365
3038
|
(r) => r
|
|
2366
3039
|
);
|
|
@@ -2606,7 +3279,7 @@ function buildBrandRightsHandlers(platform, ctxFor, ctxMetadataStore, logger) {
|
|
|
2606
3279
|
const reqCtx = ctxFor(ctx, params);
|
|
2607
3280
|
return projectSync(
|
|
2608
3281
|
async () => {
|
|
2609
|
-
const result = await br.
|
|
3282
|
+
const result = await br.getRightsLegacy(params, reqCtx);
|
|
2610
3283
|
await autoStoreResources(
|
|
2611
3284
|
ctxMetadataStore,
|
|
2612
3285
|
reqCtx.account?.id,
|
|
@@ -2629,7 +3302,7 @@ function buildBrandRightsHandlers(platform, ctxFor, ctxMetadataStore, logger) {
|
|
|
2629
3302
|
const reqCtx = ctxFor(ctx, params);
|
|
2630
3303
|
await hydrateForTool(ctxMetadataStore, reqCtx.account?.id, "acquire_rights", params, logger);
|
|
2631
3304
|
return projectSync(
|
|
2632
|
-
() => br.
|
|
3305
|
+
() => br.acquireRightsLegacy(params, reqCtx),
|
|
2633
3306
|
(r) => r
|
|
2634
3307
|
);
|
|
2635
3308
|
},
|
|
@@ -2647,7 +3320,7 @@ function buildBrandRightsHandlers(platform, ctxFor, ctxMetadataStore, logger) {
|
|
|
2647
3320
|
const reqCtx = ctxFor(ctx, params);
|
|
2648
3321
|
await hydrateForTool(ctxMetadataStore, reqCtx.account?.id, "update_rights", params, logger);
|
|
2649
3322
|
return projectSync(
|
|
2650
|
-
() => br.
|
|
3323
|
+
() => br.updateRightsLegacy(params, reqCtx),
|
|
2651
3324
|
(r) => r
|
|
2652
3325
|
);
|
|
2653
3326
|
}
|
|
@@ -2768,59 +3441,59 @@ function buildGovernanceHandlers(platform, ctxFor) {
|
|
|
2768
3441
|
handlers.listContentStandards = async (params, ctx) => {
|
|
2769
3442
|
const reqCtx = ctxFor(ctx, params);
|
|
2770
3443
|
return projectSync(
|
|
2771
|
-
() => cs.
|
|
3444
|
+
() => cs.listContentStandardsLegacy(params, reqCtx),
|
|
2772
3445
|
(r) => r
|
|
2773
3446
|
);
|
|
2774
3447
|
};
|
|
2775
3448
|
handlers.getContentStandards = async (params, ctx) => {
|
|
2776
3449
|
const reqCtx = ctxFor(ctx, params);
|
|
2777
3450
|
return projectSync(
|
|
2778
|
-
() => cs.
|
|
3451
|
+
() => cs.getContentStandardsLegacy(params, reqCtx),
|
|
2779
3452
|
(r) => r
|
|
2780
3453
|
);
|
|
2781
3454
|
};
|
|
2782
3455
|
handlers.createContentStandards = async (params, ctx) => {
|
|
2783
3456
|
const reqCtx = ctxFor(ctx, params);
|
|
2784
3457
|
return projectSync(
|
|
2785
|
-
() => cs.
|
|
3458
|
+
() => cs.createContentStandardsLegacy(params, reqCtx),
|
|
2786
3459
|
(r) => r
|
|
2787
3460
|
);
|
|
2788
3461
|
};
|
|
2789
3462
|
handlers.updateContentStandards = async (params, ctx) => {
|
|
2790
3463
|
const reqCtx = ctxFor(ctx, params);
|
|
2791
3464
|
return projectSync(
|
|
2792
|
-
() => cs.
|
|
3465
|
+
() => cs.updateContentStandardsLegacy(params, reqCtx),
|
|
2793
3466
|
(r) => r
|
|
2794
3467
|
);
|
|
2795
3468
|
};
|
|
2796
3469
|
handlers.calibrateContent = async (params, ctx) => {
|
|
2797
3470
|
const reqCtx = ctxFor(ctx, params);
|
|
2798
3471
|
return projectSync(
|
|
2799
|
-
() => cs.
|
|
3472
|
+
() => cs.calibrateContentLegacy(params, reqCtx),
|
|
2800
3473
|
(r) => r
|
|
2801
3474
|
);
|
|
2802
3475
|
};
|
|
2803
3476
|
handlers.validateContentDelivery = async (params, ctx) => {
|
|
2804
3477
|
const reqCtx = ctxFor(ctx, params);
|
|
2805
3478
|
return projectSync(
|
|
2806
|
-
() => cs.
|
|
3479
|
+
() => cs.validateContentDeliveryLegacy(params, reqCtx),
|
|
2807
3480
|
(r) => r
|
|
2808
3481
|
);
|
|
2809
3482
|
};
|
|
2810
|
-
if (cs.
|
|
3483
|
+
if (cs.getMediaBuyArtifactsLegacy) {
|
|
2811
3484
|
handlers.getMediaBuyArtifacts = async (params, ctx) => {
|
|
2812
3485
|
const reqCtx = ctxFor(ctx, params);
|
|
2813
3486
|
return projectSync(
|
|
2814
|
-
() => cs.
|
|
3487
|
+
() => cs.getMediaBuyArtifactsLegacy(params, reqCtx),
|
|
2815
3488
|
(r) => r
|
|
2816
3489
|
);
|
|
2817
3490
|
};
|
|
2818
3491
|
}
|
|
2819
|
-
if (cs.
|
|
3492
|
+
if (cs.getCreativeFeaturesLegacy) {
|
|
2820
3493
|
handlers.getCreativeFeatures = async (params, ctx) => {
|
|
2821
3494
|
const reqCtx = ctxFor(ctx, params);
|
|
2822
3495
|
return projectSync(
|
|
2823
|
-
() => cs.
|
|
3496
|
+
() => cs.getCreativeFeaturesLegacy(params, reqCtx),
|
|
2824
3497
|
(r) => r
|
|
2825
3498
|
);
|
|
2826
3499
|
};
|