diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-02-24 04:58:36 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-02-24 06:25:48 +0800 |
commit | 55f38b9c35bb8b988eb22ee47d4d671475f05a0e (patch) | |
tree | f737d8095a3b01e209f5cdf0c0a5c72035c862e7 /packages/sra-report | |
parent | e13924cd2dbe14c426ddadd4ab21a872712ae0fd (diff) | |
download | dexon-sol-tools-55f38b9c35bb8b988eb22ee47d4d671475f05a0e.tar.gz dexon-sol-tools-55f38b9c35bb8b988eb22ee47d4d671475f05a0e.tar.zst dexon-sol-tools-55f38b9c35bb8b988eb22ee47d4d671475f05a0e.zip |
Add an array of schemaKeys to the globals
Diffstat (limited to 'packages/sra-report')
-rw-r--r-- | packages/sra-report/src/index.ts | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts index a24de377a..58734182e 100644 --- a/packages/sra-report/src/index.ts +++ b/packages/sra-report/src/index.ts @@ -13,6 +13,13 @@ import * as mainnetTokensEnvironmentJSON from '../postman_configs/environments/m import { utils } from './utils'; +interface GlobalsValue { + key: string; + value: string; + enabled: boolean; + type: string; +} + const DEFAULT_NETWORK_ID = 1; const SUPPORTED_NETWORK_IDS = [1, 42]; @@ -73,19 +80,30 @@ function createGlobals(url: string, schemaList: Schema[]) { enabled: true, type: 'text', }; - const schemaGlobalsValues = _.compact(_.map(schemaList, (schema: Schema) => { - if (_.isUndefined(schema.id)) { - return undefined; - } else { - return { - key: convertSchemaIdToKey(schema.id), - value: JSON.stringify(schema), - enabled: true, - type: 'text', - }; - } - })); - const globalsValues = _.concat(schemaGlobalsValues, urlGlobalsValue); + const schemaGlobalsValues = _.compact( + _.map(schemaList, (schema: Schema) => { + if (_.isUndefined(schema.id)) { + return undefined; + } else { + return { + key: convertSchemaIdToKey(schema.id), + value: JSON.stringify(schema), + enabled: true, + type: 'text', + }; + } + }), + ); + const schemaKeys = _.map(schemaGlobalsValues, (globalsValue: GlobalsValue) => { + return globalsValue.key; + }); + const schemaKeysGlobalsValue = { + key: 'schemaKeys', + value: JSON.stringify(schemaKeys), + enabled: true, + type: 'text', + }; + const globalsValues = _.concat(schemaGlobalsValues, urlGlobalsValue, schemaKeysGlobalsValue); const globals = { values: globalsValues, }; |