@adcp/sdk 16.0.0-beta.6 → 16.0.0-beta.7
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/TaskExecutor.d.mts +1 -0
- package/dist/lib/core/TaskExecutor.d.ts +1 -0
- package/dist/lib/core/TaskExecutor.js +48 -34
- package/dist/lib/core/TaskExecutor.mjs +49 -35
- package/dist/lib/identity-3.3/revocation.js +5 -4
- package/dist/lib/identity-3.3/revocation.mjs +5 -4
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/auth-signature.js +23 -2
- package/dist/lib/server/auth-signature.mjs +26 -2
- package/dist/lib/server/auth.d.mts +6 -0
- package/dist/lib/server/auth.d.ts +6 -0
- package/dist/lib/server/auth.js +6 -0
- package/dist/lib/server/auth.mjs +6 -0
- package/dist/lib/server/create-adcp-server.js +19 -3
- package/dist/lib/server/create-adcp-server.mjs +23 -4
- package/dist/lib/server/decisioning/runtime/from-platform.js +6 -2
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +6 -2
- package/dist/lib/server/serve.js +2 -1
- package/dist/lib/server/serve.mjs +2 -1
- package/dist/lib/server/webhook-emitter.js +1 -0
- package/dist/lib/server/webhook-emitter.mjs +2 -1
- package/dist/lib/signing/crypto.d.mts +1 -1
- package/dist/lib/signing/crypto.d.ts +1 -1
- package/dist/lib/signing/crypto.js +37 -2
- package/dist/lib/signing/crypto.mjs +37 -2
- package/dist/lib/signing/parser.d.mts +6 -0
- package/dist/lib/signing/parser.d.ts +6 -0
- package/dist/lib/signing/parser.js +5 -1
- package/dist/lib/signing/parser.mjs +4 -1
- package/dist/lib/signing/web-bot-auth.d.mts +61 -22
- package/dist/lib/signing/web-bot-auth.d.ts +61 -22
- package/dist/lib/signing/web-bot-auth.js +286 -266
- package/dist/lib/signing/web-bot-auth.mjs +288 -277
- package/dist/lib/testing/client.js +3 -5
- package/dist/lib/testing/client.mjs +4 -6
- package/dist/lib/testing/compliance/comply.js +7 -2
- package/dist/lib/testing/compliance/comply.mjs +8 -3
- package/dist/lib/testing/index.d.mts +1 -1
- package/dist/lib/testing/index.d.ts +1 -1
- package/dist/lib/testing/index.js +4 -2
- package/dist/lib/testing/index.mjs +8 -2
- package/dist/lib/testing/storyboard/runner.js +12 -12
- package/dist/lib/testing/storyboard/runner.mjs +14 -13
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.js +23 -1
- package/dist/lib/testing/storyboard/validations.mjs +28 -2
- package/dist/lib/testing/types.d.mts +39 -0
- package/dist/lib/testing/types.d.ts +39 -0
- package/dist/lib/v2/projection/augment-response.js +6 -3
- package/dist/lib/v2/projection/augment-response.mjs +8 -5
- package/dist/lib/v2/projection/creative-delivery.js +29 -17
- package/dist/lib/v2/projection/creative-delivery.mjs +31 -18
- package/dist/lib/v2/projection/v1-to-v2.d.mts +7 -0
- package/dist/lib/v2/projection/v1-to-v2.d.ts +7 -0
- package/dist/lib/v2/projection/v1-to-v2.js +70 -2
- package/dist/lib/v2/projection/v1-to-v2.mjs +72 -1
- package/dist/lib/validation/index.d.mts +1 -1
- package/dist/lib/validation/index.d.ts +1 -1
- package/dist/lib/validation/index.js +4 -2
- package/dist/lib/validation/index.mjs +4 -2
- package/dist/lib/validation/schema-loader.d.mts +26 -0
- package/dist/lib/validation/schema-loader.d.ts +26 -0
- package/dist/lib/validation/schema-loader.js +98 -14
- package/dist/lib/validation/schema-loader.mjs +95 -13
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/VALIDATE-YOUR-AGENT.md +34 -0
- package/docs/llms.txt +2 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-agent-identity-3.3.md +60 -23
- package/package.json +1 -1
|
@@ -530,12 +530,10 @@ async function discoverAgentProfile(client, signal, schemaAdcpVersion) {
|
|
|
530
530
|
step.error = versionUnsupported;
|
|
531
531
|
} else if (caps?.data) {
|
|
532
532
|
profile.raw_capabilities = caps.data;
|
|
533
|
-
const validation = (0,
|
|
534
|
-
"get_adcp_capabilities",
|
|
533
|
+
const validation = (0, import_schema_loader.withServedValidationVersion)(
|
|
535
534
|
caps.data,
|
|
536
|
-
|
|
537
|
-
void 0,
|
|
538
|
-
(0, import_schema_loader.resolveServedValidationVersion)(caps.data, schemaAdcpVersion ?? client.getAdcpVersion())
|
|
535
|
+
schemaAdcpVersion ?? client.getAdcpVersion(),
|
|
536
|
+
(validationVersion) => (0, import_client_hooks.validateIncomingResponse)("get_adcp_capabilities", caps.data, "strict", void 0, validationVersion)
|
|
539
537
|
);
|
|
540
538
|
if (!validation.valid) {
|
|
541
539
|
profile.capabilities_schema_issues = validation.issues.map((issue) => ({
|
|
@@ -12,7 +12,7 @@ import { normalizeTransportOptions } from "../protocols/index.mjs";
|
|
|
12
12
|
import { createHmac, hkdfSync, randomBytes } from "node:crypto";
|
|
13
13
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
14
14
|
import { validateIncomingResponse } from "../validation/client-hooks.mjs";
|
|
15
|
-
import {
|
|
15
|
+
import { withServedValidationVersion } from "../validation/schema-loader.mjs";
|
|
16
16
|
import { extractVersionUnsupportedDetails } from "../utils/error-extraction.mjs";
|
|
17
17
|
import { buildAgentSigningContext } from "../signing/client.mjs";
|
|
18
18
|
import { bindAgentStorage } from "../auth/oauth/storage-registry.mjs";
|
|
@@ -487,12 +487,10 @@ async function discoverAgentProfile(client, signal, schemaAdcpVersion) {
|
|
|
487
487
|
step.error = versionUnsupported;
|
|
488
488
|
} else if (caps?.data) {
|
|
489
489
|
profile.raw_capabilities = caps.data;
|
|
490
|
-
const validation =
|
|
491
|
-
"get_adcp_capabilities",
|
|
490
|
+
const validation = withServedValidationVersion(
|
|
492
491
|
caps.data,
|
|
493
|
-
|
|
494
|
-
void 0,
|
|
495
|
-
resolveServedValidationVersion(caps.data, schemaAdcpVersion ?? client.getAdcpVersion())
|
|
492
|
+
schemaAdcpVersion ?? client.getAdcpVersion(),
|
|
493
|
+
(validationVersion) => validateIncomingResponse("get_adcp_capabilities", caps.data, "strict", void 0, validationVersion)
|
|
496
494
|
);
|
|
497
495
|
if (!validation.valid) {
|
|
498
496
|
profile.capabilities_schema_issues = validation.issues.map((issue) => ({
|
|
@@ -1358,7 +1358,12 @@ async function complyImpl(agentUrl, options) {
|
|
|
1358
1358
|
}
|
|
1359
1359
|
(0, import_test_kit.validateTestKit)(testOptions.test_kit);
|
|
1360
1360
|
const signal = externalSignal;
|
|
1361
|
-
return await (0, import_schema_loader.withExternalSchemaRoot)(
|
|
1361
|
+
return await (0, import_schema_loader.withExternalSchemaRoot)(
|
|
1362
|
+
complianceIndex.adcp_version,
|
|
1363
|
+
scopedSchemaRoot,
|
|
1364
|
+
() => (0, import_schema_loader.withServedReleaseSchemaRoots)(testOptions.servedReleaseSchemaRoots, () => complyInSchemaScope())
|
|
1365
|
+
);
|
|
1366
|
+
async function complyInSchemaScope() {
|
|
1362
1367
|
let effectiveOptions = (0, import_runner.applyAdcpVersionRunOptions)(complianceIndex.adcp_version, {
|
|
1363
1368
|
...testOptions,
|
|
1364
1369
|
// `comply()` has always defaulted an unset transport to MCP when it built
|
|
@@ -1667,7 +1672,7 @@ async function complyImpl(agentUrl, options) {
|
|
|
1667
1672
|
total_duration_ms: Date.now() - start,
|
|
1668
1673
|
notices: noticesDedup
|
|
1669
1674
|
};
|
|
1670
|
-
}
|
|
1675
|
+
}
|
|
1671
1676
|
}
|
|
1672
1677
|
function hasComplyTimeoutBudgetExpired(start, timeout_ms, now = Date.now()) {
|
|
1673
1678
|
return timeout_ms !== void 0 && now - start >= timeout_ms;
|
|
@@ -35,7 +35,7 @@ import { closeScopedConnections, withMCPConnectionScope } from "../../protocols/
|
|
|
35
35
|
import { detectController, hasTestController } from "../test-controller.mjs";
|
|
36
36
|
import { randomBytes } from "crypto";
|
|
37
37
|
import { isPre31AdcpVersion } from "../../utils/adcp-version-config.mjs";
|
|
38
|
-
import { withExternalSchemaRoot } from "../../validation/schema-loader.mjs";
|
|
38
|
+
import { withExternalSchemaRoot, withServedReleaseSchemaRoots } from "../../validation/schema-loader.mjs";
|
|
39
39
|
import { redactOAuthUrlForOutput, redactOAuthUrlsInText } from "../storyboard/oauth-metadata-graph/index.mjs";
|
|
40
40
|
import { LIBRARY_VERSION } from "../../version.mjs";
|
|
41
41
|
import { validationFailsStep } from "../storyboard/validations.mjs";
|
|
@@ -1348,7 +1348,12 @@ async function complyImpl(agentUrl, options) {
|
|
|
1348
1348
|
}
|
|
1349
1349
|
validateTestKit(testOptions.test_kit);
|
|
1350
1350
|
const signal = externalSignal;
|
|
1351
|
-
return await withExternalSchemaRoot(
|
|
1351
|
+
return await withExternalSchemaRoot(
|
|
1352
|
+
complianceIndex.adcp_version,
|
|
1353
|
+
scopedSchemaRoot,
|
|
1354
|
+
() => withServedReleaseSchemaRoots(testOptions.servedReleaseSchemaRoots, () => complyInSchemaScope())
|
|
1355
|
+
);
|
|
1356
|
+
async function complyInSchemaScope() {
|
|
1352
1357
|
let effectiveOptions = applyAdcpVersionRunOptions(complianceIndex.adcp_version, {
|
|
1353
1358
|
...testOptions,
|
|
1354
1359
|
// `comply()` has always defaulted an unset transport to MCP when it built
|
|
@@ -1657,7 +1662,7 @@ async function complyImpl(agentUrl, options) {
|
|
|
1657
1662
|
total_duration_ms: Date.now() - start,
|
|
1658
1663
|
notices: noticesDedup
|
|
1659
1664
|
};
|
|
1660
|
-
}
|
|
1665
|
+
}
|
|
1661
1666
|
}
|
|
1662
1667
|
function hasComplyTimeoutBudgetExpired(start, timeout_ms, now = Date.now()) {
|
|
1663
1668
|
return timeout_ms !== void 0 && now - start >= timeout_ms;
|
|
@@ -16,5 +16,5 @@ export { isSandboxRequest, mergeSeededProductsIntoResponse, filterValidSeededPro
|
|
|
16
16
|
export type { TestControllerBridge, TestControllerBridgeContext, BridgeFromSessionStoreOptions, SeededCreative, SeededMediaBuy, SeededAccountFinancials, } from '../server/test-controller-bridge.mjs';
|
|
17
17
|
export { runAgainstLocalAgent } from './local-agent-runner.mjs';
|
|
18
18
|
export type { LocalAgentRunResult, PerStoryboardOverride, RunAgainstLocalAgentOptions } from './local-agent-runner.mjs';
|
|
19
|
-
export { registerExternalSchemaRoot, unregisterExternalSchemaRoot, withExternalSchemaRoot } from '../validation/index.mjs';
|
|
19
|
+
export { registerExternalSchemaRoot, unregisterExternalSchemaRoot, withExternalSchemaRoot, withServedReleaseSchemaRoots, } from '../validation/index.mjs';
|
|
20
20
|
export { runStoryboard, runStoryboardStep, applyAdcpVersionRunOptions, applyStoryboardVersionOptions, getFirstStepPreview, parseStoryboard, loadStoryboardFile, normalizeValidationOnlyTasks, VALIDATION_ONLY_TASK, applyFixtureBindingsToRequest, buildFixtureResolutionSpecs, FixtureBindingRegistry, matchesFixtureRequirements, normalizeFixtureMatchExpression, validateFixtureResolutionDeclarations, getComplianceCacheDir, loadComplianceIndex, listBundles, loadBundleStoryboards, listAllComplianceStoryboards, getComplianceStoryboardById, findBundleById, resolveBundleOrStoryboard, resolveStoryboardsForCapabilities, isComplianceVersionSupported, CapabilityResolutionError, TASK_TO_METHOD, executeStoryboardTask, expandCreativeAssetDirectives, findUnresolvedCreativeAssetDirectives, extractContext, injectContext, runValidations, resolvePath, RateLimitTripObserver, RATE_LIMIT_TRIP_CONTRACT, RATE_LIMIT_TRIP_DEFAULT_REPLAY_MAX_WAIT_SECONDS, RATE_LIMIT_TRIP_MAX_ATTEMPTS_MAX, RATE_LIMIT_TRIP_MAX_ATTEMPTS_MIN, validateRateLimitTripSpec, getSandboxEntities, getSandboxBrands, getSandboxBrand, isSandboxDomain, clearSandboxCache, registerAssertion, getAssertion, listAssertions, listDefaultAssertions, clearAssertionRegistry, resolveAssertions, type AssertionSpec, type AssertionContext, type AssertionResult, type RegisterAssertionOptions, type Storyboard, type StoryboardFixtureResolution, type FixtureResolutionStrategy, type FixtureMatchOperator, type FixtureMatchClause, type FixtureResolutionDeclaration, type ProductFixtureResolutionDeclaration, type PricingOptionFixtureResolutionDeclaration, type FixtureResolutionStatus, type FixtureResolutionRecord, type FixtureResolutionAttempt, type FixtureResolutionEvidence, type FixtureResolutionCoverageGap, type StoryboardInvariants, type StoryboardInvariantsObject, type StepInvariantsObject, type StoryboardPhase, type StoryboardStep, type RateLimitTripSpec, type StoryboardValidation, type RateLimitTripClient, type RateLimitTripFailureCode, type RateLimitTripObservation, type RateLimitTripObserverOptions, type RateLimitTripResponseSnapshot, type RateLimitTripStructuredResult, type RateLimitTripTaskOptions, type StoryboardContext, type StoryboardRunOptions, type TrustedMatchContextProviderEndpoint, type TrustedMatchContextRegistrationContext, type TrustedMatchContextRouterRunnerOptions, type TrustedMatchPublisherAuthOperation, type TrustedMatchPublisherCredentialState, type TrustedMatchPublisherAuthTls, type TrustedMatchPublisherAuthProbeConfiguration, type TrustedMatchPublisherAuthRunner, type ValidationResult, type StoryboardStepPreview, type StoryboardStepResult, type StoryboardStepHint, type StoryboardStepHintBase, type ContextValueRejectedHint, type ShapeDriftHint, type MissingRequiredFieldHint, type FormatMismatchHint, type MonotonicViolationHint, type ContextProvenanceEntry, type StoryboardPhaseResult, type StoryboardResult, type RunnerNotice, type NoticeCode, type NoticeSeverity, type AgentCapabilities, type BundleKind, type BundleRef, type CapabilityResolutionCode, type ComplianceIndex, type ComplianceIndexProtocol, type ComplianceIndexSpecialism, type ResolveOptions, type ResolvedBundle, type ResolvedStoryboards, type SandboxBrand, type SandboxAgent, type SandboxEntities, type BrandJson, type AdagentsJson, gradeOAuthMetadataGraph, gradeOAuthMetadataGraphVector, loadOAuthMetadataGraphVectors, normalizeOAuthResourceForComparison, redactOAuthUrlForOutput, type GradeOAuthMetadataGraphOptions, type OAuthMetadataGraphErrorCode, type OAuthMetadataGraphFinding, type OAuthMetadataGraphGrade, type OAuthMetadataGraphObservation, type OAuthMetadataGraphVector, type OAuthMetadataGraphVectorCorpus, BrandJsonSchema, AdagentsJsonSchema, MCP_SESSION_PROBE_TASK, } from './storyboard/index.mjs';
|
|
@@ -16,5 +16,5 @@ export { isSandboxRequest, mergeSeededProductsIntoResponse, filterValidSeededPro
|
|
|
16
16
|
export type { TestControllerBridge, TestControllerBridgeContext, BridgeFromSessionStoreOptions, SeededCreative, SeededMediaBuy, SeededAccountFinancials, } from '../server/test-controller-bridge';
|
|
17
17
|
export { runAgainstLocalAgent } from './local-agent-runner';
|
|
18
18
|
export type { LocalAgentRunResult, PerStoryboardOverride, RunAgainstLocalAgentOptions } from './local-agent-runner';
|
|
19
|
-
export { registerExternalSchemaRoot, unregisterExternalSchemaRoot, withExternalSchemaRoot } from '../validation';
|
|
19
|
+
export { registerExternalSchemaRoot, unregisterExternalSchemaRoot, withExternalSchemaRoot, withServedReleaseSchemaRoots, } from '../validation';
|
|
20
20
|
export { runStoryboard, runStoryboardStep, applyAdcpVersionRunOptions, applyStoryboardVersionOptions, getFirstStepPreview, parseStoryboard, loadStoryboardFile, normalizeValidationOnlyTasks, VALIDATION_ONLY_TASK, applyFixtureBindingsToRequest, buildFixtureResolutionSpecs, FixtureBindingRegistry, matchesFixtureRequirements, normalizeFixtureMatchExpression, validateFixtureResolutionDeclarations, getComplianceCacheDir, loadComplianceIndex, listBundles, loadBundleStoryboards, listAllComplianceStoryboards, getComplianceStoryboardById, findBundleById, resolveBundleOrStoryboard, resolveStoryboardsForCapabilities, isComplianceVersionSupported, CapabilityResolutionError, TASK_TO_METHOD, executeStoryboardTask, expandCreativeAssetDirectives, findUnresolvedCreativeAssetDirectives, extractContext, injectContext, runValidations, resolvePath, RateLimitTripObserver, RATE_LIMIT_TRIP_CONTRACT, RATE_LIMIT_TRIP_DEFAULT_REPLAY_MAX_WAIT_SECONDS, RATE_LIMIT_TRIP_MAX_ATTEMPTS_MAX, RATE_LIMIT_TRIP_MAX_ATTEMPTS_MIN, validateRateLimitTripSpec, getSandboxEntities, getSandboxBrands, getSandboxBrand, isSandboxDomain, clearSandboxCache, registerAssertion, getAssertion, listAssertions, listDefaultAssertions, clearAssertionRegistry, resolveAssertions, type AssertionSpec, type AssertionContext, type AssertionResult, type RegisterAssertionOptions, type Storyboard, type StoryboardFixtureResolution, type FixtureResolutionStrategy, type FixtureMatchOperator, type FixtureMatchClause, type FixtureResolutionDeclaration, type ProductFixtureResolutionDeclaration, type PricingOptionFixtureResolutionDeclaration, type FixtureResolutionStatus, type FixtureResolutionRecord, type FixtureResolutionAttempt, type FixtureResolutionEvidence, type FixtureResolutionCoverageGap, type StoryboardInvariants, type StoryboardInvariantsObject, type StepInvariantsObject, type StoryboardPhase, type StoryboardStep, type RateLimitTripSpec, type StoryboardValidation, type RateLimitTripClient, type RateLimitTripFailureCode, type RateLimitTripObservation, type RateLimitTripObserverOptions, type RateLimitTripResponseSnapshot, type RateLimitTripStructuredResult, type RateLimitTripTaskOptions, type StoryboardContext, type StoryboardRunOptions, type TrustedMatchContextProviderEndpoint, type TrustedMatchContextRegistrationContext, type TrustedMatchContextRouterRunnerOptions, type TrustedMatchPublisherAuthOperation, type TrustedMatchPublisherCredentialState, type TrustedMatchPublisherAuthTls, type TrustedMatchPublisherAuthProbeConfiguration, type TrustedMatchPublisherAuthRunner, type ValidationResult, type StoryboardStepPreview, type StoryboardStepResult, type StoryboardStepHint, type StoryboardStepHintBase, type ContextValueRejectedHint, type ShapeDriftHint, type MissingRequiredFieldHint, type FormatMismatchHint, type MonotonicViolationHint, type ContextProvenanceEntry, type StoryboardPhaseResult, type StoryboardResult, type RunnerNotice, type NoticeCode, type NoticeSeverity, type AgentCapabilities, type BundleKind, type BundleRef, type CapabilityResolutionCode, type ComplianceIndex, type ComplianceIndexProtocol, type ComplianceIndexSpecialism, type ResolveOptions, type ResolvedBundle, type ResolvedStoryboards, type SandboxBrand, type SandboxAgent, type SandboxEntities, type BrandJson, type AdagentsJson, gradeOAuthMetadataGraph, gradeOAuthMetadataGraphVector, loadOAuthMetadataGraphVectors, normalizeOAuthResourceForComparison, redactOAuthUrlForOutput, type GradeOAuthMetadataGraphOptions, type OAuthMetadataGraphErrorCode, type OAuthMetadataGraphFinding, type OAuthMetadataGraphGrade, type OAuthMetadataGraphObservation, type OAuthMetadataGraphVector, type OAuthMetadataGraphVectorCorpus, BrandJsonSchema, AdagentsJsonSchema, MCP_SESSION_PROBE_TASK, } from './storyboard';
|
|
@@ -192,7 +192,8 @@ __export(testing_exports, {
|
|
|
192
192
|
unregisterExternalSchemaRoot: () => import_validation.unregisterExternalSchemaRoot,
|
|
193
193
|
validateFixtureResolutionDeclarations: () => import_storyboard.validateFixtureResolutionDeclarations,
|
|
194
194
|
validateRateLimitTripSpec: () => import_storyboard.validateRateLimitTripSpec,
|
|
195
|
-
withExternalSchemaRoot: () => import_validation.withExternalSchemaRoot
|
|
195
|
+
withExternalSchemaRoot: () => import_validation.withExternalSchemaRoot,
|
|
196
|
+
withServedReleaseSchemaRoots: () => import_validation.withServedReleaseSchemaRoots
|
|
196
197
|
});
|
|
197
198
|
module.exports = __toCommonJS(testing_exports);
|
|
198
199
|
var import_pending_web_flow_store = require('./pending-web-flow-store.js');
|
|
@@ -384,5 +385,6 @@ var import_storyboard = require('./storyboard/index.js');
|
|
|
384
385
|
unregisterExternalSchemaRoot,
|
|
385
386
|
validateFixtureResolutionDeclarations,
|
|
386
387
|
validateRateLimitTripSpec,
|
|
387
|
-
withExternalSchemaRoot
|
|
388
|
+
withExternalSchemaRoot,
|
|
389
|
+
withServedReleaseSchemaRoots
|
|
388
390
|
});
|
|
@@ -122,7 +122,12 @@ import {
|
|
|
122
122
|
bridgeFromSessionStore
|
|
123
123
|
} from "../server/test-controller-bridge.mjs";
|
|
124
124
|
import { runAgainstLocalAgent } from "./local-agent-runner.mjs";
|
|
125
|
-
import {
|
|
125
|
+
import {
|
|
126
|
+
registerExternalSchemaRoot,
|
|
127
|
+
unregisterExternalSchemaRoot,
|
|
128
|
+
withExternalSchemaRoot,
|
|
129
|
+
withServedReleaseSchemaRoots
|
|
130
|
+
} from "../validation/index.mjs";
|
|
126
131
|
import {
|
|
127
132
|
runStoryboard,
|
|
128
133
|
runStoryboardStep,
|
|
@@ -359,5 +364,6 @@ export {
|
|
|
359
364
|
unregisterExternalSchemaRoot,
|
|
360
365
|
validateFixtureResolutionDeclarations,
|
|
361
366
|
validateRateLimitTripSpec,
|
|
362
|
-
withExternalSchemaRoot
|
|
367
|
+
withExternalSchemaRoot,
|
|
368
|
+
withServedReleaseSchemaRoots
|
|
363
369
|
};
|
|
@@ -783,14 +783,14 @@ async function runStoryboard(agentUrlOrUrls, storyboard, options = {}) {
|
|
|
783
783
|
};
|
|
784
784
|
}
|
|
785
785
|
const schemaRoot = getRunSchemaRoot(options);
|
|
786
|
+
const runBody = () => (0, import_schema_loader.withServedReleaseSchemaRoots)(
|
|
787
|
+
options.servedReleaseSchemaRoots,
|
|
788
|
+
() => runStoryboardBody(agentUrlOrUrls, storyboard, options)
|
|
789
|
+
);
|
|
786
790
|
if (schemaRoot) {
|
|
787
|
-
return await (0, import_schema_loader.withExternalSchemaRoot)(
|
|
788
|
-
schemaRoot.adcpVersion,
|
|
789
|
-
schemaRoot.schemaRoot,
|
|
790
|
-
() => runStoryboardBody(agentUrlOrUrls, storyboard, options)
|
|
791
|
-
);
|
|
791
|
+
return await (0, import_schema_loader.withExternalSchemaRoot)(schemaRoot.adcpVersion, schemaRoot.schemaRoot, runBody);
|
|
792
792
|
}
|
|
793
|
-
return await
|
|
793
|
+
return await runBody();
|
|
794
794
|
},
|
|
795
795
|
{ isolate: !(0, import_client.hasTestClientScope)() }
|
|
796
796
|
);
|
|
@@ -3117,14 +3117,14 @@ async function runStoryboardStep(agentUrl, storyboard, stepId, options = {}) {
|
|
|
3117
3117
|
options = (0, import_test_kit.resolveDeclaredTestKit)(storyboard, options);
|
|
3118
3118
|
options = (0, import_native_a2a_compliance.applyNativeA2AComplianceTransportOptions)(options);
|
|
3119
3119
|
const schemaRoot = getRunSchemaRoot(options);
|
|
3120
|
+
const runBody = () => (0, import_schema_loader.withServedReleaseSchemaRoots)(
|
|
3121
|
+
options.servedReleaseSchemaRoots,
|
|
3122
|
+
() => runStoryboardStepBody(agentUrl, storyboard, stepId, options)
|
|
3123
|
+
);
|
|
3120
3124
|
if (schemaRoot) {
|
|
3121
|
-
return await (0, import_schema_loader.withExternalSchemaRoot)(
|
|
3122
|
-
schemaRoot.adcpVersion,
|
|
3123
|
-
schemaRoot.schemaRoot,
|
|
3124
|
-
() => runStoryboardStepBody(agentUrl, storyboard, stepId, options)
|
|
3125
|
-
);
|
|
3125
|
+
return await (0, import_schema_loader.withExternalSchemaRoot)(schemaRoot.adcpVersion, schemaRoot.schemaRoot, runBody);
|
|
3126
3126
|
}
|
|
3127
|
-
return await
|
|
3127
|
+
return await runBody();
|
|
3128
3128
|
},
|
|
3129
3129
|
{ isolate: !(0, import_client.hasTestClientScope)() }
|
|
3130
3130
|
);
|
|
@@ -61,7 +61,8 @@ import {
|
|
|
61
61
|
getSchemaValidatorByRef,
|
|
62
62
|
resolveBundleKey,
|
|
63
63
|
schemaAllowsTopLevelField,
|
|
64
|
-
withExternalSchemaRoot
|
|
64
|
+
withExternalSchemaRoot,
|
|
65
|
+
withServedReleaseSchemaRoots
|
|
65
66
|
} from "../../validation/schema-loader.mjs";
|
|
66
67
|
import { ADCP_VERSION, parseAdcpMajorVersion } from "../../version.mjs";
|
|
67
68
|
import {
|
|
@@ -806,14 +807,14 @@ async function runStoryboard(agentUrlOrUrls, storyboard, options = {}) {
|
|
|
806
807
|
};
|
|
807
808
|
}
|
|
808
809
|
const schemaRoot = getRunSchemaRoot(options);
|
|
810
|
+
const runBody = () => withServedReleaseSchemaRoots(
|
|
811
|
+
options.servedReleaseSchemaRoots,
|
|
812
|
+
() => runStoryboardBody(agentUrlOrUrls, storyboard, options)
|
|
813
|
+
);
|
|
809
814
|
if (schemaRoot) {
|
|
810
|
-
return await withExternalSchemaRoot(
|
|
811
|
-
schemaRoot.adcpVersion,
|
|
812
|
-
schemaRoot.schemaRoot,
|
|
813
|
-
() => runStoryboardBody(agentUrlOrUrls, storyboard, options)
|
|
814
|
-
);
|
|
815
|
+
return await withExternalSchemaRoot(schemaRoot.adcpVersion, schemaRoot.schemaRoot, runBody);
|
|
815
816
|
}
|
|
816
|
-
return await
|
|
817
|
+
return await runBody();
|
|
817
818
|
},
|
|
818
819
|
{ isolate: !hasTestClientScope() }
|
|
819
820
|
);
|
|
@@ -3140,14 +3141,14 @@ async function runStoryboardStep(agentUrl, storyboard, stepId, options = {}) {
|
|
|
3140
3141
|
options = resolveDeclaredTestKit(storyboard, options);
|
|
3141
3142
|
options = applyNativeA2AComplianceTransportOptions(options);
|
|
3142
3143
|
const schemaRoot = getRunSchemaRoot(options);
|
|
3144
|
+
const runBody = () => withServedReleaseSchemaRoots(
|
|
3145
|
+
options.servedReleaseSchemaRoots,
|
|
3146
|
+
() => runStoryboardStepBody(agentUrl, storyboard, stepId, options)
|
|
3147
|
+
);
|
|
3143
3148
|
if (schemaRoot) {
|
|
3144
|
-
return await withExternalSchemaRoot(
|
|
3145
|
-
schemaRoot.adcpVersion,
|
|
3146
|
-
schemaRoot.schemaRoot,
|
|
3147
|
-
() => runStoryboardStepBody(agentUrl, storyboard, stepId, options)
|
|
3148
|
-
);
|
|
3149
|
+
return await withExternalSchemaRoot(schemaRoot.adcpVersion, schemaRoot.schemaRoot, runBody);
|
|
3149
3150
|
}
|
|
3150
|
-
return await
|
|
3151
|
+
return await runBody();
|
|
3151
3152
|
},
|
|
3152
3153
|
{ isolate: !hasTestClientScope() }
|
|
3153
3154
|
);
|
|
@@ -197,7 +197,7 @@ export interface UpstreamTrafficQueryResult {
|
|
|
197
197
|
*/
|
|
198
198
|
export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
|
|
199
199
|
/** Capability semver emitted in run summaries and used for advisory expiry. */
|
|
200
|
-
export declare const RUNNER_CAPABILITY_VERSION = "16.0.0-beta.
|
|
200
|
+
export declare const RUNNER_CAPABILITY_VERSION = "16.0.0-beta.7";
|
|
201
201
|
/** True when a failed validation contributes to the owning step's grade. */
|
|
202
202
|
export declare function validationFailsStep(result: ValidationResult): boolean;
|
|
203
203
|
/**
|
|
@@ -197,7 +197,7 @@ export interface UpstreamTrafficQueryResult {
|
|
|
197
197
|
*/
|
|
198
198
|
export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
|
|
199
199
|
/** Capability semver emitted in run summaries and used for advisory expiry. */
|
|
200
|
-
export declare const RUNNER_CAPABILITY_VERSION = "16.0.0-beta.
|
|
200
|
+
export declare const RUNNER_CAPABILITY_VERSION = "16.0.0-beta.7";
|
|
201
201
|
/** True when a failed validation contributes to the owning step's grade. */
|
|
202
202
|
export declare function validationFailsStep(result: ValidationResult): boolean;
|
|
203
203
|
/**
|
|
@@ -259,6 +259,21 @@ function mapZodIssueToSchemaKeyword(issue) {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
function validateResponseSchema(validation, ctx, taskResult) {
|
|
262
|
+
const pinnedVersion = ctx.adcpVersion;
|
|
263
|
+
if (ctx.taskName === "get_adcp_capabilities" && pinnedVersion !== void 0) {
|
|
264
|
+
return (0, import_schema_loader.withServedValidationVersion)(
|
|
265
|
+
taskResult.data,
|
|
266
|
+
pinnedVersion,
|
|
267
|
+
(validationVersion) => validateResponseSchemaForVersion(
|
|
268
|
+
validation,
|
|
269
|
+
validationVersion === pinnedVersion ? ctx : { ...ctx, adcpVersion: validationVersion, responseAdcpVersion: validationVersion },
|
|
270
|
+
taskResult
|
|
271
|
+
)
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
return validateResponseSchemaForVersion(validation, ctx, taskResult);
|
|
275
|
+
}
|
|
276
|
+
function validateResponseSchemaForVersion(validation, ctx, taskResult) {
|
|
262
277
|
const taskName = ctx.taskName;
|
|
263
278
|
const schemaIdentityVersion = ctx.adcpVersion ?? ctx.responseAdcpVersion ?? import_version.ADCP_VERSION;
|
|
264
279
|
const { schema_id, schema_url } = resolveSchemaIdentity(ctx.responseSchemaRef, schemaIdentityVersion);
|
|
@@ -356,7 +371,14 @@ function validateResponseSchema(validation, ctx, taskResult) {
|
|
|
356
371
|
}
|
|
357
372
|
function isExternalResponseSchemaAuthoritative(ctx) {
|
|
358
373
|
const validationVersion = responseSchemaValidationVersion(ctx.adcpVersion, ctx.responseAdcpVersion);
|
|
359
|
-
|
|
374
|
+
if (validationVersion !== void 0 && (0, import_schema_loader.isExternalSchemaRootActive)(validationVersion)) return true;
|
|
375
|
+
const pinnedVersion = ctx.adcpVersion;
|
|
376
|
+
if (ctx.taskName !== "get_adcp_capabilities" || pinnedVersion === void 0 || !ctx.taskResult) return false;
|
|
377
|
+
return (0, import_schema_loader.withServedValidationVersion)(
|
|
378
|
+
ctx.taskResult.data,
|
|
379
|
+
pinnedVersion,
|
|
380
|
+
(version) => version !== pinnedVersion && (0, import_schema_loader.isExternalSchemaRootActive)(version)
|
|
381
|
+
);
|
|
360
382
|
}
|
|
361
383
|
function responseSchemaValidationVersion(adcpVersion, responseAdcpVersion) {
|
|
362
384
|
if (adcpVersion && (0, import_schema_loader.isExternalSchemaRootActive)(adcpVersion)) return adcpVersion;
|
|
@@ -2,7 +2,11 @@ import { prepareResponseForSchemaValidation, TOOL_RESPONSE_SCHEMAS } from "../..
|
|
|
2
2
|
import { injectLegacyEnvelopeStatus } from "../../utils/envelope-status-compat.mjs";
|
|
3
3
|
import { TRANSPORT_SUFFIX_REGEX } from "../../utils/a2a-discovery.mjs";
|
|
4
4
|
import { validateResponse } from "../../validation/schema-validator.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
hasSchemaBundle,
|
|
7
|
+
isExternalSchemaRootActive,
|
|
8
|
+
withServedValidationVersion
|
|
9
|
+
} from "../../validation/schema-loader.mjs";
|
|
6
10
|
import { ADCP_VERSION, LIBRARY_VERSION } from "../../version.mjs";
|
|
7
11
|
import { isPre31AdcpVersion } from "../../utils/adcp-version-config.mjs";
|
|
8
12
|
import { gte as semverGte, valid as validSemver } from "semver";
|
|
@@ -234,6 +238,21 @@ function mapZodIssueToSchemaKeyword(issue) {
|
|
|
234
238
|
}
|
|
235
239
|
}
|
|
236
240
|
function validateResponseSchema(validation, ctx, taskResult) {
|
|
241
|
+
const pinnedVersion = ctx.adcpVersion;
|
|
242
|
+
if (ctx.taskName === "get_adcp_capabilities" && pinnedVersion !== void 0) {
|
|
243
|
+
return withServedValidationVersion(
|
|
244
|
+
taskResult.data,
|
|
245
|
+
pinnedVersion,
|
|
246
|
+
(validationVersion) => validateResponseSchemaForVersion(
|
|
247
|
+
validation,
|
|
248
|
+
validationVersion === pinnedVersion ? ctx : { ...ctx, adcpVersion: validationVersion, responseAdcpVersion: validationVersion },
|
|
249
|
+
taskResult
|
|
250
|
+
)
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
return validateResponseSchemaForVersion(validation, ctx, taskResult);
|
|
254
|
+
}
|
|
255
|
+
function validateResponseSchemaForVersion(validation, ctx, taskResult) {
|
|
237
256
|
const taskName = ctx.taskName;
|
|
238
257
|
const schemaIdentityVersion = ctx.adcpVersion ?? ctx.responseAdcpVersion ?? ADCP_VERSION;
|
|
239
258
|
const { schema_id, schema_url } = resolveSchemaIdentity(ctx.responseSchemaRef, schemaIdentityVersion);
|
|
@@ -331,7 +350,14 @@ function validateResponseSchema(validation, ctx, taskResult) {
|
|
|
331
350
|
}
|
|
332
351
|
function isExternalResponseSchemaAuthoritative(ctx) {
|
|
333
352
|
const validationVersion = responseSchemaValidationVersion(ctx.adcpVersion, ctx.responseAdcpVersion);
|
|
334
|
-
|
|
353
|
+
if (validationVersion !== void 0 && isExternalSchemaRootActive(validationVersion)) return true;
|
|
354
|
+
const pinnedVersion = ctx.adcpVersion;
|
|
355
|
+
if (ctx.taskName !== "get_adcp_capabilities" || pinnedVersion === void 0 || !ctx.taskResult) return false;
|
|
356
|
+
return withServedValidationVersion(
|
|
357
|
+
ctx.taskResult.data,
|
|
358
|
+
pinnedVersion,
|
|
359
|
+
(version) => version !== pinnedVersion && isExternalSchemaRootActive(version)
|
|
360
|
+
);
|
|
335
361
|
}
|
|
336
362
|
function responseSchemaValidationVersion(adcpVersion, responseAdcpVersion) {
|
|
337
363
|
if (adcpVersion && isExternalSchemaRootActive(adcpVersion)) return adcpVersion;
|
|
@@ -58,6 +58,45 @@ export interface TestOptions {
|
|
|
58
58
|
* authoritative over the SDK's generated Zod snapshot for the run.
|
|
59
59
|
*/
|
|
60
60
|
schemaRoot?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Schema roots for releases the agent may echo in its
|
|
63
|
+
* `get_adcp_capabilities` response, keyed by AdCP version (`'3.2'`,
|
|
64
|
+
* `'3.2.5'`, `'3.3.0-beta.1'`). Values are schema-data roots in the same
|
|
65
|
+
* shape as `schemaRoot`.
|
|
66
|
+
*
|
|
67
|
+
* A 3.0 pin sends only `adcp_major_version`, so an agent may serve and echo
|
|
68
|
+
* a newer release in the same major (versioning spec, "Server echoes").
|
|
69
|
+
* The SDK validates that capabilities response against the echoed release
|
|
70
|
+
* when the echo is the pin's major, is listed in the response's
|
|
71
|
+
* `adcp.supported_versions`, and has a schema root: an entry here, an
|
|
72
|
+
* external root registered for it, or the SDK's bundled schemas. That
|
|
73
|
+
* applies to discovery's capability notices, `getAdcpCapabilities()` and
|
|
74
|
+
* storyboard `response_schema` checks on `get_adcp_capabilities`, including
|
|
75
|
+
* when `schemaRoot` is set for the pin. Otherwise validation stays on the
|
|
76
|
+
* pin.
|
|
77
|
+
*
|
|
78
|
+
* Entries are used for that capabilities validation only. Every other
|
|
79
|
+
* task's response, storyboard selection and grading stay on the pin. Each
|
|
80
|
+
* root is checked against its key once per process; a malformed map throws
|
|
81
|
+
* before the run starts. Honored by `comply()`, `runStoryboard()` and
|
|
82
|
+
* `runStoryboardStep()`; other callers can use `withServedReleaseSchemaRoots`.
|
|
83
|
+
* The echo is compared with the run's pin, so storyboard checks apply it
|
|
84
|
+
* only when the run has one (`adcpVersion`, or the storyboard or compliance
|
|
85
|
+
* bundle's `adcp_version`); `comply()` always does.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* await comply(agentUrl, {
|
|
90
|
+
* complianceDir: hosted30.complianceDir,
|
|
91
|
+
* schemaRoot: hosted30.schemaRoot,
|
|
92
|
+
* servedReleaseSchemaRoots: {
|
|
93
|
+
* '3.1.29': hosted31.schemaRoot,
|
|
94
|
+
* '3.2.5': hosted32.schemaRoot,
|
|
95
|
+
* },
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
servedReleaseSchemaRoots?: Readonly<Record<string, string>>;
|
|
61
100
|
/**
|
|
62
101
|
* Whether strict AJV response-schema failures contribute to storyboard
|
|
63
102
|
* grading. Defaults to `true`, matching the hosted compliance grader.
|
|
@@ -58,6 +58,45 @@ export interface TestOptions {
|
|
|
58
58
|
* authoritative over the SDK's generated Zod snapshot for the run.
|
|
59
59
|
*/
|
|
60
60
|
schemaRoot?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Schema roots for releases the agent may echo in its
|
|
63
|
+
* `get_adcp_capabilities` response, keyed by AdCP version (`'3.2'`,
|
|
64
|
+
* `'3.2.5'`, `'3.3.0-beta.1'`). Values are schema-data roots in the same
|
|
65
|
+
* shape as `schemaRoot`.
|
|
66
|
+
*
|
|
67
|
+
* A 3.0 pin sends only `adcp_major_version`, so an agent may serve and echo
|
|
68
|
+
* a newer release in the same major (versioning spec, "Server echoes").
|
|
69
|
+
* The SDK validates that capabilities response against the echoed release
|
|
70
|
+
* when the echo is the pin's major, is listed in the response's
|
|
71
|
+
* `adcp.supported_versions`, and has a schema root: an entry here, an
|
|
72
|
+
* external root registered for it, or the SDK's bundled schemas. That
|
|
73
|
+
* applies to discovery's capability notices, `getAdcpCapabilities()` and
|
|
74
|
+
* storyboard `response_schema` checks on `get_adcp_capabilities`, including
|
|
75
|
+
* when `schemaRoot` is set for the pin. Otherwise validation stays on the
|
|
76
|
+
* pin.
|
|
77
|
+
*
|
|
78
|
+
* Entries are used for that capabilities validation only. Every other
|
|
79
|
+
* task's response, storyboard selection and grading stay on the pin. Each
|
|
80
|
+
* root is checked against its key once per process; a malformed map throws
|
|
81
|
+
* before the run starts. Honored by `comply()`, `runStoryboard()` and
|
|
82
|
+
* `runStoryboardStep()`; other callers can use `withServedReleaseSchemaRoots`.
|
|
83
|
+
* The echo is compared with the run's pin, so storyboard checks apply it
|
|
84
|
+
* only when the run has one (`adcpVersion`, or the storyboard or compliance
|
|
85
|
+
* bundle's `adcp_version`); `comply()` always does.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* await comply(agentUrl, {
|
|
90
|
+
* complianceDir: hosted30.complianceDir,
|
|
91
|
+
* schemaRoot: hosted30.schemaRoot,
|
|
92
|
+
* servedReleaseSchemaRoots: {
|
|
93
|
+
* '3.1.29': hosted31.schemaRoot,
|
|
94
|
+
* '3.2.5': hosted32.schemaRoot,
|
|
95
|
+
* },
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
servedReleaseSchemaRoots?: Readonly<Record<string, string>>;
|
|
61
100
|
/**
|
|
62
101
|
* Whether strict AJV response-schema failures contribute to storyboard
|
|
63
102
|
* grading. Defaults to `true`, matching the hosted compliance grader.
|
|
@@ -224,7 +224,10 @@ function toCanonicalFormatOptionsWithRoutes(productId, formatOptions) {
|
|
|
224
224
|
}
|
|
225
225
|
function toAdditiveCanonicalProduct(product, options) {
|
|
226
226
|
const { product: augmented, diagnostics } = augmentProductWithFormatOptions(product, options);
|
|
227
|
-
const projected = toCanonicalFormatOptionsWithRoutes(
|
|
227
|
+
const projected = toCanonicalFormatOptionsWithRoutes(
|
|
228
|
+
product.product_id,
|
|
229
|
+
options?._inferDualEmissionLegacyRefs === false ? augmented.format_options : (0, import_v1_to_v2.withDualEmissionLegacyRefs)(augmented.format_options, product.format_ids)
|
|
230
|
+
);
|
|
228
231
|
return {
|
|
229
232
|
product: {
|
|
230
233
|
...augmented,
|
|
@@ -299,13 +302,13 @@ function formatRefCoverageKey(ref) {
|
|
|
299
302
|
function toCanonicalOnlyProduct(product, options) {
|
|
300
303
|
const existing = product.format_options;
|
|
301
304
|
if (Array.isArray(existing)) {
|
|
302
|
-
const formatOptions = existing;
|
|
305
|
+
const formatOptions = options?._inferDualEmissionLegacyRefs === false ? existing : (0, import_v1_to_v2.withDualEmissionLegacyRefs)(existing, product.format_ids);
|
|
303
306
|
const diagnostics2 = [];
|
|
304
307
|
const inputIds = Array.isArray(product.format_ids) ? product.format_ids : [];
|
|
305
308
|
if (inputIds.length > 0) {
|
|
306
309
|
const covered = /* @__PURE__ */ new Set();
|
|
307
310
|
for (const opt of formatOptions) {
|
|
308
|
-
const refs =
|
|
311
|
+
const refs = (0, import_legacy_metadata.legacyFormatRefsForDeclaration)(opt);
|
|
309
312
|
for (const ref of refs) covered.add(formatRefCoverageKey(ref));
|
|
310
313
|
}
|
|
311
314
|
for (let k = 0; k < inputIds.length; k++) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { projectV1ProductToV2 } from "./v1-to-v2.mjs";
|
|
1
|
+
import { projectV1ProductToV2, withDualEmissionLegacyRefs } from "./v1-to-v2.mjs";
|
|
2
2
|
import { LIBRARY_VERSION } from "../../version.mjs";
|
|
3
3
|
import { canonicalize as canonicalizeJson } from "../../utils/jcs.mjs";
|
|
4
|
-
import { concealLegacyFormatRefs } from "./legacy-metadata.mjs";
|
|
4
|
+
import { concealLegacyFormatRefs, legacyFormatRefsForDeclaration } from "./legacy-metadata.mjs";
|
|
5
5
|
import { legacyRoutesForProduct } from "./legacy-routes.mjs";
|
|
6
6
|
const SDK_ID = `@adcp/sdk@${LIBRARY_VERSION}`;
|
|
7
7
|
const DIRECT_LEGACY_FORMAT_IDENTITY_KEYS = /* @__PURE__ */ new Set(["agenturl", "formatid", "formatids", "v1formatref"]);
|
|
@@ -194,7 +194,10 @@ function toCanonicalFormatOptionsWithRoutes(productId, formatOptions) {
|
|
|
194
194
|
}
|
|
195
195
|
function toAdditiveCanonicalProduct(product, options) {
|
|
196
196
|
const { product: augmented, diagnostics } = augmentProductWithFormatOptions(product, options);
|
|
197
|
-
const projected = toCanonicalFormatOptionsWithRoutes(
|
|
197
|
+
const projected = toCanonicalFormatOptionsWithRoutes(
|
|
198
|
+
product.product_id,
|
|
199
|
+
options?._inferDualEmissionLegacyRefs === false ? augmented.format_options : withDualEmissionLegacyRefs(augmented.format_options, product.format_ids)
|
|
200
|
+
);
|
|
198
201
|
return {
|
|
199
202
|
product: {
|
|
200
203
|
...augmented,
|
|
@@ -269,13 +272,13 @@ function formatRefCoverageKey(ref) {
|
|
|
269
272
|
function toCanonicalOnlyProduct(product, options) {
|
|
270
273
|
const existing = product.format_options;
|
|
271
274
|
if (Array.isArray(existing)) {
|
|
272
|
-
const formatOptions = existing;
|
|
275
|
+
const formatOptions = options?._inferDualEmissionLegacyRefs === false ? existing : withDualEmissionLegacyRefs(existing, product.format_ids);
|
|
273
276
|
const diagnostics2 = [];
|
|
274
277
|
const inputIds = Array.isArray(product.format_ids) ? product.format_ids : [];
|
|
275
278
|
if (inputIds.length > 0) {
|
|
276
279
|
const covered = /* @__PURE__ */ new Set();
|
|
277
280
|
for (const opt of formatOptions) {
|
|
278
|
-
const refs =
|
|
281
|
+
const refs = legacyFormatRefsForDeclaration(opt);
|
|
279
282
|
for (const ref of refs) covered.add(formatRefCoverageKey(ref));
|
|
280
283
|
}
|
|
281
284
|
for (let k = 0; k < inputIds.length; k++) {
|
|
@@ -378,26 +378,15 @@ function candidatesFromContainer(container, canonicalFormatLegacyResolver, opera
|
|
|
378
378
|
);
|
|
379
379
|
}
|
|
380
380
|
const candidates = [];
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
candidates.push({
|
|
385
|
-
ref,
|
|
386
|
-
formatKind: (0, import_v1_to_v2.resolveCanonicalFormatKind)(ref.id) ?? containerKind,
|
|
387
|
-
selectorParams: container.params
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
const formatOptions = [
|
|
392
|
-
...Array.isArray(container.format_options) ? container.format_options : [],
|
|
393
|
-
...(0, import_legacy_metadata.selectedFormatOptions)(container)
|
|
394
|
-
];
|
|
395
|
-
for (const optionValue of formatOptions) {
|
|
381
|
+
const nativeOptions = Array.isArray(container.format_options) ? container.format_options : [];
|
|
382
|
+
const formatOptions = [...nativeOptions, ...(0, import_legacy_metadata.selectedFormatOptions)(container)];
|
|
383
|
+
const resolvedOptions = formatOptions.map((optionValue) => {
|
|
396
384
|
const option = record(optionValue);
|
|
397
|
-
if (!option)
|
|
385
|
+
if (!option) return optionValue;
|
|
398
386
|
const formatKind = typeof option.format_kind === "string" ? option.format_kind : void 0;
|
|
399
387
|
const formatOptionRef = optionReference(option);
|
|
400
388
|
let refs = [...(0, import_legacy_metadata.legacyFormatRefsForDeclaration)(option)];
|
|
389
|
+
if (refs.length > 0) return optionValue;
|
|
401
390
|
if (refs.length === 0 && option.canonical_formats_only !== true && formatKind) {
|
|
402
391
|
try {
|
|
403
392
|
refs = (0, import_v2_to_v1.resolveCanonicalFormatLegacyRefs)(canonicalFormatLegacyResolver, {
|
|
@@ -415,10 +404,33 @@ function candidatesFromContainer(container, canonicalFormatLegacyResolver, opera
|
|
|
415
404
|
);
|
|
416
405
|
}
|
|
417
406
|
}
|
|
418
|
-
|
|
407
|
+
return refs.length > 0 ? { ...option, v1_format_ref: refs } : optionValue;
|
|
408
|
+
});
|
|
409
|
+
const pairedOptions = [
|
|
410
|
+
...(0, import_v1_to_v2.withDualEmissionLegacyRefs)(resolvedOptions.slice(0, nativeOptions.length), container.format_ids),
|
|
411
|
+
...resolvedOptions.slice(nativeOptions.length)
|
|
412
|
+
];
|
|
413
|
+
for (const optionValue of pairedOptions) {
|
|
414
|
+
const option = record(optionValue);
|
|
415
|
+
if (!option) continue;
|
|
416
|
+
const formatKind = typeof option.format_kind === "string" ? option.format_kind : void 0;
|
|
417
|
+
const formatOptionRef = optionReference(option);
|
|
418
|
+
for (const ref of (0, import_legacy_metadata.legacyFormatRefsForDeclaration)(option)) {
|
|
419
419
|
candidates.push({ ref, formatKind, formatOptionRef, selectorParams: option.params ?? container.params });
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
+
const linkedRefs = new Set(candidates.map((candidate) => candidateKey({ ref: candidate.ref })));
|
|
423
|
+
const containerKind = typeof container.format_kind === "string" ? container.format_kind : void 0;
|
|
424
|
+
for (const key of ["format_ids", "formats"]) {
|
|
425
|
+
for (const ref of refsFromValue(container[key])) {
|
|
426
|
+
if (linkedRefs.has(candidateKey({ ref }))) continue;
|
|
427
|
+
candidates.push({
|
|
428
|
+
ref,
|
|
429
|
+
formatKind: (0, import_v1_to_v2.resolveCanonicalFormatKind)(ref.id) ?? containerKind,
|
|
430
|
+
selectorParams: container.params
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
}
|
|
422
434
|
return uniqueCandidates(candidates);
|
|
423
435
|
}
|
|
424
436
|
function containerOptsOutOfLegacy(container, formatKind, formatOptionRef) {
|