@apify/utilities 2.35.11 → 3.0.0-beta.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/code_hash_manager.d.ts +34 -0
- package/code_hash_manager.js +66 -0
- package/code_hash_manager.js.map +1 -0
- package/crypto.d.ts +35 -0
- package/crypto.js +58 -0
- package/crypto.js.map +1 -0
- package/exponential_backoff.d.ts +9 -0
- package/exponential_backoff.js +47 -0
- package/exponential_backoff.js.map +1 -0
- package/health_checker.d.ts +61 -0
- package/health_checker.js +132 -0
- package/health_checker.js.map +1 -0
- package/hmac.d.ts +20 -0
- package/hmac.js +59 -0
- package/hmac.js.map +1 -0
- package/index.d.ts +14 -0
- package/index.js +15 -0
- package/index.js.map +1 -0
- package/package.json +16 -21
- package/parse_boolean.d.ts +10 -0
- package/parse_boolean.js +25 -0
- package/parse_boolean.js.map +1 -0
- package/parse_jsonl_stream.d.ts +25 -0
- package/parse_jsonl_stream.js +79 -0
- package/parse_jsonl_stream.js.map +1 -0
- package/storages.d.ts +29 -0
- package/storages.js +37 -0
- package/storages.js.map +1 -0
- package/streams_utilities.d.ts +10 -0
- package/streams_utilities.js +26 -0
- package/streams_utilities.js.map +1 -0
- package/url_params_utils.d.ts +7 -0
- package/url_params_utils.js +11 -0
- package/url_params_utils.js.map +1 -0
- package/usernames.d.ts +10 -0
- package/usernames.js +1137 -0
- package/usernames.js.map +1 -0
- package/utilities.client.d.ts +125 -0
- package/utilities.client.js +408 -0
- package/utilities.client.js.map +1 -0
- package/utilities.d.ts +111 -0
- package/utilities.js +263 -0
- package/utilities.js.map +1 -0
- package/webhook_payload_template.d.ts +114 -0
- package/webhook_payload_template.js +245 -0
- package/webhook_payload_template.js.map +1 -0
- package/cjs/index.cjs +0 -2402
- package/cjs/index.cjs.map +0 -1
- package/cjs/index.d.ts +0 -609
- package/esm/index.d.mts +0 -609
- package/esm/index.mjs +0 -2314
- package/esm/index.mjs.map +0 -1
package/usernames.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usernames.js","sourceRoot":"","sources":["../src/usernames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,2BAA2B,GAAG;IAChC,aAAa;IACb,gBAAgB;IAChB,MAAM;IACN,cAAc;IACd,OAAO;IACP,SAAS;IACT,gBAAgB;IAChB,WAAW;IACX,cAAc;IACd,kBAAkB;IAClB,eAAe;IACf,MAAM;IACN,eAAe;IACf,iBAAiB;IACjB,MAAM;IACN,kBAAkB;IAClB,WAAW;IACX,SAAS;IACT,SAAS;IACT,mBAAmB;IACnB,OAAO;IACP,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,SAAS;IACT,cAAc;IACd,aAAa;IACb,cAAc;IACd,UAAU;IACV,cAAc;IACd,KAAK;IACL,YAAY;IACZ,WAAW;IACX,WAAW;IACX,UAAU;IACV,KAAK;IACL,SAAS;IAET,kBAAkB;IAClB,OAAO;IACP,gBAAgB;IAChB,SAAS;IACT,KAAK;IACL,SAAS;IACT,KAAK;IACL,SAAS;IACT,MAAM;IACN,SAAS;IACT,KAAK;IACL,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,YAAY;IACZ,UAAU;IACV,cAAc;IACd,KAAK;IACL,SAAS;IACT,UAAU;IACV,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,eAAe;IACf,OAAO;IACP,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,aAAa;IACb,WAAW;IACX,SAAS;IACT,QAAQ;IACR,aAAa;IACb,UAAU;IACV,WAAW;IACX,UAAU;IACV,OAAO;IACP,MAAM;IACN,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,UAAU;IACV,SAAS;IACT,SAAS;IACT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ACL,SAAS;IACT,OAAO;IACP,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,KAAK;IACL,SAAS;IACT,UAAU;IACV,SAAS;IACT,WAAW;IACX,SAAS;IACT,UAAU;IACV,SAAS;IACT,QAAQ;IACR,SAAS;IACT,MAAM;IACN,KAAK;IACL,SAAS;IACT,MAAM;IACN,MAAM;IACN,OAAO;IACP,UAAU;IACV,IAAI;IACJ,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,YAAY;IACZ,UAAU;IACV,UAAU;IACV,cAAc;CACjB,CAAC;AAEF,sCAAsC;AACtC,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,KAAK,kBAAkB,IAAI,2BAA2B,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAE/G;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAChD,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import { ANONYMOUS_USERNAME, APIFY_ID_REGEX } from '@apify/consts';\n\n/**\n * List of forbidden usernames. Note that usernames can be used as apify.com/username,\n * so we need to prohibit any username that might be part of our website or confusing in any way.\n *\n * After extending this list, check whether any existing users already hold one of the\n * newly-forbidden usernames. The thorough way is to mirror `isForbiddenUsername` server-side\n * by rebuilding the same regex inside Robo 3T / mongosh — paste the contents of this array\n * verbatim into `var patterns = [...]` and run something like:\n *\n * var forbiddenRegex = new RegExp('^(anonymous|' + patterns.join('|') + ')$', 'i');\n * var apifyIdRegex = /^[a-zA-Z0-9]{17}$/;\n * db.getCollection('users').find({\n * $or: [{ username: forbiddenRegex }, { username: apifyIdRegex }],\n * }, { username: 1, 'profile.isPublic': 1, createdAt: 1, lastActivityAt: 1 })\n * .sort({ username: 1 })\n * .forEach(function (u) { print(u.username + '\\t' + !!(u.profile && u.profile.isPublic)); });\n *\n * For a quick sanity check (literals only, fast) use `$in` with an exact-string array\n * of the new additions instead.\n */\nconst FORBIDDEN_USERNAMES_REGEXPS = [\n // App routes\n 'page-not-found',\n 'docs',\n 'terms-of-use',\n 'about',\n 'pricing',\n 'privacy-policy',\n 'customers',\n 'request-form',\n 'request-solution',\n 'release-notes',\n 'jobs',\n 'api-reference',\n 'video-tutorials',\n 'acts',\n 'key-value-stores',\n 'schedules',\n 'account',\n 'sign-up',\n 'sign-in-discourse',\n 'admin',\n 'documentation',\n 'change-password',\n 'enroll-account',\n 'forgot-password',\n 'reset-password',\n 'sign-in',\n 'verify-email',\n 'live-status',\n 'browser-info',\n 'webhooks',\n 'health-check',\n 'api',\n 'change-log',\n 'dashboard',\n 'community',\n 'crawlers',\n 'ext',\n 'schemas',\n\n // Various strings\n 'admin',\n 'administration',\n 'crawler',\n 'act',\n 'library',\n 'lib',\n 'apifier',\n 'team',\n 'contact',\n 'doc',\n 'documentation',\n 'for-business',\n 'for-developers',\n 'developers',\n 'business',\n 'integrations',\n 'job',\n 'setting',\n 'settings',\n 'privacy',\n 'policy',\n 'assets',\n 'help',\n 'config',\n 'configuration',\n 'terms',\n 'hiring',\n 'hire',\n 'status',\n 'status-page',\n 'solutions',\n 'support',\n 'market',\n 'marketplace',\n 'download',\n 'downloads',\n 'username',\n 'users',\n 'user',\n 'login',\n 'logout',\n 'signin',\n 'sign',\n 'signup',\n 'sign-out',\n 'signout',\n 'plugins',\n 'plug-ins',\n 'reset',\n 'password',\n 'passwords',\n 'square',\n 'profile-photos',\n 'profiles',\n 'true',\n 'false',\n 'js',\n 'css',\n 'img',\n 'images',\n 'image',\n 'partials',\n 'fonts',\n 'font',\n 'dynamic_templates',\n 'app',\n 'schedules',\n 'community',\n 'storage',\n 'storages',\n 'account',\n 'node_modules',\n 'bower_components',\n 'video',\n 'knowledgebase',\n 'forum',\n 'customers',\n 'blog',\n 'health-check',\n 'health',\n 'anim',\n 'forum_topics.json',\n 'forum_categories.json',\n 'me',\n 'you',\n 'him',\n 'she',\n 'it',\n 'external',\n 'actor',\n 'crawler',\n 'scheduler',\n 'api',\n 'sdk',\n 'puppeteer',\n 'webdriver',\n 'selenium',\n '(selenium.*webdriver)',\n 'undefined',\n 'page-analyzer',\n 'wp-login.php',\n 'welcome.action',\n 'echo',\n 'proxy',\n 'super-proxy',\n 'gdpr',\n 'case-studies',\n 'use-cases',\n 'how-to',\n 'kb',\n 'cookies',\n 'cookie-policy',\n 'cookies-policy',\n 'powered-by',\n 'run',\n 'runs',\n 'actor',\n 'actors',\n 'act',\n 'acts',\n 'success-stories',\n 'roadmap',\n 'join-marketplace',\n 'presskit',\n 'press-kit',\n 'covid-19',\n 'covid',\n 'covid19',\n 'matfyz',\n 'ideas',\n 'public-actors',\n 'resources',\n 'partners',\n 'affiliate',\n 'industries',\n 'web-scraping',\n 'custom-solutions',\n 'solution-provider',\n 'alternatives',\n 'platform',\n 'freelancers',\n 'freelancer',\n 'partner',\n 'preview',\n 'templates',\n 'data-for-generative-ai',\n 'discord',\n 'praguecrawl',\n 'prague-crawl',\n 'bob',\n 'ai-agents',\n 'reel',\n 'video-reel',\n 'mcp',\n 'mcpc',\n 'model-context-protocol',\n 'modelcontextprotocol',\n // 'apify.com' intentionally unescaped so \".\" matches any character, also blocking variants like \"apify_com\" or \"apifyxcom\"\n 'apify.com',\n 'design-kit',\n 'press-kit',\n 'scrapers',\n 'professional-services',\n 'challenge',\n 'challange',\n '1m-challenge',\n '1m-usd-challenge',\n 'contact-sales',\n 'creator',\n 'creators',\n 'creator-plan',\n 'request-an-integration',\n 'whitepaper',\n 'adviser',\n 'crawlee',\n 'ultimate-scraper',\n 'agent-skills',\n\n // Apify platform resources\n 'key-value-store',\n 'request-queue',\n 'request-queues',\n 'build',\n 'builds',\n 'dataset',\n 'datasets',\n 'schedule',\n 'standby',\n 'pay-per-event',\n 'pay-per-result',\n 'pay-per-usage',\n 'ppe',\n 'ppr',\n 'compute-unit',\n 'compute-units',\n\n // AI / LLM related\n 'agent',\n 'agents',\n 'agentic',\n 'llms',\n 'llm',\n 'openai',\n 'anthropic',\n 'claude',\n 'copilot',\n 'mistral',\n 'gemini',\n 'llama',\n 'chatbot',\n 'chatgpt',\n 'prompt',\n 'prompts',\n 'embeddings',\n 'vectors',\n 'rag',\n\n // Agentic protocols / agentic payments / agent identity\n 'agentic-commerce',\n 'agentic-economy',\n 'agentic-payments',\n 'a2a',\n 'a2b',\n 'a2p',\n 'ap2',\n 'b2a',\n 'acp',\n 'ucp',\n 'mpp',\n 'x402',\n 'l402',\n 'anp',\n 'agp',\n 'erc-8004',\n 'kya',\n 'kyapay',\n\n // Trust / verification / anti-impersonation handles\n // (entries containing 'apify' are already blocked by USERNAME.RESTRICTED_REGEX)\n 'official',\n 'verified',\n 'certified',\n 'authorized',\n 'partner-official',\n 'gold-partner',\n 'premium-partner',\n 'staff',\n 'moderator',\n 'apify-admin',\n\n // Apify subdomain / service names (current and future)\n 'console',\n 'cli',\n 'studio',\n 'gateway',\n 'workbench',\n 'agents-marketplace',\n 'agents-store',\n 'mcp-server',\n 'mcp-servers',\n 'mcp-gateway',\n\n // Region / locale codes (3+ chars only; 1-2 char codes are blocked by USERNAME.MIN_LENGTH)\n 'asia',\n 'latam',\n 'emea',\n 'apac',\n 'i18n',\n 'l10n',\n 'localization',\n 'localisation',\n\n // Currency / payment generics (open standards, not company brands)\n 'usd',\n 'eur',\n 'gbp',\n 'jpy',\n 'cny',\n 'usdc',\n 'usdt',\n 'btc',\n 'eth',\n 'sol',\n 'crypto',\n 'fiat',\n 'stablecoin',\n 'stablecoins',\n 'payment',\n 'payments',\n 'payout',\n 'payouts',\n 'invoice',\n 'invoices',\n 'wallet',\n\n // Compliance / certifications\n 'soc',\n 'soc2',\n 'iso',\n 'iso-27001',\n 'hipaa',\n 'ccpa',\n 'pci',\n 'pci-dss',\n 'dpa',\n 'dpia',\n 'dmca',\n 'sla',\n 'eula',\n 'aml',\n 'kyc',\n\n // Open-source / community roles\n 'contributor',\n 'contributors',\n 'maintainer',\n 'maintainers',\n 'core-team',\n 'oss',\n 'open-source',\n 'opensource',\n 'open-source-software',\n\n // Anti-abuse / scam-bait names (frequently used in account fraud)\n 'spam',\n 'scam',\n 'phishing',\n 'malware',\n 'hack',\n 'hacked',\n 'giveaway',\n 'airdrop',\n 'bitcoin-giveaway',\n 'free-credits',\n 'free-money',\n\n // Apify marketing / campaign slugs\n 'launch',\n 'launches',\n 'webinar',\n 'webinars',\n 'meetup',\n 'meetups',\n 'summit',\n 'conference',\n 'conferences',\n\n // Organizations / workspaces / permissions\n 'org',\n 'orgs',\n 'organisation',\n 'workspace',\n 'workspaces',\n 'tenant',\n 'tenants',\n 'role',\n 'roles',\n 'permission',\n 'permissions',\n\n // Auth / security\n 'saml',\n 'scim',\n 'token',\n 'tokens',\n 'apikey',\n 'api-key',\n 'api-keys',\n 'keys',\n 'secret',\n 'secrets',\n\n // Billing / commerce\n 'coupon',\n 'coupons',\n 'discount',\n 'discounts',\n 'promos',\n 'refund',\n 'refunds',\n 'credit',\n 'credits',\n 'billing-portal',\n\n // Infrastructure / environments\n 'production',\n 'prod',\n 'canary',\n 'internal',\n 'restricted',\n\n // Communication\n 'conversations',\n 'reactions',\n 'mentions',\n 'channel',\n 'channels',\n 'inbox',\n 'no-reply',\n 'noreply',\n\n // Legal / trust / web standards\n 'accessibility',\n 'imprint',\n 'impressum',\n 'trust',\n 'trust-center',\n 'security-center',\n\n // Brand protection / impersonation prevention\n 'brand',\n 'branding',\n 'support-team',\n 'abuse',\n\n // Incidents / updates\n 'outage',\n 'incident',\n 'incidents',\n 'what-is-new',\n 'whatsnew',\n\n // Special files\n 'index',\n 'index\\\\.html',\n '(favicon\\\\.[a-z]+)',\n 'BingSiteAuth.xml',\n '(google.+\\\\.html)',\n 'robots\\\\.txt',\n '(sitemap\\\\.[a-z]+)',\n '(apple-touch-icon.*)',\n 'security-whitepaper\\\\.pdf',\n 'security\\\\.txt',\n 'llms\\\\.txt',\n 'llms-full\\\\.txt',\n 'AGENTS\\\\.md',\n 'CLAUDE\\\\.md',\n 'auth\\\\.md',\n\n // All hidden files\n '(\\\\..*)',\n\n // Username starting with xxx-\n '(xxx-.*)',\n\n // Usernames containing inappropriate/adult content keywords.\n // Each entry requires non-letter boundaries on both sides so the keyword only\n // matches as a whole word — this avoids false positives like Akshit (shit),\n // Hancock (cock), Nudelman (nude), Uranus (anus), pussycat (pussy),\n // snaked (naked), scunthorpe (cunt), christoph-dick-media (dick — legitimate\n // German surname, not blocked), etc.\n '((.+[^a-z]|)porn([^a-z].+|))',\n '((.+[^a-z]|)vagina([^a-z].+|))',\n '((.+[^a-z]|)dildo([^a-z].+|))',\n '((.+[^a-z]|)nsfw([^a-z].+|))',\n '((.+[^a-z]|)hentai([^a-z].+|))',\n '((.+[^a-z]|)cunt([^a-z].+|))',\n '((.+[^a-z]|)fuck([^a-z].+|))',\n '((.+[^a-z]|)shit([^a-z].+|))',\n '((.+[^a-z]|)bitch([^a-z].+|))',\n '((.+[^a-z]|)slut([^a-z].+|))',\n '((.+[^a-z]|)whore([^a-z].+|))',\n '((.+[^a-z]|)boob([^a-z].+|))',\n '((.+[^a-z]|)tits([^a-z].+|))',\n '((.+[^a-z]|)cock([^a-z].+|))',\n '((.+[^a-z]|)anus([^a-z].+|))',\n '((.+[^a-z]|)pussy([^a-z].+|))',\n '((.+[^a-z]|)nude([^a-z].+|))',\n '((.+[^a-z]|)penis([^a-z].+|))',\n '((.+[^a-z]|)naked([^a-z].+|))',\n\n // Username starting with install-cli. (see https://docs.apify.com/cli/docs/installation)\n '(install-cli\\\\..*)',\n\n // Strings not starting with letter or number\n '([^0-9a-z].*)',\n\n // Strings not ending with letter or number\n '(.*[^0-9a-z])',\n\n // Strings where there's more than one underscore, comma or dash in row\n '(.*[_.\\\\-]{2}.*)',\n\n // Reserved usernames from https://github.com/shouldbee/reserved-usernames/blob/master/reserved-usernames.json\n '0',\n 'about',\n 'access',\n 'account',\n 'accounts',\n 'activate',\n 'activities',\n 'activity',\n 'ad',\n 'add',\n 'address',\n 'adm',\n 'admin',\n 'administration',\n 'administrator',\n 'ads',\n 'adult',\n 'advertising',\n 'affiliate',\n 'affiliates',\n 'ajax',\n 'all',\n 'alpha',\n 'analysis',\n 'analytics',\n 'android',\n 'anon',\n 'anonymous',\n 'api',\n 'app',\n 'apps',\n 'archive',\n 'archives',\n 'article',\n 'asct',\n 'asset',\n 'atom',\n 'auth',\n 'authentication',\n 'avatar',\n 'backup',\n 'balancer-manager',\n 'banner',\n 'banners',\n 'beta',\n 'billing',\n 'bin',\n 'blog',\n 'blogs',\n 'board',\n 'book',\n 'bookmark',\n 'bot',\n 'bots',\n 'bug',\n 'business',\n 'cache',\n 'cadastro',\n 'calendar',\n 'call',\n 'campaign',\n 'cancel',\n 'captcha',\n 'career',\n 'careers',\n 'cart',\n 'categories',\n 'category',\n 'cgi',\n 'cgi-bin',\n 'changelog',\n 'chat',\n 'check',\n 'checking',\n 'checkout',\n 'client',\n 'cliente',\n 'clients',\n 'code',\n 'codereview',\n 'comercial',\n 'comment',\n 'comments',\n 'communities',\n 'community',\n 'company',\n 'compare',\n 'compras',\n 'config',\n 'configuration',\n 'connect',\n 'contact',\n 'contact-us',\n 'contact_us',\n 'contactus',\n 'contest',\n 'contribute',\n 'corp',\n 'create',\n 'css',\n 'dashboard',\n 'data',\n 'db',\n 'default',\n 'delete',\n 'demo',\n 'design',\n 'designer',\n 'destroy',\n 'dev',\n 'devel',\n 'developer',\n 'developers',\n 'diagram',\n 'diary',\n 'dict',\n 'dictionary',\n 'die',\n 'dir',\n 'direct_messages',\n 'directory',\n 'dist',\n 'doc',\n 'docs',\n 'documentation',\n 'domain',\n 'download',\n 'downloads',\n 'ecommerce',\n 'edit',\n 'editor',\n 'edu',\n 'education',\n 'email',\n 'employment',\n 'empty',\n 'end',\n 'enterprise',\n 'entries',\n 'entry',\n 'error',\n 'errors',\n 'eval',\n 'event',\n 'events',\n 'exit',\n 'explore',\n 'facebook',\n 'faq',\n 'favorite',\n 'favorites',\n 'feature',\n 'features',\n 'feed',\n 'feedback',\n 'feeds',\n 'file',\n 'files',\n 'first',\n 'flash',\n 'fleet',\n 'fleets',\n 'flog',\n 'follow',\n 'followers',\n 'following',\n 'forgot',\n 'form',\n 'forum',\n 'forums',\n 'founder',\n 'free',\n 'friend',\n 'friends',\n 'ftp',\n 'gadget',\n 'gadgets',\n 'game',\n 'games',\n 'get',\n 'gift',\n 'gifts',\n 'gist',\n 'github',\n 'graph',\n 'group',\n 'groups',\n 'guest',\n 'guests',\n 'help',\n 'home',\n 'homepage',\n 'host',\n 'hosting',\n 'hostmaster',\n 'hostname',\n 'howto',\n 'hpg',\n 'html',\n 'http',\n 'httpd',\n 'https',\n 'i',\n 'iamges',\n 'icon',\n 'icons',\n 'id',\n 'idea',\n 'ideas',\n 'image',\n 'images',\n 'imap',\n 'img',\n 'index',\n 'indice',\n 'info',\n 'information',\n 'inquiry',\n 'instagram',\n 'intranet',\n 'invitations',\n 'invite',\n 'ipad',\n 'iphone',\n 'irc',\n 'is',\n 'issue',\n 'issues',\n 'it',\n 'item',\n 'items',\n 'java',\n 'javascript',\n 'job',\n 'jobs',\n 'join',\n 'js',\n 'json',\n 'jump',\n 'knowledgebase',\n 'language',\n 'languages',\n 'last',\n 'ldap-status',\n 'legal',\n 'license',\n 'link',\n 'links',\n 'linux',\n 'list',\n 'lists',\n 'log',\n 'log-in',\n 'log-out',\n 'log_in',\n 'log_out',\n 'login',\n 'logout',\n 'logs',\n 'm',\n 'mac',\n 'mail',\n 'mail1',\n 'mail2',\n 'mail3',\n 'mail4',\n 'mail5',\n 'mailer',\n 'mailing',\n 'maintenance',\n 'manager',\n 'manual',\n 'map',\n 'maps',\n 'marketing',\n 'master',\n 'me',\n 'media',\n 'member',\n 'members',\n 'message',\n 'messages',\n 'messenger',\n 'microblog',\n 'microblogs',\n 'mine',\n 'mis',\n 'mob',\n 'mobile',\n 'movie',\n 'movies',\n 'mp3',\n 'msg',\n 'msn',\n 'music',\n 'musicas',\n 'mx',\n 'my',\n 'mysql',\n 'name',\n 'named',\n 'nan',\n 'navi',\n 'navigation',\n 'net',\n 'network',\n 'new',\n 'news',\n 'newsletter',\n 'nick',\n 'nickname',\n 'notes',\n 'noticias',\n 'notification',\n 'notifications',\n 'notify',\n 'ns',\n 'ns1',\n 'ns10',\n 'ns2',\n 'ns3',\n 'ns4',\n 'ns5',\n 'ns6',\n 'ns7',\n 'ns8',\n 'ns9',\n 'null',\n 'oauth',\n 'oauth_clients',\n 'offer',\n 'offers',\n 'official',\n 'old',\n 'online',\n 'openid',\n 'operator',\n 'order',\n 'orders',\n 'organization',\n 'organizations',\n 'overview',\n 'owner',\n 'owners',\n 'page',\n 'pager',\n 'pages',\n 'panel',\n 'password',\n 'payment',\n 'perl',\n 'phone',\n 'photo',\n 'photoalbum',\n 'photos',\n 'php',\n 'phpmyadmin',\n 'phppgadmin',\n 'phpredisadmin',\n 'pic',\n 'pics',\n 'ping',\n 'plan',\n 'plans',\n 'plugin',\n 'plugins',\n 'policy',\n 'pop',\n 'pop3',\n 'popular',\n 'portal',\n 'post',\n 'postfix',\n 'postmaster',\n 'posts',\n 'pr',\n 'premium',\n 'press',\n 'price',\n 'pricing',\n 'privacy',\n 'privacy-policy',\n 'privacy_policy',\n 'privacypolicy',\n 'private',\n 'product',\n 'products',\n 'profile',\n 'project',\n 'projects',\n 'promo',\n 'pub',\n 'public',\n 'purpose',\n 'put',\n 'python',\n 'query',\n 'random',\n 'ranking',\n 'read',\n 'readme',\n 'recent',\n 'recruit',\n 'recruitment',\n 'register',\n 'registration',\n 'release',\n 'remove',\n 'replies',\n 'report',\n 'reports',\n 'repositories',\n 'repository',\n 'req',\n 'request',\n 'requests',\n 'reset',\n 'roc',\n 'root',\n 'rss',\n 'ruby',\n 'rule',\n 'sag',\n 'sale',\n 'sales',\n 'sample',\n 'samples',\n 'save',\n 'school',\n 'script',\n 'scripts',\n 'search',\n 'secure',\n 'security',\n 'self',\n 'send',\n 'server',\n 'server-info',\n 'server-status',\n 'service',\n 'services',\n 'session',\n 'sessions',\n 'setting',\n 'settings',\n 'setup',\n 'share',\n 'shop',\n 'show',\n 'sign-in',\n 'sign-up',\n 'sign_in',\n 'sign_up',\n 'signin',\n 'signout',\n 'signup',\n 'site',\n 'sitemap',\n 'sites',\n 'smartphone',\n 'smtp',\n 'soporte',\n 'source',\n 'spec',\n 'special',\n 'sql',\n 'src',\n 'ssh',\n 'ssl',\n 'ssladmin',\n 'ssladministrator',\n 'sslwebmaster',\n 'staff',\n 'stage',\n 'staging',\n 'start',\n 'stat',\n 'state',\n 'static',\n 'stats',\n 'status',\n 'store',\n 'stores',\n 'stories',\n 'style',\n 'styleguide',\n 'stylesheet',\n 'stylesheets',\n 'subdomain',\n 'subscribe',\n 'subscription',\n 'subscriptions',\n 'suporte',\n 'support',\n 'svn',\n 'swf',\n 'sys',\n 'sysadmin',\n 'sysadministrator',\n 'system',\n 'tablet',\n 'tablets',\n 'tag',\n 'talk',\n 'task',\n 'tasks',\n 'team',\n 'teams',\n 'tech',\n 'telnet',\n 'term',\n 'terms',\n 'terms-of-service',\n 'terms_of_service',\n 'termsofservice',\n 'test',\n 'test1',\n 'test2',\n 'test3',\n 'teste',\n 'testing',\n 'tests',\n 'theme',\n 'themes',\n 'thread',\n 'threads',\n 'tmp',\n 'todo',\n 'tool',\n 'tools',\n 'top',\n 'topic',\n 'topics',\n 'tos',\n 'tour',\n 'translations',\n 'trends',\n 'tutorial',\n 'tux',\n 'tv',\n 'twitter',\n 'undef',\n 'unfollow',\n 'unsubscribe',\n 'update',\n 'upload',\n 'uploads',\n 'url',\n 'usage',\n 'user',\n 'username',\n 'users',\n 'usuario',\n 'vendas',\n 'ver',\n 'version',\n 'video',\n 'videos',\n 'visitor',\n 'watch',\n 'weather',\n 'web',\n 'webhook',\n 'webhooks',\n 'webmail',\n 'webmaster',\n 'website',\n 'websites',\n 'welcome',\n 'widget',\n 'widgets',\n 'wiki',\n 'win',\n 'windows',\n 'word',\n 'work',\n 'works',\n 'workshop',\n 'ww',\n 'wws',\n 'www',\n 'www1',\n 'www2',\n 'www3',\n 'www4',\n 'www5',\n 'www6',\n 'www7',\n 'wwws',\n 'wwww',\n 'xfn',\n 'xml',\n 'xmpp',\n 'xpg',\n 'xxx',\n 'yaml',\n 'year',\n 'yml',\n 'you',\n 'yourdomain',\n 'yourname',\n 'yoursite',\n 'yourusername',\n];\n\n// Regex matching forbidden usernames.\nconst FORBIDDEN_REGEXP = new RegExp(`^(${ANONYMOUS_USERNAME}|${FORBIDDEN_USERNAMES_REGEXPS.join('|')})$`, 'i');\n\n/**\n * Checks whether username is listed in the forbidden username list\n * or looks like an Apify ID.\n *\n * NOTE: The forbidden list may expand over time, so a username that was\n * previously permitted may later become forbidden. Use this function only\n * when validating a username change, not as part of normal authentication\n * or authorization flow.\n */\nexport function isForbiddenUsername(username: string): boolean {\n return !!username.match(APIFY_ID_REGEX) || !!username.match(FORBIDDEN_REGEXP);\n}\n"]}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* This module contains various client-side utility and helper functions.
|
|
3
|
+
*
|
|
4
|
+
* Author: Jan Curn (jan@apify.com)
|
|
5
|
+
* Copyright(c) 2016 Apify. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if object equals null or undefined, otherwise returns false.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isNullOrUndefined(obj: unknown): boolean;
|
|
12
|
+
export declare function isBuffer(obj: any): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Converts Date object to ISO string.
|
|
15
|
+
*/
|
|
16
|
+
export declare function dateToString(date: Date, middleT: boolean): string;
|
|
17
|
+
/**
|
|
18
|
+
* Ensures a string is shorter than a specified number of character, and truncates it if not,
|
|
19
|
+
* appending a specific suffix to it.
|
|
20
|
+
* @param str
|
|
21
|
+
* @param maxLength
|
|
22
|
+
* @param [suffix] Suffix to be appended to truncated string. Defaults to "...[truncated]".
|
|
23
|
+
*/
|
|
24
|
+
export declare function truncate(str: string, maxLength: number, suffix?: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Gets ordinal suffix for a number (e.g. "nd" for 2).
|
|
27
|
+
*/
|
|
28
|
+
export declare function getOrdinalSuffix(num: number): string;
|
|
29
|
+
interface Uri {
|
|
30
|
+
protocol?: string;
|
|
31
|
+
host?: string;
|
|
32
|
+
path?: string;
|
|
33
|
+
query?: string;
|
|
34
|
+
fragment?: string;
|
|
35
|
+
fragmentKey?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated use `new URL()` instead
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseUrl(str: string): Uri;
|
|
41
|
+
export declare function normalizeUrl(url: string, keepFragment?: boolean): string | null;
|
|
42
|
+
export declare function markedSetNofollowLinks(href: string, title: string, text: string, referrerHostname?: string): string;
|
|
43
|
+
export declare function markedDecreaseHeadsLevel(text: string, level: number): string;
|
|
44
|
+
/**
|
|
45
|
+
* Converts integer version number previously generated by buildNumberToInt() or versionNumberToInt()
|
|
46
|
+
* to string in a form 'MAJOR.MINOR' or 'MAJOR.MINOR.BUILD' in case build number is non-zero.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildOrVersionNumberIntToStr(int: number): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* If a property name is invalid for MongoDB or BSON, the function transforms
|
|
51
|
+
* it to a valid form, which can be (most of the time) reversed back using unescapePropertyName().
|
|
52
|
+
* For a detailed list of transformations, see escapeForBson().
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
export declare function escapePropertyName(name: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Reverses a string transformed using escapePropertyName() back to its original form.
|
|
58
|
+
* Note that the reverse transformation might not be 100% correct for certain unlikely-to-occur strings
|
|
59
|
+
* (e.g. string contain null chars).
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
export declare function unescapePropertyName(name: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Traverses an object, creates a deep clone if requested and transforms object keys and values using a provided function.
|
|
65
|
+
* The `traverseObject` is recursive, hence if the input object has circular references, the function will run into
|
|
66
|
+
* and infinite recursion and crash the Node.js process.
|
|
67
|
+
* @param obj Object to traverse, it must not contain circular references!
|
|
68
|
+
* @param clone If true, object is not modified but cloned.
|
|
69
|
+
* @param transformFunc Function used to transform the property names na value.
|
|
70
|
+
* It has the following signature: `(key, value) => [key, value]`.
|
|
71
|
+
* Beware that the transformed value is only set if it !== old value.
|
|
72
|
+
* @returns {*}
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
export declare function traverseObject(obj: Record<string, any>, clone: boolean, transformFunc: (key: string, value: unknown) => [string, unknown]): any[] | Record<string, any>;
|
|
76
|
+
/**
|
|
77
|
+
* Transforms an object so that it can be stored to MongoDB or serialized to BSON.
|
|
78
|
+
* It does so by transforming prohibited property names (e.g. names starting with "$",
|
|
79
|
+
* containing "." or null char, equal to "toBSON" or "_bsontype") to equivalent full-width Unicode chars
|
|
80
|
+
* which are normally allowed. To revert this transformation, use unescapeFromBson().
|
|
81
|
+
* @param obj Object to be transformed. It must not contain circular references or any complex types (e.g. Maps, Promises etc.)!
|
|
82
|
+
* @param clone If true, the function transforms a deep clone of the object rather than the original object.
|
|
83
|
+
* @returns {*} Transformed object
|
|
84
|
+
*/
|
|
85
|
+
export declare function escapeForBson(obj: Record<string, any>, clone?: boolean): any[] | Record<string, any>;
|
|
86
|
+
/**
|
|
87
|
+
* Reverts a transformation of object property names performed by escapeForBson().
|
|
88
|
+
* Note that the reverse transformation might not be 100% equal to the original object
|
|
89
|
+
* for certain unlikely-to-occur property name (e.g. one contain null chars or full-width Unicode chars).
|
|
90
|
+
* @param obj Object to be transformed. It must not contain circular references or any complex types (e.g. Maps, Promises etc.)!
|
|
91
|
+
* @param clone If true, the function transforms a deep clone of the object rather than the original object.
|
|
92
|
+
* @returns {*} Transformed object.
|
|
93
|
+
*/
|
|
94
|
+
export declare function unescapeFromBson(obj: Record<string, any>, clone?: boolean): Record<string, any>;
|
|
95
|
+
/**
|
|
96
|
+
* Determines whether an object contains property names that cannot be stored to MongoDB.
|
|
97
|
+
* See escapeForBson() for more details.
|
|
98
|
+
* Note that this function only works with objects that are serializable to JSON!
|
|
99
|
+
* @param obj Object to be checked. It must not contain circular references or any complex types (e.g. Maps, Promises etc.)!
|
|
100
|
+
* @returns {boolean} Returns true if object is invalid, otherwise it returns false.
|
|
101
|
+
*/
|
|
102
|
+
export declare function isBadForMongo(obj: Record<string, any>): boolean;
|
|
103
|
+
export declare class JsonVariable {
|
|
104
|
+
readonly name: string;
|
|
105
|
+
constructor(name: string);
|
|
106
|
+
getToken(): string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Stringifies provided value to JSON with a difference that supports functions that
|
|
110
|
+
* are stringified using .toString() method.
|
|
111
|
+
*
|
|
112
|
+
* In addition to that supports instances of JsonVariable('my.token') that are replaced
|
|
113
|
+
* with a {{my.token}}.
|
|
114
|
+
*/
|
|
115
|
+
export declare function jsonStringifyExtended(value: Record<string, any>, replacer?: ((k: string, val: unknown) => unknown) | null, space?: number): string;
|
|
116
|
+
/**
|
|
117
|
+
* Splits a full name into the first name and last name, trimming all internal and external spaces.
|
|
118
|
+
* Returns an array with two elements or null if splitting is not possible.
|
|
119
|
+
*/
|
|
120
|
+
export declare function splitFullName(fullName: string): (string | null)[];
|
|
121
|
+
/**
|
|
122
|
+
* Perform a Regex test on a given URL to see if it is relative.
|
|
123
|
+
*/
|
|
124
|
+
export declare function isUrlRelative(url: string): boolean;
|
|
125
|
+
export {};
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* This module contains various client-side utility and helper functions.
|
|
3
|
+
*
|
|
4
|
+
* Author: Jan Curn (jan@apify.com)
|
|
5
|
+
* Copyright(c) 2016 Apify. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { RELATIVE_URL_REGEX, VERSION_INT_MAJOR_BASE, VERSION_INT_MINOR_BASE } from '@apify/consts';
|
|
9
|
+
/**
|
|
10
|
+
* Returns true if object equals null or undefined, otherwise returns false.
|
|
11
|
+
*/
|
|
12
|
+
export function isNullOrUndefined(obj) {
|
|
13
|
+
return obj == null;
|
|
14
|
+
}
|
|
15
|
+
export function isBuffer(obj) {
|
|
16
|
+
return (obj != null &&
|
|
17
|
+
obj.constructor != null &&
|
|
18
|
+
typeof obj.constructor.isBuffer === 'function' &&
|
|
19
|
+
obj.constructor.isBuffer(obj));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Converts Date object to ISO string.
|
|
23
|
+
*/
|
|
24
|
+
export function dateToString(date, middleT) {
|
|
25
|
+
if (!(date instanceof Date)) {
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
28
|
+
const year = date.getFullYear();
|
|
29
|
+
const month = date.getMonth() + 1; // January is 0, February is 1, and so on.
|
|
30
|
+
const day = date.getDate();
|
|
31
|
+
const hours = date.getHours();
|
|
32
|
+
const minutes = date.getMinutes();
|
|
33
|
+
const seconds = date.getSeconds();
|
|
34
|
+
const millis = date.getMilliseconds();
|
|
35
|
+
const pad = (num) => (num < 10 ? `0${num}` : num);
|
|
36
|
+
const datePart = `${year}-${pad(month)}-${pad(day)}`;
|
|
37
|
+
// eslint-disable-next-line no-nested-ternary
|
|
38
|
+
const millisPart = millis < 10 ? `00${millis}` : millis < 100 ? `0${millis}` : millis;
|
|
39
|
+
const timePart = `${pad(hours)}:${pad(minutes)}:${pad(seconds)}.${millisPart}`;
|
|
40
|
+
return `${datePart}${middleT ? 'T' : ' '}${timePart}`;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Ensures a string is shorter than a specified number of character, and truncates it if not,
|
|
44
|
+
* appending a specific suffix to it.
|
|
45
|
+
* @param str
|
|
46
|
+
* @param maxLength
|
|
47
|
+
* @param [suffix] Suffix to be appended to truncated string. Defaults to "...[truncated]".
|
|
48
|
+
*/
|
|
49
|
+
export function truncate(str, maxLength, suffix = '...[truncated]') {
|
|
50
|
+
maxLength = Math.floor(maxLength);
|
|
51
|
+
// TODO: we should just ignore rest of the suffix...
|
|
52
|
+
if (suffix.length > maxLength) {
|
|
53
|
+
throw new Error('suffix string cannot be longer than maxLength');
|
|
54
|
+
}
|
|
55
|
+
if (typeof str === 'string' && str.length > maxLength) {
|
|
56
|
+
str = str.substr(0, maxLength - suffix.length) + suffix;
|
|
57
|
+
}
|
|
58
|
+
return str;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets ordinal suffix for a number (e.g. "nd" for 2).
|
|
62
|
+
*/
|
|
63
|
+
export function getOrdinalSuffix(num) {
|
|
64
|
+
// code from https://ecommerce.shopify.com/c/ecommerce-design/t/ordinal-number-in-javascript-1st-2nd-3rd-4th-29259
|
|
65
|
+
const s = ['th', 'st', 'nd', 'rd'];
|
|
66
|
+
const v = num % 100;
|
|
67
|
+
return s[(v - 20) % 10] || s[v] || s[0];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated use `new URL()` instead
|
|
71
|
+
*/
|
|
72
|
+
export function parseUrl(str) {
|
|
73
|
+
if (typeof str !== 'string')
|
|
74
|
+
return {};
|
|
75
|
+
const o = {
|
|
76
|
+
strictMode: false,
|
|
77
|
+
key: [
|
|
78
|
+
'source',
|
|
79
|
+
'protocol',
|
|
80
|
+
'authority',
|
|
81
|
+
'userInfo',
|
|
82
|
+
'user',
|
|
83
|
+
'password',
|
|
84
|
+
'host',
|
|
85
|
+
'port',
|
|
86
|
+
'relative',
|
|
87
|
+
'path',
|
|
88
|
+
'directory',
|
|
89
|
+
'file',
|
|
90
|
+
'query',
|
|
91
|
+
'fragment',
|
|
92
|
+
],
|
|
93
|
+
q: {
|
|
94
|
+
name: 'queryKey',
|
|
95
|
+
parser: /(?:^|&)([^&=]*)=?([^&]*)/g,
|
|
96
|
+
},
|
|
97
|
+
parser: {
|
|
98
|
+
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, // eslint-disable-line max-len,no-useless-escape
|
|
99
|
+
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, // eslint-disable-line max-len,no-useless-escape
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
const m = o.parser[o.strictMode ? 'strict' : 'loose'].exec(str);
|
|
103
|
+
const uri = {};
|
|
104
|
+
let i = o.key.length;
|
|
105
|
+
while (i--)
|
|
106
|
+
uri[o.key[i]] = m[i] || '';
|
|
107
|
+
uri[o.q.name] = {};
|
|
108
|
+
uri[o.key[12]].replace(o.q.parser, ($0, $1, $2) => {
|
|
109
|
+
if ($1)
|
|
110
|
+
uri[o.q.name][$1] = $2;
|
|
111
|
+
});
|
|
112
|
+
// our extension - parse fragment using a query string format (i.e. "#key1=val1&key2=val2")
|
|
113
|
+
// this format is used by many websites
|
|
114
|
+
uri.fragmentKey = {};
|
|
115
|
+
if (uri.fragment) {
|
|
116
|
+
// casting as any, as the usage seems invalid, replacer should always return something (but keeping as is to mitigate unwanted BCs)
|
|
117
|
+
uri.fragment.replace(o.q.parser, (($0, $1, $2) => {
|
|
118
|
+
if ($1)
|
|
119
|
+
uri.fragmentKey[$1] = $2;
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
return uri;
|
|
123
|
+
}
|
|
124
|
+
export function normalizeUrl(url, keepFragment) {
|
|
125
|
+
if (typeof url !== 'string' || !url.length) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
let urlObj;
|
|
129
|
+
try {
|
|
130
|
+
urlObj = new URL(url.trim());
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
const { searchParams } = urlObj;
|
|
136
|
+
for (const key of [...searchParams.keys()]) {
|
|
137
|
+
if (key.startsWith('utm_')) {
|
|
138
|
+
searchParams.delete(key);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
searchParams.sort();
|
|
142
|
+
const protocol = urlObj.protocol.toLowerCase();
|
|
143
|
+
const host = urlObj.host.toLowerCase();
|
|
144
|
+
const path = urlObj.pathname.replace(/\/$/, '');
|
|
145
|
+
const search = searchParams.toString() ? `?${searchParams}` : '';
|
|
146
|
+
const hash = keepFragment ? urlObj.hash : '';
|
|
147
|
+
return `${protocol}//${host}${path}${search}${hash}`;
|
|
148
|
+
}
|
|
149
|
+
// Helper function for markdown rendered marked
|
|
150
|
+
// If passed referrerHostname, it renders links outside that hostname in readme with rel="noopener noreferrer" and target="_blank" attributes
|
|
151
|
+
// And links outside apify.com in readme with rel="noopener noreferrer nofollow" and target="_blank" attributes
|
|
152
|
+
export function markedSetNofollowLinks(href, title, text, referrerHostname) {
|
|
153
|
+
let urlParsed;
|
|
154
|
+
try {
|
|
155
|
+
urlParsed = new URL(href);
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// Probably invalid url, go on
|
|
159
|
+
}
|
|
160
|
+
const isApifyLink = urlParsed && /(\.|^)apify\.com$/i.test(urlParsed.hostname);
|
|
161
|
+
const isSameHostname = !referrerHostname || (urlParsed && urlParsed.hostname === referrerHostname);
|
|
162
|
+
if (isApifyLink && isSameHostname) {
|
|
163
|
+
return `<a href="${href}">${title || text}</a>`;
|
|
164
|
+
}
|
|
165
|
+
if (isApifyLink) {
|
|
166
|
+
return `<a rel="noopener noreferrer" target="_blank" href="${href}">${title || text}</a>`;
|
|
167
|
+
}
|
|
168
|
+
return `<a rel="noopener noreferrer nofollow" target="_blank" href="${href}">${title || text}</a>`;
|
|
169
|
+
}
|
|
170
|
+
// Helper function for markdown rendered marked
|
|
171
|
+
// Decreases level of all headings by one, h1 -> h2
|
|
172
|
+
export function markedDecreaseHeadsLevel(text, level) {
|
|
173
|
+
level += 1;
|
|
174
|
+
return `<h${level}>${text}</h${level}>`;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Converts integer version number previously generated by buildNumberToInt() or versionNumberToInt()
|
|
178
|
+
* to string in a form 'MAJOR.MINOR' or 'MAJOR.MINOR.BUILD' in case build number is non-zero.
|
|
179
|
+
*/
|
|
180
|
+
export function buildOrVersionNumberIntToStr(int) {
|
|
181
|
+
if (typeof int !== 'number' || !(int >= 0))
|
|
182
|
+
return null;
|
|
183
|
+
const major = Math.floor(int / VERSION_INT_MAJOR_BASE);
|
|
184
|
+
const remainder = int % VERSION_INT_MAJOR_BASE;
|
|
185
|
+
const minor = Math.floor(remainder / VERSION_INT_MINOR_BASE);
|
|
186
|
+
const build = remainder % VERSION_INT_MINOR_BASE;
|
|
187
|
+
let str = `${major}.${minor}`;
|
|
188
|
+
if (build > 0)
|
|
189
|
+
str += `.${build}`;
|
|
190
|
+
return str;
|
|
191
|
+
}
|
|
192
|
+
// escaped variants for various strings
|
|
193
|
+
const ESCAPE_DOT = '\uFF0E'; // "."
|
|
194
|
+
const ESCAPE_DOLLAR = '\uFF04'; // "$"
|
|
195
|
+
const ESCAPE_TO_BSON = '\uFF54\uFF4F\uFF22\uFF33\uFF2F\uFF2E'; // "toBSON"
|
|
196
|
+
const ESCAPE_TO_STRING = '\uFF54\uFF4F\uFF33\uFF54\uFF52\uFF49\uFF4E\uFF47'; // "toString"
|
|
197
|
+
const ESCAPE_BSON_TYPE = '\uFF3F\uFF42\uFF53\uFF4F\uFF4E\uFF54\uFF59\uFF50\uFF45'; // "_bsontype"
|
|
198
|
+
const ESCAPE_NULL = ''; // "\0" (null chars are removed completely, they won't be recovered)
|
|
199
|
+
const REGEXP_IS_ESCAPED = new RegExp(`(${ESCAPE_DOT}|^${ESCAPE_DOLLAR}|^${ESCAPE_TO_BSON}$|^${ESCAPE_BSON_TYPE}|^${ESCAPE_TO_STRING}$)`);
|
|
200
|
+
const REGEXP_DOT = new RegExp(ESCAPE_DOT, 'g');
|
|
201
|
+
const REGEXP_DOLLAR = new RegExp(`^${ESCAPE_DOLLAR}`);
|
|
202
|
+
const REGEXP_TO_BSON = new RegExp(`^${ESCAPE_TO_BSON}$`);
|
|
203
|
+
const REGEXP_TO_STRING = new RegExp(`^${ESCAPE_TO_STRING}$`);
|
|
204
|
+
const REGEXP_BSON_TYPE = new RegExp(`^${ESCAPE_BSON_TYPE}$`);
|
|
205
|
+
/**
|
|
206
|
+
* If a property name is invalid for MongoDB or BSON, the function transforms
|
|
207
|
+
* it to a valid form, which can be (most of the time) reversed back using unescapePropertyName().
|
|
208
|
+
* For a detailed list of transformations, see escapeForBson().
|
|
209
|
+
* @private
|
|
210
|
+
*/
|
|
211
|
+
export function escapePropertyName(name) {
|
|
212
|
+
// From MongoDB docs:
|
|
213
|
+
// "Field names cannot contain dots (.) or null ("\0") characters, and they must not start with
|
|
214
|
+
// a dollar sign (i.e. $). See faq-dollar-sign-escaping for an alternate approach."
|
|
215
|
+
// Moreover, the name cannot be "toBSON" and "_bsontype" because they have a special meaning in BSON serialization.
|
|
216
|
+
// Other special BSON properties like $id and $db are covered thanks to $ escape.
|
|
217
|
+
// 2021-06-25: The `toString` string was added as a property to escape because
|
|
218
|
+
// it generates issues due to a bug in mongo bson-ext package https://jira.mongodb.org/browse/NODE-3375.
|
|
219
|
+
// pre-test to improve performance
|
|
220
|
+
// eslint-disable-next-line no-control-regex -- intentionally matching the null character escaped by MongoDB BSON
|
|
221
|
+
if (/(\.|^\$|^toBSON$|^_bsontype$|^toString$|\0)/.test(name)) {
|
|
222
|
+
name = name.replace(/\./g, ESCAPE_DOT);
|
|
223
|
+
name = name.replace(/^\$/, ESCAPE_DOLLAR);
|
|
224
|
+
name = name.replace(/^toBSON$/, ESCAPE_TO_BSON);
|
|
225
|
+
name = name.replace(/^toString$/, ESCAPE_TO_STRING);
|
|
226
|
+
name = name.replace(/^_bsontype$/, ESCAPE_BSON_TYPE);
|
|
227
|
+
// eslint-disable-next-line no-control-regex -- intentionally matching the null character escaped by MongoDB BSON
|
|
228
|
+
name = name.replace(/\0/g, ESCAPE_NULL);
|
|
229
|
+
}
|
|
230
|
+
return name;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Reverses a string transformed using escapePropertyName() back to its original form.
|
|
234
|
+
* Note that the reverse transformation might not be 100% correct for certain unlikely-to-occur strings
|
|
235
|
+
* (e.g. string contain null chars).
|
|
236
|
+
* @private
|
|
237
|
+
*/
|
|
238
|
+
export function unescapePropertyName(name) {
|
|
239
|
+
// pre-test to improve performance
|
|
240
|
+
if (REGEXP_IS_ESCAPED.test(name)) {
|
|
241
|
+
name = name.replace(REGEXP_DOT, '.');
|
|
242
|
+
name = name.replace(REGEXP_DOLLAR, '$');
|
|
243
|
+
name = name.replace(REGEXP_TO_BSON, 'toBSON');
|
|
244
|
+
name = name.replace(REGEXP_TO_STRING, 'toString');
|
|
245
|
+
name = name.replace(REGEXP_BSON_TYPE, '_bsontype');
|
|
246
|
+
}
|
|
247
|
+
return name;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Traverses an object, creates a deep clone if requested and transforms object keys and values using a provided function.
|
|
251
|
+
* The `traverseObject` is recursive, hence if the input object has circular references, the function will run into
|
|
252
|
+
* and infinite recursion and crash the Node.js process.
|
|
253
|
+
* @param obj Object to traverse, it must not contain circular references!
|
|
254
|
+
* @param clone If true, object is not modified but cloned.
|
|
255
|
+
* @param transformFunc Function used to transform the property names na value.
|
|
256
|
+
* It has the following signature: `(key, value) => [key, value]`.
|
|
257
|
+
* Beware that the transformed value is only set if it !== old value.
|
|
258
|
+
* @returns {*}
|
|
259
|
+
* @private
|
|
260
|
+
*/
|
|
261
|
+
export function traverseObject(obj, clone, transformFunc) {
|
|
262
|
+
// Primitive types don't need to be cloned or further traversed.
|
|
263
|
+
// Buffer needs to be skipped otherwise this will iterate over the whole buffer which kills the event loop.
|
|
264
|
+
if (obj === null ||
|
|
265
|
+
typeof obj !== 'object' ||
|
|
266
|
+
Object.prototype.toString.call(obj) === '[object Date]' ||
|
|
267
|
+
isBuffer(obj))
|
|
268
|
+
return obj;
|
|
269
|
+
let result;
|
|
270
|
+
if (Array.isArray(obj)) {
|
|
271
|
+
// obj is an array, keys are numbers and never need to be escaped
|
|
272
|
+
result = clone ? new Array(obj.length) : obj;
|
|
273
|
+
for (let i = 0; i < obj.length; i++) {
|
|
274
|
+
const val = traverseObject(obj[i], clone, transformFunc);
|
|
275
|
+
if (clone)
|
|
276
|
+
result[i] = val;
|
|
277
|
+
}
|
|
278
|
+
return result;
|
|
279
|
+
}
|
|
280
|
+
// obj is an object, all keys need to be checked
|
|
281
|
+
result = clone ? {} : obj;
|
|
282
|
+
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
|
283
|
+
for (const key in obj) {
|
|
284
|
+
const val = traverseObject(obj[key], clone, transformFunc);
|
|
285
|
+
const [transformedKey, transformedVal] = transformFunc(key, val);
|
|
286
|
+
if (key === transformedKey) {
|
|
287
|
+
// For better efficiency, skip setting the key-value if not cloning and nothing changed
|
|
288
|
+
if (clone || val !== transformedVal)
|
|
289
|
+
result[key] = transformedVal;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
// Key has been renamed
|
|
293
|
+
result[transformedKey] = transformedVal;
|
|
294
|
+
if (!clone)
|
|
295
|
+
delete obj[key];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return result;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Transforms an object so that it can be stored to MongoDB or serialized to BSON.
|
|
302
|
+
* It does so by transforming prohibited property names (e.g. names starting with "$",
|
|
303
|
+
* containing "." or null char, equal to "toBSON" or "_bsontype") to equivalent full-width Unicode chars
|
|
304
|
+
* which are normally allowed. To revert this transformation, use unescapeFromBson().
|
|
305
|
+
* @param obj Object to be transformed. It must not contain circular references or any complex types (e.g. Maps, Promises etc.)!
|
|
306
|
+
* @param clone If true, the function transforms a deep clone of the object rather than the original object.
|
|
307
|
+
* @returns {*} Transformed object
|
|
308
|
+
*/
|
|
309
|
+
export function escapeForBson(obj, clone = false) {
|
|
310
|
+
return traverseObject(obj, clone, (key, value) => [escapePropertyName(key), value]);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Reverts a transformation of object property names performed by escapeForBson().
|
|
314
|
+
* Note that the reverse transformation might not be 100% equal to the original object
|
|
315
|
+
* for certain unlikely-to-occur property name (e.g. one contain null chars or full-width Unicode chars).
|
|
316
|
+
* @param obj Object to be transformed. It must not contain circular references or any complex types (e.g. Maps, Promises etc.)!
|
|
317
|
+
* @param clone If true, the function transforms a deep clone of the object rather than the original object.
|
|
318
|
+
* @returns {*} Transformed object.
|
|
319
|
+
*/
|
|
320
|
+
export function unescapeFromBson(obj, clone = false) {
|
|
321
|
+
return traverseObject(obj, clone, (key, value) => [unescapePropertyName(key), value]);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Determines whether an object contains property names that cannot be stored to MongoDB.
|
|
325
|
+
* See escapeForBson() for more details.
|
|
326
|
+
* Note that this function only works with objects that are serializable to JSON!
|
|
327
|
+
* @param obj Object to be checked. It must not contain circular references or any complex types (e.g. Maps, Promises etc.)!
|
|
328
|
+
* @returns {boolean} Returns true if object is invalid, otherwise it returns false.
|
|
329
|
+
*/
|
|
330
|
+
export function isBadForMongo(obj) {
|
|
331
|
+
let isBad = false;
|
|
332
|
+
try {
|
|
333
|
+
traverseObject(obj, false, (key, value) => {
|
|
334
|
+
const escapedKey = escapePropertyName(key);
|
|
335
|
+
if (key !== escapedKey) {
|
|
336
|
+
isBad = true;
|
|
337
|
+
throw new Error();
|
|
338
|
+
}
|
|
339
|
+
return [key, value];
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
catch (e) {
|
|
343
|
+
if (!isBad)
|
|
344
|
+
throw e;
|
|
345
|
+
}
|
|
346
|
+
return isBad;
|
|
347
|
+
}
|
|
348
|
+
export class JsonVariable {
|
|
349
|
+
name;
|
|
350
|
+
constructor(name) {
|
|
351
|
+
this.name = name;
|
|
352
|
+
}
|
|
353
|
+
getToken() {
|
|
354
|
+
return `{{${this.name}}}`;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Stringifies provided value to JSON with a difference that supports functions that
|
|
359
|
+
* are stringified using .toString() method.
|
|
360
|
+
*
|
|
361
|
+
* In addition to that supports instances of JsonVariable('my.token') that are replaced
|
|
362
|
+
* with a {{my.token}}.
|
|
363
|
+
*/
|
|
364
|
+
export function jsonStringifyExtended(value, replacer, space = 0) {
|
|
365
|
+
if (replacer && !(replacer instanceof Function))
|
|
366
|
+
throw new Error('Parameter "replacer" of jsonStringifyExtended() must be a function!');
|
|
367
|
+
const replacements = {};
|
|
368
|
+
const extendedReplacer = (key, val) => {
|
|
369
|
+
val = replacer ? replacer(key, val) : val;
|
|
370
|
+
if (val instanceof Function)
|
|
371
|
+
return val.toString();
|
|
372
|
+
if (val instanceof JsonVariable) {
|
|
373
|
+
const randomToken = `<<<REPLACEMENT_TOKEN::${Math.random()}>>>`;
|
|
374
|
+
replacements[randomToken] = val.getToken();
|
|
375
|
+
return randomToken;
|
|
376
|
+
}
|
|
377
|
+
return val;
|
|
378
|
+
};
|
|
379
|
+
let stringifiedValue = JSON.stringify(value, extendedReplacer, space);
|
|
380
|
+
Object.entries(replacements).forEach(([replacementToken, replacementValue]) => {
|
|
381
|
+
stringifiedValue = stringifiedValue.replace(`"${replacementToken}"`, replacementValue);
|
|
382
|
+
});
|
|
383
|
+
return stringifiedValue;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Splits a full name into the first name and last name, trimming all internal and external spaces.
|
|
387
|
+
* Returns an array with two elements or null if splitting is not possible.
|
|
388
|
+
*/
|
|
389
|
+
export function splitFullName(fullName) {
|
|
390
|
+
if (typeof fullName !== 'string')
|
|
391
|
+
return [null, null];
|
|
392
|
+
const names = (fullName || '').trim().split(' ');
|
|
393
|
+
const nonEmptyNames = names.filter((val) => val);
|
|
394
|
+
if (nonEmptyNames.length === 0) {
|
|
395
|
+
return [null, null];
|
|
396
|
+
}
|
|
397
|
+
if (nonEmptyNames.length === 1) {
|
|
398
|
+
return [null, nonEmptyNames[0]];
|
|
399
|
+
}
|
|
400
|
+
return [names[0], nonEmptyNames.slice(1).join(' ')];
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Perform a Regex test on a given URL to see if it is relative.
|
|
404
|
+
*/
|
|
405
|
+
export function isUrlRelative(url) {
|
|
406
|
+
return RELATIVE_URL_REGEX.test(url);
|
|
407
|
+
}
|
|
408
|
+
//# sourceMappingURL=utilities.client.js.map
|