@adcp/sdk 10.0.1 → 11.0.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/dist/lib/brand/index.d.ts +32 -0
- package/dist/lib/brand/index.d.ts.map +1 -1
- package/dist/lib/brand/index.js +137 -0
- package/dist/lib/brand/index.js.map +1 -1
- package/dist/lib/discovery/validate-adagents.js +1 -1
- package/dist/lib/discovery/validate-adagents.js.map +1 -1
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +15 -13
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/registry/index.d.ts +6 -9
- package/dist/lib/registry/index.d.ts.map +1 -1
- package/dist/lib/registry/index.js.map +1 -1
- package/dist/lib/registry/property-registry.d.ts +6 -0
- package/dist/lib/registry/property-registry.d.ts.map +1 -1
- package/dist/lib/registry/property-registry.js +10 -1
- package/dist/lib/registry/property-registry.js.map +1 -1
- package/dist/lib/registry/sync.d.ts +77 -4
- package/dist/lib/registry/sync.d.ts.map +1 -1
- package/dist/lib/registry/sync.js +480 -64
- package/dist/lib/registry/sync.js.map +1 -1
- package/dist/lib/registry/types.d.ts +21 -2
- package/dist/lib/registry/types.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.d.ts +4 -8
- package/dist/lib/registry/types.generated.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.js +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/validations.js +43 -1
- package/dist/lib/testing/storyboard/validations.js.map +1 -1
- package/dist/lib/utils/creative-adapter.d.ts +16 -10
- package/dist/lib/utils/creative-adapter.d.ts.map +1 -1
- package/dist/lib/utils/creative-adapter.js +40 -24
- package/dist/lib/utils/creative-adapter.js.map +1 -1
- package/dist/lib/utils/request-normalizer.d.ts +8 -1
- package/dist/lib/utils/request-normalizer.d.ts.map +1 -1
- package/dist/lib/utils/request-normalizer.js +14 -16
- package/dist/lib/utils/request-normalizer.js.map +1 -1
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/package.json +1 -1
|
@@ -21,25 +21,34 @@ exports.getCreativeAssignments = getCreativeAssignments;
|
|
|
21
21
|
* Converts creative_assignments to creative_ids (dropping weight and placement_ids).
|
|
22
22
|
* Strips v3-only package fields (optimization_goals, catalogs).
|
|
23
23
|
*
|
|
24
|
-
* When `ctx` is provided and the input has no `buyer_ref`, derives one
|
|
25
|
-
* `package.
|
|
26
|
-
*
|
|
24
|
+
* When `ctx` is provided and the input has no `buyer_ref`, derives one from —
|
|
25
|
+
* in order — `package.context.buyer_ref`, `package.idempotency_key`, or
|
|
26
|
+
* `${ctx.parentBuyerRef}-${ctx.index}` so v2.5 package-request validation
|
|
27
|
+
* passes. Caller-supplied top-level `buyer_ref` always wins. The `context.buyer_ref`
|
|
28
|
+
* fallback exists because v3 callers put their per-package correlation ref in
|
|
29
|
+
* `context.buyer_ref` (per the 3.0 package schema); this adapter is the only
|
|
30
|
+
* place that promotes it back to the top-level shape v2.5 sellers still expect.
|
|
27
31
|
*/
|
|
28
32
|
function adaptPackageRequestForV2(pkg, ctx) {
|
|
29
33
|
const { optimization_goals, catalogs, idempotency_key: pkgIdempotencyKey, buyer_ref: callerBuyerRef, ...rest } = pkg;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
// the
|
|
35
|
-
//
|
|
34
|
+
const contextBuyerRef = rest.context && typeof rest.context === 'object' && !Array.isArray(rest.context)
|
|
35
|
+
? rest.context.buyer_ref
|
|
36
|
+
: undefined;
|
|
37
|
+
// Derive per-package buyer_ref. Caller-supplied top-level wins; then
|
|
38
|
+
// context.buyer_ref (the v3 per-package correlation slot); then per-package
|
|
39
|
+
// idempotency_key; then a stable composition of the parent's buyer_ref and
|
|
40
|
+
// the package's array index. If none of those are available we pass through
|
|
41
|
+
// without a buyer_ref and let the v2.5 validator surface the missing field
|
|
42
|
+
// — better than synthesizing an unstable value that breaks dedupe on replay.
|
|
36
43
|
const derivedBuyerRef = typeof callerBuyerRef === 'string' && callerBuyerRef.length > 0
|
|
37
44
|
? callerBuyerRef
|
|
38
|
-
: typeof
|
|
39
|
-
?
|
|
40
|
-
:
|
|
41
|
-
?
|
|
42
|
-
: undefined
|
|
45
|
+
: typeof contextBuyerRef === 'string' && contextBuyerRef.length > 0
|
|
46
|
+
? contextBuyerRef
|
|
47
|
+
: typeof pkgIdempotencyKey === 'string' && pkgIdempotencyKey.length > 0
|
|
48
|
+
? pkgIdempotencyKey
|
|
49
|
+
: ctx?.parentBuyerRef !== undefined && ctx?.index !== undefined
|
|
50
|
+
? `${ctx.parentBuyerRef}-${ctx.index}`
|
|
51
|
+
: undefined;
|
|
43
52
|
const baseOut = rest;
|
|
44
53
|
if (!rest.creative_assignments) {
|
|
45
54
|
return derivedBuyerRef === undefined ? baseOut : { ...baseOut, buyer_ref: derivedBuyerRef };
|
|
@@ -54,18 +63,23 @@ function adaptPackageRequestForV2(pkg, ctx) {
|
|
|
54
63
|
/**
|
|
55
64
|
* Adapt a create_media_buy request for a v2 server.
|
|
56
65
|
* Strips v3-only top-level fields, converts brand → brand_manifest, derives
|
|
57
|
-
* `buyer_ref` (top-level + per-package) from `
|
|
58
|
-
* packages.
|
|
66
|
+
* `buyer_ref` (top-level + per-package) from `context.buyer_ref` or
|
|
67
|
+
* `idempotency_key`, and adapts packages.
|
|
59
68
|
*
|
|
60
69
|
* v2.5 requires `buyer_ref` as the buyer's reference for THIS media buy,
|
|
61
|
-
* top-level + per-package. v3
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
70
|
+
* top-level + per-package. v3 removed the top-level field and moved buyer
|
|
71
|
+
* correlation into `context.buyer_ref`; `idempotency_key` carries the same
|
|
72
|
+
* client-controlled-unique-identity semantics. Preferring the caller's
|
|
73
|
+
* `context.buyer_ref` before falling back to `idempotency_key` preserves the
|
|
74
|
+
* buyer's stable reference on the wire when they provided one, and still
|
|
75
|
+
* satisfies v2.5 dedupe on replay when they did not. Caller-supplied
|
|
76
|
+
* top-level `buyer_ref` (if any) always wins.
|
|
66
77
|
*/
|
|
67
78
|
function adaptCreateMediaBuyRequestForV2(request) {
|
|
68
79
|
const { account, proposal_id, total_budget, artifact_webhook, brand, brand_manifest: inputManifest, adcp_major_version, idempotency_key, buyer_ref: callerBuyerRef, ...rest } = request;
|
|
80
|
+
const contextBuyerRef = rest.context && typeof rest.context === 'object' && !Array.isArray(rest.context)
|
|
81
|
+
? rest.context.buyer_ref
|
|
82
|
+
: undefined;
|
|
69
83
|
// Proposal mode is v3-only. If packages are also present we can still satisfy the request
|
|
70
84
|
// by dropping proposal_id/total_budget and using the explicit packages.
|
|
71
85
|
// Only throw when there are no packages — then there's nothing to send a v2 server.
|
|
@@ -84,9 +98,11 @@ function adaptCreateMediaBuyRequestForV2(request) {
|
|
|
84
98
|
const brand_manifest = callerUrl || (brand?.domain ? `https://${brand.domain}` : undefined);
|
|
85
99
|
const buyer_ref = typeof callerBuyerRef === 'string' && callerBuyerRef.length > 0
|
|
86
100
|
? callerBuyerRef
|
|
87
|
-
: typeof
|
|
88
|
-
?
|
|
89
|
-
:
|
|
101
|
+
: typeof contextBuyerRef === 'string' && contextBuyerRef.length > 0
|
|
102
|
+
? contextBuyerRef
|
|
103
|
+
: typeof idempotency_key === 'string' && idempotency_key.length > 0
|
|
104
|
+
? idempotency_key
|
|
105
|
+
: undefined;
|
|
90
106
|
return {
|
|
91
107
|
...rest,
|
|
92
108
|
...(buyer_ref !== undefined && { buyer_ref }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creative-adapter.js","sourceRoot":"","sources":["../../../src/lib/utils/creative-adapter.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"creative-adapter.js","sourceRoot":"","sources":["../../../src/lib/utils/creative-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 -9,9 +9,16 @@
|
|
|
9
9
|
* Normalize a single package's params for backward compatibility.
|
|
10
10
|
*
|
|
11
11
|
* Handles:
|
|
12
|
-
* - context.buyer_ref → buyer_ref (pre-4.15 servers require top-level buyer_ref)
|
|
13
12
|
* - optimization_goal (scalar) → optimization_goals (array)
|
|
14
13
|
* - catalog (scalar object) → catalogs (array)
|
|
14
|
+
*
|
|
15
|
+
* Does NOT copy `context.buyer_ref` up to a top-level `buyer_ref`. The top-level
|
|
16
|
+
* field was removed from the package schema in AdCP 3.0 and strict v3 receivers
|
|
17
|
+
* reject it. When a request routes to a v2.5 seller, the v2 adapter in
|
|
18
|
+
* `creative-adapter.ts` derives `buyer_ref` (from a caller-supplied value,
|
|
19
|
+
* `context.buyer_ref`, `idempotency_key`, or parent/index) — that adapter is
|
|
20
|
+
* gated on `serverVersion !== 'v3'`, so the field only lands on the wire for
|
|
21
|
+
* sellers that still expect it.
|
|
15
22
|
*/
|
|
16
23
|
export declare function normalizePackageParams(pkg: any): any;
|
|
17
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-normalizer.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/request-normalizer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH
|
|
1
|
+
{"version":3,"file":"request-normalizer.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/request-normalizer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAmDpD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,GAAG,EACX,IAAI,GAAE;IAAE,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAO,GAClF,GAAG,CAiJL"}
|
|
@@ -17,9 +17,16 @@ const idempotency_1 = require("./idempotency");
|
|
|
17
17
|
* Normalize a single package's params for backward compatibility.
|
|
18
18
|
*
|
|
19
19
|
* Handles:
|
|
20
|
-
* - context.buyer_ref → buyer_ref (pre-4.15 servers require top-level buyer_ref)
|
|
21
20
|
* - optimization_goal (scalar) → optimization_goals (array)
|
|
22
21
|
* - catalog (scalar object) → catalogs (array)
|
|
22
|
+
*
|
|
23
|
+
* Does NOT copy `context.buyer_ref` up to a top-level `buyer_ref`. The top-level
|
|
24
|
+
* field was removed from the package schema in AdCP 3.0 and strict v3 receivers
|
|
25
|
+
* reject it. When a request routes to a v2.5 seller, the v2 adapter in
|
|
26
|
+
* `creative-adapter.ts` derives `buyer_ref` (from a caller-supplied value,
|
|
27
|
+
* `context.buyer_ref`, `idempotency_key`, or parent/index) — that adapter is
|
|
28
|
+
* gated on `serverVersion !== 'v3'`, so the field only lands on the wire for
|
|
29
|
+
* sellers that still expect it.
|
|
23
30
|
*/
|
|
24
31
|
function normalizePackageParams(pkg) {
|
|
25
32
|
if (!pkg || typeof pkg !== 'object')
|
|
@@ -44,12 +51,6 @@ function normalizePackageParams(pkg) {
|
|
|
44
51
|
if (normalized.budget !== null && typeof normalized.budget === 'object') {
|
|
45
52
|
throw new errors_1.ValidationError('packages[].budget', normalized.budget, 'pre-3.0 shape not supported in AdCP 3.0. Use budget as a number instead.');
|
|
46
53
|
}
|
|
47
|
-
// context.buyer_ref → buyer_ref (backward compat for pre-4.15 AdCP servers)
|
|
48
|
-
// AdCP 4.15 moved buyer_ref into context, but older servers still require it
|
|
49
|
-
// at the top level. Copy it back so requests validate on both old and new servers.
|
|
50
|
-
if (normalized.context?.buyer_ref && !normalized.buyer_ref) {
|
|
51
|
-
normalized.buyer_ref = normalized.context.buyer_ref;
|
|
52
|
-
}
|
|
53
54
|
// optimization_goal (scalar) → optimization_goals (array)
|
|
54
55
|
if (normalized.optimization_goal && !normalized.optimization_goals?.length) {
|
|
55
56
|
(0, deprecation_1.warnOnce)('optimization_goal', 'PackageRequest.optimization_goal is deprecated. Use optimization_goals (array) instead.');
|
|
@@ -74,7 +75,7 @@ function normalizeRequestParams(taskType, params, opts = {}) {
|
|
|
74
75
|
if (!params) {
|
|
75
76
|
return params;
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
const normalized = { ...params };
|
|
78
79
|
// ── idempotency_key auto-generation ──
|
|
79
80
|
// Tasks that mutate state require a caller-supplied idempotency_key per
|
|
80
81
|
// AdCP spec. When the caller omits one, mint a fresh UUID v4. Most buyer
|
|
@@ -131,14 +132,11 @@ function normalizeRequestParams(taskType, params, opts = {}) {
|
|
|
131
132
|
'Use list_accounts to discover an existing account_id; ' +
|
|
132
133
|
'implicit-account sellers also support sync_accounts to register a new one.');
|
|
133
134
|
}
|
|
134
|
-
//
|
|
135
|
-
// AdCP
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
!normalized.buyer_ref) {
|
|
140
|
-
normalized.buyer_ref = normalized.context.buyer_ref;
|
|
141
|
-
}
|
|
135
|
+
// Top-level `buyer_ref` on create_media_buy / update_media_buy was removed
|
|
136
|
+
// from the AdCP request schema in 3.0. It is NOT derived from `context.buyer_ref`
|
|
137
|
+
// here — strict v3 receivers reject it as an unknown field. The v2.5 adapter in
|
|
138
|
+
// `creative-adapter.ts` performs the derivation for legacy servers only, gated
|
|
139
|
+
// on `serverVersion !== 'v3'`.
|
|
142
140
|
// ── Package normalization (create_media_buy, update_media_buy) ──
|
|
143
141
|
if ((taskType === 'create_media_buy' || taskType === 'update_media_buy') && Array.isArray(normalized.packages)) {
|
|
144
142
|
normalized.packages = normalized.packages.map(normalizePackageParams);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-normalizer.js","sourceRoot":"","sources":["../../../src/lib/utils/request-normalizer.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"request-normalizer.js","sourceRoot":"","sources":["../../../src/lib/utils/request-normalizer.ts"],"names":[],"mappings":";AA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CAAC;YAC5F,UAAU,CAAC,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC;QAClD,CAAC;QACD,OAAO,UAAU,CAAC,UAAU,CAAC;IAC/B,CAAC;IAED,4CAA4C;IAC5C,IAAI,QAAQ,KAAK,cAAc,EAAE,CAAC;QAChC,wDAAwD;QACxD,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;YAC5B,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC;QACpE,CAAC;QAED,4DAA4D;QAC5D,KAAK,MAAM,OAAO,IAAI,CAAC,UAAU,EAAE,aAAa,EAAE,aAAa,CAAU,EAAE,CAAC;YAC1E,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;gBAC1B,IAAA,sBAAQ,EAAC,gBAAgB,OAAO,EAAE,EAAE,sBAAsB,OAAO,0BAA0B,CAAC,CAAC;gBAC7F,OAAQ,UAAsC,CAAC,OAAO,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,6FAA6F;QAC7F,iDAAiD;QACjD,IAAI,UAAU,CAAC,iBAAiB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YACxD,UAAU,CAAC,OAAO,GAAG,IAAA,kCAAyB,EAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,UAAU,CAAC,iBAAiB,CAAC;IACtC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AdCP SDK library version
|
|
3
3
|
*/
|
|
4
|
-
export declare const LIBRARY_VERSION = "
|
|
4
|
+
export declare const LIBRARY_VERSION = "11.0.0";
|
|
5
5
|
/**
|
|
6
6
|
* AdCP specification version this library is built for
|
|
7
7
|
*/
|
|
@@ -33,10 +33,10 @@ export type AdcpVersion = (typeof COMPATIBLE_ADCP_VERSIONS)[number];
|
|
|
33
33
|
* Full version information
|
|
34
34
|
*/
|
|
35
35
|
export declare const VERSION_INFO: {
|
|
36
|
-
readonly library: "
|
|
36
|
+
readonly library: "11.0.0";
|
|
37
37
|
readonly adcp: "3.1.1";
|
|
38
38
|
readonly compatibleVersions: readonly ["v2.5", "v2.6", "v3", "3.0.0-beta.1", "3.0-beta.1", "3.0-beta", "3.0.0-beta.3", "3.0-beta.3", "3.0.0", "3.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4", "3.0.5", "3.0.6", "3.0.7", "3.0.8", "3.0.9", "3.0.10", "3.0.11", "3.0.12", "3.1.0", "3.1", "3.1.1"];
|
|
39
|
-
readonly generatedAt: "2026-07-
|
|
39
|
+
readonly generatedAt: "2026-07-07T19:57:47.370Z";
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
42
|
* Get the AdCP specification version this library is built for
|
package/dist/lib/version.js
CHANGED
|
@@ -12,7 +12,7 @@ exports.toReleasePrecisionVersion = toReleasePrecisionVersion;
|
|
|
12
12
|
/**
|
|
13
13
|
* AdCP SDK library version
|
|
14
14
|
*/
|
|
15
|
-
exports.LIBRARY_VERSION = '
|
|
15
|
+
exports.LIBRARY_VERSION = '11.0.0';
|
|
16
16
|
/**
|
|
17
17
|
* AdCP specification version this library is built for
|
|
18
18
|
*/
|
|
@@ -61,10 +61,10 @@ exports.COMPATIBLE_ADCP_VERSIONS = [
|
|
|
61
61
|
* Full version information
|
|
62
62
|
*/
|
|
63
63
|
exports.VERSION_INFO = {
|
|
64
|
-
library: '
|
|
64
|
+
library: '11.0.0',
|
|
65
65
|
adcp: '3.1.1',
|
|
66
66
|
compatibleVersions: exports.COMPATIBLE_ADCP_VERSIONS,
|
|
67
|
-
generatedAt: '2026-07-
|
|
67
|
+
generatedAt: '2026-07-07T19:57:47.370Z',
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
70
|
* Get the AdCP specification version this library is built for
|