@cookiemunch/sdk 0.3.0 → 0.4.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/dist/index.cjs +21 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +469 -8
- package/dist/index.d.ts +469 -8
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -175,6 +175,7 @@ function createCookieMunch(opts) {
|
|
|
175
175
|
if (!doFetch) throw new Error("No fetch available; pass { fetch } in CookieMunchOptions.");
|
|
176
176
|
async function request(method, path, body, raw = false) {
|
|
177
177
|
const headers = { Authorization: `Bearer ${opts.apiKey}` };
|
|
178
|
+
if (opts.strictUnknownFields && method !== "GET") headers["Prefer"] = "strict-unknown-fields";
|
|
178
179
|
const init = { method, headers };
|
|
179
180
|
if (body !== void 0) {
|
|
180
181
|
headers["Content-Type"] = "application/json";
|
|
@@ -212,9 +213,13 @@ function createCookieMunch(opts) {
|
|
|
212
213
|
list: () => get("/sites"),
|
|
213
214
|
create: (input) => request("POST", "/sites", input),
|
|
214
215
|
get: (cbid) => get(`/sites/${enc(cbid)}`),
|
|
216
|
+
update: (cbid, patch, o) => request("PATCH", `/sites/${enc(cbid)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, patch),
|
|
215
217
|
delete: async (cbid) => {
|
|
216
218
|
await request("DELETE", `/sites/${enc(cbid)}`);
|
|
217
219
|
},
|
|
220
|
+
listPartners: (cbid) => get(`/sites/${enc(cbid)}/partners`),
|
|
221
|
+
linkPartner: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/partners${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
222
|
+
unlinkPartner: (cbid, linkId) => request("DELETE", `/sites/${enc(cbid)}/partners/${enc(linkId)}`),
|
|
218
223
|
getConfig: (cbid) => get(`/sites/${enc(cbid)}/config`),
|
|
219
224
|
putConfig: (cbid, config, opts2) => request("PUT", `/sites/${enc(cbid)}/config${qs({ keep: opts2?.keep })}`, config),
|
|
220
225
|
patchConfig: (cbid, config) => request("PATCH", `/sites/${enc(cbid)}/config`, config),
|
|
@@ -258,6 +263,14 @@ function createCookieMunch(opts) {
|
|
|
258
263
|
const out = await request("DELETE", `/sites/${enc(cbid)}/cookies/${enc(name)}/retire${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
|
|
259
264
|
return o?.dryRun ? out : void 0;
|
|
260
265
|
}),
|
|
266
|
+
cookiePresets: (cbid) => get(`/sites/${enc(cbid)}/cookies/presets`),
|
|
267
|
+
applyCookiePreset: (cbid, vendor, params, o) => request("PUT", `/sites/${enc(cbid)}/cookies/presets/${enc(vendor)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, params ?? {}),
|
|
268
|
+
removeCookiePreset: (cbid, vendor, o) => request("DELETE", `/sites/${enc(cbid)}/cookies/presets/${enc(vendor)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`),
|
|
269
|
+
deleteObservedCookie: (async (cbid, name, o) => {
|
|
270
|
+
const out = await request("DELETE", `/sites/${enc(cbid)}/observed-cookies/${enc(name)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
|
|
271
|
+
return o?.dryRun ? out : void 0;
|
|
272
|
+
}),
|
|
273
|
+
purgeObservedCookies: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/observed-cookies/purge${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
261
274
|
undeclareCookie: (async (cbid, name, o) => {
|
|
262
275
|
const out = await request("DELETE", `/sites/${enc(cbid)}/cookies/${enc(name)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
|
|
263
276
|
return o?.dryRun ? out : void 0;
|
|
@@ -304,7 +317,7 @@ function createCookieMunch(opts) {
|
|
|
304
317
|
list: () => get("/dsar"),
|
|
305
318
|
get: (id) => get(`/dsar/${enc(id)}`),
|
|
306
319
|
create: (input) => request("POST", "/dsar", input),
|
|
307
|
-
advance: (id, toStatus) => request("POST", `/dsar/${enc(id)}/advance`, { toStatus }),
|
|
320
|
+
advance: (id, toStatus, opts2) => request("POST", `/dsar/${enc(id)}/advance`, { toStatus, ...opts2?.messageToSubject !== void 0 ? { messageToSubject: opts2.messageToSubject } : {} }),
|
|
308
321
|
response: (id) => request("GET", `/dsar/${enc(id)}/response`, void 0, true),
|
|
309
322
|
erase: (id, cbid, stamp) => request("POST", `/dsar/${enc(id)}/erase`, { cbid, stamp }),
|
|
310
323
|
export: (id, cbid, stamp) => request("POST", `/dsar/${enc(id)}/export`, { cbid, stamp }),
|
|
@@ -418,6 +431,9 @@ function createCookieMunch(opts) {
|
|
|
418
431
|
connectExecutor: (input) => request("POST", "/dsar/executors", input),
|
|
419
432
|
updateExecutor: (id, patch) => request("PATCH", `/dsar/executors/${enc(id)}`, patch),
|
|
420
433
|
dryRunConnectExecutor: (input) => request("POST", "/dsar/executors?dryRun=1", input),
|
|
434
|
+
executorPresets: () => get("/dsar/executors/presets"),
|
|
435
|
+
upgradeExecutorPreset: (id, input = {}) => request("POST", `/dsar/executors/${enc(id)}/upgrade-preset`, input),
|
|
436
|
+
dryRunUpgradeExecutorPreset: (id, input = {}) => request("POST", `/dsar/executors/${enc(id)}/upgrade-preset?dryRun=1`, input),
|
|
421
437
|
dryRunUpdateExecutor: (id, patch) => request("PATCH", `/dsar/executors/${enc(id)}?dryRun=1`, patch),
|
|
422
438
|
testExecutorWebhook: (id, delivery) => request("POST", `/dsar/executors/${enc(id)}/webhook/test`, delivery),
|
|
423
439
|
executorWebhookDeliveries: (id) => get(`/dsar/executors/${enc(id)}/webhook/deliveries`),
|
|
@@ -446,9 +462,12 @@ function createCookieMunch(opts) {
|
|
|
446
462
|
await request("DELETE", `/keys/${enc(prefix)}`);
|
|
447
463
|
},
|
|
448
464
|
roll: (prefix) => request("POST", `/keys/${enc(prefix)}/roll`),
|
|
449
|
-
update: (prefix, patch) => request("PATCH", `/keys/${enc(prefix)}`, patch)
|
|
465
|
+
update: (prefix, patch) => request("PATCH", `/keys/${enc(prefix)}`, patch),
|
|
466
|
+
report: (o) => get(`/keys/report${qs({ unusedDays: o?.unusedDays, expiringDays: o?.expiringDays })}`)
|
|
450
467
|
},
|
|
451
468
|
usage: () => get("/usage"),
|
|
469
|
+
integrationHealth: (cbid) => get(`/integration-health${qs({ cbid })}`),
|
|
470
|
+
provision: (input, o) => request("POST", `/provision${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
452
471
|
org: {
|
|
453
472
|
get: () => get("/org"),
|
|
454
473
|
update: (patch) => request("PATCH", "/org", patch),
|