@cookiemunch/sdk 0.1.0 → 0.1.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/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -11
- package/dist/index.d.ts +105 -11
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
package/dist/index.d.cts
CHANGED
|
@@ -111,7 +111,7 @@ interface DsarRequest {
|
|
|
111
111
|
/** Where the subject said they are, when the intake captured it. */
|
|
112
112
|
jurisdiction?: string;
|
|
113
113
|
note?: string;
|
|
114
|
-
/** A test request: off the SLA board, labelled, and deletable with `dsar.delete`. */
|
|
114
|
+
/** A test request: off the SLA board, labelled, and deletable with `dsar.delete`. A closed request can be marked one with `dsar.markTest`. */
|
|
115
115
|
test?: boolean;
|
|
116
116
|
}
|
|
117
117
|
interface DsarCreate {
|
|
@@ -251,13 +251,54 @@ interface CategorizedCookie {
|
|
|
251
251
|
provider?: string;
|
|
252
252
|
purpose?: string;
|
|
253
253
|
expiry?: string;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
/** Page URLs (multi-page scan) that set this cookie, earliest first. */
|
|
255
|
+
foundOnPages?: string[];
|
|
256
|
+
/** The site owner declared this cookie; it overrides the scan. */
|
|
257
|
+
declared?: boolean;
|
|
258
|
+
/** A declared `prefix*` wildcard row that no observed cookie matched yet. */
|
|
259
|
+
pattern?: boolean;
|
|
260
|
+
/** Why a person should look at it. Visitors see such cookies under "Unclassified". */
|
|
261
|
+
review?: 'unclassified' | 'category_disabled' | 'category_unknown';
|
|
262
|
+
}
|
|
263
|
+
/** A site's cookie declaration: the latest scan and observed visits with the site's own
|
|
264
|
+
* declarations on top. This is what GET /v1/sites/:cbid/cookies returns. */
|
|
257
265
|
interface CookieDeclaration {
|
|
258
|
-
/** Epoch-ms of the latest scan, or 0 if none. */
|
|
266
|
+
/** Epoch-ms of the latest scan or declaration change, or 0 if none. */
|
|
259
267
|
updatedAt: number;
|
|
260
268
|
cookies: CategorizedCookie[];
|
|
269
|
+
/** The site owner's declarations, as stored. */
|
|
270
|
+
declared?: DeclaredCookie[];
|
|
271
|
+
}
|
|
272
|
+
/** What the site owner says a cookie is (PUT /v1/sites/:cbid/cookies/:name). */
|
|
273
|
+
interface DeclaredCookieInput {
|
|
274
|
+
/** A standard category or one of the site's `categories.custom` ids. Not `unclassified`. */
|
|
275
|
+
category: string;
|
|
276
|
+
/** Shown to visitors. */
|
|
277
|
+
purpose: string;
|
|
278
|
+
provider?: string;
|
|
279
|
+
expiry?: string;
|
|
280
|
+
domain?: string;
|
|
281
|
+
/** Treat the name as a prefix wildcard (a trailing `*` does the same). */
|
|
282
|
+
pattern?: boolean;
|
|
283
|
+
}
|
|
284
|
+
/** A stored declaration. */
|
|
285
|
+
interface DeclaredCookie extends DeclaredCookieInput {
|
|
286
|
+
name: string;
|
|
287
|
+
updatedAt: number;
|
|
288
|
+
}
|
|
289
|
+
/** A warning about a write: e.g. the category is switched off for the site. */
|
|
290
|
+
interface DeclarationWarning {
|
|
291
|
+
field: string;
|
|
292
|
+
reason: string;
|
|
293
|
+
}
|
|
294
|
+
/** What an import with `apply` declared, on top of what it read. */
|
|
295
|
+
interface AppliedImport extends ImportedDeclaration {
|
|
296
|
+
applied: number;
|
|
297
|
+
skipped: Array<{
|
|
298
|
+
name: string;
|
|
299
|
+
reason: string;
|
|
300
|
+
}>;
|
|
301
|
+
warnings?: DeclarationWarning[];
|
|
261
302
|
}
|
|
262
303
|
/** @deprecated The server returns {@link CookieDeclaration}; kept only for back-compat. */
|
|
263
304
|
interface SiteCookie {
|
|
@@ -335,6 +376,10 @@ interface ConfigChange {
|
|
|
335
376
|
from?: unknown;
|
|
336
377
|
to?: unknown;
|
|
337
378
|
}
|
|
379
|
+
/** `PUT …/config` options. `keep: 'unspecified'` keeps the stored value of every top-level field the body omits. */
|
|
380
|
+
interface PutConfigOptions {
|
|
381
|
+
keep?: 'unspecified';
|
|
382
|
+
}
|
|
338
383
|
/** What a config write would do (`?dryRun=1`) — nothing is saved. */
|
|
339
384
|
interface ConfigDryRun {
|
|
340
385
|
dryRun: true;
|
|
@@ -1116,17 +1161,27 @@ interface CookieMunchClient {
|
|
|
1116
1161
|
get(cbid: string): Promise<Site>;
|
|
1117
1162
|
delete(cbid: string): Promise<void>;
|
|
1118
1163
|
getConfig(cbid: string): Promise<SiteConfig>;
|
|
1119
|
-
/**
|
|
1120
|
-
|
|
1121
|
-
|
|
1164
|
+
/**
|
|
1165
|
+
* Replaces the whole config — a top-level field you omit reverts to its default. With
|
|
1166
|
+
* `{ keep: 'unspecified' }` (`?keep=unspecified`) an omitted top-level field keeps its
|
|
1167
|
+
* stored value instead; each field you send is still replaced whole, and one sent as
|
|
1168
|
+
* `null` reverts to its default.
|
|
1169
|
+
*/
|
|
1170
|
+
putConfig(cbid: string, config: SiteConfig, opts?: PutConfigOptions): Promise<SiteConfig>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Changes some of the config — a JSON Merge Patch (RFC 7386): omitted fields keep their
|
|
1173
|
+
* stored value, nested objects merge, and `null` removes a field (it takes its default):
|
|
1174
|
+
* `{ banner: { i18n: { es: null } } }` drops the Spanish override. Arrays replace whole.
|
|
1175
|
+
*/
|
|
1122
1176
|
patchConfig(cbid: string, config: Partial<SiteConfig>): Promise<SiteConfig>;
|
|
1123
1177
|
/**
|
|
1124
1178
|
* Preview a config write without saving it: the merged result and a diff. `mode: 'put'`
|
|
1125
|
-
* previews a replace (the diff then lists everything that would revert to its default)
|
|
1179
|
+
* previews a replace (the diff then lists everything that would revert to its default);
|
|
1180
|
+
* add `keep: 'unspecified'` to preview a replace that keeps omitted fields.
|
|
1126
1181
|
*/
|
|
1127
1182
|
dryRunConfig(cbid: string, config: Partial<SiteConfig>, opts?: {
|
|
1128
1183
|
mode?: 'patch' | 'put';
|
|
1129
|
-
}): Promise<ConfigDryRun>;
|
|
1184
|
+
} & PutConfigOptions): Promise<ConfigDryRun>;
|
|
1130
1185
|
cookies(cbid: string): Promise<CookieDeclaration>;
|
|
1131
1186
|
scan(cbid: string): Promise<ScanStatus>;
|
|
1132
1187
|
scanStatus(cbid: string): Promise<ScanStatus>;
|
|
@@ -1155,6 +1210,36 @@ interface CookieMunchClient {
|
|
|
1155
1210
|
* wrong category is a tag firing against a refusal, so the result is for review.
|
|
1156
1211
|
*/
|
|
1157
1212
|
importDeclaration(cbid: string, data: string): Promise<ImportedDeclaration>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Import AND declare: every row that mapped to one of our categories and has a purpose
|
|
1215
|
+
* is declared; the rest come back in `skipped`. Already-declared cookies are kept
|
|
1216
|
+
* unless `overwrite`.
|
|
1217
|
+
*/
|
|
1218
|
+
applyImport(cbid: string, data: string, opts?: {
|
|
1219
|
+
overwrite?: boolean;
|
|
1220
|
+
}): Promise<AppliedImport>;
|
|
1221
|
+
/**
|
|
1222
|
+
* Declare what one cookie is. Overrides scanned, observed and database classification
|
|
1223
|
+
* in the API, the preference modal and `data-cc="declaration"`. A name ending in `*`
|
|
1224
|
+
* declares a prefix wildcard.
|
|
1225
|
+
*/
|
|
1226
|
+
declareCookie(cbid: string, name: string, input: DeclaredCookieInput): Promise<{
|
|
1227
|
+
cookie: DeclaredCookie;
|
|
1228
|
+
warnings?: DeclarationWarning[];
|
|
1229
|
+
}>;
|
|
1230
|
+
/** Remove a declaration; the scanned classification applies again. */
|
|
1231
|
+
undeclareCookie(cbid: string, name: string): Promise<void>;
|
|
1232
|
+
/** Declare many at once (all-or-nothing). `replace` also removes declarations not listed. */
|
|
1233
|
+
declareCookies(cbid: string, cookies: Array<DeclaredCookieInput & {
|
|
1234
|
+
name: string;
|
|
1235
|
+
}>, opts?: {
|
|
1236
|
+
replace?: boolean;
|
|
1237
|
+
}): Promise<{
|
|
1238
|
+
declared: DeclaredCookie[];
|
|
1239
|
+
saved: number;
|
|
1240
|
+
removed: number;
|
|
1241
|
+
warnings?: DeclarationWarning[];
|
|
1242
|
+
}>;
|
|
1158
1243
|
snippet(cbid: string, opts?: SnippetOptions): Promise<InstallSnippet>;
|
|
1159
1244
|
/**
|
|
1160
1245
|
* Mint a short-lived signed token to see the banner as a visitor in a given region and
|
|
@@ -1235,6 +1320,15 @@ interface CookieMunchClient {
|
|
|
1235
1320
|
* real request cannot be deleted (409 `not_a_test_request`); the deletion is audited.
|
|
1236
1321
|
*/
|
|
1237
1322
|
delete(id: string): Promise<void>;
|
|
1323
|
+
/**
|
|
1324
|
+
* Mark a CLOSED request (completed or rejected) as a test, after the fact — for trials
|
|
1325
|
+
* filed before `test` existed. An open one is refused (409 `request_not_closed`). Audited
|
|
1326
|
+
* as `dsar.marked_test`; afterwards `delete` works on it. `changed` is false on a repeat.
|
|
1327
|
+
*/
|
|
1328
|
+
markTest(id: string): Promise<{
|
|
1329
|
+
request: DsarRequest;
|
|
1330
|
+
changed: boolean;
|
|
1331
|
+
}>;
|
|
1238
1332
|
};
|
|
1239
1333
|
vendors: {
|
|
1240
1334
|
list(): Promise<ScoredVendor[]>;
|
|
@@ -1617,4 +1711,4 @@ interface CookieMunchClient {
|
|
|
1617
1711
|
}
|
|
1618
1712
|
declare function createCookieMunch(opts: CookieMunchOptions): CookieMunchClient;
|
|
1619
1713
|
|
|
1620
|
-
export { type AbResult, type AccountOrg, type AccountOrgs, type AdPersonalizationInput, type AiInspectInput, type AiInspectResult, type ApiKey, type ApiKeyIssueInput, type ApiKeyIssued, type ApiKeyPrefix, type ApiKeyUpdate, type AssetUpload, type AuditEntry, type BannerRecord, type BannerSummary, type BlockedReport, type BrandExtractionResult, type BrandKit, type BrandKitCreate, type BrandSuggestion, type BulkSiteInput, type BulkSiteResult, type CategorizedCookie, type ChildKeyInput, type ConfigChange, type ConfigDryRun, type ConfigWarning, type ConsentDay, type ConsentDecisionInput, type ConsentIngestInput, type ConsentLogRow, type CookieDeclaration, CookieMunchApiError, type CookieMunchClient, type CookieMunchOptions, type CspSources, type DsarCreate, type DsarEraseResult, type DsarExecutor, type DsarExecutorCreated, type DsarExecutorInput, type DsarExportResult, type DsarRequest, type DsarStatus, type DsarTask, type DsarTaskEvent, type DsarTaskExport, type DsarTaskLogEntry, type DsarTaskOutcome, type DsarType, type EnforcementRuleInput, type ExecutorProfile, type ExecutorTestInput, type ExecutorTestResult, type FlowIssue, type FlowOp, type FlowOpResponse, type FulfillmentOp, type Identifier, type Identity, type ImportedCookie, type ImportedDeclaration, type InstallSnippet, type LegalBasis, type LogQuery, type Member, type OptInMethod, type Org, type OrgUpdate, type PlanSource, type PolicyOptions, type PreferenceItem, type PreferenceRecord, type PreviewToken, type PreviewTokenOptions, type ProfileAttributeInput, type RangeQuery, type Regulation, type RegulationSummary, type RegulatoryFeedResult, type ResellerChild, type ResellerChildCreate, type ResellerChildList, type ResellerChildPatch, type RiskScore, type RopaEntry, type RopaInput, type ScanResult, type ScanStatus, type ScoredVendor, type SessionAnalysisInput, type SignedReceipt, type Site, type SiteConfig, type SiteCookie, type SiteCreate, type SiteFlow, type SnippetOptions, type SubscriptionTopicInput, type SupportedLanguage, type Usage, type VendorInput, type VendorRecord, type VerifyResult, type VerifyWebhookInput, type WebhookCreate, type WebhookDeadLetter, type WebhookSubscription, type WebhookTestResult, type WebhookUpdate, createCookieMunch, verifyWebhookSignature };
|
|
1714
|
+
export { type AbResult, type AccountOrg, type AccountOrgs, type AdPersonalizationInput, type AiInspectInput, type AiInspectResult, type ApiKey, type ApiKeyIssueInput, type ApiKeyIssued, type ApiKeyPrefix, type ApiKeyUpdate, type AppliedImport, type AssetUpload, type AuditEntry, type BannerRecord, type BannerSummary, type BlockedReport, type BrandExtractionResult, type BrandKit, type BrandKitCreate, type BrandSuggestion, type BulkSiteInput, type BulkSiteResult, type CategorizedCookie, type ChildKeyInput, type ConfigChange, type ConfigDryRun, type ConfigWarning, type ConsentDay, type ConsentDecisionInput, type ConsentIngestInput, type ConsentLogRow, type CookieDeclaration, CookieMunchApiError, type CookieMunchClient, type CookieMunchOptions, type CspSources, type DeclarationWarning, type DeclaredCookie, type DeclaredCookieInput, type DsarCreate, type DsarEraseResult, type DsarExecutor, type DsarExecutorCreated, type DsarExecutorInput, type DsarExportResult, type DsarRequest, type DsarStatus, type DsarTask, type DsarTaskEvent, type DsarTaskExport, type DsarTaskLogEntry, type DsarTaskOutcome, type DsarType, type EnforcementRuleInput, type ExecutorProfile, type ExecutorTestInput, type ExecutorTestResult, type FlowIssue, type FlowOp, type FlowOpResponse, type FulfillmentOp, type Identifier, type Identity, type ImportedCookie, type ImportedDeclaration, type InstallSnippet, type LegalBasis, type LogQuery, type Member, type OptInMethod, type Org, type OrgUpdate, type PlanSource, type PolicyOptions, type PreferenceItem, type PreferenceRecord, type PreviewToken, type PreviewTokenOptions, type ProfileAttributeInput, type PutConfigOptions, type RangeQuery, type Regulation, type RegulationSummary, type RegulatoryFeedResult, type ResellerChild, type ResellerChildCreate, type ResellerChildList, type ResellerChildPatch, type RiskScore, type RopaEntry, type RopaInput, type ScanResult, type ScanStatus, type ScoredVendor, type SessionAnalysisInput, type SignedReceipt, type Site, type SiteConfig, type SiteCookie, type SiteCreate, type SiteFlow, type SnippetOptions, type SubscriptionTopicInput, type SupportedLanguage, type Usage, type VendorInput, type VendorRecord, type VerifyResult, type VerifyWebhookInput, type WebhookCreate, type WebhookDeadLetter, type WebhookSubscription, type WebhookTestResult, type WebhookUpdate, createCookieMunch, verifyWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ interface DsarRequest {
|
|
|
111
111
|
/** Where the subject said they are, when the intake captured it. */
|
|
112
112
|
jurisdiction?: string;
|
|
113
113
|
note?: string;
|
|
114
|
-
/** A test request: off the SLA board, labelled, and deletable with `dsar.delete`. */
|
|
114
|
+
/** A test request: off the SLA board, labelled, and deletable with `dsar.delete`. A closed request can be marked one with `dsar.markTest`. */
|
|
115
115
|
test?: boolean;
|
|
116
116
|
}
|
|
117
117
|
interface DsarCreate {
|
|
@@ -251,13 +251,54 @@ interface CategorizedCookie {
|
|
|
251
251
|
provider?: string;
|
|
252
252
|
purpose?: string;
|
|
253
253
|
expiry?: string;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
/** Page URLs (multi-page scan) that set this cookie, earliest first. */
|
|
255
|
+
foundOnPages?: string[];
|
|
256
|
+
/** The site owner declared this cookie; it overrides the scan. */
|
|
257
|
+
declared?: boolean;
|
|
258
|
+
/** A declared `prefix*` wildcard row that no observed cookie matched yet. */
|
|
259
|
+
pattern?: boolean;
|
|
260
|
+
/** Why a person should look at it. Visitors see such cookies under "Unclassified". */
|
|
261
|
+
review?: 'unclassified' | 'category_disabled' | 'category_unknown';
|
|
262
|
+
}
|
|
263
|
+
/** A site's cookie declaration: the latest scan and observed visits with the site's own
|
|
264
|
+
* declarations on top. This is what GET /v1/sites/:cbid/cookies returns. */
|
|
257
265
|
interface CookieDeclaration {
|
|
258
|
-
/** Epoch-ms of the latest scan, or 0 if none. */
|
|
266
|
+
/** Epoch-ms of the latest scan or declaration change, or 0 if none. */
|
|
259
267
|
updatedAt: number;
|
|
260
268
|
cookies: CategorizedCookie[];
|
|
269
|
+
/** The site owner's declarations, as stored. */
|
|
270
|
+
declared?: DeclaredCookie[];
|
|
271
|
+
}
|
|
272
|
+
/** What the site owner says a cookie is (PUT /v1/sites/:cbid/cookies/:name). */
|
|
273
|
+
interface DeclaredCookieInput {
|
|
274
|
+
/** A standard category or one of the site's `categories.custom` ids. Not `unclassified`. */
|
|
275
|
+
category: string;
|
|
276
|
+
/** Shown to visitors. */
|
|
277
|
+
purpose: string;
|
|
278
|
+
provider?: string;
|
|
279
|
+
expiry?: string;
|
|
280
|
+
domain?: string;
|
|
281
|
+
/** Treat the name as a prefix wildcard (a trailing `*` does the same). */
|
|
282
|
+
pattern?: boolean;
|
|
283
|
+
}
|
|
284
|
+
/** A stored declaration. */
|
|
285
|
+
interface DeclaredCookie extends DeclaredCookieInput {
|
|
286
|
+
name: string;
|
|
287
|
+
updatedAt: number;
|
|
288
|
+
}
|
|
289
|
+
/** A warning about a write: e.g. the category is switched off for the site. */
|
|
290
|
+
interface DeclarationWarning {
|
|
291
|
+
field: string;
|
|
292
|
+
reason: string;
|
|
293
|
+
}
|
|
294
|
+
/** What an import with `apply` declared, on top of what it read. */
|
|
295
|
+
interface AppliedImport extends ImportedDeclaration {
|
|
296
|
+
applied: number;
|
|
297
|
+
skipped: Array<{
|
|
298
|
+
name: string;
|
|
299
|
+
reason: string;
|
|
300
|
+
}>;
|
|
301
|
+
warnings?: DeclarationWarning[];
|
|
261
302
|
}
|
|
262
303
|
/** @deprecated The server returns {@link CookieDeclaration}; kept only for back-compat. */
|
|
263
304
|
interface SiteCookie {
|
|
@@ -335,6 +376,10 @@ interface ConfigChange {
|
|
|
335
376
|
from?: unknown;
|
|
336
377
|
to?: unknown;
|
|
337
378
|
}
|
|
379
|
+
/** `PUT …/config` options. `keep: 'unspecified'` keeps the stored value of every top-level field the body omits. */
|
|
380
|
+
interface PutConfigOptions {
|
|
381
|
+
keep?: 'unspecified';
|
|
382
|
+
}
|
|
338
383
|
/** What a config write would do (`?dryRun=1`) — nothing is saved. */
|
|
339
384
|
interface ConfigDryRun {
|
|
340
385
|
dryRun: true;
|
|
@@ -1116,17 +1161,27 @@ interface CookieMunchClient {
|
|
|
1116
1161
|
get(cbid: string): Promise<Site>;
|
|
1117
1162
|
delete(cbid: string): Promise<void>;
|
|
1118
1163
|
getConfig(cbid: string): Promise<SiteConfig>;
|
|
1119
|
-
/**
|
|
1120
|
-
|
|
1121
|
-
|
|
1164
|
+
/**
|
|
1165
|
+
* Replaces the whole config — a top-level field you omit reverts to its default. With
|
|
1166
|
+
* `{ keep: 'unspecified' }` (`?keep=unspecified`) an omitted top-level field keeps its
|
|
1167
|
+
* stored value instead; each field you send is still replaced whole, and one sent as
|
|
1168
|
+
* `null` reverts to its default.
|
|
1169
|
+
*/
|
|
1170
|
+
putConfig(cbid: string, config: SiteConfig, opts?: PutConfigOptions): Promise<SiteConfig>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Changes some of the config — a JSON Merge Patch (RFC 7386): omitted fields keep their
|
|
1173
|
+
* stored value, nested objects merge, and `null` removes a field (it takes its default):
|
|
1174
|
+
* `{ banner: { i18n: { es: null } } }` drops the Spanish override. Arrays replace whole.
|
|
1175
|
+
*/
|
|
1122
1176
|
patchConfig(cbid: string, config: Partial<SiteConfig>): Promise<SiteConfig>;
|
|
1123
1177
|
/**
|
|
1124
1178
|
* Preview a config write without saving it: the merged result and a diff. `mode: 'put'`
|
|
1125
|
-
* previews a replace (the diff then lists everything that would revert to its default)
|
|
1179
|
+
* previews a replace (the diff then lists everything that would revert to its default);
|
|
1180
|
+
* add `keep: 'unspecified'` to preview a replace that keeps omitted fields.
|
|
1126
1181
|
*/
|
|
1127
1182
|
dryRunConfig(cbid: string, config: Partial<SiteConfig>, opts?: {
|
|
1128
1183
|
mode?: 'patch' | 'put';
|
|
1129
|
-
}): Promise<ConfigDryRun>;
|
|
1184
|
+
} & PutConfigOptions): Promise<ConfigDryRun>;
|
|
1130
1185
|
cookies(cbid: string): Promise<CookieDeclaration>;
|
|
1131
1186
|
scan(cbid: string): Promise<ScanStatus>;
|
|
1132
1187
|
scanStatus(cbid: string): Promise<ScanStatus>;
|
|
@@ -1155,6 +1210,36 @@ interface CookieMunchClient {
|
|
|
1155
1210
|
* wrong category is a tag firing against a refusal, so the result is for review.
|
|
1156
1211
|
*/
|
|
1157
1212
|
importDeclaration(cbid: string, data: string): Promise<ImportedDeclaration>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Import AND declare: every row that mapped to one of our categories and has a purpose
|
|
1215
|
+
* is declared; the rest come back in `skipped`. Already-declared cookies are kept
|
|
1216
|
+
* unless `overwrite`.
|
|
1217
|
+
*/
|
|
1218
|
+
applyImport(cbid: string, data: string, opts?: {
|
|
1219
|
+
overwrite?: boolean;
|
|
1220
|
+
}): Promise<AppliedImport>;
|
|
1221
|
+
/**
|
|
1222
|
+
* Declare what one cookie is. Overrides scanned, observed and database classification
|
|
1223
|
+
* in the API, the preference modal and `data-cc="declaration"`. A name ending in `*`
|
|
1224
|
+
* declares a prefix wildcard.
|
|
1225
|
+
*/
|
|
1226
|
+
declareCookie(cbid: string, name: string, input: DeclaredCookieInput): Promise<{
|
|
1227
|
+
cookie: DeclaredCookie;
|
|
1228
|
+
warnings?: DeclarationWarning[];
|
|
1229
|
+
}>;
|
|
1230
|
+
/** Remove a declaration; the scanned classification applies again. */
|
|
1231
|
+
undeclareCookie(cbid: string, name: string): Promise<void>;
|
|
1232
|
+
/** Declare many at once (all-or-nothing). `replace` also removes declarations not listed. */
|
|
1233
|
+
declareCookies(cbid: string, cookies: Array<DeclaredCookieInput & {
|
|
1234
|
+
name: string;
|
|
1235
|
+
}>, opts?: {
|
|
1236
|
+
replace?: boolean;
|
|
1237
|
+
}): Promise<{
|
|
1238
|
+
declared: DeclaredCookie[];
|
|
1239
|
+
saved: number;
|
|
1240
|
+
removed: number;
|
|
1241
|
+
warnings?: DeclarationWarning[];
|
|
1242
|
+
}>;
|
|
1158
1243
|
snippet(cbid: string, opts?: SnippetOptions): Promise<InstallSnippet>;
|
|
1159
1244
|
/**
|
|
1160
1245
|
* Mint a short-lived signed token to see the banner as a visitor in a given region and
|
|
@@ -1235,6 +1320,15 @@ interface CookieMunchClient {
|
|
|
1235
1320
|
* real request cannot be deleted (409 `not_a_test_request`); the deletion is audited.
|
|
1236
1321
|
*/
|
|
1237
1322
|
delete(id: string): Promise<void>;
|
|
1323
|
+
/**
|
|
1324
|
+
* Mark a CLOSED request (completed or rejected) as a test, after the fact — for trials
|
|
1325
|
+
* filed before `test` existed. An open one is refused (409 `request_not_closed`). Audited
|
|
1326
|
+
* as `dsar.marked_test`; afterwards `delete` works on it. `changed` is false on a repeat.
|
|
1327
|
+
*/
|
|
1328
|
+
markTest(id: string): Promise<{
|
|
1329
|
+
request: DsarRequest;
|
|
1330
|
+
changed: boolean;
|
|
1331
|
+
}>;
|
|
1238
1332
|
};
|
|
1239
1333
|
vendors: {
|
|
1240
1334
|
list(): Promise<ScoredVendor[]>;
|
|
@@ -1617,4 +1711,4 @@ interface CookieMunchClient {
|
|
|
1617
1711
|
}
|
|
1618
1712
|
declare function createCookieMunch(opts: CookieMunchOptions): CookieMunchClient;
|
|
1619
1713
|
|
|
1620
|
-
export { type AbResult, type AccountOrg, type AccountOrgs, type AdPersonalizationInput, type AiInspectInput, type AiInspectResult, type ApiKey, type ApiKeyIssueInput, type ApiKeyIssued, type ApiKeyPrefix, type ApiKeyUpdate, type AssetUpload, type AuditEntry, type BannerRecord, type BannerSummary, type BlockedReport, type BrandExtractionResult, type BrandKit, type BrandKitCreate, type BrandSuggestion, type BulkSiteInput, type BulkSiteResult, type CategorizedCookie, type ChildKeyInput, type ConfigChange, type ConfigDryRun, type ConfigWarning, type ConsentDay, type ConsentDecisionInput, type ConsentIngestInput, type ConsentLogRow, type CookieDeclaration, CookieMunchApiError, type CookieMunchClient, type CookieMunchOptions, type CspSources, type DsarCreate, type DsarEraseResult, type DsarExecutor, type DsarExecutorCreated, type DsarExecutorInput, type DsarExportResult, type DsarRequest, type DsarStatus, type DsarTask, type DsarTaskEvent, type DsarTaskExport, type DsarTaskLogEntry, type DsarTaskOutcome, type DsarType, type EnforcementRuleInput, type ExecutorProfile, type ExecutorTestInput, type ExecutorTestResult, type FlowIssue, type FlowOp, type FlowOpResponse, type FulfillmentOp, type Identifier, type Identity, type ImportedCookie, type ImportedDeclaration, type InstallSnippet, type LegalBasis, type LogQuery, type Member, type OptInMethod, type Org, type OrgUpdate, type PlanSource, type PolicyOptions, type PreferenceItem, type PreferenceRecord, type PreviewToken, type PreviewTokenOptions, type ProfileAttributeInput, type RangeQuery, type Regulation, type RegulationSummary, type RegulatoryFeedResult, type ResellerChild, type ResellerChildCreate, type ResellerChildList, type ResellerChildPatch, type RiskScore, type RopaEntry, type RopaInput, type ScanResult, type ScanStatus, type ScoredVendor, type SessionAnalysisInput, type SignedReceipt, type Site, type SiteConfig, type SiteCookie, type SiteCreate, type SiteFlow, type SnippetOptions, type SubscriptionTopicInput, type SupportedLanguage, type Usage, type VendorInput, type VendorRecord, type VerifyResult, type VerifyWebhookInput, type WebhookCreate, type WebhookDeadLetter, type WebhookSubscription, type WebhookTestResult, type WebhookUpdate, createCookieMunch, verifyWebhookSignature };
|
|
1714
|
+
export { type AbResult, type AccountOrg, type AccountOrgs, type AdPersonalizationInput, type AiInspectInput, type AiInspectResult, type ApiKey, type ApiKeyIssueInput, type ApiKeyIssued, type ApiKeyPrefix, type ApiKeyUpdate, type AppliedImport, type AssetUpload, type AuditEntry, type BannerRecord, type BannerSummary, type BlockedReport, type BrandExtractionResult, type BrandKit, type BrandKitCreate, type BrandSuggestion, type BulkSiteInput, type BulkSiteResult, type CategorizedCookie, type ChildKeyInput, type ConfigChange, type ConfigDryRun, type ConfigWarning, type ConsentDay, type ConsentDecisionInput, type ConsentIngestInput, type ConsentLogRow, type CookieDeclaration, CookieMunchApiError, type CookieMunchClient, type CookieMunchOptions, type CspSources, type DeclarationWarning, type DeclaredCookie, type DeclaredCookieInput, type DsarCreate, type DsarEraseResult, type DsarExecutor, type DsarExecutorCreated, type DsarExecutorInput, type DsarExportResult, type DsarRequest, type DsarStatus, type DsarTask, type DsarTaskEvent, type DsarTaskExport, type DsarTaskLogEntry, type DsarTaskOutcome, type DsarType, type EnforcementRuleInput, type ExecutorProfile, type ExecutorTestInput, type ExecutorTestResult, type FlowIssue, type FlowOp, type FlowOpResponse, type FulfillmentOp, type Identifier, type Identity, type ImportedCookie, type ImportedDeclaration, type InstallSnippet, type LegalBasis, type LogQuery, type Member, type OptInMethod, type Org, type OrgUpdate, type PlanSource, type PolicyOptions, type PreferenceItem, type PreferenceRecord, type PreviewToken, type PreviewTokenOptions, type ProfileAttributeInput, type PutConfigOptions, type RangeQuery, type Regulation, type RegulationSummary, type RegulatoryFeedResult, type ResellerChild, type ResellerChildCreate, type ResellerChildList, type ResellerChildPatch, type RiskScore, type RopaEntry, type RopaInput, type ScanResult, type ScanStatus, type ScoredVendor, type SessionAnalysisInput, type SignedReceipt, type Site, type SiteConfig, type SiteCookie, type SiteCreate, type SiteFlow, type SnippetOptions, type SubscriptionTopicInput, type SupportedLanguage, type Usage, type VendorInput, type VendorRecord, type VerifyResult, type VerifyWebhookInput, type WebhookCreate, type WebhookDeadLetter, type WebhookSubscription, type WebhookTestResult, type WebhookUpdate, createCookieMunch, verifyWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -91,9 +91,13 @@ function createCookieMunch(opts) {
|
|
|
91
91
|
await request("DELETE", `/sites/${enc(cbid)}`);
|
|
92
92
|
},
|
|
93
93
|
getConfig: (cbid) => get(`/sites/${enc(cbid)}/config`),
|
|
94
|
-
putConfig: (cbid, config) => request("PUT", `/sites/${enc(cbid)}/config`, config),
|
|
94
|
+
putConfig: (cbid, config, opts2) => request("PUT", `/sites/${enc(cbid)}/config${qs({ keep: opts2?.keep })}`, config),
|
|
95
95
|
patchConfig: (cbid, config) => request("PATCH", `/sites/${enc(cbid)}/config`, config),
|
|
96
|
-
dryRunConfig: (cbid, config, opts2) => request(
|
|
96
|
+
dryRunConfig: (cbid, config, opts2) => request(
|
|
97
|
+
opts2?.mode === "put" ? "PUT" : "PATCH",
|
|
98
|
+
`/sites/${enc(cbid)}/config${qs({ dryRun: 1, keep: opts2?.mode === "put" ? opts2.keep : void 0 })}`,
|
|
99
|
+
config
|
|
100
|
+
),
|
|
97
101
|
cookies: (cbid) => get(`/sites/${enc(cbid)}/cookies`),
|
|
98
102
|
scan: (cbid) => request("POST", `/sites/${enc(cbid)}/scan`),
|
|
99
103
|
scanStatus: (cbid) => get(`/sites/${enc(cbid)}/scan`),
|
|
@@ -109,6 +113,12 @@ function createCookieMunch(opts) {
|
|
|
109
113
|
banner: (cbid) => get(`/sites/${enc(cbid)}/banner`),
|
|
110
114
|
blocked: (cbid) => get(`/sites/${enc(cbid)}/blocked`),
|
|
111
115
|
importDeclaration: (cbid, data) => request("POST", `/sites/${enc(cbid)}/import`, { data }),
|
|
116
|
+
applyImport: (cbid, data, o) => request("POST", `/sites/${enc(cbid)}/import${qs({ apply: "1", overwrite: o?.overwrite ? "1" : void 0 })}`, { data }),
|
|
117
|
+
declareCookie: (cbid, name, input) => request("PUT", `/sites/${enc(cbid)}/cookies/${enc(name)}`, input),
|
|
118
|
+
undeclareCookie: async (cbid, name) => {
|
|
119
|
+
await request("DELETE", `/sites/${enc(cbid)}/cookies/${enc(name)}`);
|
|
120
|
+
},
|
|
121
|
+
declareCookies: (cbid, cookies, o) => request("PUT", `/sites/${enc(cbid)}/cookies`, { cookies, ...o?.replace ? { replace: true } : {} }),
|
|
112
122
|
snippet: (cbid, opts2) => get(`/sites/${enc(cbid)}/snippet${qs({ blockingmode: opts2?.blockingMode, culture: opts2?.culture })}`),
|
|
113
123
|
previewToken: (cbid, o) => request("POST", `/sites/${enc(cbid)}/preview-token`, o ?? {}),
|
|
114
124
|
verify: (cbid, method) => request("POST", `/sites/${enc(cbid)}/verify`, { method }),
|
|
@@ -156,7 +166,8 @@ function createCookieMunch(opts) {
|
|
|
156
166
|
export: (id, cbid, stamp) => request("POST", `/dsar/${enc(id)}/export`, { cbid, stamp }),
|
|
157
167
|
delete: async (id) => {
|
|
158
168
|
await request("DELETE", `/dsar/${enc(id)}`);
|
|
159
|
-
}
|
|
169
|
+
},
|
|
170
|
+
markTest: (id) => request("POST", `/dsar/${enc(id)}/mark-test`)
|
|
160
171
|
},
|
|
161
172
|
vendors: {
|
|
162
173
|
list: () => get("/vendors"),
|