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.cf9e512a to 1.2.1-0-alpha.d00d4639

15

dist/src/convector-model.d.ts
import * as yup from 'yup';
export declare type RequiredKeys<T> = {
[K in keyof T]-?: string extends K ? never : number extends K ? never : {} extends Pick<T, K> ? never : K;
} extends {
[_ in keyof T]-?: infer U;
} ? U extends keyof T ? U : never : never;
export declare type OptionalKeys<T> = {
[K in keyof T]-?: string extends K ? never : number extends K ? never : {} extends Pick<T, K> ? K : never;
} extends {
[_ in keyof T]-?: infer U;
} ? U extends keyof T ? U : never : never;
export declare type FlatConvectorModel<T> = {
[L in Exclude<keyof T, keyof ConvectorModel<any>>]: T[L];
[L in Exclude<OptionalKeys<T>, keyof ConvectorModel<any>>]?: T[L];
} & {
[L in Exclude<RequiredKeys<T>, keyof ConvectorModel<any>>]: T[L];
};

@@ -11,2 +23,3 @@ export interface History<T> {

export declare abstract class ConvectorModel<T extends ConvectorModel<any>> {
private static type;
static schema<T extends ConvectorModel<any>>(this: Function & {

@@ -13,0 +26,0 @@ prototype: T;

19

dist/src/convector-model.js

@@ -23,8 +23,7 @@ "use strict";

ConvectorModel.schema = function () {
var instance = new this();
return yup.object().shape(tslib_1.__assign({ id: yup.string().required(), type: yup.string() }, validate_decorator_2.getPropertiesValidation(instance)));
return yup.object().shape(tslib_1.__assign({ id: yup.string().required(), type: yup.string() }, validate_decorator_2.getPropertiesValidation(this.prototype)));
};
ConvectorModel.getOne = function (id, type) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var content;
var content, model;
return tslib_1.__generator(this, function (_a) {

@@ -37,3 +36,7 @@ switch (_a.label) {

content = _a.sent();
return [2, new type(content)];
model = new type(content);
if ((content && model) && content.type !== model.type) {
throw new Error("Possible ID collision, element " + id + " of type " + content.type + " is not " + model.type);
}
return [2, model];
}

@@ -54,3 +57,3 @@ });

type = this;
if (args[0] && args[0].prototype.__proto__.constructor === ConvectorModel) {
if (args[0] && 'type' in args[0] && args[0].type === ConvectorModel.type) {
type = args.shift();

@@ -166,3 +169,3 @@ }

.filter(function (k) { return !k.startsWith('_'); })
.filter(function (k) { return !skipEmpty || _this[k] !== undefined || _this[k] !== null; })
.filter(function (k) { return !skipEmpty || !(_this[k] === undefined || _this[k] === null); })
.reduce(function (result, key) {

@@ -182,2 +185,5 @@ return (tslib_1.__assign({}, result, (_a = {}, _a[key] = _this[key], _a)));

}
if (result[key] instanceof ConvectorModel) {
result[key] = result[key].toJSON(true);
}
return result;

@@ -211,2 +217,3 @@ }, base);

};
ConvectorModel.type = 'io.convector.model';
tslib_1.__decorate([

@@ -213,0 +220,0 @@ required_decorator_1.Required(),

{
"name": "@worldsibu/convector-core-model",
"version": "1.2.1-0-alpha.cf9e512a",
"version": "1.2.1-0-alpha.d00d4639",
"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.cf9e512a",
"@worldsibu/convector-core-storage": "1.2.1-0-alpha.cf9e512a",
"@worldsibu/convector-core-errors": "1.2.1-0-alpha.d00d4639",
"@worldsibu/convector-core-storage": "1.2.1-0-alpha.d00d4639",
"tslib": "^1.9.0",

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

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