UNPKG

http-request-mock

Version:

Intercept & mock http requests issued by XMLHttpRequest, fetch, nodejs https/http module, axios, jquery, superagent, ky, node-fetch, request, got or any other request libraries by intercepting XMLHttpRequest, fetch and nodejs native requests in low level.

2,359 lines (2,235 loc) 594 kB
/******/ var __webpack_modules__ = ({ /***/ 395: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { rand: () => (/* binding */ rand), randAbbreviation: () => (/* binding */ randAbbreviation), randAccessory: () => (/* binding */ randAccessory), randAccount: () => (/* binding */ randAccount), randAddress: () => (/* binding */ randAddress), randAirline: () => (/* binding */ randAirline), randAirport: () => (/* binding */ randAirport), randAirportCode: () => (/* binding */ randAirportCode), randAirportName: () => (/* binding */ randAirportName), randAlpha: () => (/* binding */ randAlpha), randAlphaNumeric: () => (/* binding */ randAlphaNumeric), randAmericanFootballTeam: () => (/* binding */ randAmericanFootballTeam), randAnimalType: () => (/* binding */ randAnimalType), randArn: () => (/* binding */ randArn), randAvatar: () => (/* binding */ randAvatar), randAwsRegion: () => (/* binding */ randAwsRegion), randAwsRequestId: () => (/* binding */ randAwsRequestId), randAwsService: () => (/* binding */ randAwsService), randBaseballTeam: () => (/* binding */ randBaseballTeam), randBasketballTeam: () => (/* binding */ randBasketballTeam), randBear: () => (/* binding */ randBear), randBetweenDate: () => (/* binding */ randBetweenDate), randBinary: () => (/* binding */ randBinary), randBird: () => (/* binding */ randBird), randBitcoinAddress: () => (/* binding */ randBitcoinAddress), randBook: () => (/* binding */ randBook), randBoolean: () => (/* binding */ randBoolean), randBrand: () => (/* binding */ randBrand), randBrowser: () => (/* binding */ randBrowser), randCardinalDirection: () => (/* binding */ randCardinalDirection), randCat: () => (/* binding */ randCat), randCatchPhrase: () => (/* binding */ randCatchPhrase), randCetacean: () => (/* binding */ randCetacean), randCity: () => (/* binding */ randCity), randClothingSize: () => (/* binding */ randClothingSize), randCodeSnippet: () => (/* binding */ randCodeSnippet), randColor: () => (/* binding */ randColor), randCompanyName: () => (/* binding */ randCompanyName), randCountry: () => (/* binding */ randCountry), randCountryCode: () => (/* binding */ randCountryCode), randCounty: () => (/* binding */ randCounty), randCow: () => (/* binding */ randCow), randCreditCard: () => (/* binding */ randCreditCard), randCreditCardBrand: () => (/* binding */ randCreditCardBrand), randCreditCardCVV: () => (/* binding */ randCreditCardCVV), randCreditCardNumber: () => (/* binding */ randCreditCardNumber), randCrocodilia: () => (/* binding */ randCrocodilia), randCurrencyCode: () => (/* binding */ randCurrencyCode), randCurrencyName: () => (/* binding */ randCurrencyName), randCurrencySymbol: () => (/* binding */ randCurrencySymbol), randDatabaseCollation: () => (/* binding */ randDatabaseCollation), randDatabaseColumn: () => (/* binding */ randDatabaseColumn), randDatabaseEngine: () => (/* binding */ randDatabaseEngine), randDatabaseType: () => (/* binding */ randDatabaseType), randDepartment: () => (/* binding */ randDepartment), randDirection: () => (/* binding */ randDirection), randDirectoryPath: () => (/* binding */ randDirectoryPath), randDog: () => (/* binding */ randDog), randDomainName: () => (/* binding */ randDomainName), randDomainSuffix: () => (/* binding */ randDomainSuffix), randDrinks: () => (/* binding */ randDrinks), randEmail: () => (/* binding */ randEmail), randEmailProvider: () => (/* binding */ randEmailProvider), randEmoji: () => (/* binding */ randEmoji), randEthereumAddress: () => (/* binding */ randEthereumAddress), randFileExt: () => (/* binding */ randFileExt), randFileName: () => (/* binding */ randFileName), randFilePath: () => (/* binding */ randFilePath), randFileType: () => (/* binding */ randFileType), randFirstName: () => (/* binding */ randFirstName), randFish: () => (/* binding */ randFish), randFlightDetails: () => (/* binding */ randFlightDetails), randFlightNumber: () => (/* binding */ randFlightNumber), randFloat: () => (/* binding */ randFloat), randFontFamily: () => (/* binding */ randFontFamily), randFontSize: () => (/* binding */ randFontSize), randFood: () => (/* binding */ randFood), randFootballTeam: () => (/* binding */ randFootballTeam), randFrequency: () => (/* binding */ randFrequency), randFullAddress: () => (/* binding */ randFullAddress), randFullName: () => (/* binding */ randFullName), randFutureDate: () => (/* binding */ randFutureDate), randGender: () => (/* binding */ randGender), randGitBranch: () => (/* binding */ randGitBranch), randGitCommitEntry: () => (/* binding */ randGitCommitEntry), randGitCommitMessage: () => (/* binding */ randGitCommitMessage), randGitCommitSha: () => (/* binding */ randGitCommitSha), randGitShortSha: () => (/* binding */ randGitShortSha), randHex: () => (/* binding */ randHex), randHexaDecimal: () => (/* binding */ randHexaDecimal), randHorse: () => (/* binding */ randHorse), randHsl: () => (/* binding */ randHsl), randHttpMethod: () => (/* binding */ randHttpMethod), randIban: () => (/* binding */ randIban), randIceHockeyTeam: () => (/* binding */ randIceHockeyTeam), randImg: () => (/* binding */ randImg), randIntegration: () => (/* binding */ randIntegration), randIp: () => (/* binding */ randIp), randIpv6: () => (/* binding */ randIpv6), randJSON: () => (/* binding */ randJSON), randJobArea: () => (/* binding */ randJobArea), randJobDescriptor: () => (/* binding */ randJobDescriptor), randJobTitle: () => (/* binding */ randJobTitle), randJobType: () => (/* binding */ randJobType), randLanguage: () => (/* binding */ randLanguage), randLastName: () => (/* binding */ randLastName), randLatitude: () => (/* binding */ randLatitude), randLine: () => (/* binding */ randLine), randLines: () => (/* binding */ randLines), randLion: () => (/* binding */ randLion), randLocale: () => (/* binding */ randLocale), randLongitude: () => (/* binding */ randLongitude), randMac: () => (/* binding */ randMac), randMask: () => (/* binding */ randMask), randMimeType: () => (/* binding */ randMimeType), randMonth: () => (/* binding */ randMonth), randMovie: () => (/* binding */ randMovie), randMovieCharacter: () => (/* binding */ randMovieCharacter), randMusicGenre: () => (/* binding */ randMusicGenre), randNearbyGPSCoordinate: () => (/* binding */ randNearbyGPSCoordinate), randNumber: () => (/* binding */ randNumber), randOAuthProvider: () => (/* binding */ randOAuthProvider), randOctal: () => (/* binding */ randOctal), randOrdinalDirection: () => (/* binding */ randOrdinalDirection), randParagraph: () => (/* binding */ randParagraph), randPassword: () => (/* binding */ randPassword), randPastDate: () => (/* binding */ randPastDate), randPermission: () => (/* binding */ randPermission), randPersonTitle: () => (/* binding */ randPersonTitle), randPhoneNumber: () => (/* binding */ randPhoneNumber), randPhrase: () => (/* binding */ randPhrase), randPort: () => (/* binding */ randPort), randPost: () => (/* binding */ randPost), randPriority: () => (/* binding */ randPriority), randProduct: () => (/* binding */ randProduct), randProductAdjective: () => (/* binding */ randProductAdjective), randProductCategory: () => (/* binding */ randProductCategory), randProductDescription: () => (/* binding */ randProductDescription), randProductMaterial: () => (/* binding */ randProductMaterial), randProductName: () => (/* binding */ randProductName), randProgrammingLanguage: () => (/* binding */ randProgrammingLanguage), randPronoun: () => (/* binding */ randPronoun), randProtocol: () => (/* binding */ randProtocol), randQuote: () => (/* binding */ randQuote), randRabbit: () => (/* binding */ randRabbit), randRecentDate: () => (/* binding */ randRecentDate), randRgb: () => (/* binding */ randRgb), randRole: () => (/* binding */ randRole), randRoutingNumber: () => (/* binding */ randRoutingNumber), randSeatNumber: () => (/* binding */ randSeatNumber), randSemver: () => (/* binding */ randSemver), randSentence: () => (/* binding */ randSentence), randSequence: () => (/* binding */ randSequence), randShape: () => (/* binding */ randShape), randSinger: () => (/* binding */ randSinger), randSkill: () => (/* binding */ randSkill), randSlug: () => (/* binding */ randSlug), randSnake: () => (/* binding */ randSnake), randSocial: () => (/* binding */ randSocial), randSong: () => (/* binding */ randSong), randSoonDate: () => (/* binding */ randSoonDate), randSports: () => (/* binding */ randSports), randSportsTeam: () => (/* binding */ randSportsTeam), randState: () => (/* binding */ randState), randStateAbbr: () => (/* binding */ randStateAbbr), randStatus: () => (/* binding */ randStatus), randStreetAddress: () => (/* binding */ randStreetAddress), randStreetName: () => (/* binding */ randStreetName), randSubscriptionPlan: () => (/* binding */ randSubscriptionPlan), randSuperhero: () => (/* binding */ randSuperhero), randSuperheroName: () => (/* binding */ randSuperheroName), randSvg: () => (/* binding */ randSvg), randText: () => (/* binding */ randText), randTextRange: () => (/* binding */ randTextRange), randTimeZone: () => (/* binding */ randTimeZone), randTodo: () => (/* binding */ randTodo), randTransactionType: () => (/* binding */ randTransactionType), randUrl: () => (/* binding */ randUrl), randUser: () => (/* binding */ randUser), randUserAgent: () => (/* binding */ randUserAgent), randUserName: () => (/* binding */ randUserName), randUuid: () => (/* binding */ randUuid), randVehicle: () => (/* binding */ randVehicle), randVehicleFuel: () => (/* binding */ randVehicleFuel), randVehicleManufacturer: () => (/* binding */ randVehicleManufacturer), randVehicleModel: () => (/* binding */ randVehicleModel), randVehicleType: () => (/* binding */ randVehicleType), randVerb: () => (/* binding */ randVerb), randWeekday: () => (/* binding */ randWeekday), randWord: () => (/* binding */ randWord), randZipCode: () => (/* binding */ randZipCode), random: () => (/* binding */ random), seed: () => (/* binding */ seed) }); // EXTERNAL MODULE: ./node_modules/seedrandom/index.js var seedrandom = __webpack_require__(391); var seedrandom_default = /*#__PURE__*/__webpack_require__.n(seedrandom); ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). var getRandomValues; var rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, // find the complete implementation of crypto (msCrypto) on IE11. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/regex.js /* harmony default export */ const regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i); ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/validate.js function validate(uuid) { return typeof uuid === 'string' && regex.test(uuid); } /* harmony default export */ const esm_browser_validate = (validate); ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ var byteToHex = []; for (var i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).substr(1)); } function stringify(arr) { var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!esm_browser_validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = (stringify); ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { options = options || {}; var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (var i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return esm_browser_stringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); ;// CONCATENATED MODULE: ./node_modules/@ngneat/falso/index.esm.js let prng = seedrandom_default()(); /** * Create a seed. * * @category general * * @example * * random() * */ function random() { return prng(); } /** * Sets and Resets random seed. * * @category general * * @example * * seed() * * @example * * seed('some-constant-seed') */ function seed(value) { prng = seedrandom_default()(value); } function fake(data, options) { const dataSource = Array.isArray(data) ? () => randElement(data) : data; if (!(options != null && options.length)) { return dataSource(0); } return Array.from({ length: options.length }, (_, index) => dataSource(index)); } function randElement(arr) { return arr[Math.floor(random() * arr.length)]; } function getRandomInRange({ min = 1.0, max = 9999.99, fraction = 0 } = {}) { return Number((random() * (max - min) + min).toFixed(fraction)); } var data$1X = [ "SCSI", "SMTP", "ADP", "TCP", "PNG", "EXE", "AI", "RAM", "RSS", "GB", "SSL", "CSS", "SAS", "SDD", "PCI", "IB", "SQL", "XML", "THX", "AGP", "HTTP", "SMS", "FTP", "JBOD", "XSS", "HDD", "JSON", "COM" ]; /** * Generate a random abbreviation. * * @category text * * @example * * randAbbreviation() * * @example * * randAbbreviation({ length: 10 }) * */ function randAbbreviation(options) { return fake(data$1X, options); } var data$1W = [ "Sunglasses", "Apron", "Necklace", "Watch", "Socks", "Tie", "Bow tie", "Purse", "Ring", "Gloves", "Scarf", "Umbrella", "Boots", "Mittens", "Stockings", "Earmuffs", "Hair clip", "Bobby pin", "Hair band", "Safety pin", "Pocket watch", "Beanie", "Cap", "Beret", "Straw hat", "Derby hat", "Helmet", "Top hat", "Mortar board" ]; /** * Generate a random accessory. * * @category Commerce * * @example * * randAccessory() * * @example * * randAccessory({ length: 10 }) * */ function randAccessory(options) { return fake(data$1W, options); } /** * Generate a random account. * * @category finance * * @example * * randAccount() * * @example * * randAccount({ accountLength: 12 }) // default is 9 * * @example * * randAccount({ length: 10 }) * */ function randAccount(options) { var _options$accountLengt; const accountLength = (_options$accountLengt = options == null ? void 0 : options.accountLength) != null ? _options$accountLengt : 9; const factory = () => { return Array(accountLength).fill('#').join('').replace(/#/g, () => { return getRandomInRange({ min: 0, max: 9 }).toString(); }); }; return fake(factory, options); } const numericChars = '0123456789'; const alphaChars = 'abcdefghijklmnopqrstuvwxyz'; // TODO const numericAlphaChars = `${numericChars}${alphaChars}${alphaChars.split('').map(v => v.toUpperCase()).join('')}`; function generator$1(size = 8, chars = numericAlphaChars) { let result = ''; for (let i = size; i > 0; --i) result += chars[Math.floor(random() * chars.length)]; return result; } /** * Generate a random sequence. * * @category general * * @example * * randSequence() * * @example * * randSequence({ size: 10 }) * * @example * * randSequence({ chars: 'aAbBcC@#' }) * * @example * * randSequence({ length: 10 }) * */ function randSequence(options) { return fake(() => generator$1(options == null ? void 0 : options.size, options == null ? void 0 : options.chars), options); } /** * Get a random alpha. * * @category text * * @example * * randAlpha() * * @example * * randAlpha({ length: 3 }) * */ function randAlpha(options) { return fake(alphaChars.split(''), options); } /** * Generate a random boolean. * * @category general * * @example * * randBoolean() * * @example * * randBoolean({ length: 10 }) * */ function randBoolean(options) { return fake(() => randElement([true, false]), options); } /** * Generate a random number. * * @category general, math * * @example * * randNumber() * * @example * * randNumber({ length: 10 }) * * @example * * randNumber({ min: 10, max: 1000 }) // default is 'min': 0, 'max': 999_999 * * @example * * randNumber({ min: 1000, max: 100000, precision: 1000 }) // 67000 * * @example * * randNumber({ min: 1000, max: 2000, precision: 100 }) // 1200 * * @example * * randNumber({ min: 1000, max: 2000, precision: 10 }) // 1250 */ function randNumber(options) { const o = { min: (options == null ? void 0 : options.min) || 0, max: (options == null ? void 0 : options.max) || 999999, precision: options == null ? void 0 : options.precision }; return fake(() => { const num = getRandomInRange(o); if (o.precision !== undefined) { return Math.floor(num / o.precision) * o.precision; } return num; }, options); } /** * Get a random alpha or numeric. * * @category text * * @example * * randAlphaNumeric() * * @example * * randAlphaNumeric({ length: 3 }) * */ function randAlphaNumeric(options) { return fake(() => randBoolean() ? randAlpha() : randNumber({ min: 0, max: 9 }), options); } var data$1V = [ "Arizona Cardinals", "Atlanta Falcons", "Baltimore Ravens", "Buffalo Bills", "Carolina Panthers", "Chicago Bears", "Cincinnati Bengals", "Cleveland Browns", "Dallas Cowboys", "Denver Broncos", "Detroit Lions", "Green Bay Packers", "Houston Texans", "Indianapolis Colts", "Jacksonville Jaguars", "Kansas City Chiefs", "Las Vegas Raiders", "Los Angeles Chargers", "Los Angeles Rams", "Miami Dolphins", "Minnesota Vikings", "New England Patriots", "New Orleans Saints", "New York Giants", "New York Jets", "Philadelphia Eagles", "Pittsburgh Steelers", "San Francisco 49ers", "Seattle Seahawks", "Tampa Bay Buccaneers", "Tennessee Titans" ]; /** * Generate a random american football team. * * @category sports * * @example * * randAmericanFootballTeam() * * @example * * randAmericanFootballTeam({ length: 10 }) * */ function randAmericanFootballTeam(options) { return fake(data$1V, options); } var data$1U = [ "bird", "cetacean", "rabbit", "bear", "cat", "snake", "cow", "insect", "crocodile", "horse", "fish", "dog", "lion" ]; /** * Generate a random animal type. * * @category animals * * @example * * randAnimalType() * * @example * * randAnimalType({ length: 10 }) * */ function randAnimalType(options) { return fake(data$1U, options); } var data$1T = [ "us-east-2", "us-east-1", "us-west-1", "us-west-2", "af-south-1", "ap-east-1", "ap-southeast-3", "ap-south-1", "ap-northeast-3", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-south-1", "eu-west-3", "eu-north-1", "me-south-1", "sa-east-1", "us-gov-east-1", "us-gov-west-1" ]; /** * Generate a random AWS region. * * @category AWS * * @example * * randAwsRegion() * * @example * * randAwsRegion({ length: 10 }) * */ function randAwsRegion(options) { return fake(data$1T, options); } var data$1S = [ "/usr/X11R6", "/sys", "/mnt", "/Network", "/usr/libdata", "/Library", "/sbin", "/tmp", "/usr/local/src", "/boot/defaults", "/etc/mail", "/bin", "/boot", "/var/tmp", "/etc/namedb", "/private/var", "/var/mail", "/opt", "/opt/lib", "/proc", "/usr/include", "/usr/src", "/home/user", "/selinux", "/usr/libexec", "/dev", "/etc/defaults", "/usr", "/usr/share", "/rescue", "/private", "/usr/sbin", "/home/user/dir", "/Users", "/var", "/lost+found", "/usr/bin", "/etc/ppp", "/var/spool", "/var/yp", "/usr/ports", "/private/tmp", "/usr/obj", "/home", "/media" ]; /** * Generate a random directory path. * * @category system * * @example * * randDirectoryPath() * * @example * * randDirectoryPath({ length: 10 }) * */ function randDirectoryPath(options) { return fake(data$1S, options); } var data$1R = [ "markets", "solid_backing_strategist", "granite", "synthesizing_executive_specialist", "ecuador", "calculate_island", "nevada", "gloves_manat_delaware", "loan_saint", "client_server", "kroon", "investor", "dynamic_portal", "pixel", "concrete", "nuevo_avon_market", "productize_withdrawal_override", "operative_sum_bypassing", "visionary_online_account", "balboa", "sql_connecting", "incredible_azure_interface", "open_source_netherlands_copying", "hack_hard_thailand", "berkshire_car_micronesia", "pound_program_handmade", "implement_nevada", "home", "agp", "berkshire_investment_tasty", "licensed_pink_fundamental", "concrete_encompassing", "holistic", "application_saint_infrastructureg", "visionary", "towels_visionary_ergonomic", "scalable_jewelery_sudan", "revolutionary", "global_fresh_open_source", "png_capacitor_quantify", "automotive", "action_items", "soap_unbranded", "music_payment_payment", "chips_taiwan", "payment", "intelligent_connecting_account", "capacitor_bypass", "tools_vatu", "interface", "e_markets", "transmit_borders_input", "invoice", "ball_orange", "morph_magnetic", "team_oriented_ivory", "concrete_compress", "market_hack", "wireless_frictionless_chicken", "png", "turquoise_territories_berkshire", "back_end", "withdrawal_paradigm_matrix", "payment_context_sensitive_wisconsin", "unbranded_json_wooden", "invoice_sleek_customized", "silver_copying", "licensed", "plug_and_play", "cultivate_orchestrator", "quantifying_quantify_norway", "account_borders_gourde", "quantifyg", "open_architected_content_based_protocol", "administrator", "synthesizing", "metrics", "white_wireless_garden", "berkshireg", "nepal_view_protocol", "calculating_shirt", "fuchsia_reintermediate_fish", "extend", "matrix", "peso", "superstructure_value_added_redundant", "national_world_classv", "yellowv", "moratorium", "views", "metal_drive_sports", "ports_pink_overriding", "borders", "supply_chains_client_driven_dynamic", "shirt_moratorium_place", "calculate", "protocol_engineer_azerbaijan", "chair_rss", "b2b_belarussian", "fiji" ]; /** * Generate a random file name. * * @category system * * @example * * randFileName() * * @example * * randFileName({ length: 10 }) * */ function randFileName(options) { var _options$extension; const ext = (_options$extension = options == null ? void 0 : options.extension) != null ? _options$extension : 'pdf'; return fake(() => `${randElement(data$1R)}.${ext}`, options); } const partitions = ['aws', 'aws-cn', 'aws-us-gov']; const services = ['s3', 'sqs', 'lambda', 'iam']; const serviceArn = { s3: () => `::${randDirectoryPath()}/*`, iam: () => `:${randAccount()}:${fake(['user', 'group'])}/*`, sqs: () => `${randAwsRegion()}:${randAccount()}:queue${randNumber({ min: 1, max: 10 })}`, lambda: () => `${randAwsRegion()}:${randAccount()}:function:${randFileName().replace(/_/g, '-')}` }; /** * Generate a random ARN. * * @category AWS * * @example * * randArn() * * @example * * randArn({ length: 10 }) * */ function randArn(options) { return fake(() => { const partition = fake(partitions); const service = fake(services); return `arn:${partition}:${service}:${serviceArn[service]()}`; }, options); } /** * Generate a random avatar. * * @category person * * @example * * randAvatar() * * @example * * randAvatar({ length: 10 }) * * @example * * randAvatar({ size: 200 }) // default is 100 * */ function randAvatar(options) { var _options$size; const size = (_options$size = options == null ? void 0 : options.size) != null ? _options$size : 100; return fake(() => `https://i.pravatar.cc/${size}`, options); } var data$1Q = [ "EC2", "RDS", "S3", "Lambda", "CloudFront", "Glacier", "SNS", "SQS", "EBS", "VPC", "Kinesis", "Kinesis Data Firehose", "Dynamo DB", "ElastiCache", "CloudWatch", "Cognito", "Cognito", "API Gateway", "AppSync", "Athena" ]; /** * Generate a random AWS service name. * * @category AWS * * @example * * randAwsService() * * @example * * randAwsService({ length: 10 }) * */ function randAwsService(options) { return fake(data$1Q, options); } /** * Generate a random AWS request id. * * @category AWS * * @example * * randAwsRequestId() * * @example * * randAwsRequestId({ length: 10 }) * */ function randAwsRequestId(options) { const generator = () => { return [randAlphaNumeric({ length: 8 }), randAlphaNumeric({ length: 4 }), randAlphaNumeric({ length: 4 }), randAlphaNumeric({ length: 4 }), randAlphaNumeric({ length: 12 })].map(v => v.join('')).join('-'); }; return fake(generator, options); } var data$1P = [ "Arizona Diamondbacks", "Atlanta Braves", "Baltimore Orioles", "Boston Red Sox", "Chicago Cubs", "Chicago White Sox", "Cincinnati Reds", "Cleveland Guardians", "Colorado Rockies", "Detroit Tigers", "Houston Astros", "Kansas City Royals", "Los Angeles Angels", "Los Angeles Dodgers", "Miami Marlins", "Milwaukee Brewers", "Minnesota Twins", "New York Mets", "New York Yankees", "Oakland Athletics", "Philadelphia Phillies", "Pittsburgh Pirates", "San Diego Padres", "San Francisco Giants", "Seattle Mariners", "St. Louis Cardinals", "Tampa Bay Rays", "Texas Rangers", "Toronto Blue Jays", "Washington Nationals" ]; /** * Generate a random baseball team. * * @category sports * * @example * * randBaseballTeam() * * @example * * randBaseballTeam({ length: 10 }) * */ function randBaseballTeam(options) { return fake(data$1P, options); } var data$1O = [ "Atlanta Hawks", "Boston Celtics", "Brooklyn Nets", "Charlotte Hornets", "Chicago Bulls", "Cleveland Cavaliers", "Dallas Mavericks", "Denver Nuggets", "Detroit Pistons", "Golden State Warriors", "Houston Rockets", "Indiana Pacers", "LA Clippers", "Los Angeles Lakers", "Memphis Grizzlies", "Miami Heat", "Milwaukee Bucks", "Minnesota Timberwolves", "New Orleans Pelicans", "New York Knicks", "Oklahoma City Thunder", "Orlando Magic", "Philadelphia 76ers", "Phoenix Suns", "Portland Trail Blazers", "Sacramento Kings", "San Antonio Spurs", "Toronto Raptors", "Utah Jazz", "Washington Wizards" ]; /** * Generate a random basketball team. * * @category sports * * @example * * randBasketballTeam() * * @example * * randBasketballTeam({ length: 10 }) * */ function randBasketballTeam(options) { return fake(data$1O, options); } var data$1N = [ "Spectacled bear", "Brown bear", "Asian black bear", "Sun bear", "Polar bear", "Giant panda", "Sloth bear", "American black bear" ]; /** * Generate a random bear. * * @category animals * * @example * * randBear() * * @example * * randBear({ length: 10 }) * */ function randBear(options) { return fake(data$1N, options); } /** * Generate a random date between ranges. * * @category date * * @example * * randBetweenDate({ from: new Date('10/07/2020'), to: new Date() }) * * @example * * randBetweenDate({ from: new Date('10/07/2020'), to: new Date(), length: 10 }) * */ function randBetweenDate(options) { const from = options.from.getTime(); const to = options.to.getTime(); if (from >= to) { throw new Error('From must be before to'); } const generator = () => { return new Date(randNumber({ min: from, max: to })); }; return fake(generator, options); } /** * Generate a random binary. * * @category Math * * @example * * randBinary() * * @example * * randBinary({ length: 10 }) * */ function randBinary(options) { return fake(() => { const RADIX = 2; const randomNumber = getRandomInRange({ min: 0, max: Number.MAX_SAFE_INTEGER, fraction: 0 }); return BigInt(randomNumber.toString(RADIX)).toString(); }, options); } var data$1M = [ "Red-necked Phalarope", "Cliff Swallow", "Loggerhead Kingbird", "Aztec Thrush", "Hooded Warbler", "Common Pochard", "Scotts Oriole", "Black-browed Albatross", "Monk Parakeet", "Magnificent Hummingbird", "Broad-billed Sandpiper", "Bushtit", "Mexican Jay", "Hooded Merganser", "Wood Stork", "Rosss Gull", "Green Sandpiper", "Whooping Crane" ]; /** * Generate a random bird. * * @category animals * * @example * * randBird() * * @example * * randBird({ length: 10 }) * */ function randBird(options) { return fake(data$1M, options); } /** * Generate a random bitcoin-address. * * @category finance * * @example * * randBitcoinAddress() * * @example * * randBitcoinAddress({ length: 10 }) * */ function randBitcoinAddress(options) { return fake(() => randSequence({ size: 33 }), options); } var data$1L = [ { title: "The Adventures of Augie March", author: "Saul Bellow", category: "Comedy" }, { title: "The Uncommon Reader", author: "Alan Bennett", category: "Comedy" }, { title: "Don Quixote", author: "Miguel de Cervantes", category: "Comedy" }, { title: "Tom Jones", author: "Henry Fielding", category: "Comedy" }, { title: "Dead Souls", author: "Nikolai Gogol", category: "Comedy" }, { title: "The Wind in the Willows", author: "Kenneth Grahame", category: "Comedy" }, { title: "Our Man in Havana", author: "Graham Greene", category: "Comedy" }, { title: "Catch-22", author: "Joseph Heller", category: "Comedy" }, { title: "High Fidelity", author: "Nick Hornby", category: "Comedy" }, { title: "Three Men in a Boat", author: "Jerome K Jerome", category: "Comedy" }, { title: "Finnegans Wake", author: "James Joyce", category: "Comedy" }, { title: "Puckoon", author: "Spike Milligan", category: "Comedy" }, { title: "Portnoy’s Complaint", author: "Philip Roth", category: "Comedy" }, { title: "Great Apes", author: "Will Self", category: "Comedy" }, { title: "The Life and Opinions of Tristram Shandy, Gentleman", author: "Laurence Sterne", category: "Comedy" }, { title: "A Confederacy of Dunces", author: "John Kennedy Toole", category: "Comedy" }, { title: "Breakfast of Champions", author: "Kurt Vonnegut", category: "Comedy" }, { title: "Infinite Jest", author: "David Foster Wallace", category: "Comedy" }, { title: "Molesworth", author: "Geoffrey Willans and Ronald Searle", category: "Comedy" }, { title: "Thank You Jeeves", author: "PG Wodehouse", category: "Comedy" }, { title: "The Thirty-Nine Steps", author: "John Buchan", category: "Crime" }, { title: "The Big Sleep", author: "Raymond Chandler", category: "Crime" }, { title: "And Then There Were None", author: "Agatha Christie", category: "Crime" }, { title: "The Hound of the Baskervilles", author: "Arthur Conan Doyle", category: "Crime" }, { title: "The Manchurian Candidate", author: "Richard Condon", category: "Crime" }, { title: "The Andromeda Strain", author: "Michael Crichton", category: "Crime" }, { title: "The Ipcress File", author: "Len Deighton", category: "Crime" }, { title: "Crime and Punishment", author: "Fyodor Dostoevsky", category: "Crime" }, { title: "The Count of Monte Cristo", author: "Alexandre Dumas", category: "Crime" }, { title: "The Day of the Jackal", author: "Frederick Forsyth", category: "Crime" }, { title: "The Third Man", author: "Graham Greene", category: "Crime" }, { title: "A Time to Kill", author: "John Grisham", category: "Crime" }, { title: "The Thin Man", author: "Dashiell Hammett", category: "Crime" }, { title: "The Talented Mr Ripley", author: "Patricia Highsmith", category: "Crime" }, { title: "Tinker, Tailor, Soldier, Spy", author: "John le Carre", category: "Crime" }, { title: "To Kill a Mockingbird", author: "Harper Lee", category: "Crime" }, { title: "No Country for Old Men", author: "Cormac McCarthy", category: "Crime" }, { title: "The Godfather", author: "Mario Puzo", category: "Crime" }, { title: "The Crying of Lot 49", author: "Thomas Pynchon", category: "Crime" }, { title: "Judgment in Stone", author: "Ruth Rendell", category: "Crime" }, { title: "Little Women", author: "Louisa May Alcott", category: "Family and Self" }, { title: "Le Pere Goriot", author: "Honore de Balzac", category: "Family and Self" }, { title: "The Outsider", author: "Albert Camus", category: "Family and Self" }, { title: "Great Expectations", author: "Charles Dickens", category: "Family and Self" }, { title: "The Sound and the Fury", author: "William Faulkner", category: "Family and Self" }, { title: "Howards End", author: "EM Forster", category: "Family and Self" }, { title: "The Power and the Glory", author: "Graham Greene", category: "Family and Self" }, { title: "Steppenwolf", author: "Herman Hesse", category: "Family and Self" }, { title: "A Prayer for Owen Meany", author: "John Irving", category: "Family and Self" }, { title: "Ulysses", author: "James Joyce", category: "Family and Self" }, { title: "One Flew Over the Cuckoo’s Nest", author: "Ken Kesey", category: "Family and Self" }, { title: "How Green was My Valley", author: "Richard Llewellyn", category: "Family and Self" }, { title: "The Bluest Eye", author: "Toni Morrison", category: "Family and Self" }, { title: "Who Do You Think You Are?", author: "Alice Munro", category: "Family and Self" }, { title: "The Bell Jar", author: "Sylvia Plath", category: "Family and Self" }, { title: "Remembrance of Things Past", author: "Marcel Proust", category: "Family and Self" }, { title: "The Catcher in the Rye", author: "JD Salinger", category: "Family and Self" }, { title: "The Color Purple", author: "Alice Walker", category: "Family and Self" }, { title: "Jimmy Corrigan, The Smarest Kid on Earth", author: "Chris Ware", category: "Family and Self" }, { title: "The Picture of Dorian Gray", author: "Oscar Wilde", category: "Family and Self" }, { title: "Pride and Prejudice", author: "Jane Austen", category: "Love" }, { title: "Jane Eyre", author: "Charlotte Bronte", category: "Love" }, { title: "Wuthering Heights", author: "Emily Bronte", category: "Love" }, { title: "Breakfast at Tiffany’s", author: "Truman Capote", category: "Love" }, { title: "Rebecca", author: "Daphne du Maurier", category: "Love" }, { title: "Daniel Deronda", author: "George Eliot", category: "Love" }, { title: "The Great Gatsby", author: "F Scott Fitzgerald", category: "Love" }, { title: "Madame Bovary", author: "Gustave Flaubert", category: "Love" }, { title: "A Room with a View", author: "EM Forster", category: "Love" }, { title: "The Sorrows of Young Werther", author: "Johann Wolfgang Goethe", category: "Love" }, { title: "Far From the Madding Crowd", author: "Thomas Hardy", category: "Love" }, { title: "The Scarlet Letter", author: "Nathaniel Hawthorne", category: "Love" }, { title: "The Remains of the Day", author: "Kazuo Ishiguro", category: "Love" }, { title: "Les Liaisons Dangereuses", author: "Pierre-Ambroise-Francois Choderlos de Laclos", category: "Love" }, { title: "Of Human Bondage", author: "Somerset Maugham", category: "Love" }, { title: "Atonement", author: "Ian McEwan", category: "Love" }, { title: "Gone With the Wind", author: "Margaret Mitchell", category: "Love" }, { title: "Norwegian Wood", author: "Haruki Murakami", category: "Love" }, { title: "Doctor Zhivago", author: "Boris Pasternak", category: "Love" }, { title: "Wide Sargasso Sea", author: "Jean Rhys", category: "Love" }, { title: "The Hitchhikers Guide to the Galaxy", author: "Douglas Adams", category: "Science Fiction and Fantasy" }, { title: "Foundation", author: "Isaac Asimov", category: "Science Fiction and Fantasy" }, { title: "Fahrenheit 451", author: "Ray Bradbury", category: "Science Fiction and Fantasy" }, { title: "Alice’s Adventures in Wonderland", author: "Lewis Carroll", category: "Science Fiction and Fantasy" }, { title: "The Man who was Thursday", author: "GK Chesterton", category: "Science Fiction and Fantasy" }, { title: "Childhood’s End", author: "Arthur C Clarke", category: "Science Fiction and Fantasy" }, { title: "Do Androids Dream of Electric Sheep?", author: "Philip K Dick", category: "Science Fiction and Fantasy" }, { title: "American Gods", author: "Neil Gaiman", category: "Science Fiction and Fantasy" }, { title: "Neuromancer", author: "William Gibson", category: "Science Fiction and Fantasy" }, { title: "Dune", author: "Frank L Herbert", category: "Science Fiction and Fantasy" }, { title: "The Turn of the Screw", author: "Henry James", category: "Science Fiction and Fantasy" }, { title: "The Shining", author: "Stephen King", category: "Science Fiction and Fantasy" }, { title: "The Earthsea Series", author: "Ursula Le Guin", category: "Science Fiction and Fantasy" }, { title: "The Chronicles of Narnia", author: "CS Lewis", category: "Science Fiction and Fantasy" }, { title: "Nineteen Eighty-Four", author: "George Orwell", category: "Science Fiction and Fantasy" }, { title: "The Discworld Series", author: "Terry Pratchett", category: "Science Fiction and Fantasy" }, { title: "Frankenstein", author: "Mary Shelley", category: "Science Fiction and Fantasy" }, { title: "The Strange Case of Dr Jekyll and Mr Hyde", author: "Robert Louis Stevenson", category: "Science Fiction and Fantasy" }, { title: "Dracula", author: "Bram Stoker", category: "Science Fiction and Fantasy" }, { title: "The Lord of the Rings", author: "JRR Tolkien", category: "Science Fiction and Fantasy" }, { title: "Things Fall Apart", author: "Chinua Achebe", category: "State of the Nation" }, { title: "Go Tell it on the Mountain", author: "James Baldwin", category: "State of the Nation" }, { title: "Uncle Tom’s Cabin", author: "Harriet Beecher Stowe", category: "State of the Nation" }, { title: "Moll Flanders", author: "Daniel Defoe", category: "State of the Nation" }, { title: "A Tale of Two Cities", author: "Charles Dickens", category: "State of the Nation" }, { title: "North and South", author: "Elizabeth Gaskell", category: "State of the Nation" }, { title: "Les Miserables", author: "Victor Hugo", category: "State of the Nation" }, { title: "A Girl in Winter", author: "Philip Larkin", category: "State of the Nation" }, { title: "The Magic Mountain", author: "Thomas Mann", category: "State of the Nation" }, { title: "Bel-Ami", author: "Guy de Maupassant", category: "State of the Nation" }, { title: "Animal Farm", author: "George Orwell", category: "State of the Nation" }, { title: "Cry, the Beloved Country", author: "Alan Paton", category: "State of the Nation" }, { title: "The Jungle", author: "Upton Sinclair", category: "State of the Nation" }, { title: "White Teeth", author: "Zadie Smith", category: "State of the Nation" }, { title: "The Grapes of Wrath", author: "John Steinbeck", category: "State of the Nation" }, { title: "Vanity Fair", author: "William Makepeace Thackeray", category: "State of the Nation" }, { title: "The Way We Live Now", author: "Anthony Trollope", category: "State of the Nation" }, { title: "The Adventures of Tom Sawyer", author: "Mark Twain", category: "State of the Nation" }, { title: "The Bonfire of the Vanities", author: "Tom Wolfe", category: "State of the Nation" }, { title: "Germinal", author: "Emile Zola", category: "State of the Nation" }, { title: "Empire of the Sun", author: "JG Ballard", category: "War and Travel" }, { title: "Heart of Darkness", author: "Joseph Conrad", category: "War and Travel" }, { title: "Robinson Crusoe", author: "Daniel Defoe", category: "War and Travel" }, { title: "The Three Musketeers", author: "Alexandre Dumas", category: "War and Travel" }, { title: "King Solomon’s Mines", author: "H Rider Haggard", category: "War and Travel" }, { title: "Enigma", author: "Robert Harris", category: "War and Travel" }, { title: "The Good Soldier Svejk", author: "Jaroslav Hasek", category: "War and Travel" }, { title: "For Whom the Bell Tolls", author: "Ernest Hemingway", category: "War and Travel" }, { title: "On the Road", author: "Jack Kerouac", category: "War and Travel" }, { title: "The Call of the Wild", author: "Jack London", category: "War and Travel" }, { title: "One Hundred Years of Solitude", author: "Gabriel Garcia Marquez", category: "War and Travel" }, { title: "Moby-Dick or, The Whale", author: "Herman Melville", category: "War and Travel" }, { title: "Zen and the Art of Motorcycle Maintenance", author: "Robert Pirsig", category: "War and Travel" }, { title: "All Quiet on the Western Front", author: "Erich Maria Remarque", category: "War and Travel" }, { title: "Ivanhoe", author: "Sir Walter Scott", category: "War and Travel" }, { title: "Treasure Island", author: "Robert Louis Stevenson", category: "War and Travel" }, { title: "Gulliver’s Travels", author: "Jonathan Swift", category: "War and Travel" }, { title: "War and Peace", author: "Leo Tolstoy", category: "War and Travel" }, { title: "Around the World in Eighty Days", author: "Jules Verne", category: "War and Travel" }, { title: "The Caine Mutiny", author: "Herman Wouk", category: "War and Travel" } ]; /** * Generate a random book. * * @category entities * * @example * * randBook() * * @example * * randBook({ length: 10 }) * * @example * * randBook({ category: 'Comedy' }) * */ function randBook(options) { const bookData = options != null && options.category ? data$1L.filter(({ category }) => category === options.category) : data$1L; return fake(bookData, options); } var data$1K = [ "Apple", "Amazon", "Microsoft", "Google", "Samsung", "Coca-Cola", "Toyota", "Mercedes", "McDonald’s", "Disney", "BMW", "Intel", "Facebook", "IBM", "Nike", "Cisco", "Louis Vuitton", "SAP", "Instagram", "Honda", "Chanel", "J.P. Morgan", "American Express", "UPS", "Ikea", "Pepsi", "Adobe", "Hermès", "General Electric", "YouTube", "Accenture", "Gucci", "Budweiser", "Pampers", "Zara", "Hyundai", "H&M", "Nescafé", "Allianz", "Tesla", "Netflix", "Ford", "L'Oreal", "Audi", "Visa", "Ebay", "Volkswagen", "AXA", "Goldman Sachs", "Adidas", "Sony", "Citi", "Philips", "Gillette", "Porsche", "Starbucks", "Mastercard", "Salesforce", "Nissan", "PayPal", "Siemens", "Danone", "Nestlé", "HSBC", "Hewlett Packard", "Kellogg's", "3M", "Colgate", "Morgan Stanely", "Spotify", "Canon", "Lego", "Cartier", "Santander", "FedEx", "Nintendo", "Hewlett Packard Enterprise", "Corona", "Ferrari", "Huawei", "DHL", "Jack Daniel's", "Dior", "Caterpillar", "Panasonic", "Kia", "Johnson & Johnson", "Heineken", "John Deere", "LinkedIn", "Hennessy", "KFC", "Land Rover", "Tiffany & Co.", "Mini", "Uber", "Burberry", "Johnnie Walker", "Prada", "Zoom" ]; /** * Generate a random brand. * * @category company * * @example * * randBrand() * * @example * * randBrand({ length: 10 }) * */ function randBrand(options) { return fake(data$1K, options); } var data$1J = [ "Chrome", "Edge", "Firefox", "Internet Explorer", "Safari", "Opera", "Yandex", "Chromium", "Vivaldi", "Baidu", "Brave" ]; /** * Generate a random browser. * * @category internet * * @example * * randBrowser() * * @example * * randBrowser({ length: 10 }) * */ function randBrowser(options) { return fake(data$1J, options); } var data$1I = [ "East", "South", "West", "North" ]; /** * Generate a random cardinal direction. * * @category address * * @example * * randCardinalDirection() * * @example * * randCardinalDirection({ length: 10 }) * */ function randCardinalDirection(options) { return fake(data$1I, options); } var data$1H = [ "Japanese Bobtail", "Savannah", "LaPerm", "Siberian", "Ocicat", "Birman", "Devon Rex", "Minskin", "Serengeti", "Bombay", "Himalayan", "American Curl", "Thai", "Balinese", "Singapura", "American Shorthair", "Ojos Azules", "Burmese" ]; /** * Generate a random cat. * * @category animals * * @example * * randCat() * * @example * * randCat({ length: 10 }) * */ function randCat(options) { return fake(data$1H, options); } var data$1G = [ "Persevering encompassing middleware", "Multi-layered zero administration system engine", "Digitized attitude-oriented implementation", "Multi-lateral zero defect throughput", "Profit-focused coherent application", "Decentralized human-resource system engine", "Right-sized client-driven firmware", "Cloned incremental structure", "Streamlined impactful alliance", "Visionary fresh-thinking instruction set", "Networked exuding monitoring", "Organized contextually-based function", "Enterprise-wide directional orchestration", "Universal empowering product", "Reduced regional frame", "Monitored bottom-line productivity", "Reduced multi-tasking encoding", "Enhanced responsive software", "Multi-tiered exuding approach", "Balanced stable knowledge user", "Re-engineered neutral database", "Versatile national time-frame", "Exclusive fresh-thinking workforce", "Virtual background paradigm", "Upgradable cohesive knowledge user", "De-engineered needs-based hardware", "Networked mobile moratorium", "Inverse contextually-based portal", "De-engineered full-range extranet", "Advanced transitional support", "Business-focused stable framework", "Reactive 4th generation info-mediaries", "Switchable upward-trending array", "Integrated regional open architecture", "Reactive local implementation", "Focused asymmetric contingency", "Synergized 4th generation success", "Mandatory regional complexity", "Proactive client-server access", "Implemented well-modulated task-force", "Pre-emptive clear-thinking groupware", "Balanced radical archive", "Managed explicit installation", "Switchable next generation intranet", "Quality-focused coherent groupware", "Customizable client-driven encoding", "Centralized impactful contingency", "Streamlined executive Graphic Interface", "Seamless bi-directional capacity", "Synchronised 24 hour emulation", "Robust heuristic installation", "Face to face 6th generation complexity", "Vision-oriented holistic protocol", "Ameliorated asynchronous pricing structure", "Profit-focused executive core", "Multi-channell