@adcp/sdk 15.5.0 → 15.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/lib/auth/oauth/index.d.mts +1 -0
- package/dist/lib/auth/oauth/index.d.ts +1 -0
- package/dist/lib/auth/oauth/index.js +5 -0
- package/dist/lib/auth/oauth/index.mjs +3 -0
- package/dist/lib/auth/oauth/pending-web-flow.d.mts +16 -0
- package/dist/lib/auth/oauth/pending-web-flow.d.ts +16 -0
- package/dist/lib/auth/oauth/pending-web-flow.js +66 -0
- package/dist/lib/auth/oauth/pending-web-flow.mjs +41 -0
- package/dist/lib/auth/oauth/web-flow.js +3 -3
- package/dist/lib/auth/oauth/web-flow.mjs +3 -3
- package/dist/lib/registry/types.generated.d.mts +63 -1
- package/dist/lib/registry/types.generated.d.ts +63 -1
- package/dist/lib/reporting/azure/index.d.mts +26 -0
- package/dist/lib/reporting/azure/index.d.ts +26 -0
- package/dist/lib/reporting/azure/index.js +247 -0
- package/dist/lib/reporting/azure/index.mjs +230 -0
- package/dist/lib/reporting/bigquery/index.d.mts +127 -0
- package/dist/lib/reporting/bigquery/index.d.ts +127 -0
- package/dist/lib/reporting/bigquery/index.js +379 -0
- package/dist/lib/reporting/bigquery/index.mjs +341 -0
- package/dist/lib/reporting/ledger/postgres.d.mts +10 -0
- package/dist/lib/reporting/ledger/postgres.d.ts +10 -0
- package/dist/lib/reporting/ledger/postgres.js +23 -2
- package/dist/lib/reporting/ledger/postgres.mjs +23 -2
- package/dist/lib/reporting/ledger/row-storage-object.js +31 -8
- package/dist/lib/reporting/ledger/row-storage-object.mjs +32 -9
- package/dist/lib/reporting/ledger/row-storage-provider-io.d.mts +0 -7
- package/dist/lib/reporting/ledger/row-storage-provider-io.d.ts +0 -7
- package/dist/lib/reporting/ledger/row-storage-provider-io.js +0 -10
- package/dist/lib/reporting/ledger/row-storage-provider-io.mjs +0 -8
- package/dist/lib/reporting/s3/index.d.mts +29 -0
- package/dist/lib/reporting/s3/index.d.ts +29 -0
- package/dist/lib/reporting/s3/index.js +324 -0
- package/dist/lib/reporting/s3/index.mjs +317 -0
- package/dist/lib/reporting/service/index.d.mts +3 -1
- package/dist/lib/reporting/service/index.d.ts +3 -1
- package/dist/lib/reporting/service/index.js +1 -0
- package/dist/lib/reporting/service/index.mjs +1 -0
- package/dist/lib/schemas/browser.d.mts +14 -0
- package/dist/lib/schemas/browser.d.ts +14 -0
- package/dist/lib/schemas/browser.js +48 -0
- package/dist/lib/schemas/browser.mjs +20 -0
- package/dist/lib/schemas/index.d.mts +2 -120
- package/dist/lib/schemas/index.d.ts +2 -120
- package/dist/lib/schemas/index.js +3 -11
- package/dist/lib/schemas/index.mjs +1 -9
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/testing/index.d.mts +1 -0
- package/dist/lib/testing/index.d.ts +1 -0
- package/dist/lib/testing/index.js +3 -0
- package/dist/lib/testing/index.mjs +2 -0
- package/dist/lib/testing/pending-web-flow-store.d.mts +20 -0
- package/dist/lib/testing/pending-web-flow-store.d.ts +20 -0
- package/dist/lib/testing/pending-web-flow-store.js +132 -0
- package/dist/lib/testing/pending-web-flow-store.mjs +98 -0
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/validation/get-products-request.d.mts +122 -0
- package/dist/lib/validation/get-products-request.d.ts +122 -0
- package/dist/lib/validation/get-products-request.js +39 -0
- package/dist/lib/validation/get-products-request.mjs +14 -0
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +1 -1
- package/docs/ZOD-SCHEMAS.md +13 -1
- package/docs/guides/OAUTH-ISSUER-BINDING.md +6 -0
- package/docs/guides/REPORTING-LEDGER.md +165 -0
- package/docs/guides/REPORTING-OPERATIONS.md +76 -1
- package/docs/guides/WEB-OAUTH.md +48 -1
- package/docs/llms.txt +1 -1
- package/docs/migration-14.x-rc-worksheet.md +6 -4
- package/package.json +64 -1
|
@@ -376,6 +376,14 @@ await store.readyRowStorage();
|
|
|
376
376
|
- Every read verifies the stored bytes against the recorded physical digest
|
|
377
377
|
before decompressing, then verifies segments, chunks and the revision binding.
|
|
378
378
|
- Keep a retired binding configured while revisions still reference it.
|
|
379
|
+
- The filesystem provider identifies each write by inode, birth time, mtime
|
|
380
|
+
and size, stamping a random sub-millisecond mtime on every write. It needs a
|
|
381
|
+
filesystem with sub-second mtime and, ideally, birth time (ext4, XFS, APFS,
|
|
382
|
+
NTFS). On a coarse filesystem (FAT, some NFS mounts, ext3), a reused inode
|
|
383
|
+
re-created with identical bytes in the same second gets the same version,
|
|
384
|
+
so a delayed delete could remove the replacement. The conformance check
|
|
385
|
+
`write-unique-version` fails on such filesystems. That failure means the
|
|
386
|
+
filesystem is wrong, not the code.
|
|
379
387
|
- Custom providers implement `ReportingRowObjectProviderV1`. Run
|
|
380
388
|
`runReportingRowObjectProviderConformanceV1(provider, { location, prefix })`
|
|
381
389
|
against a dedicated test prefix before using one.
|
|
@@ -417,6 +425,86 @@ const gcs = createGcsReportingRowObjectProviderV1({
|
|
|
417
425
|
- The client needs `storage.buckets.get` for the probe plus object create, get
|
|
418
426
|
and delete on the bucket.
|
|
419
427
|
|
|
428
|
+
**Amazon S3 and S3-compatible stores** (`@adcp/sdk/reporting/s3`, optional peer
|
|
429
|
+
`@aws-sdk/client-s3`):
|
|
430
|
+
|
|
431
|
+
```ts
|
|
432
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
433
|
+
import { createS3ReportingRowObjectProviderV1 } from '@adcp/sdk/reporting/s3';
|
|
434
|
+
|
|
435
|
+
const s3 = createS3ReportingRowObjectProviderV1({
|
|
436
|
+
client: new S3Client({ region: 'us-east-1' }), // default credential chain
|
|
437
|
+
});
|
|
438
|
+
// binding: { kind: 'object', provider: 's3', location: { bucket: 'acme-adcp-rows', region: 'us-east-1' }, prefix: 'adcp-rows' }
|
|
439
|
+
// providers: { s3 }
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
- Endpoint, region, credentials and path style come only from the client you
|
|
443
|
+
inject; `location` accepts just `bucket` and an optional `region`, which the
|
|
444
|
+
probe checks against the client.
|
|
445
|
+
- **Bucket versioning is required.** Writes use `PutObject` with
|
|
446
|
+
`If-None-Match: *` (a 409 is retried once). The recorded native version is
|
|
447
|
+
the write-unique `VersionId`; reads pin it with `VersionId`, and deletes
|
|
448
|
+
confirm the exact version with `HeadObject`, then delete by `VersionId`.
|
|
449
|
+
Deletes must be fenced to one write, and an ETag identifies content, not a
|
|
450
|
+
write: a delayed delete (for example an intent sweep removing an abandoned
|
|
451
|
+
upload) pinned to an ETag would also remove a replacement object later
|
|
452
|
+
re-created with identical bytes at the same key. The probe therefore refuses
|
|
453
|
+
any bucket whose `GetBucketVersioning` status is not `Enabled` (suspended or
|
|
454
|
+
unversioned), and `putIfAbsent` refuses a result with no `VersionId`.
|
|
455
|
+
Deleting a specific `VersionId` permanently removes that version without
|
|
456
|
+
leaving a delete marker, so retention still frees storage; noncurrent-version
|
|
457
|
+
lifecycle rules are not needed for rows this provider deletes.
|
|
458
|
+
- S3-compatible stores may ignore `If-None-Match`, so the probe writes a probe
|
|
459
|
+
key under the binding prefix twice and requires the second write to fail with
|
|
460
|
+
412, then deletes it. It also refuses missing or inaccessible buckets, a
|
|
461
|
+
bucket policy reported as public, and enabled lifecycle `Expiration` rules
|
|
462
|
+
that can match the prefix. The probe cannot verify Block Public Access on
|
|
463
|
+
every store, so keep row buckets private.
|
|
464
|
+
- The client needs `s3:ListBucket` (HeadBucket),
|
|
465
|
+
`s3:GetLifecycleConfiguration`, `s3:GetBucketVersioning`, object put/get,
|
|
466
|
+
`s3:GetObjectVersion` and `s3:DeleteObjectVersion`.
|
|
467
|
+
`s3:GetBucketPolicyStatus` is optional. For stores without flexible
|
|
468
|
+
checksums, construct the client with `requestChecksumCalculation: 'WHEN_REQUIRED'`.
|
|
469
|
+
|
|
470
|
+
**Azure Blob Storage** (`@adcp/sdk/reporting/azure`, optional peer
|
|
471
|
+
`@azure/storage-blob`):
|
|
472
|
+
|
|
473
|
+
```ts
|
|
474
|
+
import { DefaultAzureCredential } from '@azure/identity';
|
|
475
|
+
import { BlobServiceClient } from '@azure/storage-blob';
|
|
476
|
+
import { createAzureBlobReportingRowObjectProviderV1 } from '@adcp/sdk/reporting/azure';
|
|
477
|
+
|
|
478
|
+
const azure = createAzureBlobReportingRowObjectProviderV1({
|
|
479
|
+
client: new BlobServiceClient('https://acmerows.blob.core.windows.net', new DefaultAzureCredential()),
|
|
480
|
+
});
|
|
481
|
+
// binding: { kind: 'object', provider: 'azure_blob', location: { account: 'acmerows', container: 'adcp-rows' }, prefix: 'adcp-rows' }
|
|
482
|
+
// providers: { azure_blob: azure }
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
- `location` names the storage `account` and `container`; the selected client
|
|
486
|
+
must belong to that account. The endpoint and credentials come only from
|
|
487
|
+
the client.
|
|
488
|
+
- **Blob versioning is required** on the storage account. Writes are
|
|
489
|
+
block-blob uploads with `If-None-Match: *`. A 409 `BlobAlreadyExists` or 412
|
|
490
|
+
adopts the existing blob. The recorded native version is the write-unique
|
|
491
|
+
`versionId`; reads and deletes pin it, and only count a response that echoes
|
|
492
|
+
that exact version. ETags are content-derived, so they cannot fence a delayed
|
|
493
|
+
delete away from an identical re-upload at the same key. The probe's
|
|
494
|
+
create-only write must return a `versionId` (otherwise `UNSAFE_BINDING`), and
|
|
495
|
+
`putIfAbsent` refuses a result without one. Deleting a specific version
|
|
496
|
+
permanently removes it, so retention still frees storage. Azurite does not
|
|
497
|
+
implement blob versioning and cannot back this provider. Metadata names are
|
|
498
|
+
stored as C# identifiers (`adcp_intent`).
|
|
499
|
+
- The probe refuses missing or inaccessible containers and containers with
|
|
500
|
+
anonymous access. Like S3, it proves create-only writes empirically with a
|
|
501
|
+
probe blob under the prefix. Lifecycle management policies are account-level
|
|
502
|
+
and are not visible to the data-plane client, so make sure none can delete
|
|
503
|
+
blobs under the binding prefix.
|
|
504
|
+
- The client needs read, write and delete on blobs in the container (for
|
|
505
|
+
example `Storage Blob Data Contributor`), plus permission to delete
|
|
506
|
+
versions.
|
|
507
|
+
|
|
420
508
|
### Retention
|
|
421
509
|
|
|
422
510
|
Retention is period-aligned and opt-in. A period becomes eligible once both its
|
|
@@ -425,6 +513,17 @@ recordRetentionDays)`, no worker holds its lease, and no Managed Delivery
|
|
|
425
513
|
materialization still references it. Superseded snapshots stay readable for the
|
|
426
514
|
whole window, as the protocol requires.
|
|
427
515
|
|
|
516
|
+
When the change feed is installed, retention also waits for registered feed
|
|
517
|
+
consumers. A period is held while any live consumer (one whose cursor was saved
|
|
518
|
+
within `maxFeedHoldDays`, default 7) has not yet passed that period's change
|
|
519
|
+
rows, in the consumer's own feed order. This is the same rule `pruneChanges`
|
|
520
|
+
uses, so a warehouse sink that is briefly down does not lose revisions it has
|
|
521
|
+
not loaded. A held period is simply not retired on this pass. A consumer silent
|
|
522
|
+
for longer than `maxFeedHoldDays` stops holding, so a dead consumer cannot block
|
|
523
|
+
retention forever; it has then fallen behind retention (see the warehouse sink
|
|
524
|
+
below). Pass `maxFeedHoldDays` to `retireExpiredPeriods`; the production service
|
|
525
|
+
passes `changeFeed.maxFeedHoldDays` for you so retention and feed pruning agree.
|
|
526
|
+
|
|
428
527
|
```ts
|
|
429
528
|
await store.retireExpiredPeriods({ statusRetentionDays: 30, recordRetentionDays: 45, limit: 100 });
|
|
430
529
|
await store.sweepRowWriteIntents({ limit: 100 }); // abandoned object uploads
|
|
@@ -478,9 +577,75 @@ await store.saveFeedConsumerCursor('pacing', page.cursor); // holds back pruning
|
|
|
478
577
|
that every consumer updated within `maxFeedHoldDays` (default 7) has passed.
|
|
479
578
|
An older cursor throws `ReportingChangeCursorExpiredError`; resynchronize from
|
|
480
579
|
`listCurrentRevisions`.
|
|
580
|
+
- Period retention honours the same hold: `retireExpiredPeriods` does not retire
|
|
581
|
+
a period while a live consumer has not read its changes. A consumer that
|
|
582
|
+
stays silent past `maxFeedHoldDays` stops holding, and its unread changes can
|
|
583
|
+
then point at revisions whose period was retired.
|
|
481
584
|
- The production service accepts `changeFeed: true | { changeRetentionDays,
|
|
482
585
|
maxFeedHoldDays }` and prunes the feed on its scheduler.
|
|
483
586
|
|
|
587
|
+
### BigQuery warehouse sink
|
|
588
|
+
|
|
589
|
+
`@adcp/sdk/reporting/bigquery` loads committed revisions into your own BigQuery
|
|
590
|
+
tables for analysts. The warehouse copy is derived and non-authoritative. It
|
|
591
|
+
is never read for serving or verification, so its table names, columns,
|
|
592
|
+
partitioning and retention are yours.
|
|
593
|
+
|
|
594
|
+
```ts
|
|
595
|
+
import { BigQuery } from '@google-cloud/bigquery';
|
|
596
|
+
import {
|
|
597
|
+
REPORTING_WAREHOUSE_SINK_MIGRATION,
|
|
598
|
+
createBigQueryReportingWarehouseSinkV1,
|
|
599
|
+
} from '@adcp/sdk/reporting/bigquery';
|
|
600
|
+
|
|
601
|
+
await pool.query(REPORTING_WAREHOUSE_SINK_MIGRATION); // after REPORTING_LEDGER_CHANGES_MIGRATION
|
|
602
|
+
const sink = createBigQueryReportingWarehouseSinkV1({
|
|
603
|
+
store, // PostgresReportingLedgerStore with changeFeed: true
|
|
604
|
+
db: pool,
|
|
605
|
+
bigquery: new BigQuery({ projectId: 'analytics-prod' }), // ADC / workload identity
|
|
606
|
+
name: 'warehouse',
|
|
607
|
+
projectId: 'analytics-prod',
|
|
608
|
+
datasetId: 'reporting',
|
|
609
|
+
rowsTableId: 'media_buy_delivery_rows',
|
|
610
|
+
revisionsTableId: 'media_buy_delivery_revisions',
|
|
611
|
+
location: 'US',
|
|
612
|
+
mapRow: row => ({ media_buy_id: row.media_buy_id, impressions: row.impressions, spend: row.spend }),
|
|
613
|
+
labels: { component: 'adcp-reporting' },
|
|
614
|
+
});
|
|
615
|
+
await bigquery.query({ query: sink.defaultTablesSql }); // or create your own tables
|
|
616
|
+
await bigquery.query({ query: sink.currentRowsViewSql });
|
|
617
|
+
setInterval(() => void sink.runOnce(), 15 * 60_000);
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
- Each run follows the change feed and reads every revision's rows through the
|
|
621
|
+
store's verified reader. It loads rows first and revision metadata second,
|
|
622
|
+
in one load job per table per tick. The sink always adds
|
|
623
|
+
`reporting_revision_id`, `reporting_obligation_id`, `account_id`,
|
|
624
|
+
`revision_number`, `finality`, `period_date` (the period's date in its source
|
|
625
|
+
timezone) and `ordinal` to your mapped columns.
|
|
626
|
+
- Batches are planned durably before loading, and job IDs derive from the
|
|
627
|
+
change-feed range. A crash between a load and the cursor commit replays the
|
|
628
|
+
same batch under the same job ID, which BigQuery refuses to run twice. A job
|
|
629
|
+
that finished with an error is retried under a new attempt for that table
|
|
630
|
+
only.
|
|
631
|
+
- Query `current_rows`, not the raw rows table. Pacing snapshots are
|
|
632
|
+
cumulative, so summing across revisions double-counts. The view keeps each
|
|
633
|
+
obligation's current revision.
|
|
634
|
+
- The sink registers as a change-feed consumer, so `pruneChanges` keeps changes
|
|
635
|
+
it has not loaded yet, and `retireExpiredPeriods` keeps the periods it has not
|
|
636
|
+
loaded yet, in both cases only while its cursor was saved within
|
|
637
|
+
`maxFeedHoldDays`. Superseded snapshots are the intraday pacing curve, and the
|
|
638
|
+
warehouse may keep them as long as you like.
|
|
639
|
+
- `runOnce()` resolves with `{ idle, revisions, rows, missing }`. `missing`
|
|
640
|
+
lists revision IDs the feed announced that were retired before the batch ran.
|
|
641
|
+
A non-empty `missing` means the sink fell behind retention (it was down longer
|
|
642
|
+
than `maxFeedHoldDays` plus the retention window): the warehouse lacks those
|
|
643
|
+
revisions. Backfill them from another source or accept the gap. The cursor
|
|
644
|
+
still advances so the sink is not stuck. After a crash and replay of a planned
|
|
645
|
+
batch, a listed revision may already have been loaded by the first attempt.
|
|
646
|
+
- The sink uses only `dataset().table().load()`, `job().getMetadata()` and
|
|
647
|
+
`query()` from the official client you construct. It adds no dependency.
|
|
648
|
+
|
|
484
649
|
## Managed Delivery and Reconciled Billing
|
|
485
650
|
|
|
486
651
|
Core remains the default and has no destination, external-resource, or receipt dependency. To opt into the higher tiers, apply `REPORTING_MANAGED_DELIVERY_MIGRATION` **after** `REPORTING_LEDGER_MIGRATION`, explicitly construct the Core store with `managedDelivery: true`, create a `PostgresReportingManagedDeliveryStore`, and pass both stores with a destination adapter to `createReportingManagedDeliveryRuntime`. The async factory proves the stores share one authority and validates the RC3 tier wiring before returning it. It advertises `managed_delivery` only when an immutable binding, delivery, bounded resource reading, generation-fenced revocation, and at least one verification profile are installed. The advertised automated recovery window must be at least the widest installed managed Core configuration recovery window. It advertises `reconciled_billing` and `receipt_task` only when an authenticated consumer resolver and canonical-digest verification are also installed.
|
|
@@ -72,6 +72,65 @@ different operators own tenant partitions. For Reconciled Billing offerings,
|
|
|
72
72
|
provide `obligatedConsumers` from a trusted authorization roster. A missing or
|
|
73
73
|
incomplete roster cannot safely mark a billing obligation reconciled.
|
|
74
74
|
|
|
75
|
+
## Adopting row storage, retention and the change feed
|
|
76
|
+
|
|
77
|
+
Each of these features is opt-in and additive. Enable them one at a time on a
|
|
78
|
+
running deployment. See the [ledger guide](REPORTING-LEDGER.md#row-storage)
|
|
79
|
+
for configuration details.
|
|
80
|
+
|
|
81
|
+
1. **Row storage.** Apply `REPORTING_ROW_STORAGE_MIGRATION` (PostgreSQL 13+),
|
|
82
|
+
or pass `rowStorage` to the production service, which adds it to
|
|
83
|
+
`setup.migrations`. Roll out with `rowStorage` set. New revisions store
|
|
84
|
+
verified chunks. Existing revisions keep their inline rows, and every
|
|
85
|
+
binary built with row storage reads both forms. Do not run a writer older
|
|
86
|
+
than this release once chunked revisions exist: it cannot read them.
|
|
87
|
+
2. **Existing inline rows (optional).** Run `migrateInlineRows` in bounded
|
|
88
|
+
batches from a maintenance job until it returns no cursor. Alert on any
|
|
89
|
+
`quarantined` IDs: those revisions no longer reproduce their committed
|
|
90
|
+
binding and are left untouched for investigation. Then reclaim space with
|
|
91
|
+
`VACUUM FULL` or an online repack in a maintenance window.
|
|
92
|
+
3. **Object storage.** Create a dedicated private bucket, container or prefix
|
|
93
|
+
for rows, separate from Managed Delivery buckets. Configure the binding in
|
|
94
|
+
host code and run `runReportingRowObjectProviderConformanceV1` against a
|
|
95
|
+
test prefix first. S3 bucket versioning and Azure blob versioning are
|
|
96
|
+
**required**, and the providers' probes refuse unversioned buckets and
|
|
97
|
+
accounts: deletes must be fenced to one write, and ETags are content-derived,
|
|
98
|
+
so an ETag-pinned delayed delete (for example an intent sweep) could remove a
|
|
99
|
+
replacement object re-created with identical bytes at the same key. Deleting
|
|
100
|
+
a specific `VersionId` permanently removes that version (no delete marker),
|
|
101
|
+
so retention still frees storage. Do not
|
|
102
|
+
attach lifecycle rules that can delete live rows sooner than
|
|
103
|
+
`max(statusRetentionDays, recordRetentionDays)` plus the restatement window.
|
|
104
|
+
The GCS probe refuses them; for S3 and Azure, policies outside the client's
|
|
105
|
+
view are the operator's responsibility.
|
|
106
|
+
4. **Change feed.** Apply `REPORTING_LEDGER_CHANGES_MIGRATION` (PostgreSQL 13+)
|
|
107
|
+
or pass `changeFeed`. Register each durable consumer with
|
|
108
|
+
`saveFeedConsumerCursor`, and size `maxFeedHoldDays` so one stalled consumer
|
|
109
|
+
cannot hold the table indefinitely.
|
|
110
|
+
5. **Warehouse sink.** Apply `REPORTING_WAREHOUSE_SINK_MIGRATION`, create the
|
|
111
|
+
tables, and the `current_rows` view, then schedule `runOnce`. Point analysts
|
|
112
|
+
at `current_rows`.
|
|
113
|
+
6. **Retention.** Enable `retention` last, after confirming the advertised
|
|
114
|
+
`status_retention_days` is the window you intend to keep. Retirement deletes
|
|
115
|
+
rows and ledger records for whole periods and cannot be undone. Keep backups
|
|
116
|
+
for any longer audit requirement.
|
|
117
|
+
|
|
118
|
+
Alert on these row-storage signals:
|
|
119
|
+
|
|
120
|
+
- `ROWS_INTEGRITY_FAILED` or `ROWS_UNAVAILABLE` from reads. These are never
|
|
121
|
+
normal, and buyers see `SERVICE_UNAVAILABLE` for the affected revision.
|
|
122
|
+
- A growing count of `adcp_reporting_row_write_intents` in `sweeping` state,
|
|
123
|
+
or `sweepRowWriteIntents` reporting failures. Provider deletes are failing.
|
|
124
|
+
- `retireExpiredPeriods` returning `failed` IDs. Usually a binding was removed
|
|
125
|
+
from configuration while revisions still reference it; keep retired bindings
|
|
126
|
+
configured.
|
|
127
|
+
- `ReportingChangeCursorExpiredError` in a consumer. That consumer fell behind
|
|
128
|
+
retention and must resynchronize from `listCurrentRevisions`.
|
|
129
|
+
- A non-empty `missing` from the warehouse sink's `runOnce()`. The sink was down
|
|
130
|
+
longer than `maxFeedHoldDays`, retention stopped waiting for it, and the
|
|
131
|
+
warehouse lacks those revisions. Backfill them or accept the gap, and keep
|
|
132
|
+
`maxFeedHoldDays` above your longest tolerated sink outage.
|
|
133
|
+
|
|
75
134
|
## Service objectives and alerts
|
|
76
135
|
|
|
77
136
|
Choose targets stricter than contractual delivery SLAs. A reasonable starting
|
|
@@ -146,7 +205,17 @@ Quarterly, restore into an isolated environment and verify:
|
|
|
146
205
|
- notification recovery resumes without duplicate logical events;
|
|
147
206
|
- buyer cursors/checkpoints resume and duplicate notification keys remain deduped;
|
|
148
207
|
- a new lease fences an expired owner;
|
|
149
|
-
- sampled manifest and canonical-content digests still verify
|
|
208
|
+
- sampled manifest and canonical-content digests still verify;
|
|
209
|
+
- sampled chunked revisions read back through `getRevision`, including rows in
|
|
210
|
+
object-storage bindings.
|
|
211
|
+
|
|
212
|
+
Row objects live outside the database. A database restore and the matching
|
|
213
|
+
row buckets must come from the same point in time, or revisions committed
|
|
214
|
+
after the bucket snapshot read as `ROWS_UNAVAILABLE`. A restored replica of
|
|
215
|
+
the same authority keeps its installation identity. An independently writable
|
|
216
|
+
clone, such as staging restored from production, must mint a new
|
|
217
|
+
`adcp_persistence_installation` row and use new bindings before it writes or
|
|
218
|
+
sweeps, so it can never delete production objects.
|
|
150
219
|
|
|
151
220
|
After regional failover, fence the old primary before enabling writers. Ensure
|
|
152
221
|
database time is healthy, then start canary workers and watch lease generation,
|
|
@@ -177,6 +246,12 @@ Disable notification-triggered acceleration if necessary, retain dedupe rows,
|
|
|
177
246
|
and repair the authenticated seller/principal registry before resuming. Never
|
|
178
247
|
choose an account based only on an untrusted webhook body.
|
|
179
248
|
|
|
249
|
+
Row-storage integrity failure: stop serving the affected scope and do not
|
|
250
|
+
re-upload over the recorded object. Compare the stored object's bytes and
|
|
251
|
+
version with the chunk manifest, restore the exact recorded version from bucket
|
|
252
|
+
versioning or backups, and verify by reading the revision through `getRevision`.
|
|
253
|
+
Never edit a chunk manifest or digest to match the stored bytes.
|
|
254
|
+
|
|
180
255
|
Clock skew: remove the host from service. Lease and event times use PostgreSQL
|
|
181
256
|
where correctness needs a shared clock, while provider deadlines and process
|
|
182
257
|
timeouts still depend on healthy host clocks.
|
package/docs/guides/WEB-OAUTH.md
CHANGED
|
@@ -69,10 +69,57 @@ Auth0 `audience`. With storage, overrides persist/reuse on omission; successful
|
|
|
69
69
|
`PendingWebFlowStore`: `put(flow)` and atomic `consume(state)`, e.g. PostgreSQL
|
|
70
70
|
`DELETE ... WHERE state = $1 AND expires_at > now() RETURNING payload`, or Redis
|
|
71
71
|
`SET pending:flow:<state> <payload> EX 600 NX` then `GETDEL`. SELECT/DELETE races
|
|
72
|
-
permit replay.
|
|
72
|
+
permit replay. Check your store with `assertPendingWebFlowStoreRoundTrip` (below).
|
|
73
73
|
`DEFAULT_WEB_FLOW_TTL_MS` is 10 minutes; shorten as needed. `InMemoryPendingFlowStore` is
|
|
74
74
|
test/dev-only; restarts lose flows. Encrypt PKCE verifiers at rest across trust boundaries.
|
|
75
75
|
|
|
76
|
+
Use `serializePendingWebFlow` and `parsePendingWebFlow` from `@adcp/sdk/auth`
|
|
77
|
+
for the stored payload. The parser validates SDK-owned fields, revives `createdAt`
|
|
78
|
+
and `expiresAt` as `Date` values, and returns `null` for malformed input. It accepts
|
|
79
|
+
JSON strings and decoded JSON values such as `pg`'s `jsonb` payloads. It preserves
|
|
80
|
+
unknown fields and all client metadata, including `issuer` and `client_secret`.
|
|
81
|
+
Do not narrow the persisted shape to today's fields: a hand-written schema that
|
|
82
|
+
strips new optional fields can type-check while breaking sign-in after an SDK upgrade.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { parsePendingWebFlow, serializePendingWebFlow } from '@adcp/sdk/auth';
|
|
86
|
+
import { assertPendingWebFlowStoreRoundTrip } from '@adcp/sdk/testing';
|
|
87
|
+
|
|
88
|
+
// In put(flow), serialize before encrypting and inserting with duplicate rejection:
|
|
89
|
+
const payload = serializePendingWebFlow(flow);
|
|
90
|
+
|
|
91
|
+
// In consume(state), decrypt the payload returned by atomic get-and-delete:
|
|
92
|
+
function restoreConsumedFlow(state: string, decryptedPayload: unknown) {
|
|
93
|
+
const restored = parsePendingWebFlow(decryptedPayload);
|
|
94
|
+
return restored && restored.state === state && restored.expiresAt.getTime() > Date.now()
|
|
95
|
+
? restored
|
|
96
|
+
: null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// In CI, use a disposable instance of your production store on each SDK upgrade:
|
|
100
|
+
await assertPendingWebFlowStoreRoundTrip(pendingFlowStore);
|
|
101
|
+
// Stores with application-owned constraints can supply valid fixture values:
|
|
102
|
+
await assertPendingWebFlowStoreRoundTrip(pendingFlowStore, {
|
|
103
|
+
agentId: testAgentId,
|
|
104
|
+
carry: { user_id: testUserId, nested: { values: ['one', 2, null] } },
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The helper checks every current SDK field (including nested `carry` and issuer-bound
|
|
109
|
+
client secrets), Date revival, missing states, single use, expired rows, duplicate
|
|
110
|
+
rejection, and concurrent consume. It also checks null/absent snapshots, clear actions,
|
|
111
|
+
public clients, registration metadata, and unknown extensions. Stores may reject
|
|
112
|
+
already-expired inserts; the helper still checks that consumption returns `null`.
|
|
113
|
+
Its fixture is exhaustive at SDK build time, including optional flow and client
|
|
114
|
+
information fields. The concurrency check is a smoke test; the backend must
|
|
115
|
+
provide atomic deletion across processes. Use JSON-serializable `carry` and validate
|
|
116
|
+
its application-owned contents separately. Keep absent optional fields absent when
|
|
117
|
+
hydrating rows; an undefined-valued own `resourceOverrideSnapshot` can trigger the
|
|
118
|
+
callback's concurrent-edit guard. The store still owns encryption of PKCE
|
|
119
|
+
and client secrets, TTL, duplicate rejection, atomic consume, and binding the payload's
|
|
120
|
+
`state` to its storage key. The parser does not filter expired flows or establish
|
|
121
|
+
issuer trust; `completeWebOAuthFlow` also enforces expiry and issuer binding.
|
|
122
|
+
|
|
76
123
|
Optional `agentStorage` (`OAuthConfigStorage`): callback loads the pending row's
|
|
77
124
|
agent ID. Without it, completion
|
|
78
125
|
returns `persisted: false` for application persistence. Preserve the issuer guide's
|
package/docs/llms.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Ad Context Protocol (AdCP)
|
|
2
2
|
|
|
3
3
|
> Generated at: 2026-10-09
|
|
4
|
-
> Library: @adcp/sdk v15.
|
|
4
|
+
> Library: @adcp/sdk v15.6.0
|
|
5
5
|
> AdCP major version: 3
|
|
6
6
|
> Canonical URL: https://adcontextprotocol.github.io/adcp-client/llms.txt
|
|
7
7
|
> Note: the `Library` stamp reflects the package.json version at doc-generation time. The narrative below describes the surface that lands on the next-published minor — including any 6.7 helpers documented here ahead of the release tag.
|
|
@@ -11,8 +11,8 @@ below as the publication/deployment gate.
|
|
|
11
11
|
|
|
12
12
|
| Fact | Value |
|
|
13
13
|
| --- | --- |
|
|
14
|
-
| Exact npm package | `@adcp/sdk@15.
|
|
15
|
-
| npm integrity | registry-derived after publication; run `npm view @adcp/sdk@15.
|
|
14
|
+
| Exact npm package | `@adcp/sdk@15.6.0` |
|
|
15
|
+
| npm integrity | registry-derived after publication; run `npm view @adcp/sdk@15.6.0 dist.integrity` |
|
|
16
16
|
| Node.js runtime | `^20.19.0 || >=22.12.0` |
|
|
17
17
|
| Default AdCP wire release | `3.2.3` |
|
|
18
18
|
| Maintained wire releases | `v2.5`, `v2.6`, `v3`, `3.0.0`, `3.0`, `3.0.1`, `3.0.2`, `3.0.3`, `3.0.4`, `3.0.5`, `3.0.6`, `3.0.7`, `3.0.8`, `3.0.9`, `3.0.10`, `3.0.11`, `3.0.12`, `3.0.13`, `3.0.14`, `3.0.15`, `3.0.16`, `3.0.17`, `3.0.18`, `3.0.19`, `3.0.20`, `3.0.21`, `3.0.22`, `3.0.23`, `3.0.24`, `3.0.25`, `3.1.0`, `3.1`, `3.1.1`, `3.1.2`, `3.1.3`, `3.1.4`, `3.1.5`, `3.1.6`, `3.1.7`, `3.1.8`, `3.1.9`, `3.1.10`, `3.1.11`, `3.1.12`, `3.1.13`, `3.1.14`, `3.1.15`, `3.1.16`, `3.1.17`, `3.1.18`, `3.1.19`, `3.1.20`, `3.1.21`, `3.1.22`, `3.1.23`, `3.1.24`, `3.2.1`, `3.2`, `3.2.2`, `3.2.3` |
|
|
@@ -21,8 +21,8 @@ below as the publication/deployment gate.
|
|
|
21
21
|
Install exact production inputs rather than a moving range or dist-tag:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npm install --save-exact '@adcp/sdk@15.
|
|
25
|
-
npm view '@adcp/sdk@15.
|
|
24
|
+
npm install --save-exact '@adcp/sdk@15.6.0'
|
|
25
|
+
npm view '@adcp/sdk@15.6.0' dist.integrity
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### Required and optional peers
|
|
@@ -32,6 +32,8 @@ Install the peer packages used by your application at versions satisfying these
|
|
|
32
32
|
| Peer | Supported range | Installation |
|
|
33
33
|
| --- | --- | --- |
|
|
34
34
|
| `@a2a-js/sdk` | `^1.0.1` | Required |
|
|
35
|
+
| `@aws-sdk/client-s3` | `^3.700.0` | Optional |
|
|
36
|
+
| `@azure/storage-blob` | `^12.23.0` | Optional |
|
|
35
37
|
| `@google-cloud/storage` | `^7.22.0 || ^8.2.0` | Optional |
|
|
36
38
|
| `@modelcontextprotocol/sdk` | `^1.31.0` | Required |
|
|
37
39
|
| `@opentelemetry/api` | `^1.0.0` | Optional |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adcp/sdk",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.6.0",
|
|
4
4
|
"description": "AdCP SDK — client, server, and compliance harnesses for the AdContext Protocol (MCP + A2A)",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -284,6 +284,16 @@
|
|
|
284
284
|
"default": "./dist/lib/schemas/index.js"
|
|
285
285
|
}
|
|
286
286
|
},
|
|
287
|
+
"./schemas/browser": {
|
|
288
|
+
"import": {
|
|
289
|
+
"types": "./dist/lib/schemas/browser.d.mts",
|
|
290
|
+
"default": "./dist/lib/schemas/browser.mjs"
|
|
291
|
+
},
|
|
292
|
+
"require": {
|
|
293
|
+
"types": "./dist/lib/schemas/browser.d.ts",
|
|
294
|
+
"default": "./dist/lib/schemas/browser.js"
|
|
295
|
+
}
|
|
296
|
+
},
|
|
287
297
|
"./compliance-fixtures": {
|
|
288
298
|
"import": {
|
|
289
299
|
"types": "./dist/lib/compliance-fixtures/index.d.mts",
|
|
@@ -419,6 +429,36 @@
|
|
|
419
429
|
"types": "./dist/lib/reporting/gcs/index.d.ts",
|
|
420
430
|
"default": "./dist/lib/reporting/gcs/index.js"
|
|
421
431
|
}
|
|
432
|
+
},
|
|
433
|
+
"./reporting/s3": {
|
|
434
|
+
"import": {
|
|
435
|
+
"types": "./dist/lib/reporting/s3/index.d.mts",
|
|
436
|
+
"default": "./dist/lib/reporting/s3/index.mjs"
|
|
437
|
+
},
|
|
438
|
+
"require": {
|
|
439
|
+
"types": "./dist/lib/reporting/s3/index.d.ts",
|
|
440
|
+
"default": "./dist/lib/reporting/s3/index.js"
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
"./reporting/azure": {
|
|
444
|
+
"import": {
|
|
445
|
+
"types": "./dist/lib/reporting/azure/index.d.mts",
|
|
446
|
+
"default": "./dist/lib/reporting/azure/index.mjs"
|
|
447
|
+
},
|
|
448
|
+
"require": {
|
|
449
|
+
"types": "./dist/lib/reporting/azure/index.d.ts",
|
|
450
|
+
"default": "./dist/lib/reporting/azure/index.js"
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
"./reporting/bigquery": {
|
|
454
|
+
"import": {
|
|
455
|
+
"types": "./dist/lib/reporting/bigquery/index.d.mts",
|
|
456
|
+
"default": "./dist/lib/reporting/bigquery/index.mjs"
|
|
457
|
+
},
|
|
458
|
+
"require": {
|
|
459
|
+
"types": "./dist/lib/reporting/bigquery/index.d.ts",
|
|
460
|
+
"default": "./dist/lib/reporting/bigquery/index.js"
|
|
461
|
+
}
|
|
422
462
|
}
|
|
423
463
|
},
|
|
424
464
|
"typesVersions": {
|
|
@@ -489,6 +529,9 @@
|
|
|
489
529
|
"schemas": [
|
|
490
530
|
"dist/lib/schemas/index.d.ts"
|
|
491
531
|
],
|
|
532
|
+
"schemas/browser": [
|
|
533
|
+
"dist/lib/schemas/browser.d.ts"
|
|
534
|
+
],
|
|
492
535
|
"compliance-fixtures": [
|
|
493
536
|
"dist/lib/compliance-fixtures/index.d.ts"
|
|
494
537
|
],
|
|
@@ -542,6 +585,15 @@
|
|
|
542
585
|
],
|
|
543
586
|
"reporting/gcs": [
|
|
544
587
|
"dist/lib/reporting/gcs/index.d.ts"
|
|
588
|
+
],
|
|
589
|
+
"reporting/s3": [
|
|
590
|
+
"dist/lib/reporting/s3/index.d.ts"
|
|
591
|
+
],
|
|
592
|
+
"reporting/azure": [
|
|
593
|
+
"dist/lib/reporting/azure/index.d.ts"
|
|
594
|
+
],
|
|
595
|
+
"reporting/bigquery": [
|
|
596
|
+
"dist/lib/reporting/bigquery/index.d.ts"
|
|
545
597
|
]
|
|
546
598
|
}
|
|
547
599
|
},
|
|
@@ -684,6 +736,7 @@
|
|
|
684
736
|
"ci:validate": "node scripts/ci-validate.js",
|
|
685
737
|
"ci:quick": "npm run format:check && npm run typecheck && npm run build:lib && npm test",
|
|
686
738
|
"test:zod-openapi-portability": "node --test test/lib/zod-openapi-portability.test.js",
|
|
739
|
+
"test:schemas-browser": "node --test-timeout=60000 --test test/lib/schemas-browser.test.js",
|
|
687
740
|
"ci:schema-check": "npm run sync-schemas && npm run generate-types && npm run generate-registry-types -- --sync && git diff --exit-code -I '// Generated at:' src/lib/types/ src/lib/agents/ src/lib/media-buy/action-metadata.generated.ts src/lib/media-buy/update-fields.generated.ts src/lib/registry/types.generated.ts schemas/registry/registry.yaml || (echo '⚠️ Generated files are out of sync. Run: npm run sync-schemas && npm run generate-types && npm run generate-registry-types -- --sync' && exit 1)",
|
|
688
741
|
"ci:codegen-strict": "tsx scripts/check-no-loose-oneof.ts",
|
|
689
742
|
"ci:docs-check": "npm run generate-agent-docs && npm run generate-release-worksheet && git diff --exit-code -I '> Generated at:' docs/llms.txt docs/TYPE-SUMMARY.md docs/migration-14.x-rc-worksheet.md || (echo '⚠️ Generated docs are out of sync. Run: npm run generate-agent-docs && npm run generate-release-worksheet' && exit 1)",
|
|
@@ -746,6 +799,8 @@
|
|
|
746
799
|
},
|
|
747
800
|
"peerDependencies": {
|
|
748
801
|
"@a2a-js/sdk": "^1.0.1",
|
|
802
|
+
"@aws-sdk/client-s3": "^3.700.0",
|
|
803
|
+
"@azure/storage-blob": "^12.23.0",
|
|
749
804
|
"@google-cloud/storage": "^7.22.0 || ^8.2.0",
|
|
750
805
|
"@modelcontextprotocol/sdk": "^1.31.0",
|
|
751
806
|
"@opentelemetry/api": "^1.0.0",
|
|
@@ -753,6 +808,12 @@
|
|
|
753
808
|
"zod": "^4.1.5"
|
|
754
809
|
},
|
|
755
810
|
"peerDependenciesMeta": {
|
|
811
|
+
"@aws-sdk/client-s3": {
|
|
812
|
+
"optional": true
|
|
813
|
+
},
|
|
814
|
+
"@azure/storage-blob": {
|
|
815
|
+
"optional": true
|
|
816
|
+
},
|
|
756
817
|
"@google-cloud/storage": {
|
|
757
818
|
"optional": true
|
|
758
819
|
},
|
|
@@ -767,6 +828,8 @@
|
|
|
767
828
|
"@a2a-js/sdk": "^1.0.1",
|
|
768
829
|
"@apidevtools/json-schema-ref-parser": "^15.5.2",
|
|
769
830
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
831
|
+
"@aws-sdk/client-s3": "^3.1147.0",
|
|
832
|
+
"@azure/storage-blob": "~12.32.0",
|
|
770
833
|
"@changesets/cli": "^3.0.3",
|
|
771
834
|
"@commitlint/cli": "^20.5.3",
|
|
772
835
|
"@commitlint/config-conventional": "^20.5.3",
|