@adcp/sdk 16.2.0 → 16.4.0
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/AGENTS.md +2 -0
- package/dist/lib/adapters/version/3.1/assignments.d.mts +12 -0
- package/dist/lib/adapters/version/3.1/assignments.d.ts +12 -0
- package/dist/lib/adapters/version/3.1/assignments.js +67 -0
- package/dist/lib/adapters/version/3.1/assignments.mjs +43 -0
- package/dist/lib/adapters/version/3.1/bidding.d.mts +3 -0
- package/dist/lib/adapters/version/3.1/bidding.d.ts +3 -0
- package/dist/lib/adapters/version/3.1/bidding.js +115 -0
- package/dist/lib/adapters/version/3.1/bidding.mjs +90 -0
- package/dist/lib/adapters/version/3.1/delivery.d.mts +7 -0
- package/dist/lib/adapters/version/3.1/delivery.d.ts +7 -0
- package/dist/lib/adapters/version/3.1/delivery.js +78 -0
- package/dist/lib/adapters/version/3.1/delivery.mjs +54 -0
- package/dist/lib/adapters/version/3.1/index.d.mts +3 -0
- package/dist/lib/adapters/version/3.1/index.d.ts +3 -0
- package/dist/lib/adapters/version/3.1/index.js +36 -0
- package/dist/lib/adapters/version/3.1/index.mjs +12 -0
- package/dist/lib/adapters/version/index.d.mts +59 -7
- package/dist/lib/adapters/version/index.d.ts +59 -7
- package/dist/lib/adapters/version/index.js +51 -2
- package/dist/lib/adapters/version/index.mjs +49 -1
- package/dist/lib/adapters/version/negotiate.d.mts +71 -0
- package/dist/lib/adapters/version/negotiate.d.ts +71 -0
- package/dist/lib/adapters/version/negotiate.js +101 -0
- package/dist/lib/adapters/version/negotiate.mjs +73 -0
- package/dist/lib/adapters/version/schema-projection.d.mts +33 -0
- package/dist/lib/adapters/version/schema-projection.d.ts +33 -0
- package/dist/lib/adapters/version/schema-projection.js +294 -0
- package/dist/lib/adapters/version/schema-projection.mjs +269 -0
- package/dist/lib/adapters/version/translate.d.mts +122 -0
- package/dist/lib/adapters/version/translate.d.ts +122 -0
- package/dist/lib/adapters/version/translate.js +169 -0
- package/dist/lib/adapters/version/translate.mjs +141 -0
- package/dist/lib/adapters/version/types.d.mts +51 -10
- package/dist/lib/adapters/version/types.d.ts +51 -10
- package/dist/lib/core/AgentClient.d.mts +1 -1
- package/dist/lib/core/AgentClient.d.ts +1 -1
- package/dist/lib/core/AgentClient.js +17 -1
- package/dist/lib/core/AgentClient.mjs +17 -1
- package/dist/lib/core/ConversationTypes.d.mts +7 -0
- package/dist/lib/core/ConversationTypes.d.ts +7 -0
- package/dist/lib/core/SingleAgentClient.d.mts +82 -0
- package/dist/lib/core/SingleAgentClient.d.ts +82 -0
- package/dist/lib/core/SingleAgentClient.js +336 -15
- package/dist/lib/core/SingleAgentClient.mjs +350 -17
- package/dist/lib/core/TaskExecutor.d.mts +1 -1
- package/dist/lib/core/TaskExecutor.d.ts +1 -1
- package/dist/lib/core/TaskExecutor.js +182 -31
- package/dist/lib/core/TaskExecutor.mjs +183 -32
- package/dist/lib/core/account-reduction.d.mts +36 -0
- package/dist/lib/core/account-reduction.d.ts +36 -0
- package/dist/lib/core/account-reduction.js +127 -0
- package/dist/lib/core/account-reduction.mjs +98 -0
- package/dist/lib/core/buyer-account-registry.d.mts +52 -0
- package/dist/lib/core/buyer-account-registry.d.ts +52 -0
- package/dist/lib/core/buyer-account-registry.js +142 -6
- package/dist/lib/core/buyer-account-registry.mjs +142 -6
- package/dist/lib/errors/index.d.mts +34 -0
- package/dist/lib/errors/index.d.ts +34 -0
- package/dist/lib/errors/index.js +11 -0
- package/dist/lib/errors/index.mjs +10 -0
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.mjs +2 -0
- package/dist/lib/media-buy/action-contracts.js +4 -4
- package/dist/lib/media-buy/action-contracts.mjs +4 -4
- package/dist/lib/media-buy/action-types.d.mts +3 -2
- package/dist/lib/media-buy/action-types.d.ts +3 -2
- package/dist/lib/media-buy/compatibility.d.mts +1 -0
- package/dist/lib/media-buy/compatibility.d.ts +1 -0
- package/dist/lib/media-buy/compatibility.js +33 -10
- package/dist/lib/media-buy/compatibility.mjs +32 -14
- package/dist/lib/media-buy/update-fields.generated.d.mts +3 -2
- package/dist/lib/media-buy/update-fields.generated.d.ts +3 -2
- package/dist/lib/negotiation/buyer.js +11 -5
- package/dist/lib/negotiation/buyer.mjs +11 -5
- package/dist/lib/negotiation/types.d.mts +4 -2
- package/dist/lib/negotiation/types.d.ts +4 -2
- package/dist/lib/negotiation/verification.d.mts +15 -6
- package/dist/lib/negotiation/verification.d.ts +15 -6
- package/dist/lib/negotiation/verification.js +146 -27
- package/dist/lib/negotiation/verification.mjs +146 -28
- package/dist/lib/negotiation/version.d.mts +6 -0
- package/dist/lib/negotiation/version.d.ts +6 -0
- package/dist/lib/negotiation/version.js +60 -0
- package/dist/lib/negotiation/version.mjs +33 -0
- package/dist/lib/registry/types.generated.d.mts +1 -1
- package/dist/lib/registry/types.generated.d.ts +1 -1
- package/dist/lib/server/create-adcp-server.d.mts +21 -0
- package/dist/lib/server/create-adcp-server.d.ts +21 -0
- package/dist/lib/server/create-adcp-server.js +98 -16
- package/dist/lib/server/create-adcp-server.mjs +84 -2
- package/dist/lib/server/error-arm-tools.d.mts +10 -10
- package/dist/lib/server/error-arm-tools.d.ts +10 -10
- package/dist/lib/server/error-arm-tools.js +22 -58
- package/dist/lib/server/error-arm-tools.mjs +30 -65
- package/dist/lib/server/index.d.mts +1 -1
- package/dist/lib/server/index.d.ts +1 -1
- package/dist/lib/storage/interfaces.d.mts +2 -0
- package/dist/lib/storage/interfaces.d.ts +2 -0
- package/dist/lib/testing/compliance/comply.js +17 -0
- package/dist/lib/testing/compliance/comply.mjs +17 -0
- package/dist/lib/testing/index.d.mts +3 -0
- package/dist/lib/testing/index.d.ts +3 -0
- package/dist/lib/testing/index.js +44 -2
- package/dist/lib/testing/index.mjs +42 -0
- package/dist/lib/testing/storyboard/collection-selection.d.mts +259 -0
- package/dist/lib/testing/storyboard/collection-selection.d.ts +259 -0
- package/dist/lib/testing/storyboard/collection-selection.js +384 -0
- package/dist/lib/testing/storyboard/collection-selection.mjs +348 -0
- package/dist/lib/testing/storyboard/context.js +12 -6
- package/dist/lib/testing/storyboard/context.mjs +12 -6
- package/dist/lib/testing/storyboard/fixture-resolution.d.mts +39 -1
- package/dist/lib/testing/storyboard/fixture-resolution.d.ts +39 -1
- package/dist/lib/testing/storyboard/fixture-resolution.js +216 -12
- package/dist/lib/testing/storyboard/fixture-resolution.mjs +218 -12
- package/dist/lib/testing/storyboard/index.d.mts +9 -2
- package/dist/lib/testing/storyboard/index.d.ts +9 -2
- package/dist/lib/testing/storyboard/index.js +51 -2
- package/dist/lib/testing/storyboard/index.mjs +49 -1
- package/dist/lib/testing/storyboard/prepared-fixtures.d.mts +471 -0
- package/dist/lib/testing/storyboard/prepared-fixtures.d.ts +471 -0
- package/dist/lib/testing/storyboard/prepared-fixtures.js +434 -0
- package/dist/lib/testing/storyboard/prepared-fixtures.mjs +389 -0
- package/dist/lib/testing/storyboard/protected-context.d.mts +127 -0
- package/dist/lib/testing/storyboard/protected-context.d.ts +127 -0
- package/dist/lib/testing/storyboard/protected-context.js +301 -0
- package/dist/lib/testing/storyboard/protected-context.mjs +267 -0
- package/dist/lib/testing/storyboard/rejection-hints.js +13 -4
- package/dist/lib/testing/storyboard/rejection-hints.mjs +13 -4
- package/dist/lib/testing/storyboard/runner.d.mts +24 -0
- package/dist/lib/testing/storyboard/runner.d.ts +24 -0
- package/dist/lib/testing/storyboard/runner.js +1061 -105
- package/dist/lib/testing/storyboard/runner.mjs +1075 -106
- package/dist/lib/testing/storyboard/seeding.d.mts +15 -1
- package/dist/lib/testing/storyboard/seeding.d.ts +15 -1
- package/dist/lib/testing/storyboard/seeding.js +272 -12
- package/dist/lib/testing/storyboard/seeding.mjs +274 -13
- package/dist/lib/testing/storyboard/types.d.mts +207 -10
- package/dist/lib/testing/storyboard/types.d.ts +207 -10
- package/dist/lib/testing/storyboard/types.js +1 -1
- package/dist/lib/testing/storyboard/types.mjs +1 -1
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.js +95 -0
- package/dist/lib/testing/storyboard/validations.mjs +95 -0
- package/dist/lib/validation/bundled-schema-store.js +5 -0
- package/dist/lib/validation/bundled-schema-store.mjs +4 -0
- package/dist/lib/validation/schema-loader.js +19 -2
- package/dist/lib/validation/schema-loader.mjs +22 -3
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/COLLECTION-FIXTURE-FOUNDATION.md +850 -0
- package/docs/guides/PROPOSAL-TERMS-VERIFICATION.md +66 -0
- package/docs/llms.txt +4 -3
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -21,6 +21,8 @@ This document contains essential guidelines for AI coding assistants (Claude, Co
|
|
|
21
21
|
|
|
22
22
|
**Migration guides** — [AdCP 2 retirement](docs/migration-drop-adcp-2.md) (AdCP 3-only discovery, removed compatibility APIs, and last supporting SDK pins); [Account change feed](docs/migration-account-change-feed.md) (wake-up parsing, guarded bootstrap/drain, subscriber registration and ownership boundaries); `docs/migration-6.6-to-6.7.md` (fifteen adopter recipes; two breaking changes — `'implicit'` enforces inline-`account_id` refusal and `SalesPlatform` split into `SalesCorePlatform & SalesIngestionPlatform`; plus `definePlatform` helpers, `composeMethod`, `accounts.resolve` security presets, `accounts.upsert/list/syncGovernance(ctx)`, typed errors, `issues[].hint`, `BuyerAgentRegistry`, `createTenantRegistry`, `createOAuthPassthroughResolver`, `createRosterAccountStore`, `createTenantStore` w/ built-in tenant gate, `MEDIA_BUY_TRANSITIONS` lifecycle helpers, `createMediaBuyStore` for `targeting_overlay` echo, `NoAccountCtx` narrow, `refAccountId(ref)`); `docs/migration-5.x-to-6.x.md` (5 → 6 framework shape); `docs/migration-4.x-to-5.x.md` (4 → 5); `docs/migration-buyer-agent-registry.md` (registry deep-dive).
|
|
23
23
|
|
|
24
|
+
**Pinning a real collection-bearing product in a storyboard?** — Read [`docs/guides/COLLECTION-FIXTURE-FOUNDATION.md`](docs/guides/COLLECTION-FIXTURE-FOUNDATION.md): `collection_selection_satisfies`, same-graph fixture captures, the protected `__adcp_fixture_` namespace, `prepareStoryboardFixtures()`, and `collection_set_equals_context` — plus the limits the foundation does not claim to solve.
|
|
25
|
+
|
|
24
26
|
**Putting credentials in `ctx_metadata`?** — Don't. Read `docs/guides/CTX-METADATA-SAFETY.md` — wire-strip protects buyer responses but not log lines / error envelopes / heap dumps / adopter strings. Re-derive bearers per request; embed only non-secret upstream IDs.
|
|
25
27
|
|
|
26
28
|
**Reviewing a safety-critical PR (auth, signing, replay, idempotency, governance, tenancy)?** — Read `docs/development/REVIEW-STACKS.md`. Run Claude expert agents (DX, protocol, code-review, security) in parallel **plus** `npm run review:codex -- --all --base main` for a second-model opinion. Convergence = ship confidence; divergence = the actual review.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { VersionAdapter } from '../types.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* AdCP 3.2 `sync_creatives.assignment_operations` adds explicit `unassign`
|
|
4
|
+
* and `replace` to the 3.1 `assignments` upsert. A request whose operations
|
|
5
|
+
* are all `assign` means exactly what 3.1 `assignments` means, so it moves
|
|
6
|
+
* there (appended after any `assignments` the request already carries, in
|
|
7
|
+
* order). 3.2 makes the operations atomic, so the moved request asks for
|
|
8
|
+
* `validation_mode: 'strict'` unless the caller chose a mode. Any `unassign`
|
|
9
|
+
* or `replace` has no 3.1 form; the request is left for the projection,
|
|
10
|
+
* which refuses it as a mutation.
|
|
11
|
+
*/
|
|
12
|
+
export declare const syncCreativesAdapter: VersionAdapter;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { VersionAdapter } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* AdCP 3.2 `sync_creatives.assignment_operations` adds explicit `unassign`
|
|
4
|
+
* and `replace` to the 3.1 `assignments` upsert. A request whose operations
|
|
5
|
+
* are all `assign` means exactly what 3.1 `assignments` means, so it moves
|
|
6
|
+
* there (appended after any `assignments` the request already carries, in
|
|
7
|
+
* order). 3.2 makes the operations atomic, so the moved request asks for
|
|
8
|
+
* `validation_mode: 'strict'` unless the caller chose a mode. Any `unassign`
|
|
9
|
+
* or `replace` has no 3.1 form; the request is left for the projection,
|
|
10
|
+
* which refuses it as a mutation.
|
|
11
|
+
*/
|
|
12
|
+
export declare const syncCreativesAdapter: VersionAdapter;
|
|
@@ -0,0 +1,67 @@
|
|
|
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 assignments_exports = {};
|
|
20
|
+
__export(assignments_exports, {
|
|
21
|
+
syncCreativesAdapter: () => syncCreativesAdapter
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(assignments_exports);
|
|
24
|
+
function isObject(value) {
|
|
25
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
const syncCreativesAdapter = {
|
|
28
|
+
toolName: "sync_creatives",
|
|
29
|
+
adaptRequest(params) {
|
|
30
|
+
if (!isObject(params) || !Array.isArray(params.assignment_operations)) return { params };
|
|
31
|
+
const operations = params.assignment_operations;
|
|
32
|
+
if (operations.length === 0) {
|
|
33
|
+
const { assignment_operations: _2, ...rest2 } = params;
|
|
34
|
+
return {
|
|
35
|
+
params: rest2,
|
|
36
|
+
drift: {
|
|
37
|
+
type: "empty_assignment_operations_removed",
|
|
38
|
+
message: "Empty assignment_operations removed: it requests no change and AdCP 3.1 has no such field.",
|
|
39
|
+
strippedFields: ["assignment_operations"]
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (!operations.every((op) => isObject(op) && op.operation === "assign")) return { params };
|
|
44
|
+
const moved = operations.map(({ operation: _2, ...assignment }) => assignment);
|
|
45
|
+
const { assignment_operations: _, ...rest } = params;
|
|
46
|
+
const existing = Array.isArray(params.assignments) ? params.assignments : [];
|
|
47
|
+
return {
|
|
48
|
+
params: {
|
|
49
|
+
...rest,
|
|
50
|
+
assignments: [...existing, ...moved],
|
|
51
|
+
validation_mode: params.validation_mode ?? "strict"
|
|
52
|
+
},
|
|
53
|
+
drift: {
|
|
54
|
+
type: "assignment_operations_moved_to_assignments",
|
|
55
|
+
message: "assignment_operations (assign only) rewritten as AdCP 3.1 assignments, validated strictly to keep the 3.2 all-or-nothing behavior.",
|
|
56
|
+
movedFields: moved.map((_2, index) => ({
|
|
57
|
+
from: `assignment_operations[${index}]`,
|
|
58
|
+
to: `assignments[${existing.length + index}]`
|
|
59
|
+
}))
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
syncCreativesAdapter
|
|
67
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
function isObject(value) {
|
|
2
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
const syncCreativesAdapter = {
|
|
5
|
+
toolName: "sync_creatives",
|
|
6
|
+
adaptRequest(params) {
|
|
7
|
+
if (!isObject(params) || !Array.isArray(params.assignment_operations)) return { params };
|
|
8
|
+
const operations = params.assignment_operations;
|
|
9
|
+
if (operations.length === 0) {
|
|
10
|
+
const { assignment_operations: _2, ...rest2 } = params;
|
|
11
|
+
return {
|
|
12
|
+
params: rest2,
|
|
13
|
+
drift: {
|
|
14
|
+
type: "empty_assignment_operations_removed",
|
|
15
|
+
message: "Empty assignment_operations removed: it requests no change and AdCP 3.1 has no such field.",
|
|
16
|
+
strippedFields: ["assignment_operations"]
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (!operations.every((op) => isObject(op) && op.operation === "assign")) return { params };
|
|
21
|
+
const moved = operations.map(({ operation: _2, ...assignment }) => assignment);
|
|
22
|
+
const { assignment_operations: _, ...rest } = params;
|
|
23
|
+
const existing = Array.isArray(params.assignments) ? params.assignments : [];
|
|
24
|
+
return {
|
|
25
|
+
params: {
|
|
26
|
+
...rest,
|
|
27
|
+
assignments: [...existing, ...moved],
|
|
28
|
+
validation_mode: params.validation_mode ?? "strict"
|
|
29
|
+
},
|
|
30
|
+
drift: {
|
|
31
|
+
type: "assignment_operations_moved_to_assignments",
|
|
32
|
+
message: "assignment_operations (assign only) rewritten as AdCP 3.1 assignments, validated strictly to keep the 3.2 all-or-nothing behavior.",
|
|
33
|
+
movedFields: moved.map((_2, index) => ({
|
|
34
|
+
from: `assignment_operations[${index}]`,
|
|
35
|
+
to: `assignments[${existing.length + index}]`
|
|
36
|
+
}))
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
syncCreativesAdapter
|
|
43
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
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 bidding_exports = {};
|
|
20
|
+
__export(bidding_exports, {
|
|
21
|
+
createMediaBuyAdapter: () => createMediaBuyAdapter,
|
|
22
|
+
updateMediaBuyAdapter: () => updateMediaBuyAdapter
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(bidding_exports);
|
|
25
|
+
var import_envelope_status_compat = require('../../../utils/envelope-status-compat.js');
|
|
26
|
+
function isObject(value) {
|
|
27
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
28
|
+
}
|
|
29
|
+
function legacyBidPrice(bidding) {
|
|
30
|
+
if (!isObject(bidding)) return void 0;
|
|
31
|
+
const keys = Object.keys(bidding).filter((key) => bidding[key] !== void 0);
|
|
32
|
+
if (keys.length !== 1 || keys[0] !== "bid_amount") return void 0;
|
|
33
|
+
return typeof bidding.bid_amount === "number" ? bidding.bid_amount : void 0;
|
|
34
|
+
}
|
|
35
|
+
function adaptPackages(packages, inherited, moved, inheritedPath) {
|
|
36
|
+
if (!Array.isArray(packages)) return packages;
|
|
37
|
+
let changed = false;
|
|
38
|
+
const adapted = packages.map((pkg, index) => {
|
|
39
|
+
if (!isObject(pkg) || pkg.bid_price !== void 0) return pkg;
|
|
40
|
+
const own = pkg.bidding === void 0 ? void 0 : legacyBidPrice(pkg.bidding);
|
|
41
|
+
if (own !== void 0) {
|
|
42
|
+
changed = true;
|
|
43
|
+
const { bidding: _, ...rest } = pkg;
|
|
44
|
+
moved.push({ from: `packages[${index}].bidding`, to: `packages[${index}].bid_price` });
|
|
45
|
+
return { ...rest, bid_price: own };
|
|
46
|
+
}
|
|
47
|
+
if (pkg.bidding === void 0 && inherited !== void 0) {
|
|
48
|
+
changed = true;
|
|
49
|
+
moved.push({ from: inheritedPath, to: `packages[${index}].bid_price` });
|
|
50
|
+
return { ...pkg, bid_price: inherited };
|
|
51
|
+
}
|
|
52
|
+
return pkg;
|
|
53
|
+
});
|
|
54
|
+
return changed ? adapted : packages;
|
|
55
|
+
}
|
|
56
|
+
function bidDrift(moved) {
|
|
57
|
+
return {
|
|
58
|
+
type: "bidding_moved_to_bid_price",
|
|
59
|
+
message: "bidding.bid_amount rewritten as package bid_price: AdCP 3.1 has no bidding block. The seller reads bid_price as the exact bid, or as a ceiling when the selected pricing option sets max_bid.",
|
|
60
|
+
movedFields: moved
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const createMediaBuyAdapter = {
|
|
64
|
+
toolName: "create_media_buy",
|
|
65
|
+
adaptRequest(params) {
|
|
66
|
+
if (!isObject(params)) return { params };
|
|
67
|
+
const moved = [];
|
|
68
|
+
const inherited = legacyBidPrice(params.bidding);
|
|
69
|
+
const packages = adaptPackages(params.packages, inherited, moved, "bidding");
|
|
70
|
+
if (moved.length === 0 && inherited === void 0) return { params };
|
|
71
|
+
const adapted = { ...params, packages };
|
|
72
|
+
if (inherited !== void 0) delete adapted.bidding;
|
|
73
|
+
if (moved.length > 0) return { params: adapted, drift: bidDrift(moved) };
|
|
74
|
+
return {
|
|
75
|
+
params: adapted,
|
|
76
|
+
drift: {
|
|
77
|
+
type: "redundant_bidding_default_removed",
|
|
78
|
+
message: "Media-buy bidding default removed: every package sets its own bid, and AdCP 3.1 has no media-buy bidding block.",
|
|
79
|
+
strippedFields: ["bidding"]
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
adaptResponse: adaptMediaBuyStatus("create_media_buy")
|
|
84
|
+
};
|
|
85
|
+
const updateMediaBuyAdapter = {
|
|
86
|
+
toolName: "update_media_buy",
|
|
87
|
+
adaptRequest(params) {
|
|
88
|
+
if (!isObject(params)) return { params };
|
|
89
|
+
const moved = [];
|
|
90
|
+
const packages = adaptPackages(params.packages, void 0, moved, "bidding");
|
|
91
|
+
if (moved.length === 0) return { params };
|
|
92
|
+
return { params: { ...params, packages }, drift: bidDrift(moved) };
|
|
93
|
+
},
|
|
94
|
+
adaptResponse: adaptMediaBuyStatus("update_media_buy")
|
|
95
|
+
};
|
|
96
|
+
function adaptMediaBuyStatus(toolName) {
|
|
97
|
+
return (data) => {
|
|
98
|
+
if (!isObject(data)) return { data };
|
|
99
|
+
const adapted = (0, import_envelope_status_compat.injectLegacyEnvelopeStatus)(data, { toolName });
|
|
100
|
+
if (adapted === data || adapted.media_buy_status === data.media_buy_status) return { data };
|
|
101
|
+
return {
|
|
102
|
+
data: adapted,
|
|
103
|
+
drift: {
|
|
104
|
+
type: "media_buy_status_alias_moved",
|
|
105
|
+
message: "Legacy top-level media-buy status moved to media_buy_status for the AdCP 3.2 response shape.",
|
|
106
|
+
movedFields: [{ from: "status", to: "media_buy_status" }]
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
+
0 && (module.exports = {
|
|
113
|
+
createMediaBuyAdapter,
|
|
114
|
+
updateMediaBuyAdapter
|
|
115
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { injectLegacyEnvelopeStatus } from "../../../utils/envelope-status-compat.mjs";
|
|
2
|
+
function isObject(value) {
|
|
3
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
function legacyBidPrice(bidding) {
|
|
6
|
+
if (!isObject(bidding)) return void 0;
|
|
7
|
+
const keys = Object.keys(bidding).filter((key) => bidding[key] !== void 0);
|
|
8
|
+
if (keys.length !== 1 || keys[0] !== "bid_amount") return void 0;
|
|
9
|
+
return typeof bidding.bid_amount === "number" ? bidding.bid_amount : void 0;
|
|
10
|
+
}
|
|
11
|
+
function adaptPackages(packages, inherited, moved, inheritedPath) {
|
|
12
|
+
if (!Array.isArray(packages)) return packages;
|
|
13
|
+
let changed = false;
|
|
14
|
+
const adapted = packages.map((pkg, index) => {
|
|
15
|
+
if (!isObject(pkg) || pkg.bid_price !== void 0) return pkg;
|
|
16
|
+
const own = pkg.bidding === void 0 ? void 0 : legacyBidPrice(pkg.bidding);
|
|
17
|
+
if (own !== void 0) {
|
|
18
|
+
changed = true;
|
|
19
|
+
const { bidding: _, ...rest } = pkg;
|
|
20
|
+
moved.push({ from: `packages[${index}].bidding`, to: `packages[${index}].bid_price` });
|
|
21
|
+
return { ...rest, bid_price: own };
|
|
22
|
+
}
|
|
23
|
+
if (pkg.bidding === void 0 && inherited !== void 0) {
|
|
24
|
+
changed = true;
|
|
25
|
+
moved.push({ from: inheritedPath, to: `packages[${index}].bid_price` });
|
|
26
|
+
return { ...pkg, bid_price: inherited };
|
|
27
|
+
}
|
|
28
|
+
return pkg;
|
|
29
|
+
});
|
|
30
|
+
return changed ? adapted : packages;
|
|
31
|
+
}
|
|
32
|
+
function bidDrift(moved) {
|
|
33
|
+
return {
|
|
34
|
+
type: "bidding_moved_to_bid_price",
|
|
35
|
+
message: "bidding.bid_amount rewritten as package bid_price: AdCP 3.1 has no bidding block. The seller reads bid_price as the exact bid, or as a ceiling when the selected pricing option sets max_bid.",
|
|
36
|
+
movedFields: moved
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const createMediaBuyAdapter = {
|
|
40
|
+
toolName: "create_media_buy",
|
|
41
|
+
adaptRequest(params) {
|
|
42
|
+
if (!isObject(params)) return { params };
|
|
43
|
+
const moved = [];
|
|
44
|
+
const inherited = legacyBidPrice(params.bidding);
|
|
45
|
+
const packages = adaptPackages(params.packages, inherited, moved, "bidding");
|
|
46
|
+
if (moved.length === 0 && inherited === void 0) return { params };
|
|
47
|
+
const adapted = { ...params, packages };
|
|
48
|
+
if (inherited !== void 0) delete adapted.bidding;
|
|
49
|
+
if (moved.length > 0) return { params: adapted, drift: bidDrift(moved) };
|
|
50
|
+
return {
|
|
51
|
+
params: adapted,
|
|
52
|
+
drift: {
|
|
53
|
+
type: "redundant_bidding_default_removed",
|
|
54
|
+
message: "Media-buy bidding default removed: every package sets its own bid, and AdCP 3.1 has no media-buy bidding block.",
|
|
55
|
+
strippedFields: ["bidding"]
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
adaptResponse: adaptMediaBuyStatus("create_media_buy")
|
|
60
|
+
};
|
|
61
|
+
const updateMediaBuyAdapter = {
|
|
62
|
+
toolName: "update_media_buy",
|
|
63
|
+
adaptRequest(params) {
|
|
64
|
+
if (!isObject(params)) return { params };
|
|
65
|
+
const moved = [];
|
|
66
|
+
const packages = adaptPackages(params.packages, void 0, moved, "bidding");
|
|
67
|
+
if (moved.length === 0) return { params };
|
|
68
|
+
return { params: { ...params, packages }, drift: bidDrift(moved) };
|
|
69
|
+
},
|
|
70
|
+
adaptResponse: adaptMediaBuyStatus("update_media_buy")
|
|
71
|
+
};
|
|
72
|
+
function adaptMediaBuyStatus(toolName) {
|
|
73
|
+
return (data) => {
|
|
74
|
+
if (!isObject(data)) return { data };
|
|
75
|
+
const adapted = injectLegacyEnvelopeStatus(data, { toolName });
|
|
76
|
+
if (adapted === data || adapted.media_buy_status === data.media_buy_status) return { data };
|
|
77
|
+
return {
|
|
78
|
+
data: adapted,
|
|
79
|
+
drift: {
|
|
80
|
+
type: "media_buy_status_alias_moved",
|
|
81
|
+
message: "Legacy top-level media-buy status moved to media_buy_status for the AdCP 3.2 response shape.",
|
|
82
|
+
movedFields: [{ from: "status", to: "media_buy_status" }]
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
createMediaBuyAdapter,
|
|
89
|
+
updateMediaBuyAdapter
|
|
90
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { VersionAdapter } from '../types.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* AdCP 3.2 reports currency per media buy and deprecates the root `currency`,
|
|
4
|
+
* which is unsafe across currencies. A 3.1 response has exactly one currency
|
|
5
|
+
* (the required root field), so each buy's currency is that value.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getMediaBuyDeliveryAdapter: VersionAdapter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { VersionAdapter } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* AdCP 3.2 reports currency per media buy and deprecates the root `currency`,
|
|
4
|
+
* which is unsafe across currencies. A 3.1 response has exactly one currency
|
|
5
|
+
* (the required root field), so each buy's currency is that value.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getMediaBuyDeliveryAdapter: VersionAdapter;
|
|
@@ -0,0 +1,78 @@
|
|
|
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 delivery_exports = {};
|
|
20
|
+
__export(delivery_exports, {
|
|
21
|
+
getMediaBuyDeliveryAdapter: () => getMediaBuyDeliveryAdapter
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(delivery_exports);
|
|
24
|
+
function isObject(value) {
|
|
25
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
const getMediaBuyDeliveryAdapter = {
|
|
28
|
+
toolName: "get_media_buy_delivery",
|
|
29
|
+
/**
|
|
30
|
+
* AdCP 3.1 requires the root `currency`. A 3.2 handler reports currency per
|
|
31
|
+
* media buy; when every buy shares one currency, that is the root value.
|
|
32
|
+
* Mixed currencies have no 3.1 form and are left for response validation
|
|
33
|
+
* to report.
|
|
34
|
+
*/
|
|
35
|
+
downgradeResponse(data) {
|
|
36
|
+
if (!isObject(data) || data.currency !== void 0 || !Array.isArray(data.media_buy_deliveries)) {
|
|
37
|
+
return { data };
|
|
38
|
+
}
|
|
39
|
+
const currencies = new Set(
|
|
40
|
+
data.media_buy_deliveries.map((delivery) => isObject(delivery) ? delivery.currency : void 0)
|
|
41
|
+
);
|
|
42
|
+
const [currency] = currencies;
|
|
43
|
+
if (currencies.size !== 1 || typeof currency !== "string") return { data };
|
|
44
|
+
return {
|
|
45
|
+
data: { ...data, currency },
|
|
46
|
+
drift: {
|
|
47
|
+
type: "delivery_currency_to_root",
|
|
48
|
+
message: "Shared per-media-buy currency copied to the root currency AdCP 3.1 requires.",
|
|
49
|
+
movedFields: [{ from: "media_buy_deliveries[].currency", to: "currency" }]
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
adaptResponse(data) {
|
|
54
|
+
if (!isObject(data) || typeof data.currency !== "string" || !Array.isArray(data.media_buy_deliveries)) {
|
|
55
|
+
return { data };
|
|
56
|
+
}
|
|
57
|
+
const currency = data.currency;
|
|
58
|
+
const moved = [];
|
|
59
|
+
const deliveries = data.media_buy_deliveries.map((delivery, index) => {
|
|
60
|
+
if (!isObject(delivery) || delivery.currency !== void 0) return delivery;
|
|
61
|
+
moved.push({ from: "currency", to: `media_buy_deliveries[${index}].currency` });
|
|
62
|
+
return { ...delivery, currency };
|
|
63
|
+
});
|
|
64
|
+
if (moved.length === 0) return { data };
|
|
65
|
+
return {
|
|
66
|
+
data: { ...data, media_buy_deliveries: deliveries },
|
|
67
|
+
drift: {
|
|
68
|
+
type: "delivery_currency_per_media_buy",
|
|
69
|
+
message: "Root currency copied onto each media_buy_deliveries[] entry for the AdCP 3.2 response shape.",
|
|
70
|
+
movedFields: moved
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
getMediaBuyDeliveryAdapter
|
|
78
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function isObject(value) {
|
|
2
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
const getMediaBuyDeliveryAdapter = {
|
|
5
|
+
toolName: "get_media_buy_delivery",
|
|
6
|
+
/**
|
|
7
|
+
* AdCP 3.1 requires the root `currency`. A 3.2 handler reports currency per
|
|
8
|
+
* media buy; when every buy shares one currency, that is the root value.
|
|
9
|
+
* Mixed currencies have no 3.1 form and are left for response validation
|
|
10
|
+
* to report.
|
|
11
|
+
*/
|
|
12
|
+
downgradeResponse(data) {
|
|
13
|
+
if (!isObject(data) || data.currency !== void 0 || !Array.isArray(data.media_buy_deliveries)) {
|
|
14
|
+
return { data };
|
|
15
|
+
}
|
|
16
|
+
const currencies = new Set(
|
|
17
|
+
data.media_buy_deliveries.map((delivery) => isObject(delivery) ? delivery.currency : void 0)
|
|
18
|
+
);
|
|
19
|
+
const [currency] = currencies;
|
|
20
|
+
if (currencies.size !== 1 || typeof currency !== "string") return { data };
|
|
21
|
+
return {
|
|
22
|
+
data: { ...data, currency },
|
|
23
|
+
drift: {
|
|
24
|
+
type: "delivery_currency_to_root",
|
|
25
|
+
message: "Shared per-media-buy currency copied to the root currency AdCP 3.1 requires.",
|
|
26
|
+
movedFields: [{ from: "media_buy_deliveries[].currency", to: "currency" }]
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
adaptResponse(data) {
|
|
31
|
+
if (!isObject(data) || typeof data.currency !== "string" || !Array.isArray(data.media_buy_deliveries)) {
|
|
32
|
+
return { data };
|
|
33
|
+
}
|
|
34
|
+
const currency = data.currency;
|
|
35
|
+
const moved = [];
|
|
36
|
+
const deliveries = data.media_buy_deliveries.map((delivery, index) => {
|
|
37
|
+
if (!isObject(delivery) || delivery.currency !== void 0) return delivery;
|
|
38
|
+
moved.push({ from: "currency", to: `media_buy_deliveries[${index}].currency` });
|
|
39
|
+
return { ...delivery, currency };
|
|
40
|
+
});
|
|
41
|
+
if (moved.length === 0) return { data };
|
|
42
|
+
return {
|
|
43
|
+
data: { ...data, media_buy_deliveries: deliveries },
|
|
44
|
+
drift: {
|
|
45
|
+
type: "delivery_currency_per_media_buy",
|
|
46
|
+
message: "Root currency copied onto each media_buy_deliveries[] entry for the AdCP 3.2 response shape.",
|
|
47
|
+
movedFields: moved
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
getMediaBuyDeliveryAdapter
|
|
54
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
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 __exports = {};
|
|
20
|
+
__export(__exports, {
|
|
21
|
+
v31Adapters: () => v31Adapters
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(__exports);
|
|
24
|
+
var import_bidding = require('./bidding.js');
|
|
25
|
+
var import_assignments = require('./assignments.js');
|
|
26
|
+
var import_delivery = require('./delivery.js');
|
|
27
|
+
const v31Adapters = [
|
|
28
|
+
import_bidding.createMediaBuyAdapter,
|
|
29
|
+
import_bidding.updateMediaBuyAdapter,
|
|
30
|
+
import_delivery.getMediaBuyDeliveryAdapter,
|
|
31
|
+
import_assignments.syncCreativesAdapter
|
|
32
|
+
];
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
v31Adapters
|
|
36
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createMediaBuyAdapter, updateMediaBuyAdapter } from "./bidding.mjs";
|
|
2
|
+
import { syncCreativesAdapter } from "./assignments.mjs";
|
|
3
|
+
import { getMediaBuyDeliveryAdapter } from "./delivery.mjs";
|
|
4
|
+
const v31Adapters = [
|
|
5
|
+
createMediaBuyAdapter,
|
|
6
|
+
updateMediaBuyAdapter,
|
|
7
|
+
getMediaBuyDeliveryAdapter,
|
|
8
|
+
syncCreativesAdapter
|
|
9
|
+
];
|
|
10
|
+
export {
|
|
11
|
+
v31Adapters
|
|
12
|
+
};
|
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Registry of per-version
|
|
2
|
+
* Registry of per-version adapters, keyed by the older AdCP release of each
|
|
3
|
+
* consecutive minor pair (`'3.1'` holds the 3.2 ↔ 3.1 adapters, `'3.0'` the
|
|
4
|
+
* 3.1 ↔ 3.0 adapters).
|
|
3
5
|
*
|
|
4
|
-
* `
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* `negotiateAdcpRelease` picks the wire release for a seller.
|
|
7
|
+
* `convertRequest` / `convertResponse` then chain the adapters and the
|
|
8
|
+
* schema projection across every step between the client's release and the
|
|
9
|
+
* wire release. `resolveAdapterKey` remains for sellers whose release cannot
|
|
10
|
+
* be negotiated (synthetic capabilities), where only the 3.0 adapters apply.
|
|
9
11
|
*
|
|
10
12
|
* Add a new version transition by:
|
|
11
|
-
* 1. Create a `version/<target>/` directory with per-tool adapter modules
|
|
13
|
+
* 1. Create a `version/<target>/` directory with per-tool adapter modules
|
|
14
|
+
* for renames and moves. Pure additions need no adapter: the schema
|
|
15
|
+
* projection removes and reports them.
|
|
12
16
|
* 2. Collect them in `version/<target>/index.ts` as a `ReadonlyArray<VersionAdapter>`.
|
|
13
17
|
* 3. Register below.
|
|
14
18
|
* 4. Add tests to the conformance suite.
|
|
15
19
|
*/
|
|
16
20
|
import type { VersionAdapter } from './types.mjs';
|
|
21
|
+
import { type AccountIdentityDowngrade, type RequestTranslation, type ResponseTranslation } from './translate.mjs';
|
|
17
22
|
export type { VersionAdapter, VersionDrift } from './types.mjs';
|
|
23
|
+
export type { AccountIdentityDowngrade, RequestTranslation, ResponseTranslation, TranslationStep } from './translate.mjs';
|
|
24
|
+
export { translationSteps } from './translate.mjs';
|
|
25
|
+
export { negotiateAdcpRelease, isNegotiationFailure, parseAdcpRelease, adcpMinorLine, compareAdcpMinorLines, } from './negotiate.mjs';
|
|
26
|
+
export type { NegotiatedAdcpRelease, AdcpNegotiationFailure, AdcpNegotiationSource } from './negotiate.mjs';
|
|
27
|
+
export { projectToolPayload, releaseDefinesTool } from './schema-projection.mjs';
|
|
28
|
+
export type { ProjectionDrop, ProjectionResult } from './schema-projection.mjs';
|
|
18
29
|
/**
|
|
19
30
|
* Look up the version adapter for a given (adapterKey, toolName) pair.
|
|
20
31
|
* Returns `undefined` when no adapter is registered — caller passes through.
|
|
@@ -36,3 +47,44 @@ export declare function resolveAdapterKey(clientVersion: string | undefined, cap
|
|
|
36
47
|
* Used by the conformance test suite as the authoritative list.
|
|
37
48
|
*/
|
|
38
49
|
export declare function listVersionAdapterTools(adapterKey: string): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Convert a request built for `fromVersion` (the client's release) down to
|
|
52
|
+
* the negotiated wire release `toVersion`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function convertRequest<T>(toolName: string, params: T, options: {
|
|
55
|
+
fromVersion: string;
|
|
56
|
+
toVersion: string;
|
|
57
|
+
accountIdentity?: AccountIdentityDowngrade;
|
|
58
|
+
/** Defaults to `isMutatingTask(toolName)`. */
|
|
59
|
+
mutating?: boolean;
|
|
60
|
+
}): RequestTranslation<T>;
|
|
61
|
+
/**
|
|
62
|
+
* Convert a response served at the wire release `fromVersion` up to the
|
|
63
|
+
* client's release `toVersion`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function convertResponse<T>(toolName: string, data: T, options: {
|
|
66
|
+
fromVersion: string;
|
|
67
|
+
toVersion: string;
|
|
68
|
+
}): ResponseTranslation<T>;
|
|
69
|
+
/**
|
|
70
|
+
* Server side: convert an older buyer's request from the served release
|
|
71
|
+
* `fromVersion` up to the server's release `toVersion`.
|
|
72
|
+
*/
|
|
73
|
+
export declare function upgradeRequest<T>(toolName: string, params: T, options: {
|
|
74
|
+
fromVersion: string;
|
|
75
|
+
toVersion: string;
|
|
76
|
+
}): {
|
|
77
|
+
params: T;
|
|
78
|
+
drifts: import('./types.mjs').VersionDrift[];
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Server side: convert a handler's response from the server's release
|
|
82
|
+
* `fromVersion` down to the served release `toVersion`.
|
|
83
|
+
*/
|
|
84
|
+
export declare function downgradeResponse<T>(toolName: string, data: T, options: {
|
|
85
|
+
fromVersion: string;
|
|
86
|
+
toVersion: string;
|
|
87
|
+
}): {
|
|
88
|
+
data: T;
|
|
89
|
+
drifts: import('./types.mjs').VersionDrift[];
|
|
90
|
+
};
|