@cookiemunch/sdk 0.2.0 → 0.3.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.d.cts CHANGED
@@ -296,8 +296,34 @@ interface CategorizedCookie {
296
296
  declared?: boolean;
297
297
  /** A declared `prefix*` wildcard row that no observed cookie matched yet. */
298
298
  pattern?: boolean;
299
- /** Why a person should look at it. Visitors see such cookies under "Unclassified". */
300
- review?: 'unclassified' | 'category_disabled' | 'category_unknown';
299
+ /**
300
+ * Why a person should look at it. Visitors see unclassified and category ones under
301
+ * "Unclassified"; `retired_but_seen` = retired, but a crawl or a visit saw it since, so the
302
+ * site still sets it and it is listed again.
303
+ */
304
+ review?: 'unclassified' | 'category_disabled' | 'category_unknown' | 'retired_but_seen';
305
+ /** Epoch-ms a crawl or a real visit last saw it. Absent on older rows. */
306
+ lastSeenAt?: number;
307
+ /** Owner views only: the site owner retired this cookie (see `sites.retireCookie`). */
308
+ retired?: {
309
+ at: number;
310
+ renamedTo?: string;
311
+ note?: string;
312
+ by?: string;
313
+ pattern?: string;
314
+ };
315
+ }
316
+ /** A cookie the site owner retired: the site renamed or stopped setting it. */
317
+ interface RetiredCookie {
318
+ /** Exact name, or a `prefix*` wildcard. */
319
+ name: string;
320
+ /** Epoch-ms it was retired; anything seen after this brings it back. */
321
+ at: number;
322
+ renamedTo?: string;
323
+ note?: string;
324
+ /** `apikey:<prefix>` or a dashboard user id. */
325
+ by?: string;
326
+ pattern?: boolean;
301
327
  }
302
328
  /** A site's cookie declaration: the latest scan and observed visits with the site's own
303
329
  * declarations on top. This is what GET /v1/sites/:cbid/cookies returns. */
@@ -307,6 +333,8 @@ interface CookieDeclaration {
307
333
  cookies: CategorizedCookie[];
308
334
  /** The site owner's declarations, as stored. */
309
335
  declared?: DeclaredCookie[];
336
+ /** The site's retirements, as stored (owner views only). */
337
+ retired?: RetiredCookie[];
310
338
  }
311
339
  /** What the site owner says a cookie is (PUT /v1/sites/:cbid/cookies/:name). */
312
340
  interface DeclaredCookieInput {
@@ -374,11 +402,24 @@ interface SiteCookie {
374
402
  }
375
403
  /** Cookie-scan status, from GET /v1/sites/:cbid/scan. */
376
404
  interface ScanStatus {
405
+ /** `scanning` while the last scan is queued or crawling. Kept for older clients; read `state`. */
377
406
  status: 'idle' | 'scanning';
378
407
  /** Epoch-ms of the last completed scan, or null. */
379
408
  lastScannedAt: number | null;
380
409
  /** What the last scan saw of the live banner's Accept all / Reject all. Absent until measured. */
381
410
  buttonParity?: ButtonParityScan;
411
+ /** Where the last scan is. Absent when the site was never scanned. */
412
+ state?: 'queued' | 'scanning' | 'done' | 'failed';
413
+ scanId?: string;
414
+ startedAt?: number;
415
+ finishedAt?: number;
416
+ durationMs?: number;
417
+ /** Cookies this crawl saw (the stored list also keeps earlier finds: `keptFromEarlier`). */
418
+ cookieCount?: number;
419
+ keptFromEarlier?: number;
420
+ pagesVisited?: number;
421
+ /** Why it failed. */
422
+ error?: string;
382
423
  }
383
424
  /** Consent-button parity of the banner a real browser saw on the site (see ScanStatus). */
384
425
  interface ButtonParityScan {
@@ -539,6 +580,18 @@ interface ButtonParityLint {
539
580
  score: number;
540
581
  suggestedReject: SuggestedRejectStyle[];
541
582
  }
583
+ /**
584
+ * Scrollbars on the surfaces Cookie Munch renders — the same shape on the banner theme (`theme.scrollbar`)
585
+ * and the rights-page theme. Colours are #hex, rgb() or hsl(); width is clamped to 4–16, radius to 0–999.
586
+ */
587
+ interface ScrollbarTheme {
588
+ style: 'themed' | 'thin' | 'native' | 'hidden';
589
+ thumb?: string;
590
+ thumbHover?: string;
591
+ track?: string;
592
+ width?: number;
593
+ radius?: number;
594
+ }
542
595
  /** The hosted rights page document. See docs/rights-page for each section type's props. */
543
596
  interface RightsPageDocument {
544
597
  v: 1;
@@ -547,6 +600,7 @@ interface RightsPageDocument {
547
600
  width: 'narrow' | 'normal' | 'wide' | 'full';
548
601
  density: 'compact' | 'comfortable' | 'spacious';
549
602
  colorScheme: 'light' | 'dark' | 'auto';
603
+ scrollbar?: ScrollbarTheme;
550
604
  [k: string]: unknown;
551
605
  };
552
606
  sections: Array<{
@@ -1526,8 +1580,9 @@ interface DsarExecutorInput {
1526
1580
  secretKey: string;
1527
1581
  /**
1528
1582
  * The signing secret of its webhook endpoint. Optional — polling closes tasks without it.
1529
- * A `whsec_<base64>` secret verifies a delivery signed with either the base64-decoded bytes
1530
- * or the literal string; anything else only with its UTF-8 bytes.
1583
+ * A `whsec_<base64>` secret (standard base64 or base64url, padded or not) verifies a delivery
1584
+ * signed with either the base64-decoded bytes or the literal string; anything else only with
1585
+ * its UTF-8 bytes.
1531
1586
  */
1532
1587
  webhookSecret?: string;
1533
1588
  auto?: boolean;
@@ -1714,8 +1769,24 @@ interface CookieMunchClient {
1714
1769
  replace?: boolean;
1715
1770
  }): Promise<ButtonParityLint>;
1716
1771
  cookies(cbid: string): Promise<CookieDeclaration>;
1717
- scan(cbid: string): Promise<ScanStatus>;
1718
- scanStatus(cbid: string): Promise<ScanStatus>;
1772
+ /**
1773
+ * Start a cookie crawl. Answers at once with `scanId` and `state: 'queued'`; `wait`
1774
+ * (seconds, ≤60) holds the request until the scan is done or failed.
1775
+ */
1776
+ scan(cbid: string, opts?: {
1777
+ wait?: number;
1778
+ }): Promise<ScanStatus>;
1779
+ /** The last scan's state. `wait` (seconds, ≤60) holds the request until a running scan settles. */
1780
+ scanStatus(cbid: string, opts?: {
1781
+ wait?: number;
1782
+ }): Promise<ScanStatus>;
1783
+ /**
1784
+ * Resolve once the site's scan is done or failed (read `state` and `error`), long-polling
1785
+ * the server. At `timeoutMs` (default 120 000) it resolves with the still-running state.
1786
+ */
1787
+ waitForScan(cbid: string, opts?: {
1788
+ timeoutMs?: number;
1789
+ }): Promise<ScanStatus>;
1719
1790
  ab(cbid: string): Promise<AbResult[]>;
1720
1791
  /** Generate the site's privacy and cookie policy, as Markdown. */
1721
1792
  policy(cbid: string, opts?: PolicyOptions): Promise<string>;
@@ -1761,6 +1832,32 @@ interface CookieMunchClient {
1761
1832
  cookie: DeclaredCookie;
1762
1833
  warnings?: DeclarationWarning[];
1763
1834
  } & Partial<DeclarationDryRun>>;
1835
+ /**
1836
+ * Retire a cookie the site renamed or stopped setting: it leaves the banner's list,
1837
+ * `data-cc="declaration"` and the public feed, and stays listed for you with `retired`.
1838
+ * A name ending in `*` retires every cookie with that prefix. If a crawl or a visit sees
1839
+ * it again afterwards it is listed again, flagged `review: 'retired_but_seen'`.
1840
+ */
1841
+ retireCookie(cbid: string, name: string, input?: {
1842
+ renamedTo?: string;
1843
+ note?: string;
1844
+ }, opts?: {
1845
+ dryRun?: boolean;
1846
+ }): Promise<{
1847
+ cookie: RetiredCookie;
1848
+ matched: string[];
1849
+ dryRun?: true;
1850
+ retired?: RetiredCookie[];
1851
+ }>;
1852
+ /** Un-retire a cookie: it is listed again everywhere. */
1853
+ unretireCookie(cbid: string, name: string): Promise<void>;
1854
+ /** What un-retiring would leave; nothing is removed. */
1855
+ unretireCookie(cbid: string, name: string, opts: {
1856
+ dryRun: true;
1857
+ }): Promise<{
1858
+ dryRun: true;
1859
+ retired: RetiredCookie[];
1860
+ }>;
1764
1861
  /** Remove a declaration; the scanned classification applies again. */
1765
1862
  undeclareCookie(cbid: string, name: string): Promise<void>;
1766
1863
  /** What removing a declaration would leave; nothing is removed. */
@@ -2352,4 +2449,4 @@ interface CookieMunchClient {
2352
2449
  }
2353
2450
  declare function createCookieMunch(opts: CookieMunchOptions): CookieMunchClient;
2354
2451
 
2355
- 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 ButtonParityFinding, type ButtonParityLint, type ButtonParityScan, 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 DeclarationDiff, type DeclarationDryRun, type DeclarationWarning, type DeclaredCookie, type DeclaredCookieInput, type DnsRecordInstruction, type DsarCreate, type DsarEraseResult, type DsarExecutor, type DsarExecutorCreated, type DsarExecutorDryRun, type DsarExecutorInput, type DsarExecutorPatch, 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 ExecutorWebhookDelivery, type ExecutorWebhookTestResult, type FlowIssue, type FlowOp, type FlowOpResponse, type FulfillmentOp, type Identifier, type Identity, type ImportedCookie, type ImportedDeclaration, type InstallSnippet, type LegalBasis, type LogQuery, type MailProvider, type MailProviderInput, type MailProviderKind, type MailProviderTestResult, type Member, type OptInMethod, type Org, type OrgUpdate, type ParityControlSummary, type PlanSource, type PolicyOptions, type PreferenceItem, type PreferenceRecord, type PreviewToken, type PreviewTokenOptions, type ProfileAttributeInput, type PublicDsarFiled, type PublicDsarPending, type PublicVerification, type PutConfigOptions, type RangeQuery, type Regulation, type RegulationSummary, type RegulatoryFeedResult, type ResellerChild, type ResellerChildCreate, type ResellerChildList, type ResellerChildPatch, type RightKind, type RightsCaptcha, type RightsCaptchaInput, type RightsCaptchaProvider, type RightsIdentity, type RightsIdentityInput, type RightsIdentityType, type RightsLink, type RightsLinkInput, type RightsPageDocument, type RightsPageDomain, type RightsPageDomainList, type RightsPageDraft, type RightsPageDraftConflict, type RightsPageDryRun, type RightsPageIssue, type RightsPagePublishResult, type RightsPagePublished, type RightsPagePublisher, type RightsPageVersions, type RightsPageWriteOptions, 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 SuggestedRejectStyle, type SupportedLanguage, type Usage, type VendorInput, type VendorRecord, type VerifyResult, type VerifyWebhookInput, type WebhookCreate, type WebhookDeadLetter, type WebhookKeyForm, type WebhookStage, type WebhookSubscription, type WebhookTestResult, type WebhookUpdate, createCookieMunch, verifyWebhookSignature };
2452
+ 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 ButtonParityFinding, type ButtonParityLint, type ButtonParityScan, 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 DeclarationDiff, type DeclarationDryRun, type DeclarationWarning, type DeclaredCookie, type DeclaredCookieInput, type DnsRecordInstruction, type DsarCreate, type DsarEraseResult, type DsarExecutor, type DsarExecutorCreated, type DsarExecutorDryRun, type DsarExecutorInput, type DsarExecutorPatch, 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 ExecutorWebhookDelivery, type ExecutorWebhookTestResult, type FlowIssue, type FlowOp, type FlowOpResponse, type FulfillmentOp, type Identifier, type Identity, type ImportedCookie, type ImportedDeclaration, type InstallSnippet, type LegalBasis, type LogQuery, type MailProvider, type MailProviderInput, type MailProviderKind, type MailProviderTestResult, type Member, type OptInMethod, type Org, type OrgUpdate, type ParityControlSummary, type PlanSource, type PolicyOptions, type PreferenceItem, type PreferenceRecord, type PreviewToken, type PreviewTokenOptions, type ProfileAttributeInput, type PublicDsarFiled, type PublicDsarPending, type PublicVerification, type PutConfigOptions, type RangeQuery, type Regulation, type RegulationSummary, type RegulatoryFeedResult, type ResellerChild, type ResellerChildCreate, type ResellerChildList, type ResellerChildPatch, type RetiredCookie, type RightKind, type RightsCaptcha, type RightsCaptchaInput, type RightsCaptchaProvider, type RightsIdentity, type RightsIdentityInput, type RightsIdentityType, type RightsLink, type RightsLinkInput, type RightsPageDocument, type RightsPageDomain, type RightsPageDomainList, type RightsPageDraft, type RightsPageDraftConflict, type RightsPageDryRun, type RightsPageIssue, type RightsPagePublishResult, type RightsPagePublished, type RightsPagePublisher, type RightsPageVersions, type RightsPageWriteOptions, type RiskScore, type RopaEntry, type RopaInput, type ScanResult, type ScanStatus, type ScoredVendor, type ScrollbarTheme, type SessionAnalysisInput, type SignedReceipt, type Site, type SiteConfig, type SiteCookie, type SiteCreate, type SiteFlow, type SnippetOptions, type SubscriptionTopicInput, type SuggestedRejectStyle, type SupportedLanguage, type Usage, type VendorInput, type VendorRecord, type VerifyResult, type VerifyWebhookInput, type WebhookCreate, type WebhookDeadLetter, type WebhookKeyForm, type WebhookStage, type WebhookSubscription, type WebhookTestResult, type WebhookUpdate, createCookieMunch, verifyWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -296,8 +296,34 @@ interface CategorizedCookie {
296
296
  declared?: boolean;
297
297
  /** A declared `prefix*` wildcard row that no observed cookie matched yet. */
298
298
  pattern?: boolean;
299
- /** Why a person should look at it. Visitors see such cookies under "Unclassified". */
300
- review?: 'unclassified' | 'category_disabled' | 'category_unknown';
299
+ /**
300
+ * Why a person should look at it. Visitors see unclassified and category ones under
301
+ * "Unclassified"; `retired_but_seen` = retired, but a crawl or a visit saw it since, so the
302
+ * site still sets it and it is listed again.
303
+ */
304
+ review?: 'unclassified' | 'category_disabled' | 'category_unknown' | 'retired_but_seen';
305
+ /** Epoch-ms a crawl or a real visit last saw it. Absent on older rows. */
306
+ lastSeenAt?: number;
307
+ /** Owner views only: the site owner retired this cookie (see `sites.retireCookie`). */
308
+ retired?: {
309
+ at: number;
310
+ renamedTo?: string;
311
+ note?: string;
312
+ by?: string;
313
+ pattern?: string;
314
+ };
315
+ }
316
+ /** A cookie the site owner retired: the site renamed or stopped setting it. */
317
+ interface RetiredCookie {
318
+ /** Exact name, or a `prefix*` wildcard. */
319
+ name: string;
320
+ /** Epoch-ms it was retired; anything seen after this brings it back. */
321
+ at: number;
322
+ renamedTo?: string;
323
+ note?: string;
324
+ /** `apikey:<prefix>` or a dashboard user id. */
325
+ by?: string;
326
+ pattern?: boolean;
301
327
  }
302
328
  /** A site's cookie declaration: the latest scan and observed visits with the site's own
303
329
  * declarations on top. This is what GET /v1/sites/:cbid/cookies returns. */
@@ -307,6 +333,8 @@ interface CookieDeclaration {
307
333
  cookies: CategorizedCookie[];
308
334
  /** The site owner's declarations, as stored. */
309
335
  declared?: DeclaredCookie[];
336
+ /** The site's retirements, as stored (owner views only). */
337
+ retired?: RetiredCookie[];
310
338
  }
311
339
  /** What the site owner says a cookie is (PUT /v1/sites/:cbid/cookies/:name). */
312
340
  interface DeclaredCookieInput {
@@ -374,11 +402,24 @@ interface SiteCookie {
374
402
  }
375
403
  /** Cookie-scan status, from GET /v1/sites/:cbid/scan. */
376
404
  interface ScanStatus {
405
+ /** `scanning` while the last scan is queued or crawling. Kept for older clients; read `state`. */
377
406
  status: 'idle' | 'scanning';
378
407
  /** Epoch-ms of the last completed scan, or null. */
379
408
  lastScannedAt: number | null;
380
409
  /** What the last scan saw of the live banner's Accept all / Reject all. Absent until measured. */
381
410
  buttonParity?: ButtonParityScan;
411
+ /** Where the last scan is. Absent when the site was never scanned. */
412
+ state?: 'queued' | 'scanning' | 'done' | 'failed';
413
+ scanId?: string;
414
+ startedAt?: number;
415
+ finishedAt?: number;
416
+ durationMs?: number;
417
+ /** Cookies this crawl saw (the stored list also keeps earlier finds: `keptFromEarlier`). */
418
+ cookieCount?: number;
419
+ keptFromEarlier?: number;
420
+ pagesVisited?: number;
421
+ /** Why it failed. */
422
+ error?: string;
382
423
  }
383
424
  /** Consent-button parity of the banner a real browser saw on the site (see ScanStatus). */
384
425
  interface ButtonParityScan {
@@ -539,6 +580,18 @@ interface ButtonParityLint {
539
580
  score: number;
540
581
  suggestedReject: SuggestedRejectStyle[];
541
582
  }
583
+ /**
584
+ * Scrollbars on the surfaces Cookie Munch renders — the same shape on the banner theme (`theme.scrollbar`)
585
+ * and the rights-page theme. Colours are #hex, rgb() or hsl(); width is clamped to 4–16, radius to 0–999.
586
+ */
587
+ interface ScrollbarTheme {
588
+ style: 'themed' | 'thin' | 'native' | 'hidden';
589
+ thumb?: string;
590
+ thumbHover?: string;
591
+ track?: string;
592
+ width?: number;
593
+ radius?: number;
594
+ }
542
595
  /** The hosted rights page document. See docs/rights-page for each section type's props. */
543
596
  interface RightsPageDocument {
544
597
  v: 1;
@@ -547,6 +600,7 @@ interface RightsPageDocument {
547
600
  width: 'narrow' | 'normal' | 'wide' | 'full';
548
601
  density: 'compact' | 'comfortable' | 'spacious';
549
602
  colorScheme: 'light' | 'dark' | 'auto';
603
+ scrollbar?: ScrollbarTheme;
550
604
  [k: string]: unknown;
551
605
  };
552
606
  sections: Array<{
@@ -1526,8 +1580,9 @@ interface DsarExecutorInput {
1526
1580
  secretKey: string;
1527
1581
  /**
1528
1582
  * The signing secret of its webhook endpoint. Optional — polling closes tasks without it.
1529
- * A `whsec_<base64>` secret verifies a delivery signed with either the base64-decoded bytes
1530
- * or the literal string; anything else only with its UTF-8 bytes.
1583
+ * A `whsec_<base64>` secret (standard base64 or base64url, padded or not) verifies a delivery
1584
+ * signed with either the base64-decoded bytes or the literal string; anything else only with
1585
+ * its UTF-8 bytes.
1531
1586
  */
1532
1587
  webhookSecret?: string;
1533
1588
  auto?: boolean;
@@ -1714,8 +1769,24 @@ interface CookieMunchClient {
1714
1769
  replace?: boolean;
1715
1770
  }): Promise<ButtonParityLint>;
1716
1771
  cookies(cbid: string): Promise<CookieDeclaration>;
1717
- scan(cbid: string): Promise<ScanStatus>;
1718
- scanStatus(cbid: string): Promise<ScanStatus>;
1772
+ /**
1773
+ * Start a cookie crawl. Answers at once with `scanId` and `state: 'queued'`; `wait`
1774
+ * (seconds, ≤60) holds the request until the scan is done or failed.
1775
+ */
1776
+ scan(cbid: string, opts?: {
1777
+ wait?: number;
1778
+ }): Promise<ScanStatus>;
1779
+ /** The last scan's state. `wait` (seconds, ≤60) holds the request until a running scan settles. */
1780
+ scanStatus(cbid: string, opts?: {
1781
+ wait?: number;
1782
+ }): Promise<ScanStatus>;
1783
+ /**
1784
+ * Resolve once the site's scan is done or failed (read `state` and `error`), long-polling
1785
+ * the server. At `timeoutMs` (default 120 000) it resolves with the still-running state.
1786
+ */
1787
+ waitForScan(cbid: string, opts?: {
1788
+ timeoutMs?: number;
1789
+ }): Promise<ScanStatus>;
1719
1790
  ab(cbid: string): Promise<AbResult[]>;
1720
1791
  /** Generate the site's privacy and cookie policy, as Markdown. */
1721
1792
  policy(cbid: string, opts?: PolicyOptions): Promise<string>;
@@ -1761,6 +1832,32 @@ interface CookieMunchClient {
1761
1832
  cookie: DeclaredCookie;
1762
1833
  warnings?: DeclarationWarning[];
1763
1834
  } & Partial<DeclarationDryRun>>;
1835
+ /**
1836
+ * Retire a cookie the site renamed or stopped setting: it leaves the banner's list,
1837
+ * `data-cc="declaration"` and the public feed, and stays listed for you with `retired`.
1838
+ * A name ending in `*` retires every cookie with that prefix. If a crawl or a visit sees
1839
+ * it again afterwards it is listed again, flagged `review: 'retired_but_seen'`.
1840
+ */
1841
+ retireCookie(cbid: string, name: string, input?: {
1842
+ renamedTo?: string;
1843
+ note?: string;
1844
+ }, opts?: {
1845
+ dryRun?: boolean;
1846
+ }): Promise<{
1847
+ cookie: RetiredCookie;
1848
+ matched: string[];
1849
+ dryRun?: true;
1850
+ retired?: RetiredCookie[];
1851
+ }>;
1852
+ /** Un-retire a cookie: it is listed again everywhere. */
1853
+ unretireCookie(cbid: string, name: string): Promise<void>;
1854
+ /** What un-retiring would leave; nothing is removed. */
1855
+ unretireCookie(cbid: string, name: string, opts: {
1856
+ dryRun: true;
1857
+ }): Promise<{
1858
+ dryRun: true;
1859
+ retired: RetiredCookie[];
1860
+ }>;
1764
1861
  /** Remove a declaration; the scanned classification applies again. */
1765
1862
  undeclareCookie(cbid: string, name: string): Promise<void>;
1766
1863
  /** What removing a declaration would leave; nothing is removed. */
@@ -2352,4 +2449,4 @@ interface CookieMunchClient {
2352
2449
  }
2353
2450
  declare function createCookieMunch(opts: CookieMunchOptions): CookieMunchClient;
2354
2451
 
2355
- 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 ButtonParityFinding, type ButtonParityLint, type ButtonParityScan, 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 DeclarationDiff, type DeclarationDryRun, type DeclarationWarning, type DeclaredCookie, type DeclaredCookieInput, type DnsRecordInstruction, type DsarCreate, type DsarEraseResult, type DsarExecutor, type DsarExecutorCreated, type DsarExecutorDryRun, type DsarExecutorInput, type DsarExecutorPatch, 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 ExecutorWebhookDelivery, type ExecutorWebhookTestResult, type FlowIssue, type FlowOp, type FlowOpResponse, type FulfillmentOp, type Identifier, type Identity, type ImportedCookie, type ImportedDeclaration, type InstallSnippet, type LegalBasis, type LogQuery, type MailProvider, type MailProviderInput, type MailProviderKind, type MailProviderTestResult, type Member, type OptInMethod, type Org, type OrgUpdate, type ParityControlSummary, type PlanSource, type PolicyOptions, type PreferenceItem, type PreferenceRecord, type PreviewToken, type PreviewTokenOptions, type ProfileAttributeInput, type PublicDsarFiled, type PublicDsarPending, type PublicVerification, type PutConfigOptions, type RangeQuery, type Regulation, type RegulationSummary, type RegulatoryFeedResult, type ResellerChild, type ResellerChildCreate, type ResellerChildList, type ResellerChildPatch, type RightKind, type RightsCaptcha, type RightsCaptchaInput, type RightsCaptchaProvider, type RightsIdentity, type RightsIdentityInput, type RightsIdentityType, type RightsLink, type RightsLinkInput, type RightsPageDocument, type RightsPageDomain, type RightsPageDomainList, type RightsPageDraft, type RightsPageDraftConflict, type RightsPageDryRun, type RightsPageIssue, type RightsPagePublishResult, type RightsPagePublished, type RightsPagePublisher, type RightsPageVersions, type RightsPageWriteOptions, 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 SuggestedRejectStyle, type SupportedLanguage, type Usage, type VendorInput, type VendorRecord, type VerifyResult, type VerifyWebhookInput, type WebhookCreate, type WebhookDeadLetter, type WebhookKeyForm, type WebhookStage, type WebhookSubscription, type WebhookTestResult, type WebhookUpdate, createCookieMunch, verifyWebhookSignature };
2452
+ 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 ButtonParityFinding, type ButtonParityLint, type ButtonParityScan, 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 DeclarationDiff, type DeclarationDryRun, type DeclarationWarning, type DeclaredCookie, type DeclaredCookieInput, type DnsRecordInstruction, type DsarCreate, type DsarEraseResult, type DsarExecutor, type DsarExecutorCreated, type DsarExecutorDryRun, type DsarExecutorInput, type DsarExecutorPatch, 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 ExecutorWebhookDelivery, type ExecutorWebhookTestResult, type FlowIssue, type FlowOp, type FlowOpResponse, type FulfillmentOp, type Identifier, type Identity, type ImportedCookie, type ImportedDeclaration, type InstallSnippet, type LegalBasis, type LogQuery, type MailProvider, type MailProviderInput, type MailProviderKind, type MailProviderTestResult, type Member, type OptInMethod, type Org, type OrgUpdate, type ParityControlSummary, type PlanSource, type PolicyOptions, type PreferenceItem, type PreferenceRecord, type PreviewToken, type PreviewTokenOptions, type ProfileAttributeInput, type PublicDsarFiled, type PublicDsarPending, type PublicVerification, type PutConfigOptions, type RangeQuery, type Regulation, type RegulationSummary, type RegulatoryFeedResult, type ResellerChild, type ResellerChildCreate, type ResellerChildList, type ResellerChildPatch, type RetiredCookie, type RightKind, type RightsCaptcha, type RightsCaptchaInput, type RightsCaptchaProvider, type RightsIdentity, type RightsIdentityInput, type RightsIdentityType, type RightsLink, type RightsLinkInput, type RightsPageDocument, type RightsPageDomain, type RightsPageDomainList, type RightsPageDraft, type RightsPageDraftConflict, type RightsPageDryRun, type RightsPageIssue, type RightsPagePublishResult, type RightsPagePublished, type RightsPagePublisher, type RightsPageVersions, type RightsPageWriteOptions, type RiskScore, type RopaEntry, type RopaInput, type ScanResult, type ScanStatus, type ScoredVendor, type ScrollbarTheme, type SessionAnalysisInput, type SignedReceipt, type Site, type SiteConfig, type SiteCookie, type SiteCreate, type SiteFlow, type SnippetOptions, type SubscriptionTopicInput, type SuggestedRejectStyle, type SupportedLanguage, type Usage, type VendorInput, type VendorRecord, type VerifyResult, type VerifyWebhookInput, type WebhookCreate, type WebhookDeadLetter, type WebhookKeyForm, type WebhookStage, type WebhookSubscription, type WebhookTestResult, type WebhookUpdate, createCookieMunch, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -104,8 +104,20 @@ function createCookieMunch(opts) {
104
104
  ),
105
105
  lintConfig: (cbid, config, opts2) => request("POST", `/sites/${enc(cbid)}/config/lint${qs({ replace: opts2?.replace ? 1 : void 0 })}`, config),
106
106
  cookies: (cbid) => get(`/sites/${enc(cbid)}/cookies`),
107
- scan: (cbid) => request("POST", `/sites/${enc(cbid)}/scan`),
108
- scanStatus: (cbid) => get(`/sites/${enc(cbid)}/scan`),
107
+ scan: (cbid, o) => request("POST", `/sites/${enc(cbid)}/scan${qs({ wait: o?.wait })}`),
108
+ scanStatus: (cbid, o) => get(`/sites/${enc(cbid)}/scan${qs({ wait: o?.wait })}`),
109
+ waitForScan: async (cbid, o) => {
110
+ const until = Date.now() + (o?.timeoutMs ?? 12e4);
111
+ for (; ; ) {
112
+ const left = until - Date.now();
113
+ const asked = Math.max(0, Math.min(6e4, left));
114
+ const t0 = Date.now();
115
+ const s = await get(`/sites/${enc(cbid)}/scan${qs({ wait: asked / 1e3 })}`);
116
+ if (s.status !== "scanning" || until - Date.now() <= 0) return s;
117
+ const early = Math.min(1e3, until - Date.now()) - (Date.now() - t0);
118
+ if (early > 0) await new Promise((r) => setTimeout(r, early));
119
+ }
120
+ },
109
121
  ab: (cbid) => get(`/sites/${enc(cbid)}/ab`),
110
122
  policy: (cbid, o) => request(
111
123
  "GET",
@@ -120,6 +132,11 @@ function createCookieMunch(opts) {
120
132
  importDeclaration: (cbid, data) => request("POST", `/sites/${enc(cbid)}/import`, { data }),
121
133
  applyImport: (cbid, data, o) => request("POST", `/sites/${enc(cbid)}/import${qs({ apply: "1", overwrite: o?.overwrite ? "1" : void 0 })}`, { data }),
122
134
  declareCookie: (cbid, name, input, o) => request("PUT", `/sites/${enc(cbid)}/cookies/${enc(name)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
135
+ retireCookie: (cbid, name, input, o) => request("POST", `/sites/${enc(cbid)}/cookies/${enc(name)}/retire${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input ?? {}),
136
+ unretireCookie: (async (cbid, name, o) => {
137
+ const out = await request("DELETE", `/sites/${enc(cbid)}/cookies/${enc(name)}/retire${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
138
+ return o?.dryRun ? out : void 0;
139
+ }),
123
140
  undeclareCookie: (async (cbid, name, o) => {
124
141
  const out = await request("DELETE", `/sites/${enc(cbid)}/cookies/${enc(name)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`);
125
142
  return o?.dryRun ? out : void 0;