@cookiemunch/sdk 0.5.0 → 0.5.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.d.cts CHANGED
@@ -418,7 +418,7 @@ declare function mintConsentSyncToken(input: MintConsentSyncTokenInput): string;
418
418
  * This package's version, sent in the default User-Agent. Cloudflare answers a request with
419
419
  * no recognisable User-Agent with `403 error code: 1010`; a test pins this to package.json.
420
420
  */
421
- declare const SDK_VERSION = "0.5.0";
421
+ declare const SDK_VERSION = "0.5.1";
422
422
  interface CookieMunchOptions {
423
423
  apiKey: string;
424
424
  /** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
package/dist/index.d.ts CHANGED
@@ -418,7 +418,7 @@ declare function mintConsentSyncToken(input: MintConsentSyncTokenInput): string;
418
418
  * This package's version, sent in the default User-Agent. Cloudflare answers a request with
419
419
  * no recognisable User-Agent with `403 error code: 1010`; a test pins this to package.json.
420
420
  */
421
- declare const SDK_VERSION = "0.5.0";
421
+ declare const SDK_VERSION = "0.5.1";
422
422
  interface CookieMunchOptions {
423
423
  apiKey: string;
424
424
  /** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ function mintConsentSyncToken(input) {
42
42
  }
43
43
 
44
44
  // src/index.ts
45
- var SDK_VERSION = "0.5.0";
45
+ var SDK_VERSION = "0.5.1";
46
46
  var CookieMunchApiError = class extends Error {
47
47
  constructor(status, message, code, body) {
48
48
  super(message);
@@ -134,7 +134,7 @@ function createCookieMunch(opts) {
134
134
  const asked = Math.max(0, Math.min(6e4, left));
135
135
  const t0 = Date.now();
136
136
  const s = await get(`/sites/${enc(cbid)}/scan${qs({ wait: asked / 1e3 })}`);
137
- if (s.status !== "scanning" || until - Date.now() <= 0) return s;
137
+ if (s.status !== "scanning" || until - Date.now() < 50) return s;
138
138
  const early = Math.min(1e3, until - Date.now()) - (Date.now() - t0);
139
139
  if (early > 0) await new Promise((r) => setTimeout(r, early));
140
140
  }