@adcp/sdk 5.25.0 → 6.0.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/README.md +45 -7
- package/dist/lib/compliance-fixtures/index.d.ts +1 -1
- package/dist/lib/compliance-fixtures/index.js +1 -1
- package/dist/lib/conformance/runners.d.ts.map +1 -1
- package/dist/lib/conformance/runners.js +13 -1
- package/dist/lib/conformance/runners.js.map +1 -1
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +15 -0
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/core/TaskExecutor.d.ts +7 -0
- package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
- package/dist/lib/core/TaskExecutor.js +9 -2
- package/dist/lib/core/TaskExecutor.js.map +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +7 -8
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/protocols/index.d.ts +3 -1
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +23 -14
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/schemas/index.d.ts +1 -1
- package/dist/lib/schemas/index.js +1 -1
- package/dist/lib/server/create-adcp-server.d.ts +142 -11
- package/dist/lib/server/create-adcp-server.d.ts.map +1 -1
- package/dist/lib/server/create-adcp-server.js +211 -2
- package/dist/lib/server/create-adcp-server.js.map +1 -1
- package/dist/lib/server/ctx-metadata/backends/memory.d.ts +27 -0
- package/dist/lib/server/ctx-metadata/backends/memory.d.ts.map +1 -0
- package/dist/lib/server/ctx-metadata/backends/memory.js +72 -0
- package/dist/lib/server/ctx-metadata/backends/memory.js.map +1 -0
- package/dist/lib/server/ctx-metadata/backends/pg.d.ts +62 -0
- package/dist/lib/server/ctx-metadata/backends/pg.d.ts.map +1 -0
- package/dist/lib/server/ctx-metadata/backends/pg.js +145 -0
- package/dist/lib/server/ctx-metadata/backends/pg.js.map +1 -0
- package/dist/lib/server/ctx-metadata/index.d.ts +15 -0
- package/dist/lib/server/ctx-metadata/index.d.ts.map +1 -0
- package/dist/lib/server/ctx-metadata/index.js +28 -0
- package/dist/lib/server/ctx-metadata/index.js.map +1 -0
- package/dist/lib/server/ctx-metadata/store.d.ts +177 -0
- package/dist/lib/server/ctx-metadata/store.d.ts.map +1 -0
- package/dist/lib/server/ctx-metadata/store.js +327 -0
- package/dist/lib/server/ctx-metadata/store.js.map +1 -0
- package/dist/lib/server/ctx-metadata/wire-shape.d.ts +55 -0
- package/dist/lib/server/ctx-metadata/wire-shape.d.ts.map +1 -0
- package/dist/lib/server/ctx-metadata/wire-shape.js +121 -0
- package/dist/lib/server/ctx-metadata/wire-shape.js.map +1 -0
- package/dist/lib/server/decisioning/account.d.ts +309 -0
- package/dist/lib/server/decisioning/account.d.ts.map +1 -0
- package/dist/lib/server/decisioning/account.js +102 -0
- package/dist/lib/server/decisioning/account.js.map +1 -0
- package/dist/lib/server/decisioning/admin-router.d.ts +75 -0
- package/dist/lib/server/decisioning/admin-router.d.ts.map +1 -0
- package/dist/lib/server/decisioning/admin-router.js +120 -0
- package/dist/lib/server/decisioning/admin-router.js.map +1 -0
- package/dist/lib/server/decisioning/assembly-helpers.d.ts +204 -0
- package/dist/lib/server/decisioning/assembly-helpers.d.ts.map +1 -0
- package/dist/lib/server/decisioning/assembly-helpers.js +173 -0
- package/dist/lib/server/decisioning/assembly-helpers.js.map +1 -0
- package/dist/lib/server/decisioning/async-outcome.d.ts +154 -0
- package/dist/lib/server/decisioning/async-outcome.d.ts.map +1 -0
- package/dist/lib/server/decisioning/async-outcome.js +239 -0
- package/dist/lib/server/decisioning/async-outcome.js.map +1 -0
- package/dist/lib/server/decisioning/capabilities.d.ts +251 -0
- package/dist/lib/server/decisioning/capabilities.d.ts.map +1 -0
- package/dist/lib/server/decisioning/capabilities.js +16 -0
- package/dist/lib/server/decisioning/capabilities.js.map +1 -0
- package/dist/lib/server/decisioning/context.d.ts +212 -0
- package/dist/lib/server/decisioning/context.d.ts.map +1 -0
- package/dist/lib/server/decisioning/context.js +26 -0
- package/dist/lib/server/decisioning/context.js.map +1 -0
- package/dist/lib/server/decisioning/errors-typed.d.ts +104 -0
- package/dist/lib/server/decisioning/errors-typed.d.ts.map +1 -0
- package/dist/lib/server/decisioning/errors-typed.js +304 -0
- package/dist/lib/server/decisioning/errors-typed.js.map +1 -0
- package/dist/lib/server/decisioning/helpers.d.ts +131 -0
- package/dist/lib/server/decisioning/helpers.d.ts.map +1 -0
- package/dist/lib/server/decisioning/helpers.js +134 -0
- package/dist/lib/server/decisioning/helpers.js.map +1 -0
- package/dist/lib/server/decisioning/index.d.ts +46 -0
- package/dist/lib/server/decisioning/index.d.ts.map +1 -0
- package/dist/lib/server/decisioning/index.js +120 -0
- package/dist/lib/server/decisioning/index.js.map +1 -0
- package/dist/lib/server/decisioning/list-helpers.d.ts +53 -0
- package/dist/lib/server/decisioning/list-helpers.d.ts.map +1 -0
- package/dist/lib/server/decisioning/list-helpers.js +96 -0
- package/dist/lib/server/decisioning/list-helpers.js.map +1 -0
- package/dist/lib/server/decisioning/manifest-helpers.d.ts +56 -0
- package/dist/lib/server/decisioning/manifest-helpers.d.ts.map +1 -0
- package/dist/lib/server/decisioning/manifest-helpers.js +78 -0
- package/dist/lib/server/decisioning/manifest-helpers.js.map +1 -0
- package/dist/lib/server/decisioning/pagination.d.ts +21 -0
- package/dist/lib/server/decisioning/pagination.d.ts.map +1 -0
- package/dist/lib/server/decisioning/pagination.js +12 -0
- package/dist/lib/server/decisioning/pagination.js.map +1 -0
- package/dist/lib/server/decisioning/platform.d.ts +188 -0
- package/dist/lib/server/decisioning/platform.d.ts.map +1 -0
- package/dist/lib/server/decisioning/platform.js +19 -0
- package/dist/lib/server/decisioning/platform.js.map +1 -0
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +510 -0
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -0
- package/dist/lib/server/decisioning/runtime/from-platform.js +2196 -0
- package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -0
- package/dist/lib/server/decisioning/runtime/postgres-task-registry.d.ts +114 -0
- package/dist/lib/server/decisioning/runtime/postgres-task-registry.d.ts.map +1 -0
- package/dist/lib/server/decisioning/runtime/postgres-task-registry.js +247 -0
- package/dist/lib/server/decisioning/runtime/postgres-task-registry.js.map +1 -0
- package/dist/lib/server/decisioning/runtime/protocol-for-tool.d.ts +32 -0
- package/dist/lib/server/decisioning/runtime/protocol-for-tool.d.ts.map +1 -0
- package/dist/lib/server/decisioning/runtime/protocol-for-tool.js +127 -0
- package/dist/lib/server/decisioning/runtime/protocol-for-tool.js.map +1 -0
- package/dist/lib/server/decisioning/runtime/task-registry.d.ts +105 -0
- package/dist/lib/server/decisioning/runtime/task-registry.d.ts.map +1 -0
- package/dist/lib/server/decisioning/runtime/task-registry.js +96 -0
- package/dist/lib/server/decisioning/runtime/task-registry.js.map +1 -0
- package/dist/lib/server/decisioning/runtime/to-context.d.ts +54 -0
- package/dist/lib/server/decisioning/runtime/to-context.d.ts.map +1 -0
- package/dist/lib/server/decisioning/runtime/to-context.js +166 -0
- package/dist/lib/server/decisioning/runtime/to-context.js.map +1 -0
- package/dist/lib/server/decisioning/runtime/validate-platform.d.ts +20 -0
- package/dist/lib/server/decisioning/runtime/validate-platform.d.ts.map +1 -0
- package/dist/lib/server/decisioning/runtime/validate-platform.js +93 -0
- package/dist/lib/server/decisioning/runtime/validate-platform.js.map +1 -0
- package/dist/lib/server/decisioning/specialisms/audiences.d.ts +72 -0
- package/dist/lib/server/decisioning/specialisms/audiences.d.ts.map +1 -0
- package/dist/lib/server/decisioning/specialisms/audiences.js +15 -0
- package/dist/lib/server/decisioning/specialisms/audiences.js.map +1 -0
- package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts +92 -0
- package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts.map +1 -0
- package/dist/lib/server/decisioning/specialisms/brand-rights.js +28 -0
- package/dist/lib/server/decisioning/specialisms/brand-rights.js.map +1 -0
- package/dist/lib/server/decisioning/specialisms/campaign-governance.d.ts +67 -0
- package/dist/lib/server/decisioning/specialisms/campaign-governance.d.ts.map +1 -0
- package/dist/lib/server/decisioning/specialisms/campaign-governance.js +31 -0
- package/dist/lib/server/decisioning/specialisms/campaign-governance.js.map +1 -0
- package/dist/lib/server/decisioning/specialisms/content-standards.d.ts +78 -0
- package/dist/lib/server/decisioning/specialisms/content-standards.d.ts.map +1 -0
- package/dist/lib/server/decisioning/specialisms/content-standards.js +35 -0
- package/dist/lib/server/decisioning/specialisms/content-standards.js.map +1 -0
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts +81 -0
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts.map +1 -0
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.js +28 -0
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.js.map +1 -0
- package/dist/lib/server/decisioning/specialisms/creative.d.ts +144 -0
- package/dist/lib/server/decisioning/specialisms/creative.d.ts.map +1 -0
- package/dist/lib/server/decisioning/specialisms/creative.js +19 -0
- package/dist/lib/server/decisioning/specialisms/creative.js.map +1 -0
- package/dist/lib/server/decisioning/specialisms/lists.d.ts +61 -0
- package/dist/lib/server/decisioning/specialisms/lists.d.ts.map +1 -0
- package/dist/lib/server/decisioning/specialisms/lists.js +30 -0
- package/dist/lib/server/decisioning/specialisms/lists.js.map +1 -0
- package/dist/lib/server/decisioning/specialisms/sales.d.ts +163 -0
- package/dist/lib/server/decisioning/specialisms/sales.d.ts.map +1 -0
- package/dist/lib/server/decisioning/specialisms/sales.js +64 -0
- package/dist/lib/server/decisioning/specialisms/sales.js.map +1 -0
- package/dist/lib/server/decisioning/specialisms/signals.d.ts +64 -0
- package/dist/lib/server/decisioning/specialisms/signals.d.ts.map +1 -0
- package/dist/lib/server/decisioning/specialisms/signals.js +28 -0
- package/dist/lib/server/decisioning/specialisms/signals.js.map +1 -0
- package/dist/lib/server/decisioning/start-time.d.ts +76 -0
- package/dist/lib/server/decisioning/start-time.d.ts.map +1 -0
- package/dist/lib/server/decisioning/start-time.js +81 -0
- package/dist/lib/server/decisioning/start-time.js.map +1 -0
- package/dist/lib/server/decisioning/status-changes.d.ts +165 -0
- package/dist/lib/server/decisioning/status-changes.d.ts.map +1 -0
- package/dist/lib/server/decisioning/status-changes.js +131 -0
- package/dist/lib/server/decisioning/status-changes.js.map +1 -0
- package/dist/lib/server/decisioning/status-mappers.d.ts +46 -0
- package/dist/lib/server/decisioning/status-mappers.d.ts.map +1 -0
- package/dist/lib/server/decisioning/status-mappers.js +46 -0
- package/dist/lib/server/decisioning/status-mappers.js.map +1 -0
- package/dist/lib/server/decisioning/tenant-registry.d.ts +289 -0
- package/dist/lib/server/decisioning/tenant-registry.d.ts.map +1 -0
- package/dist/lib/server/decisioning/tenant-registry.js +503 -0
- package/dist/lib/server/decisioning/tenant-registry.js.map +1 -0
- package/dist/lib/server/express-adapter.d.ts +1 -1
- package/dist/lib/server/express-adapter.js +1 -1
- package/dist/lib/server/governance.d.ts +1 -1
- package/dist/lib/server/governance.js +1 -1
- package/dist/lib/server/idempotency/store.d.ts +1 -1
- package/dist/lib/server/idempotency/store.js +1 -1
- package/dist/lib/server/index.d.ts +9 -2
- package/dist/lib/server/index.d.ts.map +1 -1
- package/dist/lib/server/index.js +79 -4
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/server/legacy/v5/index.d.ts +38 -0
- package/dist/lib/server/legacy/v5/index.d.ts.map +1 -0
- package/dist/lib/server/legacy/v5/index.js +60 -0
- package/dist/lib/server/legacy/v5/index.js.map +1 -0
- package/dist/lib/server/normalize-errors.d.ts +88 -0
- package/dist/lib/server/normalize-errors.d.ts.map +1 -0
- package/dist/lib/server/normalize-errors.js +146 -0
- package/dist/lib/server/normalize-errors.js.map +1 -0
- package/dist/lib/server/pick-safe-details.d.ts +90 -0
- package/dist/lib/server/pick-safe-details.d.ts.map +1 -0
- package/dist/lib/server/pick-safe-details.js +148 -0
- package/dist/lib/server/pick-safe-details.js.map +1 -0
- package/dist/lib/server/postgres-state-store.d.ts +1 -1
- package/dist/lib/server/postgres-state-store.js +1 -1
- package/dist/lib/server/responses.d.ts +38 -0
- package/dist/lib/server/responses.d.ts.map +1 -1
- package/dist/lib/server/responses.js +38 -0
- package/dist/lib/server/responses.js.map +1 -1
- package/dist/lib/server/state-store.d.ts +1 -1
- package/dist/lib/server/state-store.js +1 -1
- package/dist/lib/server/test-controller.d.ts +10 -3
- package/dist/lib/server/test-controller.d.ts.map +1 -1
- package/dist/lib/server/test-controller.js +10 -3
- package/dist/lib/server/test-controller.js.map +1 -1
- package/dist/lib/testing/comply-controller.d.ts +47 -1
- package/dist/lib/testing/comply-controller.d.ts.map +1 -1
- package/dist/lib/testing/comply-controller.js +11 -4
- package/dist/lib/testing/comply-controller.js.map +1 -1
- package/dist/lib/testing/index.d.ts +1 -1
- package/dist/lib/testing/index.d.ts.map +1 -1
- package/dist/lib/testing/index.js.map +1 -1
- package/dist/lib/testing/personas/index.d.ts +143 -0
- package/dist/lib/testing/personas/index.d.ts.map +1 -0
- package/dist/lib/testing/personas/index.js +190 -0
- package/dist/lib/testing/personas/index.js.map +1 -0
- package/dist/lib/testing/storyboard/index.d.ts +1 -1
- package/dist/lib/testing/storyboard/index.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/index.js +3 -2
- package/dist/lib/testing/storyboard/index.js.map +1 -1
- package/dist/lib/testing/storyboard/runner.d.ts +13 -0
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +179 -7
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/types/adcp.d.ts.map +1 -1
- package/dist/lib/types/adcp.js +1 -0
- package/dist/lib/types/adcp.js.map +1 -1
- package/dist/lib/types/asset-instances.d.ts +1 -0
- package/dist/lib/types/asset-instances.d.ts.map +1 -1
- package/dist/lib/types/core.generated.d.ts +203 -98
- package/dist/lib/types/core.generated.d.ts.map +1 -1
- package/dist/lib/types/core.generated.js +1 -1
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/index.d.ts.map +1 -1
- package/dist/lib/types/index.js.map +1 -1
- package/dist/lib/types/schemas.generated.d.ts +599 -159
- package/dist/lib/types/schemas.generated.d.ts.map +1 -1
- package/dist/lib/types/schemas.generated.js +175 -94
- package/dist/lib/types/schemas.generated.js.map +1 -1
- package/dist/lib/types/tools.generated.d.ts +315 -46
- package/dist/lib/types/tools.generated.d.ts.map +1 -1
- package/dist/lib/utils/capabilities.d.ts +1 -1
- package/dist/lib/utils/capabilities.d.ts.map +1 -1
- package/dist/lib/utils/capabilities.js +6 -0
- package/dist/lib/utils/capabilities.js.map +1 -1
- package/dist/lib/validation/schema-validator.d.ts +13 -0
- package/dist/lib/validation/schema-validator.d.ts.map +1 -1
- package/dist/lib/validation/schema-validator.js +240 -3
- package/dist/lib/validation/schema-validator.js.map +1 -1
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.js.map +1 -1
- package/docs/guides/BUILD-AN-AGENT.md +30 -5
- package/docs/llms.txt +28 -17
- package/examples/README.md +3 -1
- package/examples/decisioning-platform-broadcast-tv.ts +300 -0
- package/examples/decisioning-platform-identity-graph.ts +214 -0
- package/examples/decisioning-platform-mock-seller.ts +332 -0
- package/examples/decisioning-platform-multi-tenant.ts +128 -0
- package/examples/decisioning-platform-programmatic.ts +254 -0
- package/examples/signals-agent.ts +1 -1
- package/package.json +13 -2
- package/skills/build-brand-rights-agent/SKILL.md +10 -3
- package/skills/build-creative-agent/SKILL.md +94 -64
- package/skills/build-decisioning-creative-template/SKILL.md +554 -0
- package/skills/build-decisioning-platform/SKILL.md +304 -0
- package/skills/build-decisioning-platform/advanced/BRAND-RIGHTS.md +25 -0
- package/skills/build-decisioning-platform/advanced/COMPLIANCE.md +23 -0
- package/skills/build-decisioning-platform/advanced/GOVERNANCE.md +24 -0
- package/skills/build-decisioning-platform/advanced/HITL.md +34 -0
- package/skills/build-decisioning-platform/advanced/IDEMPOTENCY.md +52 -0
- package/skills/build-decisioning-platform/advanced/MULTI-TENANT.md +47 -0
- package/skills/build-decisioning-platform/advanced/OAUTH.md +22 -0
- package/skills/build-decisioning-platform/advanced/REFERENCE.md +991 -0
- package/skills/build-decisioning-platform/advanced/SANDBOX.md +24 -0
- package/skills/build-decisioning-platform/advanced/STATE-MACHINE.md +52 -0
- package/skills/build-decisioning-signal-marketplace/SKILL.md +269 -0
- package/skills/build-generative-seller-agent/SKILL.md +89 -53
- package/skills/build-governance-agent/SKILL.md +76 -45
- package/skills/build-retail-media-agent/SKILL.md +87 -62
- package/skills/build-seller-agent/SKILL.md +384 -255
- package/skills/build-seller-agent/deployment.md +5 -3
- package/skills/build-seller-agent/specialisms/audience-sync.md +0 -2
- package/skills/build-seller-agent/specialisms/sales-broadcast-tv.md +0 -2
- package/skills/build-seller-agent/specialisms/sales-guaranteed.md +0 -2
- package/skills/build-seller-agent/specialisms/sales-non-guaranteed.md +0 -2
- package/skills/build-seller-agent/specialisms/sales-proposal-mode.md +0 -2
- package/skills/build-seller-agent/specialisms/sales-social.md +0 -2
- package/skills/build-seller-agent/specialisms/signed-requests.md +0 -2
- package/skills/build-si-agent/SKILL.md +40 -32
- package/skills/build-signals-agent/SKILL.md +139 -92
- package/skills/call-adcp-agent.previous/SKILL.md +5 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Compile-time + runtime defense against `ctx_metadata` leaking into
|
|
4
|
+
* buyer-facing wire payloads.
|
|
5
|
+
*
|
|
6
|
+
* - **Compile-time:** `WireShape<T>` strips `ctx_metadata` from a type
|
|
7
|
+
* tree, so the framework's response builder return types refuse a
|
|
8
|
+
* payload that carries it.
|
|
9
|
+
* - **Runtime:** `stripCtxMetadata(value)` shape-aware shallow walk
|
|
10
|
+
* over known carrier locations (response root + `packages[]` +
|
|
11
|
+
* `creatives[]` + `audiences[]` + `signals[]` + `media_buys[]` +
|
|
12
|
+
* `products[]`). Catches custom-handler escape hatches and HITL
|
|
13
|
+
* task return values that re-introduce the field at runtime.
|
|
14
|
+
*
|
|
15
|
+
* Single chokepoint at the dispatcher seam. Strip runs *before* the
|
|
16
|
+
* idempotency cache write so cached replays don't leak.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.stripCtxMetadata = stripCtxMetadata;
|
|
22
|
+
exports.hasCtxMetadata = hasCtxMetadata;
|
|
23
|
+
const CTX_METADATA_KEY = 'ctx_metadata';
|
|
24
|
+
/**
|
|
25
|
+
* Runtime strip. Walks known carrier shapes in the response and
|
|
26
|
+
* deletes `ctx_metadata` keys. Returns the input value (mutates in
|
|
27
|
+
* place — the dispatcher constructs a fresh response per call, so
|
|
28
|
+
* mutation is safe).
|
|
29
|
+
*
|
|
30
|
+
* **Why shape-aware shallow walk, not full recursion.** Full
|
|
31
|
+
* recursion is O(response size) and risks stripping a field a
|
|
32
|
+
* future spec adds with the same name elsewhere (e.g., a diagnostic
|
|
33
|
+
* envelope's `ctx_metadata`). Shape-aware walks the carrier
|
|
34
|
+
* locations defined by AdCP 3.0 — adding a new carrier requires
|
|
35
|
+
* updating this list, which is the right kind of friction.
|
|
36
|
+
*/
|
|
37
|
+
function stripCtxMetadata(value) {
|
|
38
|
+
if (value == null || typeof value !== 'object')
|
|
39
|
+
return value;
|
|
40
|
+
stripFromCarrier(value);
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Carrier locations: keys whose values may be objects or arrays of
|
|
45
|
+
* objects that carry `ctx_metadata`. Add new keys here when a future
|
|
46
|
+
* spec extends the wire-resource surface.
|
|
47
|
+
*/
|
|
48
|
+
const CARRIER_KEYS = [
|
|
49
|
+
'account',
|
|
50
|
+
'accounts',
|
|
51
|
+
'media_buy',
|
|
52
|
+
'media_buys',
|
|
53
|
+
'package',
|
|
54
|
+
'packages',
|
|
55
|
+
'product',
|
|
56
|
+
'products',
|
|
57
|
+
'creative',
|
|
58
|
+
'creatives',
|
|
59
|
+
'audience',
|
|
60
|
+
'audiences',
|
|
61
|
+
'signal',
|
|
62
|
+
'signals',
|
|
63
|
+
'rights_grant',
|
|
64
|
+
'rights_grants',
|
|
65
|
+
'property_list',
|
|
66
|
+
'property_lists',
|
|
67
|
+
'collection_list',
|
|
68
|
+
'collection_lists',
|
|
69
|
+
'asset',
|
|
70
|
+
'assets',
|
|
71
|
+
];
|
|
72
|
+
function stripFromCarrier(obj) {
|
|
73
|
+
if (CTX_METADATA_KEY in obj)
|
|
74
|
+
delete obj[CTX_METADATA_KEY];
|
|
75
|
+
for (const key of CARRIER_KEYS) {
|
|
76
|
+
const nested = obj[key];
|
|
77
|
+
if (nested == null)
|
|
78
|
+
continue;
|
|
79
|
+
if (Array.isArray(nested)) {
|
|
80
|
+
for (const item of nested) {
|
|
81
|
+
if (item != null && typeof item === 'object')
|
|
82
|
+
stripFromCarrier(item);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (typeof nested === 'object') {
|
|
86
|
+
stripFromCarrier(nested);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Detect whether a payload contains `ctx_metadata` at any walked
|
|
92
|
+
* carrier location. Used by the test suite to assert wire payloads
|
|
93
|
+
* are clean — production code paths just call `stripCtxMetadata`.
|
|
94
|
+
*/
|
|
95
|
+
function hasCtxMetadata(value) {
|
|
96
|
+
if (value == null || typeof value !== 'object')
|
|
97
|
+
return false;
|
|
98
|
+
return walkForCtxMetadata(value);
|
|
99
|
+
}
|
|
100
|
+
function walkForCtxMetadata(obj) {
|
|
101
|
+
if (CTX_METADATA_KEY in obj)
|
|
102
|
+
return true;
|
|
103
|
+
for (const key of CARRIER_KEYS) {
|
|
104
|
+
const nested = obj[key];
|
|
105
|
+
if (nested == null)
|
|
106
|
+
continue;
|
|
107
|
+
if (Array.isArray(nested)) {
|
|
108
|
+
for (const item of nested) {
|
|
109
|
+
if (item != null && typeof item === 'object' && walkForCtxMetadata(item)) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else if (typeof nested === 'object') {
|
|
115
|
+
if (walkForCtxMetadata(nested))
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=wire-shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-shape.js","sourceRoot":"","sources":["../../../../src/lib/server/ctx-metadata/wire-shape.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAqCH,4CAIC;AAoDD,wCAGC;AA9FD,MAAM,gBAAgB,GAAG,cAAuB,CAAC;AAsBjD;;;;;;;;;;;;GAYG;AACH,SAAgB,gBAAgB,CAAI,KAAQ;IAC1C,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAqB,CAAC;IAC7E,gBAAgB,CAAC,KAAgC,CAAC,CAAC;IACnD,OAAO,KAAqB,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,YAAY,GAAG;IACnB,SAAS;IACT,UAAU;IACV,WAAW;IACX,YAAY;IACZ,SAAS;IACT,UAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,WAAW;IACX,UAAU;IACV,WAAW;IACX,QAAQ;IACR,SAAS;IACT,cAAc;IACd,eAAe;IACf,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;IAClB,OAAO;IACP,QAAQ;CACA,CAAC;AAEX,SAAS,g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,CAAC,EAAE,CAAC;oBACpG,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACtC,IAAI,kBAAkB,CAAC,MAAiC,CAAC;gBAAE,OAAO,IAAI,CAAC;QACzE,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account model. Single-level (matches AdCP wire's AccountReference).
|
|
3
|
+
* Platform-internal hierarchies (GAM Network → Advertiser → Order;
|
|
4
|
+
* Spotify Brand → Campaign) are encoded in `metadata`, not in the typed
|
|
5
|
+
* shape. Generic `TCtxMeta` lets platforms type their metadata at the call site.
|
|
6
|
+
*
|
|
7
|
+
* Tenant isolation is enforced at `accounts.resolve()` returning null for
|
|
8
|
+
* cross-scope references, not via a multi-level type.
|
|
9
|
+
*
|
|
10
|
+
* Status: Preview / 6.0.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
import type { BrandReference, AccountReference, ReportUsageRequest, ReportUsageResponse, GetAccountFinancialsRequest, GetAccountFinancialsSuccess } from '../../types/tools.generated';
|
|
15
|
+
import type { CursorPage, CursorRequest } from './pagination';
|
|
16
|
+
/**
|
|
17
|
+
* Account — framework's rich representation. A strict superset of the wire
|
|
18
|
+
* `Account` shape (from `list_accounts` / response envelopes):
|
|
19
|
+
*
|
|
20
|
+
* - Adds `metadata: TCtxMeta` (platform-internal fields the framework doesn't
|
|
21
|
+
* read but adopters use to thread platform-specific data)
|
|
22
|
+
* - Adds `authInfo: AuthPrincipal` (auth context for the request — MUST NOT
|
|
23
|
+
* leak to the wire)
|
|
24
|
+
* - All wire-required fields (`id`/`account_id`, `name`, `status`) are
|
|
25
|
+
* required here too.
|
|
26
|
+
*
|
|
27
|
+
* Framework projects to wire shape via `toWireAccount`: strips `metadata` +
|
|
28
|
+
* `authInfo`, renames `id` → `account_id`. ~10 lines, no `as never` casts.
|
|
29
|
+
*/
|
|
30
|
+
export interface Account<TCtxMeta = Record<string, unknown>> {
|
|
31
|
+
/** Your platform's account_id. Maps to wire `Account.account_id`. */
|
|
32
|
+
id: string;
|
|
33
|
+
/** Human-readable account name (e.g., 'Acme', 'Acme c/o Pinnacle'). Required on the wire. */
|
|
34
|
+
name: string;
|
|
35
|
+
/** Account status. Maps to wire `Account.status`. */
|
|
36
|
+
status: AdcpAccountStatus;
|
|
37
|
+
/** Canonical brand reference. Either id OR (brand+operator) identifies the account. */
|
|
38
|
+
brand?: BrandReference;
|
|
39
|
+
/** Operator domain (agency / managed-services). Pairs with `brand`. */
|
|
40
|
+
operator?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The advertiser whose rates apply to this account. Maps to wire
|
|
43
|
+
* `Account.advertiser`. Use when the account is operated by an agency on
|
|
44
|
+
* behalf of an advertiser whose rates differ from the operator's.
|
|
45
|
+
*/
|
|
46
|
+
advertiser?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Settlement boundary for operator-billed retail-media platforms.
|
|
49
|
+
* `'agent'` = pass-through (buyer's agent settles directly with the platform).
|
|
50
|
+
* `'operator'` = retail-media model (operator pays publisher, bills brand).
|
|
51
|
+
* `BrandReference` = invoice routes to a third party (Amazon DSP returning
|
|
52
|
+
* a different invoice principal than the requester is the canonical case).
|
|
53
|
+
*
|
|
54
|
+
* Optional — most platforms don't need this; comply storyboards use it to
|
|
55
|
+
* assert the right party is billed.
|
|
56
|
+
*/
|
|
57
|
+
billing?: {
|
|
58
|
+
invoicedTo: 'agent' | 'operator' | BrandReference;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Adapter-internal opaque state. Framework doesn't read this; **stripped
|
|
62
|
+
* before emitting on the wire**. GAM puts `{ networkId, advertiserId }`;
|
|
63
|
+
* Spotify puts `{ brandId, businessId }`; Criteo puts `{ customerId }`.
|
|
64
|
+
* Each platform's choice.
|
|
65
|
+
*
|
|
66
|
+
* Same field name (`ctx_metadata`) used across every DecisioningPlatform
|
|
67
|
+
* resource (Product, MediaBuy, Package, Creative, Audience, Signal,
|
|
68
|
+
* Account) for naming consistency. Account is special operationally:
|
|
69
|
+
* `accounts.resolve()` is called per-request, so the publisher is the
|
|
70
|
+
* canonical source of truth and the SDK does NOT round-trip Account
|
|
71
|
+
* `ctx_metadata` through the cache (unlike Product / MediaBuy / etc.,
|
|
72
|
+
* where the SDK bridges between `getProducts` and `createMediaBuy`).
|
|
73
|
+
* Put adapter state in `ctx_metadata`; treat it as fresh from your
|
|
74
|
+
* `accounts.resolve()` on every request.
|
|
75
|
+
*/
|
|
76
|
+
ctx_metadata: TCtxMeta;
|
|
77
|
+
/** Caller's authenticated principal. **Stripped before emitting on the wire.** */
|
|
78
|
+
authInfo: AuthPrincipal;
|
|
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
|
+
/**
|
|
96
|
+
* The OAuth-style auth shape extracted by `serve({ authenticate })`. Threaded
|
|
97
|
+
* to `accounts.resolve(ref, ctx)` and to the `tasks_get` custom-tool handler
|
|
98
|
+
* so adopters can authorize the resolution against the principal.
|
|
99
|
+
*
|
|
100
|
+
* Distinct from {@link AuthPrincipal} — `ResolvedAuthInfo` is the RAW
|
|
101
|
+
* transport-level auth the framework hands to the resolver; `AuthPrincipal`
|
|
102
|
+
* is what the resolver chooses to persist on the resolved `Account`. The
|
|
103
|
+
* resolver decides what to keep / drop / re-shape.
|
|
104
|
+
*
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
export interface ResolvedAuthInfo {
|
|
108
|
+
token: string;
|
|
109
|
+
clientId: string;
|
|
110
|
+
scopes: string[];
|
|
111
|
+
expiresAt?: number;
|
|
112
|
+
extra?: Record<string, unknown>;
|
|
113
|
+
}
|
|
114
|
+
export interface ResolveContext {
|
|
115
|
+
/** Authenticated principal extracted by `serve({ authenticate })`. Undefined when no `authenticate` is configured. */
|
|
116
|
+
authInfo?: ResolvedAuthInfo;
|
|
117
|
+
/** Tool the buyer is calling — useful for tool-aware tenant routing. */
|
|
118
|
+
toolName?: string;
|
|
119
|
+
}
|
|
120
|
+
export interface AuthPrincipal {
|
|
121
|
+
/** Stable identifier for the calling agent (e.g., `https://buyer.example.com/mcp`). */
|
|
122
|
+
agent_url?: string;
|
|
123
|
+
/** Token kind: API key, OAuth bearer, signed-request claim. */
|
|
124
|
+
kind: 'api_key' | 'oauth' | 'signature' | 'public';
|
|
125
|
+
/** Bearer token / API key value. Platform-side don't log this. */
|
|
126
|
+
token?: string;
|
|
127
|
+
/** OAuth scopes / API-key principal name. */
|
|
128
|
+
principal?: string;
|
|
129
|
+
/** Additional claims (jwt sub, kid, etc.). */
|
|
130
|
+
claims?: Record<string, unknown>;
|
|
131
|
+
}
|
|
132
|
+
export interface AccountStore<TCtxMeta = Record<string, unknown>> {
|
|
133
|
+
/**
|
|
134
|
+
* How buyers reference accounts on this platform.
|
|
135
|
+
* - `'explicit'` — buyer passes `account_id` inline on every request (Snap,
|
|
136
|
+
* Meta, GAM via Network/Company id). The default.
|
|
137
|
+
* - `'implicit'` — buyer must `sync_accounts` first; subsequent requests are
|
|
138
|
+
* resolved from the auth principal's pre-synced linkage (LinkedIn, some
|
|
139
|
+
* retail-media operators). Framework refuses inline `account_id` references
|
|
140
|
+
* for these platforms.
|
|
141
|
+
* - `'derived'` — single-tenant agents where there is no account_id on the
|
|
142
|
+
* wire at all and the auth principal alone identifies the tenant. Most
|
|
143
|
+
* self-hosted broadcasters and retail-media operators in proxy mode.
|
|
144
|
+
*
|
|
145
|
+
* Defaults to `'explicit'` when omitted.
|
|
146
|
+
*/
|
|
147
|
+
readonly resolution?: 'explicit' | 'implicit' | 'derived';
|
|
148
|
+
/**
|
|
149
|
+
* Resolve buyer's AccountReference into the platform's tenant model.
|
|
150
|
+
*
|
|
151
|
+
* `ref` is `undefined` when the wire request didn't carry an account
|
|
152
|
+
* field — `provide_performance_feedback` and `list_creative_formats` are
|
|
153
|
+
* the canonical examples. Per `resolution` mode:
|
|
154
|
+
* - `'derived'` (single-tenant): return the singleton account regardless.
|
|
155
|
+
* - `'implicit'`: look up the account from the auth principal.
|
|
156
|
+
* - `'explicit'` (default): no account is available; either throw
|
|
157
|
+
* `AccountNotFoundError` to signal "tool requires account" OR return
|
|
158
|
+
* a synthetic singleton if the tool legitimately doesn't need
|
|
159
|
+
* tenant scoping (e.g., publisher-wide format catalog from
|
|
160
|
+
* `list_creative_formats`).
|
|
161
|
+
*
|
|
162
|
+
* `ctx.authInfo` is the caller's authenticated principal (when
|
|
163
|
+
* `serve({ authenticate })` is wired). Adapters fronting an upstream
|
|
164
|
+
* platform API (Snap, Meta, retail-media) translate auth to tenant ID:
|
|
165
|
+
*
|
|
166
|
+
* ```ts
|
|
167
|
+
* resolve: async (ref, ctx) => {
|
|
168
|
+
* if (ref?.account_id) return await this.db.findById(ref.account_id);
|
|
169
|
+
* const platformAcct = await myUpstream.findByOAuthClient(ctx?.authInfo?.clientId);
|
|
170
|
+
* return platformAcct ? this.toAccount(platformAcct) : null;
|
|
171
|
+
* }
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* Two failure shapes:
|
|
175
|
+
* - **Unknown / cross-tenant reference**: return `null` (canonical) — OR
|
|
176
|
+
* throw `AccountNotFoundError` if your codebase already throws a
|
|
177
|
+
* not-found exception class. Framework emits the spec's fixed
|
|
178
|
+
* `ACCOUNT_NOT_FOUND` envelope either way. The buyer learns no detail
|
|
179
|
+
* beyond "not found" — guarding against principal-enumeration.
|
|
180
|
+
* - **Transient upstream failure** (DB outage, identity-provider 5xx):
|
|
181
|
+
* throw a generic exception. Framework maps to `SERVICE_UNAVAILABLE`
|
|
182
|
+
* so the buyer can retry.
|
|
183
|
+
*/
|
|
184
|
+
resolve(ref: AccountReference | undefined, ctx?: ResolveContext): Promise<Account<TCtxMeta> | null>;
|
|
185
|
+
/**
|
|
186
|
+
* sync_accounts API surface. Framework normalizes the wire request; platform
|
|
187
|
+
* upserts and returns per-account result rows. `throw new AdcpError(...)`
|
|
188
|
+
* for buyer-facing rejection.
|
|
189
|
+
*
|
|
190
|
+
* **Optional.** Stateless platforms (creative-template, signal-marketplace
|
|
191
|
+
* proxies) that don't manage account lifecycle can omit this; framework
|
|
192
|
+
* surfaces `UNSUPPORTED_FEATURE` to buyers calling `sync_accounts`.
|
|
193
|
+
*/
|
|
194
|
+
upsert?(refs: AccountReference[]): Promise<SyncAccountsResultRow[]>;
|
|
195
|
+
/**
|
|
196
|
+
* list_accounts API surface. Framework wraps with cursor envelope.
|
|
197
|
+
*
|
|
198
|
+
* **Optional.** Same rationale as `upsert` — stateless platforms can omit.
|
|
199
|
+
*/
|
|
200
|
+
list?(filter: AccountFilter & CursorRequest): Promise<CursorPage<Account<TCtxMeta>>>;
|
|
201
|
+
/**
|
|
202
|
+
* report_usage API surface. Operator-billed platforms accept usage rows
|
|
203
|
+
* (often impressions / spend by media_buy + period) for billing
|
|
204
|
+
* reconciliation. Optional — adopters that don't run billing through the
|
|
205
|
+
* agent leave this unimplemented and the framework returns
|
|
206
|
+
* UNSUPPORTED_FEATURE.
|
|
207
|
+
*
|
|
208
|
+
* Idempotent on `(account, period_start, period_end, line_item_id)` —
|
|
209
|
+
* platform must dedupe replays under the framework's idempotency key.
|
|
210
|
+
*
|
|
211
|
+
* `ctx.authInfo` carries the caller's OAuth principal (when
|
|
212
|
+
* `serve({ authenticate })` is wired). Platforms fronting an upstream
|
|
213
|
+
* billing API (Snap, Meta, retail-media) use it to authorize the usage
|
|
214
|
+
* post against the principal's tenant — same pattern as `accounts.resolve`.
|
|
215
|
+
*/
|
|
216
|
+
reportUsage?(req: ReportUsageRequest, ctx?: ResolveContext): Promise<ReportUsageResponse>;
|
|
217
|
+
/**
|
|
218
|
+
* get_account_financials API surface. Operator-billed platforms expose
|
|
219
|
+
* spend / credit / payment status per the wire shape. Optional — agent-
|
|
220
|
+
* billed platforms (where the buyer settles directly with the publisher)
|
|
221
|
+
* leave this unimplemented.
|
|
222
|
+
*
|
|
223
|
+
* Read tool — no idempotency requirement. Throw `AdcpError` for buyer-
|
|
224
|
+
* fixable rejection (`'PERMISSION_DENIED'` if the principal can't see
|
|
225
|
+
* financials for the requested account).
|
|
226
|
+
*
|
|
227
|
+
* `ctx.authInfo` carries the caller's OAuth principal (when
|
|
228
|
+
* `serve({ authenticate })` is wired). Platforms that guard financials
|
|
229
|
+
* per-principal use it to authorize the read — same pattern as
|
|
230
|
+
* `accounts.resolve`.
|
|
231
|
+
*/
|
|
232
|
+
getAccountFinancials?(req: GetAccountFinancialsRequest, ctx?: ResolveContext): Promise<GetAccountFinancialsSuccess>;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Optional throw-class for `AccountStore.resolve` not-found signaling. Returning
|
|
236
|
+
* `null` from `resolve` is canonical and equivalent; throw this only if your
|
|
237
|
+
* codebase already throws a typed not-found exception elsewhere.
|
|
238
|
+
*
|
|
239
|
+
* **Throwable only from `AccountStore.resolve()`.** Throwing it from a
|
|
240
|
+
* specialism method (`createMediaBuy`, `getProducts`, etc.) bypasses the
|
|
241
|
+
* framework's not-found mapping and surfaces as `SERVICE_UNAVAILABLE`.
|
|
242
|
+
*
|
|
243
|
+
* The constructor's `message` is for server-side operator diagnostics only.
|
|
244
|
+
* The framework emits a fixed `ACCOUNT_NOT_FOUND` envelope regardless; the
|
|
245
|
+
* message never reaches the buyer. Operator-side log pipelines may aggregate
|
|
246
|
+
* this string, so MUST NOT include caller-supplied identifiers (echoed account
|
|
247
|
+
* refs, request args) — those leak across operator / buyer trust boundaries.
|
|
248
|
+
*
|
|
249
|
+
* Use ONLY for the narrow not-found case. Upstream-API outages, misconfigured
|
|
250
|
+
* env vars, and schema-validation failures should propagate as generic
|
|
251
|
+
* exceptions and surface to the buyer as `SERVICE_UNAVAILABLE`.
|
|
252
|
+
*/
|
|
253
|
+
export declare class AccountNotFoundError extends Error {
|
|
254
|
+
readonly name: "AccountNotFoundError";
|
|
255
|
+
constructor(message?: string);
|
|
256
|
+
}
|
|
257
|
+
export interface AccountFilter {
|
|
258
|
+
/** Filter by brand domain across all operators. */
|
|
259
|
+
brand_domain?: string;
|
|
260
|
+
/** Filter by operator across all brands. */
|
|
261
|
+
operator?: string;
|
|
262
|
+
/** Filter by status. */
|
|
263
|
+
status?: AdcpAccountStatus[];
|
|
264
|
+
}
|
|
265
|
+
export interface SyncAccountsResultRow {
|
|
266
|
+
account_id?: string;
|
|
267
|
+
brand: BrandReference;
|
|
268
|
+
operator: string;
|
|
269
|
+
action: 'created' | 'updated' | 'unchanged' | 'failed';
|
|
270
|
+
status: AdcpAccountStatus;
|
|
271
|
+
errors?: {
|
|
272
|
+
code: string;
|
|
273
|
+
message: string;
|
|
274
|
+
}[];
|
|
275
|
+
}
|
|
276
|
+
export type AdcpAccountStatus = 'active' | 'pending_approval' | 'rejected' | 'payment_required' | 'suspended' | 'closed';
|
|
277
|
+
import type { Account as WireAccount } from '../../types/tools.generated';
|
|
278
|
+
/**
|
|
279
|
+
* Project a framework `Account<TCtxMeta>` to the wire `Account` shape.
|
|
280
|
+
*
|
|
281
|
+
* Strips `metadata` and `authInfo` (framework-internal); renames `id` →
|
|
282
|
+
* `account_id`; passes through `name`, `status`, `brand`, `operator`,
|
|
283
|
+
* `advertiser`, and `billing.invoicedTo` mappings.
|
|
284
|
+
*
|
|
285
|
+
* Used by the framework when emitting `list_accounts` and other wire
|
|
286
|
+
* responses that include account data. Adopters never call this directly —
|
|
287
|
+
* they return `Account<TCtxMeta>` from `accounts.resolve` / `accounts.list`
|
|
288
|
+
* and the framework projects.
|
|
289
|
+
*/
|
|
290
|
+
export declare function toWireAccount<TCtxMeta>(account: Account<TCtxMeta>): WireAccount;
|
|
291
|
+
/**
|
|
292
|
+
* Extract `account_id` from an `AccountReference` discriminated union without
|
|
293
|
+
* casting. Returns `undefined` when `ref` is absent or the union arm doesn't
|
|
294
|
+
* carry an `account_id` (e.g., `{ brand, operator }` or sandbox variants).
|
|
295
|
+
*
|
|
296
|
+
* Typical use in `accounts.resolve` implementations:
|
|
297
|
+
*
|
|
298
|
+
* ```ts
|
|
299
|
+
* resolve: async (ref, ctx) => {
|
|
300
|
+
* const id = refAccountId(ref);
|
|
301
|
+
* if (id) return this.db.findById(id);
|
|
302
|
+
* return this.db.findByOAuthClient(ctx?.authInfo?.clientId ?? '');
|
|
303
|
+
* }
|
|
304
|
+
* ```
|
|
305
|
+
*
|
|
306
|
+
* @public
|
|
307
|
+
*/
|
|
308
|
+
export declare function refAccountId(ref?: AccountReference): string | undefined;
|
|
309
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +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,WAA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AAC,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IACvD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,CAAC,EAAE;QAAE,IAAI,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"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Account model. Single-level (matches AdCP wire's AccountReference).
|
|
4
|
+
* Platform-internal hierarchies (GAM Network → Advertiser → Order;
|
|
5
|
+
* Spotify Brand → Campaign) are encoded in `metadata`, not in the typed
|
|
6
|
+
* shape. Generic `TCtxMeta` lets platforms type their metadata at the call site.
|
|
7
|
+
*
|
|
8
|
+
* Tenant isolation is enforced at `accounts.resolve()` returning null for
|
|
9
|
+
* cross-scope references, not via a multi-level type.
|
|
10
|
+
*
|
|
11
|
+
* Status: Preview / 6.0.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.AccountNotFoundError = void 0;
|
|
17
|
+
exports.toWireAccount = toWireAccount;
|
|
18
|
+
exports.refAccountId = refAccountId;
|
|
19
|
+
/**
|
|
20
|
+
* Optional throw-class for `AccountStore.resolve` not-found signaling. Returning
|
|
21
|
+
* `null` from `resolve` is canonical and equivalent; throw this only if your
|
|
22
|
+
* codebase already throws a typed not-found exception elsewhere.
|
|
23
|
+
*
|
|
24
|
+
* **Throwable only from `AccountStore.resolve()`.** Throwing it from a
|
|
25
|
+
* specialism method (`createMediaBuy`, `getProducts`, etc.) bypasses the
|
|
26
|
+
* framework's not-found mapping and surfaces as `SERVICE_UNAVAILABLE`.
|
|
27
|
+
*
|
|
28
|
+
* The constructor's `message` is for server-side operator diagnostics only.
|
|
29
|
+
* The framework emits a fixed `ACCOUNT_NOT_FOUND` envelope regardless; the
|
|
30
|
+
* message never reaches the buyer. Operator-side log pipelines may aggregate
|
|
31
|
+
* this string, so MUST NOT include caller-supplied identifiers (echoed account
|
|
32
|
+
* refs, request args) — those leak across operator / buyer trust boundaries.
|
|
33
|
+
*
|
|
34
|
+
* Use ONLY for the narrow not-found case. Upstream-API outages, misconfigured
|
|
35
|
+
* env vars, and schema-validation failures should propagate as generic
|
|
36
|
+
* exceptions and surface to the buyer as `SERVICE_UNAVAILABLE`.
|
|
37
|
+
*/
|
|
38
|
+
class AccountNotFoundError extends Error {
|
|
39
|
+
name = 'AccountNotFoundError';
|
|
40
|
+
constructor(message = 'Account not found') {
|
|
41
|
+
super(message);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.AccountNotFoundError = AccountNotFoundError;
|
|
45
|
+
/**
|
|
46
|
+
* Project a framework `Account<TCtxMeta>` to the wire `Account` shape.
|
|
47
|
+
*
|
|
48
|
+
* Strips `metadata` and `authInfo` (framework-internal); renames `id` →
|
|
49
|
+
* `account_id`; passes through `name`, `status`, `brand`, `operator`,
|
|
50
|
+
* `advertiser`, and `billing.invoicedTo` mappings.
|
|
51
|
+
*
|
|
52
|
+
* Used by the framework when emitting `list_accounts` and other wire
|
|
53
|
+
* responses that include account data. Adopters never call this directly —
|
|
54
|
+
* they return `Account<TCtxMeta>` from `accounts.resolve` / `accounts.list`
|
|
55
|
+
* and the framework projects.
|
|
56
|
+
*/
|
|
57
|
+
function toWireAccount(account) {
|
|
58
|
+
const wire = {
|
|
59
|
+
account_id: account.id,
|
|
60
|
+
name: account.name,
|
|
61
|
+
status: account.status,
|
|
62
|
+
};
|
|
63
|
+
if (account.brand !== undefined)
|
|
64
|
+
wire.brand = account.brand;
|
|
65
|
+
if (account.operator !== undefined)
|
|
66
|
+
wire.operator = account.operator;
|
|
67
|
+
if (account.advertiser !== undefined)
|
|
68
|
+
wire.advertiser = account.advertiser;
|
|
69
|
+
if (account.billing !== undefined) {
|
|
70
|
+
// Wire `Account.billing: 'operator' | 'agent' | 'advertiser'` is the
|
|
71
|
+
// invoiced-to party. Internal `billing.invoicedTo` collapses string +
|
|
72
|
+
// BrandReference; a BrandReference indicates a third-party advertiser
|
|
73
|
+
// (Amazon DSP-shaped flow), which projects to `'advertiser'`.
|
|
74
|
+
const t = account.billing.invoicedTo;
|
|
75
|
+
wire.billing = typeof t === 'string' ? t : 'advertiser';
|
|
76
|
+
}
|
|
77
|
+
return wire;
|
|
78
|
+
}
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
// AccountReference helpers
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
/**
|
|
83
|
+
* Extract `account_id` from an `AccountReference` discriminated union without
|
|
84
|
+
* casting. Returns `undefined` when `ref` is absent or the union arm doesn't
|
|
85
|
+
* carry an `account_id` (e.g., `{ brand, operator }` or sandbox variants).
|
|
86
|
+
*
|
|
87
|
+
* Typical use in `accounts.resolve` implementations:
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* resolve: async (ref, ctx) => {
|
|
91
|
+
* const id = refAccountId(ref);
|
|
92
|
+
* if (id) return this.db.findById(id);
|
|
93
|
+
* return this.db.findByOAuthClient(ctx?.authInfo?.clientId ?? '');
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
function refAccountId(ref) {
|
|
100
|
+
return ref && 'account_id' in ref ? ref.account_id : undefined;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/account.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AA4TH,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"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin Express router for the v6.0 TenantRegistry.
|
|
3
|
+
*
|
|
4
|
+
* Mounted on a separate port / path from the public agent endpoint so
|
|
5
|
+
* tenant traffic and ops surface stay independent. Adopters wire it
|
|
6
|
+
* behind their existing auth (basic auth, mTLS, OAuth introspection):
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import express from 'express';
|
|
10
|
+
* import { createTenantAdminRouter } from '@adcp/sdk/server/decisioning';
|
|
11
|
+
*
|
|
12
|
+
* const adminApp = express();
|
|
13
|
+
* adminApp.use('/admin', requireOpsAuth, createTenantAdminRouter(registry));
|
|
14
|
+
* adminApp.listen(9090);
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Endpoints:
|
|
18
|
+
*
|
|
19
|
+
* - `GET /tenants` — list all tenants with health status
|
|
20
|
+
* - `GET /tenants/:id` — single tenant status (404 if unknown)
|
|
21
|
+
* - `POST /tenants/:id/recheck` — force JWKS revalidation (returns new status)
|
|
22
|
+
* - `DELETE /tenants/:id` — unregister (idempotent; 204 either way)
|
|
23
|
+
*
|
|
24
|
+
* All responses are JSON. Missing tenants return 404 + `{ error: 'tenant_not_found' }`.
|
|
25
|
+
*
|
|
26
|
+
* Status: Preview / 6.0.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
import type { Request, Response, NextFunction, IRouter } from 'express';
|
|
31
|
+
import type { TenantRegistry } from './tenant-registry';
|
|
32
|
+
/**
|
|
33
|
+
* Minimal Express-router-shaped object so we don't need a hard dependency
|
|
34
|
+
* on the Express types in this file. Adopters who use a different framework
|
|
35
|
+
* (Koa, Fastify) can mount the same handler functions via the framework's
|
|
36
|
+
* adapter — `createTenantAdminHandlers(registry)` returns the bare handlers.
|
|
37
|
+
*/
|
|
38
|
+
export interface RouterLike {
|
|
39
|
+
get(path: string, handler: (req: Request, res: Response, next?: NextFunction) => void): unknown;
|
|
40
|
+
post(path: string, handler: (req: Request, res: Response, next?: NextFunction) => void): unknown;
|
|
41
|
+
delete(path: string, handler: (req: Request, res: Response, next?: NextFunction) => void): unknown;
|
|
42
|
+
}
|
|
43
|
+
export interface TenantAdminHandlers {
|
|
44
|
+
listTenants(req: Request, res: Response): void;
|
|
45
|
+
getTenant(req: Request, res: Response): void;
|
|
46
|
+
recheckTenant(req: Request, res: Response): Promise<void>;
|
|
47
|
+
unregisterTenant(req: Request, res: Response): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Bare handlers — for adopters running a non-Express framework. The router
|
|
51
|
+
* helper below mounts these on the standard paths.
|
|
52
|
+
*/
|
|
53
|
+
export declare function createTenantAdminHandlers(registry: TenantRegistry): TenantAdminHandlers;
|
|
54
|
+
/**
|
|
55
|
+
* Build an Express router with the standard admin endpoints mounted.
|
|
56
|
+
* Pass an `express.Router()` instance to mount on (so we don't need an
|
|
57
|
+
* Express dependency in this file).
|
|
58
|
+
*/
|
|
59
|
+
export declare function mountTenantAdmin(router: RouterLike, registry: TenantRegistry): RouterLike;
|
|
60
|
+
/**
|
|
61
|
+
* Convenience: takes an `express` import and a registry, returns a
|
|
62
|
+
* mounted `Router` ready to attach. Usage:
|
|
63
|
+
*
|
|
64
|
+
* ```ts
|
|
65
|
+
* import express from 'express';
|
|
66
|
+
* import { createTenantAdminRouter } from '@adcp/sdk/server/decisioning';
|
|
67
|
+
* adminApp.use('/admin', createTenantAdminRouter(express.Router(), registry));
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* The `routerFactory` argument lets adopters pre-configure middleware
|
|
71
|
+
* (auth, logging) on the router before passing it in.
|
|
72
|
+
*/
|
|
73
|
+
export declare function createTenantAdminRouter<R extends RouterLike>(routerFactory: R, registry: TenantRegistry): R;
|
|
74
|
+
export type { IRouter };
|
|
75
|
+
//# sourceMappingURL=admin-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-router.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/decisioning/admin-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC;IAChG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC;IACjG,MAAM,CAAC,IA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