@cookiemunch/sdk 0.14.2 → 0.15.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/CHANGELOG.md +6 -0
- package/README.md +6 -0
- package/dist/embed.cjs +62 -0
- package/dist/embed.cjs.map +1 -0
- package/dist/embed.d.ts +88 -0
- package/dist/embed.js +34 -0
- package/dist/embed.js.map +1 -0
- package/dist/index.cjs +9 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +35 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/rights.cjs +105 -5
- package/dist/rights.cjs.map +1 -1
- package/dist/rights.d.ts +53 -4
- package/dist/rights.js +89 -4
- package/dist/rights.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/package.json +10 -11
- package/LICENSE +0 -21
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.
|
|
23
|
+
export declare const SDK_VERSION = "0.15.0";
|
|
24
24
|
export interface CookieMunchOptions {
|
|
25
25
|
apiKey: string;
|
|
26
26
|
/** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
|
|
@@ -587,10 +587,16 @@ export interface CookiePresetResult {
|
|
|
587
587
|
reason: string;
|
|
588
588
|
}>;
|
|
589
589
|
note?: string;
|
|
590
|
-
/**
|
|
590
|
+
/**
|
|
591
|
+
* Rows filed under a category this site has switched off (`cookies[<name>].category`); `preset_incomplete`
|
|
592
|
+
* (observed `names` under the vendor's prefixes the preset does not declare); `lifetime_default` (a referral
|
|
593
|
+
* preset's default lifetime: send `cookieDays`, or Referalli `programHandle`/`orgToken`).
|
|
594
|
+
*/
|
|
591
595
|
warnings?: Array<{
|
|
592
596
|
field: string;
|
|
593
597
|
reason: string;
|
|
598
|
+
code?: string;
|
|
599
|
+
names?: string[];
|
|
594
600
|
}>;
|
|
595
601
|
/** With `warnings`: a body for `sites.patchConfig` that fixes them; apply the preset again after. */
|
|
596
602
|
suggestedConfigPatch?: Record<string, unknown>;
|
|
@@ -2143,6 +2149,12 @@ export interface PolicyOptions {
|
|
|
2143
2149
|
effectiveDate?: string;
|
|
2144
2150
|
/** Override the jurisdictions the policy addresses. */
|
|
2145
2151
|
jurisdictions?: string[];
|
|
2152
|
+
/** `cookies`: only the cookie table section (needs no contact email). */
|
|
2153
|
+
fragment?: 'cookies';
|
|
2154
|
+
/** With `fragment: 'cookies'`: Markdown (default) or escaped HTML tables. */
|
|
2155
|
+
format?: 'markdown' | 'html';
|
|
2156
|
+
/** The text's language; the policy is written in English only (`en`). */
|
|
2157
|
+
lang?: string;
|
|
2146
2158
|
}
|
|
2147
2159
|
export interface AdPersonalizationInput {
|
|
2148
2160
|
enabled: boolean;
|
|
@@ -2309,6 +2321,12 @@ export interface DsarExecutor {
|
|
|
2309
2321
|
requireApproval?: boolean;
|
|
2310
2322
|
/** Made with `verify: 'defer'` and no probe has passed yet: not planned into requests, not alerted on. Absent: active. */
|
|
2311
2323
|
state?: 'awaiting_first_probe';
|
|
2324
|
+
/** The last conformance run (`testExecutor` with `conformance: true`): rule counts and when (epoch ms). Null until one runs. */
|
|
2325
|
+
lastConformance?: {
|
|
2326
|
+
passed: number;
|
|
2327
|
+
failed: number;
|
|
2328
|
+
at: number;
|
|
2329
|
+
} | null;
|
|
2312
2330
|
/** On create only: the completion secret, shown this once. */
|
|
2313
2331
|
completionSecret?: string;
|
|
2314
2332
|
}
|
|
@@ -2410,6 +2428,8 @@ export interface ExecutorPresets {
|
|
|
2410
2428
|
title: string;
|
|
2411
2429
|
latestVersion: number;
|
|
2412
2430
|
defaultSystem?: string;
|
|
2431
|
+
/** Presets of one family (cm-standard) a connection may move between in place: `updateExecutor(id, { preset })`. */
|
|
2432
|
+
family?: string;
|
|
2413
2433
|
params: Array<{
|
|
2414
2434
|
name: string;
|
|
2415
2435
|
required: boolean;
|
|
@@ -2521,6 +2541,12 @@ export interface DsarExecutorPatch {
|
|
|
2521
2541
|
orchestrator?: 1 | 2;
|
|
2522
2542
|
/** Park its erasures for approval; false stops parking new ones (parked ones still wait). */
|
|
2523
2543
|
requireApproval?: boolean;
|
|
2544
|
+
/**
|
|
2545
|
+
* Another preset of the same family (cm-standard-v1 → cm-standard-v2) moves the connection in place, keeping its
|
|
2546
|
+
* id, credentials and history; any other preset change is 409 immutable_field.
|
|
2547
|
+
*/
|
|
2548
|
+
preset?: ExecutorPresetName;
|
|
2549
|
+
presetVersion?: number;
|
|
2524
2550
|
}
|
|
2525
2551
|
/** One entry in a fulfilment task's status history. */
|
|
2526
2552
|
export interface DsarTaskEvent {
|
|
@@ -2680,12 +2706,14 @@ export interface CookieMunchClient {
|
|
|
2680
2706
|
/**
|
|
2681
2707
|
* Create a sibling organisation owned by the same account — for a separate business of
|
|
2682
2708
|
* your own. Needs an unscoped key. Not reseller provisioning, which is for your customers.
|
|
2709
|
+
* `inheritFrom` copies another of the account's orgs' data controller and mail provider (unverified until tested).
|
|
2683
2710
|
*/
|
|
2684
2711
|
create(name: string, opts?: {
|
|
2685
2712
|
mintKey?: boolean;
|
|
2686
2713
|
keyScopes?: string[];
|
|
2687
2714
|
keyExpiresInDays?: number;
|
|
2688
2715
|
keyOwner?: string;
|
|
2716
|
+
inheritFrom?: string;
|
|
2689
2717
|
} & ResourceTagsInput): Promise<{
|
|
2690
2718
|
org: {
|
|
2691
2719
|
id: string;
|
|
@@ -2694,6 +2722,11 @@ export interface CookieMunchClient {
|
|
|
2694
2722
|
};
|
|
2695
2723
|
apiKey?: string;
|
|
2696
2724
|
keyError?: string;
|
|
2725
|
+
inherited?: {
|
|
2726
|
+
controller: boolean;
|
|
2727
|
+
mailProvider: boolean;
|
|
2728
|
+
};
|
|
2729
|
+
warnings?: string[];
|
|
2697
2730
|
}>;
|
|
2698
2731
|
/** Hard-delete a SANDBOX organisation of this account (created with metadata.stack_sandbox). Anything else: 403 not_a_sandbox. */
|
|
2699
2732
|
deleteSandbox(id: string): Promise<SandboxPurge>;
|
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.
|
|
91
|
+
var SDK_VERSION = "0.15.0";
|
|
92
92
|
var CookieMunchApiError = class extends Error {
|
|
93
93
|
constructor(status, message, code, body) {
|
|
94
94
|
super(message);
|
|
@@ -103,6 +103,12 @@ function metaQs(o) {
|
|
|
103
103
|
const parts = Object.entries(o?.metadata ?? {}).map(([k, v]) => `metadata%5B${encodeURIComponent(k)}%5D=${encodeURIComponent(v)}`);
|
|
104
104
|
return parts.length ? `?${parts.join("&")}` : "";
|
|
105
105
|
}
|
|
106
|
+
function unwrapList(version, body) {
|
|
107
|
+
if (!version || version < "2026-11-03" || !body || typeof body !== "object" || Array.isArray(body)) return body;
|
|
108
|
+
const o = body;
|
|
109
|
+
const keys = Object.keys(o);
|
|
110
|
+
return Array.isArray(o.data) && keys.every((k) => k === "data" || k === "next") ? o.data : body;
|
|
111
|
+
}
|
|
106
112
|
function qs(query) {
|
|
107
113
|
if (!query) return "";
|
|
108
114
|
const parts = [];
|
|
@@ -146,7 +152,7 @@ function createCookieMunch(opts) {
|
|
|
146
152
|
if (res.status === 204) return void 0;
|
|
147
153
|
if (raw) return res.text();
|
|
148
154
|
const contentType = res.headers.get("content-type") ?? "";
|
|
149
|
-
return contentType.includes("application/json") ? res.json() : res.text();
|
|
155
|
+
return contentType.includes("application/json") ? unwrapList(res.headers.get("cookiemunch-version"), await res.json()) : res.text();
|
|
150
156
|
}
|
|
151
157
|
const get = (p) => request("GET", p);
|
|
152
158
|
async function requestBytes(path) {
|
|
@@ -222,7 +228,7 @@ function createCookieMunch(opts) {
|
|
|
222
228
|
ab: (cbid) => get(`/sites/${enc(cbid)}/ab`),
|
|
223
229
|
policy: (cbid, o) => request(
|
|
224
230
|
"GET",
|
|
225
|
-
`/sites/${enc(cbid)}/policy${qs({ contactEmail: o?.contactEmail, effectiveDate: o?.effectiveDate, jurisdictions: o?.jurisdictions?.join(",") })}`,
|
|
231
|
+
`/sites/${enc(cbid)}/policy${qs({ contactEmail: o?.contactEmail, effectiveDate: o?.effectiveDate, jurisdictions: o?.jurisdictions?.join(","), fragment: o?.fragment, format: o?.format, lang: o?.lang })}`,
|
|
226
232
|
void 0,
|
|
227
233
|
true
|
|
228
234
|
),
|