@adcp/sdk 15.9.0 → 16.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/adcp-identity.js +74 -0
- package/bin/adcp.js +2 -0
- package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
- package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
- package/dist/lib/adapters/keyed-account-backend.js +121 -0
- package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
- package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
- package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
- package/dist/lib/adapters/keyed-account-store.js +227 -0
- package/dist/lib/adapters/keyed-account-store.mjs +203 -0
- package/dist/lib/core/SingleAgentClient.d.mts +16 -2
- package/dist/lib/core/SingleAgentClient.d.ts +16 -2
- package/dist/lib/core/SingleAgentClient.js +259 -62
- package/dist/lib/core/SingleAgentClient.mjs +261 -57
- package/dist/lib/core/TaskExecutor.d.mts +6 -0
- package/dist/lib/core/TaskExecutor.d.ts +6 -0
- package/dist/lib/core/TaskExecutor.js +66 -5
- package/dist/lib/core/TaskExecutor.mjs +71 -5
- package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
- package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
- package/dist/lib/core/redis-webhook-registration-store.js +23 -1
- package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
- package/dist/lib/core/webhook-registration.d.mts +7 -1
- package/dist/lib/core/webhook-registration.d.ts +7 -1
- package/dist/lib/core/webhook-registration.js +24 -2
- package/dist/lib/core/webhook-registration.mjs +23 -2
- package/dist/lib/identity-3.3/index.d.mts +10 -0
- package/dist/lib/identity-3.3/index.d.ts +10 -0
- package/dist/lib/identity-3.3/index.js +75 -0
- package/dist/lib/identity-3.3/index.mjs +46 -0
- package/dist/lib/identity-3.3/lifecycle.d.mts +113 -0
- package/dist/lib/identity-3.3/lifecycle.d.ts +113 -0
- package/dist/lib/identity-3.3/lifecycle.js +267 -0
- package/dist/lib/identity-3.3/lifecycle.mjs +240 -0
- package/dist/lib/identity-3.3/revocation.d.mts +50 -0
- package/dist/lib/identity-3.3/revocation.d.ts +50 -0
- package/dist/lib/identity-3.3/revocation.js +238 -0
- package/dist/lib/identity-3.3/revocation.mjs +216 -0
- package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
- package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
- package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
- package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
- package/dist/lib/identity-3.3/server.d.mts +34 -0
- package/dist/lib/identity-3.3/server.d.ts +34 -0
- package/dist/lib/identity-3.3/server.js +219 -0
- package/dist/lib/identity-3.3/server.mjs +194 -0
- package/dist/lib/identity-3.3/store.d.mts +24 -0
- package/dist/lib/identity-3.3/store.d.ts +24 -0
- package/dist/lib/identity-3.3/store.js +191 -0
- package/dist/lib/identity-3.3/store.mjs +169 -0
- package/dist/lib/identity-3.3/trust.d.mts +94 -0
- package/dist/lib/identity-3.3/trust.d.ts +94 -0
- package/dist/lib/identity-3.3/trust.js +278 -0
- package/dist/lib/identity-3.3/trust.mjs +239 -0
- package/dist/lib/identity-3.3/types.d.mts +127 -0
- package/dist/lib/identity-3.3/types.d.ts +127 -0
- package/dist/lib/identity-3.3/types.js +16 -0
- package/dist/lib/identity-3.3/types.mjs +0 -0
- package/dist/lib/identity-3.3/validation.d.mts +2 -0
- package/dist/lib/identity-3.3/validation.d.ts +2 -0
- package/dist/lib/identity-3.3/validation.js +125 -0
- package/dist/lib/identity-3.3/validation.mjs +91 -0
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/reporting/azure/index.d.mts +5 -0
- package/dist/lib/reporting/azure/index.d.ts +5 -0
- package/dist/lib/reporting/azure/index.js +26 -7
- package/dist/lib/reporting/azure/index.mjs +26 -7
- package/dist/lib/reporting/bigquery/index.d.mts +80 -25
- package/dist/lib/reporting/bigquery/index.d.ts +80 -25
- package/dist/lib/reporting/bigquery/index.js +184 -81
- package/dist/lib/reporting/bigquery/index.mjs +182 -80
- package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
- package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
- package/dist/lib/reporting/gcs/errors.d.mts +6 -0
- package/dist/lib/reporting/gcs/errors.d.ts +6 -0
- package/dist/lib/reporting/gcs/fence.d.mts +5 -0
- package/dist/lib/reporting/gcs/fence.d.ts +5 -0
- package/dist/lib/reporting/gcs/index.d.mts +9 -0
- package/dist/lib/reporting/gcs/index.d.ts +9 -0
- package/dist/lib/reporting/gcs/reader.d.mts +27 -3
- package/dist/lib/reporting/gcs/reader.d.ts +27 -3
- package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
- package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
- package/dist/lib/reporting/gcs/row-provider.js +34 -14
- package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
- package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
- package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
- package/dist/lib/reporting/ledger/index.d.mts +11 -0
- package/dist/lib/reporting/ledger/index.d.ts +11 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
- package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
- package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
- package/dist/lib/reporting/ledger/managed.d.mts +86 -6
- package/dist/lib/reporting/ledger/managed.d.ts +86 -6
- package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
- package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
- package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
- package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
- package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
- package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
- package/dist/lib/reporting/ledger/postgres.js +43 -27
- package/dist/lib/reporting/ledger/postgres.mjs +43 -27
- package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
- package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
- package/dist/lib/reporting/ledger/row-encoding.js +8 -4
- package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
- package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
- package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
- package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
- package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
- package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
- package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
- package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
- package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
- package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
- package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
- package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
- package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
- package/dist/lib/reporting/ledger/row-storage.js +126 -66
- package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
- package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
- package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
- package/dist/lib/reporting/ledger/schedule.js +24 -0
- package/dist/lib/reporting/ledger/schedule.mjs +23 -0
- package/dist/lib/reporting/ledger/types.d.mts +23 -1
- package/dist/lib/reporting/ledger/types.d.ts +23 -1
- package/dist/lib/reporting/s3/index.d.mts +5 -0
- package/dist/lib/reporting/s3/index.d.ts +5 -0
- package/dist/lib/reporting/s3/index.js +37 -14
- package/dist/lib/reporting/s3/index.mjs +37 -14
- package/dist/lib/reporting/service/index.d.mts +10 -0
- package/dist/lib/reporting/service/index.d.ts +10 -0
- package/dist/lib/reporting/service/maintenance.d.mts +28 -2
- package/dist/lib/reporting/service/maintenance.d.ts +28 -2
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/account-sync-contract.d.mts +14 -0
- package/dist/lib/server/account-sync-contract.d.ts +14 -0
- package/dist/lib/server/account-sync-contract.js +225 -0
- package/dist/lib/server/account-sync-contract.mjs +197 -0
- package/dist/lib/server/adcp-server.js +5 -0
- package/dist/lib/server/adcp-server.mjs +10 -0
- package/dist/lib/server/auth-signature.d.mts +10 -0
- package/dist/lib/server/auth-signature.d.ts +10 -0
- package/dist/lib/server/auth-signature.js +61 -2
- package/dist/lib/server/auth-signature.mjs +65 -2
- package/dist/lib/server/auth.d.mts +6 -0
- package/dist/lib/server/auth.d.ts +6 -0
- package/dist/lib/server/auth.js +6 -0
- package/dist/lib/server/auth.mjs +6 -0
- package/dist/lib/server/create-adcp-server.d.mts +19 -5
- package/dist/lib/server/create-adcp-server.d.ts +19 -5
- package/dist/lib/server/create-adcp-server.js +238 -19
- package/dist/lib/server/create-adcp-server.mjs +240 -10
- package/dist/lib/server/decisioning/account.d.mts +24 -1
- package/dist/lib/server/decisioning/account.d.ts +24 -1
- package/dist/lib/server/decisioning/index.d.mts +1 -1
- package/dist/lib/server/decisioning/index.d.ts +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
- package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
- package/dist/lib/server/index.d.mts +2 -0
- package/dist/lib/server/index.d.ts +2 -0
- package/dist/lib/server/index.js +12 -0
- package/dist/lib/server/index.mjs +12 -0
- package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
- package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
- package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
- package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
- package/dist/lib/server/principal/types.d.mts +1 -1
- package/dist/lib/server/principal/types.d.ts +1 -1
- package/dist/lib/server/serve.js +5 -0
- package/dist/lib/server/serve.mjs +5 -0
- package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
- package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
- package/dist/lib/server/webhook-delivery/recovery.js +4 -0
- package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
- package/dist/lib/server/webhook-emitter.d.mts +10 -0
- package/dist/lib/server/webhook-emitter.d.ts +10 -0
- package/dist/lib/server/webhook-emitter.js +22 -0
- package/dist/lib/server/webhook-emitter.mjs +22 -0
- package/dist/lib/signing/agent-context.d.mts +0 -5
- package/dist/lib/signing/agent-context.d.ts +0 -5
- package/dist/lib/signing/agent-context.js +9 -1
- package/dist/lib/signing/agent-context.mjs +9 -1
- package/dist/lib/signing/agent-fetch.js +27 -2
- package/dist/lib/signing/agent-fetch.mjs +32 -2
- package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
- package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
- package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
- package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
- package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
- package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
- package/dist/lib/signing/agent-resolver/index.js +5 -0
- package/dist/lib/signing/agent-resolver/index.mjs +3 -0
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
- package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
- package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
- package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
- package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
- package/dist/lib/signing/brand-jwks.d.mts +2 -2
- package/dist/lib/signing/brand-jwks.d.ts +2 -2
- package/dist/lib/signing/brand-jwks.js +4 -4
- package/dist/lib/signing/brand-jwks.mjs +4 -4
- package/dist/lib/signing/client.d.mts +1 -0
- package/dist/lib/signing/client.d.ts +1 -0
- package/dist/lib/signing/client.js +5 -0
- package/dist/lib/signing/client.mjs +3 -0
- package/dist/lib/signing/jwks-https.d.mts +1 -1
- package/dist/lib/signing/jwks-https.d.ts +1 -1
- package/dist/lib/signing/jwks-https.js +1 -1
- package/dist/lib/signing/jwks-https.mjs +1 -1
- package/dist/lib/signing/jwks.d.mts +11 -3
- package/dist/lib/signing/jwks.d.ts +11 -3
- package/dist/lib/signing/jwks.js +1 -1
- package/dist/lib/signing/jwks.mjs +1 -1
- package/dist/lib/signing/parser.d.mts +1 -1
- package/dist/lib/signing/parser.d.ts +1 -1
- package/dist/lib/signing/parser.js +5 -3
- package/dist/lib/signing/parser.mjs +6 -4
- package/dist/lib/signing/revocation.d.mts +4 -1
- package/dist/lib/signing/revocation.d.ts +4 -1
- package/dist/lib/signing/revocation.js +33 -3
- package/dist/lib/signing/revocation.mjs +31 -2
- package/dist/lib/signing/server.d.mts +1 -1
- package/dist/lib/signing/server.d.ts +1 -1
- package/dist/lib/signing/server.js +4 -0
- package/dist/lib/signing/server.mjs +4 -0
- package/dist/lib/signing/types.d.mts +3 -0
- package/dist/lib/signing/types.d.ts +3 -0
- package/dist/lib/signing/web-bot-auth.d.mts +117 -0
- package/dist/lib/signing/web-bot-auth.d.ts +117 -0
- package/dist/lib/signing/web-bot-auth.js +660 -0
- package/dist/lib/signing/web-bot-auth.mjs +624 -0
- package/dist/lib/testing/client.d.mts +1 -4
- package/dist/lib/testing/client.d.ts +1 -4
- package/dist/lib/testing/client.js +141 -20
- package/dist/lib/testing/client.mjs +137 -19
- package/dist/lib/testing/compliance/comply.js +29 -10
- package/dist/lib/testing/compliance/comply.mjs +37 -11
- package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
- package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
- package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
- package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
- package/dist/lib/testing/storyboard/default-invariants.js +2 -0
- package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
- package/dist/lib/testing/storyboard/runner.js +23 -8
- package/dist/lib/testing/storyboard/runner.mjs +24 -8
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/types/adcp.d.mts +4 -0
- package/dist/lib/types/adcp.d.ts +4 -0
- package/dist/lib/types/schemas.generated.d.ts +6 -6
- package/dist/lib/utils/capabilities.d.mts +1 -0
- package/dist/lib/utils/capabilities.d.ts +1 -0
- package/dist/lib/utils/capabilities.js +5 -0
- package/dist/lib/utils/capabilities.mjs +5 -0
- package/dist/lib/v2/projection/creative-delivery.d.mts +3 -1
- package/dist/lib/v2/projection/creative-delivery.d.ts +3 -1
- package/dist/lib/v2/projection/creative-delivery.js +26 -10
- package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
- package/dist/lib/v2/projection/index.d.mts +1 -1
- package/dist/lib/v2/projection/index.d.ts +1 -1
- package/dist/lib/v2/projection/legacy-routes.d.mts +24 -2
- package/dist/lib/v2/projection/legacy-routes.d.ts +24 -2
- package/dist/lib/v2/projection/legacy-routes.js +28 -2
- package/dist/lib/v2/projection/legacy-routes.mjs +26 -2
- package/dist/lib/validation/schema-loader.d.mts +2 -0
- package/dist/lib/validation/schema-loader.d.ts +2 -0
- package/dist/lib/validation/schema-loader.js +43 -4
- package/dist/lib/validation/schema-loader.mjs +39 -3
- 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/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
- package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
- package/docs/guides/REPORTING-LEDGER.md +132 -46
- package/docs/guides/REPORTING-OPERATIONS.md +25 -4
- package/docs/guides/REPORTING-STABILITY.md +76 -0
- package/docs/guides/account-resolution.md +101 -0
- package/docs/llms.txt +3 -2
- package/docs/migration-12-to-13.md +7 -0
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-agent-identity-3.3.md +355 -0
- package/docs/migration-agent-resolution-3.3.md +5 -0
- package/docs/migration-reporting-row-storage-alignment.md +137 -0
- package/examples/storyboards/account-sync-contract.yaml +57 -0
- package/package.json +15 -1
|
@@ -3,6 +3,7 @@ import { promises as fs } from "fs";
|
|
|
3
3
|
import { tmpdir } from "os";
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
import { decodeReportingChangeCursorV1 } from "../ledger/change-feed.mjs";
|
|
6
|
+
import { reportingPeriodDate } from "../ledger/schedule.mjs";
|
|
6
7
|
const REPORTING_WAREHOUSE_SINK_MIGRATION = `
|
|
7
8
|
CREATE TABLE IF NOT EXISTS adcp_reporting_warehouse_sinks (
|
|
8
9
|
sink_name TEXT PRIMARY KEY CHECK (sink_name ~ '^[A-Za-z0-9_.:-]{1,128}$'),
|
|
@@ -12,14 +13,21 @@ CREATE TABLE IF NOT EXISTS adcp_reporting_warehouse_sinks (
|
|
|
12
13
|
planned_revisions JSONB,
|
|
13
14
|
planned_rows_attempt INTEGER NOT NULL DEFAULT 0 CHECK (planned_rows_attempt >= 0),
|
|
14
15
|
planned_revisions_attempt INTEGER NOT NULL DEFAULT 0 CHECK (planned_revisions_attempt >= 0),
|
|
16
|
+
planned_rows_timeouts INTEGER NOT NULL DEFAULT 0 CHECK (planned_rows_timeouts >= 0),
|
|
17
|
+
planned_revisions_timeouts INTEGER NOT NULL DEFAULT 0 CHECK (planned_revisions_timeouts >= 0),
|
|
15
18
|
reset_generation INTEGER NOT NULL DEFAULT 0 CHECK (reset_generation >= 0),
|
|
16
19
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(),
|
|
17
20
|
CHECK ((planned_to_cursor IS NULL) = (planned_revisions IS NULL))
|
|
18
21
|
);
|
|
19
22
|
ALTER TABLE adcp_reporting_warehouse_sinks
|
|
20
23
|
ADD COLUMN IF NOT EXISTS reset_generation INTEGER NOT NULL DEFAULT 0 CHECK (reset_generation >= 0);
|
|
24
|
+
ALTER TABLE adcp_reporting_warehouse_sinks
|
|
25
|
+
ADD COLUMN IF NOT EXISTS planned_rows_timeouts INTEGER NOT NULL DEFAULT 0 CHECK (planned_rows_timeouts >= 0);
|
|
26
|
+
ALTER TABLE adcp_reporting_warehouse_sinks
|
|
27
|
+
ADD COLUMN IF NOT EXISTS planned_revisions_timeouts INTEGER NOT NULL DEFAULT 0 CHECK (planned_revisions_timeouts >= 0);
|
|
21
28
|
`.trim();
|
|
22
29
|
const MAX_LOAD_TIMEOUT = 6 * 36e5;
|
|
30
|
+
const MAX_TIMEOUT_DOUBLINGS = 16;
|
|
23
31
|
let warnedLabelsIgnored = false;
|
|
24
32
|
const PROJECT = /^[a-z][a-z0-9-]{4,61}[a-z0-9]$/;
|
|
25
33
|
const DATASET_OR_TABLE = /^[A-Za-z_][A-Za-z0-9_]{0,1023}$/;
|
|
@@ -72,51 +80,104 @@ function createBigQueryReportingWarehouseSinkV1(options) {
|
|
|
72
80
|
...options.projectId ? { projectId: options.projectId } : {},
|
|
73
81
|
...options.location ? { location: options.location } : {}
|
|
74
82
|
} : void 0;
|
|
75
|
-
|
|
83
|
+
const uploads = /* @__PURE__ */ new Map();
|
|
84
|
+
function startUpload(tableId, jobId, lines) {
|
|
85
|
+
const entry = {
|
|
86
|
+
startedAt: Date.now(),
|
|
87
|
+
done: Promise.resolve()
|
|
88
|
+
};
|
|
89
|
+
const cleanup = async () => {
|
|
90
|
+
if (uploads.get(jobId) === entry) uploads.delete(jobId);
|
|
91
|
+
if (entry.directory) await fs.rm(entry.directory, { recursive: true, force: true }).catch(() => {
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
entry.done = (async () => {
|
|
95
|
+
const directory = await fs.mkdtemp(path.join(tmpdir(), "adcp-warehouse-"));
|
|
96
|
+
entry.directory = directory;
|
|
97
|
+
const file = path.join(directory, `${jobId}.ndjson`);
|
|
98
|
+
await fs.writeFile(file, lines.length ? lines.join("\n") + "\n" : "", { mode: 384 });
|
|
99
|
+
return dataset.table(tableId).load(file, {
|
|
100
|
+
jobId,
|
|
101
|
+
sourceFormat: "NEWLINE_DELIMITED_JSON",
|
|
102
|
+
writeDisposition: "WRITE_APPEND",
|
|
103
|
+
...options.location ? { location: options.location } : {}
|
|
104
|
+
});
|
|
105
|
+
})();
|
|
106
|
+
const replaced = uploads.get(jobId);
|
|
107
|
+
uploads.set(jobId, entry);
|
|
108
|
+
void entry.done.then(cleanup, cleanup);
|
|
109
|
+
if (replaced?.directory) void fs.rm(replaced.directory, { recursive: true, force: true }).catch(() => {
|
|
110
|
+
});
|
|
111
|
+
return entry.done;
|
|
112
|
+
}
|
|
113
|
+
async function jobStatus(jobId, signal, boundMilliseconds = loadTimeout, context) {
|
|
114
|
+
let metadata;
|
|
76
115
|
try {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const code = error?.code;
|
|
83
|
-
if (code === 404 || signal?.aborted) return;
|
|
84
|
-
process.emitWarning(
|
|
85
|
-
`Cancelling BigQuery load job ${jobId} failed (${typeof code === "number" || typeof code === "string" ? code : "no status code"}); the job may still be running`,
|
|
86
|
-
{ code: "ADCP_BIGQUERY_SINK_CANCEL_FAILED" }
|
|
116
|
+
metadata = await withinDeadline(
|
|
117
|
+
() => options.bigquery.job(jobId, jobOptions).getMetadata(),
|
|
118
|
+
boundMilliseconds,
|
|
119
|
+
signal,
|
|
120
|
+
context
|
|
87
121
|
);
|
|
122
|
+
} catch (error) {
|
|
123
|
+
if (error?.code === 404) return "missing";
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
const record = Array.isArray(metadata) ? metadata[0] : metadata;
|
|
127
|
+
if (record?.status?.state !== "DONE") return "running";
|
|
128
|
+
if (record.status.errorResult) {
|
|
129
|
+
const failure = new Error("A BigQuery load job for this batch failed; it will be retried as a new attempt");
|
|
130
|
+
Object.defineProperty(failure, "adcpJobFailed", { value: true });
|
|
131
|
+
throw failure;
|
|
88
132
|
}
|
|
133
|
+
return "done";
|
|
89
134
|
}
|
|
90
|
-
async function loadOnce(tableId, jobId, lines,
|
|
91
|
-
const loadDeadline = Math.min(loadTimeout * 2 ** Math.min(attempt, 16), MAX_LOAD_TIMEOUT);
|
|
135
|
+
async function loadOnce(role, tableId, jobId, lines, timeouts, signal) {
|
|
92
136
|
signal?.throwIfAborted();
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
137
|
+
const table = `the ${role} table "${tableId}" (timeout count ${timeouts})`;
|
|
138
|
+
let status = await jobStatus(jobId, signal, loadTimeout, table);
|
|
139
|
+
if (status === "done") return;
|
|
140
|
+
const loadDeadline = reportingWarehouseLoadDeadlineV1(loadTimeout, timeouts);
|
|
141
|
+
const deadlineAt = Date.now() + loadDeadline;
|
|
142
|
+
const timedOut = (what) => {
|
|
143
|
+
const error = new Error(
|
|
144
|
+
`${what} exceeded this run's ${loadDeadline} ms deadline for ${table}; the next run checks the job again`
|
|
145
|
+
);
|
|
146
|
+
Object.defineProperty(error, "adcpDeadlineExceeded", { value: true });
|
|
147
|
+
Object.defineProperty(error, "adcpLoadTimedOut", { value: true });
|
|
148
|
+
return error;
|
|
149
|
+
};
|
|
150
|
+
if (status === "missing") {
|
|
97
151
|
try {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
writeDisposition: "WRITE_APPEND",
|
|
103
|
-
...options.location ? { location: options.location } : {}
|
|
104
|
-
}),
|
|
105
|
-
loadDeadline,
|
|
106
|
-
signal
|
|
107
|
-
);
|
|
152
|
+
const running = uploads.get(jobId);
|
|
153
|
+
const upload = running && Date.now() - running.startedAt < MAX_LOAD_TIMEOUT ? running.done : startUpload(tableId, jobId, lines);
|
|
154
|
+
await withinDeadline(() => upload, Math.max(deadlineAt - Date.now(), 1), signal);
|
|
155
|
+
return;
|
|
108
156
|
} catch (error) {
|
|
109
|
-
if (isDeadlineExceeded(error))
|
|
157
|
+
if (isDeadlineExceeded(error)) throw timedOut("Uploading the load");
|
|
110
158
|
if (!isAlreadyExists(error)) throw error;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
159
|
+
status = await jobStatus(jobId, signal, loadTimeout, table);
|
|
160
|
+
if (status === "missing") {
|
|
161
|
+
throw new Error(
|
|
162
|
+
"BigQuery refused the load job ID as already existing, but the job cannot be found. Check that projectId and location match the dataset (location is required for datasets outside the US and EU multi-regions)",
|
|
163
|
+
{ cause: error }
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const pollMilliseconds = Math.min(5e3, Math.max(250, Math.floor(loadDeadline / 10)));
|
|
169
|
+
while (status !== "done") {
|
|
170
|
+
const remaining = deadlineAt - Date.now();
|
|
171
|
+
if (remaining <= 0) throw timedOut("Waiting for the running load job");
|
|
172
|
+
await sleep(Math.min(pollMilliseconds, remaining), signal);
|
|
173
|
+
const bound = Math.max(Math.min(loadTimeout, deadlineAt - Date.now()), 1);
|
|
174
|
+
try {
|
|
175
|
+
status = await jobStatus(jobId, signal, bound, table);
|
|
176
|
+
} catch (error) {
|
|
177
|
+
if (isDeadlineExceeded(error) && bound < loadTimeout) throw timedOut("Waiting for the running load job");
|
|
178
|
+
throw error;
|
|
117
179
|
}
|
|
118
|
-
|
|
119
|
-
await fs.rm(directory, { recursive: true, force: true });
|
|
180
|
+
if (status === "missing") throw new Error("A BigQuery load job for this batch disappeared while it was awaited");
|
|
120
181
|
}
|
|
121
182
|
}
|
|
122
183
|
return {
|
|
@@ -131,6 +192,7 @@ function createBigQueryReportingWarehouseSinkV1(options) {
|
|
|
131
192
|
`UPDATE adcp_reporting_warehouse_sinks
|
|
132
193
|
SET committed_cursor = NULL, planned_from_cursor = NULL, planned_to_cursor = NULL,
|
|
133
194
|
planned_revisions = NULL, planned_rows_attempt = 0, planned_revisions_attempt = 0,
|
|
195
|
+
planned_rows_timeouts = 0, planned_revisions_timeouts = 0,
|
|
134
196
|
reset_generation = reset_generation + 1, updated_at = clock_timestamp()
|
|
135
197
|
WHERE sink_name = $1 AND ($2::boolean OR planned_to_cursor IS NULL)
|
|
136
198
|
RETURNING sink_name`,
|
|
@@ -164,7 +226,8 @@ function createBigQueryReportingWarehouseSinkV1(options) {
|
|
|
164
226
|
);
|
|
165
227
|
const state = (await options.db.query(
|
|
166
228
|
`SELECT committed_cursor, planned_from_cursor, planned_to_cursor, planned_revisions,
|
|
167
|
-
planned_rows_attempt, planned_revisions_attempt,
|
|
229
|
+
planned_rows_attempt, planned_revisions_attempt,
|
|
230
|
+
planned_rows_timeouts, planned_revisions_timeouts, reset_generation
|
|
168
231
|
FROM adcp_reporting_warehouse_sinks WHERE sink_name = $1`,
|
|
169
232
|
[options.name]
|
|
170
233
|
).catch(missingMigration)).rows[0];
|
|
@@ -183,7 +246,9 @@ function createBigQueryReportingWarehouseSinkV1(options) {
|
|
|
183
246
|
to: state.planned_to_cursor,
|
|
184
247
|
revisions: state.planned_revisions,
|
|
185
248
|
rowsAttempt: state.planned_rows_attempt,
|
|
186
|
-
revisionsAttempt: state.planned_revisions_attempt
|
|
249
|
+
revisionsAttempt: state.planned_revisions_attempt,
|
|
250
|
+
rowsTimeouts: state.planned_rows_timeouts,
|
|
251
|
+
revisionsTimeouts: state.planned_revisions_timeouts
|
|
187
252
|
} : void 0;
|
|
188
253
|
if (!plan) {
|
|
189
254
|
const position = {
|
|
@@ -232,12 +297,15 @@ function createBigQueryReportingWarehouseSinkV1(options) {
|
|
|
232
297
|
to: page.cursor,
|
|
233
298
|
revisions: page.records.filter((record) => record.kind === "revision").map((record) => ({ id: record.record_id, account_id: record.account_id })),
|
|
234
299
|
rowsAttempt: 0,
|
|
235
|
-
revisionsAttempt: 0
|
|
300
|
+
revisionsAttempt: 0,
|
|
301
|
+
rowsTimeouts: 0,
|
|
302
|
+
revisionsTimeouts: 0
|
|
236
303
|
};
|
|
237
304
|
const claimed = await options.db.query(
|
|
238
305
|
`UPDATE adcp_reporting_warehouse_sinks
|
|
239
306
|
SET planned_from_cursor = $2, planned_to_cursor = $3, planned_revisions = $4::jsonb,
|
|
240
|
-
planned_rows_attempt = 0, planned_revisions_attempt = 0,
|
|
307
|
+
planned_rows_attempt = 0, planned_revisions_attempt = 0,
|
|
308
|
+
planned_rows_timeouts = 0, planned_revisions_timeouts = 0, updated_at = clock_timestamp()
|
|
241
309
|
WHERE sink_name = $1 AND committed_cursor IS NOT DISTINCT FROM $2
|
|
242
310
|
AND planned_to_cursor IS NULL AND planned_revisions IS NULL AND reset_generation = $5
|
|
243
311
|
RETURNING sink_name`,
|
|
@@ -257,6 +325,7 @@ function createBigQueryReportingWarehouseSinkV1(options) {
|
|
|
257
325
|
const rowLines = [];
|
|
258
326
|
const revisionLines = [];
|
|
259
327
|
const missing = [];
|
|
328
|
+
const resolved = [];
|
|
260
329
|
for (const planned of plan.revisions) {
|
|
261
330
|
signal?.throwIfAborted();
|
|
262
331
|
const revision = await options.store.getRevisionMetadata(planned.id, planned.account_id);
|
|
@@ -264,10 +333,10 @@ function createBigQueryReportingWarehouseSinkV1(options) {
|
|
|
264
333
|
missing.push(planned.id);
|
|
265
334
|
continue;
|
|
266
335
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
);
|
|
336
|
+
resolved.push({ planned, revision, periodDate: periodDateOf(revision) });
|
|
337
|
+
}
|
|
338
|
+
for (const { planned, revision, periodDate } of resolved) {
|
|
339
|
+
signal?.throwIfAborted();
|
|
271
340
|
const base = {
|
|
272
341
|
reporting_revision_id: revision.reporting_revision_id,
|
|
273
342
|
reporting_obligation_id: revision.reporting_obligation_id,
|
|
@@ -296,9 +365,9 @@ function createBigQueryReportingWarehouseSinkV1(options) {
|
|
|
296
365
|
JSON.stringify({
|
|
297
366
|
...base,
|
|
298
367
|
supersedes_reporting_revision_id: revision.supersedes_reporting_revision_id ?? null,
|
|
299
|
-
period_start: revision.wireRevision.period
|
|
300
|
-
period_end: revision.wireRevision.period
|
|
301
|
-
source_timezone: revision.wireRevision.period
|
|
368
|
+
period_start: revision.wireRevision.period.start,
|
|
369
|
+
period_end: revision.wireRevision.period.end,
|
|
370
|
+
source_timezone: revision.wireRevision.period.source_timezone,
|
|
302
371
|
observed_at: revision.observedAt,
|
|
303
372
|
data_through: revision.dataThrough,
|
|
304
373
|
revision_content_sha256: revision.binding.sha256,
|
|
@@ -310,27 +379,52 @@ function createBigQueryReportingWarehouseSinkV1(options) {
|
|
|
310
379
|
const baseJobId = reportingWarehouseJobIdV1(options.name, plan.from, plan.to, state.reset_generation);
|
|
311
380
|
const suffix = (attempt) => attempt ? `_a${attempt}` : "";
|
|
312
381
|
const steps = [
|
|
313
|
-
{
|
|
314
|
-
|
|
382
|
+
{
|
|
383
|
+
table: options.rowsTableId,
|
|
384
|
+
role: "rows",
|
|
385
|
+
kind: "rows",
|
|
386
|
+
lines: rowLines,
|
|
387
|
+
attempt: plan.rowsAttempt,
|
|
388
|
+
timeouts: plan.rowsTimeouts,
|
|
389
|
+
timeoutColumn: "planned_rows_timeouts",
|
|
390
|
+
attemptColumn: "planned_rows_attempt"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
table: options.revisionsTableId,
|
|
394
|
+
role: "revisions",
|
|
395
|
+
kind: "revs",
|
|
396
|
+
lines: revisionLines,
|
|
397
|
+
attempt: plan.revisionsAttempt,
|
|
398
|
+
timeouts: plan.revisionsTimeouts,
|
|
399
|
+
timeoutColumn: "planned_revisions_timeouts",
|
|
400
|
+
attemptColumn: "planned_revisions_attempt"
|
|
401
|
+
}
|
|
315
402
|
];
|
|
316
403
|
for (const step of steps) {
|
|
317
404
|
if (!step.lines.length) continue;
|
|
318
405
|
try {
|
|
319
406
|
await loadOnce(
|
|
407
|
+
step.role,
|
|
320
408
|
step.table,
|
|
321
409
|
`${baseJobId}_${step.kind}${suffix(step.attempt)}`,
|
|
322
410
|
[...step.lines],
|
|
323
|
-
step.
|
|
411
|
+
step.timeouts,
|
|
324
412
|
signal
|
|
325
413
|
);
|
|
326
414
|
} catch (error) {
|
|
327
415
|
if (isFinishedWithError(error)) {
|
|
328
|
-
const column = step.kind === "rows" ? "planned_rows_attempt" : "planned_revisions_attempt";
|
|
329
416
|
await options.db.query(
|
|
330
|
-
`UPDATE adcp_reporting_warehouse_sinks SET ${
|
|
417
|
+
`UPDATE adcp_reporting_warehouse_sinks SET ${step.attemptColumn} = ${step.attemptColumn} + 1,
|
|
331
418
|
updated_at = clock_timestamp() ${matchesPlan}`,
|
|
332
419
|
planValues
|
|
333
420
|
);
|
|
421
|
+
} else if (isLoadTimedOut(error)) {
|
|
422
|
+
await options.db.query(
|
|
423
|
+
`UPDATE adcp_reporting_warehouse_sinks
|
|
424
|
+
SET ${step.timeoutColumn} = $8::integer + 1, updated_at = clock_timestamp()
|
|
425
|
+
${matchesPlan} AND ${step.timeoutColumn} = $8::integer`,
|
|
426
|
+
[...planValues, step.timeouts]
|
|
427
|
+
);
|
|
334
428
|
}
|
|
335
429
|
throw error;
|
|
336
430
|
}
|
|
@@ -339,7 +433,7 @@ function createBigQueryReportingWarehouseSinkV1(options) {
|
|
|
339
433
|
`UPDATE adcp_reporting_warehouse_sinks
|
|
340
434
|
SET committed_cursor = $3, planned_from_cursor = NULL, planned_to_cursor = NULL,
|
|
341
435
|
planned_revisions = NULL, planned_rows_attempt = 0, planned_revisions_attempt = 0,
|
|
342
|
-
updated_at = clock_timestamp()
|
|
436
|
+
planned_rows_timeouts = 0, planned_revisions_timeouts = 0, updated_at = clock_timestamp()
|
|
343
437
|
${matchesPlan} RETURNING sink_name`,
|
|
344
438
|
planValues
|
|
345
439
|
);
|
|
@@ -358,6 +452,9 @@ function missingMigration(error) {
|
|
|
358
452
|
}
|
|
359
453
|
throw error;
|
|
360
454
|
}
|
|
455
|
+
function reportingWarehouseLoadDeadlineV1(baseMilliseconds, timeouts) {
|
|
456
|
+
return Math.min(baseMilliseconds * 2 ** Math.min(Math.max(timeouts, 0), MAX_TIMEOUT_DOUBLINGS), MAX_LOAD_TIMEOUT);
|
|
457
|
+
}
|
|
361
458
|
function reportingWarehouseJobIdV1(name, from, to, generation = 0) {
|
|
362
459
|
return `adcp_rr_${createHash("sha256").update(JSON.stringify(generation > 0 ? [name, from, to, generation] : [name, from, to])).digest("hex").slice(0, 40)}`;
|
|
363
460
|
}
|
|
@@ -414,23 +511,19 @@ SELECT row_data.*
|
|
|
414
511
|
) AS current_revision
|
|
415
512
|
USING (reporting_obligation_id, reporting_revision_id);`.trim();
|
|
416
513
|
}
|
|
417
|
-
function
|
|
418
|
-
|
|
419
|
-
const instant = new Date(start);
|
|
420
|
-
if (Number.isNaN(instant.getTime())) return null;
|
|
514
|
+
function periodDateOf(revision) {
|
|
515
|
+
const period = revision.wireRevision.period;
|
|
421
516
|
try {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
} catch {
|
|
430
|
-
return instant.toISOString().slice(0, 10);
|
|
517
|
+
if (!period) throw new TypeError("the revision carries no period");
|
|
518
|
+
return reportingPeriodDate(period.start, period.source_timezone);
|
|
519
|
+
} catch (error) {
|
|
520
|
+
throw new Error(
|
|
521
|
+
`Cannot compute period_date for revision ${revision.reporting_revision_id}: ${error instanceof Error ? error.message : String(error)}. The batch stays retained and every run fails until the revision's period is repaired (or, if this runtime's timezone data is older than the writer's, until it is upgraded); reset({ discardRetainedPlan: true }) restarts from the beginning, so empty the destination tables first.`,
|
|
522
|
+
{ cause: error }
|
|
523
|
+
);
|
|
431
524
|
}
|
|
432
525
|
}
|
|
433
|
-
async function withinDeadline(operation, milliseconds, signal) {
|
|
526
|
+
async function withinDeadline(operation, milliseconds, signal, context) {
|
|
434
527
|
signal?.throwIfAborted();
|
|
435
528
|
let timer;
|
|
436
529
|
let onAbort;
|
|
@@ -439,7 +532,9 @@ async function withinDeadline(operation, milliseconds, signal) {
|
|
|
439
532
|
operation(),
|
|
440
533
|
new Promise((_, reject) => {
|
|
441
534
|
timer = setTimeout(() => {
|
|
442
|
-
const error = new Error(
|
|
535
|
+
const error = new Error(
|
|
536
|
+
`BigQuery call exceeded its deadline${context ? ` of ${milliseconds} ms for ${context}` : ""}; the batch will be retried`
|
|
537
|
+
);
|
|
443
538
|
Object.defineProperty(error, "adcpDeadlineExceeded", { value: true });
|
|
444
539
|
reject(error);
|
|
445
540
|
}, milliseconds);
|
|
@@ -461,24 +556,31 @@ function isAlreadyExists(error) {
|
|
|
461
556
|
const record = error;
|
|
462
557
|
return record?.code === 409 || !!record?.errors?.some((entry) => entry.reason === "duplicate");
|
|
463
558
|
}
|
|
559
|
+
function isLoadTimedOut(error) {
|
|
560
|
+
return error?.adcpLoadTimedOut === true;
|
|
561
|
+
}
|
|
562
|
+
function sleep(milliseconds, signal) {
|
|
563
|
+
signal?.throwIfAborted();
|
|
564
|
+
return new Promise((resolve, reject) => {
|
|
565
|
+
const onAbort = () => {
|
|
566
|
+
clearTimeout(timer);
|
|
567
|
+
reject(signal?.reason ?? new Error("aborted"));
|
|
568
|
+
};
|
|
569
|
+
const timer = setTimeout(() => {
|
|
570
|
+
signal?.removeEventListener("abort", onAbort);
|
|
571
|
+
resolve();
|
|
572
|
+
}, milliseconds);
|
|
573
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
574
|
+
});
|
|
575
|
+
}
|
|
464
576
|
function isFinishedWithError(error) {
|
|
465
577
|
return error?.adcpJobFailed === true;
|
|
466
578
|
}
|
|
467
|
-
function assertJobSucceeded(metadata) {
|
|
468
|
-
const record = Array.isArray(metadata) ? metadata[0] : metadata;
|
|
469
|
-
if (record?.status?.state !== "DONE") {
|
|
470
|
-
throw new Error("A BigQuery load job for this batch is still running; retry later");
|
|
471
|
-
}
|
|
472
|
-
if (record.status.errorResult) {
|
|
473
|
-
const failure = new Error("A BigQuery load job for this batch failed; it will be retried as a new attempt");
|
|
474
|
-
Object.defineProperty(failure, "adcpJobFailed", { value: true });
|
|
475
|
-
throw failure;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
579
|
export {
|
|
479
580
|
REPORTING_WAREHOUSE_SINK_MIGRATION,
|
|
480
581
|
createBigQueryReportingWarehouseSinkV1,
|
|
481
582
|
reportingWarehouseCurrentRowsViewSqlV1,
|
|
482
583
|
reportingWarehouseDefaultTablesSqlV1,
|
|
483
|
-
reportingWarehouseJobIdV1
|
|
584
|
+
reportingWarehouseJobIdV1,
|
|
585
|
+
reportingWarehouseLoadDeadlineV1
|
|
484
586
|
};
|
|
@@ -5,6 +5,9 @@ import type { ReportingLedgerStore } from '../ledger/types.mjs';
|
|
|
5
5
|
import { type ReportingObjectWriteAuthorityStoreV1 } from '../ledger/object-writes.mjs';
|
|
6
6
|
import { type GcsReportingReaderOptionsV1 } from './reader.mjs';
|
|
7
7
|
type DeliveryInput = Parameters<ReportingManagedDeliveryAdapterV1['deliver']>[0];
|
|
8
|
+
/**
|
|
9
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
10
|
+
*/
|
|
8
11
|
export interface CreateGcsReportingManagedDeliveryAdapterOptionsV1 {
|
|
9
12
|
storage: Storage;
|
|
10
13
|
coreStore: ReportingLedgerStore;
|
|
@@ -24,7 +27,11 @@ export interface CreateGcsReportingManagedDeliveryAdapterOptionsV1 {
|
|
|
24
27
|
operationDeadlineMilliseconds?: number;
|
|
25
28
|
minimumResourceRetentionDays?: number;
|
|
26
29
|
}
|
|
27
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Complete file-transfer adapter. Availability and cleanup lease commits remain with the managed runtime.
|
|
32
|
+
*
|
|
33
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
34
|
+
*/
|
|
28
35
|
export declare function createGcsReportingManagedDeliveryAdapterV1(options: CreateGcsReportingManagedDeliveryAdapterOptionsV1, context?: {
|
|
29
36
|
signal?: AbortSignal;
|
|
30
37
|
}): Promise<ReportingManagedDeliveryAdapterV1>;
|
|
@@ -5,6 +5,9 @@ import type { ReportingLedgerStore } from '../ledger/types';
|
|
|
5
5
|
import { type ReportingObjectWriteAuthorityStoreV1 } from '../ledger/object-writes';
|
|
6
6
|
import { type GcsReportingReaderOptionsV1 } from './reader';
|
|
7
7
|
type DeliveryInput = Parameters<ReportingManagedDeliveryAdapterV1['deliver']>[0];
|
|
8
|
+
/**
|
|
9
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
10
|
+
*/
|
|
8
11
|
export interface CreateGcsReportingManagedDeliveryAdapterOptionsV1 {
|
|
9
12
|
storage: Storage;
|
|
10
13
|
coreStore: ReportingLedgerStore;
|
|
@@ -24,7 +27,11 @@ export interface CreateGcsReportingManagedDeliveryAdapterOptionsV1 {
|
|
|
24
27
|
operationDeadlineMilliseconds?: number;
|
|
25
28
|
minimumResourceRetentionDays?: number;
|
|
26
29
|
}
|
|
27
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Complete file-transfer adapter. Availability and cleanup lease commits remain with the managed runtime.
|
|
32
|
+
*
|
|
33
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
34
|
+
*/
|
|
28
35
|
export declare function createGcsReportingManagedDeliveryAdapterV1(options: CreateGcsReportingManagedDeliveryAdapterOptionsV1, context?: {
|
|
29
36
|
signal?: AbortSignal;
|
|
30
37
|
}): Promise<ReportingManagedDeliveryAdapterV1>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
3
|
+
*/
|
|
1
4
|
export declare class ReportingGcsFenceError extends Error {
|
|
2
5
|
readonly code: 'INVALID_INPUT' | 'UNSAFE_BUCKET' | 'REVOKED' | 'NOT_REVOKED' | 'CONTENT_CONFLICT' | 'ABORTED' | 'PROVIDER_UNAVAILABLE' | 'DEADLINE_EXCEEDED' | 'HOST_CALLBACK_FAILED' | 'STATE_UNAVAILABLE';
|
|
3
6
|
constructor(code: 'INVALID_INPUT' | 'UNSAFE_BUCKET' | 'REVOKED' | 'NOT_REVOKED' | 'CONTENT_CONFLICT' | 'ABORTED' | 'PROVIDER_UNAVAILABLE' | 'DEADLINE_EXCEEDED' | 'HOST_CALLBACK_FAILED' | 'STATE_UNAVAILABLE');
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
10
|
+
*/
|
|
5
11
|
export declare function isReportingGcsFenceError(error: unknown): error is ReportingGcsFenceError;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
3
|
+
*/
|
|
1
4
|
export declare class ReportingGcsFenceError extends Error {
|
|
2
5
|
readonly code: 'INVALID_INPUT' | 'UNSAFE_BUCKET' | 'REVOKED' | 'NOT_REVOKED' | 'CONTENT_CONFLICT' | 'ABORTED' | 'PROVIDER_UNAVAILABLE' | 'DEADLINE_EXCEEDED' | 'HOST_CALLBACK_FAILED' | 'STATE_UNAVAILABLE';
|
|
3
6
|
constructor(code: 'INVALID_INPUT' | 'UNSAFE_BUCKET' | 'REVOKED' | 'NOT_REVOKED' | 'CONTENT_CONFLICT' | 'ABORTED' | 'PROVIDER_UNAVAILABLE' | 'DEADLINE_EXCEEDED' | 'HOST_CALLBACK_FAILED' | 'STATE_UNAVAILABLE');
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
10
|
+
*/
|
|
5
11
|
export declare function isReportingGcsFenceError(error: unknown): error is ReportingGcsFenceError;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Storage } from '@google-cloud/storage';
|
|
2
2
|
import { type ReportingObjectWriteScopeV1, type ReportingObjectWritePlanV1, type ReportingObjectWriteStoreV1 } from '../ledger/object-writes.mjs';
|
|
3
3
|
export { ReportingGcsFenceError } from './errors.mjs';
|
|
4
|
+
/**
|
|
5
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
6
|
+
*/
|
|
4
7
|
export interface GcsReportingObjectFenceV1 {
|
|
5
8
|
probe(context?: {
|
|
6
9
|
signal?: AbortSignal;
|
|
@@ -25,6 +28,8 @@ export interface GcsReportingObjectFenceV1 {
|
|
|
25
28
|
* Bucket configuration must remain managed exclusively by the trusted host.
|
|
26
29
|
* Tombstones and inventory MUST NOT be deleted while stale requests can execute.
|
|
27
30
|
* Inject the official Storage client with host-owned, keyless credentials.
|
|
31
|
+
*
|
|
32
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
28
33
|
*/
|
|
29
34
|
export declare function createGcsReportingObjectFenceV1(options: {
|
|
30
35
|
storage: Storage;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Storage } from '@google-cloud/storage';
|
|
2
2
|
import { type ReportingObjectWriteScopeV1, type ReportingObjectWritePlanV1, type ReportingObjectWriteStoreV1 } from '../ledger/object-writes';
|
|
3
3
|
export { ReportingGcsFenceError } from './errors';
|
|
4
|
+
/**
|
|
5
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
6
|
+
*/
|
|
4
7
|
export interface GcsReportingObjectFenceV1 {
|
|
5
8
|
probe(context?: {
|
|
6
9
|
signal?: AbortSignal;
|
|
@@ -25,6 +28,8 @@ export interface GcsReportingObjectFenceV1 {
|
|
|
25
28
|
* Bucket configuration must remain managed exclusively by the trusted host.
|
|
26
29
|
* Tombstones and inventory MUST NOT be deleted while stale requests can execute.
|
|
27
30
|
* Inject the official Storage client with host-owned, keyless credentials.
|
|
31
|
+
*
|
|
32
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
28
33
|
*/
|
|
29
34
|
export declare function createGcsReportingObjectFenceV1(options: {
|
|
30
35
|
storage: Storage;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Cloud Storage fence, reader, managed-delivery adapter and row-object provider for Reliable Reporting.
|
|
3
|
+
*
|
|
4
|
+
* Every export of this subpath is `@experimental` and may change in minor releases.
|
|
5
|
+
*
|
|
6
|
+
* Stability policy: https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
1
10
|
export { createGcsReportingObjectFenceV1 } from './fence.mjs';
|
|
2
11
|
export type { GcsReportingObjectFenceV1 } from './fence.mjs';
|
|
3
12
|
export { ReportingGcsFenceError, isReportingGcsFenceError } from './errors.mjs';
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Cloud Storage fence, reader, managed-delivery adapter and row-object provider for Reliable Reporting.
|
|
3
|
+
*
|
|
4
|
+
* Every export of this subpath is `@experimental` and may change in minor releases.
|
|
5
|
+
*
|
|
6
|
+
* Stability policy: https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
1
10
|
export { createGcsReportingObjectFenceV1 } from './fence';
|
|
2
11
|
export type { GcsReportingObjectFenceV1 } from './fence';
|
|
3
12
|
export { ReportingGcsFenceError, isReportingGcsFenceError } from './errors';
|
|
@@ -2,16 +2,25 @@ import type { Storage } from '@google-cloud/storage';
|
|
|
2
2
|
import { type CanonicalReferenceResolver } from '../../canonical-references/index.mjs';
|
|
3
3
|
import type { ReportingResourceReader } from '../inspection.mjs';
|
|
4
4
|
import { type ReportingObjectWriteScopeV1 } from '../ledger/object-writes.mjs';
|
|
5
|
+
/**
|
|
6
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
7
|
+
*/
|
|
5
8
|
export interface GcsReportingReadScopeV1 extends ReportingObjectWriteScopeV1 {
|
|
6
9
|
/** Non-secret identity from the host's authenticated principal registry. Never a bearer. */
|
|
7
10
|
principal_id: string;
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
14
|
+
*/
|
|
9
15
|
export interface GcsReportingReadAuthorizationV1 {
|
|
10
16
|
scope: Readonly<GcsReportingReadScopeV1>;
|
|
11
17
|
bucket: string;
|
|
12
18
|
objectPrefix: string;
|
|
13
19
|
objectName: string;
|
|
14
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
23
|
+
*/
|
|
15
24
|
export interface GcsReportingReaderOptionsV1 {
|
|
16
25
|
scope: GcsReportingReadScopeV1;
|
|
17
26
|
bucket: string;
|
|
@@ -30,14 +39,29 @@ export interface GcsReportingReaderOptionsV1 {
|
|
|
30
39
|
operationDeadlineMilliseconds?: number;
|
|
31
40
|
maxBytes?: number;
|
|
32
41
|
}
|
|
33
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Restrictive provider-native URL grammar: no credentials, queries, encoding or traversal.
|
|
44
|
+
*
|
|
45
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
46
|
+
*/
|
|
34
47
|
export declare function gcsReportingObjectFromUriV1(uri: string, bucket: string, prefix: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
50
|
+
*/
|
|
35
51
|
export declare function createGcsScopedObjectReadV1(options: GcsReportingReaderOptionsV1): (uri: string, maxBytes: number, signal?: AbortSignal, nativeVersion?: string) => Promise<{
|
|
36
52
|
body: Buffer<ArrayBufferLike>;
|
|
37
53
|
contentType: string | undefined;
|
|
38
54
|
generation: string;
|
|
39
55
|
}>;
|
|
40
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Destination-bound manifest/object reader. The caller never supplies bucket or credential scope.
|
|
58
|
+
*
|
|
59
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
60
|
+
*/
|
|
41
61
|
export declare function createGcsReportingResourceReaderV1(options: GcsReportingReaderOptionsV1): ReportingResourceReader;
|
|
42
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Digest-pinned private contract resolver; all resolutions re-authorize and bypass caches.
|
|
64
|
+
*
|
|
65
|
+
* @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
|
|
66
|
+
*/
|
|
43
67
|
export declare function createGcsReportingReferenceResolverV1(options: GcsReportingReaderOptionsV1): CanonicalReferenceResolver;
|