@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
|
@@ -36,7 +36,7 @@ function recordFor(records, ref) {
|
|
|
36
36
|
return "account_id" in ref ? records.find((row) => row.account.id === ref.account_id) : records.find((row) => row.key === (0, import_account_key.accountReferenceKey)(ref));
|
|
37
37
|
}
|
|
38
38
|
function resultRow(account, action) {
|
|
39
|
-
const wire = (0, import_account.toWireAccount)(account);
|
|
39
|
+
const { destination_billing_entity: _destination, ...wire } = (0, import_account.toWireAccount)(account);
|
|
40
40
|
return { ...wire, brand: account.brand, operator: account.operator, action };
|
|
41
41
|
}
|
|
42
42
|
function createKeyedAccountStore(options) {
|
|
@@ -13,7 +13,7 @@ function recordFor(records, ref) {
|
|
|
13
13
|
return "account_id" in ref ? records.find((row) => row.account.id === ref.account_id) : records.find((row) => row.key === accountReferenceKey(ref));
|
|
14
14
|
}
|
|
15
15
|
function resultRow(account, action) {
|
|
16
|
-
const wire = toWireAccount(account);
|
|
16
|
+
const { destination_billing_entity: _destination, ...wire } = toWireAccount(account);
|
|
17
17
|
return { ...wire, brand: account.brand, operator: account.operator, action };
|
|
18
18
|
}
|
|
19
19
|
function createKeyedAccountStore(options) {
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import type { VersionAdapter } from '../types.mjs';
|
|
1
|
+
import type { VersionAdapter, VersionDrift } from '../types.mjs';
|
|
2
2
|
export declare const createMediaBuyAdapter: VersionAdapter;
|
|
3
3
|
export declare const getProductsAdapter: VersionAdapter;
|
|
4
|
+
/** Convert only creative asset positions, never opaque ext/provenance objects. */
|
|
5
|
+
export declare function downgradeCreativeTrackers(params: unknown): {
|
|
6
|
+
params: unknown;
|
|
7
|
+
drift?: VersionDrift;
|
|
8
|
+
};
|
|
9
|
+
export declare const updateMediaBuyAdapter: VersionAdapter;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import type { VersionAdapter } from '../types';
|
|
1
|
+
import type { VersionAdapter, VersionDrift } from '../types';
|
|
2
2
|
export declare const createMediaBuyAdapter: VersionAdapter;
|
|
3
3
|
export declare const getProductsAdapter: VersionAdapter;
|
|
4
|
+
/** Convert only creative asset positions, never opaque ext/provenance objects. */
|
|
5
|
+
export declare function downgradeCreativeTrackers(params: unknown): {
|
|
6
|
+
params: unknown;
|
|
7
|
+
drift?: VersionDrift;
|
|
8
|
+
};
|
|
9
|
+
export declare const updateMediaBuyAdapter: VersionAdapter;
|
|
@@ -19,9 +19,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var brand_fields_exports = {};
|
|
20
20
|
__export(brand_fields_exports, {
|
|
21
21
|
createMediaBuyAdapter: () => createMediaBuyAdapter,
|
|
22
|
-
|
|
22
|
+
downgradeCreativeTrackers: () => downgradeCreativeTrackers,
|
|
23
|
+
getProductsAdapter: () => getProductsAdapter,
|
|
24
|
+
updateMediaBuyAdapter: () => updateMediaBuyAdapter
|
|
23
25
|
});
|
|
24
26
|
module.exports = __toCommonJS(brand_fields_exports);
|
|
27
|
+
var import_creative_delivery = require('../../../v2/projection/creative-delivery.js');
|
|
28
|
+
var import_legacy_metadata = require('../../../v2/projection/legacy-metadata.js');
|
|
25
29
|
var import_adcp_version_config = require('../../../utils/adcp-version-config.js');
|
|
26
30
|
const BRAND_DRIFT = {
|
|
27
31
|
type: "pre31_brand_fields_stripped",
|
|
@@ -36,16 +40,148 @@ function stripTopLevelBrand(params) {
|
|
|
36
40
|
if (stripped === req.brand) return { params };
|
|
37
41
|
return { params: { ...req, brand: stripped }, drift: BRAND_DRIFT };
|
|
38
42
|
}
|
|
43
|
+
function downgradeMediaBuyStatus(data) {
|
|
44
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return { data };
|
|
45
|
+
const response = data;
|
|
46
|
+
if (typeof response.media_buy_status !== "string") {
|
|
47
|
+
if (response.status !== "completed") return { data };
|
|
48
|
+
const { status: _taskStatus, ...rest2 } = response;
|
|
49
|
+
return {
|
|
50
|
+
data: rest2,
|
|
51
|
+
drift: {
|
|
52
|
+
type: "pre31_task_status_stripped",
|
|
53
|
+
message: "Task completion omitted: AdCP 3.0 status describes the media-buy lifecycle.",
|
|
54
|
+
strippedFields: ["status"]
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (response.status !== void 0 && response.status !== "completed") return { data };
|
|
59
|
+
const { media_buy_status, ...rest } = response;
|
|
60
|
+
return {
|
|
61
|
+
data: { ...rest, status: media_buy_status },
|
|
62
|
+
drift: {
|
|
63
|
+
type: "pre31_media_buy_status_moved",
|
|
64
|
+
message: "Media-buy lifecycle moved from media_buy_status to the AdCP 3.0 status field.",
|
|
65
|
+
movedFields: [{ from: "media_buy_status", to: "status" }]
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
39
69
|
const createMediaBuyAdapter = {
|
|
40
70
|
toolName: "create_media_buy",
|
|
41
|
-
|
|
71
|
+
downgradeResponse: downgradeMediaBuyStatus,
|
|
72
|
+
adaptUnnegotiatedRequest: stripTopLevelBrand,
|
|
73
|
+
adaptRequest(params) {
|
|
74
|
+
const brand = stripTopLevelBrand(params);
|
|
75
|
+
const trackers = downgradeCreativeTrackers(brand.params);
|
|
76
|
+
if (!brand.drift) return trackers;
|
|
77
|
+
if (!trackers.drift) return { params: trackers.params, drift: brand.drift };
|
|
78
|
+
return {
|
|
79
|
+
params: trackers.params,
|
|
80
|
+
drift: {
|
|
81
|
+
type: brand.drift.type,
|
|
82
|
+
message: `${brand.drift.message} ${trackers.drift.message}`,
|
|
83
|
+
strippedFields: [...brand.drift.strippedFields ?? [], ...trackers.drift.strippedFields ?? []],
|
|
84
|
+
constituentTypes: [brand.drift.type, trackers.drift.type]
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
42
88
|
};
|
|
43
89
|
const getProductsAdapter = {
|
|
44
90
|
toolName: "get_products",
|
|
45
91
|
adaptRequest: stripTopLevelBrand
|
|
46
92
|
};
|
|
93
|
+
function record(value) {
|
|
94
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
95
|
+
}
|
|
96
|
+
function downgradeCreativeTrackers(params) {
|
|
97
|
+
const request = record(params);
|
|
98
|
+
if (!request) return { params };
|
|
99
|
+
const losses = [];
|
|
100
|
+
const convertCreatives = (items, path) => {
|
|
101
|
+
if (!Array.isArray(items)) return items;
|
|
102
|
+
let changed = false;
|
|
103
|
+
const converted = items.map((item, index) => {
|
|
104
|
+
const creative = record(item);
|
|
105
|
+
const assets = record(creative?.assets);
|
|
106
|
+
if (!creative || !assets) return item;
|
|
107
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
108
|
+
for (const [key, value] of Object.entries(assets)) {
|
|
109
|
+
const pixels = Array.isArray(value) ? value : [value];
|
|
110
|
+
if (pixels.length === 0) continue;
|
|
111
|
+
const trackers = pixels.map(import_legacy_metadata.downgradePixelTracker);
|
|
112
|
+
if (trackers.some((tracker) => tracker === void 0)) continue;
|
|
113
|
+
const groups = /* @__PURE__ */ new Map();
|
|
114
|
+
for (const tracker of trackers) {
|
|
115
|
+
const group = groups.get(tracker.assetId) ?? [];
|
|
116
|
+
group.push(tracker.asset);
|
|
117
|
+
groups.set(tracker.assetId, group);
|
|
118
|
+
}
|
|
119
|
+
for (const [target, group] of groups) {
|
|
120
|
+
if (Object.hasOwn(assets, target) && target !== key || replacements.has(target)) {
|
|
121
|
+
throw new import_creative_delivery.CreativeFormatProjectionError(
|
|
122
|
+
"creative_delivery",
|
|
123
|
+
typeof creative.creative_id === "string" ? creative.creative_id : "(unknown)",
|
|
124
|
+
`multiple assets would occupy the legacy tracker slot ${target}`
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
replacements.set(target, { source: key, asset: Array.isArray(value) ? group : group[0] });
|
|
128
|
+
}
|
|
129
|
+
trackers.forEach((tracker, trackerIndex) => {
|
|
130
|
+
const field = `${path}[${index}].assets.${key}${Array.isArray(value) ? `[${trackerIndex}]` : ""}`;
|
|
131
|
+
const drift = (0, import_legacy_metadata.pixelTrackerDrift)(field, tracker);
|
|
132
|
+
if (drift) losses.push(drift);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
if (replacements.size === 0) return item;
|
|
136
|
+
changed = true;
|
|
137
|
+
const sources = new Set([...replacements.values()].map((entry) => entry.source));
|
|
138
|
+
return {
|
|
139
|
+
...creative,
|
|
140
|
+
assets: {
|
|
141
|
+
...Object.fromEntries(Object.entries(assets).filter(([key]) => !sources.has(key))),
|
|
142
|
+
...Object.fromEntries([...replacements].map(([target, entry]) => [target, entry.asset]))
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
return changed ? converted : items;
|
|
147
|
+
};
|
|
148
|
+
let adapted = request;
|
|
149
|
+
const creatives = convertCreatives(request.creatives, "creatives");
|
|
150
|
+
if (creatives !== request.creatives) adapted = { ...adapted, creatives };
|
|
151
|
+
for (const field of ["packages", "new_packages"]) {
|
|
152
|
+
const packages = request[field];
|
|
153
|
+
if (!Array.isArray(packages)) continue;
|
|
154
|
+
let changed = false;
|
|
155
|
+
const converted = packages.map((pkg, index) => {
|
|
156
|
+
const item = record(pkg);
|
|
157
|
+
if (!item) return pkg;
|
|
158
|
+
const creatives2 = convertCreatives(item.creatives, `${field}[${index}].creatives`);
|
|
159
|
+
if (creatives2 === item.creatives) return pkg;
|
|
160
|
+
changed = true;
|
|
161
|
+
return { ...item, creatives: creatives2 };
|
|
162
|
+
});
|
|
163
|
+
if (changed) adapted = { ...adapted, [field]: converted };
|
|
164
|
+
}
|
|
165
|
+
if (losses.length === 0) return { params: adapted };
|
|
166
|
+
return {
|
|
167
|
+
params: adapted,
|
|
168
|
+
drift: {
|
|
169
|
+
type: "PIXEL_TRACKER_LOSSY_DOWNGRADE",
|
|
170
|
+
message: losses.map((loss) => loss.message).join(" "),
|
|
171
|
+
strippedFields: losses.flatMap((loss) => loss.strippedFields ?? [])
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
const updateMediaBuyAdapter = {
|
|
176
|
+
toolName: "update_media_buy",
|
|
177
|
+
adaptRequest: downgradeCreativeTrackers,
|
|
178
|
+
adaptUnnegotiatedRequest: (params) => ({ params }),
|
|
179
|
+
downgradeResponse: downgradeMediaBuyStatus
|
|
180
|
+
};
|
|
47
181
|
// Annotate the CommonJS export names for ESM import in node:
|
|
48
182
|
0 && (module.exports = {
|
|
49
183
|
createMediaBuyAdapter,
|
|
50
|
-
|
|
184
|
+
downgradeCreativeTrackers,
|
|
185
|
+
getProductsAdapter,
|
|
186
|
+
updateMediaBuyAdapter
|
|
51
187
|
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CreativeFormatProjectionError } from "../../../v2/projection/creative-delivery.mjs";
|
|
2
|
+
import { downgradePixelTracker, pixelTrackerDrift } from "../../../v2/projection/legacy-metadata.mjs";
|
|
1
3
|
import { omit31BrandFields } from "../../../utils/adcp-version-config.mjs";
|
|
2
4
|
const BRAND_DRIFT = {
|
|
3
5
|
type: "pre31_brand_fields_stripped",
|
|
@@ -12,15 +14,147 @@ function stripTopLevelBrand(params) {
|
|
|
12
14
|
if (stripped === req.brand) return { params };
|
|
13
15
|
return { params: { ...req, brand: stripped }, drift: BRAND_DRIFT };
|
|
14
16
|
}
|
|
17
|
+
function downgradeMediaBuyStatus(data) {
|
|
18
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return { data };
|
|
19
|
+
const response = data;
|
|
20
|
+
if (typeof response.media_buy_status !== "string") {
|
|
21
|
+
if (response.status !== "completed") return { data };
|
|
22
|
+
const { status: _taskStatus, ...rest2 } = response;
|
|
23
|
+
return {
|
|
24
|
+
data: rest2,
|
|
25
|
+
drift: {
|
|
26
|
+
type: "pre31_task_status_stripped",
|
|
27
|
+
message: "Task completion omitted: AdCP 3.0 status describes the media-buy lifecycle.",
|
|
28
|
+
strippedFields: ["status"]
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (response.status !== void 0 && response.status !== "completed") return { data };
|
|
33
|
+
const { media_buy_status, ...rest } = response;
|
|
34
|
+
return {
|
|
35
|
+
data: { ...rest, status: media_buy_status },
|
|
36
|
+
drift: {
|
|
37
|
+
type: "pre31_media_buy_status_moved",
|
|
38
|
+
message: "Media-buy lifecycle moved from media_buy_status to the AdCP 3.0 status field.",
|
|
39
|
+
movedFields: [{ from: "media_buy_status", to: "status" }]
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
15
43
|
const createMediaBuyAdapter = {
|
|
16
44
|
toolName: "create_media_buy",
|
|
17
|
-
|
|
45
|
+
downgradeResponse: downgradeMediaBuyStatus,
|
|
46
|
+
adaptUnnegotiatedRequest: stripTopLevelBrand,
|
|
47
|
+
adaptRequest(params) {
|
|
48
|
+
const brand = stripTopLevelBrand(params);
|
|
49
|
+
const trackers = downgradeCreativeTrackers(brand.params);
|
|
50
|
+
if (!brand.drift) return trackers;
|
|
51
|
+
if (!trackers.drift) return { params: trackers.params, drift: brand.drift };
|
|
52
|
+
return {
|
|
53
|
+
params: trackers.params,
|
|
54
|
+
drift: {
|
|
55
|
+
type: brand.drift.type,
|
|
56
|
+
message: `${brand.drift.message} ${trackers.drift.message}`,
|
|
57
|
+
strippedFields: [...brand.drift.strippedFields ?? [], ...trackers.drift.strippedFields ?? []],
|
|
58
|
+
constituentTypes: [brand.drift.type, trackers.drift.type]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
18
62
|
};
|
|
19
63
|
const getProductsAdapter = {
|
|
20
64
|
toolName: "get_products",
|
|
21
65
|
adaptRequest: stripTopLevelBrand
|
|
22
66
|
};
|
|
67
|
+
function record(value) {
|
|
68
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
69
|
+
}
|
|
70
|
+
function downgradeCreativeTrackers(params) {
|
|
71
|
+
const request = record(params);
|
|
72
|
+
if (!request) return { params };
|
|
73
|
+
const losses = [];
|
|
74
|
+
const convertCreatives = (items, path) => {
|
|
75
|
+
if (!Array.isArray(items)) return items;
|
|
76
|
+
let changed = false;
|
|
77
|
+
const converted = items.map((item, index) => {
|
|
78
|
+
const creative = record(item);
|
|
79
|
+
const assets = record(creative?.assets);
|
|
80
|
+
if (!creative || !assets) return item;
|
|
81
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
82
|
+
for (const [key, value] of Object.entries(assets)) {
|
|
83
|
+
const pixels = Array.isArray(value) ? value : [value];
|
|
84
|
+
if (pixels.length === 0) continue;
|
|
85
|
+
const trackers = pixels.map(downgradePixelTracker);
|
|
86
|
+
if (trackers.some((tracker) => tracker === void 0)) continue;
|
|
87
|
+
const groups = /* @__PURE__ */ new Map();
|
|
88
|
+
for (const tracker of trackers) {
|
|
89
|
+
const group = groups.get(tracker.assetId) ?? [];
|
|
90
|
+
group.push(tracker.asset);
|
|
91
|
+
groups.set(tracker.assetId, group);
|
|
92
|
+
}
|
|
93
|
+
for (const [target, group] of groups) {
|
|
94
|
+
if (Object.hasOwn(assets, target) && target !== key || replacements.has(target)) {
|
|
95
|
+
throw new CreativeFormatProjectionError(
|
|
96
|
+
"creative_delivery",
|
|
97
|
+
typeof creative.creative_id === "string" ? creative.creative_id : "(unknown)",
|
|
98
|
+
`multiple assets would occupy the legacy tracker slot ${target}`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
replacements.set(target, { source: key, asset: Array.isArray(value) ? group : group[0] });
|
|
102
|
+
}
|
|
103
|
+
trackers.forEach((tracker, trackerIndex) => {
|
|
104
|
+
const field = `${path}[${index}].assets.${key}${Array.isArray(value) ? `[${trackerIndex}]` : ""}`;
|
|
105
|
+
const drift = pixelTrackerDrift(field, tracker);
|
|
106
|
+
if (drift) losses.push(drift);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (replacements.size === 0) return item;
|
|
110
|
+
changed = true;
|
|
111
|
+
const sources = new Set([...replacements.values()].map((entry) => entry.source));
|
|
112
|
+
return {
|
|
113
|
+
...creative,
|
|
114
|
+
assets: {
|
|
115
|
+
...Object.fromEntries(Object.entries(assets).filter(([key]) => !sources.has(key))),
|
|
116
|
+
...Object.fromEntries([...replacements].map(([target, entry]) => [target, entry.asset]))
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
return changed ? converted : items;
|
|
121
|
+
};
|
|
122
|
+
let adapted = request;
|
|
123
|
+
const creatives = convertCreatives(request.creatives, "creatives");
|
|
124
|
+
if (creatives !== request.creatives) adapted = { ...adapted, creatives };
|
|
125
|
+
for (const field of ["packages", "new_packages"]) {
|
|
126
|
+
const packages = request[field];
|
|
127
|
+
if (!Array.isArray(packages)) continue;
|
|
128
|
+
let changed = false;
|
|
129
|
+
const converted = packages.map((pkg, index) => {
|
|
130
|
+
const item = record(pkg);
|
|
131
|
+
if (!item) return pkg;
|
|
132
|
+
const creatives2 = convertCreatives(item.creatives, `${field}[${index}].creatives`);
|
|
133
|
+
if (creatives2 === item.creatives) return pkg;
|
|
134
|
+
changed = true;
|
|
135
|
+
return { ...item, creatives: creatives2 };
|
|
136
|
+
});
|
|
137
|
+
if (changed) adapted = { ...adapted, [field]: converted };
|
|
138
|
+
}
|
|
139
|
+
if (losses.length === 0) return { params: adapted };
|
|
140
|
+
return {
|
|
141
|
+
params: adapted,
|
|
142
|
+
drift: {
|
|
143
|
+
type: "PIXEL_TRACKER_LOSSY_DOWNGRADE",
|
|
144
|
+
message: losses.map((loss) => loss.message).join(" "),
|
|
145
|
+
strippedFields: losses.flatMap((loss) => loss.strippedFields ?? [])
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const updateMediaBuyAdapter = {
|
|
150
|
+
toolName: "update_media_buy",
|
|
151
|
+
adaptRequest: downgradeCreativeTrackers,
|
|
152
|
+
adaptUnnegotiatedRequest: (params) => ({ params }),
|
|
153
|
+
downgradeResponse: downgradeMediaBuyStatus
|
|
154
|
+
};
|
|
23
155
|
export {
|
|
24
156
|
createMediaBuyAdapter,
|
|
25
|
-
|
|
157
|
+
downgradeCreativeTrackers,
|
|
158
|
+
getProductsAdapter,
|
|
159
|
+
updateMediaBuyAdapter
|
|
26
160
|
};
|
|
@@ -27,6 +27,12 @@ var import_get_signals = require('./get-signals.js');
|
|
|
27
27
|
var import_sync_accounts = require('./sync-accounts.js');
|
|
28
28
|
const v30Adapters = [
|
|
29
29
|
import_brand_fields.createMediaBuyAdapter,
|
|
30
|
+
import_brand_fields.updateMediaBuyAdapter,
|
|
31
|
+
{
|
|
32
|
+
toolName: "sync_creatives",
|
|
33
|
+
adaptRequest: import_brand_fields.downgradeCreativeTrackers,
|
|
34
|
+
adaptUnnegotiatedRequest: (params) => ({ params })
|
|
35
|
+
},
|
|
30
36
|
import_get_products.getProductsAdapter,
|
|
31
37
|
import_get_signals.getSignalsAdapter,
|
|
32
38
|
import_sync_accounts.syncAccountsAdapter
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { createMediaBuyAdapter } from "./brand-fields.mjs";
|
|
1
|
+
import { createMediaBuyAdapter, updateMediaBuyAdapter, downgradeCreativeTrackers } from "./brand-fields.mjs";
|
|
2
2
|
import { getProductsAdapter } from "./get-products.mjs";
|
|
3
3
|
import { getSignalsAdapter } from "./get-signals.mjs";
|
|
4
4
|
import { syncAccountsAdapter } from "./sync-accounts.mjs";
|
|
5
5
|
const v30Adapters = [
|
|
6
6
|
createMediaBuyAdapter,
|
|
7
|
+
updateMediaBuyAdapter,
|
|
8
|
+
{
|
|
9
|
+
toolName: "sync_creatives",
|
|
10
|
+
adaptRequest: downgradeCreativeTrackers,
|
|
11
|
+
adaptUnnegotiatedRequest: (params) => ({ params })
|
|
12
|
+
},
|
|
7
13
|
getProductsAdapter,
|
|
8
14
|
getSignalsAdapter,
|
|
9
15
|
syncAccountsAdapter
|
|
@@ -88,3 +88,12 @@ export declare function downgradeResponse<T>(toolName: string, data: T, options:
|
|
|
88
88
|
data: T;
|
|
89
89
|
drifts: import('./types.mjs').VersionDrift[];
|
|
90
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* Project a seller-owned webhook result with the same per-release conversion
|
|
93
|
+
* as framework responses. Pass the originating request's `ctx.servedAdcpVersion`;
|
|
94
|
+
* when the server uses another source release, pass it as `fromVersion`.
|
|
95
|
+
* Envelope construction, credential stripping and webhook signing remain the
|
|
96
|
+
* emitter's responsibility. The input is never mutated.
|
|
97
|
+
* Use `downgradeResponse` when translation diagnostics are also needed.
|
|
98
|
+
*/
|
|
99
|
+
export declare function projectResponseForRelease<T>(toolName: string, payload: T, servedAdcpVersion: string, fromVersion?: string): T;
|
|
@@ -88,3 +88,12 @@ export declare function downgradeResponse<T>(toolName: string, data: T, options:
|
|
|
88
88
|
data: T;
|
|
89
89
|
drifts: import('./types').VersionDrift[];
|
|
90
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* Project a seller-owned webhook result with the same per-release conversion
|
|
93
|
+
* as framework responses. Pass the originating request's `ctx.servedAdcpVersion`;
|
|
94
|
+
* when the server uses another source release, pass it as `fromVersion`.
|
|
95
|
+
* Envelope construction, credential stripping and webhook signing remain the
|
|
96
|
+
* emitter's responsibility. The input is never mutated.
|
|
97
|
+
* Use `downgradeResponse` when translation diagnostics are also needed.
|
|
98
|
+
*/
|
|
99
|
+
export declare function projectResponseForRelease<T>(toolName: string, payload: T, servedAdcpVersion: string, fromVersion?: string): T;
|
|
@@ -18,16 +18,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var version_exports = {};
|
|
20
20
|
__export(version_exports, {
|
|
21
|
-
adcpMinorLine: () =>
|
|
22
|
-
compareAdcpMinorLines: () =>
|
|
21
|
+
adcpMinorLine: () => import_negotiate2.adcpMinorLine,
|
|
22
|
+
compareAdcpMinorLines: () => import_negotiate2.compareAdcpMinorLines,
|
|
23
23
|
convertRequest: () => convertRequest,
|
|
24
24
|
convertResponse: () => convertResponse,
|
|
25
25
|
downgradeResponse: () => downgradeResponse,
|
|
26
26
|
getVersionAdapter: () => getVersionAdapter,
|
|
27
|
-
isNegotiationFailure: () =>
|
|
27
|
+
isNegotiationFailure: () => import_negotiate2.isNegotiationFailure,
|
|
28
28
|
listVersionAdapterTools: () => listVersionAdapterTools,
|
|
29
|
-
negotiateAdcpRelease: () =>
|
|
30
|
-
parseAdcpRelease: () =>
|
|
29
|
+
negotiateAdcpRelease: () => import_negotiate2.negotiateAdcpRelease,
|
|
30
|
+
parseAdcpRelease: () => import_negotiate2.parseAdcpRelease,
|
|
31
|
+
projectResponseForRelease: () => projectResponseForRelease,
|
|
31
32
|
projectToolPayload: () => import_schema_projection.projectToolPayload,
|
|
32
33
|
releaseDefinesTool: () => import_schema_projection.releaseDefinesTool,
|
|
33
34
|
resolveAdapterKey: () => resolveAdapterKey,
|
|
@@ -36,12 +37,15 @@ __export(version_exports, {
|
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(version_exports);
|
|
38
39
|
var import_adcp_version_config = require('../../utils/adcp-version-config.js');
|
|
40
|
+
var import_version = require('../../version.js');
|
|
41
|
+
var import_negotiate = require('./negotiate.js');
|
|
42
|
+
var import_schema_loader = require('../../validation/schema-loader.js');
|
|
39
43
|
var import_idempotency = require('../../utils/idempotency.js');
|
|
40
44
|
var import__ = require('./3.0/index.js');
|
|
41
45
|
var import__2 = require('./3.1/index.js');
|
|
42
46
|
var import_translate = require('./translate.js');
|
|
43
47
|
var import_translate2 = require('./translate.js');
|
|
44
|
-
var
|
|
48
|
+
var import_negotiate2 = require('./negotiate.js');
|
|
45
49
|
var import_schema_projection = require('./schema-projection.js');
|
|
46
50
|
const REGISTRY = /* @__PURE__ */ new Map();
|
|
47
51
|
function register(version, adapters) {
|
|
@@ -77,6 +81,15 @@ function upgradeRequest(toolName, params, options) {
|
|
|
77
81
|
function downgradeResponse(toolName, data, options) {
|
|
78
82
|
return (0, import_translate.convertResponseToRelease)(toolName, data, { ...options, adapters: getVersionAdapter });
|
|
79
83
|
}
|
|
84
|
+
function projectResponseForRelease(toolName, payload, servedAdcpVersion, fromVersion = import_version.ADCP_VERSION) {
|
|
85
|
+
const source = typeof fromVersion === "string" ? (0, import_negotiate.parseAdcpRelease)(fromVersion) : void 0;
|
|
86
|
+
const target = typeof servedAdcpVersion === "string" ? (0, import_negotiate.parseAdcpRelease)(servedAdcpVersion) : void 0;
|
|
87
|
+
if (!source || !target || source.major !== 3 || target.major !== 3 || target.minor > source.minor || source.minor === target.minor && source.prerelease !== target.prerelease || !(0, import_schema_loader.hasSchemaBundle)(fromVersion) || !(0, import_schema_loader.hasSchemaBundle)(servedAdcpVersion))
|
|
88
|
+
throw new TypeError(
|
|
89
|
+
"projectResponseForRelease requires valid AdCP 3 schema bundles, with the served minor line on or below the source and matching same-line previews"
|
|
90
|
+
);
|
|
91
|
+
return downgradeResponse(toolName, payload, { fromVersion, toVersion: servedAdcpVersion }).data;
|
|
92
|
+
}
|
|
80
93
|
// Annotate the CommonJS export names for ESM import in node:
|
|
81
94
|
0 && (module.exports = {
|
|
82
95
|
adcpMinorLine,
|
|
@@ -89,6 +102,7 @@ function downgradeResponse(toolName, data, options) {
|
|
|
89
102
|
listVersionAdapterTools,
|
|
90
103
|
negotiateAdcpRelease,
|
|
91
104
|
parseAdcpRelease,
|
|
105
|
+
projectResponseForRelease,
|
|
92
106
|
projectToolPayload,
|
|
93
107
|
releaseDefinesTool,
|
|
94
108
|
resolveAdapterKey,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { shouldOmit31Fields } from "../../utils/adcp-version-config.mjs";
|
|
2
|
+
import { ADCP_VERSION } from "../../version.mjs";
|
|
3
|
+
import { parseAdcpRelease } from "./negotiate.mjs";
|
|
4
|
+
import { hasSchemaBundle } from "../../validation/schema-loader.mjs";
|
|
2
5
|
import { isMutatingTask } from "../../utils/idempotency.mjs";
|
|
3
6
|
import { v30Adapters } from "./3.0/index.mjs";
|
|
4
7
|
import { v31Adapters } from "./3.1/index.mjs";
|
|
@@ -12,7 +15,7 @@ import { translationSteps } from "./translate.mjs";
|
|
|
12
15
|
import {
|
|
13
16
|
negotiateAdcpRelease,
|
|
14
17
|
isNegotiationFailure,
|
|
15
|
-
parseAdcpRelease,
|
|
18
|
+
parseAdcpRelease as parseAdcpRelease2,
|
|
16
19
|
adcpMinorLine,
|
|
17
20
|
compareAdcpMinorLines
|
|
18
21
|
} from "./negotiate.mjs";
|
|
@@ -51,6 +54,15 @@ function upgradeRequest(toolName, params, options) {
|
|
|
51
54
|
function downgradeResponse(toolName, data, options) {
|
|
52
55
|
return convertResponseToRelease(toolName, data, { ...options, adapters: getVersionAdapter });
|
|
53
56
|
}
|
|
57
|
+
function projectResponseForRelease(toolName, payload, servedAdcpVersion, fromVersion = ADCP_VERSION) {
|
|
58
|
+
const source = typeof fromVersion === "string" ? parseAdcpRelease(fromVersion) : void 0;
|
|
59
|
+
const target = typeof servedAdcpVersion === "string" ? parseAdcpRelease(servedAdcpVersion) : void 0;
|
|
60
|
+
if (!source || !target || source.major !== 3 || target.major !== 3 || target.minor > source.minor || source.minor === target.minor && source.prerelease !== target.prerelease || !hasSchemaBundle(fromVersion) || !hasSchemaBundle(servedAdcpVersion))
|
|
61
|
+
throw new TypeError(
|
|
62
|
+
"projectResponseForRelease requires valid AdCP 3 schema bundles, with the served minor line on or below the source and matching same-line previews"
|
|
63
|
+
);
|
|
64
|
+
return downgradeResponse(toolName, payload, { fromVersion, toVersion: servedAdcpVersion }).data;
|
|
65
|
+
}
|
|
54
66
|
export {
|
|
55
67
|
adcpMinorLine,
|
|
56
68
|
compareAdcpMinorLines,
|
|
@@ -61,7 +73,8 @@ export {
|
|
|
61
73
|
isNegotiationFailure,
|
|
62
74
|
listVersionAdapterTools,
|
|
63
75
|
negotiateAdcpRelease,
|
|
64
|
-
parseAdcpRelease,
|
|
76
|
+
parseAdcpRelease2 as parseAdcpRelease,
|
|
77
|
+
projectResponseForRelease,
|
|
65
78
|
projectToolPayload,
|
|
66
79
|
releaseDefinesTool,
|
|
67
80
|
resolveAdapterKey,
|
|
@@ -48,6 +48,11 @@ export interface VersionAdapter {
|
|
|
48
48
|
params: unknown;
|
|
49
49
|
drift?: VersionDrift;
|
|
50
50
|
};
|
|
51
|
+
/** Compatibility fallback when no authoritative wire release was negotiated. */
|
|
52
|
+
adaptUnnegotiatedRequest?(params: unknown): {
|
|
53
|
+
params: unknown;
|
|
54
|
+
drift?: VersionDrift;
|
|
55
|
+
};
|
|
51
56
|
/**
|
|
52
57
|
* Adapt a response from this adapter's release up to the next minor
|
|
53
58
|
* release. Returns the original reference when nothing changes.
|
|
@@ -48,6 +48,11 @@ export interface VersionAdapter {
|
|
|
48
48
|
params: unknown;
|
|
49
49
|
drift?: VersionDrift;
|
|
50
50
|
};
|
|
51
|
+
/** Compatibility fallback when no authoritative wire release was negotiated. */
|
|
52
|
+
adaptUnnegotiatedRequest?(params: unknown): {
|
|
53
|
+
params: unknown;
|
|
54
|
+
drift?: VersionDrift;
|
|
55
|
+
};
|
|
51
56
|
/**
|
|
52
57
|
* Adapt a response from this adapter's release up to the next minor
|
|
53
58
|
* release. Returns the original reference when nothing changes.
|
|
@@ -696,6 +696,7 @@ function detectDraft(schema) {
|
|
|
696
696
|
}
|
|
697
697
|
function getDraft07Ajv() {
|
|
698
698
|
const ajv = new import_ajv.default({
|
|
699
|
+
inlineRefs: false,
|
|
699
700
|
strict: false,
|
|
700
701
|
allErrors: true,
|
|
701
702
|
validateSchema: true,
|
|
@@ -707,6 +708,7 @@ function getDraft07Ajv() {
|
|
|
707
708
|
}
|
|
708
709
|
function getDraft2020Ajv() {
|
|
709
710
|
const ajv = new Ajv2020({
|
|
711
|
+
inlineRefs: false,
|
|
710
712
|
strict: false,
|
|
711
713
|
allErrors: true,
|
|
712
714
|
validateSchema: true,
|
|
@@ -669,6 +669,7 @@ function detectDraft(schema) {
|
|
|
669
669
|
}
|
|
670
670
|
function getDraft07Ajv() {
|
|
671
671
|
const ajv = new Ajv({
|
|
672
|
+
inlineRefs: false,
|
|
672
673
|
strict: false,
|
|
673
674
|
allErrors: true,
|
|
674
675
|
validateSchema: true,
|
|
@@ -680,6 +681,7 @@ function getDraft07Ajv() {
|
|
|
680
681
|
}
|
|
681
682
|
function getDraft2020Ajv() {
|
|
682
683
|
const ajv = new Ajv2020({
|
|
684
|
+
inlineRefs: false,
|
|
683
685
|
strict: false,
|
|
684
686
|
allErrors: true,
|
|
685
687
|
validateSchema: true,
|
|
@@ -39,6 +39,8 @@ export interface StreamAccountChangesOptions {
|
|
|
39
39
|
resourceTypes?: readonly string[];
|
|
40
40
|
maxResults?: number;
|
|
41
41
|
taskOptions?: TaskOptions;
|
|
42
|
+
/** Fallback served schema release for custom readers without SDK version metadata. */
|
|
43
|
+
adcpVersion?: string;
|
|
42
44
|
/**
|
|
43
45
|
* Rebuild every authoritative snapshot in scope, including all statuses and
|
|
44
46
|
* pages. A fresh latest cursor is acquired BEFORE this hook. No checkpoint
|
|
@@ -61,4 +63,4 @@ export interface AccountChangeDrainPage extends Omit<AccountChangePage, 'cursor'
|
|
|
61
63
|
* webhook targets never enter continuation requests. Poll again periodically.
|
|
62
64
|
* The adopter owns storage, transaction atomicity and concurrency fencing.
|
|
63
65
|
*/
|
|
64
|
-
export declare function streamAccountChanges(client: Pick<AgentClient, 'listAccountChanges'
|
|
66
|
+
export declare function streamAccountChanges(client: Pick<AgentClient, 'listAccountChanges'> & Partial<Pick<AgentClient, 'getAdcpVersion'>>, options: StreamAccountChangesOptions): AsyncGenerator<AccountChangeDrainPage, void, void>;
|
|
@@ -39,6 +39,8 @@ export interface StreamAccountChangesOptions {
|
|
|
39
39
|
resourceTypes?: readonly string[];
|
|
40
40
|
maxResults?: number;
|
|
41
41
|
taskOptions?: TaskOptions;
|
|
42
|
+
/** Fallback served schema release for custom readers without SDK version metadata. */
|
|
43
|
+
adcpVersion?: string;
|
|
42
44
|
/**
|
|
43
45
|
* Rebuild every authoritative snapshot in scope, including all statuses and
|
|
44
46
|
* pages. A fresh latest cursor is acquired BEFORE this hook. No checkpoint
|
|
@@ -61,4 +63,4 @@ export interface AccountChangeDrainPage extends Omit<AccountChangePage, 'cursor'
|
|
|
61
63
|
* webhook targets never enter continuation requests. Poll again periodically.
|
|
62
64
|
* The adopter owns storage, transaction atomicity and concurrency fencing.
|
|
63
65
|
*/
|
|
64
|
-
export declare function streamAccountChanges(client: Pick<AgentClient, 'listAccountChanges'
|
|
66
|
+
export declare function streamAccountChanges(client: Pick<AgentClient, 'listAccountChanges'> & Partial<Pick<AgentClient, 'getAdcpVersion'>>, options: StreamAccountChangesOptions): AsyncGenerator<AccountChangeDrainPage, void, void>;
|