@cookiemunch/sdk 0.13.0 → 0.13.2
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/CHANGELOG.md +10 -0
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +28 -5
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/package.json +1 -1
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.13.
|
|
23
|
+
export declare const SDK_VERSION = "0.13.2";
|
|
24
24
|
export interface CookieMunchOptions {
|
|
25
25
|
apiKey: string;
|
|
26
26
|
/** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
|
|
@@ -774,6 +774,18 @@ export interface DsarCreateDryRun {
|
|
|
774
774
|
purpose: string;
|
|
775
775
|
}>;
|
|
776
776
|
effect?: string;
|
|
777
|
+
/** `{ preview: true }` only: what the system's `profile.preview` reported for the subject (reads only). */
|
|
778
|
+
preview?: {
|
|
779
|
+
ok: true;
|
|
780
|
+
records: Array<{
|
|
781
|
+
type: string;
|
|
782
|
+
count: number;
|
|
783
|
+
}>;
|
|
784
|
+
raw?: string;
|
|
785
|
+
} | {
|
|
786
|
+
ok: false;
|
|
787
|
+
reason: string;
|
|
788
|
+
};
|
|
777
789
|
}>;
|
|
778
790
|
skipped: Array<{
|
|
779
791
|
system: string;
|
|
@@ -1248,6 +1260,8 @@ export interface ApiKeyPrefix {
|
|
|
1248
1260
|
strictUnknownFields?: boolean;
|
|
1249
1261
|
/** The dated API version this key is pinned to. */
|
|
1250
1262
|
apiVersion?: string;
|
|
1263
|
+
/** A bound child key's parent (the scoped key that minted it): it works only while that key does. null = independent. */
|
|
1264
|
+
parentPrefix?: string | null;
|
|
1251
1265
|
}
|
|
1252
1266
|
/** 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. */
|
|
1253
1267
|
export interface AnchorReceipt {
|
|
@@ -1340,6 +1354,8 @@ export interface ApiKeyIssued {
|
|
|
1340
1354
|
expiresAt?: number | null;
|
|
1341
1355
|
scopes?: string[] | null;
|
|
1342
1356
|
cbids?: string[] | null;
|
|
1357
|
+
/** Minted by a scoped key: the key it is bound to (it stops working when that key is revoked, rolled or expires). null = independent. */
|
|
1358
|
+
parentPrefix?: string | null;
|
|
1343
1359
|
/** No expiry, or one over 365 days. */
|
|
1344
1360
|
warnings?: string[];
|
|
1345
1361
|
/** With `secretRecipient`: the key, sealed (and `key` absent). */
|
|
@@ -2263,6 +2279,8 @@ export interface DsarExecutor {
|
|
|
2263
2279
|
completionsUrl?: string;
|
|
2264
2280
|
/** True: its erasures wait (status `awaiting_approval`) for `approveTask` or `rejectTask`. */
|
|
2265
2281
|
requireApproval?: boolean;
|
|
2282
|
+
/** Made with `verify: 'defer'` and no probe has passed yet: not planned into requests, not alerted on. Absent: active. */
|
|
2283
|
+
state?: 'awaiting_first_probe';
|
|
2266
2284
|
/** On create only: the completion secret, shown this once. */
|
|
2267
2285
|
completionSecret?: string;
|
|
2268
2286
|
}
|
|
@@ -2995,10 +3013,12 @@ export interface CookieMunchClient {
|
|
|
2995
3013
|
/**
|
|
2996
3014
|
* `skipped`: connections scoped to another property (or to one, when the request names none), never planned for it.
|
|
2997
3015
|
* `{ dryRun: true }` files nothing and contacts no connected system: it answers which connections the request would
|
|
2998
|
-
* reach once verified (`plan`) and which it would skip.
|
|
3016
|
+
* reach once verified (`plan`) and which it would skip. Add `preview: true` to also ask each planned system its
|
|
3017
|
+
* lookup and `profile.preview` for the subject (reads only, nothing filed): `plan[].preview`.
|
|
2999
3018
|
*/
|
|
3000
3019
|
create(input: DsarCreate & ResourceTagsInput, opts: {
|
|
3001
3020
|
dryRun: true;
|
|
3021
|
+
preview?: boolean;
|
|
3002
3022
|
}): Promise<DsarCreateDryRun>;
|
|
3003
3023
|
create(input: DsarCreate & ResourceTagsInput, opts?: {
|
|
3004
3024
|
dryRun?: false;
|
|
@@ -3321,10 +3341,11 @@ export interface CookieMunchClient {
|
|
|
3321
3341
|
connectExecutor(input: (DsarExecutorInput | DsarExecutorPresetInput) & ResourceTagsInput,
|
|
3322
3342
|
/**
|
|
3323
3343
|
* `verify: true` probes it first (a canary locate; no erasure is sent) and refuses a failing one
|
|
3324
|
-
* (422 `verify_failed`, nothing stored); `'warn'` stores it with the verdict in `warnings`.
|
|
3344
|
+
* (422 `verify_failed`, nothing stored); `'warn'` stores it with the verdict in `warnings`. `'defer'` (its API
|
|
3345
|
+
* is not deployed yet) probes nothing and stores it as `state: 'awaiting_first_probe'` until a probe passes.
|
|
3325
3346
|
*/
|
|
3326
3347
|
opts?: {
|
|
3327
|
-
verify?: true | 'warn';
|
|
3348
|
+
verify?: true | 'warn' | 'defer';
|
|
3328
3349
|
}): Promise<DsarExecutorCreated>;
|
|
3329
3350
|
/**
|
|
3330
3351
|
* Change a connection in place. Only what you send changes, and the stored credential
|
|
@@ -3337,7 +3358,9 @@ export interface CookieMunchClient {
|
|
|
3337
3358
|
* Re-running it changes nothing; a changed create-only field (system, preset, presetVersion, preset params,
|
|
3338
3359
|
* mintFrom, externalId) is `409 immutable_field` with every such field in `fields`.
|
|
3339
3360
|
*/
|
|
3340
|
-
upsertExecutor(input: DsarExecutorInput | DsarExecutorPresetInput | Record<string, unknown
|
|
3361
|
+
upsertExecutor(input: DsarExecutorInput | DsarExecutorPresetInput | Record<string, unknown>, opts?: {
|
|
3362
|
+
verify?: true | 'warn' | 'defer';
|
|
3363
|
+
}): Promise<DsarExecutor & {
|
|
3341
3364
|
upserted: 'created' | 'updated';
|
|
3342
3365
|
}>;
|
|
3343
3366
|
/** What `connectExecutor` would create, validated in full; nothing is stored (`?dryRun=1`). */
|
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.13.
|
|
91
|
+
var SDK_VERSION = "0.13.2";
|
|
92
92
|
var CookieMunchApiError = class extends Error {
|
|
93
93
|
constructor(status, message, code, body) {
|
|
94
94
|
super(message);
|
|
@@ -302,7 +302,7 @@ function createCookieMunch(opts) {
|
|
|
302
302
|
dsar: {
|
|
303
303
|
list: () => get("/dsar"),
|
|
304
304
|
get: (id) => get(`/dsar/${enc(id)}`),
|
|
305
|
-
create: ((input, o) => request("POST", `/dsar${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input)),
|
|
305
|
+
create: ((input, o) => request("POST", `/dsar${qs({ dryRun: o?.dryRun ? "1" : void 0, preview: o?.preview ? "1" : void 0 })}`, input)),
|
|
306
306
|
advance: (id, toStatus, opts2) => request("POST", `/dsar/${enc(id)}/advance`, { toStatus, ...opts2?.messageToSubject !== void 0 ? { messageToSubject: opts2.messageToSubject } : {} }),
|
|
307
307
|
response: (id) => request("GET", `/dsar/${enc(id)}/response`, void 0, true),
|
|
308
308
|
erase: (id, cbid, stamp) => request("POST", `/dsar/${enc(id)}/erase`, { cbid, stamp }),
|
|
@@ -426,9 +426,9 @@ function createCookieMunch(opts) {
|
|
|
426
426
|
reportTask: (taskId, ok, error) => request("POST", `/dsar/agent/tasks/${enc(taskId)}/result`, { ok, ...error !== void 0 ? { error } : {} }),
|
|
427
427
|
executors: (o) => get(`/dsar/executors${metaQs(o)}`),
|
|
428
428
|
executor: (id) => get(`/dsar/executors/${enc(id)}`),
|
|
429
|
-
connectExecutor: (input, o) => request("POST", `/dsar/executors${qs({ verify: o?.verify
|
|
429
|
+
connectExecutor: (input, o) => request("POST", `/dsar/executors${qs({ verify: o?.verify === true ? "1" : o?.verify })}`, input),
|
|
430
430
|
updateExecutor: (id, patch) => request("PATCH", `/dsar/executors/${enc(id)}`, patch),
|
|
431
|
-
upsertExecutor: (input) => request("PUT",
|
|
431
|
+
upsertExecutor: (input, o) => request("PUT", `/dsar/executors${qs({ verify: o?.verify === true ? "1" : o?.verify })}`, input),
|
|
432
432
|
dryRunConnectExecutor: (input) => request("POST", "/dsar/executors?dryRun=1", input),
|
|
433
433
|
executorPresets: () => get("/dsar/executors/presets"),
|
|
434
434
|
upgradeExecutorPreset: (id, input = {}) => request("POST", `/dsar/executors/${enc(id)}/upgrade-preset`, input),
|