@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
|
@@ -7,26 +7,51 @@
|
|
|
7
7
|
* binding, and every byte a provider returns is verified against digests
|
|
8
8
|
* committed in PostgreSQL before rows are released.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* @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
|
|
12
|
+
*/
|
|
10
13
|
export interface ReportingRowObjectContextV1 {
|
|
11
14
|
signal: AbortSignal;
|
|
12
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* @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
|
|
18
|
+
*/
|
|
13
19
|
export interface ReportingRowObjectLocationV1 {
|
|
14
20
|
/** Non-secret provider coordinates (bucket, container, filesystem root name, endpoint host). */
|
|
15
21
|
readonly location: Readonly<Record<string, string>>;
|
|
16
22
|
/** Host-mapped client reference; never a secret. */
|
|
17
23
|
readonly credentialRef?: string;
|
|
18
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Bounds AdCP puts on `object_ref` and `native_version_ref`
|
|
27
|
+
* (`reporting-file-object-ref.json`, `reporting-native-version-ref.json`):
|
|
28
|
+
* 1 to 1024 characters. The row-storage `CHECK` constraints enforce the same.
|
|
29
|
+
*
|
|
30
|
+
* @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
|
|
31
|
+
*/
|
|
32
|
+
export declare const REPORTING_ROW_OBJECT_REF_MAX_LENGTH = 1024;
|
|
33
|
+
/**
|
|
34
|
+
* @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
|
|
35
|
+
*/
|
|
36
|
+
export declare const REPORTING_ROW_NATIVE_VERSION_REF_MAX_LENGTH = 1024;
|
|
37
|
+
/**
|
|
38
|
+
* @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
|
|
39
|
+
*/
|
|
19
40
|
export interface ReportingRowObjectPutInputV1 extends ReportingRowObjectLocationV1 {
|
|
20
|
-
key
|
|
41
|
+
/** AdCP `object_ref`: decoded, destination-relative object key. */
|
|
42
|
+
objectRef: string;
|
|
21
43
|
bytes: Uint8Array;
|
|
22
44
|
contentType: 'application/x-ndjson' | 'application/gzip';
|
|
23
45
|
/** Non-secret object metadata (installation and intent identifiers). */
|
|
24
46
|
metadata: Readonly<Record<string, string>>;
|
|
25
47
|
}
|
|
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
|
+
*/
|
|
26
51
|
export interface ReportingRowObjectGetInputV1 extends ReportingRowObjectLocationV1 {
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
|
|
52
|
+
objectRef: string;
|
|
53
|
+
/** AdCP `native_version_ref`: the exact native version recorded at write time. */
|
|
54
|
+
nativeVersionRef: string;
|
|
30
55
|
/** Byte range within the stored object; omit for the whole object. */
|
|
31
56
|
range?: {
|
|
32
57
|
offset: number;
|
|
@@ -35,10 +60,23 @@ export interface ReportingRowObjectGetInputV1 extends ReportingRowObjectLocation
|
|
|
35
60
|
/** Hard cap on bytes read; providers abort beyond it. */
|
|
36
61
|
maxBytes: number;
|
|
37
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* @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
|
|
65
|
+
*/
|
|
38
66
|
export interface ReportingRowObjectDeleteInputV1 extends ReportingRowObjectLocationV1 {
|
|
39
|
-
|
|
40
|
-
|
|
67
|
+
objectRef: string;
|
|
68
|
+
nativeVersionRef: string;
|
|
41
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @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
|
|
72
|
+
*/
|
|
73
|
+
export interface ReportingRowObjectStatInputV1 extends ReportingRowObjectLocationV1 {
|
|
74
|
+
objectRef: string;
|
|
75
|
+
nativeVersionRef: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @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
|
|
79
|
+
*/
|
|
42
80
|
export interface ReportingRowObjectProviderV1 {
|
|
43
81
|
/** Registry name, e.g. `filesystem`, `gcs`, `s3`, `azure_blob`. */
|
|
44
82
|
readonly name: string;
|
|
@@ -60,35 +98,84 @@ export interface ReportingRowObjectProviderV1 {
|
|
|
60
98
|
*/
|
|
61
99
|
putIfAbsent(input: ReportingRowObjectPutInputV1, context: ReportingRowObjectContextV1): Promise<{
|
|
62
100
|
created: boolean;
|
|
63
|
-
|
|
101
|
+
nativeVersionRef: string;
|
|
64
102
|
}>;
|
|
65
103
|
/** Bytes at the exact native version, or `null` when that version is absent. */
|
|
66
104
|
get(input: ReportingRowObjectGetInputV1, context: ReportingRowObjectContextV1): Promise<Uint8Array | null>;
|
|
105
|
+
/**
|
|
106
|
+
* Metadata of the exact native version without reading its bytes: the version it resolved (which must equal the
|
|
107
|
+
* requested `nativeVersionRef`) and its stored size (`size_bytes`), or `null` when that version is absent. Optional. The commit transaction uses it to
|
|
108
|
+
* prove an adopted object is unchanged (native versions are write-unique, so the same version at
|
|
109
|
+
* the recorded size is the same bytes) without downloading it under the account lock. A provider
|
|
110
|
+
* without `stat` falls back to a full read there. Never return a size for a different version.
|
|
111
|
+
*/
|
|
112
|
+
stat?(input: ReportingRowObjectStatInputV1, context: ReportingRowObjectContextV1): Promise<{
|
|
113
|
+
nativeVersionRef: string;
|
|
114
|
+
sizeBytes: number;
|
|
115
|
+
} | null>;
|
|
67
116
|
/** Delete the exact native version. Idempotent: `absent` is success. */
|
|
68
117
|
delete(input: ReportingRowObjectDeleteInputV1, context: ReportingRowObjectContextV1): Promise<'deleted' | 'absent'>;
|
|
69
118
|
}
|
|
70
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Placeholders allowed in object key templates. `{period_date}` renders AdCP's `YYYY-MM-DD`: the calendar
|
|
121
|
+
* date of the period start in the period's `source_timezone` (never UTC, unless that is the source
|
|
122
|
+
* timezone). It is one path segment, so the default layout is
|
|
123
|
+
* `.../{account_key}/2026-10-02/{finality}/...`.
|
|
124
|
+
*
|
|
125
|
+
* @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
|
|
126
|
+
*/
|
|
71
127
|
export declare const REPORTING_ROW_KEY_PLACEHOLDERS: readonly ["prefix", "namespace_key", "account_key", "period_date", "finality", "revision_key", "content_sha256", "chunk_index"];
|
|
128
|
+
/**
|
|
129
|
+
* @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
|
|
130
|
+
*/
|
|
72
131
|
export declare const REPORTING_ROW_DEFAULT_KEY_TEMPLATE = "{prefix}/{namespace_key}/{account_key}/{period_date}/{finality}/{revision_key}/{content_sha256}/{chunk_index}";
|
|
73
|
-
/**
|
|
74
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Validate an object key template; throws `INVALID_INPUT`. Every template that writes must include
|
|
134
|
+
* `{revision_key}`, so no two row sets can ever name the same object key; `requireRevisionKey: false`
|
|
135
|
+
* is for a read-only binding that only reads rows written under an older template.
|
|
136
|
+
*
|
|
137
|
+
* @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
|
|
138
|
+
*/
|
|
139
|
+
export declare function assertReportingRowKeyTemplateV1(template: string, options?: {
|
|
140
|
+
requireRevisionKey?: boolean;
|
|
141
|
+
}): void;
|
|
142
|
+
/**
|
|
143
|
+
* @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
|
|
144
|
+
*/
|
|
75
145
|
export declare function assertReportingRowPrefixV1(prefix: string): void;
|
|
76
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Pseudonymous account segment; never a raw account ID.
|
|
148
|
+
*
|
|
149
|
+
* @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
|
|
150
|
+
*/
|
|
77
151
|
export declare function reportingRowAccountKeyV1(namespaceKey: string, accountId: string): string;
|
|
152
|
+
/**
|
|
153
|
+
* @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
|
|
154
|
+
*/
|
|
78
155
|
export declare function reportingRowRevisionKeyV1(rowSetId: string): string;
|
|
79
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Render one chunk's object key and confine it to the binding's owned prefix.
|
|
158
|
+
*
|
|
159
|
+
* @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
|
|
160
|
+
*/
|
|
80
161
|
export declare function renderReportingRowObjectKeyV1(input: {
|
|
81
162
|
template: string;
|
|
82
163
|
prefix: string;
|
|
83
164
|
namespaceKey: string;
|
|
84
165
|
accountId: string;
|
|
85
166
|
rowSetId: string;
|
|
167
|
+
/** Period start instant; with `sourceTimezone`, renders `{period_date}`. Absent renders `undated`. */
|
|
86
168
|
periodStart?: string;
|
|
169
|
+
/** The period's `source_timezone`; required whenever `periodStart` is set. Invalid values fail closed. */
|
|
170
|
+
sourceTimezone?: string;
|
|
87
171
|
finality?: 'snapshot' | 'official';
|
|
88
172
|
contentSha256: string;
|
|
89
173
|
chunkIndex: number;
|
|
90
174
|
compression: 'none' | 'gzip';
|
|
91
175
|
}): string;
|
|
176
|
+
/**
|
|
177
|
+
* @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
|
|
178
|
+
*/
|
|
92
179
|
export interface FilesystemReportingRowObjectProviderOptionsV1 {
|
|
93
180
|
/**
|
|
94
181
|
* Root name → absolute directory. Bindings name a root (`location.root`);
|
|
@@ -100,12 +187,16 @@ export interface FilesystemReportingRowObjectProviderOptionsV1 {
|
|
|
100
187
|
* Local filesystem provider for tests and single-host deployments. Create-only
|
|
101
188
|
* writes use a temporary file, `fsync`, and `link()` to the final name, which
|
|
102
189
|
* fails rather than replacing an existing object.
|
|
190
|
+
*
|
|
191
|
+
* @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
|
|
103
192
|
*/
|
|
104
193
|
export declare function createFilesystemReportingRowObjectProviderV1(options: FilesystemReportingRowObjectProviderOptionsV1): ReportingRowObjectProviderV1;
|
|
105
194
|
/**
|
|
106
195
|
* Behavioural conformance for a custom object provider. Writes and deletes
|
|
107
196
|
* only under `prefix`; run it against a dedicated test bucket or prefix.
|
|
108
197
|
* Resolves with the checks that passed; rejects on the first violation.
|
|
198
|
+
*
|
|
199
|
+
* @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
|
|
109
200
|
*/
|
|
110
201
|
export declare function runReportingRowObjectProviderConformanceV1(provider: ReportingRowObjectProviderV1, input: ReportingRowObjectLocationV1 & {
|
|
111
202
|
prefix: string;
|
|
@@ -30,6 +30,8 @@ var row_storage_object_exports = {};
|
|
|
30
30
|
__export(row_storage_object_exports, {
|
|
31
31
|
REPORTING_ROW_DEFAULT_KEY_TEMPLATE: () => REPORTING_ROW_DEFAULT_KEY_TEMPLATE,
|
|
32
32
|
REPORTING_ROW_KEY_PLACEHOLDERS: () => REPORTING_ROW_KEY_PLACEHOLDERS,
|
|
33
|
+
REPORTING_ROW_NATIVE_VERSION_REF_MAX_LENGTH: () => REPORTING_ROW_NATIVE_VERSION_REF_MAX_LENGTH,
|
|
34
|
+
REPORTING_ROW_OBJECT_REF_MAX_LENGTH: () => REPORTING_ROW_OBJECT_REF_MAX_LENGTH,
|
|
33
35
|
assertReportingRowKeyTemplateV1: () => assertReportingRowKeyTemplateV1,
|
|
34
36
|
assertReportingRowPrefixV1: () => assertReportingRowPrefixV1,
|
|
35
37
|
createFilesystemReportingRowObjectProviderV1: () => createFilesystemReportingRowObjectProviderV1,
|
|
@@ -44,6 +46,9 @@ var import_fs = require("fs");
|
|
|
44
46
|
var path = __toESM(require("path"));
|
|
45
47
|
var import_jcs = require('../../utils/jcs.js');
|
|
46
48
|
var import_row_storage_errors = require('./row-storage-errors.js');
|
|
49
|
+
var import_schedule = require('./schedule.js');
|
|
50
|
+
const REPORTING_ROW_OBJECT_REF_MAX_LENGTH = 1024;
|
|
51
|
+
const REPORTING_ROW_NATIVE_VERSION_REF_MAX_LENGTH = 1024;
|
|
47
52
|
const REPORTING_ROW_KEY_PLACEHOLDERS = Object.freeze([
|
|
48
53
|
"prefix",
|
|
49
54
|
"namespace_key",
|
|
@@ -58,13 +63,18 @@ const REPORTING_ROW_DEFAULT_KEY_TEMPLATE = "{prefix}/{namespace_key}/{account_ke
|
|
|
58
63
|
const PREFIX = /^[A-Za-z0-9_.=-]+(?:\/[A-Za-z0-9_.=-]+)*$/;
|
|
59
64
|
const KEY = /^[A-Za-z0-9_.=-]+(?:\/[A-Za-z0-9_.=-]+)*$/;
|
|
60
65
|
const PLACEHOLDER = /\{([a-z0-9_]+)\}/g;
|
|
61
|
-
function assertReportingRowKeyTemplateV1(template) {
|
|
66
|
+
function assertReportingRowKeyTemplateV1(template, options = {}) {
|
|
62
67
|
if (!template.startsWith("{prefix}/{namespace_key}/")) {
|
|
63
68
|
throw new import_row_storage_errors.ReportingRowStoreError("INVALID_INPUT", "key templates must begin with {prefix}/{namespace_key}/");
|
|
64
69
|
}
|
|
65
|
-
|
|
70
|
+
const requiredPlaceholders = ["{content_sha256}", "{chunk_index}"];
|
|
71
|
+
if (options.requireRevisionKey ?? true) requiredPlaceholders.push("{revision_key}");
|
|
72
|
+
for (const required of requiredPlaceholders) {
|
|
66
73
|
if (!template.includes(required)) {
|
|
67
|
-
throw new import_row_storage_errors.ReportingRowStoreError(
|
|
74
|
+
throw new import_row_storage_errors.ReportingRowStoreError(
|
|
75
|
+
"INVALID_INPUT",
|
|
76
|
+
required === "{revision_key}" ? "key templates must include {revision_key} so every row set has unique object keys. A binding identity includes its template, so add it under a NEW binding ID and keep the old definition configured with `readOnly: true` while rows reference it (rows already written stay readable at their recorded object_ref)" : `key templates must include ${required}`
|
|
77
|
+
);
|
|
68
78
|
}
|
|
69
79
|
}
|
|
70
80
|
const unknown = [...template.matchAll(PLACEHOLDER)].map((match) => match[1]).filter((name) => !REPORTING_ROW_KEY_PLACEHOLDERS.includes(name));
|
|
@@ -92,7 +102,8 @@ function renderReportingRowObjectKeyV1(input) {
|
|
|
92
102
|
prefix: input.prefix,
|
|
93
103
|
namespace_key: input.namespaceKey,
|
|
94
104
|
account_key: reportingRowAccountKeyV1(input.namespaceKey, input.accountId),
|
|
95
|
-
period_date
|
|
105
|
+
// Rendered only when the template uses it, so a template without {period_date} needs no timezone.
|
|
106
|
+
period_date: input.template.includes("{period_date}") ? renderedPeriodDate(input.periodStart, input.sourceTimezone) : "",
|
|
96
107
|
finality: input.finality ?? "adjustment",
|
|
97
108
|
revision_key: reportingRowRevisionKeyV1(input.rowSetId),
|
|
98
109
|
content_sha256: input.contentSha256,
|
|
@@ -102,13 +113,30 @@ function renderReportingRowObjectKeyV1(input) {
|
|
|
102
113
|
if (!KEY.test(key) || key.split("/").some((segment) => segment === "." || segment === "..") || !key.startsWith(`${input.prefix}/${input.namespaceKey}/`)) {
|
|
103
114
|
throw new import_row_storage_errors.ReportingRowStoreError("INVALID_INPUT", "rendered object key escapes the binding prefix");
|
|
104
115
|
}
|
|
116
|
+
if (key.length > REPORTING_ROW_OBJECT_REF_MAX_LENGTH) {
|
|
117
|
+
throw new import_row_storage_errors.ReportingRowStoreError(
|
|
118
|
+
"INVALID_INPUT",
|
|
119
|
+
`rendered object key exceeds ${REPORTING_ROW_OBJECT_REF_MAX_LENGTH} characters (AdCP object_ref bound)`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
105
122
|
return key;
|
|
106
123
|
}
|
|
107
|
-
function
|
|
124
|
+
function renderedPeriodDate(periodStart, sourceTimezone) {
|
|
108
125
|
if (!periodStart) return "undated";
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
126
|
+
if (!sourceTimezone) {
|
|
127
|
+
throw new import_row_storage_errors.ReportingRowStoreError(
|
|
128
|
+
"INVALID_INPUT",
|
|
129
|
+
"a period start needs its source_timezone to render {period_date}"
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
return (0, import_schedule.reportingPeriodDate)(periodStart, sourceTimezone);
|
|
134
|
+
} catch {
|
|
135
|
+
throw new import_row_storage_errors.ReportingRowStoreError(
|
|
136
|
+
"INVALID_INPUT",
|
|
137
|
+
"period start or source_timezone is invalid; cannot render {period_date}"
|
|
138
|
+
);
|
|
139
|
+
}
|
|
112
140
|
}
|
|
113
141
|
function createFilesystemReportingRowObjectProviderV1(options) {
|
|
114
142
|
const roots = /* @__PURE__ */ new Map();
|
|
@@ -145,7 +173,7 @@ function createFilesystemReportingRowObjectProviderV1(options) {
|
|
|
145
173
|
},
|
|
146
174
|
async putIfAbsent(input, context) {
|
|
147
175
|
context.signal.throwIfAborted();
|
|
148
|
-
const target = resolve(input.location, input.
|
|
176
|
+
const target = resolve(input.location, input.objectRef);
|
|
149
177
|
await import_fs.promises.mkdir(path.dirname(target), { recursive: true });
|
|
150
178
|
const temporary = `${target}.${(0, import_crypto.randomUUID)()}.tmp`;
|
|
151
179
|
const handle = await import_fs.promises.open(temporary, "wx");
|
|
@@ -159,10 +187,10 @@ function createFilesystemReportingRowObjectProviderV1(options) {
|
|
|
159
187
|
}
|
|
160
188
|
try {
|
|
161
189
|
await import_fs.promises.link(temporary, target);
|
|
162
|
-
return { created: true,
|
|
190
|
+
return { created: true, nativeVersionRef: await version(target) };
|
|
163
191
|
} catch (error) {
|
|
164
192
|
if (error.code === "EEXIST") {
|
|
165
|
-
return { created: false,
|
|
193
|
+
return { created: false, nativeVersionRef: await version(target) };
|
|
166
194
|
}
|
|
167
195
|
throw new import_row_storage_errors.ReportingRowStoreError("PROVIDER_UNAVAILABLE", "filesystem write failed");
|
|
168
196
|
} finally {
|
|
@@ -171,7 +199,7 @@ function createFilesystemReportingRowObjectProviderV1(options) {
|
|
|
171
199
|
},
|
|
172
200
|
async get(input, context) {
|
|
173
201
|
context.signal.throwIfAborted();
|
|
174
|
-
const target = resolve(input.location, input.
|
|
202
|
+
const target = resolve(input.location, input.objectRef);
|
|
175
203
|
let handle;
|
|
176
204
|
try {
|
|
177
205
|
handle = await import_fs.promises.open(target, "r");
|
|
@@ -181,7 +209,7 @@ function createFilesystemReportingRowObjectProviderV1(options) {
|
|
|
181
209
|
}
|
|
182
210
|
try {
|
|
183
211
|
const stat = await handle.stat({ bigint: true });
|
|
184
|
-
if (versionOf(stat) !== input.
|
|
212
|
+
if (versionOf(stat) !== input.nativeVersionRef) return null;
|
|
185
213
|
const size = Number(stat.size);
|
|
186
214
|
const offset = input.range?.offset ?? 0;
|
|
187
215
|
const length = input.range?.length ?? size - offset;
|
|
@@ -198,11 +226,22 @@ function createFilesystemReportingRowObjectProviderV1(options) {
|
|
|
198
226
|
await handle.close();
|
|
199
227
|
}
|
|
200
228
|
},
|
|
229
|
+
async stat(input, context) {
|
|
230
|
+
context.signal.throwIfAborted();
|
|
231
|
+
const target = resolve(input.location, input.objectRef);
|
|
232
|
+
try {
|
|
233
|
+
const stat = await import_fs.promises.stat(target, { bigint: true });
|
|
234
|
+
return versionOf(stat) === input.nativeVersionRef ? { nativeVersionRef: input.nativeVersionRef, sizeBytes: Number(stat.size) } : null;
|
|
235
|
+
} catch (error) {
|
|
236
|
+
if (error.code === "ENOENT") return null;
|
|
237
|
+
throw new import_row_storage_errors.ReportingRowStoreError("PROVIDER_UNAVAILABLE", "filesystem stat failed");
|
|
238
|
+
}
|
|
239
|
+
},
|
|
201
240
|
async delete(input, context) {
|
|
202
241
|
context.signal.throwIfAborted();
|
|
203
|
-
const target = resolve(input.location, input.
|
|
242
|
+
const target = resolve(input.location, input.objectRef);
|
|
204
243
|
try {
|
|
205
|
-
if (await version(target) !== input.
|
|
244
|
+
if (await version(target) !== input.nativeVersionRef) return "absent";
|
|
206
245
|
await import_fs.promises.unlink(target);
|
|
207
246
|
return "deleted";
|
|
208
247
|
} catch (error) {
|
|
@@ -224,64 +263,98 @@ async function runReportingRowObjectProviderConformanceV1(provider, input) {
|
|
|
224
263
|
await provider.probe(input, context);
|
|
225
264
|
passed.push("probe");
|
|
226
265
|
const created = await provider.putIfAbsent(
|
|
227
|
-
{ ...base, key, bytes: first, contentType: "application/x-ndjson", metadata },
|
|
266
|
+
{ ...base, objectRef: key, bytes: first, contentType: "application/x-ndjson", metadata },
|
|
228
267
|
context
|
|
229
268
|
);
|
|
230
|
-
if (!created.created || !created.
|
|
269
|
+
if (!created.created || !created.nativeVersionRef) throw new Error("putIfAbsent did not create a new object");
|
|
231
270
|
passed.push("create");
|
|
232
271
|
const conflict = await provider.putIfAbsent(
|
|
233
|
-
{ ...base, key, bytes: Buffer.from('{"c":3}\n'), contentType: "application/x-ndjson", metadata },
|
|
272
|
+
{ ...base, objectRef: key, bytes: Buffer.from('{"c":3}\n'), contentType: "application/x-ndjson", metadata },
|
|
234
273
|
context
|
|
235
274
|
);
|
|
236
|
-
if (conflict.created || conflict.
|
|
275
|
+
if (conflict.created || conflict.nativeVersionRef !== created.nativeVersionRef) {
|
|
237
276
|
throw new Error("putIfAbsent replaced or re-versioned an existing object");
|
|
238
277
|
}
|
|
239
|
-
const stored = await provider.get(
|
|
278
|
+
const stored = await provider.get(
|
|
279
|
+
{ ...base, objectRef: key, nativeVersionRef: created.nativeVersionRef, maxBytes: 1024 },
|
|
280
|
+
context
|
|
281
|
+
);
|
|
240
282
|
if (!stored || !Buffer.from(stored).equals(first))
|
|
241
283
|
throw new Error("create-only write did not preserve the first bytes");
|
|
242
284
|
passed.push("create-only");
|
|
243
285
|
if (provider.rangedReads) {
|
|
244
286
|
const ranged = await provider.get(
|
|
245
|
-
{
|
|
287
|
+
{
|
|
288
|
+
...base,
|
|
289
|
+
objectRef: key,
|
|
290
|
+
nativeVersionRef: created.nativeVersionRef,
|
|
291
|
+
range: { offset: 8, length: 8 },
|
|
292
|
+
maxBytes: 1024
|
|
293
|
+
},
|
|
246
294
|
context
|
|
247
295
|
);
|
|
248
296
|
if (!ranged || Buffer.from(ranged).toString("utf8") !== '{"b":2}\n')
|
|
249
297
|
throw new Error("ranged read returned wrong bytes");
|
|
250
298
|
passed.push("ranged-read");
|
|
251
299
|
}
|
|
252
|
-
if (await provider.get({ ...base, key,
|
|
300
|
+
if (await provider.get({ ...base, objectRef: key, nativeVersionRef: "not-a-version", maxBytes: 1024 }, context) !== null) {
|
|
253
301
|
throw new Error("get returned bytes for a version that does not exist");
|
|
254
302
|
}
|
|
255
303
|
passed.push("version-pinned-read");
|
|
256
|
-
if (
|
|
304
|
+
if (provider.stat) {
|
|
305
|
+
const stat = await provider.stat({ ...base, objectRef: key, nativeVersionRef: created.nativeVersionRef }, context);
|
|
306
|
+
if (!stat || stat.sizeBytes !== first.byteLength) throw new Error("stat did not report the stored object size");
|
|
307
|
+
if (stat.nativeVersionRef !== created.nativeVersionRef) throw new Error("stat did not echo the version it checked");
|
|
308
|
+
if (await provider.stat({ ...base, objectRef: key, nativeVersionRef: "not-a-version" }, context) !== null) {
|
|
309
|
+
throw new Error("stat returned metadata for a version that does not exist");
|
|
310
|
+
}
|
|
311
|
+
passed.push("version-pinned-stat");
|
|
312
|
+
}
|
|
313
|
+
if (await provider.delete({ ...base, objectRef: key, nativeVersionRef: "not-a-version" }, context) !== "absent") {
|
|
257
314
|
throw new Error("delete removed an object at a different version");
|
|
258
315
|
}
|
|
259
|
-
if (await provider.delete({ ...base, key,
|
|
316
|
+
if (await provider.delete({ ...base, objectRef: key, nativeVersionRef: created.nativeVersionRef }, context) !== "deleted") {
|
|
260
317
|
throw new Error("delete did not remove the exact version");
|
|
261
318
|
}
|
|
262
|
-
if (await provider.delete({ ...base, key,
|
|
319
|
+
if (await provider.delete({ ...base, objectRef: key, nativeVersionRef: created.nativeVersionRef }, context) !== "absent") {
|
|
263
320
|
throw new Error("repeated delete was not idempotent");
|
|
264
321
|
}
|
|
265
322
|
passed.push("exact-version-delete");
|
|
323
|
+
if (provider.stat && await provider.stat({ ...base, objectRef: key, nativeVersionRef: created.nativeVersionRef }, context) !== null) {
|
|
324
|
+
throw new Error("stat returned metadata for a deleted version");
|
|
325
|
+
}
|
|
266
326
|
const recreated = await provider.putIfAbsent(
|
|
267
|
-
{ ...base, key, bytes: first, contentType: "application/x-ndjson", metadata },
|
|
327
|
+
{ ...base, objectRef: key, bytes: first, contentType: "application/x-ndjson", metadata },
|
|
268
328
|
context
|
|
269
329
|
);
|
|
270
|
-
if (!recreated.created || !recreated.
|
|
271
|
-
|
|
330
|
+
if (!recreated.created || !recreated.nativeVersionRef)
|
|
331
|
+
throw new Error("putIfAbsent did not re-create a deleted object");
|
|
332
|
+
if (recreated.nativeVersionRef === created.nativeVersionRef) {
|
|
272
333
|
throw new Error("re-creating identical bytes produced the same native version; versions must be write-unique");
|
|
273
334
|
}
|
|
274
|
-
if (await provider.delete({ ...base, key,
|
|
335
|
+
if (await provider.delete({ ...base, objectRef: key, nativeVersionRef: created.nativeVersionRef }, context) !== "absent") {
|
|
275
336
|
throw new Error("delete of a stale version removed or reported a later write");
|
|
276
337
|
}
|
|
338
|
+
if (provider.stat) {
|
|
339
|
+
if (await provider.stat({ ...base, objectRef: key, nativeVersionRef: created.nativeVersionRef }, context) !== null) {
|
|
340
|
+
throw new Error("stat of a stale version reported a later write at the same key");
|
|
341
|
+
}
|
|
342
|
+
const current = await provider.stat(
|
|
343
|
+
{ ...base, objectRef: key, nativeVersionRef: recreated.nativeVersionRef },
|
|
344
|
+
context
|
|
345
|
+
);
|
|
346
|
+
if (!current || current.sizeBytes !== first.byteLength || current.nativeVersionRef !== recreated.nativeVersionRef) {
|
|
347
|
+
throw new Error("stat did not report the re-created object");
|
|
348
|
+
}
|
|
349
|
+
}
|
|
277
350
|
const survivor = await provider.get(
|
|
278
|
-
{ ...base, key,
|
|
351
|
+
{ ...base, objectRef: key, nativeVersionRef: recreated.nativeVersionRef, maxBytes: 1024 },
|
|
279
352
|
context
|
|
280
353
|
);
|
|
281
354
|
if (!survivor || !Buffer.from(survivor).equals(first)) {
|
|
282
355
|
throw new Error("delete of a stale version removed a later write with identical bytes");
|
|
283
356
|
}
|
|
284
|
-
if (await provider.delete({ ...base, key,
|
|
357
|
+
if (await provider.delete({ ...base, objectRef: key, nativeVersionRef: recreated.nativeVersionRef }, context) !== "deleted") {
|
|
285
358
|
throw new Error("delete did not remove the re-created version");
|
|
286
359
|
}
|
|
287
360
|
passed.push("write-unique-version");
|
|
@@ -294,6 +367,8 @@ function sha256Hex(value) {
|
|
|
294
367
|
0 && (module.exports = {
|
|
295
368
|
REPORTING_ROW_DEFAULT_KEY_TEMPLATE,
|
|
296
369
|
REPORTING_ROW_KEY_PLACEHOLDERS,
|
|
370
|
+
REPORTING_ROW_NATIVE_VERSION_REF_MAX_LENGTH,
|
|
371
|
+
REPORTING_ROW_OBJECT_REF_MAX_LENGTH,
|
|
297
372
|
assertReportingRowKeyTemplateV1,
|
|
298
373
|
assertReportingRowPrefixV1,
|
|
299
374
|
createFilesystemReportingRowObjectProviderV1,
|