@adcp/sdk 17.0.0-beta.0 → 17.0.0-beta.2
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/keyed-account-store.js +1 -1
- package/dist/lib/adapters/keyed-account-store.mjs +1 -1
- package/dist/lib/adapters/version/3.0/brand-fields.d.mts +7 -1
- package/dist/lib/adapters/version/3.0/brand-fields.d.ts +7 -1
- package/dist/lib/adapters/version/3.0/brand-fields.js +139 -3
- package/dist/lib/adapters/version/3.0/brand-fields.mjs +136 -2
- package/dist/lib/adapters/version/3.0/index.js +6 -0
- package/dist/lib/adapters/version/3.0/index.mjs +7 -1
- package/dist/lib/adapters/version/3.1/bidding.js +1 -1
- package/dist/lib/adapters/version/3.1/bidding.mjs +1 -1
- package/dist/lib/adapters/version/types.d.mts +5 -0
- package/dist/lib/adapters/version/types.d.ts +5 -0
- package/dist/lib/canonical-references/index.js +2 -0
- package/dist/lib/canonical-references/index.mjs +2 -0
- package/dist/lib/client/account-changes.d.mts +3 -1
- package/dist/lib/client/account-changes.d.ts +3 -1
- package/dist/lib/client/account-changes.js +22 -2
- package/dist/lib/client/account-changes.mjs +22 -2
- package/dist/lib/conformance/oracle.js +3 -2
- package/dist/lib/conformance/oracle.mjs +3 -2
- package/dist/lib/core/AgentClient.d.mts +165 -1
- package/dist/lib/core/AgentClient.d.ts +165 -1
- package/dist/lib/core/AgentClient.js +446 -8
- package/dist/lib/core/AgentClient.mjs +446 -8
- package/dist/lib/core/ConversationTypes.d.mts +8 -0
- package/dist/lib/core/ConversationTypes.d.ts +8 -0
- package/dist/lib/core/ProtocolResponseParser.d.mts +1 -1
- package/dist/lib/core/ProtocolResponseParser.d.ts +1 -1
- package/dist/lib/core/ProtocolResponseParser.js +28 -18
- package/dist/lib/core/ProtocolResponseParser.mjs +11 -1
- package/dist/lib/core/ResponseValidator.js +1 -1
- package/dist/lib/core/ResponseValidator.mjs +1 -1
- package/dist/lib/core/SingleAgentClient.d.mts +122 -7
- package/dist/lib/core/SingleAgentClient.d.ts +122 -7
- package/dist/lib/core/SingleAgentClient.js +601 -96
- package/dist/lib/core/SingleAgentClient.mjs +590 -84
- package/dist/lib/core/TaskExecutor.d.mts +7 -0
- package/dist/lib/core/TaskExecutor.d.ts +7 -0
- package/dist/lib/core/TaskExecutor.js +23 -8
- package/dist/lib/core/TaskExecutor.mjs +23 -8
- package/dist/lib/core/task-status.d.mts +2 -0
- package/dist/lib/core/task-status.d.ts +2 -0
- package/dist/lib/core/task-status.js +11 -2
- package/dist/lib/core/task-status.mjs +9 -1
- package/dist/lib/errors/index.d.mts +22 -0
- package/dist/lib/errors/index.d.ts +22 -0
- package/dist/lib/errors/index.js +43 -0
- package/dist/lib/errors/index.mjs +42 -0
- package/dist/lib/identity-3.3/trust.d.mts +1 -4
- package/dist/lib/identity-3.3/trust.d.ts +1 -4
- package/dist/lib/identity-3.3/trust.js +34 -21
- package/dist/lib/identity-3.3/trust.mjs +34 -21
- package/dist/lib/identity-3.3/validation.js +5 -3
- package/dist/lib/identity-3.3/validation.mjs +6 -4
- package/dist/lib/index.d.mts +7 -53
- package/dist/lib/index.d.ts +7 -53
- package/dist/lib/index.js +13 -0
- package/dist/lib/index.mjs +9 -0
- package/dist/lib/media-buy/compatibility.js +6 -1
- package/dist/lib/media-buy/compatibility.mjs +6 -1
- package/dist/lib/protocols/mcp-modern.d.mts +2 -0
- package/dist/lib/protocols/mcp-modern.d.ts +2 -0
- package/dist/lib/protocols/mcp-modern.js +31 -5
- package/dist/lib/protocols/mcp-modern.mjs +31 -5
- package/dist/lib/protocols/mcp-scope.d.mts +6 -1
- package/dist/lib/protocols/mcp-scope.d.ts +6 -1
- package/dist/lib/protocols/mcp-scope.js +25 -3
- package/dist/lib/protocols/mcp-scope.mjs +24 -3
- package/dist/lib/protocols/mcp.js +12 -6
- package/dist/lib/protocols/mcp.mjs +13 -6
- package/dist/lib/reporting/inspection.js +1 -0
- package/dist/lib/reporting/inspection.mjs +1 -0
- package/dist/lib/reporting/ledger/coverage.d.mts +5 -0
- package/dist/lib/reporting/ledger/coverage.d.ts +5 -0
- package/dist/lib/reporting/ledger/coverage.js +37 -3
- package/dist/lib/reporting/ledger/coverage.mjs +36 -3
- package/dist/lib/reporting/ledger/handler.js +7 -4
- package/dist/lib/reporting/ledger/handler.mjs +7 -4
- package/dist/lib/reporting/ledger/producer.js +215 -69
- package/dist/lib/reporting/ledger/producer.mjs +217 -70
- package/dist/lib/reporting/ledger/schedule.d.mts +2 -2
- package/dist/lib/reporting/ledger/schedule.d.ts +2 -2
- package/dist/lib/reporting/ledger/schedule.js +8 -5
- package/dist/lib/reporting/ledger/schedule.mjs +8 -5
- package/dist/lib/reporting/ledger/status-ingest.d.mts +1 -1
- package/dist/lib/reporting/ledger/status-ingest.d.ts +1 -1
- package/dist/lib/reporting/ledger/status-ingest.js +4 -3
- package/dist/lib/reporting/ledger/status-ingest.mjs +4 -3
- package/dist/lib/reporting/ledger/types.d.mts +36 -1
- package/dist/lib/reporting/ledger/types.d.ts +36 -1
- package/dist/lib/reporting/service/index.d.mts +14 -1
- package/dist/lib/reporting/service/index.d.ts +14 -1
- package/dist/lib/reporting/service/index.js +24 -12
- package/dist/lib/reporting/service/index.mjs +24 -12
- package/dist/lib/schemas/browser.d.mts +2 -0
- package/dist/lib/schemas/browser.d.ts +2 -0
- package/dist/lib/schemas/browser.js +3 -0
- package/dist/lib/schemas/browser.mjs +2 -0
- package/dist/lib/schemas/index.d.mts +5 -3
- package/dist/lib/schemas/index.d.ts +5 -3
- package/dist/lib/schemas/index.js +5 -0
- package/dist/lib/schemas/index.mjs +4 -0
- package/dist/lib/server/account-response-identity.d.mts +17 -0
- package/dist/lib/server/account-response-identity.d.ts +17 -0
- package/dist/lib/server/account-response-identity.js +52 -0
- package/dist/lib/server/account-response-identity.mjs +28 -0
- package/dist/lib/server/account-sync-contract.js +2 -2
- package/dist/lib/server/account-sync-contract.mjs +2 -2
- package/dist/lib/server/create-adcp-server.js +33 -20
- package/dist/lib/server/create-adcp-server.mjs +36 -12
- package/dist/lib/server/decisioning/account.d.mts +36 -10
- package/dist/lib/server/decisioning/account.d.ts +36 -10
- package/dist/lib/server/decisioning/account.js +33 -14
- package/dist/lib/server/decisioning/account.mjs +33 -14
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +5 -5
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +5 -5
- package/dist/lib/server/decisioning/runtime/from-platform.js +4 -4
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +4 -4
- package/dist/lib/server/media-buy-store.d.mts +26 -12
- package/dist/lib/server/media-buy-store.d.ts +26 -12
- package/dist/lib/server/media-buy-store.js +69 -21
- package/dist/lib/server/media-buy-store.mjs +69 -21
- package/dist/lib/server/notification-subscriptions/runtime.d.mts +1 -1
- package/dist/lib/server/notification-subscriptions/runtime.d.ts +1 -1
- package/dist/lib/server/notification-subscriptions/runtime.js +4 -0
- package/dist/lib/server/notification-subscriptions/runtime.mjs +4 -0
- package/dist/lib/server/responses.js +9 -1
- package/dist/lib/server/responses.mjs +9 -1
- package/dist/lib/signing/agent-fetch.d.mts +1 -1
- package/dist/lib/signing/agent-fetch.d.ts +1 -1
- package/dist/lib/signing/agent-fetch.js +3 -3
- package/dist/lib/signing/agent-fetch.mjs +3 -3
- package/dist/lib/testing/client.d.mts +1 -0
- package/dist/lib/testing/client.d.ts +1 -0
- package/dist/lib/testing/client.js +6 -5
- package/dist/lib/testing/client.mjs +6 -5
- package/dist/lib/testing/storyboard/agent-routing.d.mts +5 -2
- package/dist/lib/testing/storyboard/agent-routing.d.ts +5 -2
- package/dist/lib/testing/storyboard/agent-routing.js +11 -4
- package/dist/lib/testing/storyboard/agent-routing.mjs +11 -4
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +60 -14
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +60 -14
- package/dist/lib/testing/storyboard/compliance.d.mts +2 -5
- package/dist/lib/testing/storyboard/compliance.d.ts +2 -5
- package/dist/lib/testing/storyboard/compliance.js +62 -13
- package/dist/lib/testing/storyboard/compliance.mjs +63 -14
- package/dist/lib/testing/storyboard/context.d.mts +13 -3
- package/dist/lib/testing/storyboard/context.d.ts +13 -3
- package/dist/lib/testing/storyboard/context.js +15 -10
- package/dist/lib/testing/storyboard/context.mjs +15 -10
- package/dist/lib/testing/storyboard/request-signing/vector-loader.d.mts +2 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.d.ts +2 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.js +11 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +10 -0
- package/dist/lib/testing/storyboard/runner.js +141 -13
- package/dist/lib/testing/storyboard/runner.mjs +141 -13
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.js +4 -1
- package/dist/lib/testing/storyboard/validations.mjs +4 -1
- package/dist/lib/testing/test-controller.js +3 -0
- package/dist/lib/testing/test-controller.mjs +3 -0
- package/dist/lib/types/accept-proposal.d.ts +20 -28
- package/dist/lib/types/asset-instances.d.mts +1 -1
- package/dist/lib/types/asset-instances.d.ts +1 -1
- package/dist/lib/types/buy-products.d.ts +20 -28
- package/dist/lib/types/check-governance.d.ts +20 -28
- package/dist/lib/types/comply-test-controller.d.ts +20 -28
- package/dist/lib/types/control-media-buy.d.ts +20 -28
- package/dist/lib/types/core.generated.d.mts +273 -184
- package/dist/lib/types/core.generated.d.ts +273 -184
- package/dist/lib/types/create-media-buy.d.ts +20 -28
- package/dist/lib/types/get-media-buys.d.ts +20 -28
- package/dist/lib/types/get-products.d.ts +20 -28
- package/dist/lib/types/index.d.mts +6 -1
- package/dist/lib/types/index.d.ts +6 -1
- package/dist/lib/types/index.js +6 -1
- package/dist/lib/types/index.mjs +4 -1
- package/dist/lib/types/inline-enums.generated.d.mts +30 -4
- package/dist/lib/types/inline-enums.generated.d.ts +30 -4
- package/dist/lib/types/inline-enums.generated.js +41 -2
- package/dist/lib/types/inline-enums.generated.mjs +28 -2
- package/dist/lib/types/list-products.d.ts +20 -28
- package/dist/lib/types/list-proposals.d.ts +20 -28
- package/dist/lib/types/media-buy-delivery-report.d.mts +6 -0
- package/dist/lib/types/media-buy-delivery-report.d.ts +6 -0
- package/dist/lib/types/media-buy-delivery-report.js +16 -0
- package/dist/lib/types/media-buy-delivery-report.mjs +0 -0
- package/dist/lib/types/refine-proposals.d.ts +20 -28
- package/dist/lib/types/request-proposals.d.ts +20 -28
- package/dist/lib/types/schemas.generated.d.ts +63113 -127273
- package/dist/lib/types/schemas.generated.js +759 -770
- package/dist/lib/types/schemas.generated.mjs +759 -770
- package/dist/lib/types/targeting-keys.generated.d.mts +4 -0
- package/dist/lib/types/targeting-keys.generated.d.ts +4 -0
- package/dist/lib/types/targeting-keys.generated.js +109 -0
- package/dist/lib/types/targeting-keys.generated.mjs +84 -0
- package/dist/lib/types/tools.generated.d.mts +2 -68
- package/dist/lib/types/tools.generated.d.ts +2 -68
- package/dist/lib/types/update-media-buy.d.ts +20 -28
- package/dist/lib/utils/adcp-version-config.js +5 -2
- package/dist/lib/utils/adcp-version-config.mjs +5 -2
- package/dist/lib/utils/envelope-status-compat.d.mts +18 -1
- package/dist/lib/utils/envelope-status-compat.d.ts +18 -1
- package/dist/lib/utils/envelope-status-compat.js +11 -5
- package/dist/lib/utils/envelope-status-compat.mjs +11 -5
- package/dist/lib/utils/response-unwrapper.js +18 -10
- package/dist/lib/utils/response-unwrapper.mjs +18 -10
- package/dist/lib/v2/format-schema/resolver.js +1 -1
- package/dist/lib/v2/format-schema/resolver.mjs +1 -1
- package/dist/lib/v2/projection/creative-delivery.js +159 -39
- package/dist/lib/v2/projection/creative-delivery.mjs +163 -39
- package/dist/lib/v2/projection/index.d.mts +1 -0
- package/dist/lib/v2/projection/index.d.ts +1 -0
- package/dist/lib/v2/projection/index.js +3 -0
- package/dist/lib/v2/projection/index.mjs +2 -0
- package/dist/lib/v2/projection/legacy-metadata.d.mts +19 -0
- package/dist/lib/v2/projection/legacy-metadata.d.ts +19 -0
- package/dist/lib/v2/projection/legacy-metadata.js +91 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs +86 -0
- package/dist/lib/v2/projection/v1-to-v2.d.mts +1 -1
- package/dist/lib/v2/projection/v1-to-v2.d.ts +1 -1
- package/dist/lib/v2/projection/v1-to-v2.js +12 -9
- package/dist/lib/v2/projection/v1-to-v2.mjs +12 -9
- package/dist/lib/validation/budget-allocation.d.mts +3 -3
- package/dist/lib/validation/budget-allocation.d.ts +3 -3
- package/dist/lib/validation/compact-schema.d.mts +27 -0
- package/dist/lib/validation/compact-schema.d.ts +27 -0
- package/dist/lib/validation/compact-schema.js +276 -0
- package/dist/lib/validation/compact-schema.mjs +250 -0
- package/dist/lib/validation/media-buy-delivery-report.d.mts +8 -0
- package/dist/lib/validation/media-buy-delivery-report.d.ts +8 -0
- package/dist/lib/validation/media-buy-delivery-report.js +31 -0
- package/dist/lib/validation/media-buy-delivery-report.mjs +7 -0
- package/dist/lib/validation/nonempty-array.d.mts +15 -0
- package/dist/lib/validation/nonempty-array.d.ts +15 -0
- package/dist/lib/validation/nonempty-array.js +41 -0
- package/dist/lib/validation/nonempty-array.mjs +7 -0
- package/dist/lib/validation/schema-diagnostic-origins.d.mts +21 -0
- package/dist/lib/validation/schema-diagnostic-origins.d.ts +21 -0
- package/dist/lib/validation/schema-diagnostic-origins.js +193 -0
- package/dist/lib/validation/schema-diagnostic-origins.mjs +169 -0
- package/dist/lib/validation/schema-loader.js +86 -16
- package/dist/lib/validation/schema-loader.mjs +82 -16
- package/dist/lib/validation/schema-validator.d.mts +10 -19
- package/dist/lib/validation/schema-validator.d.ts +10 -19
- package/dist/lib/validation/schema-validator.js +136 -43
- package/dist/lib/validation/schema-validator.mjs +140 -44
- package/dist/lib/validation/sync-creatives.d.mts +22 -22
- package/dist/lib/validation/sync-creatives.d.ts +22 -22
- 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/dist/lib/webhooks/index.d.mts +3 -0
- package/dist/lib/webhooks/index.d.ts +3 -0
- package/dist/lib/webhooks/index.js +3 -0
- package/dist/lib/webhooks/index.mjs +2 -0
- package/dist/lib/webhooks/media-buy-delivery.d.mts +43 -0
- package/dist/lib/webhooks/media-buy-delivery.d.ts +43 -0
- package/dist/lib/webhooks/media-buy-delivery.js +119 -0
- package/dist/lib/webhooks/media-buy-delivery.mjs +94 -0
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/COLLECTION-FIXTURE-FOUNDATION.md +11 -0
- package/docs/guides/DELIVERY-WEBHOOK-PARSING.md +142 -0
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +27 -1
- package/docs/guides/REPORTING-LEDGER.md +93 -0
- package/docs/guides/REPORTING-STABILITY.md +1 -1
- package/docs/guides/TYPED-CLIENT-TOOLS.md +49 -0
- package/docs/llms.txt +2 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-16-to-17.md +202 -2
- package/docs/migration-6.6-to-6.7.md +14 -0
- package/docs/migration-account-change-feed.md +15 -0
- package/docs/migration-reporting-storage-package.md +1 -1
- package/docs/recipes/verifying-inbound-webhooks.md +18 -2
- package/package.json +2 -2
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
* enum during validation. The same translation applies to the documented 3.1
|
|
15
15
|
* deprecation window for top-level `status: MediaBuyStatus`. Other 3.1+
|
|
16
16
|
* responses are returned unchanged so the strict validator still rejects a
|
|
17
|
-
* peer that omits or misuses `status`.
|
|
17
|
+
* peer that omits or misuses `status`. A bare `completed` / `rejected` /
|
|
18
|
+
* `canceled` is never treated as a lifecycle when the payload, or failing
|
|
19
|
+
* that the caller's requested release (`options.adcpVersion`), is 3.1+:
|
|
20
|
+
* there it is the task envelope status.
|
|
18
21
|
*
|
|
19
22
|
* The leniency is a back-compat affordance, not a permanent loosening.
|
|
20
23
|
*/
|
|
@@ -26,6 +29,20 @@ export interface LegacyEnvelopeStatusOptions {
|
|
|
26
29
|
* the protocol task envelope.
|
|
27
30
|
*/
|
|
28
31
|
toolName?: string;
|
|
32
|
+
/**
|
|
33
|
+
* AdCP release the caller requested or negotiated for this exchange (for
|
|
34
|
+
* example the client's `adcpVersion` pin, or the release negotiated down
|
|
35
|
+
* from it). The response `adcp_version` echo is optional, so a seller on
|
|
36
|
+
* 3.1+ may answer a create with only `{ status: 'completed', media_buy_id }`.
|
|
37
|
+
* `completed`, `rejected` and `canceled` are valid both as TaskStatus and as
|
|
38
|
+
* MediaBuyStatus. When the payload carries no version echo, this release
|
|
39
|
+
* decides which one a bare top-level `status` is: on 3.1+ it is the task
|
|
40
|
+
* envelope status and is never copied into `media_buy_status`. An explicit
|
|
41
|
+
* `adcp_version` / `adcp_major_version` on the payload always wins. When
|
|
42
|
+
* neither the payload nor the caller knows the release, the legacy 3.0
|
|
43
|
+
* reading still applies.
|
|
44
|
+
*/
|
|
45
|
+
adcpVersion?: string;
|
|
29
46
|
}
|
|
30
47
|
/** 3.2 synchronous response arms that intentionally forbid task-envelope status. */
|
|
31
48
|
export declare const STATUS_FREE_SYNC_RESPONSE_TOOLS: ReadonlySet<string>;
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
* enum during validation. The same translation applies to the documented 3.1
|
|
15
15
|
* deprecation window for top-level `status: MediaBuyStatus`. Other 3.1+
|
|
16
16
|
* responses are returned unchanged so the strict validator still rejects a
|
|
17
|
-
* peer that omits or misuses `status`.
|
|
17
|
+
* peer that omits or misuses `status`. A bare `completed` / `rejected` /
|
|
18
|
+
* `canceled` is never treated as a lifecycle when the payload, or failing
|
|
19
|
+
* that the caller's requested release (`options.adcpVersion`), is 3.1+:
|
|
20
|
+
* there it is the task envelope status.
|
|
18
21
|
*
|
|
19
22
|
* The leniency is a back-compat affordance, not a permanent loosening.
|
|
20
23
|
*/
|
|
@@ -26,6 +29,20 @@ export interface LegacyEnvelopeStatusOptions {
|
|
|
26
29
|
* the protocol task envelope.
|
|
27
30
|
*/
|
|
28
31
|
toolName?: string;
|
|
32
|
+
/**
|
|
33
|
+
* AdCP release the caller requested or negotiated for this exchange (for
|
|
34
|
+
* example the client's `adcpVersion` pin, or the release negotiated down
|
|
35
|
+
* from it). The response `adcp_version` echo is optional, so a seller on
|
|
36
|
+
* 3.1+ may answer a create with only `{ status: 'completed', media_buy_id }`.
|
|
37
|
+
* `completed`, `rejected` and `canceled` are valid both as TaskStatus and as
|
|
38
|
+
* MediaBuyStatus. When the payload carries no version echo, this release
|
|
39
|
+
* decides which one a bare top-level `status` is: on 3.1+ it is the task
|
|
40
|
+
* envelope status and is never copied into `media_buy_status`. An explicit
|
|
41
|
+
* `adcp_version` / `adcp_major_version` on the payload always wins. When
|
|
42
|
+
* neither the payload nor the caller knows the release, the legacy 3.0
|
|
43
|
+
* reading still applies.
|
|
44
|
+
*/
|
|
45
|
+
adcpVersion?: string;
|
|
29
46
|
}
|
|
30
47
|
/** 3.2 synchronous response arms that intentionally forbid task-envelope status. */
|
|
31
48
|
export declare const STATUS_FREE_SYNC_RESPONSE_TOOLS: ReadonlySet<string>;
|
|
@@ -51,7 +51,7 @@ function injectLegacyEnvelopeStatus(response, options) {
|
|
|
51
51
|
return response;
|
|
52
52
|
}
|
|
53
53
|
if (options?.toolName && STATUS_FREE_SYNC_RESPONSE_TOOLS.has(options.toolName)) return response;
|
|
54
|
-
if (options?.toolName && MEDIA_BUY_STATUS_RESPONSE_TOOLS.has(options.toolName) && allowsDeprecatedMediaBuyStatus(response) && isMediaBuySuccessStatusForCompat(response)) {
|
|
54
|
+
if (options?.toolName && MEDIA_BUY_STATUS_RESPONSE_TOOLS.has(options.toolName) && allowsDeprecatedMediaBuyStatus(response) && isMediaBuySuccessStatusForCompat(response, options)) {
|
|
55
55
|
const mediaBuyStatus = response.status;
|
|
56
56
|
return {
|
|
57
57
|
...response,
|
|
@@ -76,16 +76,16 @@ function normalizeLegacyMediaBuyStatusForReturn(response, options) {
|
|
|
76
76
|
if (!response || typeof response !== "object" || Array.isArray(response)) {
|
|
77
77
|
return response;
|
|
78
78
|
}
|
|
79
|
-
if (!options?.toolName || !MEDIA_BUY_STATUS_RESPONSE_TOOLS.has(options.toolName) || !allowsDeprecatedMediaBuyStatus(response) || !isMediaBuySuccessStatusForCompat(response)) {
|
|
79
|
+
if (!options?.toolName || !MEDIA_BUY_STATUS_RESPONSE_TOOLS.has(options.toolName) || !allowsDeprecatedMediaBuyStatus(response) || !isMediaBuySuccessStatusForCompat(response, options)) {
|
|
80
80
|
return response;
|
|
81
81
|
}
|
|
82
|
-
const status = (0, import_media_buy_status.getAuthoritativeMediaBuyStatus)(response);
|
|
82
|
+
const status = (0, import_media_buy_status.getAuthoritativeMediaBuyStatus)(withRequestedVersion(response, options));
|
|
83
83
|
if (!status || response.media_buy_status === status) return response;
|
|
84
84
|
return { ...response, media_buy_status: status };
|
|
85
85
|
}
|
|
86
|
-
function isMediaBuySuccessStatusForCompat(response) {
|
|
86
|
+
function isMediaBuySuccessStatusForCompat(response, options) {
|
|
87
87
|
const status = response.status;
|
|
88
|
-
if ((0, import_media_buy_status.getAuthoritativeMediaBuyStatus)(response) !== status) return false;
|
|
88
|
+
if ((0, import_media_buy_status.getAuthoritativeMediaBuyStatus)(withRequestedVersion(response, options)) !== status) return false;
|
|
89
89
|
if (typeof response.media_buy_status === "string" && response.media_buy_status !== status) {
|
|
90
90
|
return false;
|
|
91
91
|
}
|
|
@@ -100,6 +100,12 @@ function allowsDeprecatedMediaBuyStatus(payload) {
|
|
|
100
100
|
if (typeof major === "number") return major === 3;
|
|
101
101
|
return true;
|
|
102
102
|
}
|
|
103
|
+
function withRequestedVersion(payload, options) {
|
|
104
|
+
const requested = options?.adcpVersion;
|
|
105
|
+
if (typeof requested !== "string" || requested.length === 0) return payload;
|
|
106
|
+
if (typeof payload.adcp_version === "string" || typeof payload.adcp_major_version === "number") return payload;
|
|
107
|
+
return { ...payload, adcp_version: requested };
|
|
108
|
+
}
|
|
103
109
|
// Annotate the CommonJS export names for ESM import in node:
|
|
104
110
|
0 && (module.exports = {
|
|
105
111
|
STATUS_FREE_SYNC_RESPONSE_TOOLS,
|
|
@@ -25,7 +25,7 @@ function injectLegacyEnvelopeStatus(response, options) {
|
|
|
25
25
|
return response;
|
|
26
26
|
}
|
|
27
27
|
if (options?.toolName && STATUS_FREE_SYNC_RESPONSE_TOOLS.has(options.toolName)) return response;
|
|
28
|
-
if (options?.toolName && MEDIA_BUY_STATUS_RESPONSE_TOOLS.has(options.toolName) && allowsDeprecatedMediaBuyStatus(response) && isMediaBuySuccessStatusForCompat(response)) {
|
|
28
|
+
if (options?.toolName && MEDIA_BUY_STATUS_RESPONSE_TOOLS.has(options.toolName) && allowsDeprecatedMediaBuyStatus(response) && isMediaBuySuccessStatusForCompat(response, options)) {
|
|
29
29
|
const mediaBuyStatus = response.status;
|
|
30
30
|
return {
|
|
31
31
|
...response,
|
|
@@ -50,16 +50,16 @@ function normalizeLegacyMediaBuyStatusForReturn(response, options) {
|
|
|
50
50
|
if (!response || typeof response !== "object" || Array.isArray(response)) {
|
|
51
51
|
return response;
|
|
52
52
|
}
|
|
53
|
-
if (!options?.toolName || !MEDIA_BUY_STATUS_RESPONSE_TOOLS.has(options.toolName) || !allowsDeprecatedMediaBuyStatus(response) || !isMediaBuySuccessStatusForCompat(response)) {
|
|
53
|
+
if (!options?.toolName || !MEDIA_BUY_STATUS_RESPONSE_TOOLS.has(options.toolName) || !allowsDeprecatedMediaBuyStatus(response) || !isMediaBuySuccessStatusForCompat(response, options)) {
|
|
54
54
|
return response;
|
|
55
55
|
}
|
|
56
|
-
const status = getAuthoritativeMediaBuyStatus(response);
|
|
56
|
+
const status = getAuthoritativeMediaBuyStatus(withRequestedVersion(response, options));
|
|
57
57
|
if (!status || response.media_buy_status === status) return response;
|
|
58
58
|
return { ...response, media_buy_status: status };
|
|
59
59
|
}
|
|
60
|
-
function isMediaBuySuccessStatusForCompat(response) {
|
|
60
|
+
function isMediaBuySuccessStatusForCompat(response, options) {
|
|
61
61
|
const status = response.status;
|
|
62
|
-
if (getAuthoritativeMediaBuyStatus(response) !== status) return false;
|
|
62
|
+
if (getAuthoritativeMediaBuyStatus(withRequestedVersion(response, options)) !== status) return false;
|
|
63
63
|
if (typeof response.media_buy_status === "string" && response.media_buy_status !== status) {
|
|
64
64
|
return false;
|
|
65
65
|
}
|
|
@@ -74,6 +74,12 @@ function allowsDeprecatedMediaBuyStatus(payload) {
|
|
|
74
74
|
if (typeof major === "number") return major === 3;
|
|
75
75
|
return true;
|
|
76
76
|
}
|
|
77
|
+
function withRequestedVersion(payload, options) {
|
|
78
|
+
const requested = options?.adcpVersion;
|
|
79
|
+
if (typeof requested !== "string" || requested.length === 0) return payload;
|
|
80
|
+
if (typeof payload.adcp_version === "string" || typeof payload.adcp_major_version === "number") return payload;
|
|
81
|
+
return { ...payload, adcp_version: requested };
|
|
82
|
+
}
|
|
77
83
|
export {
|
|
78
84
|
STATUS_FREE_SYNC_RESPONSE_TOOLS,
|
|
79
85
|
injectLegacyEnvelopeStatus,
|
|
@@ -29,6 +29,7 @@ __export(response_unwrapper_exports, {
|
|
|
29
29
|
unwrapProtocolResponse: () => unwrapProtocolResponse
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(response_unwrapper_exports);
|
|
32
|
+
var import_task_status = require('../core/task-status.js');
|
|
32
33
|
var import_union_errors = require('./union-errors.js');
|
|
33
34
|
var import_envelope_status_compat = require('./envelope-status-compat.js');
|
|
34
35
|
var import_a2a_artifacts = require('./a2a-artifacts.js');
|
|
@@ -164,6 +165,7 @@ function isStructuredGetProductsRejection(response, toolName, responseAdcpVersio
|
|
|
164
165
|
return declaresStructuredRejectionVersion && obj.status === "rejected" && typeof obj.reason === "string" && obj.reason.length >= 1 && obj.reason.length <= 2e3 && suggestionsValid && obj.success !== false && obj.error == null && typeof obj.error_code !== "string" && forbiddenFields.every((field) => !hasOwnField(obj, field));
|
|
165
166
|
}
|
|
166
167
|
function isTerminalAdcpError(response, toolName, responseAdcpVersion) {
|
|
168
|
+
if ((0, import_task_status.isTaskStatusResponse)(response, toolName)) return false;
|
|
167
169
|
const obj = response;
|
|
168
170
|
if (isStructuredGetProductsRejection(obj, toolName, responseAdcpVersion)) return false;
|
|
169
171
|
if (obj?.status === "failed" || obj?.status === "rejected") return true;
|
|
@@ -177,6 +179,7 @@ function isTerminalAdcpError(response, toolName, responseAdcpVersion) {
|
|
|
177
179
|
return false;
|
|
178
180
|
}
|
|
179
181
|
function isAdcpOperationSuccess(response, toolName, responseAdcpVersion) {
|
|
182
|
+
if ((0, import_task_status.isTaskStatusResponse)(response, toolName)) return true;
|
|
180
183
|
const obj = response;
|
|
181
184
|
return obj?.success !== false && !obj?.error && !obj?.adcp_error && !isTerminalAdcpError(response, toolName, responseAdcpVersion);
|
|
182
185
|
}
|
|
@@ -186,7 +189,9 @@ function unwrapProtocolResponse(protocolResponse, toolName, protocol, options) {
|
|
|
186
189
|
}
|
|
187
190
|
let unwrapped;
|
|
188
191
|
let mcpExtractionPath;
|
|
189
|
-
if (
|
|
192
|
+
if ((0, import_task_status.isTaskStatusResponse)(protocolResponse, toolName)) {
|
|
193
|
+
unwrapped = protocolResponse;
|
|
194
|
+
} else if (protocol === "mcp") {
|
|
190
195
|
const outcome = unwrapMCPResponse(protocolResponse);
|
|
191
196
|
unwrapped = outcome.result;
|
|
192
197
|
mcpExtractionPath = outcome.extractionPath;
|
|
@@ -218,9 +223,10 @@ function unwrapProtocolResponse(protocolResponse, toolName, protocol, options) {
|
|
|
218
223
|
const schema = TOOL_RESPONSE_SCHEMAS[toolName];
|
|
219
224
|
if (schema) {
|
|
220
225
|
const { _message: _msg, ...stripped } = unwrapped;
|
|
226
|
+
const compatOptions = { toolName, adcpVersion: options?.responseAdcpVersion };
|
|
221
227
|
const dataToValidate = prepareResponseForSchemaValidation(
|
|
222
228
|
toolName,
|
|
223
|
-
(0, import_envelope_status_compat.injectLegacyEnvelopeStatus)(stripped,
|
|
229
|
+
(0, import_envelope_status_compat.injectLegacyEnvelopeStatus)(stripped, compatOptions),
|
|
224
230
|
options?.responseAdcpVersion
|
|
225
231
|
);
|
|
226
232
|
const result = schema.safeParse(dataToValidate);
|
|
@@ -233,7 +239,7 @@ function unwrapProtocolResponse(protocolResponse, toolName, protocol, options) {
|
|
|
233
239
|
const { status: _s, ...rest } = validated2;
|
|
234
240
|
validated2 = rest;
|
|
235
241
|
} else {
|
|
236
|
-
validated2 = restoreLegacyMediaBuyStatusForReturn(validated2, stripped, dataToValidate,
|
|
242
|
+
validated2 = restoreLegacyMediaBuyStatusForReturn(validated2, stripped, dataToValidate, compatOptions);
|
|
237
243
|
}
|
|
238
244
|
validated2 = restoreCompatibilityVersionForReturn(validated2, stripped, dataToValidate);
|
|
239
245
|
if (!("adcp_version" in stripped)) {
|
|
@@ -260,7 +266,7 @@ function unwrapProtocolResponse(protocolResponse, toolName, protocol, options) {
|
|
|
260
266
|
const { status: _s, ...rest } = validated;
|
|
261
267
|
validated = rest;
|
|
262
268
|
} else {
|
|
263
|
-
validated = restoreLegacyMediaBuyStatusForReturn(validated, stripped, dataToValidate,
|
|
269
|
+
validated = restoreLegacyMediaBuyStatusForReturn(validated, stripped, dataToValidate, compatOptions);
|
|
264
270
|
}
|
|
265
271
|
validated = restoreCompatibilityVersionForReturn(validated, stripped, dataToValidate);
|
|
266
272
|
if (!("adcp_version" in stripped)) {
|
|
@@ -279,16 +285,18 @@ function restoreCompatibilityVersionForReturn(validated, original, compat) {
|
|
|
279
285
|
}
|
|
280
286
|
return validated;
|
|
281
287
|
}
|
|
282
|
-
function restoreLegacyMediaBuyStatusForReturn(validated, original, compat,
|
|
288
|
+
function restoreLegacyMediaBuyStatusForReturn(validated, original, compat, compatOptions) {
|
|
289
|
+
const { toolName } = compatOptions;
|
|
283
290
|
if ((toolName === "create_media_buy" || toolName === "update_media_buy") && typeof original.media_buy_id === "string" && typeof original.status === "string" && compat.status === "completed" && typeof compat.media_buy_status === "string") {
|
|
284
291
|
return (0, import_envelope_status_compat.normalizeLegacyMediaBuyStatusForReturn)(
|
|
285
292
|
{ ...validated, status: original.status },
|
|
286
|
-
|
|
293
|
+
compatOptions
|
|
287
294
|
);
|
|
288
295
|
}
|
|
289
|
-
return (0, import_envelope_status_compat.normalizeLegacyMediaBuyStatusForReturn)(
|
|
290
|
-
|
|
291
|
-
|
|
296
|
+
return (0, import_envelope_status_compat.normalizeLegacyMediaBuyStatusForReturn)(
|
|
297
|
+
validated,
|
|
298
|
+
compatOptions
|
|
299
|
+
);
|
|
292
300
|
}
|
|
293
301
|
function filterInvalidProducts(schema, data) {
|
|
294
302
|
const { z } = require("zod");
|
|
@@ -499,7 +507,7 @@ function isAdcpSuccess(response, taskName, responseAdcpVersion) {
|
|
|
499
507
|
const { _message: _, ...stripped } = response ?? {};
|
|
500
508
|
const dataToValidate = prepareResponseForSchemaValidation(
|
|
501
509
|
taskName,
|
|
502
|
-
(0, import_envelope_status_compat.injectLegacyEnvelopeStatus)(stripped, { toolName: taskName }),
|
|
510
|
+
(0, import_envelope_status_compat.injectLegacyEnvelopeStatus)(stripped, { toolName: taskName, adcpVersion: responseAdcpVersion }),
|
|
503
511
|
responseAdcpVersion
|
|
504
512
|
);
|
|
505
513
|
const result = schema.safeParse(dataToValidate);
|
|
@@ -3,6 +3,7 @@ import { dirname as __adcpDirname } from "node:path";
|
|
|
3
3
|
import { createRequire as __adcpCreateRequire } from "node:module";
|
|
4
4
|
const __dirname = __adcpDirname(__adcpFileURLToPath(import.meta.url));
|
|
5
5
|
const require2 = __adcpCreateRequire(import.meta.url);
|
|
6
|
+
import { isTaskStatusResponse } from "../core/task-status.mjs";
|
|
6
7
|
import { getBestUnionErrors } from "./union-errors.mjs";
|
|
7
8
|
const ERROR_CODES = {
|
|
8
9
|
MCP_ERROR: "mcp_error",
|
|
@@ -138,6 +139,7 @@ function isStructuredGetProductsRejection(response, toolName, responseAdcpVersio
|
|
|
138
139
|
return declaresStructuredRejectionVersion && obj.status === "rejected" && typeof obj.reason === "string" && obj.reason.length >= 1 && obj.reason.length <= 2e3 && suggestionsValid && obj.success !== false && obj.error == null && typeof obj.error_code !== "string" && forbiddenFields.every((field) => !hasOwnField(obj, field));
|
|
139
140
|
}
|
|
140
141
|
function isTerminalAdcpError(response, toolName, responseAdcpVersion) {
|
|
142
|
+
if (isTaskStatusResponse(response, toolName)) return false;
|
|
141
143
|
const obj = response;
|
|
142
144
|
if (isStructuredGetProductsRejection(obj, toolName, responseAdcpVersion)) return false;
|
|
143
145
|
if (obj?.status === "failed" || obj?.status === "rejected") return true;
|
|
@@ -151,6 +153,7 @@ function isTerminalAdcpError(response, toolName, responseAdcpVersion) {
|
|
|
151
153
|
return false;
|
|
152
154
|
}
|
|
153
155
|
function isAdcpOperationSuccess(response, toolName, responseAdcpVersion) {
|
|
156
|
+
if (isTaskStatusResponse(response, toolName)) return true;
|
|
154
157
|
const obj = response;
|
|
155
158
|
return obj?.success !== false && !obj?.error && !obj?.adcp_error && !isTerminalAdcpError(response, toolName, responseAdcpVersion);
|
|
156
159
|
}
|
|
@@ -160,7 +163,9 @@ function unwrapProtocolResponse(protocolResponse, toolName, protocol, options) {
|
|
|
160
163
|
}
|
|
161
164
|
let unwrapped;
|
|
162
165
|
let mcpExtractionPath;
|
|
163
|
-
if (
|
|
166
|
+
if (isTaskStatusResponse(protocolResponse, toolName)) {
|
|
167
|
+
unwrapped = protocolResponse;
|
|
168
|
+
} else if (protocol === "mcp") {
|
|
164
169
|
const outcome = unwrapMCPResponse(protocolResponse);
|
|
165
170
|
unwrapped = outcome.result;
|
|
166
171
|
mcpExtractionPath = outcome.extractionPath;
|
|
@@ -192,9 +197,10 @@ function unwrapProtocolResponse(protocolResponse, toolName, protocol, options) {
|
|
|
192
197
|
const schema = TOOL_RESPONSE_SCHEMAS[toolName];
|
|
193
198
|
if (schema) {
|
|
194
199
|
const { _message: _msg, ...stripped } = unwrapped;
|
|
200
|
+
const compatOptions = { toolName, adcpVersion: options?.responseAdcpVersion };
|
|
195
201
|
const dataToValidate = prepareResponseForSchemaValidation(
|
|
196
202
|
toolName,
|
|
197
|
-
injectLegacyEnvelopeStatus(stripped,
|
|
203
|
+
injectLegacyEnvelopeStatus(stripped, compatOptions),
|
|
198
204
|
options?.responseAdcpVersion
|
|
199
205
|
);
|
|
200
206
|
const result = schema.safeParse(dataToValidate);
|
|
@@ -207,7 +213,7 @@ function unwrapProtocolResponse(protocolResponse, toolName, protocol, options) {
|
|
|
207
213
|
const { status: _s, ...rest } = validated2;
|
|
208
214
|
validated2 = rest;
|
|
209
215
|
} else {
|
|
210
|
-
validated2 = restoreLegacyMediaBuyStatusForReturn(validated2, stripped, dataToValidate,
|
|
216
|
+
validated2 = restoreLegacyMediaBuyStatusForReturn(validated2, stripped, dataToValidate, compatOptions);
|
|
211
217
|
}
|
|
212
218
|
validated2 = restoreCompatibilityVersionForReturn(validated2, stripped, dataToValidate);
|
|
213
219
|
if (!("adcp_version" in stripped)) {
|
|
@@ -234,7 +240,7 @@ function unwrapProtocolResponse(protocolResponse, toolName, protocol, options) {
|
|
|
234
240
|
const { status: _s, ...rest } = validated;
|
|
235
241
|
validated = rest;
|
|
236
242
|
} else {
|
|
237
|
-
validated = restoreLegacyMediaBuyStatusForReturn(validated, stripped, dataToValidate,
|
|
243
|
+
validated = restoreLegacyMediaBuyStatusForReturn(validated, stripped, dataToValidate, compatOptions);
|
|
238
244
|
}
|
|
239
245
|
validated = restoreCompatibilityVersionForReturn(validated, stripped, dataToValidate);
|
|
240
246
|
if (!("adcp_version" in stripped)) {
|
|
@@ -253,16 +259,18 @@ function restoreCompatibilityVersionForReturn(validated, original, compat) {
|
|
|
253
259
|
}
|
|
254
260
|
return validated;
|
|
255
261
|
}
|
|
256
|
-
function restoreLegacyMediaBuyStatusForReturn(validated, original, compat,
|
|
262
|
+
function restoreLegacyMediaBuyStatusForReturn(validated, original, compat, compatOptions) {
|
|
263
|
+
const { toolName } = compatOptions;
|
|
257
264
|
if ((toolName === "create_media_buy" || toolName === "update_media_buy") && typeof original.media_buy_id === "string" && typeof original.status === "string" && compat.status === "completed" && typeof compat.media_buy_status === "string") {
|
|
258
265
|
return normalizeLegacyMediaBuyStatusForReturn(
|
|
259
266
|
{ ...validated, status: original.status },
|
|
260
|
-
|
|
267
|
+
compatOptions
|
|
261
268
|
);
|
|
262
269
|
}
|
|
263
|
-
return normalizeLegacyMediaBuyStatusForReturn(
|
|
264
|
-
|
|
265
|
-
|
|
270
|
+
return normalizeLegacyMediaBuyStatusForReturn(
|
|
271
|
+
validated,
|
|
272
|
+
compatOptions
|
|
273
|
+
);
|
|
266
274
|
}
|
|
267
275
|
function filterInvalidProducts(schema, data) {
|
|
268
276
|
const { z } = require2("zod");
|
|
@@ -473,7 +481,7 @@ function isAdcpSuccess(response, taskName, responseAdcpVersion) {
|
|
|
473
481
|
const { _message: _, ...stripped } = response ?? {};
|
|
474
482
|
const dataToValidate = prepareResponseForSchemaValidation(
|
|
475
483
|
taskName,
|
|
476
|
-
injectLegacyEnvelopeStatus(stripped, { toolName: taskName }),
|
|
484
|
+
injectLegacyEnvelopeStatus(stripped, { toolName: taskName, adcpVersion: responseAdcpVersion }),
|
|
477
485
|
responseAdcpVersion
|
|
478
486
|
);
|
|
479
487
|
const result = schema.safeParse(dataToValidate);
|
|
@@ -202,7 +202,7 @@ function validateJsonSchema(schema, maxKeywords) {
|
|
|
202
202
|
details: (0, import_regex_safety.unsafeRegexDetails)(unsafeRegex)
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
|
-
const ajv = new Ajv2019({ strict: false, allErrors: true, validateSchema: true });
|
|
205
|
+
const ajv = new Ajv2019({ inlineRefs: false, strict: false, allErrors: true, validateSchema: true });
|
|
206
206
|
(0, import_ajv_formats.default)(ajv);
|
|
207
207
|
ajv.addMetaSchema(draft7MetaSchema);
|
|
208
208
|
ajv.addMetaSchema({ ...draft7MetaSchema, $id: "https://json-schema.org/draft-07/schema#" });
|
|
@@ -179,7 +179,7 @@ function validateJsonSchema(schema, maxKeywords) {
|
|
|
179
179
|
details: unsafeRegexDetails(unsafeRegex)
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
const ajv = new Ajv2019({ strict: false, allErrors: true, validateSchema: true });
|
|
182
|
+
const ajv = new Ajv2019({ inlineRefs: false, strict: false, allErrors: true, validateSchema: true });
|
|
183
183
|
addFormats(ajv);
|
|
184
184
|
ajv.addMetaSchema(draft7MetaSchema);
|
|
185
185
|
ajv.addMetaSchema({ ...draft7MetaSchema, $id: "https://json-schema.org/draft-07/schema#" });
|