diff --git a/packages/ripple-binary-codec/.eslintignore b/packages/ripple-binary-codec/.eslintignore new file mode 100644 index 00000000..3cf68f75 --- /dev/null +++ b/packages/ripple-binary-codec/.eslintignore @@ -0,0 +1,4 @@ +node_modules +dist +.github +coverage \ No newline at end of file diff --git a/packages/ripple-binary-codec/.eslintrc b/packages/ripple-binary-codec/.eslintrc deleted file mode 100644 index e20ae98c..00000000 --- a/packages/ripple-binary-codec/.eslintrc +++ /dev/null @@ -1,196 +0,0 @@ -# ESLint documentation can be found at http://eslint.org/docs/ -env: - browser: true - node: true - amd: false - mocha: true - jasmine: false - es6: true -rules: - no-alert: 2 - no-array-constructor: 2 - no-arrow-condition: 0 - no-bitwise: 0 - no-caller: 2 - no-case-declarations: 2 - no-catch-shadow: 2 - no-class-assign: 2 - no-cond-assign: [2, 'always'] - no-console: 0 - no-const-assign: 2 - no-constant-condition: 2 - no-continue: 0 - no-control-regex: 2 - no-debugger: 2 - no-delete-var: 2 - no-div-regex: 0 - no-dupe-class-members: 2 - no-dupe-keys: 2 - no-dupe-args: 2 - no-duplicate-case: 2 - no-else-return: 0 - no-empty: 2 - no-empty-character-class: 2 - no-empty-pattern: 2 - no-eq-null: 2 - no-eval: 2 - no-ex-assign: 2 - no-extend-native: 2 - no-extra-bind: 2 - no-extra-boolean-cast: 2 - no-extra-parens: [2, 'functions'] - no-extra-semi: 2 - no-fallthrough: 2 - no-floating-decimal: 0 - no-func-assign: 2 - no-implicit-coercion: 2 - no-implied-eval: 2 - no-inline-comments: 0 - no-inner-declarations: [2, 'functions'] - no-invalid-regexp: 2 - no-invalid-this: 0 # this rule would cause problems with mocha test cases - no-irregular-whitespace: 2 - no-iterator: 2 - no-label-var: 2 - no-labels: 2 - no-lone-blocks: 2 - no-lonely-if: 2 - no-loop-func: 2 - no-mixed-requires: [0, false] - no-mixed-spaces-and-tabs: [2, false] - linebreak-style: [2, 'unix'] - no-multi-spaces: 2 - no-multi-str: 2 - no-multiple-empty-lines: [2, {max: 2}] - no-native-reassign: 2 - no-negated-condition: 0 - no-negated-in-lhs: 2 - no-nested-ternary: 0 - no-new: 2 - no-new-func: 2 - no-new-object: 2 - no-new-require: 0 - no-new-wrappers: 2 - no-obj-calls: 2 - no-octal: 2 - no-octal-escape: 2 - no-param-reassign: 2 - no-path-concat: 0 - no-plusplus: 0 - no-process-env: 0 - no-process-exit: 0 - no-proto: 2 - no-redeclare: 2 - no-regex-spaces: 2 - no-restricted-modules: 0 - no-restricted-syntax: 0 - no-return-assign: 2 - no-script-url: 2 - no-self-compare: 2 - no-sequences: 2 - no-shadow: 2 - no-shadow-restricted-names: 2 - no-spaced-func: 2 - no-sparse-arrays: 2 - no-sync: 0 - no-ternary: 0 - no-trailing-spaces: 2 - no-this-before-super: 2 - no-throw-literal: 2 - no-undef: 2 - no-undef-init: 2 - no-undefined: 0 - no-unexpected-multiline: 2 - no-underscore-dangle: 0 - no-unneeded-ternary: 0 - no-unreachable: 2 - no-unused-expressions: 2 - no-unused-vars: [2, {vars: 'all', args: 'all', argsIgnorePattern: '^_'}] - no-use-before-define: 2 - no-useless-call: 2 - no-useless-concat: 0 - no-void: 2 - no-var: 2 - no-warning-comments: [0, {terms: ['todo', 'fixme', 'xxx'], location: 'start'}] - no-with: 2 - no-magic-numbers: 0 - - array-bracket-spacing: [2, 'never'] - arrow-body-style: 0 - arrow-parens: [2, 'as-needed'] - arrow-spacing: 2 - accessor-pairs: 2 - block-scoped-var: 2 - block-spacing: 2 - brace-style: 2 - callback-return: 0 - camelcase: 0 - comma-dangle: 2 - comma-spacing: 2 - comma-style: 2 - complexity: [0, 11] - computed-property-spacing: 2 - consistent-return: 2 - consistent-this: [2, 'self'] - constructor-super: 2 - curly: [2, 'all'] - default-case: 0 - dot-location: [2, 'property'] - dot-notation: [2, {allowKeywords: true}] - eol-last: 2 - eqeqeq: 2 - func-names: 0 - func-style: [2, 'declaration', {"allowArrowFunctions": true}] - generator-star-spacing: 2 - global-require: 0 - guard-for-in: 0 - handle-callback-err: 2 - id-length: 0 - indent: [2, 2, {SwitchCase: 1}] - init-declarations: 0 - jsx-quotes: 0 - key-spacing: [2, {beforeColon: false, afterColon: true}] - keyword-spacing: 2 - lines-around-comment: 0 - max-depth: [0, 4] - max-len: [2, 80] - max-nested-callbacks: [0, 2] - max-params: [0, 4] - max-statements: [0, 10] - new-cap: 2 - new-parens: 2 - newline-after-var: 0 - object-curly-spacing: [2, 'never'] - object-shorthand: 0 - one-var: [2, 'never'] - operator-assignment: [0, 'always'] - operator-linebreak: 0 - padded-blocks: 0 - prefer-arrow-callback: 0 - prefer-const: 2 - prefer-spread: 2 - prefer-reflect: 0 - prefer-template: 0 - quote-props: 0 - quotes: [2, 'single'] - radix: 2 - id-match: 0 - require-jsdoc: 0 - require-yield: 0 - semi-spacing: 2 - sort-vars: 0 - space-before-blocks: 2 - space-before-function-paren: [2, 'never'] - space-in-parens: 2 - space-infix-ops: 2 - space-unary-ops: [2, {words: true, nonwords: false}] - spaced-comment: 2 - strict: [2, 'global'] - use-isnan: 2 - valid-jsdoc: 2 - valid-typeof: 2 - vars-on-top: 0 - wrap-iife: 0 - wrap-regex: 0 - yoda: [2, 'never'] -parser: babel-eslint diff --git a/packages/ripple-binary-codec/.eslintrc.js b/packages/ripple-binary-codec/.eslintrc.js new file mode 100644 index 00000000..6a2c0bc1 --- /dev/null +++ b/packages/ripple-binary-codec/.eslintrc.js @@ -0,0 +1,100 @@ +module.exports = { + root: true, + + parser: '@typescript-eslint/parser', // Make ESLint compatible with TypeScript + parserOptions: { + // Enable linting rules with type information from our tsconfig + tsconfigRootDir: __dirname, + project: ['./tsconfig.eslint.json'], + + sourceType: 'module', // Allow the use of imports / ES modules + + ecmaFeatures: { + impliedStrict: true, // Enable global strict mode + }, + }, + + // Specify global variables that are predefined + env: { + browser: true, // Enable browser global variables + node: true, // Enable node global variables & Node.js scoping + es2020: true, // Add all ECMAScript 2020 globals and automatically set the ecmaVersion parser option to ES2020 + jest: true, // Add Mocha testing global variables + }, + + plugins: [ + '@typescript-eslint', // Add some TypeScript specific rules, and disable rules covered by the typechecker + 'import', // Add rules that help validate proper imports + 'prettier', // Allows running prettier as an ESLint rule, and reporting differences as individual linting issues + ], + + extends: [ + // ESLint recommended rules + 'eslint:recommended', + + // Add TypeScript-specific rules, and disable rules covered by typechecker + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + + // Add rules for import/export syntax + 'plugin:import/errors', + 'plugin:import/warnings', + 'plugin:import/typescript', + + // Add rules that specifically require type information using our tsconfig + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + + // Enable Prettier for ESLint --fix, and disable rules that conflict with Prettier + 'prettier/@typescript-eslint', + 'plugin:prettier/recommended', + ], + + // rules: { + // // This rule is about explicitly using `return undefined` when a function returns any non-undefined object. + // // However, since we're using TypeScript, it will yell at us if a function is not allowed to return `undefined` in its signature, so we don't need this rule. + // "consistent-return": "off", + // }, + + overrides: [ + // Overrides for all test files + { + files: 'test/**/*.ts', + rules: { + // For our Mocha test files, the pattern has been to have unnamed functions + 'func-names': 'off', + // Using non-null assertions (obj!.property) cancels the benefits of the strict null-checking mode, but these are test files, so we don't care. + '@typescript-eslint/no-non-null-assertion': 'off', + // For some test files, we shadow testing constants with function parameter names + 'no-shadow': 'off', + // Some of our test files declare helper classes with errors + 'max-classes-per-file': 'off', + }, + }, + { + files: '**/*.ts', + rules: { + // Allow unused variables in our files when explicitly prepended with `_`. + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_' }, + ], + + // These rules are deprecated, but we have an old config that enables it + '@typescript-eslint/camelcase': 'off', + '@typescript-eslint/ban-ts-ignore': 'off', + + // These rules are actually disabled in @xpring-eng/eslint-config-base/loose at the moment + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + }, + }, + { + files: ['src/XRP/default-xrp-client.ts'], + rules: { + // This is actually a good rule to have enabled, but for the XRPClient, we define a helper error message class in the same file + 'max-classes-per-file': 'off', + }, + }, + ], +} \ No newline at end of file diff --git a/packages/ripple-binary-codec/package.json b/packages/ripple-binary-codec/package.json index 9ff6b4b1..d511035b 100644 --- a/packages/ripple-binary-codec/package.json +++ b/packages/ripple-binary-codec/package.json @@ -23,14 +23,22 @@ "@types/jest": "^26.0.0", "@types/lodash": "^4.14.155", "@types/node": "^14.0.10", + "@typescript-eslint/eslint-plugin": "^3.2.0", + "@typescript-eslint/parser": "^3.2.0", + "eslint": "^7.2.0", + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-import": "^2.21.1", + "eslint-plugin-mocha": "^7.0.1", + "eslint-plugin-prettier": "^3.1.3", + "prettier": "^2.0.4", "jest": "^26.0.1", "typescript": "^3.9.5" }, "scripts": { "compile": "tsc && cp ./src/enums/definitions.json ./dist/enums", "prepare": "npm run compile && npm test", - "lint" : "echo 'no linting for this PR is available'", - "test": "jest" + "test": "jest --coverage=true", + "lint": "eslint . --ext .ts --fix" }, "repository": { "type": "git", diff --git a/packages/ripple-binary-codec/src/binary.ts b/packages/ripple-binary-codec/src/binary.ts index 72513ecc..fccf16da 100644 --- a/packages/ripple-binary-codec/src/binary.ts +++ b/packages/ripple-binary-codec/src/binary.ts @@ -1,25 +1,25 @@ /* eslint-disable func-style */ -import { BN } from 'bn.js'; -import { coreTypes } from './types'; -const { HashPrefix } = require('./hash-prefixes'); -const {BinaryParser} = require('./serdes/binary-parser'); -const {BinarySerializer, BytesList} = require('./serdes/binary-serializer'); -const {bytesToHex, slice, parseBytes} = require('./utils/bytes-utils'); +import { BN } from "bn.js"; +import { coreTypes } from "./types"; +const { HashPrefix } = require("./hash-prefixes"); +const { BinaryParser } = require("./serdes/binary-parser"); +const { BinarySerializer, BytesList } = require("./serdes/binary-serializer"); +const { bytesToHex, slice, parseBytes } = require("./utils/bytes-utils"); -const {sha512Half, transactionID} = require('./hashes'); +const { sha512Half, transactionID } = require("./hashes"); -const makeParser = bytes => new BinaryParser(bytes); -const readJSON = parser => parser.readType(coreTypes.STObject).toJSON(); -const binaryToJSON = bytes => readJSON(makeParser(bytes)); +const makeParser = (bytes) => new BinaryParser(bytes); +const readJSON = (parser) => parser.readType(coreTypes.STObject).toJSON(); +const binaryToJSON = (bytes) => readJSON(makeParser(bytes)); function serializeObject(object, opts = {}) { - const {prefix, suffix, signingFieldsOnly = false} = opts; + const { prefix, suffix, signingFieldsOnly = false } = opts; const bytesList = new BytesList(); if (prefix) { bytesList.put(prefix); } - const filter = signingFieldsOnly ? f => f.isSigningField : undefined; + const filter = signingFieldsOnly ? (f) => f.isSigningField : undefined; coreTypes.STObject.from(object).toBytesSink(bytesList, filter); if (suffix) { bytesList.put(suffix); @@ -28,26 +28,26 @@ function serializeObject(object, opts = {}) { } function signingData(tx, prefix = HashPrefix.transactionSig) { - return serializeObject(tx, {prefix, signingFieldsOnly: true}); + return serializeObject(tx, { prefix, signingFieldsOnly: true }); } function signingClaimData(claim) { - const prefix = HashPrefix.paymentChannelClaim - const channel = coreTypes.Hash256.from(claim.channel).toBytes() + const prefix = HashPrefix.paymentChannelClaim; + const channel = coreTypes.Hash256.from(claim.channel).toBytes(); const amount = new coreTypes.UInt64(new BN(claim.amount)).toBytes(); const bytesList = new BytesList(); - bytesList.put(prefix) - bytesList.put(channel) - bytesList.put(amount) - return bytesList.toBytes() + bytesList.put(prefix); + bytesList.put(channel); + bytesList.put(amount); + return bytesList.toBytes(); } function multiSigningData(tx, signingAccount) { const prefix = HashPrefix.transactionMultiSig; const suffix = coreTypes.AccountID.from(signingAccount).toBytes(); - return serializeObject(tx, {prefix, suffix, signingFieldsOnly: true}); + return serializeObject(tx, { prefix, suffix, signingFieldsOnly: true }); } export { @@ -65,5 +65,5 @@ export { binaryToJSON, sha512Half, transactionID, - slice + slice, }; diff --git a/packages/ripple-binary-codec/src/coretypes.ts b/packages/ripple-binary-codec/src/coretypes.ts index 2ad0eaa8..dd078d72 100644 --- a/packages/ripple-binary-codec/src/coretypes.ts +++ b/packages/ripple-binary-codec/src/coretypes.ts @@ -1,13 +1,12 @@ -import { Enums } from './enums'; -const {Field} = Enums.Field; -const types = require('./types'); -const binary = require('./binary'); -const {ShaMap} = require('./shamap'); -const ledgerHashes = require('./ledger-hashes'); -const hashes = require('./hashes'); -const quality = require('./quality'); -const {HashPrefix} = require('./hash-prefixes'); - +import { Enums } from "./enums"; +const { Field } = Enums.Field; +const types = require("./types"); +const binary = require("./binary"); +const { ShaMap } = require("./shamap"); +const ledgerHashes = require("./ledger-hashes"); +const hashes = require("./hashes"); +const quality = require("./quality"); +const { HashPrefix } = require("./hash-prefixes"); export { hashes, @@ -18,5 +17,5 @@ export { Field, HashPrefix, ShaMap, - types -} + types, +}; diff --git a/packages/ripple-binary-codec/src/enums/index.ts b/packages/ripple-binary-codec/src/enums/index.ts index 71eb5b5c..8f4b79b7 100644 --- a/packages/ripple-binary-codec/src/enums/index.ts +++ b/packages/ripple-binary-codec/src/enums/index.ts @@ -1,125 +1,138 @@ -import { makeClass } from './../utils/make-class' -const assert = require('assert') -const _ = require('lodash') -const { parseBytes, serializeUIntN } = require('./../utils/bytes-utils') -const enums = require('./definitions.json') +import { makeClass } from "./../utils/make-class"; +const assert = require("assert"); +const _ = require("lodash"); +const { parseBytes, serializeUIntN } = require("./../utils/bytes-utils"); +const enums = require("./definitions.json"); -function transformWith (func, obj) { - return _.transform(obj, func) +function transformWith(func, obj) { + return _.transform(obj, func); } -function biMap (obj, valueKey) { +function biMap(obj, valueKey) { return _.transform(obj, (result, value, key) => { - result[key] = value - result[value[valueKey]] = value - }) + result[key] = value; + result[value[valueKey]] = value; + }); } -const EnumType = makeClass({ - EnumType (definition) { - _.assign(this, definition) - // At minimum - assert(this.bytes instanceof Uint8Array) - assert(typeof this.ordinal === 'number') - assert(typeof this.name === 'string') - }, - toString () { - return this.name - }, - toJSON () { - return this.name - }, - toBytesSink (sink) { - sink.put(this.bytes) - }, - statics: { - ordinalByteWidth: 1, - fromParser (parser) { - return this.from(parser.readUIntN(this.ordinalByteWidth)) +const EnumType = makeClass( + { + EnumType(definition) { + _.assign(this, definition); + // At minimum + assert(this.bytes instanceof Uint8Array); + assert(typeof this.ordinal === "number"); + assert(typeof this.name === "string"); }, - from (val) { - const ret = val instanceof this ? val : this[val] - if (!ret) { - throw new Error( - `${val} is not a valid name or ordinal for ${this.enumName}`) - } - return ret + toString() { + return this.name; }, - valuesByName () { - return _.transform(this.initVals, (result, ordinal, name) => { - const bytes = serializeUIntN(ordinal, this.ordinalByteWidth) - const type = new this({ name, ordinal, bytes }) - result[name] = type - }) + toJSON() { + return this.name; }, - init () { - const mapped = this.valuesByName() - _.assign(this, biMap(mapped, 'ordinal')) - this.values = _.values(mapped) - return this - } - } -}, undefined) + toBytesSink(sink) { + sink.put(this.bytes); + }, + statics: { + ordinalByteWidth: 1, + fromParser(parser) { + return this.from(parser.readUIntN(this.ordinalByteWidth)); + }, + from(val) { + const ret = val instanceof this ? val : this[val]; + if (!ret) { + throw new Error( + `${val} is not a valid name or ordinal for ${this.enumName}` + ); + } + return ret; + }, + valuesByName() { + return _.transform(this.initVals, (result, ordinal, name) => { + const bytes = serializeUIntN(ordinal, this.ordinalByteWidth); + const type = new this({ name, ordinal, bytes }); + result[name] = type; + }); + }, + init() { + const mapped = this.valuesByName(); + _.assign(this, biMap(mapped, "ordinal")); + this.values = _.values(mapped); + return this; + }, + }, + }, + undefined +); -function makeEnum (name, definition) { - return makeClass({ - inherits: EnumType, - statics: _.assign(definition, { enumName: name }) - }, undefined) +function makeEnum(name, definition) { + return makeClass( + { + inherits: EnumType, + statics: _.assign(definition, { enumName: name }), + }, + undefined + ); } -function makeEnums (to, definition, name) { - to[name] = makeEnum(name, definition) +function makeEnums(to, definition, name) { + to[name] = makeEnum(name, definition); } const Enums = transformWith(makeEnums, { Type: { - initVals: enums.TYPES + initVals: enums.TYPES, }, LedgerEntryType: { - initVals: enums.LEDGER_ENTRY_TYPES, ordinalByteWidth: 2 + initVals: enums.LEDGER_ENTRY_TYPES, + ordinalByteWidth: 2, }, TransactionType: { - initVals: enums.TRANSACTION_TYPES, ordinalByteWidth: 2 + initVals: enums.TRANSACTION_TYPES, + ordinalByteWidth: 2, }, TransactionResult: { - initVals: enums.TRANSACTION_RESULTS, ordinalByteWidth: 1 - } -}) + initVals: enums.TRANSACTION_RESULTS, + ordinalByteWidth: 1, + }, +}); -Enums.Field = makeClass({ - inherits: EnumType, - statics: { - enumName: 'Field', - initVals: enums.FIELDS, - valuesByName () { - const fields = _.map(this.initVals, ([name, definition]) => { - const type = Enums.Type[definition.type] - const bytes = this.header(type.ordinal, definition.nth) - const ordinal = type.ordinal << 16 | definition.nth - const extra = { ordinal, name, type, bytes } - return new this(_.assign(definition, extra)) - }) - return _.keyBy(fields, 'name') - }, - header (type, nth) { - const name = nth - const header = [] - const push = header.push.bind(header) - if (type < 16) { - if (name < 16) { - push(type << 4 | name) +Enums.Field = makeClass( + { + inherits: EnumType, + statics: { + enumName: "Field", + initVals: enums.FIELDS, + valuesByName() { + const fields = _.map(this.initVals, ([name, definition]) => { + const type = Enums.Type[definition.type]; + const bytes = this.header(type.ordinal, definition.nth); + const ordinal = (type.ordinal << 16) | definition.nth; + const extra = { ordinal, name, type, bytes }; + return new this(_.assign(definition, extra)); + }); + return _.keyBy(fields, "name"); + }, + header(type, nth) { + const name = nth; + const header = []; + const push = header.push.bind(header); + if (type < 16) { + if (name < 16) { + push((type << 4) | name); + } else { + push(type << 4, name); + } + } else if (name < 16) { + push(name, type); } else { - push(type << 4, name) + push(0, type, name); } - } else if (name < 16) { - push(name, type) - } else { - push(0, type, name) - } - return parseBytes(header, Uint8Array) - } - } -}, undefined) + return parseBytes(header, Uint8Array); + }, + }, + }, + undefined +); -export { Enums } +export { Enums }; diff --git a/packages/ripple-binary-codec/src/enums/utils-renumber.ts b/packages/ripple-binary-codec/src/enums/utils-renumber.ts index 0672de92..c0d120ab 100644 --- a/packages/ripple-binary-codec/src/enums/utils-renumber.ts +++ b/packages/ripple-binary-codec/src/enums/utils-renumber.ts @@ -96,39 +96,39 @@ const input = { tecDUPLICATE: 149, tecKILLED: 150, tecHAS_OBLIGATIONS: 151, - tecTOO_SOON: 152 -} + tecTOO_SOON: 152, +}; -let startingFromTemBADSENDXRPPATHS = -284 +let startingFromTemBADSENDXRPPATHS = -284; -let startingFromTefFAILURE = -199 +let startingFromTefFAILURE = -199; -let startingFromTerRETRY = -99 +let startingFromTerRETRY = -99; -const tesSUCCESS = 0 +const tesSUCCESS = 0; -let startingFromTecCLAIM = 100 +let startingFromTecCLAIM = 100; -const startingFromTecDIRFULL = 121 +const startingFromTecDIRFULL = 121; -let previousKey = 'tem' -Object.keys(input).forEach(key => { +let previousKey = "tem"; +Object.keys(input).forEach((key) => { if (key.substring(0, 3) !== previousKey.substring(0, 3)) { - console.log() - previousKey = key + console.log(); + previousKey = key; } - if (key.substring(0, 3) === 'tem') { - console.log(` "${key}": ${startingFromTemBADSENDXRPPATHS++},`) - } else if (key.substring(0, 3) === 'tef') { - console.log(` "${key}": ${startingFromTefFAILURE++},`) - } else if (key.substring(0, 3) === 'ter') { - console.log(` "${key}": ${startingFromTerRETRY++},`) - } else if (key.substring(0, 3) === 'tes') { - console.log(` "${key}": ${tesSUCCESS},`) - } else if (key.substring(0, 3) === 'tec') { - if (key === 'tecDIR_FULL') { - startingFromTecCLAIM = startingFromTecDIRFULL + if (key.substring(0, 3) === "tem") { + console.log(` "${key}": ${startingFromTemBADSENDXRPPATHS++},`); + } else if (key.substring(0, 3) === "tef") { + console.log(` "${key}": ${startingFromTefFAILURE++},`); + } else if (key.substring(0, 3) === "ter") { + console.log(` "${key}": ${startingFromTerRETRY++},`); + } else if (key.substring(0, 3) === "tes") { + console.log(` "${key}": ${tesSUCCESS},`); + } else if (key.substring(0, 3) === "tec") { + if (key === "tecDIR_FULL") { + startingFromTecCLAIM = startingFromTecDIRFULL; } - console.log(` "${key}": ${startingFromTecCLAIM++},`) + console.log(` "${key}": ${startingFromTecCLAIM++},`); } -}) +}); diff --git a/packages/ripple-binary-codec/src/hash-prefixes.ts b/packages/ripple-binary-codec/src/hash-prefixes.ts index 34e0efdc..b6101e2b 100644 --- a/packages/ripple-binary-codec/src/hash-prefixes.ts +++ b/packages/ripple-binary-codec/src/hash-prefixes.ts @@ -1,31 +1,29 @@ -import { serializeUIntN } from './utils/bytes-utils'; +import { serializeUIntN } from "./utils/bytes-utils"; function bytes(uint32) { return serializeUIntN(uint32, 4); } const HashPrefix = { - transactionID: bytes(0x54584E00), + transactionID: bytes(0x54584e00), // transaction plus metadata - transaction: bytes(0x534E4400), + transaction: bytes(0x534e4400), // account state - accountStateEntry: bytes(0x4D4C4E00), + accountStateEntry: bytes(0x4d4c4e00), // inner node in tree - innerNode: bytes(0x4D494E00), + innerNode: bytes(0x4d494e00), // ledger master data for signing - ledgerHeader: bytes(0x4C575200), + ledgerHeader: bytes(0x4c575200), // inner transaction to sign transactionSig: bytes(0x53545800), // inner transaction to sign - transactionMultiSig: bytes(0x534D5400), + transactionMultiSig: bytes(0x534d5400), // validation for signing - validation: bytes(0x56414C00), + validation: bytes(0x56414c00), // proposal for signing proposal: bytes(0x50525000), // payment channel claim - paymentChannelClaim: bytes(0x434C4D00) + paymentChannelClaim: bytes(0x434c4d00), }; -export { - HashPrefix -}; +export { HashPrefix }; diff --git a/packages/ripple-binary-codec/src/hashes.ts b/packages/ripple-binary-codec/src/hashes.ts index eb140010..78f467f4 100644 --- a/packages/ripple-binary-codec/src/hashes.ts +++ b/packages/ripple-binary-codec/src/hashes.ts @@ -1,43 +1,44 @@ -import { makeClass } from './utils/make-class'; -import { HashPrefix } from './hash-prefixes'; -import { coreTypes } from './types'; -import { parseBytes } from './utils/bytes-utils'; -import * as createHash from 'create-hash'; +import { makeClass } from "./utils/make-class"; +import { HashPrefix } from "./hash-prefixes"; +import { coreTypes } from "./types"; +import { parseBytes } from "./utils/bytes-utils"; +import * as createHash from "create-hash"; -const Sha512Half = makeClass({ - Sha512Half() { - this.hash = createHash('sha512'); - }, - statics: { +const Sha512Half = makeClass( + { + Sha512Half() { + this.hash = createHash("sha512"); + }, + statics: { + put(bytes) { + return new this().put(bytes); + }, + }, put(bytes) { - return new this().put(bytes); - } + this.hash.update(parseBytes(bytes, Buffer)); + return this; + }, + finish256() { + const bytes = this.hash.digest(); + return bytes.slice(0, 32); + }, + finish() { + return new coreTypes.Hash256(this.finish256()); + }, }, - put(bytes) { - this.hash.update(parseBytes(bytes, Buffer)); - return this; - }, - finish256() { - const bytes = this.hash.digest(); - return bytes.slice(0, 32); - }, - finish() { - return new coreTypes.Hash256(this.finish256()); - } -}, undefined); + undefined +); function sha512Half(...args) { const hash = new Sha512Half(); - args.forEach(a => hash.put(a)); + args.forEach((a) => hash.put(a)); return parseBytes(hash.finish256(), Uint8Array); } function transactionID(serialized) { - return new coreTypes.Hash256(sha512Half(HashPrefix.transactionID, serialized)); + return new coreTypes.Hash256( + sha512Half(HashPrefix.transactionID, serialized) + ); } -export { - Sha512Half, - sha512Half, - transactionID -}; +export { Sha512Half, sha512Half, transactionID }; diff --git a/packages/ripple-binary-codec/src/index.ts b/packages/ripple-binary-codec/src/index.ts index 77554078..f8527689 100644 --- a/packages/ripple-binary-codec/src/index.ts +++ b/packages/ripple-binary-codec/src/index.ts @@ -1,64 +1,65 @@ -import {strict as assert} from 'assert'; -import { quality, binary } from './coretypes'; -import { coreTypes } from './types'; -const { bytesToHex, - signingData, - signingClaimData, - multiSigningData, - binaryToJSON, - serializeObject, - BinaryParser } = binary; - +import { strict as assert } from "assert"; +import { quality, binary } from "./coretypes"; +import { coreTypes } from "./types"; +const { + bytesToHex, + signingData, + signingClaimData, + multiSigningData, + binaryToJSON, + serializeObject, + BinaryParser, +} = binary; function decodeLedgerData(binary) { - assert(typeof binary === 'string', 'binary must be a hex string'); - const parser = new BinaryParser(binary) + assert(typeof binary === "string", "binary must be a hex string"); + const parser = new BinaryParser(binary); return { - ledger_index: parser.readUInt32(), - total_coins: parser.readType(coreTypes.UInt64).valueOf().toString(), - parent_hash: parser.readType(coreTypes.Hash256).toHex(), - transaction_hash: parser.readType(coreTypes.Hash256).toHex(), - account_hash: parser.readType(coreTypes.Hash256).toHex(), - parent_close_time: parser.readUInt32(), - close_time: parser.readUInt32(), + ledger_index: parser.readUInt32(), + total_coins: parser.readType(coreTypes.UInt64).valueOf().toString(), + parent_hash: parser.readType(coreTypes.Hash256).toHex(), + transaction_hash: parser.readType(coreTypes.Hash256).toHex(), + account_hash: parser.readType(coreTypes.Hash256).toHex(), + parent_close_time: parser.readUInt32(), + close_time: parser.readUInt32(), close_time_resolution: parser.readUInt8(), - close_flags: parser.readUInt8() - } + close_flags: parser.readUInt8(), + }; } function decode(binary) { - assert(typeof binary === 'string', 'binary must be a hex string'); + assert(typeof binary === "string", "binary must be a hex string"); return binaryToJSON(binary); } function encode(json) { - assert(typeof json === 'object'); + assert(typeof json === "object"); return bytesToHex(serializeObject(json)); } function encodeForSigning(json) { - assert(typeof json === 'object'); + assert(typeof json === "object"); return bytesToHex(signingData(json)); } function encodeForSigningClaim(json) { - assert(typeof json === 'object'); + assert(typeof json === "object"); return bytesToHex(signingClaimData(json)); } function encodeForMultisigning(json, signer) { - assert(typeof json === 'object'); - assert.equal(json.SigningPubKey, ''); + assert(typeof json === "object"); + assert.equal(json.SigningPubKey, ""); return bytesToHex(multiSigningData(json, signer)); } function encodeQuality(value) { - assert(typeof value === 'string'); + assert(typeof value === "string"); return bytesToHex(quality.encode(value)); } function decodeQuality(value) { - assert(typeof value === 'string'); + assert(typeof value === "string"); return quality.decode(value).toString(); } @@ -70,5 +71,5 @@ module.exports = { encodeForMultisigning, encodeQuality, decodeQuality, - decodeLedgerData -}; \ No newline at end of file + decodeLedgerData, +}; diff --git a/packages/ripple-binary-codec/src/ledger-hashes.ts b/packages/ripple-binary-codec/src/ledger-hashes.ts index a1e2b784..08e70722 100644 --- a/packages/ripple-binary-codec/src/ledger-hashes.ts +++ b/packages/ripple-binary-codec/src/ledger-hashes.ts @@ -1,16 +1,16 @@ -import * as _ from 'lodash' -import { BN } from 'bn.js'; -import { strict as assert } from 'assert'; -import { coreTypes } from './types'; +import * as _ from "lodash"; +import { BN } from "bn.js"; +import { strict as assert } from "assert"; +import { coreTypes } from "./types"; const { STObject, Hash256 } = coreTypes; -import { ShaMap } from './shamap'; -import { HashPrefix } from './hash-prefixes'; -import { Sha512Half } from './hashes'; -import { BinarySerializer, serializeObject } from './binary'; +import { ShaMap } from "./shamap"; +import { HashPrefix } from "./hash-prefixes"; +import { Sha512Half } from "./hashes"; +import { BinarySerializer, serializeObject } from "./binary"; function computeHash(itemizer, itemsJson) { const map = new ShaMap(); - itemsJson.forEach(item => map.addItem(...itemizer(item))); + itemsJson.forEach((item) => map.addItem(...itemizer(item))); return map.hash(); } @@ -25,7 +25,7 @@ function transactionItem(json) { const serializer = new BinarySerializer(sink); serializer.writeLengthEncoded(STObject.from(json)); serializer.writeLengthEncoded(STObject.from(json.metaData)); - } + }, }; return [index, item]; } @@ -39,7 +39,7 @@ function entryItem(json) { }, toBytesSink(sink) { sink.put(bytes); - } + }, }; return [index, item]; } @@ -65,8 +65,4 @@ function ledgerHash(header) { return hash.finish(); } -export { - accountStateHash, - transactionTreeHash, - ledgerHash -}; +export { accountStateHash, transactionTreeHash, ledgerHash }; diff --git a/packages/ripple-binary-codec/src/quality.ts b/packages/ripple-binary-codec/src/quality.ts index f6102a60..729d2c12 100644 --- a/packages/ripple-binary-codec/src/quality.ts +++ b/packages/ripple-binary-codec/src/quality.ts @@ -1,13 +1,16 @@ -const Decimal = require('decimal.js'); -import { bytesToHex, slice, parseBytes } from './utils/bytes-utils'; -import { coreTypes } from './types'; -import { BN } from 'bn.js'; +const Decimal = require("decimal.js"); +import { bytesToHex, slice, parseBytes } from "./utils/bytes-utils"; +import { coreTypes } from "./types"; +import { BN } from "bn.js"; module.exports = { encode(arg) { const quality = arg instanceof Decimal ? arg : new Decimal(arg); const exponent = quality.e - 15; - const qualityString = quality.times('1e' + -exponent).abs().toString(); + const qualityString = quality + .times("1e" + -exponent) + .abs() + .toString(); const bytes = new coreTypes.UInt64(new BN(qualityString)).toBytes(); bytes[0] = exponent + 100; return bytes; @@ -15,7 +18,7 @@ module.exports = { decode(arg) { const bytes = slice(parseBytes(arg), -8); const exponent = bytes[0] - 100; - const mantissa = new Decimal('0x' + bytesToHex(slice(bytes, 1))); - return mantissa.times('1e' + exponent); - } + const mantissa = new Decimal("0x" + bytesToHex(slice(bytes, 1))); + return mantissa.times("1e" + exponent); + }, }; diff --git a/packages/ripple-binary-codec/src/serdes/binary-parser.ts b/packages/ripple-binary-codec/src/serdes/binary-parser.ts index be36970e..4389dea8 100644 --- a/packages/ripple-binary-codec/src/serdes/binary-parser.ts +++ b/packages/ripple-binary-codec/src/serdes/binary-parser.ts @@ -1,98 +1,101 @@ -import { strict as assert } from 'assert' -import { makeClass } from '../utils/make-class' -import { Enums } from '../enums' -import { slice, parseBytes } from '../utils/bytes-utils' +import { strict as assert } from "assert"; +import { makeClass } from "../utils/make-class"; +import { Enums } from "../enums"; +import { slice, parseBytes } from "../utils/bytes-utils"; -const BinaryParser = makeClass({ - BinaryParser (buf) { - this._buf = parseBytes(buf, Uint8Array) - this._length = this._buf.length - this._cursor = 0 +const BinaryParser = makeClass( + { + BinaryParser(buf) { + this._buf = parseBytes(buf, Uint8Array); + this._length = this._buf.length; + this._cursor = 0; + }, + skip(n) { + this._cursor += n; + }, + read(n, to = Uint8Array) { + const start = this._cursor; + const end = this._cursor + n; + assert(end <= this._buf.length); + this._cursor = end; + return slice(this._buf, start, end, to); + }, + readUIntN(n) { + return this.read(n, Array).reduce((a, b) => (a << 8) | b) >>> 0; + }, + readUInt8() { + return this._buf[this._cursor++]; + }, + readUInt16() { + return this.readUIntN(2); + }, + readUInt32() { + return this.readUIntN(4); + }, + pos() { + return this._cursor; + }, + size() { + return this._buf.length; + }, + end(customEnd) { + const cursor = this.pos(); + return ( + cursor >= this._length || (customEnd !== null && cursor >= customEnd) + ); + }, + readVL() { + return this.read(this.readVLLength()); + }, + readVLLength() { + const b1 = this.readUInt8(); + if (b1 <= 192) { + return b1; + } else if (b1 <= 240) { + const b2 = this.readUInt8(); + return 193 + (b1 - 193) * 256 + b2; + } else if (b1 <= 254) { + const b2 = this.readUInt8(); + const b3 = this.readUInt8(); + return 12481 + (b1 - 241) * 65536 + b2 * 256 + b3; + } + throw new Error("Invalid varint length indicator"); + }, + readFieldOrdinal() { + const tagByte = this.readUInt8(); + const type = (tagByte & 0xf0) >>> 4 || this.readUInt8(); + const nth = tagByte & 0x0f || this.readUInt8(); + return (type << 16) | nth; + }, + readField() { + return Enums.Field.from(this.readFieldOrdinal()); + }, + readType(type) { + return type.fromParser(this); + }, + typeForField(field) { + return field.associatedType; + }, + readFieldValue(field) { + const kls = this.typeForField(field); + if (!kls) { + throw new Error(`unsupported: (${field.name}, ${field.type.name})`); + } + const sizeHint = field.isVLEncoded ? this.readVLLength() : null; + const value = kls.fromParser(this, sizeHint); + if (value === undefined) { + throw new Error( + `fromParser for (${field.name}, ${field.type.name}) -> undefined ` + ); + } + return value; + }, + readFieldAndValue() { + const field = this.readField(); + return [field, this.readFieldValue(field)]; + }, }, - skip (n) { - this._cursor += n - }, - read (n, to = Uint8Array) { - const start = this._cursor - const end = this._cursor + n - assert(end <= this._buf.length) - this._cursor = end - return slice(this._buf, start, end, to) - }, - readUIntN (n) { - return this.read(n, Array).reduce((a, b) => a << 8 | b) >>> 0 - }, - readUInt8 () { - return this._buf[this._cursor++] - }, - readUInt16 () { - return this.readUIntN(2) - }, - readUInt32 () { - return this.readUIntN(4) - }, - pos () { - return this._cursor - }, - size () { - return this._buf.length - }, - end (customEnd) { - const cursor = this.pos() - return (cursor >= this._length) || (customEnd !== null && - cursor >= customEnd) - }, - readVL () { - return this.read(this.readVLLength()) - }, - readVLLength () { - const b1 = this.readUInt8() - if (b1 <= 192) { - return b1 - } else if (b1 <= 240) { - const b2 = this.readUInt8() - return 193 + (b1 - 193) * 256 + b2 - } else if (b1 <= 254) { - const b2 = this.readUInt8() - const b3 = this.readUInt8() - return 12481 + (b1 - 241) * 65536 + b2 * 256 + b3 - } - throw new Error('Invalid varint length indicator') - }, - readFieldOrdinal () { - const tagByte = this.readUInt8() - const type = (tagByte & 0xF0) >>> 4 || this.readUInt8() - const nth = tagByte & 0x0F || this.readUInt8() - return type << 16 | nth - }, - readField () { - return Enums.Field.from(this.readFieldOrdinal()) - }, - readType (type) { - return type.fromParser(this) - }, - typeForField (field) { - return field.associatedType - }, - readFieldValue (field) { - const kls = this.typeForField(field) - if (!kls) { - throw new Error(`unsupported: (${field.name}, ${field.type.name})`) - } - const sizeHint = field.isVLEncoded ? this.readVLLength() : null - const value = kls.fromParser(this, sizeHint) - if (value === undefined) { - throw new Error( - `fromParser for (${field.name}, ${field.type.name}) -> undefined `) - } - return value - }, - readFieldAndValue () { - const field = this.readField() - return [field, this.readFieldValue(field)] - } -}, undefined) + undefined +); -export { - BinaryParser -} +export { BinaryParser }; diff --git a/packages/ripple-binary-codec/src/serdes/binary-serializer.ts b/packages/ripple-binary-codec/src/serdes/binary-serializer.ts index 58062cf9..69780ed0 100644 --- a/packages/ripple-binary-codec/src/serdes/binary-serializer.ts +++ b/packages/ripple-binary-codec/src/serdes/binary-serializer.ts @@ -1,107 +1,110 @@ -import { strict as assert } from 'assert' -import { parseBytes, bytesToHex } from '../utils/bytes-utils' -import { makeClass } from '../utils/make-class' -import { Enums } from '../enums' +import { strict as assert } from "assert"; +import { parseBytes, bytesToHex } from "../utils/bytes-utils"; +import { makeClass } from "../utils/make-class"; +import { Enums } from "../enums"; const BytesSink = { - put (/* bytesSequence */) { + put(/* bytesSequence */) { // any hex string or any object with a `length` and where 0 <= [ix] <= 255 - } -} + }, +}; -const BytesList = makeClass({ - implementing: BytesSink, - BytesList () { - this.arrays = [] - this.length = 0 +const BytesList = makeClass( + { + implementing: BytesSink, + BytesList() { + this.arrays = []; + this.length = 0; + }, + put(bytesArg) { + const bytes = parseBytes(bytesArg, Uint8Array); + this.length += bytes.length; + this.arrays.push(bytes); + return this; + }, + toBytesSink(sink) { + this.arrays.forEach((arr) => { + sink.put(arr); + }); + }, + toBytes() { + const concatenated = new Uint8Array(this.length); + let pointer = 0; + this.arrays.forEach((arr) => { + concatenated.set(arr, pointer); + pointer += arr.length; + }); + return concatenated; + }, + toHex() { + return bytesToHex(this.toBytes()); + }, }, - put (bytesArg) { - const bytes = parseBytes(bytesArg, Uint8Array) - this.length += bytes.length - this.arrays.push(bytes) - return this - }, - toBytesSink (sink) { - this.arrays.forEach(arr => { - sink.put(arr) - }) - }, - toBytes () { - const concatenated = new Uint8Array(this.length) - let pointer = 0 - this.arrays.forEach(arr => { - concatenated.set(arr, pointer) - pointer += arr.length - }) - return concatenated - }, - toHex () { - return bytesToHex(this.toBytes()) - } -}, undefined) + undefined +); -const BinarySerializer = makeClass({ - BinarySerializer (sink) { - this.sink = sink - }, - write (value) { - value.toBytesSink(this.sink) - }, - put (bytes) { - this.sink.put(bytes) - }, - writeType (type, value) { - this.write(type.from(value)) - }, - writeBytesList (bl) { - bl.toBytesSink(this.sink) - }, - encodeVL (len) { - let length = len - const lenBytes = new Uint8Array(4) - if (length <= 192) { - lenBytes[0] = length - return lenBytes.subarray(0, 1) - } else if (length <= 12480) { - length -= 193 - lenBytes[0] = 193 + (length >>> 8) - lenBytes[1] = length & 0xff - return lenBytes.subarray(0, 2) - } else if (length <= 918744) { - length -= 12481 - lenBytes[0] = 241 + (length >>> 16) - lenBytes[1] = (length >> 8) & 0xff - lenBytes[2] = length & 0xff - return lenBytes.subarray(0, 3) - } - throw new Error('Overflow error') - }, - writeFieldAndValue (field, _value) { - const sink = this.sink - const value = field.associatedType.from(_value) - assert(value.toBytesSink, field) - sink.put(field.bytes) - - if (field.isVLEncoded) { - this.writeLengthEncoded(value) - } else { - value.toBytesSink(sink) - if (field.type === Enums.Type.STObject) { - sink.put(Enums.Field.ObjectEndMarker.bytes) - } else if (field.type === Enums.Type.STArray) { - sink.put(Enums.Field.ArrayEndMarker.bytes) +const BinarySerializer = makeClass( + { + BinarySerializer(sink) { + this.sink = sink; + }, + write(value) { + value.toBytesSink(this.sink); + }, + put(bytes) { + this.sink.put(bytes); + }, + writeType(type, value) { + this.write(type.from(value)); + }, + writeBytesList(bl) { + bl.toBytesSink(this.sink); + }, + encodeVL(len) { + let length = len; + const lenBytes = new Uint8Array(4); + if (length <= 192) { + lenBytes[0] = length; + return lenBytes.subarray(0, 1); + } else if (length <= 12480) { + length -= 193; + lenBytes[0] = 193 + (length >>> 8); + lenBytes[1] = length & 0xff; + return lenBytes.subarray(0, 2); + } else if (length <= 918744) { + length -= 12481; + lenBytes[0] = 241 + (length >>> 16); + lenBytes[1] = (length >> 8) & 0xff; + lenBytes[2] = length & 0xff; + return lenBytes.subarray(0, 3); } - } - }, - writeLengthEncoded (value) { - const bytes = new BytesList() - value.toBytesSink(bytes) - this.put(this.encodeVL(bytes.length)) - this.writeBytesList(bytes) - } -}, undefined) + throw new Error("Overflow error"); + }, + writeFieldAndValue(field, _value) { + const sink = this.sink; + const value = field.associatedType.from(_value); + assert(value.toBytesSink, field); + sink.put(field.bytes); -export { - BytesList, - BinarySerializer -} + if (field.isVLEncoded) { + this.writeLengthEncoded(value); + } else { + value.toBytesSink(sink); + if (field.type === Enums.Type.STObject) { + sink.put(Enums.Field.ObjectEndMarker.bytes); + } else if (field.type === Enums.Type.STArray) { + sink.put(Enums.Field.ArrayEndMarker.bytes); + } + } + }, + writeLengthEncoded(value) { + const bytes = new BytesList(); + value.toBytesSink(bytes); + this.put(this.encodeVL(bytes.length)); + this.writeBytesList(bytes); + }, + }, + undefined +); + +export { BytesList, BinarySerializer }; diff --git a/packages/ripple-binary-codec/src/shamap.ts b/packages/ripple-binary-codec/src/shamap.ts index cfb6978b..fb963936 100644 --- a/packages/ripple-binary-codec/src/shamap.ts +++ b/packages/ripple-binary-codec/src/shamap.ts @@ -1,108 +1,118 @@ -import { strict as assert } from 'assert' -import { makeClass } from './utils/make-class'; -import { coreTypes } from './types'; -import { HashPrefix } from './hash-prefixes'; -import { Sha512Half } from './hashes'; +import { strict as assert } from "assert"; +import { makeClass } from "./utils/make-class"; +import { coreTypes } from "./types"; +import { HashPrefix } from "./hash-prefixes"; +import { Sha512Half } from "./hashes"; -const ShaMapNode = makeClass({ - virtuals: { - hashPrefix() {}, - isLeaf() {}, - isInner() {} +const ShaMapNode = makeClass( + { + virtuals: { + hashPrefix() {}, + isLeaf() {}, + isInner() {}, + }, + cached: { + hash() { + const hasher = Sha512Half.put(this.hashPrefix()); + this.toBytesSink(hasher); + return hasher.finish(); + }, + }, }, - cached: { - hash() { - const hasher = Sha512Half.put(this.hashPrefix()); - this.toBytesSink(hasher); - return hasher.finish(); - } - } -}, undefined); + undefined +); -const ShaMapLeaf = makeClass({ - inherits: ShaMapNode, - ShaMapLeaf(index, item) { - ShaMapNode.call(this); - this.index = index; - this.item = item; +const ShaMapLeaf = makeClass( + { + inherits: ShaMapNode, + ShaMapLeaf(index, item) { + ShaMapNode.call(this); + this.index = index; + this.item = item; + }, + isLeaf() { + return true; + }, + isInner() { + return false; + }, + hashPrefix() { + return this.item.hashPrefix(); + }, + toBytesSink(sink) { + this.item.toBytesSink(sink); + this.index.toBytesSink(sink); + }, }, - isLeaf() { - return true; - }, - isInner() { - return false; - }, - hashPrefix() { - return this.item.hashPrefix(); - }, - toBytesSink(sink) { - this.item.toBytesSink(sink); - this.index.toBytesSink(sink); - } -}, undefined); + undefined +); const $uper = ShaMapNode.prototype; -const ShaMapInner = makeClass({ - inherits: ShaMapNode, - ShaMapInner(depth = 0) { - ShaMapNode.call(this); - this.depth = depth; - this.slotBits = 0; - this.branches = Array(16); +const ShaMapInner = makeClass( + { + inherits: ShaMapNode, + ShaMapInner(depth = 0) { + ShaMapNode.call(this); + this.depth = depth; + this.slotBits = 0; + this.branches = Array(16); + }, + isInner() { + return true; + }, + isLeaf() { + return false; + }, + hashPrefix() { + return HashPrefix.innerNode; + }, + setBranch(slot, branch) { + this.slotBits = this.slotBits | (1 << slot); + this.branches[slot] = branch; + }, + empty() { + return this.slotBits === 0; + }, + hash() { + if (this.empty()) { + return coreTypes.Hash256.ZERO_256; + } + return $uper.hash.call(this); + }, + toBytesSink(sink) { + for (let i = 0; i < this.branches.length; i++) { + const branch = this.branches[i]; + const hash = branch ? branch.hash() : coreTypes.Hash256.ZERO_256; + hash.toBytesSink(sink); + } + }, + addItem(index, item, leaf) { + assert(index instanceof coreTypes.Hash256); + const nibble = index.nibblet(this.depth); + const existing = this.branches[nibble]; + if (!existing) { + this.setBranch(nibble, leaf || new ShaMapLeaf(index, item)); + } else if (existing.isLeaf()) { + const newInner = new ShaMapInner(this.depth + 1); + newInner.addItem(existing.index, null, existing); + newInner.addItem(index, item, leaf); + this.setBranch(nibble, newInner); + } else if (existing.isInner()) { + existing.addItem(index, item, leaf); + } else { + assert(false); + } + }, }, - isInner() { - return true; - }, - isLeaf() { - return false; - }, - hashPrefix() { - return HashPrefix.innerNode; - }, - setBranch(slot, branch) { - this.slotBits = this.slotBits | (1 << slot); - this.branches[slot] = branch; - }, - empty() { - return this.slotBits === 0; - }, - hash() { - if (this.empty()) { - return coreTypes.Hash256.ZERO_256; - } - return $uper.hash.call(this); - }, - toBytesSink(sink) { - for (let i = 0; i < this.branches.length; i++) { - const branch = this.branches[i]; - const hash = branch ? branch.hash() : coreTypes.Hash256.ZERO_256; - hash.toBytesSink(sink); - } - }, - addItem(index, item, leaf) { - assert(index instanceof coreTypes.Hash256); - const nibble = index.nibblet(this.depth); - const existing = this.branches[nibble]; - if (!existing) { - this.setBranch(nibble, leaf || new ShaMapLeaf(index, item)); - } else if (existing.isLeaf()) { - const newInner = new ShaMapInner(this.depth + 1); - newInner.addItem(existing.index, null, existing); - newInner.addItem(index, item, leaf); - this.setBranch(nibble, newInner); - } else if (existing.isInner()) { - existing.addItem(index, item, leaf); - } else { - assert(false); - } - } -}, undefined); + undefined +); -const ShaMap = makeClass({ - inherits: ShaMapInner -}, undefined); +const ShaMap = makeClass( + { + inherits: ShaMapInner, + }, + undefined +); -export { - ShaMap -}; +export { ShaMap }; diff --git a/packages/ripple-binary-codec/src/types/account-id.ts b/packages/ripple-binary-codec/src/types/account-id.ts index 9116fea5..58d57688 100644 --- a/packages/ripple-binary-codec/src/types/account-id.ts +++ b/packages/ripple-binary-codec/src/types/account-id.ts @@ -1,42 +1,45 @@ -import { makeClass } from '../utils/make-class' -const { decodeAccountID, encodeAccountID } = require('ripple-address-codec') -const { Hash160 } = require('./hash-160') +import { makeClass } from "../utils/make-class"; +const { decodeAccountID, encodeAccountID } = require("ripple-address-codec"); +const { Hash160 } = require("./hash-160"); -const AccountID = makeClass({ - AccountID (bytes) { - Hash160.call(this, bytes) - }, - inherits: Hash160, - statics: { - from (value) { - return value instanceof this ? value - : /^r/.test(value) ? this.fromBase58(value) - : new this(value) +const AccountID = makeClass( + { + AccountID(bytes) { + Hash160.call(this, bytes); }, - cache: {}, - fromCache (base58) { - let cached = this.cache[base58] - if (!cached) { - cached = this.cache[base58] = this.fromBase58(base58) - } - return cached + inherits: Hash160, + statics: { + from(value) { + return value instanceof this + ? value + : /^r/.test(value) + ? this.fromBase58(value) + : new this(value); + }, + cache: {}, + fromCache(base58) { + let cached = this.cache[base58]; + if (!cached) { + cached = this.cache[base58] = this.fromBase58(base58); + } + return cached; + }, + fromBase58(value) { + const acc = new this(decodeAccountID(value)); + acc._toBase58 = value; + return acc; + }, + }, + toJSON() { + return this.toBase58(); + }, + cached: { + toBase58() { + return encodeAccountID(this._bytes); + }, }, - fromBase58 (value) { - const acc = new this(decodeAccountID(value)) - acc._toBase58 = value - return acc - } }, - toJSON () { - return this.toBase58() - }, - cached: { - toBase58 () { - return encodeAccountID(this._bytes) - } - } -}, undefined) + undefined +); -export { - AccountID -} +export { AccountID }; diff --git a/packages/ripple-binary-codec/src/types/amount.ts b/packages/ripple-binary-codec/src/types/amount.ts index c43ed3c0..a330f2b4 100644 --- a/packages/ripple-binary-codec/src/types/amount.ts +++ b/packages/ripple-binary-codec/src/types/amount.ts @@ -1,31 +1,31 @@ -import { makeClass } from '../utils/make-class' -const _ = require('lodash') -const assert = require('assert') -const BN = require('bn.js') -const Decimal = require('decimal.js') -const { SerializedType } = require('./serialized-type') -const { bytesToHex } = require('../utils/bytes-utils') -const { Currency } = require('./currency') -const { AccountID } = require('./account-id') -const { UInt64 } = require('./uint-64') +import { makeClass } from "../utils/make-class"; +const _ = require("lodash"); +const assert = require("assert"); +const BN = require("bn.js"); +const Decimal = require("decimal.js"); +const { SerializedType } = require("./serialized-type"); +const { bytesToHex } = require("../utils/bytes-utils"); +const { Currency } = require("./currency"); +const { AccountID } = require("./account-id"); +const { UInt64 } = require("./uint-64"); -const MIN_IOU_EXPONENT = -96 -const MAX_IOU_EXPONENT = 80 -const MAX_IOU_PRECISION = 16 -const MIN_IOU_MANTISSA = '1000' + '0000' + '0000' + '0000' // 16 digits -const MAX_IOU_MANTISSA = '9999' + '9999' + '9999' + '9999' // .. -const MAX_IOU = new Decimal(`${MAX_IOU_MANTISSA}e${MAX_IOU_EXPONENT}`) -const MIN_IOU = new Decimal(`${MIN_IOU_MANTISSA}e${MIN_IOU_EXPONENT}`) -const DROPS_PER_XRP = new Decimal('1e6') -const MAX_NETWORK_DROPS = new Decimal('1e17') -const MIN_XRP = new Decimal('1e-6') -const MAX_XRP = MAX_NETWORK_DROPS.dividedBy(DROPS_PER_XRP) +const MIN_IOU_EXPONENT = -96; +const MAX_IOU_EXPONENT = 80; +const MAX_IOU_PRECISION = 16; +const MIN_IOU_MANTISSA = "1000" + "0000" + "0000" + "0000"; // 16 digits +const MAX_IOU_MANTISSA = "9999" + "9999" + "9999" + "9999"; // .. +const MAX_IOU = new Decimal(`${MAX_IOU_MANTISSA}e${MAX_IOU_EXPONENT}`); +const MIN_IOU = new Decimal(`${MIN_IOU_MANTISSA}e${MIN_IOU_EXPONENT}`); +const DROPS_PER_XRP = new Decimal("1e6"); +const MAX_NETWORK_DROPS = new Decimal("1e17"); +const MIN_XRP = new Decimal("1e-6"); +const MAX_XRP = MAX_NETWORK_DROPS.dividedBy(DROPS_PER_XRP); // Never use exponential form Decimal.config({ toExpPos: MAX_IOU_EXPONENT + MAX_IOU_PRECISION, - toExpNeg: MIN_IOU_EXPONENT - MAX_IOU_PRECISION -}) + toExpNeg: MIN_IOU_EXPONENT - MAX_IOU_PRECISION, +}); const AMOUNT_PARAMETERS_DESCRIPTION = ` Native values must be described in drops, a million of which equal one XRP. @@ -44,173 +44,183 @@ ${MAX_IOU.toString()} And the smallest: ${MIN_IOU.toString()} -` +`; -function isDefined (val) { - return !_.isUndefined(val) +function isDefined(val) { + return !_.isUndefined(val); } -function raiseIllegalAmountError (value) { - throw new Error(`${value.toString()} is an illegal amount\n` + - AMOUNT_PARAMETERS_DESCRIPTION) +function raiseIllegalAmountError(value) { + throw new Error( + `${value.toString()} is an illegal amount\n` + AMOUNT_PARAMETERS_DESCRIPTION + ); } const parsers = { - string (str) { + string(str) { // Using /^\d+$/ here fixes #31 if (!str.match(/^\d+$/)) { - raiseIllegalAmountError(str) + raiseIllegalAmountError(str); } - return [new Decimal(str).dividedBy(DROPS_PER_XRP), Currency.XRP] + return [new Decimal(str).dividedBy(DROPS_PER_XRP), Currency.XRP]; }, - object (object) { - assert(isDefined(object.currency), 'currency must be defined') - assert(isDefined(object.issuer), 'issuer must be defined') - return [new Decimal(object.value), + object(object) { + assert(isDefined(object.currency), "currency must be defined"); + assert(isDefined(object.issuer), "issuer must be defined"); + return [ + new Decimal(object.value), Currency.from(object.currency), - AccountID.from(object.issuer)] - } -} - -const Amount = makeClass({ - Amount (value, currency, issuer, validate = true) { - this.value = value || new Decimal('0') - this.currency = currency || Currency.XRP - this.issuer = issuer || null - if (validate) { - this.assertValueIsValid() - } + AccountID.from(object.issuer), + ]; }, - mixins: SerializedType, - statics: { - from (value) { - if (value instanceof this) { - return value +}; + +const Amount = makeClass( + { + Amount(value, currency, issuer, validate = true) { + this.value = value || new Decimal("0"); + this.currency = currency || Currency.XRP; + this.issuer = issuer || null; + if (validate) { + this.assertValueIsValid(); } - const parser = parsers[typeof value] - if (parser) { - return new this(...parser(value)) - } - throw new Error(`unsupported value: ${value}`) }, - fromParser (parser) { - const mantissa = parser.read(8) - const b1 = mantissa[0] - const b2 = mantissa[1] - - const isIOU = b1 & 0x80 - const isPositive = b1 & 0x40 - const sign = isPositive ? '' : '-' - - if (isIOU) { - mantissa[0] = 0 - const currency = parser.readType(Currency) - const issuer = parser.readType(AccountID) - const exponent = ((b1 & 0x3F) << 2) + ((b2 & 0xff) >> 6) - 97 - mantissa[1] &= 0x3F - // decimal.js won't accept e notation with hex - const value = new Decimal(`${sign}0x${bytesToHex(mantissa)}`) - .times('1e' + exponent) - return new this(value, currency, issuer, false) - } - - mantissa[0] &= 0x3F - const drops = new Decimal(`${sign}0x${bytesToHex(mantissa)}`) - const xrpValue = drops.dividedBy(DROPS_PER_XRP) - return new this(xrpValue, Currency.XRP, null, false) - } - }, - assertValueIsValid () { - // zero is always a valid amount value - if (!this.isZero()) { - if (this.isNative()) { - const abs = this.value.abs() - if (abs.lt(MIN_XRP) || abs.gt(MAX_XRP)) { - // value is in XRP scale, but show the value in canonical json form - raiseIllegalAmountError(this.value.times(DROPS_PER_XRP)) + mixins: SerializedType, + statics: { + from(value) { + if (value instanceof this) { + return value; } - this.verifyNoDecimal(this.value) // This is a secondary fix for #31 - } else { - const p = this.value.precision() - const e = this.exponent() - if (p > MAX_IOU_PRECISION || - e > MAX_IOU_EXPONENT || - e < MIN_IOU_EXPONENT) { - raiseIllegalAmountError(this.value) + const parser = parsers[typeof value]; + if (parser) { + return new this(...parser(value)); } - } - } - }, - isNative () { - return this.currency.isNative() - }, - mantissa () { - // This is a tertiary fix for #31 - const integerNumberString = this.verifyNoDecimal() + throw new Error(`unsupported value: ${value}`); + }, + fromParser(parser) { + const mantissa = parser.read(8); + const b1 = mantissa[0]; + const b2 = mantissa[1]; - return new UInt64( - new BN(integerNumberString)) - }, - verifyNoDecimal () { - const integerNumberString = this.value - .times('1e' + -this.exponent()).abs().toString() - // Ensure that the value (after being multiplied by the exponent) - // does not contain a decimal. From the bn.js README: - // "decimals are not supported in this library." - // eslint-disable-next-line max-len - // https://github.com/indutny/bn.js/blob/9cb459f044853b46615464eea1a3ddfc7006463b/README.md - if (integerNumberString.indexOf('.') !== -1) { - raiseIllegalAmountError(integerNumberString) - } - return integerNumberString - }, - isZero () { - return this.value.isZero() - }, - exponent () { - return this.isNative() ? -6 : this.value.e - 15 - }, - valueString () { - return (this.isNative() ? this.value.times(DROPS_PER_XRP) : this.value) - .toString() - }, - toBytesSink (sink) { - const isNative = this.isNative() - const notNegative = !this.value.isNegative() - const mantissa = this.mantissa().toBytes() + const isIOU = b1 & 0x80; + const isPositive = b1 & 0x40; + const sign = isPositive ? "" : "-"; - if (isNative) { - mantissa[0] |= notNegative ? 0x40 : 0 - sink.put(mantissa) - } else { - mantissa[0] |= 0x80 + if (isIOU) { + mantissa[0] = 0; + const currency = parser.readType(Currency); + const issuer = parser.readType(AccountID); + const exponent = ((b1 & 0x3f) << 2) + ((b2 & 0xff) >> 6) - 97; + mantissa[1] &= 0x3f; + // decimal.js won't accept e notation with hex + const value = new Decimal(`${sign}0x${bytesToHex(mantissa)}`).times( + "1e" + exponent + ); + return new this(value, currency, issuer, false); + } + + mantissa[0] &= 0x3f; + const drops = new Decimal(`${sign}0x${bytesToHex(mantissa)}`); + const xrpValue = drops.dividedBy(DROPS_PER_XRP); + return new this(xrpValue, Currency.XRP, null, false); + }, + }, + assertValueIsValid() { + // zero is always a valid amount value if (!this.isZero()) { - if (notNegative) { - mantissa[0] |= 0x40 + if (this.isNative()) { + const abs = this.value.abs(); + if (abs.lt(MIN_XRP) || abs.gt(MAX_XRP)) { + // value is in XRP scale, but show the value in canonical json form + raiseIllegalAmountError(this.value.times(DROPS_PER_XRP)); + } + this.verifyNoDecimal(this.value); // This is a secondary fix for #31 + } else { + const p = this.value.precision(); + const e = this.exponent(); + if ( + p > MAX_IOU_PRECISION || + e > MAX_IOU_EXPONENT || + e < MIN_IOU_EXPONENT + ) { + raiseIllegalAmountError(this.value); + } } - const exponent = this.value.e - 15 - const exponentByte = 97 + exponent - mantissa[0] |= (exponentByte >>> 2) - mantissa[1] |= (exponentByte & 0x03) << 6 } - sink.put(mantissa) - this.currency.toBytesSink(sink) - this.issuer.toBytesSink(sink) - } - }, - toJSON () { - const valueString = this.valueString() - if (this.isNative()) { - return valueString - } - return { - value: valueString, - currency: this.currency.toJSON(), - issuer: this.issuer.toJSON() - } - } -}, undefined) + }, + isNative() { + return this.currency.isNative(); + }, + mantissa() { + // This is a tertiary fix for #31 + const integerNumberString = this.verifyNoDecimal(); -export { - Amount -} + return new UInt64(new BN(integerNumberString)); + }, + verifyNoDecimal() { + const integerNumberString = this.value + .times("1e" + -this.exponent()) + .abs() + .toString(); + // Ensure that the value (after being multiplied by the exponent) + // does not contain a decimal. From the bn.js README: + // "decimals are not supported in this library." + // eslint-disable-next-line max-len + // https://github.com/indutny/bn.js/blob/9cb459f044853b46615464eea1a3ddfc7006463b/README.md + if (integerNumberString.indexOf(".") !== -1) { + raiseIllegalAmountError(integerNumberString); + } + return integerNumberString; + }, + isZero() { + return this.value.isZero(); + }, + exponent() { + return this.isNative() ? -6 : this.value.e - 15; + }, + valueString() { + return (this.isNative() + ? this.value.times(DROPS_PER_XRP) + : this.value + ).toString(); + }, + toBytesSink(sink) { + const isNative = this.isNative(); + const notNegative = !this.value.isNegative(); + const mantissa = this.mantissa().toBytes(); + + if (isNative) { + mantissa[0] |= notNegative ? 0x40 : 0; + sink.put(mantissa); + } else { + mantissa[0] |= 0x80; + if (!this.isZero()) { + if (notNegative) { + mantissa[0] |= 0x40; + } + const exponent = this.value.e - 15; + const exponentByte = 97 + exponent; + mantissa[0] |= exponentByte >>> 2; + mantissa[1] |= (exponentByte & 0x03) << 6; + } + sink.put(mantissa); + this.currency.toBytesSink(sink); + this.issuer.toBytesSink(sink); + } + }, + toJSON() { + const valueString = this.valueString(); + if (this.isNative()) { + return valueString; + } + return { + value: valueString, + currency: this.currency.toJSON(), + issuer: this.issuer.toJSON(), + }; + }, + }, + undefined +); + +export { Amount }; diff --git a/packages/ripple-binary-codec/src/types/blob.ts b/packages/ripple-binary-codec/src/types/blob.ts index 2089db04..08b99c97 100644 --- a/packages/ripple-binary-codec/src/types/blob.ts +++ b/packages/ripple-binary-codec/src/types/blob.ts @@ -1,29 +1,30 @@ -import { makeClass } from '../utils/make-class' -import { parseBytes } from '../utils/bytes-utils' -import { SerializedType } from './serialized-type' +import { makeClass } from "../utils/make-class"; +import { parseBytes } from "../utils/bytes-utils"; +import { SerializedType } from "./serialized-type"; -const Blob = makeClass({ - mixins: SerializedType, - Blob (bytes) { - if (bytes) { - this._bytes = parseBytes(bytes, Uint8Array) - } else { - this._bytes = new Uint8Array(0) - } - }, - statics: { - fromParser (parser, hint) { - return new this(parser.read(hint)) - }, - from (value) { - if (value instanceof this) { - return value +const Blob = makeClass( + { + mixins: SerializedType, + Blob(bytes) { + if (bytes) { + this._bytes = parseBytes(bytes, Uint8Array); + } else { + this._bytes = new Uint8Array(0); } - return new this(value) - } - } -}, undefined) + }, + statics: { + fromParser(parser, hint) { + return new this(parser.read(hint)); + }, + from(value) { + if (value instanceof this) { + return value; + } + return new this(value); + }, + }, + }, + undefined +); -export { - Blob -} +export { Blob }; diff --git a/packages/ripple-binary-codec/src/types/currency.ts b/packages/ripple-binary-codec/src/types/currency.ts index d03c2490..c0ac3183 100644 --- a/packages/ripple-binary-codec/src/types/currency.ts +++ b/packages/ripple-binary-codec/src/types/currency.ts @@ -1,92 +1,93 @@ -import { makeClass } from '../utils/make-class' -const _ = require('lodash') -const { slice } = require('../utils/bytes-utils') -const { Hash160 } = require('./hash-160') -const ISO_REGEX = /^[A-Z0-9]{3}$/ -const HEX_REGEX = /^[A-F0-9]{40}$/ +import { makeClass } from "../utils/make-class"; +const _ = require("lodash"); +const { slice } = require("../utils/bytes-utils"); +const { Hash160 } = require("./hash-160"); +const ISO_REGEX = /^[A-Z0-9]{3}$/; +const HEX_REGEX = /^[A-F0-9]{40}$/; -function isoToBytes (iso) { - const bytes = new Uint8Array(20) - if (iso !== 'XRP') { - const isoBytes = iso.split('').map(c => c.charCodeAt(0)) - bytes.set(isoBytes, 12) +function isoToBytes(iso) { + const bytes = new Uint8Array(20); + if (iso !== "XRP") { + const isoBytes = iso.split("").map((c) => c.charCodeAt(0)); + bytes.set(isoBytes, 12); } - return bytes + return bytes; } -function isISOCode (val) { - return val.length === 3 // ISO_REGEX.test(val); +function isISOCode(val) { + return val.length === 3; // ISO_REGEX.test(val); } -function isHex (val) { - return HEX_REGEX.test(val) +function isHex(val) { + return HEX_REGEX.test(val); } -function isStringRepr (val) { - return _.isString(val) && (isISOCode(val) || isHex(val)) +function isStringRepr(val) { + return _.isString(val) && (isISOCode(val) || isHex(val)); } -function isBytesArray (val) { - return val.length === 20 +function isBytesArray(val) { + return val.length === 20; } -function isValidRepr (val) { - return isStringRepr(val) || isBytesArray(val) +function isValidRepr(val) { + return isStringRepr(val) || isBytesArray(val); } -function bytesFromRepr (val) { +function bytesFromRepr(val) { if (isValidRepr(val)) { // We assume at this point that we have an object with a length, either 3, // 20 or 40. - return val.length === 3 ? isoToBytes(val) : val + return val.length === 3 ? isoToBytes(val) : val; } - throw new Error(`Unsupported Currency repr: ${val}`) + throw new Error(`Unsupported Currency repr: ${val}`); } -const $uper = Hash160.prototype -const Currency = makeClass({ - inherits: Hash160, - getters: ['isNative', 'iso'], - statics: { - init () { - this.XRP = new this(new Uint8Array(20)) +const $uper = Hash160.prototype; +const Currency = makeClass( + { + inherits: Hash160, + getters: ["isNative", "iso"], + statics: { + init() { + this.XRP = new this(new Uint8Array(20)); + }, + from(val) { + return val instanceof this ? val : new this(bytesFromRepr(val)); + }, }, - from (val) { - return val instanceof this ? val : new this(bytesFromRepr(val)) - } - }, - Currency (bytes) { - Hash160.call(this, bytes) - this.classify() - }, - classify () { - // We only have a non null iso() property available if the currency can be - // losslessly represented by the 3 letter iso code. If none is available a - // hex encoding of the full 20 bytes is the canonical representation. - let onlyISO = true + Currency(bytes) { + Hash160.call(this, bytes); + this.classify(); + }, + classify() { + // We only have a non null iso() property available if the currency can be + // losslessly represented by the 3 letter iso code. If none is available a + // hex encoding of the full 20 bytes is the canonical representation. + let onlyISO = true; - const bytes = this._bytes - const code = slice(this._bytes, 12, 15, Array) - const iso = code.map(c => String.fromCharCode(c)).join('') + const bytes = this._bytes; + const code = slice(this._bytes, 12, 15, Array); + const iso = code.map((c) => String.fromCharCode(c)).join(""); - for (let i = bytes.length - 1; i >= 0; i--) { - if (bytes[i] !== 0 && !(i === 12 || i === 13 || i === 14)) { - onlyISO = false - break + for (let i = bytes.length - 1; i >= 0; i--) { + if (bytes[i] !== 0 && !(i === 12 || i === 13 || i === 14)) { + onlyISO = false; + break; + } } - } - const lossLessISO = onlyISO && iso !== 'XRP' && ISO_REGEX.test(iso) - this._isNative = onlyISO && _.isEqual(code, [0, 0, 0]) - this._iso = this._isNative ? 'XRP' : lossLessISO ? iso : null + const lossLessISO = onlyISO && iso !== "XRP" && ISO_REGEX.test(iso); + this._isNative = onlyISO && _.isEqual(code, [0, 0, 0]); + this._iso = this._isNative ? "XRP" : lossLessISO ? iso : null; + }, + toJSON() { + if (this.iso()) { + return this.iso(); + } + return $uper.toJSON.call(this); + }, }, - toJSON () { - if (this.iso()) { - return this.iso() - } - return $uper.toJSON.call(this) - } -}, undefined) + undefined +); -export { - Currency -} +export { Currency }; diff --git a/packages/ripple-binary-codec/src/types/hash-128.ts b/packages/ripple-binary-codec/src/types/hash-128.ts index 7d426c34..cb68841d 100644 --- a/packages/ripple-binary-codec/src/types/hash-128.ts +++ b/packages/ripple-binary-codec/src/types/hash-128.ts @@ -1,11 +1,12 @@ -import { makeClass } from '../utils/make-class' -import { Hash } from './hash' +import { makeClass } from "../utils/make-class"; +import { Hash } from "./hash"; -const Hash128 = makeClass({ - inherits: Hash, - statics: { width: 16 } -}, undefined) +const Hash128 = makeClass( + { + inherits: Hash, + statics: { width: 16 }, + }, + undefined +); -export { - Hash128 -} +export { Hash128 }; diff --git a/packages/ripple-binary-codec/src/types/hash-160.ts b/packages/ripple-binary-codec/src/types/hash-160.ts index 9540c182..96fede82 100644 --- a/packages/ripple-binary-codec/src/types/hash-160.ts +++ b/packages/ripple-binary-codec/src/types/hash-160.ts @@ -1,11 +1,12 @@ -import { makeClass } from '../utils/make-class' -const { Hash } = require('./hash') +import { makeClass } from "../utils/make-class"; +const { Hash } = require("./hash"); -const Hash160 = makeClass({ - inherits: Hash, - statics: { width: 20 } -}, undefined) +const Hash160 = makeClass( + { + inherits: Hash, + statics: { width: 20 }, + }, + undefined +); -export { - Hash160 -} +export { Hash160 }; diff --git a/packages/ripple-binary-codec/src/types/hash-256.ts b/packages/ripple-binary-codec/src/types/hash-256.ts index 6152ecdb..abcfda8c 100644 --- a/packages/ripple-binary-codec/src/types/hash-256.ts +++ b/packages/ripple-binary-codec/src/types/hash-256.ts @@ -1,16 +1,17 @@ -import { makeClass } from '../utils/make-class' -import { Hash } from './hash' +import { makeClass } from "../utils/make-class"; +import { Hash } from "./hash"; -const Hash256 = makeClass({ - inherits: Hash, - statics: { - width: 32, - init () { - this.ZERO_256 = new this(new Uint8Array(this.width)) - } - } -}, undefined) +const Hash256 = makeClass( + { + inherits: Hash, + statics: { + width: 32, + init() { + this.ZERO_256 = new this(new Uint8Array(this.width)); + }, + }, + }, + undefined +); -export { - Hash256 -} +export { Hash256 }; diff --git a/packages/ripple-binary-codec/src/types/hash.ts b/packages/ripple-binary-codec/src/types/hash.ts index 95dc71a2..f08b6309 100644 --- a/packages/ripple-binary-codec/src/types/hash.ts +++ b/packages/ripple-binary-codec/src/types/hash.ts @@ -1,46 +1,48 @@ -import * as assert from 'assert' -import { makeClass } from '../utils/make-class' -import { Comparable, SerializedType } from './serialized-type' -import { compareBytes, parseBytes } from '../utils/bytes-utils' +import * as assert from "assert"; +import { makeClass } from "../utils/make-class"; +import { Comparable, SerializedType } from "./serialized-type"; +import { compareBytes, parseBytes } from "../utils/bytes-utils"; -const Hash = makeClass({ - Hash (bytes) { - const width = this.constructor.width - this._bytes = bytes ? parseBytes(bytes, Uint8Array) - : new Uint8Array(width) - assert.equal(this._bytes.length, width) - }, - mixins: [Comparable, SerializedType], - statics: { - width: NaN, - from (value) { - if (value instanceof this) { - return value - } - return new this(parseBytes(value)) +const Hash = makeClass( + { + Hash(bytes) { + const width = this.constructor.width; + this._bytes = bytes + ? parseBytes(bytes, Uint8Array) + : new Uint8Array(width); + assert.equal(this._bytes.length, width); + }, + mixins: [Comparable, SerializedType], + statics: { + width: NaN, + from(value) { + if (value instanceof this) { + return value; + } + return new this(parseBytes(value)); + }, + fromParser(parser, hint) { + return new this(parser.read(hint || this.width)); + }, + }, + compareTo(other) { + return compareBytes(this._bytes, this.constructor.from(other)._bytes); + }, + toString() { + return this.toHex(); + }, + nibblet(depth) { + const byteIx = depth > 0 ? (depth / 2) | 0 : 0; + let b = this._bytes[byteIx]; + if (depth % 2 === 0) { + b = (b & 0xf0) >>> 4; + } else { + b = b & 0x0f; + } + return b; }, - fromParser (parser, hint) { - return new this(parser.read(hint || this.width)) - } }, - compareTo (other) { - return compareBytes(this._bytes, this.constructor.from(other)._bytes) - }, - toString () { - return this.toHex() - }, - nibblet (depth) { - const byteIx = depth > 0 ? (depth / 2) | 0 : 0 - let b = this._bytes[byteIx] - if (depth % 2 === 0) { - b = (b & 0xF0) >>> 4 - } else { - b = b & 0x0F - } - return b - } -}, undefined) + undefined +); -export { - Hash -} +export { Hash }; diff --git a/packages/ripple-binary-codec/src/types/index.ts b/packages/ripple-binary-codec/src/types/index.ts index 0c732b76..e191346e 100644 --- a/packages/ripple-binary-codec/src/types/index.ts +++ b/packages/ripple-binary-codec/src/types/index.ts @@ -1,20 +1,20 @@ -import { Enums } from '../enums' -import { AccountID } from './account-id' -import { Amount } from './amount' -import { Blob } from './blob' -const Field = Enums.Field -const { Currency } = require('./currency') -const { Hash128 } = require('./hash-128') -const { Hash160 } = require('./hash-160') -const { Hash256 } = require('./hash-256') -const { PathSet } = require('./path-set') -const { STArray } = require('./st-array') -const { STObject } = require('./st-object') -const { UInt16 } = require('./uint-16') -const { UInt32 } = require('./uint-32') -const { UInt64 } = require('./uint-64') -const { UInt8 } = require('./uint-8') -const { Vector256 } = require('./vector-256') +import { Enums } from "../enums"; +import { AccountID } from "./account-id"; +import { Amount } from "./amount"; +import { Blob } from "./blob"; +const Field = Enums.Field; +const { Currency } = require("./currency"); +const { Hash128 } = require("./hash-128"); +const { Hash160 } = require("./hash-160"); +const { Hash256 } = require("./hash-256"); +const { PathSet } = require("./path-set"); +const { STArray } = require("./st-array"); +const { STObject } = require("./st-object"); +const { UInt16 } = require("./uint-16"); +const { UInt32 } = require("./uint-32"); +const { UInt64 } = require("./uint-64"); +const { UInt8 } = require("./uint-8"); +const { Vector256 } = require("./vector-256"); const coreTypes = { AccountID, @@ -31,15 +31,15 @@ const coreTypes = { UInt16, UInt32, UInt64, - Vector256 -} + Vector256, +}; -Field.values.forEach(field => { - field.associatedType = coreTypes[field.type] -}) +Field.values.forEach((field) => { + field.associatedType = coreTypes[field.type]; +}); -Field.TransactionType.associatedType = Enums.TransactionType -Field.TransactionResult.associatedType = Enums.TransactionResult -Field.LedgerEntryType.associatedType = Enums.LedgerEntryType +Field.TransactionType.associatedType = Enums.TransactionType; +Field.TransactionResult.associatedType = Enums.TransactionResult; +Field.LedgerEntryType.associatedType = Enums.LedgerEntryType; -export { coreTypes } +export { coreTypes }; diff --git a/packages/ripple-binary-codec/src/types/path-set.ts b/packages/ripple-binary-codec/src/types/path-set.ts index f455be95..de1bea04 100644 --- a/packages/ripple-binary-codec/src/types/path-set.ts +++ b/packages/ripple-binary-codec/src/types/path-set.ts @@ -1,113 +1,120 @@ /* eslint-disable no-unused-expressions */ -import { makeClass } from '../utils/make-class' -const { SerializedType, ensureArrayLikeIs } = require('./serialized-type') -const { Currency } = require('./currency') -const { AccountID } = require('./account-id') +import { makeClass } from "../utils/make-class"; +const { SerializedType, ensureArrayLikeIs } = require("./serialized-type"); +const { Currency } = require("./currency"); +const { AccountID } = require("./account-id"); -const PATHSET_END_BYTE = 0x00 -const PATH_SEPARATOR_BYTE = 0xFF -const TYPE_ACCOUNT = 0x01 -const TYPE_CURRENCY = 0x10 -const TYPE_ISSUER = 0x20 +const PATHSET_END_BYTE = 0x00; +const PATH_SEPARATOR_BYTE = 0xff; +const TYPE_ACCOUNT = 0x01; +const TYPE_CURRENCY = 0x10; +const TYPE_ISSUER = 0x20; -const Hop = makeClass({ - statics: { - from (value) { - if (value instanceof this) { - return value - } - const hop = new Hop() - value.issuer && (hop.issuer = AccountID.from(value.issuer)) - value.account && (hop.account = AccountID.from(value.account)) - value.currency && (hop.currency = Currency.from(value.currency)) - return hop +const Hop = makeClass( + { + statics: { + from(value) { + if (value instanceof this) { + return value; + } + const hop = new Hop(); + value.issuer && (hop.issuer = AccountID.from(value.issuer)); + value.account && (hop.account = AccountID.from(value.account)); + value.currency && (hop.currency = Currency.from(value.currency)); + return hop; + }, + parse(parser, type) { + const hop = new Hop(); + type & TYPE_ACCOUNT && (hop.account = AccountID.fromParser(parser)); + type & TYPE_CURRENCY && (hop.currency = Currency.fromParser(parser)); + type & TYPE_ISSUER && (hop.issuer = AccountID.fromParser(parser)); + return hop; + }, }, - parse (parser, type) { - const hop = new Hop(); - (type & TYPE_ACCOUNT) && (hop.account = AccountID.fromParser(parser)); - (type & TYPE_CURRENCY) && (hop.currency = Currency.fromParser(parser)); - (type & TYPE_ISSUER) && (hop.issuer = AccountID.fromParser(parser)) - return hop - } - }, - toJSON () { - const type = this.type() - const ret = {}; - (type & TYPE_ACCOUNT) && (ret.account = this.account.toJSON()); - (type & TYPE_ISSUER) && (ret.issuer = this.issuer.toJSON()); - (type & TYPE_CURRENCY) && (ret.currency = this.currency.toJSON()) - return ret - }, - type () { - let type = 0 - this.issuer && (type += TYPE_ISSUER) - this.account && (type += TYPE_ACCOUNT) - this.currency && (type += TYPE_CURRENCY) - return type - } -}, undefined) - -const Path = makeClass({ - inherits: Array, - statics: { - from (value) { - return ensureArrayLikeIs(Path, value).withChildren(Hop) - } - }, - toJSON () { - return this.map(k => k.toJSON()) - } -}, undefined) - -const PathSet = makeClass({ - mixins: SerializedType, - inherits: Array, - statics: { - from (value) { - return ensureArrayLikeIs(PathSet, value).withChildren(Path) + toJSON() { + const type = this.type(); + const ret = {}; + type & TYPE_ACCOUNT && (ret.account = this.account.toJSON()); + type & TYPE_ISSUER && (ret.issuer = this.issuer.toJSON()); + type & TYPE_CURRENCY && (ret.currency = this.currency.toJSON()); + return ret; + }, + type() { + let type = 0; + this.issuer && (type += TYPE_ISSUER); + this.account && (type += TYPE_ACCOUNT); + this.currency && (type += TYPE_CURRENCY); + return type; }, - fromParser (parser) { - const pathSet = new this() - let path - while (!parser.end()) { - const type = parser.readUInt8() - if (type === PATHSET_END_BYTE) { - break - } - if (type === PATH_SEPARATOR_BYTE) { - path = null - continue - } - if (!path) { - path = new Path() - pathSet.push(path) - } - path.push(Hop.parse(parser, type)) - } - return pathSet - } }, - toJSON () { - return this.map(k => k.toJSON()) - }, - toBytesSink (sink) { - let n = 0 - this.forEach(path => { - if (n++ !== 0) { - sink.put([PATH_SEPARATOR_BYTE]) - } - path.forEach(hop => { - sink.put([hop.type()]) - hop.account && (hop.account.toBytesSink(sink)) - hop.currency && (hop.currency.toBytesSink(sink)) - hop.issuer && (hop.issuer.toBytesSink(sink)) - }) - }) - sink.put([PATHSET_END_BYTE]) - } -}, undefined) + undefined +); -export { - PathSet -} +const Path = makeClass( + { + inherits: Array, + statics: { + from(value) { + return ensureArrayLikeIs(Path, value).withChildren(Hop); + }, + }, + toJSON() { + return this.map((k) => k.toJSON()); + }, + }, + undefined +); + +const PathSet = makeClass( + { + mixins: SerializedType, + inherits: Array, + statics: { + from(value) { + return ensureArrayLikeIs(PathSet, value).withChildren(Path); + }, + fromParser(parser) { + const pathSet = new this(); + let path; + while (!parser.end()) { + const type = parser.readUInt8(); + if (type === PATHSET_END_BYTE) { + break; + } + if (type === PATH_SEPARATOR_BYTE) { + path = null; + continue; + } + if (!path) { + path = new Path(); + pathSet.push(path); + } + path.push(Hop.parse(parser, type)); + } + return pathSet; + }, + }, + toJSON() { + return this.map((k) => k.toJSON()); + }, + toBytesSink(sink) { + let n = 0; + this.forEach((path) => { + if (n++ !== 0) { + sink.put([PATH_SEPARATOR_BYTE]); + } + path.forEach((hop) => { + sink.put([hop.type()]); + hop.account && hop.account.toBytesSink(sink); + hop.currency && hop.currency.toBytesSink(sink); + hop.issuer && hop.issuer.toBytesSink(sink); + }); + }); + sink.put([PATHSET_END_BYTE]); + }, + }, + undefined +); + +export { PathSet }; diff --git a/packages/ripple-binary-codec/src/types/serialized-type.ts b/packages/ripple-binary-codec/src/types/serialized-type.ts index 9d8b2474..ac7027bb 100644 --- a/packages/ripple-binary-codec/src/types/serialized-type.ts +++ b/packages/ripple-binary-codec/src/types/serialized-type.ts @@ -1,64 +1,60 @@ -import { BytesList } from '../serdes/binary-serializer' -const { bytesToHex, slice } = require('../utils/bytes-utils') +import { BytesList } from "../serdes/binary-serializer"; +const { bytesToHex, slice } = require("../utils/bytes-utils"); const Comparable = { - lt (other) { - return this.compareTo(other) < 0 + lt(other) { + return this.compareTo(other) < 0; }, - eq (other) { - return this.compareTo(other) === 0 + eq(other) { + return this.compareTo(other) === 0; }, - gt (other) { - return this.compareTo(other) > 0 + gt(other) { + return this.compareTo(other) > 0; }, - gte (other) { - return this.compareTo(other) > -1 + gte(other) { + return this.compareTo(other) > -1; }, - lte (other) { - return this.compareTo(other) < 1 - } -} + lte(other) { + return this.compareTo(other) < 1; + }, +}; const SerializedType = { - toBytesSink (sink) { - sink.put(this._bytes) + toBytesSink(sink) { + sink.put(this._bytes); }, - toHex () { - return bytesToHex(this.toBytes()) + toHex() { + return bytesToHex(this.toBytes()); }, - toBytes () { + toBytes() { if (this._bytes) { - return slice(this._bytes) + return slice(this._bytes); } - const bl = new BytesList() - this.toBytesSink(bl) - return bl.toBytes() + const bl = new BytesList(); + this.toBytesSink(bl); + return bl.toBytes(); }, - toJSON () { - return this.toHex() + toJSON() { + return this.toHex(); }, - toString () { - return this.toHex() - } -} + toString() { + return this.toHex(); + }, +}; -function ensureArrayLikeIs (Type, arrayLike) { +function ensureArrayLikeIs(Type, arrayLike) { return { - withChildren (Child) { + withChildren(Child) { if (arrayLike instanceof Type) { - return arrayLike + return arrayLike; } - const obj = new Type() + const obj = new Type(); for (let i = 0; i < arrayLike.length; i++) { - obj.push(Child.from(arrayLike[i])) + obj.push(Child.from(arrayLike[i])); } - return obj - } - } + return obj; + }, + }; } -export { - ensureArrayLikeIs, - SerializedType, - Comparable -} +export { ensureArrayLikeIs, SerializedType, Comparable }; diff --git a/packages/ripple-binary-codec/src/types/st-array.ts b/packages/ripple-binary-codec/src/types/st-array.ts index dd24030b..9f0393e3 100644 --- a/packages/ripple-binary-codec/src/types/st-array.ts +++ b/packages/ripple-binary-codec/src/types/st-array.ts @@ -1,38 +1,39 @@ -import { makeClass } from '../utils/make-class' -import { ensureArrayLikeIs, SerializedType } from './serialized-type' -import { Enums } from '../enums' -import { STObject } from './st-object' -const { ArrayEndMarker } = Enums.Field +import { makeClass } from "../utils/make-class"; +import { ensureArrayLikeIs, SerializedType } from "./serialized-type"; +import { Enums } from "../enums"; +import { STObject } from "./st-object"; +const { ArrayEndMarker } = Enums.Field; -const STArray = makeClass({ - mixins: SerializedType, - inherits: Array, - statics: { - fromParser (parser) { - const array = new STArray() - while (!parser.end()) { - const field = parser.readField() - if (field === ArrayEndMarker) { - break +const STArray = makeClass( + { + mixins: SerializedType, + inherits: Array, + statics: { + fromParser(parser) { + const array = new STArray(); + while (!parser.end()) { + const field = parser.readField(); + if (field === ArrayEndMarker) { + break; + } + const outer = new STObject(); + outer[field] = parser.readFieldValue(field); + array.push(outer); } - const outer = new STObject() - outer[field] = parser.readFieldValue(field) - array.push(outer) - } - return array + return array; + }, + from(value) { + return ensureArrayLikeIs(STArray, value).withChildren(STObject); + }, + }, + toJSON() { + return this.map((v) => v.toJSON()); + }, + toBytesSink(sink) { + this.forEach((so) => so.toBytesSink(sink)); }, - from (value) { - return ensureArrayLikeIs(STArray, value).withChildren(STObject) - } }, - toJSON () { - return this.map(v => v.toJSON()) - }, - toBytesSink (sink) { - this.forEach(so => so.toBytesSink(sink)) - } -}, undefined) + undefined +); -export { - STArray -} +export { STArray }; diff --git a/packages/ripple-binary-codec/src/types/st-object.ts b/packages/ripple-binary-codec/src/types/st-object.ts index 10eb321b..5dc1ebc2 100644 --- a/packages/ripple-binary-codec/src/types/st-object.ts +++ b/packages/ripple-binary-codec/src/types/st-object.ts @@ -1,66 +1,77 @@ -import { makeClass } from '../utils/make-class' -import { Enums } from '../enums' -const _ = require('lodash') -const { BinarySerializer } = require('../serdes/binary-serializer') -const { ObjectEndMarker } = Enums.Field -const { SerializedType } = require('./serialized-type') +import { makeClass } from "../utils/make-class"; +import { Enums } from "../enums"; +const _ = require("lodash"); +const { BinarySerializer } = require("../serdes/binary-serializer"); +const { ObjectEndMarker } = Enums.Field; +const { SerializedType } = require("./serialized-type"); -const STObject = makeClass({ - mixins: SerializedType, - statics: { - fromParser (parser, hint) { - const end = typeof hint === 'number' ? parser.pos() + hint : null - const so = new this() - while (!parser.end(end)) { - const field = parser.readField() - if (field === ObjectEndMarker) { - break - } - so[field] = parser.readFieldValue(field) - } - return so - }, - from (value) { - if (value instanceof this) { - return value - } - if (typeof value === 'object') { - return _.transform(value, (so, val, key) => { - const field = Enums.Field[key] - if (field) { - so[field] = field.associatedType.from(val) - } else { - so[key] = val +const STObject = makeClass( + { + mixins: SerializedType, + statics: { + fromParser(parser, hint) { + const end = typeof hint === "number" ? parser.pos() + hint : null; + const so = new this(); + while (!parser.end(end)) { + const field = parser.readField(); + if (field === ObjectEndMarker) { + break; } - }, new this()) - } - throw new Error(`${value} is unsupported`) - } + so[field] = parser.readFieldValue(field); + } + return so; + }, + from(value) { + if (value instanceof this) { + return value; + } + if (typeof value === "object") { + return _.transform( + value, + (so, val, key) => { + const field = Enums.Field[key]; + if (field) { + so[field] = field.associatedType.from(val); + } else { + so[key] = val; + } + }, + new this() + ); + } + throw new Error(`${value} is unsupported`); + }, + }, + fieldKeys() { + return Object.keys(this) + .map((k) => Enums.Field[k]) + .filter(Boolean); + }, + toJSON() { + // Otherwise seemingly result will have same prototype as `this` + const accumulator = {}; // of only `own` properties + return _.transform( + this, + (result, value, key) => { + result[key] = value && value.toJSON ? value.toJSON() : value; + }, + accumulator + ); + }, + toBytesSink(sink, filter = () => true) { + const serializer = new BinarySerializer(sink); + const fields = this.fieldKeys(); + const sorted = _.sortBy(fields, "ordinal"); + sorted.filter(filter).forEach((field) => { + const value = this[field]; + if (!field.isSerialized) { + return; + } + serializer.writeFieldAndValue(field, value); + }); + }, }, - fieldKeys () { - return Object.keys(this).map(k => Enums.Field[k]).filter(Boolean) - }, - toJSON () { - // Otherwise seemingly result will have same prototype as `this` - const accumulator = {} // of only `own` properties - return _.transform(this, (result, value, key) => { - result[key] = value && value.toJSON ? value.toJSON() : value - }, accumulator) - }, - toBytesSink (sink, filter = () => true) { - const serializer = new BinarySerializer(sink) - const fields = this.fieldKeys() - const sorted = _.sortBy(fields, 'ordinal') - sorted.filter(filter).forEach(field => { - const value = this[field] - if (!field.isSerialized) { - return - } - serializer.writeFieldAndValue(field, value) - }) - } -}, undefined) + undefined +); -export { - STObject -} +export { STObject }; diff --git a/packages/ripple-binary-codec/src/types/uint-16.ts b/packages/ripple-binary-codec/src/types/uint-16.ts index 07d0f47b..53cbe335 100644 --- a/packages/ripple-binary-codec/src/types/uint-16.ts +++ b/packages/ripple-binary-codec/src/types/uint-16.ts @@ -1,11 +1,12 @@ -import { makeClass } from '../utils/make-class' -import { UInt } from './uint' +import { makeClass } from "../utils/make-class"; +import { UInt } from "./uint"; -const UInt16 = makeClass({ - inherits: UInt, - statics: { width: 2 } -}, undefined) +const UInt16 = makeClass( + { + inherits: UInt, + statics: { width: 2 }, + }, + undefined +); -export { - UInt16 -} +export { UInt16 }; diff --git a/packages/ripple-binary-codec/src/types/uint-32.ts b/packages/ripple-binary-codec/src/types/uint-32.ts index 99e305de..b049984f 100644 --- a/packages/ripple-binary-codec/src/types/uint-32.ts +++ b/packages/ripple-binary-codec/src/types/uint-32.ts @@ -1,11 +1,12 @@ -import { makeClass } from '../utils/make-class' -import { UInt } from './uint' +import { makeClass } from "../utils/make-class"; +import { UInt } from "./uint"; -const UInt32 = makeClass({ - inherits: UInt, - statics: { width: 4 } -}, undefined) +const UInt32 = makeClass( + { + inherits: UInt, + statics: { width: 4 }, + }, + undefined +); -export { - UInt32 -} +export { UInt32 }; diff --git a/packages/ripple-binary-codec/src/types/uint-64.ts b/packages/ripple-binary-codec/src/types/uint-64.ts index 98c0cfcc..56e1aa64 100644 --- a/packages/ripple-binary-codec/src/types/uint-64.ts +++ b/packages/ripple-binary-codec/src/types/uint-64.ts @@ -1,49 +1,50 @@ -import { strict as assert } from 'assert' -import { BN } from 'bn.js' -import { makeClass } from '../utils/make-class' -import { bytesToHex, parseBytes, serializeUIntN } from '../utils/bytes-utils' -import { UInt } from './uint' +import { strict as assert } from "assert"; +import { BN } from "bn.js"; +import { makeClass } from "../utils/make-class"; +import { bytesToHex, parseBytes, serializeUIntN } from "../utils/bytes-utils"; +import { UInt } from "./uint"; -const HEX_REGEX = /^[A-F0-9]{16}$/ +const HEX_REGEX = /^[A-F0-9]{16}$/; -const UInt64 = makeClass({ - inherits: UInt, - statics: { width: 8 }, - UInt64 (arg : any = 0) { - const argType = typeof arg - if (argType === 'number') { - assert(arg >= 0) - this._bytes = new Uint8Array(8) - this._bytes.set(serializeUIntN(arg, 4), 4) - } else if (arg instanceof BN) { - this._bytes = parseBytes(arg.toArray('be', 8), Uint8Array) - this._toBN = arg - } else { - if (argType === 'string') { - if (!HEX_REGEX.test(arg)) { - throw new Error(`${arg} is not a valid UInt64 hex string`) +const UInt64 = makeClass( + { + inherits: UInt, + statics: { width: 8 }, + UInt64(arg: any = 0) { + const argType = typeof arg; + if (argType === "number") { + assert(arg >= 0); + this._bytes = new Uint8Array(8); + this._bytes.set(serializeUIntN(arg, 4), 4); + } else if (arg instanceof BN) { + this._bytes = parseBytes(arg.toArray("be", 8), Uint8Array); + this._toBN = arg; + } else { + if (argType === "string") { + if (!HEX_REGEX.test(arg)) { + throw new Error(`${arg} is not a valid UInt64 hex string`); + } } + this._bytes = parseBytes(arg, Uint8Array); } - this._bytes = parseBytes(arg, Uint8Array) - } - assert(this._bytes.length === 8) + assert(this._bytes.length === 8); + }, + toJSON() { + return bytesToHex(this._bytes); + }, + valueOf() { + return this.toBN(); + }, + cached: { + toBN() { + return new BN(this._bytes); + }, + }, + toBytes() { + return this._bytes; + }, }, - toJSON () { - return bytesToHex(this._bytes) - }, - valueOf () { - return this.toBN() - }, - cached: { - toBN () { - return new BN(this._bytes) - } - }, - toBytes () { - return this._bytes - } -}, undefined) + undefined +); -export { - UInt64 -} +export { UInt64 }; diff --git a/packages/ripple-binary-codec/src/types/uint-8.ts b/packages/ripple-binary-codec/src/types/uint-8.ts index 678b3199..765db285 100644 --- a/packages/ripple-binary-codec/src/types/uint-8.ts +++ b/packages/ripple-binary-codec/src/types/uint-8.ts @@ -1,11 +1,12 @@ -import { makeClass } from '../utils/make-class' -import { UInt } from './uint' +import { makeClass } from "../utils/make-class"; +import { UInt } from "./uint"; -const UInt8 = makeClass({ - inherits: UInt, - statics: { width: 1 } -}, undefined) +const UInt8 = makeClass( + { + inherits: UInt, + statics: { width: 1 }, + }, + undefined +); -export { - UInt8 -} +export { UInt8 }; diff --git a/packages/ripple-binary-codec/src/types/uint.ts b/packages/ripple-binary-codec/src/types/uint.ts index 98535a17..c91f2e57 100644 --- a/packages/ripple-binary-codec/src/types/uint.ts +++ b/packages/ripple-binary-codec/src/types/uint.ts @@ -1,61 +1,64 @@ -import { strict as assert } from 'assert' -import { BN } from 'bn.js' -import { makeClass } from '../utils/make-class' -const { Comparable, SerializedType } = require('./serialized-type') -const { serializeUIntN } = require('../utils/bytes-utils') -const MAX_VALUES = [0, 255, 65535, 16777215, 4294967295] +import { strict as assert } from "assert"; +import { BN } from "bn.js"; +import { makeClass } from "../utils/make-class"; +const { Comparable, SerializedType } = require("./serialized-type"); +const { serializeUIntN } = require("../utils/bytes-utils"); +const MAX_VALUES = [0, 255, 65535, 16777215, 4294967295]; -function signum (a, b) { - return a < b ? -1 : a === b ? 0 : 1 +function signum(a, b) { + return a < b ? -1 : a === b ? 0 : 1; } -const UInt = makeClass({ - mixins: [Comparable, SerializedType], - UInt (val = 0) { - const max = MAX_VALUES[this.constructor.width] - if (val < 0 || !(val <= max)) { - throw new Error(`${val} not in range 0 <= $val <= ${max}`) - } - this.val = val - }, - statics: { - width: 0, - fromParser (parser) { - const val = this.width > 4 ? parser.read(this.width) - : parser.readUIntN(this.width) - return new this(val) +const UInt = makeClass( + { + mixins: [Comparable, SerializedType], + UInt(val = 0) { + const max = MAX_VALUES[this.constructor.width]; + if (val < 0 || !(val <= max)) { + throw new Error(`${val} not in range 0 <= $val <= ${max}`); + } + this.val = val; + }, + statics: { + width: 0, + fromParser(parser) { + const val = + this.width > 4 + ? parser.read(this.width) + : parser.readUIntN(this.width); + return new this(val); + }, + from(val) { + return val instanceof this ? val : new this(val); + }, + }, + toJSON() { + return this.val; + }, + valueOf() { + return this.val; + }, + compareTo(other) { + const thisValue = this.valueOf(); + const otherValue = other.valueOf(); + if (thisValue instanceof BN) { + return otherValue instanceof BN + ? thisValue.cmp(otherValue) + : thisValue.cmpn(otherValue); + } else if (otherValue instanceof BN) { + return -other.compareTo(this); + } + assert(typeof otherValue === "number"); + return signum(thisValue, otherValue); + }, + toBytesSink(sink) { + sink.put(this.toBytes()); + }, + toBytes() { + return serializeUIntN(this.val, this.constructor.width); }, - from (val) { - return val instanceof this ? val : new this(val) - } }, - toJSON () { - return this.val - }, - valueOf () { - return this.val - }, - compareTo (other) { - const thisValue = this.valueOf() - const otherValue = other.valueOf() - if (thisValue instanceof BN) { - return otherValue instanceof BN - ? thisValue.cmp(otherValue) - : thisValue.cmpn(otherValue) - } else if (otherValue instanceof BN) { - return -other.compareTo(this) - } - assert(typeof otherValue === 'number') - return signum(thisValue, otherValue) - }, - toBytesSink (sink) { - sink.put(this.toBytes()) - }, - toBytes () { - return serializeUIntN(this.val, this.constructor.width) - } -}, undefined) + undefined +); -export { - UInt -} +export { UInt }; diff --git a/packages/ripple-binary-codec/src/types/vector-256.ts b/packages/ripple-binary-codec/src/types/vector-256.ts index e83cb351..3fbb4540 100644 --- a/packages/ripple-binary-codec/src/types/vector-256.ts +++ b/packages/ripple-binary-codec/src/types/vector-256.ts @@ -1,32 +1,33 @@ -import { makeClass } from '../utils/make-class' -const { Hash256 } = require('./hash-256') -const { ensureArrayLikeIs, SerializedType } = require('./serialized-type') +import { makeClass } from "../utils/make-class"; +const { Hash256 } = require("./hash-256"); +const { ensureArrayLikeIs, SerializedType } = require("./serialized-type"); -const Vector256 = makeClass({ - mixins: SerializedType, - inherits: Array, - statics: { - fromParser (parser, hint) { - const vector256 = new this() - const bytes = hint !== null ? hint : parser.size() - parser.pos() - const hashes = bytes / 32 - for (let i = 0; i < hashes; i++) { - vector256.push(Hash256.fromParser(parser)) - } - return vector256 +const Vector256 = makeClass( + { + mixins: SerializedType, + inherits: Array, + statics: { + fromParser(parser, hint) { + const vector256 = new this(); + const bytes = hint !== null ? hint : parser.size() - parser.pos(); + const hashes = bytes / 32; + for (let i = 0; i < hashes; i++) { + vector256.push(Hash256.fromParser(parser)); + } + return vector256; + }, + from(value) { + return ensureArrayLikeIs(Vector256, value).withChildren(Hash256); + }, + }, + toBytesSink(sink) { + this.forEach((h) => h.toBytesSink(sink)); + }, + toJSON() { + return this.map((hash) => hash.toJSON()); }, - from (value) { - return ensureArrayLikeIs(Vector256, value).withChildren(Hash256) - } }, - toBytesSink (sink) { - this.forEach(h => h.toBytesSink(sink)) - }, - toJSON () { - return this.map(hash => hash.toJSON()) - } -}, undefined) + undefined +); -export { - Vector256 -} +export { Vector256 }; diff --git a/packages/ripple-binary-codec/src/utils/bytes-utils.ts b/packages/ripple-binary-codec/src/utils/bytes-utils.ts index 30eec2d4..82d9efd1 100644 --- a/packages/ripple-binary-codec/src/utils/bytes-utils.ts +++ b/packages/ripple-binary-codec/src/utils/bytes-utils.ts @@ -1,113 +1,107 @@ -import { strict as assert } from 'assert' +import { strict as assert } from "assert"; -function signum (a, b) { - return a < b ? -1 : a === b ? 0 : 1 +function signum(a, b) { + return a < b ? -1 : a === b ? 0 : 1; } const hexLookup = (function () { - const res = {} - const reverse = res.reverse = new Array(256) + const res = {}; + const reverse = (res.reverse = new Array(256)); for (let i = 0; i < 16; i++) { - const char = i.toString(16).toUpperCase() - res[char] = i + const char = i.toString(16).toUpperCase(); + res[char] = i; for (let j = 0; j < 16; j++) { - const char2 = j.toString(16).toUpperCase() - const byte = (i << 4) + j - const byteHex = char + char2 - res[byteHex] = byte - reverse[byte] = byteHex + const char2 = j.toString(16).toUpperCase(); + const byte = (i << 4) + j; + const byteHex = char + char2; + res[byteHex] = byte; + reverse[byte] = byteHex; } } - return res -}()) + return res; +})(); -const reverseHexLookup = hexLookup.reverse +const reverseHexLookup = hexLookup.reverse; -function bytesToHex (sequence) { - const buf = Array(sequence.length) +function bytesToHex(sequence) { + const buf = Array(sequence.length); for (let i = sequence.length - 1; i >= 0; i--) { - buf[i] = reverseHexLookup[sequence[i]] + buf[i] = reverseHexLookup[sequence[i]]; } - return buf.join('') + return buf.join(""); } -function byteForHex (hex) { - const byte = hexLookup[hex] +function byteForHex(hex) { + const byte = hexLookup[hex]; if (byte === undefined) { - throw new Error(`\`${hex}\` is not a valid hex representation of a byte`) + throw new Error(`\`${hex}\` is not a valid hex representation of a byte`); } - return byte + return byte; } -function parseBytes (val, Output = Array) { +function parseBytes(val, Output = Array) { if (!val || val.length === undefined) { - throw new Error(`${val} is not a sequence`) + throw new Error(`${val} is not a sequence`); } - if (typeof val === 'string') { - const start = val.length % 2 - const res = new Output((val.length + start) / 2) + if (typeof val === "string") { + const start = val.length % 2; + const res = new Output((val.length + start) / 2); for (let i = val.length, to = res.length - 1; to >= start; i -= 2, to--) { - res[to] = byteForHex(val.slice(i - 2, i)) + res[to] = byteForHex(val.slice(i - 2, i)); } if (start === 1) { - res[0] = byteForHex(val[0]) + res[0] = byteForHex(val[0]); } - return res + return res; } else if (val instanceof Output) { - return val + return val; } else if (Output === Uint8Array) { - return new Output(val) + return new Output(val); } - const res = new Output(val.length) + const res = new Output(val.length); for (let i = val.length - 1; i >= 0; i--) { - res[i] = val[i] + res[i] = val[i]; } - return res + return res; } -function serializeUIntN (val, width) { - const newBytes = new Uint8Array(width) - const lastIx = width - 1 +function serializeUIntN(val, width) { + const newBytes = new Uint8Array(width); + const lastIx = width - 1; for (let i = 0; i < width; i++) { - newBytes[lastIx - i] = (val >>> (i * 8) & 0xff) + newBytes[lastIx - i] = (val >>> (i * 8)) & 0xff; } - return newBytes + return newBytes; } -function compareBytes (a, b) { - assert(a.length === b.length) +function compareBytes(a, b) { + assert(a.length === b.length); for (let i = 0; i < a.length; i++) { - const cmp = signum(a[i], b[i]) + const cmp = signum(a[i], b[i]); if (cmp !== 0) { - return cmp + return cmp; } } - return 0 + return 0; } -function slice (val, startIx = 0, endIx = val.length, Output = val.constructor) { +function slice(val, startIx = 0, endIx = val.length, Output = val.constructor) { /* eslint-disable no-param-reassign */ if (startIx < 0) { - startIx += val.length + startIx += val.length; } if (endIx < 0) { - endIx += val.length + endIx += val.length; } /* eslint-enable no-param-reassign */ - const len = endIx - startIx - const res = new Output(len) + const len = endIx - startIx; + const res = new Output(len); for (let i = endIx - 1; i >= startIx; i--) { - res[i - startIx] = val[i] + res[i - startIx] = val[i]; } - return res + return res; } -export { - parseBytes, - bytesToHex, - slice, - compareBytes, - serializeUIntN -} +export { parseBytes, bytesToHex, slice, compareBytes, serializeUIntN }; diff --git a/packages/ripple-binary-codec/src/utils/make-class.ts b/packages/ripple-binary-codec/src/utils/make-class.ts index 62ade8f2..272e056c 100644 --- a/packages/ripple-binary-codec/src/utils/make-class.ts +++ b/packages/ripple-binary-codec/src/utils/make-class.ts @@ -1,83 +1,85 @@ -import _ = require('lodash'); -const inherits = require('inherits') +import _ = require("lodash"); +const inherits = require("inherits"); -function forEach (obj, func) { - Object.keys(obj || {}).forEach(k => { - func(obj[k], k) - }) +function forEach(obj, func) { + Object.keys(obj || {}).forEach((k) => { + func(obj[k], k); + }); } -function ensureArray (val) { - return Array.isArray(val) ? val : [val] +function ensureArray(val) { + return Array.isArray(val) ? val : [val]; } -export function makeClass (klass_, definition_) { - const definition = definition_ || klass_ - let klass = typeof klass_ === 'function' ? klass_ : null +export function makeClass(klass_, definition_) { + const definition = definition_ || klass_; + let klass = typeof klass_ === "function" ? klass_ : null; if (klass === null) { for (const k in definition) { if (k[0].match(/[A-Z]/)) { - klass = definition[k] - break + klass = definition[k]; + break; } } } - const parent = definition.inherits + const parent = definition.inherits; if (parent) { if (klass === null) { klass = function () { - parent.apply(this, arguments) - } + parent.apply(this, arguments); + }; } - inherits(klass, parent) - _.defaults(klass, parent) + inherits(klass, parent); + _.defaults(klass, parent); } if (klass === null) { - klass = function () {} + klass = function () {}; } - const proto = klass.prototype - function addFunc (original, name, wrapper) { - proto[name] = wrapper || original + const proto = klass.prototype; + function addFunc(original, name, wrapper) { + proto[name] = wrapper || original; } - (definition.getters || []).forEach(k => { - const key = '_' + k + (definition.getters || []).forEach((k) => { + const key = "_" + k; proto[k] = function () { - return this[key] - } - }) + return this[key]; + }; + }); forEach(definition.virtuals, (f, n) => { addFunc(f, n, function () { - throw new Error('unimplemented') - }) - }) - forEach(definition.methods, addFunc) + throw new Error("unimplemented"); + }); + }); + forEach(definition.methods, addFunc); forEach(definition, (f, n) => { if (_.isFunction(f) && f !== klass) { - addFunc(f, n, undefined) + addFunc(f, n, undefined); } - }) - _.assign(klass, definition.statics) - if (typeof klass.init === 'function') { - klass.init() + }); + _.assign(klass, definition.statics); + if (typeof klass.init === "function") { + klass.init(); } forEach(definition.cached, (f, n) => { - const key = '_' + n + const key = "_" + n; addFunc(f, n, function () { - let value = this[key] + let value = this[key]; if (value === undefined) { - value = this[key] = f.call(this) + value = this[key] = f.call(this); } - return value - }) - }) + return value; + }); + }); if (definition.mixins) { - const mixins = {} + const mixins = {}; // Right-most in the list win - ensureArray(definition.mixins).reverse().forEach(o => { - _.defaults(mixins, o) - }) - _.defaults(proto, mixins) + ensureArray(definition.mixins) + .reverse() + .forEach((o) => { + _.defaults(mixins, o); + }); + _.defaults(proto, mixins); } - return klass -}; + return klass; +} diff --git a/packages/ripple-binary-codec/tsconfig.eslint.json b/packages/ripple-binary-codec/tsconfig.eslint.json new file mode 100644 index 00000000..38a070ef --- /dev/null +++ b/packages/ripple-binary-codec/tsconfig.eslint.json @@ -0,0 +1,7 @@ +// We need this file to run ESLint on our tests +// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/README.md#configuration +{ + // extend your base config so you don't have to redefine your compilerOptions + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"] + } \ No newline at end of file diff --git a/packages/ripple-binary-codec/yarn.lock b/packages/ripple-binary-codec/yarn.lock index 78dda707..97e41cf3 100644 --- a/packages/ripple-binary-codec/yarn.lock +++ b/packages/ripple-binary-codec/yarn.lock @@ -516,6 +516,11 @@ resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== +"@types/eslint-visitor-keys@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + "@types/graceful-fs@^4.1.2": version "4.1.3" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.3.tgz#039af35fe26bec35003e8d86d2ee9c586354348f" @@ -551,6 +556,16 @@ jest-diff "^25.2.1" pretty-format "^25.2.1" +"@types/json-schema@^7.0.3": + version "7.0.5" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd" + integrity sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ== + +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + "@types/lodash@^4.14.155": version "4.14.155" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.155.tgz#e2b4514f46a261fd11542e47519c20ebce7bc23a" @@ -588,6 +603,51 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@^3.2.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.4.0.tgz#8378062e6be8a1d049259bdbcf27ce5dfbeee62b" + integrity sha512-wfkpiqaEVhZIuQRmudDszc01jC/YR7gMSxa6ulhggAe/Hs0KVIuo9wzvFiDbG3JD5pRFQoqnf4m7REDsUvBnMQ== + dependencies: + "@typescript-eslint/experimental-utils" "3.4.0" + debug "^4.1.1" + functional-red-black-tree "^1.0.1" + regexpp "^3.0.0" + semver "^7.3.2" + tsutils "^3.17.1" + +"@typescript-eslint/experimental-utils@3.4.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.4.0.tgz#8a44dfc6fb7f1d071937b390fe27608ebda122b8" + integrity sha512-rHPOjL43lOH1Opte4+dhC0a/+ks+8gOBwxXnyrZ/K4OTAChpSjP76fbI8Cglj7V5GouwVAGaK+xVwzqTyE/TPw== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "3.4.0" + eslint-scope "^5.0.0" + eslint-utils "^2.0.0" + +"@typescript-eslint/parser@^3.2.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.4.0.tgz#fe52b68c5cb3bba3f5d875bd17adb70420d49d8d" + integrity sha512-ZUGI/de44L5x87uX5zM14UYcbn79HSXUR+kzcqU42gH0AgpdB/TjuJy3m4ezI7Q/jk3wTQd755mxSDLhQP79KA== + dependencies: + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "3.4.0" + "@typescript-eslint/typescript-estree" "3.4.0" + eslint-visitor-keys "^1.1.0" + +"@typescript-eslint/typescript-estree@3.4.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.4.0.tgz#6a787eb70b48969e4cd1ea67b057083f96dfee29" + integrity sha512-zKwLiybtt4uJb4mkG5q2t6+W7BuYx2IISiDNV+IY68VfoGwErDx/RfVI7SWL4gnZ2t1A1ytQQwZ+YOJbHHJ2rw== + dependencies: + debug "^4.1.1" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" + is-glob "^4.0.1" + lodash "^4.17.15" + semver "^7.3.2" + tsutils "^3.17.1" + abab@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" @@ -601,17 +661,22 @@ acorn-globals@^6.0.0: acorn "^7.1.1" acorn-walk "^7.1.1" +acorn-jsx@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" + integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== + acorn-walk@^7.1.1: version "7.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== -acorn@^7.1.1: +acorn@^7.1.1, acorn@^7.2.0: version "7.3.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.3.1.tgz#85010754db53c3fbaf3b9ea3e083aa5c5d147ffd" integrity sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA== -ajv@^6.5.5: +ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: version "6.12.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.2.tgz#c629c5eced17baf314437918d2da88c99d5958cd" integrity sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ== @@ -621,6 +686,11 @@ ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ansi-colors@^3.2.1: + version "3.2.4" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf" + integrity sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA== + ansi-escapes@^4.2.1: version "4.3.1" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" @@ -628,12 +698,17 @@ ansi-escapes@^4.2.1: dependencies: type-fest "^0.11.0" +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + ansi-regex@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== -ansi-styles@^3.2.1: +ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== @@ -686,11 +761,28 @@ arr-union@^3.1.0: resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= +array-includes@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.1.tgz#cdd67e6852bdf9c1215460786732255ed2459348" + integrity sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0" + is-string "^1.0.5" + array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= +array.prototype.flat@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz#0de82b426b0318dbfdb940089e38b043d37f6c7b" + integrity sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + asn1@~0.2.3: version "0.2.4" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" @@ -708,6 +800,11 @@ assign-symbols@^1.0.0: resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -1035,6 +1132,11 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= + convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" @@ -1074,7 +1176,7 @@ cross-spawn@^6.0.0: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.0: +cross-spawn@^7.0.0, cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -1116,14 +1218,14 @@ data-urls@^2.0.0: whatwg-mimetype "^2.3.0" whatwg-url "^8.0.0" -debug@^2.2.0, debug@^2.3.3: +debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" -debug@^4.1.0, debug@^4.1.1: +debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== @@ -1145,7 +1247,7 @@ decode-uri-component@^0.2.0: resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= -deep-is@~0.1.3: +deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= @@ -1155,6 +1257,13 @@ deepmerge@^4.2.2: resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== +define-properties@^1.1.2, define-properties@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" + define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" @@ -1197,6 +1306,21 @@ diff-sequences@^26.0.0: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.0.0.tgz#0760059a5c287637b842bd7085311db7060e88a6" integrity sha512-JC/eHYEC3aSS0vZGjuoc4vHA0yAQTzhQQldXMeMF+JlxLGJlCO38Gma82NV9gk1jGFz8mDzUMeaKXvjRRdJ2dg== +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + domexception@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-2.0.1.tgz#fb44aefba793e1574b0af6aed2801d057529f304" @@ -1212,6 +1336,11 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -1224,13 +1353,46 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" -error-ex@^1.3.1: +enquirer@^2.3.5: + version "2.3.5" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.5.tgz#3ab2b838df0a9d8ab9e7dff235b0e8712ef92381" + integrity sha512-BNT1C08P9XD0vNg3J475yIUG+mVdp9T6towYFHUv897X0KoHBjB1shyrNmhmtHWKP17iSWgo7Gqh7BBuzLZMSA== + dependencies: + ansi-colors "^3.2.1" + +error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: is-arrayish "^0.2.1" +es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.5: + version "1.17.6" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.6.tgz#9142071707857b2cacc7b89ecb670316c3e2d52a" + integrity sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw== + dependencies: + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + is-callable "^1.2.0" + is-regex "^1.1.0" + object-inspect "^1.7.0" + object-keys "^1.1.1" + object.assign "^4.1.0" + string.prototype.trimend "^1.0.1" + string.prototype.trimstart "^1.0.1" + +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1253,16 +1415,163 @@ escodegen@^1.14.1: optionalDependencies: source-map "~0.6.1" +eslint-config-prettier@^6.11.0: + version "6.11.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz#f6d2238c1290d01c859a8b5c1f7d352a0b0da8b1" + integrity sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA== + dependencies: + get-stdin "^6.0.0" + +eslint-import-resolver-node@^0.3.3: + version "0.3.4" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz#85ffa81942c25012d8231096ddf679c03042c717" + integrity sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA== + dependencies: + debug "^2.6.9" + resolve "^1.13.1" + +eslint-module-utils@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz#579ebd094f56af7797d19c9866c9c9486629bfa6" + integrity sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA== + dependencies: + debug "^2.6.9" + pkg-dir "^2.0.0" + +eslint-plugin-import@^2.21.1: + version "2.21.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.21.2.tgz#8fef77475cc5510801bedc95f84b932f7f334a7c" + integrity sha512-FEmxeGI6yaz+SnEB6YgNHlQK1Bs2DKLM+YF+vuTk5H8J9CLbJLtlPvRFgZZ2+sXiKAlN5dpdlrWOjK8ZoZJpQA== + dependencies: + array-includes "^3.1.1" + array.prototype.flat "^1.2.3" + contains-path "^0.1.0" + debug "^2.6.9" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.3" + eslint-module-utils "^2.6.0" + has "^1.0.3" + minimatch "^3.0.4" + object.values "^1.1.1" + read-pkg-up "^2.0.0" + resolve "^1.17.0" + tsconfig-paths "^3.9.0" + +eslint-plugin-mocha@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-mocha/-/eslint-plugin-mocha-7.0.1.tgz#b2e9e8ebef7836f999a83f8bab25d0e0c05f0d28" + integrity sha512-zkQRW9UigRaayGm/pK9TD5RjccKXSgQksNtpsXbG9b6L5I+jNx7m98VUbZ4w1H1ArlNA+K7IOH+z8TscN6sOYg== + dependencies: + eslint-utils "^2.0.0" + ramda "^0.27.0" + +eslint-plugin-prettier@^3.1.3: + version "3.1.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2" + integrity sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg== + dependencies: + prettier-linter-helpers "^1.0.0" + +eslint-scope@^5.0.0, eslint-scope@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5" + integrity sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" + integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== + dependencies: + eslint-visitor-keys "^1.1.0" + +eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" + integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== + +eslint@^7.2.0: + version "7.3.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.3.1.tgz#76392bd7e44468d046149ba128d1566c59acbe19" + integrity sha512-cQC/xj9bhWUcyi/RuMbRtC3I0eW8MH0jhRELSvpKYkWep3C6YZ2OkvcvJVUeO6gcunABmzptbXBuDoXsjHmfTA== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.0.1" + doctrine "^3.0.0" + enquirer "^2.3.5" + eslint-scope "^5.1.0" + eslint-utils "^2.0.0" + eslint-visitor-keys "^1.2.0" + espree "^7.1.0" + esquery "^1.2.0" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.0.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash "^4.17.14" + minimatch "^3.0.4" + natural-compare "^1.4.0" + optionator "^0.9.1" + progress "^2.0.0" + regexpp "^3.1.0" + semver "^7.2.1" + strip-ansi "^6.0.0" + strip-json-comments "^3.1.0" + table "^5.2.3" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +espree@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.1.0.tgz#a9c7f18a752056735bf1ba14cb1b70adc3a5ce1c" + integrity sha512-dcorZSyfmm4WTuTnE5Y7MEN1DyoPYy1ZR783QW1FJoenn7RailyWFsq/UL6ZAAA7uXurN9FIpYyUs3OfiIW+Qw== + dependencies: + acorn "^7.2.0" + acorn-jsx "^5.2.0" + eslint-visitor-keys "^1.2.0" + esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -estraverse@^4.2.0: +esquery@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" + integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== +estraverse@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.1.0.tgz#374309d39fd935ae500e7b92e8a6b4c720e59642" + integrity sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw== + esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -1380,12 +1689,17 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fast-levenshtein@~2.0.6: +fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= @@ -1397,6 +1711,13 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" + fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" @@ -1414,6 +1735,13 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +find-up@^2.0.0, find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= + dependencies: + locate-path "^2.0.0" + find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" @@ -1422,6 +1750,20 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== + dependencies: + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + +flatted@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" + integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== + for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -1458,6 +1800,16 @@ fsevents@^2.1.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + gensync@^1.0.0-beta.1: version "1.0.0-beta.1" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" @@ -1473,6 +1825,11 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + get-stream@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -1499,7 +1856,14 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob-parent@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" + integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== + dependencies: + is-glob "^4.0.1" + +glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -1516,7 +1880,14 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -graceful-fs@^4.2.4: +globals@^12.1.0: + version "12.4.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" + integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== + dependencies: + type-fest "^0.8.1" + +graceful-fs@^4.1.2, graceful-fs@^4.2.4: version "4.2.4" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== @@ -1549,6 +1920,11 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-symbols@^1.0.0, has-symbols@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" + integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== + has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" @@ -1580,6 +1956,13 @@ has-values@^1.0.0: is-number "^3.0.0" kind-of "^4.0.0" +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + hash-base@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" @@ -1627,6 +2010,19 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +import-fresh@^3.0.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" + integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + import-local@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.0.2.tgz#a8cfd0431d1de4a2199703d003e3e62364fa6db6" @@ -1682,6 +2078,11 @@ is-buffer@^1.1.5: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== +is-callable@^1.1.4, is-callable@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.0.tgz#83336560b54a38e35e3a2df7afd0454d691468bb" + integrity sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw== + is-ci@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" @@ -1703,6 +2104,11 @@ is-data-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" +is-date-object@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" + integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== + is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" @@ -1738,6 +2144,16 @@ is-extendable@^1.0.1: dependencies: is-plain-object "^2.0.4" +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -1748,6 +2164,13 @@ is-generator-fn@^2.0.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== +is-glob@^4.0.0, is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -1772,6 +2195,13 @@ is-potential-custom-element-name@^1.0.0: resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz#0c52e54bcca391bb2c494b21e8626d7336c6e397" integrity sha1-DFLlS8yjkbssSUsh6GJtczbG45c= +is-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.0.tgz#ece38e389e490df0dc21caea2bd596f987f767ff" + integrity sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw== + dependencies: + has-symbols "^1.0.1" + is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -1782,6 +2212,18 @@ is-stream@^2.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== +is-string@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" + integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== + +is-symbol@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" + integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== + dependencies: + has-symbols "^1.0.1" + is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -1799,7 +2241,7 @@ is-wsl@^2.1.1: dependencies: is-docker "^2.0.0" -isarray@1.0.0: +isarray@1.0.0, isarray@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= @@ -2312,11 +2754,23 @@ json-schema@0.2.3: resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= +json5@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" + integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + dependencies: + minimist "^1.2.0" + json5@^2.1.2: version "2.1.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43" @@ -2368,6 +2822,14 @@ leven@^3.1.0: resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -2381,6 +2843,24 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + locate-path@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" @@ -2393,7 +2873,7 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash@^4.17.13, lodash@^4.17.15: +lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -2502,6 +2982,13 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" +mkdirp@^0.5.1: + version "0.5.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== + dependencies: + minimist "^1.2.5" + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -2561,7 +3048,7 @@ node-notifier@^7.0.0: uuid "^7.0.3" which "^2.0.2" -normalize-package-data@^2.5.0: +normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== @@ -2616,6 +3103,16 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-inspect@^1.7.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.8.0.tgz#df807e5ecf53a609cc6bfe93eac3cc7be5b3a9d0" + integrity sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA== + +object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" @@ -2623,6 +3120,16 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" +object.assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" @@ -2630,6 +3137,16 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" +object.values@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.1.tgz#68a99ecde356b7e9295a3c5e0ce31dc8c953de5e" + integrity sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + function-bind "^1.1.1" + has "^1.0.3" + once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -2656,6 +3173,18 @@ optionator@^0.8.1: type-check "~0.3.2" word-wrap "~1.2.3" +optionator@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" + integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.3" + p-each-series@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-2.1.0.tgz#961c8dd3f195ea96c747e636b262b800a6b1af48" @@ -2666,6 +3195,13 @@ p-finally@^1.0.0: resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== + dependencies: + p-try "^1.0.0" + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -2673,6 +3209,13 @@ p-limit@^2.2.0: dependencies: p-try "^2.0.0" +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= + dependencies: + p-limit "^1.1.0" + p-locate@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" @@ -2680,11 +3223,30 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= + p-try@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= + dependencies: + error-ex "^1.2.0" + parse-json@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" @@ -2705,6 +3267,11 @@ pascalcase@^0.1.1: resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -2730,6 +3297,13 @@ path-parse@^1.0.6: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= + dependencies: + pify "^2.0.0" + performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -2740,6 +3314,11 @@ picomatch@^2.0.4, picomatch@^2.0.5: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= + pirates@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" @@ -2747,6 +3326,13 @@ pirates@^4.0.1: dependencies: node-modules-regexp "^1.0.0" +pkg-dir@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" + integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= + dependencies: + find-up "^2.1.0" + pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" @@ -2759,11 +3345,28 @@ posix-character-classes@^0.1.0: resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^2.0.4: + version "2.0.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" + integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== + pretty-format@^25.2.1, pretty-format@^25.5.0: version "25.5.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.5.0.tgz#7873c1d774f682c34b8d48b6743a2bf2ac55791a" @@ -2784,6 +3387,11 @@ pretty-format@^26.0.1: ansi-styles "^4.0.0" react-is "^16.12.0" +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + prompts@^2.0.1: version "2.3.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.3.2.tgz#480572d89ecf39566d2bd3fe2c9fccb7c4c0b068" @@ -2815,11 +3423,24 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== +ramda@^0.27.0: + version "0.27.0" + resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.0.tgz#915dc29865c0800bf3f69b8fd6c279898b59de43" + integrity sha512-pVzZdDpWwWqEVVLshWUHjNwuVP7SfcmPraYuqocJp1yo2U1R7P+5QAfDhdItkuoGqIBnBYrtPp7rEPqDn9HlZA== + react-is@^16.12.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + read-pkg-up@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" @@ -2829,6 +3450,15 @@ read-pkg-up@^7.0.1: read-pkg "^5.2.0" type-fest "^0.8.1" +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + read-pkg@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" @@ -2856,6 +3486,11 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" +regexpp@^3.0.0, regexpp@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" + integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== + remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" @@ -2930,6 +3565,11 @@ resolve-cwd@^3.0.0: dependencies: resolve-from "^5.0.0" +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + resolve-from@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" @@ -2940,7 +3580,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.10.0, resolve@^1.17.0, resolve@^1.3.2: +resolve@^1.10.0, resolve@^1.13.1, resolve@^1.17.0, resolve@^1.3.2: version "1.17.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== @@ -2952,6 +3592,13 @@ ret@~0.1.10: resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== +rimraf@2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + rimraf@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -3106,6 +3753,15 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" + is-fullwidth-code-point "^2.0.0" + snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" @@ -3256,6 +3912,15 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" +string-width@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + string-width@^4.1.0, string-width@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" @@ -3265,6 +3930,22 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string.prototype.trimend@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" + integrity sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" + +string.prototype.trimstart@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz#14af6d9f34b053f7cfc89b72f8f2ee14b9039a54" + integrity sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" + string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -3272,6 +3953,13 @@ string_decoder@^1.1.1: dependencies: safe-buffer "~5.2.0" +strip-ansi@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + strip-ansi@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" @@ -3279,6 +3967,11 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + strip-bom@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" @@ -3294,6 +3987,11 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== +strip-json-comments@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.0.tgz#7638d31422129ecf4457440009fba03f9f9ac180" + integrity sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w== + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -3321,6 +4019,16 @@ symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== +table@^5.2.3: + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== + dependencies: + ajv "^6.10.2" + lodash "^4.17.14" + slice-ansi "^2.1.0" + string-width "^3.0.0" + terminal-link@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" @@ -3338,6 +4046,11 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + throat@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" @@ -3409,6 +4122,28 @@ tr46@^2.0.2: dependencies: punycode "^2.1.1" +tsconfig-paths@^3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" + integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + +tslib@^1.8.1: + version "1.13.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" + integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== + +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + dependencies: + tslib "^1.8.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -3421,6 +4156,13 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -3510,6 +4252,11 @@ uuid@^7.0.3: resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== +v8-compile-cache@^2.0.3: + version "2.1.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" + integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ== + v8-to-istanbul@^4.1.3: version "4.1.4" resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-4.1.4.tgz#b97936f21c0e2d9996d4985e5c5156e9d4e49cd6" @@ -3607,7 +4354,7 @@ which@^2.0.1, which@^2.0.2: dependencies: isexe "^2.0.0" -word-wrap@~1.2.3: +word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== @@ -3636,6 +4383,13 @@ write-file-atomic@^3.0.0: signal-exit "^3.0.2" typedarray-to-buffer "^3.1.5" +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== + dependencies: + mkdirp "^0.5.1" + ws@^7.2.3: version "7.3.0" resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.0.tgz#4b2f7f219b3d3737bc1a2fbf145d825b94d38ffd"