@cookiemunch/sdk 0.11.0 → 0.12.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/CHANGELOG.md +10 -0
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +121 -8
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +78 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,13 +14,13 @@ export * from './consent-sync.js';
|
|
|
14
14
|
export * from './executor-conformance.js';
|
|
15
15
|
export * from './token-exchange.js';
|
|
16
16
|
export type * from './fd-consent.js';
|
|
17
|
-
import type { CategoryRegistry, Identity, AccountOrgs, Site, SiteCreate, SiteConfig, SiteUpdate, SiteUpdateResult, IntegrationHealthReport, HealthWaiver, HealthWaiverInput, ProvisionRequest, ProvisionResult, PartnerLink, PartnerLinkCreate, PartnerCatalogEntry, ConsentDay, ConsentLogRow, RangeQuery, LogQuery, DsarRequest, DsarCreate, DsarCase, DsarCaseCreate, DsarCaseReceipt, DsarSettings, SubjectCard, IntegrationConnect, IntegrationConnectResult, DsarStatus, ScoredVendor, VendorInput, VendorRecord, RiskScore, RopaEntry, RopaInput, SignedReceipt, PreferenceRecord } from './types.js';
|
|
17
|
+
import type { CategoryRegistry, Identity, AccountOrgs, Site, SiteCreate, SiteConfig, SiteUpdate, SiteUpdateResult, IntegrationHealthReport, HealthWaiver, HealthWaiverInput, ProvisionRequest, ProvisionResult, PartnerLink, PartnerLinkCreate, PartnerCatalogEntry, ConsentDay, ConsentLogRow, RangeQuery, LogQuery, DsarRequest, DsarCreate, DsarCase, DsarCaseCreate, DsarCaseReceipt, DsarSettings, DsarSettingsInput, SubjectCard, IntegrationConnect, IntegrationConnectResult, DsarStatus, ScoredVendor, VendorInput, VendorRecord, RiskScore, RopaEntry, RopaInput, SignedReceipt, PreferenceRecord } from './types.js';
|
|
18
18
|
import type { ConformanceReport } from './executor-conformance.js';
|
|
19
19
|
/**
|
|
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.12.1";
|
|
24
24
|
export interface CookieMunchOptions {
|
|
25
25
|
apiKey: string;
|
|
26
26
|
/** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
|
|
@@ -334,6 +334,51 @@ export interface DeclaredCookie extends DeclaredCookieInput {
|
|
|
334
334
|
source?: 'import';
|
|
335
335
|
/** The vendor whose preset declared it. */
|
|
336
336
|
vendor?: string;
|
|
337
|
+
/** The `purposes` languages that are machine translations (sites.translateCookies); absent = all human-written. */
|
|
338
|
+
machinePurposes?: string[];
|
|
339
|
+
}
|
|
340
|
+
/** GET/PUT/DELETE /v1/sites/:cbid/translation — the site's own translation account. Never the key. */
|
|
341
|
+
export interface TranslationConnection {
|
|
342
|
+
cbid: string;
|
|
343
|
+
connected: boolean;
|
|
344
|
+
provider: 'deepl' | 'google' | null;
|
|
345
|
+
keyLast4: string | null;
|
|
346
|
+
/** First 12 hex of SHA-256(key). */
|
|
347
|
+
keyFingerprint: string | null;
|
|
348
|
+
connectedAt: number | null;
|
|
349
|
+
/** On connect only: whether the key was checked with the provider first. */
|
|
350
|
+
verified?: boolean;
|
|
351
|
+
}
|
|
352
|
+
/** POST /v1/sites/:cbid/cookies/translate */
|
|
353
|
+
export interface CookieTranslateResult {
|
|
354
|
+
dryRun: boolean;
|
|
355
|
+
provider: 'deepl' | 'google' | null;
|
|
356
|
+
languages: string[];
|
|
357
|
+
/** Languages the provider cannot translate into. Reported, not a failure. */
|
|
358
|
+
unsupported: Array<{
|
|
359
|
+
language: string;
|
|
360
|
+
reason: string;
|
|
361
|
+
}>;
|
|
362
|
+
/** Languages whose provider call failed; nothing was stored for them. */
|
|
363
|
+
failed: Array<{
|
|
364
|
+
language: string;
|
|
365
|
+
error: string;
|
|
366
|
+
}>;
|
|
367
|
+
characters: number;
|
|
368
|
+
translated: number;
|
|
369
|
+
rows: number;
|
|
370
|
+
/** `text` is absent on a dry run. */
|
|
371
|
+
changes: Array<{
|
|
372
|
+
name: string;
|
|
373
|
+
language: string;
|
|
374
|
+
source: string;
|
|
375
|
+
text?: string;
|
|
376
|
+
}>;
|
|
377
|
+
skipped: Array<{
|
|
378
|
+
name: string;
|
|
379
|
+
language: string;
|
|
380
|
+
reason: string;
|
|
381
|
+
}>;
|
|
337
382
|
}
|
|
338
383
|
/** A platform whose cookies and storage a preset declares. */
|
|
339
384
|
export type CookiePresetVendor = 'atlas' | 'forumulate' | 'chatly' | 'cookiemunch' | 'referalli' | 'firstpromoter' | 'partnerstack' | 'tapfiliate' | 'impact'
|
|
@@ -708,6 +753,43 @@ export interface ConfigChange {
|
|
|
708
753
|
export interface PutConfigOptions {
|
|
709
754
|
keep?: 'unspecified';
|
|
710
755
|
}
|
|
756
|
+
/** What `POST /v1/dsar?dryRun=1` would do: nothing was filed, and no connected system was contacted. */
|
|
757
|
+
export interface DsarCreateDryRun {
|
|
758
|
+
dryRun: true;
|
|
759
|
+
/** The connections auto-planning would open a task on once the request is verified. */
|
|
760
|
+
plan: Array<{
|
|
761
|
+
id: string;
|
|
762
|
+
system: string;
|
|
763
|
+
preset?: string;
|
|
764
|
+
op: 'export' | 'erase' | 'optOut';
|
|
765
|
+
reached: true;
|
|
766
|
+
requireApproval?: true;
|
|
767
|
+
/** What this system would do: the host, the request templates in order (no person's data), one sentence. */
|
|
768
|
+
host?: string;
|
|
769
|
+
steps?: Array<{
|
|
770
|
+
step: string;
|
|
771
|
+
method: string;
|
|
772
|
+
path: string;
|
|
773
|
+
operation?: string;
|
|
774
|
+
purpose: string;
|
|
775
|
+
}>;
|
|
776
|
+
effect?: string;
|
|
777
|
+
}>;
|
|
778
|
+
skipped: Array<{
|
|
779
|
+
system: string;
|
|
780
|
+
reason: string;
|
|
781
|
+
}>;
|
|
782
|
+
status: 'received';
|
|
783
|
+
verificationRequired: true;
|
|
784
|
+
/** The deadline it would get (epoch ms). */
|
|
785
|
+
dueAt: number;
|
|
786
|
+
/** On a processor site: the controller it would be forwarded to (`plan` and `skipped` are then empty). */
|
|
787
|
+
forwardTo?: {
|
|
788
|
+
controllerId: string;
|
|
789
|
+
name: string;
|
|
790
|
+
kind: 'cookiemunch' | 'webhook' | 'refer';
|
|
791
|
+
};
|
|
792
|
+
}
|
|
711
793
|
/** What a config write would do (`?dryRun=1`) — nothing is saved. */
|
|
712
794
|
export interface ConfigDryRun {
|
|
713
795
|
dryRun: true;
|
|
@@ -2766,6 +2848,30 @@ export interface CookieMunchClient {
|
|
|
2766
2848
|
}, opts?: {
|
|
2767
2849
|
dryRun?: boolean;
|
|
2768
2850
|
}): Promise<CookieSuggestionsDeclared>;
|
|
2851
|
+
/** The site's own translation account (DeepL or Google) for translateCookies. Never the key. */
|
|
2852
|
+
translation(cbid: string): Promise<TranslationConnection>;
|
|
2853
|
+
/**
|
|
2854
|
+
* Connect the site's own DeepL or Google Cloud Translation key (stored sealed, never returned).
|
|
2855
|
+
* `verify` checks it with the provider first, sending no text.
|
|
2856
|
+
*/
|
|
2857
|
+
connectTranslation(cbid: string, input: {
|
|
2858
|
+
provider: 'deepl' | 'google';
|
|
2859
|
+
key: string;
|
|
2860
|
+
}, opts?: {
|
|
2861
|
+
verify?: boolean;
|
|
2862
|
+
}): Promise<TranslationConnection>;
|
|
2863
|
+
/** Disconnect it; translations already stored stay. */
|
|
2864
|
+
disconnectTranslation(cbid: string): Promise<TranslationConnection>;
|
|
2865
|
+
/**
|
|
2866
|
+
* Machine-translate the missing `purposes` of the site's own declarations on its connected
|
|
2867
|
+
* account. Never overwrites text a row has. `dryRun` lists the changes and calls no provider.
|
|
2868
|
+
*/
|
|
2869
|
+
translateCookies(cbid: string, input?: {
|
|
2870
|
+
languages?: string[];
|
|
2871
|
+
names?: string[];
|
|
2872
|
+
}, opts?: {
|
|
2873
|
+
dryRun?: boolean;
|
|
2874
|
+
}): Promise<CookieTranslateResult>;
|
|
2769
2875
|
/** Remove every declaration a vendor preset made. */
|
|
2770
2876
|
removeCookiePreset(cbid: string, vendor: CookiePresetVendor | (string & {}), opts?: {
|
|
2771
2877
|
dryRun?: boolean;
|
|
@@ -2886,8 +2992,17 @@ export interface CookieMunchClient {
|
|
|
2886
2992
|
* wrapped as `{ request }`, so `create(...).request.id` is what you pass here.
|
|
2887
2993
|
*/
|
|
2888
2994
|
get(id: string): Promise<DsarRequest>;
|
|
2889
|
-
/**
|
|
2890
|
-
|
|
2995
|
+
/**
|
|
2996
|
+
* `skipped`: connections scoped to another property (or to one, when the request names none), never planned for it.
|
|
2997
|
+
* `{ 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.
|
|
2999
|
+
*/
|
|
3000
|
+
create(input: DsarCreate & ResourceTagsInput, opts: {
|
|
3001
|
+
dryRun: true;
|
|
3002
|
+
}): Promise<DsarCreateDryRun>;
|
|
3003
|
+
create(input: DsarCreate & ResourceTagsInput, opts?: {
|
|
3004
|
+
dryRun?: false;
|
|
3005
|
+
}): Promise<{
|
|
2891
3006
|
request: DsarRequest;
|
|
2892
3007
|
consent?: {
|
|
2893
3008
|
count: number;
|
|
@@ -2933,7 +3048,7 @@ export interface CookieMunchClient {
|
|
|
2933
3048
|
/** Requests carrying one X-Trace-Id (`GET /v1/dsar?trace=`). */
|
|
2934
3049
|
listByTrace(trace: string): Promise<DsarRequest[]>;
|
|
2935
3050
|
/** Requests with one origin (`GET /v1/dsar?origin=`): `account_deletion`, those a person's own account deletion opened. */
|
|
2936
|
-
listByOrigin(origin: 'account_deletion'): Promise<DsarRequest[]>;
|
|
3051
|
+
listByOrigin(origin: 'account_deletion' | 'processor_forward'): Promise<DsarRequest[]>;
|
|
2937
3052
|
/**
|
|
2938
3053
|
* Open a case fanned out to every connected system (POST /v1/dsar/requests). `opts.idempotencyKey`
|
|
2939
3054
|
* (16–128 chars) makes a retry answer the same case; `opts.trace` passes your X-Trace-Id on.
|
|
@@ -3592,9 +3707,7 @@ export interface CookieMunchClient {
|
|
|
3592
3707
|
/** A site's rights-request settings: graceDays (0–30; 7 for a new site, 0 until set for one that existed before). Requires dsar:read / dsar:write. */
|
|
3593
3708
|
dsarSettings: {
|
|
3594
3709
|
get(cbid: string): Promise<DsarSettings>;
|
|
3595
|
-
set(cbid: string, input:
|
|
3596
|
-
graceDays: number;
|
|
3597
|
-
}): Promise<DsarSettings>;
|
|
3710
|
+
set(cbid: string, input: DsarSettingsInput): Promise<DsarSettings>;
|
|
3598
3711
|
};
|
|
3599
3712
|
/** Cards for support, CRM and helpdesk sidebars (dsar:read), and one-call identity-provider connect (dsar:write). */
|
|
3600
3713
|
integrations: {
|
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.12.1";
|
|
92
92
|
var CookieMunchApiError = class extends Error {
|
|
93
93
|
constructor(status, message, code, body) {
|
|
94
94
|
super(message);
|
|
@@ -243,6 +243,10 @@ function createCookieMunch(opts) {
|
|
|
243
243
|
importCookieManifest: (cbid, input, o) => request("PUT", `/sites/${enc(cbid)}/cookies/presets/custom${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
244
244
|
cookieSuggestions: (cbid) => get(`/sites/${enc(cbid)}/cookies/suggestions`),
|
|
245
245
|
declareCookieSuggestions: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/cookies/suggestions/declare${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input ?? {}),
|
|
246
|
+
translation: (cbid) => get(`/sites/${enc(cbid)}/translation`),
|
|
247
|
+
connectTranslation: (cbid, input, o) => request("PUT", `/sites/${enc(cbid)}/translation${qs({ verify: o?.verify ? "1" : void 0 })}`, input),
|
|
248
|
+
disconnectTranslation: (cbid) => request("DELETE", `/sites/${enc(cbid)}/translation`),
|
|
249
|
+
translateCookies: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/cookies/translate${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input ?? {}),
|
|
246
250
|
removeCookiePreset: (cbid, vendor, o) => request("DELETE", `/sites/${enc(cbid)}/cookies/presets/${enc(vendor)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`),
|
|
247
251
|
deleteObservedCookie: (async (cbid, name, o) => {
|
|
248
252
|
const out = await request("DELETE", `/sites/${enc(cbid)}/observed-cookies/${enc(name)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
|
|
@@ -298,7 +302,7 @@ function createCookieMunch(opts) {
|
|
|
298
302
|
dsar: {
|
|
299
303
|
list: () => get("/dsar"),
|
|
300
304
|
get: (id) => get(`/dsar/${enc(id)}`),
|
|
301
|
-
create: (input) => request("POST",
|
|
305
|
+
create: ((input, o) => request("POST", `/dsar${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input)),
|
|
302
306
|
advance: (id, toStatus, opts2) => request("POST", `/dsar/${enc(id)}/advance`, { toStatus, ...opts2?.messageToSubject !== void 0 ? { messageToSubject: opts2.messageToSubject } : {} }),
|
|
303
307
|
response: (id) => request("GET", `/dsar/${enc(id)}/response`, void 0, true),
|
|
304
308
|
erase: (id, cbid, stamp) => request("POST", `/dsar/${enc(id)}/erase`, { cbid, stamp }),
|