@apify/utilities 2.29.3 → 2.30.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/cjs/index.d.ts CHANGED
@@ -494,7 +494,7 @@ declare function publicEncrypt({ publicKey, value }: EncryptOptions): {
494
494
  * @param encryptedValue {string} Content in Base64 encrypted using AES cipher
495
495
  * @returns {string}
496
496
  */
497
- declare function privateDecrypt({ privateKey, encryptedPassword, encryptedValue, }: DecryptOptions): string;
497
+ declare function privateDecrypt({ privateKey, encryptedPassword, encryptedValue }: DecryptOptions): string;
498
498
 
499
499
  /**
500
500
  * Extract import statements from the code.
package/esm/index.d.mts CHANGED
@@ -494,7 +494,7 @@ declare function publicEncrypt({ publicKey, value }: EncryptOptions): {
494
494
  * @param encryptedValue {string} Content in Base64 encrypted using AES cipher
495
495
  * @returns {string}
496
496
  */
497
- declare function privateDecrypt({ privateKey, encryptedPassword, encryptedValue, }: DecryptOptions): string;
497
+ declare function privateDecrypt({ privateKey, encryptedPassword, encryptedValue }: DecryptOptions): string;
498
498
 
499
499
  /**
500
500
  * Extract import statements from the code.
package/esm/index.mjs CHANGED
@@ -40,13 +40,13 @@ function parseDateFromJson(date) {
40
40
  }
41
41
  __name(parseDateFromJson, "parseDateFromJson");
42
42
  async function delayPromise(millis) {
43
- return new Promise(((resolve) => {
43
+ return new Promise((resolve) => {
44
44
  if (millis > 0) {
45
45
  setTimeout(() => resolve(), millis);
46
46
  } else {
47
47
  resolve();
48
48
  }
49
- }));
49
+ });
50
50
  }
51
51
  __name(delayPromise, "delayPromise");
52
52
  function removeFromArray(array, element) {
@@ -331,14 +331,35 @@ var FORBIDDEN_USERNAMES_REGEXPS = [
331
331
  "challange",
332
332
  "1m-challenge",
333
333
  "1m-usd-challenge",
334
+ "contact-sales",
335
+ "creator",
336
+ "creator-plan",
337
+ "request-an-integration",
338
+ "whitepaper",
339
+ "adviser",
340
+ "crawlee",
341
+ "ultimate-scraper",
342
+ "agent-skills",
334
343
  // Apify platform resources
335
344
  "key-value-store",
336
345
  "request-queue",
337
346
  "request-queues",
338
347
  "builds",
339
348
  "schedule",
349
+ "standby",
350
+ "pay-per-event",
351
+ "pay-per-result",
352
+ "pay-per-usage",
353
+ "ppe",
354
+ "ppr",
355
+ "compute-unit",
356
+ "compute-units",
340
357
  // AI / LLM related
358
+ "agent",
359
+ "agents",
360
+ "agentic",
341
361
  "llms",
362
+ "llm",
342
363
  "openai",
343
364
  "anthropic",
344
365
  "claude",
@@ -348,6 +369,124 @@ var FORBIDDEN_USERNAMES_REGEXPS = [
348
369
  "prompts",
349
370
  "embeddings",
350
371
  "vectors",
372
+ "rag",
373
+ // Agentic protocols / agentic payments / agent identity
374
+ "agentic-commerce",
375
+ "agentic-economy",
376
+ "agentic-payments",
377
+ "a2a",
378
+ "a2b",
379
+ "a2p",
380
+ "ap2",
381
+ "b2a",
382
+ "acp",
383
+ "ucp",
384
+ "mpp",
385
+ "x402",
386
+ "l402",
387
+ "anp",
388
+ "agp",
389
+ "erc-8004",
390
+ "kya",
391
+ "kyapay",
392
+ // Trust / verification / anti-impersonation handles
393
+ // (entries containing 'apify' are already blocked by USERNAME.RESTRICTED_REGEX)
394
+ "official",
395
+ "verified",
396
+ "certified",
397
+ "authorized",
398
+ "partner-official",
399
+ "gold-partner",
400
+ "premium-partner",
401
+ "staff",
402
+ "moderator",
403
+ // Apify subdomain / service names (current and future)
404
+ "console",
405
+ "cli",
406
+ "studio",
407
+ "gateway",
408
+ "workbench",
409
+ "agents-marketplace",
410
+ "agents-store",
411
+ "mcp-server",
412
+ "mcp-servers",
413
+ "mcp-gateway",
414
+ // Region / locale codes (3+ chars only; 1-2 char codes are blocked by USERNAME.MIN_LENGTH)
415
+ "asia",
416
+ "latam",
417
+ "emea",
418
+ "apac",
419
+ "i18n",
420
+ "l10n",
421
+ "localization",
422
+ "localisation",
423
+ // Currency / payment generics (open standards, not company brands)
424
+ "usd",
425
+ "eur",
426
+ "gbp",
427
+ "jpy",
428
+ "cny",
429
+ "usdc",
430
+ "usdt",
431
+ "btc",
432
+ "eth",
433
+ "sol",
434
+ "crypto",
435
+ "fiat",
436
+ "stablecoin",
437
+ "stablecoins",
438
+ "payment",
439
+ "payments",
440
+ "payout",
441
+ "payouts",
442
+ "invoice",
443
+ "invoices",
444
+ // Compliance / certifications
445
+ "soc",
446
+ "soc2",
447
+ "iso",
448
+ "iso-27001",
449
+ "hipaa",
450
+ "ccpa",
451
+ "pci",
452
+ "pci-dss",
453
+ "dpa",
454
+ "dpia",
455
+ "dmca",
456
+ "sla",
457
+ "eula",
458
+ "aml",
459
+ "kyc",
460
+ // Open-source / community roles
461
+ "contributor",
462
+ "contributors",
463
+ "maintainer",
464
+ "maintainers",
465
+ "core-team",
466
+ "oss",
467
+ "open-source",
468
+ // Anti-abuse / scam-bait names (frequently used in account fraud)
469
+ "spam",
470
+ "scam",
471
+ "phishing",
472
+ "malware",
473
+ "hack",
474
+ "hacked",
475
+ "giveaway",
476
+ "airdrop",
477
+ "bitcoin-giveaway",
478
+ "free-credits",
479
+ "free-money",
480
+ // Apify marketing / campaign slugs
481
+ "launch",
482
+ "launches",
483
+ "webinar",
484
+ "webinars",
485
+ "meetup",
486
+ "meetups",
487
+ "summit",
488
+ "conference",
489
+ "conferences",
351
490
  // Organizations / workspaces / permissions
352
491
  "orgs",
353
492
  "workspaces",
@@ -391,9 +530,6 @@ var FORBIDDEN_USERNAMES_REGEXPS = [
391
530
  // Brand protection / impersonation prevention
392
531
  "brand",
393
532
  "branding",
394
- "verified",
395
- "apify-support",
396
- "apify-team",
397
533
  "support-team",
398
534
  "abuse",
399
535
  // Incidents / updates
@@ -1271,7 +1407,9 @@ var ESCAPE_TO_BSON = "\uFF54\uFF4F\uFF22\uFF33\uFF2F\uFF2E";
1271
1407
  var ESCAPE_TO_STRING = "\uFF54\uFF4F\uFF33\uFF54\uFF52\uFF49\uFF4E\uFF47";
1272
1408
  var ESCAPE_BSON_TYPE = "\uFF3F\uFF42\uFF53\uFF4F\uFF4E\uFF54\uFF59\uFF50\uFF45";
1273
1409
  var ESCAPE_NULL = "";
1274
- var REGEXP_IS_ESCAPED = new RegExp(`(${ESCAPE_DOT}|^${ESCAPE_DOLLAR}|^${ESCAPE_TO_BSON}$|^${ESCAPE_BSON_TYPE}|^${ESCAPE_TO_STRING}$)`);
1410
+ var REGEXP_IS_ESCAPED = new RegExp(
1411
+ `(${ESCAPE_DOT}|^${ESCAPE_DOLLAR}|^${ESCAPE_TO_BSON}$|^${ESCAPE_BSON_TYPE}|^${ESCAPE_TO_STRING}$)`
1412
+ );
1275
1413
  var REGEXP_DOT = new RegExp(ESCAPE_DOT, "g");
1276
1414
  var REGEXP_DOLLAR = new RegExp(`^${ESCAPE_DOLLAR}`);
1277
1415
  var REGEXP_TO_BSON = new RegExp(`^${ESCAPE_TO_BSON}$`);
@@ -1301,7 +1439,8 @@ function unescapePropertyName(name) {
1301
1439
  }
1302
1440
  __name(unescapePropertyName, "unescapePropertyName");
1303
1441
  function traverseObject(obj, clone, transformFunc) {
1304
- if (obj === null || typeof obj !== "object" || Object.prototype.toString.call(obj) === "[object Date]" || isBuffer(obj)) return obj;
1442
+ if (obj === null || typeof obj !== "object" || Object.prototype.toString.call(obj) === "[object Date]" || isBuffer(obj))
1443
+ return obj;
1305
1444
  let result;
1306
1445
  if (Array.isArray(obj)) {
1307
1446
  result = clone ? new Array(obj.length) : obj;
@@ -1361,7 +1500,8 @@ var _JsonVariable = class _JsonVariable {
1361
1500
  __name(_JsonVariable, "JsonVariable");
1362
1501
  var JsonVariable = _JsonVariable;
1363
1502
  function jsonStringifyExtended(value, replacer, space = 0) {
1364
- if (replacer && !(replacer instanceof Function)) throw new Error('Parameter "replacer" of jsonStringifyExtended() must be a function!');
1503
+ if (replacer && !(replacer instanceof Function))
1504
+ throw new Error('Parameter "replacer" of jsonStringifyExtended() must be a function!');
1365
1505
  const replacements = {};
1366
1506
  const extendedReplacer = /* @__PURE__ */ __name((key, val) => {
1367
1507
  val = replacer ? replacer(key, val) : val;
@@ -1496,7 +1636,8 @@ var _HealthChecker = class _HealthChecker {
1496
1636
  }
1497
1637
  _validateCheck(check) {
1498
1638
  if (!(check.type in CHECK_TYPES)) throw new Error(`Check type "${check.type}" is invalid`);
1499
- if (typeof check.client !== "object") throw new Error(`Check client must be an object got "${typeof check.client}" instead`);
1639
+ if (typeof check.client !== "object")
1640
+ throw new Error(`Check client must be an object got "${typeof check.client}" instead`);
1500
1641
  }
1501
1642
  async _performCheck(check) {
1502
1643
  switch (check.type) {
@@ -1849,11 +1990,7 @@ function publicEncrypt({ publicKey, value }) {
1849
1990
  };
1850
1991
  }
1851
1992
  __name(publicEncrypt, "publicEncrypt");
1852
- function privateDecrypt({
1853
- privateKey,
1854
- encryptedPassword,
1855
- encryptedValue
1856
- }) {
1993
+ function privateDecrypt({ privateKey, encryptedPassword, encryptedValue }) {
1857
1994
  const encryptedValueBuffer = Buffer.from(encryptedValue, "base64");
1858
1995
  const encryptedPasswordBuffer = Buffer.from(encryptedPassword, "base64");
1859
1996
  const passwordBuffer = crypto2.privateDecrypt(privateKey, encryptedPasswordBuffer);
@@ -1989,11 +2126,7 @@ async function createHmacSignatureAsync(secretKey, message) {
1989
2126
  false,
1990
2127
  ["sign"]
1991
2128
  );
1992
- const signatureBuffer = await subtleCrypto.sign(
1993
- "HMAC",
1994
- key,
1995
- encoder.encode(message)
1996
- );
2129
+ const signatureBuffer = await subtleCrypto.sign("HMAC", key, encoder.encode(message));
1997
2130
  const signatureArray = new Uint8Array(signatureBuffer);
1998
2131
  const signatureHex = Array.from(signatureArray).map((b) => b.toString(16).padStart(2, "0")).join("").substring(0, 30);
1999
2132
  return encodeBase62(BigInt(`0x${signatureHex}`));