@worldsibu/convector-core-model
Advanced tools
Comparing version 1.0.4-0-alpha.1ab95c05 to 1.0.4-0-alpha.3af5ce5e
@@ -11,3 +11,3 @@ "use strict"; | ||
var required_decorator_1 = require("../src/required.decorator"); | ||
var ConvectorModel = /** @class */ (function () { | ||
var ConvectorModel = (function () { | ||
function ConvectorModel(content) { | ||
@@ -30,6 +30,6 @@ if (!content) { | ||
type = type || this; | ||
return [4 /*yield*/, convector_core_storage_1.BaseStorage.current.get(id)]; | ||
return [4, convector_core_storage_1.BaseStorage.current.get(id)]; | ||
case 1: | ||
content = _a.sent(); | ||
return [2 /*return*/, new type(content)]; | ||
return [2, new type(content)]; | ||
} | ||
@@ -50,10 +50,9 @@ }); | ||
type = this; | ||
// Stupid horrible hack to find the current implementation's parent type | ||
if (args[0] && args[0].prototype.__proto__.constructor === ConvectorModel) { | ||
type = args.shift(); | ||
} | ||
return [4 /*yield*/, (_a = convector_core_storage_1.BaseStorage.current).query.apply(_a, args)]; | ||
return [4, (_a = convector_core_storage_1.BaseStorage.current).query.apply(_a, args)]; | ||
case 1: | ||
content = _b.sent(); | ||
return [2 /*return*/, Array.isArray(content) ? content.map(function (c) { return new type(c); }) : new type(content)]; | ||
return [2, Array.isArray(content) ? content.map(function (c) { return new type(c); }) : new type(content)]; | ||
} | ||
@@ -69,4 +68,4 @@ }); | ||
type = type || new this('').type; | ||
return [4 /*yield*/, ConvectorModel.query(this, { selector: { type: type } })]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
return [4, ConvectorModel.query(this, { selector: { type: type } })]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
@@ -82,6 +81,6 @@ }); | ||
this.assign(content); | ||
return [4 /*yield*/, this.save()]; | ||
return [4, this.save()]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
return [2]; | ||
} | ||
@@ -96,3 +95,3 @@ }); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, convector_core_storage_1.BaseStorage.current.get(this.id)]; | ||
case 0: return [4, convector_core_storage_1.BaseStorage.current.get(this.id)]; | ||
case 1: | ||
@@ -104,3 +103,3 @@ content = _a.sent(); | ||
this.assign(content); | ||
return [2 /*return*/]; | ||
return [2]; | ||
} | ||
@@ -120,6 +119,6 @@ }); | ||
convector_core_errors_1.InvalidIdError.test(this.id); | ||
return [4 /*yield*/, convector_core_storage_1.BaseStorage.current.set(this.id, this)]; | ||
return [4, convector_core_storage_1.BaseStorage.current.set(this.id, this)]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
return [2]; | ||
} | ||
@@ -160,6 +159,6 @@ }); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, convector_core_storage_1.BaseStorage.current.delete(this.id)]; | ||
case 0: return [4, convector_core_storage_1.BaseStorage.current.delete(this.id)]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
return [2]; | ||
} | ||
@@ -166,0 +165,0 @@ }); |
"use strict"; | ||
// tslint:disable:no-invalid-this | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +3,0 @@ function ReadOnly() { |
@@ -20,3 +20,2 @@ "use strict"; | ||
catch (e) { | ||
// empty | ||
} | ||
@@ -23,0 +22,0 @@ return Object.keys(required) |
"use strict"; | ||
// tslint:disable:no-invalid-this | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -34,3 +33,2 @@ var tslib_1 = require("tslib"); | ||
catch (e) { | ||
// empty | ||
} | ||
@@ -37,0 +35,0 @@ return Object.keys(validated); |
{ | ||
"name": "@worldsibu/convector-core-model", | ||
"version": "1.0.4-0-alpha.1ab95c05", | ||
"version": "1.0.4-0-alpha.3af5ce5e", | ||
"description": "Convector Model base class", | ||
@@ -23,3 +23,3 @@ "license": "ISC", | ||
"predocs:generate": "npm run clean:docs", | ||
"docs:generate": "typedoc src --out docs --target ES6 --excludePrivate", | ||
"docs:generate": "typedoc src --mode file --out docs --target ES6 --excludePrivate", | ||
"docs:serve": "http-server docs" | ||
@@ -37,4 +37,4 @@ }, | ||
"@theledger/fabric-chaincode-utils": "^2.0.9", | ||
"@worldsibu/convector-core-errors": "^1.0.4-0-alpha.1ab95c05", | ||
"@worldsibu/convector-core-storage": "^1.0.4-0-alpha.1ab95c05", | ||
"@worldsibu/convector-core-errors": "^1.0.4-0-alpha.3af5ce5e", | ||
"@worldsibu/convector-core-storage": "^1.0.4-0-alpha.3af5ce5e", | ||
"tslib": "^1.9.0", | ||
@@ -44,2 +44,3 @@ "yup": "^0.24.1" | ||
"devDependencies": { | ||
"http-server": "^0.11.1", | ||
"mocha": "^5.0.3", | ||
@@ -51,4 +52,5 @@ "npm-scripts-watcher": "^1.0.2", | ||
"tslint": "^5.9.1", | ||
"typedoc": "^0.11.1", | ||
"typescript": "2.8.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24115
9
328