@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.js
CHANGED
|
@@ -54,6 +54,7 @@ function createCookieMunch(opts) {
|
|
|
54
54
|
if (!doFetch) throw new Error("No fetch available; pass { fetch } in CookieMunchOptions.");
|
|
55
55
|
async function request(method, path, body, raw = false) {
|
|
56
56
|
const headers = { Authorization: `Bearer ${opts.apiKey}` };
|
|
57
|
+
if (opts.strictUnknownFields && method !== "GET") headers["Prefer"] = "strict-unknown-fields";
|
|
57
58
|
const init = { method, headers };
|
|
58
59
|
if (body !== void 0) {
|
|
59
60
|
headers["Content-Type"] = "application/json";
|
|
@@ -91,9 +92,13 @@ function createCookieMunch(opts) {
|
|
|
91
92
|
list: () => get("/sites"),
|
|
92
93
|
create: (input) => request("POST", "/sites", input),
|
|
93
94
|
get: (cbid) => get(`/sites/${enc(cbid)}`),
|
|
95
|
+
update: (cbid, patch, o) => request("PATCH", `/sites/${enc(cbid)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, patch),
|
|
94
96
|
delete: async (cbid) => {
|
|
95
97
|
await request("DELETE", `/sites/${enc(cbid)}`);
|
|
96
98
|
},
|
|
99
|
+
listPartners: (cbid) => get(`/sites/${enc(cbid)}/partners`),
|
|
100
|
+
linkPartner: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/partners${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
101
|
+
unlinkPartner: (cbid, linkId) => request("DELETE", `/sites/${enc(cbid)}/partners/${enc(linkId)}`),
|
|
97
102
|
getConfig: (cbid) => get(`/sites/${enc(cbid)}/config`),
|
|
98
103
|
putConfig: (cbid, config, opts2) => request("PUT", `/sites/${enc(cbid)}/config${qs({ keep: opts2?.keep })}`, config),
|
|
99
104
|
patchConfig: (cbid, config) => request("PATCH", `/sites/${enc(cbid)}/config`, config),
|
|
@@ -137,6 +142,14 @@ function createCookieMunch(opts) {
|
|
|
137
142
|
const out = await request("DELETE", `/sites/${enc(cbid)}/cookies/${enc(name)}/retire${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
|
|
138
143
|
return o?.dryRun ? out : void 0;
|
|
139
144
|
}),
|
|
145
|
+
cookiePresets: (cbid) => get(`/sites/${enc(cbid)}/cookies/presets`),
|
|
146
|
+
applyCookiePreset: (cbid, vendor, params, o) => request("PUT", `/sites/${enc(cbid)}/cookies/presets/${enc(vendor)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, params ?? {}),
|
|
147
|
+
removeCookiePreset: (cbid, vendor, o) => request("DELETE", `/sites/${enc(cbid)}/cookies/presets/${enc(vendor)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`),
|
|
148
|
+
deleteObservedCookie: (async (cbid, name, o) => {
|
|
149
|
+
const out = await request("DELETE", `/sites/${enc(cbid)}/observed-cookies/${enc(name)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
|
|
150
|
+
return o?.dryRun ? out : void 0;
|
|
151
|
+
}),
|
|
152
|
+
purgeObservedCookies: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/observed-cookies/purge${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
140
153
|
undeclareCookie: (async (cbid, name, o) => {
|
|
141
154
|
const out = await request("DELETE", `/sites/${enc(cbid)}/cookies/${enc(name)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
|
|
142
155
|
return o?.dryRun ? out : void 0;
|
|
@@ -183,7 +196,7 @@ function createCookieMunch(opts) {
|
|
|
183
196
|
list: () => get("/dsar"),
|
|
184
197
|
get: (id) => get(`/dsar/${enc(id)}`),
|
|
185
198
|
create: (input) => request("POST", "/dsar", input),
|
|
186
|
-
advance: (id, toStatus) => request("POST", `/dsar/${enc(id)}/advance`, { toStatus }),
|
|
199
|
+
advance: (id, toStatus, opts2) => request("POST", `/dsar/${enc(id)}/advance`, { toStatus, ...opts2?.messageToSubject !== void 0 ? { messageToSubject: opts2.messageToSubject } : {} }),
|
|
187
200
|
response: (id) => request("GET", `/dsar/${enc(id)}/response`, void 0, true),
|
|
188
201
|
erase: (id, cbid, stamp) => request("POST", `/dsar/${enc(id)}/erase`, { cbid, stamp }),
|
|
189
202
|
export: (id, cbid, stamp) => request("POST", `/dsar/${enc(id)}/export`, { cbid, stamp }),
|
|
@@ -297,6 +310,9 @@ function createCookieMunch(opts) {
|
|
|
297
310
|
connectExecutor: (input) => request("POST", "/dsar/executors", input),
|
|
298
311
|
updateExecutor: (id, patch) => request("PATCH", `/dsar/executors/${enc(id)}`, patch),
|
|
299
312
|
dryRunConnectExecutor: (input) => request("POST", "/dsar/executors?dryRun=1", input),
|
|
313
|
+
executorPresets: () => get("/dsar/executors/presets"),
|
|
314
|
+
upgradeExecutorPreset: (id, input = {}) => request("POST", `/dsar/executors/${enc(id)}/upgrade-preset`, input),
|
|
315
|
+
dryRunUpgradeExecutorPreset: (id, input = {}) => request("POST", `/dsar/executors/${enc(id)}/upgrade-preset?dryRun=1`, input),
|
|
300
316
|
dryRunUpdateExecutor: (id, patch) => request("PATCH", `/dsar/executors/${enc(id)}?dryRun=1`, patch),
|
|
301
317
|
testExecutorWebhook: (id, delivery) => request("POST", `/dsar/executors/${enc(id)}/webhook/test`, delivery),
|
|
302
318
|
executorWebhookDeliveries: (id) => get(`/dsar/executors/${enc(id)}/webhook/deliveries`),
|
|
@@ -325,9 +341,12 @@ function createCookieMunch(opts) {
|
|
|
325
341
|
await request("DELETE", `/keys/${enc(prefix)}`);
|
|
326
342
|
},
|
|
327
343
|
roll: (prefix) => request("POST", `/keys/${enc(prefix)}/roll`),
|
|
328
|
-
update: (prefix, patch) => request("PATCH", `/keys/${enc(prefix)}`, patch)
|
|
344
|
+
update: (prefix, patch) => request("PATCH", `/keys/${enc(prefix)}`, patch),
|
|
345
|
+
report: (o) => get(`/keys/report${qs({ unusedDays: o?.unusedDays, expiringDays: o?.expiringDays })}`)
|
|
329
346
|
},
|
|
330
347
|
usage: () => get("/usage"),
|
|
348
|
+
integrationHealth: (cbid) => get(`/integration-health${qs({ cbid })}`),
|
|
349
|
+
provision: (input, o) => request("POST", `/provision${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
331
350
|
org: {
|
|
332
351
|
get: () => get("/org"),
|
|
333
352
|
update: (patch) => request("PATCH", "/org", patch),
|