@taqueria/plugin-taquito 0.0.0-pr-695-bec90e45 → 0.0.0-pr-740-e1500660

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  var $iVZbm$taquerianodesdk = require("@taqueria/node-sdk");
2
- var $iVZbm$taquitosigner = require("@taquito/signer");
3
- var $iVZbm$taquitotaquito = require("@taquito/taquito");
4
2
  var $iVZbm$fastglob = require("fast-glob");
5
- var $iVZbm$fspromises = require("fs/promises");
6
3
  var $iVZbm$path = require("path");
4
+ var $iVZbm$taquitotaquito = require("@taquito/taquito");
5
+ var $iVZbm$fspromises = require("fs/promises");
6
+ var $iVZbm$taquitosigner = require("@taquito/signer");
7
7
 
8
8
  function $parcel$interopDefault(a) {
9
9
  return a && a.__esModule ? a.default : a;
@@ -19,7 +19,7 @@ const $806c5c6032403442$var$getContractAbspath = (contractFilename, parsedArgs)=
19
19
  ;
20
20
  const $806c5c6032403442$var$addOrigination = (parsedArgs, batch)=>async (mapping)=>{
21
21
  const contractAbspath = $806c5c6032403442$var$getContractAbspath(mapping.filename, parsedArgs);
22
- const contractData = await $iVZbm$fspromises.readFile(contractAbspath, 'utf-8');
22
+ const contractData = await $iVZbm$fspromises.readFile(contractAbspath, "utf-8");
23
23
  return (await batch).withOrigination({
24
24
  code: contractData,
25
25
  storage: mapping.storage
@@ -29,7 +29,7 @@ const $806c5c6032403442$var$addOrigination = (parsedArgs, batch)=>async (mapping
29
29
  const $806c5c6032403442$var$getValidContracts = async (parsedArgs)=>{
30
30
  const contracts = parsedArgs.contract ? [
31
31
  parsedArgs.contract
32
- ] : await ($parcel$interopDefault($iVZbm$fastglob))('**/*.tz', {
32
+ ] : await ($parcel$interopDefault($iVZbm$fastglob))("**/*.tz", {
33
33
  cwd: parsedArgs.artifactsDir
34
34
  });
35
35
  return contracts.reduce((retval, filename)=>{
@@ -59,16 +59,16 @@ const $806c5c6032403442$var$mapOpToContract = async (contracts, op, destination)
59
59
  contract: contract.filename,
60
60
  address: address,
61
61
  destination: destination
62
- },
62
+ }
63
63
  ];
64
64
  }
65
65
  return [
66
66
  ...retval,
67
67
  {
68
68
  contract: contract.filename,
69
- address: 'Error',
69
+ address: "Error",
70
70
  destination: destination
71
- },
71
+ }
72
72
  ];
73
73
  }, []);
74
74
  };
@@ -130,7 +130,7 @@ const $806c5c6032403442$export$acf571c34911f824 = (parsedArgs)=>{
130
130
  if (!env) return $iVZbm$taquerianodesdk.sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);
131
131
  const jobs1 = [
132
132
  ...$806c5c6032403442$var$originateToNetworks(parsedArgs, env),
133
- ...$806c5c6032403442$var$originateToSandboxes(parsedArgs, env),
133
+ ...$806c5c6032403442$var$originateToSandboxes(parsedArgs, env)
134
134
  ];
135
135
  return Promise.all(jobs1).then((jobs)=>jobs.reduce((retval, originations)=>{
136
136
  return originations ? [
@@ -145,20 +145,20 @@ var $806c5c6032403442$export$2e2bcd8739ae039 = $806c5c6032403442$export$acf571c3
145
145
 
146
146
 
147
147
  $iVZbm$taquerianodesdk.Plugin.create((i18n)=>({
148
- alias: 'taquito',
149
- schema: '1.0',
150
- version: '0.1',
148
+ alias: "taquito",
149
+ schema: "1.0",
150
+ version: "0.1",
151
151
  tasks: [
152
152
  $iVZbm$taquerianodesdk.Task.create({
153
- task: 'deploy',
154
- command: 'deploy [contract]',
155
- description: 'Deploy a smart contract to a particular environment',
153
+ task: "deploy",
154
+ command: "deploy [contract]",
155
+ description: "Deploy a smart contract to a particular environment",
156
156
  options: [],
157
157
  aliases: [
158
- 'originate'
158
+ "originate"
159
159
  ],
160
- handler: 'proxy',
161
- encoding: 'application/json'
160
+ handler: "proxy",
161
+ encoding: "application/json"
162
162
  }),
163
163
  ],
164
164
  proxy: $806c5c6032403442$export$2e2bcd8739ae039
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;ACAA;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ueria/node-sdk';\nimport type { i18n } from '@taqueria/node-sdk/types';\nimport originate from './originate';\n\nPlugin.create((i18n: i18n) => ({\n\talias: 'taquito',\n\tschema: '1.0',\n\tversion: '0.1',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'deploy',\n\t\t\tcommand: 'deploy [contract]',\n\t\t\tdescription: 'Deploy a smart contract to a particular environment',\n\t\t\toptions: [],\n\t\t\taliases: ['originate'],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'application/json',\n\t\t}),\n\t],\n\tproxy: originate,\n}), process.argv);\n","import {\n\tgetCurrentEnvironmentConfig,\n\tgetDefaultAccount,\n\tgetInitialStorage,\n\tgetNetworkConfig,\n\tgetSandboxAccountConfig,\n\tgetSandboxConfig,\n\tsendAsyncErr,\n\tsendAsyncJsonRes,\n\tsendErr,\n\tsendJsonRes,\n} from '@taqueria/node-sdk';\nimport {\n\tAccountDetails,\n\tConfig,\n\tEnvironmentConfig,\n\tFailure,\n\tLikeAPromise,\n\tNetworkConfig,\n\tPluginResponse,\n\tSandboxConfig,\n\tSanitizedArgs,\n} from '@taqueria/node-sdk/types';\nimport { OperationContentsAndResultOrigination } from '@taquito/rpc';\nimport { importKey, InMemorySigner } from '@taquito/signer';\nimport { OriginateParams, TezosToolkit, WalletOperationBatch } from '@taquito/taquito';\nimport { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';\nimport glob from 'fast-glob';\nimport { readFile } from 'fs/promises';\nimport { join } from 'path';\n\ntype Opts = SanitizedArgs & Record<string, unknown>;\n\ninterface ContractStorageMapping {\n\tfilename: string;\n\tstorage?: unknown;\n}\n\ninterface OriginationResult {\n\tcontract: string;\n\taddress: string;\n\tdestination: string;\n}\n\nconst getContractAbspath = (contractFilename: string, parsedArgs: Opts) =>\n\tjoin(parsedArgs.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);\n\nconst addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) =>\n\tasync (mapping: ContractStorageMapping) => {\n\t\tconst contractAbspath = getContractAbspath(mapping.filename, parsedArgs);\n\t\tconst contractData = await readFile(contractAbspath, 'utf-8');\n\t\treturn (await batch).withOrigination({\n\t\t\tcode: contractData,\n\t\t\tstorage: mapping.storage,\n\t\t});\n\t};\n\nconst getValidContracts = async (parsedArgs: Opts) => {\n\tconst contracts = parsedArgs.contract\n\t\t? [parsedArgs.contract as string]\n\t\t: (await glob('**/*.tz', { cwd: parsedArgs.artifactsDir })) as string[];\n\n\treturn contracts.reduce(\n\t\t(retval, filename) => {\n\t\t\tconst storage = getInitialStorage(parsedArgs)(filename);\n\t\t\tif (!storage) throw (`No initial storage provided for ${filename}`);\n\t\t\treturn [...retval, { filename, storage }];\n\t\t},\n\t\t[] as ContractStorageMapping[],\n\t);\n};\n\nconst mapOpToContract = async (contracts: ContractStorageMapping[], op: BatchWalletOperation, destination: string) => {\n\tdebugger;\n\tconst results = await op.operationResults();\n\n\treturn contracts.reduce(\n\t\t(retval, contract) => {\n\t\t\t// If initial storage was provided for the contract\n\t\t\t// then we submitted an operation to originate that contract\n\t\t\tif (contract.storage) {\n\t\t\t\tconst result = results.pop() as OperationContentsAndResultOrigination;\n\t\t\t\tconst address = result && result.metadata.operation_result.originated_contracts\n\t\t\t\t\t? result.metadata.operation_result.originated_contracts.join(',')\n\t\t\t\t\t: 'Error';\n\n\t\t\t\treturn [\n\t\t\t\t\t...retval,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontract: contract.filename,\n\t\t\t\t\t\taddress,\n\t\t\t\t\t\tdestination,\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t...retval,\n\t\t\t\t{\n\t\t\t\t\tcontract: contract.filename,\n\t\t\t\t\taddress: 'Error',\n\t\t\t\t\tdestination,\n\t\t\t\t},\n\t\t\t];\n\t\t},\n\t\t[] as OriginationResult[],\n\t);\n};\n\nconst createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: string) => {\n\tconst contracts = await getValidContracts(parsedArgs);\n\n\tconst batch = await contracts.reduce(\n\t\t(batch, contractMapping) =>\n\t\t\tcontractMapping.storage\n\t\t\t\t? addOrigination(parsedArgs, batch)(contractMapping)\n\t\t\t\t: batch,\n\t\tPromise.resolve(tezos.wallet.batch()),\n\t);\n\n\ttry {\n\t\tconst op = await batch.send();\n\t\tconst confirmed = await op.confirmation();\n\t\treturn await mapOpToContract(contracts, op, destination);\n\t} catch (err) {\n\t\tconst error = (err as { message: string });\n\t\tif (error.message) sendErr(error.message);\n\t\treturn undefined;\n\t}\n};\n\nconst originateToNetworks = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>\n\tcurrentEnv.networks\n\t\t? currentEnv.networks.reduce(\n\t\t\t(retval, networkName) => {\n\t\t\t\tconst network = getNetworkConfig(parsedArgs)(networkName);\n\t\t\t\tif (network.rpcUrl) {\n\t\t\t\t\tif (network.faucet) {\n\t\t\t\t\t\tconst result = (async () => {\n\t\t\t\t\t\t\tconst tezos = new TezosToolkit(network.rpcUrl as string);\n\t\t\t\t\t\t\tawait importKey(\n\t\t\t\t\t\t\t\ttezos,\n\t\t\t\t\t\t\t\tnetwork.faucet.email,\n\t\t\t\t\t\t\t\tnetwork.faucet.password,\n\t\t\t\t\t\t\t\tnetwork.faucet.mnemonic.join(' '),\n\t\t\t\t\t\t\t\tnetwork.faucet.activation_code,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn await createBatch(parsedArgs, tezos, networkName);\n\t\t\t\t\t\t})();\n\n\t\t\t\t\t\treturn [...retval, result];\n\t\t\t\t\t} else sendErr(`Network ${networkName} requires a valid faucet in config.json.`);\n\t\t\t\t} else sendErr(`Network \"${networkName} is missing an RPC url in config.json.\"`);\n\t\t\t\treturn retval;\n\t\t\t},\n\t\t\t[] as Promise<OriginationResult[] | undefined>[],\n\t\t)\n\t\t: [];\n\nconst originateToSandboxes = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>\n\tcurrentEnv.sandboxes\n\t\t? currentEnv.sandboxes.reduce(\n\t\t\t(retval, sandboxName) => {\n\t\t\t\tconst sandbox = getSandboxConfig(parsedArgs)(sandboxName);\n\t\t\t\tif (sandbox.rpcUrl) {\n\t\t\t\t\tconst secretKey = getDefaultAccount(parsedArgs)(sandboxName)?.keys?.secretKey;\n\t\t\t\t\tif (secretKey) {\n\t\t\t\t\t\tconst result = (async () => {\n\t\t\t\t\t\t\tconst tezos = new TezosToolkit(sandbox.rpcUrl as string);\n\t\t\t\t\t\t\ttezos.setProvider({\n\t\t\t\t\t\t\t\tsigner: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn await createBatch(parsedArgs, tezos, sandboxName);\n\t\t\t\t\t\t})();\n\n\t\t\t\t\t\treturn [...retval, result];\n\t\t\t\t\t} else sendErr(`Sandbox ${sandboxName}'s default account is missing keys in config.json.`);\n\t\t\t\t} else sendErr(`Sandbox \"${sandboxName} is missing an RPC url in config.json.\"`);\n\n\t\t\t\treturn retval;\n\t\t\t},\n\t\t\t[] as Promise<OriginationResult[] | undefined>[],\n\t\t)\n\t\t: [];\n\nexport const originate = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\n\tconst env = getCurrentEnvironmentConfig(parsedArgs);\n\n\tif (!env) {\n\t\treturn sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);\n\t}\n\n\tconst jobs = [\n\t\t...originateToNetworks(parsedArgs, env),\n\t\t...originateToSandboxes(parsedArgs, env),\n\t];\n\n\treturn Promise.all(jobs)\n\t\t.then(jobs =>\n\t\t\tjobs.reduce(\n\t\t\t\t(retval, originations) => {\n\t\t\t\t\treturn originations\n\t\t\t\t\t\t? [...retval as OriginationResult[], ...originations]\n\t\t\t\t\t\t: retval;\n\t\t\t\t},\n\t\t\t\t[],\n\t\t\t)\n\t\t)\n\t\t.then(results => results && results.length > 0 ? sendJsonRes(results) : sendEr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CAAC,qBAAqB,CAAC,CAAC,CAAA;IAGhG,MAAM,KAAI,GAAG;WACN,yCAAmB,CAAC,UAAU,EAAE,GAAG,CAAC;WACpC,0CAAoB,CAAC,UAAU,EAAE,GAAG,CAAC;KAC3C;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,KAAI,CAAC,CACnB,IAAI,CAAC,CAAA,IAAI,GAAI,IAAI,CAAC,MAAM,CACrB,CAAC,MAAM,EAAE,YAAY,GAAK;YACtB,OAAO,YAAY,GACb;mBAAI,MAAM;mBAA4B,YAAY;aAAC,GACnD,MAAM,CAAA;SACf,EACD,EAAE,CACL;IAAA,CAAC,CACD,IAAI,CAAC,CAAA,OAAO,GAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,kCAAW,CAAC,OAAO,CAAC,GAAE,8BAAO,CAAC,CAAC,wBAAwB,CAAC,CAAC;IAAA,CAAC,CAAA;CAClH;IAED,wCAAwB,GAAT,yCAAS;;;ADzLxB,6BAAM,CAAC,MAAM,CAAC,CAAC,IAAU,GAAM,CAAA;QAC3B,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACH,2BAAI,CAAC,MAAM,CAAC;gBACR,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,mBAAmB;gBAC5B,WAAW,EAAE,qDAAqD;gBAClE,OAAO,EAAE,EACR;gBACD,OAAO,EAAE;oBAAC,WAAW;iBAAC;gBACtB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,kBAAkB;aAC/B,CAAC;SACL;QACD,KAAK,EAAE,wCAAS;KACnB,CAAA;AAAC,EAAE,OAAO,CAAC,IAAI,CAAC","sources":["taqueria-plugin-taquito/index.ts","taqueria-plugin-taquito/originate.ts"],"sourcesContent":["import {Plugin, Task} from '@taqueria/node-sdk'\nimport type { i18n} from '@taqueria/node-sdk/types'\nimport originate from './originate'\n\nPlugin.create((i18n: i18n) => ({\n alias: \"taquito\",\n schema: \"1.0\",\n version: \"0.1\",\n tasks: [\n Task.create({\n task: \"deploy\",\n command: \"deploy [contract]\",\n description: \"Deploy a smart contract to a particular environment\",\n options: [\n ],\n aliases: [\"originate\"],\n handler: \"proxy\",\n encoding: \"application/json\"\n }),\n ],\n proxy: originate\n}), process.argv)\n","import { SanitizedArgs, PluginResponse, AccountDetails, Failure, LikeAPromise, Config, NetworkConfig, SandboxConfig, EnvironmentConfig} from \"@taqueria/node-sdk/types\";\nimport glob from 'fast-glob'\nimport {join} from 'path'\nimport { TezosToolkit, OriginateParams, WalletOperationBatch } from '@taquito/taquito';\nimport {readFile} from 'fs/promises'\nimport { InMemorySigner, importKey } from '@taquito/signer';\nimport { sendAsyncJsonRes, getCurrentEnvironmentConfig, getNetworkConfig, getSandboxAccountConfig, getInitialStorage, sendErr, getSandboxConfig, getDefaultAccount, sendJsonRes, sendAsyncErr } from \"@taqueria/node-sdk\";\nimport { BatchWalletOperation } from \"@taquito/taquito/dist/types/wallet/batch-operation\";\nimport { OperationContentsAndResultOrigination } from \"@taquito/rpc\";\n\ntype Opts = SanitizedArgs & Record<string, unknown>\n\ninterface ContractStorageMapping {\n filename: string,\n storage?: unknown\n}\n\ninterface OriginationResult {\n contract: string\n address: string\n destination: string\n}\n\nconst getContractAbspath = (contractFilename: string, parsedArgs: Opts) => \n join(parsedArgs.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`)\n\nconst addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) => async (mapping: ContractStorageMapping) => {\n const contractAbspath = getContractAbspath(mapping.filename, parsedArgs)\n const contractData = await readFile(contractAbspath, \"utf-8\")\n return (await batch).withOrigination({\n code: contractData,\n storage: mapping.storage,\n \n })\n}\n\nconst getValidContracts = async (parsedArgs: Opts) => {\n const contracts = parsedArgs.contract\n ? [parsedArgs.contract as string]\n : (await glob(\"**/*.tz\", {cwd: parsedArgs.artifactsDir})) as string[] \n\n return contracts.reduce(\n (retval, filename) => {\n const storage = getInitialStorage(parsedArgs) (filename)\n if (!storage) throw(`No initial storage provided for ${filename}`)\n return [...retval, {filename, storage}]\n },\n [] as ContractStorageMapping[]\n ) \n}\n\nconst mapOpToContract = async (contracts: ContractStorageMapping[], op: BatchWalletOperation, destination: string) => {\n debugger\n const results = await op.operationResults()\n\n return contracts.reduce(\n (retval, contract) => {\n\n // If initial storage was provided for the contract\n // then we submitted an operation to originate that contract\n if (contract.storage) {\n const result = results.pop() as OperationContentsAndResultOrigination\n const address = result && result.metadata.operation_result.originated_contracts\n ? result.metadata.operation_result.originated_contracts.join(',')\n : 'Error'\n\n return [\n ...retval, {\n contract: contract.filename,\n address,\n destination\n }\n ]\n }\n\n return [\n ...retval, {\n contract: contract.filename,\n address: \"Error\",\n destination\n }\n ]\n },\n [] as OriginationResult[]\n )\n}\n\n\nconst createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: string) => {\n const contracts = await getValidContracts (parsedArgs) \n \n const batch = await contracts.reduce(\n (batch, contractMapping) => \n contractMapping.storage\n ? addOrigination(parsedArgs, batch) (contractMapping)\n : batch,\n Promise.resolve(tezos.wallet.batch())\n )\n \n try {\n const op = await batch.send()\n const confirmed = await op.confirmation()\n return await mapOpToContract(contracts, op, destination)\n }\n catch (err) {\n const error = (err as {message: string})\n if (error.message) sendErr(error.message)\n return undefined\n }\n}\n\nconst originateToNetworks = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>\n currentEnv.networks\n ? currentEnv.networks.reduce(\n (retval, networkName) => {\n const network = getNetworkConfig (parsedArgs) (networkName)\n if (network.rpcUrl) {\n if (network.faucet) {\n const result = (async () => {\n const tezos = new TezosToolkit(network.rpcUrl as string)\n await importKey(tezos, network.faucet.email, network.faucet.password, network.faucet.mnemonic.join(' '), network.faucet.activation_code)\n return await createBatch(parsedArgs, tezos, networkName)\n })()\n\n return [...retval, result]\n }\n else sendErr(`Network ${networkName} requires a valid faucet in config.json.`)\n }\n else sendErr(`Network \"${networkName} is missing an RPC url in config.json.\"`)\n return retval\n },\n [] as Promise<OriginationResult[]|undefined>[]\n )\n : []\n\nconst originateToSandboxes = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>\n currentEnv.sandboxes\n ? currentEnv.sandboxes.reduce(\n (retval, sandboxName) => {\n const sandbox = getSandboxConfig (parsedArgs) (sandboxName)\n if (sandbox.rpcUrl) {\n const secretKey = getDefaultAccount(parsedArgs) (sandboxName) ?.keys?.secretKey\n if (secretKey) {\n const result = (async () => {\n const tezos = new TezosToolkit(sandbox.rpcUrl as string)\n tezos.setProvider({\n signer: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),\n });\n return await createBatch(parsedArgs, tezos, sandboxName)\n })()\n \n return [...retval, result]\n }\n else sendErr(`Sandbox ${sandboxName}'s default account is missing keys in config.json.`)\n }\n else sendErr(`Sandbox \"${sandboxName} is missing an RPC url in config.json.\"`)\n\n return retval\n },\n [] as Promise<OriginationResult[]|undefined>[]\n )\n : []\n \n \n\nexport const originate = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\n const env = getCurrentEnvironmentConfig(parsedArgs)\n\n if (!env) {\n return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`)\n }\n\n const jobs = [\n ...originateToNetworks(parsedArgs, env),\n ...originateToSandboxes(parsedArgs, env)\n ]\n\n return Promise.all(jobs)\n .then(jobs => jobs.reduce(\n (retval, originations) => {\n return originations\n ? [...retval as OriginationResult[], ...originations]\n : retval\n },\n []\n ))\n .then(results => results && results.length > 0 ? sendJsonRes(results): sendErr(`No contracts originated.`))\n}\n\nexport default originate\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
package/index.ts CHANGED
@@ -1,21 +1,22 @@
1
- import { Plugin, Task } from '@taqueria/node-sdk';
2
- import type { i18n } from '@taqueria/node-sdk/types';
3
- import originate from './originate';
1
+ import {Plugin, Task} from '@taqueria/node-sdk'
2
+ import type { i18n} from '@taqueria/node-sdk/types'
3
+ import originate from './originate'
4
4
 
5
5
  Plugin.create((i18n: i18n) => ({
6
- alias: 'taquito',
7
- schema: '1.0',
8
- version: '0.1',
9
- tasks: [
10
- Task.create({
11
- task: 'deploy',
12
- command: 'deploy [contract]',
13
- description: 'Deploy a smart contract to a particular environment',
14
- options: [],
15
- aliases: ['originate'],
16
- handler: 'proxy',
17
- encoding: 'application/json',
18
- }),
19
- ],
20
- proxy: originate,
21
- }), process.argv);
6
+ alias: "taquito",
7
+ schema: "1.0",
8
+ version: "0.1",
9
+ tasks: [
10
+ Task.create({
11
+ task: "deploy",
12
+ command: "deploy [contract]",
13
+ description: "Deploy a smart contract to a particular environment",
14
+ options: [
15
+ ],
16
+ aliases: ["originate"],
17
+ handler: "proxy",
18
+ encoding: "application/json"
19
+ }),
20
+ ],
21
+ proxy: originate
22
+ }), process.argv)
package/originate.ts CHANGED
@@ -1,212 +1,190 @@
1
- import {
2
- getCurrentEnvironmentConfig,
3
- getDefaultAccount,
4
- getInitialStorage,
5
- getNetworkConfig,
6
- getSandboxAccountConfig,
7
- getSandboxConfig,
8
- sendAsyncErr,
9
- sendAsyncJsonRes,
10
- sendErr,
11
- sendJsonRes,
12
- } from '@taqueria/node-sdk';
13
- import {
14
- AccountDetails,
15
- Config,
16
- EnvironmentConfig,
17
- Failure,
18
- LikeAPromise,
19
- NetworkConfig,
20
- PluginResponse,
21
- SandboxConfig,
22
- SanitizedArgs,
23
- } from '@taqueria/node-sdk/types';
24
- import { OperationContentsAndResultOrigination } from '@taquito/rpc';
25
- import { importKey, InMemorySigner } from '@taquito/signer';
26
- import { OriginateParams, TezosToolkit, WalletOperationBatch } from '@taquito/taquito';
27
- import { BatchWalletOperation } from '@taquito/taquito/dist/types/wallet/batch-operation';
28
- import glob from 'fast-glob';
29
- import { readFile } from 'fs/promises';
30
- import { join } from 'path';
31
-
32
- type Opts = SanitizedArgs & Record<string, unknown>;
1
+ import { SanitizedArgs, PluginResponse, AccountDetails, Failure, LikeAPromise, Config, NetworkConfig, SandboxConfig, EnvironmentConfig} from "@taqueria/node-sdk/types";
2
+ import glob from 'fast-glob'
3
+ import {join} from 'path'
4
+ import { TezosToolkit, OriginateParams, WalletOperationBatch } from '@taquito/taquito';
5
+ import {readFile} from 'fs/promises'
6
+ import { InMemorySigner, importKey } from '@taquito/signer';
7
+ import { sendAsyncJsonRes, getCurrentEnvironmentConfig, getNetworkConfig, getSandboxAccountConfig, getInitialStorage, sendErr, getSandboxConfig, getDefaultAccount, sendJsonRes, sendAsyncErr } from "@taqueria/node-sdk";
8
+ import { BatchWalletOperation } from "@taquito/taquito/dist/types/wallet/batch-operation";
9
+ import { OperationContentsAndResultOrigination } from "@taquito/rpc";
10
+
11
+ type Opts = SanitizedArgs & Record<string, unknown>
33
12
 
34
13
  interface ContractStorageMapping {
35
- filename: string;
36
- storage?: unknown;
14
+ filename: string,
15
+ storage?: unknown
37
16
  }
38
17
 
39
18
  interface OriginationResult {
40
- contract: string;
41
- address: string;
42
- destination: string;
19
+ contract: string
20
+ address: string
21
+ destination: string
43
22
  }
44
23
 
45
- const getContractAbspath = (contractFilename: string, parsedArgs: Opts) =>
46
- join(parsedArgs.artifactsDir, /\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`);
47
-
48
- const addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) =>
49
- async (mapping: ContractStorageMapping) => {
50
- const contractAbspath = getContractAbspath(mapping.filename, parsedArgs);
51
- const contractData = await readFile(contractAbspath, 'utf-8');
52
- return (await batch).withOrigination({
53
- code: contractData,
54
- storage: mapping.storage,
55
- });
56
- };
24
+ const getContractAbspath = (contractFilename: string, parsedArgs: Opts) =>
25
+ join(parsedArgs.artifactsDir, /\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`)
26
+
27
+ const addOrigination = (parsedArgs: Opts, batch: Promise<WalletOperationBatch>) => async (mapping: ContractStorageMapping) => {
28
+ const contractAbspath = getContractAbspath(mapping.filename, parsedArgs)
29
+ const contractData = await readFile(contractAbspath, "utf-8")
30
+ return (await batch).withOrigination({
31
+ code: contractData,
32
+ storage: mapping.storage,
33
+
34
+ })
35
+ }
57
36
 
58
37
  const getValidContracts = async (parsedArgs: Opts) => {
59
- const contracts = parsedArgs.contract
60
- ? [parsedArgs.contract as string]
61
- : (await glob('**/*.tz', { cwd: parsedArgs.artifactsDir })) as string[];
62
-
63
- return contracts.reduce(
64
- (retval, filename) => {
65
- const storage = getInitialStorage(parsedArgs)(filename);
66
- if (!storage) throw (`No initial storage provided for ${filename}`);
67
- return [...retval, { filename, storage }];
68
- },
69
- [] as ContractStorageMapping[],
70
- );
71
- };
38
+ const contracts = parsedArgs.contract
39
+ ? [parsedArgs.contract as string]
40
+ : (await glob("**/*.tz", {cwd: parsedArgs.artifactsDir})) as string[]
41
+
42
+ return contracts.reduce(
43
+ (retval, filename) => {
44
+ const storage = getInitialStorage(parsedArgs) (filename)
45
+ if (!storage) throw(`No initial storage provided for ${filename}`)
46
+ return [...retval, {filename, storage}]
47
+ },
48
+ [] as ContractStorageMapping[]
49
+ )
50
+ }
72
51
 
73
52
  const mapOpToContract = async (contracts: ContractStorageMapping[], op: BatchWalletOperation, destination: string) => {
74
- debugger;
75
- const results = await op.operationResults();
76
-
77
- return contracts.reduce(
78
- (retval, contract) => {
79
- // If initial storage was provided for the contract
80
- // then we submitted an operation to originate that contract
81
- if (contract.storage) {
82
- const result = results.pop() as OperationContentsAndResultOrigination;
83
- const address = result && result.metadata.operation_result.originated_contracts
84
- ? result.metadata.operation_result.originated_contracts.join(',')
85
- : 'Error';
86
-
87
- return [
88
- ...retval,
89
- {
90
- contract: contract.filename,
91
- address,
92
- destination,
93
- },
94
- ];
95
- }
96
-
97
- return [
98
- ...retval,
99
- {
100
- contract: contract.filename,
101
- address: 'Error',
102
- destination,
103
- },
104
- ];
105
- },
106
- [] as OriginationResult[],
107
- );
108
- };
53
+ debugger
54
+ const results = await op.operationResults()
55
+
56
+ return contracts.reduce(
57
+ (retval, contract) => {
58
+
59
+ // If initial storage was provided for the contract
60
+ // then we submitted an operation to originate that contract
61
+ if (contract.storage) {
62
+ const result = results.pop() as OperationContentsAndResultOrigination
63
+ const address = result && result.metadata.operation_result.originated_contracts
64
+ ? result.metadata.operation_result.originated_contracts.join(',')
65
+ : 'Error'
66
+
67
+ return [
68
+ ...retval, {
69
+ contract: contract.filename,
70
+ address,
71
+ destination
72
+ }
73
+ ]
74
+ }
75
+
76
+ return [
77
+ ...retval, {
78
+ contract: contract.filename,
79
+ address: "Error",
80
+ destination
81
+ }
82
+ ]
83
+ },
84
+ [] as OriginationResult[]
85
+ )
86
+ }
87
+
109
88
 
110
89
  const createBatch = async (parsedArgs: Opts, tezos: TezosToolkit, destination: string) => {
111
- const contracts = await getValidContracts(parsedArgs);
112
-
113
- const batch = await contracts.reduce(
114
- (batch, contractMapping) =>
115
- contractMapping.storage
116
- ? addOrigination(parsedArgs, batch)(contractMapping)
117
- : batch,
118
- Promise.resolve(tezos.wallet.batch()),
119
- );
120
-
121
- try {
122
- const op = await batch.send();
123
- const confirmed = await op.confirmation();
124
- return await mapOpToContract(contracts, op, destination);
125
- } catch (err) {
126
- const error = (err as { message: string });
127
- if (error.message) sendErr(error.message);
128
- return undefined;
129
- }
130
- };
90
+ const contracts = await getValidContracts (parsedArgs)
91
+
92
+ const batch = await contracts.reduce(
93
+ (batch, contractMapping) =>
94
+ contractMapping.storage
95
+ ? addOrigination(parsedArgs, batch) (contractMapping)
96
+ : batch,
97
+ Promise.resolve(tezos.wallet.batch())
98
+ )
99
+
100
+ try {
101
+ const op = await batch.send()
102
+ const confirmed = await op.confirmation()
103
+ return await mapOpToContract(contracts, op, destination)
104
+ }
105
+ catch (err) {
106
+ const error = (err as {message: string})
107
+ if (error.message) sendErr(error.message)
108
+ return undefined
109
+ }
110
+ }
131
111
 
132
112
  const originateToNetworks = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>
133
- currentEnv.networks
134
- ? currentEnv.networks.reduce(
135
- (retval, networkName) => {
136
- const network = getNetworkConfig(parsedArgs)(networkName);
137
- if (network.rpcUrl) {
138
- if (network.faucet) {
139
- const result = (async () => {
140
- const tezos = new TezosToolkit(network.rpcUrl as string);
141
- await importKey(
142
- tezos,
143
- network.faucet.email,
144
- network.faucet.password,
145
- network.faucet.mnemonic.join(' '),
146
- network.faucet.activation_code,
147
- );
148
- return await createBatch(parsedArgs, tezos, networkName);
149
- })();
150
-
151
- return [...retval, result];
152
- } else sendErr(`Network ${networkName} requires a valid faucet in config.json.`);
153
- } else sendErr(`Network "${networkName} is missing an RPC url in config.json."`);
154
- return retval;
155
- },
156
- [] as Promise<OriginationResult[] | undefined>[],
157
- )
158
- : [];
113
+ currentEnv.networks
114
+ ? currentEnv.networks.reduce(
115
+ (retval, networkName) => {
116
+ const network = getNetworkConfig (parsedArgs) (networkName)
117
+ if (network.rpcUrl) {
118
+ if (network.faucet) {
119
+ const result = (async () => {
120
+ const tezos = new TezosToolkit(network.rpcUrl as string)
121
+ await importKey(tezos, network.faucet.email, network.faucet.password, network.faucet.mnemonic.join(' '), network.faucet.activation_code)
122
+ return await createBatch(parsedArgs, tezos, networkName)
123
+ })()
124
+
125
+ return [...retval, result]
126
+ }
127
+ else sendErr(`Network ${networkName} requires a valid faucet in config.json.`)
128
+ }
129
+ else sendErr(`Network "${networkName} is missing an RPC url in config.json."`)
130
+ return retval
131
+ },
132
+ [] as Promise<OriginationResult[]|undefined>[]
133
+ )
134
+ : []
159
135
 
160
136
  const originateToSandboxes = (parsedArgs: Opts, currentEnv: EnvironmentConfig) =>
161
- currentEnv.sandboxes
162
- ? currentEnv.sandboxes.reduce(
163
- (retval, sandboxName) => {
164
- const sandbox = getSandboxConfig(parsedArgs)(sandboxName);
165
- if (sandbox.rpcUrl) {
166
- const secretKey = getDefaultAccount(parsedArgs)(sandboxName)?.keys?.secretKey;
167
- if (secretKey) {
168
- const result = (async () => {
169
- const tezos = new TezosToolkit(sandbox.rpcUrl as string);
170
- tezos.setProvider({
171
- signer: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),
172
- });
173
- return await createBatch(parsedArgs, tezos, sandboxName);
174
- })();
175
-
176
- return [...retval, result];
177
- } else sendErr(`Sandbox ${sandboxName}'s default account is missing keys in config.json.`);
178
- } else sendErr(`Sandbox "${sandboxName} is missing an RPC url in config.json."`);
179
-
180
- return retval;
181
- },
182
- [] as Promise<OriginationResult[] | undefined>[],
183
- )
184
- : [];
137
+ currentEnv.sandboxes
138
+ ? currentEnv.sandboxes.reduce(
139
+ (retval, sandboxName) => {
140
+ const sandbox = getSandboxConfig (parsedArgs) (sandboxName)
141
+ if (sandbox.rpcUrl) {
142
+ const secretKey = getDefaultAccount(parsedArgs) (sandboxName) ?.keys?.secretKey
143
+ if (secretKey) {
144
+ const result = (async () => {
145
+ const tezos = new TezosToolkit(sandbox.rpcUrl as string)
146
+ tezos.setProvider({
147
+ signer: new InMemorySigner(secretKey.replace(/^unencrypted:/, '')),
148
+ });
149
+ return await createBatch(parsedArgs, tezos, sandboxName)
150
+ })()
151
+
152
+ return [...retval, result]
153
+ }
154
+ else sendErr(`Sandbox ${sandboxName}'s default account is missing keys in config.json.`)
155
+ }
156
+ else sendErr(`Sandbox "${sandboxName} is missing an RPC url in config.json."`)
157
+
158
+ return retval
159
+ },
160
+ [] as Promise<OriginationResult[]|undefined>[]
161
+ )
162
+ : []
163
+
164
+
185
165
 
186
166
  export const originate = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {
187
- const env = getCurrentEnvironmentConfig(parsedArgs);
188
-
189
- if (!env) {
190
- return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`);
191
- }
192
-
193
- const jobs = [
194
- ...originateToNetworks(parsedArgs, env),
195
- ...originateToSandboxes(parsedArgs, env),
196
- ];
197
-
198
- return Promise.all(jobs)
199
- .then(jobs =>
200
- jobs.reduce(
201
- (retval, originations) => {
202
- return originations
203
- ? [...retval as OriginationResult[], ...originations]
204
- : retval;
205
- },
206
- [],
207
- )
208
- )
209
- .then(results => results && results.length > 0 ? sendJsonRes(results) : sendErr(`No contracts originated.`));
210
- };
211
-
212
- export default originate;
167
+ const env = getCurrentEnvironmentConfig(parsedArgs)
168
+
169
+ if (!env) {
170
+ return sendAsyncErr(`There is no environment called ${parsedArgs.env} in your config.json.`)
171
+ }
172
+
173
+ const jobs = [
174
+ ...originateToNetworks(parsedArgs, env),
175
+ ...originateToSandboxes(parsedArgs, env)
176
+ ]
177
+
178
+ return Promise.all(jobs)
179
+ .then(jobs => jobs.reduce(
180
+ (retval, originations) => {
181
+ return originations
182
+ ? [...retval as OriginationResult[], ...originations]
183
+ : retval
184
+ },
185
+ []
186
+ ))
187
+ .then(results => results && results.length > 0 ? sendJsonRes(results): sendErr(`No contracts originated.`))
188
+ }
189
+
190
+ export default originate
package/package.json CHANGED
@@ -1,54 +1,54 @@
1
1
  {
2
- "name": "@taqueria/plugin-taquito",
3
- "version": "0.0.0-pr-695-bec90e45",
4
- "description": "A taqueria plugin for originating smart contracts using Taquito",
5
- "targets": {
6
- "default": {
7
- "source": "./index.ts",
8
- "distDir": "./",
9
- "context": "node",
10
- "isLibrary": true
11
- }
12
- },
13
- "scripts": {
14
- "test": "echo \"Error: no test specified\" && exit 1",
15
- "pluginInfo": "npx ts-node index.ts --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}",
16
- "build": "npx tsc -noEmit && npx parcel build --no-cache 2>&1",
17
- "debugPluginInfo": "node --inspect-brk index.js --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}"
18
- },
19
- "keywords": [
20
- "taqueria",
21
- "tezos",
22
- "originate",
23
- "deploy",
24
- "ecad",
25
- "ecadlabs",
26
- "plugin",
27
- "taquito",
28
- "smart contract"
29
- ],
30
- "engines": {
31
- "node": ">=16"
32
- },
33
- "author": "ECAD Labs",
34
- "license": "Apache-2.0",
35
- "repository": {
36
- "type": "git",
37
- "url": "https://github.com/ecadlabs/taqueria.git",
38
- "directory": "taqueria-plugin-taquito"
39
- },
40
- "bugs": {
41
- "url": "https://github.com/ecadlabs/taqueria/issues"
42
- },
43
- "homepage": "https://github.com/ecadlabs/taqueria#readme",
44
- "devDependencies": {
45
- "parcel": "^2.4.0",
46
- "typescript": "4.5.4"
47
- },
48
- "dependencies": {
49
- "@taqueria/node-sdk": "^0.3.1",
50
- "@taquito/signer": "^12.1.0",
51
- "@taquito/taquito": "^12.1.0",
52
- "fast-glob": "^3.2.10"
53
- }
2
+ "name": "@taqueria/plugin-taquito",
3
+ "version": "0.0.0-pr-740-e1500660",
4
+ "description": "A taqueria plugin for originating smart contracts using Taquito",
5
+ "targets": {
6
+ "default": {
7
+ "source": "./index.ts",
8
+ "distDir": "./",
9
+ "context": "node",
10
+ "isLibrary": true
11
+ }
12
+ },
13
+ "scripts": {
14
+ "test": "echo \"Error: no test specified\" && exit 1",
15
+ "pluginInfo": "npx ts-node index.ts --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}",
16
+ "build": "npx tsc -noEmit && npx parcel build --no-cache 2>&1",
17
+ "debugPluginInfo": "node --inspect-brk index.js --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}"
18
+ },
19
+ "keywords": [
20
+ "taqueria",
21
+ "tezos",
22
+ "originate",
23
+ "deploy",
24
+ "ecad",
25
+ "ecadlabs",
26
+ "plugin",
27
+ "taquito",
28
+ "smart contract"
29
+ ],
30
+ "engines": {
31
+ "node": ">=16"
32
+ },
33
+ "author": "ECAD Labs",
34
+ "license": "Apache-2.0",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/ecadlabs/taqueria.git",
38
+ "directory": "taqueria-plugin-taquito"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/ecadlabs/taqueria/issues"
42
+ },
43
+ "homepage": "https://github.com/ecadlabs/taqueria#readme",
44
+ "devDependencies": {
45
+ "parcel": "^2.4.0",
46
+ "typescript": "4.5.4"
47
+ },
48
+ "dependencies": {
49
+ "@taqueria/node-sdk": "^0.3.1",
50
+ "@taquito/signer": "^12.1.0",
51
+ "@taquito/taquito": "^12.1.0",
52
+ "fast-glob": "^3.2.10"
53
+ }
54
54
  }
package/tsconfig.json CHANGED
@@ -1,101 +1,101 @@
1
1
  {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
4
 
5
- /* Projects */
6
- // "incremental": true, /* Enable incremental compilation */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
5
+ /* Projects */
6
+ // "incremental": true, /* Enable incremental compilation */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
12
 
13
- /* Language and Environment */
14
- "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- // "jsx": "preserve", /* Specify what JSX code is generated. */
17
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
20
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
22
- // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
23
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
13
+ /* Language and Environment */
14
+ "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
22
+ // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
25
 
26
- /* Modules */
27
- "module": "CommonJS", /* Specify what module code is generated. */
28
- // "rootDir": "./", /* Specify the root folder within your source files. */
29
- // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
30
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
31
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
32
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
33
- // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
34
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
35
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
36
- // "resolveJsonModule": true, /* Enable importing .json files */
37
- // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
26
+ /* Modules */
27
+ "module": "CommonJS", /* Specify what module code is generated. */
28
+ // "rootDir": "./", /* Specify the root folder within your source files. */
29
+ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
30
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
31
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
32
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
33
+ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
34
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
35
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
36
+ // "resolveJsonModule": true, /* Enable importing .json files */
37
+ // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
38
38
 
39
- /* JavaScript Support */
40
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
41
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
42
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
39
+ /* JavaScript Support */
40
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
41
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
42
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
43
43
 
44
- /* Emit */
45
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
46
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
47
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
48
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
49
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
50
- // "outDir": "./", /* Specify an output folder for all emitted files. */
51
- // "removeComments": true, /* Disable emitting comments. */
52
- // "noEmit": true, /* Disable emitting files from a compilation. */
53
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
54
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
55
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
56
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
57
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
59
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
60
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
61
- // "newLine": "crlf", /* Set the newline character for emitting files. */
62
- // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
63
- // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
64
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
65
- // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
66
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
67
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
44
+ /* Emit */
45
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
46
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
47
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
48
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
49
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
50
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
51
+ // "removeComments": true, /* Disable emitting comments. */
52
+ // "noEmit": true, /* Disable emitting files from a compilation. */
53
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
54
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
55
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
56
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
57
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
59
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
60
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
61
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
62
+ // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
63
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
64
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
65
+ // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
66
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
67
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
68
68
 
69
- /* Interop Constraints */
70
- "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
71
- "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
72
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
73
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
74
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
69
+ /* Interop Constraints */
70
+ "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
71
+ "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
72
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
73
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
74
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
75
75
 
76
- /* Type Checking */
77
- "strict": true, /* Enable all strict type-checking options. */
78
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
79
- // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
80
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
81
- // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
82
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
83
- // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
84
- // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
85
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
86
- // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
87
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
88
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
89
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
90
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
91
- // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
92
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
93
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
94
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
95
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
76
+ /* Type Checking */
77
+ "strict": true, /* Enable all strict type-checking options. */
78
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
79
+ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
80
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
81
+ // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
82
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
83
+ // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
84
+ // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
85
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
86
+ // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
87
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
88
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
89
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
90
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
91
+ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
92
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
93
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
94
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
95
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
96
96
 
97
- /* Completeness */
98
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
99
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
100
- }
97
+ /* Completeness */
98
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
99
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
100
+ }
101
101
  }