@adcp/sdk 17.0.0-beta.21 → 17.0.0-beta.23
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 +26 -2
- package/dist/lib/adapters/version/index.d.mts +1 -1
- package/dist/lib/adapters/version/index.d.ts +1 -1
- package/dist/lib/adapters/version/index.js +2 -0
- package/dist/lib/adapters/version/index.mjs +2 -0
- package/dist/lib/adapters/version/negotiate.d.mts +13 -0
- package/dist/lib/adapters/version/negotiate.d.ts +13 -0
- package/dist/lib/adapters/version/negotiate.js +6 -0
- package/dist/lib/adapters/version/negotiate.mjs +5 -0
- package/dist/lib/client/core.d.mts +4 -0
- package/dist/lib/client/core.d.ts +4 -0
- package/dist/lib/client/core.js +13 -0
- package/dist/lib/client/core.mjs +12 -0
- package/dist/lib/conformance/property-lists.d.mts +1 -1
- package/dist/lib/conformance/property-lists.d.ts +1 -1
- package/dist/lib/conformance/property-lists.js +1 -1
- package/dist/lib/conformance/property-lists.mjs +1 -1
- package/dist/lib/core/SingleAgentClient.d.mts +23 -1
- package/dist/lib/core/SingleAgentClient.d.ts +23 -1
- package/dist/lib/core/SingleAgentClient.js +102 -18
- package/dist/lib/core/SingleAgentClient.mjs +108 -18
- package/dist/lib/core/targeting-helpers.d.mts +123 -0
- package/dist/lib/core/targeting-helpers.d.ts +123 -0
- package/dist/lib/core/targeting-helpers.js +412 -0
- package/dist/lib/core/targeting-helpers.mjs +370 -0
- package/dist/lib/entrypoints/client-account-changes.d.mts +5 -0
- package/dist/lib/entrypoints/client-account-changes.d.ts +5 -0
- package/dist/lib/entrypoints/client-account-changes.js +28 -0
- package/dist/lib/entrypoints/client-account-changes.mjs +4 -0
- package/dist/lib/entrypoints/client-webhook-stores.d.mts +2 -0
- package/dist/lib/entrypoints/client-webhook-stores.d.ts +2 -0
- package/dist/lib/entrypoints/client-webhook-stores.js +37 -0
- package/dist/lib/entrypoints/client-webhook-stores.mjs +16 -0
- package/dist/lib/entrypoints/discovery.d.mts +9 -0
- package/dist/lib/entrypoints/discovery.d.ts +9 -0
- package/dist/lib/entrypoints/discovery.js +72 -0
- package/dist/lib/entrypoints/discovery.mjs +56 -0
- package/dist/lib/entrypoints/errors.d.mts +11 -0
- package/dist/lib/entrypoints/errors.d.ts +11 -0
- package/dist/lib/entrypoints/errors.js +159 -0
- package/dist/lib/entrypoints/errors.mjs +132 -0
- package/dist/lib/entrypoints/media-buy.d.mts +5 -0
- package/dist/lib/entrypoints/media-buy.d.ts +5 -0
- package/dist/lib/entrypoints/media-buy.js +119 -0
- package/dist/lib/entrypoints/media-buy.mjs +100 -0
- package/dist/lib/entrypoints/registry.d.mts +5 -0
- package/dist/lib/entrypoints/registry.d.ts +5 -0
- package/dist/lib/entrypoints/registry.js +61 -0
- package/dist/lib/entrypoints/registry.mjs +40 -0
- package/dist/lib/entrypoints/utils.d.mts +7 -0
- package/dist/lib/entrypoints/utils.d.ts +7 -0
- package/dist/lib/entrypoints/utils.js +100 -0
- package/dist/lib/entrypoints/utils.mjs +72 -0
- package/dist/lib/entrypoints/version.d.mts +3 -0
- package/dist/lib/entrypoints/version.d.ts +3 -0
- package/dist/lib/entrypoints/version.js +57 -0
- package/dist/lib/entrypoints/version.mjs +36 -0
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/media-buy/action-contracts.js +3 -3
- package/dist/lib/media-buy/action-contracts.mjs +1 -1
- package/dist/lib/media-buy/creative-start-policy.d.mts +19 -0
- package/dist/lib/media-buy/creative-start-policy.d.ts +19 -0
- package/dist/lib/media-buy/creative-start-policy.js +59 -0
- package/dist/lib/media-buy/creative-start-policy.mjs +31 -0
- package/dist/lib/media-buy/valid-actions.d.mts +47 -0
- package/dist/lib/media-buy/valid-actions.d.ts +47 -0
- package/dist/lib/media-buy/valid-actions.js +42 -0
- package/dist/lib/media-buy/valid-actions.mjs +18 -0
- package/dist/lib/net/pin-and-bind-fetch.d.mts +121 -0
- package/dist/lib/net/pin-and-bind-fetch.d.ts +121 -0
- package/dist/lib/net/pin-and-bind-fetch.js +209 -0
- package/dist/lib/net/pin-and-bind-fetch.mjs +183 -0
- package/dist/lib/protocols/mcp-modern.js +20 -4
- package/dist/lib/protocols/mcp-modern.mjs +20 -4
- package/dist/lib/registry/types.generated.d.ts +224 -3
- package/dist/lib/reporting/ledger/index.d.mts +1 -0
- package/dist/lib/reporting/ledger/index.d.ts +1 -0
- package/dist/lib/reporting/ledger/index.js +3 -1
- package/dist/lib/reporting/ledger/index.mjs +1 -0
- package/dist/lib/reporting/ledger/instant.d.mts +5 -0
- package/dist/lib/reporting/ledger/instant.d.ts +5 -0
- package/dist/lib/reporting/ledger/instant.js +10 -0
- package/dist/lib/reporting/ledger/instant.mjs +9 -0
- package/dist/lib/reporting/ledger/issue-events.d.mts +333 -0
- package/dist/lib/reporting/ledger/issue-events.d.ts +333 -0
- package/dist/lib/reporting/ledger/issue-events.js +310 -0
- package/dist/lib/reporting/ledger/issue-events.mjs +282 -0
- package/dist/lib/reporting/service/index.d.mts +36 -1
- package/dist/lib/reporting/service/index.d.ts +36 -1
- package/dist/lib/reporting/service/index.js +51 -1
- package/dist/lib/reporting/service/index.mjs +52 -2
- package/dist/lib/reporting/service/scheduler-support.d.mts +1 -1
- package/dist/lib/reporting/service/scheduler-support.d.ts +1 -1
- package/dist/lib/reporting/service/scheduler-support.js +1 -1
- package/dist/lib/reporting/service/scheduler-support.mjs +1 -1
- package/dist/lib/server/capabilities-release-projection.d.mts +43 -0
- package/dist/lib/server/capabilities-release-projection.d.ts +43 -0
- package/dist/lib/server/capabilities-release-projection.js +128 -0
- package/dist/lib/server/capabilities-release-projection.mjs +112 -0
- package/dist/lib/server/create-adcp-server.d.mts +29 -5
- package/dist/lib/server/create-adcp-server.d.ts +29 -5
- package/dist/lib/server/create-adcp-server.js +97 -24
- package/dist/lib/server/create-adcp-server.mjs +108 -23
- package/dist/lib/server/decisioning/capabilities.d.mts +27 -0
- package/dist/lib/server/decisioning/capabilities.d.ts +27 -0
- package/dist/lib/server/decisioning/runtime/from-platform.js +99 -27
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +103 -27
- package/dist/lib/server/declared-input-schema.d.mts +108 -0
- package/dist/lib/server/declared-input-schema.d.ts +108 -0
- package/dist/lib/server/declared-input-schema.js +167 -0
- package/dist/lib/server/declared-input-schema.mjs +137 -0
- package/dist/lib/server/envelope-allowlist.d.mts +1 -105
- package/dist/lib/server/envelope-allowlist.d.ts +1 -105
- package/dist/lib/server/envelope-allowlist.js +3 -79
- package/dist/lib/server/envelope-allowlist.mjs +1 -71
- package/dist/lib/server/errors.d.mts +1 -186
- package/dist/lib/server/errors.d.ts +1 -186
- package/dist/lib/server/errors.js +3 -98
- package/dist/lib/server/errors.mjs +1 -94
- package/dist/lib/server/index.d.mts +1 -1
- package/dist/lib/server/index.d.ts +1 -1
- package/dist/lib/server/mcp-modern-server.js +21 -4
- package/dist/lib/server/mcp-modern-server.mjs +21 -4
- package/dist/lib/server/media-buy-action-resolver.d.mts +7 -0
- package/dist/lib/server/media-buy-action-resolver.d.ts +7 -0
- package/dist/lib/server/media-buy-action-resolver.js +10 -1
- package/dist/lib/server/media-buy-action-resolver.mjs +10 -1
- package/dist/lib/server/media-buy-helpers.d.mts +1 -47
- package/dist/lib/server/media-buy-helpers.d.ts +1 -47
- package/dist/lib/server/media-buy-helpers.js +3 -23
- package/dist/lib/server/media-buy-helpers.mjs +1 -18
- package/dist/lib/server/pick-safe-details.d.mts +1 -89
- package/dist/lib/server/pick-safe-details.d.ts +1 -89
- package/dist/lib/server/pick-safe-details.js +3 -61
- package/dist/lib/server/pick-safe-details.mjs +1 -56
- package/dist/lib/server/pin-and-bind-fetch.d.mts +1 -121
- package/dist/lib/server/pin-and-bind-fetch.d.ts +1 -121
- package/dist/lib/server/pin-and-bind-fetch.js +3 -190
- package/dist/lib/server/pin-and-bind-fetch.mjs +1 -183
- package/dist/lib/server/targeting-helpers.d.mts +1 -123
- package/dist/lib/server/targeting-helpers.d.ts +1 -123
- package/dist/lib/server/targeting-helpers.js +3 -393
- package/dist/lib/server/targeting-helpers.mjs +1 -370
- package/dist/lib/server/test-controller.js +7 -3
- package/dist/lib/server/test-controller.mjs +7 -3
- package/dist/lib/storage/memory-ledger.js +219 -1
- package/dist/lib/storage/memory-ledger.mjs +223 -1
- package/dist/lib/testing/client.js +26 -5
- package/dist/lib/testing/client.mjs +24 -5
- package/dist/lib/testing/compliance/storyboard-tracks.js +0 -4
- package/dist/lib/testing/compliance/storyboard-tracks.mjs +0 -4
- package/dist/lib/testing/comply-controller.js +7 -2
- package/dist/lib/testing/comply-controller.mjs +7 -2
- package/dist/lib/testing/storyboard/request-signing/grader.d.mts +21 -0
- package/dist/lib/testing/storyboard/request-signing/grader.d.ts +21 -0
- package/dist/lib/testing/storyboard/request-signing/grader.js +31 -0
- package/dist/lib/testing/storyboard/request-signing/grader.mjs +30 -0
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.js +1 -1
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs +2 -1
- package/dist/lib/testing/storyboard/request-signing/types.d.mts +12 -0
- package/dist/lib/testing/storyboard/request-signing/types.d.ts +12 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.js +7 -2
- package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +7 -2
- package/dist/lib/testing/storyboard/runner.js +4 -4
- package/dist/lib/testing/storyboard/runner.mjs +4 -4
- package/dist/lib/testing/storyboard/task-map.js +4 -1
- package/dist/lib/testing/storyboard/task-map.mjs +4 -1
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/utils/adcp-error-response.d.mts +196 -0
- package/dist/lib/utils/adcp-error-response.d.ts +196 -0
- package/dist/lib/utils/adcp-error-response.js +118 -0
- package/dist/lib/utils/adcp-error-response.mjs +95 -0
- package/dist/lib/utils/buyer-retry-policy.js +2 -2
- package/dist/lib/utils/buyer-retry-policy.mjs +1 -1
- package/dist/lib/utils/capabilities.d.mts +6 -0
- package/dist/lib/utils/capabilities.d.ts +6 -0
- package/dist/lib/utils/capabilities.js +6 -2
- package/dist/lib/utils/capabilities.mjs +6 -2
- package/dist/lib/utils/envelope-allowlist.d.mts +105 -0
- package/dist/lib/utils/envelope-allowlist.d.ts +105 -0
- package/dist/lib/utils/envelope-allowlist.js +98 -0
- package/dist/lib/utils/envelope-allowlist.mjs +71 -0
- package/dist/lib/utils/pick-safe-details.d.mts +89 -0
- package/dist/lib/utils/pick-safe-details.d.ts +89 -0
- package/dist/lib/utils/pick-safe-details.js +80 -0
- package/dist/lib/utils/pick-safe-details.mjs +56 -0
- package/dist/lib/v2/projection/augment-response.d.mts +4 -0
- package/dist/lib/v2/projection/augment-response.d.ts +4 -0
- package/dist/lib/v2/projection/creative-delivery.d.mts +20 -3
- package/dist/lib/v2/projection/creative-delivery.d.ts +20 -3
- package/dist/lib/v2/projection/creative-delivery.js +20 -4
- package/dist/lib/v2/projection/creative-delivery.mjs +19 -4
- package/dist/lib/v2/projection/index.d.mts +2 -2
- package/dist/lib/v2/projection/index.d.ts +2 -2
- package/dist/lib/v2/projection/index.js +4 -0
- package/dist/lib/v2/projection/index.mjs +5 -1
- package/dist/lib/v2/projection/legacy-metadata.d.mts +7 -0
- package/dist/lib/v2/projection/legacy-metadata.d.ts +7 -0
- package/dist/lib/v2/projection/legacy-metadata.js +14 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs +12 -0
- package/dist/lib/v2/projection/legacy-routes.d.mts +11 -0
- package/dist/lib/v2/projection/legacy-routes.d.ts +11 -0
- package/dist/lib/v2/projection/legacy-routes.js +2 -1
- package/dist/lib/v2/projection/legacy-routes.mjs +7 -2
- package/dist/lib/v2/projection/v1-to-v2.d.mts +21 -1
- package/dist/lib/v2/projection/v1-to-v2.d.ts +21 -1
- package/dist/lib/v2/projection/v1-to-v2.js +18 -11
- package/dist/lib/v2/projection/v1-to-v2.mjs +19 -11
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/CREATIVE-DELIVERY.md +12 -0
- package/docs/guides/REPORTING-LEDGER.md +121 -0
- package/docs/guides/VALIDATE-YOUR-AGENT.md +1 -0
- package/docs/llms.txt +2 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-16-to-17.md +149 -0
- package/docs/migration-reporting-storage-package.md +10 -0
- package/package.json +106 -1
|
@@ -1,183 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { lookup as nativeDnsLookup } from "node:dns";
|
|
3
|
-
import { isIPv6 } from "node:net";
|
|
4
|
-
import { isAlwaysBlocked, isLoopbackIp, isPrivateIp } from "../net/address-guards.mjs";
|
|
5
|
-
import { enforceSsrfPolicy, enforceSsrfPolicyResolved } from "../substitution/observer/ssrf.mjs";
|
|
6
|
-
const WEBHOOK_SSRF_POLICY = Object.freeze({
|
|
7
|
-
schemes_allowed: Object.freeze(["https"]),
|
|
8
|
-
schemes_denied: Object.freeze(["http", "file", "gopher", "ftp", "ftps", "data", "javascript", "about", "ws", "wss"]),
|
|
9
|
-
hosts_denied_ipv4_cidrs: Object.freeze([
|
|
10
|
-
"0.0.0.0/8",
|
|
11
|
-
"10.0.0.0/8",
|
|
12
|
-
"100.64.0.0/10",
|
|
13
|
-
"127.0.0.0/8",
|
|
14
|
-
"169.254.0.0/16",
|
|
15
|
-
"172.16.0.0/12",
|
|
16
|
-
"192.0.0.0/24",
|
|
17
|
-
"192.168.0.0/16",
|
|
18
|
-
"224.0.0.0/4",
|
|
19
|
-
"240.0.0.0/4"
|
|
20
|
-
]),
|
|
21
|
-
hosts_denied_ipv6_cidrs: Object.freeze([
|
|
22
|
-
"::1/128",
|
|
23
|
-
"::/128",
|
|
24
|
-
"::ffff:0:0/96",
|
|
25
|
-
"64:ff9b::/96",
|
|
26
|
-
"fc00::/7",
|
|
27
|
-
"fe80::/10",
|
|
28
|
-
"ff00::/8"
|
|
29
|
-
]),
|
|
30
|
-
hosts_denied_metadata: Object.freeze([
|
|
31
|
-
"metadata.google.internal",
|
|
32
|
-
"metadata",
|
|
33
|
-
"metadata.packet.net",
|
|
34
|
-
"fd00:ec2::254"
|
|
35
|
-
]),
|
|
36
|
-
host_literal_policy: "allow",
|
|
37
|
-
shared_private_address_policy: "deny"
|
|
38
|
-
});
|
|
39
|
-
const LOOPBACK_OK_WEBHOOK_SSRF_POLICY = Object.freeze({
|
|
40
|
-
schemes_allowed: Object.freeze(["http", "https"]),
|
|
41
|
-
schemes_denied: Object.freeze(["file", "gopher", "ftp", "ftps", "data", "javascript", "about", "ws", "wss"]),
|
|
42
|
-
hosts_denied_ipv4_cidrs: Object.freeze([
|
|
43
|
-
"0.0.0.0/8",
|
|
44
|
-
"10.0.0.0/8",
|
|
45
|
-
"100.64.0.0/10",
|
|
46
|
-
// 127.0.0.0/8 omitted — loopback allowed for tests.
|
|
47
|
-
"169.254.0.0/16",
|
|
48
|
-
"172.16.0.0/12",
|
|
49
|
-
"192.0.0.0/24",
|
|
50
|
-
"192.168.0.0/16",
|
|
51
|
-
"224.0.0.0/4",
|
|
52
|
-
"240.0.0.0/4"
|
|
53
|
-
]),
|
|
54
|
-
hosts_denied_ipv6_cidrs: Object.freeze([
|
|
55
|
-
// ::1/128 and ::/128 omitted — IPv6 loopback allowed for tests.
|
|
56
|
-
"::ffff:0:0/96",
|
|
57
|
-
"64:ff9b::/96",
|
|
58
|
-
"fc00::/7",
|
|
59
|
-
"fe80::/10",
|
|
60
|
-
"ff00::/8"
|
|
61
|
-
]),
|
|
62
|
-
hosts_denied_metadata: Object.freeze([
|
|
63
|
-
"metadata.google.internal",
|
|
64
|
-
"metadata",
|
|
65
|
-
"metadata.packet.net",
|
|
66
|
-
"fd00:ec2::254"
|
|
67
|
-
]),
|
|
68
|
-
host_literal_policy: "allow",
|
|
69
|
-
shared_private_address_policy: "allow_loopback"
|
|
70
|
-
});
|
|
71
|
-
const DEFAULT_LOOKUP_ALL = (hostname, options, callback) => {
|
|
72
|
-
nativeDnsLookup(hostname, { ...options, all: true }, (err, addresses) => {
|
|
73
|
-
callback(err, addresses);
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
function createPinAndBindFetch(options = {}) {
|
|
77
|
-
const policy = options.policy ?? WEBHOOK_SSRF_POLICY;
|
|
78
|
-
const lookupImpl = options.lookup ?? DEFAULT_LOOKUP_ALL;
|
|
79
|
-
const guardedLookup = (hostname, opts, callback) => {
|
|
80
|
-
const wantsAll = opts?.all === true;
|
|
81
|
-
lookupImpl(hostname, { ...opts ?? {}, all: true }, (err, addresses) => {
|
|
82
|
-
if (err) {
|
|
83
|
-
callback(err);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (!Array.isArray(addresses) || addresses.length === 0) {
|
|
87
|
-
callback(
|
|
88
|
-
makeSsrfError(`DNS resolution returned no addresses for ${hostname}`, "dns_revalidation:no_addresses")
|
|
89
|
-
);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const url = new URL(`https://${bracketIfV6(hostname)}`);
|
|
93
|
-
const ips = addresses.map((a) => a.address);
|
|
94
|
-
if (ips.some(isAlwaysBlocked)) {
|
|
95
|
-
callback(makeSsrfError(`Host ${hostname} resolves to an always-blocked address`, "always_blocked_address"));
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const result = enforceSsrfPolicyResolved(url, ips, policy);
|
|
99
|
-
if (!result.allowed) {
|
|
100
|
-
callback(makeSsrfError(`Host ${hostname} resolves to an address denied by SSRF policy`, result.rule ?? "ssrf"));
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (ips.some((ip) => isSharedPrivateAddressDenied(ip, policy))) {
|
|
104
|
-
callback(
|
|
105
|
-
makeSsrfError(
|
|
106
|
-
`Host ${hostname} resolves to a private, non-routable, or reserved address`,
|
|
107
|
-
"shared_private_address"
|
|
108
|
-
)
|
|
109
|
-
);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
if (wantsAll) {
|
|
113
|
-
callback(null, addresses);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
const first = addresses[0];
|
|
117
|
-
callback(null, first.address, first.family);
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
const dispatcher = new Agent({
|
|
121
|
-
...options.agentOptions ?? {},
|
|
122
|
-
connect: {
|
|
123
|
-
...options.agentOptions?.connect ?? {},
|
|
124
|
-
// undici's connect type accepts a lookup with the dns.lookup signature.
|
|
125
|
-
lookup: guardedLookup
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
const wrapped = async (input, init) => {
|
|
129
|
-
const url = resolveRequestUrl(input);
|
|
130
|
-
if (!url) {
|
|
131
|
-
throw makeSsrfError("Unsupported or invalid URL input", "invalid_url");
|
|
132
|
-
}
|
|
133
|
-
const hostname = url.hostname.replace(/^\[|\]$/g, "");
|
|
134
|
-
if (isAlwaysBlocked(hostname)) {
|
|
135
|
-
throw makeSsrfError(`Host ${hostname} is an always-blocked address`, "always_blocked_address");
|
|
136
|
-
}
|
|
137
|
-
const sync = enforceSsrfPolicy(url, policy);
|
|
138
|
-
if (!sync.allowed) {
|
|
139
|
-
throw makeSsrfError(sync.message ?? "SSRF policy denied URL", sync.rule ?? "ssrf");
|
|
140
|
-
}
|
|
141
|
-
if (isSharedPrivateAddressDenied(hostname, policy)) {
|
|
142
|
-
throw makeSsrfError(`Host ${hostname} is a private, non-routable, or reserved address`, "shared_private_address");
|
|
143
|
-
}
|
|
144
|
-
const redirect = init?.redirect === "error" ? "error" : "manual";
|
|
145
|
-
const runtimeInput = input;
|
|
146
|
-
const checkedInput = runtimeInput instanceof globalThis.Request || runtimeInput instanceof UndiciRequest ? new UndiciRequest(url.href, runtimeInput) : url.href;
|
|
147
|
-
return undiciFetch(checkedInput, {
|
|
148
|
-
...init,
|
|
149
|
-
redirect,
|
|
150
|
-
dispatcher
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
return wrapped;
|
|
154
|
-
}
|
|
155
|
-
function isSharedPrivateAddressDenied(address, policy) {
|
|
156
|
-
if (!isPrivateIp(address)) return false;
|
|
157
|
-
if (policy.shared_private_address_policy === "deny") return true;
|
|
158
|
-
if (policy.shared_private_address_policy === "allow_loopback") return !isLoopbackIp(address);
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
function resolveRequestUrl(input) {
|
|
162
|
-
try {
|
|
163
|
-
if (typeof input === "string") return new URL(input);
|
|
164
|
-
if (input instanceof URL) return new URL(input.href);
|
|
165
|
-
if (input instanceof globalThis.Request || input instanceof UndiciRequest) return new URL(input.url);
|
|
166
|
-
} catch {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
function bracketIfV6(host) {
|
|
172
|
-
return isIPv6(host) ? `[${host}]` : host;
|
|
173
|
-
}
|
|
174
|
-
function makeSsrfError(message, rule) {
|
|
175
|
-
const err = new Error(`pin-and-bind: ${rule}: ${message}`);
|
|
176
|
-
err.code = "EADCP_SSRF_BLOCKED";
|
|
177
|
-
return err;
|
|
178
|
-
}
|
|
179
|
-
export {
|
|
180
|
-
LOOPBACK_OK_WEBHOOK_SSRF_POLICY,
|
|
181
|
-
WEBHOOK_SSRF_POLICY,
|
|
182
|
-
createPinAndBindFetch
|
|
183
|
-
};
|
|
1
|
+
export * from "../net/pin-and-bind-fetch.mjs";
|
|
@@ -1,123 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Inventory list targeting helpers for AdCP sellers.
|
|
3
|
-
*
|
|
4
|
-
* AdCP 3.0 carries property and collection targeting as references to
|
|
5
|
-
* externally-managed lists (`PropertyListReference`, `CollectionListReference`).
|
|
6
|
-
* The seller resolves those references at serve time and filters its own
|
|
7
|
-
* inventory against the resolved contents.
|
|
8
|
-
*
|
|
9
|
-
* These helpers let a seller handler do that in one line:
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import { resolvePropertyList, matchesPropertyList } from '@adcp/sdk/server';
|
|
14
|
-
*
|
|
15
|
-
* if (targeting.property_list) {
|
|
16
|
-
* const list = await resolvePropertyList(targeting.property_list);
|
|
17
|
-
* inventory = inventory.filter(p => matchesPropertyList(p.identifier, list));
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* Resolution goes through MCP (`get_property_list` / `get_collection_list`) on
|
|
22
|
-
* the referenced agent — the same contract a buyer agent uses to fetch the list.
|
|
23
|
-
* Matching follows the identifier and distribution-id semantics defined by the
|
|
24
|
-
* AdCP property and collection specs.
|
|
25
|
-
*/
|
|
26
|
-
import type { PropertyListReference, CollectionListReference, GetCollectionListResponse, Identifier } from '../types/tools.generated.mjs';
|
|
27
|
-
export interface ResolvedPropertyList {
|
|
28
|
-
listId: string;
|
|
29
|
-
agentUrl: string;
|
|
30
|
-
identifiers: Identifier[];
|
|
31
|
-
cacheValidUntil?: string;
|
|
32
|
-
}
|
|
33
|
-
/** A collection entry as returned by get_collection_list. */
|
|
34
|
-
export type ResolvedCollection = NonNullable<GetCollectionListResponse['collections']>[number];
|
|
35
|
-
export interface ResolvedCollectionList {
|
|
36
|
-
listId: string;
|
|
37
|
-
agentUrl: string;
|
|
38
|
-
collections: ResolvedCollection[];
|
|
39
|
-
cacheValidUntil?: string;
|
|
40
|
-
}
|
|
41
|
-
export type ResolvedListKind = 'property' | 'collection';
|
|
42
|
-
export type ResolvedListCacheValue = ResolvedPropertyList | ResolvedCollectionList;
|
|
43
|
-
export declare const DEFAULT_RESOLVE_LIST_PAGE_SIZE = 1000;
|
|
44
|
-
export interface ResolvedListCacheEntry<TValue extends ResolvedListCacheValue = ResolvedListCacheValue> {
|
|
45
|
-
value: TValue;
|
|
46
|
-
expiresAtMs: number;
|
|
47
|
-
}
|
|
48
|
-
export interface ResolvedListCache {
|
|
49
|
-
get<TValue extends ResolvedListCacheValue>(key: string, nowMs?: number): TValue | undefined;
|
|
50
|
-
set<TValue extends ResolvedListCacheValue>(key: string, entry: ResolvedListCacheEntry<TValue>): void;
|
|
51
|
-
delete(key: string): boolean;
|
|
52
|
-
clear(): void;
|
|
53
|
-
}
|
|
54
|
-
export declare function createResolvedListCache(): ResolvedListCache;
|
|
55
|
-
export declare const defaultResolvedListCache: ResolvedListCache;
|
|
56
|
-
export declare function clearDefaultResolvedListCache(): void;
|
|
57
|
-
export type ResolveListCallTool = (agentUrl: string, toolName: 'get_property_list' | 'get_collection_list', args: Record<string, unknown>, authToken?: string) => Promise<unknown>;
|
|
58
|
-
export interface ResolveListOptions {
|
|
59
|
-
/** Require schema-valid list pages with resolved items. Used for certification. */
|
|
60
|
-
strictResponseValidation?: boolean;
|
|
61
|
-
/** Maximum page size when calling get_property_list / get_collection_list. Defaults to 1000. */
|
|
62
|
-
pageSize?: number;
|
|
63
|
-
/** Maximum number of pages to walk before treating pagination as unsafe. Defaults to 100. */
|
|
64
|
-
maxPages?: number;
|
|
65
|
-
/** Cache for resolved list contents. Defaults to the process-local SDK cache. Pass false to disable caching. */
|
|
66
|
-
cache?: ResolvedListCache | false;
|
|
67
|
-
/**
|
|
68
|
-
* Tenant/principal/auth-context fingerprint for cache scoping when the list
|
|
69
|
-
* reference does not carry an auth_token. Shared caching is disabled without
|
|
70
|
-
* either auth_token or this explicit scope.
|
|
71
|
-
*/
|
|
72
|
-
cacheScopeKey?: string;
|
|
73
|
-
/** Clock hook for testing cache expiry. */
|
|
74
|
-
now?: () => Date | number;
|
|
75
|
-
/** MCP call hook for testing/custom transports. */
|
|
76
|
-
callTool?: ResolveListCallTool;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Resolve a PropertyListReference to the concrete identifiers it contains.
|
|
80
|
-
*
|
|
81
|
-
* Calls `get_property_list` on the referenced agent with `resolve: true`.
|
|
82
|
-
* Honors `auth_token` on the reference if present.
|
|
83
|
-
*/
|
|
84
|
-
export declare function resolvePropertyList(ref: PropertyListReference, options?: ResolveListOptions): Promise<ResolvedPropertyList>;
|
|
85
|
-
/**
|
|
86
|
-
* Resolve a CollectionListReference to the concrete collections it contains.
|
|
87
|
-
*
|
|
88
|
-
* Calls `get_collection_list` on the referenced agent with `resolve: true`.
|
|
89
|
-
* Honors `auth_token` on the reference if present.
|
|
90
|
-
*/
|
|
91
|
-
export declare function resolveCollectionList(ref: CollectionListReference, options?: ResolveListOptions): Promise<ResolvedCollectionList>;
|
|
92
|
-
export declare function resolvedListCacheKey(kind: ResolvedListKind, ref: Pick<PropertyListReference | CollectionListReference, 'agent_url' | 'list_id' | 'auth_token'>, options?: Pick<ResolveListOptions, 'pageSize' | 'cacheScopeKey'>): string | undefined;
|
|
93
|
-
/**
|
|
94
|
-
* Return true if `property` matches any identifier in the resolved list.
|
|
95
|
-
*
|
|
96
|
-
* Domain matching rules (from the AdCP property spec):
|
|
97
|
-
* - Exact match on the identifier value is always accepted.
|
|
98
|
-
* - A `domain` entry of `example.com` also matches `www.example.com` and
|
|
99
|
-
* `m.example.com` — the two canonical aliases for a base domain.
|
|
100
|
-
* - A `domain` entry of `*.example.com` matches every subdomain but NOT the
|
|
101
|
-
* base domain itself.
|
|
102
|
-
* - Non-domain identifier types (ios_bundle, network_id, etc.) use exact
|
|
103
|
-
* string match on both `type` and `value`.
|
|
104
|
-
*/
|
|
105
|
-
export declare function matchesPropertyList(property: Identifier, list: ResolvedPropertyList): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Return true if `collection` matches any entry in the resolved list.
|
|
108
|
-
*
|
|
109
|
-
* Matching modes:
|
|
110
|
-
* - Collections match when `collection_rid` is set on both sides and equal.
|
|
111
|
-
* - Otherwise, they match when they share at least one `distribution_ids`
|
|
112
|
-
* entry with the same `type` and `value`.
|
|
113
|
-
*
|
|
114
|
-
* A collection with no collection_rid and no distribution_ids cannot match —
|
|
115
|
-
* the seller has nothing to match against.
|
|
116
|
-
*/
|
|
117
|
-
export declare function matchesCollectionList(collection: {
|
|
118
|
-
collection_rid?: string;
|
|
119
|
-
distribution_ids?: {
|
|
120
|
-
type: string;
|
|
121
|
-
value: string;
|
|
122
|
-
}[];
|
|
123
|
-
}, list: ResolvedCollectionList): boolean;
|
|
1
|
+
export * from '../core/targeting-helpers.mjs';
|
|
@@ -1,123 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Inventory list targeting helpers for AdCP sellers.
|
|
3
|
-
*
|
|
4
|
-
* AdCP 3.0 carries property and collection targeting as references to
|
|
5
|
-
* externally-managed lists (`PropertyListReference`, `CollectionListReference`).
|
|
6
|
-
* The seller resolves those references at serve time and filters its own
|
|
7
|
-
* inventory against the resolved contents.
|
|
8
|
-
*
|
|
9
|
-
* These helpers let a seller handler do that in one line:
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import { resolvePropertyList, matchesPropertyList } from '@adcp/sdk/server';
|
|
14
|
-
*
|
|
15
|
-
* if (targeting.property_list) {
|
|
16
|
-
* const list = await resolvePropertyList(targeting.property_list);
|
|
17
|
-
* inventory = inventory.filter(p => matchesPropertyList(p.identifier, list));
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* Resolution goes through MCP (`get_property_list` / `get_collection_list`) on
|
|
22
|
-
* the referenced agent — the same contract a buyer agent uses to fetch the list.
|
|
23
|
-
* Matching follows the identifier and distribution-id semantics defined by the
|
|
24
|
-
* AdCP property and collection specs.
|
|
25
|
-
*/
|
|
26
|
-
import type { PropertyListReference, CollectionListReference, GetCollectionListResponse, Identifier } from '../types/tools.generated';
|
|
27
|
-
export interface ResolvedPropertyList {
|
|
28
|
-
listId: string;
|
|
29
|
-
agentUrl: string;
|
|
30
|
-
identifiers: Identifier[];
|
|
31
|
-
cacheValidUntil?: string;
|
|
32
|
-
}
|
|
33
|
-
/** A collection entry as returned by get_collection_list. */
|
|
34
|
-
export type ResolvedCollection = NonNullable<GetCollectionListResponse['collections']>[number];
|
|
35
|
-
export interface ResolvedCollectionList {
|
|
36
|
-
listId: string;
|
|
37
|
-
agentUrl: string;
|
|
38
|
-
collections: ResolvedCollection[];
|
|
39
|
-
cacheValidUntil?: string;
|
|
40
|
-
}
|
|
41
|
-
export type ResolvedListKind = 'property' | 'collection';
|
|
42
|
-
export type ResolvedListCacheValue = ResolvedPropertyList | ResolvedCollectionList;
|
|
43
|
-
export declare const DEFAULT_RESOLVE_LIST_PAGE_SIZE = 1000;
|
|
44
|
-
export interface ResolvedListCacheEntry<TValue extends ResolvedListCacheValue = ResolvedListCacheValue> {
|
|
45
|
-
value: TValue;
|
|
46
|
-
expiresAtMs: number;
|
|
47
|
-
}
|
|
48
|
-
export interface ResolvedListCache {
|
|
49
|
-
get<TValue extends ResolvedListCacheValue>(key: string, nowMs?: number): TValue | undefined;
|
|
50
|
-
set<TValue extends ResolvedListCacheValue>(key: string, entry: ResolvedListCacheEntry<TValue>): void;
|
|
51
|
-
delete(key: string): boolean;
|
|
52
|
-
clear(): void;
|
|
53
|
-
}
|
|
54
|
-
export declare function createResolvedListCache(): ResolvedListCache;
|
|
55
|
-
export declare const defaultResolvedListCache: ResolvedListCache;
|
|
56
|
-
export declare function clearDefaultResolvedListCache(): void;
|
|
57
|
-
export type ResolveListCallTool = (agentUrl: string, toolName: 'get_property_list' | 'get_collection_list', args: Record<string, unknown>, authToken?: string) => Promise<unknown>;
|
|
58
|
-
export interface ResolveListOptions {
|
|
59
|
-
/** Require schema-valid list pages with resolved items. Used for certification. */
|
|
60
|
-
strictResponseValidation?: boolean;
|
|
61
|
-
/** Maximum page size when calling get_property_list / get_collection_list. Defaults to 1000. */
|
|
62
|
-
pageSize?: number;
|
|
63
|
-
/** Maximum number of pages to walk before treating pagination as unsafe. Defaults to 100. */
|
|
64
|
-
maxPages?: number;
|
|
65
|
-
/** Cache for resolved list contents. Defaults to the process-local SDK cache. Pass false to disable caching. */
|
|
66
|
-
cache?: ResolvedListCache | false;
|
|
67
|
-
/**
|
|
68
|
-
* Tenant/principal/auth-context fingerprint for cache scoping when the list
|
|
69
|
-
* reference does not carry an auth_token. Shared caching is disabled without
|
|
70
|
-
* either auth_token or this explicit scope.
|
|
71
|
-
*/
|
|
72
|
-
cacheScopeKey?: string;
|
|
73
|
-
/** Clock hook for testing cache expiry. */
|
|
74
|
-
now?: () => Date | number;
|
|
75
|
-
/** MCP call hook for testing/custom transports. */
|
|
76
|
-
callTool?: ResolveListCallTool;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Resolve a PropertyListReference to the concrete identifiers it contains.
|
|
80
|
-
*
|
|
81
|
-
* Calls `get_property_list` on the referenced agent with `resolve: true`.
|
|
82
|
-
* Honors `auth_token` on the reference if present.
|
|
83
|
-
*/
|
|
84
|
-
export declare function resolvePropertyList(ref: PropertyListReference, options?: ResolveListOptions): Promise<ResolvedPropertyList>;
|
|
85
|
-
/**
|
|
86
|
-
* Resolve a CollectionListReference to the concrete collections it contains.
|
|
87
|
-
*
|
|
88
|
-
* Calls `get_collection_list` on the referenced agent with `resolve: true`.
|
|
89
|
-
* Honors `auth_token` on the reference if present.
|
|
90
|
-
*/
|
|
91
|
-
export declare function resolveCollectionList(ref: CollectionListReference, options?: ResolveListOptions): Promise<ResolvedCollectionList>;
|
|
92
|
-
export declare function resolvedListCacheKey(kind: ResolvedListKind, ref: Pick<PropertyListReference | CollectionListReference, 'agent_url' | 'list_id' | 'auth_token'>, options?: Pick<ResolveListOptions, 'pageSize' | 'cacheScopeKey'>): string | undefined;
|
|
93
|
-
/**
|
|
94
|
-
* Return true if `property` matches any identifier in the resolved list.
|
|
95
|
-
*
|
|
96
|
-
* Domain matching rules (from the AdCP property spec):
|
|
97
|
-
* - Exact match on the identifier value is always accepted.
|
|
98
|
-
* - A `domain` entry of `example.com` also matches `www.example.com` and
|
|
99
|
-
* `m.example.com` — the two canonical aliases for a base domain.
|
|
100
|
-
* - A `domain` entry of `*.example.com` matches every subdomain but NOT the
|
|
101
|
-
* base domain itself.
|
|
102
|
-
* - Non-domain identifier types (ios_bundle, network_id, etc.) use exact
|
|
103
|
-
* string match on both `type` and `value`.
|
|
104
|
-
*/
|
|
105
|
-
export declare function matchesPropertyList(property: Identifier, list: ResolvedPropertyList): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Return true if `collection` matches any entry in the resolved list.
|
|
108
|
-
*
|
|
109
|
-
* Matching modes:
|
|
110
|
-
* - Collections match when `collection_rid` is set on both sides and equal.
|
|
111
|
-
* - Otherwise, they match when they share at least one `distribution_ids`
|
|
112
|
-
* entry with the same `type` and `value`.
|
|
113
|
-
*
|
|
114
|
-
* A collection with no collection_rid and no distribution_ids cannot match —
|
|
115
|
-
* the seller has nothing to match against.
|
|
116
|
-
*/
|
|
117
|
-
export declare function matchesCollectionList(collection: {
|
|
118
|
-
collection_rid?: string;
|
|
119
|
-
distribution_ids?: {
|
|
120
|
-
type: string;
|
|
121
|
-
value: string;
|
|
122
|
-
}[];
|
|
123
|
-
}, list: ResolvedCollectionList): boolean;
|
|
1
|
+
export * from '../core/targeting-helpers';
|