@adcp/sdk 16.0.0-beta.2 → 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/README.md +54 -0
- 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/core/ConversationTypes.d.mts +8 -3
- package/dist/lib/core/ConversationTypes.d.ts +8 -3
- package/dist/lib/core/SingleAgentClient.d.mts +5 -3
- package/dist/lib/core/SingleAgentClient.d.ts +5 -3
- package/dist/lib/core/TaskExecutor.js +5 -1
- package/dist/lib/core/TaskExecutor.mjs +5 -1
- package/dist/lib/errors/index.d.mts +9 -4
- package/dist/lib/errors/index.d.ts +9 -4
- package/dist/lib/index.d.mts +3 -3
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +8 -0
- package/dist/lib/index.mjs +14 -2
- package/dist/lib/negotiation/types.d.mts +20 -39
- package/dist/lib/negotiation/types.d.ts +20 -39
- package/dist/lib/protocols/index.d.mts +60 -24
- package/dist/lib/protocols/index.d.ts +60 -24
- package/dist/lib/protocols/index.js +9 -4
- package/dist/lib/protocols/index.mjs +3 -0
- package/dist/lib/protocols/mcp-modern.js +1 -0
- package/dist/lib/protocols/mcp-modern.mjs +2 -1
- package/dist/lib/protocols/mcp.js +1 -0
- package/dist/lib/protocols/mcp.mjs +2 -1
- package/dist/lib/protocols/responseSizeLimit.d.mts +91 -5
- package/dist/lib/protocols/responseSizeLimit.d.ts +91 -5
- package/dist/lib/protocols/responseSizeLimit.js +195 -31
- package/dist/lib/protocols/responseSizeLimit.mjs +192 -31
- 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/crypto.d.mts +15 -0
- package/dist/lib/signing/crypto.d.ts +15 -0
- package/dist/lib/signing/crypto.js +75 -3
- package/dist/lib/signing/crypto.mjs +78 -3
- package/dist/lib/signing/server.d.mts +1 -1
- package/dist/lib/signing/server.d.ts +1 -1
- package/dist/lib/signing/server.js +2 -0
- package/dist/lib/signing/server.mjs +2 -1
- package/dist/lib/signing/signer.js +11 -14
- package/dist/lib/signing/signer.mjs +13 -16
- package/dist/lib/signing/testing.js +2 -6
- package/dist/lib/signing/testing.mjs +3 -7
- package/dist/lib/signing/verifier.js +2 -2
- package/dist/lib/signing/verifier.mjs +3 -3
- package/dist/lib/signing/web-bot-auth.js +122 -43
- package/dist/lib/signing/web-bot-auth.mjs +128 -44
- package/dist/lib/signing/webhook-verifier.js +2 -2
- package/dist/lib/signing/webhook-verifier.mjs +3 -3
- package/dist/lib/substitution/compile.js +2 -1
- package/dist/lib/substitution/compile.mjs +2 -1
- package/dist/lib/substitution/consent-macros.d.mts +4 -0
- package/dist/lib/substitution/consent-macros.d.ts +4 -0
- package/dist/lib/substitution/consent-macros.js +45 -0
- package/dist/lib/substitution/consent-macros.mjs +20 -0
- package/dist/lib/substitution/index.d.mts +1 -1
- package/dist/lib/substitution/index.d.ts +1 -1
- package/dist/lib/substitution/index.js +2 -0
- package/dist/lib/substitution/index.mjs +2 -1
- package/dist/lib/substitution/translate.d.mts +15 -2
- package/dist/lib/substitution/translate.d.ts +15 -2
- package/dist/lib/substitution/translate.js +148 -26
- package/dist/lib/substitution/translate.mjs +147 -26
- package/dist/lib/testing/client.js +2 -1
- package/dist/lib/testing/client.mjs +2 -1
- package/dist/lib/testing/scenarios/capabilities.js +1 -1
- package/dist/lib/testing/scenarios/capabilities.mjs +1 -1
- 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 +12 -14
- package/dist/lib/testing/storyboard/request-signing/builder.mjs +13 -15
- package/dist/lib/testing/storyboard/runner.js +94 -25
- package/dist/lib/testing/storyboard/runner.mjs +94 -25
- package/dist/lib/testing/storyboard/signer-grader/grader.js +2 -7
- package/dist/lib/testing/storyboard/signer-grader/grader.mjs +2 -7
- 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/types/enums.generated.d.mts +3 -0
- package/dist/lib/types/enums.generated.d.ts +3 -0
- package/dist/lib/types/enums.generated.js +9 -0
- package/dist/lib/types/enums.generated.mjs +6 -0
- package/dist/lib/validation/schema-loader.js +25 -0
- package/dist/lib/validation/schema-loader.mjs +24 -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 +28 -5
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +3 -2
- 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/guides/UNIVERSAL-MACRO-COMPILATION.md +38 -0
- package/docs/guides/VALIDATE-YOUR-AGENT.md +12 -0
- 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 +14 -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,185 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var maintenance_exports = {};
|
|
20
|
-
__export(maintenance_exports, {
|
|
21
|
-
ReportingMaintenancePartialFailureError: () => ReportingMaintenancePartialFailureError,
|
|
22
|
-
assertReportingLedgerMaintenanceOptions: () => assertReportingLedgerMaintenanceOptions,
|
|
23
|
-
runReportingLedgerMaintenance: () => runReportingLedgerMaintenance
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(maintenance_exports);
|
|
26
|
-
class ReportingMaintenancePartialFailureError extends Error {
|
|
27
|
-
constructor(task, failedCount, failedIds, warnings = []) {
|
|
28
|
-
super(
|
|
29
|
-
(failedCount > 0 ? `Reporting ${task} could not process ${failedCount} item(s)${failedIds.length ? `: ${failedIds.slice(0, 20).join(", ")}` : ""}` : `Reporting ${task} needs attention`) + (warnings.length ? `${failedCount > 0 ? "; " : ": "}${warnings.join("; ")}` : "")
|
|
30
|
-
);
|
|
31
|
-
this.task = task;
|
|
32
|
-
this.failedCount = failedCount;
|
|
33
|
-
this.failedIds = failedIds;
|
|
34
|
-
this.warnings = warnings;
|
|
35
|
-
this.name = "ReportingMaintenancePartialFailureError";
|
|
36
|
-
}
|
|
37
|
-
task;
|
|
38
|
-
failedCount;
|
|
39
|
-
failedIds;
|
|
40
|
-
warnings;
|
|
41
|
-
}
|
|
42
|
-
async function runReportingLedgerMaintenance(input) {
|
|
43
|
-
const { store, signal, changeFeed, retention, compaction } = input;
|
|
44
|
-
const start = (name, run) => {
|
|
45
|
-
try {
|
|
46
|
-
return [name, run()];
|
|
47
|
-
} catch (error) {
|
|
48
|
-
return [name, Promise.reject(error)];
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const tasks = [
|
|
52
|
-
...input.sweepSnapshots ? [start("snapshot sweep", () => input.sweepSnapshots(1e3))] : [],
|
|
53
|
-
start("row upload sweep", () => store.sweepRowWriteIntents({ limit: 100, ...signal ? { signal } : {} })),
|
|
54
|
-
...changeFeed ? [
|
|
55
|
-
start(
|
|
56
|
-
"change-feed pruning",
|
|
57
|
-
() => store.pruneChanges(
|
|
58
|
-
typeof changeFeed === "object" ? {
|
|
59
|
-
...changeFeed.changeRetentionDays !== void 0 ? { changeRetentionDays: changeFeed.changeRetentionDays } : {},
|
|
60
|
-
...changeFeed.maxFeedHoldDays !== void 0 ? { maxFeedHoldDays: changeFeed.maxFeedHoldDays } : {}
|
|
61
|
-
} : {}
|
|
62
|
-
)
|
|
63
|
-
)
|
|
64
|
-
] : [],
|
|
65
|
-
...retention?.enabled ? [
|
|
66
|
-
start(
|
|
67
|
-
"retention",
|
|
68
|
-
() => store.retireExpiredPeriods({
|
|
69
|
-
statusRetentionDays: input.statusRetentionDays,
|
|
70
|
-
...retention.recordRetentionDays !== void 0 ? { recordRetentionDays: retention.recordRetentionDays } : {},
|
|
71
|
-
...typeof changeFeed === "object" && changeFeed.maxFeedHoldDays !== void 0 ? { maxFeedHoldDays: changeFeed.maxFeedHoldDays } : {},
|
|
72
|
-
limit: retention.limit ?? 100,
|
|
73
|
-
...signal ? { signal } : {}
|
|
74
|
-
})
|
|
75
|
-
)
|
|
76
|
-
] : [],
|
|
77
|
-
...compaction?.enabled ? [
|
|
78
|
-
start("snapshot compaction", () => {
|
|
79
|
-
if (typeof store.compactSupersededSnapshots !== "function") {
|
|
80
|
-
throw new TypeError("compaction requires a store with compactSupersededSnapshots");
|
|
81
|
-
}
|
|
82
|
-
if (input.automatedRecoveryWindowSeconds === void 0) {
|
|
83
|
-
throw new TypeError("compaction requires automatedRecoveryWindowSeconds");
|
|
84
|
-
}
|
|
85
|
-
return store.compactSupersededSnapshots({
|
|
86
|
-
statusRetentionDays: input.statusRetentionDays,
|
|
87
|
-
automatedRecoveryWindowSeconds: input.automatedRecoveryWindowSeconds,
|
|
88
|
-
...typeof changeFeed === "object" && changeFeed.maxFeedHoldDays !== void 0 ? { maxFeedHoldDays: changeFeed.maxFeedHoldDays } : {},
|
|
89
|
-
limit: compaction.limit ?? 100,
|
|
90
|
-
...signal ? { signal } : {}
|
|
91
|
-
});
|
|
92
|
-
})
|
|
93
|
-
] : []
|
|
94
|
-
];
|
|
95
|
-
const settled = await Promise.allSettled(tasks.map(([, task]) => task));
|
|
96
|
-
const results = [];
|
|
97
|
-
for (const [index, outcome] of settled.entries()) {
|
|
98
|
-
const name = tasks[index][0];
|
|
99
|
-
if (outcome.status === "rejected") {
|
|
100
|
-
if (!signal?.aborted) await input.report?.(outcome.reason);
|
|
101
|
-
results.push({ task: name, status: "failed", error: outcome.reason });
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
const value = outcome.value;
|
|
105
|
-
const failed = Array.isArray(value?.failed) ? value.failed.length : typeof value?.failed === "number" ? value.failed : 0;
|
|
106
|
-
const warnings = [];
|
|
107
|
-
if (value?.stuck?.length) {
|
|
108
|
-
warnings.push(
|
|
109
|
-
`${value.stuck.length} period(s) keep failing: ${value.stuck.slice(0, 20).map((entry) => `${entry.reporting_obligation_id} (${entry.cause}, ${entry.attempts} attempts)`).join(", ")}`
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
if (typeof value?.deferred === "number" && value.deferred > 0) {
|
|
113
|
-
warnings.push(`${value.deferred} item(s) backing off after a failure`);
|
|
114
|
-
}
|
|
115
|
-
if (typeof value?.skippedUnconfigured === "number" && value.skippedUnconfigured > 0) {
|
|
116
|
-
warnings.push(
|
|
117
|
-
`${value.skippedUnconfigured} expired upload(s) skipped because this host does not configure their row binding`
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
if (typeof value?.overdue === "number" && value.overdue > 0) {
|
|
121
|
-
warnings.push(
|
|
122
|
-
`${value.overdue} upload(s) expired long ago and still unswept; their objects are leaking (check that a host configures their binding and that provider deletes succeed)`
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
let partialFailure;
|
|
126
|
-
if (failed > 0 || warnings.length > 0) {
|
|
127
|
-
partialFailure = new ReportingMaintenancePartialFailureError(
|
|
128
|
-
name,
|
|
129
|
-
failed,
|
|
130
|
-
value?.failures?.length ? value.failures.map((entry) => `${entry.reporting_obligation_id} (${entry.cause})`) : Array.isArray(value?.failed) ? value.failed : [],
|
|
131
|
-
warnings
|
|
132
|
-
);
|
|
133
|
-
if (!signal?.aborted) await input.report?.(partialFailure);
|
|
134
|
-
}
|
|
135
|
-
results.push({
|
|
136
|
-
task: name,
|
|
137
|
-
status: "completed",
|
|
138
|
-
result: outcome.value,
|
|
139
|
-
...partialFailure ? { partialFailure } : {}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
return results;
|
|
143
|
-
}
|
|
144
|
-
function assertReportingLedgerMaintenanceOptions(input, statusRetentionDays) {
|
|
145
|
-
const positive = (value, field) => {
|
|
146
|
-
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
147
|
-
throw new TypeError(`${field} must be a positive safe integer`);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
const { retention, changeFeed, compaction } = input;
|
|
151
|
-
if (compaction !== void 0) {
|
|
152
|
-
if (compaction === null || typeof compaction !== "object" || compaction.enabled !== true) {
|
|
153
|
-
throw new TypeError("maintenance.compaction must be { enabled: true, ... }");
|
|
154
|
-
}
|
|
155
|
-
if (compaction.limit !== void 0) positive(compaction.limit, "maintenance.compaction.limit");
|
|
156
|
-
}
|
|
157
|
-
if (retention !== void 0) {
|
|
158
|
-
if (retention === null || typeof retention !== "object" || retention.enabled !== true) {
|
|
159
|
-
throw new TypeError("maintenance.retention must be { enabled: true, ... }");
|
|
160
|
-
}
|
|
161
|
-
if (retention.recordRetentionDays !== void 0) {
|
|
162
|
-
positive(retention.recordRetentionDays, "maintenance.retention.recordRetentionDays");
|
|
163
|
-
if (retention.recordRetentionDays < statusRetentionDays) {
|
|
164
|
-
throw new RangeError(
|
|
165
|
-
"maintenance.retention.recordRetentionDays must be no shorter than statusRetentionDays, the retention advertised to buyers"
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
if (retention.limit !== void 0) positive(retention.limit, "maintenance.retention.limit");
|
|
170
|
-
}
|
|
171
|
-
if (typeof changeFeed === "object" && changeFeed !== null) {
|
|
172
|
-
if (changeFeed.changeRetentionDays !== void 0) {
|
|
173
|
-
positive(changeFeed.changeRetentionDays, "maintenance.changeFeed.changeRetentionDays");
|
|
174
|
-
}
|
|
175
|
-
if (changeFeed.maxFeedHoldDays !== void 0) {
|
|
176
|
-
positive(changeFeed.maxFeedHoldDays, "maintenance.changeFeed.maxFeedHoldDays");
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
181
|
-
0 && (module.exports = {
|
|
182
|
-
ReportingMaintenancePartialFailureError,
|
|
183
|
-
assertReportingLedgerMaintenanceOptions,
|
|
184
|
-
runReportingLedgerMaintenance
|
|
185
|
-
});
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
class ReportingMaintenancePartialFailureError extends Error {
|
|
2
|
-
constructor(task, failedCount, failedIds, warnings = []) {
|
|
3
|
-
super(
|
|
4
|
-
(failedCount > 0 ? `Reporting ${task} could not process ${failedCount} item(s)${failedIds.length ? `: ${failedIds.slice(0, 20).join(", ")}` : ""}` : `Reporting ${task} needs attention`) + (warnings.length ? `${failedCount > 0 ? "; " : ": "}${warnings.join("; ")}` : "")
|
|
5
|
-
);
|
|
6
|
-
this.task = task;
|
|
7
|
-
this.failedCount = failedCount;
|
|
8
|
-
this.failedIds = failedIds;
|
|
9
|
-
this.warnings = warnings;
|
|
10
|
-
this.name = "ReportingMaintenancePartialFailureError";
|
|
11
|
-
}
|
|
12
|
-
task;
|
|
13
|
-
failedCount;
|
|
14
|
-
failedIds;
|
|
15
|
-
warnings;
|
|
16
|
-
}
|
|
17
|
-
async function runReportingLedgerMaintenance(input) {
|
|
18
|
-
const { store, signal, changeFeed, retention, compaction } = input;
|
|
19
|
-
const start = (name, run) => {
|
|
20
|
-
try {
|
|
21
|
-
return [name, run()];
|
|
22
|
-
} catch (error) {
|
|
23
|
-
return [name, Promise.reject(error)];
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const tasks = [
|
|
27
|
-
...input.sweepSnapshots ? [start("snapshot sweep", () => input.sweepSnapshots(1e3))] : [],
|
|
28
|
-
start("row upload sweep", () => store.sweepRowWriteIntents({ limit: 100, ...signal ? { signal } : {} })),
|
|
29
|
-
...changeFeed ? [
|
|
30
|
-
start(
|
|
31
|
-
"change-feed pruning",
|
|
32
|
-
() => store.pruneChanges(
|
|
33
|
-
typeof changeFeed === "object" ? {
|
|
34
|
-
...changeFeed.changeRetentionDays !== void 0 ? { changeRetentionDays: changeFeed.changeRetentionDays } : {},
|
|
35
|
-
...changeFeed.maxFeedHoldDays !== void 0 ? { maxFeedHoldDays: changeFeed.maxFeedHoldDays } : {}
|
|
36
|
-
} : {}
|
|
37
|
-
)
|
|
38
|
-
)
|
|
39
|
-
] : [],
|
|
40
|
-
...retention?.enabled ? [
|
|
41
|
-
start(
|
|
42
|
-
"retention",
|
|
43
|
-
() => store.retireExpiredPeriods({
|
|
44
|
-
statusRetentionDays: input.statusRetentionDays,
|
|
45
|
-
...retention.recordRetentionDays !== void 0 ? { recordRetentionDays: retention.recordRetentionDays } : {},
|
|
46
|
-
...typeof changeFeed === "object" && changeFeed.maxFeedHoldDays !== void 0 ? { maxFeedHoldDays: changeFeed.maxFeedHoldDays } : {},
|
|
47
|
-
limit: retention.limit ?? 100,
|
|
48
|
-
...signal ? { signal } : {}
|
|
49
|
-
})
|
|
50
|
-
)
|
|
51
|
-
] : [],
|
|
52
|
-
...compaction?.enabled ? [
|
|
53
|
-
start("snapshot compaction", () => {
|
|
54
|
-
if (typeof store.compactSupersededSnapshots !== "function") {
|
|
55
|
-
throw new TypeError("compaction requires a store with compactSupersededSnapshots");
|
|
56
|
-
}
|
|
57
|
-
if (input.automatedRecoveryWindowSeconds === void 0) {
|
|
58
|
-
throw new TypeError("compaction requires automatedRecoveryWindowSeconds");
|
|
59
|
-
}
|
|
60
|
-
return store.compactSupersededSnapshots({
|
|
61
|
-
statusRetentionDays: input.statusRetentionDays,
|
|
62
|
-
automatedRecoveryWindowSeconds: input.automatedRecoveryWindowSeconds,
|
|
63
|
-
...typeof changeFeed === "object" && changeFeed.maxFeedHoldDays !== void 0 ? { maxFeedHoldDays: changeFeed.maxFeedHoldDays } : {},
|
|
64
|
-
limit: compaction.limit ?? 100,
|
|
65
|
-
...signal ? { signal } : {}
|
|
66
|
-
});
|
|
67
|
-
})
|
|
68
|
-
] : []
|
|
69
|
-
];
|
|
70
|
-
const settled = await Promise.allSettled(tasks.map(([, task]) => task));
|
|
71
|
-
const results = [];
|
|
72
|
-
for (const [index, outcome] of settled.entries()) {
|
|
73
|
-
const name = tasks[index][0];
|
|
74
|
-
if (outcome.status === "rejected") {
|
|
75
|
-
if (!signal?.aborted) await input.report?.(outcome.reason);
|
|
76
|
-
results.push({ task: name, status: "failed", error: outcome.reason });
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
const value = outcome.value;
|
|
80
|
-
const failed = Array.isArray(value?.failed) ? value.failed.length : typeof value?.failed === "number" ? value.failed : 0;
|
|
81
|
-
const warnings = [];
|
|
82
|
-
if (value?.stuck?.length) {
|
|
83
|
-
warnings.push(
|
|
84
|
-
`${value.stuck.length} period(s) keep failing: ${value.stuck.slice(0, 20).map((entry) => `${entry.reporting_obligation_id} (${entry.cause}, ${entry.attempts} attempts)`).join(", ")}`
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
if (typeof value?.deferred === "number" && value.deferred > 0) {
|
|
88
|
-
warnings.push(`${value.deferred} item(s) backing off after a failure`);
|
|
89
|
-
}
|
|
90
|
-
if (typeof value?.skippedUnconfigured === "number" && value.skippedUnconfigured > 0) {
|
|
91
|
-
warnings.push(
|
|
92
|
-
`${value.skippedUnconfigured} expired upload(s) skipped because this host does not configure their row binding`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
if (typeof value?.overdue === "number" && value.overdue > 0) {
|
|
96
|
-
warnings.push(
|
|
97
|
-
`${value.overdue} upload(s) expired long ago and still unswept; their objects are leaking (check that a host configures their binding and that provider deletes succeed)`
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
let partialFailure;
|
|
101
|
-
if (failed > 0 || warnings.length > 0) {
|
|
102
|
-
partialFailure = new ReportingMaintenancePartialFailureError(
|
|
103
|
-
name,
|
|
104
|
-
failed,
|
|
105
|
-
value?.failures?.length ? value.failures.map((entry) => `${entry.reporting_obligation_id} (${entry.cause})`) : Array.isArray(value?.failed) ? value.failed : [],
|
|
106
|
-
warnings
|
|
107
|
-
);
|
|
108
|
-
if (!signal?.aborted) await input.report?.(partialFailure);
|
|
109
|
-
}
|
|
110
|
-
results.push({
|
|
111
|
-
task: name,
|
|
112
|
-
status: "completed",
|
|
113
|
-
result: outcome.value,
|
|
114
|
-
...partialFailure ? { partialFailure } : {}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return results;
|
|
118
|
-
}
|
|
119
|
-
function assertReportingLedgerMaintenanceOptions(input, statusRetentionDays) {
|
|
120
|
-
const positive = (value, field) => {
|
|
121
|
-
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
122
|
-
throw new TypeError(`${field} must be a positive safe integer`);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
const { retention, changeFeed, compaction } = input;
|
|
126
|
-
if (compaction !== void 0) {
|
|
127
|
-
if (compaction === null || typeof compaction !== "object" || compaction.enabled !== true) {
|
|
128
|
-
throw new TypeError("maintenance.compaction must be { enabled: true, ... }");
|
|
129
|
-
}
|
|
130
|
-
if (compaction.limit !== void 0) positive(compaction.limit, "maintenance.compaction.limit");
|
|
131
|
-
}
|
|
132
|
-
if (retention !== void 0) {
|
|
133
|
-
if (retention === null || typeof retention !== "object" || retention.enabled !== true) {
|
|
134
|
-
throw new TypeError("maintenance.retention must be { enabled: true, ... }");
|
|
135
|
-
}
|
|
136
|
-
if (retention.recordRetentionDays !== void 0) {
|
|
137
|
-
positive(retention.recordRetentionDays, "maintenance.retention.recordRetentionDays");
|
|
138
|
-
if (retention.recordRetentionDays < statusRetentionDays) {
|
|
139
|
-
throw new RangeError(
|
|
140
|
-
"maintenance.retention.recordRetentionDays must be no shorter than statusRetentionDays, the retention advertised to buyers"
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (retention.limit !== void 0) positive(retention.limit, "maintenance.retention.limit");
|
|
145
|
-
}
|
|
146
|
-
if (typeof changeFeed === "object" && changeFeed !== null) {
|
|
147
|
-
if (changeFeed.changeRetentionDays !== void 0) {
|
|
148
|
-
positive(changeFeed.changeRetentionDays, "maintenance.changeFeed.changeRetentionDays");
|
|
149
|
-
}
|
|
150
|
-
if (changeFeed.maxFeedHoldDays !== void 0) {
|
|
151
|
-
positive(changeFeed.maxFeedHoldDays, "maintenance.changeFeed.maxFeedHoldDays");
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
export {
|
|
156
|
-
ReportingMaintenancePartialFailureError,
|
|
157
|
-
assertReportingLedgerMaintenanceOptions,
|
|
158
|
-
runReportingLedgerMaintenance
|
|
159
|
-
};
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
# Adapter-first Reliable Reporting Core
|
|
2
|
-
|
|
3
|
-
This is the minimal production assembly. The provider adapter returns only
|
|
4
|
-
real upstream results: `null` means not ready, `[]` is an observed zero-row
|
|
5
|
-
period, and a populated response carries the provider's rows and temporal
|
|
6
|
-
evidence. It never manufactures fallback delivery.
|
|
7
|
-
|
|
8
|
-
```ts
|
|
9
|
-
import { Pool } from 'pg';
|
|
10
|
-
import { createAdcpServerFromPlatform } from '@adcp/sdk/server';
|
|
11
|
-
import { PostgresReportingLedgerStore } from '@adcp/sdk/reporting/ledger';
|
|
12
|
-
import { createReliableReportingService, type ReliableReportingAdapterV1 } from '@adcp/sdk/reporting/service';
|
|
13
|
-
|
|
14
|
-
// Your provider integration owns these immutable declarations and the real
|
|
15
|
-
// bounded API read. The fetch context contains only durable, non-secret
|
|
16
|
-
// routing IDs; derive OAuth/bearer credentials inside the provider client.
|
|
17
|
-
const providerAdapter: ReliableReportingAdapterV1 = {
|
|
18
|
-
sourceOffering: provider.reportingSourceOffering,
|
|
19
|
-
deliveryOffering: provider.reportingDeliveryOffering,
|
|
20
|
-
fetchSlice: (request, context) =>
|
|
21
|
-
provider.fetchReportingSlice(request, {
|
|
22
|
-
signal: context.signal,
|
|
23
|
-
networkId: String(context.sourceScope.network_id),
|
|
24
|
-
}),
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
28
|
-
const reporting = createReliableReportingService({
|
|
29
|
-
store: new PostgresReportingLedgerStore(pool, {
|
|
30
|
-
acknowledgeIsolatedDatabase: true,
|
|
31
|
-
}),
|
|
32
|
-
adapters: { provider: providerAdapter },
|
|
33
|
-
contact: { name: 'Reporting operations', email: 'reporting@example.com' },
|
|
34
|
-
automatedRecoveryWindowSeconds: 86_400,
|
|
35
|
-
statusRetentionDays: 90, // enforce the same or longer retention in the ledger database
|
|
36
|
-
resolveSource: account => ({
|
|
37
|
-
adapterId: 'provider',
|
|
38
|
-
sourceScope: { network_id: account.ctx_metadata.provider.networkId },
|
|
39
|
-
sourceTimezone: account.ctx_metadata.provider.timezone,
|
|
40
|
-
}),
|
|
41
|
-
resolveCurrency: account => account.ctx_metadata.provider.currency,
|
|
42
|
-
// Authorization boundary: the constituents this account may report on, read
|
|
43
|
-
// from your booking system rather than echoed from the buyer's declaration.
|
|
44
|
-
resolveCoverage: async account => ({
|
|
45
|
-
constituents: await bookings.authorizedReportingConstituents(account.id),
|
|
46
|
-
}),
|
|
47
|
-
resolveConsumerId: ctx => {
|
|
48
|
-
if (!ctx.agent) throw new Error('Authenticated buyer-agent registry required');
|
|
49
|
-
return ctx.agent.agent_url;
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
await pool.query(reporting.setup.migrations[0]);
|
|
54
|
-
const installedPlatform = reporting.install(platform);
|
|
55
|
-
const server = createAdcpServerFromPlatform(installedPlatform, serverOptions);
|
|
56
|
-
|
|
57
|
-
// Pick exactly one operational ownership model.
|
|
58
|
-
reporting.start({
|
|
59
|
-
intervalMilliseconds: 60_000,
|
|
60
|
-
deploymentWide: true,
|
|
61
|
-
maxObligationsPerAccount: 500,
|
|
62
|
-
maxWorkerIterationsPerAccount: 100,
|
|
63
|
-
onError: error => operations.capture(error),
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
process.once('SIGTERM', async () => {
|
|
67
|
-
await reporting.stop();
|
|
68
|
-
await pool.end();
|
|
69
|
-
});
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
For tenant-partitioned scheduling, replace `deploymentWide: true` with
|
|
73
|
-
`accountIds: () => tenantDirectory.reportingAccountIds()`. A resolver must
|
|
74
|
-
return an array; it can never fall back to a deployment-wide scan, and an
|
|
75
|
-
empty or missing account ID is refused rather than widened. One account's
|
|
76
|
-
failed cycle reaches `onError` without skipping the accounts behind it. Configure an
|
|
77
|
-
authenticated `agentRegistry` before using the `ctx.agent` consumer identity
|
|
78
|
-
shown above.
|
|
79
|
-
|
|
80
|
-
`platform.accounts.upsert` must be installed: it is the native
|
|
81
|
-
`sync_accounts` implementation advertised by the Core capability. Its
|
|
82
|
-
authenticated reporting-configuration path calls `installConfiguration` as
|
|
83
|
-
shown below.
|
|
84
|
-
|
|
85
|
-
During authenticated `sync_accounts` handling, validate the requested
|
|
86
|
-
offering and resolve its media-buy/package denominator, then call:
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
const frozen = await reporting.installConfiguration(resolvedConfiguration, {
|
|
90
|
-
account: ctx.account,
|
|
91
|
-
});
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
`resolvedConfiguration` contains reporting semantics only: no account identity,
|
|
95
|
-
source scope, source contract, timezone, currency, `constituents`, or
|
|
96
|
-
`mediaBuyIds`. The denominator comes from `resolveCoverage`, so a buyer cannot
|
|
97
|
-
name another buyer's media buys on a shared upstream network. The service derives those only from the already-resolved account.
|
|
98
|
-
See [the ledger guide](../../docs/guides/REPORTING-LEDGER.md) for the complete
|
|
99
|
-
input shape, per-account scheduling, migration from manual wiring, and the
|
|
100
|
-
conformance helper.
|
|
101
|
-
|
|
102
|
-
## Integrated seller production service
|
|
103
|
-
|
|
104
|
-
For Managed Delivery and Reconciled Billing, compose the real provider,
|
|
105
|
-
authorization, notification, and migration adapters in one probed service.
|
|
106
|
-
The host-owned dependencies below must use live systems and bounded network
|
|
107
|
-
timeouts; `applyMigrations` runs before any capability is published.
|
|
108
|
-
|
|
109
|
-
```ts
|
|
110
|
-
import { createPostgresReliableReportingProductionService } from '@adcp/sdk/reporting/service';
|
|
111
|
-
|
|
112
|
-
const production = await createPostgresReliableReportingProductionService({
|
|
113
|
-
db: pool,
|
|
114
|
-
namespace: 'reporting-prod',
|
|
115
|
-
publisherScope: 'seller-prod',
|
|
116
|
-
acknowledgeIsolatedDatabase: true,
|
|
117
|
-
adapters: { provider: providerAdapter },
|
|
118
|
-
contact: { name: 'Reporting operations', email: 'reporting@example.com' },
|
|
119
|
-
automatedRecoveryWindowSeconds: 86_400,
|
|
120
|
-
statusRetentionDays: 90,
|
|
121
|
-
resolveSource: account => ({
|
|
122
|
-
adapterId: 'provider',
|
|
123
|
-
sourceScope: { network_id: account.ctx_metadata.provider.networkId },
|
|
124
|
-
sourceTimezone: account.ctx_metadata.provider.timezone,
|
|
125
|
-
}),
|
|
126
|
-
resolveCurrency: account => account.ctx_metadata.provider.currency,
|
|
127
|
-
resolveCoverage: async account => ({
|
|
128
|
-
constituents: await bookings.authorizedReportingConstituents(account.id),
|
|
129
|
-
}),
|
|
130
|
-
resolveConsumerId: ctx => buyerRegistry.requireAuthenticatedConsumerId(ctx),
|
|
131
|
-
obligatedConsumers: ({ reporting_obligation_id, account_id }) =>
|
|
132
|
-
billingRoster.obligatedConsumers(reporting_obligation_id, account_id),
|
|
133
|
-
notifications: {
|
|
134
|
-
subscriptions: { acknowledgeIsolatedDatabase: true },
|
|
135
|
-
webhooks: {
|
|
136
|
-
signerProvider: keyManager.reportingWebhookSigner(),
|
|
137
|
-
fetch: safeWebhookFetch, // enforce the SDK's pinned SSRF policy
|
|
138
|
-
},
|
|
139
|
-
proofAdapter: notificationAuthority.proofAdapter,
|
|
140
|
-
authorizeDelivery: notificationAuthority.authorizeDelivery,
|
|
141
|
-
validateDestination: notificationAuthority.validateDestination,
|
|
142
|
-
},
|
|
143
|
-
managedDelivery: {
|
|
144
|
-
adapter: provider.managedDeliveryAdapter,
|
|
145
|
-
resourceRetentionDays: 90,
|
|
146
|
-
authorizationRevocationSeconds: 3_600,
|
|
147
|
-
},
|
|
148
|
-
activity: { tenantScopeForAccount: accountId => accountDirectory.tenantFor(accountId) },
|
|
149
|
-
resolveWebhookActivityScope: ctx => accountDirectory.webhookActivityScope(ctx),
|
|
150
|
-
applyMigrations: statements => migrations.applyInOrder(statements),
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
const installedPlatform = production.install(platform); // accounts.upsert and accounts.list required
|
|
154
|
-
const server = createAdcpServerFromPlatform(installedPlatform, serverOptions);
|
|
155
|
-
production.start({ intervalMilliseconds: 60_000, deploymentWide: true });
|
|
156
|
-
|
|
157
|
-
process.once('SIGTERM', async () => {
|
|
158
|
-
await production.stop();
|
|
159
|
-
await pool.end();
|
|
160
|
-
});
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Use one isolated namespace and publisher scope per independently operated
|
|
164
|
-
tenant partition. The production worker's recovery passes scan that entire
|
|
165
|
-
namespace, so `start()` and `recoverOnce()` require `deploymentWide: true`.
|
|
166
|
-
The trusted `obligatedConsumers` roster is required when an offering uses
|
|
167
|
-
`consumer_receipt`; an incomplete roster keeps billing health conservative.
|
|
168
|
-
See the [production operations guide](../../docs/guides/REPORTING-OPERATIONS.md)
|
|
169
|
-
for migration, readiness, and recovery procedures.
|