@cookiemunch/sdk 0.30.0 → 0.32.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 +10 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -4
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -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.
|
|
23
|
+
export declare const SDK_VERSION = "0.32.0";
|
|
24
24
|
export interface CookieMunchOptions {
|
|
25
25
|
apiKey: string;
|
|
26
26
|
/** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
|
|
@@ -620,6 +620,12 @@ export interface CookiePreset {
|
|
|
620
620
|
/** An applied preset: names the site was seen writing under the vendor's prefixes that nothing declares. */
|
|
621
621
|
incomplete?: string[];
|
|
622
622
|
manifest: CookiePresetManifest;
|
|
623
|
+
/** A first-class preset this site applied: the revision its rows came from (`instance:<version>` for Chatly's storage declaration). */
|
|
624
|
+
appliedRevision?: string;
|
|
625
|
+
appliedAt?: string;
|
|
626
|
+
/** What the vendor's instance source answered at its last hourly read; differs from `appliedRevision` when the vendor changed. */
|
|
627
|
+
latestRevision?: string;
|
|
628
|
+
latestAt?: string;
|
|
623
629
|
}
|
|
624
630
|
/** What applying a preset declared. */
|
|
625
631
|
export interface CookiePresetResult {
|
|
@@ -687,14 +693,19 @@ export interface CookiePlanInput {
|
|
|
687
693
|
name: string;
|
|
688
694
|
}>;
|
|
689
695
|
replace?: boolean;
|
|
690
|
-
/**
|
|
696
|
+
/** Own rows to give to a preset in `presets` that declares the same name: removed in the cookies step, declared by the preset. Each must end up declared by a preset, or the run is refused. */
|
|
697
|
+
handOver?: string[];
|
|
698
|
+
/** Vendor → its params, applied in key order, each seeing the steps before it. `custom` takes the body of `PUT …/cookies/presets/custom` (plan only). */
|
|
691
699
|
presets?: Partial<Record<CookiePresetVendor, CookiePresetParams>> & {
|
|
692
700
|
custom?: CustomPresetInput;
|
|
693
701
|
};
|
|
694
702
|
}
|
|
695
|
-
/** What the steps, in order, would produce
|
|
703
|
+
/** What the steps, in order, would produce (`planCookies`: nothing stored) or did store (`applyCookies`). */
|
|
696
704
|
export interface CookiePlanResult {
|
|
697
|
-
|
|
705
|
+
/** Set by `planCookies`. */
|
|
706
|
+
dryRun?: true;
|
|
707
|
+
/** Set by `applyCookies`. */
|
|
708
|
+
applied?: true;
|
|
698
709
|
/** Each step's own dry-run answer, plus `step` (`cookies` or `presets.<vendor>`) and its diff against the step before. */
|
|
699
710
|
steps: Array<{
|
|
700
711
|
step: string;
|
|
@@ -3197,6 +3208,11 @@ export interface CookieMunchClient {
|
|
|
3197
3208
|
* preset in `presets` in key order, against one scratch copy — exactly what the real calls in that order produce.
|
|
3198
3209
|
*/
|
|
3199
3210
|
planCookies(cbid: string, input: CookiePlanInput): Promise<CookiePlanResult>;
|
|
3211
|
+
/**
|
|
3212
|
+
* Apply what `planCookies` shows, all or nothing: the same steps on a scratch copy, stored only when every
|
|
3213
|
+
* step (and the `handOver` check) passes, each preset registered as its PUT would. A refusal stores nothing.
|
|
3214
|
+
*/
|
|
3215
|
+
applyCookies(cbid: string, input: CookiePlanInput): Promise<CookiePlanResult>;
|
|
3200
3216
|
snippet(cbid: string, opts?: SnippetOptions): Promise<InstallSnippet>;
|
|
3201
3217
|
/**
|
|
3202
3218
|
* Mint a short-lived signed token to see the banner as a visitor in a given region and
|
package/dist/index.js
CHANGED
|
@@ -89,7 +89,7 @@ async function exchangeOperatorToken(input) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// src/index.ts
|
|
92
|
-
var SDK_VERSION = "0.
|
|
92
|
+
var SDK_VERSION = "0.32.0";
|
|
93
93
|
var CookieMunchApiError = class extends Error {
|
|
94
94
|
constructor(status, message, code, body) {
|
|
95
95
|
super(message);
|
|
@@ -269,6 +269,7 @@ function createCookieMunch(opts) {
|
|
|
269
269
|
}),
|
|
270
270
|
declareCookies: (cbid, cookies, o) => request("PUT", `/sites/${enc(cbid)}/cookies${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, { cookies, ...o?.replace ? { replace: true } : {} }),
|
|
271
271
|
planCookies: (cbid, input) => request("POST", `/sites/${enc(cbid)}/cookies/plan`, input),
|
|
272
|
+
applyCookies: (cbid, input) => request("POST", `/sites/${enc(cbid)}/cookies/apply`, input),
|
|
272
273
|
snippet: (cbid, opts2) => get(`/sites/${enc(cbid)}/snippet${qs({ blockingmode: opts2?.blockingMode, culture: opts2?.culture })}`),
|
|
273
274
|
previewToken: (cbid, o) => request("POST", `/sites/${enc(cbid)}/preview-token`, o ?? {}),
|
|
274
275
|
verify: (cbid, method) => request("POST", `/sites/${enc(cbid)}/verify`, { method }),
|