@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
|
@@ -55,12 +55,14 @@ class ReportingRowStorageV1 {
|
|
|
55
55
|
if (!provider) throw new import_row_storage_errors.ReportingRowStoreError("INVALID_INPUT", `row binding ${id} names an unknown provider`);
|
|
56
56
|
provider.validateLocation(binding.location);
|
|
57
57
|
(0, import_row_storage_object.assertReportingRowPrefixV1)(binding.prefix);
|
|
58
|
-
(0, import_row_storage_object.assertReportingRowKeyTemplateV1)(binding.keyTemplate ?? import_row_storage_object.REPORTING_ROW_DEFAULT_KEY_TEMPLATE);
|
|
59
58
|
if (binding.credentialRef !== void 0 && !CREDENTIAL_REF.test(binding.credentialRef)) {
|
|
60
59
|
throw new import_row_storage_errors.ReportingRowStoreError("INVALID_INPUT", `row binding ${id} has an invalid credentialRef`);
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
|
-
this.bindings = Object.freeze(
|
|
62
|
+
this.bindings = Object.freeze(
|
|
63
|
+
Object.fromEntries(Object.entries(bindings).map(([id, binding]) => [id, Object.freeze({ ...binding })]))
|
|
64
|
+
);
|
|
65
|
+
this.assertBindingKeyTemplates();
|
|
64
66
|
this.deploymentNamespace = options.deploymentNamespace ?? "default";
|
|
65
67
|
if (!this.deploymentNamespace || this.deploymentNamespace.length > 256) {
|
|
66
68
|
throw new import_row_storage_errors.ReportingRowStoreError("INVALID_INPUT", "deploymentNamespace must be 1-256 characters");
|
|
@@ -81,12 +83,34 @@ class ReportingRowStorageV1 {
|
|
|
81
83
|
get writeDeadlineMilliseconds() {
|
|
82
84
|
return this.writeDeadline;
|
|
83
85
|
}
|
|
86
|
+
/** Every writable object binding's key template must include `{revision_key}`; throws `INVALID_INPUT`. */
|
|
87
|
+
assertBindingKeyTemplates() {
|
|
88
|
+
for (const [id, binding] of Object.entries(this.bindings)) {
|
|
89
|
+
if (binding.kind !== "object") continue;
|
|
90
|
+
try {
|
|
91
|
+
(0, import_row_storage_object.assertReportingRowKeyTemplateV1)(binding.keyTemplate ?? import_row_storage_object.REPORTING_ROW_DEFAULT_KEY_TEMPLATE, {
|
|
92
|
+
requireRevisionKey: binding.readOnly !== true
|
|
93
|
+
});
|
|
94
|
+
} catch (error) {
|
|
95
|
+
if ((0, import_row_storage_errors.isReportingRowStoreError)(error)) {
|
|
96
|
+
throw new import_row_storage_errors.ReportingRowStoreError(
|
|
97
|
+
"INVALID_INPUT",
|
|
98
|
+
`row binding ${id}: ${error.message.replace(/^Reporting row store: INVALID_INPUT: /, "")}`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
84
105
|
/**
|
|
85
106
|
* Refuse a configuration in which compaction could delete an object a concurrent commit is
|
|
86
107
|
* adopting. An object binding whose key template omits `{revision_key}` can map two revisions
|
|
87
108
|
* with identical chunk content to one object key, and a create-only write adopts an existing
|
|
88
109
|
* object with identical bytes. Compaction deleting that object at the same moment would leave
|
|
89
|
-
* the newer revision without its rows.
|
|
110
|
+
* the newer revision without its rows. Every writable binding is already required to include
|
|
111
|
+
* `{revision_key}`, so this cannot fail for a validated configuration. A `readOnly` binding is
|
|
112
|
+
* skipped: it never takes commits, so nothing can adopt through it, and every delete is
|
|
113
|
+
* reference-checked.
|
|
90
114
|
*
|
|
91
115
|
* Since the reference-checked, per-object-locked delete this is no longer the only guard: every
|
|
92
116
|
* delete path now skips an object another row set still references. It is kept as defense in
|
|
@@ -94,7 +118,7 @@ class ReportingRowStorageV1 {
|
|
|
94
118
|
*/
|
|
95
119
|
assertCompactionSafeKeyTemplates() {
|
|
96
120
|
const unsafe = Object.entries(this.bindings).filter(
|
|
97
|
-
([, binding]) => binding.kind === "object" && !(binding.keyTemplate ?? import_row_storage_object.REPORTING_ROW_DEFAULT_KEY_TEMPLATE).includes("{revision_key}")
|
|
121
|
+
([, binding]) => binding.kind === "object" && binding.readOnly !== true && !(binding.keyTemplate ?? import_row_storage_object.REPORTING_ROW_DEFAULT_KEY_TEMPLATE).includes("{revision_key}")
|
|
98
122
|
).map(([id]) => id);
|
|
99
123
|
if (unsafe.length > 0) {
|
|
100
124
|
throw new import_row_storage_errors.ReportingRowStoreError(
|
|
@@ -136,30 +160,46 @@ class ReportingRowStorageV1 {
|
|
|
136
160
|
if (digest.sha256 !== input.binding.sha256 || digest.byteCount !== input.binding.byteCount || input.binding.rowCount !== input.rows.length) {
|
|
137
161
|
throw new import_row_storage_errors.ReportingRowStoreError("INVALID_INPUT", "rows do not reproduce their committed binding");
|
|
138
162
|
}
|
|
139
|
-
const
|
|
163
|
+
const writable = Object.keys(this.bindings).filter((id) => {
|
|
164
|
+
const candidate = this.bindings[id];
|
|
165
|
+
return candidate.kind !== "object" || candidate.readOnly !== true;
|
|
166
|
+
});
|
|
167
|
+
if (writable.length === 0 && !input.bindingId && !this.options.selectRowBinding) {
|
|
168
|
+
throw new import_row_storage_errors.ReportingRowStoreError(
|
|
169
|
+
"UNSAFE_BINDING",
|
|
170
|
+
"no writable row binding is configured: every binding is readOnly"
|
|
171
|
+
);
|
|
172
|
+
}
|
|
140
173
|
const bindingId = input.bindingId ? input.bindingId : this.options.selectRowBinding ? await this.options.selectRowBinding({
|
|
141
174
|
account_id: input.accountId,
|
|
142
175
|
reporting_obligation_id: input.obligationId,
|
|
143
176
|
row_set_kind: input.rowSetKind,
|
|
144
177
|
...input.finality ? { finality: input.finality } : {},
|
|
145
178
|
row_count: input.rows.length,
|
|
146
|
-
|
|
147
|
-
}) :
|
|
179
|
+
content_size_bytes: digest.byteCount
|
|
180
|
+
}) : writable.length === 1 ? writable[0] : DEFAULT_BINDING_ID;
|
|
148
181
|
const binding = this.bindings[bindingId];
|
|
149
182
|
if (!binding) throw new import_row_storage_errors.ReportingRowStoreError("STATE_UNAVAILABLE", `row binding ${bindingId} is not configured`);
|
|
183
|
+
if (binding.kind === "object" && binding.readOnly === true) {
|
|
184
|
+
throw new import_row_storage_errors.ReportingRowStoreError(
|
|
185
|
+
"UNSAFE_BINDING",
|
|
186
|
+
`row binding ${bindingId} is read-only and cannot take new row sets`
|
|
187
|
+
);
|
|
188
|
+
}
|
|
150
189
|
if (binding.kind === "postgres") return Object.freeze({ input, encoded, bindingId, binding, digestProfile });
|
|
151
190
|
const compression = binding.compression ?? "gzip";
|
|
152
191
|
const namespaceKey = this.installation.namespaceKey;
|
|
153
192
|
const objects = encoded.chunks.map((chunk) => {
|
|
154
193
|
const physicalBytes = compression === "gzip" ? (0, import_zlib.gzipSync)(chunk.bytes, { level: 6 }) : chunk.bytes;
|
|
155
194
|
return Object.freeze({
|
|
156
|
-
|
|
195
|
+
objectRef: (0, import_row_storage_object.renderReportingRowObjectKeyV1)({
|
|
157
196
|
template: binding.keyTemplate ?? import_row_storage_object.REPORTING_ROW_DEFAULT_KEY_TEMPLATE,
|
|
158
197
|
prefix: binding.prefix,
|
|
159
198
|
namespaceKey,
|
|
160
199
|
accountId: input.accountId,
|
|
161
200
|
rowSetId: input.rowSetId,
|
|
162
201
|
...input.periodStart ? { periodStart: input.periodStart } : {},
|
|
202
|
+
...input.sourceTimezone ? { sourceTimezone: input.sourceTimezone } : {},
|
|
163
203
|
...input.finality ? { finality: input.finality } : {},
|
|
164
204
|
contentSha256: input.binding.sha256,
|
|
165
205
|
chunkIndex: chunk.manifest.chunk_index,
|
|
@@ -194,7 +234,7 @@ class ReportingRowStorageV1 {
|
|
|
194
234
|
() => provider.putIfAbsent(
|
|
195
235
|
{
|
|
196
236
|
...location,
|
|
197
|
-
|
|
237
|
+
objectRef: object.objectRef,
|
|
198
238
|
bytes: object.physicalBytes,
|
|
199
239
|
contentType: object.compression === "gzip" ? "application/gzip" : "application/x-ndjson",
|
|
200
240
|
metadata: {
|
|
@@ -206,20 +246,27 @@ class ReportingRowStorageV1 {
|
|
|
206
246
|
)
|
|
207
247
|
);
|
|
208
248
|
if (put.created) {
|
|
209
|
-
await onCreated({
|
|
249
|
+
await onCreated({ objectRef: object.objectRef, nativeVersionRef: put.nativeVersionRef });
|
|
250
|
+
assertNativeVersionRef(put.nativeVersionRef);
|
|
210
251
|
locators.push({
|
|
211
|
-
|
|
212
|
-
|
|
252
|
+
objectRef: object.objectRef,
|
|
253
|
+
nativeVersionRef: put.nativeVersionRef,
|
|
213
254
|
compression: object.compression,
|
|
214
255
|
physicalSha256: object.physicalSha256,
|
|
215
|
-
|
|
256
|
+
sizeBytes: object.physicalBytes.byteLength,
|
|
216
257
|
created: true
|
|
217
258
|
});
|
|
218
259
|
continue;
|
|
219
260
|
}
|
|
261
|
+
assertNativeVersionRef(put.nativeVersionRef);
|
|
220
262
|
const existing = await this.provider(
|
|
221
263
|
() => provider.get(
|
|
222
|
-
{
|
|
264
|
+
{
|
|
265
|
+
...location,
|
|
266
|
+
objectRef: object.objectRef,
|
|
267
|
+
nativeVersionRef: put.nativeVersionRef,
|
|
268
|
+
maxBytes: MAX_ADOPTED_OBJECT_BYTES
|
|
269
|
+
},
|
|
223
270
|
context
|
|
224
271
|
)
|
|
225
272
|
);
|
|
@@ -228,11 +275,11 @@ class ReportingRowStorageV1 {
|
|
|
228
275
|
throw new import_row_storage_errors.ReportingRowStoreError("CONTENT_CONFLICT", `object for chunk ${index} holds different bytes`);
|
|
229
276
|
}
|
|
230
277
|
locators.push({
|
|
231
|
-
|
|
232
|
-
|
|
278
|
+
objectRef: object.objectRef,
|
|
279
|
+
nativeVersionRef: put.nativeVersionRef,
|
|
233
280
|
compression: object.compression,
|
|
234
281
|
physicalSha256: sha256Hex(existing),
|
|
235
|
-
|
|
282
|
+
sizeBytes: existing.byteLength,
|
|
236
283
|
created: false
|
|
237
284
|
});
|
|
238
285
|
}
|
|
@@ -251,17 +298,18 @@ class ReportingRowStorageV1 {
|
|
|
251
298
|
}
|
|
252
299
|
const inserted = await transaction.query(
|
|
253
300
|
`INSERT INTO adcp_reporting_row_sets
|
|
254
|
-
(row_set_id, row_set_kind, account_id, obligation_id,
|
|
255
|
-
|
|
301
|
+
(row_set_id, row_set_kind, account_id, obligation_id, format, algorithm, digest_profile, content_sha256,
|
|
302
|
+
content_size_bytes, row_count, row_manifest_sha256, chunk_count, row_binding_id,
|
|
256
303
|
rows_shared_from_row_set_id)
|
|
257
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
|
|
304
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)
|
|
258
305
|
ON CONFLICT (row_set_id) DO NOTHING`,
|
|
259
306
|
[
|
|
260
307
|
input.rowSetId,
|
|
261
308
|
input.rowSetKind,
|
|
262
309
|
input.accountId,
|
|
263
310
|
input.obligationId,
|
|
264
|
-
import_row_encoding.
|
|
311
|
+
import_row_encoding.REPORTING_ROW_FORMAT_V1,
|
|
312
|
+
import_row_encoding.REPORTING_ROW_ALGORITHM_V1,
|
|
265
313
|
prepared.digestProfile,
|
|
266
314
|
input.binding.sha256,
|
|
267
315
|
input.binding.byteCount,
|
|
@@ -295,8 +343,8 @@ class ReportingRowStorageV1 {
|
|
|
295
343
|
}
|
|
296
344
|
await transaction.query(
|
|
297
345
|
`INSERT INTO adcp_reporting_row_chunks
|
|
298
|
-
(row_set_id, chunk_index, account_id, obligation_id, first_ordinal, row_count,
|
|
299
|
-
|
|
346
|
+
(row_set_id, chunk_index, account_id, obligation_id, first_ordinal, row_count, canonical_size_bytes, sha256,
|
|
347
|
+
segments, object_ref, native_version_ref, compression, physical_sha256, size_bytes)
|
|
300
348
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9::jsonb, $10, $11, $12, $13, $14)`,
|
|
301
349
|
[
|
|
302
350
|
input.rowSetId,
|
|
@@ -308,11 +356,11 @@ class ReportingRowStorageV1 {
|
|
|
308
356
|
manifest.byte_count,
|
|
309
357
|
manifest.sha256,
|
|
310
358
|
JSON.stringify(manifest.segments),
|
|
311
|
-
locator?.
|
|
312
|
-
locator?.
|
|
359
|
+
locator?.objectRef ?? null,
|
|
360
|
+
locator?.nativeVersionRef ?? null,
|
|
313
361
|
locator?.compression ?? "none",
|
|
314
362
|
locator?.physicalSha256 ?? null,
|
|
315
|
-
locator?.
|
|
363
|
+
locator?.sizeBytes ?? null
|
|
316
364
|
]
|
|
317
365
|
);
|
|
318
366
|
}
|
|
@@ -326,7 +374,7 @@ class ReportingRowStorageV1 {
|
|
|
326
374
|
async find(rowSetId, accountId, queryable = this.pool) {
|
|
327
375
|
const found = await queryable.query(
|
|
328
376
|
`SELECT row_set.row_set_id, row_set.row_set_kind, row_set.account_id, row_set.obligation_id,
|
|
329
|
-
row_set.digest_profile, row_set.content_sha256, row_set.
|
|
377
|
+
row_set.digest_profile, row_set.content_sha256, row_set.content_size_bytes, row_set.row_count,
|
|
330
378
|
row_set.row_manifest_sha256, row_set.chunk_count, row_set.row_binding_id,
|
|
331
379
|
row_set.row_location_version, row_set.rows_state, binding.kind, binding.identity_sha256
|
|
332
380
|
FROM adcp_reporting_row_sets row_set
|
|
@@ -341,8 +389,8 @@ class ReportingRowStorageV1 {
|
|
|
341
389
|
}
|
|
342
390
|
if (record.rows_state === "unavailable") throw new import_row_storage_errors.ReportingRowStoreError("ROWS_UNAVAILABLE");
|
|
343
391
|
const chunks = await queryable.query(
|
|
344
|
-
`SELECT chunk_index, first_ordinal, row_count,
|
|
345
|
-
|
|
392
|
+
`SELECT chunk_index, first_ordinal, row_count, canonical_size_bytes, sha256, segments,
|
|
393
|
+
object_ref, native_version_ref, compression, physical_sha256, size_bytes
|
|
346
394
|
FROM adcp_reporting_row_chunks WHERE row_set_id = $1 ORDER BY chunk_index`,
|
|
347
395
|
[rowSetId]
|
|
348
396
|
);
|
|
@@ -350,7 +398,7 @@ class ReportingRowStorageV1 {
|
|
|
350
398
|
chunk_index: chunk.chunk_index,
|
|
351
399
|
first_ordinal: Number(chunk.first_ordinal),
|
|
352
400
|
row_count: chunk.row_count,
|
|
353
|
-
byte_count: Number(chunk.
|
|
401
|
+
byte_count: Number(chunk.canonical_size_bytes),
|
|
354
402
|
sha256: chunk.sha256,
|
|
355
403
|
segments: chunk.segments.map((segment) => ({
|
|
356
404
|
first_ordinal: Number(segment.first_ordinal),
|
|
@@ -371,16 +419,16 @@ class ReportingRowStorageV1 {
|
|
|
371
419
|
throw new import_row_storage_errors.ReportingRowStoreError("ROWS_INTEGRITY_FAILED", "chunk count does not match the row set");
|
|
372
420
|
}
|
|
373
421
|
const locators = chunks.rows.map((chunk) => {
|
|
374
|
-
const hasLocation = chunk.
|
|
422
|
+
const hasLocation = chunk.object_ref !== null;
|
|
375
423
|
if (hasLocation !== (record.kind === "object")) {
|
|
376
424
|
throw new import_row_storage_errors.ReportingRowStoreError("ROWS_INTEGRITY_FAILED", "chunk location does not match its binding kind");
|
|
377
425
|
}
|
|
378
426
|
return hasLocation ? Object.freeze({
|
|
379
|
-
|
|
380
|
-
|
|
427
|
+
objectRef: chunk.object_ref,
|
|
428
|
+
nativeVersionRef: chunk.native_version_ref,
|
|
381
429
|
compression: chunk.compression,
|
|
382
430
|
physicalSha256: chunk.physical_sha256,
|
|
383
|
-
|
|
431
|
+
sizeBytes: Number(chunk.size_bytes)
|
|
384
432
|
}) : void 0;
|
|
385
433
|
});
|
|
386
434
|
return Object.freeze({
|
|
@@ -390,7 +438,7 @@ class ReportingRowStorageV1 {
|
|
|
390
438
|
obligationId: record.obligation_id,
|
|
391
439
|
digestProfile: record.digest_profile,
|
|
392
440
|
contentSha256: record.content_sha256,
|
|
393
|
-
|
|
441
|
+
contentSizeBytes: Number(record.content_size_bytes),
|
|
394
442
|
rowCount,
|
|
395
443
|
rowManifestSha256: record.row_manifest_sha256,
|
|
396
444
|
bindingId: record.row_binding_id,
|
|
@@ -438,7 +486,7 @@ class ReportingRowStorageV1 {
|
|
|
438
486
|
* `controlTotals` are required for revision row sets.
|
|
439
487
|
*/
|
|
440
488
|
async readAll(handle, controlTotals, options = {}) {
|
|
441
|
-
if (options.maxBytes !== void 0 && handle.
|
|
489
|
+
if (options.maxBytes !== void 0 && handle.contentSizeBytes > options.maxBytes) {
|
|
442
490
|
throw new import_row_storage_errors.ReportingRowStoreError("INVALID_INPUT", "row set exceeds the hydration byte limit");
|
|
443
491
|
}
|
|
444
492
|
const hasher = handle.digestProfile === "revision_envelope_v1" ? (0, import_row_encoding.createReportingRevisionEnvelopeHasherV1)({
|
|
@@ -457,7 +505,7 @@ class ReportingRowStorageV1 {
|
|
|
457
505
|
);
|
|
458
506
|
}
|
|
459
507
|
const digest = this.decode(() => hasher.digest());
|
|
460
|
-
if (digest.sha256 !== handle.contentSha256 || digest.byteCount !== handle.
|
|
508
|
+
if (digest.sha256 !== handle.contentSha256 || digest.byteCount !== handle.contentSizeBytes) {
|
|
461
509
|
throw new import_row_storage_errors.ReportingRowStoreError("ROWS_INTEGRITY_FAILED", "rows do not reproduce the committed binding");
|
|
462
510
|
}
|
|
463
511
|
return rows;
|
|
@@ -476,22 +524,28 @@ class ReportingRowStorageV1 {
|
|
|
476
524
|
const ownedPrefix = `${binding.prefix}/${this.installation.namespaceKey}/`;
|
|
477
525
|
const context = { signal: deadlineSignal(this.writeDeadline, signal) };
|
|
478
526
|
for (const object of objects) {
|
|
479
|
-
if (!object.
|
|
527
|
+
if (!object.objectRef.startsWith(ownedPrefix)) {
|
|
480
528
|
throw new import_row_storage_errors.ReportingRowStoreError("UNSAFE_BINDING", "refusing to delete an object outside the owned prefix");
|
|
481
529
|
}
|
|
482
530
|
await this.provider(
|
|
483
531
|
() => provider.delete(
|
|
484
|
-
{ ...providerLocation(binding),
|
|
532
|
+
{ ...providerLocation(binding), objectRef: object.objectRef, nativeVersionRef: object.nativeVersionRef },
|
|
485
533
|
context
|
|
486
534
|
)
|
|
487
535
|
);
|
|
488
536
|
}
|
|
489
537
|
}
|
|
490
538
|
/**
|
|
491
|
-
* Prove each object is still present at its recorded version with the recorded
|
|
539
|
+
* Prove each object is still present at its recorded version with the recorded size.
|
|
492
540
|
* A commit that adopted an object another row set created calls this under the object's
|
|
493
541
|
* lock, so a concurrent delete either finished first (this throws, the commit fails and
|
|
494
542
|
* the writer re-uploads) or sees the commit's chunk reference and skips the delete.
|
|
543
|
+
*
|
|
544
|
+
* Native versions are write-unique (S3 VersionId, Azure versionId, GCS generation, filesystem
|
|
545
|
+
* `ino:birthtime:mtime:size`), so a version-pinned metadata check, "this exact version exists at the
|
|
546
|
+
* recorded size", proves the object unchanged without downloading it while the commit holds its
|
|
547
|
+
* locks. Bytes were verified when the object was uploaded or adopted. A custom provider without
|
|
548
|
+
* `stat` falls back to reading the whole object and comparing its physical digest.
|
|
495
549
|
*/
|
|
496
550
|
async assertObjectsPresent(bindingId, objects, signal) {
|
|
497
551
|
await this.ready();
|
|
@@ -501,24 +555,24 @@ class ReportingRowStorageV1 {
|
|
|
501
555
|
}
|
|
502
556
|
const provider = this.providers[binding.provider];
|
|
503
557
|
const context = { signal: deadlineSignal(this.writeDeadline, signal) };
|
|
558
|
+
const location = providerLocation(binding);
|
|
559
|
+
const changed = () => new import_row_storage_errors.ReportingRowStoreError(
|
|
560
|
+
"STATE_UNAVAILABLE",
|
|
561
|
+
"an adopted row object was deleted or replaced before its commit; retry the upload"
|
|
562
|
+
);
|
|
504
563
|
for (const object of objects) {
|
|
564
|
+
const identity = { ...location, objectRef: object.objectRef, nativeVersionRef: object.nativeVersionRef };
|
|
565
|
+
if (provider.stat) {
|
|
566
|
+
const stat = await this.provider(() => provider.stat(identity, context));
|
|
567
|
+
if (!stat || stat.nativeVersionRef !== object.nativeVersionRef || !Number.isSafeInteger(stat.sizeBytes) || stat.sizeBytes !== object.sizeBytes) {
|
|
568
|
+
throw changed();
|
|
569
|
+
}
|
|
570
|
+
continue;
|
|
571
|
+
}
|
|
505
572
|
const bytes = await this.provider(
|
|
506
|
-
() => provider.get(
|
|
507
|
-
{
|
|
508
|
-
...providerLocation(binding),
|
|
509
|
-
key: object.objectKey,
|
|
510
|
-
nativeVersion: object.nativeVersion,
|
|
511
|
-
maxBytes: MAX_ADOPTED_OBJECT_BYTES
|
|
512
|
-
},
|
|
513
|
-
context
|
|
514
|
-
)
|
|
573
|
+
() => provider.get({ ...identity, maxBytes: MAX_ADOPTED_OBJECT_BYTES }, context)
|
|
515
574
|
);
|
|
516
|
-
if (!bytes || sha256Hex(bytes) !== object.physicalSha256)
|
|
517
|
-
throw new import_row_storage_errors.ReportingRowStoreError(
|
|
518
|
-
"STATE_UNAVAILABLE",
|
|
519
|
-
"an adopted row object was deleted or replaced before its commit; retry the upload"
|
|
520
|
-
);
|
|
521
|
-
}
|
|
575
|
+
if (!bytes || sha256Hex(bytes) !== object.physicalSha256) throw changed();
|
|
522
576
|
}
|
|
523
577
|
}
|
|
524
578
|
/**
|
|
@@ -545,21 +599,21 @@ class ReportingRowStorageV1 {
|
|
|
545
599
|
const rowSetId = found.rows[0]?.row_set_id;
|
|
546
600
|
if (!rowSetId) return void 0;
|
|
547
601
|
const chunks = await queryable.query(
|
|
548
|
-
`SELECT
|
|
602
|
+
`SELECT object_ref, native_version_ref, compression, physical_sha256, size_bytes
|
|
549
603
|
FROM adcp_reporting_row_chunks WHERE row_set_id = $1 ORDER BY chunk_index`,
|
|
550
604
|
[rowSetId]
|
|
551
605
|
);
|
|
552
606
|
if (chunks.rows.length !== prepared.encoded.chunks.length) return void 0;
|
|
553
607
|
if (prepared.binding.kind === "postgres") return { rowSetId, locators: [] };
|
|
554
|
-
if (chunks.rows.some((chunk) => chunk.
|
|
608
|
+
if (chunks.rows.some((chunk) => chunk.object_ref === null)) return void 0;
|
|
555
609
|
return {
|
|
556
610
|
rowSetId,
|
|
557
611
|
locators: chunks.rows.map((chunk) => ({
|
|
558
|
-
|
|
559
|
-
|
|
612
|
+
objectRef: chunk.object_ref,
|
|
613
|
+
nativeVersionRef: chunk.native_version_ref,
|
|
560
614
|
compression: chunk.compression,
|
|
561
615
|
physicalSha256: chunk.physical_sha256,
|
|
562
|
-
|
|
616
|
+
sizeBytes: Number(chunk.size_bytes),
|
|
563
617
|
created: false
|
|
564
618
|
}))
|
|
565
619
|
};
|
|
@@ -594,8 +648,8 @@ class ReportingRowStorageV1 {
|
|
|
594
648
|
() => provider.get(
|
|
595
649
|
{
|
|
596
650
|
...location,
|
|
597
|
-
|
|
598
|
-
|
|
651
|
+
objectRef: locator.objectRef,
|
|
652
|
+
nativeVersionRef: locator.nativeVersionRef,
|
|
599
653
|
range: { offset: byteOffset, length: byteCount },
|
|
600
654
|
maxBytes: byteCount
|
|
601
655
|
},
|
|
@@ -613,9 +667,9 @@ class ReportingRowStorageV1 {
|
|
|
613
667
|
() => provider.get(
|
|
614
668
|
{
|
|
615
669
|
...location,
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
maxBytes: locator.
|
|
670
|
+
objectRef: locator.objectRef,
|
|
671
|
+
nativeVersionRef: locator.nativeVersionRef,
|
|
672
|
+
maxBytes: locator.sizeBytes
|
|
619
673
|
},
|
|
620
674
|
context
|
|
621
675
|
)
|
|
@@ -623,7 +677,7 @@ class ReportingRowStorageV1 {
|
|
|
623
677
|
if (!stored)
|
|
624
678
|
throw new import_row_storage_errors.ReportingRowStoreError("ROWS_UNAVAILABLE", `chunk ${manifest.chunk_index} object is missing`);
|
|
625
679
|
const physical = Buffer.from(stored);
|
|
626
|
-
if (physical.byteLength !== locator.
|
|
680
|
+
if (physical.byteLength !== locator.sizeBytes || sha256Hex(physical) !== locator.physicalSha256) {
|
|
627
681
|
throw new import_row_storage_errors.ReportingRowStoreError("ROWS_INTEGRITY_FAILED", `chunk ${manifest.chunk_index} stored bytes differ`);
|
|
628
682
|
}
|
|
629
683
|
const logical = this.inflate(physical, locator.compression, manifest.byte_count);
|
|
@@ -662,6 +716,7 @@ class ReportingRowStorageV1 {
|
|
|
662
716
|
}
|
|
663
717
|
}
|
|
664
718
|
async register() {
|
|
719
|
+
this.assertBindingKeyTemplates();
|
|
665
720
|
const { installationId } = await (0, import_row_storage_migration.probeReportingRowStorageSchemaV1)(this.pool);
|
|
666
721
|
const namespaceKey = sha256Hex((0, import_jcs.canonicalize)(["adcp.rows.v1", this.deploymentNamespace, installationId]));
|
|
667
722
|
this.installation = { installationId, namespaceKey };
|
|
@@ -731,6 +786,11 @@ function deadlineSignal(milliseconds, signal) {
|
|
|
731
786
|
const timeout = AbortSignal.timeout(milliseconds);
|
|
732
787
|
return signal ? AbortSignal.any([signal, timeout]) : timeout;
|
|
733
788
|
}
|
|
789
|
+
function assertNativeVersionRef(value) {
|
|
790
|
+
if (typeof value !== "string" || value.length < 1 || value.length > import_row_storage_object.REPORTING_ROW_NATIVE_VERSION_REF_MAX_LENGTH) {
|
|
791
|
+
throw new import_row_storage_errors.ReportingRowStoreError("PROVIDER_UNAVAILABLE", "provider returned an invalid native version reference");
|
|
792
|
+
}
|
|
793
|
+
}
|
|
734
794
|
function positiveMilliseconds(value, name) {
|
|
735
795
|
if (!Number.isSafeInteger(value) || value < 1e3 || value > 6e5) {
|
|
736
796
|
throw new import_row_storage_errors.ReportingRowStoreError("INVALID_INPUT", `${name} must be between 1000 and 600000`);
|