From cb4e3d5d53a8db7491a398a36fbab6b34b6384e2 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 3 Jun 2021 17:18:36 +0200 Subject: [PATCH 001/112] implemented web3Api interface package type --- packages/cli/src/commands/create.ts | 3 +- packages/cli/src/lib/Compiler.ts | 118 +- packages/core-apis/api-resolver/.gitignore | 3 + packages/core-apis/api-resolver/.nvmrc | 1 + packages/core-apis/api-resolver/README.md | 13 + packages/core-apis/api-resolver/package.json | 18 + .../{schema.graphql => query.graphql} | 0 packages/core-apis/api-resolver/web3api.yaml | 4 +- packages/core-apis/api-resolver/yarn.lock | 3331 +++++++++++++++++ packages/js/client/src/wasm/WasmWeb3Api.ts | 6 + .../src/manifest/formats/0.0.1-prealpha.1.ts | 5 +- .../formats/0.0.1-prealpha.1.json | 9 +- .../interface/assemblyscript/.gitignore | 3 + .../templates/interface/assemblyscript/.nvmrc | 1 + .../interface/assemblyscript/README.md | 17 + .../interface/assemblyscript/package.json | 25 + .../assemblyscript/recipes/constants.json | 3 + .../interface/assemblyscript/recipes/e2e.json | 43 + .../assemblyscript/recipes/get.graphql | 8 + .../assemblyscript/recipes/set.graphql | 9 + .../assemblyscript/scripts/build-contract.js | 78 + .../assemblyscript/scripts/deploy-contract.js | 55 + .../src/contracts/SimpleStorage.json | 1 + .../src/contracts/SimpleStorage.sol | 27 + .../src/contracts/SimpleStorage.ts | 3 + .../assemblyscript/src/mutation/index.ts | 24 + .../src/mutation/schema.graphql | 13 + .../assemblyscript/src/query/index.ts | 15 + .../assemblyscript/src/query/schema.graphql | 8 + .../interface/assemblyscript/web3api.yaml | 16 + 30 files changed, 3802 insertions(+), 58 deletions(-) create mode 100644 packages/core-apis/api-resolver/.gitignore create mode 100644 packages/core-apis/api-resolver/.nvmrc create mode 100644 packages/core-apis/api-resolver/README.md create mode 100644 packages/core-apis/api-resolver/package.json rename packages/core-apis/api-resolver/{schema.graphql => query.graphql} (100%) create mode 100644 packages/core-apis/api-resolver/yarn.lock create mode 100644 packages/templates/interface/assemblyscript/.gitignore create mode 100644 packages/templates/interface/assemblyscript/.nvmrc create mode 100644 packages/templates/interface/assemblyscript/README.md create mode 100644 packages/templates/interface/assemblyscript/package.json create mode 100644 packages/templates/interface/assemblyscript/recipes/constants.json create mode 100644 packages/templates/interface/assemblyscript/recipes/e2e.json create mode 100644 packages/templates/interface/assemblyscript/recipes/get.graphql create mode 100644 packages/templates/interface/assemblyscript/recipes/set.graphql create mode 100644 packages/templates/interface/assemblyscript/scripts/build-contract.js create mode 100644 packages/templates/interface/assemblyscript/scripts/deploy-contract.js create mode 100644 packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.json create mode 100644 packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.sol create mode 100644 packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.ts create mode 100644 packages/templates/interface/assemblyscript/src/mutation/index.ts create mode 100644 packages/templates/interface/assemblyscript/src/mutation/schema.graphql create mode 100644 packages/templates/interface/assemblyscript/src/query/index.ts create mode 100644 packages/templates/interface/assemblyscript/src/query/schema.graphql create mode 100644 packages/templates/interface/assemblyscript/web3api.yaml diff --git a/packages/cli/src/commands/create.ts b/packages/cli/src/commands/create.ts index 79421f5837..8bb35ed5dc 100644 --- a/packages/cli/src/commands/create.ts +++ b/packages/cli/src/commands/create.ts @@ -16,6 +16,7 @@ const createPluginStr = intlMsg.commands_create_options_createPlugin(); const pathStr = intlMsg.commands_create_options_o_path(); export const supportedLangs: { [key: string]: string[] } = { + interface: ["assemblyscript"], api: ["assemblyscript"], app: ["react"], plugin: ["typescript"], @@ -149,7 +150,7 @@ export default { .then(() => { print.newline(); let readyMessage; - if (type === "api") { + if (type === "api" || type === "interface") { readyMessage = intlMsg.commands_create_readyProtocol(); } else if (type === "app") { readyMessage = intlMsg.commands_create_readyDapp(); diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index 6d85d4822e..ee4bc29204 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -67,6 +67,7 @@ export class Compiler { const buildModules = async () => { const buildQuery = !!manifest.query; const buildMutation = !!manifest.mutation; + const buildWasmModules = !manifest.interface; const throwMissingSchema = (moduleName: string) => { const missingSchemaMessage = intlMsg.lib_compiler_missingDefinition({ @@ -82,25 +83,7 @@ export class Compiler { if (buildMutation && !composed.mutation) { throwMissingSchema("mutation"); } - - const queryDirectory = manifest.query - ? this._getGenerationDirectory(manifest.query.module.file) - : undefined; - const mutationDirectory = manifest.mutation - ? this._getGenerationDirectory(manifest.mutation.module.file) - : undefined; - - if ( - queryDirectory && - mutationDirectory && - queryDirectory === mutationDirectory - ) { - throw Error( - `compileWeb3Api: Duplicate code generation folder found "${queryDirectory}".` + - `Please ensure each module file is located in a unique directory.` - ); - } - + if (buildQuery && !composed.query?.schema) { throw Error(`compileWeb3Api: Missing schema for the module "query"`); } @@ -111,44 +94,81 @@ export class Compiler { ); } - this._generateCode( - buildQuery - ? { - typeInfo: composed.query?.typeInfo as TypeInfo, - outputDirAbs: queryDirectory as string, - } - : undefined, - buildMutation - ? { - typeInfo: composed.mutation?.typeInfo as TypeInfo, - outputDirAbs: mutationDirectory as string, - } - : undefined - ); + if(buildWasmModules) { + + if (manifest.query && !manifest.query.module) { + throw Error(`compileWeb3Api: Missing module definition for the module "query"`); + } + + if (manifest.mutation && !manifest.mutation.module) { + throw Error(`compileWeb3Api: Missing module definition for the module "mutation"`); + } + + const queryDirectory = manifest.query + ? this._getGenerationDirectory(manifest.query.module!.file) + : undefined; + const mutationDirectory = manifest.mutation + ? this._getGenerationDirectory(manifest.mutation.module!.file) + : undefined; + + if ( + queryDirectory && + mutationDirectory && + queryDirectory === mutationDirectory + ) { + throw Error( + `compileWeb3Api: Duplicate code generation folder found "${queryDirectory}".` + + `Please ensure each module file is located in a unique directory.` + ); + } + + this._generateCode( + buildQuery + ? { + typeInfo: composed.query?.typeInfo as TypeInfo, + outputDirAbs: queryDirectory as string, + } + : undefined, + buildMutation + ? { + typeInfo: composed.mutation?.typeInfo as TypeInfo, + outputDirAbs: mutationDirectory as string, + } + : undefined + ); + } if (buildQuery) { const queryManifest = manifest as Required; - await this._compileWasmModule( - queryManifest.query.module.file, - "query", - outputDir, - spinner, - verbose - ); - queryManifest.query.module.file = `./query.wasm`; + + if(buildWasmModules) { + await this._compileWasmModule( + queryManifest.query.module!.file, + "query", + outputDir, + spinner, + verbose + ); + queryManifest.query.module!.file = `./query.wasm`; + } + queryManifest.query.schema.file = "./schema.graphql"; } if (buildMutation) { const mutationManifest = manifest as Required; - await this._compileWasmModule( - mutationManifest.mutation.module.file, - "mutation", - outputDir, - spinner, - verbose - ); - mutationManifest.mutation.module.file = `./mutation.wasm`; + + if(buildWasmModules) { + await this._compileWasmModule( + mutationManifest.mutation.module!.file, + "mutation", + outputDir, + spinner, + verbose + ); + mutationManifest.mutation.module!.file = `./mutation.wasm`; + } + mutationManifest.mutation.schema.file = "./schema.graphql"; } }; diff --git a/packages/core-apis/api-resolver/.gitignore b/packages/core-apis/api-resolver/.gitignore new file mode 100644 index 0000000000..1e8f0fdefe --- /dev/null +++ b/packages/core-apis/api-resolver/.gitignore @@ -0,0 +1,3 @@ +build +node_modules +w3 diff --git a/packages/core-apis/api-resolver/.nvmrc b/packages/core-apis/api-resolver/.nvmrc new file mode 100644 index 0000000000..158c00641a --- /dev/null +++ b/packages/core-apis/api-resolver/.nvmrc @@ -0,0 +1 @@ +v14.16.0 diff --git a/packages/core-apis/api-resolver/README.md b/packages/core-apis/api-resolver/README.md new file mode 100644 index 0000000000..7fe082d7a6 --- /dev/null +++ b/packages/core-apis/api-resolver/README.md @@ -0,0 +1,13 @@ +# Web3API Resolver Interface + +# How To Run + +## Install Dependencies +`nvm install && nvm use` +`yarn` + +## Start Test Environment +`yarn test:env:up` + +## Build & Deploy Web3API +`yarn deploy` \ No newline at end of file diff --git a/packages/core-apis/api-resolver/package.json b/packages/core-apis/api-resolver/package.json new file mode 100644 index 0000000000..b4f85f621f --- /dev/null +++ b/packages/core-apis/api-resolver/package.json @@ -0,0 +1,18 @@ +{ + "name": "resolver-interface", + "description": "Web3API Resolver Interface", + "private": true, + "version": "0.0.1-prealpha.24", + "scripts": { + "build": "yarn build:web3api", + "build:web3api": "npx w3 build", + "test:env:up": "npx w3 test-env up", + "test:env:down": "npx w3 test-env down", + "deploy": "yarn deploy:web3api", + "deploy:web3api": "npx w3 build --ipfs http://localhost:5001 --test-ens simplestorage.eth" + }, + "devDependencies": { + "@web3api/cli": "0.0.1-prealpha.24", + "js-yaml": "3.14.0" + } +} diff --git a/packages/core-apis/api-resolver/schema.graphql b/packages/core-apis/api-resolver/query.graphql similarity index 100% rename from packages/core-apis/api-resolver/schema.graphql rename to packages/core-apis/api-resolver/query.graphql diff --git a/packages/core-apis/api-resolver/web3api.yaml b/packages/core-apis/api-resolver/web3api.yaml index 1366a48216..ec036178b4 100644 --- a/packages/core-apis/api-resolver/web3api.yaml +++ b/packages/core-apis/api-resolver/web3api.yaml @@ -1,7 +1,7 @@ -description: Web3API Resolver Standard +description: Web3API Resolver Interface format: 0.0.1-prealpha.1 repository: https://github.com/web3-api/monorepo -abstract: true +interface: true query: schema: file: ./query.graphql diff --git a/packages/core-apis/api-resolver/yarn.lock b/packages/core-apis/api-resolver/yarn.lock new file mode 100644 index 0000000000..c087caf8e8 --- /dev/null +++ b/packages/core-apis/api-resolver/yarn.lock @@ -0,0 +1,3331 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658" + integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g== + dependencies: + "@babel/highlight" "^7.12.13" + +"@babel/helper-validator-identifier@^7.14.0": + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz#d26cad8a47c65286b15df1547319a5d0bcf27288" + integrity sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A== + +"@babel/highlight@^7.12.13": + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.0.tgz#3197e375711ef6bf834e67d0daec88e4f46113cf" + integrity sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg== + dependencies: + "@babel/helper-validator-identifier" "^7.14.0" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@dorgjelli-test/ipfs-http-client-lite@0.3.1": + version "0.3.1" + resolved "https://registry.yarnpkg.com/@dorgjelli-test/ipfs-http-client-lite/-/ipfs-http-client-lite-0.3.1.tgz#5514b4400e0c91ea64e0b5faf426ba808809ddfe" + integrity sha512-N96ilOlJnjnprOOIrwKjEA7lu67mbXyGmJO/vOBXQvY9AQw9XrPdIEn0x30bHwQ6pWSwN4RhIgJUy1/A7u/hEg== + dependencies: + abort-controller "^3.0.0" + async-iterator-to-pull-stream "^1.3.0" + buffer "^5.2.1" + cids "^0.7.1" + explain-error "^1.0.4" + form-data "^2.4.0" + iterable-ndjson "^1.1.0" + node-fetch "^2.6.0" + pull-stream-to-async-iterator "^1.0.2" + querystring "^0.2.0" + +"@ethersproject/abi@^5.0.0", "@ethersproject/abi@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.3.0.tgz#00f0647d906edcd32c50b16ab9c98f83e208dcf1" + integrity sha512-NaT4UacjOwca8qCG/gv8k+DgTcWu49xlrvdhr/p8PTFnoS8e3aMWqjI3znFME5Txa/QWXDrg2/heufIUue9rtw== + dependencies: + "@ethersproject/address" "^5.3.0" + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/constants" "^5.3.0" + "@ethersproject/hash" "^5.3.0" + "@ethersproject/keccak256" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/strings" "^5.3.0" + +"@ethersproject/abstract-provider@^5.0.0", "@ethersproject/abstract-provider@^5.0.3", "@ethersproject/abstract-provider@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.3.0.tgz#f4c0ae4a4cef9f204d7781de805fd44b72756c81" + integrity sha512-1+MLhGP1GwxBDBNwMWVmhCsvKwh4gK7oIfOrmlmePNeskg1NhIrYssraJBieaFNHUYfKEd/1DjiVZMw8Qu5Cxw== + dependencies: + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/networks" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/transactions" "^5.3.0" + "@ethersproject/web" "^5.3.0" + +"@ethersproject/abstract-signer@^5.0.0", "@ethersproject/abstract-signer@^5.0.3", "@ethersproject/abstract-signer@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.3.0.tgz#05172b653e15b535ed5854ef5f6a72f4b441052d" + integrity sha512-w8IFwOYqiPrtvosPuArZ3+QPR2nmdVTRrVY8uJYL3NNfMmQfTy3V3l2wbzX47UUlNbPJY+gKvzJAyvK1onZxJg== + dependencies: + "@ethersproject/abstract-provider" "^5.3.0" + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + +"@ethersproject/address@5.0.7": + version "5.0.7" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.0.7.tgz#ee7fd7d3b3a400dec6035c7b3f0b7e4652207308" + integrity sha512-+63DiYG+2og6rFNvQmLlLw8i5LtyT65n+jtHd06Ic81rLHc+JUKRpeZFhBa+gqh9f+P8V0xtKR5NI/EHXOfgSw== + dependencies: + "@ethersproject/bignumber" "^5.0.10" + "@ethersproject/bytes" "^5.0.4" + "@ethersproject/keccak256" "^5.0.3" + "@ethersproject/logger" "^5.0.5" + "@ethersproject/rlp" "^5.0.3" + +"@ethersproject/address@^5.0.0", "@ethersproject/address@^5.0.3", "@ethersproject/address@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.3.0.tgz#e53b69eacebf332e8175de814c5e6507d6932518" + integrity sha512-29TgjzEBK+gUEUAOfWCG7s9IxLNLCqvr+oDSk6L9TXD0VLvZJKhJV479tKQqheVA81OeGxfpdxYtUVH8hqlCvA== + dependencies: + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/keccak256" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/rlp" "^5.3.0" + +"@ethersproject/base64@^5.0.0", "@ethersproject/base64@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.3.0.tgz#b831fb35418b42ad24d943c557259062b8640824" + integrity sha512-JIqgtOmgKcbc2sjGWTXyXktqUhvFUDte8fPVsAaOrcPiJf6YotNF+nsrOYGC9pbHBEGSuSBp3QR0varkO8JHEw== + dependencies: + "@ethersproject/bytes" "^5.3.0" + +"@ethersproject/basex@^5.0.3", "@ethersproject/basex@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.3.0.tgz#02dea3ab8559ae625c6d548bc11773432255c916" + integrity sha512-8J4nS6t/SOnoCgr3DF5WCSRLC5YwTKYpZWJqeyYQLX+86TwPhtzvHXacODzcDII9tWKhVg6g0Bka8JCBWXsCiQ== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + +"@ethersproject/bignumber@^5.0.0", "@ethersproject/bignumber@^5.0.10", "@ethersproject/bignumber@^5.0.6", "@ethersproject/bignumber@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.3.0.tgz#74ab2ec9c3bda4e344920565720a6ee9c794e9db" + integrity sha512-5xguJ+Q1/zRMgHgDCaqAexx/8DwDVLRemw2i6uR8KyGjwGdXI8f32QZZ1cKGucBN6ekJvpUpHy6XAuQnTv0mPA== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + bn.js "^4.11.9" + +"@ethersproject/bytes@^5.0.0", "@ethersproject/bytes@^5.0.4", "@ethersproject/bytes@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.3.0.tgz#473e0da7f831d535b2002be05e6f4ca3729a1bc9" + integrity sha512-rqLJjdVqCcn7glPer7Fxh87PRqlnRScVAoxcIP3PmOUNApMWJ6yRdOFfo2KvPAdO7Le3yEI1o0YW+Yvr7XCYvw== + dependencies: + "@ethersproject/logger" "^5.3.0" + +"@ethersproject/constants@^5.0.0", "@ethersproject/constants@^5.0.3", "@ethersproject/constants@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.3.0.tgz#a5d6d86c0eec2c64c3024479609493b9afb3fc77" + integrity sha512-4y1feNOwEpgjAfiCFWOHznvv6qUF/H6uI0UKp8xdhftb+H+FbKflXg1pOgH5qs4Sr7EYBL+zPyPb+YD5g1aEyw== + dependencies: + "@ethersproject/bignumber" "^5.3.0" + +"@ethersproject/contracts@^5.0.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.3.0.tgz#ad699a3abaae30bfb6422cf31813a663b2d4099c" + integrity sha512-eDyQ8ltykvyQqnGZxb/c1e0OnEtzqXhNNC4BX8nhYBCaoBrYYuK/1fLmyEvc5+XUMoxNhwpYkoSSwvPLci7/Zg== + dependencies: + "@ethersproject/abi" "^5.3.0" + "@ethersproject/abstract-provider" "^5.3.0" + "@ethersproject/abstract-signer" "^5.3.0" + "@ethersproject/address" "^5.3.0" + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/constants" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/transactions" "^5.3.0" + +"@ethersproject/hash@^5.0.0", "@ethersproject/hash@^5.0.3", "@ethersproject/hash@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.3.0.tgz#f65e3bf3db3282df4da676db6cfa049535dd3643" + integrity sha512-gAFZSjUPQ32CIfoKSMtMEQ+IO0kQxqhwz9fCIFt2DtAq2u4pWt8mL9Z5P0r6KkLcQU8LE9FmuPPyd+JvBzmr1w== + dependencies: + "@ethersproject/abstract-signer" "^5.3.0" + "@ethersproject/address" "^5.3.0" + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/keccak256" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/strings" "^5.3.0" + +"@ethersproject/hdnode@^5.0.0", "@ethersproject/hdnode@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.3.0.tgz#26fed65ffd5c25463fddff13f5fb4e5617553c94" + integrity sha512-zLmmtLNoDMGoYRdjOab01Zqkvp+TmZyCGDAMQF1Bs3yZyBs/kzTNi1qJjR1jVUcPP5CWGtjFwY8iNG8oNV9J8g== + dependencies: + "@ethersproject/abstract-signer" "^5.3.0" + "@ethersproject/basex" "^5.3.0" + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/pbkdf2" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/sha2" "^5.3.0" + "@ethersproject/signing-key" "^5.3.0" + "@ethersproject/strings" "^5.3.0" + "@ethersproject/transactions" "^5.3.0" + "@ethersproject/wordlists" "^5.3.0" + +"@ethersproject/json-wallets@^5.0.0", "@ethersproject/json-wallets@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.3.0.tgz#7b1a5ff500c12aa8597ae82c8939837b0449376e" + integrity sha512-/xwbqaIb5grUIGNmeEaz8GdcpmDr++X8WT4Jqcclnxow8PXCUHFeDxjf3O+nSuoqOYG/Ds0+BI5xuQKbva6Xkw== + dependencies: + "@ethersproject/abstract-signer" "^5.3.0" + "@ethersproject/address" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/hdnode" "^5.3.0" + "@ethersproject/keccak256" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/pbkdf2" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/random" "^5.3.0" + "@ethersproject/strings" "^5.3.0" + "@ethersproject/transactions" "^5.3.0" + aes-js "3.0.0" + scrypt-js "3.0.1" + +"@ethersproject/keccak256@^5.0.0", "@ethersproject/keccak256@^5.0.3", "@ethersproject/keccak256@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.3.0.tgz#fb5cd36bdfd6fa02e2ea84964078a9fc6bd731be" + integrity sha512-Gv2YqgIUmRbYVNIibafT0qGaeGYLIA/EdWHJ7JcVxVSs2vyxafGxOJ5VpSBHWeOIsE6OOaCelYowhuuTicgdFQ== + dependencies: + "@ethersproject/bytes" "^5.3.0" + js-sha3 "0.5.7" + +"@ethersproject/logger@^5.0.0", "@ethersproject/logger@^5.0.5", "@ethersproject/logger@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.3.0.tgz#7a69fa1d4ca0d4b7138da1627eb152f763d84dd0" + integrity sha512-8bwJ2gxJGkZZnpQSq5uSiZSJjyVTWmlGft4oH8vxHdvO1Asy4TwVepAhPgxIQIMxXZFUNMych1YjIV4oQ4I7dA== + +"@ethersproject/networks@^5.0.0", "@ethersproject/networks@^5.0.3", "@ethersproject/networks@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.3.0.tgz#d8ad06eb107c69fb8651f4c81ddd0e88944fdfea" + integrity sha512-XGbD9MMgqrR7SYz8o6xVgdG+25v7YT5vQG8ZdlcLj2I7elOBM7VNeQrnxfSN7rWQNcqu2z80OM29gGbQz+4Low== + dependencies: + "@ethersproject/logger" "^5.3.0" + +"@ethersproject/pbkdf2@^5.0.0", "@ethersproject/pbkdf2@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.3.0.tgz#8adbb41489c3c9f319cc44bc7d3e6095fd468dc8" + integrity sha512-Q9ChVU6gBFiex0FSdtzo4b0SAKz3ZYcYVFLrEWHL0FnHvNk3J3WgAtRNtBQGQYn/T5wkoTdZttMbfBkFlaiWcA== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/sha2" "^5.3.0" + +"@ethersproject/properties@^5.0.0", "@ethersproject/properties@^5.0.3", "@ethersproject/properties@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.3.0.tgz#feef4c4babeb7c10a6b3449575016f4ad2c092b2" + integrity sha512-PaHxJyM5/bfusk6vr3yP//JMnm4UEojpzuWGTmtL5X4uNhNnFNvlYilZLyDr4I9cTkIbipCMsAuIcXWsmdRnEw== + dependencies: + "@ethersproject/logger" "^5.3.0" + +"@ethersproject/providers@5.0.7": + version "5.0.7" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.0.7.tgz#8dfb9eacb36d3c05c08831f71ad43fb46d2aaec6" + integrity sha512-lT+w/w2PKX9oyddX0DTBYl2CVHJTJONZP5HLJ3MzVvSA5dTOdiJ9Sx5rpqR7Tw+mxVA9xPjanoNCaPPIT7cykQ== + dependencies: + "@ethersproject/abstract-provider" "^5.0.3" + "@ethersproject/abstract-signer" "^5.0.3" + "@ethersproject/address" "^5.0.3" + "@ethersproject/basex" "^5.0.3" + "@ethersproject/bignumber" "^5.0.6" + "@ethersproject/bytes" "^5.0.4" + "@ethersproject/constants" "^5.0.3" + "@ethersproject/hash" "^5.0.3" + "@ethersproject/logger" "^5.0.5" + "@ethersproject/networks" "^5.0.3" + "@ethersproject/properties" "^5.0.3" + "@ethersproject/random" "^5.0.3" + "@ethersproject/rlp" "^5.0.3" + "@ethersproject/sha2" "^5.0.3" + "@ethersproject/strings" "^5.0.3" + "@ethersproject/transactions" "^5.0.3" + "@ethersproject/web" "^5.0.4" + bech32 "1.1.4" + ws "7.2.3" + +"@ethersproject/providers@^5.0.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.3.0.tgz#bccb49f1073a7d56e24f49abb14bb281c9b08636" + integrity sha512-HtL+DEbzPcRyfrkrMay7Rk/4he+NbUpzI/wHXP4Cqtra82nQOnqqCgTQc4HbdDrl75WVxG/JRMFhyneIPIMZaA== + dependencies: + "@ethersproject/abstract-provider" "^5.3.0" + "@ethersproject/abstract-signer" "^5.3.0" + "@ethersproject/address" "^5.3.0" + "@ethersproject/basex" "^5.3.0" + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/constants" "^5.3.0" + "@ethersproject/hash" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/networks" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/random" "^5.3.0" + "@ethersproject/rlp" "^5.3.0" + "@ethersproject/sha2" "^5.3.0" + "@ethersproject/strings" "^5.3.0" + "@ethersproject/transactions" "^5.3.0" + "@ethersproject/web" "^5.3.0" + bech32 "1.1.4" + ws "7.4.6" + +"@ethersproject/random@^5.0.0", "@ethersproject/random@^5.0.3", "@ethersproject/random@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.3.0.tgz#7c46bf36e50cb0d0550bc8c666af8e1d4496dc1a" + integrity sha512-A5SL/4inutSwt3Fh2OD0x2gz+x6GHmuUnIPkR7zAiTidMD2N8F6tZdMF1hlQKWVCcVMWhEQg8mWijhEzm6BBYw== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + +"@ethersproject/rlp@^5.0.0", "@ethersproject/rlp@^5.0.3", "@ethersproject/rlp@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.3.0.tgz#7cb93a7b5dfa69163894153c9d4b0d936f333188" + integrity sha512-oI0joYpsRanl9guDubaW+1NbcpK0vJ3F/6Wpcanzcnqq+oaW9O5E98liwkEDPcb16BUTLIJ+ZF8GPIHYxJ/5Pw== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + +"@ethersproject/sha2@^5.0.0", "@ethersproject/sha2@^5.0.3", "@ethersproject/sha2@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.3.0.tgz#209f9a1649f7d2452dcd5e5b94af43b7f3f42366" + integrity sha512-r5ftlwKcocYEuFz2JbeKOT5SAsCV4m1RJDsTOEfQ5L67ZC7NFDK5i7maPdn1bx4nPhylF9VAwxSrQ1esmwzylg== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + hash.js "1.1.7" + +"@ethersproject/signing-key@^5.0.0", "@ethersproject/signing-key@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.3.0.tgz#a96c88f8173e1abedfa35de32d3e5db7c48e5259" + integrity sha512-+DX/GwHAd0ok1bgedV1cKO0zfK7P/9aEyNoaYiRsGHpCecN7mhLqcdoUiUzE7Uz86LBsxm5ssK0qA1kBB47fbQ== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + bn.js "^4.11.9" + elliptic "6.5.4" + hash.js "1.1.7" + +"@ethersproject/solidity@^5.0.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.3.0.tgz#2a0b00b4aaaef99a080ddea13acab1fa35cd4a93" + integrity sha512-uLRBaNUiISHbut94XKewJgQh6UmydWTBp71I7I21pkjVXfZO2dJ5EOo3jCnumJc01M4LOm79dlNNmF3oGIvweQ== + dependencies: + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/keccak256" "^5.3.0" + "@ethersproject/sha2" "^5.3.0" + "@ethersproject/strings" "^5.3.0" + +"@ethersproject/strings@^5.0.0", "@ethersproject/strings@^5.0.3", "@ethersproject/strings@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.3.0.tgz#a6b640aab56a18e0909f657da798eef890968ff0" + integrity sha512-j/AzIGZ503cvhuF2ldRSjB0BrKzpsBMtCieDtn4TYMMZMQ9zScJn9wLzTQl/bRNvJbBE6TOspK0r8/Ngae/f2Q== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/constants" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + +"@ethersproject/transactions@^5.0.0", "@ethersproject/transactions@^5.0.3", "@ethersproject/transactions@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.3.0.tgz#49b86f2bafa4d0bdf8e596578fc795ee47c50458" + integrity sha512-cdfK8VVyW2oEBCXhURG0WQ6AICL/r6Gmjh0e4Bvbv6MCn/GBd8FeBH3rtl7ho+AW50csMKeGv3m3K1HSHB2jMQ== + dependencies: + "@ethersproject/address" "^5.3.0" + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/constants" "^5.3.0" + "@ethersproject/keccak256" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/rlp" "^5.3.0" + "@ethersproject/signing-key" "^5.3.0" + +"@ethersproject/units@^5.0.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.3.0.tgz#c4d1493532ad3d4ddf6e2bc4f8c94a2db933a8f5" + integrity sha512-BkfccZGwfJ6Ob+AelpIrgAzuNhrN2VLp3AILnkqTOv+yBdsc83V4AYf25XC/u0rHnWl6f4POaietPwlMqP2vUg== + dependencies: + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/constants" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + +"@ethersproject/wallet@^5.0.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.3.0.tgz#91946b470bd279e39ade58866f21f92749d062af" + integrity sha512-boYBLydG6671p9QoG6EinNnNzbm7DNOjVT20eV8J6HQEq4aUaGiA2CytF2vK+2rOEWbzhZqoNDt6AlkE1LlsTg== + dependencies: + "@ethersproject/abstract-provider" "^5.3.0" + "@ethersproject/abstract-signer" "^5.3.0" + "@ethersproject/address" "^5.3.0" + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/hash" "^5.3.0" + "@ethersproject/hdnode" "^5.3.0" + "@ethersproject/json-wallets" "^5.3.0" + "@ethersproject/keccak256" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/random" "^5.3.0" + "@ethersproject/signing-key" "^5.3.0" + "@ethersproject/transactions" "^5.3.0" + "@ethersproject/wordlists" "^5.3.0" + +"@ethersproject/web@^5.0.0", "@ethersproject/web@^5.0.4", "@ethersproject/web@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.3.0.tgz#7959c403f6476c61515008d8f92da51c553a8ee1" + integrity sha512-Ni6/DHnY6k/TD41LEkv0RQDx4jqWz5e/RZvrSecsxGYycF+MFy2z++T/yGc2peRunLOTIFwEksgEGGlbwfYmhQ== + dependencies: + "@ethersproject/base64" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/strings" "^5.3.0" + +"@ethersproject/wordlists@^5.0.0", "@ethersproject/wordlists@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.3.0.tgz#45a0205f5178c1de33d316cb2ab7ed5eac3c06c5" + integrity sha512-JcwumCZcsUxgWpiFU/BRy6b4KlTRdOmYvOKZcAw/3sdF93/pZyPW5Od2hFkHS8oWp4xS06YQ+qHqQhdcxdHafQ== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/hash" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/strings" "^5.3.0" + +"@formatjs/ecma402-abstract@1.6.2": + version "1.6.2" + resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.6.2.tgz#9d064a2cf790769aa6721e074fb5d5c357084bb9" + integrity sha512-aLBODrSRhHaL/0WdQ0T2UsGqRbdtRRHqqrs4zwNQoRsGBEtEAvlj/rgr6Uea4PSymVJrbZBoAyECM2Z3Pq4i0g== + dependencies: + tslib "^2.1.0" + +"@formatjs/intl-datetimeformat@3.2.12": + version "3.2.12" + resolved "https://registry.yarnpkg.com/@formatjs/intl-datetimeformat/-/intl-datetimeformat-3.2.12.tgz#c9b2e85f0267ee13ea615a8991995da3075e3b13" + integrity sha512-qvY5+dl3vlgH0iWRXwl8CG9UkSVB5uP2+HH//fyZZ01G4Ww5rxMJmia1SbUqatpoe/dX+Z+aLejCqUUyugyL2g== + dependencies: + "@formatjs/ecma402-abstract" "1.6.2" + tslib "^2.1.0" + +"@formatjs/intl-displaynames@4.0.10": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@formatjs/intl-displaynames/-/intl-displaynames-4.0.10.tgz#5bbd1bbcd64a036b4be27798b650c864dcf4466a" + integrity sha512-KmYJQHynGnnMeqIWVXhbzCMcEC8lg1TfGVdcO9May6paDT+dksZoOBQc741t7iXi/YVO/wXEZdmXhUNX7ODZug== + dependencies: + "@formatjs/ecma402-abstract" "1.6.2" + tslib "^2.1.0" + +"@formatjs/intl-listformat@5.0.10": + version "5.0.10" + resolved "https://registry.yarnpkg.com/@formatjs/intl-listformat/-/intl-listformat-5.0.10.tgz#9f8c4ad5e8a925240e151ba794c41fba01f742cc" + integrity sha512-FLtrtBPfBoeteRlYcHvThYbSW2YdJTllR0xEnk6cr/6FRArbfPRYMzDpFYlESzb5g8bpQMKZy+kFQ6V2Z+5KaA== + dependencies: + "@formatjs/ecma402-abstract" "1.6.2" + tslib "^2.1.0" + +"@formatjs/intl-relativetimeformat@8.1.2": + version "8.1.2" + resolved "https://registry.yarnpkg.com/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-8.1.2.tgz#119f3dce97458991f86bf34a736880e4a7bc1697" + integrity sha512-LZUxbc9GHVGmDc4sqGAXugoxhvZV7EG2lG2c0aKERup2ixvmDMbbEN3iEEr5aKkP7YyGxXxgqDn2dwg7QCPR6Q== + dependencies: + "@formatjs/ecma402-abstract" "1.6.2" + tslib "^2.1.0" + +"@formatjs/intl@1.8.2": + version "1.8.2" + resolved "https://registry.yarnpkg.com/@formatjs/intl/-/intl-1.8.2.tgz#6090e6c1826a92e70668dfe08b4ba30127ea3a85" + integrity sha512-9xHoNKPv4qQIQ5AVfpQbIPZanz50i7oMtZWrd6Fz7Q2GM/5uhBr9mrCrY1tz/+diP7uguKmhj1IweLYaxY3DTQ== + dependencies: + "@formatjs/ecma402-abstract" "1.6.2" + "@formatjs/intl-datetimeformat" "3.2.12" + "@formatjs/intl-displaynames" "4.0.10" + "@formatjs/intl-listformat" "5.0.10" + "@formatjs/intl-relativetimeformat" "8.1.2" + fast-memoize "^2.5.2" + intl-messageformat "9.5.2" + intl-messageformat-parser "6.4.2" + tslib "^2.1.0" + +"@msgpack/msgpack@2.3.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@msgpack/msgpack/-/msgpack-2.3.0.tgz#a9043b920837b2dd63482e7bf6b8345813e9816b" + integrity sha512-xxRejzNpiVQ2lzxMG/yo2ocfZSk+cKo2THq54AimaubMucg66DpQm9Yj7ESMr/l2EqDkmF2Dx4r0F/cbsitAaw== + +"@multiformats/base-x@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@multiformats/base-x/-/base-x-4.0.1.tgz#95ff0fa58711789d53aefb2590a8b7a4e715d121" + integrity sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw== + +"@opentelemetry/api-metrics@^0.18.2": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/api-metrics/-/api-metrics-0.18.2.tgz#12ad987cb785e142508e6df3772b8908f2edd8de" + integrity sha512-yoC1Bg3GRAf2xXAVsE6Wf54rs351XO694PsnvWGRXITJQq84yLru7Qq12w6w3N5TTyGzW6oZtqXpGWe5Im/dNQ== + dependencies: + "@opentelemetry/api" "^0.18.1" + +"@opentelemetry/api@^0.18.1": + version "0.18.1" + resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-0.18.1.tgz#fb499e07afa1f55acffc47b2469eb218dcdee2a2" + integrity sha512-pKNxHe3AJ5T2N5G3AlT9gx6FyF5K2FS9ZNc+FipC+f1CpVF/EY+JHTJ749dnM2kWIgZTbDJFiGMuc0FYjNSCOg== + +"@opentelemetry/api@^1.0.0-rc.0": + version "1.0.0-rc.3" + resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.0.0-rc.3.tgz#903ef6dddf04410d09072d43a060b87ccc162545" + integrity sha512-3PlJD9uN5iZrKmX054vOifGxZ/iH24+UFD5eW8Vyz08GUU7SdW8PNu4VSpTixWeuWo+Q6TELfSv7vVu43t+tbA== + +"@opentelemetry/context-async-hooks@^0.18.2": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/context-async-hooks/-/context-async-hooks-0.18.2.tgz#65c06f91fbcba58e9865978ed43b46a1a12a3a4e" + integrity sha512-p//1ocBUI6EKXfyijtOPzKuLGBkNxcZLEWDpKKLw8fVK0gCuJiZ//hYMlemc7WvJuAYH27Vapo3cc6NTt/arPw== + dependencies: + "@opentelemetry/api" "^0.18.1" + +"@opentelemetry/context-zone-peer-dep@^0.18.2": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/context-zone-peer-dep/-/context-zone-peer-dep-0.18.2.tgz#ec60066b352f8aa4ba1e779ac0e4a724c1d79313" + integrity sha512-yEyxBihR8ElP8Zaub4L+sQs98yZegTb00qgv3B0gfyenoXAEiVVA52S0vZZ5vNa/tPeoih0xArTFzrnOJTiJ+w== + dependencies: + "@opentelemetry/api" "^0.18.1" + +"@opentelemetry/context-zone@^0.18.0": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/context-zone/-/context-zone-0.18.2.tgz#174bd9269199775eeed0f752998aa1ca306f1651" + integrity sha512-JvIKdPYa2EVZfFuGQX/GqOmlIlxzG6rI0ilit7PtXmLISgJ0dgWzs45yKx4VCbvzOH1doVBwvgVP/nOejZ5WtQ== + dependencies: + "@opentelemetry/context-zone-peer-dep" "^0.18.2" + zone.js "^0.11.0" + +"@opentelemetry/core@^0.18.0", "@opentelemetry/core@^0.18.2": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/core/-/core-0.18.2.tgz#3f8f54e250416b50730551f73e42fca9808cafd3" + integrity sha512-WG8veOEd8xZHuBaOHddzWQg5yj794lrEPAe6W1qI0YkV7pyqYXvhJdCxOU5Lyo1SWzTAjI5xrCUQ9J2WlrqzYA== + dependencies: + "@opentelemetry/api" "^0.18.1" + semver "^7.1.3" + +"@opentelemetry/exporter-collector@^0.18.0": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-collector/-/exporter-collector-0.18.2.tgz#30108fac2b3abb3e0c3641eabf9d40b3dfc1e0f4" + integrity sha512-WFYz7m0AN0ECJhBsrBh4JhelYnlwqlL/XDY0d99eCTBLwkgG+ywsYuF5aK56dRuciWXVLudnYxXQxZcFeUw/iw== + dependencies: + "@opentelemetry/api" "^0.18.1" + "@opentelemetry/api-metrics" "^0.18.2" + "@opentelemetry/core" "^0.18.2" + "@opentelemetry/metrics" "^0.18.2" + "@opentelemetry/resources" "^0.18.2" + "@opentelemetry/tracing" "^0.18.2" + +"@opentelemetry/exporter-jaeger@^0.18.0": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-jaeger/-/exporter-jaeger-0.18.2.tgz#e8946a0de07b0febdeba2fb3c8a3c92e95b91191" + integrity sha512-/Fv4T7qWg4eeZAb+NsKXetKrFYjRjrg2GeVMZ5sEEURGN2K44OzqfomFX+HOZFdNZpQzeUj6PywY9/bMOnPqyw== + dependencies: + "@opentelemetry/api" "^0.18.1" + "@opentelemetry/core" "^0.18.2" + "@opentelemetry/tracing" "^0.18.2" + jaeger-client "^3.15.0" + +"@opentelemetry/exporter-zipkin@^0.18.0": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-zipkin/-/exporter-zipkin-0.18.2.tgz#aa33ec65a2e5f5b404534577f9a0f6d2a8b212ca" + integrity sha512-4afGSxI3+k3hiKyYIY5Iy/oQPP3k0RPvPofn3CPyB+aXsTgxrwG3+Kan54TlHVP1M3EFimA2kKay+tM1ad8Lcw== + dependencies: + "@opentelemetry/api" "^0.18.1" + "@opentelemetry/core" "^0.18.2" + "@opentelemetry/resources" "^0.18.2" + "@opentelemetry/tracing" "^0.18.2" + +"@opentelemetry/metrics@^0.18.2": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/metrics/-/metrics-0.18.2.tgz#4541f54399ba37bff3573f7ed31074ba8bb41a5b" + integrity sha512-Fp+1rmey1xMgXAFpBp3C61bnAVPlQFtPBlm7oSSYCsjwqBtDEcaT8EdY/c06Vo6k+aXTuMw1BFNgTHrwDtNGlg== + dependencies: + "@opentelemetry/api" "^0.18.1" + "@opentelemetry/api-metrics" "^0.18.2" + "@opentelemetry/core" "^0.18.2" + "@opentelemetry/resources" "^0.18.2" + lodash.merge "^4.6.2" + +"@opentelemetry/node@^0.18.0": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/node/-/node-0.18.2.tgz#a40fd5537daf0b0755181c09aca93df25e7ba5c4" + integrity sha512-9cJtXQga3dSdkNcNyhVipxNg2g7fNa2f/lE08a035ZA3NKKIGKaPop/p+Uc5+2gmkZfzKkmkZRn9YVOBRHg/ww== + dependencies: + "@opentelemetry/api" "^0.18.1" + "@opentelemetry/context-async-hooks" "^0.18.2" + "@opentelemetry/core" "^0.18.2" + "@opentelemetry/tracing" "^0.18.2" + semver "^7.1.3" + +"@opentelemetry/propagator-b3@^0.18.0": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/propagator-b3/-/propagator-b3-0.18.2.tgz#dc650b022d03d7a3a1bcbc0277206cf9a22899e3" + integrity sha512-zKL9JKnfeSeY53GXA/m6D1PB0J3fMp6fg7exvVI7q52bt+gR+/bxawwc3wyt8tdKm93BTVcok7NyPpLxMTYjOA== + dependencies: + "@opentelemetry/api" "^0.18.1" + +"@opentelemetry/resources@^0.18.2": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/resources/-/resources-0.18.2.tgz#9d671476a53385c5a75c6ef273a609c9f01d8142" + integrity sha512-EBPqFsreXgFaqkMmWCE8vh6pFhbWExRHSO24qSeGhxFmM5SQP/D1jJqMp/jVUSmrF97fPkMS0aEH5z7NOWdxQA== + dependencies: + "@opentelemetry/api" "^0.18.1" + "@opentelemetry/core" "^0.18.2" + +"@opentelemetry/semantic-conventions@^0.18.2": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/semantic-conventions/-/semantic-conventions-0.18.2.tgz#a0f15d2ef752567713c1f59f69c6742edb03030c" + integrity sha512-+0P+PrP9qSFVaayNdek4P1OAGE+PEl2SsufuHDRmUpOY25Wzjo7Atyar56Trjc32jkNy4lID6ZFT6BahsR9P9A== + +"@opentelemetry/tracing@^0.18.0", "@opentelemetry/tracing@^0.18.2": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/tracing/-/tracing-0.18.2.tgz#b247bcd7c68f95000ca20014ce4bd05c3f561b7a" + integrity sha512-IQSu+NwMhX8O9Wkjc4HjNqs/aKfkcInCE3dQuAOBBec/saLrM6jqd+Fa5QUzg03WMOqpDuZm5KTkr5+6DUrr0g== + dependencies: + "@opentelemetry/api" "^0.18.1" + "@opentelemetry/core" "^0.18.2" + "@opentelemetry/resources" "^0.18.2" + "@opentelemetry/semantic-conventions" "^0.18.2" + lodash.merge "^4.6.2" + +"@opentelemetry/web@^0.18.0": + version "0.18.2" + resolved "https://registry.yarnpkg.com/@opentelemetry/web/-/web-0.18.2.tgz#3bd8242f9fc87b887e4c0650a77dd6a643130b70" + integrity sha512-3OP7iuk4TyDly06zoWG5FsTjT+gy1PypwqMD1L5GYDlCBINCSmHI6fuFeyU2k8Is62kR7voar6UwSS283Fo8Yw== + dependencies: + "@opentelemetry/api" "^0.18.1" + "@opentelemetry/core" "^0.18.2" + "@opentelemetry/semantic-conventions" "^0.18.2" + "@opentelemetry/tracing" "^0.18.2" + +"@types/node@12.7.11": + version "12.7.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.11.tgz#be879b52031cfb5d295b047f5462d8ef1a716446" + integrity sha512-Otxmr2rrZLKRYIybtdG/sgeO+tHY20GxeDjcGmUnmmlCWyEnv2a2x1ZXBo3BTec4OiTXMQCiazB8NMBf0iRlFw== + +"@types/parse-json@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" + integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== + +"@web3api/cli@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/cli/-/cli-0.0.1-prealpha.24.tgz#6c97d8531816c349198eb58a0fa7af2a70eed18a" + integrity sha512-2IrAMpUjgai0O77dtn+F6SFnTYtgfz5Las/s0QlihYhVlGya4WPt9f2xFuvHm/DWwldfpod/gA5PAO+D/sJITA== + dependencies: + "@formatjs/intl" "1.8.2" + "@types/node" "12.7.11" + "@web3api/client-js" "0.0.1-prealpha.24" + "@web3api/client-test-env" "0.0.1-prealpha.24" + "@web3api/core-js" "0.0.1-prealpha.24" + "@web3api/ens-plugin-js" "0.0.1-prealpha.24" + "@web3api/ethereum-plugin-js" "0.0.1-prealpha.24" + "@web3api/ipfs-plugin-js" "0.0.1-prealpha.24" + "@web3api/os-js" "0.0.1-prealpha.24" + "@web3api/schema-bind" "0.0.1-prealpha.24" + "@web3api/schema-compose" "0.0.1-prealpha.24" + "@web3api/schema-parse" "0.0.1-prealpha.24" + assemblyscript "0.17.14" + axios "0.19.2" + chalk "4.1.0" + chokidar "3.5.1" + fs-extra "9.0.1" + gluegun "4.6.1" + graphql-tag "2.11.0" + ipfs-http-client "48.1.3" + js-yaml "3.14.0" + mustache "4.0.1" + ora "4.0.0" + os-locale "5.0.0" + ws "7.3.1" + +"@web3api/client-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/client-js/-/client-js-0.0.1-prealpha.24.tgz#f38ec697020944fecf0261c9334efbc0a8c24403" + integrity sha512-waSzJlIZ2iDQqKyd6JHZEG9TIGVZTSosDBV/8l39n68s/3EwD5CiToc/UwtdF4RxFHC0jwpNzfZHGbdgflIGQA== + dependencies: + "@msgpack/msgpack" "2.3.0" + "@web3api/core-js" "0.0.1-prealpha.24" + "@web3api/ens-plugin-js" "0.0.1-prealpha.24" + "@web3api/ethereum-plugin-js" "0.0.1-prealpha.24" + "@web3api/ipfs-plugin-js" "0.0.1-prealpha.24" + "@web3api/logger-plugin-js" "0.0.1-prealpha.24" + "@web3api/schema-parse" "0.0.1-prealpha.24" + "@web3api/tracing-js" "0.0.1-prealpha.24" + graphql "15.5.0" + js-yaml "3.14.0" + web-worker "1.0.0" + +"@web3api/client-test-env@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/client-test-env/-/client-test-env-0.0.1-prealpha.24.tgz#8b23d56bfc32f7b76718885e495e5bfc6a795339" + integrity sha512-eNkD/tG5PnFFp7Egy0rAFRrLpD1YCAlvUJ0STVLRQMujMPkFuFEtHziBjVJGJiiyU+1mZ46ub1gEvMbcB7Frpg== + +"@web3api/core-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/core-js/-/core-js-0.0.1-prealpha.24.tgz#426011c3d1695a65adbeaa27e4e94af954c0ae73" + integrity sha512-O7WJ1jXyESLR3JwMZTxS9IMfOtrJbGnb6PTIcthrdkZOUO4zppM8ArJlB9BttQf5vNHdTNnzOOu0pxwkKnLOtg== + dependencies: + "@web3api/manifest-schema" "0.0.1-prealpha.24" + "@web3api/tracing-js" "0.0.1-prealpha.24" + graphql "15.5.0" + graphql-tag "2.10.4" + js-yaml "3.14.0" + jsonschema "1.4.0" + semver "7.3.4" + +"@web3api/ens-plugin-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/ens-plugin-js/-/ens-plugin-js-0.0.1-prealpha.24.tgz#7494e28449764308bfc2bd9ae72d347ef0961b6f" + integrity sha512-NFucvYZ7Ri356IZXvMq6s0vmtMwEoenESUw3Vjy9tc3rpsxNXZHVxfJ14tZjenArZAyVsJDXRBmhuIyJ6mP+jw== + dependencies: + "@ethersproject/address" "5.0.7" + "@web3api/core-js" "0.0.1-prealpha.24" + ethers "5.0.7" + +"@web3api/ethereum-plugin-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/ethereum-plugin-js/-/ethereum-plugin-js-0.0.1-prealpha.24.tgz#9ecfd3be33615a9e7cc46e1d919f56b1a67392b3" + integrity sha512-jWefPeACTk7ziK1fFNhrkKmcHvPcEwQnqs/Av8zKeMe0NMPkDXg17Qjzw++bxzmuJjjlyKDIn2jFBsNkELumNA== + dependencies: + "@ethersproject/address" "5.0.7" + "@ethersproject/providers" "5.0.7" + "@web3api/core-js" "0.0.1-prealpha.24" + ethers "5.0.7" + +"@web3api/ipfs-plugin-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/ipfs-plugin-js/-/ipfs-plugin-js-0.0.1-prealpha.24.tgz#30e3c1e09362e7f80cf4e7a4e0f6860fd9490d8b" + integrity sha512-Gw4pofUMonFHhwR5/30j6wEBqyjX7bwA0zedCflDKSCqd4k8JzSa8KaIaKpX5+DOyrVlAGxspsjxmqqYmaXarA== + dependencies: + "@dorgjelli-test/ipfs-http-client-lite" "0.3.1" + "@web3api/core-js" "0.0.1-prealpha.24" + abort-controller "3.0.0" + cids "^1.1.4" + is-ipfs "1.0.3" + +"@web3api/logger-plugin-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/logger-plugin-js/-/logger-plugin-js-0.0.1-prealpha.24.tgz#77ad91170a154ee31c95e796f784671dcc46a4d4" + integrity sha512-0jwD/PS41uN6LOYSTzTMFC5DuLZ42xDzAw6JNpxu3/V3acioCZzXx33B5Nw3BPSPsO5gATExRU8ExxMWeAFfug== + dependencies: + "@web3api/core-js" "0.0.1-prealpha.24" + +"@web3api/manifest-schema@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/manifest-schema/-/manifest-schema-0.0.1-prealpha.24.tgz#f07e33db19b55538cf171fd6cad5e6d236909931" + integrity sha512-yFGVSOqGChZq7pnOCBr/cK/3wHxZgge6cRyjcwMZGG628wCRijEXqTWd8lCLiaLbs8zLX4JzaoLTcCj/Nkwn4A== + +"@web3api/os-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/os-js/-/os-js-0.0.1-prealpha.24.tgz#da1b7ce7cb57fa8dcfdd2602b0143993359c3a1a" + integrity sha512-iTxS+2zO4Ia3PO99/PDq79uHsrgPPgjfOCqGLneNFx/fAstJEA3z9TT6H+gbYfoBt2YjOixfiQg5Z541yvOmYw== + dependencies: + "@types/node" "12.7.11" + +"@web3api/schema-bind@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/schema-bind/-/schema-bind-0.0.1-prealpha.24.tgz#eaca951913bafc346be3f33e73cc20c91312d163" + integrity sha512-026HW1gapAHb/mVgB2Au9Xnt4yVolXlDmQsRj30j50AgMdkEGDUElrZCH0npIhXFPPnX7m1PlSLUFQGHeLsPeQ== + dependencies: + "@web3api/os-js" "0.0.1-prealpha.24" + "@web3api/schema-parse" "0.0.1-prealpha.24" + mustache "4.0.1" + +"@web3api/schema-compose@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/schema-compose/-/schema-compose-0.0.1-prealpha.24.tgz#8248c7062f910d4f045d3ca450094b4af54c1f07" + integrity sha512-kCAi30pIoKk4KqBSiIY6khRUIIGt3fkudEp5JKTbcjqWrCGq8GxDAZ5ooqd63KxeQRUQ5gCrQY8ztSMwuZfbgw== + dependencies: + "@web3api/schema-parse" "0.0.1-prealpha.24" + graphql "15.5.0" + mustache "4.0.1" + +"@web3api/schema-parse@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/schema-parse/-/schema-parse-0.0.1-prealpha.24.tgz#c492447ff2d6959f6e291aefc97e194bf1cca5ef" + integrity sha512-0CG/4YHMaZyEx5YxUZfBRlrNMyfTjBlniPfR9lrNdpReJPhnx4tDF+uUgFo8NH2M1yUSRLh40txCdDw93wVgdg== + dependencies: + graphql "15.5.0" + graphql-schema-cycles "1.1.2" + +"@web3api/tracing-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/tracing-js/-/tracing-js-0.0.1-prealpha.24.tgz#9ba25335c56c45dbbd498a7efd320d4577e480d4" + integrity sha512-UJWBHgqaWslK7GGMjU8KLvVG2Hp4AiHFFga6/C97dFZKXXIaGg3OO7MtTeL3jek8P21FggL23LeZNTkpPCjcTw== + dependencies: + "@opentelemetry/api" "^1.0.0-rc.0" + "@opentelemetry/context-zone" "^0.18.0" + "@opentelemetry/core" "^0.18.0" + "@opentelemetry/exporter-collector" "^0.18.0" + "@opentelemetry/exporter-jaeger" "^0.18.0" + "@opentelemetry/exporter-zipkin" "^0.18.0" + "@opentelemetry/node" "^0.18.0" + "@opentelemetry/propagator-b3" "^0.18.0" + "@opentelemetry/tracing" "^0.18.0" + "@opentelemetry/web" "^0.18.0" + util-inspect "0.1.8" + +"@zxing/text-encoding@0.9.0": + version "0.9.0" + resolved "https://registry.yarnpkg.com/@zxing/text-encoding/-/text-encoding-0.9.0.tgz#fb50ffabc6c7c66a0c96b4c03e3d9be74864b70b" + integrity sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA== + +abort-controller@3.0.0, abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + +aes-js@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" + integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= + +ansi-color@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/ansi-color/-/ansi-color-0.2.1.tgz#3e75c037475217544ed763a8db5709fa9ae5bf9a" + integrity sha1-PnXAN0dSF1RO12Oo21cJ+prlv5o= + +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-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +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: + 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== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +any-signal@^2.0.0, any-signal@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/any-signal/-/any-signal-2.1.2.tgz#8d48270de0605f8b218cf9abe8e9c6a0e7418102" + integrity sha512-B+rDnWasMi/eWcajPcCWSlYc7muXOrcYrqgyzcdKisl2H/WTlQ0gip1KyQfr0ZlxJdsuWCj/LWwQm7fhyhRfIQ== + dependencies: + abort-controller "^3.0.0" + native-abort-controller "^1.0.3" + +anymatch@~3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" + integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +apisauce@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/apisauce/-/apisauce-2.1.1.tgz#0b8bc7f2544e6ef710a6fa1d6f49583856940dd2" + integrity sha512-P4SsLvmsH8BLLruBn/nsO+65j+ChZlGQ2zC5avCIjbWstYS4PgjxeVWtbeVwFGEWX7dEkLp85OvdapGXy1zS8g== + dependencies: + axios "^0.21.1" + ramda "^0.25.0" + +app-module-path@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/app-module-path/-/app-module-path-2.2.0.tgz#641aa55dfb7d6a6f0a8141c4b9c0aa50b6c24dd5" + integrity sha1-ZBqlXft9am8KgUHEucCqULbCTdU= + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +array-map@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" + integrity sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI= + +array-reduce@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" + integrity sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys= + +assemblyscript@0.17.14: + version "0.17.14" + resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.17.14.tgz#9ea4a04a50dc53042b35d492fff947101ae00248" + integrity sha512-TLuwNvZAIH26wu2puKpAJokzLp10kJkVXxbgDjFFmbW9VF/qg7rkmi0hjsiu41bjoH1UaVgY4vYvbbUeOHtKyg== + dependencies: + binaryen "98.0.0-nightly.20201109" + long "^4.0.0" + +async-iterator-to-pull-stream@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/async-iterator-to-pull-stream/-/async-iterator-to-pull-stream-1.3.0.tgz#3a6b9f3cceadff972ca20eb480e3cb43f8789732" + integrity sha512-NjyhAEz/sx32olqgKIk/2xbWEM6o8qef1yetIgb0U/R3oBgndP1kE/0CslowH3jvnA94BO4I6OXpOkTKH7Z1AA== + dependencies: + get-iterator "^1.0.2" + pull-stream-to-async-iterator "^1.0.1" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + +available-typed-arrays@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.4.tgz#9e0ae84ecff20caae6a94a1c3bc39b955649b7a9" + integrity sha512-SA5mXJWrId1TaQjfxUYghbqQ/hYioKmLJvPJyDuYRtXXenFNMjj4hSSt1Cf1xsuXSXrtxrVC5Ot4eU6cOtBDdA== + +axios@0.19.2: + version "0.19.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27" + integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA== + dependencies: + follow-redirects "1.5.10" + +axios@^0.21.1: + version "0.21.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" + integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== + dependencies: + follow-redirects "^1.10.0" + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +base-x@^3.0.8: + version "3.0.8" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.8.tgz#1e1106c2537f0162e8b52474a557ebb09000018d" + integrity sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA== + dependencies: + safe-buffer "^5.0.1" + +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +bech32@1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" + integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== + +bignumber.js@^9.0.0: + version "9.0.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5" + integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA== + +binary-extensions@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + +binaryen@98.0.0-nightly.20201109: + version "98.0.0-nightly.20201109" + resolved "https://registry.yarnpkg.com/binaryen/-/binaryen-98.0.0-nightly.20201109.tgz#512bf6ca15c67bf7402144734a4836e63993aa05" + integrity sha512-iRarAqdH5lMWlMBzrDuJgLYJR2g4QXk93iYE2zpr6gEZkb/jCgDpPUXdhuN11Ge1zZ/6By4DwA1mmifcx7FWaw== + +bl@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" + integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== + dependencies: + buffer "^5.5.0" + inherits "^2.0.4" + readable-stream "^3.4.0" + +blakejs@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.1.0.tgz#69df92ef953aa88ca51a32df6ab1c54a155fc7a5" + integrity sha1-ad+S75U6qIylGjLfarHFShVfx6U= + +blob-to-it@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/blob-to-it/-/blob-to-it-1.0.2.tgz#bc76550638ca13280dbd3f202422a6a132ffcc8d" + integrity sha512-yD8tikfTlUGEOSHExz4vDCIQFLaBPXIL0KcxGQt9RbwMVXBEh+jokdJyStvTXPgWrdKfwgk7RX8GPsgrYzsyng== + dependencies: + browser-readablestream-to-it "^1.0.2" + +bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== + +borc@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/borc/-/borc-2.1.2.tgz#6ce75e7da5ce711b963755117dd1b187f6f8cf19" + integrity sha512-Sy9eoUi4OiKzq7VovMn246iTo17kzuyHJKomCfpWMlI6RpfN1gk95w7d7gH264nApVLg0HZfcpz62/g4VH1Y4w== + dependencies: + bignumber.js "^9.0.0" + buffer "^5.5.0" + commander "^2.15.0" + ieee754 "^1.1.13" + iso-url "~0.4.7" + json-text-sequence "~0.1.0" + readable-stream "^3.6.0" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +brorand@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= + +browser-readablestream-to-it@^1.0.1, browser-readablestream-to-it@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/browser-readablestream-to-it/-/browser-readablestream-to-it-1.0.2.tgz#f6b8d18e7a35b0321359261a32aa2c70f46921c4" + integrity sha512-lv4M2Z6RKJpyJijJzBQL5MNssS7i8yedl+QkhnLCyPtgNGNSXv1KthzUnye9NlRAtBAI80X6S9i+vK09Rzjcvg== + +buffer@^5.2.1, buffer@^5.4.3, buffer@^5.5.0, buffer@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + +buffer@^6.0.1: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + +bufrw@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/bufrw/-/bufrw-1.3.0.tgz#28d6cfdaf34300376836310f5c31d57eeb40c8fa" + integrity sha512-jzQnSbdJqhIltU9O5KUiTtljP9ccw2u5ix59McQy4pV2xGhVLhRZIndY8GIrgh5HjXa6+QJ9AQhOd2QWQizJFQ== + dependencies: + ansi-color "^0.2.1" + error "^7.0.0" + hexer "^1.5.0" + xtend "^4.0.0" + +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^5.0.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +chalk@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +chalk@^2.0.0, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +chokidar@3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a" + integrity sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.5.0" + optionalDependencies: + fsevents "~2.3.1" + +cids@^0.7.1: + version "0.7.5" + resolved "https://registry.yarnpkg.com/cids/-/cids-0.7.5.tgz#60a08138a99bfb69b6be4ceb63bfef7a396b28b2" + integrity sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA== + dependencies: + buffer "^5.5.0" + class-is "^1.1.0" + multibase "~0.6.0" + multicodec "^1.0.0" + multihashes "~0.4.15" + +cids@^1.0.0, cids@^1.1.4: + version "1.1.6" + resolved "https://registry.yarnpkg.com/cids/-/cids-1.1.6.tgz#ac7aea7dbcabaa64ca242b5d970d596a5c34d006" + integrity sha512-5P+Jas2bVpjiHibp/SOwKY+v7JhAjTChaAZN+vCIrsWXn/JZV0frX22Vp5zZgEyJRPco79pX+yNQ2S3LkRukHQ== + dependencies: + multibase "^4.0.1" + multicodec "^3.0.1" + multihashes "^4.0.1" + uint8arrays "^2.1.3" + +cids@~0.8.0: + version "0.8.3" + resolved "https://registry.yarnpkg.com/cids/-/cids-0.8.3.tgz#aaf48ac8ed857c3d37dad94d8db1d8c9407b92db" + integrity sha512-yoXTbV3llpm+EBGWKeL9xKtksPE/s6DPoDSY4fn8I8TEW1zehWXPSB0pwAXVDlLaOlrw+sNynj995uD9abmPhA== + dependencies: + buffer "^5.6.0" + class-is "^1.1.0" + multibase "^1.0.0" + multicodec "^1.0.1" + multihashes "^1.0.1" + +class-is@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825" + integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== + +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + +cli-spinners@^2.2.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.6.0.tgz#36c7dc98fb6a9a76bd6238ec3f77e2425627e939" + integrity sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q== + +cli-table3@~0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.5.1.tgz#0252372d94dfc40dbd8df06005f48f31f656f202" + integrity sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw== + dependencies: + object-assign "^4.1.0" + string-width "^2.1.1" + optionalDependencies: + colors "^1.1.2" + +clone@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" + integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +colors@^1.1.2, colors@^1.3.3: + version "1.4.0" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" + integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== + +combined-stream@^1.0.6, combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@^2.15.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +cosmiconfig@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982" + integrity sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.1.0" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.7.2" + +cross-spawn@^7.0.0: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +debug@=3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + +debug@^4.1.1, debug@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" + integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== + dependencies: + ms "2.1.2" + +decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + +defaults@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" + integrity sha1-xlYFHpgX2f8I7YgUd/P+QBnz730= + dependencies: + clone "^1.0.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" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +delimit-stream@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/delimit-stream/-/delimit-stream-0.1.0.tgz#9b8319477c0e5f8aeb3ce357ae305fc25ea1cd2b" + integrity sha1-m4MZR3wOX4rrPONXrjBfwl6hzSs= + +dns-over-http-resolver@^1.0.0: + version "1.2.3" + resolved "https://registry.yarnpkg.com/dns-over-http-resolver/-/dns-over-http-resolver-1.2.3.tgz#194d5e140a42153f55bb79ac5a64dd2768c36af9" + integrity sha512-miDiVSI6KSNbi4SVifzO/reD8rMnxgrlnkrlkugOLQpWQTe2qMdHsZp5DmfKjxNE+/T3VAAYLQUZMv9SMr6+AA== + dependencies: + debug "^4.3.1" + native-fetch "^3.0.0" + receptacle "^1.3.2" + +ejs@^2.6.1: + version "2.7.4" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.7.4.tgz#48661287573dcc53e366c7a1ae52c3a120eec9ba" + integrity sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA== + +electron-fetch@^1.7.2: + version "1.7.3" + resolved "https://registry.yarnpkg.com/electron-fetch/-/electron-fetch-1.7.3.tgz#06cf363d7f64073ec00a37e9949ec9d29ce6b08a" + integrity sha512-1AVMaxrHXTTMqd7EK0MGWusdqNr07Rpj8Th6bG4at0oNgIi/1LBwa9CjT/0Zy+M0k/tSJPS04nFxHj0SXDVgVw== + dependencies: + encoding "^0.1.13" + +elliptic@6.5.4: + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" + +encoding@^0.1.13: + version "0.1.13" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" + integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== + dependencies: + iconv-lite "^0.6.2" + +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +enquirer@2.3.4: + version "2.3.4" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.4.tgz#c608f2e1134c7f68c1c9ee056de13f9b31076de9" + integrity sha512-pkYrrDZumL2VS6VBGDhqbajCM2xpkUNLuKfGPjfKaSIBKYopQbqEFyrOkRMIb2HDR/rO1kGhEt/5twBwtzKBXw== + dependencies: + ansi-colors "^3.2.1" + +err-code@^2.0.0, err-code@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9" + integrity sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA== + +err-code@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/err-code/-/err-code-3.0.1.tgz#a444c7b992705f2b120ee320b09972eef331c920" + integrity sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA== + +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" + +error@7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/error/-/error-7.0.2.tgz#a5f75fff4d9926126ddac0ea5dc38e689153cb02" + integrity sha1-pfdf/02ZJhJt2sDqXcOOaJFTywI= + dependencies: + string-template "~0.2.1" + xtend "~4.0.0" + +error@^7.0.0: + version "7.2.1" + resolved "https://registry.yarnpkg.com/error/-/error-7.2.1.tgz#eab21a4689b5f684fc83da84a0e390de82d94894" + integrity sha512-fo9HBvWnx3NGUKMvMwB/CBCMMrfEJgbDTVDEkPygA3Bdd3lM1OyCd+rbQ8BwnpF6GdVeOLDNmyL4N5Bg80ZvdA== + dependencies: + string-template "~0.2.1" + +es-abstract@^1.18.0-next.1, es-abstract@^1.18.0-next.2: + version "1.18.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.3.tgz#25c4c3380a27aa203c44b2b685bba94da31b63e0" + integrity sha512-nQIr12dxV7SSxE6r6f1l3DtAeEYdsGpps13dR0TwJg1S8gyp4ZPgy3FZcHBgbiQqnoqSTb+oC+kO4UQ0C/J8vw== + dependencies: + call-bind "^1.0.2" + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + get-intrinsic "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.2" + is-callable "^1.2.3" + is-negative-zero "^2.0.1" + is-regex "^1.1.3" + is-string "^1.0.6" + object-inspect "^1.10.3" + object-keys "^1.1.1" + object.assign "^4.1.2" + string.prototype.trimend "^1.0.4" + string.prototype.trimstart "^1.0.4" + unbox-primitive "^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" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +ethers@5.0.7: + version "5.0.7" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.0.7.tgz#41c3d774e0a57bfde12b0198885789fb41a14976" + integrity sha512-1Zu9s+z4BgsDAZcGIYACJdWBB6mVtCCmUonj68Njul7STcSdgwOyj0sCAxCUr2Nsmsamckr4E12q3ecvZPGAUw== + dependencies: + "@ethersproject/abi" "^5.0.0" + "@ethersproject/abstract-provider" "^5.0.0" + "@ethersproject/abstract-signer" "^5.0.0" + "@ethersproject/address" "^5.0.0" + "@ethersproject/base64" "^5.0.0" + "@ethersproject/bignumber" "^5.0.0" + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/constants" "^5.0.0" + "@ethersproject/contracts" "^5.0.0" + "@ethersproject/hash" "^5.0.0" + "@ethersproject/hdnode" "^5.0.0" + "@ethersproject/json-wallets" "^5.0.0" + "@ethersproject/keccak256" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/networks" "^5.0.0" + "@ethersproject/pbkdf2" "^5.0.0" + "@ethersproject/properties" "^5.0.0" + "@ethersproject/providers" "^5.0.0" + "@ethersproject/random" "^5.0.0" + "@ethersproject/rlp" "^5.0.0" + "@ethersproject/sha2" "^5.0.0" + "@ethersproject/signing-key" "^5.0.0" + "@ethersproject/solidity" "^5.0.0" + "@ethersproject/strings" "^5.0.0" + "@ethersproject/transactions" "^5.0.0" + "@ethersproject/units" "^5.0.0" + "@ethersproject/wallet" "^5.0.0" + "@ethersproject/web" "^5.0.0" + "@ethersproject/wordlists" "^5.0.0" + +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + +execa@^3.0.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-3.4.0.tgz#c08ed4550ef65d858fac269ffc8572446f37eb89" + integrity sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + human-signals "^1.1.1" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.0" + onetime "^5.1.0" + p-finally "^2.0.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + +execa@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" + integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + human-signals "^1.1.1" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.0" + onetime "^5.1.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + +explain-error@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/explain-error/-/explain-error-1.0.4.tgz#a793d3ac0cad4c6ab571e9968fbbab6cb2532929" + integrity sha1-p5PTrAytTGq1cemWj7urbLJTKSk= + +fast-fifo@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.0.0.tgz#9bc72e6860347bb045a876d1c5c0af11e9b984e7" + integrity sha512-4VEXmjxLj7sbs8J//cn2qhRap50dGzF5n8fjay8mau+Jn4hxSeR3xPFwxMaQq/pDaq7+KQk0PAbC2+nWDkJrmQ== + +fast-memoize@^2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/fast-memoize/-/fast-memoize-2.5.2.tgz#79e3bb6a4ec867ea40ba0e7146816f6cdce9b57e" + integrity sha512-Ue0LwpDYErFbmNnZSF0UH6eImUwDmogUO1jyE+JbN2gsQz/jICm1Ve7t9QT0rNSsfJt+Hs4/S3GnsDVjL4HVrw== + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +follow-redirects@1.5.10: + version "1.5.10" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" + integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== + dependencies: + debug "=3.1.0" + +follow-redirects@^1.10.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43" + integrity sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg== + +foreach@2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.4.tgz#cc5d0d8ae1d46cc9a555c2682f910977859935df" + integrity sha1-zF0NiuHUbMmlVcJoL5EJd4WZNd8= + +foreach@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= + +form-data@^2.4.0: + version "2.5.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4" + integrity sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +fs-extra@9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.1.tgz#910da0062437ba4c39fedd863f1675ccfefcb9fc" + integrity sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^1.0.0" + +fs-extra@^9.0.1: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + +fs-jetpack@^2.2.2: + version "2.4.0" + resolved "https://registry.yarnpkg.com/fs-jetpack/-/fs-jetpack-2.4.0.tgz#6080c4ab464a019d37a404baeb47f32af8835026" + integrity sha512-S/o9Dd7K9A7gicVU32eT8G0kHcmSu0rCVdP79P0MWInKFb8XpTc8Syhoo66k9no+HDshtlh4pUJTws8X+8fdFQ== + dependencies: + minimatch "^3.0.2" + rimraf "^2.6.3" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +fsevents@~2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + +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== + +get-intrinsic@^1.0.2, get-intrinsic@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" + integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + +get-iterator@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/get-iterator/-/get-iterator-1.0.2.tgz#cd747c02b4c084461fac14f48f6b45a80ed25c82" + integrity sha512-v+dm9bNVfOYsY1OrhaCrmyOcYoSeVvbt+hHZ0Au+T+p1y+0Uyj9aMaGIeUTT6xdpRbWzDeYKvfOslPhggQMcsg== + +get-stream@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" + integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== + dependencies: + pump "^3.0.0" + +glob-parent@~5.1.0: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob@^7.1.3: + version "7.1.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" + integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globalthis@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.2.tgz#2a235d34f4d8036219f7e34929b5de9e18166b8b" + integrity sha512-ZQnSFO1la8P7auIOQECnm0sSuoMeaSq0EEdXMBFF2QJO4uNcwbyhSgG3MruWNbFTqCLmxVwGOl7LZ9kASvHdeQ== + dependencies: + define-properties "^1.1.3" + +gluegun@4.6.1: + version "4.6.1" + resolved "https://registry.yarnpkg.com/gluegun/-/gluegun-4.6.1.tgz#f2a65d20378873de87a2143b8c3939ffc9a9e2b6" + integrity sha512-Jd5hV1Uku2rjBg59mYA/bnwLwynK7u9A1zmK/LIb/p5d3pzjDCKRjWFuxZXyPwl9rsvKGhJUQxkFo2HEy8crKQ== + dependencies: + apisauce "^2.0.1" + app-module-path "^2.2.0" + cli-table3 "~0.5.0" + colors "^1.3.3" + cosmiconfig "6.0.0" + cross-spawn "^7.0.0" + ejs "^2.6.1" + enquirer "2.3.4" + execa "^3.0.0" + fs-jetpack "^2.2.2" + lodash.camelcase "^4.3.0" + lodash.kebabcase "^4.1.1" + lodash.lowercase "^4.3.0" + lodash.lowerfirst "^4.3.1" + lodash.pad "^4.5.1" + lodash.padend "^4.6.1" + lodash.padstart "^4.6.1" + lodash.repeat "^4.1.0" + lodash.snakecase "^4.1.1" + lodash.startcase "^4.4.0" + lodash.trim "^4.5.1" + lodash.trimend "^4.5.1" + lodash.trimstart "^4.5.1" + lodash.uppercase "^4.3.0" + lodash.upperfirst "^4.3.1" + ora "^4.0.0" + pluralize "^8.0.0" + ramdasauce "^2.1.0" + semver "^7.0.0" + which "^2.0.0" + yargs-parser "^16.1.0" + +graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.6" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" + integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== + +graphql-json-transform@^1.1.0-alpha.0: + version "1.1.0-alpha.0" + resolved "https://registry.yarnpkg.com/graphql-json-transform/-/graphql-json-transform-1.1.0-alpha.0.tgz#fb0c88d24840067e6c55ac64bbc8d4e5de245d2d" + integrity sha512-I6lR/lYEezSz4iru0f7a/wR8Rzi3pCafk7S0bX2b/WQOtK0vKabxLShGBXIslsi0arMehIjvOPHJl7MpOUqj0w== + +graphql-schema-cycles@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/graphql-schema-cycles/-/graphql-schema-cycles-1.1.2.tgz#925d65d774d296238620aaedc391f26a9e46eb33" + integrity sha512-0I1pOOZZ8MhcNvhvYVRBIGnco8Q4EWfRYJ8vBuGEajuEuSXhC340Tasx7so1jjSphk+48kaoXy2+LNaTnEaSjA== + dependencies: + graphql "15.5.0" + graphql-json-transform "^1.1.0-alpha.0" + +graphql-tag@2.10.4: + version "2.10.4" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.4.tgz#2f301a98219be8b178a6453bb7e33b79b66d8f83" + integrity sha512-O7vG5BT3w6Sotc26ybcvLKNTdfr4GfsIVMD+LdYqXCeJIYPRyp8BIsDOUtxw7S1PYvRw5vH3278J2EDezR6mfA== + +graphql-tag@2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.11.0.tgz#1deb53a01c46a7eb401d6cb59dec86fa1cccbffd" + integrity sha512-VmsD5pJqWJnQZMUeRwrDhfgoyqcfwEkvtpANqcoUG8/tOLkwNgU9mzub/Mc78OJMhHjx7gfAMTxzdG43VGg3bA== + +graphql@15.5.0: + version "15.5.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.5.0.tgz#39d19494dbe69d1ea719915b578bf920344a69d5" + integrity sha512-OmaM7y0kaK31NKG31q4YbD2beNYa6jBBKtMFT6gLYJljHLJr42IqJ8KX08u3Li/0ifzTU5HjmoOOrwa5BRLeDA== + +has-bigints@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" + integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-flag@^4.0.0: + version "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.1, has-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" + integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== + +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.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + +hexer@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/hexer/-/hexer-1.5.0.tgz#b86ce808598e8a9d1892c571f3cedd86fc9f0653" + integrity sha1-uGzoCFmOip0YksVx887dhvyfBlM= + dependencies: + ansi-color "^0.2.1" + minimist "^1.1.0" + process "^0.10.0" + xtend "^4.0.0" + +hmac-drbg@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + +human-signals@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" + integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== + +iconv-lite@^0.6.2: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + +ieee754@^1.1.13, ieee754@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +import-fresh@^3.1.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +indexof@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" + integrity sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +intl-messageformat-parser@6.4.2: + version "6.4.2" + resolved "https://registry.yarnpkg.com/intl-messageformat-parser/-/intl-messageformat-parser-6.4.2.tgz#e2d28c3156c27961ead9d613ca55b6a155078d7d" + integrity sha512-IVNGy24lNEYr/KPWId5tF3KXRHFFbMgzIMI4kUonNa/ide2ywUYyBuOUro1IBGZJqjA2ncBVUyXdYKlMfzqpAA== + dependencies: + "@formatjs/ecma402-abstract" "1.6.2" + tslib "^2.1.0" + +intl-messageformat@9.5.2: + version "9.5.2" + resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-9.5.2.tgz#e72d32152c760b7411e413780e462909987c005a" + integrity sha512-sBGXcSQLyBuBA/kzAYhTpzhzkOGfSwGIau2W6FuwLZk0JE+VF3C+y0077FhVDOcRSi60iSfWzT8QC3Z7//dFxw== + dependencies: + fast-memoize "^2.5.2" + intl-messageformat-parser "6.4.2" + tslib "^2.1.0" + +invert-kv@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-3.0.1.tgz#a93c7a3d4386a1dc8325b97da9bb1620c0282523" + integrity sha512-CYdFeFexxhv/Bcny+Q0BfOV+ltRlJcd4BBZBYFX/O0u4npJrgZtIcjokegtiSMAvlMTJ+Koq0GBCc//3bueQxw== + +ip-regex@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5" + integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q== + +ipfs-core-utils@^0.5.4: + version "0.5.4" + resolved "https://registry.yarnpkg.com/ipfs-core-utils/-/ipfs-core-utils-0.5.4.tgz#c7fa508562086be65cebb51feb13c58abbbd3d8d" + integrity sha512-V+OHCkqf/263jHU0Fc9Rx/uDuwlz3PHxl3qu6a5ka/mNi6gucbFuI53jWsevCrOOY9giWMLB29RINGmCV5dFeQ== + dependencies: + any-signal "^2.0.0" + blob-to-it "^1.0.1" + browser-readablestream-to-it "^1.0.1" + cids "^1.0.0" + err-code "^2.0.3" + ipfs-utils "^5.0.0" + it-all "^1.0.4" + it-map "^1.0.4" + it-peekable "^1.0.1" + multiaddr "^8.0.0" + multiaddr-to-uri "^6.0.0" + parse-duration "^0.4.4" + timeout-abort-controller "^1.1.1" + uint8arrays "^1.1.0" + +ipfs-http-client@48.1.3: + version "48.1.3" + resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-48.1.3.tgz#d9b91b1f65d54730de92290d3be5a11ef124b400" + integrity sha512-+JV4cdMaTvYN3vd4r6+mcVxV3LkJXzc4kn2ToVbObpVpdqmG34ePf1KlvFF8A9gjcel84WpiP5xCEV/IrisPBA== + dependencies: + any-signal "^2.0.0" + bignumber.js "^9.0.0" + cids "^1.0.0" + debug "^4.1.1" + form-data "^3.0.0" + ipfs-core-utils "^0.5.4" + ipfs-utils "^5.0.0" + ipld-block "^0.11.0" + ipld-dag-cbor "^0.17.0" + ipld-dag-pb "^0.20.0" + ipld-raw "^6.0.0" + it-last "^1.0.4" + it-map "^1.0.4" + it-tar "^1.2.2" + it-to-stream "^0.1.2" + merge-options "^2.0.0" + multiaddr "^8.0.0" + multibase "^3.0.0" + multicodec "^2.0.1" + multihashes "^3.0.1" + nanoid "^3.1.12" + native-abort-controller "~0.0.3" + parse-duration "^0.4.4" + stream-to-it "^0.2.2" + uint8arrays "^1.1.0" + +ipfs-utils@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ipfs-utils/-/ipfs-utils-5.0.1.tgz#7c0053d5e77686f45577257a73905d4523e6b4f7" + integrity sha512-28KZPgO4Uf5duT2ORLAYfboUp98iUshDD7yRAfbNxNAR8Dtidfn6o20rZfoXnkri2zKBVIPlJkuCPmPJB+6erg== + dependencies: + abort-controller "^3.0.0" + any-signal "^2.1.0" + buffer "^6.0.1" + electron-fetch "^1.7.2" + err-code "^2.0.0" + fs-extra "^9.0.1" + is-electron "^2.2.0" + iso-url "^1.0.0" + it-glob "0.0.10" + it-to-stream "^0.1.2" + merge-options "^2.0.0" + nanoid "^3.1.3" + native-abort-controller "0.0.3" + native-fetch "^2.0.0" + node-fetch "^2.6.0" + stream-to-it "^0.2.0" + +ipld-block@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/ipld-block/-/ipld-block-0.11.1.tgz#c3a7b41aee3244187bd87a73f980e3565d299b6e" + integrity sha512-sDqqLqD5qh4QzGq6ssxLHUCnH4emCf/8F8IwjQM2cjEEIEHMUj57XhNYgmGbemdYPznUhffxFGEHsruh5+HQRw== + dependencies: + cids "^1.0.0" + +ipld-dag-cbor@^0.17.0: + version "0.17.1" + resolved "https://registry.yarnpkg.com/ipld-dag-cbor/-/ipld-dag-cbor-0.17.1.tgz#842e6c250603e5791049168831a425ec03471fb1" + integrity sha512-Bakj/cnxQBdscORyf4LRHxQJQfoaY8KWc7PWROQgX+aw5FCzBt8ga0VM/59K+ABOznsqNvyLR/wz/oYImOpXJw== + dependencies: + borc "^2.1.2" + cids "^1.0.0" + is-circular "^1.0.2" + multicodec "^3.0.1" + multihashing-async "^2.0.0" + uint8arrays "^2.1.3" + +ipld-dag-pb@^0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/ipld-dag-pb/-/ipld-dag-pb-0.20.0.tgz#025c0343aafe6cb9db395dd1dc93c8c60a669360" + integrity sha512-zfM0EdaolqNjAxIrtpuGKvXxWk5YtH9jKinBuQGTcngOsWFQhyybGCTJHGNGGtRjHNJi2hz5Udy/8pzv4kcKyg== + dependencies: + cids "^1.0.0" + class-is "^1.1.0" + multicodec "^2.0.0" + multihashing-async "^2.0.0" + protons "^2.0.0" + reset "^0.1.0" + run "^1.4.0" + stable "^0.1.8" + uint8arrays "^1.0.0" + +ipld-raw@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/ipld-raw/-/ipld-raw-6.0.0.tgz#74d947fcd2ce4e0e1d5bb650c1b5754ed8ea6da0" + integrity sha512-UK7fjncAzs59iu/o2kwYtb8jgTtW6B+cNWIiNpAJkfRwqoMk1xD/6i25ktzwe4qO8gQgoR9RxA5ibC23nq8BLg== + dependencies: + cids "^1.0.0" + multicodec "^2.0.0" + multihashing-async "^2.0.0" + +is-arguments@^1.0.4: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.0.tgz#62353031dfbee07ceb34656a6bde59efecae8dd9" + integrity sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg== + dependencies: + call-bind "^1.0.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + +is-bigint@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.2.tgz#ffb381442503235ad245ea89e45b3dbff040ee5a" + integrity sha512-0JV5+SOCQkIdzjBK9buARcV804Ddu7A0Qet6sHi3FimE9ne6m4BGQZfRn+NZiXbBk4F4XmHfDZIipLj9pX8dSA== + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-boolean-object@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.1.tgz#3c0878f035cb821228d350d2e1e36719716a3de8" + integrity sha512-bXdQWkECBUIAcCkeH1unwJLIpZYaa5VvuygSyS/c2lf719mTKZDU5UdDRlpd01UjADgmW8RfqaP+mRaVPdr/Ng== + dependencies: + call-bind "^1.0.2" + +is-callable@^1.1.4, is-callable@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" + integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ== + +is-circular@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-circular/-/is-circular-1.0.2.tgz#2e0ab4e9835f4c6b0ea2b9855a84acd501b8366c" + integrity sha512-YttjnrswnUYRVJvxCvu8z+PGMUSzC2JttP0OEXezlAEdp3EXzhf7IZ3j0gRAybJBQupedIZFhY61Tga6E0qASA== + +is-date-object@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.4.tgz#550cfcc03afada05eea3dd30981c7b09551f73e5" + integrity sha512-/b4ZVsG7Z5XVtIxs/h9W8nvfLgSAyKYdtGWQLbqy6jA1icmgjf8WCoTKgeS4wy5tYaPePouzFMANbnj94c2Z+A== + +is-electron@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-electron/-/is-electron-2.2.0.tgz#8943084f09e8b731b3a7a0298a7b5d56f6b7eef0" + integrity sha512-SpMppC2XR3YdxSzczXReBjqs2zGscWQpBIKqwXYBFic0ERaxNVgwLCHwOLZeESfdJQjX0RDvrJ1lBXX2ij+G1Q== + +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-generator-function@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.9.tgz#e5f82c2323673e7fcad3d12858c83c4039f6399c" + integrity sha512-ZJ34p1uvIfptHCN7sFTjGibB9/oBg17sHqzDLfuwhvmN/qLVvIQXRQ8licZQ35WJ8KuEQt/etnnzQFI9C9Ue/A== + +is-glob@^4.0.1, 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-interactive@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" + integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== + +is-ip@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/is-ip/-/is-ip-3.1.0.tgz#2ae5ddfafaf05cb8008a62093cf29734f657c5d8" + integrity sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q== + dependencies: + ip-regex "^4.0.0" + +is-ipfs@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-ipfs/-/is-ipfs-1.0.3.tgz#4b8c4995c46beac38f0c05f8cecd77093dd6a6b3" + integrity sha512-7SAfhxp39rxMvr95qjHMtsle1xa7zXpIbhX/Q77iXKtMVnQ0Fr9AVpAUq+bl3HPXGXDpZJFP0hzWBZaMwD6vGg== + dependencies: + buffer "^5.6.0" + cids "~0.8.0" + iso-url "~0.4.7" + mafmt "^7.1.0" + multiaddr "^7.4.3" + multibase "~0.7.0" + multihashes "~0.4.19" + +is-negative-zero@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" + integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== + +is-number-object@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.5.tgz#6edfaeed7950cff19afedce9fbfca9ee6dd289eb" + integrity sha512-RU0lI/n95pMoUKu9v1BZP5MBcZuNSVJkMkAG2dJqC4z2GlkGUNeH68SuHuBKBD/XFe+LHZ+f9BKkLET60Niedw== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-plain-obj@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + +is-regex@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.3.tgz#d029f9aff6448b93ebbe3f33dac71511fdcbef9f" + integrity sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ== + dependencies: + call-bind "^1.0.2" + has-symbols "^1.0.2" + +is-stream@^2.0.0: + version "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, is-string@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.6.tgz#3fe5d5992fb0d93404f32584d4b0179a71b54a5f" + integrity sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w== + +is-symbol@^1.0.2, is-symbol@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" + integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== + dependencies: + has-symbols "^1.0.2" + +is-typed-array@^1.1.3: + version "1.1.5" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.5.tgz#f32e6e096455e329eb7b423862456aa213f0eb4e" + integrity sha512-S+GRDgJlR3PyEbsX/Fobd9cqpZBuvUS+8asRqYDMLCb2qMzt1oz5m5oxQCxOgUDxiWsOVNi4yaF+/uvdlHlYug== + dependencies: + available-typed-arrays "^1.0.2" + call-bind "^1.0.2" + es-abstract "^1.18.0-next.2" + foreach "^2.0.5" + has-symbols "^1.0.1" + +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +iso-constants@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/iso-constants/-/iso-constants-0.1.2.tgz#3d2456ed5aeaa55d18564f285ba02a47a0d885b4" + integrity sha512-OTCM5ZCQsHBCI4Wdu4tSxvDIkmDHd5EwJDps5mKqnQnWJSKlnwMs3EDZ4n3Fh1tmkWkDlyd2vCDbEYuPbyrUNQ== + +iso-url@^1.0.0: + version "1.1.5" + resolved "https://registry.yarnpkg.com/iso-url/-/iso-url-1.1.5.tgz#875a0f2bf33fa1fc200f8d89e3f49eee57a8f0d9" + integrity sha512-+3JqoKdBTGmyv9vOkS6b9iHhvK34UajfTibrH/1HOK8TI7K2VsM0qOCd+aJdWKtSOA8g3PqZfcwDmnR0p3klqQ== + +iso-url@~0.4.7: + version "0.4.7" + resolved "https://registry.yarnpkg.com/iso-url/-/iso-url-0.4.7.tgz#de7e48120dae46921079fe78f325ac9e9217a385" + integrity sha512-27fFRDnPAMnHGLq36bWTpKET+eiXct3ENlCcdcMdk+mjXrb2kw3mhBUg1B7ewAC0kVzlOPhADzQgz1SE6Tglog== + +it-all@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/it-all/-/it-all-1.0.5.tgz#e880510d7e73ebb79063a76296a2eb3cb77bbbdb" + integrity sha512-ygD4kA4vp8fi+Y+NBgEKt6W06xSbv6Ub/0V8d1r3uCyJ9Izwa1UspkIOlqY9fOee0Z1w3WRo1+VWyAU4DgtufA== + +it-concat@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/it-concat/-/it-concat-1.0.3.tgz#84db9376e4c77bf7bc1fd933bb90f184e7cef32b" + integrity sha512-sjeZQ1BWQ9U/W2oI09kZgUyvSWzQahTkOkLIsnEPgyqZFaF9ME5gV6An4nMjlyhXKWQMKEakQU8oRHs2SdmeyA== + dependencies: + bl "^4.0.0" + +it-glob@0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/it-glob/-/it-glob-0.0.10.tgz#4defd9286f693847c3ff483d2ff65f22e1359ad8" + integrity sha512-p1PR15djgPV7pxdLOW9j4WcJdla8+91rJdUU2hU2Jm68vkxpIEXK55VHBeH8Lvqh2vqLtM83t8q4BuJxue6niA== + dependencies: + fs-extra "^9.0.1" + minimatch "^3.0.4" + +it-last@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/it-last/-/it-last-1.0.5.tgz#5c711c7d58948bcbc8e0cb129af3a039ba2a585b" + integrity sha512-PV/2S4zg5g6dkVuKfgrQfN2rUN4wdTI1FzyAvU+i8RV96syut40pa2s9Dut5X7SkjwA3P0tOhLABLdnOJ0Y/4Q== + +it-map@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/it-map/-/it-map-1.0.5.tgz#2f6a9b8f0ba1ed1aeadabf86e00b38c73a1dc299" + integrity sha512-EElupuWhHVStUgUY+OfTJIS2MZed96lDrAXzJUuqiiqLnIKoBRqtX1ZG2oR0bGDsSppmz83MtzCeKLZ9TVAUxQ== + +it-peekable@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/it-peekable/-/it-peekable-1.0.2.tgz#3b2c7948b765f35b3bb07abbb9b2108c644e73c1" + integrity sha512-LRPLu94RLm+lxLZbChuc9iCXrKCOu1obWqxfaKhF00yIp30VGkl741b5P60U+rdBxuZD/Gt1bnmakernv7bVFg== + +it-reader@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/it-reader/-/it-reader-2.1.0.tgz#b1164be343f8538d8775e10fb0339f61ccf71b0f" + integrity sha512-hSysqWTO9Tlwc5EGjVf8JYZzw0D2FsxD/g+eNNWrez9zODxWt6QlN6JAMmycK72Mv4jHEKEXoyzUN4FYGmJaZw== + dependencies: + bl "^4.0.0" + +it-tar@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/it-tar/-/it-tar-1.2.2.tgz#8d79863dad27726c781a4bcc491f53c20f2866cf" + integrity sha512-M8V4a9I+x/vwXTjqvixcEZbQZHjwDIb8iUQ+D4M2QbhAdNs3WKVSl+45u5/F2XFx6jYMFOGzMVlKNK/uONgNIA== + dependencies: + bl "^4.0.0" + buffer "^5.4.3" + iso-constants "^0.1.2" + it-concat "^1.0.0" + it-reader "^2.0.0" + p-defer "^3.0.0" + +it-to-stream@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/it-to-stream/-/it-to-stream-0.1.2.tgz#7163151f75b60445e86b8ab1a968666acaacfe7b" + integrity sha512-DTB5TJRZG3untmZehcaFN0kGWl2bNv7tnJRgQHAO9QEt8jfvVRrebZtnD5NZd4SCj4WVPjl0LSrugNWE/UaZRQ== + dependencies: + buffer "^5.6.0" + fast-fifo "^1.0.0" + get-iterator "^1.0.2" + p-defer "^3.0.0" + p-fifo "^1.0.0" + readable-stream "^3.6.0" + +iterable-ndjson@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/iterable-ndjson/-/iterable-ndjson-1.1.0.tgz#36f7e8a5bb04fd087d384f29e44fc4280fc014fc" + integrity sha512-OOp1Lb0o3k5MkXHx1YaIY5Z0ELosZfTnBaas9f8opJVcZGBIONA2zY/6CYE+LKkqrSDooIneZbrBGgOZnHPkrg== + dependencies: + string_decoder "^1.2.0" + +jaeger-client@^3.15.0: + version "3.18.1" + resolved "https://registry.yarnpkg.com/jaeger-client/-/jaeger-client-3.18.1.tgz#a8c7a778244ba117f4fb8775eb6aa5508703564e" + integrity sha512-eZLM2U6rJvYo0XbzQYFeMYfp29gQix7SKlmDReorp9hJkUwXZtTyxW81AcKdmFCjLHO5tFysTX+394BnjEnUZg== + dependencies: + node-int64 "^0.4.0" + opentracing "^0.14.4" + thriftrw "^3.5.0" + uuid "^3.2.1" + xorshift "^0.2.0" + +js-sha3@0.5.7: + version "0.5.7" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" + integrity sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc= + +js-sha3@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" + integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@3.14.0: + version "3.14.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" + integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json-text-sequence@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/json-text-sequence/-/json-text-sequence-0.1.1.tgz#a72f217dc4afc4629fff5feb304dc1bd51a2f3d2" + integrity sha1-py8hfcSvxGKf/1/rME3BvVGi89I= + dependencies: + delimit-stream "0.1.0" + +json3@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.0.tgz#0e9e7f6c5d270b758929af4d6fefdc84bd66e259" + integrity sha1-Dp5/bF0nC3WJKa9Nb+/chL1m4lk= + +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + +jsonschema@1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jsonschema/-/jsonschema-1.4.0.tgz#1afa34c4bc22190d8e42271ec17ac8b3404f87b2" + integrity sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw== + +lcid@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-3.1.1.tgz#9030ec479a058fc36b5e8243ebaac8b6ac582fd0" + integrity sha512-M6T051+5QCGLBQb8id3hdvIW8+zeFV2FyBGFS9IEK5H9Wt4MueD4bW1eWikpHgZp+5xR3l5c8pZUkQsIA0BFZg== + dependencies: + invert-kv "^3.0.0" + +lines-and-columns@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= + +lodash.camelcase@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" + integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= + +lodash.kebabcase@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" + integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY= + +lodash.lowercase@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.lowercase/-/lodash.lowercase-4.3.0.tgz#46515aced4acb0b7093133333af068e4c3b14e9d" + integrity sha1-RlFaztSssLcJMTMzOvBo5MOxTp0= + +lodash.lowerfirst@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/lodash.lowerfirst/-/lodash.lowerfirst-4.3.1.tgz#de3c7b12e02c6524a0059c2f6cb7c5c52655a13d" + integrity sha1-3jx7EuAsZSSgBZwvbLfFxSZVoT0= + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash.pad@^4.5.1: + version "4.5.1" + resolved "https://registry.yarnpkg.com/lodash.pad/-/lodash.pad-4.5.1.tgz#4330949a833a7c8da22cc20f6a26c4d59debba70" + integrity sha1-QzCUmoM6fI2iLMIPaibE1Z3runA= + +lodash.padend@^4.6.1: + version "4.6.1" + resolved "https://registry.yarnpkg.com/lodash.padend/-/lodash.padend-4.6.1.tgz#53ccba047d06e158d311f45da625f4e49e6f166e" + integrity sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4= + +lodash.padstart@^4.6.1: + version "4.6.1" + resolved "https://registry.yarnpkg.com/lodash.padstart/-/lodash.padstart-4.6.1.tgz#d2e3eebff0d9d39ad50f5cbd1b52a7bce6bb611b" + integrity sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs= + +lodash.repeat@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/lodash.repeat/-/lodash.repeat-4.1.0.tgz#fc7de8131d8c8ac07e4b49f74ffe829d1f2bec44" + integrity sha1-/H3oEx2MisB+S0n3T/6CnR8r7EQ= + +lodash.snakecase@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d" + integrity sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40= + +lodash.startcase@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.startcase/-/lodash.startcase-4.4.0.tgz#9436e34ed26093ed7ffae1936144350915d9add8" + integrity sha1-lDbjTtJgk+1/+uGTYUQ1CRXZrdg= + +lodash.trim@^4.5.1: + version "4.5.1" + resolved "https://registry.yarnpkg.com/lodash.trim/-/lodash.trim-4.5.1.tgz#36425e7ee90be4aa5e27bcebb85b7d11ea47aa57" + integrity sha1-NkJefukL5KpeJ7zruFt9EepHqlc= + +lodash.trimend@^4.5.1: + version "4.5.1" + resolved "https://registry.yarnpkg.com/lodash.trimend/-/lodash.trimend-4.5.1.tgz#12804437286b98cad8996b79414e11300114082f" + integrity sha1-EoBENyhrmMrYmWt5QU4RMAEUCC8= + +lodash.trimstart@^4.5.1: + version "4.5.1" + resolved "https://registry.yarnpkg.com/lodash.trimstart/-/lodash.trimstart-4.5.1.tgz#8ff4dec532d82486af59573c39445914e944a7f1" + integrity sha1-j/TexTLYJIavWVc8OURZFOlEp/E= + +lodash.uppercase@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.uppercase/-/lodash.uppercase-4.3.0.tgz#c404abfd1469f93931f9bb24cf6cc7d57059bc73" + integrity sha1-xASr/RRp+Tkx+bskz2zH1XBZvHM= + +lodash.upperfirst@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce" + integrity sha1-E2Xt9DFIBIHvDRxolXpe2Z1J984= + +log-symbols@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4" + integrity sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ== + dependencies: + chalk "^2.4.2" + +long@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/long/-/long-2.4.0.tgz#9fa180bb1d9500cdc29c4156766a1995e1f4524f" + integrity sha1-n6GAux2VAM3CnEFWdmoZleH0Uk8= + +long@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +mafmt@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/mafmt/-/mafmt-7.1.0.tgz#4126f6d0eded070ace7dbbb6fb04977412d380b5" + integrity sha512-vpeo9S+hepT3k2h5iFxzEHvvR0GPBx9uKaErmnRzYNcaKb03DgOArjEMlgG4a9LcuZZ89a3I8xbeto487n26eA== + dependencies: + multiaddr "^7.3.0" + +map-age-cleaner@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" + integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== + dependencies: + p-defer "^1.0.0" + +mem@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/mem/-/mem-5.1.1.tgz#7059b67bf9ac2c924c9f1cff7155a064394adfb3" + integrity sha512-qvwipnozMohxLXG1pOqoLiZKNkC4r4qqRucSoDwXowsNGDSULiqFTRUF05vcZWnwJSG22qTsynQhxbaMtnX9gw== + dependencies: + map-age-cleaner "^0.1.3" + mimic-fn "^2.1.0" + p-is-promise "^2.1.0" + +merge-options@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-options/-/merge-options-2.0.0.tgz#36ca5038badfc3974dbde5e58ba89d3df80882c3" + integrity sha512-S7xYIeWHl2ZUKF7SDeBhGg6rfv5bKxVBdk95s/I7wVF8d+hjLSztJ/B271cnUiF6CAFduEQ5Zn3HYwAjT16DlQ== + dependencies: + is-plain-obj "^2.0.0" + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +mime-db@1.48.0: + version "1.48.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.48.0.tgz#e35b31045dd7eada3aaad537ed88a33afbef2d1d" + integrity sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ== + +mime-types@^2.1.12: + version "2.1.31" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.31.tgz#a00d76b74317c61f9c2db2218b8e9f8e9c5c9e6b" + integrity sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg== + dependencies: + mime-db "1.48.0" + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= + +minimatch@*, minimatch@^3.0.2, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@^1.1.0: + version "1.2.5" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +ms@^2.1.1: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +multiaddr-to-uri@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/multiaddr-to-uri/-/multiaddr-to-uri-6.0.0.tgz#8f08a75c6eeb2370d5d24b77b8413e3f0fa9bcc0" + integrity sha512-OjpkVHOXEmIKMO8WChzzQ7aZQcSQX8squxmvtDbRpy7/QNmJ3Z7jv6qyD74C28QtaeNie8O8ngW2AkeiMmKP7A== + dependencies: + multiaddr "^8.0.0" + +multiaddr@^7.3.0, multiaddr@^7.4.3: + version "7.5.0" + resolved "https://registry.yarnpkg.com/multiaddr/-/multiaddr-7.5.0.tgz#976c88e256e512263445ab03b3b68c003d5f485e" + integrity sha512-GvhHsIGDULh06jyb6ev+VfREH9evJCFIRnh3jUt9iEZ6XDbyoisZRFEI9bMvK/AiR6y66y6P+eoBw9mBYMhMvw== + dependencies: + buffer "^5.5.0" + cids "~0.8.0" + class-is "^1.1.0" + is-ip "^3.1.0" + multibase "^0.7.0" + varint "^5.0.0" + +multiaddr@^8.0.0: + version "8.1.2" + resolved "https://registry.yarnpkg.com/multiaddr/-/multiaddr-8.1.2.tgz#74060ff8636ba1c01b2cf0ffd53950b852fa9b1f" + integrity sha512-r13IzW8+Sv9zab9Gt8RPMIN2WkptIPq99EpAzg4IbJ/zTELhiEwXWr9bAmEatSCI4j/LSA6ESJzvz95JZ+ZYXQ== + dependencies: + cids "^1.0.0" + class-is "^1.1.0" + dns-over-http-resolver "^1.0.0" + err-code "^2.0.3" + is-ip "^3.1.0" + multibase "^3.0.0" + uint8arrays "^1.1.0" + varint "^5.0.0" + +multibase@^0.7.0, multibase@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" + integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== + dependencies: + base-x "^3.0.8" + buffer "^5.5.0" + +multibase@^1.0.0, multibase@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/multibase/-/multibase-1.0.1.tgz#4adbe1de0be8a1ab0274328b653c3f1903476724" + integrity sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw== + dependencies: + base-x "^3.0.8" + buffer "^5.5.0" + +multibase@^3.0.0, multibase@^3.1.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/multibase/-/multibase-3.1.2.tgz#59314e1e2c35d018db38e4c20bb79026827f0f2f" + integrity sha512-bpklWHs70LO3smJUHOjcnzGceJJvn9ui0Vau6Za0B/GBepaXswmW8Ufea0uD9pROf/qCQ4N4lZ3sf3U+SNf0tw== + dependencies: + "@multiformats/base-x" "^4.0.1" + web-encoding "^1.0.6" + +multibase@^4.0.1: + version "4.0.4" + resolved "https://registry.yarnpkg.com/multibase/-/multibase-4.0.4.tgz#55ef53e6acce223c5a09341a8a3a3d973871a577" + integrity sha512-8/JmrdSGzlw6KTgAJCOqUBSGd1V6186i/X8dDCGy/lbCKrQ+1QB6f3HE+wPr7Tpdj4U3gutaj9jG2rNX6UpiJg== + dependencies: + "@multiformats/base-x" "^4.0.1" + +multibase@~0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.6.1.tgz#b76df6298536cc17b9f6a6db53ec88f85f8cc12b" + integrity sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw== + dependencies: + base-x "^3.0.8" + buffer "^5.5.0" + +multicodec@^1.0.0, multicodec@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-1.0.4.tgz#46ac064657c40380c28367c90304d8ed175a714f" + integrity sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg== + dependencies: + buffer "^5.6.0" + varint "^5.0.0" + +multicodec@^2.0.0, multicodec@^2.0.1: + version "2.1.3" + resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-2.1.3.tgz#b9850635ad4e2a285a933151b55b4a2294152a5d" + integrity sha512-0tOH2Gtio39uO41o+2xl9UhRkCWxU5ZmZSbFCh/OjGzkWJI8e6lkN/s4Mj1YfyWoBod+2+S3W+6wO6nhkwN8pA== + dependencies: + uint8arrays "1.1.0" + varint "^6.0.0" + +multicodec@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-3.0.1.tgz#94e043847ee11fcce92487609ac9010429a95e31" + integrity sha512-Y6j3wiPojvkF/z6KFIGt84KdJdP2oILEdzc/3YbD3qQ3EerhqtYlfsZTPPNVoCCxNZZdzIpCKrdYFSav17sIrQ== + dependencies: + uint8arrays "^2.1.3" + varint "^5.0.2" + +multihashes@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-1.0.1.tgz#a89415d68283cf6287c6e219e304e75ce7fb73fe" + integrity sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw== + dependencies: + buffer "^5.6.0" + multibase "^1.0.1" + varint "^5.0.0" + +multihashes@^3.0.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-3.1.2.tgz#ffa5e50497aceb7911f7b4a3b6cada9b9730edfc" + integrity sha512-AP4IoV/YzkNrfbQKZE3OMPibrmy350OmCd6cJkwyM8oExaXIlOY4UnOOVSQtAEuq/LR01XfXKCESidzZvSwHCQ== + dependencies: + multibase "^3.1.0" + uint8arrays "^2.0.5" + varint "^6.0.0" + +multihashes@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-4.0.2.tgz#d76aeac3a302a1bed9fe1ec964fb7a22fa662283" + integrity sha512-xpx++1iZr4ZQHjN1mcrXS6904R36LWLxX/CBifczjtmrtCXEX623DMWOF1eiNSg+pFpiZDFVBgou/4v6ayCHSQ== + dependencies: + multibase "^4.0.1" + uint8arrays "^2.1.3" + varint "^5.0.2" + +multihashes@~0.4.15, multihashes@~0.4.19: + version "0.4.21" + resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.21.tgz#dc02d525579f334a7909ade8a122dabb58ccfcb5" + integrity sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw== + dependencies: + buffer "^5.5.0" + multibase "^0.7.0" + varint "^5.0.0" + +multihashing-async@^2.0.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/multihashing-async/-/multihashing-async-2.1.2.tgz#9ed68f183bde70e0416b166bbc59a0c0623a0ede" + integrity sha512-FTPNnWWxwIK5dXXmTFhySSF8Fkdqf7vzqpV09+RWsmfUhrsL/b3Arg3+bRrBnXTtjxm3JRGI3wSAtQHL0QCxhQ== + dependencies: + blakejs "^1.1.0" + err-code "^3.0.0" + js-sha3 "^0.8.0" + multihashes "^4.0.1" + murmurhash3js-revisited "^3.0.0" + uint8arrays "^2.1.3" + +murmurhash3js-revisited@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz#6bd36e25de8f73394222adc6e41fa3fac08a5869" + integrity sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g== + +mustache@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.0.1.tgz#d99beb031701ad433338e7ea65e0489416c854a2" + integrity sha512-yL5VE97+OXn4+Er3THSmTdCFCtx5hHWzrolvH+JObZnUYwuaG7XV+Ch4fR2cIrcYI0tFHxS7iyFYl14bW8y2sA== + +mute-stream@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== + +nanoid@^3.1.12, nanoid@^3.1.3: + version "3.1.23" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81" + integrity sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw== + +native-abort-controller@0.0.3, native-abort-controller@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/native-abort-controller/-/native-abort-controller-0.0.3.tgz#4c528a6c9c7d3eafefdc2c196ac9deb1a5edf2f8" + integrity sha512-YIxU5nWqSHG1Xbu3eOu3pdFRD882ivQpIcu6AiPVe2oSVoRbfYW63DVkZm3g1gHiMtZSvZzF6THSzTGEBYl8YA== + dependencies: + globalthis "^1.0.1" + +native-abort-controller@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/native-abort-controller/-/native-abort-controller-1.0.3.tgz#35974a2e189c0d91399c8767a989a5bf058c1435" + integrity sha512-fd5LY5q06mHKZPD5FmMrn7Lkd2H018oBGKNOAdLpctBDEPFKsfJ1nX9ke+XRa8PEJJpjqrpQkGjq2IZ27QNmYA== + +native-fetch@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/native-fetch/-/native-fetch-2.0.1.tgz#319d53741a7040def92d5dc8ea5fe9416b1fad89" + integrity sha512-gv4Bea+ga9QdXINurpkEqun3ap3vnB+WYoe4c8ddqUYEH7B2h6iD39RF8uVN7OwmSfMY3RDxkvBnoI4e2/vLXQ== + dependencies: + globalthis "^1.0.1" + +native-fetch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/native-fetch/-/native-fetch-3.0.0.tgz#06ccdd70e79e171c365c75117959cf4fe14a09bb" + integrity sha512-G3Z7vx0IFb/FQ4JxvtqGABsOTIqRWvgQz6e+erkB+JJD6LrszQtMozEHI4EkmgZQvnGHrpLVzUWk7t4sJCIkVw== + +node-fetch@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +npm-run-path@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +object-inspect@^1.10.3: + version "1.10.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.10.3.tgz#c2aa7d2d09f50c99375704f7a0adf24c5782d369" + integrity sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw== + +object-keys@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.5.0.tgz#09e211f3e00318afc4f592e36e7cdc10d9ad7293" + integrity sha1-CeIR8+ADGK/E9ZLjbnzcENmtcpM= + +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.assign@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" + integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== + dependencies: + call-bind "^1.0.0" + define-properties "^1.1.3" + has-symbols "^1.0.1" + object-keys "^1.1.1" + +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" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^5.1.0: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +opentracing@^0.14.4: + version "0.14.5" + resolved "https://registry.yarnpkg.com/opentracing/-/opentracing-0.14.5.tgz#891fa92cd90a24e64f99bc964370227310926c85" + integrity sha512-XLKtEfHxqrWyF1fzxznsv78w3csW41ucHnjiKnfzZLD5FN8UBDZZL1i4q0FR29zjxXhm+2Hop+5Vr/b8tKIvEg== + +ora@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/ora/-/ora-4.0.0.tgz#374c4ee8c5fb91b5dbcd82de199f188d3e8fd5ec" + integrity sha512-2RaV0LWJgpWEjvpsW57H8pnzdVQJrtAr4VGk9cIqn58ePx5k1b0H3h9DS2Qj4cL1Cm012JSeg+7AcVNsis6AVQ== + dependencies: + chalk "^2.4.2" + cli-cursor "^3.1.0" + cli-spinners "^2.2.0" + is-interactive "^1.0.0" + log-symbols "^3.0.0" + strip-ansi "^5.2.0" + wcwidth "^1.0.1" + +ora@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ora/-/ora-4.1.1.tgz#566cc0348a15c36f5f0e979612842e02ba9dddbc" + integrity sha512-sjYP8QyVWBpBZWD6Vr1M/KwknSw6kJOz41tvGMlwWeClHBtYKTbHMki1PsLZnxKpXMPbTKv9b3pjQu3REib96A== + dependencies: + chalk "^3.0.0" + cli-cursor "^3.1.0" + cli-spinners "^2.2.0" + is-interactive "^1.0.0" + log-symbols "^3.0.0" + mute-stream "0.0.8" + strip-ansi "^6.0.0" + wcwidth "^1.0.1" + +os-locale@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-5.0.0.tgz#6d26c1d95b6597c5d5317bf5fba37eccec3672e0" + integrity sha512-tqZcNEDAIZKBEPnHPlVDvKrp7NzgLi7jRmhKiUoa2NUmhl13FtkAGLUVR+ZsYvApBQdBfYm43A4tXXQ4IrYLBA== + dependencies: + execa "^4.0.0" + lcid "^3.0.0" + mem "^5.0.0" + +p-defer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" + integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= + +p-defer@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-3.0.0.tgz#d1dceb4ee9b2b604b1d94ffec83760175d4e6f83" + integrity sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw== + +p-fifo@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-fifo/-/p-fifo-1.0.0.tgz#e29d5cf17c239ba87f51dde98c1d26a9cfe20a63" + integrity sha512-IjoCxXW48tqdtDFz6fqo5q1UfFVjjVZe8TC1QRflvNUJtNfCUhxOUw6MOVZhDPjqhSzc26xKdugsO17gmzd5+A== + dependencies: + fast-fifo "^1.0.0" + p-defer "^3.0.0" + +p-finally@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" + integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== + +p-is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" + integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== + +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-duration@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/parse-duration/-/parse-duration-0.4.4.tgz#11c0f51a689e97d06c57bd772f7fda7dc013243c" + integrity sha512-KbAJuYGUhZkB9gotDiKLnZ7Z3VTacK3fgwmDdB6ZVDtJbMBT6MfLga0WJaYpPDu0mzqT0NgHtHDt5PY4l0nidg== + +parse-json@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +picomatch@^2.0.4, picomatch@^2.2.1: + version "2.3.0" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" + integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== + +pluralize@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" + integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== + +process@^0.10.0: + version "0.10.1" + resolved "https://registry.yarnpkg.com/process/-/process-0.10.1.tgz#842457cc51cfed72dc775afeeafb8c6034372725" + integrity sha1-hCRXzFHP7XLcd1r+6vuMYDQ3JyU= + +protocol-buffers-schema@^3.3.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/protocol-buffers-schema/-/protocol-buffers-schema-3.5.1.tgz#8388e768d383ac8cbea23e1280dfadb79f4122ad" + integrity sha512-YVCvdhxWNDP8/nJDyXLuM+UFsuPk4+1PB7WGPVDzm3HTHbzFLxQYeW2iZpS4mmnXrQJGBzt230t/BbEb7PrQaw== + +protons@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/protons/-/protons-2.0.1.tgz#bfee5123c100001dcf56ab8f71b1b36f2e8289f1" + integrity sha512-FlmPorLEeCEDPu+uIn0Qardgiy5XqVA4IyNTz9wb9c0e2U7BEXdRcIbx64r09o4Abtf+4B7mkTtMbsIXMxZzKw== + dependencies: + protocol-buffers-schema "^3.3.1" + signed-varint "^2.0.1" + uint8arrays "^2.1.3" + varint "^5.0.0" + +pull-stream-to-async-iterator@^1.0.1, pull-stream-to-async-iterator@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pull-stream-to-async-iterator/-/pull-stream-to-async-iterator-1.0.2.tgz#5cc1a3a146ef6bbf01c17755647369b683b24986" + integrity sha512-c3KRs2EneuxP7b6pG9fvQTIjatf33RbIErhbQ75s5r2MI6E8R74NZC1nJgXc8kcmqiQxmr+TWY+WwK2mWaUnlA== + dependencies: + pull-stream "^3.6.9" + +pull-stream@^3.6.9: + version "3.6.14" + resolved "https://registry.yarnpkg.com/pull-stream/-/pull-stream-3.6.14.tgz#529dbd5b86131f4a5ed636fdf7f6af00781357ee" + integrity sha512-KIqdvpqHHaTUA2mCYcLG1ibEbu/LCKoJZsBWyv9lSYtPkJPBq8m3Hxa103xHi6D2thj5YXa0TqK3L3GUkwgnew== + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +querystring@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.1.tgz#40d77615bb09d16902a85c3e38aa8b5ed761c2dd" + integrity sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg== + +ramda@^0.24.1: + version "0.24.1" + resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.24.1.tgz#c3b7755197f35b8dc3502228262c4c91ddb6b857" + integrity sha1-w7d1UZfzW43DUCIoJixMkd22uFc= + +ramda@^0.25.0: + version "0.25.0" + resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.25.0.tgz#8fdf68231cffa90bc2f9460390a0cb74a29b29a9" + integrity sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ== + +ramdasauce@^2.1.0: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ramdasauce/-/ramdasauce-2.1.3.tgz#acb45ecc7e4fc4d6f39e19989b4a16dff383e9c2" + integrity sha512-Ml3CPim4SKwmg5g9UI77lnRSeKr/kQw7YhQ6rfdMcBYy6DMlwmkEwQqjygJ3OhxPR+NfFfpjKl3Tf8GXckaqqg== + dependencies: + ramda "^0.24.1" + +readable-stream@^3.4.0, readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readdirp@~3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" + integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ== + dependencies: + picomatch "^2.2.1" + +receptacle@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/receptacle/-/receptacle-1.3.2.tgz#a7994c7efafc7a01d0e2041839dab6c4951360d2" + integrity sha512-HrsFvqZZheusncQRiEE7GatOAETrARKV/lnfYicIm8lbvp/JQOdADOfhjBd2DajvoszEyxSM6RlAAIZgEoeu/A== + dependencies: + ms "^2.1.1" + +reset@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/reset/-/reset-0.1.0.tgz#9fc7314171995ae6cb0b7e58b06ce7522af4bafb" + integrity sha1-n8cxQXGZWubLC35YsGznUir0uvs= + +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== + +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + +retimer@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/retimer/-/retimer-2.0.0.tgz#e8bd68c5e5a8ec2f49ccb5c636db84c04063bbca" + integrity sha512-KLXY85WkEq2V2bKex/LOO1ViXVn2KGYe4PYysAdYdjmraYIUsVkXu8O4am+8+5UbaaGl1qho4aqAAPHNQ4GSbg== + +rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + +run@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/run/-/run-1.4.0.tgz#e17d9e9043ab2fe17776cb299e1237f38f0b4ffa" + integrity sha1-4X2ekEOrL+F3dsspnhI3848LT/o= + dependencies: + minimatch "*" + +safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +"safer-buffer@>= 2.1.2 < 3.0.0": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +scrypt-js@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" + integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== + +semver@7.3.4: + version "7.3.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" + integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + dependencies: + lru-cache "^6.0.0" + +semver@^7.0.0, semver@^7.1.3: + version "7.3.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" + integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== + dependencies: + lru-cache "^6.0.0" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +signal-exit@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" + integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== + +signed-varint@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/signed-varint/-/signed-varint-2.0.1.tgz#50a9989da7c98c2c61dad119bc97470ef8528129" + integrity sha1-UKmYnafJjCxh2tEZvJdHDvhSgSk= + dependencies: + varint "~5.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +stable@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf" + integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w== + +stream-to-it@^0.2.0, stream-to-it@^0.2.2: + version "0.2.3" + resolved "https://registry.yarnpkg.com/stream-to-it/-/stream-to-it-0.2.3.tgz#b9320ceb26a51b313de81036d4354d9b657f4d2d" + integrity sha512-xaK9EjPtLox5rrC7YLSBXSanTtUJN/lzJlMFvy9VaROmnyvy0U/X6m2uMhXPJRn3g3M9uOSIzTszW7BPiWSg9w== + dependencies: + get-iterator "^1.0.2" + +string-template@~0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add" + integrity sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0= + +string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string.prototype.trimend@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80" + integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + +string.prototype.trimstart@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" + integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + +string_decoder@^1.1.1, string_decoder@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-ansi@^5.2.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" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +thriftrw@^3.5.0: + version "3.12.0" + resolved "https://registry.yarnpkg.com/thriftrw/-/thriftrw-3.12.0.tgz#30857847755e7f036b2e0a79d11c9f55075539d9" + integrity sha512-4YZvR4DPEI41n4Opwr4jmrLGG4hndxr7387kzRFIIzxHQjarPusH4lGXrugvgb7TtPrfZVTpZCVe44/xUxowEw== + dependencies: + bufrw "^1.3.0" + error "7.0.2" + long "^2.4.0" + +timeout-abort-controller@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/timeout-abort-controller/-/timeout-abort-controller-1.1.1.tgz#2c3c3c66f13c783237987673c276cbd7a9762f29" + integrity sha512-BsF9i3NAJag6T0ZEjki9j654zoafI2X6ayuNd6Tp8+Ul6Tr5s4jo973qFeiWrRSweqvskC+AHDKUmIW4b7pdhQ== + dependencies: + abort-controller "^3.0.0" + retimer "^2.0.0" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tslib@^2.0.0, tslib@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c" + integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w== + +uint8arrays@1.1.0, uint8arrays@^1.0.0, uint8arrays@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-1.1.0.tgz#d034aa65399a9fd213a1579e323f0b29f67d0ed2" + integrity sha512-cLdlZ6jnFczsKf5IH1gPHTtcHtPGho5r4CvctohmQjw8K7Q3gFdfIGHxSTdTaCKrL4w09SsPRJTqRS0drYeszA== + dependencies: + multibase "^3.0.0" + web-encoding "^1.0.2" + +uint8arrays@^2.0.5, uint8arrays@^2.1.3: + version "2.1.5" + resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-2.1.5.tgz#9e6e6377a9463d5eba4620a3f0450f7eb389a351" + integrity sha512-CSR7AO+4AHUeSOnZ/NBNCElDeWfRh9bXtOck27083kc7SznmmHIhNEkEOCQOn0wvrIMjS3IH0TNLR16vuc46mA== + dependencies: + multibase "^4.0.1" + +unbox-primitive@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" + integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== + dependencies: + function-bind "^1.1.1" + has-bigints "^1.0.1" + has-symbols "^1.0.2" + which-boxed-primitive "^1.0.2" + +universalify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d" + integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug== + +universalify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" + integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== + +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +util-inspect@0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/util-inspect/-/util-inspect-0.1.8.tgz#2b39dbcd2d921f2d8430923caff40f4b5cea5db1" + integrity sha1-KznbzS2SHy2EMJI8r/QPS1zqXbE= + dependencies: + array-map "0.0.0" + array-reduce "0.0.0" + foreach "2.0.4" + indexof "0.0.1" + isarray "0.0.1" + json3 "3.3.0" + object-keys "0.5.0" + +util@^0.12.3: + version "0.12.4" + resolved "https://registry.yarnpkg.com/util/-/util-0.12.4.tgz#66121a31420df8f01ca0c464be15dfa1d1850253" + integrity sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw== + dependencies: + inherits "^2.0.3" + is-arguments "^1.0.4" + is-generator-function "^1.0.7" + is-typed-array "^1.1.3" + safe-buffer "^5.1.2" + which-typed-array "^1.1.2" + +uuid@^3.2.1: + version "3.4.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== + +varint@^5.0.0, varint@^5.0.2, varint@~5.0.0: + version "5.0.2" + resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" + integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== + +varint@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/varint/-/varint-6.0.0.tgz#9881eb0ce8feaea6512439d19ddf84bf551661d0" + integrity sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg== + +wcwidth@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" + integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= + dependencies: + defaults "^1.0.3" + +web-encoding@^1.0.2, web-encoding@^1.0.6: + version "1.1.5" + resolved "https://registry.yarnpkg.com/web-encoding/-/web-encoding-1.1.5.tgz#fc810cf7667364a6335c939913f5051d3e0c4864" + integrity sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA== + dependencies: + util "^0.12.3" + optionalDependencies: + "@zxing/text-encoding" "0.9.0" + +web-worker@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.0.0.tgz#c7ced4e1eb6227636ada35056a9e5a477414e4d0" + integrity sha512-BzuMqeKVkKKwHV6tJuwePFcxYMxvC97D448mXTgh/CxXAB4sRtoV26gRPN+JDxsXRR7QZyioMV9O6NzQaASf7Q== + +which-boxed-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" + integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== + dependencies: + is-bigint "^1.0.1" + is-boolean-object "^1.1.0" + is-number-object "^1.0.4" + is-string "^1.0.5" + is-symbol "^1.0.3" + +which-typed-array@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.4.tgz#8fcb7d3ee5adf2d771066fba7cf37e32fe8711ff" + integrity sha512-49E0SpUe90cjpoc7BOJwyPHRqSAd12c10Qm2amdEZrJPCY2NDxaW01zHITrem+rnETY3dwrbH3UUrUwagfCYDA== + dependencies: + available-typed-arrays "^1.0.2" + call-bind "^1.0.0" + es-abstract "^1.18.0-next.1" + foreach "^2.0.5" + function-bind "^1.1.1" + has-symbols "^1.0.1" + is-typed-array "^1.1.3" + +which@^2.0.0, which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +ws@7.2.3: + version "7.2.3" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.3.tgz#a5411e1fb04d5ed0efee76d26d5c46d830c39b46" + integrity sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ== + +ws@7.3.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.1.tgz#d0547bf67f7ce4f12a72dfe31262c68d7dc551c8" + integrity sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA== + +ws@7.4.6: + version "7.4.6" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" + integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== + +xorshift@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/xorshift/-/xorshift-0.2.1.tgz#fcd82267e9351c13f0fb9c73307f25331d29c63a" + integrity sha1-/NgiZ+k1HBPw+5xzMH8lMx0pxjo= + +xtend@^4.0.0, xtend@~4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yaml@^1.7.2: + version "1.10.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" + integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== + +yargs-parser@^16.1.0: + version "16.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-16.1.0.tgz#73747d53ae187e7b8dbe333f95714c76ea00ecf1" + integrity sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +zone.js@^0.11.0: + version "0.11.4" + resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.11.4.tgz#0f70dcf6aba80f698af5735cbb257969396e8025" + integrity sha512-DDh2Ab+A/B+9mJyajPjHFPWfYU1H+pdun4wnnk0OcQTNjem1XQSZ2CDW+rfZEUDjv5M19SBqAkjZi0x5wuB5Qw== + dependencies: + tslib "^2.0.0" diff --git a/packages/js/client/src/wasm/WasmWeb3Api.ts b/packages/js/client/src/wasm/WasmWeb3Api.ts index 0529c554a6..ab1525bb73 100644 --- a/packages/js/client/src/wasm/WasmWeb3Api.ts +++ b/packages/js/client/src/wasm/WasmWeb3Api.ts @@ -393,6 +393,12 @@ export class WasmWeb3Api extends Api { ); } + if (!moduleManifest.module) { + throw Error( + `Package manifest module ${module} does not contain a definition for module"` + ); + } + const { data, error } = await ApiResolver.Query.getFile( client, this._apiResolver, diff --git a/packages/js/core/src/manifest/formats/0.0.1-prealpha.1.ts b/packages/js/core/src/manifest/formats/0.0.1-prealpha.1.ts index 1c740a4ea3..e0cdff1f4e 100644 --- a/packages/js/core/src/manifest/formats/0.0.1-prealpha.1.ts +++ b/packages/js/core/src/manifest/formats/0.0.1-prealpha.1.ts @@ -10,11 +10,12 @@ export interface Manifest { format: string; description?: string; repository?: string; + interface?: boolean; mutation?: { schema: { file: string; }; - module: { + module?: { language: string; file: string; }; @@ -23,7 +24,7 @@ export interface Manifest { schema: { file: string; }; - module: { + module?: { language: string; file: string; }; diff --git a/packages/manifest-schema/formats/0.0.1-prealpha.1.json b/packages/manifest-schema/formats/0.0.1-prealpha.1.json index 77b928cdab..2a95ed9564 100644 --- a/packages/manifest-schema/formats/0.0.1-prealpha.1.json +++ b/packages/manifest-schema/formats/0.0.1-prealpha.1.json @@ -16,6 +16,9 @@ "repository": { "type": "string" }, + "interface": { + "type": "boolean" + }, "mutation": { "type": "object", "additionalProperties": false, @@ -52,8 +55,7 @@ } }, "required": [ - "schema", - "module" + "schema" ] }, "query": { @@ -92,8 +94,7 @@ } }, "required": [ - "schema", - "module" + "schema" ] }, "import_redirects": { diff --git a/packages/templates/interface/assemblyscript/.gitignore b/packages/templates/interface/assemblyscript/.gitignore new file mode 100644 index 0000000000..1e8f0fdefe --- /dev/null +++ b/packages/templates/interface/assemblyscript/.gitignore @@ -0,0 +1,3 @@ +build +node_modules +w3 diff --git a/packages/templates/interface/assemblyscript/.nvmrc b/packages/templates/interface/assemblyscript/.nvmrc new file mode 100644 index 0000000000..158c00641a --- /dev/null +++ b/packages/templates/interface/assemblyscript/.nvmrc @@ -0,0 +1 @@ +v14.16.0 diff --git a/packages/templates/interface/assemblyscript/README.md b/packages/templates/interface/assemblyscript/README.md new file mode 100644 index 0000000000..1303fd24cb --- /dev/null +++ b/packages/templates/interface/assemblyscript/README.md @@ -0,0 +1,17 @@ +# SimpleStorage Demo Web3API +A simple starter template that uses a SimpleStorage.sol contract ethereum. For more information on how this project works, and a step by step on how to extend its behavior, see the documentation [here](https://docs.web3api.dev/developers/create-as-web3api). + +# How To Run + +## Install Dependencies +`nvm install && nvm use` +`yarn` + +## Start Test Environment +`yarn test:env:up` + +## Build & Deploy Web3API +`yarn deploy` + +## Run Test Query Recipe +`yarn test` diff --git a/packages/templates/interface/assemblyscript/package.json b/packages/templates/interface/assemblyscript/package.json new file mode 100644 index 0000000000..9cf5f47cb8 --- /dev/null +++ b/packages/templates/interface/assemblyscript/package.json @@ -0,0 +1,25 @@ +{ + "name": "templates-interface-assemblyscript", + "description": "Web3API Interface Assemblyscript Template", + "private": true, + "version": "0.0.1-prealpha.24", + "scripts": { + "build": "yarn build:contract && yarn build:web3api", + "build:web3api": "npx w3 build", + "build:contract": "node ./scripts/build-contract.js", + "test:env:up": "npx w3 test-env up", + "test:env:down": "npx w3 test-env down", + "deploy": "yarn deploy:contract && yarn deploy:web3api", + "deploy:web3api": "npx w3 build --ipfs http://localhost:5001 --test-ens simplestorage.eth", + "deploy:contract": "node ./scripts/deploy-contract.js", + "test": "npx w3 query ./recipes/e2e.json" + }, + "devDependencies": { + "@web3api/cli": "0.0.1-prealpha.24", + "@web3api/ethereum-plugin-js": "0.0.1-prealpha.24", + "@web3api/wasm-as": "0.0.1-prealpha.24", + "ethers": "5.0.8", + "js-yaml": "3.14.0", + "solc": "0.8.3" + } +} diff --git a/packages/templates/interface/assemblyscript/recipes/constants.json b/packages/templates/interface/assemblyscript/recipes/constants.json new file mode 100644 index 0000000000..bd46d57bc4 --- /dev/null +++ b/packages/templates/interface/assemblyscript/recipes/constants.json @@ -0,0 +1,3 @@ +{ + "SimpleStorageAddr": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab" +} \ No newline at end of file diff --git a/packages/templates/interface/assemblyscript/recipes/e2e.json b/packages/templates/interface/assemblyscript/recipes/e2e.json new file mode 100644 index 0000000000..5cde111cbd --- /dev/null +++ b/packages/templates/interface/assemblyscript/recipes/e2e.json @@ -0,0 +1,43 @@ +[ + { + "api": "ens/testnet/simplestorage.eth", + "constants": "./constants.json" + }, + { + "query": "./get.graphql", + "variables": { + "address": "$SimpleStorageAddr", + "network": "testnet" + } + }, + { + "query": "./set.graphql", + "variables": { + "address": "$SimpleStorageAddr", + "value": 5, + "network": "testnet" + } + }, + { + "query": "./get.graphql", + "variables": { + "address": "$SimpleStorageAddr", + "network": "testnet" + } + }, + { + "query": "./set.graphql", + "variables": { + "address": "$SimpleStorageAddr", + "value": 569, + "network": "testnet" + } + }, + { + "query": "./get.graphql", + "variables": { + "address": "$SimpleStorageAddr", + "network": "testnet" + } + } +] diff --git a/packages/templates/interface/assemblyscript/recipes/get.graphql b/packages/templates/interface/assemblyscript/recipes/get.graphql new file mode 100644 index 0000000000..ce22f136be --- /dev/null +++ b/packages/templates/interface/assemblyscript/recipes/get.graphql @@ -0,0 +1,8 @@ +query GetData($address: String!) { + getData( + address: $address + connection: { + networkNameOrChainId: $network + } + ) +} diff --git a/packages/templates/interface/assemblyscript/recipes/set.graphql b/packages/templates/interface/assemblyscript/recipes/set.graphql new file mode 100644 index 0000000000..d5c8f9a896 --- /dev/null +++ b/packages/templates/interface/assemblyscript/recipes/set.graphql @@ -0,0 +1,9 @@ +mutation SetData($address: String!, $value: Int!) { + setData( + address: $address + value: $value + connection: { + networkNameOrChainId: $network + } + ) +} diff --git a/packages/templates/interface/assemblyscript/scripts/build-contract.js b/packages/templates/interface/assemblyscript/scripts/build-contract.js new file mode 100644 index 0000000000..43270b0692 --- /dev/null +++ b/packages/templates/interface/assemblyscript/scripts/build-contract.js @@ -0,0 +1,78 @@ +const solc = require("solc"); +const fs = require("fs"); + +async function main() { + // Fetch the contract's source + const contractSource = fs.readFileSync( + `${__dirname}/../src/contracts/SimpleStorage.sol`, 'utf-8' + ); + + // Compile the SimpleStorage contract using solc (Solidity compiler) + const output = JSON.parse( + solc.compile( + JSON.stringify({ + language: "Solidity", + sources: { + "SimpleStorage.sol": { + content: contractSource + } + }, + settings: { + outputSelection: { + '*': { + '*': ['*'] + } + } + } + }) + ) + ); + + if (output.contracts) { + console.log("✔️ Compiled SimpleStorage.sol"); + } else { + throw Error( + `Error: Failed to compile SimpleStorage.sol.\n${JSON.stringify(output, null, 2)}` + ); + } + + // Fetch the compiled contract's abi & bytecode + const contract = output.contracts["SimpleStorage.sol"]["SimpleStorage"]; + const abi = JSON.stringify(contract.abi); + const bytecode = contract.evm.bytecode.object; + + // Generate an Assemblyscript file containing the abi + bytecode + fs.writeFileSync( + `${__dirname}/../src/contracts/SimpleStorage.ts`, +`/// NOTE: This file is auto-generate, see deploy-contract.js +export const abi = \`${abi}\`; +export const bytecode = "0x${bytecode}"; +` + ); + + console.log("✔️ Generated SimpleStorage.ts"); + + // Generate a JSON ABI file + fs.writeFileSync( + `${__dirname}/../src/contracts/SimpleStorage.json`, + JSON.stringify({ + abi: contract.abi, + bytecode: `0x${bytecode}` + }) + ); + + console.log("✔️ Generated SimpleStorage.json"); +} + +if (require.main === module) { + main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); +} else { + module.exports = { + main + }; +} diff --git a/packages/templates/interface/assemblyscript/scripts/deploy-contract.js b/packages/templates/interface/assemblyscript/scripts/deploy-contract.js new file mode 100644 index 0000000000..32b14f6759 --- /dev/null +++ b/packages/templates/interface/assemblyscript/scripts/deploy-contract.js @@ -0,0 +1,55 @@ +const { EthereumPlugin } = require("@web3api/ethereum-plugin-js"); +const fs = require("fs"); +const buildContract = require("./build-contract"); + +async function main() { + // Ensure the contract is built + await buildContract.main(); + + // Fetch the contract's ABI + const contractAbi = JSON.parse( + fs.readFileSync( + `${__dirname}/../src/contracts/SimpleStorage.json`, 'utf-8' + ) + ); + + // Deploy the contract to testnet + const eth = new EthereumPlugin({ + networks: { + testnet: { + provider: "http://localhost:8545" + }, + }, + }); + + const address = await eth.deployContract( + contractAbi.abi, contractAbi.bytecode, [], { + networkNameOrChainId: "testnet" + } + ); + + console.log(`✔️ SimpleStorage live at: ${address}`) + + // Store the address in our recipes' constants file + const constants = require(`${__dirname}/../recipes/constants.json`); + constants.SimpleStorageAddr = address; + fs.writeFileSync( + `${__dirname}/../recipes/constants.json`, + JSON.stringify(constants, null, 2) + ); + + console.log("✔️ Recipe Constants Updated"); +} + +if (require.main === module) { + main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); +} else { + module.exports = { + main + }; +} diff --git a/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.json b/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.json new file mode 100644 index 0000000000..8349da4520 --- /dev/null +++ b/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.json @@ -0,0 +1 @@ +{"abi":[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"DataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"string","name":"ipfsHash","type":"string"}],"name":"HashSet","type":"event"},{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"x","type":"string"}],"name":"setHash","outputs":[],"stateMutability":"nonpayable","type":"function"}],"bytecode":"0x608060405234801561001057600080fd5b506105d9806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80631ed83fd41461005157806360fe47b11461006d5780636d4ce63c14610089578063d13319c4146100a7575b600080fd5b61006b600480360381019061006691906102f6565b6100c5565b005b6100876004803603810190610082919061033b565b610116565b005b610091610159565b60405161009e9190610465565b60405180910390f35b6100af610162565b6040516100bc9190610443565b60405180910390f35b8181600191906100d69291906101f4565b507f7701f49eb9aabe8890631508a9092eabb511a34566c30f2d94ff4420da1ccb1333838360405161010a939291906103e8565b60405180910390a15050565b806000819055507f7c94a94848d5859b1a30c887dc5740bf8d1cf789779be90adda1d0d34dd25022338260405161014e92919061041a565b60405180910390a150565b60008054905090565b6060600180546101719061051a565b80601f016020809104026020016040519081016040528092919081815260200182805461019d9061051a565b80156101ea5780601f106101bf576101008083540402835291602001916101ea565b820191906000526020600020905b8154815290600101906020018083116101cd57829003601f168201915b5050505050905090565b8280546102009061051a565b90600052602060002090601f0160209004810192826102225760008555610269565b82601f1061023b57803560ff1916838001178555610269565b82800160010185558215610269579182015b8281111561026857823582559160200191906001019061024d565b5b509050610276919061027a565b5090565b5b8082111561029357600081600090555060010161027b565b5090565b60008083601f8401126102a957600080fd5b8235905067ffffffffffffffff8111156102c257600080fd5b6020830191508360018202830111156102da57600080fd5b9250929050565b6000813590506102f08161058c565b92915050565b6000806020838503121561030957600080fd5b600083013567ffffffffffffffff81111561032357600080fd5b61032f85828601610297565b92509250509250929050565b60006020828403121561034d57600080fd5b600061035b848285016102e1565b91505092915050565b61036d8161049c565b82525050565b600061037f838561048b565b935061038c8385846104d8565b6103958361057b565b840190509392505050565b60006103ab82610480565b6103b5818561048b565b93506103c58185602086016104e7565b6103ce8161057b565b840191505092915050565b6103e2816104ce565b82525050565b60006040820190506103fd6000830186610364565b8181036020830152610410818486610373565b9050949350505050565b600060408201905061042f6000830185610364565b61043c60208301846103d9565b9392505050565b6000602082019050818103600083015261045d81846103a0565b905092915050565b600060208201905061047a60008301846103d9565b92915050565b600081519050919050565b600082825260208201905092915050565b60006104a7826104ae565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156105055780820151818401526020810190506104ea565b83811115610514576000848401525b50505050565b6000600282049050600182168061053257607f821691505b602082108114156105465761054561054c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b610595816104ce565b81146105a057600080fd5b5056fea26469706673582212204f956d7623b7fe0a5a722d01575cc1d310a1a18086a604796ff457447881740864736f6c63430008030033"} \ No newline at end of file diff --git a/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.sol b/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.sol new file mode 100644 index 0000000000..415b2686c7 --- /dev/null +++ b/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.sol @@ -0,0 +1,27 @@ +pragma solidity 0.8.3; + +contract SimpleStorage { + uint256 data; + string ipfsHash; + + event DataSet(address from, uint256 data); + event HashSet(address from, string ipfsHash); + + function set(uint256 x) public { + data = x; + emit DataSet(msg.sender, x); + } + + function get() public view returns (uint256) { + return data; + } + + function setHash(string calldata x) public { + ipfsHash = x; + emit HashSet(msg.sender, x); + } + + function getHash() public view returns (string memory) { + return ipfsHash; + } +} diff --git a/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.ts b/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.ts new file mode 100644 index 0000000000..a3808db55b --- /dev/null +++ b/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.ts @@ -0,0 +1,3 @@ +/// NOTE: This file is auto-generate, see deploy-contract.js +export const abi = `[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"DataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"string","name":"ipfsHash","type":"string"}],"name":"HashSet","type":"event"},{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"x","type":"string"}],"name":"setHash","outputs":[],"stateMutability":"nonpayable","type":"function"}]`; +export const bytecode = "0x608060405234801561001057600080fd5b506105d9806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80631ed83fd41461005157806360fe47b11461006d5780636d4ce63c14610089578063d13319c4146100a7575b600080fd5b61006b600480360381019061006691906102f6565b6100c5565b005b6100876004803603810190610082919061033b565b610116565b005b610091610159565b60405161009e9190610465565b60405180910390f35b6100af610162565b6040516100bc9190610443565b60405180910390f35b8181600191906100d69291906101f4565b507f7701f49eb9aabe8890631508a9092eabb511a34566c30f2d94ff4420da1ccb1333838360405161010a939291906103e8565b60405180910390a15050565b806000819055507f7c94a94848d5859b1a30c887dc5740bf8d1cf789779be90adda1d0d34dd25022338260405161014e92919061041a565b60405180910390a150565b60008054905090565b6060600180546101719061051a565b80601f016020809104026020016040519081016040528092919081815260200182805461019d9061051a565b80156101ea5780601f106101bf576101008083540402835291602001916101ea565b820191906000526020600020905b8154815290600101906020018083116101cd57829003601f168201915b5050505050905090565b8280546102009061051a565b90600052602060002090601f0160209004810192826102225760008555610269565b82601f1061023b57803560ff1916838001178555610269565b82800160010185558215610269579182015b8281111561026857823582559160200191906001019061024d565b5b509050610276919061027a565b5090565b5b8082111561029357600081600090555060010161027b565b5090565b60008083601f8401126102a957600080fd5b8235905067ffffffffffffffff8111156102c257600080fd5b6020830191508360018202830111156102da57600080fd5b9250929050565b6000813590506102f08161058c565b92915050565b6000806020838503121561030957600080fd5b600083013567ffffffffffffffff81111561032357600080fd5b61032f85828601610297565b92509250509250929050565b60006020828403121561034d57600080fd5b600061035b848285016102e1565b91505092915050565b61036d8161049c565b82525050565b600061037f838561048b565b935061038c8385846104d8565b6103958361057b565b840190509392505050565b60006103ab82610480565b6103b5818561048b565b93506103c58185602086016104e7565b6103ce8161057b565b840191505092915050565b6103e2816104ce565b82525050565b60006040820190506103fd6000830186610364565b8181036020830152610410818486610373565b9050949350505050565b600060408201905061042f6000830185610364565b61043c60208301846103d9565b9392505050565b6000602082019050818103600083015261045d81846103a0565b905092915050565b600060208201905061047a60008301846103d9565b92915050565b600081519050919050565b600082825260208201905092915050565b60006104a7826104ae565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156105055780820151818401526020810190506104ea565b83811115610514576000848401525b50505050565b6000600282049050600182168061053257607f821691505b602082108114156105465761054561054c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b610595816104ce565b81146105a057600080fd5b5056fea26469706673582212204f956d7623b7fe0a5a722d01575cc1d310a1a18086a604796ff457447881740864736f6c63430008030033"; diff --git a/packages/templates/interface/assemblyscript/src/mutation/index.ts b/packages/templates/interface/assemblyscript/src/mutation/index.ts new file mode 100644 index 0000000000..e2721378ec --- /dev/null +++ b/packages/templates/interface/assemblyscript/src/mutation/index.ts @@ -0,0 +1,24 @@ +import { + Ethereum_Mutation, + Input_setData, + Input_deployContract +} from "./w3"; +import { abi, bytecode } from "../contracts/SimpleStorage"; + +export function setData(input: Input_setData): string { + return Ethereum_Mutation.sendTransaction({ + address: input.address, + method: "function set(uint256 value)", + args: [input.value.toString()], + connection: input.connection + }); +} + +export function deployContract(input: Input_deployContract): string { + return Ethereum_Mutation.deployContract({ + abi, + bytecode, + args: null, + connection: input.connection + }); +} diff --git a/packages/templates/interface/assemblyscript/src/mutation/schema.graphql b/packages/templates/interface/assemblyscript/src/mutation/schema.graphql new file mode 100644 index 0000000000..bcfc21899b --- /dev/null +++ b/packages/templates/interface/assemblyscript/src/mutation/schema.graphql @@ -0,0 +1,13 @@ +#import { Mutation, Connection } into Ethereum from "w3://ens/ethereum.web3api.eth" + +type Mutation { + setData( + address: String! + value: UInt32! + connection: Ethereum_Connection + ): String! + + deployContract( + connection: Ethereum_Connection + ): String! +} diff --git a/packages/templates/interface/assemblyscript/src/query/index.ts b/packages/templates/interface/assemblyscript/src/query/index.ts new file mode 100644 index 0000000000..c9d51212bb --- /dev/null +++ b/packages/templates/interface/assemblyscript/src/query/index.ts @@ -0,0 +1,15 @@ +import { + Ethereum_Query, + Input_getData +} from "./w3"; + +export function getData(input: Input_getData): u32 { + const res = Ethereum_Query.callView({ + address: input.address, + method: "function get() view returns (uint256)", + args: null, + connection: input.connection + }); + + return U32.parseInt(res); +} diff --git a/packages/templates/interface/assemblyscript/src/query/schema.graphql b/packages/templates/interface/assemblyscript/src/query/schema.graphql new file mode 100644 index 0000000000..f482cc128e --- /dev/null +++ b/packages/templates/interface/assemblyscript/src/query/schema.graphql @@ -0,0 +1,8 @@ +#import { Query, Connection } into Ethereum from "w3://ens/ethereum.web3api.eth" + +type Query { + getData( + address: String! + connection: Ethereum_Connection + ): Int! +} diff --git a/packages/templates/interface/assemblyscript/web3api.yaml b/packages/templates/interface/assemblyscript/web3api.yaml new file mode 100644 index 0000000000..3395dcd364 --- /dev/null +++ b/packages/templates/interface/assemblyscript/web3api.yaml @@ -0,0 +1,16 @@ +description: SimpleStorage Web3API Example +repository: https://github.com/web3-api/monorepo +format: 0.0.1-prealpha.1 +interface: true +mutation: + schema: + file: ./src/mutation/schema.graphql + module: + language: wasm/assemblyscript + file: ./src/mutation/index.ts +query: + schema: + file: ./src/query/schema.graphql + module: + language: wasm/assemblyscript + file: ./src/query/index.ts From 5361b5441470d2180237e0e8998e5c047e4dd5ef Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 3 Jun 2021 18:02:58 +0200 Subject: [PATCH 002/112] updated api interface template --- packages/core-apis/api-resolver/package.json | 2 +- .../interface}/.gitignore | 0 .../assemblyscript => api/interface}/.nvmrc | 0 packages/templates/api/interface/README.md | 13 ++++ packages/templates/api/interface/package.json | 18 +++++ .../templates/api/interface/query.graphql | 15 ++++ packages/templates/api/interface/web3api.yaml | 7 ++ .../interface/assemblyscript/README.md | 17 ---- .../interface/assemblyscript/package.json | 25 ------ .../assemblyscript/recipes/constants.json | 3 - .../interface/assemblyscript/recipes/e2e.json | 43 ---------- .../assemblyscript/recipes/get.graphql | 8 -- .../assemblyscript/recipes/set.graphql | 9 --- .../assemblyscript/scripts/build-contract.js | 78 ------------------- .../assemblyscript/scripts/deploy-contract.js | 55 ------------- .../src/contracts/SimpleStorage.json | 1 - .../src/contracts/SimpleStorage.sol | 27 ------- .../src/contracts/SimpleStorage.ts | 3 - .../assemblyscript/src/mutation/index.ts | 24 ------ .../src/mutation/schema.graphql | 13 ---- .../assemblyscript/src/query/index.ts | 15 ---- .../assemblyscript/src/query/schema.graphql | 8 -- .../interface/assemblyscript/web3api.yaml | 16 ---- 23 files changed, 54 insertions(+), 346 deletions(-) rename packages/templates/{interface/assemblyscript => api/interface}/.gitignore (100%) rename packages/templates/{interface/assemblyscript => api/interface}/.nvmrc (100%) create mode 100644 packages/templates/api/interface/README.md create mode 100644 packages/templates/api/interface/package.json create mode 100644 packages/templates/api/interface/query.graphql create mode 100644 packages/templates/api/interface/web3api.yaml delete mode 100644 packages/templates/interface/assemblyscript/README.md delete mode 100644 packages/templates/interface/assemblyscript/package.json delete mode 100644 packages/templates/interface/assemblyscript/recipes/constants.json delete mode 100644 packages/templates/interface/assemblyscript/recipes/e2e.json delete mode 100644 packages/templates/interface/assemblyscript/recipes/get.graphql delete mode 100644 packages/templates/interface/assemblyscript/recipes/set.graphql delete mode 100644 packages/templates/interface/assemblyscript/scripts/build-contract.js delete mode 100644 packages/templates/interface/assemblyscript/scripts/deploy-contract.js delete mode 100644 packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.json delete mode 100644 packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.sol delete mode 100644 packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.ts delete mode 100644 packages/templates/interface/assemblyscript/src/mutation/index.ts delete mode 100644 packages/templates/interface/assemblyscript/src/mutation/schema.graphql delete mode 100644 packages/templates/interface/assemblyscript/src/query/index.ts delete mode 100644 packages/templates/interface/assemblyscript/src/query/schema.graphql delete mode 100644 packages/templates/interface/assemblyscript/web3api.yaml diff --git a/packages/core-apis/api-resolver/package.json b/packages/core-apis/api-resolver/package.json index b4f85f621f..66ef691485 100644 --- a/packages/core-apis/api-resolver/package.json +++ b/packages/core-apis/api-resolver/package.json @@ -9,7 +9,7 @@ "test:env:up": "npx w3 test-env up", "test:env:down": "npx w3 test-env down", "deploy": "yarn deploy:web3api", - "deploy:web3api": "npx w3 build --ipfs http://localhost:5001 --test-ens simplestorage.eth" + "deploy:web3api": "npx w3 build --ipfs http://localhost:5001" }, "devDependencies": { "@web3api/cli": "0.0.1-prealpha.24", diff --git a/packages/templates/interface/assemblyscript/.gitignore b/packages/templates/api/interface/.gitignore similarity index 100% rename from packages/templates/interface/assemblyscript/.gitignore rename to packages/templates/api/interface/.gitignore diff --git a/packages/templates/interface/assemblyscript/.nvmrc b/packages/templates/api/interface/.nvmrc similarity index 100% rename from packages/templates/interface/assemblyscript/.nvmrc rename to packages/templates/api/interface/.nvmrc diff --git a/packages/templates/api/interface/README.md b/packages/templates/api/interface/README.md new file mode 100644 index 0000000000..6aa16eebc6 --- /dev/null +++ b/packages/templates/api/interface/README.md @@ -0,0 +1,13 @@ +# Web3API Interface Example + +# How To Run + +## Install Dependencies +`nvm install && nvm use` +`yarn` + +## Start Test Environment +`yarn test:env:up` + +## Build & Deploy Web3API +`yarn deploy` \ No newline at end of file diff --git a/packages/templates/api/interface/package.json b/packages/templates/api/interface/package.json new file mode 100644 index 0000000000..66ef691485 --- /dev/null +++ b/packages/templates/api/interface/package.json @@ -0,0 +1,18 @@ +{ + "name": "resolver-interface", + "description": "Web3API Resolver Interface", + "private": true, + "version": "0.0.1-prealpha.24", + "scripts": { + "build": "yarn build:web3api", + "build:web3api": "npx w3 build", + "test:env:up": "npx w3 test-env up", + "test:env:down": "npx w3 test-env down", + "deploy": "yarn deploy:web3api", + "deploy:web3api": "npx w3 build --ipfs http://localhost:5001" + }, + "devDependencies": { + "@web3api/cli": "0.0.1-prealpha.24", + "js-yaml": "3.14.0" + } +} diff --git a/packages/templates/api/interface/query.graphql b/packages/templates/api/interface/query.graphql new file mode 100644 index 0000000000..046311f779 --- /dev/null +++ b/packages/templates/api/interface/query.graphql @@ -0,0 +1,15 @@ +type Query { + tryResolveUri( + authority: String! + path: String! + ): MaybeUriOrManifest + + getFile( + path: String! + ): Bytes +} + +type MaybeUriOrManifest { + uri: String + manifest: String +} diff --git a/packages/templates/api/interface/web3api.yaml b/packages/templates/api/interface/web3api.yaml new file mode 100644 index 0000000000..a323677efc --- /dev/null +++ b/packages/templates/api/interface/web3api.yaml @@ -0,0 +1,7 @@ +description: Web3API Interface Example +format: 0.0.1-prealpha.1 +repository: https://github.com/web3-api/monorepo +interface: true +query: + schema: + file: ./query.graphql diff --git a/packages/templates/interface/assemblyscript/README.md b/packages/templates/interface/assemblyscript/README.md deleted file mode 100644 index 1303fd24cb..0000000000 --- a/packages/templates/interface/assemblyscript/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# SimpleStorage Demo Web3API -A simple starter template that uses a SimpleStorage.sol contract ethereum. For more information on how this project works, and a step by step on how to extend its behavior, see the documentation [here](https://docs.web3api.dev/developers/create-as-web3api). - -# How To Run - -## Install Dependencies -`nvm install && nvm use` -`yarn` - -## Start Test Environment -`yarn test:env:up` - -## Build & Deploy Web3API -`yarn deploy` - -## Run Test Query Recipe -`yarn test` diff --git a/packages/templates/interface/assemblyscript/package.json b/packages/templates/interface/assemblyscript/package.json deleted file mode 100644 index 9cf5f47cb8..0000000000 --- a/packages/templates/interface/assemblyscript/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "templates-interface-assemblyscript", - "description": "Web3API Interface Assemblyscript Template", - "private": true, - "version": "0.0.1-prealpha.24", - "scripts": { - "build": "yarn build:contract && yarn build:web3api", - "build:web3api": "npx w3 build", - "build:contract": "node ./scripts/build-contract.js", - "test:env:up": "npx w3 test-env up", - "test:env:down": "npx w3 test-env down", - "deploy": "yarn deploy:contract && yarn deploy:web3api", - "deploy:web3api": "npx w3 build --ipfs http://localhost:5001 --test-ens simplestorage.eth", - "deploy:contract": "node ./scripts/deploy-contract.js", - "test": "npx w3 query ./recipes/e2e.json" - }, - "devDependencies": { - "@web3api/cli": "0.0.1-prealpha.24", - "@web3api/ethereum-plugin-js": "0.0.1-prealpha.24", - "@web3api/wasm-as": "0.0.1-prealpha.24", - "ethers": "5.0.8", - "js-yaml": "3.14.0", - "solc": "0.8.3" - } -} diff --git a/packages/templates/interface/assemblyscript/recipes/constants.json b/packages/templates/interface/assemblyscript/recipes/constants.json deleted file mode 100644 index bd46d57bc4..0000000000 --- a/packages/templates/interface/assemblyscript/recipes/constants.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "SimpleStorageAddr": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab" -} \ No newline at end of file diff --git a/packages/templates/interface/assemblyscript/recipes/e2e.json b/packages/templates/interface/assemblyscript/recipes/e2e.json deleted file mode 100644 index 5cde111cbd..0000000000 --- a/packages/templates/interface/assemblyscript/recipes/e2e.json +++ /dev/null @@ -1,43 +0,0 @@ -[ - { - "api": "ens/testnet/simplestorage.eth", - "constants": "./constants.json" - }, - { - "query": "./get.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "network": "testnet" - } - }, - { - "query": "./set.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "value": 5, - "network": "testnet" - } - }, - { - "query": "./get.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "network": "testnet" - } - }, - { - "query": "./set.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "value": 569, - "network": "testnet" - } - }, - { - "query": "./get.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "network": "testnet" - } - } -] diff --git a/packages/templates/interface/assemblyscript/recipes/get.graphql b/packages/templates/interface/assemblyscript/recipes/get.graphql deleted file mode 100644 index ce22f136be..0000000000 --- a/packages/templates/interface/assemblyscript/recipes/get.graphql +++ /dev/null @@ -1,8 +0,0 @@ -query GetData($address: String!) { - getData( - address: $address - connection: { - networkNameOrChainId: $network - } - ) -} diff --git a/packages/templates/interface/assemblyscript/recipes/set.graphql b/packages/templates/interface/assemblyscript/recipes/set.graphql deleted file mode 100644 index d5c8f9a896..0000000000 --- a/packages/templates/interface/assemblyscript/recipes/set.graphql +++ /dev/null @@ -1,9 +0,0 @@ -mutation SetData($address: String!, $value: Int!) { - setData( - address: $address - value: $value - connection: { - networkNameOrChainId: $network - } - ) -} diff --git a/packages/templates/interface/assemblyscript/scripts/build-contract.js b/packages/templates/interface/assemblyscript/scripts/build-contract.js deleted file mode 100644 index 43270b0692..0000000000 --- a/packages/templates/interface/assemblyscript/scripts/build-contract.js +++ /dev/null @@ -1,78 +0,0 @@ -const solc = require("solc"); -const fs = require("fs"); - -async function main() { - // Fetch the contract's source - const contractSource = fs.readFileSync( - `${__dirname}/../src/contracts/SimpleStorage.sol`, 'utf-8' - ); - - // Compile the SimpleStorage contract using solc (Solidity compiler) - const output = JSON.parse( - solc.compile( - JSON.stringify({ - language: "Solidity", - sources: { - "SimpleStorage.sol": { - content: contractSource - } - }, - settings: { - outputSelection: { - '*': { - '*': ['*'] - } - } - } - }) - ) - ); - - if (output.contracts) { - console.log("✔️ Compiled SimpleStorage.sol"); - } else { - throw Error( - `Error: Failed to compile SimpleStorage.sol.\n${JSON.stringify(output, null, 2)}` - ); - } - - // Fetch the compiled contract's abi & bytecode - const contract = output.contracts["SimpleStorage.sol"]["SimpleStorage"]; - const abi = JSON.stringify(contract.abi); - const bytecode = contract.evm.bytecode.object; - - // Generate an Assemblyscript file containing the abi + bytecode - fs.writeFileSync( - `${__dirname}/../src/contracts/SimpleStorage.ts`, -`/// NOTE: This file is auto-generate, see deploy-contract.js -export const abi = \`${abi}\`; -export const bytecode = "0x${bytecode}"; -` - ); - - console.log("✔️ Generated SimpleStorage.ts"); - - // Generate a JSON ABI file - fs.writeFileSync( - `${__dirname}/../src/contracts/SimpleStorage.json`, - JSON.stringify({ - abi: contract.abi, - bytecode: `0x${bytecode}` - }) - ); - - console.log("✔️ Generated SimpleStorage.json"); -} - -if (require.main === module) { - main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error); - process.exit(1); - }); -} else { - module.exports = { - main - }; -} diff --git a/packages/templates/interface/assemblyscript/scripts/deploy-contract.js b/packages/templates/interface/assemblyscript/scripts/deploy-contract.js deleted file mode 100644 index 32b14f6759..0000000000 --- a/packages/templates/interface/assemblyscript/scripts/deploy-contract.js +++ /dev/null @@ -1,55 +0,0 @@ -const { EthereumPlugin } = require("@web3api/ethereum-plugin-js"); -const fs = require("fs"); -const buildContract = require("./build-contract"); - -async function main() { - // Ensure the contract is built - await buildContract.main(); - - // Fetch the contract's ABI - const contractAbi = JSON.parse( - fs.readFileSync( - `${__dirname}/../src/contracts/SimpleStorage.json`, 'utf-8' - ) - ); - - // Deploy the contract to testnet - const eth = new EthereumPlugin({ - networks: { - testnet: { - provider: "http://localhost:8545" - }, - }, - }); - - const address = await eth.deployContract( - contractAbi.abi, contractAbi.bytecode, [], { - networkNameOrChainId: "testnet" - } - ); - - console.log(`✔️ SimpleStorage live at: ${address}`) - - // Store the address in our recipes' constants file - const constants = require(`${__dirname}/../recipes/constants.json`); - constants.SimpleStorageAddr = address; - fs.writeFileSync( - `${__dirname}/../recipes/constants.json`, - JSON.stringify(constants, null, 2) - ); - - console.log("✔️ Recipe Constants Updated"); -} - -if (require.main === module) { - main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error); - process.exit(1); - }); -} else { - module.exports = { - main - }; -} diff --git a/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.json b/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.json deleted file mode 100644 index 8349da4520..0000000000 --- a/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.json +++ /dev/null @@ -1 +0,0 @@ -{"abi":[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"DataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"string","name":"ipfsHash","type":"string"}],"name":"HashSet","type":"event"},{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"x","type":"string"}],"name":"setHash","outputs":[],"stateMutability":"nonpayable","type":"function"}],"bytecode":"0x608060405234801561001057600080fd5b506105d9806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80631ed83fd41461005157806360fe47b11461006d5780636d4ce63c14610089578063d13319c4146100a7575b600080fd5b61006b600480360381019061006691906102f6565b6100c5565b005b6100876004803603810190610082919061033b565b610116565b005b610091610159565b60405161009e9190610465565b60405180910390f35b6100af610162565b6040516100bc9190610443565b60405180910390f35b8181600191906100d69291906101f4565b507f7701f49eb9aabe8890631508a9092eabb511a34566c30f2d94ff4420da1ccb1333838360405161010a939291906103e8565b60405180910390a15050565b806000819055507f7c94a94848d5859b1a30c887dc5740bf8d1cf789779be90adda1d0d34dd25022338260405161014e92919061041a565b60405180910390a150565b60008054905090565b6060600180546101719061051a565b80601f016020809104026020016040519081016040528092919081815260200182805461019d9061051a565b80156101ea5780601f106101bf576101008083540402835291602001916101ea565b820191906000526020600020905b8154815290600101906020018083116101cd57829003601f168201915b5050505050905090565b8280546102009061051a565b90600052602060002090601f0160209004810192826102225760008555610269565b82601f1061023b57803560ff1916838001178555610269565b82800160010185558215610269579182015b8281111561026857823582559160200191906001019061024d565b5b509050610276919061027a565b5090565b5b8082111561029357600081600090555060010161027b565b5090565b60008083601f8401126102a957600080fd5b8235905067ffffffffffffffff8111156102c257600080fd5b6020830191508360018202830111156102da57600080fd5b9250929050565b6000813590506102f08161058c565b92915050565b6000806020838503121561030957600080fd5b600083013567ffffffffffffffff81111561032357600080fd5b61032f85828601610297565b92509250509250929050565b60006020828403121561034d57600080fd5b600061035b848285016102e1565b91505092915050565b61036d8161049c565b82525050565b600061037f838561048b565b935061038c8385846104d8565b6103958361057b565b840190509392505050565b60006103ab82610480565b6103b5818561048b565b93506103c58185602086016104e7565b6103ce8161057b565b840191505092915050565b6103e2816104ce565b82525050565b60006040820190506103fd6000830186610364565b8181036020830152610410818486610373565b9050949350505050565b600060408201905061042f6000830185610364565b61043c60208301846103d9565b9392505050565b6000602082019050818103600083015261045d81846103a0565b905092915050565b600060208201905061047a60008301846103d9565b92915050565b600081519050919050565b600082825260208201905092915050565b60006104a7826104ae565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156105055780820151818401526020810190506104ea565b83811115610514576000848401525b50505050565b6000600282049050600182168061053257607f821691505b602082108114156105465761054561054c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b610595816104ce565b81146105a057600080fd5b5056fea26469706673582212204f956d7623b7fe0a5a722d01575cc1d310a1a18086a604796ff457447881740864736f6c63430008030033"} \ No newline at end of file diff --git a/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.sol b/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.sol deleted file mode 100644 index 415b2686c7..0000000000 --- a/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.sol +++ /dev/null @@ -1,27 +0,0 @@ -pragma solidity 0.8.3; - -contract SimpleStorage { - uint256 data; - string ipfsHash; - - event DataSet(address from, uint256 data); - event HashSet(address from, string ipfsHash); - - function set(uint256 x) public { - data = x; - emit DataSet(msg.sender, x); - } - - function get() public view returns (uint256) { - return data; - } - - function setHash(string calldata x) public { - ipfsHash = x; - emit HashSet(msg.sender, x); - } - - function getHash() public view returns (string memory) { - return ipfsHash; - } -} diff --git a/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.ts b/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.ts deleted file mode 100644 index a3808db55b..0000000000 --- a/packages/templates/interface/assemblyscript/src/contracts/SimpleStorage.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// NOTE: This file is auto-generate, see deploy-contract.js -export const abi = `[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"DataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"string","name":"ipfsHash","type":"string"}],"name":"HashSet","type":"event"},{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"x","type":"string"}],"name":"setHash","outputs":[],"stateMutability":"nonpayable","type":"function"}]`; -export const bytecode = "0x608060405234801561001057600080fd5b506105d9806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80631ed83fd41461005157806360fe47b11461006d5780636d4ce63c14610089578063d13319c4146100a7575b600080fd5b61006b600480360381019061006691906102f6565b6100c5565b005b6100876004803603810190610082919061033b565b610116565b005b610091610159565b60405161009e9190610465565b60405180910390f35b6100af610162565b6040516100bc9190610443565b60405180910390f35b8181600191906100d69291906101f4565b507f7701f49eb9aabe8890631508a9092eabb511a34566c30f2d94ff4420da1ccb1333838360405161010a939291906103e8565b60405180910390a15050565b806000819055507f7c94a94848d5859b1a30c887dc5740bf8d1cf789779be90adda1d0d34dd25022338260405161014e92919061041a565b60405180910390a150565b60008054905090565b6060600180546101719061051a565b80601f016020809104026020016040519081016040528092919081815260200182805461019d9061051a565b80156101ea5780601f106101bf576101008083540402835291602001916101ea565b820191906000526020600020905b8154815290600101906020018083116101cd57829003601f168201915b5050505050905090565b8280546102009061051a565b90600052602060002090601f0160209004810192826102225760008555610269565b82601f1061023b57803560ff1916838001178555610269565b82800160010185558215610269579182015b8281111561026857823582559160200191906001019061024d565b5b509050610276919061027a565b5090565b5b8082111561029357600081600090555060010161027b565b5090565b60008083601f8401126102a957600080fd5b8235905067ffffffffffffffff8111156102c257600080fd5b6020830191508360018202830111156102da57600080fd5b9250929050565b6000813590506102f08161058c565b92915050565b6000806020838503121561030957600080fd5b600083013567ffffffffffffffff81111561032357600080fd5b61032f85828601610297565b92509250509250929050565b60006020828403121561034d57600080fd5b600061035b848285016102e1565b91505092915050565b61036d8161049c565b82525050565b600061037f838561048b565b935061038c8385846104d8565b6103958361057b565b840190509392505050565b60006103ab82610480565b6103b5818561048b565b93506103c58185602086016104e7565b6103ce8161057b565b840191505092915050565b6103e2816104ce565b82525050565b60006040820190506103fd6000830186610364565b8181036020830152610410818486610373565b9050949350505050565b600060408201905061042f6000830185610364565b61043c60208301846103d9565b9392505050565b6000602082019050818103600083015261045d81846103a0565b905092915050565b600060208201905061047a60008301846103d9565b92915050565b600081519050919050565b600082825260208201905092915050565b60006104a7826104ae565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156105055780820151818401526020810190506104ea565b83811115610514576000848401525b50505050565b6000600282049050600182168061053257607f821691505b602082108114156105465761054561054c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b610595816104ce565b81146105a057600080fd5b5056fea26469706673582212204f956d7623b7fe0a5a722d01575cc1d310a1a18086a604796ff457447881740864736f6c63430008030033"; diff --git a/packages/templates/interface/assemblyscript/src/mutation/index.ts b/packages/templates/interface/assemblyscript/src/mutation/index.ts deleted file mode 100644 index e2721378ec..0000000000 --- a/packages/templates/interface/assemblyscript/src/mutation/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { - Ethereum_Mutation, - Input_setData, - Input_deployContract -} from "./w3"; -import { abi, bytecode } from "../contracts/SimpleStorage"; - -export function setData(input: Input_setData): string { - return Ethereum_Mutation.sendTransaction({ - address: input.address, - method: "function set(uint256 value)", - args: [input.value.toString()], - connection: input.connection - }); -} - -export function deployContract(input: Input_deployContract): string { - return Ethereum_Mutation.deployContract({ - abi, - bytecode, - args: null, - connection: input.connection - }); -} diff --git a/packages/templates/interface/assemblyscript/src/mutation/schema.graphql b/packages/templates/interface/assemblyscript/src/mutation/schema.graphql deleted file mode 100644 index bcfc21899b..0000000000 --- a/packages/templates/interface/assemblyscript/src/mutation/schema.graphql +++ /dev/null @@ -1,13 +0,0 @@ -#import { Mutation, Connection } into Ethereum from "w3://ens/ethereum.web3api.eth" - -type Mutation { - setData( - address: String! - value: UInt32! - connection: Ethereum_Connection - ): String! - - deployContract( - connection: Ethereum_Connection - ): String! -} diff --git a/packages/templates/interface/assemblyscript/src/query/index.ts b/packages/templates/interface/assemblyscript/src/query/index.ts deleted file mode 100644 index c9d51212bb..0000000000 --- a/packages/templates/interface/assemblyscript/src/query/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { - Ethereum_Query, - Input_getData -} from "./w3"; - -export function getData(input: Input_getData): u32 { - const res = Ethereum_Query.callView({ - address: input.address, - method: "function get() view returns (uint256)", - args: null, - connection: input.connection - }); - - return U32.parseInt(res); -} diff --git a/packages/templates/interface/assemblyscript/src/query/schema.graphql b/packages/templates/interface/assemblyscript/src/query/schema.graphql deleted file mode 100644 index f482cc128e..0000000000 --- a/packages/templates/interface/assemblyscript/src/query/schema.graphql +++ /dev/null @@ -1,8 +0,0 @@ -#import { Query, Connection } into Ethereum from "w3://ens/ethereum.web3api.eth" - -type Query { - getData( - address: String! - connection: Ethereum_Connection - ): Int! -} diff --git a/packages/templates/interface/assemblyscript/web3api.yaml b/packages/templates/interface/assemblyscript/web3api.yaml deleted file mode 100644 index 3395dcd364..0000000000 --- a/packages/templates/interface/assemblyscript/web3api.yaml +++ /dev/null @@ -1,16 +0,0 @@ -description: SimpleStorage Web3API Example -repository: https://github.com/web3-api/monorepo -format: 0.0.1-prealpha.1 -interface: true -mutation: - schema: - file: ./src/mutation/schema.graphql - module: - language: wasm/assemblyscript - file: ./src/mutation/index.ts -query: - schema: - file: ./src/query/schema.graphql - module: - language: wasm/assemblyscript - file: ./src/query/index.ts From ef786e2ec7aa38a7cd306fa8b0fd41b5255f6217 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 3 Jun 2021 18:08:25 +0200 Subject: [PATCH 003/112] added w3 create api interface command --- packages/cli/src/commands/create.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/cli/src/commands/create.ts b/packages/cli/src/commands/create.ts index 8bb35ed5dc..fc071cbed4 100644 --- a/packages/cli/src/commands/create.ts +++ b/packages/cli/src/commands/create.ts @@ -16,8 +16,7 @@ const createPluginStr = intlMsg.commands_create_options_createPlugin(); const pathStr = intlMsg.commands_create_options_o_path(); export const supportedLangs: { [key: string]: string[] } = { - interface: ["assemblyscript"], - api: ["assemblyscript"], + api: ["assemblyscript", "interface"], app: ["react"], plugin: ["typescript"], }; From 4cf0d348655f878fc80ed2799b13e5fa1c1f6669 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 3 Jun 2021 18:20:53 +0200 Subject: [PATCH 004/112] removed old way of dealing with create type --- packages/cli/src/commands/create.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/commands/create.ts b/packages/cli/src/commands/create.ts index fc071cbed4..f7845786d8 100644 --- a/packages/cli/src/commands/create.ts +++ b/packages/cli/src/commands/create.ts @@ -149,7 +149,7 @@ export default { .then(() => { print.newline(); let readyMessage; - if (type === "api" || type === "interface") { + if (type === "api") { readyMessage = intlMsg.commands_create_readyProtocol(); } else if (type === "app") { readyMessage = intlMsg.commands_create_readyDapp(); From 153da7f849b94cba5a0e447cb84064f3731f4014 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 3 Jun 2021 18:21:10 +0200 Subject: [PATCH 005/112] updated package name of api interface template --- packages/templates/api/interface/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/templates/api/interface/package.json b/packages/templates/api/interface/package.json index 66ef691485..56dc59b986 100644 --- a/packages/templates/api/interface/package.json +++ b/packages/templates/api/interface/package.json @@ -1,6 +1,6 @@ { - "name": "resolver-interface", - "description": "Web3API Resolver Interface", + "name": "templates-api-interface", + "description": "Web3API Interface Example", "private": true, "version": "0.0.1-prealpha.24", "scripts": { From 876c4f9041689ce376ec2658ea4478a677865300 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 4 Jun 2021 18:05:16 +0200 Subject: [PATCH 006/112] ran lint:fix --- packages/cli/src/lib/Compiler.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index ee4bc29204..1f0df0ffe8 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -83,7 +83,7 @@ export class Compiler { if (buildMutation && !composed.mutation) { throwMissingSchema("mutation"); } - + if (buildQuery && !composed.query?.schema) { throw Error(`compileWeb3Api: Missing schema for the module "query"`); } @@ -94,16 +94,19 @@ export class Compiler { ); } - if(buildWasmModules) { - + if (buildWasmModules) { if (manifest.query && !manifest.query.module) { - throw Error(`compileWeb3Api: Missing module definition for the module "query"`); + throw Error( + `compileWeb3Api: Missing module definition for the module "query"` + ); } if (manifest.mutation && !manifest.mutation.module) { - throw Error(`compileWeb3Api: Missing module definition for the module "mutation"`); + throw Error( + `compileWeb3Api: Missing module definition for the module "mutation"` + ); } - + const queryDirectory = manifest.query ? this._getGenerationDirectory(manifest.query.module!.file) : undefined; @@ -141,7 +144,7 @@ export class Compiler { if (buildQuery) { const queryManifest = manifest as Required; - if(buildWasmModules) { + if (buildWasmModules) { await this._compileWasmModule( queryManifest.query.module!.file, "query", @@ -151,14 +154,14 @@ export class Compiler { ); queryManifest.query.module!.file = `./query.wasm`; } - + queryManifest.query.schema.file = "./schema.graphql"; } if (buildMutation) { const mutationManifest = manifest as Required; - if(buildWasmModules) { + if (buildWasmModules) { await this._compileWasmModule( mutationManifest.mutation.module!.file, "mutation", @@ -168,7 +171,7 @@ export class Compiler { ); mutationManifest.mutation.module!.file = `./mutation.wasm`; } - + mutationManifest.mutation.schema.file = "./schema.graphql"; } }; From b7e6a81f2de452cdf2a868e1e4e067bd953ad9bf Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 4 Jun 2021 20:27:38 +0200 Subject: [PATCH 007/112] added get implementations method to js web3Api client --- packages/js/client/src/Web3ApiClient.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 7ea2045a96..65174c443b 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -18,6 +18,7 @@ import { InvokeApiResult, Manifest, sanitizeUriRedirects, + getImplementations } from "@web3api/core-js"; import { Tracer } from "@web3api/tracing-js"; @@ -215,4 +216,15 @@ export class Web3ApiClient implements Client { return run(uri); } + + public getImplementations(uri: Uri): Uri[] { + const run = Tracer.traceFunc( + "Web3ApiClient: getImplementations", + (uri: Uri): Uri[] => { + return getImplementations(uri, this.redirects()); + } + ); + + return run(uri); + } } From f20ad0786a4f5b51fdeacea7ec62a8da460d6d4b Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Mon, 7 Jun 2021 22:20:06 +0200 Subject: [PATCH 008/112] using string instead of uri for get implementations, started client get implementations tests --- packages/js/client/src/Web3ApiClient.ts | 7 ++- .../src/__tests__/Web3ApiClient.spec.ts | 56 ++++++++++++++++++- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 65174c443b..70fd3559da 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -217,11 +217,12 @@ export class Web3ApiClient implements Client { return run(uri); } - public getImplementations(uri: Uri): Uri[] { + public getImplementations(uri: string): string[] { const run = Tracer.traceFunc( "Web3ApiClient: getImplementations", - (uri: Uri): Uri[] => { - return getImplementations(uri, this.redirects()); + (uri: string): string[] => { + return getImplementations(new Uri(uri), this.redirects()) + .map(x => x.toString()); } ); diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 2fb788619e..48fd95ce60 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -1,4 +1,5 @@ import { + ClientConfig, createWeb3ApiClient } from "../"; import { @@ -7,6 +8,7 @@ import { stopTestEnvironment } from "@web3api/test-env-js"; import { GetPathToTestApis } from "@web3api/test-cases"; +import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; jest.setTimeout(50000); @@ -26,7 +28,7 @@ describe("Web3ApiClient", () => { await stopTestEnvironment(); }); - const getClient = async () => { + const getClient = async (config?: ClientConfig) => { return createWeb3ApiClient({ ethereum: { networks: { @@ -41,7 +43,7 @@ describe("Web3ApiClient", () => { testnet: ensAddress } } - }) + }, config); } it("simple-storage", async () => { @@ -899,4 +901,54 @@ describe("Web3ApiClient", () => { /Property must be of type 'array'. Found 'map'./ ); }); + + /*it("get implementations", async () => { + const interface1Uri = "ens/some-interface1.eth"; + const interface2Uri = "ens/some-interface2.eth"; + + const implementation1Uri = "ens/some-implementation.eth"; + const implementation2Uri = "ens/some-implementation2.eth"; + const implementation3Uri = "ens/some-implementation3.eth"; + + const client = await getClient({ + redirects: [ + { + from: interface1Uri, + to: implementation1Uri + }, + { + from: interface1Uri, + to: implementation2Uri + }, + { + from: interface2Uri, + to: implementation3Uri + }, + { + from: interface2Uri, + to: ethereumPlugin({ + networks: { + mainnet: { + provider: "ethereum" + } + }, + defaultNetwork: "mainnet" + }) + } + ] + }); + + const implementations1 = client.getImplementations(interface1Uri); + const implementations2 = client.getImplementations(interface2Uri); + + expect(implementations1).toBeTruthy(); + expect(implementations1.length).toBe(2); + expect(implementations1).toContain(implementation1Uri); + expect(implementations1).toContain(implementation2Uri); + + expect(implementations2).toBeTruthy(); + expect(implementations2.length).toBe(2); + expect(implementations2).toContain(implementation3Uri); + expect(implementations2).toContain(interface2Uri); + });*/ }); From d6dad50daa2702909f8ee3f4acac421052688ec4 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Mon, 7 Jun 2021 22:46:51 +0200 Subject: [PATCH 009/112] uncommented test and added implementations to client config --- packages/js/client/src/Web3ApiClient.ts | 6 ++++++ .../js/client/src/__tests__/Web3ApiClient.spec.ts | 15 ++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 70fd3559da..5b481e3cfb 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -22,8 +22,14 @@ import { } from "@web3api/core-js"; import { Tracer } from "@web3api/tracing-js"; +export interface UriInterfaceImplementations { + interface: TUri; + implementations: TUri[]; +} + export interface ClientConfig { redirects?: UriRedirect[]; + implementations?: UriInterfaceImplementations[]; tracingEnabled?: boolean; } diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 48fd95ce60..3ec58efd0c 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -902,13 +902,14 @@ describe("Web3ApiClient", () => { ); }); - /*it("get implementations", async () => { - const interface1Uri = "ens/some-interface1.eth"; - const interface2Uri = "ens/some-interface2.eth"; + it("get implementations", async () => { + console.log('saddssds'); + const interface1Uri = "w3://ens/some-interface1.eth"; + const interface2Uri = "w3://ens/some-interface2.eth"; - const implementation1Uri = "ens/some-implementation.eth"; - const implementation2Uri = "ens/some-implementation2.eth"; - const implementation3Uri = "ens/some-implementation3.eth"; + const implementation1Uri = "w3://ens/some-implementation.eth"; + const implementation2Uri = "w3://ens/some-implementation2.eth"; + const implementation3Uri = "w3://ens/some-implementation3.eth"; const client = await getClient({ redirects: [ @@ -950,5 +951,5 @@ describe("Web3ApiClient", () => { expect(implementations2.length).toBe(2); expect(implementations2).toContain(implementation3Uri); expect(implementations2).toContain(interface2Uri); - });*/ + }); }); From fc5843a38f1bd89a506ab4c27588c1b5e6298b9e Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 16:13:16 +0200 Subject: [PATCH 010/112] implemented applyRedirects, findPluginPackage and interfaceImplementations --- packages/js/client/src/Web3ApiClient.ts | 18 +-- .../js/core/src/algorithms/apply-redirects.ts | 61 ++++++++++ .../src/algorithms/find-plugin-package.ts | 12 ++ .../src/algorithms/get-implementations.ts | 49 +++++--- .../js/core/src/algorithms/resolve-uri.ts | 106 ++++++------------ packages/js/core/src/types/Client.ts | 1 + packages/js/core/src/types/UriRedirect.ts | 29 +++++ 7 files changed, 181 insertions(+), 95 deletions(-) create mode 100644 packages/js/core/src/algorithms/apply-redirects.ts create mode 100644 packages/js/core/src/algorithms/find-plugin-package.ts diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 5b481e3cfb..950e66453a 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -13,20 +13,17 @@ import { QueryApiResult, Uri, UriRedirect, + UriInterfaceImplementations, resolveUri, InvokeApiOptions, InvokeApiResult, Manifest, sanitizeUriRedirects, + sanitizeUriInterfaceImplementations, getImplementations } from "@web3api/core-js"; import { Tracer } from "@web3api/tracing-js"; -export interface UriInterfaceImplementations { - interface: TUri; - implementations: TUri[]; -} - export interface ClientConfig { redirects?: UriRedirect[]; implementations?: UriInterfaceImplementations[]; @@ -60,6 +57,9 @@ export class Web3ApiClient implements Client { redirects: config.redirects ? sanitizeUriRedirects(config.redirects) : [], + implementations: config.implementations + ? sanitizeUriInterfaceImplementations(config.implementations) + : [] }; } @@ -93,6 +93,10 @@ export class Web3ApiClient implements Client { return this._config.redirects || []; } + public implementations(): readonly UriInterfaceImplementations[] { + return this._config.implementations || []; + } + public async query< TData extends Record = Record, TVariables extends Record = Record @@ -227,8 +231,8 @@ export class Web3ApiClient implements Client { const run = Tracer.traceFunc( "Web3ApiClient: getImplementations", (uri: string): string[] => { - return getImplementations(new Uri(uri), this.redirects()) - .map(x => x.toString()); + return getImplementations(new Uri(uri), this.redirects(), this.implementations()) + .map(x => x.uri); } ); diff --git a/packages/js/core/src/algorithms/apply-redirects.ts b/packages/js/core/src/algorithms/apply-redirects.ts new file mode 100644 index 0000000000..876335dd21 --- /dev/null +++ b/packages/js/core/src/algorithms/apply-redirects.ts @@ -0,0 +1,61 @@ +import { Uri, UriRedirect } from "../types"; + +import { Tracer } from "@web3api/tracing-js"; + +export const applyRedirects = Tracer.traceFunc( + "core: applyRedirects", + ( + uri: Uri, + redirects: readonly UriRedirect[], + ): Uri => { + + // Keep track of past redirects (from -> to) to find the final uri + let redirectFromToMap: Record = {}; + + const throwError = (message: string) => { + throw Error( + `${message}\nResolution Stack: ${JSON.stringify( + redirectFromToMap, + null, + 2 + )}` + ); + } + + const checkForDuplicateRedirects = (redirectFrom: Uri, redirectFromToMap: Record) => { + if(redirectFromToMap[redirectFrom.uri]) { + throwError(`Cannot redirect from the same URI more than once, URI: "${uri}".`); + } + }; + + for(const redirect of redirects) { + if (!redirect.from) { + throwError(`Redirect missing the from property.\nEncountered while resolving ${uri.uri}`); + } + + if(Uri.isUri(redirect.to)) { + checkForDuplicateRedirects(redirect.from, redirectFromToMap); + + redirectFromToMap[redirect.from.uri] = redirect.to; + } + } + + let finalUri = uri; + + const visitedUris: Record = {}; + + while(redirectFromToMap[finalUri.uri]) { + + visitedUris[finalUri.uri] = true; + + finalUri = redirectFromToMap[finalUri.uri]; + + if(visitedUris[finalUri.uri]) { + throwError(`Infinite loop while resolving URI "${uri}".`); + } + } + + return finalUri; + } +); + \ No newline at end of file diff --git a/packages/js/core/src/algorithms/find-plugin-package.ts b/packages/js/core/src/algorithms/find-plugin-package.ts new file mode 100644 index 0000000000..d3f08788cf --- /dev/null +++ b/packages/js/core/src/algorithms/find-plugin-package.ts @@ -0,0 +1,12 @@ +import { Uri, PluginPackage, UriRedirect } from "../types"; + +import { Tracer } from "@web3api/tracing-js"; + +export const findPluginPackage = Tracer.traceFunc( + "core: findPluginPackage", + (uri: Uri, redirects: readonly UriRedirect[]): PluginPackage | undefined => { + const pluginRedirect = redirects.find(redirect => Uri.equals(redirect.from, uri) && !Uri.isUri(redirect.to)); + + return pluginRedirect?.to as (PluginPackage | undefined); + } +); \ No newline at end of file diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 7d4ea586fe..50b3d4821b 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -1,10 +1,11 @@ -import { Uri, UriRedirect } from "../types"; +import { Uri, UriRedirect, UriInterfaceImplementations } from "../types"; import { Tracer } from "@web3api/tracing-js"; +import { applyRedirects } from "./apply-redirects"; export const getImplementations = Tracer.traceFunc( "core: getImplementations", - (abstractApi: Uri, redirects: readonly UriRedirect[]): Uri[] => { + (apiInterfaceUri: Uri, redirects: readonly UriRedirect[], implementations: readonly UriInterfaceImplementations[]): Uri[] => { const result: Uri[] = []; const addUniqueResult = (uri: Uri) => { @@ -14,25 +15,39 @@ export const getImplementations = Tracer.traceFunc( } }; - for (const redirect of redirects) { - // Plugin implemented check - if (!Uri.isUri(redirect.to)) { - const { implemented } = redirect.to.manifest; - const implementedApi = - implemented.findIndex((uri) => Uri.equals(uri, abstractApi)) > -1; - - if (implementedApi) { - addUniqueResult(redirect.from); + const addAllImplementationsFromPluginRedirects = (redirects: readonly UriRedirect[], abstractApi: Uri) => { + for (const redirect of redirects) { + // Plugin implemented check + if (!Uri.isUri(redirect.to)) { + const { implemented } = redirect.to.manifest; + const implementedApi = + implemented.findIndex((uri) => Uri.equals(uri, apiInterfaceUri)) > -1; + + if (implementedApi) { + addUniqueResult(redirect.from); + } } } - // Explicit check - else if (Uri.isUri(redirect.from)) { - if (Uri.equals(redirect.from, abstractApi)) { - addUniqueResult(redirect.to); + }; + + + const addAllImplementationsFromImplementationsArray = (implementationsArray: readonly UriInterfaceImplementations[], abstractApi: Uri) => { + for (const interfaceImplementations of implementationsArray) { + const fullyResolvedUri = applyRedirects(interfaceImplementations.interface, redirects); + + if(Uri.equals(fullyResolvedUri, apiInterfaceUri)) { + for(const implementation of interfaceImplementations.implementations) { + addUniqueResult(implementation); + } } } - } + }; + + const fullyResolvedApiInterface = applyRedirects(apiInterfaceUri, redirects); + + addAllImplementationsFromPluginRedirects(redirects, fullyResolvedApiInterface); + addAllImplementationsFromImplementationsArray(implementations, fullyResolvedApiInterface); return result; } -); +); \ No newline at end of file diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index d1570f1d4c..20d5d40fd2 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -1,7 +1,8 @@ import { Api, Client, Uri, PluginPackage } from "../types"; import { Manifest, deserializeManifest } from "../manifest"; import * as ApiResolver from "../apis/api-resolver"; -import { getImplementations } from "./get-implementations"; +import { applyRedirects } from "./apply-redirects"; +import { findPluginPackage } from "./find-plugin-package"; import { Tracer } from "@web3api/tracing-js"; @@ -14,8 +15,35 @@ export const resolveUri = Tracer.traceFunc( createApi: (uri: Uri, manifest: Manifest, apiResolver: Uri) => Api, noValidate?: boolean ): Promise => { - let resolvedUri = uri; + const redirects = client.redirects(); + + let finalRedirectedUri = applyRedirects(uri, redirects); + + const plugin = findPluginPackage(finalRedirectedUri, redirects); + if(plugin) { + return Tracer.traceFunc( + "resolveUri: createPluginApi", + (uri: Uri, plugin: PluginPackage) => createPluginApi(uri, plugin) + )(finalRedirectedUri, plugin); + } + + // The final URI has been resolved, let's now resolve the Web3API package + const uriResolverImplementations = client.getImplementations("w3/api-resolver"); + + return await resolveUriWithApiResolvers(finalRedirectedUri, uriResolverImplementations, client, createApi, noValidate); + } +); + +const resolveUriWithApiResolvers = async ( + uri: Uri, + apiResolverImplementationUris: string[], + client: Client, + createApi: (uri: Uri, manifest: Manifest, apiResolver: Uri) => Api, + noValidate?: boolean + ): Promise => { + let resolvedUri = uri; + // Keep track of past URIs to avoid infinite loops let uriHistory: { uri: string; source: string }[] = [ { @@ -41,73 +69,10 @@ export const resolveUri = Tracer.traceFunc( } }; - const resetUriHistory = () => { - uriHistory = [ - { - uri: resolvedUri.uri, - source: "ROOT", - }, - ]; - }; - - const redirects = client.redirects(); - - // Iterate through all redirects. If anything matches - // apply the redirect, and restart the process over again. - // If the redirect `to` is a Plugin, return a PluginWeb3Api instance. - for (let i = 0; i < redirects.length; ++i) { - const redirect = redirects[i]; - const from = redirect.from; - - if (!from) { - throw Error( - `Redirect missing the from property.\nEncountered while resolving ${uri.uri}` - ); - } - - // Determine what type of comparison to use - const tryRedirect = (testUri: Uri): Uri | PluginPackage => - Uri.equals(testUri, from) ? redirect.to : testUri; - - const uriOrPlugin = tryRedirect(resolvedUri); - - // If we've redirected to another URI - if (Uri.isUri(uriOrPlugin)) { - if (uriOrPlugin.uri !== resolvedUri.uri) { - trackUriRedirect(uriOrPlugin.uri, redirect.from.uri); - - Tracer.addEvent("client-redirect", { - from: redirect.from.uri, - to: redirect.to, - }); - - // Restart the iteration over again - i = -1; - resolvedUri = uriOrPlugin; - } - } else { - // We've found a plugin, return an instance of it - return Tracer.traceFunc( - "resolveUri: createPluginApi", - (uri: Uri, plugin: PluginPackage) => createPluginApi(uri, plugin) - )(resolvedUri, uriOrPlugin); - } - } - - // The final URI has been resolved, let's now resolve the Web3API package - const uriResolverImplementations = getImplementations( - new Uri("w3/api-resolver"), - redirects - ); - - // Clear the history of URI redirects, so we can now - // track api-resolver driven redirects - resetUriHistory(); - // Iterate through all api-resolver implementations, // iteratively resolving the URI until we reach the Web3API manifest - for (let i = 0; i < uriResolverImplementations.length; ++i) { - const uriResolver = uriResolverImplementations[i]; + for (let i = 0; i < apiResolverImplementationUris.length; ++i) { + const uriResolver = new Uri(apiResolverImplementationUris[i]); const { data } = await ApiResolver.Query.tryResolveUri( client, @@ -153,9 +118,8 @@ export const resolveUri = Tracer.traceFunc( // We've failed to resolve the URI throw Error( - `No Web3API found at URI: ${uri.uri}` + + `No Web3API found at URI: ${resolvedUri.uri}` + `\nResolution Path: ${JSON.stringify(uriHistory, null, 2)}` + - `\nResolvers Used: ${uriResolverImplementations}` + `\nResolvers Used: ${apiResolverImplementationUris}` ); - } -); +} diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index aacd8aca9c..98036cb817 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -2,4 +2,5 @@ import { Uri, UriRedirect, QueryHandler, InvokeHandler } from "./"; export interface Client extends QueryHandler, InvokeHandler { redirects: () => readonly UriRedirect[]; + getImplementations: (uri: string) => string[]; } diff --git a/packages/js/core/src/types/UriRedirect.ts b/packages/js/core/src/types/UriRedirect.ts index 7df74b9f09..7118213658 100644 --- a/packages/js/core/src/types/UriRedirect.ts +++ b/packages/js/core/src/types/UriRedirect.ts @@ -12,6 +12,11 @@ export interface UriRedirect { to: TUri | PluginPackage; } +export interface UriInterfaceImplementations { + interface: TUri; + implementations: TUri[]; +} + export const sanitizeUriRedirects = Tracer.traceFunc( "core: sanitizeUriRedirects", (input: UriRedirect[]): UriRedirect[] => { @@ -32,3 +37,27 @@ export const sanitizeUriRedirects = Tracer.traceFunc( return output; } ); + +export const sanitizeUriInterfaceImplementations = Tracer.traceFunc( + "core: sanitizeUriInterfaceImplementations", + (input: UriInterfaceImplementations[]): UriInterfaceImplementations[] => { + const output: UriInterfaceImplementations[] = []; + for (const definition of input) { + const interfaceUri = new Uri(definition.interface); + + const implementations = definition.implementations + .map(x => + typeof x === "string" + ? new Uri(x) + : x + ); + + output.push({ + interface: interfaceUri, + implementations: implementations, + }); + } + + return output; + } +); From 4191e83fa27d71d49bbe1b96e663537219be3506 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 16:35:12 +0200 Subject: [PATCH 011/112] resolve uri refactor --- .../js/core/src/algorithms/apply-redirects.ts | 3 +- .../js/core/src/algorithms/resolve-uri.ts | 31 ++++++++++++------- packages/js/core/src/apis/api-resolver.ts | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/packages/js/core/src/algorithms/apply-redirects.ts b/packages/js/core/src/algorithms/apply-redirects.ts index 876335dd21..9e46cf7264 100644 --- a/packages/js/core/src/algorithms/apply-redirects.ts +++ b/packages/js/core/src/algorithms/apply-redirects.ts @@ -57,5 +57,4 @@ export const applyRedirects = Tracer.traceFunc( return finalUri; } -); - \ No newline at end of file +); \ No newline at end of file diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 20d5d40fd2..55b88a8413 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -69,11 +69,7 @@ const resolveUriWithApiResolvers = async ( } }; - // Iterate through all api-resolver implementations, - // iteratively resolving the URI until we reach the Web3API manifest - for (let i = 0; i < apiResolverImplementationUris.length; ++i) { - const uriResolver = new Uri(apiResolverImplementationUris[i]); - + const tryResolveUriWithApiResolver = async (uri: Uri, uriResolver: Uri): Promise => { const { data } = await ApiResolver.Query.tryResolveUri( client, uriResolver, @@ -83,15 +79,26 @@ const resolveUriWithApiResolvers = async ( // If nothing was returned, the URI is not supported if (!data || (!data.uri && !data.manifest)) { Tracer.addEvent("continue", uriResolver.uri); - continue; + return undefined; } - const newUri = data.uri; - const manifestStr = data.manifest; + return data; + }; + + // Iterate through all api-resolver implementations, + // iteratively resolving the URI until we reach the Web3API manifest + for (let i = 0; i < apiResolverImplementationUris.length; ++i) { + const uriResolver = new Uri(apiResolverImplementationUris[i]); + + const result = await tryResolveUriWithApiResolver(resolvedUri, uriResolver); + + if(!result) { + continue; + } - if (newUri) { + if (result.uri) { // Use the new URI, and reset our index - const convertedUri = new Uri(newUri); + const convertedUri = new Uri(result.uri); trackUriRedirect(convertedUri.uri, uriResolver.uri); Tracer.addEvent("api-resolver-redirect", { @@ -103,10 +110,10 @@ const resolveUriWithApiResolvers = async ( i = -1; resolvedUri = convertedUri; continue; - } else if (manifestStr) { + } else if (result.manifest) { // We've found our manifest at the current URI resolver // meaning the URI resolver can also be used as an API resolver - const manifest = deserializeManifest(manifestStr, { noValidate }); + const manifest = deserializeManifest(result.manifest, { noValidate }); return Tracer.traceFunc( "resolveUri: createApi", diff --git a/packages/js/core/src/apis/api-resolver.ts b/packages/js/core/src/apis/api-resolver.ts index a48f42412b..93b37c5a2f 100644 --- a/packages/js/core/src/apis/api-resolver.ts +++ b/packages/js/core/src/apis/api-resolver.ts @@ -3,7 +3,7 @@ import { Uri, Client, InvokeApiResult } from "../"; import { Tracer } from "@web3api/tracing-js"; -interface MaybeUriOrManifest { +export interface MaybeUriOrManifest { uri?: string; manifest?: string; } From 435c1b2d63d4ed987f2e62cf3529eb622f91ac06 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 16:45:22 +0200 Subject: [PATCH 012/112] minor renaming --- packages/js/core/src/algorithms/get-implementations.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 50b3d4821b..82e1acfa7a 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -30,7 +30,6 @@ export const getImplementations = Tracer.traceFunc( } }; - const addAllImplementationsFromImplementationsArray = (implementationsArray: readonly UriInterfaceImplementations[], abstractApi: Uri) => { for (const interfaceImplementations of implementationsArray) { const fullyResolvedUri = applyRedirects(interfaceImplementations.interface, redirects); @@ -43,10 +42,10 @@ export const getImplementations = Tracer.traceFunc( } }; - const fullyResolvedApiInterface = applyRedirects(apiInterfaceUri, redirects); + const finalRedirectedApiInterface = applyRedirects(apiInterfaceUri, redirects); - addAllImplementationsFromPluginRedirects(redirects, fullyResolvedApiInterface); - addAllImplementationsFromImplementationsArray(implementations, fullyResolvedApiInterface); + addAllImplementationsFromPluginRedirects(redirects, finalRedirectedApiInterface); + addAllImplementationsFromImplementationsArray(implementations, finalRedirectedApiInterface); return result; } From 2213744706702002a0131fba57b836fe689c9459 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 17:02:09 +0200 Subject: [PATCH 013/112] error now explicitly has any type --- packages/js/client/src/Web3ApiClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 950e66453a..066bbd1170 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -163,7 +163,7 @@ export class Web3ApiClient implements Client { } ); - return await run(options).catch((error) => { + return await run(options).catch((error: any) => { if (error.length) { return { errors: error }; } else { From b5711d7741aa8283d90fbd9af29dc5880ee316c6 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 17:25:41 +0200 Subject: [PATCH 014/112] implemented simple get implementations test --- .../src/__tests__/Web3ApiClient.spec.ts | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 3ec58efd0c..914c740370 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -903,30 +903,27 @@ describe("Web3ApiClient", () => { }); it("get implementations", async () => { - console.log('saddssds'); + const interface1Uri = "w3://ens/some-interface1.eth"; const interface2Uri = "w3://ens/some-interface2.eth"; const implementation1Uri = "w3://ens/some-implementation.eth"; const implementation2Uri = "w3://ens/some-implementation2.eth"; const implementation3Uri = "w3://ens/some-implementation3.eth"; + const implementation4Uri = "w3://ens/some-implementation4.eth"; const client = await getClient({ redirects: [ { - from: interface1Uri, - to: implementation1Uri - }, - { - from: interface1Uri, + from: implementation1Uri, to: implementation2Uri }, { - from: interface2Uri, + from: implementation2Uri, to: implementation3Uri }, { - from: interface2Uri, + from: implementation4Uri, to: ethereumPlugin({ networks: { mainnet: { @@ -936,9 +933,25 @@ describe("Web3ApiClient", () => { defaultNetwork: "mainnet" }) } + ], + implementations: [ + { + interface: interface1Uri, + implementations: [ + implementation1Uri, + implementation2Uri + ] + }, + { + interface: interface2Uri, + implementations: [ + implementation3Uri, + implementation4Uri + ] + } ] }); - + const implementations1 = client.getImplementations(interface1Uri); const implementations2 = client.getImplementations(interface2Uri); @@ -950,6 +963,6 @@ describe("Web3ApiClient", () => { expect(implementations2).toBeTruthy(); expect(implementations2.length).toBe(2); expect(implementations2).toContain(implementation3Uri); - expect(implementations2).toContain(interface2Uri); + expect(implementations2).toContain(implementation4Uri); }); }); From e5f1229a3b803b0000ddcfb7a592ce23d873a38e Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 18:00:50 +0200 Subject: [PATCH 015/112] lint fix --- packages/js/client/src/Web3ApiClient.ts | 13 +- .../js/core/src/algorithms/apply-redirects.ts | 46 ++-- .../src/algorithms/find-plugin-package.ts | 15 +- .../src/algorithms/get-implementations.ts | 51 +++-- .../js/core/src/algorithms/resolve-uri.ts | 207 +++++++++--------- packages/js/core/src/types/UriRedirect.ts | 13 +- 6 files changed, 194 insertions(+), 151 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 066bbd1170..3fdf29ff29 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -20,7 +20,7 @@ import { Manifest, sanitizeUriRedirects, sanitizeUriInterfaceImplementations, - getImplementations + getImplementations, } from "@web3api/core-js"; import { Tracer } from "@web3api/tracing-js"; @@ -59,7 +59,7 @@ export class Web3ApiClient implements Client { : [], implementations: config.implementations ? sanitizeUriInterfaceImplementations(config.implementations) - : [] + : [], }; } @@ -163,7 +163,7 @@ export class Web3ApiClient implements Client { } ); - return await run(options).catch((error: any) => { + return await run(options).catch((error) => { if (error.length) { return { errors: error }; } else { @@ -231,8 +231,11 @@ export class Web3ApiClient implements Client { const run = Tracer.traceFunc( "Web3ApiClient: getImplementations", (uri: string): string[] => { - return getImplementations(new Uri(uri), this.redirects(), this.implementations()) - .map(x => x.uri); + return getImplementations( + new Uri(uri), + this.redirects(), + this.implementations() + ).map((x) => x.uri); } ); diff --git a/packages/js/core/src/algorithms/apply-redirects.ts b/packages/js/core/src/algorithms/apply-redirects.ts index 9e46cf7264..7286d99b74 100644 --- a/packages/js/core/src/algorithms/apply-redirects.ts +++ b/packages/js/core/src/algorithms/apply-redirects.ts @@ -4,36 +4,39 @@ import { Tracer } from "@web3api/tracing-js"; export const applyRedirects = Tracer.traceFunc( "core: applyRedirects", - ( - uri: Uri, - redirects: readonly UriRedirect[], - ): Uri => { - - // Keep track of past redirects (from -> to) to find the final uri - let redirectFromToMap: Record = {}; + (uri: Uri, redirects: readonly UriRedirect[]): Uri => { + // Keep track of past redirects (from -> to) to find the final uri + const redirectFromToMap: Record = {}; const throwError = (message: string) => { throw Error( `${message}\nResolution Stack: ${JSON.stringify( - redirectFromToMap, - null, - 2 - )}` + redirectFromToMap, + null, + 2 + )}` ); - } + }; - const checkForDuplicateRedirects = (redirectFrom: Uri, redirectFromToMap: Record) => { - if(redirectFromToMap[redirectFrom.uri]) { - throwError(`Cannot redirect from the same URI more than once, URI: "${uri}".`); + const checkForDuplicateRedirects = ( + redirectFrom: Uri, + redirectFromToMap: Record + ) => { + if (redirectFromToMap[redirectFrom.uri]) { + throwError( + `Cannot redirect from the same URI more than once, URI: "${uri}".` + ); } }; - for(const redirect of redirects) { + for (const redirect of redirects) { if (!redirect.from) { - throwError(`Redirect missing the from property.\nEncountered while resolving ${uri.uri}`); + throwError( + `Redirect missing the from property.\nEncountered while resolving ${uri.uri}` + ); } - if(Uri.isUri(redirect.to)) { + if (Uri.isUri(redirect.to)) { checkForDuplicateRedirects(redirect.from, redirectFromToMap); redirectFromToMap[redirect.from.uri] = redirect.to; @@ -44,17 +47,16 @@ export const applyRedirects = Tracer.traceFunc( const visitedUris: Record = {}; - while(redirectFromToMap[finalUri.uri]) { - + while (redirectFromToMap[finalUri.uri]) { visitedUris[finalUri.uri] = true; finalUri = redirectFromToMap[finalUri.uri]; - if(visitedUris[finalUri.uri]) { + if (visitedUris[finalUri.uri]) { throwError(`Infinite loop while resolving URI "${uri}".`); } } return finalUri; } -); \ No newline at end of file +); diff --git a/packages/js/core/src/algorithms/find-plugin-package.ts b/packages/js/core/src/algorithms/find-plugin-package.ts index d3f08788cf..ca1df2e8a5 100644 --- a/packages/js/core/src/algorithms/find-plugin-package.ts +++ b/packages/js/core/src/algorithms/find-plugin-package.ts @@ -4,9 +4,14 @@ import { Tracer } from "@web3api/tracing-js"; export const findPluginPackage = Tracer.traceFunc( "core: findPluginPackage", - (uri: Uri, redirects: readonly UriRedirect[]): PluginPackage | undefined => { - const pluginRedirect = redirects.find(redirect => Uri.equals(redirect.from, uri) && !Uri.isUri(redirect.to)); - - return pluginRedirect?.to as (PluginPackage | undefined); + ( + uri: Uri, + redirects: readonly UriRedirect[] + ): PluginPackage | undefined => { + const pluginRedirect = redirects.find( + (redirect) => Uri.equals(redirect.from, uri) && !Uri.isUri(redirect.to) + ); + + return pluginRedirect?.to as PluginPackage | undefined; } -); \ No newline at end of file +); diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 82e1acfa7a..fad81685be 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -1,11 +1,15 @@ import { Uri, UriRedirect, UriInterfaceImplementations } from "../types"; +import { applyRedirects } from "./apply-redirects"; import { Tracer } from "@web3api/tracing-js"; -import { applyRedirects } from "./apply-redirects"; export const getImplementations = Tracer.traceFunc( "core: getImplementations", - (apiInterfaceUri: Uri, redirects: readonly UriRedirect[], implementations: readonly UriInterfaceImplementations[]): Uri[] => { + ( + apiInterfaceUri: Uri, + redirects: readonly UriRedirect[], + implementations: readonly UriInterfaceImplementations[] + ): Uri[] => { const result: Uri[] = []; const addUniqueResult = (uri: Uri) => { @@ -15,14 +19,18 @@ export const getImplementations = Tracer.traceFunc( } }; - const addAllImplementationsFromPluginRedirects = (redirects: readonly UriRedirect[], abstractApi: Uri) => { + const addAllImplementationsFromPluginRedirects = ( + redirects: readonly UriRedirect[], + apiInterfaceUri: Uri + ) => { for (const redirect of redirects) { // Plugin implemented check if (!Uri.isUri(redirect.to)) { const { implemented } = redirect.to.manifest; const implementedApi = - implemented.findIndex((uri) => Uri.equals(uri, apiInterfaceUri)) > -1; - + implemented.findIndex((uri) => Uri.equals(uri, apiInterfaceUri)) > + -1; + if (implementedApi) { addUniqueResult(redirect.from); } @@ -30,23 +38,38 @@ export const getImplementations = Tracer.traceFunc( } }; - const addAllImplementationsFromImplementationsArray = (implementationsArray: readonly UriInterfaceImplementations[], abstractApi: Uri) => { + const addAllImplementationsFromImplementationsArray = ( + implementationsArray: readonly UriInterfaceImplementations[], + apiInterfaceUri: Uri + ) => { for (const interfaceImplementations of implementationsArray) { - const fullyResolvedUri = applyRedirects(interfaceImplementations.interface, redirects); - - if(Uri.equals(fullyResolvedUri, apiInterfaceUri)) { - for(const implementation of interfaceImplementations.implementations) { + const fullyResolvedUri = applyRedirects( + interfaceImplementations.interface, + redirects + ); + + if (Uri.equals(fullyResolvedUri, apiInterfaceUri)) { + for (const implementation of interfaceImplementations.implementations) { addUniqueResult(implementation); } } } }; - const finalRedirectedApiInterface = applyRedirects(apiInterfaceUri, redirects); + const finalRedirectedApiInterface = applyRedirects( + apiInterfaceUri, + redirects + ); - addAllImplementationsFromPluginRedirects(redirects, finalRedirectedApiInterface); - addAllImplementationsFromImplementationsArray(implementations, finalRedirectedApiInterface); + addAllImplementationsFromPluginRedirects( + redirects, + finalRedirectedApiInterface + ); + addAllImplementationsFromImplementationsArray( + implementations, + finalRedirectedApiInterface + ); return result; } -); \ No newline at end of file +); diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 55b88a8413..3340d71cf7 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -16,117 +16,128 @@ export const resolveUri = Tracer.traceFunc( noValidate?: boolean ): Promise => { const redirects = client.redirects(); - - let finalRedirectedUri = applyRedirects(uri, redirects); + + const finalRedirectedUri = applyRedirects(uri, redirects); const plugin = findPluginPackage(finalRedirectedUri, redirects); - if(plugin) { + if (plugin) { return Tracer.traceFunc( - "resolveUri: createPluginApi", - (uri: Uri, plugin: PluginPackage) => createPluginApi(uri, plugin) - )(finalRedirectedUri, plugin); + "resolveUri: createPluginApi", + (uri: Uri, plugin: PluginPackage) => createPluginApi(uri, plugin) + )(finalRedirectedUri, plugin); } // The final URI has been resolved, let's now resolve the Web3API package - const uriResolverImplementations = client.getImplementations("w3/api-resolver"); + const uriResolverImplementations = client.getImplementations( + "w3/api-resolver" + ); - return await resolveUriWithApiResolvers(finalRedirectedUri, uriResolverImplementations, client, createApi, noValidate); + return await resolveUriWithApiResolvers( + finalRedirectedUri, + uriResolverImplementations, + client, + createApi, + noValidate + ); } ); const resolveUriWithApiResolvers = async ( - uri: Uri, - apiResolverImplementationUris: string[], - client: Client, - createApi: (uri: Uri, manifest: Manifest, apiResolver: Uri) => Api, - noValidate?: boolean - ): Promise => { - let resolvedUri = uri; - - // Keep track of past URIs to avoid infinite loops - let uriHistory: { uri: string; source: string }[] = [ - { - uri: resolvedUri.uri, - source: "ROOT", - }, - ]; - - const trackUriRedirect = (uri: string, source: string) => { - const dupIdx = uriHistory.findIndex((item) => item.uri === uri); - uriHistory.push({ - uri, - source, - }); - if (dupIdx > -1) { - throw Error( - `Infinite loop while resolving URI "${uri}".\nResolution Stack: ${JSON.stringify( - uriHistory, - null, - 2 - )}` - ); - } - }; - - const tryResolveUriWithApiResolver = async (uri: Uri, uriResolver: Uri): Promise => { - const { data } = await ApiResolver.Query.tryResolveUri( - client, - uriResolver, - resolvedUri + uri: Uri, + apiResolverImplementationUris: string[], + client: Client, + createApi: (uri: Uri, manifest: Manifest, apiResolver: Uri) => Api, + noValidate?: boolean +): Promise => { + let resolvedUri = uri; + + // Keep track of past URIs to avoid infinite loops + const uriHistory: { uri: string; source: string }[] = [ + { + uri: resolvedUri.uri, + source: "ROOT", + }, + ]; + + const trackUriRedirect = (uri: string, source: string) => { + const dupIdx = uriHistory.findIndex((item) => item.uri === uri); + uriHistory.push({ + uri, + source, + }); + if (dupIdx > -1) { + throw Error( + `Infinite loop while resolving URI "${uri}".\nResolution Stack: ${JSON.stringify( + uriHistory, + null, + 2 + )}` ); - - // If nothing was returned, the URI is not supported - if (!data || (!data.uri && !data.manifest)) { - Tracer.addEvent("continue", uriResolver.uri); - return undefined; - } - - return data; - }; - - // Iterate through all api-resolver implementations, - // iteratively resolving the URI until we reach the Web3API manifest - for (let i = 0; i < apiResolverImplementationUris.length; ++i) { - const uriResolver = new Uri(apiResolverImplementationUris[i]); - - const result = await tryResolveUriWithApiResolver(resolvedUri, uriResolver); - - if(!result) { - continue; - } - - if (result.uri) { - // Use the new URI, and reset our index - const convertedUri = new Uri(result.uri); - trackUriRedirect(convertedUri.uri, uriResolver.uri); - - Tracer.addEvent("api-resolver-redirect", { - from: resolvedUri.uri, - to: convertedUri.uri, - }); - - // Restart the iteration over again - i = -1; - resolvedUri = convertedUri; - continue; - } else if (result.manifest) { - // We've found our manifest at the current URI resolver - // meaning the URI resolver can also be used as an API resolver - const manifest = deserializeManifest(result.manifest, { noValidate }); - - return Tracer.traceFunc( - "resolveUri: createApi", - (uri: Uri, manifest: Manifest, apiResolver: Uri) => - createApi(uri, manifest, apiResolver) - )(resolvedUri, manifest, uriResolver); - } } + }; - // We've failed to resolve the URI - throw Error( - `No Web3API found at URI: ${resolvedUri.uri}` + - `\nResolution Path: ${JSON.stringify(uriHistory, null, 2)}` + - `\nResolvers Used: ${apiResolverImplementationUris}` + const tryResolveUriWithApiResolver = async ( + uri: Uri, + uriResolver: Uri + ): Promise => { + const { data } = await ApiResolver.Query.tryResolveUri( + client, + uriResolver, + resolvedUri ); -} + + // If nothing was returned, the URI is not supported + if (!data || (!data.uri && !data.manifest)) { + Tracer.addEvent("continue", uriResolver.uri); + return undefined; + } + + return data; + }; + + // Iterate through all api-resolver implementations, + // iteratively resolving the URI until we reach the Web3API manifest + for (let i = 0; i < apiResolverImplementationUris.length; ++i) { + const uriResolver = new Uri(apiResolverImplementationUris[i]); + + const result = await tryResolveUriWithApiResolver(resolvedUri, uriResolver); + + if (!result) { + continue; + } + + if (result.uri) { + // Use the new URI, and reset our index + const convertedUri = new Uri(result.uri); + trackUriRedirect(convertedUri.uri, uriResolver.uri); + + Tracer.addEvent("api-resolver-redirect", { + from: resolvedUri.uri, + to: convertedUri.uri, + }); + + // Restart the iteration over again + i = -1; + resolvedUri = convertedUri; + continue; + } else if (result.manifest) { + // We've found our manifest at the current URI resolver + // meaning the URI resolver can also be used as an API resolver + const manifest = deserializeManifest(result.manifest, { noValidate }); + + return Tracer.traceFunc( + "resolveUri: createApi", + (uri: Uri, manifest: Manifest, apiResolver: Uri) => + createApi(uri, manifest, apiResolver) + )(resolvedUri, manifest, uriResolver); + } + } + + // We've failed to resolve the URI + throw Error( + `No Web3API found at URI: ${resolvedUri.uri}` + + `\nResolution Path: ${JSON.stringify(uriHistory, null, 2)}` + + `\nResolvers Used: ${apiResolverImplementationUris}` + ); +}; diff --git a/packages/js/core/src/types/UriRedirect.ts b/packages/js/core/src/types/UriRedirect.ts index 7118213658..2e59c41c96 100644 --- a/packages/js/core/src/types/UriRedirect.ts +++ b/packages/js/core/src/types/UriRedirect.ts @@ -40,17 +40,16 @@ export const sanitizeUriRedirects = Tracer.traceFunc( export const sanitizeUriInterfaceImplementations = Tracer.traceFunc( "core: sanitizeUriInterfaceImplementations", - (input: UriInterfaceImplementations[]): UriInterfaceImplementations[] => { + ( + input: UriInterfaceImplementations[] + ): UriInterfaceImplementations[] => { const output: UriInterfaceImplementations[] = []; for (const definition of input) { const interfaceUri = new Uri(definition.interface); - const implementations = definition.implementations - .map(x => - typeof x === "string" - ? new Uri(x) - : x - ); + const implementations = definition.implementations.map((x) => + typeof x === "string" ? new Uri(x) : x + ); output.push({ interface: interfaceUri, From 939fdd1fe886b43bf241a04eaa1600e1d7b700b6 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 18:44:02 +0200 Subject: [PATCH 016/112] fixed up existing tests to work with new api interface changes --- .../src/__tests__/get-implementations.spec.ts | 27 ++++++++---- .../js/core/src/__tests__/resolve-uri.spec.ts | 43 +++++++++++-------- .../js/core/src/algorithms/resolve-uri.ts | 7 +-- packages/js/core/src/types/Client.ts | 3 +- 4 files changed, 49 insertions(+), 31 deletions(-) diff --git a/packages/js/core/src/__tests__/get-implementations.spec.ts b/packages/js/core/src/__tests__/get-implementations.spec.ts index e195e65a8f..705c127e53 100644 --- a/packages/js/core/src/__tests__/get-implementations.spec.ts +++ b/packages/js/core/src/__tests__/get-implementations.spec.ts @@ -5,14 +5,11 @@ import { SchemaDocument, Plugin, } from "../"; +import { UriInterfaceImplementations } from "../types"; describe("getImplementations", () => { it("works in the typical case", () => { - const implementations: UriRedirect[] = [ - { - from: new Uri("authority/some-abstract-interface"), - to: new Uri("one/1"), - }, + const pluginImplementations: UriRedirect[] = [ { from: new Uri("authority/some-abstract-interface"), to: { @@ -37,7 +34,16 @@ describe("getImplementations", () => { }, ]; - const others: UriRedirect[] = [ + const implementations: UriInterfaceImplementations[] = [ + { + interface: new Uri("authority/some-abstract-interface"), + implementations: [ + new Uri("one/1") + ], + } + ]; + + const otherRedirects: UriRedirect[] = [ { from: new Uri("some-other/other"), to: new Uri("other/other"), @@ -57,12 +63,17 @@ describe("getImplementations", () => { const result = getImplementations( new Uri("authority/some-abstract-interface"), - [...implementations, ...others] + [...pluginImplementations, ...otherRedirects], + implementations ); - const values = implementations.map((item) => + const values = pluginImplementations.map((item) => Uri.isUri(item.to) ? item.to : item.from + ).concat( + implementations.map(x => x.implementations) + .reduce((s,x) =>s.concat(x), []) ); + expect(result).toMatchObject(values); }); }); diff --git a/packages/js/core/src/__tests__/resolve-uri.spec.ts b/packages/js/core/src/__tests__/resolve-uri.spec.ts index b4088fdb39..3b0e8443e3 100644 --- a/packages/js/core/src/__tests__/resolve-uri.spec.ts +++ b/packages/js/core/src/__tests__/resolve-uri.spec.ts @@ -14,13 +14,16 @@ import { UriRedirect, resolveUri, } from "../"; +import { UriInterfaceImplementations } from "../types"; describe("resolveUri", () => { const client = ( redirects: UriRedirect[], - apis: Record + implementations: UriInterfaceImplementations[], + apis: Record, ): Client => ({ redirects: () => redirects, + implementations: () => implementations, query: < TData extends Record = Record, TVariables extends Record = Record, @@ -110,14 +113,6 @@ describe("resolveUri", () => { }; const redirects: UriRedirect[] = [ - { - from: new Uri("w3/api-resolver"), - to: new Uri("ens/ens"), - }, - { - from: new Uri("w3/api-resolver"), - to: new Uri("ens/ipfs"), - }, { from: new Uri("ens/my-plugin"), to: { @@ -129,6 +124,16 @@ describe("resolveUri", () => { }, }, }, + ] + + const implementations: UriInterfaceImplementations[] = [ + { + interface: new Uri("w3/api-resolver"), + implementations: [ + new Uri("ens/ens"), + new Uri("ens/ipfs") + ] + }, ]; const apis: Record = { @@ -144,14 +149,14 @@ describe("resolveUri", () => { const query = ApiResolver.Query; const uri = new Uri("w3/some-uri"); - expect(query.tryResolveUri(client(redirects, apis), api, uri)).toBeDefined(); - expect(query.getFile(client(redirects, apis), file, path)).toBeDefined(); + expect(query.tryResolveUri(client(redirects, implementations, apis), api, uri)).toBeDefined(); + expect(query.getFile(client(redirects, implementations, apis), file, path)).toBeDefined(); }); it("works in the typical case", async () => { const result = await resolveUri( new Uri("ens/test.eth"), - client(redirects, apis), + client(redirects, implementations, apis), createPluginApi, createApi, true @@ -174,7 +179,7 @@ describe("resolveUri", () => { it("uses a plugin that implements api-resolver", async () => { const result = await resolveUri( new Uri("my/something-different"), - client(redirects, apis), + client(redirects, implementations, apis), createPluginApi, createApi, true @@ -197,7 +202,7 @@ describe("resolveUri", () => { it("works when direct query a Web3API that implements the api-resolver", async () => { const result = await resolveUri( new Uri("ens/ens"), - client(redirects, apis), + client(redirects, implementations, apis), createPluginApi, createApi, true @@ -221,7 +226,7 @@ describe("resolveUri", () => { it("works when direct query a plugin Web3API that implements the api-resolver", async () => { const result = await resolveUri( new Uri("my/something-different"), - client(redirects, apis), + client(redirects, implementations, apis), createPluginApi, createApi, true @@ -258,7 +263,7 @@ describe("resolveUri", () => { return resolveUri( new Uri("some/api"), - client(circular, apis), + client(circular, implementations, apis), createPluginApi, createApi, true @@ -284,7 +289,7 @@ describe("resolveUri", () => { return resolveUri( new Uri("some/api"), - client(missingFromProperty, apis), + client(missingFromProperty, implementations, apis), createPluginApi, createApi, true @@ -311,7 +316,7 @@ describe("resolveUri", () => { const result = await resolveUri( new Uri("some/api"), - client(uriToPlugin, apis), + client(uriToPlugin, implementations, apis), createPluginApi, createApi, true @@ -346,7 +351,7 @@ describe("resolveUri", () => { await resolveUri( uri, - client(redirects, { + client(redirects, implementations, { ...apis, "w3://ens/ipfs": faultyIpfsApi }), diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 55b88a8413..8a2b110fd2 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -5,6 +5,7 @@ import { applyRedirects } from "./apply-redirects"; import { findPluginPackage } from "./find-plugin-package"; import { Tracer } from "@web3api/tracing-js"; +import { getImplementations } from "./get-implementations"; export const resolveUri = Tracer.traceFunc( "core: resolveUri", @@ -29,7 +30,7 @@ export const resolveUri = Tracer.traceFunc( } // The final URI has been resolved, let's now resolve the Web3API package - const uriResolverImplementations = client.getImplementations("w3/api-resolver"); + const uriResolverImplementations = getImplementations(new Uri("w3/api-resolver"), redirects, client.implementations()); return await resolveUriWithApiResolvers(finalRedirectedUri, uriResolverImplementations, client, createApi, noValidate); } @@ -37,7 +38,7 @@ export const resolveUri = Tracer.traceFunc( const resolveUriWithApiResolvers = async ( uri: Uri, - apiResolverImplementationUris: string[], + apiResolverImplementationUris: Uri[], client: Client, createApi: (uri: Uri, manifest: Manifest, apiResolver: Uri) => Api, noValidate?: boolean @@ -88,7 +89,7 @@ const resolveUriWithApiResolvers = async ( // Iterate through all api-resolver implementations, // iteratively resolving the URI until we reach the Web3API manifest for (let i = 0; i < apiResolverImplementationUris.length; ++i) { - const uriResolver = new Uri(apiResolverImplementationUris[i]); + const uriResolver = apiResolverImplementationUris[i]; const result = await tryResolveUriWithApiResolver(resolvedUri, uriResolver); diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index 98036cb817..8f82acacae 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -1,6 +1,7 @@ import { Uri, UriRedirect, QueryHandler, InvokeHandler } from "./"; +import { UriInterfaceImplementations } from "./UriRedirect"; export interface Client extends QueryHandler, InvokeHandler { redirects: () => readonly UriRedirect[]; - getImplementations: (uri: string) => string[]; + implementations: () => readonly UriInterfaceImplementations[]; } From 4b0ec9f31fac172aebbdc0f85c5fea2326f9c03b Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 19:11:47 +0200 Subject: [PATCH 017/112] lint fix and tests --- .../src/__tests__/Web3ApiClient.spec.ts | 41 ++-- .../src/__tests__/get-implementations.spec.ts | 92 ++++++++ .../js/core/src/algorithms/apply-redirects.ts | 46 ++-- .../src/algorithms/find-plugin-package.ts | 15 +- .../src/algorithms/get-implementations.ts | 51 +++-- .../js/core/src/algorithms/resolve-uri.ts | 211 ++++++++++-------- packages/js/core/src/types/UriRedirect.ts | 13 +- 7 files changed, 309 insertions(+), 160 deletions(-) diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 914c740370..10dd0e055a 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -1,6 +1,8 @@ import { ClientConfig, - createWeb3ApiClient + createWeb3ApiClient, + SchemaDocument, + Plugin } from "../"; import { buildAndDeployApi, @@ -8,7 +10,6 @@ import { stopTestEnvironment } from "@web3api/test-env-js"; import { GetPathToTestApis } from "@web3api/test-cases"; -import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; jest.setTimeout(50000); @@ -906,6 +907,7 @@ describe("Web3ApiClient", () => { const interface1Uri = "w3://ens/some-interface1.eth"; const interface2Uri = "w3://ens/some-interface2.eth"; + const interface3Uri = "w3://ens/some-interface3.eth"; const implementation1Uri = "w3://ens/some-implementation.eth"; const implementation2Uri = "w3://ens/some-implementation2.eth"; @@ -914,6 +916,10 @@ describe("Web3ApiClient", () => { const client = await getClient({ redirects: [ + { + from: interface1Uri, + to: interface2Uri + }, { from: implementation1Uri, to: implementation2Uri @@ -924,14 +930,14 @@ describe("Web3ApiClient", () => { }, { from: implementation4Uri, - to: ethereumPlugin({ - networks: { - mainnet: { - provider: "ethereum" - } - }, - defaultNetwork: "mainnet" - }) + to: { + factory: () => ({} as Plugin), + manifest: { + schema: {} as SchemaDocument, + implemented: [], + imported: [], + } + } } ], implementations: [ @@ -944,6 +950,12 @@ describe("Web3ApiClient", () => { }, { interface: interface2Uri, + implementations: [ + implementation3Uri + ] + }, + { + interface: interface3Uri, implementations: [ implementation3Uri, implementation4Uri @@ -956,9 +968,12 @@ describe("Web3ApiClient", () => { const implementations2 = client.getImplementations(interface2Uri); expect(implementations1).toBeTruthy(); - expect(implementations1.length).toBe(2); - expect(implementations1).toContain(implementation1Uri); - expect(implementations1).toContain(implementation2Uri); + expect(implementations1.length).toBe(1); + expect(implementations1).toContain(implementation3Uri); + + expect(implementations2).toBeTruthy(); + expect(implementations2.length).toBe(1); + expect(implementations2).toContain(implementation3Uri); expect(implementations2).toBeTruthy(); expect(implementations2.length).toBe(2); diff --git a/packages/js/core/src/__tests__/get-implementations.spec.ts b/packages/js/core/src/__tests__/get-implementations.spec.ts index 705c127e53..ec6acd4019 100644 --- a/packages/js/core/src/__tests__/get-implementations.spec.ts +++ b/packages/js/core/src/__tests__/get-implementations.spec.ts @@ -76,4 +76,96 @@ describe("getImplementations", () => { expect(result).toMatchObject(values); }); + + it("works with complex redirects", () => { + const interface1Uri = "w3://ens/some-interface1.eth"; + const interface2Uri = "w3://ens/some-interface2.eth"; + const interface3Uri = "w3://ens/some-interface3.eth"; + + const implementation1Uri = "w3://ens/some-implementation.eth"; + const implementation2Uri = "w3://ens/some-implementation2.eth"; + const implementation3Uri = "w3://ens/some-implementation3.eth"; + const implementation4Uri = "w3://ens/some-implementation4.eth"; + + const redirects: UriRedirect[] = [ + { + from: new Uri(interface1Uri), + to: new Uri(interface2Uri) + }, + { + from: new Uri(implementation1Uri), + to: new Uri(implementation2Uri) + }, + { + from: new Uri(implementation2Uri), + to: new Uri(implementation3Uri) + } + ]; + + const pluginImplementations: UriRedirect[] = [ + { + from: new Uri(implementation4Uri), + to: { + factory: () => ({} as Plugin), + manifest: { + schema: {} as SchemaDocument, + implemented: [new Uri("authority/some-abstract-interface")], + imported: [new Uri("something/else-2")], + }, + } + } + ]; + + const implementations: UriInterfaceImplementations[] = [ + { + interface: new Uri(interface1Uri), + implementations: [ + new Uri(implementation1Uri), + new Uri(implementation2Uri) + ] + }, + { + interface: new Uri(interface2Uri), + implementations: [ + new Uri(implementation3Uri) + ] + }, + { + interface: new Uri(interface3Uri), + implementations: [ + new Uri(implementation3Uri), + new Uri(implementation4Uri) + ] + } + ]; + + const getImplementationsResult1 = getImplementations( + new Uri(interface1Uri), + [...pluginImplementations, ...redirects], + implementations + ); + const getImplementationsResult2 = getImplementations( + new Uri(interface2Uri), + [...pluginImplementations, ...redirects], + implementations + ); + const getImplementationsResult3 = getImplementations( + new Uri(interface3Uri), + [...pluginImplementations, ...redirects], + implementations + ); + + expect(getImplementationsResult1).toBeTruthy(); + expect(getImplementationsResult1.length).toBe(1); + expect(getImplementationsResult1).toContain(implementation3Uri); + + expect(getImplementationsResult2).toBeTruthy(); + expect(getImplementationsResult2.length).toBe(1); + expect(getImplementationsResult2).toContain(implementation3Uri); + + expect(getImplementationsResult3).toBeTruthy(); + expect(getImplementationsResult3.length).toBe(2); + expect(getImplementationsResult3).toContain(implementation3Uri); + expect(getImplementationsResult3).toContain(implementation4Uri); + }); }); diff --git a/packages/js/core/src/algorithms/apply-redirects.ts b/packages/js/core/src/algorithms/apply-redirects.ts index 9e46cf7264..7286d99b74 100644 --- a/packages/js/core/src/algorithms/apply-redirects.ts +++ b/packages/js/core/src/algorithms/apply-redirects.ts @@ -4,36 +4,39 @@ import { Tracer } from "@web3api/tracing-js"; export const applyRedirects = Tracer.traceFunc( "core: applyRedirects", - ( - uri: Uri, - redirects: readonly UriRedirect[], - ): Uri => { - - // Keep track of past redirects (from -> to) to find the final uri - let redirectFromToMap: Record = {}; + (uri: Uri, redirects: readonly UriRedirect[]): Uri => { + // Keep track of past redirects (from -> to) to find the final uri + const redirectFromToMap: Record = {}; const throwError = (message: string) => { throw Error( `${message}\nResolution Stack: ${JSON.stringify( - redirectFromToMap, - null, - 2 - )}` + redirectFromToMap, + null, + 2 + )}` ); - } + }; - const checkForDuplicateRedirects = (redirectFrom: Uri, redirectFromToMap: Record) => { - if(redirectFromToMap[redirectFrom.uri]) { - throwError(`Cannot redirect from the same URI more than once, URI: "${uri}".`); + const checkForDuplicateRedirects = ( + redirectFrom: Uri, + redirectFromToMap: Record + ) => { + if (redirectFromToMap[redirectFrom.uri]) { + throwError( + `Cannot redirect from the same URI more than once, URI: "${uri}".` + ); } }; - for(const redirect of redirects) { + for (const redirect of redirects) { if (!redirect.from) { - throwError(`Redirect missing the from property.\nEncountered while resolving ${uri.uri}`); + throwError( + `Redirect missing the from property.\nEncountered while resolving ${uri.uri}` + ); } - if(Uri.isUri(redirect.to)) { + if (Uri.isUri(redirect.to)) { checkForDuplicateRedirects(redirect.from, redirectFromToMap); redirectFromToMap[redirect.from.uri] = redirect.to; @@ -44,17 +47,16 @@ export const applyRedirects = Tracer.traceFunc( const visitedUris: Record = {}; - while(redirectFromToMap[finalUri.uri]) { - + while (redirectFromToMap[finalUri.uri]) { visitedUris[finalUri.uri] = true; finalUri = redirectFromToMap[finalUri.uri]; - if(visitedUris[finalUri.uri]) { + if (visitedUris[finalUri.uri]) { throwError(`Infinite loop while resolving URI "${uri}".`); } } return finalUri; } -); \ No newline at end of file +); diff --git a/packages/js/core/src/algorithms/find-plugin-package.ts b/packages/js/core/src/algorithms/find-plugin-package.ts index d3f08788cf..ca1df2e8a5 100644 --- a/packages/js/core/src/algorithms/find-plugin-package.ts +++ b/packages/js/core/src/algorithms/find-plugin-package.ts @@ -4,9 +4,14 @@ import { Tracer } from "@web3api/tracing-js"; export const findPluginPackage = Tracer.traceFunc( "core: findPluginPackage", - (uri: Uri, redirects: readonly UriRedirect[]): PluginPackage | undefined => { - const pluginRedirect = redirects.find(redirect => Uri.equals(redirect.from, uri) && !Uri.isUri(redirect.to)); - - return pluginRedirect?.to as (PluginPackage | undefined); + ( + uri: Uri, + redirects: readonly UriRedirect[] + ): PluginPackage | undefined => { + const pluginRedirect = redirects.find( + (redirect) => Uri.equals(redirect.from, uri) && !Uri.isUri(redirect.to) + ); + + return pluginRedirect?.to as PluginPackage | undefined; } -); \ No newline at end of file +); diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 82e1acfa7a..e2965c7734 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -1,11 +1,15 @@ import { Uri, UriRedirect, UriInterfaceImplementations } from "../types"; +import { applyRedirects } from "./apply-redirects"; import { Tracer } from "@web3api/tracing-js"; -import { applyRedirects } from "./apply-redirects"; export const getImplementations = Tracer.traceFunc( "core: getImplementations", - (apiInterfaceUri: Uri, redirects: readonly UriRedirect[], implementations: readonly UriInterfaceImplementations[]): Uri[] => { + ( + apiInterfaceUri: Uri, + redirects: readonly UriRedirect[], + implementations: readonly UriInterfaceImplementations[] + ): Uri[] => { const result: Uri[] = []; const addUniqueResult = (uri: Uri) => { @@ -15,14 +19,18 @@ export const getImplementations = Tracer.traceFunc( } }; - const addAllImplementationsFromPluginRedirects = (redirects: readonly UriRedirect[], abstractApi: Uri) => { + const addAllImplementationsFromPluginRedirects = ( + redirects: readonly UriRedirect[], + abstractApi: Uri + ) => { for (const redirect of redirects) { // Plugin implemented check if (!Uri.isUri(redirect.to)) { const { implemented } = redirect.to.manifest; const implementedApi = - implemented.findIndex((uri) => Uri.equals(uri, apiInterfaceUri)) > -1; - + implemented.findIndex((uri) => Uri.equals(uri, apiInterfaceUri)) > + -1; + if (implementedApi) { addUniqueResult(redirect.from); } @@ -30,23 +38,38 @@ export const getImplementations = Tracer.traceFunc( } }; - const addAllImplementationsFromImplementationsArray = (implementationsArray: readonly UriInterfaceImplementations[], abstractApi: Uri) => { + const addAllImplementationsFromImplementationsArray = ( + implementationsArray: readonly UriInterfaceImplementations[], + abstractApi: Uri + ) => { for (const interfaceImplementations of implementationsArray) { - const fullyResolvedUri = applyRedirects(interfaceImplementations.interface, redirects); - - if(Uri.equals(fullyResolvedUri, apiInterfaceUri)) { - for(const implementation of interfaceImplementations.implementations) { + const fullyResolvedUri = applyRedirects( + interfaceImplementations.interface, + redirects + ); + + if (Uri.equals(fullyResolvedUri, apiInterfaceUri)) { + for (const implementation of interfaceImplementations.implementations) { addUniqueResult(implementation); } } } }; - const finalRedirectedApiInterface = applyRedirects(apiInterfaceUri, redirects); + const finalRedirectedApiInterface = applyRedirects( + apiInterfaceUri, + redirects + ); - addAllImplementationsFromPluginRedirects(redirects, finalRedirectedApiInterface); - addAllImplementationsFromImplementationsArray(implementations, finalRedirectedApiInterface); + addAllImplementationsFromPluginRedirects( + redirects, + finalRedirectedApiInterface + ); + addAllImplementationsFromImplementationsArray( + implementations, + finalRedirectedApiInterface + ); return result; } -); \ No newline at end of file +); diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 8a2b110fd2..ba7ec5bbdc 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -3,9 +3,9 @@ import { Manifest, deserializeManifest } from "../manifest"; import * as ApiResolver from "../apis/api-resolver"; import { applyRedirects } from "./apply-redirects"; import { findPluginPackage } from "./find-plugin-package"; +import { getImplementations } from "./get-implementations"; import { Tracer } from "@web3api/tracing-js"; -import { getImplementations } from "./get-implementations"; export const resolveUri = Tracer.traceFunc( "core: resolveUri", @@ -17,117 +17,130 @@ export const resolveUri = Tracer.traceFunc( noValidate?: boolean ): Promise => { const redirects = client.redirects(); - - let finalRedirectedUri = applyRedirects(uri, redirects); + + const finalRedirectedUri = applyRedirects(uri, redirects); const plugin = findPluginPackage(finalRedirectedUri, redirects); - if(plugin) { + if (plugin) { return Tracer.traceFunc( - "resolveUri: createPluginApi", - (uri: Uri, plugin: PluginPackage) => createPluginApi(uri, plugin) - )(finalRedirectedUri, plugin); + "resolveUri: createPluginApi", + (uri: Uri, plugin: PluginPackage) => createPluginApi(uri, plugin) + )(finalRedirectedUri, plugin); } // The final URI has been resolved, let's now resolve the Web3API package - const uriResolverImplementations = getImplementations(new Uri("w3/api-resolver"), redirects, client.implementations()); + const uriResolverImplementations = getImplementations( + new Uri("w3/api-resolver"), + redirects, + client.implementations() + ); - return await resolveUriWithApiResolvers(finalRedirectedUri, uriResolverImplementations, client, createApi, noValidate); + return await resolveUriWithApiResolvers( + finalRedirectedUri, + uriResolverImplementations, + client, + createApi, + noValidate + ); } ); const resolveUriWithApiResolvers = async ( - uri: Uri, - apiResolverImplementationUris: Uri[], - client: Client, - createApi: (uri: Uri, manifest: Manifest, apiResolver: Uri) => Api, - noValidate?: boolean - ): Promise => { - let resolvedUri = uri; - - // Keep track of past URIs to avoid infinite loops - let uriHistory: { uri: string; source: string }[] = [ - { - uri: resolvedUri.uri, - source: "ROOT", - }, - ]; - - const trackUriRedirect = (uri: string, source: string) => { - const dupIdx = uriHistory.findIndex((item) => item.uri === uri); - uriHistory.push({ - uri, - source, - }); - if (dupIdx > -1) { - throw Error( - `Infinite loop while resolving URI "${uri}".\nResolution Stack: ${JSON.stringify( - uriHistory, - null, - 2 - )}` - ); - } - }; - - const tryResolveUriWithApiResolver = async (uri: Uri, uriResolver: Uri): Promise => { - const { data } = await ApiResolver.Query.tryResolveUri( - client, - uriResolver, - resolvedUri + uri: Uri, + apiResolverImplementationUris: Uri[], + client: Client, + createApi: (uri: Uri, manifest: Manifest, apiResolver: Uri) => Api, + noValidate?: boolean +): Promise => { + let resolvedUri = uri; + + // Keep track of past URIs to avoid infinite loops + const uriHistory: { uri: string; source: string }[] = [ + { + uri: resolvedUri.uri, + source: "ROOT", + }, + ]; + + const trackUriRedirect = (uri: string, source: string) => { + const dupIdx = uriHistory.findIndex((item) => item.uri === uri); + uriHistory.push({ + uri, + source, + }); + if (dupIdx > -1) { + throw Error( + `Infinite loop while resolving URI "${uri}".\nResolution Stack: ${JSON.stringify( + uriHistory, + null, + 2 + )}` ); - - // If nothing was returned, the URI is not supported - if (!data || (!data.uri && !data.manifest)) { - Tracer.addEvent("continue", uriResolver.uri); - return undefined; - } - - return data; - }; - - // Iterate through all api-resolver implementations, - // iteratively resolving the URI until we reach the Web3API manifest - for (let i = 0; i < apiResolverImplementationUris.length; ++i) { - const uriResolver = apiResolverImplementationUris[i]; - - const result = await tryResolveUriWithApiResolver(resolvedUri, uriResolver); - - if(!result) { - continue; - } - - if (result.uri) { - // Use the new URI, and reset our index - const convertedUri = new Uri(result.uri); - trackUriRedirect(convertedUri.uri, uriResolver.uri); - - Tracer.addEvent("api-resolver-redirect", { - from: resolvedUri.uri, - to: convertedUri.uri, - }); - - // Restart the iteration over again - i = -1; - resolvedUri = convertedUri; - continue; - } else if (result.manifest) { - // We've found our manifest at the current URI resolver - // meaning the URI resolver can also be used as an API resolver - const manifest = deserializeManifest(result.manifest, { noValidate }); - - return Tracer.traceFunc( - "resolveUri: createApi", - (uri: Uri, manifest: Manifest, apiResolver: Uri) => - createApi(uri, manifest, apiResolver) - )(resolvedUri, manifest, uriResolver); - } } + }; - // We've failed to resolve the URI - throw Error( - `No Web3API found at URI: ${resolvedUri.uri}` + - `\nResolution Path: ${JSON.stringify(uriHistory, null, 2)}` + - `\nResolvers Used: ${apiResolverImplementationUris}` + const tryResolveUriWithApiResolver = async ( + uri: Uri, + uriResolver: Uri + ): Promise => { + const { data } = await ApiResolver.Query.tryResolveUri( + client, + uriResolver, + resolvedUri ); -} + + // If nothing was returned, the URI is not supported + if (!data || (!data.uri && !data.manifest)) { + Tracer.addEvent("continue", uriResolver.uri); + return undefined; + } + + return data; + }; + + // Iterate through all api-resolver implementations, + // iteratively resolving the URI until we reach the Web3API manifest + for (let i = 0; i < apiResolverImplementationUris.length; ++i) { + const uriResolver = apiResolverImplementationUris[i]; + + const result = await tryResolveUriWithApiResolver(resolvedUri, uriResolver); + + if (!result) { + continue; + } + + if (result.uri) { + // Use the new URI, and reset our index + const convertedUri = new Uri(result.uri); + trackUriRedirect(convertedUri.uri, uriResolver.uri); + + Tracer.addEvent("api-resolver-redirect", { + from: resolvedUri.uri, + to: convertedUri.uri, + }); + + // Restart the iteration over again + i = -1; + resolvedUri = convertedUri; + continue; + } else if (result.manifest) { + // We've found our manifest at the current URI resolver + // meaning the URI resolver can also be used as an API resolver + const manifest = deserializeManifest(result.manifest, { noValidate }); + + return Tracer.traceFunc( + "resolveUri: createApi", + (uri: Uri, manifest: Manifest, apiResolver: Uri) => + createApi(uri, manifest, apiResolver) + )(resolvedUri, manifest, uriResolver); + } + } + + // We've failed to resolve the URI + throw Error( + `No Web3API found at URI: ${resolvedUri.uri}` + + `\nResolution Path: ${JSON.stringify(uriHistory, null, 2)}` + + `\nResolvers Used: ${apiResolverImplementationUris}` + ); +}; diff --git a/packages/js/core/src/types/UriRedirect.ts b/packages/js/core/src/types/UriRedirect.ts index 7118213658..2e59c41c96 100644 --- a/packages/js/core/src/types/UriRedirect.ts +++ b/packages/js/core/src/types/UriRedirect.ts @@ -40,17 +40,16 @@ export const sanitizeUriRedirects = Tracer.traceFunc( export const sanitizeUriInterfaceImplementations = Tracer.traceFunc( "core: sanitizeUriInterfaceImplementations", - (input: UriInterfaceImplementations[]): UriInterfaceImplementations[] => { + ( + input: UriInterfaceImplementations[] + ): UriInterfaceImplementations[] => { const output: UriInterfaceImplementations[] = []; for (const definition of input) { const interfaceUri = new Uri(definition.interface); - const implementations = definition.implementations - .map(x => - typeof x === "string" - ? new Uri(x) - : x - ); + const implementations = definition.implementations.map((x) => + typeof x === "string" ? new Uri(x) : x + ); output.push({ interface: interfaceUri, From 65a8959f35a325972d1f36a3d6f2d42c228eddb3 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 19:20:41 +0200 Subject: [PATCH 018/112] merged with base --- packages/js/client/src/Web3ApiClient.ts | 13 ++++++++----- .../js/core/src/algorithms/get-implementations.ts | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 066bbd1170..3fdf29ff29 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -20,7 +20,7 @@ import { Manifest, sanitizeUriRedirects, sanitizeUriInterfaceImplementations, - getImplementations + getImplementations, } from "@web3api/core-js"; import { Tracer } from "@web3api/tracing-js"; @@ -59,7 +59,7 @@ export class Web3ApiClient implements Client { : [], implementations: config.implementations ? sanitizeUriInterfaceImplementations(config.implementations) - : [] + : [], }; } @@ -163,7 +163,7 @@ export class Web3ApiClient implements Client { } ); - return await run(options).catch((error: any) => { + return await run(options).catch((error) => { if (error.length) { return { errors: error }; } else { @@ -231,8 +231,11 @@ export class Web3ApiClient implements Client { const run = Tracer.traceFunc( "Web3ApiClient: getImplementations", (uri: string): string[] => { - return getImplementations(new Uri(uri), this.redirects(), this.implementations()) - .map(x => x.uri); + return getImplementations( + new Uri(uri), + this.redirects(), + this.implementations() + ).map((x) => x.uri); } ); diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index e2965c7734..fad81685be 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -21,7 +21,7 @@ export const getImplementations = Tracer.traceFunc( const addAllImplementationsFromPluginRedirects = ( redirects: readonly UriRedirect[], - abstractApi: Uri + apiInterfaceUri: Uri ) => { for (const redirect of redirects) { // Plugin implemented check @@ -40,7 +40,7 @@ export const getImplementations = Tracer.traceFunc( const addAllImplementationsFromImplementationsArray = ( implementationsArray: readonly UriInterfaceImplementations[], - abstractApi: Uri + apiInterfaceUri: Uri ) => { for (const interfaceImplementations of implementationsArray) { const fullyResolvedUri = applyRedirects( From 25aeafcd3df2a58e4d29eb653b4f2d429f823f9f Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 19:43:09 +0200 Subject: [PATCH 019/112] fixed up get-implementations tests --- .../src/__tests__/Web3ApiClient.spec.ts | 28 ++++++++++++------- .../src/__tests__/get-implementations.spec.ts | 25 +++++++++++------ 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 10dd0e055a..31388a2fc9 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -933,7 +933,7 @@ describe("Web3ApiClient", () => { to: { factory: () => ({} as Plugin), manifest: { - schema: {} as SchemaDocument, + schema: "", implemented: [], imported: [], } @@ -966,18 +966,26 @@ describe("Web3ApiClient", () => { const implementations1 = client.getImplementations(interface1Uri); const implementations2 = client.getImplementations(interface2Uri); + const implementations3 = client.getImplementations(interface3Uri); expect(implementations1).toBeTruthy(); - expect(implementations1.length).toBe(1); - expect(implementations1).toContain(implementation3Uri); + expect(implementations1).toEqual([ + implementation1Uri, + implementation2Uri, + implementation3Uri + ]); expect(implementations2).toBeTruthy(); - expect(implementations2.length).toBe(1); - expect(implementations2).toContain(implementation3Uri); - - expect(implementations2).toBeTruthy(); - expect(implementations2.length).toBe(2); - expect(implementations2).toContain(implementation3Uri); - expect(implementations2).toContain(implementation4Uri); + expect(implementations2).toEqual([ + implementation1Uri, + implementation2Uri, + implementation3Uri + ]); + + expect(implementations3).toBeTruthy(); + expect(implementations3).toEqual([ + implementation3Uri, + implementation4Uri + ]); }); }); diff --git a/packages/js/core/src/__tests__/get-implementations.spec.ts b/packages/js/core/src/__tests__/get-implementations.spec.ts index ec6acd4019..ef0e9c60b9 100644 --- a/packages/js/core/src/__tests__/get-implementations.spec.ts +++ b/packages/js/core/src/__tests__/get-implementations.spec.ts @@ -53,7 +53,7 @@ describe("getImplementations", () => { to: { factory: () => ({} as Plugin), manifest: { - schema: {} as SchemaDocument, + schema: "", implemented: [], imported: [], }, @@ -108,7 +108,7 @@ describe("getImplementations", () => { to: { factory: () => ({} as Plugin), manifest: { - schema: {} as SchemaDocument, + schema: '', implemented: [new Uri("authority/some-abstract-interface")], imported: [new Uri("something/else-2")], }, @@ -156,16 +156,23 @@ describe("getImplementations", () => { ); expect(getImplementationsResult1).toBeTruthy(); - expect(getImplementationsResult1.length).toBe(1); - expect(getImplementationsResult1).toContain(implementation3Uri); + expect(getImplementationsResult1).toEqual([ + new Uri(implementation1Uri), + new Uri(implementation2Uri), + new Uri(implementation3Uri) + ]); expect(getImplementationsResult2).toBeTruthy(); - expect(getImplementationsResult2.length).toBe(1); - expect(getImplementationsResult2).toContain(implementation3Uri); + expect(getImplementationsResult2).toEqual([ + new Uri(implementation1Uri), + new Uri(implementation2Uri), + new Uri(implementation3Uri) + ]); expect(getImplementationsResult3).toBeTruthy(); - expect(getImplementationsResult3.length).toBe(2); - expect(getImplementationsResult3).toContain(implementation3Uri); - expect(getImplementationsResult3).toContain(implementation4Uri); + expect(getImplementationsResult3).toEqual([ + new Uri(implementation3Uri), + new Uri(implementation4Uri) + ]); }); }); From d4f40f9e36954702239bee0df7842366743c4eca Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 8 Jun 2021 20:11:55 +0200 Subject: [PATCH 020/112] warning fixes --- packages/js/client/src/__tests__/Web3ApiClient.spec.ts | 1 - packages/js/core/src/__tests__/get-implementations.spec.ts | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 31388a2fc9..1845356e75 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -1,7 +1,6 @@ import { ClientConfig, createWeb3ApiClient, - SchemaDocument, Plugin } from "../"; import { diff --git a/packages/js/core/src/__tests__/get-implementations.spec.ts b/packages/js/core/src/__tests__/get-implementations.spec.ts index ef0e9c60b9..78b400aa06 100644 --- a/packages/js/core/src/__tests__/get-implementations.spec.ts +++ b/packages/js/core/src/__tests__/get-implementations.spec.ts @@ -2,7 +2,6 @@ import { getImplementations, Uri, UriRedirect, - SchemaDocument, Plugin, } from "../"; import { UriInterfaceImplementations } from "../types"; @@ -15,7 +14,7 @@ describe("getImplementations", () => { to: { factory: () => ({} as Plugin), manifest: { - schema: {} as SchemaDocument, + schema: "", implemented: [new Uri("authority/some-abstract-interface")], imported: [], }, @@ -26,7 +25,7 @@ describe("getImplementations", () => { to: { factory: () => ({} as Plugin), manifest: { - schema: {} as SchemaDocument, + schema: "", implemented: [new Uri("authority/some-abstract-interface")], imported: [new Uri("something/else-2")], }, From cbf2fa7d6deb0051e4024becc05f8d7fe148cbe6 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Tue, 8 Jun 2021 15:22:15 -0500 Subject: [PATCH 021/112] minor changes --- packages/core-apis/api-resolver/.gitignore | 1 - .../api-resolver/{ => src}/query.graphql | 0 packages/core-apis/api-resolver/web3api.yaml | 2 +- packages/core-apis/api-resolver/yarn.lock | 3331 ----------------- 4 files changed, 1 insertion(+), 3333 deletions(-) rename packages/core-apis/api-resolver/{ => src}/query.graphql (100%) delete mode 100644 packages/core-apis/api-resolver/yarn.lock diff --git a/packages/core-apis/api-resolver/.gitignore b/packages/core-apis/api-resolver/.gitignore index 1e8f0fdefe..e3fbd98336 100644 --- a/packages/core-apis/api-resolver/.gitignore +++ b/packages/core-apis/api-resolver/.gitignore @@ -1,3 +1,2 @@ build node_modules -w3 diff --git a/packages/core-apis/api-resolver/query.graphql b/packages/core-apis/api-resolver/src/query.graphql similarity index 100% rename from packages/core-apis/api-resolver/query.graphql rename to packages/core-apis/api-resolver/src/query.graphql diff --git a/packages/core-apis/api-resolver/web3api.yaml b/packages/core-apis/api-resolver/web3api.yaml index ec036178b4..29d36956ed 100644 --- a/packages/core-apis/api-resolver/web3api.yaml +++ b/packages/core-apis/api-resolver/web3api.yaml @@ -4,4 +4,4 @@ repository: https://github.com/web3-api/monorepo interface: true query: schema: - file: ./query.graphql + file: ./src/query.graphql diff --git a/packages/core-apis/api-resolver/yarn.lock b/packages/core-apis/api-resolver/yarn.lock deleted file mode 100644 index c087caf8e8..0000000000 --- a/packages/core-apis/api-resolver/yarn.lock +++ /dev/null @@ -1,3331 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/code-frame@^7.0.0": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658" - integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g== - dependencies: - "@babel/highlight" "^7.12.13" - -"@babel/helper-validator-identifier@^7.14.0": - version "7.14.0" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz#d26cad8a47c65286b15df1547319a5d0bcf27288" - integrity sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A== - -"@babel/highlight@^7.12.13": - version "7.14.0" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.0.tgz#3197e375711ef6bf834e67d0daec88e4f46113cf" - integrity sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg== - dependencies: - "@babel/helper-validator-identifier" "^7.14.0" - chalk "^2.0.0" - js-tokens "^4.0.0" - -"@dorgjelli-test/ipfs-http-client-lite@0.3.1": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@dorgjelli-test/ipfs-http-client-lite/-/ipfs-http-client-lite-0.3.1.tgz#5514b4400e0c91ea64e0b5faf426ba808809ddfe" - integrity sha512-N96ilOlJnjnprOOIrwKjEA7lu67mbXyGmJO/vOBXQvY9AQw9XrPdIEn0x30bHwQ6pWSwN4RhIgJUy1/A7u/hEg== - dependencies: - abort-controller "^3.0.0" - async-iterator-to-pull-stream "^1.3.0" - buffer "^5.2.1" - cids "^0.7.1" - explain-error "^1.0.4" - form-data "^2.4.0" - iterable-ndjson "^1.1.0" - node-fetch "^2.6.0" - pull-stream-to-async-iterator "^1.0.2" - querystring "^0.2.0" - -"@ethersproject/abi@^5.0.0", "@ethersproject/abi@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.3.0.tgz#00f0647d906edcd32c50b16ab9c98f83e208dcf1" - integrity sha512-NaT4UacjOwca8qCG/gv8k+DgTcWu49xlrvdhr/p8PTFnoS8e3aMWqjI3znFME5Txa/QWXDrg2/heufIUue9rtw== - dependencies: - "@ethersproject/address" "^5.3.0" - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/constants" "^5.3.0" - "@ethersproject/hash" "^5.3.0" - "@ethersproject/keccak256" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/strings" "^5.3.0" - -"@ethersproject/abstract-provider@^5.0.0", "@ethersproject/abstract-provider@^5.0.3", "@ethersproject/abstract-provider@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.3.0.tgz#f4c0ae4a4cef9f204d7781de805fd44b72756c81" - integrity sha512-1+MLhGP1GwxBDBNwMWVmhCsvKwh4gK7oIfOrmlmePNeskg1NhIrYssraJBieaFNHUYfKEd/1DjiVZMw8Qu5Cxw== - dependencies: - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/networks" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/transactions" "^5.3.0" - "@ethersproject/web" "^5.3.0" - -"@ethersproject/abstract-signer@^5.0.0", "@ethersproject/abstract-signer@^5.0.3", "@ethersproject/abstract-signer@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.3.0.tgz#05172b653e15b535ed5854ef5f6a72f4b441052d" - integrity sha512-w8IFwOYqiPrtvosPuArZ3+QPR2nmdVTRrVY8uJYL3NNfMmQfTy3V3l2wbzX47UUlNbPJY+gKvzJAyvK1onZxJg== - dependencies: - "@ethersproject/abstract-provider" "^5.3.0" - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - -"@ethersproject/address@5.0.7": - version "5.0.7" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.0.7.tgz#ee7fd7d3b3a400dec6035c7b3f0b7e4652207308" - integrity sha512-+63DiYG+2og6rFNvQmLlLw8i5LtyT65n+jtHd06Ic81rLHc+JUKRpeZFhBa+gqh9f+P8V0xtKR5NI/EHXOfgSw== - dependencies: - "@ethersproject/bignumber" "^5.0.10" - "@ethersproject/bytes" "^5.0.4" - "@ethersproject/keccak256" "^5.0.3" - "@ethersproject/logger" "^5.0.5" - "@ethersproject/rlp" "^5.0.3" - -"@ethersproject/address@^5.0.0", "@ethersproject/address@^5.0.3", "@ethersproject/address@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.3.0.tgz#e53b69eacebf332e8175de814c5e6507d6932518" - integrity sha512-29TgjzEBK+gUEUAOfWCG7s9IxLNLCqvr+oDSk6L9TXD0VLvZJKhJV479tKQqheVA81OeGxfpdxYtUVH8hqlCvA== - dependencies: - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/keccak256" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/rlp" "^5.3.0" - -"@ethersproject/base64@^5.0.0", "@ethersproject/base64@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.3.0.tgz#b831fb35418b42ad24d943c557259062b8640824" - integrity sha512-JIqgtOmgKcbc2sjGWTXyXktqUhvFUDte8fPVsAaOrcPiJf6YotNF+nsrOYGC9pbHBEGSuSBp3QR0varkO8JHEw== - dependencies: - "@ethersproject/bytes" "^5.3.0" - -"@ethersproject/basex@^5.0.3", "@ethersproject/basex@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.3.0.tgz#02dea3ab8559ae625c6d548bc11773432255c916" - integrity sha512-8J4nS6t/SOnoCgr3DF5WCSRLC5YwTKYpZWJqeyYQLX+86TwPhtzvHXacODzcDII9tWKhVg6g0Bka8JCBWXsCiQ== - dependencies: - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - -"@ethersproject/bignumber@^5.0.0", "@ethersproject/bignumber@^5.0.10", "@ethersproject/bignumber@^5.0.6", "@ethersproject/bignumber@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.3.0.tgz#74ab2ec9c3bda4e344920565720a6ee9c794e9db" - integrity sha512-5xguJ+Q1/zRMgHgDCaqAexx/8DwDVLRemw2i6uR8KyGjwGdXI8f32QZZ1cKGucBN6ekJvpUpHy6XAuQnTv0mPA== - dependencies: - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - bn.js "^4.11.9" - -"@ethersproject/bytes@^5.0.0", "@ethersproject/bytes@^5.0.4", "@ethersproject/bytes@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.3.0.tgz#473e0da7f831d535b2002be05e6f4ca3729a1bc9" - integrity sha512-rqLJjdVqCcn7glPer7Fxh87PRqlnRScVAoxcIP3PmOUNApMWJ6yRdOFfo2KvPAdO7Le3yEI1o0YW+Yvr7XCYvw== - dependencies: - "@ethersproject/logger" "^5.3.0" - -"@ethersproject/constants@^5.0.0", "@ethersproject/constants@^5.0.3", "@ethersproject/constants@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.3.0.tgz#a5d6d86c0eec2c64c3024479609493b9afb3fc77" - integrity sha512-4y1feNOwEpgjAfiCFWOHznvv6qUF/H6uI0UKp8xdhftb+H+FbKflXg1pOgH5qs4Sr7EYBL+zPyPb+YD5g1aEyw== - dependencies: - "@ethersproject/bignumber" "^5.3.0" - -"@ethersproject/contracts@^5.0.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.3.0.tgz#ad699a3abaae30bfb6422cf31813a663b2d4099c" - integrity sha512-eDyQ8ltykvyQqnGZxb/c1e0OnEtzqXhNNC4BX8nhYBCaoBrYYuK/1fLmyEvc5+XUMoxNhwpYkoSSwvPLci7/Zg== - dependencies: - "@ethersproject/abi" "^5.3.0" - "@ethersproject/abstract-provider" "^5.3.0" - "@ethersproject/abstract-signer" "^5.3.0" - "@ethersproject/address" "^5.3.0" - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/constants" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/transactions" "^5.3.0" - -"@ethersproject/hash@^5.0.0", "@ethersproject/hash@^5.0.3", "@ethersproject/hash@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.3.0.tgz#f65e3bf3db3282df4da676db6cfa049535dd3643" - integrity sha512-gAFZSjUPQ32CIfoKSMtMEQ+IO0kQxqhwz9fCIFt2DtAq2u4pWt8mL9Z5P0r6KkLcQU8LE9FmuPPyd+JvBzmr1w== - dependencies: - "@ethersproject/abstract-signer" "^5.3.0" - "@ethersproject/address" "^5.3.0" - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/keccak256" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/strings" "^5.3.0" - -"@ethersproject/hdnode@^5.0.0", "@ethersproject/hdnode@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.3.0.tgz#26fed65ffd5c25463fddff13f5fb4e5617553c94" - integrity sha512-zLmmtLNoDMGoYRdjOab01Zqkvp+TmZyCGDAMQF1Bs3yZyBs/kzTNi1qJjR1jVUcPP5CWGtjFwY8iNG8oNV9J8g== - dependencies: - "@ethersproject/abstract-signer" "^5.3.0" - "@ethersproject/basex" "^5.3.0" - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/pbkdf2" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/sha2" "^5.3.0" - "@ethersproject/signing-key" "^5.3.0" - "@ethersproject/strings" "^5.3.0" - "@ethersproject/transactions" "^5.3.0" - "@ethersproject/wordlists" "^5.3.0" - -"@ethersproject/json-wallets@^5.0.0", "@ethersproject/json-wallets@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.3.0.tgz#7b1a5ff500c12aa8597ae82c8939837b0449376e" - integrity sha512-/xwbqaIb5grUIGNmeEaz8GdcpmDr++X8WT4Jqcclnxow8PXCUHFeDxjf3O+nSuoqOYG/Ds0+BI5xuQKbva6Xkw== - dependencies: - "@ethersproject/abstract-signer" "^5.3.0" - "@ethersproject/address" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/hdnode" "^5.3.0" - "@ethersproject/keccak256" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/pbkdf2" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/random" "^5.3.0" - "@ethersproject/strings" "^5.3.0" - "@ethersproject/transactions" "^5.3.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@^5.0.0", "@ethersproject/keccak256@^5.0.3", "@ethersproject/keccak256@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.3.0.tgz#fb5cd36bdfd6fa02e2ea84964078a9fc6bd731be" - integrity sha512-Gv2YqgIUmRbYVNIibafT0qGaeGYLIA/EdWHJ7JcVxVSs2vyxafGxOJ5VpSBHWeOIsE6OOaCelYowhuuTicgdFQ== - dependencies: - "@ethersproject/bytes" "^5.3.0" - js-sha3 "0.5.7" - -"@ethersproject/logger@^5.0.0", "@ethersproject/logger@^5.0.5", "@ethersproject/logger@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.3.0.tgz#7a69fa1d4ca0d4b7138da1627eb152f763d84dd0" - integrity sha512-8bwJ2gxJGkZZnpQSq5uSiZSJjyVTWmlGft4oH8vxHdvO1Asy4TwVepAhPgxIQIMxXZFUNMych1YjIV4oQ4I7dA== - -"@ethersproject/networks@^5.0.0", "@ethersproject/networks@^5.0.3", "@ethersproject/networks@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.3.0.tgz#d8ad06eb107c69fb8651f4c81ddd0e88944fdfea" - integrity sha512-XGbD9MMgqrR7SYz8o6xVgdG+25v7YT5vQG8ZdlcLj2I7elOBM7VNeQrnxfSN7rWQNcqu2z80OM29gGbQz+4Low== - dependencies: - "@ethersproject/logger" "^5.3.0" - -"@ethersproject/pbkdf2@^5.0.0", "@ethersproject/pbkdf2@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.3.0.tgz#8adbb41489c3c9f319cc44bc7d3e6095fd468dc8" - integrity sha512-Q9ChVU6gBFiex0FSdtzo4b0SAKz3ZYcYVFLrEWHL0FnHvNk3J3WgAtRNtBQGQYn/T5wkoTdZttMbfBkFlaiWcA== - dependencies: - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/sha2" "^5.3.0" - -"@ethersproject/properties@^5.0.0", "@ethersproject/properties@^5.0.3", "@ethersproject/properties@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.3.0.tgz#feef4c4babeb7c10a6b3449575016f4ad2c092b2" - integrity sha512-PaHxJyM5/bfusk6vr3yP//JMnm4UEojpzuWGTmtL5X4uNhNnFNvlYilZLyDr4I9cTkIbipCMsAuIcXWsmdRnEw== - dependencies: - "@ethersproject/logger" "^5.3.0" - -"@ethersproject/providers@5.0.7": - version "5.0.7" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.0.7.tgz#8dfb9eacb36d3c05c08831f71ad43fb46d2aaec6" - integrity sha512-lT+w/w2PKX9oyddX0DTBYl2CVHJTJONZP5HLJ3MzVvSA5dTOdiJ9Sx5rpqR7Tw+mxVA9xPjanoNCaPPIT7cykQ== - dependencies: - "@ethersproject/abstract-provider" "^5.0.3" - "@ethersproject/abstract-signer" "^5.0.3" - "@ethersproject/address" "^5.0.3" - "@ethersproject/basex" "^5.0.3" - "@ethersproject/bignumber" "^5.0.6" - "@ethersproject/bytes" "^5.0.4" - "@ethersproject/constants" "^5.0.3" - "@ethersproject/hash" "^5.0.3" - "@ethersproject/logger" "^5.0.5" - "@ethersproject/networks" "^5.0.3" - "@ethersproject/properties" "^5.0.3" - "@ethersproject/random" "^5.0.3" - "@ethersproject/rlp" "^5.0.3" - "@ethersproject/sha2" "^5.0.3" - "@ethersproject/strings" "^5.0.3" - "@ethersproject/transactions" "^5.0.3" - "@ethersproject/web" "^5.0.4" - bech32 "1.1.4" - ws "7.2.3" - -"@ethersproject/providers@^5.0.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.3.0.tgz#bccb49f1073a7d56e24f49abb14bb281c9b08636" - integrity sha512-HtL+DEbzPcRyfrkrMay7Rk/4he+NbUpzI/wHXP4Cqtra82nQOnqqCgTQc4HbdDrl75WVxG/JRMFhyneIPIMZaA== - dependencies: - "@ethersproject/abstract-provider" "^5.3.0" - "@ethersproject/abstract-signer" "^5.3.0" - "@ethersproject/address" "^5.3.0" - "@ethersproject/basex" "^5.3.0" - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/constants" "^5.3.0" - "@ethersproject/hash" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/networks" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/random" "^5.3.0" - "@ethersproject/rlp" "^5.3.0" - "@ethersproject/sha2" "^5.3.0" - "@ethersproject/strings" "^5.3.0" - "@ethersproject/transactions" "^5.3.0" - "@ethersproject/web" "^5.3.0" - bech32 "1.1.4" - ws "7.4.6" - -"@ethersproject/random@^5.0.0", "@ethersproject/random@^5.0.3", "@ethersproject/random@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.3.0.tgz#7c46bf36e50cb0d0550bc8c666af8e1d4496dc1a" - integrity sha512-A5SL/4inutSwt3Fh2OD0x2gz+x6GHmuUnIPkR7zAiTidMD2N8F6tZdMF1hlQKWVCcVMWhEQg8mWijhEzm6BBYw== - dependencies: - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - -"@ethersproject/rlp@^5.0.0", "@ethersproject/rlp@^5.0.3", "@ethersproject/rlp@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.3.0.tgz#7cb93a7b5dfa69163894153c9d4b0d936f333188" - integrity sha512-oI0joYpsRanl9guDubaW+1NbcpK0vJ3F/6Wpcanzcnqq+oaW9O5E98liwkEDPcb16BUTLIJ+ZF8GPIHYxJ/5Pw== - dependencies: - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - -"@ethersproject/sha2@^5.0.0", "@ethersproject/sha2@^5.0.3", "@ethersproject/sha2@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.3.0.tgz#209f9a1649f7d2452dcd5e5b94af43b7f3f42366" - integrity sha512-r5ftlwKcocYEuFz2JbeKOT5SAsCV4m1RJDsTOEfQ5L67ZC7NFDK5i7maPdn1bx4nPhylF9VAwxSrQ1esmwzylg== - dependencies: - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@^5.0.0", "@ethersproject/signing-key@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.3.0.tgz#a96c88f8173e1abedfa35de32d3e5db7c48e5259" - integrity sha512-+DX/GwHAd0ok1bgedV1cKO0zfK7P/9aEyNoaYiRsGHpCecN7mhLqcdoUiUzE7Uz86LBsxm5ssK0qA1kBB47fbQ== - dependencies: - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - bn.js "^4.11.9" - elliptic "6.5.4" - hash.js "1.1.7" - -"@ethersproject/solidity@^5.0.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.3.0.tgz#2a0b00b4aaaef99a080ddea13acab1fa35cd4a93" - integrity sha512-uLRBaNUiISHbut94XKewJgQh6UmydWTBp71I7I21pkjVXfZO2dJ5EOo3jCnumJc01M4LOm79dlNNmF3oGIvweQ== - dependencies: - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/keccak256" "^5.3.0" - "@ethersproject/sha2" "^5.3.0" - "@ethersproject/strings" "^5.3.0" - -"@ethersproject/strings@^5.0.0", "@ethersproject/strings@^5.0.3", "@ethersproject/strings@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.3.0.tgz#a6b640aab56a18e0909f657da798eef890968ff0" - integrity sha512-j/AzIGZ503cvhuF2ldRSjB0BrKzpsBMtCieDtn4TYMMZMQ9zScJn9wLzTQl/bRNvJbBE6TOspK0r8/Ngae/f2Q== - dependencies: - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/constants" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - -"@ethersproject/transactions@^5.0.0", "@ethersproject/transactions@^5.0.3", "@ethersproject/transactions@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.3.0.tgz#49b86f2bafa4d0bdf8e596578fc795ee47c50458" - integrity sha512-cdfK8VVyW2oEBCXhURG0WQ6AICL/r6Gmjh0e4Bvbv6MCn/GBd8FeBH3rtl7ho+AW50csMKeGv3m3K1HSHB2jMQ== - dependencies: - "@ethersproject/address" "^5.3.0" - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/constants" "^5.3.0" - "@ethersproject/keccak256" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/rlp" "^5.3.0" - "@ethersproject/signing-key" "^5.3.0" - -"@ethersproject/units@^5.0.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.3.0.tgz#c4d1493532ad3d4ddf6e2bc4f8c94a2db933a8f5" - integrity sha512-BkfccZGwfJ6Ob+AelpIrgAzuNhrN2VLp3AILnkqTOv+yBdsc83V4AYf25XC/u0rHnWl6f4POaietPwlMqP2vUg== - dependencies: - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/constants" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - -"@ethersproject/wallet@^5.0.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.3.0.tgz#91946b470bd279e39ade58866f21f92749d062af" - integrity sha512-boYBLydG6671p9QoG6EinNnNzbm7DNOjVT20eV8J6HQEq4aUaGiA2CytF2vK+2rOEWbzhZqoNDt6AlkE1LlsTg== - dependencies: - "@ethersproject/abstract-provider" "^5.3.0" - "@ethersproject/abstract-signer" "^5.3.0" - "@ethersproject/address" "^5.3.0" - "@ethersproject/bignumber" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/hash" "^5.3.0" - "@ethersproject/hdnode" "^5.3.0" - "@ethersproject/json-wallets" "^5.3.0" - "@ethersproject/keccak256" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/random" "^5.3.0" - "@ethersproject/signing-key" "^5.3.0" - "@ethersproject/transactions" "^5.3.0" - "@ethersproject/wordlists" "^5.3.0" - -"@ethersproject/web@^5.0.0", "@ethersproject/web@^5.0.4", "@ethersproject/web@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.3.0.tgz#7959c403f6476c61515008d8f92da51c553a8ee1" - integrity sha512-Ni6/DHnY6k/TD41LEkv0RQDx4jqWz5e/RZvrSecsxGYycF+MFy2z++T/yGc2peRunLOTIFwEksgEGGlbwfYmhQ== - dependencies: - "@ethersproject/base64" "^5.3.0" - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/strings" "^5.3.0" - -"@ethersproject/wordlists@^5.0.0", "@ethersproject/wordlists@^5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.3.0.tgz#45a0205f5178c1de33d316cb2ab7ed5eac3c06c5" - integrity sha512-JcwumCZcsUxgWpiFU/BRy6b4KlTRdOmYvOKZcAw/3sdF93/pZyPW5Od2hFkHS8oWp4xS06YQ+qHqQhdcxdHafQ== - dependencies: - "@ethersproject/bytes" "^5.3.0" - "@ethersproject/hash" "^5.3.0" - "@ethersproject/logger" "^5.3.0" - "@ethersproject/properties" "^5.3.0" - "@ethersproject/strings" "^5.3.0" - -"@formatjs/ecma402-abstract@1.6.2": - version "1.6.2" - resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.6.2.tgz#9d064a2cf790769aa6721e074fb5d5c357084bb9" - integrity sha512-aLBODrSRhHaL/0WdQ0T2UsGqRbdtRRHqqrs4zwNQoRsGBEtEAvlj/rgr6Uea4PSymVJrbZBoAyECM2Z3Pq4i0g== - dependencies: - tslib "^2.1.0" - -"@formatjs/intl-datetimeformat@3.2.12": - version "3.2.12" - resolved "https://registry.yarnpkg.com/@formatjs/intl-datetimeformat/-/intl-datetimeformat-3.2.12.tgz#c9b2e85f0267ee13ea615a8991995da3075e3b13" - integrity sha512-qvY5+dl3vlgH0iWRXwl8CG9UkSVB5uP2+HH//fyZZ01G4Ww5rxMJmia1SbUqatpoe/dX+Z+aLejCqUUyugyL2g== - dependencies: - "@formatjs/ecma402-abstract" "1.6.2" - tslib "^2.1.0" - -"@formatjs/intl-displaynames@4.0.10": - version "4.0.10" - resolved "https://registry.yarnpkg.com/@formatjs/intl-displaynames/-/intl-displaynames-4.0.10.tgz#5bbd1bbcd64a036b4be27798b650c864dcf4466a" - integrity sha512-KmYJQHynGnnMeqIWVXhbzCMcEC8lg1TfGVdcO9May6paDT+dksZoOBQc741t7iXi/YVO/wXEZdmXhUNX7ODZug== - dependencies: - "@formatjs/ecma402-abstract" "1.6.2" - tslib "^2.1.0" - -"@formatjs/intl-listformat@5.0.10": - version "5.0.10" - resolved "https://registry.yarnpkg.com/@formatjs/intl-listformat/-/intl-listformat-5.0.10.tgz#9f8c4ad5e8a925240e151ba794c41fba01f742cc" - integrity sha512-FLtrtBPfBoeteRlYcHvThYbSW2YdJTllR0xEnk6cr/6FRArbfPRYMzDpFYlESzb5g8bpQMKZy+kFQ6V2Z+5KaA== - dependencies: - "@formatjs/ecma402-abstract" "1.6.2" - tslib "^2.1.0" - -"@formatjs/intl-relativetimeformat@8.1.2": - version "8.1.2" - resolved "https://registry.yarnpkg.com/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-8.1.2.tgz#119f3dce97458991f86bf34a736880e4a7bc1697" - integrity sha512-LZUxbc9GHVGmDc4sqGAXugoxhvZV7EG2lG2c0aKERup2ixvmDMbbEN3iEEr5aKkP7YyGxXxgqDn2dwg7QCPR6Q== - dependencies: - "@formatjs/ecma402-abstract" "1.6.2" - tslib "^2.1.0" - -"@formatjs/intl@1.8.2": - version "1.8.2" - resolved "https://registry.yarnpkg.com/@formatjs/intl/-/intl-1.8.2.tgz#6090e6c1826a92e70668dfe08b4ba30127ea3a85" - integrity sha512-9xHoNKPv4qQIQ5AVfpQbIPZanz50i7oMtZWrd6Fz7Q2GM/5uhBr9mrCrY1tz/+diP7uguKmhj1IweLYaxY3DTQ== - dependencies: - "@formatjs/ecma402-abstract" "1.6.2" - "@formatjs/intl-datetimeformat" "3.2.12" - "@formatjs/intl-displaynames" "4.0.10" - "@formatjs/intl-listformat" "5.0.10" - "@formatjs/intl-relativetimeformat" "8.1.2" - fast-memoize "^2.5.2" - intl-messageformat "9.5.2" - intl-messageformat-parser "6.4.2" - tslib "^2.1.0" - -"@msgpack/msgpack@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@msgpack/msgpack/-/msgpack-2.3.0.tgz#a9043b920837b2dd63482e7bf6b8345813e9816b" - integrity sha512-xxRejzNpiVQ2lzxMG/yo2ocfZSk+cKo2THq54AimaubMucg66DpQm9Yj7ESMr/l2EqDkmF2Dx4r0F/cbsitAaw== - -"@multiformats/base-x@^4.0.1": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@multiformats/base-x/-/base-x-4.0.1.tgz#95ff0fa58711789d53aefb2590a8b7a4e715d121" - integrity sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw== - -"@opentelemetry/api-metrics@^0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/api-metrics/-/api-metrics-0.18.2.tgz#12ad987cb785e142508e6df3772b8908f2edd8de" - integrity sha512-yoC1Bg3GRAf2xXAVsE6Wf54rs351XO694PsnvWGRXITJQq84yLru7Qq12w6w3N5TTyGzW6oZtqXpGWe5Im/dNQ== - dependencies: - "@opentelemetry/api" "^0.18.1" - -"@opentelemetry/api@^0.18.1": - version "0.18.1" - resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-0.18.1.tgz#fb499e07afa1f55acffc47b2469eb218dcdee2a2" - integrity sha512-pKNxHe3AJ5T2N5G3AlT9gx6FyF5K2FS9ZNc+FipC+f1CpVF/EY+JHTJ749dnM2kWIgZTbDJFiGMuc0FYjNSCOg== - -"@opentelemetry/api@^1.0.0-rc.0": - version "1.0.0-rc.3" - resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.0.0-rc.3.tgz#903ef6dddf04410d09072d43a060b87ccc162545" - integrity sha512-3PlJD9uN5iZrKmX054vOifGxZ/iH24+UFD5eW8Vyz08GUU7SdW8PNu4VSpTixWeuWo+Q6TELfSv7vVu43t+tbA== - -"@opentelemetry/context-async-hooks@^0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/context-async-hooks/-/context-async-hooks-0.18.2.tgz#65c06f91fbcba58e9865978ed43b46a1a12a3a4e" - integrity sha512-p//1ocBUI6EKXfyijtOPzKuLGBkNxcZLEWDpKKLw8fVK0gCuJiZ//hYMlemc7WvJuAYH27Vapo3cc6NTt/arPw== - dependencies: - "@opentelemetry/api" "^0.18.1" - -"@opentelemetry/context-zone-peer-dep@^0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/context-zone-peer-dep/-/context-zone-peer-dep-0.18.2.tgz#ec60066b352f8aa4ba1e779ac0e4a724c1d79313" - integrity sha512-yEyxBihR8ElP8Zaub4L+sQs98yZegTb00qgv3B0gfyenoXAEiVVA52S0vZZ5vNa/tPeoih0xArTFzrnOJTiJ+w== - dependencies: - "@opentelemetry/api" "^0.18.1" - -"@opentelemetry/context-zone@^0.18.0": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/context-zone/-/context-zone-0.18.2.tgz#174bd9269199775eeed0f752998aa1ca306f1651" - integrity sha512-JvIKdPYa2EVZfFuGQX/GqOmlIlxzG6rI0ilit7PtXmLISgJ0dgWzs45yKx4VCbvzOH1doVBwvgVP/nOejZ5WtQ== - dependencies: - "@opentelemetry/context-zone-peer-dep" "^0.18.2" - zone.js "^0.11.0" - -"@opentelemetry/core@^0.18.0", "@opentelemetry/core@^0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/core/-/core-0.18.2.tgz#3f8f54e250416b50730551f73e42fca9808cafd3" - integrity sha512-WG8veOEd8xZHuBaOHddzWQg5yj794lrEPAe6W1qI0YkV7pyqYXvhJdCxOU5Lyo1SWzTAjI5xrCUQ9J2WlrqzYA== - dependencies: - "@opentelemetry/api" "^0.18.1" - semver "^7.1.3" - -"@opentelemetry/exporter-collector@^0.18.0": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-collector/-/exporter-collector-0.18.2.tgz#30108fac2b3abb3e0c3641eabf9d40b3dfc1e0f4" - integrity sha512-WFYz7m0AN0ECJhBsrBh4JhelYnlwqlL/XDY0d99eCTBLwkgG+ywsYuF5aK56dRuciWXVLudnYxXQxZcFeUw/iw== - dependencies: - "@opentelemetry/api" "^0.18.1" - "@opentelemetry/api-metrics" "^0.18.2" - "@opentelemetry/core" "^0.18.2" - "@opentelemetry/metrics" "^0.18.2" - "@opentelemetry/resources" "^0.18.2" - "@opentelemetry/tracing" "^0.18.2" - -"@opentelemetry/exporter-jaeger@^0.18.0": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-jaeger/-/exporter-jaeger-0.18.2.tgz#e8946a0de07b0febdeba2fb3c8a3c92e95b91191" - integrity sha512-/Fv4T7qWg4eeZAb+NsKXetKrFYjRjrg2GeVMZ5sEEURGN2K44OzqfomFX+HOZFdNZpQzeUj6PywY9/bMOnPqyw== - dependencies: - "@opentelemetry/api" "^0.18.1" - "@opentelemetry/core" "^0.18.2" - "@opentelemetry/tracing" "^0.18.2" - jaeger-client "^3.15.0" - -"@opentelemetry/exporter-zipkin@^0.18.0": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-zipkin/-/exporter-zipkin-0.18.2.tgz#aa33ec65a2e5f5b404534577f9a0f6d2a8b212ca" - integrity sha512-4afGSxI3+k3hiKyYIY5Iy/oQPP3k0RPvPofn3CPyB+aXsTgxrwG3+Kan54TlHVP1M3EFimA2kKay+tM1ad8Lcw== - dependencies: - "@opentelemetry/api" "^0.18.1" - "@opentelemetry/core" "^0.18.2" - "@opentelemetry/resources" "^0.18.2" - "@opentelemetry/tracing" "^0.18.2" - -"@opentelemetry/metrics@^0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/metrics/-/metrics-0.18.2.tgz#4541f54399ba37bff3573f7ed31074ba8bb41a5b" - integrity sha512-Fp+1rmey1xMgXAFpBp3C61bnAVPlQFtPBlm7oSSYCsjwqBtDEcaT8EdY/c06Vo6k+aXTuMw1BFNgTHrwDtNGlg== - dependencies: - "@opentelemetry/api" "^0.18.1" - "@opentelemetry/api-metrics" "^0.18.2" - "@opentelemetry/core" "^0.18.2" - "@opentelemetry/resources" "^0.18.2" - lodash.merge "^4.6.2" - -"@opentelemetry/node@^0.18.0": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/node/-/node-0.18.2.tgz#a40fd5537daf0b0755181c09aca93df25e7ba5c4" - integrity sha512-9cJtXQga3dSdkNcNyhVipxNg2g7fNa2f/lE08a035ZA3NKKIGKaPop/p+Uc5+2gmkZfzKkmkZRn9YVOBRHg/ww== - dependencies: - "@opentelemetry/api" "^0.18.1" - "@opentelemetry/context-async-hooks" "^0.18.2" - "@opentelemetry/core" "^0.18.2" - "@opentelemetry/tracing" "^0.18.2" - semver "^7.1.3" - -"@opentelemetry/propagator-b3@^0.18.0": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/propagator-b3/-/propagator-b3-0.18.2.tgz#dc650b022d03d7a3a1bcbc0277206cf9a22899e3" - integrity sha512-zKL9JKnfeSeY53GXA/m6D1PB0J3fMp6fg7exvVI7q52bt+gR+/bxawwc3wyt8tdKm93BTVcok7NyPpLxMTYjOA== - dependencies: - "@opentelemetry/api" "^0.18.1" - -"@opentelemetry/resources@^0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/resources/-/resources-0.18.2.tgz#9d671476a53385c5a75c6ef273a609c9f01d8142" - integrity sha512-EBPqFsreXgFaqkMmWCE8vh6pFhbWExRHSO24qSeGhxFmM5SQP/D1jJqMp/jVUSmrF97fPkMS0aEH5z7NOWdxQA== - dependencies: - "@opentelemetry/api" "^0.18.1" - "@opentelemetry/core" "^0.18.2" - -"@opentelemetry/semantic-conventions@^0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/semantic-conventions/-/semantic-conventions-0.18.2.tgz#a0f15d2ef752567713c1f59f69c6742edb03030c" - integrity sha512-+0P+PrP9qSFVaayNdek4P1OAGE+PEl2SsufuHDRmUpOY25Wzjo7Atyar56Trjc32jkNy4lID6ZFT6BahsR9P9A== - -"@opentelemetry/tracing@^0.18.0", "@opentelemetry/tracing@^0.18.2": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/tracing/-/tracing-0.18.2.tgz#b247bcd7c68f95000ca20014ce4bd05c3f561b7a" - integrity sha512-IQSu+NwMhX8O9Wkjc4HjNqs/aKfkcInCE3dQuAOBBec/saLrM6jqd+Fa5QUzg03WMOqpDuZm5KTkr5+6DUrr0g== - dependencies: - "@opentelemetry/api" "^0.18.1" - "@opentelemetry/core" "^0.18.2" - "@opentelemetry/resources" "^0.18.2" - "@opentelemetry/semantic-conventions" "^0.18.2" - lodash.merge "^4.6.2" - -"@opentelemetry/web@^0.18.0": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@opentelemetry/web/-/web-0.18.2.tgz#3bd8242f9fc87b887e4c0650a77dd6a643130b70" - integrity sha512-3OP7iuk4TyDly06zoWG5FsTjT+gy1PypwqMD1L5GYDlCBINCSmHI6fuFeyU2k8Is62kR7voar6UwSS283Fo8Yw== - dependencies: - "@opentelemetry/api" "^0.18.1" - "@opentelemetry/core" "^0.18.2" - "@opentelemetry/semantic-conventions" "^0.18.2" - "@opentelemetry/tracing" "^0.18.2" - -"@types/node@12.7.11": - version "12.7.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.11.tgz#be879b52031cfb5d295b047f5462d8ef1a716446" - integrity sha512-Otxmr2rrZLKRYIybtdG/sgeO+tHY20GxeDjcGmUnmmlCWyEnv2a2x1ZXBo3BTec4OiTXMQCiazB8NMBf0iRlFw== - -"@types/parse-json@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" - integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== - -"@web3api/cli@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/cli/-/cli-0.0.1-prealpha.24.tgz#6c97d8531816c349198eb58a0fa7af2a70eed18a" - integrity sha512-2IrAMpUjgai0O77dtn+F6SFnTYtgfz5Las/s0QlihYhVlGya4WPt9f2xFuvHm/DWwldfpod/gA5PAO+D/sJITA== - dependencies: - "@formatjs/intl" "1.8.2" - "@types/node" "12.7.11" - "@web3api/client-js" "0.0.1-prealpha.24" - "@web3api/client-test-env" "0.0.1-prealpha.24" - "@web3api/core-js" "0.0.1-prealpha.24" - "@web3api/ens-plugin-js" "0.0.1-prealpha.24" - "@web3api/ethereum-plugin-js" "0.0.1-prealpha.24" - "@web3api/ipfs-plugin-js" "0.0.1-prealpha.24" - "@web3api/os-js" "0.0.1-prealpha.24" - "@web3api/schema-bind" "0.0.1-prealpha.24" - "@web3api/schema-compose" "0.0.1-prealpha.24" - "@web3api/schema-parse" "0.0.1-prealpha.24" - assemblyscript "0.17.14" - axios "0.19.2" - chalk "4.1.0" - chokidar "3.5.1" - fs-extra "9.0.1" - gluegun "4.6.1" - graphql-tag "2.11.0" - ipfs-http-client "48.1.3" - js-yaml "3.14.0" - mustache "4.0.1" - ora "4.0.0" - os-locale "5.0.0" - ws "7.3.1" - -"@web3api/client-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/client-js/-/client-js-0.0.1-prealpha.24.tgz#f38ec697020944fecf0261c9334efbc0a8c24403" - integrity sha512-waSzJlIZ2iDQqKyd6JHZEG9TIGVZTSosDBV/8l39n68s/3EwD5CiToc/UwtdF4RxFHC0jwpNzfZHGbdgflIGQA== - dependencies: - "@msgpack/msgpack" "2.3.0" - "@web3api/core-js" "0.0.1-prealpha.24" - "@web3api/ens-plugin-js" "0.0.1-prealpha.24" - "@web3api/ethereum-plugin-js" "0.0.1-prealpha.24" - "@web3api/ipfs-plugin-js" "0.0.1-prealpha.24" - "@web3api/logger-plugin-js" "0.0.1-prealpha.24" - "@web3api/schema-parse" "0.0.1-prealpha.24" - "@web3api/tracing-js" "0.0.1-prealpha.24" - graphql "15.5.0" - js-yaml "3.14.0" - web-worker "1.0.0" - -"@web3api/client-test-env@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/client-test-env/-/client-test-env-0.0.1-prealpha.24.tgz#8b23d56bfc32f7b76718885e495e5bfc6a795339" - integrity sha512-eNkD/tG5PnFFp7Egy0rAFRrLpD1YCAlvUJ0STVLRQMujMPkFuFEtHziBjVJGJiiyU+1mZ46ub1gEvMbcB7Frpg== - -"@web3api/core-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/core-js/-/core-js-0.0.1-prealpha.24.tgz#426011c3d1695a65adbeaa27e4e94af954c0ae73" - integrity sha512-O7WJ1jXyESLR3JwMZTxS9IMfOtrJbGnb6PTIcthrdkZOUO4zppM8ArJlB9BttQf5vNHdTNnzOOu0pxwkKnLOtg== - dependencies: - "@web3api/manifest-schema" "0.0.1-prealpha.24" - "@web3api/tracing-js" "0.0.1-prealpha.24" - graphql "15.5.0" - graphql-tag "2.10.4" - js-yaml "3.14.0" - jsonschema "1.4.0" - semver "7.3.4" - -"@web3api/ens-plugin-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/ens-plugin-js/-/ens-plugin-js-0.0.1-prealpha.24.tgz#7494e28449764308bfc2bd9ae72d347ef0961b6f" - integrity sha512-NFucvYZ7Ri356IZXvMq6s0vmtMwEoenESUw3Vjy9tc3rpsxNXZHVxfJ14tZjenArZAyVsJDXRBmhuIyJ6mP+jw== - dependencies: - "@ethersproject/address" "5.0.7" - "@web3api/core-js" "0.0.1-prealpha.24" - ethers "5.0.7" - -"@web3api/ethereum-plugin-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/ethereum-plugin-js/-/ethereum-plugin-js-0.0.1-prealpha.24.tgz#9ecfd3be33615a9e7cc46e1d919f56b1a67392b3" - integrity sha512-jWefPeACTk7ziK1fFNhrkKmcHvPcEwQnqs/Av8zKeMe0NMPkDXg17Qjzw++bxzmuJjjlyKDIn2jFBsNkELumNA== - dependencies: - "@ethersproject/address" "5.0.7" - "@ethersproject/providers" "5.0.7" - "@web3api/core-js" "0.0.1-prealpha.24" - ethers "5.0.7" - -"@web3api/ipfs-plugin-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/ipfs-plugin-js/-/ipfs-plugin-js-0.0.1-prealpha.24.tgz#30e3c1e09362e7f80cf4e7a4e0f6860fd9490d8b" - integrity sha512-Gw4pofUMonFHhwR5/30j6wEBqyjX7bwA0zedCflDKSCqd4k8JzSa8KaIaKpX5+DOyrVlAGxspsjxmqqYmaXarA== - dependencies: - "@dorgjelli-test/ipfs-http-client-lite" "0.3.1" - "@web3api/core-js" "0.0.1-prealpha.24" - abort-controller "3.0.0" - cids "^1.1.4" - is-ipfs "1.0.3" - -"@web3api/logger-plugin-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/logger-plugin-js/-/logger-plugin-js-0.0.1-prealpha.24.tgz#77ad91170a154ee31c95e796f784671dcc46a4d4" - integrity sha512-0jwD/PS41uN6LOYSTzTMFC5DuLZ42xDzAw6JNpxu3/V3acioCZzXx33B5Nw3BPSPsO5gATExRU8ExxMWeAFfug== - dependencies: - "@web3api/core-js" "0.0.1-prealpha.24" - -"@web3api/manifest-schema@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/manifest-schema/-/manifest-schema-0.0.1-prealpha.24.tgz#f07e33db19b55538cf171fd6cad5e6d236909931" - integrity sha512-yFGVSOqGChZq7pnOCBr/cK/3wHxZgge6cRyjcwMZGG628wCRijEXqTWd8lCLiaLbs8zLX4JzaoLTcCj/Nkwn4A== - -"@web3api/os-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/os-js/-/os-js-0.0.1-prealpha.24.tgz#da1b7ce7cb57fa8dcfdd2602b0143993359c3a1a" - integrity sha512-iTxS+2zO4Ia3PO99/PDq79uHsrgPPgjfOCqGLneNFx/fAstJEA3z9TT6H+gbYfoBt2YjOixfiQg5Z541yvOmYw== - dependencies: - "@types/node" "12.7.11" - -"@web3api/schema-bind@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/schema-bind/-/schema-bind-0.0.1-prealpha.24.tgz#eaca951913bafc346be3f33e73cc20c91312d163" - integrity sha512-026HW1gapAHb/mVgB2Au9Xnt4yVolXlDmQsRj30j50AgMdkEGDUElrZCH0npIhXFPPnX7m1PlSLUFQGHeLsPeQ== - dependencies: - "@web3api/os-js" "0.0.1-prealpha.24" - "@web3api/schema-parse" "0.0.1-prealpha.24" - mustache "4.0.1" - -"@web3api/schema-compose@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/schema-compose/-/schema-compose-0.0.1-prealpha.24.tgz#8248c7062f910d4f045d3ca450094b4af54c1f07" - integrity sha512-kCAi30pIoKk4KqBSiIY6khRUIIGt3fkudEp5JKTbcjqWrCGq8GxDAZ5ooqd63KxeQRUQ5gCrQY8ztSMwuZfbgw== - dependencies: - "@web3api/schema-parse" "0.0.1-prealpha.24" - graphql "15.5.0" - mustache "4.0.1" - -"@web3api/schema-parse@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/schema-parse/-/schema-parse-0.0.1-prealpha.24.tgz#c492447ff2d6959f6e291aefc97e194bf1cca5ef" - integrity sha512-0CG/4YHMaZyEx5YxUZfBRlrNMyfTjBlniPfR9lrNdpReJPhnx4tDF+uUgFo8NH2M1yUSRLh40txCdDw93wVgdg== - dependencies: - graphql "15.5.0" - graphql-schema-cycles "1.1.2" - -"@web3api/tracing-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/tracing-js/-/tracing-js-0.0.1-prealpha.24.tgz#9ba25335c56c45dbbd498a7efd320d4577e480d4" - integrity sha512-UJWBHgqaWslK7GGMjU8KLvVG2Hp4AiHFFga6/C97dFZKXXIaGg3OO7MtTeL3jek8P21FggL23LeZNTkpPCjcTw== - dependencies: - "@opentelemetry/api" "^1.0.0-rc.0" - "@opentelemetry/context-zone" "^0.18.0" - "@opentelemetry/core" "^0.18.0" - "@opentelemetry/exporter-collector" "^0.18.0" - "@opentelemetry/exporter-jaeger" "^0.18.0" - "@opentelemetry/exporter-zipkin" "^0.18.0" - "@opentelemetry/node" "^0.18.0" - "@opentelemetry/propagator-b3" "^0.18.0" - "@opentelemetry/tracing" "^0.18.0" - "@opentelemetry/web" "^0.18.0" - util-inspect "0.1.8" - -"@zxing/text-encoding@0.9.0": - version "0.9.0" - resolved "https://registry.yarnpkg.com/@zxing/text-encoding/-/text-encoding-0.9.0.tgz#fb50ffabc6c7c66a0c96b4c03e3d9be74864b70b" - integrity sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA== - -abort-controller@3.0.0, abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= - -ansi-color@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/ansi-color/-/ansi-color-0.2.1.tgz#3e75c037475217544ed763a8db5709fa9ae5bf9a" - integrity sha1-PnXAN0dSF1RO12Oo21cJ+prlv5o= - -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-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= - -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: - 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== - dependencies: - color-convert "^1.9.0" - -ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -any-signal@^2.0.0, any-signal@^2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/any-signal/-/any-signal-2.1.2.tgz#8d48270de0605f8b218cf9abe8e9c6a0e7418102" - integrity sha512-B+rDnWasMi/eWcajPcCWSlYc7muXOrcYrqgyzcdKisl2H/WTlQ0gip1KyQfr0ZlxJdsuWCj/LWwQm7fhyhRfIQ== - dependencies: - abort-controller "^3.0.0" - native-abort-controller "^1.0.3" - -anymatch@~3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" - integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -apisauce@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/apisauce/-/apisauce-2.1.1.tgz#0b8bc7f2544e6ef710a6fa1d6f49583856940dd2" - integrity sha512-P4SsLvmsH8BLLruBn/nsO+65j+ChZlGQ2zC5avCIjbWstYS4PgjxeVWtbeVwFGEWX7dEkLp85OvdapGXy1zS8g== - dependencies: - axios "^0.21.1" - ramda "^0.25.0" - -app-module-path@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/app-module-path/-/app-module-path-2.2.0.tgz#641aa55dfb7d6a6f0a8141c4b9c0aa50b6c24dd5" - integrity sha1-ZBqlXft9am8KgUHEucCqULbCTdU= - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -array-map@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" - integrity sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI= - -array-reduce@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" - integrity sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys= - -assemblyscript@0.17.14: - version "0.17.14" - resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.17.14.tgz#9ea4a04a50dc53042b35d492fff947101ae00248" - integrity sha512-TLuwNvZAIH26wu2puKpAJokzLp10kJkVXxbgDjFFmbW9VF/qg7rkmi0hjsiu41bjoH1UaVgY4vYvbbUeOHtKyg== - dependencies: - binaryen "98.0.0-nightly.20201109" - long "^4.0.0" - -async-iterator-to-pull-stream@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/async-iterator-to-pull-stream/-/async-iterator-to-pull-stream-1.3.0.tgz#3a6b9f3cceadff972ca20eb480e3cb43f8789732" - integrity sha512-NjyhAEz/sx32olqgKIk/2xbWEM6o8qef1yetIgb0U/R3oBgndP1kE/0CslowH3jvnA94BO4I6OXpOkTKH7Z1AA== - dependencies: - get-iterator "^1.0.2" - pull-stream-to-async-iterator "^1.0.1" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= - -at-least-node@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" - integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== - -available-typed-arrays@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.4.tgz#9e0ae84ecff20caae6a94a1c3bc39b955649b7a9" - integrity sha512-SA5mXJWrId1TaQjfxUYghbqQ/hYioKmLJvPJyDuYRtXXenFNMjj4hSSt1Cf1xsuXSXrtxrVC5Ot4eU6cOtBDdA== - -axios@0.19.2: - version "0.19.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27" - integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA== - dependencies: - follow-redirects "1.5.10" - -axios@^0.21.1: - version "0.21.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" - integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== - dependencies: - follow-redirects "^1.10.0" - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -base-x@^3.0.8: - version "3.0.8" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.8.tgz#1e1106c2537f0162e8b52474a557ebb09000018d" - integrity sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA== - dependencies: - safe-buffer "^5.0.1" - -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -bech32@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== - -bignumber.js@^9.0.0: - version "9.0.1" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5" - integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA== - -binary-extensions@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" - integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== - -binaryen@98.0.0-nightly.20201109: - version "98.0.0-nightly.20201109" - resolved "https://registry.yarnpkg.com/binaryen/-/binaryen-98.0.0-nightly.20201109.tgz#512bf6ca15c67bf7402144734a4836e63993aa05" - integrity sha512-iRarAqdH5lMWlMBzrDuJgLYJR2g4QXk93iYE2zpr6gEZkb/jCgDpPUXdhuN11Ge1zZ/6By4DwA1mmifcx7FWaw== - -bl@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" - integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== - dependencies: - buffer "^5.5.0" - inherits "^2.0.4" - readable-stream "^3.4.0" - -blakejs@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.1.0.tgz#69df92ef953aa88ca51a32df6ab1c54a155fc7a5" - integrity sha1-ad+S75U6qIylGjLfarHFShVfx6U= - -blob-to-it@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/blob-to-it/-/blob-to-it-1.0.2.tgz#bc76550638ca13280dbd3f202422a6a132ffcc8d" - integrity sha512-yD8tikfTlUGEOSHExz4vDCIQFLaBPXIL0KcxGQt9RbwMVXBEh+jokdJyStvTXPgWrdKfwgk7RX8GPsgrYzsyng== - dependencies: - browser-readablestream-to-it "^1.0.2" - -bn.js@^4.11.9: - version "4.12.0" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" - integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== - -borc@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/borc/-/borc-2.1.2.tgz#6ce75e7da5ce711b963755117dd1b187f6f8cf19" - integrity sha512-Sy9eoUi4OiKzq7VovMn246iTo17kzuyHJKomCfpWMlI6RpfN1gk95w7d7gH264nApVLg0HZfcpz62/g4VH1Y4w== - dependencies: - bignumber.js "^9.0.0" - buffer "^5.5.0" - commander "^2.15.0" - ieee754 "^1.1.13" - iso-url "~0.4.7" - json-text-sequence "~0.1.0" - readable-stream "^3.6.0" - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== - dependencies: - fill-range "^7.0.1" - -brorand@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= - -browser-readablestream-to-it@^1.0.1, browser-readablestream-to-it@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/browser-readablestream-to-it/-/browser-readablestream-to-it-1.0.2.tgz#f6b8d18e7a35b0321359261a32aa2c70f46921c4" - integrity sha512-lv4M2Z6RKJpyJijJzBQL5MNssS7i8yedl+QkhnLCyPtgNGNSXv1KthzUnye9NlRAtBAI80X6S9i+vK09Rzjcvg== - -buffer@^5.2.1, buffer@^5.4.3, buffer@^5.5.0, buffer@^5.6.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" - integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.1.13" - -buffer@^6.0.1: - version "6.0.3" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" - integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.2.1" - -bufrw@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/bufrw/-/bufrw-1.3.0.tgz#28d6cfdaf34300376836310f5c31d57eeb40c8fa" - integrity sha512-jzQnSbdJqhIltU9O5KUiTtljP9ccw2u5ix59McQy4pV2xGhVLhRZIndY8GIrgh5HjXa6+QJ9AQhOd2QWQizJFQ== - dependencies: - ansi-color "^0.2.1" - error "^7.0.0" - hexer "^1.5.0" - xtend "^4.0.0" - -call-bind@^1.0.0, call-bind@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" - integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== - dependencies: - function-bind "^1.1.1" - get-intrinsic "^1.0.2" - -callsites@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" - integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== - -camelcase@^5.0.0: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - -chalk@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chalk@^2.0.0, chalk@^2.4.2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chokidar@3.5.1: - version "3.5.1" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a" - integrity sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw== - dependencies: - anymatch "~3.1.1" - braces "~3.0.2" - glob-parent "~5.1.0" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.5.0" - optionalDependencies: - fsevents "~2.3.1" - -cids@^0.7.1: - version "0.7.5" - resolved "https://registry.yarnpkg.com/cids/-/cids-0.7.5.tgz#60a08138a99bfb69b6be4ceb63bfef7a396b28b2" - integrity sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA== - dependencies: - buffer "^5.5.0" - class-is "^1.1.0" - multibase "~0.6.0" - multicodec "^1.0.0" - multihashes "~0.4.15" - -cids@^1.0.0, cids@^1.1.4: - version "1.1.6" - resolved "https://registry.yarnpkg.com/cids/-/cids-1.1.6.tgz#ac7aea7dbcabaa64ca242b5d970d596a5c34d006" - integrity sha512-5P+Jas2bVpjiHibp/SOwKY+v7JhAjTChaAZN+vCIrsWXn/JZV0frX22Vp5zZgEyJRPco79pX+yNQ2S3LkRukHQ== - dependencies: - multibase "^4.0.1" - multicodec "^3.0.1" - multihashes "^4.0.1" - uint8arrays "^2.1.3" - -cids@~0.8.0: - version "0.8.3" - resolved "https://registry.yarnpkg.com/cids/-/cids-0.8.3.tgz#aaf48ac8ed857c3d37dad94d8db1d8c9407b92db" - integrity sha512-yoXTbV3llpm+EBGWKeL9xKtksPE/s6DPoDSY4fn8I8TEW1zehWXPSB0pwAXVDlLaOlrw+sNynj995uD9abmPhA== - dependencies: - buffer "^5.6.0" - class-is "^1.1.0" - multibase "^1.0.0" - multicodec "^1.0.1" - multihashes "^1.0.1" - -class-is@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825" - integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== - -cli-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" - integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== - dependencies: - restore-cursor "^3.1.0" - -cli-spinners@^2.2.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.6.0.tgz#36c7dc98fb6a9a76bd6238ec3f77e2425627e939" - integrity sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q== - -cli-table3@~0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.5.1.tgz#0252372d94dfc40dbd8df06005f48f31f656f202" - integrity sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw== - dependencies: - object-assign "^4.1.0" - string-width "^2.1.1" - optionalDependencies: - colors "^1.1.2" - -clone@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" - integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -colors@^1.1.2, colors@^1.3.3: - version "1.4.0" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" - integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== - -combined-stream@^1.0.6, combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -commander@^2.15.0: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= - -cosmiconfig@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982" - integrity sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg== - dependencies: - "@types/parse-json" "^4.0.0" - import-fresh "^3.1.0" - parse-json "^5.0.0" - path-type "^4.0.0" - yaml "^1.7.2" - -cross-spawn@^7.0.0: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" - integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -debug@=3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" - integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== - dependencies: - ms "2.0.0" - -debug@^4.1.1, debug@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" - integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== - dependencies: - ms "2.1.2" - -decamelize@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= - -defaults@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" - integrity sha1-xlYFHpgX2f8I7YgUd/P+QBnz730= - dependencies: - clone "^1.0.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" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= - -delimit-stream@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/delimit-stream/-/delimit-stream-0.1.0.tgz#9b8319477c0e5f8aeb3ce357ae305fc25ea1cd2b" - integrity sha1-m4MZR3wOX4rrPONXrjBfwl6hzSs= - -dns-over-http-resolver@^1.0.0: - version "1.2.3" - resolved "https://registry.yarnpkg.com/dns-over-http-resolver/-/dns-over-http-resolver-1.2.3.tgz#194d5e140a42153f55bb79ac5a64dd2768c36af9" - integrity sha512-miDiVSI6KSNbi4SVifzO/reD8rMnxgrlnkrlkugOLQpWQTe2qMdHsZp5DmfKjxNE+/T3VAAYLQUZMv9SMr6+AA== - dependencies: - debug "^4.3.1" - native-fetch "^3.0.0" - receptacle "^1.3.2" - -ejs@^2.6.1: - version "2.7.4" - resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.7.4.tgz#48661287573dcc53e366c7a1ae52c3a120eec9ba" - integrity sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA== - -electron-fetch@^1.7.2: - version "1.7.3" - resolved "https://registry.yarnpkg.com/electron-fetch/-/electron-fetch-1.7.3.tgz#06cf363d7f64073ec00a37e9949ec9d29ce6b08a" - integrity sha512-1AVMaxrHXTTMqd7EK0MGWusdqNr07Rpj8Th6bG4at0oNgIi/1LBwa9CjT/0Zy+M0k/tSJPS04nFxHj0SXDVgVw== - dependencies: - encoding "^0.1.13" - -elliptic@6.5.4: - version "6.5.4" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" - integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== - dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - hash.js "^1.0.0" - hmac-drbg "^1.0.1" - inherits "^2.0.4" - minimalistic-assert "^1.0.1" - minimalistic-crypto-utils "^1.0.1" - -encoding@^0.1.13: - version "0.1.13" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" - integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== - dependencies: - iconv-lite "^0.6.2" - -end-of-stream@^1.1.0: - version "1.4.4" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" - integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== - dependencies: - once "^1.4.0" - -enquirer@2.3.4: - version "2.3.4" - resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.4.tgz#c608f2e1134c7f68c1c9ee056de13f9b31076de9" - integrity sha512-pkYrrDZumL2VS6VBGDhqbajCM2xpkUNLuKfGPjfKaSIBKYopQbqEFyrOkRMIb2HDR/rO1kGhEt/5twBwtzKBXw== - dependencies: - ansi-colors "^3.2.1" - -err-code@^2.0.0, err-code@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9" - integrity sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA== - -err-code@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/err-code/-/err-code-3.0.1.tgz#a444c7b992705f2b120ee320b09972eef331c920" - integrity sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA== - -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" - -error@7.0.2: - version "7.0.2" - resolved "https://registry.yarnpkg.com/error/-/error-7.0.2.tgz#a5f75fff4d9926126ddac0ea5dc38e689153cb02" - integrity sha1-pfdf/02ZJhJt2sDqXcOOaJFTywI= - dependencies: - string-template "~0.2.1" - xtend "~4.0.0" - -error@^7.0.0: - version "7.2.1" - resolved "https://registry.yarnpkg.com/error/-/error-7.2.1.tgz#eab21a4689b5f684fc83da84a0e390de82d94894" - integrity sha512-fo9HBvWnx3NGUKMvMwB/CBCMMrfEJgbDTVDEkPygA3Bdd3lM1OyCd+rbQ8BwnpF6GdVeOLDNmyL4N5Bg80ZvdA== - dependencies: - string-template "~0.2.1" - -es-abstract@^1.18.0-next.1, es-abstract@^1.18.0-next.2: - version "1.18.3" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.3.tgz#25c4c3380a27aa203c44b2b685bba94da31b63e0" - integrity sha512-nQIr12dxV7SSxE6r6f1l3DtAeEYdsGpps13dR0TwJg1S8gyp4ZPgy3FZcHBgbiQqnoqSTb+oC+kO4UQ0C/J8vw== - dependencies: - call-bind "^1.0.2" - es-to-primitive "^1.2.1" - function-bind "^1.1.1" - get-intrinsic "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.2" - is-callable "^1.2.3" - is-negative-zero "^2.0.1" - is-regex "^1.1.3" - is-string "^1.0.6" - object-inspect "^1.10.3" - object-keys "^1.1.1" - object.assign "^4.1.2" - string.prototype.trimend "^1.0.4" - string.prototype.trimstart "^1.0.4" - unbox-primitive "^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" - integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= - -esprima@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -ethers@5.0.7: - version "5.0.7" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.0.7.tgz#41c3d774e0a57bfde12b0198885789fb41a14976" - integrity sha512-1Zu9s+z4BgsDAZcGIYACJdWBB6mVtCCmUonj68Njul7STcSdgwOyj0sCAxCUr2Nsmsamckr4E12q3ecvZPGAUw== - dependencies: - "@ethersproject/abi" "^5.0.0" - "@ethersproject/abstract-provider" "^5.0.0" - "@ethersproject/abstract-signer" "^5.0.0" - "@ethersproject/address" "^5.0.0" - "@ethersproject/base64" "^5.0.0" - "@ethersproject/bignumber" "^5.0.0" - "@ethersproject/bytes" "^5.0.0" - "@ethersproject/constants" "^5.0.0" - "@ethersproject/contracts" "^5.0.0" - "@ethersproject/hash" "^5.0.0" - "@ethersproject/hdnode" "^5.0.0" - "@ethersproject/json-wallets" "^5.0.0" - "@ethersproject/keccak256" "^5.0.0" - "@ethersproject/logger" "^5.0.0" - "@ethersproject/networks" "^5.0.0" - "@ethersproject/pbkdf2" "^5.0.0" - "@ethersproject/properties" "^5.0.0" - "@ethersproject/providers" "^5.0.0" - "@ethersproject/random" "^5.0.0" - "@ethersproject/rlp" "^5.0.0" - "@ethersproject/sha2" "^5.0.0" - "@ethersproject/signing-key" "^5.0.0" - "@ethersproject/solidity" "^5.0.0" - "@ethersproject/strings" "^5.0.0" - "@ethersproject/transactions" "^5.0.0" - "@ethersproject/units" "^5.0.0" - "@ethersproject/wallet" "^5.0.0" - "@ethersproject/web" "^5.0.0" - "@ethersproject/wordlists" "^5.0.0" - -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - -execa@^3.0.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-3.4.0.tgz#c08ed4550ef65d858fac269ffc8572446f37eb89" - integrity sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g== - dependencies: - cross-spawn "^7.0.0" - get-stream "^5.0.0" - human-signals "^1.1.1" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.0" - onetime "^5.1.0" - p-finally "^2.0.0" - signal-exit "^3.0.2" - strip-final-newline "^2.0.0" - -execa@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" - integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== - dependencies: - cross-spawn "^7.0.0" - get-stream "^5.0.0" - human-signals "^1.1.1" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.0" - onetime "^5.1.0" - signal-exit "^3.0.2" - strip-final-newline "^2.0.0" - -explain-error@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/explain-error/-/explain-error-1.0.4.tgz#a793d3ac0cad4c6ab571e9968fbbab6cb2532929" - integrity sha1-p5PTrAytTGq1cemWj7urbLJTKSk= - -fast-fifo@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.0.0.tgz#9bc72e6860347bb045a876d1c5c0af11e9b984e7" - integrity sha512-4VEXmjxLj7sbs8J//cn2qhRap50dGzF5n8fjay8mau+Jn4hxSeR3xPFwxMaQq/pDaq7+KQk0PAbC2+nWDkJrmQ== - -fast-memoize@^2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/fast-memoize/-/fast-memoize-2.5.2.tgz#79e3bb6a4ec867ea40ba0e7146816f6cdce9b57e" - integrity sha512-Ue0LwpDYErFbmNnZSF0UH6eImUwDmogUO1jyE+JbN2gsQz/jICm1Ve7t9QT0rNSsfJt+Hs4/S3GnsDVjL4HVrw== - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== - dependencies: - to-regex-range "^5.0.1" - -follow-redirects@1.5.10: - version "1.5.10" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" - integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== - dependencies: - debug "=3.1.0" - -follow-redirects@^1.10.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43" - integrity sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg== - -foreach@2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.4.tgz#cc5d0d8ae1d46cc9a555c2682f910977859935df" - integrity sha1-zF0NiuHUbMmlVcJoL5EJd4WZNd8= - -foreach@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" - integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= - -form-data@^2.4.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4" - integrity sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -form-data@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" - integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - -fs-extra@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.1.tgz#910da0062437ba4c39fedd863f1675ccfefcb9fc" - integrity sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ== - dependencies: - at-least-node "^1.0.0" - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^1.0.0" - -fs-extra@^9.0.1: - version "9.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" - integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== - dependencies: - at-least-node "^1.0.0" - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - -fs-jetpack@^2.2.2: - version "2.4.0" - resolved "https://registry.yarnpkg.com/fs-jetpack/-/fs-jetpack-2.4.0.tgz#6080c4ab464a019d37a404baeb47f32af8835026" - integrity sha512-S/o9Dd7K9A7gicVU32eT8G0kHcmSu0rCVdP79P0MWInKFb8XpTc8Syhoo66k9no+HDshtlh4pUJTws8X+8fdFQ== - dependencies: - minimatch "^3.0.2" - rimraf "^2.6.3" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= - -fsevents@~2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - -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== - -get-intrinsic@^1.0.2, get-intrinsic@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" - integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== - dependencies: - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - -get-iterator@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/get-iterator/-/get-iterator-1.0.2.tgz#cd747c02b4c084461fac14f48f6b45a80ed25c82" - integrity sha512-v+dm9bNVfOYsY1OrhaCrmyOcYoSeVvbt+hHZ0Au+T+p1y+0Uyj9aMaGIeUTT6xdpRbWzDeYKvfOslPhggQMcsg== - -get-stream@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" - integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== - dependencies: - pump "^3.0.0" - -glob-parent@~5.1.0: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - -glob@^7.1.3: - version "7.1.7" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" - integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globalthis@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.2.tgz#2a235d34f4d8036219f7e34929b5de9e18166b8b" - integrity sha512-ZQnSFO1la8P7auIOQECnm0sSuoMeaSq0EEdXMBFF2QJO4uNcwbyhSgG3MruWNbFTqCLmxVwGOl7LZ9kASvHdeQ== - dependencies: - define-properties "^1.1.3" - -gluegun@4.6.1: - version "4.6.1" - resolved "https://registry.yarnpkg.com/gluegun/-/gluegun-4.6.1.tgz#f2a65d20378873de87a2143b8c3939ffc9a9e2b6" - integrity sha512-Jd5hV1Uku2rjBg59mYA/bnwLwynK7u9A1zmK/LIb/p5d3pzjDCKRjWFuxZXyPwl9rsvKGhJUQxkFo2HEy8crKQ== - dependencies: - apisauce "^2.0.1" - app-module-path "^2.2.0" - cli-table3 "~0.5.0" - colors "^1.3.3" - cosmiconfig "6.0.0" - cross-spawn "^7.0.0" - ejs "^2.6.1" - enquirer "2.3.4" - execa "^3.0.0" - fs-jetpack "^2.2.2" - lodash.camelcase "^4.3.0" - lodash.kebabcase "^4.1.1" - lodash.lowercase "^4.3.0" - lodash.lowerfirst "^4.3.1" - lodash.pad "^4.5.1" - lodash.padend "^4.6.1" - lodash.padstart "^4.6.1" - lodash.repeat "^4.1.0" - lodash.snakecase "^4.1.1" - lodash.startcase "^4.4.0" - lodash.trim "^4.5.1" - lodash.trimend "^4.5.1" - lodash.trimstart "^4.5.1" - lodash.uppercase "^4.3.0" - lodash.upperfirst "^4.3.1" - ora "^4.0.0" - pluralize "^8.0.0" - ramdasauce "^2.1.0" - semver "^7.0.0" - which "^2.0.0" - yargs-parser "^16.1.0" - -graceful-fs@^4.1.6, graceful-fs@^4.2.0: - version "4.2.6" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" - integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== - -graphql-json-transform@^1.1.0-alpha.0: - version "1.1.0-alpha.0" - resolved "https://registry.yarnpkg.com/graphql-json-transform/-/graphql-json-transform-1.1.0-alpha.0.tgz#fb0c88d24840067e6c55ac64bbc8d4e5de245d2d" - integrity sha512-I6lR/lYEezSz4iru0f7a/wR8Rzi3pCafk7S0bX2b/WQOtK0vKabxLShGBXIslsi0arMehIjvOPHJl7MpOUqj0w== - -graphql-schema-cycles@1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/graphql-schema-cycles/-/graphql-schema-cycles-1.1.2.tgz#925d65d774d296238620aaedc391f26a9e46eb33" - integrity sha512-0I1pOOZZ8MhcNvhvYVRBIGnco8Q4EWfRYJ8vBuGEajuEuSXhC340Tasx7so1jjSphk+48kaoXy2+LNaTnEaSjA== - dependencies: - graphql "15.5.0" - graphql-json-transform "^1.1.0-alpha.0" - -graphql-tag@2.10.4: - version "2.10.4" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.4.tgz#2f301a98219be8b178a6453bb7e33b79b66d8f83" - integrity sha512-O7vG5BT3w6Sotc26ybcvLKNTdfr4GfsIVMD+LdYqXCeJIYPRyp8BIsDOUtxw7S1PYvRw5vH3278J2EDezR6mfA== - -graphql-tag@2.11.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.11.0.tgz#1deb53a01c46a7eb401d6cb59dec86fa1cccbffd" - integrity sha512-VmsD5pJqWJnQZMUeRwrDhfgoyqcfwEkvtpANqcoUG8/tOLkwNgU9mzub/Mc78OJMhHjx7gfAMTxzdG43VGg3bA== - -graphql@15.5.0: - version "15.5.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.5.0.tgz#39d19494dbe69d1ea719915b578bf920344a69d5" - integrity sha512-OmaM7y0kaK31NKG31q4YbD2beNYa6jBBKtMFT6gLYJljHLJr42IqJ8KX08u3Li/0ifzTU5HjmoOOrwa5BRLeDA== - -has-bigints@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" - integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= - -has-flag@^4.0.0: - version "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.1, has-symbols@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" - integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== - -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.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - -hexer@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/hexer/-/hexer-1.5.0.tgz#b86ce808598e8a9d1892c571f3cedd86fc9f0653" - integrity sha1-uGzoCFmOip0YksVx887dhvyfBlM= - dependencies: - ansi-color "^0.2.1" - minimist "^1.1.0" - process "^0.10.0" - xtend "^4.0.0" - -hmac-drbg@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - -human-signals@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" - integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== - -iconv-lite@^0.6.2: - version "0.6.3" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" - integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== - dependencies: - safer-buffer ">= 2.1.2 < 3.0.0" - -ieee754@^1.1.13, ieee754@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -import-fresh@^3.1.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" - integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== - dependencies: - parent-module "^1.0.0" - resolve-from "^4.0.0" - -indexof@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" - integrity sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10= - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.3, inherits@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -intl-messageformat-parser@6.4.2: - version "6.4.2" - resolved "https://registry.yarnpkg.com/intl-messageformat-parser/-/intl-messageformat-parser-6.4.2.tgz#e2d28c3156c27961ead9d613ca55b6a155078d7d" - integrity sha512-IVNGy24lNEYr/KPWId5tF3KXRHFFbMgzIMI4kUonNa/ide2ywUYyBuOUro1IBGZJqjA2ncBVUyXdYKlMfzqpAA== - dependencies: - "@formatjs/ecma402-abstract" "1.6.2" - tslib "^2.1.0" - -intl-messageformat@9.5.2: - version "9.5.2" - resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-9.5.2.tgz#e72d32152c760b7411e413780e462909987c005a" - integrity sha512-sBGXcSQLyBuBA/kzAYhTpzhzkOGfSwGIau2W6FuwLZk0JE+VF3C+y0077FhVDOcRSi60iSfWzT8QC3Z7//dFxw== - dependencies: - fast-memoize "^2.5.2" - intl-messageformat-parser "6.4.2" - tslib "^2.1.0" - -invert-kv@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-3.0.1.tgz#a93c7a3d4386a1dc8325b97da9bb1620c0282523" - integrity sha512-CYdFeFexxhv/Bcny+Q0BfOV+ltRlJcd4BBZBYFX/O0u4npJrgZtIcjokegtiSMAvlMTJ+Koq0GBCc//3bueQxw== - -ip-regex@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5" - integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q== - -ipfs-core-utils@^0.5.4: - version "0.5.4" - resolved "https://registry.yarnpkg.com/ipfs-core-utils/-/ipfs-core-utils-0.5.4.tgz#c7fa508562086be65cebb51feb13c58abbbd3d8d" - integrity sha512-V+OHCkqf/263jHU0Fc9Rx/uDuwlz3PHxl3qu6a5ka/mNi6gucbFuI53jWsevCrOOY9giWMLB29RINGmCV5dFeQ== - dependencies: - any-signal "^2.0.0" - blob-to-it "^1.0.1" - browser-readablestream-to-it "^1.0.1" - cids "^1.0.0" - err-code "^2.0.3" - ipfs-utils "^5.0.0" - it-all "^1.0.4" - it-map "^1.0.4" - it-peekable "^1.0.1" - multiaddr "^8.0.0" - multiaddr-to-uri "^6.0.0" - parse-duration "^0.4.4" - timeout-abort-controller "^1.1.1" - uint8arrays "^1.1.0" - -ipfs-http-client@48.1.3: - version "48.1.3" - resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-48.1.3.tgz#d9b91b1f65d54730de92290d3be5a11ef124b400" - integrity sha512-+JV4cdMaTvYN3vd4r6+mcVxV3LkJXzc4kn2ToVbObpVpdqmG34ePf1KlvFF8A9gjcel84WpiP5xCEV/IrisPBA== - dependencies: - any-signal "^2.0.0" - bignumber.js "^9.0.0" - cids "^1.0.0" - debug "^4.1.1" - form-data "^3.0.0" - ipfs-core-utils "^0.5.4" - ipfs-utils "^5.0.0" - ipld-block "^0.11.0" - ipld-dag-cbor "^0.17.0" - ipld-dag-pb "^0.20.0" - ipld-raw "^6.0.0" - it-last "^1.0.4" - it-map "^1.0.4" - it-tar "^1.2.2" - it-to-stream "^0.1.2" - merge-options "^2.0.0" - multiaddr "^8.0.0" - multibase "^3.0.0" - multicodec "^2.0.1" - multihashes "^3.0.1" - nanoid "^3.1.12" - native-abort-controller "~0.0.3" - parse-duration "^0.4.4" - stream-to-it "^0.2.2" - uint8arrays "^1.1.0" - -ipfs-utils@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ipfs-utils/-/ipfs-utils-5.0.1.tgz#7c0053d5e77686f45577257a73905d4523e6b4f7" - integrity sha512-28KZPgO4Uf5duT2ORLAYfboUp98iUshDD7yRAfbNxNAR8Dtidfn6o20rZfoXnkri2zKBVIPlJkuCPmPJB+6erg== - dependencies: - abort-controller "^3.0.0" - any-signal "^2.1.0" - buffer "^6.0.1" - electron-fetch "^1.7.2" - err-code "^2.0.0" - fs-extra "^9.0.1" - is-electron "^2.2.0" - iso-url "^1.0.0" - it-glob "0.0.10" - it-to-stream "^0.1.2" - merge-options "^2.0.0" - nanoid "^3.1.3" - native-abort-controller "0.0.3" - native-fetch "^2.0.0" - node-fetch "^2.6.0" - stream-to-it "^0.2.0" - -ipld-block@^0.11.0: - version "0.11.1" - resolved "https://registry.yarnpkg.com/ipld-block/-/ipld-block-0.11.1.tgz#c3a7b41aee3244187bd87a73f980e3565d299b6e" - integrity sha512-sDqqLqD5qh4QzGq6ssxLHUCnH4emCf/8F8IwjQM2cjEEIEHMUj57XhNYgmGbemdYPznUhffxFGEHsruh5+HQRw== - dependencies: - cids "^1.0.0" - -ipld-dag-cbor@^0.17.0: - version "0.17.1" - resolved "https://registry.yarnpkg.com/ipld-dag-cbor/-/ipld-dag-cbor-0.17.1.tgz#842e6c250603e5791049168831a425ec03471fb1" - integrity sha512-Bakj/cnxQBdscORyf4LRHxQJQfoaY8KWc7PWROQgX+aw5FCzBt8ga0VM/59K+ABOznsqNvyLR/wz/oYImOpXJw== - dependencies: - borc "^2.1.2" - cids "^1.0.0" - is-circular "^1.0.2" - multicodec "^3.0.1" - multihashing-async "^2.0.0" - uint8arrays "^2.1.3" - -ipld-dag-pb@^0.20.0: - version "0.20.0" - resolved "https://registry.yarnpkg.com/ipld-dag-pb/-/ipld-dag-pb-0.20.0.tgz#025c0343aafe6cb9db395dd1dc93c8c60a669360" - integrity sha512-zfM0EdaolqNjAxIrtpuGKvXxWk5YtH9jKinBuQGTcngOsWFQhyybGCTJHGNGGtRjHNJi2hz5Udy/8pzv4kcKyg== - dependencies: - cids "^1.0.0" - class-is "^1.1.0" - multicodec "^2.0.0" - multihashing-async "^2.0.0" - protons "^2.0.0" - reset "^0.1.0" - run "^1.4.0" - stable "^0.1.8" - uint8arrays "^1.0.0" - -ipld-raw@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/ipld-raw/-/ipld-raw-6.0.0.tgz#74d947fcd2ce4e0e1d5bb650c1b5754ed8ea6da0" - integrity sha512-UK7fjncAzs59iu/o2kwYtb8jgTtW6B+cNWIiNpAJkfRwqoMk1xD/6i25ktzwe4qO8gQgoR9RxA5ibC23nq8BLg== - dependencies: - cids "^1.0.0" - multicodec "^2.0.0" - multihashing-async "^2.0.0" - -is-arguments@^1.0.4: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.0.tgz#62353031dfbee07ceb34656a6bde59efecae8dd9" - integrity sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg== - dependencies: - call-bind "^1.0.0" - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= - -is-bigint@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.2.tgz#ffb381442503235ad245ea89e45b3dbff040ee5a" - integrity sha512-0JV5+SOCQkIdzjBK9buARcV804Ddu7A0Qet6sHi3FimE9ne6m4BGQZfRn+NZiXbBk4F4XmHfDZIipLj9pX8dSA== - -is-binary-path@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - -is-boolean-object@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.1.tgz#3c0878f035cb821228d350d2e1e36719716a3de8" - integrity sha512-bXdQWkECBUIAcCkeH1unwJLIpZYaa5VvuygSyS/c2lf719mTKZDU5UdDRlpd01UjADgmW8RfqaP+mRaVPdr/Ng== - dependencies: - call-bind "^1.0.2" - -is-callable@^1.1.4, is-callable@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" - integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ== - -is-circular@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-circular/-/is-circular-1.0.2.tgz#2e0ab4e9835f4c6b0ea2b9855a84acd501b8366c" - integrity sha512-YttjnrswnUYRVJvxCvu8z+PGMUSzC2JttP0OEXezlAEdp3EXzhf7IZ3j0gRAybJBQupedIZFhY61Tga6E0qASA== - -is-date-object@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.4.tgz#550cfcc03afada05eea3dd30981c7b09551f73e5" - integrity sha512-/b4ZVsG7Z5XVtIxs/h9W8nvfLgSAyKYdtGWQLbqy6jA1icmgjf8WCoTKgeS4wy5tYaPePouzFMANbnj94c2Z+A== - -is-electron@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-electron/-/is-electron-2.2.0.tgz#8943084f09e8b731b3a7a0298a7b5d56f6b7eef0" - integrity sha512-SpMppC2XR3YdxSzczXReBjqs2zGscWQpBIKqwXYBFic0ERaxNVgwLCHwOLZeESfdJQjX0RDvrJ1lBXX2ij+G1Q== - -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-generator-function@^1.0.7: - version "1.0.9" - resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.9.tgz#e5f82c2323673e7fcad3d12858c83c4039f6399c" - integrity sha512-ZJ34p1uvIfptHCN7sFTjGibB9/oBg17sHqzDLfuwhvmN/qLVvIQXRQ8licZQ35WJ8KuEQt/etnnzQFI9C9Ue/A== - -is-glob@^4.0.1, 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-interactive@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" - integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== - -is-ip@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/is-ip/-/is-ip-3.1.0.tgz#2ae5ddfafaf05cb8008a62093cf29734f657c5d8" - integrity sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q== - dependencies: - ip-regex "^4.0.0" - -is-ipfs@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-ipfs/-/is-ipfs-1.0.3.tgz#4b8c4995c46beac38f0c05f8cecd77093dd6a6b3" - integrity sha512-7SAfhxp39rxMvr95qjHMtsle1xa7zXpIbhX/Q77iXKtMVnQ0Fr9AVpAUq+bl3HPXGXDpZJFP0hzWBZaMwD6vGg== - dependencies: - buffer "^5.6.0" - cids "~0.8.0" - iso-url "~0.4.7" - mafmt "^7.1.0" - multiaddr "^7.4.3" - multibase "~0.7.0" - multihashes "~0.4.19" - -is-negative-zero@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" - integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== - -is-number-object@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.5.tgz#6edfaeed7950cff19afedce9fbfca9ee6dd289eb" - integrity sha512-RU0lI/n95pMoUKu9v1BZP5MBcZuNSVJkMkAG2dJqC4z2GlkGUNeH68SuHuBKBD/XFe+LHZ+f9BKkLET60Niedw== - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-plain-obj@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" - integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== - -is-regex@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.3.tgz#d029f9aff6448b93ebbe3f33dac71511fdcbef9f" - integrity sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ== - dependencies: - call-bind "^1.0.2" - has-symbols "^1.0.2" - -is-stream@^2.0.0: - version "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, is-string@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.6.tgz#3fe5d5992fb0d93404f32584d4b0179a71b54a5f" - integrity sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w== - -is-symbol@^1.0.2, is-symbol@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" - integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== - dependencies: - has-symbols "^1.0.2" - -is-typed-array@^1.1.3: - version "1.1.5" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.5.tgz#f32e6e096455e329eb7b423862456aa213f0eb4e" - integrity sha512-S+GRDgJlR3PyEbsX/Fobd9cqpZBuvUS+8asRqYDMLCb2qMzt1oz5m5oxQCxOgUDxiWsOVNi4yaF+/uvdlHlYug== - dependencies: - available-typed-arrays "^1.0.2" - call-bind "^1.0.2" - es-abstract "^1.18.0-next.2" - foreach "^2.0.5" - has-symbols "^1.0.1" - -isarray@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= - -iso-constants@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/iso-constants/-/iso-constants-0.1.2.tgz#3d2456ed5aeaa55d18564f285ba02a47a0d885b4" - integrity sha512-OTCM5ZCQsHBCI4Wdu4tSxvDIkmDHd5EwJDps5mKqnQnWJSKlnwMs3EDZ4n3Fh1tmkWkDlyd2vCDbEYuPbyrUNQ== - -iso-url@^1.0.0: - version "1.1.5" - resolved "https://registry.yarnpkg.com/iso-url/-/iso-url-1.1.5.tgz#875a0f2bf33fa1fc200f8d89e3f49eee57a8f0d9" - integrity sha512-+3JqoKdBTGmyv9vOkS6b9iHhvK34UajfTibrH/1HOK8TI7K2VsM0qOCd+aJdWKtSOA8g3PqZfcwDmnR0p3klqQ== - -iso-url@~0.4.7: - version "0.4.7" - resolved "https://registry.yarnpkg.com/iso-url/-/iso-url-0.4.7.tgz#de7e48120dae46921079fe78f325ac9e9217a385" - integrity sha512-27fFRDnPAMnHGLq36bWTpKET+eiXct3ENlCcdcMdk+mjXrb2kw3mhBUg1B7ewAC0kVzlOPhADzQgz1SE6Tglog== - -it-all@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/it-all/-/it-all-1.0.5.tgz#e880510d7e73ebb79063a76296a2eb3cb77bbbdb" - integrity sha512-ygD4kA4vp8fi+Y+NBgEKt6W06xSbv6Ub/0V8d1r3uCyJ9Izwa1UspkIOlqY9fOee0Z1w3WRo1+VWyAU4DgtufA== - -it-concat@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/it-concat/-/it-concat-1.0.3.tgz#84db9376e4c77bf7bc1fd933bb90f184e7cef32b" - integrity sha512-sjeZQ1BWQ9U/W2oI09kZgUyvSWzQahTkOkLIsnEPgyqZFaF9ME5gV6An4nMjlyhXKWQMKEakQU8oRHs2SdmeyA== - dependencies: - bl "^4.0.0" - -it-glob@0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/it-glob/-/it-glob-0.0.10.tgz#4defd9286f693847c3ff483d2ff65f22e1359ad8" - integrity sha512-p1PR15djgPV7pxdLOW9j4WcJdla8+91rJdUU2hU2Jm68vkxpIEXK55VHBeH8Lvqh2vqLtM83t8q4BuJxue6niA== - dependencies: - fs-extra "^9.0.1" - minimatch "^3.0.4" - -it-last@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/it-last/-/it-last-1.0.5.tgz#5c711c7d58948bcbc8e0cb129af3a039ba2a585b" - integrity sha512-PV/2S4zg5g6dkVuKfgrQfN2rUN4wdTI1FzyAvU+i8RV96syut40pa2s9Dut5X7SkjwA3P0tOhLABLdnOJ0Y/4Q== - -it-map@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/it-map/-/it-map-1.0.5.tgz#2f6a9b8f0ba1ed1aeadabf86e00b38c73a1dc299" - integrity sha512-EElupuWhHVStUgUY+OfTJIS2MZed96lDrAXzJUuqiiqLnIKoBRqtX1ZG2oR0bGDsSppmz83MtzCeKLZ9TVAUxQ== - -it-peekable@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/it-peekable/-/it-peekable-1.0.2.tgz#3b2c7948b765f35b3bb07abbb9b2108c644e73c1" - integrity sha512-LRPLu94RLm+lxLZbChuc9iCXrKCOu1obWqxfaKhF00yIp30VGkl741b5P60U+rdBxuZD/Gt1bnmakernv7bVFg== - -it-reader@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/it-reader/-/it-reader-2.1.0.tgz#b1164be343f8538d8775e10fb0339f61ccf71b0f" - integrity sha512-hSysqWTO9Tlwc5EGjVf8JYZzw0D2FsxD/g+eNNWrez9zODxWt6QlN6JAMmycK72Mv4jHEKEXoyzUN4FYGmJaZw== - dependencies: - bl "^4.0.0" - -it-tar@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/it-tar/-/it-tar-1.2.2.tgz#8d79863dad27726c781a4bcc491f53c20f2866cf" - integrity sha512-M8V4a9I+x/vwXTjqvixcEZbQZHjwDIb8iUQ+D4M2QbhAdNs3WKVSl+45u5/F2XFx6jYMFOGzMVlKNK/uONgNIA== - dependencies: - bl "^4.0.0" - buffer "^5.4.3" - iso-constants "^0.1.2" - it-concat "^1.0.0" - it-reader "^2.0.0" - p-defer "^3.0.0" - -it-to-stream@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/it-to-stream/-/it-to-stream-0.1.2.tgz#7163151f75b60445e86b8ab1a968666acaacfe7b" - integrity sha512-DTB5TJRZG3untmZehcaFN0kGWl2bNv7tnJRgQHAO9QEt8jfvVRrebZtnD5NZd4SCj4WVPjl0LSrugNWE/UaZRQ== - dependencies: - buffer "^5.6.0" - fast-fifo "^1.0.0" - get-iterator "^1.0.2" - p-defer "^3.0.0" - p-fifo "^1.0.0" - readable-stream "^3.6.0" - -iterable-ndjson@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/iterable-ndjson/-/iterable-ndjson-1.1.0.tgz#36f7e8a5bb04fd087d384f29e44fc4280fc014fc" - integrity sha512-OOp1Lb0o3k5MkXHx1YaIY5Z0ELosZfTnBaas9f8opJVcZGBIONA2zY/6CYE+LKkqrSDooIneZbrBGgOZnHPkrg== - dependencies: - string_decoder "^1.2.0" - -jaeger-client@^3.15.0: - version "3.18.1" - resolved "https://registry.yarnpkg.com/jaeger-client/-/jaeger-client-3.18.1.tgz#a8c7a778244ba117f4fb8775eb6aa5508703564e" - integrity sha512-eZLM2U6rJvYo0XbzQYFeMYfp29gQix7SKlmDReorp9hJkUwXZtTyxW81AcKdmFCjLHO5tFysTX+394BnjEnUZg== - dependencies: - node-int64 "^0.4.0" - opentracing "^0.14.4" - thriftrw "^3.5.0" - uuid "^3.2.1" - xorshift "^0.2.0" - -js-sha3@0.5.7: - version "0.5.7" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" - integrity sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc= - -js-sha3@^0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" - integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -js-yaml@3.14.0: - version "3.14.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" - integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -json-parse-even-better-errors@^2.3.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" - integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== - -json-text-sequence@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/json-text-sequence/-/json-text-sequence-0.1.1.tgz#a72f217dc4afc4629fff5feb304dc1bd51a2f3d2" - integrity sha1-py8hfcSvxGKf/1/rME3BvVGi89I= - dependencies: - delimit-stream "0.1.0" - -json3@3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.0.tgz#0e9e7f6c5d270b758929af4d6fefdc84bd66e259" - integrity sha1-Dp5/bF0nC3WJKa9Nb+/chL1m4lk= - -jsonfile@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" - integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== - dependencies: - universalify "^2.0.0" - optionalDependencies: - graceful-fs "^4.1.6" - -jsonschema@1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/jsonschema/-/jsonschema-1.4.0.tgz#1afa34c4bc22190d8e42271ec17ac8b3404f87b2" - integrity sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw== - -lcid@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-3.1.1.tgz#9030ec479a058fc36b5e8243ebaac8b6ac582fd0" - integrity sha512-M6T051+5QCGLBQb8id3hdvIW8+zeFV2FyBGFS9IEK5H9Wt4MueD4bW1eWikpHgZp+5xR3l5c8pZUkQsIA0BFZg== - dependencies: - invert-kv "^3.0.0" - -lines-and-columns@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" - integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= - -lodash.camelcase@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" - integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= - -lodash.kebabcase@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" - integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY= - -lodash.lowercase@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.lowercase/-/lodash.lowercase-4.3.0.tgz#46515aced4acb0b7093133333af068e4c3b14e9d" - integrity sha1-RlFaztSssLcJMTMzOvBo5MOxTp0= - -lodash.lowerfirst@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/lodash.lowerfirst/-/lodash.lowerfirst-4.3.1.tgz#de3c7b12e02c6524a0059c2f6cb7c5c52655a13d" - integrity sha1-3jx7EuAsZSSgBZwvbLfFxSZVoT0= - -lodash.merge@^4.6.2: - version "4.6.2" - resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" - integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== - -lodash.pad@^4.5.1: - version "4.5.1" - resolved "https://registry.yarnpkg.com/lodash.pad/-/lodash.pad-4.5.1.tgz#4330949a833a7c8da22cc20f6a26c4d59debba70" - integrity sha1-QzCUmoM6fI2iLMIPaibE1Z3runA= - -lodash.padend@^4.6.1: - version "4.6.1" - resolved "https://registry.yarnpkg.com/lodash.padend/-/lodash.padend-4.6.1.tgz#53ccba047d06e158d311f45da625f4e49e6f166e" - integrity sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4= - -lodash.padstart@^4.6.1: - version "4.6.1" - resolved "https://registry.yarnpkg.com/lodash.padstart/-/lodash.padstart-4.6.1.tgz#d2e3eebff0d9d39ad50f5cbd1b52a7bce6bb611b" - integrity sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs= - -lodash.repeat@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/lodash.repeat/-/lodash.repeat-4.1.0.tgz#fc7de8131d8c8ac07e4b49f74ffe829d1f2bec44" - integrity sha1-/H3oEx2MisB+S0n3T/6CnR8r7EQ= - -lodash.snakecase@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d" - integrity sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40= - -lodash.startcase@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.startcase/-/lodash.startcase-4.4.0.tgz#9436e34ed26093ed7ffae1936144350915d9add8" - integrity sha1-lDbjTtJgk+1/+uGTYUQ1CRXZrdg= - -lodash.trim@^4.5.1: - version "4.5.1" - resolved "https://registry.yarnpkg.com/lodash.trim/-/lodash.trim-4.5.1.tgz#36425e7ee90be4aa5e27bcebb85b7d11ea47aa57" - integrity sha1-NkJefukL5KpeJ7zruFt9EepHqlc= - -lodash.trimend@^4.5.1: - version "4.5.1" - resolved "https://registry.yarnpkg.com/lodash.trimend/-/lodash.trimend-4.5.1.tgz#12804437286b98cad8996b79414e11300114082f" - integrity sha1-EoBENyhrmMrYmWt5QU4RMAEUCC8= - -lodash.trimstart@^4.5.1: - version "4.5.1" - resolved "https://registry.yarnpkg.com/lodash.trimstart/-/lodash.trimstart-4.5.1.tgz#8ff4dec532d82486af59573c39445914e944a7f1" - integrity sha1-j/TexTLYJIavWVc8OURZFOlEp/E= - -lodash.uppercase@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.uppercase/-/lodash.uppercase-4.3.0.tgz#c404abfd1469f93931f9bb24cf6cc7d57059bc73" - integrity sha1-xASr/RRp+Tkx+bskz2zH1XBZvHM= - -lodash.upperfirst@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce" - integrity sha1-E2Xt9DFIBIHvDRxolXpe2Z1J984= - -log-symbols@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4" - integrity sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ== - dependencies: - chalk "^2.4.2" - -long@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/long/-/long-2.4.0.tgz#9fa180bb1d9500cdc29c4156766a1995e1f4524f" - integrity sha1-n6GAux2VAM3CnEFWdmoZleH0Uk8= - -long@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" - integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== - -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - -mafmt@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/mafmt/-/mafmt-7.1.0.tgz#4126f6d0eded070ace7dbbb6fb04977412d380b5" - integrity sha512-vpeo9S+hepT3k2h5iFxzEHvvR0GPBx9uKaErmnRzYNcaKb03DgOArjEMlgG4a9LcuZZ89a3I8xbeto487n26eA== - dependencies: - multiaddr "^7.3.0" - -map-age-cleaner@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" - integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== - dependencies: - p-defer "^1.0.0" - -mem@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/mem/-/mem-5.1.1.tgz#7059b67bf9ac2c924c9f1cff7155a064394adfb3" - integrity sha512-qvwipnozMohxLXG1pOqoLiZKNkC4r4qqRucSoDwXowsNGDSULiqFTRUF05vcZWnwJSG22qTsynQhxbaMtnX9gw== - dependencies: - map-age-cleaner "^0.1.3" - mimic-fn "^2.1.0" - p-is-promise "^2.1.0" - -merge-options@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-options/-/merge-options-2.0.0.tgz#36ca5038badfc3974dbde5e58ba89d3df80882c3" - integrity sha512-S7xYIeWHl2ZUKF7SDeBhGg6rfv5bKxVBdk95s/I7wVF8d+hjLSztJ/B271cnUiF6CAFduEQ5Zn3HYwAjT16DlQ== - dependencies: - is-plain-obj "^2.0.0" - -merge-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== - -mime-db@1.48.0: - version "1.48.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.48.0.tgz#e35b31045dd7eada3aaad537ed88a33afbef2d1d" - integrity sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ== - -mime-types@^2.1.12: - version "2.1.31" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.31.tgz#a00d76b74317c61f9c2db2218b8e9f8e9c5c9e6b" - integrity sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg== - dependencies: - mime-db "1.48.0" - -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== - -minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= - -minimatch@*, minimatch@^3.0.2, minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.1.0: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -ms@^2.1.1: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -multiaddr-to-uri@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/multiaddr-to-uri/-/multiaddr-to-uri-6.0.0.tgz#8f08a75c6eeb2370d5d24b77b8413e3f0fa9bcc0" - integrity sha512-OjpkVHOXEmIKMO8WChzzQ7aZQcSQX8squxmvtDbRpy7/QNmJ3Z7jv6qyD74C28QtaeNie8O8ngW2AkeiMmKP7A== - dependencies: - multiaddr "^8.0.0" - -multiaddr@^7.3.0, multiaddr@^7.4.3: - version "7.5.0" - resolved "https://registry.yarnpkg.com/multiaddr/-/multiaddr-7.5.0.tgz#976c88e256e512263445ab03b3b68c003d5f485e" - integrity sha512-GvhHsIGDULh06jyb6ev+VfREH9evJCFIRnh3jUt9iEZ6XDbyoisZRFEI9bMvK/AiR6y66y6P+eoBw9mBYMhMvw== - dependencies: - buffer "^5.5.0" - cids "~0.8.0" - class-is "^1.1.0" - is-ip "^3.1.0" - multibase "^0.7.0" - varint "^5.0.0" - -multiaddr@^8.0.0: - version "8.1.2" - resolved "https://registry.yarnpkg.com/multiaddr/-/multiaddr-8.1.2.tgz#74060ff8636ba1c01b2cf0ffd53950b852fa9b1f" - integrity sha512-r13IzW8+Sv9zab9Gt8RPMIN2WkptIPq99EpAzg4IbJ/zTELhiEwXWr9bAmEatSCI4j/LSA6ESJzvz95JZ+ZYXQ== - dependencies: - cids "^1.0.0" - class-is "^1.1.0" - dns-over-http-resolver "^1.0.0" - err-code "^2.0.3" - is-ip "^3.1.0" - multibase "^3.0.0" - uint8arrays "^1.1.0" - varint "^5.0.0" - -multibase@^0.7.0, multibase@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" - integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multibase@^1.0.0, multibase@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-1.0.1.tgz#4adbe1de0be8a1ab0274328b653c3f1903476724" - integrity sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multibase@^3.0.0, multibase@^3.1.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-3.1.2.tgz#59314e1e2c35d018db38e4c20bb79026827f0f2f" - integrity sha512-bpklWHs70LO3smJUHOjcnzGceJJvn9ui0Vau6Za0B/GBepaXswmW8Ufea0uD9pROf/qCQ4N4lZ3sf3U+SNf0tw== - dependencies: - "@multiformats/base-x" "^4.0.1" - web-encoding "^1.0.6" - -multibase@^4.0.1: - version "4.0.4" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-4.0.4.tgz#55ef53e6acce223c5a09341a8a3a3d973871a577" - integrity sha512-8/JmrdSGzlw6KTgAJCOqUBSGd1V6186i/X8dDCGy/lbCKrQ+1QB6f3HE+wPr7Tpdj4U3gutaj9jG2rNX6UpiJg== - dependencies: - "@multiformats/base-x" "^4.0.1" - -multibase@~0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.6.1.tgz#b76df6298536cc17b9f6a6db53ec88f85f8cc12b" - integrity sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multicodec@^1.0.0, multicodec@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-1.0.4.tgz#46ac064657c40380c28367c90304d8ed175a714f" - integrity sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg== - dependencies: - buffer "^5.6.0" - varint "^5.0.0" - -multicodec@^2.0.0, multicodec@^2.0.1: - version "2.1.3" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-2.1.3.tgz#b9850635ad4e2a285a933151b55b4a2294152a5d" - integrity sha512-0tOH2Gtio39uO41o+2xl9UhRkCWxU5ZmZSbFCh/OjGzkWJI8e6lkN/s4Mj1YfyWoBod+2+S3W+6wO6nhkwN8pA== - dependencies: - uint8arrays "1.1.0" - varint "^6.0.0" - -multicodec@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-3.0.1.tgz#94e043847ee11fcce92487609ac9010429a95e31" - integrity sha512-Y6j3wiPojvkF/z6KFIGt84KdJdP2oILEdzc/3YbD3qQ3EerhqtYlfsZTPPNVoCCxNZZdzIpCKrdYFSav17sIrQ== - dependencies: - uint8arrays "^2.1.3" - varint "^5.0.2" - -multihashes@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-1.0.1.tgz#a89415d68283cf6287c6e219e304e75ce7fb73fe" - integrity sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw== - dependencies: - buffer "^5.6.0" - multibase "^1.0.1" - varint "^5.0.0" - -multihashes@^3.0.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-3.1.2.tgz#ffa5e50497aceb7911f7b4a3b6cada9b9730edfc" - integrity sha512-AP4IoV/YzkNrfbQKZE3OMPibrmy350OmCd6cJkwyM8oExaXIlOY4UnOOVSQtAEuq/LR01XfXKCESidzZvSwHCQ== - dependencies: - multibase "^3.1.0" - uint8arrays "^2.0.5" - varint "^6.0.0" - -multihashes@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-4.0.2.tgz#d76aeac3a302a1bed9fe1ec964fb7a22fa662283" - integrity sha512-xpx++1iZr4ZQHjN1mcrXS6904R36LWLxX/CBifczjtmrtCXEX623DMWOF1eiNSg+pFpiZDFVBgou/4v6ayCHSQ== - dependencies: - multibase "^4.0.1" - uint8arrays "^2.1.3" - varint "^5.0.2" - -multihashes@~0.4.15, multihashes@~0.4.19: - version "0.4.21" - resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.21.tgz#dc02d525579f334a7909ade8a122dabb58ccfcb5" - integrity sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw== - dependencies: - buffer "^5.5.0" - multibase "^0.7.0" - varint "^5.0.0" - -multihashing-async@^2.0.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/multihashing-async/-/multihashing-async-2.1.2.tgz#9ed68f183bde70e0416b166bbc59a0c0623a0ede" - integrity sha512-FTPNnWWxwIK5dXXmTFhySSF8Fkdqf7vzqpV09+RWsmfUhrsL/b3Arg3+bRrBnXTtjxm3JRGI3wSAtQHL0QCxhQ== - dependencies: - blakejs "^1.1.0" - err-code "^3.0.0" - js-sha3 "^0.8.0" - multihashes "^4.0.1" - murmurhash3js-revisited "^3.0.0" - uint8arrays "^2.1.3" - -murmurhash3js-revisited@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz#6bd36e25de8f73394222adc6e41fa3fac08a5869" - integrity sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g== - -mustache@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.0.1.tgz#d99beb031701ad433338e7ea65e0489416c854a2" - integrity sha512-yL5VE97+OXn4+Er3THSmTdCFCtx5hHWzrolvH+JObZnUYwuaG7XV+Ch4fR2cIrcYI0tFHxS7iyFYl14bW8y2sA== - -mute-stream@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" - integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== - -nanoid@^3.1.12, nanoid@^3.1.3: - version "3.1.23" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81" - integrity sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw== - -native-abort-controller@0.0.3, native-abort-controller@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/native-abort-controller/-/native-abort-controller-0.0.3.tgz#4c528a6c9c7d3eafefdc2c196ac9deb1a5edf2f8" - integrity sha512-YIxU5nWqSHG1Xbu3eOu3pdFRD882ivQpIcu6AiPVe2oSVoRbfYW63DVkZm3g1gHiMtZSvZzF6THSzTGEBYl8YA== - dependencies: - globalthis "^1.0.1" - -native-abort-controller@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/native-abort-controller/-/native-abort-controller-1.0.3.tgz#35974a2e189c0d91399c8767a989a5bf058c1435" - integrity sha512-fd5LY5q06mHKZPD5FmMrn7Lkd2H018oBGKNOAdLpctBDEPFKsfJ1nX9ke+XRa8PEJJpjqrpQkGjq2IZ27QNmYA== - -native-fetch@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/native-fetch/-/native-fetch-2.0.1.tgz#319d53741a7040def92d5dc8ea5fe9416b1fad89" - integrity sha512-gv4Bea+ga9QdXINurpkEqun3ap3vnB+WYoe4c8ddqUYEH7B2h6iD39RF8uVN7OwmSfMY3RDxkvBnoI4e2/vLXQ== - dependencies: - globalthis "^1.0.1" - -native-fetch@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/native-fetch/-/native-fetch-3.0.0.tgz#06ccdd70e79e171c365c75117959cf4fe14a09bb" - integrity sha512-G3Z7vx0IFb/FQ4JxvtqGABsOTIqRWvgQz6e+erkB+JJD6LrszQtMozEHI4EkmgZQvnGHrpLVzUWk7t4sJCIkVw== - -node-fetch@^2.6.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" - integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== - -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= - -normalize-path@^3.0.0, normalize-path@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -npm-run-path@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== - dependencies: - path-key "^3.0.0" - -object-assign@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - -object-inspect@^1.10.3: - version "1.10.3" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.10.3.tgz#c2aa7d2d09f50c99375704f7a0adf24c5782d369" - integrity sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw== - -object-keys@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.5.0.tgz#09e211f3e00318afc4f592e36e7cdc10d9ad7293" - integrity sha1-CeIR8+ADGK/E9ZLjbnzcENmtcpM= - -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.assign@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" - integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== - dependencies: - call-bind "^1.0.0" - define-properties "^1.1.3" - has-symbols "^1.0.1" - object-keys "^1.1.1" - -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" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - dependencies: - wrappy "1" - -onetime@^5.1.0: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - dependencies: - mimic-fn "^2.1.0" - -opentracing@^0.14.4: - version "0.14.5" - resolved "https://registry.yarnpkg.com/opentracing/-/opentracing-0.14.5.tgz#891fa92cd90a24e64f99bc964370227310926c85" - integrity sha512-XLKtEfHxqrWyF1fzxznsv78w3csW41ucHnjiKnfzZLD5FN8UBDZZL1i4q0FR29zjxXhm+2Hop+5Vr/b8tKIvEg== - -ora@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/ora/-/ora-4.0.0.tgz#374c4ee8c5fb91b5dbcd82de199f188d3e8fd5ec" - integrity sha512-2RaV0LWJgpWEjvpsW57H8pnzdVQJrtAr4VGk9cIqn58ePx5k1b0H3h9DS2Qj4cL1Cm012JSeg+7AcVNsis6AVQ== - dependencies: - chalk "^2.4.2" - cli-cursor "^3.1.0" - cli-spinners "^2.2.0" - is-interactive "^1.0.0" - log-symbols "^3.0.0" - strip-ansi "^5.2.0" - wcwidth "^1.0.1" - -ora@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/ora/-/ora-4.1.1.tgz#566cc0348a15c36f5f0e979612842e02ba9dddbc" - integrity sha512-sjYP8QyVWBpBZWD6Vr1M/KwknSw6kJOz41tvGMlwWeClHBtYKTbHMki1PsLZnxKpXMPbTKv9b3pjQu3REib96A== - dependencies: - chalk "^3.0.0" - cli-cursor "^3.1.0" - cli-spinners "^2.2.0" - is-interactive "^1.0.0" - log-symbols "^3.0.0" - mute-stream "0.0.8" - strip-ansi "^6.0.0" - wcwidth "^1.0.1" - -os-locale@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-5.0.0.tgz#6d26c1d95b6597c5d5317bf5fba37eccec3672e0" - integrity sha512-tqZcNEDAIZKBEPnHPlVDvKrp7NzgLi7jRmhKiUoa2NUmhl13FtkAGLUVR+ZsYvApBQdBfYm43A4tXXQ4IrYLBA== - dependencies: - execa "^4.0.0" - lcid "^3.0.0" - mem "^5.0.0" - -p-defer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" - integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= - -p-defer@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-3.0.0.tgz#d1dceb4ee9b2b604b1d94ffec83760175d4e6f83" - integrity sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw== - -p-fifo@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-fifo/-/p-fifo-1.0.0.tgz#e29d5cf17c239ba87f51dde98c1d26a9cfe20a63" - integrity sha512-IjoCxXW48tqdtDFz6fqo5q1UfFVjjVZe8TC1QRflvNUJtNfCUhxOUw6MOVZhDPjqhSzc26xKdugsO17gmzd5+A== - dependencies: - fast-fifo "^1.0.0" - p-defer "^3.0.0" - -p-finally@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" - integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== - -p-is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" - integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== - -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-duration@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/parse-duration/-/parse-duration-0.4.4.tgz#11c0f51a689e97d06c57bd772f7fda7dc013243c" - integrity sha512-KbAJuYGUhZkB9gotDiKLnZ7Z3VTacK3fgwmDdB6ZVDtJbMBT6MfLga0WJaYpPDu0mzqT0NgHtHDt5PY4l0nidg== - -parse-json@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" - integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== - dependencies: - "@babel/code-frame" "^7.0.0" - error-ex "^1.3.1" - json-parse-even-better-errors "^2.3.0" - lines-and-columns "^1.1.6" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - -path-key@^3.0.0, path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - -picomatch@^2.0.4, picomatch@^2.2.1: - version "2.3.0" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" - integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== - -pluralize@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" - integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== - -process@^0.10.0: - version "0.10.1" - resolved "https://registry.yarnpkg.com/process/-/process-0.10.1.tgz#842457cc51cfed72dc775afeeafb8c6034372725" - integrity sha1-hCRXzFHP7XLcd1r+6vuMYDQ3JyU= - -protocol-buffers-schema@^3.3.1: - version "3.5.1" - resolved "https://registry.yarnpkg.com/protocol-buffers-schema/-/protocol-buffers-schema-3.5.1.tgz#8388e768d383ac8cbea23e1280dfadb79f4122ad" - integrity sha512-YVCvdhxWNDP8/nJDyXLuM+UFsuPk4+1PB7WGPVDzm3HTHbzFLxQYeW2iZpS4mmnXrQJGBzt230t/BbEb7PrQaw== - -protons@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/protons/-/protons-2.0.1.tgz#bfee5123c100001dcf56ab8f71b1b36f2e8289f1" - integrity sha512-FlmPorLEeCEDPu+uIn0Qardgiy5XqVA4IyNTz9wb9c0e2U7BEXdRcIbx64r09o4Abtf+4B7mkTtMbsIXMxZzKw== - dependencies: - protocol-buffers-schema "^3.3.1" - signed-varint "^2.0.1" - uint8arrays "^2.1.3" - varint "^5.0.0" - -pull-stream-to-async-iterator@^1.0.1, pull-stream-to-async-iterator@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pull-stream-to-async-iterator/-/pull-stream-to-async-iterator-1.0.2.tgz#5cc1a3a146ef6bbf01c17755647369b683b24986" - integrity sha512-c3KRs2EneuxP7b6pG9fvQTIjatf33RbIErhbQ75s5r2MI6E8R74NZC1nJgXc8kcmqiQxmr+TWY+WwK2mWaUnlA== - dependencies: - pull-stream "^3.6.9" - -pull-stream@^3.6.9: - version "3.6.14" - resolved "https://registry.yarnpkg.com/pull-stream/-/pull-stream-3.6.14.tgz#529dbd5b86131f4a5ed636fdf7f6af00781357ee" - integrity sha512-KIqdvpqHHaTUA2mCYcLG1ibEbu/LCKoJZsBWyv9lSYtPkJPBq8m3Hxa103xHi6D2thj5YXa0TqK3L3GUkwgnew== - -pump@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" - integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -querystring@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.1.tgz#40d77615bb09d16902a85c3e38aa8b5ed761c2dd" - integrity sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg== - -ramda@^0.24.1: - version "0.24.1" - resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.24.1.tgz#c3b7755197f35b8dc3502228262c4c91ddb6b857" - integrity sha1-w7d1UZfzW43DUCIoJixMkd22uFc= - -ramda@^0.25.0: - version "0.25.0" - resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.25.0.tgz#8fdf68231cffa90bc2f9460390a0cb74a29b29a9" - integrity sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ== - -ramdasauce@^2.1.0: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ramdasauce/-/ramdasauce-2.1.3.tgz#acb45ecc7e4fc4d6f39e19989b4a16dff383e9c2" - integrity sha512-Ml3CPim4SKwmg5g9UI77lnRSeKr/kQw7YhQ6rfdMcBYy6DMlwmkEwQqjygJ3OhxPR+NfFfpjKl3Tf8GXckaqqg== - dependencies: - ramda "^0.24.1" - -readable-stream@^3.4.0, readable-stream@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readdirp@~3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" - integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ== - dependencies: - picomatch "^2.2.1" - -receptacle@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/receptacle/-/receptacle-1.3.2.tgz#a7994c7efafc7a01d0e2041839dab6c4951360d2" - integrity sha512-HrsFvqZZheusncQRiEE7GatOAETrARKV/lnfYicIm8lbvp/JQOdADOfhjBd2DajvoszEyxSM6RlAAIZgEoeu/A== - dependencies: - ms "^2.1.1" - -reset@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/reset/-/reset-0.1.0.tgz#9fc7314171995ae6cb0b7e58b06ce7522af4bafb" - integrity sha1-n8cxQXGZWubLC35YsGznUir0uvs= - -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== - -restore-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" - integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== - dependencies: - onetime "^5.1.0" - signal-exit "^3.0.2" - -retimer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/retimer/-/retimer-2.0.0.tgz#e8bd68c5e5a8ec2f49ccb5c636db84c04063bbca" - integrity sha512-KLXY85WkEq2V2bKex/LOO1ViXVn2KGYe4PYysAdYdjmraYIUsVkXu8O4am+8+5UbaaGl1qho4aqAAPHNQ4GSbg== - -rimraf@^2.6.3: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - -run@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/run/-/run-1.4.0.tgz#e17d9e9043ab2fe17776cb299e1237f38f0b4ffa" - integrity sha1-4X2ekEOrL+F3dsspnhI3848LT/o= - dependencies: - minimatch "*" - -safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -"safer-buffer@>= 2.1.2 < 3.0.0": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -scrypt-js@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" - integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== - -semver@7.3.4: - version "7.3.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" - integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== - dependencies: - lru-cache "^6.0.0" - -semver@^7.0.0, semver@^7.1.3: - version "7.3.5" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" - integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== - dependencies: - lru-cache "^6.0.0" - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -signal-exit@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" - integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== - -signed-varint@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/signed-varint/-/signed-varint-2.0.1.tgz#50a9989da7c98c2c61dad119bc97470ef8528129" - integrity sha1-UKmYnafJjCxh2tEZvJdHDvhSgSk= - dependencies: - varint "~5.0.0" - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= - -stable@^0.1.8: - version "0.1.8" - resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf" - integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w== - -stream-to-it@^0.2.0, stream-to-it@^0.2.2: - version "0.2.3" - resolved "https://registry.yarnpkg.com/stream-to-it/-/stream-to-it-0.2.3.tgz#b9320ceb26a51b313de81036d4354d9b657f4d2d" - integrity sha512-xaK9EjPtLox5rrC7YLSBXSanTtUJN/lzJlMFvy9VaROmnyvy0U/X6m2uMhXPJRn3g3M9uOSIzTszW7BPiWSg9w== - dependencies: - get-iterator "^1.0.2" - -string-template@~0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add" - integrity sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0= - -string-width@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - -string.prototype.trimend@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80" - integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - -string.prototype.trimstart@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" - integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - -string_decoder@^1.1.1, string_decoder@^1.2.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= - dependencies: - ansi-regex "^3.0.0" - -strip-ansi@^5.2.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" - integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== - dependencies: - ansi-regex "^5.0.0" - -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -thriftrw@^3.5.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/thriftrw/-/thriftrw-3.12.0.tgz#30857847755e7f036b2e0a79d11c9f55075539d9" - integrity sha512-4YZvR4DPEI41n4Opwr4jmrLGG4hndxr7387kzRFIIzxHQjarPusH4lGXrugvgb7TtPrfZVTpZCVe44/xUxowEw== - dependencies: - bufrw "^1.3.0" - error "7.0.2" - long "^2.4.0" - -timeout-abort-controller@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/timeout-abort-controller/-/timeout-abort-controller-1.1.1.tgz#2c3c3c66f13c783237987673c276cbd7a9762f29" - integrity sha512-BsF9i3NAJag6T0ZEjki9j654zoafI2X6ayuNd6Tp8+Ul6Tr5s4jo973qFeiWrRSweqvskC+AHDKUmIW4b7pdhQ== - dependencies: - abort-controller "^3.0.0" - retimer "^2.0.0" - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -tslib@^2.0.0, tslib@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c" - integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w== - -uint8arrays@1.1.0, uint8arrays@^1.0.0, uint8arrays@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-1.1.0.tgz#d034aa65399a9fd213a1579e323f0b29f67d0ed2" - integrity sha512-cLdlZ6jnFczsKf5IH1gPHTtcHtPGho5r4CvctohmQjw8K7Q3gFdfIGHxSTdTaCKrL4w09SsPRJTqRS0drYeszA== - dependencies: - multibase "^3.0.0" - web-encoding "^1.0.2" - -uint8arrays@^2.0.5, uint8arrays@^2.1.3: - version "2.1.5" - resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-2.1.5.tgz#9e6e6377a9463d5eba4620a3f0450f7eb389a351" - integrity sha512-CSR7AO+4AHUeSOnZ/NBNCElDeWfRh9bXtOck27083kc7SznmmHIhNEkEOCQOn0wvrIMjS3IH0TNLR16vuc46mA== - dependencies: - multibase "^4.0.1" - -unbox-primitive@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" - integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== - dependencies: - function-bind "^1.1.1" - has-bigints "^1.0.1" - has-symbols "^1.0.2" - which-boxed-primitive "^1.0.2" - -universalify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d" - integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug== - -universalify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" - integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== - -util-deprecate@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= - -util-inspect@0.1.8: - version "0.1.8" - resolved "https://registry.yarnpkg.com/util-inspect/-/util-inspect-0.1.8.tgz#2b39dbcd2d921f2d8430923caff40f4b5cea5db1" - integrity sha1-KznbzS2SHy2EMJI8r/QPS1zqXbE= - dependencies: - array-map "0.0.0" - array-reduce "0.0.0" - foreach "2.0.4" - indexof "0.0.1" - isarray "0.0.1" - json3 "3.3.0" - object-keys "0.5.0" - -util@^0.12.3: - version "0.12.4" - resolved "https://registry.yarnpkg.com/util/-/util-0.12.4.tgz#66121a31420df8f01ca0c464be15dfa1d1850253" - integrity sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw== - dependencies: - inherits "^2.0.3" - is-arguments "^1.0.4" - is-generator-function "^1.0.7" - is-typed-array "^1.1.3" - safe-buffer "^5.1.2" - which-typed-array "^1.1.2" - -uuid@^3.2.1: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - -varint@^5.0.0, varint@^5.0.2, varint@~5.0.0: - version "5.0.2" - resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" - integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== - -varint@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/varint/-/varint-6.0.0.tgz#9881eb0ce8feaea6512439d19ddf84bf551661d0" - integrity sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg== - -wcwidth@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" - integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= - dependencies: - defaults "^1.0.3" - -web-encoding@^1.0.2, web-encoding@^1.0.6: - version "1.1.5" - resolved "https://registry.yarnpkg.com/web-encoding/-/web-encoding-1.1.5.tgz#fc810cf7667364a6335c939913f5051d3e0c4864" - integrity sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA== - dependencies: - util "^0.12.3" - optionalDependencies: - "@zxing/text-encoding" "0.9.0" - -web-worker@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.0.0.tgz#c7ced4e1eb6227636ada35056a9e5a477414e4d0" - integrity sha512-BzuMqeKVkKKwHV6tJuwePFcxYMxvC97D448mXTgh/CxXAB4sRtoV26gRPN+JDxsXRR7QZyioMV9O6NzQaASf7Q== - -which-boxed-primitive@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" - integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== - dependencies: - is-bigint "^1.0.1" - is-boolean-object "^1.1.0" - is-number-object "^1.0.4" - is-string "^1.0.5" - is-symbol "^1.0.3" - -which-typed-array@^1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.4.tgz#8fcb7d3ee5adf2d771066fba7cf37e32fe8711ff" - integrity sha512-49E0SpUe90cjpoc7BOJwyPHRqSAd12c10Qm2amdEZrJPCY2NDxaW01zHITrem+rnETY3dwrbH3UUrUwagfCYDA== - dependencies: - available-typed-arrays "^1.0.2" - call-bind "^1.0.0" - es-abstract "^1.18.0-next.1" - foreach "^2.0.5" - function-bind "^1.1.1" - has-symbols "^1.0.1" - is-typed-array "^1.1.3" - -which@^2.0.0, which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= - -ws@7.2.3: - version "7.2.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.3.tgz#a5411e1fb04d5ed0efee76d26d5c46d830c39b46" - integrity sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ== - -ws@7.3.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.1.tgz#d0547bf67f7ce4f12a72dfe31262c68d7dc551c8" - integrity sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA== - -ws@7.4.6: - version "7.4.6" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" - integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== - -xorshift@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/xorshift/-/xorshift-0.2.1.tgz#fcd82267e9351c13f0fb9c73307f25331d29c63a" - integrity sha1-/NgiZ+k1HBPw+5xzMH8lMx0pxjo= - -xtend@^4.0.0, xtend@~4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== - -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - -yaml@^1.7.2: - version "1.10.2" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" - integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== - -yargs-parser@^16.1.0: - version "16.1.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-16.1.0.tgz#73747d53ae187e7b8dbe333f95714c76ea00ecf1" - integrity sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - -zone.js@^0.11.0: - version "0.11.4" - resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.11.4.tgz#0f70dcf6aba80f698af5735cbb257969396e8025" - integrity sha512-DDh2Ab+A/B+9mJyajPjHFPWfYU1H+pdun4wnnk0OcQTNjem1XQSZ2CDW+rfZEUDjv5M19SBqAkjZi0x5wuB5Qw== - dependencies: - tslib "^2.0.0" From 5cd9646731c36bc44ad5faf33cb9b984f3260031 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 9 Jun 2021 12:03:44 +0200 Subject: [PATCH 022/112] moved uriInterfaceImplementations to its own file --- .../src/types/UriInterfaceImplementations.ts | 31 ++++++++++++++++++ packages/js/core/src/types/UriRedirect.ts | 32 ++----------------- 2 files changed, 33 insertions(+), 30 deletions(-) create mode 100644 packages/js/core/src/types/UriInterfaceImplementations.ts diff --git a/packages/js/core/src/types/UriInterfaceImplementations.ts b/packages/js/core/src/types/UriInterfaceImplementations.ts new file mode 100644 index 0000000000..634f99ad2f --- /dev/null +++ b/packages/js/core/src/types/UriInterfaceImplementations.ts @@ -0,0 +1,31 @@ +import { Uri } from "."; + +import { Tracer } from "@web3api/tracing-js"; + +export interface UriInterfaceImplementations { + interface: TUri; + implementations: TUri[]; +} + +export const sanitizeUriInterfaceImplementations = Tracer.traceFunc( + "core: sanitizeUriInterfaceImplementations", + ( + input: UriInterfaceImplementations[] + ): UriInterfaceImplementations[] => { + const output: UriInterfaceImplementations[] = []; + for (const definition of input) { + const interfaceUri = new Uri(definition.interface); + + const implementations = definition.implementations.map((x) => + typeof x === "string" ? new Uri(x) : x + ); + + output.push({ + interface: interfaceUri, + implementations: implementations, + }); + } + + return output; + } +); diff --git a/packages/js/core/src/types/UriRedirect.ts b/packages/js/core/src/types/UriRedirect.ts index 2e59c41c96..08e91527f0 100644 --- a/packages/js/core/src/types/UriRedirect.ts +++ b/packages/js/core/src/types/UriRedirect.ts @@ -12,14 +12,9 @@ export interface UriRedirect { to: TUri | PluginPackage; } -export interface UriInterfaceImplementations { - interface: TUri; - implementations: TUri[]; -} - export const sanitizeUriRedirects = Tracer.traceFunc( "core: sanitizeUriRedirects", - (input: UriRedirect[]): UriRedirect[] => { + (input: UriRedirect[]): UriRedirect[] => { const output: UriRedirect[] = []; for (const definition of input) { const from = new Uri(definition.from); @@ -36,27 +31,4 @@ export const sanitizeUriRedirects = Tracer.traceFunc( return output; } -); - -export const sanitizeUriInterfaceImplementations = Tracer.traceFunc( - "core: sanitizeUriInterfaceImplementations", - ( - input: UriInterfaceImplementations[] - ): UriInterfaceImplementations[] => { - const output: UriInterfaceImplementations[] = []; - for (const definition of input) { - const interfaceUri = new Uri(definition.interface); - - const implementations = definition.implementations.map((x) => - typeof x === "string" ? new Uri(x) : x - ); - - output.push({ - interface: interfaceUri, - implementations: implementations, - }); - } - - return output; - } -); +); \ No newline at end of file From 425554f9e7d817aa3afe773b968a9a7b32b6c356 Mon Sep 17 00:00:00 2001 From: jbogunovic Date: Wed, 9 Jun 2021 16:07:01 +0200 Subject: [PATCH 023/112] renamed implementations confit to interfaces, extracted plugins registration separate from redirects --- packages/js/client/src/Web3ApiClient.ts | 37 ++++++++++++++++--- .../src/algorithms/get-implementations.ts | 4 +- .../js/core/src/types/PluginRegistration.ts | 25 +++++++++++++ 3 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 packages/js/core/src/types/PluginRegistration.ts diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 3fdf29ff29..51709816e0 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -14,19 +14,22 @@ import { Uri, UriRedirect, UriInterfaceImplementations, + PluginRegistration, resolveUri, InvokeApiOptions, InvokeApiResult, Manifest, sanitizeUriRedirects, sanitizeUriInterfaceImplementations, - getImplementations, + sanitizePluginRegistrations, + getAllImplementations, } from "@web3api/core-js"; import { Tracer } from "@web3api/tracing-js"; export interface ClientConfig { redirects?: UriRedirect[]; - implementations?: UriInterfaceImplementations[]; + plugins?: PluginRegistration[]; + interfaces?: UriInterfaceImplementations[]; tracingEnabled?: boolean; } @@ -57,6 +60,9 @@ export class Web3ApiClient implements Client { redirects: config.redirects ? sanitizeUriRedirects(config.redirects) : [], + plugins: config.plugins + ? sanitizePluginRegistrations(config.plugins) + : [], implementations: config.implementations ? sanitizeUriInterfaceImplementations(config.implementations) : [], @@ -93,8 +99,12 @@ export class Web3ApiClient implements Client { return this._config.redirects || []; } - public implementations(): readonly UriInterfaceImplementations[] { - return this._config.implementations || []; + public plugins(): readonly PluginRegistration[] { + return this._config.plugins || []; + } + + public interfaces(): readonly UriInterfaceImplementations[] { + return this._config.interfaces || []; } public async query< @@ -231,10 +241,25 @@ export class Web3ApiClient implements Client { const run = Tracer.traceFunc( "Web3ApiClient: getImplementations", (uri: string): string[] => { - return getImplementations( + return getAllImplementations( + new Uri(uri), + this.redirects(), + this.interfaces() + ).map((x) => x.uri); + } + ); + + return run(uri); + } + + public getAllImplementations(uri: string): string[] { + const run = Tracer.traceFunc( + "Web3ApiClient: getImplementations", + (uri: string): string[] => { + return getAllImplementations( new Uri(uri), this.redirects(), - this.implementations() + this.interfaces() ).map((x) => x.uri); } ); diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index fad81685be..978334c9d3 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -8,7 +8,7 @@ export const getImplementations = Tracer.traceFunc( ( apiInterfaceUri: Uri, redirects: readonly UriRedirect[], - implementations: readonly UriInterfaceImplementations[] + interfaceImplementationsList: readonly UriInterfaceImplementations[] ): Uri[] => { const result: Uri[] = []; @@ -66,7 +66,7 @@ export const getImplementations = Tracer.traceFunc( finalRedirectedApiInterface ); addAllImplementationsFromImplementationsArray( - implementations, + interfaceImplementationsList, finalRedirectedApiInterface ); diff --git a/packages/js/core/src/types/PluginRegistration.ts b/packages/js/core/src/types/PluginRegistration.ts new file mode 100644 index 0000000000..e9c161c226 --- /dev/null +++ b/packages/js/core/src/types/PluginRegistration.ts @@ -0,0 +1,25 @@ +import { PluginPackage, Uri } from "."; + +import { Tracer } from "@web3api/tracing-js"; + +export interface PluginRegistration { + uri: TUri; + plugin: PluginPackage; +} + +export const sanitizePluginRegistrations = Tracer.traceFunc( + "core: sanitizePluginRegistrations", + (input: PluginRegistration[]): PluginRegistration[] => { + const output: PluginRegistration[] = []; + for (const definition of input) { + const uri = new Uri(definition.uri); + + output.push({ + uri, + plugin: definition.plugin, + }); + } + + return output; + } +); \ No newline at end of file From c008cfccbe19c4dd254808e1f70831959d383f3a Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 9 Jun 2021 17:22:26 +0200 Subject: [PATCH 024/112] fixed exporting UriInterfaceImplementations type --- packages/js/core/src/types/Client.ts | 3 +-- packages/js/core/src/types/index.ts | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index 8f82acacae..3214bbfcd3 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -1,5 +1,4 @@ -import { Uri, UriRedirect, QueryHandler, InvokeHandler } from "./"; -import { UriInterfaceImplementations } from "./UriRedirect"; +import { Uri, UriRedirect, UriInterfaceImplementations, QueryHandler, InvokeHandler } from "./"; export interface Client extends QueryHandler, InvokeHandler { redirects: () => readonly UriRedirect[]; diff --git a/packages/js/core/src/types/index.ts b/packages/js/core/src/types/index.ts index a1b8371f88..a3f4a534f6 100644 --- a/packages/js/core/src/types/index.ts +++ b/packages/js/core/src/types/index.ts @@ -6,3 +6,4 @@ export * from "./Query"; export * from "./Invoke"; export * from "./Uri"; export * from "./UriRedirect"; +export * from "./UriInterfaceImplementations"; From d16eecc3fa266d45588c6d7739b69f383047e2b4 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 9 Jun 2021 17:29:59 +0200 Subject: [PATCH 025/112] lint fix --- packages/js/core/src/types/Client.ts | 8 +++++++- packages/js/core/src/types/UriRedirect.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index 3214bbfcd3..b06d382b27 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -1,4 +1,10 @@ -import { Uri, UriRedirect, UriInterfaceImplementations, QueryHandler, InvokeHandler } from "./"; +import { + Uri, + UriRedirect, + UriInterfaceImplementations, + QueryHandler, + InvokeHandler, +} from "./"; export interface Client extends QueryHandler, InvokeHandler { redirects: () => readonly UriRedirect[]; diff --git a/packages/js/core/src/types/UriRedirect.ts b/packages/js/core/src/types/UriRedirect.ts index 08e91527f0..31cf6faf4a 100644 --- a/packages/js/core/src/types/UriRedirect.ts +++ b/packages/js/core/src/types/UriRedirect.ts @@ -31,4 +31,4 @@ export const sanitizeUriRedirects = Tracer.traceFunc( return output; } -); \ No newline at end of file +); From 11d7ad6ced6984167b575e1b7a1c840f13c19f07 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 9 Jun 2021 17:33:07 +0200 Subject: [PATCH 026/112] merged with base --- packages/js/core/src/types/UriRedirect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/js/core/src/types/UriRedirect.ts b/packages/js/core/src/types/UriRedirect.ts index 31cf6faf4a..08e91527f0 100644 --- a/packages/js/core/src/types/UriRedirect.ts +++ b/packages/js/core/src/types/UriRedirect.ts @@ -31,4 +31,4 @@ export const sanitizeUriRedirects = Tracer.traceFunc( return output; } -); +); \ No newline at end of file From 6b596ea050a6c1f3d60c0415d05db3afa40dbcc2 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 9 Jun 2021 17:38:43 +0200 Subject: [PATCH 027/112] lint fix --- packages/js/core/src/types/UriRedirect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/js/core/src/types/UriRedirect.ts b/packages/js/core/src/types/UriRedirect.ts index 08e91527f0..31cf6faf4a 100644 --- a/packages/js/core/src/types/UriRedirect.ts +++ b/packages/js/core/src/types/UriRedirect.ts @@ -31,4 +31,4 @@ export const sanitizeUriRedirects = Tracer.traceFunc( return output; } -); \ No newline at end of file +); From 897aee7522fc01f5741ae7f752e16e6c4eb86e87 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 9 Jun 2021 18:09:50 +0200 Subject: [PATCH 028/112] removed bad code from merge --- packages/js/core/src/types/UriRedirect.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/js/core/src/types/UriRedirect.ts b/packages/js/core/src/types/UriRedirect.ts index 45823e31f2..31cf6faf4a 100644 --- a/packages/js/core/src/types/UriRedirect.ts +++ b/packages/js/core/src/types/UriRedirect.ts @@ -32,6 +32,3 @@ export const sanitizeUriRedirects = Tracer.traceFunc( return output; } ); - - input: UriInterfaceImplementations[] - ): UriInterfaceImplementations[] => { \ No newline at end of file From 69844a1e169f4bef14188ef95db3a3c16ae99e1d Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 9 Jun 2021 18:55:17 +0200 Subject: [PATCH 029/112] renaming interface implementations --- packages/js/client/src/Web3ApiClient.ts | 31 +++++++++++-------- .../src/__tests__/get-implementations.spec.ts | 6 ++-- .../js/core/src/__tests__/resolve-uri.spec.ts | 6 ++-- .../src/algorithms/get-implementations.ts | 6 ++-- .../js/core/src/algorithms/resolve-uri.ts | 2 +- packages/js/core/src/types/Client.ts | 4 +-- ...tations.ts => InterfaceImplementations.ts} | 12 +++---- packages/js/core/src/types/index.ts | 3 +- 8 files changed, 38 insertions(+), 32 deletions(-) rename packages/js/core/src/types/{UriInterfaceImplementations.ts => InterfaceImplementations.ts} (59%) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 51709816e0..7037dbb19e 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -13,23 +13,23 @@ import { QueryApiResult, Uri, UriRedirect, - UriInterfaceImplementations, + InterfaceImplementations, PluginRegistration, resolveUri, InvokeApiOptions, InvokeApiResult, Manifest, sanitizeUriRedirects, - sanitizeUriInterfaceImplementations, + sanitizeInterfaceImplementations, sanitizePluginRegistrations, - getAllImplementations, + getImplementations, } from "@web3api/core-js"; import { Tracer } from "@web3api/tracing-js"; export interface ClientConfig { redirects?: UriRedirect[]; plugins?: PluginRegistration[]; - interfaces?: UriInterfaceImplementations[]; + interfaces?: InterfaceImplementations[]; tracingEnabled?: boolean; } @@ -63,8 +63,8 @@ export class Web3ApiClient implements Client { plugins: config.plugins ? sanitizePluginRegistrations(config.plugins) : [], - implementations: config.implementations - ? sanitizeUriInterfaceImplementations(config.implementations) + interfaces: config.interfaces + ? sanitizeInterfaceImplementations(config.interfaces) : [], }; } @@ -103,7 +103,7 @@ export class Web3ApiClient implements Client { return this._config.plugins || []; } - public interfaces(): readonly UriInterfaceImplementations[] { + public interfaces(): readonly InterfaceImplementations[] { return this._config.interfaces || []; } @@ -241,11 +241,16 @@ export class Web3ApiClient implements Client { const run = Tracer.traceFunc( "Web3ApiClient: getImplementations", (uri: string): string[] => { - return getAllImplementations( - new Uri(uri), - this.redirects(), - this.interfaces() - ).map((x) => x.uri); + const interfaceImplementations = this.interfaces() + .find((x) => Uri.equals(x.interface, new Uri(uri))); + + if(!interfaceImplementations) { + throw Error(`Interface: ${uri} has no implementations registered`); + } + + return interfaceImplementations + .implementations + .map(x => x.uri); } ); @@ -256,7 +261,7 @@ export class Web3ApiClient implements Client { const run = Tracer.traceFunc( "Web3ApiClient: getImplementations", (uri: string): string[] => { - return getAllImplementations( + return getImplementations( new Uri(uri), this.redirects(), this.interfaces() diff --git a/packages/js/core/src/__tests__/get-implementations.spec.ts b/packages/js/core/src/__tests__/get-implementations.spec.ts index 78b400aa06..9b2ea8145c 100644 --- a/packages/js/core/src/__tests__/get-implementations.spec.ts +++ b/packages/js/core/src/__tests__/get-implementations.spec.ts @@ -4,7 +4,7 @@ import { UriRedirect, Plugin, } from "../"; -import { UriInterfaceImplementations } from "../types"; +import { InterfaceImplementations } from "../types"; describe("getImplementations", () => { it("works in the typical case", () => { @@ -33,7 +33,7 @@ describe("getImplementations", () => { }, ]; - const implementations: UriInterfaceImplementations[] = [ + const implementations: InterfaceImplementations[] = [ { interface: new Uri("authority/some-abstract-interface"), implementations: [ @@ -115,7 +115,7 @@ describe("getImplementations", () => { } ]; - const implementations: UriInterfaceImplementations[] = [ + const implementations: InterfaceImplementations[] = [ { interface: new Uri(interface1Uri), implementations: [ diff --git a/packages/js/core/src/__tests__/resolve-uri.spec.ts b/packages/js/core/src/__tests__/resolve-uri.spec.ts index 3b0e8443e3..82e3a0d99d 100644 --- a/packages/js/core/src/__tests__/resolve-uri.spec.ts +++ b/packages/js/core/src/__tests__/resolve-uri.spec.ts @@ -14,12 +14,12 @@ import { UriRedirect, resolveUri, } from "../"; -import { UriInterfaceImplementations } from "../types"; +import { InterfaceImplementations } from "../types"; describe("resolveUri", () => { const client = ( redirects: UriRedirect[], - implementations: UriInterfaceImplementations[], + implementations: InterfaceImplementations[], apis: Record, ): Client => ({ redirects: () => redirects, @@ -126,7 +126,7 @@ describe("resolveUri", () => { }, ] - const implementations: UriInterfaceImplementations[] = [ + const implementations: InterfaceImplementations[] = [ { interface: new Uri("w3/api-resolver"), implementations: [ diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 978334c9d3..2815ec6294 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -1,4 +1,4 @@ -import { Uri, UriRedirect, UriInterfaceImplementations } from "../types"; +import { Uri, UriRedirect, InterfaceImplementations } from "../types"; import { applyRedirects } from "./apply-redirects"; import { Tracer } from "@web3api/tracing-js"; @@ -8,7 +8,7 @@ export const getImplementations = Tracer.traceFunc( ( apiInterfaceUri: Uri, redirects: readonly UriRedirect[], - interfaceImplementationsList: readonly UriInterfaceImplementations[] + interfaceImplementationsList: readonly InterfaceImplementations[] ): Uri[] => { const result: Uri[] = []; @@ -39,7 +39,7 @@ export const getImplementations = Tracer.traceFunc( }; const addAllImplementationsFromImplementationsArray = ( - implementationsArray: readonly UriInterfaceImplementations[], + implementationsArray: readonly InterfaceImplementations[], apiInterfaceUri: Uri ) => { for (const interfaceImplementations of implementationsArray) { diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index ba7ec5bbdc..41ba55db38 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -33,7 +33,7 @@ export const resolveUri = Tracer.traceFunc( const uriResolverImplementations = getImplementations( new Uri("w3/api-resolver"), redirects, - client.implementations() + client.interfaces() ); return await resolveUriWithApiResolvers( diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index b06d382b27..ba86fd3470 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -1,12 +1,12 @@ import { Uri, UriRedirect, - UriInterfaceImplementations, + InterfaceImplementations, QueryHandler, InvokeHandler, } from "./"; export interface Client extends QueryHandler, InvokeHandler { redirects: () => readonly UriRedirect[]; - implementations: () => readonly UriInterfaceImplementations[]; + interfaces: () => readonly InterfaceImplementations[]; } diff --git a/packages/js/core/src/types/UriInterfaceImplementations.ts b/packages/js/core/src/types/InterfaceImplementations.ts similarity index 59% rename from packages/js/core/src/types/UriInterfaceImplementations.ts rename to packages/js/core/src/types/InterfaceImplementations.ts index 634f99ad2f..9b02aaddfd 100644 --- a/packages/js/core/src/types/UriInterfaceImplementations.ts +++ b/packages/js/core/src/types/InterfaceImplementations.ts @@ -2,17 +2,17 @@ import { Uri } from "."; import { Tracer } from "@web3api/tracing-js"; -export interface UriInterfaceImplementations { +export interface InterfaceImplementations { interface: TUri; implementations: TUri[]; } -export const sanitizeUriInterfaceImplementations = Tracer.traceFunc( - "core: sanitizeUriInterfaceImplementations", +export const sanitizeInterfaceImplementations = Tracer.traceFunc( + "core: sanitizeInterfaceImplementations", ( - input: UriInterfaceImplementations[] - ): UriInterfaceImplementations[] => { - const output: UriInterfaceImplementations[] = []; + input: InterfaceImplementations[] + ): InterfaceImplementations[] => { + const output: InterfaceImplementations[] = []; for (const definition of input) { const interfaceUri = new Uri(definition.interface); diff --git a/packages/js/core/src/types/index.ts b/packages/js/core/src/types/index.ts index a3f4a534f6..9f5fec5dac 100644 --- a/packages/js/core/src/types/index.ts +++ b/packages/js/core/src/types/index.ts @@ -6,4 +6,5 @@ export * from "./Query"; export * from "./Invoke"; export * from "./Uri"; export * from "./UriRedirect"; -export * from "./UriInterfaceImplementations"; +export * from "./InterfaceImplementations"; +export * from "./PluginRegistration"; From 934d1ba1716c3c1553b7be8282734ba93840e0a2 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 9 Jun 2021 18:57:53 +0200 Subject: [PATCH 030/112] lint fix --- packages/js/client/src/Web3ApiClient.ts | 11 +++++------ packages/js/core/src/types/PluginRegistration.ts | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 7037dbb19e..9af81b65e0 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -241,16 +241,15 @@ export class Web3ApiClient implements Client { const run = Tracer.traceFunc( "Web3ApiClient: getImplementations", (uri: string): string[] => { - const interfaceImplementations = this.interfaces() - .find((x) => Uri.equals(x.interface, new Uri(uri))); + const interfaceImplementations = this.interfaces().find((x) => + Uri.equals(x.interface, new Uri(uri)) + ); - if(!interfaceImplementations) { + if (!interfaceImplementations) { throw Error(`Interface: ${uri} has no implementations registered`); } - return interfaceImplementations - .implementations - .map(x => x.uri); + return interfaceImplementations.implementations.map((x) => x.uri); } ); diff --git a/packages/js/core/src/types/PluginRegistration.ts b/packages/js/core/src/types/PluginRegistration.ts index e9c161c226..c9888ff881 100644 --- a/packages/js/core/src/types/PluginRegistration.ts +++ b/packages/js/core/src/types/PluginRegistration.ts @@ -22,4 +22,4 @@ export const sanitizePluginRegistrations = Tracer.traceFunc( return output; } -); \ No newline at end of file +); From f5aed45dc1bbeedf9b42768d202bdff3727d5e8d Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 10 Jun 2021 00:04:49 +0200 Subject: [PATCH 031/112] implemented plugins registration change throught the monorepo --- packages/cli/src/commands/query.ts | 18 ++-- packages/cli/src/lib/SchemaComposer.ts | 24 ++--- packages/js/client/src/Web3ApiClient.ts | 38 ++++---- .../src/__tests__/Web3ApiClient.spec.ts | 19 ++-- packages/js/client/src/createWeb3ApiClient.ts | 24 ++--- ...lt-redirects.ts => get-default-plugins.ts} | 24 ++--- .../src/__tests__/get-implementations.spec.ts | 85 +++--------------- .../js/core/src/__tests__/resolve-uri.spec.ts | 48 +++++----- .../src/algorithms/find-plugin-package.ts | 10 +-- .../src/algorithms/get-implementations.ts | 21 ++--- .../js/core/src/algorithms/resolve-uri.ts | 3 +- packages/js/core/src/types/Client.ts | 2 + packages/js/core/src/types/UriRedirect.ts | 9 +- .../http/src/__tests__/e2e/e2e.spec.ts | 89 +++---------------- .../src/__tests__/dapp/SimpleStorage.tsx | 14 +-- .../react/src/__tests__/integration.spec.tsx | 15 ++-- .../src/__tests__/useWeb3ApiClient.spec.tsx | 14 +-- .../src/__tests__/useWeb3ApiQuery.spec.tsx | 10 +-- packages/js/react/src/provider.tsx | 4 +- packages/js/test-env/src/index.ts | 25 +++--- 20 files changed, 183 insertions(+), 313 deletions(-) rename packages/js/client/src/{default-redirects.ts => get-default-plugins.ts} (55%) diff --git a/packages/cli/src/commands/query.ts b/packages/cli/src/commands/query.ts index 5f6cde7cd8..4b5b5bcd4d 100644 --- a/packages/cli/src/commands/query.ts +++ b/packages/cli/src/commands/query.ts @@ -6,7 +6,7 @@ import chalk from "chalk"; import { GluegunToolbox } from "gluegun"; import gql from "graphql-tag"; import path from "path"; -import { UriRedirect, Web3ApiClient } from "@web3api/client-js"; +import { PluginRegistration, Web3ApiClient } from "@web3api/client-js"; import { ensPlugin } from "@web3api/ens-plugin-js"; import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; @@ -79,10 +79,10 @@ export default { // TODO: move this into its own package, since it's being used everywhere? // maybe have it exported from test-env. - const redirects: UriRedirect[] = [ + const plugins: PluginRegistration[] = [ { - from: "w3://ens/ethereum.web3api.eth", - to: ethereumPlugin({ + uri: "w3://ens/ethereum.web3api.eth", + plugin: ethereumPlugin({ networks: { testnet: { provider: ethereumProvider, @@ -95,15 +95,15 @@ export default { }), }, { - from: "w3://ens/ipfs.web3api.eth", - to: ipfsPlugin({ + uri: "w3://ens/ipfs.web3api.eth", + plugin: ipfsPlugin({ provider: ipfsProvider, fallbackProviders: ["https://ipfs.io"], }), }, { - from: "w3://ens/ens.web3api.eth", - to: ensPlugin({ + uri: "w3://ens/ens.web3api.eth", + plugin: ensPlugin({ addresses: { testnet: ensAddress, }, @@ -111,7 +111,7 @@ export default { }, ]; - const client = new Web3ApiClient({ redirects }); + const client = new Web3ApiClient({ plugins }); const recipe = JSON.parse(filesystem.read(recipePath) as string); const dir = path.dirname(recipePath); diff --git a/packages/cli/src/lib/SchemaComposer.ts b/packages/cli/src/lib/SchemaComposer.ts index 507a4ce73d..8f39b42d75 100644 --- a/packages/cli/src/lib/SchemaComposer.ts +++ b/packages/cli/src/lib/SchemaComposer.ts @@ -3,7 +3,7 @@ import { Project } from "./Project"; -import { Manifest, Uri, Web3ApiClient, UriRedirect } from "@web3api/client-js"; +import { Manifest, Uri, Web3ApiClient, PluginRegistration } from "@web3api/client-js"; import { composeSchema, ComposerOutput, @@ -33,12 +33,12 @@ export class SchemaComposer { constructor(private _config: SchemaConfig) { const { ensAddress, ethProvider, ipfsProvider } = this._config; - const redirects: UriRedirect[] = []; + const plugins: PluginRegistration[] = []; if (ensAddress) { - redirects.push({ - from: "w3://ens/ens.web3api.eth", - to: ensPlugin({ + plugins.push({ + uri: "w3://ens/ens.web3api.eth", + plugin: ensPlugin({ addresses: { testnet: ensAddress, }, @@ -47,9 +47,9 @@ export class SchemaComposer { } if (ethProvider) { - redirects.push({ - from: "w3://ens/ethereum.web3api.eth", - to: ethereumPlugin({ + plugins.push({ + uri: "w3://ens/ethereum.web3api.eth", + plugin: ethereumPlugin({ networks: { testnet: { provider: ethProvider, @@ -60,16 +60,16 @@ export class SchemaComposer { } if (ipfsProvider) { - redirects.push({ - from: "w3://ens/ipfs.web3api.eth", - to: ipfsPlugin({ + plugins.push({ + uri: "w3://ens/ipfs.web3api.eth", + plugin: ipfsPlugin({ provider: ipfsProvider, fallbackProviders: ["https://ipfs.io"], }), }); } - this._client = new Web3ApiClient({ redirects }); + this._client = new Web3ApiClient({ plugins }); } public async getComposedSchemas( diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 9af81b65e0..39d77d772d 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -1,4 +1,4 @@ -import { getDefaultRedirects } from "./default-redirects"; +import { getDefaultPlugins } from "./get-default-plugins"; import { PluginWeb3Api } from "./plugin/PluginWeb3Api"; import { WasmWeb3Api } from "./wasm/WasmWeb3Api"; @@ -39,24 +39,21 @@ export class Web3ApiClient implements Client { // and handle cases where the are multiple jumps. For exmaple, if // A => B => C, then the cache should have A => C, and B => C. private _apiCache: ApiCache = new Map(); - private _config: ClientConfig = {}; + private _config: Required> = { + redirects: [], + plugins: [], + interfaces: [], + tracingEnabled: false, + }; constructor(config?: ClientConfig) { try { - if (!config) { - this._config = { - redirects: [], - tracingEnabled: false, - }; - } - this.tracingEnabled(!!config?.tracingEnabled); Tracer.startSpan("Web3ApiClient: constructor"); if (config) { this._config = { - ...config, redirects: config.redirects ? sanitizeUriRedirects(config.redirects) : [], @@ -66,15 +63,14 @@ export class Web3ApiClient implements Client { interfaces: config.interfaces ? sanitizeInterfaceImplementations(config.interfaces) : [], + tracingEnabled: !!config.tracingEnabled }; } - if (!this._config.redirects) { - this._config.redirects = []; - } + // Add all default plugins + this._config.plugins.push(...getDefaultPlugins()); - // Add all default redirects - this._config.redirects.push(...getDefaultRedirects()); + this.requirePluginsToUseNonInterfaceUris(); Tracer.setAttribute("config", this._config); } catch (error) { @@ -85,6 +81,17 @@ export class Web3ApiClient implements Client { } } + private requirePluginsToUseNonInterfaceUris(): void { + const pluginUris = this.plugins().map(x => x.uri.uri); + const interfaceUris = this.interfaces().map(x => x.interface.uri); + + const pluginsWithInterfaceUris = pluginUris.filter(plugin => interfaceUris.includes(plugin)); + + if(pluginsWithInterfaceUris.length) { + throw Error(`Plugins can't use interfaces for their URI. Invalid plugins: ${pluginsWithInterfaceUris}`); + } + } + public tracingEnabled(enable: boolean): void { if (enable) { Tracer.enableTracing("Web3ApiClient"); @@ -263,6 +270,7 @@ export class Web3ApiClient implements Client { return getImplementations( new Uri(uri), this.redirects(), + this.plugins(), this.interfaces() ).map((x) => x.uri); } diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 1845356e75..78fe7a8475 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -926,10 +926,12 @@ describe("Web3ApiClient", () => { { from: implementation2Uri, to: implementation3Uri - }, + } + ], + plugins: [ { - from: implementation4Uri, - to: { + uri: implementation4Uri, + plugin: { factory: () => ({} as Plugin), manifest: { schema: "", @@ -939,7 +941,7 @@ describe("Web3ApiClient", () => { } } ], - implementations: [ + interfaces: [ { interface: interface1Uri, implementations: [ @@ -963,25 +965,22 @@ describe("Web3ApiClient", () => { ] }); - const implementations1 = client.getImplementations(interface1Uri); - const implementations2 = client.getImplementations(interface2Uri); - const implementations3 = client.getImplementations(interface3Uri); + const implementations1 = client.getAllImplementations(interface1Uri); + const implementations2 = client.getAllImplementations(interface2Uri); + const implementations3 = client.getAllImplementations(interface3Uri); - expect(implementations1).toBeTruthy(); expect(implementations1).toEqual([ implementation1Uri, implementation2Uri, implementation3Uri ]); - expect(implementations2).toBeTruthy(); expect(implementations2).toEqual([ implementation1Uri, implementation2Uri, implementation3Uri ]); - expect(implementations3).toBeTruthy(); expect(implementations3).toEqual([ implementation3Uri, implementation4Uri diff --git a/packages/js/client/src/createWeb3ApiClient.ts b/packages/js/client/src/createWeb3ApiClient.ts index 2981aa8f88..72321d80af 100644 --- a/packages/js/client/src/createWeb3ApiClient.ts +++ b/packages/js/client/src/createWeb3ApiClient.ts @@ -4,7 +4,7 @@ import { Web3ApiClient, ClientConfig } from "./Web3ApiClient"; import { PluginConfigs, modules, uris } from "./pluginConfigs"; -import { UriRedirect } from "@web3api/core-js"; +import { PluginRegistration } from "@web3api/core-js"; import { Tracer } from "@web3api/tracing-js"; export { PluginConfigs }; @@ -12,12 +12,12 @@ export { PluginConfigs }; export const createWeb3ApiClient = Tracer.traceFunc( "createWeb3ApiClient", async ( - plugins: PluginConfigs, + pluginConfigs: PluginConfigs, config?: ClientConfig ): Promise => { - const redirects: UriRedirect[] = []; + const plugins: PluginRegistration[] = []; - for (const plugin of Object.keys(plugins)) { + for (const plugin of Object.keys(pluginConfigs)) { let pluginModule: any; if (!modules[plugin]) { @@ -50,7 +50,7 @@ export const createWeb3ApiClient = Tracer.traceFunc( } const pluginPackage = pluginFactory( - (plugins as Record)[plugin] + (pluginConfigs as Record)[plugin] ); if ( @@ -64,22 +64,22 @@ export const createWeb3ApiClient = Tracer.traceFunc( ); } - redirects.push({ - from: uris[plugin], - to: pluginPackage, + plugins.push({ + uri: uris[plugin], + plugin: pluginPackage, }); } if (config) { return new Web3ApiClient({ ...config, - redirects: [ - ...redirects, - ...(config.redirects ? config.redirects : []), + plugins: [ + ...plugins, + ...(config.plugins ? config.plugins : []), ], }); } else { - return new Web3ApiClient({ redirects }); + return new Web3ApiClient({ plugins }); } } ); diff --git a/packages/js/client/src/default-redirects.ts b/packages/js/client/src/get-default-plugins.ts similarity index 55% rename from packages/js/client/src/default-redirects.ts rename to packages/js/client/src/get-default-plugins.ts index 8e317685e3..ee5b7f71d7 100644 --- a/packages/js/client/src/default-redirects.ts +++ b/packages/js/client/src/get-default-plugins.ts @@ -1,27 +1,27 @@ -import { Uri, UriRedirect } from "@web3api/core-js"; +import { PluginRegistration, Uri } from "@web3api/core-js"; import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; import { ensPlugin } from "@web3api/ens-plugin-js"; import { loggerPlugin } from "@web3api/logger-plugin-js"; import { Tracer } from "@web3api/tracing-js"; -export const getDefaultRedirects = Tracer.traceFunc( - "client-js: getDefaultRedirects", - (): UriRedirect[] => { +export const getDefaultPlugins = Tracer.traceFunc( + "client-js: getDefaultPlugins", + (): PluginRegistration[] => { return [ // IPFS is required for downloading Web3API packages { - from: new Uri("w3://ens/ipfs.web3api.eth"), - to: ipfsPlugin({ provider: "https://ipfs.io" }), + uri: new Uri("w3://ens/ipfs.web3api.eth"), + plugin: ipfsPlugin({ provider: "https://ipfs.io" }), }, // ENS is required for resolving domain to IPFS hashes { - from: new Uri("w3://ens/ens.web3api.eth"), - to: ensPlugin({}), + uri: new Uri("w3://ens/ens.web3api.eth"), + plugin: ensPlugin({}), }, { - from: new Uri("w3://ens/ethereum.web3api.eth"), - to: ethereumPlugin({ + uri: new Uri("w3://ens/ethereum.web3api.eth"), + plugin: ethereumPlugin({ networks: { mainnet: { provider: @@ -31,8 +31,8 @@ export const getDefaultRedirects = Tracer.traceFunc( }), }, { - from: new Uri("w3://w3/logger"), - to: loggerPlugin(), + uri: new Uri("w3://w3/logger"), + plugin: loggerPlugin(), }, ]; } diff --git a/packages/js/core/src/__tests__/get-implementations.spec.ts b/packages/js/core/src/__tests__/get-implementations.spec.ts index 9b2ea8145c..85ba094a26 100644 --- a/packages/js/core/src/__tests__/get-implementations.spec.ts +++ b/packages/js/core/src/__tests__/get-implementations.spec.ts @@ -4,77 +4,9 @@ import { UriRedirect, Plugin, } from "../"; -import { InterfaceImplementations } from "../types"; +import { InterfaceImplementations, PluginRegistration } from "../types"; describe("getImplementations", () => { - it("works in the typical case", () => { - const pluginImplementations: UriRedirect[] = [ - { - from: new Uri("authority/some-abstract-interface"), - to: { - factory: () => ({} as Plugin), - manifest: { - schema: "", - implemented: [new Uri("authority/some-abstract-interface")], - imported: [], - }, - }, - }, - { - from: new Uri("something/else"), - to: { - factory: () => ({} as Plugin), - manifest: { - schema: "", - implemented: [new Uri("authority/some-abstract-interface")], - imported: [new Uri("something/else-2")], - }, - }, - }, - ]; - - const implementations: InterfaceImplementations[] = [ - { - interface: new Uri("authority/some-abstract-interface"), - implementations: [ - new Uri("one/1") - ], - } - ]; - - const otherRedirects: UriRedirect[] = [ - { - from: new Uri("some-other/other"), - to: new Uri("other/other"), - }, - { - from: new Uri("some-other/other1"), - to: { - factory: () => ({} as Plugin), - manifest: { - schema: "", - implemented: [], - imported: [], - }, - }, - }, - ]; - - const result = getImplementations( - new Uri("authority/some-abstract-interface"), - [...pluginImplementations, ...otherRedirects], - implementations - ); - - const values = pluginImplementations.map((item) => - Uri.isUri(item.to) ? item.to : item.from - ).concat( - implementations.map(x => x.implementations) - .reduce((s,x) =>s.concat(x), []) - ); - - expect(result).toMatchObject(values); - }); it("works with complex redirects", () => { const interface1Uri = "w3://ens/some-interface1.eth"; @@ -101,10 +33,10 @@ describe("getImplementations", () => { } ]; - const pluginImplementations: UriRedirect[] = [ + const plugins: PluginRegistration[] = [ { - from: new Uri(implementation4Uri), - to: { + uri: new Uri(implementation4Uri), + plugin: { factory: () => ({} as Plugin), manifest: { schema: '', @@ -140,17 +72,20 @@ describe("getImplementations", () => { const getImplementationsResult1 = getImplementations( new Uri(interface1Uri), - [...pluginImplementations, ...redirects], + redirects, + plugins, implementations ); const getImplementationsResult2 = getImplementations( new Uri(interface2Uri), - [...pluginImplementations, ...redirects], + redirects, + plugins, implementations ); const getImplementationsResult3 = getImplementations( new Uri(interface3Uri), - [...pluginImplementations, ...redirects], + redirects, + plugins, implementations ); diff --git a/packages/js/core/src/__tests__/resolve-uri.spec.ts b/packages/js/core/src/__tests__/resolve-uri.spec.ts index 82e3a0d99d..da7fedfce8 100644 --- a/packages/js/core/src/__tests__/resolve-uri.spec.ts +++ b/packages/js/core/src/__tests__/resolve-uri.spec.ts @@ -14,16 +14,18 @@ import { UriRedirect, resolveUri, } from "../"; -import { InterfaceImplementations } from "../types"; +import { InterfaceImplementations, PluginRegistration } from "../types"; describe("resolveUri", () => { const client = ( redirects: UriRedirect[], - implementations: InterfaceImplementations[], + plugins: PluginRegistration[], + interfaceImplementationsList: InterfaceImplementations[], apis: Record, ): Client => ({ redirects: () => redirects, - implementations: () => implementations, + plugins: () => plugins, + interfaces: () => interfaceImplementationsList, query: < TData extends Record = Record, TVariables extends Record = Record, @@ -112,10 +114,10 @@ describe("resolveUri", () => { }, }; - const redirects: UriRedirect[] = [ + const plugins: PluginRegistration[] = [ { - from: new Uri("ens/my-plugin"), - to: { + uri: new Uri("ens/my-plugin"), + plugin: { factory: () => ({} as Plugin), manifest: { schema: "", @@ -126,7 +128,7 @@ describe("resolveUri", () => { }, ] - const implementations: InterfaceImplementations[] = [ + const interfaces: InterfaceImplementations[] = [ { interface: new Uri("w3/api-resolver"), implementations: [ @@ -149,14 +151,14 @@ describe("resolveUri", () => { const query = ApiResolver.Query; const uri = new Uri("w3/some-uri"); - expect(query.tryResolveUri(client(redirects, implementations, apis), api, uri)).toBeDefined(); - expect(query.getFile(client(redirects, implementations, apis), file, path)).toBeDefined(); + expect(query.tryResolveUri(client([], plugins, interfaces, apis), api, uri)).toBeDefined(); + expect(query.getFile(client([], plugins, interfaces, apis), file, path)).toBeDefined(); }); it("works in the typical case", async () => { const result = await resolveUri( new Uri("ens/test.eth"), - client(redirects, implementations, apis), + client([], plugins, interfaces, apis), createPluginApi, createApi, true @@ -179,7 +181,7 @@ describe("resolveUri", () => { it("uses a plugin that implements api-resolver", async () => { const result = await resolveUri( new Uri("my/something-different"), - client(redirects, implementations, apis), + client([], plugins, interfaces, apis), createPluginApi, createApi, true @@ -202,7 +204,7 @@ describe("resolveUri", () => { it("works when direct query a Web3API that implements the api-resolver", async () => { const result = await resolveUri( new Uri("ens/ens"), - client(redirects, implementations, apis), + client([], plugins, interfaces, apis), createPluginApi, createApi, true @@ -226,7 +228,7 @@ describe("resolveUri", () => { it("works when direct query a plugin Web3API that implements the api-resolver", async () => { const result = await resolveUri( new Uri("my/something-different"), - client(redirects, implementations, apis), + client([], plugins, interfaces, apis), createPluginApi, createApi, true @@ -248,7 +250,6 @@ describe("resolveUri", () => { it("throws when circular redirect loops are found", async () => { const circular: UriRedirect[] = [ - ...redirects, { from: new Uri("some/api"), to: new Uri("ens/api"), @@ -263,7 +264,7 @@ describe("resolveUri", () => { return resolveUri( new Uri("some/api"), - client(circular, implementations, apis), + client(circular, plugins, interfaces, apis), createPluginApi, createApi, true @@ -274,7 +275,6 @@ describe("resolveUri", () => { it("throws when redirect missing the from property", async () => { const missingFromProperty: UriRedirect[] = [ - ...redirects, { from: new Uri("some/api"), to: new Uri("ens/api"), @@ -289,7 +289,7 @@ describe("resolveUri", () => { return resolveUri( new Uri("some/api"), - client(missingFromProperty, implementations, apis), + client(missingFromProperty, plugins, interfaces, apis), createPluginApi, createApi, true @@ -298,12 +298,12 @@ describe("resolveUri", () => { ); }); - it("works when a Web3API redirects to a Plugin", async () => { - const uriToPlugin: UriRedirect[] = [ - ...redirects, + it("works when a Web3API registers a Plugin", async () => { + const pluginRegistrations: PluginRegistration[] = [ + ...plugins, { - from: new Uri("some/api"), - to: { + uri: new Uri("some/api"), + plugin: { factory: () => ({} as Plugin), manifest: { schema: "", @@ -316,7 +316,7 @@ describe("resolveUri", () => { const result = await resolveUri( new Uri("some/api"), - client(uriToPlugin, implementations, apis), + client([], pluginRegistrations, interfaces, apis), createPluginApi, createApi, true @@ -351,7 +351,7 @@ describe("resolveUri", () => { await resolveUri( uri, - client(redirects, implementations, { + client([], plugins, interfaces, { ...apis, "w3://ens/ipfs": faultyIpfsApi }), diff --git a/packages/js/core/src/algorithms/find-plugin-package.ts b/packages/js/core/src/algorithms/find-plugin-package.ts index ca1df2e8a5..ecd52be4ec 100644 --- a/packages/js/core/src/algorithms/find-plugin-package.ts +++ b/packages/js/core/src/algorithms/find-plugin-package.ts @@ -1,4 +1,4 @@ -import { Uri, PluginPackage, UriRedirect } from "../types"; +import { Uri, PluginPackage, PluginRegistration } from "../types"; import { Tracer } from "@web3api/tracing-js"; @@ -6,12 +6,12 @@ export const findPluginPackage = Tracer.traceFunc( "core: findPluginPackage", ( uri: Uri, - redirects: readonly UriRedirect[] + plugins: readonly PluginRegistration[] ): PluginPackage | undefined => { - const pluginRedirect = redirects.find( - (redirect) => Uri.equals(redirect.from, uri) && !Uri.isUri(redirect.to) + const pluginRedirect = plugins.find( + (x) => Uri.equals(x.uri, uri) ); - return pluginRedirect?.to as PluginPackage | undefined; + return pluginRedirect?.plugin as PluginPackage | undefined; } ); diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 2815ec6294..232f75a0b8 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -1,4 +1,4 @@ -import { Uri, UriRedirect, InterfaceImplementations } from "../types"; +import { Uri, UriRedirect, InterfaceImplementations, PluginRegistration } from "../types"; import { applyRedirects } from "./apply-redirects"; import { Tracer } from "@web3api/tracing-js"; @@ -8,6 +8,7 @@ export const getImplementations = Tracer.traceFunc( ( apiInterfaceUri: Uri, redirects: readonly UriRedirect[], + plugins: readonly PluginRegistration[], interfaceImplementationsList: readonly InterfaceImplementations[] ): Uri[] => { const result: Uri[] = []; @@ -20,20 +21,15 @@ export const getImplementations = Tracer.traceFunc( }; const addAllImplementationsFromPluginRedirects = ( - redirects: readonly UriRedirect[], apiInterfaceUri: Uri ) => { - for (const redirect of redirects) { - // Plugin implemented check - if (!Uri.isUri(redirect.to)) { - const { implemented } = redirect.to.manifest; - const implementedApi = - implemented.findIndex((uri) => Uri.equals(uri, apiInterfaceUri)) > - -1; + for (const pluginRegistration of plugins) { + const { implemented } = pluginRegistration.plugin.manifest; + const implementedApi = + implemented.findIndex((uri) => Uri.equals(uri, apiInterfaceUri)) > -1; - if (implementedApi) { - addUniqueResult(redirect.from); - } + if (implementedApi) { + addUniqueResult(pluginRegistration.uri); } } }; @@ -62,7 +58,6 @@ export const getImplementations = Tracer.traceFunc( ); addAllImplementationsFromPluginRedirects( - redirects, finalRedirectedApiInterface ); addAllImplementationsFromImplementationsArray( diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 41ba55db38..b0b904ad9d 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -20,7 +20,7 @@ export const resolveUri = Tracer.traceFunc( const finalRedirectedUri = applyRedirects(uri, redirects); - const plugin = findPluginPackage(finalRedirectedUri, redirects); + const plugin = findPluginPackage(finalRedirectedUri, client.plugins()); if (plugin) { return Tracer.traceFunc( @@ -33,6 +33,7 @@ export const resolveUri = Tracer.traceFunc( const uriResolverImplementations = getImplementations( new Uri("w3/api-resolver"), redirects, + client.plugins(), client.interfaces() ); diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index ba86fd3470..418672a58d 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -5,8 +5,10 @@ import { QueryHandler, InvokeHandler, } from "./"; +import { PluginRegistration } from "./PluginRegistration"; export interface Client extends QueryHandler, InvokeHandler { redirects: () => readonly UriRedirect[]; + plugins: () => readonly PluginRegistration[]; interfaces: () => readonly InterfaceImplementations[]; } diff --git a/packages/js/core/src/types/UriRedirect.ts b/packages/js/core/src/types/UriRedirect.ts index 31cf6faf4a..013aee6796 100644 --- a/packages/js/core/src/types/UriRedirect.ts +++ b/packages/js/core/src/types/UriRedirect.ts @@ -1,15 +1,10 @@ -import { PluginPackage, Uri } from "."; +import { Uri } from "."; import { Tracer } from "@web3api/tracing-js"; export interface UriRedirect { - /** Redirect from this URI */ from: TUri; - - /** The destination URI, or plugin, that will now handle the invocation. */ - // TODO: currently UriRedirects are used for: plugins, implementations, and redirects. This is either elegant, or confusing... - // Should look at what it looks like to seperate these. - to: TUri | PluginPackage; + to: TUri; } export const sanitizeUriRedirects = Tracer.traceFunc( diff --git a/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts b/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts index 557c5ed868..8d66ddab36 100644 --- a/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts +++ b/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts @@ -9,6 +9,18 @@ const defaultReplyHeaders = { } describe("e2e tests for HttpPlugin", () => { + let web3ApiClient: Web3ApiClient; + + beforeEach(() => { + web3ApiClient = new Web3ApiClient({ + plugins: [ + { + uri: "w3://ens/http.web3api.eth", + plugin: httpPlugin(), + }, + ] + }); + }); describe("get method", () => { @@ -18,15 +30,6 @@ describe("e2e tests for HttpPlugin", () => { .get("/api") .reply(200, '{data: "test-response"}') - const web3ApiClient = new Web3ApiClient({ - redirects: [ - { - from: "w3://ens/http.web3api.eth", - to: httpPlugin(), - }, - ] - }) - const response = await web3ApiClient.query<{ get: Response }>({ uri: "w3://ens/http.web3api.eth", query: ` @@ -55,16 +58,6 @@ describe("e2e tests for HttpPlugin", () => { .get("/api") .reply(200, '{data: "test-response"}') - - const web3ApiClient = new Web3ApiClient({ - redirects: [ - { - from: "w3://ens/http.web3api.eth", - to: httpPlugin(), - }, - ] - }) - const response = await web3ApiClient.query<{ get: Response }>({ uri: "w3://ens/http.web3api.eth", query: ` @@ -94,15 +87,6 @@ describe("e2e tests for HttpPlugin", () => { .query({ query: "foo" }) .reply(200, '{data: "test-response"}', { 'X-Response-Header': "resp-foo" }) - const web3ApiClient = new Web3ApiClient({ - redirects: [ - { - from: "w3://ens/http.web3api.eth", - to: httpPlugin(), - }, - ] - }) - const response = await web3ApiClient.query<{ get: Response }>({ uri: "w3://ens/http.web3api.eth", query: ` @@ -137,16 +121,6 @@ describe("e2e tests for HttpPlugin", () => { .get("/api") .reply(404) - - const web3ApiClient = new Web3ApiClient({ - redirects: [ - { - from: "w3://ens/http.web3api.eth", - to: httpPlugin(), - }, - ] - }) - const response = await web3ApiClient.query<{ get: Response }>({ uri: "w3://ens/http.web3api.eth", query: ` @@ -175,16 +149,6 @@ describe("e2e tests for HttpPlugin", () => { .post("/api", "{data: 'test-request'}") .reply(200, '{data: "test-response"}') - - const web3ApiClient = new Web3ApiClient({ - redirects: [ - { - from: "w3://ens/http.web3api.eth", - to: httpPlugin(), - }, - ] - }) - const response = await web3ApiClient.query<{ post: Response }>({ uri: "w3://ens/http.web3api.eth", query: ` @@ -214,16 +178,6 @@ describe("e2e tests for HttpPlugin", () => { .post("/api", "{data: 'test-request'}") .reply(200, '{data: "test-response"}') - - const web3ApiClient = new Web3ApiClient({ - redirects: [ - { - from: "w3://ens/http.web3api.eth", - to: httpPlugin(), - }, - ] - }) - const response = await web3ApiClient.query<{ post: Response }>({ uri: "w3://ens/http.web3api.eth", query: ` @@ -254,15 +208,6 @@ describe("e2e tests for HttpPlugin", () => { .query({ query: "foo" }) .reply(200, '{data: "test-response"}', { 'X-Response-Header': "resp-foo" }) - const web3ApiClient = new Web3ApiClient({ - redirects: [ - { - from: "w3://ens/http.web3api.eth", - to: httpPlugin(), - }, - ] - }) - const response = await web3ApiClient.query<{ post: Response }>({ uri: "w3://ens/http.web3api.eth", query: ` @@ -298,16 +243,6 @@ describe("e2e tests for HttpPlugin", () => { .post("/api") .reply(404) - - const web3ApiClient = new Web3ApiClient({ - redirects: [ - { - from: "w3://ens/http.web3api.eth", - to: httpPlugin(), - }, - ] - }) - const response = await web3ApiClient.query<{ get: Response }>({ uri: "w3://ens/http.web3api.eth", query: ` diff --git a/packages/js/react/src/__tests__/dapp/SimpleStorage.tsx b/packages/js/react/src/__tests__/dapp/SimpleStorage.tsx index 70191d65a1..66e5cf9d54 100644 --- a/packages/js/react/src/__tests__/dapp/SimpleStorage.tsx +++ b/packages/js/react/src/__tests__/dapp/SimpleStorage.tsx @@ -1,5 +1,5 @@ import { useWeb3ApiQuery, Web3ApiProvider, useWeb3ApiClient, createWeb3ApiProvider } from "@web3api/react"; -import { UriRedirect } from "@web3api/client-js"; +import { PluginRegistration } from "@web3api/client-js"; import React from "react"; const SimpleStorage = ({ uri }: { uri: string }) => { @@ -65,9 +65,9 @@ const SimpleStorage = ({ uri }: { uri: string }) => {
{currentStorage?.getData}
{ - client1.redirects().length > client2.redirects().length - ? 'Provider Redirects are correct' - : 'Provider Redirects are not correct' + client1.plugins().length > client2.plugins().length + ? 'Provider plugin counts are correct' + : 'Provider plugin counts are not correct' }
@@ -79,14 +79,14 @@ const SimpleStorage = ({ uri }: { uri: string }) => { const CustomProvider = createWeb3ApiProvider("custom"); export const SimpleStorageContainer = ({ - redirects, + plugins, ensUri, }: { - redirects: UriRedirect[]; + plugins: PluginRegistration[]; ensUri: string; }) => ( - + diff --git a/packages/js/react/src/__tests__/integration.spec.tsx b/packages/js/react/src/__tests__/integration.spec.tsx index 5de7d241db..105491bb89 100644 --- a/packages/js/react/src/__tests__/integration.spec.tsx +++ b/packages/js/react/src/__tests__/integration.spec.tsx @@ -3,20 +3,18 @@ import { SimpleStorageContainer } from "./dapp/SimpleStorage"; import React from "react"; import { render, fireEvent, screen, waitFor } from "@testing-library/react"; -import { - UriRedirect -} from "@web3api/client-js"; import { initTestEnvironment, stopTestEnvironment, buildAndDeployApi } from "@web3api/test-env-js"; import { GetPathToTestApis } from "@web3api/test-cases"; +import { PluginRegistration } from "@web3api/core-js"; jest.setTimeout(60000); describe("Web3API React Integration", () => { - let redirects: UriRedirect[]; + let plugins: PluginRegistration[]; let ensUri: string; let api: { ensDomain: string; @@ -27,10 +25,11 @@ describe("Web3API React Integration", () => { const { ipfs, ensAddress, - redirects: testRedirects, + plugins: defaultPlugins, } = await initTestEnvironment(); - redirects = testRedirects; + plugins = defaultPlugins; + api = await buildAndDeployApi( `${GetPathToTestApis()}/simple-storage`, ipfs, @@ -44,7 +43,7 @@ describe("Web3API React Integration", () => { }); it("Deploys, read and write on Smart Contract ", async () => { - render(); + render(); fireEvent.click(screen.getByText("Deploy")); await waitFor(() => screen.getByText(/0x/)); @@ -61,7 +60,7 @@ describe("Web3API React Integration", () => { expect(screen.getByText("5")).toBeTruthy(); // check for provider redirects - expect(screen.getByText("Provider Redirects are correct")).toBeTruthy(); + expect(screen.getByText("Provider plugin counts are correct")).toBeTruthy(); }); it("Should throw error because two providers with same key has been rendered ", () => { diff --git a/packages/js/react/src/__tests__/useWeb3ApiClient.spec.tsx b/packages/js/react/src/__tests__/useWeb3ApiClient.spec.tsx index e77400d78a..7e28837e2e 100644 --- a/packages/js/react/src/__tests__/useWeb3ApiClient.spec.tsx +++ b/packages/js/react/src/__tests__/useWeb3ApiClient.spec.tsx @@ -9,7 +9,7 @@ import { RenderHookOptions, cleanup } from "@testing-library/react-hooks"; -import { UriRedirect } from "@web3api/core-js"; +import { PluginRegistration } from "@web3api/core-js"; import { initTestEnvironment, stopTestEnvironment @@ -19,19 +19,19 @@ import { UseWeb3ApiClientProps } from '../client'; jest.setTimeout(60000); describe("useWeb3ApiClient hook", () => { - let redirects: UriRedirect[]; + let plugins: PluginRegistration[]; let WrapperProvider: RenderHookOptions; beforeAll(async () => { const { - redirects: testRedirects, + plugins: testPlugins, } = await initTestEnvironment(); - redirects = testRedirects; + plugins = testPlugins; WrapperProvider = { wrapper: Web3ApiProvider, initialProps: { - redirects, + plugins, }, }; }); @@ -52,11 +52,11 @@ describe("useWeb3ApiClient hook", () => { return result; } - it("Should return client with redirects", async () => { + it("Should return client with plugins", async () => { const client = getClient(); expect(client).toBeTruthy(); - expect(client.redirects().length).toBeGreaterThan(0); + expect(client.plugins().length).toBeGreaterThan(0); }); it("Should throw error because there's no provider with expected key ", async () => { diff --git a/packages/js/react/src/__tests__/useWeb3ApiQuery.spec.tsx b/packages/js/react/src/__tests__/useWeb3ApiQuery.spec.tsx index 29a03999b7..2405d04548 100644 --- a/packages/js/react/src/__tests__/useWeb3ApiQuery.spec.tsx +++ b/packages/js/react/src/__tests__/useWeb3ApiQuery.spec.tsx @@ -13,7 +13,7 @@ import { RenderHookOptions, cleanup } from "@testing-library/react-hooks"; -import { UriRedirect } from "@web3api/core-js"; +import { PluginRegistration } from "@web3api/core-js"; import { initTestEnvironment, stopTestEnvironment, @@ -25,14 +25,14 @@ jest.setTimeout(60000); describe("useWeb3ApiQuery hook", () => { let uri: string; - let redirects: UriRedirect[]; + let plugins: PluginRegistration[]; let WrapperProvider: RenderHookOptions; beforeAll(async () => { const { ipfs, ensAddress, - redirects: testRedirects, + plugins: testPlugins, } = await initTestEnvironment(); const { ensDomain } = await buildAndDeployApi( @@ -42,11 +42,11 @@ describe("useWeb3ApiQuery hook", () => { ); uri = `ens/testnet/${ensDomain}`; - redirects = testRedirects; + plugins = testPlugins; WrapperProvider = { wrapper: Web3ApiProvider, initialProps: { - redirects, + plugins, }, }; }); diff --git a/packages/js/react/src/provider.tsx b/packages/js/react/src/provider.tsx index 821c4e9a1f..4fb0782161 100644 --- a/packages/js/react/src/provider.tsx +++ b/packages/js/react/src/provider.tsx @@ -32,7 +32,7 @@ export function createWeb3ApiProvider( ClientContext: React.createContext({} as Web3ApiClient) }; - return ({ redirects, children }) => { + return ({ redirects, plugins, interfaces, children }) => { const [clientCreated, setClientCreated] = React.useState(false); @@ -46,7 +46,7 @@ export function createWeb3ApiProvider( } // Instantiate the client - PROVIDERS[name].client = new Web3ApiClient({ redirects }); + PROVIDERS[name].client = new Web3ApiClient({ redirects, plugins, interfaces }); setClientCreated(true); diff --git a/packages/js/test-env/src/index.ts b/packages/js/test-env/src/index.ts index d9c73801ea..cca801a952 100644 --- a/packages/js/test-env/src/index.ts +++ b/packages/js/test-env/src/index.ts @@ -1,4 +1,4 @@ -import { UriRedirect } from "@web3api/core-js"; +import { PluginRegistration } from "@web3api/core-js"; import { plugin as ethereumPlugin } from "@web3api/ethereum-plugin-js"; import { plugin as ipfsPlugin } from "@web3api/ipfs-plugin-js"; import { plugin as ensPlugin } from "@web3api/ens-plugin-js"; @@ -10,7 +10,7 @@ interface TestEnvironment { ipfs: string; ethereum: string; ensAddress: string; - redirects: UriRedirect[]; + plugins: PluginRegistration[]; } export const initTestEnvironment = async (): Promise => { @@ -35,12 +35,13 @@ export const initTestEnvironment = async (): Promise => { // re-deploy ENS const { data } = await axios.get("http://localhost:4040/deploy-ens"); - // Test env redirects for ethereum, ipfs, and ENS. - // Will be used to fetch APIs. - const redirects: UriRedirect[] = [ + //Test env plugins for ethereum, ipfs, and ENS. + // Will be used to fetch APIs.: + + const plugins: PluginRegistration[] = [ { - from: "w3://ens/ethereum.web3api.eth", - to: ethereumPlugin({ + uri: "w3://ens/ethereum.web3api.eth", + plugin: ethereumPlugin({ networks: { testnet: { provider: ethereum as string, @@ -49,15 +50,15 @@ export const initTestEnvironment = async (): Promise => { }), }, { - from: "w3://ens/ipfs.web3api.eth", - to: ipfsPlugin({ + uri: "w3://ens/ipfs.web3api.eth", + plugin: ipfsPlugin({ provider: ipfs as string, fallbackProviders: ["https://ipfs.io"], }), }, { - from: "w3://ens/ens.web3api.eth", - to: ensPlugin({ + uri: "w3://ens/ens.web3api.eth", + plugin: ensPlugin({ addresses: { testnet: data.ensAddress as string, }, @@ -65,7 +66,7 @@ export const initTestEnvironment = async (): Promise => { }, ]; - return { ipfs, ethereum, ensAddress: data.ensAddress, redirects }; + return { ipfs, ethereum, ensAddress: data.ensAddress, plugins }; }; export const stopTestEnvironment = async (): Promise => { From c5cc7215e3e2531ef9d8109ebdd2dd86d813513c Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 10 Jun 2021 12:05:07 +0200 Subject: [PATCH 032/112] added tests to check that plugins cant use interfaces for their uri --- .../src/__tests__/Web3ApiClient.spec.ts | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 78fe7a8475..83f35cf01e 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -9,6 +9,7 @@ import { stopTestEnvironment } from "@web3api/test-env-js"; import { GetPathToTestApis } from "@web3api/test-cases"; +import { Web3ApiClient } from "../Web3ApiClient"; jest.setTimeout(50000); @@ -986,4 +987,95 @@ describe("Web3ApiClient", () => { implementation4Uri ]); }); + + it("plugins should not get registered with an interface uri (without default plugins)", () => { + const interface1Uri = "w3://ens/some-interface1.eth"; + const interface2Uri = "w3://ens/some-interface2.eth"; + const interface3Uri = "w3://ens/some-interface3.eth"; + + const implementationUri = "w3://ens/some-implementation.eth"; + + expect(() => { + new Web3ApiClient({ + plugins: [ + { + uri: interface1Uri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: "", + implemented: [], + imported: [], + } + } + }, + { + uri: interface2Uri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: "", + implemented: [], + imported: [], + } + } + } + ], + interfaces: [ + { + interface: interface1Uri, + implementations: [ + implementationUri + ] + }, + { + interface: interface2Uri, + implementations: [ + implementationUri + ] + }, + { + interface: interface3Uri, + implementations: [ + implementationUri + ] + } + ] + }); + }).toThrow(`Plugins can't use interfaces for their URI. Invalid plugins: ${[interface1Uri, interface2Uri]}`); + }); + + it("plugins should not get registered with an interface uri (with default plugins)", async () => { + const interfaceUri = "w3://ens/some-interface.eth"; + + const implementationUri = "w3://ens/some-implementation.eth"; + + await expect(async () => { + await getClient({ + plugins: [ + { + uri: interfaceUri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: "", + implemented: [], + imported: [], + } + } + } + ], + interfaces: [ + { + interface: interfaceUri, + implementations: [ + implementationUri + ] + } + ] + }); + }) + .rejects + .toThrow(`Plugins can't use interfaces for their URI. Invalid plugins: ${[interfaceUri]}`); + }); }); From 1e5ce5b8d7e8eb88c9ce759398054da33cc48d12 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 10 Jun 2021 12:40:17 +0200 Subject: [PATCH 033/112] added more Web3ApiClient tests --- .../src/__tests__/Web3ApiClient.spec.ts | 445 +++++++++++------- 1 file changed, 268 insertions(+), 177 deletions(-) diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 83f35cf01e..62cf8d2743 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -1,7 +1,8 @@ import { ClientConfig, createWeb3ApiClient, - Plugin + Plugin, + Uri } from "../"; import { buildAndDeployApi, @@ -47,6 +48,272 @@ describe("Web3ApiClient", () => { }, config); } + it("redirect registration", () => { + const implementation1Uri = "w3://ens/some-implementation1.eth"; + const implementation2Uri = "w3://ens/some-implementation2.eth"; + + const client = new Web3ApiClient({ + redirects: [ + { + from: implementation1Uri, + to: implementation2Uri + } + ] + }); + + const redirects = client.redirects(); + + expect(redirects).toEqual([ + { + from: new Uri(implementation1Uri), + to: new Uri(implementation2Uri), + } + ]); + }); + + it("plugin registration - with default plugins", () => { + const implementationUri = "w3://ens/some-implementation.eth"; + const defaultPlugins = [ + "w3://ens/ipfs.web3api.eth", + "w3://ens/ens.web3api.eth", + "w3://ens/ethereum.web3api.eth", + "w3://w3/logger" + ]; + + const client = new Web3ApiClient({ + plugins: [ + { + uri: implementationUri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: "", + implemented: [], + imported: [], + } + } + } + ] + }); + + const pluginUris = client.plugins().map(x => x.uri.uri); + + expect(pluginUris).toEqual([implementationUri].concat(defaultPlugins)); + }); + + it("interface registration", () => { + const interfaceUri = "w3://ens/some-interface1.eth"; + const implementation1Uri = "w3://ens/some-implementation1.eth"; + const implementation2Uri = "w3://ens/some-implementation2.eth"; + + const client = new Web3ApiClient({ + interfaces: [ + { + interface: interfaceUri, + implementations: [ + implementation1Uri, + implementation2Uri + ] + } + ] + }); + + const interfaces = client.interfaces(); + + expect(interfaces).toEqual([ + { + interface: new Uri(interfaceUri), + implementations: [ + new Uri(implementation1Uri), + new Uri(implementation2Uri) + ] + } + ]); + + const implementations = client.getImplementations(interfaceUri); + + expect(implementations).toEqual([ + implementation1Uri, + implementation2Uri + ]); + }); + + it("get all implementations of interface", async () => { + + const interface1Uri = "w3://ens/some-interface1.eth"; + const interface2Uri = "w3://ens/some-interface2.eth"; + const interface3Uri = "w3://ens/some-interface3.eth"; + + const implementation1Uri = "w3://ens/some-implementation.eth"; + const implementation2Uri = "w3://ens/some-implementation2.eth"; + const implementation3Uri = "w3://ens/some-implementation3.eth"; + const implementation4Uri = "w3://ens/some-implementation4.eth"; + + const client = await getClient({ + redirects: [ + { + from: interface1Uri, + to: interface2Uri + }, + { + from: implementation1Uri, + to: implementation2Uri + }, + { + from: implementation2Uri, + to: implementation3Uri + } + ], + plugins: [ + { + uri: implementation4Uri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: "", + implemented: [], + imported: [], + } + } + } + ], + interfaces: [ + { + interface: interface1Uri, + implementations: [ + implementation1Uri, + implementation2Uri + ] + }, + { + interface: interface2Uri, + implementations: [ + implementation3Uri + ] + }, + { + interface: interface3Uri, + implementations: [ + implementation3Uri, + implementation4Uri + ] + } + ] + }); + + const implementations1 = client.getAllImplementations(interface1Uri); + const implementations2 = client.getAllImplementations(interface2Uri); + const implementations3 = client.getAllImplementations(interface3Uri); + + expect(implementations1).toEqual([ + implementation1Uri, + implementation2Uri, + implementation3Uri + ]); + + expect(implementations2).toEqual([ + implementation1Uri, + implementation2Uri, + implementation3Uri + ]); + + expect(implementations3).toEqual([ + implementation3Uri, + implementation4Uri + ]); + }); + + it("plugins should not get registered with an interface uri (without default plugins)", () => { + const interface1Uri = "w3://ens/some-interface1.eth"; + const interface2Uri = "w3://ens/some-interface2.eth"; + const interface3Uri = "w3://ens/some-interface3.eth"; + + const implementationUri = "w3://ens/some-implementation.eth"; + + expect(() => { + new Web3ApiClient({ + plugins: [ + { + uri: interface1Uri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: "", + implemented: [], + imported: [], + } + } + }, + { + uri: interface2Uri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: "", + implemented: [], + imported: [], + } + } + } + ], + interfaces: [ + { + interface: interface1Uri, + implementations: [ + implementationUri + ] + }, + { + interface: interface2Uri, + implementations: [ + implementationUri + ] + }, + { + interface: interface3Uri, + implementations: [ + implementationUri + ] + } + ] + }); + }).toThrow(`Plugins can't use interfaces for their URI. Invalid plugins: ${[interface1Uri, interface2Uri]}`); + }); + + it("plugins should not get registered with an interface uri (with default plugins)", async () => { + const interfaceUri = "w3://ens/some-interface.eth"; + + const implementationUri = "w3://ens/some-implementation.eth"; + + await expect(async () => { + await getClient({ + plugins: [ + { + uri: interfaceUri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: "", + implemented: [], + imported: [], + } + } + } + ], + interfaces: [ + { + interface: interfaceUri, + implementations: [ + implementationUri + ] + } + ] + }); + }) + .rejects + .toThrow(`Plugins can't use interfaces for their URI. Invalid plugins: ${[interfaceUri]}`); + }); + it("simple-storage", async () => { const api = await buildAndDeployApi( `${GetPathToTestApis()}/simple-storage`, @@ -902,180 +1169,4 @@ describe("Web3ApiClient", () => { /Property must be of type 'array'. Found 'map'./ ); }); - - it("get implementations", async () => { - - const interface1Uri = "w3://ens/some-interface1.eth"; - const interface2Uri = "w3://ens/some-interface2.eth"; - const interface3Uri = "w3://ens/some-interface3.eth"; - - const implementation1Uri = "w3://ens/some-implementation.eth"; - const implementation2Uri = "w3://ens/some-implementation2.eth"; - const implementation3Uri = "w3://ens/some-implementation3.eth"; - const implementation4Uri = "w3://ens/some-implementation4.eth"; - - const client = await getClient({ - redirects: [ - { - from: interface1Uri, - to: interface2Uri - }, - { - from: implementation1Uri, - to: implementation2Uri - }, - { - from: implementation2Uri, - to: implementation3Uri - } - ], - plugins: [ - { - uri: implementation4Uri, - plugin: { - factory: () => ({} as Plugin), - manifest: { - schema: "", - implemented: [], - imported: [], - } - } - } - ], - interfaces: [ - { - interface: interface1Uri, - implementations: [ - implementation1Uri, - implementation2Uri - ] - }, - { - interface: interface2Uri, - implementations: [ - implementation3Uri - ] - }, - { - interface: interface3Uri, - implementations: [ - implementation3Uri, - implementation4Uri - ] - } - ] - }); - - const implementations1 = client.getAllImplementations(interface1Uri); - const implementations2 = client.getAllImplementations(interface2Uri); - const implementations3 = client.getAllImplementations(interface3Uri); - - expect(implementations1).toEqual([ - implementation1Uri, - implementation2Uri, - implementation3Uri - ]); - - expect(implementations2).toEqual([ - implementation1Uri, - implementation2Uri, - implementation3Uri - ]); - - expect(implementations3).toEqual([ - implementation3Uri, - implementation4Uri - ]); - }); - - it("plugins should not get registered with an interface uri (without default plugins)", () => { - const interface1Uri = "w3://ens/some-interface1.eth"; - const interface2Uri = "w3://ens/some-interface2.eth"; - const interface3Uri = "w3://ens/some-interface3.eth"; - - const implementationUri = "w3://ens/some-implementation.eth"; - - expect(() => { - new Web3ApiClient({ - plugins: [ - { - uri: interface1Uri, - plugin: { - factory: () => ({} as Plugin), - manifest: { - schema: "", - implemented: [], - imported: [], - } - } - }, - { - uri: interface2Uri, - plugin: { - factory: () => ({} as Plugin), - manifest: { - schema: "", - implemented: [], - imported: [], - } - } - } - ], - interfaces: [ - { - interface: interface1Uri, - implementations: [ - implementationUri - ] - }, - { - interface: interface2Uri, - implementations: [ - implementationUri - ] - }, - { - interface: interface3Uri, - implementations: [ - implementationUri - ] - } - ] - }); - }).toThrow(`Plugins can't use interfaces for their URI. Invalid plugins: ${[interface1Uri, interface2Uri]}`); - }); - - it("plugins should not get registered with an interface uri (with default plugins)", async () => { - const interfaceUri = "w3://ens/some-interface.eth"; - - const implementationUri = "w3://ens/some-implementation.eth"; - - await expect(async () => { - await getClient({ - plugins: [ - { - uri: interfaceUri, - plugin: { - factory: () => ({} as Plugin), - manifest: { - schema: "", - implemented: [], - imported: [], - } - } - } - ], - interfaces: [ - { - interface: interfaceUri, - implementations: [ - implementationUri - ] - } - ] - }); - }) - .rejects - .toThrow(`Plugins can't use interfaces for their URI. Invalid plugins: ${[interfaceUri]}`); - }); }); From fd90ba020e3f0073a6fdab78b4aa2bf73209717c Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 10 Jun 2021 12:46:09 +0200 Subject: [PATCH 034/112] lint fix --- packages/cli/src/lib/SchemaComposer.ts | 7 ++++- packages/js/client/src/Web3ApiClient.ts | 28 +++++++++++-------- packages/js/client/src/createWeb3ApiClient.ts | 5 +--- .../src/algorithms/find-plugin-package.ts | 4 +-- .../src/algorithms/get-implementations.ts | 15 +++++----- 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/packages/cli/src/lib/SchemaComposer.ts b/packages/cli/src/lib/SchemaComposer.ts index 8f39b42d75..8eb93c83cb 100644 --- a/packages/cli/src/lib/SchemaComposer.ts +++ b/packages/cli/src/lib/SchemaComposer.ts @@ -3,7 +3,12 @@ import { Project } from "./Project"; -import { Manifest, Uri, Web3ApiClient, PluginRegistration } from "@web3api/client-js"; +import { + Manifest, + Uri, + Web3ApiClient, + PluginRegistration, +} from "@web3api/client-js"; import { composeSchema, ComposerOutput, diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 39d77d772d..0faa7719cf 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -63,7 +63,7 @@ export class Web3ApiClient implements Client { interfaces: config.interfaces ? sanitizeInterfaceImplementations(config.interfaces) : [], - tracingEnabled: !!config.tracingEnabled + tracingEnabled: !!config.tracingEnabled, }; } @@ -81,17 +81,6 @@ export class Web3ApiClient implements Client { } } - private requirePluginsToUseNonInterfaceUris(): void { - const pluginUris = this.plugins().map(x => x.uri.uri); - const interfaceUris = this.interfaces().map(x => x.interface.uri); - - const pluginsWithInterfaceUris = pluginUris.filter(plugin => interfaceUris.includes(plugin)); - - if(pluginsWithInterfaceUris.length) { - throw Error(`Plugins can't use interfaces for their URI. Invalid plugins: ${pluginsWithInterfaceUris}`); - } - } - public tracingEnabled(enable: boolean): void { if (enable) { Tracer.enableTracing("Web3ApiClient"); @@ -278,4 +267,19 @@ export class Web3ApiClient implements Client { return run(uri); } + + private requirePluginsToUseNonInterfaceUris(): void { + const pluginUris = this.plugins().map((x) => x.uri.uri); + const interfaceUris = this.interfaces().map((x) => x.interface.uri); + + const pluginsWithInterfaceUris = pluginUris.filter((plugin) => + interfaceUris.includes(plugin) + ); + + if (pluginsWithInterfaceUris.length) { + throw Error( + `Plugins can't use interfaces for their URI. Invalid plugins: ${pluginsWithInterfaceUris}` + ); + } + } } diff --git a/packages/js/client/src/createWeb3ApiClient.ts b/packages/js/client/src/createWeb3ApiClient.ts index 72321d80af..58950d0895 100644 --- a/packages/js/client/src/createWeb3ApiClient.ts +++ b/packages/js/client/src/createWeb3ApiClient.ts @@ -73,10 +73,7 @@ export const createWeb3ApiClient = Tracer.traceFunc( if (config) { return new Web3ApiClient({ ...config, - plugins: [ - ...plugins, - ...(config.plugins ? config.plugins : []), - ], + plugins: [...plugins, ...(config.plugins ? config.plugins : [])], }); } else { return new Web3ApiClient({ plugins }); diff --git a/packages/js/core/src/algorithms/find-plugin-package.ts b/packages/js/core/src/algorithms/find-plugin-package.ts index ecd52be4ec..900a9df41c 100644 --- a/packages/js/core/src/algorithms/find-plugin-package.ts +++ b/packages/js/core/src/algorithms/find-plugin-package.ts @@ -8,9 +8,7 @@ export const findPluginPackage = Tracer.traceFunc( uri: Uri, plugins: readonly PluginRegistration[] ): PluginPackage | undefined => { - const pluginRedirect = plugins.find( - (x) => Uri.equals(x.uri, uri) - ); + const pluginRedirect = plugins.find((x) => Uri.equals(x.uri, uri)); return pluginRedirect?.plugin as PluginPackage | undefined; } diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 232f75a0b8..81532f67fe 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -1,4 +1,9 @@ -import { Uri, UriRedirect, InterfaceImplementations, PluginRegistration } from "../types"; +import { + Uri, + UriRedirect, + InterfaceImplementations, + PluginRegistration, +} from "../types"; import { applyRedirects } from "./apply-redirects"; import { Tracer } from "@web3api/tracing-js"; @@ -20,9 +25,7 @@ export const getImplementations = Tracer.traceFunc( } }; - const addAllImplementationsFromPluginRedirects = ( - apiInterfaceUri: Uri - ) => { + const addAllImplementationsFromPluginRedirects = (apiInterfaceUri: Uri) => { for (const pluginRegistration of plugins) { const { implemented } = pluginRegistration.plugin.manifest; const implementedApi = @@ -57,9 +60,7 @@ export const getImplementations = Tracer.traceFunc( redirects ); - addAllImplementationsFromPluginRedirects( - finalRedirectedApiInterface - ); + addAllImplementationsFromPluginRedirects(finalRedirectedApiInterface); addAllImplementationsFromImplementationsArray( interfaceImplementationsList, finalRedirectedApiInterface From 625b1c7f04cea9cf01d147e124c17e90a582c5f5 Mon Sep 17 00:00:00 2001 From: jbogunovic Date: Thu, 10 Jun 2021 14:57:03 +0200 Subject: [PATCH 035/112] removed redirects, plugins and interfaces from Client --- packages/js/core/src/algorithms/resolve-uri.ts | 12 +++++++----- packages/js/core/src/types/Client.ts | 7 ------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index b0b904ad9d..44bb0c5a47 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -1,4 +1,4 @@ -import { Api, Client, Uri, PluginPackage } from "../types"; +import { Api, Client, Uri, PluginPackage, InterfaceImplementations, PluginRegistration, UriRedirect } from "../types"; import { Manifest, deserializeManifest } from "../manifest"; import * as ApiResolver from "../apis/api-resolver"; import { applyRedirects } from "./apply-redirects"; @@ -12,15 +12,17 @@ export const resolveUri = Tracer.traceFunc( async ( uri: Uri, client: Client, + redirects: readonly UriRedirect[], + plugins: PluginRegistration[], + interfaces: InterfaceImplementations[], createPluginApi: (uri: Uri, plugin: PluginPackage) => Api, createApi: (uri: Uri, manifest: Manifest, apiResolver: Uri) => Api, noValidate?: boolean ): Promise => { - const redirects = client.redirects(); const finalRedirectedUri = applyRedirects(uri, redirects); - const plugin = findPluginPackage(finalRedirectedUri, client.plugins()); + const plugin = findPluginPackage(finalRedirectedUri, plugins); if (plugin) { return Tracer.traceFunc( @@ -33,8 +35,8 @@ export const resolveUri = Tracer.traceFunc( const uriResolverImplementations = getImplementations( new Uri("w3/api-resolver"), redirects, - client.plugins(), - client.interfaces() + plugins, + interfaces ); return await resolveUriWithApiResolvers( diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index 418672a58d..f76c31ac5c 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -1,14 +1,7 @@ import { - Uri, - UriRedirect, - InterfaceImplementations, QueryHandler, InvokeHandler, } from "./"; -import { PluginRegistration } from "./PluginRegistration"; export interface Client extends QueryHandler, InvokeHandler { - redirects: () => readonly UriRedirect[]; - plugins: () => readonly PluginRegistration[]; - interfaces: () => readonly InterfaceImplementations[]; } From a32ef7e9726c351a2f0d8f78fb14fe1fd4027a8d Mon Sep 17 00:00:00 2001 From: jbogunovic Date: Thu, 10 Jun 2021 15:14:07 +0200 Subject: [PATCH 036/112] added applyRedirect tests --- .../src/__tests__/apply-redirects.spec.ts | 40 +++++++++++++++++++ .../js/core/src/algorithms/apply-redirects.ts | 21 ++-------- packages/js/core/src/algorithms/index.ts | 1 + 3 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 packages/js/core/src/__tests__/apply-redirects.spec.ts diff --git a/packages/js/core/src/__tests__/apply-redirects.spec.ts b/packages/js/core/src/__tests__/apply-redirects.spec.ts new file mode 100644 index 0000000000..6cd31f6cbe --- /dev/null +++ b/packages/js/core/src/__tests__/apply-redirects.spec.ts @@ -0,0 +1,40 @@ +import { + Uri, + applyRedirects +} from "../"; + +describe("applyRedirects", () => { + + it("works with the typical use case", () => { + const uri1 = "w3://ens/some-uri1.eth"; + const uri2 = "w3://ens/some-uri2.eth"; + + const redirectedUri = applyRedirects(uri1, [ + { + from: new Uri(uri1), + to: new Uri(uri2) + } + ]); + + expect(Uri.equals(redirectedUri, new Uri(uri1))).toBeTrue(); + }); + + it("works with the redirect stack overrides", () => { + const uri1 = "w3://ens/some-uri1.eth"; + const uri2 = "w3://ens/some-uri2.eth"; + const uri3 = "w3://ens/some-uri3.eth"; + + const redirectedUri = applyRedirects(uri1, [ + { + from: new Uri(uri1), + to: new Uri(uri2) + }, + { + from: new Uri(uri1), + to: new Uri(uri3) + } + ]); + + expect(Uri.equals(redirectedUri, new Uri(uri1))).toBeTrue(); + }); +}); diff --git a/packages/js/core/src/algorithms/apply-redirects.ts b/packages/js/core/src/algorithms/apply-redirects.ts index 7286d99b74..6559039ba1 100644 --- a/packages/js/core/src/algorithms/apply-redirects.ts +++ b/packages/js/core/src/algorithms/apply-redirects.ts @@ -18,26 +18,11 @@ export const applyRedirects = Tracer.traceFunc( ); }; - const checkForDuplicateRedirects = ( - redirectFrom: Uri, - redirectFromToMap: Record - ) => { - if (redirectFromToMap[redirectFrom.uri]) { - throwError( - `Cannot redirect from the same URI more than once, URI: "${uri}".` - ); - } - }; - for (const redirect of redirects) { - if (!redirect.from) { - throwError( - `Redirect missing the from property.\nEncountered while resolving ${uri.uri}` - ); - } - if (Uri.isUri(redirect.to)) { - checkForDuplicateRedirects(redirect.from, redirectFromToMap); + if (redirectFromToMap[redirect.from.uri]) { + continue; + } redirectFromToMap[redirect.from.uri] = redirect.to; } diff --git a/packages/js/core/src/algorithms/index.ts b/packages/js/core/src/algorithms/index.ts index efa8ed2fab..79935f300b 100644 --- a/packages/js/core/src/algorithms/index.ts +++ b/packages/js/core/src/algorithms/index.ts @@ -2,3 +2,4 @@ export * from "./filter-results"; export * from "./get-implementations"; export * from "./parse-query"; export * from "./resolve-uri"; +export * from "./apply-redirects"; From 2a469de0ca59460cfa0442805ac4c2518ecd6483 Mon Sep 17 00:00:00 2001 From: jbogunovic Date: Thu, 10 Jun 2021 15:16:18 +0200 Subject: [PATCH 037/112] fixed bad tests --- packages/js/core/src/__tests__/apply-redirects.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/js/core/src/__tests__/apply-redirects.spec.ts b/packages/js/core/src/__tests__/apply-redirects.spec.ts index 6cd31f6cbe..8dc246136b 100644 --- a/packages/js/core/src/__tests__/apply-redirects.spec.ts +++ b/packages/js/core/src/__tests__/apply-redirects.spec.ts @@ -16,7 +16,7 @@ describe("applyRedirects", () => { } ]); - expect(Uri.equals(redirectedUri, new Uri(uri1))).toBeTrue(); + expect(Uri.equals(redirectedUri, new Uri(uri2))).toBeTrue(); }); it("works with the redirect stack overrides", () => { @@ -35,6 +35,6 @@ describe("applyRedirects", () => { } ]); - expect(Uri.equals(redirectedUri, new Uri(uri1))).toBeTrue(); + expect(Uri.equals(redirectedUri, new Uri(uri2))).toBeTrue(); }); }); From b8e440f995428d1ff3c9e26bbc844c6743d149d2 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 10 Jun 2021 18:41:36 +0200 Subject: [PATCH 038/112] fixed tests --- packages/js/client/src/Web3ApiClient.ts | 3 ++ .../src/__tests__/apply-redirects.spec.ts | 8 +-- .../js/core/src/__tests__/resolve-uri.spec.ts | 50 +++++++++++++------ .../js/core/src/algorithms/apply-redirects.ts | 14 ++++-- .../js/core/src/algorithms/resolve-uri.ts | 4 +- 5 files changed, 52 insertions(+), 27 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 0faa7719cf..7a80a3fb63 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -214,6 +214,9 @@ export class Web3ApiClient implements Client { api = await resolveUri( uri, this, + this.redirects(), + this.plugins(), + this.interfaces(), (uri: Uri, plugin: PluginPackage) => new PluginWeb3Api(uri, plugin), (uri: Uri, manifest: Manifest, apiResolver: Uri) => new WasmWeb3Api(uri, manifest, apiResolver) diff --git a/packages/js/core/src/__tests__/apply-redirects.spec.ts b/packages/js/core/src/__tests__/apply-redirects.spec.ts index 8dc246136b..33a905be8b 100644 --- a/packages/js/core/src/__tests__/apply-redirects.spec.ts +++ b/packages/js/core/src/__tests__/apply-redirects.spec.ts @@ -9,14 +9,14 @@ describe("applyRedirects", () => { const uri1 = "w3://ens/some-uri1.eth"; const uri2 = "w3://ens/some-uri2.eth"; - const redirectedUri = applyRedirects(uri1, [ + const redirectedUri = applyRedirects(new Uri(uri1), [ { from: new Uri(uri1), to: new Uri(uri2) } ]); - expect(Uri.equals(redirectedUri, new Uri(uri2))).toBeTrue(); + expect(Uri.equals(redirectedUri, new Uri(uri2))).toBeTruthy(); }); it("works with the redirect stack overrides", () => { @@ -24,7 +24,7 @@ describe("applyRedirects", () => { const uri2 = "w3://ens/some-uri2.eth"; const uri3 = "w3://ens/some-uri3.eth"; - const redirectedUri = applyRedirects(uri1, [ + const redirectedUri = applyRedirects(new Uri(uri1), [ { from: new Uri(uri1), to: new Uri(uri2) @@ -35,6 +35,6 @@ describe("applyRedirects", () => { } ]); - expect(Uri.equals(redirectedUri, new Uri(uri2))).toBeTrue(); + expect(Uri.equals(redirectedUri, new Uri(uri2))).toBeTruthy(); }); }); diff --git a/packages/js/core/src/__tests__/resolve-uri.spec.ts b/packages/js/core/src/__tests__/resolve-uri.spec.ts index da7fedfce8..18e21f4a27 100644 --- a/packages/js/core/src/__tests__/resolve-uri.spec.ts +++ b/packages/js/core/src/__tests__/resolve-uri.spec.ts @@ -18,14 +18,8 @@ import { InterfaceImplementations, PluginRegistration } from "../types"; describe("resolveUri", () => { const client = ( - redirects: UriRedirect[], - plugins: PluginRegistration[], - interfaceImplementationsList: InterfaceImplementations[], apis: Record, ): Client => ({ - redirects: () => redirects, - plugins: () => plugins, - interfaces: () => interfaceImplementationsList, query: < TData extends Record = Record, TVariables extends Record = Record, @@ -151,14 +145,17 @@ describe("resolveUri", () => { const query = ApiResolver.Query; const uri = new Uri("w3/some-uri"); - expect(query.tryResolveUri(client([], plugins, interfaces, apis), api, uri)).toBeDefined(); - expect(query.getFile(client([], plugins, interfaces, apis), file, path)).toBeDefined(); + expect(query.tryResolveUri(client(apis), api, uri)).toBeDefined(); + expect(query.getFile(client(apis), file, path)).toBeDefined(); }); it("works in the typical case", async () => { const result = await resolveUri( new Uri("ens/test.eth"), - client([], plugins, interfaces, apis), + client(apis), + [], + plugins, + interfaces, createPluginApi, createApi, true @@ -181,7 +178,10 @@ describe("resolveUri", () => { it("uses a plugin that implements api-resolver", async () => { const result = await resolveUri( new Uri("my/something-different"), - client([], plugins, interfaces, apis), + client(apis), + [], + plugins, + interfaces, createPluginApi, createApi, true @@ -204,7 +204,10 @@ describe("resolveUri", () => { it("works when direct query a Web3API that implements the api-resolver", async () => { const result = await resolveUri( new Uri("ens/ens"), - client([], plugins, interfaces, apis), + client(apis), + [], + plugins, + interfaces, createPluginApi, createApi, true @@ -228,7 +231,10 @@ describe("resolveUri", () => { it("works when direct query a plugin Web3API that implements the api-resolver", async () => { const result = await resolveUri( new Uri("my/something-different"), - client([], plugins, interfaces, apis), + client(apis), + [], + plugins, + interfaces, createPluginApi, createApi, true @@ -264,7 +270,10 @@ describe("resolveUri", () => { return resolveUri( new Uri("some/api"), - client(circular, plugins, interfaces, apis), + client(apis), + circular, + plugins, + interfaces, createPluginApi, createApi, true @@ -289,7 +298,10 @@ describe("resolveUri", () => { return resolveUri( new Uri("some/api"), - client(missingFromProperty, plugins, interfaces, apis), + client(apis), + missingFromProperty, + plugins, + interfaces, createPluginApi, createApi, true @@ -316,7 +328,10 @@ describe("resolveUri", () => { const result = await resolveUri( new Uri("some/api"), - client([], pluginRegistrations, interfaces, apis), + client(apis), + [], + pluginRegistrations, + interfaces, createPluginApi, createApi, true @@ -351,10 +366,13 @@ describe("resolveUri", () => { await resolveUri( uri, - client([], plugins, interfaces, { + client({ ...apis, "w3://ens/ipfs": faultyIpfsApi }), + [], + plugins, + interfaces, createPluginApi, createApi, true diff --git a/packages/js/core/src/algorithms/apply-redirects.ts b/packages/js/core/src/algorithms/apply-redirects.ts index 6559039ba1..8ddf751570 100644 --- a/packages/js/core/src/algorithms/apply-redirects.ts +++ b/packages/js/core/src/algorithms/apply-redirects.ts @@ -19,13 +19,17 @@ export const applyRedirects = Tracer.traceFunc( }; for (const redirect of redirects) { - if (Uri.isUri(redirect.to)) { - if (redirectFromToMap[redirect.from.uri]) { - continue; - } + if (!redirect.from) { + throwError( + `Redirect missing the from property.\nEncountered while resolving ${uri.uri}` + ); + } - redirectFromToMap[redirect.from.uri] = redirect.to; + if (redirectFromToMap[redirect.from.uri]) { + continue; } + + redirectFromToMap[redirect.from.uri] = redirect.to; } let finalUri = uri; diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 44bb0c5a47..752f310e52 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -13,8 +13,8 @@ export const resolveUri = Tracer.traceFunc( uri: Uri, client: Client, redirects: readonly UriRedirect[], - plugins: PluginRegistration[], - interfaces: InterfaceImplementations[], + plugins: readonly PluginRegistration[], + interfaces: readonly InterfaceImplementations[], createPluginApi: (uri: Uri, plugin: PluginPackage) => Api, createApi: (uri: Uri, manifest: Manifest, apiResolver: Uri) => Api, noValidate?: boolean From 8693e92cdcbacf010bf054c9937ac963017f35dd Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 10 Jun 2021 19:03:15 +0200 Subject: [PATCH 039/112] lint fix --- packages/js/core/src/algorithms/apply-redirects.ts | 2 +- packages/js/core/src/algorithms/resolve-uri.ts | 11 +++++++++-- packages/js/core/src/types/Client.ts | 8 ++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/js/core/src/algorithms/apply-redirects.ts b/packages/js/core/src/algorithms/apply-redirects.ts index 8ddf751570..336139a1ff 100644 --- a/packages/js/core/src/algorithms/apply-redirects.ts +++ b/packages/js/core/src/algorithms/apply-redirects.ts @@ -26,7 +26,7 @@ export const applyRedirects = Tracer.traceFunc( } if (redirectFromToMap[redirect.from.uri]) { - continue; + continue; } redirectFromToMap[redirect.from.uri] = redirect.to; diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 752f310e52..77a3b85181 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -1,4 +1,12 @@ -import { Api, Client, Uri, PluginPackage, InterfaceImplementations, PluginRegistration, UriRedirect } from "../types"; +import { + Api, + Client, + Uri, + PluginPackage, + InterfaceImplementations, + PluginRegistration, + UriRedirect, +} from "../types"; import { Manifest, deserializeManifest } from "../manifest"; import * as ApiResolver from "../apis/api-resolver"; import { applyRedirects } from "./apply-redirects"; @@ -19,7 +27,6 @@ export const resolveUri = Tracer.traceFunc( createApi: (uri: Uri, manifest: Manifest, apiResolver: Uri) => Api, noValidate?: boolean ): Promise => { - const finalRedirectedUri = applyRedirects(uri, redirects); const plugin = findPluginPackage(finalRedirectedUri, plugins); diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index f76c31ac5c..efb89745be 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -1,7 +1,3 @@ -import { - QueryHandler, - InvokeHandler, -} from "./"; +import { QueryHandler, InvokeHandler } from "./"; -export interface Client extends QueryHandler, InvokeHandler { -} +export interface Client extends QueryHandler, InvokeHandler {} From 6dccbc23494c0699c4525615969a7c9322276a23 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 00:15:02 +0200 Subject: [PATCH 040/112] added overloads to methods on client that use uris --- packages/js/client/src/Web3ApiClient.ts | 65 ++++++++++++++++--------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 7a80a3fb63..973dc5f662 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -204,7 +204,13 @@ export class Web3ApiClient implements Client { return run(options); } - public async loadWeb3Api(uri: Uri): Promise { + public async loadWeb3Api(uri: string): Promise + public async loadWeb3Api(uri: Uri): Promise + public async loadWeb3Api(uri: string | Uri): Promise { + const typedUri = typeof uri === "string" + ? new Uri(uri) + : uri; + const run = Tracer.traceFunc( "Web3ApiClient: loadWeb3Api", async (uri: Uri): Promise => { @@ -233,42 +239,57 @@ export class Web3ApiClient implements Client { } ); - return run(uri); + return run(typedUri); } - public getImplementations(uri: string): string[] { - const run = Tracer.traceFunc( - "Web3ApiClient: getImplementations", - (uri: string): string[] => { + public getImplementations(uri: string): string[] + public getImplementations(uri: Uri): Uri[] + public getImplementations(uri: string | Uri, filters: { applyRedirects: boolean } = { applyRedirects: false }): (string | Uri)[] { + const isUriTypeString = typeof uri === "string" + + const typedUri: Uri = isUriTypeString + ? new Uri(uri as string) + : uri as Uri; + + const getImplementationsWithoutRedirects = Tracer.traceFunc( + "Web3ApiClient: getImplementations - getImplementationsWithoutRedirects", + (uri: Uri): (string | Uri)[] => { const interfaceImplementations = this.interfaces().find((x) => - Uri.equals(x.interface, new Uri(uri)) + Uri.equals(x.interface, uri) ); if (!interfaceImplementations) { throw Error(`Interface: ${uri} has no implementations registered`); } - return interfaceImplementations.implementations.map((x) => x.uri); + return isUriTypeString + ? interfaceImplementations.implementations.map((x) => x.uri) + : interfaceImplementations.implementations } ); - return run(uri); - } - - public getAllImplementations(uri: string): string[] { - const run = Tracer.traceFunc( - "Web3ApiClient: getImplementations", - (uri: string): string[] => { - return getImplementations( - new Uri(uri), - this.redirects(), - this.plugins(), - this.interfaces() - ).map((x) => x.uri); + const getImplementationsWithRedirects = Tracer.traceFunc( + "Web3ApiClient: getImplementations - getImplementationsWithRedirects", + (uri: Uri): (string | Uri)[] => { + return isUriTypeString + ? getImplementations( + uri, + this.redirects(), + this.plugins(), + this.interfaces() + ).map((x) => x.uri) + : getImplementations( + uri, + this.redirects(), + this.plugins(), + this.interfaces() + ); } ); - return run(uri); + return filters.applyRedirects + ? getImplementationsWithRedirects(typedUri) + : getImplementationsWithoutRedirects(typedUri); } private requirePluginsToUseNonInterfaceUris(): void { From a9d2cd67842d2cc2a1cf39bc5bb53d2277c80249 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 00:34:14 +0200 Subject: [PATCH 041/112] implemented defaultClientConfig instead of defaultPlugins --- packages/js/client/src/Web3ApiClient.ts | 43 +++++++++----- .../client/src/get-default-client-config.ts | 58 +++++++++++++++++++ packages/js/client/src/get-default-plugins.ts | 39 ------------- 3 files changed, 86 insertions(+), 54 deletions(-) create mode 100644 packages/js/client/src/get-default-client-config.ts delete mode 100644 packages/js/client/src/get-default-plugins.ts diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 973dc5f662..58db41b463 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -1,4 +1,4 @@ -import { getDefaultPlugins } from "./get-default-plugins"; +import { getDefaultClientConfig } from "./get-default-client-config"; import { PluginWeb3Api } from "./plugin/PluginWeb3Api"; import { WasmWeb3Api } from "./wasm/WasmWeb3Api"; @@ -67,8 +67,20 @@ export class Web3ApiClient implements Client { }; } - // Add all default plugins - this._config.plugins.push(...getDefaultPlugins()); + // Add the default config + const defaultClientConfig = getDefaultClientConfig(); + + if(defaultClientConfig.redirects) { + this._config.redirects.push(...defaultClientConfig.redirects) + } + + if(defaultClientConfig.plugins) { + this._config.plugins.push(...defaultClientConfig.plugins); + } + + if(defaultClientConfig.interfaces) { + this._config.interfaces.push(...defaultClientConfig.interfaces); + } this.requirePluginsToUseNonInterfaceUris(); @@ -204,12 +216,10 @@ export class Web3ApiClient implements Client { return run(options); } - public async loadWeb3Api(uri: string): Promise - public async loadWeb3Api(uri: Uri): Promise + public async loadWeb3Api(uri: string): Promise; + public async loadWeb3Api(uri: Uri): Promise; public async loadWeb3Api(uri: string | Uri): Promise { - const typedUri = typeof uri === "string" - ? new Uri(uri) - : uri; + const typedUri = typeof uri === "string" ? new Uri(uri) : uri; const run = Tracer.traceFunc( "Web3ApiClient: loadWeb3Api", @@ -242,14 +252,17 @@ export class Web3ApiClient implements Client { return run(typedUri); } - public getImplementations(uri: string): string[] - public getImplementations(uri: Uri): Uri[] - public getImplementations(uri: string | Uri, filters: { applyRedirects: boolean } = { applyRedirects: false }): (string | Uri)[] { - const isUriTypeString = typeof uri === "string" - + public getImplementations(uri: string): string[]; + public getImplementations(uri: Uri): Uri[]; + public getImplementations( + uri: string | Uri, + filters: { applyRedirects: boolean } = { applyRedirects: false } + ): (string | Uri)[] { + const isUriTypeString = typeof uri === "string"; + const typedUri: Uri = isUriTypeString ? new Uri(uri as string) - : uri as Uri; + : (uri as Uri); const getImplementationsWithoutRedirects = Tracer.traceFunc( "Web3ApiClient: getImplementations - getImplementationsWithoutRedirects", @@ -264,7 +277,7 @@ export class Web3ApiClient implements Client { return isUriTypeString ? interfaceImplementations.implementations.map((x) => x.uri) - : interfaceImplementations.implementations + : interfaceImplementations.implementations; } ); diff --git a/packages/js/client/src/get-default-client-config.ts b/packages/js/client/src/get-default-client-config.ts new file mode 100644 index 0000000000..108cb8daf1 --- /dev/null +++ b/packages/js/client/src/get-default-client-config.ts @@ -0,0 +1,58 @@ +import { Uri } from "@web3api/core-js"; +import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; +import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; +import { ensPlugin } from "@web3api/ens-plugin-js"; +import { loggerPlugin } from "@web3api/logger-plugin-js"; +import { Tracer } from "@web3api/tracing-js"; +import { ClientConfig } from "."; + +export const getDefaultClientConfig = Tracer.traceFunc( + "client-js: getDefaultClientConfig", + (): ClientConfig => { + return { + redirects: [], + plugins: [ + // IPFS is required for downloading Web3API packages + { + uri: new Uri("w3://ens/ipfs.web3api.eth"), + plugin: ipfsPlugin({ provider: "https://ipfs.io" }), + }, + // ENS is required for resolving domain to IPFS hashes + { + uri: new Uri("w3://ens/ens.web3api.eth"), + plugin: ensPlugin({}), + }, + { + uri: new Uri("w3://ens/ethereum.web3api.eth"), + plugin: ethereumPlugin({ + networks: { + mainnet: { + provider: + "https://mainnet.infura.io/v3/b00b2c2cc09c487685e9fb061256d6a6", + }, + }, + }), + }, + { + uri: new Uri("w3://w3/logger"), + plugin: loggerPlugin(), + }, + ], + interfaces: [ + { + interface: new Uri("w3/api-resolver"), + implementations: [ + new Uri("w3://ens/ipfs.web3api.eth"), + new Uri("w3://ens/ens.web3api.eth") + ] + }, + { + interface: new Uri("w3/logger"), + implementations: [ + new Uri("w3://w3/logger") + ] + } + ] + }; + } +); diff --git a/packages/js/client/src/get-default-plugins.ts b/packages/js/client/src/get-default-plugins.ts deleted file mode 100644 index ee5b7f71d7..0000000000 --- a/packages/js/client/src/get-default-plugins.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { PluginRegistration, Uri } from "@web3api/core-js"; -import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; -import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; -import { ensPlugin } from "@web3api/ens-plugin-js"; -import { loggerPlugin } from "@web3api/logger-plugin-js"; -import { Tracer } from "@web3api/tracing-js"; - -export const getDefaultPlugins = Tracer.traceFunc( - "client-js: getDefaultPlugins", - (): PluginRegistration[] => { - return [ - // IPFS is required for downloading Web3API packages - { - uri: new Uri("w3://ens/ipfs.web3api.eth"), - plugin: ipfsPlugin({ provider: "https://ipfs.io" }), - }, - // ENS is required for resolving domain to IPFS hashes - { - uri: new Uri("w3://ens/ens.web3api.eth"), - plugin: ensPlugin({}), - }, - { - uri: new Uri("w3://ens/ethereum.web3api.eth"), - plugin: ethereumPlugin({ - networks: { - mainnet: { - provider: - "https://mainnet.infura.io/v3/b00b2c2cc09c487685e9fb061256d6a6", - }, - }, - }), - }, - { - uri: new Uri("w3://w3/logger"), - plugin: loggerPlugin(), - }, - ]; - } -); From b6f527feb431eac4f45446e0d253bbee655a663f Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 00:51:11 +0200 Subject: [PATCH 042/112] testing that interface implementations are not redirected --- .../src/__tests__/get-implementations.spec.ts | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/packages/js/core/src/__tests__/get-implementations.spec.ts b/packages/js/core/src/__tests__/get-implementations.spec.ts index 85ba094a26..50e65afa76 100644 --- a/packages/js/core/src/__tests__/get-implementations.spec.ts +++ b/packages/js/core/src/__tests__/get-implementations.spec.ts @@ -89,24 +89,55 @@ describe("getImplementations", () => { implementations ); - expect(getImplementationsResult1).toBeTruthy(); expect(getImplementationsResult1).toEqual([ new Uri(implementation1Uri), new Uri(implementation2Uri), new Uri(implementation3Uri) ]); - expect(getImplementationsResult2).toBeTruthy(); expect(getImplementationsResult2).toEqual([ new Uri(implementation1Uri), new Uri(implementation2Uri), new Uri(implementation3Uri) ]); - expect(getImplementationsResult3).toBeTruthy(); expect(getImplementationsResult3).toEqual([ new Uri(implementation3Uri), new Uri(implementation4Uri) ]); }); + + it("interface implementations are not redirected", () => { + const interface1Uri = "w3://ens/some-interface1.eth"; + + const implementation1Uri = "w3://ens/some-implementation.eth"; + const implementation2Uri = "w3://ens/some-implementation2.eth"; + + const redirects: UriRedirect[] = [ + { + from: new Uri(implementation1Uri), + to: new Uri(implementation2Uri) + } + ]; + + const implementations: InterfaceImplementations[] = [ + { + interface: new Uri(interface1Uri), + implementations: [ + new Uri(implementation1Uri) + ] + } + ]; + + const getImplementationsResult = getImplementations( + new Uri(interface1Uri), + redirects, + [], + implementations + ); + + expect(getImplementationsResult).toEqual([ + new Uri(implementation1Uri) + ]); + }); }); From a6b4c41c02ecaaca08062b36edb9ba372d0e1ea4 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 10:44:26 +0200 Subject: [PATCH 043/112] loadWeb3Api - type test --- .../src/__tests__/Web3ApiClient.spec.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 62cf8d2743..1dd56beb71 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -1169,4 +1169,34 @@ describe("Web3ApiClient", () => { /Property must be of type 'array'. Found 'map'./ ); }); + + it("loadWeb3Api - pass string or Uri", async () => { + const implementationUri = "w3://ens/some-implementation.eth"; + const schemaStr = "test-schema"; + + const client = new Web3ApiClient({ + plugins: [ + { + uri: implementationUri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: schemaStr, + implemented: [], + imported: [], + } + } + } + ] + }); + + const apiWhenString = await client.loadWeb3Api(implementationUri); + const apiWhenUri = await client.loadWeb3Api(new Uri(implementationUri)); + + const schemaWhenString = await apiWhenString.getSchema(client); + const schemaWhenUri = await apiWhenUri.getSchema(client); + + expect(schemaWhenString).toEqual(schemaStr); + expect(schemaWhenUri).toEqual(schemaStr); + }); }); From 90a12b2ad797080573fd86cfecad88968004445c Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 10:48:22 +0200 Subject: [PATCH 044/112] using applyRedirects for client.getImplementations --- packages/js/client/src/Web3ApiClient.ts | 8 ++++++-- packages/js/client/src/__tests__/Web3ApiClient.spec.ts | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 58db41b463..3eb1e32844 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -252,8 +252,12 @@ export class Web3ApiClient implements Client { return run(typedUri); } - public getImplementations(uri: string): string[]; - public getImplementations(uri: Uri): Uri[]; + public getImplementations( + uri: string, + filters?: { applyRedirects: boolean }): string[]; + public getImplementations( + uri: Uri, + filters?: { applyRedirects: boolean }): Uri[]; public getImplementations( uri: string | Uri, filters: { applyRedirects: boolean } = { applyRedirects: false } diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 1dd56beb71..d1b6061abd 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -201,9 +201,9 @@ describe("Web3ApiClient", () => { ] }); - const implementations1 = client.getAllImplementations(interface1Uri); - const implementations2 = client.getAllImplementations(interface2Uri); - const implementations3 = client.getAllImplementations(interface3Uri); + const implementations1 = client.getImplementations(interface1Uri, { applyRedirects: true }); + const implementations2 = client.getImplementations(interface2Uri, { applyRedirects: true }); + const implementations3 = client.getImplementations(interface3Uri, { applyRedirects: true }); expect(implementations1).toEqual([ implementation1Uri, From 04988a5be6e0577c932fb6039d8e0ed094272008 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 11:30:53 +0200 Subject: [PATCH 045/112] implemented coreInterfaceUris and added more tests --- packages/apis/console/web3api.yaml | 2 +- .../src/__tests__/Web3ApiClient.spec.ts | 2 +- .../client/src/get-default-client-config.ts | 10 +++---- .../InterfaceImplementations.spec.ts | 26 +++++++++++++++++++ .../src/__tests__/PluginRegistrations.spec.ts | 26 +++++++++++++++++++ .../js/core/src/__tests__/UriRedirect.spec.ts | 9 ------- .../js/core/src/algorithms/resolve-uri.ts | 3 ++- packages/js/core/src/index.ts | 1 + .../src/interfaces/core-interface-uris.ts | 6 +++++ packages/js/core/src/interfaces/index.ts | 1 + packages/js/plugins/ens/src/resolvers.ts | 2 +- packages/js/plugins/ipfs/src/resolvers.ts | 2 +- packages/js/plugins/logger/README.md | 8 +++--- .../logger/src/__tests__/e2e/e2e.spec.ts | 2 +- 14 files changed, 76 insertions(+), 24 deletions(-) create mode 100644 packages/js/core/src/__tests__/InterfaceImplementations.spec.ts create mode 100644 packages/js/core/src/__tests__/PluginRegistrations.spec.ts create mode 100644 packages/js/core/src/interfaces/core-interface-uris.ts create mode 100644 packages/js/core/src/interfaces/index.ts diff --git a/packages/apis/console/web3api.yaml b/packages/apis/console/web3api.yaml index 26e902703a..eabd8a5979 100644 --- a/packages/apis/console/web3api.yaml +++ b/packages/apis/console/web3api.yaml @@ -8,5 +8,5 @@ query: language: wasm/assemblyscript file: ./src/query/index.ts import_redirects: - - uri: w3://w3/logger + - uri: w3://ens/js-logger.web3api.eth schema: ../../core-apis/logger/schema.graphql diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index d1b6061abd..bb5c8ef540 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -77,7 +77,7 @@ describe("Web3ApiClient", () => { "w3://ens/ipfs.web3api.eth", "w3://ens/ens.web3api.eth", "w3://ens/ethereum.web3api.eth", - "w3://w3/logger" + "w3://ens/js-logger.web3api.eth" ]; const client = new Web3ApiClient({ diff --git a/packages/js/client/src/get-default-client-config.ts b/packages/js/client/src/get-default-client-config.ts index 108cb8daf1..197ee18d61 100644 --- a/packages/js/client/src/get-default-client-config.ts +++ b/packages/js/client/src/get-default-client-config.ts @@ -1,4 +1,4 @@ -import { Uri } from "@web3api/core-js"; +import { Uri, coreInterfaceUris } from "@web3api/core-js"; import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; import { ensPlugin } from "@web3api/ens-plugin-js"; @@ -34,22 +34,22 @@ export const getDefaultClientConfig = Tracer.traceFunc( }), }, { - uri: new Uri("w3://w3/logger"), + uri: new Uri("w3://ens/js-logger.web3api.eth"), plugin: loggerPlugin(), }, ], interfaces: [ { - interface: new Uri("w3/api-resolver"), + interface: coreInterfaceUris.apiResolver, implementations: [ new Uri("w3://ens/ipfs.web3api.eth"), new Uri("w3://ens/ens.web3api.eth") ] }, { - interface: new Uri("w3/logger"), + interface: coreInterfaceUris.logger, implementations: [ - new Uri("w3://w3/logger") + new Uri("w3://ens/js-logger.web3api.eth") ] } ] diff --git a/packages/js/core/src/__tests__/InterfaceImplementations.spec.ts b/packages/js/core/src/__tests__/InterfaceImplementations.spec.ts new file mode 100644 index 0000000000..0b4bd442b0 --- /dev/null +++ b/packages/js/core/src/__tests__/InterfaceImplementations.spec.ts @@ -0,0 +1,26 @@ +import { Uri } from "../"; +import { sanitizeInterfaceImplementations } from "../types"; + +describe("sanitizeInterfaceImplementations", () => { + it("Returns empty array if empty array passed", () => { + const interfaces = sanitizeInterfaceImplementations([]); + + expect(interfaces).toEqual([]); + }); + + it("Returns interfaces from interfaces definitions", () => { + const interfaces = sanitizeInterfaceImplementations([ + { + interface: "w3://w3/interface", + implementations: ["w3://w3/api1", "w3://w3/api2"] + } + ]); + + expect(interfaces).toEqual([ + { + interface: new Uri("w3://w3/interface"), + implementations: [new Uri("w3://w3/api1"), new Uri("w3://w3/api2")] + } + ]); + }); +}); diff --git a/packages/js/core/src/__tests__/PluginRegistrations.spec.ts b/packages/js/core/src/__tests__/PluginRegistrations.spec.ts new file mode 100644 index 0000000000..fbce4568f5 --- /dev/null +++ b/packages/js/core/src/__tests__/PluginRegistrations.spec.ts @@ -0,0 +1,26 @@ +import { Uri } from "../"; +import { PluginPackage, sanitizePluginRegistrations } from "../types"; + +describe("sanitizePluginRegistrations", () => { + it("Returns empty array if empty array passed", () => { + const plugins = sanitizePluginRegistrations([]); + + expect(plugins).toEqual([]); + }); + + it("Returns plugins from plugins definitions", () => { + const plugins = sanitizePluginRegistrations([ + { + uri: "w3://w3/api", + plugin: {} as PluginPackage, + } + ]); + + expect(plugins).toEqual([ + { + uri: new Uri("w3://w3/api"), + plugin: {} as PluginPackage + } + ]); + }); +}); diff --git a/packages/js/core/src/__tests__/UriRedirect.spec.ts b/packages/js/core/src/__tests__/UriRedirect.spec.ts index c822454da7..70651123e8 100644 --- a/packages/js/core/src/__tests__/UriRedirect.spec.ts +++ b/packages/js/core/src/__tests__/UriRedirect.spec.ts @@ -1,5 +1,4 @@ import { Uri } from "../"; -import { PluginPackage } from "../types"; import { sanitizeUriRedirects } from "../types/UriRedirect"; describe("sanitizeUriRedirects", () => { @@ -14,10 +13,6 @@ describe("sanitizeUriRedirects", () => { { from: "w3://w3/api", to: "w3://w3/api" - }, - { - from: "w3://w3/api", - to: {} as PluginPackage, } ]); @@ -25,10 +20,6 @@ describe("sanitizeUriRedirects", () => { { from: new Uri("w3://w3/api"), to: new Uri("w3://w3/api") - }, - { - from: new Uri("w3://w3/api"), - to: {} as PluginPackage, } ]); }); diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 77a3b85181..6b2f97b287 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -14,6 +14,7 @@ import { findPluginPackage } from "./find-plugin-package"; import { getImplementations } from "./get-implementations"; import { Tracer } from "@web3api/tracing-js"; +import { coreInterfaceUris } from "../interfaces"; export const resolveUri = Tracer.traceFunc( "core: resolveUri", @@ -40,7 +41,7 @@ export const resolveUri = Tracer.traceFunc( // The final URI has been resolved, let's now resolve the Web3API package const uriResolverImplementations = getImplementations( - new Uri("w3/api-resolver"), + coreInterfaceUris.apiResolver, redirects, plugins, interfaces diff --git a/packages/js/core/src/index.ts b/packages/js/core/src/index.ts index a9b255d330..78f6903cc7 100644 --- a/packages/js/core/src/index.ts +++ b/packages/js/core/src/index.ts @@ -1,4 +1,5 @@ export * from "./types"; export * from "./algorithms"; export * from "./apis"; +export * from "./interfaces"; export * from "./manifest"; diff --git a/packages/js/core/src/interfaces/core-interface-uris.ts b/packages/js/core/src/interfaces/core-interface-uris.ts new file mode 100644 index 0000000000..0b91ba82a9 --- /dev/null +++ b/packages/js/core/src/interfaces/core-interface-uris.ts @@ -0,0 +1,6 @@ +import { Uri } from "../"; + +export const coreInterfaceUris = { + apiResolver: new Uri("w3://ens/api-resolver.core.web3api.eth"), + logger: new Uri("w3://ens/logger.core.web3api.eth") +}; \ No newline at end of file diff --git a/packages/js/core/src/interfaces/index.ts b/packages/js/core/src/interfaces/index.ts new file mode 100644 index 0000000000..a0fd40febb --- /dev/null +++ b/packages/js/core/src/interfaces/index.ts @@ -0,0 +1 @@ +export * from "./core-interface-uris"; \ No newline at end of file diff --git a/packages/js/plugins/ens/src/resolvers.ts b/packages/js/plugins/ens/src/resolvers.ts index 96cf18a4f5..f9a44feaa5 100644 --- a/packages/js/plugins/ens/src/resolvers.ts +++ b/packages/js/plugins/ens/src/resolvers.ts @@ -3,7 +3,7 @@ import { EnsPlugin } from "./"; import { Client, PluginModule } from "@web3api/core-js"; export const query = (ens: EnsPlugin, client: Client): PluginModule => ({ - // w3/api-resolver + //apiResolver tryResolveUri: async (input: { authority: string; path: string }) => { if (input.authority !== "ens") { return null; diff --git a/packages/js/plugins/ipfs/src/resolvers.ts b/packages/js/plugins/ipfs/src/resolvers.ts index b2461f9fbd..1d23845ad5 100644 --- a/packages/js/plugins/ipfs/src/resolvers.ts +++ b/packages/js/plugins/ipfs/src/resolvers.ts @@ -22,7 +22,7 @@ export const query = (ipfs: IpfsPlugin): PluginModule => ({ }): Promise => { return await ipfs.resolve(input.cid, input.options); }, - // w3/api-resolver + // apiResolver tryResolveUri: async (input: { authority: string; path: string }) => { if (input.authority !== "ipfs") { return null; diff --git a/packages/js/plugins/logger/README.md b/packages/js/plugins/logger/README.md index 0941619ec4..cd5dc49339 100644 --- a/packages/js/plugins/logger/README.md +++ b/packages/js/plugins/logger/README.md @@ -1,6 +1,6 @@ # Consoler Logger Plugin -Console Logger plugin implements the `w3://w3/logger` core Web3API interface. By default it logs all events using the Javascript `console` module. Different logging mechanisms can be set using the `LoggerConfig`. +Console Logger plugin implements the `w3://ens/logger.core.web3api.eth` core Web3API interface. By default it logs all events using the Javascript `console` module. Different logging mechanisms can be set using the `LoggerConfig`. ## Log levels @@ -15,8 +15,8 @@ Console Logger plugin implements the `w3://w3/logger` core Web3API interface. By import { loggerPlugin, LogLevel } from "@web3api/logger-plugin-js"; const client = new Web3ApiClient({ - redirects: { - from: "w3://w3/logger", + plugins: { + from: "w3://ens/js-logger.web3api.eth", to: loggerPlugin() } }); @@ -25,7 +25,7 @@ const client = new Web3ApiClient({ // loggerPlugin((level: LogLevel, message: string) => { ... }) const response = await client.query<{ log: boolean }>({ - uri: "w3://w3/logger", + uri: "w3://ens/js-logger.web3api.eth", query: ` query { log( diff --git a/packages/js/plugins/logger/src/__tests__/e2e/e2e.spec.ts b/packages/js/plugins/logger/src/__tests__/e2e/e2e.spec.ts index 42758efb21..d35c2be0f1 100644 --- a/packages/js/plugins/logger/src/__tests__/e2e/e2e.spec.ts +++ b/packages/js/plugins/logger/src/__tests__/e2e/e2e.spec.ts @@ -7,7 +7,7 @@ describe("log method", () => { const web3ApiClient = new Web3ApiClient() const response = await web3ApiClient.query<{ log: boolean }>({ - uri: "w3://w3/logger", + uri: "w3://ens/js-logger.web3api.eth", query: ` query { log( From 8a8d4c003de58585f50dbc43c7c64306574cdf0f Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 12:10:52 +0200 Subject: [PATCH 046/112] core interface uri changes --- packages/apis/console/README.md | 2 +- packages/apis/console/src/query/schema.graphql | 2 +- packages/js/client/src/__tests__/Web3ApiClient.spec.ts | 6 +++++- packages/js/core/src/__tests__/resolve-uri.spec.ts | 10 ++++++---- packages/js/plugins/ens/src/manifest.ts | 4 ++-- packages/js/plugins/ipfs/src/manifest.ts | 4 ++-- packages/js/plugins/logger/src/manifest.ts | 2 +- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/apis/console/README.md b/packages/apis/console/README.md index 3b2cca7259..83b183494f 100644 --- a/packages/apis/console/README.md +++ b/packages/apis/console/README.md @@ -1,6 +1,6 @@ # Console Web3API -Calls log on logger plugin at uri `w3://w3/logger`. Default logger logs to console, but can be overridden with redirect to custom logger web3api implementation. +Calls log on logger plugin at uri `w3://ens/js-logger.web3api.eth`. Default logger logs to console, but can be overridden with redirect to custom logger web3api implementation. ### Log levels diff --git a/packages/apis/console/src/query/schema.graphql b/packages/apis/console/src/query/schema.graphql index c1d913f6fe..48ad56181a 100644 --- a/packages/apis/console/src/query/schema.graphql +++ b/packages/apis/console/src/query/schema.graphql @@ -1,4 +1,4 @@ -#import { Query, LogLevel } into Logger from "w3://w3/logger" +#import { Query, LogLevel } into Logger from "w3://ens/js-logger.web3api.eth" type Query { debug( diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index bb5c8ef540..af137fde9d 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -11,6 +11,7 @@ import { } from "@web3api/test-env-js"; import { GetPathToTestApis } from "@web3api/test-cases"; import { Web3ApiClient } from "../Web3ApiClient"; +import { getDefaultClientConfig } from "../get-default-client-config"; jest.setTimeout(50000); @@ -120,6 +121,9 @@ describe("Web3ApiClient", () => { const interfaces = client.interfaces(); + + const defaultClientConfig = getDefaultClientConfig(); + expect(interfaces).toEqual([ { interface: new Uri(interfaceUri), @@ -128,7 +132,7 @@ describe("Web3ApiClient", () => { new Uri(implementation2Uri) ] } - ]); + ].concat(defaultClientConfig.interfaces ?? [])); const implementations = client.getImplementations(interfaceUri); diff --git a/packages/js/core/src/__tests__/resolve-uri.spec.ts b/packages/js/core/src/__tests__/resolve-uri.spec.ts index 18e21f4a27..0a8232289f 100644 --- a/packages/js/core/src/__tests__/resolve-uri.spec.ts +++ b/packages/js/core/src/__tests__/resolve-uri.spec.ts @@ -14,6 +14,7 @@ import { UriRedirect, resolveUri, } from "../"; +import { coreInterfaceUris } from "../interfaces"; import { InterfaceImplementations, PluginRegistration } from "../types"; describe("resolveUri", () => { @@ -115,7 +116,7 @@ describe("resolveUri", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implemented: [new Uri("w3/api-resolver")], + implemented: [coreInterfaceUris.apiResolver], imported: [], }, }, @@ -124,10 +125,11 @@ describe("resolveUri", () => { const interfaces: InterfaceImplementations[] = [ { - interface: new Uri("w3/api-resolver"), + interface: coreInterfaceUris.apiResolver, implementations: [ new Uri("ens/ens"), - new Uri("ens/ipfs") + new Uri("ens/ipfs"), + new Uri("ens/my-plugin") ] }, ]; @@ -319,7 +321,7 @@ describe("resolveUri", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implemented: [new Uri("w3/api-resolver")], + implemented: [coreInterfaceUris.apiResolver], imported: [], }, }, diff --git a/packages/js/plugins/ens/src/manifest.ts b/packages/js/plugins/ens/src/manifest.ts index d5eec16222..fb0f4c3512 100644 --- a/packages/js/plugins/ens/src/manifest.ts +++ b/packages/js/plugins/ens/src/manifest.ts @@ -1,4 +1,4 @@ -import { PluginManifest, Uri } from "@web3api/core-js"; +import { PluginManifest, Uri, coreInterfaceUris } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql @@ -24,6 +24,6 @@ type ApiResolver_MaybeUriOrManifest { uri: String manifest: String }`, - implemented: [new Uri("w3/api-resolver")], + implemented: [coreInterfaceUris.apiResolver], imported: [new Uri("ens/ethereum.web3api.eth")], }; diff --git a/packages/js/plugins/ipfs/src/manifest.ts b/packages/js/plugins/ipfs/src/manifest.ts index 7f6ca20cb7..87b3813ccc 100644 --- a/packages/js/plugins/ipfs/src/manifest.ts +++ b/packages/js/plugins/ipfs/src/manifest.ts @@ -1,4 +1,4 @@ -import { PluginManifest, Uri } from "@web3api/core-js"; +import { PluginManifest, coreInterfaceUris } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql @@ -54,6 +54,6 @@ type ApiResolver_MaybeUriOrManifest { uri: String manifest: String }`, - implemented: [new Uri("w3/api-resolver")], + implemented: [coreInterfaceUris.apiResolver], imported: [], }; diff --git a/packages/js/plugins/logger/src/manifest.ts b/packages/js/plugins/logger/src/manifest.ts index 7db59fc2d9..3124e16806 100644 --- a/packages/js/plugins/logger/src/manifest.ts +++ b/packages/js/plugins/logger/src/manifest.ts @@ -21,6 +21,6 @@ type Query { ): Boolean! } `, - implemented: [new Uri("w3/logger")], + implemented: [new Uri("w3://ens/logger.core.web3api.eth")], imported: [], }; From 0f07dea841ca208fdad54c3b71b669a5e389ff26 Mon Sep 17 00:00:00 2001 From: jbogunovic Date: Fri, 11 Jun 2021 14:24:24 +0200 Subject: [PATCH 047/112] added test for default client config --- .../src/__tests__/Web3ApiClient.spec.ts | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index af137fde9d..cf73b0e2ed 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -12,6 +12,11 @@ import { import { GetPathToTestApis } from "@web3api/test-cases"; import { Web3ApiClient } from "../Web3ApiClient"; import { getDefaultClientConfig } from "../get-default-client-config"; +import { ensPlugin } from "@web3api/ens-plugin-js"; +import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; +import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; +import { loggerPlugin } from "@web3api/logger-plugin-js"; +import { coreInterfaceUris } from '@web3api/core-js'; jest.setTimeout(50000); @@ -48,6 +53,50 @@ describe("Web3ApiClient", () => { } }, config); } + + it("default client config", () => { + const client = new Web3ApiClient(); + + expect(client.redirects()).toEqual([]); + expect(client.plugins()).toEqual([ + { + uri: new Uri("w3://ens/ipfs.web3api.eth"), + plugin: ipfsPlugin({ provider: "https://ipfs.io" }), + }, + { + uri: new Uri("w3://ens/ens.web3api.eth"), + plugin: ensPlugin({}), + }, + { + plugin: ethereumPlugin({ + networks: { + mainnet: { + provider: + "https://mainnet.infura.io/v3/b00b2c2cc09c487685e9fb061256d6a6", + }, + }, + }), + }, + { + uri: new Uri("w3://ens/js-logger.web3api.eth"), + plugin: loggerPlugin(), + }, + ]); + expect(client.interfaces()).toEqual([ + { + interface: coreInterfaceUris.apiResolver, + implementations: [ + new Uri("w3://ens/ipfs.web3api.eth"), + new Uri("w3://ens/ens.web3api.eth") + ] + }, + { + interface: coreInterfaceUris.logger, + implementations: [ + new Uri("w3://ens/js-logger.web3api.eth") + ] + }]); + }); it("redirect registration", () => { const implementation1Uri = "w3://ens/some-implementation1.eth"; From a8dc277024c1245a24b3f5e51b85cdb54f74676a Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 16:52:00 +0200 Subject: [PATCH 048/112] added tests for client get implementations - string and uri overloads --- packages/js/client/src/Web3ApiClient.ts | 31 +++++++++++----- .../src/__tests__/Web3ApiClient.spec.ts | 37 +++++++++++++++++++ 2 files changed, 59 insertions(+), 9 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 3eb1e32844..8922350e71 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -149,7 +149,7 @@ export class Web3ApiClient implements Client { parallelInvocations.push( this.invoke({ ...queryInvocations[invocationName], - uri: queryInvocations[invocationName].uri.uri, + uri: queryInvocations[invocationName].uri, decode: true, }).then((result) => ({ name: invocationName, @@ -192,20 +192,33 @@ export class Web3ApiClient implements Client { public async invoke( options: InvokeApiOptions + ): Promise> + public async invoke( + options: InvokeApiOptions + ): Promise> + public async invoke( + options: InvokeApiOptions ): Promise> { + let typedOptions: InvokeApiOptions; + + if(typeof options.uri === "string") { + typedOptions = { + ...options, + uri: new Uri(options.uri) + }; + } else { + typedOptions = options as InvokeApiOptions; + } + const run = Tracer.traceFunc( "Web3ApiClient: invoke", async ( - options: InvokeApiOptions + options: InvokeApiOptions ): Promise> => { - const uri = new Uri(options.uri); - const api = await this.loadWeb3Api(uri); + const api = await this.loadWeb3Api(options.uri); const result = (await api.invoke( - { - ...options, - uri, - }, + options, this )) as TData; @@ -213,7 +226,7 @@ export class Web3ApiClient implements Client { } ); - return run(options); + return run(typedOptions); } public async loadWeb3Api(uri: string): Promise; diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index af137fde9d..badc0e6b8d 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -1203,4 +1203,41 @@ describe("Web3ApiClient", () => { expect(schemaWhenString).toEqual(schemaStr); expect(schemaWhenUri).toEqual(schemaStr); }); + + it("getImplementations - pass string or Uri", async () => { + const client = new Web3ApiClient({ + redirects: [ + { + from: "old", + to: "new" + } + ], + interfaces: [ + { + interface: "old", + implementations: [ + "ens/1", + ] + }, + { + interface: "new", + implementations: [ + "ens/2", + ] + } + ] + }); + + let result = client.getImplementations("old"); + expect(result).toEqual(["ens/1"]); + + result = client.getImplementations("old", { applyRedirects: true }); + expect(result).toEqual(["ens/1", "ens/2"]); + + let result2 = client.getImplementations(new Uri("old")); + expect(result2).toEqual([new Uri("ens/1")]); + + result2 = client.getImplementations(new Uri("old"), { applyRedirects: true }); + expect(result2).toEqual([new Uri("ens/1"), new Uri("ens/2")]); + }); }); From a763f69aa13b4cffad906134d9628db71662b57e Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 17:47:49 +0200 Subject: [PATCH 049/112] fixed default config test --- .../src/__tests__/Web3ApiClient.spec.ts | 76 ++++++++----------- 1 file changed, 32 insertions(+), 44 deletions(-) diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 0620661794..9eeb877fad 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -12,10 +12,6 @@ import { import { GetPathToTestApis } from "@web3api/test-cases"; import { Web3ApiClient } from "../Web3ApiClient"; import { getDefaultClientConfig } from "../get-default-client-config"; -import { ensPlugin } from "@web3api/ens-plugin-js"; -import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; -import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; -import { loggerPlugin } from "@web3api/logger-plugin-js"; import { coreInterfaceUris } from '@web3api/core-js'; jest.setTimeout(50000); @@ -57,32 +53,18 @@ describe("Web3ApiClient", () => { it("default client config", () => { const client = new Web3ApiClient(); - expect(client.redirects()).toEqual([]); - expect(client.plugins()).toEqual([ - { - uri: new Uri("w3://ens/ipfs.web3api.eth"), - plugin: ipfsPlugin({ provider: "https://ipfs.io" }), - }, - { - uri: new Uri("w3://ens/ens.web3api.eth"), - plugin: ensPlugin({}), - }, - { - plugin: ethereumPlugin({ - networks: { - mainnet: { - provider: - "https://mainnet.infura.io/v3/b00b2c2cc09c487685e9fb061256d6a6", - }, - }, - }), - }, - { - uri: new Uri("w3://ens/js-logger.web3api.eth"), - plugin: loggerPlugin(), - }, - ]); - expect(client.interfaces()).toEqual([ + expect(client.redirects()).toStrictEqual([]); + expect( + client.plugins().map(x => x.uri) + ).toStrictEqual([ + new Uri("w3://ens/ipfs.web3api.eth"), + new Uri("w3://ens/ens.web3api.eth"), + new Uri("w3://ens/ethereum.web3api.eth"), + new Uri("w3://ens/js-logger.web3api.eth") + ]); + expect( + client.interfaces() + ).toStrictEqual([ { interface: coreInterfaceUris.apiResolver, implementations: [ @@ -1254,39 +1236,45 @@ describe("Web3ApiClient", () => { }); it("getImplementations - pass string or Uri", async () => { + const oldInterfaceUri = "ens/old.eth"; + const newInterfaceUri = "ens/new.eth"; + + const implementation1Uri = "w3://ens/some-implementation1.eth"; + const implementation2Uri = "w3://ens/some-implementation2.eth"; + const client = new Web3ApiClient({ redirects: [ { - from: "old", - to: "new" + from: oldInterfaceUri, + to: newInterfaceUri } ], interfaces: [ { - interface: "old", + interface: oldInterfaceUri, implementations: [ - "ens/1", + implementation1Uri, ] }, { - interface: "new", + interface: newInterfaceUri, implementations: [ - "ens/2", + implementation2Uri, ] } ] }); - let result = client.getImplementations("old"); - expect(result).toEqual(["ens/1"]); + let result = client.getImplementations(oldInterfaceUri); + expect(result).toEqual([implementation1Uri]); - result = client.getImplementations("old", { applyRedirects: true }); - expect(result).toEqual(["ens/1", "ens/2"]); + result = client.getImplementations(oldInterfaceUri, { applyRedirects: true }); + expect(result).toEqual([implementation1Uri, implementation2Uri]); - let result2 = client.getImplementations(new Uri("old")); - expect(result2).toEqual([new Uri("ens/1")]); + let result2 = client.getImplementations(new Uri(oldInterfaceUri)); + expect(result2).toEqual([new Uri(implementation1Uri)]); - result2 = client.getImplementations(new Uri("old"), { applyRedirects: true }); - expect(result2).toEqual([new Uri("ens/1"), new Uri("ens/2")]); + result2 = client.getImplementations(new Uri(oldInterfaceUri), { applyRedirects: true }); + expect(result2).toEqual([new Uri(implementation1Uri), new Uri(implementation2Uri)]); }); }); From e6870ad636085bf39662b1d24f88993b3efaa1b5 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 18:12:58 +0200 Subject: [PATCH 050/112] client.query method now has overloads for uri string and uri types --- packages/js/client/src/Web3ApiClient.ts | 29 +++++++++-- .../src/__tests__/Web3ApiClient.spec.ts | 48 ++++++++++++++++--- 2 files changed, 68 insertions(+), 9 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 8922350e71..ef1b51fb51 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -120,11 +120,34 @@ export class Web3ApiClient implements Client { TVariables extends Record = Record >( options: QueryApiOptions + ): Promise> + public async query< + TData extends Record = Record, + TVariables extends Record = Record + >( + options: QueryApiOptions + ): Promise> + public async query< + TData extends Record = Record, + TVariables extends Record = Record + >( + options: QueryApiOptions ): Promise> { + let typedOptions: QueryApiOptions; + + if(typeof options.uri === "string") { + typedOptions = { + ...options, + uri: new Uri(options.uri) + }; + } else { + typedOptions = options as QueryApiOptions; + } + const run = Tracer.traceFunc( "Web3ApiClient: query", async ( - options: QueryApiOptions + options: QueryApiOptions ): Promise> => { const { uri, query, variables } = options; @@ -134,7 +157,7 @@ export class Web3ApiClient implements Client { // Parse the query to understand what's being invoked const queryInvocations = parseQuery( - new Uri(uri), + uri, queryDocument, variables ); @@ -181,7 +204,7 @@ export class Web3ApiClient implements Client { } ); - return await run(options).catch((error) => { + return await run(typedOptions).catch((error) => { if (error.length) { return { errors: error }; } else { diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 9eeb877fad..9d47ddb2cb 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -409,7 +409,7 @@ describe("Web3ApiClient", () => { expect(set.data).toBeTruthy(); expect(set.data?.setData.indexOf("0x")).toBeGreaterThan(-1); - const get = await client.query<{ + const getWithStringType = await client.query<{ getData: number; secondGetData: number; thirdGetData: number; @@ -439,11 +439,47 @@ describe("Web3ApiClient", () => { `, }); - expect(get.errors).toBeFalsy(); - expect(get.data).toBeTruthy(); - expect(get.data?.getData).toBe(55); - expect(get.data?.secondGetData).toBe(55); - expect(get.data?.thirdGetData).toBe(55); + expect(getWithStringType.errors).toBeFalsy(); + expect(getWithStringType.data).toBeTruthy(); + expect(getWithStringType.data?.getData).toBe(55); + expect(getWithStringType.data?.secondGetData).toBe(55); + expect(getWithStringType.data?.thirdGetData).toBe(55); + + const getWithUriType = await client.query<{ + getData: number; + secondGetData: number; + thirdGetData: number; + }>({ + uri: new Uri(ensUri), + query: ` + query { + getData( + address: "${address}" + connection: { + networkNameOrChainId: "testnet" + } + ) + secondGetData: getData( + address: "${address}" + connection: { + networkNameOrChainId: "testnet" + } + ) + thirdGetData: getData( + address: "${address}" + connection: { + networkNameOrChainId: "testnet" + } + ) + } + `, + }); + + expect(getWithUriType.errors).toBeFalsy(); + expect(getWithUriType.data).toBeTruthy(); + expect(getWithUriType.data?.getData).toBe(55); + expect(getWithUriType.data?.secondGetData).toBe(55); + expect(getWithUriType.data?.thirdGetData).toBe(55); }); it("object-types", async () => { From 9b327d58ab7d6927cfa5db2cc66742648e0e309e Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 18:19:55 +0200 Subject: [PATCH 051/112] covered can not redirect to self test case --- .../js/core/src/__tests__/apply-redirects.spec.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/js/core/src/__tests__/apply-redirects.spec.ts b/packages/js/core/src/__tests__/apply-redirects.spec.ts index 33a905be8b..cd051e2371 100644 --- a/packages/js/core/src/__tests__/apply-redirects.spec.ts +++ b/packages/js/core/src/__tests__/apply-redirects.spec.ts @@ -37,4 +37,17 @@ describe("applyRedirects", () => { expect(Uri.equals(redirectedUri, new Uri(uri2))).toBeTruthy(); }); + + it("can not redirect to self", () => { + const uri = "w3://ens/some-uri.eth"; + + expect(() => { + applyRedirects(new Uri(uri), [ + { + from: new Uri(uri), + to: new Uri(uri) + } + ]); + }).toThrow(/Infinite loop while resolving URI/); + }); }); From d4069e94f33f2de38e488686de3b7c35f771181b Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 19:17:47 +0200 Subject: [PATCH 052/112] lint fix --- packages/js/client/src/Web3ApiClient.ts | 47 ++++++++----------- .../client/src/get-default-client-config.ts | 17 ++++--- .../js/core/src/algorithms/resolve-uri.ts | 2 +- .../src/interfaces/core-interface-uris.ts | 4 +- packages/js/core/src/interfaces/index.ts | 2 +- 5 files changed, 32 insertions(+), 40 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index ef1b51fb51..06f514e403 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -70,15 +70,15 @@ export class Web3ApiClient implements Client { // Add the default config const defaultClientConfig = getDefaultClientConfig(); - if(defaultClientConfig.redirects) { - this._config.redirects.push(...defaultClientConfig.redirects) + if (defaultClientConfig.redirects) { + this._config.redirects.push(...defaultClientConfig.redirects); } - if(defaultClientConfig.plugins) { + if (defaultClientConfig.plugins) { this._config.plugins.push(...defaultClientConfig.plugins); } - if(defaultClientConfig.interfaces) { + if (defaultClientConfig.interfaces) { this._config.interfaces.push(...defaultClientConfig.interfaces); } @@ -120,13 +120,11 @@ export class Web3ApiClient implements Client { TVariables extends Record = Record >( options: QueryApiOptions - ): Promise> + ): Promise>; public async query< TData extends Record = Record, TVariables extends Record = Record - >( - options: QueryApiOptions - ): Promise> + >(options: QueryApiOptions): Promise>; public async query< TData extends Record = Record, TVariables extends Record = Record @@ -134,11 +132,11 @@ export class Web3ApiClient implements Client { options: QueryApiOptions ): Promise> { let typedOptions: QueryApiOptions; - - if(typeof options.uri === "string") { + + if (typeof options.uri === "string") { typedOptions = { ...options, - uri: new Uri(options.uri) + uri: new Uri(options.uri), }; } else { typedOptions = options as QueryApiOptions; @@ -156,11 +154,7 @@ export class Web3ApiClient implements Client { typeof query === "string" ? createQueryDocument(query) : query; // Parse the query to understand what's being invoked - const queryInvocations = parseQuery( - uri, - queryDocument, - variables - ); + const queryInvocations = parseQuery(uri, queryDocument, variables); // Execute all invocations in parallel const parallelInvocations: Promise<{ @@ -215,19 +209,19 @@ export class Web3ApiClient implements Client { public async invoke( options: InvokeApiOptions - ): Promise> + ): Promise>; public async invoke( options: InvokeApiOptions - ): Promise> + ): Promise>; public async invoke( options: InvokeApiOptions ): Promise> { let typedOptions: InvokeApiOptions; - - if(typeof options.uri === "string") { + + if (typeof options.uri === "string") { typedOptions = { ...options, - uri: new Uri(options.uri) + uri: new Uri(options.uri), }; } else { typedOptions = options as InvokeApiOptions; @@ -240,10 +234,7 @@ export class Web3ApiClient implements Client { ): Promise> => { const api = await this.loadWeb3Api(options.uri); - const result = (await api.invoke( - options, - this - )) as TData; + const result = (await api.invoke(options, this)) as TData; return result; } @@ -290,10 +281,12 @@ export class Web3ApiClient implements Client { public getImplementations( uri: string, - filters?: { applyRedirects: boolean }): string[]; + filters?: { applyRedirects: boolean } + ): string[]; public getImplementations( uri: Uri, - filters?: { applyRedirects: boolean }): Uri[]; + filters?: { applyRedirects: boolean } + ): Uri[]; public getImplementations( uri: string | Uri, filters: { applyRedirects: boolean } = { applyRedirects: false } diff --git a/packages/js/client/src/get-default-client-config.ts b/packages/js/client/src/get-default-client-config.ts index 197ee18d61..0cde59f841 100644 --- a/packages/js/client/src/get-default-client-config.ts +++ b/packages/js/client/src/get-default-client-config.ts @@ -1,10 +1,11 @@ +import { ClientConfig } from "."; + import { Uri, coreInterfaceUris } from "@web3api/core-js"; import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; import { ensPlugin } from "@web3api/ens-plugin-js"; import { loggerPlugin } from "@web3api/logger-plugin-js"; import { Tracer } from "@web3api/tracing-js"; -import { ClientConfig } from "."; export const getDefaultClientConfig = Tracer.traceFunc( "client-js: getDefaultClientConfig", @@ -42,17 +43,15 @@ export const getDefaultClientConfig = Tracer.traceFunc( { interface: coreInterfaceUris.apiResolver, implementations: [ - new Uri("w3://ens/ipfs.web3api.eth"), - new Uri("w3://ens/ens.web3api.eth") - ] + new Uri("w3://ens/ipfs.web3api.eth"), + new Uri("w3://ens/ens.web3api.eth"), + ], }, { interface: coreInterfaceUris.logger, - implementations: [ - new Uri("w3://ens/js-logger.web3api.eth") - ] - } - ] + implementations: [new Uri("w3://ens/js-logger.web3api.eth")], + }, + ], }; } ); diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 6b2f97b287..6a5e4f77b3 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -12,9 +12,9 @@ import * as ApiResolver from "../apis/api-resolver"; import { applyRedirects } from "./apply-redirects"; import { findPluginPackage } from "./find-plugin-package"; import { getImplementations } from "./get-implementations"; +import { coreInterfaceUris } from "../interfaces"; import { Tracer } from "@web3api/tracing-js"; -import { coreInterfaceUris } from "../interfaces"; export const resolveUri = Tracer.traceFunc( "core: resolveUri", diff --git a/packages/js/core/src/interfaces/core-interface-uris.ts b/packages/js/core/src/interfaces/core-interface-uris.ts index 0b91ba82a9..bfe595a23f 100644 --- a/packages/js/core/src/interfaces/core-interface-uris.ts +++ b/packages/js/core/src/interfaces/core-interface-uris.ts @@ -2,5 +2,5 @@ import { Uri } from "../"; export const coreInterfaceUris = { apiResolver: new Uri("w3://ens/api-resolver.core.web3api.eth"), - logger: new Uri("w3://ens/logger.core.web3api.eth") -}; \ No newline at end of file + logger: new Uri("w3://ens/logger.core.web3api.eth"), +}; diff --git a/packages/js/core/src/interfaces/index.ts b/packages/js/core/src/interfaces/index.ts index a0fd40febb..c10a2e0e65 100644 --- a/packages/js/core/src/interfaces/index.ts +++ b/packages/js/core/src/interfaces/index.ts @@ -1 +1 @@ -export * from "./core-interface-uris"; \ No newline at end of file +export * from "./core-interface-uris"; From ccc9e19b9ef99deaa863f9118e2d04b3e53174c7 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 20:43:23 +0200 Subject: [PATCH 053/112] renamed core apis to core interfaces, implemented full folder structure for logger interface, changed template for default api interface --- .../{core-apis => core-interfaces}/README.md | 0 .../api-resolver/.gitignore | 0 .../api-resolver/.nvmrc | 0 .../api-resolver/README.md | 0 .../api-resolver/package.json | 0 .../api-resolver/src/query.graphql | 0 .../api-resolver/web3api.yaml | 0 packages/core-interfaces/logger/.gitignore | 2 ++ packages/core-interfaces/logger/.nvmrc | 1 + packages/core-interfaces/logger/README.md | 13 +++++++++++++ packages/core-interfaces/logger/package.json | 18 ++++++++++++++++++ .../logger/src/query.graphql} | 0 .../logger/web3api.yaml | 6 +++--- packages/templates/api/interface/query.graphql | 18 ++++-------------- 14 files changed, 41 insertions(+), 17 deletions(-) rename packages/{core-apis => core-interfaces}/README.md (100%) rename packages/{core-apis => core-interfaces}/api-resolver/.gitignore (100%) rename packages/{core-apis => core-interfaces}/api-resolver/.nvmrc (100%) rename packages/{core-apis => core-interfaces}/api-resolver/README.md (100%) rename packages/{core-apis => core-interfaces}/api-resolver/package.json (100%) rename packages/{core-apis => core-interfaces}/api-resolver/src/query.graphql (100%) rename packages/{core-apis => core-interfaces}/api-resolver/web3api.yaml (100%) create mode 100644 packages/core-interfaces/logger/.gitignore create mode 100644 packages/core-interfaces/logger/.nvmrc create mode 100644 packages/core-interfaces/logger/README.md create mode 100644 packages/core-interfaces/logger/package.json rename packages/{core-apis/logger/schema.graphql => core-interfaces/logger/src/query.graphql} (100%) rename packages/{core-apis => core-interfaces}/logger/web3api.yaml (52%) diff --git a/packages/core-apis/README.md b/packages/core-interfaces/README.md similarity index 100% rename from packages/core-apis/README.md rename to packages/core-interfaces/README.md diff --git a/packages/core-apis/api-resolver/.gitignore b/packages/core-interfaces/api-resolver/.gitignore similarity index 100% rename from packages/core-apis/api-resolver/.gitignore rename to packages/core-interfaces/api-resolver/.gitignore diff --git a/packages/core-apis/api-resolver/.nvmrc b/packages/core-interfaces/api-resolver/.nvmrc similarity index 100% rename from packages/core-apis/api-resolver/.nvmrc rename to packages/core-interfaces/api-resolver/.nvmrc diff --git a/packages/core-apis/api-resolver/README.md b/packages/core-interfaces/api-resolver/README.md similarity index 100% rename from packages/core-apis/api-resolver/README.md rename to packages/core-interfaces/api-resolver/README.md diff --git a/packages/core-apis/api-resolver/package.json b/packages/core-interfaces/api-resolver/package.json similarity index 100% rename from packages/core-apis/api-resolver/package.json rename to packages/core-interfaces/api-resolver/package.json diff --git a/packages/core-apis/api-resolver/src/query.graphql b/packages/core-interfaces/api-resolver/src/query.graphql similarity index 100% rename from packages/core-apis/api-resolver/src/query.graphql rename to packages/core-interfaces/api-resolver/src/query.graphql diff --git a/packages/core-apis/api-resolver/web3api.yaml b/packages/core-interfaces/api-resolver/web3api.yaml similarity index 100% rename from packages/core-apis/api-resolver/web3api.yaml rename to packages/core-interfaces/api-resolver/web3api.yaml diff --git a/packages/core-interfaces/logger/.gitignore b/packages/core-interfaces/logger/.gitignore new file mode 100644 index 0000000000..e3fbd98336 --- /dev/null +++ b/packages/core-interfaces/logger/.gitignore @@ -0,0 +1,2 @@ +build +node_modules diff --git a/packages/core-interfaces/logger/.nvmrc b/packages/core-interfaces/logger/.nvmrc new file mode 100644 index 0000000000..158c00641a --- /dev/null +++ b/packages/core-interfaces/logger/.nvmrc @@ -0,0 +1 @@ +v14.16.0 diff --git a/packages/core-interfaces/logger/README.md b/packages/core-interfaces/logger/README.md new file mode 100644 index 0000000000..218f331fff --- /dev/null +++ b/packages/core-interfaces/logger/README.md @@ -0,0 +1,13 @@ +# Web3API Logger Interface + +# How To Run + +## Install Dependencies +`nvm install && nvm use` +`yarn` + +## Start Test Environment +`yarn test:env:up` + +## Build & Deploy Web3API +`yarn deploy` \ No newline at end of file diff --git a/packages/core-interfaces/logger/package.json b/packages/core-interfaces/logger/package.json new file mode 100644 index 0000000000..01a16df664 --- /dev/null +++ b/packages/core-interfaces/logger/package.json @@ -0,0 +1,18 @@ +{ + "name": "logger-interface", + "description": "Web3API Logger Interface", + "private": true, + "version": "0.0.1-prealpha.24", + "scripts": { + "build": "yarn build:web3api", + "build:web3api": "npx w3 build", + "test:env:up": "npx w3 test-env up", + "test:env:down": "npx w3 test-env down", + "deploy": "yarn deploy:web3api", + "deploy:web3api": "npx w3 build --ipfs http://localhost:5001" + }, + "devDependencies": { + "@web3api/cli": "0.0.1-prealpha.24", + "js-yaml": "3.14.0" + } +} diff --git a/packages/core-apis/logger/schema.graphql b/packages/core-interfaces/logger/src/query.graphql similarity index 100% rename from packages/core-apis/logger/schema.graphql rename to packages/core-interfaces/logger/src/query.graphql diff --git a/packages/core-apis/logger/web3api.yaml b/packages/core-interfaces/logger/web3api.yaml similarity index 52% rename from packages/core-apis/logger/web3api.yaml rename to packages/core-interfaces/logger/web3api.yaml index a782c3e2e3..812ff19f2d 100644 --- a/packages/core-apis/logger/web3api.yaml +++ b/packages/core-interfaces/logger/web3api.yaml @@ -1,7 +1,7 @@ -description: Web3API Logger Standard +description: Web3API Logger Interface format: 0.0.1-prealpha.1 repository: https://github.com/web3-api/monorepo -abstract: true +interface: true query: schema: - file: ./query.graphql + file: ./src/query.graphql diff --git a/packages/templates/api/interface/query.graphql b/packages/templates/api/interface/query.graphql index 046311f779..3f7b824e13 100644 --- a/packages/templates/api/interface/query.graphql +++ b/packages/templates/api/interface/query.graphql @@ -1,15 +1,5 @@ type Query { - tryResolveUri( - authority: String! - path: String! - ): MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} - -type MaybeUriOrManifest { - uri: String - manifest: String -} + methodToImplement( + arg: String + ): String +} \ No newline at end of file From b385a187bd2f660f40e5cd22fa2a5b40627506be Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 20:50:46 +0200 Subject: [PATCH 054/112] change schema reference path --- packages/apis/console/web3api.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apis/console/web3api.yaml b/packages/apis/console/web3api.yaml index eabd8a5979..402658d960 100644 --- a/packages/apis/console/web3api.yaml +++ b/packages/apis/console/web3api.yaml @@ -9,4 +9,4 @@ query: file: ./src/query/index.ts import_redirects: - uri: w3://ens/js-logger.web3api.eth - schema: ../../core-apis/logger/schema.graphql + schema: ../../core-interfaces/logger/schema.graphql From 7f7ad86a90794528ef71d322fe9f89605eedaaba Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 21:06:27 +0200 Subject: [PATCH 055/112] added a test case to cover ignoring non registered plugin implementations --- .../src/__tests__/get-implementations.spec.ts | 53 ++++++++++++++++--- .../src/algorithms/get-implementations.ts | 13 ----- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/packages/js/core/src/__tests__/get-implementations.spec.ts b/packages/js/core/src/__tests__/get-implementations.spec.ts index 50e65afa76..c66e6eb9a2 100644 --- a/packages/js/core/src/__tests__/get-implementations.spec.ts +++ b/packages/js/core/src/__tests__/get-implementations.spec.ts @@ -47,7 +47,7 @@ describe("getImplementations", () => { } ]; - const implementations: InterfaceImplementations[] = [ + const interfaces: InterfaceImplementations[] = [ { interface: new Uri(interface1Uri), implementations: [ @@ -74,19 +74,19 @@ describe("getImplementations", () => { new Uri(interface1Uri), redirects, plugins, - implementations + interfaces ); const getImplementationsResult2 = getImplementations( new Uri(interface2Uri), redirects, plugins, - implementations + interfaces ); const getImplementationsResult3 = getImplementations( new Uri(interface3Uri), redirects, plugins, - implementations + interfaces ); expect(getImplementationsResult1).toEqual([ @@ -120,7 +120,7 @@ describe("getImplementations", () => { } ]; - const implementations: InterfaceImplementations[] = [ + const interfaces: InterfaceImplementations[] = [ { interface: new Uri(interface1Uri), implementations: [ @@ -133,11 +133,52 @@ describe("getImplementations", () => { new Uri(interface1Uri), redirects, [], - implementations + interfaces ); expect(getImplementationsResult).toEqual([ new Uri(implementation1Uri) ]); }); + + it("do not return plugins that are not explicitly registered", () => { + const interfaceUri = "w3://ens/some-interface.eth"; + + const implementation1Uri = "w3://ens/some-implementation1.eth"; + const implementation2Uri = "w3://ens/some-implementation2.eth"; + + const plugins: PluginRegistration[] = [ + { + uri: new Uri(implementation1Uri), + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: '', + implemented: [new Uri(interfaceUri)], + imported: [], + } + } + } + ]; + + const interfaces: InterfaceImplementations[] = [ + { + interface: new Uri(interfaceUri), + implementations: [ + new Uri(implementation2Uri) + ] + } + ]; + + const getImplementationsResult = getImplementations( + new Uri(interfaceUri), + [], + plugins, + interfaces + ); + + expect(getImplementationsResult).toEqual([ + new Uri(implementation2Uri) + ]); + }); }); diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 81532f67fe..c272f94668 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -25,18 +25,6 @@ export const getImplementations = Tracer.traceFunc( } }; - const addAllImplementationsFromPluginRedirects = (apiInterfaceUri: Uri) => { - for (const pluginRegistration of plugins) { - const { implemented } = pluginRegistration.plugin.manifest; - const implementedApi = - implemented.findIndex((uri) => Uri.equals(uri, apiInterfaceUri)) > -1; - - if (implementedApi) { - addUniqueResult(pluginRegistration.uri); - } - } - }; - const addAllImplementationsFromImplementationsArray = ( implementationsArray: readonly InterfaceImplementations[], apiInterfaceUri: Uri @@ -60,7 +48,6 @@ export const getImplementations = Tracer.traceFunc( redirects ); - addAllImplementationsFromPluginRedirects(finalRedirectedApiInterface); addAllImplementationsFromImplementationsArray( interfaceImplementationsList, finalRedirectedApiInterface From 6108c16f4cbb07093cb961b66716a384243022d2 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 21:39:47 +0200 Subject: [PATCH 056/112] get implementations fixes --- packages/js/client/src/Web3ApiClient.ts | 2 - .../src/__tests__/Web3ApiClient.spec.ts | 82 +++++++++++++++++++ .../src/__tests__/get-implementations.spec.ts | 71 +--------------- .../src/algorithms/get-implementations.ts | 4 +- .../js/core/src/algorithms/resolve-uri.ts | 1 - 5 files changed, 87 insertions(+), 73 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 06f514e403..d4ebe8bebe 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -321,13 +321,11 @@ export class Web3ApiClient implements Client { ? getImplementations( uri, this.redirects(), - this.plugins(), this.interfaces() ).map((x) => x.uri) : getImplementations( uri, this.redirects(), - this.plugins(), this.interfaces() ); } diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 9d47ddb2cb..36c9c4980a 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -349,6 +349,88 @@ describe("Web3ApiClient", () => { .toThrow(`Plugins can't use interfaces for their URI. Invalid plugins: ${[interfaceUri]}`); }); + it("get implementations - do not return plugins that are not explicitly registered", () => { + const interfaceUri = "w3://ens/some-interface.eth"; + + const implementation1Uri = "w3://ens/some-implementation1.eth"; + const implementation2Uri = "w3://ens/some-implementation2.eth"; + + const client = new Web3ApiClient({ + plugins: [ + { + uri: implementation1Uri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: '', + implemented: [new Uri(interfaceUri)], + imported: [], + } + } + } + ], + interfaces: [ + { + interface: interfaceUri, + implementations: [ + implementation2Uri + ] + } + ] + }); + + const getImplementationsResult = client.getImplementations( + new Uri(interfaceUri), + { applyRedirects: true } + ); + + expect(getImplementationsResult).toEqual([ + new Uri(implementation2Uri) + ]); + }); + + it("get implementations - return implementations for plugins which don't have interface stated in manifest", () => { + const interfaceUri = "w3://ens/some-interface.eth"; + + const implementation1Uri = "w3://ens/some-implementation1.eth"; + const implementation2Uri = "w3://ens/some-implementation2.eth"; + + const client = new Web3ApiClient({ + plugins: [ + { + uri: implementation1Uri, + plugin: { + factory: () => ({} as Plugin), + manifest: { + schema: '', + implemented: [], + imported: [], + } + } + } + ], + interfaces: [ + { + interface: interfaceUri, + implementations: [ + implementation1Uri, + implementation2Uri + ] + } + ] + }); + + const getImplementationsResult = client.getImplementations( + new Uri(interfaceUri), + { applyRedirects: true } + ); + + expect(getImplementationsResult).toEqual([ + new Uri(implementation1Uri), + new Uri(implementation2Uri) + ]); + }); + it("simple-storage", async () => { const api = await buildAndDeployApi( `${GetPathToTestApis()}/simple-storage`, diff --git a/packages/js/core/src/__tests__/get-implementations.spec.ts b/packages/js/core/src/__tests__/get-implementations.spec.ts index c66e6eb9a2..d4e8860cdd 100644 --- a/packages/js/core/src/__tests__/get-implementations.spec.ts +++ b/packages/js/core/src/__tests__/get-implementations.spec.ts @@ -1,10 +1,9 @@ import { getImplementations, Uri, - UriRedirect, - Plugin, + UriRedirect } from "../"; -import { InterfaceImplementations, PluginRegistration } from "../types"; +import { InterfaceImplementations } from "../types"; describe("getImplementations", () => { @@ -16,7 +15,6 @@ describe("getImplementations", () => { const implementation1Uri = "w3://ens/some-implementation.eth"; const implementation2Uri = "w3://ens/some-implementation2.eth"; const implementation3Uri = "w3://ens/some-implementation3.eth"; - const implementation4Uri = "w3://ens/some-implementation4.eth"; const redirects: UriRedirect[] = [ { @@ -33,20 +31,6 @@ describe("getImplementations", () => { } ]; - const plugins: PluginRegistration[] = [ - { - uri: new Uri(implementation4Uri), - plugin: { - factory: () => ({} as Plugin), - manifest: { - schema: '', - implemented: [new Uri("authority/some-abstract-interface")], - imported: [new Uri("something/else-2")], - }, - } - } - ]; - const interfaces: InterfaceImplementations[] = [ { interface: new Uri(interface1Uri), @@ -64,8 +48,7 @@ describe("getImplementations", () => { { interface: new Uri(interface3Uri), implementations: [ - new Uri(implementation3Uri), - new Uri(implementation4Uri) + new Uri(implementation3Uri) ] } ]; @@ -73,19 +56,16 @@ describe("getImplementations", () => { const getImplementationsResult1 = getImplementations( new Uri(interface1Uri), redirects, - plugins, interfaces ); const getImplementationsResult2 = getImplementations( new Uri(interface2Uri), redirects, - plugins, interfaces ); const getImplementationsResult3 = getImplementations( new Uri(interface3Uri), redirects, - plugins, interfaces ); @@ -102,8 +82,7 @@ describe("getImplementations", () => { ]); expect(getImplementationsResult3).toEqual([ - new Uri(implementation3Uri), - new Uri(implementation4Uri) + new Uri(implementation3Uri) ]); }); @@ -132,7 +111,6 @@ describe("getImplementations", () => { const getImplementationsResult = getImplementations( new Uri(interface1Uri), redirects, - [], interfaces ); @@ -140,45 +118,4 @@ describe("getImplementations", () => { new Uri(implementation1Uri) ]); }); - - it("do not return plugins that are not explicitly registered", () => { - const interfaceUri = "w3://ens/some-interface.eth"; - - const implementation1Uri = "w3://ens/some-implementation1.eth"; - const implementation2Uri = "w3://ens/some-implementation2.eth"; - - const plugins: PluginRegistration[] = [ - { - uri: new Uri(implementation1Uri), - plugin: { - factory: () => ({} as Plugin), - manifest: { - schema: '', - implemented: [new Uri(interfaceUri)], - imported: [], - } - } - } - ]; - - const interfaces: InterfaceImplementations[] = [ - { - interface: new Uri(interfaceUri), - implementations: [ - new Uri(implementation2Uri) - ] - } - ]; - - const getImplementationsResult = getImplementations( - new Uri(interfaceUri), - [], - plugins, - interfaces - ); - - expect(getImplementationsResult).toEqual([ - new Uri(implementation2Uri) - ]); - }); }); diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index c272f94668..b8ba5a1af9 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -1,8 +1,7 @@ import { Uri, UriRedirect, - InterfaceImplementations, - PluginRegistration, + InterfaceImplementations } from "../types"; import { applyRedirects } from "./apply-redirects"; @@ -13,7 +12,6 @@ export const getImplementations = Tracer.traceFunc( ( apiInterfaceUri: Uri, redirects: readonly UriRedirect[], - plugins: readonly PluginRegistration[], interfaceImplementationsList: readonly InterfaceImplementations[] ): Uri[] => { const result: Uri[] = []; diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 6a5e4f77b3..eb8692dc7b 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -43,7 +43,6 @@ export const resolveUri = Tracer.traceFunc( const uriResolverImplementations = getImplementations( coreInterfaceUris.apiResolver, redirects, - plugins, interfaces ); From 53ee7f5abe7bdf3e4b719a610eeea7996ee391a6 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 11 Jun 2021 21:42:04 +0200 Subject: [PATCH 057/112] lint fix --- packages/js/client/src/Web3ApiClient.ts | 14 ++++---------- .../js/core/src/algorithms/get-implementations.ts | 6 +----- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index d4ebe8bebe..482445c3ae 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -318,16 +318,10 @@ export class Web3ApiClient implements Client { "Web3ApiClient: getImplementations - getImplementationsWithRedirects", (uri: Uri): (string | Uri)[] => { return isUriTypeString - ? getImplementations( - uri, - this.redirects(), - this.interfaces() - ).map((x) => x.uri) - : getImplementations( - uri, - this.redirects(), - this.interfaces() - ); + ? getImplementations(uri, this.redirects(), this.interfaces()).map( + (x) => x.uri + ) + : getImplementations(uri, this.redirects(), this.interfaces()); } ); diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index b8ba5a1af9..05fe7fa120 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -1,8 +1,4 @@ -import { - Uri, - UriRedirect, - InterfaceImplementations -} from "../types"; +import { Uri, UriRedirect, InterfaceImplementations } from "../types"; import { applyRedirects } from "./apply-redirects"; import { Tracer } from "@web3api/tracing-js"; From 0e3d814546364ef59d14d1c3c051cd2b7b6bdf02 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Sat, 12 Jun 2021 14:19:42 +0200 Subject: [PATCH 058/112] renamed argument --- packages/js/core/src/algorithms/get-implementations.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 81532f67fe..339bc64e47 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -14,7 +14,7 @@ export const getImplementations = Tracer.traceFunc( apiInterfaceUri: Uri, redirects: readonly UriRedirect[], plugins: readonly PluginRegistration[], - interfaceImplementationsList: readonly InterfaceImplementations[] + interfaces: readonly InterfaceImplementations[] ): Uri[] => { const result: Uri[] = []; @@ -62,7 +62,7 @@ export const getImplementations = Tracer.traceFunc( addAllImplementationsFromPluginRedirects(finalRedirectedApiInterface); addAllImplementationsFromImplementationsArray( - interfaceImplementationsList, + interfaces, finalRedirectedApiInterface ); From e133e0760edec51acc0842a1376f696e4b212dfd Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Sat, 12 Jun 2021 14:03:14 -0500 Subject: [PATCH 059/112] remove unneeded deps --- packages/core-interfaces/api-resolver/package.json | 5 ++--- packages/core-interfaces/logger/package.json | 5 ++--- packages/templates/api/assemblyscript/package.json | 1 - packages/templates/api/interface/package.json | 5 ++--- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/core-interfaces/api-resolver/package.json b/packages/core-interfaces/api-resolver/package.json index 66ef691485..ba4c4a115d 100644 --- a/packages/core-interfaces/api-resolver/package.json +++ b/packages/core-interfaces/api-resolver/package.json @@ -2,7 +2,7 @@ "name": "resolver-interface", "description": "Web3API Resolver Interface", "private": true, - "version": "0.0.1-prealpha.24", + "version": "0.0.1-prealpha.25", "scripts": { "build": "yarn build:web3api", "build:web3api": "npx w3 build", @@ -12,7 +12,6 @@ "deploy:web3api": "npx w3 build --ipfs http://localhost:5001" }, "devDependencies": { - "@web3api/cli": "0.0.1-prealpha.24", - "js-yaml": "3.14.0" + "@web3api/cli": "0.0.1-prealpha.25" } } diff --git a/packages/core-interfaces/logger/package.json b/packages/core-interfaces/logger/package.json index 01a16df664..d07601bae7 100644 --- a/packages/core-interfaces/logger/package.json +++ b/packages/core-interfaces/logger/package.json @@ -2,7 +2,7 @@ "name": "logger-interface", "description": "Web3API Logger Interface", "private": true, - "version": "0.0.1-prealpha.24", + "version": "0.0.1-prealpha.25", "scripts": { "build": "yarn build:web3api", "build:web3api": "npx w3 build", @@ -12,7 +12,6 @@ "deploy:web3api": "npx w3 build --ipfs http://localhost:5001" }, "devDependencies": { - "@web3api/cli": "0.0.1-prealpha.24", - "js-yaml": "3.14.0" + "@web3api/cli": "0.0.1-prealpha.25" } } diff --git a/packages/templates/api/assemblyscript/package.json b/packages/templates/api/assemblyscript/package.json index 973ca6d0b8..64d1dd1a25 100644 --- a/packages/templates/api/assemblyscript/package.json +++ b/packages/templates/api/assemblyscript/package.json @@ -19,7 +19,6 @@ "@web3api/ethereum-plugin-js": "0.0.1-prealpha.25", "@web3api/wasm-as": "0.0.1-prealpha.25", "ethers": "5.0.8", - "js-yaml": "3.14.0", "solc": "0.8.3" } } diff --git a/packages/templates/api/interface/package.json b/packages/templates/api/interface/package.json index 56dc59b986..9c750dcff0 100644 --- a/packages/templates/api/interface/package.json +++ b/packages/templates/api/interface/package.json @@ -2,7 +2,7 @@ "name": "templates-api-interface", "description": "Web3API Interface Example", "private": true, - "version": "0.0.1-prealpha.24", + "version": "0.0.1-prealpha.25", "scripts": { "build": "yarn build:web3api", "build:web3api": "npx w3 build", @@ -12,7 +12,6 @@ "deploy:web3api": "npx w3 build --ipfs http://localhost:5001" }, "devDependencies": { - "@web3api/cli": "0.0.1-prealpha.24", - "js-yaml": "3.14.0" + "@web3api/cli": "0.0.1-prealpha.25" } } From 76c344b803f8d11b4801433c85f69e023079f97c Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Sat, 12 Jun 2021 15:24:50 -0500 Subject: [PATCH 060/112] init --- .../schema/parse/src/typeInfo/definitions.ts | 2 ++ .../imports-ext/interface.eth/schema.graphql | 36 +++++++++++++++++++ .../compose/sanity/input/mutation.graphql | 7 +++- .../compose/sanity/output/mutation.graphql | 15 ++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index d35c6f6672..0513147e71 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -42,6 +42,7 @@ export function createGenericDefinition(args: { export interface ObjectDefinition extends GenericDefinition { properties: PropertyDefinition[]; + interfaces: ObjectDefinition[]; } export function createObjectDefinition(args: { type: string; @@ -246,6 +247,7 @@ export interface QueryDefinition extends GenericDefinition { type: QueryType; methods: MethodDefinition[]; imports: { type: string }[]; + interfaces: ImportedQueryDefinition[]; } export function createQueryDefinition(args: { type: string; diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql new file mode 100644 index 0000000000..5f69ed234c --- /dev/null +++ b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql @@ -0,0 +1,36 @@ +### Web3API Header START ### +scalar UInt +scalar UInt8 +scalar UInt16 +scalar UInt32 +scalar UInt64 +scalar Int +scalar Int8 +scalar Int16 +scalar Int32 +scalar Int64 +scalar Bytes +scalar BigInt + +directive @imported( + uri: String! + namespace: String! + nativeType: String! +) on OBJECT | ENUM + +directive @imports( + types: [String!]! +) on OBJECT + +### Web3API Header END ### + +type Mutation { + abstractMethod( + arg: UInt8! + ): String! +} + +type Object { + str: String! + uint8: UInt8! +} diff --git a/packages/test-cases/cases/compose/sanity/input/mutation.graphql b/packages/test-cases/cases/compose/sanity/input/mutation.graphql index f2bcbb0577..4edde40135 100644 --- a/packages/test-cases/cases/compose/sanity/input/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/input/mutation.graphql @@ -1,8 +1,9 @@ #import { Query, Mutation, CustomType } into Namespace from "test.eth" #import { Mutation } into JustMutation from "just.mutation.eth" +#import { Object, Mutation } into Interface from "interface.eth" #import { CommonType } from "../imports-local/common.graphql" -type Mutation { +type Mutation implements Interface_Mutation { method1( str: String! optStr: String @@ -37,3 +38,7 @@ type CustomMutationType { type AnotherMutationType { prop: String } + +type ImplObject implements Interface_Object { + anotherProp: String +} diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index ea8da2590e..d902b78d87 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -72,6 +72,12 @@ type AnotherMutationType { prop: String } +type ImplObject implements Interface_Object { + str: String! + uint8: UInt8! + anotherProp: String +} + type CommonType { prop: UInt8! nestedObject: NestedType! @@ -220,6 +226,15 @@ type Namespace_CustomType @imported( optImportedEnum: Namespace_Imported_Enum } +type Interface_Object @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object" +) { + str: String! + uint8: UInt8! +} + enum Namespace_CustomEnum @imported( namespace: "Namespace", uri: "test.eth", From c76192254541400dcabb521995ce33562664e643 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Mon, 14 Jun 2021 20:44:30 +0200 Subject: [PATCH 061/112] compose and parse interfaces --- packages/schema/compose/src/resolve.ts | 13 ++- .../compose/src/templates/schema.mustache.ts | 4 +- .../schema/parse/src/extract/query-types.ts | 107 ++++++++++-------- packages/schema/parse/src/index.ts | 12 ++ .../schema/parse/src/typeInfo/definitions.ts | 8 +- .../schema/parse/src/validate/directives.ts | 5 +- .../compose/sanity/input/mutation.graphql | 4 - .../compose/sanity/output/mutation.graphql | 22 ++-- .../cases/compose/sanity/output/mutation.ts | 72 ++++++++++++ .../compose/sanity/output/schema.graphql | 25 +++- .../cases/compose/sanity/output/schema.ts | 72 ++++++++++++ .../cases/parse/sanity/input.graphql | 14 ++- .../test-cases/cases/parse/sanity/output.ts | 48 +++++++- 13 files changed, 331 insertions(+), 75 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 5ea83e5c88..2a6d662392 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -283,19 +283,26 @@ function addQueryImportsDirective( // Append the @imports(...) directive to the query type const typeCapture = mutation - ? /type[ \n\t]*Mutation[ \n\t]*{/g + ? /type[ \n\t]*Mutation[ \n\t]*[^{]*[ \n\t]*{/g : /type[ \n\t]*Query[ \n\t]*{/g; + const implementsCapture = mutation + ? /type[ \n\t]*Mutation[ \n\t]*([^{]*)[ \n\t]*{/g + : /type[ \n\t]*Query[ \n\t]*([^{]*)[ \n\t]*{/g; + + const implementsStr = implementsCapture.exec(schema)![1]; + const importedTypes = `${externalImports .map((type) => `\"${type}\"`) .join(",\n ")}`; - const replacementQueryStr = `type ${mutation ? "Mutation" : "Query"} @imports( + + const replacementQueryStr = `type ${mutation ? "Mutation" : "Query"} ${implementsStr} @imports( types: [ ${importedTypes} ] ) {`; - return schema.replace(typeCapture, replacementQueryStr); + return schema.replace(typeCapture, replacementQueryStr, ); } async function resolveExternalImports( diff --git a/packages/schema/compose/src/templates/schema.mustache.ts b/packages/schema/compose/src/templates/schema.mustache.ts index 66102af1c1..e65442e48e 100644 --- a/packages/schema/compose/src/templates/schema.mustache.ts +++ b/packages/schema/compose/src/templates/schema.mustache.ts @@ -1,13 +1,13 @@ const template = ` {{#typeInfo}} {{#queryTypes}} -type {{type}} {{#imports.length}}@imports( +type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}},{{/last}}{{/interfaces}}{{/interfaces.length}}{{#imports.length}} @imports( types: [ {{#imports}} "{{type}}"{{^last}},{{/last}} {{/imports}} ] -) {{/imports.length}}{ +){{/imports.length}} { {{#methods}} {{name}}{{#arguments.length}}( {{#arguments}} diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index 7e53123824..ca111ebe67 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -39,58 +39,12 @@ const visitorEnter = ( return; } - // Look for the imports directive, and gather imported types - const imports: { type: string }[] = []; - - if (node.directives) { - const importsIndex = node.directives.findIndex( - (dir: DirectiveNode) => dir.name.value === "imports" - ); - - if (importsIndex !== -1) { - const importsDir = node.directives[importsIndex]; - - if (!importsDir.arguments) { - throw Error( - `@imports directive is incomplete, missing arguments. See type ${nodeName}.` - ); - } - - const typesIndex = importsDir.arguments.findIndex( - (arg: ArgumentNode) => arg.name.value === "types" - ); - - if (typesIndex === -1) { - throw Error( - `@imports directive missing required argument "types". See type ${nodeName}.` - ); - } - - const typesArg = importsDir.arguments[typesIndex]; - - if (typesArg.value.kind !== "ListValue") { - throw Error( - `@imports directive's types argument must be a List type. See type ${nodeName}.` - ); - } - - const listValue = typesArg.value; - - listValue.values.forEach((value: ValueNode) => { - if (value.kind !== "StringValue") { - throw Error( - `@imports directive's types list must only contain strings. See type ${nodeName}.` - ); - } - - imports.push({ type: value.value }); - }); - } - } - + const imports = parseImportsDirective(nodeName, node); + const query = createQueryDefinition({ type: nodeName, imports, + interfaces: node.interfaces?.map(x => ({ type: x.name.value })) }); queryTypes.push(query); state.currentQuery = query; @@ -130,6 +84,61 @@ const visitorEnter = ( }, }); +const parseImportsDirective = (nodeName: string, node: ObjectTypeDefinitionNode): { type: string }[] => { + // Look for the imports directive, and gather imported types + const imports: { type: string }[] = []; + + if(!node.directives) { + return imports; + } + + const importsIndex = node.directives.findIndex( + (dir: DirectiveNode) => dir.name.value === "imports" + ); + + if (importsIndex !== -1) { + const importsDir = node.directives[importsIndex]; + + if (!importsDir.arguments) { + throw Error( + `@imports directive is incomplete, missing arguments. See type ${nodeName}.` + ); + } + + const typesIndex = importsDir.arguments.findIndex( + (arg: ArgumentNode) => arg.name.value === "types" + ); + + if (typesIndex === -1) { + throw Error( + `@imports directive missing required argument "types". See type ${nodeName}.` + ); + } + + const typesArg = importsDir.arguments[typesIndex]; + + if (typesArg.value.kind !== "ListValue") { + throw Error( + `@imports directive's types argument must be a List type. See type ${nodeName}.` + ); + } + + const listValue = typesArg.value; + + listValue.values.forEach((value: ValueNode) => { + if (value.kind !== "StringValue") { + throw Error( + `@imports directive's types list must only contain strings. See type ${nodeName}.` + ); + } + + imports.push({ type: value.value }); + }); + } + + return imports; +}; + const visitorLeave = (state: State) => ({ ObjectTypeDefinition: (_node: ObjectTypeDefinitionNode) => { state.currentQuery = undefined; diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index bf15b8c585..4365a31e56 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -56,6 +56,18 @@ export function parseSchema( // Finalize & Transform TypeInfo info = transformTypeInfo(info, finalizePropertyDef); + for(const queryType of info.queryTypes) { + queryType.interfaces = queryType.interfaces.map(interfaceDefinition => { + const importedQueryDefinition = info.importedQueryTypes.find(x => x.type === interfaceDefinition.type); + + if(!importedQueryDefinition) { + throw ''; + } + + return importedQueryDefinition; + }); + } + if (options && options.transforms) { for (const transform of options.transforms) { info = transformTypeInfo(info, transform); diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index 0513147e71..69eeff3569 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -48,11 +48,13 @@ export function createObjectDefinition(args: { type: string; name?: string | null; required?: boolean; - properties?: PropertyDefinition[]; + properties?: PropertyDefinition[], + interfaces?: ObjectDefinition[] }): ObjectDefinition { return { ...createGenericDefinition(args), properties: args.properties ? args.properties : [], + interfaces: args.interfaces ? args.interfaces : [], kind: DefinitionKind.Object, }; } @@ -247,11 +249,12 @@ export interface QueryDefinition extends GenericDefinition { type: QueryType; methods: MethodDefinition[]; imports: { type: string }[]; - interfaces: ImportedQueryDefinition[]; + interfaces: Partial[]; } export function createQueryDefinition(args: { type: string; imports?: { type: string }[]; + interfaces?: Partial[]; required?: boolean; }): QueryDefinition { if (!isQueryType(args.type)) { @@ -265,6 +268,7 @@ export function createQueryDefinition(args: { type: args.type, methods: [], imports: args.imports ? args.imports : [], + interfaces: args.interfaces ? args.interfaces : [], kind: DefinitionKind.Query, }; } diff --git a/packages/schema/parse/src/validate/directives.ts b/packages/schema/parse/src/validate/directives.ts index 33a51cda23..aaa5e9f9c5 100644 --- a/packages/schema/parse/src/validate/directives.ts +++ b/packages/schema/parse/src/validate/directives.ts @@ -73,10 +73,11 @@ export function importsDirective(astNode: DocumentNode): void { return; } - if (lastNodeVisited !== "ObjectTypeDefinition") { + if (lastNodeVisited !== "ObjectTypeDefinition" && lastNodeVisited !== "NamedType") { throw new Error( `@imports directive should only be used on QUERY or MUTATION type definitions, ` + - `but it is being used in the following location: ${path.join(" -> ")}` + `but it is being used in the following location: ${path.join(" -> ")}` + + `LNV: ${lastNodeVisited}` ); } diff --git a/packages/test-cases/cases/compose/sanity/input/mutation.graphql b/packages/test-cases/cases/compose/sanity/input/mutation.graphql index 4edde40135..b3dbaa0204 100644 --- a/packages/test-cases/cases/compose/sanity/input/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/input/mutation.graphql @@ -38,7 +38,3 @@ type CustomMutationType { type AnotherMutationType { prop: String } - -type ImplObject implements Interface_Object { - anotherProp: String -} diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index d902b78d87..555a023d81 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -23,7 +23,7 @@ directive @imports( ) on OBJECT ### Web3API Header END ### -type Mutation @imports( +type Mutation implements Interface_Mutation @imports( types: [ "Namespace_Query", "Namespace_Mutation", @@ -34,7 +34,9 @@ type Mutation @imports( "Namespace_CustomType", "Namespace_CustomEnum", "Namespace_Imported_Enum", - "JustMutation_Mutation" + "JustMutation_Mutation", + "Interface_Object", + "Interface_Mutation" ] ) { method1( @@ -72,12 +74,6 @@ type AnotherMutationType { prop: String } -type ImplObject implements Interface_Object { - str: String! - uint8: UInt8! - anotherProp: String -} - type CommonType { prop: UInt8! nestedObject: NestedType! @@ -150,6 +146,16 @@ type JustMutation_Mutation @imported( ): [Int64!]! } +type Interface_Mutation @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Mutation" +) { + abstractMethod( + arg: UInt8! + ): String! +} + ### Imported Queries END ### ### Imported Objects START ### diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index dd7948a912..10bb269d3a 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -30,6 +30,38 @@ export const typeInfo: TypeInfo = { { type: "Namespace_CustomEnum" }, { type: "Namespace_Imported_Enum" }, { type: "JustMutation_Mutation" }, + { type: "Interface_Object" }, + { type: "Interface_Mutation" }, + ], + interfaces: [ + { + ...createImportedQueryDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Mutation", + type: "Interface_Mutation" + }), + methods: [ + { + ...createMethodDefinition({ + type: "mutation", + name: "abstractMethod", + return: createScalarPropertyDefinition({ + name: "abstractMethod", + type: "String", + required: true + }) + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }), + ] + }, + ] + } ], methods: [ { @@ -481,6 +513,34 @@ export const typeInfo: TypeInfo = { }, ] }, + { + ...createImportedQueryDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Mutation", + type: "Interface_Mutation" + }), + methods: [ + { + ...createMethodDefinition({ + type: "mutation", + name: "abstractMethod", + return: createScalarPropertyDefinition({ + name: "abstractMethod", + type: "String", + required: true + }) + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }), + ] + }, + ] + }, ], importedObjectTypes: [ { @@ -691,6 +751,18 @@ export const typeInfo: TypeInfo = { }), ] }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object", + type: "Interface_Object" + }), + properties: [ + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + }, ], importedEnumTypes: [ { diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index c31c41d2da..638e5ee0ea 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -47,7 +47,7 @@ type Query @imports( ): [Int64!]! } -type Mutation @imports( +type Mutation implements Interface_Mutation @imports( types: [ "Namespace_Query", "Namespace_Mutation", @@ -58,7 +58,9 @@ type Mutation @imports( "Namespace_CustomType", "Namespace_CustomEnum", "Namespace_Imported_Enum", - "JustMutation_Mutation" + "JustMutation_Mutation", + "Interface_Object", + "Interface_Mutation" ] ) { method1( @@ -191,6 +193,16 @@ type JustMutation_Mutation @imported( ): [Int64!]! } +type Interface_Mutation @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Mutation" +) { + abstractMethod( + arg: UInt8! + ): String! +} + ### Imported Queries END ### ### Imported Objects START ### @@ -267,6 +279,15 @@ type Namespace_Imported_ObjectType @imported( prop: String! } +type Interface_Object @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object" +) { + str: String! + uint8: UInt8! +} + enum Namespace_CustomEnum @imported( namespace: "Namespace", uri: "test.eth", diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index d3e0967980..2ffe88f855 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -116,6 +116,8 @@ export const typeInfo: TypeInfo = { { type: "Namespace_CustomEnum" }, { type: "Namespace_Imported_Enum" }, { type: "JustMutation_Mutation" }, + { type: "Interface_Object" }, + { type: "Interface_Mutation" }, ], methods: [ { @@ -189,6 +191,36 @@ export const typeInfo: TypeInfo = { }) ] } + ], + interfaces: [ + { + ...createImportedQueryDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Mutation", + type: "Interface_Mutation" + }), + methods: [ + { + ...createMethodDefinition({ + type: "mutation", + name: "abstractMethod", + return: createScalarPropertyDefinition({ + name: "abstractMethod", + type: "String", + required: true + }) + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }), + ] + }, + ] + } ] } ], @@ -635,6 +667,34 @@ export const typeInfo: TypeInfo = { }, ] }, + { + ...createImportedQueryDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Mutation", + type: "Interface_Mutation" + }), + methods: [ + { + ...createMethodDefinition({ + type: "mutation", + name: "abstractMethod", + return: createScalarPropertyDefinition({ + name: "abstractMethod", + type: "String", + required: true + }) + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }), + ] + }, + ] + }, ], importedObjectTypes: [ { @@ -845,6 +905,18 @@ export const typeInfo: TypeInfo = { }), properties: [createScalarPropertyDefinition({ name: "prop", type: "String", required: true })], }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object", + type: "Interface_Object" + }), + properties: [ + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + }, ], importedEnumTypes: [ { diff --git a/packages/test-cases/cases/parse/sanity/input.graphql b/packages/test-cases/cases/parse/sanity/input.graphql index a11f8a124f..c664d1f91d 100644 --- a/packages/test-cases/cases/parse/sanity/input.graphql +++ b/packages/test-cases/cases/parse/sanity/input.graphql @@ -70,8 +70,8 @@ type UserObject { fieldB: Int! } -type Query @imports( - types: [ "TestImport_Query" ] +type Query implements Interface_Query @imports( + types: [ "TestImport_Query", "Interface_Query" ] ) { queryMethod( arg: String! @@ -151,3 +151,13 @@ enum TestImport_Enum @imported( TEXT BYTES } + +type Interface_Query @imported( + uri: "interface.uri.eth", + namespace: "Interface", + nativeType: "Query" +) { + abstractMethod( + arg: UInt8! + ): String! +} \ No newline at end of file diff --git a/packages/test-cases/cases/parse/sanity/output.ts b/packages/test-cases/cases/parse/sanity/output.ts index 593be356d1..6c87f79b5e 100644 --- a/packages/test-cases/cases/parse/sanity/output.ts +++ b/packages/test-cases/cases/parse/sanity/output.ts @@ -207,7 +207,31 @@ export const output: TypeInfo = { { ...createQueryDefinition({ type: "Query", - imports: [{ type: "TestImport_Query" }] + imports: [{ type: "TestImport_Query" }, { type: "Interface_Query" }], + interfaces: [ + { + ...createImportedQueryDefinition({ + uri: "interface.uri.eth", + namespace: "Interface", + type: "Interface_Query", + nativeType: "Query" + }), + methods: [ + { + ...createMethodDefinition({ + type: "query", + name: "abstractMethod", + return: createScalarPropertyDefinition({ + name: "abstractMethod", + type: "String", + required: true + }), + }), + arguments: [createScalarPropertyDefinition({ name: "arg", type: "UInt8", required: true })], + }, + ], + }, + ] }), methods: [ { @@ -451,5 +475,27 @@ export const output: TypeInfo = { }, ], }, + { + ...createImportedQueryDefinition({ + uri: "interface.uri.eth", + namespace: "Interface", + type: "Interface_Query", + nativeType: "Query" + }), + methods: [ + { + ...createMethodDefinition({ + type: "query", + name: "abstractMethod", + return: createScalarPropertyDefinition({ + name: "abstractMethod", + type: "String", + required: true + }), + }), + arguments: [createScalarPropertyDefinition({ name: "arg", type: "UInt8", required: true })], + }, + ], + }, ], }; From 3a2936ddbc62cbaae16ee4c38b8db35671bbb91b Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 15 Jun 2021 12:18:33 +0200 Subject: [PATCH 062/112] added tests for implementing query interface methods --- packages/schema/compose/src/resolve.ts | 2 +- packages/schema/parse/src/validate/types.ts | 26 ++++++++----- .../compose/sanity/output/mutation.graphql | 4 ++ .../cases/compose/sanity/output/mutation.ts | 18 +++++++++ .../cases/parse/sanity/input.graphql | 14 +++++++ .../test-cases/cases/parse/sanity/output.ts | 39 +++++++++---------- 6 files changed, 72 insertions(+), 31 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 2a6d662392..6c9b903e60 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -44,7 +44,7 @@ export async function resolveImportsAndParseSchemas( resolvers: SchemaResolvers ): Promise { const importKeywordCapture = /^[#]*["{3}]*import[ \n\t]/gm; - const externalImportCapture = /[#]*["{3}]*import[ \n\t]*{([a-zA-Z0-9_, \n\t]+)}[ \n\t]*into[ \n\t]*(\w+?)[ \n\t]*from[ \n\t]*[\"'`]([a-zA-Z0-9_~.:\/]+?)[\"'`]/g; + const externalImportCapture = /[#]*["{3}]*import[ \n\t]*{([a-zA-Z0-9_, \n\t]+)}[ \n\t]*into[ \n\t]*(\w+?)[ \n\t]*from[ \n\t]*[\"'`]([\-a-zA-Z0-9_~.:\/]+?)[\"'`]/g; const localImportCapture = /[#]*["{3}]*import[ \n\t]*{([a-zA-Z0-9_, \n\t]+)}[ \n\t]*from[ \n\t]*[\"'`]([a-zA-Z0-9_~\-:.\/]+?)[\"'`]/g; const keywords = [...schema.matchAll(importKeywordCapture)]; diff --git a/packages/schema/parse/src/validate/types.ts b/packages/schema/parse/src/validate/types.ts index 0c0274548f..7df5611b32 100644 --- a/packages/schema/parse/src/validate/types.ts +++ b/packages/schema/parse/src/validate/types.ts @@ -169,16 +169,22 @@ export function circularDefinitions(astNode: DocumentNode): void { }, }); - const { cycleStrings, foundCycle } = getSchemaCycles(astNode, { - ignoreTypeNames: operationTypes, - allowOnNullableFields: true, - }); + try { - if (foundCycle) { - throw Error( - `Graphql cycles are not supported. \nFound: ${cycleStrings.map( - (cycle) => `\n- ${cycle}` - )}` - ); + const { cycleStrings, foundCycle } = getSchemaCycles(astNode, { + ignoreTypeNames: operationTypes, + allowOnNullableFields: true, + }); + + if (foundCycle) { + throw Error( + `Graphql cycles are not supported. \nFound: ${cycleStrings.map( + (cycle) => `\n- ${cycle}` + )}` + ); + } + } + catch(ex) { + console.log(ex); } } diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index 555a023d81..7e08508813 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -49,6 +49,10 @@ type Mutation implements Interface_Mutation @imports( method2( arg: [String!]! ): [Int64!]! + + abstractMethod( + arg: UInt8! + ): String! } type CustomMutationType { diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index 10bb269d3a..4a72901352 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -107,6 +107,24 @@ export const typeInfo: TypeInfo = { }) ] }, + { + ...createMethodDefinition({ + type: "mutation", + name: "abstractMethod", + return: createScalarPropertyDefinition({ + name: "abstractMethod", + type: "String", + required: true + }) + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }) + ] + }, { ...createMethodDefinition({ type: "mutation", diff --git a/packages/test-cases/cases/parse/sanity/input.graphql b/packages/test-cases/cases/parse/sanity/input.graphql index c664d1f91d..8a8a03061b 100644 --- a/packages/test-cases/cases/parse/sanity/input.graphql +++ b/packages/test-cases/cases/parse/sanity/input.graphql @@ -70,6 +70,20 @@ type UserObject { fieldB: Int! } +type Implementation_Object implements Interface_Object { + str: String! + uint8: UInt8! +} + +type Interface_Object @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object" +) { + str: String! + uint8: UInt8! +} + type Query implements Interface_Query @imports( types: [ "TestImport_Query", "Interface_Query" ] ) { diff --git a/packages/test-cases/cases/parse/sanity/output.ts b/packages/test-cases/cases/parse/sanity/output.ts index 6c87f79b5e..ff7bd515e8 100644 --- a/packages/test-cases/cases/parse/sanity/output.ts +++ b/packages/test-cases/cases/parse/sanity/output.ts @@ -210,26 +210,7 @@ export const output: TypeInfo = { imports: [{ type: "TestImport_Query" }, { type: "Interface_Query" }], interfaces: [ { - ...createImportedQueryDefinition({ - uri: "interface.uri.eth", - namespace: "Interface", - type: "Interface_Query", - nativeType: "Query" - }), - methods: [ - { - ...createMethodDefinition({ - type: "query", - name: "abstractMethod", - return: createScalarPropertyDefinition({ - name: "abstractMethod", - type: "String", - required: true - }), - }), - arguments: [createScalarPropertyDefinition({ name: "arg", type: "UInt8", required: true })], - }, - ], + type: "Interface_Query", }, ] }), @@ -285,6 +266,24 @@ export const output: TypeInfo = { })}), ], }, + { + ...createMethodDefinition({ + type: "query", + name: "abstractMethod", + return: createScalarPropertyDefinition({ + name: "abstractMethod", + type: "String", + required: true + }), + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + type: "UInt8", + required: true + }), + ], + }, ], }, ], From 80cba952fe24a4ebdd8cb511efced44d6bc0ca4b Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 16 Jun 2021 01:43:11 +0200 Subject: [PATCH 063/112] extracting body of interfaces and injecting implementations --- packages/schema/compose/src/resolve.ts | 103 +++++++++++++++++- .../compose/src/templates/schema.mustache.ts | 2 +- .../schema/parse/src/extract/object-types.ts | 5 +- packages/schema/parse/src/index.ts | 12 -- .../parse/src/transform/addFirstLast.ts | 2 + .../schema/parse/src/typeInfo/definitions.ts | 4 +- .../schema/parse/src/validate/directives.ts | 2 +- packages/schema/parse/src/validate/types.ts | 26 ++--- .../compose/sanity/input/mutation.graphql | 4 + .../compose/sanity/output/mutation.graphql | 6 + .../cases/compose/sanity/output/mutation.ts | 80 ++++++-------- .../compose/sanity/output/schema.graphql | 10 ++ .../cases/compose/sanity/output/schema.ts | 60 +++++----- .../cases/parse/sanity/input.graphql | 27 +++-- .../test-cases/cases/parse/sanity/output.ts | 35 +++++- 15 files changed, 253 insertions(+), 125 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 6c9b903e60..ee4113fc6f 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -59,6 +59,13 @@ export async function resolveImportsAndParseSchemas( ); } + const interfaceCapture = /type[ \n\t]*[a-zA-Z0-9_]+[ \n\t]+implements ([a-zA-Z0-9_&\n\t ]*){/g; + const implementInterfaceStatments = [...schema.matchAll(interfaceCapture)]; + + const interfacesToResolve: { implementationInterfaces: { typeName: string, interfaces: string[] }, allInterfaces: string[]} = parseInterfaces( + implementInterfaceStatments + ); + const externalImportsToResolve: ExternalImport[] = parseExternalImports( externalImportStatements, mutation @@ -95,10 +102,21 @@ export async function resolveImportsAndParseSchemas( .replace(localImportCapture, ""); // Add the @imports directive - newSchema = addQueryImportsDirective(newSchema, externalImports, mutation); + newSchema = addQueryImportsDirective(newSchema, externalImports, mutation, subTypeInfo); + + //Combine the new schema with the subTypeInfo + newSchema = header + newSchema + renderSchema(subTypeInfo, false); - // Parse the newly formed schema, and combine it with the subTypeInfo - return parseSchema(header + newSchema + renderSchema(subTypeInfo, false)); + newSchema = resolveInterfaces(newSchema, interfacesToResolve); + + // Parse the newly formed schema +try +{ + return parseSchema(newSchema); +} +catch(ex) { + throw ''; +} } interface Namespaced { @@ -275,7 +293,8 @@ function appendNamespace(namespace: string, str: string) { function addQueryImportsDirective( schema: string, externalImports: string[], - mutation: boolean + mutation: boolean, + subTypeInfo: TypeInfo ): string { if (!externalImports.length) { return schema; @@ -289,7 +308,7 @@ function addQueryImportsDirective( const implementsCapture = mutation ? /type[ \n\t]*Mutation[ \n\t]*([^{]*)[ \n\t]*{/g : /type[ \n\t]*Query[ \n\t]*([^{]*)[ \n\t]*{/g; - + const implementsStr = implementsCapture.exec(schema)![1]; const importedTypes = `${externalImports @@ -305,6 +324,80 @@ function addQueryImportsDirective( return schema.replace(typeCapture, replacementQueryStr, ); } +function parseInterfaces( + implementInterfaceStatments: RegExpMatchArray[] +): { implementationInterfaces: any, allInterfaces: string[]} { + + const implementationInterfaces: any = {}; + const allInterfaces: string[] = []; + + for(const implementMatch of implementInterfaceStatments) { + const implementStr = implementMatch[1].trim(); + const typeCapture = /type[ \n\t]*([a-zA-Z0-9_]+)[ \n\t]*/g; + + const typeName = typeCapture.exec(implementMatch[0])![1]; + + var interfaces = [...implementStr.matchAll(/([a-zA-Z0-9_]+)(&\s*\d+)*/g)] + .map(x => x[0]); + + implementationInterfaces[typeName] = interfaces; + allInterfaces.push(...interfaces); + } + + return { + implementationInterfaces, + allInterfaces: [...new Set(allInterfaces)] + }; +} + +function resolveInterfaces( + schema: string, + result: { implementationInterfaces: any, allInterfaces: string[]} +): string { + + const ret: { implementationInterfaces: any, interfacesWithBodies: { name: string, body: string }[]} = { + implementationInterfaces: result.implementationInterfaces, + interfacesWithBodies: [] + }; + + if (!result.allInterfaces.length) { + return schema; + } + + const typeCapture = /type[ \n\t]*([a-zA-Z0-9_]+)[a-zA-Z0-9_,.:@"!\(\)\[\] \n\t]+{([a-zA-Z0-9_,.:@"!\(\)\[\] \n\t]*)}/g; + const typeNames = [...schema.matchAll(typeCapture)]; + + // for(const name of typeNames) { + // console.log(name); + // } + + for(const interfaceName of result.allInterfaces) { + let body = typeNames.find(x => x[1] === interfaceName)![2]; + + ret.interfacesWithBodies.push({ + name: interfaceName, + body: body + }); + } + + + for(const x of Object.keys(ret.implementationInterfaces)) { + + const typeCapture2 = new RegExp(`(type[ \\n\\t]*${x}[a-zA-Z0-9_,.:@"!\\(\\)\\[\\] \\n\\t]*{)([a-zA-Z0-9_,.:@"!\\(\\)\\[\\] \\n\\t]*)}`); + + var bodiesOfInterfaces = ret.implementationInterfaces[x].map((a: any) => { + return ret.interfacesWithBodies.find(iwb => iwb.name === a)?.body.trim(); + }); + + var str = bodiesOfInterfaces.reduce((s: any, a: any) => s + '\n' + a); + + schema = schema.replace(typeCapture2, `$1$2${str}}`); + } + + + return schema; +} + async function resolveExternalImports( importsToResolve: ExternalImport[], resolveSchema: SchemaResolver, diff --git a/packages/schema/compose/src/templates/schema.mustache.ts b/packages/schema/compose/src/templates/schema.mustache.ts index e65442e48e..9199cff365 100644 --- a/packages/schema/compose/src/templates/schema.mustache.ts +++ b/packages/schema/compose/src/templates/schema.mustache.ts @@ -22,7 +22,7 @@ type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}}, {{/queryTypes}} {{#objectTypes}} -type {{type}} { +type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}},{{/last}}{{/interfaces}}{{/interfaces.length}} { {{#properties}} {{name}}: {{toGraphQLType}} {{/properties}} diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index 300737f4e4..779de2895e 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -44,7 +44,10 @@ const visitorEnter = ( } // Create a new TypeDefinition - const type = createObjectDefinition({ type: node.name.value }); + const type = createObjectDefinition({ + type: node.name.value, + interfaces: node.interfaces?.map(x => ({ type: x.name.value })) + }); objectTypes.push(type); state.currentType = type; }, diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index 4365a31e56..bf15b8c585 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -56,18 +56,6 @@ export function parseSchema( // Finalize & Transform TypeInfo info = transformTypeInfo(info, finalizePropertyDef); - for(const queryType of info.queryTypes) { - queryType.interfaces = queryType.interfaces.map(interfaceDefinition => { - const importedQueryDefinition = info.importedQueryTypes.find(x => x.type === interfaceDefinition.type); - - if(!importedQueryDefinition) { - throw ''; - } - - return importedQueryDefinition; - }); - } - if (options && options.transforms) { for (const transform of options.transforms) { info = transformTypeInfo(info, transform); diff --git a/packages/schema/parse/src/transform/addFirstLast.ts b/packages/schema/parse/src/transform/addFirstLast.ts index 619a55638b..9a329d17c8 100644 --- a/packages/schema/parse/src/transform/addFirstLast.ts +++ b/packages/schema/parse/src/transform/addFirstLast.ts @@ -19,6 +19,7 @@ export const addFirstLast: TypeInfoTransforms = { ObjectDefinition: (def: ObjectDefinition) => ({ ...def, properties: setFirstLast(def.properties), + interfaces: setFirstLast(def.interfaces) }), MethodDefinition: (def: MethodDefinition) => ({ ...def, @@ -28,6 +29,7 @@ export const addFirstLast: TypeInfoTransforms = { ...def, methods: setFirstLast(def.methods), imports: setFirstLast(def.imports), + interfaces: setFirstLast(def.interfaces), }), ImportedQueryDefinition: (def: ImportedQueryDefinition) => ({ ...def, diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index 69eeff3569..3551ddfa90 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -42,14 +42,14 @@ export function createGenericDefinition(args: { export interface ObjectDefinition extends GenericDefinition { properties: PropertyDefinition[]; - interfaces: ObjectDefinition[]; + interfaces: { type: string }[]; } export function createObjectDefinition(args: { type: string; name?: string | null; required?: boolean; properties?: PropertyDefinition[], - interfaces?: ObjectDefinition[] + interfaces?: { type: string }[] }): ObjectDefinition { return { ...createGenericDefinition(args), diff --git a/packages/schema/parse/src/validate/directives.ts b/packages/schema/parse/src/validate/directives.ts index aaa5e9f9c5..d70ba1dc34 100644 --- a/packages/schema/parse/src/validate/directives.ts +++ b/packages/schema/parse/src/validate/directives.ts @@ -73,7 +73,7 @@ export function importsDirective(astNode: DocumentNode): void { return; } - if (lastNodeVisited !== "ObjectTypeDefinition" && lastNodeVisited !== "NamedType") { + if (lastNodeVisited !== "ObjectTypeDefinition") { throw new Error( `@imports directive should only be used on QUERY or MUTATION type definitions, ` + `but it is being used in the following location: ${path.join(" -> ")}` + diff --git a/packages/schema/parse/src/validate/types.ts b/packages/schema/parse/src/validate/types.ts index 7df5611b32..0c0274548f 100644 --- a/packages/schema/parse/src/validate/types.ts +++ b/packages/schema/parse/src/validate/types.ts @@ -169,22 +169,16 @@ export function circularDefinitions(astNode: DocumentNode): void { }, }); - try { + const { cycleStrings, foundCycle } = getSchemaCycles(astNode, { + ignoreTypeNames: operationTypes, + allowOnNullableFields: true, + }); - const { cycleStrings, foundCycle } = getSchemaCycles(astNode, { - ignoreTypeNames: operationTypes, - allowOnNullableFields: true, - }); - - if (foundCycle) { - throw Error( - `Graphql cycles are not supported. \nFound: ${cycleStrings.map( - (cycle) => `\n- ${cycle}` - )}` - ); - } - } - catch(ex) { - console.log(ex); + if (foundCycle) { + throw Error( + `Graphql cycles are not supported. \nFound: ${cycleStrings.map( + (cycle) => `\n- ${cycle}` + )}` + ); } } diff --git a/packages/test-cases/cases/compose/sanity/input/mutation.graphql b/packages/test-cases/cases/compose/sanity/input/mutation.graphql index b3dbaa0204..f2de02bb58 100644 --- a/packages/test-cases/cases/compose/sanity/input/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/input/mutation.graphql @@ -38,3 +38,7 @@ type CustomMutationType { type AnotherMutationType { prop: String } + +type ImplementationObject implements Interface_Object { + anotherProp: String +} diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index 7e08508813..85a30b1b49 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -78,6 +78,12 @@ type AnotherMutationType { prop: String } +type ImplementationObject implements Interface_Object { + anotherProp: String + str: String! + uint8: UInt8! +} + type CommonType { prop: UInt8! nestedObject: NestedType! diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index 4a72901352..385f60d3ab 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -34,34 +34,7 @@ export const typeInfo: TypeInfo = { { type: "Interface_Mutation" }, ], interfaces: [ - { - ...createImportedQueryDefinition({ - uri: "interface.eth", - namespace: "Interface", - nativeType: "Mutation", - type: "Interface_Mutation" - }), - methods: [ - { - ...createMethodDefinition({ - type: "mutation", - name: "abstractMethod", - return: createScalarPropertyDefinition({ - name: "abstractMethod", - type: "String", - required: true - }) - }), - arguments: [ - createScalarPropertyDefinition({ - name: "arg", - required: true, - type: "UInt8" - }), - ] - }, - ] - } + { type: "Interface_Mutation" } ], methods: [ { @@ -107,24 +80,6 @@ export const typeInfo: TypeInfo = { }) ] }, - { - ...createMethodDefinition({ - type: "mutation", - name: "abstractMethod", - return: createScalarPropertyDefinition({ - name: "abstractMethod", - type: "String", - required: true - }) - }), - arguments: [ - createScalarPropertyDefinition({ - name: "arg", - required: true, - type: "UInt8" - }) - ] - }, { ...createMethodDefinition({ type: "mutation", @@ -152,7 +107,25 @@ export const typeInfo: TypeInfo = { }) }) ] - } + }, + { + ...createMethodDefinition({ + type: "mutation", + name: "abstractMethod", + return: createScalarPropertyDefinition({ + name: "abstractMethod", + type: "String", + required: true + }) + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }) + ] + }, ] } ], @@ -225,6 +198,19 @@ export const typeInfo: TypeInfo = { ...createObjectDefinition({ type: "AnotherMutationType" }), properties: [createScalarPropertyDefinition({ name: "prop", type: "String" })], }, + { + ...createObjectDefinition({ + type: "ImplementationObject", + interfaces: [ + { type: "Interface_Object" } + ] + }), + properties: [ + createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false }), + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + }, { ...createObjectDefinition({ type: "CommonType" }), properties: [ diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index 638e5ee0ea..17fc80178f 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -73,6 +73,10 @@ type Mutation implements Interface_Mutation @imports( method2( arg: [String!]! ): [Int64!]! + + abstractMethod( + arg: UInt8! + ): String! } type CustomQueryType { @@ -135,6 +139,12 @@ type AnotherMutationType { prop: String } +type ImplementationObject implements Interface_Object { + anotherProp: String + str: String! + uint8: UInt8! +} + ### Imported Queries START ### type Namespace_Query @imported( diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index 2ffe88f855..5160414cbe 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -190,37 +190,28 @@ export const typeInfo: TypeInfo = { }) }) ] - } - ], - interfaces: [ + }, { - ...createImportedQueryDefinition({ - uri: "interface.eth", - namespace: "Interface", - nativeType: "Mutation", - type: "Interface_Mutation" + ...createMethodDefinition({ + type: "mutation", + name: "abstractMethod", + return: createScalarPropertyDefinition({ + name: "abstractMethod", + type: "String", + required: true + }) }), - methods: [ - { - ...createMethodDefinition({ - type: "mutation", - name: "abstractMethod", - return: createScalarPropertyDefinition({ - name: "abstractMethod", - type: "String", - required: true - }) - }), - arguments: [ - createScalarPropertyDefinition({ - name: "arg", - required: true, - type: "UInt8" - }), - ] - }, + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }) ] - } + }, + ], + interfaces: [ + { type: "Interface_Mutation" } ] } ], @@ -399,6 +390,19 @@ export const typeInfo: TypeInfo = { ...createObjectDefinition({ type: "AnotherMutationType" }), properties: [createScalarPropertyDefinition({ name: "prop", type: "String" })], }, + { + ...createObjectDefinition({ + type: "ImplementationObject", + interfaces: [ + { type: "Interface_Object" } + ] + }), + properties: [ + createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false }), + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + } ], importedQueryTypes: [ { diff --git a/packages/test-cases/cases/parse/sanity/input.graphql b/packages/test-cases/cases/parse/sanity/input.graphql index 8a8a03061b..968ac4cde0 100644 --- a/packages/test-cases/cases/parse/sanity/input.graphql +++ b/packages/test-cases/cases/parse/sanity/input.graphql @@ -70,16 +70,8 @@ type UserObject { fieldB: Int! } -type Implementation_Object implements Interface_Object { - str: String! - uint8: UInt8! -} - -type Interface_Object @imported( - uri: "interface.eth", - namespace: "Interface", - nativeType: "Object" -) { +type ImplementationObject implements Interface_Object { + anotherProp: String str: String! uint8: UInt8! } @@ -100,6 +92,10 @@ type Query implements Interface_Query @imports( enum: CustomEnum, arrayEnum: [CustomEnum!]! ): CustomEnum! + + abstractMethod( + arg: UInt8! + ): String! } type TestImport_Query @imported( @@ -174,4 +170,13 @@ type Interface_Query @imported( abstractMethod( arg: UInt8! ): String! -} \ No newline at end of file +} + +type Interface_Object @imported( + uri: "interface.uri.eth", + namespace: "Interface", + nativeType: "Object" +) { + str: String! + uint8: UInt8! +} diff --git a/packages/test-cases/cases/parse/sanity/output.ts b/packages/test-cases/cases/parse/sanity/output.ts index ff7bd515e8..60bc1962c6 100644 --- a/packages/test-cases/cases/parse/sanity/output.ts +++ b/packages/test-cases/cases/parse/sanity/output.ts @@ -187,6 +187,19 @@ export const output: TypeInfo = { createScalarPropertyDefinition({ name: "fieldB", type: "Int", required: true }), ], }, + { + ...createObjectDefinition({ + type: "ImplementationObject", + interfaces: [ + { type: "Interface_Object" } + ] + }), + properties: [ + createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false }), + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }) + ], + }, ], enumTypes: [ createEnumDefinition({ @@ -324,7 +337,27 @@ export const output: TypeInfo = { required: false, }) ], - } + }, + { + ...createImportedObjectDefinition({ + uri: "interface.uri.eth", + namespace: "Interface", + type: "Interface_Object", + nativeType: "Object" + }), + properties: [ + createScalarPropertyDefinition({ + name: "str", + type: "String", + required: true + }), + createScalarPropertyDefinition({ + name: "uint8", + type: "UInt8", + required: true, + }) + ], + }, ], importedQueryTypes: [ { From 1bedc5f5e205db0e9baa12b0a878f099ab983e92 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 16 Jun 2021 16:28:05 +0200 Subject: [PATCH 064/112] refactor --- packages/schema/compose/src/resolve.ts | 89 ++++++++++++++------------ 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index ee4113fc6f..f5aaf53bd0 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -37,6 +37,11 @@ import { header, } from "@web3api/schema-parse"; +type ImplementationWithInterfaces = { + typeName: string; + interfaces: string[]; +} + export async function resolveImportsAndParseSchemas( schema: string, schemaPath: string, @@ -62,7 +67,7 @@ export async function resolveImportsAndParseSchemas( const interfaceCapture = /type[ \n\t]*[a-zA-Z0-9_]+[ \n\t]+implements ([a-zA-Z0-9_&\n\t ]*){/g; const implementInterfaceStatments = [...schema.matchAll(interfaceCapture)]; - const interfacesToResolve: { implementationInterfaces: { typeName: string, interfaces: string[] }, allInterfaces: string[]} = parseInterfaces( + const implementationsWithInterfaces = parseInterfaces( implementInterfaceStatments ); @@ -107,7 +112,7 @@ export async function resolveImportsAndParseSchemas( //Combine the new schema with the subTypeInfo newSchema = header + newSchema + renderSchema(subTypeInfo, false); - newSchema = resolveInterfaces(newSchema, interfacesToResolve); + newSchema = resolveInterfaces(newSchema, implementationsWithInterfaces); // Parse the newly formed schema try @@ -302,20 +307,14 @@ function addQueryImportsDirective( // Append the @imports(...) directive to the query type const typeCapture = mutation - ? /type[ \n\t]*Mutation[ \n\t]*[^{]*[ \n\t]*{/g - : /type[ \n\t]*Query[ \n\t]*{/g; - - const implementsCapture = mutation ? /type[ \n\t]*Mutation[ \n\t]*([^{]*)[ \n\t]*{/g : /type[ \n\t]*Query[ \n\t]*([^{]*)[ \n\t]*{/g; - - const implementsStr = implementsCapture.exec(schema)![1]; const importedTypes = `${externalImports .map((type) => `\"${type}\"`) .join(",\n ")}`; - const replacementQueryStr = `type ${mutation ? "Mutation" : "Query"} ${implementsStr} @imports( + const replacementQueryStr = `type ${mutation ? "Mutation" : "Query"} $1@imports( types: [ ${importedTypes} ] @@ -326,10 +325,9 @@ function addQueryImportsDirective( function parseInterfaces( implementInterfaceStatments: RegExpMatchArray[] -): { implementationInterfaces: any, allInterfaces: string[]} { +): ImplementationWithInterfaces[] { - const implementationInterfaces: any = {}; - const allInterfaces: string[] = []; + const implementationsWithInterfaces: ImplementationWithInterfaces[] = []; for(const implementMatch of implementInterfaceStatments) { const implementStr = implementMatch[1].trim(); @@ -340,60 +338,69 @@ function parseInterfaces( var interfaces = [...implementStr.matchAll(/([a-zA-Z0-9_]+)(&\s*\d+)*/g)] .map(x => x[0]); - implementationInterfaces[typeName] = interfaces; - allInterfaces.push(...interfaces); + implementationsWithInterfaces.push({ + typeName, + interfaces + }); } - return { - implementationInterfaces, - allInterfaces: [...new Set(allInterfaces)] - }; + return implementationsWithInterfaces; } function resolveInterfaces( schema: string, - result: { implementationInterfaces: any, allInterfaces: string[]} + implementationsWithInterfaces: ImplementationWithInterfaces[] ): string { + if (!implementationsWithInterfaces.length) { + return schema; + } + + const getAllUniqueInterfaces = (): string[] => { + const allIntefaces = implementationsWithInterfaces + .map(x => x.interfaces) + .reduce((acc, x) => acc.concat(x), []); - const ret: { implementationInterfaces: any, interfacesWithBodies: { name: string, body: string }[]} = { - implementationInterfaces: result.implementationInterfaces, - interfacesWithBodies: [] + return [...new Set(allIntefaces)]; }; - if (!result.allInterfaces.length) { - return schema; - } + const allInterfaces = getAllUniqueInterfaces(); + const interfacesWithBodies: { name: string, body: string }[] = []; const typeCapture = /type[ \n\t]*([a-zA-Z0-9_]+)[a-zA-Z0-9_,.:@"!\(\)\[\] \n\t]+{([a-zA-Z0-9_,.:@"!\(\)\[\] \n\t]*)}/g; - const typeNames = [...schema.matchAll(typeCapture)]; + const typeMatches = [...schema.matchAll(typeCapture)]; - // for(const name of typeNames) { - // console.log(name); - // } + for(const interfaceName of allInterfaces) { + let match = typeMatches.find(x => x[1] === interfaceName); + if(!match) { + continue; + } - for(const interfaceName of result.allInterfaces) { - let body = typeNames.find(x => x[1] === interfaceName)![2]; + const body = match[2]; + if(!body) { + continue; + } - ret.interfacesWithBodies.push({ + interfacesWithBodies.push({ name: interfaceName, body: body }); } + for(const implementationWithInterfaces of implementationsWithInterfaces) { - for(const x of Object.keys(ret.implementationInterfaces)) { + const implementationTypeCapture = new RegExp(`(type[ \\n\\t]*${implementationWithInterfaces.typeName}[a-zA-Z0-9_,.:@"!\\(\\)\\[\\] \\n\\t]*{)([a-zA-Z0-9_,.:@"!\\(\\)\\[\\] \\n\\t]*)}`); - const typeCapture2 = new RegExp(`(type[ \\n\\t]*${x}[a-zA-Z0-9_,.:@"!\\(\\)\\[\\] \\n\\t]*{)([a-zA-Z0-9_,.:@"!\\(\\)\\[\\] \\n\\t]*)}`); + var bodiesOfInterfaces = implementationWithInterfaces.interfaces + .map(interfaceName => { + return interfacesWithBodies.find(iwb => iwb.name === interfaceName)?.body.trim(); + }); - var bodiesOfInterfaces = ret.implementationInterfaces[x].map((a: any) => { - return ret.interfacesWithBodies.find(iwb => iwb.name === a)?.body.trim(); - }); - - var str = bodiesOfInterfaces.reduce((s: any, a: any) => s + '\n' + a); + var bodiesOfInterfacesStr = bodiesOfInterfaces + .filter(x => x) + .reduce((acc: any, x: any) => acc + '\n' + x); - schema = schema.replace(typeCapture2, `$1$2${str}}`); + schema = schema.replace(implementationTypeCapture, `$1$2${bodiesOfInterfacesStr}}`); } - return schema; } From d0fd232a3d82e174ce98f02e457933a14d6bf51f Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 16 Jun 2021 17:12:10 +0200 Subject: [PATCH 065/112] covered more advanced interface situations --- packages/schema/compose/src/resolve.ts | 4 +- .../compose/src/templates/schema.mustache.ts | 4 +- .../imports-ext/interface.eth/schema.graphql | 12 ++- .../compose/sanity/input/mutation.graphql | 6 +- .../cases/compose/sanity/input/query.graphql | 3 +- .../compose/sanity/output/mutation.graphql | 16 +++- .../cases/compose/sanity/output/mutation.ts | 24 ++++-- .../cases/compose/sanity/output/query.graphql | 29 ++++++- .../cases/compose/sanity/output/query.ts | 67 ++++++++++++++++- .../compose/sanity/output/schema.graphql | 36 +++++++-- .../cases/compose/sanity/output/schema.ts | 75 +++++++++++++++++-- .../cases/parse/sanity/input.graphql | 11 ++- .../test-cases/cases/parse/sanity/output.ts | 21 +++++- 13 files changed, 274 insertions(+), 34 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index f5aaf53bd0..ec2c65669c 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -366,7 +366,7 @@ function resolveInterfaces( const allInterfaces = getAllUniqueInterfaces(); const interfacesWithBodies: { name: string, body: string }[] = []; - const typeCapture = /type[ \n\t]*([a-zA-Z0-9_]+)[a-zA-Z0-9_,.:@"!\(\)\[\] \n\t]+{([a-zA-Z0-9_,.:@"!\(\)\[\] \n\t]*)}/g; + const typeCapture = /type[ \n\t]*([a-zA-Z0-9_]+)[a-zA-Z0-9_,.:@"&!\(\)\[\] \n\t]+{([a-zA-Z0-9_,.:@"&!\(\)\[\] \n\t]*)}/g; const typeMatches = [...schema.matchAll(typeCapture)]; for(const interfaceName of allInterfaces) { @@ -388,7 +388,7 @@ function resolveInterfaces( for(const implementationWithInterfaces of implementationsWithInterfaces) { - const implementationTypeCapture = new RegExp(`(type[ \\n\\t]*${implementationWithInterfaces.typeName}[a-zA-Z0-9_,.:@"!\\(\\)\\[\\] \\n\\t]*{)([a-zA-Z0-9_,.:@"!\\(\\)\\[\\] \\n\\t]*)}`); + const implementationTypeCapture = new RegExp(`(type[ \\n\\t]*${implementationWithInterfaces.typeName}[a-zA-Z0-9_,.:@"&!\\(\\)\\[\\] \\n\\t]*{)([a-zA-Z0-9_,.:@"&!\\(\\)\\[\\] \\n\\t]*)}`); var bodiesOfInterfaces = implementationWithInterfaces.interfaces .map(interfaceName => { diff --git a/packages/schema/compose/src/templates/schema.mustache.ts b/packages/schema/compose/src/templates/schema.mustache.ts index 9199cff365..9d36573509 100644 --- a/packages/schema/compose/src/templates/schema.mustache.ts +++ b/packages/schema/compose/src/templates/schema.mustache.ts @@ -1,7 +1,7 @@ const template = ` {{#typeInfo}} {{#queryTypes}} -type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}},{{/last}}{{/interfaces}}{{/interfaces.length}}{{#imports.length}} @imports( +type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} &{{/last}}{{/interfaces}}{{/interfaces.length}}{{#imports.length}} @imports( types: [ {{#imports}} "{{type}}"{{^last}},{{/last}} @@ -22,7 +22,7 @@ type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}}, {{/queryTypes}} {{#objectTypes}} -type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}},{{/last}}{{/interfaces}}{{/interfaces.length}} { +type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} &{{/last}}{{/interfaces}}{{/interfaces.length}} { {{#properties}} {{name}}: {{toGraphQLType}} {{/properties}} diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql index 5f69ed234c..4638eaa41f 100644 --- a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql @@ -25,12 +25,22 @@ directive @imports( ### Web3API Header END ### type Mutation { - abstractMethod( + abstractMutationMethod( arg: UInt8! ): String! } +type Query { + abstractQueryMethod( + arg: UInt8! + ): Object! +} + type Object { str: String! uint8: UInt8! } + +type Object2 { + str2: String! +} diff --git a/packages/test-cases/cases/compose/sanity/input/mutation.graphql b/packages/test-cases/cases/compose/sanity/input/mutation.graphql index f2de02bb58..ee45faa694 100644 --- a/packages/test-cases/cases/compose/sanity/input/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/input/mutation.graphql @@ -1,6 +1,6 @@ #import { Query, Mutation, CustomType } into Namespace from "test.eth" #import { Mutation } into JustMutation from "just.mutation.eth" -#import { Object, Mutation } into Interface from "interface.eth" +#import { Object, Object2, Mutation } into Interface from "interface.eth" #import { CommonType } from "../imports-local/common.graphql" type Mutation implements Interface_Mutation { @@ -39,6 +39,6 @@ type AnotherMutationType { prop: String } -type ImplementationObject implements Interface_Object { +type ImplementationObject implements Interface_Object & Interface_Object2 { anotherProp: String -} +} \ No newline at end of file diff --git a/packages/test-cases/cases/compose/sanity/input/query.graphql b/packages/test-cases/cases/compose/sanity/input/query.graphql index 402f8662e2..40de0284b9 100644 --- a/packages/test-cases/cases/compose/sanity/input/query.graphql +++ b/packages/test-cases/cases/compose/sanity/input/query.graphql @@ -1,7 +1,8 @@ #import { Query, CustomType } into Namespace from "test.eth" +#import { Query } into Interface from "interface.eth" #import { CommonType } from "../imports-local/common.graphql" -type Query { +type Query implements Interface_Query { method1( str: String! optStr: String diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index 85a30b1b49..07983dc318 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -36,6 +36,7 @@ type Mutation implements Interface_Mutation @imports( "Namespace_Imported_Enum", "JustMutation_Mutation", "Interface_Object", + "Interface_Object2", "Interface_Mutation" ] ) { @@ -50,7 +51,7 @@ type Mutation implements Interface_Mutation @imports( arg: [String!]! ): [Int64!]! - abstractMethod( + abstractMutationMethod( arg: UInt8! ): String! } @@ -78,10 +79,11 @@ type AnotherMutationType { prop: String } -type ImplementationObject implements Interface_Object { +type ImplementationObject implements Interface_Object & Interface_Object2 { anotherProp: String str: String! uint8: UInt8! + str2: String! } type CommonType { @@ -161,7 +163,7 @@ type Interface_Mutation @imported( namespace: "Interface", nativeType: "Mutation" ) { - abstractMethod( + abstractMutationMethod( arg: UInt8! ): String! } @@ -251,6 +253,14 @@ type Interface_Object @imported( uint8: UInt8! } +type Interface_Object2 @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object2" +) { + str2: String! +} + enum Namespace_CustomEnum @imported( namespace: "Namespace", uri: "test.eth", diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index 385f60d3ab..2b758ac173 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -31,6 +31,7 @@ export const typeInfo: TypeInfo = { { type: "Namespace_Imported_Enum" }, { type: "JustMutation_Mutation" }, { type: "Interface_Object" }, + { type: "Interface_Object2" }, { type: "Interface_Mutation" }, ], interfaces: [ @@ -111,9 +112,9 @@ export const typeInfo: TypeInfo = { { ...createMethodDefinition({ type: "mutation", - name: "abstractMethod", + name: "abstractMutationMethod", return: createScalarPropertyDefinition({ - name: "abstractMethod", + name: "abstractMutationMethod", type: "String", required: true }) @@ -202,13 +203,15 @@ export const typeInfo: TypeInfo = { ...createObjectDefinition({ type: "ImplementationObject", interfaces: [ - { type: "Interface_Object" } + { type: "Interface_Object" }, + { type: "Interface_Object2" } ] }), properties: [ createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), ] }, { @@ -528,9 +531,9 @@ export const typeInfo: TypeInfo = { { ...createMethodDefinition({ type: "mutation", - name: "abstractMethod", + name: "abstractMutationMethod", return: createScalarPropertyDefinition({ - name: "abstractMethod", + name: "abstractMutationMethod", type: "String", required: true }) @@ -767,6 +770,17 @@ export const typeInfo: TypeInfo = { createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), ] }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object2", + type: "Interface_Object2" + }), + properties: [ + createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), + ] + }, ], importedEnumTypes: [ { diff --git a/packages/test-cases/cases/compose/sanity/output/query.graphql b/packages/test-cases/cases/compose/sanity/output/query.graphql index 7e48e47f80..8843e32d25 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.graphql +++ b/packages/test-cases/cases/compose/sanity/output/query.graphql @@ -23,7 +23,7 @@ directive @imports( ) on OBJECT ### Web3API Header END ### -type Query @imports( +type Query implements Interface_Query @imports( types: [ "Namespace_Query", "Namespace_CustomType", @@ -32,7 +32,9 @@ type Query @imports( "Namespace_Imported_NestedObjectType", "Namespace_Imported_ObjectType", "Namespace_CustomEnum", - "Namespace_Imported_Enum" + "Namespace_Imported_Enum", + "Interface_Query", + "Interface_Object" ] ) { method1( @@ -45,6 +47,10 @@ type Query @imports( method2( arg: [String!]! ): [Int64!]! + + abstractQueryMethod( + arg: UInt8! + ): Interface_Object! } type CustomQueryType { @@ -104,6 +110,16 @@ type Namespace_Query @imported( ): [Int64!]! } +type Interface_Query @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Query" +) { + abstractQueryMethod( + arg: UInt8! + ): Interface_Object! +} + ### Imported Queries END ### ### Imported Objects START ### @@ -180,6 +196,15 @@ type Namespace_Imported_ObjectType @imported( prop: String! } +type Interface_Object @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object" +) { + str: String! + uint8: UInt8! +} + enum Namespace_CustomEnum @imported( namespace: "Namespace", uri: "test.eth", diff --git a/packages/test-cases/cases/compose/sanity/output/query.ts b/packages/test-cases/cases/compose/sanity/output/query.ts index 9f91dbfe63..928f3083eb 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.ts +++ b/packages/test-cases/cases/compose/sanity/output/query.ts @@ -135,6 +135,11 @@ export const typeInfo: TypeInfo = { { type: "Namespace_Imported_ObjectType" }, { type: "Namespace_CustomEnum" }, { type: "Namespace_Imported_Enum" }, + { type: "Interface_Query" }, + { type: "Interface_Object" }, + ], + interfaces: [ + { type: "Interface_Query" } ], methods: [ { @@ -207,6 +212,24 @@ export const typeInfo: TypeInfo = { }) }) ] + }, + { + ...createMethodDefinition({ + type: "query", + name: "abstractQueryMethod", + return: createObjectPropertyDefinition({ + name: "abstractQueryMethod", + type: "Interface_Object", + required: true + }) + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }) + ] } ] } @@ -421,6 +444,18 @@ export const typeInfo: TypeInfo = { }), properties: [createScalarPropertyDefinition({ name: "prop", type: "String", required: true })], }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object", + type: "Interface_Object" + }), + properties: [ + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + } ], importedQueryTypes: [ { @@ -506,9 +541,37 @@ export const typeInfo: TypeInfo = { }) }) ] - } + }, + ], + }, + { + ...createImportedQueryDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Query", + type: "Interface_Query" + }), + methods: [ + { + ...createMethodDefinition({ + type: "query", + name: "abstractQueryMethod", + return: createObjectPropertyDefinition({ + name: "abstractQueryMethod", + type: "Interface_Object", + required: true + }) + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }), + ] + }, ] - } + }, ], importedEnumTypes: [ { diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index 17fc80178f..ea86a19ce8 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -23,7 +23,7 @@ directive @imports( ) on OBJECT ### Web3API Header END ### -type Query @imports( +type Query implements Interface_Query @imports( types: [ "Namespace_Query", "Namespace_CustomType", @@ -32,7 +32,9 @@ type Query @imports( "Namespace_Imported_NestedObjectType", "Namespace_Imported_ObjectType", "Namespace_CustomEnum", - "Namespace_Imported_Enum" + "Namespace_Imported_Enum", + "Interface_Query", + "Interface_Object" ] ) { method1( @@ -45,6 +47,10 @@ type Query @imports( method2( arg: [String!]! ): [Int64!]! + + abstractQueryMethod( + arg: UInt8! + ): Interface_Object! } type Mutation implements Interface_Mutation @imports( @@ -60,6 +66,7 @@ type Mutation implements Interface_Mutation @imports( "Namespace_Imported_Enum", "JustMutation_Mutation", "Interface_Object", + "Interface_Object2", "Interface_Mutation" ] ) { @@ -74,7 +81,7 @@ type Mutation implements Interface_Mutation @imports( arg: [String!]! ): [Int64!]! - abstractMethod( + abstractMutationMethod( arg: UInt8! ): String! } @@ -139,10 +146,11 @@ type AnotherMutationType { prop: String } -type ImplementationObject implements Interface_Object { +type ImplementationObject implements Interface_Object & Interface_Object2 { anotherProp: String str: String! uint8: UInt8! + str2: String! } ### Imported Queries START ### @@ -165,6 +173,16 @@ type Namespace_Query @imported( ): [Int64!]! } +type Interface_Query @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Query" +) { + abstractQueryMethod( + arg: UInt8! + ): Interface_Object! +} + type Namespace_Mutation @imported( uri: "test.eth", namespace: "Namespace", @@ -208,7 +226,7 @@ type Interface_Mutation @imported( namespace: "Interface", nativeType: "Mutation" ) { - abstractMethod( + abstractMutationMethod( arg: UInt8! ): String! } @@ -298,6 +316,14 @@ type Interface_Object @imported( uint8: UInt8! } +type Interface_Object2 @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object2" +) { + str2: String! +} + enum Namespace_CustomEnum @imported( namespace: "Namespace", uri: "test.eth", diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index 5160414cbe..7e913c2170 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -28,6 +28,11 @@ export const typeInfo: TypeInfo = { { type: "Namespace_Imported_ObjectType" }, { type: "Namespace_CustomEnum" }, { type: "Namespace_Imported_Enum" }, + { type: "Interface_Query" }, + { type: "Interface_Object" }, + ], + interfaces: [ + { type: "Interface_Query" } ], methods: [ { @@ -100,6 +105,24 @@ export const typeInfo: TypeInfo = { }) }) ] + }, + { + ...createMethodDefinition({ + type: "query", + name: "abstractQueryMethod", + return: createObjectPropertyDefinition({ + name: "abstractQueryMethod", + type: "Interface_Object", + required: true + }) + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }) + ] } ] }, @@ -117,6 +140,7 @@ export const typeInfo: TypeInfo = { { type: "Namespace_Imported_Enum" }, { type: "JustMutation_Mutation" }, { type: "Interface_Object" }, + { type: "Interface_Object2" }, { type: "Interface_Mutation" }, ], methods: [ @@ -194,9 +218,9 @@ export const typeInfo: TypeInfo = { { ...createMethodDefinition({ type: "mutation", - name: "abstractMethod", + name: "abstractMutationMethod", return: createScalarPropertyDefinition({ - name: "abstractMethod", + name: "abstractMutationMethod", type: "String", required: true }) @@ -394,13 +418,15 @@ export const typeInfo: TypeInfo = { ...createObjectDefinition({ type: "ImplementationObject", interfaces: [ - { type: "Interface_Object" } + { type: "Interface_Object" }, + { type: "Interface_Object2" } ] }), properties: [ createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), ] } ], @@ -491,6 +517,34 @@ export const typeInfo: TypeInfo = { } ] }, + { + ...createImportedQueryDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Query", + type: "Interface_Query" + }), + methods: [ + { + ...createMethodDefinition({ + type: "query", + name: "abstractQueryMethod", + return: createObjectPropertyDefinition({ + name: "abstractQueryMethod", + type: "Interface_Object", + required: true + }) + }), + arguments: [ + createScalarPropertyDefinition({ + name: "arg", + required: true, + type: "UInt8" + }), + ] + }, + ] + }, { ...createImportedQueryDefinition({ uri: "test.eth", @@ -682,9 +736,9 @@ export const typeInfo: TypeInfo = { { ...createMethodDefinition({ type: "mutation", - name: "abstractMethod", + name: "abstractMutationMethod", return: createScalarPropertyDefinition({ - name: "abstractMethod", + name: "abstractMutationMethod", type: "String", required: true }) @@ -921,6 +975,17 @@ export const typeInfo: TypeInfo = { createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), ] }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object2", + type: "Interface_Object2" + }), + properties: [ + createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), + ] + }, ], importedEnumTypes: [ { diff --git a/packages/test-cases/cases/parse/sanity/input.graphql b/packages/test-cases/cases/parse/sanity/input.graphql index 968ac4cde0..da6b077a7c 100644 --- a/packages/test-cases/cases/parse/sanity/input.graphql +++ b/packages/test-cases/cases/parse/sanity/input.graphql @@ -70,10 +70,11 @@ type UserObject { fieldB: Int! } -type ImplementationObject implements Interface_Object { +type ImplementationObject implements Interface_Object & Interface_Object2 { anotherProp: String str: String! uint8: UInt8! + str2: String! } type Query implements Interface_Query @imports( @@ -180,3 +181,11 @@ type Interface_Object @imported( str: String! uint8: UInt8! } + +type Interface_Object2 @imported( + uri: "interface.uri.eth", + namespace: "Interface", + nativeType: "Object2" +) { + str2: String! +} diff --git a/packages/test-cases/cases/parse/sanity/output.ts b/packages/test-cases/cases/parse/sanity/output.ts index 60bc1962c6..574309765f 100644 --- a/packages/test-cases/cases/parse/sanity/output.ts +++ b/packages/test-cases/cases/parse/sanity/output.ts @@ -191,13 +191,15 @@ export const output: TypeInfo = { ...createObjectDefinition({ type: "ImplementationObject", interfaces: [ - { type: "Interface_Object" } + { type: "Interface_Object" }, + { type: "Interface_Object2" } ] }), properties: [ createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }) + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), ], }, ], @@ -358,6 +360,21 @@ export const output: TypeInfo = { }) ], }, + { + ...createImportedObjectDefinition({ + uri: "interface.uri.eth", + namespace: "Interface", + type: "Interface_Object2", + nativeType: "Object2" + }), + properties: [ + createScalarPropertyDefinition({ + name: "str2", + type: "String", + required: true + }) + ], + }, ], importedQueryTypes: [ { From 45e6818053b0893c1a0cf967f5b7fb1872011e41 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 17 Jun 2021 12:24:25 +0200 Subject: [PATCH 066/112] covered more test cases --- .../compose/src/templates/schema.mustache.ts | 4 +- .../src/extract/imported-object-types.ts | 1 + .../parse/src/extract/imported-query-types.ts | 1 + .../imports-ext/interface.eth/schema.graphql | 15 ++++-- .../compose/sanity/input/mutation.graphql | 4 +- .../compose/sanity/output/mutation.graphql | 32 ++++++++++--- .../cases/compose/sanity/output/mutation.ts | 42 ++++++++++++++--- .../cases/compose/sanity/output/query.graphql | 26 ++++++++-- .../cases/compose/sanity/output/query.ts | 37 +++++++++++++-- .../compose/sanity/output/schema.graphql | 40 ++++++++++++---- .../cases/compose/sanity/output/schema.ts | 47 +++++++++++++++---- 11 files changed, 203 insertions(+), 46 deletions(-) diff --git a/packages/schema/compose/src/templates/schema.mustache.ts b/packages/schema/compose/src/templates/schema.mustache.ts index 9d36573509..3acb7619c2 100644 --- a/packages/schema/compose/src/templates/schema.mustache.ts +++ b/packages/schema/compose/src/templates/schema.mustache.ts @@ -40,7 +40,7 @@ enum {{type}} { ### Imported Queries START ### {{#importedQueryTypes}} -type {{type}} @imported( +type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} &{{/last}}{{/interfaces}}{{/interfaces.length}} @imported( uri: "{{uri}}", namespace: "{{namespace}}", nativeType: "{{nativeType}}" @@ -63,7 +63,7 @@ type {{type}} @imported( ### Imported Objects START ### {{#importedObjectTypes}} -type {{type}} @imported( +type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} &{{/last}}{{/interfaces}}{{/interfaces.length}} @imported( uri: "{{uri}}", namespace: "{{namespace}}", nativeType: "{{nativeType}}" diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index 3aece5b83e..bceeb0bbb9 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -39,6 +39,7 @@ const visitorEnter = ( uri: imported.uri, namespace: imported.namespace, nativeType: imported.nativeType, + interfaces: node.interfaces?.map(x => ({ type: x.name.value })) }); importedObjectTypes.push(importedType); state.currentType = importedType; diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index 74f516af2f..10c093d1a2 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -42,6 +42,7 @@ const visitorEnter = ( uri: imported.uri, namespace: imported.namespace, nativeType: imported.nativeType, + interfaces: node.interfaces?.map(x => ({ type: x.name.value })) }); importedQueryTypes.push(importedType); state.currentImport = importedType; diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql index 4638eaa41f..48618dba85 100644 --- a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql @@ -33,14 +33,23 @@ type Mutation { type Query { abstractQueryMethod( arg: UInt8! - ): Object! + ): InterfaceObject2! } -type Object { +type InterfaceObject1 { str: String! uint8: UInt8! } -type Object2 { +type InterfaceObject2 implements NestedInterfaceObject { str2: String! + object: Object +} + +type NestedInterfaceObject { + object: Object } + +type Object { + uint8: UInt8! +} \ No newline at end of file diff --git a/packages/test-cases/cases/compose/sanity/input/mutation.graphql b/packages/test-cases/cases/compose/sanity/input/mutation.graphql index ee45faa694..e945b117f1 100644 --- a/packages/test-cases/cases/compose/sanity/input/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/input/mutation.graphql @@ -1,6 +1,6 @@ #import { Query, Mutation, CustomType } into Namespace from "test.eth" #import { Mutation } into JustMutation from "just.mutation.eth" -#import { Object, Object2, Mutation } into Interface from "interface.eth" +#import { InterfaceObject1, InterfaceObject2, Mutation } into Interface from "interface.eth" #import { CommonType } from "../imports-local/common.graphql" type Mutation implements Interface_Mutation { @@ -39,6 +39,6 @@ type AnotherMutationType { prop: String } -type ImplementationObject implements Interface_Object & Interface_Object2 { +type ImplementationObject implements Interface_InterfaceObject1 & Interface_InterfaceObject2 { anotherProp: String } \ No newline at end of file diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index 07983dc318..0ba793e7f5 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -35,8 +35,10 @@ type Mutation implements Interface_Mutation @imports( "Namespace_CustomEnum", "Namespace_Imported_Enum", "JustMutation_Mutation", + "Interface_InterfaceObject1", + "Interface_InterfaceObject2", "Interface_Object", - "Interface_Object2", + "Interface_NestedInterfaceObject", "Interface_Mutation" ] ) { @@ -79,11 +81,12 @@ type AnotherMutationType { prop: String } -type ImplementationObject implements Interface_Object & Interface_Object2 { +type ImplementationObject implements Interface_InterfaceObject1 & Interface_InterfaceObject2 { anotherProp: String str: String! uint8: UInt8! str2: String! + object: Interface_Object } type CommonType { @@ -244,21 +247,38 @@ type Namespace_CustomType @imported( optImportedEnum: Namespace_Imported_Enum } -type Interface_Object @imported( +type Interface_InterfaceObject1 @imported( uri: "interface.eth", namespace: "Interface", - nativeType: "Object" + nativeType: "InterfaceObject1" ) { str: String! uint8: UInt8! } -type Interface_Object2 @imported( +type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @imported( uri: "interface.eth", namespace: "Interface", - nativeType: "Object2" + nativeType: "InterfaceObject2" ) { str2: String! + object: Interface_Object +} + +type Interface_Object @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object" +) { + uint8: UInt8! +} + +type Interface_NestedInterfaceObject @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "NestedInterfaceObject" +) { + object: Interface_Object } enum Namespace_CustomEnum @imported( diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index 2b758ac173..b05170af10 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -30,8 +30,9 @@ export const typeInfo: TypeInfo = { { type: "Namespace_CustomEnum" }, { type: "Namespace_Imported_Enum" }, { type: "JustMutation_Mutation" }, + { type: "Interface_InterfaceObject1" }, + { type: "Interface_InterfaceObject2" }, { type: "Interface_Object" }, - { type: "Interface_Object2" }, { type: "Interface_Mutation" }, ], interfaces: [ @@ -203,8 +204,8 @@ export const typeInfo: TypeInfo = { ...createObjectDefinition({ type: "ImplementationObject", interfaces: [ - { type: "Interface_Object" }, - { type: "Interface_Object2" } + { type: "Interface_InterfaceObject1" }, + { type: "Interface_InterfaceObject2" } ] }), properties: [ @@ -212,6 +213,7 @@ export const typeInfo: TypeInfo = { createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] }, { @@ -762,8 +764,8 @@ export const typeInfo: TypeInfo = { ...createImportedObjectDefinition({ uri: "interface.eth", namespace: "Interface", - nativeType: "Object", - type: "Interface_Object" + nativeType: "InterfaceObject1", + type: "Interface_InterfaceObject1" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), @@ -774,11 +776,37 @@ export const typeInfo: TypeInfo = { ...createImportedObjectDefinition({ uri: "interface.eth", namespace: "Interface", - nativeType: "Object2", - type: "Interface_Object2" + nativeType: "InterfaceObject2", + type: "Interface_InterfaceObject2" }), + interfaces: [ + { type: "Interface_NestedInterfaceObject" } + ], properties: [ createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), + ] + }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "Object", + type: "Interface_Object" + }), + properties: [ + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "NestedInterfaceObject", + type: "Interface_NestedInterfaceObject" + }), + properties: [ + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] }, ], diff --git a/packages/test-cases/cases/compose/sanity/output/query.graphql b/packages/test-cases/cases/compose/sanity/output/query.graphql index 8843e32d25..2c1dd1d1e7 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.graphql +++ b/packages/test-cases/cases/compose/sanity/output/query.graphql @@ -34,7 +34,9 @@ type Query implements Interface_Query @imports( "Namespace_CustomEnum", "Namespace_Imported_Enum", "Interface_Query", - "Interface_Object" + "Interface_InterfaceObject2", + "Interface_Object", + "Interface_NestedInterfaceObject" ] ) { method1( @@ -50,7 +52,7 @@ type Query implements Interface_Query @imports( abstractQueryMethod( arg: UInt8! - ): Interface_Object! + ): Interface_InterfaceObject2! } type CustomQueryType { @@ -117,7 +119,7 @@ type Interface_Query @imported( ) { abstractQueryMethod( arg: UInt8! - ): Interface_Object! + ): Interface_InterfaceObject2! } ### Imported Queries END ### @@ -196,15 +198,31 @@ type Namespace_Imported_ObjectType @imported( prop: String! } +type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "InterfaceObject2" +) { + str2: String! + object: Interface_Object +} + type Interface_Object @imported( uri: "interface.eth", namespace: "Interface", nativeType: "Object" ) { - str: String! uint8: UInt8! } +type Interface_NestedInterfaceObject @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "NestedInterfaceObject" +) { + object: Interface_Object +} + enum Namespace_CustomEnum @imported( namespace: "Namespace", uri: "test.eth", diff --git a/packages/test-cases/cases/compose/sanity/output/query.ts b/packages/test-cases/cases/compose/sanity/output/query.ts index 928f3083eb..23f66ebdaf 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.ts +++ b/packages/test-cases/cases/compose/sanity/output/query.ts @@ -136,10 +136,12 @@ export const typeInfo: TypeInfo = { { type: "Namespace_CustomEnum" }, { type: "Namespace_Imported_Enum" }, { type: "Interface_Query" }, + { type: "Interface_InterfaceObject2" }, { type: "Interface_Object" }, + { type: "Interface_NestedInterfaceObject" }, ], interfaces: [ - { type: "Interface_Query" } + { type: "Interface_Query" }, ], methods: [ { @@ -219,7 +221,7 @@ export const typeInfo: TypeInfo = { name: "abstractQueryMethod", return: createObjectPropertyDefinition({ name: "abstractQueryMethod", - type: "Interface_Object", + type: "Interface_InterfaceObject2", required: true }) }), @@ -444,6 +446,21 @@ export const typeInfo: TypeInfo = { }), properties: [createScalarPropertyDefinition({ name: "prop", type: "String", required: true })], }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "InterfaceObject2", + type: "Interface_InterfaceObject2" + }), + interfaces: [ + { type: "Interface_NestedInterfaceObject" } + ], + properties: [ + createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), + ] + }, { ...createImportedObjectDefinition({ uri: "interface.eth", @@ -452,10 +469,20 @@ export const typeInfo: TypeInfo = { type: "Interface_Object" }), properties: [ - createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), ] - } + }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "NestedInterfaceObject", + type: "Interface_NestedInterfaceObject" + }), + properties: [ + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), + ] + }, ], importedQueryTypes: [ { @@ -558,7 +585,7 @@ export const typeInfo: TypeInfo = { name: "abstractQueryMethod", return: createObjectPropertyDefinition({ name: "abstractQueryMethod", - type: "Interface_Object", + type: "Interface_InterfaceObject2", required: true }) }), diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index ea86a19ce8..a1b8a60737 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -34,7 +34,9 @@ type Query implements Interface_Query @imports( "Namespace_CustomEnum", "Namespace_Imported_Enum", "Interface_Query", - "Interface_Object" + "Interface_InterfaceObject2", + "Interface_Object", + "Interface_NestedInterfaceObject" ] ) { method1( @@ -50,7 +52,7 @@ type Query implements Interface_Query @imports( abstractQueryMethod( arg: UInt8! - ): Interface_Object! + ): Interface_InterfaceObject2! } type Mutation implements Interface_Mutation @imports( @@ -65,8 +67,10 @@ type Mutation implements Interface_Mutation @imports( "Namespace_CustomEnum", "Namespace_Imported_Enum", "JustMutation_Mutation", + "Interface_InterfaceObject1", + "Interface_InterfaceObject2", "Interface_Object", - "Interface_Object2", + "Interface_NestedInterfaceObject", "Interface_Mutation" ] ) { @@ -146,11 +150,12 @@ type AnotherMutationType { prop: String } -type ImplementationObject implements Interface_Object & Interface_Object2 { +type ImplementationObject implements Interface_InterfaceObject1 & Interface_InterfaceObject2 { anotherProp: String str: String! uint8: UInt8! str2: String! + object: Interface_Object } ### Imported Queries START ### @@ -180,7 +185,7 @@ type Interface_Query @imported( ) { abstractQueryMethod( arg: UInt8! - ): Interface_Object! + ): Interface_InterfaceObject2! } type Namespace_Mutation @imported( @@ -307,21 +312,38 @@ type Namespace_Imported_ObjectType @imported( prop: String! } +type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "InterfaceObject2" +) { + str2: String! + object: Interface_Object +} + type Interface_Object @imported( uri: "interface.eth", namespace: "Interface", nativeType: "Object" ) { - str: String! uint8: UInt8! } -type Interface_Object2 @imported( +type Interface_NestedInterfaceObject @imported( uri: "interface.eth", namespace: "Interface", - nativeType: "Object2" + nativeType: "NestedInterfaceObject" ) { - str2: String! + object: Object +} + +type Interface_InterfaceObject1 @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "InterfaceObject1" +) { + str: String! + uint8: UInt8! } enum Namespace_CustomEnum @imported( diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index 7e913c2170..bb65ea3ca0 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -29,7 +29,9 @@ export const typeInfo: TypeInfo = { { type: "Namespace_CustomEnum" }, { type: "Namespace_Imported_Enum" }, { type: "Interface_Query" }, + { type: "Interface_InterfaceObject2" }, { type: "Interface_Object" }, + { type: "Interface_NestedInterfaceObject" }, ], interfaces: [ { type: "Interface_Query" } @@ -112,7 +114,7 @@ export const typeInfo: TypeInfo = { name: "abstractQueryMethod", return: createObjectPropertyDefinition({ name: "abstractQueryMethod", - type: "Interface_Object", + type: "Interface_InterfaceObject2", required: true }) }), @@ -139,9 +141,11 @@ export const typeInfo: TypeInfo = { { type: "Namespace_CustomEnum" }, { type: "Namespace_Imported_Enum" }, { type: "JustMutation_Mutation" }, + { type: "Interface_InterfaceObject1" }, + { type: "Interface_InterfaceObject2" }, { type: "Interface_Object" }, - { type: "Interface_Object2" }, { type: "Interface_Mutation" }, + { type: "Interface_NestedInterfaceObject" }, ], methods: [ { @@ -418,8 +422,8 @@ export const typeInfo: TypeInfo = { ...createObjectDefinition({ type: "ImplementationObject", interfaces: [ - { type: "Interface_Object" }, - { type: "Interface_Object2" } + { type: "Interface_InterfaceObject1" }, + { type: "Interface_InterfaceObject2" } ] }), properties: [ @@ -427,6 +431,7 @@ export const typeInfo: TypeInfo = { createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] } ], @@ -531,7 +536,7 @@ export const typeInfo: TypeInfo = { name: "abstractQueryMethod", return: createObjectPropertyDefinition({ name: "abstractQueryMethod", - type: "Interface_Object", + type: "Interface_InterfaceObject2", required: true }) }), @@ -963,6 +968,21 @@ export const typeInfo: TypeInfo = { }), properties: [createScalarPropertyDefinition({ name: "prop", type: "String", required: true })], }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "InterfaceObject2", + type: "Interface_InterfaceObject2" + }), + interfaces: [ + { type: "Interface_NestedInterfaceObject" } + ], + properties: [ + createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), + ] + }, { ...createImportedObjectDefinition({ uri: "interface.eth", @@ -970,6 +990,17 @@ export const typeInfo: TypeInfo = { nativeType: "Object", type: "Interface_Object" }), + properties: [ + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "InterfaceObject1", + type: "Interface_InterfaceObject1" + }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), @@ -979,11 +1010,11 @@ export const typeInfo: TypeInfo = { ...createImportedObjectDefinition({ uri: "interface.eth", namespace: "Interface", - nativeType: "Object2", - type: "Interface_Object2" + nativeType: "NestedInterfaceObject", + type: "Interface_NestedInterfaceObject" }), properties: [ - createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] }, ], From 087f0209eef6bed9bbe938906926f501a0513174 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 17 Jun 2021 16:30:21 +0200 Subject: [PATCH 067/112] implemented interfaceImplementedDefinition --- packages/schema/compose/src/resolve.ts | 145 ++++++++++++++---- .../src/extract/imported-object-types.ts | 3 +- .../parse/src/extract/imported-query-types.ts | 3 +- .../schema/parse/src/extract/object-types.ts | 3 +- .../schema/parse/src/extract/query-types.ts | 3 +- packages/schema/parse/src/transform/index.ts | 23 +++ .../schema/parse/src/typeInfo/definitions.ts | 21 ++- .../schema/parse/src/validate/directives.ts | 10 +- .../cases/compose/sanity/output/mutation.ts | 12 +- .../cases/compose/sanity/output/query.ts | 7 +- .../compose/sanity/output/schema.graphql | 2 +- .../cases/compose/sanity/output/schema.ts | 29 ++-- 12 files changed, 195 insertions(+), 66 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index ec2c65669c..4564585ed0 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -35,6 +35,7 @@ import { GenericDefinition, isKind, header, + InterfaceImplementedDefinition, } from "@web3api/schema-parse"; type ImplementationWithInterfaces = { @@ -150,18 +151,18 @@ const extractObjectImportDependencies = ( uri: string ): TypeInfoTransforms => { const findImport = ( - def: GenericDefinition, + type: string, namespaceType: string, rootTypes: EnumOrObject[], importedTypes: ImportedEnumOrObject[], kind: DefinitionKind ): ImportedEnumOrObject & Namespaced => { // Find this type's ObjectDefinition in the root type info - let idx = rootTypes.findIndex((obj) => obj.type === def.type); + let idx = rootTypes.findIndex((obj) => obj.type === type); let obj = undefined; if (idx === -1) { - idx = importedTypes.findIndex((obj) => obj.type === def.type); + idx = importedTypes.findIndex((obj) => obj.type === type); } else { obj = rootTypes[idx]; } @@ -169,7 +170,7 @@ const extractObjectImportDependencies = ( if (idx === -1) { throw Error( `extractObjectImportDependencies: Cannot find the dependent type within the root type info.\n` + - `Type: ${def.type}\nTypeInfo: ${JSON.stringify( + `Type: ${type}\nTypeInfo: ${JSON.stringify( rootTypeInfo )}\n${namespace}\n${JSON.stringify(Object.keys(importsFound))}` ); @@ -187,7 +188,7 @@ const extractObjectImportDependencies = ( kind, uri, namespace, - nativeType: def.type, + nativeType: type, }; }; @@ -198,38 +199,97 @@ const extractObjectImportDependencies = ( return def; } - const namespaceType = appendNamespace(namespace, def.type); + const processType = (type: string): string => { + const namespaceType = appendNamespace(namespace, type); + + if (!importsFound[namespaceType]) { + // Find the import + const importFound = findImport( + type, + namespaceType, + rootTypeInfo.objectTypes, + rootTypeInfo.importedObjectTypes, + DefinitionKind.ImportedObject + ) as ImportedObjectDefinition; + + // Keep track of it + importsFound[importFound.type] = importFound; + + // Traverse this newly added object + visitObjectDefinition(importFound, { + ...extractObjectImportDependencies( + importsFound, + rootTypeInfo, + namespace, + uri + ), + leave: { + PropertyDefinition: (def: PropertyDefinition) => { + populatePropertyType(def); + return def; + }, + }, + }); + + // importFound.interfaces = importFound.interfaces.map(x => ({ + // type: processType(x.type) + // })); + } - if (!importsFound[namespaceType]) { - // Find the import - const importFound = findImport( - def, - namespaceType, - rootTypeInfo.objectTypes, - rootTypeInfo.importedObjectTypes, - DefinitionKind.ImportedObject - ) as ImportedObjectDefinition; + return namespaceType; + }; - // Keep track of it - importsFound[importFound.type] = importFound; + processType(def.type); - // Traverse this newly added object - visitObjectDefinition(importFound, { - ...extractObjectImportDependencies( - importsFound, - rootTypeInfo, - namespace, - uri - ), - leave: { - PropertyDefinition: (def: PropertyDefinition) => { - populatePropertyType(def); - return def; - }, - }, - }); + return def; + }, + InterfaceImplementedDefinition: (def: InterfaceImplementedDefinition & Namespaced) => { + if (def.__namespaced) { + return def; } + const processType = (type: string): string => { + const namespaceType = appendNamespace(namespace, type); + + if (!importsFound[namespaceType]) { + // Find the import + const importFound = findImport( + type, + namespaceType, + rootTypeInfo.objectTypes, + rootTypeInfo.importedObjectTypes, + DefinitionKind.ImportedObject + ) as ImportedObjectDefinition; + + // Keep track of it + importsFound[importFound.type] = importFound; + + // Traverse this newly added object + visitObjectDefinition(importFound, { + ...extractObjectImportDependencies( + importsFound, + rootTypeInfo, + namespace, + uri + ), + leave: { + PropertyDefinition: (def: PropertyDefinition) => { + populatePropertyType(def); + return def; + }, + }, + }); + + // importFound.interfaces = importFound.interfaces.map(x => crea({ + // type: processType(x.type) + // })); + } + + return namespaceType; + }; + + processType(def.type); + return def; }, EnumDefinition: (def: EnumDefinition & Namespaced) => { @@ -241,7 +301,7 @@ const extractObjectImportDependencies = ( if (!importsFound[namespaceType]) { // Find the import const importFound = findImport( - def, + def.type, namespaceType, rootTypeInfo.enumTypes, rootTypeInfo.importedEnumTypes, @@ -271,6 +331,17 @@ const namespaceTypes = (namespace: string): TypeInfoTransforms => ({ __namespaced: true, }; }, + InterfaceImplementedDefinition: (def: InterfaceImplementedDefinition & Namespaced) => { + if (def.__namespaced) { + return def; + } + + return { + ...def, + type: appendNamespace(namespace, def.type), + __namespaced: true, + }; + }, EnumDefinition: (def: EnumDefinition & Namespaced) => { if (def.__namespaced) { return def; @@ -511,6 +582,14 @@ async function resolveExternalImports( nativeType: type.type, }; + const baseImportedType = typesToImport[namespacedType]; + + if('interfaces' in baseImportedType) { + // baseImportedType.interfaces = baseImportedType.interfaces.map(x => ({ + // type: appendNamespace(namespace, x.type) + // })); + } + // Extract all object dependencies visitorFunc( type, diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index bceeb0bbb9..95bdf07904 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -2,6 +2,7 @@ import { TypeInfo, ImportedObjectDefinition, createImportedObjectDefinition, + createInterfaceImplementedDefinition, } from "../typeInfo"; import { extractFieldDefinition, @@ -39,7 +40,7 @@ const visitorEnter = ( uri: imported.uri, namespace: imported.namespace, nativeType: imported.nativeType, - interfaces: node.interfaces?.map(x => ({ type: x.name.value })) + interfaces: node.interfaces?.map(x => createInterfaceImplementedDefinition({ type: x.name.value })) }); importedObjectTypes.push(importedType); state.currentType = importedType; diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index 10c093d1a2..d72b455503 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -4,6 +4,7 @@ import { createImportedQueryDefinition, createMethodDefinition, createPropertyDefinition, + createInterfaceImplementedDefinition, } from "../typeInfo"; import { extractInputValueDefinition, @@ -42,7 +43,7 @@ const visitorEnter = ( uri: imported.uri, namespace: imported.namespace, nativeType: imported.nativeType, - interfaces: node.interfaces?.map(x => ({ type: x.name.value })) + interfaces: node.interfaces?.map(x => createInterfaceImplementedDefinition({ type: x.name.value })) }); importedQueryTypes.push(importedType); state.currentImport = importedType; diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index 779de2895e..de604487dd 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -2,6 +2,7 @@ import { TypeInfo, ObjectDefinition, createObjectDefinition, + createInterfaceImplementedDefinition, } from "../typeInfo"; import { extractFieldDefinition, @@ -46,7 +47,7 @@ const visitorEnter = ( // Create a new TypeDefinition const type = createObjectDefinition({ type: node.name.value, - interfaces: node.interfaces?.map(x => ({ type: x.name.value })) + interfaces: node.interfaces?.map(x => createInterfaceImplementedDefinition({ type: x.name.value })) }); objectTypes.push(type); state.currentType = type; diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index ca111ebe67..743ca540d6 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -4,6 +4,7 @@ import { createQueryDefinition, createMethodDefinition, createPropertyDefinition, + createInterfaceImplementedDefinition, } from "../typeInfo"; import { extractInputValueDefinition, @@ -44,7 +45,7 @@ const visitorEnter = ( const query = createQueryDefinition({ type: nodeName, imports, - interfaces: node.interfaces?.map(x => ({ type: x.name.value })) + interfaces: node.interfaces?.map(x => createInterfaceImplementedDefinition({ type: x.name.value })) }); queryTypes.push(query); state.currentQuery = query; diff --git a/packages/schema/parse/src/transform/index.ts b/packages/schema/parse/src/transform/index.ts index 93e88b429a..bf6e992451 100644 --- a/packages/schema/parse/src/transform/index.ts +++ b/packages/schema/parse/src/transform/index.ts @@ -16,6 +16,7 @@ import { isKind, EnumDefinition, ImportedEnumDefinition, + InterfaceImplementedDefinition, } from "../typeInfo"; export * from "./finalizePropertyDef"; @@ -48,6 +49,7 @@ export interface TypeInfoTransformer { ImportedObjectDefinition?: ( def: ImportedObjectDefinition ) => ImportedObjectDefinition; + InterfaceImplementedDefinition?: (def: InterfaceImplementedDefinition) => InterfaceImplementedDefinition; } export function transformTypeInfo( @@ -120,6 +122,23 @@ export function visitObjectDefinition( ); } + for (let i = 0; i < result.interfaces.length; ++i) { + result.interfaces[i] = visitInterfaceImplementedDefinition( + result.interfaces[i], + transforms + ); + } + + return transformType(result, transforms.leave); +} + +export function visitInterfaceImplementedDefinition( + def: InterfaceImplementedDefinition, + transforms: TypeInfoTransforms +): InterfaceImplementedDefinition { + let result = Object.assign({}, def); + result = transformType(result, transforms.enter); + return transformType(result, transforms.leave); } @@ -281,6 +300,7 @@ export function transformType( ImportedEnumDefinition, ImportedQueryDefinition, ImportedObjectDefinition, + InterfaceImplementedDefinition, } = transform; if (GenericDefinition && isKind(result, DefinitionKind.Generic)) { @@ -322,6 +342,9 @@ export function transformType( ) { result = Object.assign(result, ImportedObjectDefinition(result as any)); } + if (InterfaceImplementedDefinition && isKind(result, DefinitionKind.InterfaceImplemented)) { + result = Object.assign(result, InterfaceImplementedDefinition(result as any)); + } return result; } diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index 3551ddfa90..c3fb32ce14 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -15,6 +15,7 @@ export enum DefinitionKind { ImportedQuery = 1 << 8, ImportedEnum = 1 << 9, ImportedObject = (1 << 10) | DefinitionKind.Object, + InterfaceImplemented = 1 << 11 } export function isKind(type: GenericDefinition, kind: DefinitionKind): boolean { @@ -42,14 +43,14 @@ export function createGenericDefinition(args: { export interface ObjectDefinition extends GenericDefinition { properties: PropertyDefinition[]; - interfaces: { type: string }[]; + interfaces: InterfaceImplementedDefinition[]; } export function createObjectDefinition(args: { type: string; name?: string | null; required?: boolean; properties?: PropertyDefinition[], - interfaces?: { type: string }[] + interfaces?: InterfaceImplementedDefinition[] }): ObjectDefinition { return { ...createGenericDefinition(args), @@ -171,6 +172,16 @@ export function createPropertyDefinition(args: { }; } +export type InterfaceImplementedDefinition = AnyDefinition; +export function createInterfaceImplementedDefinition(args: { + type: string; +}): InterfaceImplementedDefinition { + return { + ...createAnyDefinition(args), + kind: DefinitionKind.InterfaceImplemented, + }; +} + export function createArrayPropertyDefinition(args: { type: string; name?: string | null; @@ -249,12 +260,12 @@ export interface QueryDefinition extends GenericDefinition { type: QueryType; methods: MethodDefinition[]; imports: { type: string }[]; - interfaces: Partial[]; + interfaces: InterfaceImplementedDefinition[]; } export function createQueryDefinition(args: { type: string; imports?: { type: string }[]; - interfaces?: Partial[]; + interfaces?: InterfaceImplementedDefinition[]; required?: boolean; }): QueryDefinition { if (!isQueryType(args.type)) { @@ -311,6 +322,7 @@ export function createImportedQueryDefinition(args: { uri: string; namespace: string; nativeType: string; + interfaces?: InterfaceImplementedDefinition[]; }): ImportedQueryDefinition { if (!isQueryType(args.nativeType)) { throw Error( @@ -338,6 +350,7 @@ export function createImportedObjectDefinition(args: { uri: string; namespace: string; nativeType: string; + interfaces?: InterfaceImplementedDefinition[]; }): ImportedObjectDefinition { return { ...createObjectDefinition(args), diff --git a/packages/schema/parse/src/validate/directives.ts b/packages/schema/parse/src/validate/directives.ts index d70ba1dc34..9942729329 100644 --- a/packages/schema/parse/src/validate/directives.ts +++ b/packages/schema/parse/src/validate/directives.ts @@ -35,8 +35,10 @@ export function supportedDirectives(astNode: DocumentNode): void { export function importsDirective(astNode: DocumentNode): void { let lastNodeVisited = ""; + // let lastNode: ASTNode | undefined; const ObjectTypeDefinition = (node: ObjectTypeDefinitionNode) => { + // lastNode = node; lastNodeVisited = node.kind; const badUsageLocations: string[] = []; @@ -73,7 +75,7 @@ export function importsDirective(astNode: DocumentNode): void { return; } - if (lastNodeVisited !== "ObjectTypeDefinition") { + if (lastNodeVisited !== "ObjectTypeDefinition" && lastNodeVisited !== "NamedType") { throw new Error( `@imports directive should only be used on QUERY or MUTATION type definitions, ` + `but it is being used in the following location: ${path.join(" -> ")}` + @@ -132,10 +134,13 @@ export function importsDirective(astNode: DocumentNode): void { ObjectTypeDefinition(node as ObjectTypeDefinitionNode); } else if (node.kind === "Directive") { Directive(node as DirectiveNode, key, parent, path); + } else if(node.kind.includes("Interface")) { + console.log('sds'); } if (node.kind !== "Name") { lastNodeVisited = node.kind; + // lastNode = node; } }, }); @@ -156,7 +161,8 @@ export function importedDirective(astNode: ASTNode): void { if ( lastNodeVisited !== "ObjectTypeDefinition" && - lastNodeVisited !== "EnumTypeDefinition" + lastNodeVisited !== "EnumTypeDefinition" && + lastNodeVisited !== "NamedType" ) { throw new Error( `@imported directive should only be used on object or enum type definitions, ` + diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index b05170af10..c5d1b6bd24 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -11,7 +11,8 @@ import { createEnumPropertyDefinition, createImportedQueryDefinition, createImportedObjectDefinition, - createImportedEnumDefinition + createImportedEnumDefinition, + createInterfaceImplementedDefinition } from "@web3api/schema-parse"; export const typeInfo: TypeInfo = { @@ -33,10 +34,11 @@ export const typeInfo: TypeInfo = { { type: "Interface_InterfaceObject1" }, { type: "Interface_InterfaceObject2" }, { type: "Interface_Object" }, + { type: "Interface_NestedInterfaceObject" }, { type: "Interface_Mutation" }, ], interfaces: [ - { type: "Interface_Mutation" } + createInterfaceImplementedDefinition({type: "Interface_Mutation"}) ], methods: [ { @@ -204,8 +206,8 @@ export const typeInfo: TypeInfo = { ...createObjectDefinition({ type: "ImplementationObject", interfaces: [ - { type: "Interface_InterfaceObject1" }, - { type: "Interface_InterfaceObject2" } + createInterfaceImplementedDefinition({ type: "Interface_InterfaceObject1" }), + createInterfaceImplementedDefinition({ type: "Interface_InterfaceObject2" }) ] }), properties: [ @@ -780,7 +782,7 @@ export const typeInfo: TypeInfo = { type: "Interface_InterfaceObject2" }), interfaces: [ - { type: "Interface_NestedInterfaceObject" } + createInterfaceImplementedDefinition({ type: "Interface_NestedInterfaceObject" }) ], properties: [ createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), diff --git a/packages/test-cases/cases/compose/sanity/output/query.ts b/packages/test-cases/cases/compose/sanity/output/query.ts index 23f66ebdaf..90f41dab0c 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.ts +++ b/packages/test-cases/cases/compose/sanity/output/query.ts @@ -11,7 +11,8 @@ import { createEnumPropertyDefinition, createImportedQueryDefinition, createImportedObjectDefinition, - createImportedEnumDefinition + createImportedEnumDefinition, + createInterfaceImplementedDefinition } from "@web3api/schema-parse"; export const typeInfo: TypeInfo = { @@ -141,7 +142,7 @@ export const typeInfo: TypeInfo = { { type: "Interface_NestedInterfaceObject" }, ], interfaces: [ - { type: "Interface_Query" }, + createInterfaceImplementedDefinition({ type: "Interface_Query" }), ], methods: [ { @@ -454,7 +455,7 @@ export const typeInfo: TypeInfo = { type: "Interface_InterfaceObject2" }), interfaces: [ - { type: "Interface_NestedInterfaceObject" } + createInterfaceImplementedDefinition({ type: "Interface_NestedInterfaceObject" }) ], properties: [ createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index a1b8a60737..da86c13871 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -334,7 +334,7 @@ type Interface_NestedInterfaceObject @imported( namespace: "Interface", nativeType: "NestedInterfaceObject" ) { - object: Object + object: Interface_Object } type Interface_InterfaceObject1 @imported( diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index bb65ea3ca0..7fa60c6548 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -11,7 +11,8 @@ import { createEnumPropertyDefinition, createImportedQueryDefinition, createImportedObjectDefinition, - createImportedEnumDefinition + createImportedEnumDefinition, + createInterfaceImplementedDefinition } from "@web3api/schema-parse"; export const typeInfo: TypeInfo = { @@ -34,7 +35,7 @@ export const typeInfo: TypeInfo = { { type: "Interface_NestedInterfaceObject" }, ], interfaces: [ - { type: "Interface_Query" } + createInterfaceImplementedDefinition({ type: "Interface_Query" }) ], methods: [ { @@ -144,8 +145,8 @@ export const typeInfo: TypeInfo = { { type: "Interface_InterfaceObject1" }, { type: "Interface_InterfaceObject2" }, { type: "Interface_Object" }, - { type: "Interface_Mutation" }, { type: "Interface_NestedInterfaceObject" }, + { type: "Interface_Mutation" }, ], methods: [ { @@ -239,7 +240,7 @@ export const typeInfo: TypeInfo = { }, ], interfaces: [ - { type: "Interface_Mutation" } + createInterfaceImplementedDefinition({ type: "Interface_Mutation" }) ] } ], @@ -422,8 +423,8 @@ export const typeInfo: TypeInfo = { ...createObjectDefinition({ type: "ImplementationObject", interfaces: [ - { type: "Interface_InterfaceObject1" }, - { type: "Interface_InterfaceObject2" } + createInterfaceImplementedDefinition({ type: "Interface_InterfaceObject1" }), + createInterfaceImplementedDefinition({ type: "Interface_InterfaceObject2" }) ] }), properties: [ @@ -976,7 +977,7 @@ export const typeInfo: TypeInfo = { type: "Interface_InterfaceObject2" }), interfaces: [ - { type: "Interface_NestedInterfaceObject" } + createInterfaceImplementedDefinition({ type: "Interface_NestedInterfaceObject" }) ], properties: [ createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), @@ -998,23 +999,23 @@ export const typeInfo: TypeInfo = { ...createImportedObjectDefinition({ uri: "interface.eth", namespace: "Interface", - nativeType: "InterfaceObject1", - type: "Interface_InterfaceObject1" + nativeType: "NestedInterfaceObject", + type: "Interface_NestedInterfaceObject" }), properties: [ - createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] }, { ...createImportedObjectDefinition({ uri: "interface.eth", namespace: "Interface", - nativeType: "NestedInterfaceObject", - type: "Interface_NestedInterfaceObject" + nativeType: "InterfaceObject1", + type: "Interface_InterfaceObject1" }), properties: [ - createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), ] }, ], From 9f31eb4150dcfa30361f4b38efdacd93f8294305 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 17 Jun 2021 16:30:43 +0200 Subject: [PATCH 068/112] refactor --- packages/schema/compose/src/resolve.ts | 148 +++++++++++-------------- 1 file changed, 62 insertions(+), 86 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 4564585ed0..c59e60895f 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -199,47 +199,39 @@ const extractObjectImportDependencies = ( return def; } - const processType = (type: string): string => { - const namespaceType = appendNamespace(namespace, type); - - if (!importsFound[namespaceType]) { - // Find the import - const importFound = findImport( - type, - namespaceType, - rootTypeInfo.objectTypes, - rootTypeInfo.importedObjectTypes, - DefinitionKind.ImportedObject - ) as ImportedObjectDefinition; - - // Keep track of it - importsFound[importFound.type] = importFound; - - // Traverse this newly added object - visitObjectDefinition(importFound, { - ...extractObjectImportDependencies( - importsFound, - rootTypeInfo, - namespace, - uri - ), - leave: { - PropertyDefinition: (def: PropertyDefinition) => { - populatePropertyType(def); - return def; - }, - }, - }); - - // importFound.interfaces = importFound.interfaces.map(x => ({ - // type: processType(x.type) - // })); - } + const type = def.type; - return namespaceType; - }; + const namespaceType = appendNamespace(namespace, type); + + if (!importsFound[namespaceType]) { + // Find the import + const importFound = findImport( + type, + namespaceType, + rootTypeInfo.objectTypes, + rootTypeInfo.importedObjectTypes, + DefinitionKind.ImportedObject + ) as ImportedObjectDefinition; - processType(def.type); + // Keep track of it + importsFound[importFound.type] = importFound; + + // Traverse this newly added object + visitObjectDefinition(importFound, { + ...extractObjectImportDependencies( + importsFound, + rootTypeInfo, + namespace, + uri + ), + leave: { + PropertyDefinition: (def: PropertyDefinition) => { + populatePropertyType(def); + return def; + }, + }, + }); + } return def; }, @@ -248,47 +240,39 @@ const extractObjectImportDependencies = ( return def; } - const processType = (type: string): string => { - const namespaceType = appendNamespace(namespace, type); - - if (!importsFound[namespaceType]) { - // Find the import - const importFound = findImport( - type, - namespaceType, - rootTypeInfo.objectTypes, - rootTypeInfo.importedObjectTypes, - DefinitionKind.ImportedObject - ) as ImportedObjectDefinition; - - // Keep track of it - importsFound[importFound.type] = importFound; - - // Traverse this newly added object - visitObjectDefinition(importFound, { - ...extractObjectImportDependencies( - importsFound, - rootTypeInfo, - namespace, - uri - ), - leave: { - PropertyDefinition: (def: PropertyDefinition) => { - populatePropertyType(def); - return def; - }, - }, - }); - - // importFound.interfaces = importFound.interfaces.map(x => crea({ - // type: processType(x.type) - // })); - } + const type = def.type; + + const namespaceType = appendNamespace(namespace, type); - return namespaceType; - }; + if (!importsFound[namespaceType]) { + // Find the import + const importFound = findImport( + type, + namespaceType, + rootTypeInfo.objectTypes, + rootTypeInfo.importedObjectTypes, + DefinitionKind.ImportedObject + ) as ImportedObjectDefinition; - processType(def.type); + // Keep track of it + importsFound[importFound.type] = importFound; + + // Traverse this newly added object + visitObjectDefinition(importFound, { + ...extractObjectImportDependencies( + importsFound, + rootTypeInfo, + namespace, + uri + ), + leave: { + PropertyDefinition: (def: PropertyDefinition) => { + populatePropertyType(def); + return def; + }, + }, + }); + } return def; }, @@ -582,14 +566,6 @@ async function resolveExternalImports( nativeType: type.type, }; - const baseImportedType = typesToImport[namespacedType]; - - if('interfaces' in baseImportedType) { - // baseImportedType.interfaces = baseImportedType.interfaces.map(x => ({ - // type: appendNamespace(namespace, x.type) - // })); - } - // Extract all object dependencies visitorFunc( type, From 4528f344226749877e7c06ce679dfcfbbb73b684 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 17 Jun 2021 16:56:17 +0200 Subject: [PATCH 069/112] added more tests --- .../imports-ext/interface.eth/schema.graphql | 11 +++++- .../cases/compose/sanity/output/query.graphql | 23 ++++++++++-- .../cases/compose/sanity/output/query.ts | 36 ++++++++++++++++--- .../compose/sanity/output/schema.graphql | 23 ++++++++++-- .../cases/compose/sanity/output/schema.ts | 36 ++++++++++++++++--- 5 files changed, 116 insertions(+), 13 deletions(-) diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql index 48618dba85..4be0899837 100644 --- a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql @@ -32,10 +32,19 @@ type Mutation { type Query { abstractQueryMethod( - arg: UInt8! + arg: QueryInterfaceArgument! ): InterfaceObject2! } +type QueryInterfaceArgument implements NestedQueryInterfaceArgument { + str: String! + uint8: UInt8! +} + +type NestedQueryInterfaceArgument { + uint8: UInt8! +} + type InterfaceObject1 { str: String! uint8: UInt8! diff --git a/packages/test-cases/cases/compose/sanity/output/query.graphql b/packages/test-cases/cases/compose/sanity/output/query.graphql index 2c1dd1d1e7..22c817dc66 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.graphql +++ b/packages/test-cases/cases/compose/sanity/output/query.graphql @@ -34,6 +34,8 @@ type Query implements Interface_Query @imports( "Namespace_CustomEnum", "Namespace_Imported_Enum", "Interface_Query", + "Interface_QueryInterfaceArgument", + "Interface_NestedQueryInterfaceArgument", "Interface_InterfaceObject2", "Interface_Object", "Interface_NestedInterfaceObject" @@ -51,7 +53,7 @@ type Query implements Interface_Query @imports( ): [Int64!]! abstractQueryMethod( - arg: UInt8! + arg: Interface_QueryInterfaceArgument! ): Interface_InterfaceObject2! } @@ -118,7 +120,7 @@ type Interface_Query @imported( nativeType: "Query" ) { abstractQueryMethod( - arg: UInt8! + arg: Interface_QueryInterfaceArgument! ): Interface_InterfaceObject2! } @@ -198,6 +200,23 @@ type Namespace_Imported_ObjectType @imported( prop: String! } +type Interface_QueryInterfaceArgument implements Interface_NestedQueryInterfaceArgument @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "QueryInterfaceArgument" +) { + str: String! + uint8: UInt8! +} + +type Interface_NestedQueryInterfaceArgument @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "NestedQueryInterfaceArgument" +) { + uint8: UInt8! +} + type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @imported( uri: "interface.eth", namespace: "Interface", diff --git a/packages/test-cases/cases/compose/sanity/output/query.ts b/packages/test-cases/cases/compose/sanity/output/query.ts index 90f41dab0c..c73562a687 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.ts +++ b/packages/test-cases/cases/compose/sanity/output/query.ts @@ -137,6 +137,8 @@ export const typeInfo: TypeInfo = { { type: "Namespace_CustomEnum" }, { type: "Namespace_Imported_Enum" }, { type: "Interface_Query" }, + { type: "Interface_QueryInterfaceArgument" }, + { type: "Interface_NestedQueryInterfaceArgument" }, { type: "Interface_InterfaceObject2" }, { type: "Interface_Object" }, { type: "Interface_NestedInterfaceObject" }, @@ -227,10 +229,10 @@ export const typeInfo: TypeInfo = { }) }), arguments: [ - createScalarPropertyDefinition({ + createObjectPropertyDefinition({ name: "arg", required: true, - type: "UInt8" + type: "Interface_QueryInterfaceArgument" }) ] } @@ -447,6 +449,32 @@ export const typeInfo: TypeInfo = { }), properties: [createScalarPropertyDefinition({ name: "prop", type: "String", required: true })], }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "QueryInterfaceArgument", + type: "Interface_QueryInterfaceArgument" + }), + interfaces: [ + createInterfaceImplementedDefinition({ type: "Interface_NestedQueryInterfaceArgument" }) + ], + properties: [ + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "NestedQueryInterfaceArgument", + type: "Interface_NestedQueryInterfaceArgument" + }), + properties: [ + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + }, { ...createImportedObjectDefinition({ uri: "interface.eth", @@ -591,10 +619,10 @@ export const typeInfo: TypeInfo = { }) }), arguments: [ - createScalarPropertyDefinition({ + createObjectPropertyDefinition({ name: "arg", required: true, - type: "UInt8" + type: "Interface_QueryInterfaceArgument" }), ] }, diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index da86c13871..02d1973a74 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -34,6 +34,8 @@ type Query implements Interface_Query @imports( "Namespace_CustomEnum", "Namespace_Imported_Enum", "Interface_Query", + "Interface_QueryInterfaceArgument", + "Interface_NestedQueryInterfaceArgument", "Interface_InterfaceObject2", "Interface_Object", "Interface_NestedInterfaceObject" @@ -51,7 +53,7 @@ type Query implements Interface_Query @imports( ): [Int64!]! abstractQueryMethod( - arg: UInt8! + arg: Interface_QueryInterfaceArgument! ): Interface_InterfaceObject2! } @@ -184,7 +186,7 @@ type Interface_Query @imported( nativeType: "Query" ) { abstractQueryMethod( - arg: UInt8! + arg: Interface_QueryInterfaceArgument! ): Interface_InterfaceObject2! } @@ -312,6 +314,23 @@ type Namespace_Imported_ObjectType @imported( prop: String! } +type Interface_QueryInterfaceArgument implements Interface_NestedQueryInterfaceArgument @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "QueryInterfaceArgument" +) { + str: String! + uint8: UInt8! +} + +type Interface_NestedQueryInterfaceArgument @imported( + uri: "interface.eth", + namespace: "Interface", + nativeType: "NestedQueryInterfaceArgument" +) { + uint8: UInt8! +} + type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @imported( uri: "interface.eth", namespace: "Interface", diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index 7fa60c6548..69f7424fad 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -30,6 +30,8 @@ export const typeInfo: TypeInfo = { { type: "Namespace_CustomEnum" }, { type: "Namespace_Imported_Enum" }, { type: "Interface_Query" }, + { type: "Interface_QueryInterfaceArgument" }, + { type: "Interface_NestedQueryInterfaceArgument" }, { type: "Interface_InterfaceObject2" }, { type: "Interface_Object" }, { type: "Interface_NestedInterfaceObject" }, @@ -120,10 +122,10 @@ export const typeInfo: TypeInfo = { }) }), arguments: [ - createScalarPropertyDefinition({ + createObjectPropertyDefinition({ name: "arg", required: true, - type: "UInt8" + type: "Interface_QueryInterfaceArgument" }) ] } @@ -542,10 +544,10 @@ export const typeInfo: TypeInfo = { }) }), arguments: [ - createScalarPropertyDefinition({ + createObjectPropertyDefinition({ name: "arg", required: true, - type: "UInt8" + type: "Interface_QueryInterfaceArgument" }), ] }, @@ -969,6 +971,32 @@ export const typeInfo: TypeInfo = { }), properties: [createScalarPropertyDefinition({ name: "prop", type: "String", required: true })], }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "QueryInterfaceArgument", + type: "Interface_QueryInterfaceArgument" + }), + interfaces: [ + createInterfaceImplementedDefinition({ type: "Interface_NestedQueryInterfaceArgument" }) + ], + properties: [ + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + }, + { + ...createImportedObjectDefinition({ + uri: "interface.eth", + namespace: "Interface", + nativeType: "NestedQueryInterfaceArgument", + type: "Interface_NestedQueryInterfaceArgument" + }), + properties: [ + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + ] + }, { ...createImportedObjectDefinition({ uri: "interface.eth", From a12eaec56d797996a158750c8ff75905a259acfb Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 17 Jun 2021 19:22:43 +0200 Subject: [PATCH 070/112] imports and imported directive can now be added after 'implements interface' --- .../schema/parse/src/validate/directives.ts | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/packages/schema/parse/src/validate/directives.ts b/packages/schema/parse/src/validate/directives.ts index 9942729329..4fd3b4916f 100644 --- a/packages/schema/parse/src/validate/directives.ts +++ b/packages/schema/parse/src/validate/directives.ts @@ -34,12 +34,10 @@ export function supportedDirectives(astNode: DocumentNode): void { } export function importsDirective(astNode: DocumentNode): void { - let lastNodeVisited = ""; - // let lastNode: ASTNode | undefined; + let isInsideObjectTypeDefinition = false; const ObjectTypeDefinition = (node: ObjectTypeDefinitionNode) => { - // lastNode = node; - lastNodeVisited = node.kind; + isInsideObjectTypeDefinition = true; const badUsageLocations: string[] = []; const importsAllowedObjectTypes = ["Query", "Mutation"]; @@ -75,11 +73,10 @@ export function importsDirective(astNode: DocumentNode): void { return; } - if (lastNodeVisited !== "ObjectTypeDefinition" && lastNodeVisited !== "NamedType") { + if (!isInsideObjectTypeDefinition) { throw new Error( `@imports directive should only be used on QUERY or MUTATION type definitions, ` + - `but it is being used in the following location: ${path.join(" -> ")}` + - `LNV: ${lastNodeVisited}` + `but it is being used in the following location: ${path.join(" -> ")}` ); } @@ -134,20 +131,15 @@ export function importsDirective(astNode: DocumentNode): void { ObjectTypeDefinition(node as ObjectTypeDefinitionNode); } else if (node.kind === "Directive") { Directive(node as DirectiveNode, key, parent, path); - } else if(node.kind.includes("Interface")) { - console.log('sds'); - } - - if (node.kind !== "Name") { - lastNodeVisited = node.kind; - // lastNode = node; + } else if(node.kind !== "NamedType" && node.kind !== "Name") { + isInsideObjectTypeDefinition = false; } }, }); } export function importedDirective(astNode: ASTNode): void { - let lastNodeVisited = ""; + let isInsideObjectOrEnumTypeDefinition = false; const Directive = ( node: DirectiveNode, @@ -159,11 +151,7 @@ export function importedDirective(astNode: ASTNode): void { return; } - if ( - lastNodeVisited !== "ObjectTypeDefinition" && - lastNodeVisited !== "EnumTypeDefinition" && - lastNodeVisited !== "NamedType" - ) { + if (!isInsideObjectOrEnumTypeDefinition) { throw new Error( `@imported directive should only be used on object or enum type definitions, ` + `but it is being used in the following location: ${path.join(" -> ")}` @@ -215,9 +203,11 @@ export function importedDirective(astNode: ASTNode): void { if (node.kind === "Directive") { Directive(node as DirectiveNode, key, parent, path); } - - if (node.kind !== "Name") { - lastNodeVisited = node.kind; + else if(node.kind === "ObjectTypeDefinition" || node.kind === "EnumTypeDefinition") { + isInsideObjectOrEnumTypeDefinition = true; + } + else if(node.kind !== "NamedType" && node.kind !== "Name") { + isInsideObjectOrEnumTypeDefinition = false; } }, }); From 3b3007a5fd7a88f36e4d2c3784b44621d41c4e2c Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 17 Jun 2021 19:40:03 +0200 Subject: [PATCH 071/112] lint fix --- packages/schema/compose/src/resolve.ts | 106 ++++++++++-------- .../src/extract/imported-object-types.ts | 4 +- .../parse/src/extract/imported-query-types.ts | 4 +- .../schema/parse/src/extract/object-types.ts | 8 +- .../schema/parse/src/extract/query-types.ts | 13 ++- .../parse/src/transform/addFirstLast.ts | 2 +- packages/schema/parse/src/transform/index.ts | 14 ++- .../schema/parse/src/typeInfo/definitions.ts | 6 +- .../schema/parse/src/validate/directives.ts | 11 +- 9 files changed, 102 insertions(+), 66 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index c59e60895f..62392f0ff8 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -41,7 +41,7 @@ import { type ImplementationWithInterfaces = { typeName: string; interfaces: string[]; -} +}; export async function resolveImportsAndParseSchemas( schema: string, @@ -71,7 +71,7 @@ export async function resolveImportsAndParseSchemas( const implementationsWithInterfaces = parseInterfaces( implementInterfaceStatments ); - + const externalImportsToResolve: ExternalImport[] = parseExternalImports( externalImportStatements, mutation @@ -108,7 +108,7 @@ export async function resolveImportsAndParseSchemas( .replace(localImportCapture, ""); // Add the @imports directive - newSchema = addQueryImportsDirective(newSchema, externalImports, mutation, subTypeInfo); + newSchema = addQueryImportsDirective(newSchema, externalImports, mutation); //Combine the new schema with the subTypeInfo newSchema = header + newSchema + renderSchema(subTypeInfo, false); @@ -116,13 +116,11 @@ export async function resolveImportsAndParseSchemas( newSchema = resolveInterfaces(newSchema, implementationsWithInterfaces); // Parse the newly formed schema -try -{ - return parseSchema(newSchema); -} -catch(ex) { - throw ''; -} + try { + return parseSchema(newSchema); + } catch (ex) { + throw ""; + } } interface Namespaced { @@ -235,13 +233,15 @@ const extractObjectImportDependencies = ( return def; }, - InterfaceImplementedDefinition: (def: InterfaceImplementedDefinition & Namespaced) => { + InterfaceImplementedDefinition: ( + def: InterfaceImplementedDefinition & Namespaced + ) => { if (def.__namespaced) { return def; } const type = def.type; - + const namespaceType = appendNamespace(namespace, type); if (!importsFound[namespaceType]) { @@ -315,7 +315,9 @@ const namespaceTypes = (namespace: string): TypeInfoTransforms => ({ __namespaced: true, }; }, - InterfaceImplementedDefinition: (def: InterfaceImplementedDefinition & Namespaced) => { + InterfaceImplementedDefinition: ( + def: InterfaceImplementedDefinition & Namespaced + ) => { if (def.__namespaced) { return def; } @@ -353,8 +355,7 @@ function appendNamespace(namespace: string, str: string) { function addQueryImportsDirective( schema: string, externalImports: string[], - mutation: boolean, - subTypeInfo: TypeInfo + mutation: boolean ): string { if (!externalImports.length) { return schema; @@ -369,34 +370,42 @@ function addQueryImportsDirective( .map((type) => `\"${type}\"`) .join(",\n ")}`; - const replacementQueryStr = `type ${mutation ? "Mutation" : "Query"} $1@imports( + const replacementQueryStr = `type ${ + mutation ? "Mutation" : "Query" + } $1@imports( types: [ ${importedTypes} ] ) {`; - return schema.replace(typeCapture, replacementQueryStr, ); + return schema.replace(typeCapture, replacementQueryStr); } function parseInterfaces( implementInterfaceStatments: RegExpMatchArray[] ): ImplementationWithInterfaces[] { - const implementationsWithInterfaces: ImplementationWithInterfaces[] = []; - for(const implementMatch of implementInterfaceStatments) { + for (const implementMatch of implementInterfaceStatments) { const implementStr = implementMatch[1].trim(); const typeCapture = /type[ \n\t]*([a-zA-Z0-9_]+)[ \n\t]*/g; - const typeName = typeCapture.exec(implementMatch[0])![1]; + const typeNameMatches = typeCapture.exec(implementMatch[0]); - var interfaces = [...implementStr.matchAll(/([a-zA-Z0-9_]+)(&\s*\d+)*/g)] - .map(x => x[0]); + if (!typeNameMatches) { + continue; + } + + const typeName = typeNameMatches[1]; + + const interfaces = [ + ...implementStr.matchAll(/([a-zA-Z0-9_]+)(&\s*\d+)*/g), + ].map((x) => x[0]); - implementationsWithInterfaces.push({ - typeName, - interfaces - }); + implementationsWithInterfaces.push({ + typeName, + interfaces, + }); } return implementationsWithInterfaces; @@ -412,49 +421,56 @@ function resolveInterfaces( const getAllUniqueInterfaces = (): string[] => { const allIntefaces = implementationsWithInterfaces - .map(x => x.interfaces) - .reduce((acc, x) => acc.concat(x), []); + .map((x) => x.interfaces) + .reduce((acc, x) => acc.concat(x), []); return [...new Set(allIntefaces)]; }; const allInterfaces = getAllUniqueInterfaces(); - const interfacesWithBodies: { name: string, body: string }[] = []; + const interfacesWithBodies: { name: string; body: string }[] = []; const typeCapture = /type[ \n\t]*([a-zA-Z0-9_]+)[a-zA-Z0-9_,.:@"&!\(\)\[\] \n\t]+{([a-zA-Z0-9_,.:@"&!\(\)\[\] \n\t]*)}/g; const typeMatches = [...schema.matchAll(typeCapture)]; - for(const interfaceName of allInterfaces) { - let match = typeMatches.find(x => x[1] === interfaceName); - if(!match) { + for (const interfaceName of allInterfaces) { + const match = typeMatches.find((x) => x[1] === interfaceName); + if (!match) { continue; } const body = match[2]; - if(!body) { + if (!body) { continue; } interfacesWithBodies.push({ name: interfaceName, - body: body + body: body, }); } - for(const implementationWithInterfaces of implementationsWithInterfaces) { - - const implementationTypeCapture = new RegExp(`(type[ \\n\\t]*${implementationWithInterfaces.typeName}[a-zA-Z0-9_,.:@"&!\\(\\)\\[\\] \\n\\t]*{)([a-zA-Z0-9_,.:@"&!\\(\\)\\[\\] \\n\\t]*)}`); + for (const implementationWithInterfaces of implementationsWithInterfaces) { + const implementationTypeCapture = new RegExp( + `(type[ \\n\\t]*${implementationWithInterfaces.typeName}[a-zA-Z0-9_,.:@"&!\\(\\)\\[\\] \\n\\t]*{)([a-zA-Z0-9_,.:@"&!\\(\\)\\[\\] \\n\\t]*)}` + ); - var bodiesOfInterfaces = implementationWithInterfaces.interfaces - .map(interfaceName => { - return interfacesWithBodies.find(iwb => iwb.name === interfaceName)?.body.trim(); - }); + const bodiesOfInterfaces = implementationWithInterfaces.interfaces.map( + (interfaceName) => { + return interfacesWithBodies + .find((iwb) => iwb.name === interfaceName) + ?.body.trim(); + } + ); - var bodiesOfInterfacesStr = bodiesOfInterfaces - .filter(x => x) - .reduce((acc: any, x: any) => acc + '\n' + x); + const bodiesOfInterfacesStr = bodiesOfInterfaces + .filter((x) => x) + .reduce((acc: string, x: string) => acc + "\n" + x); - schema = schema.replace(implementationTypeCapture, `$1$2${bodiesOfInterfacesStr}}`); + schema = schema.replace( + implementationTypeCapture, + `$1$2${bodiesOfInterfacesStr}}` + ); } return schema; diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index 95bdf07904..c61e1efc95 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -40,7 +40,9 @@ const visitorEnter = ( uri: imported.uri, namespace: imported.namespace, nativeType: imported.nativeType, - interfaces: node.interfaces?.map(x => createInterfaceImplementedDefinition({ type: x.name.value })) + interfaces: node.interfaces?.map((x) => + createInterfaceImplementedDefinition({ type: x.name.value }) + ), }); importedObjectTypes.push(importedType); state.currentType = importedType; diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index d72b455503..47687dd18d 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -43,7 +43,9 @@ const visitorEnter = ( uri: imported.uri, namespace: imported.namespace, nativeType: imported.nativeType, - interfaces: node.interfaces?.map(x => createInterfaceImplementedDefinition({ type: x.name.value })) + interfaces: node.interfaces?.map((x) => + createInterfaceImplementedDefinition({ type: x.name.value }) + ), }); importedQueryTypes.push(importedType); state.currentImport = importedType; diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index de604487dd..72ae5325a6 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -45,10 +45,12 @@ const visitorEnter = ( } // Create a new TypeDefinition - const type = createObjectDefinition({ + const type = createObjectDefinition({ type: node.name.value, - interfaces: node.interfaces?.map(x => createInterfaceImplementedDefinition({ type: x.name.value })) - }); + interfaces: node.interfaces?.map((x) => + createInterfaceImplementedDefinition({ type: x.name.value }) + ), + }); objectTypes.push(type); state.currentType = type; }, diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index 743ca540d6..d3bdf019d7 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -41,11 +41,13 @@ const visitorEnter = ( } const imports = parseImportsDirective(nodeName, node); - + const query = createQueryDefinition({ type: nodeName, imports, - interfaces: node.interfaces?.map(x => createInterfaceImplementedDefinition({ type: x.name.value })) + interfaces: node.interfaces?.map((x) => + createInterfaceImplementedDefinition({ type: x.name.value }) + ), }); queryTypes.push(query); state.currentQuery = query; @@ -85,11 +87,14 @@ const visitorEnter = ( }, }); -const parseImportsDirective = (nodeName: string, node: ObjectTypeDefinitionNode): { type: string }[] => { +const parseImportsDirective = ( + nodeName: string, + node: ObjectTypeDefinitionNode +): { type: string }[] => { // Look for the imports directive, and gather imported types const imports: { type: string }[] = []; - if(!node.directives) { + if (!node.directives) { return imports; } diff --git a/packages/schema/parse/src/transform/addFirstLast.ts b/packages/schema/parse/src/transform/addFirstLast.ts index 9a329d17c8..144201423d 100644 --- a/packages/schema/parse/src/transform/addFirstLast.ts +++ b/packages/schema/parse/src/transform/addFirstLast.ts @@ -19,7 +19,7 @@ export const addFirstLast: TypeInfoTransforms = { ObjectDefinition: (def: ObjectDefinition) => ({ ...def, properties: setFirstLast(def.properties), - interfaces: setFirstLast(def.interfaces) + interfaces: setFirstLast(def.interfaces), }), MethodDefinition: (def: MethodDefinition) => ({ ...def, diff --git a/packages/schema/parse/src/transform/index.ts b/packages/schema/parse/src/transform/index.ts index bf6e992451..ca555bc337 100644 --- a/packages/schema/parse/src/transform/index.ts +++ b/packages/schema/parse/src/transform/index.ts @@ -49,7 +49,9 @@ export interface TypeInfoTransformer { ImportedObjectDefinition?: ( def: ImportedObjectDefinition ) => ImportedObjectDefinition; - InterfaceImplementedDefinition?: (def: InterfaceImplementedDefinition) => InterfaceImplementedDefinition; + InterfaceImplementedDefinition?: ( + def: InterfaceImplementedDefinition + ) => InterfaceImplementedDefinition; } export function transformTypeInfo( @@ -342,8 +344,14 @@ export function transformType( ) { result = Object.assign(result, ImportedObjectDefinition(result as any)); } - if (InterfaceImplementedDefinition && isKind(result, DefinitionKind.InterfaceImplemented)) { - result = Object.assign(result, InterfaceImplementedDefinition(result as any)); + if ( + InterfaceImplementedDefinition && + isKind(result, DefinitionKind.InterfaceImplemented) + ) { + result = Object.assign( + result, + InterfaceImplementedDefinition(result as any) + ); } return result; diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index c3fb32ce14..62f5776732 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -15,7 +15,7 @@ export enum DefinitionKind { ImportedQuery = 1 << 8, ImportedEnum = 1 << 9, ImportedObject = (1 << 10) | DefinitionKind.Object, - InterfaceImplemented = 1 << 11 + InterfaceImplemented = 1 << 11, } export function isKind(type: GenericDefinition, kind: DefinitionKind): boolean { @@ -49,8 +49,8 @@ export function createObjectDefinition(args: { type: string; name?: string | null; required?: boolean; - properties?: PropertyDefinition[], - interfaces?: InterfaceImplementedDefinition[] + properties?: PropertyDefinition[]; + interfaces?: InterfaceImplementedDefinition[]; }): ObjectDefinition { return { ...createGenericDefinition(args), diff --git a/packages/schema/parse/src/validate/directives.ts b/packages/schema/parse/src/validate/directives.ts index 4fd3b4916f..affad9784d 100644 --- a/packages/schema/parse/src/validate/directives.ts +++ b/packages/schema/parse/src/validate/directives.ts @@ -131,7 +131,7 @@ export function importsDirective(astNode: DocumentNode): void { ObjectTypeDefinition(node as ObjectTypeDefinitionNode); } else if (node.kind === "Directive") { Directive(node as DirectiveNode, key, parent, path); - } else if(node.kind !== "NamedType" && node.kind !== "Name") { + } else if (node.kind !== "NamedType" && node.kind !== "Name") { isInsideObjectTypeDefinition = false; } }, @@ -202,11 +202,12 @@ export function importedDirective(astNode: ASTNode): void { ) => { if (node.kind === "Directive") { Directive(node as DirectiveNode, key, parent, path); - } - else if(node.kind === "ObjectTypeDefinition" || node.kind === "EnumTypeDefinition") { + } else if ( + node.kind === "ObjectTypeDefinition" || + node.kind === "EnumTypeDefinition" + ) { isInsideObjectOrEnumTypeDefinition = true; - } - else if(node.kind !== "NamedType" && node.kind !== "Name") { + } else if (node.kind !== "NamedType" && node.kind !== "Name") { isInsideObjectOrEnumTypeDefinition = false; } }, From d7e1307609bd807d31df16f2cde46d856fc09c4a Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 17 Jun 2021 21:53:07 +0200 Subject: [PATCH 072/112] refactor --- packages/schema/compose/src/resolve.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 62392f0ff8..0f556fe783 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -116,11 +116,7 @@ export async function resolveImportsAndParseSchemas( newSchema = resolveInterfaces(newSchema, implementationsWithInterfaces); // Parse the newly formed schema - try { - return parseSchema(newSchema); - } catch (ex) { - throw ""; - } + return parseSchema(newSchema); } interface Namespaced { From 5ab104ee6b394b41a0dde1dbe1cdbd258af04e04 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 17 Jun 2021 23:10:02 +0200 Subject: [PATCH 073/112] updated graphql-schema-cycles dependency version --- packages/schema/parse/package.json | 2 +- yarn.lock | 166 +++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+), 1 deletion(-) diff --git a/packages/schema/parse/package.json b/packages/schema/parse/package.json index 089750810d..879a3613da 100644 --- a/packages/schema/parse/package.json +++ b/packages/schema/parse/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "graphql": "15.5.0", - "graphql-schema-cycles": "1.1.2" + "graphql-schema-cycles": "1.1.3" }, "devDependencies": { "@types/deep-equal": "1.0.1", diff --git a/yarn.lock b/yarn.lock index 84c0555179..6efa75e343 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3619,6 +3619,164 @@ "@typescript-eslint/types" "4.11.1" eslint-visitor-keys "^2.0.0" +"@web3api/cli@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/cli/-/cli-0.0.1-prealpha.24.tgz#6c97d8531816c349198eb58a0fa7af2a70eed18a" + integrity sha512-2IrAMpUjgai0O77dtn+F6SFnTYtgfz5Las/s0QlihYhVlGya4WPt9f2xFuvHm/DWwldfpod/gA5PAO+D/sJITA== + dependencies: + "@formatjs/intl" "1.8.2" + "@types/node" "12.7.11" + "@web3api/client-js" "0.0.1-prealpha.24" + "@web3api/client-test-env" "0.0.1-prealpha.24" + "@web3api/core-js" "0.0.1-prealpha.24" + "@web3api/ens-plugin-js" "0.0.1-prealpha.24" + "@web3api/ethereum-plugin-js" "0.0.1-prealpha.24" + "@web3api/ipfs-plugin-js" "0.0.1-prealpha.24" + "@web3api/os-js" "0.0.1-prealpha.24" + "@web3api/schema-bind" "0.0.1-prealpha.24" + "@web3api/schema-compose" "0.0.1-prealpha.24" + "@web3api/schema-parse" "0.0.1-prealpha.24" + assemblyscript "0.17.14" + axios "0.19.2" + chalk "4.1.0" + chokidar "3.5.1" + fs-extra "9.0.1" + gluegun "4.6.1" + graphql-tag "2.11.0" + ipfs-http-client "48.1.3" + js-yaml "3.14.0" + mustache "4.0.1" + ora "4.0.0" + os-locale "5.0.0" + ws "7.3.1" + +"@web3api/client-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/client-js/-/client-js-0.0.1-prealpha.24.tgz#f38ec697020944fecf0261c9334efbc0a8c24403" + integrity sha512-waSzJlIZ2iDQqKyd6JHZEG9TIGVZTSosDBV/8l39n68s/3EwD5CiToc/UwtdF4RxFHC0jwpNzfZHGbdgflIGQA== + dependencies: + "@msgpack/msgpack" "2.3.0" + "@web3api/core-js" "0.0.1-prealpha.24" + "@web3api/ens-plugin-js" "0.0.1-prealpha.24" + "@web3api/ethereum-plugin-js" "0.0.1-prealpha.24" + "@web3api/ipfs-plugin-js" "0.0.1-prealpha.24" + "@web3api/logger-plugin-js" "0.0.1-prealpha.24" + "@web3api/schema-parse" "0.0.1-prealpha.24" + "@web3api/tracing-js" "0.0.1-prealpha.24" + graphql "15.5.0" + js-yaml "3.14.0" + web-worker "1.0.0" + +"@web3api/client-test-env@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/client-test-env/-/client-test-env-0.0.1-prealpha.24.tgz#8b23d56bfc32f7b76718885e495e5bfc6a795339" + integrity sha512-eNkD/tG5PnFFp7Egy0rAFRrLpD1YCAlvUJ0STVLRQMujMPkFuFEtHziBjVJGJiiyU+1mZ46ub1gEvMbcB7Frpg== + +"@web3api/core-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/core-js/-/core-js-0.0.1-prealpha.24.tgz#426011c3d1695a65adbeaa27e4e94af954c0ae73" + integrity sha512-O7WJ1jXyESLR3JwMZTxS9IMfOtrJbGnb6PTIcthrdkZOUO4zppM8ArJlB9BttQf5vNHdTNnzOOu0pxwkKnLOtg== + dependencies: + "@web3api/manifest-schema" "0.0.1-prealpha.24" + "@web3api/tracing-js" "0.0.1-prealpha.24" + graphql "15.5.0" + graphql-tag "2.10.4" + js-yaml "3.14.0" + jsonschema "1.4.0" + semver "7.3.4" + +"@web3api/ens-plugin-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/ens-plugin-js/-/ens-plugin-js-0.0.1-prealpha.24.tgz#7494e28449764308bfc2bd9ae72d347ef0961b6f" + integrity sha512-NFucvYZ7Ri356IZXvMq6s0vmtMwEoenESUw3Vjy9tc3rpsxNXZHVxfJ14tZjenArZAyVsJDXRBmhuIyJ6mP+jw== + dependencies: + "@ethersproject/address" "5.0.7" + "@web3api/core-js" "0.0.1-prealpha.24" + ethers "5.0.7" + +"@web3api/ethereum-plugin-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/ethereum-plugin-js/-/ethereum-plugin-js-0.0.1-prealpha.24.tgz#9ecfd3be33615a9e7cc46e1d919f56b1a67392b3" + integrity sha512-jWefPeACTk7ziK1fFNhrkKmcHvPcEwQnqs/Av8zKeMe0NMPkDXg17Qjzw++bxzmuJjjlyKDIn2jFBsNkELumNA== + dependencies: + "@ethersproject/address" "5.0.7" + "@ethersproject/providers" "5.0.7" + "@web3api/core-js" "0.0.1-prealpha.24" + ethers "5.0.7" + +"@web3api/ipfs-plugin-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/ipfs-plugin-js/-/ipfs-plugin-js-0.0.1-prealpha.24.tgz#30e3c1e09362e7f80cf4e7a4e0f6860fd9490d8b" + integrity sha512-Gw4pofUMonFHhwR5/30j6wEBqyjX7bwA0zedCflDKSCqd4k8JzSa8KaIaKpX5+DOyrVlAGxspsjxmqqYmaXarA== + dependencies: + "@dorgjelli-test/ipfs-http-client-lite" "0.3.1" + "@web3api/core-js" "0.0.1-prealpha.24" + abort-controller "3.0.0" + cids "^1.1.4" + is-ipfs "1.0.3" + +"@web3api/logger-plugin-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/logger-plugin-js/-/logger-plugin-js-0.0.1-prealpha.24.tgz#77ad91170a154ee31c95e796f784671dcc46a4d4" + integrity sha512-0jwD/PS41uN6LOYSTzTMFC5DuLZ42xDzAw6JNpxu3/V3acioCZzXx33B5Nw3BPSPsO5gATExRU8ExxMWeAFfug== + dependencies: + "@web3api/core-js" "0.0.1-prealpha.24" + +"@web3api/manifest-schema@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/manifest-schema/-/manifest-schema-0.0.1-prealpha.24.tgz#f07e33db19b55538cf171fd6cad5e6d236909931" + integrity sha512-yFGVSOqGChZq7pnOCBr/cK/3wHxZgge6cRyjcwMZGG628wCRijEXqTWd8lCLiaLbs8zLX4JzaoLTcCj/Nkwn4A== + +"@web3api/os-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/os-js/-/os-js-0.0.1-prealpha.24.tgz#da1b7ce7cb57fa8dcfdd2602b0143993359c3a1a" + integrity sha512-iTxS+2zO4Ia3PO99/PDq79uHsrgPPgjfOCqGLneNFx/fAstJEA3z9TT6H+gbYfoBt2YjOixfiQg5Z541yvOmYw== + dependencies: + "@types/node" "12.7.11" + +"@web3api/schema-bind@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/schema-bind/-/schema-bind-0.0.1-prealpha.24.tgz#eaca951913bafc346be3f33e73cc20c91312d163" + integrity sha512-026HW1gapAHb/mVgB2Au9Xnt4yVolXlDmQsRj30j50AgMdkEGDUElrZCH0npIhXFPPnX7m1PlSLUFQGHeLsPeQ== + dependencies: + "@web3api/os-js" "0.0.1-prealpha.24" + "@web3api/schema-parse" "0.0.1-prealpha.24" + mustache "4.0.1" + +"@web3api/schema-compose@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/schema-compose/-/schema-compose-0.0.1-prealpha.24.tgz#8248c7062f910d4f045d3ca450094b4af54c1f07" + integrity sha512-kCAi30pIoKk4KqBSiIY6khRUIIGt3fkudEp5JKTbcjqWrCGq8GxDAZ5ooqd63KxeQRUQ5gCrQY8ztSMwuZfbgw== + dependencies: + "@web3api/schema-parse" "0.0.1-prealpha.24" + graphql "15.5.0" + mustache "4.0.1" + +"@web3api/schema-parse@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/schema-parse/-/schema-parse-0.0.1-prealpha.24.tgz#c492447ff2d6959f6e291aefc97e194bf1cca5ef" + integrity sha512-0CG/4YHMaZyEx5YxUZfBRlrNMyfTjBlniPfR9lrNdpReJPhnx4tDF+uUgFo8NH2M1yUSRLh40txCdDw93wVgdg== + dependencies: + graphql "15.5.0" + graphql-schema-cycles "1.1.2" + +"@web3api/tracing-js@0.0.1-prealpha.24": + version "0.0.1-prealpha.24" + resolved "https://registry.yarnpkg.com/@web3api/tracing-js/-/tracing-js-0.0.1-prealpha.24.tgz#9ba25335c56c45dbbd498a7efd320d4577e480d4" + integrity sha512-UJWBHgqaWslK7GGMjU8KLvVG2Hp4AiHFFga6/C97dFZKXXIaGg3OO7MtTeL3jek8P21FggL23LeZNTkpPCjcTw== + dependencies: + "@opentelemetry/api" "^1.0.0-rc.0" + "@opentelemetry/context-zone" "^0.18.0" + "@opentelemetry/core" "^0.18.0" + "@opentelemetry/exporter-collector" "^0.18.0" + "@opentelemetry/exporter-jaeger" "^0.18.0" + "@opentelemetry/exporter-zipkin" "^0.18.0" + "@opentelemetry/node" "^0.18.0" + "@opentelemetry/propagator-b3" "^0.18.0" + "@opentelemetry/tracing" "^0.18.0" + "@opentelemetry/web" "^0.18.0" + util-inspect "0.1.8" + "@webassemblyjs/ast@1.8.5": version "1.8.5" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" @@ -8878,6 +9036,14 @@ graphql-schema-cycles@1.1.2: graphql "15.5.0" graphql-json-transform "^1.1.0-alpha.0" +graphql-schema-cycles@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/graphql-schema-cycles/-/graphql-schema-cycles-1.1.3.tgz#80c148e2d1bb9f741372b7b54dff950aa2f9c0d2" + integrity sha512-0hQZNUeHlwaoTT6apNWLSeO/gJv/+AbZO1JOPqafMlZUmq+fN+KN3ifjoxIt6kxYSlOOpsEWLf0GWEOMdMwTdg== + dependencies: + graphql "15.5.0" + graphql-json-transform "^1.1.0-alpha.0" + graphql-tag@2.10.4: version "2.10.4" resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.4.tgz#2f301a98219be8b178a6453bb7e33b79b66d8f83" From f94cc74520df77bb212ad4591834f69df731d859 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 18 Jun 2021 19:25:25 +0200 Subject: [PATCH 074/112] local interface test --- .../compose/sanity/input/mutation.graphql | 9 ++++++ .../compose/sanity/output/mutation.graphql | 10 +++++++ .../cases/compose/sanity/output/mutation.ts | 27 ++++++++++++++++- .../compose/sanity/output/schema.graphql | 10 +++++++ .../cases/compose/sanity/output/schema.ts | 29 +++++++++++++++++-- 5 files changed, 82 insertions(+), 3 deletions(-) diff --git a/packages/test-cases/cases/compose/sanity/input/mutation.graphql b/packages/test-cases/cases/compose/sanity/input/mutation.graphql index e945b117f1..4f5b0a22f0 100644 --- a/packages/test-cases/cases/compose/sanity/input/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/input/mutation.graphql @@ -9,6 +9,7 @@ type Mutation implements Interface_Mutation { optStr: String u: UInt! uArrayArray: [[UInt]]! + implObject: LocalImplementationObject! ): String! method2( @@ -41,4 +42,12 @@ type AnotherMutationType { type ImplementationObject implements Interface_InterfaceObject1 & Interface_InterfaceObject2 { anotherProp: String +} + +type LocalImplementationObject implements LocalInterfaceObject { + uint8: UInt8! +} + +type LocalInterfaceObject { + str: String! } \ No newline at end of file diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index 0ba793e7f5..f83082d492 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -47,6 +47,7 @@ type Mutation implements Interface_Mutation @imports( optStr: String u: UInt! uArrayArray: [[UInt]]! + implObject: LocalImplementationObject! ): String! method2( @@ -89,6 +90,15 @@ type ImplementationObject implements Interface_InterfaceObject1 & Interface_Inte object: Interface_Object } +type LocalImplementationObject implements LocalInterfaceObject { + uint8: UInt8! + str: String! +} + +type LocalInterfaceObject { + str: String! +} + type CommonType { prop: UInt8! nestedObject: NestedType! diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index c5d1b6bd24..48d04a786d 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -81,7 +81,12 @@ export const typeInfo: TypeInfo = { type: "UInt" }) }) - }) + }), + createObjectPropertyDefinition({ + name: "implObject", + required: true, + type: "LocalImplementationObject" + }), ] }, { @@ -218,6 +223,26 @@ export const typeInfo: TypeInfo = { createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] }, + { + ...createObjectDefinition({ + type: "LocalImplementationObject", + interfaces: [ + createInterfaceImplementedDefinition({ type: "LocalInterfaceObject" }), + ] + }), + properties: [ + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + ] + }, + { + ...createObjectDefinition({ + type: "LocalInterfaceObject", + }), + properties: [ + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + ] + }, { ...createObjectDefinition({ type: "CommonType" }), properties: [ diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index 02d1973a74..ba402826cd 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -81,6 +81,7 @@ type Mutation implements Interface_Mutation @imports( optStr: String u: UInt! uArrayArray: [[UInt]]! + implObject: LocalImplementationObject! ): String! method2( @@ -160,6 +161,15 @@ type ImplementationObject implements Interface_InterfaceObject1 & Interface_Inte object: Interface_Object } +type LocalImplementationObject implements LocalInterfaceObject { + uint8: UInt8! + str: String! +} + +type LocalInterfaceObject { + str: String! +} + ### Imported Queries START ### type Namespace_Query @imported( diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index 69f7424fad..43a23c1ba3 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -191,7 +191,12 @@ export const typeInfo: TypeInfo = { type: "UInt" }) }) - }) + }), + createObjectPropertyDefinition({ + name: "implObject", + required: true, + type: "LocalImplementationObject" + }), ] }, { @@ -436,7 +441,27 @@ export const typeInfo: TypeInfo = { createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] - } + }, + { + ...createObjectDefinition({ + type: "LocalImplementationObject", + interfaces: [ + createInterfaceImplementedDefinition({ type: "LocalInterfaceObject" }), + ] + }), + properties: [ + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + ] + }, + { + ...createObjectDefinition({ + type: "LocalInterfaceObject", + }), + properties: [ + createScalarPropertyDefinition({ name: "str", type: "String", required: true }), + ] + }, ], importedQueryTypes: [ { From 775a7a980065eac7919e108969200acec779dad4 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Tue, 22 Jun 2021 22:47:17 +0200 Subject: [PATCH 075/112] parallelized extract visitors --- .../schema/parse/src/extract/enum-types.ts | 13 +-- .../parse/src/extract/imported-enum-types.ts | 13 ++- .../src/extract/imported-object-types.ts | 17 ++-- .../parse/src/extract/imported-query-types.ts | 17 ++-- packages/schema/parse/src/extract/index.ts | 33 +++---- .../schema/parse/src/extract/object-types.ts | 17 ++-- .../schema/parse/src/extract/query-types.ts | 17 ++-- packages/schema/parse/src/index.ts | 90 +++++++++++++++++-- 8 files changed, 139 insertions(+), 78 deletions(-) diff --git a/packages/schema/parse/src/extract/enum-types.ts b/packages/schema/parse/src/extract/enum-types.ts index 830dd42380..10699a5d40 100644 --- a/packages/schema/parse/src/extract/enum-types.ts +++ b/packages/schema/parse/src/extract/enum-types.ts @@ -2,9 +2,7 @@ import { TypeInfo, EnumDefinition, createEnumDefinition } from "../typeInfo"; import { DirectiveNode, - DocumentNode, EnumTypeDefinitionNode, - visit, } from "graphql"; const visitorEnter = (enumTypes: EnumDefinition[]) => ({ @@ -34,11 +32,8 @@ const visitorEnter = (enumTypes: EnumDefinition[]) => ({ }, }); -export function extractEnumTypes( - astNode: DocumentNode, +export const getEnumTypesVisitor = ( typeInfo: TypeInfo -): void { - visit(astNode, { - enter: visitorEnter(typeInfo.enumTypes), - }); -} +) => ({ + enter: visitorEnter(typeInfo.enumTypes) +}); diff --git a/packages/schema/parse/src/extract/imported-enum-types.ts b/packages/schema/parse/src/extract/imported-enum-types.ts index 7a8ba17dfd..ecc447bcf0 100644 --- a/packages/schema/parse/src/extract/imported-enum-types.ts +++ b/packages/schema/parse/src/extract/imported-enum-types.ts @@ -5,7 +5,7 @@ import { } from "../typeInfo"; import { extractImportedDefinition } from "./imported-types-utils"; -import { DocumentNode, EnumTypeDefinitionNode, visit } from "graphql"; +import { EnumTypeDefinitionNode } from "graphql"; const visitorEnter = (importedEnumTypes: ImportedEnumDefinition[]) => ({ EnumTypeDefinition: (node: EnumTypeDefinitionNode) => { @@ -33,11 +33,8 @@ const visitorEnter = (importedEnumTypes: ImportedEnumDefinition[]) => ({ }, }); -export function extractImportedEnumTypes( - astNode: DocumentNode, +export const getImportedEnumTypesVisitor = ( typeInfo: TypeInfo -): void { - visit(astNode, { - enter: visitorEnter(typeInfo.importedEnumTypes), - }); -} +) => ({ + enter: visitorEnter(typeInfo.importedEnumTypes) +}); diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index c61e1efc95..5922552b2d 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -14,13 +14,11 @@ import { extractImportedDefinition } from "./imported-types-utils"; import { Blackboard } from "./Blackboard"; import { - DocumentNode, ObjectTypeDefinitionNode, NonNullTypeNode, NamedTypeNode, ListTypeNode, FieldDefinitionNode, - visit, } from "graphql"; const visitorEnter = ( @@ -73,15 +71,14 @@ const visitorLeave = (state: State) => ({ }, }); -export function extractImportedObjectTypes( - astNode: DocumentNode, +export const getImportedObjectTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -): void { +) => { const state: State = {}; - - visit(astNode, { + + return { enter: visitorEnter(typeInfo.importedObjectTypes, state, blackboard), - leave: visitorLeave(state), - }); -} + leave: visitorLeave(state) + }; +}; diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index 47687dd18d..e14ab5936d 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -16,14 +16,12 @@ import { extractImportedDefinition } from "./imported-types-utils"; import { Blackboard } from "./Blackboard"; import { - DocumentNode, ObjectTypeDefinitionNode, NonNullTypeNode, NamedTypeNode, ListTypeNode, FieldDefinitionNode, InputValueDefinitionNode, - visit, } from "graphql"; const visitorEnter = ( @@ -107,15 +105,14 @@ const visitorLeave = (state: State) => ({ }, }); -export function extractImportedQueryTypes( - astNode: DocumentNode, +export const getImportedQueryTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -): void { +) => { const state: State = {}; - - visit(astNode, { + + return { enter: visitorEnter(typeInfo.importedQueryTypes, state, blackboard), - leave: visitorLeave(state), - }); -} + leave: visitorLeave(state) + }; +}; diff --git a/packages/schema/parse/src/extract/index.ts b/packages/schema/parse/src/extract/index.ts index c62d1b7c49..9dbb8d0102 100644 --- a/packages/schema/parse/src/extract/index.ts +++ b/packages/schema/parse/src/extract/index.ts @@ -1,25 +1,26 @@ import { TypeInfo } from "../typeInfo"; -import { extractEnumTypes } from "./enum-types"; -import { extractObjectTypes } from "./object-types"; -import { extractQueryTypes } from "./query-types"; -import { extractImportedObjectTypes } from "./imported-object-types"; -import { extractImportedQueryTypes } from "./imported-query-types"; -import { extractImportedEnumTypes } from "./imported-enum-types"; +import { getEnumTypesVisitor } from "./enum-types"; +import { getObjectTypesVisitor } from "./object-types"; +import { getQueryTypesVisitor } from "./query-types"; +import { getImportedObjectTypesVisitor } from "./imported-object-types"; +import { getImportedQueryTypesVisitor } from "./imported-query-types"; +import { getImportedEnumTypesVisitor } from "./imported-enum-types"; import { Blackboard } from "./Blackboard"; - -import { DocumentNode } from "graphql"; +import { ASTNode } from "graphql"; export type SchemaExtractor = ( - astNode: DocumentNode, typeInfo: TypeInfo, blackboard: Blackboard -) => void; +) => { + enter?: Record void>; + leave?: Record void>; +}; export const extractors: SchemaExtractor[] = [ - extractEnumTypes, - extractImportedEnumTypes, - extractObjectTypes, - extractImportedObjectTypes, - extractQueryTypes, - extractImportedQueryTypes, + getEnumTypesVisitor, + getImportedEnumTypesVisitor, + getObjectTypesVisitor, + getImportedObjectTypesVisitor, + getQueryTypesVisitor, + getImportedQueryTypesVisitor, ]; diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index 72ae5325a6..08de375e8a 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -13,13 +13,11 @@ import { import { Blackboard } from "./Blackboard"; import { - DocumentNode, ObjectTypeDefinitionNode, NonNullTypeNode, NamedTypeNode, ListTypeNode, FieldDefinitionNode, - visit, DirectiveNode, } from "graphql"; @@ -80,15 +78,14 @@ const visitorLeave = (state: State) => ({ }, }); -export function extractObjectTypes( - astNode: DocumentNode, +export const getObjectTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -): void { +) => { const state: State = {}; - - visit(astNode, { + + return { enter: visitorEnter(typeInfo.objectTypes, state, blackboard), - leave: visitorLeave(state), - }); -} + leave: visitorLeave(state) + }; +}; diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index d3bdf019d7..cfc22555d4 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -15,14 +15,12 @@ import { import { Blackboard } from "./Blackboard"; import { - DocumentNode, ObjectTypeDefinitionNode, NonNullTypeNode, NamedTypeNode, ListTypeNode, FieldDefinitionNode, InputValueDefinitionNode, - visit, DirectiveNode, ArgumentNode, ValueNode, @@ -161,15 +159,14 @@ const visitorLeave = (state: State) => ({ }, }); -export function extractQueryTypes( - astNode: DocumentNode, +export const getQueryTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -): void { +) => { const state: State = {}; - - visit(astNode, { + + return { enter: visitorEnter(typeInfo.queryTypes, state, blackboard), - leave: visitorLeave(state), - }); -} + leave: visitorLeave(state) + }; +}; diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index bf15b8c585..453e9c5509 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -5,7 +5,7 @@ import { finalizePropertyDef } from "./transform/finalizePropertyDef"; import { validators, SchemaValidator } from "./validate"; import { Blackboard } from "./extract/Blackboard"; -import { parse } from "graphql"; +import { ASTNode, DocumentNode, parse, visit } from "graphql"; export * from "./typeInfo"; export * from "./transform"; @@ -47,11 +47,9 @@ export function parseSchema( // Extract & Build TypeInfo let info = createTypeInfo(); - const extracts = options.extractors || extractors; - for (const extract of extracts) { - extract(astNode, info, blackboard); - } + const extracts = options.extractors || extractors; + extract(astNode, info, blackboard, extracts); // Finalize & Transform TypeInfo info = transformTypeInfo(info, finalizePropertyDef); @@ -64,3 +62,85 @@ export function parseSchema( return info; } + +const extract = ( + astNode: DocumentNode, + typeInfo: TypeInfo, + blackboard: Blackboard, + extractors: SchemaExtractor[], +) => { + const buildVisitorMaps = () => { + const enterVisitorMap: Record = {}; + const leaveVisitorMap: Record = {}; + + for(const visitor of aggregatedVisitors) { + if(visitor.enter) { + for(const type of Object.keys(visitor.enter)) { + if(!enterVisitorMap[type]) { + enterVisitorMap[type] = []; + } + + enterVisitorMap[type].push(visitor.enter[type]); + } + } + + if(visitor.leave) { + for(const type of Object.keys(visitor.leave)) { + if(!leaveVisitorMap[type]) { + leaveVisitorMap[type] = []; + } + + leaveVisitorMap[type].push(visitor.leave[type]); + } + } + } + + return { + enterVisitorMap, + leaveVisitorMap + }; + }; + + const buildVisitors = () => { + const enterVisitor: Record void> = {}; + const leaveVisitor: Record void> = {}; + + for(const key of Object.keys(enterVisitorMap)) { + enterVisitor[key] = (node) => { + for(const visitorType of enterVisitorMap[key]) { + visitorType(node); + } + }; + } + + for(const key of Object.keys(leaveVisitorMap)) { + leaveVisitor[key] = (node) => { + for(const visitorType of leaveVisitorMap[key]) { + visitorType(node); + } + }; + } + + return { + enterVisitor, + leaveVisitor + }; + }; + + var aggregatedVisitors = extractors.map(getVisitor => getVisitor(typeInfo, blackboard)); + + const { + enterVisitorMap, + leaveVisitorMap + } = buildVisitorMaps(); + + const { + enterVisitor, + leaveVisitor + } = buildVisitors(); + + visit(astNode, { + enter: enterVisitor, + leave: leaveVisitor + }); +}; From b8ba4ad8766f918539735cdd966c2f98e0bbc437 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 24 Jun 2021 13:00:08 +0200 Subject: [PATCH 076/112] implemented aggregateVisitors function --- .../src/__tests__/validate-directives.spec.ts | 12 +- .../src/__tests__/validate-types.spec.ts | 6 +- .../schema/parse/src/aggregateVisitors.ts | 146 +++++++++ packages/schema/parse/src/index.ts | 111 ++----- .../schema/parse/src/validate/directives.ts | 117 ++++---- packages/schema/parse/src/validate/index.ts | 23 +- packages/schema/parse/src/validate/types.ts | 282 +++++++++--------- 7 files changed, 399 insertions(+), 298 deletions(-) create mode 100644 packages/schema/parse/src/aggregateVisitors.ts diff --git a/packages/schema/parse/src/__tests__/validate-directives.spec.ts b/packages/schema/parse/src/__tests__/validate-directives.spec.ts index e6c4ef6439..879fa13652 100644 --- a/packages/schema/parse/src/__tests__/validate-directives.spec.ts +++ b/packages/schema/parse/src/__tests__/validate-directives.spec.ts @@ -72,7 +72,7 @@ describe("Web3API Schema Directives Validation", () => { it("supportedDirectives", () => { expect(() => parseSchema(supportedDirectivesSchema, { validators: [ - directiveValidators.supportedDirectives + directiveValidators.getSupportedDirectivesValidator ] })).toThrow( /Found the following usages of unsupported directives:\n@unknown,\n@anotherUnknown/gm @@ -82,7 +82,7 @@ describe("Web3API Schema Directives Validation", () => { it("importsDirective: Query Object Only", () => { expect(() => parseSchema(importsDirectiveSchema1, { validators: [ - directiveValidators.importsDirective + directiveValidators.getImportsDirectiveValidator ] })).toThrow( /@imports directive should only be used on QUERY or MUTATION type definitions, but it is being used on the following ObjectTypeDefinitions:\nObject/gm @@ -92,7 +92,7 @@ describe("Web3API Schema Directives Validation", () => { it("importsDirective: Improper Placement", () => { expect(() => parseSchema(importsDirectiveSchema2, { validators: [ - directiveValidators.importsDirective + directiveValidators.getImportsDirectiveValidator ] })).toThrow( /@imports directive should only be used on QUERY or MUTATION type definitions, but it is being used in the following location: definitions -> 0 -> fields -> 0 -> directives -> 0/gm @@ -102,7 +102,7 @@ describe("Web3API Schema Directives Validation", () => { it("importsDirective: Incorrect Arguments", () => { expect(() => parseSchema(importsDirectiveSchema3, { validators: [ - directiveValidators.importsDirective + directiveValidators.getImportsDirectiveValidator ] })).toThrow( /@imports directive requires argument 'types' of type \[String!\]!/ @@ -112,7 +112,7 @@ describe("Web3API Schema Directives Validation", () => { it("importedDirective: Incorrect Arguments", () => { expect(() => parseSchema(importedDirectiveSchema1, { validators: [ - directiveValidators.importedDirective + directiveValidators.getImportedDirectiveValidator ] })).toThrow( /@imported directive is missing the following arguments:\n- uri/gm @@ -122,7 +122,7 @@ describe("Web3API Schema Directives Validation", () => { it("importedDirective: Improper Placement", () => { expect(() => parseSchema(importedDirectiveSchema2, { validators: [ - directiveValidators.importedDirective + directiveValidators.getImportedDirectiveValidator ] })).toThrow( /@imported directive should only be used on object or enum type definitions, but it is being used in the following location: definitions -> 0 -> fields -> 0 -> directives -> 0/gm diff --git a/packages/schema/parse/src/__tests__/validate-types.spec.ts b/packages/schema/parse/src/__tests__/validate-types.spec.ts index f24dfe5ca3..201e5902eb 100644 --- a/packages/schema/parse/src/__tests__/validate-types.spec.ts +++ b/packages/schema/parse/src/__tests__/validate-types.spec.ts @@ -220,7 +220,7 @@ type B { describe("Web3API Schema Type Validation", () => { it("typeDefinitions", () => { const exec = (schema: string) => () => parseSchema(schema, { - validators: [typeValidators.typeDefinitions] + validators: [typeValidators.getTypeDefinitionsValidator] }); expect(exec(typeDefinitions1)).toThrow( @@ -246,7 +246,7 @@ describe("Web3API Schema Type Validation", () => { it("propertyTypes", () => { const exec = (schema: string) => () => parseSchema(schema, { - validators: [typeValidators.propertyTypes] + validators: [typeValidators.getPropertyTypesValidator] }); expect(exec(propertyTypes1)).toThrow( @@ -280,7 +280,7 @@ describe("Web3API Schema Type Validation", () => { it("Circular type definitions", () => { const exec = (schema: string) => () => parseSchema(schema, { - validators: [typeValidators.circularDefinitions] + validators: [typeValidators.getCircularDefinitionsValidator] }) expect(exec(circularTypes1)).toThrow( diff --git a/packages/schema/parse/src/aggregateVisitors.ts b/packages/schema/parse/src/aggregateVisitors.ts new file mode 100644 index 0000000000..aeca778b8c --- /dev/null +++ b/packages/schema/parse/src/aggregateVisitors.ts @@ -0,0 +1,146 @@ +import { ASTNode, Visitor, ASTKindToNode } from "graphql"; + +type CatchAllVisitorFunction = ( + node: ASTNode, + key: string | number | undefined, + parent: ASTNode | undefined, + path: ReadonlyArray +) => void; + +type VisitorFunction = (node: ASTNode) => void; + +const buildVisitorMapsAndFuncs = (visitors: { + enter?: Record | CatchAllVisitorFunction, + leave?: Record | CatchAllVisitorFunction +}[]) => { + const enterVisitorMap: Record = {}; + const leaveVisitorMap: Record = {}; + const enterFuncs: Array = []; + const leaveFuncs: Array = []; + + for(const visitor of visitors) { + if(visitor.enter) { + if(typeof visitor.enter === "function") { + enterFuncs.push(visitor.enter); + } else { + for(const nodeKind of Object.keys(visitor.enter)) { + if(!enterVisitorMap[nodeKind]) { + enterVisitorMap[nodeKind] = []; + } + + enterVisitorMap[nodeKind].push(visitor.enter[nodeKind]); + } + } + } + + if(visitor.leave) { + if(typeof visitor.leave === "function") { + leaveFuncs.push(visitor.leave); + } else { + for(const nodeKind of Object.keys(visitor.leave)) { + if(!leaveVisitorMap[nodeKind]) { + leaveVisitorMap[nodeKind] = []; + } + + leaveVisitorMap[nodeKind].push(visitor.leave[nodeKind]); + } + } + } + } + + return { + enterVisitorMap, + leaveVisitorMap, + enterFuncs, + leaveFuncs + }; +}; + +const buildVisitors = ( + enterVisitorMap: Record, + leaveVisitorMap:Record, + enterFuncs: CatchAllVisitorFunction[] = [], + leaveFuncs: CatchAllVisitorFunction[] = [] = [] +) => { + const enterVisitors: Record = {}; + const leaveVisitors: Record = {}; + + for(const key of Object.keys(enterVisitorMap)) { + enterVisitors[key] = (node) => { + for(const visitorType of enterVisitorMap[key]) { + visitorType(node); + } + }; + } + + for(const key of Object.keys(leaveVisitorMap)) { + leaveVisitors[key] = (node) => { + for(const visitorType of leaveVisitorMap[key]) { + visitorType(node); + } + }; + } + + return { + enterVisitor: ( + node: ASTNode, + key: string | number | undefined, + parent: ASTNode | undefined, + path: ReadonlyArray + ) => { + for(const enterFunc of enterFuncs) { + enterFunc(node, key, parent, path); + } + + const enterVisitor = enterVisitors[node.kind]; + + if(enterVisitor) { + enterVisitor(node); + } + }, + leaveVisitor: ( + node: ASTNode, + key: string | number | undefined, + parent: ASTNode | undefined, + path: ReadonlyArray + ) => { + for(const leaveFunc of leaveFuncs) { + leaveFunc(node, key, parent, path); + } + + const leaveVisitor = leaveVisitors[node.kind]; + + if(leaveVisitor) { + leaveVisitor(node); + } + } + }; +}; + +export const aggregateVisitors = (visitors: { + enter?: Record | CatchAllVisitorFunction, + leave?: Record | CatchAllVisitorFunction +}[]): Visitor => { + + const { + enterVisitorMap, + leaveVisitorMap, + enterFuncs, + leaveFuncs + } = buildVisitorMapsAndFuncs(visitors); + + const { + enterVisitor, + leaveVisitor + } = buildVisitors( + enterVisitorMap, + leaveVisitorMap, + enterFuncs, + leaveFuncs + ); + + return { + enter: enterVisitor, + leave: leaveVisitor + }; +}; \ No newline at end of file diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index 453e9c5509..0c1d42ed47 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -4,8 +4,9 @@ import { TypeInfoTransforms, transformTypeInfo } from "./transform"; import { finalizePropertyDef } from "./transform/finalizePropertyDef"; import { validators, SchemaValidator } from "./validate"; import { Blackboard } from "./extract/Blackboard"; +import { aggregateVisitors } from "./aggregateVisitors"; -import { ASTNode, DocumentNode, parse, visit } from "graphql"; +import { DocumentNode, parse, visit } from "graphql"; export * from "./typeInfo"; export * from "./transform"; @@ -27,19 +28,7 @@ export function parseSchema( // Validate GraphQL Schema if (!options.noValidate) { const validates = options.validators || validators; - const errors: Error[] = []; - - for (const validate of validates) { - try { - validate(astNode); - } catch (e) { - errors.push(e); - } - } - - if (errors.length) { - throw errors; - } + validate(astNode, validates); } // Create a blackboard for shared metadata @@ -63,84 +52,32 @@ export function parseSchema( return info; } +const validate = ( + astNode: DocumentNode, + validators: SchemaValidator[], +) => { + + const allValidators = validators.map(getValidator => getValidator()); + const allVisitors = allValidators.map(x => x.visitor); + const allDisplayValidationMessages = allValidators + .map(x => x.displayValidationMessagesIfExist) + .filter(x => x); + + + visit(astNode, aggregateVisitors(allVisitors)); + + for(const displayValidationMessagesIfExist of allDisplayValidationMessages) { + displayValidationMessagesIfExist!(astNode); + } +}; + const extract = ( astNode: DocumentNode, typeInfo: TypeInfo, blackboard: Blackboard, extractors: SchemaExtractor[], ) => { - const buildVisitorMaps = () => { - const enterVisitorMap: Record = {}; - const leaveVisitorMap: Record = {}; - - for(const visitor of aggregatedVisitors) { - if(visitor.enter) { - for(const type of Object.keys(visitor.enter)) { - if(!enterVisitorMap[type]) { - enterVisitorMap[type] = []; - } - - enterVisitorMap[type].push(visitor.enter[type]); - } - } - - if(visitor.leave) { - for(const type of Object.keys(visitor.leave)) { - if(!leaveVisitorMap[type]) { - leaveVisitorMap[type] = []; - } - - leaveVisitorMap[type].push(visitor.leave[type]); - } - } - } - - return { - enterVisitorMap, - leaveVisitorMap - }; - }; + const allVisitors = extractors.map(getVisitor => getVisitor(typeInfo, blackboard)); - const buildVisitors = () => { - const enterVisitor: Record void> = {}; - const leaveVisitor: Record void> = {}; - - for(const key of Object.keys(enterVisitorMap)) { - enterVisitor[key] = (node) => { - for(const visitorType of enterVisitorMap[key]) { - visitorType(node); - } - }; - } - - for(const key of Object.keys(leaveVisitorMap)) { - leaveVisitor[key] = (node) => { - for(const visitorType of leaveVisitorMap[key]) { - visitorType(node); - } - }; - } - - return { - enterVisitor, - leaveVisitor - }; - }; - - var aggregatedVisitors = extractors.map(getVisitor => getVisitor(typeInfo, blackboard)); - - const { - enterVisitorMap, - leaveVisitorMap - } = buildVisitorMaps(); - - const { - enterVisitor, - leaveVisitor - } = buildVisitors(); - - visit(astNode, { - enter: enterVisitor, - leave: leaveVisitor - }); + visit(astNode, aggregateVisitors(allVisitors)); }; diff --git a/packages/schema/parse/src/validate/directives.ts b/packages/schema/parse/src/validate/directives.ts index affad9784d..a54cb1c4ab 100644 --- a/packages/schema/parse/src/validate/directives.ts +++ b/packages/schema/parse/src/validate/directives.ts @@ -1,39 +1,40 @@ import { ImportedDefinition } from "../typeInfo"; import { - visit, DirectiveNode, - DocumentNode, ASTNode, ObjectTypeDefinitionNode, } from "graphql"; -export function supportedDirectives(astNode: DocumentNode): void { +export const getSupportedDirectivesValidator = () => { const supportedDirectives = ["imported", "imports"]; const unsupportedUsages: string[] = []; - visit(astNode, { - enter: { - Directive: (node: DirectiveNode) => { - const name = node.name.value; + return { + visitor: { + enter: { + Directive: (node: DirectiveNode) => { + const name = node.name.value; - if (!supportedDirectives.includes(name)) { - unsupportedUsages.push(name); + if (!supportedDirectives.includes(name)) { + unsupportedUsages.push(name); + } } - }, + } }, - }); - - if (unsupportedUsages.length) { - throw new Error( - `Found the following usages of unsupported directives:${unsupportedUsages.map( - (u) => `\n@${u}` - )}` - ); - } -} + displayValidationMessagesIfExist: () => { + if (unsupportedUsages.length) { + throw new Error( + `Found the following usages of unsupported directives:${unsupportedUsages.map( + (u) => `\n@${u}` + )}` + ); + } + } + }; +}; -export function importsDirective(astNode: DocumentNode): void { +export const getImportsDirectiveValidator = () => { let isInsideObjectTypeDefinition = false; const ObjectTypeDefinition = (node: ObjectTypeDefinitionNode) => { @@ -120,25 +121,27 @@ export function importsDirective(astNode: DocumentNode): void { } }; - visit(astNode, { - enter: ( - node: ASTNode, - key: string | number | undefined, - parent: ASTNode | undefined, - path: ReadonlyArray - ) => { - if (node.kind === "ObjectTypeDefinition") { - ObjectTypeDefinition(node as ObjectTypeDefinitionNode); - } else if (node.kind === "Directive") { - Directive(node as DirectiveNode, key, parent, path); - } else if (node.kind !== "NamedType" && node.kind !== "Name") { - isInsideObjectTypeDefinition = false; - } - }, - }); + return { + visitor: { + enter: ( + node: ASTNode, + key: string | number | undefined, + parent: ASTNode | undefined, + path: ReadonlyArray + ) => { + if (node.kind === "ObjectTypeDefinition") { + ObjectTypeDefinition(node as ObjectTypeDefinitionNode); + } else if (node.kind === "Directive") { + Directive(node as DirectiveNode, key, parent, path); + } else if (node.kind !== "NamedType" && node.kind !== "Name") { + isInsideObjectTypeDefinition = false; + } + }, + } + }; } -export function importedDirective(astNode: ASTNode): void { +export const getImportedDirectiveValidator = () => { let isInsideObjectOrEnumTypeDefinition = false; const Directive = ( @@ -193,23 +196,25 @@ export function importedDirective(astNode: ASTNode): void { } }; - visit(astNode, { - enter: ( - node: ASTNode, - key: string | number | undefined, - parent: ASTNode | undefined, - path: ReadonlyArray - ) => { - if (node.kind === "Directive") { - Directive(node as DirectiveNode, key, parent, path); - } else if ( - node.kind === "ObjectTypeDefinition" || - node.kind === "EnumTypeDefinition" - ) { - isInsideObjectOrEnumTypeDefinition = true; - } else if (node.kind !== "NamedType" && node.kind !== "Name") { - isInsideObjectOrEnumTypeDefinition = false; + return { + visitor: { + enter: ( + node: ASTNode, + key: string | number | undefined, + parent: ASTNode | undefined, + path: ReadonlyArray + ) => { + if (node.kind === "Directive") { + Directive(node as DirectiveNode, key, parent, path); + } else if ( + node.kind === "ObjectTypeDefinition" || + node.kind === "EnumTypeDefinition" + ) { + isInsideObjectOrEnumTypeDefinition = true; + } else if (node.kind !== "NamedType" && node.kind !== "Name") { + isInsideObjectOrEnumTypeDefinition = false; + } } - }, - }); + } + }; } diff --git a/packages/schema/parse/src/validate/index.ts b/packages/schema/parse/src/validate/index.ts index 4974a91d86..4acfac8629 100644 --- a/packages/schema/parse/src/validate/index.ts +++ b/packages/schema/parse/src/validate/index.ts @@ -1,17 +1,22 @@ +import { DocumentNode } from "graphql"; import * as directiveValidators from "./directives"; import * as typeValidators from "./types"; -import { DocumentNode } from "graphql"; - -export type SchemaValidator = (astNode: DocumentNode) => void; +export type SchemaValidator = () => { + visitor: { + enter?: Record, + leave?: Record + }, + displayValidationMessagesIfExist?: (documentNode: DocumentNode) => void +}; export const validators: SchemaValidator[] = [ - directiveValidators.supportedDirectives, - directiveValidators.importedDirective, - directiveValidators.importsDirective, - typeValidators.typeDefinitions, - typeValidators.propertyTypes, - typeValidators.circularDefinitions, + directiveValidators.getSupportedDirectivesValidator, + directiveValidators.getImportedDirectiveValidator, + directiveValidators.getImportsDirectiveValidator, + typeValidators.getTypeDefinitionsValidator, + typeValidators.getPropertyTypesValidator, + typeValidators.getCircularDefinitionsValidator, ]; export { directiveValidators, typeValidators }; diff --git a/packages/schema/parse/src/validate/types.ts b/packages/schema/parse/src/validate/types.ts index 0c0274548f..27223760b7 100644 --- a/packages/schema/parse/src/validate/types.ts +++ b/packages/schema/parse/src/validate/types.ts @@ -5,67 +5,69 @@ import { queryTypeNames, } from "../typeInfo"; -import { DocumentNode, StringValueNode, visit } from "graphql"; +import { DirectiveNode, DocumentNode, EnumTypeDefinitionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, NamedTypeNode, ObjectTypeDefinitionNode, ScalarTypeDefinitionNode, StringValueNode, UnionTypeDefinitionNode } from "graphql"; import { getSchemaCycles } from "graphql-schema-cycles"; -export function typeDefinitions(astNode: DocumentNode): void { +export const getTypeDefinitionsValidator = () => { const objectTypes: Record = {}; - visit(astNode, { - enter: { - // No Interfaces - InterfaceTypeDefinition: (node) => { - throw Error( - "Interface type definitions are not supported.\n" + - `Found: interface ${node.name.value} { ... }\n` + - `Please Use: type ${node.name.value} { ... }` - ); - }, - // No Inputs - InputObjectTypeDefinition: (node) => { - throw Error( - "Input type definitions are not supported.\n" + - `Found: input ${node.name.value} { ... }\n` + - `Please Use: type ${node.name.value} { ... }` - ); - }, - ObjectTypeDefinition: (node) => { - // No Subscriptions - if (node.name.value === "Subscription") { + return { + visitor: { + enter: { + // No Interfaces + InterfaceTypeDefinition: (node: InterfaceTypeDefinitionNode) => { throw Error( - "Subscriptions are not yet supported. Please use Query or Mutation." + "Interface type definitions are not supported.\n" + + `Found: interface ${node.name.value} { ... }\n` + + `Please Use: type ${node.name.value} { ... }` ); - } - - // No duplicates - if (objectTypes[node.name.value]) { + }, + // No Inputs + InputObjectTypeDefinition: (node: InputObjectTypeDefinitionNode) => { throw Error( - `Duplicate object type definition found: ${node.name.value}` + "Input type definitions are not supported.\n" + + `Found: input ${node.name.value} { ... }\n` + + `Please Use: type ${node.name.value} { ... }` ); - } - - objectTypes[node.name.value] = true; - }, - // No New Scalars - ScalarTypeDefinition: (node) => { - if (!isScalarType(node.name.value)) { + }, + ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { + // No Subscriptions + if (node.name.value === "Subscription") { + throw Error( + "Subscriptions are not yet supported. Please use Query or Mutation." + ); + } + + // No duplicates + if (objectTypes[node.name.value]) { + throw Error( + `Duplicate object type definition found: ${node.name.value}` + ); + } + + objectTypes[node.name.value] = true; + }, + // No New Scalars + ScalarTypeDefinition: (node: ScalarTypeDefinitionNode) => { + if (!isScalarType(node.name.value)) { + throw Error( + `Custom scalar types are not supported. Supported scalars: ${scalarTypeNames}` + ); + } + }, + // No Unions + UnionTypeDefinition: (node: UnionTypeDefinitionNode) => { throw Error( - `Custom scalar types are not supported. Supported scalars: ${scalarTypeNames}` + "Union type definitions are not supported.\n" + + `Found: union ${node.name.value}` ); - } - }, - // No Unions - UnionTypeDefinition: (node) => { - throw Error( - "Union type definitions are not supported.\n" + - `Found: union ${node.name.value}` - ); - }, - }, - }); + }, + } + } + }; } -export function propertyTypes(astNode: DocumentNode): void { +export const getPropertyTypesValidator = () => { let currentObject: string | undefined; let currentImportType: string | undefined; let currentField: string | undefined; @@ -77,108 +79,114 @@ export function propertyTypes(astNode: DocumentNode): void { type: string; }[] = []; - visit(astNode, { - enter: { - ObjectTypeDefinition: (node) => { - currentObject = node.name.value; - objectTypes[node.name.value] = true; - }, - EnumTypeDefinition: (node) => { - enumTypes[node.name.value] = true; - }, - Directive: (node) => { - if (node.name.value === "imported") { - // save the imported native type name - if (node.arguments) { - const nativeType = node.arguments.find( - (arg) => arg.name.value === "nativeType" - ); + return { + visitor: { + enter: { + ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { + currentObject = node.name.value; + objectTypes[node.name.value] = true; + }, + EnumTypeDefinition: (node: EnumTypeDefinitionNode) => { + enumTypes[node.name.value] = true; + }, + Directive: (node: DirectiveNode) => { + if (node.name.value === "imported") { + // save the imported native type name + if (node.arguments) { + const nativeType = node.arguments.find( + (arg) => arg.name.value === "nativeType" + ); - if (nativeType) { - currentImportType = (nativeType.value as StringValueNode).value; + if (nativeType) { + currentImportType = (nativeType.value as StringValueNode).value; + } } } - } - }, - FieldDefinition: (node) => { - currentField = node.name.value; + }, + FieldDefinition: (node: FieldDefinitionNode) => { + currentField = node.name.value; + }, + NamedType: (node: NamedTypeNode) => { + if (currentObject && currentField) { + fieldTypes.push({ + object: currentObject, + field: currentField, + type: node.name.value, + }); + } + }, + InputValueDefinition: (node: InputValueDefinitionNode) => { + const typeName = currentImportType ? currentImportType : currentObject; + if (typeName && !isQueryType(typeName)) { + // Arguments not supported on non-query types + throw Error( + `Methods can only be defined on query types (${queryTypeNames.join( + ", " + )}).\n` + + `Found: type ${typeName} { ${currentField}(${node.name.value}) }` + ); + } + }, }, - NamedType: (node) => { - if (currentObject && currentField) { - fieldTypes.push({ - object: currentObject, - field: currentField, - type: node.name.value, - }); - } + leave: { + ObjectTypeDefinition: () => { + currentObject = undefined; + currentImportType = undefined; + }, + FieldDefinition: () => { + currentField = undefined; + }, }, - InputValueDefinition: (node) => { - const typeName = currentImportType ? currentImportType : currentObject; - if (typeName && !isQueryType(typeName)) { - // Arguments not supported on non-query types + }, + displayValidationMessagesIfExist: (documentNode: DocumentNode) => { + // Ensure all property types are either a + // supported scalar, enum or an object type definition + for (const field of fieldTypes) { + if ( + !isScalarType(field.type) && + !objectTypes[field.type] && + !enumTypes[field.type] + ) { throw Error( - `Methods can only be defined on query types (${queryTypeNames.join( - ", " - )}).\n` + - `Found: type ${typeName} { ${currentField}(${node.name.value}) }` + `Unknown property type found: type ${field.object} { ${field.field}: ${field.type} }` ); } - }, - }, - leave: { - ObjectTypeDefinition: () => { - currentObject = undefined; - currentImportType = undefined; - }, - FieldDefinition: () => { - currentField = undefined; - }, - }, - }); - - // Ensure all property types are either a - // supported scalar, enum or an object type definition - for (const field of fieldTypes) { - if ( - !isScalarType(field.type) && - !objectTypes[field.type] && - !enumTypes[field.type] - ) { - throw Error( - `Unknown property type found: type ${field.object} { ${field.field}: ${field.type} }` - ); + } } - } + }; } -export function circularDefinitions(astNode: DocumentNode): void { +export function getCircularDefinitionsValidator() { const operationTypes: string[] = []; const operationTypeNames = ["Mutation", "Subscription", "Query"]; - visit(astNode, { - enter: { - ObjectTypeDefinition: (node) => { - const isOperationType = operationTypeNames.some( - (name) => - node.name.value === name || node.name.value.endsWith(`_${name}`) - ); - if (isOperationType) { - operationTypes.push(node.name.value); - } - }, + return { + visitor: { + enter: { + ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { + const isOperationType = operationTypeNames.some( + (name) => + node.name.value === name || node.name.value.endsWith(`_${name}`) + ); + if (isOperationType) { + operationTypes.push(node.name.value); + } + }, + } }, - }); - - const { cycleStrings, foundCycle } = getSchemaCycles(astNode, { - ignoreTypeNames: operationTypes, - allowOnNullableFields: true, - }); + displayValidationMessagesIfExist: (documentNode: DocumentNode) => { + const { cycleStrings, foundCycle } = getSchemaCycles(documentNode, { + ignoreTypeNames: operationTypes, + allowOnNullableFields: true, + }); - if (foundCycle) { - throw Error( - `Graphql cycles are not supported. \nFound: ${cycleStrings.map( - (cycle) => `\n- ${cycle}` - )}` - ); - } + if (foundCycle) { + throw Error( + `Graphql cycles are not supported. \nFound: ${cycleStrings.map( + (cycle) => `\n- ${cycle}` + )}` + ); + } + } + }; } From 9124fe834ce89fbe7c430264f84f1e4aaeadc584 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 24 Jun 2021 15:05:26 +0200 Subject: [PATCH 077/112] refactor --- .../schema/parse/src/EnterLeaveASTVisitor.ts | 11 +++++ .../schema/parse/src/aggregateVisitors.ts | 41 +++++++++---------- .../schema/parse/src/extract/enum-types.ts | 3 +- .../parse/src/extract/imported-enum-types.ts | 3 +- .../src/extract/imported-object-types.ts | 3 +- .../parse/src/extract/imported-query-types.ts | 3 +- packages/schema/parse/src/extract/index.ts | 7 +--- .../schema/parse/src/extract/object-types.ts | 3 +- .../schema/parse/src/extract/query-types.ts | 3 +- .../schema/parse/src/typeInfo/definitions.ts | 6 +++ packages/schema/parse/src/validate/index.ts | 6 +-- .../test-cases/cases/parse/sanity/output.ts | 11 +++-- 12 files changed, 57 insertions(+), 43 deletions(-) create mode 100644 packages/schema/parse/src/EnterLeaveASTVisitor.ts diff --git a/packages/schema/parse/src/EnterLeaveASTVisitor.ts b/packages/schema/parse/src/EnterLeaveASTVisitor.ts new file mode 100644 index 0000000000..f1d11fa7f1 --- /dev/null +++ b/packages/schema/parse/src/EnterLeaveASTVisitor.ts @@ -0,0 +1,11 @@ +import { ASTKindToNode } from "graphql"; +import { EnterLeave, VisitFn } from "graphql/language/visitor"; + +//Helper type to avoid supporting the full ASTVisitor from graphql +//which can also be of type ShapeMapVisitor +//To fully support ASTVisitor, the aggregateVisitor function should be +//expanded to support ShapeMapVisitor +export type EnterLeaveASTVisitor = EnterLeave< + VisitFn | + { [K in keyof ASTKindToNode]?: VisitFn } +>; \ No newline at end of file diff --git a/packages/schema/parse/src/aggregateVisitors.ts b/packages/schema/parse/src/aggregateVisitors.ts index aeca778b8c..9e70779a08 100644 --- a/packages/schema/parse/src/aggregateVisitors.ts +++ b/packages/schema/parse/src/aggregateVisitors.ts @@ -1,18 +1,12 @@ import { ASTNode, Visitor, ASTKindToNode } from "graphql"; +import { VisitFn } from "graphql/language/visitor"; +import { EnterLeaveASTVisitor } from "./EnterLeaveASTVisitor"; -type CatchAllVisitorFunction = ( - node: ASTNode, - key: string | number | undefined, - parent: ASTNode | undefined, - path: ReadonlyArray -) => void; +type CatchAllVisitorFunction = VisitFn; type VisitorFunction = (node: ASTNode) => void; -const buildVisitorMapsAndFuncs = (visitors: { - enter?: Record | CatchAllVisitorFunction, - leave?: Record | CatchAllVisitorFunction -}[]) => { +const buildVisitorMapsAndFuncs = (visitors: EnterLeaveASTVisitor[]) => { const enterVisitorMap: Record = {}; const leaveVisitorMap: Record = {}; const enterFuncs: Array = []; @@ -23,12 +17,14 @@ const buildVisitorMapsAndFuncs = (visitors: { if(typeof visitor.enter === "function") { enterFuncs.push(visitor.enter); } else { - for(const nodeKind of Object.keys(visitor.enter)) { + for(const key of Object.keys(visitor.enter)) { + const nodeKind = key as keyof ASTKindToNode; + if(!enterVisitorMap[nodeKind]) { enterVisitorMap[nodeKind] = []; } - enterVisitorMap[nodeKind].push(visitor.enter[nodeKind]); + enterVisitorMap[nodeKind].push(visitor.enter[nodeKind] as VisitorFunction); } } } @@ -37,12 +33,14 @@ const buildVisitorMapsAndFuncs = (visitors: { if(typeof visitor.leave === "function") { leaveFuncs.push(visitor.leave); } else { - for(const nodeKind of Object.keys(visitor.leave)) { + for(const key of Object.keys(visitor.leave)) { + const nodeKind = key as keyof ASTKindToNode; + if(!leaveVisitorMap[nodeKind]) { leaveVisitorMap[nodeKind] = []; } - leaveVisitorMap[nodeKind].push(visitor.leave[nodeKind]); + leaveVisitorMap[nodeKind].push(visitor.leave[nodeKind] as VisitorFunction); } } } @@ -86,10 +84,11 @@ const buildVisitors = ( node: ASTNode, key: string | number | undefined, parent: ASTNode | undefined, - path: ReadonlyArray + path: ReadonlyArray, + ancestors: ReadonlyArray> ) => { for(const enterFunc of enterFuncs) { - enterFunc(node, key, parent, path); + enterFunc(node, key, parent, path, ancestors); } const enterVisitor = enterVisitors[node.kind]; @@ -102,10 +101,11 @@ const buildVisitors = ( node: ASTNode, key: string | number | undefined, parent: ASTNode | undefined, - path: ReadonlyArray + path: ReadonlyArray, + ancestors: ReadonlyArray> ) => { for(const leaveFunc of leaveFuncs) { - leaveFunc(node, key, parent, path); + leaveFunc(node, key, parent, path, ancestors); } const leaveVisitor = leaveVisitors[node.kind]; @@ -117,10 +117,7 @@ const buildVisitors = ( }; }; -export const aggregateVisitors = (visitors: { - enter?: Record | CatchAllVisitorFunction, - leave?: Record | CatchAllVisitorFunction -}[]): Visitor => { +export const aggregateVisitors = (visitors: EnterLeaveASTVisitor[]): Visitor => { const { enterVisitorMap, diff --git a/packages/schema/parse/src/extract/enum-types.ts b/packages/schema/parse/src/extract/enum-types.ts index 10699a5d40..1c5b21a562 100644 --- a/packages/schema/parse/src/extract/enum-types.ts +++ b/packages/schema/parse/src/extract/enum-types.ts @@ -4,6 +4,7 @@ import { DirectiveNode, EnumTypeDefinitionNode, } from "graphql"; +import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = (enumTypes: EnumDefinition[]) => ({ EnumTypeDefinition: (node: EnumTypeDefinitionNode) => { @@ -34,6 +35,6 @@ const visitorEnter = (enumTypes: EnumDefinition[]) => ({ export const getEnumTypesVisitor = ( typeInfo: TypeInfo -) => ({ +): EnterLeaveASTVisitor => ({ enter: visitorEnter(typeInfo.enumTypes) }); diff --git a/packages/schema/parse/src/extract/imported-enum-types.ts b/packages/schema/parse/src/extract/imported-enum-types.ts index ecc447bcf0..eae474786b 100644 --- a/packages/schema/parse/src/extract/imported-enum-types.ts +++ b/packages/schema/parse/src/extract/imported-enum-types.ts @@ -6,6 +6,7 @@ import { import { extractImportedDefinition } from "./imported-types-utils"; import { EnumTypeDefinitionNode } from "graphql"; +import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = (importedEnumTypes: ImportedEnumDefinition[]) => ({ EnumTypeDefinition: (node: EnumTypeDefinitionNode) => { @@ -35,6 +36,6 @@ const visitorEnter = (importedEnumTypes: ImportedEnumDefinition[]) => ({ export const getImportedEnumTypesVisitor = ( typeInfo: TypeInfo -) => ({ +): EnterLeaveASTVisitor => ({ enter: visitorEnter(typeInfo.importedEnumTypes) }); diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index 5922552b2d..e7e19bc005 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -20,6 +20,7 @@ import { ListTypeNode, FieldDefinitionNode, } from "graphql"; +import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = ( importedObjectTypes: ImportedObjectDefinition[], @@ -74,7 +75,7 @@ const visitorLeave = (state: State) => ({ export const getImportedObjectTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -) => { +): EnterLeaveASTVisitor => { const state: State = {}; return { diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index e14ab5936d..573ea29ab0 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -23,6 +23,7 @@ import { FieldDefinitionNode, InputValueDefinitionNode, } from "graphql"; +import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = ( importedQueryTypes: ImportedQueryDefinition[], @@ -108,7 +109,7 @@ const visitorLeave = (state: State) => ({ export const getImportedQueryTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -) => { +): EnterLeaveASTVisitor => { const state: State = {}; return { diff --git a/packages/schema/parse/src/extract/index.ts b/packages/schema/parse/src/extract/index.ts index 9dbb8d0102..8006048d12 100644 --- a/packages/schema/parse/src/extract/index.ts +++ b/packages/schema/parse/src/extract/index.ts @@ -6,15 +6,12 @@ import { getImportedObjectTypesVisitor } from "./imported-object-types"; import { getImportedQueryTypesVisitor } from "./imported-query-types"; import { getImportedEnumTypesVisitor } from "./imported-enum-types"; import { Blackboard } from "./Blackboard"; -import { ASTNode } from "graphql"; +import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; export type SchemaExtractor = ( typeInfo: TypeInfo, blackboard: Blackboard -) => { - enter?: Record void>; - leave?: Record void>; -}; +) => EnterLeaveASTVisitor; export const extractors: SchemaExtractor[] = [ getEnumTypesVisitor, diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index 08de375e8a..deb0797cce 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -20,6 +20,7 @@ import { FieldDefinitionNode, DirectiveNode, } from "graphql"; +import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = ( objectTypes: ObjectDefinition[], @@ -81,7 +82,7 @@ const visitorLeave = (state: State) => ({ export const getObjectTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -) => { +): EnterLeaveASTVisitor => { const state: State = {}; return { diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index cfc22555d4..a163c9141b 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -25,6 +25,7 @@ import { ArgumentNode, ValueNode, } from "graphql"; +import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = ( queryTypes: QueryDefinition[], @@ -162,7 +163,7 @@ const visitorLeave = (state: State) => ({ export const getQueryTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -) => { +): EnterLeaveASTVisitor => { const state: State = {}; return { diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index 62f5776732..e7b2ba742d 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -175,6 +175,12 @@ export function createPropertyDefinition(args: { export type InterfaceImplementedDefinition = AnyDefinition; export function createInterfaceImplementedDefinition(args: { type: string; + name?: string | null; + required?: boolean; + array?: ArrayDefinition; + scalar?: ScalarDefinition; + object?: ObjectDefinition; + enum?: EnumDefinition; }): InterfaceImplementedDefinition { return { ...createAnyDefinition(args), diff --git a/packages/schema/parse/src/validate/index.ts b/packages/schema/parse/src/validate/index.ts index 4acfac8629..e4f9c54799 100644 --- a/packages/schema/parse/src/validate/index.ts +++ b/packages/schema/parse/src/validate/index.ts @@ -1,12 +1,10 @@ import { DocumentNode } from "graphql"; +import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; import * as directiveValidators from "./directives"; import * as typeValidators from "./types"; export type SchemaValidator = () => { - visitor: { - enter?: Record, - leave?: Record - }, + visitor: EnterLeaveASTVisitor, displayValidationMessagesIfExist?: (documentNode: DocumentNode) => void }; diff --git a/packages/test-cases/cases/parse/sanity/output.ts b/packages/test-cases/cases/parse/sanity/output.ts index 574309765f..f85c61fd53 100644 --- a/packages/test-cases/cases/parse/sanity/output.ts +++ b/packages/test-cases/cases/parse/sanity/output.ts @@ -12,7 +12,8 @@ import { createImportedQueryDefinition, createEnumDefinition, createEnumPropertyDefinition, - createImportedEnumDefinition + createImportedEnumDefinition, + createInterfaceImplementedDefinition } from "../../../../schema/parse/src/typeInfo"; export const output: TypeInfo = { @@ -191,8 +192,8 @@ export const output: TypeInfo = { ...createObjectDefinition({ type: "ImplementationObject", interfaces: [ - { type: "Interface_Object" }, - { type: "Interface_Object2" } + createInterfaceImplementedDefinition({ type: "Interface_Object" }), + createInterfaceImplementedDefinition({ type: "Interface_Object2" }) ] }), properties: [ @@ -224,9 +225,7 @@ export const output: TypeInfo = { type: "Query", imports: [{ type: "TestImport_Query" }, { type: "Interface_Query" }], interfaces: [ - { - type: "Interface_Query", - }, + createInterfaceImplementedDefinition({ type: "Interface_Query" }), ] }), methods: [ From ebb31b097292741bf499885499799a755a5656a2 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 24 Jun 2021 15:30:02 +0200 Subject: [PATCH 078/112] removed aggregateVisitors and using visitInParallel from graphql --- .../schema/parse/src/EnterLeaveASTVisitor.ts | 11 -- .../schema/parse/src/aggregateVisitors.ts | 143 ------------------ .../schema/parse/src/extract/enum-types.ts | 4 +- .../parse/src/extract/imported-enum-types.ts | 5 +- .../src/extract/imported-object-types.ts | 4 +- .../parse/src/extract/imported-query-types.ts | 4 +- packages/schema/parse/src/extract/index.ts | 4 +- .../schema/parse/src/extract/object-types.ts | 4 +- .../schema/parse/src/extract/query-types.ts | 4 +- packages/schema/parse/src/index.ts | 7 +- packages/schema/parse/src/validate/index.ts | 5 +- 11 files changed, 19 insertions(+), 176 deletions(-) delete mode 100644 packages/schema/parse/src/EnterLeaveASTVisitor.ts delete mode 100644 packages/schema/parse/src/aggregateVisitors.ts diff --git a/packages/schema/parse/src/EnterLeaveASTVisitor.ts b/packages/schema/parse/src/EnterLeaveASTVisitor.ts deleted file mode 100644 index f1d11fa7f1..0000000000 --- a/packages/schema/parse/src/EnterLeaveASTVisitor.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTKindToNode } from "graphql"; -import { EnterLeave, VisitFn } from "graphql/language/visitor"; - -//Helper type to avoid supporting the full ASTVisitor from graphql -//which can also be of type ShapeMapVisitor -//To fully support ASTVisitor, the aggregateVisitor function should be -//expanded to support ShapeMapVisitor -export type EnterLeaveASTVisitor = EnterLeave< - VisitFn | - { [K in keyof ASTKindToNode]?: VisitFn } ->; \ No newline at end of file diff --git a/packages/schema/parse/src/aggregateVisitors.ts b/packages/schema/parse/src/aggregateVisitors.ts deleted file mode 100644 index 9e70779a08..0000000000 --- a/packages/schema/parse/src/aggregateVisitors.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { ASTNode, Visitor, ASTKindToNode } from "graphql"; -import { VisitFn } from "graphql/language/visitor"; -import { EnterLeaveASTVisitor } from "./EnterLeaveASTVisitor"; - -type CatchAllVisitorFunction = VisitFn; - -type VisitorFunction = (node: ASTNode) => void; - -const buildVisitorMapsAndFuncs = (visitors: EnterLeaveASTVisitor[]) => { - const enterVisitorMap: Record = {}; - const leaveVisitorMap: Record = {}; - const enterFuncs: Array = []; - const leaveFuncs: Array = []; - - for(const visitor of visitors) { - if(visitor.enter) { - if(typeof visitor.enter === "function") { - enterFuncs.push(visitor.enter); - } else { - for(const key of Object.keys(visitor.enter)) { - const nodeKind = key as keyof ASTKindToNode; - - if(!enterVisitorMap[nodeKind]) { - enterVisitorMap[nodeKind] = []; - } - - enterVisitorMap[nodeKind].push(visitor.enter[nodeKind] as VisitorFunction); - } - } - } - - if(visitor.leave) { - if(typeof visitor.leave === "function") { - leaveFuncs.push(visitor.leave); - } else { - for(const key of Object.keys(visitor.leave)) { - const nodeKind = key as keyof ASTKindToNode; - - if(!leaveVisitorMap[nodeKind]) { - leaveVisitorMap[nodeKind] = []; - } - - leaveVisitorMap[nodeKind].push(visitor.leave[nodeKind] as VisitorFunction); - } - } - } - } - - return { - enterVisitorMap, - leaveVisitorMap, - enterFuncs, - leaveFuncs - }; -}; - -const buildVisitors = ( - enterVisitorMap: Record, - leaveVisitorMap:Record, - enterFuncs: CatchAllVisitorFunction[] = [], - leaveFuncs: CatchAllVisitorFunction[] = [] = [] -) => { - const enterVisitors: Record = {}; - const leaveVisitors: Record = {}; - - for(const key of Object.keys(enterVisitorMap)) { - enterVisitors[key] = (node) => { - for(const visitorType of enterVisitorMap[key]) { - visitorType(node); - } - }; - } - - for(const key of Object.keys(leaveVisitorMap)) { - leaveVisitors[key] = (node) => { - for(const visitorType of leaveVisitorMap[key]) { - visitorType(node); - } - }; - } - - return { - enterVisitor: ( - node: ASTNode, - key: string | number | undefined, - parent: ASTNode | undefined, - path: ReadonlyArray, - ancestors: ReadonlyArray> - ) => { - for(const enterFunc of enterFuncs) { - enterFunc(node, key, parent, path, ancestors); - } - - const enterVisitor = enterVisitors[node.kind]; - - if(enterVisitor) { - enterVisitor(node); - } - }, - leaveVisitor: ( - node: ASTNode, - key: string | number | undefined, - parent: ASTNode | undefined, - path: ReadonlyArray, - ancestors: ReadonlyArray> - ) => { - for(const leaveFunc of leaveFuncs) { - leaveFunc(node, key, parent, path, ancestors); - } - - const leaveVisitor = leaveVisitors[node.kind]; - - if(leaveVisitor) { - leaveVisitor(node); - } - } - }; -}; - -export const aggregateVisitors = (visitors: EnterLeaveASTVisitor[]): Visitor => { - - const { - enterVisitorMap, - leaveVisitorMap, - enterFuncs, - leaveFuncs - } = buildVisitorMapsAndFuncs(visitors); - - const { - enterVisitor, - leaveVisitor - } = buildVisitors( - enterVisitorMap, - leaveVisitorMap, - enterFuncs, - leaveFuncs - ); - - return { - enter: enterVisitor, - leave: leaveVisitor - }; -}; \ No newline at end of file diff --git a/packages/schema/parse/src/extract/enum-types.ts b/packages/schema/parse/src/extract/enum-types.ts index 1c5b21a562..2e29214291 100644 --- a/packages/schema/parse/src/extract/enum-types.ts +++ b/packages/schema/parse/src/extract/enum-types.ts @@ -1,10 +1,10 @@ import { TypeInfo, EnumDefinition, createEnumDefinition } from "../typeInfo"; import { + ASTVisitor, DirectiveNode, EnumTypeDefinitionNode, } from "graphql"; -import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = (enumTypes: EnumDefinition[]) => ({ EnumTypeDefinition: (node: EnumTypeDefinitionNode) => { @@ -35,6 +35,6 @@ const visitorEnter = (enumTypes: EnumDefinition[]) => ({ export const getEnumTypesVisitor = ( typeInfo: TypeInfo -): EnterLeaveASTVisitor => ({ +): ASTVisitor => ({ enter: visitorEnter(typeInfo.enumTypes) }); diff --git a/packages/schema/parse/src/extract/imported-enum-types.ts b/packages/schema/parse/src/extract/imported-enum-types.ts index eae474786b..585dce6a16 100644 --- a/packages/schema/parse/src/extract/imported-enum-types.ts +++ b/packages/schema/parse/src/extract/imported-enum-types.ts @@ -5,8 +5,7 @@ import { } from "../typeInfo"; import { extractImportedDefinition } from "./imported-types-utils"; -import { EnumTypeDefinitionNode } from "graphql"; -import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; +import { ASTVisitor, EnumTypeDefinitionNode } from "graphql"; const visitorEnter = (importedEnumTypes: ImportedEnumDefinition[]) => ({ EnumTypeDefinition: (node: EnumTypeDefinitionNode) => { @@ -36,6 +35,6 @@ const visitorEnter = (importedEnumTypes: ImportedEnumDefinition[]) => ({ export const getImportedEnumTypesVisitor = ( typeInfo: TypeInfo -): EnterLeaveASTVisitor => ({ +): ASTVisitor => ({ enter: visitorEnter(typeInfo.importedEnumTypes) }); diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index e7e19bc005..3c61c02464 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -19,8 +19,8 @@ import { NamedTypeNode, ListTypeNode, FieldDefinitionNode, + ASTVisitor, } from "graphql"; -import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = ( importedObjectTypes: ImportedObjectDefinition[], @@ -75,7 +75,7 @@ const visitorLeave = (state: State) => ({ export const getImportedObjectTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -): EnterLeaveASTVisitor => { +): ASTVisitor => { const state: State = {}; return { diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index 573ea29ab0..2a838d3172 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -22,8 +22,8 @@ import { ListTypeNode, FieldDefinitionNode, InputValueDefinitionNode, + ASTVisitor, } from "graphql"; -import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = ( importedQueryTypes: ImportedQueryDefinition[], @@ -109,7 +109,7 @@ const visitorLeave = (state: State) => ({ export const getImportedQueryTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -): EnterLeaveASTVisitor => { +): ASTVisitor => { const state: State = {}; return { diff --git a/packages/schema/parse/src/extract/index.ts b/packages/schema/parse/src/extract/index.ts index 8006048d12..25fb2838df 100644 --- a/packages/schema/parse/src/extract/index.ts +++ b/packages/schema/parse/src/extract/index.ts @@ -6,12 +6,12 @@ import { getImportedObjectTypesVisitor } from "./imported-object-types"; import { getImportedQueryTypesVisitor } from "./imported-query-types"; import { getImportedEnumTypesVisitor } from "./imported-enum-types"; import { Blackboard } from "./Blackboard"; -import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; +import { ASTVisitor } from "graphql"; export type SchemaExtractor = ( typeInfo: TypeInfo, blackboard: Blackboard -) => EnterLeaveASTVisitor; +) => ASTVisitor; export const extractors: SchemaExtractor[] = [ getEnumTypesVisitor, diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index deb0797cce..de3d0638a6 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -19,8 +19,8 @@ import { ListTypeNode, FieldDefinitionNode, DirectiveNode, + ASTVisitor, } from "graphql"; -import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = ( objectTypes: ObjectDefinition[], @@ -82,7 +82,7 @@ const visitorLeave = (state: State) => ({ export const getObjectTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -): EnterLeaveASTVisitor => { +): ASTVisitor => { const state: State = {}; return { diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index a163c9141b..a765c01e08 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -24,8 +24,8 @@ import { DirectiveNode, ArgumentNode, ValueNode, + ASTVisitor, } from "graphql"; -import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; const visitorEnter = ( queryTypes: QueryDefinition[], @@ -163,7 +163,7 @@ const visitorLeave = (state: State) => ({ export const getQueryTypesVisitor = ( typeInfo: TypeInfo, blackboard: Blackboard -): EnterLeaveASTVisitor => { +): ASTVisitor => { const state: State = {}; return { diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index 0c1d42ed47..a1256c5351 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -4,9 +4,8 @@ import { TypeInfoTransforms, transformTypeInfo } from "./transform"; import { finalizePropertyDef } from "./transform/finalizePropertyDef"; import { validators, SchemaValidator } from "./validate"; import { Blackboard } from "./extract/Blackboard"; -import { aggregateVisitors } from "./aggregateVisitors"; -import { DocumentNode, parse, visit } from "graphql"; +import { DocumentNode, parse, visit, visitInParallel } from "graphql"; export * from "./typeInfo"; export * from "./transform"; @@ -64,7 +63,7 @@ const validate = ( .filter(x => x); - visit(astNode, aggregateVisitors(allVisitors)); + visit(astNode, visitInParallel(allVisitors)); for(const displayValidationMessagesIfExist of allDisplayValidationMessages) { displayValidationMessagesIfExist!(astNode); @@ -79,5 +78,5 @@ const extract = ( ) => { const allVisitors = extractors.map(getVisitor => getVisitor(typeInfo, blackboard)); - visit(astNode, aggregateVisitors(allVisitors)); + visit(astNode, visitInParallel(allVisitors)); }; diff --git a/packages/schema/parse/src/validate/index.ts b/packages/schema/parse/src/validate/index.ts index e4f9c54799..c8c49dad07 100644 --- a/packages/schema/parse/src/validate/index.ts +++ b/packages/schema/parse/src/validate/index.ts @@ -1,10 +1,9 @@ -import { DocumentNode } from "graphql"; -import { EnterLeaveASTVisitor } from "../EnterLeaveASTVisitor"; +import { ASTVisitor, DocumentNode } from "graphql"; import * as directiveValidators from "./directives"; import * as typeValidators from "./types"; export type SchemaValidator = () => { - visitor: EnterLeaveASTVisitor, + visitor: ASTVisitor, displayValidationMessagesIfExist?: (documentNode: DocumentNode) => void }; From 27ea42f9fd462fde385ea1f9a47ab66f2fd387bc Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 24 Jun 2021 15:49:16 +0200 Subject: [PATCH 079/112] lint fix --- .../schema/parse/src/extract/enum-types.ts | 12 ++--- .../parse/src/extract/imported-enum-types.ts | 2 +- .../src/extract/imported-object-types.ts | 4 +- .../parse/src/extract/imported-query-types.ts | 4 +- packages/schema/parse/src/extract/index.ts | 1 + .../schema/parse/src/extract/object-types.ts | 4 +- .../schema/parse/src/extract/query-types.ts | 4 +- packages/schema/parse/src/index.ts | 37 ++++++++------- .../parse/src/validate/SchemaValidator.ts | 6 +++ .../schema/parse/src/validate/directives.ts | 29 ++++++------ packages/schema/parse/src/validate/index.ts | 9 ++-- packages/schema/parse/src/validate/types.ts | 46 +++++++++++++------ 12 files changed, 87 insertions(+), 71 deletions(-) create mode 100644 packages/schema/parse/src/validate/SchemaValidator.ts diff --git a/packages/schema/parse/src/extract/enum-types.ts b/packages/schema/parse/src/extract/enum-types.ts index 2e29214291..02b42319c2 100644 --- a/packages/schema/parse/src/extract/enum-types.ts +++ b/packages/schema/parse/src/extract/enum-types.ts @@ -1,10 +1,6 @@ import { TypeInfo, EnumDefinition, createEnumDefinition } from "../typeInfo"; -import { - ASTVisitor, - DirectiveNode, - EnumTypeDefinitionNode, -} from "graphql"; +import { ASTVisitor, DirectiveNode, EnumTypeDefinitionNode } from "graphql"; const visitorEnter = (enumTypes: EnumDefinition[]) => ({ EnumTypeDefinition: (node: EnumTypeDefinitionNode) => { @@ -33,8 +29,6 @@ const visitorEnter = (enumTypes: EnumDefinition[]) => ({ }, }); -export const getEnumTypesVisitor = ( - typeInfo: TypeInfo -): ASTVisitor => ({ - enter: visitorEnter(typeInfo.enumTypes) +export const getEnumTypesVisitor = (typeInfo: TypeInfo): ASTVisitor => ({ + enter: visitorEnter(typeInfo.enumTypes), }); diff --git a/packages/schema/parse/src/extract/imported-enum-types.ts b/packages/schema/parse/src/extract/imported-enum-types.ts index 585dce6a16..a43cf75c62 100644 --- a/packages/schema/parse/src/extract/imported-enum-types.ts +++ b/packages/schema/parse/src/extract/imported-enum-types.ts @@ -36,5 +36,5 @@ const visitorEnter = (importedEnumTypes: ImportedEnumDefinition[]) => ({ export const getImportedEnumTypesVisitor = ( typeInfo: TypeInfo ): ASTVisitor => ({ - enter: visitorEnter(typeInfo.importedEnumTypes) + enter: visitorEnter(typeInfo.importedEnumTypes), }); diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index 3c61c02464..adbc406e75 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -77,9 +77,9 @@ export const getImportedObjectTypesVisitor = ( blackboard: Blackboard ): ASTVisitor => { const state: State = {}; - + return { enter: visitorEnter(typeInfo.importedObjectTypes, state, blackboard), - leave: visitorLeave(state) + leave: visitorLeave(state), }; }; diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index 2a838d3172..f1a21658ab 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -111,9 +111,9 @@ export const getImportedQueryTypesVisitor = ( blackboard: Blackboard ): ASTVisitor => { const state: State = {}; - + return { enter: visitorEnter(typeInfo.importedQueryTypes, state, blackboard), - leave: visitorLeave(state) + leave: visitorLeave(state), }; }; diff --git a/packages/schema/parse/src/extract/index.ts b/packages/schema/parse/src/extract/index.ts index 25fb2838df..346de0c888 100644 --- a/packages/schema/parse/src/extract/index.ts +++ b/packages/schema/parse/src/extract/index.ts @@ -6,6 +6,7 @@ import { getImportedObjectTypesVisitor } from "./imported-object-types"; import { getImportedQueryTypesVisitor } from "./imported-query-types"; import { getImportedEnumTypesVisitor } from "./imported-enum-types"; import { Blackboard } from "./Blackboard"; + import { ASTVisitor } from "graphql"; export type SchemaExtractor = ( diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index de3d0638a6..1cc97eeec3 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -84,9 +84,9 @@ export const getObjectTypesVisitor = ( blackboard: Blackboard ): ASTVisitor => { const state: State = {}; - + return { enter: visitorEnter(typeInfo.objectTypes, state, blackboard), - leave: visitorLeave(state) + leave: visitorLeave(state), }; }; diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index a765c01e08..971002f006 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -165,9 +165,9 @@ export const getQueryTypesVisitor = ( blackboard: Blackboard ): ASTVisitor => { const state: State = {}; - + return { enter: visitorEnter(typeInfo.queryTypes, state, blackboard), - leave: visitorLeave(state) + leave: visitorLeave(state), }; }; diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index a1256c5351..5b5f71cb26 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -2,7 +2,8 @@ import { TypeInfo, createTypeInfo } from "./typeInfo"; import { extractors, SchemaExtractor } from "./extract"; import { TypeInfoTransforms, transformTypeInfo } from "./transform"; import { finalizePropertyDef } from "./transform/finalizePropertyDef"; -import { validators, SchemaValidator } from "./validate"; +import { validators } from "./validate"; +import { SchemaValidator } from "./SchemaValidator"; import { Blackboard } from "./extract/Blackboard"; import { DocumentNode, parse, visit, visitInParallel } from "graphql"; @@ -51,22 +52,24 @@ export function parseSchema( return info; } -const validate = ( - astNode: DocumentNode, - validators: SchemaValidator[], -) => { - - const allValidators = validators.map(getValidator => getValidator()); - const allVisitors = allValidators.map(x => x.visitor); - const allDisplayValidationMessages = allValidators - .map(x => x.displayValidationMessagesIfExist) - .filter(x => x); - +const validate = (astNode: DocumentNode, validators: SchemaValidator[]) => { + const allValidators = validators.map((getValidator) => getValidator()); + const allVisitors = allValidators.map((x) => x.visitor); + const allDisplayValidationMessages: Array< + (documentNode: DocumentNode) => void + > = allValidators + .filter((x) => !!x.displayValidationMessagesIfExist) + .map( + (x) => + x.displayValidationMessagesIfExist as ( + documentNode: DocumentNode + ) => void + ); visit(astNode, visitInParallel(allVisitors)); - for(const displayValidationMessagesIfExist of allDisplayValidationMessages) { - displayValidationMessagesIfExist!(astNode); + for (const displayValidationMessagesIfExist of allDisplayValidationMessages) { + displayValidationMessagesIfExist(astNode); } }; @@ -74,9 +77,11 @@ const extract = ( astNode: DocumentNode, typeInfo: TypeInfo, blackboard: Blackboard, - extractors: SchemaExtractor[], + extractors: SchemaExtractor[] ) => { - const allVisitors = extractors.map(getVisitor => getVisitor(typeInfo, blackboard)); + const allVisitors = extractors.map((getVisitor) => + getVisitor(typeInfo, blackboard) + ); visit(astNode, visitInParallel(allVisitors)); }; diff --git a/packages/schema/parse/src/validate/SchemaValidator.ts b/packages/schema/parse/src/validate/SchemaValidator.ts new file mode 100644 index 0000000000..1a9aab9285 --- /dev/null +++ b/packages/schema/parse/src/validate/SchemaValidator.ts @@ -0,0 +1,6 @@ +import { ASTVisitor, DocumentNode } from "graphql"; + +export type SchemaValidator = { + visitor: ASTVisitor; + displayValidationMessagesIfExist?: (documentNode: DocumentNode) => void; +}; diff --git a/packages/schema/parse/src/validate/directives.ts b/packages/schema/parse/src/validate/directives.ts index a54cb1c4ab..5e58725150 100644 --- a/packages/schema/parse/src/validate/directives.ts +++ b/packages/schema/parse/src/validate/directives.ts @@ -1,12 +1,9 @@ import { ImportedDefinition } from "../typeInfo"; +import { SchemaValidator } from "./SchemaValidator"; -import { - DirectiveNode, - ASTNode, - ObjectTypeDefinitionNode, -} from "graphql"; +import { DirectiveNode, ASTNode, ObjectTypeDefinitionNode } from "graphql"; -export const getSupportedDirectivesValidator = () => { +export const getSupportedDirectivesValidator = (): SchemaValidator => { const supportedDirectives = ["imported", "imports"]; const unsupportedUsages: string[] = []; @@ -19,8 +16,8 @@ export const getSupportedDirectivesValidator = () => { if (!supportedDirectives.includes(name)) { unsupportedUsages.push(name); } - } - } + }, + }, }, displayValidationMessagesIfExist: () => { if (unsupportedUsages.length) { @@ -30,11 +27,11 @@ export const getSupportedDirectivesValidator = () => { )}` ); } - } + }, }; }; -export const getImportsDirectiveValidator = () => { +export const getImportsDirectiveValidator = (): SchemaValidator => { let isInsideObjectTypeDefinition = false; const ObjectTypeDefinition = (node: ObjectTypeDefinitionNode) => { @@ -137,11 +134,11 @@ export const getImportsDirectiveValidator = () => { isInsideObjectTypeDefinition = false; } }, - } + }, }; -} +}; -export const getImportedDirectiveValidator = () => { +export const getImportedDirectiveValidator = (): SchemaValidator => { let isInsideObjectOrEnumTypeDefinition = false; const Directive = ( @@ -214,7 +211,7 @@ export const getImportedDirectiveValidator = () => { } else if (node.kind !== "NamedType" && node.kind !== "Name") { isInsideObjectOrEnumTypeDefinition = false; } - } - } + }, + }, }; -} +}; diff --git a/packages/schema/parse/src/validate/index.ts b/packages/schema/parse/src/validate/index.ts index c8c49dad07..235fd7d63c 100644 --- a/packages/schema/parse/src/validate/index.ts +++ b/packages/schema/parse/src/validate/index.ts @@ -1,13 +1,10 @@ -import { ASTVisitor, DocumentNode } from "graphql"; import * as directiveValidators from "./directives"; import * as typeValidators from "./types"; +import { SchemaValidator } from "./SchemaValidator"; -export type SchemaValidator = () => { - visitor: ASTVisitor, - displayValidationMessagesIfExist?: (documentNode: DocumentNode) => void -}; +export type SchemaValidatorBuilder = () => SchemaValidator; -export const validators: SchemaValidator[] = [ +export const validators: SchemaValidatorBuilder[] = [ directiveValidators.getSupportedDirectivesValidator, directiveValidators.getImportedDirectiveValidator, directiveValidators.getImportsDirectiveValidator, diff --git a/packages/schema/parse/src/validate/types.ts b/packages/schema/parse/src/validate/types.ts index 27223760b7..d4412e7e30 100644 --- a/packages/schema/parse/src/validate/types.ts +++ b/packages/schema/parse/src/validate/types.ts @@ -4,11 +4,25 @@ import { isQueryType, queryTypeNames, } from "../typeInfo"; +import { SchemaValidator } from "./SchemaValidator"; -import { DirectiveNode, DocumentNode, EnumTypeDefinitionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, NamedTypeNode, ObjectTypeDefinitionNode, ScalarTypeDefinitionNode, StringValueNode, UnionTypeDefinitionNode } from "graphql"; +import { + DirectiveNode, + DocumentNode, + EnumTypeDefinitionNode, + FieldDefinitionNode, + InputObjectTypeDefinitionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + NamedTypeNode, + ObjectTypeDefinitionNode, + ScalarTypeDefinitionNode, + StringValueNode, + UnionTypeDefinitionNode, +} from "graphql"; import { getSchemaCycles } from "graphql-schema-cycles"; -export const getTypeDefinitionsValidator = () => { +export const getTypeDefinitionsValidator = (): SchemaValidator => { const objectTypes: Record = {}; return { @@ -37,14 +51,14 @@ export const getTypeDefinitionsValidator = () => { "Subscriptions are not yet supported. Please use Query or Mutation." ); } - + // No duplicates if (objectTypes[node.name.value]) { throw Error( `Duplicate object type definition found: ${node.name.value}` ); } - + objectTypes[node.name.value] = true; }, // No New Scalars @@ -62,12 +76,12 @@ export const getTypeDefinitionsValidator = () => { `Found: union ${node.name.value}` ); }, - } - } + }, + }, }; -} +}; -export const getPropertyTypesValidator = () => { +export const getPropertyTypesValidator = (): SchemaValidator => { let currentObject: string | undefined; let currentImportType: string | undefined; let currentField: string | undefined; @@ -116,7 +130,9 @@ export const getPropertyTypesValidator = () => { } }, InputValueDefinition: (node: InputValueDefinitionNode) => { - const typeName = currentImportType ? currentImportType : currentObject; + const typeName = currentImportType + ? currentImportType + : currentObject; if (typeName && !isQueryType(typeName)) { // Arguments not supported on non-query types throw Error( @@ -138,7 +154,7 @@ export const getPropertyTypesValidator = () => { }, }, }, - displayValidationMessagesIfExist: (documentNode: DocumentNode) => { + displayValidationMessagesIfExist: () => { // Ensure all property types are either a // supported scalar, enum or an object type definition for (const field of fieldTypes) { @@ -152,11 +168,11 @@ export const getPropertyTypesValidator = () => { ); } } - } + }, }; -} +}; -export function getCircularDefinitionsValidator() { +export function getCircularDefinitionsValidator(): SchemaValidator { const operationTypes: string[] = []; const operationTypeNames = ["Mutation", "Subscription", "Query"]; @@ -172,7 +188,7 @@ export function getCircularDefinitionsValidator() { operationTypes.push(node.name.value); } }, - } + }, }, displayValidationMessagesIfExist: (documentNode: DocumentNode) => { const { cycleStrings, foundCycle } = getSchemaCycles(documentNode, { @@ -187,6 +203,6 @@ export function getCircularDefinitionsValidator() { )}` ); } - } + }, }; } From 4edd0bdade2a2acf1f4007e23ad196a7a4eb9cca Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 24 Jun 2021 16:05:58 +0200 Subject: [PATCH 080/112] fix --- packages/schema/parse/src/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index 5b5f71cb26..0cbb5d42e5 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -2,8 +2,7 @@ import { TypeInfo, createTypeInfo } from "./typeInfo"; import { extractors, SchemaExtractor } from "./extract"; import { TypeInfoTransforms, transformTypeInfo } from "./transform"; import { finalizePropertyDef } from "./transform/finalizePropertyDef"; -import { validators } from "./validate"; -import { SchemaValidator } from "./SchemaValidator"; +import { SchemaValidatorBuilder, validators } from "./validate"; import { Blackboard } from "./extract/Blackboard"; import { DocumentNode, parse, visit, visitInParallel } from "graphql"; @@ -15,7 +14,7 @@ export * from "./header"; interface ParserOptions { extractors?: SchemaExtractor[]; transforms?: TypeInfoTransforms[]; - validators?: SchemaValidator[]; + validators?: SchemaValidatorBuilder[]; noValidate?: boolean; } @@ -52,7 +51,7 @@ export function parseSchema( return info; } -const validate = (astNode: DocumentNode, validators: SchemaValidator[]) => { +const validate = (astNode: DocumentNode, validators: SchemaValidatorBuilder[]) => { const allValidators = validators.map((getValidator) => getValidator()); const allVisitors = allValidators.map((x) => x.visitor); const allDisplayValidationMessages: Array< From eed868c605eb9d0006e308aace2e41bd52391cb9 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 24 Jun 2021 18:31:18 +0200 Subject: [PATCH 081/112] fix --- packages/schema/parse/src/index.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index 0cbb5d42e5..bdfec9759b 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -51,24 +51,22 @@ export function parseSchema( return info; } -const validate = (astNode: DocumentNode, validators: SchemaValidatorBuilder[]) => { +const validate = ( + astNode: DocumentNode, + validators: SchemaValidatorBuilder[] +) => { const allValidators = validators.map((getValidator) => getValidator()); const allVisitors = allValidators.map((x) => x.visitor); - const allDisplayValidationMessages: Array< - (documentNode: DocumentNode) => void - > = allValidators - .filter((x) => !!x.displayValidationMessagesIfExist) - .map( - (x) => - x.displayValidationMessagesIfExist as ( - documentNode: DocumentNode - ) => void - ); + const allDisplayValidationMessages = allValidators.map( + (x) => x.displayValidationMessagesIfExist + ); visit(astNode, visitInParallel(allVisitors)); for (const displayValidationMessagesIfExist of allDisplayValidationMessages) { - displayValidationMessagesIfExist(astNode); + if (displayValidationMessagesIfExist) { + displayValidationMessagesIfExist(astNode); + } } }; From 91050d76c67e384e5a5448be3b7474dc267f0f88 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 24 Jun 2021 22:42:39 +0200 Subject: [PATCH 082/112] renamed SchemaExtractor to SchemaExtractorBuilder --- packages/schema/parse/src/extract/index.ts | 4 ++-- packages/schema/parse/src/index.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/schema/parse/src/extract/index.ts b/packages/schema/parse/src/extract/index.ts index 346de0c888..83e66e3925 100644 --- a/packages/schema/parse/src/extract/index.ts +++ b/packages/schema/parse/src/extract/index.ts @@ -9,12 +9,12 @@ import { Blackboard } from "./Blackboard"; import { ASTVisitor } from "graphql"; -export type SchemaExtractor = ( +export type SchemaExtractorBuilder = ( typeInfo: TypeInfo, blackboard: Blackboard ) => ASTVisitor; -export const extractors: SchemaExtractor[] = [ +export const extractors: SchemaExtractorBuilder[] = [ getEnumTypesVisitor, getImportedEnumTypesVisitor, getObjectTypesVisitor, diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index bdfec9759b..dbf47bb8e2 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -1,5 +1,5 @@ import { TypeInfo, createTypeInfo } from "./typeInfo"; -import { extractors, SchemaExtractor } from "./extract"; +import { extractors, SchemaExtractorBuilder } from "./extract"; import { TypeInfoTransforms, transformTypeInfo } from "./transform"; import { finalizePropertyDef } from "./transform/finalizePropertyDef"; import { SchemaValidatorBuilder, validators } from "./validate"; @@ -12,7 +12,7 @@ export * from "./transform"; export * from "./header"; interface ParserOptions { - extractors?: SchemaExtractor[]; + extractors?: SchemaExtractorBuilder[]; transforms?: TypeInfoTransforms[]; validators?: SchemaValidatorBuilder[]; noValidate?: boolean; @@ -74,7 +74,7 @@ const extract = ( astNode: DocumentNode, typeInfo: TypeInfo, blackboard: Blackboard, - extractors: SchemaExtractor[] + extractors: SchemaExtractorBuilder[] ) => { const allVisitors = extractors.map((getVisitor) => getVisitor(typeInfo, blackboard) From a95894e0c9eeab222c171702d6f02811db740620 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 25 Jun 2021 00:06:03 +0200 Subject: [PATCH 083/112] maintaining graphql schema comments through parse --- .../schema/parse/src/extract/enum-types.ts | 1 + .../parse/src/extract/imported-enum-types.ts | 1 + .../src/extract/imported-object-types.ts | 1 + .../parse/src/extract/imported-query-types.ts | 2 + .../parse/src/extract/object-types-utils.ts | 1 + .../schema/parse/src/extract/object-types.ts | 1 + .../parse/src/extract/query-types-utils.ts | 1 + .../schema/parse/src/extract/query-types.ts | 4 +- .../schema/parse/src/typeInfo/definitions.ts | 35 +++++- .../schema/parse/src/validate/directives.ts | 4 +- .../cases/parse/sanity/input.graphql | 108 +++++++++++++++++- .../test-cases/cases/parse/sanity/output.ts | 76 +++++++----- 12 files changed, 197 insertions(+), 38 deletions(-) diff --git a/packages/schema/parse/src/extract/enum-types.ts b/packages/schema/parse/src/extract/enum-types.ts index 02b42319c2..f584bc0944 100644 --- a/packages/schema/parse/src/extract/enum-types.ts +++ b/packages/schema/parse/src/extract/enum-types.ts @@ -24,6 +24,7 @@ const visitorEnter = (enumTypes: EnumDefinition[]) => ({ const enumType = createEnumDefinition({ type: node.name.value, constants, + comment: node.description?.value }); enumTypes.push(enumType); }, diff --git a/packages/schema/parse/src/extract/imported-enum-types.ts b/packages/schema/parse/src/extract/imported-enum-types.ts index a43cf75c62..0003f223e8 100644 --- a/packages/schema/parse/src/extract/imported-enum-types.ts +++ b/packages/schema/parse/src/extract/imported-enum-types.ts @@ -28,6 +28,7 @@ const visitorEnter = (importedEnumTypes: ImportedEnumDefinition[]) => ({ uri: imported.uri, namespace: imported.namespace, nativeType: imported.nativeType, + comment: node.description?.value }); importedEnumTypes.push(enumType); }, diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index adbc406e75..079b8ee7fc 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -42,6 +42,7 @@ const visitorEnter = ( interfaces: node.interfaces?.map((x) => createInterfaceImplementedDefinition({ type: x.name.value }) ), + comment: node.description?.value }); importedObjectTypes.push(importedType); state.currentType = importedType; diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index f1a21658ab..1138c7a8d2 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -45,6 +45,7 @@ const visitorEnter = ( interfaces: node.interfaces?.map((x) => createInterfaceImplementedDefinition({ type: x.name.value }) ), + comment: node.description?.value }); importedQueryTypes.push(importedType); state.currentImport = importedType; @@ -71,6 +72,7 @@ const visitorEnter = ( type: importDef.nativeType, name: node.name.value, return: returnType, + comment: node.description?.value }); importDef.methods.push(method); state.currentMethod = method; diff --git a/packages/schema/parse/src/extract/object-types-utils.ts b/packages/schema/parse/src/extract/object-types-utils.ts index eba85465a1..4b62522258 100644 --- a/packages/schema/parse/src/extract/object-types-utils.ts +++ b/packages/schema/parse/src/extract/object-types-utils.ts @@ -34,6 +34,7 @@ export function extractFieldDefinition( const property = createPropertyDefinition({ type: "N/A", name: node.name.value, + comment: node.description?.value }); state.currentProperty = property; diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index 1cc97eeec3..2a0b442268 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -49,6 +49,7 @@ const visitorEnter = ( interfaces: node.interfaces?.map((x) => createInterfaceImplementedDefinition({ type: x.name.value }) ), + comment: node.description?.value }); objectTypes.push(type); state.currentType = type; diff --git a/packages/schema/parse/src/extract/query-types-utils.ts b/packages/schema/parse/src/extract/query-types-utils.ts index 14db1c2f57..915ed8ae5e 100644 --- a/packages/schema/parse/src/extract/query-types-utils.ts +++ b/packages/schema/parse/src/extract/query-types-utils.ts @@ -131,6 +131,7 @@ export function extractInputValueDefinition( const argument = createPropertyDefinition({ type: "N/A", name: node.name.value, + comment: node.description?.value }); method.arguments.push(argument); state.currentArgument = argument; diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index 971002f006..08a83c5bf5 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -47,6 +47,7 @@ const visitorEnter = ( interfaces: node.interfaces?.map((x) => createInterfaceImplementedDefinition({ type: x.name.value }) ), + comment: node.description?.value }); queryTypes.push(query); state.currentQuery = query; @@ -60,13 +61,14 @@ const visitorEnter = ( const returnType = createPropertyDefinition({ type: "N/A", - name: node.name.value, + name: node.name.value }); const method = createMethodDefinition({ type: query.type, name: node.name.value, return: returnType, + comment: node.description?.value }); query.methods.push(method); state.currentMethod = method; diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index e7b2ba742d..405778d608 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -26,17 +26,20 @@ export interface GenericDefinition { type: string; name: string | null; required: boolean | null; + comment?: string; kind: DefinitionKind; } export function createGenericDefinition(args: { type: string; name?: string | null; required?: boolean; + comment?: string; }): GenericDefinition { return { type: args.type, name: args.name ? args.name : null, required: args.required ? args.required : null, + comment: args.comment, kind: DefinitionKind.Generic, }; } @@ -51,6 +54,7 @@ export function createObjectDefinition(args: { required?: boolean; properties?: PropertyDefinition[]; interfaces?: InterfaceImplementedDefinition[]; + comment?: string; }): ObjectDefinition { return { ...createGenericDefinition(args), @@ -74,6 +78,7 @@ export function createAnyDefinition(args: { scalar?: ScalarDefinition; object?: ObjectDefinition; enum?: EnumDefinition; + comment?: string; }): AnyDefinition { return { ...createGenericDefinition(args), @@ -113,6 +118,7 @@ export function createEnumDefinition(args: { name?: string | null; required?: boolean; constants?: string[]; + comment?: string; }): EnumDefinition { return { ...createGenericDefinition(args), @@ -165,6 +171,7 @@ export function createPropertyDefinition(args: { scalar?: ScalarDefinition; object?: ObjectDefinition; enum?: EnumDefinition; + comment?: string; }): PropertyDefinition { return { ...createAnyDefinition(args), @@ -193,10 +200,14 @@ export function createArrayPropertyDefinition(args: { name?: string | null; required?: boolean; item?: GenericDefinition; + comment?: string; }): PropertyDefinition { return createPropertyDefinition({ ...args, - array: createArrayDefinition(args), + array: { + ...createArrayDefinition(args), + comment: undefined + }, }); } @@ -204,10 +215,14 @@ export function createScalarPropertyDefinition(args: { type: string; name?: string | null; required?: boolean; + comment?: string; }): PropertyDefinition { return createPropertyDefinition({ ...args, - scalar: createScalarDefinition(args), + scalar: { + ...createScalarDefinition(args), + comment: undefined + }, }); } @@ -219,7 +234,10 @@ export function createEnumPropertyDefinition(args: { }): PropertyDefinition { return createPropertyDefinition({ ...args, - enum: createEnumDefinition(args), + enum: { + ...createEnumDefinition(args), + comment: undefined + }, }); } @@ -228,10 +246,14 @@ export function createObjectPropertyDefinition(args: { name?: string | null; required?: boolean; properties?: PropertyDefinition[]; + comment?: string; }): PropertyDefinition { return createPropertyDefinition({ ...args, - object: createObjectDefinition(args), + object: { + ...createObjectDefinition(args), + comment: undefined + }, }); } @@ -245,6 +267,7 @@ export function createMethodDefinition(args: { name: string; arguments?: PropertyDefinition[]; return: PropertyDefinition; + comment?: string; }): MethodDefinition { const lowercase = args.type.toLowerCase(); if (!isOperationType(lowercase)) { @@ -273,6 +296,7 @@ export function createQueryDefinition(args: { imports?: { type: string }[]; interfaces?: InterfaceImplementedDefinition[]; required?: boolean; + comment?: string; }): QueryDefinition { if (!isQueryType(args.type)) { throw Error( @@ -307,6 +331,7 @@ export function createImportedEnumDefinition(args: { uri: string; namespace: string; nativeType: string; + comment?: string; }): ImportedEnumDefinition { return { ...createEnumDefinition(args), @@ -329,6 +354,7 @@ export function createImportedQueryDefinition(args: { namespace: string; nativeType: string; interfaces?: InterfaceImplementedDefinition[]; + comment?: string; }): ImportedQueryDefinition { if (!isQueryType(args.nativeType)) { throw Error( @@ -357,6 +383,7 @@ export function createImportedObjectDefinition(args: { namespace: string; nativeType: string; interfaces?: InterfaceImplementedDefinition[]; + comment?: string; }): ImportedObjectDefinition { return { ...createObjectDefinition(args), diff --git a/packages/schema/parse/src/validate/directives.ts b/packages/schema/parse/src/validate/directives.ts index 5e58725150..e0f79d01e4 100644 --- a/packages/schema/parse/src/validate/directives.ts +++ b/packages/schema/parse/src/validate/directives.ts @@ -130,7 +130,7 @@ export const getImportsDirectiveValidator = (): SchemaValidator => { ObjectTypeDefinition(node as ObjectTypeDefinitionNode); } else if (node.kind === "Directive") { Directive(node as DirectiveNode, key, parent, path); - } else if (node.kind !== "NamedType" && node.kind !== "Name") { + } else if (node.kind !== "NamedType" && node.kind !== "Name" && node.kind !== "StringValue") { isInsideObjectTypeDefinition = false; } }, @@ -208,7 +208,7 @@ export const getImportedDirectiveValidator = (): SchemaValidator => { node.kind === "EnumTypeDefinition" ) { isInsideObjectOrEnumTypeDefinition = true; - } else if (node.kind !== "NamedType" && node.kind !== "Name") { + } else if (node.kind !== "NamedType" && node.kind !== "Name" && node.kind !== "StringValue") { isInsideObjectOrEnumTypeDefinition = false; } }, diff --git a/packages/test-cases/cases/parse/sanity/input.graphql b/packages/test-cases/cases/parse/sanity/input.graphql index da6b077a7c..c4377427ab 100644 --- a/packages/test-cases/cases/parse/sanity/input.graphql +++ b/packages/test-cases/cases/parse/sanity/input.graphql @@ -21,13 +21,25 @@ directive @imports( types: [String!]! ) on OBJECT +""" +CustomEnum comment +""" enum CustomEnum { TEXT BINARY } +""" +CustomType comment +""" type CustomType { +""" +str comment +""" str: String! +""" +optStr comment +""" optStr: String u: UInt! optU: UInt @@ -61,54 +73,105 @@ type CustomType { optEnumArray: [CustomEnum] } +""" +AnotherType comment +""" type AnotherType { +""" +prop comment +""" prop: String } +""" +UserObject comment +""" type UserObject { fieldA: String fieldB: Int! } +""" +ImplementationObject comment +""" type ImplementationObject implements Interface_Object & Interface_Object2 { +""" +anotherProp comment +""" anotherProp: String str: String! uint8: UInt8! str2: String! } +""" +Query comment +""" type Query implements Interface_Query @imports( types: [ "TestImport_Query", "Interface_Query" ] ) { +""" +queryMethod comment +""" queryMethod( +""" +arg comment +""" arg: String! ): [Int]! - +""" +userObjectMethod comment +""" userObjectMethod( +""" +userObject comment +""" userObject: UserObject +""" +arrayObject comment +""" arrayObject: [UserObject!]! ): UserObject! - +""" +enumMethod comment +""" enumMethod( +""" +enum comment +""" enum: CustomEnum, +""" +arrayEnum comment +""" arrayEnum: [CustomEnum!]! ): CustomEnum! - +""" +abstractMethod comment +""" abstractMethod( arg: UInt8! ): String! } +""" +TestImport_Query comment +""" type TestImport_Query @imported( uri: "testimport.uri.eth", namespace: "TestImport", nativeType: "Query" ) { +""" +importedMethod comment +""" importedMethod( str: String! optStr: String u: UInt! optU: UInt +""" +uArrayArray comment +""" uArrayArray: [[UInt]]! ): String! @@ -126,34 +189,61 @@ type TestImport_Query @imported( ): TestImport_Enum! } +""" +TestImport_Mutation comment +""" type TestImport_Mutation @imported( uri: "testimport.uri.eth", namespace: "TestImport", nativeType: "Mutation" ) { +""" +importedMethod comment +""" importedMethod( +""" +str comment +""" str: String! ): String! } +""" +TestImport_Object comment +""" type TestImport_Object @imported( uri: "testimport.uri.eth", namespace: "TestImport", nativeType: "Object" ) { +""" +prop comment +""" prop: String! +""" +nested comment +""" nested: TestImport_NestedObject! } +""" +TestImport_NestedObject comment +""" type TestImport_NestedObject @imported( uri: "testimport.uri.eth", namespace: "TestImport", nativeType: "NestedObject" ) { +""" +foo comment +""" foo: [String!]! circular: TestImport_Object } +""" +TestImport_Enum comment +""" enum TestImport_Enum @imported( namespace: "TestImport", uri: "testimport.uri.eth", @@ -163,16 +253,25 @@ enum TestImport_Enum @imported( BYTES } +""" +Interface_Query comment +""" type Interface_Query @imported( uri: "interface.uri.eth", namespace: "Interface", nativeType: "Query" ) { +""" +abstractMethod comment +""" abstractMethod( arg: UInt8! ): String! } +""" +Interface_Object comment +""" type Interface_Object @imported( uri: "interface.uri.eth", namespace: "Interface", @@ -182,6 +281,9 @@ type Interface_Object @imported( uint8: UInt8! } +""" +Interface_Object2 comment +""" type Interface_Object2 @imported( uri: "interface.uri.eth", namespace: "Interface", diff --git a/packages/test-cases/cases/parse/sanity/output.ts b/packages/test-cases/cases/parse/sanity/output.ts index f85c61fd53..53e6132155 100644 --- a/packages/test-cases/cases/parse/sanity/output.ts +++ b/packages/test-cases/cases/parse/sanity/output.ts @@ -19,10 +19,10 @@ import { export const output: TypeInfo = { objectTypes: [ { - ...createObjectDefinition({ type: "CustomType" }), + ...createObjectDefinition({ type: "CustomType", comment: "CustomType comment" }), properties: [ - createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "optStr", type: "String", required: false }), + createScalarPropertyDefinition({ name: "str", type: "String", required: true, comment: "str comment" }), + createScalarPropertyDefinition({ name: "optStr", type: "String", required: false, comment: "optStr comment" }), createScalarPropertyDefinition({ name: "u", type: "UInt", required: true }), createScalarPropertyDefinition({ name: "optU", type: "UInt", required: false }), createScalarPropertyDefinition({ name: "u8", type: "UInt8", required: true }), @@ -178,11 +178,11 @@ export const output: TypeInfo = { ], }, { - ...createObjectDefinition({ type: "AnotherType" }), - properties: [createScalarPropertyDefinition({ name: "prop", type: "String" })], + ...createObjectDefinition({ type: "AnotherType", comment: "AnotherType comment" }), + properties: [createScalarPropertyDefinition({ name: "prop", type: "String", comment: "prop comment" })], }, { - ...createObjectDefinition({ type: "UserObject" }), + ...createObjectDefinition({ type: "UserObject", comment: "UserObject comment" }), properties: [ createScalarPropertyDefinition({ name: "fieldA", type: "String", required: false }), createScalarPropertyDefinition({ name: "fieldB", type: "Int", required: true }), @@ -194,10 +194,11 @@ export const output: TypeInfo = { interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_Object" }), createInterfaceImplementedDefinition({ type: "Interface_Object2" }) - ] + ], + comment: "ImplementationObject comment" }), properties: [ - createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false }), + createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false, comment: "anotherProp comment" }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), @@ -207,7 +208,8 @@ export const output: TypeInfo = { enumTypes: [ createEnumDefinition({ type: "CustomEnum", - constants: ["TEXT", "BINARY"] + constants: ["TEXT", "BINARY"], + comment: "CustomEnum comment" }) ], importedEnumTypes: [ @@ -216,7 +218,8 @@ export const output: TypeInfo = { uri: "testimport.uri.eth", namespace: "TestImport", nativeType: "Enum", - constants: ["TEXT", "BYTES"] + constants: ["TEXT", "BYTES"], + comment: "TestImport_Enum comment" }) ], queryTypes: [ @@ -226,7 +229,8 @@ export const output: TypeInfo = { imports: [{ type: "TestImport_Query" }, { type: "Interface_Query" }], interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_Query" }), - ] + ], + comment: "Query comment" }), methods: [ { @@ -238,9 +242,10 @@ export const output: TypeInfo = { type: "[Int]", required: true, item: createScalarDefinition({ name: "queryMethod", type: "Int", required: false }), - }) + }), + comment: "queryMethod comment" }), - arguments: [createScalarPropertyDefinition({ name: "arg", type: "String", required: true })], + arguments: [createScalarPropertyDefinition({ name: "arg", type: "String", required: true, comment: "arg comment" })], }, { ...createMethodDefinition({ @@ -251,10 +256,11 @@ export const output: TypeInfo = { type: "UserObject", required: true }), + comment: "userObjectMethod comment" }), arguments: [ - createObjectPropertyDefinition({ name: "userObject", type: "UserObject" }), - createArrayPropertyDefinition({ name: "arrayObject", type: "[UserObject]", required: true, item: createObjectDefinition({ + createObjectPropertyDefinition({ name: "userObject", type: "UserObject", comment: "userObject comment" }), + createArrayPropertyDefinition({ name: "arrayObject", type: "[UserObject]", required: true, comment: "arrayObject comment", item: createObjectDefinition({ type: "UserObject", name: "arrayObject", required: true @@ -270,14 +276,15 @@ export const output: TypeInfo = { type: "CustomEnum", required: true }), + comment: "enumMethod comment" }), arguments: [ - createEnumPropertyDefinition({ name: "enum", type: "CustomEnum" }), - createArrayPropertyDefinition({ name: "arrayEnum", type: "[CustomEnum]", required: true, item: createEnumDefinition({ + createEnumPropertyDefinition({ name: "enum", type: "CustomEnum", comment: "enum comment" }), + createArrayPropertyDefinition({ name: "arrayEnum", type: "[CustomEnum]", required: true, comment: "arrayEnum comment", item: createEnumDefinition({ type: "CustomEnum", name: "arrayEnum", required: true - })}), + })}) ], }, { @@ -289,6 +296,7 @@ export const output: TypeInfo = { type: "String", required: true }), + comment: "abstractMethod comment" }), arguments: [ createScalarPropertyDefinition({ @@ -307,11 +315,12 @@ export const output: TypeInfo = { uri: "testimport.uri.eth", namespace: "TestImport", type: "TestImport_Object", - nativeType: "Object" + nativeType: "Object", + comment: "TestImport_Object comment" }), properties: [ - createScalarPropertyDefinition({ name: "prop", type: "String", required: true }), - createObjectPropertyDefinition({ name: "nested", type: "TestImport_NestedObject", required: true }) + createScalarPropertyDefinition({ name: "prop", type: "String", required: true, comment: "prop comment" }), + createObjectPropertyDefinition({ name: "nested", type: "TestImport_NestedObject", required: true, comment: "nested comment" }) ], }, { @@ -319,13 +328,15 @@ export const output: TypeInfo = { uri: "testimport.uri.eth", namespace: "TestImport", type: "TestImport_NestedObject", - nativeType: "NestedObject" + nativeType: "NestedObject", + comment: "TestImport_NestedObject comment" }), properties: [ createArrayPropertyDefinition({ name: "foo", type: "[String]", required: true, + comment: "foo comment", item: createScalarDefinition({ name: "foo", type: "String", @@ -344,7 +355,8 @@ export const output: TypeInfo = { uri: "interface.uri.eth", namespace: "Interface", type: "Interface_Object", - nativeType: "Object" + nativeType: "Object", + comment: "Interface_Object comment" }), properties: [ createScalarPropertyDefinition({ @@ -364,7 +376,8 @@ export const output: TypeInfo = { uri: "interface.uri.eth", namespace: "Interface", type: "Interface_Object2", - nativeType: "Object2" + nativeType: "Object2", + comment: "Interface_Object2 comment" }), properties: [ createScalarPropertyDefinition({ @@ -381,7 +394,8 @@ export const output: TypeInfo = { uri: "testimport.uri.eth", namespace: "TestImport", type: "TestImport_Query", - nativeType: "Query" + nativeType: "Query", + comment: "TestImport_Query comment" }), methods: [ { @@ -393,6 +407,7 @@ export const output: TypeInfo = { type: "String", required: true }), + comment: "importedMethod comment" }), arguments: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), @@ -403,6 +418,7 @@ export const output: TypeInfo = { name: "uArrayArray", type: "[[UInt]]", required: true, + comment: "uArrayArray comment", item: createArrayDefinition({ name: "uArrayArray", type: "[UInt]", @@ -506,7 +522,8 @@ export const output: TypeInfo = { uri: "testimport.uri.eth", namespace: "TestImport", type: "TestImport_Mutation", - nativeType: "Mutation" + nativeType: "Mutation", + comment: "TestImport_Mutation comment" }), methods: [ { @@ -518,8 +535,9 @@ export const output: TypeInfo = { type: "String", required: true }), + comment: "importedMethod comment" }), - arguments: [createScalarPropertyDefinition({ name: "str", type: "String", required: true })], + arguments: [createScalarPropertyDefinition({ name: "str", type: "String", required: true, comment: "str comment" })], }, ], }, @@ -528,7 +546,8 @@ export const output: TypeInfo = { uri: "interface.uri.eth", namespace: "Interface", type: "Interface_Query", - nativeType: "Query" + nativeType: "Query", + comment: "Interface_Query comment" }), methods: [ { @@ -540,6 +559,7 @@ export const output: TypeInfo = { type: "String", required: true }), + comment: "abstractMethod comment" }), arguments: [createScalarPropertyDefinition({ name: "arg", type: "UInt8", required: true })], }, From 2a7f10238ea0a747bb45b166ef89316dfd3282ce Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 25 Jun 2021 11:17:42 +0200 Subject: [PATCH 084/112] added basic comment tests to schema compose --- .../compose/src/templates/schema.mustache.ts | 72 +++++++++++++++---- .../compose/sanity/input/mutation.graphql | 39 ++++++++++ .../cases/compose/sanity/input/query.graphql | 18 +++++ .../compose/sanity/output/mutation.graphql | 39 ++++++++++ .../cases/compose/sanity/output/mutation.ts | 30 +++++--- .../cases/compose/sanity/output/query.graphql | 18 +++++ .../cases/compose/sanity/output/query.ts | 10 ++- .../compose/sanity/output/schema.graphql | 57 +++++++++++++++ .../cases/compose/sanity/output/schema.ts | 34 ++++++--- 9 files changed, 280 insertions(+), 37 deletions(-) diff --git a/packages/schema/compose/src/templates/schema.mustache.ts b/packages/schema/compose/src/templates/schema.mustache.ts index 3acb7619c2..2dc4e890cf 100644 --- a/packages/schema/compose/src/templates/schema.mustache.ts +++ b/packages/schema/compose/src/templates/schema.mustache.ts @@ -1,6 +1,10 @@ const template = ` {{#typeInfo}} -{{#queryTypes}} +{{#queryTypes}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} &{{/last}}{{/interfaces}}{{/interfaces.length}}{{#imports.length}} @imports( types: [ {{#imports}} @@ -8,9 +12,17 @@ type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} {{/imports}} ] ){{/imports.length}} { - {{#methods}} + {{#methods}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} {{name}}{{#arguments.length}}( - {{#arguments}} + {{#arguments}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} {{name}}: {{toGraphQLType}} {{/arguments}} ){{/arguments.length}}: {{#return}}{{toGraphQLType}}{{/return}} @@ -21,15 +33,27 @@ type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} } {{/queryTypes}} -{{#objectTypes}} +{{#objectTypes}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} &{{/last}}{{/interfaces}}{{/interfaces.length}} { - {{#properties}} + {{#properties}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} {{name}}: {{toGraphQLType}} {{/properties}} } {{/objectTypes}} -{{#enumTypes}} +{{#enumTypes}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} enum {{type}} { {{#constants}} {{.}} @@ -39,15 +63,27 @@ enum {{type}} { {{/enumTypes}} ### Imported Queries START ### -{{#importedQueryTypes}} +{{#importedQueryTypes}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} &{{/last}}{{/interfaces}}{{/interfaces.length}} @imported( uri: "{{uri}}", namespace: "{{namespace}}", nativeType: "{{nativeType}}" ) { - {{#methods}} + {{#methods}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} {{name}}( - {{#arguments}} + {{#arguments}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} {{name}}: {{toGraphQLType}} {{/arguments}} ): {{#return}}{{toGraphQLType}}{{/return}} @@ -62,20 +98,32 @@ type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} ### Imported Objects START ### -{{#importedObjectTypes}} +{{#importedObjectTypes}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} &{{/last}}{{/interfaces}}{{/interfaces.length}} @imported( uri: "{{uri}}", namespace: "{{namespace}}", nativeType: "{{nativeType}}" ) { - {{#properties}} + {{#properties}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} {{name}}: {{toGraphQLType}} {{/properties}} } {{/importedObjectTypes}} -{{#importedEnumTypes}} +{{#importedEnumTypes}}{{#comment}} +""" +{{comment}} +""" +{{/comment}} enum {{type}} @imported( namespace: "{{namespace}}", uri: "{{uri}}", diff --git a/packages/test-cases/cases/compose/sanity/input/mutation.graphql b/packages/test-cases/cases/compose/sanity/input/mutation.graphql index 4f5b0a22f0..09bf837a07 100644 --- a/packages/test-cases/cases/compose/sanity/input/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/input/mutation.graphql @@ -3,12 +3,30 @@ #import { InterfaceObject1, InterfaceObject2, Mutation } into Interface from "interface.eth" #import { CommonType } from "../imports-local/common.graphql" +""" +Mutation comment +""" type Mutation implements Interface_Mutation { +""" +method1 comment +""" method1( +""" +str comment +""" str: String! +""" +optStr comment +""" optStr: String u: UInt! +""" +uArrayArray comment +""" uArrayArray: [[UInt]]! +""" +implObject comment +""" implObject: LocalImplementationObject! ): String! @@ -17,8 +35,17 @@ type Mutation implements Interface_Mutation { ): [Int64!]! } +""" +CustomMutationType comment +""" type CustomMutationType { +""" +str comment +""" str: String! +""" +optStr comment +""" optStr: String u: UInt! optU: UInt @@ -31,8 +58,14 @@ type CustomMutationType { uArray: [UInt!]! uOptArray: [UInt!] optStrOptArray: [String] +""" +crazyArray comment +""" crazyArray: [[[[UInt64!]]!]] commonType: CommonType! +""" +customType comment +""" customType: Namespace_CustomType! } @@ -40,7 +73,13 @@ type AnotherMutationType { prop: String } +""" +ImplementationObject comment +""" type ImplementationObject implements Interface_InterfaceObject1 & Interface_InterfaceObject2 { +""" +anotherProp comment +""" anotherProp: String } diff --git a/packages/test-cases/cases/compose/sanity/input/query.graphql b/packages/test-cases/cases/compose/sanity/input/query.graphql index 40de0284b9..3682858376 100644 --- a/packages/test-cases/cases/compose/sanity/input/query.graphql +++ b/packages/test-cases/cases/compose/sanity/input/query.graphql @@ -2,19 +2,34 @@ #import { Query } into Interface from "interface.eth" #import { CommonType } from "../imports-local/common.graphql" +""" +Query comment +""" type Query implements Interface_Query { +""" +method1 comment +""" method1( str: String! optStr: String u: UInt! +""" +uArrayArray comment +""" uArrayArray: [[UInt]]! ): String! +""" +method2 comment +""" method2( arg: [String!]! ): [Int64!]! } +""" +CustomQueryType comment +""" type CustomQueryType { str: String! optStr: String @@ -31,6 +46,9 @@ type CustomQueryType { optStrOptArray: [String] crazyArray: [[[[UInt64!]]!]] commonType: CommonType! +""" +customType comment +""" customType: Namespace_CustomType! } diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index f83082d492..6f674acfa9 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -23,6 +23,9 @@ directive @imports( ) on OBJECT ### Web3API Header END ### +""" +Mutation comment +""" type Mutation implements Interface_Mutation @imports( types: [ "Namespace_Query", @@ -42,11 +45,26 @@ type Mutation implements Interface_Mutation @imports( "Interface_Mutation" ] ) { +""" +method1 comment +""" method1( +""" +str comment +""" str: String! +""" +optStr comment +""" optStr: String u: UInt! +""" +uArrayArray comment +""" uArrayArray: [[UInt]]! +""" +implObject comment +""" implObject: LocalImplementationObject! ): String! @@ -59,8 +77,17 @@ type Mutation implements Interface_Mutation @imports( ): String! } +""" +CustomMutationType comment +""" type CustomMutationType { +""" +str comment +""" str: String! +""" +optStr comment +""" optStr: String u: UInt! optU: UInt @@ -73,8 +100,14 @@ type CustomMutationType { uArray: [UInt!]! uOptArray: [UInt!] optStrOptArray: [String] +""" +crazyArray comment +""" crazyArray: [[[[UInt64!]]!]] commonType: CommonType! +""" +customType comment +""" customType: Namespace_CustomType! } @@ -82,7 +115,13 @@ type AnotherMutationType { prop: String } +""" +ImplementationObject comment +""" type ImplementationObject implements Interface_InterfaceObject1 & Interface_InterfaceObject2 { +""" +anotherProp comment +""" anotherProp: String str: String! uint8: UInt8! diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index 48d04a786d..56d3214d5d 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -19,7 +19,7 @@ export const typeInfo: TypeInfo = { enumTypes: [], queryTypes: [ { - ...createQueryDefinition({ type: "Mutation" }), + ...createQueryDefinition({ type: "Mutation", comment: "Mutation comment" }), imports: [ { type: "Namespace_Query" }, { type: "Namespace_Mutation" }, @@ -49,18 +49,21 @@ export const typeInfo: TypeInfo = { name: "method1", type: "String", required: true - }) + }), + comment: "method1 comment" }), arguments: [ createScalarPropertyDefinition({ name: "str", required: true, - type: "String" + type: "String", + comment: "str comment" }), createScalarPropertyDefinition({ name: "optStr", required: false, - type: "String" + type: "String", + comment: "optStr comment" }), createScalarPropertyDefinition({ name: "u", @@ -80,12 +83,14 @@ export const typeInfo: TypeInfo = { required: false, type: "UInt" }) - }) + }), + comment: "uArrayArray comment" }), createObjectPropertyDefinition({ name: "implObject", required: true, - type: "LocalImplementationObject" + type: "LocalImplementationObject", + comment: "implObject comment" }), ] }, @@ -140,10 +145,10 @@ export const typeInfo: TypeInfo = { ], objectTypes: [ { - ...createObjectDefinition({ type: "CustomMutationType" }), + ...createObjectDefinition({ type: "CustomMutationType", comment: "CustomMutationType comment" }), properties: [ - createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "optStr", type: "String", required: false }), + createScalarPropertyDefinition({ name: "str", type: "String", required: true, comment: "str comment" }), + createScalarPropertyDefinition({ name: "optStr", type: "String", required: false, comment: "optStr comment" }), createScalarPropertyDefinition({ name: "u", type: "UInt", required: true }), createScalarPropertyDefinition({ name: "optU", type: "UInt", required: false }), createScalarPropertyDefinition({ name: "u8", type: "UInt8", required: true }), @@ -174,6 +179,7 @@ export const typeInfo: TypeInfo = { name: "crazyArray", type: "[[[[UInt64]]]]", required: false, + comment: "crazyArray comment", item: createArrayDefinition({ name: "crazyArray", type: "[[[UInt64]]]", @@ -200,6 +206,7 @@ export const typeInfo: TypeInfo = { name: "customType", type: "Namespace_CustomType", required: true, + comment: "customType comment" }) ], }, @@ -213,10 +220,11 @@ export const typeInfo: TypeInfo = { interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_InterfaceObject1" }), createInterfaceImplementedDefinition({ type: "Interface_InterfaceObject2" }) - ] + ], + comment: "ImplementationObject comment" }), properties: [ - createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false }), + createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false, comment: "anotherProp comment" }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), diff --git a/packages/test-cases/cases/compose/sanity/output/query.graphql b/packages/test-cases/cases/compose/sanity/output/query.graphql index 22c817dc66..3fd8d1cae2 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.graphql +++ b/packages/test-cases/cases/compose/sanity/output/query.graphql @@ -23,6 +23,9 @@ directive @imports( ) on OBJECT ### Web3API Header END ### +""" +Query comment +""" type Query implements Interface_Query @imports( types: [ "Namespace_Query", @@ -41,13 +44,22 @@ type Query implements Interface_Query @imports( "Interface_NestedInterfaceObject" ] ) { +""" +method1 comment +""" method1( str: String! optStr: String u: UInt! +""" +uArrayArray comment +""" uArrayArray: [[UInt]]! ): String! +""" +method2 comment +""" method2( arg: [String!]! ): [Int64!]! @@ -57,6 +69,9 @@ type Query implements Interface_Query @imports( ): Interface_InterfaceObject2! } +""" +CustomQueryType comment +""" type CustomQueryType { str: String! optStr: String @@ -73,6 +88,9 @@ type CustomQueryType { optStrOptArray: [String] crazyArray: [[[[UInt64!]]!]] commonType: CommonType! +""" +customType comment +""" customType: Namespace_CustomType! } diff --git a/packages/test-cases/cases/compose/sanity/output/query.ts b/packages/test-cases/cases/compose/sanity/output/query.ts index c73562a687..5bfaa93f72 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.ts +++ b/packages/test-cases/cases/compose/sanity/output/query.ts @@ -18,7 +18,7 @@ import { export const typeInfo: TypeInfo = { objectTypes: [ { - ...createObjectDefinition({ type: "CustomQueryType" }), + ...createObjectDefinition({ type: "CustomQueryType", comment: "CustomQueryType comment" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "optStr", type: "String", required: false }), @@ -78,6 +78,7 @@ export const typeInfo: TypeInfo = { name: "customType", type: "Namespace_CustomType", required: true, + comment: "customType comment" }) ], }, @@ -126,7 +127,7 @@ export const typeInfo: TypeInfo = { ], queryTypes: [ { - ...createQueryDefinition({ type: "Query" }), + ...createQueryDefinition({ type: "Query", comment: "Query comment" }), imports: [ { type: "Namespace_Query" }, { type: "Namespace_CustomType" }, @@ -155,7 +156,8 @@ export const typeInfo: TypeInfo = { name: "method1", type: "String", required: true - }) + }), + comment: "method1 comment" }), arguments: [ createScalarPropertyDefinition({ @@ -177,6 +179,7 @@ export const typeInfo: TypeInfo = { name: "uArrayArray", required: true, type: "[[UInt]]", + comment: "uArrayArray comment", item: createArrayDefinition({ name: "uArrayArray", required: false, @@ -194,6 +197,7 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "query", name: "method2", + comment: "method2 comment", return: createArrayPropertyDefinition({ name: "method2", type: "[Int64]", diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index ba402826cd..2be9aa5681 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -23,6 +23,9 @@ directive @imports( ) on OBJECT ### Web3API Header END ### +""" +Query comment +""" type Query implements Interface_Query @imports( types: [ "Namespace_Query", @@ -41,13 +44,22 @@ type Query implements Interface_Query @imports( "Interface_NestedInterfaceObject" ] ) { +""" +method1 comment +""" method1( str: String! optStr: String u: UInt! +""" +uArrayArray comment +""" uArrayArray: [[UInt]]! ): String! +""" +method2 comment +""" method2( arg: [String!]! ): [Int64!]! @@ -57,6 +69,9 @@ type Query implements Interface_Query @imports( ): Interface_InterfaceObject2! } +""" +Mutation comment +""" type Mutation implements Interface_Mutation @imports( types: [ "Namespace_Query", @@ -76,11 +91,26 @@ type Mutation implements Interface_Mutation @imports( "Interface_Mutation" ] ) { +""" +method1 comment +""" method1( +""" +str comment +""" str: String! +""" +optStr comment +""" optStr: String u: UInt! +""" +uArrayArray comment +""" uArrayArray: [[UInt]]! +""" +implObject comment +""" implObject: LocalImplementationObject! ): String! @@ -93,6 +123,9 @@ type Mutation implements Interface_Mutation @imports( ): String! } +""" +CustomQueryType comment +""" type CustomQueryType { str: String! optStr: String @@ -109,6 +142,9 @@ type CustomQueryType { optStrOptArray: [String] crazyArray: [[[[UInt64!]]!]] commonType: CommonType! +""" +customType comment +""" customType: Namespace_CustomType! } @@ -130,8 +166,17 @@ type ArrayObject { prop: String! } +""" +CustomMutationType comment +""" type CustomMutationType { +""" +str comment +""" str: String! +""" +optStr comment +""" optStr: String u: UInt! optU: UInt @@ -144,8 +189,14 @@ type CustomMutationType { uArray: [UInt!]! uOptArray: [UInt!] optStrOptArray: [String] +""" +crazyArray comment +""" crazyArray: [[[[UInt64!]]!]] commonType: CommonType! +""" +customType comment +""" customType: Namespace_CustomType! } @@ -153,7 +204,13 @@ type AnotherMutationType { prop: String } +""" +ImplementationObject comment +""" type ImplementationObject implements Interface_InterfaceObject1 & Interface_InterfaceObject2 { +""" +anotherProp comment +""" anotherProp: String str: String! uint8: UInt8! diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index 43a23c1ba3..774d50b6df 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -19,7 +19,7 @@ export const typeInfo: TypeInfo = { enumTypes: [], queryTypes: [ { - ...createQueryDefinition({ type: "Query" }), + ...createQueryDefinition({ type: "Query", comment: "Query comment" }), imports: [ { type: "Namespace_Query" }, { type: "Namespace_CustomType" }, @@ -44,6 +44,7 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "query", name: "method1", + comment: "method1 comment", return: createScalarPropertyDefinition({ name: "method1", type: "String", @@ -70,6 +71,7 @@ export const typeInfo: TypeInfo = { name: "uArrayArray", required: true, type: "[[UInt]]", + comment: "uArrayArray comment", item: createArrayDefinition({ name: "uArrayArray", required: false, @@ -87,6 +89,7 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "query", name: "method2", + comment: "method2 comment", return: createArrayPropertyDefinition({ name: "method2", type: "[Int64]", @@ -132,7 +135,7 @@ export const typeInfo: TypeInfo = { ] }, { - ...createQueryDefinition({ type: "Mutation" }), + ...createQueryDefinition({ type: "Mutation", comment: "Mutation comment" }), imports: [ { type: "Namespace_Query" }, { type: "Namespace_Mutation" }, @@ -155,6 +158,7 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "mutation", name: "method1", + comment: "method1 comment", return: createScalarPropertyDefinition({ name: "method1", type: "String", @@ -165,12 +169,14 @@ export const typeInfo: TypeInfo = { createScalarPropertyDefinition({ name: "str", required: true, - type: "String" + type: "String", + comment: "str comment" }), createScalarPropertyDefinition({ name: "optStr", required: false, - type: "String" + type: "String", + comment: "optStr comment" }), createScalarPropertyDefinition({ name: "u", @@ -181,6 +187,7 @@ export const typeInfo: TypeInfo = { name: "uArrayArray", required: true, type: "[[UInt]]", + comment: "uArrayArray comment", item: createArrayDefinition({ name: "uArrayArray", required: false, @@ -195,7 +202,8 @@ export const typeInfo: TypeInfo = { createObjectPropertyDefinition({ name: "implObject", required: true, - type: "LocalImplementationObject" + type: "LocalImplementationObject", + comment: "implObject comment" }), ] }, @@ -253,7 +261,7 @@ export const typeInfo: TypeInfo = { ], objectTypes: [ { - ...createObjectDefinition({ type: "CustomQueryType" }), + ...createObjectDefinition({ type: "CustomQueryType", comment: "CustomQueryType comment" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "optStr", type: "String", required: false }), @@ -313,6 +321,7 @@ export const typeInfo: TypeInfo = { name: "customType", type: "Namespace_CustomType", required: true, + comment: "customType comment" }) ], }, @@ -359,10 +368,10 @@ export const typeInfo: TypeInfo = { ], }, { - ...createObjectDefinition({ type: "CustomMutationType" }), + ...createObjectDefinition({ type: "CustomMutationType", comment: "CustomMutationType comment" }), properties: [ - createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "optStr", type: "String", required: false }), + createScalarPropertyDefinition({ name: "str", type: "String", required: true, comment: "str comment" }), + createScalarPropertyDefinition({ name: "optStr", type: "String", required: false, comment: "optStr comment" }), createScalarPropertyDefinition({ name: "u", type: "UInt", required: true }), createScalarPropertyDefinition({ name: "optU", type: "UInt", required: false }), createScalarPropertyDefinition({ name: "u8", type: "UInt8", required: true }), @@ -393,6 +402,7 @@ export const typeInfo: TypeInfo = { name: "crazyArray", type: "[[[[UInt64]]]]", required: false, + comment: "crazyArray comment", item: createArrayDefinition({ name: "crazyArray", type: "[[[UInt64]]]", @@ -419,6 +429,7 @@ export const typeInfo: TypeInfo = { name: "customType", type: "Namespace_CustomType", required: true, + comment: "customType comment" }) ], }, @@ -432,10 +443,11 @@ export const typeInfo: TypeInfo = { interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_InterfaceObject1" }), createInterfaceImplementedDefinition({ type: "Interface_InterfaceObject2" }) - ] + ], + comment: "ImplementationObject comment" }), properties: [ - createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false }), + createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false, comment: "anotherProp comment" }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), From 7e1df21a6d3be3ff55aa96ee4bae733410e218df Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 25 Jun 2021 16:15:49 +0200 Subject: [PATCH 085/112] added imported and interface comment tests --- .../schema/parse/src/typeInfo/definitions.ts | 1 + .../imports-ext/interface.eth/schema.graphql | 39 +++++++++ .../imports-ext/test.eth/schema.graphql | 24 ++++++ .../sanity/imports-local/common.graphql | 12 +++ .../compose/sanity/output/mutation.graphql | 60 +++++++++++++ .../cases/compose/sanity/output/mutation.ts | 50 +++++++---- .../cases/compose/sanity/output/query.graphql | 69 +++++++++++++++ .../cases/compose/sanity/output/query.ts | 54 ++++++++---- .../compose/sanity/output/schema.graphql | 84 +++++++++++++++++++ .../cases/compose/sanity/output/schema.ts | 69 ++++++++++----- 10 files changed, 405 insertions(+), 57 deletions(-) diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index 405778d608..fa64d92746 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -231,6 +231,7 @@ export function createEnumPropertyDefinition(args: { name?: string | null; required?: boolean; constants?: string[]; + comment?: string; }): PropertyDefinition { return createPropertyDefinition({ ...args, diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql index 4be0899837..f4f0bfa1d3 100644 --- a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql @@ -24,41 +24,80 @@ directive @imports( ### Web3API Header END ### +""" +Mutation comment +""" type Mutation { abstractMutationMethod( arg: UInt8! ): String! } +""" +Query comment +""" type Query { +""" +abstractQueryMethod comment +""" abstractQueryMethod( +""" +arg comment +""" arg: QueryInterfaceArgument! ): InterfaceObject2! } +""" +QueryInterfaceArgument comment +""" type QueryInterfaceArgument implements NestedQueryInterfaceArgument { str: String! +""" +uint8 comment +""" uint8: UInt8! } +""" +NestedQueryInterfaceArgument comment +""" type NestedQueryInterfaceArgument { uint8: UInt8! } +""" +InterfaceObject1 comment +""" type InterfaceObject1 { str: String! +""" +uint8 comment +""" uint8: UInt8! } +""" +InterfaceObject2 comment +""" type InterfaceObject2 implements NestedInterfaceObject { str2: String! object: Object } +""" +NestedInterfaceObject comment +""" type NestedInterfaceObject { +""" +object comment +""" object: Object } +""" +Object comment +""" type Object { uint8: UInt8! } \ No newline at end of file diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/test.eth/schema.graphql b/packages/test-cases/cases/compose/sanity/imports-ext/test.eth/schema.graphql index a0acfe625c..68d08be3e2 100644 --- a/packages/test-cases/cases/compose/sanity/imports-ext/test.eth/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/imports-ext/test.eth/schema.graphql @@ -29,6 +29,9 @@ enum CustomEnum { BYTES } +""" +Query comment +""" type Query { method1( str: String! @@ -38,11 +41,20 @@ type Query { uArrayArray: [[UInt]]! ): String! +""" +method2 comment +""" method2( +""" +arg comment +""" arg: [String!]! ): [Int64!]! } +""" +Mutation comment +""" type Mutation @imports( types: [ "Imported_NestedObjectType", @@ -72,6 +84,9 @@ type Mutation @imports( ): Imported_NestedObjectType } +""" +CustomType comment +""" type CustomType { str: String! optStr: String @@ -105,6 +120,9 @@ type CustomType { enum: CustomEnum! optEnum: CustomEnum importedEnum: Imported_Enum! +""" +optImportedEnum comment +""" optImportedEnum: Imported_Enum } @@ -116,6 +134,9 @@ type ObjectType { prop: String! } +""" +Imported_NestedObjectType comment +""" type Imported_NestedObjectType @imported( uri: "imported.eth", namespace: "Imported", @@ -132,6 +153,9 @@ type Imported_ObjectType @imported( prop: String! } +""" +Imported_Enum comment +""" enum Imported_Enum @imported( namespace: "Imported", uri: "imported.eth", diff --git a/packages/test-cases/cases/compose/sanity/imports-local/common.graphql b/packages/test-cases/cases/compose/sanity/imports-local/common.graphql index effe4156ad..e5fe04ad93 100644 --- a/packages/test-cases/cases/compose/sanity/imports-local/common.graphql +++ b/packages/test-cases/cases/compose/sanity/imports-local/common.graphql @@ -1,13 +1,25 @@ +""" +CommonType comment +""" type CommonType { prop: UInt8! nestedObject: NestedType! +""" +objectArray comment +""" objectArray: [[ArrayObject]]! } +""" +NestedType comment +""" type NestedType { prop: String! } +""" +ArrayObject comment +""" type ArrayObject { prop: String! } diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index 6f674acfa9..670c6dd074 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -124,6 +124,9 @@ anotherProp comment """ anotherProp: String str: String! +""" +uint8 comment +""" uint8: UInt8! str2: String! object: Interface_Object @@ -138,22 +141,37 @@ type LocalInterfaceObject { str: String! } +""" +CommonType comment +""" type CommonType { prop: UInt8! nestedObject: NestedType! +""" +objectArray comment +""" objectArray: [[ArrayObject]]! } +""" +NestedType comment +""" type NestedType { prop: String! } +""" +ArrayObject comment +""" type ArrayObject { prop: String! } ### Imported Queries START ### +""" +Query comment +""" type Namespace_Query @imported( uri: "test.eth", namespace: "Namespace", @@ -167,11 +185,20 @@ type Namespace_Query @imported( uArrayArray: [[UInt]]! ): String! +""" +method2 comment +""" method2( +""" +arg comment +""" arg: [String!]! ): [Int64!]! } +""" +Mutation comment +""" type Namespace_Mutation @imported( uri: "test.eth", namespace: "Namespace", @@ -210,6 +237,9 @@ type JustMutation_Mutation @imported( ): [Int64!]! } +""" +Mutation comment +""" type Interface_Mutation @imported( uri: "interface.eth", namespace: "Interface", @@ -240,6 +270,9 @@ type Namespace_ObjectType @imported( prop: String! } +""" +Imported_NestedObjectType comment +""" type Namespace_Imported_NestedObjectType @imported( uri: "test.eth", namespace: "Namespace", @@ -256,6 +289,9 @@ type Namespace_Imported_ObjectType @imported( prop: String! } +""" +CustomType comment +""" type Namespace_CustomType @imported( uri: "test.eth", namespace: "Namespace", @@ -293,18 +329,30 @@ type Namespace_CustomType @imported( enum: Namespace_CustomEnum! optEnum: Namespace_CustomEnum importedEnum: Namespace_Imported_Enum! +""" +optImportedEnum comment +""" optImportedEnum: Namespace_Imported_Enum } +""" +InterfaceObject1 comment +""" type Interface_InterfaceObject1 @imported( uri: "interface.eth", namespace: "Interface", nativeType: "InterfaceObject1" ) { str: String! +""" +uint8 comment +""" uint8: UInt8! } +""" +InterfaceObject2 comment +""" type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @imported( uri: "interface.eth", namespace: "Interface", @@ -314,6 +362,9 @@ type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @impo object: Interface_Object } +""" +Object comment +""" type Interface_Object @imported( uri: "interface.eth", namespace: "Interface", @@ -322,11 +373,17 @@ type Interface_Object @imported( uint8: UInt8! } +""" +NestedInterfaceObject comment +""" type Interface_NestedInterfaceObject @imported( uri: "interface.eth", namespace: "Interface", nativeType: "NestedInterfaceObject" ) { +""" +object comment +""" object: Interface_Object } @@ -339,6 +396,9 @@ enum Namespace_CustomEnum @imported( BYTES } +""" +Imported_Enum comment +""" enum Namespace_Imported_Enum @imported( namespace: "Namespace", uri: "test.eth", diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index 56d3214d5d..112c59cedb 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -226,7 +226,7 @@ export const typeInfo: TypeInfo = { properties: [ createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false, comment: "anotherProp comment" }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "uint8 comment" }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] @@ -252,7 +252,7 @@ export const typeInfo: TypeInfo = { ] }, { - ...createObjectDefinition({ type: "CommonType" }), + ...createObjectDefinition({ type: "CommonType", comment: "CommonType comment" }), properties: [ createScalarPropertyDefinition({ name: "prop", type: "UInt8", required: true }), createObjectPropertyDefinition({ name: "nestedObject", type: "NestedType", required: true }), @@ -260,6 +260,7 @@ export const typeInfo: TypeInfo = { name: "objectArray", type: "[[ArrayObject]]", required: true, + comment: "objectArray comment", item: createArrayDefinition({ name: "objectArray", type: "[ArrayObject]", @@ -275,7 +276,8 @@ export const typeInfo: TypeInfo = { }, { ...createObjectDefinition({ - type: "NestedType" + type: "NestedType", + comment: "NestedType comment" }), properties: [ createScalarPropertyDefinition({ name: "prop", type: "String", required: true }), @@ -283,7 +285,8 @@ export const typeInfo: TypeInfo = { }, { ...createObjectDefinition({ - type: "ArrayObject" + type: "ArrayObject", + comment: "ArrayObject comment" }), properties: [ createScalarPropertyDefinition({ name: "prop", type: "String", required: true }), @@ -296,7 +299,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "Query", - type: "Namespace_Query" + type: "Namespace_Query", + comment: "Query comment" }), methods: [ { @@ -351,6 +355,7 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "query", name: "method2", + comment: "method2 comment", return: createArrayPropertyDefinition({ name: "method2", type: "[Int64]", @@ -367,6 +372,7 @@ export const typeInfo: TypeInfo = { name: "arg", required: true, type: "[String]", + comment: "arg comment", item: createScalarDefinition({ name: "arg", required: true, @@ -382,7 +388,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "Mutation", - type: "Namespace_Mutation" + type: "Namespace_Mutation", + comment: "Mutation comment" }), methods: [ { @@ -562,7 +569,8 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "Mutation", - type: "Interface_Mutation" + type: "Interface_Mutation", + comment: "Mutation comment" }), methods: [ { @@ -610,7 +618,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "Imported_NestedObjectType", - type: "Namespace_Imported_NestedObjectType" + type: "Namespace_Imported_NestedObjectType", + comment: "Imported_NestedObjectType comment" }), properties: [createObjectPropertyDefinition({ name: "nestedObject", type: "Namespace_Imported_ObjectType", required: true })], }, @@ -628,7 +637,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "CustomType", - type: "Namespace_CustomType" + type: "Namespace_CustomType", + comment: "CustomType comment" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), @@ -791,7 +801,8 @@ export const typeInfo: TypeInfo = { createEnumPropertyDefinition({ name: "optImportedEnum", type: "Namespace_Imported_Enum", - required: false + required: false, + comment: "optImportedEnum comment" }), ] }, @@ -800,11 +811,12 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "InterfaceObject1", - type: "Interface_InterfaceObject1" + type: "Interface_InterfaceObject1", + comment: "InterfaceObject1 comment" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "uint8 comment" }), ] }, { @@ -812,7 +824,8 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "InterfaceObject2", - type: "Interface_InterfaceObject2" + type: "Interface_InterfaceObject2", + comment: "InterfaceObject2 comment" }), interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_NestedInterfaceObject" }) @@ -827,7 +840,8 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "Object", - type: "Interface_Object" + type: "Interface_Object", + comment: "Object comment" }), properties: [ createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), @@ -838,10 +852,11 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "NestedInterfaceObject", - type: "Interface_NestedInterfaceObject" + type: "Interface_NestedInterfaceObject", + comment: "NestedInterfaceObject comment" }), properties: [ - createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false, comment: "object comment" }), ] }, ], @@ -867,7 +882,8 @@ export const typeInfo: TypeInfo = { constants: [ "STRING", "BYTES" - ] + ], + comment: "Imported_Enum comment" }) } ], diff --git a/packages/test-cases/cases/compose/sanity/output/query.graphql b/packages/test-cases/cases/compose/sanity/output/query.graphql index 3fd8d1cae2..05fac8b43b 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.graphql +++ b/packages/test-cases/cases/compose/sanity/output/query.graphql @@ -64,7 +64,13 @@ method2 comment arg: [String!]! ): [Int64!]! +""" +abstractQueryMethod comment +""" abstractQueryMethod( +""" +arg comment +""" arg: Interface_QueryInterfaceArgument! ): Interface_InterfaceObject2! } @@ -98,22 +104,37 @@ type AnotherQueryType { prop: String } +""" +CommonType comment +""" type CommonType { prop: UInt8! nestedObject: NestedType! +""" +objectArray comment +""" objectArray: [[ArrayObject]]! } +""" +NestedType comment +""" type NestedType { prop: String! } +""" +ArrayObject comment +""" type ArrayObject { prop: String! } ### Imported Queries START ### +""" +Query comment +""" type Namespace_Query @imported( uri: "test.eth", namespace: "Namespace", @@ -127,17 +148,32 @@ type Namespace_Query @imported( uArrayArray: [[UInt]]! ): String! +""" +method2 comment +""" method2( +""" +arg comment +""" arg: [String!]! ): [Int64!]! } +""" +Query comment +""" type Interface_Query @imported( uri: "interface.eth", namespace: "Interface", nativeType: "Query" ) { +""" +abstractQueryMethod comment +""" abstractQueryMethod( +""" +arg comment +""" arg: Interface_QueryInterfaceArgument! ): Interface_InterfaceObject2! } @@ -146,6 +182,9 @@ type Interface_Query @imported( ### Imported Objects START ### +""" +CustomType comment +""" type Namespace_CustomType @imported( uri: "test.eth", namespace: "Namespace", @@ -183,6 +222,9 @@ type Namespace_CustomType @imported( enum: Namespace_CustomEnum! optEnum: Namespace_CustomEnum importedEnum: Namespace_Imported_Enum! +""" +optImportedEnum comment +""" optImportedEnum: Namespace_Imported_Enum } @@ -202,6 +244,9 @@ type Namespace_NestedObjectType @imported( nestedObject: Namespace_ObjectType! } +""" +Imported_NestedObjectType comment +""" type Namespace_Imported_NestedObjectType @imported( uri: "test.eth", namespace: "Namespace", @@ -218,15 +263,24 @@ type Namespace_Imported_ObjectType @imported( prop: String! } +""" +QueryInterfaceArgument comment +""" type Interface_QueryInterfaceArgument implements Interface_NestedQueryInterfaceArgument @imported( uri: "interface.eth", namespace: "Interface", nativeType: "QueryInterfaceArgument" ) { str: String! +""" +uint8 comment +""" uint8: UInt8! } +""" +NestedQueryInterfaceArgument comment +""" type Interface_NestedQueryInterfaceArgument @imported( uri: "interface.eth", namespace: "Interface", @@ -235,6 +289,9 @@ type Interface_NestedQueryInterfaceArgument @imported( uint8: UInt8! } +""" +InterfaceObject2 comment +""" type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @imported( uri: "interface.eth", namespace: "Interface", @@ -244,6 +301,9 @@ type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @impo object: Interface_Object } +""" +Object comment +""" type Interface_Object @imported( uri: "interface.eth", namespace: "Interface", @@ -252,11 +312,17 @@ type Interface_Object @imported( uint8: UInt8! } +""" +NestedInterfaceObject comment +""" type Interface_NestedInterfaceObject @imported( uri: "interface.eth", namespace: "Interface", nativeType: "NestedInterfaceObject" ) { +""" +object comment +""" object: Interface_Object } @@ -269,6 +335,9 @@ enum Namespace_CustomEnum @imported( BYTES } +""" +Imported_Enum comment +""" enum Namespace_Imported_Enum @imported( namespace: "Namespace", uri: "test.eth", diff --git a/packages/test-cases/cases/compose/sanity/output/query.ts b/packages/test-cases/cases/compose/sanity/output/query.ts index 5bfaa93f72..07f93a29d1 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.ts +++ b/packages/test-cases/cases/compose/sanity/output/query.ts @@ -87,7 +87,7 @@ export const typeInfo: TypeInfo = { properties: [createScalarPropertyDefinition({ name: "prop", type: "String" })], }, { - ...createObjectDefinition({ type: "CommonType" }), + ...createObjectDefinition({ type: "CommonType", comment: "CommonType comment" }), properties: [ createScalarPropertyDefinition({ name: "prop", type: "UInt8", required: true }), createObjectPropertyDefinition({ name: "nestedObject", type: "NestedType", required: true }), @@ -95,6 +95,7 @@ export const typeInfo: TypeInfo = { name: "objectArray", type: "[[ArrayObject]]", required: true, + comment: "objectArray comment", item: createArrayDefinition({ name: "objectArray", type: "[ArrayObject]", @@ -110,7 +111,8 @@ export const typeInfo: TypeInfo = { }, { ...createObjectDefinition({ - type: "NestedType" + type: "NestedType", + comment: "NestedType comment" }), properties: [ createScalarPropertyDefinition({ name: "prop", type: "String", required: true }), @@ -118,7 +120,8 @@ export const typeInfo: TypeInfo = { }, { ...createObjectDefinition({ - type: "ArrayObject" + type: "ArrayObject", + comment: "ArrayObject comment" }), properties: [ createScalarPropertyDefinition({ name: "prop", type: "String", required: true }), @@ -226,6 +229,7 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "query", name: "abstractQueryMethod", + comment: "abstractQueryMethod comment", return: createObjectPropertyDefinition({ name: "abstractQueryMethod", type: "Interface_InterfaceObject2", @@ -236,6 +240,7 @@ export const typeInfo: TypeInfo = { createObjectPropertyDefinition({ name: "arg", required: true, + comment: "arg comment", type: "Interface_QueryInterfaceArgument" }) ] @@ -250,7 +255,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "CustomType", - type: "Namespace_CustomType" + type: "Namespace_CustomType", + comment: "CustomType comment" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), @@ -413,7 +419,8 @@ export const typeInfo: TypeInfo = { createEnumPropertyDefinition({ name: "optImportedEnum", type: "Namespace_Imported_Enum", - required: false + required: false, + comment: "optImportedEnum comment" }), ] }, @@ -440,7 +447,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "Imported_NestedObjectType", - type: "Namespace_Imported_NestedObjectType" + type: "Namespace_Imported_NestedObjectType", + comment: "Imported_NestedObjectType comment" }), properties: [createObjectPropertyDefinition({ name: "nestedObject", type: "Namespace_Imported_ObjectType", required: true })], }, @@ -458,14 +466,15 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "QueryInterfaceArgument", - type: "Interface_QueryInterfaceArgument" + type: "Interface_QueryInterfaceArgument", + comment: "QueryInterfaceArgument comment" }), interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_NestedQueryInterfaceArgument" }) ], properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "uint8 comment" }), ] }, { @@ -473,7 +482,8 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "NestedQueryInterfaceArgument", - type: "Interface_NestedQueryInterfaceArgument" + type: "Interface_NestedQueryInterfaceArgument", + comment: "NestedQueryInterfaceArgument comment" }), properties: [ createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), @@ -484,7 +494,8 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "InterfaceObject2", - type: "Interface_InterfaceObject2" + type: "Interface_InterfaceObject2", + comment: "InterfaceObject2 comment" }), interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_NestedInterfaceObject" }) @@ -499,7 +510,8 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "Object", - type: "Interface_Object" + type: "Interface_Object", + comment: "Object comment" }), properties: [ createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), @@ -510,10 +522,11 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "NestedInterfaceObject", - type: "Interface_NestedInterfaceObject" + type: "Interface_NestedInterfaceObject", + comment: "NestedInterfaceObject comment" }), properties: [ - createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false, comment: "object comment" }), ] }, ], @@ -523,7 +536,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "Query", - type: "Namespace_Query" + type: "Namespace_Query", + comment: "Query comment" }), methods: [ { @@ -578,6 +592,7 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "query", name: "method2", + comment: "method2 comment", return: createArrayPropertyDefinition({ name: "method2", type: "[Int64]", @@ -594,6 +609,7 @@ export const typeInfo: TypeInfo = { name: "arg", required: true, type: "[String]", + comment: "arg comment", item: createScalarDefinition({ name: "arg", required: true, @@ -609,13 +625,15 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "Query", - type: "Interface_Query" + type: "Interface_Query", + comment: "Query comment" }), methods: [ { ...createMethodDefinition({ type: "query", name: "abstractQueryMethod", + comment: "abstractQueryMethod comment", return: createObjectPropertyDefinition({ name: "abstractQueryMethod", type: "Interface_InterfaceObject2", @@ -626,7 +644,8 @@ export const typeInfo: TypeInfo = { createObjectPropertyDefinition({ name: "arg", required: true, - type: "Interface_QueryInterfaceArgument" + type: "Interface_QueryInterfaceArgument", + comment: "arg comment" }), ] }, @@ -655,7 +674,8 @@ export const typeInfo: TypeInfo = { constants: [ "STRING", "BYTES" - ] + ], + comment: "Imported_Enum comment" }) } ], diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index 2be9aa5681..ac92adadc0 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -64,7 +64,13 @@ method2 comment arg: [String!]! ): [Int64!]! +""" +abstractQueryMethod comment +""" abstractQueryMethod( +""" +arg comment +""" arg: Interface_QueryInterfaceArgument! ): Interface_InterfaceObject2! } @@ -152,16 +158,28 @@ type AnotherQueryType { prop: String } +""" +CommonType comment +""" type CommonType { prop: UInt8! nestedObject: NestedType! +""" +objectArray comment +""" objectArray: [[ArrayObject]]! } +""" +NestedType comment +""" type NestedType { prop: String! } +""" +ArrayObject comment +""" type ArrayObject { prop: String! } @@ -213,6 +231,9 @@ anotherProp comment """ anotherProp: String str: String! +""" +uint8 comment +""" uint8: UInt8! str2: String! object: Interface_Object @@ -229,6 +250,9 @@ type LocalInterfaceObject { ### Imported Queries START ### +""" +Query comment +""" type Namespace_Query @imported( uri: "test.eth", namespace: "Namespace", @@ -242,21 +266,39 @@ type Namespace_Query @imported( uArrayArray: [[UInt]]! ): String! +""" +method2 comment +""" method2( +""" +arg comment +""" arg: [String!]! ): [Int64!]! } +""" +Query comment +""" type Interface_Query @imported( uri: "interface.eth", namespace: "Interface", nativeType: "Query" ) { +""" +abstractQueryMethod comment +""" abstractQueryMethod( +""" +arg comment +""" arg: Interface_QueryInterfaceArgument! ): Interface_InterfaceObject2! } +""" +Mutation comment +""" type Namespace_Mutation @imported( uri: "test.eth", namespace: "Namespace", @@ -295,6 +337,9 @@ type JustMutation_Mutation @imported( ): [Int64!]! } +""" +Mutation comment +""" type Interface_Mutation @imported( uri: "interface.eth", namespace: "Interface", @@ -309,6 +354,9 @@ type Interface_Mutation @imported( ### Imported Objects START ### +""" +CustomType comment +""" type Namespace_CustomType @imported( uri: "test.eth", namespace: "Namespace", @@ -346,6 +394,9 @@ type Namespace_CustomType @imported( enum: Namespace_CustomEnum! optEnum: Namespace_CustomEnum importedEnum: Namespace_Imported_Enum! +""" +optImportedEnum comment +""" optImportedEnum: Namespace_Imported_Enum } @@ -365,6 +416,9 @@ type Namespace_NestedObjectType @imported( nestedObject: Namespace_ObjectType! } +""" +Imported_NestedObjectType comment +""" type Namespace_Imported_NestedObjectType @imported( uri: "test.eth", namespace: "Namespace", @@ -381,15 +435,24 @@ type Namespace_Imported_ObjectType @imported( prop: String! } +""" +QueryInterfaceArgument comment +""" type Interface_QueryInterfaceArgument implements Interface_NestedQueryInterfaceArgument @imported( uri: "interface.eth", namespace: "Interface", nativeType: "QueryInterfaceArgument" ) { str: String! +""" +uint8 comment +""" uint8: UInt8! } +""" +NestedQueryInterfaceArgument comment +""" type Interface_NestedQueryInterfaceArgument @imported( uri: "interface.eth", namespace: "Interface", @@ -398,6 +461,9 @@ type Interface_NestedQueryInterfaceArgument @imported( uint8: UInt8! } +""" +InterfaceObject2 comment +""" type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @imported( uri: "interface.eth", namespace: "Interface", @@ -407,6 +473,9 @@ type Interface_InterfaceObject2 implements Interface_NestedInterfaceObject @impo object: Interface_Object } +""" +Object comment +""" type Interface_Object @imported( uri: "interface.eth", namespace: "Interface", @@ -415,20 +484,32 @@ type Interface_Object @imported( uint8: UInt8! } +""" +NestedInterfaceObject comment +""" type Interface_NestedInterfaceObject @imported( uri: "interface.eth", namespace: "Interface", nativeType: "NestedInterfaceObject" ) { +""" +object comment +""" object: Interface_Object } +""" +InterfaceObject1 comment +""" type Interface_InterfaceObject1 @imported( uri: "interface.eth", namespace: "Interface", nativeType: "InterfaceObject1" ) { str: String! +""" +uint8 comment +""" uint8: UInt8! } @@ -441,6 +522,9 @@ enum Namespace_CustomEnum @imported( BYTES } +""" +Imported_Enum comment +""" enum Namespace_Imported_Enum @imported( namespace: "Namespace", uri: "test.eth", diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index 774d50b6df..664594922e 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -118,6 +118,7 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "query", name: "abstractQueryMethod", + comment: "abstractQueryMethod comment", return: createObjectPropertyDefinition({ name: "abstractQueryMethod", type: "Interface_InterfaceObject2", @@ -128,7 +129,8 @@ export const typeInfo: TypeInfo = { createObjectPropertyDefinition({ name: "arg", required: true, - type: "Interface_QueryInterfaceArgument" + type: "Interface_QueryInterfaceArgument", + comment: "arg comment" }) ] } @@ -330,7 +332,7 @@ export const typeInfo: TypeInfo = { properties: [createScalarPropertyDefinition({ name: "prop", type: "String" })], }, { - ...createObjectDefinition({ type: "CommonType" }), + ...createObjectDefinition({ type: "CommonType", comment: "CommonType comment" }), properties: [ createScalarPropertyDefinition({ name: "prop", type: "UInt8", required: true }), createObjectPropertyDefinition({ name: "nestedObject", type: "NestedType", required: true }), @@ -338,6 +340,7 @@ export const typeInfo: TypeInfo = { name: "objectArray", type: "[[ArrayObject]]", required: true, + comment: "objectArray comment", item: createArrayDefinition({ name: "objectArray", type: "[ArrayObject]", @@ -353,7 +356,8 @@ export const typeInfo: TypeInfo = { }, { ...createObjectDefinition({ - type: "NestedType" + type: "NestedType", + comment: "NestedType comment" }), properties: [ createScalarPropertyDefinition({ name: "prop", type: "String", required: true }), @@ -361,7 +365,8 @@ export const typeInfo: TypeInfo = { }, { ...createObjectDefinition({ - type: "ArrayObject" + type: "ArrayObject", + comment: "ArrayObject comment" }), properties: [ createScalarPropertyDefinition({ name: "prop", type: "String", required: true }), @@ -449,7 +454,7 @@ export const typeInfo: TypeInfo = { properties: [ createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false, comment: "anotherProp comment" }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "uint8 comment" }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] @@ -481,7 +486,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "Query", - type: "Namespace_Query" + type: "Namespace_Query", + comment: "Query comment" }), methods: [ { @@ -536,6 +542,7 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "query", name: "method2", + comment: "method2 comment", return: createArrayPropertyDefinition({ name: "method2", type: "[Int64]", @@ -552,6 +559,7 @@ export const typeInfo: TypeInfo = { name: "arg", required: true, type: "[String]", + comment: "arg comment", item: createScalarDefinition({ name: "arg", required: true, @@ -567,13 +575,15 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "Query", - type: "Interface_Query" + type: "Interface_Query", + comment: "Query comment" }), methods: [ { ...createMethodDefinition({ type: "query", name: "abstractQueryMethod", + comment: "abstractQueryMethod comment", return: createObjectPropertyDefinition({ name: "abstractQueryMethod", type: "Interface_InterfaceObject2", @@ -584,7 +594,8 @@ export const typeInfo: TypeInfo = { createObjectPropertyDefinition({ name: "arg", required: true, - type: "Interface_QueryInterfaceArgument" + type: "Interface_QueryInterfaceArgument", + comment: "arg comment" }), ] }, @@ -595,7 +606,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "Mutation", - type: "Namespace_Mutation" + type: "Namespace_Mutation", + comment: "Mutation comment" }), methods: [ { @@ -775,7 +787,8 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "Mutation", - type: "Interface_Mutation" + type: "Interface_Mutation", + comment: "Mutation comment" }), methods: [ { @@ -805,7 +818,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "CustomType", - type: "Namespace_CustomType" + type: "Namespace_CustomType", + comment: "CustomType comment" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), @@ -968,7 +982,8 @@ export const typeInfo: TypeInfo = { createEnumPropertyDefinition({ name: "optImportedEnum", type: "Namespace_Imported_Enum", - required: false + required: false, + comment: "optImportedEnum comment" }), ] }, @@ -995,7 +1010,8 @@ export const typeInfo: TypeInfo = { uri: "test.eth", namespace: "Namespace", nativeType: "Imported_NestedObjectType", - type: "Namespace_Imported_NestedObjectType" + type: "Namespace_Imported_NestedObjectType", + comment: "Imported_NestedObjectType comment" }), properties: [createObjectPropertyDefinition({ name: "nestedObject", type: "Namespace_Imported_ObjectType", required: true })], }, @@ -1013,14 +1029,15 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "QueryInterfaceArgument", - type: "Interface_QueryInterfaceArgument" + type: "Interface_QueryInterfaceArgument", + comment: "QueryInterfaceArgument comment" }), interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_NestedQueryInterfaceArgument" }) ], properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true , comment: "uint8 comment"}), ] }, { @@ -1028,7 +1045,8 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "NestedQueryInterfaceArgument", - type: "Interface_NestedQueryInterfaceArgument" + type: "Interface_NestedQueryInterfaceArgument", + comment: "NestedQueryInterfaceArgument comment" }), properties: [ createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), @@ -1039,7 +1057,8 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "InterfaceObject2", - type: "Interface_InterfaceObject2" + type: "Interface_InterfaceObject2", + comment: "InterfaceObject2 comment" }), interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_NestedInterfaceObject" }) @@ -1054,7 +1073,8 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "Object", - type: "Interface_Object" + type: "Interface_Object", + comment: "Object comment" }), properties: [ createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), @@ -1065,10 +1085,11 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "NestedInterfaceObject", - type: "Interface_NestedInterfaceObject" + type: "Interface_NestedInterfaceObject", + comment: "NestedInterfaceObject comment" }), properties: [ - createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), + createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false, comment: "object comment" }), ] }, { @@ -1076,11 +1097,12 @@ export const typeInfo: TypeInfo = { uri: "interface.eth", namespace: "Interface", nativeType: "InterfaceObject1", - type: "Interface_InterfaceObject1" + type: "Interface_InterfaceObject1", + comment: "InterfaceObject1 comment" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "uint8 comment"}), ] }, ], @@ -1106,7 +1128,8 @@ export const typeInfo: TypeInfo = { constants: [ "STRING", "BYTES" - ] + ], + comment: "Imported_Enum comment" }) } ], From ddee7505ec694559869462e73e314bce36d686ae Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 25 Jun 2021 16:18:27 +0200 Subject: [PATCH 086/112] lint fix --- packages/schema/parse/src/extract/enum-types.ts | 2 +- .../schema/parse/src/extract/imported-enum-types.ts | 2 +- .../parse/src/extract/imported-object-types.ts | 2 +- .../schema/parse/src/extract/imported-query-types.ts | 4 ++-- .../schema/parse/src/extract/object-types-utils.ts | 2 +- packages/schema/parse/src/extract/object-types.ts | 2 +- .../schema/parse/src/extract/query-types-utils.ts | 2 +- packages/schema/parse/src/extract/query-types.ts | 6 +++--- packages/schema/parse/src/typeInfo/definitions.ts | 8 ++++---- packages/schema/parse/src/validate/directives.ts | 12 ++++++++++-- 10 files changed, 25 insertions(+), 17 deletions(-) diff --git a/packages/schema/parse/src/extract/enum-types.ts b/packages/schema/parse/src/extract/enum-types.ts index f584bc0944..da2a9401e4 100644 --- a/packages/schema/parse/src/extract/enum-types.ts +++ b/packages/schema/parse/src/extract/enum-types.ts @@ -24,7 +24,7 @@ const visitorEnter = (enumTypes: EnumDefinition[]) => ({ const enumType = createEnumDefinition({ type: node.name.value, constants, - comment: node.description?.value + comment: node.description?.value, }); enumTypes.push(enumType); }, diff --git a/packages/schema/parse/src/extract/imported-enum-types.ts b/packages/schema/parse/src/extract/imported-enum-types.ts index 0003f223e8..25e827dabf 100644 --- a/packages/schema/parse/src/extract/imported-enum-types.ts +++ b/packages/schema/parse/src/extract/imported-enum-types.ts @@ -28,7 +28,7 @@ const visitorEnter = (importedEnumTypes: ImportedEnumDefinition[]) => ({ uri: imported.uri, namespace: imported.namespace, nativeType: imported.nativeType, - comment: node.description?.value + comment: node.description?.value, }); importedEnumTypes.push(enumType); }, diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index 079b8ee7fc..b3238bddad 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -42,7 +42,7 @@ const visitorEnter = ( interfaces: node.interfaces?.map((x) => createInterfaceImplementedDefinition({ type: x.name.value }) ), - comment: node.description?.value + comment: node.description?.value, }); importedObjectTypes.push(importedType); state.currentType = importedType; diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index 1138c7a8d2..433dd2c47e 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -45,7 +45,7 @@ const visitorEnter = ( interfaces: node.interfaces?.map((x) => createInterfaceImplementedDefinition({ type: x.name.value }) ), - comment: node.description?.value + comment: node.description?.value, }); importedQueryTypes.push(importedType); state.currentImport = importedType; @@ -72,7 +72,7 @@ const visitorEnter = ( type: importDef.nativeType, name: node.name.value, return: returnType, - comment: node.description?.value + comment: node.description?.value, }); importDef.methods.push(method); state.currentMethod = method; diff --git a/packages/schema/parse/src/extract/object-types-utils.ts b/packages/schema/parse/src/extract/object-types-utils.ts index 4b62522258..b096cd661b 100644 --- a/packages/schema/parse/src/extract/object-types-utils.ts +++ b/packages/schema/parse/src/extract/object-types-utils.ts @@ -34,7 +34,7 @@ export function extractFieldDefinition( const property = createPropertyDefinition({ type: "N/A", name: node.name.value, - comment: node.description?.value + comment: node.description?.value, }); state.currentProperty = property; diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index 2a0b442268..baea01b14a 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -49,7 +49,7 @@ const visitorEnter = ( interfaces: node.interfaces?.map((x) => createInterfaceImplementedDefinition({ type: x.name.value }) ), - comment: node.description?.value + comment: node.description?.value, }); objectTypes.push(type); state.currentType = type; diff --git a/packages/schema/parse/src/extract/query-types-utils.ts b/packages/schema/parse/src/extract/query-types-utils.ts index 915ed8ae5e..66949551b3 100644 --- a/packages/schema/parse/src/extract/query-types-utils.ts +++ b/packages/schema/parse/src/extract/query-types-utils.ts @@ -131,7 +131,7 @@ export function extractInputValueDefinition( const argument = createPropertyDefinition({ type: "N/A", name: node.name.value, - comment: node.description?.value + comment: node.description?.value, }); method.arguments.push(argument); state.currentArgument = argument; diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index 08a83c5bf5..60f166ce98 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -47,7 +47,7 @@ const visitorEnter = ( interfaces: node.interfaces?.map((x) => createInterfaceImplementedDefinition({ type: x.name.value }) ), - comment: node.description?.value + comment: node.description?.value, }); queryTypes.push(query); state.currentQuery = query; @@ -61,14 +61,14 @@ const visitorEnter = ( const returnType = createPropertyDefinition({ type: "N/A", - name: node.name.value + name: node.name.value, }); const method = createMethodDefinition({ type: query.type, name: node.name.value, return: returnType, - comment: node.description?.value + comment: node.description?.value, }); query.methods.push(method); state.currentMethod = method; diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index fa64d92746..fc84d81293 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -206,7 +206,7 @@ export function createArrayPropertyDefinition(args: { ...args, array: { ...createArrayDefinition(args), - comment: undefined + comment: undefined, }, }); } @@ -221,7 +221,7 @@ export function createScalarPropertyDefinition(args: { ...args, scalar: { ...createScalarDefinition(args), - comment: undefined + comment: undefined, }, }); } @@ -237,7 +237,7 @@ export function createEnumPropertyDefinition(args: { ...args, enum: { ...createEnumDefinition(args), - comment: undefined + comment: undefined, }, }); } @@ -253,7 +253,7 @@ export function createObjectPropertyDefinition(args: { ...args, object: { ...createObjectDefinition(args), - comment: undefined + comment: undefined, }, }); } diff --git a/packages/schema/parse/src/validate/directives.ts b/packages/schema/parse/src/validate/directives.ts index e0f79d01e4..f338b82486 100644 --- a/packages/schema/parse/src/validate/directives.ts +++ b/packages/schema/parse/src/validate/directives.ts @@ -130,7 +130,11 @@ export const getImportsDirectiveValidator = (): SchemaValidator => { ObjectTypeDefinition(node as ObjectTypeDefinitionNode); } else if (node.kind === "Directive") { Directive(node as DirectiveNode, key, parent, path); - } else if (node.kind !== "NamedType" && node.kind !== "Name" && node.kind !== "StringValue") { + } else if ( + node.kind !== "NamedType" && + node.kind !== "Name" && + node.kind !== "StringValue" + ) { isInsideObjectTypeDefinition = false; } }, @@ -208,7 +212,11 @@ export const getImportedDirectiveValidator = (): SchemaValidator => { node.kind === "EnumTypeDefinition" ) { isInsideObjectOrEnumTypeDefinition = true; - } else if (node.kind !== "NamedType" && node.kind !== "Name" && node.kind !== "StringValue") { + } else if ( + node.kind !== "NamedType" && + node.kind !== "Name" && + node.kind !== "StringValue" + ) { isInsideObjectOrEnumTypeDefinition = false; } }, From cf232425aacbb0b09b5bf9010188c4337f038027 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 25 Jun 2021 17:42:44 +0200 Subject: [PATCH 087/112] more schema comments tests --- .../sanity/imports-ext/interface.eth/schema.graphql | 2 +- .../test-cases/cases/compose/sanity/input/mutation.graphql | 3 ++- .../cases/compose/sanity/output/mutation.graphql | 7 ++++--- .../test-cases/cases/compose/sanity/output/mutation.ts | 6 +++--- .../test-cases/cases/compose/sanity/output/schema.graphql | 7 ++++--- packages/test-cases/cases/compose/sanity/output/schema.ts | 6 +++--- packages/test-cases/cases/parse/sanity/input.graphql | 3 ++- packages/test-cases/cases/parse/sanity/output.ts | 2 +- 8 files changed, 20 insertions(+), 16 deletions(-) diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql index f4f0bfa1d3..5de2655256 100644 --- a/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/imports-ext/interface.eth/schema.graphql @@ -72,7 +72,7 @@ InterfaceObject1 comment type InterfaceObject1 { str: String! """ -uint8 comment +InterfaceObject1_uint8 comment """ uint8: UInt8! } diff --git a/packages/test-cases/cases/compose/sanity/input/mutation.graphql b/packages/test-cases/cases/compose/sanity/input/mutation.graphql index 09bf837a07..2977645326 100644 --- a/packages/test-cases/cases/compose/sanity/input/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/input/mutation.graphql @@ -36,7 +36,8 @@ implObject comment } """ -CustomMutationType comment +CustomMutationType multi-line comment +line 2 """ type CustomMutationType { """ diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index 670c6dd074..139c5666be 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -78,7 +78,8 @@ implObject comment } """ -CustomMutationType comment +CustomMutationType multi-line comment +line 2 """ type CustomMutationType { """ @@ -125,7 +126,7 @@ anotherProp comment anotherProp: String str: String! """ -uint8 comment +InterfaceObject1_uint8 comment """ uint8: UInt8! str2: String! @@ -345,7 +346,7 @@ type Interface_InterfaceObject1 @imported( ) { str: String! """ -uint8 comment +InterfaceObject1_uint8 comment """ uint8: UInt8! } diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index 112c59cedb..49001563e1 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -145,7 +145,7 @@ export const typeInfo: TypeInfo = { ], objectTypes: [ { - ...createObjectDefinition({ type: "CustomMutationType", comment: "CustomMutationType comment" }), + ...createObjectDefinition({ type: "CustomMutationType", comment: "CustomMutationType multi-line comment\nline 2" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true, comment: "str comment" }), createScalarPropertyDefinition({ name: "optStr", type: "String", required: false, comment: "optStr comment" }), @@ -226,7 +226,7 @@ export const typeInfo: TypeInfo = { properties: [ createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false, comment: "anotherProp comment" }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "uint8 comment" }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "InterfaceObject1_uint8 comment" }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] @@ -816,7 +816,7 @@ export const typeInfo: TypeInfo = { }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "uint8 comment" }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "InterfaceObject1_uint8 comment" }), ] }, { diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index ac92adadc0..ac1cc99d8b 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -185,7 +185,8 @@ type ArrayObject { } """ -CustomMutationType comment +CustomMutationType multi-line comment +line 2 """ type CustomMutationType { """ @@ -232,7 +233,7 @@ anotherProp comment anotherProp: String str: String! """ -uint8 comment +InterfaceObject1_uint8 comment """ uint8: UInt8! str2: String! @@ -508,7 +509,7 @@ type Interface_InterfaceObject1 @imported( ) { str: String! """ -uint8 comment +InterfaceObject1_uint8 comment """ uint8: UInt8! } diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index 664594922e..a4889871d5 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -373,7 +373,7 @@ export const typeInfo: TypeInfo = { ], }, { - ...createObjectDefinition({ type: "CustomMutationType", comment: "CustomMutationType comment" }), + ...createObjectDefinition({ type: "CustomMutationType", comment: "CustomMutationType multi-line comment\nline 2" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true, comment: "str comment" }), createScalarPropertyDefinition({ name: "optStr", type: "String", required: false, comment: "optStr comment" }), @@ -454,7 +454,7 @@ export const typeInfo: TypeInfo = { properties: [ createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false, comment: "anotherProp comment" }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "uint8 comment" }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "InterfaceObject1_uint8 comment" }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] @@ -1102,7 +1102,7 @@ export const typeInfo: TypeInfo = { }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "uint8 comment"}), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "InterfaceObject1_uint8 comment"}), ] }, ], diff --git a/packages/test-cases/cases/parse/sanity/input.graphql b/packages/test-cases/cases/parse/sanity/input.graphql index c4377427ab..bb73a3c73d 100644 --- a/packages/test-cases/cases/parse/sanity/input.graphql +++ b/packages/test-cases/cases/parse/sanity/input.graphql @@ -30,7 +30,8 @@ enum CustomEnum { } """ -CustomType comment +CustomType multi-line comment +line 2 """ type CustomType { """ diff --git a/packages/test-cases/cases/parse/sanity/output.ts b/packages/test-cases/cases/parse/sanity/output.ts index 53e6132155..e20e3d1f73 100644 --- a/packages/test-cases/cases/parse/sanity/output.ts +++ b/packages/test-cases/cases/parse/sanity/output.ts @@ -19,7 +19,7 @@ import { export const output: TypeInfo = { objectTypes: [ { - ...createObjectDefinition({ type: "CustomType", comment: "CustomType comment" }), + ...createObjectDefinition({ type: "CustomType", comment: "CustomType multi-line comment\nline 2" }), properties: [ createScalarPropertyDefinition({ name: "str", type: "String", required: true, comment: "str comment" }), createScalarPropertyDefinition({ name: "optStr", type: "String", required: false, comment: "optStr comment" }), From 00dfb17360e4272c5186d1f24401ad2d8f38d79b Mon Sep 17 00:00:00 2001 From: krisbitney Date: Tue, 29 Jun 2021 11:47:51 -0500 Subject: [PATCH 088/112] made config optional in ext schema --- .../lib/build-envs/wasm/assemblyscript/web3api.build.ext.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/cli/src/lib/build-envs/wasm/assemblyscript/web3api.build.ext.json b/packages/cli/src/lib/build-envs/wasm/assemblyscript/web3api.build.ext.json index 92d6f6fc61..c6d2aa39f1 100644 --- a/packages/cli/src/lib/build-envs/wasm/assemblyscript/web3api.build.ext.json +++ b/packages/cli/src/lib/build-envs/wasm/assemblyscript/web3api.build.ext.json @@ -1,9 +1,7 @@ { "id": "BuildManifest_WasmAsExt", "type": "object", - "required": [ - "config" - ], + "required": [], "properties": { "config": { "type": "object", From 46d5aac1460a31c56e7adc60fda199a01e95e454 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 30 Jun 2021 19:34:26 +0200 Subject: [PATCH 089/112] removed blackboard, using typeInfo now --- packages/schema/compose/src/resolve.ts | 34 ++----- .../src/extract/imported-object-types.ts | 7 +- .../parse/src/extract/imported-query-types.ts | 7 +- packages/schema/parse/src/extract/index.ts | 2 - .../parse/src/extract/object-types-utils.ts | 5 +- .../schema/parse/src/extract/object-types.ts | 7 +- .../parse/src/extract/property-utils.ts | 38 ++------ .../parse/src/extract/query-types-utils.ts | 8 +- .../schema/parse/src/extract/query-types.ts | 7 +- packages/schema/parse/src/index.ts | 11 +-- .../src/transform/finalizePropertyDef.ts | 90 ++++++++++++++++--- .../schema/parse/src/typeInfo/definitions.ts | 19 ++++ 12 files changed, 123 insertions(+), 112 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 0f556fe783..7bcd9d22df 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -24,8 +24,6 @@ import { visitQueryDefinition, ImportedQueryDefinition, DefinitionKind, - PropertyDefinition, - populatePropertyType, visitImportedQueryDefinition, visitImportedObjectDefinition, ImportedEnumDefinition, @@ -217,13 +215,7 @@ const extractObjectImportDependencies = ( rootTypeInfo, namespace, uri - ), - leave: { - PropertyDefinition: (def: PropertyDefinition) => { - populatePropertyType(def); - return def; - }, - }, + ) }); } @@ -260,13 +252,7 @@ const extractObjectImportDependencies = ( rootTypeInfo, namespace, uri - ), - leave: { - PropertyDefinition: (def: PropertyDefinition) => { - populatePropertyType(def); - return def; - }, - }, + ) }); } @@ -298,7 +284,7 @@ const extractObjectImportDependencies = ( }; }; -const namespaceTypes = (namespace: string): TypeInfoTransforms => ({ +const namespaceTypes = (namespace: string, typeInfo: TypeInfo): TypeInfoTransforms => ({ enter: { ObjectDefinition: (def: ObjectDefinition & Namespaced) => { if (def.__namespaced) { @@ -335,13 +321,7 @@ const namespaceTypes = (namespace: string): TypeInfoTransforms => ({ __namespaced: true, }; }, - }, - leave: { - PropertyDefinition: (def: PropertyDefinition) => { - populatePropertyType(def); - return def; - }, - }, + } }); function appendNamespace(namespace: string, str: string) { @@ -605,7 +585,7 @@ async function resolveExternalImports( const importDef = importType as ImportedObjectDefinition; // Namespace all object types typeInfo.importedObjectTypes.push( - visitImportedObjectDefinition(importDef, namespaceTypes(namespace)) + visitImportedObjectDefinition(importDef, namespaceTypes(namespace, typeInfo)) ); }; } else if (importType.kind === DefinitionKind.ImportedQuery) { @@ -614,7 +594,7 @@ async function resolveExternalImports( const importDef = importType as ImportedQueryDefinition; // Namespace all object types typeInfo.importedQueryTypes.push( - visitImportedQueryDefinition(importDef, namespaceTypes(namespace)) + visitImportedQueryDefinition(importDef, namespaceTypes(namespace, typeInfo)) ); }; } else if (importType.kind === DefinitionKind.ImportedEnum) { @@ -623,7 +603,7 @@ async function resolveExternalImports( typeInfo.importedEnumTypes.push( visitImportedEnumDefinition( importType as ImportedEnumDefinition, - namespaceTypes(namespace) + namespaceTypes(namespace, typeInfo) ) ); }; diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index b3238bddad..474538369d 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -11,7 +11,6 @@ import { State, } from "./object-types-utils"; import { extractImportedDefinition } from "./imported-types-utils"; -import { Blackboard } from "./Blackboard"; import { ObjectTypeDefinitionNode, @@ -25,7 +24,6 @@ import { const visitorEnter = ( importedObjectTypes: ImportedObjectDefinition[], state: State, - blackboard: Blackboard ) => ({ ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { const imported = extractImportedDefinition(node); @@ -51,7 +49,7 @@ const visitorEnter = ( state.nonNullType = true; }, NamedType: (node: NamedTypeNode) => { - extractNamedType(node, state, blackboard); + extractNamedType(node, state); }, ListType: (_node: ListTypeNode) => { extractListType(state); @@ -75,12 +73,11 @@ const visitorLeave = (state: State) => ({ export const getImportedObjectTypesVisitor = ( typeInfo: TypeInfo, - blackboard: Blackboard ): ASTVisitor => { const state: State = {}; return { - enter: visitorEnter(typeInfo.importedObjectTypes, state, blackboard), + enter: visitorEnter(typeInfo.importedObjectTypes, state), leave: visitorLeave(state), }; }; diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index 433dd2c47e..fbceb3c593 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -13,7 +13,6 @@ import { State, } from "./query-types-utils"; import { extractImportedDefinition } from "./imported-types-utils"; -import { Blackboard } from "./Blackboard"; import { ObjectTypeDefinitionNode, @@ -28,7 +27,6 @@ import { const visitorEnter = ( importedQueryTypes: ImportedQueryDefinition[], state: State, - blackboard: Blackboard ) => ({ ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { const imported = extractImportedDefinition(node, true); @@ -85,7 +83,7 @@ const visitorEnter = ( state.nonNullType = true; }, NamedType: (node: NamedTypeNode) => { - extractNamedType(node, state, blackboard); + extractNamedType(node, state); }, ListType: (_node: ListTypeNode) => { extractListType(state); @@ -110,12 +108,11 @@ const visitorLeave = (state: State) => ({ export const getImportedQueryTypesVisitor = ( typeInfo: TypeInfo, - blackboard: Blackboard ): ASTVisitor => { const state: State = {}; return { - enter: visitorEnter(typeInfo.importedQueryTypes, state, blackboard), + enter: visitorEnter(typeInfo.importedQueryTypes, state), leave: visitorLeave(state), }; }; diff --git a/packages/schema/parse/src/extract/index.ts b/packages/schema/parse/src/extract/index.ts index 83e66e3925..9bd385c46f 100644 --- a/packages/schema/parse/src/extract/index.ts +++ b/packages/schema/parse/src/extract/index.ts @@ -5,13 +5,11 @@ import { getQueryTypesVisitor } from "./query-types"; import { getImportedObjectTypesVisitor } from "./imported-object-types"; import { getImportedQueryTypesVisitor } from "./imported-query-types"; import { getImportedEnumTypesVisitor } from "./imported-enum-types"; -import { Blackboard } from "./Blackboard"; import { ASTVisitor } from "graphql"; export type SchemaExtractorBuilder = ( typeInfo: TypeInfo, - blackboard: Blackboard ) => ASTVisitor; export const extractors: SchemaExtractorBuilder[] = [ diff --git a/packages/schema/parse/src/extract/object-types-utils.ts b/packages/schema/parse/src/extract/object-types-utils.ts index b096cd661b..9703d1e275 100644 --- a/packages/schema/parse/src/extract/object-types-utils.ts +++ b/packages/schema/parse/src/extract/object-types-utils.ts @@ -5,7 +5,6 @@ import { PropertyDefinition, } from "../typeInfo"; import { setPropertyType } from "./property-utils"; -import { Blackboard } from "./Blackboard"; import { FieldDefinitionNode, NamedTypeNode } from "graphql"; @@ -44,7 +43,6 @@ export function extractFieldDefinition( export function extractNamedType( node: NamedTypeNode, state: State, - blackboard: Blackboard ): void { const property = state.currentProperty; @@ -73,8 +71,7 @@ export function extractNamedType( { type: node.name.value, required: state.nonNullType, - }, - blackboard + } ); state.nonNullType = false; diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index baea01b14a..3ab634c1dd 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -10,7 +10,6 @@ import { extractNamedType, State, } from "./object-types-utils"; -import { Blackboard } from "./Blackboard"; import { ObjectTypeDefinitionNode, @@ -25,7 +24,6 @@ import { const visitorEnter = ( objectTypes: ObjectDefinition[], state: State, - blackboard: Blackboard ) => ({ ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { // Skip non-custom types @@ -58,7 +56,7 @@ const visitorEnter = ( state.nonNullType = true; }, NamedType: (node: NamedTypeNode) => { - extractNamedType(node, state, blackboard); + extractNamedType(node, state); }, ListType: (_node: ListTypeNode) => { extractListType(state); @@ -82,12 +80,11 @@ const visitorLeave = (state: State) => ({ export const getObjectTypesVisitor = ( typeInfo: TypeInfo, - blackboard: Blackboard ): ASTVisitor => { const state: State = {}; return { - enter: visitorEnter(typeInfo.objectTypes, state, blackboard), + enter: visitorEnter(typeInfo.objectTypes, state), leave: visitorLeave(state), }; }; diff --git a/packages/schema/parse/src/extract/property-utils.ts b/packages/schema/parse/src/extract/property-utils.ts index fac41cc407..f28ec40b6d 100644 --- a/packages/schema/parse/src/extract/property-utils.ts +++ b/packages/schema/parse/src/extract/property-utils.ts @@ -1,17 +1,14 @@ import { - createEnumDefinition, - createObjectDefinition, createScalarDefinition, + createUnresolvedObjectOrEnumDefinition, isScalarType, PropertyDefinition, } from "../typeInfo"; -import { Blackboard } from "./Blackboard"; export function setPropertyType( property: PropertyDefinition, name: string, type: { type: string; required: boolean | undefined }, - blackboard: Blackboard ): void { if (isScalarType(type.type)) { property.scalar = createScalarDefinition({ @@ -22,32 +19,9 @@ export function setPropertyType( return; } - // The type is not a known scalar, check to see if it's - // apart of the custom types defined inside the schema (objects, enums) - const customTypes = blackboard.getCustomTypes(); - const idx = customTypes.findIndex( - (customType) => customType.name === type.type - ); - - if (idx === -1) { - throw new Error(`Unsupported type ${type.type}`); - } - - const customType = customTypes[idx]; - - if (customType.type === "enum") { - property.enum = createEnumDefinition({ - name: name, - type: type.type, - required: type.required, - }); - } else if (customType.type === "object") { - property.object = createObjectDefinition({ - name: name, - type: type.type, - required: type.required, - }); - } else { - throw new Error(`Unimplemented custom type ${customType}`); - } + property.unresolvedObjectOrEnum = createUnresolvedObjectOrEnumDefinition({ + name: name, + type: type.type, + required: type.required, + }); } diff --git a/packages/schema/parse/src/extract/query-types-utils.ts b/packages/schema/parse/src/extract/query-types-utils.ts index 66949551b3..d9821e1229 100644 --- a/packages/schema/parse/src/extract/query-types-utils.ts +++ b/packages/schema/parse/src/extract/query-types-utils.ts @@ -7,7 +7,6 @@ import { createArrayDefinition, } from "../typeInfo"; import { setPropertyType } from "./property-utils"; -import { Blackboard } from "./Blackboard"; import { InputValueDefinitionNode, NamedTypeNode } from "graphql"; @@ -23,7 +22,6 @@ export interface State { export function extractNamedType( node: NamedTypeNode, state: State, - blackboard: Blackboard ): void { const argument = state.currentArgument; const method = state.currentMethod; @@ -47,8 +45,7 @@ export function extractNamedType( { type: node.name.value, required: state.nonNullType, - }, - blackboard + } ); state.nonNullType = false; @@ -75,8 +72,7 @@ export function extractNamedType( { type: node.name.value, required: state.nonNullType, - }, - blackboard + } ); state.nonNullType = false; diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index 60f166ce98..df40e20653 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -12,7 +12,6 @@ import { extractNamedType, State, } from "./query-types-utils"; -import { Blackboard } from "./Blackboard"; import { ObjectTypeDefinitionNode, @@ -30,7 +29,6 @@ import { const visitorEnter = ( queryTypes: QueryDefinition[], state: State, - blackboard: Blackboard ) => ({ ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { const nodeName = node.name.value; @@ -81,7 +79,7 @@ const visitorEnter = ( state.nonNullType = true; }, NamedType: (node: NamedTypeNode) => { - extractNamedType(node, state, blackboard); + extractNamedType(node, state); }, ListType: (_node: ListTypeNode) => { extractListType(state); @@ -164,12 +162,11 @@ const visitorLeave = (state: State) => ({ export const getQueryTypesVisitor = ( typeInfo: TypeInfo, - blackboard: Blackboard ): ASTVisitor => { const state: State = {}; return { - enter: visitorEnter(typeInfo.queryTypes, state, blackboard), + enter: visitorEnter(typeInfo.queryTypes, state), leave: visitorLeave(state), }; }; diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index dbf47bb8e2..4a961f7265 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -3,7 +3,6 @@ import { extractors, SchemaExtractorBuilder } from "./extract"; import { TypeInfoTransforms, transformTypeInfo } from "./transform"; import { finalizePropertyDef } from "./transform/finalizePropertyDef"; import { SchemaValidatorBuilder, validators } from "./validate"; -import { Blackboard } from "./extract/Blackboard"; import { DocumentNode, parse, visit, visitInParallel } from "graphql"; @@ -30,17 +29,14 @@ export function parseSchema( validate(astNode, validates); } - // Create a blackboard for shared metadata - const blackboard = new Blackboard(astNode); - // Extract & Build TypeInfo let info = createTypeInfo(); const extracts = options.extractors || extractors; - extract(astNode, info, blackboard, extracts); + extract(astNode, info, extracts); // Finalize & Transform TypeInfo - info = transformTypeInfo(info, finalizePropertyDef); + info = transformTypeInfo(info, finalizePropertyDef(info)); if (options && options.transforms) { for (const transform of options.transforms) { @@ -73,11 +69,10 @@ const validate = ( const extract = ( astNode: DocumentNode, typeInfo: TypeInfo, - blackboard: Blackboard, extractors: SchemaExtractorBuilder[] ) => { const allVisitors = extractors.map((getVisitor) => - getVisitor(typeInfo, blackboard) + getVisitor(typeInfo) ); visit(astNode, visitInParallel(allVisitors)); diff --git a/packages/schema/parse/src/transform/finalizePropertyDef.ts b/packages/schema/parse/src/transform/finalizePropertyDef.ts index f638799cfd..12db44de90 100644 --- a/packages/schema/parse/src/transform/finalizePropertyDef.ts +++ b/packages/schema/parse/src/transform/finalizePropertyDef.ts @@ -1,25 +1,32 @@ import { TypeInfoTransforms } from "."; import { ArrayDefinition, + createEnumDefinition, + createObjectDefinition, GenericDefinition, PropertyDefinition, + TypeInfo, } from "../typeInfo"; -export const finalizePropertyDef: TypeInfoTransforms = { - enter: { - // eslint-disable-next-line @typescript-eslint/naming-convention - PropertyDefinition: (def: PropertyDefinition): PropertyDefinition => { - populatePropertyType(def); - return def; +export const finalizePropertyDef = (typeInfo: TypeInfo): TypeInfoTransforms => { + return { + enter: { + // eslint-disable-next-line @typescript-eslint/naming-convention + PropertyDefinition: (def: PropertyDefinition): PropertyDefinition => { + populatePropertyType(def, typeInfo); + return def; + }, }, - }, + }; }; -export function populatePropertyType(property: PropertyDefinition): void { +export function populatePropertyType(property: PropertyDefinition, typeInfo: TypeInfo): void { let propertyType: GenericDefinition | undefined; if (property.array) { - populateArrayType(property.array); + populateArrayType(property.array, typeInfo); propertyType = property.array; + } else if (property.unresolvedObjectOrEnum) { + propertyType = resolveObjectOrEnumKind(property, typeInfo); } else if (property.scalar) { propertyType = property.scalar; } else if (property.object) { @@ -29,23 +36,24 @@ export function populatePropertyType(property: PropertyDefinition): void { } else { throw Error("Property type is undefined, this should never happen."); } - + property.type = propertyType.type; property.required = propertyType.required; } -function populateArrayType(array: ArrayDefinition) { +function populateArrayType(array: ArrayDefinition, typeInfo: TypeInfo) { let baseTypeFound = false; let currentArray = array; while (!baseTypeFound) { if (currentArray.array) { currentArray = currentArray.array; - populateArrayType(currentArray); + populateArrayType(currentArray, typeInfo); } else if ( currentArray.scalar || currentArray.object || - currentArray.enum + currentArray.enum || + currentArray.unresolvedObjectOrEnum ) { baseTypeFound = true; } else { @@ -59,8 +67,11 @@ function populateArrayType(array: ArrayDefinition) { } } + if (array.array) { array.item = array.array; + } else if (array.unresolvedObjectOrEnum) { + array.item = resolveObjectOrEnumKind(array, typeInfo); } else if (array.scalar) { array.item = array.scalar; } else if (array.enum) { @@ -75,3 +86,56 @@ function populateArrayType(array: ArrayDefinition) { array.type = "[" + array.item.type + "]"; } + +function resolveObjectOrEnumKind(property: PropertyDefinition, typeInfo: TypeInfo): GenericDefinition { + if(!property.unresolvedObjectOrEnum) { + throw Error("Type reference is undefined, this should never happen."); + } + + // Check to see if the type is a part of the custom types defined inside the schema (objects, enums) + let customType: GenericDefinition | undefined = typeInfo.objectTypes.find( + (type) => type.type === property.unresolvedObjectOrEnum!.type + ); + + customType = customType + ? customType + : typeInfo.importedObjectTypes.find( + (type) => type.type === property.unresolvedObjectOrEnum!.type + ); + + if (!customType) { + customType = typeInfo.enumTypes.find( + (type) => type.type === property.unresolvedObjectOrEnum!.type + ); + + customType = customType + ? customType + : typeInfo.importedEnumTypes.find( + (type) => type.type === property.unresolvedObjectOrEnum!.type + ); + + if (!customType) { + throw new Error(`Unsupported type ${property.unresolvedObjectOrEnum.type}`); + } + + property.enum = createEnumDefinition({ + name: property.unresolvedObjectOrEnum.name, + required: property.unresolvedObjectOrEnum.required ?? undefined, + type: property.unresolvedObjectOrEnum.type + }); + + property.unresolvedObjectOrEnum = null; + + return property.enum; + } else { + property.object = createObjectDefinition({ + name: property.unresolvedObjectOrEnum.name, + required: property.unresolvedObjectOrEnum.required ?? undefined, + type: property.unresolvedObjectOrEnum.type + }); + + property.unresolvedObjectOrEnum = null; + + return property.object; + } +} diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index fc84d81293..e6d6f3f9d5 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -16,6 +16,7 @@ export enum DefinitionKind { ImportedEnum = 1 << 9, ImportedObject = (1 << 10) | DefinitionKind.Object, InterfaceImplemented = 1 << 11, + UnresolvedObjectOrEnum = 1 << 12 } export function isKind(type: GenericDefinition, kind: DefinitionKind): boolean { @@ -69,6 +70,7 @@ export interface AnyDefinition extends GenericDefinition { scalar: ScalarDefinition | null; object: ObjectDefinition | null; enum: EnumDefinition | null; + unresolvedObjectOrEnum: (ObjectDefinition & EnumDefinition) | null; } export function createAnyDefinition(args: { type: string; @@ -86,6 +88,7 @@ export function createAnyDefinition(args: { scalar: args.scalar ? args.scalar : null, object: args.object ? args.object : null, enum: args.enum ? args.enum : null, + unresolvedObjectOrEnum: null, kind: DefinitionKind.Any, }; } @@ -128,6 +131,22 @@ export function createEnumDefinition(args: { }; } +export function createUnresolvedObjectOrEnumDefinition(args: { + type: string; + name?: string | null; + required?: boolean; + comment?: string; +}): ObjectDefinition & EnumDefinition { + return { + ...createGenericDefinition(args), + type: args.type, + kind: DefinitionKind.UnresolvedObjectOrEnum, + constants: [], + properties: [], + interfaces: [] + }; +} + export interface ArrayDefinition extends AnyDefinition { item: GenericDefinition | null; } From 7ac950356ea419967a19c0d0bd9f5f11db4a6262 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Wed, 30 Jun 2021 12:40:40 -0500 Subject: [PATCH 090/112] minor add --- .../schema/parse/src/typeInfo/definitions.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index e6d6f3f9d5..f7593d5f8b 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -16,7 +16,8 @@ export enum DefinitionKind { ImportedEnum = 1 << 9, ImportedObject = (1 << 10) | DefinitionKind.Object, InterfaceImplemented = 1 << 11, - UnresolvedObjectOrEnum = 1 << 12 + UnresolvedObjectOrEnum = 1 << 12, + ObjectRef = 1 << 13, } export function isKind(type: GenericDefinition, kind: DefinitionKind): boolean { @@ -65,6 +66,19 @@ export function createObjectDefinition(args: { }; } +export interface ObjectDefinitionRef extends GenericDefinition { } +export function createObjectDefinitionRef(args: { + type: string; + name?: string | null; + required?: boolean; + comment?: string; +}): ObjectDefinitionRef { + return { + ...createGenericDefinition(args), + kind: DefinitionKind.ObjectRef, + }; +} + export interface AnyDefinition extends GenericDefinition { array: ArrayDefinition | null; scalar: ScalarDefinition | null; From e15737a5e4d6d40b0a6865f68a622e58c407e794 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 1 Jul 2021 17:38:00 +0200 Subject: [PATCH 091/112] inerfaceImplementedDefinition now inherits generic definition instead of any definition --- packages/schema/parse/src/typeInfo/definitions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index 62f5776732..3e8c2a85d4 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -172,7 +172,7 @@ export function createPropertyDefinition(args: { }; } -export type InterfaceImplementedDefinition = AnyDefinition; +export type InterfaceImplementedDefinition = GenericDefinition; export function createInterfaceImplementedDefinition(args: { type: string; }): InterfaceImplementedDefinition { From bab319f6ff9ae6b7f04f21f64cd98f3e59800216 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 1 Jul 2021 18:34:04 +0200 Subject: [PATCH 092/112] removed comment from generic definition and added a new WithComment type for other definitions to inherit --- .../schema/parse/src/typeInfo/definitions.ts | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index fc84d81293..e565cb6313 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -22,29 +22,29 @@ export function isKind(type: GenericDefinition, kind: DefinitionKind): boolean { return (type.kind & kind) === kind; } +export type WithComment = { + comment?: string; +} export interface GenericDefinition { type: string; name: string | null; required: boolean | null; - comment?: string; kind: DefinitionKind; } export function createGenericDefinition(args: { type: string; name?: string | null; required?: boolean; - comment?: string; }): GenericDefinition { return { type: args.type, name: args.name ? args.name : null, required: args.required ? args.required : null, - comment: args.comment, kind: DefinitionKind.Generic, }; } -export interface ObjectDefinition extends GenericDefinition { +export interface ObjectDefinition extends GenericDefinition, WithComment { properties: PropertyDefinition[]; interfaces: InterfaceImplementedDefinition[]; } @@ -60,6 +60,7 @@ export function createObjectDefinition(args: { ...createGenericDefinition(args), properties: args.properties ? args.properties : [], interfaces: args.interfaces ? args.interfaces : [], + comment: args.comment, kind: DefinitionKind.Object, }; } @@ -78,7 +79,6 @@ export function createAnyDefinition(args: { scalar?: ScalarDefinition; object?: ObjectDefinition; enum?: EnumDefinition; - comment?: string; }): AnyDefinition { return { ...createGenericDefinition(args), @@ -110,7 +110,7 @@ export function createScalarDefinition(args: { }; } -export interface EnumDefinition extends GenericDefinition { +export interface EnumDefinition extends GenericDefinition, WithComment { constants: string[]; } export function createEnumDefinition(args: { @@ -125,6 +125,7 @@ export function createEnumDefinition(args: { type: args.type, kind: DefinitionKind.Enum, constants: args.constants ? args.constants : [], + comment: args.comment }; } @@ -162,7 +163,7 @@ export function createArrayDefinition(args: { }; } -export type PropertyDefinition = AnyDefinition; +export type PropertyDefinition = AnyDefinition & WithComment; export function createPropertyDefinition(args: { type: string; name?: string | null; @@ -175,6 +176,7 @@ export function createPropertyDefinition(args: { }): PropertyDefinition { return { ...createAnyDefinition(args), + comment: args.comment, kind: DefinitionKind.Property, }; } @@ -204,10 +206,7 @@ export function createArrayPropertyDefinition(args: { }): PropertyDefinition { return createPropertyDefinition({ ...args, - array: { - ...createArrayDefinition(args), - comment: undefined, - }, + array: createArrayDefinition(args) }); } @@ -219,10 +218,7 @@ export function createScalarPropertyDefinition(args: { }): PropertyDefinition { return createPropertyDefinition({ ...args, - scalar: { - ...createScalarDefinition(args), - comment: undefined, - }, + scalar: createScalarDefinition(args) }); } @@ -237,8 +233,8 @@ export function createEnumPropertyDefinition(args: { ...args, enum: { ...createEnumDefinition(args), - comment: undefined, - }, + comment: undefined + } }); } @@ -253,12 +249,12 @@ export function createObjectPropertyDefinition(args: { ...args, object: { ...createObjectDefinition(args), - comment: undefined, - }, + comment: undefined + } }); } -export interface MethodDefinition extends GenericDefinition { +export interface MethodDefinition extends GenericDefinition, WithComment { type: OperationType; arguments: PropertyDefinition[]; return: PropertyDefinition; @@ -282,11 +278,12 @@ export function createMethodDefinition(args: { required: true, arguments: args.arguments ? args.arguments : [], return: args.return, + comment: args.comment, kind: DefinitionKind.Method, }; } -export interface QueryDefinition extends GenericDefinition { +export interface QueryDefinition extends GenericDefinition, WithComment { type: QueryType; methods: MethodDefinition[]; imports: { type: string }[]; @@ -311,6 +308,7 @@ export function createQueryDefinition(args: { methods: [], imports: args.imports ? args.imports : [], interfaces: args.interfaces ? args.interfaces : [], + comment: args.comment, kind: DefinitionKind.Query, }; } @@ -323,7 +321,7 @@ export interface ImportedDefinition { export interface ImportedEnumDefinition extends EnumDefinition, - ImportedDefinition {} + ImportedDefinition, WithComment {} export function createImportedEnumDefinition(args: { type: string; constants: string[]; @@ -339,13 +337,14 @@ export function createImportedEnumDefinition(args: { uri: args.uri, namespace: args.namespace, nativeType: args.nativeType, + comment: args.comment, kind: DefinitionKind.ImportedEnum, }; } export interface ImportedQueryDefinition extends GenericDefinition, - ImportedDefinition { + ImportedDefinition, WithComment { methods: MethodDefinition[]; } export function createImportedQueryDefinition(args: { @@ -369,13 +368,14 @@ export function createImportedQueryDefinition(args: { uri: args.uri, namespace: args.namespace, nativeType: args.nativeType, + comment: args.comment, kind: DefinitionKind.ImportedQuery, }; } export interface ImportedObjectDefinition extends ObjectDefinition, - ImportedDefinition {} + ImportedDefinition, WithComment {} export function createImportedObjectDefinition(args: { type: string; name?: string; @@ -391,6 +391,7 @@ export function createImportedObjectDefinition(args: { uri: args.uri, namespace: args.namespace, nativeType: args.nativeType, + comment: args.comment, kind: DefinitionKind.ImportedObject, }; } From ed7a877d0b90094f690f73a81df642eac42c6f37 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 1 Jul 2021 19:28:34 +0200 Subject: [PATCH 093/112] using objectRef and enumRef instead of definitions for reference types --- .../parse/src/extract/property-utils.ts | 4 +- .../src/transform/finalizePropertyDef.ts | 8 +-- packages/schema/parse/src/transform/index.ts | 36 +++++++++++- .../schema/parse/src/typeInfo/definitions.ts | 55 ++++++++++--------- .../compose/local-imports/output/mutation.ts | 5 +- .../compose/local-imports/output/query.ts | 5 +- .../compose/local-imports/output/schema.ts | 5 +- .../cases/compose/sanity/output/mutation.ts | 13 +++-- .../cases/compose/sanity/output/query.ts | 9 +-- .../cases/compose/sanity/output/schema.ts | 13 +++-- .../test-cases/cases/parse/sanity/output.ts | 16 +++--- 11 files changed, 106 insertions(+), 63 deletions(-) diff --git a/packages/schema/parse/src/extract/property-utils.ts b/packages/schema/parse/src/extract/property-utils.ts index f28ec40b6d..3cf51d47b5 100644 --- a/packages/schema/parse/src/extract/property-utils.ts +++ b/packages/schema/parse/src/extract/property-utils.ts @@ -1,6 +1,6 @@ import { createScalarDefinition, - createUnresolvedObjectOrEnumDefinition, + createUnresolvedObjectOrEnumRef, isScalarType, PropertyDefinition, } from "../typeInfo"; @@ -19,7 +19,7 @@ export function setPropertyType( return; } - property.unresolvedObjectOrEnum = createUnresolvedObjectOrEnumDefinition({ + property.unresolvedObjectOrEnum = createUnresolvedObjectOrEnumRef({ name: name, type: type.type, required: type.required, diff --git a/packages/schema/parse/src/transform/finalizePropertyDef.ts b/packages/schema/parse/src/transform/finalizePropertyDef.ts index 12db44de90..eb0cab36d8 100644 --- a/packages/schema/parse/src/transform/finalizePropertyDef.ts +++ b/packages/schema/parse/src/transform/finalizePropertyDef.ts @@ -1,8 +1,8 @@ import { TypeInfoTransforms } from "."; import { ArrayDefinition, - createEnumDefinition, - createObjectDefinition, + createEnumRef, + createObjectRef, GenericDefinition, PropertyDefinition, TypeInfo, @@ -118,7 +118,7 @@ function resolveObjectOrEnumKind(property: PropertyDefinition, typeInfo: TypeInf throw new Error(`Unsupported type ${property.unresolvedObjectOrEnum.type}`); } - property.enum = createEnumDefinition({ + property.enum = createEnumRef({ name: property.unresolvedObjectOrEnum.name, required: property.unresolvedObjectOrEnum.required ?? undefined, type: property.unresolvedObjectOrEnum.type @@ -128,7 +128,7 @@ function resolveObjectOrEnumKind(property: PropertyDefinition, typeInfo: TypeInf return property.enum; } else { - property.object = createObjectDefinition({ + property.object = createObjectRef({ name: property.unresolvedObjectOrEnum.name, required: property.unresolvedObjectOrEnum.required ?? undefined, type: property.unresolvedObjectOrEnum.type diff --git a/packages/schema/parse/src/transform/index.ts b/packages/schema/parse/src/transform/index.ts index ca555bc337..7d7b7cf5d1 100644 --- a/packages/schema/parse/src/transform/index.ts +++ b/packages/schema/parse/src/transform/index.ts @@ -17,6 +17,8 @@ import { EnumDefinition, ImportedEnumDefinition, InterfaceImplementedDefinition, + EnumRef, + ObjectRef, } from "../typeInfo"; export * from "./finalizePropertyDef"; @@ -33,9 +35,11 @@ export interface TypeInfoTransformer { TypeInfo?: (typeInfo: TypeInfo) => TypeInfo; GenericDefinition?: (def: GenericDefinition) => GenericDefinition; ObjectDefinition?: (def: ObjectDefinition) => ObjectDefinition; + ObjectRef?: (def: ObjectRef) => ObjectRef; AnyDefinition?: (def: AnyDefinition) => AnyDefinition; ScalarDefinition?: (def: ScalarDefinition) => ScalarDefinition; EnumDefinition?: (def: EnumDefinition) => EnumDefinition; + EnumRef?: (def: EnumRef) => EnumRef; PropertyDefinition?: (def: PropertyDefinition) => PropertyDefinition; ArrayDefinition?: (def: ArrayDefinition) => ArrayDefinition; MethodDefinition?: (def: MethodDefinition) => MethodDefinition; @@ -134,6 +138,17 @@ export function visitObjectDefinition( return transformType(result, transforms.leave); } + +export function visitObjectRef( + def: ObjectRef, + transforms: TypeInfoTransforms +): ObjectRef { + let result = Object.assign({}, def); + result = transformType(result, transforms.enter); + + return transformType(result, transforms.leave); +} + export function visitInterfaceImplementedDefinition( def: InterfaceImplementedDefinition, transforms: TypeInfoTransforms @@ -160,11 +175,11 @@ export function visitAnyDefinition( } if (result.object) { - result.object = visitObjectDefinition(result.object, transforms); + result.object = visitObjectRef(result.object, transforms); } if (result.enum) { - result.enum = visitEnumDefinition(result.enum, transforms); + result.enum = visitEnumRef(result.enum, transforms); } return result; @@ -188,6 +203,15 @@ export function visitEnumDefinition( return transformType(result, transforms.leave); } +export function visitEnumRef( + def: EnumRef, + transforms: TypeInfoTransforms +): EnumRef { + let result = Object.assign({}, def); + result = transformType(result, transforms.enter); + return transformType(result, transforms.leave); +} + export function visitArrayDefinition( def: ArrayDefinition, transforms: TypeInfoTransforms @@ -292,9 +316,11 @@ export function transformType( const { GenericDefinition, ObjectDefinition, + ObjectRef, AnyDefinition, ScalarDefinition, EnumDefinition, + EnumRef, ArrayDefinition, PropertyDefinition, MethodDefinition, @@ -311,6 +337,9 @@ export function transformType( if (ObjectDefinition && isKind(result, DefinitionKind.Object)) { result = Object.assign(result, ObjectDefinition(result as any)); } + if (ObjectRef && isKind(result, DefinitionKind.ObjectRef)) { + result = Object.assign(result, ObjectRef(result as any)); + } if (AnyDefinition && isKind(result, DefinitionKind.Any)) { result = Object.assign(result, AnyDefinition(result as any)); } @@ -320,6 +349,9 @@ export function transformType( if (EnumDefinition && isKind(result, DefinitionKind.Enum)) { result = Object.assign(result, EnumDefinition(result as any)); } + if (EnumRef && isKind(result, DefinitionKind.EnumRef)) { + result = Object.assign(result, EnumRef(result as any)); + } if (ArrayDefinition && isKind(result, DefinitionKind.Array)) { result = Object.assign(result, ArrayDefinition(result as any)); } diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index f7593d5f8b..2f87fdbdad 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -18,6 +18,7 @@ export enum DefinitionKind { InterfaceImplemented = 1 << 11, UnresolvedObjectOrEnum = 1 << 12, ObjectRef = 1 << 13, + EnumRef = 1 << 14, } export function isKind(type: GenericDefinition, kind: DefinitionKind): boolean { @@ -66,13 +67,12 @@ export function createObjectDefinition(args: { }; } -export interface ObjectDefinitionRef extends GenericDefinition { } -export function createObjectDefinitionRef(args: { +export interface ObjectRef extends GenericDefinition { } +export function createObjectRef(args: { type: string; name?: string | null; required?: boolean; - comment?: string; -}): ObjectDefinitionRef { +}): ObjectRef { return { ...createGenericDefinition(args), kind: DefinitionKind.ObjectRef, @@ -82,9 +82,9 @@ export function createObjectDefinitionRef(args: { export interface AnyDefinition extends GenericDefinition { array: ArrayDefinition | null; scalar: ScalarDefinition | null; - object: ObjectDefinition | null; - enum: EnumDefinition | null; - unresolvedObjectOrEnum: (ObjectDefinition & EnumDefinition) | null; + object: ObjectRef | null; + enum: EnumRef | null; + unresolvedObjectOrEnum: UnresolvedObjectOrEnumRef | null; } export function createAnyDefinition(args: { type: string; @@ -92,8 +92,8 @@ export function createAnyDefinition(args: { required?: boolean; array?: ArrayDefinition; scalar?: ScalarDefinition; - object?: ObjectDefinition; - enum?: EnumDefinition; + object?: ObjectRef; + enum?: EnumRef; comment?: string; }): AnyDefinition { return { @@ -145,19 +145,28 @@ export function createEnumDefinition(args: { }; } -export function createUnresolvedObjectOrEnumDefinition(args: { +export interface EnumRef extends GenericDefinition { } +export function createEnumRef(args: { type: string; name?: string | null; required?: boolean; - comment?: string; -}): ObjectDefinition & EnumDefinition { +}): EnumRef { + return { + ...createGenericDefinition(args), + kind: DefinitionKind.EnumRef, + }; +} + +export interface UnresolvedObjectOrEnumRef extends GenericDefinition { } +export function createUnresolvedObjectOrEnumRef(args: { + type: string; + name?: string | null; + required?: boolean; +}): UnresolvedObjectOrEnumRef { return { ...createGenericDefinition(args), type: args.type, - kind: DefinitionKind.UnresolvedObjectOrEnum, - constants: [], - properties: [], - interfaces: [] + kind: DefinitionKind.UnresolvedObjectOrEnum }; } @@ -202,8 +211,8 @@ export function createPropertyDefinition(args: { required?: boolean; array?: ArrayDefinition; scalar?: ScalarDefinition; - object?: ObjectDefinition; - enum?: EnumDefinition; + object?: ObjectRef; + enum?: EnumRef; comment?: string; }): PropertyDefinition { return { @@ -268,10 +277,7 @@ export function createEnumPropertyDefinition(args: { }): PropertyDefinition { return createPropertyDefinition({ ...args, - enum: { - ...createEnumDefinition(args), - comment: undefined, - }, + enum: createEnumRef(args) }); } @@ -284,10 +290,7 @@ export function createObjectPropertyDefinition(args: { }): PropertyDefinition { return createPropertyDefinition({ ...args, - object: { - ...createObjectDefinition(args), - comment: undefined, - }, + object: createObjectRef(args) }); } diff --git a/packages/test-cases/cases/compose/local-imports/output/mutation.ts b/packages/test-cases/cases/compose/local-imports/output/mutation.ts index 54bbb333db..c81ff723f3 100644 --- a/packages/test-cases/cases/compose/local-imports/output/mutation.ts +++ b/packages/test-cases/cases/compose/local-imports/output/mutation.ts @@ -9,7 +9,8 @@ import { createObjectDefinition, createEnumDefinition, TypeInfo, - createEnumPropertyDefinition + createEnumPropertyDefinition, + createObjectRef } from "@web3api/schema-parse"; export const typeInfo: TypeInfo = { @@ -171,7 +172,7 @@ export const typeInfo: TypeInfo = { name: "objectArray", type: "[ArrayObject]", required: false, - item: createObjectDefinition({ + item: createObjectRef({ name: "objectArray", type: "ArrayObject", required: false diff --git a/packages/test-cases/cases/compose/local-imports/output/query.ts b/packages/test-cases/cases/compose/local-imports/output/query.ts index 99bd8d4e1e..d183beca43 100644 --- a/packages/test-cases/cases/compose/local-imports/output/query.ts +++ b/packages/test-cases/cases/compose/local-imports/output/query.ts @@ -9,7 +9,8 @@ import { createObjectDefinition, createEnumDefinition, TypeInfo, - createEnumPropertyDefinition + createEnumPropertyDefinition, + createObjectRef } from "@web3api/schema-parse"; export const typeInfo: TypeInfo = { @@ -90,7 +91,7 @@ export const typeInfo: TypeInfo = { name: "objectArray", type: "[ArrayObject]", required: false, - item: createObjectDefinition({ + item: createObjectRef({ name: "objectArray", type: "ArrayObject", required: false diff --git a/packages/test-cases/cases/compose/local-imports/output/schema.ts b/packages/test-cases/cases/compose/local-imports/output/schema.ts index 4010fda75c..fa1be8df32 100644 --- a/packages/test-cases/cases/compose/local-imports/output/schema.ts +++ b/packages/test-cases/cases/compose/local-imports/output/schema.ts @@ -9,7 +9,8 @@ import { createObjectDefinition, createEnumDefinition, TypeInfo, - createEnumPropertyDefinition + createEnumPropertyDefinition, + createObjectRef } from "@web3api/schema-parse"; export const typeInfo: TypeInfo = { @@ -247,7 +248,7 @@ export const typeInfo: TypeInfo = { name: "objectArray", type: "[ArrayObject]", required: false, - item: createObjectDefinition({ + item: createObjectRef({ name: "objectArray", type: "ArrayObject", required: false diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index 49001563e1..19ac6cdfd4 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -12,7 +12,8 @@ import { createImportedQueryDefinition, createImportedObjectDefinition, createImportedEnumDefinition, - createInterfaceImplementedDefinition + createInterfaceImplementedDefinition, + createObjectRef } from "@web3api/schema-parse"; export const typeInfo: TypeInfo = { @@ -265,7 +266,7 @@ export const typeInfo: TypeInfo = { name: "objectArray", type: "[ArrayObject]", required: false, - item: createObjectDefinition({ + item: createObjectRef({ name: "objectArray", type: "ArrayObject", required: false @@ -488,7 +489,7 @@ export const typeInfo: TypeInfo = { name: "localObjectArray", required: false, type: "[Namespace_NestedObjectType]", - item: createObjectDefinition({ + item: createObjectRef({ name: "localObjectArray", required: true, type: "Namespace_NestedObjectType" @@ -516,7 +517,7 @@ export const typeInfo: TypeInfo = { name: "localObjectArray", required: false, type: "[Namespace_Imported_NestedObjectType]", - item: createObjectDefinition({ + item: createObjectRef({ name: "localObjectArray", required: true, type: "Namespace_Imported_NestedObjectType" @@ -762,7 +763,7 @@ export const typeInfo: TypeInfo = { name: "optNestedObjectArray", type: "[Namespace_NestedObjectType]", required: true, - item: createObjectDefinition({ + item: createObjectRef({ name: "optNestedObjectArray", type: "Namespace_NestedObjectType", required: false @@ -777,7 +778,7 @@ export const typeInfo: TypeInfo = { name: "optImportedNestedObjectArray", type: "[Namespace_Imported_NestedObjectType]", required: true, - item: createObjectDefinition({ + item: createObjectRef({ name: "optImportedNestedObjectArray", type: "Namespace_Imported_NestedObjectType", required: false diff --git a/packages/test-cases/cases/compose/sanity/output/query.ts b/packages/test-cases/cases/compose/sanity/output/query.ts index 07f93a29d1..41a4812dfe 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.ts +++ b/packages/test-cases/cases/compose/sanity/output/query.ts @@ -12,7 +12,8 @@ import { createImportedQueryDefinition, createImportedObjectDefinition, createImportedEnumDefinition, - createInterfaceImplementedDefinition + createInterfaceImplementedDefinition, + createObjectRef } from "@web3api/schema-parse"; export const typeInfo: TypeInfo = { @@ -100,7 +101,7 @@ export const typeInfo: TypeInfo = { name: "objectArray", type: "[ArrayObject]", required: false, - item: createObjectDefinition({ + item: createObjectRef({ name: "objectArray", type: "ArrayObject", required: false @@ -380,7 +381,7 @@ export const typeInfo: TypeInfo = { name: "optNestedObjectArray", type: "[Namespace_NestedObjectType]", required: true, - item: createObjectDefinition({ + item: createObjectRef({ name: "optNestedObjectArray", type: "Namespace_NestedObjectType", required: false @@ -395,7 +396,7 @@ export const typeInfo: TypeInfo = { name: "optImportedNestedObjectArray", type: "[Namespace_Imported_NestedObjectType]", required: true, - item: createObjectDefinition({ + item: createObjectRef({ name: "optImportedNestedObjectArray", type: "Namespace_Imported_NestedObjectType", required: false diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index a4889871d5..9f0ad5edb0 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -12,7 +12,8 @@ import { createImportedQueryDefinition, createImportedObjectDefinition, createImportedEnumDefinition, - createInterfaceImplementedDefinition + createInterfaceImplementedDefinition, + createObjectRef } from "@web3api/schema-parse"; export const typeInfo: TypeInfo = { @@ -345,7 +346,7 @@ export const typeInfo: TypeInfo = { name: "objectArray", type: "[ArrayObject]", required: false, - item: createObjectDefinition({ + item: createObjectRef({ name: "objectArray", type: "ArrayObject", required: false @@ -706,7 +707,7 @@ export const typeInfo: TypeInfo = { name: "localObjectArray", required: false, type: "[Namespace_NestedObjectType]", - item: createObjectDefinition({ + item: createObjectRef({ name: "localObjectArray", required: true, type: "Namespace_NestedObjectType" @@ -734,7 +735,7 @@ export const typeInfo: TypeInfo = { name: "localObjectArray", required: false, type: "[Namespace_Imported_NestedObjectType]", - item: createObjectDefinition({ + item: createObjectRef({ name: "localObjectArray", required: true, type: "Namespace_Imported_NestedObjectType" @@ -943,7 +944,7 @@ export const typeInfo: TypeInfo = { name: "optNestedObjectArray", type: "[Namespace_NestedObjectType]", required: true, - item: createObjectDefinition({ + item: createObjectRef({ name: "optNestedObjectArray", type: "Namespace_NestedObjectType", required: false @@ -958,7 +959,7 @@ export const typeInfo: TypeInfo = { name: "optImportedNestedObjectArray", type: "[Namespace_Imported_NestedObjectType]", required: true, - item: createObjectDefinition({ + item: createObjectRef({ name: "optImportedNestedObjectArray", type: "Namespace_Imported_NestedObjectType", required: false diff --git a/packages/test-cases/cases/parse/sanity/output.ts b/packages/test-cases/cases/parse/sanity/output.ts index e20e3d1f73..669edeef79 100644 --- a/packages/test-cases/cases/parse/sanity/output.ts +++ b/packages/test-cases/cases/parse/sanity/output.ts @@ -13,7 +13,9 @@ import { createEnumDefinition, createEnumPropertyDefinition, createImportedEnumDefinition, - createInterfaceImplementedDefinition + createInterfaceImplementedDefinition, + createObjectRef, + createEnumRef } from "../../../../schema/parse/src/typeInfo"; export const output: TypeInfo = { @@ -124,7 +126,7 @@ export const output: TypeInfo = { name: "objectArray", type: "[UserObject]", required: true, - item: createObjectDefinition({ name: "objectArray", type: "UserObject", required: true }) + item: createObjectRef({ name: "objectArray", type: "UserObject", required: true }) }), createArrayPropertyDefinition({ name: "objectArrayArray", @@ -134,7 +136,7 @@ export const output: TypeInfo = { name: "objectArrayArray", type: "[UserObject]", required: true, - item: createObjectDefinition({ name: "objectArrayArray", type: "UserObject", required: true }) + item: createObjectRef({ name: "objectArrayArray", type: "UserObject", required: true }) }) }), createObjectPropertyDefinition({ @@ -159,7 +161,7 @@ export const output: TypeInfo = { name: "enumArray", type: "[CustomEnum]", required: true, - item: createEnumDefinition({ + item: createEnumRef({ name: "enumArray", type: "CustomEnum", required: true, @@ -169,7 +171,7 @@ export const output: TypeInfo = { name: "optEnumArray", type: "[CustomEnum]", required: false, - item: createEnumDefinition({ + item: createEnumRef({ name: "optEnumArray", type: "CustomEnum", required: false @@ -463,7 +465,7 @@ export const output: TypeInfo = { required: true }), object: { - ...createObjectDefinition({ + ...createObjectRef({ name: "importedObjectMethod", type: "TestImport_Object", required: true @@ -479,7 +481,7 @@ export const output: TypeInfo = { required: true }), object: { - ...createObjectDefinition({ + ...createObjectRef({ name: "importedObject", type: "TestImport_Object", required: true From fac8af611e872f1d8f3b05e3cda8ff0f9f7afc01 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 2 Jul 2021 19:07:35 +0200 Subject: [PATCH 094/112] using object and enum refs instead of object and enum defs where appropriate --- packages/schema/compose/src/resolve.ts | 14 ++++++++------ .../parse/src/transform/finalizePropertyDef.ts | 1 - .../schema/parse/src/transform/toGraphQLType.ts | 2 ++ packages/schema/parse/src/typeInfo/definitions.ts | 8 ++++---- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 7bcd9d22df..972d426c39 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -34,6 +34,8 @@ import { isKind, header, InterfaceImplementedDefinition, + ObjectRef, + EnumRef, } from "@web3api/schema-parse"; type ImplementationWithInterfaces = { @@ -186,7 +188,7 @@ const extractObjectImportDependencies = ( return { enter: { - ObjectDefinition: (def: ObjectDefinition & Namespaced) => { + ObjectRef: (def: ObjectRef & Namespaced) => { if (def.__namespaced) { return def; } @@ -258,7 +260,7 @@ const extractObjectImportDependencies = ( return def; }, - EnumDefinition: (def: EnumDefinition & Namespaced) => { + EnumRef: (def: EnumRef & Namespaced) => { if (def.__namespaced) { return def; } @@ -286,7 +288,7 @@ const extractObjectImportDependencies = ( const namespaceTypes = (namespace: string, typeInfo: TypeInfo): TypeInfoTransforms => ({ enter: { - ObjectDefinition: (def: ObjectDefinition & Namespaced) => { + ObjectRef: (def: ObjectRef & Namespaced) => { if (def.__namespaced) { return def; } @@ -310,7 +312,7 @@ const namespaceTypes = (namespace: string, typeInfo: TypeInfo): TypeInfoTransfor __namespaced: true, }; }, - EnumDefinition: (def: EnumDefinition & Namespaced) => { + EnumRef: (def: EnumRef & Namespaced) => { if (def.__namespaced) { return def; } @@ -726,10 +728,10 @@ async function resolveLocalImports( visitorFunc(type, { enter: { - ObjectDefinition: (def: ObjectDefinition) => { + ObjectRef: (def: ObjectRef) => { return findImport(def, localTypeInfo.objectTypes); }, - EnumDefinition: (def: EnumDefinition) => { + EnumRef: (def: EnumRef) => { return findImport(def, localTypeInfo.enumTypes); }, }, diff --git a/packages/schema/parse/src/transform/finalizePropertyDef.ts b/packages/schema/parse/src/transform/finalizePropertyDef.ts index eb0cab36d8..da52027fd7 100644 --- a/packages/schema/parse/src/transform/finalizePropertyDef.ts +++ b/packages/schema/parse/src/transform/finalizePropertyDef.ts @@ -67,7 +67,6 @@ function populateArrayType(array: ArrayDefinition, typeInfo: TypeInfo) { } } - if (array.array) { array.item = array.array; } else if (array.unresolvedObjectOrEnum) { diff --git a/packages/schema/parse/src/transform/toGraphQLType.ts b/packages/schema/parse/src/transform/toGraphQLType.ts index d8ddb8454a..9e87e524ef 100644 --- a/packages/schema/parse/src/transform/toGraphQLType.ts +++ b/packages/schema/parse/src/transform/toGraphQLType.ts @@ -30,10 +30,12 @@ function anyToGraphQL(any: AnyDefinition, prefixed: boolean): string { function toGraphQL(def: GenericDefinition, prefixed = false): string { switch (def.kind) { case DefinitionKind.Object: + case DefinitionKind.ObjectRef: case DefinitionKind.Scalar: case DefinitionKind.ImportedObject: return applyRequired(def.type, def.required); case DefinitionKind.Enum: + case DefinitionKind.EnumRef: case DefinitionKind.ImportedEnum: if (prefixed) { return applyRequired(`Enum_${def.type}`, def.required); diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index 7ac24b23c5..94dafa8808 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -192,12 +192,12 @@ export function createArrayDefinition(args: { ? (args.item as ScalarDefinition) : undefined, object: - args.item && isKind(args.item, DefinitionKind.Object) - ? (args.item as ObjectDefinition) + args.item && isKind(args.item, DefinitionKind.ObjectRef) + ? (args.item as ObjectRef) : undefined, enum: - args.item && isKind(args.item, DefinitionKind.Enum) - ? (args.item as EnumDefinition) + args.item && isKind(args.item, DefinitionKind.EnumRef) + ? (args.item as EnumRef) : undefined, }), item: args.item ? args.item : null, From 2a3e278c4c5c4d988160832ca5d02982a933f156 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 2 Jul 2021 19:18:11 +0200 Subject: [PATCH 095/112] lint fix --- .../schema/parse/src/typeInfo/definitions.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index 60414f3b97..56c793f0be 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -24,7 +24,7 @@ export function isKind(type: GenericDefinition, kind: DefinitionKind): boolean { export type WithComment = { comment?: string; -} +}; export interface GenericDefinition { type: string; name: string | null; @@ -125,7 +125,7 @@ export function createEnumDefinition(args: { type: args.type, kind: DefinitionKind.Enum, constants: args.constants ? args.constants : [], - comment: args.comment + comment: args.comment, }; } @@ -206,7 +206,7 @@ export function createArrayPropertyDefinition(args: { }): PropertyDefinition { return createPropertyDefinition({ ...args, - array: createArrayDefinition(args) + array: createArrayDefinition(args), }); } @@ -218,7 +218,7 @@ export function createScalarPropertyDefinition(args: { }): PropertyDefinition { return createPropertyDefinition({ ...args, - scalar: createScalarDefinition(args) + scalar: createScalarDefinition(args), }); } @@ -233,8 +233,8 @@ export function createEnumPropertyDefinition(args: { ...args, enum: { ...createEnumDefinition(args), - comment: undefined - } + comment: undefined, + }, }); } @@ -249,8 +249,8 @@ export function createObjectPropertyDefinition(args: { ...args, object: { ...createObjectDefinition(args), - comment: undefined - } + comment: undefined, + }, }); } @@ -321,7 +321,8 @@ export interface ImportedDefinition { export interface ImportedEnumDefinition extends EnumDefinition, - ImportedDefinition, WithComment {} + ImportedDefinition, + WithComment {} export function createImportedEnumDefinition(args: { type: string; constants: string[]; @@ -344,7 +345,8 @@ export function createImportedEnumDefinition(args: { export interface ImportedQueryDefinition extends GenericDefinition, - ImportedDefinition, WithComment { + ImportedDefinition, + WithComment { methods: MethodDefinition[]; } export function createImportedQueryDefinition(args: { @@ -375,7 +377,8 @@ export function createImportedQueryDefinition(args: { export interface ImportedObjectDefinition extends ObjectDefinition, - ImportedDefinition, WithComment {} + ImportedDefinition, + WithComment {} export function createImportedObjectDefinition(args: { type: string; name?: string; From e341aaeab989820e677dde39fa91911bd489240a Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 2 Jul 2021 19:23:54 +0200 Subject: [PATCH 096/112] lint fix --- packages/schema/compose/src/resolve.ts | 18 +++++--- .../src/extract/imported-object-types.ts | 4 +- .../parse/src/extract/imported-query-types.ts | 4 +- packages/schema/parse/src/extract/index.ts | 4 +- .../parse/src/extract/object-types-utils.ts | 17 +++----- .../schema/parse/src/extract/object-types.ts | 9 +--- .../parse/src/extract/property-utils.ts | 2 +- .../parse/src/extract/query-types-utils.ts | 29 ++++--------- .../schema/parse/src/extract/query-types.ts | 9 +--- packages/schema/parse/src/index.ts | 4 +- .../src/transform/finalizePropertyDef.ts | 42 +++++++++++-------- packages/schema/parse/src/transform/index.ts | 1 - .../schema/parse/src/typeInfo/definitions.ts | 12 +++--- 13 files changed, 68 insertions(+), 87 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 972d426c39..1be666b406 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -217,7 +217,7 @@ const extractObjectImportDependencies = ( rootTypeInfo, namespace, uri - ) + ), }); } @@ -254,7 +254,7 @@ const extractObjectImportDependencies = ( rootTypeInfo, namespace, uri - ) + ), }); } @@ -286,7 +286,7 @@ const extractObjectImportDependencies = ( }; }; -const namespaceTypes = (namespace: string, typeInfo: TypeInfo): TypeInfoTransforms => ({ +const namespaceTypes = (namespace: string): TypeInfoTransforms => ({ enter: { ObjectRef: (def: ObjectRef & Namespaced) => { if (def.__namespaced) { @@ -323,7 +323,7 @@ const namespaceTypes = (namespace: string, typeInfo: TypeInfo): TypeInfoTransfor __namespaced: true, }; }, - } + }, }); function appendNamespace(namespace: string, str: string) { @@ -587,7 +587,10 @@ async function resolveExternalImports( const importDef = importType as ImportedObjectDefinition; // Namespace all object types typeInfo.importedObjectTypes.push( - visitImportedObjectDefinition(importDef, namespaceTypes(namespace, typeInfo)) + visitImportedObjectDefinition( + importDef, + namespaceTypes(namespace, typeInfo) + ) ); }; } else if (importType.kind === DefinitionKind.ImportedQuery) { @@ -596,7 +599,10 @@ async function resolveExternalImports( const importDef = importType as ImportedQueryDefinition; // Namespace all object types typeInfo.importedQueryTypes.push( - visitImportedQueryDefinition(importDef, namespaceTypes(namespace, typeInfo)) + visitImportedQueryDefinition( + importDef, + namespaceTypes(namespace, typeInfo) + ) ); }; } else if (importType.kind === DefinitionKind.ImportedEnum) { diff --git a/packages/schema/parse/src/extract/imported-object-types.ts b/packages/schema/parse/src/extract/imported-object-types.ts index 474538369d..de74b058a6 100644 --- a/packages/schema/parse/src/extract/imported-object-types.ts +++ b/packages/schema/parse/src/extract/imported-object-types.ts @@ -23,7 +23,7 @@ import { const visitorEnter = ( importedObjectTypes: ImportedObjectDefinition[], - state: State, + state: State ) => ({ ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { const imported = extractImportedDefinition(node); @@ -72,7 +72,7 @@ const visitorLeave = (state: State) => ({ }); export const getImportedObjectTypesVisitor = ( - typeInfo: TypeInfo, + typeInfo: TypeInfo ): ASTVisitor => { const state: State = {}; diff --git a/packages/schema/parse/src/extract/imported-query-types.ts b/packages/schema/parse/src/extract/imported-query-types.ts index fbceb3c593..cb0cf3c5bf 100644 --- a/packages/schema/parse/src/extract/imported-query-types.ts +++ b/packages/schema/parse/src/extract/imported-query-types.ts @@ -26,7 +26,7 @@ import { const visitorEnter = ( importedQueryTypes: ImportedQueryDefinition[], - state: State, + state: State ) => ({ ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { const imported = extractImportedDefinition(node, true); @@ -107,7 +107,7 @@ const visitorLeave = (state: State) => ({ }); export const getImportedQueryTypesVisitor = ( - typeInfo: TypeInfo, + typeInfo: TypeInfo ): ASTVisitor => { const state: State = {}; diff --git a/packages/schema/parse/src/extract/index.ts b/packages/schema/parse/src/extract/index.ts index 9bd385c46f..c71fdb261a 100644 --- a/packages/schema/parse/src/extract/index.ts +++ b/packages/schema/parse/src/extract/index.ts @@ -8,9 +8,7 @@ import { getImportedEnumTypesVisitor } from "./imported-enum-types"; import { ASTVisitor } from "graphql"; -export type SchemaExtractorBuilder = ( - typeInfo: TypeInfo, -) => ASTVisitor; +export type SchemaExtractorBuilder = (typeInfo: TypeInfo) => ASTVisitor; export const extractors: SchemaExtractorBuilder[] = [ getEnumTypesVisitor, diff --git a/packages/schema/parse/src/extract/object-types-utils.ts b/packages/schema/parse/src/extract/object-types-utils.ts index 9703d1e275..4dad1062c2 100644 --- a/packages/schema/parse/src/extract/object-types-utils.ts +++ b/packages/schema/parse/src/extract/object-types-utils.ts @@ -40,10 +40,7 @@ export function extractFieldDefinition( importDef.properties.push(property); } -export function extractNamedType( - node: NamedTypeNode, - state: State, -): void { +export function extractNamedType(node: NamedTypeNode, state: State): void { const property = state.currentProperty; if (!property) { @@ -65,14 +62,10 @@ export function extractNamedType( ); } - setPropertyType( - property, - property.name, - { - type: node.name.value, - required: state.nonNullType, - } - ); + setPropertyType(property, property.name, { + type: node.name.value, + required: state.nonNullType, + }); state.nonNullType = false; } diff --git a/packages/schema/parse/src/extract/object-types.ts b/packages/schema/parse/src/extract/object-types.ts index 3ab634c1dd..05a0cf84a7 100644 --- a/packages/schema/parse/src/extract/object-types.ts +++ b/packages/schema/parse/src/extract/object-types.ts @@ -21,10 +21,7 @@ import { ASTVisitor, } from "graphql"; -const visitorEnter = ( - objectTypes: ObjectDefinition[], - state: State, -) => ({ +const visitorEnter = (objectTypes: ObjectDefinition[], state: State) => ({ ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { // Skip non-custom types if (node.name.value === "Query" || node.name.value === "Mutation") { @@ -78,9 +75,7 @@ const visitorLeave = (state: State) => ({ }, }); -export const getObjectTypesVisitor = ( - typeInfo: TypeInfo, -): ASTVisitor => { +export const getObjectTypesVisitor = (typeInfo: TypeInfo): ASTVisitor => { const state: State = {}; return { diff --git a/packages/schema/parse/src/extract/property-utils.ts b/packages/schema/parse/src/extract/property-utils.ts index 3cf51d47b5..f38db4e547 100644 --- a/packages/schema/parse/src/extract/property-utils.ts +++ b/packages/schema/parse/src/extract/property-utils.ts @@ -8,7 +8,7 @@ import { export function setPropertyType( property: PropertyDefinition, name: string, - type: { type: string; required: boolean | undefined }, + type: { type: string; required: boolean | undefined } ): void { if (isScalarType(type.type)) { property.scalar = createScalarDefinition({ diff --git a/packages/schema/parse/src/extract/query-types-utils.ts b/packages/schema/parse/src/extract/query-types-utils.ts index d9821e1229..71fa7a16c1 100644 --- a/packages/schema/parse/src/extract/query-types-utils.ts +++ b/packages/schema/parse/src/extract/query-types-utils.ts @@ -19,10 +19,7 @@ export interface State { currentImport?: ImportedQueryDefinition; } -export function extractNamedType( - node: NamedTypeNode, - state: State, -): void { +export function extractNamedType(node: NamedTypeNode, state: State): void { const argument = state.currentArgument; const method = state.currentMethod; @@ -39,14 +36,10 @@ export function extractNamedType( } // Argument value - setPropertyType( - argument, - argument.name, - { - type: node.name.value, - required: state.nonNullType, - } - ); + setPropertyType(argument, argument.name, { + type: node.name.value, + required: state.nonNullType, + }); state.nonNullType = false; } else if (method) { @@ -66,14 +59,10 @@ export function extractNamedType( ); } - setPropertyType( - state.currentReturn, - method.name, - { - type: node.name.value, - required: state.nonNullType, - } - ); + setPropertyType(state.currentReturn, method.name, { + type: node.name.value, + required: state.nonNullType, + }); state.nonNullType = false; } diff --git a/packages/schema/parse/src/extract/query-types.ts b/packages/schema/parse/src/extract/query-types.ts index df40e20653..4653e032c6 100644 --- a/packages/schema/parse/src/extract/query-types.ts +++ b/packages/schema/parse/src/extract/query-types.ts @@ -26,10 +26,7 @@ import { ASTVisitor, } from "graphql"; -const visitorEnter = ( - queryTypes: QueryDefinition[], - state: State, -) => ({ +const visitorEnter = (queryTypes: QueryDefinition[], state: State) => ({ ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { const nodeName = node.name.value; @@ -160,9 +157,7 @@ const visitorLeave = (state: State) => ({ }, }); -export const getQueryTypesVisitor = ( - typeInfo: TypeInfo, -): ASTVisitor => { +export const getQueryTypesVisitor = (typeInfo: TypeInfo): ASTVisitor => { const state: State = {}; return { diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index 4a961f7265..ec86967b7d 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -71,9 +71,7 @@ const extract = ( typeInfo: TypeInfo, extractors: SchemaExtractorBuilder[] ) => { - const allVisitors = extractors.map((getVisitor) => - getVisitor(typeInfo) - ); + const allVisitors = extractors.map((getVisitor) => getVisitor(typeInfo)); visit(astNode, visitInParallel(allVisitors)); }; diff --git a/packages/schema/parse/src/transform/finalizePropertyDef.ts b/packages/schema/parse/src/transform/finalizePropertyDef.ts index da52027fd7..561195db9a 100644 --- a/packages/schema/parse/src/transform/finalizePropertyDef.ts +++ b/packages/schema/parse/src/transform/finalizePropertyDef.ts @@ -20,7 +20,10 @@ export const finalizePropertyDef = (typeInfo: TypeInfo): TypeInfoTransforms => { }; }; -export function populatePropertyType(property: PropertyDefinition, typeInfo: TypeInfo): void { +export function populatePropertyType( + property: PropertyDefinition, + typeInfo: TypeInfo +): void { let propertyType: GenericDefinition | undefined; if (property.array) { populateArrayType(property.array, typeInfo); @@ -36,7 +39,7 @@ export function populatePropertyType(property: PropertyDefinition, typeInfo: Typ } else { throw Error("Property type is undefined, this should never happen."); } - + property.type = propertyType.type; property.required = propertyType.required; } @@ -86,8 +89,11 @@ function populateArrayType(array: ArrayDefinition, typeInfo: TypeInfo) { array.type = "[" + array.item.type + "]"; } -function resolveObjectOrEnumKind(property: PropertyDefinition, typeInfo: TypeInfo): GenericDefinition { - if(!property.unresolvedObjectOrEnum) { +function resolveObjectOrEnumKind( + property: PropertyDefinition, + typeInfo: TypeInfo +): GenericDefinition { + if (!property.unresolvedObjectOrEnum) { throw Error("Type reference is undefined, this should never happen."); } @@ -96,45 +102,47 @@ function resolveObjectOrEnumKind(property: PropertyDefinition, typeInfo: TypeInf (type) => type.type === property.unresolvedObjectOrEnum!.type ); - customType = customType + customType = customType ? customType : typeInfo.importedObjectTypes.find( - (type) => type.type === property.unresolvedObjectOrEnum!.type - ); + (type) => type.type === property.unresolvedObjectOrEnum!.type + ); if (!customType) { customType = typeInfo.enumTypes.find( (type) => type.type === property.unresolvedObjectOrEnum!.type ); - customType = customType + customType = customType ? customType : typeInfo.importedEnumTypes.find( - (type) => type.type === property.unresolvedObjectOrEnum!.type - ); - + (type) => type.type === property.unresolvedObjectOrEnum!.type + ); + if (!customType) { - throw new Error(`Unsupported type ${property.unresolvedObjectOrEnum.type}`); + throw new Error( + `Unsupported type ${property.unresolvedObjectOrEnum.type}` + ); } property.enum = createEnumRef({ name: property.unresolvedObjectOrEnum.name, required: property.unresolvedObjectOrEnum.required ?? undefined, - type: property.unresolvedObjectOrEnum.type + type: property.unresolvedObjectOrEnum.type, }); - + property.unresolvedObjectOrEnum = null; - + return property.enum; } else { property.object = createObjectRef({ name: property.unresolvedObjectOrEnum.name, required: property.unresolvedObjectOrEnum.required ?? undefined, - type: property.unresolvedObjectOrEnum.type + type: property.unresolvedObjectOrEnum.type, }); property.unresolvedObjectOrEnum = null; - + return property.object; } } diff --git a/packages/schema/parse/src/transform/index.ts b/packages/schema/parse/src/transform/index.ts index 7d7b7cf5d1..c07e85b3bb 100644 --- a/packages/schema/parse/src/transform/index.ts +++ b/packages/schema/parse/src/transform/index.ts @@ -138,7 +138,6 @@ export function visitObjectDefinition( return transformType(result, transforms.leave); } - export function visitObjectRef( def: ObjectRef, transforms: TypeInfoTransforms diff --git a/packages/schema/parse/src/typeInfo/definitions.ts b/packages/schema/parse/src/typeInfo/definitions.ts index ec1d5b0a72..312c2119e4 100644 --- a/packages/schema/parse/src/typeInfo/definitions.ts +++ b/packages/schema/parse/src/typeInfo/definitions.ts @@ -68,7 +68,7 @@ export function createObjectDefinition(args: { }; } -export interface ObjectRef extends GenericDefinition { } +export type ObjectRef = GenericDefinition; export function createObjectRef(args: { type: string; name?: string | null; @@ -146,7 +146,7 @@ export function createEnumDefinition(args: { }; } -export interface EnumRef extends GenericDefinition { } +export type EnumRef = GenericDefinition; export function createEnumRef(args: { type: string; name?: string | null; @@ -158,7 +158,7 @@ export function createEnumRef(args: { }; } -export interface UnresolvedObjectOrEnumRef extends GenericDefinition { } +export type UnresolvedObjectOrEnumRef = GenericDefinition; export function createUnresolvedObjectOrEnumRef(args: { type: string; name?: string | null; @@ -167,7 +167,7 @@ export function createUnresolvedObjectOrEnumRef(args: { return { ...createGenericDefinition(args), type: args.type, - kind: DefinitionKind.UnresolvedObjectOrEnum + kind: DefinitionKind.UnresolvedObjectOrEnum, }; } @@ -273,7 +273,7 @@ export function createEnumPropertyDefinition(args: { }): PropertyDefinition { return createPropertyDefinition({ ...args, - enum: createEnumRef(args) + enum: createEnumRef(args), }); } @@ -286,7 +286,7 @@ export function createObjectPropertyDefinition(args: { }): PropertyDefinition { return createPropertyDefinition({ ...args, - object: createObjectRef(args) + object: createObjectRef(args), }); } From 9de66508ad3ae08b9630e57392f1ed43d5147b70 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 2 Jul 2021 19:24:15 +0200 Subject: [PATCH 097/112] removed unused argument --- packages/schema/compose/src/resolve.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 1be666b406..3bc2fa555a 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -589,7 +589,7 @@ async function resolveExternalImports( typeInfo.importedObjectTypes.push( visitImportedObjectDefinition( importDef, - namespaceTypes(namespace, typeInfo) + namespaceTypes(namespace) ) ); }; @@ -601,7 +601,7 @@ async function resolveExternalImports( typeInfo.importedQueryTypes.push( visitImportedQueryDefinition( importDef, - namespaceTypes(namespace, typeInfo) + namespaceTypes(namespace) ) ); }; @@ -611,7 +611,7 @@ async function resolveExternalImports( typeInfo.importedEnumTypes.push( visitImportedEnumDefinition( importType as ImportedEnumDefinition, - namespaceTypes(namespace, typeInfo) + namespaceTypes(namespace) ) ); }; From 941929c8663c46f35d65025ca5a47c02ec96e872 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Fri, 2 Jul 2021 19:36:57 +0200 Subject: [PATCH 098/112] lint fic --- packages/schema/compose/src/resolve.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 3bc2fa555a..88377ac0d8 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -587,10 +587,7 @@ async function resolveExternalImports( const importDef = importType as ImportedObjectDefinition; // Namespace all object types typeInfo.importedObjectTypes.push( - visitImportedObjectDefinition( - importDef, - namespaceTypes(namespace) - ) + visitImportedObjectDefinition(importDef, namespaceTypes(namespace)) ); }; } else if (importType.kind === DefinitionKind.ImportedQuery) { @@ -599,10 +596,7 @@ async function resolveExternalImports( const importDef = importType as ImportedQueryDefinition; // Namespace all object types typeInfo.importedQueryTypes.push( - visitImportedQueryDefinition( - importDef, - namespaceTypes(namespace) - ) + visitImportedQueryDefinition(importDef, namespaceTypes(namespace)) ); }; } else if (importType.kind === DefinitionKind.ImportedEnum) { From 6b6f7ec95c6b523667a57c58d6f148c2447910cd Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Mon, 5 Jul 2021 20:41:43 +0200 Subject: [PATCH 099/112] removed comments from body of implementation types --- packages/schema/compose/src/resolve.ts | 9 ++++++++- .../cases/compose/sanity/output/mutation.graphql | 3 --- .../test-cases/cases/compose/sanity/output/mutation.ts | 2 +- .../test-cases/cases/compose/sanity/output/query.graphql | 6 ------ packages/test-cases/cases/compose/sanity/output/query.ts | 2 -- .../cases/compose/sanity/output/schema.graphql | 9 --------- .../test-cases/cases/compose/sanity/output/schema.ts | 6 ++---- 7 files changed, 11 insertions(+), 26 deletions(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 0f556fe783..9429e5476e 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -411,6 +411,11 @@ function resolveInterfaces( schema: string, implementationsWithInterfaces: ImplementationWithInterfaces[] ): string { + const removeComments = (body: string) => { + const bodyWithoutComments = body.replace(/"""[^"]*"""[ \n\t]*/g, ''); + return bodyWithoutComments; + }; + if (!implementationsWithInterfaces.length) { return schema; } @@ -435,11 +440,13 @@ function resolveInterfaces( continue; } - const body = match[2]; + let body = match[2]; if (!body) { continue; } + body = removeComments(body); + interfacesWithBodies.push({ name: interfaceName, body: body, diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.graphql b/packages/test-cases/cases/compose/sanity/output/mutation.graphql index 139c5666be..f1cba44ecb 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.graphql +++ b/packages/test-cases/cases/compose/sanity/output/mutation.graphql @@ -125,9 +125,6 @@ anotherProp comment """ anotherProp: String str: String! -""" -InterfaceObject1_uint8 comment -""" uint8: UInt8! str2: String! object: Interface_Object diff --git a/packages/test-cases/cases/compose/sanity/output/mutation.ts b/packages/test-cases/cases/compose/sanity/output/mutation.ts index 49001563e1..f84ea6254c 100644 --- a/packages/test-cases/cases/compose/sanity/output/mutation.ts +++ b/packages/test-cases/cases/compose/sanity/output/mutation.ts @@ -226,7 +226,7 @@ export const typeInfo: TypeInfo = { properties: [ createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false, comment: "anotherProp comment" }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "InterfaceObject1_uint8 comment" }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] diff --git a/packages/test-cases/cases/compose/sanity/output/query.graphql b/packages/test-cases/cases/compose/sanity/output/query.graphql index 05fac8b43b..80913ffcae 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.graphql +++ b/packages/test-cases/cases/compose/sanity/output/query.graphql @@ -64,13 +64,7 @@ method2 comment arg: [String!]! ): [Int64!]! -""" -abstractQueryMethod comment -""" abstractQueryMethod( -""" -arg comment -""" arg: Interface_QueryInterfaceArgument! ): Interface_InterfaceObject2! } diff --git a/packages/test-cases/cases/compose/sanity/output/query.ts b/packages/test-cases/cases/compose/sanity/output/query.ts index 07f93a29d1..dcfa2f068b 100644 --- a/packages/test-cases/cases/compose/sanity/output/query.ts +++ b/packages/test-cases/cases/compose/sanity/output/query.ts @@ -229,7 +229,6 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "query", name: "abstractQueryMethod", - comment: "abstractQueryMethod comment", return: createObjectPropertyDefinition({ name: "abstractQueryMethod", type: "Interface_InterfaceObject2", @@ -240,7 +239,6 @@ export const typeInfo: TypeInfo = { createObjectPropertyDefinition({ name: "arg", required: true, - comment: "arg comment", type: "Interface_QueryInterfaceArgument" }) ] diff --git a/packages/test-cases/cases/compose/sanity/output/schema.graphql b/packages/test-cases/cases/compose/sanity/output/schema.graphql index ac1cc99d8b..87169827e4 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.graphql +++ b/packages/test-cases/cases/compose/sanity/output/schema.graphql @@ -64,13 +64,7 @@ method2 comment arg: [String!]! ): [Int64!]! -""" -abstractQueryMethod comment -""" abstractQueryMethod( -""" -arg comment -""" arg: Interface_QueryInterfaceArgument! ): Interface_InterfaceObject2! } @@ -232,9 +226,6 @@ anotherProp comment """ anotherProp: String str: String! -""" -InterfaceObject1_uint8 comment -""" uint8: UInt8! str2: String! object: Interface_Object diff --git a/packages/test-cases/cases/compose/sanity/output/schema.ts b/packages/test-cases/cases/compose/sanity/output/schema.ts index a4889871d5..df46889210 100644 --- a/packages/test-cases/cases/compose/sanity/output/schema.ts +++ b/packages/test-cases/cases/compose/sanity/output/schema.ts @@ -118,7 +118,6 @@ export const typeInfo: TypeInfo = { ...createMethodDefinition({ type: "query", name: "abstractQueryMethod", - comment: "abstractQueryMethod comment", return: createObjectPropertyDefinition({ name: "abstractQueryMethod", type: "Interface_InterfaceObject2", @@ -129,8 +128,7 @@ export const typeInfo: TypeInfo = { createObjectPropertyDefinition({ name: "arg", required: true, - type: "Interface_QueryInterfaceArgument", - comment: "arg comment" + type: "Interface_QueryInterfaceArgument" }) ] } @@ -454,7 +452,7 @@ export const typeInfo: TypeInfo = { properties: [ createScalarPropertyDefinition({ name: "anotherProp", type: "String", required: false, comment: "anotherProp comment" }), createScalarPropertyDefinition({ name: "str", type: "String", required: true }), - createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true, comment: "InterfaceObject1_uint8 comment" }), + createScalarPropertyDefinition({ name: "uint8", type: "UInt8", required: true }), createScalarPropertyDefinition({ name: "str2", type: "String", required: true }), createObjectPropertyDefinition({ name: "object", type: "Interface_Object", required: false }), ] From 72f9342295660b18911fbabd16bb9b169ee58f83 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Mon, 5 Jul 2021 22:12:16 +0200 Subject: [PATCH 100/112] lint fix --- packages/schema/compose/src/resolve.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 9429e5476e..ace00f5914 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -412,7 +412,7 @@ function resolveInterfaces( implementationsWithInterfaces: ImplementationWithInterfaces[] ): string { const removeComments = (body: string) => { - const bodyWithoutComments = body.replace(/"""[^"]*"""[ \n\t]*/g, ''); + const bodyWithoutComments = body.replace(/"""[^"]*"""[ \n\t]*/g, ""); return bodyWithoutComments; }; From b6f5f0a0c1cea6d4ab8f198704cd4352c3fd03bf Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Wed, 7 Jul 2021 13:45:05 -0500 Subject: [PATCH 101/112] use v25 --- packages/core-apis/api-resolver/package.json | 4 +- packages/templates/api/interface/package.json | 4 +- yarn.lock | 165 ------------------ 3 files changed, 4 insertions(+), 169 deletions(-) diff --git a/packages/core-apis/api-resolver/package.json b/packages/core-apis/api-resolver/package.json index 66ef691485..2aa478ca6b 100644 --- a/packages/core-apis/api-resolver/package.json +++ b/packages/core-apis/api-resolver/package.json @@ -2,7 +2,7 @@ "name": "resolver-interface", "description": "Web3API Resolver Interface", "private": true, - "version": "0.0.1-prealpha.24", + "version": "0.0.1-prealpha.25", "scripts": { "build": "yarn build:web3api", "build:web3api": "npx w3 build", @@ -12,7 +12,7 @@ "deploy:web3api": "npx w3 build --ipfs http://localhost:5001" }, "devDependencies": { - "@web3api/cli": "0.0.1-prealpha.24", + "@web3api/cli": "0.0.1-prealpha.25", "js-yaml": "3.14.0" } } diff --git a/packages/templates/api/interface/package.json b/packages/templates/api/interface/package.json index 56dc59b986..59880d7037 100644 --- a/packages/templates/api/interface/package.json +++ b/packages/templates/api/interface/package.json @@ -2,7 +2,7 @@ "name": "templates-api-interface", "description": "Web3API Interface Example", "private": true, - "version": "0.0.1-prealpha.24", + "version": "0.0.1-prealpha.25", "scripts": { "build": "yarn build:web3api", "build:web3api": "npx w3 build", @@ -12,7 +12,7 @@ "deploy:web3api": "npx w3 build --ipfs http://localhost:5001" }, "devDependencies": { - "@web3api/cli": "0.0.1-prealpha.24", + "@web3api/cli": "0.0.1-prealpha.25", "js-yaml": "3.14.0" } } diff --git a/yarn.lock b/yarn.lock index 6efa75e343..0cd663e4b8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3619,164 +3619,6 @@ "@typescript-eslint/types" "4.11.1" eslint-visitor-keys "^2.0.0" -"@web3api/cli@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/cli/-/cli-0.0.1-prealpha.24.tgz#6c97d8531816c349198eb58a0fa7af2a70eed18a" - integrity sha512-2IrAMpUjgai0O77dtn+F6SFnTYtgfz5Las/s0QlihYhVlGya4WPt9f2xFuvHm/DWwldfpod/gA5PAO+D/sJITA== - dependencies: - "@formatjs/intl" "1.8.2" - "@types/node" "12.7.11" - "@web3api/client-js" "0.0.1-prealpha.24" - "@web3api/client-test-env" "0.0.1-prealpha.24" - "@web3api/core-js" "0.0.1-prealpha.24" - "@web3api/ens-plugin-js" "0.0.1-prealpha.24" - "@web3api/ethereum-plugin-js" "0.0.1-prealpha.24" - "@web3api/ipfs-plugin-js" "0.0.1-prealpha.24" - "@web3api/os-js" "0.0.1-prealpha.24" - "@web3api/schema-bind" "0.0.1-prealpha.24" - "@web3api/schema-compose" "0.0.1-prealpha.24" - "@web3api/schema-parse" "0.0.1-prealpha.24" - assemblyscript "0.17.14" - axios "0.19.2" - chalk "4.1.0" - chokidar "3.5.1" - fs-extra "9.0.1" - gluegun "4.6.1" - graphql-tag "2.11.0" - ipfs-http-client "48.1.3" - js-yaml "3.14.0" - mustache "4.0.1" - ora "4.0.0" - os-locale "5.0.0" - ws "7.3.1" - -"@web3api/client-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/client-js/-/client-js-0.0.1-prealpha.24.tgz#f38ec697020944fecf0261c9334efbc0a8c24403" - integrity sha512-waSzJlIZ2iDQqKyd6JHZEG9TIGVZTSosDBV/8l39n68s/3EwD5CiToc/UwtdF4RxFHC0jwpNzfZHGbdgflIGQA== - dependencies: - "@msgpack/msgpack" "2.3.0" - "@web3api/core-js" "0.0.1-prealpha.24" - "@web3api/ens-plugin-js" "0.0.1-prealpha.24" - "@web3api/ethereum-plugin-js" "0.0.1-prealpha.24" - "@web3api/ipfs-plugin-js" "0.0.1-prealpha.24" - "@web3api/logger-plugin-js" "0.0.1-prealpha.24" - "@web3api/schema-parse" "0.0.1-prealpha.24" - "@web3api/tracing-js" "0.0.1-prealpha.24" - graphql "15.5.0" - js-yaml "3.14.0" - web-worker "1.0.0" - -"@web3api/client-test-env@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/client-test-env/-/client-test-env-0.0.1-prealpha.24.tgz#8b23d56bfc32f7b76718885e495e5bfc6a795339" - integrity sha512-eNkD/tG5PnFFp7Egy0rAFRrLpD1YCAlvUJ0STVLRQMujMPkFuFEtHziBjVJGJiiyU+1mZ46ub1gEvMbcB7Frpg== - -"@web3api/core-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/core-js/-/core-js-0.0.1-prealpha.24.tgz#426011c3d1695a65adbeaa27e4e94af954c0ae73" - integrity sha512-O7WJ1jXyESLR3JwMZTxS9IMfOtrJbGnb6PTIcthrdkZOUO4zppM8ArJlB9BttQf5vNHdTNnzOOu0pxwkKnLOtg== - dependencies: - "@web3api/manifest-schema" "0.0.1-prealpha.24" - "@web3api/tracing-js" "0.0.1-prealpha.24" - graphql "15.5.0" - graphql-tag "2.10.4" - js-yaml "3.14.0" - jsonschema "1.4.0" - semver "7.3.4" - -"@web3api/ens-plugin-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/ens-plugin-js/-/ens-plugin-js-0.0.1-prealpha.24.tgz#7494e28449764308bfc2bd9ae72d347ef0961b6f" - integrity sha512-NFucvYZ7Ri356IZXvMq6s0vmtMwEoenESUw3Vjy9tc3rpsxNXZHVxfJ14tZjenArZAyVsJDXRBmhuIyJ6mP+jw== - dependencies: - "@ethersproject/address" "5.0.7" - "@web3api/core-js" "0.0.1-prealpha.24" - ethers "5.0.7" - -"@web3api/ethereum-plugin-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/ethereum-plugin-js/-/ethereum-plugin-js-0.0.1-prealpha.24.tgz#9ecfd3be33615a9e7cc46e1d919f56b1a67392b3" - integrity sha512-jWefPeACTk7ziK1fFNhrkKmcHvPcEwQnqs/Av8zKeMe0NMPkDXg17Qjzw++bxzmuJjjlyKDIn2jFBsNkELumNA== - dependencies: - "@ethersproject/address" "5.0.7" - "@ethersproject/providers" "5.0.7" - "@web3api/core-js" "0.0.1-prealpha.24" - ethers "5.0.7" - -"@web3api/ipfs-plugin-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/ipfs-plugin-js/-/ipfs-plugin-js-0.0.1-prealpha.24.tgz#30e3c1e09362e7f80cf4e7a4e0f6860fd9490d8b" - integrity sha512-Gw4pofUMonFHhwR5/30j6wEBqyjX7bwA0zedCflDKSCqd4k8JzSa8KaIaKpX5+DOyrVlAGxspsjxmqqYmaXarA== - dependencies: - "@dorgjelli-test/ipfs-http-client-lite" "0.3.1" - "@web3api/core-js" "0.0.1-prealpha.24" - abort-controller "3.0.0" - cids "^1.1.4" - is-ipfs "1.0.3" - -"@web3api/logger-plugin-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/logger-plugin-js/-/logger-plugin-js-0.0.1-prealpha.24.tgz#77ad91170a154ee31c95e796f784671dcc46a4d4" - integrity sha512-0jwD/PS41uN6LOYSTzTMFC5DuLZ42xDzAw6JNpxu3/V3acioCZzXx33B5Nw3BPSPsO5gATExRU8ExxMWeAFfug== - dependencies: - "@web3api/core-js" "0.0.1-prealpha.24" - -"@web3api/manifest-schema@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/manifest-schema/-/manifest-schema-0.0.1-prealpha.24.tgz#f07e33db19b55538cf171fd6cad5e6d236909931" - integrity sha512-yFGVSOqGChZq7pnOCBr/cK/3wHxZgge6cRyjcwMZGG628wCRijEXqTWd8lCLiaLbs8zLX4JzaoLTcCj/Nkwn4A== - -"@web3api/os-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/os-js/-/os-js-0.0.1-prealpha.24.tgz#da1b7ce7cb57fa8dcfdd2602b0143993359c3a1a" - integrity sha512-iTxS+2zO4Ia3PO99/PDq79uHsrgPPgjfOCqGLneNFx/fAstJEA3z9TT6H+gbYfoBt2YjOixfiQg5Z541yvOmYw== - dependencies: - "@types/node" "12.7.11" - -"@web3api/schema-bind@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/schema-bind/-/schema-bind-0.0.1-prealpha.24.tgz#eaca951913bafc346be3f33e73cc20c91312d163" - integrity sha512-026HW1gapAHb/mVgB2Au9Xnt4yVolXlDmQsRj30j50AgMdkEGDUElrZCH0npIhXFPPnX7m1PlSLUFQGHeLsPeQ== - dependencies: - "@web3api/os-js" "0.0.1-prealpha.24" - "@web3api/schema-parse" "0.0.1-prealpha.24" - mustache "4.0.1" - -"@web3api/schema-compose@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/schema-compose/-/schema-compose-0.0.1-prealpha.24.tgz#8248c7062f910d4f045d3ca450094b4af54c1f07" - integrity sha512-kCAi30pIoKk4KqBSiIY6khRUIIGt3fkudEp5JKTbcjqWrCGq8GxDAZ5ooqd63KxeQRUQ5gCrQY8ztSMwuZfbgw== - dependencies: - "@web3api/schema-parse" "0.0.1-prealpha.24" - graphql "15.5.0" - mustache "4.0.1" - -"@web3api/schema-parse@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/schema-parse/-/schema-parse-0.0.1-prealpha.24.tgz#c492447ff2d6959f6e291aefc97e194bf1cca5ef" - integrity sha512-0CG/4YHMaZyEx5YxUZfBRlrNMyfTjBlniPfR9lrNdpReJPhnx4tDF+uUgFo8NH2M1yUSRLh40txCdDw93wVgdg== - dependencies: - graphql "15.5.0" - graphql-schema-cycles "1.1.2" - -"@web3api/tracing-js@0.0.1-prealpha.24": - version "0.0.1-prealpha.24" - resolved "https://registry.yarnpkg.com/@web3api/tracing-js/-/tracing-js-0.0.1-prealpha.24.tgz#9ba25335c56c45dbbd498a7efd320d4577e480d4" - integrity sha512-UJWBHgqaWslK7GGMjU8KLvVG2Hp4AiHFFga6/C97dFZKXXIaGg3OO7MtTeL3jek8P21FggL23LeZNTkpPCjcTw== - dependencies: - "@opentelemetry/api" "^1.0.0-rc.0" - "@opentelemetry/context-zone" "^0.18.0" - "@opentelemetry/core" "^0.18.0" - "@opentelemetry/exporter-collector" "^0.18.0" - "@opentelemetry/exporter-jaeger" "^0.18.0" - "@opentelemetry/exporter-zipkin" "^0.18.0" - "@opentelemetry/node" "^0.18.0" - "@opentelemetry/propagator-b3" "^0.18.0" - "@opentelemetry/tracing" "^0.18.0" - "@opentelemetry/web" "^0.18.0" - util-inspect "0.1.8" - "@webassemblyjs/ast@1.8.5": version "1.8.5" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" @@ -9029,13 +8871,6 @@ graphql-json-transform@^1.1.0-alpha.0: version "1.1.0-alpha.0" resolved "https://registry.yarnpkg.com/graphql-json-transform/-/graphql-json-transform-1.1.0-alpha.0.tgz#fb0c88d24840067e6c55ac64bbc8d4e5de245d2d" -graphql-schema-cycles@1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/graphql-schema-cycles/-/graphql-schema-cycles-1.1.2.tgz#925d65d774d296238620aaedc391f26a9e46eb33" - dependencies: - graphql "15.5.0" - graphql-json-transform "^1.1.0-alpha.0" - graphql-schema-cycles@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/graphql-schema-cycles/-/graphql-schema-cycles-1.1.3.tgz#80c148e2d1bb9f741372b7b54dff950aa2f9c0d2" From 4dcf0530c946daf5c28e3c287716f14b82a67cee Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Wed, 7 Jul 2021 21:00:28 +0200 Subject: [PATCH 102/112] added e2d test of interfaces --- .../src/__tests__/Web3ApiClient.spec.ts | 93 +++++++++++++++++++ packages/schema/compose/src/resolve.ts | 4 +- .../test-api/mutation/index.ts | 9 ++ .../test-api/mutation/schema.graphql | 7 ++ .../implementations/test-api/query/index.ts | 9 ++ .../test-api/query/schema.graphql | 11 +++ .../implementations/test-api/web3api.yaml | 16 ++++ .../test-interface/mutation/schema.graphql | 5 + .../test-interface/query/schema.graphql | 13 +++ .../test-interface/web3api.yaml | 8 ++ 10 files changed, 173 insertions(+), 2 deletions(-) create mode 100644 packages/test-cases/cases/apis/implementations/test-api/mutation/index.ts create mode 100644 packages/test-cases/cases/apis/implementations/test-api/mutation/schema.graphql create mode 100644 packages/test-cases/cases/apis/implementations/test-api/query/index.ts create mode 100644 packages/test-cases/cases/apis/implementations/test-api/query/schema.graphql create mode 100644 packages/test-cases/cases/apis/implementations/test-api/web3api.yaml create mode 100644 packages/test-cases/cases/apis/implementations/test-interface/mutation/schema.graphql create mode 100644 packages/test-cases/cases/apis/implementations/test-interface/query/schema.graphql create mode 100644 packages/test-cases/cases/apis/implementations/test-interface/web3api.yaml diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 9d47ddb2cb..6c77c13dfb 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -1313,4 +1313,97 @@ describe("Web3ApiClient", () => { result2 = client.getImplementations(new Uri(oldInterfaceUri), { applyRedirects: true }); expect(result2).toEqual([new Uri(implementation1Uri), new Uri(implementation2Uri)]); }); + + it("e2e interface implementations", async () => { + let interfaceApi = await buildAndDeployApi( + `${GetPathToTestApis()}/implementations/test-interface`, + ipfsProvider, + ensAddress + ); + const interfaceUri = `w3://ens/testnet/${interfaceApi.ensDomain}`; + + const implementationApi = await buildAndDeployApi( + `${GetPathToTestApis()}/implementations/test-api`, + ipfsProvider, + ensAddress + ); + const implementationUri = `w3://ens/testnet/${implementationApi.ensDomain}`; + + const client = await getClient({ + interfaces: [ + { + interface: interfaceUri, + implementations: [ + implementationUri + ] + } + ] + }); + + expect( + client.getImplementations(interfaceUri) + ) + .toEqual([implementationUri]); + + const query = await client.query<{ + queryMethod: string; + abstractQueryMethod: string; + }>({ + uri: implementationUri, + query: ` + query { + queryMethod( + arg: $argument1 + ) + abstractQueryMethod( + arg: $argument2 + ) + } + `, + variables: { + argument1: { + uint8: 1, + str: "Test String 1" + }, + argument2: { + str: "Test String 2" + } + } + }); + + expect(query.errors).toBeFalsy(); + expect(query.data).toBeTruthy(); + expect(query.data?.queryMethod).toEqual({ + uint8: 1, + str: "Test String 1" + }); + + expect(query.data?.abstractQueryMethod).toBe("Test String 2"); + + const mutation = await client.query<{ + mutationMethod: string; + abstractMutationMethod: string; + }>({ + uri: implementationUri, + query: ` + mutation { + mutationMethod( + arg: $argument1 + ) + abstractMutationMethod( + arg: $argument2 + ) + } + `, + variables: { + argument1: 1, + argument2: 2 + } + }); + + expect(mutation.errors).toBeFalsy(); + expect(mutation.data).toBeTruthy(); + expect(mutation.data?.mutationMethod).toBe(1); + expect(mutation.data?.abstractMutationMethod).toBe(2); + }); }); diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 0f556fe783..904422e6d2 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -426,7 +426,7 @@ function resolveInterfaces( const allInterfaces = getAllUniqueInterfaces(); const interfacesWithBodies: { name: string; body: string }[] = []; - const typeCapture = /type[ \n\t]*([a-zA-Z0-9_]+)[a-zA-Z0-9_,.:@"&!\(\)\[\] \n\t]+{([a-zA-Z0-9_,.:@"&!\(\)\[\] \n\t]*)}/g; + const typeCapture = /type[ \n\t]*([a-zA-Z0-9_]+)[a-zA-Z0-9_,.:@"&!/\(\)\[\] \n\t]+{([a-zA-Z0-9_,.:@"&!\(\)\[\] \n\t]*)}/g; const typeMatches = [...schema.matchAll(typeCapture)]; for (const interfaceName of allInterfaces) { @@ -461,7 +461,7 @@ function resolveInterfaces( const bodiesOfInterfacesStr = bodiesOfInterfaces .filter((x) => x) - .reduce((acc: string, x: string) => acc + "\n" + x); + .reduce((acc: string, x: string) => acc + "\n" + x, ""); schema = schema.replace( implementationTypeCapture, diff --git a/packages/test-cases/cases/apis/implementations/test-api/mutation/index.ts b/packages/test-cases/cases/apis/implementations/test-api/mutation/index.ts new file mode 100644 index 0000000000..103f9254e1 --- /dev/null +++ b/packages/test-cases/cases/apis/implementations/test-api/mutation/index.ts @@ -0,0 +1,9 @@ +import { Input_mutationMethod, Input_abstractMutationMethod } from "./w3"; + +export function mutationMethod(input: Input_mutationMethod): u8 { + return input.arg; +} + +export function abstractMutationMethod(input: Input_abstractMutationMethod): u8 { + return input.arg; +} diff --git a/packages/test-cases/cases/apis/implementations/test-api/mutation/schema.graphql b/packages/test-cases/cases/apis/implementations/test-api/mutation/schema.graphql new file mode 100644 index 0000000000..33c51914d6 --- /dev/null +++ b/packages/test-cases/cases/apis/implementations/test-api/mutation/schema.graphql @@ -0,0 +1,7 @@ +#import { Mutation } into Interface from "w3://ens/interface.eth" + +type Mutation implements Interface_Mutation { + mutationMethod( + arg: UInt8! + ): UInt8! +} diff --git a/packages/test-cases/cases/apis/implementations/test-api/query/index.ts b/packages/test-cases/cases/apis/implementations/test-api/query/index.ts new file mode 100644 index 0000000000..5a725e8abf --- /dev/null +++ b/packages/test-cases/cases/apis/implementations/test-api/query/index.ts @@ -0,0 +1,9 @@ +import { Input_queryMethod, Input_abstractQueryMethod, ImplementationType } from "./w3"; + +export function queryMethod(input: Input_queryMethod): ImplementationType { + return input.arg; +} + +export function abstractQueryMethod(input: Input_abstractQueryMethod): String { + return input.arg.str; +} diff --git a/packages/test-cases/cases/apis/implementations/test-api/query/schema.graphql b/packages/test-cases/cases/apis/implementations/test-api/query/schema.graphql new file mode 100644 index 0000000000..72567bd200 --- /dev/null +++ b/packages/test-cases/cases/apis/implementations/test-api/query/schema.graphql @@ -0,0 +1,11 @@ +#import { Query, InterfaceType } into Interface from "w3://ens/interface.eth" + +type Query implements Interface_Query { + queryMethod( + arg: ImplementationType! + ): ImplementationType! +} + +type ImplementationType implements Interface_InterfaceType { + str: String! +} \ No newline at end of file diff --git a/packages/test-cases/cases/apis/implementations/test-api/web3api.yaml b/packages/test-cases/cases/apis/implementations/test-api/web3api.yaml new file mode 100644 index 0000000000..991899e89d --- /dev/null +++ b/packages/test-cases/cases/apis/implementations/test-api/web3api.yaml @@ -0,0 +1,16 @@ +format: 0.0.1-prealpha.1 +mutation: + schema: + file: ./mutation/schema.graphql + module: + language: wasm/assemblyscript + file: ./mutation/index.ts +query: + schema: + file: ./query/schema.graphql + module: + language: wasm/assemblyscript + file: ./query/index.ts +import_redirects: + - uri: w3://ens/interface.eth + schema: ../test-interface/build/schema.graphql \ No newline at end of file diff --git a/packages/test-cases/cases/apis/implementations/test-interface/mutation/schema.graphql b/packages/test-cases/cases/apis/implementations/test-interface/mutation/schema.graphql new file mode 100644 index 0000000000..778d28638e --- /dev/null +++ b/packages/test-cases/cases/apis/implementations/test-interface/mutation/schema.graphql @@ -0,0 +1,5 @@ +type Mutation { + abstractMutationMethod( + arg: UInt8! + ): UInt8! +} diff --git a/packages/test-cases/cases/apis/implementations/test-interface/query/schema.graphql b/packages/test-cases/cases/apis/implementations/test-interface/query/schema.graphql new file mode 100644 index 0000000000..c0a4af4da9 --- /dev/null +++ b/packages/test-cases/cases/apis/implementations/test-interface/query/schema.graphql @@ -0,0 +1,13 @@ +type Query { + abstractQueryMethod( + arg: Argument! + ): String! +} + +type Argument { + str: String! +} + +type InterfaceType { + uint8: UInt8! +} \ No newline at end of file diff --git a/packages/test-cases/cases/apis/implementations/test-interface/web3api.yaml b/packages/test-cases/cases/apis/implementations/test-interface/web3api.yaml new file mode 100644 index 0000000000..d3f28a21fc --- /dev/null +++ b/packages/test-cases/cases/apis/implementations/test-interface/web3api.yaml @@ -0,0 +1,8 @@ +format: 0.0.1-prealpha.1 +interface: true +mutation: + schema: + file: ./mutation/schema.graphql +query: + schema: + file: ./query/schema.graphql From 7e17d157d1d0078cccc26f9d682cac312254572a Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Wed, 7 Jul 2021 17:26:25 -0500 Subject: [PATCH 103/112] implemented -> implements --- .../src/__tests__/Web3ApiClient.spec.ts | 24 +++++++------------ packages/js/core/src/__tests__/Plugin.spec.ts | 12 ++++------ .../js/core/src/__tests__/resolve-uri.spec.ts | 6 ++--- packages/js/core/src/types/Plugin.ts | 7 ++---- packages/js/plugins/ens/src/manifest.ts | 5 ++-- packages/js/plugins/ethereum/src/manifest.ts | 3 +-- .../js/plugins/graph-node/src/manifest.ts | 3 +-- packages/js/plugins/http/src/manifest.ts | 3 +-- packages/js/plugins/ipfs/src/manifest.ts | 3 +-- packages/js/plugins/logger/src/manifest.ts | 5 ++-- .../plugin/typescript/src/manifest.ts | 3 +-- 11 files changed, 26 insertions(+), 48 deletions(-) diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index b69e928494..6dff7e9f96 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -120,8 +120,7 @@ describe("Web3ApiClient", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implemented: [], - imported: [], + implements: [], } } } @@ -206,8 +205,7 @@ describe("Web3ApiClient", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implemented: [], - imported: [], + implements: [], } } } @@ -274,8 +272,7 @@ describe("Web3ApiClient", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implemented: [], - imported: [], + implements: [], } } }, @@ -285,8 +282,7 @@ describe("Web3ApiClient", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implemented: [], - imported: [], + implements: [], } } } @@ -329,8 +325,7 @@ describe("Web3ApiClient", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implemented: [], - imported: [], + implements: [], } } } @@ -363,8 +358,7 @@ describe("Web3ApiClient", () => { factory: () => ({} as Plugin), manifest: { schema: '', - implemented: [new Uri(interfaceUri)], - imported: [], + implements: [new Uri(interfaceUri)], } } } @@ -403,8 +397,7 @@ describe("Web3ApiClient", () => { factory: () => ({} as Plugin), manifest: { schema: '', - implemented: [], - imported: [], + implements: [], } } } @@ -1335,8 +1328,7 @@ describe("Web3ApiClient", () => { factory: () => ({} as Plugin), manifest: { schema: schemaStr, - implemented: [], - imported: [], + implements: [], } } } diff --git a/packages/js/core/src/__tests__/Plugin.spec.ts b/packages/js/core/src/__tests__/Plugin.spec.ts index 06fef68784..ba0b601c0a 100644 --- a/packages/js/core/src/__tests__/Plugin.spec.ts +++ b/packages/js/core/src/__tests__/Plugin.spec.ts @@ -4,11 +4,10 @@ import { PluginModules, PluginManifest, Uri, - createSchemaDocument, } from ".."; const testPluginManifest: PluginManifest = { - schema: createSchemaDocument(` + schema: ` type Query { testQuery: Number! } @@ -16,9 +15,8 @@ const testPluginManifest: PluginManifest = { type Mutation { testMutation: Boolean! } - `), - imported: [new Uri("host/path")], - implemented: [new Uri("host2/path2")], + `, + implements: [new Uri("host2/path2")], }; class TestPlugin extends Plugin { @@ -44,8 +42,8 @@ describe("Plugin", () => { it("sanity", () => { const modules = plugin.getModules({} as Client); - expect(testPluginManifest.implemented.length).toBe(1); + expect(testPluginManifest.implements.length).toBe(1); expect(modules.mutation).toBeTruthy(); - expect(modules.mutation.testMutation).toBeTruthy(); + expect(modules.mutation?.testMutation).toBeTruthy(); }); }); diff --git a/packages/js/core/src/__tests__/resolve-uri.spec.ts b/packages/js/core/src/__tests__/resolve-uri.spec.ts index 0a8232289f..564a1a5c1e 100644 --- a/packages/js/core/src/__tests__/resolve-uri.spec.ts +++ b/packages/js/core/src/__tests__/resolve-uri.spec.ts @@ -116,8 +116,7 @@ describe("resolveUri", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implemented: [coreInterfaceUris.apiResolver], - imported: [], + implements: [coreInterfaceUris.apiResolver], }, }, }, @@ -321,8 +320,7 @@ describe("resolveUri", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implemented: [coreInterfaceUris.apiResolver], - imported: [], + implements: [coreInterfaceUris.apiResolver], }, }, }, diff --git a/packages/js/core/src/types/Plugin.ts b/packages/js/core/src/types/Plugin.ts index 89f08e64a3..c533828af4 100644 --- a/packages/js/core/src/types/Plugin.ts +++ b/packages/js/core/src/types/Plugin.ts @@ -5,11 +5,8 @@ export interface PluginManifest { /** The API's schema */ schema: string; - /** All API dependencies imported by this plugin. */ - imported: Uri[]; - - /** All abstract APIs implemented by this plugin. */ - implemented: Uri[]; + /** All interface schemas implemented by this plugin. */ + implements: Uri[]; } /** diff --git a/packages/js/plugins/ens/src/manifest.ts b/packages/js/plugins/ens/src/manifest.ts index fb0f4c3512..d714cd4fcc 100644 --- a/packages/js/plugins/ens/src/manifest.ts +++ b/packages/js/plugins/ens/src/manifest.ts @@ -1,4 +1,4 @@ -import { PluginManifest, Uri, coreInterfaceUris } from "@web3api/core-js"; +import { PluginManifest, coreInterfaceUris } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql @@ -24,6 +24,5 @@ type ApiResolver_MaybeUriOrManifest { uri: String manifest: String }`, - implemented: [coreInterfaceUris.apiResolver], - imported: [new Uri("ens/ethereum.web3api.eth")], + implements: [coreInterfaceUris.apiResolver], }; diff --git a/packages/js/plugins/ethereum/src/manifest.ts b/packages/js/plugins/ethereum/src/manifest.ts index b0829e20de..c8177de8e3 100644 --- a/packages/js/plugins/ethereum/src/manifest.ts +++ b/packages/js/plugins/ethereum/src/manifest.ts @@ -33,6 +33,5 @@ type Connection { node: String networkNameOrChainId: String }`, - implemented: [], - imported: [], + implements: [], }; diff --git a/packages/js/plugins/graph-node/src/manifest.ts b/packages/js/plugins/graph-node/src/manifest.ts index 4a0aa8f7b8..2530c6c50e 100644 --- a/packages/js/plugins/graph-node/src/manifest.ts +++ b/packages/js/plugins/graph-node/src/manifest.ts @@ -12,6 +12,5 @@ type Query { """TODO: support JSON type as base type?""" """I think this would be helpful for dynamic data""" }`, - implemented: [], - imported: [], + implements: [], }; diff --git a/packages/js/plugins/http/src/manifest.ts b/packages/js/plugins/http/src/manifest.ts index d54fe1aa11..39d6002248 100644 --- a/packages/js/plugins/http/src/manifest.ts +++ b/packages/js/plugins/http/src/manifest.ts @@ -43,6 +43,5 @@ type Mutation { post(url: String!, request: Request): Response } `, - implemented: [], - imported: [], + implements: [], }; diff --git a/packages/js/plugins/ipfs/src/manifest.ts b/packages/js/plugins/ipfs/src/manifest.ts index 87b3813ccc..c8db4942d7 100644 --- a/packages/js/plugins/ipfs/src/manifest.ts +++ b/packages/js/plugins/ipfs/src/manifest.ts @@ -54,6 +54,5 @@ type ApiResolver_MaybeUriOrManifest { uri: String manifest: String }`, - implemented: [coreInterfaceUris.apiResolver], - imported: [], + implements: [coreInterfaceUris.apiResolver], }; diff --git a/packages/js/plugins/logger/src/manifest.ts b/packages/js/plugins/logger/src/manifest.ts index 3124e16806..03cdc5de73 100644 --- a/packages/js/plugins/logger/src/manifest.ts +++ b/packages/js/plugins/logger/src/manifest.ts @@ -1,4 +1,4 @@ -import { PluginManifest, Uri } from "@web3api/core-js"; +import { PluginManifest, coreInterfaceUris } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql @@ -21,6 +21,5 @@ type Query { ): Boolean! } `, - implemented: [new Uri("w3://ens/logger.core.web3api.eth")], - imported: [], + implements: [coreInterfaceUris.logger], }; diff --git a/packages/templates/plugin/typescript/src/manifest.ts b/packages/templates/plugin/typescript/src/manifest.ts index 27e1525e2f..ebcc8802cd 100644 --- a/packages/templates/plugin/typescript/src/manifest.ts +++ b/packages/templates/plugin/typescript/src/manifest.ts @@ -11,6 +11,5 @@ type Query { type Mutation { sampleMutation(data: Bytes!): Boolean! }`, - implemented: [], - imported: [], + implements: [], }; From 5d9ecdd0a70080e85cab8ed8175456c0fe104170 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Wed, 7 Jul 2021 17:45:36 -0500 Subject: [PATCH 104/112] clean command --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1b36126690..cded213ed9 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "scripts": { "reset": "yarn clean && yarn && yarn build", - "clean": "npx rimraf ./**/node_modules ./**/build ./**/coverage", + "clean": "npx rimraf ./**/node_modules ./**/build ./**/coverage ./**/.w3", "build": "lerna run build --no-private --ignore @web3api/cli* --ignore @web3api/react && lerna run build --scope @web3api/client-js --scope @web3api/react && lerna run build --scope @web3api/cli", "lint": "lerna run lint", "lint:fix": "lerna run lint -- --fix", From 65d7d78b0ee8407d3409203f42cb0150bebfda09 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 8 Jul 2021 14:17:02 -0500 Subject: [PATCH 105/112] console API uses core logger interface --- packages/apis/console/README.md | 12 ++++++------ packages/apis/console/src/query/schema.graphql | 2 +- packages/apis/console/web3api.yaml | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/apis/console/README.md b/packages/apis/console/README.md index 83b183494f..5872533075 100644 --- a/packages/apis/console/README.md +++ b/packages/apis/console/README.md @@ -1,13 +1,13 @@ # Console Web3API -Calls log on logger plugin at uri `w3://ens/js-logger.web3api.eth`. Default logger logs to console, but can be overridden with redirect to custom logger web3api implementation. +Calls log on logger plugin at uri `w3://ens/logger.core.web3api.eth`. Default logger logs to console, but can be overridden with redirect to custom logger web3api implementation. -### Log levels +### Log Methods -- DEBUG -- INFO -- WARN -- ERROR +- debug +- info +- warn +- error ## Example diff --git a/packages/apis/console/src/query/schema.graphql b/packages/apis/console/src/query/schema.graphql index 48ad56181a..c1288ac945 100644 --- a/packages/apis/console/src/query/schema.graphql +++ b/packages/apis/console/src/query/schema.graphql @@ -1,4 +1,4 @@ -#import { Query, LogLevel } into Logger from "w3://ens/js-logger.web3api.eth" +#import { Query, LogLevel } into Logger from "w3://ens/logger.core.web3api.eth" type Query { debug( diff --git a/packages/apis/console/web3api.yaml b/packages/apis/console/web3api.yaml index 402658d960..905495a18a 100644 --- a/packages/apis/console/web3api.yaml +++ b/packages/apis/console/web3api.yaml @@ -8,5 +8,5 @@ query: language: wasm/assemblyscript file: ./src/query/index.ts import_redirects: - - uri: w3://ens/js-logger.web3api.eth + - uri: w3://ens/logger.core.web3api.eth schema: ../../core-interfaces/logger/schema.graphql From e9170ed4bd9e1944d7dcaf789bb83573a6fe8734 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 8 Jul 2021 20:48:51 -0500 Subject: [PATCH 106/112] rename api-resolver to uri-resolver --- packages/apis/console/web3api.yaml | 2 +- .../{api-resolver => uri-resolver}/.gitignore | 0 .../{api-resolver => uri-resolver}/.nvmrc | 0 .../{api-resolver => uri-resolver}/README.md | 2 +- .../package.json | 4 +- .../src/query.graphql | 0 .../web3api.yaml | 0 packages/js/client/src/Web3ApiClient.ts | 8 +- .../src/__tests__/Web3ApiClient.spec.ts | 2 +- .../js/client/src/default-client-config.ts | 2 +- packages/js/client/src/wasm/WasmWeb3Api.ts | 16 ++-- .../js/core/src/__tests__/resolve-uri.spec.ts | 38 +++++----- packages/js/core/src/algorithms/index.ts | 3 +- .../js/core/src/algorithms/resolve-uri.ts | 37 +++++----- packages/js/core/src/apis/index.ts | 2 - packages/js/core/src/index.ts | 1 - .../src/interfaces/core-interface-uris.ts | 2 +- packages/js/core/src/interfaces/index.ts | 3 + .../uri-resolver.ts} | 4 +- packages/js/core/src/types/Invoke.ts | 4 + packages/js/core/src/types/Query.ts | 7 ++ packages/js/plugins/ens/schema.graphql | 66 +++++++++++++++-- packages/js/plugins/ens/src/manifest.ts | 73 ++++++++++++++++--- packages/js/plugins/ens/src/resolvers.ts | 2 +- packages/js/plugins/ipfs/schema.graphql | 66 +++++++++++++++-- packages/js/plugins/ipfs/src/manifest.ts | 72 +++++++++++++++--- packages/js/plugins/ipfs/src/resolvers.ts | 2 +- packages/js/plugins/logger/README.md | 8 +- 28 files changed, 328 insertions(+), 98 deletions(-) rename packages/core-interfaces/{api-resolver => uri-resolver}/.gitignore (100%) rename packages/core-interfaces/{api-resolver => uri-resolver}/.nvmrc (100%) rename packages/core-interfaces/{api-resolver => uri-resolver}/README.md (84%) rename packages/core-interfaces/{api-resolver => uri-resolver}/package.json (83%) rename packages/core-interfaces/{api-resolver => uri-resolver}/src/query.graphql (100%) rename packages/core-interfaces/{api-resolver => uri-resolver}/web3api.yaml (100%) delete mode 100644 packages/js/core/src/apis/index.ts rename packages/js/core/src/{apis/api-resolver.ts => interfaces/uri-resolver.ts} (93%) diff --git a/packages/apis/console/web3api.yaml b/packages/apis/console/web3api.yaml index 905495a18a..2557fdb4aa 100644 --- a/packages/apis/console/web3api.yaml +++ b/packages/apis/console/web3api.yaml @@ -9,4 +9,4 @@ query: file: ./src/query/index.ts import_redirects: - uri: w3://ens/logger.core.web3api.eth - schema: ../../core-interfaces/logger/schema.graphql + schema: ../../core-interfaces/logger/src/schema.graphql diff --git a/packages/core-interfaces/api-resolver/.gitignore b/packages/core-interfaces/uri-resolver/.gitignore similarity index 100% rename from packages/core-interfaces/api-resolver/.gitignore rename to packages/core-interfaces/uri-resolver/.gitignore diff --git a/packages/core-interfaces/api-resolver/.nvmrc b/packages/core-interfaces/uri-resolver/.nvmrc similarity index 100% rename from packages/core-interfaces/api-resolver/.nvmrc rename to packages/core-interfaces/uri-resolver/.nvmrc diff --git a/packages/core-interfaces/api-resolver/README.md b/packages/core-interfaces/uri-resolver/README.md similarity index 84% rename from packages/core-interfaces/api-resolver/README.md rename to packages/core-interfaces/uri-resolver/README.md index 7fe082d7a6..299a44873b 100644 --- a/packages/core-interfaces/api-resolver/README.md +++ b/packages/core-interfaces/uri-resolver/README.md @@ -1,4 +1,4 @@ -# Web3API Resolver Interface +# URI Resolver Interface # How To Run diff --git a/packages/core-interfaces/api-resolver/package.json b/packages/core-interfaces/uri-resolver/package.json similarity index 83% rename from packages/core-interfaces/api-resolver/package.json rename to packages/core-interfaces/uri-resolver/package.json index b6c4154bd8..e4decc9047 100644 --- a/packages/core-interfaces/api-resolver/package.json +++ b/packages/core-interfaces/uri-resolver/package.json @@ -1,6 +1,6 @@ { - "name": "resolver-interface", - "description": "Web3API Resolver Interface", + "name": "uri-resolver-interface", + "description": "URI Resolver Interface", "private": true, "version": "0.0.1-prealpha.28", "scripts": { diff --git a/packages/core-interfaces/api-resolver/src/query.graphql b/packages/core-interfaces/uri-resolver/src/query.graphql similarity index 100% rename from packages/core-interfaces/api-resolver/src/query.graphql rename to packages/core-interfaces/uri-resolver/src/query.graphql diff --git a/packages/core-interfaces/api-resolver/web3api.yaml b/packages/core-interfaces/uri-resolver/web3api.yaml similarity index 100% rename from packages/core-interfaces/api-resolver/web3api.yaml rename to packages/core-interfaces/uri-resolver/web3api.yaml diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index a069b6e8eb..868c1021d8 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -124,7 +124,9 @@ export class Web3ApiClient implements Client { public async query< TData extends Record = Record, TVariables extends Record = Record - >(options: QueryApiOptions): Promise>; + >( + options: QueryApiOptions + ): Promise>; public async query< TData extends Record = Record, TVariables extends Record = Record @@ -261,8 +263,8 @@ export class Web3ApiClient implements Client { this.plugins(), this.interfaces(), (uri: Uri, plugin: PluginPackage) => new PluginWeb3Api(uri, plugin), - (uri: Uri, manifest: Web3ApiManifest, apiResolver: Uri) => - new WasmWeb3Api(uri, manifest, apiResolver) + (uri: Uri, manifest: Web3ApiManifest, uriResolver: Uri) => + new WasmWeb3Api(uri, manifest, uriResolver) ); if (!api) { diff --git a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts index 919aaf8cf6..199d94422e 100644 --- a/packages/js/client/src/__tests__/Web3ApiClient.spec.ts +++ b/packages/js/client/src/__tests__/Web3ApiClient.spec.ts @@ -68,7 +68,7 @@ describe("Web3ApiClient", () => { client.interfaces() ).toStrictEqual([ { - interface: coreInterfaceUris.apiResolver, + interface: coreInterfaceUris.uriResolver, implementations: [ new Uri("w3://ens/ipfs.web3api.eth"), new Uri("w3://ens/ens.web3api.eth") diff --git a/packages/js/client/src/default-client-config.ts b/packages/js/client/src/default-client-config.ts index 1d339786c5..584ed9025c 100644 --- a/packages/js/client/src/default-client-config.ts +++ b/packages/js/client/src/default-client-config.ts @@ -51,7 +51,7 @@ export const getDefaultClientConfig = Tracer.traceFunc( ], interfaces: [ { - interface: coreInterfaceUris.apiResolver, + interface: coreInterfaceUris.uriResolver, implementations: [ new Uri("w3://ens/ipfs.web3api.eth"), new Uri("w3://ens/ens.web3api.eth"), diff --git a/packages/js/client/src/wasm/WasmWeb3Api.ts b/packages/js/client/src/wasm/WasmWeb3Api.ts index 650fceeece..0f5f3c24bf 100644 --- a/packages/js/client/src/wasm/WasmWeb3Api.ts +++ b/packages/js/client/src/wasm/WasmWeb3Api.ts @@ -17,7 +17,7 @@ import { Web3ApiManifest, Uri, Client, - ApiResolver, + UriResolver, InvokableModules, } from "@web3api/core-js"; import * as MsgPack from "@msgpack/msgpack"; @@ -43,7 +43,7 @@ export class WasmWeb3Api extends Api { constructor( private _uri: Uri, private _manifest: Web3ApiManifest, - private _apiResolver: Uri + private _uriResolver: Uri ) { super(); @@ -51,7 +51,7 @@ export class WasmWeb3Api extends Api { Tracer.setAttribute("input", { uri: this._uri, manifest: this._manifest, - apiResolver: this._apiResolver, + uriResolver: this._uriResolver, }); Tracer.endSpan(); } @@ -343,9 +343,9 @@ export class WasmWeb3Api extends Api { throw Error(`WasmWeb3Api: No module was found.`); } - const { data, error } = await ApiResolver.Query.getFile( + const { data, error } = await UriResolver.Query.getFile( client, - this._apiResolver, + this._uriResolver, this.combinePaths(this._uri.path, module.schema) ); @@ -404,14 +404,14 @@ export class WasmWeb3Api extends Api { ); } - const { data, error } = await ApiResolver.Query.getFile( + const { data, error } = await UriResolver.Query.getFile( client, - this._apiResolver, + this._uriResolver, this.combinePaths(this._uri.path, moduleManifest.module) ); if (error) { - throw Error(`ApiResolver.Query.getFile Failed: ${error}`); + throw Error(`UriResolver.Query.getFile Failed: ${error}`); } // If nothing is returned, the module was not found diff --git a/packages/js/core/src/__tests__/resolve-uri.spec.ts b/packages/js/core/src/__tests__/resolve-uri.spec.ts index 9c0d1ba4d6..a107575b52 100644 --- a/packages/js/core/src/__tests__/resolve-uri.spec.ts +++ b/packages/js/core/src/__tests__/resolve-uri.spec.ts @@ -1,6 +1,6 @@ import { Api, - ApiResolver, + UriResolver, Client, InvokeApiOptions, InvokeApiResult, @@ -24,7 +24,7 @@ describe("resolveUri", () => { query: < TData extends Record = Record, TVariables extends Record = Record, - >(_options: QueryApiOptions): Promise> => { + >(_options: QueryApiOptions): Promise> => { return Promise.resolve({ data: ({ foo: "foo", @@ -32,10 +32,14 @@ describe("resolveUri", () => { }); }, invoke: ( - options: InvokeApiOptions + options: InvokeApiOptions ): Promise> => { + let uri = options.uri; + if (Uri.isUri(uri)) { + uri = uri.uri; + } return Promise.resolve({ - data: apis[options.uri]?.[options.module]?.[options.method]( + data: apis[uri]?.[options.module]?.[options.method]( options.input as Record, {} as Client ) as TData, @@ -55,13 +59,13 @@ describe("resolveUri", () => { }; }; - const createApi = (uri: Uri, manifest: Web3ApiManifest, apiResolver: Uri): Api => { + const createApi = (uri: Uri, manifest: Web3ApiManifest, uriResolver: Uri): Api => { return { invoke: () => Promise.resolve({ uri, manifest, - apiResolver, + uriResolver, } as InvokeApiResult), getSchema: (_client: Client): Promise => Promise.resolve("") @@ -116,7 +120,7 @@ describe("resolveUri", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implements: [coreInterfaceUris.apiResolver], + implements: [coreInterfaceUris.uriResolver], }, }, }, @@ -124,7 +128,7 @@ describe("resolveUri", () => { const interfaces: InterfaceImplementations[] = [ { - interface: coreInterfaceUris.apiResolver, + interface: coreInterfaceUris.uriResolver, implementations: [ new Uri("ens/ens"), new Uri("ens/ipfs"), @@ -143,7 +147,7 @@ describe("resolveUri", () => { const api = new Uri("w3://ens/ens"); const file = new Uri("w3/some-file"); const path = "w3/some-path"; - const query = ApiResolver.Query; + const query = UriResolver.Query; const uri = new Uri("w3/some-uri"); expect(query.tryResolveUri(client(apis), api, uri)).toBeDefined(); @@ -172,11 +176,11 @@ describe("resolveUri", () => { manifest: { format: "0.0.1-prealpha.3" }, - apiResolver: new Uri("ens/ipfs"), + uriResolver: new Uri("ens/ipfs"), }); }); - it("uses a plugin that implements api-resolver", async () => { + it("uses a plugin that implements uri-resolver", async () => { const result = await resolveUri( new Uri("my/something-different"), client(apis), @@ -198,11 +202,11 @@ describe("resolveUri", () => { manifest: { format: "0.0.1-prealpha.3" }, - apiResolver: new Uri("ens/my-plugin"), + uriResolver: new Uri("ens/my-plugin"), }); }); - it("works when direct query a Web3API that implements the api-resolver", async () => { + it("works when direct query a Web3API that implements the uri-resolver", async () => { const result = await resolveUri( new Uri("ens/ens"), client(apis), @@ -225,11 +229,11 @@ describe("resolveUri", () => { format: "0.0.1-prealpha.3", dog: "cat" }, - apiResolver: new Uri("ens/ipfs"), + uriResolver: new Uri("ens/ipfs"), }); }); - it("works when direct query a plugin Web3API that implements the api-resolver", async () => { + it("works when direct query a plugin Web3API that implements the uri-resolver", async () => { const result = await resolveUri( new Uri("my/something-different"), client(apis), @@ -251,7 +255,7 @@ describe("resolveUri", () => { manifest: { format: "0.0.1-prealpha.3" }, - apiResolver: new Uri("ens/my-plugin"), + uriResolver: new Uri("ens/my-plugin"), }); }); @@ -320,7 +324,7 @@ describe("resolveUri", () => { factory: () => ({} as Plugin), manifest: { schema: "", - implements: [coreInterfaceUris.apiResolver], + implements: [coreInterfaceUris.uriResolver], }, }, }, diff --git a/packages/js/core/src/algorithms/index.ts b/packages/js/core/src/algorithms/index.ts index 79935f300b..7c3c240d99 100644 --- a/packages/js/core/src/algorithms/index.ts +++ b/packages/js/core/src/algorithms/index.ts @@ -1,5 +1,6 @@ +export * from "./apply-redirects"; export * from "./filter-results"; +export * from "./find-plugin-package"; export * from "./get-implementations"; export * from "./parse-query"; export * from "./resolve-uri"; -export * from "./apply-redirects"; diff --git a/packages/js/core/src/algorithms/resolve-uri.ts b/packages/js/core/src/algorithms/resolve-uri.ts index 4c4d07d8b0..d4bb9f6a7c 100644 --- a/packages/js/core/src/algorithms/resolve-uri.ts +++ b/packages/js/core/src/algorithms/resolve-uri.ts @@ -8,11 +8,10 @@ import { UriRedirect, } from "../types"; import { Web3ApiManifest, deserializeWeb3ApiManifest } from "../manifest"; -import * as ApiResolver from "../apis/api-resolver"; import { applyRedirects } from "./apply-redirects"; import { findPluginPackage } from "./find-plugin-package"; import { getImplementations } from "./get-implementations"; -import { coreInterfaceUris } from "../interfaces"; +import { coreInterfaceUris, UriResolver } from "../interfaces"; import { Tracer } from "@web3api/tracing-js"; @@ -25,7 +24,7 @@ export const resolveUri = Tracer.traceFunc( plugins: readonly PluginRegistration[], interfaces: readonly InterfaceImplementations[], createPluginApi: (uri: Uri, plugin: PluginPackage) => Api, - createApi: (uri: Uri, manifest: Web3ApiManifest, apiResolver: Uri) => Api, + createApi: (uri: Uri, manifest: Web3ApiManifest, uriResolver: Uri) => Api, noValidate?: boolean ): Promise => { const finalRedirectedUri = applyRedirects(uri, redirects); @@ -41,12 +40,12 @@ export const resolveUri = Tracer.traceFunc( // The final URI has been resolved, let's now resolve the Web3API package const uriResolverImplementations = getImplementations( - coreInterfaceUris.apiResolver, + coreInterfaceUris.uriResolver, redirects, interfaces ); - return await resolveUriWithApiResolvers( + return await resolveUriWithUriResolvers( finalRedirectedUri, uriResolverImplementations, client, @@ -56,11 +55,11 @@ export const resolveUri = Tracer.traceFunc( } ); -const resolveUriWithApiResolvers = async ( +const resolveUriWithUriResolvers = async ( uri: Uri, - apiResolverImplementationUris: Uri[], + uriResolverImplementationUris: Uri[], client: Client, - createApi: (uri: Uri, manifest: Web3ApiManifest, apiResolver: Uri) => Api, + createApi: (uri: Uri, manifest: Web3ApiManifest, uriResolver: Uri) => Api, noValidate?: boolean ): Promise => { let resolvedUri = uri; @@ -90,11 +89,11 @@ const resolveUriWithApiResolvers = async ( } }; - const tryResolveUriWithApiResolver = async ( + const tryResolveUriWithUriResolver = async ( uri: Uri, uriResolver: Uri - ): Promise => { - const { data } = await ApiResolver.Query.tryResolveUri( + ): Promise => { + const { data } = await UriResolver.Query.tryResolveUri( client, uriResolver, uri @@ -109,12 +108,12 @@ const resolveUriWithApiResolvers = async ( return data; }; - // Iterate through all api-resolver implementations, + // Iterate through all uri-resolver implementations, // iteratively resolving the URI until we reach the Web3API manifest - for (let i = 0; i < apiResolverImplementationUris.length; ++i) { - const uriResolver = apiResolverImplementationUris[i]; + for (let i = 0; i < uriResolverImplementationUris.length; ++i) { + const uriResolver = uriResolverImplementationUris[i]; - const result = await tryResolveUriWithApiResolver(resolvedUri, uriResolver); + const result = await tryResolveUriWithUriResolver(resolvedUri, uriResolver); if (!result) { continue; @@ -125,7 +124,7 @@ const resolveUriWithApiResolvers = async ( const convertedUri = new Uri(result.uri); trackUriRedirect(convertedUri.uri, uriResolver.uri); - Tracer.addEvent("api-resolver-redirect", { + Tracer.addEvent("uri-resolver-redirect", { from: resolvedUri.uri, to: convertedUri.uri, }); @@ -143,8 +142,8 @@ const resolveUriWithApiResolvers = async ( return Tracer.traceFunc( "resolveUri: createApi", - (uri: Uri, manifest: Web3ApiManifest, apiResolver: Uri) => - createApi(uri, manifest, apiResolver) + (uri: Uri, manifest: Web3ApiManifest, uriResolver: Uri) => + createApi(uri, manifest, uriResolver) )(resolvedUri, manifest, uriResolver); } } @@ -153,6 +152,6 @@ const resolveUriWithApiResolvers = async ( throw Error( `No Web3API found at URI: ${resolvedUri.uri}` + `\nResolution Path: ${JSON.stringify(uriHistory, null, 2)}` + - `\nResolvers Used: ${apiResolverImplementationUris}` + `\nResolvers Used: ${uriResolverImplementationUris}` ); }; diff --git a/packages/js/core/src/apis/index.ts b/packages/js/core/src/apis/index.ts deleted file mode 100644 index 08399cc82b..0000000000 --- a/packages/js/core/src/apis/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import * as ApiResolver from "./api-resolver"; -export { ApiResolver }; diff --git a/packages/js/core/src/index.ts b/packages/js/core/src/index.ts index 78f6903cc7..d11c4b6eaf 100644 --- a/packages/js/core/src/index.ts +++ b/packages/js/core/src/index.ts @@ -1,5 +1,4 @@ export * from "./types"; export * from "./algorithms"; -export * from "./apis"; export * from "./interfaces"; export * from "./manifest"; diff --git a/packages/js/core/src/interfaces/core-interface-uris.ts b/packages/js/core/src/interfaces/core-interface-uris.ts index bfe595a23f..c1e9f25ff4 100644 --- a/packages/js/core/src/interfaces/core-interface-uris.ts +++ b/packages/js/core/src/interfaces/core-interface-uris.ts @@ -1,6 +1,6 @@ import { Uri } from "../"; export const coreInterfaceUris = { - apiResolver: new Uri("w3://ens/api-resolver.core.web3api.eth"), + uriResolver: new Uri("w3://ens/uri-resolver.core.web3api.eth"), logger: new Uri("w3://ens/logger.core.web3api.eth"), }; diff --git a/packages/js/core/src/interfaces/index.ts b/packages/js/core/src/interfaces/index.ts index c10a2e0e65..6f5e6e96ae 100644 --- a/packages/js/core/src/interfaces/index.ts +++ b/packages/js/core/src/interfaces/index.ts @@ -1 +1,4 @@ +import * as UriResolver from "./uri-resolver"; + +export { UriResolver }; export * from "./core-interface-uris"; diff --git a/packages/js/core/src/apis/api-resolver.ts b/packages/js/core/src/interfaces/uri-resolver.ts similarity index 93% rename from packages/js/core/src/apis/api-resolver.ts rename to packages/js/core/src/interfaces/uri-resolver.ts index 93b37c5a2f..2e60dffc60 100644 --- a/packages/js/core/src/apis/api-resolver.ts +++ b/packages/js/core/src/interfaces/uri-resolver.ts @@ -11,7 +11,7 @@ export interface MaybeUriOrManifest { // eslint-disable-next-line @typescript-eslint/naming-convention export const Query = { tryResolveUri: Tracer.traceFunc( - "core: api-resolver: tryResolveUri", + "core: uri-resolver: tryResolveUri", async ( client: Client, api: Uri, @@ -29,7 +29,7 @@ export const Query = { } ), getFile: Tracer.traceFunc( - "core: api-resolver: getFile", + "core: uri-resolver: getFile", async ( client: Client, api: Uri, diff --git a/packages/js/core/src/types/Invoke.ts b/packages/js/core/src/types/Invoke.ts index 9d77c016b3..9eff620292 100644 --- a/packages/js/core/src/types/Invoke.ts +++ b/packages/js/core/src/types/Invoke.ts @@ -56,4 +56,8 @@ export interface InvokeHandler { invoke( options: InvokeApiOptions ): Promise>; + + invoke( + options: InvokeApiOptions + ): Promise>; } diff --git a/packages/js/core/src/types/Query.ts b/packages/js/core/src/types/Query.ts index 0c149c35ea..20e8aa60ea 100644 --- a/packages/js/core/src/types/Query.ts +++ b/packages/js/core/src/types/Query.ts @@ -85,4 +85,11 @@ export interface QueryHandler { >( options: QueryApiOptions ): Promise>; + + query< + TData extends Record = Record, + TVariables extends Record = Record + >( + options: QueryApiOptions + ): Promise>; } diff --git a/packages/js/plugins/ens/schema.graphql b/packages/js/plugins/ens/schema.graphql index c1d9733fa9..95d45e220d 100644 --- a/packages/js/plugins/ens/schema.graphql +++ b/packages/js/plugins/ens/schema.graphql @@ -1,20 +1,72 @@ -# TODO: should import and "implements" the api-resolver core-api schema -# https://github.com/Web3-API/monorepo/issues/75 +### Web3API Header START ### +scalar UInt +scalar UInt8 +scalar UInt16 +scalar UInt32 +scalar UInt64 +scalar Int +scalar Int8 +scalar Int16 +scalar Int32 +scalar Int64 +scalar Bytes +scalar BigInt -type Query { +directive @imported( + uri: String! + namespace: String! + nativeType: String! +) on OBJECT | ENUM + +directive @imports( + types: [String!]! +) on OBJECT +### Web3API Header END ### + +type Query implements UriResolver_Query @imports( + types: [ + "UriResolver_Query", + "UriResolver_MaybeUriOrManifest" + ] +) { tryResolveUri( authority: String! path: String! - ): ApiResolver_MaybeUriOrManifest + ): UriResolver_MaybeUriOrManifest getFile( path: String! ): Bytes } -# TODO: should get replaced with an import -# https://github.com/Web3-API/monorepo/issues/75 -type ApiResolver_MaybeUriOrManifest { +### Imported Queries START ### + +type UriResolver_Query @imported( + uri: "w3://ens/uri-resolver.core.web3api.eth", + namespace: "UriResolver", + nativeType: "Query" +) { + tryResolveUri( + authority: String! + path: String! + ): UriResolver_MaybeUriOrManifest + + getFile( + path: String! + ): Bytes +} + +### Imported Queries END ### + +### Imported Objects START ### + +type UriResolver_MaybeUriOrManifest @imported( + uri: "w3://ens/uri-resolver.core.web3api.eth", + namespace: "UriResolver", + nativeType: "MaybeUriOrManifest" +) { uri: String manifest: String } + +### Imported Objects END ### diff --git a/packages/js/plugins/ens/src/manifest.ts b/packages/js/plugins/ens/src/manifest.ts index d714cd4fcc..c958bf0a8e 100644 --- a/packages/js/plugins/ens/src/manifest.ts +++ b/packages/js/plugins/ens/src/manifest.ts @@ -3,26 +3,79 @@ import { PluginManifest, coreInterfaceUris } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: ` -# TODO: should import and "implements" the api-resolver core-api schema -# https://github.com/Web3-API/monorepo/issues/75 + schema: +`### Web3API Header START ### +scalar UInt +scalar UInt8 +scalar UInt16 +scalar UInt32 +scalar UInt64 +scalar Int +scalar Int8 +scalar Int16 +scalar Int32 +scalar Int64 +scalar Bytes +scalar BigInt -type Query { +directive @imported( + uri: String! + namespace: String! + nativeType: String! +) on OBJECT | ENUM + +directive @imports( + types: [String!]! +) on OBJECT +### Web3API Header END ### + +type Query implements UriResolver_Query @imports( + types: [ + "UriResolver_Query", + "UriResolver_MaybeUriOrManifest" + ] +) { + tryResolveUri( + authority: String! + path: String! + ): UriResolver_MaybeUriOrManifest + + getFile( + path: String! + ): Bytes +} + +### Imported Queries START ### + +type UriResolver_Query @imported( + uri: "w3://ens/uri-resolver.core.web3api.eth", + namespace: "UriResolver", + nativeType: "Query" +) { tryResolveUri( authority: String! path: String! - ): ApiResolver_MaybeUriOrManifest + ): UriResolver_MaybeUriOrManifest getFile( path: String! ): Bytes } -# TODO: should get replaced with an import -# https://github.com/Web3-API/monorepo/issues/75 -type ApiResolver_MaybeUriOrManifest { +### Imported Queries END ### + +### Imported Objects START ### + +type UriResolver_MaybeUriOrManifest @imported( + uri: "w3://ens/uri-resolver.core.web3api.eth", + namespace: "UriResolver", + nativeType: "MaybeUriOrManifest" +) { uri: String manifest: String -}`, - implements: [coreInterfaceUris.apiResolver], +} + +### Imported Objects END ### +`, + implements: [coreInterfaceUris.uriResolver], }; diff --git a/packages/js/plugins/ens/src/resolvers.ts b/packages/js/plugins/ens/src/resolvers.ts index f9a44feaa5..0882e7b9b3 100644 --- a/packages/js/plugins/ens/src/resolvers.ts +++ b/packages/js/plugins/ens/src/resolvers.ts @@ -3,7 +3,7 @@ import { EnsPlugin } from "./"; import { Client, PluginModule } from "@web3api/core-js"; export const query = (ens: EnsPlugin, client: Client): PluginModule => ({ - //apiResolver + // uri-resolver.core.web3api.eth tryResolveUri: async (input: { authority: string; path: string }) => { if (input.authority !== "ens") { return null; diff --git a/packages/js/plugins/ipfs/schema.graphql b/packages/js/plugins/ipfs/schema.graphql index 36fdbc678b..16c7447c63 100644 --- a/packages/js/plugins/ipfs/schema.graphql +++ b/packages/js/plugins/ipfs/schema.graphql @@ -1,7 +1,34 @@ -# TODO: should import and "implements" the api-resolver core-api schema -# https://github.com/Web3-API/monorepo/issues/75 +### Web3API Header START ### +scalar UInt +scalar UInt8 +scalar UInt16 +scalar UInt32 +scalar UInt64 +scalar Int +scalar Int8 +scalar Int16 +scalar Int32 +scalar Int64 +scalar Bytes +scalar BigInt -type Query { +directive @imported( + uri: String! + namespace: String! + nativeType: String! +) on OBJECT | ENUM + +directive @imports( + types: [String!]! +) on OBJECT +### Web3API Header END ### + +type Query implements UriResolver_Query @imports( + types: [ + "UriResolver_Query", + "UriResolver_MaybeUriOrManifest" + ] +) { catFile( cid: String! options: Options @@ -15,7 +42,7 @@ type Query { tryResolveUri( authority: String! path: String! - ): ApiResolver_MaybeUriOrManifest + ): UriResolver_MaybeUriOrManifest getFile( path: String! @@ -42,9 +69,34 @@ type Options { provider: String } -# TODO: should get replaced with an import -# https://github.com/Web3-API/monorepo/issues/75 -type ApiResolver_MaybeUriOrManifest { +### Imported Queries START ### + +type UriResolver_Query @imported( + uri: "w3://ens/uri-resolver.core.web3api.eth", + namespace: "UriResolver", + nativeType: "Query" +) { + tryResolveUri( + authority: String! + path: String! + ): UriResolver_MaybeUriOrManifest + + getFile( + path: String! + ): Bytes +} + +### Imported Queries END ### + +### Imported Objects START ### + +type UriResolver_MaybeUriOrManifest @imported( + uri: "w3://ens/uri-resolver.core.web3api.eth", + namespace: "UriResolver", + nativeType: "MaybeUriOrManifest" +) { uri: String manifest: String } + +### Imported Objects END ### diff --git a/packages/js/plugins/ipfs/src/manifest.ts b/packages/js/plugins/ipfs/src/manifest.ts index c8db4942d7..f0ac0901b0 100644 --- a/packages/js/plugins/ipfs/src/manifest.ts +++ b/packages/js/plugins/ipfs/src/manifest.ts @@ -3,11 +3,38 @@ import { PluginManifest, coreInterfaceUris } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: ` -# TODO: should import and "implements" the api-resolver core-api schema -# https://github.com/Web3-API/monorepo/issues/75 + schema: +`### Web3API Header START ### +scalar UInt +scalar UInt8 +scalar UInt16 +scalar UInt32 +scalar UInt64 +scalar Int +scalar Int8 +scalar Int16 +scalar Int32 +scalar Int64 +scalar Bytes +scalar BigInt -type Query { +directive @imported( + uri: String! + namespace: String! + nativeType: String! +) on OBJECT | ENUM + +directive @imports( + types: [String!]! +) on OBJECT +### Web3API Header END ### + +type Query implements UriResolver_Query @imports( + types: [ + "UriResolver_Query", + "UriResolver_MaybeUriOrManifest" + ] +) { catFile( cid: String! options: Options @@ -21,7 +48,7 @@ type Query { tryResolveUri( authority: String! path: String! - ): ApiResolver_MaybeUriOrManifest + ): UriResolver_MaybeUriOrManifest getFile( path: String! @@ -48,11 +75,36 @@ type Options { provider: String } -# TODO: should get replaced with an import -# https://github.com/Web3-API/monorepo/issues/75 -type ApiResolver_MaybeUriOrManifest { +### Imported Queries START ### + +type UriResolver_Query @imported( + uri: "w3://ens/uri-resolver.core.web3api.eth", + namespace: "UriResolver", + nativeType: "Query" +) { + tryResolveUri( + authority: String! + path: String! + ): UriResolver_MaybeUriOrManifest + + getFile( + path: String! + ): Bytes +} + +### Imported Queries END ### + +### Imported Objects START ### + +type UriResolver_MaybeUriOrManifest @imported( + uri: "w3://ens/uri-resolver.core.web3api.eth", + namespace: "UriResolver", + nativeType: "MaybeUriOrManifest" +) { uri: String manifest: String -}`, - implements: [coreInterfaceUris.apiResolver], +} + +### Imported Objects END ###`, + implements: [coreInterfaceUris.uriResolver], }; diff --git a/packages/js/plugins/ipfs/src/resolvers.ts b/packages/js/plugins/ipfs/src/resolvers.ts index 1d23845ad5..f71f937489 100644 --- a/packages/js/plugins/ipfs/src/resolvers.ts +++ b/packages/js/plugins/ipfs/src/resolvers.ts @@ -22,7 +22,7 @@ export const query = (ipfs: IpfsPlugin): PluginModule => ({ }): Promise => { return await ipfs.resolve(input.cid, input.options); }, - // apiResolver + // uri-resolver.core.web3api.eth tryResolveUri: async (input: { authority: string; path: string }) => { if (input.authority !== "ipfs") { return null; diff --git a/packages/js/plugins/logger/README.md b/packages/js/plugins/logger/README.md index cd5dc49339..2d165a2cb3 100644 --- a/packages/js/plugins/logger/README.md +++ b/packages/js/plugins/logger/README.md @@ -15,10 +15,14 @@ Console Logger plugin implements the `w3://ens/logger.core.web3api.eth` core Web import { loggerPlugin, LogLevel } from "@web3api/logger-plugin-js"; const client = new Web3ApiClient({ - plugins: { + plugins: [{ from: "w3://ens/js-logger.web3api.eth", to: loggerPlugin() - } + }], + interfaces: [{ + interface: "w3://ens/logger.core.web3api.eth", + implementations: ["w3://ens/js-logger.web3api.eth"], + }] }); // For custom logging logic, initialize the logger like so: From 66b57609ab226544af5392deb95d2f692ce341c7 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 8 Jul 2021 21:33:59 -0500 Subject: [PATCH 107/112] update console + logger --- packages/apis/console/recipes/e2e.json | 2 +- packages/apis/console/src/query/index.ts | 10 +-- .../apis/console/src/query/schema.graphql | 2 +- packages/apis/console/web3api.yaml | 3 - packages/js/plugins/logger/schema.graphql | 66 +++++++++++++++++ packages/js/plugins/logger/src/manifest.ts | 72 ++++++++++++++++--- 6 files changed, 134 insertions(+), 21 deletions(-) create mode 100644 packages/js/plugins/logger/schema.graphql diff --git a/packages/apis/console/recipes/e2e.json b/packages/apis/console/recipes/e2e.json index d603cfacf5..86c0957d4b 100644 --- a/packages/apis/console/recipes/e2e.json +++ b/packages/apis/console/recipes/e2e.json @@ -1,6 +1,6 @@ [ { - "api": "ens/console.eth", + "api": "ens/testnet/console.eth", "constants": "./constants.json" }, { diff --git a/packages/apis/console/src/query/index.ts b/packages/apis/console/src/query/index.ts index ab2aaa398a..bd13f2b7e6 100644 --- a/packages/apis/console/src/query/index.ts +++ b/packages/apis/console/src/query/index.ts @@ -1,29 +1,29 @@ -import { Input_info, Logger_Query, Logger_LogLevel } from "./w3"; +import { Input_info, Logger_Query, Logger_Logger_LogLevel } from "./w3"; export function debug(input: Input_info): bool { return Logger_Query.log({ message: input.message, - level: Logger_LogLevel.DEBUG + level: Logger_Logger_LogLevel.DEBUG }); } export function info(input: Input_info): bool { return Logger_Query.log({ message: input.message, - level: Logger_LogLevel.INFO + level: Logger_Logger_LogLevel.INFO }); } export function warn(input: Input_info): bool { return Logger_Query.log({ message: input.message, - level: Logger_LogLevel.WARN + level: Logger_Logger_LogLevel.WARN }); } export function error(input: Input_info): bool { return Logger_Query.log({ message: input.message, - level: Logger_LogLevel.ERROR + level: Logger_Logger_LogLevel.ERROR }); } diff --git a/packages/apis/console/src/query/schema.graphql b/packages/apis/console/src/query/schema.graphql index c1288ac945..e5b5e90c84 100644 --- a/packages/apis/console/src/query/schema.graphql +++ b/packages/apis/console/src/query/schema.graphql @@ -1,4 +1,4 @@ -#import { Query, LogLevel } into Logger from "w3://ens/logger.core.web3api.eth" +#import { Query } into Logger from "w3://ens/js-logger.web3api.eth" type Query { debug( diff --git a/packages/apis/console/web3api.yaml b/packages/apis/console/web3api.yaml index 2557fdb4aa..3e5e30387b 100644 --- a/packages/apis/console/web3api.yaml +++ b/packages/apis/console/web3api.yaml @@ -7,6 +7,3 @@ query: module: language: wasm/assemblyscript file: ./src/query/index.ts -import_redirects: - - uri: w3://ens/logger.core.web3api.eth - schema: ../../core-interfaces/logger/src/schema.graphql diff --git a/packages/js/plugins/logger/schema.graphql b/packages/js/plugins/logger/schema.graphql new file mode 100644 index 0000000000..cd411b5e8e --- /dev/null +++ b/packages/js/plugins/logger/schema.graphql @@ -0,0 +1,66 @@ +### Web3API Header START ### +scalar UInt +scalar UInt8 +scalar UInt16 +scalar UInt32 +scalar UInt64 +scalar Int +scalar Int8 +scalar Int16 +scalar Int32 +scalar Int64 +scalar Bytes +scalar BigInt + +directive @imported( + uri: String! + namespace: String! + nativeType: String! +) on OBJECT | ENUM + +directive @imports( + types: [String!]! +) on OBJECT +### Web3API Header END ### + +type Query implements Logger_Query @imports( + types: [ + "Logger_Query", + "Logger_LogLevel" + ] +) { + log( + level: Logger_LogLevel! + message: String! + ): Boolean! +} + +### Imported Queries START ### + +type Logger_Query @imported( + uri: "w3://ens/logger.core.web3api.eth", + namespace: "Logger", + nativeType: "Query" +) { + log( + level: Logger_LogLevel! + message: String! + ): Boolean! +} + +### Imported Queries END ### + +### Imported Objects START ### + +enum Logger_LogLevel @imported( + uri: "w3://ens/logger.core.web3api.eth", + namespace: "Logger", + nativeType: "LogLevel" +) { + DEBUG + INFO + WARN + ERROR +} + +### Imported Objects END ### diff --git a/packages/js/plugins/logger/src/manifest.ts b/packages/js/plugins/logger/src/manifest.ts index 03cdc5de73..1a84593b79 100644 --- a/packages/js/plugins/logger/src/manifest.ts +++ b/packages/js/plugins/logger/src/manifest.ts @@ -3,23 +3,73 @@ import { PluginManifest, coreInterfaceUris } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: ` -# TODO: should import and "implements" the logger core-api schema -# https://github.com/Web3-API/monorepo/issues/75 - -enum LogLevel { - DEBUG, - INFO, - WARN, - ERROR, + schema: +`### Web3API Header START ### +scalar UInt +scalar UInt8 +scalar UInt16 +scalar UInt32 +scalar UInt64 +scalar Int +scalar Int8 +scalar Int16 +scalar Int32 +scalar Int64 +scalar Bytes +scalar BigInt + +directive @imported( + uri: String! + namespace: String! + nativeType: String! +) on OBJECT | ENUM + +directive @imports( + types: [String!]! +) on OBJECT +### Web3API Header END ### + +type Query implements Logger_Query @imports( + types: [ + "Logger_Query", + "Logger_LogLevel" + ] +) { + log( + level: Logger_LogLevel! + message: String! + ): Boolean! } -type Query { +### Imported Queries START ### + +type Logger_Query @imported( + uri: "w3://ens/logger.core.web3api.eth", + namespace: "Logger", + nativeType: "Query" +) { log( - level: LogLevel! + level: Logger_LogLevel! message: String! ): Boolean! } + +### Imported Queries END ### + +### Imported Objects START ### + +enum Logger_LogLevel @imported( + uri: "w3://ens/logger.core.web3api.eth", + namespace: "Logger", + nativeType: "LogLevel" +) { + DEBUG + INFO + WARN + ERROR +} + +### Imported Objects END ### `, implements: [coreInterfaceUris.logger], }; From 69bf8c4cfe2d7a2004656fce8c5c7ded1cd5cf55 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 8 Jul 2021 21:43:21 -0500 Subject: [PATCH 108/112] linter update --- packages/js/client/src/Web3ApiClient.ts | 4 +- packages/js/plugins/ens/src/manifest.ts | 3 +- packages/js/plugins/ipfs/src/manifest.ts | 3 +- packages/js/plugins/logger/src/manifest.ts | 3 +- packages/templates/app/react/public/thread.js | 124 +++++++++--------- 5 files changed, 66 insertions(+), 71 deletions(-) diff --git a/packages/js/client/src/Web3ApiClient.ts b/packages/js/client/src/Web3ApiClient.ts index 868c1021d8..8ae890a75d 100644 --- a/packages/js/client/src/Web3ApiClient.ts +++ b/packages/js/client/src/Web3ApiClient.ts @@ -124,9 +124,7 @@ export class Web3ApiClient implements Client { public async query< TData extends Record = Record, TVariables extends Record = Record - >( - options: QueryApiOptions - ): Promise>; + >(options: QueryApiOptions): Promise>; public async query< TData extends Record = Record, TVariables extends Record = Record diff --git a/packages/js/plugins/ens/src/manifest.ts b/packages/js/plugins/ens/src/manifest.ts index c958bf0a8e..23bb91eefa 100644 --- a/packages/js/plugins/ens/src/manifest.ts +++ b/packages/js/plugins/ens/src/manifest.ts @@ -3,8 +3,7 @@ import { PluginManifest, coreInterfaceUris } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: -`### Web3API Header START ### + schema: `### Web3API Header START ### scalar UInt scalar UInt8 scalar UInt16 diff --git a/packages/js/plugins/ipfs/src/manifest.ts b/packages/js/plugins/ipfs/src/manifest.ts index f0ac0901b0..d6a60062e9 100644 --- a/packages/js/plugins/ipfs/src/manifest.ts +++ b/packages/js/plugins/ipfs/src/manifest.ts @@ -3,8 +3,7 @@ import { PluginManifest, coreInterfaceUris } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: -`### Web3API Header START ### + schema: `### Web3API Header START ### scalar UInt scalar UInt8 scalar UInt16 diff --git a/packages/js/plugins/logger/src/manifest.ts b/packages/js/plugins/logger/src/manifest.ts index 1a84593b79..88434d9cea 100644 --- a/packages/js/plugins/logger/src/manifest.ts +++ b/packages/js/plugins/logger/src/manifest.ts @@ -3,8 +3,7 @@ import { PluginManifest, coreInterfaceUris } from "@web3api/core-js"; export const manifest: PluginManifest = { // TODO: use the schema.graphql // https://github.com/web3-api/monorepo/issues/101 - schema: -`### Web3API Header START ### + schema: `### Web3API Header START ### scalar UInt scalar UInt8 scalar UInt16 diff --git a/packages/templates/app/react/public/thread.js b/packages/templates/app/react/public/thread.js index 48505ecd27..4f62de1c56 100644 --- a/packages/templates/app/react/public/thread.js +++ b/packages/templates/app/react/public/thread.js @@ -97,182 +97,182 @@ return /******/ (function(modules) { // webpackBootstrap /******/ ({ /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/CachedKeyDecoder.mjs": -/*!***********************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/CachedKeyDecoder.mjs ***! - \***********************************************************************************************************/ +/*!******************************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/CachedKeyDecoder.mjs ***! + \******************************************************************************************************************/ /*! exports provided: CachedKeyDecoder */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CachedKeyDecoder\", function() { return CachedKeyDecoder; });\n/* harmony import */ var _utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/utf8.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs\");\n\nvar DEFAULT_MAX_KEY_LENGTH = 16;\nvar DEFAULT_MAX_LENGTH_PER_KEY = 16;\nvar CachedKeyDecoder = /** @class */ (function () {\n function CachedKeyDecoder(maxKeyLength, maxLengthPerKey) {\n if (maxKeyLength === void 0) { maxKeyLength = DEFAULT_MAX_KEY_LENGTH; }\n if (maxLengthPerKey === void 0) { maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY; }\n this.maxKeyLength = maxKeyLength;\n this.maxLengthPerKey = maxLengthPerKey;\n this.hit = 0;\n this.miss = 0;\n // avoid `new Array(N)` to create a non-sparse array for performance.\n this.caches = [];\n for (var i = 0; i < this.maxKeyLength; i++) {\n this.caches.push([]);\n }\n }\n CachedKeyDecoder.prototype.canBeCached = function (byteLength) {\n return byteLength > 0 && byteLength <= this.maxKeyLength;\n };\n CachedKeyDecoder.prototype.get = function (bytes, inputOffset, byteLength) {\n var records = this.caches[byteLength - 1];\n var recordsLength = records.length;\n FIND_CHUNK: for (var i = 0; i < recordsLength; i++) {\n var record = records[i];\n var recordBytes = record.bytes;\n for (var j = 0; j < byteLength; j++) {\n if (recordBytes[j] !== bytes[inputOffset + j]) {\n continue FIND_CHUNK;\n }\n }\n return record.value;\n }\n return null;\n };\n CachedKeyDecoder.prototype.store = function (bytes, value) {\n var records = this.caches[bytes.length - 1];\n var record = { bytes: bytes, value: value };\n if (records.length >= this.maxLengthPerKey) {\n // `records` are full!\n // Set `record` to a randomized position.\n records[(Math.random() * records.length) | 0] = record;\n }\n else {\n records.push(record);\n }\n };\n CachedKeyDecoder.prototype.decode = function (bytes, inputOffset, byteLength) {\n var cachedValue = this.get(bytes, inputOffset, byteLength);\n if (cachedValue != null) {\n this.hit++;\n return cachedValue;\n }\n this.miss++;\n var value = Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"utf8DecodeJs\"])(bytes, inputOffset, byteLength);\n // Ensure to copy a slice of bytes because the byte may be NodeJS Buffer and Buffer#slice() returns a reference to its internal ArrayBuffer.\n var slicedCopyOfBytes = Uint8Array.prototype.slice.call(bytes, inputOffset, inputOffset + byteLength);\n this.store(slicedCopyOfBytes, value);\n return value;\n };\n return CachedKeyDecoder;\n}());\n\n//# sourceMappingURL=CachedKeyDecoder.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/CachedKeyDecoder.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CachedKeyDecoder\", function() { return CachedKeyDecoder; });\n/* harmony import */ var _utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/utf8.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs\");\n\nvar DEFAULT_MAX_KEY_LENGTH = 16;\nvar DEFAULT_MAX_LENGTH_PER_KEY = 16;\nvar CachedKeyDecoder = /** @class */ (function () {\n function CachedKeyDecoder(maxKeyLength, maxLengthPerKey) {\n if (maxKeyLength === void 0) { maxKeyLength = DEFAULT_MAX_KEY_LENGTH; }\n if (maxLengthPerKey === void 0) { maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY; }\n this.maxKeyLength = maxKeyLength;\n this.maxLengthPerKey = maxLengthPerKey;\n this.hit = 0;\n this.miss = 0;\n // avoid `new Array(N)` to create a non-sparse array for performance.\n this.caches = [];\n for (var i = 0; i < this.maxKeyLength; i++) {\n this.caches.push([]);\n }\n }\n CachedKeyDecoder.prototype.canBeCached = function (byteLength) {\n return byteLength > 0 && byteLength <= this.maxKeyLength;\n };\n CachedKeyDecoder.prototype.get = function (bytes, inputOffset, byteLength) {\n var records = this.caches[byteLength - 1];\n var recordsLength = records.length;\n FIND_CHUNK: for (var i = 0; i < recordsLength; i++) {\n var record = records[i];\n var recordBytes = record.bytes;\n for (var j = 0; j < byteLength; j++) {\n if (recordBytes[j] !== bytes[inputOffset + j]) {\n continue FIND_CHUNK;\n }\n }\n return record.value;\n }\n return null;\n };\n CachedKeyDecoder.prototype.store = function (bytes, value) {\n var records = this.caches[bytes.length - 1];\n var record = { bytes: bytes, value: value };\n if (records.length >= this.maxLengthPerKey) {\n // `records` are full!\n // Set `record` to a randomized position.\n records[(Math.random() * records.length) | 0] = record;\n }\n else {\n records.push(record);\n }\n };\n CachedKeyDecoder.prototype.decode = function (bytes, inputOffset, byteLength) {\n var cachedValue = this.get(bytes, inputOffset, byteLength);\n if (cachedValue != null) {\n this.hit++;\n return cachedValue;\n }\n this.miss++;\n var value = Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"utf8DecodeJs\"])(bytes, inputOffset, byteLength);\n // Ensure to copy a slice of bytes because the byte may be NodeJS Buffer and Buffer#slice() returns a reference to its internal ArrayBuffer.\n var slicedCopyOfBytes = Uint8Array.prototype.slice.call(bytes, inputOffset, inputOffset + byteLength);\n this.store(slicedCopyOfBytes, value);\n return value;\n };\n return CachedKeyDecoder;\n}());\n\n//# sourceMappingURL=CachedKeyDecoder.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/CachedKeyDecoder.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs": -/*!**************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs ***! - \**************************************************************************************************/ +/*!*********************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs ***! + \*********************************************************************************************************/ /*! exports provided: DataViewIndexOutOfBoundsError, Decoder */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DataViewIndexOutOfBoundsError\", function() { return DataViewIndexOutOfBoundsError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Decoder\", function() { return Decoder; });\n/* harmony import */ var _utils_prettyByte_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/prettyByte.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/prettyByte.mjs\");\n/* harmony import */ var _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExtensionCodec.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs\");\n/* harmony import */ var _utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/int.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs\");\n/* harmony import */ var _utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/utf8.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs\");\n/* harmony import */ var _utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/typedArrays.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/typedArrays.mjs\");\n/* harmony import */ var _CachedKeyDecoder_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./CachedKeyDecoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/CachedKeyDecoder.mjs\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __asyncValues = (undefined && undefined.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n};\nvar __await = (undefined && undefined.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }\nvar __asyncGenerator = (undefined && undefined.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n};\n\n\n\n\n\n\nvar isValidMapKeyType = function (key) {\n var keyType = typeof key;\n return keyType === \"string\" || keyType === \"number\";\n};\nvar HEAD_BYTE_REQUIRED = -1;\nvar EMPTY_VIEW = new DataView(new ArrayBuffer(0));\nvar EMPTY_BYTES = new Uint8Array(EMPTY_VIEW.buffer);\n// IE11: Hack to support IE11.\n// IE11: Drop this hack and just use RangeError when IE11 is obsolete.\nvar DataViewIndexOutOfBoundsError = (function () {\n try {\n // IE11: The spec says it should throw RangeError,\n // IE11: but in IE11 it throws TypeError.\n EMPTY_VIEW.getInt8(0);\n }\n catch (e) {\n return e.constructor;\n }\n throw new Error(\"never reached\");\n})();\nvar MORE_DATA = new DataViewIndexOutOfBoundsError(\"Insufficient data\");\nvar DEFAULT_MAX_LENGTH = 4294967295; // uint32_max\nvar sharedCachedKeyDecoder = new _CachedKeyDecoder_mjs__WEBPACK_IMPORTED_MODULE_5__[\"CachedKeyDecoder\"]();\nvar Decoder = /** @class */ (function () {\n function Decoder(extensionCodec, context, maxStrLength, maxBinLength, maxArrayLength, maxMapLength, maxExtLength, keyDecoder) {\n if (extensionCodec === void 0) { extensionCodec = _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_1__[\"ExtensionCodec\"].defaultCodec; }\n if (context === void 0) { context = undefined; }\n if (maxStrLength === void 0) { maxStrLength = DEFAULT_MAX_LENGTH; }\n if (maxBinLength === void 0) { maxBinLength = DEFAULT_MAX_LENGTH; }\n if (maxArrayLength === void 0) { maxArrayLength = DEFAULT_MAX_LENGTH; }\n if (maxMapLength === void 0) { maxMapLength = DEFAULT_MAX_LENGTH; }\n if (maxExtLength === void 0) { maxExtLength = DEFAULT_MAX_LENGTH; }\n if (keyDecoder === void 0) { keyDecoder = sharedCachedKeyDecoder; }\n this.extensionCodec = extensionCodec;\n this.context = context;\n this.maxStrLength = maxStrLength;\n this.maxBinLength = maxBinLength;\n this.maxArrayLength = maxArrayLength;\n this.maxMapLength = maxMapLength;\n this.maxExtLength = maxExtLength;\n this.keyDecoder = keyDecoder;\n this.totalPos = 0;\n this.pos = 0;\n this.view = EMPTY_VIEW;\n this.bytes = EMPTY_BYTES;\n this.headByte = HEAD_BYTE_REQUIRED;\n this.stack = [];\n }\n Decoder.prototype.reinitializeState = function () {\n this.totalPos = 0;\n this.headByte = HEAD_BYTE_REQUIRED;\n };\n Decoder.prototype.setBuffer = function (buffer) {\n this.bytes = Object(_utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_4__[\"ensureUint8Array\"])(buffer);\n this.view = Object(_utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_4__[\"createDataView\"])(this.bytes);\n this.pos = 0;\n };\n Decoder.prototype.appendBuffer = function (buffer) {\n if (this.headByte === HEAD_BYTE_REQUIRED && !this.hasRemaining()) {\n this.setBuffer(buffer);\n }\n else {\n // retried because data is insufficient\n var remainingData = this.bytes.subarray(this.pos);\n var newData = Object(_utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_4__[\"ensureUint8Array\"])(buffer);\n var concated = new Uint8Array(remainingData.length + newData.length);\n concated.set(remainingData);\n concated.set(newData, remainingData.length);\n this.setBuffer(concated);\n }\n };\n Decoder.prototype.hasRemaining = function (size) {\n if (size === void 0) { size = 1; }\n return this.view.byteLength - this.pos >= size;\n };\n Decoder.prototype.createExtraByteError = function (posToShow) {\n var _a = this, view = _a.view, pos = _a.pos;\n return new RangeError(\"Extra \" + (view.byteLength - pos) + \" of \" + view.byteLength + \" byte(s) found at buffer[\" + posToShow + \"]\");\n };\n Decoder.prototype.decode = function (buffer) {\n this.reinitializeState();\n this.setBuffer(buffer);\n var object = this.doDecodeSync();\n if (this.hasRemaining()) {\n throw this.createExtraByteError(this.pos);\n }\n return object;\n };\n Decoder.prototype.decodeAsync = function (stream) {\n var stream_1, stream_1_1;\n var e_1, _a;\n return __awaiter(this, void 0, void 0, function () {\n var decoded, object, buffer, e_1_1, _b, headByte, pos, totalPos;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n decoded = false;\n _c.label = 1;\n case 1:\n _c.trys.push([1, 6, 7, 12]);\n stream_1 = __asyncValues(stream);\n _c.label = 2;\n case 2: return [4 /*yield*/, stream_1.next()];\n case 3:\n if (!(stream_1_1 = _c.sent(), !stream_1_1.done)) return [3 /*break*/, 5];\n buffer = stream_1_1.value;\n if (decoded) {\n throw this.createExtraByteError(this.totalPos);\n }\n this.appendBuffer(buffer);\n try {\n object = this.doDecodeSync();\n decoded = true;\n }\n catch (e) {\n if (!(e instanceof DataViewIndexOutOfBoundsError)) {\n throw e; // rethrow\n }\n // fallthrough\n }\n this.totalPos += this.pos;\n _c.label = 4;\n case 4: return [3 /*break*/, 2];\n case 5: return [3 /*break*/, 12];\n case 6:\n e_1_1 = _c.sent();\n e_1 = { error: e_1_1 };\n return [3 /*break*/, 12];\n case 7:\n _c.trys.push([7, , 10, 11]);\n if (!(stream_1_1 && !stream_1_1.done && (_a = stream_1.return))) return [3 /*break*/, 9];\n return [4 /*yield*/, _a.call(stream_1)];\n case 8:\n _c.sent();\n _c.label = 9;\n case 9: return [3 /*break*/, 11];\n case 10:\n if (e_1) throw e_1.error;\n return [7 /*endfinally*/];\n case 11: return [7 /*endfinally*/];\n case 12:\n if (decoded) {\n if (this.hasRemaining()) {\n throw this.createExtraByteError(this.totalPos);\n }\n return [2 /*return*/, object];\n }\n _b = this, headByte = _b.headByte, pos = _b.pos, totalPos = _b.totalPos;\n throw new RangeError(\"Insufficient data in parsing \" + Object(_utils_prettyByte_mjs__WEBPACK_IMPORTED_MODULE_0__[\"prettyByte\"])(headByte) + \" at \" + totalPos + \" (\" + pos + \" in the current buffer)\");\n }\n });\n });\n };\n Decoder.prototype.decodeArrayStream = function (stream) {\n return this.decodeMultiAsync(stream, true);\n };\n Decoder.prototype.decodeStream = function (stream) {\n return this.decodeMultiAsync(stream, false);\n };\n Decoder.prototype.decodeMultiAsync = function (stream, isArray) {\n return __asyncGenerator(this, arguments, function decodeMultiAsync_1() {\n var isArrayHeaderRequired, arrayItemsLeft, stream_2, stream_2_1, buffer, e_2, e_3_1;\n var e_3, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n isArrayHeaderRequired = isArray;\n arrayItemsLeft = -1;\n _b.label = 1;\n case 1:\n _b.trys.push([1, 13, 14, 19]);\n stream_2 = __asyncValues(stream);\n _b.label = 2;\n case 2: return [4 /*yield*/, __await(stream_2.next())];\n case 3:\n if (!(stream_2_1 = _b.sent(), !stream_2_1.done)) return [3 /*break*/, 12];\n buffer = stream_2_1.value;\n if (isArray && arrayItemsLeft === 0) {\n throw this.createExtraByteError(this.totalPos);\n }\n this.appendBuffer(buffer);\n if (isArrayHeaderRequired) {\n arrayItemsLeft = this.readArraySize();\n isArrayHeaderRequired = false;\n this.complete();\n }\n _b.label = 4;\n case 4:\n _b.trys.push([4, 9, , 10]);\n _b.label = 5;\n case 5:\n if (false) {}\n return [4 /*yield*/, __await(this.doDecodeSync())];\n case 6: return [4 /*yield*/, _b.sent()];\n case 7:\n _b.sent();\n if (--arrayItemsLeft === 0) {\n return [3 /*break*/, 8];\n }\n return [3 /*break*/, 5];\n case 8: return [3 /*break*/, 10];\n case 9:\n e_2 = _b.sent();\n if (!(e_2 instanceof DataViewIndexOutOfBoundsError)) {\n throw e_2; // rethrow\n }\n return [3 /*break*/, 10];\n case 10:\n this.totalPos += this.pos;\n _b.label = 11;\n case 11: return [3 /*break*/, 2];\n case 12: return [3 /*break*/, 19];\n case 13:\n e_3_1 = _b.sent();\n e_3 = { error: e_3_1 };\n return [3 /*break*/, 19];\n case 14:\n _b.trys.push([14, , 17, 18]);\n if (!(stream_2_1 && !stream_2_1.done && (_a = stream_2.return))) return [3 /*break*/, 16];\n return [4 /*yield*/, __await(_a.call(stream_2))];\n case 15:\n _b.sent();\n _b.label = 16;\n case 16: return [3 /*break*/, 18];\n case 17:\n if (e_3) throw e_3.error;\n return [7 /*endfinally*/];\n case 18: return [7 /*endfinally*/];\n case 19: return [2 /*return*/];\n }\n });\n });\n };\n Decoder.prototype.doDecodeSync = function () {\n DECODE: while (true) {\n var headByte = this.readHeadByte();\n var object = void 0;\n if (headByte >= 0xe0) {\n // negative fixint (111x xxxx) 0xe0 - 0xff\n object = headByte - 0x100;\n }\n else if (headByte < 0xc0) {\n if (headByte < 0x80) {\n // positive fixint (0xxx xxxx) 0x00 - 0x7f\n object = headByte;\n }\n else if (headByte < 0x90) {\n // fixmap (1000 xxxx) 0x80 - 0x8f\n var size = headByte - 0x80;\n if (size !== 0) {\n this.pushMapState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = {};\n }\n }\n else if (headByte < 0xa0) {\n // fixarray (1001 xxxx) 0x90 - 0x9f\n var size = headByte - 0x90;\n if (size !== 0) {\n this.pushArrayState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = [];\n }\n }\n else {\n // fixstr (101x xxxx) 0xa0 - 0xbf\n var byteLength = headByte - 0xa0;\n object = this.decodeUtf8String(byteLength, 0);\n }\n }\n else if (headByte === 0xc0) {\n // nil\n object = null;\n }\n else if (headByte === 0xc2) {\n // false\n object = false;\n }\n else if (headByte === 0xc3) {\n // true\n object = true;\n }\n else if (headByte === 0xca) {\n // float 32\n object = this.readF32();\n }\n else if (headByte === 0xcb) {\n // float 64\n object = this.readF64();\n }\n else if (headByte === 0xcc) {\n // uint 8\n object = this.readU8();\n }\n else if (headByte === 0xcd) {\n // uint 16\n object = this.readU16();\n }\n else if (headByte === 0xce) {\n // uint 32\n object = this.readU32();\n }\n else if (headByte === 0xcf) {\n // uint 64\n object = this.readU64();\n }\n else if (headByte === 0xd0) {\n // int 8\n object = this.readI8();\n }\n else if (headByte === 0xd1) {\n // int 16\n object = this.readI16();\n }\n else if (headByte === 0xd2) {\n // int 32\n object = this.readI32();\n }\n else if (headByte === 0xd3) {\n // int 64\n object = this.readI64();\n }\n else if (headByte === 0xd9) {\n // str 8\n var byteLength = this.lookU8();\n object = this.decodeUtf8String(byteLength, 1);\n }\n else if (headByte === 0xda) {\n // str 16\n var byteLength = this.lookU16();\n object = this.decodeUtf8String(byteLength, 2);\n }\n else if (headByte === 0xdb) {\n // str 32\n var byteLength = this.lookU32();\n object = this.decodeUtf8String(byteLength, 4);\n }\n else if (headByte === 0xdc) {\n // array 16\n var size = this.readU16();\n if (size !== 0) {\n this.pushArrayState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = [];\n }\n }\n else if (headByte === 0xdd) {\n // array 32\n var size = this.readU32();\n if (size !== 0) {\n this.pushArrayState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = [];\n }\n }\n else if (headByte === 0xde) {\n // map 16\n var size = this.readU16();\n if (size !== 0) {\n this.pushMapState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = {};\n }\n }\n else if (headByte === 0xdf) {\n // map 32\n var size = this.readU32();\n if (size !== 0) {\n this.pushMapState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = {};\n }\n }\n else if (headByte === 0xc4) {\n // bin 8\n var size = this.lookU8();\n object = this.decodeBinary(size, 1);\n }\n else if (headByte === 0xc5) {\n // bin 16\n var size = this.lookU16();\n object = this.decodeBinary(size, 2);\n }\n else if (headByte === 0xc6) {\n // bin 32\n var size = this.lookU32();\n object = this.decodeBinary(size, 4);\n }\n else if (headByte === 0xd4) {\n // fixext 1\n object = this.decodeExtension(1, 0);\n }\n else if (headByte === 0xd5) {\n // fixext 2\n object = this.decodeExtension(2, 0);\n }\n else if (headByte === 0xd6) {\n // fixext 4\n object = this.decodeExtension(4, 0);\n }\n else if (headByte === 0xd7) {\n // fixext 8\n object = this.decodeExtension(8, 0);\n }\n else if (headByte === 0xd8) {\n // fixext 16\n object = this.decodeExtension(16, 0);\n }\n else if (headByte === 0xc7) {\n // ext 8\n var size = this.lookU8();\n object = this.decodeExtension(size, 1);\n }\n else if (headByte === 0xc8) {\n // ext 16\n var size = this.lookU16();\n object = this.decodeExtension(size, 2);\n }\n else if (headByte === 0xc9) {\n // ext 32\n var size = this.lookU32();\n object = this.decodeExtension(size, 4);\n }\n else {\n throw new Error(\"Unrecognized type byte: \" + Object(_utils_prettyByte_mjs__WEBPACK_IMPORTED_MODULE_0__[\"prettyByte\"])(headByte));\n }\n this.complete();\n var stack = this.stack;\n while (stack.length > 0) {\n // arrays and maps\n var state = stack[stack.length - 1];\n if (state.type === 0 /* ARRAY */) {\n state.array[state.position] = object;\n state.position++;\n if (state.position === state.size) {\n stack.pop();\n object = state.array;\n }\n else {\n continue DECODE;\n }\n }\n else if (state.type === 1 /* MAP_KEY */) {\n if (!isValidMapKeyType(object)) {\n throw new Error(\"The type of key must be string or number but \" + typeof object);\n }\n state.key = object;\n state.type = 2 /* MAP_VALUE */;\n continue DECODE;\n }\n else {\n // it must be `state.type === State.MAP_VALUE` here\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n state.map[state.key] = object;\n state.readCount++;\n if (state.readCount === state.size) {\n stack.pop();\n object = state.map;\n }\n else {\n state.key = null;\n state.type = 1 /* MAP_KEY */;\n continue DECODE;\n }\n }\n }\n return object;\n }\n };\n Decoder.prototype.readHeadByte = function () {\n if (this.headByte === HEAD_BYTE_REQUIRED) {\n this.headByte = this.readU8();\n // console.log(\"headByte\", prettyByte(this.headByte));\n }\n return this.headByte;\n };\n Decoder.prototype.complete = function () {\n this.headByte = HEAD_BYTE_REQUIRED;\n };\n Decoder.prototype.readArraySize = function () {\n var headByte = this.readHeadByte();\n switch (headByte) {\n case 0xdc:\n return this.readU16();\n case 0xdd:\n return this.readU32();\n default: {\n if (headByte < 0xa0) {\n return headByte - 0x90;\n }\n else {\n throw new Error(\"Unrecognized array type byte: \" + Object(_utils_prettyByte_mjs__WEBPACK_IMPORTED_MODULE_0__[\"prettyByte\"])(headByte));\n }\n }\n }\n };\n Decoder.prototype.pushMapState = function (size) {\n if (size > this.maxMapLength) {\n throw new Error(\"Max length exceeded: map length (\" + size + \") > maxMapLengthLength (\" + this.maxMapLength + \")\");\n }\n this.stack.push({\n type: 1 /* MAP_KEY */,\n size: size,\n key: null,\n readCount: 0,\n map: {},\n });\n };\n Decoder.prototype.pushArrayState = function (size) {\n if (size > this.maxArrayLength) {\n throw new Error(\"Max length exceeded: array length (\" + size + \") > maxArrayLength (\" + this.maxArrayLength + \")\");\n }\n this.stack.push({\n type: 0 /* ARRAY */,\n size: size,\n array: new Array(size),\n position: 0,\n });\n };\n Decoder.prototype.decodeUtf8String = function (byteLength, headerOffset) {\n var _a;\n if (byteLength > this.maxStrLength) {\n throw new Error(\"Max length exceeded: UTF-8 byte length (\" + byteLength + \") > maxStrLength (\" + this.maxStrLength + \")\");\n }\n if (this.bytes.byteLength < this.pos + headerOffset + byteLength) {\n throw MORE_DATA;\n }\n var offset = this.pos + headerOffset;\n var object;\n if (this.stateIsMapKey() && ((_a = this.keyDecoder) === null || _a === void 0 ? void 0 : _a.canBeCached(byteLength))) {\n object = this.keyDecoder.decode(this.bytes, offset, byteLength);\n }\n else if (byteLength > _utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TEXT_DECODER_THRESHOLD\"]) {\n object = Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_3__[\"utf8DecodeTD\"])(this.bytes, offset, byteLength);\n }\n else {\n object = Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_3__[\"utf8DecodeJs\"])(this.bytes, offset, byteLength);\n }\n this.pos += headerOffset + byteLength;\n return object;\n };\n Decoder.prototype.stateIsMapKey = function () {\n if (this.stack.length > 0) {\n var state = this.stack[this.stack.length - 1];\n return state.type === 1 /* MAP_KEY */;\n }\n return false;\n };\n Decoder.prototype.decodeBinary = function (byteLength, headOffset) {\n if (byteLength > this.maxBinLength) {\n throw new Error(\"Max length exceeded: bin length (\" + byteLength + \") > maxBinLength (\" + this.maxBinLength + \")\");\n }\n if (!this.hasRemaining(byteLength + headOffset)) {\n throw MORE_DATA;\n }\n var offset = this.pos + headOffset;\n var object = this.bytes.subarray(offset, offset + byteLength);\n this.pos += headOffset + byteLength;\n return object;\n };\n Decoder.prototype.decodeExtension = function (size, headOffset) {\n if (size > this.maxExtLength) {\n throw new Error(\"Max length exceeded: ext length (\" + size + \") > maxExtLength (\" + this.maxExtLength + \")\");\n }\n var extType = this.view.getInt8(this.pos + headOffset);\n var data = this.decodeBinary(size, headOffset + 1 /* extType */);\n return this.extensionCodec.decode(data, extType, this.context);\n };\n Decoder.prototype.lookU8 = function () {\n return this.view.getUint8(this.pos);\n };\n Decoder.prototype.lookU16 = function () {\n return this.view.getUint16(this.pos);\n };\n Decoder.prototype.lookU32 = function () {\n return this.view.getUint32(this.pos);\n };\n Decoder.prototype.readU8 = function () {\n var value = this.view.getUint8(this.pos);\n this.pos++;\n return value;\n };\n Decoder.prototype.readI8 = function () {\n var value = this.view.getInt8(this.pos);\n this.pos++;\n return value;\n };\n Decoder.prototype.readU16 = function () {\n var value = this.view.getUint16(this.pos);\n this.pos += 2;\n return value;\n };\n Decoder.prototype.readI16 = function () {\n var value = this.view.getInt16(this.pos);\n this.pos += 2;\n return value;\n };\n Decoder.prototype.readU32 = function () {\n var value = this.view.getUint32(this.pos);\n this.pos += 4;\n return value;\n };\n Decoder.prototype.readI32 = function () {\n var value = this.view.getInt32(this.pos);\n this.pos += 4;\n return value;\n };\n Decoder.prototype.readU64 = function () {\n var value = Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__[\"getUint64\"])(this.view, this.pos);\n this.pos += 8;\n return value;\n };\n Decoder.prototype.readI64 = function () {\n var value = Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__[\"getInt64\"])(this.view, this.pos);\n this.pos += 8;\n return value;\n };\n Decoder.prototype.readF32 = function () {\n var value = this.view.getFloat32(this.pos);\n this.pos += 4;\n return value;\n };\n Decoder.prototype.readF64 = function () {\n var value = this.view.getFloat64(this.pos);\n this.pos += 8;\n return value;\n };\n return Decoder;\n}());\n\n//# sourceMappingURL=Decoder.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DataViewIndexOutOfBoundsError\", function() { return DataViewIndexOutOfBoundsError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Decoder\", function() { return Decoder; });\n/* harmony import */ var _utils_prettyByte_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/prettyByte.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/prettyByte.mjs\");\n/* harmony import */ var _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExtensionCodec.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs\");\n/* harmony import */ var _utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/int.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs\");\n/* harmony import */ var _utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/utf8.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs\");\n/* harmony import */ var _utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/typedArrays.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/typedArrays.mjs\");\n/* harmony import */ var _CachedKeyDecoder_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./CachedKeyDecoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/CachedKeyDecoder.mjs\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __asyncValues = (undefined && undefined.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n};\nvar __await = (undefined && undefined.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }\nvar __asyncGenerator = (undefined && undefined.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n};\n\n\n\n\n\n\nvar isValidMapKeyType = function (key) {\n var keyType = typeof key;\n return keyType === \"string\" || keyType === \"number\";\n};\nvar HEAD_BYTE_REQUIRED = -1;\nvar EMPTY_VIEW = new DataView(new ArrayBuffer(0));\nvar EMPTY_BYTES = new Uint8Array(EMPTY_VIEW.buffer);\n// IE11: Hack to support IE11.\n// IE11: Drop this hack and just use RangeError when IE11 is obsolete.\nvar DataViewIndexOutOfBoundsError = (function () {\n try {\n // IE11: The spec says it should throw RangeError,\n // IE11: but in IE11 it throws TypeError.\n EMPTY_VIEW.getInt8(0);\n }\n catch (e) {\n return e.constructor;\n }\n throw new Error(\"never reached\");\n})();\nvar MORE_DATA = new DataViewIndexOutOfBoundsError(\"Insufficient data\");\nvar DEFAULT_MAX_LENGTH = 4294967295; // uint32_max\nvar sharedCachedKeyDecoder = new _CachedKeyDecoder_mjs__WEBPACK_IMPORTED_MODULE_5__[\"CachedKeyDecoder\"]();\nvar Decoder = /** @class */ (function () {\n function Decoder(extensionCodec, context, maxStrLength, maxBinLength, maxArrayLength, maxMapLength, maxExtLength, keyDecoder) {\n if (extensionCodec === void 0) { extensionCodec = _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_1__[\"ExtensionCodec\"].defaultCodec; }\n if (context === void 0) { context = undefined; }\n if (maxStrLength === void 0) { maxStrLength = DEFAULT_MAX_LENGTH; }\n if (maxBinLength === void 0) { maxBinLength = DEFAULT_MAX_LENGTH; }\n if (maxArrayLength === void 0) { maxArrayLength = DEFAULT_MAX_LENGTH; }\n if (maxMapLength === void 0) { maxMapLength = DEFAULT_MAX_LENGTH; }\n if (maxExtLength === void 0) { maxExtLength = DEFAULT_MAX_LENGTH; }\n if (keyDecoder === void 0) { keyDecoder = sharedCachedKeyDecoder; }\n this.extensionCodec = extensionCodec;\n this.context = context;\n this.maxStrLength = maxStrLength;\n this.maxBinLength = maxBinLength;\n this.maxArrayLength = maxArrayLength;\n this.maxMapLength = maxMapLength;\n this.maxExtLength = maxExtLength;\n this.keyDecoder = keyDecoder;\n this.totalPos = 0;\n this.pos = 0;\n this.view = EMPTY_VIEW;\n this.bytes = EMPTY_BYTES;\n this.headByte = HEAD_BYTE_REQUIRED;\n this.stack = [];\n }\n Decoder.prototype.reinitializeState = function () {\n this.totalPos = 0;\n this.headByte = HEAD_BYTE_REQUIRED;\n };\n Decoder.prototype.setBuffer = function (buffer) {\n this.bytes = Object(_utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_4__[\"ensureUint8Array\"])(buffer);\n this.view = Object(_utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_4__[\"createDataView\"])(this.bytes);\n this.pos = 0;\n };\n Decoder.prototype.appendBuffer = function (buffer) {\n if (this.headByte === HEAD_BYTE_REQUIRED && !this.hasRemaining()) {\n this.setBuffer(buffer);\n }\n else {\n // retried because data is insufficient\n var remainingData = this.bytes.subarray(this.pos);\n var newData = Object(_utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_4__[\"ensureUint8Array\"])(buffer);\n var concated = new Uint8Array(remainingData.length + newData.length);\n concated.set(remainingData);\n concated.set(newData, remainingData.length);\n this.setBuffer(concated);\n }\n };\n Decoder.prototype.hasRemaining = function (size) {\n if (size === void 0) { size = 1; }\n return this.view.byteLength - this.pos >= size;\n };\n Decoder.prototype.createExtraByteError = function (posToShow) {\n var _a = this, view = _a.view, pos = _a.pos;\n return new RangeError(\"Extra \" + (view.byteLength - pos) + \" of \" + view.byteLength + \" byte(s) found at buffer[\" + posToShow + \"]\");\n };\n Decoder.prototype.decode = function (buffer) {\n this.reinitializeState();\n this.setBuffer(buffer);\n var object = this.doDecodeSync();\n if (this.hasRemaining()) {\n throw this.createExtraByteError(this.pos);\n }\n return object;\n };\n Decoder.prototype.decodeAsync = function (stream) {\n var stream_1, stream_1_1;\n var e_1, _a;\n return __awaiter(this, void 0, void 0, function () {\n var decoded, object, buffer, e_1_1, _b, headByte, pos, totalPos;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n decoded = false;\n _c.label = 1;\n case 1:\n _c.trys.push([1, 6, 7, 12]);\n stream_1 = __asyncValues(stream);\n _c.label = 2;\n case 2: return [4 /*yield*/, stream_1.next()];\n case 3:\n if (!(stream_1_1 = _c.sent(), !stream_1_1.done)) return [3 /*break*/, 5];\n buffer = stream_1_1.value;\n if (decoded) {\n throw this.createExtraByteError(this.totalPos);\n }\n this.appendBuffer(buffer);\n try {\n object = this.doDecodeSync();\n decoded = true;\n }\n catch (e) {\n if (!(e instanceof DataViewIndexOutOfBoundsError)) {\n throw e; // rethrow\n }\n // fallthrough\n }\n this.totalPos += this.pos;\n _c.label = 4;\n case 4: return [3 /*break*/, 2];\n case 5: return [3 /*break*/, 12];\n case 6:\n e_1_1 = _c.sent();\n e_1 = { error: e_1_1 };\n return [3 /*break*/, 12];\n case 7:\n _c.trys.push([7, , 10, 11]);\n if (!(stream_1_1 && !stream_1_1.done && (_a = stream_1.return))) return [3 /*break*/, 9];\n return [4 /*yield*/, _a.call(stream_1)];\n case 8:\n _c.sent();\n _c.label = 9;\n case 9: return [3 /*break*/, 11];\n case 10:\n if (e_1) throw e_1.error;\n return [7 /*endfinally*/];\n case 11: return [7 /*endfinally*/];\n case 12:\n if (decoded) {\n if (this.hasRemaining()) {\n throw this.createExtraByteError(this.totalPos);\n }\n return [2 /*return*/, object];\n }\n _b = this, headByte = _b.headByte, pos = _b.pos, totalPos = _b.totalPos;\n throw new RangeError(\"Insufficient data in parsing \" + Object(_utils_prettyByte_mjs__WEBPACK_IMPORTED_MODULE_0__[\"prettyByte\"])(headByte) + \" at \" + totalPos + \" (\" + pos + \" in the current buffer)\");\n }\n });\n });\n };\n Decoder.prototype.decodeArrayStream = function (stream) {\n return this.decodeMultiAsync(stream, true);\n };\n Decoder.prototype.decodeStream = function (stream) {\n return this.decodeMultiAsync(stream, false);\n };\n Decoder.prototype.decodeMultiAsync = function (stream, isArray) {\n return __asyncGenerator(this, arguments, function decodeMultiAsync_1() {\n var isArrayHeaderRequired, arrayItemsLeft, stream_2, stream_2_1, buffer, e_2, e_3_1;\n var e_3, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n isArrayHeaderRequired = isArray;\n arrayItemsLeft = -1;\n _b.label = 1;\n case 1:\n _b.trys.push([1, 13, 14, 19]);\n stream_2 = __asyncValues(stream);\n _b.label = 2;\n case 2: return [4 /*yield*/, __await(stream_2.next())];\n case 3:\n if (!(stream_2_1 = _b.sent(), !stream_2_1.done)) return [3 /*break*/, 12];\n buffer = stream_2_1.value;\n if (isArray && arrayItemsLeft === 0) {\n throw this.createExtraByteError(this.totalPos);\n }\n this.appendBuffer(buffer);\n if (isArrayHeaderRequired) {\n arrayItemsLeft = this.readArraySize();\n isArrayHeaderRequired = false;\n this.complete();\n }\n _b.label = 4;\n case 4:\n _b.trys.push([4, 9, , 10]);\n _b.label = 5;\n case 5:\n if (false) {}\n return [4 /*yield*/, __await(this.doDecodeSync())];\n case 6: return [4 /*yield*/, _b.sent()];\n case 7:\n _b.sent();\n if (--arrayItemsLeft === 0) {\n return [3 /*break*/, 8];\n }\n return [3 /*break*/, 5];\n case 8: return [3 /*break*/, 10];\n case 9:\n e_2 = _b.sent();\n if (!(e_2 instanceof DataViewIndexOutOfBoundsError)) {\n throw e_2; // rethrow\n }\n return [3 /*break*/, 10];\n case 10:\n this.totalPos += this.pos;\n _b.label = 11;\n case 11: return [3 /*break*/, 2];\n case 12: return [3 /*break*/, 19];\n case 13:\n e_3_1 = _b.sent();\n e_3 = { error: e_3_1 };\n return [3 /*break*/, 19];\n case 14:\n _b.trys.push([14, , 17, 18]);\n if (!(stream_2_1 && !stream_2_1.done && (_a = stream_2.return))) return [3 /*break*/, 16];\n return [4 /*yield*/, __await(_a.call(stream_2))];\n case 15:\n _b.sent();\n _b.label = 16;\n case 16: return [3 /*break*/, 18];\n case 17:\n if (e_3) throw e_3.error;\n return [7 /*endfinally*/];\n case 18: return [7 /*endfinally*/];\n case 19: return [2 /*return*/];\n }\n });\n });\n };\n Decoder.prototype.doDecodeSync = function () {\n DECODE: while (true) {\n var headByte = this.readHeadByte();\n var object = void 0;\n if (headByte >= 0xe0) {\n // negative fixint (111x xxxx) 0xe0 - 0xff\n object = headByte - 0x100;\n }\n else if (headByte < 0xc0) {\n if (headByte < 0x80) {\n // positive fixint (0xxx xxxx) 0x00 - 0x7f\n object = headByte;\n }\n else if (headByte < 0x90) {\n // fixmap (1000 xxxx) 0x80 - 0x8f\n var size = headByte - 0x80;\n if (size !== 0) {\n this.pushMapState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = {};\n }\n }\n else if (headByte < 0xa0) {\n // fixarray (1001 xxxx) 0x90 - 0x9f\n var size = headByte - 0x90;\n if (size !== 0) {\n this.pushArrayState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = [];\n }\n }\n else {\n // fixstr (101x xxxx) 0xa0 - 0xbf\n var byteLength = headByte - 0xa0;\n object = this.decodeUtf8String(byteLength, 0);\n }\n }\n else if (headByte === 0xc0) {\n // nil\n object = null;\n }\n else if (headByte === 0xc2) {\n // false\n object = false;\n }\n else if (headByte === 0xc3) {\n // true\n object = true;\n }\n else if (headByte === 0xca) {\n // float 32\n object = this.readF32();\n }\n else if (headByte === 0xcb) {\n // float 64\n object = this.readF64();\n }\n else if (headByte === 0xcc) {\n // uint 8\n object = this.readU8();\n }\n else if (headByte === 0xcd) {\n // uint 16\n object = this.readU16();\n }\n else if (headByte === 0xce) {\n // uint 32\n object = this.readU32();\n }\n else if (headByte === 0xcf) {\n // uint 64\n object = this.readU64();\n }\n else if (headByte === 0xd0) {\n // int 8\n object = this.readI8();\n }\n else if (headByte === 0xd1) {\n // int 16\n object = this.readI16();\n }\n else if (headByte === 0xd2) {\n // int 32\n object = this.readI32();\n }\n else if (headByte === 0xd3) {\n // int 64\n object = this.readI64();\n }\n else if (headByte === 0xd9) {\n // str 8\n var byteLength = this.lookU8();\n object = this.decodeUtf8String(byteLength, 1);\n }\n else if (headByte === 0xda) {\n // str 16\n var byteLength = this.lookU16();\n object = this.decodeUtf8String(byteLength, 2);\n }\n else if (headByte === 0xdb) {\n // str 32\n var byteLength = this.lookU32();\n object = this.decodeUtf8String(byteLength, 4);\n }\n else if (headByte === 0xdc) {\n // array 16\n var size = this.readU16();\n if (size !== 0) {\n this.pushArrayState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = [];\n }\n }\n else if (headByte === 0xdd) {\n // array 32\n var size = this.readU32();\n if (size !== 0) {\n this.pushArrayState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = [];\n }\n }\n else if (headByte === 0xde) {\n // map 16\n var size = this.readU16();\n if (size !== 0) {\n this.pushMapState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = {};\n }\n }\n else if (headByte === 0xdf) {\n // map 32\n var size = this.readU32();\n if (size !== 0) {\n this.pushMapState(size);\n this.complete();\n continue DECODE;\n }\n else {\n object = {};\n }\n }\n else if (headByte === 0xc4) {\n // bin 8\n var size = this.lookU8();\n object = this.decodeBinary(size, 1);\n }\n else if (headByte === 0xc5) {\n // bin 16\n var size = this.lookU16();\n object = this.decodeBinary(size, 2);\n }\n else if (headByte === 0xc6) {\n // bin 32\n var size = this.lookU32();\n object = this.decodeBinary(size, 4);\n }\n else if (headByte === 0xd4) {\n // fixext 1\n object = this.decodeExtension(1, 0);\n }\n else if (headByte === 0xd5) {\n // fixext 2\n object = this.decodeExtension(2, 0);\n }\n else if (headByte === 0xd6) {\n // fixext 4\n object = this.decodeExtension(4, 0);\n }\n else if (headByte === 0xd7) {\n // fixext 8\n object = this.decodeExtension(8, 0);\n }\n else if (headByte === 0xd8) {\n // fixext 16\n object = this.decodeExtension(16, 0);\n }\n else if (headByte === 0xc7) {\n // ext 8\n var size = this.lookU8();\n object = this.decodeExtension(size, 1);\n }\n else if (headByte === 0xc8) {\n // ext 16\n var size = this.lookU16();\n object = this.decodeExtension(size, 2);\n }\n else if (headByte === 0xc9) {\n // ext 32\n var size = this.lookU32();\n object = this.decodeExtension(size, 4);\n }\n else {\n throw new Error(\"Unrecognized type byte: \" + Object(_utils_prettyByte_mjs__WEBPACK_IMPORTED_MODULE_0__[\"prettyByte\"])(headByte));\n }\n this.complete();\n var stack = this.stack;\n while (stack.length > 0) {\n // arrays and maps\n var state = stack[stack.length - 1];\n if (state.type === 0 /* ARRAY */) {\n state.array[state.position] = object;\n state.position++;\n if (state.position === state.size) {\n stack.pop();\n object = state.array;\n }\n else {\n continue DECODE;\n }\n }\n else if (state.type === 1 /* MAP_KEY */) {\n if (!isValidMapKeyType(object)) {\n throw new Error(\"The type of key must be string or number but \" + typeof object);\n }\n state.key = object;\n state.type = 2 /* MAP_VALUE */;\n continue DECODE;\n }\n else {\n // it must be `state.type === State.MAP_VALUE` here\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n state.map[state.key] = object;\n state.readCount++;\n if (state.readCount === state.size) {\n stack.pop();\n object = state.map;\n }\n else {\n state.key = null;\n state.type = 1 /* MAP_KEY */;\n continue DECODE;\n }\n }\n }\n return object;\n }\n };\n Decoder.prototype.readHeadByte = function () {\n if (this.headByte === HEAD_BYTE_REQUIRED) {\n this.headByte = this.readU8();\n // console.log(\"headByte\", prettyByte(this.headByte));\n }\n return this.headByte;\n };\n Decoder.prototype.complete = function () {\n this.headByte = HEAD_BYTE_REQUIRED;\n };\n Decoder.prototype.readArraySize = function () {\n var headByte = this.readHeadByte();\n switch (headByte) {\n case 0xdc:\n return this.readU16();\n case 0xdd:\n return this.readU32();\n default: {\n if (headByte < 0xa0) {\n return headByte - 0x90;\n }\n else {\n throw new Error(\"Unrecognized array type byte: \" + Object(_utils_prettyByte_mjs__WEBPACK_IMPORTED_MODULE_0__[\"prettyByte\"])(headByte));\n }\n }\n }\n };\n Decoder.prototype.pushMapState = function (size) {\n if (size > this.maxMapLength) {\n throw new Error(\"Max length exceeded: map length (\" + size + \") > maxMapLengthLength (\" + this.maxMapLength + \")\");\n }\n this.stack.push({\n type: 1 /* MAP_KEY */,\n size: size,\n key: null,\n readCount: 0,\n map: {},\n });\n };\n Decoder.prototype.pushArrayState = function (size) {\n if (size > this.maxArrayLength) {\n throw new Error(\"Max length exceeded: array length (\" + size + \") > maxArrayLength (\" + this.maxArrayLength + \")\");\n }\n this.stack.push({\n type: 0 /* ARRAY */,\n size: size,\n array: new Array(size),\n position: 0,\n });\n };\n Decoder.prototype.decodeUtf8String = function (byteLength, headerOffset) {\n var _a;\n if (byteLength > this.maxStrLength) {\n throw new Error(\"Max length exceeded: UTF-8 byte length (\" + byteLength + \") > maxStrLength (\" + this.maxStrLength + \")\");\n }\n if (this.bytes.byteLength < this.pos + headerOffset + byteLength) {\n throw MORE_DATA;\n }\n var offset = this.pos + headerOffset;\n var object;\n if (this.stateIsMapKey() && ((_a = this.keyDecoder) === null || _a === void 0 ? void 0 : _a.canBeCached(byteLength))) {\n object = this.keyDecoder.decode(this.bytes, offset, byteLength);\n }\n else if (byteLength > _utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TEXT_DECODER_THRESHOLD\"]) {\n object = Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_3__[\"utf8DecodeTD\"])(this.bytes, offset, byteLength);\n }\n else {\n object = Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_3__[\"utf8DecodeJs\"])(this.bytes, offset, byteLength);\n }\n this.pos += headerOffset + byteLength;\n return object;\n };\n Decoder.prototype.stateIsMapKey = function () {\n if (this.stack.length > 0) {\n var state = this.stack[this.stack.length - 1];\n return state.type === 1 /* MAP_KEY */;\n }\n return false;\n };\n Decoder.prototype.decodeBinary = function (byteLength, headOffset) {\n if (byteLength > this.maxBinLength) {\n throw new Error(\"Max length exceeded: bin length (\" + byteLength + \") > maxBinLength (\" + this.maxBinLength + \")\");\n }\n if (!this.hasRemaining(byteLength + headOffset)) {\n throw MORE_DATA;\n }\n var offset = this.pos + headOffset;\n var object = this.bytes.subarray(offset, offset + byteLength);\n this.pos += headOffset + byteLength;\n return object;\n };\n Decoder.prototype.decodeExtension = function (size, headOffset) {\n if (size > this.maxExtLength) {\n throw new Error(\"Max length exceeded: ext length (\" + size + \") > maxExtLength (\" + this.maxExtLength + \")\");\n }\n var extType = this.view.getInt8(this.pos + headOffset);\n var data = this.decodeBinary(size, headOffset + 1 /* extType */);\n return this.extensionCodec.decode(data, extType, this.context);\n };\n Decoder.prototype.lookU8 = function () {\n return this.view.getUint8(this.pos);\n };\n Decoder.prototype.lookU16 = function () {\n return this.view.getUint16(this.pos);\n };\n Decoder.prototype.lookU32 = function () {\n return this.view.getUint32(this.pos);\n };\n Decoder.prototype.readU8 = function () {\n var value = this.view.getUint8(this.pos);\n this.pos++;\n return value;\n };\n Decoder.prototype.readI8 = function () {\n var value = this.view.getInt8(this.pos);\n this.pos++;\n return value;\n };\n Decoder.prototype.readU16 = function () {\n var value = this.view.getUint16(this.pos);\n this.pos += 2;\n return value;\n };\n Decoder.prototype.readI16 = function () {\n var value = this.view.getInt16(this.pos);\n this.pos += 2;\n return value;\n };\n Decoder.prototype.readU32 = function () {\n var value = this.view.getUint32(this.pos);\n this.pos += 4;\n return value;\n };\n Decoder.prototype.readI32 = function () {\n var value = this.view.getInt32(this.pos);\n this.pos += 4;\n return value;\n };\n Decoder.prototype.readU64 = function () {\n var value = Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__[\"getUint64\"])(this.view, this.pos);\n this.pos += 8;\n return value;\n };\n Decoder.prototype.readI64 = function () {\n var value = Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__[\"getInt64\"])(this.view, this.pos);\n this.pos += 8;\n return value;\n };\n Decoder.prototype.readF32 = function () {\n var value = this.view.getFloat32(this.pos);\n this.pos += 4;\n return value;\n };\n Decoder.prototype.readF64 = function () {\n var value = this.view.getFloat64(this.pos);\n this.pos += 8;\n return value;\n };\n return Decoder;\n}());\n\n//# sourceMappingURL=Decoder.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/Encoder.mjs": -/*!**************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/Encoder.mjs ***! - \**************************************************************************************************/ +/*!*********************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/Encoder.mjs ***! + \*********************************************************************************************************/ /*! exports provided: DEFAULT_MAX_DEPTH, DEFAULT_INITIAL_BUFFER_SIZE, Encoder */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DEFAULT_MAX_DEPTH\", function() { return DEFAULT_MAX_DEPTH; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DEFAULT_INITIAL_BUFFER_SIZE\", function() { return DEFAULT_INITIAL_BUFFER_SIZE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Encoder\", function() { return Encoder; });\n/* harmony import */ var _utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/utf8.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs\");\n/* harmony import */ var _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExtensionCodec.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs\");\n/* harmony import */ var _utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/int.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs\");\n/* harmony import */ var _utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/typedArrays.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/typedArrays.mjs\");\n\n\n\n\nvar DEFAULT_MAX_DEPTH = 100;\nvar DEFAULT_INITIAL_BUFFER_SIZE = 2048;\nvar Encoder = /** @class */ (function () {\n function Encoder(extensionCodec, context, maxDepth, initialBufferSize, sortKeys, forceFloat32, ignoreUndefined, forceIntegerToFloat) {\n if (extensionCodec === void 0) { extensionCodec = _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_1__[\"ExtensionCodec\"].defaultCodec; }\n if (context === void 0) { context = undefined; }\n if (maxDepth === void 0) { maxDepth = DEFAULT_MAX_DEPTH; }\n if (initialBufferSize === void 0) { initialBufferSize = DEFAULT_INITIAL_BUFFER_SIZE; }\n if (sortKeys === void 0) { sortKeys = false; }\n if (forceFloat32 === void 0) { forceFloat32 = false; }\n if (ignoreUndefined === void 0) { ignoreUndefined = false; }\n if (forceIntegerToFloat === void 0) { forceIntegerToFloat = false; }\n this.extensionCodec = extensionCodec;\n this.context = context;\n this.maxDepth = maxDepth;\n this.initialBufferSize = initialBufferSize;\n this.sortKeys = sortKeys;\n this.forceFloat32 = forceFloat32;\n this.ignoreUndefined = ignoreUndefined;\n this.forceIntegerToFloat = forceIntegerToFloat;\n this.pos = 0;\n this.view = new DataView(new ArrayBuffer(this.initialBufferSize));\n this.bytes = new Uint8Array(this.view.buffer);\n }\n Encoder.prototype.getUint8Array = function () {\n return this.bytes.subarray(0, this.pos);\n };\n Encoder.prototype.reinitializeState = function () {\n this.pos = 0;\n };\n Encoder.prototype.encode = function (object) {\n this.reinitializeState();\n this.doEncode(object, 1);\n return this.getUint8Array();\n };\n Encoder.prototype.doEncode = function (object, depth) {\n if (depth > this.maxDepth) {\n throw new Error(\"Too deep objects in depth \" + depth);\n }\n if (object == null) {\n this.encodeNil();\n }\n else if (typeof object === \"boolean\") {\n this.encodeBoolean(object);\n }\n else if (typeof object === \"number\") {\n this.encodeNumber(object);\n }\n else if (typeof object === \"string\") {\n this.encodeString(object);\n }\n else {\n this.encodeObject(object, depth);\n }\n };\n Encoder.prototype.ensureBufferSizeToWrite = function (sizeToWrite) {\n var requiredSize = this.pos + sizeToWrite;\n if (this.view.byteLength < requiredSize) {\n this.resizeBuffer(requiredSize * 2);\n }\n };\n Encoder.prototype.resizeBuffer = function (newSize) {\n var newBuffer = new ArrayBuffer(newSize);\n var newBytes = new Uint8Array(newBuffer);\n var newView = new DataView(newBuffer);\n newBytes.set(this.bytes);\n this.view = newView;\n this.bytes = newBytes;\n };\n Encoder.prototype.encodeNil = function () {\n this.writeU8(0xc0);\n };\n Encoder.prototype.encodeBoolean = function (object) {\n if (object === false) {\n this.writeU8(0xc2);\n }\n else {\n this.writeU8(0xc3);\n }\n };\n Encoder.prototype.encodeNumber = function (object) {\n if (Number.isSafeInteger(object) && !this.forceIntegerToFloat) {\n if (object >= 0) {\n if (object < 0x80) {\n // positive fixint\n this.writeU8(object);\n }\n else if (object < 0x100) {\n // uint 8\n this.writeU8(0xcc);\n this.writeU8(object);\n }\n else if (object < 0x10000) {\n // uint 16\n this.writeU8(0xcd);\n this.writeU16(object);\n }\n else if (object < 0x100000000) {\n // uint 32\n this.writeU8(0xce);\n this.writeU32(object);\n }\n else {\n // uint 64\n this.writeU8(0xcf);\n this.writeU64(object);\n }\n }\n else {\n if (object >= -0x20) {\n // nagative fixint\n this.writeU8(0xe0 | (object + 0x20));\n }\n else if (object >= -0x80) {\n // int 8\n this.writeU8(0xd0);\n this.writeI8(object);\n }\n else if (object >= -0x8000) {\n // int 16\n this.writeU8(0xd1);\n this.writeI16(object);\n }\n else if (object >= -0x80000000) {\n // int 32\n this.writeU8(0xd2);\n this.writeI32(object);\n }\n else {\n // int 64\n this.writeU8(0xd3);\n this.writeI64(object);\n }\n }\n }\n else {\n // non-integer numbers\n if (this.forceFloat32) {\n // float 32\n this.writeU8(0xca);\n this.writeF32(object);\n }\n else {\n // float 64\n this.writeU8(0xcb);\n this.writeF64(object);\n }\n }\n };\n Encoder.prototype.writeStringHeader = function (byteLength) {\n if (byteLength < 32) {\n // fixstr\n this.writeU8(0xa0 + byteLength);\n }\n else if (byteLength < 0x100) {\n // str 8\n this.writeU8(0xd9);\n this.writeU8(byteLength);\n }\n else if (byteLength < 0x10000) {\n // str 16\n this.writeU8(0xda);\n this.writeU16(byteLength);\n }\n else if (byteLength < 0x100000000) {\n // str 32\n this.writeU8(0xdb);\n this.writeU32(byteLength);\n }\n else {\n throw new Error(\"Too long string: \" + byteLength + \" bytes in UTF-8\");\n }\n };\n Encoder.prototype.encodeString = function (object) {\n var maxHeaderSize = 1 + 4;\n var strLength = object.length;\n if (strLength > _utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"TEXT_ENCODER_THRESHOLD\"]) {\n var byteLength = Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"utf8Count\"])(object);\n this.ensureBufferSizeToWrite(maxHeaderSize + byteLength);\n this.writeStringHeader(byteLength);\n Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"utf8EncodeTE\"])(object, this.bytes, this.pos);\n this.pos += byteLength;\n }\n else {\n var byteLength = Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"utf8Count\"])(object);\n this.ensureBufferSizeToWrite(maxHeaderSize + byteLength);\n this.writeStringHeader(byteLength);\n Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"utf8EncodeJs\"])(object, this.bytes, this.pos);\n this.pos += byteLength;\n }\n };\n Encoder.prototype.encodeObject = function (object, depth) {\n // try to encode objects with custom codec first of non-primitives\n var ext = this.extensionCodec.tryToEncode(object, this.context);\n if (ext != null) {\n this.encodeExtension(ext);\n }\n else if (Array.isArray(object)) {\n this.encodeArray(object, depth);\n }\n else if (ArrayBuffer.isView(object)) {\n this.encodeBinary(object);\n }\n else if (typeof object === \"object\") {\n this.encodeMap(object, depth);\n }\n else {\n // symbol, function and other special object come here unless extensionCodec handles them.\n throw new Error(\"Unrecognized object: \" + Object.prototype.toString.apply(object));\n }\n };\n Encoder.prototype.encodeBinary = function (object) {\n var size = object.byteLength;\n if (size < 0x100) {\n // bin 8\n this.writeU8(0xc4);\n this.writeU8(size);\n }\n else if (size < 0x10000) {\n // bin 16\n this.writeU8(0xc5);\n this.writeU16(size);\n }\n else if (size < 0x100000000) {\n // bin 32\n this.writeU8(0xc6);\n this.writeU32(size);\n }\n else {\n throw new Error(\"Too large binary: \" + size);\n }\n var bytes = Object(_utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_3__[\"ensureUint8Array\"])(object);\n this.writeU8a(bytes);\n };\n Encoder.prototype.encodeArray = function (object, depth) {\n var size = object.length;\n if (size < 16) {\n // fixarray\n this.writeU8(0x90 + size);\n }\n else if (size < 0x10000) {\n // array 16\n this.writeU8(0xdc);\n this.writeU16(size);\n }\n else if (size < 0x100000000) {\n // array 32\n this.writeU8(0xdd);\n this.writeU32(size);\n }\n else {\n throw new Error(\"Too large array: \" + size);\n }\n for (var _i = 0, object_1 = object; _i < object_1.length; _i++) {\n var item = object_1[_i];\n this.doEncode(item, depth + 1);\n }\n };\n Encoder.prototype.countWithoutUndefined = function (object, keys) {\n var count = 0;\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n if (object[key] !== undefined) {\n count++;\n }\n }\n return count;\n };\n Encoder.prototype.encodeMap = function (object, depth) {\n var keys = Object.keys(object);\n if (this.sortKeys) {\n keys.sort();\n }\n var size = this.ignoreUndefined ? this.countWithoutUndefined(object, keys) : keys.length;\n if (size < 16) {\n // fixmap\n this.writeU8(0x80 + size);\n }\n else if (size < 0x10000) {\n // map 16\n this.writeU8(0xde);\n this.writeU16(size);\n }\n else if (size < 0x100000000) {\n // map 32\n this.writeU8(0xdf);\n this.writeU32(size);\n }\n else {\n throw new Error(\"Too large map object: \" + size);\n }\n for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {\n var key = keys_2[_i];\n var value = object[key];\n if (!(this.ignoreUndefined && value === undefined)) {\n this.encodeString(key);\n this.doEncode(value, depth + 1);\n }\n }\n };\n Encoder.prototype.encodeExtension = function (ext) {\n var size = ext.data.length;\n if (size === 1) {\n // fixext 1\n this.writeU8(0xd4);\n }\n else if (size === 2) {\n // fixext 2\n this.writeU8(0xd5);\n }\n else if (size === 4) {\n // fixext 4\n this.writeU8(0xd6);\n }\n else if (size === 8) {\n // fixext 8\n this.writeU8(0xd7);\n }\n else if (size === 16) {\n // fixext 16\n this.writeU8(0xd8);\n }\n else if (size < 0x100) {\n // ext 8\n this.writeU8(0xc7);\n this.writeU8(size);\n }\n else if (size < 0x10000) {\n // ext 16\n this.writeU8(0xc8);\n this.writeU16(size);\n }\n else if (size < 0x100000000) {\n // ext 32\n this.writeU8(0xc9);\n this.writeU32(size);\n }\n else {\n throw new Error(\"Too large extension object: \" + size);\n }\n this.writeI8(ext.type);\n this.writeU8a(ext.data);\n };\n Encoder.prototype.writeU8 = function (value) {\n this.ensureBufferSizeToWrite(1);\n this.view.setUint8(this.pos, value);\n this.pos++;\n };\n Encoder.prototype.writeU8a = function (values) {\n var size = values.length;\n this.ensureBufferSizeToWrite(size);\n this.bytes.set(values, this.pos);\n this.pos += size;\n };\n Encoder.prototype.writeI8 = function (value) {\n this.ensureBufferSizeToWrite(1);\n this.view.setInt8(this.pos, value);\n this.pos++;\n };\n Encoder.prototype.writeU16 = function (value) {\n this.ensureBufferSizeToWrite(2);\n this.view.setUint16(this.pos, value);\n this.pos += 2;\n };\n Encoder.prototype.writeI16 = function (value) {\n this.ensureBufferSizeToWrite(2);\n this.view.setInt16(this.pos, value);\n this.pos += 2;\n };\n Encoder.prototype.writeU32 = function (value) {\n this.ensureBufferSizeToWrite(4);\n this.view.setUint32(this.pos, value);\n this.pos += 4;\n };\n Encoder.prototype.writeI32 = function (value) {\n this.ensureBufferSizeToWrite(4);\n this.view.setInt32(this.pos, value);\n this.pos += 4;\n };\n Encoder.prototype.writeF32 = function (value) {\n this.ensureBufferSizeToWrite(4);\n this.view.setFloat32(this.pos, value);\n this.pos += 4;\n };\n Encoder.prototype.writeF64 = function (value) {\n this.ensureBufferSizeToWrite(8);\n this.view.setFloat64(this.pos, value);\n this.pos += 8;\n };\n Encoder.prototype.writeU64 = function (value) {\n this.ensureBufferSizeToWrite(8);\n Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__[\"setUint64\"])(this.view, this.pos, value);\n this.pos += 8;\n };\n Encoder.prototype.writeI64 = function (value) {\n this.ensureBufferSizeToWrite(8);\n Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__[\"setInt64\"])(this.view, this.pos, value);\n this.pos += 8;\n };\n return Encoder;\n}());\n\n//# sourceMappingURL=Encoder.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/Encoder.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DEFAULT_MAX_DEPTH\", function() { return DEFAULT_MAX_DEPTH; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DEFAULT_INITIAL_BUFFER_SIZE\", function() { return DEFAULT_INITIAL_BUFFER_SIZE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Encoder\", function() { return Encoder; });\n/* harmony import */ var _utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/utf8.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs\");\n/* harmony import */ var _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExtensionCodec.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs\");\n/* harmony import */ var _utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/int.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs\");\n/* harmony import */ var _utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/typedArrays.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/typedArrays.mjs\");\n\n\n\n\nvar DEFAULT_MAX_DEPTH = 100;\nvar DEFAULT_INITIAL_BUFFER_SIZE = 2048;\nvar Encoder = /** @class */ (function () {\n function Encoder(extensionCodec, context, maxDepth, initialBufferSize, sortKeys, forceFloat32, ignoreUndefined, forceIntegerToFloat) {\n if (extensionCodec === void 0) { extensionCodec = _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_1__[\"ExtensionCodec\"].defaultCodec; }\n if (context === void 0) { context = undefined; }\n if (maxDepth === void 0) { maxDepth = DEFAULT_MAX_DEPTH; }\n if (initialBufferSize === void 0) { initialBufferSize = DEFAULT_INITIAL_BUFFER_SIZE; }\n if (sortKeys === void 0) { sortKeys = false; }\n if (forceFloat32 === void 0) { forceFloat32 = false; }\n if (ignoreUndefined === void 0) { ignoreUndefined = false; }\n if (forceIntegerToFloat === void 0) { forceIntegerToFloat = false; }\n this.extensionCodec = extensionCodec;\n this.context = context;\n this.maxDepth = maxDepth;\n this.initialBufferSize = initialBufferSize;\n this.sortKeys = sortKeys;\n this.forceFloat32 = forceFloat32;\n this.ignoreUndefined = ignoreUndefined;\n this.forceIntegerToFloat = forceIntegerToFloat;\n this.pos = 0;\n this.view = new DataView(new ArrayBuffer(this.initialBufferSize));\n this.bytes = new Uint8Array(this.view.buffer);\n }\n Encoder.prototype.getUint8Array = function () {\n return this.bytes.subarray(0, this.pos);\n };\n Encoder.prototype.reinitializeState = function () {\n this.pos = 0;\n };\n Encoder.prototype.encode = function (object) {\n this.reinitializeState();\n this.doEncode(object, 1);\n return this.getUint8Array();\n };\n Encoder.prototype.doEncode = function (object, depth) {\n if (depth > this.maxDepth) {\n throw new Error(\"Too deep objects in depth \" + depth);\n }\n if (object == null) {\n this.encodeNil();\n }\n else if (typeof object === \"boolean\") {\n this.encodeBoolean(object);\n }\n else if (typeof object === \"number\") {\n this.encodeNumber(object);\n }\n else if (typeof object === \"string\") {\n this.encodeString(object);\n }\n else {\n this.encodeObject(object, depth);\n }\n };\n Encoder.prototype.ensureBufferSizeToWrite = function (sizeToWrite) {\n var requiredSize = this.pos + sizeToWrite;\n if (this.view.byteLength < requiredSize) {\n this.resizeBuffer(requiredSize * 2);\n }\n };\n Encoder.prototype.resizeBuffer = function (newSize) {\n var newBuffer = new ArrayBuffer(newSize);\n var newBytes = new Uint8Array(newBuffer);\n var newView = new DataView(newBuffer);\n newBytes.set(this.bytes);\n this.view = newView;\n this.bytes = newBytes;\n };\n Encoder.prototype.encodeNil = function () {\n this.writeU8(0xc0);\n };\n Encoder.prototype.encodeBoolean = function (object) {\n if (object === false) {\n this.writeU8(0xc2);\n }\n else {\n this.writeU8(0xc3);\n }\n };\n Encoder.prototype.encodeNumber = function (object) {\n if (Number.isSafeInteger(object) && !this.forceIntegerToFloat) {\n if (object >= 0) {\n if (object < 0x80) {\n // positive fixint\n this.writeU8(object);\n }\n else if (object < 0x100) {\n // uint 8\n this.writeU8(0xcc);\n this.writeU8(object);\n }\n else if (object < 0x10000) {\n // uint 16\n this.writeU8(0xcd);\n this.writeU16(object);\n }\n else if (object < 0x100000000) {\n // uint 32\n this.writeU8(0xce);\n this.writeU32(object);\n }\n else {\n // uint 64\n this.writeU8(0xcf);\n this.writeU64(object);\n }\n }\n else {\n if (object >= -0x20) {\n // nagative fixint\n this.writeU8(0xe0 | (object + 0x20));\n }\n else if (object >= -0x80) {\n // int 8\n this.writeU8(0xd0);\n this.writeI8(object);\n }\n else if (object >= -0x8000) {\n // int 16\n this.writeU8(0xd1);\n this.writeI16(object);\n }\n else if (object >= -0x80000000) {\n // int 32\n this.writeU8(0xd2);\n this.writeI32(object);\n }\n else {\n // int 64\n this.writeU8(0xd3);\n this.writeI64(object);\n }\n }\n }\n else {\n // non-integer numbers\n if (this.forceFloat32) {\n // float 32\n this.writeU8(0xca);\n this.writeF32(object);\n }\n else {\n // float 64\n this.writeU8(0xcb);\n this.writeF64(object);\n }\n }\n };\n Encoder.prototype.writeStringHeader = function (byteLength) {\n if (byteLength < 32) {\n // fixstr\n this.writeU8(0xa0 + byteLength);\n }\n else if (byteLength < 0x100) {\n // str 8\n this.writeU8(0xd9);\n this.writeU8(byteLength);\n }\n else if (byteLength < 0x10000) {\n // str 16\n this.writeU8(0xda);\n this.writeU16(byteLength);\n }\n else if (byteLength < 0x100000000) {\n // str 32\n this.writeU8(0xdb);\n this.writeU32(byteLength);\n }\n else {\n throw new Error(\"Too long string: \" + byteLength + \" bytes in UTF-8\");\n }\n };\n Encoder.prototype.encodeString = function (object) {\n var maxHeaderSize = 1 + 4;\n var strLength = object.length;\n if (strLength > _utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"TEXT_ENCODER_THRESHOLD\"]) {\n var byteLength = Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"utf8Count\"])(object);\n this.ensureBufferSizeToWrite(maxHeaderSize + byteLength);\n this.writeStringHeader(byteLength);\n Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"utf8EncodeTE\"])(object, this.bytes, this.pos);\n this.pos += byteLength;\n }\n else {\n var byteLength = Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"utf8Count\"])(object);\n this.ensureBufferSizeToWrite(maxHeaderSize + byteLength);\n this.writeStringHeader(byteLength);\n Object(_utils_utf8_mjs__WEBPACK_IMPORTED_MODULE_0__[\"utf8EncodeJs\"])(object, this.bytes, this.pos);\n this.pos += byteLength;\n }\n };\n Encoder.prototype.encodeObject = function (object, depth) {\n // try to encode objects with custom codec first of non-primitives\n var ext = this.extensionCodec.tryToEncode(object, this.context);\n if (ext != null) {\n this.encodeExtension(ext);\n }\n else if (Array.isArray(object)) {\n this.encodeArray(object, depth);\n }\n else if (ArrayBuffer.isView(object)) {\n this.encodeBinary(object);\n }\n else if (typeof object === \"object\") {\n this.encodeMap(object, depth);\n }\n else {\n // symbol, function and other special object come here unless extensionCodec handles them.\n throw new Error(\"Unrecognized object: \" + Object.prototype.toString.apply(object));\n }\n };\n Encoder.prototype.encodeBinary = function (object) {\n var size = object.byteLength;\n if (size < 0x100) {\n // bin 8\n this.writeU8(0xc4);\n this.writeU8(size);\n }\n else if (size < 0x10000) {\n // bin 16\n this.writeU8(0xc5);\n this.writeU16(size);\n }\n else if (size < 0x100000000) {\n // bin 32\n this.writeU8(0xc6);\n this.writeU32(size);\n }\n else {\n throw new Error(\"Too large binary: \" + size);\n }\n var bytes = Object(_utils_typedArrays_mjs__WEBPACK_IMPORTED_MODULE_3__[\"ensureUint8Array\"])(object);\n this.writeU8a(bytes);\n };\n Encoder.prototype.encodeArray = function (object, depth) {\n var size = object.length;\n if (size < 16) {\n // fixarray\n this.writeU8(0x90 + size);\n }\n else if (size < 0x10000) {\n // array 16\n this.writeU8(0xdc);\n this.writeU16(size);\n }\n else if (size < 0x100000000) {\n // array 32\n this.writeU8(0xdd);\n this.writeU32(size);\n }\n else {\n throw new Error(\"Too large array: \" + size);\n }\n for (var _i = 0, object_1 = object; _i < object_1.length; _i++) {\n var item = object_1[_i];\n this.doEncode(item, depth + 1);\n }\n };\n Encoder.prototype.countWithoutUndefined = function (object, keys) {\n var count = 0;\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n if (object[key] !== undefined) {\n count++;\n }\n }\n return count;\n };\n Encoder.prototype.encodeMap = function (object, depth) {\n var keys = Object.keys(object);\n if (this.sortKeys) {\n keys.sort();\n }\n var size = this.ignoreUndefined ? this.countWithoutUndefined(object, keys) : keys.length;\n if (size < 16) {\n // fixmap\n this.writeU8(0x80 + size);\n }\n else if (size < 0x10000) {\n // map 16\n this.writeU8(0xde);\n this.writeU16(size);\n }\n else if (size < 0x100000000) {\n // map 32\n this.writeU8(0xdf);\n this.writeU32(size);\n }\n else {\n throw new Error(\"Too large map object: \" + size);\n }\n for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {\n var key = keys_2[_i];\n var value = object[key];\n if (!(this.ignoreUndefined && value === undefined)) {\n this.encodeString(key);\n this.doEncode(value, depth + 1);\n }\n }\n };\n Encoder.prototype.encodeExtension = function (ext) {\n var size = ext.data.length;\n if (size === 1) {\n // fixext 1\n this.writeU8(0xd4);\n }\n else if (size === 2) {\n // fixext 2\n this.writeU8(0xd5);\n }\n else if (size === 4) {\n // fixext 4\n this.writeU8(0xd6);\n }\n else if (size === 8) {\n // fixext 8\n this.writeU8(0xd7);\n }\n else if (size === 16) {\n // fixext 16\n this.writeU8(0xd8);\n }\n else if (size < 0x100) {\n // ext 8\n this.writeU8(0xc7);\n this.writeU8(size);\n }\n else if (size < 0x10000) {\n // ext 16\n this.writeU8(0xc8);\n this.writeU16(size);\n }\n else if (size < 0x100000000) {\n // ext 32\n this.writeU8(0xc9);\n this.writeU32(size);\n }\n else {\n throw new Error(\"Too large extension object: \" + size);\n }\n this.writeI8(ext.type);\n this.writeU8a(ext.data);\n };\n Encoder.prototype.writeU8 = function (value) {\n this.ensureBufferSizeToWrite(1);\n this.view.setUint8(this.pos, value);\n this.pos++;\n };\n Encoder.prototype.writeU8a = function (values) {\n var size = values.length;\n this.ensureBufferSizeToWrite(size);\n this.bytes.set(values, this.pos);\n this.pos += size;\n };\n Encoder.prototype.writeI8 = function (value) {\n this.ensureBufferSizeToWrite(1);\n this.view.setInt8(this.pos, value);\n this.pos++;\n };\n Encoder.prototype.writeU16 = function (value) {\n this.ensureBufferSizeToWrite(2);\n this.view.setUint16(this.pos, value);\n this.pos += 2;\n };\n Encoder.prototype.writeI16 = function (value) {\n this.ensureBufferSizeToWrite(2);\n this.view.setInt16(this.pos, value);\n this.pos += 2;\n };\n Encoder.prototype.writeU32 = function (value) {\n this.ensureBufferSizeToWrite(4);\n this.view.setUint32(this.pos, value);\n this.pos += 4;\n };\n Encoder.prototype.writeI32 = function (value) {\n this.ensureBufferSizeToWrite(4);\n this.view.setInt32(this.pos, value);\n this.pos += 4;\n };\n Encoder.prototype.writeF32 = function (value) {\n this.ensureBufferSizeToWrite(4);\n this.view.setFloat32(this.pos, value);\n this.pos += 4;\n };\n Encoder.prototype.writeF64 = function (value) {\n this.ensureBufferSizeToWrite(8);\n this.view.setFloat64(this.pos, value);\n this.pos += 8;\n };\n Encoder.prototype.writeU64 = function (value) {\n this.ensureBufferSizeToWrite(8);\n Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__[\"setUint64\"])(this.view, this.pos, value);\n this.pos += 8;\n };\n Encoder.prototype.writeI64 = function (value) {\n this.ensureBufferSizeToWrite(8);\n Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_2__[\"setInt64\"])(this.view, this.pos, value);\n this.pos += 8;\n };\n return Encoder;\n}());\n\n//# sourceMappingURL=Encoder.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/Encoder.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtData.mjs": -/*!**************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/ExtData.mjs ***! - \**************************************************************************************************/ +/*!*********************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/ExtData.mjs ***! + \*********************************************************************************************************/ /*! exports provided: ExtData */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExtData\", function() { return ExtData; });\n/**\n * ExtData is used to handle Extension Types that are not registered to ExtensionCodec.\n */\nvar ExtData = /** @class */ (function () {\n function ExtData(type, data) {\n this.type = type;\n this.data = data;\n }\n return ExtData;\n}());\n\n//# sourceMappingURL=ExtData.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/ExtData.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExtData\", function() { return ExtData; });\n/**\n * ExtData is used to handle Extension Types that are not registered to ExtensionCodec.\n */\nvar ExtData = /** @class */ (function () {\n function ExtData(type, data) {\n this.type = type;\n this.data = data;\n }\n return ExtData;\n}());\n\n//# sourceMappingURL=ExtData.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/ExtData.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs": -/*!*********************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs ***! - \*********************************************************************************************************/ +/*!****************************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs ***! + \****************************************************************************************************************/ /*! exports provided: ExtensionCodec */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExtensionCodec\", function() { return ExtensionCodec; });\n/* harmony import */ var _ExtData_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExtData.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtData.mjs\");\n/* harmony import */ var _timestamp_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./timestamp.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/timestamp.mjs\");\n// ExtensionCodec to handle MessagePack extensions\n\n\nvar ExtensionCodec = /** @class */ (function () {\n function ExtensionCodec() {\n // built-in extensions\n this.builtInEncoders = [];\n this.builtInDecoders = [];\n // custom extensions\n this.encoders = [];\n this.decoders = [];\n this.register(_timestamp_mjs__WEBPACK_IMPORTED_MODULE_1__[\"timestampExtension\"]);\n }\n ExtensionCodec.prototype.register = function (_a) {\n var type = _a.type, encode = _a.encode, decode = _a.decode;\n if (type >= 0) {\n // custom extensions\n this.encoders[type] = encode;\n this.decoders[type] = decode;\n }\n else {\n // built-in extensions\n var index = 1 + type;\n this.builtInEncoders[index] = encode;\n this.builtInDecoders[index] = decode;\n }\n };\n ExtensionCodec.prototype.tryToEncode = function (object, context) {\n // built-in extensions\n for (var i = 0; i < this.builtInEncoders.length; i++) {\n var encoder = this.builtInEncoders[i];\n if (encoder != null) {\n var data = encoder(object, context);\n if (data != null) {\n var type = -1 - i;\n return new _ExtData_mjs__WEBPACK_IMPORTED_MODULE_0__[\"ExtData\"](type, data);\n }\n }\n }\n // custom extensions\n for (var i = 0; i < this.encoders.length; i++) {\n var encoder = this.encoders[i];\n if (encoder != null) {\n var data = encoder(object, context);\n if (data != null) {\n var type = i;\n return new _ExtData_mjs__WEBPACK_IMPORTED_MODULE_0__[\"ExtData\"](type, data);\n }\n }\n }\n if (object instanceof _ExtData_mjs__WEBPACK_IMPORTED_MODULE_0__[\"ExtData\"]) {\n // to keep ExtData as is\n return object;\n }\n return null;\n };\n ExtensionCodec.prototype.decode = function (data, type, context) {\n var decoder = type < 0 ? this.builtInDecoders[-1 - type] : this.decoders[type];\n if (decoder) {\n return decoder(data, type, context);\n }\n else {\n // decode() does not fail, returns ExtData instead.\n return new _ExtData_mjs__WEBPACK_IMPORTED_MODULE_0__[\"ExtData\"](type, data);\n }\n };\n ExtensionCodec.defaultCodec = new ExtensionCodec();\n return ExtensionCodec;\n}());\n\n//# sourceMappingURL=ExtensionCodec.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExtensionCodec\", function() { return ExtensionCodec; });\n/* harmony import */ var _ExtData_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExtData.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtData.mjs\");\n/* harmony import */ var _timestamp_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./timestamp.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/timestamp.mjs\");\n// ExtensionCodec to handle MessagePack extensions\n\n\nvar ExtensionCodec = /** @class */ (function () {\n function ExtensionCodec() {\n // built-in extensions\n this.builtInEncoders = [];\n this.builtInDecoders = [];\n // custom extensions\n this.encoders = [];\n this.decoders = [];\n this.register(_timestamp_mjs__WEBPACK_IMPORTED_MODULE_1__[\"timestampExtension\"]);\n }\n ExtensionCodec.prototype.register = function (_a) {\n var type = _a.type, encode = _a.encode, decode = _a.decode;\n if (type >= 0) {\n // custom extensions\n this.encoders[type] = encode;\n this.decoders[type] = decode;\n }\n else {\n // built-in extensions\n var index = 1 + type;\n this.builtInEncoders[index] = encode;\n this.builtInDecoders[index] = decode;\n }\n };\n ExtensionCodec.prototype.tryToEncode = function (object, context) {\n // built-in extensions\n for (var i = 0; i < this.builtInEncoders.length; i++) {\n var encoder = this.builtInEncoders[i];\n if (encoder != null) {\n var data = encoder(object, context);\n if (data != null) {\n var type = -1 - i;\n return new _ExtData_mjs__WEBPACK_IMPORTED_MODULE_0__[\"ExtData\"](type, data);\n }\n }\n }\n // custom extensions\n for (var i = 0; i < this.encoders.length; i++) {\n var encoder = this.encoders[i];\n if (encoder != null) {\n var data = encoder(object, context);\n if (data != null) {\n var type = i;\n return new _ExtData_mjs__WEBPACK_IMPORTED_MODULE_0__[\"ExtData\"](type, data);\n }\n }\n }\n if (object instanceof _ExtData_mjs__WEBPACK_IMPORTED_MODULE_0__[\"ExtData\"]) {\n // to keep ExtData as is\n return object;\n }\n return null;\n };\n ExtensionCodec.prototype.decode = function (data, type, context) {\n var decoder = type < 0 ? this.builtInDecoders[-1 - type] : this.decoders[type];\n if (decoder) {\n return decoder(data, type, context);\n }\n else {\n // decode() does not fail, returns ExtData instead.\n return new _ExtData_mjs__WEBPACK_IMPORTED_MODULE_0__[\"ExtData\"](type, data);\n }\n };\n ExtensionCodec.defaultCodec = new ExtensionCodec();\n return ExtensionCodec;\n}());\n\n//# sourceMappingURL=ExtensionCodec.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/decode.mjs": -/*!*************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/decode.mjs ***! - \*************************************************************************************************/ +/*!********************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/decode.mjs ***! + \********************************************************************************************************/ /*! exports provided: defaultDecodeOptions, decode */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultDecodeOptions\", function() { return defaultDecodeOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decode\", function() { return decode; });\n/* harmony import */ var _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Decoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs\");\n\nvar defaultDecodeOptions = {};\n/**\n * It decodes a MessagePack-encoded buffer.\n *\n * This is a synchronous decoding function. See other variants for asynchronous decoding: `decodeAsync()`, `decodeStream()`, `decodeArrayStream()`.\n */\nfunction decode(buffer, options) {\n if (options === void 0) { options = defaultDecodeOptions; }\n var decoder = new _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__[\"Decoder\"](options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength);\n return decoder.decode(buffer);\n}\n//# sourceMappingURL=decode.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/decode.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultDecodeOptions\", function() { return defaultDecodeOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decode\", function() { return decode; });\n/* harmony import */ var _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Decoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs\");\n\nvar defaultDecodeOptions = {};\n/**\n * It decodes a MessagePack-encoded buffer.\n *\n * This is a synchronous decoding function. See other variants for asynchronous decoding: `decodeAsync()`, `decodeStream()`, `decodeArrayStream()`.\n */\nfunction decode(buffer, options) {\n if (options === void 0) { options = defaultDecodeOptions; }\n var decoder = new _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__[\"Decoder\"](options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength);\n return decoder.decode(buffer);\n}\n//# sourceMappingURL=decode.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/decode.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs": -/*!******************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs ***! - \******************************************************************************************************/ +/*!*************************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs ***! + \*************************************************************************************************************/ /*! exports provided: decodeAsync, decodeArrayStream, decodeStream */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeAsync\", function() { return decodeAsync; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeArrayStream\", function() { return decodeArrayStream; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeStream\", function() { return decodeStream; });\n/* harmony import */ var _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Decoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs\");\n/* harmony import */ var _decode_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decode.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/decode.mjs\");\n/* harmony import */ var _utils_stream_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/stream.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n\n\n\nfunction decodeAsync(streamLike, options) {\n if (options === void 0) { options = _decode_mjs__WEBPACK_IMPORTED_MODULE_1__[\"defaultDecodeOptions\"]; }\n return __awaiter(this, void 0, void 0, function () {\n var stream, decoder;\n return __generator(this, function (_a) {\n stream = Object(_utils_stream_mjs__WEBPACK_IMPORTED_MODULE_2__[\"ensureAsyncIterabe\"])(streamLike);\n decoder = new _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__[\"Decoder\"](options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength);\n return [2 /*return*/, decoder.decodeAsync(stream)];\n });\n });\n}\nfunction decodeArrayStream(streamLike, options) {\n if (options === void 0) { options = _decode_mjs__WEBPACK_IMPORTED_MODULE_1__[\"defaultDecodeOptions\"]; }\n var stream = Object(_utils_stream_mjs__WEBPACK_IMPORTED_MODULE_2__[\"ensureAsyncIterabe\"])(streamLike);\n var decoder = new _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__[\"Decoder\"](options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength);\n return decoder.decodeArrayStream(stream);\n}\nfunction decodeStream(streamLike, options) {\n if (options === void 0) { options = _decode_mjs__WEBPACK_IMPORTED_MODULE_1__[\"defaultDecodeOptions\"]; }\n var stream = Object(_utils_stream_mjs__WEBPACK_IMPORTED_MODULE_2__[\"ensureAsyncIterabe\"])(streamLike);\n var decoder = new _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__[\"Decoder\"](options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength);\n return decoder.decodeStream(stream);\n}\n//# sourceMappingURL=decodeAsync.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeAsync\", function() { return decodeAsync; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeArrayStream\", function() { return decodeArrayStream; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeStream\", function() { return decodeStream; });\n/* harmony import */ var _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Decoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs\");\n/* harmony import */ var _decode_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decode.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/decode.mjs\");\n/* harmony import */ var _utils_stream_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/stream.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n\n\n\nfunction decodeAsync(streamLike, options) {\n if (options === void 0) { options = _decode_mjs__WEBPACK_IMPORTED_MODULE_1__[\"defaultDecodeOptions\"]; }\n return __awaiter(this, void 0, void 0, function () {\n var stream, decoder;\n return __generator(this, function (_a) {\n stream = Object(_utils_stream_mjs__WEBPACK_IMPORTED_MODULE_2__[\"ensureAsyncIterabe\"])(streamLike);\n decoder = new _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__[\"Decoder\"](options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength);\n return [2 /*return*/, decoder.decodeAsync(stream)];\n });\n });\n}\nfunction decodeArrayStream(streamLike, options) {\n if (options === void 0) { options = _decode_mjs__WEBPACK_IMPORTED_MODULE_1__[\"defaultDecodeOptions\"]; }\n var stream = Object(_utils_stream_mjs__WEBPACK_IMPORTED_MODULE_2__[\"ensureAsyncIterabe\"])(streamLike);\n var decoder = new _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__[\"Decoder\"](options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength);\n return decoder.decodeArrayStream(stream);\n}\nfunction decodeStream(streamLike, options) {\n if (options === void 0) { options = _decode_mjs__WEBPACK_IMPORTED_MODULE_1__[\"defaultDecodeOptions\"]; }\n var stream = Object(_utils_stream_mjs__WEBPACK_IMPORTED_MODULE_2__[\"ensureAsyncIterabe\"])(streamLike);\n var decoder = new _Decoder_mjs__WEBPACK_IMPORTED_MODULE_0__[\"Decoder\"](options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength);\n return decoder.decodeStream(stream);\n}\n//# sourceMappingURL=decodeAsync.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/encode.mjs": -/*!*************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/encode.mjs ***! - \*************************************************************************************************/ +/*!********************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/encode.mjs ***! + \********************************************************************************************************/ /*! exports provided: encode */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"encode\", function() { return encode; });\n/* harmony import */ var _Encoder_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Encoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/Encoder.mjs\");\n\nvar defaultEncodeOptions = {};\n/**\n * It encodes `value` in the MessagePack format and\n * returns a byte buffer.\n *\n * The returned buffer is a slice of a larger `ArrayBuffer`, so you have to use its `#byteOffset` and `#byteLength` in order to convert it to another typed arrays including NodeJS `Buffer`.\n */\nfunction encode(value, options) {\n if (options === void 0) { options = defaultEncodeOptions; }\n var encoder = new _Encoder_mjs__WEBPACK_IMPORTED_MODULE_0__[\"Encoder\"](options.extensionCodec, options.context, options.maxDepth, options.initialBufferSize, options.sortKeys, options.forceFloat32, options.ignoreUndefined, options.forceIntegerToFloat);\n return encoder.encode(value);\n}\n//# sourceMappingURL=encode.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/encode.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"encode\", function() { return encode; });\n/* harmony import */ var _Encoder_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Encoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/Encoder.mjs\");\n\nvar defaultEncodeOptions = {};\n/**\n * It encodes `value` in the MessagePack format and\n * returns a byte buffer.\n *\n * The returned buffer is a slice of a larger `ArrayBuffer`, so you have to use its `#byteOffset` and `#byteLength` in order to convert it to another typed arrays including NodeJS `Buffer`.\n */\nfunction encode(value, options) {\n if (options === void 0) { options = defaultEncodeOptions; }\n var encoder = new _Encoder_mjs__WEBPACK_IMPORTED_MODULE_0__[\"Encoder\"](options.extensionCodec, options.context, options.maxDepth, options.initialBufferSize, options.sortKeys, options.forceFloat32, options.ignoreUndefined, options.forceIntegerToFloat);\n return encoder.encode(value);\n}\n//# sourceMappingURL=encode.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/encode.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs": -/*!************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs ***! - \************************************************************************************************/ +/*!*******************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs ***! + \*******************************************************************************************************/ /*! exports provided: encode, decode, decodeAsync, decodeArrayStream, decodeStream, Decoder, Encoder, ExtensionCodec, ExtData, EXT_TIMESTAMP, encodeDateToTimeSpec, encodeTimeSpecToTimestamp, decodeTimestampToTimeSpec, encodeTimestampExtension, decodeTimestampExtension */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _encode_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./encode.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/encode.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"encode\", function() { return _encode_mjs__WEBPACK_IMPORTED_MODULE_0__[\"encode\"]; });\n\n/* harmony import */ var _decode_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decode.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/decode.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decode\", function() { return _decode_mjs__WEBPACK_IMPORTED_MODULE_1__[\"decode\"]; });\n\n/* harmony import */ var _decodeAsync_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./decodeAsync.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decodeAsync\", function() { return _decodeAsync_mjs__WEBPACK_IMPORTED_MODULE_2__[\"decodeAsync\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decodeArrayStream\", function() { return _decodeAsync_mjs__WEBPACK_IMPORTED_MODULE_2__[\"decodeArrayStream\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decodeStream\", function() { return _decodeAsync_mjs__WEBPACK_IMPORTED_MODULE_2__[\"decodeStream\"]; });\n\n/* harmony import */ var _Decoder_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Decoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Decoder\", function() { return _Decoder_mjs__WEBPACK_IMPORTED_MODULE_3__[\"Decoder\"]; });\n\n/* harmony import */ var _Encoder_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Encoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/Encoder.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Encoder\", function() { return _Encoder_mjs__WEBPACK_IMPORTED_MODULE_4__[\"Encoder\"]; });\n\n/* harmony import */ var _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ExtensionCodec.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExtensionCodec\", function() { return _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_5__[\"ExtensionCodec\"]; });\n\n/* harmony import */ var _ExtData_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ExtData.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtData.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExtData\", function() { return _ExtData_mjs__WEBPACK_IMPORTED_MODULE_6__[\"ExtData\"]; });\n\n/* harmony import */ var _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./timestamp.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/timestamp.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EXT_TIMESTAMP\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"EXT_TIMESTAMP\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"encodeDateToTimeSpec\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"encodeDateToTimeSpec\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"encodeTimeSpecToTimestamp\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"encodeTimeSpecToTimestamp\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decodeTimestampToTimeSpec\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"decodeTimestampToTimeSpec\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"encodeTimestampExtension\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"encodeTimestampExtension\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decodeTimestampExtension\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"decodeTimestampExtension\"]; });\n\n// Main Functions:\n\n\n\n\n\n\n\n\n\n\n// Utilitiies for Extension Types:\n\n\n\n\n\n\n//# sourceMappingURL=index.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _encode_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./encode.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/encode.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"encode\", function() { return _encode_mjs__WEBPACK_IMPORTED_MODULE_0__[\"encode\"]; });\n\n/* harmony import */ var _decode_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decode.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/decode.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decode\", function() { return _decode_mjs__WEBPACK_IMPORTED_MODULE_1__[\"decode\"]; });\n\n/* harmony import */ var _decodeAsync_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./decodeAsync.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decodeAsync\", function() { return _decodeAsync_mjs__WEBPACK_IMPORTED_MODULE_2__[\"decodeAsync\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decodeArrayStream\", function() { return _decodeAsync_mjs__WEBPACK_IMPORTED_MODULE_2__[\"decodeArrayStream\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decodeStream\", function() { return _decodeAsync_mjs__WEBPACK_IMPORTED_MODULE_2__[\"decodeStream\"]; });\n\n/* harmony import */ var _Decoder_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Decoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Decoder\", function() { return _Decoder_mjs__WEBPACK_IMPORTED_MODULE_3__[\"Decoder\"]; });\n\n/* harmony import */ var _Encoder_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Encoder.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/Encoder.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Encoder\", function() { return _Encoder_mjs__WEBPACK_IMPORTED_MODULE_4__[\"Encoder\"]; });\n\n/* harmony import */ var _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ExtensionCodec.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtensionCodec.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExtensionCodec\", function() { return _ExtensionCodec_mjs__WEBPACK_IMPORTED_MODULE_5__[\"ExtensionCodec\"]; });\n\n/* harmony import */ var _ExtData_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ExtData.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/ExtData.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExtData\", function() { return _ExtData_mjs__WEBPACK_IMPORTED_MODULE_6__[\"ExtData\"]; });\n\n/* harmony import */ var _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./timestamp.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/timestamp.mjs\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EXT_TIMESTAMP\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"EXT_TIMESTAMP\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"encodeDateToTimeSpec\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"encodeDateToTimeSpec\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"encodeTimeSpecToTimestamp\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"encodeTimeSpecToTimestamp\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decodeTimestampToTimeSpec\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"decodeTimestampToTimeSpec\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"encodeTimestampExtension\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"encodeTimestampExtension\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"decodeTimestampExtension\", function() { return _timestamp_mjs__WEBPACK_IMPORTED_MODULE_7__[\"decodeTimestampExtension\"]; });\n\n// Main Functions:\n\n\n\n\n\n\n\n\n\n\n// Utilitiies for Extension Types:\n\n\n\n\n\n\n//# sourceMappingURL=index.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/timestamp.mjs": -/*!****************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/timestamp.mjs ***! - \****************************************************************************************************/ +/*!***********************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/timestamp.mjs ***! + \***********************************************************************************************************/ /*! exports provided: EXT_TIMESTAMP, encodeTimeSpecToTimestamp, encodeDateToTimeSpec, encodeTimestampExtension, decodeTimestampToTimeSpec, decodeTimestampExtension, timestampExtension */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EXT_TIMESTAMP\", function() { return EXT_TIMESTAMP; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"encodeTimeSpecToTimestamp\", function() { return encodeTimeSpecToTimestamp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"encodeDateToTimeSpec\", function() { return encodeDateToTimeSpec; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"encodeTimestampExtension\", function() { return encodeTimestampExtension; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeTimestampToTimeSpec\", function() { return decodeTimestampToTimeSpec; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeTimestampExtension\", function() { return decodeTimestampExtension; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"timestampExtension\", function() { return timestampExtension; });\n/* harmony import */ var _utils_int_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/int.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs\");\n// https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type\n\nvar EXT_TIMESTAMP = -1;\nvar TIMESTAMP32_MAX_SEC = 0x100000000 - 1; // 32-bit unsigned int\nvar TIMESTAMP64_MAX_SEC = 0x400000000 - 1; // 34-bit unsigned int\nfunction encodeTimeSpecToTimestamp(_a) {\n var sec = _a.sec, nsec = _a.nsec;\n if (sec >= 0 && nsec >= 0 && sec <= TIMESTAMP64_MAX_SEC) {\n // Here sec >= 0 && nsec >= 0\n if (nsec === 0 && sec <= TIMESTAMP32_MAX_SEC) {\n // timestamp 32 = { sec32 (unsigned) }\n var rv = new Uint8Array(4);\n var view = new DataView(rv.buffer);\n view.setUint32(0, sec);\n return rv;\n }\n else {\n // timestamp 64 = { nsec30 (unsigned), sec34 (unsigned) }\n var secHigh = sec / 0x100000000;\n var secLow = sec & 0xffffffff;\n var rv = new Uint8Array(8);\n var view = new DataView(rv.buffer);\n // nsec30 | secHigh2\n view.setUint32(0, (nsec << 2) | (secHigh & 0x3));\n // secLow32\n view.setUint32(4, secLow);\n return rv;\n }\n }\n else {\n // timestamp 96 = { nsec32 (unsigned), sec64 (signed) }\n var rv = new Uint8Array(12);\n var view = new DataView(rv.buffer);\n view.setUint32(0, nsec);\n Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_0__[\"setInt64\"])(view, 4, sec);\n return rv;\n }\n}\nfunction encodeDateToTimeSpec(date) {\n var msec = date.getTime();\n var sec = Math.floor(msec / 1e3);\n var nsec = (msec - sec * 1e3) * 1e6;\n // Normalizes { sec, nsec } to ensure nsec is unsigned.\n var nsecInSec = Math.floor(nsec / 1e9);\n return {\n sec: sec + nsecInSec,\n nsec: nsec - nsecInSec * 1e9,\n };\n}\nfunction encodeTimestampExtension(object) {\n if (object instanceof Date) {\n var timeSpec = encodeDateToTimeSpec(object);\n return encodeTimeSpecToTimestamp(timeSpec);\n }\n else {\n return null;\n }\n}\nfunction decodeTimestampToTimeSpec(data) {\n var view = new DataView(data.buffer, data.byteOffset, data.byteLength);\n // data may be 32, 64, or 96 bits\n switch (data.byteLength) {\n case 4: {\n // timestamp 32 = { sec32 }\n var sec = view.getUint32(0);\n var nsec = 0;\n return { sec: sec, nsec: nsec };\n }\n case 8: {\n // timestamp 64 = { nsec30, sec34 }\n var nsec30AndSecHigh2 = view.getUint32(0);\n var secLow32 = view.getUint32(4);\n var sec = (nsec30AndSecHigh2 & 0x3) * 0x100000000 + secLow32;\n var nsec = nsec30AndSecHigh2 >>> 2;\n return { sec: sec, nsec: nsec };\n }\n case 12: {\n // timestamp 96 = { nsec32 (unsigned), sec64 (signed) }\n var sec = Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_0__[\"getInt64\"])(view, 4);\n var nsec = view.getUint32(0);\n return { sec: sec, nsec: nsec };\n }\n default:\n throw new Error(\"Unrecognized data size for timestamp: \" + data.length);\n }\n}\nfunction decodeTimestampExtension(data) {\n var timeSpec = decodeTimestampToTimeSpec(data);\n return new Date(timeSpec.sec * 1e3 + timeSpec.nsec / 1e6);\n}\nvar timestampExtension = {\n type: EXT_TIMESTAMP,\n encode: encodeTimestampExtension,\n decode: decodeTimestampExtension,\n};\n//# sourceMappingURL=timestamp.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/timestamp.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EXT_TIMESTAMP\", function() { return EXT_TIMESTAMP; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"encodeTimeSpecToTimestamp\", function() { return encodeTimeSpecToTimestamp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"encodeDateToTimeSpec\", function() { return encodeDateToTimeSpec; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"encodeTimestampExtension\", function() { return encodeTimestampExtension; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeTimestampToTimeSpec\", function() { return decodeTimestampToTimeSpec; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeTimestampExtension\", function() { return decodeTimestampExtension; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"timestampExtension\", function() { return timestampExtension; });\n/* harmony import */ var _utils_int_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/int.mjs */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs\");\n// https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type\n\nvar EXT_TIMESTAMP = -1;\nvar TIMESTAMP32_MAX_SEC = 0x100000000 - 1; // 32-bit unsigned int\nvar TIMESTAMP64_MAX_SEC = 0x400000000 - 1; // 34-bit unsigned int\nfunction encodeTimeSpecToTimestamp(_a) {\n var sec = _a.sec, nsec = _a.nsec;\n if (sec >= 0 && nsec >= 0 && sec <= TIMESTAMP64_MAX_SEC) {\n // Here sec >= 0 && nsec >= 0\n if (nsec === 0 && sec <= TIMESTAMP32_MAX_SEC) {\n // timestamp 32 = { sec32 (unsigned) }\n var rv = new Uint8Array(4);\n var view = new DataView(rv.buffer);\n view.setUint32(0, sec);\n return rv;\n }\n else {\n // timestamp 64 = { nsec30 (unsigned), sec34 (unsigned) }\n var secHigh = sec / 0x100000000;\n var secLow = sec & 0xffffffff;\n var rv = new Uint8Array(8);\n var view = new DataView(rv.buffer);\n // nsec30 | secHigh2\n view.setUint32(0, (nsec << 2) | (secHigh & 0x3));\n // secLow32\n view.setUint32(4, secLow);\n return rv;\n }\n }\n else {\n // timestamp 96 = { nsec32 (unsigned), sec64 (signed) }\n var rv = new Uint8Array(12);\n var view = new DataView(rv.buffer);\n view.setUint32(0, nsec);\n Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_0__[\"setInt64\"])(view, 4, sec);\n return rv;\n }\n}\nfunction encodeDateToTimeSpec(date) {\n var msec = date.getTime();\n var sec = Math.floor(msec / 1e3);\n var nsec = (msec - sec * 1e3) * 1e6;\n // Normalizes { sec, nsec } to ensure nsec is unsigned.\n var nsecInSec = Math.floor(nsec / 1e9);\n return {\n sec: sec + nsecInSec,\n nsec: nsec - nsecInSec * 1e9,\n };\n}\nfunction encodeTimestampExtension(object) {\n if (object instanceof Date) {\n var timeSpec = encodeDateToTimeSpec(object);\n return encodeTimeSpecToTimestamp(timeSpec);\n }\n else {\n return null;\n }\n}\nfunction decodeTimestampToTimeSpec(data) {\n var view = new DataView(data.buffer, data.byteOffset, data.byteLength);\n // data may be 32, 64, or 96 bits\n switch (data.byteLength) {\n case 4: {\n // timestamp 32 = { sec32 }\n var sec = view.getUint32(0);\n var nsec = 0;\n return { sec: sec, nsec: nsec };\n }\n case 8: {\n // timestamp 64 = { nsec30, sec34 }\n var nsec30AndSecHigh2 = view.getUint32(0);\n var secLow32 = view.getUint32(4);\n var sec = (nsec30AndSecHigh2 & 0x3) * 0x100000000 + secLow32;\n var nsec = nsec30AndSecHigh2 >>> 2;\n return { sec: sec, nsec: nsec };\n }\n case 12: {\n // timestamp 96 = { nsec32 (unsigned), sec64 (signed) }\n var sec = Object(_utils_int_mjs__WEBPACK_IMPORTED_MODULE_0__[\"getInt64\"])(view, 4);\n var nsec = view.getUint32(0);\n return { sec: sec, nsec: nsec };\n }\n default:\n throw new Error(\"Unrecognized data size for timestamp: \" + data.length);\n }\n}\nfunction decodeTimestampExtension(data) {\n var timeSpec = decodeTimestampToTimeSpec(data);\n return new Date(timeSpec.sec * 1e3 + timeSpec.nsec / 1e6);\n}\nvar timestampExtension = {\n type: EXT_TIMESTAMP,\n encode: encodeTimestampExtension,\n decode: decodeTimestampExtension,\n};\n//# sourceMappingURL=timestamp.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/timestamp.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs": -/*!****************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs ***! - \****************************************************************************************************/ +/*!***********************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs ***! + \***********************************************************************************************************/ /*! exports provided: setUint64, setInt64, getInt64, getUint64 */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setUint64\", function() { return setUint64; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setInt64\", function() { return setInt64; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getInt64\", function() { return getInt64; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getUint64\", function() { return getUint64; });\n// DataView extension to handle int64 / uint64,\n// where the actual range is 53-bits integer (a.k.a. safe integer)\nfunction setUint64(view, offset, value) {\n var high = value / 4294967296;\n var low = value; // high bits are truncated by DataView\n view.setUint32(offset, high);\n view.setUint32(offset + 4, low);\n}\nfunction setInt64(view, offset, value) {\n var high = Math.floor(value / 4294967296);\n var low = value; // high bits are truncated by DataView\n view.setUint32(offset, high);\n view.setUint32(offset + 4, low);\n}\nfunction getInt64(view, offset) {\n var high = view.getInt32(offset);\n var low = view.getUint32(offset + 4);\n return high * 4294967296 + low;\n}\nfunction getUint64(view, offset) {\n var high = view.getUint32(offset);\n var low = view.getUint32(offset + 4);\n return high * 4294967296 + low;\n}\n//# sourceMappingURL=int.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setUint64\", function() { return setUint64; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setInt64\", function() { return setInt64; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getInt64\", function() { return getInt64; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getUint64\", function() { return getUint64; });\n// DataView extension to handle int64 / uint64,\n// where the actual range is 53-bits integer (a.k.a. safe integer)\nfunction setUint64(view, offset, value) {\n var high = value / 4294967296;\n var low = value; // high bits are truncated by DataView\n view.setUint32(offset, high);\n view.setUint32(offset + 4, low);\n}\nfunction setInt64(view, offset, value) {\n var high = Math.floor(value / 4294967296);\n var low = value; // high bits are truncated by DataView\n view.setUint32(offset, high);\n view.setUint32(offset + 4, low);\n}\nfunction getInt64(view, offset) {\n var high = view.getInt32(offset);\n var low = view.getUint32(offset + 4);\n return high * 4294967296 + low;\n}\nfunction getUint64(view, offset) {\n var high = view.getUint32(offset);\n var low = view.getUint32(offset + 4);\n return high * 4294967296 + low;\n}\n//# sourceMappingURL=int.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/int.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/prettyByte.mjs": -/*!***********************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/prettyByte.mjs ***! - \***********************************************************************************************************/ +/*!******************************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/prettyByte.mjs ***! + \******************************************************************************************************************/ /*! exports provided: prettyByte */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"prettyByte\", function() { return prettyByte; });\nfunction prettyByte(byte) {\n return (byte < 0 ? \"-\" : \"\") + \"0x\" + Math.abs(byte).toString(16).padStart(2, \"0\");\n}\n//# sourceMappingURL=prettyByte.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/prettyByte.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"prettyByte\", function() { return prettyByte; });\nfunction prettyByte(byte) {\n return (byte < 0 ? \"-\" : \"\") + \"0x\" + Math.abs(byte).toString(16).padStart(2, \"0\");\n}\n//# sourceMappingURL=prettyByte.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/prettyByte.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs": -/*!*******************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs ***! - \*******************************************************************************************************/ +/*!**************************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs ***! + \**************************************************************************************************************/ /*! exports provided: isAsyncIterable, asyncIterableFromStream, ensureAsyncIterabe */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAsyncIterable\", function() { return isAsyncIterable; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"asyncIterableFromStream\", function() { return asyncIterableFromStream; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ensureAsyncIterabe\", function() { return ensureAsyncIterabe; });\n// utility for whatwg streams\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __await = (undefined && undefined.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }\nvar __asyncGenerator = (undefined && undefined.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n};\nfunction isAsyncIterable(object) {\n return object[Symbol.asyncIterator] != null;\n}\nfunction assertNonNull(value) {\n if (value == null) {\n throw new Error(\"Assertion Failure: value must not be null nor undefined\");\n }\n}\nfunction asyncIterableFromStream(stream) {\n return __asyncGenerator(this, arguments, function asyncIterableFromStream_1() {\n var reader, _a, done, value;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n reader = stream.getReader();\n _b.label = 1;\n case 1:\n _b.trys.push([1, , 9, 10]);\n _b.label = 2;\n case 2:\n if (false) {}\n return [4 /*yield*/, __await(reader.read())];\n case 3:\n _a = _b.sent(), done = _a.done, value = _a.value;\n if (!done) return [3 /*break*/, 5];\n return [4 /*yield*/, __await(void 0)];\n case 4: return [2 /*return*/, _b.sent()];\n case 5:\n assertNonNull(value);\n return [4 /*yield*/, __await(value)];\n case 6: return [4 /*yield*/, _b.sent()];\n case 7:\n _b.sent();\n return [3 /*break*/, 2];\n case 8: return [3 /*break*/, 10];\n case 9:\n reader.releaseLock();\n return [7 /*endfinally*/];\n case 10: return [2 /*return*/];\n }\n });\n });\n}\nfunction ensureAsyncIterabe(streamLike) {\n if (isAsyncIterable(streamLike)) {\n return streamLike;\n }\n else {\n return asyncIterableFromStream(streamLike);\n }\n}\n//# sourceMappingURL=stream.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAsyncIterable\", function() { return isAsyncIterable; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"asyncIterableFromStream\", function() { return asyncIterableFromStream; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ensureAsyncIterabe\", function() { return ensureAsyncIterabe; });\n// utility for whatwg streams\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __await = (undefined && undefined.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }\nvar __asyncGenerator = (undefined && undefined.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n};\nfunction isAsyncIterable(object) {\n return object[Symbol.asyncIterator] != null;\n}\nfunction assertNonNull(value) {\n if (value == null) {\n throw new Error(\"Assertion Failure: value must not be null nor undefined\");\n }\n}\nfunction asyncIterableFromStream(stream) {\n return __asyncGenerator(this, arguments, function asyncIterableFromStream_1() {\n var reader, _a, done, value;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n reader = stream.getReader();\n _b.label = 1;\n case 1:\n _b.trys.push([1, , 9, 10]);\n _b.label = 2;\n case 2:\n if (false) {}\n return [4 /*yield*/, __await(reader.read())];\n case 3:\n _a = _b.sent(), done = _a.done, value = _a.value;\n if (!done) return [3 /*break*/, 5];\n return [4 /*yield*/, __await(void 0)];\n case 4: return [2 /*return*/, _b.sent()];\n case 5:\n assertNonNull(value);\n return [4 /*yield*/, __await(value)];\n case 6: return [4 /*yield*/, _b.sent()];\n case 7:\n _b.sent();\n return [3 /*break*/, 2];\n case 8: return [3 /*break*/, 10];\n case 9:\n reader.releaseLock();\n return [7 /*endfinally*/];\n case 10: return [2 /*return*/];\n }\n });\n });\n}\nfunction ensureAsyncIterabe(streamLike) {\n if (isAsyncIterable(streamLike)) {\n return streamLike;\n }\n else {\n return asyncIterableFromStream(streamLike);\n }\n}\n//# sourceMappingURL=stream.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/typedArrays.mjs": -/*!************************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/typedArrays.mjs ***! - \************************************************************************************************************/ +/*!*******************************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/typedArrays.mjs ***! + \*******************************************************************************************************************/ /*! exports provided: ensureUint8Array, createDataView */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ensureUint8Array\", function() { return ensureUint8Array; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createDataView\", function() { return createDataView; });\nfunction ensureUint8Array(buffer) {\n if (buffer instanceof Uint8Array) {\n return buffer;\n }\n else if (ArrayBuffer.isView(buffer)) {\n return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);\n }\n else if (buffer instanceof ArrayBuffer) {\n return new Uint8Array(buffer);\n }\n else {\n // ArrayLike\n return Uint8Array.from(buffer);\n }\n}\nfunction createDataView(buffer) {\n if (buffer instanceof ArrayBuffer) {\n return new DataView(buffer);\n }\n var bufferView = ensureUint8Array(buffer);\n return new DataView(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength);\n}\n//# sourceMappingURL=typedArrays.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/typedArrays.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ensureUint8Array\", function() { return ensureUint8Array; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createDataView\", function() { return createDataView; });\nfunction ensureUint8Array(buffer) {\n if (buffer instanceof Uint8Array) {\n return buffer;\n }\n else if (ArrayBuffer.isView(buffer)) {\n return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);\n }\n else if (buffer instanceof ArrayBuffer) {\n return new Uint8Array(buffer);\n }\n else {\n // ArrayLike\n return Uint8Array.from(buffer);\n }\n}\nfunction createDataView(buffer) {\n if (buffer instanceof ArrayBuffer) {\n return new DataView(buffer);\n }\n var bufferView = ensureUint8Array(buffer);\n return new DataView(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength);\n}\n//# sourceMappingURL=typedArrays.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/typedArrays.mjs?"); /***/ }), /***/ "../../../node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs": -/*!*****************************************************************************************************!*\ - !*** /home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs ***! - \*****************************************************************************************************/ +/*!************************************************************************************************************!*\ + !*** /home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs ***! + \************************************************************************************************************/ /*! exports provided: utf8Count, utf8EncodeJs, TEXT_ENCODER_THRESHOLD, utf8EncodeTE, utf8DecodeJs, TEXT_DECODER_THRESHOLD, utf8DecodeTD */ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8Count\", function() { return utf8Count; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8EncodeJs\", function() { return utf8EncodeJs; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TEXT_ENCODER_THRESHOLD\", function() { return TEXT_ENCODER_THRESHOLD; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8EncodeTE\", function() { return utf8EncodeTE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8DecodeJs\", function() { return utf8DecodeJs; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TEXT_DECODER_THRESHOLD\", function() { return TEXT_DECODER_THRESHOLD; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8DecodeTD\", function() { return utf8DecodeTD; });\nvar TEXT_ENCODING_AVAILABLE = typeof process !== \"undefined\" &&\n process.env.TEXT_ENCODING !== \"never\" &&\n typeof TextEncoder !== \"undefined\" &&\n typeof TextDecoder !== \"undefined\";\nvar STR_SIZE_MAX = 4294967295; // uint32_max\nfunction utf8Count(str) {\n var strLength = str.length;\n var byteLength = 0;\n var pos = 0;\n while (pos < strLength) {\n var value = str.charCodeAt(pos++);\n if ((value & 0xffffff80) === 0) {\n // 1-byte\n byteLength++;\n continue;\n }\n else if ((value & 0xfffff800) === 0) {\n // 2-bytes\n byteLength += 2;\n }\n else {\n // handle surrogate pair\n if (value >= 0xd800 && value <= 0xdbff) {\n // high surrogate\n if (pos < strLength) {\n var extra = str.charCodeAt(pos);\n if ((extra & 0xfc00) === 0xdc00) {\n ++pos;\n value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000;\n }\n }\n }\n if ((value & 0xffff0000) === 0) {\n // 3-byte\n byteLength += 3;\n }\n else {\n // 4-byte\n byteLength += 4;\n }\n }\n }\n return byteLength;\n}\nfunction utf8EncodeJs(str, output, outputOffset) {\n var strLength = str.length;\n var offset = outputOffset;\n var pos = 0;\n while (pos < strLength) {\n var value = str.charCodeAt(pos++);\n if ((value & 0xffffff80) === 0) {\n // 1-byte\n output[offset++] = value;\n continue;\n }\n else if ((value & 0xfffff800) === 0) {\n // 2-bytes\n output[offset++] = ((value >> 6) & 0x1f) | 0xc0;\n }\n else {\n // handle surrogate pair\n if (value >= 0xd800 && value <= 0xdbff) {\n // high surrogate\n if (pos < strLength) {\n var extra = str.charCodeAt(pos);\n if ((extra & 0xfc00) === 0xdc00) {\n ++pos;\n value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000;\n }\n }\n }\n if ((value & 0xffff0000) === 0) {\n // 3-byte\n output[offset++] = ((value >> 12) & 0x0f) | 0xe0;\n output[offset++] = ((value >> 6) & 0x3f) | 0x80;\n }\n else {\n // 4-byte\n output[offset++] = ((value >> 18) & 0x07) | 0xf0;\n output[offset++] = ((value >> 12) & 0x3f) | 0x80;\n output[offset++] = ((value >> 6) & 0x3f) | 0x80;\n }\n }\n output[offset++] = (value & 0x3f) | 0x80;\n }\n}\nvar sharedTextEncoder = TEXT_ENCODING_AVAILABLE ? new TextEncoder() : undefined;\nvar TEXT_ENCODER_THRESHOLD = !TEXT_ENCODING_AVAILABLE\n ? STR_SIZE_MAX\n : typeof process !== \"undefined\" && process.env.TEXT_ENCODING !== \"force\"\n ? 200\n : 0;\nfunction utf8EncodeTEencode(str, output, outputOffset) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n output.set(sharedTextEncoder.encode(str), outputOffset);\n}\nfunction utf8EncodeTEencodeInto(str, output, outputOffset) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n sharedTextEncoder.encodeInto(str, output.subarray(outputOffset));\n}\nvar utf8EncodeTE = (sharedTextEncoder === null || sharedTextEncoder === void 0 ? void 0 : sharedTextEncoder.encodeInto) ? utf8EncodeTEencodeInto : utf8EncodeTEencode;\nvar CHUNK_SIZE = 4096;\nfunction utf8DecodeJs(bytes, inputOffset, byteLength) {\n var offset = inputOffset;\n var end = offset + byteLength;\n var units = [];\n var result = \"\";\n while (offset < end) {\n var byte1 = bytes[offset++];\n if ((byte1 & 0x80) === 0) {\n // 1 byte\n units.push(byte1);\n }\n else if ((byte1 & 0xe0) === 0xc0) {\n // 2 bytes\n var byte2 = bytes[offset++] & 0x3f;\n units.push(((byte1 & 0x1f) << 6) | byte2);\n }\n else if ((byte1 & 0xf0) === 0xe0) {\n // 3 bytes\n var byte2 = bytes[offset++] & 0x3f;\n var byte3 = bytes[offset++] & 0x3f;\n units.push(((byte1 & 0x1f) << 12) | (byte2 << 6) | byte3);\n }\n else if ((byte1 & 0xf8) === 0xf0) {\n // 4 bytes\n var byte2 = bytes[offset++] & 0x3f;\n var byte3 = bytes[offset++] & 0x3f;\n var byte4 = bytes[offset++] & 0x3f;\n var unit = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0c) | (byte3 << 0x06) | byte4;\n if (unit > 0xffff) {\n unit -= 0x10000;\n units.push(((unit >>> 10) & 0x3ff) | 0xd800);\n unit = 0xdc00 | (unit & 0x3ff);\n }\n units.push(unit);\n }\n else {\n units.push(byte1);\n }\n if (units.length >= CHUNK_SIZE) {\n result += String.fromCharCode.apply(String, units);\n units.length = 0;\n }\n }\n if (units.length > 0) {\n result += String.fromCharCode.apply(String, units);\n }\n return result;\n}\nvar sharedTextDecoder = TEXT_ENCODING_AVAILABLE ? new TextDecoder() : null;\nvar TEXT_DECODER_THRESHOLD = !TEXT_ENCODING_AVAILABLE\n ? STR_SIZE_MAX\n : typeof process !== \"undefined\" && process.env.TEXT_DECODER !== \"force\"\n ? 200\n : 0;\nfunction utf8DecodeTD(bytes, inputOffset, byteLength) {\n var stringBytes = bytes.subarray(inputOffset, inputOffset + byteLength);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return sharedTextDecoder.decode(stringBytes);\n}\n//# sourceMappingURL=utf8.mjs.map\n\n//# sourceURL=webpack:////home/runner/work/monorepo/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8Count\", function() { return utf8Count; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8EncodeJs\", function() { return utf8EncodeJs; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TEXT_ENCODER_THRESHOLD\", function() { return TEXT_ENCODER_THRESHOLD; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8EncodeTE\", function() { return utf8EncodeTE; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8DecodeJs\", function() { return utf8DecodeJs; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TEXT_DECODER_THRESHOLD\", function() { return TEXT_DECODER_THRESHOLD; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8DecodeTD\", function() { return utf8DecodeTD; });\nvar TEXT_ENCODING_AVAILABLE = typeof process !== \"undefined\" &&\n process.env.TEXT_ENCODING !== \"never\" &&\n typeof TextEncoder !== \"undefined\" &&\n typeof TextDecoder !== \"undefined\";\nvar STR_SIZE_MAX = 4294967295; // uint32_max\nfunction utf8Count(str) {\n var strLength = str.length;\n var byteLength = 0;\n var pos = 0;\n while (pos < strLength) {\n var value = str.charCodeAt(pos++);\n if ((value & 0xffffff80) === 0) {\n // 1-byte\n byteLength++;\n continue;\n }\n else if ((value & 0xfffff800) === 0) {\n // 2-bytes\n byteLength += 2;\n }\n else {\n // handle surrogate pair\n if (value >= 0xd800 && value <= 0xdbff) {\n // high surrogate\n if (pos < strLength) {\n var extra = str.charCodeAt(pos);\n if ((extra & 0xfc00) === 0xdc00) {\n ++pos;\n value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000;\n }\n }\n }\n if ((value & 0xffff0000) === 0) {\n // 3-byte\n byteLength += 3;\n }\n else {\n // 4-byte\n byteLength += 4;\n }\n }\n }\n return byteLength;\n}\nfunction utf8EncodeJs(str, output, outputOffset) {\n var strLength = str.length;\n var offset = outputOffset;\n var pos = 0;\n while (pos < strLength) {\n var value = str.charCodeAt(pos++);\n if ((value & 0xffffff80) === 0) {\n // 1-byte\n output[offset++] = value;\n continue;\n }\n else if ((value & 0xfffff800) === 0) {\n // 2-bytes\n output[offset++] = ((value >> 6) & 0x1f) | 0xc0;\n }\n else {\n // handle surrogate pair\n if (value >= 0xd800 && value <= 0xdbff) {\n // high surrogate\n if (pos < strLength) {\n var extra = str.charCodeAt(pos);\n if ((extra & 0xfc00) === 0xdc00) {\n ++pos;\n value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000;\n }\n }\n }\n if ((value & 0xffff0000) === 0) {\n // 3-byte\n output[offset++] = ((value >> 12) & 0x0f) | 0xe0;\n output[offset++] = ((value >> 6) & 0x3f) | 0x80;\n }\n else {\n // 4-byte\n output[offset++] = ((value >> 18) & 0x07) | 0xf0;\n output[offset++] = ((value >> 12) & 0x3f) | 0x80;\n output[offset++] = ((value >> 6) & 0x3f) | 0x80;\n }\n }\n output[offset++] = (value & 0x3f) | 0x80;\n }\n}\nvar sharedTextEncoder = TEXT_ENCODING_AVAILABLE ? new TextEncoder() : undefined;\nvar TEXT_ENCODER_THRESHOLD = !TEXT_ENCODING_AVAILABLE\n ? STR_SIZE_MAX\n : typeof process !== \"undefined\" && process.env.TEXT_ENCODING !== \"force\"\n ? 200\n : 0;\nfunction utf8EncodeTEencode(str, output, outputOffset) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n output.set(sharedTextEncoder.encode(str), outputOffset);\n}\nfunction utf8EncodeTEencodeInto(str, output, outputOffset) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n sharedTextEncoder.encodeInto(str, output.subarray(outputOffset));\n}\nvar utf8EncodeTE = (sharedTextEncoder === null || sharedTextEncoder === void 0 ? void 0 : sharedTextEncoder.encodeInto) ? utf8EncodeTEencodeInto : utf8EncodeTEencode;\nvar CHUNK_SIZE = 4096;\nfunction utf8DecodeJs(bytes, inputOffset, byteLength) {\n var offset = inputOffset;\n var end = offset + byteLength;\n var units = [];\n var result = \"\";\n while (offset < end) {\n var byte1 = bytes[offset++];\n if ((byte1 & 0x80) === 0) {\n // 1 byte\n units.push(byte1);\n }\n else if ((byte1 & 0xe0) === 0xc0) {\n // 2 bytes\n var byte2 = bytes[offset++] & 0x3f;\n units.push(((byte1 & 0x1f) << 6) | byte2);\n }\n else if ((byte1 & 0xf0) === 0xe0) {\n // 3 bytes\n var byte2 = bytes[offset++] & 0x3f;\n var byte3 = bytes[offset++] & 0x3f;\n units.push(((byte1 & 0x1f) << 12) | (byte2 << 6) | byte3);\n }\n else if ((byte1 & 0xf8) === 0xf0) {\n // 4 bytes\n var byte2 = bytes[offset++] & 0x3f;\n var byte3 = bytes[offset++] & 0x3f;\n var byte4 = bytes[offset++] & 0x3f;\n var unit = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0c) | (byte3 << 0x06) | byte4;\n if (unit > 0xffff) {\n unit -= 0x10000;\n units.push(((unit >>> 10) & 0x3ff) | 0xd800);\n unit = 0xdc00 | (unit & 0x3ff);\n }\n units.push(unit);\n }\n else {\n units.push(byte1);\n }\n if (units.length >= CHUNK_SIZE) {\n result += String.fromCharCode.apply(String, units);\n units.length = 0;\n }\n }\n if (units.length > 0) {\n result += String.fromCharCode.apply(String, units);\n }\n return result;\n}\nvar sharedTextDecoder = TEXT_ENCODING_AVAILABLE ? new TextDecoder() : null;\nvar TEXT_DECODER_THRESHOLD = !TEXT_ENCODING_AVAILABLE\n ? STR_SIZE_MAX\n : typeof process !== \"undefined\" && process.env.TEXT_DECODER !== \"force\"\n ? 200\n : 0;\nfunction utf8DecodeTD(bytes, inputOffset, byteLength) {\n var stringBytes = bytes.subarray(inputOffset, inputOffset + byteLength);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return sharedTextDecoder.decode(stringBytes);\n}\n//# sourceMappingURL=utf8.mjs.map\n\n//# sourceURL=webpack:////home/jelli/Dev/Repos/w3/web3-api/monorepo/node_modules/@msgpack/msgpack/dist.es5+esm/utils/utf8.mjs?"); /***/ }), @@ -284,7 +284,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-disable no-constant-condition */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar types_1 = __webpack_require__(/*! ./types */ \"./src/wasm/types.ts\");\nvar utils_1 = __webpack_require__(/*! ./utils */ \"./src/wasm/utils.ts\");\nvar msgpack_1 = __webpack_require__(/*! @msgpack/msgpack */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs\");\nvar state = {\n invoke: {},\n subinvoke: {},\n};\nvar abort = function (message) {\n dispatchAction({\n type: \"Abort\",\n message: message,\n });\n};\nvar dispatchAction = function (action) {\n // @ts-ignore webworker postMessage\n postMessage(action);\n};\nvar imports = function (memory) { return ({\n w3: {\n __w3_subinvoke: function (uriPtr, uriLen, modulePtr, moduleLen, methodPtr, methodLen, inputPtr, inputLen) {\n if (state.threadId === undefined ||\n state.threadMutexes === undefined ||\n state.transfer === undefined) {\n abort(\"__w3_subinvoke: thread uninitialized.\\nthreadId: \" + state.threadId + \"\\nthreadMutexes: \" + state.threadMutexes);\n return false;\n }\n // Reset our state\n state.subinvoke.result = undefined;\n state.subinvoke.error = undefined;\n var uri = utils_1.readString(memory.buffer, uriPtr, uriLen);\n var module = utils_1.readString(memory.buffer, modulePtr, moduleLen);\n var method = utils_1.readString(memory.buffer, methodPtr, methodLen);\n var input = utils_1.readBytes(memory.buffer, inputPtr, inputLen);\n // Reset our thread's status\n Atomics.store(state.threadMutexes, state.threadId, 0);\n dispatchAction({\n type: \"SubInvoke\",\n uri: uri,\n module: module,\n method: method,\n input: input,\n });\n // Pause the thread\n Atomics.wait(state.threadMutexes, state.threadId, 0);\n // Get the code & reset to 0\n var status = Atomics.exchange(state.threadMutexes, state.threadId, 0);\n if (status === types_1.ThreadWakeStatus.SUBINVOKE_ERROR ||\n status === types_1.ThreadWakeStatus.SUBINVOKE_RESULT) {\n var transferStatus = status;\n var numBytes = Atomics.load(state.transfer, 0);\n var data = new Uint8Array(numBytes);\n var progress = 0;\n while (true) {\n var newLength = progress + numBytes;\n if (data.byteLength < newLength) {\n data = new Uint8Array(data, 0, newLength);\n }\n for (var i = 1; i <= numBytes; ++i) {\n data[progress + (i - 1)] = Atomics.load(state.transfer, i);\n }\n progress += numBytes;\n dispatchAction({ type: \"TransferComplete\" });\n // If the main thread hasn't said we're done yet, wait\n // for another chunk of data\n if (transferStatus !== types_1.ThreadWakeStatus.SUBINVOKE_DONE) {\n Atomics.wait(state.threadMutexes, state.threadId, 0);\n transferStatus = Atomics.exchange(state.threadMutexes, state.threadId, 0);\n numBytes = Atomics.load(state.transfer, 0);\n }\n else {\n break;\n }\n }\n // Transfer is complete, copy result to desired location\n if (status === types_1.ThreadWakeStatus.SUBINVOKE_ERROR) {\n var decoder = new TextDecoder();\n state.subinvoke.error = decoder.decode(data);\n return false;\n }\n else if (status === types_1.ThreadWakeStatus.SUBINVOKE_RESULT) {\n state.subinvoke.result = data.buffer;\n return true;\n }\n }\n else {\n abort(\"__w3_subinvoke: Unknown wake status \" + status);\n return false;\n }\n return false;\n },\n // Give WASM the size of the result\n __w3_subinvoke_result_len: function () {\n if (!state.subinvoke.result) {\n abort(\"__w3_subinvoke_result_len: subinvoke.result is not set\");\n return 0;\n }\n return state.subinvoke.result.byteLength;\n },\n // Copy the subinvoke result into WASM\n __w3_subinvoke_result: function (ptr) {\n if (!state.subinvoke.result) {\n abort(\"__w3_subinvoke_result: subinvoke.result is not set\");\n return;\n }\n utils_1.writeBytes(state.subinvoke.result, memory.buffer, ptr);\n },\n // Give WASM the size of the error\n __w3_subinvoke_error_len: function () {\n if (!state.subinvoke.error) {\n abort(\"__w3_subinvoke_error_len: subinvoke.error is not set\");\n return 0;\n }\n return state.subinvoke.error.length;\n },\n // Copy the subinvoke error into WASM\n __w3_subinvoke_error: function (ptr) {\n if (!state.subinvoke.error) {\n abort(\"__w3_subinvoke_error: subinvoke.error is not set\");\n return;\n }\n utils_1.writeString(state.subinvoke.error, memory.buffer, ptr);\n },\n // Copy the invocation's method & args into WASM\n __w3_invoke_args: function (methodPtr, argsPtr) {\n if (!state.method) {\n abort(\"__w3_invoke_args: method is not set\");\n return;\n }\n if (!state.args) {\n abort(\"__w3_invoke_args: args is not set\");\n return;\n }\n utils_1.writeString(state.method, memory.buffer, methodPtr);\n utils_1.writeBytes(state.args, memory.buffer, argsPtr);\n },\n // Store the invocation's result\n __w3_invoke_result: function (ptr, len) {\n state.invoke.result = utils_1.readBytes(memory.buffer, ptr, len);\n },\n // Store the invocation's error\n __w3_invoke_error: function (ptr, len) {\n state.invoke.error = utils_1.readString(memory.buffer, ptr, len);\n },\n __w3_abort: function (msgPtr, msgLen, filePtr, fileLen, line, column) {\n var msg = utils_1.readString(memory.buffer, msgPtr, msgLen);\n var file = utils_1.readString(memory.buffer, filePtr, fileLen);\n abort(\"__w3_abort: \" + msg + \"\\nFile: \" + file + \"\\nLocation: [\" + line + \",\" + column + \"]\");\n },\n },\n env: {\n memory: memory,\n },\n}); };\n// @ts-ignore\naddEventListener(\"message\", function (input) {\n var data = input.data;\n // Store thread mutexes & ID, used for pausing the thread's execution\n state.threadMutexes = new Int32Array(data.threadMutexesBuffer, 0, types_1.maxThreads);\n state.threadId = data.threadId;\n // Store transfer buffer\n state.transfer = new Uint8Array(data.transferBuffer, 0, types_1.maxTransferBytes);\n // Store the method we're invoking\n state.method = data.method;\n if (data.input instanceof ArrayBuffer) {\n // No need to serialize\n state.args = data.input;\n }\n else {\n // We must serialize the input object into msgpack\n state.args = msgpack_1.encode(data.input);\n }\n var module = new WebAssembly.Module(data.wasm);\n var memory = new WebAssembly.Memory({ initial: 1 });\n var source = new WebAssembly.Instance(module, imports(memory));\n var exports = source.exports;\n var hasExport = function (name, exports) {\n if (!exports[name]) {\n abort(\"A required export was not found: \" + name);\n return false;\n }\n return true;\n };\n // Make sure _w3_init exists\n if (!hasExport(\"_w3_init\", exports)) {\n return;\n }\n // Initialize the Web3Api module\n exports._w3_init();\n // Make sure _w3_invoke exists\n if (!hasExport(\"_w3_invoke\", exports)) {\n return;\n }\n var result = exports._w3_invoke(state.method.length, state.args.byteLength);\n if (result) {\n if (!state.invoke.result) {\n abort(\"Invoke result is missing.\");\n return;\n }\n // __w3_invoke_result has already been called\n dispatchAction({\n type: \"LogQueryResult\",\n result: state.invoke.result,\n });\n }\n else {\n if (!state.invoke.error) {\n abort(\"Invoke error is missing.\");\n return;\n }\n // __w3_invoke_error has already been called\n dispatchAction({\n type: \"LogQueryError\",\n error: state.invoke.error,\n });\n }\n});\n\n\n//# sourceURL=webpack:///./src/wasm/thread.ts?"); +eval("\n/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-disable no-constant-condition */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar types_1 = __webpack_require__(/*! ./types */ \"./src/wasm/types.ts\");\nvar utils_1 = __webpack_require__(/*! ./utils */ \"./src/wasm/utils.ts\");\nvar MsgPack = __importStar(__webpack_require__(/*! @msgpack/msgpack */ \"../../../node_modules/@msgpack/msgpack/dist.es5+esm/index.mjs\"));\nvar state = {\n invoke: {},\n subinvoke: {},\n};\nvar abort = function (message) {\n dispatchAction({\n type: \"Abort\",\n message: message,\n });\n};\nvar dispatchAction = function (action) {\n // @ts-ignore webworker postMessage\n postMessage(action);\n};\nvar imports = function (memory) { return ({\n w3: {\n __w3_subinvoke: function (uriPtr, uriLen, modulePtr, moduleLen, methodPtr, methodLen, inputPtr, inputLen) {\n if (state.threadId === undefined ||\n state.threadMutexes === undefined ||\n state.transfer === undefined) {\n abort(\"__w3_subinvoke: thread uninitialized.\\nthreadId: \" + state.threadId + \"\\nthreadMutexes: \" + state.threadMutexes);\n return false;\n }\n // Reset our state\n state.subinvoke.result = undefined;\n state.subinvoke.error = undefined;\n var uri = utils_1.readString(memory.buffer, uriPtr, uriLen);\n var module = utils_1.readString(memory.buffer, modulePtr, moduleLen);\n var method = utils_1.readString(memory.buffer, methodPtr, methodLen);\n var input = utils_1.readBytes(memory.buffer, inputPtr, inputLen);\n // Reset our thread's status\n Atomics.store(state.threadMutexes, state.threadId, 0);\n dispatchAction({\n type: \"SubInvoke\",\n uri: uri,\n module: module,\n method: method,\n input: input,\n });\n // Pause the thread\n Atomics.wait(state.threadMutexes, state.threadId, 0);\n // Get the code & reset to 0\n var status = Atomics.exchange(state.threadMutexes, state.threadId, 0);\n if (status === types_1.ThreadWakeStatus.SUBINVOKE_ERROR ||\n status === types_1.ThreadWakeStatus.SUBINVOKE_RESULT) {\n var transferStatus = status;\n var numBytes = Atomics.load(state.transfer, 0);\n var data = new Uint8Array(numBytes);\n var progress = 0;\n while (true) {\n var newLength = progress + numBytes;\n if (data.byteLength < newLength) {\n var buf = new Uint8Array(newLength);\n buf.set(data);\n data = buf;\n }\n for (var i = 1; i <= numBytes; ++i) {\n data[progress + (i - 1)] = Atomics.load(state.transfer, i);\n }\n progress += numBytes;\n dispatchAction({ type: \"TransferComplete\" });\n // If the main thread hasn't said we're done yet, wait\n // for another chunk of data\n if (transferStatus !== types_1.ThreadWakeStatus.SUBINVOKE_DONE) {\n Atomics.wait(state.threadMutexes, state.threadId, 0);\n transferStatus = Atomics.exchange(state.threadMutexes, state.threadId, 0);\n numBytes = Atomics.load(state.transfer, 0);\n }\n else {\n break;\n }\n }\n // Transfer is complete, copy result to desired location\n if (status === types_1.ThreadWakeStatus.SUBINVOKE_ERROR) {\n var decoder = new TextDecoder();\n state.subinvoke.error = decoder.decode(data);\n return false;\n }\n else if (status === types_1.ThreadWakeStatus.SUBINVOKE_RESULT) {\n state.subinvoke.result = data.buffer;\n return true;\n }\n }\n else {\n abort(\"__w3_subinvoke: Unknown wake status \" + status);\n return false;\n }\n return false;\n },\n // Give WASM the size of the result\n __w3_subinvoke_result_len: function () {\n if (!state.subinvoke.result) {\n abort(\"__w3_subinvoke_result_len: subinvoke.result is not set\");\n return 0;\n }\n return state.subinvoke.result.byteLength;\n },\n // Copy the subinvoke result into WASM\n __w3_subinvoke_result: function (ptr) {\n if (!state.subinvoke.result) {\n abort(\"__w3_subinvoke_result: subinvoke.result is not set\");\n return;\n }\n utils_1.writeBytes(state.subinvoke.result, memory.buffer, ptr);\n },\n // Give WASM the size of the error\n __w3_subinvoke_error_len: function () {\n if (!state.subinvoke.error) {\n abort(\"__w3_subinvoke_error_len: subinvoke.error is not set\");\n return 0;\n }\n return state.subinvoke.error.length;\n },\n // Copy the subinvoke error into WASM\n __w3_subinvoke_error: function (ptr) {\n if (!state.subinvoke.error) {\n abort(\"__w3_subinvoke_error: subinvoke.error is not set\");\n return;\n }\n utils_1.writeString(state.subinvoke.error, memory.buffer, ptr);\n },\n // Copy the invocation's method & args into WASM\n __w3_invoke_args: function (methodPtr, argsPtr) {\n if (!state.method) {\n abort(\"__w3_invoke_args: method is not set\");\n return;\n }\n if (!state.args) {\n abort(\"__w3_invoke_args: args is not set\");\n return;\n }\n utils_1.writeString(state.method, memory.buffer, methodPtr);\n utils_1.writeBytes(state.args, memory.buffer, argsPtr);\n },\n // Store the invocation's result\n __w3_invoke_result: function (ptr, len) {\n state.invoke.result = utils_1.readBytes(memory.buffer, ptr, len);\n },\n // Store the invocation's error\n __w3_invoke_error: function (ptr, len) {\n state.invoke.error = utils_1.readString(memory.buffer, ptr, len);\n },\n __w3_abort: function (msgPtr, msgLen, filePtr, fileLen, line, column) {\n var msg = utils_1.readString(memory.buffer, msgPtr, msgLen);\n var file = utils_1.readString(memory.buffer, filePtr, fileLen);\n abort(\"__w3_abort: \" + msg + \"\\nFile: \" + file + \"\\nLocation: [\" + line + \",\" + column + \"]\");\n },\n },\n env: {\n memory: memory,\n },\n}); };\n// @ts-ignore\naddEventListener(\"message\", function (input) {\n var data = input.data;\n // Store thread mutexes & ID, used for pausing the thread's execution\n state.threadMutexes = new Int32Array(data.threadMutexesBuffer, 0, types_1.maxThreads);\n state.threadId = data.threadId;\n // Store transfer buffer\n state.transfer = new Uint8Array(data.transferBuffer, 0, types_1.maxTransferBytes);\n // Store the method we're invoking\n state.method = data.method;\n if (data.input instanceof ArrayBuffer) {\n // No need to serialize\n state.args = data.input;\n }\n else {\n // We must serialize the input object into msgpack\n state.args = MsgPack.encode(data.input, { ignoreUndefined: true });\n }\n var module = new WebAssembly.Module(data.wasm);\n var memory = new WebAssembly.Memory({ initial: 1 });\n var source = new WebAssembly.Instance(module, imports(memory));\n var exports = source.exports;\n var hasExport = function (name, exports) {\n if (!exports[name]) {\n abort(\"A required export was not found: \" + name);\n return false;\n }\n return true;\n };\n // Make sure _w3_init exists\n if (!hasExport(\"_w3_init\", exports)) {\n return;\n }\n // Initialize the Web3Api module\n exports._w3_init();\n // Make sure _w3_invoke exists\n if (!hasExport(\"_w3_invoke\", exports)) {\n return;\n }\n var result = exports._w3_invoke(state.method.length, state.args.byteLength);\n if (result) {\n if (!state.invoke.result) {\n abort(\"Invoke result is missing.\");\n return;\n }\n // __w3_invoke_result has already been called\n dispatchAction({\n type: \"LogQueryResult\",\n result: state.invoke.result,\n });\n }\n else {\n if (!state.invoke.error) {\n abort(\"Invoke error is missing.\");\n return;\n }\n // __w3_invoke_error has already been called\n dispatchAction({\n type: \"LogQueryError\",\n error: state.invoke.error,\n });\n }\n});\n\n\n//# sourceURL=webpack:///./src/wasm/thread.ts?"); /***/ }), @@ -308,7 +308,7 @@ eval("\n/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-dis /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.sleep = exports.readString = exports.readBytes = exports.writeBytes = exports.writeString = void 0;\nfunction memcpy(src, srcOffset, dst, dstOffset, length) {\n src = (src.subarray || src.slice ? src : src.buffer);\n dst = (dst.subarray || dst.slice ? dst : dst.buffer);\n src = srcOffset\n ? src.subarray\n ? src.subarray(srcOffset, length && srcOffset + length)\n : src.slice(srcOffset, length && srcOffset + length)\n : src;\n if (dst.set) {\n dst.set(src, dstOffset);\n }\n else {\n for (var i = 0; i < src.length; i++) {\n dst[i + dstOffset] = src[i];\n }\n }\n return dst;\n}\nfunction writeString(str, dst, dstOffset) {\n var encoder = new TextEncoder();\n var strBuffer = encoder.encode(str);\n var view = new Uint8Array(dst);\n return memcpy(strBuffer, 0, view, dstOffset, strBuffer.byteLength);\n}\nexports.writeString = writeString;\nfunction writeBytes(bytes, dst, dstOffset) {\n var bytesView = new Uint8Array(bytes);\n var dstView = new Uint8Array(dst);\n return memcpy(bytesView, 0, dstView, dstOffset, bytesView.byteLength);\n}\nexports.writeBytes = writeBytes;\nfunction readBytes(from, offset, length) {\n var buffer = new ArrayBuffer(length);\n writeBytes(from.slice(offset, offset + length), buffer, 0);\n return buffer;\n}\nexports.readBytes = readBytes;\nfunction readString(from, offset, length) {\n var buffer = readBytes(from, offset, length);\n var decoder = new TextDecoder();\n return decoder.decode(buffer);\n}\nexports.readString = readString;\nfunction sleep(ms) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, ms); })];\n });\n });\n}\nexports.sleep = sleep;\n\n\n//# sourceURL=webpack:///./src/wasm/utils.ts?"); +eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.sleep = exports.readString = exports.readBytes = exports.writeBytes = exports.writeString = void 0;\nfunction memcpy(src, srcOffset, dst, dstOffset, length) {\n src = (src.subarray || src.slice ? src : src.buffer);\n dst = (dst.subarray || dst.slice ? dst : dst.buffer);\n src = srcOffset\n ? src.subarray\n ? src.subarray(srcOffset, length && srcOffset + length)\n : src.slice(srcOffset, length && srcOffset + length)\n : src;\n if (dst.set) {\n dst.set(src, dstOffset);\n }\n else {\n for (var i = 0; i < src.length; i++) {\n dst[i + dstOffset] = src[i];\n }\n }\n return dst;\n}\nfunction writeString(str, dst, dstOffset) {\n var encoder = new TextEncoder();\n var strBuffer = encoder.encode(str);\n var view = new Uint8Array(dst);\n return memcpy(strBuffer, 0, view, dstOffset, strBuffer.byteLength);\n}\nexports.writeString = writeString;\nfunction writeBytes(bytes, dst, dstOffset) {\n var bytesView = new Uint8Array(bytes);\n var dstView = new Uint8Array(dst);\n return memcpy(bytesView, 0, dstView, dstOffset, bytesView.byteLength);\n}\nexports.writeBytes = writeBytes;\nfunction readBytes(from, offset, length) {\n var buffer = new ArrayBuffer(length);\n writeBytes(from.slice(offset, offset + length), buffer, 0);\n return buffer;\n}\nexports.readBytes = readBytes;\nfunction readString(from, offset, length) {\n var buffer = readBytes(from, offset, length);\n var decoder = new TextDecoder();\n return decoder.decode(buffer);\n}\nexports.readString = readString;\nfunction sleep(ms) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve) {\n return setTimeout(function () {\n resolve();\n }, ms);\n })];\n });\n });\n}\nexports.sleep = sleep;\n\n\n//# sourceURL=webpack:///./src/wasm/utils.ts?"); /***/ }) From 0c21e93abc05f367209dc99344ea9e5ae6596f2b Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 8 Jul 2021 22:19:15 -0500 Subject: [PATCH 109/112] fix --- .../build-envs/wasm/assemblyscript/web3api.build.ext.json | 4 +++- packages/cli/src/lib/helpers/manifest.ts | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/lib/build-envs/wasm/assemblyscript/web3api.build.ext.json b/packages/cli/src/lib/build-envs/wasm/assemblyscript/web3api.build.ext.json index c6d2aa39f1..92d6f6fc61 100644 --- a/packages/cli/src/lib/build-envs/wasm/assemblyscript/web3api.build.ext.json +++ b/packages/cli/src/lib/build-envs/wasm/assemblyscript/web3api.build.ext.json @@ -1,7 +1,9 @@ { "id": "BuildManifest_WasmAsExt", "type": "object", - "required": [], + "required": [ + "config" + ], "properties": { "config": { "type": "object", diff --git a/packages/cli/src/lib/helpers/manifest.ts b/packages/cli/src/lib/helpers/manifest.ts index 5cd4c82e9b..f9ff2b4346 100644 --- a/packages/cli/src/lib/helpers/manifest.ts +++ b/packages/cli/src/lib/helpers/manifest.ts @@ -74,12 +74,6 @@ export async function loadBuildManifest( ); let extSchema: JsonSchema | undefined = undefined; - if (!fs.existsSync(configSchemaPath)) { - configSchemaPath = project.getCachePath( - "build/env/web3api.build.ext.json" - ); - } - if (fs.existsSync(configSchemaPath)) { extSchema = JSON.parse( fs.readFileSync(configSchemaPath, "utf-8") From f6266ab1c6025cbef00f03aebb2c5196f22222d2 Mon Sep 17 00:00:00 2001 From: Jordan Ellis Date: Mon, 12 Jul 2021 19:39:43 -0500 Subject: [PATCH 110/112] macos fix --- packages/cli/src/__tests__/e2e/build.spec.ts | 13 ------------- packages/cli/src/lib/helpers/command.ts | 12 +++++++++++- packages/cli/src/lib/helpers/manifest.ts | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/__tests__/e2e/build.spec.ts b/packages/cli/src/__tests__/e2e/build.spec.ts index 073ec1e3a6..5eff45a6e8 100644 --- a/packages/cli/src/__tests__/e2e/build.spec.ts +++ b/packages/cli/src/__tests__/e2e/build.spec.ts @@ -137,17 +137,4 @@ ${HELP}`); expect(sanitizedOutput).toContain("Manifest written to ./build/web3api.yaml"); expect(sanitizedOutput).toContain(manifestPath); }); - - test("Errors when dockerfile config property is missing", async () => { - const { exitCode: code, stdout: output } = await runCLI({ - args: ["build", "web3api.wrong-config.yaml", "-v"], - cwd: projectRoot - }, w3Cli); - - const sanitizedOutput = clearStyle(output); - - expect(code).toEqual(1); - expect(sanitizedOutput).toContain("Validation errors encountered while sanitizing BuildManifest"); - expect(sanitizedOutput).toContain("instance.config requires property \"include\""); - }); }); diff --git a/packages/cli/src/lib/helpers/command.ts b/packages/cli/src/lib/helpers/command.ts index 6f5322717d..8f2e79dead 100644 --- a/packages/cli/src/lib/helpers/command.ts +++ b/packages/cli/src/lib/helpers/command.ts @@ -30,6 +30,16 @@ export async function runCommand( } }; - exec(command, { cwd: __dirname, env }, callback); + exec( + command, + { + cwd: __dirname, + env: { + ...process.env, + ...env, + }, + }, + callback + ); }); } diff --git a/packages/cli/src/lib/helpers/manifest.ts b/packages/cli/src/lib/helpers/manifest.ts index f9ff2b4346..daae688fa4 100644 --- a/packages/cli/src/lib/helpers/manifest.ts +++ b/packages/cli/src/lib/helpers/manifest.ts @@ -68,7 +68,7 @@ export async function loadBuildManifest( } // Load the custom json-schema extension if it exists - let configSchemaPath = path.join( + const configSchemaPath = path.join( path.dirname(manifestPath), "/web3api.build.ext.json" ); From 4597b3bbc9726c3e7e3520025969a4726119cbe2 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Mon, 12 Jul 2021 19:45:18 -0500 Subject: [PATCH 111/112] update CHANGELOG & VERSION --- CHANGELOG.md | 4 ++++ VERSION | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f32336c12c..30cca600f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# Web3API 0.0.1-prealpha.29 +## Bugs +* `@web3api/cli`: Fix MacOS specific issue w/ PATH not being retained. + # Web3API 0.0.1-prealpha.28 ## Bugs * Fixed API template project diff --git a/VERSION b/VERSION index c2db2c0cdb..63f77f7fd3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.1-prealpha.28 +0.0.1-prealpha.29 From a707176c805ede815ca0b2b9196a209be6ea2374 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Mon, 12 Jul 2021 20:28:52 -0500 Subject: [PATCH 112/112] update CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30cca600f3..d86f62b0b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Web3API 0.0.1-prealpha.29 +## Feature +* Web3API Interfaces are now fully supported in the tool-chain. +* GraphQL schema comments are now retained, and will show up in the build folder. +* `@web3api/parse`: Reference types definitions are now differentiated from the root definitions the reference. + ## Bugs * `@web3api/cli`: Fix MacOS specific issue w/ PATH not being retained. +* The `config` property in `web3api.build.yaml` is now optional. # Web3API 0.0.1-prealpha.28 ## Bugs