@adcp/sdk 17.0.0-beta.1 → 17.0.0-beta.3
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/index.d.mts +9 -0
- package/dist/lib/adapters/version/index.d.ts +9 -0
- package/dist/lib/adapters/version/index.js +20 -6
- package/dist/lib/adapters/version/index.mjs +15 -2
- 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/SingleAgentClient.d.mts +115 -2
- package/dist/lib/core/SingleAgentClient.d.ts +115 -2
- package/dist/lib/core/SingleAgentClient.js +547 -67
- package/dist/lib/core/SingleAgentClient.mjs +534 -54
- package/dist/lib/core/TaskExecutor.d.mts +7 -0
- package/dist/lib/core/TaskExecutor.d.ts +7 -0
- package/dist/lib/core/TaskExecutor.js +18 -5
- package/dist/lib/core/TaskExecutor.mjs +18 -5
- 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/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 +43 -23
- package/dist/lib/identity-3.3/trust.mjs +43 -23
- 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 +6 -52
- package/dist/lib/index.d.ts +6 -52
- package/dist/lib/index.js +11 -0
- package/dist/lib/index.mjs +7 -0
- package/dist/lib/media-buy/compatibility.js +6 -1
- package/dist/lib/media-buy/compatibility.mjs +6 -1
- package/dist/lib/protocols/mcp-scope.d.mts +3 -0
- package/dist/lib/protocols/mcp-scope.d.ts +3 -0
- package/dist/lib/protocols/mcp-scope.js +8 -3
- package/dist/lib/protocols/mcp-scope.mjs +8 -3
- 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/a2a-adapter.js +2 -1
- package/dist/lib/server/a2a-adapter.mjs +2 -1
- 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/auth-signature.d.mts +2 -2
- package/dist/lib/server/auth-signature.d.ts +2 -2
- package/dist/lib/server/auth-signature.js +3 -0
- package/dist/lib/server/auth-signature.mjs +3 -0
- package/dist/lib/server/create-adcp-server.d.mts +2 -2
- package/dist/lib/server/create-adcp-server.d.ts +2 -2
- package/dist/lib/server/create-adcp-server.js +58 -23
- package/dist/lib/server/create-adcp-server.mjs +61 -15
- 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/server/serve.js +3 -1
- package/dist/lib/server/serve.mjs +3 -1
- package/dist/lib/server/signed-request-transport.d.mts +1 -0
- package/dist/lib/server/signed-request-transport.d.ts +1 -0
- package/dist/lib/server/signed-request-transport.js +46 -0
- package/dist/lib/server/signed-request-transport.mjs +20 -0
- package/dist/lib/server/test-controller.d.mts +1 -0
- package/dist/lib/server/test-controller.d.ts +1 -0
- package/dist/lib/server/test-controller.js +5 -1
- package/dist/lib/server/test-controller.mjs +5 -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/index.d.mts +1 -0
- package/dist/lib/testing/index.d.ts +1 -0
- package/dist/lib/testing/index.js +3 -0
- package/dist/lib/testing/index.mjs +2 -0
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +61 -29
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +61 -29
- 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/index.d.mts +1 -0
- package/dist/lib/testing/storyboard/index.d.ts +1 -0
- package/dist/lib/testing/storyboard/index.js +3 -0
- package/dist/lib/testing/storyboard/index.mjs +2 -0
- package/dist/lib/testing/storyboard/loader.js +7 -0
- package/dist/lib/testing/storyboard/loader.mjs +7 -0
- package/dist/lib/testing/storyboard/request-builder.js +9 -6
- package/dist/lib/testing/storyboard/request-builder.mjs +9 -6
- 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 +59 -6
- package/dist/lib/testing/storyboard/runner.mjs +59 -6
- package/dist/lib/testing/storyboard/types.d.mts +18 -0
- package/dist/lib/testing/storyboard/types.d.ts +18 -0
- 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/web-bot-auth.d.mts +10 -0
- package/dist/lib/testing/storyboard/web-bot-auth.d.ts +10 -0
- package/dist/lib/testing/storyboard/web-bot-auth.js +80 -0
- package/dist/lib/testing/storyboard/web-bot-auth.mjs +56 -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/response-unwrapper.js +6 -1
- package/dist/lib/utils/response-unwrapper.mjs +6 -1
- 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 +104 -29
- package/dist/lib/v2/projection/creative-delivery.mjs +108 -29
- 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 +135 -42
- package/dist/lib/validation/schema-validator.mjs +139 -43
- 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/DELIVERY-WEBHOOK-PARSING.md +142 -0
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +15 -0
- 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 +218 -14
- package/docs/migration-6.6-to-6.7.md +14 -0
- package/docs/migration-account-change-feed.md +15 -0
- package/docs/migration-agent-identity-3.3.md +106 -4
- package/docs/recipes/verifying-inbound-webhooks.md +18 -2
- package/package.json +16 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SyncAccountsSuccess } from '../types/tools.generated.mjs';
|
|
2
|
+
declare const IDENTITY_RESPONSE_SCHEMAS: {
|
|
3
|
+
readonly account: "core/account-ref.json";
|
|
4
|
+
readonly operator_unit: "core/operator-unit.json";
|
|
5
|
+
readonly identity_change: "core/account-identity-change.json";
|
|
6
|
+
readonly identity_change_preview: "core/account-identity-change-preview.json";
|
|
7
|
+
};
|
|
8
|
+
type IdentityFields = Pick<SyncAccountsSuccess['accounts'][number], keyof typeof IDENTITY_RESPONSE_SCHEMAS>;
|
|
9
|
+
/**
|
|
10
|
+
* These canonical identity objects have closed schemas, including their nested
|
|
11
|
+
* operator identities. Validate and emit the same detached snapshot so retained
|
|
12
|
+
* DB/request fields or later mutations cannot enter a response or replay cache,
|
|
13
|
+
* even with whole-response validation off. These four core contracts are shared
|
|
14
|
+
* by the maintained 3.2 and 3.3 bundles.
|
|
15
|
+
*/
|
|
16
|
+
export declare function projectAccountResponseIdentityFields(account: object): IdentityFields;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SyncAccountsSuccess } from '../types/tools.generated';
|
|
2
|
+
declare const IDENTITY_RESPONSE_SCHEMAS: {
|
|
3
|
+
readonly account: "core/account-ref.json";
|
|
4
|
+
readonly operator_unit: "core/operator-unit.json";
|
|
5
|
+
readonly identity_change: "core/account-identity-change.json";
|
|
6
|
+
readonly identity_change_preview: "core/account-identity-change-preview.json";
|
|
7
|
+
};
|
|
8
|
+
type IdentityFields = Pick<SyncAccountsSuccess['accounts'][number], keyof typeof IDENTITY_RESPONSE_SCHEMAS>;
|
|
9
|
+
/**
|
|
10
|
+
* These canonical identity objects have closed schemas, including their nested
|
|
11
|
+
* operator identities. Validate and emit the same detached snapshot so retained
|
|
12
|
+
* DB/request fields or later mutations cannot enter a response or replay cache,
|
|
13
|
+
* even with whole-response validation off. These four core contracts are shared
|
|
14
|
+
* by the maintained 3.2 and 3.3 bundles.
|
|
15
|
+
*/
|
|
16
|
+
export declare function projectAccountResponseIdentityFields(account: object): IdentityFields;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var account_response_identity_exports = {};
|
|
20
|
+
__export(account_response_identity_exports, {
|
|
21
|
+
projectAccountResponseIdentityFields: () => projectAccountResponseIdentityFields
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(account_response_identity_exports);
|
|
24
|
+
var import_schema_loader = require('../validation/schema-loader.js');
|
|
25
|
+
const IDENTITY_RESPONSE_SCHEMAS = {
|
|
26
|
+
account: "core/account-ref.json",
|
|
27
|
+
operator_unit: "core/operator-unit.json",
|
|
28
|
+
identity_change: "core/account-identity-change.json",
|
|
29
|
+
identity_change_preview: "core/account-identity-change-preview.json"
|
|
30
|
+
};
|
|
31
|
+
function projectAccountResponseIdentityFields(account) {
|
|
32
|
+
const fields = account;
|
|
33
|
+
const projected = {};
|
|
34
|
+
for (const [field, schemaRef] of Object.entries(IDENTITY_RESPONSE_SCHEMAS)) {
|
|
35
|
+
const value = fields[field];
|
|
36
|
+
if (value === void 0) continue;
|
|
37
|
+
const snapshot = structuredClone(value);
|
|
38
|
+
const validate = (0, import_schema_loader.getSchemaValidatorByRef)(schemaRef);
|
|
39
|
+
if (!validate) throw new Error(`Account response identity schema unavailable: ${schemaRef}.`);
|
|
40
|
+
if (!validate(snapshot)) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Account response ${field} must match its canonical identity schema without retained internal fields.`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
Object.assign(projected, { [field]: snapshot });
|
|
46
|
+
}
|
|
47
|
+
return projected;
|
|
48
|
+
}
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
projectAccountResponseIdentityFields
|
|
52
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getSchemaValidatorByRef } from "../validation/schema-loader.mjs";
|
|
2
|
+
const IDENTITY_RESPONSE_SCHEMAS = {
|
|
3
|
+
account: "core/account-ref.json",
|
|
4
|
+
operator_unit: "core/operator-unit.json",
|
|
5
|
+
identity_change: "core/account-identity-change.json",
|
|
6
|
+
identity_change_preview: "core/account-identity-change-preview.json"
|
|
7
|
+
};
|
|
8
|
+
function projectAccountResponseIdentityFields(account) {
|
|
9
|
+
const fields = account;
|
|
10
|
+
const projected = {};
|
|
11
|
+
for (const [field, schemaRef] of Object.entries(IDENTITY_RESPONSE_SCHEMAS)) {
|
|
12
|
+
const value = fields[field];
|
|
13
|
+
if (value === void 0) continue;
|
|
14
|
+
const snapshot = structuredClone(value);
|
|
15
|
+
const validate = getSchemaValidatorByRef(schemaRef);
|
|
16
|
+
if (!validate) throw new Error(`Account response identity schema unavailable: ${schemaRef}.`);
|
|
17
|
+
if (!validate(snapshot)) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
`Account response ${field} must match its canonical identity schema without retained internal fields.`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
Object.assign(projected, { [field]: snapshot });
|
|
23
|
+
}
|
|
24
|
+
return projected;
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
projectAccountResponseIdentityFields
|
|
28
|
+
};
|
|
@@ -205,9 +205,9 @@ async function checkSyncAccountRows(accounts, entries, existing, rows, indices,
|
|
|
205
205
|
field: `accounts[${index}]${termsViolation ? ".payment_terms" : billingViolation ? ".billing" : ""}`
|
|
206
206
|
}
|
|
207
207
|
).toStructuredError();
|
|
208
|
+
const anchor = row.account !== void 0 ? { account: row.account } : { brand: row.brand, operator: row.operator };
|
|
208
209
|
row = {
|
|
209
|
-
|
|
210
|
-
operator: row.operator,
|
|
210
|
+
...anchor,
|
|
211
211
|
...priorId === row.account_id && priorId && { account_id: priorId },
|
|
212
212
|
action: "failed",
|
|
213
213
|
status: existing[offset]?.status ?? row.status,
|
|
@@ -178,9 +178,9 @@ async function checkSyncAccountRows(accounts, entries, existing, rows, indices,
|
|
|
178
178
|
field: `accounts[${index}]${termsViolation ? ".payment_terms" : billingViolation ? ".billing" : ""}`
|
|
179
179
|
}
|
|
180
180
|
).toStructuredError();
|
|
181
|
+
const anchor = row.account !== void 0 ? { account: row.account } : { brand: row.brand, operator: row.operator };
|
|
181
182
|
row = {
|
|
182
|
-
|
|
183
|
-
operator: row.operator,
|
|
183
|
+
...anchor,
|
|
184
184
|
...priorId === row.account_id && priorId && { account_id: priorId },
|
|
185
185
|
action: "failed",
|
|
186
186
|
status: existing[offset]?.status ?? row.status,
|
|
@@ -64,8 +64,8 @@ export interface VerifySignatureAsAuthenticatorOptions {
|
|
|
64
64
|
* requests fall through to the next authenticator — so set it to whatever
|
|
65
65
|
* your `request_signing` capability claim advertises. */
|
|
66
66
|
capability: VerifierCapability;
|
|
67
|
-
/** Resolves
|
|
68
|
-
jwks
|
|
67
|
+
/** Resolves legacy RFC 9421 keys. May be omitted for a Web Bot Auth-only endpoint. */
|
|
68
|
+
jwks?: JwksResolver;
|
|
69
69
|
/**
|
|
70
70
|
* Stores `(keyid, signature-bytes, expires)` tuples for replay detection.
|
|
71
71
|
* Defaults to a fresh {@link InMemoryReplayStore} — fine for single-process
|
|
@@ -64,8 +64,8 @@ export interface VerifySignatureAsAuthenticatorOptions {
|
|
|
64
64
|
* requests fall through to the next authenticator — so set it to whatever
|
|
65
65
|
* your `request_signing` capability claim advertises. */
|
|
66
66
|
capability: VerifierCapability;
|
|
67
|
-
/** Resolves
|
|
68
|
-
jwks
|
|
67
|
+
/** Resolves legacy RFC 9421 keys. May be omitted for a Web Bot Auth-only endpoint. */
|
|
68
|
+
jwks?: JwksResolver;
|
|
69
69
|
/**
|
|
70
70
|
* Stores `(keyid, signature-bytes, expires)` tuples for replay detection.
|
|
71
71
|
* Defaults to a fresh {@link InMemoryReplayStore} — fine for single-process
|
|
@@ -36,6 +36,8 @@ var import_verifier = require('../signing/verifier.js');
|
|
|
36
36
|
var import_buyer_agent = require('./decisioning/buyer-agent.js');
|
|
37
37
|
var import_auth = require('./auth.js');
|
|
38
38
|
function verifySignatureAsAuthenticator(options) {
|
|
39
|
+
if (!options.jwks && !options.webBotAuth)
|
|
40
|
+
throw new TypeError("verifySignatureAsAuthenticator requires jwks or webBotAuth");
|
|
39
41
|
const replayStore = options.replayStore ?? new import_replay.InMemoryReplayStore();
|
|
40
42
|
const legacyOriginGate = options.assertLegacyOriginAllowed ?? (0, import_web_bot_auth.getWebBotAuthLegacyOriginGate)(options.webBotAuth?.resolvePrincipal);
|
|
41
43
|
if (options.webBotAuth && !legacyOriginGate)
|
|
@@ -102,6 +104,7 @@ function verifySignatureAsAuthenticator(options) {
|
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
106
|
}
|
|
107
|
+
if (!options.jwks) throw new import_web_bot_auth2.WebBotAuthError(403, "profile_disabled");
|
|
105
108
|
result = await (0, import_verifier.verifyRequestSignature)(requestLike, {
|
|
106
109
|
capability: options.capability,
|
|
107
110
|
jwks: options.jwks,
|
|
@@ -36,6 +36,8 @@ import {
|
|
|
36
36
|
tagAuthenticatorPresenceGated
|
|
37
37
|
} from "./auth.mjs";
|
|
38
38
|
function verifySignatureAsAuthenticator(options) {
|
|
39
|
+
if (!options.jwks && !options.webBotAuth)
|
|
40
|
+
throw new TypeError("verifySignatureAsAuthenticator requires jwks or webBotAuth");
|
|
39
41
|
const replayStore = options.replayStore ?? new InMemoryReplayStore();
|
|
40
42
|
const legacyOriginGate = options.assertLegacyOriginAllowed ?? getWebBotAuthLegacyOriginGate(options.webBotAuth?.resolvePrincipal);
|
|
41
43
|
if (options.webBotAuth && !legacyOriginGate)
|
|
@@ -102,6 +104,7 @@ function verifySignatureAsAuthenticator(options) {
|
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
106
|
}
|
|
107
|
+
if (!options.jwks) throw new WebBotAuthError(403, "profile_disabled");
|
|
105
108
|
result = await verifyRequestSignature(requestLike, {
|
|
106
109
|
capability: options.capability,
|
|
107
110
|
jwks: options.jwks,
|
|
@@ -946,8 +946,8 @@ export interface AdcpCapabilitiesOverrides {
|
|
|
946
946
|
export interface SignedRequestsConfig {
|
|
947
947
|
webBotAuth?: import('./auth-signature.mjs').VerifySignatureAsAuthenticatorOptions['webBotAuth'];
|
|
948
948
|
assertLegacyOriginAllowed?: (agentUrl: string) => Promise<void>;
|
|
949
|
-
/** Resolves
|
|
950
|
-
jwks
|
|
949
|
+
/** Resolves legacy RFC 9421 keys. May be omitted for a Web Bot Auth-only endpoint. */
|
|
950
|
+
jwks?: JwksResolver;
|
|
951
951
|
/** Stores `(keyid, signature-bytes, expires)` tuples for replay detection. */
|
|
952
952
|
replayStore: ReplayStore;
|
|
953
953
|
/** Consulted for revoked `kid` / `jti` before accepting a signature. */
|
|
@@ -946,8 +946,8 @@ export interface AdcpCapabilitiesOverrides {
|
|
|
946
946
|
export interface SignedRequestsConfig {
|
|
947
947
|
webBotAuth?: import('./auth-signature').VerifySignatureAsAuthenticatorOptions['webBotAuth'];
|
|
948
948
|
assertLegacyOriginAllowed?: (agentUrl: string) => Promise<void>;
|
|
949
|
-
/** Resolves
|
|
950
|
-
jwks
|
|
949
|
+
/** Resolves legacy RFC 9421 keys. May be omitted for a Web Bot Auth-only endpoint. */
|
|
950
|
+
jwks?: JwksResolver;
|
|
951
951
|
/** Stores `(keyid, signature-bytes, expires)` tuples for replay detection. */
|
|
952
952
|
replayStore: ReplayStore;
|
|
953
953
|
/** Consulted for revoked `kid` / `jti` before accepting a signature. */
|
|
@@ -30,6 +30,7 @@ __export(create_adcp_server_exports, {
|
|
|
30
30
|
requireSessionKey: () => requireSessionKey
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(create_adcp_server_exports);
|
|
33
|
+
var import_adcp_version_config = require('../utils/adcp-version-config.js');
|
|
33
34
|
var import_web_bot_auth = require('../signing/web-bot-auth.js');
|
|
34
35
|
var import_version = require('../adapters/version/index.js');
|
|
35
36
|
var import_schema_loader = require('../validation/schema-loader.js');
|
|
@@ -40,7 +41,7 @@ var import_validation = require('../identity-3.3/validation.js');
|
|
|
40
41
|
var import_trust = require('../identity-3.3/trust.js');
|
|
41
42
|
var import_zod = require("zod");
|
|
42
43
|
var import_version2 = require('../version.js');
|
|
43
|
-
var
|
|
44
|
+
var import_adcp_version_config2 = require('../utils/adcp-version-config.js');
|
|
44
45
|
var import_errors = require('../errors/index.js');
|
|
45
46
|
var import_schema_loader2 = require('../validation/schema-loader.js');
|
|
46
47
|
var import_schemas = require('../schemas/index.js');
|
|
@@ -80,6 +81,7 @@ var import_middleware = require('../signing/middleware.js');
|
|
|
80
81
|
var import_operation_resolution = require('../signing/operation-resolution.js');
|
|
81
82
|
var import_account_mode = require('./account-mode.js');
|
|
82
83
|
var import_test_controller_bridge = require('./test-controller-bridge.js');
|
|
84
|
+
var import_signed_request_transport = require('./signed-request-transport.js');
|
|
83
85
|
var import_version3 = require('../version.js');
|
|
84
86
|
var import_schemas2 = require('../types/schemas.generated.js');
|
|
85
87
|
var import_error_codes = require('../types/error-codes.js');
|
|
@@ -962,8 +964,7 @@ function projectValueToCapabilitySchema(root, schema, value, depth = 0) {
|
|
|
962
964
|
return projectedObject;
|
|
963
965
|
}
|
|
964
966
|
function projectCapabilitiesToVersion(data, version) {
|
|
965
|
-
const
|
|
966
|
-
const schema = asProjectionSchema(validator?.schema);
|
|
967
|
+
const schema = asProjectionSchema((0, import_schema_loader2.getToolSchemaDocument)("get_adcp_capabilities", "sync", version)?.schema);
|
|
967
968
|
if (!schema) return data;
|
|
968
969
|
const projected = projectValueToCapabilitySchema(schema, schema, data);
|
|
969
970
|
if (!isPlainObject(projected)) return data;
|
|
@@ -1392,7 +1393,9 @@ function injectContextIntoResponse(response, context) {
|
|
|
1392
1393
|
syncContentJsonText(response, sc, mirrorsStructuredContent);
|
|
1393
1394
|
}
|
|
1394
1395
|
}
|
|
1395
|
-
function injectEnvelopeStatusIntoResponse(response, toolName) {
|
|
1396
|
+
function injectEnvelopeStatusIntoResponse(response, toolName, servedVersion) {
|
|
1397
|
+
if (servedVersion && (0, import_adcp_version_config.isPre31AdcpVersion)(servedVersion) && MEDIA_BUY_RESPONSE_TOOLS_REQUIRING_STATUS_SPLIT.has(toolName) && response.isError !== true)
|
|
1398
|
+
return;
|
|
1396
1399
|
const sc = response.structuredContent;
|
|
1397
1400
|
if (!sc || typeof sc !== "object") return;
|
|
1398
1401
|
if ("status" in sc) return;
|
|
@@ -1416,12 +1419,23 @@ const MEDIA_BUY_STATUS_VALUES = /* @__PURE__ */ new Set([
|
|
|
1416
1419
|
"rejected",
|
|
1417
1420
|
"canceled"
|
|
1418
1421
|
]);
|
|
1419
|
-
function normalizeMediaBuyStatusCollision(response, toolName) {
|
|
1422
|
+
function normalizeMediaBuyStatusCollision(response, toolName, servedVersion) {
|
|
1420
1423
|
if (!MEDIA_BUY_RESPONSE_TOOLS_REQUIRING_STATUS_SPLIT.has(toolName)) return;
|
|
1421
1424
|
const sc = response.structuredContent;
|
|
1422
1425
|
if (!sc || typeof sc !== "object") return;
|
|
1426
|
+
if (servedVersion && (0, import_adcp_version_config.isPre31AdcpVersion)(servedVersion)) {
|
|
1427
|
+
const adapted = typeof sc.media_buy_status === "string" ? (0, import_version.getVersionAdapter)("3.0", toolName)?.downgradeResponse?.(sc) : void 0;
|
|
1428
|
+
if (adapted && adapted.data !== sc && adapted.data && typeof adapted.data === "object") {
|
|
1429
|
+
const mirrors = contentTextMirrorsStructuredContent(response, sc);
|
|
1430
|
+
response.structuredContent = adapted.data;
|
|
1431
|
+
syncContentJsonText(response, response.structuredContent, mirrors);
|
|
1432
|
+
}
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1423
1435
|
const status = sc.status;
|
|
1424
1436
|
if (typeof status !== "string" || !MEDIA_BUY_STATUS_VALUES.has(status)) return;
|
|
1437
|
+
if (servedVersion && sc.media_buy_status === void 0 && (status === "completed" || status === "rejected" || status === "canceled"))
|
|
1438
|
+
return;
|
|
1425
1439
|
const looksLikeMediaBuyPayload = typeof sc.media_buy_id === "string" || "media_buy_status" in sc || Array.isArray(sc.packages);
|
|
1426
1440
|
if (!looksLikeMediaBuyPayload) return;
|
|
1427
1441
|
const mirrorsStructuredContent = contentTextMirrorsStructuredContent(response, sc);
|
|
@@ -1453,6 +1467,8 @@ function resolveEffectiveSignedRequestPolicy(signedRequests, capabilityRequestSi
|
|
|
1453
1467
|
};
|
|
1454
1468
|
}
|
|
1455
1469
|
function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning, adcpVersion) {
|
|
1470
|
+
if (!signedRequests.jwks && !signedRequests.webBotAuth)
|
|
1471
|
+
throw new TypeError("signedRequests requires jwks or webBotAuth");
|
|
1456
1472
|
const legacyOriginGate = signedRequests.assertLegacyOriginAllowed ?? (0, import_web_bot_auth.getWebBotAuthLegacyOriginGate)(signedRequests.webBotAuth?.resolvePrincipal);
|
|
1457
1473
|
if (signedRequests.webBotAuth && !legacyOriginGate)
|
|
1458
1474
|
throw new Error(
|
|
@@ -1472,7 +1488,7 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1472
1488
|
required_for: requiredFor,
|
|
1473
1489
|
...effectiveRequestSigning.protocol_methods_required_for ? { protocol_methods_required_for: effectiveRequestSigning.protocol_methods_required_for } : {}
|
|
1474
1490
|
},
|
|
1475
|
-
jwks: signedRequests.jwks,
|
|
1491
|
+
jwks: signedRequests.jwks ?? { resolve: async () => null },
|
|
1476
1492
|
replayStore: signedRequests.replayStore,
|
|
1477
1493
|
revocationStore: signedRequests.revocationStore,
|
|
1478
1494
|
adcpVersion,
|
|
@@ -1545,6 +1561,12 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1545
1561
|
return true;
|
|
1546
1562
|
}
|
|
1547
1563
|
}
|
|
1564
|
+
if (!signedRequests.jwks && (req.headers["signature"] !== void 0 || req.headers["signature-input"] !== void 0)) {
|
|
1565
|
+
const refused = new import_web_bot_auth2.WebBotAuthError(403, "profile_disabled");
|
|
1566
|
+
res.writeHead(refused.status, { ...refused.headers, "Content-Type": "application/json" });
|
|
1567
|
+
res.end(JSON.stringify(refused.body));
|
|
1568
|
+
return true;
|
|
1569
|
+
}
|
|
1548
1570
|
const reqShim = {
|
|
1549
1571
|
method: req.method ?? "POST",
|
|
1550
1572
|
url: req.url ?? "/mcp",
|
|
@@ -1798,7 +1820,7 @@ function supportedVersionsForTool(toolName, ranges, capConfig, serverPin) {
|
|
|
1798
1820
|
}
|
|
1799
1821
|
const PUSH_OPERATION_ID_PATTERN = /^[A-Za-z0-9_.:-]{1,255}$/;
|
|
1800
1822
|
function releaseRequiresPushOperationId(release) {
|
|
1801
|
-
return (0,
|
|
1823
|
+
return (0, import_adcp_version_config2.isAdcpVersionAtLeast)((0, import_schema_loader2.resolveBundleKey)(release), "3.2.0-beta.5");
|
|
1802
1824
|
}
|
|
1803
1825
|
function pushOperationIdError(params, release) {
|
|
1804
1826
|
const config = params.push_notification_config;
|
|
@@ -2082,18 +2104,18 @@ function createAdcpServer(config) {
|
|
|
2082
2104
|
logger.warn(message);
|
|
2083
2105
|
}
|
|
2084
2106
|
const credentialPolicyPatterns = credentialPolicy === void 0 || typeof credentialPolicy === "string" ? void 0 : credentialPolicy.patterns;
|
|
2085
|
-
const adcpVersion = (0,
|
|
2107
|
+
const adcpVersion = (0, import_adcp_version_config2.resolveAdcpVersion)(
|
|
2086
2108
|
configuredAdcpVersion ?? (config.identity33 ? "3.3" : config.proposalNegotiation ? import_version3.ADCP_VERSION : void 0)
|
|
2087
2109
|
);
|
|
2088
2110
|
const toolVersionRanges = parseToolVersionRanges(config.toolVersions);
|
|
2089
2111
|
const toolAvailableForRelease = (toolName, release) => toolIsAvailableInRelease(toolVersionRanges, toolName, release);
|
|
2090
|
-
const movingSupportedVersion = capConfig?.supported_versions?.find(
|
|
2112
|
+
const movingSupportedVersion = capConfig?.supported_versions?.find(import_adcp_version_config2.isMovingAdcpPrereleaseFamilyAlias);
|
|
2091
2113
|
if (movingSupportedVersion) {
|
|
2092
2114
|
throw new Error(
|
|
2093
2115
|
`createAdcpServer: capabilities.supported_versions contains moving prerelease-family alias ${JSON.stringify(movingSupportedVersion)}; pin ${JSON.stringify((0, import_version2.toReleasePrecisionVersion)(import_version3.ADCP_VERSION))} instead`
|
|
2094
2116
|
);
|
|
2095
2117
|
}
|
|
2096
|
-
const configuredDefaultVersion = configuredDefaultAdcpVersion === void 0 ? void 0 : (0,
|
|
2118
|
+
const configuredDefaultVersion = configuredDefaultAdcpVersion === void 0 ? void 0 : (0, import_adcp_version_config2.resolveAdcpVersion)(configuredDefaultAdcpVersion, "defaultAdcpVersion");
|
|
2097
2119
|
const maximumRelease = parseAdcpRelease(adcpVersion);
|
|
2098
2120
|
const requestedDefaultRelease = configuredDefaultVersion === void 0 ? void 0 : parseAdcpRelease(configuredDefaultVersion);
|
|
2099
2121
|
if (maximumRelease === void 0) {
|
|
@@ -2430,8 +2452,8 @@ function createAdcpServer(config) {
|
|
|
2430
2452
|
enrichErrorTwoLayer(response, toolName, (0, import_error_arm_tools.getToolsWithErrorArm)(release.validationVersion));
|
|
2431
2453
|
if (!isErrorResponse(response)) {
|
|
2432
2454
|
response = downgradeTaskStatusResult(toolName, response, release.validationVersion);
|
|
2433
|
-
normalizeMediaBuyStatusCollision(response, toolName);
|
|
2434
|
-
injectEnvelopeStatusIntoResponse(response, toolName);
|
|
2455
|
+
normalizeMediaBuyStatusCollision(response, toolName, release.validationVersion);
|
|
2456
|
+
injectEnvelopeStatusIntoResponse(response, toolName, release.validationVersion);
|
|
2435
2457
|
const validationError = protocolTaskResponseValidationError(toolName, response, params);
|
|
2436
2458
|
if (validationError) return finalizeProtocolTaskToolResponse(toolName, params, validationError, opts);
|
|
2437
2459
|
}
|
|
@@ -2810,8 +2832,8 @@ function createAdcpServer(config) {
|
|
|
2810
2832
|
const finalizeProtocolEnvelope = (response) => {
|
|
2811
2833
|
sanitizeAdcpErrorEnvelope(response);
|
|
2812
2834
|
enrichErrorTwoLayer(response, toolName, requestErrorArms);
|
|
2813
|
-
normalizeMediaBuyStatusCollision(response, toolName);
|
|
2814
|
-
injectEnvelopeStatusIntoResponse(response, toolName);
|
|
2835
|
+
normalizeMediaBuyStatusCollision(response, toolName, requestRelease.validationVersion);
|
|
2836
|
+
injectEnvelopeStatusIntoResponse(response, toolName, requestRelease.validationVersion);
|
|
2815
2837
|
injectContextIntoResponse(response, params.context);
|
|
2816
2838
|
injectVersionIntoResponse(response, requestRelease.wireVersion);
|
|
2817
2839
|
return response;
|
|
@@ -2840,7 +2862,7 @@ function createAdcpServer(config) {
|
|
|
2840
2862
|
const offered = capabilitiesData.webhook_signing?.profiles ?? [
|
|
2841
2863
|
"adcp/webhook-signing/v1"
|
|
2842
2864
|
];
|
|
2843
|
-
if (typeof selectedProfile !== "string" || !offered.includes(selectedProfile) || selectedProfile === "web-bot-auth" && (!config.identity33 || !(0,
|
|
2865
|
+
if (typeof selectedProfile !== "string" || !offered.includes(selectedProfile) || selectedProfile === "web-bot-auth" && (!config.identity33 || !(0, import_adcp_version_config2.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")) || selectedProfile === "web-bot-auth" && registration.authentication !== void 0)
|
|
2844
2866
|
return finalize(
|
|
2845
2867
|
(0, import_errors2.adcpError)("INVALID_REQUEST", {
|
|
2846
2868
|
message: "Unsupported or ambiguous webhook signing profile",
|
|
@@ -3028,7 +3050,7 @@ function createAdcpServer(config) {
|
|
|
3028
3050
|
params,
|
|
3029
3051
|
requestRelease.validationVersion,
|
|
3030
3052
|
proposalRefinementCapabilities,
|
|
3031
|
-
!!config.identity33 && (0,
|
|
3053
|
+
!!config.identity33 && (0, import_adcp_version_config2.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")
|
|
3032
3054
|
);
|
|
3033
3055
|
if (!outcome.valid) {
|
|
3034
3056
|
if ("refinementError" in outcome && outcome.refinementError?.code === "UNSUPPORTED_FEATURE") {
|
|
@@ -3101,7 +3123,7 @@ function createAdcpServer(config) {
|
|
|
3101
3123
|
}
|
|
3102
3124
|
}
|
|
3103
3125
|
let unresolvedAccountPassThrough = false;
|
|
3104
|
-
const requireVerifiedAccountReferences = strictAccountReferences || (0,
|
|
3126
|
+
const requireVerifiedAccountReferences = strictAccountReferences || (0, import_adcp_version_config2.isAdcpVersionAtLeast)(requestRelease.validationVersion, "3.3.0-beta.0");
|
|
3105
3127
|
const suppliedAccountRef = hasAccount && params.account != null && !(requireVerifiedAccountReferences && toolName === "list_accounts");
|
|
3106
3128
|
if (suppliedAccountRef && toolName === "list_accounts") {
|
|
3107
3129
|
(0, import_account_reference_warnings.warnAccountReferenceDeprecation)(
|
|
@@ -4003,8 +4025,8 @@ function createAdcpServer(config) {
|
|
|
4003
4025
|
formatted = normalizeGetProductsCacheScope(formatted, params, ctx.account, ctx.authInfo, exposeErrorDetails) ?? formatted;
|
|
4004
4026
|
}
|
|
4005
4027
|
if (!isErrorResponse(formatted)) {
|
|
4006
|
-
normalizeMediaBuyStatusCollision(formatted, toolName);
|
|
4007
|
-
injectEnvelopeStatusIntoResponse(formatted, toolName);
|
|
4028
|
+
normalizeMediaBuyStatusCollision(formatted, toolName, adcpVersion);
|
|
4029
|
+
injectEnvelopeStatusIntoResponse(formatted, toolName, adcpVersion);
|
|
4008
4030
|
}
|
|
4009
4031
|
}
|
|
4010
4032
|
if (translatesRelease && !isErrorResponse(formatted) && formatted.structuredContent) {
|
|
@@ -4040,7 +4062,7 @@ function createAdcpServer(config) {
|
|
|
4040
4062
|
payload,
|
|
4041
4063
|
requestRelease.validationVersion,
|
|
4042
4064
|
void 0,
|
|
4043
|
-
!!config.identity33 && (0,
|
|
4065
|
+
!!config.identity33 && (0, import_adcp_version_config2.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")
|
|
4044
4066
|
);
|
|
4045
4067
|
if (!outcome.valid) {
|
|
4046
4068
|
logger.warn(
|
|
@@ -4935,7 +4957,7 @@ function createAdcpServer(config) {
|
|
|
4935
4957
|
delete validationPayload.media_buy.proposal_refinement;
|
|
4936
4958
|
delete validationPayload.media_buy.lifecycle_tools;
|
|
4937
4959
|
}
|
|
4938
|
-
const responseOutcome = config.identity33 && (0,
|
|
4960
|
+
const responseOutcome = config.identity33 && (0, import_adcp_version_config2.isAdcpVersionAtLeast)(release.wireVersion, "3.3") ? (0, import_validation.validateIdentity33Payload)(
|
|
4939
4961
|
"get_adcp_capabilities",
|
|
4940
4962
|
"response",
|
|
4941
4963
|
validationPayload,
|
|
@@ -5108,12 +5130,25 @@ function createAdcpServer(config) {
|
|
|
5108
5130
|
(0, import_adcp_server.setMcpAppResources)(wrapped, mcpAppResources);
|
|
5109
5131
|
if (signedRequests) {
|
|
5110
5132
|
const preTransport = buildSignedRequestsPreTransport(signedRequests, enforcedRequestSigningPolicy, adcpVersion);
|
|
5133
|
+
const transportPermitted = (0, import_signed_request_transport.registerSignedRequestTransportGuard)(wrapped, preTransport);
|
|
5134
|
+
let preTransportConsumed = false;
|
|
5111
5135
|
Object.defineProperty(wrapped, ADCP_PRE_TRANSPORT, {
|
|
5112
|
-
|
|
5136
|
+
get() {
|
|
5137
|
+
preTransportConsumed = true;
|
|
5138
|
+
return preTransport;
|
|
5139
|
+
},
|
|
5113
5140
|
enumerable: false,
|
|
5114
|
-
writable: false,
|
|
5115
5141
|
configurable: true
|
|
5116
5142
|
});
|
|
5143
|
+
const connect = wrapped.connect.bind(wrapped);
|
|
5144
|
+
wrapped.connect = async (transport) => {
|
|
5145
|
+
if (!preTransportConsumed && !transportPermitted(transport)) {
|
|
5146
|
+
throw new Error(
|
|
5147
|
+
"signedRequests verifier is not mounted: direct server.connect(transport) does not run HTTP middleware. Use serve(), createA2AAdapter(), or mount server[ADCP_PRE_TRANSPORT] before handling requests. For custom authentication, compose verifySignatureAsAuthenticator({ webBotAuth }) and capture rawBody."
|
|
5148
|
+
);
|
|
5149
|
+
}
|
|
5150
|
+
return connect(transport);
|
|
5151
|
+
};
|
|
5117
5152
|
}
|
|
5118
5153
|
const signedRequestsState = {
|
|
5119
5154
|
autoWired: Boolean(signedRequests),
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { isPre31AdcpVersion } from "../utils/adcp-version-config.mjs";
|
|
1
2
|
import { assertWebBotAuthSigningKey, getWebBotAuthLegacyOriginGate } from "../signing/web-bot-auth.mjs";
|
|
2
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
downgradeResponse,
|
|
5
|
+
getVersionAdapter,
|
|
6
|
+
translationSteps,
|
|
7
|
+
upgradeRequest
|
|
8
|
+
} from "../adapters/version/index.mjs";
|
|
3
9
|
import {
|
|
4
10
|
isIdentity33SchemaScope,
|
|
5
11
|
withIdentity33SchemaScope,
|
|
@@ -37,7 +43,13 @@ import {
|
|
|
37
43
|
resolveAdcpVersion
|
|
38
44
|
} from "../utils/adcp-version-config.mjs";
|
|
39
45
|
import { ConfigurationError } from "../errors/index.mjs";
|
|
40
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
getValidator,
|
|
48
|
+
getToolSchemaDocument,
|
|
49
|
+
hasSchemaBundle,
|
|
50
|
+
resolveBundleKey,
|
|
51
|
+
getMcpProfileInputSchema
|
|
52
|
+
} from "../validation/schema-loader.mjs";
|
|
41
53
|
import { TOOL_INPUT_SHAPES } from "../schemas/index.mjs";
|
|
42
54
|
import { TaskTypeValues } from "../types/enums.generated.mjs";
|
|
43
55
|
import { bundleSupportsAdcpVersionField } from "../protocols/index.mjs";
|
|
@@ -171,6 +183,7 @@ import {
|
|
|
171
183
|
filterValidSeededRights,
|
|
172
184
|
filterValidSeededSiOffering
|
|
173
185
|
} from "./test-controller-bridge.mjs";
|
|
186
|
+
import { registerSignedRequestTransportGuard } from "./signed-request-transport.mjs";
|
|
174
187
|
import { ADCP_VERSION, LIBRARY_VERSION } from "../version.mjs";
|
|
175
188
|
import { AccountReferenceSchema } from "../types/schemas.generated.mjs";
|
|
176
189
|
import {
|
|
@@ -1053,8 +1066,7 @@ function projectValueToCapabilitySchema(root, schema, value, depth = 0) {
|
|
|
1053
1066
|
return projectedObject;
|
|
1054
1067
|
}
|
|
1055
1068
|
function projectCapabilitiesToVersion(data, version) {
|
|
1056
|
-
const
|
|
1057
|
-
const schema = asProjectionSchema(validator?.schema);
|
|
1069
|
+
const schema = asProjectionSchema(getToolSchemaDocument("get_adcp_capabilities", "sync", version)?.schema);
|
|
1058
1070
|
if (!schema) return data;
|
|
1059
1071
|
const projected = projectValueToCapabilitySchema(schema, schema, data);
|
|
1060
1072
|
if (!isPlainObject(projected)) return data;
|
|
@@ -1483,7 +1495,9 @@ function injectContextIntoResponse(response, context) {
|
|
|
1483
1495
|
syncContentJsonText(response, sc, mirrorsStructuredContent);
|
|
1484
1496
|
}
|
|
1485
1497
|
}
|
|
1486
|
-
function injectEnvelopeStatusIntoResponse(response, toolName) {
|
|
1498
|
+
function injectEnvelopeStatusIntoResponse(response, toolName, servedVersion) {
|
|
1499
|
+
if (servedVersion && isPre31AdcpVersion(servedVersion) && MEDIA_BUY_RESPONSE_TOOLS_REQUIRING_STATUS_SPLIT.has(toolName) && response.isError !== true)
|
|
1500
|
+
return;
|
|
1487
1501
|
const sc = response.structuredContent;
|
|
1488
1502
|
if (!sc || typeof sc !== "object") return;
|
|
1489
1503
|
if ("status" in sc) return;
|
|
@@ -1507,12 +1521,23 @@ const MEDIA_BUY_STATUS_VALUES = /* @__PURE__ */ new Set([
|
|
|
1507
1521
|
"rejected",
|
|
1508
1522
|
"canceled"
|
|
1509
1523
|
]);
|
|
1510
|
-
function normalizeMediaBuyStatusCollision(response, toolName) {
|
|
1524
|
+
function normalizeMediaBuyStatusCollision(response, toolName, servedVersion) {
|
|
1511
1525
|
if (!MEDIA_BUY_RESPONSE_TOOLS_REQUIRING_STATUS_SPLIT.has(toolName)) return;
|
|
1512
1526
|
const sc = response.structuredContent;
|
|
1513
1527
|
if (!sc || typeof sc !== "object") return;
|
|
1528
|
+
if (servedVersion && isPre31AdcpVersion(servedVersion)) {
|
|
1529
|
+
const adapted = typeof sc.media_buy_status === "string" ? getVersionAdapter("3.0", toolName)?.downgradeResponse?.(sc) : void 0;
|
|
1530
|
+
if (adapted && adapted.data !== sc && adapted.data && typeof adapted.data === "object") {
|
|
1531
|
+
const mirrors = contentTextMirrorsStructuredContent(response, sc);
|
|
1532
|
+
response.structuredContent = adapted.data;
|
|
1533
|
+
syncContentJsonText(response, response.structuredContent, mirrors);
|
|
1534
|
+
}
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1514
1537
|
const status = sc.status;
|
|
1515
1538
|
if (typeof status !== "string" || !MEDIA_BUY_STATUS_VALUES.has(status)) return;
|
|
1539
|
+
if (servedVersion && sc.media_buy_status === void 0 && (status === "completed" || status === "rejected" || status === "canceled"))
|
|
1540
|
+
return;
|
|
1516
1541
|
const looksLikeMediaBuyPayload = typeof sc.media_buy_id === "string" || "media_buy_status" in sc || Array.isArray(sc.packages);
|
|
1517
1542
|
if (!looksLikeMediaBuyPayload) return;
|
|
1518
1543
|
const mirrorsStructuredContent = contentTextMirrorsStructuredContent(response, sc);
|
|
@@ -1544,6 +1569,8 @@ function resolveEffectiveSignedRequestPolicy(signedRequests, capabilityRequestSi
|
|
|
1544
1569
|
};
|
|
1545
1570
|
}
|
|
1546
1571
|
function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning, adcpVersion) {
|
|
1572
|
+
if (!signedRequests.jwks && !signedRequests.webBotAuth)
|
|
1573
|
+
throw new TypeError("signedRequests requires jwks or webBotAuth");
|
|
1547
1574
|
const legacyOriginGate = signedRequests.assertLegacyOriginAllowed ?? getWebBotAuthLegacyOriginGate(signedRequests.webBotAuth?.resolvePrincipal);
|
|
1548
1575
|
if (signedRequests.webBotAuth && !legacyOriginGate)
|
|
1549
1576
|
throw new Error(
|
|
@@ -1563,7 +1590,7 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1563
1590
|
required_for: requiredFor,
|
|
1564
1591
|
...effectiveRequestSigning.protocol_methods_required_for ? { protocol_methods_required_for: effectiveRequestSigning.protocol_methods_required_for } : {}
|
|
1565
1592
|
},
|
|
1566
|
-
jwks: signedRequests.jwks,
|
|
1593
|
+
jwks: signedRequests.jwks ?? { resolve: async () => null },
|
|
1567
1594
|
replayStore: signedRequests.replayStore,
|
|
1568
1595
|
revocationStore: signedRequests.revocationStore,
|
|
1569
1596
|
adcpVersion,
|
|
@@ -1636,6 +1663,12 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1636
1663
|
return true;
|
|
1637
1664
|
}
|
|
1638
1665
|
}
|
|
1666
|
+
if (!signedRequests.jwks && (req.headers["signature"] !== void 0 || req.headers["signature-input"] !== void 0)) {
|
|
1667
|
+
const refused = new WebBotAuthError(403, "profile_disabled");
|
|
1668
|
+
res.writeHead(refused.status, { ...refused.headers, "Content-Type": "application/json" });
|
|
1669
|
+
res.end(JSON.stringify(refused.body));
|
|
1670
|
+
return true;
|
|
1671
|
+
}
|
|
1639
1672
|
const reqShim = {
|
|
1640
1673
|
method: req.method ?? "POST",
|
|
1641
1674
|
url: req.url ?? "/mcp",
|
|
@@ -2521,8 +2554,8 @@ function createAdcpServer(config) {
|
|
|
2521
2554
|
enrichErrorTwoLayer(response, toolName, getToolsWithErrorArm(release.validationVersion));
|
|
2522
2555
|
if (!isErrorResponse(response)) {
|
|
2523
2556
|
response = downgradeTaskStatusResult(toolName, response, release.validationVersion);
|
|
2524
|
-
normalizeMediaBuyStatusCollision(response, toolName);
|
|
2525
|
-
injectEnvelopeStatusIntoResponse(response, toolName);
|
|
2557
|
+
normalizeMediaBuyStatusCollision(response, toolName, release.validationVersion);
|
|
2558
|
+
injectEnvelopeStatusIntoResponse(response, toolName, release.validationVersion);
|
|
2526
2559
|
const validationError = protocolTaskResponseValidationError(toolName, response, params);
|
|
2527
2560
|
if (validationError) return finalizeProtocolTaskToolResponse(toolName, params, validationError, opts);
|
|
2528
2561
|
}
|
|
@@ -2901,8 +2934,8 @@ function createAdcpServer(config) {
|
|
|
2901
2934
|
const finalizeProtocolEnvelope = (response) => {
|
|
2902
2935
|
sanitizeAdcpErrorEnvelope(response);
|
|
2903
2936
|
enrichErrorTwoLayer(response, toolName, requestErrorArms);
|
|
2904
|
-
normalizeMediaBuyStatusCollision(response, toolName);
|
|
2905
|
-
injectEnvelopeStatusIntoResponse(response, toolName);
|
|
2937
|
+
normalizeMediaBuyStatusCollision(response, toolName, requestRelease.validationVersion);
|
|
2938
|
+
injectEnvelopeStatusIntoResponse(response, toolName, requestRelease.validationVersion);
|
|
2906
2939
|
injectContextIntoResponse(response, params.context);
|
|
2907
2940
|
injectVersionIntoResponse(response, requestRelease.wireVersion);
|
|
2908
2941
|
return response;
|
|
@@ -4094,8 +4127,8 @@ function createAdcpServer(config) {
|
|
|
4094
4127
|
formatted = normalizeGetProductsCacheScope(formatted, params, ctx.account, ctx.authInfo, exposeErrorDetails) ?? formatted;
|
|
4095
4128
|
}
|
|
4096
4129
|
if (!isErrorResponse(formatted)) {
|
|
4097
|
-
normalizeMediaBuyStatusCollision(formatted, toolName);
|
|
4098
|
-
injectEnvelopeStatusIntoResponse(formatted, toolName);
|
|
4130
|
+
normalizeMediaBuyStatusCollision(formatted, toolName, adcpVersion);
|
|
4131
|
+
injectEnvelopeStatusIntoResponse(formatted, toolName, adcpVersion);
|
|
4099
4132
|
}
|
|
4100
4133
|
}
|
|
4101
4134
|
if (translatesRelease && !isErrorResponse(formatted) && formatted.structuredContent) {
|
|
@@ -5199,12 +5232,25 @@ function createAdcpServer(config) {
|
|
|
5199
5232
|
setMcpAppResources(wrapped, mcpAppResources);
|
|
5200
5233
|
if (signedRequests) {
|
|
5201
5234
|
const preTransport = buildSignedRequestsPreTransport(signedRequests, enforcedRequestSigningPolicy, adcpVersion);
|
|
5235
|
+
const transportPermitted = registerSignedRequestTransportGuard(wrapped, preTransport);
|
|
5236
|
+
let preTransportConsumed = false;
|
|
5202
5237
|
Object.defineProperty(wrapped, ADCP_PRE_TRANSPORT, {
|
|
5203
|
-
|
|
5238
|
+
get() {
|
|
5239
|
+
preTransportConsumed = true;
|
|
5240
|
+
return preTransport;
|
|
5241
|
+
},
|
|
5204
5242
|
enumerable: false,
|
|
5205
|
-
writable: false,
|
|
5206
5243
|
configurable: true
|
|
5207
5244
|
});
|
|
5245
|
+
const connect = wrapped.connect.bind(wrapped);
|
|
5246
|
+
wrapped.connect = async (transport) => {
|
|
5247
|
+
if (!preTransportConsumed && !transportPermitted(transport)) {
|
|
5248
|
+
throw new Error(
|
|
5249
|
+
"signedRequests verifier is not mounted: direct server.connect(transport) does not run HTTP middleware. Use serve(), createA2AAdapter(), or mount server[ADCP_PRE_TRANSPORT] before handling requests. For custom authentication, compose verifySignatureAsAuthenticator({ webBotAuth }) and capture rawBody."
|
|
5250
|
+
);
|
|
5251
|
+
}
|
|
5252
|
+
return connect(transport);
|
|
5253
|
+
};
|
|
5208
5254
|
}
|
|
5209
5255
|
const signedRequestsState = {
|
|
5210
5256
|
autoWired: Boolean(signedRequests),
|