@adcp/sdk 9.1.2 → 9.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +8 -8
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +9 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.js +2 -0
- package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
- package/dist/lib/server/test-controller.d.ts +4 -1
- package/dist/lib/server/test-controller.d.ts.map +1 -1
- package/dist/lib/server/test-controller.js +18 -0
- package/dist/lib/server/test-controller.js.map +1 -1
- package/dist/lib/testing/comply-controller.d.ts +8 -0
- package/dist/lib/testing/comply-controller.d.ts.map +1 -1
- package/dist/lib/testing/comply-controller.js +7 -0
- package/dist/lib/testing/comply-controller.js.map +1 -1
- package/dist/lib/testing/index.d.ts +1 -1
- package/dist/lib/testing/index.d.ts.map +1 -1
- package/dist/lib/testing/index.js.map +1 -1
- package/dist/lib/testing/storyboard/runner.d.ts +8 -5
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +106 -17
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/testing/storyboard/seeding.d.ts +1 -1
- package/dist/lib/testing/storyboard/seeding.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/seeding.js +20 -0
- package/dist/lib/testing/storyboard/seeding.js.map +1 -1
- package/dist/lib/testing/storyboard/types.d.ts +24 -10
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/types.js +1 -0
- package/dist/lib/testing/storyboard/types.js.map +1 -1
- package/dist/lib/v2/projection/augment-response.d.ts +67 -1
- package/dist/lib/v2/projection/augment-response.d.ts.map +1 -1
- package/dist/lib/v2/projection/augment-response.js +151 -1
- package/dist/lib/v2/projection/augment-response.js.map +1 -1
- package/dist/lib/v2/projection/index.d.ts +14 -4
- package/dist/lib/v2/projection/index.d.ts.map +1 -1
- package/dist/lib/v2/projection/index.js +16 -2
- package/dist/lib/v2/projection/index.js.map +1 -1
- package/dist/lib/v2/projection/types.d.ts +36 -0
- package/dist/lib/v2/projection/types.d.ts.map +1 -1
- package/dist/lib/v2/projection/v1-to-v2.d.ts +104 -1
- package/dist/lib/v2/projection/v1-to-v2.d.ts.map +1 -1
- package/dist/lib/v2/projection/v1-to-v2.js +107 -0
- package/dist/lib/v2/projection/v1-to-v2.js.map +1 -1
- package/dist/lib/validation/schema-loader.js +57 -0
- package/dist/lib/validation/schema-loader.js.map +1 -1
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"augment-response.js","sourceRoot":"","sources":["../../../../src/lib/v2/projection/augment-response.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"augment-response.js","sourceRoot":"","sources":["../../../../src/lib/v2/projection/augment-response.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAyCH,0EA8BC;AAgBD,8CAoBC;AAqDD,wDA2EC;AAaD,0DAuBC;AA5QD,yCAAkD;AAClD,2CAAgD;AAEhD,MAAM,MAAM,GAAG,aAAa,yBAAe,EAAE,CAAC;AAuB9C;;;;;;;;;;;GAWG;AACH,SAAgB,+BAA+B,CAC7C,OAAU;IAEV,0EAA0E;IAC1E,MAAM,QAAQ,GAAI,OAAmD,CAAC,cAAc,CAAC;IACrF,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO;YACL,OAAO,EAAE,O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,EAAE,CAAC,EAAE,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC;QAC9D,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,OAAO;QACL,QAAQ,EAAE,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAA2E;QACjH,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* v1 ↔ v2 Product projection layer (AdCP 3.1).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Public surfaces:
|
|
5
5
|
*
|
|
6
6
|
* - `projectV1ProductToV2` / `projectV2ProductToV1` — the symmetric
|
|
7
7
|
* core projections. Read a Product on one side, return a Product
|
|
8
8
|
* on the other plus structured diagnostics (`source: 'sdk'`,
|
|
9
9
|
* normative spec codes + SDK-local codes).
|
|
10
10
|
*
|
|
11
|
+
* - `resolveCanonicalFormatKind` / `canonicalDeclarationFromBareId` —
|
|
12
|
+
* resolve a single bare format-id string (no surrounding Product,
|
|
13
|
+
* no `agent_url`) to its canonical `format_kind` or full declaration.
|
|
14
|
+
* Registry- and catalog-backed; fails closed to `null`.
|
|
15
|
+
*
|
|
11
16
|
* - `withFormatOptions` / `augmentProductWithFormatOptions` —
|
|
12
17
|
* buyer-side response augmentation. Adds `format_options[]` to a
|
|
13
18
|
* v1-shaped get_products response so canonical-format-aware buyers
|
|
14
19
|
* can read the canonical model regardless of the seller's wire
|
|
15
20
|
* version. Additive — `format_ids[]` is preserved.
|
|
16
21
|
*
|
|
22
|
+
* - `toCanonicalOnlyProduct` / `toCanonicalOnlyResponse` — the
|
|
23
|
+
* read-side narrowing for a fully-migrated consumer. Returns
|
|
24
|
+
* `format_options[]` with `format_ids[]` dropped, surfacing a
|
|
25
|
+
* diagnostic for any ref that couldn't be carried over.
|
|
26
|
+
*
|
|
17
27
|
* - Catalog + registry primitives (`lookupV1Format`,
|
|
18
28
|
* `findCatalogEntryByCanonicalAndSize`, registry exports) for
|
|
19
29
|
* callers wiring projection into their own code paths.
|
|
@@ -22,11 +32,11 @@
|
|
|
22
32
|
* adopters migrating from local format metadata and `product_card.format_id`
|
|
23
33
|
* conventions to canonical creative formats.
|
|
24
34
|
*/
|
|
25
|
-
export { projectV1ProductToV2 } from './v1-to-v2';
|
|
26
|
-
export type { V1ToV2Result } from './v1-to-v2';
|
|
35
|
+
export { projectV1ProductToV2, canonicalDeclarationFromBareId, resolveCanonicalFormatKind } from './v1-to-v2';
|
|
36
|
+
export type { V1ToV2Result, BareFormatIdResolveOptions } from './v1-to-v2';
|
|
27
37
|
export { projectV2ProductToV1 } from './v2-to-v1';
|
|
28
38
|
export type { V2ToV1Result } from './v2-to-v1';
|
|
29
|
-
export { augmentProductWithFormatOptions, withFormatOptions, type V2AugmentedProduct } from './augment-response';
|
|
39
|
+
export { augmentProductWithFormatOptions, withFormatOptions, toCanonicalOnlyProduct, toCanonicalOnlyResponse, type V2AugmentedProduct, type CanonicalOnlyProduct, } from './augment-response';
|
|
30
40
|
export { CanonicalFormat, audioDaastFormatDeclaration, audioHostedFormatDeclaration, agentPlacementFormatDeclaration, canonicalFormatDeclaration, customFormatDeclaration, displayTagFormatDeclaration, formatRef, formatRefs, html5FormatDeclaration, imageCarouselFormatDeclaration, imageFormatDeclaration, nativeInFeedFormatDeclaration, productCard, productCardDetailed, responsiveCreativeFormatDeclaration, sponsoredPlacementFormatDeclaration, videoHostedFormatDeclaration, videoVastFormatDeclaration, type CanonicalFormatDeclaration, type CanonicalFormatDeclarationFields, type CanonicalFormatKind, type CanonicalFormatParams, type FormatReferenceInput, type ProductCardDetailedFields, type ProductCardFields, } from './builders';
|
|
31
41
|
export { packageRefsForFormatOptions, packageRefsForCapabilities, legacyFormatIdsFromOptions, tryLegacyFormatIdsFromOptions, legacyFormatIdsForFormatOption, legacyFormatIdsForCapability, FormatOptionRefsLookupError, CapabilityIdsLookupError, type PackageFormatRefs, type PackageCapabilityRefs, type FormatOptionRef, type FormatOptionSelector, type FormatOptionRefsLookupErrorCode, type CapabilityIdsLookupErrorCode, } from './write-side';
|
|
32
42
|
export type { V1FormatId, V2ProductFormatDeclaration, V2Product, V1Product, ProjectionDiagnostic } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/v2/projection/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/v2/projection/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAC9G,YAAY,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,4BAA4B,EAC5B,+BAA+B,EAC/B,0BAA0B,EAC1B,uBAAuB,EACvB,2BAA2B,EAC3B,SAAS,EACT,UAAU,EACV,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,6BAA6B,EAC7B,WAAW,EACX,mBAAmB,EACnB,mCAAmC,EACnC,mCAAmC,EACnC,4BAA4B,EAC5B,0BAA0B,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,6BAA6B,EAC7B,8BAA8B,EAC9B,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,GAClC,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,UAAU,EAAE,0BAA0B,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAElH,OAAO,EACL,WAAW,EACX,cAAc,EACd,kCAAkC,EAClC,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -2,19 +2,29 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* v1 ↔ v2 Product projection layer (AdCP 3.1).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Public surfaces:
|
|
6
6
|
*
|
|
7
7
|
* - `projectV1ProductToV2` / `projectV2ProductToV1` — the symmetric
|
|
8
8
|
* core projections. Read a Product on one side, return a Product
|
|
9
9
|
* on the other plus structured diagnostics (`source: 'sdk'`,
|
|
10
10
|
* normative spec codes + SDK-local codes).
|
|
11
11
|
*
|
|
12
|
+
* - `resolveCanonicalFormatKind` / `canonicalDeclarationFromBareId` —
|
|
13
|
+
* resolve a single bare format-id string (no surrounding Product,
|
|
14
|
+
* no `agent_url`) to its canonical `format_kind` or full declaration.
|
|
15
|
+
* Registry- and catalog-backed; fails closed to `null`.
|
|
16
|
+
*
|
|
12
17
|
* - `withFormatOptions` / `augmentProductWithFormatOptions` —
|
|
13
18
|
* buyer-side response augmentation. Adds `format_options[]` to a
|
|
14
19
|
* v1-shaped get_products response so canonical-format-aware buyers
|
|
15
20
|
* can read the canonical model regardless of the seller's wire
|
|
16
21
|
* version. Additive — `format_ids[]` is preserved.
|
|
17
22
|
*
|
|
23
|
+
* - `toCanonicalOnlyProduct` / `toCanonicalOnlyResponse` — the
|
|
24
|
+
* read-side narrowing for a fully-migrated consumer. Returns
|
|
25
|
+
* `format_options[]` with `format_ids[]` dropped, surfacing a
|
|
26
|
+
* diagnostic for any ref that couldn't be carried over.
|
|
27
|
+
*
|
|
18
28
|
* - Catalog + registry primitives (`lookupV1Format`,
|
|
19
29
|
* `findCatalogEntryByCanonicalAndSize`, registry exports) for
|
|
20
30
|
* callers wiring projection into their own code paths.
|
|
@@ -24,14 +34,18 @@
|
|
|
24
34
|
* conventions to canonical creative formats.
|
|
25
35
|
*/
|
|
26
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.isCanonicalV1Translatable = exports._resetCatalogCache = exports.parseSizedIdTemplate = exports.findCatalogEntryByCanonicalAndSize = exports.lookupV1Format = exports.loadCatalog = exports.CapabilityIdsLookupError = exports.FormatOptionRefsLookupError = exports.legacyFormatIdsForCapability = exports.legacyFormatIdsForFormatOption = exports.tryLegacyFormatIdsFromOptions = exports.legacyFormatIdsFromOptions = exports.packageRefsForCapabilities = exports.packageRefsForFormatOptions = exports.videoVastFormatDeclaration = exports.videoHostedFormatDeclaration = exports.sponsoredPlacementFormatDeclaration = exports.responsiveCreativeFormatDeclaration = exports.productCardDetailed = exports.productCard = exports.nativeInFeedFormatDeclaration = exports.imageFormatDeclaration = exports.imageCarouselFormatDeclaration = exports.html5FormatDeclaration = exports.formatRefs = exports.formatRef = exports.displayTagFormatDeclaration = exports.customFormatDeclaration = exports.canonicalFormatDeclaration = exports.agentPlacementFormatDeclaration = exports.audioHostedFormatDeclaration = exports.audioDaastFormatDeclaration = exports.CanonicalFormat = exports.withFormatOptions = exports.augmentProductWithFormatOptions = exports.projectV2ProductToV1 = exports.projectV1ProductToV2 = void 0;
|
|
37
|
+
exports.isCanonicalV1Translatable = exports._resetCatalogCache = exports.parseSizedIdTemplate = exports.findCatalogEntryByCanonicalAndSize = exports.lookupV1Format = exports.loadCatalog = exports.CapabilityIdsLookupError = exports.FormatOptionRefsLookupError = exports.legacyFormatIdsForCapability = exports.legacyFormatIdsForFormatOption = exports.tryLegacyFormatIdsFromOptions = exports.legacyFormatIdsFromOptions = exports.packageRefsForCapabilities = exports.packageRefsForFormatOptions = exports.videoVastFormatDeclaration = exports.videoHostedFormatDeclaration = exports.sponsoredPlacementFormatDeclaration = exports.responsiveCreativeFormatDeclaration = exports.productCardDetailed = exports.productCard = exports.nativeInFeedFormatDeclaration = exports.imageFormatDeclaration = exports.imageCarouselFormatDeclaration = exports.html5FormatDeclaration = exports.formatRefs = exports.formatRef = exports.displayTagFormatDeclaration = exports.customFormatDeclaration = exports.canonicalFormatDeclaration = exports.agentPlacementFormatDeclaration = exports.audioHostedFormatDeclaration = exports.audioDaastFormatDeclaration = exports.CanonicalFormat = exports.toCanonicalOnlyResponse = exports.toCanonicalOnlyProduct = exports.withFormatOptions = exports.augmentProductWithFormatOptions = exports.projectV2ProductToV1 = exports.resolveCanonicalFormatKind = exports.canonicalDeclarationFromBareId = exports.projectV1ProductToV2 = void 0;
|
|
28
38
|
var v1_to_v2_1 = require("./v1-to-v2");
|
|
29
39
|
Object.defineProperty(exports, "projectV1ProductToV2", { enumerable: true, get: function () { return v1_to_v2_1.projectV1ProductToV2; } });
|
|
40
|
+
Object.defineProperty(exports, "canonicalDeclarationFromBareId", { enumerable: true, get: function () { return v1_to_v2_1.canonicalDeclarationFromBareId; } });
|
|
41
|
+
Object.defineProperty(exports, "resolveCanonicalFormatKind", { enumerable: true, get: function () { return v1_to_v2_1.resolveCanonicalFormatKind; } });
|
|
30
42
|
var v2_to_v1_1 = require("./v2-to-v1");
|
|
31
43
|
Object.defineProperty(exports, "projectV2ProductToV1", { enumerable: true, get: function () { return v2_to_v1_1.projectV2ProductToV1; } });
|
|
32
44
|
var augment_response_1 = require("./augment-response");
|
|
33
45
|
Object.defineProperty(exports, "augmentProductWithFormatOptions", { enumerable: true, get: function () { return augment_response_1.augmentProductWithFormatOptions; } });
|
|
34
46
|
Object.defineProperty(exports, "withFormatOptions", { enumerable: true, get: function () { return augment_response_1.withFormatOptions; } });
|
|
47
|
+
Object.defineProperty(exports, "toCanonicalOnlyProduct", { enumerable: true, get: function () { return augment_response_1.toCanonicalOnlyProduct; } });
|
|
48
|
+
Object.defineProperty(exports, "toCanonicalOnlyResponse", { enumerable: true, get: function () { return augment_response_1.toCanonicalOnlyResponse; } });
|
|
35
49
|
var builders_1 = require("./builders");
|
|
36
50
|
Object.defineProperty(exports, "CanonicalFormat", { enumerable: true, get: function () { return builders_1.CanonicalFormat; } });
|
|
37
51
|
Object.defineProperty(exports, "audioDaastFormatDeclaration", { enumerable: true, get: function () { return builders_1.audioDaastFormatDeclaration; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/v2/projection/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/v2/projection/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;AAEH,uCAA8G;AAArG,gHAAA,oBAAoB,OAAA;AAAE,0HAAA,8BAA8B,OAAA;AAAE,sHAAA,0BAA0B,OAAA;AAGzF,uCAAkD;AAAzC,gHAAA,oBAAoB,OAAA;AAG7B,uDAO4B;AAN1B,mIAAA,+BAA+B,OAAA;AAC/B,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AACtB,2HAAA,uBAAuB,OAAA;AAKzB,uCA2BoB;AA1BlB,2GAAA,eAAe,OAAA;AACf,uHAAA,2BAA2B,OAAA;AAC3B,wHAAA,4BAA4B,OAAA;AAC5B,2HAAA,+BAA+B,OAAA;AAC/B,sHAAA,0BAA0B,OAAA;AAC1B,mHAAA,uBAAuB,OAAA;AACvB,uHAAA,2BAA2B,OAAA;AAC3B,qGAAA,SAAS,OAAA;AACT,sGAAA,UAAU,OAAA;AACV,kHAAA,sBAAsB,OAAA;AACtB,0HAAA,8BAA8B,OAAA;AAC9B,kHAAA,sBAAsB,OAAA;AACtB,yHAAA,6BAA6B,OAAA;AAC7B,uGAAA,WAAW,OAAA;AACX,+GAAA,mBAAmB,OAAA;AACnB,+HAAA,mCAAmC,OAAA;AACnC,+HAAA,mCAAmC,OAAA;AACnC,wHAAA,4BAA4B,OAAA;AAC5B,sHAAA,0BAA0B,OAAA;AAU5B,2CAesB;AAdpB,yHAAA,2BAA2B,OAAA;AAC3B,wHAAA,0BAA0B,OAAA;AAC1B,wHAAA,0BAA0B,OAAA;AAC1B,2HAAA,6BAA6B,OAAA;AAC7B,4HAAA,8BAA8B,OAAA;AAC9B,0HAAA,4BAA4B,OAAA;AAC5B,yHAAA,2BAA2B,OAAA;AAC3B,sHAAA,wBAAwB,OAAA;AAW1B,qCAQmB;AAPjB,sGAAA,WAAW,OAAA;AACX,yGAAA,cAAc,OAAA;AACd,6HAAA,kCAAkC,OAAA;AAClC,+GAAA,oBAAoB,OAAA;AACpB,6GAAA,kBAAkB,OAAA;AAKpB,+DAAmE;AAA1D,iIAAA,yBAAyB,OAAA"}
|
|
@@ -223,5 +223,41 @@ export type ProjectionDiagnostic = (ProjectionDiagnosticBase & {
|
|
|
223
223
|
};
|
|
224
224
|
};
|
|
225
225
|
};
|
|
226
|
+
}) | (ProjectionDiagnosticBase & {
|
|
227
|
+
/**
|
|
228
|
+
* SDK-local code: canonical-only projection (`toCanonicalOnlyProduct`
|
|
229
|
+
* / `toCanonicalOnlyResponse`) dropped a legacy `format_id` that no
|
|
230
|
+
* `format_options[].v1_format_ref` covers. Emitted only on the
|
|
231
|
+
* v2-native pass-through path — a seller that sent `format_options[]`
|
|
232
|
+
* directly but also carried a `format_ids[]` entry with no canonical
|
|
233
|
+
* representation. Without it, canonical-only mode would silently
|
|
234
|
+
* discard a format the buyer could still have acted on via the v1
|
|
235
|
+
* path.
|
|
236
|
+
*
|
|
237
|
+
* On the v1 → v2 projection path an unmappable ref is already
|
|
238
|
+
* surfaced as `FORMAT_PROJECTION_FAILED`; this code covers the gap
|
|
239
|
+
* the projection path can't see (no projection runs when the seller
|
|
240
|
+
* is already v2-native).
|
|
241
|
+
*/
|
|
242
|
+
code: 'LEGACY_FORMAT_ID_DROPPED_UNMAPPED';
|
|
243
|
+
error: {
|
|
244
|
+
details: {
|
|
245
|
+
product_id: string;
|
|
246
|
+
/**
|
|
247
|
+
* The full ref that was dropped, including the dimensional
|
|
248
|
+
* discriminators (`width` / `height` / `duration_ms`) when the
|
|
249
|
+
* input carried them — so a buyer can tell which variant of a
|
|
250
|
+
* multi-size/multi-duration family was lost and re-acquire it on
|
|
251
|
+
* the v1 path. Omitted keys mean the input ref carried no value.
|
|
252
|
+
*/
|
|
253
|
+
dropped_format_id: {
|
|
254
|
+
agent_url: string;
|
|
255
|
+
id: string;
|
|
256
|
+
width?: number;
|
|
257
|
+
height?: number;
|
|
258
|
+
duration_ms?: number;
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
};
|
|
226
262
|
});
|
|
227
263
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/v2/projection/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,MAAM,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AC1B;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,EAAE,wCAAwC,CAAC;IAC/C,KAAK,EAAE;QACL,OAAO,EAAE;YACP,WAAW,EAAE,mBAAmB,CAAC;YACjC,UAAU,EAAE,MAAM,CAAC;YACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAC1B,SAAS,EAAE,OAAO,GAAG,kBAAkB,CAAC;YACxC,oBAAoB,CAAC,EAAE,MAAM,CAAC;YAC9B;;;;;;eAMG;YACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;YAC7B,uBAAuB,CAAC,EAAE;gBAAE,KAAK,CAAC,EAAE,MAAM,CAAC;gBAAC,MAAM,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;SAC/D,CAAC;KACH,CAAC;CACH,CAAC,GACF,CAAC,wBAAwB,GAAG;IAC1B;;;;;;;;;;;;;;OAcG;IACH,IAAI,EAAE,mCAAmC,CAAC;IAC1C,KAAK,EAAE;QACL,OAAO,EAAE;YACP,UAAU,EAAE,MAAM,CAAC;YACnB;;;;;;eAMG;YACH,iBAAiB,EAAE;gBAAE,SAAS,EAAE,MAAM,CAAC;gBAAC,EAAE,EAAE,MAAM,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,CAAC;gBAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAAC,WAAW,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;SAC7G,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
* is the most adopter-relevant piece for actual creative
|
|
46
46
|
* submission flows and lands in a follow-up.
|
|
47
47
|
*/
|
|
48
|
-
import type { V1Product, V2Product, ProjectionDiagnostic } from './types';
|
|
48
|
+
import type { V1Product, V2Product, V2ProductFormatDeclaration, ProjectionDiagnostic, CanonicalFormatKind } from './types';
|
|
49
49
|
export interface V1ToV2Result {
|
|
50
50
|
v2: V2Product;
|
|
51
51
|
diagnostics: ProjectionDiagnostic[];
|
|
@@ -59,6 +59,109 @@ export interface V1ToV2Result {
|
|
|
59
59
|
* a v2-only buyer (the spec requires `format_options` to have
|
|
60
60
|
* `minItems: 1` when present). The function always returns a Product
|
|
61
61
|
* shape so adopters can inspect what got dropped via diagnostics.
|
|
62
|
+
*
|
|
63
|
+
* @see canonicalDeclarationFromBareId — resolve a single bare format-id
|
|
64
|
+
* string (no surrounding Product) to a declaration or `format_kind`.
|
|
62
65
|
*/
|
|
63
66
|
export declare function projectV1ProductToV2(v1: V1Product): V1ToV2Result;
|
|
67
|
+
export interface BareFormatIdResolveOptions {
|
|
68
|
+
/**
|
|
69
|
+
* `agent_url` to attach when lifting the bare `id` to a structured
|
|
70
|
+
* {@link V1FormatId} for resolution. Defaults to the canonical AAO host
|
|
71
|
+
* (`https://creative.adcontextprotocol.org/`) — the publisher of every
|
|
72
|
+
* AAO catalog id, and the source of essentially all bare ids persisted
|
|
73
|
+
* before the `{ agent_url, id }` convention. Override only when the bare
|
|
74
|
+
* id was minted under a different agent's catalog — for an AAO catalog id,
|
|
75
|
+
* leave this unset; passing a non-AAO `agentUrl` won't match the AAO-keyed
|
|
76
|
+
* catalog and resolves to `null`.
|
|
77
|
+
*/
|
|
78
|
+
agentUrl?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Asset-type disambiguator for an under-specified bare id. The AAO
|
|
81
|
+
* catalog names per-asset-type variants `<base>_<suffix>` (e.g.
|
|
82
|
+
* `display_300x250` → `display_300x250_image` / `_html` / `_generative`).
|
|
83
|
+
* A size-only bare id like `display_300x250` is genuinely ambiguous and
|
|
84
|
+
* resolves to `null` on its own; pass the asset type you already hold
|
|
85
|
+
* (an adopter's `format_type`) and the resolver retries the disambiguated
|
|
86
|
+
* catalog variant `<id>_<suffix>`.
|
|
87
|
+
*
|
|
88
|
+
* The vocabulary is the catalog asset type where it differs from the
|
|
89
|
+
* variant suffix (`javascript` → `_js`), otherwise the suffix itself
|
|
90
|
+
* (`image`, `html`, `generative`, `js`). Canonical-kind aliases are also
|
|
91
|
+
* accepted (`html5` → `html`, `display_tag` → `js`) for callers already
|
|
92
|
+
* holding a kind-like local value.
|
|
93
|
+
*
|
|
94
|
+
* Only consulted when the bare id does NOT resolve on its own (a real
|
|
95
|
+
* catalog id is authoritative). Still fails closed: if `<id>_<suffix>`
|
|
96
|
+
* is not a catalog entry, returns `null` — the hint narrows, it never
|
|
97
|
+
* fabricates.
|
|
98
|
+
*/
|
|
99
|
+
assetType?: string;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated Use `assetType`. Kept as a backwards-compatible alias for
|
|
102
|
+
* callers who adopted the initial helper surface before issue #2289.
|
|
103
|
+
*/
|
|
104
|
+
assetTypeHint?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolve a bare v1 format-id string to its full v2
|
|
108
|
+
* `ProductFormatDeclaration`, or `null` when the id has no canonical
|
|
109
|
+
* mapping.
|
|
110
|
+
*
|
|
111
|
+
* Adopters migrating off legacy format storage routinely hold a bare id
|
|
112
|
+
* (`display_300x250_image`, `video_standard_30s`) persisted before the
|
|
113
|
+
* `{ agent_url, id }` structured-ref convention. This lifts that bare id
|
|
114
|
+
* to a structured ref (via `agentUrl`, default the AAO host) and runs the
|
|
115
|
+
* exact resolution the v1 → v2 product projection uses — in the registry
|
|
116
|
+
* spec's `v1-canonical-mapping.json` resolution order:
|
|
117
|
+
*
|
|
118
|
+
* - AAO catalog `canonical:` annotation — the authoritative
|
|
119
|
+
* seller-asserted mapping (registry resolution-order step 2).
|
|
120
|
+
* - Registry `format_id_glob` literal match (registry resolution-order
|
|
121
|
+
* step 3) — future-proof; 3.1 ships zero literal globs, so this fires
|
|
122
|
+
* only when a future registry adds platform-specific literals.
|
|
123
|
+
*
|
|
124
|
+
* Fails closed: returns `null` — never a guess — when neither path
|
|
125
|
+
* resolves the id. That covers an unknown id, an under-specified id
|
|
126
|
+
* (`display_300x250`, which the catalog only carries as `_image` /
|
|
127
|
+
* `_html` / `_generative` variants), and a catalog entry the AAO has not
|
|
128
|
+
* yet annotated with a `canonical:`. Structural matching never
|
|
129
|
+
* contributes a kind: a bare id absent from the catalog carries no asset
|
|
130
|
+
* shape to match on, and a catalog entry lacking a `canonical:` fails
|
|
131
|
+
* closed before the structural step is reached.
|
|
132
|
+
*
|
|
133
|
+
* For an under-specified bare id, pass `assetType` (the asset type you
|
|
134
|
+
* already hold, such as an adopter's `format_type`) and the resolver retries
|
|
135
|
+
* the disambiguated catalog variant
|
|
136
|
+
* `<id>_<suffix>` — so the SDK owns the `_image` / `_html` suffix
|
|
137
|
+
* convention instead of every adopter re-deriving it. The hint is
|
|
138
|
+
* consulted only when the bare id doesn't resolve on its own, and still
|
|
139
|
+
* fails closed when the disambiguated id isn't a catalog entry.
|
|
140
|
+
*
|
|
141
|
+
* The returned declaration carries `v1_format_ref: [{ agent_url, id }]`
|
|
142
|
+
* (the resolved id — the disambiguated `<id>_<suffix>` when a hint
|
|
143
|
+
* applied), so adopters lift a bare id to a structured ref in one step
|
|
144
|
+
* (the pre-projection step the migration docs encourage).
|
|
145
|
+
*
|
|
146
|
+
* Like the rest of the projection layer, this requires the bundled AAO
|
|
147
|
+
* catalog + canonical-mapping registry; it throws (rather than returning
|
|
148
|
+
* `null`) only when those are missing from the install — a corrupted
|
|
149
|
+
* `@adcp/sdk` package, not a normal unresolved-id outcome.
|
|
150
|
+
*
|
|
151
|
+
* For just the `format_kind`, use {@link resolveCanonicalFormatKind}. For
|
|
152
|
+
* the structured diagnostic explaining *why* an id did not resolve, run
|
|
153
|
+
* it through {@link projectV1ProductToV2} inside a one-format product.
|
|
154
|
+
*/
|
|
155
|
+
export declare function canonicalDeclarationFromBareId(id: string, options?: BareFormatIdResolveOptions): V2ProductFormatDeclaration | null;
|
|
156
|
+
/**
|
|
157
|
+
* Resolve a bare v1 format-id string to its canonical `format_kind`, or
|
|
158
|
+
* `null` when the id has no canonical mapping. Registry- and
|
|
159
|
+
* catalog-backed: the single source of truth that replaces hand-rolled
|
|
160
|
+
* `inferFormatKindFromFormatId` heuristics adopters maintain locally.
|
|
161
|
+
*
|
|
162
|
+
* Thin projection of {@link canonicalDeclarationFromBareId} down to the
|
|
163
|
+
* `format_kind`; see it for the resolution order, fail-closed semantics,
|
|
164
|
+
* the `agentUrl` default, and the `assetType` disambiguator.
|
|
165
|
+
*/
|
|
166
|
+
export declare function resolveCanonicalFormatKind(id: string, options?: BareFormatIdResolveOptions): CanonicalFormatKind | null;
|
|
64
167
|
//# sourceMappingURL=v1-to-v2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1-to-v2.d.ts","sourceRoot":"","sources":["../../../../src/lib/v2/projection/v1-to-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"v1-to-v2.d.ts","sourceRoot":"","sources":["../../../../src/lib/v2/projection/v1-to-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,KAAK,EACV,SAAS,EAET,SAAS,EACT,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAQjB,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,SAAS,CAAC;IACd,WAAW,EAAE,oBAAoB,EAAE,CAAC;CACrC;AAwID;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,SAAS,GAAG,YAAY,CAoBhE;AAED,MAAM,WAAW,0BAA0B;IACzC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,8BAA8B,CAC5C,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,0BAA0B,GACnC,0BAA0B,GAAG,IAAI,CAwBnC;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,0BAA0B,GACnC,mBAAmB,GAAG,IAAI,CAE5B"}
|
|
@@ -48,8 +48,11 @@
|
|
|
48
48
|
*/
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.projectV1ProductToV2 = projectV1ProductToV2;
|
|
51
|
+
exports.canonicalDeclarationFromBareId = canonicalDeclarationFromBareId;
|
|
52
|
+
exports.resolveCanonicalFormatKind = resolveCanonicalFormatKind;
|
|
51
53
|
const registry_1 = require("./registry");
|
|
52
54
|
const catalog_1 = require("./catalog");
|
|
55
|
+
const constants_1 = require("./constants");
|
|
53
56
|
const version_1 = require("../../version");
|
|
54
57
|
const SDK_ID = `@adcp/sdk@${version_1.LIBRARY_VERSION}`;
|
|
55
58
|
/**
|
|
@@ -185,6 +188,9 @@ function projectFormatId(fid, productId, field) {
|
|
|
185
188
|
* a v2-only buyer (the spec requires `format_options` to have
|
|
186
189
|
* `minItems: 1` when present). The function always returns a Product
|
|
187
190
|
* shape so adopters can inspect what got dropped via diagnostics.
|
|
191
|
+
*
|
|
192
|
+
* @see canonicalDeclarationFromBareId — resolve a single bare format-id
|
|
193
|
+
* string (no surrounding Product) to a declaration or `format_kind`.
|
|
188
194
|
*/
|
|
189
195
|
function projectV1ProductToV2(v1) {
|
|
190
196
|
const format_options = [];
|
|
@@ -206,4 +212,105 @@ function projectV1ProductToV2(v1) {
|
|
|
206
212
|
};
|
|
207
213
|
return { v2: v2Product, diagnostics };
|
|
208
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Resolve a bare v1 format-id string to its full v2
|
|
217
|
+
* `ProductFormatDeclaration`, or `null` when the id has no canonical
|
|
218
|
+
* mapping.
|
|
219
|
+
*
|
|
220
|
+
* Adopters migrating off legacy format storage routinely hold a bare id
|
|
221
|
+
* (`display_300x250_image`, `video_standard_30s`) persisted before the
|
|
222
|
+
* `{ agent_url, id }` structured-ref convention. This lifts that bare id
|
|
223
|
+
* to a structured ref (via `agentUrl`, default the AAO host) and runs the
|
|
224
|
+
* exact resolution the v1 → v2 product projection uses — in the registry
|
|
225
|
+
* spec's `v1-canonical-mapping.json` resolution order:
|
|
226
|
+
*
|
|
227
|
+
* - AAO catalog `canonical:` annotation — the authoritative
|
|
228
|
+
* seller-asserted mapping (registry resolution-order step 2).
|
|
229
|
+
* - Registry `format_id_glob` literal match (registry resolution-order
|
|
230
|
+
* step 3) — future-proof; 3.1 ships zero literal globs, so this fires
|
|
231
|
+
* only when a future registry adds platform-specific literals.
|
|
232
|
+
*
|
|
233
|
+
* Fails closed: returns `null` — never a guess — when neither path
|
|
234
|
+
* resolves the id. That covers an unknown id, an under-specified id
|
|
235
|
+
* (`display_300x250`, which the catalog only carries as `_image` /
|
|
236
|
+
* `_html` / `_generative` variants), and a catalog entry the AAO has not
|
|
237
|
+
* yet annotated with a `canonical:`. Structural matching never
|
|
238
|
+
* contributes a kind: a bare id absent from the catalog carries no asset
|
|
239
|
+
* shape to match on, and a catalog entry lacking a `canonical:` fails
|
|
240
|
+
* closed before the structural step is reached.
|
|
241
|
+
*
|
|
242
|
+
* For an under-specified bare id, pass `assetType` (the asset type you
|
|
243
|
+
* already hold, such as an adopter's `format_type`) and the resolver retries
|
|
244
|
+
* the disambiguated catalog variant
|
|
245
|
+
* `<id>_<suffix>` — so the SDK owns the `_image` / `_html` suffix
|
|
246
|
+
* convention instead of every adopter re-deriving it. The hint is
|
|
247
|
+
* consulted only when the bare id doesn't resolve on its own, and still
|
|
248
|
+
* fails closed when the disambiguated id isn't a catalog entry.
|
|
249
|
+
*
|
|
250
|
+
* The returned declaration carries `v1_format_ref: [{ agent_url, id }]`
|
|
251
|
+
* (the resolved id — the disambiguated `<id>_<suffix>` when a hint
|
|
252
|
+
* applied), so adopters lift a bare id to a structured ref in one step
|
|
253
|
+
* (the pre-projection step the migration docs encourage).
|
|
254
|
+
*
|
|
255
|
+
* Like the rest of the projection layer, this requires the bundled AAO
|
|
256
|
+
* catalog + canonical-mapping registry; it throws (rather than returning
|
|
257
|
+
* `null`) only when those are missing from the install — a corrupted
|
|
258
|
+
* `@adcp/sdk` package, not a normal unresolved-id outcome.
|
|
259
|
+
*
|
|
260
|
+
* For just the `format_kind`, use {@link resolveCanonicalFormatKind}. For
|
|
261
|
+
* the structured diagnostic explaining *why* an id did not resolve, run
|
|
262
|
+
* it through {@link projectV1ProductToV2} inside a one-format product.
|
|
263
|
+
*/
|
|
264
|
+
function canonicalDeclarationFromBareId(id, options) {
|
|
265
|
+
if (!id)
|
|
266
|
+
return null;
|
|
267
|
+
const agentUrl = options?.agentUrl ?? constants_1.AAO_CANONICAL_AGENT_URL;
|
|
268
|
+
// A real catalog id is authoritative — resolve it directly first.
|
|
269
|
+
const direct = projectFormatId({ agent_url: agentUrl, id }, `<bare:${id}>`, `bareFormatId(${id})`).decl;
|
|
270
|
+
if (direct)
|
|
271
|
+
return direct;
|
|
272
|
+
// Under-specified bare id + an asset-type hint: retry the disambiguated
|
|
273
|
+
// catalog variant `<id>_<suffix>`. Fails closed if that isn't a catalog
|
|
274
|
+
// entry either — the hint narrows, it never fabricates.
|
|
275
|
+
const assetType = options?.assetType ?? options?.assetTypeHint;
|
|
276
|
+
const suffix = assetType ? normalizeAssetTypeSuffix(assetType) : '';
|
|
277
|
+
if (suffix) {
|
|
278
|
+
const disambiguated = `${id}_${suffix}`;
|
|
279
|
+
const hinted = projectFormatId({ agent_url: agentUrl, id: disambiguated }, `<bare:${disambiguated}>`, `bareFormatId(${disambiguated})`).decl;
|
|
280
|
+
if (hinted)
|
|
281
|
+
return hinted;
|
|
282
|
+
}
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Map an `assetType` to the AAO catalog's `<base>_<suffix>` suffix.
|
|
287
|
+
* Catalog asset type `javascript` and canonical-kind names that differ from
|
|
288
|
+
* their suffix (`html5`, `display_tag`) are aliased. Any other value is passed
|
|
289
|
+
* through lowercased so a future asset type or suffix resolves without a code
|
|
290
|
+
* change — an unknown value simply misses the catalog and the caller fails
|
|
291
|
+
* closed.
|
|
292
|
+
*/
|
|
293
|
+
function normalizeAssetTypeSuffix(hint) {
|
|
294
|
+
const h = hint.trim().toLowerCase();
|
|
295
|
+
if (h === 'html5')
|
|
296
|
+
return 'html';
|
|
297
|
+
if (h === 'javascript')
|
|
298
|
+
return 'js';
|
|
299
|
+
if (h === 'display_tag')
|
|
300
|
+
return 'js';
|
|
301
|
+
return h;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Resolve a bare v1 format-id string to its canonical `format_kind`, or
|
|
305
|
+
* `null` when the id has no canonical mapping. Registry- and
|
|
306
|
+
* catalog-backed: the single source of truth that replaces hand-rolled
|
|
307
|
+
* `inferFormatKindFromFormatId` heuristics adopters maintain locally.
|
|
308
|
+
*
|
|
309
|
+
* Thin projection of {@link canonicalDeclarationFromBareId} down to the
|
|
310
|
+
* `format_kind`; see it for the resolution order, fail-closed semantics,
|
|
311
|
+
* the `agentUrl` default, and the `assetType` disambiguator.
|
|
312
|
+
*/
|
|
313
|
+
function resolveCanonicalFormatKind(id, options) {
|
|
314
|
+
return canonicalDeclarationFromBareId(id, options)?.format_kind ?? null;
|
|
315
|
+
}
|
|
209
316
|
//# sourceMappingURL=v1-to-v2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1-to-v2.js","sourceRoot":"","sources":["../../../../src/lib/v2/projection/v1-to-v2.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;;
|
|
1
|
+
{"version":3,"file":"v1-to-v2.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AAI,MAAM,EAAE,CAAC;QACX,MAAM,aAAa,GAAG,GAAG,EAAE,IAAI,MAAM,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,eAAe,CAC5B,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,EAAE,EAC1C,SAAS,aAAa,GAAG,EACzB,gBAAgB,aAAa,GAAG,CACjC,CAAC,IAAI,CAAC;QACP,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;IAC5B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,wBAAwB,CAAC,IAAY;IAC5C,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACpC,IAAI,CAAC,KAAK,OAAO;QAAE,OAAO,MAAM,CAAC;IACjC,IAAI,CAAC,KAAK,YAAY;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,CAAC,KAAK,aAAa;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,0BAA0B,CACxC,EAAU,EACV,OAAoC;IAEpC,OAAO,8BAA8B,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,IAAI,IAAI,CAAC;AAC1E,CAAC"}
|
|
@@ -31,6 +31,7 @@ exports.getRegisteredSchemaIds = getRegisteredSchemaIds;
|
|
|
31
31
|
exports.hasSchemaBundle = hasSchemaBundle;
|
|
32
32
|
exports._resetValidationLoader = _resetValidationLoader;
|
|
33
33
|
exports.schemaAllowsTopLevelField = schemaAllowsTopLevelField;
|
|
34
|
+
exports.getSchemaDefaultByPath = getSchemaDefaultByPath;
|
|
34
35
|
const ajv_1 = __importDefault(require("ajv"));
|
|
35
36
|
const ajv_formats_1 = __importDefault(require("ajv-formats"));
|
|
36
37
|
const async_hooks_1 = require("async_hooks");
|
|
@@ -948,4 +949,60 @@ function schemaAllowsTopLevelField(toolName, field, version = version_1.ADCP_VER
|
|
|
948
949
|
return true;
|
|
949
950
|
}
|
|
950
951
|
}
|
|
952
|
+
/**
|
|
953
|
+
* Resolve a JSON Schema `default` value by walking a dot-separated property
|
|
954
|
+
* path through a schema's nested `properties` maps.
|
|
955
|
+
*
|
|
956
|
+
* This intentionally does not instantiate AJV's `useDefaults` mutation mode.
|
|
957
|
+
* Callers decide when a schema default is semantically meaningful for their
|
|
958
|
+
* runtime object; this helper only reports what the bundled schema declares.
|
|
959
|
+
*
|
|
960
|
+
* Fails closed (`undefined`) when the schema is unavailable, the path is not a
|
|
961
|
+
* concrete properties path, or the target schema node has no `default`.
|
|
962
|
+
*
|
|
963
|
+
* @internal — not part of the public API surface; may change without a major bump.
|
|
964
|
+
*/
|
|
965
|
+
function getSchemaDefaultByPath(schemaRef, dottedPath, version = version_1.ADCP_VERSION) {
|
|
966
|
+
try {
|
|
967
|
+
const s = ensureInit(version);
|
|
968
|
+
const normalized = normalizeSchemaRef(schemaRef);
|
|
969
|
+
if (!normalized)
|
|
970
|
+
return undefined;
|
|
971
|
+
const cacheKey = `schema-ref::${normalized}`;
|
|
972
|
+
const file = path_1.default.join(s.root, normalized);
|
|
973
|
+
if (!(0, fs_1.existsSync)(file))
|
|
974
|
+
return undefined;
|
|
975
|
+
let schema = s.rawSchemas.get(cacheKey);
|
|
976
|
+
if (!schema) {
|
|
977
|
+
schema = loadJson(file);
|
|
978
|
+
s.rawSchemas.set(cacheKey, schema);
|
|
979
|
+
}
|
|
980
|
+
const node = resolveSchemaPropertyPath(schema, dottedPath);
|
|
981
|
+
if (!node || !Object.prototype.hasOwnProperty.call(node, 'default'))
|
|
982
|
+
return undefined;
|
|
983
|
+
return cloneJsonValue(node.default);
|
|
984
|
+
}
|
|
985
|
+
catch {
|
|
986
|
+
return undefined;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
function resolveSchemaPropertyPath(schema, dottedPath) {
|
|
990
|
+
let current = schema;
|
|
991
|
+
for (const key of dottedPath.split('.')) {
|
|
992
|
+
if (!current || typeof current !== 'object')
|
|
993
|
+
return undefined;
|
|
994
|
+
const props = current.properties;
|
|
995
|
+
if (!props || typeof props !== 'object')
|
|
996
|
+
return undefined;
|
|
997
|
+
if (!Object.prototype.hasOwnProperty.call(props, key))
|
|
998
|
+
return undefined;
|
|
999
|
+
current = props[key];
|
|
1000
|
+
}
|
|
1001
|
+
return current && typeof current === 'object' ? current : undefined;
|
|
1002
|
+
}
|
|
1003
|
+
function cloneJsonValue(value) {
|
|
1004
|
+
if (value === null || typeof value !== 'object')
|
|
1005
|
+
return value;
|
|
1006
|
+
return JSON.parse(JSON.stringify(value));
|
|
1007
|
+
}
|
|
951
1008
|
//# sourceMappingURL=schema-loader.js.map
|