@adcp/sdk 16.0.0-beta.3 → 16.0.0-beta.4
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/auth/oauth/diagnose.js +3 -11
- package/dist/lib/auth/oauth/diagnose.mjs +4 -12
- package/dist/lib/auth/oauth/diagnostics.d.mts +2 -1
- package/dist/lib/auth/oauth/diagnostics.d.ts +2 -1
- package/dist/lib/auth/oauth/diagnostics.js +8 -10
- package/dist/lib/auth/oauth/diagnostics.mjs +7 -10
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.mjs +7 -1
- package/dist/lib/reporting/consumer-runtime.js +2 -1
- package/dist/lib/reporting/consumer-runtime.mjs +2 -1
- package/dist/lib/reporting/ledger/handler.js +50 -11
- package/dist/lib/reporting/ledger/handler.mjs +50 -12
- package/dist/lib/reporting/ledger/index.d.mts +17 -14
- package/dist/lib/reporting/ledger/index.d.ts +17 -14
- package/dist/lib/reporting/ledger/index.js +32 -20
- package/dist/lib/reporting/ledger/index.mjs +21 -10
- package/dist/lib/reporting/ledger/offering-validation.d.mts +9 -0
- package/dist/lib/reporting/ledger/offering-validation.d.ts +9 -0
- package/dist/lib/reporting/{gcs/bucket-policy.js → ledger/offering-validation.js} +9 -8
- package/dist/lib/reporting/ledger/offering-validation.mjs +8 -0
- package/dist/lib/reporting/ledger/receipts.d.mts +48 -0
- package/dist/lib/reporting/ledger/receipts.d.ts +48 -0
- package/dist/lib/reporting/ledger/receipts.js +186 -0
- package/dist/lib/reporting/ledger/receipts.mjs +161 -0
- package/dist/lib/reporting/ledger/status-ingest.js +3 -3
- package/dist/lib/reporting/ledger/status-ingest.mjs +4 -5
- package/dist/lib/reporting/ledger/types.d.mts +43 -0
- package/dist/lib/reporting/ledger/types.d.ts +43 -0
- package/dist/lib/reporting/ledger/types.js +31 -2
- package/dist/lib/reporting/ledger/types.mjs +26 -1
- package/dist/lib/reporting/pagination.d.mts +6 -0
- package/dist/lib/reporting/pagination.d.ts +6 -0
- package/dist/lib/reporting/{gcs/errors.js → pagination.js} +12 -17
- package/dist/lib/reporting/pagination.mjs +12 -0
- package/dist/lib/reporting/reconciliation.d.mts +1 -0
- package/dist/lib/reporting/reconciliation.d.ts +1 -0
- package/dist/lib/reporting/reconciliation.js +3 -2
- package/dist/lib/reporting/reconciliation.mjs +3 -2
- package/dist/lib/reporting/service/index.d.mts +79 -153
- package/dist/lib/reporting/service/index.d.ts +79 -153
- package/dist/lib/reporting/service/index.js +34 -491
- package/dist/lib/reporting/service/index.mjs +36 -510
- package/dist/lib/reporting/service/scheduler-support.d.mts +43 -0
- package/dist/lib/reporting/service/scheduler-support.d.ts +43 -0
- package/dist/lib/reporting/service/scheduler-support.js +125 -0
- package/dist/lib/reporting/service/scheduler-support.mjs +96 -0
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/signing/canonicalize.d.mts +4 -0
- package/dist/lib/signing/canonicalize.d.ts +4 -0
- package/dist/lib/signing/canonicalize.js +14 -8
- package/dist/lib/signing/canonicalize.mjs +14 -8
- package/dist/lib/signing/content-digest.d.mts +8 -0
- package/dist/lib/signing/content-digest.d.ts +8 -0
- package/dist/lib/signing/content-digest.js +11 -5
- package/dist/lib/signing/content-digest.mjs +10 -5
- package/dist/lib/signing/signer.js +9 -6
- package/dist/lib/signing/signer.mjs +10 -7
- package/dist/lib/signing/web-bot-auth.js +103 -37
- package/dist/lib/signing/web-bot-auth.mjs +108 -37
- package/dist/lib/testing/storyboard/junit.js +16 -3
- package/dist/lib/testing/storyboard/junit.mjs +16 -3
- package/dist/lib/testing/storyboard/request-signing/builder.js +10 -9
- package/dist/lib/testing/storyboard/request-signing/builder.mjs +10 -9
- package/dist/lib/testing/storyboard/runner.js +94 -25
- package/dist/lib/testing/storyboard/runner.mjs +94 -25
- package/dist/lib/testing/storyboard/types.d.mts +6 -0
- package/dist/lib/testing/storyboard/types.d.ts +6 -0
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- 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 +23 -5
- package/docs/guides/REPORTING-GCS-FENCE.md +3 -3
- package/docs/guides/REPORTING-GCS-MANAGED.md +4 -4
- package/docs/guides/REPORTING-LEDGER-CUTOVER.md +7 -7
- package/docs/guides/REPORTING-LEDGER.md +107 -51
- package/docs/guides/REPORTING-OPERATIONS.md +66 -5
- package/docs/guides/REPORTING-STABILITY.md +36 -32
- package/docs/llms.txt +4 -3
- package/docs/migration-14.x-rc-worksheet.md +4 -7
- package/docs/migration-reporting-storage-package.md +186 -0
- package/examples/README.md +1 -1
- package/package.json +13 -78
- package/dist/lib/reporting/azure/index.d.mts +0 -31
- package/dist/lib/reporting/azure/index.d.ts +0 -31
- package/dist/lib/reporting/azure/index.js +0 -266
- package/dist/lib/reporting/azure/index.mjs +0 -249
- package/dist/lib/reporting/bigquery/index.d.mts +0 -246
- package/dist/lib/reporting/bigquery/index.d.ts +0 -246
- package/dist/lib/reporting/bigquery/index.js +0 -633
- package/dist/lib/reporting/bigquery/index.mjs +0 -594
- package/dist/lib/reporting/gcs/adapter.d.mts +0 -38
- package/dist/lib/reporting/gcs/adapter.d.ts +0 -38
- package/dist/lib/reporting/gcs/adapter.js +0 -342
- package/dist/lib/reporting/gcs/adapter.mjs +0 -325
- package/dist/lib/reporting/gcs/bucket-policy.d.mts +0 -3
- package/dist/lib/reporting/gcs/bucket-policy.d.ts +0 -3
- package/dist/lib/reporting/gcs/bucket-policy.mjs +0 -7
- package/dist/lib/reporting/gcs/errors.d.mts +0 -11
- package/dist/lib/reporting/gcs/errors.d.ts +0 -11
- package/dist/lib/reporting/gcs/errors.mjs +0 -16
- package/dist/lib/reporting/gcs/fence.d.mts +0 -41
- package/dist/lib/reporting/gcs/fence.d.ts +0 -41
- package/dist/lib/reporting/gcs/fence.js +0 -250
- package/dist/lib/reporting/gcs/fence.mjs +0 -230
- package/dist/lib/reporting/gcs/index.d.mts +0 -18
- package/dist/lib/reporting/gcs/index.d.ts +0 -18
- package/dist/lib/reporting/gcs/index.js +0 -44
- package/dist/lib/reporting/gcs/index.mjs +0 -14
- package/dist/lib/reporting/gcs/io.d.mts +0 -7
- package/dist/lib/reporting/gcs/io.d.ts +0 -7
- package/dist/lib/reporting/gcs/io.js +0 -95
- package/dist/lib/reporting/gcs/io.mjs +0 -69
- package/dist/lib/reporting/gcs/reader.d.mts +0 -67
- package/dist/lib/reporting/gcs/reader.d.ts +0 -67
- package/dist/lib/reporting/gcs/reader.js +0 -193
- package/dist/lib/reporting/gcs/reader.mjs +0 -169
- package/dist/lib/reporting/gcs/row-provider.d.mts +0 -39
- package/dist/lib/reporting/gcs/row-provider.d.ts +0 -39
- package/dist/lib/reporting/gcs/row-provider.js +0 -225
- package/dist/lib/reporting/gcs/row-provider.mjs +0 -208
- package/dist/lib/reporting/gcs/validation.d.mts +0 -5
- package/dist/lib/reporting/gcs/validation.d.ts +0 -5
- package/dist/lib/reporting/gcs/validation.js +0 -49
- package/dist/lib/reporting/gcs/validation.mjs +0 -25
- package/dist/lib/reporting/ledger/change-feed.d.mts +0 -69
- package/dist/lib/reporting/ledger/change-feed.d.ts +0 -69
- package/dist/lib/reporting/ledger/change-feed.js +0 -107
- package/dist/lib/reporting/ledger/change-feed.mjs +0 -80
- package/dist/lib/reporting/ledger/managed-postgres.d.mts +0 -293
- package/dist/lib/reporting/ledger/managed-postgres.d.ts +0 -293
- package/dist/lib/reporting/ledger/managed-postgres.js +0 -2346
- package/dist/lib/reporting/ledger/managed-postgres.mjs +0 -2332
- package/dist/lib/reporting/ledger/managed-router.d.mts +0 -148
- package/dist/lib/reporting/ledger/managed-router.d.ts +0 -148
- package/dist/lib/reporting/ledger/managed-router.js +0 -280
- package/dist/lib/reporting/ledger/managed-router.mjs +0 -258
- package/dist/lib/reporting/ledger/managed.d.mts +0 -535
- package/dist/lib/reporting/ledger/managed.d.ts +0 -535
- package/dist/lib/reporting/ledger/managed.js +0 -761
- package/dist/lib/reporting/ledger/managed.mjs +0 -729
- package/dist/lib/reporting/ledger/notification-activity.d.mts +0 -332
- package/dist/lib/reporting/ledger/notification-activity.d.ts +0 -332
- package/dist/lib/reporting/ledger/notification-activity.js +0 -1366
- package/dist/lib/reporting/ledger/notification-activity.mjs +0 -1337
- package/dist/lib/reporting/ledger/object-writes.d.mts +0 -128
- package/dist/lib/reporting/ledger/object-writes.d.ts +0 -128
- package/dist/lib/reporting/ledger/object-writes.js +0 -147
- package/dist/lib/reporting/ledger/object-writes.mjs +0 -114
- package/dist/lib/reporting/ledger/postgres.d.mts +0 -689
- package/dist/lib/reporting/ledger/postgres.d.ts +0 -689
- package/dist/lib/reporting/ledger/postgres.js +0 -4462
- package/dist/lib/reporting/ledger/postgres.mjs +0 -4462
- package/dist/lib/reporting/ledger/row-storage-migration.d.mts +0 -59
- package/dist/lib/reporting/ledger/row-storage-migration.d.ts +0 -59
- package/dist/lib/reporting/ledger/row-storage-migration.js +0 -365
- package/dist/lib/reporting/ledger/row-storage-migration.mjs +0 -339
- package/dist/lib/reporting/ledger/row-storage-object.d.mts +0 -203
- package/dist/lib/reporting/ledger/row-storage-object.d.ts +0 -203
- package/dist/lib/reporting/ledger/row-storage-object.js +0 -379
- package/dist/lib/reporting/ledger/row-storage-object.mjs +0 -335
- package/dist/lib/reporting/ledger/row-storage-provider-io.d.mts +0 -44
- package/dist/lib/reporting/ledger/row-storage-provider-io.d.ts +0 -44
- package/dist/lib/reporting/ledger/row-storage-provider-io.js +0 -142
- package/dist/lib/reporting/ledger/row-storage-provider-io.mjs +0 -111
- package/dist/lib/reporting/ledger/row-storage.d.mts +0 -316
- package/dist/lib/reporting/ledger/row-storage.d.ts +0 -316
- package/dist/lib/reporting/ledger/row-storage.js +0 -812
- package/dist/lib/reporting/ledger/row-storage.mjs +0 -802
- package/dist/lib/reporting/s3/index.d.mts +0 -34
- package/dist/lib/reporting/s3/index.d.ts +0 -34
- package/dist/lib/reporting/s3/index.js +0 -347
- package/dist/lib/reporting/s3/index.mjs +0 -340
- package/dist/lib/reporting/service/maintenance.d.mts +0 -148
- package/dist/lib/reporting/service/maintenance.d.ts +0 -148
- package/dist/lib/reporting/service/maintenance.js +0 -185
- package/dist/lib/reporting/service/maintenance.mjs +0 -159
- package/examples/reliable-reporting-service/README.md +0 -169
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reliable Reporting service wiring
|
|
2
|
+
* Reliable Reporting service wiring and conformance runner.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* `createReliableReportingService` takes any `ReportingLedgerStore`. The PostgreSQL store, the production
|
|
5
|
+
* composition (`createPostgresReliableReportingProductionService`) and ledger maintenance
|
|
6
|
+
* (`reportingLedgerMaintenance`) live in `@adcp/reporting-storage`.
|
|
7
|
+
*
|
|
8
|
+
* The scheduler primitives (`reportingSchedulerDelay`, `rotateReportingRoster`, ...) and
|
|
9
|
+
* `REPORTING_MANAGED_DELIVERY_COMPOSITION_V1` are storage-facing building blocks for compositions such as
|
|
10
|
+
* `@adcp/reporting-storage/service`, covered by the experimental policy below; applications should not use them.
|
|
6
11
|
*
|
|
7
12
|
* Stability policy: https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
8
13
|
*
|
|
9
14
|
* @packageDocumentation
|
|
10
15
|
*/
|
|
11
|
-
import type { Account
|
|
16
|
+
import type { Account } from '../../server/decisioning/account.mjs';
|
|
12
17
|
import type { RequestContext } from '../../server/decisioning/context.mjs';
|
|
13
18
|
import type { DecisioningPlatform } from '../../server/decisioning/platform.mjs';
|
|
14
19
|
import type { ReliableReportingPlatform } from '../../server/decisioning/specialisms/reporting.mjs';
|
|
15
20
|
import type { ReportingDeliveryCapabilities, ReportingDeliveryOffering } from '../../types/tools.generated.mjs';
|
|
16
|
-
import { type
|
|
17
|
-
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';
|
|
18
|
-
import { type PostgresReportingWebhookActivityV1 } from '../webhook-activity.mjs';
|
|
19
|
-
import { type ReportingChangeFeedMaintenanceOptionsV1, type ReportingLedgerMaintenanceTaskResultV1, type ReportingCompactionOptionsV1, type ReportingRetentionOptionsV1 } from './maintenance.mjs';
|
|
21
|
+
import { type CreateReportingProducerOptionsV1, type ReportingConsumerMismatchEscalationV1, type ReportingLedgerConfigurationV1, type ReportingLedgerStore, type ReportingLegacyRevisionReaderV1, type ReportingProducerContactV1, type ReportingProducerV1, type ReportingSourceWithReaderV1 } from '../ledger/index.mjs';
|
|
20
22
|
import type { InlineReportingReplayRetentionV1 } from '../source/index.mjs';
|
|
21
23
|
import { type InlineReportingDeliveryFetchV1, type ReportingSourceOfferingV1 } from '../source/index.mjs';
|
|
22
24
|
/** The intentionally small provider boundary: one bounded slice fetch plus immutable metadata. */
|
|
@@ -161,20 +163,18 @@ export interface CreateReliableReportingServiceOptionsV1<TCtxMeta = Record<strin
|
|
|
161
163
|
statusRetentionDays: number;
|
|
162
164
|
subscribers?: CreateReportingProducerOptionsV1['subscribers'];
|
|
163
165
|
/**
|
|
164
|
-
* Opt in to scheduled ledger maintenance
|
|
165
|
-
*
|
|
166
|
-
* `
|
|
167
|
-
* with its own scheduler. The production service does this itself and does
|
|
168
|
-
* not take this option.
|
|
166
|
+
* Opt in to scheduled ledger maintenance (retention, compaction, change-feed pruning, abandoned-upload
|
|
167
|
+
* sweeps) for a Core-only deployment. `start()` runs it at most once per `intervalMilliseconds`;
|
|
168
|
+
* `runMaintenance()` runs it on demand for a host with its own scheduler.
|
|
169
169
|
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
170
|
+
* The SDK does not know what maintenance a store needs: the option takes a factory, called once at
|
|
171
|
+
* construction with the store and the retention and recovery-window commitments this service advertises
|
|
172
|
+
* to buyers, so maintenance can never retire a period earlier than that retention. For the PostgreSQL
|
|
173
|
+
* store, pass `reportingLedgerMaintenance({ ... })` from `@adcp/reporting-storage`. A factory that
|
|
174
|
+
* throws fails service construction, not the first scheduled pass. The production service in
|
|
175
|
+
* `@adcp/reporting-storage/service` runs maintenance itself and does not take this option.
|
|
176
176
|
*/
|
|
177
|
-
maintenance?:
|
|
177
|
+
maintenance?: ReliableReportingMaintenanceFactoryV1;
|
|
178
178
|
/**
|
|
179
179
|
* Serve exact revision reads (`get_media_buy_delivery`) for revisions this
|
|
180
180
|
* ledger does not hold, such as a seller's pre-cutover ledger tables. The
|
|
@@ -192,19 +192,66 @@ export interface CreateReliableReportingServiceOptionsV1<TCtxMeta = Record<strin
|
|
|
192
192
|
*/
|
|
193
193
|
legacyRevisionReader?: ReportingLegacyRevisionReaderV1;
|
|
194
194
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Outcome of one maintenance task. A task that resolved but could not process some items is `completed`
|
|
197
|
+
* with `partialFailure` set; the pass resumes those items next time.
|
|
198
|
+
*/
|
|
199
|
+
export type ReliableReportingMaintenanceTaskResultV1 = {
|
|
200
|
+
readonly task: string;
|
|
201
|
+
readonly status: 'completed';
|
|
202
|
+
readonly result: unknown;
|
|
203
|
+
readonly partialFailure?: Error;
|
|
204
|
+
} | {
|
|
205
|
+
readonly task: string;
|
|
206
|
+
readonly status: 'failed';
|
|
207
|
+
readonly error: unknown;
|
|
208
|
+
};
|
|
209
|
+
/** One scheduled maintenance pass, as built by a {@link ReliableReportingMaintenanceFactoryV1}. */
|
|
210
|
+
export interface ReliableReportingMaintenanceV1 {
|
|
211
|
+
/** Minimum time between scheduled passes. A positive safe integer. */
|
|
212
|
+
readonly intervalMilliseconds: number;
|
|
213
|
+
/**
|
|
214
|
+
* Run one pass. Tasks are isolated: a task failure is reported in its result, never thrown. `report`
|
|
215
|
+
* is awaited, in task order, for every task that rejected or partially failed, unless `signal` has
|
|
216
|
+
* aborted (an abort is shutdown, not a fault).
|
|
217
|
+
*/
|
|
218
|
+
run(input: {
|
|
219
|
+
signal?: AbortSignal | undefined;
|
|
220
|
+
report?: (error: unknown) => Promise<void>;
|
|
221
|
+
}): Promise<readonly ReliableReportingMaintenanceTaskResultV1[]>;
|
|
222
|
+
}
|
|
223
|
+
/** What the service tells a maintenance factory about the store it will maintain. */
|
|
224
|
+
export interface ReliableReportingMaintenanceContextV1 {
|
|
225
|
+
readonly store: ReportingLedgerStore;
|
|
226
|
+
/** The `statusRetentionDays` this service advertises. */
|
|
227
|
+
readonly statusRetentionDays: number;
|
|
228
|
+
/** The `automatedRecoveryWindowSeconds` this service advertises. */
|
|
229
|
+
readonly automatedRecoveryWindowSeconds: number;
|
|
204
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Builds the maintenance for one service. Throw from it to refuse a configuration the store cannot
|
|
233
|
+
* serve; the service lets the error reach the caller of `createReliableReportingService`.
|
|
234
|
+
*/
|
|
235
|
+
export type ReliableReportingMaintenanceFactoryV1 = (context: ReliableReportingMaintenanceContextV1) => ReliableReportingMaintenanceV1;
|
|
236
|
+
/**
|
|
237
|
+
* Composition token, for packages that compose this service with a managed-delivery runtime (such as
|
|
238
|
+
* `createPostgresReliableReportingProductionService` in `@adcp/reporting-storage/service`). Such a
|
|
239
|
+
* composition passes `{ [REPORTING_MANAGED_DELIVERY_COMPOSITION_V1]: store }`, naming the very `store` it passes
|
|
240
|
+
* as `store`, so the Core service accepts the managed-delivery and reconciled-billing offerings that only that
|
|
241
|
+
* composition can serve. A plain Core service refuses them.
|
|
242
|
+
*
|
|
243
|
+
* It is an assertion by the composer, not an authentication boundary: it keeps a Core-only service from
|
|
244
|
+
* advertising capabilities it has no runtime for by accident (the value must be the store itself, so a copied
|
|
245
|
+
* `true` does nothing). It is a `Symbol.for` key so it holds across duplicate copies of the SDK. Applications
|
|
246
|
+
* should not use it.
|
|
247
|
+
*
|
|
248
|
+
* @experimental Storage-facing building block: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
249
|
+
*/
|
|
250
|
+
export declare const REPORTING_MANAGED_DELIVERY_COMPOSITION_V1: unique symbol;
|
|
205
251
|
export interface ReliableReportingSetupV1 {
|
|
206
252
|
readonly component: 'reliable-reporting-core';
|
|
207
|
-
|
|
253
|
+
/** The store's own `migrations`: what to apply before first use. Empty for a store that needs none. */
|
|
254
|
+
readonly migrations: readonly string[];
|
|
208
255
|
readonly requiresIsolatedLedgerDatabaseAcknowledgement: true;
|
|
209
256
|
}
|
|
210
257
|
export interface ReliableReportingServiceV1<TCtxMeta = Record<string, unknown>> {
|
|
@@ -238,7 +285,7 @@ export interface ReliableReportingServiceV1<TCtxMeta = Record<string, unknown>>
|
|
|
238
285
|
*/
|
|
239
286
|
runMaintenance(options?: {
|
|
240
287
|
signal?: AbortSignal;
|
|
241
|
-
}): Promise<
|
|
288
|
+
}): Promise<readonly ReliableReportingMaintenanceTaskResultV1[]>;
|
|
242
289
|
start(options: ReliableReportingSchedulerOptionsV1): void;
|
|
243
290
|
stop(): Promise<void>;
|
|
244
291
|
}
|
|
@@ -247,126 +294,5 @@ export interface ReliableReportingServiceV1<TCtxMeta = Record<string, unknown>>
|
|
|
247
294
|
* and scheduler into one Reliable Reporting Core lifecycle owner.
|
|
248
295
|
*/
|
|
249
296
|
export declare function createReliableReportingService<TCtxMeta = Record<string, unknown>>(options: CreateReliableReportingServiceOptionsV1<TCtxMeta>): ReliableReportingServiceV1<TCtxMeta>;
|
|
250
|
-
type ProductionNotificationOptions = Omit<CreatePostgresPersistentNotificationRuntimeOptions, 'db' | 'publisherScope' | 'checkpointDeliveryAttempt' | 'supportedAccountEventTypes'>;
|
|
251
|
-
export type CreatePostgresReliableReportingProductionServiceOptionsV1<TCtxMeta = Record<string, unknown>> = Omit<CreateReliableReportingServiceOptionsV1<TCtxMeta>, 'store' | 'subscribers' | 'maintenance'> & {
|
|
252
|
-
db: ReportingPgPool;
|
|
253
|
-
/** Stable, non-secret deployment namespace shared by reporting workers. */
|
|
254
|
-
namespace: string;
|
|
255
|
-
/** Stable webhook publisher identity; credentials must never be used here. */
|
|
256
|
-
publisherScope: string;
|
|
257
|
-
/** Explicit acknowledgement required by the authoritative Core store. */
|
|
258
|
-
acknowledgeIsolatedDatabase: true;
|
|
259
|
-
/**
|
|
260
|
-
* Store new revision rows as verified canonical JSONL chunks. Adds
|
|
261
|
-
* `REPORTING_ROW_STORAGE_MIGRATION` (PostgreSQL 13+) to `setup.migrations`
|
|
262
|
-
* and probes it before publishing capabilities.
|
|
263
|
-
*/
|
|
264
|
-
rowStorage?: boolean | ReportingRowStorageOptionsV1;
|
|
265
|
-
/**
|
|
266
|
-
* Opt in to period-aligned retention. Each scheduler pass retires whole
|
|
267
|
-
* periods once `max(statusRetentionDays, recordRetentionDays)` has elapsed
|
|
268
|
-
* since both the period end and its latest publication, deleting their
|
|
269
|
-
* rows and ledger records and leaving a tombstone. Abandoned row uploads
|
|
270
|
-
* and expired cursor snapshots are always swept. With `changeFeed`, a
|
|
271
|
-
* period is also held until every live registered feed consumer (updated
|
|
272
|
-
* within `changeFeed.maxFeedHoldDays`, default 7) has read its changes.
|
|
273
|
-
*/
|
|
274
|
-
retention?: ReportingRetentionOptionsV1;
|
|
275
|
-
/**
|
|
276
|
-
* Opt in to compacting superseded snapshot revisions to metadata only, as
|
|
277
|
-
* adcontextprotocol/adcp#8100 permits. Off by default. Each scheduler pass
|
|
278
|
-
* drops the row content of snapshots that are superseded, past their
|
|
279
|
-
* recovery grace and not owed to any caller (receipts, current
|
|
280
|
-
* `received` / `unreadable` / `content_mismatch` statements), while every
|
|
281
|
-
* revision's metadata stays. Official revisions are never compacted. Uses
|
|
282
|
-
* this service's `statusRetentionDays` and `automatedRecoveryWindowSeconds`.
|
|
283
|
-
* The protocol takes compaction into effect only in the next eligible minor
|
|
284
|
-
* after November 20, 2026: do not enable this in production before then.
|
|
285
|
-
*/
|
|
286
|
-
compaction?: ReportingCompactionOptionsV1;
|
|
287
|
-
/**
|
|
288
|
-
* Maintain the host change feed (`changesAfter`, `getCurrentRevision`,
|
|
289
|
-
* `listCurrentRevisions` on `stores.core`). Adds
|
|
290
|
-
* `REPORTING_LEDGER_CHANGES_MIGRATION` (PostgreSQL 13+); the scheduler prunes
|
|
291
|
-
* changes older than `changeRetentionDays` (default 30) unless a registered
|
|
292
|
-
* consumer updated within `maxFeedHoldDays` (default 7) still needs them.
|
|
293
|
-
*/
|
|
294
|
-
changeFeed?: ReportingChangeFeedMaintenanceOptionsV1;
|
|
295
|
-
notifications: ProductionNotificationOptions;
|
|
296
|
-
managedDelivery: {
|
|
297
|
-
adapter: ReportingManagedDeliveryAdapterV1;
|
|
298
|
-
resourceRetentionDays: number;
|
|
299
|
-
authorizationRevocationSeconds: number;
|
|
300
|
-
store?: Omit<PostgresReportingManagedDeliveryStoreOptions, 'notificationActivityPort'>;
|
|
301
|
-
};
|
|
302
|
-
activity: Omit<PostgresReportingNotificationActivityOptions, 'db' | 'notifications' | 'namespace' | 'attemptCheckpoint' | 'tenantScopeForAccount'> & {
|
|
303
|
-
tenantScopeForAccount(accountId: string): string;
|
|
304
|
-
};
|
|
305
|
-
webhookActivity?: {
|
|
306
|
-
tableName?: string;
|
|
307
|
-
retentionDays?: number;
|
|
308
|
-
};
|
|
309
|
-
/** Resolve activity visibility from verified auth/registry state, never request fields. */
|
|
310
|
-
resolveWebhookActivityScope(context: ResolveContext): {
|
|
311
|
-
tenantId: string;
|
|
312
|
-
principalId: string;
|
|
313
|
-
} | Promise<{
|
|
314
|
-
tenantId: string;
|
|
315
|
-
principalId: string;
|
|
316
|
-
}>;
|
|
317
|
-
/** Trusted complete roster of consumers that owe receipts for an obligation. */
|
|
318
|
-
obligatedConsumers?: (input: {
|
|
319
|
-
reporting_obligation_id: string;
|
|
320
|
-
account_id: string;
|
|
321
|
-
}) => Promise<{
|
|
322
|
-
ids: readonly string[];
|
|
323
|
-
complete: boolean;
|
|
324
|
-
version?: string;
|
|
325
|
-
}>;
|
|
326
|
-
/** Optional migration-system bridge. Called before any capability probe. */
|
|
327
|
-
applyMigrations?: (migrations: readonly string[]) => Promise<void>;
|
|
328
|
-
};
|
|
329
|
-
export interface PostgresReliableReportingProductionServiceV1<TCtxMeta = Record<string, unknown>> {
|
|
330
|
-
readonly setup: {
|
|
331
|
-
readonly component: 'reliable-reporting-production';
|
|
332
|
-
readonly migrations: readonly string[];
|
|
333
|
-
};
|
|
334
|
-
readonly capabilities: ReportingDeliveryCapabilities;
|
|
335
|
-
readonly platform: ReliableReportingPlatform<TCtxMeta>;
|
|
336
|
-
readonly core: ReliableReportingServiceV1<TCtxMeta>;
|
|
337
|
-
readonly managed: ReportingManagedDeliveryRuntimeV1<RequestContext<Account<TCtxMeta>>>;
|
|
338
|
-
readonly notifications: PostgresPersistentNotificationRuntime;
|
|
339
|
-
readonly notificationActivity: PostgresReportingNotificationActivityRuntime;
|
|
340
|
-
readonly webhookActivity: PostgresReportingWebhookActivityV1;
|
|
341
|
-
readonly stores: {
|
|
342
|
-
core: PostgresReportingLedgerStore;
|
|
343
|
-
managed: PostgresReportingManagedDeliveryStore;
|
|
344
|
-
};
|
|
345
|
-
readonly running: boolean;
|
|
346
|
-
installConfiguration: ReliableReportingServiceV1<TCtxMeta>['installConfiguration'];
|
|
347
|
-
install<TPlatform extends DecisioningPlatform<unknown, TCtxMeta>>(platform: TPlatform): TPlatform & {
|
|
348
|
-
reporting: ReliableReportingPlatform<TCtxMeta>;
|
|
349
|
-
};
|
|
350
|
-
runCycle(options: ReliableReportingCycleOptionsV1): Promise<{
|
|
351
|
-
core: Awaited<ReturnType<ReliableReportingServiceV1<TCtxMeta>['runCycle']>>;
|
|
352
|
-
managed: Awaited<ReturnType<ReportingManagedDeliveryRuntimeV1['runWorker']>>;
|
|
353
|
-
}>;
|
|
354
|
-
recoverOnce(options: {
|
|
355
|
-
deploymentWide: true;
|
|
356
|
-
}): Promise<{
|
|
357
|
-
activity: Awaited<ReturnType<PostgresReportingNotificationActivityRuntime['recoverOnce']>>;
|
|
358
|
-
webhookOutbox: Awaited<ReturnType<PostgresPersistentNotificationRuntime['recoverOnce']>>;
|
|
359
|
-
}>;
|
|
360
|
-
start(options: ReliableReportingSchedulerOptionsV1 & {
|
|
361
|
-
deploymentWide: true;
|
|
362
|
-
}): void;
|
|
363
|
-
stop(): Promise<void>;
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Assemble and probe the complete seller-side Reliable Reporting production
|
|
367
|
-
* chain. Capability publication happens only after every durable component is
|
|
368
|
-
* present and the managed policy has been adopted.
|
|
369
|
-
*/
|
|
370
|
-
export declare function createPostgresReliableReportingProductionService<TCtxMeta = Record<string, unknown>>(options: CreatePostgresReliableReportingProductionServiceOptionsV1<TCtxMeta>): Promise<PostgresReliableReportingProductionServiceV1<TCtxMeta>>;
|
|
371
297
|
export * from './conformance.mjs';
|
|
372
|
-
export
|
|
298
|
+
export * from './scheduler-support.mjs';
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reliable Reporting service wiring
|
|
2
|
+
* Reliable Reporting service wiring and conformance runner.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* `createReliableReportingService` takes any `ReportingLedgerStore`. The PostgreSQL store, the production
|
|
5
|
+
* composition (`createPostgresReliableReportingProductionService`) and ledger maintenance
|
|
6
|
+
* (`reportingLedgerMaintenance`) live in `@adcp/reporting-storage`.
|
|
7
|
+
*
|
|
8
|
+
* The scheduler primitives (`reportingSchedulerDelay`, `rotateReportingRoster`, ...) and
|
|
9
|
+
* `REPORTING_MANAGED_DELIVERY_COMPOSITION_V1` are storage-facing building blocks for compositions such as
|
|
10
|
+
* `@adcp/reporting-storage/service`, covered by the experimental policy below; applications should not use them.
|
|
6
11
|
*
|
|
7
12
|
* Stability policy: https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
8
13
|
*
|
|
9
14
|
* @packageDocumentation
|
|
10
15
|
*/
|
|
11
|
-
import type { Account
|
|
16
|
+
import type { Account } from '../../server/decisioning/account';
|
|
12
17
|
import type { RequestContext } from '../../server/decisioning/context';
|
|
13
18
|
import type { DecisioningPlatform } from '../../server/decisioning/platform';
|
|
14
19
|
import type { ReliableReportingPlatform } from '../../server/decisioning/specialisms/reporting';
|
|
15
20
|
import type { ReportingDeliveryCapabilities, ReportingDeliveryOffering } from '../../types/tools.generated';
|
|
16
|
-
import { type
|
|
17
|
-
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';
|
|
18
|
-
import { type PostgresReportingWebhookActivityV1 } from '../webhook-activity';
|
|
19
|
-
import { type ReportingChangeFeedMaintenanceOptionsV1, type ReportingLedgerMaintenanceTaskResultV1, type ReportingCompactionOptionsV1, type ReportingRetentionOptionsV1 } from './maintenance';
|
|
21
|
+
import { type CreateReportingProducerOptionsV1, type ReportingConsumerMismatchEscalationV1, type ReportingLedgerConfigurationV1, type ReportingLedgerStore, type ReportingLegacyRevisionReaderV1, type ReportingProducerContactV1, type ReportingProducerV1, type ReportingSourceWithReaderV1 } from '../ledger';
|
|
20
22
|
import type { InlineReportingReplayRetentionV1 } from '../source';
|
|
21
23
|
import { type InlineReportingDeliveryFetchV1, type ReportingSourceOfferingV1 } from '../source';
|
|
22
24
|
/** The intentionally small provider boundary: one bounded slice fetch plus immutable metadata. */
|
|
@@ -161,20 +163,18 @@ export interface CreateReliableReportingServiceOptionsV1<TCtxMeta = Record<strin
|
|
|
161
163
|
statusRetentionDays: number;
|
|
162
164
|
subscribers?: CreateReportingProducerOptionsV1['subscribers'];
|
|
163
165
|
/**
|
|
164
|
-
* Opt in to scheduled ledger maintenance
|
|
165
|
-
*
|
|
166
|
-
* `
|
|
167
|
-
* with its own scheduler. The production service does this itself and does
|
|
168
|
-
* not take this option.
|
|
166
|
+
* Opt in to scheduled ledger maintenance (retention, compaction, change-feed pruning, abandoned-upload
|
|
167
|
+
* sweeps) for a Core-only deployment. `start()` runs it at most once per `intervalMilliseconds`;
|
|
168
|
+
* `runMaintenance()` runs it on demand for a host with its own scheduler.
|
|
169
169
|
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
170
|
+
* The SDK does not know what maintenance a store needs: the option takes a factory, called once at
|
|
171
|
+
* construction with the store and the retention and recovery-window commitments this service advertises
|
|
172
|
+
* to buyers, so maintenance can never retire a period earlier than that retention. For the PostgreSQL
|
|
173
|
+
* store, pass `reportingLedgerMaintenance({ ... })` from `@adcp/reporting-storage`. A factory that
|
|
174
|
+
* throws fails service construction, not the first scheduled pass. The production service in
|
|
175
|
+
* `@adcp/reporting-storage/service` runs maintenance itself and does not take this option.
|
|
176
176
|
*/
|
|
177
|
-
maintenance?:
|
|
177
|
+
maintenance?: ReliableReportingMaintenanceFactoryV1;
|
|
178
178
|
/**
|
|
179
179
|
* Serve exact revision reads (`get_media_buy_delivery`) for revisions this
|
|
180
180
|
* ledger does not hold, such as a seller's pre-cutover ledger tables. The
|
|
@@ -192,19 +192,66 @@ export interface CreateReliableReportingServiceOptionsV1<TCtxMeta = Record<strin
|
|
|
192
192
|
*/
|
|
193
193
|
legacyRevisionReader?: ReportingLegacyRevisionReaderV1;
|
|
194
194
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Outcome of one maintenance task. A task that resolved but could not process some items is `completed`
|
|
197
|
+
* with `partialFailure` set; the pass resumes those items next time.
|
|
198
|
+
*/
|
|
199
|
+
export type ReliableReportingMaintenanceTaskResultV1 = {
|
|
200
|
+
readonly task: string;
|
|
201
|
+
readonly status: 'completed';
|
|
202
|
+
readonly result: unknown;
|
|
203
|
+
readonly partialFailure?: Error;
|
|
204
|
+
} | {
|
|
205
|
+
readonly task: string;
|
|
206
|
+
readonly status: 'failed';
|
|
207
|
+
readonly error: unknown;
|
|
208
|
+
};
|
|
209
|
+
/** One scheduled maintenance pass, as built by a {@link ReliableReportingMaintenanceFactoryV1}. */
|
|
210
|
+
export interface ReliableReportingMaintenanceV1 {
|
|
211
|
+
/** Minimum time between scheduled passes. A positive safe integer. */
|
|
212
|
+
readonly intervalMilliseconds: number;
|
|
213
|
+
/**
|
|
214
|
+
* Run one pass. Tasks are isolated: a task failure is reported in its result, never thrown. `report`
|
|
215
|
+
* is awaited, in task order, for every task that rejected or partially failed, unless `signal` has
|
|
216
|
+
* aborted (an abort is shutdown, not a fault).
|
|
217
|
+
*/
|
|
218
|
+
run(input: {
|
|
219
|
+
signal?: AbortSignal | undefined;
|
|
220
|
+
report?: (error: unknown) => Promise<void>;
|
|
221
|
+
}): Promise<readonly ReliableReportingMaintenanceTaskResultV1[]>;
|
|
222
|
+
}
|
|
223
|
+
/** What the service tells a maintenance factory about the store it will maintain. */
|
|
224
|
+
export interface ReliableReportingMaintenanceContextV1 {
|
|
225
|
+
readonly store: ReportingLedgerStore;
|
|
226
|
+
/** The `statusRetentionDays` this service advertises. */
|
|
227
|
+
readonly statusRetentionDays: number;
|
|
228
|
+
/** The `automatedRecoveryWindowSeconds` this service advertises. */
|
|
229
|
+
readonly automatedRecoveryWindowSeconds: number;
|
|
204
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Builds the maintenance for one service. Throw from it to refuse a configuration the store cannot
|
|
233
|
+
* serve; the service lets the error reach the caller of `createReliableReportingService`.
|
|
234
|
+
*/
|
|
235
|
+
export type ReliableReportingMaintenanceFactoryV1 = (context: ReliableReportingMaintenanceContextV1) => ReliableReportingMaintenanceV1;
|
|
236
|
+
/**
|
|
237
|
+
* Composition token, for packages that compose this service with a managed-delivery runtime (such as
|
|
238
|
+
* `createPostgresReliableReportingProductionService` in `@adcp/reporting-storage/service`). Such a
|
|
239
|
+
* composition passes `{ [REPORTING_MANAGED_DELIVERY_COMPOSITION_V1]: store }`, naming the very `store` it passes
|
|
240
|
+
* as `store`, so the Core service accepts the managed-delivery and reconciled-billing offerings that only that
|
|
241
|
+
* composition can serve. A plain Core service refuses them.
|
|
242
|
+
*
|
|
243
|
+
* It is an assertion by the composer, not an authentication boundary: it keeps a Core-only service from
|
|
244
|
+
* advertising capabilities it has no runtime for by accident (the value must be the store itself, so a copied
|
|
245
|
+
* `true` does nothing). It is a `Symbol.for` key so it holds across duplicate copies of the SDK. Applications
|
|
246
|
+
* should not use it.
|
|
247
|
+
*
|
|
248
|
+
* @experimental Storage-facing building block: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
249
|
+
*/
|
|
250
|
+
export declare const REPORTING_MANAGED_DELIVERY_COMPOSITION_V1: unique symbol;
|
|
205
251
|
export interface ReliableReportingSetupV1 {
|
|
206
252
|
readonly component: 'reliable-reporting-core';
|
|
207
|
-
|
|
253
|
+
/** The store's own `migrations`: what to apply before first use. Empty for a store that needs none. */
|
|
254
|
+
readonly migrations: readonly string[];
|
|
208
255
|
readonly requiresIsolatedLedgerDatabaseAcknowledgement: true;
|
|
209
256
|
}
|
|
210
257
|
export interface ReliableReportingServiceV1<TCtxMeta = Record<string, unknown>> {
|
|
@@ -238,7 +285,7 @@ export interface ReliableReportingServiceV1<TCtxMeta = Record<string, unknown>>
|
|
|
238
285
|
*/
|
|
239
286
|
runMaintenance(options?: {
|
|
240
287
|
signal?: AbortSignal;
|
|
241
|
-
}): Promise<
|
|
288
|
+
}): Promise<readonly ReliableReportingMaintenanceTaskResultV1[]>;
|
|
242
289
|
start(options: ReliableReportingSchedulerOptionsV1): void;
|
|
243
290
|
stop(): Promise<void>;
|
|
244
291
|
}
|
|
@@ -247,126 +294,5 @@ export interface ReliableReportingServiceV1<TCtxMeta = Record<string, unknown>>
|
|
|
247
294
|
* and scheduler into one Reliable Reporting Core lifecycle owner.
|
|
248
295
|
*/
|
|
249
296
|
export declare function createReliableReportingService<TCtxMeta = Record<string, unknown>>(options: CreateReliableReportingServiceOptionsV1<TCtxMeta>): ReliableReportingServiceV1<TCtxMeta>;
|
|
250
|
-
type ProductionNotificationOptions = Omit<CreatePostgresPersistentNotificationRuntimeOptions, 'db' | 'publisherScope' | 'checkpointDeliveryAttempt' | 'supportedAccountEventTypes'>;
|
|
251
|
-
export type CreatePostgresReliableReportingProductionServiceOptionsV1<TCtxMeta = Record<string, unknown>> = Omit<CreateReliableReportingServiceOptionsV1<TCtxMeta>, 'store' | 'subscribers' | 'maintenance'> & {
|
|
252
|
-
db: ReportingPgPool;
|
|
253
|
-
/** Stable, non-secret deployment namespace shared by reporting workers. */
|
|
254
|
-
namespace: string;
|
|
255
|
-
/** Stable webhook publisher identity; credentials must never be used here. */
|
|
256
|
-
publisherScope: string;
|
|
257
|
-
/** Explicit acknowledgement required by the authoritative Core store. */
|
|
258
|
-
acknowledgeIsolatedDatabase: true;
|
|
259
|
-
/**
|
|
260
|
-
* Store new revision rows as verified canonical JSONL chunks. Adds
|
|
261
|
-
* `REPORTING_ROW_STORAGE_MIGRATION` (PostgreSQL 13+) to `setup.migrations`
|
|
262
|
-
* and probes it before publishing capabilities.
|
|
263
|
-
*/
|
|
264
|
-
rowStorage?: boolean | ReportingRowStorageOptionsV1;
|
|
265
|
-
/**
|
|
266
|
-
* Opt in to period-aligned retention. Each scheduler pass retires whole
|
|
267
|
-
* periods once `max(statusRetentionDays, recordRetentionDays)` has elapsed
|
|
268
|
-
* since both the period end and its latest publication, deleting their
|
|
269
|
-
* rows and ledger records and leaving a tombstone. Abandoned row uploads
|
|
270
|
-
* and expired cursor snapshots are always swept. With `changeFeed`, a
|
|
271
|
-
* period is also held until every live registered feed consumer (updated
|
|
272
|
-
* within `changeFeed.maxFeedHoldDays`, default 7) has read its changes.
|
|
273
|
-
*/
|
|
274
|
-
retention?: ReportingRetentionOptionsV1;
|
|
275
|
-
/**
|
|
276
|
-
* Opt in to compacting superseded snapshot revisions to metadata only, as
|
|
277
|
-
* adcontextprotocol/adcp#8100 permits. Off by default. Each scheduler pass
|
|
278
|
-
* drops the row content of snapshots that are superseded, past their
|
|
279
|
-
* recovery grace and not owed to any caller (receipts, current
|
|
280
|
-
* `received` / `unreadable` / `content_mismatch` statements), while every
|
|
281
|
-
* revision's metadata stays. Official revisions are never compacted. Uses
|
|
282
|
-
* this service's `statusRetentionDays` and `automatedRecoveryWindowSeconds`.
|
|
283
|
-
* The protocol takes compaction into effect only in the next eligible minor
|
|
284
|
-
* after November 20, 2026: do not enable this in production before then.
|
|
285
|
-
*/
|
|
286
|
-
compaction?: ReportingCompactionOptionsV1;
|
|
287
|
-
/**
|
|
288
|
-
* Maintain the host change feed (`changesAfter`, `getCurrentRevision`,
|
|
289
|
-
* `listCurrentRevisions` on `stores.core`). Adds
|
|
290
|
-
* `REPORTING_LEDGER_CHANGES_MIGRATION` (PostgreSQL 13+); the scheduler prunes
|
|
291
|
-
* changes older than `changeRetentionDays` (default 30) unless a registered
|
|
292
|
-
* consumer updated within `maxFeedHoldDays` (default 7) still needs them.
|
|
293
|
-
*/
|
|
294
|
-
changeFeed?: ReportingChangeFeedMaintenanceOptionsV1;
|
|
295
|
-
notifications: ProductionNotificationOptions;
|
|
296
|
-
managedDelivery: {
|
|
297
|
-
adapter: ReportingManagedDeliveryAdapterV1;
|
|
298
|
-
resourceRetentionDays: number;
|
|
299
|
-
authorizationRevocationSeconds: number;
|
|
300
|
-
store?: Omit<PostgresReportingManagedDeliveryStoreOptions, 'notificationActivityPort'>;
|
|
301
|
-
};
|
|
302
|
-
activity: Omit<PostgresReportingNotificationActivityOptions, 'db' | 'notifications' | 'namespace' | 'attemptCheckpoint' | 'tenantScopeForAccount'> & {
|
|
303
|
-
tenantScopeForAccount(accountId: string): string;
|
|
304
|
-
};
|
|
305
|
-
webhookActivity?: {
|
|
306
|
-
tableName?: string;
|
|
307
|
-
retentionDays?: number;
|
|
308
|
-
};
|
|
309
|
-
/** Resolve activity visibility from verified auth/registry state, never request fields. */
|
|
310
|
-
resolveWebhookActivityScope(context: ResolveContext): {
|
|
311
|
-
tenantId: string;
|
|
312
|
-
principalId: string;
|
|
313
|
-
} | Promise<{
|
|
314
|
-
tenantId: string;
|
|
315
|
-
principalId: string;
|
|
316
|
-
}>;
|
|
317
|
-
/** Trusted complete roster of consumers that owe receipts for an obligation. */
|
|
318
|
-
obligatedConsumers?: (input: {
|
|
319
|
-
reporting_obligation_id: string;
|
|
320
|
-
account_id: string;
|
|
321
|
-
}) => Promise<{
|
|
322
|
-
ids: readonly string[];
|
|
323
|
-
complete: boolean;
|
|
324
|
-
version?: string;
|
|
325
|
-
}>;
|
|
326
|
-
/** Optional migration-system bridge. Called before any capability probe. */
|
|
327
|
-
applyMigrations?: (migrations: readonly string[]) => Promise<void>;
|
|
328
|
-
};
|
|
329
|
-
export interface PostgresReliableReportingProductionServiceV1<TCtxMeta = Record<string, unknown>> {
|
|
330
|
-
readonly setup: {
|
|
331
|
-
readonly component: 'reliable-reporting-production';
|
|
332
|
-
readonly migrations: readonly string[];
|
|
333
|
-
};
|
|
334
|
-
readonly capabilities: ReportingDeliveryCapabilities;
|
|
335
|
-
readonly platform: ReliableReportingPlatform<TCtxMeta>;
|
|
336
|
-
readonly core: ReliableReportingServiceV1<TCtxMeta>;
|
|
337
|
-
readonly managed: ReportingManagedDeliveryRuntimeV1<RequestContext<Account<TCtxMeta>>>;
|
|
338
|
-
readonly notifications: PostgresPersistentNotificationRuntime;
|
|
339
|
-
readonly notificationActivity: PostgresReportingNotificationActivityRuntime;
|
|
340
|
-
readonly webhookActivity: PostgresReportingWebhookActivityV1;
|
|
341
|
-
readonly stores: {
|
|
342
|
-
core: PostgresReportingLedgerStore;
|
|
343
|
-
managed: PostgresReportingManagedDeliveryStore;
|
|
344
|
-
};
|
|
345
|
-
readonly running: boolean;
|
|
346
|
-
installConfiguration: ReliableReportingServiceV1<TCtxMeta>['installConfiguration'];
|
|
347
|
-
install<TPlatform extends DecisioningPlatform<unknown, TCtxMeta>>(platform: TPlatform): TPlatform & {
|
|
348
|
-
reporting: ReliableReportingPlatform<TCtxMeta>;
|
|
349
|
-
};
|
|
350
|
-
runCycle(options: ReliableReportingCycleOptionsV1): Promise<{
|
|
351
|
-
core: Awaited<ReturnType<ReliableReportingServiceV1<TCtxMeta>['runCycle']>>;
|
|
352
|
-
managed: Awaited<ReturnType<ReportingManagedDeliveryRuntimeV1['runWorker']>>;
|
|
353
|
-
}>;
|
|
354
|
-
recoverOnce(options: {
|
|
355
|
-
deploymentWide: true;
|
|
356
|
-
}): Promise<{
|
|
357
|
-
activity: Awaited<ReturnType<PostgresReportingNotificationActivityRuntime['recoverOnce']>>;
|
|
358
|
-
webhookOutbox: Awaited<ReturnType<PostgresPersistentNotificationRuntime['recoverOnce']>>;
|
|
359
|
-
}>;
|
|
360
|
-
start(options: ReliableReportingSchedulerOptionsV1 & {
|
|
361
|
-
deploymentWide: true;
|
|
362
|
-
}): void;
|
|
363
|
-
stop(): Promise<void>;
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Assemble and probe the complete seller-side Reliable Reporting production
|
|
367
|
-
* chain. Capability publication happens only after every durable component is
|
|
368
|
-
* present and the managed policy has been adopted.
|
|
369
|
-
*/
|
|
370
|
-
export declare function createPostgresReliableReportingProductionService<TCtxMeta = Record<string, unknown>>(options: CreatePostgresReliableReportingProductionServiceOptionsV1<TCtxMeta>): Promise<PostgresReliableReportingProductionServiceV1<TCtxMeta>>;
|
|
371
297
|
export * from './conformance';
|
|
372
|
-
export
|
|
298
|
+
export * from './scheduler-support';
|