@adcp/sdk 15.9.0 → 16.0.0-beta.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/bin/adcp-identity.js +74 -0
- package/bin/adcp.js +2 -0
- package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
- package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
- package/dist/lib/adapters/keyed-account-backend.js +121 -0
- package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
- package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
- package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
- package/dist/lib/adapters/keyed-account-store.js +227 -0
- package/dist/lib/adapters/keyed-account-store.mjs +203 -0
- package/dist/lib/core/SingleAgentClient.d.mts +16 -2
- package/dist/lib/core/SingleAgentClient.d.ts +16 -2
- package/dist/lib/core/SingleAgentClient.js +259 -62
- package/dist/lib/core/SingleAgentClient.mjs +261 -57
- package/dist/lib/core/TaskExecutor.d.mts +6 -0
- package/dist/lib/core/TaskExecutor.d.ts +6 -0
- package/dist/lib/core/TaskExecutor.js +66 -5
- package/dist/lib/core/TaskExecutor.mjs +71 -5
- package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
- package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
- package/dist/lib/core/redis-webhook-registration-store.js +23 -1
- package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
- package/dist/lib/core/webhook-registration.d.mts +7 -1
- package/dist/lib/core/webhook-registration.d.ts +7 -1
- package/dist/lib/core/webhook-registration.js +24 -2
- package/dist/lib/core/webhook-registration.mjs +23 -2
- package/dist/lib/identity-3.3/index.d.mts +10 -0
- package/dist/lib/identity-3.3/index.d.ts +10 -0
- package/dist/lib/identity-3.3/index.js +75 -0
- package/dist/lib/identity-3.3/index.mjs +46 -0
- package/dist/lib/identity-3.3/lifecycle.d.mts +113 -0
- package/dist/lib/identity-3.3/lifecycle.d.ts +113 -0
- package/dist/lib/identity-3.3/lifecycle.js +267 -0
- package/dist/lib/identity-3.3/lifecycle.mjs +240 -0
- package/dist/lib/identity-3.3/revocation.d.mts +50 -0
- package/dist/lib/identity-3.3/revocation.d.ts +50 -0
- package/dist/lib/identity-3.3/revocation.js +238 -0
- package/dist/lib/identity-3.3/revocation.mjs +216 -0
- package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
- package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
- package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
- package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
- package/dist/lib/identity-3.3/server.d.mts +34 -0
- package/dist/lib/identity-3.3/server.d.ts +34 -0
- package/dist/lib/identity-3.3/server.js +219 -0
- package/dist/lib/identity-3.3/server.mjs +194 -0
- package/dist/lib/identity-3.3/store.d.mts +24 -0
- package/dist/lib/identity-3.3/store.d.ts +24 -0
- package/dist/lib/identity-3.3/store.js +191 -0
- package/dist/lib/identity-3.3/store.mjs +169 -0
- package/dist/lib/identity-3.3/trust.d.mts +94 -0
- package/dist/lib/identity-3.3/trust.d.ts +94 -0
- package/dist/lib/identity-3.3/trust.js +278 -0
- package/dist/lib/identity-3.3/trust.mjs +239 -0
- package/dist/lib/identity-3.3/types.d.mts +127 -0
- package/dist/lib/identity-3.3/types.d.ts +127 -0
- package/dist/lib/identity-3.3/types.js +16 -0
- package/dist/lib/identity-3.3/types.mjs +0 -0
- package/dist/lib/identity-3.3/validation.d.mts +2 -0
- package/dist/lib/identity-3.3/validation.d.ts +2 -0
- package/dist/lib/identity-3.3/validation.js +125 -0
- package/dist/lib/identity-3.3/validation.mjs +91 -0
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/reporting/azure/index.d.mts +5 -0
- package/dist/lib/reporting/azure/index.d.ts +5 -0
- package/dist/lib/reporting/azure/index.js +26 -7
- package/dist/lib/reporting/azure/index.mjs +26 -7
- package/dist/lib/reporting/bigquery/index.d.mts +80 -25
- package/dist/lib/reporting/bigquery/index.d.ts +80 -25
- package/dist/lib/reporting/bigquery/index.js +184 -81
- package/dist/lib/reporting/bigquery/index.mjs +182 -80
- package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
- package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
- package/dist/lib/reporting/gcs/errors.d.mts +6 -0
- package/dist/lib/reporting/gcs/errors.d.ts +6 -0
- package/dist/lib/reporting/gcs/fence.d.mts +5 -0
- package/dist/lib/reporting/gcs/fence.d.ts +5 -0
- package/dist/lib/reporting/gcs/index.d.mts +9 -0
- package/dist/lib/reporting/gcs/index.d.ts +9 -0
- package/dist/lib/reporting/gcs/reader.d.mts +27 -3
- package/dist/lib/reporting/gcs/reader.d.ts +27 -3
- package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
- package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
- package/dist/lib/reporting/gcs/row-provider.js +34 -14
- package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
- package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
- package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
- package/dist/lib/reporting/ledger/index.d.mts +11 -0
- package/dist/lib/reporting/ledger/index.d.ts +11 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
- package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
- package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
- package/dist/lib/reporting/ledger/managed.d.mts +86 -6
- package/dist/lib/reporting/ledger/managed.d.ts +86 -6
- package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
- package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
- package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
- package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
- package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
- package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
- package/dist/lib/reporting/ledger/postgres.js +43 -27
- package/dist/lib/reporting/ledger/postgres.mjs +43 -27
- package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
- package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
- package/dist/lib/reporting/ledger/row-encoding.js +8 -4
- package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
- package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
- package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
- package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
- package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
- package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
- package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
- package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
- package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
- package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
- package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
- package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
- package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
- package/dist/lib/reporting/ledger/row-storage.js +126 -66
- package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
- package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
- package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
- package/dist/lib/reporting/ledger/schedule.js +24 -0
- package/dist/lib/reporting/ledger/schedule.mjs +23 -0
- package/dist/lib/reporting/ledger/types.d.mts +23 -1
- package/dist/lib/reporting/ledger/types.d.ts +23 -1
- package/dist/lib/reporting/s3/index.d.mts +5 -0
- package/dist/lib/reporting/s3/index.d.ts +5 -0
- package/dist/lib/reporting/s3/index.js +37 -14
- package/dist/lib/reporting/s3/index.mjs +37 -14
- package/dist/lib/reporting/service/index.d.mts +10 -0
- package/dist/lib/reporting/service/index.d.ts +10 -0
- package/dist/lib/reporting/service/maintenance.d.mts +28 -2
- package/dist/lib/reporting/service/maintenance.d.ts +28 -2
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/account-sync-contract.d.mts +14 -0
- package/dist/lib/server/account-sync-contract.d.ts +14 -0
- package/dist/lib/server/account-sync-contract.js +225 -0
- package/dist/lib/server/account-sync-contract.mjs +197 -0
- package/dist/lib/server/adcp-server.js +5 -0
- package/dist/lib/server/adcp-server.mjs +10 -0
- package/dist/lib/server/auth-signature.d.mts +10 -0
- package/dist/lib/server/auth-signature.d.ts +10 -0
- package/dist/lib/server/auth-signature.js +61 -2
- package/dist/lib/server/auth-signature.mjs +65 -2
- package/dist/lib/server/auth.d.mts +6 -0
- package/dist/lib/server/auth.d.ts +6 -0
- package/dist/lib/server/auth.js +6 -0
- package/dist/lib/server/auth.mjs +6 -0
- package/dist/lib/server/create-adcp-server.d.mts +19 -5
- package/dist/lib/server/create-adcp-server.d.ts +19 -5
- package/dist/lib/server/create-adcp-server.js +238 -19
- package/dist/lib/server/create-adcp-server.mjs +240 -10
- package/dist/lib/server/decisioning/account.d.mts +24 -1
- package/dist/lib/server/decisioning/account.d.ts +24 -1
- package/dist/lib/server/decisioning/index.d.mts +1 -1
- package/dist/lib/server/decisioning/index.d.ts +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
- package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
- package/dist/lib/server/index.d.mts +2 -0
- package/dist/lib/server/index.d.ts +2 -0
- package/dist/lib/server/index.js +12 -0
- package/dist/lib/server/index.mjs +12 -0
- package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
- package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
- package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
- package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
- package/dist/lib/server/principal/types.d.mts +1 -1
- package/dist/lib/server/principal/types.d.ts +1 -1
- package/dist/lib/server/serve.js +5 -0
- package/dist/lib/server/serve.mjs +5 -0
- package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
- package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
- package/dist/lib/server/webhook-delivery/recovery.js +4 -0
- package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
- package/dist/lib/server/webhook-emitter.d.mts +10 -0
- package/dist/lib/server/webhook-emitter.d.ts +10 -0
- package/dist/lib/server/webhook-emitter.js +22 -0
- package/dist/lib/server/webhook-emitter.mjs +22 -0
- package/dist/lib/signing/agent-context.d.mts +0 -5
- package/dist/lib/signing/agent-context.d.ts +0 -5
- package/dist/lib/signing/agent-context.js +9 -1
- package/dist/lib/signing/agent-context.mjs +9 -1
- package/dist/lib/signing/agent-fetch.js +27 -2
- package/dist/lib/signing/agent-fetch.mjs +32 -2
- package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
- package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
- package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
- package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
- package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
- package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
- package/dist/lib/signing/agent-resolver/index.js +5 -0
- package/dist/lib/signing/agent-resolver/index.mjs +3 -0
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
- package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
- package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
- package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
- package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
- package/dist/lib/signing/brand-jwks.d.mts +2 -2
- package/dist/lib/signing/brand-jwks.d.ts +2 -2
- package/dist/lib/signing/brand-jwks.js +4 -4
- package/dist/lib/signing/brand-jwks.mjs +4 -4
- package/dist/lib/signing/client.d.mts +1 -0
- package/dist/lib/signing/client.d.ts +1 -0
- package/dist/lib/signing/client.js +5 -0
- package/dist/lib/signing/client.mjs +3 -0
- package/dist/lib/signing/jwks-https.d.mts +1 -1
- package/dist/lib/signing/jwks-https.d.ts +1 -1
- package/dist/lib/signing/jwks-https.js +1 -1
- package/dist/lib/signing/jwks-https.mjs +1 -1
- package/dist/lib/signing/jwks.d.mts +11 -3
- package/dist/lib/signing/jwks.d.ts +11 -3
- package/dist/lib/signing/jwks.js +1 -1
- package/dist/lib/signing/jwks.mjs +1 -1
- package/dist/lib/signing/parser.d.mts +1 -1
- package/dist/lib/signing/parser.d.ts +1 -1
- package/dist/lib/signing/parser.js +5 -3
- package/dist/lib/signing/parser.mjs +6 -4
- package/dist/lib/signing/revocation.d.mts +4 -1
- package/dist/lib/signing/revocation.d.ts +4 -1
- package/dist/lib/signing/revocation.js +33 -3
- package/dist/lib/signing/revocation.mjs +31 -2
- package/dist/lib/signing/server.d.mts +1 -1
- package/dist/lib/signing/server.d.ts +1 -1
- package/dist/lib/signing/server.js +4 -0
- package/dist/lib/signing/server.mjs +4 -0
- package/dist/lib/signing/types.d.mts +3 -0
- package/dist/lib/signing/types.d.ts +3 -0
- package/dist/lib/signing/web-bot-auth.d.mts +117 -0
- package/dist/lib/signing/web-bot-auth.d.ts +117 -0
- package/dist/lib/signing/web-bot-auth.js +660 -0
- package/dist/lib/signing/web-bot-auth.mjs +624 -0
- package/dist/lib/testing/client.d.mts +1 -4
- package/dist/lib/testing/client.d.ts +1 -4
- package/dist/lib/testing/client.js +141 -20
- package/dist/lib/testing/client.mjs +137 -19
- package/dist/lib/testing/compliance/comply.js +29 -10
- package/dist/lib/testing/compliance/comply.mjs +37 -11
- package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
- package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
- package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
- package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
- package/dist/lib/testing/storyboard/default-invariants.js +2 -0
- package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
- package/dist/lib/testing/storyboard/runner.js +23 -8
- package/dist/lib/testing/storyboard/runner.mjs +24 -8
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/types/adcp.d.mts +4 -0
- package/dist/lib/types/adcp.d.ts +4 -0
- package/dist/lib/types/schemas.generated.d.ts +6 -6
- package/dist/lib/utils/capabilities.d.mts +1 -0
- package/dist/lib/utils/capabilities.d.ts +1 -0
- package/dist/lib/utils/capabilities.js +5 -0
- package/dist/lib/utils/capabilities.mjs +5 -0
- package/dist/lib/v2/projection/creative-delivery.d.mts +3 -1
- package/dist/lib/v2/projection/creative-delivery.d.ts +3 -1
- package/dist/lib/v2/projection/creative-delivery.js +26 -10
- package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
- package/dist/lib/v2/projection/index.d.mts +1 -1
- package/dist/lib/v2/projection/index.d.ts +1 -1
- package/dist/lib/v2/projection/legacy-routes.d.mts +24 -2
- package/dist/lib/v2/projection/legacy-routes.d.ts +24 -2
- package/dist/lib/v2/projection/legacy-routes.js +28 -2
- package/dist/lib/v2/projection/legacy-routes.mjs +26 -2
- package/dist/lib/validation/schema-loader.d.mts +2 -0
- package/dist/lib/validation/schema-loader.d.ts +2 -0
- package/dist/lib/validation/schema-loader.js +43 -4
- package/dist/lib/validation/schema-loader.mjs +39 -3
- 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.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
- package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
- package/docs/guides/REPORTING-LEDGER.md +132 -46
- package/docs/guides/REPORTING-OPERATIONS.md +25 -4
- package/docs/guides/REPORTING-STABILITY.md +76 -0
- package/docs/guides/account-resolution.md +101 -0
- package/docs/llms.txt +3 -2
- package/docs/migration-12-to-13.md +7 -0
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-agent-identity-3.3.md +355 -0
- package/docs/migration-agent-resolution-3.3.md +5 -0
- package/docs/migration-reporting-row-storage-alignment.md +137 -0
- package/examples/storyboards/account-sync-contract.yaml +57 -0
- package/package.json +15 -1
|
@@ -53,6 +53,7 @@ export interface MediaBuyFeatures {
|
|
|
53
53
|
* Account management capabilities declared by the seller
|
|
54
54
|
*/
|
|
55
55
|
export interface AccountCapabilities {
|
|
56
|
+
agentOnboarding?: import('../identity-3.3/types').AgentOnboarding;
|
|
56
57
|
/** Seller-issued IDs are stable and accepted wherever an account reference is used. */
|
|
57
58
|
stableAccountId?: boolean;
|
|
58
59
|
/** Optional account change feed; absence does not imply support. */
|
|
@@ -316,6 +316,11 @@ function parseCapabilitiesResponse(response) {
|
|
|
316
316
|
authorizationEndpoint: response.account.authorization_endpoint,
|
|
317
317
|
supportedBilling: response.account.supported_billing ?? [],
|
|
318
318
|
defaultBilling: response.account.default_billing,
|
|
319
|
+
...response.account.agent_onboarding && {
|
|
320
|
+
agentOnboarding: structuredClone(
|
|
321
|
+
response.account.agent_onboarding
|
|
322
|
+
)
|
|
323
|
+
},
|
|
319
324
|
supportedAccountCurrencyModes: response.account.supported_account_currency_modes,
|
|
320
325
|
...response.account.timezone && {
|
|
321
326
|
timezone: {
|
|
@@ -260,6 +260,11 @@ function parseCapabilitiesResponse(response) {
|
|
|
260
260
|
authorizationEndpoint: response.account.authorization_endpoint,
|
|
261
261
|
supportedBilling: response.account.supported_billing ?? [],
|
|
262
262
|
defaultBilling: response.account.default_billing,
|
|
263
|
+
...response.account.agent_onboarding && {
|
|
264
|
+
agentOnboarding: structuredClone(
|
|
265
|
+
response.account.agent_onboarding
|
|
266
|
+
)
|
|
267
|
+
},
|
|
263
268
|
supportedAccountCurrencyModes: response.account.supported_account_currency_modes,
|
|
264
269
|
...response.account.timezone && {
|
|
265
270
|
timezone: {
|
|
@@ -94,7 +94,9 @@ type ClientReportingWebhookInput = (ReportingWebhookPreferences & {
|
|
|
94
94
|
* request remains a strict {@link CanonicalCreateMediaBuyRequest}.
|
|
95
95
|
*/
|
|
96
96
|
export type CanonicalCreateMediaBuyInput = Omit<CanonicalCreateMediaBuyRequest, 'reporting_webhook'> & {
|
|
97
|
-
reporting_webhook?: ClientReportingWebhookInput
|
|
97
|
+
reporting_webhook?: ClientReportingWebhookInput & {
|
|
98
|
+
signing_profile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
99
|
+
};
|
|
98
100
|
};
|
|
99
101
|
export type CanonicalUpdateMediaBuyRequest = Omit<CanonicalCreativeResponse<UpdateMediaBuyRequest>, 'packages' | 'new_packages'> & {
|
|
100
102
|
packages?: CanonicalPackageUpdate[];
|
|
@@ -94,7 +94,9 @@ type ClientReportingWebhookInput = (ReportingWebhookPreferences & {
|
|
|
94
94
|
* request remains a strict {@link CanonicalCreateMediaBuyRequest}.
|
|
95
95
|
*/
|
|
96
96
|
export type CanonicalCreateMediaBuyInput = Omit<CanonicalCreateMediaBuyRequest, 'reporting_webhook'> & {
|
|
97
|
-
reporting_webhook?: ClientReportingWebhookInput
|
|
97
|
+
reporting_webhook?: ClientReportingWebhookInput & {
|
|
98
|
+
signing_profile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
99
|
+
};
|
|
98
100
|
};
|
|
99
101
|
export type CanonicalUpdateMediaBuyRequest = Omit<CanonicalCreativeResponse<UpdateMediaBuyRequest>, 'packages' | 'new_packages'> & {
|
|
100
102
|
packages?: CanonicalPackageUpdate[];
|
|
@@ -487,20 +487,32 @@ function creativeFormatParameterConstraints(creative) {
|
|
|
487
487
|
if (width === void 0 && height === void 0 && durationMs === void 0) return void 0;
|
|
488
488
|
return { width, height, durationMs };
|
|
489
489
|
}
|
|
490
|
+
function legacyRefParameterConstraints(ref) {
|
|
491
|
+
const params = typeof ref.width !== "number" || typeof ref.height !== "number" ? record((0, import_v1_to_v2.canonicalDeclarationFromBareId)(ref.id, { agentUrl: ref.agent_url })?.params) : void 0;
|
|
492
|
+
return {
|
|
493
|
+
width: typeof ref.width === "number" ? ref.width : typeof params?.width === "number" ? params.width : void 0,
|
|
494
|
+
height: typeof ref.height === "number" ? ref.height : typeof params?.height === "number" ? params.height : void 0,
|
|
495
|
+
durationMs: ref.duration_ms
|
|
496
|
+
};
|
|
497
|
+
}
|
|
490
498
|
function refContradictsConstraints(ref, constraints) {
|
|
491
|
-
|
|
492
|
-
if (constraints.
|
|
499
|
+
const refConstraints = legacyRefParameterConstraints(ref);
|
|
500
|
+
if (constraints.width !== void 0 && refConstraints.width !== void 0 && refConstraints.width !== constraints.width) {
|
|
501
|
+
return true;
|
|
502
|
+
}
|
|
503
|
+
if (constraints.height !== void 0 && refConstraints.height !== void 0 && refConstraints.height !== constraints.height) {
|
|
493
504
|
return true;
|
|
494
505
|
}
|
|
495
|
-
if (constraints.durationMs !== void 0 && typeof
|
|
506
|
+
if (constraints.durationMs !== void 0 && typeof refConstraints.durationMs === "number" && refConstraints.durationMs !== constraints.durationMs) {
|
|
496
507
|
return true;
|
|
497
508
|
}
|
|
498
509
|
return false;
|
|
499
510
|
}
|
|
500
511
|
function refPinsConstraints(ref, constraints) {
|
|
501
|
-
|
|
502
|
-
if (constraints.
|
|
503
|
-
if (constraints.
|
|
512
|
+
const refConstraints = legacyRefParameterConstraints(ref);
|
|
513
|
+
if (constraints.width !== void 0 && refConstraints.width === void 0) return false;
|
|
514
|
+
if (constraints.height !== void 0 && refConstraints.height === void 0) return false;
|
|
515
|
+
if (constraints.durationMs !== void 0 && typeof refConstraints.durationMs !== "number") return false;
|
|
504
516
|
return true;
|
|
505
517
|
}
|
|
506
518
|
function legacyIdPinsDimensions(ref) {
|
|
@@ -510,15 +522,19 @@ function legacyIdPinsDimensions(ref) {
|
|
|
510
522
|
return typeof params.width === "number" || typeof params.height === "number" || typeof params.duration_ms_exact === "number" || Array.isArray(params.sizes);
|
|
511
523
|
}
|
|
512
524
|
function refConstraintKey(ref) {
|
|
513
|
-
|
|
525
|
+
const constraints = legacyRefParameterConstraints(ref);
|
|
526
|
+
return [
|
|
527
|
+
agentIdentity(ref.agent_url),
|
|
528
|
+
constraints.width ?? "",
|
|
529
|
+
constraints.height ?? "",
|
|
530
|
+
constraints.durationMs ?? ""
|
|
531
|
+
].join("|");
|
|
514
532
|
}
|
|
515
533
|
function preferMostConstrainedLegacyCandidates(candidates, creative) {
|
|
516
|
-
if (candidates.length <= 1) return candidates;
|
|
517
534
|
let remaining = candidates;
|
|
518
535
|
const constraints = creativeFormatParameterConstraints(creative);
|
|
519
536
|
if (constraints) {
|
|
520
|
-
|
|
521
|
-
if (compatible.length > 0) remaining = compatible;
|
|
537
|
+
remaining = remaining.filter((candidate) => !refContradictsConstraints(candidate.ref, constraints));
|
|
522
538
|
const pinned = remaining.filter((candidate) => refPinsConstraints(candidate.ref, constraints));
|
|
523
539
|
if (pinned.length > 0) remaining = pinned;
|
|
524
540
|
}
|
|
@@ -466,20 +466,32 @@ function creativeFormatParameterConstraints(creative) {
|
|
|
466
466
|
if (width === void 0 && height === void 0 && durationMs === void 0) return void 0;
|
|
467
467
|
return { width, height, durationMs };
|
|
468
468
|
}
|
|
469
|
+
function legacyRefParameterConstraints(ref) {
|
|
470
|
+
const params = typeof ref.width !== "number" || typeof ref.height !== "number" ? record(canonicalDeclarationFromBareId(ref.id, { agentUrl: ref.agent_url })?.params) : void 0;
|
|
471
|
+
return {
|
|
472
|
+
width: typeof ref.width === "number" ? ref.width : typeof params?.width === "number" ? params.width : void 0,
|
|
473
|
+
height: typeof ref.height === "number" ? ref.height : typeof params?.height === "number" ? params.height : void 0,
|
|
474
|
+
durationMs: ref.duration_ms
|
|
475
|
+
};
|
|
476
|
+
}
|
|
469
477
|
function refContradictsConstraints(ref, constraints) {
|
|
470
|
-
|
|
471
|
-
if (constraints.
|
|
478
|
+
const refConstraints = legacyRefParameterConstraints(ref);
|
|
479
|
+
if (constraints.width !== void 0 && refConstraints.width !== void 0 && refConstraints.width !== constraints.width) {
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
if (constraints.height !== void 0 && refConstraints.height !== void 0 && refConstraints.height !== constraints.height) {
|
|
472
483
|
return true;
|
|
473
484
|
}
|
|
474
|
-
if (constraints.durationMs !== void 0 && typeof
|
|
485
|
+
if (constraints.durationMs !== void 0 && typeof refConstraints.durationMs === "number" && refConstraints.durationMs !== constraints.durationMs) {
|
|
475
486
|
return true;
|
|
476
487
|
}
|
|
477
488
|
return false;
|
|
478
489
|
}
|
|
479
490
|
function refPinsConstraints(ref, constraints) {
|
|
480
|
-
|
|
481
|
-
if (constraints.
|
|
482
|
-
if (constraints.
|
|
491
|
+
const refConstraints = legacyRefParameterConstraints(ref);
|
|
492
|
+
if (constraints.width !== void 0 && refConstraints.width === void 0) return false;
|
|
493
|
+
if (constraints.height !== void 0 && refConstraints.height === void 0) return false;
|
|
494
|
+
if (constraints.durationMs !== void 0 && typeof refConstraints.durationMs !== "number") return false;
|
|
483
495
|
return true;
|
|
484
496
|
}
|
|
485
497
|
function legacyIdPinsDimensions(ref) {
|
|
@@ -489,15 +501,19 @@ function legacyIdPinsDimensions(ref) {
|
|
|
489
501
|
return typeof params.width === "number" || typeof params.height === "number" || typeof params.duration_ms_exact === "number" || Array.isArray(params.sizes);
|
|
490
502
|
}
|
|
491
503
|
function refConstraintKey(ref) {
|
|
492
|
-
|
|
504
|
+
const constraints = legacyRefParameterConstraints(ref);
|
|
505
|
+
return [
|
|
506
|
+
agentIdentity(ref.agent_url),
|
|
507
|
+
constraints.width ?? "",
|
|
508
|
+
constraints.height ?? "",
|
|
509
|
+
constraints.durationMs ?? ""
|
|
510
|
+
].join("|");
|
|
493
511
|
}
|
|
494
512
|
function preferMostConstrainedLegacyCandidates(candidates, creative) {
|
|
495
|
-
if (candidates.length <= 1) return candidates;
|
|
496
513
|
let remaining = candidates;
|
|
497
514
|
const constraints = creativeFormatParameterConstraints(creative);
|
|
498
515
|
if (constraints) {
|
|
499
|
-
|
|
500
|
-
if (compatible.length > 0) remaining = compatible;
|
|
516
|
+
remaining = remaining.filter((candidate) => !refContradictsConstraints(candidate.ref, constraints));
|
|
501
517
|
const pinned = remaining.filter((candidate) => refPinsConstraints(candidate.ref, constraints));
|
|
502
518
|
if (pinned.length > 0) remaining = pinned;
|
|
503
519
|
}
|
|
@@ -43,7 +43,7 @@ export { projectV1ProductToV2, canonicalDeclarationFromBareId, resolveCanonicalF
|
|
|
43
43
|
export type { V1ToV2Result, V1ToV2ProjectionOptions, BareFormatIdResolveOptions, LegacyFormatConversionContext, LegacyFormatConverter, LegacyFormatResolutionContext, LegacyFormatResolver, } from './v1-to-v2.mjs';
|
|
44
44
|
export { projectV2ProductToV1 } from './v2-to-v1.mjs';
|
|
45
45
|
export type { V2ToV1Result, V2ToV1ProjectionOptions, CanonicalFormatLegacyResolver, CanonicalFormatLegacyResolutionContext, CanonicalProductFormatLegacyResolutionContext, CanonicalCreativeFormatLegacyResolutionContext, CanonicalSelectorFormatLegacyResolutionContext, } from './v2-to-v1.mjs';
|
|
46
|
-
export { canonicalFormatLegacyResolverFromRoutes, legacyRoutesForProduct, type CanonicalFormatLegacyRoute, } from './legacy-routes.mjs';
|
|
46
|
+
export { canonicalFormatLegacyResolverFromRoutes, legacyRoutesForProduct, type CanonicalFormatLegacyRoute, type LegacyRoutesForProductOptions, } from './legacy-routes.mjs';
|
|
47
47
|
export { augmentProductWithFormatOptions, withFormatOptions, toCanonicalFormatOptionsWithRoutes, toAdditiveCanonicalProduct, withAdditiveCanonicalFormatOptions, toCanonicalOnlyProduct, toCanonicalOnlyResponse, type V2AugmentedProduct, type AdditiveCanonicalProduct, type CanonicalOnlyProduct, } from './augment-response.mjs';
|
|
48
48
|
export { CanonicalFormat, audioDaastFormatDeclaration, audioHostedFormatDeclaration, audioVastFormatDeclaration, agentPlacementFormatDeclaration, canonicalFormatDeclaration, customFormatDeclaration, displayTagFormatDeclaration, legacyFormatRef, legacyFormatRefs, html5FormatDeclaration, imageCarouselFormatDeclaration, imageFormatDeclaration, nativeInFeedFormatDeclaration, productCard, productCardDetailed, responsiveCreativeFormatDeclaration, sellerRenderedStatefulDisplayFormatDeclaration, sponsoredPlacementFormatDeclaration, coordinatedPlacementsFormatDeclaration, videoHostedFormatDeclaration, videoVastFormatDeclaration, type CanonicalFormatDeclaration, type CanonicalFormatDeclarationFields, type CanonicalFormatKind, type CanonicalFormatParams, type FormatReferenceInput, type ProductCardDetailedFields, type ProductCardFields, } from './builders.mjs';
|
|
49
49
|
export { packageRefsForFormatOptions, packageRefsForCapabilities, legacyFormatIdsFromOptions, tryLegacyFormatIdsFromOptions, legacyFormatIdsForFormatOption, legacyFormatIdsForCapability, lintPackageFormatSelectorDimensions, FormatOptionRefsLookupError, CapabilityIdsLookupError, type PackageFormatRefs, type PackageCapabilityRefs, type FormatOptionRef, type FormatOptionSelector, type FormatOptionRefsLookupErrorCode, type CapabilityIdsLookupErrorCode, type PackageFormatSelectorInput, type PackageFormatSelectorDimensionOptions, type FixedSizeDimensions, type PackageFormatSelectorDimensionDiagnosticCode, type PackageFormatSelectorDimensionDiagnostic, } from './write-side.mjs';
|
|
@@ -43,7 +43,7 @@ export { projectV1ProductToV2, canonicalDeclarationFromBareId, resolveCanonicalF
|
|
|
43
43
|
export type { V1ToV2Result, V1ToV2ProjectionOptions, BareFormatIdResolveOptions, LegacyFormatConversionContext, LegacyFormatConverter, LegacyFormatResolutionContext, LegacyFormatResolver, } from './v1-to-v2';
|
|
44
44
|
export { projectV2ProductToV1 } from './v2-to-v1';
|
|
45
45
|
export type { V2ToV1Result, V2ToV1ProjectionOptions, CanonicalFormatLegacyResolver, CanonicalFormatLegacyResolutionContext, CanonicalProductFormatLegacyResolutionContext, CanonicalCreativeFormatLegacyResolutionContext, CanonicalSelectorFormatLegacyResolutionContext, } from './v2-to-v1';
|
|
46
|
-
export { canonicalFormatLegacyResolverFromRoutes, legacyRoutesForProduct, type CanonicalFormatLegacyRoute, } from './legacy-routes';
|
|
46
|
+
export { canonicalFormatLegacyResolverFromRoutes, legacyRoutesForProduct, type CanonicalFormatLegacyRoute, type LegacyRoutesForProductOptions, } from './legacy-routes';
|
|
47
47
|
export { augmentProductWithFormatOptions, withFormatOptions, toCanonicalFormatOptionsWithRoutes, toAdditiveCanonicalProduct, withAdditiveCanonicalFormatOptions, toCanonicalOnlyProduct, toCanonicalOnlyResponse, type V2AugmentedProduct, type AdditiveCanonicalProduct, type CanonicalOnlyProduct, } from './augment-response';
|
|
48
48
|
export { CanonicalFormat, audioDaastFormatDeclaration, audioHostedFormatDeclaration, audioVastFormatDeclaration, agentPlacementFormatDeclaration, canonicalFormatDeclaration, customFormatDeclaration, displayTagFormatDeclaration, legacyFormatRef, legacyFormatRefs, html5FormatDeclaration, imageCarouselFormatDeclaration, imageFormatDeclaration, nativeInFeedFormatDeclaration, productCard, productCardDetailed, responsiveCreativeFormatDeclaration, sellerRenderedStatefulDisplayFormatDeclaration, sponsoredPlacementFormatDeclaration, coordinatedPlacementsFormatDeclaration, videoHostedFormatDeclaration, videoVastFormatDeclaration, type CanonicalFormatDeclaration, type CanonicalFormatDeclarationFields, type CanonicalFormatKind, type CanonicalFormatParams, type FormatReferenceInput, type ProductCardDetailedFields, type ProductCardFields, } from './builders';
|
|
49
49
|
export { packageRefsForFormatOptions, packageRefsForCapabilities, legacyFormatIdsFromOptions, tryLegacyFormatIdsFromOptions, legacyFormatIdsForFormatOption, legacyFormatIdsForCapability, lintPackageFormatSelectorDimensions, FormatOptionRefsLookupError, CapabilityIdsLookupError, type PackageFormatRefs, type PackageCapabilityRefs, type FormatOptionRef, type FormatOptionSelector, type FormatOptionRefsLookupErrorCode, type CapabilityIdsLookupErrorCode, type PackageFormatSelectorInput, type PackageFormatSelectorDimensionOptions, type FixedSizeDimensions, type PackageFormatSelectorDimensionDiagnosticCode, type PackageFormatSelectorDimensionDiagnostic, } from './write-side';
|
|
@@ -51,8 +51,30 @@ export type FormatOptionOrigin = {
|
|
|
51
51
|
seller_declared: false;
|
|
52
52
|
selector: UndeclaredFormatOptionSelector;
|
|
53
53
|
};
|
|
54
|
-
/**
|
|
55
|
-
export declare function
|
|
54
|
+
/** Whether two option refs name the same format option. Publisher domains compare case-insensitively. */
|
|
55
|
+
export declare function sameFormatOptionRef(left: FormatOptionReference, right: FormatOptionReference): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Option refs a product declares in its own `format_options[]`, read from the
|
|
58
|
+
* product exactly as the seller returned it. Options the SDK derives from the
|
|
59
|
+
* seller's legacy `format_ids` never appear here.
|
|
60
|
+
*/
|
|
61
|
+
export declare function sellerDeclaredFormatOptionRefs(sellerProduct: unknown): FormatOptionReference[];
|
|
62
|
+
export interface LegacyRoutesForProductOptions {
|
|
63
|
+
/**
|
|
64
|
+
* The product exactly as the seller returned it from `get_products`. When
|
|
65
|
+
* given, an option is seller-declared exactly when this product's own
|
|
66
|
+
* `format_options[]` names it. Use it when the declarations were projected
|
|
67
|
+
* from a stored seller response in a process that never ran discovery, so
|
|
68
|
+
* the SDK holds no origin metadata for them.
|
|
69
|
+
*/
|
|
70
|
+
sellerProduct?: unknown;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Extract persistable routes from canonical declarations, including concealed
|
|
74
|
+
* migration metadata. Pass `sellerProduct` to record each option's origin from
|
|
75
|
+
* the seller's own response instead of that metadata.
|
|
76
|
+
*/
|
|
77
|
+
export declare function legacyRoutesForProduct(productId: string, declarations: readonly V2ProductFormatDeclaration[], options?: LegacyRoutesForProductOptions): CanonicalFormatLegacyRoute[];
|
|
56
78
|
/**
|
|
57
79
|
* The origin a resolver built by {@link canonicalFormatLegacyResolverFromRoutes}
|
|
58
80
|
* recorded for one option. Without a product id, every route for the option
|
|
@@ -51,8 +51,30 @@ export type FormatOptionOrigin = {
|
|
|
51
51
|
seller_declared: false;
|
|
52
52
|
selector: UndeclaredFormatOptionSelector;
|
|
53
53
|
};
|
|
54
|
-
/**
|
|
55
|
-
export declare function
|
|
54
|
+
/** Whether two option refs name the same format option. Publisher domains compare case-insensitively. */
|
|
55
|
+
export declare function sameFormatOptionRef(left: FormatOptionReference, right: FormatOptionReference): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Option refs a product declares in its own `format_options[]`, read from the
|
|
58
|
+
* product exactly as the seller returned it. Options the SDK derives from the
|
|
59
|
+
* seller's legacy `format_ids` never appear here.
|
|
60
|
+
*/
|
|
61
|
+
export declare function sellerDeclaredFormatOptionRefs(sellerProduct: unknown): FormatOptionReference[];
|
|
62
|
+
export interface LegacyRoutesForProductOptions {
|
|
63
|
+
/**
|
|
64
|
+
* The product exactly as the seller returned it from `get_products`. When
|
|
65
|
+
* given, an option is seller-declared exactly when this product's own
|
|
66
|
+
* `format_options[]` names it. Use it when the declarations were projected
|
|
67
|
+
* from a stored seller response in a process that never ran discovery, so
|
|
68
|
+
* the SDK holds no origin metadata for them.
|
|
69
|
+
*/
|
|
70
|
+
sellerProduct?: unknown;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Extract persistable routes from canonical declarations, including concealed
|
|
74
|
+
* migration metadata. Pass `sellerProduct` to record each option's origin from
|
|
75
|
+
* the seller's own response instead of that metadata.
|
|
76
|
+
*/
|
|
77
|
+
export declare function legacyRoutesForProduct(productId: string, declarations: readonly V2ProductFormatDeclaration[], options?: LegacyRoutesForProductOptions): CanonicalFormatLegacyRoute[];
|
|
56
78
|
/**
|
|
57
79
|
* The origin a resolver built by {@link canonicalFormatLegacyResolverFromRoutes}
|
|
58
80
|
* recorded for one option. Without a product id, every route for the option
|
|
@@ -21,6 +21,8 @@ __export(legacy_routes_exports, {
|
|
|
21
21
|
canonicalFormatLegacyResolverFromRoutes: () => canonicalFormatLegacyResolverFromRoutes,
|
|
22
22
|
formatOptionOriginFromRoutes: () => formatOptionOriginFromRoutes,
|
|
23
23
|
legacyRoutesForProduct: () => legacyRoutesForProduct,
|
|
24
|
+
sameFormatOptionRef: () => sameFormatOptionRef,
|
|
25
|
+
sellerDeclaredFormatOptionRefs: () => sellerDeclaredFormatOptionRefs,
|
|
24
26
|
undeclaredFormatOptionSelector: () => undeclaredFormatOptionSelector
|
|
25
27
|
});
|
|
26
28
|
module.exports = __toCommonJS(legacy_routes_exports);
|
|
@@ -62,6 +64,27 @@ function routeRef(value) {
|
|
|
62
64
|
if (record.scope !== void 0 && record.scope !== "product") return void 0;
|
|
63
65
|
return { scope: "product", format_option_id: record.format_option_id };
|
|
64
66
|
}
|
|
67
|
+
function sameFormatOptionRef(left, right) {
|
|
68
|
+
return left.scope === right.scope && left.format_option_id === right.format_option_id && (left.scope !== "publisher" || right.scope === "publisher" && left.publisher_domain.toLowerCase() === right.publisher_domain.toLowerCase());
|
|
69
|
+
}
|
|
70
|
+
function sellerDeclaredFormatOptionRefs(sellerProduct) {
|
|
71
|
+
if (!sellerProduct || typeof sellerProduct !== "object" || Array.isArray(sellerProduct)) return [];
|
|
72
|
+
const options = sellerProduct.format_options;
|
|
73
|
+
const refs = [];
|
|
74
|
+
for (const optionValue of Array.isArray(options) ? options : []) {
|
|
75
|
+
if (!optionValue || typeof optionValue !== "object" || Array.isArray(optionValue)) continue;
|
|
76
|
+
const option = optionValue;
|
|
77
|
+
if (typeof option.format_option_id !== "string") continue;
|
|
78
|
+
refs.push(
|
|
79
|
+
typeof option.publisher_domain === "string" ? {
|
|
80
|
+
scope: "publisher",
|
|
81
|
+
publisher_domain: option.publisher_domain,
|
|
82
|
+
format_option_id: option.format_option_id
|
|
83
|
+
} : { scope: "product", format_option_id: option.format_option_id }
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
return refs;
|
|
87
|
+
}
|
|
65
88
|
function routeKey(productId, ref) {
|
|
66
89
|
return JSON.stringify([
|
|
67
90
|
productId,
|
|
@@ -89,12 +112,13 @@ function uniqueFormatIds(refs) {
|
|
|
89
112
|
).values()
|
|
90
113
|
];
|
|
91
114
|
}
|
|
92
|
-
function legacyRoutesForProduct(productId, declarations) {
|
|
115
|
+
function legacyRoutesForProduct(productId, declarations, options = {}) {
|
|
116
|
+
const declaredRefs = options.sellerProduct === void 0 ? void 0 : sellerDeclaredFormatOptionRefs(options.sellerProduct);
|
|
93
117
|
return declarations.flatMap((declaration) => {
|
|
94
118
|
const formatOptionRef = routeRef(declaration);
|
|
95
119
|
const formatIds = uniqueFormatIds((0, import_legacy_metadata.legacyFormatRefsForDeclaration)(declaration));
|
|
96
120
|
if (!formatOptionRef || formatIds.length === 0) return [];
|
|
97
|
-
const declared = (0, import_legacy_metadata.sellerDeclaredFormatOption)(declaration);
|
|
121
|
+
const declared = declaredRefs ? declaredRefs.some((ref) => sameFormatOptionRef(ref, formatOptionRef)) : (0, import_legacy_metadata.sellerDeclaredFormatOption)(declaration);
|
|
98
122
|
const selector = declared === false ? undeclaredFormatOptionSelector(declaration) : void 0;
|
|
99
123
|
return [
|
|
100
124
|
{
|
|
@@ -215,5 +239,7 @@ function canonicalFormatLegacyResolverFromRoutes(routes) {
|
|
|
215
239
|
canonicalFormatLegacyResolverFromRoutes,
|
|
216
240
|
formatOptionOriginFromRoutes,
|
|
217
241
|
legacyRoutesForProduct,
|
|
242
|
+
sameFormatOptionRef,
|
|
243
|
+
sellerDeclaredFormatOptionRefs,
|
|
218
244
|
undeclaredFormatOptionSelector
|
|
219
245
|
});
|
|
@@ -36,6 +36,27 @@ function routeRef(value) {
|
|
|
36
36
|
if (record.scope !== void 0 && record.scope !== "product") return void 0;
|
|
37
37
|
return { scope: "product", format_option_id: record.format_option_id };
|
|
38
38
|
}
|
|
39
|
+
function sameFormatOptionRef(left, right) {
|
|
40
|
+
return left.scope === right.scope && left.format_option_id === right.format_option_id && (left.scope !== "publisher" || right.scope === "publisher" && left.publisher_domain.toLowerCase() === right.publisher_domain.toLowerCase());
|
|
41
|
+
}
|
|
42
|
+
function sellerDeclaredFormatOptionRefs(sellerProduct) {
|
|
43
|
+
if (!sellerProduct || typeof sellerProduct !== "object" || Array.isArray(sellerProduct)) return [];
|
|
44
|
+
const options = sellerProduct.format_options;
|
|
45
|
+
const refs = [];
|
|
46
|
+
for (const optionValue of Array.isArray(options) ? options : []) {
|
|
47
|
+
if (!optionValue || typeof optionValue !== "object" || Array.isArray(optionValue)) continue;
|
|
48
|
+
const option = optionValue;
|
|
49
|
+
if (typeof option.format_option_id !== "string") continue;
|
|
50
|
+
refs.push(
|
|
51
|
+
typeof option.publisher_domain === "string" ? {
|
|
52
|
+
scope: "publisher",
|
|
53
|
+
publisher_domain: option.publisher_domain,
|
|
54
|
+
format_option_id: option.format_option_id
|
|
55
|
+
} : { scope: "product", format_option_id: option.format_option_id }
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return refs;
|
|
59
|
+
}
|
|
39
60
|
function routeKey(productId, ref) {
|
|
40
61
|
return JSON.stringify([
|
|
41
62
|
productId,
|
|
@@ -63,12 +84,13 @@ function uniqueFormatIds(refs) {
|
|
|
63
84
|
).values()
|
|
64
85
|
];
|
|
65
86
|
}
|
|
66
|
-
function legacyRoutesForProduct(productId, declarations) {
|
|
87
|
+
function legacyRoutesForProduct(productId, declarations, options = {}) {
|
|
88
|
+
const declaredRefs = options.sellerProduct === void 0 ? void 0 : sellerDeclaredFormatOptionRefs(options.sellerProduct);
|
|
67
89
|
return declarations.flatMap((declaration) => {
|
|
68
90
|
const formatOptionRef = routeRef(declaration);
|
|
69
91
|
const formatIds = uniqueFormatIds(legacyFormatRefsForDeclaration(declaration));
|
|
70
92
|
if (!formatOptionRef || formatIds.length === 0) return [];
|
|
71
|
-
const declared = sellerDeclaredFormatOption(declaration);
|
|
93
|
+
const declared = declaredRefs ? declaredRefs.some((ref) => sameFormatOptionRef(ref, formatOptionRef)) : sellerDeclaredFormatOption(declaration);
|
|
72
94
|
const selector = declared === false ? undeclaredFormatOptionSelector(declaration) : void 0;
|
|
73
95
|
return [
|
|
74
96
|
{
|
|
@@ -188,5 +210,7 @@ export {
|
|
|
188
210
|
canonicalFormatLegacyResolverFromRoutes,
|
|
189
211
|
formatOptionOriginFromRoutes,
|
|
190
212
|
legacyRoutesForProduct,
|
|
213
|
+
sameFormatOptionRef,
|
|
214
|
+
sellerDeclaredFormatOptionRefs,
|
|
191
215
|
undeclaredFormatOptionSelector
|
|
192
216
|
};
|
|
@@ -68,6 +68,8 @@ export declare function resolveBundleKey(version: string): string;
|
|
|
68
68
|
*/
|
|
69
69
|
export declare function validateAdcpVersionWire(value: unknown): asserts value is string;
|
|
70
70
|
export declare function toReleasePrecisionWire(bundleKeyOrVersion: string): string;
|
|
71
|
+
export declare function withIdentity33SchemaScope<T>(fn: () => T, enabled?: boolean): T;
|
|
72
|
+
export declare function bindIdentity33SchemaScope<T extends object>(instance: T): T;
|
|
71
73
|
/**
|
|
72
74
|
* Register a schema bundle supplied outside the installed SDK package.
|
|
73
75
|
*
|
|
@@ -68,6 +68,8 @@ export declare function resolveBundleKey(version: string): string;
|
|
|
68
68
|
*/
|
|
69
69
|
export declare function validateAdcpVersionWire(value: unknown): asserts value is string;
|
|
70
70
|
export declare function toReleasePrecisionWire(bundleKeyOrVersion: string): string;
|
|
71
|
+
export declare function withIdentity33SchemaScope<T>(fn: () => T, enabled?: boolean): T;
|
|
72
|
+
export declare function bindIdentity33SchemaScope<T extends object>(instance: T): T;
|
|
71
73
|
/**
|
|
72
74
|
* Register a schema bundle supplied outside the installed SDK package.
|
|
73
75
|
*
|
|
@@ -30,6 +30,7 @@ var schema_loader_exports = {};
|
|
|
30
30
|
__export(schema_loader_exports, {
|
|
31
31
|
SCHEMA_FILENAME_SUFFIX: () => SCHEMA_FILENAME_SUFFIX,
|
|
32
32
|
_resetValidationLoader: () => _resetValidationLoader,
|
|
33
|
+
bindIdentity33SchemaScope: () => bindIdentity33SchemaScope,
|
|
33
34
|
getCanonicalToolValidatorForVersion: () => getCanonicalToolValidatorForVersion,
|
|
34
35
|
getMcpProfileInputSchema: () => getMcpProfileInputSchema,
|
|
35
36
|
getMcpToolSchema: () => getMcpToolSchema,
|
|
@@ -43,6 +44,7 @@ __export(schema_loader_exports, {
|
|
|
43
44
|
getValidator: () => getValidator,
|
|
44
45
|
hasSchemaBundle: () => hasSchemaBundle,
|
|
45
46
|
isExternalSchemaRootActive: () => isExternalSchemaRootActive,
|
|
47
|
+
isIdentity33SchemaScope: () => isIdentity33SchemaScope,
|
|
46
48
|
listValidatorKeys: () => listValidatorKeys,
|
|
47
49
|
registerExternalSchemaRoot: () => registerExternalSchemaRoot,
|
|
48
50
|
resolveBundleKey: () => resolveBundleKey,
|
|
@@ -50,7 +52,8 @@ __export(schema_loader_exports, {
|
|
|
50
52
|
toReleasePrecisionWire: () => toReleasePrecisionWire,
|
|
51
53
|
unregisterExternalSchemaRoot: () => unregisterExternalSchemaRoot,
|
|
52
54
|
validateAdcpVersionWire: () => validateAdcpVersionWire,
|
|
53
|
-
withExternalSchemaRoot: () => withExternalSchemaRoot
|
|
55
|
+
withExternalSchemaRoot: () => withExternalSchemaRoot,
|
|
56
|
+
withIdentity33SchemaScope: () => withIdentity33SchemaScope
|
|
54
57
|
});
|
|
55
58
|
module.exports = __toCommonJS(schema_loader_exports);
|
|
56
59
|
var import_ajv = __toESM(require("ajv"));
|
|
@@ -123,12 +126,30 @@ function toReleasePrecisionWire(bundleKeyOrVersion) {
|
|
|
123
126
|
"adcpVersion"
|
|
124
127
|
);
|
|
125
128
|
}
|
|
129
|
+
const identity33Scope = new import_async_hooks.AsyncLocalStorage();
|
|
130
|
+
function isIdentity33SchemaScope() {
|
|
131
|
+
return identity33Scope.getStore() === true;
|
|
132
|
+
}
|
|
133
|
+
function withIdentity33SchemaScope(fn, enabled = true) {
|
|
134
|
+
return identity33Scope.run(enabled, fn);
|
|
135
|
+
}
|
|
136
|
+
function bindIdentity33SchemaScope(instance) {
|
|
137
|
+
return new Proxy(instance, {
|
|
138
|
+
get(target, property, receiver) {
|
|
139
|
+
const value = withIdentity33SchemaScope(() => Reflect.get(target, property, receiver));
|
|
140
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(target, property);
|
|
141
|
+
if (descriptor && !descriptor.configurable && "value" in descriptor && !descriptor.writable) return value;
|
|
142
|
+
return typeof value === "function" ? (...args) => withIdentity33SchemaScope(() => value.apply(target, args)) : value;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
126
146
|
function resolveSchemaRoot(version) {
|
|
127
147
|
const key = resolveBundleKey(version);
|
|
128
148
|
const scopedRoot = scopedExternalSchemaRoots.getStore()?.get(key);
|
|
129
149
|
if (scopedRoot && (0, import_fs.existsSync)(scopedRoot)) return scopedRoot;
|
|
130
150
|
const externalRoot = externalSchemaRoots.get(key);
|
|
131
151
|
if (externalRoot && (0, import_fs.existsSync)(externalRoot)) return externalRoot;
|
|
152
|
+
if (isIdentity33SchemaScope() && key === "3.3") return resolveSchemaRoot(import_version.ADCP_VERSION);
|
|
132
153
|
const distCandidate = import_path.default.join(__dirname, "..", "schemas-data", key);
|
|
133
154
|
if ((0, import_fs.existsSync)(distCandidate)) return distCandidate;
|
|
134
155
|
const releasePrecisionMatch = /^\d+\.\d+-/.test(key);
|
|
@@ -334,6 +355,7 @@ function withExternalSchemaRoot(version, root, fn) {
|
|
|
334
355
|
}
|
|
335
356
|
function isExternalSchemaRootActive(version) {
|
|
336
357
|
const key = resolveBundleKey(version);
|
|
358
|
+
if (isIdentity33SchemaScope() && key === "3.3") return true;
|
|
337
359
|
const scopedRoot = scopedExternalSchemaRoots.getStore()?.get(key);
|
|
338
360
|
if (scopedRoot && (0, import_fs.existsSync)(scopedRoot)) return true;
|
|
339
361
|
const registeredRoot = externalSchemaRoots.get(key);
|
|
@@ -601,7 +623,7 @@ function getSchemaValidatorByRef(schemaRef, version = import_version.ADCP_VERSIO
|
|
|
601
623
|
});
|
|
602
624
|
(0, import_ajv_formats.default)(ajv);
|
|
603
625
|
for (const keyword of keywords ?? []) ajv.addKeyword(keyword);
|
|
604
|
-
const rawSchema = loadJson(file);
|
|
626
|
+
const rawSchema = identity33ReferenceSchema(loadJson(file), version);
|
|
605
627
|
const dependencySchemas = [];
|
|
606
628
|
const registeredIds = /* @__PURE__ */ new Map();
|
|
607
629
|
for (const schemaFile of walkJsonFiles(root)) {
|
|
@@ -610,7 +632,7 @@ function getSchemaValidatorByRef(schemaRef, version = import_version.ADCP_VERSIO
|
|
|
610
632
|
continue;
|
|
611
633
|
}
|
|
612
634
|
if (schemaFile === file) continue;
|
|
613
|
-
const schema = loadJson(schemaFile);
|
|
635
|
+
const schema = identity33ReferenceSchema(loadJson(schemaFile), version);
|
|
614
636
|
if ((keywords || allErrors) && typeof schema.$id === "string") {
|
|
615
637
|
const previous = schema.$id === rawSchema.$id ? rawSchema : registeredIds.get(schema.$id);
|
|
616
638
|
if (previous && !(0, import_node_util.isDeepStrictEqual)(previous, schema)) {
|
|
@@ -710,6 +732,20 @@ function getRegisteredSchemaIds(version = import_version.ADCP_VERSION) {
|
|
|
710
732
|
const bundledRegistry = s.bundledAjv.schemas;
|
|
711
733
|
return [.../* @__PURE__ */ new Set([...Object.keys(registry ?? {}), ...Object.keys(bundledRegistry ?? {})])];
|
|
712
734
|
}
|
|
735
|
+
function identity33ReferenceSchema(schema, version) {
|
|
736
|
+
if (!isIdentity33SchemaScope() || resolveBundleKey(version) !== "3.3") return schema;
|
|
737
|
+
const clone = structuredClone(schema);
|
|
738
|
+
const pending = [clone];
|
|
739
|
+
while (pending.length) {
|
|
740
|
+
const node = pending.pop();
|
|
741
|
+
if (!node || typeof node !== "object") continue;
|
|
742
|
+
const object = node;
|
|
743
|
+
if (Array.isArray(object.enum) && object.enum.includes("destination_state_changed"))
|
|
744
|
+
object.enum = [...object.enum, "relationship_changed", "relationship_expiring"];
|
|
745
|
+
for (const value of Object.values(object)) if (typeof value === "object") pending.push(value);
|
|
746
|
+
}
|
|
747
|
+
return clone;
|
|
748
|
+
}
|
|
713
749
|
function hasSchemaBundle(version) {
|
|
714
750
|
try {
|
|
715
751
|
resolveSchemaRoot(version);
|
|
@@ -965,6 +1001,7 @@ function cloneJsonValue(value) {
|
|
|
965
1001
|
0 && (module.exports = {
|
|
966
1002
|
SCHEMA_FILENAME_SUFFIX,
|
|
967
1003
|
_resetValidationLoader,
|
|
1004
|
+
bindIdentity33SchemaScope,
|
|
968
1005
|
getCanonicalToolValidatorForVersion,
|
|
969
1006
|
getMcpProfileInputSchema,
|
|
970
1007
|
getMcpToolSchema,
|
|
@@ -978,6 +1015,7 @@ function cloneJsonValue(value) {
|
|
|
978
1015
|
getValidator,
|
|
979
1016
|
hasSchemaBundle,
|
|
980
1017
|
isExternalSchemaRootActive,
|
|
1018
|
+
isIdentity33SchemaScope,
|
|
981
1019
|
listValidatorKeys,
|
|
982
1020
|
registerExternalSchemaRoot,
|
|
983
1021
|
resolveBundleKey,
|
|
@@ -985,5 +1023,6 @@ function cloneJsonValue(value) {
|
|
|
985
1023
|
toReleasePrecisionWire,
|
|
986
1024
|
unregisterExternalSchemaRoot,
|
|
987
1025
|
validateAdcpVersionWire,
|
|
988
|
-
withExternalSchemaRoot
|
|
1026
|
+
withExternalSchemaRoot,
|
|
1027
|
+
withIdentity33SchemaScope
|
|
989
1028
|
});
|
|
@@ -73,12 +73,30 @@ function toReleasePrecisionWire(bundleKeyOrVersion) {
|
|
|
73
73
|
"adcpVersion"
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
|
+
const identity33Scope = new AsyncLocalStorage();
|
|
77
|
+
function isIdentity33SchemaScope() {
|
|
78
|
+
return identity33Scope.getStore() === true;
|
|
79
|
+
}
|
|
80
|
+
function withIdentity33SchemaScope(fn, enabled = true) {
|
|
81
|
+
return identity33Scope.run(enabled, fn);
|
|
82
|
+
}
|
|
83
|
+
function bindIdentity33SchemaScope(instance) {
|
|
84
|
+
return new Proxy(instance, {
|
|
85
|
+
get(target, property, receiver) {
|
|
86
|
+
const value = withIdentity33SchemaScope(() => Reflect.get(target, property, receiver));
|
|
87
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(target, property);
|
|
88
|
+
if (descriptor && !descriptor.configurable && "value" in descriptor && !descriptor.writable) return value;
|
|
89
|
+
return typeof value === "function" ? (...args) => withIdentity33SchemaScope(() => value.apply(target, args)) : value;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
76
93
|
function resolveSchemaRoot(version) {
|
|
77
94
|
const key = resolveBundleKey(version);
|
|
78
95
|
const scopedRoot = scopedExternalSchemaRoots.getStore()?.get(key);
|
|
79
96
|
if (scopedRoot && existsSync(scopedRoot)) return scopedRoot;
|
|
80
97
|
const externalRoot = externalSchemaRoots.get(key);
|
|
81
98
|
if (externalRoot && existsSync(externalRoot)) return externalRoot;
|
|
99
|
+
if (isIdentity33SchemaScope() && key === "3.3") return resolveSchemaRoot(ADCP_VERSION);
|
|
82
100
|
const distCandidate = path.join(__dirname, "..", "schemas-data", key);
|
|
83
101
|
if (existsSync(distCandidate)) return distCandidate;
|
|
84
102
|
const releasePrecisionMatch = /^\d+\.\d+-/.test(key);
|
|
@@ -284,6 +302,7 @@ function withExternalSchemaRoot(version, root, fn) {
|
|
|
284
302
|
}
|
|
285
303
|
function isExternalSchemaRootActive(version) {
|
|
286
304
|
const key = resolveBundleKey(version);
|
|
305
|
+
if (isIdentity33SchemaScope() && key === "3.3") return true;
|
|
287
306
|
const scopedRoot = scopedExternalSchemaRoots.getStore()?.get(key);
|
|
288
307
|
if (scopedRoot && existsSync(scopedRoot)) return true;
|
|
289
308
|
const registeredRoot = externalSchemaRoots.get(key);
|
|
@@ -551,7 +570,7 @@ function getSchemaValidatorByRef(schemaRef, version = ADCP_VERSION, keywords, op
|
|
|
551
570
|
});
|
|
552
571
|
addFormats(ajv);
|
|
553
572
|
for (const keyword of keywords ?? []) ajv.addKeyword(keyword);
|
|
554
|
-
const rawSchema = loadJson(file);
|
|
573
|
+
const rawSchema = identity33ReferenceSchema(loadJson(file), version);
|
|
555
574
|
const dependencySchemas = [];
|
|
556
575
|
const registeredIds = /* @__PURE__ */ new Map();
|
|
557
576
|
for (const schemaFile of walkJsonFiles(root)) {
|
|
@@ -560,7 +579,7 @@ function getSchemaValidatorByRef(schemaRef, version = ADCP_VERSION, keywords, op
|
|
|
560
579
|
continue;
|
|
561
580
|
}
|
|
562
581
|
if (schemaFile === file) continue;
|
|
563
|
-
const schema = loadJson(schemaFile);
|
|
582
|
+
const schema = identity33ReferenceSchema(loadJson(schemaFile), version);
|
|
564
583
|
if ((keywords || allErrors) && typeof schema.$id === "string") {
|
|
565
584
|
const previous = schema.$id === rawSchema.$id ? rawSchema : registeredIds.get(schema.$id);
|
|
566
585
|
if (previous && !isDeepStrictEqual(previous, schema)) {
|
|
@@ -660,6 +679,20 @@ function getRegisteredSchemaIds(version = ADCP_VERSION) {
|
|
|
660
679
|
const bundledRegistry = s.bundledAjv.schemas;
|
|
661
680
|
return [.../* @__PURE__ */ new Set([...Object.keys(registry ?? {}), ...Object.keys(bundledRegistry ?? {})])];
|
|
662
681
|
}
|
|
682
|
+
function identity33ReferenceSchema(schema, version) {
|
|
683
|
+
if (!isIdentity33SchemaScope() || resolveBundleKey(version) !== "3.3") return schema;
|
|
684
|
+
const clone = structuredClone(schema);
|
|
685
|
+
const pending = [clone];
|
|
686
|
+
while (pending.length) {
|
|
687
|
+
const node = pending.pop();
|
|
688
|
+
if (!node || typeof node !== "object") continue;
|
|
689
|
+
const object = node;
|
|
690
|
+
if (Array.isArray(object.enum) && object.enum.includes("destination_state_changed"))
|
|
691
|
+
object.enum = [...object.enum, "relationship_changed", "relationship_expiring"];
|
|
692
|
+
for (const value of Object.values(object)) if (typeof value === "object") pending.push(value);
|
|
693
|
+
}
|
|
694
|
+
return clone;
|
|
695
|
+
}
|
|
663
696
|
function hasSchemaBundle(version) {
|
|
664
697
|
try {
|
|
665
698
|
resolveSchemaRoot(version);
|
|
@@ -914,6 +947,7 @@ function cloneJsonValue(value) {
|
|
|
914
947
|
export {
|
|
915
948
|
SCHEMA_FILENAME_SUFFIX,
|
|
916
949
|
_resetValidationLoader,
|
|
950
|
+
bindIdentity33SchemaScope,
|
|
917
951
|
getCanonicalToolValidatorForVersion,
|
|
918
952
|
getMcpProfileInputSchema,
|
|
919
953
|
getMcpToolSchema,
|
|
@@ -927,6 +961,7 @@ export {
|
|
|
927
961
|
getValidator,
|
|
928
962
|
hasSchemaBundle,
|
|
929
963
|
isExternalSchemaRootActive,
|
|
964
|
+
isIdentity33SchemaScope,
|
|
930
965
|
listValidatorKeys,
|
|
931
966
|
registerExternalSchemaRoot,
|
|
932
967
|
resolveBundleKey,
|
|
@@ -934,5 +969,6 @@ export {
|
|
|
934
969
|
toReleasePrecisionWire,
|
|
935
970
|
unregisterExternalSchemaRoot,
|
|
936
971
|
validateAdcpVersionWire,
|
|
937
|
-
withExternalSchemaRoot
|
|
972
|
+
withExternalSchemaRoot,
|
|
973
|
+
withIdentity33SchemaScope
|
|
938
974
|
};
|