Socket
Socket
Sign inDemoInstall

@worldsibu/convector-core-model

Package Overview
Dependencies
Maintainers
1
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@worldsibu/convector-core-model - npm Package Compare versions

Comparing version 1.2.1-0-alpha.57ce2bb4 to 1.2.1-0-alpha.619b2e94

8

dist/src/convector-model.d.ts

@@ -30,3 +30,3 @@ import * as yup from 'yup';

}>;
static getOne<T extends ConvectorModel<any>>(this: new (content: any) => T, id: string, type?: new (content: any) => T): Promise<T>;
static getOne<T extends ConvectorModel<any>>(this: new (content: any) => T, id: string, type?: new (content: any) => T, storageOptions?: any): Promise<T>;
static query<T>(type: new (content: any) => T, ...args: any[]): Promise<T | T[]>;

@@ -44,5 +44,5 @@ static getAll<T extends ConvectorModel<any>>(this: new (content: any) => T, type?: string): Promise<T[]>;

}): Promise<void>;
fetch(): Promise<void>;
fetch(storageOptions?: any): Promise<void>;
history(): Promise<History<T>[]>;
save(): Promise<void>;
save(storageOptions?: any): Promise<void>;
clone(): T;

@@ -52,4 +52,4 @@ toJSON(skipEmpty?: boolean): {

};
delete(): Promise<void>;
delete(storageOptions?: any): Promise<void>;
private assign(content, defaults?);
}

@@ -25,3 +25,3 @@ "use strict";

};
ConvectorModel.getOne = function (id, type) {
ConvectorModel.getOne = function (id, type, storageOptions) {
return tslib_1.__awaiter(this, void 0, void 0, function () {

@@ -33,7 +33,7 @@ var content, model;

type = type || this;
return [4, convector_core_storage_1.BaseStorage.current.get(id)];
return [4, convector_core_storage_1.BaseStorage.current.get(id, storageOptions)];
case 1:
content = _a.sent();
model = new type(content);
if (content.type !== model.type) {
if ((content && model) && content.type !== model.type) {
throw new Error("Possible ID collision, element " + id + " of type " + content.type + " is not " + model.type);

@@ -94,3 +94,3 @@ }

};
ConvectorModel.prototype.fetch = function () {
ConvectorModel.prototype.fetch = function (storageOptions) {
return tslib_1.__awaiter(this, void 0, void 0, function () {

@@ -100,3 +100,3 @@ var content;

switch (_a.label) {
case 0: return [4, convector_core_storage_1.BaseStorage.current.get(this.id)];
case 0: return [4, convector_core_storage_1.BaseStorage.current.get(this.id, storageOptions)];
case 1:

@@ -131,3 +131,3 @@ content = _a.sent();

};
ConvectorModel.prototype.save = function () {
ConvectorModel.prototype.save = function (storageOptions) {
return tslib_1.__awaiter(this, void 0, void 0, function () {

@@ -147,3 +147,3 @@ return tslib_1.__generator(this, function (_a) {

convector_core_errors_1.InvalidIdError.test(this.id);
return [4, convector_core_storage_1.BaseStorage.current.set(this.id, this)];
return [4, convector_core_storage_1.BaseStorage.current.set(this.id, this, storageOptions)];
case 1:

@@ -193,7 +193,7 @@ _a.sent();

};
ConvectorModel.prototype.delete = function () {
ConvectorModel.prototype.delete = function (storageOptions) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, convector_core_storage_1.BaseStorage.current.delete(this.id)];
case 0: return [4, convector_core_storage_1.BaseStorage.current.delete(this.id, storageOptions)];
case 1:

@@ -200,0 +200,0 @@ _a.sent();

@@ -24,5 +24,11 @@ "use strict";

return Object.keys(required)
.every(function (k) { return !required[k] || obj[k] !== undefined; });
.every(function (k) {
var res = !required[k] || obj[k] !== undefined;
if (!res) {
console.log("Validation error. Field " + k + " is required but was not found.");
}
return res;
});
}
exports.ensureRequired = ensureRequired;
//# sourceMappingURL=required.decorator.js.map

@@ -21,3 +21,9 @@ "use strict";

setter = !setter || setter === getSet.set ? (function (v) { return v; }) : setter;
this["_" + key] = schema.validateSync(setter.call(this, newVal));
try {
this["_" + key] = schema.validateSync(setter.call(this, newVal));
}
catch (ex) {
ex.message = "Error for field '" + key + "' with val '" + JSON.stringify(newVal) + "' " + ex.message;
throw ex;
}
},

@@ -24,0 +30,0 @@ enumerable: true,

{
"name": "@worldsibu/convector-core-model",
"version": "1.2.1-0-alpha.57ce2bb4",
"version": "1.2.1-0-alpha.619b2e94",
"description": "Convector Model base class",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model"
},
"homepage": "https://worldsibu.tech/convector/convector-smart-contracts/",
"main": "./dist/src/index.js",

@@ -35,4 +40,4 @@ "typings": "./dist/src/index.d.ts",

"dependencies": {
"@worldsibu/convector-core-errors": "1.2.1-0-alpha.57ce2bb4",
"@worldsibu/convector-core-storage": "1.2.1-0-alpha.57ce2bb4",
"@worldsibu/convector-core-errors": "1.2.1-0-alpha.619b2e94",
"@worldsibu/convector-core-storage": "1.2.1-0-alpha.619b2e94",
"tslib": "^1.9.0",

@@ -39,0 +44,0 @@ "yup": "^0.26.10"

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc