@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
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { CreativeAsset, PackageRequest } from '../types/tools.generated.mjs';
|
|
2
|
+
import { type CanonicalCreativeAsset, type LegacyCreativeAsset } from '../v2/projection/creative-delivery.mjs';
|
|
3
|
+
import type { LegacyFormatConverter } from '../v2/projection/v1-to-v2.mjs';
|
|
4
|
+
import type { CanonicalFormatLegacyResolver } from '../v2/projection/v2-to-v1.mjs';
|
|
2
5
|
/**
|
|
3
6
|
* Package-like input accepted by `inlineCreativesForPackages`.
|
|
4
7
|
*
|
|
@@ -6,15 +9,28 @@ import type { CreativeAsset, PackageRequest } from '../types/tools.generated.mjs
|
|
|
6
9
|
* patches are narrower but carry the same `package_id` + `creatives` fields,
|
|
7
10
|
* so the helper accepts both without depending on AgentClient.
|
|
8
11
|
*/
|
|
9
|
-
export type InlineCreativePackage =
|
|
12
|
+
export type InlineCreativePackage = {
|
|
10
13
|
package_id?: string;
|
|
11
14
|
buyer_ref?: string;
|
|
12
|
-
context?: {
|
|
15
|
+
context?: NonNullable<PackageRequest['context']> & {
|
|
13
16
|
buyer_ref?: string;
|
|
14
|
-
[key: string]: unknown;
|
|
15
17
|
};
|
|
18
|
+
creatives?: CanonicalCreativeAsset[];
|
|
19
|
+
format_ids?: never;
|
|
20
|
+
format_option_refs?: PackageRequest['format_option_refs'];
|
|
21
|
+
format_kind?: PackageRequest['format_kind'];
|
|
22
|
+
params?: PackageRequest['params'];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Compatibility-only package shape accepted by
|
|
26
|
+
* `inlineCreativesForPackagesLegacy`.
|
|
27
|
+
*
|
|
28
|
+
* @deprecated Legacy `format_ids` belong at an explicit compatibility
|
|
29
|
+
* boundary. Prefer `InlineCreativePackage` and canonical format selectors.
|
|
30
|
+
*/
|
|
31
|
+
export type LegacyInlineCreativePackage = Omit<InlineCreativePackage, 'creatives' | 'format_ids'> & {
|
|
16
32
|
creatives?: CreativeAsset[];
|
|
17
|
-
[
|
|
33
|
+
format_ids?: PackageRequest['format_ids'];
|
|
18
34
|
};
|
|
19
35
|
/**
|
|
20
36
|
* Assignment shape shared with `sync_creatives.assignments[]`, plus
|
|
@@ -28,7 +44,7 @@ export interface InlineCreativeAssignment {
|
|
|
28
44
|
placement_ids?: string[];
|
|
29
45
|
placement_refs?: unknown[];
|
|
30
46
|
}
|
|
31
|
-
|
|
47
|
+
interface InlineCreativesForPackagesBaseOptions<TPackage> {
|
|
32
48
|
/**
|
|
33
49
|
* Package-scoped assignment instructions. When supplied, only creatives
|
|
34
50
|
* assigned to each package are inlined unless `includeUnassignedCreatives`
|
|
@@ -41,8 +57,9 @@ export interface InlineCreativesForPackagesOptions<TPackage extends InlineCreati
|
|
|
41
57
|
*/
|
|
42
58
|
includeUnassignedCreatives?: boolean;
|
|
43
59
|
/**
|
|
44
|
-
* Filter creatives by package format selectors (`
|
|
45
|
-
* `
|
|
60
|
+
* Filter creatives by package format selectors (`format_option_refs` or
|
|
61
|
+
* `format_kind`). The legacy helper also recognizes `format_ids`. Defaults
|
|
62
|
+
* to true.
|
|
46
63
|
*/
|
|
47
64
|
filterByFormat?: boolean;
|
|
48
65
|
/**
|
|
@@ -69,8 +86,23 @@ export interface InlineCreativesForPackagesOptions<TPackage extends InlineCreati
|
|
|
69
86
|
*/
|
|
70
87
|
onIncompatibleAssignment?: 'throw' | 'ignore';
|
|
71
88
|
}
|
|
72
|
-
export
|
|
73
|
-
|
|
89
|
+
export interface InlineCreativesForPackagesOptions<TPackage extends InlineCreativePackage = InlineCreativePackage> extends InlineCreativesForPackagesBaseOptions<TPackage> {
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Options for the explicit legacy inline-creative compatibility helper.
|
|
93
|
+
*
|
|
94
|
+
* @deprecated Prefer canonical selectors and `inlineCreativesForPackages`.
|
|
95
|
+
*/
|
|
96
|
+
export interface InlineCreativesForPackagesLegacyOptions<TPackage extends LegacyInlineCreativePackage = LegacyInlineCreativePackage> extends InlineCreativesForPackagesBaseOptions<TPackage> {
|
|
97
|
+
/** Fail closed when the seller's legacy wire shape is not known. */
|
|
98
|
+
creativeFormatWireMode?: 'legacy' | 'unknown';
|
|
99
|
+
/** Convert custom legacy creative refs before matching/projecting. */
|
|
100
|
+
legacyFormatConverter?: LegacyFormatConverter;
|
|
101
|
+
/** Resolve canonical custom formats when no built-in or private legacy mapping exists. */
|
|
102
|
+
canonicalFormatLegacyResolver?: CanonicalFormatLegacyResolver;
|
|
103
|
+
}
|
|
104
|
+
export type InlineCreativePackagePatch<TPackage extends InlineCreativePackage | LegacyInlineCreativePackage = InlineCreativePackage, TCreative = CanonicalCreativeAsset> = Omit<TPackage, 'creatives'> & {
|
|
105
|
+
creatives?: TCreative[];
|
|
74
106
|
};
|
|
75
107
|
/**
|
|
76
108
|
* Project library-scoped creative assets into package-scoped inline creative
|
|
@@ -99,4 +131,14 @@ export type InlineCreativePackagePatch<TPackage extends InlineCreativePackage =
|
|
|
99
131
|
* }
|
|
100
132
|
* ```
|
|
101
133
|
*/
|
|
102
|
-
export declare function inlineCreativesForPackages<TPackage extends InlineCreativePackage>(packages: ReadonlyArray<TPackage>, creatives: ReadonlyArray<
|
|
134
|
+
export declare function inlineCreativesForPackages<TPackage extends InlineCreativePackage>(packages: ReadonlyArray<TPackage>, creatives: ReadonlyArray<CanonicalCreativeAsset>, options?: InlineCreativesForPackagesOptions<TPackage>): InlineCreativePackagePatch<TPackage, CanonicalCreativeAsset>[];
|
|
135
|
+
/**
|
|
136
|
+
* Project creatives into the legacy inline package wire shape.
|
|
137
|
+
*
|
|
138
|
+
* @deprecated This is an explicit compatibility escape hatch for legacy
|
|
139
|
+
* sellers. New integrations should use canonical package selectors with
|
|
140
|
+
* `inlineCreativesForPackages`; the SDK client performs negotiated wire
|
|
141
|
+
* projection at the transport boundary.
|
|
142
|
+
*/
|
|
143
|
+
export declare function inlineCreativesForPackagesLegacy<TPackage extends LegacyInlineCreativePackage>(packages: ReadonlyArray<TPackage>, creatives: ReadonlyArray<CreativeAsset>, options?: InlineCreativesForPackagesLegacyOptions<TPackage>): InlineCreativePackagePatch<TPackage, LegacyCreativeAsset>[];
|
|
144
|
+
export {};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { CreativeAsset, PackageRequest } from '../types/tools.generated';
|
|
2
|
+
import { type CanonicalCreativeAsset, type LegacyCreativeAsset } from '../v2/projection/creative-delivery';
|
|
3
|
+
import type { LegacyFormatConverter } from '../v2/projection/v1-to-v2';
|
|
4
|
+
import type { CanonicalFormatLegacyResolver } from '../v2/projection/v2-to-v1';
|
|
2
5
|
/**
|
|
3
6
|
* Package-like input accepted by `inlineCreativesForPackages`.
|
|
4
7
|
*
|
|
@@ -6,15 +9,28 @@ import type { CreativeAsset, PackageRequest } from '../types/tools.generated';
|
|
|
6
9
|
* patches are narrower but carry the same `package_id` + `creatives` fields,
|
|
7
10
|
* so the helper accepts both without depending on AgentClient.
|
|
8
11
|
*/
|
|
9
|
-
export type InlineCreativePackage =
|
|
12
|
+
export type InlineCreativePackage = {
|
|
10
13
|
package_id?: string;
|
|
11
14
|
buyer_ref?: string;
|
|
12
|
-
context?: {
|
|
15
|
+
context?: NonNullable<PackageRequest['context']> & {
|
|
13
16
|
buyer_ref?: string;
|
|
14
|
-
[key: string]: unknown;
|
|
15
17
|
};
|
|
18
|
+
creatives?: CanonicalCreativeAsset[];
|
|
19
|
+
format_ids?: never;
|
|
20
|
+
format_option_refs?: PackageRequest['format_option_refs'];
|
|
21
|
+
format_kind?: PackageRequest['format_kind'];
|
|
22
|
+
params?: PackageRequest['params'];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Compatibility-only package shape accepted by
|
|
26
|
+
* `inlineCreativesForPackagesLegacy`.
|
|
27
|
+
*
|
|
28
|
+
* @deprecated Legacy `format_ids` belong at an explicit compatibility
|
|
29
|
+
* boundary. Prefer `InlineCreativePackage` and canonical format selectors.
|
|
30
|
+
*/
|
|
31
|
+
export type LegacyInlineCreativePackage = Omit<InlineCreativePackage, 'creatives' | 'format_ids'> & {
|
|
16
32
|
creatives?: CreativeAsset[];
|
|
17
|
-
[
|
|
33
|
+
format_ids?: PackageRequest['format_ids'];
|
|
18
34
|
};
|
|
19
35
|
/**
|
|
20
36
|
* Assignment shape shared with `sync_creatives.assignments[]`, plus
|
|
@@ -28,7 +44,7 @@ export interface InlineCreativeAssignment {
|
|
|
28
44
|
placement_ids?: string[];
|
|
29
45
|
placement_refs?: unknown[];
|
|
30
46
|
}
|
|
31
|
-
|
|
47
|
+
interface InlineCreativesForPackagesBaseOptions<TPackage> {
|
|
32
48
|
/**
|
|
33
49
|
* Package-scoped assignment instructions. When supplied, only creatives
|
|
34
50
|
* assigned to each package are inlined unless `includeUnassignedCreatives`
|
|
@@ -41,8 +57,9 @@ export interface InlineCreativesForPackagesOptions<TPackage extends InlineCreati
|
|
|
41
57
|
*/
|
|
42
58
|
includeUnassignedCreatives?: boolean;
|
|
43
59
|
/**
|
|
44
|
-
* Filter creatives by package format selectors (`
|
|
45
|
-
* `
|
|
60
|
+
* Filter creatives by package format selectors (`format_option_refs` or
|
|
61
|
+
* `format_kind`). The legacy helper also recognizes `format_ids`. Defaults
|
|
62
|
+
* to true.
|
|
46
63
|
*/
|
|
47
64
|
filterByFormat?: boolean;
|
|
48
65
|
/**
|
|
@@ -69,8 +86,23 @@ export interface InlineCreativesForPackagesOptions<TPackage extends InlineCreati
|
|
|
69
86
|
*/
|
|
70
87
|
onIncompatibleAssignment?: 'throw' | 'ignore';
|
|
71
88
|
}
|
|
72
|
-
export
|
|
73
|
-
|
|
89
|
+
export interface InlineCreativesForPackagesOptions<TPackage extends InlineCreativePackage = InlineCreativePackage> extends InlineCreativesForPackagesBaseOptions<TPackage> {
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Options for the explicit legacy inline-creative compatibility helper.
|
|
93
|
+
*
|
|
94
|
+
* @deprecated Prefer canonical selectors and `inlineCreativesForPackages`.
|
|
95
|
+
*/
|
|
96
|
+
export interface InlineCreativesForPackagesLegacyOptions<TPackage extends LegacyInlineCreativePackage = LegacyInlineCreativePackage> extends InlineCreativesForPackagesBaseOptions<TPackage> {
|
|
97
|
+
/** Fail closed when the seller's legacy wire shape is not known. */
|
|
98
|
+
creativeFormatWireMode?: 'legacy' | 'unknown';
|
|
99
|
+
/** Convert custom legacy creative refs before matching/projecting. */
|
|
100
|
+
legacyFormatConverter?: LegacyFormatConverter;
|
|
101
|
+
/** Resolve canonical custom formats when no built-in or private legacy mapping exists. */
|
|
102
|
+
canonicalFormatLegacyResolver?: CanonicalFormatLegacyResolver;
|
|
103
|
+
}
|
|
104
|
+
export type InlineCreativePackagePatch<TPackage extends InlineCreativePackage | LegacyInlineCreativePackage = InlineCreativePackage, TCreative = CanonicalCreativeAsset> = Omit<TPackage, 'creatives'> & {
|
|
105
|
+
creatives?: TCreative[];
|
|
74
106
|
};
|
|
75
107
|
/**
|
|
76
108
|
* Project library-scoped creative assets into package-scoped inline creative
|
|
@@ -99,5 +131,15 @@ export type InlineCreativePackagePatch<TPackage extends InlineCreativePackage =
|
|
|
99
131
|
* }
|
|
100
132
|
* ```
|
|
101
133
|
*/
|
|
102
|
-
export declare function inlineCreativesForPackages<TPackage extends InlineCreativePackage>(packages: ReadonlyArray<TPackage>, creatives: ReadonlyArray<
|
|
134
|
+
export declare function inlineCreativesForPackages<TPackage extends InlineCreativePackage>(packages: ReadonlyArray<TPackage>, creatives: ReadonlyArray<CanonicalCreativeAsset>, options?: InlineCreativesForPackagesOptions<TPackage>): InlineCreativePackagePatch<TPackage, CanonicalCreativeAsset>[];
|
|
135
|
+
/**
|
|
136
|
+
* Project creatives into the legacy inline package wire shape.
|
|
137
|
+
*
|
|
138
|
+
* @deprecated This is an explicit compatibility escape hatch for legacy
|
|
139
|
+
* sellers. New integrations should use canonical package selectors with
|
|
140
|
+
* `inlineCreativesForPackages`; the SDK client performs negotiated wire
|
|
141
|
+
* projection at the transport boundary.
|
|
142
|
+
*/
|
|
143
|
+
export declare function inlineCreativesForPackagesLegacy<TPackage extends LegacyInlineCreativePackage>(packages: ReadonlyArray<TPackage>, creatives: ReadonlyArray<CreativeAsset>, options?: InlineCreativesForPackagesLegacyOptions<TPackage>): InlineCreativePackagePatch<TPackage, LegacyCreativeAsset>[];
|
|
144
|
+
export {};
|
|
103
145
|
//# sourceMappingURL=creative-delivery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creative-delivery.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/creative-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"creative-delivery.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/creative-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAEL,KAAK,sBAAsB,EAE3B,KAAK,mBAAmB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2B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BAAsB,CAAC,EAAE,CAMhE;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,SAAS,2BAA2B,EAC3F,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC,EACjC,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,EACvC,OAAO,GAAE,uCAAuC,CAAC,QAAQ,CAAM,GAC9D,0BAA0B,CAAC,QAAQ,EAAE,mBAAmB,CAAC,EAAE,CAY7D"}
|
|
@@ -18,10 +18,30 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var creative_delivery_exports = {};
|
|
20
20
|
__export(creative_delivery_exports, {
|
|
21
|
-
inlineCreativesForPackages: () => inlineCreativesForPackages
|
|
21
|
+
inlineCreativesForPackages: () => inlineCreativesForPackages,
|
|
22
|
+
inlineCreativesForPackagesLegacy: () => inlineCreativesForPackagesLegacy
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(creative_delivery_exports);
|
|
25
|
+
var import_creative_delivery = require('../v2/projection/creative-delivery.js');
|
|
26
|
+
var import_v1_to_v2 = require('../v2/projection/v1-to-v2.js');
|
|
24
27
|
function inlineCreativesForPackages(packages, creatives, options = {}) {
|
|
28
|
+
assertCanonicalInlineInputs(packages, creatives, options);
|
|
29
|
+
return inlineCreativesForPackagesInternal(packages, creatives, options, "canonical");
|
|
30
|
+
}
|
|
31
|
+
function inlineCreativesForPackagesLegacy(packages, creatives, options = {}) {
|
|
32
|
+
const { creativeFormatWireMode = "legacy", ...sharedOptions } = options;
|
|
33
|
+
return inlineCreativesForPackagesInternal(
|
|
34
|
+
packages,
|
|
35
|
+
creatives,
|
|
36
|
+
{
|
|
37
|
+
...sharedOptions,
|
|
38
|
+
legacyFormatConverter: options.legacyFormatConverter,
|
|
39
|
+
canonicalFormatLegacyResolver: options.canonicalFormatLegacyResolver
|
|
40
|
+
},
|
|
41
|
+
creativeFormatWireMode
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
function inlineCreativesForPackagesInternal(packages, creatives, options, creativeFormatWireMode) {
|
|
25
45
|
const {
|
|
26
46
|
assignments,
|
|
27
47
|
includeUnassignedCreatives = assignments == null || assignments.length === 0,
|
|
@@ -29,7 +49,9 @@ function inlineCreativesForPackages(packages, creatives, options = {}) {
|
|
|
29
49
|
packageId = defaultPackageId,
|
|
30
50
|
onUnmatchedAssignment = "throw",
|
|
31
51
|
onMissingCreative = "throw",
|
|
32
|
-
onIncompatibleAssignment = "throw"
|
|
52
|
+
onIncompatibleAssignment = "throw",
|
|
53
|
+
legacyFormatConverter,
|
|
54
|
+
canonicalFormatLegacyResolver
|
|
33
55
|
} = options;
|
|
34
56
|
const creativesById = /* @__PURE__ */ new Map();
|
|
35
57
|
for (const creative of creatives) {
|
|
@@ -65,9 +87,26 @@ function inlineCreativesForPackages(packages, creatives, options = {}) {
|
|
|
65
87
|
for (const assignment of assigned) {
|
|
66
88
|
const creative = creativesById.get(assignment.creative_id);
|
|
67
89
|
if (!creative) continue;
|
|
68
|
-
const
|
|
90
|
+
const sourceCompatible = !filterByFormat || creativeMatchesPackage(pkg, creative);
|
|
91
|
+
if (!sourceCompatible) {
|
|
92
|
+
if (onIncompatibleAssignment === "throw") {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`inlineCreativesForPackages assignment creative_id "${assignment.creative_id}" does not match package_id "${assignment.package_id}" format selectors`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const projected = (0, import_creative_delivery.projectCreativeForDelivery)(
|
|
100
|
+
creative,
|
|
101
|
+
pkg,
|
|
102
|
+
creativeFormatWireMode,
|
|
103
|
+
"inline_creatives",
|
|
104
|
+
legacyFormatConverter,
|
|
105
|
+
canonicalFormatLegacyResolver
|
|
106
|
+
);
|
|
107
|
+
const compatible = !filterByFormat || creativeMatchesPackage(pkg, projected);
|
|
69
108
|
if (compatible) {
|
|
70
|
-
inlined.push(applyAssignmentToCreative(
|
|
109
|
+
inlined.push(applyAssignmentToCreative(projected, assignment));
|
|
71
110
|
} else if (onIncompatibleAssignment === "throw") {
|
|
72
111
|
throw new Error(
|
|
73
112
|
`inlineCreativesForPackages assignment creative_id "${assignment.creative_id}" does not match package_id "${assignment.package_id}" format selectors`
|
|
@@ -77,8 +116,17 @@ function inlineCreativesForPackages(packages, creatives, options = {}) {
|
|
|
77
116
|
if (includeUnassignedCreatives) {
|
|
78
117
|
for (const creative of creatives) {
|
|
79
118
|
if (typeof creative.creative_id === "string" && assignedCreativeIds.has(creative.creative_id)) continue;
|
|
80
|
-
if (
|
|
81
|
-
|
|
119
|
+
if (filterByFormat && !creativeMatchesPackage(pkg, creative)) continue;
|
|
120
|
+
const projected = (0, import_creative_delivery.projectCreativeForDelivery)(
|
|
121
|
+
creative,
|
|
122
|
+
pkg,
|
|
123
|
+
creativeFormatWireMode,
|
|
124
|
+
"inline_creatives",
|
|
125
|
+
legacyFormatConverter,
|
|
126
|
+
canonicalFormatLegacyResolver
|
|
127
|
+
);
|
|
128
|
+
if (!filterByFormat || creativeMatchesPackage(pkg, projected)) {
|
|
129
|
+
inlined.push({ ...projected });
|
|
82
130
|
}
|
|
83
131
|
}
|
|
84
132
|
}
|
|
@@ -97,6 +145,28 @@ function inlineCreativesForPackages(packages, creatives, options = {}) {
|
|
|
97
145
|
}
|
|
98
146
|
return result;
|
|
99
147
|
}
|
|
148
|
+
function assertCanonicalInlineInputs(packages, creatives, options) {
|
|
149
|
+
const unsafeOptions = options;
|
|
150
|
+
if ("creativeFormatWireMode" in unsafeOptions || "legacyFormatConverter" in unsafeOptions || "canonicalFormatLegacyResolver" in unsafeOptions) {
|
|
151
|
+
throw new Error(
|
|
152
|
+
"inlineCreativesForPackages is canonical-only; use inlineCreativesForPackagesLegacy for legacy wire projection"
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
for (const pkg of packages) {
|
|
156
|
+
if ("format_ids" in pkg) {
|
|
157
|
+
throw new Error(
|
|
158
|
+
"inlineCreativesForPackages does not accept legacy package format_ids; use canonical format selectors or inlineCreativesForPackagesLegacy"
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
for (const creative of creatives) {
|
|
163
|
+
if ("format_id" in creative) {
|
|
164
|
+
throw new Error(
|
|
165
|
+
"inlineCreativesForPackages does not accept legacy creative format_id; use canonical format_kind or inlineCreativesForPackagesLegacy"
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
100
170
|
function defaultPackageId(pkg) {
|
|
101
171
|
if (typeof pkg.package_id === "string") return pkg.package_id;
|
|
102
172
|
if (typeof pkg.context?.buyer_ref === "string") return pkg.context.buyer_ref;
|
|
@@ -131,13 +201,37 @@ function creativeMatchesPackage(pkg, creative) {
|
|
|
131
201
|
if (packageFormatIds.length === 0 && packageFormatKind === void 0) return false;
|
|
132
202
|
}
|
|
133
203
|
if (packageFormatKind !== void 0) {
|
|
134
|
-
return creativeRecord.format_kind === packageFormatKind && paramsMatchCreative(packageParams, creativeFormatId);
|
|
204
|
+
return creativeRecord.format_kind === packageFormatKind && paramsMatchCreative(packageParams, creativeFormatId ?? creativeParamsFromAssets(creativeRecord.assets));
|
|
135
205
|
}
|
|
136
206
|
if (packageFormatIds.length > 0) {
|
|
137
|
-
|
|
207
|
+
if (creativeFormatId !== void 0) {
|
|
208
|
+
return packageFormatIds.some((formatId) => formatIdMatches(formatId, creativeFormatId));
|
|
209
|
+
}
|
|
210
|
+
return packageFormatIds.some(
|
|
211
|
+
(formatId) => typeof formatId.id === "string" && (0, import_v1_to_v2.resolveCanonicalFormatKind)(formatId.id, {
|
|
212
|
+
agentUrl: typeof formatId.agent_url === "string" ? formatId.agent_url : void 0
|
|
213
|
+
}) === creativeRecord.format_kind
|
|
214
|
+
);
|
|
138
215
|
}
|
|
139
216
|
return true;
|
|
140
217
|
}
|
|
218
|
+
function creativeParamsFromAssets(value) {
|
|
219
|
+
const assets = plainObject(value);
|
|
220
|
+
if (!assets) return void 0;
|
|
221
|
+
for (const assetValue of Object.values(assets)) {
|
|
222
|
+
const candidates = Array.isArray(assetValue) ? assetValue : [assetValue];
|
|
223
|
+
for (const candidate of candidates) {
|
|
224
|
+
const asset = plainObject(candidate);
|
|
225
|
+
if (!asset) continue;
|
|
226
|
+
const params = {};
|
|
227
|
+
if (typeof asset.width === "number") params.width = asset.width;
|
|
228
|
+
if (typeof asset.height === "number") params.height = asset.height;
|
|
229
|
+
if (typeof asset.duration_ms === "number") params.duration_ms = asset.duration_ms;
|
|
230
|
+
if (Object.keys(params).length > 0) return params;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return void 0;
|
|
234
|
+
}
|
|
141
235
|
function arrayOfObjects(value) {
|
|
142
236
|
return Array.isArray(value) ? value.flatMap((item) => plainObject(item) ? [item] : []) : [];
|
|
143
237
|
}
|
|
@@ -250,6 +344,7 @@ function sortKeys(value) {
|
|
|
250
344
|
}
|
|
251
345
|
// Annotate the CommonJS export names for ESM import in node:
|
|
252
346
|
0 && (module.exports = {
|
|
253
|
-
inlineCreativesForPackages
|
|
347
|
+
inlineCreativesForPackages,
|
|
348
|
+
inlineCreativesForPackagesLegacy
|
|
254
349
|
});
|
|
255
350
|
//# sourceMappingURL=creative-delivery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/utils/creative-delivery.ts"],"sourcesContent":["import type { CreativeAsset, PackageRequest } from '../types/tools.generated';\n\n/**\n * Package-like input accepted by `inlineCreativesForPackages`.\n *\n * `PackageRequest` is the create-media-buy shape. Update-media-buy package\n * patches are narrower but carry the same `package_id` + `creatives` fields,\n * so the helper accepts both without depending on AgentClient.\n */\nexport type InlineCreativePackage = Partial<PackageRequest> & {\n package_id?: string;\n buyer_ref?: string;\n context?: { buyer_ref?: string; [key: string]: unknown };\n creatives?: CreativeAsset[];\n [key: string]: unknown;\n};\n\n/**\n * Assignment shape shared with `sync_creatives.assignments[]`, plus\n * `placement_refs` for callers already authoring the structured placement\n * form accepted by inline `CreativeAsset`.\n */\nexport interface InlineCreativeAssignment {\n creative_id: string;\n package_id: string;\n weight?: number;\n placement_ids?: string[];\n placement_refs?: unknown[];\n}\n\nexport interface InlineCreativesForPackagesOptions<TPackage extends InlineCreativePackage = InlineCreativePackage> {\n /**\n * Package-scoped assignment instructions. When supplied, only creatives\n * assigned to each package are inlined unless `includeUnassignedCreatives`\n * is true.\n */\n assignments?: ReadonlyArray<InlineCreativeAssignment>;\n\n /**\n * Include compatible creatives that have no assignment entry. Defaults to\n * false when assignments are supplied and true when no assignments exist.\n */\n includeUnassignedCreatives?: boolean;\n\n /**\n * Filter creatives by package format selectors (`format_ids`,\n * `format_option_refs`, or `format_kind`). Defaults to true.\n */\n filterByFormat?: boolean;\n\n /**\n * Resolve the package identifier used to match assignment.package_id.\n * Defaults to `package_id`, then `context.buyer_ref`, then `buyer_ref`.\n */\n packageId?: (pkg: TPackage, index: number) => string | undefined;\n\n /**\n * Behavior when an assignment names a package not present in the package\n * list. Defaults to throw so package scoping mistakes do not broaden\n * delivery silently.\n */\n onUnmatchedAssignment?: 'throw' | 'ignore';\n\n /**\n * Behavior when an assignment names a creative not present in `creatives`.\n * Defaults to throw because inline payloads cannot reference library-only\n * creatives.\n */\n onMissingCreative?: 'throw' | 'ignore';\n\n /**\n * Behavior when an explicit assignment names a creative whose format cannot\n * satisfy the target package selectors. Defaults to throw so authoring\n * mistakes do not silently remove assigned delivery.\n */\n onIncompatibleAssignment?: 'throw' | 'ignore';\n}\n\nexport type InlineCreativePackagePatch<TPackage extends InlineCreativePackage = InlineCreativePackage> = TPackage & {\n creatives?: CreativeAsset[];\n};\n\n/**\n * Project library-scoped creative assets into package-scoped inline creative\n * payloads for `create_media_buy` or `update_media_buy`.\n *\n * The helper is pure: it performs no network calls, does not call\n * `sync_creatives`, and does not generate idempotency keys. Use\n * `supportsSyncCreatives(caps)` to decide whether the seller has a creative\n * library. When it does not, spread this helper's result into\n * `packages[].creatives` and use a fresh idempotency key for the enclosing\n * create/update media-buy call.\n *\n * @example\n * ```ts\n * const caps = await agent.getCapabilities();\n * if (supportsSyncCreatives(caps)) {\n * await agent.syncCreatives({ account, creatives, assignments });\n * } else if (caps.features.inlineCreativeManagement) {\n * await agent.createMediaBuy({\n * account,\n * idempotency_key: crypto.randomUUID(),\n * packages: inlineCreativesForPackages(packages, creatives, { assignments }),\n * });\n * } else {\n * throw new Error('Seller supports neither creative library sync nor inline creative uploads.');\n * }\n * ```\n */\nexport function inlineCreativesForPackages<TPackage extends InlineCreativePackage>(\n packages: ReadonlyArray<TPackage>,\n creatives: ReadonlyArray<CreativeAsset>,\n options: InlineCreativesForPackagesOptions<TPackage> = {}\n): InlineCreativePackagePatch<TPackage>[] {\n const {\n assignments,\n includeUnassignedCreatives = assignments == null || assignments.length === 0,\n filterByFormat = true,\n packageId = defaultPackageId,\n onUnmatchedAssignment = 'throw',\n onMissingCreative = 'throw',\n onIncompatibleAssignment = 'throw',\n } = options;\n\n const creativesById = new Map<string, CreativeAsset>();\n for (const creative of creatives) {\n if (typeof creative.creative_id === 'string') {\n creativesById.set(creative.creative_id, creative);\n }\n }\n\n const assignmentsByPackage = new Map<string, InlineCreativeAssignment[]>();\n const matchedPackageIds = new Set<string>();\n for (const assignment of assignments ?? []) {\n const creative = creativesById.get(assignment.creative_id);\n if (!creative) {\n if (onMissingCreative === 'throw') {\n throw new Error(\n `inlineCreativesForPackages assignment references unknown creative_id \"${assignment.creative_id}\"`\n );\n }\n continue;\n }\n const existing = assignmentsByPackage.get(assignment.package_id);\n if (existing) {\n existing.push(assignment);\n } else {\n assignmentsByPackage.set(assignment.package_id, [assignment]);\n }\n }\n\n const result = packages.map((pkg, index) => {\n const id = packageId(pkg, index);\n if (id) matchedPackageIds.add(id);\n const assigned = id ? (assignmentsByPackage.get(id) ?? []) : [];\n const assignedCreativeIds = new Set(assigned.map(a => a.creative_id));\n const inlined: CreativeAsset[] = [];\n\n for (const assignment of assigned) {\n const creative = creativesById.get(assignment.creative_id);\n if (!creative) continue;\n const compatible = !filterByFormat || creativeMatchesPackage(pkg, creative);\n if (compatible) {\n inlined.push(applyAssignmentToCreative(creative, assignment));\n } else if (onIncompatibleAssignment === 'throw') {\n throw new Error(\n `inlineCreativesForPackages assignment creative_id \"${assignment.creative_id}\" ` +\n `does not match package_id \"${assignment.package_id}\" format selectors`\n );\n }\n }\n\n if (includeUnassignedCreatives) {\n for (const creative of creatives) {\n if (typeof creative.creative_id === 'string' && assignedCreativeIds.has(creative.creative_id)) continue;\n if (!filterByFormat || creativeMatchesPackage(pkg, creative)) {\n inlined.push({ ...creative });\n }\n }\n }\n\n const next: Record<string, unknown> = { ...(pkg as Record<string, unknown>) };\n delete next.creatives;\n if (inlined.length > 0) {\n next.creatives = inlined;\n }\n return next as InlineCreativePackagePatch<TPackage>;\n });\n\n if (onUnmatchedAssignment === 'throw') {\n const unmatched = [...assignmentsByPackage.keys()].filter(package_id => !matchedPackageIds.has(package_id));\n if (unmatched.length > 0) {\n throw new Error(`inlineCreativesForPackages assignment references unknown package_id \"${unmatched[0]}\"`);\n }\n }\n\n return result;\n}\n\nfunction defaultPackageId(pkg: InlineCreativePackage): string | undefined {\n if (typeof pkg.package_id === 'string') return pkg.package_id;\n if (typeof pkg.context?.buyer_ref === 'string') return pkg.context.buyer_ref;\n if (typeof pkg.buyer_ref === 'string') return pkg.buyer_ref;\n return undefined;\n}\n\nfunction applyAssignmentToCreative(creative: CreativeAsset, assignment: InlineCreativeAssignment): CreativeAsset {\n const next: Record<string, unknown> = { ...(creative as unknown as Record<string, unknown>) };\n delete next.weight;\n delete next.placement_ids;\n delete next.placement_refs;\n\n if (assignment.weight !== undefined) next.weight = assignment.weight;\n if (assignment.placement_refs !== undefined) {\n next.placement_refs = [...assignment.placement_refs];\n } else if (assignment.placement_ids !== undefined) {\n next.placement_ids = [...assignment.placement_ids];\n }\n return next as unknown as CreativeAsset;\n}\n\nfunction creativeMatchesPackage(pkg: InlineCreativePackage, creative: CreativeAsset): boolean {\n const packageFormatIds = arrayOfObjects(pkg.format_ids);\n const packageFormatOptionRefs = arrayOfObjects(pkg.format_option_refs);\n const packageFormatKind = typeof pkg.format_kind === 'string' ? pkg.format_kind : undefined;\n const packageParams = plainObject(pkg.params);\n\n const creativeRecord = creative as unknown as Record<string, unknown>;\n const creativeFormatId = plainObject(creativeRecord.format_id);\n const creativeFormatOptionRef = plainObject(creativeRecord.format_option_ref);\n\n if (packageFormatOptionRefs.length > 0) {\n if (creativeFormatOptionRef) {\n return packageFormatOptionRefs.some(formatOptionRef => deepEqual(formatOptionRef, creativeFormatOptionRef));\n }\n if (packageFormatIds.length === 0 && packageFormatKind === undefined) return false;\n }\n\n if (packageFormatKind !== undefined) {\n return creativeRecord.format_kind === packageFormatKind && paramsMatchCreative(packageParams, creativeFormatId);\n }\n\n if (packageFormatIds.length > 0) {\n return (\n creativeFormatId !== undefined && packageFormatIds.some(formatId => formatIdMatches(formatId, creativeFormatId))\n );\n }\n\n return true;\n}\n\nfunction arrayOfObjects(value: unknown): Record<string, unknown>[] {\n return Array.isArray(value) ? value.flatMap(item => (plainObject(item) ? [item] : [])) : [];\n}\n\nfunction plainObject(value: unknown): Record<string, unknown> | undefined {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nfunction formatIdMatches(expected: Record<string, unknown>, actual: Record<string, unknown>): boolean {\n const expectedId = expected.id;\n const actualId = actual.id;\n if (expectedId !== actualId) return false;\n\n const expectedAgentUrl = normalizeAgentUrl(expected.agent_url);\n const actualAgentUrl = normalizeAgentUrl(actual.agent_url);\n if (expectedAgentUrl !== undefined && actualAgentUrl !== undefined && expectedAgentUrl !== actualAgentUrl) {\n return false;\n }\n\n for (const key of ['width', 'height', 'duration_ms']) {\n if (expected[key] !== undefined && actual[key] !== undefined && expected[key] !== actual[key]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction paramsMatchCreative(\n packageParams: Record<string, unknown> | undefined,\n creativeFormatId: Record<string, unknown> | undefined\n): boolean {\n if (!packageParams) return true;\n\n let constrained = false;\n const actualWidth = numberValue(creativeFormatId, 'width');\n const actualHeight = numberValue(creativeFormatId, 'height');\n const actualDuration =\n numberValue(creativeFormatId, 'duration_ms') ?? numberValue(creativeFormatId, 'duration_ms_exact');\n\n const sizes = Array.isArray(packageParams.sizes)\n ? packageParams.sizes.flatMap(size => (plainObject(size) ? [size] : []))\n : [];\n if (sizes.length > 0) {\n constrained = true;\n if (\n actualWidth === undefined ||\n actualHeight === undefined ||\n !sizes.some(size => numberValue(size, 'width') === actualWidth && numberValue(size, 'height') === actualHeight)\n ) {\n return false;\n }\n }\n\n const expectedWidth = numberValue(packageParams, 'width');\n if (expectedWidth !== undefined) {\n constrained = true;\n if (actualWidth !== expectedWidth) return false;\n }\n\n const expectedHeight = numberValue(packageParams, 'height');\n if (expectedHeight !== undefined) {\n constrained = true;\n if (actualHeight !== expectedHeight) return false;\n }\n\n const minWidth = numberValue(packageParams, 'min_width');\n if (minWidth !== undefined) {\n constrained = true;\n if (actualWidth === undefined || actualWidth < minWidth) return false;\n }\n\n const maxWidth = numberValue(packageParams, 'max_width');\n if (maxWidth !== undefined) {\n constrained = true;\n if (actualWidth === undefined || actualWidth > maxWidth) return false;\n }\n\n const minHeight = numberValue(packageParams, 'min_height');\n if (minHeight !== undefined) {\n constrained = true;\n if (actualHeight === undefined || actualHeight < minHeight) return false;\n }\n\n const maxHeight = numberValue(packageParams, 'max_height');\n if (maxHeight !== undefined) {\n constrained = true;\n if (actualHeight === undefined || actualHeight > maxHeight) return false;\n }\n\n const exactDuration = numberValue(packageParams, 'duration_ms_exact') ?? numberValue(packageParams, 'duration_ms');\n if (exactDuration !== undefined) {\n constrained = true;\n if (actualDuration !== exactDuration) return false;\n }\n\n const durationRange = numberRange(packageParams.duration_ms_range);\n if (durationRange) {\n constrained = true;\n const [minDuration, maxDuration] = durationRange;\n if (actualDuration === undefined) return false;\n if (minDuration !== undefined && actualDuration < minDuration) return false;\n if (maxDuration !== undefined && actualDuration > maxDuration) return false;\n }\n\n return constrained ? creativeFormatId !== undefined : true;\n}\n\nfunction numberValue(object: Record<string, unknown> | undefined, key: string): number | undefined {\n const value = object?.[key];\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\nfunction numberRange(value: unknown): [number | undefined, number | undefined] | undefined {\n if (!Array.isArray(value) || value.length !== 2) return undefined;\n const [min, max] = value;\n const minValue = min === null ? undefined : typeof min === 'number' && Number.isFinite(min) ? min : undefined;\n const maxValue = max === null ? undefined : typeof max === 'number' && Number.isFinite(max) ? max : undefined;\n return minValue === undefined && maxValue === undefined ? undefined : [minValue, maxValue];\n}\n\nfunction normalizeAgentUrl(value: unknown): string | undefined {\n if (typeof value !== 'string') return undefined;\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === 47) {\n end -= 1;\n }\n return end === value.length ? value : value.slice(0, end);\n}\n\nfunction deepEqual(a: unknown, b: unknown): boolean {\n return JSON.stringify(sortKeys(a)) === JSON.stringify(sortKeys(b));\n}\n\nfunction sortKeys(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(sortKeys);\n const object = plainObject(value);\n if (!object) return value;\n return Object.fromEntries(\n Object.entries(object)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([k, v]) => [k, sortKeys(v)])\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6GO,SAAS,2BACd,UACA,WACA,UAAuD,CAAC,GAChB;AACxC,QAAM;AAAA,IACJ;AAAA,IACA,6BAA6B,eAAe,QAAQ,YAAY,WAAW;AAAA,IAC3E,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,wBAAwB;AAAA,IACxB,oBAAoB;AAAA,IACpB,2BAA2B;AAAA,EAC7B,IAAI;AAEJ,QAAM,gBAAgB,oBAAI,IAA2B;AACr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Aa,aAAa,SAAY,SAAY,CAAC,UAAU,QAAQ;AAC3F;AAEA,SAAS,kBAAkB,OAAoC;AAC7D,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI,MAAM,MAAM;AAChB,SAAO,MAAM,KAAK,MAAM,WAAW,MAAM,CAAC,MAAM,IAAI;AAClD,WAAO;AAAA,EACT;AACA,SAAO,QAAQ,MAAM,SAAS,QAAQ,MAAM,MAAM,GAAG,GAAG;AAC1D;AAEA,SAAS,UAAU,GAAY,GAAqB;AAClD,SAAO,KAAK,UAAU,SAAS,CAAC,CAAC,MAAM,KAAK,UAAU,SAAS,CAAC,CAAC;AACnE;AAEA,SAAS,SAAS,OAAyB;AACzC,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,QAAQ;AACnD,QAAM,SAAS,YAAY,KAAK;AAChC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,MAAM,EAClB,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,EACrC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;AAAA,EACrC;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/creative-delivery.ts"],"sourcesContent":["import type { CreativeAsset, PackageRequest } from '../types/tools.generated';\nimport {\n projectCreativeForDelivery,\n type CanonicalCreativeAsset,\n type CreativeFormatWireMode,\n type LegacyCreativeAsset,\n} from '../v2/projection/creative-delivery';\nimport type { LegacyFormatConverter } from '../v2/projection/v1-to-v2';\nimport type { CanonicalFormatLegacyResolver } from '../v2/projection/v2-to-v1';\nimport { resolveCanonicalFormatKind } from '../v2/projection/v1-to-v2';\n\n/**\n * Package-like input accepted by `inlineCreativesForPackages`.\n *\n * `PackageRequest` is the create-media-buy shape. Update-media-buy package\n * patches are narrower but carry the same `package_id` + `creatives` fields,\n * so the helper accepts both without depending on AgentClient.\n */\nexport type InlineCreativePackage = {\n package_id?: string;\n buyer_ref?: string;\n context?: NonNullable<PackageRequest['context']> & { buyer_ref?: string };\n creatives?: CanonicalCreativeAsset[];\n format_ids?: never;\n format_option_refs?: PackageRequest['format_option_refs'];\n format_kind?: PackageRequest['format_kind'];\n params?: PackageRequest['params'];\n};\n\n/**\n * Compatibility-only package shape accepted by\n * `inlineCreativesForPackagesLegacy`.\n *\n * @deprecated Legacy `format_ids` belong at an explicit compatibility\n * boundary. Prefer `InlineCreativePackage` and canonical format selectors.\n */\nexport type LegacyInlineCreativePackage = Omit<InlineCreativePackage, 'creatives' | 'format_ids'> & {\n creatives?: CreativeAsset[];\n format_ids?: PackageRequest['format_ids'];\n};\n\n/**\n * Assignment shape shared with `sync_creatives.assignments[]`, plus\n * `placement_refs` for callers already authoring the structured placement\n * form accepted by inline `CreativeAsset`.\n */\nexport interface InlineCreativeAssignment {\n creative_id: string;\n package_id: string;\n weight?: number;\n placement_ids?: string[];\n placement_refs?: unknown[];\n}\n\ninterface InlineCreativesForPackagesBaseOptions<TPackage> {\n /**\n * Package-scoped assignment instructions. When supplied, only creatives\n * assigned to each package are inlined unless `includeUnassignedCreatives`\n * is true.\n */\n assignments?: ReadonlyArray<InlineCreativeAssignment>;\n\n /**\n * Include compatible creatives that have no assignment entry. Defaults to\n * false when assignments are supplied and true when no assignments exist.\n */\n includeUnassignedCreatives?: boolean;\n\n /**\n * Filter creatives by package format selectors (`format_option_refs` or\n * `format_kind`). The legacy helper also recognizes `format_ids`. Defaults\n * to true.\n */\n filterByFormat?: boolean;\n\n /**\n * Resolve the package identifier used to match assignment.package_id.\n * Defaults to `package_id`, then `context.buyer_ref`, then `buyer_ref`.\n */\n packageId?: (pkg: TPackage, index: number) => string | undefined;\n\n /**\n * Behavior when an assignment names a package not present in the package\n * list. Defaults to throw so package scoping mistakes do not broaden\n * delivery silently.\n */\n onUnmatchedAssignment?: 'throw' | 'ignore';\n\n /**\n * Behavior when an assignment names a creative not present in `creatives`.\n * Defaults to throw because inline payloads cannot reference library-only\n * creatives.\n */\n onMissingCreative?: 'throw' | 'ignore';\n\n /**\n * Behavior when an explicit assignment names a creative whose format cannot\n * satisfy the target package selectors. Defaults to throw so authoring\n * mistakes do not silently remove assigned delivery.\n */\n onIncompatibleAssignment?: 'throw' | 'ignore';\n}\n\nexport interface InlineCreativesForPackagesOptions<\n TPackage extends InlineCreativePackage = InlineCreativePackage,\n> extends InlineCreativesForPackagesBaseOptions<TPackage> {}\n\n/**\n * Options for the explicit legacy inline-creative compatibility helper.\n *\n * @deprecated Prefer canonical selectors and `inlineCreativesForPackages`.\n */\nexport interface InlineCreativesForPackagesLegacyOptions<\n TPackage extends LegacyInlineCreativePackage = LegacyInlineCreativePackage,\n> extends InlineCreativesForPackagesBaseOptions<TPackage> {\n /** Fail closed when the seller's legacy wire shape is not known. */\n creativeFormatWireMode?: 'legacy' | 'unknown';\n\n /** Convert custom legacy creative refs before matching/projecting. */\n legacyFormatConverter?: LegacyFormatConverter;\n\n /** Resolve canonical custom formats when no built-in or private legacy mapping exists. */\n canonicalFormatLegacyResolver?: CanonicalFormatLegacyResolver;\n}\n\nexport type InlineCreativePackagePatch<\n TPackage extends InlineCreativePackage | LegacyInlineCreativePackage = InlineCreativePackage,\n TCreative = CanonicalCreativeAsset,\n> = Omit<TPackage, 'creatives'> & {\n creatives?: TCreative[];\n};\n\n/**\n * Project library-scoped creative assets into package-scoped inline creative\n * payloads for `create_media_buy` or `update_media_buy`.\n *\n * The helper is pure: it performs no network calls, does not call\n * `sync_creatives`, and does not generate idempotency keys. Use\n * `supportsSyncCreatives(caps)` to decide whether the seller has a creative\n * library. When it does not, spread this helper's result into\n * `packages[].creatives` and use a fresh idempotency key for the enclosing\n * create/update media-buy call.\n *\n * @example\n * ```ts\n * const caps = await agent.getCapabilities();\n * if (supportsSyncCreatives(caps)) {\n * await agent.syncCreatives({ account, creatives, assignments });\n * } else if (caps.features.inlineCreativeManagement) {\n * await agent.createMediaBuy({\n * account,\n * idempotency_key: crypto.randomUUID(),\n * packages: inlineCreativesForPackages(packages, creatives, { assignments }),\n * });\n * } else {\n * throw new Error('Seller supports neither creative library sync nor inline creative uploads.');\n * }\n * ```\n */\nexport function inlineCreativesForPackages<TPackage extends InlineCreativePackage>(\n packages: ReadonlyArray<TPackage>,\n creatives: ReadonlyArray<CanonicalCreativeAsset>,\n options: InlineCreativesForPackagesOptions<TPackage> = {}\n): InlineCreativePackagePatch<TPackage, CanonicalCreativeAsset>[] {\n assertCanonicalInlineInputs(packages, creatives, options);\n return inlineCreativesForPackagesInternal(packages, creatives, options, 'canonical') as InlineCreativePackagePatch<\n TPackage,\n CanonicalCreativeAsset\n >[];\n}\n\n/**\n * Project creatives into the legacy inline package wire shape.\n *\n * @deprecated This is an explicit compatibility escape hatch for legacy\n * sellers. New integrations should use canonical package selectors with\n * `inlineCreativesForPackages`; the SDK client performs negotiated wire\n * projection at the transport boundary.\n */\nexport function inlineCreativesForPackagesLegacy<TPackage extends LegacyInlineCreativePackage>(\n packages: ReadonlyArray<TPackage>,\n creatives: ReadonlyArray<CreativeAsset>,\n options: InlineCreativesForPackagesLegacyOptions<TPackage> = {}\n): InlineCreativePackagePatch<TPackage, LegacyCreativeAsset>[] {\n const { creativeFormatWireMode = 'legacy', ...sharedOptions } = options;\n return inlineCreativesForPackagesInternal(\n packages,\n creatives,\n {\n ...sharedOptions,\n legacyFormatConverter: options.legacyFormatConverter,\n canonicalFormatLegacyResolver: options.canonicalFormatLegacyResolver,\n },\n creativeFormatWireMode\n ) as InlineCreativePackagePatch<TPackage, LegacyCreativeAsset>[];\n}\n\ntype InternalInlineCreativesOptions<TPackage extends LegacyInlineCreativePackage> =\n InlineCreativesForPackagesBaseOptions<TPackage> & {\n legacyFormatConverter?: LegacyFormatConverter;\n canonicalFormatLegacyResolver?: CanonicalFormatLegacyResolver;\n };\n\nfunction inlineCreativesForPackagesInternal<TPackage extends LegacyInlineCreativePackage>(\n packages: ReadonlyArray<TPackage>,\n creatives: ReadonlyArray<CreativeAsset>,\n options: InternalInlineCreativesOptions<TPackage>,\n creativeFormatWireMode: CreativeFormatWireMode\n): InlineCreativePackagePatch<TPackage, CreativeAsset>[] {\n const {\n assignments,\n includeUnassignedCreatives = assignments == null || assignments.length === 0,\n filterByFormat = true,\n packageId = defaultPackageId,\n onUnmatchedAssignment = 'throw',\n onMissingCreative = 'throw',\n onIncompatibleAssignment = 'throw',\n legacyFormatConverter,\n canonicalFormatLegacyResolver,\n } = options;\n\n const creativesById = new Map<string, CreativeAsset>();\n for (const creative of creatives) {\n if (typeof creative.creative_id === 'string') {\n creativesById.set(creative.creative_id, creative);\n }\n }\n\n const assignmentsByPackage = new Map<string, InlineCreativeAssignment[]>();\n const matchedPackageIds = new Set<string>();\n for (const assignment of assignments ?? []) {\n const creative = creativesById.get(assignment.creative_id);\n if (!creative) {\n if (onMissingCreative === 'throw') {\n throw new Error(\n `inlineCreativesForPackages assignment references unknown creative_id \"${assignment.creative_id}\"`\n );\n }\n continue;\n }\n const existing = assignmentsByPackage.get(assignment.package_id);\n if (existing) {\n existing.push(assignment);\n } else {\n assignmentsByPackage.set(assignment.package_id, [assignment]);\n }\n }\n\n const result = packages.map((pkg, index) => {\n const id = packageId(pkg, index);\n if (id) matchedPackageIds.add(id);\n const assigned = id ? (assignmentsByPackage.get(id) ?? []) : [];\n const assignedCreativeIds = new Set(assigned.map(a => a.creative_id));\n const inlined: CreativeAsset[] = [];\n\n for (const assignment of assigned) {\n const creative = creativesById.get(assignment.creative_id);\n if (!creative) continue;\n const sourceCompatible = !filterByFormat || creativeMatchesPackage(pkg, creative);\n if (!sourceCompatible) {\n if (onIncompatibleAssignment === 'throw') {\n throw new Error(\n `inlineCreativesForPackages assignment creative_id \"${assignment.creative_id}\" ` +\n `does not match package_id \"${assignment.package_id}\" format selectors`\n );\n }\n continue;\n }\n const projected = projectCreativeForDelivery(\n creative,\n pkg,\n creativeFormatWireMode,\n 'inline_creatives',\n legacyFormatConverter,\n canonicalFormatLegacyResolver\n );\n const compatible = !filterByFormat || creativeMatchesPackage(pkg, projected);\n if (compatible) {\n inlined.push(applyAssignmentToCreative(projected, assignment));\n } else if (onIncompatibleAssignment === 'throw') {\n throw new Error(\n `inlineCreativesForPackages assignment creative_id \"${assignment.creative_id}\" ` +\n `does not match package_id \"${assignment.package_id}\" format selectors`\n );\n }\n }\n\n if (includeUnassignedCreatives) {\n for (const creative of creatives) {\n if (typeof creative.creative_id === 'string' && assignedCreativeIds.has(creative.creative_id)) continue;\n if (filterByFormat && !creativeMatchesPackage(pkg, creative)) continue;\n const projected = projectCreativeForDelivery(\n creative,\n pkg,\n creativeFormatWireMode,\n 'inline_creatives',\n legacyFormatConverter,\n canonicalFormatLegacyResolver\n );\n if (!filterByFormat || creativeMatchesPackage(pkg, projected)) {\n inlined.push({ ...projected });\n }\n }\n }\n\n const next: Record<string, unknown> = { ...(pkg as Record<string, unknown>) };\n delete next.creatives;\n if (inlined.length > 0) {\n next.creatives = inlined;\n }\n return next as InlineCreativePackagePatch<TPackage, CreativeAsset>;\n });\n\n if (onUnmatchedAssignment === 'throw') {\n const unmatched = [...assignmentsByPackage.keys()].filter(package_id => !matchedPackageIds.has(package_id));\n if (unmatched.length > 0) {\n throw new Error(`inlineCreativesForPackages assignment references unknown package_id \"${unmatched[0]}\"`);\n }\n }\n\n return result;\n}\n\nfunction assertCanonicalInlineInputs(\n packages: ReadonlyArray<InlineCreativePackage>,\n creatives: ReadonlyArray<CanonicalCreativeAsset>,\n options: object\n): void {\n const unsafeOptions = options as Record<string, unknown>;\n if (\n 'creativeFormatWireMode' in unsafeOptions ||\n 'legacyFormatConverter' in unsafeOptions ||\n 'canonicalFormatLegacyResolver' in unsafeOptions\n ) {\n throw new Error(\n 'inlineCreativesForPackages is canonical-only; use inlineCreativesForPackagesLegacy for legacy wire projection'\n );\n }\n\n for (const pkg of packages) {\n if ('format_ids' in (pkg as object)) {\n throw new Error(\n 'inlineCreativesForPackages does not accept legacy package format_ids; use canonical format selectors or inlineCreativesForPackagesLegacy'\n );\n }\n }\n\n for (const creative of creatives) {\n if ('format_id' in (creative as object)) {\n throw new Error(\n 'inlineCreativesForPackages does not accept legacy creative format_id; use canonical format_kind or inlineCreativesForPackagesLegacy'\n );\n }\n }\n}\n\nfunction defaultPackageId(pkg: LegacyInlineCreativePackage): string | undefined {\n if (typeof pkg.package_id === 'string') return pkg.package_id;\n if (typeof pkg.context?.buyer_ref === 'string') return pkg.context.buyer_ref;\n if (typeof pkg.buyer_ref === 'string') return pkg.buyer_ref;\n return undefined;\n}\n\nfunction applyAssignmentToCreative(creative: CreativeAsset, assignment: InlineCreativeAssignment): CreativeAsset {\n const next: Record<string, unknown> = { ...(creative as unknown as Record<string, unknown>) };\n delete next.weight;\n delete next.placement_ids;\n delete next.placement_refs;\n\n if (assignment.weight !== undefined) next.weight = assignment.weight;\n if (assignment.placement_refs !== undefined) {\n next.placement_refs = [...assignment.placement_refs];\n } else if (assignment.placement_ids !== undefined) {\n next.placement_ids = [...assignment.placement_ids];\n }\n return next as unknown as CreativeAsset;\n}\n\nfunction creativeMatchesPackage(pkg: LegacyInlineCreativePackage, creative: CreativeAsset): boolean {\n const packageFormatIds = arrayOfObjects(pkg.format_ids);\n const packageFormatOptionRefs = arrayOfObjects(pkg.format_option_refs);\n const packageFormatKind = typeof pkg.format_kind === 'string' ? pkg.format_kind : undefined;\n const packageParams = plainObject(pkg.params);\n\n const creativeRecord = creative as unknown as Record<string, unknown>;\n const creativeFormatId = plainObject(creativeRecord.format_id);\n const creativeFormatOptionRef = plainObject(creativeRecord.format_option_ref);\n\n if (packageFormatOptionRefs.length > 0) {\n if (creativeFormatOptionRef) {\n return packageFormatOptionRefs.some(formatOptionRef => deepEqual(formatOptionRef, creativeFormatOptionRef));\n }\n if (packageFormatIds.length === 0 && packageFormatKind === undefined) return false;\n }\n\n if (packageFormatKind !== undefined) {\n return (\n creativeRecord.format_kind === packageFormatKind &&\n paramsMatchCreative(packageParams, creativeFormatId ?? creativeParamsFromAssets(creativeRecord.assets))\n );\n }\n\n if (packageFormatIds.length > 0) {\n if (creativeFormatId !== undefined) {\n return packageFormatIds.some(formatId => formatIdMatches(formatId, creativeFormatId));\n }\n return packageFormatIds.some(\n formatId =>\n typeof formatId.id === 'string' &&\n resolveCanonicalFormatKind(formatId.id, {\n agentUrl: typeof formatId.agent_url === 'string' ? formatId.agent_url : undefined,\n }) === creativeRecord.format_kind\n );\n }\n\n return true;\n}\n\nfunction creativeParamsFromAssets(value: unknown): Record<string, unknown> | undefined {\n const assets = plainObject(value);\n if (!assets) return undefined;\n for (const assetValue of Object.values(assets)) {\n const candidates = Array.isArray(assetValue) ? assetValue : [assetValue];\n for (const candidate of candidates) {\n const asset = plainObject(candidate);\n if (!asset) continue;\n const params: Record<string, unknown> = {};\n if (typeof asset.width === 'number') params.width = asset.width;\n if (typeof asset.height === 'number') params.height = asset.height;\n if (typeof asset.duration_ms === 'number') params.duration_ms = asset.duration_ms;\n if (Object.keys(params).length > 0) return params;\n }\n }\n return undefined;\n}\n\nfunction arrayOfObjects(value: unknown): Record<string, unknown>[] {\n return Array.isArray(value) ? value.flatMap(item => (plainObject(item) ? [item] : [])) : [];\n}\n\nfunction plainObject(value: unknown): Record<string, unknown> | undefined {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nfunction formatIdMatches(expected: Record<string, unknown>, actual: Record<string, unknown>): boolean {\n const expectedId = expected.id;\n const actualId = actual.id;\n if (expectedId !== actualId) return false;\n\n const expectedAgentUrl = normalizeAgentUrl(expected.agent_url);\n const actualAgentUrl = normalizeAgentUrl(actual.agent_url);\n if (expectedAgentUrl !== undefined && actualAgentUrl !== undefined && expectedAgentUrl !== actualAgentUrl) {\n return false;\n }\n\n for (const key of ['width', 'height', 'duration_ms']) {\n if (expected[key] !== undefined && actual[key] !== undefined && expected[key] !== actual[key]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction paramsMatchCreative(\n packageParams: Record<string, unknown> | undefined,\n creativeFormatId: Record<string, unknown> | undefined\n): boolean {\n if (!packageParams) return true;\n\n let constrained = false;\n const actualWidth = numberValue(creativeFormatId, 'width');\n const actualHeight = numberValue(creativeFormatId, 'height');\n const actualDuration =\n numberValue(creativeFormatId, 'duration_ms') ?? numberValue(creativeFormatId, 'duration_ms_exact');\n\n const sizes = Array.isArray(packageParams.sizes)\n ? packageParams.sizes.flatMap(size => (plainObject(size) ? [size] : []))\n : [];\n if (sizes.length > 0) {\n constrained = true;\n if (\n actualWidth === undefined ||\n actualHeight === undefined ||\n !sizes.some(size => numberValue(size, 'width') === actualWidth && numberValue(size, 'height') === actualHeight)\n ) {\n return false;\n }\n }\n\n const expectedWidth = numberValue(packageParams, 'width');\n if (expectedWidth !== undefined) {\n constrained = true;\n if (actualWidth !== expectedWidth) return false;\n }\n\n const expectedHeight = numberValue(packageParams, 'height');\n if (expectedHeight !== undefined) {\n constrained = true;\n if (actualHeight !== expectedHeight) return false;\n }\n\n const minWidth = numberValue(packageParams, 'min_width');\n if (minWidth !== undefined) {\n constrained = true;\n if (actualWidth === undefined || actualWidth < minWidth) return false;\n }\n\n const maxWidth = numberValue(packageParams, 'max_width');\n if (maxWidth !== undefined) {\n constrained = true;\n if (actualWidth === undefined || actualWidth > maxWidth) return false;\n }\n\n const minHeight = numberValue(packageParams, 'min_height');\n if (minHeight !== undefined) {\n constrained = true;\n if (actualHeight === undefined || actualHeight < minHeight) return false;\n }\n\n const maxHeight = numberValue(packageParams, 'max_height');\n if (maxHeight !== undefined) {\n constrained = true;\n if (actualHeight === undefined || actualHeight > maxHeight) return false;\n }\n\n const exactDuration = numberValue(packageParams, 'duration_ms_exact') ?? numberValue(packageParams, 'duration_ms');\n if (exactDuration !== undefined) {\n constrained = true;\n if (actualDuration !== exactDuration) return false;\n }\n\n const durationRange = numberRange(packageParams.duration_ms_range);\n if (durationRange) {\n constrained = true;\n const [minDuration, maxDuration] = durationRange;\n if (actualDuration === undefined) return false;\n if (minDuration !== undefined && actualDuration < minDuration) return false;\n if (maxDuration !== undefined && actualDuration > maxDuration) return false;\n }\n\n return constrained ? creativeFormatId !== undefined : true;\n}\n\nfunction numberValue(object: Record<string, unknown> | undefined, key: string): number | undefined {\n const value = object?.[key];\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\nfunction numberRange(value: unknown): [number | undefined, number | undefined] | undefined {\n if (!Array.isArray(value) || value.length !== 2) return undefined;\n const [min, max] = value;\n const minValue = min === null ? undefined : typeof min === 'number' && Number.isFinite(min) ? min : undefined;\n const maxValue = max === null ? undefined : typeof max === 'number' && Number.isFinite(max) ? max : undefined;\n return minValue === undefined && maxValue === undefined ? undefined : [minValue, maxValue];\n}\n\nfunction normalizeAgentUrl(value: unknown): string | undefined {\n if (typeof value !== 'string') return undefined;\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === 47) {\n end -= 1;\n }\n return end === value.length ? value : value.slice(0, end);\n}\n\nfunction deepEqual(a: unknown, b: unknown): boolean {\n return JSON.stringify(sortKeys(a)) === JSON.stringify(sortKeys(b));\n}\n\nfunction sortKeys(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(sortKeys);\n const object = plainObject(value);\n if (!object) return value;\n return Object.fromEntries(\n Object.entries(object)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([k, v]) => [k, sortKeys(v)])\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,+BAKO;AAGP,sBAA2C;AAsJpC,SAAS,2BACd,UACA,WACA,UAAuD,CAAC,GACQ;AAChE,8BAA4B,UAAU,WAAW,OAAO;AACxD,SAAO,mCAAmC,UAAU,WAAW,SAAS,WAAW;AAIrF;AAUO,SAAS,iCACd,UACA,WACA,UAA6D,CAAC,GACD;AAC7D,QAAM,EAAE,yBAAyB,UAAU,GAAG,cAAc,IAAI;AAChE,SAAO;AAAA,IACL;AAAA,IACA;A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