@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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/utils/format-assets.ts"],"sourcesContent":["// Format Asset Utilities\n// Provides access to
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/format-assets.ts"],"sourcesContent":["// Format Asset Utilities\n// Provides access to asset-slot declarations without requiring a raw\n// list_creative_formats `Format` or its legacy format identity.\n\nimport type {\n IndividualAudioAsset,\n IndividualBriefAsset,\n IndividualCatalogAsset,\n IndividualCssAsset,\n IndividualDaastAsset,\n IndividualHtmlAsset,\n IndividualImageAsset,\n IndividualJavaScriptAsset,\n IndividualMarkdownAsset,\n IndividualTextAsset,\n IndividualUrlAsset,\n IndividualVastAsset,\n IndividualVideoAsset,\n IndividualWebhookAsset,\n RepeatableGroupAsset,\n} from '../types/tools.generated';\n\n/** Canonical structural union for the slots declared in an `assets` array. */\nexport type CanonicalFormatAssetSlot =\n | IndividualAudioAsset\n | IndividualBriefAsset\n | IndividualCatalogAsset\n | IndividualCssAsset\n | IndividualDaastAsset\n | IndividualHtmlAsset\n | IndividualImageAsset\n | IndividualJavaScriptAsset\n | IndividualMarkdownAsset\n | IndividualTextAsset\n | IndividualUrlAsset\n | IndividualVastAsset\n | IndividualVideoAsset\n | IndividualWebhookAsset\n | RepeatableGroupAsset;\n\nexport type IndividualFormatAssetSlot = Exclude<CanonicalFormatAssetSlot, RepeatableGroupAsset>;\nexport type RepeatableFormatAssetGroup = RepeatableGroupAsset;\n\n/**\n * Minimal structural input for asset inspection. It deliberately has no\n * `format_id`, `agent_url`, name, or other legacy catalog identity.\n */\nexport interface FormatAssetsInput {\n assets?: CanonicalFormatAssetSlot[];\n /** Deprecated v2 compatibility field; values are normalized as required slots. */\n assets_required?: unknown[];\n}\n\n// Legacy support: v2 responses may still include assets_required (deprecated in v3)\n// This internal type allows runtime backward compatibility without exposing it in public API\ntype LegacyFormatAssetsInput = FormatAssetsInput;\n\n/**\n * Get asset slots from any structural asset container.\n *\n * Returns the assets from the v3 `assets` field. For backward compatibility with v2 servers,\n * this function also handles the deprecated `assets_required` field if present.\n *\n * @param format - An object containing canonical `assets` slots\n * @returns Array of assets\n *\n * @example\n * ```typescript\n * const assets = getFormatAssets({\n * assets: [FormatAsset.image({ asset_id: 'hero', required: true })]\n * });\n * ```\n */\nexport function getFormatAssets(format: FormatAssetsInput): CanonicalFormatAssetSlot[] {\n // Use v3 `assets` field\n if (format.assets && format.assets.length > 0) {\n return format.assets;\n }\n\n // Runtime backward compatibility: handle v2 responses with deprecated assets_required\n const legacyFormat = format as LegacyFormatAssetsInput;\n if (\n legacyFormat.assets_required &&\n Array.isArray(legacyFormat.assets_required) &&\n legacyFormat.assets_required.length > 0\n ) {\n return normalizeAssetsRequired(legacyFormat.assets_required);\n }\n\n return [];\n}\n\n/**\n * Convert deprecated assets_required to new assets format (internal use)\n *\n * All assets in assets_required are required by definition (that's why they were in that array).\n * The new `assets` field has an explicit `required: boolean` to allow both required AND optional assets.\n *\n * @param assetsRequired - The deprecated assets_required array\n * @returns Normalized assets array with explicit required: true\n * @internal\n */\nfunction normalizeAssetsRequired(assetsRequired: unknown[]): CanonicalFormatAssetSlot[] {\n return assetsRequired.map(asset => ({\n ...(asset as Record<string, unknown>),\n required: true, // assets_required only contained required assets\n })) as CanonicalFormatAssetSlot[];\n}\n\n/**\n * Get only required slots from an asset container.\n *\n * @param format - A structural asset container\n * @returns Array of required assets only\n *\n * @example\n * ```typescript\n * const requiredAssets = getRequiredAssets(format);\n * console.log(`Must provide ${requiredAssets.length} assets`);\n * ```\n */\nexport function getRequiredAssets(format: FormatAssetsInput): CanonicalFormatAssetSlot[] {\n return getFormatAssets(format).filter(asset => asset.required);\n}\n\n/**\n * Get only optional slots from an asset container.\n *\n * Note: When using deprecated `assets_required`, this will always return empty\n * since assets_required only contained required assets.\n *\n * @param format - A structural asset container\n * @returns Array of optional assets only\n *\n * @example\n * ```typescript\n * const optionalAssets = getOptionalAssets(format);\n * console.log(`Can optionally provide ${optionalAssets.length} additional assets`);\n * ```\n */\nexport function getOptionalAssets(format: FormatAssetsInput): CanonicalFormatAssetSlot[] {\n return getFormatAssets(format).filter(asset => !asset.required);\n}\n\n/**\n * Get individual slots (not repeatable groups) from an asset container.\n *\n * @param format - A structural asset container\n * @returns Array of individual assets\n */\nexport function getIndividualAssets(format: FormatAssetsInput): IndividualFormatAssetSlot[] {\n return getFormatAssets(format).filter(\n (asset): asset is IndividualFormatAssetSlot => asset.item_type === 'individual'\n );\n}\n\n/**\n * Get repeatable asset groups from an asset container.\n *\n * @param format - A structural asset container\n * @returns Array of repeatable asset groups\n */\nexport function getRepeatableGroups(format: FormatAssetsInput): RepeatableFormatAssetGroup[] {\n return getFormatAssets(format).filter(\n (asset): asset is RepeatableFormatAssetGroup => asset.item_type === 'repeatable_group'\n );\n}\n\n/**\n * Check if format uses deprecated assets_required field (for migration warnings)\n *\n * @param format - A structural asset container\n * @returns true if using deprecated field, false if using new field or neither\n *\n * @example\n * ```typescript\n * if (usesDeprecatedAssetsField(format)) {\n * console.warn('Asset container uses deprecated assets_required field');\n * }\n * ```\n */\nexport function usesDeprecatedAssetsField(format: FormatAssetsInput): boolean {\n const legacyFormat = format as LegacyFormatAssetsInput;\n return !format.assets && !!(legacyFormat.assets_required && Array.isArray(legacyFormat.assets_required));\n}\n\n/**\n * Get the count of slots in an asset container.\n *\n * @param format - A structural asset container\n * @returns Number of assets, or 0 if none defined\n */\nexport function getAssetCount(format: FormatAssetsInput): number {\n return getFormatAssets(format).length;\n}\n\n/**\n * Check if an asset container has any slots defined.\n *\n * @param format - A structural asset container\n * @returns true if format has assets, false otherwise\n */\nexport function hasAssets(format: FormatAssetsInput): boolean {\n return getAssetCount(format) > 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyEO,SAAS,gBAAgB,QAAuD;AAErF,MAAI,OAAO,UAAU,OAAO,OAAO,SAAS,GAAG;AAC7C,WAAO,OAAO;AAAA,EAChB;AAGA,QAAM,eAAe;AACrB,MACE,aAAa,mBACb,MAAM,QAAQ,aAAa,eAAe,KAC1C,aAAa,gBAAgB,SAAS,GACtC;AACA,WAAO,wBAAwB,aAAa,eAAe;AAAA,EAC7D;AAEA,SAAO,CAAC;AACV;AAYA,SAAS,wBAAwB,gBAAuD;AACtF,SAAO,eAAe,IAAI,YAAU;AAAA,IAClC,GAAI;AAAA,IACJ,UAAU;AAAA;AAAA,EACZ,EAAE;AACJ;AAcO,SAAS,kBAAkB,QAAuD;AACvF,SAAO,gBAAgB,MAAM,EAAE,OAAO,WAAS,MAAM,QAAQ;AAC/D;AAiBO,SAAS,kBAAkB,QAAuD;AACvF,SAAO,gBAAgB,MAAM,EAAE,OAAO,WAAS,CAAC,MAAM,QAAQ;AAChE;AAQO,SAAS,oBAAoB,QAAwD;AAC1F,SAAO,gBAAgB,MAAM,EAAE;AAAA,IAC7B,CAAC,UAA8C,MAAM,cAAc;AAAA,EACrE;AACF;AAQO,SAAS,oBAAoB,QAAyD;AAC3F,SAAO,gBAAgB,MAAM,EAAE;AAAA,IAC7B,CAAC,UAA+C,MAAM,cAAc;AAAA,EACtE;AACF;AAeO,SAAS,0BAA0B,QAAoC;AAC5E,QAAM,eAAe;AACrB,SAAO,CAAC,OAAO,UAAU,CAAC,EAAE,aAAa,mBAAmB,MAAM,QAAQ,aAAa,eAAe;AACxG;AAQO,SAAS,cAAc,QAAmC;AAC/D,SAAO,gBAAgB,MAAM,EAAE;AACjC;AAQO,SAAS,UAAU,QAAoC;AAC5D,SAAO,cAAc,MAAM,IAAI;AACjC;","names":[]}
|
|
@@ -22,7 +22,9 @@ function getOptionalAssets(format) {
|
|
|
22
22
|
return getFormatAssets(format).filter((asset) => !asset.required);
|
|
23
23
|
}
|
|
24
24
|
function getIndividualAssets(format) {
|
|
25
|
-
return getFormatAssets(format).filter(
|
|
25
|
+
return getFormatAssets(format).filter(
|
|
26
|
+
(asset) => asset.item_type === "individual"
|
|
27
|
+
);
|
|
26
28
|
}
|
|
27
29
|
function getRepeatableGroups(format) {
|
|
28
30
|
return getFormatAssets(format).filter(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/utils/format-assets.ts"],"sourcesContent":["// Format Asset Utilities\n// Provides access to
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/format-assets.ts"],"sourcesContent":["// Format Asset Utilities\n// Provides access to asset-slot declarations without requiring a raw\n// list_creative_formats `Format` or its legacy format identity.\n\nimport type {\n IndividualAudioAsset,\n IndividualBriefAsset,\n IndividualCatalogAsset,\n IndividualCssAsset,\n IndividualDaastAsset,\n IndividualHtmlAsset,\n IndividualImageAsset,\n IndividualJavaScriptAsset,\n IndividualMarkdownAsset,\n IndividualTextAsset,\n IndividualUrlAsset,\n IndividualVastAsset,\n IndividualVideoAsset,\n IndividualWebhookAsset,\n RepeatableGroupAsset,\n} from '../types/tools.generated';\n\n/** Canonical structural union for the slots declared in an `assets` array. */\nexport type CanonicalFormatAssetSlot =\n | IndividualAudioAsset\n | IndividualBriefAsset\n | IndividualCatalogAsset\n | IndividualCssAsset\n | IndividualDaastAsset\n | IndividualHtmlAsset\n | IndividualImageAsset\n | IndividualJavaScriptAsset\n | IndividualMarkdownAsset\n | IndividualTextAsset\n | IndividualUrlAsset\n | IndividualVastAsset\n | IndividualVideoAsset\n | IndividualWebhookAsset\n | RepeatableGroupAsset;\n\nexport type IndividualFormatAssetSlot = Exclude<CanonicalFormatAssetSlot, RepeatableGroupAsset>;\nexport type RepeatableFormatAssetGroup = RepeatableGroupAsset;\n\n/**\n * Minimal structural input for asset inspection. It deliberately has no\n * `format_id`, `agent_url`, name, or other legacy catalog identity.\n */\nexport interface FormatAssetsInput {\n assets?: CanonicalFormatAssetSlot[];\n /** Deprecated v2 compatibility field; values are normalized as required slots. */\n assets_required?: unknown[];\n}\n\n// Legacy support: v2 responses may still include assets_required (deprecated in v3)\n// This internal type allows runtime backward compatibility without exposing it in public API\ntype LegacyFormatAssetsInput = FormatAssetsInput;\n\n/**\n * Get asset slots from any structural asset container.\n *\n * Returns the assets from the v3 `assets` field. For backward compatibility with v2 servers,\n * this function also handles the deprecated `assets_required` field if present.\n *\n * @param format - An object containing canonical `assets` slots\n * @returns Array of assets\n *\n * @example\n * ```typescript\n * const assets = getFormatAssets({\n * assets: [FormatAsset.image({ asset_id: 'hero', required: true })]\n * });\n * ```\n */\nexport function getFormatAssets(format: FormatAssetsInput): CanonicalFormatAssetSlot[] {\n // Use v3 `assets` field\n if (format.assets && format.assets.length > 0) {\n return format.assets;\n }\n\n // Runtime backward compatibility: handle v2 responses with deprecated assets_required\n const legacyFormat = format as LegacyFormatAssetsInput;\n if (\n legacyFormat.assets_required &&\n Array.isArray(legacyFormat.assets_required) &&\n legacyFormat.assets_required.length > 0\n ) {\n return normalizeAssetsRequired(legacyFormat.assets_required);\n }\n\n return [];\n}\n\n/**\n * Convert deprecated assets_required to new assets format (internal use)\n *\n * All assets in assets_required are required by definition (that's why they were in that array).\n * The new `assets` field has an explicit `required: boolean` to allow both required AND optional assets.\n *\n * @param assetsRequired - The deprecated assets_required array\n * @returns Normalized assets array with explicit required: true\n * @internal\n */\nfunction normalizeAssetsRequired(assetsRequired: unknown[]): CanonicalFormatAssetSlot[] {\n return assetsRequired.map(asset => ({\n ...(asset as Record<string, unknown>),\n required: true, // assets_required only contained required assets\n })) as CanonicalFormatAssetSlot[];\n}\n\n/**\n * Get only required slots from an asset container.\n *\n * @param format - A structural asset container\n * @returns Array of required assets only\n *\n * @example\n * ```typescript\n * const requiredAssets = getRequiredAssets(format);\n * console.log(`Must provide ${requiredAssets.length} assets`);\n * ```\n */\nexport function getRequiredAssets(format: FormatAssetsInput): CanonicalFormatAssetSlot[] {\n return getFormatAssets(format).filter(asset => asset.required);\n}\n\n/**\n * Get only optional slots from an asset container.\n *\n * Note: When using deprecated `assets_required`, this will always return empty\n * since assets_required only contained required assets.\n *\n * @param format - A structural asset container\n * @returns Array of optional assets only\n *\n * @example\n * ```typescript\n * const optionalAssets = getOptionalAssets(format);\n * console.log(`Can optionally provide ${optionalAssets.length} additional assets`);\n * ```\n */\nexport function getOptionalAssets(format: FormatAssetsInput): CanonicalFormatAssetSlot[] {\n return getFormatAssets(format).filter(asset => !asset.required);\n}\n\n/**\n * Get individual slots (not repeatable groups) from an asset container.\n *\n * @param format - A structural asset container\n * @returns Array of individual assets\n */\nexport function getIndividualAssets(format: FormatAssetsInput): IndividualFormatAssetSlot[] {\n return getFormatAssets(format).filter(\n (asset): asset is IndividualFormatAssetSlot => asset.item_type === 'individual'\n );\n}\n\n/**\n * Get repeatable asset groups from an asset container.\n *\n * @param format - A structural asset container\n * @returns Array of repeatable asset groups\n */\nexport function getRepeatableGroups(format: FormatAssetsInput): RepeatableFormatAssetGroup[] {\n return getFormatAssets(format).filter(\n (asset): asset is RepeatableFormatAssetGroup => asset.item_type === 'repeatable_group'\n );\n}\n\n/**\n * Check if format uses deprecated assets_required field (for migration warnings)\n *\n * @param format - A structural asset container\n * @returns true if using deprecated field, false if using new field or neither\n *\n * @example\n * ```typescript\n * if (usesDeprecatedAssetsField(format)) {\n * console.warn('Asset container uses deprecated assets_required field');\n * }\n * ```\n */\nexport function usesDeprecatedAssetsField(format: FormatAssetsInput): boolean {\n const legacyFormat = format as LegacyFormatAssetsInput;\n return !format.assets && !!(legacyFormat.assets_required && Array.isArray(legacyFormat.assets_required));\n}\n\n/**\n * Get the count of slots in an asset container.\n *\n * @param format - A structural asset container\n * @returns Number of assets, or 0 if none defined\n */\nexport function getAssetCount(format: FormatAssetsInput): number {\n return getFormatAssets(format).length;\n}\n\n/**\n * Check if an asset container has any slots defined.\n *\n * @param format - A structural asset container\n * @returns true if format has assets, false otherwise\n */\nexport function hasAssets(format: FormatAssetsInput): boolean {\n return getAssetCount(format) > 0;\n}\n"],"mappings":"AAyEO,SAAS,gBAAgB,QAAuD;AAErF,MAAI,OAAO,UAAU,OAAO,OAAO,SAAS,GAAG;AAC7C,WAAO,OAAO;AAAA,EAChB;AAGA,QAAM,eAAe;AACrB,MACE,aAAa,mBACb,MAAM,QAAQ,aAAa,eAAe,KAC1C,aAAa,gBAAgB,SAAS,GACtC;AACA,WAAO,wBAAwB,aAAa,eAAe;AAAA,EAC7D;AAEA,SAAO,CAAC;AACV;AAYA,SAAS,wBAAwB,gBAAuD;AACtF,SAAO,eAAe,IAAI,YAAU;AAAA,IAClC,GAAI;AAAA,IACJ,UAAU;AAAA;AAAA,EACZ,EAAE;AACJ;AAcO,SAAS,kBAAkB,QAAuD;AACvF,SAAO,gBAAgB,MAAM,EAAE,OAAO,WAAS,MAAM,QAAQ;AAC/D;AAiBO,SAAS,kBAAkB,QAAuD;AACvF,SAAO,gBAAgB,MAAM,EAAE,OAAO,WAAS,CAAC,MAAM,QAAQ;AAChE;AAQO,SAAS,oBAAoB,QAAwD;AAC1F,SAAO,gBAAgB,MAAM,EAAE;AAAA,IAC7B,CAAC,UAA8C,MAAM,cAAc;AAAA,EACrE;AACF;AAQO,SAAS,oBAAoB,QAAyD;AAC3F,SAAO,gBAAgB,MAAM,EAAE;AAAA,IAC7B,CAAC,UAA+C,MAAM,cAAc;AAAA,EACtE;AACF;AAeO,SAAS,0BAA0B,QAAoC;AAC5E,QAAM,eAAe;AACrB,SAAO,CAAC,OAAO,UAAU,CAAC,EAAE,aAAa,mBAAmB,MAAM,QAAQ,aAAa,eAAe;AACxG;AAQO,SAAS,cAAc,QAAmC;AAC/D,SAAO,gBAAgB,MAAM,EAAE;AACjC;AAQO,SAAS,UAAU,QAAoC;AAC5D,SAAO,cAAc,MAAM,IAAI;AACjC;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LegacyCreativeFormatSummary } from '../types/index.mjs';
|
|
2
2
|
export { logger, createLogger, type LogLevel, type LoggerConfig } from './logger.mjs';
|
|
3
|
-
export { batchPreviewProducts,
|
|
3
|
+
export { batchPreviewProducts, batchPreviewFormatsLegacy, clearPreviewCache, type PreviewResult, type LegacyPreviewResult, type BatchPreviewOptions, type PreviewCacheBackend, type PreviewCacheEntry, } from './preview-utils.mjs';
|
|
4
4
|
export declare const REQUEST_TIMEOUT: number;
|
|
5
5
|
export declare const MAX_CONCURRENT: number;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const LEGACY_STANDARD_FORMATS: LegacyCreativeFormatSummary[];
|
|
7
7
|
/**
|
|
8
8
|
* Circuit Breaker for handling agent failures
|
|
9
9
|
*/
|
|
@@ -21,9 +21,9 @@ export declare class CircuitBreaker {
|
|
|
21
21
|
}
|
|
22
22
|
export declare function getCircuitBreaker(agentId: string): CircuitBreaker;
|
|
23
23
|
/**
|
|
24
|
-
* Get
|
|
24
|
+
* Get legacy named creative formats for migration tooling.
|
|
25
25
|
*/
|
|
26
|
-
export declare function
|
|
26
|
+
export declare function getStandardFormatsLegacy(): LegacyCreativeFormatSummary[];
|
|
27
27
|
export { unwrapProtocolResponse, isAdcpError, isAdcpSuccess, isTerminalAdcpError, hasAdvisorySuccessPayload, } from './response-unwrapper.mjs';
|
|
28
28
|
export type { AdCPResponse } from './response-unwrapper.mjs';
|
|
29
29
|
export { ensureGetProductsCacheScope, validateGetProductsCacheScope, type EnsureGetProductsCacheScopeOptions, type GetProductsCacheScope, type GetProductsResponseWithCacheScope, type GetProductsCacheScopeValidation, } from './get-products-cache-scope.mjs';
|
|
@@ -35,9 +35,9 @@ export { extractAdcpErrorFromMcp, extractAdcpErrorFromTransport, extractAdcpErro
|
|
|
35
35
|
export type { ExtractedAdcpError } from './error-extraction.mjs';
|
|
36
36
|
export { detectProtocol, detectProtocolWithTimeout } from './protocol-detection.mjs';
|
|
37
37
|
export { A2A_CARD_PATHS, TRANSPORT_SUFFIX_REGEX, isAgentCardPath, isWellKnownAgentCardUrl, buildCardUrls, stripAgentCardPath, stripTransportSuffix, } from './a2a-discovery.mjs';
|
|
38
|
-
export { getFormatAssets, getRequiredAssets, getOptionalAssets, getIndividualAssets, getRepeatableGroups, usesDeprecatedAssetsField, getAssetCount, hasAssets, } from './format-assets.mjs';
|
|
38
|
+
export { getFormatAssets, getRequiredAssets, getOptionalAssets, getIndividualAssets, getRepeatableGroups, usesDeprecatedAssetsField, getAssetCount, hasAssets, type CanonicalFormatAssetSlot, type FormatAssetsInput, type IndividualFormatAssetSlot, type RepeatableFormatAssetGroup, } from './format-assets.mjs';
|
|
39
39
|
export { adaptGetProductsRequestForV2, normalizeProductChannels, adaptPricingOptionForV2, normalizePricingOption, normalizeProductPricing, normalizeGetProductsResponse, usesV2PricingFields, usesV3PricingFields, isFixedPricing, isCPAPricing, getPrice, getFloorPrice, type PricingOptionV2, type PricingOptionV3, type PriceGuidanceV2, type PriceGuidanceV3, } from './pricing-adapter.mjs';
|
|
40
40
|
export { adaptSyncCreativesRequestForV2 } from './sync-creatives-adapter.mjs';
|
|
41
|
-
export { inlineCreativesForPackages } from './creative-delivery.mjs';
|
|
42
|
-
export type { InlineCreativeAssignment, InlineCreativePackage, InlineCreativePackagePatch, InlineCreativesForPackagesOptions, } from './creative-delivery.mjs';
|
|
41
|
+
export { inlineCreativesForPackages, inlineCreativesForPackagesLegacy } from './creative-delivery.mjs';
|
|
42
|
+
export type { InlineCreativeAssignment, InlineCreativePackage, InlineCreativePackagePatch, InlineCreativesForPackagesOptions, InlineCreativesForPackagesLegacyOptions, LegacyInlineCreativePackage, } from './creative-delivery.mjs';
|
|
43
43
|
export { paginate, paginatePages, type PaginateOptions } from './pagination.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LegacyCreativeFormatSummary } from '../types';
|
|
2
2
|
export { logger, createLogger, type LogLevel, type LoggerConfig } from './logger';
|
|
3
|
-
export { batchPreviewProducts,
|
|
3
|
+
export { batchPreviewProducts, batchPreviewFormatsLegacy, clearPreviewCache, type PreviewResult, type LegacyPreviewResult, type BatchPreviewOptions, type PreviewCacheBackend, type PreviewCacheEntry, } from './preview-utils';
|
|
4
4
|
export declare const REQUEST_TIMEOUT: number;
|
|
5
5
|
export declare const MAX_CONCURRENT: number;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const LEGACY_STANDARD_FORMATS: LegacyCreativeFormatSummary[];
|
|
7
7
|
/**
|
|
8
8
|
* Circuit Breaker for handling agent failures
|
|
9
9
|
*/
|
|
@@ -21,9 +21,9 @@ export declare class CircuitBreaker {
|
|
|
21
21
|
}
|
|
22
22
|
export declare function getCircuitBreaker(agentId: string): CircuitBreaker;
|
|
23
23
|
/**
|
|
24
|
-
* Get
|
|
24
|
+
* Get legacy named creative formats for migration tooling.
|
|
25
25
|
*/
|
|
26
|
-
export declare function
|
|
26
|
+
export declare function getStandardFormatsLegacy(): LegacyCreativeFormatSummary[];
|
|
27
27
|
export { unwrapProtocolResponse, isAdcpError, isAdcpSuccess, isTerminalAdcpError, hasAdvisorySuccessPayload, } from './response-unwrapper';
|
|
28
28
|
export type { AdCPResponse } from './response-unwrapper';
|
|
29
29
|
export { ensureGetProductsCacheScope, validateGetProductsCacheScope, type EnsureGetProductsCacheScopeOptions, type GetProductsCacheScope, type GetProductsResponseWithCacheScope, type GetProductsCacheScopeValidation, } from './get-products-cache-scope';
|
|
@@ -35,10 +35,10 @@ export { extractAdcpErrorFromMcp, extractAdcpErrorFromTransport, extractAdcpErro
|
|
|
35
35
|
export type { ExtractedAdcpError } from './error-extraction';
|
|
36
36
|
export { detectProtocol, detectProtocolWithTimeout } from './protocol-detection';
|
|
37
37
|
export { A2A_CARD_PATHS, TRANSPORT_SUFFIX_REGEX, isAgentCardPath, isWellKnownAgentCardUrl, buildCardUrls, stripAgentCardPath, stripTransportSuffix, } from './a2a-discovery';
|
|
38
|
-
export { getFormatAssets, getRequiredAssets, getOptionalAssets, getIndividualAssets, getRepeatableGroups, usesDeprecatedAssetsField, getAssetCount, hasAssets, } from './format-assets';
|
|
38
|
+
export { getFormatAssets, getRequiredAssets, getOptionalAssets, getIndividualAssets, getRepeatableGroups, usesDeprecatedAssetsField, getAssetCount, hasAssets, type CanonicalFormatAssetSlot, type FormatAssetsInput, type IndividualFormatAssetSlot, type RepeatableFormatAssetGroup, } from './format-assets';
|
|
39
39
|
export { adaptGetProductsRequestForV2, normalizeProductChannels, adaptPricingOptionForV2, normalizePricingOption, normalizeProductPricing, normalizeGetProductsResponse, usesV2PricingFields, usesV3PricingFields, isFixedPricing, isCPAPricing, getPrice, getFloorPrice, type PricingOptionV2, type PricingOptionV3, type PriceGuidanceV2, type PriceGuidanceV3, } from './pricing-adapter';
|
|
40
40
|
export { adaptSyncCreativesRequestForV2 } from './sync-creatives-adapter';
|
|
41
|
-
export { inlineCreativesForPackages } from './creative-delivery';
|
|
42
|
-
export type { InlineCreativeAssignment, InlineCreativePackage, InlineCreativePackagePatch, InlineCreativesForPackagesOptions, } from './creative-delivery';
|
|
41
|
+
export { inlineCreativesForPackages, inlineCreativesForPackagesLegacy } from './creative-delivery';
|
|
42
|
+
export type { InlineCreativeAssignment, InlineCreativePackage, InlineCreativePackagePatch, InlineCreativesForPackagesOptions, InlineCreativesForPackagesLegacyOptions, LegacyInlineCreativePackage, } from './creative-delivery';
|
|
43
43
|
export { paginate, paginatePages, type PaginateOptions } from './pagination';
|
|
44
44
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"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"}
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -20,14 +20,14 @@ var utils_exports = {};
|
|
|
20
20
|
__export(utils_exports, {
|
|
21
21
|
A2A_CARD_PATHS: () => import_a2a_discovery.A2A_CARD_PATHS,
|
|
22
22
|
CircuitBreaker: () => CircuitBreaker,
|
|
23
|
+
LEGACY_STANDARD_FORMATS: () => LEGACY_STANDARD_FORMATS,
|
|
23
24
|
MAX_CONCURRENT: () => MAX_CONCURRENT,
|
|
24
25
|
REQUEST_TIMEOUT: () => REQUEST_TIMEOUT,
|
|
25
|
-
STANDARD_FORMATS: () => STANDARD_FORMATS,
|
|
26
26
|
TRANSPORT_SUFFIX_REGEX: () => import_a2a_discovery.TRANSPORT_SUFFIX_REGEX,
|
|
27
27
|
adaptGetProductsRequestForV2: () => import_pricing_adapter.adaptGetProductsRequestForV2,
|
|
28
28
|
adaptPricingOptionForV2: () => import_pricing_adapter.adaptPricingOptionForV2,
|
|
29
29
|
adaptSyncCreativesRequestForV2: () => import_sync_creatives_adapter.adaptSyncCreativesRequestForV2,
|
|
30
|
-
|
|
30
|
+
batchPreviewFormatsLegacy: () => import_preview_utils.batchPreviewFormatsLegacy,
|
|
31
31
|
batchPreviewProducts: () => import_preview_utils.batchPreviewProducts,
|
|
32
32
|
buildCardUrls: () => import_a2a_discovery.buildCardUrls,
|
|
33
33
|
clearPreviewCache: () => import_preview_utils.clearPreviewCache,
|
|
@@ -52,10 +52,11 @@ __export(utils_exports, {
|
|
|
52
52
|
getRepeatableGroups: () => import_format_assets.getRepeatableGroups,
|
|
53
53
|
getRequiredAssets: () => import_format_assets.getRequiredAssets,
|
|
54
54
|
getRetryDelay: () => import_retry.getRetryDelay,
|
|
55
|
-
|
|
55
|
+
getStandardFormatsLegacy: () => getStandardFormatsLegacy,
|
|
56
56
|
hasAdvisorySuccessPayload: () => import_response_unwrapper.hasAdvisorySuccessPayload,
|
|
57
57
|
hasAssets: () => import_format_assets.hasAssets,
|
|
58
58
|
inlineCreativesForPackages: () => import_creative_delivery.inlineCreativesForPackages,
|
|
59
|
+
inlineCreativesForPackagesLegacy: () => import_creative_delivery.inlineCreativesForPackagesLegacy,
|
|
59
60
|
isAdcpError: () => import_response_unwrapper.isAdcpError,
|
|
60
61
|
isAdcpSuccess: () => import_response_unwrapper.isAdcpSuccess,
|
|
61
62
|
isAgentCardPath: () => import_a2a_discovery.isAgentCardPath,
|
|
@@ -102,7 +103,7 @@ var import_creative_delivery = require('./creative-delivery.js');
|
|
|
102
103
|
var import_pagination = require('./pagination.js');
|
|
103
104
|
const REQUEST_TIMEOUT = parseInt(process.env.REQUEST_TIMEOUT || "30000");
|
|
104
105
|
const MAX_CONCURRENT = parseInt(process.env.MAX_CONCURRENT || "5");
|
|
105
|
-
const
|
|
106
|
+
const LEGACY_STANDARD_FORMATS = [
|
|
106
107
|
{
|
|
107
108
|
format_id: {
|
|
108
109
|
agent_url: "https://creatives.adcontextprotocol.org",
|
|
@@ -201,21 +202,21 @@ function getCircuitBreaker(agentId) {
|
|
|
201
202
|
}
|
|
202
203
|
return circuitBreakers.get(agentId);
|
|
203
204
|
}
|
|
204
|
-
function
|
|
205
|
-
return
|
|
205
|
+
function getStandardFormatsLegacy() {
|
|
206
|
+
return LEGACY_STANDARD_FORMATS;
|
|
206
207
|
}
|
|
207
208
|
// Annotate the CommonJS export names for ESM import in node:
|
|
208
209
|
0 && (module.exports = {
|
|
209
210
|
A2A_CARD_PATHS,
|
|
210
211
|
CircuitBreaker,
|
|
212
|
+
LEGACY_STANDARD_FORMATS,
|
|
211
213
|
MAX_CONCURRENT,
|
|
212
214
|
REQUEST_TIMEOUT,
|
|
213
|
-
STANDARD_FORMATS,
|
|
214
215
|
TRANSPORT_SUFFIX_REGEX,
|
|
215
216
|
adaptGetProductsRequestForV2,
|
|
216
217
|
adaptPricingOptionForV2,
|
|
217
218
|
adaptSyncCreativesRequestForV2,
|
|
218
|
-
|
|
219
|
+
batchPreviewFormatsLegacy,
|
|
219
220
|
batchPreviewProducts,
|
|
220
221
|
buildCardUrls,
|
|
221
222
|
clearPreviewCache,
|
|
@@ -240,10 +241,11 @@ function getStandardFormats() {
|
|
|
240
241
|
getRepeatableGroups,
|
|
241
242
|
getRequiredAssets,
|
|
242
243
|
getRetryDelay,
|
|
243
|
-
|
|
244
|
+
getStandardFormatsLegacy,
|
|
244
245
|
hasAdvisorySuccessPayload,
|
|
245
246
|
hasAssets,
|
|
246
247
|
inlineCreativesForPackages,
|
|
248
|
+
inlineCreativesForPackagesLegacy,
|
|
247
249
|
isAdcpError,
|
|
248
250
|
isAdcpSuccess,
|
|
249
251
|
isAgentCardPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/utils/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/index.ts"],"sourcesContent":["import type { LegacyCreativeFormatSummary } from '../types';\n\n// Re-export logger utilities\nexport { logger, createLogger, type LogLevel, type LoggerConfig } from './logger';\nimport { logger } from './logger';\n\n// Re-export preview utilities\nexport {\n batchPreviewProducts,\n batchPreviewFormatsLegacy,\n clearPreviewCache,\n type PreviewResult,\n type LegacyPreviewResult,\n type BatchPreviewOptions,\n type PreviewCacheBackend,\n type PreviewCacheEntry,\n} from './preview-utils';\n\n// Configuration constants\nexport const REQUEST_TIMEOUT = parseInt(process.env.REQUEST_TIMEOUT || '30000'); // 30 seconds\nexport const MAX_CONCURRENT = parseInt(process.env.MAX_CONCURRENT || '5');\n\n// Legacy named creative formats (hardcoded migration fixtures)\nexport const LEGACY_STANDARD_FORMATS: LegacyCreativeFormatSummary[] = [\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'banner_728x90',\n },\n name: 'Leaderboard',\n dimensions: { width: 728, height: 90 },\n aspect_ratio: '8:1',\n file_types: ['jpg', 'jpeg', 'png', 'gif'],\n max_file_size: 150000,\n },\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'banner_300x250',\n },\n name: 'Medium Rectangle',\n dimensions: { width: 300, height: 250 },\n aspect_ratio: '6:5',\n file_types: ['jpg', 'jpeg', 'png', 'gif'],\n max_file_size: 150000,\n },\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'banner_320x50',\n },\n name: 'Mobile Banner',\n dimensions: { width: 320, height: 50 },\n aspect_ratio: '32:5',\n file_types: ['jpg', 'jpeg', 'png', 'gif'],\n max_file_size: 40000,\n },\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'video_1920x1080',\n },\n name: 'Full HD Video',\n dimensions: { width: 1920, height: 1080 },\n aspect_ratio: '16:9',\n file_types: ['mp4', 'webm'],\n max_file_size: 10000000,\n duration_range: { min: 6, max: 30 },\n },\n];\n\n/**\n * Circuit Breaker for handling agent failures\n */\nexport class CircuitBreaker {\n private failures = 0;\n private lastFailTime = 0;\n private state: 'closed' | 'open' | 'half-open' = 'closed';\n private readonly failureThreshold = 5;\n private readonly resetTimeout = 60000; // 1 minute\n\n constructor(private agentId: string) {}\n\n async call<T>(fn: () => Promise<T>): Promise<T> {\n if (this.state === 'open') {\n if (Date.now() - this.lastFailTime > this.resetTimeout) {\n this.state = 'half-open';\n logger.info(`🔄 Circuit breaker for ${this.agentId} attempting to close...`);\n } else {\n throw new Error(`Circuit breaker is open for agent ${this.agentId}`);\n }\n }\n\n try {\n const result = await fn();\n this.onSuccess();\n return result;\n } catch (error) {\n this.onFailure();\n throw error;\n }\n }\n\n private onSuccess(): void {\n this.failures = 0;\n if (this.state === 'half-open') {\n this.state = 'closed';\n logger.info(`✅ Circuit breaker for ${this.agentId} closed successfully`);\n }\n }\n\n private onFailure(): void {\n this.failures++;\n this.lastFailTime = Date.now();\n\n if (this.failures >= this.failureThreshold) {\n this.state = 'open';\n logger.warn(`🚨 Circuit breaker opened for agent ${this.agentId} after ${this.failures} failures`);\n }\n }\n}\n\n// Circuit breaker instances for each agent\nconst circuitBreakers = new Map<string, CircuitBreaker>();\n\nexport function getCircuitBreaker(agentId: string): CircuitBreaker {\n if (!circuitBreakers.has(agentId)) {\n circuitBreakers.set(agentId, new CircuitBreaker(agentId));\n }\n return circuitBreakers.get(agentId)!;\n}\n\n/**\n * Get legacy named creative formats for migration tooling.\n */\nexport function getStandardFormatsLegacy(): LegacyCreativeFormatSummary[] {\n return LEGACY_STANDARD_FORMATS;\n}\n\n// Re-export response unwrapping utilities\nexport {\n unwrapProtocolResponse,\n isAdcpError,\n isAdcpSuccess,\n isTerminalAdcpError,\n hasAdvisorySuccessPayload,\n} from './response-unwrapper';\nexport type { AdCPResponse } from './response-unwrapper';\nexport {\n ensureGetProductsCacheScope,\n validateGetProductsCacheScope,\n type EnsureGetProductsCacheScopeOptions,\n type GetProductsCacheScope,\n type GetProductsResponseWithCacheScope,\n type GetProductsCacheScopeValidation,\n} from './get-products-cache-scope';\nexport { getAuthoritativeMediaBuyStatus, isMediaBuyStatus } from './media-buy-status';\nexport {\n resolveTaskState,\n type EffectiveTaskState,\n type ResolvedTaskState,\n type ResolveTaskStateOptions,\n} from './task-state';\n\n// Lightweight MCP CallToolResult extractor (prefers structuredContent, falls back to JSON text).\nexport { extractResult, type ToolCallResultLike } from './extract-result';\n\n// Re-export retry utilities\nexport { isRetryable, getRetryDelay } from './retry';\n\n// Re-export error extraction utilities\nexport {\n extractAdcpErrorFromMcp,\n extractAdcpErrorFromTransport,\n extractAdcpErrorInfo,\n extractCorrelationId,\n resolveRecovery,\n getExpectedAction,\n} from './error-extraction';\nexport type { ExtractedAdcpError } from './error-extraction';\n\n// Re-export protocol detection utilities\nexport { detectProtocol, detectProtocolWithTimeout } from './protocol-detection';\n\n// Re-export A2A discovery utilities\nexport {\n A2A_CARD_PATHS,\n TRANSPORT_SUFFIX_REGEX,\n isAgentCardPath,\n isWellKnownAgentCardUrl,\n buildCardUrls,\n stripAgentCardPath,\n stripTransportSuffix,\n} from './a2a-discovery';\n\n// Re-export format asset utilities\nexport {\n getFormatAssets,\n getRequiredAssets,\n getOptionalAssets,\n getIndividualAssets,\n getRepeatableGroups,\n usesDeprecatedAssetsField,\n getAssetCount,\n hasAssets,\n type CanonicalFormatAssetSlot,\n type FormatAssetsInput,\n type IndividualFormatAssetSlot,\n type RepeatableFormatAssetGroup,\n} from './format-assets';\n\n// Re-export pricing adapter utilities (v3 pricing field compatibility)\nexport {\n adaptGetProductsRequestForV2,\n normalizeProductChannels,\n adaptPricingOptionForV2,\n normalizePricingOption,\n normalizeProductPricing,\n normalizeGetProductsResponse,\n usesV2PricingFields,\n usesV3PricingFields,\n isFixedPricing,\n isCPAPricing,\n getPrice,\n getFloorPrice,\n type PricingOptionV2,\n type PricingOptionV3,\n type PriceGuidanceV2,\n type PriceGuidanceV3,\n} from './pricing-adapter';\n\n// Re-export sync creatives adapter (v2/v3 compatibility)\nexport { adaptSyncCreativesRequestForV2 } from './sync-creatives-adapter';\n\n// Re-export creative delivery helpers for package-scoped inline creatives\nexport { inlineCreativesForPackages, inlineCreativesForPackagesLegacy } from './creative-delivery';\nexport type {\n InlineCreativeAssignment,\n InlineCreativePackage,\n InlineCreativePackagePatch,\n InlineCreativesForPackagesOptions,\n InlineCreativesForPackagesLegacyOptions,\n LegacyInlineCreativePackage,\n} from './creative-delivery';\n\n// Re-export pagination utilities\nexport { paginate, paginatePages, type PaginateOptions } from './pagination';\n"],"mappings":"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","names":["import_logger"]}
|
package/dist/lib/utils/index.mjs
CHANGED
|
@@ -2,12 +2,12 @@ import { logger, createLogger } from "./logger.mjs";
|
|
|
2
2
|
import { logger as logger2 } from "./logger.mjs";
|
|
3
3
|
import {
|
|
4
4
|
batchPreviewProducts,
|
|
5
|
-
|
|
5
|
+
batchPreviewFormatsLegacy,
|
|
6
6
|
clearPreviewCache
|
|
7
7
|
} from "./preview-utils.mjs";
|
|
8
8
|
const REQUEST_TIMEOUT = parseInt(process.env.REQUEST_TIMEOUT || "30000");
|
|
9
9
|
const MAX_CONCURRENT = parseInt(process.env.MAX_CONCURRENT || "5");
|
|
10
|
-
const
|
|
10
|
+
const LEGACY_STANDARD_FORMATS = [
|
|
11
11
|
{
|
|
12
12
|
format_id: {
|
|
13
13
|
agent_url: "https://creatives.adcontextprotocol.org",
|
|
@@ -106,8 +106,8 @@ function getCircuitBreaker(agentId) {
|
|
|
106
106
|
}
|
|
107
107
|
return circuitBreakers.get(agentId);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
return
|
|
109
|
+
function getStandardFormatsLegacy() {
|
|
110
|
+
return LEGACY_STANDARD_FORMATS;
|
|
111
111
|
}
|
|
112
112
|
import {
|
|
113
113
|
unwrapProtocolResponse,
|
|
@@ -169,19 +169,19 @@ import {
|
|
|
169
169
|
getFloorPrice
|
|
170
170
|
} from "./pricing-adapter.mjs";
|
|
171
171
|
import { adaptSyncCreativesRequestForV2 } from "./sync-creatives-adapter.mjs";
|
|
172
|
-
import { inlineCreativesForPackages } from "./creative-delivery.mjs";
|
|
172
|
+
import { inlineCreativesForPackages, inlineCreativesForPackagesLegacy } from "./creative-delivery.mjs";
|
|
173
173
|
import { paginate, paginatePages } from "./pagination.mjs";
|
|
174
174
|
export {
|
|
175
175
|
A2A_CARD_PATHS,
|
|
176
176
|
CircuitBreaker,
|
|
177
|
+
LEGACY_STANDARD_FORMATS,
|
|
177
178
|
MAX_CONCURRENT,
|
|
178
179
|
REQUEST_TIMEOUT,
|
|
179
|
-
STANDARD_FORMATS,
|
|
180
180
|
TRANSPORT_SUFFIX_REGEX,
|
|
181
181
|
adaptGetProductsRequestForV2,
|
|
182
182
|
adaptPricingOptionForV2,
|
|
183
183
|
adaptSyncCreativesRequestForV2,
|
|
184
|
-
|
|
184
|
+
batchPreviewFormatsLegacy,
|
|
185
185
|
batchPreviewProducts,
|
|
186
186
|
buildCardUrls,
|
|
187
187
|
clearPreviewCache,
|
|
@@ -206,10 +206,11 @@ export {
|
|
|
206
206
|
getRepeatableGroups,
|
|
207
207
|
getRequiredAssets,
|
|
208
208
|
getRetryDelay,
|
|
209
|
-
|
|
209
|
+
getStandardFormatsLegacy,
|
|
210
210
|
hasAdvisorySuccessPayload,
|
|
211
211
|
hasAssets,
|
|
212
212
|
inlineCreativesForPackages,
|
|
213
|
+
inlineCreativesForPackagesLegacy,
|
|
213
214
|
isAdcpError,
|
|
214
215
|
isAdcpSuccess,
|
|
215
216
|
isAgentCardPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/utils/index.ts"],"sourcesContent":["import type { CreativeFormat } from '../types';\n\n// Re-export logger utilities\nexport { logger, createLogger, type LogLevel, type LoggerConfig } from './logger';\nimport { logger } from './logger';\n\n// Re-export preview utilities\nexport {\n batchPreviewProducts,\n batchPreviewFormats,\n clearPreviewCache,\n type PreviewResult,\n type BatchPreviewOptions,\n type PreviewCacheBackend,\n type PreviewCacheEntry,\n} from './preview-utils';\n\n// Configuration constants\nexport const REQUEST_TIMEOUT = parseInt(process.env.REQUEST_TIMEOUT || '30000'); // 30 seconds\nexport const MAX_CONCURRENT = parseInt(process.env.MAX_CONCURRENT || '5');\n\n// Standard creative formats (hardcoded for now)\nexport const STANDARD_FORMATS: CreativeFormat[] = [\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'banner_728x90',\n },\n name: 'Leaderboard',\n dimensions: { width: 728, height: 90 },\n aspect_ratio: '8:1',\n file_types: ['jpg', 'jpeg', 'png', 'gif'],\n max_file_size: 150000,\n },\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'banner_300x250',\n },\n name: 'Medium Rectangle',\n dimensions: { width: 300, height: 250 },\n aspect_ratio: '6:5',\n file_types: ['jpg', 'jpeg', 'png', 'gif'],\n max_file_size: 150000,\n },\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'banner_320x50',\n },\n name: 'Mobile Banner',\n dimensions: { width: 320, height: 50 },\n aspect_ratio: '32:5',\n file_types: ['jpg', 'jpeg', 'png', 'gif'],\n max_file_size: 40000,\n },\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'video_1920x1080',\n },\n name: 'Full HD Video',\n dimensions: { width: 1920, height: 1080 },\n aspect_ratio: '16:9',\n file_types: ['mp4', 'webm'],\n max_file_size: 10000000,\n duration_range: { min: 6, max: 30 },\n },\n];\n\n/**\n * Circuit Breaker for handling agent failures\n */\nexport class CircuitBreaker {\n private failures = 0;\n private lastFailTime = 0;\n private state: 'closed' | 'open' | 'half-open' = 'closed';\n private readonly failureThreshold = 5;\n private readonly resetTimeout = 60000; // 1 minute\n\n constructor(private agentId: string) {}\n\n async call<T>(fn: () => Promise<T>): Promise<T> {\n if (this.state === 'open') {\n if (Date.now() - this.lastFailTime > this.resetTimeout) {\n this.state = 'half-open';\n logger.info(`🔄 Circuit breaker for ${this.agentId} attempting to close...`);\n } else {\n throw new Error(`Circuit breaker is open for agent ${this.agentId}`);\n }\n }\n\n try {\n const result = await fn();\n this.onSuccess();\n return result;\n } catch (error) {\n this.onFailure();\n throw error;\n }\n }\n\n private onSuccess(): void {\n this.failures = 0;\n if (this.state === 'half-open') {\n this.state = 'closed';\n logger.info(`✅ Circuit breaker for ${this.agentId} closed successfully`);\n }\n }\n\n private onFailure(): void {\n this.failures++;\n this.lastFailTime = Date.now();\n\n if (this.failures >= this.failureThreshold) {\n this.state = 'open';\n logger.warn(`🚨 Circuit breaker opened for agent ${this.agentId} after ${this.failures} failures`);\n }\n }\n}\n\n// Circuit breaker instances for each agent\nconst circuitBreakers = new Map<string, CircuitBreaker>();\n\nexport function getCircuitBreaker(agentId: string): CircuitBreaker {\n if (!circuitBreakers.has(agentId)) {\n circuitBreakers.set(agentId, new CircuitBreaker(agentId));\n }\n return circuitBreakers.get(agentId)!;\n}\n\n/**\n * Get standard creative formats\n */\nexport function getStandardFormats(): CreativeFormat[] {\n return STANDARD_FORMATS;\n}\n\n// Re-export response unwrapping utilities\nexport {\n unwrapProtocolResponse,\n isAdcpError,\n isAdcpSuccess,\n isTerminalAdcpError,\n hasAdvisorySuccessPayload,\n} from './response-unwrapper';\nexport type { AdCPResponse } from './response-unwrapper';\nexport {\n ensureGetProductsCacheScope,\n validateGetProductsCacheScope,\n type EnsureGetProductsCacheScopeOptions,\n type GetProductsCacheScope,\n type GetProductsResponseWithCacheScope,\n type GetProductsCacheScopeValidation,\n} from './get-products-cache-scope';\nexport { getAuthoritativeMediaBuyStatus, isMediaBuyStatus } from './media-buy-status';\nexport {\n resolveTaskState,\n type EffectiveTaskState,\n type ResolvedTaskState,\n type ResolveTaskStateOptions,\n} from './task-state';\n\n// Lightweight MCP CallToolResult extractor (prefers structuredContent, falls back to JSON text).\nexport { extractResult, type ToolCallResultLike } from './extract-result';\n\n// Re-export retry utilities\nexport { isRetryable, getRetryDelay } from './retry';\n\n// Re-export error extraction utilities\nexport {\n extractAdcpErrorFromMcp,\n extractAdcpErrorFromTransport,\n extractAdcpErrorInfo,\n extractCorrelationId,\n resolveRecovery,\n getExpectedAction,\n} from './error-extraction';\nexport type { ExtractedAdcpError } from './error-extraction';\n\n// Re-export protocol detection utilities\nexport { detectProtocol, detectProtocolWithTimeout } from './protocol-detection';\n\n// Re-export A2A discovery utilities\nexport {\n A2A_CARD_PATHS,\n TRANSPORT_SUFFIX_REGEX,\n isAgentCardPath,\n isWellKnownAgentCardUrl,\n buildCardUrls,\n stripAgentCardPath,\n stripTransportSuffix,\n} from './a2a-discovery';\n\n// Re-export format asset utilities\nexport {\n getFormatAssets,\n getRequiredAssets,\n getOptionalAssets,\n getIndividualAssets,\n getRepeatableGroups,\n usesDeprecatedAssetsField,\n getAssetCount,\n hasAssets,\n} from './format-assets';\n\n// Re-export pricing adapter utilities (v3 pricing field compatibility)\nexport {\n adaptGetProductsRequestForV2,\n normalizeProductChannels,\n adaptPricingOptionForV2,\n normalizePricingOption,\n normalizeProductPricing,\n normalizeGetProductsResponse,\n usesV2PricingFields,\n usesV3PricingFields,\n isFixedPricing,\n isCPAPricing,\n getPrice,\n getFloorPrice,\n type PricingOptionV2,\n type PricingOptionV3,\n type PriceGuidanceV2,\n type PriceGuidanceV3,\n} from './pricing-adapter';\n\n// Re-export sync creatives adapter (v2/v3 compatibility)\nexport { adaptSyncCreativesRequestForV2 } from './sync-creatives-adapter';\n\n// Re-export creative delivery helpers for package-scoped inline creatives\nexport { inlineCreativesForPackages } from './creative-delivery';\nexport type {\n InlineCreativeAssignment,\n InlineCreativePackage,\n InlineCreativePackagePatch,\n InlineCreativesForPackagesOptions,\n} from './creative-delivery';\n\n// Re-export pagination utilities\nexport { paginate, paginatePages, type PaginateOptions } from './pagination';\n"],"mappings":"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","names":["logger"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/index.ts"],"sourcesContent":["import type { LegacyCreativeFormatSummary } from '../types';\n\n// Re-export logger utilities\nexport { logger, createLogger, type LogLevel, type LoggerConfig } from './logger';\nimport { logger } from './logger';\n\n// Re-export preview utilities\nexport {\n batchPreviewProducts,\n batchPreviewFormatsLegacy,\n clearPreviewCache,\n type PreviewResult,\n type LegacyPreviewResult,\n type BatchPreviewOptions,\n type PreviewCacheBackend,\n type PreviewCacheEntry,\n} from './preview-utils';\n\n// Configuration constants\nexport const REQUEST_TIMEOUT = parseInt(process.env.REQUEST_TIMEOUT || '30000'); // 30 seconds\nexport const MAX_CONCURRENT = parseInt(process.env.MAX_CONCURRENT || '5');\n\n// Legacy named creative formats (hardcoded migration fixtures)\nexport const LEGACY_STANDARD_FORMATS: LegacyCreativeFormatSummary[] = [\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'banner_728x90',\n },\n name: 'Leaderboard',\n dimensions: { width: 728, height: 90 },\n aspect_ratio: '8:1',\n file_types: ['jpg', 'jpeg', 'png', 'gif'],\n max_file_size: 150000,\n },\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'banner_300x250',\n },\n name: 'Medium Rectangle',\n dimensions: { width: 300, height: 250 },\n aspect_ratio: '6:5',\n file_types: ['jpg', 'jpeg', 'png', 'gif'],\n max_file_size: 150000,\n },\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'banner_320x50',\n },\n name: 'Mobile Banner',\n dimensions: { width: 320, height: 50 },\n aspect_ratio: '32:5',\n file_types: ['jpg', 'jpeg', 'png', 'gif'],\n max_file_size: 40000,\n },\n {\n format_id: {\n agent_url: 'https://creatives.adcontextprotocol.org',\n id: 'video_1920x1080',\n },\n name: 'Full HD Video',\n dimensions: { width: 1920, height: 1080 },\n aspect_ratio: '16:9',\n file_types: ['mp4', 'webm'],\n max_file_size: 10000000,\n duration_range: { min: 6, max: 30 },\n },\n];\n\n/**\n * Circuit Breaker for handling agent failures\n */\nexport class CircuitBreaker {\n private failures = 0;\n private lastFailTime = 0;\n private state: 'closed' | 'open' | 'half-open' = 'closed';\n private readonly failureThreshold = 5;\n private readonly resetTimeout = 60000; // 1 minute\n\n constructor(private agentId: string) {}\n\n async call<T>(fn: () => Promise<T>): Promise<T> {\n if (this.state === 'open') {\n if (Date.now() - this.lastFailTime > this.resetTimeout) {\n this.state = 'half-open';\n logger.info(`🔄 Circuit breaker for ${this.agentId} attempting to close...`);\n } else {\n throw new Error(`Circuit breaker is open for agent ${this.agentId}`);\n }\n }\n\n try {\n const result = await fn();\n this.onSuccess();\n return result;\n } catch (error) {\n this.onFailure();\n throw error;\n }\n }\n\n private onSuccess(): void {\n this.failures = 0;\n if (this.state === 'half-open') {\n this.state = 'closed';\n logger.info(`✅ Circuit breaker for ${this.agentId} closed successfully`);\n }\n }\n\n private onFailure(): void {\n this.failures++;\n this.lastFailTime = Date.now();\n\n if (this.failures >= this.failureThreshold) {\n this.state = 'open';\n logger.warn(`🚨 Circuit breaker opened for agent ${this.agentId} after ${this.failures} failures`);\n }\n }\n}\n\n// Circuit breaker instances for each agent\nconst circuitBreakers = new Map<string, CircuitBreaker>();\n\nexport function getCircuitBreaker(agentId: string): CircuitBreaker {\n if (!circuitBreakers.has(agentId)) {\n circuitBreakers.set(agentId, new CircuitBreaker(agentId));\n }\n return circuitBreakers.get(agentId)!;\n}\n\n/**\n * Get legacy named creative formats for migration tooling.\n */\nexport function getStandardFormatsLegacy(): LegacyCreativeFormatSummary[] {\n return LEGACY_STANDARD_FORMATS;\n}\n\n// Re-export response unwrapping utilities\nexport {\n unwrapProtocolResponse,\n isAdcpError,\n isAdcpSuccess,\n isTerminalAdcpError,\n hasAdvisorySuccessPayload,\n} from './response-unwrapper';\nexport type { AdCPResponse } from './response-unwrapper';\nexport {\n ensureGetProductsCacheScope,\n validateGetProductsCacheScope,\n type EnsureGetProductsCacheScopeOptions,\n type GetProductsCacheScope,\n type GetProductsResponseWithCacheScope,\n type GetProductsCacheScopeValidation,\n} from './get-products-cache-scope';\nexport { getAuthoritativeMediaBuyStatus, isMediaBuyStatus } from './media-buy-status';\nexport {\n resolveTaskState,\n type EffectiveTaskState,\n type ResolvedTaskState,\n type ResolveTaskStateOptions,\n} from './task-state';\n\n// Lightweight MCP CallToolResult extractor (prefers structuredContent, falls back to JSON text).\nexport { extractResult, type ToolCallResultLike } from './extract-result';\n\n// Re-export retry utilities\nexport { isRetryable, getRetryDelay } from './retry';\n\n// Re-export error extraction utilities\nexport {\n extractAdcpErrorFromMcp,\n extractAdcpErrorFromTransport,\n extractAdcpErrorInfo,\n extractCorrelationId,\n resolveRecovery,\n getExpectedAction,\n} from './error-extraction';\nexport type { ExtractedAdcpError } from './error-extraction';\n\n// Re-export protocol detection utilities\nexport { detectProtocol, detectProtocolWithTimeout } from './protocol-detection';\n\n// Re-export A2A discovery utilities\nexport {\n A2A_CARD_PATHS,\n TRANSPORT_SUFFIX_REGEX,\n isAgentCardPath,\n isWellKnownAgentCardUrl,\n buildCardUrls,\n stripAgentCardPath,\n stripTransportSuffix,\n} from './a2a-discovery';\n\n// Re-export format asset utilities\nexport {\n getFormatAssets,\n getRequiredAssets,\n getOptionalAssets,\n getIndividualAssets,\n getRepeatableGroups,\n usesDeprecatedAssetsField,\n getAssetCount,\n hasAssets,\n type CanonicalFormatAssetSlot,\n type FormatAssetsInput,\n type IndividualFormatAssetSlot,\n type RepeatableFormatAssetGroup,\n} from './format-assets';\n\n// Re-export pricing adapter utilities (v3 pricing field compatibility)\nexport {\n adaptGetProductsRequestForV2,\n normalizeProductChannels,\n adaptPricingOptionForV2,\n normalizePricingOption,\n normalizeProductPricing,\n normalizeGetProductsResponse,\n usesV2PricingFields,\n usesV3PricingFields,\n isFixedPricing,\n isCPAPricing,\n getPrice,\n getFloorPrice,\n type PricingOptionV2,\n type PricingOptionV3,\n type PriceGuidanceV2,\n type PriceGuidanceV3,\n} from './pricing-adapter';\n\n// Re-export sync creatives adapter (v2/v3 compatibility)\nexport { adaptSyncCreativesRequestForV2 } from './sync-creatives-adapter';\n\n// Re-export creative delivery helpers for package-scoped inline creatives\nexport { inlineCreativesForPackages, inlineCreativesForPackagesLegacy } from './creative-delivery';\nexport type {\n InlineCreativeAssignment,\n InlineCreativePackage,\n InlineCreativePackagePatch,\n InlineCreativesForPackagesOptions,\n InlineCreativesForPackagesLegacyOptions,\n LegacyInlineCreativePackage,\n} from './creative-delivery';\n\n// Re-export pagination utilities\nexport { paginate, paginatePages, type PaginateOptions } from './pagination';\n"],"mappings":"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","names":["logger"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { SingleAgentClient } from '../core/SingleAgentClient.mjs';
|
|
2
2
|
import type { Format, Product } from '../types/tools.generated.mjs';
|
|
3
|
+
import type { CanonicalProduct } from '../v2/projection/creative-delivery.mjs';
|
|
3
4
|
/**
|
|
4
|
-
* Preview result for a single item
|
|
5
|
+
* Preview result for a single canonical item.
|
|
5
6
|
*/
|
|
6
|
-
export interface PreviewResult {
|
|
7
|
-
/** The item being previewed
|
|
8
|
-
item:
|
|
7
|
+
export interface PreviewResult<TItem = CanonicalProduct> {
|
|
8
|
+
/** The item being previewed. */
|
|
9
|
+
item: TItem;
|
|
9
10
|
/** Preview URL for the rendered card */
|
|
10
11
|
previewUrl?: string;
|
|
11
12
|
/** Preview ID from the creative agent */
|
|
@@ -13,6 +14,8 @@ export interface PreviewResult {
|
|
|
13
14
|
/** Error message if preview failed */
|
|
14
15
|
error?: string;
|
|
15
16
|
}
|
|
17
|
+
/** Raw named-format preview result for explicit migration tooling. */
|
|
18
|
+
export type LegacyPreviewResult = PreviewResult<Product | Format>;
|
|
16
19
|
/**
|
|
17
20
|
* Options for batch preview generation
|
|
18
21
|
*/
|
|
@@ -98,9 +101,9 @@ export declare function clearPreviewCache(): void;
|
|
|
98
101
|
* @deprecated Use `product.product_card?.image?.url` directly. This wrapper
|
|
99
102
|
* only exists for 8.0-beta migration ergonomics and will be removed.
|
|
100
103
|
*/
|
|
101
|
-
export declare function batchPreviewProducts(products:
|
|
104
|
+
export declare function batchPreviewProducts(products: CanonicalProduct[], _creativeAgentClient: SingleAgentClient, _options?: BatchPreviewOptions): Promise<PreviewResult[]>;
|
|
102
105
|
/**
|
|
103
|
-
* Generate batch previews for formats with format_card manifests
|
|
106
|
+
* Generate batch previews for legacy named formats with format_card manifests.
|
|
104
107
|
*
|
|
105
108
|
* Formats with format_card fields will have their cards rendered via the creative agent.
|
|
106
109
|
* Formats without format_card will be returned with no preview.
|
|
@@ -119,7 +122,7 @@ export declare function batchPreviewProducts(products: Product[], _creativeAgent
|
|
|
119
122
|
* protocol: 'mcp'
|
|
120
123
|
* });
|
|
121
124
|
*
|
|
122
|
-
* const previews = await
|
|
125
|
+
* const previews = await batchPreviewFormatsLegacy(formats, creativeAgent);
|
|
123
126
|
* previews.forEach(p => {
|
|
124
127
|
* if (p.previewUrl) {
|
|
125
128
|
* console.log(`${(p.item as Format).name}: ${p.previewUrl}`);
|
|
@@ -127,4 +130,4 @@ export declare function batchPreviewProducts(products: Product[], _creativeAgent
|
|
|
127
130
|
* });
|
|
128
131
|
* ```
|
|
129
132
|
*/
|
|
130
|
-
export declare function
|
|
133
|
+
export declare function batchPreviewFormatsLegacy(formats: Format[], creativeAgentClient: SingleAgentClient, options?: BatchPreviewOptions): Promise<LegacyPreviewResult[]>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { SingleAgentClient } from '../core/SingleAgentClient';
|
|
2
2
|
import type { Format, Product } from '../types/tools.generated';
|
|
3
|
+
import type { CanonicalProduct } from '../v2/projection/creative-delivery';
|
|
3
4
|
/**
|
|
4
|
-
* Preview result for a single item
|
|
5
|
+
* Preview result for a single canonical item.
|
|
5
6
|
*/
|
|
6
|
-
export interface PreviewResult {
|
|
7
|
-
/** The item being previewed
|
|
8
|
-
item:
|
|
7
|
+
export interface PreviewResult<TItem = CanonicalProduct> {
|
|
8
|
+
/** The item being previewed. */
|
|
9
|
+
item: TItem;
|
|
9
10
|
/** Preview URL for the rendered card */
|
|
10
11
|
previewUrl?: string;
|
|
11
12
|
/** Preview ID from the creative agent */
|
|
@@ -13,6 +14,8 @@ export interface PreviewResult {
|
|
|
13
14
|
/** Error message if preview failed */
|
|
14
15
|
error?: string;
|
|
15
16
|
}
|
|
17
|
+
/** Raw named-format preview result for explicit migration tooling. */
|
|
18
|
+
export type LegacyPreviewResult = PreviewResult<Product | Format>;
|
|
16
19
|
/**
|
|
17
20
|
* Options for batch preview generation
|
|
18
21
|
*/
|
|
@@ -98,9 +101,9 @@ export declare function clearPreviewCache(): void;
|
|
|
98
101
|
* @deprecated Use `product.product_card?.image?.url` directly. This wrapper
|
|
99
102
|
* only exists for 8.0-beta migration ergonomics and will be removed.
|
|
100
103
|
*/
|
|
101
|
-
export declare function batchPreviewProducts(products:
|
|
104
|
+
export declare function batchPreviewProducts(products: CanonicalProduct[], _creativeAgentClient: SingleAgentClient, _options?: BatchPreviewOptions): Promise<PreviewResult[]>;
|
|
102
105
|
/**
|
|
103
|
-
* Generate batch previews for formats with format_card manifests
|
|
106
|
+
* Generate batch previews for legacy named formats with format_card manifests.
|
|
104
107
|
*
|
|
105
108
|
* Formats with format_card fields will have their cards rendered via the creative agent.
|
|
106
109
|
* Formats without format_card will be returned with no preview.
|
|
@@ -119,7 +122,7 @@ export declare function batchPreviewProducts(products: Product[], _creativeAgent
|
|
|
119
122
|
* protocol: 'mcp'
|
|
120
123
|
* });
|
|
121
124
|
*
|
|
122
|
-
* const previews = await
|
|
125
|
+
* const previews = await batchPreviewFormatsLegacy(formats, creativeAgent);
|
|
123
126
|
* previews.forEach(p => {
|
|
124
127
|
* if (p.previewUrl) {
|
|
125
128
|
* console.log(`${(p.item as Format).name}: ${p.previewUrl}`);
|
|
@@ -127,5 +130,5 @@ export declare function batchPreviewProducts(products: Product[], _creativeAgent
|
|
|
127
130
|
* });
|
|
128
131
|
* ```
|
|
129
132
|
*/
|
|
130
|
-
export declare function
|
|
133
|
+
export declare function batchPreviewFormatsLegacy(formats: Format[], creativeAgentClient: SingleAgentClient, options?: BatchPreviewOptions): Promise<LegacyPreviewResult[]>;
|
|
131
134
|
//# sourceMappingURL=preview-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/preview-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAA+C,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"preview-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/preview-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAA+C,MAAM,0BAA0B,CAAC;AAE7G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,KAAK,GAAG,gBAAgB;IACrD,gCAAgC;IAChC,IAAI,EAAE,KAAK,CAAC;IACZ,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAC5G,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,MAAM,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,KAAK,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAqFD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,oBAAoB,EAAE,iBAAiB,EACvC,QAAQ,GAAE,mBAAwB,GACjC,OAAO,CAAC,aAAa,EAAE,CAAC,CAQ1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,MAAM,EAAE,EACjB,mBAAmB,EAAE,iBAAiB,EACtC,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CA2IhC"}
|
|
@@ -18,7 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var preview_utils_exports = {};
|
|
20
20
|
__export(preview_utils_exports, {
|
|
21
|
-
|
|
21
|
+
batchPreviewFormatsLegacy: () => batchPreviewFormatsLegacy,
|
|
22
22
|
batchPreviewProducts: () => batchPreviewProducts,
|
|
23
23
|
clearPreviewCache: () => clearPreviewCache
|
|
24
24
|
});
|
|
@@ -78,7 +78,7 @@ async function batchPreviewProducts(products, _creativeAgentClient, _options = {
|
|
|
78
78
|
return { item: product };
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
async function
|
|
81
|
+
async function batchPreviewFormatsLegacy(formats, creativeAgentClient, options = {}) {
|
|
82
82
|
const cacheTtl = options.cacheTtl ?? 36e5;
|
|
83
83
|
const skipCache = options.skipCache ?? false;
|
|
84
84
|
const cacheBackend = options.cacheBackend ?? defaultPreviewCacheBackend;
|
|
@@ -138,7 +138,7 @@ async function batchPreviewFormats(formats, creativeAgentClient, options = {}) {
|
|
|
138
138
|
// manifest contains the asset map (format, etc)
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
|
-
const response = await creativeAgentClient.
|
|
141
|
+
const response = await creativeAgentClient.previewCreativeLegacy(previewRequest);
|
|
142
142
|
const responseData = response.data;
|
|
143
143
|
if (responseData && "previews" in responseData && responseData.previews && responseData.previews.length > 0) {
|
|
144
144
|
const preview = responseData.previews[0];
|
|
@@ -185,7 +185,7 @@ async function batchPreviewFormats(formats, creativeAgentClient, options = {}) {
|
|
|
185
185
|
}
|
|
186
186
|
// Annotate the CommonJS export names for ESM import in node:
|
|
187
187
|
0 && (module.exports = {
|
|
188
|
-
|
|
188
|
+
batchPreviewFormatsLegacy,
|
|
189
189
|
batchPreviewProducts,
|
|
190
190
|
clearPreviewCache
|
|
191
191
|
});
|