@adcp/sdk 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.d.ts +4 -0
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.js +10 -0
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/get_products.d.ts +9 -0
- package/dist/lib/adapters/legacy/v2-5/get_products.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/get_products.js +15 -0
- package/dist/lib/adapters/legacy/v2-5/get_products.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/index.d.ts +35 -0
- package/dist/lib/adapters/legacy/v2-5/index.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/index.js +56 -0
- package/dist/lib/adapters/legacy/v2-5/index.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.d.ts +9 -0
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.js +15 -0
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/preview_creative.d.ts +4 -0
- package/dist/lib/adapters/legacy/v2-5/preview_creative.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/preview_creative.js +10 -0
- package/dist/lib/adapters/legacy/v2-5/preview_creative.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.ts +11 -0
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.js +16 -0
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/types.d.ts +40 -0
- package/dist/lib/adapters/legacy/v2-5/types.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/types.js +25 -0
- package/dist/lib/adapters/legacy/v2-5/types.js.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.d.ts +4 -0
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.d.ts.map +1 -0
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.js +12 -0
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.js.map +1 -0
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/ConversationTypes.d.ts +7 -0
- package/dist/lib/core/ConversationTypes.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.ts +9 -14
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +96 -40
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/core/TaskExecutor.d.ts +5 -0
- package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
- package/dist/lib/core/TaskExecutor.js +12 -1
- package/dist/lib/core/TaskExecutor.js.map +1 -1
- package/dist/lib/errors/index.d.ts +30 -0
- package/dist/lib/errors/index.d.ts.map +1 -1
- package/dist/lib/errors/index.js +36 -1
- package/dist/lib/errors/index.js.map +1 -1
- package/dist/lib/index.d.ts +4 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +12 -8
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/protocols/a2a.d.ts.map +1 -1
- package/dist/lib/protocols/a2a.js +5 -1
- package/dist/lib/protocols/a2a.js.map +1 -1
- package/dist/lib/protocols/index.d.ts +53 -3
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +19 -8
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/protocols/mcp.d.ts.map +1 -1
- package/dist/lib/protocols/mcp.js +13 -5
- package/dist/lib/protocols/mcp.js.map +1 -1
- package/dist/lib/protocols/responseSizeLimit.d.ts +25 -0
- package/dist/lib/protocols/responseSizeLimit.d.ts.map +1 -0
- package/dist/lib/protocols/responseSizeLimit.js +141 -0
- package/dist/lib/protocols/responseSizeLimit.js.map +1 -0
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/decisioning/async-outcome.d.ts +16 -10
- package/dist/lib/server/decisioning/async-outcome.d.ts.map +1 -1
- package/dist/lib/server/decisioning/async-outcome.js +15 -56
- package/dist/lib/server/decisioning/async-outcome.js.map +1 -1
- package/dist/lib/server/decisioning/errors-typed.d.ts +10 -4
- package/dist/lib/server/decisioning/errors-typed.d.ts.map +1 -1
- package/dist/lib/server/decisioning/errors-typed.js +13 -29
- package/dist/lib/server/decisioning/errors-typed.js.map +1 -1
- package/dist/lib/server/decisioning/helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/helpers.js +0 -2
- package/dist/lib/server/decisioning/helpers.js.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.js +0 -2
- package/dist/lib/server/decisioning/manifest-helpers.js.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.js +0 -9
- package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
- package/dist/lib/server/decisioning/start-time.d.ts.map +1 -1
- package/dist/lib/server/decisioning/start-time.js +0 -2
- package/dist/lib/server/decisioning/start-time.js.map +1 -1
- package/dist/lib/types/error-codes.d.ts +196 -9
- package/dist/lib/types/error-codes.d.ts.map +1 -1
- package/dist/lib/types/error-codes.js +104 -26
- package/dist/lib/types/error-codes.js.map +1 -1
- package/dist/lib/types/v2-5/index.d.ts +2 -0
- package/dist/lib/types/v2-5/index.d.ts.map +1 -0
- package/dist/lib/types/v2-5/index.js +30 -0
- package/dist/lib/types/v2-5/index.js.map +1 -0
- package/dist/lib/types/v2-5/tools.generated.d.ts +3507 -0
- package/dist/lib/types/v2-5/tools.generated.d.ts.map +1 -0
- package/dist/lib/types/v2-5/tools.generated.js +6 -0
- package/dist/lib/types/v2-5/tools.generated.js.map +1 -0
- package/dist/lib/utils/buyer-retry-policy.d.ts +136 -0
- package/dist/lib/utils/buyer-retry-policy.d.ts.map +1 -0
- package/dist/lib/utils/buyer-retry-policy.js +247 -0
- package/dist/lib/utils/buyer-retry-policy.js.map +1 -0
- package/dist/lib/utils/sync-creatives-adapter.d.ts +18 -8
- package/dist/lib/utils/sync-creatives-adapter.d.ts.map +1 -1
- package/dist/lib/utils/sync-creatives-adapter.js +70 -17
- package/dist/lib/utils/sync-creatives-adapter.js.map +1 -1
- package/dist/lib/validation/client-hooks.d.ts +13 -8
- package/dist/lib/validation/client-hooks.d.ts.map +1 -1
- package/dist/lib/validation/client-hooks.js +12 -12
- package/dist/lib/validation/client-hooks.js.map +1 -1
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/docs/guides/BUILD-AN-AGENT.md +2 -0
- package/docs/llms.txt +39 -22
- package/package.json +11 -1
- package/skills/build-seller-agent/SKILL.md +38 -5
- package/skills/build-seller-agent/specialisms/sales-guaranteed.md +4 -3
- package/skills/call-adcp-agent.previous/SKILL.md +83 -4
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Response-body byte cap enforcement for hostile-vendor protection.
|
|
3
|
+
//
|
|
4
|
+
// Wraps a base fetch with a streaming size counter so the SDK aborts large
|
|
5
|
+
// responses before any application-layer parsing buffers them. Active when
|
|
6
|
+
// `responseSizeLimitStorage` carries a slot — installed unconditionally as
|
|
7
|
+
// the innermost transport wrapper so production callers without the slot
|
|
8
|
+
// pay only one ALS lookup per request.
|
|
9
|
+
//
|
|
10
|
+
// The wrapper composes inside `wrapFetchWithCapture`: the diagnostic capture
|
|
11
|
+
// reads the size-limited body via `response.clone()`, so a hostile reply
|
|
12
|
+
// can't blow memory through the capture path either.
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.responseSizeLimitStorage = void 0;
|
|
15
|
+
exports.withResponseSizeLimit = withResponseSizeLimit;
|
|
16
|
+
exports.wrapFetchWithSizeLimit = wrapFetchWithSizeLimit;
|
|
17
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
18
|
+
const errors_1 = require("../errors");
|
|
19
|
+
exports.responseSizeLimitStorage = new node_async_hooks_1.AsyncLocalStorage();
|
|
20
|
+
/**
|
|
21
|
+
* Run `fn` with a response body byte cap active. Every fetch made through
|
|
22
|
+
* a wrapped transport inside `fn` aborts with `ResponseTooLargeError` when
|
|
23
|
+
* the response body exceeds `maxResponseBytes`. Non-positive caps disable
|
|
24
|
+
* enforcement (ALS slot is not entered).
|
|
25
|
+
*/
|
|
26
|
+
function withResponseSizeLimit(maxResponseBytes, fn) {
|
|
27
|
+
if (!maxResponseBytes || !Number.isFinite(maxResponseBytes) || maxResponseBytes <= 0) {
|
|
28
|
+
return fn();
|
|
29
|
+
}
|
|
30
|
+
return exports.responseSizeLimitStorage.run({ maxResponseBytes }, fn);
|
|
31
|
+
}
|
|
32
|
+
function urlOfInput(input) {
|
|
33
|
+
if (typeof input === 'string')
|
|
34
|
+
return input;
|
|
35
|
+
if (input instanceof URL)
|
|
36
|
+
return input.toString();
|
|
37
|
+
return input.url;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Strip the search component from a URL before storing it on
|
|
41
|
+
* `ResponseTooLargeError`. Some agents publish manifests with auth tokens
|
|
42
|
+
* in the query string (`?api_key=…`); without redaction those land in
|
|
43
|
+
* `err.message`, `err.details.url`, and downstream log sinks.
|
|
44
|
+
*
|
|
45
|
+
* Returns the input unchanged when it can't be parsed (relative paths,
|
|
46
|
+
* non-URL inputs from custom test stubs) — the alternative is throwing,
|
|
47
|
+
* which would mask the original `ResponseTooLargeError`.
|
|
48
|
+
*/
|
|
49
|
+
function redactUrlForError(url) {
|
|
50
|
+
try {
|
|
51
|
+
const parsed = new URL(url);
|
|
52
|
+
parsed.search = '';
|
|
53
|
+
return parsed.toString();
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return url;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Force `Accept-Encoding: identity` on outgoing requests when the size cap
|
|
61
|
+
* is active. Without this, undici sets `Accept-Encoding: gzip, deflate, br`
|
|
62
|
+
* by default and decompresses the body before our counter sees it — a
|
|
63
|
+
* hostile vendor can ship a 5 KB gzip blob that decompresses to GBs and
|
|
64
|
+
* costs the attacker nothing for asymmetric CPU burn before the cap fires.
|
|
65
|
+
* Forcing identity removes the asymmetry: the bomb has to be sent on the
|
|
66
|
+
* wire at full size, where `Content-Length` pre-check catches it.
|
|
67
|
+
*
|
|
68
|
+
* No-op when the caller already set their own `Accept-Encoding` (signing
|
|
69
|
+
* fetch may need a specific value to keep the signed bytes stable).
|
|
70
|
+
*/
|
|
71
|
+
function withIdentityEncoding(init) {
|
|
72
|
+
const headers = new Headers(init?.headers);
|
|
73
|
+
if (!headers.has('accept-encoding')) {
|
|
74
|
+
headers.set('accept-encoding', 'identity');
|
|
75
|
+
}
|
|
76
|
+
return { ...(init ?? {}), headers };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Wrap a fetch implementation so its responses honor the size cap from the
|
|
80
|
+
* active `responseSizeLimitStorage` slot. Pass-through when no slot is set.
|
|
81
|
+
*
|
|
82
|
+
* Pre-checks `Content-Length` and refuses to read the body when the declared
|
|
83
|
+
* size already exceeds the cap. Otherwise wraps `Response.body` in a
|
|
84
|
+
* `TransformStream` that counts bytes and errors with `ResponseTooLargeError`
|
|
85
|
+
* at the cap boundary, propagating to anyone reading the response (including
|
|
86
|
+
* `Response.clone()` branches used by the diagnostic capture wrapper).
|
|
87
|
+
*/
|
|
88
|
+
function wrapFetchWithSizeLimit(upstream) {
|
|
89
|
+
const wrapped = async (input, init) => {
|
|
90
|
+
const slot = exports.responseSizeLimitStorage.getStore();
|
|
91
|
+
if (!slot)
|
|
92
|
+
return upstream(input, init);
|
|
93
|
+
const response = await upstream(input, withIdentityEncoding(init));
|
|
94
|
+
return enforceSizeLimit(response, slot.maxResponseBytes, redactUrlForError(urlOfInput(input)));
|
|
95
|
+
};
|
|
96
|
+
return wrapped;
|
|
97
|
+
}
|
|
98
|
+
function enforceSizeLimit(response, maxBytes, url) {
|
|
99
|
+
// Cheap pre-check: if the server declares a Content-Length over the cap,
|
|
100
|
+
// tear the connection down before reading any of the body. Servers can
|
|
101
|
+
// omit or lie about Content-Length, which is why the streaming counter
|
|
102
|
+
// below is the authoritative enforcement.
|
|
103
|
+
const declared = parseContentLength(response.headers.get('content-length'));
|
|
104
|
+
if (declared !== undefined && declared > maxBytes) {
|
|
105
|
+
// Best-effort cancel so the runtime can release the socket. We swallow
|
|
106
|
+
// any rejection because the typed `ResponseTooLargeError` below is the
|
|
107
|
+
// signal the caller acts on — a `cancel()` rejection here would only
|
|
108
|
+
// happen if the body stream is already errored / locked, in which case
|
|
109
|
+
// the socket is already on its way down and there's nothing to recover.
|
|
110
|
+
response.body?.cancel().catch(() => { });
|
|
111
|
+
throw new errors_1.ResponseTooLargeError(maxBytes, 0, url, declared);
|
|
112
|
+
}
|
|
113
|
+
if (!response.body)
|
|
114
|
+
return response;
|
|
115
|
+
let bytesRead = 0;
|
|
116
|
+
const counter = new TransformStream({
|
|
117
|
+
transform(chunk, controller) {
|
|
118
|
+
bytesRead += chunk.byteLength;
|
|
119
|
+
if (bytesRead > maxBytes) {
|
|
120
|
+
controller.error(new errors_1.ResponseTooLargeError(maxBytes, bytesRead, url));
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
controller.enqueue(chunk);
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
return new Response(response.body.pipeThrough(counter), {
|
|
127
|
+
status: response.status,
|
|
128
|
+
statusText: response.statusText,
|
|
129
|
+
headers: response.headers,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function parseContentLength(value) {
|
|
133
|
+
if (value === null)
|
|
134
|
+
return undefined;
|
|
135
|
+
const trimmed = value.trim();
|
|
136
|
+
if (!/^\d+$/.test(trimmed))
|
|
137
|
+
return undefined;
|
|
138
|
+
const parsed = Number(trimmed);
|
|
139
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=responseSizeLimit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responseSizeLimit.js","sourceRoot":"","sources":["../../../src/lib/protocols/responseSizeLimit.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,uCAAuC;AACvC,EAAE;AACF,6EAA6E;AAC7E,yEAAyE;AACzE,qDAAqD;;;AAiBrD,sDAKC;AA0DD,wDASC;AAvFD,uDAAqD;AACrD,sCAAkD;AAMrC,QAAA,wBAAwB,GAAG,IAAI,oCAAiB,EAAiB,CAAC;AAE/E;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAI,gBAAoC,EAAE,EAAoB;IACjG,IAAI,CAAC,gBAAgB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,IAAI,CAAC,EAAE,CAAC;QACrF,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IACD,OAAO,gCAAwB,CAAC,GAAG,CAAC,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,UAAU,CAAC,KAAwB;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,KAAK,YAAY,GAAG;QAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAClD,OAAO,KAAK,CAAC,GAAG,CAAC;AACnB,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,I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AK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,SAAS,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC"}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
"source_sha": "4e553ad955f83b49c7d221ab5c3ff78237ad02e3",
|
|
5
5
|
"source_tarball_sha256": "580656d6466ef9f0d1119985e6726c2efea718dc671e2ad30957fcb2fd54af0f",
|
|
6
6
|
"upstream_adcp_version": "2.5.3",
|
|
7
|
-
"synced_at": "2026-05-
|
|
7
|
+
"synced_at": "2026-05-01T11:46:06.203Z"
|
|
8
8
|
}
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
+
import { type StandardErrorCode } from '../../types/error-codes';
|
|
17
18
|
/**
|
|
18
|
-
* Error code vocabulary mirroring `schemas/cache
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* via the same codegen pipeline as the rest of `tools.generated.ts`.
|
|
19
|
+
* Error code vocabulary mirroring `schemas/cache/<version>/enums/error-code.json`.
|
|
20
|
+
* Derived from the generated `ErrorCodeValues` array so adding a code to the
|
|
21
|
+
* spec lights up everywhere downstream (typo warn, `ErrorCode` union,
|
|
22
|
+
* autocomplete) without a hand-edit. Adopters can return platform-specific
|
|
23
|
+
* codes too — agents fall back to the `recovery` classification on unknowns
|
|
24
|
+
* via the `(string & {})` escape hatch on `AdcpStructuredError.code`.
|
|
25
25
|
*/
|
|
26
|
-
export declare const KNOWN_ERROR_CODES: readonly ["INVALID_REQUEST", "AUTH_REQUIRED", "RATE_LIMITED", "SERVICE_UNAVAILABLE", "POLICY_VIOLATION", "PRODUCT_NOT_FOUND", "PRODUCT_UNAVAILABLE", "
|
|
27
|
-
export type ErrorCode =
|
|
26
|
+
export declare const KNOWN_ERROR_CODES: readonly ["INVALID_REQUEST", "AUTH_REQUIRED", "RATE_LIMITED", "SERVICE_UNAVAILABLE", "POLICY_VIOLATION", "PRODUCT_NOT_FOUND", "PRODUCT_UNAVAILABLE", "PROPOSAL_EXPIRED", "BUDGET_TOO_LOW", "CREATIVE_REJECTED", "UNSUPPORTED_FEATURE", "AUDIENCE_TOO_SMALL", "ACCOUNT_NOT_FOUND", "ACCOUNT_SETUP_REQUIRED", "ACCOUNT_AMBIGUOUS", "ACCOUNT_PAYMENT_REQUIRED", "ACCOUNT_SUSPENDED", "COMPLIANCE_UNSATISFIED", "GOVERNANCE_DENIED", "BUDGET_EXHAUSTED", "BUDGET_EXCEEDED", "CONFLICT", "IDEMPOTENCY_CONFLICT", "IDEMPOTENCY_EXPIRED", "CREATIVE_DEADLINE_EXCEEDED", "INVALID_STATE", "MEDIA_BUY_NOT_FOUND", "NOT_CANCELLABLE", "PACKAGE_NOT_FOUND", "CREATIVE_NOT_FOUND", "SIGNAL_NOT_FOUND", "SESSION_NOT_FOUND", "PLAN_NOT_FOUND", "REFERENCE_NOT_FOUND", "SESSION_TERMINATED", "VALIDATION_ERROR", "PRODUCT_EXPIRED", "PROPOSAL_NOT_COMMITTED", "IO_REQUIRED", "TERMS_REJECTED", "REQUOTE_REQUIRED", "VERSION_UNSUPPORTED", "CAMPAIGN_SUSPENDED", "GOVERNANCE_UNAVAILABLE", "PERMISSION_DENIED"];
|
|
27
|
+
export type ErrorCode = StandardErrorCode;
|
|
28
28
|
/**
|
|
29
29
|
* Structured error envelope. Mirrors `schemas/cache/3.0.0/core/error.json`.
|
|
30
30
|
*
|
|
@@ -82,7 +82,13 @@ export declare class AdcpError extends Error {
|
|
|
82
82
|
readonly retry_after?: number;
|
|
83
83
|
readonly details?: Record<string, unknown>;
|
|
84
84
|
constructor(code: ErrorCode | (string & {}), options: {
|
|
85
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Recovery classification. Optional — defaults to the spec-correct
|
|
87
|
+
* value for any standard `code` (via `getErrorRecovery`). Pass an
|
|
88
|
+
* explicit value only to override the spec default for a vendor-
|
|
89
|
+
* specific reason; for non-standard codes the default is `correctable`.
|
|
90
|
+
*/
|
|
91
|
+
recovery?: 'transient' | 'correctable' | 'terminal';
|
|
86
92
|
message: string;
|
|
87
93
|
field?: string;
|
|
88
94
|
suggestion?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-outcome.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/async-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"async-outcome.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/async-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEnF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,k8BAAkB,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG,iBAAiB,CAAC;AA+B1C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAChC,QAAQ,EAAE,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;;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AAM,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -20,62 +20,17 @@ exports.AdcpError = exports.KNOWN_ERROR_CODES = void 0;
|
|
|
20
20
|
exports._createTaskHandoff = _createTaskHandoff;
|
|
21
21
|
exports.isTaskHandoff = isTaskHandoff;
|
|
22
22
|
exports._extractTaskFn = _extractTaskFn;
|
|
23
|
+
const enums_generated_1 = require("../../types/enums.generated");
|
|
24
|
+
const error_codes_1 = require("../../types/error-codes");
|
|
23
25
|
/**
|
|
24
|
-
* Error code vocabulary mirroring `schemas/cache
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* via the same codegen pipeline as the rest of `tools.generated.ts`.
|
|
26
|
+
* Error code vocabulary mirroring `schemas/cache/<version>/enums/error-code.json`.
|
|
27
|
+
* Derived from the generated `ErrorCodeValues` array so adding a code to the
|
|
28
|
+
* spec lights up everywhere downstream (typo warn, `ErrorCode` union,
|
|
29
|
+
* autocomplete) without a hand-edit. Adopters can return platform-specific
|
|
30
|
+
* codes too — agents fall back to the `recovery` classification on unknowns
|
|
31
|
+
* via the `(string & {})` escape hatch on `AdcpStructuredError.code`.
|
|
31
32
|
*/
|
|
32
|
-
exports.KNOWN_ERROR_CODES =
|
|
33
|
-
'INVALID_REQUEST',
|
|
34
|
-
'AUTH_REQUIRED',
|
|
35
|
-
'RATE_LIMITED',
|
|
36
|
-
'SERVICE_UNAVAILABLE',
|
|
37
|
-
'POLICY_VIOLATION',
|
|
38
|
-
'PRODUCT_NOT_FOUND',
|
|
39
|
-
'PRODUCT_UNAVAILABLE',
|
|
40
|
-
'PRODUCT_EXPIRED',
|
|
41
|
-
'PROPOSAL_EXPIRED',
|
|
42
|
-
'PROPOSAL_NOT_COMMITTED',
|
|
43
|
-
'BUDGET_TOO_LOW',
|
|
44
|
-
'BUDGET_EXHAUSTED',
|
|
45
|
-
'BUDGET_EXCEEDED',
|
|
46
|
-
'CREATIVE_REJECTED',
|
|
47
|
-
'CREATIVE_DEADLINE_EXCEEDED',
|
|
48
|
-
'CREATIVE_NOT_FOUND',
|
|
49
|
-
'UNSUPPORTED_FEATURE',
|
|
50
|
-
'AUDIENCE_TOO_SMALL',
|
|
51
|
-
'ACCOUNT_NOT_FOUND',
|
|
52
|
-
'ACCOUNT_SETUP_REQUIRED',
|
|
53
|
-
'ACCOUNT_AMBIGUOUS',
|
|
54
|
-
'ACCOUNT_PAYMENT_REQUIRED',
|
|
55
|
-
'ACCOUNT_SUSPENDED',
|
|
56
|
-
'COMPLIANCE_UNSATISFIED',
|
|
57
|
-
'GOVERNANCE_DENIED',
|
|
58
|
-
'GOVERNANCE_UNAVAILABLE',
|
|
59
|
-
'CAMPAIGN_SUSPENDED',
|
|
60
|
-
'CONFLICT',
|
|
61
|
-
'IDEMPOTENCY_CONFLICT',
|
|
62
|
-
'IDEMPOTENCY_EXPIRED',
|
|
63
|
-
'INVALID_STATE',
|
|
64
|
-
'IO_REQUIRED',
|
|
65
|
-
'MEDIA_BUY_NOT_FOUND',
|
|
66
|
-
'NOT_CANCELLABLE',
|
|
67
|
-
'PACKAGE_NOT_FOUND',
|
|
68
|
-
'PERMISSION_DENIED',
|
|
69
|
-
'PLAN_NOT_FOUND',
|
|
70
|
-
'REFERENCE_NOT_FOUND',
|
|
71
|
-
'REQUOTE_REQUIRED',
|
|
72
|
-
'SESSION_NOT_FOUND',
|
|
73
|
-
'SESSION_TERMINATED',
|
|
74
|
-
'SIGNAL_NOT_FOUND',
|
|
75
|
-
'TERMS_REJECTED',
|
|
76
|
-
'VALIDATION_ERROR',
|
|
77
|
-
'VERSION_UNSUPPORTED',
|
|
78
|
-
];
|
|
33
|
+
exports.KNOWN_ERROR_CODES = enums_generated_1.ErrorCodeValues;
|
|
79
34
|
const KNOWN_ERROR_CODE_SET = new Set(exports.KNOWN_ERROR_CODES);
|
|
80
35
|
/**
|
|
81
36
|
* Detect typoed error codes in `AdcpError` constructor calls. The
|
|
@@ -100,7 +55,7 @@ function maybeWarnUnknownErrorCode(code) {
|
|
|
100
55
|
warnedUnknownCodes.add(code);
|
|
101
56
|
// eslint-disable-next-line no-console
|
|
102
57
|
console.warn(`[adcp/decisioning] AdcpError code "${code}" is not in the known ErrorCode set ` +
|
|
103
|
-
`(
|
|
58
|
+
`(${exports.KNOWN_ERROR_CODES.length} standard codes per schemas/cache/<version>/enums/error-code.json). ` +
|
|
104
59
|
`If this is intentional (vendor-specific code), set ADCP_DECISIONING_ALLOW_CUSTOM_CODES=1. ` +
|
|
105
60
|
`Otherwise check spelling against the ErrorCode union.`);
|
|
106
61
|
}
|
|
@@ -136,7 +91,11 @@ class AdcpError extends Error {
|
|
|
136
91
|
constructor(code, options) {
|
|
137
92
|
super(options.message);
|
|
138
93
|
this.code = code;
|
|
139
|
-
|
|
94
|
+
// For non-standard `(string & {})` codes the fallback is `'terminal'`,
|
|
95
|
+
// matching `adcpError(...)`'s factory behavior in `errors.ts` — buyer
|
|
96
|
+
// can't pattern-match on an unknown code, so the conservative default
|
|
97
|
+
// tells them to escalate rather than auto-retry.
|
|
98
|
+
this.recovery = options.recovery ?? (0, error_codes_1.getErrorRecovery)(code) ?? 'terminal';
|
|
140
99
|
maybeWarnUnknownErrorCode(code);
|
|
141
100
|
if (options.field !== undefined)
|
|
142
101
|
this.field = options.field;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-outcome.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/async-outcome.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;
|
|
1
|
+
{"version":3,"file":"async-outcome.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/async-outcome.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAwPH,gDASC;AAYD,sCAOC;AAUD,wCAMC;AAlSD,iEAA8D;AAC9D,yDAAmF;AAEnF;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,iCAAe,CAAC;AAIjD,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAS,yBAAiB,CAAC,CAAC;AAErF;;;;;;;;;;;GAWG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAU,CAAC;AAC7C,SAAS,yBAAyB,CAAC,IAAY;IAC7C,IAAI,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO;IAC3C,IAAI,OAAO,CAAC,GAAG,CAAC,mCAAmC,KAAK,GAAG;QAAE,OAAO;IACpE,IAAI,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO;IACzC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC7B,sCAAsC;IACtC,OAAO,CAAC,IAAI,CACV,sCAAsC,IAAI,sCAAsC;QAC9E,IAAI,yBAAiB,CAAC,MAAM,sEAAsE;QAClG,4FAA4F;QAC5F,uDAAuD,CAC1D,CAAC;AACJ,CAAC;AA8BD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,SAAU,SAAQ,KAAK;IACzB,IAAI,GAAG,WAAoB,CAAC;IAC5B,IAAI,CAA4B;IAChC,QAAQ,CAA2C;IACnD,KAAK,CAAU;IACf,UAAU,CAAU;IACpB,WAAW,CAAU;IACrB,OAAO,CAA2B;IAE3C,YACE,IAA+B,EAC/B,OAaC;QAED,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,uEAAuE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AI,KAAK,IAAI,CAAC,QAAQ,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACvE,CAAC;CACF;AA/DD,8BA+DC;AAED,8EAA8E;AAC9E,4CAA4C;AAC5C,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,kBAAkB,GAAkB,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAEvF;;;;;;;;GAQG;AACH,MAAM,cAAc,GAAG,IAAI,OAAO,EAA6D,CAAC;AAyDhG;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CAChC,EAAqD;IAErD,kEAAkE;IAClE,iEAAiE;IACjE,qBAAqB;IACrB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,kBAAkB,CAAC,EAAE,IAAa,EAAE,CAAC,CAAC;IACtE,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,EAAuD,CAAC,CAAC;IACpF,OAAO,MAA8B,CAAC;AACxC,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAAU,KAAc;IACnD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAiC,CAAC,kBAAkB,CAAC,KAAK,IAAI;QAC/D,cAAc,CAAC,GAAG,CAAC,KAAe,CAAC,CACpC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,OAA6B;IAE7B,OAAO,cAAc,CAAC,GAAG,CAAC,OAA4B,CAEzC,CAAC;AAChB,CAAC"}
|
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
* Typed `AdcpError` subclasses. Adopters pick from a closed set of class
|
|
3
3
|
* imports rather than memorizing string codes + recovery semantics.
|
|
4
4
|
*
|
|
5
|
-
* Each class encodes the canonical `code` / `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* class
|
|
5
|
+
* Each class encodes the canonical `code` / `field` / `suggestion` shape
|
|
6
|
+
* for its scenario. `recovery` is inherited from the spec via
|
|
7
|
+
* `getErrorRecovery(code)` — these classes never hardcode it. That keeps
|
|
8
|
+
* the typed-class hierarchy in lockstep with the canonical recovery
|
|
9
|
+
* classifications in `STANDARD_ERROR_CODES` (which derives from the
|
|
10
|
+
* generated `ErrorCodeValues`). When the spec rev changes a recovery
|
|
11
|
+
* value, every typed class picks it up automatically.
|
|
12
|
+
*
|
|
13
|
+
* LLM-generated platforms get autocomplete on the import; humans skim
|
|
14
|
+
* the list to find the right class for their case.
|
|
9
15
|
*
|
|
10
16
|
* Empirical baseline (Emma matrix v17, 2026-04-30): LLM-generated
|
|
11
17
|
* sellers throw generic `Error` because the AdcpError code catalog
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-typed.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/errors-typed.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors-typed.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/errors-typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,UAAU,UAAU;IAClB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAMD,qBAAa,oBAAqB,SAAQ,SAAS;gBACrC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe;CAQrD;AAED,qBAAa,qBAAsB,SAAQ,SAAS;gBACtC,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe;CAQtD;AAED,qBAAa,oBAAqB,SAAQ,SAAS;gBACrC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe;CAQrD;AAED,qBAAa,qBA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KAAO;CASnE;AAED,qBAAa,uBAAwB,SAAQ,SAAS;gBACxC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe;CAOnD;AAMD,qBAAa,0BAA2B,SAAQ,SAAS;gBAC3C,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe;CAOlD;AAED,qBAAa,qBAAsB,SAAQ,SAAS;gBACtC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe;CAOlD;AAED,qBAAa,oBAAqB,SAAQ,SAAS;gBACrC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe;CAOlD"}
|
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
* Typed `AdcpError` subclasses. Adopters pick from a closed set of class
|
|
4
4
|
* imports rather than memorizing string codes + recovery semantics.
|
|
5
5
|
*
|
|
6
|
-
* Each class encodes the canonical `code` / `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* class
|
|
6
|
+
* Each class encodes the canonical `code` / `field` / `suggestion` shape
|
|
7
|
+
* for its scenario. `recovery` is inherited from the spec via
|
|
8
|
+
* `getErrorRecovery(code)` — these classes never hardcode it. That keeps
|
|
9
|
+
* the typed-class hierarchy in lockstep with the canonical recovery
|
|
10
|
+
* classifications in `STANDARD_ERROR_CODES` (which derives from the
|
|
11
|
+
* generated `ErrorCodeValues`). When the spec rev changes a recovery
|
|
12
|
+
* value, every typed class picks it up automatically.
|
|
13
|
+
*
|
|
14
|
+
* LLM-generated platforms get autocomplete on the import; humans skim
|
|
15
|
+
* the list to find the right class for their case.
|
|
10
16
|
*
|
|
11
17
|
* Empirical baseline (Emma matrix v17, 2026-04-30): LLM-generated
|
|
12
18
|
* sellers throw generic `Error` because the AdcpError code catalog
|
|
@@ -27,13 +33,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
27
33
|
exports.PolicyViolationError = exports.GovernanceDeniedError = exports.ComplianceUnsatisfiedError = exports.UnsupportedFeatureError = exports.ServiceUnavailableError = exports.RateLimitedError = exports.PermissionDeniedError = exports.AuthRequiredError = exports.BackwardsTimeRangeError = exports.InvalidStateError = exports.InvalidRequestError = exports.IdempotencyConflictError = exports.BudgetExhaustedError = exports.BudgetTooLowError = exports.CreativeRejectedError = exports.ProductUnavailableError = exports.CreativeNotFoundError = exports.ProductNotFoundError = exports.MediaBuyNotFoundError = exports.PackageNotFoundError = void 0;
|
|
28
34
|
const async_outcome_1 = require("./async-outcome");
|
|
29
35
|
// ---------------------------------------------------------------------------
|
|
30
|
-
// Resource-not-found family
|
|
31
|
-
// with the same ID can't succeed. Buyer must fetch a fresh ID.
|
|
36
|
+
// Resource-not-found family.
|
|
32
37
|
// ---------------------------------------------------------------------------
|
|
33
38
|
class PackageNotFoundError extends async_outcome_1.AdcpError {
|
|
34
39
|
constructor(packageId, opts = {}) {
|
|
35
40
|
super('PACKAGE_NOT_FOUND', {
|
|
36
|
-
recovery: 'terminal',
|
|
37
41
|
message: opts.message ?? `Package not found: ${packageId}`,
|
|
38
42
|
field: 'package_id',
|
|
39
43
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -45,7 +49,6 @@ exports.PackageNotFoundError = PackageNotFoundError;
|
|
|
45
49
|
class MediaBuyNotFoundError extends async_outcome_1.AdcpError {
|
|
46
50
|
constructor(mediaBuyId, opts = {}) {
|
|
47
51
|
super('MEDIA_BUY_NOT_FOUND', {
|
|
48
|
-
recovery: 'terminal',
|
|
49
52
|
message: opts.message ?? `Media buy not found: ${mediaBuyId}`,
|
|
50
53
|
field: 'media_buy_id',
|
|
51
54
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -57,7 +60,6 @@ exports.MediaBuyNotFoundError = MediaBuyNotFoundError;
|
|
|
57
60
|
class ProductNotFoundError extends async_outcome_1.AdcpError {
|
|
58
61
|
constructor(productId, opts = {}) {
|
|
59
62
|
super('PRODUCT_NOT_FOUND', {
|
|
60
|
-
recovery: 'terminal',
|
|
61
63
|
message: opts.message ?? `Product not found: ${productId}`,
|
|
62
64
|
field: 'product_id',
|
|
63
65
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -69,7 +71,6 @@ exports.ProductNotFoundError = ProductNotFoundError;
|
|
|
69
71
|
class CreativeNotFoundError extends async_outcome_1.AdcpError {
|
|
70
72
|
constructor(creativeId, opts = {}) {
|
|
71
73
|
super('CREATIVE_NOT_FOUND', {
|
|
72
|
-
recovery: 'terminal',
|
|
73
74
|
message: opts.message ?? `Creative not found: ${creativeId}`,
|
|
74
75
|
field: 'creative_id',
|
|
75
76
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -82,16 +83,14 @@ exports.CreativeNotFoundError = CreativeNotFoundError;
|
|
|
82
83
|
// `Error` subclass for the framework's `accounts.resolve()` path (caught
|
|
83
84
|
// and translated internally). Adopters who need the wire-facing
|
|
84
85
|
// `ACCOUNT_NOT_FOUND` error code throw `new AdcpError('ACCOUNT_NOT_FOUND',
|
|
85
|
-
// {
|
|
86
|
+
// { message: '...', field: 'account.id' })` directly — recovery defaults
|
|
87
|
+
// to the spec value (`terminal`) via `getErrorRecovery`.
|
|
86
88
|
// ---------------------------------------------------------------------------
|
|
87
89
|
// Resource-unavailable family — id is right but state precludes use.
|
|
88
|
-
// `recovery: 'terminal'` for sold-out / unavailable; buyer needs to choose
|
|
89
|
-
// something else.
|
|
90
90
|
// ---------------------------------------------------------------------------
|
|
91
91
|
class ProductUnavailableError extends async_outcome_1.AdcpError {
|
|
92
92
|
constructor(productId, opts = {}) {
|
|
93
93
|
super('PRODUCT_UNAVAILABLE', {
|
|
94
|
-
recovery: 'terminal',
|
|
95
94
|
message: opts.message ?? `Product unavailable (sold out / no inventory): ${productId}`,
|
|
96
95
|
field: 'product_id',
|
|
97
96
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -103,7 +102,6 @@ exports.ProductUnavailableError = ProductUnavailableError;
|
|
|
103
102
|
class CreativeRejectedError extends async_outcome_1.AdcpError {
|
|
104
103
|
constructor(creativeId, reason, opts = {}) {
|
|
105
104
|
super('CREATIVE_REJECTED', {
|
|
106
|
-
recovery: 'terminal',
|
|
107
105
|
message: opts.message ?? `Creative ${creativeId} rejected: ${reason}`,
|
|
108
106
|
field: 'creative_id',
|
|
109
107
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -123,7 +121,6 @@ class BudgetTooLowError extends async_outcome_1.AdcpError {
|
|
|
123
121
|
? `Floor is ${opts.floor}.`
|
|
124
122
|
: 'Budget below required floor.';
|
|
125
123
|
super('BUDGET_TOO_LOW', {
|
|
126
|
-
recovery: 'correctable',
|
|
127
124
|
message: opts.message ?? floorStr,
|
|
128
125
|
field: 'total_budget',
|
|
129
126
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -135,7 +132,6 @@ exports.BudgetTooLowError = BudgetTooLowError;
|
|
|
135
132
|
class BudgetExhaustedError extends async_outcome_1.AdcpError {
|
|
136
133
|
constructor(opts = {}) {
|
|
137
134
|
super('BUDGET_EXHAUSTED', {
|
|
138
|
-
recovery: 'terminal',
|
|
139
135
|
message: opts.message ?? 'Budget exhausted.',
|
|
140
136
|
field: 'total_budget',
|
|
141
137
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -150,7 +146,6 @@ exports.BudgetExhaustedError = BudgetExhaustedError;
|
|
|
150
146
|
class IdempotencyConflictError extends async_outcome_1.AdcpError {
|
|
151
147
|
constructor(opts = {}) {
|
|
152
148
|
super('IDEMPOTENCY_CONFLICT', {
|
|
153
|
-
recovery: 'terminal',
|
|
154
149
|
message: opts.message ?? 'Same idempotency_key with different payload.',
|
|
155
150
|
field: 'idempotency_key',
|
|
156
151
|
suggestion: opts.suggestion ?? 'Use a fresh idempotency_key for the new payload.',
|
|
@@ -165,7 +160,6 @@ exports.IdempotencyConflictError = IdempotencyConflictError;
|
|
|
165
160
|
class InvalidRequestError extends async_outcome_1.AdcpError {
|
|
166
161
|
constructor(field, message, opts = {}) {
|
|
167
162
|
super('INVALID_REQUEST', {
|
|
168
|
-
recovery: 'correctable',
|
|
169
163
|
message,
|
|
170
164
|
field,
|
|
171
165
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -177,7 +171,6 @@ exports.InvalidRequestError = InvalidRequestError;
|
|
|
177
171
|
class InvalidStateError extends async_outcome_1.AdcpError {
|
|
178
172
|
constructor(field, message, opts = {}) {
|
|
179
173
|
super('INVALID_STATE', {
|
|
180
|
-
recovery: 'terminal',
|
|
181
174
|
message,
|
|
182
175
|
field,
|
|
183
176
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -193,7 +186,6 @@ exports.InvalidStateError = InvalidStateError;
|
|
|
193
186
|
class BackwardsTimeRangeError extends async_outcome_1.AdcpError {
|
|
194
187
|
constructor(opts = {}) {
|
|
195
188
|
super('INVALID_REQUEST', {
|
|
196
|
-
recovery: 'correctable',
|
|
197
189
|
message: opts.message ?? 'start_time must be before end_time.',
|
|
198
190
|
field: 'start_time',
|
|
199
191
|
suggestion: opts.suggestion ?? 'Verify the buyer-provided campaign window.',
|
|
@@ -208,7 +200,6 @@ exports.BackwardsTimeRangeError = BackwardsTimeRangeError;
|
|
|
208
200
|
class AuthRequiredError extends async_outcome_1.AdcpError {
|
|
209
201
|
constructor(opts = {}) {
|
|
210
202
|
super('AUTH_REQUIRED', {
|
|
211
|
-
recovery: 'terminal',
|
|
212
203
|
message: opts.message ?? 'Authentication required.',
|
|
213
204
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
214
205
|
...(opts.details !== undefined && { details: opts.details }),
|
|
@@ -219,7 +210,6 @@ exports.AuthRequiredError = AuthRequiredError;
|
|
|
219
210
|
class PermissionDeniedError extends async_outcome_1.AdcpError {
|
|
220
211
|
constructor(action, opts = {}) {
|
|
221
212
|
super('PERMISSION_DENIED', {
|
|
222
|
-
recovery: 'terminal',
|
|
223
213
|
message: opts.message ?? `Permission denied for ${action}.`,
|
|
224
214
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
225
215
|
details: { ...(opts.details ?? {}), action },
|
|
@@ -233,7 +223,6 @@ exports.PermissionDeniedError = PermissionDeniedError;
|
|
|
233
223
|
class RateLimitedError extends async_outcome_1.AdcpError {
|
|
234
224
|
constructor(retryAfterSeconds, opts = {}) {
|
|
235
225
|
super('RATE_LIMITED', {
|
|
236
|
-
recovery: 'transient',
|
|
237
226
|
message: opts.message ?? `Rate limited. Retry after ${retryAfterSeconds}s.`,
|
|
238
227
|
retry_after: Math.max(1, Math.min(3600, Math.floor(retryAfterSeconds))),
|
|
239
228
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -245,7 +234,6 @@ exports.RateLimitedError = RateLimitedError;
|
|
|
245
234
|
class ServiceUnavailableError extends async_outcome_1.AdcpError {
|
|
246
235
|
constructor(opts = {}) {
|
|
247
236
|
super('SERVICE_UNAVAILABLE', {
|
|
248
|
-
recovery: 'transient',
|
|
249
237
|
message: opts.message ?? 'Service temporarily unavailable.',
|
|
250
238
|
retry_after: opts.retryAfterSeconds != null ? Math.max(1, Math.min(3600, Math.floor(opts.retryAfterSeconds))) : 60,
|
|
251
239
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
@@ -257,7 +245,6 @@ exports.ServiceUnavailableError = ServiceUnavailableError;
|
|
|
257
245
|
class UnsupportedFeatureError extends async_outcome_1.AdcpError {
|
|
258
246
|
constructor(feature, opts = {}) {
|
|
259
247
|
super('UNSUPPORTED_FEATURE', {
|
|
260
|
-
recovery: 'terminal',
|
|
261
248
|
message: opts.message ?? `Feature not supported: ${feature}.`,
|
|
262
249
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
263
250
|
details: { ...(opts.details ?? {}), feature },
|
|
@@ -271,7 +258,6 @@ exports.UnsupportedFeatureError = UnsupportedFeatureError;
|
|
|
271
258
|
class ComplianceUnsatisfiedError extends async_outcome_1.AdcpError {
|
|
272
259
|
constructor(reason, opts = {}) {
|
|
273
260
|
super('COMPLIANCE_UNSATISFIED', {
|
|
274
|
-
recovery: 'terminal',
|
|
275
261
|
message: opts.message ?? `Compliance not satisfied: ${reason}`,
|
|
276
262
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
277
263
|
details: { ...(opts.details ?? {}), reason },
|
|
@@ -282,7 +268,6 @@ exports.ComplianceUnsatisfiedError = ComplianceUnsatisfiedError;
|
|
|
282
268
|
class GovernanceDeniedError extends async_outcome_1.AdcpError {
|
|
283
269
|
constructor(reason, opts = {}) {
|
|
284
270
|
super('GOVERNANCE_DENIED', {
|
|
285
|
-
recovery: 'terminal',
|
|
286
271
|
message: opts.message ?? `Governance denied: ${reason}`,
|
|
287
272
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
288
273
|
details: { ...(opts.details ?? {}), reason },
|
|
@@ -293,7 +278,6 @@ exports.GovernanceDeniedError = GovernanceDeniedError;
|
|
|
293
278
|
class PolicyViolationError extends async_outcome_1.AdcpError {
|
|
294
279
|
constructor(policy, opts = {}) {
|
|
295
280
|
super('POLICY_VIOLATION', {
|
|
296
|
-
recovery: 'terminal',
|
|
297
281
|
message: opts.message ?? `Policy violation: ${policy}`,
|
|
298
282
|
...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),
|
|
299
283
|
details: { ...(opts.details ?? {}), policy },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-typed.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/errors-typed.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"errors-typed.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/errors-typed.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAEH,mDAA4C;AAW5C,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E,MAA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E,MAAM,EACd,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAChE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,SAAS,CAYX;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC"}
|
|
@@ -81,7 +81,6 @@ async function batchPoll(ids, lookup) {
|
|
|
81
81
|
*/
|
|
82
82
|
function validationError(message, opts) {
|
|
83
83
|
return new async_outcome_1.AdcpError((opts?.code ?? 'VALIDATION_ERROR'), {
|
|
84
|
-
recovery: 'correctable',
|
|
85
84
|
message,
|
|
86
85
|
...(opts?.field !== undefined && { field: opts.field }),
|
|
87
86
|
});
|
|
@@ -125,7 +124,6 @@ function upstreamError(prefix, e, extraDetails) {
|
|
|
125
124
|
const upstreamMsg = typeof e.message === 'string' && e.message.length > 0 ? e.message : 'upstream error';
|
|
126
125
|
const details = extraDetails !== undefined ? (0, pick_safe_details_1.pickSafeDetails)(extraDetails, Object.keys(extraDetails)) : undefined;
|
|
127
126
|
return new async_outcome_1.AdcpError(errorCode, {
|
|
128
|
-
recovery: 'transient',
|
|
129
127
|
message: `${prefix}: ${upstreamMsg}`,
|
|
130
128
|
...(isRateLimited && { retry_after: 60 }),
|
|
131
129
|
...(details !== undefined && { details }),
|