@cookiemunch/sdk 0.10.0 → 0.11.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/dist/index.d.ts CHANGED
@@ -20,7 +20,7 @@ import type { ConformanceReport } from './executor-conformance.js';
20
20
  * This package's version, sent in the default User-Agent. Cloudflare answers a request with
21
21
  * no recognisable User-Agent with `403 error code: 1010`; a test pins this to package.json.
22
22
  */
23
- export declare const SDK_VERSION = "0.10.0";
23
+ export declare const SDK_VERSION = "0.11.0";
24
24
  export interface CookieMunchOptions {
25
25
  apiKey: string;
26
26
  /** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
@@ -1167,6 +1167,24 @@ export interface ApiKeyPrefix {
1167
1167
  /** The dated API version this key is pinned to. */
1168
1168
  apiVersion?: string;
1169
1169
  }
1170
+ /** A signed audit-anchor receipt (POST /v1/anchors). Verify `signature` (Ed25519, base64url) over the canonical JSON of every other field with the key `keyId` in /v1/partner/jwks.json. */
1171
+ export interface AnchorReceipt {
1172
+ id: string;
1173
+ org: string;
1174
+ stream: string;
1175
+ head: string;
1176
+ seq: number;
1177
+ receivedAt: string;
1178
+ keyId: string;
1179
+ alg: 'EdDSA';
1180
+ signature: string;
1181
+ }
1182
+ /** GET /v1/anchors/{stream}: newest first; pass `nextBefore` as `before` until it is null. */
1183
+ export interface AnchorList {
1184
+ stream: string;
1185
+ anchors: AnchorReceipt[];
1186
+ nextBefore: number | null;
1187
+ }
1170
1188
  /** A live organisation's sandbox (GET /v1/sandbox). */
1171
1189
  export interface SandboxOrg {
1172
1190
  orgId: string;
@@ -2189,6 +2207,8 @@ export interface ExecutorHealth {
2189
2207
  code?: string;
2190
2208
  /** When a check last passed. */
2191
2209
  lastSuccessAt?: number;
2210
+ /** The `X-Version` the system last answered with. */
2211
+ version?: string;
2192
2212
  /** On reads: true when the last check is more than an hour old, with the command that re-checks it in `hint`. */
2193
2213
  stale?: boolean;
2194
2214
  hint?: string;
@@ -2779,7 +2799,7 @@ export interface CookieMunchClient {
2779
2799
  dryRun: true;
2780
2800
  }): Promise<DeclarationDryRun>;
2781
2801
  /**
2782
- * Declare many at once (all-or-nothing). `replace` also removes declarations not listed;
2802
+ * Declare many at once (all-or-nothing). `replace` also removes your own declarations not listed (vendor-preset rows stay);
2783
2803
  * `dryRun` answers with what would be stored and a diff, storing nothing.
2784
2804
  */
2785
2805
  declareCookies(cbid: string, cookies: Array<DeclaredCookieInput & {
@@ -2866,8 +2886,17 @@ export interface CookieMunchClient {
2866
2886
  * wrapped as `{ request }`, so `create(...).request.id` is what you pass here.
2867
2887
  */
2868
2888
  get(id: string): Promise<DsarRequest>;
2889
+ /** `skipped`: connections scoped to another property (or to one, when the request names none), never planned for it. */
2869
2890
  create(input: DsarCreate & ResourceTagsInput): Promise<{
2870
2891
  request: DsarRequest;
2892
+ consent?: {
2893
+ count: number;
2894
+ sites: string[];
2895
+ };
2896
+ skipped?: Array<{
2897
+ system: string;
2898
+ reason: string;
2899
+ }>;
2871
2900
  }>;
2872
2901
  /** `opts.messageToSubject` replaces the line the subject reads in the notice — for a rejection, why. */
2873
2902
  advance(id: string, toStatus: DsarStatus, opts?: {
@@ -3334,6 +3363,26 @@ export interface CookieMunchClient {
3334
3363
  versions(): Promise<ApiVersions>;
3335
3364
  /** What the org may use: every plan feature (`whiteLabel`, `tcf`, …) and limit, in the suite-standard shape. Any key may read it. */
3336
3365
  entitlements(): Promise<Entitlements>;
3366
+ /**
3367
+ * Audit anchoring: post the head of your own hash-chained log and get a receipt signed by Cookie Munch's
3368
+ * platform key. `seq` must strictly increase per stream; the same seq and head again returns the original
3369
+ * receipt, a different head for an anchored seq is a 409 (`anchor_head_mismatch`). Needs `anchors:write` / `anchors:read`.
3370
+ */
3371
+ anchors: {
3372
+ /** Anchor `head` at `seq` on `stream` (POST /v1/anchors). */
3373
+ create(input: {
3374
+ stream: string;
3375
+ head: string;
3376
+ seq: number;
3377
+ }): Promise<AnchorReceipt>;
3378
+ /** A stream's receipts, newest first (GET /v1/anchors/{stream}). */
3379
+ list(stream: string, query?: {
3380
+ limit?: number;
3381
+ before?: number;
3382
+ }): Promise<AnchorList>;
3383
+ /** One receipt (GET /v1/anchors/{stream}/{id}). */
3384
+ get(stream: string, id: string): Promise<AnchorReceipt>;
3385
+ };
3337
3386
  /**
3338
3387
  * The organisation's sandbox: a separate test organisation with the same people and plan features, never billed.
3339
3388
  * Its keys are test-format keys and its rights requests are all tests. `create` and `delete` need an unscoped key or `orgs:create`.
package/dist/index.js CHANGED
@@ -88,7 +88,7 @@ async function exchangeOperatorToken(input) {
88
88
  }
89
89
 
90
90
  // src/index.ts
91
- var SDK_VERSION = "0.10.0";
91
+ var SDK_VERSION = "0.11.0";
92
92
  var CookieMunchApiError = class extends Error {
93
93
  constructor(status, message, code, body) {
94
94
  super(message);
@@ -477,6 +477,11 @@ function createCookieMunch(opts) {
477
477
  usage: () => get("/usage"),
478
478
  entitlements: () => get("/entitlements"),
479
479
  versions: () => get("/versions"),
480
+ anchors: {
481
+ create: (input) => request("POST", "/anchors", input),
482
+ list: (stream, query) => get(`/anchors/${enc(stream)}${qs(query)}`),
483
+ get: (stream, id) => get(`/anchors/${enc(stream)}/${enc(id)}`)
484
+ },
480
485
  sandbox: {
481
486
  get: async () => (await get("/sandbox")).sandbox,
482
487
  create: (input) => request("POST", "/sandbox", input ?? {}),