@adcp/sdk 15.7.1 → 15.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/core/SingleAgentClient.d.mts +14 -0
- package/dist/lib/core/SingleAgentClient.d.ts +14 -0
- package/dist/lib/core/SingleAgentClient.js +138 -54
- package/dist/lib/core/SingleAgentClient.mjs +141 -54
- package/dist/lib/core/agent-discovery-cache.d.mts +2 -0
- package/dist/lib/core/agent-discovery-cache.d.ts +2 -0
- package/dist/lib/core/creative-schema-support.d.mts +3 -0
- package/dist/lib/core/creative-schema-support.d.ts +3 -0
- package/dist/lib/core/creative-schema-support.js +113 -0
- package/dist/lib/core/creative-schema-support.mjs +89 -0
- package/dist/lib/core/product-cache.js +4 -3
- package/dist/lib/core/product-cache.mjs +4 -3
- package/dist/lib/reporting/ledger/handler.d.mts +10 -3
- package/dist/lib/reporting/ledger/handler.d.ts +10 -3
- package/dist/lib/reporting/ledger/handler.js +17 -4
- package/dist/lib/reporting/ledger/handler.mjs +17 -4
- package/dist/lib/reporting/ledger/managed.d.mts +3 -1
- package/dist/lib/reporting/ledger/managed.d.ts +3 -1
- package/dist/lib/reporting/ledger/managed.js +4 -1
- package/dist/lib/reporting/ledger/managed.mjs +4 -1
- package/dist/lib/reporting/ledger/postgres.d.mts +87 -0
- package/dist/lib/reporting/ledger/postgres.d.ts +87 -0
- package/dist/lib/reporting/ledger/postgres.js +314 -13
- package/dist/lib/reporting/ledger/postgres.mjs +314 -13
- package/dist/lib/reporting/ledger/row-storage.d.mts +23 -0
- package/dist/lib/reporting/ledger/row-storage.d.ts +23 -0
- package/dist/lib/reporting/ledger/row-storage.js +56 -0
- package/dist/lib/reporting/ledger/row-storage.mjs +56 -0
- package/dist/lib/reporting/ledger/types.d.mts +26 -0
- package/dist/lib/reporting/ledger/types.d.ts +26 -0
- package/dist/lib/reporting/service/index.d.mts +33 -3
- package/dist/lib/reporting/service/index.d.ts +33 -3
- package/dist/lib/reporting/service/index.js +20 -2
- package/dist/lib/reporting/service/index.mjs +20 -2
- package/dist/lib/reporting/service/maintenance.d.mts +20 -1
- package/dist/lib/reporting/service/maintenance.d.ts +20 -1
- package/dist/lib/reporting/service/maintenance.js +25 -2
- package/dist/lib/reporting/service/maintenance.mjs +25 -2
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/testing/storyboard/request-builder.js +14 -16
- package/dist/lib/testing/storyboard/request-builder.mjs +14 -16
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/v2/projection/creative-delivery.d.mts +22 -0
- package/dist/lib/v2/projection/creative-delivery.d.ts +22 -0
- package/dist/lib/v2/projection/creative-delivery.js +92 -0
- package/dist/lib/v2/projection/creative-delivery.mjs +91 -0
- package/dist/lib/v2/projection/legacy-metadata.d.mts +6 -3
- package/dist/lib/v2/projection/legacy-metadata.d.ts +6 -3
- package/dist/lib/v2/projection/legacy-metadata.js +17 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs +15 -0
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/CREATIVE-DELIVERY.md +16 -0
- package/docs/guides/REPORTING-LEDGER-CUTOVER.md +405 -0
- package/docs/guides/REPORTING-LEDGER.md +130 -0
- package/docs/guides/REPORTING-OPERATIONS.md +12 -0
- package/docs/llms.txt +3 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/package.json +1 -1
|
@@ -1009,6 +1009,32 @@ export interface ReportingProducerV1 {
|
|
|
1009
1009
|
export type ReportingSourceWithReaderV1 = ReportingSourceExecutorV1 & ReportingSourceStagedObjectReaderV1;
|
|
1010
1010
|
export type ReportingStatusHandlerV1 = (request: AdcpToolMap['get_reporting_status']['params'], context: HandlerContext<unknown>) => Promise<GetReportingStatusResponse>;
|
|
1011
1011
|
export type ReportingDeliveryHandlerV1 = (request: AdcpToolMap['get_media_buy_delivery']['params'], context: HandlerContext<unknown>) => Promise<AdcpToolMap['get_media_buy_delivery']['result']>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Exact-revision reader for revisions the SDK ledger does not own, typically a
|
|
1014
|
+
* seller's pre-cutover ledger tables. It receives the same request and context
|
|
1015
|
+
* as `get_media_buy_delivery` and returns the protocol response, or
|
|
1016
|
+
* `null`/`undefined` when it has no such revision.
|
|
1017
|
+
*
|
|
1018
|
+
* Authorization is the reader's responsibility. The SDK has already resolved
|
|
1019
|
+
* the account (`context.account`) and cannot tell whether a legacy revision
|
|
1020
|
+
* belongs to it, so the reader MUST scope the lookup by that account and return
|
|
1021
|
+
* `null` for a revision that belongs to another one. Never return a response
|
|
1022
|
+
* for a revision the resolved account cannot read.
|
|
1023
|
+
*/
|
|
1024
|
+
export type ReportingLegacyRevisionReaderV1 = (request: AdcpToolMap['get_media_buy_delivery']['params'], context: HandlerContext<unknown>) => Promise<AdcpToolMap['get_media_buy_delivery']['result'] | null | undefined>;
|
|
1025
|
+
export interface CreateReportingDeliveryHandlerOptionsV1 {
|
|
1026
|
+
/**
|
|
1027
|
+
* Consulted only when the SDK ledger has no such revision for the resolved
|
|
1028
|
+
* account (unknown id, or an id owned by a different account). Never
|
|
1029
|
+
* consulted for an SDK-owned revision that is expired, has unavailable or
|
|
1030
|
+
* corrupt rows, or carries an unusable cursor, nor for capacity or other
|
|
1031
|
+
* errors: falling back there could serve different content under an id the
|
|
1032
|
+
* SDK owns. A `null`/`undefined` result is the same nondisclosing
|
|
1033
|
+
* `REFERENCE_NOT_FOUND` the SDK returns itself; an error the reader throws
|
|
1034
|
+
* propagates unchanged.
|
|
1035
|
+
*/
|
|
1036
|
+
legacyRevisionReader?: ReportingLegacyRevisionReaderV1;
|
|
1037
|
+
}
|
|
1012
1038
|
export interface CreateReportingProducerOptionsV1 {
|
|
1013
1039
|
store: ReportingLedgerStore;
|
|
1014
1040
|
source: ReportingSourceWithReaderV1;
|
|
@@ -4,9 +4,9 @@ import type { DecisioningPlatform } from '../../server/decisioning/platform.mjs'
|
|
|
4
4
|
import type { ReliableReportingPlatform } from '../../server/decisioning/specialisms/reporting.mjs';
|
|
5
5
|
import type { ReportingDeliveryCapabilities, ReportingDeliveryOffering } from '../../types/tools.generated.mjs';
|
|
6
6
|
import { type CreatePostgresPersistentNotificationRuntimeOptions, type PostgresPersistentNotificationRuntime } from '../../server/notification-subscriptions/index.mjs';
|
|
7
|
-
import { REPORTING_LEDGER_MIGRATION, PostgresReportingLedgerStore, PostgresReportingManagedDeliveryStore, type CreateReportingProducerOptionsV1, type ReportingConsumerMismatchEscalationV1, type ReportingLedgerConfigurationV1, type ReportingLedgerStore, type ReportingProducerContactV1, type ReportingProducerV1, type ReportingManagedDeliveryAdapterV1, type ReportingManagedDeliveryRuntimeV1, type PostgresReportingManagedDeliveryStoreOptions, type PostgresReportingNotificationActivityOptions, type PostgresReportingNotificationActivityRuntime, type ReportingPgPool, type ReportingRowStorageOptionsV1, type ReportingSourceWithReaderV1 } from '../ledger/index.mjs';
|
|
7
|
+
import { REPORTING_LEDGER_MIGRATION, PostgresReportingLedgerStore, PostgresReportingManagedDeliveryStore, type CreateReportingProducerOptionsV1, type ReportingConsumerMismatchEscalationV1, type ReportingLedgerConfigurationV1, type ReportingLedgerStore, type ReportingLegacyRevisionReaderV1, type ReportingProducerContactV1, type ReportingProducerV1, type ReportingManagedDeliveryAdapterV1, type ReportingManagedDeliveryRuntimeV1, type PostgresReportingManagedDeliveryStoreOptions, type PostgresReportingNotificationActivityOptions, type PostgresReportingNotificationActivityRuntime, type ReportingPgPool, type ReportingRowStorageOptionsV1, type ReportingSourceWithReaderV1 } from '../ledger/index.mjs';
|
|
8
8
|
import { type PostgresReportingWebhookActivityV1 } from '../webhook-activity.mjs';
|
|
9
|
-
import { type ReportingChangeFeedMaintenanceOptionsV1, type ReportingLedgerMaintenanceTaskResultV1, type ReportingRetentionOptionsV1 } from './maintenance.mjs';
|
|
9
|
+
import { type ReportingChangeFeedMaintenanceOptionsV1, type ReportingLedgerMaintenanceTaskResultV1, type ReportingCompactionOptionsV1, type ReportingRetentionOptionsV1 } from './maintenance.mjs';
|
|
10
10
|
import type { InlineReportingReplayRetentionV1 } from '../source/index.mjs';
|
|
11
11
|
import { type InlineReportingDeliveryFetchV1, type ReportingSourceOfferingV1 } from '../source/index.mjs';
|
|
12
12
|
/** The intentionally small provider boundary: one bounded slice fetch plus immutable metadata. */
|
|
@@ -165,12 +165,30 @@ export interface CreateReliableReportingServiceOptionsV1<TCtxMeta = Record<strin
|
|
|
165
165
|
* store to be built with `changeFeed: true`.
|
|
166
166
|
*/
|
|
167
167
|
maintenance?: ReliableReportingMaintenanceOptionsV1;
|
|
168
|
+
/**
|
|
169
|
+
* Serve exact revision reads (`get_media_buy_delivery`) for revisions this
|
|
170
|
+
* ledger does not hold, such as a seller's pre-cutover ledger tables. The
|
|
171
|
+
* SDK ledger answers first; the reader is called with the same request and
|
|
172
|
+
* context only when the SDK has no such revision for the resolved account.
|
|
173
|
+
* It is never called for an SDK-owned revision that is expired or has
|
|
174
|
+
* unavailable or corrupt rows, nor on capacity or other errors. A
|
|
175
|
+
* `null`/`undefined` result becomes the SDK's own nondisclosing
|
|
176
|
+
* `REFERENCE_NOT_FOUND`.
|
|
177
|
+
*
|
|
178
|
+
* The reader owns authorization: it MUST scope its lookup by
|
|
179
|
+
* `context.account` and return `null` for another account's revision. Read
|
|
180
|
+
* only; never write to the SDK ledger from it. See
|
|
181
|
+
* `docs/guides/REPORTING-LEDGER-CUTOVER.md`.
|
|
182
|
+
*/
|
|
183
|
+
legacyRevisionReader?: ReportingLegacyRevisionReaderV1;
|
|
168
184
|
}
|
|
169
185
|
export interface ReliableReportingMaintenanceOptionsV1 {
|
|
170
186
|
/** Minimum time between scheduled maintenance passes. Defaults to 300000 (5 minutes). */
|
|
171
187
|
intervalMilliseconds?: number;
|
|
172
188
|
/** Period-aligned retention; see the production service's `retention`. */
|
|
173
189
|
retention?: ReportingRetentionOptionsV1;
|
|
190
|
+
/** Opt-in snapshot compaction; see the production service's `compaction`. */
|
|
191
|
+
compaction?: ReportingCompactionOptionsV1;
|
|
174
192
|
/** Change-feed pruning and consumer hold; see the production service's `changeFeed`. */
|
|
175
193
|
changeFeed?: ReportingChangeFeedMaintenanceOptionsV1;
|
|
176
194
|
}
|
|
@@ -244,6 +262,18 @@ export type CreatePostgresReliableReportingProductionServiceOptionsV1<TCtxMeta =
|
|
|
244
262
|
* within `changeFeed.maxFeedHoldDays`, default 7) has read its changes.
|
|
245
263
|
*/
|
|
246
264
|
retention?: ReportingRetentionOptionsV1;
|
|
265
|
+
/**
|
|
266
|
+
* Opt in to compacting superseded snapshot revisions to metadata only, as
|
|
267
|
+
* adcontextprotocol/adcp#8100 permits. Off by default. Each scheduler pass
|
|
268
|
+
* drops the row content of snapshots that are superseded, past their
|
|
269
|
+
* recovery grace and not owed to any caller (receipts, current
|
|
270
|
+
* `received` / `unreadable` / `content_mismatch` statements), while every
|
|
271
|
+
* revision's metadata stays. Official revisions are never compacted. Uses
|
|
272
|
+
* this service's `statusRetentionDays` and `automatedRecoveryWindowSeconds`.
|
|
273
|
+
* The protocol takes compaction into effect only in the next eligible minor
|
|
274
|
+
* after November 20, 2026: do not enable this in production before then.
|
|
275
|
+
*/
|
|
276
|
+
compaction?: ReportingCompactionOptionsV1;
|
|
247
277
|
/**
|
|
248
278
|
* Maintain the host change feed (`changesAfter`, `getCurrentRevision`,
|
|
249
279
|
* `listCurrentRevisions` on `stores.core`). Adds
|
|
@@ -329,4 +359,4 @@ export interface PostgresReliableReportingProductionServiceV1<TCtxMeta = Record<
|
|
|
329
359
|
*/
|
|
330
360
|
export declare function createPostgresReliableReportingProductionService<TCtxMeta = Record<string, unknown>>(options: CreatePostgresReliableReportingProductionServiceOptionsV1<TCtxMeta>): Promise<PostgresReliableReportingProductionServiceV1<TCtxMeta>>;
|
|
331
361
|
export * from './conformance.mjs';
|
|
332
|
-
export { ReportingMaintenancePartialFailureError, type ReportingChangeFeedMaintenanceOptionsV1, type ReportingLedgerMaintenanceStoreV1, type ReportingLedgerMaintenanceTaskNameV1, type ReportingLedgerMaintenanceTaskResultV1, type ReportingRetentionOptionsV1, } from './maintenance.mjs';
|
|
362
|
+
export { ReportingMaintenancePartialFailureError, type ReportingChangeFeedMaintenanceOptionsV1, type ReportingCompactionOptionsV1, type ReportingLedgerMaintenanceStoreV1, type ReportingLedgerMaintenanceTaskNameV1, type ReportingLedgerMaintenanceTaskResultV1, type ReportingRetentionOptionsV1, } from './maintenance.mjs';
|
|
@@ -4,9 +4,9 @@ import type { DecisioningPlatform } from '../../server/decisioning/platform';
|
|
|
4
4
|
import type { ReliableReportingPlatform } from '../../server/decisioning/specialisms/reporting';
|
|
5
5
|
import type { ReportingDeliveryCapabilities, ReportingDeliveryOffering } from '../../types/tools.generated';
|
|
6
6
|
import { type CreatePostgresPersistentNotificationRuntimeOptions, type PostgresPersistentNotificationRuntime } from '../../server/notification-subscriptions';
|
|
7
|
-
import { REPORTING_LEDGER_MIGRATION, PostgresReportingLedgerStore, PostgresReportingManagedDeliveryStore, type CreateReportingProducerOptionsV1, type ReportingConsumerMismatchEscalationV1, type ReportingLedgerConfigurationV1, type ReportingLedgerStore, type ReportingProducerContactV1, type ReportingProducerV1, type ReportingManagedDeliveryAdapterV1, type ReportingManagedDeliveryRuntimeV1, type PostgresReportingManagedDeliveryStoreOptions, type PostgresReportingNotificationActivityOptions, type PostgresReportingNotificationActivityRuntime, type ReportingPgPool, type ReportingRowStorageOptionsV1, type ReportingSourceWithReaderV1 } from '../ledger';
|
|
7
|
+
import { REPORTING_LEDGER_MIGRATION, PostgresReportingLedgerStore, PostgresReportingManagedDeliveryStore, type CreateReportingProducerOptionsV1, type ReportingConsumerMismatchEscalationV1, type ReportingLedgerConfigurationV1, type ReportingLedgerStore, type ReportingLegacyRevisionReaderV1, type ReportingProducerContactV1, type ReportingProducerV1, type ReportingManagedDeliveryAdapterV1, type ReportingManagedDeliveryRuntimeV1, type PostgresReportingManagedDeliveryStoreOptions, type PostgresReportingNotificationActivityOptions, type PostgresReportingNotificationActivityRuntime, type ReportingPgPool, type ReportingRowStorageOptionsV1, type ReportingSourceWithReaderV1 } from '../ledger';
|
|
8
8
|
import { type PostgresReportingWebhookActivityV1 } from '../webhook-activity';
|
|
9
|
-
import { type ReportingChangeFeedMaintenanceOptionsV1, type ReportingLedgerMaintenanceTaskResultV1, type ReportingRetentionOptionsV1 } from './maintenance';
|
|
9
|
+
import { type ReportingChangeFeedMaintenanceOptionsV1, type ReportingLedgerMaintenanceTaskResultV1, type ReportingCompactionOptionsV1, type ReportingRetentionOptionsV1 } from './maintenance';
|
|
10
10
|
import type { InlineReportingReplayRetentionV1 } from '../source';
|
|
11
11
|
import { type InlineReportingDeliveryFetchV1, type ReportingSourceOfferingV1 } from '../source';
|
|
12
12
|
/** The intentionally small provider boundary: one bounded slice fetch plus immutable metadata. */
|
|
@@ -165,12 +165,30 @@ export interface CreateReliableReportingServiceOptionsV1<TCtxMeta = Record<strin
|
|
|
165
165
|
* store to be built with `changeFeed: true`.
|
|
166
166
|
*/
|
|
167
167
|
maintenance?: ReliableReportingMaintenanceOptionsV1;
|
|
168
|
+
/**
|
|
169
|
+
* Serve exact revision reads (`get_media_buy_delivery`) for revisions this
|
|
170
|
+
* ledger does not hold, such as a seller's pre-cutover ledger tables. The
|
|
171
|
+
* SDK ledger answers first; the reader is called with the same request and
|
|
172
|
+
* context only when the SDK has no such revision for the resolved account.
|
|
173
|
+
* It is never called for an SDK-owned revision that is expired or has
|
|
174
|
+
* unavailable or corrupt rows, nor on capacity or other errors. A
|
|
175
|
+
* `null`/`undefined` result becomes the SDK's own nondisclosing
|
|
176
|
+
* `REFERENCE_NOT_FOUND`.
|
|
177
|
+
*
|
|
178
|
+
* The reader owns authorization: it MUST scope its lookup by
|
|
179
|
+
* `context.account` and return `null` for another account's revision. Read
|
|
180
|
+
* only; never write to the SDK ledger from it. See
|
|
181
|
+
* `docs/guides/REPORTING-LEDGER-CUTOVER.md`.
|
|
182
|
+
*/
|
|
183
|
+
legacyRevisionReader?: ReportingLegacyRevisionReaderV1;
|
|
168
184
|
}
|
|
169
185
|
export interface ReliableReportingMaintenanceOptionsV1 {
|
|
170
186
|
/** Minimum time between scheduled maintenance passes. Defaults to 300000 (5 minutes). */
|
|
171
187
|
intervalMilliseconds?: number;
|
|
172
188
|
/** Period-aligned retention; see the production service's `retention`. */
|
|
173
189
|
retention?: ReportingRetentionOptionsV1;
|
|
190
|
+
/** Opt-in snapshot compaction; see the production service's `compaction`. */
|
|
191
|
+
compaction?: ReportingCompactionOptionsV1;
|
|
174
192
|
/** Change-feed pruning and consumer hold; see the production service's `changeFeed`. */
|
|
175
193
|
changeFeed?: ReportingChangeFeedMaintenanceOptionsV1;
|
|
176
194
|
}
|
|
@@ -244,6 +262,18 @@ export type CreatePostgresReliableReportingProductionServiceOptionsV1<TCtxMeta =
|
|
|
244
262
|
* within `changeFeed.maxFeedHoldDays`, default 7) has read its changes.
|
|
245
263
|
*/
|
|
246
264
|
retention?: ReportingRetentionOptionsV1;
|
|
265
|
+
/**
|
|
266
|
+
* Opt in to compacting superseded snapshot revisions to metadata only, as
|
|
267
|
+
* adcontextprotocol/adcp#8100 permits. Off by default. Each scheduler pass
|
|
268
|
+
* drops the row content of snapshots that are superseded, past their
|
|
269
|
+
* recovery grace and not owed to any caller (receipts, current
|
|
270
|
+
* `received` / `unreadable` / `content_mismatch` statements), while every
|
|
271
|
+
* revision's metadata stays. Official revisions are never compacted. Uses
|
|
272
|
+
* this service's `statusRetentionDays` and `automatedRecoveryWindowSeconds`.
|
|
273
|
+
* The protocol takes compaction into effect only in the next eligible minor
|
|
274
|
+
* after November 20, 2026: do not enable this in production before then.
|
|
275
|
+
*/
|
|
276
|
+
compaction?: ReportingCompactionOptionsV1;
|
|
247
277
|
/**
|
|
248
278
|
* Maintain the host change feed (`changesAfter`, `getCurrentRevision`,
|
|
249
279
|
* `listCurrentRevisions` on `stores.core`). Adds
|
|
@@ -329,4 +359,4 @@ export interface PostgresReliableReportingProductionServiceV1<TCtxMeta = Record<
|
|
|
329
359
|
*/
|
|
330
360
|
export declare function createPostgresReliableReportingProductionService<TCtxMeta = Record<string, unknown>>(options: CreatePostgresReliableReportingProductionServiceOptionsV1<TCtxMeta>): Promise<PostgresReliableReportingProductionServiceV1<TCtxMeta>>;
|
|
331
361
|
export * from './conformance';
|
|
332
|
-
export { ReportingMaintenancePartialFailureError, type ReportingChangeFeedMaintenanceOptionsV1, type ReportingLedgerMaintenanceStoreV1, type ReportingLedgerMaintenanceTaskNameV1, type ReportingLedgerMaintenanceTaskResultV1, type ReportingRetentionOptionsV1, } from './maintenance';
|
|
362
|
+
export { ReportingMaintenancePartialFailureError, type ReportingChangeFeedMaintenanceOptionsV1, type ReportingCompactionOptionsV1, type ReportingLedgerMaintenanceStoreV1, type ReportingLedgerMaintenanceTaskNameV1, type ReportingLedgerMaintenanceTaskResultV1, type ReportingRetentionOptionsV1, } from './maintenance';
|
|
@@ -108,7 +108,12 @@ function createReliableReportingService(options) {
|
|
|
108
108
|
throw new TypeError("maintenance must be an options object");
|
|
109
109
|
}
|
|
110
110
|
const candidate = options.store;
|
|
111
|
-
for (const method of [
|
|
111
|
+
for (const method of [
|
|
112
|
+
"retireExpiredPeriods",
|
|
113
|
+
"pruneChanges",
|
|
114
|
+
"sweepRowWriteIntents",
|
|
115
|
+
...maintenance.compaction ? ["compactSupersededSnapshots"] : []
|
|
116
|
+
]) {
|
|
112
117
|
if (typeof candidate[method] !== "function") {
|
|
113
118
|
throw new TypeError(
|
|
114
119
|
`maintenance requires a PostgresReportingLedgerStore (or a store with ${method}); the configured store cannot run ledger maintenance`
|
|
@@ -116,6 +121,9 @@ function createReliableReportingService(options) {
|
|
|
116
121
|
}
|
|
117
122
|
}
|
|
118
123
|
maintenanceStore = candidate;
|
|
124
|
+
if (maintenance.compaction) {
|
|
125
|
+
candidate.assertCompactionSafeRowBindings?.();
|
|
126
|
+
}
|
|
119
127
|
if (maintenance.changeFeed && maintenanceStore.changeFeedEnabled === false) {
|
|
120
128
|
throw new TypeError(
|
|
121
129
|
"maintenance.changeFeed requires the store to be built with changeFeed: true; otherwise pruning silently does nothing"
|
|
@@ -131,7 +139,9 @@ function createReliableReportingService(options) {
|
|
|
131
139
|
store: maintenanceStore,
|
|
132
140
|
...typeof maintenanceStore.sweepExpiredState === "function" ? { sweepSnapshots: (limit) => maintenanceStore.sweepExpiredState(limit) } : {},
|
|
133
141
|
statusRetentionDays: retentionDays,
|
|
142
|
+
automatedRecoveryWindowSeconds: options.automatedRecoveryWindowSeconds,
|
|
134
143
|
retention: maintenance.retention,
|
|
144
|
+
compaction: maintenance.compaction,
|
|
135
145
|
changeFeed: maintenance.changeFeed,
|
|
136
146
|
signal,
|
|
137
147
|
...report ? { report } : {}
|
|
@@ -152,7 +162,10 @@ function createReliableReportingService(options) {
|
|
|
152
162
|
resolveConsumerId: options.resolveConsumerId,
|
|
153
163
|
...effectiveConsumerMismatchEscalation ? { consumerMismatchEscalation: effectiveConsumerMismatchEscalation } : {}
|
|
154
164
|
}) : (0, import_ledger.createReportingStatusHandler)(options.store);
|
|
155
|
-
const getMediaBuyDelivery = (0, import_ledger.createReportingDeliveryHandler)(
|
|
165
|
+
const getMediaBuyDelivery = (0, import_ledger.createReportingDeliveryHandler)(
|
|
166
|
+
options.store,
|
|
167
|
+
options.legacyRevisionReader ? { legacyRevisionReader: options.legacyRevisionReader } : {}
|
|
168
|
+
);
|
|
156
169
|
const syncReportingStatus = options.resolveConsumerId ? (0, import_ledger.createSyncReportingStatusHandler)(options.store, {
|
|
157
170
|
resolveConsumerId: options.resolveConsumerId
|
|
158
171
|
}) : void 0;
|
|
@@ -356,6 +369,7 @@ async function createPostgresReliableReportingProductionService(options) {
|
|
|
356
369
|
if (typeof options.activity?.tenantScopeForAccount !== "function") {
|
|
357
370
|
throw new TypeError("Reliable Reporting production service requires activity.tenantScopeForAccount");
|
|
358
371
|
}
|
|
372
|
+
(0, import_maintenance.assertReportingLedgerMaintenanceOptions)({ compaction: options.compaction }, options.statusRetentionDays);
|
|
359
373
|
if (Object.values(options.adapters).some(
|
|
360
374
|
(adapter) => adapter.deliveryOffering.reconciliation_mode === "consumer_receipt"
|
|
361
375
|
) && typeof options.obligatedConsumers !== "function") {
|
|
@@ -427,6 +441,7 @@ async function createPostgresReliableReportingProductionService(options) {
|
|
|
427
441
|
...options.rowStorage ? { rowStorage: options.rowStorage } : {},
|
|
428
442
|
...options.changeFeed ? { changeFeed: true } : {}
|
|
429
443
|
});
|
|
444
|
+
if (options.compaction) coreStore.assertCompactionSafeRowBindings();
|
|
430
445
|
const managedStore = new import_ledger.PostgresReportingManagedDeliveryStore(options.db, {
|
|
431
446
|
...options.managedDelivery.store,
|
|
432
447
|
statusRetentionDays: options.statusRetentionDays,
|
|
@@ -455,6 +470,7 @@ async function createPostgresReliableReportingProductionService(options) {
|
|
|
455
470
|
await webhookActivity.probe();
|
|
456
471
|
const managed = await (0, import_ledger.createReportingManagedDeliveryRuntime)({
|
|
457
472
|
coreStore,
|
|
473
|
+
...options.legacyRevisionReader ? { legacyRevisionReader: options.legacyRevisionReader } : {},
|
|
458
474
|
store: managedStore,
|
|
459
475
|
adapter: options.managedDelivery.adapter,
|
|
460
476
|
offerings: core.capabilities.offerings,
|
|
@@ -563,7 +579,9 @@ async function createPostgresReliableReportingProductionService(options) {
|
|
|
563
579
|
store: coreStore,
|
|
564
580
|
sweepSnapshots: (limit) => (0, import_ledger.sweepExpiredReportingLedgerState)(options.db, limit),
|
|
565
581
|
statusRetentionDays: options.statusRetentionDays,
|
|
582
|
+
automatedRecoveryWindowSeconds: options.automatedRecoveryWindowSeconds,
|
|
566
583
|
retention: options.retention,
|
|
584
|
+
compaction: options.compaction,
|
|
567
585
|
changeFeed: options.changeFeed,
|
|
568
586
|
signal,
|
|
569
587
|
report: (error) => reportAuxiliaryError(scheduler, error)
|
|
@@ -119,7 +119,12 @@ function createReliableReportingService(options) {
|
|
|
119
119
|
throw new TypeError("maintenance must be an options object");
|
|
120
120
|
}
|
|
121
121
|
const candidate = options.store;
|
|
122
|
-
for (const method of [
|
|
122
|
+
for (const method of [
|
|
123
|
+
"retireExpiredPeriods",
|
|
124
|
+
"pruneChanges",
|
|
125
|
+
"sweepRowWriteIntents",
|
|
126
|
+
...maintenance.compaction ? ["compactSupersededSnapshots"] : []
|
|
127
|
+
]) {
|
|
123
128
|
if (typeof candidate[method] !== "function") {
|
|
124
129
|
throw new TypeError(
|
|
125
130
|
`maintenance requires a PostgresReportingLedgerStore (or a store with ${method}); the configured store cannot run ledger maintenance`
|
|
@@ -127,6 +132,9 @@ function createReliableReportingService(options) {
|
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
134
|
maintenanceStore = candidate;
|
|
135
|
+
if (maintenance.compaction) {
|
|
136
|
+
candidate.assertCompactionSafeRowBindings?.();
|
|
137
|
+
}
|
|
130
138
|
if (maintenance.changeFeed && maintenanceStore.changeFeedEnabled === false) {
|
|
131
139
|
throw new TypeError(
|
|
132
140
|
"maintenance.changeFeed requires the store to be built with changeFeed: true; otherwise pruning silently does nothing"
|
|
@@ -142,7 +150,9 @@ function createReliableReportingService(options) {
|
|
|
142
150
|
store: maintenanceStore,
|
|
143
151
|
...typeof maintenanceStore.sweepExpiredState === "function" ? { sweepSnapshots: (limit) => maintenanceStore.sweepExpiredState(limit) } : {},
|
|
144
152
|
statusRetentionDays: retentionDays,
|
|
153
|
+
automatedRecoveryWindowSeconds: options.automatedRecoveryWindowSeconds,
|
|
145
154
|
retention: maintenance.retention,
|
|
155
|
+
compaction: maintenance.compaction,
|
|
146
156
|
changeFeed: maintenance.changeFeed,
|
|
147
157
|
signal,
|
|
148
158
|
...report ? { report } : {}
|
|
@@ -163,7 +173,10 @@ function createReliableReportingService(options) {
|
|
|
163
173
|
resolveConsumerId: options.resolveConsumerId,
|
|
164
174
|
...effectiveConsumerMismatchEscalation ? { consumerMismatchEscalation: effectiveConsumerMismatchEscalation } : {}
|
|
165
175
|
}) : createReportingStatusHandler(options.store);
|
|
166
|
-
const getMediaBuyDelivery = createReportingDeliveryHandler(
|
|
176
|
+
const getMediaBuyDelivery = createReportingDeliveryHandler(
|
|
177
|
+
options.store,
|
|
178
|
+
options.legacyRevisionReader ? { legacyRevisionReader: options.legacyRevisionReader } : {}
|
|
179
|
+
);
|
|
167
180
|
const syncReportingStatus = options.resolveConsumerId ? createSyncReportingStatusHandler(options.store, {
|
|
168
181
|
resolveConsumerId: options.resolveConsumerId
|
|
169
182
|
}) : void 0;
|
|
@@ -367,6 +380,7 @@ async function createPostgresReliableReportingProductionService(options) {
|
|
|
367
380
|
if (typeof options.activity?.tenantScopeForAccount !== "function") {
|
|
368
381
|
throw new TypeError("Reliable Reporting production service requires activity.tenantScopeForAccount");
|
|
369
382
|
}
|
|
383
|
+
assertReportingLedgerMaintenanceOptions({ compaction: options.compaction }, options.statusRetentionDays);
|
|
370
384
|
if (Object.values(options.adapters).some(
|
|
371
385
|
(adapter) => adapter.deliveryOffering.reconciliation_mode === "consumer_receipt"
|
|
372
386
|
) && typeof options.obligatedConsumers !== "function") {
|
|
@@ -438,6 +452,7 @@ async function createPostgresReliableReportingProductionService(options) {
|
|
|
438
452
|
...options.rowStorage ? { rowStorage: options.rowStorage } : {},
|
|
439
453
|
...options.changeFeed ? { changeFeed: true } : {}
|
|
440
454
|
});
|
|
455
|
+
if (options.compaction) coreStore.assertCompactionSafeRowBindings();
|
|
441
456
|
const managedStore = new PostgresReportingManagedDeliveryStore(options.db, {
|
|
442
457
|
...options.managedDelivery.store,
|
|
443
458
|
statusRetentionDays: options.statusRetentionDays,
|
|
@@ -466,6 +481,7 @@ async function createPostgresReliableReportingProductionService(options) {
|
|
|
466
481
|
await webhookActivity.probe();
|
|
467
482
|
const managed = await createReportingManagedDeliveryRuntime({
|
|
468
483
|
coreStore,
|
|
484
|
+
...options.legacyRevisionReader ? { legacyRevisionReader: options.legacyRevisionReader } : {},
|
|
469
485
|
store: managedStore,
|
|
470
486
|
adapter: options.managedDelivery.adapter,
|
|
471
487
|
offerings: core.capabilities.offerings,
|
|
@@ -574,7 +590,9 @@ async function createPostgresReliableReportingProductionService(options) {
|
|
|
574
590
|
store: coreStore,
|
|
575
591
|
sweepSnapshots: (limit) => sweepExpiredReportingLedgerState(options.db, limit),
|
|
576
592
|
statusRetentionDays: options.statusRetentionDays,
|
|
593
|
+
automatedRecoveryWindowSeconds: options.automatedRecoveryWindowSeconds,
|
|
577
594
|
retention: options.retention,
|
|
595
|
+
compaction: options.compaction,
|
|
578
596
|
changeFeed: options.changeFeed,
|
|
579
597
|
signal,
|
|
580
598
|
report: (error) => reportAuxiliaryError(scheduler, error)
|
|
@@ -11,18 +11,33 @@ export interface ReportingRetentionOptionsV1 {
|
|
|
11
11
|
recordRetentionDays?: number;
|
|
12
12
|
limit?: number;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Opt-in compaction of superseded snapshot revisions to metadata only, as
|
|
16
|
+
* adcontextprotocol/adcp#8100 permits. Off unless `enabled: true`. Uses the
|
|
17
|
+
* service's `statusRetentionDays` and `automatedRecoveryWindowSeconds`, so it
|
|
18
|
+
* can never drop content earlier than the commitments advertised to buyers.
|
|
19
|
+
*
|
|
20
|
+
* Compaction takes effect in the AdCP release after November 20, 2026; do not
|
|
21
|
+
* enable it in production before then. See `docs/guides/REPORTING-OPERATIONS.md`.
|
|
22
|
+
*/
|
|
23
|
+
export interface ReportingCompactionOptionsV1 {
|
|
24
|
+
enabled: true;
|
|
25
|
+
/** Revisions compacted per pass. Defaults to 100. */
|
|
26
|
+
limit?: number;
|
|
27
|
+
}
|
|
14
28
|
/** Change-feed pruning window and the consumer hold shared with retention. */
|
|
15
29
|
export type ReportingChangeFeedMaintenanceOptionsV1 = boolean | {
|
|
16
30
|
changeRetentionDays?: number;
|
|
17
31
|
maxFeedHoldDays?: number;
|
|
18
32
|
};
|
|
19
33
|
/** The ledger-store surface a maintenance pass drives. */
|
|
20
|
-
export type ReportingLedgerMaintenanceStoreV1 = Pick<PostgresReportingLedgerStore, 'sweepRowWriteIntents' | 'pruneChanges' | 'retireExpiredPeriods'
|
|
34
|
+
export type ReportingLedgerMaintenanceStoreV1 = Pick<PostgresReportingLedgerStore, 'sweepRowWriteIntents' | 'pruneChanges' | 'retireExpiredPeriods'> & Partial<Pick<PostgresReportingLedgerStore, 'compactSupersededSnapshots'>>;
|
|
21
35
|
interface ReportingLedgerMaintenanceTaskOutcomesV1 {
|
|
22
36
|
'snapshot sweep': Awaited<ReturnType<PostgresReportingLedgerStore['sweepExpiredState']>>;
|
|
23
37
|
'row upload sweep': Awaited<ReturnType<PostgresReportingLedgerStore['sweepRowWriteIntents']>>;
|
|
24
38
|
'change-feed pruning': Awaited<ReturnType<PostgresReportingLedgerStore['pruneChanges']>>;
|
|
25
39
|
retention: Awaited<ReturnType<PostgresReportingLedgerStore['retireExpiredPeriods']>>;
|
|
40
|
+
'snapshot compaction': Awaited<ReturnType<PostgresReportingLedgerStore['compactSupersededSnapshots']>>;
|
|
26
41
|
}
|
|
27
42
|
export type ReportingLedgerMaintenanceTaskNameV1 = keyof ReportingLedgerMaintenanceTaskOutcomesV1;
|
|
28
43
|
/**
|
|
@@ -62,7 +77,10 @@ export interface RunReportingLedgerMaintenanceInputV1 {
|
|
|
62
77
|
*/
|
|
63
78
|
sweepSnapshots?: (limit: number) => Promise<ReportingLedgerMaintenanceTaskOutcomesV1['snapshot sweep']>;
|
|
64
79
|
statusRetentionDays: number;
|
|
80
|
+
/** The service's advertised `automated_recovery_window_seconds`; required when `compaction` is enabled. */
|
|
81
|
+
automatedRecoveryWindowSeconds?: number | undefined;
|
|
65
82
|
retention?: ReportingRetentionOptionsV1 | undefined;
|
|
83
|
+
compaction?: ReportingCompactionOptionsV1 | undefined;
|
|
66
84
|
changeFeed?: ReportingChangeFeedMaintenanceOptionsV1 | undefined;
|
|
67
85
|
signal?: AbortSignal | undefined;
|
|
68
86
|
/**
|
|
@@ -86,6 +104,7 @@ export declare function runReportingLedgerMaintenance(input: RunReportingLedgerM
|
|
|
86
104
|
*/
|
|
87
105
|
export declare function assertReportingLedgerMaintenanceOptions(input: {
|
|
88
106
|
retention?: ReportingRetentionOptionsV1 | undefined;
|
|
107
|
+
compaction?: ReportingCompactionOptionsV1 | undefined;
|
|
89
108
|
changeFeed?: ReportingChangeFeedMaintenanceOptionsV1 | undefined;
|
|
90
109
|
}, statusRetentionDays: number): void;
|
|
91
110
|
export {};
|
|
@@ -11,18 +11,33 @@ export interface ReportingRetentionOptionsV1 {
|
|
|
11
11
|
recordRetentionDays?: number;
|
|
12
12
|
limit?: number;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Opt-in compaction of superseded snapshot revisions to metadata only, as
|
|
16
|
+
* adcontextprotocol/adcp#8100 permits. Off unless `enabled: true`. Uses the
|
|
17
|
+
* service's `statusRetentionDays` and `automatedRecoveryWindowSeconds`, so it
|
|
18
|
+
* can never drop content earlier than the commitments advertised to buyers.
|
|
19
|
+
*
|
|
20
|
+
* Compaction takes effect in the AdCP release after November 20, 2026; do not
|
|
21
|
+
* enable it in production before then. See `docs/guides/REPORTING-OPERATIONS.md`.
|
|
22
|
+
*/
|
|
23
|
+
export interface ReportingCompactionOptionsV1 {
|
|
24
|
+
enabled: true;
|
|
25
|
+
/** Revisions compacted per pass. Defaults to 100. */
|
|
26
|
+
limit?: number;
|
|
27
|
+
}
|
|
14
28
|
/** Change-feed pruning window and the consumer hold shared with retention. */
|
|
15
29
|
export type ReportingChangeFeedMaintenanceOptionsV1 = boolean | {
|
|
16
30
|
changeRetentionDays?: number;
|
|
17
31
|
maxFeedHoldDays?: number;
|
|
18
32
|
};
|
|
19
33
|
/** The ledger-store surface a maintenance pass drives. */
|
|
20
|
-
export type ReportingLedgerMaintenanceStoreV1 = Pick<PostgresReportingLedgerStore, 'sweepRowWriteIntents' | 'pruneChanges' | 'retireExpiredPeriods'
|
|
34
|
+
export type ReportingLedgerMaintenanceStoreV1 = Pick<PostgresReportingLedgerStore, 'sweepRowWriteIntents' | 'pruneChanges' | 'retireExpiredPeriods'> & Partial<Pick<PostgresReportingLedgerStore, 'compactSupersededSnapshots'>>;
|
|
21
35
|
interface ReportingLedgerMaintenanceTaskOutcomesV1 {
|
|
22
36
|
'snapshot sweep': Awaited<ReturnType<PostgresReportingLedgerStore['sweepExpiredState']>>;
|
|
23
37
|
'row upload sweep': Awaited<ReturnType<PostgresReportingLedgerStore['sweepRowWriteIntents']>>;
|
|
24
38
|
'change-feed pruning': Awaited<ReturnType<PostgresReportingLedgerStore['pruneChanges']>>;
|
|
25
39
|
retention: Awaited<ReturnType<PostgresReportingLedgerStore['retireExpiredPeriods']>>;
|
|
40
|
+
'snapshot compaction': Awaited<ReturnType<PostgresReportingLedgerStore['compactSupersededSnapshots']>>;
|
|
26
41
|
}
|
|
27
42
|
export type ReportingLedgerMaintenanceTaskNameV1 = keyof ReportingLedgerMaintenanceTaskOutcomesV1;
|
|
28
43
|
/**
|
|
@@ -62,7 +77,10 @@ export interface RunReportingLedgerMaintenanceInputV1 {
|
|
|
62
77
|
*/
|
|
63
78
|
sweepSnapshots?: (limit: number) => Promise<ReportingLedgerMaintenanceTaskOutcomesV1['snapshot sweep']>;
|
|
64
79
|
statusRetentionDays: number;
|
|
80
|
+
/** The service's advertised `automated_recovery_window_seconds`; required when `compaction` is enabled. */
|
|
81
|
+
automatedRecoveryWindowSeconds?: number | undefined;
|
|
65
82
|
retention?: ReportingRetentionOptionsV1 | undefined;
|
|
83
|
+
compaction?: ReportingCompactionOptionsV1 | undefined;
|
|
66
84
|
changeFeed?: ReportingChangeFeedMaintenanceOptionsV1 | undefined;
|
|
67
85
|
signal?: AbortSignal | undefined;
|
|
68
86
|
/**
|
|
@@ -86,6 +104,7 @@ export declare function runReportingLedgerMaintenance(input: RunReportingLedgerM
|
|
|
86
104
|
*/
|
|
87
105
|
export declare function assertReportingLedgerMaintenanceOptions(input: {
|
|
88
106
|
retention?: ReportingRetentionOptionsV1 | undefined;
|
|
107
|
+
compaction?: ReportingCompactionOptionsV1 | undefined;
|
|
89
108
|
changeFeed?: ReportingChangeFeedMaintenanceOptionsV1 | undefined;
|
|
90
109
|
}, statusRetentionDays: number): void;
|
|
91
110
|
export {};
|
|
@@ -38,7 +38,7 @@ class ReportingMaintenancePartialFailureError extends Error {
|
|
|
38
38
|
failedIds;
|
|
39
39
|
}
|
|
40
40
|
async function runReportingLedgerMaintenance(input) {
|
|
41
|
-
const { store, signal, changeFeed, retention } = input;
|
|
41
|
+
const { store, signal, changeFeed, retention, compaction } = input;
|
|
42
42
|
const start = (name, run) => {
|
|
43
43
|
try {
|
|
44
44
|
return [name, run()];
|
|
@@ -71,6 +71,23 @@ async function runReportingLedgerMaintenance(input) {
|
|
|
71
71
|
...signal ? { signal } : {}
|
|
72
72
|
})
|
|
73
73
|
)
|
|
74
|
+
] : [],
|
|
75
|
+
...compaction?.enabled ? [
|
|
76
|
+
start("snapshot compaction", () => {
|
|
77
|
+
if (typeof store.compactSupersededSnapshots !== "function") {
|
|
78
|
+
throw new TypeError("compaction requires a store with compactSupersededSnapshots");
|
|
79
|
+
}
|
|
80
|
+
if (input.automatedRecoveryWindowSeconds === void 0) {
|
|
81
|
+
throw new TypeError("compaction requires automatedRecoveryWindowSeconds");
|
|
82
|
+
}
|
|
83
|
+
return store.compactSupersededSnapshots({
|
|
84
|
+
statusRetentionDays: input.statusRetentionDays,
|
|
85
|
+
automatedRecoveryWindowSeconds: input.automatedRecoveryWindowSeconds,
|
|
86
|
+
...typeof changeFeed === "object" && changeFeed.maxFeedHoldDays !== void 0 ? { maxFeedHoldDays: changeFeed.maxFeedHoldDays } : {},
|
|
87
|
+
limit: compaction.limit ?? 100,
|
|
88
|
+
...signal ? { signal } : {}
|
|
89
|
+
});
|
|
90
|
+
})
|
|
74
91
|
] : []
|
|
75
92
|
];
|
|
76
93
|
const settled = await Promise.allSettled(tasks.map(([, task]) => task));
|
|
@@ -108,7 +125,13 @@ function assertReportingLedgerMaintenanceOptions(input, statusRetentionDays) {
|
|
|
108
125
|
throw new TypeError(`${field} must be a positive safe integer`);
|
|
109
126
|
}
|
|
110
127
|
};
|
|
111
|
-
const { retention, changeFeed } = input;
|
|
128
|
+
const { retention, changeFeed, compaction } = input;
|
|
129
|
+
if (compaction !== void 0) {
|
|
130
|
+
if (compaction === null || typeof compaction !== "object" || compaction.enabled !== true) {
|
|
131
|
+
throw new TypeError("maintenance.compaction must be { enabled: true, ... }");
|
|
132
|
+
}
|
|
133
|
+
if (compaction.limit !== void 0) positive(compaction.limit, "maintenance.compaction.limit");
|
|
134
|
+
}
|
|
112
135
|
if (retention !== void 0) {
|
|
113
136
|
if (retention === null || typeof retention !== "object" || retention.enabled !== true) {
|
|
114
137
|
throw new TypeError("maintenance.retention must be { enabled: true, ... }");
|
|
@@ -13,7 +13,7 @@ class ReportingMaintenancePartialFailureError extends Error {
|
|
|
13
13
|
failedIds;
|
|
14
14
|
}
|
|
15
15
|
async function runReportingLedgerMaintenance(input) {
|
|
16
|
-
const { store, signal, changeFeed, retention } = input;
|
|
16
|
+
const { store, signal, changeFeed, retention, compaction } = input;
|
|
17
17
|
const start = (name, run) => {
|
|
18
18
|
try {
|
|
19
19
|
return [name, run()];
|
|
@@ -46,6 +46,23 @@ async function runReportingLedgerMaintenance(input) {
|
|
|
46
46
|
...signal ? { signal } : {}
|
|
47
47
|
})
|
|
48
48
|
)
|
|
49
|
+
] : [],
|
|
50
|
+
...compaction?.enabled ? [
|
|
51
|
+
start("snapshot compaction", () => {
|
|
52
|
+
if (typeof store.compactSupersededSnapshots !== "function") {
|
|
53
|
+
throw new TypeError("compaction requires a store with compactSupersededSnapshots");
|
|
54
|
+
}
|
|
55
|
+
if (input.automatedRecoveryWindowSeconds === void 0) {
|
|
56
|
+
throw new TypeError("compaction requires automatedRecoveryWindowSeconds");
|
|
57
|
+
}
|
|
58
|
+
return store.compactSupersededSnapshots({
|
|
59
|
+
statusRetentionDays: input.statusRetentionDays,
|
|
60
|
+
automatedRecoveryWindowSeconds: input.automatedRecoveryWindowSeconds,
|
|
61
|
+
...typeof changeFeed === "object" && changeFeed.maxFeedHoldDays !== void 0 ? { maxFeedHoldDays: changeFeed.maxFeedHoldDays } : {},
|
|
62
|
+
limit: compaction.limit ?? 100,
|
|
63
|
+
...signal ? { signal } : {}
|
|
64
|
+
});
|
|
65
|
+
})
|
|
49
66
|
] : []
|
|
50
67
|
];
|
|
51
68
|
const settled = await Promise.allSettled(tasks.map(([, task]) => task));
|
|
@@ -83,7 +100,13 @@ function assertReportingLedgerMaintenanceOptions(input, statusRetentionDays) {
|
|
|
83
100
|
throw new TypeError(`${field} must be a positive safe integer`);
|
|
84
101
|
}
|
|
85
102
|
};
|
|
86
|
-
const { retention, changeFeed } = input;
|
|
103
|
+
const { retention, changeFeed, compaction } = input;
|
|
104
|
+
if (compaction !== void 0) {
|
|
105
|
+
if (compaction === null || typeof compaction !== "object" || compaction.enabled !== true) {
|
|
106
|
+
throw new TypeError("maintenance.compaction must be { enabled: true, ... }");
|
|
107
|
+
}
|
|
108
|
+
if (compaction.limit !== void 0) positive(compaction.limit, "maintenance.compaction.limit");
|
|
109
|
+
}
|
|
87
110
|
if (retention !== void 0) {
|
|
88
111
|
if (retention === null || typeof retention !== "object" || retention.enabled !== true) {
|
|
89
112
|
throw new TypeError("maintenance.retention must be { enabled: true, ... }");
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
"source_sha": "4e553ad955f83b49c7d221ab5c3ff78237ad02e3",
|
|
5
5
|
"source_tarball_sha256": "580656d6466ef9f0d1119985e6726c2efea718dc671e2ad30957fcb2fd54af0f",
|
|
6
6
|
"upstream_adcp_version": "2.5.3",
|
|
7
|
-
"synced_at": "2026-10-
|
|
7
|
+
"synced_at": "2026-10-11T13:22:33.550Z"
|
|
8
8
|
}
|
|
@@ -32,25 +32,25 @@ const UNKNOWN_FORMAT_ID = Object.freeze({ agent_url: "https://unknown.example.co
|
|
|
32
32
|
const FALLBACK_CALLER_AGENT_URL = "https://e2e-orchestrator.adcontextprotocol.org/";
|
|
33
33
|
const FIXTURE_AWARE_ENRICHERS = /* @__PURE__ */ new Set([
|
|
34
34
|
"create_media_buy",
|
|
35
|
-
//
|
|
35
|
+
// preserves authored accounts and merges discovered identifiers INTO fixture packages[0]
|
|
36
36
|
"comply_test_controller",
|
|
37
37
|
// forces account.sandbox: true regardless of fixture
|
|
38
38
|
"check_governance",
|
|
39
39
|
// preserves the authored intent-vs-delivery request shape
|
|
40
40
|
"get_products",
|
|
41
|
-
// preserves
|
|
41
|
+
// preserves discovery fields and authored account identities
|
|
42
42
|
"get_signals",
|
|
43
|
-
// preserves discovery fields
|
|
43
|
+
// preserves discovery fields and authored account identities
|
|
44
44
|
"get_task_status",
|
|
45
|
-
// preserves task filters
|
|
45
|
+
// preserves task filters and authored account identities
|
|
46
46
|
"list_tasks",
|
|
47
|
-
// preserves reconciliation filters
|
|
47
|
+
// preserves reconciliation filters and authored account identities
|
|
48
48
|
"update_media_buy",
|
|
49
|
-
//
|
|
49
|
+
// fills missing account identity and carries sandbox routing into authored natural keys
|
|
50
50
|
"get_media_buys",
|
|
51
|
-
//
|
|
51
|
+
// fills missing account identity and carries sandbox routing into authored natural keys
|
|
52
52
|
"get_media_buy_delivery"
|
|
53
|
-
//
|
|
53
|
+
// fills missing account identity and carries sandbox routing into authored natural keys
|
|
54
54
|
]);
|
|
55
55
|
function hasUnresolvedContextReference(value) {
|
|
56
56
|
if (typeof value === "string") return /^\$context\.\w+$/.test(value);
|
|
@@ -93,23 +93,21 @@ function runClockMs(runnerVars) {
|
|
|
93
93
|
return runnerVars?.runStartMs ?? Date.now();
|
|
94
94
|
}
|
|
95
95
|
function resolveMediaBuyAccount(fixtureAccount, contextAccount, options) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
if (hasAuthoredAccountIdentity(fixtureAccount)) {
|
|
97
|
+
if (hasUnresolvedContextReference(fixtureAccount)) return fixtureAccount;
|
|
98
|
+
if (typeof fixtureAccount.account_id === "string") return fixtureAccount;
|
|
99
|
+
const sandbox = contextAccount?.sandbox ?? (0, import_client.resolveAccount)(options).sandbox;
|
|
99
100
|
return {
|
|
100
101
|
...fixtureAccount,
|
|
101
102
|
...sandbox !== void 0 && { sandbox }
|
|
102
103
|
};
|
|
103
104
|
}
|
|
104
|
-
return
|
|
105
|
+
return contextAccount ?? (0, import_client.resolveAccount)(options);
|
|
105
106
|
}
|
|
106
107
|
function resolveDiscoveryAccount(task, fixtureAccount, contextAccount, options) {
|
|
107
|
-
if (import_account_policy.ACCOUNT_FREE_DISCOVERY_TASKS.has(task) &&
|
|
108
|
-
return void 0;
|
|
108
|
+
if (import_account_policy.ACCOUNT_FREE_DISCOVERY_TASKS.has(task) && hasUnresolvedContextReference(fixtureAccount)) return contextAccount;
|
|
109
109
|
if (import_account_policy.ACCOUNT_FREE_DISCOVERY_TASKS.has(task) && fixtureAccount === void 0 && contextAccount === void 0)
|
|
110
110
|
return void 0;
|
|
111
|
-
if (contextAccount === void 0 && fixtureAccount && typeof fixtureAccount === "object" && "account_id" in fixtureAccount)
|
|
112
|
-
return fixtureAccount;
|
|
113
111
|
return resolveMediaBuyAccount(fixtureAccount, contextAccount, options);
|
|
114
112
|
}
|
|
115
113
|
const OPERATION_SCOPED_CONTROLLER_SCENARIOS = /* @__PURE__ */ new Set([
|