@adcp/sdk 17.0.0-beta.1 → 17.0.0-beta.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/adapters/keyed-account-store.js +1 -1
- package/dist/lib/adapters/keyed-account-store.mjs +1 -1
- package/dist/lib/adapters/version/3.0/brand-fields.d.mts +7 -1
- package/dist/lib/adapters/version/3.0/brand-fields.d.ts +7 -1
- package/dist/lib/adapters/version/3.0/brand-fields.js +139 -3
- package/dist/lib/adapters/version/3.0/brand-fields.mjs +136 -2
- package/dist/lib/adapters/version/3.0/index.js +6 -0
- package/dist/lib/adapters/version/3.0/index.mjs +7 -1
- package/dist/lib/adapters/version/types.d.mts +5 -0
- package/dist/lib/adapters/version/types.d.ts +5 -0
- package/dist/lib/canonical-references/index.js +2 -0
- package/dist/lib/canonical-references/index.mjs +2 -0
- package/dist/lib/client/account-changes.d.mts +3 -1
- package/dist/lib/client/account-changes.d.ts +3 -1
- package/dist/lib/client/account-changes.js +22 -2
- package/dist/lib/client/account-changes.mjs +22 -2
- package/dist/lib/conformance/oracle.js +3 -2
- package/dist/lib/conformance/oracle.mjs +3 -2
- package/dist/lib/core/AgentClient.d.mts +165 -1
- package/dist/lib/core/AgentClient.d.ts +165 -1
- package/dist/lib/core/AgentClient.js +446 -8
- package/dist/lib/core/AgentClient.mjs +446 -8
- package/dist/lib/core/ConversationTypes.d.mts +8 -0
- package/dist/lib/core/ConversationTypes.d.ts +8 -0
- package/dist/lib/core/ProtocolResponseParser.d.mts +1 -1
- package/dist/lib/core/ProtocolResponseParser.d.ts +1 -1
- package/dist/lib/core/ProtocolResponseParser.js +28 -18
- package/dist/lib/core/ProtocolResponseParser.mjs +11 -1
- package/dist/lib/core/SingleAgentClient.d.mts +115 -2
- package/dist/lib/core/SingleAgentClient.d.ts +115 -2
- package/dist/lib/core/SingleAgentClient.js +547 -67
- package/dist/lib/core/SingleAgentClient.mjs +534 -54
- package/dist/lib/core/TaskExecutor.d.mts +7 -0
- package/dist/lib/core/TaskExecutor.d.ts +7 -0
- package/dist/lib/core/TaskExecutor.js +18 -5
- package/dist/lib/core/TaskExecutor.mjs +18 -5
- package/dist/lib/core/task-status.d.mts +2 -0
- package/dist/lib/core/task-status.d.ts +2 -0
- package/dist/lib/core/task-status.js +11 -2
- package/dist/lib/core/task-status.mjs +9 -1
- package/dist/lib/identity-3.3/trust.d.mts +1 -4
- package/dist/lib/identity-3.3/trust.d.ts +1 -4
- package/dist/lib/identity-3.3/trust.js +34 -21
- package/dist/lib/identity-3.3/trust.mjs +34 -21
- package/dist/lib/identity-3.3/validation.js +5 -3
- package/dist/lib/identity-3.3/validation.mjs +6 -4
- package/dist/lib/index.d.mts +6 -52
- package/dist/lib/index.d.ts +6 -52
- package/dist/lib/index.js +11 -0
- package/dist/lib/index.mjs +7 -0
- package/dist/lib/media-buy/compatibility.js +6 -1
- package/dist/lib/media-buy/compatibility.mjs +6 -1
- package/dist/lib/protocols/mcp-scope.d.mts +3 -0
- package/dist/lib/protocols/mcp-scope.d.ts +3 -0
- package/dist/lib/protocols/mcp-scope.js +8 -3
- package/dist/lib/protocols/mcp-scope.mjs +8 -3
- package/dist/lib/reporting/inspection.js +1 -0
- package/dist/lib/reporting/inspection.mjs +1 -0
- package/dist/lib/reporting/ledger/coverage.d.mts +5 -0
- package/dist/lib/reporting/ledger/coverage.d.ts +5 -0
- package/dist/lib/reporting/ledger/coverage.js +37 -3
- package/dist/lib/reporting/ledger/coverage.mjs +36 -3
- package/dist/lib/reporting/ledger/handler.js +7 -4
- package/dist/lib/reporting/ledger/handler.mjs +7 -4
- package/dist/lib/reporting/ledger/producer.js +215 -69
- package/dist/lib/reporting/ledger/producer.mjs +217 -70
- package/dist/lib/reporting/ledger/schedule.d.mts +2 -2
- package/dist/lib/reporting/ledger/schedule.d.ts +2 -2
- package/dist/lib/reporting/ledger/schedule.js +8 -5
- package/dist/lib/reporting/ledger/schedule.mjs +8 -5
- package/dist/lib/reporting/ledger/status-ingest.d.mts +1 -1
- package/dist/lib/reporting/ledger/status-ingest.d.ts +1 -1
- package/dist/lib/reporting/ledger/status-ingest.js +4 -3
- package/dist/lib/reporting/ledger/status-ingest.mjs +4 -3
- package/dist/lib/reporting/ledger/types.d.mts +36 -1
- package/dist/lib/reporting/ledger/types.d.ts +36 -1
- package/dist/lib/reporting/service/index.d.mts +14 -1
- package/dist/lib/reporting/service/index.d.ts +14 -1
- package/dist/lib/reporting/service/index.js +24 -12
- package/dist/lib/reporting/service/index.mjs +24 -12
- package/dist/lib/schemas/browser.d.mts +2 -0
- package/dist/lib/schemas/browser.d.ts +2 -0
- package/dist/lib/schemas/browser.js +3 -0
- package/dist/lib/schemas/browser.mjs +2 -0
- package/dist/lib/schemas/index.d.mts +5 -3
- package/dist/lib/schemas/index.d.ts +5 -3
- package/dist/lib/schemas/index.js +5 -0
- package/dist/lib/schemas/index.mjs +4 -0
- package/dist/lib/server/account-response-identity.d.mts +17 -0
- package/dist/lib/server/account-response-identity.d.ts +17 -0
- package/dist/lib/server/account-response-identity.js +52 -0
- package/dist/lib/server/account-response-identity.mjs +28 -0
- package/dist/lib/server/account-sync-contract.js +2 -2
- package/dist/lib/server/account-sync-contract.mjs +2 -2
- package/dist/lib/server/create-adcp-server.js +33 -20
- package/dist/lib/server/create-adcp-server.mjs +36 -12
- package/dist/lib/server/decisioning/account.d.mts +36 -10
- package/dist/lib/server/decisioning/account.d.ts +36 -10
- package/dist/lib/server/decisioning/account.js +33 -14
- package/dist/lib/server/decisioning/account.mjs +33 -14
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +5 -5
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +5 -5
- package/dist/lib/server/decisioning/runtime/from-platform.js +4 -4
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +4 -4
- package/dist/lib/server/media-buy-store.d.mts +26 -12
- package/dist/lib/server/media-buy-store.d.ts +26 -12
- package/dist/lib/server/media-buy-store.js +69 -21
- package/dist/lib/server/media-buy-store.mjs +69 -21
- package/dist/lib/server/notification-subscriptions/runtime.d.mts +1 -1
- package/dist/lib/server/notification-subscriptions/runtime.d.ts +1 -1
- package/dist/lib/server/notification-subscriptions/runtime.js +4 -0
- package/dist/lib/server/notification-subscriptions/runtime.mjs +4 -0
- package/dist/lib/server/responses.js +9 -1
- package/dist/lib/server/responses.mjs +9 -1
- package/dist/lib/signing/agent-fetch.d.mts +1 -1
- package/dist/lib/signing/agent-fetch.d.ts +1 -1
- package/dist/lib/signing/agent-fetch.js +3 -3
- package/dist/lib/signing/agent-fetch.mjs +3 -3
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +60 -14
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +60 -14
- package/dist/lib/testing/storyboard/compliance.d.mts +2 -5
- package/dist/lib/testing/storyboard/compliance.d.ts +2 -5
- package/dist/lib/testing/storyboard/compliance.js +62 -13
- package/dist/lib/testing/storyboard/compliance.mjs +63 -14
- package/dist/lib/testing/storyboard/request-signing/vector-loader.d.mts +2 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.d.ts +2 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.js +11 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +10 -0
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/types/accept-proposal.d.ts +20 -28
- package/dist/lib/types/asset-instances.d.mts +1 -1
- package/dist/lib/types/asset-instances.d.ts +1 -1
- package/dist/lib/types/buy-products.d.ts +20 -28
- package/dist/lib/types/check-governance.d.ts +20 -28
- package/dist/lib/types/comply-test-controller.d.ts +20 -28
- package/dist/lib/types/control-media-buy.d.ts +20 -28
- package/dist/lib/types/core.generated.d.mts +273 -184
- package/dist/lib/types/core.generated.d.ts +273 -184
- package/dist/lib/types/create-media-buy.d.ts +20 -28
- package/dist/lib/types/get-media-buys.d.ts +20 -28
- package/dist/lib/types/get-products.d.ts +20 -28
- package/dist/lib/types/index.d.mts +6 -1
- package/dist/lib/types/index.d.ts +6 -1
- package/dist/lib/types/index.js +6 -1
- package/dist/lib/types/index.mjs +4 -1
- package/dist/lib/types/inline-enums.generated.d.mts +30 -4
- package/dist/lib/types/inline-enums.generated.d.ts +30 -4
- package/dist/lib/types/inline-enums.generated.js +41 -2
- package/dist/lib/types/inline-enums.generated.mjs +28 -2
- package/dist/lib/types/list-products.d.ts +20 -28
- package/dist/lib/types/list-proposals.d.ts +20 -28
- package/dist/lib/types/media-buy-delivery-report.d.mts +6 -0
- package/dist/lib/types/media-buy-delivery-report.d.ts +6 -0
- package/dist/lib/types/media-buy-delivery-report.js +16 -0
- package/dist/lib/types/media-buy-delivery-report.mjs +0 -0
- package/dist/lib/types/refine-proposals.d.ts +20 -28
- package/dist/lib/types/request-proposals.d.ts +20 -28
- package/dist/lib/types/schemas.generated.d.ts +63113 -127273
- package/dist/lib/types/schemas.generated.js +759 -770
- package/dist/lib/types/schemas.generated.mjs +759 -770
- package/dist/lib/types/targeting-keys.generated.d.mts +4 -0
- package/dist/lib/types/targeting-keys.generated.d.ts +4 -0
- package/dist/lib/types/targeting-keys.generated.js +109 -0
- package/dist/lib/types/targeting-keys.generated.mjs +84 -0
- package/dist/lib/types/tools.generated.d.mts +2 -68
- package/dist/lib/types/tools.generated.d.ts +2 -68
- package/dist/lib/types/update-media-buy.d.ts +20 -28
- package/dist/lib/utils/adcp-version-config.js +5 -2
- package/dist/lib/utils/adcp-version-config.mjs +5 -2
- package/dist/lib/utils/response-unwrapper.js +6 -1
- package/dist/lib/utils/response-unwrapper.mjs +6 -1
- package/dist/lib/v2/format-schema/resolver.js +1 -1
- package/dist/lib/v2/format-schema/resolver.mjs +1 -1
- package/dist/lib/v2/projection/creative-delivery.js +104 -29
- package/dist/lib/v2/projection/creative-delivery.mjs +108 -29
- package/dist/lib/v2/projection/index.d.mts +1 -0
- package/dist/lib/v2/projection/index.d.ts +1 -0
- package/dist/lib/v2/projection/index.js +3 -0
- package/dist/lib/v2/projection/index.mjs +2 -0
- package/dist/lib/v2/projection/legacy-metadata.d.mts +19 -0
- package/dist/lib/v2/projection/legacy-metadata.d.ts +19 -0
- package/dist/lib/v2/projection/legacy-metadata.js +91 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs +86 -0
- package/dist/lib/v2/projection/v1-to-v2.d.mts +1 -1
- package/dist/lib/v2/projection/v1-to-v2.d.ts +1 -1
- package/dist/lib/v2/projection/v1-to-v2.js +12 -9
- package/dist/lib/v2/projection/v1-to-v2.mjs +12 -9
- package/dist/lib/validation/budget-allocation.d.mts +3 -3
- package/dist/lib/validation/budget-allocation.d.ts +3 -3
- package/dist/lib/validation/compact-schema.d.mts +27 -0
- package/dist/lib/validation/compact-schema.d.ts +27 -0
- package/dist/lib/validation/compact-schema.js +276 -0
- package/dist/lib/validation/compact-schema.mjs +250 -0
- package/dist/lib/validation/media-buy-delivery-report.d.mts +8 -0
- package/dist/lib/validation/media-buy-delivery-report.d.ts +8 -0
- package/dist/lib/validation/media-buy-delivery-report.js +31 -0
- package/dist/lib/validation/media-buy-delivery-report.mjs +7 -0
- package/dist/lib/validation/nonempty-array.d.mts +15 -0
- package/dist/lib/validation/nonempty-array.d.ts +15 -0
- package/dist/lib/validation/nonempty-array.js +41 -0
- package/dist/lib/validation/nonempty-array.mjs +7 -0
- package/dist/lib/validation/schema-diagnostic-origins.d.mts +21 -0
- package/dist/lib/validation/schema-diagnostic-origins.d.ts +21 -0
- package/dist/lib/validation/schema-diagnostic-origins.js +193 -0
- package/dist/lib/validation/schema-diagnostic-origins.mjs +169 -0
- package/dist/lib/validation/schema-loader.js +86 -16
- package/dist/lib/validation/schema-loader.mjs +82 -16
- package/dist/lib/validation/schema-validator.d.mts +10 -19
- package/dist/lib/validation/schema-validator.d.ts +10 -19
- package/dist/lib/validation/schema-validator.js +135 -42
- package/dist/lib/validation/schema-validator.mjs +139 -43
- package/dist/lib/validation/sync-creatives.d.mts +22 -22
- package/dist/lib/validation/sync-creatives.d.ts +22 -22
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/dist/lib/webhooks/index.d.mts +3 -0
- package/dist/lib/webhooks/index.d.ts +3 -0
- package/dist/lib/webhooks/index.js +3 -0
- package/dist/lib/webhooks/index.mjs +2 -0
- package/dist/lib/webhooks/media-buy-delivery.d.mts +43 -0
- package/dist/lib/webhooks/media-buy-delivery.d.ts +43 -0
- package/dist/lib/webhooks/media-buy-delivery.js +119 -0
- package/dist/lib/webhooks/media-buy-delivery.mjs +94 -0
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/DELIVERY-WEBHOOK-PARSING.md +142 -0
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +15 -0
- package/docs/guides/REPORTING-LEDGER.md +93 -0
- package/docs/guides/REPORTING-STABILITY.md +1 -1
- package/docs/guides/TYPED-CLIENT-TOOLS.md +49 -0
- package/docs/llms.txt +2 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-16-to-17.md +191 -14
- package/docs/migration-6.6-to-6.7.md +14 -0
- package/docs/migration-account-change-feed.md +15 -0
- package/docs/recipes/verifying-inbound-webhooks.md +18 -2
- package/package.json +2 -2
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import type { ProductFormatDeclaration } from '../../types/tools.generated';
|
|
2
2
|
import type { V1FormatId, V2ProductFormatDeclaration } from './types';
|
|
3
|
+
import type { VersionDrift } from '../../adapters/version/types';
|
|
4
|
+
type Json = Record<string, unknown>;
|
|
5
|
+
export interface LegacyPixelTracker {
|
|
6
|
+
asset: Json;
|
|
7
|
+
assetId: string;
|
|
8
|
+
lostFields: string[];
|
|
9
|
+
}
|
|
10
|
+
/** Apply the AdCP 3.1 pixel-tracker schema's normative 3.0 downgrade table. */
|
|
11
|
+
export declare function downgradePixelTracker(value: unknown): LegacyPixelTracker | undefined;
|
|
12
|
+
export declare function pixelTrackerDrift(path: string, tracker: LegacyPixelTracker): VersionDrift | undefined;
|
|
13
|
+
/** Keep delivery advisories out of creative JSON sent to the seller. */
|
|
14
|
+
export declare function rememberCreativeDeliveryDiagnostics(value: object, entries: readonly VersionDrift[]): void;
|
|
15
|
+
export declare function transferCreativeDeliveryDiagnostics(source: object, target: object): void;
|
|
16
|
+
/**
|
|
17
|
+
* Read advisories from a projected creative or a sync/create/update request.
|
|
18
|
+
* Pure projection callers can surface these alongside the returned wire object.
|
|
19
|
+
* SingleAgentClient includes them in the task's debug logs automatically.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCreativeDeliveryDiagnostics(value: unknown): VersionDrift[];
|
|
3
22
|
/**
|
|
4
23
|
* SDK-private projection metadata held out-of-band. WeakMaps keep seller
|
|
5
24
|
* origin evidence and legacy routing identifiers absent from canonical objects
|
|
@@ -20,8 +20,12 @@ var legacy_metadata_exports = {};
|
|
|
20
20
|
__export(legacy_metadata_exports, {
|
|
21
21
|
concealLegacyFormatRefs: () => concealLegacyFormatRefs,
|
|
22
22
|
concealSelectedFormatOptions: () => concealSelectedFormatOptions,
|
|
23
|
+
downgradePixelTracker: () => downgradePixelTracker,
|
|
24
|
+
getCreativeDeliveryDiagnostics: () => getCreativeDeliveryDiagnostics,
|
|
23
25
|
isSynthesizedFormatOption: () => isSynthesizedFormatOption,
|
|
24
26
|
legacyFormatRefsForDeclaration: () => legacyFormatRefsForDeclaration,
|
|
27
|
+
pixelTrackerDrift: () => pixelTrackerDrift,
|
|
28
|
+
rememberCreativeDeliveryDiagnostics: () => rememberCreativeDeliveryDiagnostics,
|
|
25
29
|
rememberSellerDeclaredFormatOption: () => rememberSellerDeclaredFormatOption,
|
|
26
30
|
rememberSellerFormatEvidence: () => rememberSellerFormatEvidence,
|
|
27
31
|
rememberSynthesizedFormatOption: () => rememberSynthesizedFormatOption,
|
|
@@ -29,10 +33,90 @@ __export(legacy_metadata_exports, {
|
|
|
29
33
|
sellerDeclaredFormatOption: () => sellerDeclaredFormatOption,
|
|
30
34
|
sellerFormatEvidence: () => sellerFormatEvidence,
|
|
31
35
|
structuredCloneWithLegacyCreativeMetadata: () => structuredCloneWithLegacyCreativeMetadata,
|
|
36
|
+
transferCreativeDeliveryDiagnostics: () => transferCreativeDeliveryDiagnostics,
|
|
32
37
|
transferLegacyCreativeMetadata: () => transferLegacyCreativeMetadata
|
|
33
38
|
});
|
|
34
39
|
module.exports = __toCommonJS(legacy_metadata_exports);
|
|
35
40
|
var import_jcs = require('../../utils/jcs.js');
|
|
41
|
+
const diagnostics = /* @__PURE__ */ new WeakMap();
|
|
42
|
+
function downgradePixelTracker(value) {
|
|
43
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
44
|
+
const asset = value;
|
|
45
|
+
if (asset.asset_type !== "pixel_tracker" || typeof asset.url !== "string") return void 0;
|
|
46
|
+
if (asset.method !== void 0 && asset.method !== "img" && asset.method !== "js") return void 0;
|
|
47
|
+
let assetId;
|
|
48
|
+
const lostFields = [];
|
|
49
|
+
switch (asset.event) {
|
|
50
|
+
case "impression":
|
|
51
|
+
assetId = "impression_tracker";
|
|
52
|
+
break;
|
|
53
|
+
case "click":
|
|
54
|
+
assetId = "click_tracker";
|
|
55
|
+
break;
|
|
56
|
+
case "viewable_mrc_50":
|
|
57
|
+
case "viewable_mrc_100":
|
|
58
|
+
case "viewable_video_50":
|
|
59
|
+
case "audible_video_complete":
|
|
60
|
+
assetId = "viewability_tracker";
|
|
61
|
+
lostFields.push("event");
|
|
62
|
+
break;
|
|
63
|
+
case "custom":
|
|
64
|
+
if (typeof asset.custom_event_name !== "string" || asset.custom_event_name.length === 0) return void 0;
|
|
65
|
+
assetId = "impression_tracker";
|
|
66
|
+
lostFields.push("event", "custom_event_name");
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
if (asset.method === "js") lostFields.push("method");
|
|
72
|
+
const { event: _event, method: _method, custom_event_name: _custom, ...rest } = asset;
|
|
73
|
+
return { asset: { ...rest, asset_type: "url", url_type: "tracker_pixel" }, assetId, lostFields };
|
|
74
|
+
}
|
|
75
|
+
function pixelTrackerDrift(path, tracker) {
|
|
76
|
+
if (tracker.lostFields.length === 0) return void 0;
|
|
77
|
+
return {
|
|
78
|
+
type: "PIXEL_TRACKER_LOSSY_DOWNGRADE",
|
|
79
|
+
message: `${path} converted to a legacy URL tracker. ` + (tracker.lostFields.includes("event") ? "The original event variant or custom timing is not represented. " : "") + (tracker.lostFields.includes("method") ? "The URL is requested as an image; its JavaScript does not execute. " : "") + "AdCP 3.0 cannot preserve these tracker semantics.",
|
|
80
|
+
strippedFields: tracker.lostFields.map((field) => `${path}.${field}`)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function rememberCreativeDeliveryDiagnostics(value, entries) {
|
|
84
|
+
if (entries.length === 0) return;
|
|
85
|
+
const combined = [...diagnostics.get(value) ?? [], ...entries];
|
|
86
|
+
diagnostics.set(value, [...new Map(combined.map((entry) => [JSON.stringify(entry), entry])).values()]);
|
|
87
|
+
}
|
|
88
|
+
function transferCreativeDeliveryDiagnostics(source, target) {
|
|
89
|
+
const entries = diagnostics.get(source);
|
|
90
|
+
if (entries) rememberCreativeDeliveryDiagnostics(target, entries);
|
|
91
|
+
}
|
|
92
|
+
function getCreativeDeliveryDiagnostics(value) {
|
|
93
|
+
const result = [];
|
|
94
|
+
const append = (creative, prefix) => {
|
|
95
|
+
if (!creative || typeof creative !== "object") return;
|
|
96
|
+
for (const entry of diagnostics.get(creative) ?? []) {
|
|
97
|
+
result.push({
|
|
98
|
+
...entry,
|
|
99
|
+
message: prefix ? `${prefix}: ${entry.message}` : entry.message,
|
|
100
|
+
strippedFields: entry.strippedFields?.map((field) => `${prefix}${prefix ? "." : ""}${field}`)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
append(value, "");
|
|
105
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return result;
|
|
106
|
+
const request = value;
|
|
107
|
+
const creatives = (items, prefix) => {
|
|
108
|
+
if (Array.isArray(items)) items.forEach((item, index) => append(item, `${prefix}[${index}]`));
|
|
109
|
+
};
|
|
110
|
+
creatives(request.creatives, "creatives");
|
|
111
|
+
for (const field of ["packages", "new_packages"]) {
|
|
112
|
+
const packages = request[field];
|
|
113
|
+
if (!Array.isArray(packages)) continue;
|
|
114
|
+
packages.forEach((pkg, index) => {
|
|
115
|
+
if (pkg && typeof pkg === "object") creatives(pkg.creatives, `${field}[${index}].creatives`);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
36
120
|
const legacyRefsByDeclaration = /* @__PURE__ */ new WeakMap();
|
|
37
121
|
const selectedOptionsByRefs = /* @__PURE__ */ new WeakMap();
|
|
38
122
|
const sellerDeclaredByDeclaration = /* @__PURE__ */ new WeakMap();
|
|
@@ -101,6 +185,7 @@ function concealSelectedFormatOptions(refs, declarations) {
|
|
|
101
185
|
selectedOptionsByRefs.set(refs, declarations);
|
|
102
186
|
}
|
|
103
187
|
function transferLegacyCreativeMetadata(source, target) {
|
|
188
|
+
transferCreativeDeliveryDiagnostics(source, target);
|
|
104
189
|
const refs = legacyRefsByDeclaration.get(source);
|
|
105
190
|
if (refs) legacyRefsByDeclaration.set(target, refs);
|
|
106
191
|
const selected = selectedOptionsByRefs.get(source);
|
|
@@ -114,6 +199,7 @@ function structuredCloneWithLegacyCreativeMetadata(value) {
|
|
|
114
199
|
const clone = structuredClone(value);
|
|
115
200
|
const visited = /* @__PURE__ */ new WeakMap();
|
|
116
201
|
const snapshotMetadata = (source, target) => {
|
|
202
|
+
transferCreativeDeliveryDiagnostics(source, target);
|
|
117
203
|
const declared = sellerDeclaredByDeclaration.get(source);
|
|
118
204
|
if (declared !== void 0) sellerDeclaredByDeclaration.set(target, declared);
|
|
119
205
|
const evidence = sellerEvidenceByDeclaration.get(source);
|
|
@@ -155,8 +241,12 @@ function structuredCloneWithLegacyCreativeMetadata(value) {
|
|
|
155
241
|
0 && (module.exports = {
|
|
156
242
|
concealLegacyFormatRefs,
|
|
157
243
|
concealSelectedFormatOptions,
|
|
244
|
+
downgradePixelTracker,
|
|
245
|
+
getCreativeDeliveryDiagnostics,
|
|
158
246
|
isSynthesizedFormatOption,
|
|
159
247
|
legacyFormatRefsForDeclaration,
|
|
248
|
+
pixelTrackerDrift,
|
|
249
|
+
rememberCreativeDeliveryDiagnostics,
|
|
160
250
|
rememberSellerDeclaredFormatOption,
|
|
161
251
|
rememberSellerFormatEvidence,
|
|
162
252
|
rememberSynthesizedFormatOption,
|
|
@@ -164,5 +254,6 @@ function structuredCloneWithLegacyCreativeMetadata(value) {
|
|
|
164
254
|
sellerDeclaredFormatOption,
|
|
165
255
|
sellerFormatEvidence,
|
|
166
256
|
structuredCloneWithLegacyCreativeMetadata,
|
|
257
|
+
transferCreativeDeliveryDiagnostics,
|
|
167
258
|
transferLegacyCreativeMetadata
|
|
168
259
|
});
|
|
@@ -1,4 +1,83 @@
|
|
|
1
1
|
import { canonicalize } from "../../utils/jcs.mjs";
|
|
2
|
+
const diagnostics = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function downgradePixelTracker(value) {
|
|
4
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
5
|
+
const asset = value;
|
|
6
|
+
if (asset.asset_type !== "pixel_tracker" || typeof asset.url !== "string") return void 0;
|
|
7
|
+
if (asset.method !== void 0 && asset.method !== "img" && asset.method !== "js") return void 0;
|
|
8
|
+
let assetId;
|
|
9
|
+
const lostFields = [];
|
|
10
|
+
switch (asset.event) {
|
|
11
|
+
case "impression":
|
|
12
|
+
assetId = "impression_tracker";
|
|
13
|
+
break;
|
|
14
|
+
case "click":
|
|
15
|
+
assetId = "click_tracker";
|
|
16
|
+
break;
|
|
17
|
+
case "viewable_mrc_50":
|
|
18
|
+
case "viewable_mrc_100":
|
|
19
|
+
case "viewable_video_50":
|
|
20
|
+
case "audible_video_complete":
|
|
21
|
+
assetId = "viewability_tracker";
|
|
22
|
+
lostFields.push("event");
|
|
23
|
+
break;
|
|
24
|
+
case "custom":
|
|
25
|
+
if (typeof asset.custom_event_name !== "string" || asset.custom_event_name.length === 0) return void 0;
|
|
26
|
+
assetId = "impression_tracker";
|
|
27
|
+
lostFields.push("event", "custom_event_name");
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
if (asset.method === "js") lostFields.push("method");
|
|
33
|
+
const { event: _event, method: _method, custom_event_name: _custom, ...rest } = asset;
|
|
34
|
+
return { asset: { ...rest, asset_type: "url", url_type: "tracker_pixel" }, assetId, lostFields };
|
|
35
|
+
}
|
|
36
|
+
function pixelTrackerDrift(path, tracker) {
|
|
37
|
+
if (tracker.lostFields.length === 0) return void 0;
|
|
38
|
+
return {
|
|
39
|
+
type: "PIXEL_TRACKER_LOSSY_DOWNGRADE",
|
|
40
|
+
message: `${path} converted to a legacy URL tracker. ` + (tracker.lostFields.includes("event") ? "The original event variant or custom timing is not represented. " : "") + (tracker.lostFields.includes("method") ? "The URL is requested as an image; its JavaScript does not execute. " : "") + "AdCP 3.0 cannot preserve these tracker semantics.",
|
|
41
|
+
strippedFields: tracker.lostFields.map((field) => `${path}.${field}`)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function rememberCreativeDeliveryDiagnostics(value, entries) {
|
|
45
|
+
if (entries.length === 0) return;
|
|
46
|
+
const combined = [...diagnostics.get(value) ?? [], ...entries];
|
|
47
|
+
diagnostics.set(value, [...new Map(combined.map((entry) => [JSON.stringify(entry), entry])).values()]);
|
|
48
|
+
}
|
|
49
|
+
function transferCreativeDeliveryDiagnostics(source, target) {
|
|
50
|
+
const entries = diagnostics.get(source);
|
|
51
|
+
if (entries) rememberCreativeDeliveryDiagnostics(target, entries);
|
|
52
|
+
}
|
|
53
|
+
function getCreativeDeliveryDiagnostics(value) {
|
|
54
|
+
const result = [];
|
|
55
|
+
const append = (creative, prefix) => {
|
|
56
|
+
if (!creative || typeof creative !== "object") return;
|
|
57
|
+
for (const entry of diagnostics.get(creative) ?? []) {
|
|
58
|
+
result.push({
|
|
59
|
+
...entry,
|
|
60
|
+
message: prefix ? `${prefix}: ${entry.message}` : entry.message,
|
|
61
|
+
strippedFields: entry.strippedFields?.map((field) => `${prefix}${prefix ? "." : ""}${field}`)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
append(value, "");
|
|
66
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return result;
|
|
67
|
+
const request = value;
|
|
68
|
+
const creatives = (items, prefix) => {
|
|
69
|
+
if (Array.isArray(items)) items.forEach((item, index) => append(item, `${prefix}[${index}]`));
|
|
70
|
+
};
|
|
71
|
+
creatives(request.creatives, "creatives");
|
|
72
|
+
for (const field of ["packages", "new_packages"]) {
|
|
73
|
+
const packages = request[field];
|
|
74
|
+
if (!Array.isArray(packages)) continue;
|
|
75
|
+
packages.forEach((pkg, index) => {
|
|
76
|
+
if (pkg && typeof pkg === "object") creatives(pkg.creatives, `${field}[${index}].creatives`);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
2
81
|
const legacyRefsByDeclaration = /* @__PURE__ */ new WeakMap();
|
|
3
82
|
const selectedOptionsByRefs = /* @__PURE__ */ new WeakMap();
|
|
4
83
|
const sellerDeclaredByDeclaration = /* @__PURE__ */ new WeakMap();
|
|
@@ -67,6 +146,7 @@ function concealSelectedFormatOptions(refs, declarations) {
|
|
|
67
146
|
selectedOptionsByRefs.set(refs, declarations);
|
|
68
147
|
}
|
|
69
148
|
function transferLegacyCreativeMetadata(source, target) {
|
|
149
|
+
transferCreativeDeliveryDiagnostics(source, target);
|
|
70
150
|
const refs = legacyRefsByDeclaration.get(source);
|
|
71
151
|
if (refs) legacyRefsByDeclaration.set(target, refs);
|
|
72
152
|
const selected = selectedOptionsByRefs.get(source);
|
|
@@ -80,6 +160,7 @@ function structuredCloneWithLegacyCreativeMetadata(value) {
|
|
|
80
160
|
const clone = structuredClone(value);
|
|
81
161
|
const visited = /* @__PURE__ */ new WeakMap();
|
|
82
162
|
const snapshotMetadata = (source, target) => {
|
|
163
|
+
transferCreativeDeliveryDiagnostics(source, target);
|
|
83
164
|
const declared = sellerDeclaredByDeclaration.get(source);
|
|
84
165
|
if (declared !== void 0) sellerDeclaredByDeclaration.set(target, declared);
|
|
85
166
|
const evidence = sellerEvidenceByDeclaration.get(source);
|
|
@@ -120,8 +201,12 @@ function structuredCloneWithLegacyCreativeMetadata(value) {
|
|
|
120
201
|
export {
|
|
121
202
|
concealLegacyFormatRefs,
|
|
122
203
|
concealSelectedFormatOptions,
|
|
204
|
+
downgradePixelTracker,
|
|
205
|
+
getCreativeDeliveryDiagnostics,
|
|
123
206
|
isSynthesizedFormatOption,
|
|
124
207
|
legacyFormatRefsForDeclaration,
|
|
208
|
+
pixelTrackerDrift,
|
|
209
|
+
rememberCreativeDeliveryDiagnostics,
|
|
125
210
|
rememberSellerDeclaredFormatOption,
|
|
126
211
|
rememberSellerFormatEvidence,
|
|
127
212
|
rememberSynthesizedFormatOption,
|
|
@@ -129,5 +214,6 @@ export {
|
|
|
129
214
|
sellerDeclaredFormatOption,
|
|
130
215
|
sellerFormatEvidence,
|
|
131
216
|
structuredCloneWithLegacyCreativeMetadata,
|
|
217
|
+
transferCreativeDeliveryDiagnostics,
|
|
132
218
|
transferLegacyCreativeMetadata
|
|
133
219
|
};
|
|
@@ -213,7 +213,7 @@ export declare function canonicalDeclarationFromBareId(id: string, options?: Bar
|
|
|
213
213
|
*/
|
|
214
214
|
export declare function resolveCanonicalFormatKind(id: string, options?: BareFormatIdResolveOptions): CanonicalFormatKind | null;
|
|
215
215
|
/**
|
|
216
|
-
* Preserve index pairing
|
|
216
|
+
* Preserve each compatible index pairing in a seller-authored dual emission.
|
|
217
217
|
* AdCP 3.1.24 core/product.json defines this correspondence: "the format_options[i]
|
|
218
218
|
* narrows the canonical that the named format in format_ids[i] resolves to via the
|
|
219
219
|
* registry / explicit canonical field". Explicit routes remain authoritative.
|
|
@@ -213,7 +213,7 @@ export declare function canonicalDeclarationFromBareId(id: string, options?: Bar
|
|
|
213
213
|
*/
|
|
214
214
|
export declare function resolveCanonicalFormatKind(id: string, options?: BareFormatIdResolveOptions): CanonicalFormatKind | null;
|
|
215
215
|
/**
|
|
216
|
-
* Preserve index pairing
|
|
216
|
+
* Preserve each compatible index pairing in a seller-authored dual emission.
|
|
217
217
|
* AdCP 3.1.24 core/product.json defines this correspondence: "the format_options[i]
|
|
218
218
|
* narrows the canonical that the named format in format_ids[i] resolves to via the
|
|
219
219
|
* registry / explicit canonical field". Explicit routes remain authoritative.
|
|
@@ -430,19 +430,22 @@ function compatible(option, ref) {
|
|
|
430
430
|
}
|
|
431
431
|
function withDualEmissionLegacyRefs(formatOptions, formatIds) {
|
|
432
432
|
if (!Array.isArray(formatIds) || formatIds.length !== formatOptions.length) return formatOptions;
|
|
433
|
-
|
|
433
|
+
if (formatOptions.some((value, index) => {
|
|
434
|
+
const explicit = (0, import_legacy_metadata.legacyFormatRefsForDeclaration)(value);
|
|
435
|
+
if (explicit.length === 0) return false;
|
|
436
|
+
const ref = record(formatIds[index]);
|
|
437
|
+
return !ref || typeof ref.agent_url !== "string" || typeof ref.id !== "string" || !explicit.some((existing) => sameIdentity(existing, ref));
|
|
438
|
+
}))
|
|
439
|
+
return formatOptions;
|
|
440
|
+
return formatOptions.map((value, index) => {
|
|
434
441
|
const option = record(value);
|
|
435
442
|
const ref = record(formatIds[index]);
|
|
436
443
|
if (!option || typeof option.format_kind !== "string" || option.canonical_formats_only === true || !ref || typeof ref.agent_url !== "string" || ref.agent_url.length === 0 || typeof ref.id !== "string" || ref.id.length === 0) {
|
|
437
|
-
return
|
|
444
|
+
return value;
|
|
445
|
+
}
|
|
446
|
+
if ((0, import_legacy_metadata.legacyFormatRefsForDeclaration)(option).length > 0 || !compatible(option, ref)) {
|
|
447
|
+
return value;
|
|
438
448
|
}
|
|
439
|
-
const typedRef = ref;
|
|
440
|
-
const explicit = (0, import_legacy_metadata.legacyFormatRefsForDeclaration)(option);
|
|
441
|
-
return explicit.length > 0 ? explicit.some((existing) => sameIdentity(existing, typedRef)) : compatible(option, typedRef);
|
|
442
|
-
});
|
|
443
|
-
if (!aligned) return formatOptions;
|
|
444
|
-
return formatOptions.map((value, index) => {
|
|
445
|
-
if ((0, import_legacy_metadata.legacyFormatRefsForDeclaration)(value).length > 0) return value;
|
|
446
449
|
const paired = (0, import_legacy_metadata.concealLegacyFormatRefs)({
|
|
447
450
|
...value,
|
|
448
451
|
v1_format_ref: [{ ...formatIds[index] }]
|
|
@@ -413,19 +413,22 @@ function compatible(option, ref) {
|
|
|
413
413
|
}
|
|
414
414
|
function withDualEmissionLegacyRefs(formatOptions, formatIds) {
|
|
415
415
|
if (!Array.isArray(formatIds) || formatIds.length !== formatOptions.length) return formatOptions;
|
|
416
|
-
|
|
416
|
+
if (formatOptions.some((value, index) => {
|
|
417
|
+
const explicit = legacyFormatRefsForDeclaration(value);
|
|
418
|
+
if (explicit.length === 0) return false;
|
|
419
|
+
const ref = record(formatIds[index]);
|
|
420
|
+
return !ref || typeof ref.agent_url !== "string" || typeof ref.id !== "string" || !explicit.some((existing) => sameIdentity(existing, ref));
|
|
421
|
+
}))
|
|
422
|
+
return formatOptions;
|
|
423
|
+
return formatOptions.map((value, index) => {
|
|
417
424
|
const option = record(value);
|
|
418
425
|
const ref = record(formatIds[index]);
|
|
419
426
|
if (!option || typeof option.format_kind !== "string" || option.canonical_formats_only === true || !ref || typeof ref.agent_url !== "string" || ref.agent_url.length === 0 || typeof ref.id !== "string" || ref.id.length === 0) {
|
|
420
|
-
return
|
|
427
|
+
return value;
|
|
428
|
+
}
|
|
429
|
+
if (legacyFormatRefsForDeclaration(option).length > 0 || !compatible(option, ref)) {
|
|
430
|
+
return value;
|
|
421
431
|
}
|
|
422
|
-
const typedRef = ref;
|
|
423
|
-
const explicit = legacyFormatRefsForDeclaration(option);
|
|
424
|
-
return explicit.length > 0 ? explicit.some((existing) => sameIdentity(existing, typedRef)) : compatible(option, typedRef);
|
|
425
|
-
});
|
|
426
|
-
if (!aligned) return formatOptions;
|
|
427
|
-
return formatOptions.map((value, index) => {
|
|
428
|
-
if (legacyFormatRefsForDeclaration(value).length > 0) return value;
|
|
429
432
|
const paired = concealLegacyFormatRefs({
|
|
430
433
|
...value,
|
|
431
434
|
v1_format_ref: [{ ...formatIds[index] }]
|
|
@@ -4,14 +4,14 @@ export declare const CanonicalBudgetAllocationSchema: z.ZodUnion<readonly [z.Zod
|
|
|
4
4
|
mode: z.ZodLiteral<"fixed">;
|
|
5
5
|
}, z.core.$loose>, z.ZodObject<{
|
|
6
6
|
mode: z.ZodLiteral<"seller_optimized">;
|
|
7
|
-
optimization_goals:
|
|
7
|
+
optimization_goals: import("./nonempty-array.mjs").NonemptyArraySchema<z.ZodUnion<readonly [z.ZodObject<{
|
|
8
8
|
kind: z.ZodLiteral<"metric">;
|
|
9
9
|
metric: z.ZodUnion<readonly [z.ZodLiteral<"clicks">, z.ZodLiteral<"views">, z.ZodLiteral<"completed_views">, z.ZodLiteral<"viewed_seconds">, z.ZodLiteral<"viewable_rate">, z.ZodLiteral<"engagements">, z.ZodLiteral<"follows">, z.ZodLiteral<"saves">, z.ZodLiteral<"profile_visits">, z.ZodLiteral<"reach">]>;
|
|
10
10
|
standard: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"mrc">, z.ZodLiteral<"groupm">]>>;
|
|
11
11
|
vendor: z.ZodOptional<z.ZodObject<{
|
|
12
12
|
domain: z.ZodString;
|
|
13
13
|
brand_id: z.ZodOptional<z.ZodString>;
|
|
14
|
-
countries: z.ZodOptional<
|
|
14
|
+
countries: z.ZodOptional<import("./nonempty-array.mjs").NonemptyArraySchema<z.ZodString>>;
|
|
15
15
|
}, z.core.$loose>>;
|
|
16
16
|
reach_unit: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"individuals">, z.ZodLiteral<"households">, z.ZodLiteral<"devices">, z.ZodLiteral<"accounts">, z.ZodLiteral<"cookies">, z.ZodLiteral<"custom">]>>;
|
|
17
17
|
target_frequency: z.ZodOptional<z.ZodObject<{
|
|
@@ -57,7 +57,7 @@ export declare const CanonicalBudgetAllocationSchema: z.ZodUnion<readonly [z.Zod
|
|
|
57
57
|
vendor: z.ZodObject<{
|
|
58
58
|
domain: z.ZodString;
|
|
59
59
|
brand_id: z.ZodOptional<z.ZodString>;
|
|
60
|
-
countries: z.ZodOptional<
|
|
60
|
+
countries: z.ZodOptional<import("./nonempty-array.mjs").NonemptyArraySchema<z.ZodString>>;
|
|
61
61
|
}, z.core.$loose>;
|
|
62
62
|
metric_id: z.ZodString;
|
|
63
63
|
target: z.ZodOptional<z.ZodObject<{
|
|
@@ -4,14 +4,14 @@ export declare const CanonicalBudgetAllocationSchema: z.ZodUnion<readonly [z.Zod
|
|
|
4
4
|
mode: z.ZodLiteral<"fixed">;
|
|
5
5
|
}, z.core.$loose>, z.ZodObject<{
|
|
6
6
|
mode: z.ZodLiteral<"seller_optimized">;
|
|
7
|
-
optimization_goals:
|
|
7
|
+
optimization_goals: import("./nonempty-array").NonemptyArraySchema<z.ZodUnion<readonly [z.ZodObject<{
|
|
8
8
|
kind: z.ZodLiteral<"metric">;
|
|
9
9
|
metric: z.ZodUnion<readonly [z.ZodLiteral<"clicks">, z.ZodLiteral<"views">, z.ZodLiteral<"completed_views">, z.ZodLiteral<"viewed_seconds">, z.ZodLiteral<"viewable_rate">, z.ZodLiteral<"engagements">, z.ZodLiteral<"follows">, z.ZodLiteral<"saves">, z.ZodLiteral<"profile_visits">, z.ZodLiteral<"reach">]>;
|
|
10
10
|
standard: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"mrc">, z.ZodLiteral<"groupm">]>>;
|
|
11
11
|
vendor: z.ZodOptional<z.ZodObject<{
|
|
12
12
|
domain: z.ZodString;
|
|
13
13
|
brand_id: z.ZodOptional<z.ZodString>;
|
|
14
|
-
countries: z.ZodOptional<
|
|
14
|
+
countries: z.ZodOptional<import("./nonempty-array").NonemptyArraySchema<z.ZodString>>;
|
|
15
15
|
}, z.core.$loose>>;
|
|
16
16
|
reach_unit: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"individuals">, z.ZodLiteral<"households">, z.ZodLiteral<"devices">, z.ZodLiteral<"accounts">, z.ZodLiteral<"cookies">, z.ZodLiteral<"custom">]>>;
|
|
17
17
|
target_frequency: z.ZodOptional<z.ZodObject<{
|
|
@@ -57,7 +57,7 @@ export declare const CanonicalBudgetAllocationSchema: z.ZodUnion<readonly [z.Zod
|
|
|
57
57
|
vendor: z.ZodObject<{
|
|
58
58
|
domain: z.ZodString;
|
|
59
59
|
brand_id: z.ZodOptional<z.ZodString>;
|
|
60
|
-
countries: z.ZodOptional<
|
|
60
|
+
countries: z.ZodOptional<import("./nonempty-array").NonemptyArraySchema<z.ZodString>>;
|
|
61
61
|
}, z.core.$loose>;
|
|
62
62
|
metric_id: z.ZodString;
|
|
63
63
|
target: z.ZodOptional<z.ZodObject<{
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a mostly dereferenced bundled JSON Schema into a serializable schema
|
|
3
|
+
* that stores repeated schema nodes once under `$defs`.
|
|
4
|
+
*
|
|
5
|
+
* The upstream `bundled/` tree expands shared definitions at every use site,
|
|
6
|
+
* growing to hundreds of megabytes. This serializer replaces repeated schema
|
|
7
|
+
* nodes with private local refs while leaving annotation/default/example data
|
|
8
|
+
* alone. Public schema readers expand these private refs; validation can keep
|
|
9
|
+
* them to compile small referenced functions instead of multi-megabyte code.
|
|
10
|
+
*/
|
|
11
|
+
type JsonObject = Record<string, unknown>;
|
|
12
|
+
export declare const COMPACT_DEFINITIONS_KEY = "x-adcp-compact-definitions";
|
|
13
|
+
/**
|
|
14
|
+
* Compact an acyclic schema object graph. Repeated schemas become private local
|
|
15
|
+
* `$defs` refs. The archive reader expands those private refs before exposing
|
|
16
|
+
* a schema, preserving the original document and AJV diagnostic paths.
|
|
17
|
+
*/
|
|
18
|
+
export declare function compactBundledSchema(root: JsonObject, options?: {
|
|
19
|
+
maxInlineSchemaBytes?: number;
|
|
20
|
+
}): JsonObject;
|
|
21
|
+
/**
|
|
22
|
+
* Prepare a self-contained bundled schema for bounded AJV compilation. Nested
|
|
23
|
+
* IDs in these dereferenced bundles are source annotations, not ref scopes.
|
|
24
|
+
* Walk schema positions only so IDs in enum/default/example data stay intact.
|
|
25
|
+
*/
|
|
26
|
+
export declare function compactSchemaForValidation(schema: JsonObject): JsonObject;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a mostly dereferenced bundled JSON Schema into a serializable schema
|
|
3
|
+
* that stores repeated schema nodes once under `$defs`.
|
|
4
|
+
*
|
|
5
|
+
* The upstream `bundled/` tree expands shared definitions at every use site,
|
|
6
|
+
* growing to hundreds of megabytes. This serializer replaces repeated schema
|
|
7
|
+
* nodes with private local refs while leaving annotation/default/example data
|
|
8
|
+
* alone. Public schema readers expand these private refs; validation can keep
|
|
9
|
+
* them to compile small referenced functions instead of multi-megabyte code.
|
|
10
|
+
*/
|
|
11
|
+
type JsonObject = Record<string, unknown>;
|
|
12
|
+
export declare const COMPACT_DEFINITIONS_KEY = "x-adcp-compact-definitions";
|
|
13
|
+
/**
|
|
14
|
+
* Compact an acyclic schema object graph. Repeated schemas become private local
|
|
15
|
+
* `$defs` refs. The archive reader expands those private refs before exposing
|
|
16
|
+
* a schema, preserving the original document and AJV diagnostic paths.
|
|
17
|
+
*/
|
|
18
|
+
export declare function compactBundledSchema(root: JsonObject, options?: {
|
|
19
|
+
maxInlineSchemaBytes?: number;
|
|
20
|
+
}): JsonObject;
|
|
21
|
+
/**
|
|
22
|
+
* Prepare a self-contained bundled schema for bounded AJV compilation. Nested
|
|
23
|
+
* IDs in these dereferenced bundles are source annotations, not ref scopes.
|
|
24
|
+
* Walk schema positions only so IDs in enum/default/example data stay intact.
|
|
25
|
+
*/
|
|
26
|
+
export declare function compactSchemaForValidation(schema: JsonObject): JsonObject;
|
|
27
|
+
export {};
|