UNPKG

prisma

Version:

Prisma is an open-source database toolkit. It includes a JavaScript/TypeScript ORM for Node.js, migrations and a modern GUI to view and edit the data in your database. You can use Prisma in new projects or add it to an existing one.

3,469 lines (3,217 loc) • 640 kB
'use strict'; var require$$0 = require('fs'); var path$2 = require('path'); var require$$2 = require('util'); var fs$1 = require('fs/promises'); var require$$1$1 = require('os'); var crypto = require('crypto'); var Stream = require('stream'); var http = require('http'); var Url = require('url'); var require$$0$1 = require('punycode'); var https = require('https'); var zlib = require('zlib'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0); var path__default = /*#__PURE__*/_interopDefaultLegacy(path$2); var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2); var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$1); var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1$1); var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto); var Stream__default = /*#__PURE__*/_interopDefaultLegacy(Stream); var http__default = /*#__PURE__*/_interopDefaultLegacy(http); var Url__default = /*#__PURE__*/_interopDefaultLegacy(Url); var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1); var https__default = /*#__PURE__*/_interopDefaultLegacy(https); var zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib); var makeDir$2 = {exports: {}}; const debug$1 = ( typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ) ? (...args) => console.error('SEMVER', ...args) : () => {}; var debug_1 = debug$1; // Note: this is the semver.org version of the spec that it implements // Not necessarily the package version of this code. const SEMVER_SPEC_VERSION = '2.0.0'; const MAX_LENGTH$1 = 256; const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */ 9007199254740991; // Max safe segment length for coercion. const MAX_SAFE_COMPONENT_LENGTH = 16; // Max safe length for a build identifier. The max length minus 6 characters for // the shortest version with a build 0.0.0+BUILD. const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6; const RELEASE_TYPES = [ 'major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease', ]; var constants = { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1, RELEASE_TYPES, SEMVER_SPEC_VERSION, FLAG_INCLUDE_PRERELEASE: 0b001, FLAG_LOOSE: 0b010, }; var re$1 = {exports: {}}; (function (module, exports) { const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH } = constants; const debug = debug_1; exports = module.exports = {}; // The actual regexps go on exports.re const re = exports.re = []; const safeRe = exports.safeRe = []; const src = exports.src = []; const t = exports.t = {}; let R = 0; const LETTERDASHNUMBER = '[a-zA-Z0-9-]'; // Replace some greedy regex tokens to prevent regex dos issues. These regex are // used internally via the safeRe object since all inputs in this library get // normalized first to trim and collapse all extra whitespace. The original // regexes are exported for userland consumption and lower level usage. A // future breaking change could export the safer regex only with a note that // all input should have extra whitespace removed. const safeRegexReplacements = [ ['\\s', 1], ['\\d', MAX_SAFE_COMPONENT_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], ]; const makeSafeRegex = (value) => { for (const [token, max] of safeRegexReplacements) { value = value .split(`${token}*`).join(`${token}{0,${max}}`) .split(`${token}+`).join(`${token}{1,${max}}`); } return value }; const createToken = (name, value, isGlobal) => { const safe = makeSafeRegex(value); const index = R++; debug(name, index, value); t[name] = index; src[index] = value; re[index] = new RegExp(value, isGlobal ? 'g' : undefined); safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined); }; // The following Regular Expressions can be used for tokenizing, // validating, and parsing SemVer version strings. // ## Numeric Identifier // A single `0`, or a non-zero digit followed by zero or more digits. createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*'); createToken('NUMERICIDENTIFIERLOOSE', '\\d+'); // ## Non-numeric Identifier // Zero or more digits, followed by a letter or hyphen, and then zero or // more letters, digits, or hyphens. createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`); // ## Main Version // Three dot-separated numeric identifiers. createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`); createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`); // ## Pre-release Version Identifier // A numeric identifier, or a non-numeric identifier. createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] }|${src[t.NONNUMERICIDENTIFIER]})`); createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] }|${src[t.NONNUMERICIDENTIFIER]})`); // ## Pre-release Version // Hyphen, followed by one or more dot-separated pre-release version // identifiers. createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); // ## Build Metadata Identifier // Any combination of digits, letters, or hyphens. createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`); // ## Build Metadata // Plus sign, followed by one or more period-separated build metadata // identifiers. createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] }(?:\\.${src[t.BUILDIDENTIFIER]})*))`); // ## Full Version String // A main version, followed optionally by a pre-release version and // build metadata. // Note that the only major, minor, patch, and pre-release sections of // the version string are capturing groups. The build metadata is not a // capturing group, because it should not ever be used in version // comparison. createToken('FULLPLAIN', `v?${src[t.MAINVERSION] }${src[t.PRERELEASE]}?${ src[t.BUILD]}?`); createToken('FULL', `^${src[t.FULLPLAIN]}$`); // like full, but allows v1.2.3 and =1.2.3, which people do sometimes. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty // common in the npm registry. createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] }${src[t.PRERELEASELOOSE]}?${ src[t.BUILD]}?`); createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`); createToken('GTLT', '((?:<|>)?=?)'); // Something like "2.*" or "1.2.x". // Note that "x.x" is a valid xRange identifer, meaning "any version" // Only the first item is strictly required. createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${ src[t.BUILD]}?` + `)?)?`); createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${ src[t.BUILD]}?` + `)?)?`); createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); // Coercion. // Extract anything that could conceivably be a part of a valid semver createToken('COERCE', `${'(^|[^\\d])' + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:$|[^\\d])`); createToken('COERCERTL', src[t.COERCE], true); // Tilde ranges. // Meaning is "reasonably at or greater than" createToken('LONETILDE', '(?:~>?)'); createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true); exports.tildeTrimReplace = '$1~'; createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); // Caret ranges. // Meaning is "at least and backwards compatible with" createToken('LONECARET', '(?:\\^)'); createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true); exports.caretTrimReplace = '$1^'; createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); // A simple gt/lt/eq thing, or just "" to indicate "any version" createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); // An expression to strip any whitespace between the gtlt and the thing // it modifies, so that `> 1.2.3` ==> `>1.2.3` createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); exports.comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4` // Note that these all use the loose form, because they'll be // checked against either the strict or loose comparator form // later. createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`); createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`); // Star ranges basically just allow anything at all. createToken('STAR', '(<|>)?=?\\s*\\*'); // >=0.0.0 is like a star createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$'); createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$'); }(re$1, re$1.exports)); // parse out just the options we care about const looseOption = Object.freeze({ loose: true }); const emptyOpts = Object.freeze({ }); const parseOptions$1 = options => { if (!options) { return emptyOpts } if (typeof options !== 'object') { return looseOption } return options }; var parseOptions_1 = parseOptions$1; const numeric = /^[0-9]+$/; const compareIdentifiers$1 = (a, b) => { const anum = numeric.test(a); const bnum = numeric.test(b); if (anum && bnum) { a = +a; b = +b; } return a === b ? 0 : (anum && !bnum) ? -1 : (bnum && !anum) ? 1 : a < b ? -1 : 1 }; const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a); var identifiers = { compareIdentifiers: compareIdentifiers$1, rcompareIdentifiers, }; const debug = debug_1; const { MAX_LENGTH, MAX_SAFE_INTEGER } = constants; const { safeRe: re, t } = re$1.exports; const parseOptions = parseOptions_1; const { compareIdentifiers } = identifiers; class SemVer$1 { constructor (version, options) { options = parseOptions(options); if (version instanceof SemVer$1) { if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { return version } else { version = version.version; } } else if (typeof version !== 'string') { throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) } if (version.length > MAX_LENGTH) { throw new TypeError( `version is longer than ${MAX_LENGTH} characters` ) } debug('SemVer', version, options); this.options = options; this.loose = !!options.loose; // this isn't actually relevant for versions, but keep it so that we // don't run into trouble passing this.options around. this.includePrerelease = !!options.includePrerelease; const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); if (!m) { throw new TypeError(`Invalid Version: ${version}`) } this.raw = version; // these are actually numbers this.major = +m[1]; this.minor = +m[2]; this.patch = +m[3]; if (this.major > MAX_SAFE_INTEGER || this.major < 0) { throw new TypeError('Invalid major version') } if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { throw new TypeError('Invalid minor version') } if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { throw new TypeError('Invalid patch version') } // numberify any prerelease numeric ids if (!m[4]) { this.prerelease = []; } else { this.prerelease = m[4].split('.').map((id) => { if (/^[0-9]+$/.test(id)) { const num = +id; if (num >= 0 && num < MAX_SAFE_INTEGER) { return num } } return id }); } this.build = m[5] ? m[5].split('.') : []; this.format(); } format () { this.version = `${this.major}.${this.minor}.${this.patch}`; if (this.prerelease.length) { this.version += `-${this.prerelease.join('.')}`; } return this.version } toString () { return this.version } compare (other) { debug('SemVer.compare', this.version, this.options, other); if (!(other instanceof SemVer$1)) { if (typeof other === 'string' && other === this.version) { return 0 } other = new SemVer$1(other, this.options); } if (other.version === this.version) { return 0 } return this.compareMain(other) || this.comparePre(other) } compareMain (other) { if (!(other instanceof SemVer$1)) { other = new SemVer$1(other, this.options); } return ( compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch) ) } comparePre (other) { if (!(other instanceof SemVer$1)) { other = new SemVer$1(other, this.options); } // NOT having a prerelease is > having one if (this.prerelease.length && !other.prerelease.length) { return -1 } else if (!this.prerelease.length && other.prerelease.length) { return 1 } else if (!this.prerelease.length && !other.prerelease.length) { return 0 } let i = 0; do { const a = this.prerelease[i]; const b = other.prerelease[i]; debug('prerelease compare', i, a, b); if (a === undefined && b === undefined) { return 0 } else if (b === undefined) { return 1 } else if (a === undefined) { return -1 } else if (a === b) { continue } else { return compareIdentifiers(a, b) } } while (++i) } compareBuild (other) { if (!(other instanceof SemVer$1)) { other = new SemVer$1(other, this.options); } let i = 0; do { const a = this.build[i]; const b = other.build[i]; debug('prerelease compare', i, a, b); if (a === undefined && b === undefined) { return 0 } else if (b === undefined) { return 1 } else if (a === undefined) { return -1 } else if (a === b) { continue } else { return compareIdentifiers(a, b) } } while (++i) } // preminor will bump the version up to the next minor release, and immediately // down to pre-release. premajor and prepatch work the same way. inc (release, identifier, identifierBase) { switch (release) { case 'premajor': this.prerelease.length = 0; this.patch = 0; this.minor = 0; this.major++; this.inc('pre', identifier, identifierBase); break case 'preminor': this.prerelease.length = 0; this.patch = 0; this.minor++; this.inc('pre', identifier, identifierBase); break case 'prepatch': // If this is already a prerelease, it will bump to the next version // drop any prereleases that might already exist, since they are not // relevant at this point. this.prerelease.length = 0; this.inc('patch', identifier, identifierBase); this.inc('pre', identifier, identifierBase); break // If the input is a non-prerelease version, this acts the same as // prepatch. case 'prerelease': if (this.prerelease.length === 0) { this.inc('patch', identifier, identifierBase); } this.inc('pre', identifier, identifierBase); break case 'major': // If this is a pre-major version, bump up to the same major version. // Otherwise increment major. // 1.0.0-5 bumps to 1.0.0 // 1.1.0 bumps to 2.0.0 if ( this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0 ) { this.major++; } this.minor = 0; this.patch = 0; this.prerelease = []; break case 'minor': // If this is a pre-minor version, bump up to the same minor version. // Otherwise increment minor. // 1.2.0-5 bumps to 1.2.0 // 1.2.1 bumps to 1.3.0 if (this.patch !== 0 || this.prerelease.length === 0) { this.minor++; } this.patch = 0; this.prerelease = []; break case 'patch': // If this is not a pre-release version, it will increment the patch. // If it is a pre-release it will bump up to the same patch version. // 1.2.0-5 patches to 1.2.0 // 1.2.0 patches to 1.2.1 if (this.prerelease.length === 0) { this.patch++; } this.prerelease = []; break // This probably shouldn't be used publicly. // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. case 'pre': { const base = Number(identifierBase) ? 1 : 0; if (!identifier && identifierBase === false) { throw new Error('invalid increment argument: identifier is empty') } if (this.prerelease.length === 0) { this.prerelease = [base]; } else { let i = this.prerelease.length; while (--i >= 0) { if (typeof this.prerelease[i] === 'number') { this.prerelease[i]++; i = -2; } } if (i === -1) { // didn't increment anything if (identifier === this.prerelease.join('.') && identifierBase === false) { throw new Error('invalid increment argument: identifier already exists') } this.prerelease.push(base); } } if (identifier) { // 1.2.0-beta.1 bumps to 1.2.0-beta.2, // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 let prerelease = [identifier, base]; if (identifierBase === false) { prerelease = [identifier]; } if (compareIdentifiers(this.prerelease[0], identifier) === 0) { if (isNaN(this.prerelease[1])) { this.prerelease = prerelease; } } else { this.prerelease = prerelease; } } break } default: throw new Error(`invalid increment argument: ${release}`) } this.raw = this.format(); if (this.build.length) { this.raw += `+${this.build.join('.')}`; } return this } } var semver = SemVer$1; const SemVer = semver; const compare$1 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)); var compare_1 = compare$1; const compare = compare_1; const gte = (a, b, loose) => compare(a, b, loose) >= 0; var gte_1 = gte; const fs = require$$0__default["default"]; const path$1 = path__default["default"]; const {promisify} = require$$2__default["default"]; const semverGte = gte_1; const useNativeRecursiveOption = semverGte(process.version, '10.12.0'); // https://github.com/nodejs/node/issues/8987 // https://github.com/libuv/libuv/pull/1088 const checkPath = pth => { if (process.platform === 'win32') { const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path$1.parse(pth).root, '')); if (pathHasInvalidWinCharacters) { const error = new Error(`Path contains invalid characters: ${pth}`); error.code = 'EINVAL'; throw error; } } }; const processOptions = options => { const defaults = { mode: 0o777, fs }; return { ...defaults, ...options }; }; const permissionError = pth => { // This replicates the exception of `fs.mkdir` with native the // `recusive` option when run on an invalid drive under Windows. const error = new Error(`operation not permitted, mkdir '${pth}'`); error.code = 'EPERM'; error.errno = -4048; error.path = pth; error.syscall = 'mkdir'; return error; }; const makeDir = async (input, options) => { checkPath(input); options = processOptions(options); const mkdir = promisify(options.fs.mkdir); const stat = promisify(options.fs.stat); if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) { const pth = path$1.resolve(input); await mkdir(pth, { mode: options.mode, recursive: true }); return pth; } const make = async pth => { try { await mkdir(pth, options.mode); return pth; } catch (error) { if (error.code === 'EPERM') { throw error; } if (error.code === 'ENOENT') { if (path$1.dirname(pth) === pth) { throw permissionError(pth); } if (error.message.includes('null bytes')) { throw error; } await make(path$1.dirname(pth)); return make(pth); } try { const stats = await stat(pth); if (!stats.isDirectory()) { throw new Error('The path is not a directory'); } } catch { throw error; } return pth; } }; return make(path$1.resolve(input)); }; makeDir$2.exports = makeDir; makeDir$2.exports.sync = (input, options) => { checkPath(input); options = processOptions(options); if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) { const pth = path$1.resolve(input); fs.mkdirSync(pth, { mode: options.mode, recursive: true }); return pth; } const make = pth => { try { options.fs.mkdirSync(pth, options.mode); } catch (error) { if (error.code === 'EPERM') { throw error; } if (error.code === 'ENOENT') { if (path$1.dirname(pth) === pth) { throw permissionError(pth); } if (error.message.includes('null bytes')) { throw error; } make(path$1.dirname(pth)); return make(pth); } try { if (!options.fs.statSync(pth).isDirectory()) { throw new Error('The path is not a directory'); } } catch { throw error; } } return pth; }; return make(path$1.resolve(input)); }; var makeDir$1 = makeDir$2.exports; // U is the subset of T, not sure why // this works or why _T is necessary // valid default schema const defaultSchema = { last_reminder: 0, cached_at: 0, version: '', cli_path: '', // User output output: { client_event_id: '', previous_client_event_id: '', product: '', cli_path_hash: '', local_timestamp: '', previous_version: '', current_version: '', current_release_date: 0, current_download_url: '', current_changelog_url: '', package: '', release_tag: '', install_command: '', project_website: '', outdated: false, alerts: [], }, }; // initialize the configuration class Config { static async new(state, schema = defaultSchema) { await makeDir$1(path__default["default"].dirname(state.cache_file)); return new Config(state, schema) } constructor( state, defaultSchema) {this.state = state;this.defaultSchema = defaultSchema;} // check and return the cache if (matches version or hasn't expired) async checkCache(newState) { const now = newState.now(); // fetch the data from the cache const cache = await this.all(); if (!cache) { return { cache: undefined, stale: true } } // version has been upgraded or changed // TODO: define this behaviour more clearly. if (newState.version !== cache.version) { return { cache, stale: true } } // cache expired if (now - cache.cached_at > newState.cache_duration) { return { cache, stale: true } } return { cache, stale: false } } // set the configuration async set(update) { const existing = (await this.all()) || {}; const schema = Object.assign(existing, update); // TODO: figure out how to type this for (let k in this.defaultSchema) { // @ts-ignore if (typeof schema[k] === 'undefined') { // @ts-ignore schema[k] = this.defaultSchema[k]; } } await fs__default["default"].writeFile(this.state.cache_file, JSON.stringify(schema, null, ' ')); } // get the entire schema async all() { try { const data = await fs__default["default"].readFile(this.state.cache_file, 'utf8'); return JSON.parse(data) } catch (err) { return } } // get a value from the schema async get(key) { const schema = await this.all(); if (typeof schema === 'undefined') { return } return schema[key] } // reset the configuration async reset() { await fs__default["default"].writeFile(this.state.cache_file, JSON.stringify(this.defaultSchema, null, ' ')); return } // delete the configuration, ignoring any errors async delete() { try { await fs__default["default"].unlink(this.state.cache_file); return } catch (err) { return } } } const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate let poolPtr = rnds8Pool.length; function rng() { if (poolPtr > rnds8Pool.length - 16) { crypto__default["default"].randomFillSync(rnds8Pool); poolPtr = 0; } return rnds8Pool.slice(poolPtr, poolPtr += 16); } /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 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 return 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]]; } var native = { randomUUID: crypto__default["default"].randomUUID }; function v4(options, buf, offset) { if (native.randomUUID && !buf && !options) { return native.randomUUID(); } options = options || {}; const 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 (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } var envPaths$1 = {exports: {}}; const path = path__default["default"]; const os = require$$1__default["default"]; const homedir = os.homedir(); const tmpdir = os.tmpdir(); const {env} = process; const macos = name => { const library = path.join(homedir, 'Library'); return { data: path.join(library, 'Application Support', name), config: path.join(library, 'Preferences', name), cache: path.join(library, 'Caches', name), log: path.join(library, 'Logs', name), temp: path.join(tmpdir, name) }; }; const windows = name => { const appData = env.APPDATA || path.join(homedir, 'AppData', 'Roaming'); const localAppData = env.LOCALAPPDATA || path.join(homedir, 'AppData', 'Local'); return { // Data/config/cache/log are invented by me as Windows isn't opinionated about this data: path.join(localAppData, name, 'Data'), config: path.join(appData, name, 'Config'), cache: path.join(localAppData, name, 'Cache'), log: path.join(localAppData, name, 'Log'), temp: path.join(tmpdir, name) }; }; // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html const linux = name => { const username = path.basename(homedir); return { data: path.join(env.XDG_DATA_HOME || path.join(homedir, '.local', 'share'), name), config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, '.config'), name), cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, '.cache'), name), // https://wiki.debian.org/XDGBaseDirectorySpecification#state log: path.join(env.XDG_STATE_HOME || path.join(homedir, '.local', 'state'), name), temp: path.join(tmpdir, username, name) }; }; const envPaths = (name, options) => { if (typeof name !== 'string') { throw new TypeError(`Expected string, got ${typeof name}`); } options = Object.assign({suffix: 'nodejs'}, options); if (options.suffix) { // Add suffix to prevent possible conflict with native apps name += `-${options.suffix}`; } if (process.platform === 'darwin') { return macos(name); } if (process.platform === 'win32') { return windows(name); } return linux(name); }; envPaths$1.exports = envPaths; // TODO: Remove this for the next major release envPaths$1.exports.default = envPaths; var paths = envPaths$1.exports; // Signature is a random signature that is stored and used // File identifier for global signature file const PRISMA_SIGNATURE = 'signature'; // IMPORTANT: this is part of the public API async function getSignature(signatureFile) { const dirs = paths('checkpoint'); signatureFile = signatureFile || path__default["default"].join(dirs.cache, PRISMA_SIGNATURE); // new file for signature // The signatureFile replaces cacheFile as the source of turth and therefore takes precedence const signature = await readSignature(signatureFile); if (signature) { return signature } return await createSignatureFile(signatureFile) } function isSignatureValid(signature) { return typeof signature === 'string' && signature.length === 36 } /** * Parse a file containing json and return the `signature` key from it * @returns string empty if invalid or not found */ async function readSignature(file) { try { const data = await fs__default["default"].readFile(file, 'utf8'); const { signature } = JSON.parse(data); if (isSignatureValid(signature)) { return signature } return '' } catch (err) { return '' } } async function createSignatureFile(signatureFile, signature) { // Use passed signature or generate new const signatureState = { signature: signature || v4(), }; await makeDir$1(path__default["default"].dirname(signatureFile)); await fs__default["default"].writeFile(signatureFile, JSON.stringify(signatureState, null, ' ')); return signatureState.signature } var publicApi = {}; var URL$2 = {exports: {}}; var conversions = {}; var lib = conversions; function sign(x) { return x < 0 ? -1 : 1; } function evenRound(x) { // Round x to the nearest integer, choosing the even integer if it lies halfway between two. if ((x % 1) === 0.5 && (x & 1) === 0) { // [even number].5; round down (i.e. floor) return Math.floor(x); } else { return Math.round(x); } } function createNumberConversion(bitLength, typeOpts) { if (!typeOpts.unsigned) { --bitLength; } const lowerBound = typeOpts.unsigned ? 0 : -Math.pow(2, bitLength); const upperBound = Math.pow(2, bitLength) - 1; const moduloVal = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength) : Math.pow(2, bitLength); const moduloBound = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength - 1) : Math.pow(2, bitLength - 1); return function(V, opts) { if (!opts) opts = {}; let x = +V; if (opts.enforceRange) { if (!Number.isFinite(x)) { throw new TypeError("Argument is not a finite number"); } x = sign(x) * Math.floor(Math.abs(x)); if (x < lowerBound || x > upperBound) { throw new TypeError("Argument is not in byte range"); } return x; } if (!isNaN(x) && opts.clamp) { x = evenRound(x); if (x < lowerBound) x = lowerBound; if (x > upperBound) x = upperBound; return x; } if (!Number.isFinite(x) || x === 0) { return 0; } x = sign(x) * Math.floor(Math.abs(x)); x = x % moduloVal; if (!typeOpts.unsigned && x >= moduloBound) { return x - moduloVal; } else if (typeOpts.unsigned) { if (x < 0) { x += moduloVal; } else if (x === -0) { // don't return negative zero return 0; } } return x; } } conversions["void"] = function () { return undefined; }; conversions["boolean"] = function (val) { return !!val; }; conversions["byte"] = createNumberConversion(8, { unsigned: false }); conversions["octet"] = createNumberConversion(8, { unsigned: true }); conversions["short"] = createNumberConversion(16, { unsigned: false }); conversions["unsigned short"] = createNumberConversion(16, { unsigned: true }); conversions["long"] = createNumberConversion(32, { unsigned: false }); conversions["unsigned long"] = createNumberConversion(32, { unsigned: true }); conversions["long long"] = createNumberConversion(32, { unsigned: false, moduloBitLength: 64 }); conversions["unsigned long long"] = createNumberConversion(32, { unsigned: true, moduloBitLength: 64 }); conversions["double"] = function (V) { const x = +V; if (!Number.isFinite(x)) { throw new TypeError("Argument is not a finite floating-point value"); } return x; }; conversions["unrestricted double"] = function (V) { const x = +V; if (isNaN(x)) { throw new TypeError("Argument is NaN"); } return x; }; // not quite valid, but good enough for JS conversions["float"] = conversions["double"]; conversions["unrestricted float"] = conversions["unrestricted double"]; conversions["DOMString"] = function (V, opts) { if (!opts) opts = {}; if (opts.treatNullAsEmptyString && V === null) { return ""; } return String(V); }; conversions["ByteString"] = function (V, opts) { const x = String(V); let c = undefined; for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) { if (c > 255) { throw new TypeError("Argument is not a valid bytestring"); } } return x; }; conversions["USVString"] = function (V) { const S = String(V); const n = S.length; const U = []; for (let i = 0; i < n; ++i) { const c = S.charCodeAt(i); if (c < 0xD800 || c > 0xDFFF) { U.push(String.fromCodePoint(c)); } else if (0xDC00 <= c && c <= 0xDFFF) { U.push(String.fromCodePoint(0xFFFD)); } else { if (i === n - 1) { U.push(String.fromCodePoint(0xFFFD)); } else { const d = S.charCodeAt(i + 1); if (0xDC00 <= d && d <= 0xDFFF) { const a = c & 0x3FF; const b = d & 0x3FF; U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b)); ++i; } else { U.push(String.fromCodePoint(0xFFFD)); } } } } return U.join(''); }; conversions["Date"] = function (V, opts) { if (!(V instanceof Date)) { throw new TypeError("Argument is not a Date object"); } if (isNaN(V)) { return undefined; } return V; }; conversions["RegExp"] = function (V, opts) { if (!(V instanceof RegExp)) { V = new RegExp(V); } return V; }; var utils = {exports: {}}; (function (module) { module.exports.mixin = function mixin(target, source) { const keys = Object.getOwnPropertyNames(source); for (let i = 0; i < keys.length; ++i) { Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); } }; module.exports.wrapperSymbol = Symbol("wrapper"); module.exports.implSymbol = Symbol("impl"); module.exports.wrapperForImpl = function (impl) { return impl[module.exports.wrapperSymbol]; }; module.exports.implForWrapper = function (wrapper) { return wrapper[module.exports.implSymbol]; }; }(utils)); var URLImpl = {}; var urlStateMachine = {exports: {}}; var tr46 = {}; var require$$1 = [ [ [ 0, 44 ], "disallowed_STD3_valid" ], [ [ 45, 46 ], "valid" ], [ [ 47, 47 ], "disallowed_STD3_valid" ], [ [ 48, 57 ], "valid" ], [ [ 58, 64 ], "disallowed_STD3_valid" ], [ [ 65, 65 ], "mapped", [ 97 ] ], [ [ 66, 66 ], "mapped", [ 98 ] ], [ [ 67, 67 ], "mapped", [ 99 ] ], [ [ 68, 68 ], "mapped", [ 100 ] ], [ [ 69, 69 ], "mapped", [ 101 ] ], [ [ 70, 70 ], "mapped", [ 102 ] ], [ [ 71, 71 ], "mapped", [ 103 ] ], [ [ 72, 72 ], "mapped", [ 104 ] ], [ [ 73, 73 ], "mapped", [ 105 ] ], [ [ 74, 74 ], "mapped", [ 106 ] ], [ [ 75, 75 ], "mapped", [ 107 ] ], [ [ 76, 76 ], "mapped", [ 108 ] ], [ [ 77, 77 ], "mapped", [ 109 ] ], [ [ 78, 78 ], "mapped", [ 110 ] ], [ [ 79, 79 ], "mapped", [ 111 ] ], [ [ 80, 80 ], "mapped", [ 112 ] ], [ [ 81, 81 ], "mapped", [ 113 ] ], [ [ 82, 82 ], "mapped", [ 114 ] ], [ [ 83, 83 ], "mapped", [ 115 ] ], [ [ 84, 84 ], "mapped", [ 116 ] ], [ [ 85, 85 ], "mapped", [ 117 ] ], [ [ 86, 86 ], "mapped", [ 118 ] ], [ [ 87, 87 ], "mapped", [ 119 ] ], [ [ 88, 88 ], "mapped", [ 120 ] ], [ [ 89, 89 ], "mapped", [ 121 ] ], [ [ 90, 90 ], "mapped", [ 122 ] ], [ [ 91, 96 ], "disallowed_STD3_valid" ], [ [ 97, 122 ], "valid" ], [ [ 123, 127 ], "disallowed_STD3_valid" ], [ [ 128, 159 ], "disallowed" ], [ [ 160, 160 ], "disallowed_STD3_mapped", [ 32 ] ], [ [ 161, 167 ], "valid", [ ], "NV8" ], [ [ 168, 168 ], "disallowed_STD3_mapped", [ 32, 776 ] ], [ [ 169, 169 ], "valid", [ ], "NV8" ], [ [ 170, 170 ], "mapped", [ 97 ] ], [ [ 171, 172 ], "valid", [ ], "NV8" ], [ [ 173, 173 ], "ignored" ], [ [ 174, 174 ], "valid", [ ], "NV8" ], [ [ 175, 175 ], "disallowed_STD3_mapped", [ 32, 772 ] ], [ [ 176, 177 ], "valid", [ ], "NV8" ], [ [ 178, 178 ], "mapped", [ 50 ] ], [ [ 179, 179 ], "mapped", [ 51 ] ], [ [ 180, 180 ], "disallowed_STD3_mapped", [ 32, 769 ] ], [ [ 181, 181 ], "mapped", [ 956 ] ], [ [ 182, 182 ], "valid", [ ], "NV8" ], [ [ 183, 183 ], "valid" ], [ [ 184, 184 ], "disallowed_STD3_mapped", [ 32, 807 ] ], [ [ 185, 185 ], "mapped", [ 49 ] ], [ [ 186, 186 ], "mapped", [ 111 ] ], [ [ 187, 187 ], "valid", [ ], "NV8" ], [ [ 188, 188 ], "mapped", [ 49, 8260, 52 ] ], [ [ 189, 189 ], "mapped", [ 49, 8260, 50 ] ], [ [ 190, 190 ], "mapped", [ 51, 8260, 52 ] ], [ [ 191, 191 ], "valid", [ ], "NV8" ], [ [ 192, 192 ], "mapped", [ 224 ] ], [ [ 193, 193 ], "mapped", [ 225 ] ], [ [ 194, 194 ], "mapped", [ 226 ] ], [ [ 195, 195 ], "mapped", [ 227 ] ], [ [ 196, 196 ], "mapped", [ 228 ] ], [ [ 197, 197 ], "mapped", [ 229 ] ], [ [ 198, 198 ], "mapped", [ 230 ] ], [ [ 199, 199 ], "mapped", [ 231 ] ], [ [ 200, 200 ], "mapped", [ 232 ] ], [ [ 201, 201 ], "mapped", [ 233 ] ], [ [ 202, 202 ], "mapped", [ 234 ] ], [ [ 203, 203 ], "mapped", [ 235 ] ], [ [ 204, 204 ], "mapped", [ 236 ] ], [ [ 205, 205 ], "mapped", [ 237 ] ], [ [ 206, 206 ], "mapped", [ 238 ] ], [ [ 207, 207 ], "mapped", [ 239 ] ], [ [ 208, 208 ], "mapped", [ 240 ] ], [ [ 209, 209 ], "mapped", [ 241 ] ], [ [ 210, 210 ], "mapped", [ 242 ] ], [ [ 211, 211 ], "mapped", [ 243 ] ], [ [ 212, 212 ], "mapped", [ 244 ] ], [ [ 213, 213 ], "mapped", [ 245 ] ], [ [ 214, 214 ], "mapped", [ 246 ] ], [ [ 215, 215 ], "valid", [ ], "NV8" ], [ [ 216, 216 ], "mapped", [ 248 ] ], [ [ 217, 217 ], "mapped", [ 249 ] ], [ [ 218, 218 ], "mapped", [ 250 ] ], [ [ 219, 219 ], "mapped", [ 251 ] ], [ [ 220, 220 ], "mapped", [ 252 ] ], [ [ 221, 221 ], "mapped", [ 253 ] ], [ [ 222, 222 ], "mapped", [ 254 ] ], [ [ 223, 223 ], "deviation", [ 115, 115 ] ], [ [ 224, 246 ], "valid" ], [ [ 247, 247 ], "valid", [ ], "NV8" ], [ [ 248, 255 ], "valid" ], [ [ 256, 256 ], "mapped", [ 257 ] ], [ [ 257, 257 ], "valid" ], [ [ 258, 258 ], "mapped", [ 259 ] ], [ [ 259, 259 ], "valid" ], [ [ 260, 260 ], "mapped", [ 261 ] ], [ [ 261, 261 ], "valid" ], [ [ 262, 262 ], "mapped", [ 263 ] ], [ [ 263, 263 ], "valid" ], [ [ 264, 264 ], "mapped", [ 265 ] ], [ [ 265, 265 ], "valid" ], [ [ 266, 266 ], "mapped", [ 267 ] ], [ [ 267, 267 ], "valid" ], [ [ 268, 268 ], "mapped", [ 269 ] ], [ [ 269, 269 ], "valid" ], [ [ 270, 270 ], "mapped", [ 271 ] ], [ [ 271, 271 ], "valid" ], [ [ 272, 272 ], "mapped", [ 273 ] ], [ [ 273, 273 ], "valid" ], [ [ 274, 274 ], "mapped", [ 275 ] ], [ [ 275, 275 ], "valid" ], [ [ 276, 276 ], "mapped", [ 277 ] ], [ [ 277, 277 ], "valid" ], [ [ 278, 278 ], "mapped", [ 279 ] ], [ [ 279, 279 ], "valid" ], [ [ 280, 280 ], "mapped", [ 281 ] ], [ [ 281, 281 ], "valid" ], [ [ 282, 282 ], "mapped", [ 283 ] ], [ [ 283, 283 ], "valid" ], [ [ 284, 284 ], "mapped", [ 285 ] ], [ [ 285, 285 ], "valid" ], [ [ 286, 286 ], "mapped", [ 287 ] ], [ [ 287, 287 ], "valid" ], [ [ 288, 288 ], "mapped", [ 289 ] ], [ [ 289, 289 ], "valid" ], [ [ 290, 290 ], "mapped", [ 291 ] ], [ [ 291, 291 ], "valid" ], [ [ 292, 292 ], "mapped", [ 293 ] ], [ [ 293, 293 ], "valid" ], [ [ 294, 294 ], "mapped", [ 295 ] ], [ [ 295, 295 ], "valid" ], [ [ 296, 296 ], "mapped", [ 297 ] ], [ [ 297, 297 ], "valid" ], [ [ 298, 298 ], "mapped", [ 299 ] ], [ [ 299, 299 ], "valid" ], [ [ 300, 300 ], "mapped", [ 301 ] ], [ [ 301, 301 ], "valid" ], [ [ 302, 302 ], "mapped", [ 303 ] ], [ [ 303, 303 ], "valid" ], [ [ 304, 304 ], "mapped", [ 105, 775 ] ], [ [ 305, 305 ], "valid" ], [ [ 306, 307 ], "mapped", [ 105, 106 ] ], [ [ 308, 308 ], "mapped", [ 309 ] ], [ [ 309, 309 ], "valid" ], [ [ 310, 310 ], "mapped", [ 311 ] ], [ [ 311, 312 ], "valid" ], [ [ 313, 313 ], "mapped", [ 314 ] ], [ [ 314, 314 ], "valid" ], [ [ 315, 315 ], "mapped", [ 316 ] ], [ [ 316, 316 ], "valid" ], [ [ 317, 317 ], "mapped", [ 318 ] ], [ [ 318, 318 ], "valid" ], [ [ 319, 320 ], "mapped", [ 108, 183 ] ], [ [ 321, 321 ], "mapped", [ 322 ] ], [ [ 322, 322 ], "valid" ], [ [ 323, 323 ], "mapped", [ 324 ] ], [ [ 324, 324 ], "valid" ], [ [ 325, 325 ], "mapped", [ 326 ] ], [ [ 326, 326 ], "valid" ], [ [ 327, 327 ], "mapped", [ 328 ] ], [ [ 328, 328 ], "valid" ], [ [ 329, 329 ], "mapped", [ 700, 110 ] ], [ [ 330, 330 ], "mapped", [ 331 ] ], [ [ 331, 331 ], "valid" ], [ [ 332, 332 ], "mapped", [ 333 ] ], [ [ 333, 333 ], "valid" ], [ [ 334, 334 ], "mapped", [ 335 ] ], [ [ 335, 335 ], "valid" ], [ [ 336, 336 ], "mapped", [ 337 ] ], [ [ 337, 337 ], "valid" ], [ [ 338, 338 ], "mapped", [ 339 ] ], [ [ 339, 339 ], "valid" ], [ [ 340, 340 ], "mapped", [ 341 ] ], [ [ 341, 341 ], "valid" ], [ [ 342, 342 ], "mapped", [ 343 ] ], [ [ 343, 343 ], "valid" ], [ [ 344, 344 ], "mapped", [ 345 ] ], [ [ 345, 345 ], "valid" ], [ [ 346, 346 ], "mapped", [ 347 ] ], [ [ 347, 347 ], "valid" ], [ [ 348, 348 ], "mapped", [ 349 ] ], [ [ 349, 349 ], "valid" ], [ [ 350, 350 ], "mapped", [ 351 ] ], [ [ 351, 351 ], "valid" ], [ [ 352, 352 ], "mapped", [ 353 ] ], [ [ 353, 353 ], "valid" ], [ [ 354, 354 ], "mapped", [ 355 ] ], [ [ 355, 355 ], "valid" ], [ [ 356, 356 ], "mapped", [ 357 ] ], [ [ 357, 357 ], "valid" ], [ [ 358, 358 ], "mapped", [ 359 ] ], [ [ 359, 359 ], "valid" ], [ [ 360, 360 ], "mapped", [ 361 ] ], [ [ 361, 361 ], "valid" ], [ [ 362, 362 ], "mapped", [ 363 ] ], [ [ 363, 363 ], "valid" ], [ [ 364, 364 ], "mapped", [ 365 ] ], [ [ 365, 365 ], "valid" ], [ [ 366, 366 ], "mapped", [ 367 ] ], [ [ 367, 367 ], "valid" ], [ [ 368, 368 ], "mapped", [ 369 ] ], [ [ 369, 369 ], "valid" ], [ [ 370, 370 ], "mapped", [ 371 ] ], [ [ 371, 371 ], "valid" ], [ [ 372, 372 ], "mapped", [ 373 ] ], [ [ 373, 373 ], "valid" ], [ [ 374, 374 ], "mapped", [ 375 ] ], [ [ 375, 375 ], "valid" ], [ [ 376, 376 ], "mapped", [ 255 ] ], [ [ 377, 377 ], "mapped", [ 378 ] ], [ [ 378, 378 ], "valid" ], [ [ 379, 379 ], "mapped", [ 380 ] ], [ [ 380, 380 ], "valid" ], [ [ 381, 381 ], "mapped", [ 382 ] ], [ [ 382, 382 ], "valid" ], [ [ 383, 383 ], "mapped", [ 115 ] ], [ [ 384, 384 ], "valid" ], [ [ 385, 385 ], "mapped", [ 595 ] ], [ [ 386, 386 ], "mapped", [ 387 ] ], [ [ 387, 387 ], "valid" ], [ [ 388, 388 ], "mapped", [ 389 ] ], [ [ 389, 389 ], "valid" ], [ [ 390, 390 ], "mapped", [ 596 ] ], [ [ 391, 391 ], "mapped", [ 392 ] ], [ [ 392, 392 ], "valid" ], [ [ 393, 393 ], "mapped", [ 598 ] ], [ [ 394, 394 ], "mapped", [ 599 ] ], [ [ 395, 395 ], "mapped", [ 396 ] ], [ [ 396, 397 ], "valid" ], [ [ 398, 398 ], "mapped", [ 477 ] ], [ [ 399, 399 ], "mapped", [ 601 ] ], [ [ 400, 400 ], "mapped", [ 603 ] ], [ [ 401, 401 ], "ma