From 8250a98cccee9038bf8090f59fca6dd748744bdb Mon Sep 17 00:00:00 2001 From: Jerome Simeon Date: Wed, 23 Dec 2020 12:42:42 -0500 Subject: [PATCH] fix(merge) post-rebase adjustments Signed-off-by: Jerome Simeon --- package-lock.json | 21 +++++++++++++++++ packages/concerto-cli/test/cli.js | 4 ++-- packages/concerto-core/api.txt | 4 ++-- packages/concerto-core/changelog.txt | 2 +- packages/concerto-core/lib/logger.js | 28 ++++++++++++++++------- packages/concerto-core/lib/modelloader.js | 3 --- packages/concerto-tools/package.json | 8 +++---- 7 files changed, 50 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index b65758111e..b51ca8de3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4451,6 +4451,11 @@ "is-obj": "^1.0.0" } }, + "drange": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/drange/-/drange-1.1.1.tgz", + "integrity": "sha512-pYxfDYpued//QpnLIm4Avk7rsNtAtQkUES2cwAYSvD/wd2pKD71gN2Ebj3e7klzXwjocvE8c5vx/1fxwpqmSxA==" + }, "duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", @@ -10227,6 +10232,22 @@ "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", "dev": true }, + "randexp": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.5.3.tgz", + "integrity": "sha512-U+5l2KrcMNOUPYvazA3h5ekF80FHTUG+87SEAmHZmolh1M+i/WyTCxVzmi+tidIa1tM4BSe8g2Y/D3loWDjj+w==", + "requires": { + "drange": "^1.0.2", + "ret": "^0.2.0" + }, + "dependencies": { + "ret": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.2.2.tgz", + "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==" + } + } + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", diff --git a/packages/concerto-cli/test/cli.js b/packages/concerto-cli/test/cli.js index d6dcfb8dcf..55f909f57a 100644 --- a/packages/concerto-cli/test/cli.js +++ b/packages/concerto-cli/test/cli.js @@ -63,7 +63,7 @@ describe('cicero-cli', () => { const result = await Commands.validate(sample2, models, {offline:false}); JSON.parse(result).should.deep.equal(JSON.parse(sampleText2)); } catch (err) { - err.message.should.equal('Instance undefined invalid enum value true for field CurrencyCode'); + err.message.should.equal('Instance org.accordproject.money.MonetaryAmount#null invalid enum value true for field CurrencyCode'); } }); @@ -74,7 +74,7 @@ describe('cicero-cli', () => { it('should fail to validate against a model (offline)', async () => { try { - const result = await Commands.validate(sample2, null, offlineModels, {offline:true}); + const result = await Commands.validate(sample2, offlineModels, {offline:true}); JSON.parse(result).should.deep.equal(JSON.parse(sampleText2)); } catch (err) { err.message.should.equal('Instance org.accordproject.money.MonetaryAmount#null invalid enum value true for field CurrencyCode'); diff --git a/packages/concerto-core/api.txt b/packages/concerto-core/api.txt index 1d90d26c24..250f351ef0 100644 --- a/packages/concerto-core/api.txt +++ b/packages/concerto-core/api.txt @@ -188,8 +188,8 @@ class ValidatedResource extends Resource { + void validate() throws Error } class ModelLoader { - + object loadModelManager(string[],boolean) - + object loadModelManagerFromModelFiles(object[],undefined,boolean) + + object loadModelManager(string[],object,boolean) + + object loadModelManagerFromModelFiles(object[],undefined,object,boolean) } class ModelManager { + void constructor() diff --git a/packages/concerto-core/changelog.txt b/packages/concerto-core/changelog.txt index 5ab56f5587..c9a0f472ca 100644 --- a/packages/concerto-core/changelog.txt +++ b/packages/concerto-core/changelog.txt @@ -24,7 +24,7 @@ # Note that the latest public API is documented using JSDocs and is available in api.txt. # -Version 0.82.7 {c81e803b2bd1acfed8b01cc505789c3a} 2020-07-06 +Version 0.82.7 {6b77ace6b34d454cc067aa5e204aa29b} 2020-07-06 - Concepts may now be identified - assets/participants/transaction/events have a system identified created $identifier automatically - Can no longer redefine the identifier declared by a super type diff --git a/packages/concerto-core/lib/logger.js b/packages/concerto-core/lib/logger.js index 3070add40b..6f45832437 100644 --- a/packages/concerto-core/lib/logger.js +++ b/packages/concerto-core/lib/logger.js @@ -66,15 +66,20 @@ const isJson = (str) => { } }; -jsome.params.lintable = true; - -const jsonColor = winston.format(info => { - const padding = info.padding && info.padding[info.level] || ''; - - if (info[LEVEL] === 'error' && info.stack) { - info[MESSAGE] = `${tsFormat()} - ${info.level}:${padding} ${info.message}\n${info.stack}`; - return info; +/** +* Helper function to color and format JSON objects +* @param {any} obj - the input obj to prettify +* @returns {any} - the prettified object +* @private +*/ +const prettifyJson = (obj) => { + if(typeof obj === 'object') { + return `\n${jsome.getColoredString(obj, null, 2)}`; + } else if(isJson(obj)) { + return `\n${jsome.getColoredString(JSON.parse(obj), null, 2)}`; } + return obj; +}; /** * The default transport for logging at multiple levels to the console @@ -240,3 +245,10 @@ class Logger { static silly(...args){ return this.dispatch('silly', ...args); } } +// Set the default logging level +Logger.level = 'info'; + +// A list of user-provided logging tranports +Logger.transports = [ defaultTransport ]; + +module.exports = Logger; diff --git a/packages/concerto-core/lib/modelloader.js b/packages/concerto-core/lib/modelloader.js index a190a598f7..77754666ef 100644 --- a/packages/concerto-core/lib/modelloader.js +++ b/packages/concerto-core/lib/modelloader.js @@ -94,9 +94,6 @@ class ModelLoader { // Load system model modelManager.addModelFiles(modelFiles, fileNames, true); - // Load user models - modelManager.addModelFiles(modelFiles, fileNames); - // Validate the models, either offline or with external model resolution if(options && options.offline) { modelManager.validateModelFiles(); diff --git a/packages/concerto-tools/package.json b/packages/concerto-tools/package.json index 28a7562969..af4fae725b 100644 --- a/packages/concerto-tools/package.json +++ b/packages/concerto-tools/package.json @@ -120,9 +120,9 @@ ], "all": true, "check-coverage": true, - "statements": 100, - "branches": 100, - "functions": 100, - "lines": 100 + "statements": 99, + "branches": 99, + "functions": 99, + "lines": 99 } } \ No newline at end of file