Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions components/persistor/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 9.0.0
* target es2020
## 8.0.2
* bump nconf version due to security vulnerability.
## 8.0.1
Expand Down
12 changes: 6 additions & 6 deletions components/persistor/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
*/
var nextId = 1;
var objectTemplate;
var supertype = require('@haventech/supertype');
import ObjectTemplate from '@haventech/supertype';
import { Supertype, supertypeClass, property } from '@haventech/supertype';

module.exports = function (_ObjectTemplate, _RemoteObjectTemplate, baseClassForPersist) { //@TODO: Why is ObjectTemplate and RemoteObjectTemplate here?
var PersistObjectTemplate = baseClassForPersist._createObject();
Expand Down Expand Up @@ -82,20 +83,20 @@ module.exports.supertypeClass = function (target) {
if (!objectTemplate) {
throw new Error('Please create PersisObjectTemplate before importing templates');
}
return supertype.supertypeClass(target, objectTemplate)
return supertypeClass(target, objectTemplate)
};
module.exports.Supertype = function () {
if (!objectTemplate) {
throw new Error('Please create PersisObjectTemplate before importing templates');
}
return supertype.Supertype.call(this, objectTemplate);
return Reflect.construct( Supertype, [objectTemplate], this.constructor );
};
module.exports.Supertype.prototype = supertype.Supertype.prototype;
module.exports.Supertype.prototype = Supertype.prototype;
module.exports.property = function (props) {
if (!objectTemplate) {
throw new Error('Please create PersisObjectTemplate before importing templates');
}
return supertype.property(props, objectTemplate);
return property(props);
}

var __extends = (this && this.__extends) || (function () {
Expand All @@ -120,7 +121,6 @@ module.exports.Persistable = function (Base) {
}(Base));
}

let ObjectTemplate = supertype.default;
module.exports.Persistor = {
create: function () {return module.exports(ObjectTemplate, null, ObjectTemplate)}
}
Expand Down
20 changes: 10 additions & 10 deletions components/persistor/package-lock.json

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

8 changes: 4 additions & 4 deletions components/persistor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@haventech/persistor",
"description": "A subclass of supertype that serializes to and reconstitutes from MongoDB or SQL databases",
"homepage": "https://github.com/haven-life/persistor",
"version": "8.0.2",
"version": "9.0.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"dependencies": {
Expand All @@ -17,10 +17,10 @@
"uuid": "8.3.2"
},
"peerDependencies": {
"@haventech/supertype": "5.x"
"@haventech/supertype": "6.0.0-beta.4"
},
"devDependencies": {
"@haventech/supertype": "5.x",
"@haventech/supertype": "6.0.0-beta.4",
"@types/bluebird": "*",
"@types/chai": "4.3.0",
"@types/mocha": "9.1.0",
Expand Down Expand Up @@ -64,7 +64,7 @@
"test:config": "mocha test/config --exit",
"test:example": "mocha test/example --exit",
"test:ts": "npm run compile:tests && npm run test:compiled:js",
"test:ts:register": "mocha --compilers ts:ts-node/register test/supertype/persist_banking_pgsql.ts",
"test:ts:register": "mocha --require ts-node/register test/supertype/persist_banking_pgsql.ts",
"test:ts:debug": "mocha --inspect-brk --compilers ts:ts-node/register test/supertype/persist_banking_pgsql.ts"
},
"bugs": {
Expand Down
10 changes: 7 additions & 3 deletions components/persistor/test/supertype/persist_banking_pgsql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import * as _ from 'underscore';
import {Customer} from "./Customer";
import {ExtendedCustomer} from "./ExtendedCustomer";
import Promise = require('bluebird');
import * as sinon from 'sinon';
import {Role} from "./Role";
import {Account} from "./Account";
import {Transaction, Xfer} from './Transaction';
import { SupertypeLogger } from '@haventech/supertype';

var schema = {
Customer: {
Expand Down Expand Up @@ -1010,10 +1012,12 @@ describe('typescript tests: Banking from pgsql Example persist_banking_pgsql', f
sam = new Customer('Sam', 'M', 'Elsamman');
var oldSendToLog = sam.amorphic.logger;

sam.amorphic.logger.sendToLog = function sendToLog(level, obj) {
var str = sam.amorphic.logger.prettyPrint(level, obj).replace(/.*: /, '');
let sendToLogStub = sinon.stub(SupertypeLogger.prototype, 'sendToLog');
sendToLogStub.callsFake((level, obj) => {
let str = sendToLogStub.lastCall.thisValue.prettyPrint(level, obj).replace(/.*: /, '');
console.log(str);
output += str.replace(/[\r\n ]/g, '');
};
});

sam.amorphic.logger.startContext({name: '@haventech/supertype'});
sam.amorphic.logger.warn({foo: 'bar1'}, 'Yippie');
Expand Down
4 changes: 2 additions & 2 deletions components/persistor/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"lib": ["es2015", "es2017"],
"target": "es2020",
"lib": ["es2015", "es2017", "es2020"],
"noImplicitAny": false,
"sourceMap": false,
"typeRoots": [
Expand Down
2 changes: 2 additions & 0 deletions components/semotus/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 7.0.0
* target es2020
## 6.0.1
* bump nconf version due to security vulnerability.
## 6.0.0
Expand Down
20 changes: 10 additions & 10 deletions components/semotus/package-lock.json

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

8 changes: 4 additions & 4 deletions components/semotus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@haventech/semotus",
"version": "6.0.1",
"version": "7.0.0",
"description": "A subclass of supertype that synchronizes sets of objects.",
"homepage": "https://github.com/haven-life/amorphic-framework",
"bugs": {
Expand All @@ -27,7 +27,7 @@
"debugTSTests": "mocha --inspect-brk test/supertype/semotus.js",
"prepublishOnly": "npm run build",
"setup": "npm install",
"test": "mocha -- test/types.js test/javascript/semotus.js",
"test": "mocha -- test/javascript/types.js test/javascript/semotus.js",
"test:ts": "npm run test:ts:supertype && npm run test:ts:syncstates",
"test:ts:compiled": "mocha test/supertype/semotus.js",
"test:ts:supertype": "mocha -p ./test/supertype/tsconfig.json test/supertype/semotus.ts --require ts-node/register",
Expand All @@ -37,7 +37,7 @@
"test:ts:syncstates:both": "mocha ./test/syncStates/tsconfig.json test/syncStates/BaseCases_BothApps.js -t 100000"
},
"devDependencies": {
"@haventech/supertype": "5.x",
"@haventech/supertype": "6.0.0-beta.4",
"@types/chai": "4.3.0",
"@types/express": "4.17.13",
"@types/mocha": "9.1.0",
Expand All @@ -55,7 +55,7 @@
"underscore": "1.13.2"
},
"peerDependencies": {
"@haventech/supertype": "5.x"
"@haventech/supertype": "6.0.0-beta.4"
},
"dependencies": {
"q": "1.x"
Expand Down
2 changes: 1 addition & 1 deletion components/semotus/src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function supertypeClass(objectTemplate, SupertypeModule, target): any {
}

export function Supertype(template, objectTemplate, Supertype) {
return Supertype.call(template, objectTemplate);
return Reflect.construct( Supertype, [objectTemplate], template.constructor );
}

export function property(objectTemplate, SupertypeModule, props, toClientRuleSet, toServerRuleSet) {
Expand Down
3 changes: 2 additions & 1 deletion components/semotus/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"module": "commonjs",
"allowJs": true,
"moduleResolution": "node",
"target": "es5",
"target": "es2020",
"lib": [
"es2015",
"es2017",
"es2020",
"dom"
],
"noImplicitAny": false,
Expand Down
9 changes: 6 additions & 3 deletions components/semotus/test/supertype/semotus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ ServerObjectTemplate.__dictionary__ = RemoteObjectTemplate.__dictionary__;

import {expect} from 'chai';
import { mockRequest, mockResponse } from 'mock-req-res';
import { SupertypeLogger } from '@haventech/supertype';
import * as sinon from 'sinon';

let serverMockReq, serverMockRes, clientMockReq, clientMockRes;

Expand Down Expand Up @@ -94,10 +96,11 @@ describe('Typescript Banking Example', function () {
var sam = clientController.sam;
var oldSendToLog = sam.amorphic.logger;

sam.amorphic.logger.sendToLog = function sendToLog(level, obj) {
var str = sam.amorphic.logger.prettyPrint(level, obj).replace(/.*: /, '');
let sendToLogStub = sinon.stub(SupertypeLogger.prototype, 'sendToLog');
sendToLogStub.callsFake((level, obj) => {
let str = sendToLogStub.lastCall.thisValue.prettyPrint(level, obj).replace(/.*: /, '');
output += str.replace(/[\r\n ]/g, '');
};
});

sam.amorphic.logger.startContext({name: 'supertype'});
sam.amorphic.logger.warn({foo: 'bar1'}, 'Yippie');
Expand Down
5 changes: 3 additions & 2 deletions components/semotus/test/supertype/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"target": "es2020",
"lib": [
"es2015",
"es2017"
"es2017",
"es2020"
],
"noImplicitAny": false,
"typeRoots": [
Expand Down
6 changes: 3 additions & 3 deletions components/semotus/test/syncStates/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"target": "es2020",
"lib": [
"es2015",
"ES2015",
"es2017"
"es2017",
"es2020"
],
"noImplicitAny": false,
"typeRoots": [
Expand Down