@cookiemunch/sdk 0.3.0 → 0.4.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 +44 -0
- package/LICENSE +21 -0
- package/dist/index.cjs +25 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +483 -10
- package/dist/index.d.ts +483 -10
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/package.json +14 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Changelog: @cookiemunch/sdk
|
|
2
|
+
|
|
3
|
+
Every published release, newest first. Dates are the day the version was cut.
|
|
4
|
+
|
|
5
|
+
## 0.4.1 (2026-10-22)
|
|
6
|
+
|
|
7
|
+
- Added: the `referally` cookie preset (`cookieDomain`, `cookieDays`, `category` parameters on `applyCookiePreset`).
|
|
8
|
+
- Added: every request sends `User-Agent: cookiemunch-js/<version>`; set your own with the `userAgent` option.
|
|
9
|
+
|
|
10
|
+
## 0.4.0 (2026-10-19)
|
|
11
|
+
|
|
12
|
+
- Added: site PATCH (rename or move a site, keeping its cbid), integration health, `provision` and partner links.
|
|
13
|
+
- Added: the executor presets and canary health checks for connected systems; `connectExecutor` takes a `preset`.
|
|
14
|
+
- Added: declaration presets for the platforms a site is built on, observed-cookie removal and storage types on declarations.
|
|
15
|
+
- Added: opt-in strict writes and API key hygiene (`X-14`, `X-15`).
|
|
16
|
+
|
|
17
|
+
## 0.3.0 (2026-10-15)
|
|
18
|
+
|
|
19
|
+
- Added: `retireCookie` and `unretireCookie`.
|
|
20
|
+
- Added: `scan` can wait for the result, and `waitForScan`.
|
|
21
|
+
|
|
22
|
+
## 0.2.0 (2026-10-15)
|
|
23
|
+
|
|
24
|
+
- Added: executor webhook test and delivery log, with dry runs.
|
|
25
|
+
- Added: `purposes` (per-language text) and `dryRun` on declared cookies; `?lang=` on the public cookie feed.
|
|
26
|
+
- Added: document verification on rights-request intake answers (`trustEmailClaim`, `oidc_jwt`).
|
|
27
|
+
- Added: rights-page identity configuration.
|
|
28
|
+
- Fixed: design warnings say what happened and notices are not blamed on Accept.
|
|
29
|
+
|
|
30
|
+
## 0.1.2 (2026-10-15)
|
|
31
|
+
|
|
32
|
+
- Changed: the package builds standalone from its public repository and is published with npm provenance.
|
|
33
|
+
|
|
34
|
+
## 0.1.1 (2026-10-14)
|
|
35
|
+
|
|
36
|
+
- Added: `declareCookie`, bulk declare, `undeclareCookie` and applying a scan import.
|
|
37
|
+
- Added: `PUT ?keep=unspecified` and `null` in a PATCH removes the key.
|
|
38
|
+
- Added: `dryRunConfig`, and `lintConfig` with `designWarnings` on every config read and write.
|
|
39
|
+
- Added: `client.rightsPage`: draft, dry run, publish, versions, rollback (with `baseUpdatedAt` conflicts), custom domains, mail provider and account-linked rights links.
|
|
40
|
+
- Fixed: per-claim CNAME targets; a hostname already pointing at us is proven with the TXT token.
|
|
41
|
+
|
|
42
|
+
## 0.1.0 (2026-10-14)
|
|
43
|
+
|
|
44
|
+
- First release: a typed client for the Cookie Munch Developer API (`/v1`): sites, config, consent log and stats, DSAR, vendors and RoPA.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Cookie Munch
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var src_exports = {};
|
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
CONSENT_COOKIE_NAME: () => CONSENT_COOKIE_NAME,
|
|
24
24
|
CookieMunchApiError: () => CookieMunchApiError,
|
|
25
|
+
SDK_VERSION: () => SDK_VERSION,
|
|
25
26
|
createCookieMunch: () => createCookieMunch,
|
|
26
27
|
getConsent: () => getConsent,
|
|
27
28
|
isAllowed: () => isAllowed,
|
|
@@ -148,6 +149,7 @@ function verifyWebhookSignature(input) {
|
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
// src/index.ts
|
|
152
|
+
var SDK_VERSION = "0.4.1";
|
|
151
153
|
var CookieMunchApiError = class extends Error {
|
|
152
154
|
constructor(status, message, code, body) {
|
|
153
155
|
super(message);
|
|
@@ -174,7 +176,8 @@ function createCookieMunch(opts) {
|
|
|
174
176
|
const doFetch = opts.fetch ?? globalThis.fetch;
|
|
175
177
|
if (!doFetch) throw new Error("No fetch available; pass { fetch } in CookieMunchOptions.");
|
|
176
178
|
async function request(method, path, body, raw = false) {
|
|
177
|
-
const headers = { Authorization: `Bearer ${opts.apiKey}` };
|
|
179
|
+
const headers = { Authorization: `Bearer ${opts.apiKey}`, "User-Agent": opts.userAgent ?? `cookiemunch-js/${SDK_VERSION}` };
|
|
180
|
+
if (opts.strictUnknownFields && method !== "GET") headers["Prefer"] = "strict-unknown-fields";
|
|
178
181
|
const init = { method, headers };
|
|
179
182
|
if (body !== void 0) {
|
|
180
183
|
headers["Content-Type"] = "application/json";
|
|
@@ -212,9 +215,13 @@ function createCookieMunch(opts) {
|
|
|
212
215
|
list: () => get("/sites"),
|
|
213
216
|
create: (input) => request("POST", "/sites", input),
|
|
214
217
|
get: (cbid) => get(`/sites/${enc(cbid)}`),
|
|
218
|
+
update: (cbid, patch, o) => request("PATCH", `/sites/${enc(cbid)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, patch),
|
|
215
219
|
delete: async (cbid) => {
|
|
216
220
|
await request("DELETE", `/sites/${enc(cbid)}`);
|
|
217
221
|
},
|
|
222
|
+
listPartners: (cbid) => get(`/sites/${enc(cbid)}/partners`),
|
|
223
|
+
linkPartner: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/partners${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
224
|
+
unlinkPartner: (cbid, linkId) => request("DELETE", `/sites/${enc(cbid)}/partners/${enc(linkId)}`),
|
|
218
225
|
getConfig: (cbid) => get(`/sites/${enc(cbid)}/config`),
|
|
219
226
|
putConfig: (cbid, config, opts2) => request("PUT", `/sites/${enc(cbid)}/config${qs({ keep: opts2?.keep })}`, config),
|
|
220
227
|
patchConfig: (cbid, config) => request("PATCH", `/sites/${enc(cbid)}/config`, config),
|
|
@@ -258,6 +265,14 @@ function createCookieMunch(opts) {
|
|
|
258
265
|
const out = await request("DELETE", `/sites/${enc(cbid)}/cookies/${enc(name)}/retire${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
|
|
259
266
|
return o?.dryRun ? out : void 0;
|
|
260
267
|
}),
|
|
268
|
+
cookiePresets: (cbid) => get(`/sites/${enc(cbid)}/cookies/presets`),
|
|
269
|
+
applyCookiePreset: (cbid, vendor, params, o) => request("PUT", `/sites/${enc(cbid)}/cookies/presets/${enc(vendor)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, params ?? {}),
|
|
270
|
+
removeCookiePreset: (cbid, vendor, o) => request("DELETE", `/sites/${enc(cbid)}/cookies/presets/${enc(vendor)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`),
|
|
271
|
+
deleteObservedCookie: (async (cbid, name, o) => {
|
|
272
|
+
const out = await request("DELETE", `/sites/${enc(cbid)}/observed-cookies/${enc(name)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
|
|
273
|
+
return o?.dryRun ? out : void 0;
|
|
274
|
+
}),
|
|
275
|
+
purgeObservedCookies: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/observed-cookies/purge${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
261
276
|
undeclareCookie: (async (cbid, name, o) => {
|
|
262
277
|
const out = await request("DELETE", `/sites/${enc(cbid)}/cookies/${enc(name)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
|
|
263
278
|
return o?.dryRun ? out : void 0;
|
|
@@ -304,7 +319,7 @@ function createCookieMunch(opts) {
|
|
|
304
319
|
list: () => get("/dsar"),
|
|
305
320
|
get: (id) => get(`/dsar/${enc(id)}`),
|
|
306
321
|
create: (input) => request("POST", "/dsar", input),
|
|
307
|
-
advance: (id, toStatus) => request("POST", `/dsar/${enc(id)}/advance`, { toStatus }),
|
|
322
|
+
advance: (id, toStatus, opts2) => request("POST", `/dsar/${enc(id)}/advance`, { toStatus, ...opts2?.messageToSubject !== void 0 ? { messageToSubject: opts2.messageToSubject } : {} }),
|
|
308
323
|
response: (id) => request("GET", `/dsar/${enc(id)}/response`, void 0, true),
|
|
309
324
|
erase: (id, cbid, stamp) => request("POST", `/dsar/${enc(id)}/erase`, { cbid, stamp }),
|
|
310
325
|
export: (id, cbid, stamp) => request("POST", `/dsar/${enc(id)}/export`, { cbid, stamp }),
|
|
@@ -418,6 +433,9 @@ function createCookieMunch(opts) {
|
|
|
418
433
|
connectExecutor: (input) => request("POST", "/dsar/executors", input),
|
|
419
434
|
updateExecutor: (id, patch) => request("PATCH", `/dsar/executors/${enc(id)}`, patch),
|
|
420
435
|
dryRunConnectExecutor: (input) => request("POST", "/dsar/executors?dryRun=1", input),
|
|
436
|
+
executorPresets: () => get("/dsar/executors/presets"),
|
|
437
|
+
upgradeExecutorPreset: (id, input = {}) => request("POST", `/dsar/executors/${enc(id)}/upgrade-preset`, input),
|
|
438
|
+
dryRunUpgradeExecutorPreset: (id, input = {}) => request("POST", `/dsar/executors/${enc(id)}/upgrade-preset?dryRun=1`, input),
|
|
421
439
|
dryRunUpdateExecutor: (id, patch) => request("PATCH", `/dsar/executors/${enc(id)}?dryRun=1`, patch),
|
|
422
440
|
testExecutorWebhook: (id, delivery) => request("POST", `/dsar/executors/${enc(id)}/webhook/test`, delivery),
|
|
423
441
|
executorWebhookDeliveries: (id) => get(`/dsar/executors/${enc(id)}/webhook/deliveries`),
|
|
@@ -446,9 +464,12 @@ function createCookieMunch(opts) {
|
|
|
446
464
|
await request("DELETE", `/keys/${enc(prefix)}`);
|
|
447
465
|
},
|
|
448
466
|
roll: (prefix) => request("POST", `/keys/${enc(prefix)}/roll`),
|
|
449
|
-
update: (prefix, patch) => request("PATCH", `/keys/${enc(prefix)}`, patch)
|
|
467
|
+
update: (prefix, patch) => request("PATCH", `/keys/${enc(prefix)}`, patch),
|
|
468
|
+
report: (o) => get(`/keys/report${qs({ unusedDays: o?.unusedDays, expiringDays: o?.expiringDays })}`)
|
|
450
469
|
},
|
|
451
470
|
usage: () => get("/usage"),
|
|
471
|
+
integrationHealth: (cbid) => get(`/integration-health${qs({ cbid })}`),
|
|
472
|
+
provision: (input, o) => request("POST", `/provision${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
452
473
|
org: {
|
|
453
474
|
get: () => get("/org"),
|
|
454
475
|
update: (patch) => request("PATCH", "/org", patch),
|
|
@@ -539,6 +560,7 @@ function createCookieMunch(opts) {
|
|
|
539
560
|
0 && (module.exports = {
|
|
540
561
|
CONSENT_COOKIE_NAME,
|
|
541
562
|
CookieMunchApiError,
|
|
563
|
+
SDK_VERSION,
|
|
542
564
|
createCookieMunch,
|
|
543
565
|
getConsent,
|
|
544
566
|
isAllowed,
|