@adcp/sdk 17.0.0-beta.0 → 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/3.1/bidding.js +1 -1
- package/dist/lib/adapters/version/3.1/bidding.mjs +1 -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/ResponseValidator.js +1 -1
- package/dist/lib/core/ResponseValidator.mjs +1 -1
- package/dist/lib/core/SingleAgentClient.d.mts +122 -7
- package/dist/lib/core/SingleAgentClient.d.ts +122 -7
- package/dist/lib/core/SingleAgentClient.js +601 -96
- package/dist/lib/core/SingleAgentClient.mjs +590 -84
- package/dist/lib/core/TaskExecutor.d.mts +7 -0
- package/dist/lib/core/TaskExecutor.d.ts +7 -0
- package/dist/lib/core/TaskExecutor.js +23 -8
- package/dist/lib/core/TaskExecutor.mjs +23 -8
- 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/errors/index.d.mts +22 -0
- package/dist/lib/errors/index.d.ts +22 -0
- package/dist/lib/errors/index.js +43 -0
- package/dist/lib/errors/index.mjs +42 -0
- 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 +7 -53
- package/dist/lib/index.d.ts +7 -53
- package/dist/lib/index.js +13 -0
- package/dist/lib/index.mjs +9 -0
- package/dist/lib/media-buy/compatibility.js +6 -1
- package/dist/lib/media-buy/compatibility.mjs +6 -1
- package/dist/lib/protocols/mcp-modern.d.mts +2 -0
- package/dist/lib/protocols/mcp-modern.d.ts +2 -0
- package/dist/lib/protocols/mcp-modern.js +31 -5
- package/dist/lib/protocols/mcp-modern.mjs +31 -5
- package/dist/lib/protocols/mcp-scope.d.mts +6 -1
- package/dist/lib/protocols/mcp-scope.d.ts +6 -1
- package/dist/lib/protocols/mcp-scope.js +25 -3
- package/dist/lib/protocols/mcp-scope.mjs +24 -3
- package/dist/lib/protocols/mcp.js +12 -6
- package/dist/lib/protocols/mcp.mjs +13 -6
- 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/client.d.mts +1 -0
- package/dist/lib/testing/client.d.ts +1 -0
- package/dist/lib/testing/client.js +6 -5
- package/dist/lib/testing/client.mjs +6 -5
- package/dist/lib/testing/storyboard/agent-routing.d.mts +5 -2
- package/dist/lib/testing/storyboard/agent-routing.d.ts +5 -2
- package/dist/lib/testing/storyboard/agent-routing.js +11 -4
- package/dist/lib/testing/storyboard/agent-routing.mjs +11 -4
- 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/context.d.mts +13 -3
- package/dist/lib/testing/storyboard/context.d.ts +13 -3
- package/dist/lib/testing/storyboard/context.js +15 -10
- package/dist/lib/testing/storyboard/context.mjs +15 -10
- 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/runner.js +141 -13
- package/dist/lib/testing/storyboard/runner.mjs +141 -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 +4 -1
- package/dist/lib/testing/storyboard/validations.mjs +4 -1
- package/dist/lib/testing/test-controller.js +3 -0
- package/dist/lib/testing/test-controller.mjs +3 -0
- 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/envelope-status-compat.d.mts +18 -1
- package/dist/lib/utils/envelope-status-compat.d.ts +18 -1
- package/dist/lib/utils/envelope-status-compat.js +11 -5
- package/dist/lib/utils/envelope-status-compat.mjs +11 -5
- package/dist/lib/utils/response-unwrapper.js +18 -10
- package/dist/lib/utils/response-unwrapper.mjs +18 -10
- 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 +159 -39
- package/dist/lib/v2/projection/creative-delivery.mjs +163 -39
- 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 +136 -43
- package/dist/lib/validation/schema-validator.mjs +140 -44
- 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/COLLECTION-FIXTURE-FOUNDATION.md +11 -0
- package/docs/guides/DELIVERY-WEBHOOK-PARSING.md +142 -0
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +27 -1
- 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 +202 -2
- package/docs/migration-6.6-to-6.7.md +14 -0
- package/docs/migration-account-change-feed.md +15 -0
- package/docs/migration-reporting-storage-package.md +1 -1
- package/docs/recipes/verifying-inbound-webhooks.md +18 -2
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ import { eTldPlusOne } from "../signing/agent-resolver/etld.mjs";
|
|
|
6
6
|
import { parseStrictJson } from "../signing/agent-resolver/strict-json.mjs";
|
|
7
7
|
import { parse as parseDomain } from "tldts";
|
|
8
8
|
import schemas from "./schemas.draft.mjs";
|
|
9
|
-
const ajv = new Ajv({ strict: false, allErrors: false });
|
|
9
|
+
const ajv = new Ajv({ inlineRefs: false, strict: false, allErrors: false });
|
|
10
10
|
addFormats(ajv);
|
|
11
11
|
for (const schema of schemas) ajv.addSchema(schema);
|
|
12
12
|
function validateIdentity33Schema(id, value) {
|
|
@@ -294,13 +294,16 @@ function authorityGroup(operator) {
|
|
|
294
294
|
const provider = parseDomain(operator).domain;
|
|
295
295
|
return `private:${provider ?? operator}`;
|
|
296
296
|
}
|
|
297
|
+
const INTERMEDIARY_FETCH_CONCURRENCY = 8;
|
|
297
298
|
function grantsScope(grant, scope) {
|
|
298
299
|
return grant.scopes.some(
|
|
299
300
|
(granted) => granted === "*" || granted === scope || granted === "adcp:all" && scope.startsWith("adcp:")
|
|
300
301
|
);
|
|
301
302
|
}
|
|
302
303
|
function grantMatches(grant, target, claim, now) {
|
|
303
|
-
|
|
304
|
+
return registrableGrantee(grant.grantee) === target && grantCovers(grant, claim, now);
|
|
305
|
+
}
|
|
306
|
+
function grantCovers(grant, claim, now) {
|
|
304
307
|
if (!grantsScope(grant, claim.scope)) return false;
|
|
305
308
|
if (grant.agents && !grant.agents.some((agent) => grantAgentOrigin(agent.url) === canonicalAgentOrigin(claim.signerOrigin)))
|
|
306
309
|
return false;
|
|
@@ -326,7 +329,6 @@ async function authorizeDemandGrant(claim, options) {
|
|
|
326
329
|
...grants.some((g) => g.valid_until) ? { expiresAt: Math.min(...grants.map((g) => g.valid_until ? Date.parse(g.valid_until) / 1e3 : Infinity)) } : {}
|
|
327
330
|
});
|
|
328
331
|
if (brand === operator && account === operator) return result("implicit", [brand]);
|
|
329
|
-
if (brand === operator && account !== operator) throw new IdentityAuthorizationError("grant_absent");
|
|
330
332
|
let house;
|
|
331
333
|
try {
|
|
332
334
|
house = await options.resolveBrandHouse?.(claim.brand);
|
|
@@ -336,33 +338,44 @@ async function authorizeDemandGrant(claim, options) {
|
|
|
336
338
|
unavailable(cause);
|
|
337
339
|
}
|
|
338
340
|
const authoritativeBrand = house ? eTldPlusOne(house.domain) : brand;
|
|
339
|
-
|
|
341
|
+
const self = /* @__PURE__ */ new Set([brand, authoritativeBrand]);
|
|
342
|
+
if (self.has(account) && self.has(operator)) return result("implicit", [.../* @__PURE__ */ new Set([brand, account, operator])]);
|
|
340
343
|
const grantClaim = house ? { ...claim, brand: { ...claim.brand, brand_id: house.brand_id } } : claim;
|
|
341
344
|
const record = await options.evaluator.get(authoritativeBrand);
|
|
342
345
|
if (record.status === "absent") {
|
|
343
346
|
if (await options.legacyAuthorization?.(claim)) return result("legacy", [brand, account, operator]);
|
|
344
347
|
throw new IdentityAuthorizationError("grant_absent");
|
|
345
348
|
}
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if (
|
|
349
|
+
const firsts = [];
|
|
350
|
+
for (const grant of record.record.grants ?? []) {
|
|
351
|
+
const grantee = registrableGrantee(grant.grantee);
|
|
352
|
+
if (grantee === void 0 || !grantCovers(grant, grantClaim, now)) continue;
|
|
353
|
+
if (!self.has(account) && account !== grantee) continue;
|
|
354
|
+
if (grantee === operator) return result("trust", [brand, operator], [grant]);
|
|
355
|
+
firsts.push({ grant, grantee });
|
|
356
|
+
}
|
|
357
|
+
const grantees = [...new Set(firsts.map((f) => f.grantee))];
|
|
358
|
+
const records = /* @__PURE__ */ new Map();
|
|
359
|
+
for (let i = 0; i < grantees.length; i += INTERMEDIARY_FETCH_CONCURRENCY) {
|
|
360
|
+
const batch = grantees.slice(i, i + INTERMEDIARY_FETCH_CONCURRENCY);
|
|
361
|
+
const settled = await Promise.allSettled(batch.map((grantee) => options.evaluator.get(grantee)));
|
|
362
|
+
settled.forEach(
|
|
363
|
+
(outcome, j) => records.set(batch[j], outcome.status === "fulfilled" ? outcome.value : { failed: outcome.reason })
|
|
364
|
+
);
|
|
352
365
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
366
|
+
let outage;
|
|
367
|
+
for (const { grant: first, grantee } of firsts) {
|
|
368
|
+
const intermediary = records.get(grantee);
|
|
369
|
+
if ("failed" in intermediary) {
|
|
370
|
+
outage ??= intermediary.failed;
|
|
371
|
+
continue;
|
|
358
372
|
}
|
|
373
|
+
if (intermediary.status !== "present") continue;
|
|
374
|
+
const second = (intermediary.record.grants ?? []).find((g) => grantMatches(g, operator, grantClaim, now));
|
|
375
|
+
if (second) return result("trust", [brand, grantee, operator], [first, second]);
|
|
359
376
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return grantee !== void 0 && (grantee === account || selfOperated && grantee === operator) && grantsScope(g, claim.scope);
|
|
363
|
-
});
|
|
364
|
-
const exclusive = record.record.exclusive_grants === true && (record.record.grants ?? []).some((g) => grantsScope(g, claim.scope));
|
|
365
|
-
if (!covered && !exclusive && await options.sellerAuthorization?.(claim))
|
|
377
|
+
if (outage !== void 0) throw outage;
|
|
378
|
+
if (record.record.exclusive_grants !== true && await options.sellerAuthorization?.(claim))
|
|
366
379
|
return result("seller", [brand, account, operator]);
|
|
367
380
|
throw new IdentityAuthorizationError("grant_absent");
|
|
368
381
|
}
|
|
@@ -34,6 +34,7 @@ module.exports = __toCommonJS(validation_exports);
|
|
|
34
34
|
var import_ajv = __toESM(require("ajv"));
|
|
35
35
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
36
36
|
var import_schema_loader = require('../validation/schema-loader.js');
|
|
37
|
+
var import_compact_schema = require('../validation/compact-schema.js');
|
|
37
38
|
var import_schemas = __toESM(require('./schemas.draft.js'));
|
|
38
39
|
const validators = /* @__PURE__ */ new WeakMap();
|
|
39
40
|
function validateIdentity33Payload(tool, direction, payload, version) {
|
|
@@ -79,14 +80,15 @@ function validateIdentity33Payload(tool, direction, payload, version) {
|
|
|
79
80
|
for (const [k, value] of Object.entries(object)) if (k !== "$id") walk2(value, k);
|
|
80
81
|
};
|
|
81
82
|
var walk = walk2;
|
|
82
|
-
const
|
|
83
|
+
const document = (0, import_schema_loader.getToolSchemaDocument)(tool, direction === "request" ? "request" : "sync", version)?.schema ?? stable.schema;
|
|
84
|
+
const schema = structuredClone(direction === "response" ? (0, import_schema_loader.relaxResponseRoot)(document) : document);
|
|
83
85
|
const relationship = import_schemas.default.find((s) => s.$id === "/schemas/core/principal-relationship.json");
|
|
84
86
|
const onboarding = import_schemas.default.find((s) => s.$id === "/schemas/core/agent-onboarding.json");
|
|
85
87
|
walk2(schema);
|
|
86
|
-
const ajv = new import_ajv.default({ strict: false, allErrors: true });
|
|
88
|
+
const ajv = new import_ajv.default({ inlineRefs: false, strict: false, allErrors: true });
|
|
87
89
|
(0, import_ajv_formats.default)(ajv);
|
|
88
90
|
for (const draft of import_schemas.default) ajv.addSchema({ ...draft, $id: "https://adcontextprotocol.org" + draft.$id });
|
|
89
|
-
validator = ajv.compile(schema);
|
|
91
|
+
validator = ajv.compile((0, import_compact_schema.compactSchemaForValidation)(schema));
|
|
90
92
|
cache.set(key, validator);
|
|
91
93
|
}
|
|
92
94
|
let valid = validator(payload) === true;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Ajv from "ajv";
|
|
2
2
|
import addFormats from "ajv-formats";
|
|
3
|
-
import { getValidator } from "../validation/schema-loader.mjs";
|
|
3
|
+
import { getValidator, getToolSchemaDocument, relaxResponseRoot } from "../validation/schema-loader.mjs";
|
|
4
|
+
import { compactSchemaForValidation } from "../validation/compact-schema.mjs";
|
|
4
5
|
import schemas from "./schemas.draft.mjs";
|
|
5
6
|
const validators = /* @__PURE__ */ new WeakMap();
|
|
6
7
|
function validateIdentity33Payload(tool, direction, payload, version) {
|
|
@@ -46,14 +47,15 @@ function validateIdentity33Payload(tool, direction, payload, version) {
|
|
|
46
47
|
for (const [k, value] of Object.entries(object)) if (k !== "$id") walk2(value, k);
|
|
47
48
|
};
|
|
48
49
|
var walk = walk2;
|
|
49
|
-
const
|
|
50
|
+
const document = getToolSchemaDocument(tool, direction === "request" ? "request" : "sync", version)?.schema ?? stable.schema;
|
|
51
|
+
const schema = structuredClone(direction === "response" ? relaxResponseRoot(document) : document);
|
|
50
52
|
const relationship = schemas.find((s) => s.$id === "/schemas/core/principal-relationship.json");
|
|
51
53
|
const onboarding = schemas.find((s) => s.$id === "/schemas/core/agent-onboarding.json");
|
|
52
54
|
walk2(schema);
|
|
53
|
-
const ajv = new Ajv({ strict: false, allErrors: true });
|
|
55
|
+
const ajv = new Ajv({ inlineRefs: false, strict: false, allErrors: true });
|
|
54
56
|
addFormats(ajv);
|
|
55
57
|
for (const draft of schemas) ajv.addSchema({ ...draft, $id: "https://adcontextprotocol.org" + draft.$id });
|
|
56
|
-
validator = ajv.compile(schema);
|
|
58
|
+
validator = ajv.compile(compactSchemaForValidation(schema));
|
|
57
59
|
cache.set(key, validator);
|
|
58
60
|
}
|
|
59
61
|
let valid = validator(payload) === true;
|
package/dist/lib/index.d.mts
CHANGED
|
@@ -57,7 +57,7 @@ export * from './handlers/types.mjs';
|
|
|
57
57
|
export type { Storage, AtomicTakeStorage, DeferredTaskStorage, BatchStorage, PatternStorage, AgentCapabilities, ConversationState, DeferredTaskState, StorageConfig, StorageFactory, StorageMiddleware, } from './storage/interfaces.mjs';
|
|
58
58
|
export { MemoryStorage, createMemoryStorage, createMemoryStorageConfig } from './storage/MemoryStorage.mjs';
|
|
59
59
|
export { ADCPError, TaskTimeoutError, MaxClarificationError, DeferredTaskError, TaskAbortedError, AgentNotFoundError, UnsupportedTaskError, ProtocolError, ValidationError as ADCPValidationError, // Rename to avoid conflict
|
|
60
|
-
MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationCredentialsRejectedError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, UnsupportedBuyingModeError, AccountRequiredError, AccountPendingApprovalError, AccountAmbiguousError, BuyerSetupError, AccountNotFoundError, AccountSetupRequiredError, AccountPaymentRequiredError, AccountNotProvisionedError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, ActionNotAllowedError, PreparedFixturesDeniedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors/index.mjs';
|
|
60
|
+
MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationCredentialsRejectedError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, UnsupportedBuyingModeError, AccountRequiredError, AccountPendingApprovalError, AccountAmbiguousError, BuyerSetupError, AccountNotFoundError, AccountSetupRequiredError, AccountPaymentRequiredError, AccountNotProvisionedError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, AgentRateLimitedError, ActionNotAllowedError, PreparedFixturesDeniedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors/index.mjs';
|
|
61
61
|
export type { OAuthMetadataInfo, ClientPreflightAdcpErrorInfo, ClientPreflightAdcpErrorRecovery, FeatureUnsupportedErrorOptions, ProtocolFeatureUnsupportedErrorOptions, ActionNotAllowedErrorDetails, ActionNotAllowedReasonValue, ActionNotAllowedAttemptedAction, ActionNotAllowedAvailableAction, ActionNotAllowedRecovery, } from './errors/index.mjs';
|
|
62
62
|
export type { ActionNotAllowedDetails, ActionNotAllowedReason, AvailableActionsResult, AvailableActionsSource, DecomposedUpdateMediaBuy, DecomposedUpdateMediaBuyMutation, LegacyCoarseAction, MediaBuyActionContext, MediaBuyActionId, MediaBuyActionMode, MediaBuyAvailableAction, MediaBuyMutationDirection, MediaBuyMutationScope, MediaBuyUpdateFieldAction, MediaBuyValidAction, ModeMismatchRecovery, PreflightAllowed, PreflightDenial, PreflightDenied, BuyerPropertyPolicy, NormalizedPolicyDomain, ProductPolicyProductLike, ProductPolicyResolvedProperty, ProductPropertyPolicyIdentifier, ProductPropertyPolicyDiagnostic, ProductPropertyPolicyDiagnosticCode, ProductPropertyPolicyDiagnosticSeverity, ProductPropertyPolicyMode, ProductPropertyPolicySelectorBehavior, ProductPropertyPolicyValidationResult, PreflightResult, ResolvedAction, SLAWindow, SlaWindow, StructuredOnlyMediaBuyAction, ResolvedTargetingInput, TargetingInputFor, ValidateProductsAgainstPropertyPolicyOptions, UpdateFieldEntry, UpdateMediaBuyRequestLike, } from './media-buy/index.mjs';
|
|
63
63
|
export { ACTIONS_BY_FIELD, LEGACY_COARSE_ACTIONS, STRUCTURED_ONLY_MEDIA_BUY_ACTIONS, UPDATE_FIELDS_BY_ACTION, applyTargetingInput, hasTargetingClears, resolveTargetingInput, canAddPackages, canCancel, canDecreaseBudget, canExtendFlight, canIncreaseBudget, canPause, canReallocateBudget, canRemoveCreative, canRemovePackages, canReplaceCreative, canResume, canShortenFlight, canUpdateCreativeAssignments, canUpdateFlightDates, canUpdateFrequencyCaps, canUpdatePacing, canUpdateTargeting, decomposeUpdateMediaBuy, findAvailableAction, getActionForMutation, getAvailableActions, getRollupParent, ProductPropertyPolicyError, normalizeDomainForPropertyPolicy, preflightUpdateMediaBuy, recoveryForModeMismatch, validateProductsAgainstPropertyPolicy, } from './media-buy/index.mjs';
|
|
@@ -75,27 +75,15 @@ export type { GetProductsRequest as LegacyGetProductsRequest, GetProductsRespons
|
|
|
75
75
|
CreativeAsset as LegacyCompatibleCreativeAsset, CreativePolicy, BrandReference, BrandID, AccountReference, CPAPricingOption, EventType, ActionSource, OptimizationGoal, ReachUnit, TargetingOverlay, OutcomeMeasurementDeprecated, OutcomeMeasurementDeprecated as OutcomeMeasurement, Duration, DeviceType, DigitalSourceType, FrequencyCap, GeographicBreakdownSupport, Catalog, CatalogType, FeedFormat, UpdateFrequency, ContentIDType, CatalogFieldMapping, SyncCatalogsRequest, SyncCatalogsResponse, SyncCatalogsSuccess, SyncCatalogsError, Overlay, Placement as LegacyPlacement, CreativeManifest as LegacyCreativeManifest, CreativeVariable, BuildCreativeRequest as LegacyBuildCreativeRequest, BuildCreativeResponse as LegacyBuildCreativeResponse, BuildCreativeSuccess as LegacyBuildCreativeSuccess, BuildCreativeMultiSuccess as LegacyBuildCreativeMultiSuccess, BuildCreativeVariantSuccess as LegacyBuildCreativeVariantSuccess, BuildCreativeError as LegacyBuildCreativeError, PreviewCreativeRequest as LegacyPreviewCreativeRequest, PreviewCreativeResponse as LegacyPreviewCreativeResponse, GetMediaBuysRequest, GetMediaBuysResponse as LegacyGetMediaBuysResponse, ImageAsset, VideoAsset, AudioAsset, TextAsset, URLAsset, HTMLAsset, VASTAsset, DAASTAsset, JavaScriptAsset, WebhookAsset, CSSAsset, MarkdownAsset, CatalogAsset, BriefAsset, ReferenceAsset, Provenance, PreviewOutputFormat, DisclosurePosition, EventCustomData, GetCreativeDeliveryRequest, GetCreativeDeliveryResponse as LegacyGetCreativeDeliveryResponse, Account, AccountChange, ListAccountChangesRequest, ListAccountChangesResponse, ListAccountsRequest, ListAccountsResponse, SyncAccountsRequest, SyncAccountsResponse, SyncAccountsSuccess, SyncAccountsError, GetAccountFinancialsRequest, GetAccountFinancialsResponse, GetAccountFinancialsSuccess, GetAccountFinancialsError, PaginationRequest, PaginationResponse, PackageUpdate as LegacyPackageUpdate, Package as LegacyPackage, Destination, SignalFilters, PricingOption, PriceGuidance, } from './types/tools.generated.mjs';
|
|
76
76
|
export type { GetMediaBuyArtifactsRequest as LegacyGetMediaBuyArtifactsRequest, GetMediaBuyArtifactsResponse as LegacyGetMediaBuyArtifactsResponse, } from './types/tools.generated.mjs';
|
|
77
77
|
export type { GetRightsRequest as LegacyGetRightsRequest, GetRightsResponse as LegacyGetRightsResponse, AcquireRightsRequest as LegacyAcquireRightsRequest, AcquireRightsResponse as LegacyAcquireRightsResponse, UpdateRightsRequest as LegacyUpdateRightsRequest, UpdateRightsResponse as LegacyUpdateRightsResponse, } from './types/core.generated.mjs';
|
|
78
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
79
|
-
export type GetMediaBuyArtifactsRequest = never;
|
|
80
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
81
|
-
export type GetMediaBuyArtifactsResponse = never;
|
|
82
78
|
export type { FormatReferenceStructuredObject as LegacyFormatReferenceStructuredObject, FormatReferenceStructuredObject as LegacyFormatID, } from './types/core.generated.mjs';
|
|
83
79
|
/** @deprecated Legacy creative routing identity is available as `LegacyFormatReferenceStructuredObject`. */
|
|
84
80
|
export type FormatReferenceStructuredObject = never;
|
|
85
81
|
/** @deprecated Legacy creative routing identity is available as `LegacyFormatID`. */
|
|
86
82
|
export type FormatID = never;
|
|
87
|
-
/** @deprecated Use `LegacyBuildCreativeRequest`; canonical build support awaits a canonical protocol request. */
|
|
88
|
-
export type BuildCreativeRequest = never;
|
|
89
|
-
/** @deprecated Use `LegacyBuildCreativeResponse`. */
|
|
90
|
-
export type BuildCreativeResponse = never;
|
|
91
83
|
/** @deprecated Use `LegacyBuildCreativePayload`. */
|
|
92
84
|
export type BuildCreativePayload = never;
|
|
93
85
|
/** @deprecated Use `LegacyBuildCreativeMultiPayload`. */
|
|
94
86
|
export type BuildCreativeMultiPayload = never;
|
|
95
|
-
/** @deprecated Use `LegacyListCreativeFormatsRequest`. */
|
|
96
|
-
export type ListCreativeFormatsRequest = never;
|
|
97
|
-
/** @deprecated Use `LegacyListCreativeFormatsResponse`. */
|
|
98
|
-
export type ListCreativeFormatsResponse = never;
|
|
99
87
|
/** @deprecated Use `LegacyListCreativeFormatsPayload`. */
|
|
100
88
|
export type ListCreativeFormatsPayload = never;
|
|
101
89
|
/** @deprecated Use `LegacyListCreativeFormatsResponsePayload`. */
|
|
@@ -118,49 +106,9 @@ export type UpdateMediaBuyAsyncResponseData = never;
|
|
|
118
106
|
/** @deprecated Use `LegacySyncCreativesAsyncResponseData`. */
|
|
119
107
|
export type SyncCreativesAsyncResponseData = never;
|
|
120
108
|
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
121
|
-
export type ListContentStandardsRequest = never;
|
|
122
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
123
|
-
export type ListContentStandardsResponse = never;
|
|
124
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
125
|
-
export type GetContentStandardsRequest = never;
|
|
126
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
127
|
-
export type GetContentStandardsResponse = never;
|
|
128
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
129
|
-
export type CreateContentStandardsRequest = never;
|
|
130
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
131
|
-
export type CreateContentStandardsResponse = never;
|
|
132
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
133
|
-
export type UpdateContentStandardsRequest = never;
|
|
134
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
135
|
-
export type UpdateContentStandardsResponse = never;
|
|
136
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
137
|
-
export type CalibrateContentRequest = never;
|
|
138
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
139
|
-
export type CalibrateContentResponse = never;
|
|
140
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
141
|
-
export type ValidateContentDeliveryRequest = never;
|
|
142
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
143
|
-
export type ValidateContentDeliveryResponse = never;
|
|
144
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
145
|
-
export type GetCreativeFeaturesRequest = never;
|
|
146
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
147
|
-
export type GetCreativeFeaturesResponse = never;
|
|
148
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
149
109
|
export type ContentStandards = never;
|
|
150
110
|
/** @deprecated Use `LegacyArtifact` from the migration surface. */
|
|
151
111
|
export type Artifact = never;
|
|
152
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
153
|
-
export type GetRightsRequest = never;
|
|
154
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
155
|
-
export type GetRightsResponse = never;
|
|
156
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
157
|
-
export type AcquireRightsRequest = never;
|
|
158
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
159
|
-
export type AcquireRightsResponse = never;
|
|
160
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
161
|
-
export type UpdateRightsRequest = never;
|
|
162
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
163
|
-
export type UpdateRightsResponse = never;
|
|
164
112
|
export type { AccountStatus, CreativeStatus, DelegationAuthority, CatalogAction, CatalogItemStatus, MediaBuyStatus, CreativeBrief, CompatibilityPurchaseCoordinatorInput, } from './types/core.generated.mjs';
|
|
165
113
|
export type { BrandJson, AdagentsJson } from './types/wellknown-schemas.generated.mjs';
|
|
166
114
|
export { BrandJsonSchema, AdagentsJsonSchema } from './types/wellknown-schemas.generated.mjs';
|
|
@@ -279,3 +227,9 @@ export * from './supply-path/index.mjs';
|
|
|
279
227
|
export type { AuthorizationCollectionSelector, ProductCollectionSelector, CollectionDistribution, DiscoveryCollection, } from './discovery/types.mjs';
|
|
280
228
|
export { BuyerAccountRegistry, type AccountPolicy, type BuyerAccountStorage, type BuyerAccountRegistryOptions, type BuyerAccountDispatch, type BuyerAccountProvisioningDispatch, type EnsureAccountOptions, type ProvisionedAccount, } from './core/buyer-account-registry.mjs';
|
|
281
229
|
export { createProductCache, ProductCache, type ProductCacheOptions } from './core/product-cache.mjs';
|
|
230
|
+
export type { AssetVariant, DaypartTarget, TargetingOverlaySupport } from './types/core.generated.mjs';
|
|
231
|
+
export { TargetingOverlayKeys, TargetingOverlaySupportKeys } from './types/targeting-keys.generated.mjs';
|
|
232
|
+
export { parseMediaBuyDeliveryWebhook } from './webhooks/media-buy-delivery.mjs';
|
|
233
|
+
export type { ParseMediaBuyDeliveryWebhookOptions, MediaBuyDeliveryWebhookEnvelope, MediaBuyDeliveryWebhookParseErrorCode, MediaBuyDeliveryWebhookParseResult, } from './webhooks/media-buy-delivery.mjs';
|
|
234
|
+
export type { MediaBuyDeliveryReport } from './types/media-buy-delivery-report.mjs';
|
|
235
|
+
export { MediaBuyDeliveryReportSchema } from './validation/media-buy-delivery-report.mjs';
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export * from './handlers/types';
|
|
|
57
57
|
export type { Storage, AtomicTakeStorage, DeferredTaskStorage, BatchStorage, PatternStorage, AgentCapabilities, ConversationState, DeferredTaskState, StorageConfig, StorageFactory, StorageMiddleware, } from './storage/interfaces';
|
|
58
58
|
export { MemoryStorage, createMemoryStorage, createMemoryStorageConfig } from './storage/MemoryStorage';
|
|
59
59
|
export { ADCPError, TaskTimeoutError, MaxClarificationError, DeferredTaskError, TaskAbortedError, AgentNotFoundError, UnsupportedTaskError, ProtocolError, ValidationError as ADCPValidationError, // Rename to avoid conflict
|
|
60
|
-
MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationCredentialsRejectedError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, UnsupportedBuyingModeError, AccountRequiredError, AccountPendingApprovalError, AccountAmbiguousError, BuyerSetupError, AccountNotFoundError, AccountSetupRequiredError, AccountPaymentRequiredError, AccountNotProvisionedError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, ActionNotAllowedError, PreparedFixturesDeniedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors';
|
|
60
|
+
MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationCredentialsRejectedError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, UnsupportedBuyingModeError, AccountRequiredError, AccountPendingApprovalError, AccountAmbiguousError, BuyerSetupError, AccountNotFoundError, AccountSetupRequiredError, AccountPaymentRequiredError, AccountNotProvisionedError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, AgentRateLimitedError, ActionNotAllowedError, PreparedFixturesDeniedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors';
|
|
61
61
|
export type { OAuthMetadataInfo, ClientPreflightAdcpErrorInfo, ClientPreflightAdcpErrorRecovery, FeatureUnsupportedErrorOptions, ProtocolFeatureUnsupportedErrorOptions, ActionNotAllowedErrorDetails, ActionNotAllowedReasonValue, ActionNotAllowedAttemptedAction, ActionNotAllowedAvailableAction, ActionNotAllowedRecovery, } from './errors';
|
|
62
62
|
export type { ActionNotAllowedDetails, ActionNotAllowedReason, AvailableActionsResult, AvailableActionsSource, DecomposedUpdateMediaBuy, DecomposedUpdateMediaBuyMutation, LegacyCoarseAction, MediaBuyActionContext, MediaBuyActionId, MediaBuyActionMode, MediaBuyAvailableAction, MediaBuyMutationDirection, MediaBuyMutationScope, MediaBuyUpdateFieldAction, MediaBuyValidAction, ModeMismatchRecovery, PreflightAllowed, PreflightDenial, PreflightDenied, BuyerPropertyPolicy, NormalizedPolicyDomain, ProductPolicyProductLike, ProductPolicyResolvedProperty, ProductPropertyPolicyIdentifier, ProductPropertyPolicyDiagnostic, ProductPropertyPolicyDiagnosticCode, ProductPropertyPolicyDiagnosticSeverity, ProductPropertyPolicyMode, ProductPropertyPolicySelectorBehavior, ProductPropertyPolicyValidationResult, PreflightResult, ResolvedAction, SLAWindow, SlaWindow, StructuredOnlyMediaBuyAction, ResolvedTargetingInput, TargetingInputFor, ValidateProductsAgainstPropertyPolicyOptions, UpdateFieldEntry, UpdateMediaBuyRequestLike, } from './media-buy';
|
|
63
63
|
export { ACTIONS_BY_FIELD, LEGACY_COARSE_ACTIONS, STRUCTURED_ONLY_MEDIA_BUY_ACTIONS, UPDATE_FIELDS_BY_ACTION, applyTargetingInput, hasTargetingClears, resolveTargetingInput, canAddPackages, canCancel, canDecreaseBudget, canExtendFlight, canIncreaseBudget, canPause, canReallocateBudget, canRemoveCreative, canRemovePackages, canReplaceCreative, canResume, canShortenFlight, canUpdateCreativeAssignments, canUpdateFlightDates, canUpdateFrequencyCaps, canUpdatePacing, canUpdateTargeting, decomposeUpdateMediaBuy, findAvailableAction, getActionForMutation, getAvailableActions, getRollupParent, ProductPropertyPolicyError, normalizeDomainForPropertyPolicy, preflightUpdateMediaBuy, recoveryForModeMismatch, validateProductsAgainstPropertyPolicy, } from './media-buy';
|
|
@@ -75,27 +75,15 @@ export type { GetProductsRequest as LegacyGetProductsRequest, GetProductsRespons
|
|
|
75
75
|
CreativeAsset as LegacyCompatibleCreativeAsset, CreativePolicy, BrandReference, BrandID, AccountReference, CPAPricingOption, EventType, ActionSource, OptimizationGoal, ReachUnit, TargetingOverlay, OutcomeMeasurementDeprecated, OutcomeMeasurementDeprecated as OutcomeMeasurement, Duration, DeviceType, DigitalSourceType, FrequencyCap, GeographicBreakdownSupport, Catalog, CatalogType, FeedFormat, UpdateFrequency, ContentIDType, CatalogFieldMapping, SyncCatalogsRequest, SyncCatalogsResponse, SyncCatalogsSuccess, SyncCatalogsError, Overlay, Placement as LegacyPlacement, CreativeManifest as LegacyCreativeManifest, CreativeVariable, BuildCreativeRequest as LegacyBuildCreativeRequest, BuildCreativeResponse as LegacyBuildCreativeResponse, BuildCreativeSuccess as LegacyBuildCreativeSuccess, BuildCreativeMultiSuccess as LegacyBuildCreativeMultiSuccess, BuildCreativeVariantSuccess as LegacyBuildCreativeVariantSuccess, BuildCreativeError as LegacyBuildCreativeError, PreviewCreativeRequest as LegacyPreviewCreativeRequest, PreviewCreativeResponse as LegacyPreviewCreativeResponse, GetMediaBuysRequest, GetMediaBuysResponse as LegacyGetMediaBuysResponse, ImageAsset, VideoAsset, AudioAsset, TextAsset, URLAsset, HTMLAsset, VASTAsset, DAASTAsset, JavaScriptAsset, WebhookAsset, CSSAsset, MarkdownAsset, CatalogAsset, BriefAsset, ReferenceAsset, Provenance, PreviewOutputFormat, DisclosurePosition, EventCustomData, GetCreativeDeliveryRequest, GetCreativeDeliveryResponse as LegacyGetCreativeDeliveryResponse, Account, AccountChange, ListAccountChangesRequest, ListAccountChangesResponse, ListAccountsRequest, ListAccountsResponse, SyncAccountsRequest, SyncAccountsResponse, SyncAccountsSuccess, SyncAccountsError, GetAccountFinancialsRequest, GetAccountFinancialsResponse, GetAccountFinancialsSuccess, GetAccountFinancialsError, PaginationRequest, PaginationResponse, PackageUpdate as LegacyPackageUpdate, Package as LegacyPackage, Destination, SignalFilters, PricingOption, PriceGuidance, } from './types/tools.generated';
|
|
76
76
|
export type { GetMediaBuyArtifactsRequest as LegacyGetMediaBuyArtifactsRequest, GetMediaBuyArtifactsResponse as LegacyGetMediaBuyArtifactsResponse, } from './types/tools.generated';
|
|
77
77
|
export type { GetRightsRequest as LegacyGetRightsRequest, GetRightsResponse as LegacyGetRightsResponse, AcquireRightsRequest as LegacyAcquireRightsRequest, AcquireRightsResponse as LegacyAcquireRightsResponse, UpdateRightsRequest as LegacyUpdateRightsRequest, UpdateRightsResponse as LegacyUpdateRightsResponse, } from './types/core.generated';
|
|
78
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
79
|
-
export type GetMediaBuyArtifactsRequest = never;
|
|
80
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
81
|
-
export type GetMediaBuyArtifactsResponse = never;
|
|
82
78
|
export type { FormatReferenceStructuredObject as LegacyFormatReferenceStructuredObject, FormatReferenceStructuredObject as LegacyFormatID, } from './types/core.generated';
|
|
83
79
|
/** @deprecated Legacy creative routing identity is available as `LegacyFormatReferenceStructuredObject`. */
|
|
84
80
|
export type FormatReferenceStructuredObject = never;
|
|
85
81
|
/** @deprecated Legacy creative routing identity is available as `LegacyFormatID`. */
|
|
86
82
|
export type FormatID = never;
|
|
87
|
-
/** @deprecated Use `LegacyBuildCreativeRequest`; canonical build support awaits a canonical protocol request. */
|
|
88
|
-
export type BuildCreativeRequest = never;
|
|
89
|
-
/** @deprecated Use `LegacyBuildCreativeResponse`. */
|
|
90
|
-
export type BuildCreativeResponse = never;
|
|
91
83
|
/** @deprecated Use `LegacyBuildCreativePayload`. */
|
|
92
84
|
export type BuildCreativePayload = never;
|
|
93
85
|
/** @deprecated Use `LegacyBuildCreativeMultiPayload`. */
|
|
94
86
|
export type BuildCreativeMultiPayload = never;
|
|
95
|
-
/** @deprecated Use `LegacyListCreativeFormatsRequest`. */
|
|
96
|
-
export type ListCreativeFormatsRequest = never;
|
|
97
|
-
/** @deprecated Use `LegacyListCreativeFormatsResponse`. */
|
|
98
|
-
export type ListCreativeFormatsResponse = never;
|
|
99
87
|
/** @deprecated Use `LegacyListCreativeFormatsPayload`. */
|
|
100
88
|
export type ListCreativeFormatsPayload = never;
|
|
101
89
|
/** @deprecated Use `LegacyListCreativeFormatsResponsePayload`. */
|
|
@@ -118,49 +106,9 @@ export type UpdateMediaBuyAsyncResponseData = never;
|
|
|
118
106
|
/** @deprecated Use `LegacySyncCreativesAsyncResponseData`. */
|
|
119
107
|
export type SyncCreativesAsyncResponseData = never;
|
|
120
108
|
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
121
|
-
export type ListContentStandardsRequest = never;
|
|
122
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
123
|
-
export type ListContentStandardsResponse = never;
|
|
124
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
125
|
-
export type GetContentStandardsRequest = never;
|
|
126
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
127
|
-
export type GetContentStandardsResponse = never;
|
|
128
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
129
|
-
export type CreateContentStandardsRequest = never;
|
|
130
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
131
|
-
export type CreateContentStandardsResponse = never;
|
|
132
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
133
|
-
export type UpdateContentStandardsRequest = never;
|
|
134
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
135
|
-
export type UpdateContentStandardsResponse = never;
|
|
136
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
137
|
-
export type CalibrateContentRequest = never;
|
|
138
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
139
|
-
export type CalibrateContentResponse = never;
|
|
140
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
141
|
-
export type ValidateContentDeliveryRequest = never;
|
|
142
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
143
|
-
export type ValidateContentDeliveryResponse = never;
|
|
144
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
145
|
-
export type GetCreativeFeaturesRequest = never;
|
|
146
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
147
|
-
export type GetCreativeFeaturesResponse = never;
|
|
148
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
149
109
|
export type ContentStandards = never;
|
|
150
110
|
/** @deprecated Use `LegacyArtifact` from the migration surface. */
|
|
151
111
|
export type Artifact = never;
|
|
152
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
153
|
-
export type GetRightsRequest = never;
|
|
154
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
155
|
-
export type GetRightsResponse = never;
|
|
156
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
157
|
-
export type AcquireRightsRequest = never;
|
|
158
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
159
|
-
export type AcquireRightsResponse = never;
|
|
160
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
161
|
-
export type UpdateRightsRequest = never;
|
|
162
|
-
/** @deprecated Use the corresponding explicit `Legacy*` migration type. */
|
|
163
|
-
export type UpdateRightsResponse = never;
|
|
164
112
|
export type { AccountStatus, CreativeStatus, DelegationAuthority, CatalogAction, CatalogItemStatus, MediaBuyStatus, CreativeBrief, CompatibilityPurchaseCoordinatorInput, } from './types/core.generated';
|
|
165
113
|
export type { BrandJson, AdagentsJson } from './types/wellknown-schemas.generated';
|
|
166
114
|
export { BrandJsonSchema, AdagentsJsonSchema } from './types/wellknown-schemas.generated';
|
|
@@ -279,3 +227,9 @@ export * from './supply-path';
|
|
|
279
227
|
export type { AuthorizationCollectionSelector, ProductCollectionSelector, CollectionDistribution, DiscoveryCollection, } from './discovery/types';
|
|
280
228
|
export { BuyerAccountRegistry, type AccountPolicy, type BuyerAccountStorage, type BuyerAccountRegistryOptions, type BuyerAccountDispatch, type BuyerAccountProvisioningDispatch, type EnsureAccountOptions, type ProvisionedAccount, } from './core/buyer-account-registry';
|
|
281
229
|
export { createProductCache, ProductCache, type ProductCacheOptions } from './core/product-cache';
|
|
230
|
+
export type { AssetVariant, DaypartTarget, TargetingOverlaySupport } from './types/core.generated';
|
|
231
|
+
export { TargetingOverlayKeys, TargetingOverlaySupportKeys } from './types/targeting-keys.generated';
|
|
232
|
+
export { parseMediaBuyDeliveryWebhook } from './webhooks/media-buy-delivery';
|
|
233
|
+
export type { ParseMediaBuyDeliveryWebhookOptions, MediaBuyDeliveryWebhookEnvelope, MediaBuyDeliveryWebhookParseErrorCode, MediaBuyDeliveryWebhookParseResult, } from './webhooks/media-buy-delivery';
|
|
234
|
+
export type { MediaBuyDeliveryReport } from './types/media-buy-delivery-report';
|
|
235
|
+
export { MediaBuyDeliveryReportSchema } from './validation/media-buy-delivery-report';
|
package/dist/lib/index.js
CHANGED
|
@@ -49,6 +49,7 @@ __export(index_exports, {
|
|
|
49
49
|
AgentClient: () => import_AgentClient.AgentClient,
|
|
50
50
|
AgentNotFoundError: () => import_errors.AgentNotFoundError,
|
|
51
51
|
AgentOAuthClientCredentialsSchema: () => import_oauth4.AgentOAuthClientCredentialsSchema,
|
|
52
|
+
AgentRateLimitedError: () => import_errors.AgentRateLimitedError,
|
|
52
53
|
Asset: () => import_asset_builders.Asset,
|
|
53
54
|
AsyncHandler: () => import_AsyncHandler.AsyncHandler,
|
|
54
55
|
AuthenticationCredentialsRejectedError: () => import_errors.AuthenticationCredentialsRejectedError,
|
|
@@ -138,6 +139,7 @@ __export(index_exports, {
|
|
|
138
139
|
MUTATING_TASKS: () => import_idempotency.MUTATING_TASKS,
|
|
139
140
|
MacroInRawValueError: () => import_substitution.MacroInRawValueError,
|
|
140
141
|
MaxClarificationError: () => import_errors.MaxClarificationError,
|
|
142
|
+
MediaBuyDeliveryReportSchema: () => import_media_buy_delivery_report.MediaBuyDeliveryReportSchema,
|
|
141
143
|
MediaBuyLifecycleCompatibilityError: () => import_compatibility.MediaBuyLifecycleCompatibilityError,
|
|
142
144
|
MediaBuyLifecycleCoordinator: () => import_compatibility.MediaBuyLifecycleCoordinator,
|
|
143
145
|
MemoryStorage: () => import_MemoryStorage.MemoryStorage,
|
|
@@ -204,6 +206,8 @@ __export(index_exports, {
|
|
|
204
206
|
TEST_AGENT_NO_AUTH_MCP_CONFIG: () => import_testing.TEST_AGENT_NO_AUTH_MCP_CONFIG,
|
|
205
207
|
TEST_AGENT_TOKEN: () => import_testing.TEST_AGENT_TOKEN,
|
|
206
208
|
TOOL_INPUT_SHAPE: () => import_server.TOOL_INPUT_SHAPE,
|
|
209
|
+
TargetingOverlayKeys: () => import_targeting_keys.TargetingOverlayKeys,
|
|
210
|
+
TargetingOverlaySupportKeys: () => import_targeting_keys.TargetingOverlaySupportKeys,
|
|
207
211
|
TaskAbortedError: () => import_errors.TaskAbortedError,
|
|
208
212
|
TaskExecutor: () => import_TaskExecutor.TaskExecutor,
|
|
209
213
|
TaskTimeoutError: () => import_errors.TaskTimeoutError,
|
|
@@ -591,6 +595,7 @@ __export(index_exports, {
|
|
|
591
595
|
parseAdcpMajorVersion: () => import_version.parseAdcpMajorVersion,
|
|
592
596
|
parseCapabilitiesResponse: () => import_capabilities.parseCapabilitiesResponse,
|
|
593
597
|
parseManagerDomain: () => import_validate_adagents.parseManagerDomain,
|
|
598
|
+
parseMediaBuyDeliveryWebhook: () => import_media_buy_delivery.parseMediaBuyDeliveryWebhook,
|
|
594
599
|
parsePublisherPropertySelector: () => import_publisher_property_selector.parsePublisherPropertySelector,
|
|
595
600
|
parseSseStream: () => import_registry2.parseSseStream,
|
|
596
601
|
parseWWWAuthenticate: () => import_oauth.parseWWWAuthenticate,
|
|
@@ -852,6 +857,9 @@ var import_media_buy_action_resolver = require('./server/media-buy-action-resolv
|
|
|
852
857
|
__reExport(index_exports, require('./supply-path/index.js'), module.exports);
|
|
853
858
|
var import_buyer_account_registry = require('./core/buyer-account-registry.js');
|
|
854
859
|
var import_product_cache = require('./core/product-cache.js');
|
|
860
|
+
var import_targeting_keys = require('./types/targeting-keys.generated.js');
|
|
861
|
+
var import_media_buy_delivery = require('./webhooks/media-buy-delivery.js');
|
|
862
|
+
var import_media_buy_delivery_report = require('./validation/media-buy-delivery-report.js');
|
|
855
863
|
const wireVersion = {
|
|
856
864
|
isSupported: import_protocols2.bundleSupportsAdcpVersionField,
|
|
857
865
|
normalize: import_schema_loader2.toReleasePrecisionWire,
|
|
@@ -896,6 +904,7 @@ function createAdCPClientFromEnv() {
|
|
|
896
904
|
AgentClient,
|
|
897
905
|
AgentNotFoundError,
|
|
898
906
|
AgentOAuthClientCredentialsSchema,
|
|
907
|
+
AgentRateLimitedError,
|
|
899
908
|
Asset,
|
|
900
909
|
AsyncHandler,
|
|
901
910
|
AuthenticationCredentialsRejectedError,
|
|
@@ -985,6 +994,7 @@ function createAdCPClientFromEnv() {
|
|
|
985
994
|
MUTATING_TASKS,
|
|
986
995
|
MacroInRawValueError,
|
|
987
996
|
MaxClarificationError,
|
|
997
|
+
MediaBuyDeliveryReportSchema,
|
|
988
998
|
MediaBuyLifecycleCompatibilityError,
|
|
989
999
|
MediaBuyLifecycleCoordinator,
|
|
990
1000
|
MemoryStorage,
|
|
@@ -1051,6 +1061,8 @@ function createAdCPClientFromEnv() {
|
|
|
1051
1061
|
TEST_AGENT_NO_AUTH_MCP_CONFIG,
|
|
1052
1062
|
TEST_AGENT_TOKEN,
|
|
1053
1063
|
TOOL_INPUT_SHAPE,
|
|
1064
|
+
TargetingOverlayKeys,
|
|
1065
|
+
TargetingOverlaySupportKeys,
|
|
1054
1066
|
TaskAbortedError,
|
|
1055
1067
|
TaskExecutor,
|
|
1056
1068
|
TaskTimeoutError,
|
|
@@ -1438,6 +1450,7 @@ function createAdCPClientFromEnv() {
|
|
|
1438
1450
|
parseAdcpMajorVersion,
|
|
1439
1451
|
parseCapabilitiesResponse,
|
|
1440
1452
|
parseManagerDomain,
|
|
1453
|
+
parseMediaBuyDeliveryWebhook,
|
|
1441
1454
|
parsePublisherPropertySelector,
|
|
1442
1455
|
parseSseStream,
|
|
1443
1456
|
parseWWWAuthenticate,
|
package/dist/lib/index.mjs
CHANGED
|
@@ -234,6 +234,7 @@ import {
|
|
|
234
234
|
IdempotencyConflictError,
|
|
235
235
|
IdempotencyExpiredError,
|
|
236
236
|
ResponseTooLargeError,
|
|
237
|
+
AgentRateLimitedError,
|
|
237
238
|
ActionNotAllowedError,
|
|
238
239
|
PreparedFixturesDeniedError,
|
|
239
240
|
adcpErrorToTypedError,
|
|
@@ -827,6 +828,9 @@ import {
|
|
|
827
828
|
BuyerAccountRegistry
|
|
828
829
|
} from "./core/buyer-account-registry.mjs";
|
|
829
830
|
import { createProductCache, ProductCache } from "./core/product-cache.mjs";
|
|
831
|
+
import { TargetingOverlayKeys, TargetingOverlaySupportKeys } from "./types/targeting-keys.generated.mjs";
|
|
832
|
+
import { parseMediaBuyDeliveryWebhook } from "./webhooks/media-buy-delivery.mjs";
|
|
833
|
+
import { MediaBuyDeliveryReportSchema } from "./validation/media-buy-delivery-report.mjs";
|
|
830
834
|
export {
|
|
831
835
|
A2AInvocationError,
|
|
832
836
|
A2A_CARD_PATHS,
|
|
@@ -858,6 +862,7 @@ export {
|
|
|
858
862
|
AgentClient,
|
|
859
863
|
AgentNotFoundError,
|
|
860
864
|
AgentOAuthClientCredentialsSchema,
|
|
865
|
+
AgentRateLimitedError,
|
|
861
866
|
Asset,
|
|
862
867
|
AsyncHandler,
|
|
863
868
|
AuthenticationCredentialsRejectedError,
|
|
@@ -947,6 +952,7 @@ export {
|
|
|
947
952
|
MUTATING_TASKS,
|
|
948
953
|
MacroInRawValueError,
|
|
949
954
|
MaxClarificationError,
|
|
955
|
+
MediaBuyDeliveryReportSchema,
|
|
950
956
|
MediaBuyLifecycleCompatibilityError,
|
|
951
957
|
MediaBuyLifecycleCoordinator,
|
|
952
958
|
MemoryStorage,
|
|
@@ -1013,6 +1019,8 @@ export {
|
|
|
1013
1019
|
TEST_AGENT_NO_AUTH_MCP_CONFIG,
|
|
1014
1020
|
TEST_AGENT_TOKEN,
|
|
1015
1021
|
TOOL_INPUT_SHAPE,
|
|
1022
|
+
TargetingOverlayKeys,
|
|
1023
|
+
TargetingOverlaySupportKeys,
|
|
1016
1024
|
TaskAbortedError,
|
|
1017
1025
|
TaskExecutor,
|
|
1018
1026
|
TaskTimeoutError,
|
|
@@ -1400,6 +1408,7 @@ export {
|
|
|
1400
1408
|
parseAdcpMajorVersion,
|
|
1401
1409
|
parseCapabilitiesResponse,
|
|
1402
1410
|
parseManagerDomain,
|
|
1411
|
+
parseMediaBuyDeliveryWebhook,
|
|
1403
1412
|
parsePublisherPropertySelector,
|
|
1404
1413
|
parseSseStream,
|
|
1405
1414
|
parseWWWAuthenticate,
|
|
@@ -6132,7 +6132,12 @@ class MediaBuyLifecycleCoordinator {
|
|
|
6132
6132
|
});
|
|
6133
6133
|
void new Promise((resolve) => setTimeout(resolve, 0)).then(async () => {
|
|
6134
6134
|
while (!watchSignal.aborted) {
|
|
6135
|
-
const task = await this.agent.getTaskStatus(
|
|
6135
|
+
const task = await this.agent.getTaskStatus(
|
|
6136
|
+
sellerTaskId,
|
|
6137
|
+
settlementTransport,
|
|
6138
|
+
watchSignal,
|
|
6139
|
+
wireOptions
|
|
6140
|
+
);
|
|
6136
6141
|
if (task.taskId !== sellerTaskId || task.taskType !== "create_media_buy") {
|
|
6137
6142
|
throw this.legacyPurchaseAmbiguousError(
|
|
6138
6143
|
"The polled working seller task does not match the durably recorded create_media_buy task."
|
|
@@ -6120,7 +6120,12 @@ class MediaBuyLifecycleCoordinator {
|
|
|
6120
6120
|
});
|
|
6121
6121
|
void new Promise((resolve) => setTimeout(resolve, 0)).then(async () => {
|
|
6122
6122
|
while (!watchSignal.aborted) {
|
|
6123
|
-
const task = await this.agent.getTaskStatus(
|
|
6123
|
+
const task = await this.agent.getTaskStatus(
|
|
6124
|
+
sellerTaskId,
|
|
6125
|
+
settlementTransport,
|
|
6126
|
+
watchSignal,
|
|
6127
|
+
wireOptions
|
|
6128
|
+
);
|
|
6124
6129
|
if (task.taskId !== sellerTaskId || task.taskType !== "create_media_buy") {
|
|
6125
6130
|
throw this.legacyPurchaseAmbiguousError(
|
|
6126
6131
|
"The polled working seller task does not match the durably recorded create_media_buy task."
|
|
@@ -41,6 +41,8 @@ export interface ModernMCPConnectionOptions {
|
|
|
41
41
|
/** Use the v2 SDK's negotiated legacy client instead of handing off to v1. */
|
|
42
42
|
handleLegacy?: boolean;
|
|
43
43
|
}
|
|
44
|
+
/** `Retry-After` recorded on an MCP connect error by {@link withRetryAfter}, if any. */
|
|
45
|
+
export declare function retryAfterOf(error: unknown): string | undefined;
|
|
44
46
|
/**
|
|
45
47
|
* Try a tool call using the MCP 2026-07-28 protocol era.
|
|
46
48
|
*
|
|
@@ -41,6 +41,8 @@ export interface ModernMCPConnectionOptions {
|
|
|
41
41
|
/** Use the v2 SDK's negotiated legacy client instead of handing off to v1. */
|
|
42
42
|
handleLegacy?: boolean;
|
|
43
43
|
}
|
|
44
|
+
/** `Retry-After` recorded on an MCP connect error by {@link withRetryAfter}, if any. */
|
|
45
|
+
export declare function retryAfterOf(error: unknown): string | undefined;
|
|
44
46
|
/**
|
|
45
47
|
* Try a tool call using the MCP 2026-07-28 protocol era.
|
|
46
48
|
*
|
|
@@ -20,6 +20,7 @@ var mcp_modern_exports = {};
|
|
|
20
20
|
__export(mcp_modern_exports, {
|
|
21
21
|
closeModernMCPConnections: () => closeModernMCPConnections,
|
|
22
22
|
probeModernMCPConnection: () => probeModernMCPConnection,
|
|
23
|
+
retryAfterOf: () => retryAfterOf,
|
|
23
24
|
tryCallModernMCPTool: () => tryCallModernMCPTool,
|
|
24
25
|
tryListModernMCPTools: () => tryListModernMCPTools
|
|
25
26
|
});
|
|
@@ -248,9 +249,15 @@ async function createNegotiatedClient(cacheKey, options, authHeaders, useCachedD
|
|
|
248
249
|
getCapability: options.signingContext.getCapability,
|
|
249
250
|
adcpVersion: options.signingContext.adcpVersion
|
|
250
251
|
}) : diagnosticFetch;
|
|
252
|
+
const transportFetch = (0, import_rawResponseCapture.wrapFetchWithCapture)(withPerRequestTraceHeaders(signedFetch));
|
|
253
|
+
let throttleRetryAfter;
|
|
251
254
|
const transport = new import_client.StreamableHTTPClientTransport(new URL(options.agentUrl), {
|
|
252
255
|
requestInit: { headers: (0, import_mcp_call_context.splitConnectionHeaders)(authHeaders).identity, redirect: "manual" },
|
|
253
|
-
fetch: (
|
|
256
|
+
fetch: async (input, init) => {
|
|
257
|
+
const response = await transportFetch(input, init);
|
|
258
|
+
throttleRetryAfter = response.status === 429 || response.status === 503 ? response.headers.get("retry-after") ?? void 0 : void 0;
|
|
259
|
+
return response;
|
|
260
|
+
},
|
|
254
261
|
...options.authProvider && {
|
|
255
262
|
authProvider: options.authProvider
|
|
256
263
|
}
|
|
@@ -293,8 +300,22 @@ async function createNegotiatedClient(cacheKey, options, authHeaders, useCachedD
|
|
|
293
300
|
if (isNegotiationAuthFailure(error) && !skipProbe && presentedStaticCredential(authHeaders, options.authProvider)) {
|
|
294
301
|
return createNegotiatedClient(cacheKey, options, authHeaders, useCachedDiscovery, true);
|
|
295
302
|
}
|
|
296
|
-
throw error;
|
|
303
|
+
throw withRetryAfter(error, throttleRetryAfter);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
function withRetryAfter(error, retryAfter) {
|
|
307
|
+
if (retryAfter === void 0 || !error || typeof error !== "object") return error;
|
|
308
|
+
const status = httpStatusOf(error);
|
|
309
|
+
if (status !== 429 && status !== 503) return error;
|
|
310
|
+
try {
|
|
311
|
+
Object.defineProperty(error, "retryAfter", { value: retryAfter, enumerable: false, configurable: true });
|
|
312
|
+
} catch {
|
|
297
313
|
}
|
|
314
|
+
return error;
|
|
315
|
+
}
|
|
316
|
+
function retryAfterOf(error) {
|
|
317
|
+
const value = error && typeof error === "object" ? error.retryAfter : void 0;
|
|
318
|
+
return typeof value === "string" ? value : void 0;
|
|
298
319
|
}
|
|
299
320
|
async function getOrCreateModernConnection(cacheKey, options, authHeaders) {
|
|
300
321
|
for (let attempt = 0; ; attempt++) {
|
|
@@ -314,12 +335,12 @@ function createSharedModernConnection(cacheKey, options, authHeaders) {
|
|
|
314
335
|
const promise = createNegotiatedClient(cacheKey, options, authHeaders).then(async (client) => {
|
|
315
336
|
if ((client.getProtocolEra() === "modern" || options.handleLegacy === true) && generation === connectionGeneration) {
|
|
316
337
|
modernConnections.set(cacheKey, client);
|
|
317
|
-
(0, import_mcp_scope.registerMCPConnectionScopeCleanup)("modern", cacheKey, async () => {
|
|
338
|
+
(0, import_mcp_scope.registerMCPConnectionScopeCleanup)("modern", cacheKey, async (terminateSession) => {
|
|
318
339
|
if (modernConnections.get(cacheKey) !== client) return;
|
|
319
340
|
modernConnections.delete(cacheKey);
|
|
320
341
|
legacyConnectionExpiresAt.delete(cacheKey);
|
|
321
342
|
modernDiscoveries.delete(cacheKey);
|
|
322
|
-
await closeModernClient(client);
|
|
343
|
+
await closeModernClient(client, terminateSession);
|
|
323
344
|
});
|
|
324
345
|
if (client.getProtocolEra() === "legacy") {
|
|
325
346
|
legacyConnectionExpiresAt.set(cacheKey, Date.now() + LEGACY_CLASSIFICATION_TTL_MS);
|
|
@@ -341,7 +362,10 @@ function createSharedModernConnection(cacheKey, options, authHeaders) {
|
|
|
341
362
|
return promise;
|
|
342
363
|
}
|
|
343
364
|
async function retireFailedConnection(cacheKey, client, error) {
|
|
344
|
-
if ((0, import_abort.isAbortOrTimeoutError)(error))
|
|
365
|
+
if ((0, import_abort.isAbortOrTimeoutError)(error)) {
|
|
366
|
+
(0, import_mcp_scope.markMCPConnectionScopeInterrupted)();
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
345
369
|
if (modernConnections.get(cacheKey) === client) {
|
|
346
370
|
modernConnections.delete(cacheKey);
|
|
347
371
|
legacyConnectionExpiresAt.delete(cacheKey);
|
|
@@ -510,6 +534,7 @@ async function probeModernMCPConnection(agentUrl, authToken, customHeaders, opti
|
|
|
510
534
|
options.allowPrivateIp
|
|
511
535
|
);
|
|
512
536
|
const scoped = (0, import_mcp_connection_policy.shouldReuseMCPConnection)(options.fetchFn !== void 0);
|
|
537
|
+
if (isKnownLegacy(cacheKey)) return { connected: false };
|
|
513
538
|
let client;
|
|
514
539
|
return (0, import_mcp_call_context.runWithMCPCallContext)(
|
|
515
540
|
callContextFor({ customHeaders, requestTimeoutMs: options.requestTimeoutMs }),
|
|
@@ -650,6 +675,7 @@ async function closeModernMCPConnections() {
|
|
|
650
675
|
0 && (module.exports = {
|
|
651
676
|
closeModernMCPConnections,
|
|
652
677
|
probeModernMCPConnection,
|
|
678
|
+
retryAfterOf,
|
|
653
679
|
tryCallModernMCPTool,
|
|
654
680
|
tryListModernMCPTools
|
|
655
681
|
});
|