@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.cjs CHANGED
@@ -127,13 +127,13 @@ function parseDateFromJson(date) {
127
127
  }
128
128
  __name(parseDateFromJson, "parseDateFromJson");
129
129
  async function delayPromise(millis) {
130
- return new Promise(((resolve) => {
130
+ return new Promise((resolve) => {
131
131
  if (millis > 0) {
132
132
  setTimeout(() => resolve(), millis);
133
133
  } else {
134
134
  resolve();
135
135
  }
136
- }));
136
+ });
137
137
  }
138
138
  __name(delayPromise, "delayPromise");
139
139
  function removeFromArray(array, element) {
@@ -418,14 +418,35 @@ var FORBIDDEN_USERNAMES_REGEXPS = [
418
418
  "challange",
419
419
  "1m-challenge",
420
420
  "1m-usd-challenge",
421
+ "contact-sales",
422
+ "creator",
423
+ "creator-plan",
424
+ "request-an-integration",
425
+ "whitepaper",
426
+ "adviser",
427
+ "crawlee",
428
+ "ultimate-scraper",
429
+ "agent-skills",
421
430
  // Apify platform resources
422
431
  "key-value-store",
423
432
  "request-queue",
424
433
  "request-queues",
425
434
  "builds",
426
435
  "schedule",
436
+ "standby",
437
+ "pay-per-event",
438
+ "pay-per-result",
439
+ "pay-per-usage",
440
+ "ppe",
441
+ "ppr",
442
+ "compute-unit",
443
+ "compute-units",
427
444
  // AI / LLM related
445
+ "agent",
446
+ "agents",
447
+ "agentic",
428
448
  "llms",
449
+ "llm",
429
450
  "openai",
430
451
  "anthropic",
431
452
  "claude",
@@ -435,6 +456,124 @@ var FORBIDDEN_USERNAMES_REGEXPS = [
435
456
  "prompts",
436
457
  "embeddings",
437
458
  "vectors",
459
+ "rag",
460
+ // Agentic protocols / agentic payments / agent identity
461
+ "agentic-commerce",
462
+ "agentic-economy",
463
+ "agentic-payments",
464
+ "a2a",
465
+ "a2b",
466
+ "a2p",
467
+ "ap2",
468
+ "b2a",
469
+ "acp",
470
+ "ucp",
471
+ "mpp",
472
+ "x402",
473
+ "l402",
474
+ "anp",
475
+ "agp",
476
+ "erc-8004",
477
+ "kya",
478
+ "kyapay",
479
+ // Trust / verification / anti-impersonation handles
480
+ // (entries containing 'apify' are already blocked by USERNAME.RESTRICTED_REGEX)
481
+ "official",
482
+ "verified",
483
+ "certified",
484
+ "authorized",
485
+ "partner-official",
486
+ "gold-partner",
487
+ "premium-partner",
488
+ "staff",
489
+ "moderator",
490
+ // Apify subdomain / service names (current and future)
491
+ "console",
492
+ "cli",
493
+ "studio",
494
+ "gateway",
495
+ "workbench",
496
+ "agents-marketplace",
497
+ "agents-store",
498
+ "mcp-server",
499
+ "mcp-servers",
500
+ "mcp-gateway",
501
+ // Region / locale codes (3+ chars only; 1-2 char codes are blocked by USERNAME.MIN_LENGTH)
502
+ "asia",
503
+ "latam",
504
+ "emea",
505
+ "apac",
506
+ "i18n",
507
+ "l10n",
508
+ "localization",
509
+ "localisation",
510
+ // Currency / payment generics (open standards, not company brands)
511
+ "usd",
512
+ "eur",
513
+ "gbp",
514
+ "jpy",
515
+ "cny",
516
+ "usdc",
517
+ "usdt",
518
+ "btc",
519
+ "eth",
520
+ "sol",
521
+ "crypto",
522
+ "fiat",
523
+ "stablecoin",
524
+ "stablecoins",
525
+ "payment",
526
+ "payments",
527
+ "payout",
528
+ "payouts",
529
+ "invoice",
530
+ "invoices",
531
+ // Compliance / certifications
532
+ "soc",
533
+ "soc2",
534
+ "iso",
535
+ "iso-27001",
536
+ "hipaa",
537
+ "ccpa",
538
+ "pci",
539
+ "pci-dss",
540
+ "dpa",
541
+ "dpia",
542
+ "dmca",
543
+ "sla",
544
+ "eula",
545
+ "aml",
546
+ "kyc",
547
+ // Open-source / community roles
548
+ "contributor",
549
+ "contributors",
550
+ "maintainer",
551
+ "maintainers",
552
+ "core-team",
553
+ "oss",
554
+ "open-source",
555
+ // Anti-abuse / scam-bait names (frequently used in account fraud)
556
+ "spam",
557
+ "scam",
558
+ "phishing",
559
+ "malware",
560
+ "hack",
561
+ "hacked",
562
+ "giveaway",
563
+ "airdrop",
564
+ "bitcoin-giveaway",
565
+ "free-credits",
566
+ "free-money",
567
+ // Apify marketing / campaign slugs
568
+ "launch",
569
+ "launches",
570
+ "webinar",
571
+ "webinars",
572
+ "meetup",
573
+ "meetups",
574
+ "summit",
575
+ "conference",
576
+ "conferences",
438
577
  // Organizations / workspaces / permissions
439
578
  "orgs",
440
579
  "workspaces",
@@ -478,9 +617,6 @@ var FORBIDDEN_USERNAMES_REGEXPS = [
478
617
  // Brand protection / impersonation prevention
479
618
  "brand",
480
619
  "branding",
481
- "verified",
482
- "apify-support",
483
- "apify-team",
484
620
  "support-team",
485
621
  "abuse",
486
622
  // Incidents / updates
@@ -1358,7 +1494,9 @@ var ESCAPE_TO_BSON = "\uFF54\uFF4F\uFF22\uFF33\uFF2F\uFF2E";
1358
1494
  var ESCAPE_TO_STRING = "\uFF54\uFF4F\uFF33\uFF54\uFF52\uFF49\uFF4E\uFF47";
1359
1495
  var ESCAPE_BSON_TYPE = "\uFF3F\uFF42\uFF53\uFF4F\uFF4E\uFF54\uFF59\uFF50\uFF45";
1360
1496
  var ESCAPE_NULL = "";
1361
- var REGEXP_IS_ESCAPED = new RegExp(`(${ESCAPE_DOT}|^${ESCAPE_DOLLAR}|^${ESCAPE_TO_BSON}$|^${ESCAPE_BSON_TYPE}|^${ESCAPE_TO_STRING}$)`);
1497
+ var REGEXP_IS_ESCAPED = new RegExp(
1498
+ `(${ESCAPE_DOT}|^${ESCAPE_DOLLAR}|^${ESCAPE_TO_BSON}$|^${ESCAPE_BSON_TYPE}|^${ESCAPE_TO_STRING}$)`
1499
+ );
1362
1500
  var REGEXP_DOT = new RegExp(ESCAPE_DOT, "g");
1363
1501
  var REGEXP_DOLLAR = new RegExp(`^${ESCAPE_DOLLAR}`);
1364
1502
  var REGEXP_TO_BSON = new RegExp(`^${ESCAPE_TO_BSON}$`);
@@ -1388,7 +1526,8 @@ function unescapePropertyName(name) {
1388
1526
  }
1389
1527
  __name(unescapePropertyName, "unescapePropertyName");
1390
1528
  function traverseObject(obj, clone, transformFunc) {
1391
- if (obj === null || typeof obj !== "object" || Object.prototype.toString.call(obj) === "[object Date]" || isBuffer(obj)) return obj;
1529
+ if (obj === null || typeof obj !== "object" || Object.prototype.toString.call(obj) === "[object Date]" || isBuffer(obj))
1530
+ return obj;
1392
1531
  let result;
1393
1532
  if (Array.isArray(obj)) {
1394
1533
  result = clone ? new Array(obj.length) : obj;
@@ -1448,7 +1587,8 @@ var _JsonVariable = class _JsonVariable {
1448
1587
  __name(_JsonVariable, "JsonVariable");
1449
1588
  var JsonVariable = _JsonVariable;
1450
1589
  function jsonStringifyExtended(value, replacer, space = 0) {
1451
- if (replacer && !(replacer instanceof Function)) throw new Error('Parameter "replacer" of jsonStringifyExtended() must be a function!');
1590
+ if (replacer && !(replacer instanceof Function))
1591
+ throw new Error('Parameter "replacer" of jsonStringifyExtended() must be a function!');
1452
1592
  const replacements = {};
1453
1593
  const extendedReplacer = /* @__PURE__ */ __name((key, val) => {
1454
1594
  val = replacer ? replacer(key, val) : val;
@@ -1583,7 +1723,8 @@ var _HealthChecker = class _HealthChecker {
1583
1723
  }
1584
1724
  _validateCheck(check) {
1585
1725
  if (!(check.type in CHECK_TYPES)) throw new Error(`Check type "${check.type}" is invalid`);
1586
- if (typeof check.client !== "object") throw new Error(`Check client must be an object got "${typeof check.client}" instead`);
1726
+ if (typeof check.client !== "object")
1727
+ throw new Error(`Check client must be an object got "${typeof check.client}" instead`);
1587
1728
  }
1588
1729
  async _performCheck(check) {
1589
1730
  switch (check.type) {
@@ -1936,11 +2077,7 @@ function publicEncrypt({ publicKey, value }) {
1936
2077
  };
1937
2078
  }
1938
2079
  __name(publicEncrypt, "publicEncrypt");
1939
- function privateDecrypt({
1940
- privateKey,
1941
- encryptedPassword,
1942
- encryptedValue
1943
- }) {
2080
+ function privateDecrypt({ privateKey, encryptedPassword, encryptedValue }) {
1944
2081
  const encryptedValueBuffer = Buffer.from(encryptedValue, "base64");
1945
2082
  const encryptedPasswordBuffer = Buffer.from(encryptedPassword, "base64");
1946
2083
  const passwordBuffer = import_node_crypto2.default.privateDecrypt(privateKey, encryptedPasswordBuffer);
@@ -2076,11 +2213,7 @@ async function createHmacSignatureAsync(secretKey, message) {
2076
2213
  false,
2077
2214
  ["sign"]
2078
2215
  );
2079
- const signatureBuffer = await subtleCrypto.sign(
2080
- "HMAC",
2081
- key,
2082
- encoder.encode(message)
2083
- );
2216
+ const signatureBuffer = await subtleCrypto.sign("HMAC", key, encoder.encode(message));
2084
2217
  const signatureArray = new Uint8Array(signatureBuffer);
2085
2218
  const signatureHex = Array.from(signatureArray).map((b) => b.toString(16).padStart(2, "0")).join("").substring(0, 30);
2086
2219
  return encodeBase62(BigInt(`0x${signatureHex}`));