@adcp/sdk 14.0.0-rc.37 → 14.0.0-rc.39
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/bin/adcp-storyboard-summary.js +286 -0
- package/bin/adcp.js +221 -10
- package/dist/lib/conformance/schemaLoader.d.mts +1 -1
- package/dist/lib/conformance/schemaLoader.d.ts +1 -1
- package/dist/lib/core/AgentClient.d.mts +6 -1
- package/dist/lib/core/AgentClient.d.ts +6 -1
- package/dist/lib/core/AgentClient.js +9 -0
- package/dist/lib/core/AgentClient.mjs +9 -0
- package/dist/lib/core/ConversationTypes.d.mts +29 -0
- package/dist/lib/core/ConversationTypes.d.ts +29 -0
- package/dist/lib/core/SingleAgentClient.d.mts +3 -1
- package/dist/lib/core/SingleAgentClient.d.ts +3 -1
- package/dist/lib/core/SingleAgentClient.js +9 -1
- package/dist/lib/core/SingleAgentClient.mjs +9 -1
- package/dist/lib/core/TaskExecutor.d.mts +13 -1
- package/dist/lib/core/TaskExecutor.d.ts +13 -1
- package/dist/lib/core/TaskExecutor.js +216 -18
- package/dist/lib/core/TaskExecutor.mjs +216 -19
- package/dist/lib/index.d.mts +5 -2
- package/dist/lib/index.d.ts +5 -2
- package/dist/lib/index.js +10 -1
- package/dist/lib/index.mjs +10 -1
- package/dist/lib/media-buy/action-assessment.d.mts +77 -0
- package/dist/lib/media-buy/action-assessment.d.ts +77 -0
- package/dist/lib/media-buy/action-assessment.js +300 -0
- package/dist/lib/media-buy/action-assessment.mjs +284 -0
- package/dist/lib/media-buy/action-constraints.d.mts +9 -0
- package/dist/lib/media-buy/action-constraints.d.ts +9 -0
- package/dist/lib/media-buy/action-constraints.js +170 -0
- package/dist/lib/media-buy/action-constraints.mjs +146 -0
- package/dist/lib/media-buy/action-contracts.d.mts +40 -0
- package/dist/lib/media-buy/action-contracts.d.ts +40 -0
- package/dist/lib/media-buy/action-contracts.js +304 -0
- package/dist/lib/media-buy/action-contracts.mjs +267 -0
- package/dist/lib/media-buy/action-metadata.generated.d.mts +37 -0
- package/dist/lib/media-buy/action-metadata.generated.d.ts +37 -0
- package/dist/lib/media-buy/action-metadata.generated.js +128 -0
- package/dist/lib/media-buy/action-metadata.generated.mjs +101 -0
- package/dist/lib/media-buy/action-types.d.mts +106 -0
- package/dist/lib/media-buy/action-types.d.ts +106 -0
- package/dist/lib/{types/v3-1-beta/tools.generated.js → media-buy/action-types.js} +2 -2
- package/dist/lib/media-buy/actions.d.mts +6 -0
- package/dist/lib/media-buy/actions.d.ts +6 -0
- package/dist/lib/media-buy/actions.js +38 -0
- package/dist/lib/media-buy/actions.mjs +9 -0
- package/dist/lib/media-buy/available-actions.d.mts +2 -1
- package/dist/lib/media-buy/available-actions.d.ts +2 -1
- package/dist/lib/media-buy/available-actions.js +4 -3
- package/dist/lib/media-buy/available-actions.mjs +4 -3
- package/dist/lib/media-buy/compatibility.js +3 -0
- package/dist/lib/media-buy/compatibility.mjs +3 -0
- package/dist/lib/media-buy/index.d.mts +4 -0
- package/dist/lib/media-buy/index.d.ts +4 -0
- package/dist/lib/media-buy/index.js +3 -1
- package/dist/lib/media-buy/index.mjs +1 -0
- package/dist/lib/media-buy/legacy-action-ids.d.mts +1 -0
- package/dist/lib/media-buy/legacy-action-ids.d.ts +1 -0
- package/dist/lib/media-buy/legacy-action-ids.js +50 -0
- package/dist/lib/media-buy/legacy-action-ids.mjs +26 -0
- package/dist/lib/media-buy/mutations.d.mts +70 -0
- package/dist/lib/media-buy/mutations.d.ts +70 -0
- package/dist/lib/media-buy/mutations.js +525 -0
- package/dist/lib/media-buy/mutations.mjs +498 -0
- package/dist/lib/media-buy/preflight.d.mts +20 -69
- package/dist/lib/media-buy/preflight.d.ts +20 -69
- package/dist/lib/media-buy/preflight.js +100 -336
- package/dist/lib/media-buy/preflight.mjs +111 -333
- package/dist/lib/media-buy/targeting-input.d.mts +7 -4
- package/dist/lib/media-buy/targeting-input.d.ts +7 -4
- package/dist/lib/media-buy/types.d.mts +55 -7
- package/dist/lib/media-buy/types.d.ts +55 -7
- package/dist/lib/protocols/rawResponseCapture.d.mts +12 -0
- package/dist/lib/protocols/rawResponseCapture.d.ts +12 -0
- package/dist/lib/protocols/rawResponseCapture.js +33 -3
- package/dist/lib/protocols/rawResponseCapture.mjs +32 -3
- package/dist/lib/registry/types.generated.d.mts +377 -9
- package/dist/lib/registry/types.generated.d.ts +377 -9
- package/dist/lib/reporting/content-mismatch.d.mts +126 -0
- package/dist/lib/reporting/content-mismatch.d.ts +126 -0
- package/dist/lib/reporting/content-mismatch.js +90 -0
- package/dist/lib/reporting/content-mismatch.mjs +66 -0
- package/dist/lib/reporting/evidence.d.mts +1 -0
- package/dist/lib/reporting/evidence.d.ts +1 -0
- package/dist/lib/reporting/evidence.js +32 -3
- package/dist/lib/reporting/evidence.mjs +31 -3
- package/dist/lib/reporting/index.d.mts +3 -1
- package/dist/lib/reporting/index.d.ts +3 -1
- package/dist/lib/reporting/index.js +3 -0
- package/dist/lib/reporting/index.mjs +2 -0
- package/dist/lib/reporting/ledger/handler.d.mts +51 -1
- package/dist/lib/reporting/ledger/handler.d.ts +51 -1
- package/dist/lib/reporting/ledger/handler.js +306 -38
- package/dist/lib/reporting/ledger/handler.mjs +304 -37
- package/dist/lib/reporting/ledger/health.d.mts +12 -0
- package/dist/lib/reporting/ledger/health.d.ts +12 -0
- package/dist/lib/reporting/ledger/health.js +15 -2
- package/dist/lib/reporting/ledger/health.mjs +13 -1
- package/dist/lib/reporting/ledger/index.d.mts +3 -0
- package/dist/lib/reporting/ledger/index.d.ts +3 -0
- package/dist/lib/reporting/ledger/index.js +7 -1
- package/dist/lib/reporting/ledger/index.mjs +3 -0
- package/dist/lib/reporting/ledger/lifecycle.d.mts +31 -4
- package/dist/lib/reporting/ledger/lifecycle.d.ts +31 -4
- package/dist/lib/reporting/ledger/lifecycle.js +244 -37
- package/dist/lib/reporting/ledger/lifecycle.mjs +244 -37
- package/dist/lib/reporting/ledger/managed-postgres.d.mts +231 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.ts +231 -0
- package/dist/lib/reporting/ledger/managed-postgres.js +1797 -0
- package/dist/lib/reporting/ledger/managed-postgres.mjs +1776 -0
- package/dist/lib/reporting/ledger/managed.d.mts +355 -0
- package/dist/lib/reporting/ledger/managed.d.ts +355 -0
- package/dist/lib/reporting/ledger/managed.js +661 -0
- package/dist/lib/reporting/ledger/managed.mjs +633 -0
- package/dist/lib/reporting/ledger/notification-activity.d.mts +222 -0
- package/dist/lib/reporting/ledger/notification-activity.d.ts +222 -0
- package/dist/lib/reporting/ledger/notification-activity.js +1139 -0
- package/dist/lib/reporting/ledger/notification-activity.mjs +1110 -0
- package/dist/lib/reporting/ledger/postgres.d.mts +161 -1
- package/dist/lib/reporting/ledger/postgres.d.ts +161 -1
- package/dist/lib/reporting/ledger/postgres.js +1153 -21
- package/dist/lib/reporting/ledger/postgres.mjs +1152 -21
- package/dist/lib/reporting/ledger/producer.d.mts +8 -0
- package/dist/lib/reporting/ledger/producer.d.ts +8 -0
- package/dist/lib/reporting/ledger/producer.js +146 -52
- package/dist/lib/reporting/ledger/producer.mjs +146 -51
- package/dist/lib/reporting/ledger/types.d.mts +358 -1
- package/dist/lib/reporting/ledger/types.d.ts +358 -1
- package/dist/lib/reporting/ledger/types.js +3 -0
- package/dist/lib/reporting/ledger/types.mjs +2 -0
- package/dist/lib/reporting/reconciliation.d.mts +362 -2
- package/dist/lib/reporting/reconciliation.d.ts +362 -2
- package/dist/lib/reporting/reconciliation.js +1051 -7
- package/dist/lib/reporting/reconciliation.mjs +1053 -7
- package/dist/lib/reporting/service/conformance.d.mts +35 -0
- package/dist/lib/reporting/service/conformance.d.ts +35 -0
- package/dist/lib/reporting/service/conformance.js +89 -0
- package/dist/lib/reporting/service/conformance.mjs +68 -0
- package/dist/lib/reporting/service/index.d.mts +182 -0
- package/dist/lib/reporting/service/index.d.ts +182 -0
- package/dist/lib/reporting/service/index.js +793 -0
- package/dist/lib/reporting/service/index.mjs +787 -0
- package/dist/lib/reporting/source/index.d.mts +2 -1
- package/dist/lib/reporting/source/index.d.ts +2 -1
- package/dist/lib/reporting/source/index.js +16 -3
- package/dist/lib/reporting/source/index.mjs +12 -1
- package/dist/lib/reporting/source/inline.d.mts +88 -1
- package/dist/lib/reporting/source/inline.d.ts +88 -1
- package/dist/lib/reporting/source/inline.js +1161 -163
- package/dist/lib/reporting/source/inline.mjs +1166 -163
- package/dist/lib/reporting/source/manifest.js +12 -7
- package/dist/lib/reporting/source/manifest.mjs +12 -7
- package/dist/lib/reporting/source/source.d.mts +26 -0
- package/dist/lib/reporting/source/source.d.ts +26 -0
- package/dist/lib/reporting/source/source.js +71 -2
- package/dist/lib/reporting/source/source.mjs +65 -1
- package/dist/lib/schemas/index.d.mts +22 -1
- package/dist/lib/schemas/index.d.ts +22 -1
- package/dist/lib/schemas/index.js +7 -0
- package/dist/lib/schemas/index.mjs +7 -0
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/create-adcp-server.d.mts +18 -0
- package/dist/lib/server/create-adcp-server.d.ts +18 -0
- package/dist/lib/server/create-adcp-server.js +52 -2
- package/dist/lib/server/create-adcp-server.mjs +52 -2
- package/dist/lib/server/decisioning/account.d.mts +1 -1
- package/dist/lib/server/decisioning/account.d.ts +1 -1
- package/dist/lib/server/decisioning/index.d.mts +1 -0
- package/dist/lib/server/decisioning/index.d.ts +1 -0
- package/dist/lib/server/decisioning/platform.d.mts +3 -0
- package/dist/lib/server/decisioning/platform.d.ts +3 -0
- package/dist/lib/server/decisioning/runtime/from-platform.js +88 -10
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +88 -10
- package/dist/lib/server/decisioning/specialisms/reporting.d.mts +38 -0
- package/dist/lib/server/decisioning/specialisms/reporting.d.ts +38 -0
- package/dist/lib/{types/v3-1-beta/index.js → server/decisioning/specialisms/reporting.js} +2 -8
- package/dist/lib/server/decisioning/specialisms/reporting.mjs +0 -0
- package/dist/lib/server/index.d.mts +4 -2
- package/dist/lib/server/index.d.ts +4 -2
- package/dist/lib/server/index.js +5 -0
- package/dist/lib/server/index.mjs +4 -0
- package/dist/lib/server/media-buy-action-resolver.d.mts +63 -0
- package/dist/lib/server/media-buy-action-resolver.d.ts +63 -0
- package/dist/lib/server/media-buy-action-resolver.js +297 -0
- package/dist/lib/server/media-buy-action-resolver.mjs +285 -0
- package/dist/lib/server/media-buy-actions.d.mts +7 -8
- package/dist/lib/server/media-buy-actions.d.ts +7 -8
- package/dist/lib/server/media-buy-actions.js +57 -14
- package/dist/lib/server/media-buy-actions.mjs +63 -14
- package/dist/lib/server/notification-subscriptions/index.d.mts +2 -2
- package/dist/lib/server/notification-subscriptions/index.d.ts +2 -2
- package/dist/lib/server/notification-subscriptions/index.js +2 -0
- package/dist/lib/server/notification-subscriptions/index.mjs +2 -0
- package/dist/lib/server/notification-subscriptions/postgres-runtime.d.mts +3 -1
- package/dist/lib/server/notification-subscriptions/postgres-runtime.d.ts +3 -1
- package/dist/lib/server/notification-subscriptions/postgres-runtime.js +1 -0
- package/dist/lib/server/notification-subscriptions/postgres-runtime.mjs +1 -0
- package/dist/lib/server/notification-subscriptions/runtime.d.mts +12 -1
- package/dist/lib/server/notification-subscriptions/runtime.d.ts +12 -1
- package/dist/lib/server/notification-subscriptions/runtime.js +102 -16
- package/dist/lib/server/notification-subscriptions/runtime.mjs +101 -16
- package/dist/lib/server/notification-subscriptions/types.d.mts +104 -1
- package/dist/lib/server/notification-subscriptions/types.d.ts +104 -1
- package/dist/lib/server/webhook-emitter.d.mts +40 -5
- package/dist/lib/server/webhook-emitter.d.ts +40 -5
- package/dist/lib/server/webhook-emitter.js +23 -12
- package/dist/lib/server/webhook-emitter.mjs +23 -12
- package/dist/lib/storage/interfaces.d.mts +14 -2
- package/dist/lib/storage/interfaces.d.ts +14 -2
- package/dist/lib/testing/compliance/comply.d.mts +9 -3
- package/dist/lib/testing/compliance/comply.d.ts +9 -3
- package/dist/lib/testing/compliance/comply.js +158 -3
- package/dist/lib/testing/compliance/comply.mjs +159 -4
- package/dist/lib/testing/compliance/storyboard-tracks.js +7 -5
- package/dist/lib/testing/compliance/storyboard-tracks.mjs +7 -5
- package/dist/lib/testing/compliance/summary.js +10 -1
- package/dist/lib/testing/compliance/summary.mjs +10 -1
- package/dist/lib/testing/index.d.mts +1 -1
- package/dist/lib/testing/index.d.ts +1 -1
- package/dist/lib/testing/index.js +2 -0
- package/dist/lib/testing/index.mjs +3 -1
- package/dist/lib/testing/storyboard/agent-routing.d.mts +12 -43
- package/dist/lib/testing/storyboard/agent-routing.d.ts +12 -43
- package/dist/lib/testing/storyboard/agent-routing.js +75 -13
- package/dist/lib/testing/storyboard/agent-routing.mjs +70 -12
- package/dist/lib/testing/storyboard/index.d.mts +1 -0
- package/dist/lib/testing/storyboard/index.d.ts +1 -0
- package/dist/lib/testing/storyboard/index.js +3 -0
- package/dist/lib/testing/storyboard/index.mjs +2 -0
- package/dist/lib/testing/storyboard/junit.d.mts +1 -1
- package/dist/lib/testing/storyboard/junit.d.ts +1 -1
- package/dist/lib/testing/storyboard/junit.js +21 -2
- package/dist/lib/testing/storyboard/junit.mjs +21 -2
- package/dist/lib/testing/storyboard/probes.d.mts +130 -0
- package/dist/lib/testing/storyboard/probes.d.ts +130 -0
- package/dist/lib/testing/storyboard/probes.js +682 -10
- package/dist/lib/testing/storyboard/probes.mjs +683 -3
- package/dist/lib/testing/storyboard/request-signing/builder.d.mts +16 -5
- package/dist/lib/testing/storyboard/request-signing/builder.d.ts +16 -5
- package/dist/lib/testing/storyboard/request-signing/grader.d.mts +44 -1
- package/dist/lib/testing/storyboard/request-signing/grader.d.ts +44 -1
- package/dist/lib/testing/storyboard/request-signing/grader.js +46 -22
- package/dist/lib/testing/storyboard/request-signing/grader.mjs +43 -21
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.d.mts +86 -11
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.d.ts +86 -11
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.js +119 -25
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs +117 -26
- package/dist/lib/testing/storyboard/request-signing/synthesize.js +22 -2
- package/dist/lib/testing/storyboard/request-signing/synthesize.mjs +22 -2
- package/dist/lib/testing/storyboard/runner.d.mts +103 -0
- package/dist/lib/testing/storyboard/runner.d.ts +103 -0
- package/dist/lib/testing/storyboard/runner.js +1090 -268
- package/dist/lib/testing/storyboard/runner.mjs +1096 -261
- package/dist/lib/testing/storyboard/seeding.d.mts +4 -1
- package/dist/lib/testing/storyboard/seeding.d.ts +4 -1
- package/dist/lib/testing/storyboard/seeding.js +55 -24
- package/dist/lib/testing/storyboard/seeding.mjs +55 -24
- package/dist/lib/testing/storyboard/test-kit.d.mts +37 -3
- package/dist/lib/testing/storyboard/test-kit.d.ts +37 -3
- package/dist/lib/testing/storyboard/test-kit.js +8 -2
- package/dist/lib/testing/storyboard/test-kit.mjs +7 -2
- package/dist/lib/testing/storyboard/types.d.mts +132 -10
- package/dist/lib/testing/storyboard/types.d.ts +132 -10
- package/dist/lib/testing/storyboard/types.js +17 -0
- package/dist/lib/testing/storyboard/types.mjs +16 -0
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.js +16 -0
- package/dist/lib/testing/storyboard/validations.mjs +16 -0
- package/dist/lib/testing/test-controller.d.mts +1 -1
- package/dist/lib/testing/test-controller.d.ts +1 -1
- package/dist/lib/types/buy-products.d.ts +71 -6
- package/dist/lib/types/control-media-buy.d.ts +25 -11
- package/dist/lib/types/core.generated.d.mts +69 -10
- package/dist/lib/types/core.generated.d.ts +69 -10
- package/dist/lib/types/create-media-buy.d.ts +71 -6
- package/dist/lib/types/forward-compat-error-codes.d.mts +7 -6
- package/dist/lib/types/forward-compat-error-codes.d.ts +7 -6
- package/dist/lib/types/index.d.mts +2 -2
- package/dist/lib/types/index.d.ts +2 -2
- package/dist/lib/types/schemas.generated.d.ts +8040 -8116
- package/dist/lib/types/schemas.generated.js +1074 -309
- package/dist/lib/types/schemas.generated.mjs +1068 -309
- package/dist/lib/types/tools.generated.d.mts +65 -6
- package/dist/lib/types/tools.generated.d.ts +65 -6
- package/dist/lib/types/update-media-buy.d.ts +71 -6
- package/dist/lib/utils/redact-secrets.d.mts +1 -1
- package/dist/lib/utils/redact-secrets.d.ts +1 -1
- package/dist/lib/utils/redact-secrets.js +1 -1
- package/dist/lib/utils/redact-secrets.mjs +1 -1
- package/dist/lib/v2/projection/cache-versions.d.mts +0 -1
- package/dist/lib/v2/projection/cache-versions.d.ts +0 -1
- package/dist/lib/v2/projection/cache-versions.js +1 -15
- package/dist/lib/v2/projection/cache-versions.mjs +1 -14
- package/dist/lib/v2/projection/canonical-properties.js +2 -2
- package/dist/lib/v2/projection/canonical-properties.mjs +3 -3
- package/dist/lib/v2/projection/registry.d.mts +1 -1
- package/dist/lib/v2/projection/registry.d.ts +1 -1
- package/dist/lib/v2/projection/registry.js +2 -2
- package/dist/lib/v2/projection/registry.mjs +3 -3
- package/dist/lib/validation/schema-loader.d.mts +9 -1
- package/dist/lib/validation/schema-loader.d.ts +9 -1
- package/dist/lib/validation/schema-loader.js +65 -8
- package/dist/lib/validation/schema-loader.mjs +64 -8
- package/dist/lib/version.d.mts +5 -5
- package/dist/lib/version.d.ts +5 -5
- package/dist/lib/version.js +3 -8
- package/dist/lib/version.mjs +3 -8
- package/dist/lib/wholesale-feed-sync/index.d.mts +1 -0
- package/dist/lib/wholesale-feed-sync/index.d.ts +1 -0
- package/dist/lib/wholesale-feed-sync/protocol-types.d.mts +42 -0
- package/dist/lib/wholesale-feed-sync/protocol-types.d.ts +42 -0
- package/dist/lib/wholesale-feed-sync/protocol-types.js +16 -0
- package/dist/lib/wholesale-feed-sync/protocol-types.mjs +0 -0
- package/dist/lib/wholesale-feed-sync/sync.d.mts +6 -6
- package/dist/lib/wholesale-feed-sync/sync.d.ts +6 -6
- package/dist/lib/wholesale-feed-sync/sync.js +3 -1
- package/dist/lib/wholesale-feed-sync/sync.mjs +3 -1
- package/dist/lib/wholesale-feed-sync/types.d.mts +15 -14
- package/dist/lib/wholesale-feed-sync/types.d.ts +15 -14
- package/dist/lib/wholesale-feed-sync/webhook-notification.d.mts +7 -5
- package/dist/lib/wholesale-feed-sync/webhook-notification.d.ts +7 -5
- package/dist/lib/wholesale-feed-sync/webhook-notification.js +45 -0
- package/dist/lib/wholesale-feed-sync/webhook-notification.mjs +44 -0
- package/docs/CLI.md +1 -1
- package/docs/TYPE-SUMMARY.md +118 -4
- package/docs/guides/ASYNC-API-REFERENCE.md +62 -1
- package/docs/guides/ASYNC-DEVELOPER-GUIDE.md +25 -0
- package/docs/guides/ASYNC-DOCUMENTATION-INDEX.md +3 -0
- package/docs/guides/BUYER-QUICKSTART-3.2.md +5 -0
- package/docs/guides/DURABLE-BUYER-WRITES.md +337 -0
- package/docs/guides/EXISTING-PLATFORM.md +80 -1
- package/docs/guides/MEDIA-BUY-3.2-COMPATIBILITY.md +57 -0
- package/docs/guides/MEDIA-BUY-ACTION-ASSESSMENT.md +300 -0
- package/docs/guides/REPORTING-LEDGER.md +654 -3
- package/docs/guides/REPORTING-RECONCILIATION.md +50 -0
- package/docs/guides/REPORTING-SOURCE-EXECUTOR.md +63 -1
- package/docs/guides/SELLER-QUICKSTART-3.2.md +2 -0
- package/docs/guides/VALIDATE-YOUR-AGENT.md +35 -0
- package/docs/guides/idempotency-crash-recovery.md +4 -0
- package/docs/llms.txt +4 -2
- package/docs/migration-14.x-rc-worksheet.md +60 -5
- package/docs/migration-7.9-to-7.10.md +7 -5
- package/examples/README.md +17 -0
- package/examples/durable-buyer-writes/caller.ts +745 -0
- package/examples/durable-buyer-writes/worker.ts +240 -0
- package/examples/reliable-reporting-service/README.md +100 -0
- package/examples/seller-3.2-starter.ts +7 -8
- package/examples/targeting-input-existing-platform.ts +153 -0
- package/package.json +41 -29
- package/skills/build-seller-agent/SKILL.md +2 -0
- package/skills/build-seller-agent/specialisms/signed-requests.md +11 -1
- package/skills/cross-cutting.md +28 -11
- package/compliance/cache/3.1.0-beta.7/domains/brand/index.yaml +0 -160
- package/compliance/cache/3.1.0-beta.7/domains/brand/scenarios/distributed_brand_resolution.yaml +0 -415
- package/compliance/cache/3.1.0-beta.7/domains/brand/scenarios/single_side_trust_extension.yaml +0 -454
- package/compliance/cache/3.1.0-beta.7/domains/creative/index.yaml +0 -339
- package/compliance/cache/3.1.0-beta.7/domains/creative/scenarios/billing_out_of_band.yaml +0 -153
- package/compliance/cache/3.1.0-beta.7/domains/creative/scenarios/creative_lifecycle_webhooks.yaml +0 -389
- package/compliance/cache/3.1.0-beta.7/domains/creative/scenarios/native_in_feed.yaml +0 -543
- package/compliance/cache/3.1.0-beta.7/domains/governance/index.yaml +0 -682
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/index.yaml +0 -781
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/audience_buy_flow.yaml +0 -380
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/available_actions.yaml +0 -565
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/billing_finality_delivery.yaml +0 -354
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/canonical_formats.yaml +0 -711
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/clicks_buy_flow.yaml +0 -264
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/completed_views_buy_flow.yaml +0 -344
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/create_media_buy_async.yaml +0 -234
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/creative_fate_after_cancellation.yaml +0 -419
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/creative_reception.yaml +0 -247
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/delivery_reporting.yaml +0 -357
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/dependency_impairment.yaml +0 -633
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/dependency_impairment_cardinality.yaml +0 -800
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/event_dedup_flow.yaml +0 -399
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/frequency_cap_enforcement.yaml +0 -309
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/governance_approved.yaml +0 -214
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/governance_conditions.yaml +0 -199
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/governance_denied.yaml +0 -204
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/governance_denied_recovery.yaml +0 -252
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/invalid_transitions.yaml +0 -289
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/inventory_list_no_match.yaml +0 -148
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/inventory_list_targeting.yaml +0 -276
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/measurement_accountability.yaml +0 -244
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/measurement_terms_rejected.yaml +0 -203
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/pending_creatives_to_start.yaml +0 -274
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/per_creative_conversion_attribution.yaml +0 -500
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/performance_buy_flow.yaml +0 -428
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/performance_buy_flow_roas.yaml +0 -470
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/product_signal_targeting.yaml +0 -373
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/proposal_finalize.yaml +0 -399
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/proposal_finalize_asap_timing.yaml +0 -264
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/proposal_not_found_errors.yaml +0 -257
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/provenance_audit_observation.yaml +0 -333
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/provenance_enforcement.yaml +0 -517
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/provenance_truth_of_claim.yaml +0 -294
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/reach_buy_flow.yaml +0 -823
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/refine_finalize_exclusivity.yaml +0 -360
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/refine_products.yaml +0 -148
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/vendor_metric_accountability.yaml +0 -293
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/vendor_metric_catalog_precondition.yaml +0 -307
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/vendor_metric_optimization_flow.yaml +0 -576
- package/compliance/cache/3.1.0-beta.7/domains/media-buy/state-machine.yaml +0 -442
- package/compliance/cache/3.1.0-beta.7/domains/signals/index.yaml +0 -266
- package/compliance/cache/3.1.0-beta.7/domains/sponsored-intelligence/index.yaml +0 -256
- package/compliance/cache/3.1.0-beta.7/index.json +0 -356
- package/compliance/cache/3.1.0-beta.7/protocols/brand/index.yaml +0 -160
- package/compliance/cache/3.1.0-beta.7/protocols/brand/scenarios/distributed_brand_resolution.yaml +0 -415
- package/compliance/cache/3.1.0-beta.7/protocols/brand/scenarios/single_side_trust_extension.yaml +0 -454
- package/compliance/cache/3.1.0-beta.7/protocols/creative/index.yaml +0 -339
- package/compliance/cache/3.1.0-beta.7/protocols/creative/scenarios/billing_out_of_band.yaml +0 -153
- package/compliance/cache/3.1.0-beta.7/protocols/creative/scenarios/creative_lifecycle_webhooks.yaml +0 -389
- package/compliance/cache/3.1.0-beta.7/protocols/creative/scenarios/native_in_feed.yaml +0 -543
- package/compliance/cache/3.1.0-beta.7/protocols/governance/index.yaml +0 -682
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/index.yaml +0 -781
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/audience_buy_flow.yaml +0 -380
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/available_actions.yaml +0 -565
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/billing_finality_delivery.yaml +0 -354
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/canonical_formats.yaml +0 -711
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/clicks_buy_flow.yaml +0 -264
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/completed_views_buy_flow.yaml +0 -344
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/create_media_buy_async.yaml +0 -234
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/creative_fate_after_cancellation.yaml +0 -419
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/creative_reception.yaml +0 -247
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/delivery_reporting.yaml +0 -357
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/dependency_impairment.yaml +0 -633
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/dependency_impairment_cardinality.yaml +0 -800
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/event_dedup_flow.yaml +0 -399
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/frequency_cap_enforcement.yaml +0 -309
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/governance_approved.yaml +0 -214
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/governance_conditions.yaml +0 -199
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/governance_denied.yaml +0 -204
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/governance_denied_recovery.yaml +0 -252
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/invalid_transitions.yaml +0 -289
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/inventory_list_no_match.yaml +0 -148
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/inventory_list_targeting.yaml +0 -276
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/measurement_accountability.yaml +0 -244
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/measurement_terms_rejected.yaml +0 -203
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/pending_creatives_to_start.yaml +0 -274
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/per_creative_conversion_attribution.yaml +0 -500
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/performance_buy_flow.yaml +0 -428
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/performance_buy_flow_roas.yaml +0 -470
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/product_signal_targeting.yaml +0 -373
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/proposal_finalize.yaml +0 -399
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/proposal_finalize_asap_timing.yaml +0 -264
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/proposal_not_found_errors.yaml +0 -257
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/provenance_audit_observation.yaml +0 -333
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/provenance_enforcement.yaml +0 -517
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/provenance_truth_of_claim.yaml +0 -294
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/reach_buy_flow.yaml +0 -823
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/refine_finalize_exclusivity.yaml +0 -360
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/refine_products.yaml +0 -148
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/vendor_metric_accountability.yaml +0 -293
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/vendor_metric_catalog_precondition.yaml +0 -307
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/vendor_metric_optimization_flow.yaml +0 -576
- package/compliance/cache/3.1.0-beta.7/protocols/media-buy/state-machine.yaml +0 -442
- package/compliance/cache/3.1.0-beta.7/protocols/signals/index.yaml +0 -266
- package/compliance/cache/3.1.0-beta.7/protocols/sponsored-intelligence/index.yaml +0 -256
- package/compliance/cache/3.1.0-beta.7/specialisms/audience-sync/index.yaml +0 -313
- package/compliance/cache/3.1.0-beta.7/specialisms/brand-rights/index.yaml +0 -350
- package/compliance/cache/3.1.0-beta.7/specialisms/brand-rights/scenarios/governance_denied.yaml +0 -226
- package/compliance/cache/3.1.0-beta.7/specialisms/collection-lists/index.yaml +0 -359
- package/compliance/cache/3.1.0-beta.7/specialisms/content-standards/index.yaml +0 -572
- package/compliance/cache/3.1.0-beta.7/specialisms/creative-ad-server/index.yaml +0 -409
- package/compliance/cache/3.1.0-beta.7/specialisms/creative-generative/generative-seller.yaml +0 -807
- package/compliance/cache/3.1.0-beta.7/specialisms/creative-generative/index.yaml +0 -758
- package/compliance/cache/3.1.0-beta.7/specialisms/creative-template/index.yaml +0 -510
- package/compliance/cache/3.1.0-beta.7/specialisms/governance-aware-seller/index.yaml +0 -143
- package/compliance/cache/3.1.0-beta.7/specialisms/governance-aware-seller/scenarios/governance_multi_agent_rejected.yaml +0 -117
- package/compliance/cache/3.1.0-beta.7/specialisms/governance-delivery-monitor/index.yaml +0 -441
- package/compliance/cache/3.1.0-beta.7/specialisms/governance-spend-authority/denied.yaml +0 -221
- package/compliance/cache/3.1.0-beta.7/specialisms/governance-spend-authority/index.yaml +0 -330
- package/compliance/cache/3.1.0-beta.7/specialisms/property-lists/index.yaml +0 -482
- package/compliance/cache/3.1.0-beta.7/specialisms/sales-broadcast-tv/index.yaml +0 -738
- package/compliance/cache/3.1.0-beta.7/specialisms/sales-catalog-driven/index.yaml +0 -840
- package/compliance/cache/3.1.0-beta.7/specialisms/sales-guaranteed/index.yaml +0 -601
- package/compliance/cache/3.1.0-beta.7/specialisms/sales-non-guaranteed/index.yaml +0 -546
- package/compliance/cache/3.1.0-beta.7/specialisms/sales-proposal-mode/index.yaml +0 -586
- package/compliance/cache/3.1.0-beta.7/specialisms/sales-social/index.yaml +0 -919
- package/compliance/cache/3.1.0-beta.7/specialisms/signal-marketplace/index.yaml +0 -424
- package/compliance/cache/3.1.0-beta.7/specialisms/signal-marketplace/scenarios/governance_denied.yaml +0 -211
- package/compliance/cache/3.1.0-beta.7/specialisms/signal-owned/index.yaml +0 -317
- package/compliance/cache/3.1.0-beta.7/specialisms/sponsored-intelligence/index.yaml +0 -59
- package/compliance/cache/3.1.0-beta.7/test-kits/acme-outdoor-live.yaml +0 -78
- package/compliance/cache/3.1.0-beta.7/test-kits/acme-outdoor.yaml +0 -223
- package/compliance/cache/3.1.0-beta.7/test-kits/billing-gate-runner.yaml +0 -115
- package/compliance/cache/3.1.0-beta.7/test-kits/bistro-oranje.yaml +0 -126
- package/compliance/cache/3.1.0-beta.7/test-kits/distributed-brand-runner.yaml +0 -281
- package/compliance/cache/3.1.0-beta.7/test-kits/nova-motors.yaml +0 -262
- package/compliance/cache/3.1.0-beta.7/test-kits/osei-natural.yaml +0 -126
- package/compliance/cache/3.1.0-beta.7/test-kits/parallel-dispatch-runner.yaml +0 -196
- package/compliance/cache/3.1.0-beta.7/test-kits/rate-limit-trip-runner.yaml +0 -172
- package/compliance/cache/3.1.0-beta.7/test-kits/signed-requests-runner.yaml +0 -155
- package/compliance/cache/3.1.0-beta.7/test-kits/single-side-trust-runner.yaml +0 -294
- package/compliance/cache/3.1.0-beta.7/test-kits/substitution-observer-runner.yaml +0 -688
- package/compliance/cache/3.1.0-beta.7/test-kits/summit-foods.yaml +0 -125
- package/compliance/cache/3.1.0-beta.7/test-kits/webhook-receiver-runner.yaml +0 -265
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/001-minimal-plan.json +0 -43
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/002-full-plan.json +0 -217
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/003-bookkeeping-stripped.json +0 -60
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/004a-human-review-omitted.json +0 -43
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/004b-human-review-explicit-null.json +0 -49
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/005a-policy-categories-order-1.json +0 -53
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/005b-policy-categories-order-2.json +0 -57
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/006a-ext-trace-v1.json +0 -49
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/006b-ext-trace-v2.json +0 -53
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/007-unicode-objectives.json +0 -43
- package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/008-numeric-canonicalization.json +0 -65
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/README.md +0 -220
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/canonicalization.json +0 -241
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/keys.json +0 -60
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/001-no-signature-header.json +0 -24
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/002-wrong-tag.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/003-expired-signature.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/004-window-too-long.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/005-alg-not-allowed.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/006-missing-covered-component.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/007-missing-content-digest.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/008-unknown-keyid.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/009-key-ops-missing-verify.json +0 -27
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/010-content-digest-mismatch.json +0 -33
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/011-malformed-header.json +0 -27
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/012-missing-expires-param.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/013-expires-le-created.json +0 -27
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/014-missing-nonce-param.json +0 -27
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/015-signature-invalid.json +0 -28
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/016-replayed-nonce.json +0 -35
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/017-key-revoked.json +0 -38
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/018-digest-covered-when-forbidden.json +0 -28
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/019-signature-without-signature-input.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/020-rate-abuse.json +0 -34
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/021-duplicate-signature-input-label.json +0 -31
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/022-multi-valued-content-type.json +0 -31
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/023-multi-valued-content-digest.json +0 -32
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/024-unquoted-string-param.json +0 -31
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/025-jwk-alg-crv-mismatch.json +0 -43
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/026-non-ascii-host.json +0 -31
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/027-webhook-registration-authentication-unsigned.json +0 -25
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/028-unsigned-protocol-method-required.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/001-basic-post.json +0 -30
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/002-post-with-content-digest.json +0 -31
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/003-es256-post.json +0 -30
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/004-multiple-signature-labels.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/005-default-port-stripped.json +0 -30
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/006-dot-segment-path.json +0 -30
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/007-query-byte-preserved.json +0 -30
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/008-percent-encoded-path.json +0 -30
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/009-percent-encoded-unreserved-decoded.json +0 -30
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/010-percent-encoded-slash-preserved.json +0 -30
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/011-ipv6-authority.json +0 -30
- package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/012-ipv6-authority-default-port-stripped.json +0 -30
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/README.md +0 -211
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/keys.json +0 -61
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/001-wrong-tag.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/002-expired-signature.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/003-window-too-long.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/004-alg-not-allowed.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/005-missing-authority-component.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/006-missing-content-digest.json +0 -25
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/007-unknown-keyid.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/008-wrong-adcp-use.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/009-content-digest-mismatch.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/010-malformed-signature-input.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/011-signature-without-input.json +0 -25
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/012-missing-expires-param.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/013-expires-le-created.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/014-missing-nonce-param.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/015-signature-invalid.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/016-replayed-nonce.json +0 -37
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/017-key-revoked.json +0 -32
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/018-rate-abuse.json +0 -33
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/019-revocation-stale.json +0 -32
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/020-key-ops-missing-verify.json +0 -41
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/021-base64-alphabet-mixing.json +0 -26
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/001-basic-post.json +0 -24
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/002-es256-post.json +0 -24
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/003-multiple-signature-labels.json +0 -24
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/004-default-port-stripped.json +0 -24
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/005-percent-encoded-path.json +0 -24
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/006-query-byte-preserved.json +0 -24
- package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/007-body-without-idempotency-key.json +0 -25
- package/compliance/cache/3.1.0-beta.7/universal/billing-gate-dispatch.yaml +0 -450
- package/compliance/cache/3.1.0-beta.7/universal/canonical-format-validate-input.yaml +0 -640
- package/compliance/cache/3.1.0-beta.7/universal/capability-discovery.yaml +0 -125
- package/compliance/cache/3.1.0-beta.7/universal/collection-lists-pagination-integrity.yaml +0 -306
- package/compliance/cache/3.1.0-beta.7/universal/comply-controller-mode-gate.yaml +0 -141
- package/compliance/cache/3.1.0-beta.7/universal/content-standards-pagination-integrity.yaml +0 -326
- package/compliance/cache/3.1.0-beta.7/universal/deterministic-testing.yaml +0 -1430
- package/compliance/cache/3.1.0-beta.7/universal/error-compliance-signals.yaml +0 -377
- package/compliance/cache/3.1.0-beta.7/universal/error-compliance.yaml +0 -528
- package/compliance/cache/3.1.0-beta.7/universal/fictional-entities.yaml +0 -307
- package/compliance/cache/3.1.0-beta.7/universal/get-media-buys-pagination-integrity.yaml +0 -160
- package/compliance/cache/3.1.0-beta.7/universal/get-signals-pagination-integrity.yaml +0 -211
- package/compliance/cache/3.1.0-beta.7/universal/idempotency.yaml +0 -861
- package/compliance/cache/3.1.0-beta.7/universal/notification-config-event-scope.yaml +0 -119
- package/compliance/cache/3.1.0-beta.7/universal/notification-config-lifecycle.yaml +0 -337
- package/compliance/cache/3.1.0-beta.7/universal/notification-config-rejections.yaml +0 -107
- package/compliance/cache/3.1.0-beta.7/universal/pagination-integrity-creative-formats.yaml +0 -265
- package/compliance/cache/3.1.0-beta.7/universal/pagination-integrity-list-accounts.yaml +0 -245
- package/compliance/cache/3.1.0-beta.7/universal/pagination-integrity.yaml +0 -263
- package/compliance/cache/3.1.0-beta.7/universal/property-lists-pagination-integrity.yaml +0 -307
- package/compliance/cache/3.1.0-beta.7/universal/read-tool-idempotency.yaml +0 -405
- package/compliance/cache/3.1.0-beta.7/universal/runner-output-contract.yaml +0 -1266
- package/compliance/cache/3.1.0-beta.7/universal/schema-validation-signals.yaml +0 -181
- package/compliance/cache/3.1.0-beta.7/universal/schema-validation.yaml +0 -548
- package/compliance/cache/3.1.0-beta.7/universal/security.yaml +0 -539
- package/compliance/cache/3.1.0-beta.7/universal/signed-requests.yaml +0 -217
- package/compliance/cache/3.1.0-beta.7/universal/stale-response-advisory.yaml +0 -295
- package/compliance/cache/3.1.0-beta.7/universal/storyboard-schema.yaml +0 -2136
- package/compliance/cache/3.1.0-beta.7/universal/v3-envelope-integrity.yaml +0 -117
- package/compliance/cache/3.1.0-beta.7/universal/version-negotiation.yaml +0 -130
- package/compliance/cache/3.1.0-beta.7/universal/webhook-emission.yaml +0 -411
- package/compliance/cache/3.1.0-beta.7/universal/wholesale-feed-bulk-webhooks.yaml +0 -82
- package/compliance/cache/3.1.0-beta.7/universal/wholesale-feed-product-webhooks.yaml +0 -83
- package/compliance/cache/3.1.0-beta.7/universal/wholesale-feed-products.yaml +0 -151
- package/compliance/cache/3.1.0-beta.7/universal/wholesale-feed-signal-webhooks.yaml +0 -83
- package/compliance/cache/3.1.0-beta.7/universal/wholesale-feed-signals.yaml +0 -149
- package/dist/lib/types/v3-1-beta/index.d.mts +0 -1
- package/dist/lib/types/v3-1-beta/index.d.ts +0 -1
- package/dist/lib/types/v3-1-beta/index.mjs +0 -1
- package/dist/lib/types/v3-1-beta/tools.generated.d.mts +0 -26788
- package/dist/lib/types/v3-1-beta/tools.generated.d.ts +0 -26788
- /package/dist/lib/{types/v3-1-beta/tools.generated.mjs → media-buy/action-types.mjs} +0 -0
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { ReportingDeliveryCapabilitiesSchema, ReportingMaterializationSchema } from "../../types/schemas.generated.mjs";
|
|
3
|
+
import { canonicalize } from "../../utils/jcs.mjs";
|
|
4
|
+
import { getSchemaValidatorByRef } from "../../validation/schema-loader.mjs";
|
|
5
|
+
import {
|
|
6
|
+
isReportingAdjustmentReceiptEvidence,
|
|
7
|
+
isReportingReceiptEvidence,
|
|
8
|
+
isReportingVerificationEvidence
|
|
9
|
+
} from "../evidence.mjs";
|
|
10
|
+
import { AdcpError } from "../../server/decisioning/async-outcome.mjs";
|
|
11
|
+
import { createReportingDeliveryHandler, createReportingStatusHandler } from "./handler.mjs";
|
|
12
|
+
const DEFAULT_LEASE_MILLISECONDS = 65e3;
|
|
13
|
+
const DEFAULT_DELIVERY_DEADLINE_MILLISECONDS = 6e4;
|
|
14
|
+
const MINIMUM_SETTLEMENT_GRACE_MILLISECONDS = 5e3;
|
|
15
|
+
const DEFAULT_RESOURCE_MAX_BYTES = 64 * 1024 * 1024;
|
|
16
|
+
const MAX_DESCRIPTOR_BYTES = 1024 * 1024;
|
|
17
|
+
const MAX_NODE_TIMER_DELAY_MILLISECONDS = 2147483647;
|
|
18
|
+
const NANOSECONDS_PER_MILLISECOND = 1000000n;
|
|
19
|
+
const MAX_RECEIPTS_PER_ARRAY = 100;
|
|
20
|
+
const MAX_RECEIPT_RESULTS = 100;
|
|
21
|
+
const MAX_RECEIPT_EVIDENCE_BYTES = 64 * 1024;
|
|
22
|
+
async function createReportingManagedDeliveryRuntime(options) {
|
|
23
|
+
if (!await options.store.probe(options.coreStore)) {
|
|
24
|
+
throw new Error("Managed reporting store is not operational for the configured Core authority");
|
|
25
|
+
}
|
|
26
|
+
if (typeof options.store.adoptAdvertisedPolicies !== "function") {
|
|
27
|
+
throw new Error(
|
|
28
|
+
"Managed Delivery capability publication requires atomic durable adoption of every advertised policy"
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
nonnegativeInteger(options.automatedRecoveryWindowSeconds, "automatedRecoveryWindowSeconds");
|
|
32
|
+
positiveInteger(options.statusRetentionDays, "statusRetentionDays");
|
|
33
|
+
positiveInteger(options.resourceRetentionDays, "resourceRetentionDays");
|
|
34
|
+
nonnegativeInteger(options.authorizationRevocationSeconds, "authorizationRevocationSeconds");
|
|
35
|
+
if (typeof options.adapter.deliver !== "function" || typeof options.adapter.read !== "function" || typeof options.adapter.revoke !== "function" || options.adapter.revocationFencesDeliveryGenerations !== true) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
"Managed Delivery requires delivery, resource-reader, and provider generation-fencing revocation components"
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
assertManagedOfferings(options.offerings);
|
|
41
|
+
if (!options.offerings.length || !options.offerings.some((offering) => offering.method !== void 0)) {
|
|
42
|
+
throw new Error("Managed Delivery requires at least one atomic managed offering");
|
|
43
|
+
}
|
|
44
|
+
const reconciledOfferings = options.offerings.filter((offering) => offering.reconciliation_mode === "consumer_receipt");
|
|
45
|
+
if (!options.adapter.verificationProfiles.length) {
|
|
46
|
+
throw new Error("Managed Delivery requires an installed verification profile");
|
|
47
|
+
}
|
|
48
|
+
if (reconciledOfferings.length > 0 && (options.resolveConsumerId === void 0 || !options.adapter.verificationProfiles.includes("canonical_digest"))) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
"Consumer-receipt offerings require an authenticated receipt handler and canonical-digest verifier"
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
const reconciledBilling = reconciledOfferings.length > 0;
|
|
54
|
+
for (const offering of reconciledOfferings) {
|
|
55
|
+
const profile = offering.reporting_profile;
|
|
56
|
+
if (!profile.canonicalization_id || !profile.canonicalization_uri || !profile.canonicalization_sha256) {
|
|
57
|
+
throw new Error("Reconciled Billing offerings require the pinned canonicalization contract");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const statusOptions = options.resolveConsumerId ? {
|
|
61
|
+
resolveConsumerId: options.resolveConsumerId,
|
|
62
|
+
...options.consumerMismatchEscalation ? { consumerMismatchEscalation: options.consumerMismatchEscalation } : {}
|
|
63
|
+
} : void 0;
|
|
64
|
+
const getReportingStatus = createReportingStatusHandler(options.coreStore, statusOptions);
|
|
65
|
+
const getMediaBuyDelivery = createReportingDeliveryHandler(options.coreStore);
|
|
66
|
+
const syncReportingReceipts = reconciledBilling ? createSyncReportingReceiptsHandler(options.store, options.resolveConsumerId) : void 0;
|
|
67
|
+
const reportingDeliveryCapabilities = {
|
|
68
|
+
supported: true,
|
|
69
|
+
reliable_reporting_version: "1.0",
|
|
70
|
+
managed_delivery: true,
|
|
71
|
+
...reconciledBilling ? { reconciled_billing: true, receipt_task: "sync_reporting_receipts" } : {},
|
|
72
|
+
configuration_task: "sync_accounts",
|
|
73
|
+
status_task: "get_reporting_status",
|
|
74
|
+
revision_content_task: "get_media_buy_delivery",
|
|
75
|
+
offerings: [...options.offerings],
|
|
76
|
+
automated_recovery_window_seconds: options.automatedRecoveryWindowSeconds,
|
|
77
|
+
status_retention_days: options.statusRetentionDays,
|
|
78
|
+
resource_retention_days: options.resourceRetentionDays,
|
|
79
|
+
authorization_revocation_seconds: options.authorizationRevocationSeconds
|
|
80
|
+
};
|
|
81
|
+
const parsedCapabilities = ReportingDeliveryCapabilitiesSchema.safeParse(reportingDeliveryCapabilities);
|
|
82
|
+
if (!parsedCapabilities.success) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
`Managed Delivery capability wiring is invalid: ${parsedCapabilities.error.issues[0]?.message ?? "invalid"}`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
const adoptedPolicy = await options.store.adoptAdvertisedPolicies({
|
|
88
|
+
automatedRecoveryWindowSeconds: options.automatedRecoveryWindowSeconds,
|
|
89
|
+
statusRetentionDays: options.statusRetentionDays,
|
|
90
|
+
resourceRetentionDays: options.resourceRetentionDays,
|
|
91
|
+
authorizationRevocationSeconds: options.authorizationRevocationSeconds
|
|
92
|
+
});
|
|
93
|
+
nonnegativeInteger(adoptedPolicy.automatedRecoveryWindowSeconds, "adopted automatedRecoveryWindowSeconds");
|
|
94
|
+
positiveInteger(adoptedPolicy.statusRetentionDays, "adopted statusRetentionDays");
|
|
95
|
+
positiveInteger(adoptedPolicy.resourceRetentionDays, "adopted resourceRetentionDays");
|
|
96
|
+
nonnegativeInteger(adoptedPolicy.authorizationRevocationSeconds, "adopted authorizationRevocationSeconds");
|
|
97
|
+
if (adoptedPolicy.automatedRecoveryWindowSeconds > options.automatedRecoveryWindowSeconds || adoptedPolicy.statusRetentionDays < options.statusRetentionDays || adoptedPolicy.resourceRetentionDays < options.resourceRetentionDays || adoptedPolicy.authorizationRevocationSeconds > options.authorizationRevocationSeconds) {
|
|
98
|
+
throw new Error("Managed Delivery policy adoption returned values weaker than the capability being published");
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
reportingDeliveryCapabilities,
|
|
102
|
+
getReportingStatus,
|
|
103
|
+
getMediaBuyDelivery,
|
|
104
|
+
...syncReportingReceipts ? { syncReportingReceipts } : {},
|
|
105
|
+
runWorker: (workerOptions) => runManagedDeliveryWorker(options.store, options.adapter, {
|
|
106
|
+
...workerOptions,
|
|
107
|
+
minimumResourceRetentionDays: Math.max(
|
|
108
|
+
options.resourceRetentionDays,
|
|
109
|
+
adoptedPolicy.resourceRetentionDays,
|
|
110
|
+
workerOptions?.minimumResourceRetentionDays ?? 0
|
|
111
|
+
),
|
|
112
|
+
// The capability block is the promise; the worker is what keeps it.
|
|
113
|
+
// A caller may only tighten the advertised window, never widen it.
|
|
114
|
+
authorizationRevocationSeconds: Math.min(
|
|
115
|
+
options.authorizationRevocationSeconds,
|
|
116
|
+
adoptedPolicy.authorizationRevocationSeconds,
|
|
117
|
+
workerOptions?.authorizationRevocationSeconds ?? options.authorizationRevocationSeconds
|
|
118
|
+
)
|
|
119
|
+
}),
|
|
120
|
+
readResource: (input) => readManagedReportingResource(options.store, options.adapter, input)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function createSyncReportingReceiptsHandler(store, resolveConsumerId, now = () => /* @__PURE__ */ new Date()) {
|
|
124
|
+
return async (request, context) => {
|
|
125
|
+
const account_id = resolvedAccountId(context.account);
|
|
126
|
+
const consumer_id = await resolveConsumerId(context);
|
|
127
|
+
if (!consumer_id || consumer_id.length > 255) {
|
|
128
|
+
throw new TypeError("resolveConsumerId must return a durable authenticated principal of at most 255 characters");
|
|
129
|
+
}
|
|
130
|
+
if (request.receipts !== void 0 && !Array.isArray(request.receipts)) {
|
|
131
|
+
throw new AdcpError("VALIDATION_ERROR", { message: "sync_reporting_receipts receipts must be an array" });
|
|
132
|
+
}
|
|
133
|
+
if (request.adjustment_receipts !== void 0 && !Array.isArray(request.adjustment_receipts)) {
|
|
134
|
+
throw new AdcpError("VALIDATION_ERROR", {
|
|
135
|
+
message: "sync_reporting_receipts adjustment_receipts must be an array"
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const revisionReceipts = request.receipts ?? [];
|
|
139
|
+
const adjustmentReceipts = request.adjustment_receipts ?? [];
|
|
140
|
+
if (!revisionReceipts.every(isRecord) || !adjustmentReceipts.every(isRecord)) {
|
|
141
|
+
throw new AdcpError("VALIDATION_ERROR", {
|
|
142
|
+
message: "sync_reporting_receipts entries must be objects"
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (revisionReceipts.length > MAX_RECEIPTS_PER_ARRAY || adjustmentReceipts.length > MAX_RECEIPTS_PER_ARRAY) {
|
|
146
|
+
throw new AdcpError("VALIDATION_ERROR", {
|
|
147
|
+
message: `sync_reporting_receipts accepts at most ${MAX_RECEIPTS_PER_ARRAY} receipts and ${MAX_RECEIPTS_PER_ARRAY} adjustment receipts per request`
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if ([...revisionReceipts, ...adjustmentReceipts].some((receipt) => "received_at" in receipt)) {
|
|
151
|
+
throw new AdcpError("VALIDATION_ERROR", {
|
|
152
|
+
message: "sync_reporting_receipts receipts must not carry received_at; it is assigned by the server"
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
const entries = [
|
|
156
|
+
...revisionReceipts.map((receipt) => ({ kind: "revision", receipt })),
|
|
157
|
+
...adjustmentReceipts.map((receipt) => ({
|
|
158
|
+
kind: "adjustment",
|
|
159
|
+
receipt
|
|
160
|
+
}))
|
|
161
|
+
];
|
|
162
|
+
if (entries.length > MAX_RECEIPT_RESULTS) {
|
|
163
|
+
throw new AdcpError("VALIDATION_ERROR", {
|
|
164
|
+
message: `sync_reporting_receipts can return at most ${MAX_RECEIPT_RESULTS} results, so a request may carry at most ${MAX_RECEIPT_RESULTS} receipts and adjustment receipts in total`
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (!entries.length) {
|
|
168
|
+
throw new AdcpError("VALIDATION_ERROR", {
|
|
169
|
+
message: "sync_reporting_receipts requires at least one receipt or adjustment receipt"
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (request.account && "account_id" in request.account && request.account.account_id !== account_id) {
|
|
173
|
+
return receiptBatchFailure(entries, "PERMISSION_DENIED", "Reporting receipt account is unavailable");
|
|
174
|
+
}
|
|
175
|
+
if (!/^[A-Za-z0-9_.:-]{16,255}$/.test(request.idempotency_key)) {
|
|
176
|
+
return receiptBatchFailure(entries, "VALIDATION_ERROR", "sync_reporting_receipts idempotency_key is invalid");
|
|
177
|
+
}
|
|
178
|
+
const submittedIds = entries.map(
|
|
179
|
+
(entry) => isRecord(entry.receipt) && typeof entry.receipt.reporting_receipt_id === "string" ? entry.receipt.reporting_receipt_id : ""
|
|
180
|
+
);
|
|
181
|
+
const duplicateSubmittedIds = new Set(
|
|
182
|
+
submittedIds.filter((value, index) => value !== "" && submittedIds.indexOf(value) !== index)
|
|
183
|
+
);
|
|
184
|
+
if (duplicateSubmittedIds.size) {
|
|
185
|
+
return receiptBatchFailure(
|
|
186
|
+
entries,
|
|
187
|
+
"VALIDATION_ERROR",
|
|
188
|
+
"sync_reporting_receipts receipt IDs must be unique across the batch"
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
const evidenceValid = entries.map(
|
|
192
|
+
(entry) => entry.kind === "revision" ? isReportingReceiptEvidence(entry.receipt) : isReportingAdjustmentReceiptEvidence(entry.receipt)
|
|
193
|
+
);
|
|
194
|
+
const oversized = entries.map(
|
|
195
|
+
(entry) => Buffer.byteLength(JSON.stringify(entry.receipt), "utf8") > MAX_RECEIPT_EVIDENCE_BYTES
|
|
196
|
+
);
|
|
197
|
+
const valid = entries.map((_, index) => evidenceValid[index] && !oversized[index]);
|
|
198
|
+
const validEntries = entries.filter((_, index) => valid[index]);
|
|
199
|
+
const request_fingerprint = sha256({ entries });
|
|
200
|
+
const stored = validEntries.length ? await store.syncReceiptBatch({
|
|
201
|
+
account_id,
|
|
202
|
+
consumer_id,
|
|
203
|
+
idempotency_key: request.idempotency_key,
|
|
204
|
+
request_fingerprint,
|
|
205
|
+
entries: validEntries,
|
|
206
|
+
received_at: now().toISOString()
|
|
207
|
+
}) : [];
|
|
208
|
+
let storedIndex = 0;
|
|
209
|
+
return {
|
|
210
|
+
status: "completed",
|
|
211
|
+
results: entries.map((entry, index) => {
|
|
212
|
+
if (valid[index]) return stored[storedIndex++];
|
|
213
|
+
const field = entry.kind === "revision" ? `receipts[${index}]` : `adjustment_receipts[${index - revisionReceipts.length}]`;
|
|
214
|
+
return oversized[index] ? receiptFailure(
|
|
215
|
+
reflectableReceiptId(entry.receipt.reporting_receipt_id, index),
|
|
216
|
+
"VALIDATION_ERROR",
|
|
217
|
+
"Reporting receipt evidence exceeds the 64 KiB limit",
|
|
218
|
+
{
|
|
219
|
+
field,
|
|
220
|
+
suggestion: `Reduce ${field} to 64 KiB or less and retry.`
|
|
221
|
+
}
|
|
222
|
+
) : receiptFailure(
|
|
223
|
+
reflectableReceiptId(entry.receipt.reporting_receipt_id, index),
|
|
224
|
+
"VALIDATION_ERROR",
|
|
225
|
+
"Reporting receipt evidence is malformed",
|
|
226
|
+
{
|
|
227
|
+
field,
|
|
228
|
+
suggestion: `Correct ${field} to satisfy the reporting receipt evidence schema and retry.`
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
})
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function receiptBatchFailure(entries, code, message) {
|
|
236
|
+
return {
|
|
237
|
+
status: "completed",
|
|
238
|
+
results: entries.map(
|
|
239
|
+
(entry, index) => receiptFailure(reflectableReceiptId(entry.receipt.reporting_receipt_id, index), code, message)
|
|
240
|
+
)
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
const RECEIPT_ID_PATTERN = /^[A-Za-z0-9_.:-]{16,255}$/;
|
|
244
|
+
function reflectableReceiptId(value, index) {
|
|
245
|
+
return typeof value === "string" && RECEIPT_ID_PATTERN.test(value) ? value : `unidentified-reporting-receipt-${String(index).padStart(3, "0")}`;
|
|
246
|
+
}
|
|
247
|
+
function receiptFailure(reporting_receipt_id, code, message, metadata = {}) {
|
|
248
|
+
return {
|
|
249
|
+
result: "failed",
|
|
250
|
+
reporting_receipt_id,
|
|
251
|
+
errors: [{ code, message, recovery: "correctable", ...metadata }]
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
async function runManagedDeliveryWorker(store, adapter, options = {}) {
|
|
255
|
+
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
256
|
+
const maxIterations = options.maxIterations ?? 25;
|
|
257
|
+
const leaseMilliseconds = options.leaseMilliseconds ?? DEFAULT_LEASE_MILLISECONDS;
|
|
258
|
+
const deadlineMilliseconds = options.deliveryDeadlineMilliseconds ?? DEFAULT_DELIVERY_DEADLINE_MILLISECONDS;
|
|
259
|
+
const resourceMaxBytes = options.resourceMaxBytes ?? DEFAULT_RESOURCE_MAX_BYTES;
|
|
260
|
+
const minimumResourceRetentionDays = options.minimumResourceRetentionDays ?? 1;
|
|
261
|
+
positiveInteger(maxIterations, "maxIterations");
|
|
262
|
+
positiveInteger(leaseMilliseconds, "leaseMilliseconds");
|
|
263
|
+
positiveInteger(deadlineMilliseconds, "deliveryDeadlineMilliseconds");
|
|
264
|
+
positiveInteger(resourceMaxBytes, "resourceMaxBytes");
|
|
265
|
+
positiveInteger(minimumResourceRetentionDays, "minimumResourceRetentionDays");
|
|
266
|
+
if (leaseMilliseconds < deadlineMilliseconds + MINIMUM_SETTLEMENT_GRACE_MILLISECONDS) {
|
|
267
|
+
throw new RangeError("leaseMilliseconds must include at least 5 seconds of post-delivery settlement grace");
|
|
268
|
+
}
|
|
269
|
+
if (options.authorizationRevocationSeconds !== void 0) {
|
|
270
|
+
nonnegativeInteger(options.authorizationRevocationSeconds, "authorizationRevocationSeconds");
|
|
271
|
+
}
|
|
272
|
+
const revocationWindow = options.authorizationRevocationSeconds === void 0 ? void 0 : options.authorizationRevocationSeconds * 1e3;
|
|
273
|
+
const revocationLeaseMilliseconds = revocationWindow === void 0 ? leaseMilliseconds : Math.min(leaseMilliseconds, deadlineMilliseconds + MINIMUM_SETTLEMENT_GRACE_MILLISECONDS);
|
|
274
|
+
const owner = `managed-reporting-${randomUUID()}`;
|
|
275
|
+
const exhausted = await store.failExhaustedMaterializations?.({
|
|
276
|
+
...options.account_id ? { account_id: options.account_id } : {}
|
|
277
|
+
}) ?? 0;
|
|
278
|
+
const counts = {
|
|
279
|
+
exhausted,
|
|
280
|
+
planned: await store.planMaterializations({ ...options.account_id ? { account_id: options.account_id } : {} }),
|
|
281
|
+
claimed: 0,
|
|
282
|
+
delivered: 0,
|
|
283
|
+
failed: 0,
|
|
284
|
+
revocationsCompleted: 0,
|
|
285
|
+
revocationsOverdue: 0
|
|
286
|
+
};
|
|
287
|
+
for (let index = 0; index < maxIterations; index += 1) {
|
|
288
|
+
options.signal?.throwIfAborted();
|
|
289
|
+
const revocation = await store.claimRevocation({
|
|
290
|
+
owner,
|
|
291
|
+
now: now().toISOString(),
|
|
292
|
+
lease_milliseconds: revocationLeaseMilliseconds,
|
|
293
|
+
...options.account_id ? { account_id: options.account_id } : {},
|
|
294
|
+
...options.authorizationRevocationSeconds !== void 0 ? {
|
|
295
|
+
authorization_revocation_seconds: options.authorizationRevocationSeconds,
|
|
296
|
+
// A holder is only displaced after it has had a full attempt's
|
|
297
|
+
// worth of time, which recovers a crashed worker without letting
|
|
298
|
+
// live workers steal from each other on an already-late grant.
|
|
299
|
+
steal_after_milliseconds: deadlineMilliseconds + MINIMUM_SETTLEMENT_GRACE_MILLISECONDS
|
|
300
|
+
} : {}
|
|
301
|
+
});
|
|
302
|
+
if (!revocation) break;
|
|
303
|
+
const remaining = revocation.remaining_milliseconds ?? remainingRevocationMilliseconds(revocation, revocationWindow, now());
|
|
304
|
+
const overdue = revocation.overdue ?? (remaining !== void 0 && remaining <= 0);
|
|
305
|
+
if (overdue) counts.revocationsOverdue += 1;
|
|
306
|
+
const attemptDeadline = remaining !== void 0 && remaining > 0 ? Math.min(deadlineMilliseconds, remaining) : deadlineMilliseconds;
|
|
307
|
+
try {
|
|
308
|
+
await withinDeadline(
|
|
309
|
+
(signal) => adapter.revoke({ authorization: revocation.authorization }, { signal }),
|
|
310
|
+
attemptDeadline,
|
|
311
|
+
"Reporting revocation deadline elapsed",
|
|
312
|
+
options.signal
|
|
313
|
+
);
|
|
314
|
+
if (await store.completeRevocation({ lease: revocation, completed_at: now().toISOString() })) {
|
|
315
|
+
counts.revocationsCompleted += 1;
|
|
316
|
+
}
|
|
317
|
+
} catch {
|
|
318
|
+
await store.releaseRevocation({ lease: revocation });
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
for (let index = 0; index < maxIterations; index += 1) {
|
|
322
|
+
options.signal?.throwIfAborted();
|
|
323
|
+
const lease = await store.claimMaterialization({
|
|
324
|
+
owner,
|
|
325
|
+
now: now().toISOString(),
|
|
326
|
+
lease_milliseconds: leaseMilliseconds,
|
|
327
|
+
...options.account_id ? { account_id: options.account_id } : {}
|
|
328
|
+
});
|
|
329
|
+
if (!lease) break;
|
|
330
|
+
counts.claimed += 1;
|
|
331
|
+
try {
|
|
332
|
+
const outcome = await withinDeadline(
|
|
333
|
+
(signal) => adapter.deliver(
|
|
334
|
+
{
|
|
335
|
+
materialization: lease.materialization,
|
|
336
|
+
binding: lease.binding,
|
|
337
|
+
obligation: lease.obligation,
|
|
338
|
+
revision: lease.revision,
|
|
339
|
+
maxBytes: resourceMaxBytes
|
|
340
|
+
},
|
|
341
|
+
{ signal }
|
|
342
|
+
),
|
|
343
|
+
deadlineMilliseconds,
|
|
344
|
+
"Reporting delivery deadline elapsed",
|
|
345
|
+
options.signal
|
|
346
|
+
);
|
|
347
|
+
assertMaterializationOutcome(lease, outcome, now().toISOString(), minimumResourceRetentionDays);
|
|
348
|
+
if (await store.settleMaterialization({
|
|
349
|
+
lease,
|
|
350
|
+
now: now().toISOString(),
|
|
351
|
+
outcome,
|
|
352
|
+
minimum_resource_retention_days: Math.max(
|
|
353
|
+
lease.binding.resource_retention_days,
|
|
354
|
+
minimumResourceRetentionDays
|
|
355
|
+
)
|
|
356
|
+
}))
|
|
357
|
+
counts.delivered += 1;
|
|
358
|
+
else counts.failed += 1;
|
|
359
|
+
} catch {
|
|
360
|
+
await store.settleMaterialization({
|
|
361
|
+
lease,
|
|
362
|
+
now: now().toISOString(),
|
|
363
|
+
outcome: { status: "failed", failure_code: "DELIVERY_FAILED" }
|
|
364
|
+
});
|
|
365
|
+
counts.failed += 1;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return counts;
|
|
369
|
+
}
|
|
370
|
+
function remainingRevocationMilliseconds(revocation, revocationWindow, now) {
|
|
371
|
+
if (revocationWindow === void 0) return void 0;
|
|
372
|
+
const revokedAt = revocation.authorization.revoked_at;
|
|
373
|
+
if (!revokedAt) return void 0;
|
|
374
|
+
const revoked = Date.parse(revokedAt);
|
|
375
|
+
if (!Number.isFinite(revoked)) return void 0;
|
|
376
|
+
return revoked + revocationWindow - now.getTime();
|
|
377
|
+
}
|
|
378
|
+
async function readManagedReportingResource(store, adapter, input) {
|
|
379
|
+
const maxBytes = input.maxBytes ?? DEFAULT_RESOURCE_MAX_BYTES;
|
|
380
|
+
const deadlineMilliseconds = input.deadlineMilliseconds ?? DEFAULT_DELIVERY_DEADLINE_MILLISECONDS;
|
|
381
|
+
positiveInteger(maxBytes, "maxBytes");
|
|
382
|
+
positiveInteger(deadlineMilliseconds, "deadlineMilliseconds");
|
|
383
|
+
const selected = await store.getReadableResource(input);
|
|
384
|
+
const resource = selected?.materialization.resource;
|
|
385
|
+
if (!selected || !resource) return null;
|
|
386
|
+
const { binding, materialization } = selected;
|
|
387
|
+
const bytes = await withinDeadline(
|
|
388
|
+
// Adapter failure messages are provider strings: they vary by SDK version
|
|
389
|
+
// and can carry endpoint or credential detail. Callers get one stable
|
|
390
|
+
// sentence; the provider error stays reachable as `cause` for seller logs.
|
|
391
|
+
// `Promise.resolve().then` rather than calling and chaining `.catch`: an
|
|
392
|
+
// adapter that throws synchronously — a bad credential resolved eagerly,
|
|
393
|
+
// a client constructed inside `read` — never produced a promise to attach
|
|
394
|
+
// the handler to, so its raw provider message escaped this boundary.
|
|
395
|
+
(signal) => Promise.resolve().then(() => adapter.read({ materialization, binding, resource, maxBytes }, { signal })).catch((cause) => {
|
|
396
|
+
throw new Error("Managed reporting resource read failed", { cause });
|
|
397
|
+
}),
|
|
398
|
+
deadlineMilliseconds,
|
|
399
|
+
"Reporting resource read deadline elapsed",
|
|
400
|
+
input.signal
|
|
401
|
+
);
|
|
402
|
+
if (bytes.byteLength > maxBytes) throw new RangeError("Managed reporting resource exceeds maxBytes");
|
|
403
|
+
if (!await store.isAuthorizationCurrent({
|
|
404
|
+
account_id: input.account_id,
|
|
405
|
+
destination_ref: binding.destination_ref,
|
|
406
|
+
generation: binding.authorization_generation
|
|
407
|
+
})) {
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
return bytes;
|
|
411
|
+
}
|
|
412
|
+
function assertMaterializationOutcome(lease, outcome, now, minimumResourceRetentionDays = lease.binding.resource_retention_days) {
|
|
413
|
+
const parsed = ReportingMaterializationSchema.safeParse({
|
|
414
|
+
...lease.materialization,
|
|
415
|
+
status: outcome.status,
|
|
416
|
+
ready_at: now,
|
|
417
|
+
resource: outcome.resource,
|
|
418
|
+
verification: outcome.verification
|
|
419
|
+
});
|
|
420
|
+
if (!parsed.success) {
|
|
421
|
+
throw new Error(`Managed materialization evidence is invalid: ${parsed.error.issues[0]?.message ?? "invalid"}`);
|
|
422
|
+
}
|
|
423
|
+
if (Buffer.byteLength(JSON.stringify(outcome), "utf8") > MAX_DESCRIPTOR_BYTES) {
|
|
424
|
+
throw new RangeError("Managed materialization descriptor exceeds 1 MiB");
|
|
425
|
+
}
|
|
426
|
+
if (outcome.verification.verification_profile !== lease.binding.verification_profile) {
|
|
427
|
+
throw new Error("Materialization verification profile differs from the installed binding");
|
|
428
|
+
}
|
|
429
|
+
if (outcome.verification.row_count !== lease.revision.binding.rowCount) {
|
|
430
|
+
throw new Error("Materialization verification row count differs from the Core revision");
|
|
431
|
+
}
|
|
432
|
+
if (!isReportingVerificationEvidence(outcome.verification)) {
|
|
433
|
+
throw new Error("Materialization is missing evidence required by its verification profile");
|
|
434
|
+
}
|
|
435
|
+
if (canonicalJson(outcome.verification.control_totals) !== canonicalJson(lease.revision.wireRevision.control_totals)) {
|
|
436
|
+
throw new Error("Materialization verification control totals differ from the Core revision");
|
|
437
|
+
}
|
|
438
|
+
if (lease.binding.feed_purpose === "billing" && lease.binding.verification_profile !== "canonical_digest") {
|
|
439
|
+
throw new Error("Billing materializations require canonical-digest verification");
|
|
440
|
+
}
|
|
441
|
+
if (lease.binding.method === "file_transfer" && outcome.resource.kind !== "manifest" || lease.binding.method === "dataset_share" && (outcome.resource.kind !== "dataset" || outcome.verification.verification_path !== "representative_consumer") || lease.binding.method === "warehouse_materialization" && (outcome.resource.kind !== "warehouse_relation" || outcome.verification.verification_path !== "destination")) {
|
|
442
|
+
throw new Error("Materialization resource or verification path differs from its delivery method");
|
|
443
|
+
}
|
|
444
|
+
if (lease.binding.method === "file_transfer" && !outcome.verification.physical_checksums?.length) {
|
|
445
|
+
throw new Error("File-transfer materializations require physical checksums");
|
|
446
|
+
}
|
|
447
|
+
if (outcome.resource.kind === "manifest" && (outcome.resource.manifest_version !== "1.0" || !outcome.resource.manifest_sha256)) {
|
|
448
|
+
throw new Error("Manifest resources require immutable version and digest metadata");
|
|
449
|
+
}
|
|
450
|
+
const native = outcome.verification.native_commit_evidence;
|
|
451
|
+
if (native !== void 0) {
|
|
452
|
+
if (native.native_version_ref !== outcome.resource.native_version_ref || native.observed_through !== outcome.verification.verification_path) {
|
|
453
|
+
throw new Error("Native commit evidence does not match the retained resource and verification path");
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
void minimumResourceRetentionDays;
|
|
457
|
+
if (outcome.verification.canonical_content_digest !== void 0) {
|
|
458
|
+
const expected = lease.revision.wireRevision.canonical_content_digest;
|
|
459
|
+
if (!expected || canonicalJson(outcome.verification.canonical_content_digest) !== canonicalJson(expected)) {
|
|
460
|
+
throw new Error("Canonical materialization evidence does not match the official Core revision");
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if (outcome.resource.immutability === "native_version" && !outcome.resource.native_version_ref) {
|
|
464
|
+
throw new Error("Native-version materializations require an exact native_version_ref");
|
|
465
|
+
}
|
|
466
|
+
assertCredentialFreeReportingResourceLocationV1(outcome.resource.location);
|
|
467
|
+
}
|
|
468
|
+
function receiptEvidenceMatches(receipt, materialization) {
|
|
469
|
+
const verification = materialization.verification;
|
|
470
|
+
const resource = materialization.resource;
|
|
471
|
+
if (!verification || !resource || !isReportingReceiptEvidence(receipt)) return false;
|
|
472
|
+
return receipt.verification_profile === verification.verification_profile && receipt.observed_row_count === verification.row_count && canonicalJson(receipt.observed_control_totals) === canonicalJson(verification.control_totals) && canonicalJson(receipt.observed_canonical_content_digest) === canonicalJson(verification.canonical_content_digest) && (verification.verification_profile !== "manifest_checksums" || receipt.observed_manifest_sha256 === resource.manifest_sha256) && (verification.verification_profile !== "native_commit" || receipt.observed_native_version_ref === resource.native_version_ref);
|
|
473
|
+
}
|
|
474
|
+
function adjustmentReceiptEvidenceMatches(receipt, adjustment) {
|
|
475
|
+
return isReportingAdjustmentReceiptEvidence(receipt) && receipt.adjusts_reporting_revision_id === adjustment.adjusts_reporting_revision_id && receipt.observed_adjustment_sha256 === adjustment.wireAdjustment.canonical_adjustment_sha256;
|
|
476
|
+
}
|
|
477
|
+
function resolvedAccountId(account) {
|
|
478
|
+
if (!account || typeof account !== "object") throw new Error("Reporting receipts require a resolved account");
|
|
479
|
+
const value = account;
|
|
480
|
+
const id = typeof value.id === "string" ? value.id : typeof value.account_id === "string" ? value.account_id : "";
|
|
481
|
+
if (!id) throw new Error("Reporting receipts require a resolved account");
|
|
482
|
+
return id;
|
|
483
|
+
}
|
|
484
|
+
function sha256(value) {
|
|
485
|
+
return createHash("sha256").update(canonicalJson(value)).digest("hex");
|
|
486
|
+
}
|
|
487
|
+
function canonicalJson(value) {
|
|
488
|
+
return canonicalize(value === void 0 ? null : value);
|
|
489
|
+
}
|
|
490
|
+
function positiveInteger(value, name) {
|
|
491
|
+
if (!Number.isSafeInteger(value) || value <= 0) throw new RangeError(`${name} must be a positive safe integer`);
|
|
492
|
+
}
|
|
493
|
+
function nonnegativeInteger(value, name) {
|
|
494
|
+
if (!Number.isSafeInteger(value) || value < 0) throw new RangeError(`${name} must be a non-negative safe integer`);
|
|
495
|
+
}
|
|
496
|
+
function assertManagedOfferings(offerings) {
|
|
497
|
+
const validateOffering = getSchemaValidatorByRef("core/reporting-delivery-offering.json");
|
|
498
|
+
if (!validateOffering) throw new Error("The installed AdCP bundle cannot validate reporting delivery offerings");
|
|
499
|
+
const ids = /* @__PURE__ */ new Set();
|
|
500
|
+
for (const offering of offerings) {
|
|
501
|
+
if (!validateOffering(offering)) {
|
|
502
|
+
throw new Error("Managed Delivery offering does not satisfy the complete installed RC3 schema");
|
|
503
|
+
}
|
|
504
|
+
if (ids.has(offering.offering_id)) throw new Error("Managed Delivery offering_id values must be unique");
|
|
505
|
+
ids.add(offering.offering_id);
|
|
506
|
+
const method = offering.method;
|
|
507
|
+
if (method !== void 0) {
|
|
508
|
+
if (!isRecord(method)) throw new Error("Managed Delivery offering method is invalid");
|
|
509
|
+
const pattern = method.pattern;
|
|
510
|
+
if (!["file_transfer", "dataset_share", "warehouse_materialization"].includes(String(pattern)) || typeof method.transport !== "string" || !["producer_managed", "consumer_managed"].includes(String(method.orchestration)) || !Array.isArray(method.destination_modes) || method.destination_modes.length === 0 || !isRecord(method.provider) || typeof method.provider.domain !== "string" || pattern === "file_transfer" && typeof method.format !== "string" || pattern === "dataset_share" && typeof method.access_mode !== "string") {
|
|
511
|
+
throw new Error("Managed Delivery offering method omits RC3-required delivery fields");
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
if (offering.feed_purpose === "billing" && offering.reconciliation_mode !== "consumer_receipt") {
|
|
515
|
+
throw new Error("Billing offerings require consumer-receipt reconciliation");
|
|
516
|
+
}
|
|
517
|
+
const profile = offering.reporting_profile;
|
|
518
|
+
if (offering.reconciliation_mode === "consumer_receipt") {
|
|
519
|
+
if (method === void 0 || profile.canonicalization_contract_version !== "1.0" || profile.canonicalization_media_type !== "application/vnd.adcp.reporting-canonicalization+json" || !profile.canonicalization_id || !profile.canonicalization_uri || !profile.canonicalization_sha256) {
|
|
520
|
+
throw new Error("Reconciled Billing offerings require the complete pinned RC3 canonicalization contract");
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
function isRecord(value) {
|
|
526
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
527
|
+
}
|
|
528
|
+
function assertCredentialFreeReportingResourceLocationV1(location) {
|
|
529
|
+
const refuse = () => {
|
|
530
|
+
throw new Error("Managed reporting resource locations must not contain credentials");
|
|
531
|
+
};
|
|
532
|
+
if (/\r|\n|-----BEGIN|\bbearer\s|(?:token|password|secret|signature)=/i.test(location)) refuse();
|
|
533
|
+
if (/[?#]/.test(location)) refuse();
|
|
534
|
+
if (hasColonSeparatedUserinfo(location)) refuse();
|
|
535
|
+
try {
|
|
536
|
+
const parsed = new URL(location);
|
|
537
|
+
if (parsed.password || parsed.search || parsed.hash) refuse();
|
|
538
|
+
if (parsed.username && (parsed.protocol === "http:" || parsed.protocol === "https:")) refuse();
|
|
539
|
+
} catch (error) {
|
|
540
|
+
if (error instanceof Error && error.message.includes("must not contain credentials")) throw error;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
function hasColonSeparatedUserinfo(location) {
|
|
544
|
+
let scanningCandidate = true;
|
|
545
|
+
let sawColon = false;
|
|
546
|
+
let previousWasSlash = false;
|
|
547
|
+
for (let index = 0; index < location.length; index += 1) {
|
|
548
|
+
const code = location.charCodeAt(index);
|
|
549
|
+
if (scanningCandidate) {
|
|
550
|
+
if (code === 64) {
|
|
551
|
+
if (sawColon) return true;
|
|
552
|
+
scanningCandidate = false;
|
|
553
|
+
} else if (code === 58) {
|
|
554
|
+
sawColon = true;
|
|
555
|
+
} else if (code === 47 || code === 63 || code === 35 || isLocationWhitespace(code)) {
|
|
556
|
+
scanningCandidate = false;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
const startsAuthorityCandidate = code === 47 && previousWasSlash;
|
|
560
|
+
previousWasSlash = code === 47;
|
|
561
|
+
if (startsAuthorityCandidate) {
|
|
562
|
+
scanningCandidate = true;
|
|
563
|
+
sawColon = false;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return false;
|
|
567
|
+
}
|
|
568
|
+
function isLocationWhitespace(code) {
|
|
569
|
+
return code >= 9 && code <= 13 || code === 32 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || code === 8232 || code === 8233 || code === 8239 || code === 8287 || code === 12288 || code === 65279;
|
|
570
|
+
}
|
|
571
|
+
async function withinDeadline(operation, milliseconds, message, outerSignal) {
|
|
572
|
+
outerSignal?.throwIfAborted();
|
|
573
|
+
const controller = new AbortController();
|
|
574
|
+
const signal = outerSignal ? AbortSignal.any([outerSignal, controller.signal]) : controller.signal;
|
|
575
|
+
let cancelTimer;
|
|
576
|
+
try {
|
|
577
|
+
return await Promise.race([
|
|
578
|
+
operation(signal),
|
|
579
|
+
new Promise((_resolve, reject) => {
|
|
580
|
+
cancelTimer = scheduleDeadline(milliseconds, () => {
|
|
581
|
+
const error = new Error(message);
|
|
582
|
+
controller.abort(error);
|
|
583
|
+
reject(error);
|
|
584
|
+
});
|
|
585
|
+
})
|
|
586
|
+
]);
|
|
587
|
+
} finally {
|
|
588
|
+
cancelTimer?.();
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
function scheduleDeadline(milliseconds, onElapsed) {
|
|
592
|
+
const normalizedMilliseconds = Math.ceil(milliseconds);
|
|
593
|
+
if (milliseconds < 0 || !Number.isSafeInteger(normalizedMilliseconds)) {
|
|
594
|
+
throw new RangeError("Reporting deadline must be a finite non-negative safe number of milliseconds");
|
|
595
|
+
}
|
|
596
|
+
const expiresAt = process.hrtime.bigint() + BigInt(normalizedMilliseconds) * NANOSECONDS_PER_MILLISECOND;
|
|
597
|
+
let cancelled = false;
|
|
598
|
+
let timer;
|
|
599
|
+
const scheduleRemaining = () => {
|
|
600
|
+
if (cancelled) return;
|
|
601
|
+
const remainingNanoseconds = expiresAt - process.hrtime.bigint();
|
|
602
|
+
if (remainingNanoseconds <= 0n) {
|
|
603
|
+
onElapsed();
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
const remainingMilliseconds = Number(
|
|
607
|
+
(remainingNanoseconds + NANOSECONDS_PER_MILLISECOND - 1n) / NANOSECONDS_PER_MILLISECOND
|
|
608
|
+
);
|
|
609
|
+
timer = setTimeout(scheduleRemaining, Math.min(remainingMilliseconds, MAX_NODE_TIMER_DELAY_MILLISECONDS));
|
|
610
|
+
};
|
|
611
|
+
scheduleRemaining();
|
|
612
|
+
return () => {
|
|
613
|
+
cancelled = true;
|
|
614
|
+
if (timer) clearTimeout(timer);
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
function reportingManagedDeliveryBindingV1(input) {
|
|
618
|
+
const created_at = input.created_at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
619
|
+
const { semantic_fingerprint: _predecessor, ...semantic } = input;
|
|
620
|
+
const semantic_fingerprint = sha256({ ...semantic, created_at: void 0 });
|
|
621
|
+
return { ...semantic, created_at, semantic_fingerprint };
|
|
622
|
+
}
|
|
623
|
+
export {
|
|
624
|
+
adjustmentReceiptEvidenceMatches,
|
|
625
|
+
assertCredentialFreeReportingResourceLocationV1,
|
|
626
|
+
assertMaterializationOutcome,
|
|
627
|
+
createReportingManagedDeliveryRuntime,
|
|
628
|
+
createSyncReportingReceiptsHandler,
|
|
629
|
+
readManagedReportingResource,
|
|
630
|
+
receiptEvidenceMatches,
|
|
631
|
+
reportingManagedDeliveryBindingV1,
|
|
632
|
+
runManagedDeliveryWorker
|
|
633
|
+
};
|