Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
chore(dep) Switch to Concerto 1.0.0-alpha.9
Browse files Browse the repository at this point in the history
Signed-off-by: Jerome Simeon <jeromesimeon@me.com>
  • Loading branch information
jeromesimeon committed Apr 24, 2021
1 parent 650da37 commit 85ec365
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 141 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -28,7 +28,7 @@
],
"license": "Apache-2.0",
"devDependencies": {
"@accordproject/concerto-core": "1.0.0-alpha.7",
"@accordproject/concerto-core": "1.0.0-alpha.9",
"colors": "1.1.2",
"coveralls": "3.0.1",
"dayjs": "1.10.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/ergo-cli/extracted/ergoccore.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/ergo-cli/extracted/ergotopcore.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ergo-compiler/extracted/compilercore.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/ergo-compiler/package.json
Expand Up @@ -27,7 +27,7 @@
"access": "public"
},
"dependencies": {
"@accordproject/concerto-core": "1.0.0-alpha.7",
"@accordproject/concerto-core": "1.0.0-alpha.9",
"acorn": "5.1.2",
"dayjs": "1.10.4",
"debug": "4.1.0",
Expand Down
48 changes: 24 additions & 24 deletions packages/ergo-compiler/test/logicmanager.js
Expand Up @@ -86,20 +86,20 @@ describe('LogicManager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
logicManager.registerCompiledLogicSync();
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
logicManager.registerCompiledLogicSync();
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
});

it('should register a logic file to the script manager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.registerCompiledLogicSync();
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
});

it('should succeed creating a dispatch call for a JS logic file with a contract class (ES6)', () => {
Expand Down Expand Up @@ -195,9 +195,9 @@ describe('LogicManager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.compileLogic(false).then((logicCode) => {
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
});
});

Expand All @@ -211,16 +211,16 @@ describe('LogicManager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test3.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
});

it('should load a logic file (without extension) to the script manager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
});

it('should set the contract name', () => {
Expand All @@ -236,30 +236,30 @@ describe('LogicManager', () => {
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.getTarget().should.equal('es6');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
logicManager.setTarget('es6', true);
logicManager.getTarget().should.equal('es6');
const contractName = 'org.accordproject.helloemit.HelloWorld';
logicManager.setContractName(contractName);
logicManager.getContractName().should.equal(ErgoCompiler.contractCallName(contractName));
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
});

it('should fail to create init and dispatch for ES6 without a contract name', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.getTarget().should.equal('es6');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
});

it('should set the compilation target to ES6 but not recompile the logic', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
logicManager.setTarget('es6', false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
});

it('should fail to create init code for Java', () => {
Expand Down Expand Up @@ -299,7 +299,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135646);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135737);
});

it('should load a directory with formula', async function () {
Expand All @@ -314,7 +314,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66750);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66841);
});
});

Expand All @@ -332,7 +332,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135646);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135737);
});

it('should load a Zip with formula', async function () {
Expand All @@ -348,7 +348,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66750);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66841);
});
});

Expand All @@ -370,7 +370,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135646);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(135737);
});

it('should load a Zip with formula', async function () {
Expand All @@ -390,7 +390,7 @@ describe('LogicManager', () => {
'model.cto'
]);
modelManager.getModels()[0].content.length.should.equal(1328);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66750);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(66841);
});
});

Expand Down Expand Up @@ -455,15 +455,15 @@ describe('LogicManager', () => {
const logicManager = new LogicManager('es6');
logicManager.addLogicFile(ergoSample,'test.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
logicManager.updateLogic(ergoSample,'test.ergo');
logicManager.compileLogicSync(false);
logicManager.updateLogic(ergoSample,'testNEW.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
logicManager.updateLogic(ergoSample3,'test.ergo');
logicManager.compileLogicSync(false);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47854);
logicManager.getScriptManager().getCompiledScript().getContents().length.should.equal(47945);
});

});
Expand Down
12 changes: 6 additions & 6 deletions packages/ergo-compiler/test/scriptmanager.js
Expand Up @@ -62,8 +62,8 @@ describe('ScriptManager', () => {
scriptManager.getLogic().map(x => x.name).should.deep.equal(['test.ergo']);
scriptManager.allFunctionDeclarations().length.should.equal(2);
scriptManager.allFunctionDeclarations().map(x => x.getName()).should.deep.equal(['paymentClause','__dispatch']);
scriptManager.getCompiledScript().getContents().length.should.equal(47854);
scriptManager.getCompiledJavaScript().length.should.equal(47854);
scriptManager.getCompiledScript().getContents().length.should.equal(47945);
scriptManager.getCompiledJavaScript().length.should.equal(47945);
scriptManager.allFunctionDeclarations().length.should.equal(152);
scriptManager.allFunctionDeclarations().filter(x => x.name === '__init').length.should.equal(1);
expect(scriptManager.hasInit()).to.not.throw;
Expand All @@ -76,8 +76,8 @@ describe('ScriptManager', () => {
const script2 = scriptManager.createScript('test.ergo','.ergo',ergoSample);
scriptManager.addScript(script1);
scriptManager.addScript(script2);
scriptManager.compileLogic().getContents().length.should.equal(47854);
scriptManager.getCompiledScript().getContents().length.should.equal(47854);
scriptManager.compileLogic().getContents().length.should.equal(47945);
scriptManager.getCompiledScript().getContents().length.should.equal(47945);
scriptManager.getAllScripts().length.should.equal(3);
});

Expand Down Expand Up @@ -182,8 +182,8 @@ describe('ScriptManager', () => {
const script2 = scriptManager.createScript('test.ergo','.ergo',ergoSample);
scriptManager.addScript(script1);
scriptManager.addScript(script2);
scriptManager.compileLogic().getContents().length.should.equal(47854);
scriptManager.getCompiledJavaScript().length.should.equal(47854);
scriptManager.compileLogic().getContents().length.should.equal(47945);
scriptManager.getCompiledJavaScript().length.should.equal(47945);
scriptManager.clearScripts();
return (() => scriptManager.getCompiledJavaScript()).should.throw('Did not find any compiled JavaScript logic');
});
Expand Down
6 changes: 3 additions & 3 deletions packages/ergo-engine/lib/engine.js
Expand Up @@ -15,8 +15,8 @@
'use strict';

const Logger = require('@accordproject/concerto-core').Logger;
const DateTimeUtil = require('@accordproject/concerto-core').DateTimeUtil;
const validateES6 = require('./validateES6');
const Util = require('./util');

/**
* Generate the invocation logic
Expand Down Expand Up @@ -135,7 +135,7 @@ class Engine {
const scriptManager = logic.getScriptManager();

// Set the current time and UTC Offset
const { currentTime: now, utcOffset: offset } = Util.setCurrentTime(currentTime, utcOffset);
const { currentTime: now, utcOffset: offset } = DateTimeUtil.setCurrentTime(currentTime, utcOffset);
const validOptions = validateES6.validateInput(modelManager, options ? options : {
'$class': 'org.accordproject.ergo.options.Options',
'wrapVariables': false,
Expand Down Expand Up @@ -195,7 +195,7 @@ class Engine {
const contractName = logic.getContractName();

// Set the current time and UTC Offset
const { currentTime: now, utcOffset: offset } = Util.setCurrentTime(currentTime, utcOffset);
const { currentTime: now, utcOffset: offset } = DateTimeUtil.setCurrentTime(currentTime, utcOffset);
const validOptions = validateES6.validateInput(modelManager, options ? options : {
'$class': 'org.accordproject.ergo.options.Options',
'wrapVariables': false,
Expand Down
48 changes: 0 additions & 48 deletions packages/ergo-engine/lib/util.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/ergo-engine/package.json
Expand Up @@ -34,7 +34,7 @@
"index.browser.js"
],
"dependencies": {
"@accordproject/concerto-core": "1.0.0-alpha.7",
"@accordproject/concerto-core": "1.0.0-alpha.9",
"@accordproject/ergo-compiler": "0.22.0-alpha.7",
"dayjs": "1.10.4",
"vm2": "3.5.0"
Expand Down
45 changes: 0 additions & 45 deletions packages/ergo-engine/test/util.js

This file was deleted.

4 changes: 2 additions & 2 deletions runtimes/javascript/ergo-runtime-tostring.js
Expand Up @@ -50,7 +50,7 @@ function toStringQ(v, quote) {
}
return result + "]";
}
if(dayjs.isDayjs(v)) {
if(v && typeof v === 'object' && typeof v.isBefore === 'function') {
return v.format('MM/DD/YYYY');
}
if(v.hasOwnProperty('$nat')){
Expand Down Expand Up @@ -95,7 +95,7 @@ function toTextQ(v, quote) {
}
return result + "";
}
if (dayjs.isDayjs(v)) {
if(v && typeof v === 'object' && typeof v.isBefore === 'function') {
return v.format('MM/DD/YYYY');
}
if(v.hasOwnProperty('$nat')){
Expand Down

0 comments on commit 85ec365

Please sign in to comment.