@adcp/sdk 6.2.0 → 6.3.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/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/decisioning/account.d.ts +84 -16
- package/dist/lib/server/decisioning/account.d.ts.map +1 -1
- package/dist/lib/server/decisioning/account.js.map +1 -1
- package/dist/lib/server/decisioning/index.d.ts +2 -2
- package/dist/lib/server/decisioning/index.d.ts.map +1 -1
- package/dist/lib/server/decisioning/index.js +4 -1
- package/dist/lib/server/decisioning/index.js.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.js +65 -3
- package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
- package/dist/lib/server/decisioning/tenant-registry.d.ts +99 -3
- package/dist/lib/server/decisioning/tenant-registry.d.ts.map +1 -1
- package/dist/lib/server/decisioning/tenant-registry.js +223 -0
- package/dist/lib/server/decisioning/tenant-registry.js.map +1 -1
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +46 -11
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/testing/compliance/storyboard-tracks.js +22 -5
- package/dist/lib/testing/compliance/storyboard-tracks.js.map +1 -1
- package/dist/lib/testing/compliance/types.d.ts +21 -1
- package/dist/lib/testing/compliance/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/default-invariants.js +17 -0
- package/dist/lib/testing/storyboard/default-invariants.js.map +1 -1
- package/dist/lib/testing/storyboard/loader.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/loader.js +41 -0
- package/dist/lib/testing/storyboard/loader.js.map +1 -1
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +107 -17
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/testing/storyboard/types.d.ts +37 -0
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/types.js.map +1 -1
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/examples/decisioning-platform-multi-tenant.ts +26 -4
- package/package.json +1 -1
|
@@ -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-01T12:37:50.478Z"
|
|
8
8
|
}
|
|
@@ -77,21 +77,6 @@ export interface Account<TCtxMeta = Record<string, unknown>> {
|
|
|
77
77
|
/** Caller's authenticated principal. **Stripped before emitting on the wire.** */
|
|
78
78
|
authInfo: AuthPrincipal;
|
|
79
79
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Request context passed to `AccountStore.resolve()` so adopters fronting
|
|
82
|
-
* an upstream platform API can translate the auth principal into their
|
|
83
|
-
* tenant model on resolution. Mirrors `ResolveAccountContext` on the
|
|
84
|
-
* underlying `AdcpServerConfig`.
|
|
85
|
-
*
|
|
86
|
-
* `authInfo` is the OAuth-style token shape the framework extracts from
|
|
87
|
-
* `serve({ authenticate })` — it's the FRAMEWORK auth shape, not the v6
|
|
88
|
-
* `AuthPrincipal` (which is what the platform sets on the RESOLVED
|
|
89
|
-
* `Account.authInfo`). The transition is intentional: the framework hands
|
|
90
|
-
* the resolver the raw transport-level auth, and the resolver decides
|
|
91
|
-
* what to persist on the Account as `AuthPrincipal`.
|
|
92
|
-
*
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
80
|
/**
|
|
96
81
|
* The OAuth-style auth shape extracted by `serve({ authenticate })`. Threaded
|
|
97
82
|
* to `accounts.resolve(ref, ctx)` and to the `tasks_get` custom-tool handler
|
|
@@ -117,6 +102,29 @@ export interface ResolveContext {
|
|
|
117
102
|
/** Tool the buyer is calling — useful for tool-aware tenant routing. */
|
|
118
103
|
toolName?: string;
|
|
119
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Context passed to AccountStore tool methods that operate on a single
|
|
107
|
+
* resolved Account (today: `getAccountFinancials`). Threads the resolved
|
|
108
|
+
* `Account<TCtxMeta>` through so adopters can read `ctx.account.ctx_metadata`
|
|
109
|
+
* (auth tokens, upstream IDs, etc.) without re-resolving from the request.
|
|
110
|
+
*
|
|
111
|
+
* Strict superset of `ResolveContext`: same `authInfo` / `toolName` fields,
|
|
112
|
+
* plus the resolved account. Distinct type because `accounts.resolve()`
|
|
113
|
+
* produces the account and therefore cannot receive it on input.
|
|
114
|
+
*
|
|
115
|
+
* **NOT applicable to `reportUsage`.** `ReportUsageRequest.usage[]` carries
|
|
116
|
+
* a per-row `account: AccountReference`; a request can span multiple
|
|
117
|
+
* accounts. Pre-resolving a single `ctx.account` would misrepresent that
|
|
118
|
+
* shape. `reportUsage` keeps `ResolveContext` and per-row resolution is
|
|
119
|
+
* the adopter's responsibility (call `accounts.resolve` from inside the
|
|
120
|
+
* impl, once per row).
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
export interface AccountToolContext<TCtxMeta = Record<string, unknown>> extends ResolveContext {
|
|
125
|
+
/** Resolved Account from `accounts.resolve()`. Populated by the framework before dispatch. */
|
|
126
|
+
account: Account<TCtxMeta>;
|
|
127
|
+
}
|
|
120
128
|
export interface AuthPrincipal {
|
|
121
129
|
/** Stable identifier for the calling agent (e.g., `https://buyer.example.com/mcp`). */
|
|
122
130
|
agent_url?: string;
|
|
@@ -124,6 +132,8 @@ export interface AuthPrincipal {
|
|
|
124
132
|
kind: 'api_key' | 'oauth' | 'signature' | 'public';
|
|
125
133
|
/** Bearer token / API key value. Platform-side don't log this. */
|
|
126
134
|
token?: string;
|
|
135
|
+
/** Token expiry (ms since epoch). Set by `accounts.refreshToken` after a successful refresh. */
|
|
136
|
+
expiresAt?: number;
|
|
127
137
|
/** OAuth scopes / API-key principal name. */
|
|
128
138
|
principal?: string;
|
|
129
139
|
/** Additional claims (jwt sub, kid, etc.). */
|
|
@@ -224,12 +234,70 @@ export interface AccountStore<TCtxMeta = Record<string, unknown>> {
|
|
|
224
234
|
* fixable rejection (`'PERMISSION_DENIED'` if the principal can't see
|
|
225
235
|
* financials for the requested account).
|
|
226
236
|
*
|
|
237
|
+
* `ctx.account` is the resolved `Account<TCtxMeta>` (framework calls
|
|
238
|
+
* `accounts.resolve(req.account)` first and threads the result in).
|
|
239
|
+
* Adopters fronting an upstream platform read tokens / upstream IDs from
|
|
240
|
+
* `ctx.account.ctx_metadata` without re-resolving.
|
|
241
|
+
*
|
|
227
242
|
* `ctx.authInfo` carries the caller's OAuth principal (when
|
|
228
243
|
* `serve({ authenticate })` is wired). Platforms that guard financials
|
|
229
244
|
* per-principal use it to authorize the read — same pattern as
|
|
230
245
|
* `accounts.resolve`.
|
|
231
246
|
*/
|
|
232
|
-
getAccountFinancials?(req: GetAccountFinancialsRequest, ctx
|
|
247
|
+
getAccountFinancials?(req: GetAccountFinancialsRequest, ctx: AccountToolContext<TCtxMeta>): Promise<GetAccountFinancialsSuccess>;
|
|
248
|
+
/**
|
|
249
|
+
* Mid-request token refresh hook. Optional. Called by the framework when
|
|
250
|
+
* a platform method throws `AdcpError({ code: 'AUTH_REQUIRED' })` AND
|
|
251
|
+
* `refreshToken` is defined — the framework refreshes via this hook,
|
|
252
|
+
* mutates `account.authInfo.token` with the returned value, and retries
|
|
253
|
+
* the failing platform method exactly once.
|
|
254
|
+
*
|
|
255
|
+
* The reason string lets adopters distinguish trigger conditions:
|
|
256
|
+
* - `'auth_required'` — platform method threw AUTH_REQUIRED in flight.
|
|
257
|
+
*
|
|
258
|
+
* Treat as an open string union: future values may be added. Adopters
|
|
259
|
+
* SHOULD switch exhaustively (`default: throw`) so behavior drift on
|
|
260
|
+
* minor SDK bumps fails loud rather than silently no-oping.
|
|
261
|
+
*
|
|
262
|
+
* **In-flight only.** The refreshed token is scoped to the current
|
|
263
|
+
* request — the framework does NOT echo it back to the buyer. Use this
|
|
264
|
+
* for adapters that front an upstream platform API (Snap, Meta,
|
|
265
|
+
* retail-media OAuth flows) where the SDK caches an upstream token
|
|
266
|
+
* server-side and the buyer's auth-to-this-agent is separate.
|
|
267
|
+
*
|
|
268
|
+
* **Account-object identity contract.** The framework mutates
|
|
269
|
+
* `account.authInfo.token` (and `expiresAt` if returned) on the Account
|
|
270
|
+
* passed in. Adopters who memoize / cache `Account` objects across
|
|
271
|
+
* requests MUST return a fresh copy from `accounts.resolve()` for each
|
|
272
|
+
* request — sharing a cached Account would leak the refreshed token to
|
|
273
|
+
* any subsequent caller that resolves the same id. Returning a new
|
|
274
|
+
* object literal per call (the canonical pattern) is safe.
|
|
275
|
+
*
|
|
276
|
+
* **Concurrency.** `refreshToken` MUST be safe under concurrent
|
|
277
|
+
* invocation on the same account — two parallel in-flight calls hitting
|
|
278
|
+
* AUTH_REQUIRED at once will both call this hook. Adopters whose
|
|
279
|
+
* upstream provider rate-limits refresh should coalesce internally
|
|
280
|
+
* (e.g., a per-account in-flight refresh promise). The framework does
|
|
281
|
+
* not coalesce.
|
|
282
|
+
*
|
|
283
|
+
* **Failure surfaces correctable AUTH_REQUIRED.** If `refreshToken`
|
|
284
|
+
* itself throws, the framework projects to `AUTH_REQUIRED` with
|
|
285
|
+
* `recovery: 'correctable'` and a fixed message (the inner exception
|
|
286
|
+
* text is NOT echoed on the wire — refresh failures routinely include
|
|
287
|
+
* upstream details that should not cross the trust boundary). Log inner
|
|
288
|
+
* details server-side. Don't use SERVICE_UNAVAILABLE — refresh failure
|
|
289
|
+
* means the upstream authorization is gone, not that the service is
|
|
290
|
+
* transiently down.
|
|
291
|
+
*
|
|
292
|
+
* **Expiry timestamp** (`expiresAt`, ms since epoch) is optional. When
|
|
293
|
+
* returned, the framework writes it to `account.authInfo.expiresAt` so
|
|
294
|
+
* adopters reading the resolved Account can branch on it (proactive
|
|
295
|
+
* refresh is not yet wired; reactive-only in v6.x).
|
|
296
|
+
*/
|
|
297
|
+
refreshToken?(account: Account<TCtxMeta>, reason: 'auth_required'): Promise<{
|
|
298
|
+
token: string;
|
|
299
|
+
expiresAt?: number;
|
|
300
|
+
}>;
|
|
233
301
|
}
|
|
234
302
|
/**
|
|
235
303
|
* Optional throw-class for `AccountStore.resolve` not-found signaling. Returning
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;IAEX,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAC;IAEb,qDAAqD;IACrD,MAAM,EAAE,iBAAiB,CAAC;IAE1B,uFAAuF;IACvF,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE;QAAE,UAAU,EAAE,OAAO,GAAG,UAAU,GAAG,cAAc,CAAA;KAAE,CAAC;IAEhE;;;;;;;;;;;;;;;OAeG;IACH,YAAY,EAAE,QAAQ,CAAC;IAEvB,kFAAkF;IAClF,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED
|
|
1
|
+
{"version":3,"file":"account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AI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC9C;AAED,MAAM,MAAM,iBAAiB,GACzB,QAAQ,GACR,kBAAkB,GAClB,UAAU,GACV,kBAAkB,GAClB,WAAW,GACX,QAAQ,CAAC;AAMb,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,WAAW,CAkB/E;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,GAAG,CAAC,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAEvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/account.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/account.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAkYH,sCAkBC;AAuBD,oCAEC;AAjHD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,oBAAqB,SAAQ,KAAK;IACpC,IAAI,GAAG,sBAA+B,CAAC;IAChD,YAAY,OAAO,GAAG,mBAAmB;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AALD,oDAKC;AAkCD;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAW,OAA0B;IAChE,MAAM,IAAI,GAAgB;QACxB,UAAU,EAAE,OAAO,CAAC,EAAE;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC;IACF,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;QAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5D,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS;QAAE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACrE,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;QAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAC3E,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,qEAAqE;QACrE,sEAAsE;QACtE,sEAAsE;QACtE,8DAA8D;QAC9D,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;IAC1D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,YAAY,CAAC,GAAsB;IACjD,OAAO,GAAG,IAAI,YAAY,IAAI,GAAG,CAAC,CAAC,CAAE,GAA+B,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9F,CAAC"}
|
|
@@ -14,7 +14,7 @@ export { PackageNotFoundError, MediaBuyNotFoundError, ProductNotFoundError, Crea
|
|
|
14
14
|
export type { CursorPage, CursorRequest } from './pagination';
|
|
15
15
|
export { publishStatusChange, setStatusChangeBus, getStatusChangeBus, createInMemoryStatusChangeBus, type StatusChange, type StatusChangeBus, type StatusChangeResourceType, type StatusChangeListener, type PublishStatusChangeOpts, } from './status-changes';
|
|
16
16
|
export type { DecisioningCapabilities, CreativeAgentRef, TargetingCapabilities, ReportingCapabilities, } from './capabilities';
|
|
17
|
-
export type { Account, AuthPrincipal, AccountStore, AccountFilter, SyncAccountsResultRow, AdcpAccountStatus, ResolveContext, ResolvedAuthInfo, } from './account';
|
|
17
|
+
export type { Account, AuthPrincipal, AccountStore, AccountFilter, SyncAccountsResultRow, AdcpAccountStatus, ResolveContext, AccountToolContext, ResolvedAuthInfo, } from './account';
|
|
18
18
|
export { AccountNotFoundError, refAccountId } from './account';
|
|
19
19
|
export type { StatusMappers, AdcpMediaBuyStatus, AdcpCreativeStatus, AdcpPlanStatus } from './status-mappers';
|
|
20
20
|
export { identityStatusMappers } from './status-mappers';
|
|
@@ -34,7 +34,7 @@ export { createAdcpServerFromPlatform, getAllAdcpMigrations, type CreateAdcpServ
|
|
|
34
34
|
export { PlatformConfigError, validatePlatform } from './runtime/validate-platform';
|
|
35
35
|
export { createInMemoryTaskRegistry, type TaskRegistry, type TaskRecord, type TaskStatus, } from './runtime/task-registry';
|
|
36
36
|
export { createPostgresTaskRegistry, getDecisioningTaskRegistryMigration, type CreatePostgresTaskRegistryOptions, type PgQueryable, } from './runtime/postgres-task-registry';
|
|
37
|
-
export { createTenantRegistry, createDefaultJwksValidator, type TenantRegistry, type TenantConfig, type TenantSigningKey, type TenantStatus, type TenantHealth, type TenantRegistryOptions, type JwksValidator, type JwksValidationResult, } from './tenant-registry';
|
|
37
|
+
export { createTenantRegistry, createDefaultJwksValidator, createSelfSignedTenantKey, createNoopJwksValidator, type TenantRegistry, type TenantConfig, type TenantSigningKey, type TenantStatus, type TenantHealth, type TenantRegistryOptions, type JwksValidator, type JwksValidationResult, } from './tenant-registry';
|
|
38
38
|
export { getAsset, requireAsset } from './manifest-helpers';
|
|
39
39
|
export { buildListCreativesResponse, type BuildListCreativesResponseOpts } from './list-helpers';
|
|
40
40
|
export { resolveStartTime, type ResolveStartTimeOptions } from './start-time';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,MAAM,iB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Ac,EACnB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAI5D,OAAO,EAAE,0BAA0B,EAAE,KAAK,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAIjG,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAI9E,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAM9C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACpF,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* @packageDocumentation
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports.buildProduct = exports.upstreamError = exports.validationError = exports.batchPoll = exports.mountTenantAdmin = exports.createTenantAdminHandlers = exports.createTenantAdminRouter = exports.resolveStartTime = exports.buildListCreativesResponse = exports.requireAsset = exports.getAsset = exports.createNoopJwksValidator = exports.createSelfSignedTenantKey = exports.createDefaultJwksValidator = exports.createTenantRegistry = exports.getDecisioningTaskRegistryMigration = exports.createPostgresTaskRegistry = exports.createInMemoryTaskRegistry = exports.validatePlatform = exports.PlatformConfigError = exports.getAllAdcpMigrations = exports.createAdcpServerFromPlatform = exports.identityStatusMappers = exports.refAccountId = exports.AccountNotFoundError = exports.createInMemoryStatusChangeBus = exports.getStatusChangeBus = exports.setStatusChangeBus = exports.publishStatusChange = 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 = exports.AdcpError = void 0;
|
|
15
|
+
exports.buildPackage = exports.buildPricingOption = void 0;
|
|
15
16
|
// Adopter-facing structured-error primitive.
|
|
16
17
|
//
|
|
17
18
|
// `AdcpError` is the canonical throwable for structured rejection. Specialism
|
|
@@ -83,6 +84,8 @@ Object.defineProperty(exports, "getDecisioningTaskRegistryMigration", { enumerab
|
|
|
83
84
|
var tenant_registry_1 = require("./tenant-registry");
|
|
84
85
|
Object.defineProperty(exports, "createTenantRegistry", { enumerable: true, get: function () { return tenant_registry_1.createTenantRegistry; } });
|
|
85
86
|
Object.defineProperty(exports, "createDefaultJwksValidator", { enumerable: true, get: function () { return tenant_registry_1.createDefaultJwksValidator; } });
|
|
87
|
+
Object.defineProperty(exports, "createSelfSignedTenantKey", { enumerable: true, get: function () { return tenant_registry_1.createSelfSignedTenantKey; } });
|
|
88
|
+
Object.defineProperty(exports, "createNoopJwksValidator", { enumerable: true, get: function () { return tenant_registry_1.createNoopJwksValidator; } });
|
|
86
89
|
// Manifest helpers — typed accessors for creative_manifest.assets values.
|
|
87
90
|
// Save adopters from writing the same null-check + discriminator-check
|
|
88
91
|
// boilerplate per call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;AAEH,6CAA6C;AAC7C,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,qCAAqC;AACrC,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;AACzE,oCAAoC;AACpC,iDAAsF;AAAnC,0GAAA,SAAS,OAAA;AAE5D,6EAA6E;AAC7E,2EAA2E;AAC3E,0EAA0E;AAC1E,uDAAuD;AACvD,+CAqBwB;AApBtB,oHAAA,oBAAoB,OAAA;AACpB,qHAAA,qBAAqB,OAAA;AACrB,oHAAA,oBAAoB,OAAA;AACpB,qHAAA,qBAAqB,OAAA;AACrB,uHAAA,uBAAuB,OAAA;AACvB,qHAAA,qBAAqB,OAAA;AACrB,iHAAA,iBAAiB,OAAA;AACjB,oHAAA,oBAAoB,OAAA;AACpB,wHAAA,wBAAwB,OAAA;AACxB,mHAAA,mBAAmB,OAAA;AACnB,iHAAA,iBAAiB,OAAA;AACjB,uHAAA,uBAAuB,OAAA;AACvB,iHAAA,iBAAiB,OAAA;AACjB,qHAAA,qBAAqB,OAAA;AACrB,gHAAA,gBAAgB,OAAA;AAChB,uHAAA,uBAAuB,OAAA;AACvB,uHAAA,uBAAuB,OAAA;AACvB,0HAAA,0BAA0B,OAAA;AAC1B,qHAAA,qBAAqB,OAAA;AACrB,oHAAA,oBAAoB,OAAA;AAMtB,qEAAqE;AACrE,4EAA4E;AAC5E,uEAAuE;AACvE,2EAA2E;AAC3E,sBAAsB;AACtB,mDAU0B;AATxB,qHAAA,mBAAmB,OAAA;AACnB,oHAAA,kBAAkB,OAAA;AAClB,oHAAA,kBAAkB,OAAA;AAClB,+HAAA,6BAA6B,OAAA;AA6B/B,qCAA+D;AAAtD,+GAAA,oBAAoB,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,64 @@ function buildDefaultTaskRegistry() {
|
|
|
844
844
|
}
|
|
845
845
|
return (0, task_registry_1.createInMemoryTaskRegistry)();
|
|
846
846
|
}
|
|
847
|
+
/**
|
|
848
|
+
* Run a platform method with reactive token refresh on `AUTH_REQUIRED`.
|
|
849
|
+
* Without a refresh fn (or no `refresh` at all) this passes the call
|
|
850
|
+
* through. With one, catches `AUTH_REQUIRED`, calls `refresh.fn`, mutates
|
|
851
|
+
* `account.authInfo.token` (and `expiresAt` if returned), and retries the
|
|
852
|
+
* inner call exactly once.
|
|
853
|
+
*
|
|
854
|
+
* Failure modes:
|
|
855
|
+
* - Refresh hook throws → re-throw `AUTH_REQUIRED` with `recovery: 'correctable'`
|
|
856
|
+
* so the buyer re-links via their UI.
|
|
857
|
+
* - Retried call throws `AUTH_REQUIRED` again → bubble out (don't refresh
|
|
858
|
+
* a second time).
|
|
859
|
+
*/
|
|
860
|
+
async function runWithTokenRefresh(fn, refresh) {
|
|
861
|
+
if (!refresh?.fn)
|
|
862
|
+
return fn();
|
|
863
|
+
try {
|
|
864
|
+
return await fn();
|
|
865
|
+
}
|
|
866
|
+
catch (err) {
|
|
867
|
+
if (!(err instanceof async_outcome_1.AdcpError) || err.code !== 'AUTH_REQUIRED') {
|
|
868
|
+
throw err;
|
|
869
|
+
}
|
|
870
|
+
let refreshed;
|
|
871
|
+
try {
|
|
872
|
+
refreshed = await refresh.fn(refresh.account, 'auth_required');
|
|
873
|
+
}
|
|
874
|
+
catch {
|
|
875
|
+
// Refresh-fn exception text is intentionally NOT echoed on the wire
|
|
876
|
+
// — upstream identity-provider error messages routinely embed
|
|
877
|
+
// refresh-token prefixes, internal hostnames, OAuth provider error
|
|
878
|
+
// codes, and stack-trace fragments. Adopters log details server-
|
|
879
|
+
// side; the buyer gets a fixed message + correctable recovery
|
|
880
|
+
// signaling they need to re-authorize.
|
|
881
|
+
throw new async_outcome_1.AdcpError('AUTH_REQUIRED', {
|
|
882
|
+
message: 'Token refresh failed; re-authentication required',
|
|
883
|
+
recovery: 'correctable',
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
refresh.account.authInfo.token = refreshed.token;
|
|
887
|
+
if (refreshed.expiresAt !== undefined) {
|
|
888
|
+
refresh.account.authInfo.expiresAt = refreshed.expiresAt;
|
|
889
|
+
}
|
|
890
|
+
return fn();
|
|
891
|
+
}
|
|
892
|
+
}
|
|
847
893
|
/**
|
|
848
894
|
* Project a sync platform call onto the wire dispatch shape. `AdcpError`
|
|
849
895
|
* throws → wire `adcp_error` envelope; other thrown errors bubble to the
|
|
850
896
|
* framework's `SERVICE_UNAVAILABLE` mapping.
|
|
897
|
+
*
|
|
898
|
+
* When `refresh` is provided and the call throws `AUTH_REQUIRED`, the
|
|
899
|
+
* framework calls `refresh.fn(refresh.account, 'auth_required')`, updates
|
|
900
|
+
* `account.authInfo.token`, and retries the platform method once.
|
|
851
901
|
*/
|
|
852
|
-
async function projectSync(fn, mapResult) {
|
|
902
|
+
async function projectSync(fn, mapResult, refresh) {
|
|
853
903
|
try {
|
|
854
|
-
const result = await fn
|
|
904
|
+
const result = await runWithTokenRefresh(fn, refresh);
|
|
855
905
|
const wire = mapResult(result);
|
|
856
906
|
// Single-chokepoint runtime strip: ctx_metadata MUST NEVER cross to the
|
|
857
907
|
// buyer. Defense-in-depth (compile-time WireShape<T> + runtime walk).
|
|
@@ -2175,11 +2225,23 @@ function buildAccountHandlers(platform, ctxFor) {
|
|
|
2175
2225
|
}
|
|
2176
2226
|
if (accounts.getAccountFinancials) {
|
|
2177
2227
|
handlers.getAccountFinancials = async (params, ctx) => {
|
|
2228
|
+
// Resolve the account first so `ctx.account` is populated when the
|
|
2229
|
+
// platform method runs. Adopters fronting an upstream platform read
|
|
2230
|
+
// tokens / upstream IDs off `ctx.account.ctx_metadata` without
|
|
2231
|
+
// having to re-resolve from `params.account`.
|
|
2178
2232
|
const resolveCtx = {
|
|
2179
2233
|
...(ctx.authInfo !== undefined && { authInfo: ctx.authInfo }),
|
|
2180
2234
|
toolName: 'get_account_financials',
|
|
2181
2235
|
};
|
|
2182
|
-
|
|
2236
|
+
const resolved = await accounts.resolve(params.account, resolveCtx);
|
|
2237
|
+
if (!resolved) {
|
|
2238
|
+
throw new async_outcome_1.AdcpError('ACCOUNT_NOT_FOUND', {
|
|
2239
|
+
message: 'Account not found',
|
|
2240
|
+
recovery: 'terminal',
|
|
2241
|
+
});
|
|
2242
|
+
}
|
|
2243
|
+
const toolCtx = { ...resolveCtx, account: resolved };
|
|
2244
|
+
return projectSync(() => accounts.getAccountFinancials(params, toolCtx), r => r, accounts.refreshToken ? { account: resolved, fn: accounts.refreshToken.bind(accounts) } : undefined);
|
|
2183
2245
|
};
|
|
2184
2246
|
}
|
|
2185
2247
|
return handlers;
|