@adcp/sdk 12.0.0 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/adapters/content-standards-adapter.mjs +0 -6
- package/dist/lib/adapters/content-standards-adapter.mjs.map +1 -1
- package/dist/lib/adapters/derived-account-store.mjs +0 -6
- package/dist/lib/adapters/derived-account-store.mjs.map +1 -1
- package/dist/lib/adapters/governance-adapter.mjs +0 -6
- package/dist/lib/adapters/governance-adapter.mjs.map +1 -1
- package/dist/lib/adapters/implicit-account-store.mjs +0 -6
- package/dist/lib/adapters/implicit-account-store.mjs.map +1 -1
- package/dist/lib/adapters/index.mjs +0 -6
- package/dist/lib/adapters/index.mjs.map +1 -1
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.mjs +0 -6
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.mjs.map +1 -1
- package/dist/lib/adapters/legacy/v2-5/get_products.mjs +0 -6
- package/dist/lib/adapters/legacy/v2-5/get_products.mjs.map +1 -1
- package/dist/lib/adapters/legacy/v2-5/index.mjs +0 -6
- package/dist/lib/adapters/legacy/v2-5/index.mjs.map +1 -1
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.mjs +0 -6
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.mjs.map +1 -1
- package/dist/lib/adapters/legacy/v2-5/preview_creative.mjs +0 -6
- package/dist/lib/adapters/legacy/v2-5/preview_creative.mjs.map +1 -1
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.mjs +0 -6
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.mjs.map +1 -1
- package/dist/lib/adapters/legacy/v2-5/types.mjs +0 -6
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.mjs +0 -6
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.mjs.map +1 -1
- package/dist/lib/adapters/oauth-passthrough-resolver.mjs +0 -6
- package/dist/lib/adapters/oauth-passthrough-resolver.mjs.map +1 -1
- package/dist/lib/adapters/property-list-adapter.mjs +0 -6
- package/dist/lib/adapters/property-list-adapter.mjs.map +1 -1
- package/dist/lib/adapters/roster-account-store.mjs +0 -6
- package/dist/lib/adapters/roster-account-store.mjs.map +1 -1
- package/dist/lib/adapters/si-session-manager.mjs +0 -6
- package/dist/lib/adapters/si-session-manager.mjs.map +1 -1
- package/dist/lib/adapters/version/3.0/brand-fields.mjs +0 -6
- package/dist/lib/adapters/version/3.0/brand-fields.mjs.map +1 -1
- package/dist/lib/adapters/version/3.0/get-products.mjs +0 -6
- package/dist/lib/adapters/version/3.0/get-products.mjs.map +1 -1
- package/dist/lib/adapters/version/3.0/index.mjs +0 -6
- package/dist/lib/adapters/version/3.0/index.mjs.map +1 -1
- package/dist/lib/adapters/version/3.0/sync-accounts.mjs +0 -6
- package/dist/lib/adapters/version/3.0/sync-accounts.mjs.map +1 -1
- package/dist/lib/adapters/version/index.mjs +0 -6
- package/dist/lib/adapters/version/index.mjs.map +1 -1
- package/dist/lib/adapters/version/types.mjs +0 -6
- package/dist/lib/advanced.mjs +0 -6
- package/dist/lib/advanced.mjs.map +1 -1
- package/dist/lib/agents/index.generated.mjs +0 -6
- package/dist/lib/agents/index.generated.mjs.map +1 -1
- package/dist/lib/auth/index.mjs +0 -6
- package/dist/lib/auth/index.mjs.map +1 -1
- package/dist/lib/auth/oauth/CLIFlowHandler.mjs +0 -6
- package/dist/lib/auth/oauth/CLIFlowHandler.mjs.map +1 -1
- package/dist/lib/auth/oauth/ClientCredentialsFlow.mjs +0 -6
- package/dist/lib/auth/oauth/ClientCredentialsFlow.mjs.map +1 -1
- package/dist/lib/auth/oauth/MCPOAuthProvider.mjs +0 -6
- package/dist/lib/auth/oauth/MCPOAuthProvider.mjs.map +1 -1
- package/dist/lib/auth/oauth/NonInteractiveFlowHandler.mjs +0 -6
- package/dist/lib/auth/oauth/NonInteractiveFlowHandler.mjs.map +1 -1
- package/dist/lib/auth/oauth/authorization-required.mjs +0 -6
- package/dist/lib/auth/oauth/authorization-required.mjs.map +1 -1
- package/dist/lib/auth/oauth/diagnose.mjs +0 -6
- package/dist/lib/auth/oauth/diagnose.mjs.map +1 -1
- package/dist/lib/auth/oauth/diagnostics.mjs +0 -6
- package/dist/lib/auth/oauth/diagnostics.mjs.map +1 -1
- package/dist/lib/auth/oauth/discovery.mjs +0 -6
- package/dist/lib/auth/oauth/discovery.mjs.map +1 -1
- package/dist/lib/auth/oauth/file-storage.mjs +0 -6
- package/dist/lib/auth/oauth/file-storage.mjs.map +1 -1
- package/dist/lib/auth/oauth/index.mjs +0 -6
- package/dist/lib/auth/oauth/index.mjs.map +1 -1
- package/dist/lib/auth/oauth/secret-resolver.mjs +0 -6
- package/dist/lib/auth/oauth/secret-resolver.mjs.map +1 -1
- package/dist/lib/auth/oauth/storage-registry.mjs +0 -6
- package/dist/lib/auth/oauth/storage-registry.mjs.map +1 -1
- package/dist/lib/auth/oauth/types.mjs +0 -6
- package/dist/lib/auth/oauth/types.mjs.map +1 -1
- package/dist/lib/auth/oauth/web-flow.mjs +0 -6
- package/dist/lib/auth/oauth/web-flow.mjs.map +1 -1
- package/dist/lib/brand/index.mjs +0 -6
- package/dist/lib/brand/index.mjs.map +1 -1
- package/dist/lib/canonical-references/index.mjs +6 -7
- package/dist/lib/canonical-references/index.mjs.map +1 -1
- package/dist/lib/client/index.mjs +0 -6
- package/dist/lib/client/index.mjs.map +1 -1
- package/dist/lib/compliance/index.mjs +0 -6
- package/dist/lib/compliance/index.mjs.map +1 -1
- package/dist/lib/compliance-fixtures/index.mjs +0 -6
- package/dist/lib/compliance-fixtures/index.mjs.map +1 -1
- package/dist/lib/compliance-fixtures/test-authorization-server.mjs +0 -6
- package/dist/lib/compliance-fixtures/test-authorization-server.mjs.map +1 -1
- package/dist/lib/conformance/index.mjs +0 -6
- package/dist/lib/conformance/index.mjs.map +1 -1
- package/dist/lib/conformance/invariants/uniformError.mjs +0 -6
- package/dist/lib/conformance/invariants/uniformError.mjs.map +1 -1
- package/dist/lib/conformance/invariants/uniformErrorComparator.mjs +0 -6
- package/dist/lib/conformance/invariants/uniformErrorComparator.mjs.map +1 -1
- package/dist/lib/conformance/oracle.mjs +0 -6
- package/dist/lib/conformance/oracle.mjs.map +1 -1
- package/dist/lib/conformance/runConformance.mjs +0 -6
- package/dist/lib/conformance/runConformance.mjs.map +1 -1
- package/dist/lib/conformance/runners.mjs +0 -6
- package/dist/lib/conformance/runners.mjs.map +1 -1
- package/dist/lib/conformance/schemaArbitrary.mjs +0 -6
- package/dist/lib/conformance/schemaArbitrary.mjs.map +1 -1
- package/dist/lib/conformance/schemaLoader.mjs +5 -6
- package/dist/lib/conformance/schemaLoader.mjs.map +1 -1
- package/dist/lib/conformance/seeder.mjs +0 -6
- package/dist/lib/conformance/seeder.mjs.map +1 -1
- package/dist/lib/conformance/types.mjs +0 -6
- package/dist/lib/conformance/types.mjs.map +1 -1
- package/dist/lib/conformance/webhook.mjs +0 -6
- package/dist/lib/conformance/webhook.mjs.map +1 -1
- package/dist/lib/core/ADCPMultiAgentClient.mjs +0 -6
- package/dist/lib/core/ADCPMultiAgentClient.mjs.map +1 -1
- package/dist/lib/core/AgentClient.mjs +0 -6
- package/dist/lib/core/AgentClient.mjs.map +1 -1
- package/dist/lib/core/AsyncHandler.mjs +0 -6
- package/dist/lib/core/AsyncHandler.mjs.map +1 -1
- package/dist/lib/core/ConfigurationManager.mjs +0 -6
- package/dist/lib/core/ConfigurationManager.mjs.map +1 -1
- package/dist/lib/core/ConversationTypes.mjs +0 -6
- package/dist/lib/core/CreativeAgentClient.mjs +0 -6
- package/dist/lib/core/CreativeAgentClient.mjs.map +1 -1
- package/dist/lib/core/GovernanceMiddleware.mjs +0 -6
- package/dist/lib/core/GovernanceMiddleware.mjs.map +1 -1
- package/dist/lib/core/GovernanceTypes.mjs +0 -6
- package/dist/lib/core/GovernanceTypes.mjs.map +1 -1
- package/dist/lib/core/ProtocolResponseParser.mjs +0 -6
- package/dist/lib/core/ProtocolResponseParser.mjs.map +1 -1
- package/dist/lib/core/ResponseValidator.mjs +0 -6
- package/dist/lib/core/ResponseValidator.mjs.map +1 -1
- package/dist/lib/core/SingleAgentClient.mjs +0 -6
- package/dist/lib/core/SingleAgentClient.mjs.map +1 -1
- package/dist/lib/core/TaskEventTypes.mjs +0 -6
- package/dist/lib/core/TaskEventTypes.mjs.map +1 -1
- package/dist/lib/core/TaskExecutor.mjs +0 -6
- package/dist/lib/core/TaskExecutor.mjs.map +1 -1
- package/dist/lib/core/match.mjs +0 -6
- package/dist/lib/core/match.mjs.map +1 -1
- package/dist/lib/core/task-status.mjs +0 -6
- package/dist/lib/core/task-status.mjs.map +1 -1
- package/dist/lib/core/webhook-url.mjs +0 -6
- package/dist/lib/core/webhook-url.mjs.map +1 -1
- package/dist/lib/discovery/adagents-redirects.mjs +0 -6
- package/dist/lib/discovery/adagents-redirects.mjs.map +1 -1
- package/dist/lib/discovery/agent-directory.mjs +0 -6
- package/dist/lib/discovery/agent-directory.mjs.map +1 -1
- package/dist/lib/discovery/inline-publisher-properties.mjs +0 -6
- package/dist/lib/discovery/inline-publisher-properties.mjs.map +1 -1
- package/dist/lib/discovery/network-consistency-checker.mjs +0 -6
- package/dist/lib/discovery/network-consistency-checker.mjs.map +1 -1
- package/dist/lib/discovery/property-crawler.mjs +0 -6
- package/dist/lib/discovery/property-crawler.mjs.map +1 -1
- package/dist/lib/discovery/property-index.mjs +0 -6
- package/dist/lib/discovery/property-index.mjs.map +1 -1
- package/dist/lib/discovery/publisher-property-selector.mjs +0 -6
- package/dist/lib/discovery/publisher-property-selector.mjs.map +1 -1
- package/dist/lib/discovery/resolve-agent-properties.mjs +0 -6
- package/dist/lib/discovery/resolve-agent-properties.mjs.map +1 -1
- package/dist/lib/discovery/types.mjs +0 -6
- package/dist/lib/discovery/validate-adagents.mjs +0 -6
- package/dist/lib/discovery/validate-adagents.mjs.map +1 -1
- package/dist/lib/enums.mjs +0 -6
- package/dist/lib/enums.mjs.map +1 -1
- package/dist/lib/errors/index.mjs +0 -6
- package/dist/lib/errors/index.mjs.map +1 -1
- package/dist/lib/express-mcp/index.mjs +0 -6
- package/dist/lib/express-mcp/index.mjs.map +1 -1
- package/dist/lib/governance/index.mjs +0 -6
- package/dist/lib/governance/index.mjs.map +1 -1
- package/dist/lib/handlers/types.mjs +0 -6
- package/dist/lib/handlers/types.mjs.map +1 -1
- package/dist/lib/index.mjs +0 -6
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/media-buy/available-actions.mjs +0 -6
- package/dist/lib/media-buy/available-actions.mjs.map +1 -1
- package/dist/lib/media-buy/index.mjs +0 -6
- package/dist/lib/media-buy/index.mjs.map +1 -1
- package/dist/lib/media-buy/preflight.mjs +0 -6
- package/dist/lib/media-buy/preflight.mjs.map +1 -1
- package/dist/lib/media-buy/property-policy.mjs +0 -6
- package/dist/lib/media-buy/property-policy.mjs.map +1 -1
- package/dist/lib/media-buy/types.mjs +0 -6
- package/dist/lib/media-buy/types.mjs.map +1 -1
- package/dist/lib/media-buy/update-fields.generated.mjs +0 -6
- package/dist/lib/media-buy/update-fields.generated.mjs.map +1 -1
- package/dist/lib/mock-server/creative-ad-server/seed-data.mjs +0 -6
- package/dist/lib/mock-server/creative-ad-server/seed-data.mjs.map +1 -1
- package/dist/lib/mock-server/creative-ad-server/server.mjs +0 -6
- package/dist/lib/mock-server/creative-ad-server/server.mjs.map +1 -1
- package/dist/lib/mock-server/creative-template/seed-data.mjs +0 -6
- package/dist/lib/mock-server/creative-template/seed-data.mjs.map +1 -1
- package/dist/lib/mock-server/creative-template/server.mjs +0 -6
- package/dist/lib/mock-server/creative-template/server.mjs.map +1 -1
- package/dist/lib/mock-server/index.mjs +0 -6
- package/dist/lib/mock-server/index.mjs.map +1 -1
- package/dist/lib/mock-server/sales-guaranteed/recipe.mjs +0 -6
- package/dist/lib/mock-server/sales-guaranteed/recipe.mjs.map +1 -1
- package/dist/lib/mock-server/sales-guaranteed/seed-data.mjs +0 -6
- package/dist/lib/mock-server/sales-guaranteed/seed-data.mjs.map +1 -1
- package/dist/lib/mock-server/sales-guaranteed/server.mjs +0 -6
- package/dist/lib/mock-server/sales-guaranteed/server.mjs.map +1 -1
- package/dist/lib/mock-server/sales-non-guaranteed/recipe.mjs +0 -6
- package/dist/lib/mock-server/sales-non-guaranteed/recipe.mjs.map +1 -1
- package/dist/lib/mock-server/sales-non-guaranteed/seed-data.mjs +0 -6
- package/dist/lib/mock-server/sales-non-guaranteed/seed-data.mjs.map +1 -1
- package/dist/lib/mock-server/sales-non-guaranteed/server.mjs +0 -6
- package/dist/lib/mock-server/sales-non-guaranteed/server.mjs.map +1 -1
- package/dist/lib/mock-server/sales-social/seed-data.mjs +0 -6
- package/dist/lib/mock-server/sales-social/seed-data.mjs.map +1 -1
- package/dist/lib/mock-server/sales-social/server.mjs +0 -6
- package/dist/lib/mock-server/sales-social/server.mjs.map +1 -1
- package/dist/lib/mock-server/scenario.mjs +0 -6
- package/dist/lib/mock-server/scenario.mjs.map +1 -1
- package/dist/lib/mock-server/signal-marketplace/seed-data.mjs +0 -6
- package/dist/lib/mock-server/signal-marketplace/seed-data.mjs.map +1 -1
- package/dist/lib/mock-server/signal-marketplace/server.mjs +0 -6
- package/dist/lib/mock-server/signal-marketplace/server.mjs.map +1 -1
- package/dist/lib/mock-server/sponsored-intelligence/seed-data.mjs +0 -6
- package/dist/lib/mock-server/sponsored-intelligence/seed-data.mjs.map +1 -1
- package/dist/lib/mock-server/sponsored-intelligence/server.mjs +0 -6
- package/dist/lib/mock-server/sponsored-intelligence/server.mjs.map +1 -1
- package/dist/lib/net/address-guards.mjs +0 -6
- package/dist/lib/net/address-guards.mjs.map +1 -1
- package/dist/lib/net/index.mjs +0 -6
- package/dist/lib/net/index.mjs.map +1 -1
- package/dist/lib/net/ssrf-fetch.mjs +0 -6
- package/dist/lib/net/ssrf-fetch.mjs.map +1 -1
- package/dist/lib/observability/index.mjs +0 -6
- package/dist/lib/observability/index.mjs.map +1 -1
- package/dist/lib/observability/tracing.mjs +6 -7
- package/dist/lib/observability/tracing.mjs.map +1 -1
- package/dist/lib/protocols/a2a.mjs +0 -6
- package/dist/lib/protocols/a2a.mjs.map +1 -1
- package/dist/lib/protocols/abort.mjs +0 -6
- package/dist/lib/protocols/abort.mjs.map +1 -1
- package/dist/lib/protocols/index.mjs +0 -6
- package/dist/lib/protocols/index.mjs.map +1 -1
- package/dist/lib/protocols/mcp-modern.mjs +0 -6
- package/dist/lib/protocols/mcp-modern.mjs.map +1 -1
- package/dist/lib/protocols/mcp-tasks.mjs +0 -6
- package/dist/lib/protocols/mcp-tasks.mjs.map +1 -1
- package/dist/lib/protocols/mcp.mjs +0 -6
- package/dist/lib/protocols/mcp.mjs.map +1 -1
- package/dist/lib/protocols/rawResponseCapture.mjs +0 -6
- package/dist/lib/protocols/rawResponseCapture.mjs.map +1 -1
- package/dist/lib/protocols/responseSizeLimit.mjs +0 -6
- package/dist/lib/protocols/responseSizeLimit.mjs.map +1 -1
- package/dist/lib/protocols/transportDiagnostics.mjs +0 -6
- package/dist/lib/protocols/transportDiagnostics.mjs.map +1 -1
- package/dist/lib/registry/cursor-store.mjs +0 -6
- package/dist/lib/registry/cursor-store.mjs.map +1 -1
- package/dist/lib/registry/feed-stream.mjs +0 -6
- package/dist/lib/registry/feed-stream.mjs.map +1 -1
- package/dist/lib/registry/index.mjs +0 -6
- package/dist/lib/registry/index.mjs.map +1 -1
- package/dist/lib/registry/property-registry.mjs +0 -6
- package/dist/lib/registry/property-registry.mjs.map +1 -1
- package/dist/lib/registry/sync.mjs +0 -6
- package/dist/lib/registry/sync.mjs.map +1 -1
- package/dist/lib/registry/types.generated.mjs +0 -6
- package/dist/lib/registry/types.mjs +0 -6
- package/dist/lib/schemas/index.mjs +0 -6
- package/dist/lib/schemas/index.mjs.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/a2a-adapter.mjs +0 -6
- package/dist/lib/server/a2a-adapter.mjs.map +1 -1
- package/dist/lib/server/account-mode.mjs +0 -6
- package/dist/lib/server/account-mode.mjs.map +1 -1
- package/dist/lib/server/adcp-server.mjs +0 -6
- package/dist/lib/server/adcp-server.mjs.map +1 -1
- package/dist/lib/server/auth-introspection.mjs +0 -6
- package/dist/lib/server/auth-introspection.mjs.map +1 -1
- package/dist/lib/server/auth-signature.mjs +0 -6
- package/dist/lib/server/auth-signature.mjs.map +1 -1
- package/dist/lib/server/auth.mjs +0 -6
- package/dist/lib/server/auth.mjs.map +1 -1
- package/dist/lib/server/create-adcp-server.mjs +0 -6
- package/dist/lib/server/create-adcp-server.mjs.map +1 -1
- package/dist/lib/server/credential-policy.mjs +0 -6
- package/dist/lib/server/credential-policy.mjs.map +1 -1
- package/dist/lib/server/ctx-metadata/backends/memory.mjs +0 -6
- package/dist/lib/server/ctx-metadata/backends/memory.mjs.map +1 -1
- package/dist/lib/server/ctx-metadata/backends/pg.mjs +0 -6
- package/dist/lib/server/ctx-metadata/backends/pg.mjs.map +1 -1
- package/dist/lib/server/ctx-metadata/backends/redis.mjs +0 -6
- package/dist/lib/server/ctx-metadata/backends/redis.mjs.map +1 -1
- package/dist/lib/server/ctx-metadata/index.mjs +0 -6
- package/dist/lib/server/ctx-metadata/index.mjs.map +1 -1
- package/dist/lib/server/ctx-metadata/store.mjs +0 -6
- package/dist/lib/server/ctx-metadata/store.mjs.map +1 -1
- package/dist/lib/server/ctx-metadata/wire-shape.mjs +0 -6
- package/dist/lib/server/ctx-metadata/wire-shape.mjs.map +1 -1
- package/dist/lib/server/decisioning/account.mjs +0 -6
- package/dist/lib/server/decisioning/account.mjs.map +1 -1
- package/dist/lib/server/decisioning/admin-router.mjs +0 -6
- package/dist/lib/server/decisioning/admin-router.mjs.map +1 -1
- package/dist/lib/server/decisioning/assembly-helpers.mjs +0 -6
- package/dist/lib/server/decisioning/assembly-helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/async-outcome.mjs +0 -6
- package/dist/lib/server/decisioning/async-outcome.mjs.map +1 -1
- package/dist/lib/server/decisioning/buyer-agent.mjs +0 -6
- package/dist/lib/server/decisioning/buyer-agent.mjs.map +1 -1
- package/dist/lib/server/decisioning/capabilities.mjs +0 -6
- package/dist/lib/server/decisioning/capabilities.mjs.map +1 -1
- package/dist/lib/server/decisioning/compose.mjs +0 -6
- package/dist/lib/server/decisioning/compose.mjs.map +1 -1
- package/dist/lib/server/decisioning/context.mjs +0 -6
- package/dist/lib/server/decisioning/errors-typed.mjs +0 -6
- package/dist/lib/server/decisioning/errors-typed.mjs.map +1 -1
- package/dist/lib/server/decisioning/helpers.mjs +0 -6
- package/dist/lib/server/decisioning/helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/index.mjs +0 -6
- package/dist/lib/server/decisioning/index.mjs.map +1 -1
- package/dist/lib/server/decisioning/list-helpers.mjs +0 -6
- package/dist/lib/server/decisioning/list-helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.mjs +0 -6
- package/dist/lib/server/decisioning/manifest-helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/pagination.mjs +0 -6
- package/dist/lib/server/decisioning/platform-helpers.mjs +0 -6
- package/dist/lib/server/decisioning/platform-helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/platform.mjs +0 -6
- package/dist/lib/server/decisioning/proposal/dispatch.mjs +0 -6
- package/dist/lib/server/decisioning/proposal/dispatch.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/index.mjs +0 -6
- package/dist/lib/server/decisioning/proposal/index.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/lifecycle.mjs +0 -6
- package/dist/lib/server/decisioning/proposal/lifecycle.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/mock-manager.mjs +0 -6
- package/dist/lib/server/decisioning/proposal/mock-manager.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/store.mjs +0 -6
- package/dist/lib/server/decisioning/proposal/store.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/types.mjs +0 -6
- package/dist/lib/server/decisioning/proposal/types.mjs.map +1 -1
- package/dist/lib/server/decisioning/resolve-presets.mjs +0 -6
- package/dist/lib/server/decisioning/resolve-presets.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/entity-hydration.generated.mjs +0 -6
- package/dist/lib/server/decisioning/runtime/entity-hydration.generated.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +0 -6
- package/dist/lib/server/decisioning/runtime/from-platform.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/observed-modes.mjs +0 -6
- package/dist/lib/server/decisioning/runtime/observed-modes.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/postgres-task-registry.mjs +0 -6
- package/dist/lib/server/decisioning/runtime/postgres-task-registry.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/protocol-for-tool.mjs +0 -6
- package/dist/lib/server/decisioning/runtime/protocol-for-tool.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/task-registry.mjs +0 -6
- package/dist/lib/server/decisioning/runtime/task-registry.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/to-context.mjs +0 -6
- package/dist/lib/server/decisioning/runtime/to-context.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/validate-platform.mjs +0 -6
- package/dist/lib/server/decisioning/runtime/validate-platform.mjs.map +1 -1
- package/dist/lib/server/decisioning/specialisms/audiences.mjs +0 -6
- package/dist/lib/server/decisioning/specialisms/brand-rights.mjs +0 -6
- package/dist/lib/server/decisioning/specialisms/campaign-governance.mjs +0 -6
- package/dist/lib/server/decisioning/specialisms/content-standards.mjs +0 -6
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.mjs +0 -6
- package/dist/lib/server/decisioning/specialisms/creative.mjs +0 -6
- package/dist/lib/server/decisioning/specialisms/lists.mjs +0 -6
- package/dist/lib/server/decisioning/specialisms/sales.mjs +0 -6
- package/dist/lib/server/decisioning/specialisms/signals.mjs +0 -6
- package/dist/lib/server/decisioning/specialisms/sponsored-intelligence.mjs +0 -6
- package/dist/lib/server/decisioning/start-time.mjs +0 -6
- package/dist/lib/server/decisioning/start-time.mjs.map +1 -1
- package/dist/lib/server/decisioning/status-changes.mjs +0 -6
- package/dist/lib/server/decisioning/status-changes.mjs.map +1 -1
- package/dist/lib/server/decisioning/status-mappers.mjs +0 -6
- package/dist/lib/server/decisioning/status-mappers.mjs.map +1 -1
- package/dist/lib/server/decisioning/tenant-registry.mjs +0 -6
- package/dist/lib/server/decisioning/tenant-registry.mjs.map +1 -1
- package/dist/lib/server/decisioning/tenant-store.mjs +0 -6
- package/dist/lib/server/decisioning/tenant-store.mjs.map +1 -1
- package/dist/lib/server/decisioning/validate-specialisms.mjs +0 -6
- package/dist/lib/server/decisioning/validate-specialisms.mjs.map +1 -1
- package/dist/lib/server/dynamic-registry.mjs +0 -6
- package/dist/lib/server/dynamic-registry.mjs.map +1 -1
- package/dist/lib/server/envelope-allowlist.mjs +0 -6
- package/dist/lib/server/envelope-allowlist.mjs.map +1 -1
- package/dist/lib/server/error-arm-tools.mjs +5 -6
- package/dist/lib/server/error-arm-tools.mjs.map +1 -1
- package/dist/lib/server/errors.mjs +0 -6
- package/dist/lib/server/errors.mjs.map +1 -1
- package/dist/lib/server/example-tld-guard.mjs +0 -6
- package/dist/lib/server/example-tld-guard.mjs.map +1 -1
- package/dist/lib/server/express-adapter.mjs +0 -6
- package/dist/lib/server/express-adapter.mjs.map +1 -1
- package/dist/lib/server/governance.mjs +0 -6
- package/dist/lib/server/governance.mjs.map +1 -1
- package/dist/lib/server/idempotency/backends/lazy.mjs +0 -6
- package/dist/lib/server/idempotency/backends/lazy.mjs.map +1 -1
- package/dist/lib/server/idempotency/backends/memory.mjs +0 -6
- package/dist/lib/server/idempotency/backends/memory.mjs.map +1 -1
- package/dist/lib/server/idempotency/backends/pg.mjs +0 -6
- package/dist/lib/server/idempotency/backends/pg.mjs.map +1 -1
- package/dist/lib/server/idempotency/backends/redis.mjs +0 -6
- package/dist/lib/server/idempotency/backends/redis.mjs.map +1 -1
- package/dist/lib/server/idempotency/index.mjs +0 -6
- package/dist/lib/server/idempotency/index.mjs.map +1 -1
- package/dist/lib/server/idempotency/store.mjs +0 -6
- package/dist/lib/server/idempotency/store.mjs.map +1 -1
- package/dist/lib/server/index.mjs +0 -6
- package/dist/lib/server/index.mjs.map +1 -1
- package/dist/lib/server/legacy/v5/index.mjs +0 -6
- package/dist/lib/server/legacy/v5/index.mjs.map +1 -1
- package/dist/lib/server/mcp-modern-server.mjs +0 -6
- package/dist/lib/server/mcp-modern-server.mjs.map +1 -1
- package/dist/lib/server/media-buy-actions.mjs +0 -6
- package/dist/lib/server/media-buy-actions.mjs.map +1 -1
- package/dist/lib/server/media-buy-helpers.mjs +0 -6
- package/dist/lib/server/media-buy-helpers.mjs.map +1 -1
- package/dist/lib/server/media-buy-store.mjs +0 -6
- package/dist/lib/server/media-buy-store.mjs.map +1 -1
- package/dist/lib/server/normalize-errors.mjs +0 -6
- package/dist/lib/server/normalize-errors.mjs.map +1 -1
- package/dist/lib/server/operational-platform.mjs +0 -6
- package/dist/lib/server/operational-platform.mjs.map +1 -1
- package/dist/lib/server/pick-safe-details.mjs +0 -6
- package/dist/lib/server/pick-safe-details.mjs.map +1 -1
- package/dist/lib/server/pin-and-bind-fetch.mjs +0 -6
- package/dist/lib/server/pin-and-bind-fetch.mjs.map +1 -1
- package/dist/lib/server/postgres-state-store.mjs +0 -6
- package/dist/lib/server/postgres-state-store.mjs.map +1 -1
- package/dist/lib/server/postgres-task-store.mjs +0 -6
- package/dist/lib/server/postgres-task-store.mjs.map +1 -1
- package/dist/lib/server/product-defaults.mjs +0 -6
- package/dist/lib/server/product-defaults.mjs.map +1 -1
- package/dist/lib/server/redact.mjs +0 -6
- package/dist/lib/server/redact.mjs.map +1 -1
- package/dist/lib/server/responses.mjs +0 -6
- package/dist/lib/server/responses.mjs.map +1 -1
- package/dist/lib/server/serve.mjs +0 -6
- package/dist/lib/server/serve.mjs.map +1 -1
- package/dist/lib/server/socket-mode/conformance-client.mjs +0 -6
- package/dist/lib/server/socket-mode/conformance-client.mjs.map +1 -1
- package/dist/lib/server/socket-mode/index.mjs +0 -6
- package/dist/lib/server/socket-mode/index.mjs.map +1 -1
- package/dist/lib/server/socket-mode/ws-transport.mjs +0 -6
- package/dist/lib/server/socket-mode/ws-transport.mjs.map +1 -1
- package/dist/lib/server/state-machine.mjs +0 -6
- package/dist/lib/server/state-machine.mjs.map +1 -1
- package/dist/lib/server/state-store.mjs +0 -6
- package/dist/lib/server/state-store.mjs.map +1 -1
- package/dist/lib/server/structured-serialize.mjs +0 -6
- package/dist/lib/server/structured-serialize.mjs.map +1 -1
- package/dist/lib/server/targeting-helpers.mjs +0 -6
- package/dist/lib/server/targeting-helpers.mjs.map +1 -1
- package/dist/lib/server/tasks.mjs +0 -6
- package/dist/lib/server/tasks.mjs.map +1 -1
- package/dist/lib/server/test-controller-bridge.mjs +0 -6
- package/dist/lib/server/test-controller-bridge.mjs.map +1 -1
- package/dist/lib/server/test-controller.mjs +0 -6
- package/dist/lib/server/test-controller.mjs.map +1 -1
- package/dist/lib/server/upstream-helpers.mjs +0 -6
- package/dist/lib/server/upstream-helpers.mjs.map +1 -1
- package/dist/lib/server/webhook-emitter.mjs +0 -6
- package/dist/lib/server/webhook-emitter.mjs.map +1 -1
- package/dist/lib/server/wire-safe.mjs +0 -6
- package/dist/lib/server/wire-safe.mjs.map +1 -1
- package/dist/lib/server/wire-spec-fields.generated.mjs +0 -6
- package/dist/lib/server/wire-spec-fields.generated.mjs.map +1 -1
- package/dist/lib/server/wrap-envelope.mjs +0 -6
- package/dist/lib/server/wrap-envelope.mjs.map +1 -1
- package/dist/lib/signing/agent-context.mjs +0 -6
- package/dist/lib/signing/agent-context.mjs.map +1 -1
- package/dist/lib/signing/agent-fetch.mjs +0 -6
- package/dist/lib/signing/agent-fetch.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/canonicalize.mjs +0 -6
- package/dist/lib/signing/agent-resolver/canonicalize.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/capabilities-types.mjs +0 -6
- package/dist/lib/signing/agent-resolver/capabilities-types.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/consistency.mjs +0 -6
- package/dist/lib/signing/agent-resolver/consistency.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/errors.mjs +0 -6
- package/dist/lib/signing/agent-resolver/errors.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/etld.mjs +0 -6
- package/dist/lib/signing/agent-resolver/etld.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/fetch-helpers.mjs +0 -6
- package/dist/lib/signing/agent-resolver/fetch-helpers.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/index.mjs +0 -6
- package/dist/lib/signing/agent-resolver/index.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/jwks-set.mjs +0 -6
- package/dist/lib/signing/agent-resolver/jwks-set.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/resolve-agent.mjs +0 -6
- package/dist/lib/signing/agent-resolver/resolve-agent.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/select-agent.mjs +0 -6
- package/dist/lib/signing/agent-resolver/select-agent.mjs.map +1 -1
- package/dist/lib/signing/agent-resolver/strict-json.mjs +0 -6
- package/dist/lib/signing/agent-resolver/strict-json.mjs.map +1 -1
- package/dist/lib/signing/brand-jwks.mjs +0 -6
- package/dist/lib/signing/brand-jwks.mjs.map +1 -1
- package/dist/lib/signing/canonicalize.mjs +0 -6
- package/dist/lib/signing/canonicalize.mjs.map +1 -1
- package/dist/lib/signing/capability-cache.mjs +0 -6
- package/dist/lib/signing/capability-cache.mjs.map +1 -1
- package/dist/lib/signing/capability-priming.mjs +0 -6
- package/dist/lib/signing/capability-priming.mjs.map +1 -1
- package/dist/lib/signing/client.mjs +0 -6
- package/dist/lib/signing/client.mjs.map +1 -1
- package/dist/lib/signing/content-digest.mjs +0 -6
- package/dist/lib/signing/content-digest.mjs.map +1 -1
- package/dist/lib/signing/crypto.mjs +0 -6
- package/dist/lib/signing/crypto.mjs.map +1 -1
- package/dist/lib/signing/ecdsa-encoding.mjs +0 -6
- package/dist/lib/signing/ecdsa-encoding.mjs.map +1 -1
- package/dist/lib/signing/errors.mjs +0 -6
- package/dist/lib/signing/errors.mjs.map +1 -1
- package/dist/lib/signing/fetch-async.mjs +0 -6
- package/dist/lib/signing/fetch-async.mjs.map +1 -1
- package/dist/lib/signing/fetch.mjs +0 -6
- package/dist/lib/signing/fetch.mjs.map +1 -1
- package/dist/lib/signing/index.mjs +0 -6
- package/dist/lib/signing/index.mjs.map +1 -1
- package/dist/lib/signing/jwks-helpers.mjs +0 -6
- package/dist/lib/signing/jwks-helpers.mjs.map +1 -1
- package/dist/lib/signing/jwks-https.mjs +0 -6
- package/dist/lib/signing/jwks-https.mjs.map +1 -1
- package/dist/lib/signing/jwks.mjs +0 -6
- package/dist/lib/signing/jwks.mjs.map +1 -1
- package/dist/lib/signing/middleware.mjs +0 -6
- package/dist/lib/signing/middleware.mjs.map +1 -1
- package/dist/lib/signing/parser.mjs +0 -6
- package/dist/lib/signing/parser.mjs.map +1 -1
- package/dist/lib/signing/postgres-replay-store.mjs +0 -6
- package/dist/lib/signing/postgres-replay-store.mjs.map +1 -1
- package/dist/lib/signing/protocol-response.mjs +0 -6
- package/dist/lib/signing/protocol-response.mjs.map +1 -1
- package/dist/lib/signing/provider.mjs +0 -6
- package/dist/lib/signing/redis-replay-store.mjs +0 -6
- package/dist/lib/signing/redis-replay-store.mjs.map +1 -1
- package/dist/lib/signing/replay.mjs +0 -6
- package/dist/lib/signing/replay.mjs.map +1 -1
- package/dist/lib/signing/request-context.mjs +0 -6
- package/dist/lib/signing/request-context.mjs.map +1 -1
- package/dist/lib/signing/revocation-https.mjs +0 -6
- package/dist/lib/signing/revocation-https.mjs.map +1 -1
- package/dist/lib/signing/revocation.mjs +0 -6
- package/dist/lib/signing/revocation.mjs.map +1 -1
- package/dist/lib/signing/server.mjs +0 -6
- package/dist/lib/signing/server.mjs.map +1 -1
- package/dist/lib/signing/signer-async.mjs +0 -6
- package/dist/lib/signing/signer-async.mjs.map +1 -1
- package/dist/lib/signing/signer.mjs +0 -6
- package/dist/lib/signing/signer.mjs.map +1 -1
- package/dist/lib/signing/testing.mjs +0 -6
- package/dist/lib/signing/testing.mjs.map +1 -1
- package/dist/lib/signing/types.mjs +0 -6
- package/dist/lib/signing/types.mjs.map +1 -1
- package/dist/lib/signing/verifier.mjs +0 -6
- package/dist/lib/signing/verifier.mjs.map +1 -1
- package/dist/lib/signing/webhook-auth-detection.mjs +0 -6
- package/dist/lib/signing/webhook-auth-detection.mjs.map +1 -1
- package/dist/lib/signing/webhook-verifier.mjs +0 -6
- package/dist/lib/signing/webhook-verifier.mjs.map +1 -1
- package/dist/lib/storage/MemoryStorage.mjs +0 -6
- package/dist/lib/storage/MemoryStorage.mjs.map +1 -1
- package/dist/lib/storage/interfaces.mjs +0 -6
- package/dist/lib/substitution/encoder/SubstitutionEncoder.mjs +0 -6
- package/dist/lib/substitution/encoder/SubstitutionEncoder.mjs.map +1 -1
- package/dist/lib/substitution/encoder/index.mjs +0 -6
- package/dist/lib/substitution/encoder/index.mjs.map +1 -1
- package/dist/lib/substitution/index.mjs +0 -6
- package/dist/lib/substitution/index.mjs.map +1 -1
- package/dist/lib/substitution/observer/SubstitutionObserver.mjs +0 -6
- package/dist/lib/substitution/observer/SubstitutionObserver.mjs.map +1 -1
- package/dist/lib/substitution/observer/alignment.mjs +0 -6
- package/dist/lib/substitution/observer/alignment.mjs.map +1 -1
- package/dist/lib/substitution/observer/assertions.mjs +0 -6
- package/dist/lib/substitution/observer/assertions.mjs.map +1 -1
- package/dist/lib/substitution/observer/html-parser.mjs +0 -6
- package/dist/lib/substitution/observer/html-parser.mjs.map +1 -1
- package/dist/lib/substitution/observer/index.mjs +0 -6
- package/dist/lib/substitution/observer/index.mjs.map +1 -1
- package/dist/lib/substitution/observer/ssrf.mjs +0 -6
- package/dist/lib/substitution/observer/ssrf.mjs.map +1 -1
- package/dist/lib/substitution/rfc3986.mjs +0 -6
- package/dist/lib/substitution/rfc3986.mjs.map +1 -1
- package/dist/lib/substitution/translate.mjs +0 -6
- package/dist/lib/substitution/translate.mjs.map +1 -1
- package/dist/lib/substitution/types.mjs +0 -6
- package/dist/lib/substitution/vectors.mjs +0 -6
- package/dist/lib/substitution/vectors.mjs.map +1 -1
- package/dist/lib/testing/agent-tester.mjs +0 -6
- package/dist/lib/testing/agent-tester.mjs.map +1 -1
- package/dist/lib/testing/client.mjs +0 -6
- package/dist/lib/testing/client.mjs.map +1 -1
- package/dist/lib/testing/compliance/briefs.mjs +0 -6
- package/dist/lib/testing/compliance/briefs.mjs.map +1 -1
- package/dist/lib/testing/compliance/comply.mjs +0 -6
- package/dist/lib/testing/compliance/comply.mjs.map +1 -1
- package/dist/lib/testing/compliance/index.mjs +0 -6
- package/dist/lib/testing/compliance/index.mjs.map +1 -1
- package/dist/lib/testing/compliance/spec-conformance.mjs +0 -6
- package/dist/lib/testing/compliance/spec-conformance.mjs.map +1 -1
- package/dist/lib/testing/compliance/storyboard-tracks.mjs +0 -6
- package/dist/lib/testing/compliance/storyboard-tracks.mjs.map +1 -1
- package/dist/lib/testing/compliance/summary.mjs +0 -6
- package/dist/lib/testing/compliance/summary.mjs.map +1 -1
- package/dist/lib/testing/compliance/types.mjs +0 -6
- package/dist/lib/testing/comply-controller.mjs +0 -6
- package/dist/lib/testing/comply-controller.mjs.map +1 -1
- package/dist/lib/testing/controller-assertions.mjs +0 -6
- package/dist/lib/testing/controller-assertions.mjs.map +1 -1
- package/dist/lib/testing/formatter.mjs +0 -6
- package/dist/lib/testing/formatter.mjs.map +1 -1
- package/dist/lib/testing/index.mjs +0 -6
- package/dist/lib/testing/index.mjs.map +1 -1
- package/dist/lib/testing/local-agent-runner.mjs +0 -6
- package/dist/lib/testing/local-agent-runner.mjs.map +1 -1
- package/dist/lib/testing/orchestrator.mjs +0 -6
- package/dist/lib/testing/orchestrator.mjs.map +1 -1
- package/dist/lib/testing/personas/index.mjs +0 -6
- package/dist/lib/testing/personas/index.mjs.map +1 -1
- package/dist/lib/testing/scenarios/brand-rights.mjs +0 -6
- package/dist/lib/testing/scenarios/brand-rights.mjs.map +1 -1
- package/dist/lib/testing/scenarios/capabilities.mjs +0 -6
- package/dist/lib/testing/scenarios/capabilities.mjs.map +1 -1
- package/dist/lib/testing/scenarios/creative.mjs +0 -6
- package/dist/lib/testing/scenarios/creative.mjs.map +1 -1
- package/dist/lib/testing/scenarios/deterministic.mjs +0 -6
- package/dist/lib/testing/scenarios/deterministic.mjs.map +1 -1
- package/dist/lib/testing/scenarios/discovery.mjs +0 -6
- package/dist/lib/testing/scenarios/discovery.mjs.map +1 -1
- package/dist/lib/testing/scenarios/edge-cases.mjs +0 -6
- package/dist/lib/testing/scenarios/edge-cases.mjs.map +1 -1
- package/dist/lib/testing/scenarios/error-compliance.mjs +0 -6
- package/dist/lib/testing/scenarios/error-compliance.mjs.map +1 -1
- package/dist/lib/testing/scenarios/governance.mjs +0 -6
- package/dist/lib/testing/scenarios/governance.mjs.map +1 -1
- package/dist/lib/testing/scenarios/health.mjs +0 -6
- package/dist/lib/testing/scenarios/health.mjs.map +1 -1
- package/dist/lib/testing/scenarios/index.mjs +0 -6
- package/dist/lib/testing/scenarios/index.mjs.map +1 -1
- package/dist/lib/testing/scenarios/media-buy.mjs +0 -6
- package/dist/lib/testing/scenarios/media-buy.mjs.map +1 -1
- package/dist/lib/testing/scenarios/schema-compliance.mjs +0 -6
- package/dist/lib/testing/scenarios/schema-compliance.mjs.map +1 -1
- package/dist/lib/testing/scenarios/signals.mjs +0 -6
- package/dist/lib/testing/scenarios/signals.mjs.map +1 -1
- package/dist/lib/testing/scenarios/sponsored-intelligence.mjs +0 -6
- package/dist/lib/testing/scenarios/sponsored-intelligence.mjs.map +1 -1
- package/dist/lib/testing/scenarios/trusted-match.mjs +0 -6
- package/dist/lib/testing/scenarios/trusted-match.mjs.map +1 -1
- package/dist/lib/testing/seed-merge.mjs +0 -6
- package/dist/lib/testing/seed-merge.mjs.map +1 -1
- package/dist/lib/testing/storyboard/agent-routing.mjs +0 -6
- package/dist/lib/testing/storyboard/agent-routing.mjs.map +1 -1
- package/dist/lib/testing/storyboard/assertions.mjs +0 -6
- package/dist/lib/testing/storyboard/assertions.mjs.map +1 -1
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +0 -6
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs.map +1 -1
- package/dist/lib/testing/storyboard/compliance.mjs +5 -6
- package/dist/lib/testing/storyboard/compliance.mjs.map +1 -1
- package/dist/lib/testing/storyboard/context.mjs +0 -6
- package/dist/lib/testing/storyboard/context.mjs.map +1 -1
- package/dist/lib/testing/storyboard/default-invariants.mjs +0 -6
- package/dist/lib/testing/storyboard/default-invariants.mjs.map +1 -1
- package/dist/lib/testing/storyboard/index.mjs +0 -6
- package/dist/lib/testing/storyboard/index.mjs.map +1 -1
- package/dist/lib/testing/storyboard/junit.mjs +0 -6
- package/dist/lib/testing/storyboard/junit.mjs.map +1 -1
- package/dist/lib/testing/storyboard/loader.mjs +0 -6
- package/dist/lib/testing/storyboard/loader.mjs.map +1 -1
- package/dist/lib/testing/storyboard/parallel-dispatch.mjs +0 -6
- package/dist/lib/testing/storyboard/parallel-dispatch.mjs.map +1 -1
- package/dist/lib/testing/storyboard/path.mjs +0 -6
- package/dist/lib/testing/storyboard/path.mjs.map +1 -1
- package/dist/lib/testing/storyboard/probes.mjs +0 -6
- package/dist/lib/testing/storyboard/probes.mjs.map +1 -1
- package/dist/lib/testing/storyboard/rate-limit-trip.mjs +0 -6
- package/dist/lib/testing/storyboard/rate-limit-trip.mjs.map +1 -1
- package/dist/lib/testing/storyboard/rejection-hints.mjs +0 -6
- package/dist/lib/testing/storyboard/rejection-hints.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-builder.mjs +0 -6
- package/dist/lib/testing/storyboard/request-builder.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/builder.mjs +0 -6
- package/dist/lib/testing/storyboard/request-signing/builder.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/grader.mjs +0 -6
- package/dist/lib/testing/storyboard/request-signing/grader.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/index.mjs +0 -6
- package/dist/lib/testing/storyboard/request-signing/index.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs +0 -6
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/probe.mjs +0 -6
- package/dist/lib/testing/storyboard/request-signing/probe.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/synthesize.mjs +0 -6
- package/dist/lib/testing/storyboard/request-signing/synthesize.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/test-kit.mjs +0 -6
- package/dist/lib/testing/storyboard/request-signing/test-kit.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/types.mjs +0 -6
- package/dist/lib/testing/storyboard/request-signing/types.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +0 -6
- package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs.map +1 -1
- package/dist/lib/testing/storyboard/runner.mjs +0 -6
- package/dist/lib/testing/storyboard/runner.mjs.map +1 -1
- package/dist/lib/testing/storyboard/sandbox-entities.mjs +0 -6
- package/dist/lib/testing/storyboard/sandbox-entities.mjs.map +1 -1
- package/dist/lib/testing/storyboard/seeding.mjs +0 -6
- package/dist/lib/testing/storyboard/seeding.mjs.map +1 -1
- package/dist/lib/testing/storyboard/shape-drift-hints.mjs +0 -6
- package/dist/lib/testing/storyboard/shape-drift-hints.mjs.map +1 -1
- package/dist/lib/testing/storyboard/signer-grader/grader.mjs +0 -6
- package/dist/lib/testing/storyboard/signer-grader/grader.mjs.map +1 -1
- package/dist/lib/testing/storyboard/signer-grader/index.mjs +0 -6
- package/dist/lib/testing/storyboard/signer-grader/index.mjs.map +1 -1
- package/dist/lib/testing/storyboard/signer-grader/types.mjs +0 -6
- package/dist/lib/testing/storyboard/strict-validation-hints.mjs +0 -6
- package/dist/lib/testing/storyboard/strict-validation-hints.mjs.map +1 -1
- package/dist/lib/testing/storyboard/task-map.mjs +0 -6
- package/dist/lib/testing/storyboard/task-map.mjs.map +1 -1
- package/dist/lib/testing/storyboard/test-kit.mjs +0 -6
- package/dist/lib/testing/storyboard/test-kit.mjs.map +1 -1
- package/dist/lib/testing/storyboard/types.mjs +0 -6
- package/dist/lib/testing/storyboard/types.mjs.map +1 -1
- package/dist/lib/testing/storyboard/validations.mjs +0 -6
- package/dist/lib/testing/storyboard/validations.mjs.map +1 -1
- package/dist/lib/testing/storyboard/webhook-assertions.mjs +0 -6
- package/dist/lib/testing/storyboard/webhook-assertions.mjs.map +1 -1
- package/dist/lib/testing/storyboard/webhook-receiver.mjs +0 -6
- package/dist/lib/testing/storyboard/webhook-receiver.mjs.map +1 -1
- package/dist/lib/testing/stubs/governance-agent-stub.mjs +0 -6
- package/dist/lib/testing/stubs/governance-agent-stub.mjs.map +1 -1
- package/dist/lib/testing/stubs/index.mjs +0 -6
- package/dist/lib/testing/stubs/index.mjs.map +1 -1
- package/dist/lib/testing/test-controller.mjs +0 -6
- package/dist/lib/testing/test-controller.mjs.map +1 -1
- package/dist/lib/testing/test-helpers.mjs +0 -6
- package/dist/lib/testing/test-helpers.mjs.map +1 -1
- package/dist/lib/testing/types.mjs +0 -6
- package/dist/lib/types/adcp.mjs +0 -6
- package/dist/lib/types/adcp.mjs.map +1 -1
- package/dist/lib/types/asset-instances.mjs +0 -6
- package/dist/lib/types/compat.mjs +0 -6
- package/dist/lib/types/compat.mjs.map +1 -1
- package/dist/lib/types/core.generated.mjs +0 -6
- package/dist/lib/types/enums.generated.mjs +0 -6
- package/dist/lib/types/enums.generated.mjs.map +1 -1
- package/dist/lib/types/error-codes.mjs +0 -6
- package/dist/lib/types/error-codes.mjs.map +1 -1
- package/dist/lib/types/error-details.aliases.mjs +0 -6
- package/dist/lib/types/error-details.aliases.mjs.map +1 -1
- package/dist/lib/types/format-asset-slots.mjs +0 -6
- package/dist/lib/types/forward-compat-error-codes.mjs +0 -6
- package/dist/lib/types/forward-compat-error-codes.mjs.map +1 -1
- package/dist/lib/types/index.mjs +0 -6
- package/dist/lib/types/index.mjs.map +1 -1
- package/dist/lib/types/inline-enums.aliases.mjs +0 -6
- package/dist/lib/types/inline-enums.aliases.mjs.map +1 -1
- package/dist/lib/types/inline-enums.generated.mjs +0 -6
- package/dist/lib/types/inline-enums.generated.mjs.map +1 -1
- package/dist/lib/types/manifest.generated.mjs +0 -6
- package/dist/lib/types/manifest.generated.mjs.map +1 -1
- package/dist/lib/types/schemas.generated.mjs +0 -6
- package/dist/lib/types/schemas.generated.mjs.map +1 -1
- package/dist/lib/types/server-payload-aliases.mjs +0 -6
- package/dist/lib/types/server-payload.mjs +0 -6
- package/dist/lib/types/sync-rows.mjs +0 -6
- package/dist/lib/types/tools.generated.mjs +0 -6
- package/dist/lib/types/v2-5/index.mjs +0 -6
- package/dist/lib/types/v2-5/index.mjs.map +1 -1
- package/dist/lib/types/v2-5/tools.generated.mjs +0 -6
- package/dist/lib/types/v3-1-beta/index.mjs +0 -6
- package/dist/lib/types/v3-1-beta/index.mjs.map +1 -1
- package/dist/lib/types/v3-1-beta/tools.generated.mjs +0 -6
- package/dist/lib/types/wellknown-schemas.generated.mjs +0 -6
- package/dist/lib/types/wellknown-schemas.generated.mjs.map +1 -1
- package/dist/lib/upstream-recorder/constants.mjs +0 -6
- package/dist/lib/upstream-recorder/constants.mjs.map +1 -1
- package/dist/lib/upstream-recorder/index.mjs +0 -6
- package/dist/lib/upstream-recorder/index.mjs.map +1 -1
- package/dist/lib/upstream-recorder/recorder.mjs +0 -6
- package/dist/lib/upstream-recorder/recorder.mjs.map +1 -1
- package/dist/lib/upstream-recorder/types.mjs +0 -6
- package/dist/lib/upstream-recorder/types.mjs.map +1 -1
- package/dist/lib/utils/a2a-artifacts.mjs +0 -6
- package/dist/lib/utils/a2a-artifacts.mjs.map +1 -1
- package/dist/lib/utils/a2a-discovery.mjs +0 -6
- package/dist/lib/utils/a2a-discovery.mjs.map +1 -1
- package/dist/lib/utils/activation-key-builders.mjs +0 -6
- package/dist/lib/utils/activation-key-builders.mjs.map +1 -1
- package/dist/lib/utils/adcp-version-config.mjs +0 -6
- package/dist/lib/utils/adcp-version-config.mjs.map +1 -1
- package/dist/lib/utils/asset-builders.mjs +0 -6
- package/dist/lib/utils/asset-builders.mjs.map +1 -1
- package/dist/lib/utils/build-creative-return-builders.mjs +0 -6
- package/dist/lib/utils/build-creative-return-builders.mjs.map +1 -1
- package/dist/lib/utils/buyer-retry-policy.mjs +0 -6
- package/dist/lib/utils/buyer-retry-policy.mjs.map +1 -1
- package/dist/lib/utils/capabilities.mjs +0 -6
- package/dist/lib/utils/capabilities.mjs.map +1 -1
- package/dist/lib/utils/capability-rollups.mjs +0 -6
- package/dist/lib/utils/capability-rollups.mjs.map +1 -1
- package/dist/lib/utils/creative-adapter.mjs +0 -6
- package/dist/lib/utils/creative-adapter.mjs.map +1 -1
- package/dist/lib/utils/creative-delivery.mjs +0 -6
- package/dist/lib/utils/creative-delivery.mjs.map +1 -1
- package/dist/lib/utils/deprecation.mjs +0 -6
- package/dist/lib/utils/deprecation.mjs.map +1 -1
- package/dist/lib/utils/envelope-status-compat.mjs +0 -6
- package/dist/lib/utils/envelope-status-compat.mjs.map +1 -1
- package/dist/lib/utils/error-extraction.mjs +0 -6
- package/dist/lib/utils/error-extraction.mjs.map +1 -1
- package/dist/lib/utils/extract-result.mjs +0 -6
- package/dist/lib/utils/extract-result.mjs.map +1 -1
- package/dist/lib/utils/format-asset-slot-builders.mjs +0 -6
- package/dist/lib/utils/format-asset-slot-builders.mjs.map +1 -1
- package/dist/lib/utils/format-assets.mjs +0 -6
- package/dist/lib/utils/format-assets.mjs.map +1 -1
- package/dist/lib/utils/format-render-builders.mjs +0 -6
- package/dist/lib/utils/format-render-builders.mjs.map +1 -1
- package/dist/lib/utils/format-renders.mjs +0 -6
- package/dist/lib/utils/format-renders.mjs.map +1 -1
- package/dist/lib/utils/get-products-cache-scope.mjs +0 -6
- package/dist/lib/utils/get-products-cache-scope.mjs.map +1 -1
- package/dist/lib/utils/glob.mjs +0 -6
- package/dist/lib/utils/glob.mjs.map +1 -1
- package/dist/lib/utils/global-async-local-storage.mjs +0 -6
- package/dist/lib/utils/global-async-local-storage.mjs.map +1 -1
- package/dist/lib/utils/idempotency.mjs +0 -6
- package/dist/lib/utils/idempotency.mjs.map +1 -1
- package/dist/lib/utils/index.mjs +0 -6
- package/dist/lib/utils/index.mjs.map +1 -1
- package/dist/lib/utils/jcs.mjs +0 -6
- package/dist/lib/utils/jcs.mjs.map +1 -1
- package/dist/lib/utils/json-depth.mjs +0 -6
- package/dist/lib/utils/json-depth.mjs.map +1 -1
- package/dist/lib/utils/logger.mjs +0 -6
- package/dist/lib/utils/logger.mjs.map +1 -1
- package/dist/lib/utils/media-buy-delivery-notification-builders.mjs +0 -6
- package/dist/lib/utils/media-buy-delivery-notification-builders.mjs.map +1 -1
- package/dist/lib/utils/media-buy-status.mjs +0 -6
- package/dist/lib/utils/media-buy-status.mjs.map +1 -1
- package/dist/lib/utils/pagination.mjs +0 -6
- package/dist/lib/utils/pagination.mjs.map +1 -1
- package/dist/lib/utils/preview-creative-builders.mjs +0 -6
- package/dist/lib/utils/preview-creative-builders.mjs.map +1 -1
- package/dist/lib/utils/preview-normalizer.mjs +0 -6
- package/dist/lib/utils/preview-normalizer.mjs.map +1 -1
- package/dist/lib/utils/preview-utils.mjs +0 -6
- package/dist/lib/utils/preview-utils.mjs.map +1 -1
- package/dist/lib/utils/pricing-adapter.mjs +0 -6
- package/dist/lib/utils/pricing-adapter.mjs.map +1 -1
- package/dist/lib/utils/probe-policy.mjs +0 -6
- package/dist/lib/utils/probe-policy.mjs.map +1 -1
- package/dist/lib/utils/protocol-detection.mjs +0 -6
- package/dist/lib/utils/protocol-detection.mjs.map +1 -1
- package/dist/lib/utils/redact-secrets.mjs +0 -6
- package/dist/lib/utils/redact-secrets.mjs.map +1 -1
- package/dist/lib/utils/redis-default-prefix-warn.mjs +0 -6
- package/dist/lib/utils/redis-default-prefix-warn.mjs.map +1 -1
- package/dist/lib/utils/render-builders.mjs +0 -6
- package/dist/lib/utils/render-builders.mjs.map +1 -1
- package/dist/lib/utils/request-normalizer.mjs +0 -6
- package/dist/lib/utils/request-normalizer.mjs.map +1 -1
- package/dist/lib/utils/response-schemas.mjs +0 -6
- package/dist/lib/utils/response-schemas.mjs.map +1 -1
- package/dist/lib/utils/response-unwrapper.mjs +0 -6
- package/dist/lib/utils/response-unwrapper.mjs.map +1 -1
- package/dist/lib/utils/retry.mjs +0 -6
- package/dist/lib/utils/retry.mjs.map +1 -1
- package/dist/lib/utils/signal-discovery-helpers.mjs +0 -6
- package/dist/lib/utils/signal-discovery-helpers.mjs.map +1 -1
- package/dist/lib/utils/signal-id-builders.mjs +0 -6
- package/dist/lib/utils/signal-id-builders.mjs.map +1 -1
- package/dist/lib/utils/sync-creatives-adapter.mjs +0 -6
- package/dist/lib/utils/sync-creatives-adapter.mjs.map +1 -1
- package/dist/lib/utils/task-state.mjs +0 -6
- package/dist/lib/utils/task-state.mjs.map +1 -1
- package/dist/lib/utils/tool-request-schemas.mjs +0 -6
- package/dist/lib/utils/tool-request-schemas.mjs.map +1 -1
- package/dist/lib/utils/typeGuards.mjs +0 -6
- package/dist/lib/utils/typeGuards.mjs.map +1 -1
- package/dist/lib/utils/union-errors.mjs +0 -6
- package/dist/lib/utils/union-errors.mjs.map +1 -1
- package/dist/lib/utils/validate-user-agent.mjs +0 -6
- package/dist/lib/utils/validate-user-agent.mjs.map +1 -1
- package/dist/lib/v2/format-schema/fetch.mjs +0 -6
- package/dist/lib/v2/format-schema/fetch.mjs.map +1 -1
- package/dist/lib/v2/format-schema/index.mjs +0 -6
- package/dist/lib/v2/format-schema/index.mjs.map +1 -1
- package/dist/lib/v2/format-schema/regex-safety.mjs +0 -6
- package/dist/lib/v2/format-schema/regex-safety.mjs.map +1 -1
- package/dist/lib/v2/format-schema/resolver.mjs +7 -8
- package/dist/lib/v2/format-schema/resolver.mjs.map +1 -1
- package/dist/lib/v2/format-schema/sandbox-refs.mjs +0 -6
- package/dist/lib/v2/format-schema/sandbox-refs.mjs.map +1 -1
- package/dist/lib/v2/projection/augment-response.mjs +0 -6
- package/dist/lib/v2/projection/augment-response.mjs.map +1 -1
- package/dist/lib/v2/projection/builders.mjs +0 -6
- package/dist/lib/v2/projection/builders.mjs.map +1 -1
- package/dist/lib/v2/projection/cache-versions.mjs +0 -6
- package/dist/lib/v2/projection/cache-versions.mjs.map +1 -1
- package/dist/lib/v2/projection/canonical-properties.mjs +5 -6
- package/dist/lib/v2/projection/canonical-properties.mjs.map +1 -1
- package/dist/lib/v2/projection/catalog.mjs +5 -6
- package/dist/lib/v2/projection/catalog.mjs.map +1 -1
- package/dist/lib/v2/projection/constants.mjs +0 -6
- package/dist/lib/v2/projection/constants.mjs.map +1 -1
- package/dist/lib/v2/projection/index.mjs +0 -6
- package/dist/lib/v2/projection/index.mjs.map +1 -1
- package/dist/lib/v2/projection/registry.mjs +5 -6
- package/dist/lib/v2/projection/registry.mjs.map +1 -1
- package/dist/lib/v2/projection/types.mjs +0 -6
- package/dist/lib/v2/projection/v1-to-v2.mjs +0 -6
- package/dist/lib/v2/projection/v1-to-v2.mjs.map +1 -1
- package/dist/lib/v2/projection/v2-to-v1.mjs +0 -6
- package/dist/lib/v2/projection/v2-to-v1.mjs.map +1 -1
- package/dist/lib/v2/projection/write-side.mjs +0 -6
- package/dist/lib/v2/projection/write-side.mjs.map +1 -1
- package/dist/lib/v2/publisher-catalog/formats.mjs +0 -6
- package/dist/lib/v2/publisher-catalog/formats.mjs.map +1 -1
- package/dist/lib/v2/publisher-catalog/index.mjs +0 -6
- package/dist/lib/v2/publisher-catalog/index.mjs.map +1 -1
- package/dist/lib/validation/client-hooks.mjs +0 -6
- package/dist/lib/validation/client-hooks.mjs.map +1 -1
- package/dist/lib/validation/hints.mjs +0 -6
- package/dist/lib/validation/hints.mjs.map +1 -1
- package/dist/lib/validation/index.mjs +0 -6
- package/dist/lib/validation/index.mjs.map +1 -1
- package/dist/lib/validation/schema-errors.mjs +0 -6
- package/dist/lib/validation/schema-errors.mjs.map +1 -1
- package/dist/lib/validation/schema-loader.mjs +5 -6
- package/dist/lib/validation/schema-loader.mjs.map +1 -1
- package/dist/lib/validation/schema-validator.mjs +0 -6
- package/dist/lib/validation/schema-validator.mjs.map +1 -1
- package/dist/lib/validation/sync-creatives.mjs +0 -6
- package/dist/lib/validation/sync-creatives.mjs.map +1 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.js.map +1 -1
- package/dist/lib/version.mjs +3 -9
- package/dist/lib/version.mjs.map +1 -1
- package/dist/lib/webhooks/index.mjs +0 -6
- package/dist/lib/webhooks/index.mjs.map +1 -1
- package/dist/lib/wholesale-feed-sync/index.mjs +0 -6
- package/dist/lib/wholesale-feed-sync/index.mjs.map +1 -1
- package/dist/lib/wholesale-feed-sync/sync.mjs +0 -6
- package/dist/lib/wholesale-feed-sync/sync.mjs.map +1 -1
- package/dist/lib/wholesale-feed-sync/types.mjs +0 -6
- package/dist/lib/wholesale-feed-sync/webhook-notification.mjs +0 -6
- package/dist/lib/wholesale-feed-sync/webhook-notification.mjs.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/adapters/property-list-adapter.ts"],"sourcesContent":["/**\n * Property List Adapter\n *\n * Server-side adapter for implementing property list management logic.\n * Publishers use this to manage buyer-defined property lists for filtering\n * available inventory.\n *\n * This is a stub implementation that stores lists in memory.\n * Publishers should extend or replace this with persistent storage.\n */\n\nimport type {\n CreatePropertyListRequest,\n CreatePropertyListResponse,\n UpdatePropertyListRequest,\n UpdatePropertyListResponse,\n GetPropertyListRequest,\n GetPropertyListResponse,\n ListPropertyListsRequest,\n ListPropertyListsResponse,\n DeletePropertyListRequest,\n DeletePropertyListResponse,\n PropertyList,\n} from '../types/tools.generated';\n\n/**\n * Resolved property identifier\n */\nexport interface ResolvedProperty {\n identifier_type: string;\n identifier_value: string;\n publisher_domain?: string;\n display_name?: string;\n status?: 'active' | 'inactive' | 'pending';\n}\n\n/**\n * Error thrown when property list operations fail\n */\nexport class PropertyListError extends Error {\n constructor(\n public code: string,\n message: string\n ) {\n super(message);\n this.name = 'PropertyListError';\n }\n}\n\n/**\n * Abstract interface for property list adapters.\n * Publishers implement this to provide their storage and resolution logic.\n */\nexport interface IPropertyListAdapter {\n /**\n * Check if property list management is supported by this server\n */\n isSupported(): boolean;\n\n /**\n * Create a new property list\n */\n createList(request: CreatePropertyListRequest): Promise<CreatePropertyListResponse>;\n\n /**\n * Update an existing property list\n */\n updateList(request: UpdatePropertyListRequest): Promise<UpdatePropertyListResponse>;\n\n /**\n * Get a property list with optional resolution\n */\n getList(request: GetPropertyListRequest): Promise<GetPropertyListResponse>;\n\n /**\n * List all property lists for an account\n */\n listLists(request: ListPropertyListsRequest): Promise<ListPropertyListsResponse>;\n\n /**\n * Delete a property list\n */\n deleteList(request: DeletePropertyListRequest): Promise<DeletePropertyListResponse>;\n\n /**\n * Check if a property identifier is in a property list.\n * Used by get_products and create_media_buy for filtering.\n */\n isPropertyInList(listId: string, identifierType: string, identifierValue: string): Promise<boolean>;\n\n /**\n * Resolve a property list to its constituent identifiers.\n * Applies filters and returns matching properties.\n */\n resolveList(listId: string, maxResults?: number, cursor?: string): Promise<ResolvedProperty[]>;\n}\n\n/**\n * Error codes for property list operations\n */\nexport const PropertyListErrorCodes = {\n NOT_SUPPORTED: 'UNSUPPORTED_FEATURE',\n LIST_NOT_FOUND: 'REFERENCE_NOT_FOUND',\n INVALID_LIST: 'INVALID_REQUEST',\n PERMISSION_DENIED: 'PERMISSION_DENIED',\n QUOTA_EXCEEDED: 'QUOTA_EXCEEDED',\n} as const;\n\n/**\n * Stub implementation of PropertyListAdapter.\n * Uses in-memory storage for development and testing.\n *\n * Publishers should extend this class or provide their own implementation\n * that integrates with their property management systems.\n */\nexport class PropertyListAdapter implements IPropertyListAdapter {\n private lists: Map<string, PropertyList> = new Map();\n private authTokens: Map<string, string> = new Map();\n private nextId = 1;\n\n /**\n * Check if property list management is supported.\n * Override this to return true when implementing real logic.\n */\n isSupported(): boolean {\n return false;\n }\n\n async createList(request: CreatePropertyListRequest): Promise<CreatePropertyListResponse> {\n if (!this.isSupported()) {\n throw new PropertyListError(\n PropertyListErrorCodes.NOT_SUPPORTED,\n 'Property list management is not supported by this server'\n );\n }\n\n // Generate ID and auth token\n const listId = `pl_${this.nextId++}_${Date.now()}`;\n const authToken = `plat_${this.generateToken()}`;\n const now = new Date().toISOString();\n\n const list: PropertyList = {\n list_id: listId,\n name: request.name,\n description: request.description,\n base_properties: request.base_properties,\n filters: request.filters,\n brand: request.brand,\n created_at: now,\n updated_at: now,\n property_count: 0,\n };\n\n this.lists.set(listId, list);\n this.authTokens.set(listId, authToken);\n\n return {\n status: 'completed',\n list,\n auth_token: authToken,\n };\n }\n\n async updateList(request: UpdatePropertyListRequest): Promise<UpdatePropertyListResponse> {\n if (!this.isSupported()) {\n throw new PropertyListError(\n PropertyListErrorCodes.NOT_SUPPORTED,\n 'Property list management is not supported by this server'\n );\n }\n\n const existing = this.lists.get(request.list_id);\n if (!existing) {\n throw new PropertyListError(PropertyListErrorCodes.LIST_NOT_FOUND, `Property list not found: ${request.list_id}`);\n }\n\n // Update fields\n const updated: PropertyList = {\n ...existing,\n name: request.name ?? existing.name,\n description: request.description ?? existing.description,\n base_properties: request.base_properties ?? existing.base_properties,\n filters: request.filters ?? existing.filters,\n brand: request.brand ?? existing.brand,\n updated_at: new Date().toISOString(),\n };\n\n this.lists.set(request.list_id, updated);\n\n return { status: 'completed', list: updated };\n }\n\n async getList(request: GetPropertyListRequest): Promise<GetPropertyListResponse> {\n if (!this.isSupported()) {\n throw new PropertyListError(\n PropertyListErrorCodes.NOT_SUPPORTED,\n 'Property list management is not supported by this server'\n );\n }\n\n const list = this.lists.get(request.list_id);\n if (!list) {\n throw new PropertyListError(PropertyListErrorCodes.LIST_NOT_FOUND, `Property list not found: ${request.list_id}`);\n }\n\n // Resolve property identifiers if requested\n let identifiers: any[] | undefined;\n if (request.resolve !== false) {\n const resolved = await this.resolveList(\n request.list_id,\n request.pagination?.max_results ?? undefined,\n request.pagination?.cursor ?? undefined\n );\n identifiers = resolved.map(p => ({\n identifier_type: p.identifier_type,\n identifier_value: p.identifier_value,\n }));\n }\n\n return {\n status: 'completed',\n list: {\n ...list,\n property_count: identifiers?.length ?? list.property_count,\n },\n identifiers,\n pagination: {\n has_more: false,\n total_count: identifiers?.length,\n },\n resolved_at: new Date().toISOString(),\n };\n }\n\n async listLists(request: ListPropertyListsRequest): Promise<ListPropertyListsResponse> {\n if (!this.isSupported()) {\n throw new PropertyListError(\n PropertyListErrorCodes.NOT_SUPPORTED,\n 'Property list management is not supported by this server'\n );\n }\n\n // Filter by account if provided. AdCP 3.0 identifies list ownership via the\n // account primitive (either account_id or brand+operator). Match on whichever\n // key the request carries.\n let lists = Array.from(this.lists.values());\n if (request.account) {\n const filter = request.account;\n lists = lists.filter(l => {\n const acct = l.account;\n if (!acct) return false;\n if ('account_id' in filter && 'account_id' in acct) {\n return filter.account_id === acct.account_id;\n }\n if ('brand' in filter && 'brand' in acct) {\n return filter.brand.domain === acct.brand.domain && filter.operator === acct.operator;\n }\n return false;\n });\n }\n\n // Filter by name if provided\n if (request.name_contains) {\n const searchTerm = request.name_contains.toLowerCase();\n lists = lists.filter(l => l.name.toLowerCase().includes(searchTerm));\n }\n\n // Apply pagination\n const maxResults = request.pagination?.max_results ?? 100;\n const paginatedLists = lists.slice(0, maxResults);\n\n return {\n status: 'completed',\n lists: paginatedLists,\n pagination: {\n has_more: paginatedLists.length < lists.length,\n total_count: lists.length,\n },\n };\n }\n\n async deleteList(request: DeletePropertyListRequest): Promise<DeletePropertyListResponse> {\n if (!this.isSupported()) {\n throw new PropertyListError(\n PropertyListErrorCodes.NOT_SUPPORTED,\n 'Property list management is not supported by this server'\n );\n }\n\n if (!this.lists.has(request.list_id)) {\n throw new PropertyListError(PropertyListErrorCodes.LIST_NOT_FOUND, `Property list not found: ${request.list_id}`);\n }\n\n this.lists.delete(request.list_id);\n this.authTokens.delete(request.list_id);\n\n return {\n status: 'completed',\n deleted: true,\n list_id: request.list_id,\n };\n }\n\n /**\n * Check if a property is in a list.\n * Stub implementation returns false (property not found).\n */\n async isPropertyInList(listId: string, identifierType: string, identifierValue: string): Promise<boolean> {\n if (!this.isSupported()) {\n // When not supported, all properties are considered in-list (no filtering)\n return true;\n }\n\n // Override in subclass to implement actual lookup\n return false;\n }\n\n /**\n * Resolve a property list to identifiers.\n * Stub implementation returns empty array.\n */\n async resolveList(listId: string, maxResults?: number, cursor?: string): Promise<ResolvedProperty[]> {\n if (!this.isSupported()) {\n return [];\n }\n\n // Override in subclass to implement actual resolution\n return [];\n }\n\n /**\n * Generate a random token for auth\n */\n protected generateToken(): string {\n const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n for (let i = 0; i < 32; i++) {\n result += chars[Math.floor(Math.random() * chars.length)];\n }\n return result;\n }\n}\n\n/**\n * Helper to check if an error is a PropertyListError\n */\nexport function isPropertyListError(error: unknown): error is PropertyListError {\n return error instanceof PropertyListError;\n}\n\n/**\n * Default singleton instance for servers that don't need property list management\n */\nexport const defaultPropertyListAdapter = new PropertyListAdapter();\n"],"mappings":";;;;;;AAuCO,MAAM,0BAA0B,MAAM;AAAA,EAC3C,YACS,MACP,SACA;AACA,UAAM,OAAO;AAHN;AAIP,SAAK,OAAO;AAAA,EACd;AAAA,EALS;AAMX;AAqDO,MAAM,yBAAyB;AAAA,EACpC,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,cAAc;AAAA,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AW,OAAO,QAAQ,OAAO;AAEtC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,SAAS,QAAQ;AAAA,IACnB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,iBAAiB,QAAgB,gBAAwB,iBAA2C;AACxG,QAAI,CAAC,KAAK,YAAY,GAAG;AAEvB,aAAO;AAAA,IACT;AAGA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,YAAY,QAAgB,YAAqB,QAA8C;AACnG,QAAI,CAAC,KAAK,YAAY,GAAG;AACvB,aAAO,CAAC;AAAA,IACV;AAGA,WAAO,CAAC;AAAA,EACV;AAAA;AAAA;AAAA;AAAA,EAKU,gBAAwB;AAChC,UAAM,QAAQ;AACd,QAAI,SAAS;AACb,aAAS,IAAI,GAAG,IAAI,IAAI,KAAK;AAC3B,gBAAU,MAAM,KAAK,MAAM,KAAK,OAAO,IAAI,MAAM,MAAM,CAAC;AAAA,IAC1D;AACA,WAAO;AAAA,EACT;AACF;AAKO,SAAS,oBAAoB,OAA4C;AAC9E,SAAO,iBAAiB;AAC1B;AAKO,MAAM,6BAA6B,IAAI,oBAAoB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/adapters/property-list-adapter.ts"],"sourcesContent":["/**\n * Property List Adapter\n *\n * Server-side adapter for implementing property list management logic.\n * Publishers use this to manage buyer-defined property lists for filtering\n * available inventory.\n *\n * This is a stub implementation that stores lists in memory.\n * Publishers should extend or replace this with persistent storage.\n */\n\nimport type {\n CreatePropertyListRequest,\n CreatePropertyListResponse,\n UpdatePropertyListRequest,\n UpdatePropertyListResponse,\n GetPropertyListRequest,\n GetPropertyListResponse,\n ListPropertyListsRequest,\n ListPropertyListsResponse,\n DeletePropertyListRequest,\n DeletePropertyListResponse,\n PropertyList,\n} from '../types/tools.generated';\n\n/**\n * Resolved property identifier\n */\nexport interface ResolvedProperty {\n identifier_type: string;\n identifier_value: string;\n publisher_domain?: string;\n display_name?: string;\n status?: 'active' | 'inactive' | 'pending';\n}\n\n/**\n * Error thrown when property list operations fail\n */\nexport class PropertyListError extends Error {\n constructor(\n public code: string,\n message: string\n ) {\n super(message);\n this.name = 'PropertyListError';\n }\n}\n\n/**\n * Abstract interface for property list adapters.\n * Publishers implement this to provide their storage and resolution logic.\n */\nexport interface IPropertyListAdapter {\n /**\n * Check if property list management is supported by this server\n */\n isSupported(): boolean;\n\n /**\n * Create a new property list\n */\n createList(request: CreatePropertyListRequest): Promise<CreatePropertyListResponse>;\n\n /**\n * Update an existing property list\n */\n updateList(request: UpdatePropertyListRequest): Promise<UpdatePropertyListResponse>;\n\n /**\n * Get a property list with optional resolution\n */\n getList(request: GetPropertyListRequest): Promise<GetPropertyListResponse>;\n\n /**\n * List all property lists for an account\n */\n listLists(request: ListPropertyListsRequest): Promise<ListPropertyListsResponse>;\n\n /**\n * Delete a property list\n */\n deleteList(request: DeletePropertyListRequest): Promise<DeletePropertyListResponse>;\n\n /**\n * Check if a property identifier is in a property list.\n * Used by get_products and create_media_buy for filtering.\n */\n isPropertyInList(listId: string, identifierType: string, identifierValue: string): Promise<boolean>;\n\n /**\n * Resolve a property list to its constituent identifiers.\n * Applies filters and returns matching properties.\n */\n resolveList(listId: string, maxResults?: number, cursor?: string): Promise<ResolvedProperty[]>;\n}\n\n/**\n * Error codes for property list operations\n */\nexport const PropertyListErrorCodes = {\n NOT_SUPPORTED: 'UNSUPPORTED_FEATURE',\n LIST_NOT_FOUND: 'REFERENCE_NOT_FOUND',\n INVALID_LIST: 'INVALID_REQUEST',\n PERMISSION_DENIED: 'PERMISSION_DENIED',\n QUOTA_EXCEEDED: 'QUOTA_EXCEEDED',\n} as const;\n\n/**\n * Stub implementation of PropertyListAdapter.\n * Uses in-memory storage for development and testing.\n *\n * Publishers should extend this class or provide their own implementation\n * that integrates with their property management systems.\n */\nexport class PropertyListAdapter implements IPropertyListAdapter {\n private lists: Map<string, PropertyList> = new Map();\n private authTokens: Map<string, string> = new Map();\n private nextId = 1;\n\n /**\n * Check if property list management is supported.\n * Override this to return true when implementing real logic.\n */\n isSupported(): boolean {\n return false;\n }\n\n async createList(request: CreatePropertyListRequest): Promise<CreatePropertyListResponse> {\n if (!this.isSupported()) {\n throw new PropertyListError(\n PropertyListErrorCodes.NOT_SUPPORTED,\n 'Property list management is not supported by this server'\n );\n }\n\n // Generate ID and auth token\n const listId = `pl_${this.nextId++}_${Date.now()}`;\n const authToken = `plat_${this.generateToken()}`;\n const now = new Date().toISOString();\n\n const list: PropertyList = {\n list_id: listId,\n name: request.name,\n description: request.description,\n base_properties: request.base_properties,\n filters: request.filters,\n brand: request.brand,\n created_at: now,\n updated_at: now,\n property_count: 0,\n };\n\n this.lists.set(listId, list);\n this.authTokens.set(listId, authToken);\n\n return {\n status: 'completed',\n list,\n auth_token: authToken,\n };\n }\n\n async updateList(request: UpdatePropertyListRequest): Promise<UpdatePropertyListResponse> {\n if (!this.isSupported()) {\n throw new PropertyListError(\n PropertyListErrorCodes.NOT_SUPPORTED,\n 'Property list management is not supported by this server'\n );\n }\n\n const existing = this.lists.get(request.list_id);\n if (!existing) {\n throw new PropertyListError(PropertyListErrorCodes.LIST_NOT_FOUND, `Property list not found: ${request.list_id}`);\n }\n\n // Update fields\n const updated: PropertyList = {\n ...existing,\n name: request.name ?? existing.name,\n description: request.description ?? existing.description,\n base_properties: request.base_properties ?? existing.base_properties,\n filters: request.filters ?? existing.filters,\n brand: request.brand ?? existing.brand,\n updated_at: new Date().toISOString(),\n };\n\n this.lists.set(request.list_id, updated);\n\n return { status: 'completed', list: updated };\n }\n\n async getList(request: GetPropertyListRequest): Promise<GetPropertyListResponse> {\n if (!this.isSupported()) {\n throw new PropertyListError(\n PropertyListErrorCodes.NOT_SUPPORTED,\n 'Property list management is not supported by this server'\n );\n }\n\n const list = this.lists.get(request.list_id);\n if (!list) {\n throw new PropertyListError(PropertyListErrorCodes.LIST_NOT_FOUND, `Property list not found: ${request.list_id}`);\n }\n\n // Resolve property identifiers if requested\n let identifiers: any[] | undefined;\n if (request.resolve !== false) {\n const resolved = await this.resolveList(\n request.list_id,\n request.pagination?.max_results ?? undefined,\n request.pagination?.cursor ?? undefined\n );\n identifiers = resolved.map(p => ({\n identifier_type: p.identifier_type,\n identifier_value: p.identifier_value,\n }));\n }\n\n return {\n status: 'completed',\n list: {\n ...list,\n property_count: identifiers?.length ?? list.property_count,\n },\n identifiers,\n pagination: {\n has_more: false,\n total_count: identifiers?.length,\n },\n resolved_at: new Date().toISOString(),\n };\n }\n\n async listLists(request: ListPropertyListsRequest): Promise<ListPropertyListsResponse> {\n if (!this.isSupported()) {\n throw new PropertyListError(\n PropertyListErrorCodes.NOT_SUPPORTED,\n 'Property list management is not supported by this server'\n );\n }\n\n // Filter by account if provided. AdCP 3.0 identifies list ownership via the\n // account primitive (either account_id or brand+operator). Match on whichever\n // key the request carries.\n let lists = Array.from(this.lists.values());\n if (request.account) {\n const filter = request.account;\n lists = lists.filter(l => {\n const acct = l.account;\n if (!acct) return false;\n if ('account_id' in filter && 'account_id' in acct) {\n return filter.account_id === acct.account_id;\n }\n if ('brand' in filter && 'brand' in acct) {\n return filter.brand.domain === acct.brand.domain && filter.operator === acct.operator;\n }\n return false;\n });\n }\n\n // Filter by name if provided\n if (request.name_contains) {\n const searchTerm = request.name_contains.toLowerCase();\n lists = lists.filter(l => l.name.toLowerCase().includes(searchTerm));\n }\n\n // Apply pagination\n const maxResults = request.pagination?.max_results ?? 100;\n const paginatedLists = lists.slice(0, maxResults);\n\n return {\n status: 'completed',\n lists: paginatedLists,\n pagination: {\n has_more: paginatedLists.length < lists.length,\n total_count: lists.length,\n },\n };\n }\n\n async deleteList(request: DeletePropertyListRequest): Promise<DeletePropertyListResponse> {\n if (!this.isSupported()) {\n throw new PropertyListError(\n PropertyListErrorCodes.NOT_SUPPORTED,\n 'Property list management is not supported by this server'\n );\n }\n\n if (!this.lists.has(request.list_id)) {\n throw new PropertyListError(PropertyListErrorCodes.LIST_NOT_FOUND, `Property list not found: ${request.list_id}`);\n }\n\n this.lists.delete(request.list_id);\n this.authTokens.delete(request.list_id);\n\n return {\n status: 'completed',\n deleted: true,\n list_id: request.list_id,\n };\n }\n\n /**\n * Check if a property is in a list.\n * Stub implementation returns false (property not found).\n */\n async isPropertyInList(listId: string, identifierType: string, identifierValue: string): Promise<boolean> {\n if (!this.isSupported()) {\n // When not supported, all properties are considered in-list (no filtering)\n return true;\n }\n\n // Override in subclass to implement actual lookup\n return false;\n }\n\n /**\n * Resolve a property list to identifiers.\n * Stub implementation returns empty array.\n */\n async resolveList(listId: string, maxResults?: number, cursor?: string): Promise<ResolvedProperty[]> {\n if (!this.isSupported()) {\n return [];\n }\n\n // Override in subclass to implement actual resolution\n return [];\n }\n\n /**\n * Generate a random token for auth\n */\n protected generateToken(): string {\n const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n for (let i = 0; i < 32; i++) {\n result += chars[Math.floor(Math.random() * chars.length)];\n }\n return result;\n }\n}\n\n/**\n * Helper to check if an error is a PropertyListError\n */\nexport function isPropertyListError(error: unknown): error is PropertyListError {\n return error instanceof PropertyListError;\n}\n\n/**\n * Default singleton instance for servers that don't need property list management\n */\nexport const defaultPropertyListAdapter = new PropertyListAdapter();\n"],"mappings":"AAuCO,MAAM,0BAA0B,MAAM;AAAA,EAC3C,YACS,MACP,SACA;AACA,UAAM,OAAO;AAHN;AAIP,SAAK,OAAO;AAAA,EACd;AAAA,EALS;AAMX;AAqDO,MAAM,yBAAyB;AAAA,EACpC,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,gBAAgB;AAClB;AASO,MAAM,oBAAoD;AAAA,EACvD,QAAmC,oBAAI,IAAI;AAAA,EAC3C,aAAkC,oBAAI,IAAI;AAAA,EAC1C,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjB,cAAuB;AACrB,WAAO;AAAA,EACT;AAAA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YAAY,GAAG;AAEvB,aAAO;AAAA,IACT;AAGA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,YAAY,QAAgB,YAAqB,QAA8C;AACnG,QAAI,CAAC,KAAK,YAAY,GAAG;AACvB,aAAO,CAAC;AAAA,IACV;AAGA,WAAO,CAAC;AAAA,EACV;AAAA;AAAA;AAAA;AAAA,EAKU,gBAAwB;AAChC,UAAM,QAAQ;AACd,QAAI,SAAS;AACb,aAAS,IAAI,GAAG,IAAI,IAAI,KAAK;AAC3B,gBAAU,MAAM,KAAK,MAAM,KAAK,OAAO,IAAI,MAAM,MAAM,CAAC;AAAA,IAC1D;AACA,WAAO;AAAA,EACT;AACF;AAKO,SAAS,oBAAoB,OAA4C;AAC9E,SAAO,iBAAiB;AAC1B;AAKO,MAAM,6BAA6B,IAAI,oBAAoB;","names":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname as __adcpDirname } from 'node:path';
|
|
3
|
-
import { createRequire as __adcpCreateRequire } from 'node:module';
|
|
4
|
-
const __filename = __adcpFileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = __adcpDirname(__filename);
|
|
6
|
-
const require = __adcpCreateRequire(import.meta.url);
|
|
7
1
|
import { refAccountId } from "../server/decisioning/account.mjs";
|
|
8
2
|
function createRosterAccountStore(options) {
|
|
9
3
|
const store = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/adapters/roster-account-store.ts"],"sourcesContent":["/**\n * Roster-backed `AccountStore` factory for `resolution: 'explicit'` platforms\n * where the publisher curates accounts out-of-band (admin UI, config file,\n * publisher-managed DB row) and buyers pass `account_id` on every request.\n *\n * Pairs with the existing reference adapters. Pick by asking *who creates the\n * account?*:\n * - **Buyer self-onboards via `sync_accounts`** → {@link InMemoryImplicitAccountStore}\n * (Shape A, `resolution: 'implicit'`). Framework owns persistence; the\n * buyer's first request to a tenant-scoped tool resolves from a prior\n * sync. LinkedIn, some retail-media operators.\n * - **Upstream OAuth API owns the roster** → {@link createOAuthPassthroughResolver}\n * (Shape B, `resolution: 'explicit'`). Returns just the `resolve` function;\n * adopter composes into an AccountStore. Snap, Meta, TikTok — anywhere\n * the buyer's bearer is the lookup key for an upstream `/me/adaccounts`.\n * - **Publisher ops curates the roster out-of-band** → `createRosterAccountStore`\n * (this file, Shape C, `resolution: 'explicit'`). Adopter keeps the\n * persistence layer (storefront table, admin-UI-managed JSON column,\n * in-memory map); the SDK provides the AccountStore plumbing. Most\n * SSPs, broadcasters, and retail-media networks where AE/CSM provisions\n * the account in an internal admin tool before the buyer ever calls.\n * - **No account concept — auth principal IS the tenant** → `createDerivedAccountStore`\n * (Shape D, `resolution: 'derived'`). Single-tenant agents\n * (audiostack, flashtalking, single-namespace retail-media) where there\n * is no `account_id` on the wire and every call authenticates with the\n * per-request bearer.\n *\n * Design notes:\n * - Lookup is a point function, not a roster getter. An adopter with\n * thousands of accounts per tenant in Postgres can issue a SELECT WHERE\n * id = $1 instead of materializing the full array on every request.\n * - `list` is opt-in. Omit it and the framework emits UNSUPPORTED_FEATURE\n * for `list_accounts` calls (matches `AccountStore.list?` semantics).\n * Provide it and the adopter pushes filter+page down to whatever index\n * they have.\n * - No `upsert`, `reportUsage`, `getAccountFinancials`, or `refreshToken`.\n * Adopters who need those compose the helper output:\n * `{ ...createRosterAccountStore(...), refreshToken: async (a) => { ... } }`.\n *\n * @see docs/guides/account-resolution.md\n * @public\n */\n\nimport type { AccountReference } from '../types/tools.generated';\nimport type { Account, AccountFilter, AccountStore, ResolveContext } from '../server/decisioning/account';\nimport { refAccountId } from '../server/decisioning/account';\nimport type { CursorPage, CursorRequest } from '../server/decisioning/pagination';\n\n/**\n * Options for {@link createRosterAccountStore}.\n *\n * @public\n */\nexport interface RosterAccountStoreOptions<TRosterEntry, TCtxMeta = Record<string, unknown>> {\n /**\n * Point-lookup against the adopter's roster source. Return the entry for\n * a given `account_id`, or `undefined` when no row matches.\n *\n * Called once per `resolve()` with an `account_id`-shaped reference. Wire\n * shape `{ brand, operator }` and missing refs do NOT call `lookup`; see\n * the resolve behavior below.\n *\n * Throw to signal a transient upstream failure (DB outage, network blip).\n * The framework projects to `SERVICE_UNAVAILABLE`. Returning `undefined`\n * is the canonical not-found path and projects to `ACCOUNT_NOT_FOUND`.\n */\n lookup: (\n accountId: string,\n ctx: ResolveContext | undefined\n ) => TRosterEntry | undefined | Promise<TRosterEntry | undefined>;\n\n /**\n * Convert a roster entry to the framework's `Account<TCtxMeta>` shape.\n *\n * The adopter's roster row typically lacks `ctx_metadata` (which is a\n * framework-internal field). This mapper is where the adopter populates\n * it — upstream IDs, per-account caches, anything specialism methods will\n * read off `ctx.account.ctx_metadata` later.\n *\n * **DO NOT put credentials in `ctx_metadata`.** See\n * `docs/guides/CTX-METADATA-SAFETY.md` for the rationale and the\n * recommended re-derive-per-request pattern (read tokens off\n * `ctx.authInfo` instead).\n *\n * Adopters MAY omit `authInfo` from the returned `Account` — the\n * framework auto-attaches the principal from `ctx.authInfo` when absent.\n */\n toAccount: (entry: TRosterEntry, ctx: ResolveContext | undefined) => Account<TCtxMeta>;\n\n /**\n * Optional `list_accounts` implementation. The adopter receives the wire\n * filter + cursor request and returns a page of roster entries; the\n * helper threads each entry through `toAccount` before returning.\n *\n * Omit to leave `list_accounts` unimplemented (framework returns\n * `UNSUPPORTED_FEATURE`).\n *\n * **Push filter + pagination down.** The naive shape — fetch the full\n * roster, filter+slice in memory — works for tens of accounts per tenant\n * but does not scale. Adopters with a Postgres-backed roster should map\n * `filter.brand_domain` / `filter.operator` / `filter.status[]` /\n * `cursor` / `limit` to a SQL query. The helper does NOT post-filter;\n * the adopter is the source of truth.\n *\n * **No default status filter.** `filter.status` is `undefined` unless the\n * buyer passed it. If you want production callers to see only `active` +\n * `pending_approval` by default, apply that fallback inside your query —\n * the helper passes `filter` through verbatim.\n */\n list?: (\n filter: AccountFilter & CursorRequest,\n ctx: ResolveContext | undefined\n ) => CursorPage<TRosterEntry> | Promise<CursorPage<TRosterEntry>>;\n\n /**\n * Handle ref-less `accounts.resolve(undefined, ctx)` calls — invoked by\n * `list_creative_formats`, `provide_performance_feedback`, `preview_creative`,\n * and any discovery-phase tool that does not require a buyer-selected account.\n *\n * Return a synthetic publisher-wide roster entry; `toAccount` is applied to\n * it before the result is returned to the framework. Return `undefined` to\n * fall back to `null` (same as omitting this option — `ctx.account` is\n * `undefined` in the handler).\n *\n * The `ref` parameter is always `undefined` here — it is present for\n * signature parity with the framework's `resolve(ref, ctx)` shape so\n * code-generation tools produce consistent two-arg handler signatures.\n * Ignore it (use `(_ref, ctx) => ...`).\n *\n * Throw to signal a transient upstream failure (DB outage, network blip).\n * The framework projects to `SERVICE_UNAVAILABLE`. Returning `undefined`\n * is the canonical not-found path and returns `null` to the framework.\n *\n * **Brand+operator refs are not routed here.** A `{ brand, operator }` ref\n * without an `account_id` still falls through to `null`. Adopters who need\n * to handle brand-arm refs must override `resolve` on the returned store via\n * a spread.\n *\n * **`toAccount` is called on your return value** with the same `ctx`,\n * identical to the `lookup` path. Ensure your synthesized entry satisfies\n * all required fields of `TRosterEntry`.\n *\n * **Auth-derived lookup.** If your singleton should be derived from\n * `ctx.authInfo` (e.g. a per-tenant publisher account keyed on the OAuth\n * client), and that derivation needs to re-invoke `lookup`, use the\n * spread-override pattern on the returned store instead — a `resolveWithoutRef`\n * that calls back into `lookup` is more naturally expressed as a `resolve`\n * override so the call graph stays flat.\n *\n * **If you also override `resolve` on the spread**, `resolveWithoutRef` is\n * not called — the spread override takes precedence.\n *\n * Omit when `ctx.account === undefined` is acceptable for ref-less tools\n * (handlers can narrow on it and fall back to platform-level config from\n * their closure).\n */\n resolveWithoutRef?: (\n ref: undefined,\n ctx: ResolveContext | undefined\n ) => TRosterEntry | undefined | Promise<TRosterEntry | undefined>;\n}\n\n/**\n * Build an `AccountStore<TCtxMeta>` from an adopter-supplied roster source.\n *\n * The adopter brings persistence (DB row, admin-UI-managed JSON column,\n * in-memory Map, file). The helper provides:\n * - `resolution: 'explicit'` declaration\n * - `account_id`-arm dispatch from the wire reference\n * - Mapping from roster entry → `Account<TCtxMeta>` via `toAccount`\n * - Optional `list_accounts` plumbing with cursor envelope passthrough\n * - `null` return for `{ brand, operator }`-shaped refs and ref-less\n * calls (publisher-curated platforms expect explicit ids)\n *\n * Adopters who need `upsert` (buyer-driven write paths via `sync_accounts`),\n * `refreshToken`, `reportUsage`, or `getAccountFinancials` compose on top\n * of the returned store with a spread:\n *\n * ```ts\n * const accounts: AccountStore<MyMeta> = {\n * ...createRosterAccountStore({ lookup, toAccount }),\n * refreshToken: async (account) => myUpstream.refresh(account),\n * };\n * ```\n *\n * **Ref-less calls (singleton fallback).** `list_creative_formats`,\n * `preview_creative`, and `provide_performance_feedback` call\n * `accounts.resolve(undefined, ctx)`. Use `resolveWithoutRef` when your\n * platform needs a synthetic publisher-wide account for these tools:\n *\n * ```ts\n * const accounts = createRosterAccountStore({\n * lookup,\n * toAccount,\n * resolveWithoutRef: () => ({ id: '__publisher__', label: 'Publisher', tenantId: myPlatformId }),\n * });\n * ```\n *\n * The returned entry flows through `toAccount` just like a `lookup` hit.\n * When omitted the helper returns `null` for ref-less calls — handlers can\n * narrow on `ctx.account === undefined` and fall back to platform-level\n * config from their closure.\n *\n * **Ref-less calls (singleton from options):**\n * ```ts\n * const accounts = createRosterAccountStore({\n * lookup,\n * toAccount,\n * resolveWithoutRef: (_ref, ctx) => ({\n * id: '__publisher__',\n * name: 'Publisher',\n * tenant_id: deriveTenant(ctx?.authInfo),\n * }),\n * });\n * ```\n *\n * **Ref-less calls (auth-derived lookup).** When the singleton should be\n * derived from the caller's principal and needs to call back into `lookup`,\n * use the spread-override pattern instead:\n *\n * ```ts\n * const base = createRosterAccountStore({ lookup, toAccount });\n * const accounts: AccountStore<MyMeta> = {\n * ...base,\n * resolve: async (ref, ctx) => {\n * if (ref === undefined) {\n * const id = deriveAccountIdFromAuth(ctx?.authInfo);\n * return id ? base.resolve({ account_id: id }, ctx) : null;\n * }\n * return base.resolve(ref, ctx);\n * },\n * };\n * ```\n *\n * **Hybrid roster + buyer-updatable fields.** Some publisher-curated\n * platforms (GAM, FreeWheel, several retail-media networks) let the buyer\n * PATCH a narrow set of fields — billing contact, AP email, agency-of-record\n * cert — on a publisher-provisioned account, while keeping creation and\n * commercial terms (credit limit, rate card) read-only to the buyer. Compose\n * a partial `upsert` over the roster store and gate it on a field allowlist:\n *\n * ```ts\n * const BUYER_WRITABLE = new Set(['billing_entity', 'setup']);\n * const accounts: AccountStore<MyMeta> = {\n * ...createRosterAccountStore({ lookup, toAccount }),\n * upsert: async (refs, ctx) => refs.map(r => applyBuyerPatch(r, BUYER_WRITABLE, ctx)),\n * };\n * ```\n *\n * **Brand-arm refs return `null`.** Buyers who pass `{ brand, operator }`\n * (no `account_id`) hit the framework's `ACCOUNT_NOT_FOUND` envelope. The\n * helper cannot synthesize `INVALID_REQUEST` from inside `resolve` — if your\n * platform needs to reject brand-arm refs as a wire-shape error rather than\n * a not-found, wrap `resolve` and throw `AdcpError('INVALID_REQUEST', { field:\n * 'account.brand' })` before delegating to the helper.\n *\n * @example In-memory roster (tests, small fixed configs):\n * ```ts\n * const accounts = createRosterAccountStore({\n * lookup: (id) => roster.get(id),\n * toAccount: (row) => ({\n * id: row.id,\n * name: row.name,\n * status: 'active',\n * ctx_metadata: { upstreamId: row.upstream_id },\n * }),\n * });\n * ```\n *\n * @example Postgres-backed roster (publisher with admin UI):\n * ```ts\n * const accounts = createRosterAccountStore({\n * lookup: async (id, ctx) => {\n * const tenantId = deriveTenant(ctx?.authInfo);\n * return await db.oneOrNone(\n * 'SELECT * FROM storefront_accounts WHERE id = $1 AND tenant = $2',\n * [id, tenantId],\n * );\n * },\n * toAccount: (row) => ({\n * id: row.id,\n * name: row.name,\n * status: row.status,\n * brand: row.brand,\n * operator: row.operator,\n * ctx_metadata: { tenant: row.tenant, upstreamRef: row.upstream_ref },\n * }),\n * list: async (filter, ctx) => {\n * const tenantId = deriveTenant(ctx?.authInfo);\n * const rows = await db.any(buildListQuery(filter, tenantId));\n * return { items: rows, nextCursor: nextCursorFor(rows, filter) };\n * },\n * });\n * ```\n *\n * @public\n */\nexport function createRosterAccountStore<TRosterEntry, TCtxMeta = Record<string, unknown>>(\n options: RosterAccountStoreOptions<TRosterEntry, TCtxMeta>\n): AccountStore<TCtxMeta> {\n const store: AccountStore<TCtxMeta> = {\n resolution: 'explicit',\n\n async resolve(ref: AccountReference | undefined, ctx?: ResolveContext): Promise<Account<TCtxMeta> | null> {\n const accountId = refAccountId(ref);\n if (accountId !== undefined) {\n const entry = await options.lookup(accountId, ctx);\n return entry === undefined ? null : options.toAccount(entry, ctx);\n }\n\n // ref is undefined (no account field on wire) — delegate to resolveWithoutRef if provided.\n // Brand+operator refs (ref !== undefined but no account_id) fall through to null below;\n // resolveWithoutRef is intentionally not called for them.\n if (ref === undefined && options.resolveWithoutRef !== undefined) {\n const entry = await options.resolveWithoutRef(undefined, ctx);\n return entry === undefined ? null : options.toAccount(entry, ctx);\n }\n\n // brand+operator-shaped refs (no account_id) and unhandled ref-less calls → null.\n // Adopters who need brand-arm resolution or auth-derived ref-less lookup wrap\n // `resolve` via spread — see the JSDoc on `createRosterAccountStore`.\n return null;\n },\n };\n\n if (options.list !== undefined) {\n const adopterList = options.list;\n store.list = async (filter, ctx) => {\n const page = await adopterList(filter, ctx);\n return {\n items: page.items.map(entry => options.toAccount(entry, ctx)),\n ...(page.nextCursor !== undefined && { nextCursor: page.nextCursor }),\n };\n };\n }\n\n return store;\n}\n"],"mappings":";;;;;;AA6CA,SAAS,oBAAoB;AA4PtB,SAAS,yBACd,SACwB;AACxB,QAAM,QAAgC;AAAA,IACpC,YAAY;AAAA,IAEZ,MAAM,QAAQ,KAAmC,KAAyD;AACxG,YAAM,YAAY,aAAa,GAAG;AAClC,UAAI,cAAc,QAAW;AAC3B,cAAM,QAAQ,MAAM,QAAQ,OAAO,WAAW,GAAG;AACjD,eAAO,UAAU,SAAY,OAAO,QAAQ,UAAU,OAAO,GAAG;AAAA,MAClE;AAKA,UAAI,QAAQ,UAAa,QAAQ,sBAAsB,QAAW;AAChE,cAAM,QAAQ,MAAM,QAAQ,kBAAkB,QAAW,GAAG;AAC5D,eAAO,UAAU,SAAY,OAAO,QAAQ,UAAU,OAAO,GAAG;AAAA,MAClE;AAKA,aAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,QAAQ,SAAS,QAAW;AAC9B,UAAM,cAAc,QAAQ;AAC5B,UAAM,OAAO,OAAO,QAAQ,QAAQ;AAClC,YAAM,OAAO,MAAM,YAAY,QAAQ,GAAG;AAC1C,aAAO;AAAA,QACL,OAAO,KAAK,MAAM,IAAI,WAAS,QAAQ,UAAU,OAAO,GAAG,CAAC;AAAA,QAC5D,GAAI,KAAK,eAAe,UAAa,EAAE,YAAY,KAAK,WAAW;AAAA,MACrE;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/adapters/roster-account-store.ts"],"sourcesContent":["/**\n * Roster-backed `AccountStore` factory for `resolution: 'explicit'` platforms\n * where the publisher curates accounts out-of-band (admin UI, config file,\n * publisher-managed DB row) and buyers pass `account_id` on every request.\n *\n * Pairs with the existing reference adapters. Pick by asking *who creates the\n * account?*:\n * - **Buyer self-onboards via `sync_accounts`** → {@link InMemoryImplicitAccountStore}\n * (Shape A, `resolution: 'implicit'`). Framework owns persistence; the\n * buyer's first request to a tenant-scoped tool resolves from a prior\n * sync. LinkedIn, some retail-media operators.\n * - **Upstream OAuth API owns the roster** → {@link createOAuthPassthroughResolver}\n * (Shape B, `resolution: 'explicit'`). Returns just the `resolve` function;\n * adopter composes into an AccountStore. Snap, Meta, TikTok — anywhere\n * the buyer's bearer is the lookup key for an upstream `/me/adaccounts`.\n * - **Publisher ops curates the roster out-of-band** → `createRosterAccountStore`\n * (this file, Shape C, `resolution: 'explicit'`). Adopter keeps the\n * persistence layer (storefront table, admin-UI-managed JSON column,\n * in-memory map); the SDK provides the AccountStore plumbing. Most\n * SSPs, broadcasters, and retail-media networks where AE/CSM provisions\n * the account in an internal admin tool before the buyer ever calls.\n * - **No account concept — auth principal IS the tenant** → `createDerivedAccountStore`\n * (Shape D, `resolution: 'derived'`). Single-tenant agents\n * (audiostack, flashtalking, single-namespace retail-media) where there\n * is no `account_id` on the wire and every call authenticates with the\n * per-request bearer.\n *\n * Design notes:\n * - Lookup is a point function, not a roster getter. An adopter with\n * thousands of accounts per tenant in Postgres can issue a SELECT WHERE\n * id = $1 instead of materializing the full array on every request.\n * - `list` is opt-in. Omit it and the framework emits UNSUPPORTED_FEATURE\n * for `list_accounts` calls (matches `AccountStore.list?` semantics).\n * Provide it and the adopter pushes filter+page down to whatever index\n * they have.\n * - No `upsert`, `reportUsage`, `getAccountFinancials`, or `refreshToken`.\n * Adopters who need those compose the helper output:\n * `{ ...createRosterAccountStore(...), refreshToken: async (a) => { ... } }`.\n *\n * @see docs/guides/account-resolution.md\n * @public\n */\n\nimport type { AccountReference } from '../types/tools.generated';\nimport type { Account, AccountFilter, AccountStore, ResolveContext } from '../server/decisioning/account';\nimport { refAccountId } from '../server/decisioning/account';\nimport type { CursorPage, CursorRequest } from '../server/decisioning/pagination';\n\n/**\n * Options for {@link createRosterAccountStore}.\n *\n * @public\n */\nexport interface RosterAccountStoreOptions<TRosterEntry, TCtxMeta = Record<string, unknown>> {\n /**\n * Point-lookup against the adopter's roster source. Return the entry for\n * a given `account_id`, or `undefined` when no row matches.\n *\n * Called once per `resolve()` with an `account_id`-shaped reference. Wire\n * shape `{ brand, operator }` and missing refs do NOT call `lookup`; see\n * the resolve behavior below.\n *\n * Throw to signal a transient upstream failure (DB outage, network blip).\n * The framework projects to `SERVICE_UNAVAILABLE`. Returning `undefined`\n * is the canonical not-found path and projects to `ACCOUNT_NOT_FOUND`.\n */\n lookup: (\n accountId: string,\n ctx: ResolveContext | undefined\n ) => TRosterEntry | undefined | Promise<TRosterEntry | undefined>;\n\n /**\n * Convert a roster entry to the framework's `Account<TCtxMeta>` shape.\n *\n * The adopter's roster row typically lacks `ctx_metadata` (which is a\n * framework-internal field). This mapper is where the adopter populates\n * it — upstream IDs, per-account caches, anything specialism methods will\n * read off `ctx.account.ctx_metadata` later.\n *\n * **DO NOT put credentials in `ctx_metadata`.** See\n * `docs/guides/CTX-METADATA-SAFETY.md` for the rationale and the\n * recommended re-derive-per-request pattern (read tokens off\n * `ctx.authInfo` instead).\n *\n * Adopters MAY omit `authInfo` from the returned `Account` — the\n * framework auto-attaches the principal from `ctx.authInfo` when absent.\n */\n toAccount: (entry: TRosterEntry, ctx: ResolveContext | undefined) => Account<TCtxMeta>;\n\n /**\n * Optional `list_accounts` implementation. The adopter receives the wire\n * filter + cursor request and returns a page of roster entries; the\n * helper threads each entry through `toAccount` before returning.\n *\n * Omit to leave `list_accounts` unimplemented (framework returns\n * `UNSUPPORTED_FEATURE`).\n *\n * **Push filter + pagination down.** The naive shape — fetch the full\n * roster, filter+slice in memory — works for tens of accounts per tenant\n * but does not scale. Adopters with a Postgres-backed roster should map\n * `filter.brand_domain` / `filter.operator` / `filter.status[]` /\n * `cursor` / `limit` to a SQL query. The helper does NOT post-filter;\n * the adopter is the source of truth.\n *\n * **No default status filter.** `filter.status` is `undefined` unless the\n * buyer passed it. If you want production callers to see only `active` +\n * `pending_approval` by default, apply that fallback inside your query —\n * the helper passes `filter` through verbatim.\n */\n list?: (\n filter: AccountFilter & CursorRequest,\n ctx: ResolveContext | undefined\n ) => CursorPage<TRosterEntry> | Promise<CursorPage<TRosterEntry>>;\n\n /**\n * Handle ref-less `accounts.resolve(undefined, ctx)` calls — invoked by\n * `list_creative_formats`, `provide_performance_feedback`, `preview_creative`,\n * and any discovery-phase tool that does not require a buyer-selected account.\n *\n * Return a synthetic publisher-wide roster entry; `toAccount` is applied to\n * it before the result is returned to the framework. Return `undefined` to\n * fall back to `null` (same as omitting this option — `ctx.account` is\n * `undefined` in the handler).\n *\n * The `ref` parameter is always `undefined` here — it is present for\n * signature parity with the framework's `resolve(ref, ctx)` shape so\n * code-generation tools produce consistent two-arg handler signatures.\n * Ignore it (use `(_ref, ctx) => ...`).\n *\n * Throw to signal a transient upstream failure (DB outage, network blip).\n * The framework projects to `SERVICE_UNAVAILABLE`. Returning `undefined`\n * is the canonical not-found path and returns `null` to the framework.\n *\n * **Brand+operator refs are not routed here.** A `{ brand, operator }` ref\n * without an `account_id` still falls through to `null`. Adopters who need\n * to handle brand-arm refs must override `resolve` on the returned store via\n * a spread.\n *\n * **`toAccount` is called on your return value** with the same `ctx`,\n * identical to the `lookup` path. Ensure your synthesized entry satisfies\n * all required fields of `TRosterEntry`.\n *\n * **Auth-derived lookup.** If your singleton should be derived from\n * `ctx.authInfo` (e.g. a per-tenant publisher account keyed on the OAuth\n * client), and that derivation needs to re-invoke `lookup`, use the\n * spread-override pattern on the returned store instead — a `resolveWithoutRef`\n * that calls back into `lookup` is more naturally expressed as a `resolve`\n * override so the call graph stays flat.\n *\n * **If you also override `resolve` on the spread**, `resolveWithoutRef` is\n * not called — the spread override takes precedence.\n *\n * Omit when `ctx.account === undefined` is acceptable for ref-less tools\n * (handlers can narrow on it and fall back to platform-level config from\n * their closure).\n */\n resolveWithoutRef?: (\n ref: undefined,\n ctx: ResolveContext | undefined\n ) => TRosterEntry | undefined | Promise<TRosterEntry | undefined>;\n}\n\n/**\n * Build an `AccountStore<TCtxMeta>` from an adopter-supplied roster source.\n *\n * The adopter brings persistence (DB row, admin-UI-managed JSON column,\n * in-memory Map, file). The helper provides:\n * - `resolution: 'explicit'` declaration\n * - `account_id`-arm dispatch from the wire reference\n * - Mapping from roster entry → `Account<TCtxMeta>` via `toAccount`\n * - Optional `list_accounts` plumbing with cursor envelope passthrough\n * - `null` return for `{ brand, operator }`-shaped refs and ref-less\n * calls (publisher-curated platforms expect explicit ids)\n *\n * Adopters who need `upsert` (buyer-driven write paths via `sync_accounts`),\n * `refreshToken`, `reportUsage`, or `getAccountFinancials` compose on top\n * of the returned store with a spread:\n *\n * ```ts\n * const accounts: AccountStore<MyMeta> = {\n * ...createRosterAccountStore({ lookup, toAccount }),\n * refreshToken: async (account) => myUpstream.refresh(account),\n * };\n * ```\n *\n * **Ref-less calls (singleton fallback).** `list_creative_formats`,\n * `preview_creative`, and `provide_performance_feedback` call\n * `accounts.resolve(undefined, ctx)`. Use `resolveWithoutRef` when your\n * platform needs a synthetic publisher-wide account for these tools:\n *\n * ```ts\n * const accounts = createRosterAccountStore({\n * lookup,\n * toAccount,\n * resolveWithoutRef: () => ({ id: '__publisher__', label: 'Publisher', tenantId: myPlatformId }),\n * });\n * ```\n *\n * The returned entry flows through `toAccount` just like a `lookup` hit.\n * When omitted the helper returns `null` for ref-less calls — handlers can\n * narrow on `ctx.account === undefined` and fall back to platform-level\n * config from their closure.\n *\n * **Ref-less calls (singleton from options):**\n * ```ts\n * const accounts = createRosterAccountStore({\n * lookup,\n * toAccount,\n * resolveWithoutRef: (_ref, ctx) => ({\n * id: '__publisher__',\n * name: 'Publisher',\n * tenant_id: deriveTenant(ctx?.authInfo),\n * }),\n * });\n * ```\n *\n * **Ref-less calls (auth-derived lookup).** When the singleton should be\n * derived from the caller's principal and needs to call back into `lookup`,\n * use the spread-override pattern instead:\n *\n * ```ts\n * const base = createRosterAccountStore({ lookup, toAccount });\n * const accounts: AccountStore<MyMeta> = {\n * ...base,\n * resolve: async (ref, ctx) => {\n * if (ref === undefined) {\n * const id = deriveAccountIdFromAuth(ctx?.authInfo);\n * return id ? base.resolve({ account_id: id }, ctx) : null;\n * }\n * return base.resolve(ref, ctx);\n * },\n * };\n * ```\n *\n * **Hybrid roster + buyer-updatable fields.** Some publisher-curated\n * platforms (GAM, FreeWheel, several retail-media networks) let the buyer\n * PATCH a narrow set of fields — billing contact, AP email, agency-of-record\n * cert — on a publisher-provisioned account, while keeping creation and\n * commercial terms (credit limit, rate card) read-only to the buyer. Compose\n * a partial `upsert` over the roster store and gate it on a field allowlist:\n *\n * ```ts\n * const BUYER_WRITABLE = new Set(['billing_entity', 'setup']);\n * const accounts: AccountStore<MyMeta> = {\n * ...createRosterAccountStore({ lookup, toAccount }),\n * upsert: async (refs, ctx) => refs.map(r => applyBuyerPatch(r, BUYER_WRITABLE, ctx)),\n * };\n * ```\n *\n * **Brand-arm refs return `null`.** Buyers who pass `{ brand, operator }`\n * (no `account_id`) hit the framework's `ACCOUNT_NOT_FOUND` envelope. The\n * helper cannot synthesize `INVALID_REQUEST` from inside `resolve` — if your\n * platform needs to reject brand-arm refs as a wire-shape error rather than\n * a not-found, wrap `resolve` and throw `AdcpError('INVALID_REQUEST', { field:\n * 'account.brand' })` before delegating to the helper.\n *\n * @example In-memory roster (tests, small fixed configs):\n * ```ts\n * const accounts = createRosterAccountStore({\n * lookup: (id) => roster.get(id),\n * toAccount: (row) => ({\n * id: row.id,\n * name: row.name,\n * status: 'active',\n * ctx_metadata: { upstreamId: row.upstream_id },\n * }),\n * });\n * ```\n *\n * @example Postgres-backed roster (publisher with admin UI):\n * ```ts\n * const accounts = createRosterAccountStore({\n * lookup: async (id, ctx) => {\n * const tenantId = deriveTenant(ctx?.authInfo);\n * return await db.oneOrNone(\n * 'SELECT * FROM storefront_accounts WHERE id = $1 AND tenant = $2',\n * [id, tenantId],\n * );\n * },\n * toAccount: (row) => ({\n * id: row.id,\n * name: row.name,\n * status: row.status,\n * brand: row.brand,\n * operator: row.operator,\n * ctx_metadata: { tenant: row.tenant, upstreamRef: row.upstream_ref },\n * }),\n * list: async (filter, ctx) => {\n * const tenantId = deriveTenant(ctx?.authInfo);\n * const rows = await db.any(buildListQuery(filter, tenantId));\n * return { items: rows, nextCursor: nextCursorFor(rows, filter) };\n * },\n * });\n * ```\n *\n * @public\n */\nexport function createRosterAccountStore<TRosterEntry, TCtxMeta = Record<string, unknown>>(\n options: RosterAccountStoreOptions<TRosterEntry, TCtxMeta>\n): AccountStore<TCtxMeta> {\n const store: AccountStore<TCtxMeta> = {\n resolution: 'explicit',\n\n async resolve(ref: AccountReference | undefined, ctx?: ResolveContext): Promise<Account<TCtxMeta> | null> {\n const accountId = refAccountId(ref);\n if (accountId !== undefined) {\n const entry = await options.lookup(accountId, ctx);\n return entry === undefined ? null : options.toAccount(entry, ctx);\n }\n\n // ref is undefined (no account field on wire) — delegate to resolveWithoutRef if provided.\n // Brand+operator refs (ref !== undefined but no account_id) fall through to null below;\n // resolveWithoutRef is intentionally not called for them.\n if (ref === undefined && options.resolveWithoutRef !== undefined) {\n const entry = await options.resolveWithoutRef(undefined, ctx);\n return entry === undefined ? null : options.toAccount(entry, ctx);\n }\n\n // brand+operator-shaped refs (no account_id) and unhandled ref-less calls → null.\n // Adopters who need brand-arm resolution or auth-derived ref-less lookup wrap\n // `resolve` via spread — see the JSDoc on `createRosterAccountStore`.\n return null;\n },\n };\n\n if (options.list !== undefined) {\n const adopterList = options.list;\n store.list = async (filter, ctx) => {\n const page = await adopterList(filter, ctx);\n return {\n items: page.items.map(entry => options.toAccount(entry, ctx)),\n ...(page.nextCursor !== undefined && { nextCursor: page.nextCursor }),\n };\n };\n }\n\n return store;\n}\n"],"mappings":"AA6CA,SAAS,oBAAoB;AA4PtB,SAAS,yBACd,SACwB;AACxB,QAAM,QAAgC;AAAA,IACpC,YAAY;AAAA,IAEZ,MAAM,QAAQ,KAAmC,KAAyD;AACxG,YAAM,YAAY,aAAa,GAAG;AAClC,UAAI,cAAc,QAAW;AAC3B,cAAM,QAAQ,MAAM,QAAQ,OAAO,WAAW,GAAG;AACjD,eAAO,UAAU,SAAY,OAAO,QAAQ,UAAU,OAAO,GAAG;AAAA,MAClE;AAKA,UAAI,QAAQ,UAAa,QAAQ,sBAAsB,QAAW;AAChE,cAAM,QAAQ,MAAM,QAAQ,kBAAkB,QAAW,GAAG;AAC5D,eAAO,UAAU,SAAY,OAAO,QAAQ,UAAU,OAAO,GAAG;AAAA,MAClE;AAKA,aAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,QAAQ,SAAS,QAAW;AAC9B,UAAM,cAAc,QAAQ;AAC5B,UAAM,OAAO,OAAO,QAAQ,QAAQ;AAClC,YAAM,OAAO,MAAM,YAAY,QAAQ,GAAG;AAC1C,aAAO;AAAA,QACL,OAAO,KAAK,MAAM,IAAI,WAAS,QAAQ,UAAU,OAAO,GAAG,CAAC;AAAA,QAC5D,GAAI,KAAK,eAAe,UAAa,EAAE,YAAY,KAAK,WAAW;AAAA,MACrE;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname as __adcpDirname } from 'node:path';
|
|
3
|
-
import { createRequire as __adcpCreateRequire } from 'node:module';
|
|
4
|
-
const __filename = __adcpFileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = __adcpDirname(__filename);
|
|
6
|
-
const require = __adcpCreateRequire(import.meta.url);
|
|
7
1
|
const SIErrorCodes = {
|
|
8
2
|
NOT_SUPPORTED: "UNSUPPORTED_FEATURE",
|
|
9
3
|
SESSION_NOT_FOUND: "REFERENCE_NOT_FOUND",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/adapters/si-session-manager.ts"],"sourcesContent":["/**\n * Sponsored Intelligence (SI) Session Manager\n *\n * Server-side adapter for managing SI conversational commerce sessions.\n * Brands use this to handle session lifecycle and message routing to their\n * conversational AI systems.\n *\n * This is a stub implementation that doesn't support sessions.\n * Brands should extend or replace this with their conversation logic.\n */\n\nimport type {\n SIGetOfferingRequest,\n SIGetOfferingResponse,\n SIInitiateSessionRequest,\n SIInitiateSessionResponse,\n SISendMessageRequest,\n SISendMessageResponse,\n SITerminateSessionRequest,\n SITerminateSessionResponse,\n SICapabilities,\n} from '../types/tools.generated';\n\n/**\n * Internal session state\n */\nexport interface SISession {\n sessionId: string;\n createdAt: string;\n lastActiveAt: string;\n identity: any;\n mediaBuyId?: string;\n offeringId?: string;\n offeringToken?: string;\n placement?: string;\n negotiatedCapabilities?: SICapabilities;\n status: 'active' | 'pending_handoff' | 'complete' | 'terminated';\n messageCount: number;\n conversationHistory: {\n role: 'user' | 'brand';\n content: string;\n timestamp: string;\n }[];\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Abstract interface for SI session managers.\n * Brands implement this to provide their conversational AI logic.\n */\nexport interface ISISessionManager {\n /**\n * Check if SI is supported by this server\n */\n isSupported(): boolean;\n\n /**\n * Get offering details for display to user\n */\n getOffering(request: SIGetOfferingRequest): Promise<SIGetOfferingResponse>;\n\n /**\n * Initiate a new SI session\n */\n initiateSession(request: SIInitiateSessionRequest): Promise<SIInitiateSessionResponse>;\n\n /**\n * Handle a message within a session\n */\n sendMessage(request: SISendMessageRequest): Promise<SISendMessageResponse>;\n\n /**\n * Terminate a session\n */\n terminateSession(request: SITerminateSessionRequest): Promise<SITerminateSessionResponse>;\n\n /**\n * Get session state (for internal use)\n */\n getSession(sessionId: string): Promise<SISession | null>;\n\n /**\n * Clean up stale sessions\n */\n cleanupStaleSessions(maxAgeMinutes: number): Promise<number>;\n}\n\n/**\n * Error codes for SI operations\n */\nexport const SIErrorCodes = {\n NOT_SUPPORTED: 'UNSUPPORTED_FEATURE',\n SESSION_NOT_FOUND: 'REFERENCE_NOT_FOUND',\n SESSION_EXPIRED: 'INVALID_STATE',\n SESSION_TERMINATED: 'INVALID_STATE',\n OFFERING_NOT_FOUND: 'REFERENCE_NOT_FOUND',\n OFFERING_UNAVAILABLE: 'PRODUCT_UNAVAILABLE',\n INVALID_MESSAGE: 'INVALID_REQUEST',\n CAPABILITY_NOT_SUPPORTED: 'UNSUPPORTED_FEATURE',\n} as const;\n\n/**\n * Stub implementation of SISessionManager.\n * Uses in-memory storage and returns not-supported errors.\n *\n * Brands should extend this class or provide their own implementation\n * that integrates with their conversational AI systems.\n */\nexport class SISessionManager implements ISISessionManager {\n private sessions: Map<string, SISession> = new Map();\n private offerings: Map<string, any> = new Map(); // Offering cache\n private nextSessionId = 1;\n\n /**\n * Check if SI is supported.\n * Override this to return true when implementing real logic.\n */\n isSupported(): boolean {\n return false;\n }\n\n async getOffering(request: SIGetOfferingRequest): Promise<SIGetOfferingResponse> {\n if (!this.isSupported()) {\n return {\n status: 'failed',\n available: false,\n unavailable_reason: 'SI not supported by this server',\n errors: [\n {\n code: SIErrorCodes.NOT_SUPPORTED,\n message: 'Sponsored Intelligence is not supported by this server',\n },\n ],\n };\n }\n\n // Override in subclass to implement actual offering lookup\n return {\n status: 'failed',\n available: false,\n unavailable_reason: 'Offering not found',\n errors: [\n {\n code: SIErrorCodes.OFFERING_NOT_FOUND,\n message: `Offering not found: ${request.offering_id}`,\n },\n ],\n };\n }\n\n async initiateSession(request: SIInitiateSessionRequest): Promise<SIInitiateSessionResponse> {\n if (!this.isSupported()) {\n return {\n status: 'failed',\n session_id: '',\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.NOT_SUPPORTED,\n message: 'Sponsored Intelligence is not supported by this server',\n },\n ],\n };\n }\n\n // Create session\n const sessionId = this.generateSessionId();\n const now = new Date().toISOString();\n\n const session: SISession = {\n sessionId,\n createdAt: now,\n lastActiveAt: now,\n identity: request.identity,\n mediaBuyId: request.media_buy_id ?? undefined,\n offeringId: request.offering_id ?? undefined,\n offeringToken: request.offering_token ?? undefined,\n placement: request.placement ?? undefined,\n negotiatedCapabilities: this.negotiateCapabilities(request.supported_capabilities ?? undefined),\n status: 'active',\n messageCount: 0,\n conversationHistory: [],\n };\n\n this.sessions.set(sessionId, session);\n\n // Generate initial response. `intent` is the natural-language handoff\n // (AdCP 3.0 GA renamed the former string-valued `context` to `intent`;\n // `context` now carries the protocol envelope object).\n const initialResponse = await this.generateInitialResponse(session, request.intent);\n\n return {\n status: 'completed',\n session_id: sessionId,\n session_status: 'active',\n response: initialResponse,\n negotiated_capabilities: session.negotiatedCapabilities,\n };\n }\n\n async sendMessage(request: SISendMessageRequest): Promise<SISendMessageResponse> {\n if (!this.isSupported()) {\n return {\n status: 'failed',\n session_id: request.session_id,\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.NOT_SUPPORTED,\n message: 'Sponsored Intelligence is not supported by this server',\n },\n ],\n };\n }\n\n const session = await this.getSession(request.session_id);\n if (!session) {\n return {\n status: 'failed',\n session_id: request.session_id,\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.SESSION_NOT_FOUND,\n message: `Session not found: ${request.session_id}`,\n },\n ],\n };\n }\n\n if (session.status === 'terminated' || session.status === 'complete') {\n return {\n status: 'failed',\n session_id: request.session_id,\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.SESSION_TERMINATED,\n message: 'Session is not active',\n },\n ],\n };\n }\n\n // Record user message\n if (request.message) {\n session.conversationHistory.push({\n role: 'user',\n content: request.message,\n timestamp: new Date().toISOString(),\n });\n }\n\n session.messageCount++;\n session.lastActiveAt = new Date().toISOString();\n\n // Generate response\n const response = await this.generateResponse(session, request);\n\n // Record brand response\n if (response.message) {\n session.conversationHistory.push({\n role: 'brand',\n content: response.message,\n timestamp: new Date().toISOString(),\n });\n }\n\n this.sessions.set(session.sessionId, session);\n\n return {\n status: 'completed',\n session_id: session.sessionId,\n response,\n session_status: session.status,\n };\n }\n\n async terminateSession(request: SITerminateSessionRequest): Promise<SITerminateSessionResponse> {\n if (!this.isSupported()) {\n return {\n status: 'failed',\n session_id: request.session_id,\n terminated: false,\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.NOT_SUPPORTED,\n message: 'Sponsored Intelligence is not supported by this server',\n },\n ],\n };\n }\n\n const session = await this.getSession(request.session_id);\n if (!session) {\n return {\n status: 'failed',\n session_id: request.session_id,\n terminated: false,\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.SESSION_NOT_FOUND,\n message: `Session not found: ${request.session_id}`,\n },\n ],\n };\n }\n\n // Update session status\n session.status = 'terminated';\n this.sessions.set(session.sessionId, session);\n\n // Generate ACP handoff data if this is a transaction handoff\n let acpHandoff: SITerminateSessionResponse['acp_handoff'];\n if (request.reason === 'handoff_transaction') {\n acpHandoff = await this.generateACPHandoff(session, request.termination_context);\n }\n\n return {\n status: 'completed',\n session_id: session.sessionId,\n terminated: true,\n session_status: 'terminated',\n acp_handoff: acpHandoff,\n };\n }\n\n /**\n * Generate ACP handoff data for checkout.\n * Override to implement actual checkout flow integration.\n */\n protected async generateACPHandoff(\n session: SISession,\n terminationContext?: SITerminateSessionRequest['termination_context']\n ): Promise<SITerminateSessionResponse['acp_handoff']> {\n // Stub returns undefined (no checkout URL)\n return undefined;\n }\n\n async getSession(sessionId: string): Promise<SISession | null> {\n return this.sessions.get(sessionId) || null;\n }\n\n async cleanupStaleSessions(maxAgeMinutes: number): Promise<number> {\n const cutoff = new Date();\n cutoff.setMinutes(cutoff.getMinutes() - maxAgeMinutes);\n\n let removed = 0;\n for (const [id, session] of this.sessions) {\n if (new Date(session.lastActiveAt) < cutoff) {\n this.sessions.delete(id);\n removed++;\n }\n }\n\n return removed;\n }\n\n /**\n * Generate a unique session ID.\n */\n protected generateSessionId(): string {\n return `si_${this.nextSessionId++}_${Date.now()}`;\n }\n\n /**\n * Negotiate capabilities between host and brand.\n * Override to customize capability negotiation.\n */\n protected negotiateCapabilities(hostCapabilities?: SICapabilities): SICapabilities {\n // Stub returns minimal capabilities\n return {\n modalities: {\n conversational: true,\n },\n };\n }\n\n /**\n * Generate initial response when session is created.\n * Override to implement actual greeting/welcome logic.\n *\n * `intent` is the natural-language handoff from the host (AdCP 3.0 GA\n * renamed the former string-valued `context` field to `intent`).\n */\n protected async generateInitialResponse(\n session: SISession,\n intent: string\n ): Promise<{ message?: string; ui_elements?: any[] }> {\n // Stub returns a generic greeting\n return {\n message: 'Welcome! How can I help you today?',\n };\n }\n\n /**\n * Generate response to a user message.\n * Override to implement actual conversational AI logic.\n */\n protected async generateResponse(\n session: SISession,\n request: SISendMessageRequest\n ): Promise<{ message?: string; ui_elements?: any[] }> {\n // Stub returns a generic response\n return {\n message: \"I'm sorry, but I'm not able to help with that right now. Is there anything else I can assist you with?\",\n };\n }\n\n /**\n * Generate a summary of the conversation.\n * Override to implement actual summarization logic.\n */\n protected async generateConversationSummary(session: SISession): Promise<string> {\n return `Conversation with ${session.messageCount} messages.`;\n }\n}\n\n/**\n * Example of an AI-powered SI session manager (stub).\n * Shows how brands might extend the base class.\n */\nexport class AISISessionManager extends SISessionManager {\n private aiEndpoint?: string;\n private brandConfig?: {\n brandName: string;\n welcomeMessage?: string;\n offerings?: Map<string, any>;\n };\n\n constructor(config?: { aiEndpoint?: string; brandName?: string; welcomeMessage?: string }) {\n super();\n this.aiEndpoint = config?.aiEndpoint;\n this.brandConfig = {\n brandName: config?.brandName || 'Brand',\n welcomeMessage: config?.welcomeMessage,\n };\n }\n\n isSupported(): boolean {\n return !!this.aiEndpoint;\n }\n\n protected async generateInitialResponse(\n session: SISession,\n intent: string\n ): Promise<{ message?: string; ui_elements?: any[] }> {\n if (!this.isSupported()) {\n return super.generateInitialResponse(session, intent);\n }\n\n // In a real implementation, this would:\n // 1. Parse the intent to understand what the user needs\n // 2. Call AI service to generate personalized greeting\n // 3. Optionally include product recommendations\n return {\n message:\n this.brandConfig?.welcomeMessage ||\n `Welcome to ${this.brandConfig?.brandName}! I see you're interested in ${intent}. How can I help?`,\n };\n }\n}\n\n/**\n * Default singleton instance for servers that don't support SI\n */\nexport const defaultSISessionManager = new SISessionManager();\n"],"mappings":";;;;;;AA0FO,MAAM,eAAe;AAAA,EAC1B,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,0BAA0B;AAC5B;AASO,MAAM,iBAA8C;AAAA,EACjD,WAAmC,oBAAI,IAAI;AAAA,EAC3C,YAA8B,oBAAI,IAAI;AAAA;AAAA,EACtC,gBAAgB;AAAA;AAAA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,aAAa;AAAA,MAChC,gBAAgB,QAAQ;AAAA,IAC1B;AAAA,EACF;AAAA,EAEA,cAAuB;AACrB,WAAO,CAAC,CAAC,KAAK;AAAA,EAChB;AAAA,EAEA,MAAgB,wBACd,SACA,QACoD;AACpD,QAAI,CAAC,KAAK,YAAY,GAAG;AACvB,aAAO,MAAM,wBAAwB,SAAS,MAAM;AAAA,IACtD;AAMA,WAAO;AAAA,MACL,SACE,KAAK,aAAa,kBAClB,cAAc,KAAK,aAAa,SAAS,gCAAgC,MAAM;AAAA,IACnF;AAAA,EACF;AACF;AAKO,MAAM,0BAA0B,IAAI,iBAAiB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/adapters/si-session-manager.ts"],"sourcesContent":["/**\n * Sponsored Intelligence (SI) Session Manager\n *\n * Server-side adapter for managing SI conversational commerce sessions.\n * Brands use this to handle session lifecycle and message routing to their\n * conversational AI systems.\n *\n * This is a stub implementation that doesn't support sessions.\n * Brands should extend or replace this with their conversation logic.\n */\n\nimport type {\n SIGetOfferingRequest,\n SIGetOfferingResponse,\n SIInitiateSessionRequest,\n SIInitiateSessionResponse,\n SISendMessageRequest,\n SISendMessageResponse,\n SITerminateSessionRequest,\n SITerminateSessionResponse,\n SICapabilities,\n} from '../types/tools.generated';\n\n/**\n * Internal session state\n */\nexport interface SISession {\n sessionId: string;\n createdAt: string;\n lastActiveAt: string;\n identity: any;\n mediaBuyId?: string;\n offeringId?: string;\n offeringToken?: string;\n placement?: string;\n negotiatedCapabilities?: SICapabilities;\n status: 'active' | 'pending_handoff' | 'complete' | 'terminated';\n messageCount: number;\n conversationHistory: {\n role: 'user' | 'brand';\n content: string;\n timestamp: string;\n }[];\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Abstract interface for SI session managers.\n * Brands implement this to provide their conversational AI logic.\n */\nexport interface ISISessionManager {\n /**\n * Check if SI is supported by this server\n */\n isSupported(): boolean;\n\n /**\n * Get offering details for display to user\n */\n getOffering(request: SIGetOfferingRequest): Promise<SIGetOfferingResponse>;\n\n /**\n * Initiate a new SI session\n */\n initiateSession(request: SIInitiateSessionRequest): Promise<SIInitiateSessionResponse>;\n\n /**\n * Handle a message within a session\n */\n sendMessage(request: SISendMessageRequest): Promise<SISendMessageResponse>;\n\n /**\n * Terminate a session\n */\n terminateSession(request: SITerminateSessionRequest): Promise<SITerminateSessionResponse>;\n\n /**\n * Get session state (for internal use)\n */\n getSession(sessionId: string): Promise<SISession | null>;\n\n /**\n * Clean up stale sessions\n */\n cleanupStaleSessions(maxAgeMinutes: number): Promise<number>;\n}\n\n/**\n * Error codes for SI operations\n */\nexport const SIErrorCodes = {\n NOT_SUPPORTED: 'UNSUPPORTED_FEATURE',\n SESSION_NOT_FOUND: 'REFERENCE_NOT_FOUND',\n SESSION_EXPIRED: 'INVALID_STATE',\n SESSION_TERMINATED: 'INVALID_STATE',\n OFFERING_NOT_FOUND: 'REFERENCE_NOT_FOUND',\n OFFERING_UNAVAILABLE: 'PRODUCT_UNAVAILABLE',\n INVALID_MESSAGE: 'INVALID_REQUEST',\n CAPABILITY_NOT_SUPPORTED: 'UNSUPPORTED_FEATURE',\n} as const;\n\n/**\n * Stub implementation of SISessionManager.\n * Uses in-memory storage and returns not-supported errors.\n *\n * Brands should extend this class or provide their own implementation\n * that integrates with their conversational AI systems.\n */\nexport class SISessionManager implements ISISessionManager {\n private sessions: Map<string, SISession> = new Map();\n private offerings: Map<string, any> = new Map(); // Offering cache\n private nextSessionId = 1;\n\n /**\n * Check if SI is supported.\n * Override this to return true when implementing real logic.\n */\n isSupported(): boolean {\n return false;\n }\n\n async getOffering(request: SIGetOfferingRequest): Promise<SIGetOfferingResponse> {\n if (!this.isSupported()) {\n return {\n status: 'failed',\n available: false,\n unavailable_reason: 'SI not supported by this server',\n errors: [\n {\n code: SIErrorCodes.NOT_SUPPORTED,\n message: 'Sponsored Intelligence is not supported by this server',\n },\n ],\n };\n }\n\n // Override in subclass to implement actual offering lookup\n return {\n status: 'failed',\n available: false,\n unavailable_reason: 'Offering not found',\n errors: [\n {\n code: SIErrorCodes.OFFERING_NOT_FOUND,\n message: `Offering not found: ${request.offering_id}`,\n },\n ],\n };\n }\n\n async initiateSession(request: SIInitiateSessionRequest): Promise<SIInitiateSessionResponse> {\n if (!this.isSupported()) {\n return {\n status: 'failed',\n session_id: '',\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.NOT_SUPPORTED,\n message: 'Sponsored Intelligence is not supported by this server',\n },\n ],\n };\n }\n\n // Create session\n const sessionId = this.generateSessionId();\n const now = new Date().toISOString();\n\n const session: SISession = {\n sessionId,\n createdAt: now,\n lastActiveAt: now,\n identity: request.identity,\n mediaBuyId: request.media_buy_id ?? undefined,\n offeringId: request.offering_id ?? undefined,\n offeringToken: request.offering_token ?? undefined,\n placement: request.placement ?? undefined,\n negotiatedCapabilities: this.negotiateCapabilities(request.supported_capabilities ?? undefined),\n status: 'active',\n messageCount: 0,\n conversationHistory: [],\n };\n\n this.sessions.set(sessionId, session);\n\n // Generate initial response. `intent` is the natural-language handoff\n // (AdCP 3.0 GA renamed the former string-valued `context` to `intent`;\n // `context` now carries the protocol envelope object).\n const initialResponse = await this.generateInitialResponse(session, request.intent);\n\n return {\n status: 'completed',\n session_id: sessionId,\n session_status: 'active',\n response: initialResponse,\n negotiated_capabilities: session.negotiatedCapabilities,\n };\n }\n\n async sendMessage(request: SISendMessageRequest): Promise<SISendMessageResponse> {\n if (!this.isSupported()) {\n return {\n status: 'failed',\n session_id: request.session_id,\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.NOT_SUPPORTED,\n message: 'Sponsored Intelligence is not supported by this server',\n },\n ],\n };\n }\n\n const session = await this.getSession(request.session_id);\n if (!session) {\n return {\n status: 'failed',\n session_id: request.session_id,\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.SESSION_NOT_FOUND,\n message: `Session not found: ${request.session_id}`,\n },\n ],\n };\n }\n\n if (session.status === 'terminated' || session.status === 'complete') {\n return {\n status: 'failed',\n session_id: request.session_id,\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.SESSION_TERMINATED,\n message: 'Session is not active',\n },\n ],\n };\n }\n\n // Record user message\n if (request.message) {\n session.conversationHistory.push({\n role: 'user',\n content: request.message,\n timestamp: new Date().toISOString(),\n });\n }\n\n session.messageCount++;\n session.lastActiveAt = new Date().toISOString();\n\n // Generate response\n const response = await this.generateResponse(session, request);\n\n // Record brand response\n if (response.message) {\n session.conversationHistory.push({\n role: 'brand',\n content: response.message,\n timestamp: new Date().toISOString(),\n });\n }\n\n this.sessions.set(session.sessionId, session);\n\n return {\n status: 'completed',\n session_id: session.sessionId,\n response,\n session_status: session.status,\n };\n }\n\n async terminateSession(request: SITerminateSessionRequest): Promise<SITerminateSessionResponse> {\n if (!this.isSupported()) {\n return {\n status: 'failed',\n session_id: request.session_id,\n terminated: false,\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.NOT_SUPPORTED,\n message: 'Sponsored Intelligence is not supported by this server',\n },\n ],\n };\n }\n\n const session = await this.getSession(request.session_id);\n if (!session) {\n return {\n status: 'failed',\n session_id: request.session_id,\n terminated: false,\n session_status: 'terminated',\n errors: [\n {\n code: SIErrorCodes.SESSION_NOT_FOUND,\n message: `Session not found: ${request.session_id}`,\n },\n ],\n };\n }\n\n // Update session status\n session.status = 'terminated';\n this.sessions.set(session.sessionId, session);\n\n // Generate ACP handoff data if this is a transaction handoff\n let acpHandoff: SITerminateSessionResponse['acp_handoff'];\n if (request.reason === 'handoff_transaction') {\n acpHandoff = await this.generateACPHandoff(session, request.termination_context);\n }\n\n return {\n status: 'completed',\n session_id: session.sessionId,\n terminated: true,\n session_status: 'terminated',\n acp_handoff: acpHandoff,\n };\n }\n\n /**\n * Generate ACP handoff data for checkout.\n * Override to implement actual checkout flow integration.\n */\n protected async generateACPHandoff(\n session: SISession,\n terminationContext?: SITerminateSessionRequest['termination_context']\n ): Promise<SITerminateSessionResponse['acp_handoff']> {\n // Stub returns undefined (no checkout URL)\n return undefined;\n }\n\n async getSession(sessionId: string): Promise<SISession | null> {\n return this.sessions.get(sessionId) || null;\n }\n\n async cleanupStaleSessions(maxAgeMinutes: number): Promise<number> {\n const cutoff = new Date();\n cutoff.setMinutes(cutoff.getMinutes() - maxAgeMinutes);\n\n let removed = 0;\n for (const [id, session] of this.sessions) {\n if (new Date(session.lastActiveAt) < cutoff) {\n this.sessions.delete(id);\n removed++;\n }\n }\n\n return removed;\n }\n\n /**\n * Generate a unique session ID.\n */\n protected generateSessionId(): string {\n return `si_${this.nextSessionId++}_${Date.now()}`;\n }\n\n /**\n * Negotiate capabilities between host and brand.\n * Override to customize capability negotiation.\n */\n protected negotiateCapabilities(hostCapabilities?: SICapabilities): SICapabilities {\n // Stub returns minimal capabilities\n return {\n modalities: {\n conversational: true,\n },\n };\n }\n\n /**\n * Generate initial response when session is created.\n * Override to implement actual greeting/welcome logic.\n *\n * `intent` is the natural-language handoff from the host (AdCP 3.0 GA\n * renamed the former string-valued `context` field to `intent`).\n */\n protected async generateInitialResponse(\n session: SISession,\n intent: string\n ): Promise<{ message?: string; ui_elements?: any[] }> {\n // Stub returns a generic greeting\n return {\n message: 'Welcome! How can I help you today?',\n };\n }\n\n /**\n * Generate response to a user message.\n * Override to implement actual conversational AI logic.\n */\n protected async generateResponse(\n session: SISession,\n request: SISendMessageRequest\n ): Promise<{ message?: string; ui_elements?: any[] }> {\n // Stub returns a generic response\n return {\n message: \"I'm sorry, but I'm not able to help with that right now. Is there anything else I can assist you with?\",\n };\n }\n\n /**\n * Generate a summary of the conversation.\n * Override to implement actual summarization logic.\n */\n protected async generateConversationSummary(session: SISession): Promise<string> {\n return `Conversation with ${session.messageCount} messages.`;\n }\n}\n\n/**\n * Example of an AI-powered SI session manager (stub).\n * Shows how brands might extend the base class.\n */\nexport class AISISessionManager extends SISessionManager {\n private aiEndpoint?: string;\n private brandConfig?: {\n brandName: string;\n welcomeMessage?: string;\n offerings?: Map<string, any>;\n };\n\n constructor(config?: { aiEndpoint?: string; brandName?: string; welcomeMessage?: string }) {\n super();\n this.aiEndpoint = config?.aiEndpoint;\n this.brandConfig = {\n brandName: config?.brandName || 'Brand',\n welcomeMessage: config?.welcomeMessage,\n };\n }\n\n isSupported(): boolean {\n return !!this.aiEndpoint;\n }\n\n protected async generateInitialResponse(\n session: SISession,\n intent: string\n ): Promise<{ message?: string; ui_elements?: any[] }> {\n if (!this.isSupported()) {\n return super.generateInitialResponse(session, intent);\n }\n\n // In a real implementation, this would:\n // 1. Parse the intent to understand what the user needs\n // 2. Call AI service to generate personalized greeting\n // 3. Optionally include product recommendations\n return {\n message:\n this.brandConfig?.welcomeMessage ||\n `Welcome to ${this.brandConfig?.brandName}! I see you're interested in ${intent}. How can I help?`,\n };\n }\n}\n\n/**\n * Default singleton instance for servers that don't support SI\n */\nexport const defaultSISessionManager = new SISessionManager();\n"],"mappings":"AA0FO,MAAM,eAAe;AAAA,EAC1B,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,0BAA0B;AAC5B;AASO,MAAM,iBAA8C;AAAA,EACjD,WAAmC,oBAAI,IAAI;AAAA,EAC3C,YAA8B,oBAAI,IAAI;AAAA;AAAA,EACtC,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxB,cAAuB;AACrB,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,YAAY,SAA+D;AAC/E,QAAI,CAAC,KAAK,YAAY,GAAG;AACvB,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,oBAAoB;AAAA,QACpB,QAAQ;AAAA,UACN;AAAA,YACE,MAAM,aAAa;AAAA,YACnB,SAAS;AAAA,UACX;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAGA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,oBAAoB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BAA0B,IAAI,iBAAiB;","names":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname as __adcpDirname } from 'node:path';
|
|
3
|
-
import { createRequire as __adcpCreateRequire } from 'node:module';
|
|
4
|
-
const __filename = __adcpFileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = __adcpDirname(__filename);
|
|
6
|
-
const require = __adcpCreateRequire(import.meta.url);
|
|
7
1
|
import { omit31BrandFields } from "../../../utils/adcp-version-config.mjs";
|
|
8
2
|
const BRAND_DRIFT = {
|
|
9
3
|
type: "pre31_brand_fields_stripped",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/adapters/version/3.0/brand-fields.ts"],"sourcesContent":["import { omit31BrandFields } from '../../../utils/adcp-version-config';\nimport type { VersionAdapter, VersionDrift } from '../types';\n\nconst BRAND_DRIFT: VersionDrift = {\n type: 'pre31_brand_fields_stripped',\n message:\n 'brand_kit_override stripped: field requires AdCP 3.1 but the target seller does not advertise 3.1 support. ' +\n 'These fields will not reach the seller; brand identity (domain, brand_id) is preserved.',\n strippedFields: ['brand_kit_override'],\n};\n\nfunction stripTopLevelBrand(params: unknown): { params: unknown; drift?: VersionDrift } {\n if (!params || typeof params !== 'object') return { params };\n const req = params as Record<string, unknown>;\n if (!req.brand) return { params };\n const stripped = omit31BrandFields(req.brand);\n if (stripped === req.brand) return { params };\n return { params: { ...req, brand: stripped }, drift: BRAND_DRIFT };\n}\n\nexport const createMediaBuyAdapter: VersionAdapter = {\n toolName: 'create_media_buy',\n adaptRequest: stripTopLevelBrand,\n};\n\nexport const getProductsAdapter: VersionAdapter = {\n toolName: 'get_products',\n adaptRequest: stripTopLevelBrand,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/adapters/version/3.0/brand-fields.ts"],"sourcesContent":["import { omit31BrandFields } from '../../../utils/adcp-version-config';\nimport type { VersionAdapter, VersionDrift } from '../types';\n\nconst BRAND_DRIFT: VersionDrift = {\n type: 'pre31_brand_fields_stripped',\n message:\n 'brand_kit_override stripped: field requires AdCP 3.1 but the target seller does not advertise 3.1 support. ' +\n 'These fields will not reach the seller; brand identity (domain, brand_id) is preserved.',\n strippedFields: ['brand_kit_override'],\n};\n\nfunction stripTopLevelBrand(params: unknown): { params: unknown; drift?: VersionDrift } {\n if (!params || typeof params !== 'object') return { params };\n const req = params as Record<string, unknown>;\n if (!req.brand) return { params };\n const stripped = omit31BrandFields(req.brand);\n if (stripped === req.brand) return { params };\n return { params: { ...req, brand: stripped }, drift: BRAND_DRIFT };\n}\n\nexport const createMediaBuyAdapter: VersionAdapter = {\n toolName: 'create_media_buy',\n adaptRequest: stripTopLevelBrand,\n};\n\nexport const getProductsAdapter: VersionAdapter = {\n toolName: 'get_products',\n adaptRequest: stripTopLevelBrand,\n};\n"],"mappings":"AAAA,SAAS,yBAAyB;AAGlC,MAAM,cAA4B;AAAA,EAChC,MAAM;AAAA,EACN,SACE;AAAA,EAEF,gBAAgB,CAAC,oBAAoB;AACvC;AAEA,SAAS,mBAAmB,QAA4D;AACtF,MAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO,EAAE,OAAO;AAC3D,QAAM,MAAM;AACZ,MAAI,CAAC,IAAI,MAAO,QAAO,EAAE,OAAO;AAChC,QAAM,WAAW,kBAAkB,IAAI,KAAK;AAC5C,MAAI,aAAa,IAAI,MAAO,QAAO,EAAE,OAAO;AAC5C,SAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,OAAO,SAAS,GAAG,OAAO,YAAY;AACnE;AAEO,MAAM,wBAAwC;AAAA,EACnD,UAAU;AAAA,EACV,cAAc;AAChB;AAEO,MAAM,qBAAqC;AAAA,EAChD,UAAU;AAAA,EACV,cAAc;AAChB;","names":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname as __adcpDirname } from 'node:path';
|
|
3
|
-
import { createRequire as __adcpCreateRequire } from 'node:module';
|
|
4
|
-
const __filename = __adcpFileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = __adcpDirname(__filename);
|
|
6
|
-
const require = __adcpCreateRequire(import.meta.url);
|
|
7
1
|
import { omit31BrandFields } from "../../../utils/adcp-version-config.mjs";
|
|
8
2
|
const BRAND_DRIFT = {
|
|
9
3
|
type: "pre31_brand_fields_stripped",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/adapters/version/3.0/get-products.ts"],"sourcesContent":["import { omit31BrandFields } from '../../../utils/adcp-version-config';\nimport type { VersionAdapter, VersionDrift } from '../types';\n\nconst BRAND_DRIFT: VersionDrift = {\n type: 'pre31_brand_fields_stripped',\n message:\n 'brand_kit_override stripped: field requires AdCP 3.1 but the target seller does not advertise 3.1 support. ' +\n 'These fields will not reach the seller; brand identity (domain, brand_id) is preserved.',\n strippedFields: ['brand_kit_override'],\n};\n\nconst PRICING_FILTERS_DRIFT: VersionDrift = {\n type: 'pre31_pricing_currencies_stripped',\n message:\n 'filters.pricing_currencies stripped: field requires AdCP 3.1 but the target seller does not advertise 3.1 support. ' +\n 'The seller will return products in all available currencies.',\n strippedFields: ['filters.pricing_currencies'],\n};\n\nexport const getProductsAdapter: VersionAdapter = {\n toolName: 'get_products',\n adaptRequest(params) {\n if (!params || typeof params !== 'object') return { params };\n const req = params as Record<string, unknown>;\n let adapted: Record<string, unknown> = req;\n const drifts: VersionDrift[] = [];\n\n // Strip 3.1-only brand fields.\n if (adapted.brand) {\n const stripped = omit31BrandFields(adapted.brand);\n if (stripped !== adapted.brand) {\n adapted = { ...adapted, brand: stripped };\n drifts.push(BRAND_DRIFT);\n }\n }\n\n // Strip filters.pricing_currencies — 3.1-only filter. 3.0 sellers return\n // UNSUPPORTED_FEATURE and 0 products when they receive this field.\n if (adapted.filters && typeof adapted.filters === 'object') {\n const filters = adapted.filters as Record<string, unknown>;\n if ('pricing_currencies' in filters) {\n const { pricing_currencies: _, ...restFilters } = filters;\n adapted = { ...adapted, filters: restFilters };\n drifts.push(PRICING_FILTERS_DRIFT);\n }\n }\n\n if (adapted === req) return { params };\n return { params: adapted, drift: drifts[0] };\n },\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/adapters/version/3.0/get-products.ts"],"sourcesContent":["import { omit31BrandFields } from '../../../utils/adcp-version-config';\nimport type { VersionAdapter, VersionDrift } from '../types';\n\nconst BRAND_DRIFT: VersionDrift = {\n type: 'pre31_brand_fields_stripped',\n message:\n 'brand_kit_override stripped: field requires AdCP 3.1 but the target seller does not advertise 3.1 support. ' +\n 'These fields will not reach the seller; brand identity (domain, brand_id) is preserved.',\n strippedFields: ['brand_kit_override'],\n};\n\nconst PRICING_FILTERS_DRIFT: VersionDrift = {\n type: 'pre31_pricing_currencies_stripped',\n message:\n 'filters.pricing_currencies stripped: field requires AdCP 3.1 but the target seller does not advertise 3.1 support. ' +\n 'The seller will return products in all available currencies.',\n strippedFields: ['filters.pricing_currencies'],\n};\n\nexport const getProductsAdapter: VersionAdapter = {\n toolName: 'get_products',\n adaptRequest(params) {\n if (!params || typeof params !== 'object') return { params };\n const req = params as Record<string, unknown>;\n let adapted: Record<string, unknown> = req;\n const drifts: VersionDrift[] = [];\n\n // Strip 3.1-only brand fields.\n if (adapted.brand) {\n const stripped = omit31BrandFields(adapted.brand);\n if (stripped !== adapted.brand) {\n adapted = { ...adapted, brand: stripped };\n drifts.push(BRAND_DRIFT);\n }\n }\n\n // Strip filters.pricing_currencies — 3.1-only filter. 3.0 sellers return\n // UNSUPPORTED_FEATURE and 0 products when they receive this field.\n if (adapted.filters && typeof adapted.filters === 'object') {\n const filters = adapted.filters as Record<string, unknown>;\n if ('pricing_currencies' in filters) {\n const { pricing_currencies: _, ...restFilters } = filters;\n adapted = { ...adapted, filters: restFilters };\n drifts.push(PRICING_FILTERS_DRIFT);\n }\n }\n\n if (adapted === req) return { params };\n return { params: adapted, drift: drifts[0] };\n },\n};\n"],"mappings":"AAAA,SAAS,yBAAyB;AAGlC,MAAM,cAA4B;AAAA,EAChC,MAAM;AAAA,EACN,SACE;AAAA,EAEF,gBAAgB,CAAC,oBAAoB;AACvC;AAEA,MAAM,wBAAsC;AAAA,EAC1C,MAAM;AAAA,EACN,SACE;AAAA,EAEF,gBAAgB,CAAC,4BAA4B;AAC/C;AAEO,MAAM,qBAAqC;AAAA,EAChD,UAAU;AAAA,EACV,aAAa,QAAQ;AACnB,QAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO,EAAE,OAAO;AAC3D,UAAM,MAAM;AACZ,QAAI,UAAmC;AACvC,UAAM,SAAyB,CAAC;AAGhC,QAAI,QAAQ,OAAO;AACjB,YAAM,WAAW,kBAAkB,QAAQ,KAAK;AAChD,UAAI,aAAa,QAAQ,OAAO;AAC9B,kBAAU,EAAE,GAAG,SAAS,OAAO,SAAS;AACxC,eAAO,KAAK,WAAW;AAAA,MACzB;AAAA,IACF;AAIA,QAAI,QAAQ,WAAW,OAAO,QAAQ,YAAY,UAAU;AAC1D,YAAM,UAAU,QAAQ;AACxB,UAAI,wBAAwB,SAAS;AACnC,cAAM,EAAE,oBAAoB,GAAG,GAAG,YAAY,IAAI;AAClD,kBAAU,EAAE,GAAG,SAAS,SAAS,YAAY;AAC7C,eAAO,KAAK,qBAAqB;AAAA,MACnC;AAAA,IACF;AAEA,QAAI,YAAY,IAAK,QAAO,EAAE,OAAO;AACrC,WAAO,EAAE,QAAQ,SAAS,OAAO,OAAO,CAAC,EAAE;AAAA,EAC7C;AACF;","names":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname as __adcpDirname } from 'node:path';
|
|
3
|
-
import { createRequire as __adcpCreateRequire } from 'node:module';
|
|
4
|
-
const __filename = __adcpFileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = __adcpDirname(__filename);
|
|
6
|
-
const require = __adcpCreateRequire(import.meta.url);
|
|
7
1
|
import { createMediaBuyAdapter } from "./brand-fields.mjs";
|
|
8
2
|
import { getProductsAdapter } from "./get-products.mjs";
|
|
9
3
|
import { syncAccountsAdapter } from "./sync-accounts.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/adapters/version/3.0/index.ts"],"sourcesContent":["import { createMediaBuyAdapter } from './brand-fields';\nimport { getProductsAdapter } from './get-products';\nimport { syncAccountsAdapter } from './sync-accounts';\nimport type { VersionAdapter } from '../types';\n\nexport const v30Adapters: ReadonlyArray<VersionAdapter> = [\n createMediaBuyAdapter,\n getProductsAdapter,\n syncAccountsAdapter,\n];\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/adapters/version/3.0/index.ts"],"sourcesContent":["import { createMediaBuyAdapter } from './brand-fields';\nimport { getProductsAdapter } from './get-products';\nimport { syncAccountsAdapter } from './sync-accounts';\nimport type { VersionAdapter } from '../types';\n\nexport const v30Adapters: ReadonlyArray<VersionAdapter> = [\n createMediaBuyAdapter,\n getProductsAdapter,\n syncAccountsAdapter,\n];\n"],"mappings":"AAAA,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AAG7B,MAAM,cAA6C;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname as __adcpDirname } from 'node:path';
|
|
3
|
-
import { createRequire as __adcpCreateRequire } from 'node:module';
|
|
4
|
-
const __filename = __adcpFileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = __adcpDirname(__filename);
|
|
6
|
-
const require = __adcpCreateRequire(import.meta.url);
|
|
7
1
|
import { omit31BrandFields } from "../../../utils/adcp-version-config.mjs";
|
|
8
2
|
const BRAND_DRIFT = {
|
|
9
3
|
type: "pre31_brand_fields_stripped",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/adapters/version/3.0/sync-accounts.ts"],"sourcesContent":["import { omit31BrandFields } from '../../../utils/adcp-version-config';\nimport type { VersionAdapter, VersionDrift } from '../types';\n\nconst BRAND_DRIFT: VersionDrift = {\n type: 'pre31_brand_fields_stripped',\n message:\n 'brand_kit_override stripped from accounts[].brand: field requires AdCP 3.1 but the target seller does not advertise 3.1 support. ' +\n 'These fields will not reach the seller; brand identity (domain, brand_id) is preserved.',\n strippedFields: ['brand_kit_override'],\n};\n\nexport const syncAccountsAdapter: VersionAdapter = {\n toolName: 'sync_accounts',\n adaptRequest(params) {\n if (!params || typeof params !== 'object') return { params };\n const req = params as Record<string, unknown>;\n if (!Array.isArray(req.accounts)) return { params };\n let stripped = false;\n const accounts = (req.accounts as Array<Record<string, unknown>>).map(a => {\n if (!a || typeof a !== 'object' || !a.brand) return a;\n const strippedBrand = omit31BrandFields(a.brand);\n if (strippedBrand === a.brand) return a;\n stripped = true;\n return { ...a, brand: strippedBrand };\n });\n if (!stripped) return { params };\n return { params: { ...req, accounts }, drift: BRAND_DRIFT };\n },\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/adapters/version/3.0/sync-accounts.ts"],"sourcesContent":["import { omit31BrandFields } from '../../../utils/adcp-version-config';\nimport type { VersionAdapter, VersionDrift } from '../types';\n\nconst BRAND_DRIFT: VersionDrift = {\n type: 'pre31_brand_fields_stripped',\n message:\n 'brand_kit_override stripped from accounts[].brand: field requires AdCP 3.1 but the target seller does not advertise 3.1 support. ' +\n 'These fields will not reach the seller; brand identity (domain, brand_id) is preserved.',\n strippedFields: ['brand_kit_override'],\n};\n\nexport const syncAccountsAdapter: VersionAdapter = {\n toolName: 'sync_accounts',\n adaptRequest(params) {\n if (!params || typeof params !== 'object') return { params };\n const req = params as Record<string, unknown>;\n if (!Array.isArray(req.accounts)) return { params };\n let stripped = false;\n const accounts = (req.accounts as Array<Record<string, unknown>>).map(a => {\n if (!a || typeof a !== 'object' || !a.brand) return a;\n const strippedBrand = omit31BrandFields(a.brand);\n if (strippedBrand === a.brand) return a;\n stripped = true;\n return { ...a, brand: strippedBrand };\n });\n if (!stripped) return { params };\n return { params: { ...req, accounts }, drift: BRAND_DRIFT };\n },\n};\n"],"mappings":"AAAA,SAAS,yBAAyB;AAGlC,MAAM,cAA4B;AAAA,EAChC,MAAM;AAAA,EACN,SACE;AAAA,EAEF,gBAAgB,CAAC,oBAAoB;AACvC;AAEO,MAAM,sBAAsC;AAAA,EACjD,UAAU;AAAA,EACV,aAAa,QAAQ;AACnB,QAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO,EAAE,OAAO;AAC3D,UAAM,MAAM;AACZ,QAAI,CAAC,MAAM,QAAQ,IAAI,QAAQ,EAAG,QAAO,EAAE,OAAO;AAClD,QAAI,WAAW;AACf,UAAM,WAAY,IAAI,SAA4C,IAAI,OAAK;AACzE,UAAI,CAAC,KAAK,OAAO,MAAM,YAAY,CAAC,EAAE,MAAO,QAAO;AACpD,YAAM,gBAAgB,kBAAkB,EAAE,KAAK;AAC/C,UAAI,kBAAkB,EAAE,MAAO,QAAO;AACtC,iBAAW;AACX,aAAO,EAAE,GAAG,GAAG,OAAO,cAAc;AAAA,IACtC,CAAC;AACD,QAAI,CAAC,SAAU,QAAO,EAAE,OAAO;AAC/B,WAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,SAAS,GAAG,OAAO,YAAY;AAAA,EAC5D;AACF;","names":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname as __adcpDirname } from 'node:path';
|
|
3
|
-
import { createRequire as __adcpCreateRequire } from 'node:module';
|
|
4
|
-
const __filename = __adcpFileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = __adcpDirname(__filename);
|
|
6
|
-
const require = __adcpCreateRequire(import.meta.url);
|
|
7
1
|
import { shouldOmit31Fields } from "../../utils/adcp-version-config.mjs";
|
|
8
2
|
import { v30Adapters } from "./3.0/index.mjs";
|
|
9
3
|
const REGISTRY = /* @__PURE__ */ new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/adapters/version/index.ts"],"sourcesContent":["/**\n * Registry of per-version request adapters, keyed by target AdCP version string.\n *\n * `resolveAdapterKey` maps a (clientVersion, sellerCaps) pair to the adapter\n * key whose adapters should be applied. `getVersionAdapter` looks up the\n * per-tool adapter for that key. The dispatch in `SingleAgentClient` calls\n * both; tools without a registered adapter for the resolved key pass through\n * unchanged.\n *\n * Add a new version transition by:\n * 1. Create a `version/<target>/` directory with per-tool adapter modules.\n * 2. Collect them in `version/<target>/index.ts` as a `ReadonlyArray<VersionAdapter>`.\n * 3. Register below.\n * 4. Add tests to the conformance suite.\n */\n\nimport { shouldOmit31Fields } from '../../utils/adcp-version-config';\nimport type { VersionAdapter } from './types';\nimport { v30Adapters } from './3.0/index';\n\nexport type { VersionAdapter, VersionDrift } from './types';\n\nconst REGISTRY = new Map<string, ReadonlyMap<string, VersionAdapter>>();\n\nfunction register(version: string, adapters: ReadonlyArray<VersionAdapter>): void {\n REGISTRY.set(version, new Map(adapters.map(a => [a.toolName, a])));\n}\n\nregister('3.0', v30Adapters);\n\n/**\n * Look up the version adapter for a given (adapterKey, toolName) pair.\n * Returns `undefined` when no adapter is registered — caller passes through.\n */\nexport function getVersionAdapter(adapterKey: string, toolName: string): VersionAdapter | undefined {\n return REGISTRY.get(adapterKey)?.get(toolName);\n}\n\n/**\n * Resolve the adapter key for the current (clientVersion, sellerCaps) pair.\n * Returns `undefined` when no adaptation is needed (both sides speak the same\n * or a compatible version). Returns `'3.0'` when either the client is pinned\n * below 3.1 or the seller does not advertise 3.1 support.\n */\nexport function resolveAdapterKey(\n clientVersion: string | undefined,\n caps: { supportedVersions?: string[]; buildVersion?: string } | undefined\n): string | undefined {\n if (shouldOmit31Fields(clientVersion, caps)) return '3.0';\n return undefined;\n}\n\n/**\n * Names of tools registered for a given adapter key.\n * Used by the conformance test suite as the authoritative list.\n */\nexport function listVersionAdapterTools(adapterKey: string): string[] {\n return [...(REGISTRY.get(adapterKey)?.keys() ?? [])];\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/adapters/version/index.ts"],"sourcesContent":["/**\n * Registry of per-version request adapters, keyed by target AdCP version string.\n *\n * `resolveAdapterKey` maps a (clientVersion, sellerCaps) pair to the adapter\n * key whose adapters should be applied. `getVersionAdapter` looks up the\n * per-tool adapter for that key. The dispatch in `SingleAgentClient` calls\n * both; tools without a registered adapter for the resolved key pass through\n * unchanged.\n *\n * Add a new version transition by:\n * 1. Create a `version/<target>/` directory with per-tool adapter modules.\n * 2. Collect them in `version/<target>/index.ts` as a `ReadonlyArray<VersionAdapter>`.\n * 3. Register below.\n * 4. Add tests to the conformance suite.\n */\n\nimport { shouldOmit31Fields } from '../../utils/adcp-version-config';\nimport type { VersionAdapter } from './types';\nimport { v30Adapters } from './3.0/index';\n\nexport type { VersionAdapter, VersionDrift } from './types';\n\nconst REGISTRY = new Map<string, ReadonlyMap<string, VersionAdapter>>();\n\nfunction register(version: string, adapters: ReadonlyArray<VersionAdapter>): void {\n REGISTRY.set(version, new Map(adapters.map(a => [a.toolName, a])));\n}\n\nregister('3.0', v30Adapters);\n\n/**\n * Look up the version adapter for a given (adapterKey, toolName) pair.\n * Returns `undefined` when no adapter is registered — caller passes through.\n */\nexport function getVersionAdapter(adapterKey: string, toolName: string): VersionAdapter | undefined {\n return REGISTRY.get(adapterKey)?.get(toolName);\n}\n\n/**\n * Resolve the adapter key for the current (clientVersion, sellerCaps) pair.\n * Returns `undefined` when no adaptation is needed (both sides speak the same\n * or a compatible version). Returns `'3.0'` when either the client is pinned\n * below 3.1 or the seller does not advertise 3.1 support.\n */\nexport function resolveAdapterKey(\n clientVersion: string | undefined,\n caps: { supportedVersions?: string[]; buildVersion?: string } | undefined\n): string | undefined {\n if (shouldOmit31Fields(clientVersion, caps)) return '3.0';\n return undefined;\n}\n\n/**\n * Names of tools registered for a given adapter key.\n * Used by the conformance test suite as the authoritative list.\n */\nexport function listVersionAdapterTools(adapterKey: string): string[] {\n return [...(REGISTRY.get(adapterKey)?.keys() ?? [])];\n}\n"],"mappings":"AAgBA,SAAS,0BAA0B;AAEnC,SAAS,mBAAmB;AAI5B,MAAM,WAAW,oBAAI,IAAiD;AAEtE,SAAS,SAAS,SAAiB,UAA+C;AAChF,WAAS,IAAI,SAAS,IAAI,IAAI,SAAS,IAAI,OAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;AACnE;AAEA,SAAS,OAAO,WAAW;AAMpB,SAAS,kBAAkB,YAAoB,UAA8C;AAClG,SAAO,SAAS,IAAI,UAAU,GAAG,IAAI,QAAQ;AAC/C;AAQO,SAAS,kBACd,eACA,MACoB;AACpB,MAAI,mBAAmB,eAAe,IAAI,EAAG,QAAO;AACpD,SAAO;AACT;AAMO,SAAS,wBAAwB,YAA8B;AACpE,SAAO,CAAC,GAAI,SAAS,IAAI,UAAU,GAAG,KAAK,KAAK,CAAC,CAAE;AACrD;","names":[]}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname as __adcpDirname } from 'node:path';
|
|
3
|
-
import { createRequire as __adcpCreateRequire } from 'node:module';
|
|
4
|
-
const __filename = __adcpFileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = __adcpDirname(__filename);
|
|
6
|
-
const require = __adcpCreateRequire(import.meta.url);
|
|
7
1
|
//# sourceMappingURL=types.mjs.map
|
package/dist/lib/advanced.mjs
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname as __adcpDirname } from 'node:path';
|
|
3
|
-
import { createRequire as __adcpCreateRequire } from 'node:module';
|
|
4
|
-
const __filename = __adcpFileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = __adcpDirname(__filename);
|
|
6
|
-
const require = __adcpCreateRequire(import.meta.url);
|
|
7
1
|
import { ProtocolClient, callMCPTool, callA2ATool, createMCPClient, createA2AClient } from "./protocols/index.mjs";
|
|
8
2
|
export {
|
|
9
3
|
ProtocolClient,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/advanced.ts"],"sourcesContent":["/**\n * Advanced exports for library authors building custom protocol implementations\n *\n * @remarks\n * **Most developers should use AdCPClient from the main export**, which provides:\n * - Single-agent access via `client.agent(id)` with conversation context\n * - Multi-agent parallel operations via `client.agents([ids])`\n * - All AdCP tools with full type safety\n *\n * These low-level protocol clients are only needed if you're:\n * - Building custom protocol handlers\n * - Integrating AdCP with other frameworks\n * - Implementing custom agent orchestration\n *\n * @example\n * ```typescript\n * // ❌ Don't do this - use main AdCPClient instead:\n * import { callA2ATool } from '@adcp/sdk/advanced';\n *\n * // ✅ Do this - use the main client:\n * import { AdCPClient } from '@adcp/sdk';\n * const client = new AdCPClient([agentConfig]);\n * const agent = client.agent('agent-id');\n * await agent.getProducts({ brief: '...' });\n * ```\n */\n\n/**\n * Protocol-level clients for direct protocol interaction\n *\n * @remarks\n * Low-level clients for MCP and A2A protocols. Used internally by AdCPClient.\n * Only use these if you need to build custom protocol handlers or integrations.\n *\n * For normal usage, prefer AdCPClient which wraps these and provides:\n * - Automatic agent configuration\n * - Conversation context management\n * - Type-safe tool methods\n * - Error handling and validation\n */\nexport { ProtocolClient, callMCPTool, callA2ATool, createMCPClient, createA2AClient } from './protocols';\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/lib/advanced.ts"],"sourcesContent":["/**\n * Advanced exports for library authors building custom protocol implementations\n *\n * @remarks\n * **Most developers should use AdCPClient from the main export**, which provides:\n * - Single-agent access via `client.agent(id)` with conversation context\n * - Multi-agent parallel operations via `client.agents([ids])`\n * - All AdCP tools with full type safety\n *\n * These low-level protocol clients are only needed if you're:\n * - Building custom protocol handlers\n * - Integrating AdCP with other frameworks\n * - Implementing custom agent orchestration\n *\n * @example\n * ```typescript\n * // ❌ Don't do this - use main AdCPClient instead:\n * import { callA2ATool } from '@adcp/sdk/advanced';\n *\n * // ✅ Do this - use the main client:\n * import { AdCPClient } from '@adcp/sdk';\n * const client = new AdCPClient([agentConfig]);\n * const agent = client.agent('agent-id');\n * await agent.getProducts({ brief: '...' });\n * ```\n */\n\n/**\n * Protocol-level clients for direct protocol interaction\n *\n * @remarks\n * Low-level clients for MCP and A2A protocols. Used internally by AdCPClient.\n * Only use these if you need to build custom protocol handlers or integrations.\n *\n * For normal usage, prefer AdCPClient which wraps these and provides:\n * - Automatic agent configuration\n * - Conversation context management\n * - Type-safe tool methods\n * - Error handling and validation\n */\nexport { ProtocolClient, callMCPTool, callA2ATool, createMCPClient, createA2AClient } from './protocols';\n"],"mappings":"AAwCA,SAAS,gBAAgB,aAAa,aAAa,iBAAiB,uBAAuB;","names":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname as __adcpDirname } from 'node:path';
|
|
3
|
-
import { createRequire as __adcpCreateRequire } from 'node:module';
|
|
4
|
-
const __filename = __adcpFileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = __adcpDirname(__filename);
|
|
6
|
-
const require = __adcpCreateRequire(import.meta.url);
|
|
7
1
|
import { ProtocolClient } from "../protocols/index.mjs";
|
|
8
2
|
import { validateAgentUrl } from "../validation/index.mjs";
|
|
9
3
|
import { getCircuitBreaker, unwrapProtocolResponse } from "../utils/index.mjs";
|