@adcp/sdk 15.9.0 → 16.0.0-beta.1

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.
Files changed (295) hide show
  1. package/bin/adcp-identity.js +74 -0
  2. package/bin/adcp.js +2 -0
  3. package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
  4. package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
  5. package/dist/lib/adapters/keyed-account-backend.js +121 -0
  6. package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
  7. package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
  8. package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
  9. package/dist/lib/adapters/keyed-account-store.js +227 -0
  10. package/dist/lib/adapters/keyed-account-store.mjs +203 -0
  11. package/dist/lib/core/SingleAgentClient.d.mts +16 -2
  12. package/dist/lib/core/SingleAgentClient.d.ts +16 -2
  13. package/dist/lib/core/SingleAgentClient.js +259 -62
  14. package/dist/lib/core/SingleAgentClient.mjs +261 -57
  15. package/dist/lib/core/TaskExecutor.d.mts +6 -0
  16. package/dist/lib/core/TaskExecutor.d.ts +6 -0
  17. package/dist/lib/core/TaskExecutor.js +66 -5
  18. package/dist/lib/core/TaskExecutor.mjs +71 -5
  19. package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
  20. package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
  21. package/dist/lib/core/redis-webhook-registration-store.js +23 -1
  22. package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
  23. package/dist/lib/core/webhook-registration.d.mts +7 -1
  24. package/dist/lib/core/webhook-registration.d.ts +7 -1
  25. package/dist/lib/core/webhook-registration.js +24 -2
  26. package/dist/lib/core/webhook-registration.mjs +23 -2
  27. package/dist/lib/identity-3.3/index.d.mts +10 -0
  28. package/dist/lib/identity-3.3/index.d.ts +10 -0
  29. package/dist/lib/identity-3.3/index.js +75 -0
  30. package/dist/lib/identity-3.3/index.mjs +46 -0
  31. package/dist/lib/identity-3.3/lifecycle.d.mts +113 -0
  32. package/dist/lib/identity-3.3/lifecycle.d.ts +113 -0
  33. package/dist/lib/identity-3.3/lifecycle.js +267 -0
  34. package/dist/lib/identity-3.3/lifecycle.mjs +240 -0
  35. package/dist/lib/identity-3.3/revocation.d.mts +50 -0
  36. package/dist/lib/identity-3.3/revocation.d.ts +50 -0
  37. package/dist/lib/identity-3.3/revocation.js +238 -0
  38. package/dist/lib/identity-3.3/revocation.mjs +216 -0
  39. package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
  40. package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
  41. package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
  42. package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
  43. package/dist/lib/identity-3.3/server.d.mts +34 -0
  44. package/dist/lib/identity-3.3/server.d.ts +34 -0
  45. package/dist/lib/identity-3.3/server.js +219 -0
  46. package/dist/lib/identity-3.3/server.mjs +194 -0
  47. package/dist/lib/identity-3.3/store.d.mts +24 -0
  48. package/dist/lib/identity-3.3/store.d.ts +24 -0
  49. package/dist/lib/identity-3.3/store.js +191 -0
  50. package/dist/lib/identity-3.3/store.mjs +169 -0
  51. package/dist/lib/identity-3.3/trust.d.mts +94 -0
  52. package/dist/lib/identity-3.3/trust.d.ts +94 -0
  53. package/dist/lib/identity-3.3/trust.js +278 -0
  54. package/dist/lib/identity-3.3/trust.mjs +239 -0
  55. package/dist/lib/identity-3.3/types.d.mts +127 -0
  56. package/dist/lib/identity-3.3/types.d.ts +127 -0
  57. package/dist/lib/identity-3.3/types.js +16 -0
  58. package/dist/lib/identity-3.3/types.mjs +0 -0
  59. package/dist/lib/identity-3.3/validation.d.mts +2 -0
  60. package/dist/lib/identity-3.3/validation.d.ts +2 -0
  61. package/dist/lib/identity-3.3/validation.js +125 -0
  62. package/dist/lib/identity-3.3/validation.mjs +91 -0
  63. package/dist/lib/index.d.mts +1 -1
  64. package/dist/lib/index.d.ts +1 -1
  65. package/dist/lib/reporting/azure/index.d.mts +5 -0
  66. package/dist/lib/reporting/azure/index.d.ts +5 -0
  67. package/dist/lib/reporting/azure/index.js +26 -7
  68. package/dist/lib/reporting/azure/index.mjs +26 -7
  69. package/dist/lib/reporting/bigquery/index.d.mts +80 -25
  70. package/dist/lib/reporting/bigquery/index.d.ts +80 -25
  71. package/dist/lib/reporting/bigquery/index.js +184 -81
  72. package/dist/lib/reporting/bigquery/index.mjs +182 -80
  73. package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
  74. package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
  75. package/dist/lib/reporting/gcs/errors.d.mts +6 -0
  76. package/dist/lib/reporting/gcs/errors.d.ts +6 -0
  77. package/dist/lib/reporting/gcs/fence.d.mts +5 -0
  78. package/dist/lib/reporting/gcs/fence.d.ts +5 -0
  79. package/dist/lib/reporting/gcs/index.d.mts +9 -0
  80. package/dist/lib/reporting/gcs/index.d.ts +9 -0
  81. package/dist/lib/reporting/gcs/reader.d.mts +27 -3
  82. package/dist/lib/reporting/gcs/reader.d.ts +27 -3
  83. package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
  84. package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
  85. package/dist/lib/reporting/gcs/row-provider.js +34 -14
  86. package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
  87. package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
  88. package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
  89. package/dist/lib/reporting/ledger/index.d.mts +11 -0
  90. package/dist/lib/reporting/ledger/index.d.ts +11 -0
  91. package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
  92. package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
  93. package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
  94. package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
  95. package/dist/lib/reporting/ledger/managed.d.mts +86 -6
  96. package/dist/lib/reporting/ledger/managed.d.ts +86 -6
  97. package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
  98. package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
  99. package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
  100. package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
  101. package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
  102. package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
  103. package/dist/lib/reporting/ledger/postgres.js +43 -27
  104. package/dist/lib/reporting/ledger/postgres.mjs +43 -27
  105. package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
  106. package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
  107. package/dist/lib/reporting/ledger/row-encoding.js +8 -4
  108. package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
  109. package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
  110. package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
  111. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
  112. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
  113. package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
  114. package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
  115. package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
  116. package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
  117. package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
  118. package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
  119. package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
  120. package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
  121. package/dist/lib/reporting/ledger/row-storage.js +126 -66
  122. package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
  123. package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
  124. package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
  125. package/dist/lib/reporting/ledger/schedule.js +24 -0
  126. package/dist/lib/reporting/ledger/schedule.mjs +23 -0
  127. package/dist/lib/reporting/ledger/types.d.mts +23 -1
  128. package/dist/lib/reporting/ledger/types.d.ts +23 -1
  129. package/dist/lib/reporting/s3/index.d.mts +5 -0
  130. package/dist/lib/reporting/s3/index.d.ts +5 -0
  131. package/dist/lib/reporting/s3/index.js +37 -14
  132. package/dist/lib/reporting/s3/index.mjs +37 -14
  133. package/dist/lib/reporting/service/index.d.mts +10 -0
  134. package/dist/lib/reporting/service/index.d.ts +10 -0
  135. package/dist/lib/reporting/service/maintenance.d.mts +28 -2
  136. package/dist/lib/reporting/service/maintenance.d.ts +28 -2
  137. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  138. package/dist/lib/server/account-sync-contract.d.mts +14 -0
  139. package/dist/lib/server/account-sync-contract.d.ts +14 -0
  140. package/dist/lib/server/account-sync-contract.js +225 -0
  141. package/dist/lib/server/account-sync-contract.mjs +197 -0
  142. package/dist/lib/server/adcp-server.js +5 -0
  143. package/dist/lib/server/adcp-server.mjs +10 -0
  144. package/dist/lib/server/auth-signature.d.mts +10 -0
  145. package/dist/lib/server/auth-signature.d.ts +10 -0
  146. package/dist/lib/server/auth-signature.js +61 -2
  147. package/dist/lib/server/auth-signature.mjs +65 -2
  148. package/dist/lib/server/auth.d.mts +6 -0
  149. package/dist/lib/server/auth.d.ts +6 -0
  150. package/dist/lib/server/auth.js +6 -0
  151. package/dist/lib/server/auth.mjs +6 -0
  152. package/dist/lib/server/create-adcp-server.d.mts +19 -5
  153. package/dist/lib/server/create-adcp-server.d.ts +19 -5
  154. package/dist/lib/server/create-adcp-server.js +238 -19
  155. package/dist/lib/server/create-adcp-server.mjs +240 -10
  156. package/dist/lib/server/decisioning/account.d.mts +24 -1
  157. package/dist/lib/server/decisioning/account.d.ts +24 -1
  158. package/dist/lib/server/decisioning/index.d.mts +1 -1
  159. package/dist/lib/server/decisioning/index.d.ts +1 -1
  160. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
  161. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
  162. package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
  163. package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
  164. package/dist/lib/server/index.d.mts +2 -0
  165. package/dist/lib/server/index.d.ts +2 -0
  166. package/dist/lib/server/index.js +12 -0
  167. package/dist/lib/server/index.mjs +12 -0
  168. package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
  169. package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
  170. package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
  171. package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
  172. package/dist/lib/server/principal/types.d.mts +1 -1
  173. package/dist/lib/server/principal/types.d.ts +1 -1
  174. package/dist/lib/server/serve.js +5 -0
  175. package/dist/lib/server/serve.mjs +5 -0
  176. package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
  177. package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
  178. package/dist/lib/server/webhook-delivery/recovery.js +4 -0
  179. package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
  180. package/dist/lib/server/webhook-emitter.d.mts +10 -0
  181. package/dist/lib/server/webhook-emitter.d.ts +10 -0
  182. package/dist/lib/server/webhook-emitter.js +22 -0
  183. package/dist/lib/server/webhook-emitter.mjs +22 -0
  184. package/dist/lib/signing/agent-context.d.mts +0 -5
  185. package/dist/lib/signing/agent-context.d.ts +0 -5
  186. package/dist/lib/signing/agent-context.js +9 -1
  187. package/dist/lib/signing/agent-context.mjs +9 -1
  188. package/dist/lib/signing/agent-fetch.js +27 -2
  189. package/dist/lib/signing/agent-fetch.mjs +32 -2
  190. package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
  191. package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
  192. package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
  193. package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
  194. package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
  195. package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
  196. package/dist/lib/signing/agent-resolver/index.js +5 -0
  197. package/dist/lib/signing/agent-resolver/index.mjs +3 -0
  198. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
  199. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
  200. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
  201. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
  202. package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
  203. package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
  204. package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
  205. package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
  206. package/dist/lib/signing/brand-jwks.d.mts +2 -2
  207. package/dist/lib/signing/brand-jwks.d.ts +2 -2
  208. package/dist/lib/signing/brand-jwks.js +4 -4
  209. package/dist/lib/signing/brand-jwks.mjs +4 -4
  210. package/dist/lib/signing/client.d.mts +1 -0
  211. package/dist/lib/signing/client.d.ts +1 -0
  212. package/dist/lib/signing/client.js +5 -0
  213. package/dist/lib/signing/client.mjs +3 -0
  214. package/dist/lib/signing/jwks-https.d.mts +1 -1
  215. package/dist/lib/signing/jwks-https.d.ts +1 -1
  216. package/dist/lib/signing/jwks-https.js +1 -1
  217. package/dist/lib/signing/jwks-https.mjs +1 -1
  218. package/dist/lib/signing/jwks.d.mts +11 -3
  219. package/dist/lib/signing/jwks.d.ts +11 -3
  220. package/dist/lib/signing/jwks.js +1 -1
  221. package/dist/lib/signing/jwks.mjs +1 -1
  222. package/dist/lib/signing/parser.d.mts +1 -1
  223. package/dist/lib/signing/parser.d.ts +1 -1
  224. package/dist/lib/signing/parser.js +5 -3
  225. package/dist/lib/signing/parser.mjs +6 -4
  226. package/dist/lib/signing/revocation.d.mts +4 -1
  227. package/dist/lib/signing/revocation.d.ts +4 -1
  228. package/dist/lib/signing/revocation.js +33 -3
  229. package/dist/lib/signing/revocation.mjs +31 -2
  230. package/dist/lib/signing/server.d.mts +1 -1
  231. package/dist/lib/signing/server.d.ts +1 -1
  232. package/dist/lib/signing/server.js +4 -0
  233. package/dist/lib/signing/server.mjs +4 -0
  234. package/dist/lib/signing/types.d.mts +3 -0
  235. package/dist/lib/signing/types.d.ts +3 -0
  236. package/dist/lib/signing/web-bot-auth.d.mts +117 -0
  237. package/dist/lib/signing/web-bot-auth.d.ts +117 -0
  238. package/dist/lib/signing/web-bot-auth.js +660 -0
  239. package/dist/lib/signing/web-bot-auth.mjs +624 -0
  240. package/dist/lib/testing/client.d.mts +1 -4
  241. package/dist/lib/testing/client.d.ts +1 -4
  242. package/dist/lib/testing/client.js +141 -20
  243. package/dist/lib/testing/client.mjs +137 -19
  244. package/dist/lib/testing/compliance/comply.js +29 -10
  245. package/dist/lib/testing/compliance/comply.mjs +37 -11
  246. package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
  247. package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
  248. package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
  249. package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
  250. package/dist/lib/testing/storyboard/default-invariants.js +2 -0
  251. package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
  252. package/dist/lib/testing/storyboard/runner.js +23 -8
  253. package/dist/lib/testing/storyboard/runner.mjs +24 -8
  254. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  255. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  256. package/dist/lib/types/adcp.d.mts +4 -0
  257. package/dist/lib/types/adcp.d.ts +4 -0
  258. package/dist/lib/types/schemas.generated.d.ts +6 -6
  259. package/dist/lib/utils/capabilities.d.mts +1 -0
  260. package/dist/lib/utils/capabilities.d.ts +1 -0
  261. package/dist/lib/utils/capabilities.js +5 -0
  262. package/dist/lib/utils/capabilities.mjs +5 -0
  263. package/dist/lib/v2/projection/creative-delivery.d.mts +3 -1
  264. package/dist/lib/v2/projection/creative-delivery.d.ts +3 -1
  265. package/dist/lib/v2/projection/creative-delivery.js +26 -10
  266. package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
  267. package/dist/lib/v2/projection/index.d.mts +1 -1
  268. package/dist/lib/v2/projection/index.d.ts +1 -1
  269. package/dist/lib/v2/projection/legacy-routes.d.mts +24 -2
  270. package/dist/lib/v2/projection/legacy-routes.d.ts +24 -2
  271. package/dist/lib/v2/projection/legacy-routes.js +28 -2
  272. package/dist/lib/v2/projection/legacy-routes.mjs +26 -2
  273. package/dist/lib/validation/schema-loader.d.mts +2 -0
  274. package/dist/lib/validation/schema-loader.d.ts +2 -0
  275. package/dist/lib/validation/schema-loader.js +43 -4
  276. package/dist/lib/validation/schema-loader.mjs +39 -3
  277. package/dist/lib/version.d.mts +3 -3
  278. package/dist/lib/version.d.ts +3 -3
  279. package/dist/lib/version.js +3 -3
  280. package/dist/lib/version.mjs +3 -3
  281. package/docs/TYPE-SUMMARY.md +2 -2
  282. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
  283. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
  284. package/docs/guides/REPORTING-LEDGER.md +132 -46
  285. package/docs/guides/REPORTING-OPERATIONS.md +25 -4
  286. package/docs/guides/REPORTING-STABILITY.md +76 -0
  287. package/docs/guides/account-resolution.md +101 -0
  288. package/docs/llms.txt +3 -2
  289. package/docs/migration-12-to-13.md +7 -0
  290. package/docs/migration-14.x-rc-worksheet.md +4 -4
  291. package/docs/migration-agent-identity-3.3.md +355 -0
  292. package/docs/migration-agent-resolution-3.3.md +5 -0
  293. package/docs/migration-reporting-row-storage-alignment.md +137 -0
  294. package/examples/storyboards/account-sync-contract.yaml +57 -0
  295. package/package.json +15 -1
@@ -0,0 +1,278 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var trust_exports = {};
30
+ __export(trust_exports, {
31
+ IdentityAuthorizationError: () => IdentityAuthorizationError,
32
+ TrustEvaluator: () => TrustEvaluator,
33
+ authorizeDemandGrant: () => authorizeDemandGrant,
34
+ createTrustRecord: () => createTrustRecord,
35
+ validateIdentity33Schema: () => validateIdentity33Schema,
36
+ validateTrustRecord: () => validateTrustRecord
37
+ });
38
+ module.exports = __toCommonJS(trust_exports);
39
+ var import_ajv = __toESM(require("ajv"));
40
+ var import_ajv_formats = __toESM(require("ajv-formats"));
41
+ var import_net = require('../net/index.js');
42
+ var import_canonicalize = require('../signing/agent-resolver/canonicalize.js');
43
+ var import_etld = require('../signing/agent-resolver/etld.js');
44
+ var import_strict_json = require('../signing/agent-resolver/strict-json.js');
45
+ var import_schemas = __toESM(require('./schemas.draft.js'));
46
+ const ajv = new import_ajv.default({ strict: false, allErrors: false });
47
+ (0, import_ajv_formats.default)(ajv);
48
+ for (const schema of import_schemas.default) ajv.addSchema(schema);
49
+ function validateIdentity33Schema(id, value) {
50
+ return ajv.getSchema(`/schemas/${id}.json`)?.(value) === true;
51
+ }
52
+ class IdentityAuthorizationError extends Error {
53
+ code = "PERMISSION_DENIED";
54
+ details;
55
+ constructor(reason = "authorization_failed") {
56
+ super(reason === "grant_absent" ? "Agent authority is not granted" : "Agent authorization failed");
57
+ this.name = "IdentityAuthorizationError";
58
+ this.details = reason === "grant_absent" ? { scope: "agent", reason } : void 0;
59
+ }
60
+ }
61
+ function failure(cause) {
62
+ const error = new IdentityAuthorizationError();
63
+ if (cause !== void 0) Object.defineProperty(error, "cause", { value: cause });
64
+ throw error;
65
+ }
66
+ function validateTrustRecord(value) {
67
+ if (!validateIdentity33Schema("trust/v1/trust", value)) failure();
68
+ const record = value;
69
+ const origins = /* @__PURE__ */ new Set();
70
+ for (const agent of record.agents ?? []) {
71
+ if (agent.jwks_uri !== void 0) failure();
72
+ const origin = (0, import_canonicalize.canonicalAgentOrigin)(agent.url);
73
+ if (origins.has(origin)) failure();
74
+ origins.add(origin);
75
+ }
76
+ }
77
+ function createTrustRecord(record) {
78
+ validateTrustRecord(record);
79
+ return structuredClone(record);
80
+ }
81
+ class TrustEvaluator {
82
+ constructor(options = {}) {
83
+ this.options = options;
84
+ this.pollingIntervalSeconds = options.pollingIntervalSeconds ?? 300;
85
+ if (!Number.isFinite(this.pollingIntervalSeconds) || this.pollingIntervalSeconds < 60 || this.pollingIntervalSeconds > 1800)
86
+ throw new TypeError("Trust polling interval must be 60\u20131800 seconds");
87
+ }
88
+ options;
89
+ cache = /* @__PURE__ */ new Map();
90
+ negative = /* @__PURE__ */ new Map();
91
+ pending = /* @__PURE__ */ new Map();
92
+ urlRequests = /* @__PURE__ */ new Map();
93
+ hostRates = /* @__PURE__ */ new Map();
94
+ authoritativeOperators = /* @__PURE__ */ new Set();
95
+ authorityHistoryOverflowed = false;
96
+ pollingIntervalSeconds;
97
+ async get(domainOrOrigin, force = false) {
98
+ let operator;
99
+ try {
100
+ operator = (0, import_etld.eTldPlusOne)(domainOrOrigin);
101
+ } catch {
102
+ return failure();
103
+ }
104
+ const now = this.now();
105
+ const cached = this.cache.get(operator);
106
+ if (!force && cached && cached.freshUntil > now) return cached;
107
+ if ((this.negative.get(operator) ?? 0) > now) failure();
108
+ let pending = this.pending.get(operator);
109
+ if (!pending) {
110
+ if (this.pending.size >= (this.options.maxConcurrentFetches ?? 16)) failure();
111
+ pending = this.fetch(operator, now);
112
+ this.pending.set(operator, pending);
113
+ }
114
+ try {
115
+ return await pending;
116
+ } finally {
117
+ if (this.pending.get(operator) === pending) this.pending.delete(operator);
118
+ }
119
+ }
120
+ async match(origin, role, countries) {
121
+ const canonical = (0, import_canonicalize.canonicalAgentOrigin)(origin);
122
+ const result = await this.get(canonical);
123
+ if (result.status !== "present") failure();
124
+ const entries = (result.record.agents ?? []).filter((agent2) => (0, import_canonicalize.canonicalAgentOrigin)(agent2.url) === canonical);
125
+ if (entries.length !== 1 || !entries[0].roles.includes(role)) failure();
126
+ const agent = entries[0];
127
+ if (agent.countries && countries?.length && countries.some((country) => !agent.countries.includes(country)))
128
+ failure();
129
+ return { operator: result.operator, agent, record: result.record, freshUntil: result.freshUntil };
130
+ }
131
+ invalidate(domain) {
132
+ this.cache.delete((0, import_etld.eTldPlusOne)(domain));
133
+ }
134
+ hasAuthoritativeRecord(domain) {
135
+ return this.authoritativeOperators.has((0, import_etld.eTldPlusOne)(domain));
136
+ }
137
+ now() {
138
+ return (this.options.now ?? (() => Date.now() / 1e3))();
139
+ }
140
+ async request(url) {
141
+ const parsed = new URL(url);
142
+ if (parsed.protocol !== "https:" || parsed.username || parsed.password || parsed.hash) failure();
143
+ const host = parsed.hostname;
144
+ const pending = this.urlRequests.get(url);
145
+ if (pending) return pending;
146
+ const now = this.now(), rate = this.hostRates.get(host);
147
+ if (rate && now - rate.started < 60 && rate.count >= 10) failure();
148
+ if (!rate && this.hostRates.size >= (this.options.maxEntries ?? 1e3))
149
+ this.hostRates.delete(this.hostRates.keys().next().value);
150
+ this.hostRates.set(
151
+ host,
152
+ rate && now - rate.started < 60 ? { ...rate, count: rate.count + 1 } : { started: now, count: 1 }
153
+ );
154
+ const request = (0, import_net.ssrfSafeFetch)(url, {
155
+ ...this.options.fetchOptions,
156
+ maxBodyBytes: 2 * 1024 * 1024,
157
+ timeoutMs: 1e4,
158
+ headers: { accept: "application/json" }
159
+ });
160
+ this.urlRequests.set(url, request);
161
+ try {
162
+ return await request;
163
+ } finally {
164
+ if (this.urlRequests.get(url) === request) this.urlRequests.delete(url);
165
+ }
166
+ }
167
+ async fetch(operator, now) {
168
+ try {
169
+ let response = await this.request(`https://${operator}/.well-known/trust.json`);
170
+ let result;
171
+ if (response.status === 404 || response.status === 410) {
172
+ if (this.authorityHistoryOverflowed || this.authoritativeOperators.has(operator) || await this.options.authorityHistory?.has(operator))
173
+ failure();
174
+ result = { status: "absent", operator, checkedAt: now, freshUntil: now + 60 };
175
+ } else {
176
+ if (response.status !== 200) failure();
177
+ if (!this.authoritativeOperators.has(operator) && this.authoritativeOperators.size >= (this.options.maxEntries ?? 1e3)) {
178
+ if (!this.options.authorityHistory) this.authorityHistoryOverflowed = true;
179
+ this.authoritativeOperators.delete(this.authoritativeOperators.values().next().value);
180
+ }
181
+ await this.options.authorityHistory?.mark(operator);
182
+ this.authoritativeOperators.add(operator);
183
+ let record = (0, import_strict_json.parseStrictJson)(new TextDecoder("utf-8", { fatal: true }).decode(response.body), 32);
184
+ validateTrustRecord(record);
185
+ if (record.authoritative_location) {
186
+ response = await this.request(record.authoritative_location);
187
+ if (response.status !== 200) failure();
188
+ record = (0, import_strict_json.parseStrictJson)(new TextDecoder("utf-8", { fatal: true }).decode(response.body), 32);
189
+ validateTrustRecord(record);
190
+ if (record.authoritative_location) failure();
191
+ }
192
+ result = {
193
+ status: "present",
194
+ operator,
195
+ record,
196
+ checkedAt: now,
197
+ freshUntil: now + this.pollingIntervalSeconds
198
+ };
199
+ }
200
+ const max = this.options.maxEntries ?? 1e3;
201
+ if (this.cache.size >= max && !this.cache.has(operator)) this.cache.delete(this.cache.keys().next().value);
202
+ this.cache.set(operator, result);
203
+ this.negative.delete(operator);
204
+ return result;
205
+ } catch (cause) {
206
+ if (this.negative.size >= (this.options.maxEntries ?? 1e3))
207
+ this.negative.delete(this.negative.keys().next().value);
208
+ this.negative.set(operator, now + 60);
209
+ return failure(cause);
210
+ }
211
+ }
212
+ }
213
+ function grantMatches(grant, target, claim, now) {
214
+ if ((0, import_etld.eTldPlusOne)(grant.grantee) !== target) return false;
215
+ if (!grant.scopes.some(
216
+ (scope) => scope === "*" || scope === claim.scope || scope === "adcp:all" && claim.scope.startsWith("adcp:")
217
+ ))
218
+ return false;
219
+ if (grant.agents && !grant.agents.some((agent) => (0, import_canonicalize.canonicalAgentOrigin)(agent.url) === (0, import_canonicalize.canonicalAgentOrigin)(claim.signerOrigin)))
220
+ return false;
221
+ const brands = grant.profiles?.adcp?.brands;
222
+ if (brands && !brands.includes("*") && (!claim.brand.brand_id || !brands.includes(claim.brand.brand_id)))
223
+ return false;
224
+ if (grant.countries && (!claim.brand.countries?.length || claim.brand.countries.some((country) => !grant.countries.includes(country))))
225
+ return false;
226
+ if (grant.valid_from && Date.parse(grant.valid_from) / 1e3 > now) return false;
227
+ if (grant.valid_until && Date.parse(grant.valid_until) / 1e3 <= now) return false;
228
+ return true;
229
+ }
230
+ async function authorizeDemandGrant(claim, options) {
231
+ const now = (options.now ?? (() => Date.now() / 1e3))();
232
+ const signer = await options.evaluator.match(claim.signerOrigin, "adcp:buying", claim.brand.countries);
233
+ if (signer.agent.countries && !claim.brand.countries?.length) failure();
234
+ const brand = (0, import_etld.eTldPlusOne)(claim.brand.domain), account = (0, import_etld.eTldPlusOne)(claim.accountOperator), operator = signer.operator;
235
+ const result = (source, chain, grants = []) => ({
236
+ source,
237
+ chain,
238
+ operator,
239
+ checkedAt: now,
240
+ ...grants.some((g) => g.valid_until) ? { expiresAt: Math.min(...grants.map((g) => g.valid_until ? Date.parse(g.valid_until) / 1e3 : Infinity)) } : {}
241
+ });
242
+ if (brand === operator && account === operator) return result("implicit", [brand]);
243
+ if (brand === operator && account !== operator) throw new IdentityAuthorizationError("grant_absent");
244
+ const house = await options.resolveBrandHouse?.(claim.brand);
245
+ const authoritativeBrand = house ? (0, import_etld.eTldPlusOne)(house.domain) : brand;
246
+ const grantClaim = house ? { ...claim, brand: { ...claim.brand, brand_id: house.brand_id } } : claim;
247
+ const record = await options.evaluator.get(authoritativeBrand);
248
+ if (record.status === "absent") {
249
+ if (await options.legacyAuthorization?.(claim)) return result("legacy", [brand, account, operator]);
250
+ throw new IdentityAuthorizationError("grant_absent");
251
+ }
252
+ const first = (record.record.grants ?? []).filter((g) => grantMatches(g, account, grantClaim, now));
253
+ if (account === operator && first.length) return result("trust", [brand, operator], [first[0]]);
254
+ if (account !== operator && account !== brand && first.length) {
255
+ const intermediary = await options.evaluator.get(account);
256
+ if (intermediary.status === "present") {
257
+ const second = (intermediary.record.grants ?? []).find((g) => grantMatches(g, operator, grantClaim, now));
258
+ if (second) return result("trust", [brand, account, operator], [first[0], second]);
259
+ }
260
+ }
261
+ const covered = (record.record.grants ?? []).some(
262
+ (g) => (0, import_etld.eTldPlusOne)(g.grantee) === account && g.scopes.some(
263
+ (scope) => scope === "*" || scope === claim.scope || scope === "adcp:all" && claim.scope.startsWith("adcp:")
264
+ )
265
+ );
266
+ if (!covered && !record.record.exclusive_grants && await options.sellerAuthorization?.(claim))
267
+ return result("seller", [brand, account, operator]);
268
+ throw new IdentityAuthorizationError("grant_absent");
269
+ }
270
+ // Annotate the CommonJS export names for ESM import in node:
271
+ 0 && (module.exports = {
272
+ IdentityAuthorizationError,
273
+ TrustEvaluator,
274
+ authorizeDemandGrant,
275
+ createTrustRecord,
276
+ validateIdentity33Schema,
277
+ validateTrustRecord
278
+ });
@@ -0,0 +1,239 @@
1
+ import Ajv from "ajv";
2
+ import addFormats from "ajv-formats";
3
+ import { ssrfSafeFetch } from "../net/index.mjs";
4
+ import { canonicalAgentOrigin } from "../signing/agent-resolver/canonicalize.mjs";
5
+ import { eTldPlusOne } from "../signing/agent-resolver/etld.mjs";
6
+ import { parseStrictJson } from "../signing/agent-resolver/strict-json.mjs";
7
+ import schemas from "./schemas.draft.mjs";
8
+ const ajv = new Ajv({ strict: false, allErrors: false });
9
+ addFormats(ajv);
10
+ for (const schema of schemas) ajv.addSchema(schema);
11
+ function validateIdentity33Schema(id, value) {
12
+ return ajv.getSchema(`/schemas/${id}.json`)?.(value) === true;
13
+ }
14
+ class IdentityAuthorizationError extends Error {
15
+ code = "PERMISSION_DENIED";
16
+ details;
17
+ constructor(reason = "authorization_failed") {
18
+ super(reason === "grant_absent" ? "Agent authority is not granted" : "Agent authorization failed");
19
+ this.name = "IdentityAuthorizationError";
20
+ this.details = reason === "grant_absent" ? { scope: "agent", reason } : void 0;
21
+ }
22
+ }
23
+ function failure(cause) {
24
+ const error = new IdentityAuthorizationError();
25
+ if (cause !== void 0) Object.defineProperty(error, "cause", { value: cause });
26
+ throw error;
27
+ }
28
+ function validateTrustRecord(value) {
29
+ if (!validateIdentity33Schema("trust/v1/trust", value)) failure();
30
+ const record = value;
31
+ const origins = /* @__PURE__ */ new Set();
32
+ for (const agent of record.agents ?? []) {
33
+ if (agent.jwks_uri !== void 0) failure();
34
+ const origin = canonicalAgentOrigin(agent.url);
35
+ if (origins.has(origin)) failure();
36
+ origins.add(origin);
37
+ }
38
+ }
39
+ function createTrustRecord(record) {
40
+ validateTrustRecord(record);
41
+ return structuredClone(record);
42
+ }
43
+ class TrustEvaluator {
44
+ constructor(options = {}) {
45
+ this.options = options;
46
+ this.pollingIntervalSeconds = options.pollingIntervalSeconds ?? 300;
47
+ if (!Number.isFinite(this.pollingIntervalSeconds) || this.pollingIntervalSeconds < 60 || this.pollingIntervalSeconds > 1800)
48
+ throw new TypeError("Trust polling interval must be 60\u20131800 seconds");
49
+ }
50
+ options;
51
+ cache = /* @__PURE__ */ new Map();
52
+ negative = /* @__PURE__ */ new Map();
53
+ pending = /* @__PURE__ */ new Map();
54
+ urlRequests = /* @__PURE__ */ new Map();
55
+ hostRates = /* @__PURE__ */ new Map();
56
+ authoritativeOperators = /* @__PURE__ */ new Set();
57
+ authorityHistoryOverflowed = false;
58
+ pollingIntervalSeconds;
59
+ async get(domainOrOrigin, force = false) {
60
+ let operator;
61
+ try {
62
+ operator = eTldPlusOne(domainOrOrigin);
63
+ } catch {
64
+ return failure();
65
+ }
66
+ const now = this.now();
67
+ const cached = this.cache.get(operator);
68
+ if (!force && cached && cached.freshUntil > now) return cached;
69
+ if ((this.negative.get(operator) ?? 0) > now) failure();
70
+ let pending = this.pending.get(operator);
71
+ if (!pending) {
72
+ if (this.pending.size >= (this.options.maxConcurrentFetches ?? 16)) failure();
73
+ pending = this.fetch(operator, now);
74
+ this.pending.set(operator, pending);
75
+ }
76
+ try {
77
+ return await pending;
78
+ } finally {
79
+ if (this.pending.get(operator) === pending) this.pending.delete(operator);
80
+ }
81
+ }
82
+ async match(origin, role, countries) {
83
+ const canonical = canonicalAgentOrigin(origin);
84
+ const result = await this.get(canonical);
85
+ if (result.status !== "present") failure();
86
+ const entries = (result.record.agents ?? []).filter((agent2) => canonicalAgentOrigin(agent2.url) === canonical);
87
+ if (entries.length !== 1 || !entries[0].roles.includes(role)) failure();
88
+ const agent = entries[0];
89
+ if (agent.countries && countries?.length && countries.some((country) => !agent.countries.includes(country)))
90
+ failure();
91
+ return { operator: result.operator, agent, record: result.record, freshUntil: result.freshUntil };
92
+ }
93
+ invalidate(domain) {
94
+ this.cache.delete(eTldPlusOne(domain));
95
+ }
96
+ hasAuthoritativeRecord(domain) {
97
+ return this.authoritativeOperators.has(eTldPlusOne(domain));
98
+ }
99
+ now() {
100
+ return (this.options.now ?? (() => Date.now() / 1e3))();
101
+ }
102
+ async request(url) {
103
+ const parsed = new URL(url);
104
+ if (parsed.protocol !== "https:" || parsed.username || parsed.password || parsed.hash) failure();
105
+ const host = parsed.hostname;
106
+ const pending = this.urlRequests.get(url);
107
+ if (pending) return pending;
108
+ const now = this.now(), rate = this.hostRates.get(host);
109
+ if (rate && now - rate.started < 60 && rate.count >= 10) failure();
110
+ if (!rate && this.hostRates.size >= (this.options.maxEntries ?? 1e3))
111
+ this.hostRates.delete(this.hostRates.keys().next().value);
112
+ this.hostRates.set(
113
+ host,
114
+ rate && now - rate.started < 60 ? { ...rate, count: rate.count + 1 } : { started: now, count: 1 }
115
+ );
116
+ const request = ssrfSafeFetch(url, {
117
+ ...this.options.fetchOptions,
118
+ maxBodyBytes: 2 * 1024 * 1024,
119
+ timeoutMs: 1e4,
120
+ headers: { accept: "application/json" }
121
+ });
122
+ this.urlRequests.set(url, request);
123
+ try {
124
+ return await request;
125
+ } finally {
126
+ if (this.urlRequests.get(url) === request) this.urlRequests.delete(url);
127
+ }
128
+ }
129
+ async fetch(operator, now) {
130
+ try {
131
+ let response = await this.request(`https://${operator}/.well-known/trust.json`);
132
+ let result;
133
+ if (response.status === 404 || response.status === 410) {
134
+ if (this.authorityHistoryOverflowed || this.authoritativeOperators.has(operator) || await this.options.authorityHistory?.has(operator))
135
+ failure();
136
+ result = { status: "absent", operator, checkedAt: now, freshUntil: now + 60 };
137
+ } else {
138
+ if (response.status !== 200) failure();
139
+ if (!this.authoritativeOperators.has(operator) && this.authoritativeOperators.size >= (this.options.maxEntries ?? 1e3)) {
140
+ if (!this.options.authorityHistory) this.authorityHistoryOverflowed = true;
141
+ this.authoritativeOperators.delete(this.authoritativeOperators.values().next().value);
142
+ }
143
+ await this.options.authorityHistory?.mark(operator);
144
+ this.authoritativeOperators.add(operator);
145
+ let record = parseStrictJson(new TextDecoder("utf-8", { fatal: true }).decode(response.body), 32);
146
+ validateTrustRecord(record);
147
+ if (record.authoritative_location) {
148
+ response = await this.request(record.authoritative_location);
149
+ if (response.status !== 200) failure();
150
+ record = parseStrictJson(new TextDecoder("utf-8", { fatal: true }).decode(response.body), 32);
151
+ validateTrustRecord(record);
152
+ if (record.authoritative_location) failure();
153
+ }
154
+ result = {
155
+ status: "present",
156
+ operator,
157
+ record,
158
+ checkedAt: now,
159
+ freshUntil: now + this.pollingIntervalSeconds
160
+ };
161
+ }
162
+ const max = this.options.maxEntries ?? 1e3;
163
+ if (this.cache.size >= max && !this.cache.has(operator)) this.cache.delete(this.cache.keys().next().value);
164
+ this.cache.set(operator, result);
165
+ this.negative.delete(operator);
166
+ return result;
167
+ } catch (cause) {
168
+ if (this.negative.size >= (this.options.maxEntries ?? 1e3))
169
+ this.negative.delete(this.negative.keys().next().value);
170
+ this.negative.set(operator, now + 60);
171
+ return failure(cause);
172
+ }
173
+ }
174
+ }
175
+ function grantMatches(grant, target, claim, now) {
176
+ if (eTldPlusOne(grant.grantee) !== target) return false;
177
+ if (!grant.scopes.some(
178
+ (scope) => scope === "*" || scope === claim.scope || scope === "adcp:all" && claim.scope.startsWith("adcp:")
179
+ ))
180
+ return false;
181
+ if (grant.agents && !grant.agents.some((agent) => canonicalAgentOrigin(agent.url) === canonicalAgentOrigin(claim.signerOrigin)))
182
+ return false;
183
+ const brands = grant.profiles?.adcp?.brands;
184
+ if (brands && !brands.includes("*") && (!claim.brand.brand_id || !brands.includes(claim.brand.brand_id)))
185
+ return false;
186
+ if (grant.countries && (!claim.brand.countries?.length || claim.brand.countries.some((country) => !grant.countries.includes(country))))
187
+ return false;
188
+ if (grant.valid_from && Date.parse(grant.valid_from) / 1e3 > now) return false;
189
+ if (grant.valid_until && Date.parse(grant.valid_until) / 1e3 <= now) return false;
190
+ return true;
191
+ }
192
+ async function authorizeDemandGrant(claim, options) {
193
+ const now = (options.now ?? (() => Date.now() / 1e3))();
194
+ const signer = await options.evaluator.match(claim.signerOrigin, "adcp:buying", claim.brand.countries);
195
+ if (signer.agent.countries && !claim.brand.countries?.length) failure();
196
+ const brand = eTldPlusOne(claim.brand.domain), account = eTldPlusOne(claim.accountOperator), operator = signer.operator;
197
+ const result = (source, chain, grants = []) => ({
198
+ source,
199
+ chain,
200
+ operator,
201
+ checkedAt: now,
202
+ ...grants.some((g) => g.valid_until) ? { expiresAt: Math.min(...grants.map((g) => g.valid_until ? Date.parse(g.valid_until) / 1e3 : Infinity)) } : {}
203
+ });
204
+ if (brand === operator && account === operator) return result("implicit", [brand]);
205
+ if (brand === operator && account !== operator) throw new IdentityAuthorizationError("grant_absent");
206
+ const house = await options.resolveBrandHouse?.(claim.brand);
207
+ const authoritativeBrand = house ? eTldPlusOne(house.domain) : brand;
208
+ const grantClaim = house ? { ...claim, brand: { ...claim.brand, brand_id: house.brand_id } } : claim;
209
+ const record = await options.evaluator.get(authoritativeBrand);
210
+ if (record.status === "absent") {
211
+ if (await options.legacyAuthorization?.(claim)) return result("legacy", [brand, account, operator]);
212
+ throw new IdentityAuthorizationError("grant_absent");
213
+ }
214
+ const first = (record.record.grants ?? []).filter((g) => grantMatches(g, account, grantClaim, now));
215
+ if (account === operator && first.length) return result("trust", [brand, operator], [first[0]]);
216
+ if (account !== operator && account !== brand && first.length) {
217
+ const intermediary = await options.evaluator.get(account);
218
+ if (intermediary.status === "present") {
219
+ const second = (intermediary.record.grants ?? []).find((g) => grantMatches(g, operator, grantClaim, now));
220
+ if (second) return result("trust", [brand, account, operator], [first[0], second]);
221
+ }
222
+ }
223
+ const covered = (record.record.grants ?? []).some(
224
+ (g) => eTldPlusOne(g.grantee) === account && g.scopes.some(
225
+ (scope) => scope === "*" || scope === claim.scope || scope === "adcp:all" && claim.scope.startsWith("adcp:")
226
+ )
227
+ );
228
+ if (!covered && !record.record.exclusive_grants && await options.sellerAuthorization?.(claim))
229
+ return result("seller", [brand, account, operator]);
230
+ throw new IdentityAuthorizationError("grant_absent");
231
+ }
232
+ export {
233
+ IdentityAuthorizationError,
234
+ TrustEvaluator,
235
+ authorizeDemandGrant,
236
+ createTrustRecord,
237
+ validateIdentity33Schema,
238
+ validateTrustRecord
239
+ };
@@ -0,0 +1,127 @@
1
+ /** Experimental drafts; the released SDK wire/schema pin remains 3.2.4. */
2
+ export type AgentOnboardingMode = 'open' | 'application' | 'invite_only';
3
+ export type BillingParty = 'operator' | 'agent' | 'advertiser';
4
+ export type AgentOnboardingRequirementKind = 'agent_identity' | 'grant' | 'billing_entity' | 'contract' | 'credit_application' | 'aao_verified' | 'storyboard' | 'sandbox' | 'experimental_feature';
5
+ export interface AgentOnboardingRequirement {
6
+ kind: AgentOnboardingRequirementKind | (string & {});
7
+ role?: string;
8
+ verification_modes?: string[];
9
+ specialisms?: string[];
10
+ adcp_version?: string;
11
+ id?: string;
12
+ ext?: Record<string, unknown>;
13
+ }
14
+ export interface AgentOnboardingTier {
15
+ mode: AgentOnboardingMode;
16
+ url?: string;
17
+ requirements?: AgentOnboardingRequirement[];
18
+ ext?: Record<string, unknown>;
19
+ }
20
+ export interface AgentOnboarding {
21
+ sandbox?: AgentOnboardingTier;
22
+ billing?: Partial<Record<BillingParty, AgentOnboardingTier>>;
23
+ url?: string;
24
+ documentation_url?: string;
25
+ message?: string;
26
+ ext?: Record<string, unknown>;
27
+ }
28
+ export interface BuyerOnboardingPosture {
29
+ mode: 'considers_unsolicited' | 'application' | 'invite_only';
30
+ requirements?: AgentOnboardingRequirement[];
31
+ url?: string;
32
+ documentation_url?: string;
33
+ message?: string;
34
+ ext?: Record<string, unknown>;
35
+ }
36
+ export interface PrincipalRelationship {
37
+ status: 'pending' | 'active' | 'suspended' | 'blocked';
38
+ expires_at?: string;
39
+ setup?: {
40
+ message: string;
41
+ url?: string;
42
+ expires_at?: string;
43
+ [key: string]: unknown;
44
+ };
45
+ ext?: Record<string, unknown>;
46
+ }
47
+ export type IdentityPrincipalChangedReason = 'relationship_changed' | 'relationship_expiring';
48
+ export interface TrustAgent {
49
+ url: string;
50
+ roles: string[];
51
+ id?: string;
52
+ protocols?: string[];
53
+ countries?: string[];
54
+ profiles?: {
55
+ adcp?: {
56
+ onboarding?: BuyerOnboardingPosture;
57
+ [key: string]: unknown;
58
+ };
59
+ [key: string]: unknown;
60
+ };
61
+ [key: string]: unknown;
62
+ }
63
+ export interface TrustGrant {
64
+ grantee: string;
65
+ scopes: string[];
66
+ agents?: {
67
+ url: string;
68
+ }[];
69
+ countries?: string[];
70
+ valid_from?: string;
71
+ valid_until?: string;
72
+ profiles?: {
73
+ adcp?: {
74
+ brands?: string[];
75
+ [key: string]: unknown;
76
+ };
77
+ [key: string]: unknown;
78
+ };
79
+ [key: string]: unknown;
80
+ }
81
+ export interface TrustRecord {
82
+ agents?: TrustAgent[];
83
+ grants?: TrustGrant[];
84
+ acknowledgements?: unknown[];
85
+ exclusive_grants?: boolean;
86
+ authoritative_location?: string;
87
+ profiles?: {
88
+ adcp?: {
89
+ onboarding?: BuyerOnboardingPosture;
90
+ [key: string]: unknown;
91
+ };
92
+ [key: string]: unknown;
93
+ };
94
+ [key: string]: unknown;
95
+ }
96
+ export type RevocationReason = 'unspecified' | 'keyCompromise' | 'cACompromise' | 'affiliationChanged' | 'superseded' | 'cessationOfOperation' | 'certificateHold' | 'removeFromCRL' | 'privilegeWithdrawn' | 'aACompromise';
97
+ export interface RevocationDetail {
98
+ reason?: RevocationReason;
99
+ invalidity_date?: string;
100
+ }
101
+ export interface AgentGrantDeniedDetails {
102
+ scope: 'agent';
103
+ reason: 'grant_absent';
104
+ }
105
+ export interface Identity33Capabilities {
106
+ request_signing?: {
107
+ profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
108
+ wba_draft_revision?: string;
109
+ };
110
+ webhook_signing?: {
111
+ supported: boolean;
112
+ profiles?: ('adcp/webhook-signing/v1' | 'web-bot-auth')[];
113
+ wba_draft_revision?: string;
114
+ };
115
+ account?: {
116
+ agent_onboarding?: AgentOnboarding;
117
+ };
118
+ }
119
+ export type Identity33GetPrincipalResponse = Omit<import('../types/tools.generated.mjs').GetPrincipalResponse, 'result'> & {
120
+ result: (Exclude<import('../types/tools.generated.mjs').GetPrincipalResponse['result'], {
121
+ kind: 'failed';
122
+ }> & {
123
+ relationship?: PrincipalRelationship;
124
+ }) | Extract<import('../types/tools.generated.mjs').GetPrincipalResponse['result'], {
125
+ kind: 'failed';
126
+ }>;
127
+ };