@apex-pub/convector-core-model 1.5.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  import * as yup from 'yup';
2
- export declare type RequiredKeys<T> = {
2
+ export type RequiredKeys<T> = {
3
3
  [K in keyof T]-?: string extends K ? never : number extends K ? never : {} extends Pick<T, K> ? never : K;
4
4
  } extends {
5
5
  [_ in keyof T]-?: infer U;
6
6
  } ? U extends keyof T ? U : never : never;
7
- export declare type OptionalKeys<T> = {
7
+ export type OptionalKeys<T> = {
8
8
  [K in keyof T]-?: string extends K ? never : number extends K ? never : {} extends Pick<T, K> ? K : never;
9
9
  } extends {
10
10
  [_ in keyof T]-?: infer U;
@@ -31,7 +31,7 @@ export declare abstract class ConvectorModel<T extends ConvectorModel<any>> {
31
31
  static query<T>(type: new (content: any) => T, ...args: any[]): Promise<T | T[]>;
32
32
  static getAll<T extends ConvectorModel<any>>(this: new (content: any) => T, type?: string): Promise<T[]>;
33
33
  id: string;
34
- readonly abstract type: string;
34
+ abstract readonly type: string;
35
35
  constructor();
36
36
  constructor(id: string);
37
37
  constructor(content: {
@@ -48,5 +48,5 @@ export declare abstract class ConvectorModel<T extends ConvectorModel<any>> {
48
48
  [key in keyof T]?: T[key];
49
49
  };
50
50
  delete(storageOptions?: any): Promise<void>;
51
- private assign(content, defaults?);
51
+ private assign;
52
52
  }
@@ -1,15 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- var yup = require("yup");
5
- var convector_core_errors_1 = require("@apex-pub/convector-core-errors");
6
- var convector_core_storage_1 = require("@apex-pub/convector-core-storage");
7
- var validate_decorator_1 = require("../src/validate.decorator");
8
- var default_decorator_1 = require("../src/default.decorator");
9
- var required_decorator_1 = require("../src/required.decorator");
10
- var validate_decorator_2 = require("../src/validate.decorator");
11
- var ConvectorModel = (function () {
12
- function ConvectorModel(content) {
3
+ exports.ConvectorModel = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const yup = tslib_1.__importStar(require("yup"));
6
+ const convector_core_errors_1 = require("@apex-pub/convector-core-errors");
7
+ const convector_core_storage_1 = require("@apex-pub/convector-core-storage");
8
+ const validate_decorator_1 = require("../src/validate.decorator");
9
+ const default_decorator_1 = require("../src/default.decorator");
10
+ const required_decorator_1 = require("../src/required.decorator");
11
+ const validate_decorator_2 = require("../src/validate.decorator");
12
+ class ConvectorModel {
13
+ static schema() {
14
+ return yup.object().shape({
15
+ id: yup.string().required(),
16
+ type: yup.string(),
17
+ ...(0, validate_decorator_2.getPropertiesValidation)(this.prototype)
18
+ });
19
+ }
20
+ static async getOne(id, type, storageOptions) {
21
+ type = type || this;
22
+ const content = await convector_core_storage_1.BaseStorage.current.get(id, storageOptions);
23
+ const model = new type(content);
24
+ if ((content && model) && content.type !== new type('').type) {
25
+ if (storageOptions && storageOptions.enforceType) {
26
+ throw new Error(`Possible ID collision, element ${id} of type ${content.type} is not ${new type('').type}`);
27
+ }
28
+ else {
29
+ console.warn(`Possible ID collision, element ${id} of type ${content.type} is not ${new type('').type}`);
30
+ }
31
+ }
32
+ return model;
33
+ }
34
+ static async query(...args) {
35
+ let type = this;
36
+ if (args[0] && 'type' in args[0] && args[0].type === ConvectorModel.type) {
37
+ type = args.shift();
38
+ }
39
+ const content = await convector_core_storage_1.BaseStorage.current.query(...args);
40
+ return Array.isArray(content) ? content.map(c => new type(c)) : new type(content);
41
+ }
42
+ static async getAll(type) {
43
+ type = type || new this('').type;
44
+ return await ConvectorModel.query(this, { selector: { type } });
45
+ }
46
+ constructor(content) {
13
47
  if (!content) {
14
48
  return;
15
49
  }
@@ -19,166 +53,63 @@ var ConvectorModel = (function () {
19
53
  }
20
54
  this.assign(content);
21
55
  }
22
- ConvectorModel.schema = function () {
23
- return yup.object().shape(tslib_1.__assign({ id: yup.string().required(), type: yup.string() }, validate_decorator_2.getPropertiesValidation(this.prototype)));
24
- };
25
- ConvectorModel.getOne = function (id, type, storageOptions) {
26
- return tslib_1.__awaiter(this, void 0, void 0, function () {
27
- var content, model;
28
- return tslib_1.__generator(this, function (_a) {
29
- switch (_a.label) {
30
- case 0:
31
- type = type || this;
32
- return [4, convector_core_storage_1.BaseStorage.current.get(id, storageOptions)];
33
- case 1:
34
- content = _a.sent();
35
- model = new type(content);
36
- if ((content && model) && content.type !== new type('').type) {
37
- if (storageOptions && storageOptions.enforceType) {
38
- throw new Error("Possible ID collision, element " + id + " of type " + content.type + " is not " + new type('').type);
39
- }
40
- else {
41
- console.warn("Possible ID collision, element " + id + " of type " + content.type + " is not " + new type('').type);
42
- }
43
- }
44
- return [2, model];
45
- }
46
- });
47
- });
48
- };
49
- ConvectorModel.query = function () {
50
- var args = [];
51
- for (var _i = 0; _i < arguments.length; _i++) {
52
- args[_i] = arguments[_i];
56
+ async update(content) {
57
+ this.assign(content);
58
+ await this.save();
59
+ }
60
+ async fetch(storageOptions) {
61
+ const content = await convector_core_storage_1.BaseStorage.current.get(this.id, storageOptions);
62
+ if (content.type !== this.type) {
63
+ throw new Error(`Possible ID collision, element ${this.id} of type ${content.type} is not ${this.type}`);
53
64
  }
54
- return tslib_1.__awaiter(this, void 0, void 0, function () {
55
- var type, content, _a;
56
- return tslib_1.__generator(this, function (_b) {
57
- switch (_b.label) {
58
- case 0:
59
- type = this;
60
- if (args[0] && 'type' in args[0] && args[0].type === ConvectorModel.type) {
61
- type = args.shift();
62
- }
63
- return [4, (_a = convector_core_storage_1.BaseStorage.current).query.apply(_a, args)];
64
- case 1:
65
- content = _b.sent();
66
- return [2, Array.isArray(content) ? content.map(function (c) { return new type(c); }) : new type(content)];
67
- }
68
- });
69
- });
70
- };
71
- ConvectorModel.getAll = function (type) {
72
- return tslib_1.__awaiter(this, void 0, void 0, function () {
73
- return tslib_1.__generator(this, function (_a) {
74
- switch (_a.label) {
75
- case 0:
76
- type = type || new this('').type;
77
- return [4, ConvectorModel.query(this, { selector: { type: type } })];
78
- case 1: return [2, _a.sent()];
79
- }
80
- });
81
- });
82
- };
83
- ConvectorModel.prototype.update = function (content) {
84
- return tslib_1.__awaiter(this, void 0, void 0, function () {
85
- return tslib_1.__generator(this, function (_a) {
86
- switch (_a.label) {
87
- case 0:
88
- this.assign(content);
89
- return [4, this.save()];
90
- case 1:
91
- _a.sent();
92
- return [2];
93
- }
94
- });
95
- });
96
- };
97
- ConvectorModel.prototype.fetch = function (storageOptions) {
98
- return tslib_1.__awaiter(this, void 0, void 0, function () {
99
- var content;
100
- return tslib_1.__generator(this, function (_a) {
101
- switch (_a.label) {
102
- case 0: return [4, convector_core_storage_1.BaseStorage.current.get(this.id, storageOptions)];
103
- case 1:
104
- content = _a.sent();
105
- if (content.type !== this.type) {
106
- throw new Error("Possible ID collision, element " + this.id + " of type " + content.type + " is not " + this.type);
107
- }
108
- this.assign(content);
109
- return [2];
110
- }
111
- });
112
- });
113
- };
114
- ConvectorModel.prototype.history = function () {
115
- return tslib_1.__awaiter(this, void 0, void 0, function () {
116
- var _this = this;
117
- var history;
118
- return tslib_1.__generator(this, function (_a) {
119
- switch (_a.label) {
120
- case 0: return [4, convector_core_storage_1.BaseStorage.current.history(this.id)];
121
- case 1:
122
- history = _a.sent();
123
- return [2, history.map(function (item) { return ({
124
- txId: item.tx_id,
125
- value: new _this.constructor(item.value),
126
- timestamp: item.timestamp
127
- }); })];
128
- }
129
- });
130
- });
131
- };
132
- ConvectorModel.prototype.save = function (storageOptions) {
133
- return tslib_1.__awaiter(this, void 0, void 0, function () {
134
- return tslib_1.__generator(this, function (_a) {
135
- switch (_a.label) {
136
- case 0:
137
- this.assign(default_decorator_1.getDefaults(this), true);
138
- if (!required_decorator_1.ensureRequired(this)) {
139
- if (!this.id) {
140
- throw new Error("Model " + this.type + " is missing the 'id' property \n" + JSON.stringify(this));
141
- }
142
- else {
143
- throw new Error("Model " + this.type + " is not complete\n" + JSON.stringify(this) + ".\n Check your model definition for more details.");
144
- }
145
- }
146
- convector_core_errors_1.InvalidIdError.test(this.id);
147
- return [4, convector_core_storage_1.BaseStorage.current.set(this.id, this, storageOptions)];
148
- case 1:
149
- _a.sent();
150
- return [2];
151
- }
152
- });
153
- });
154
- };
155
- ConvectorModel.prototype.clone = function () {
65
+ this.assign(content);
66
+ }
67
+ async history() {
68
+ const history = await convector_core_storage_1.BaseStorage.current.history(this.id);
69
+ return history.map(item => ({
70
+ txId: item.txId,
71
+ value: new this.constructor(item.value),
72
+ timestamp: item.timestamp
73
+ }));
74
+ }
75
+ async save(storageOptions) {
76
+ this.assign((0, default_decorator_1.getDefaults)(this), true);
77
+ if (!(0, required_decorator_1.ensureRequired)(this)) {
78
+ if (!this.id) {
79
+ throw new Error(`Model ${this.type} is missing the 'id' property \n${JSON.stringify(this)}`);
80
+ }
81
+ else {
82
+ throw new Error(`Model ${this.type} is not complete\n${JSON.stringify(this)}.
83
+ Check your model definition for more details.`);
84
+ }
85
+ }
86
+ convector_core_errors_1.InvalidIdError.test(this.id);
87
+ await convector_core_storage_1.BaseStorage.current.set(this.id, this, storageOptions);
88
+ }
89
+ clone() {
156
90
  return new this.constructor(Object.assign({}, this));
157
- };
158
- ConvectorModel.prototype.toJSON = function (skipEmpty) {
159
- var _this = this;
160
- if (skipEmpty === void 0) { skipEmpty = false; }
161
- var protos = [];
162
- var children = this;
91
+ }
92
+ toJSON(skipEmpty = false) {
93
+ let protos = [];
94
+ let children = this;
163
95
  do {
164
96
  children = Object.getPrototypeOf(children);
165
97
  protos.push(children);
166
98
  } while (children['__proto__'].constructor.name !== ConvectorModel.name);
167
- var descriptors = protos.reduce(function (result, proto) { return result.concat(Object.keys(proto)
168
- .map(function (key) { return [key, Object.getOwnPropertyDescriptor(proto, key)]; })); }, []);
169
- var base = Object.keys(this).concat('id')
170
- .filter(function (k) { return !k.startsWith('_'); })
171
- .filter(function (k) { return !skipEmpty || !(_this[k] === undefined || _this[k] === null); })
172
- .reduce(function (result, key) {
173
- return (tslib_1.__assign({}, result, (_a = {}, _a[key] = _this[key], _a)));
174
- var _a;
175
- }, {});
99
+ const descriptors = protos.reduce((result, proto) => [
100
+ ...result,
101
+ ...Object.keys(proto)
102
+ .map(key => [key, Object.getOwnPropertyDescriptor(proto, key)])
103
+ ], []);
104
+ const base = Object.keys(this).concat('id')
105
+ .filter(k => !k.startsWith('_'))
106
+ .filter(k => !skipEmpty || !(this[k] === undefined || this[k] === null))
107
+ .reduce((result, key) => ({ ...result, [key]: this[key] }), {});
176
108
  return descriptors
177
- .reduce(function (result, _a) {
178
- var key = _a[0], desc = _a[1];
179
- var hasGetter = desc && typeof desc.get === 'function';
109
+ .reduce((result, [key, desc]) => {
110
+ const hasGetter = desc && typeof desc.get === 'function';
180
111
  if (hasGetter) {
181
- result[key] = desc.get.call(_this);
112
+ result[key] = desc.get.call(this);
182
113
  }
183
114
  if (skipEmpty && (result[key] === undefined || result[key] === null)) {
184
115
  delete result[key];
@@ -188,38 +119,28 @@ var ConvectorModel = (function () {
188
119
  }
189
120
  return result;
190
121
  }, base);
191
- };
192
- ConvectorModel.prototype.delete = function (storageOptions) {
193
- return tslib_1.__awaiter(this, void 0, void 0, function () {
194
- return tslib_1.__generator(this, function (_a) {
195
- switch (_a.label) {
196
- case 0: return [4, convector_core_storage_1.BaseStorage.current.delete(this.id, storageOptions)];
197
- case 1:
198
- _a.sent();
199
- return [2];
200
- }
201
- });
202
- });
203
- };
204
- ConvectorModel.prototype.assign = function (content, defaults) {
205
- if (defaults === void 0) { defaults = false; }
206
- var validated = ['id', 'type'].concat(validate_decorator_2.getValidatedProperties(this));
207
- var filteredContent = Object.keys(content)
208
- .map(function (key) { return key.replace(/^_/, ''); })
209
- .filter(function (key) { return validated.indexOf(key) >= 0; })
210
- .reduce(function (result, key) {
211
- return (tslib_1.__assign({}, result, (_a = {}, _a[key] = content[key] !== undefined ? content[key] : content['_' + key], _a)));
212
- var _a;
213
- }, {});
214
- var afterDefaults = defaults ? this.toJSON(true) : {};
122
+ }
123
+ async delete(storageOptions) {
124
+ await convector_core_storage_1.BaseStorage.current.delete(this.id, storageOptions);
125
+ }
126
+ assign(content, defaults = false) {
127
+ const validated = ['id', 'type', ...(0, validate_decorator_2.getValidatedProperties)(this)];
128
+ const filteredContent = Object.keys(content)
129
+ .map(key => key.replace(/^_/, ''))
130
+ .filter(key => validated.indexOf(key) >= 0)
131
+ .reduce((result, key) => ({
132
+ ...result,
133
+ [key]: content[key] !== undefined ? content[key] : content['_' + key]
134
+ }), {});
135
+ const afterDefaults = defaults ? this.toJSON(true) : {};
215
136
  Object.assign(this, filteredContent, afterDefaults);
216
- };
217
- ConvectorModel.type = 'io.convector.model';
218
- tslib_1.__decorate([
219
- required_decorator_1.Required(),
220
- validate_decorator_1.Validate(yup.string())
221
- ], ConvectorModel.prototype, "id", void 0);
222
- return ConvectorModel;
223
- }());
137
+ }
138
+ }
224
139
  exports.ConvectorModel = ConvectorModel;
140
+ ConvectorModel.type = 'io.convector.model';
141
+ tslib_1.__decorate([
142
+ (0, required_decorator_1.Required)(),
143
+ (0, validate_decorator_1.Validate)(yup.string()),
144
+ tslib_1.__metadata("design:type", String)
145
+ ], ConvectorModel.prototype, "id", void 0);
225
146
  //# sourceMappingURL=convector-model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convector-model.js","sourceRoot":"","sources":["../../src/convector-model.ts"],"names":[],"mappings":";;;AAEA,yBAA2B;AAC3B,yEAAiE;AACjE,2EAA+D;AAE/D,gEAAqD;AACrD,8DAAuD;AACvD,gEAAqE;AACrE,gEAGmC;AAyBnC;IAyGE,wBAAY,OAAgD;QAC1D,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QAED,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC/B,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC;YAClB,OAAO;SACR;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAjHa,qBAAM,GAApB;QAGE,OAAO,GAAG,CAAC,MAAM,EA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CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;SACtE,CAAC,EAAE,EAAE,CAAC,CAAC;QAEV,MAAM,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC;;AAlQH,wCAmQC;AAlQgB,mBAAI,GAAG,oBAAoB,CAAC;AAkFpC;IAFN,IAAA,6BAAQ,GAAE;IACV,IAAA,6BAAQ,EAAC,GAAG,CAAC,MAAM,EAAE,CAAC;;0CACL"}
@@ -1,25 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- var g = require("window-or-global");
3
+ exports.getDefaults = exports.Default = exports.defaultMetadataKey = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const g = tslib_1.__importStar(require("window-or-global"));
5
6
  require("reflect-metadata");
6
7
  exports.defaultMetadataKey = g.ConvectorDefaultMetadataKey || Symbol('default');
7
8
  g.ConvectorDefaultMetadataKey = exports.defaultMetadataKey;
8
9
  function Default(defaultValue) {
9
- return function (target, key) {
10
- var defaults = Reflect.getMetadata(exports.defaultMetadataKey, target) || {};
11
- Reflect.defineMetadata(exports.defaultMetadataKey, tslib_1.__assign({}, defaults, (_a = {}, _a[key] = defaultValue, _a)), target);
12
- var _a;
10
+ return (target, key) => {
11
+ const defaults = Reflect.getMetadata(exports.defaultMetadataKey, target) || {};
12
+ Reflect.defineMetadata(exports.defaultMetadataKey, {
13
+ ...defaults,
14
+ [key]: defaultValue
15
+ }, target);
13
16
  };
14
17
  }
15
18
  exports.Default = Default;
16
19
  function getDefaults(obj) {
17
- var defaults = Reflect.getMetadata(exports.defaultMetadataKey, obj);
20
+ const defaults = Reflect.getMetadata(exports.defaultMetadataKey, obj);
18
21
  return !defaults ? {} : Object.keys(defaults)
19
- .reduce(function (result, k) {
20
- return (tslib_1.__assign({}, result, (_a = {}, _a[k] = typeof defaults[k] === 'function' ? defaults[k]() : defaults[k], _a)));
21
- var _a;
22
- }, {});
22
+ .reduce((result, k) => ({
23
+ ...result,
24
+ [k]: typeof defaults[k] === 'function' ? defaults[k]() : defaults[k]
25
+ }), {});
23
26
  }
24
27
  exports.getDefaults = getDefaults;
25
28
  //# sourceMappingURL=default.decorator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"default.decorator.js","sourceRoot":"","sources":["../../src/default.decorator.ts"],"names":[],"mappings":";;;AAEA,oCAAsC;AACtC,4BAA0B;AAEb,QAAA,kBAAkB,GAAG,CAAC,CAAC,2BAA2B,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;AACrF,CAAC,CAAC,2BAA2B,GAAG,0BAAkB,CAAC;AAEnD,iBAA2B,YAAe;IACxC,OAAO,UAAC,MAAW,EAAE,GAAW;QAC9B,IAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,0BAAkB,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QAEvE,OAAO,CAAC,cAAc,CAAC,0BAAkB,uBACpC,QAAQ,eACV,GAAG,IAAG,YAAY,QAClB,MAAM,CAAC,CAAC;;IACb,CAAC,CAAC;AACJ,CAAC;AATD,0BASC;AAED,qBAA4B,GAAQ;IAClC,IAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,0BAAkB,EAAE,GAAG,CAAC,CAAC;IAE9D,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;SAC1C,MAAM,CAAC,UAAC,MAAM,EAAE,CAAC;QAAK,OAAA,sBAClB,MAAM,eACR,CAAC,IAAG,OAAO,QAAQ,CAAC,CAAC,C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rE,CAAC,EAAE,EAAE,CAAC,CAAC;AACZ,CAAC;AARD,kCAQC"}
package/dist/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
3
+ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./convector-model"), exports);
5
5
  tslib_1.__exportStar(require("./default.decorator"), exports);
6
6
  tslib_1.__exportStar(require("./required.decorator"), exports);
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReadOnly = void 0;
3
4
  function ReadOnly() {
4
5
  return function (target, key) {
5
- var getSet = {
6
- get: function () {
7
- return this["_" + key];
6
+ const getSet = {
7
+ get() {
8
+ return this[`_${key}`];
8
9
  },
9
- set: function (newVal) {
10
- var setter = target.__lookupSetter__(key);
11
- setter = !setter || setter === getSet.set ? (function (v) { return v; }) : setter;
12
- this["_" + key] = this["_" + key] === undefined ?
13
- setter.call(this, newVal) : this["_" + key];
10
+ set(newVal) {
11
+ let setter = target.__lookupSetter__(key);
12
+ setter = !setter || setter === getSet.set ? (v => v) : setter;
13
+ this[`_${key}`] = this[`_${key}`] === undefined ?
14
+ setter.call(this, newVal) : this[`_${key}`];
14
15
  },
15
16
  enumerable: true,
16
17
  configurable: true
@@ -1 +1 @@
1
- {"version":3,"file":"read-only.decorator.js","sourceRoot":"","sources":["../../src/read-only.decorator.ts"],"names":[],"mappings":";;AAGA;IACE,OAAO,UACL,MAAW,EACX,GAAW;QAEX,IAAM,MAAM,GAAG;YACb,GAAG;gBACD,OAAO,IAAI,CAAC,MAAI,GAAK,CAAC,CAAC;YACzB,CAAC;YACD,GAAG,YAAC,MAAM;gBACR,IAAI,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;gBAC1C,MAAM,GAAG,CAAC,MAAM,IAAI,MAAM,KAAK,MAAM,CAAC,GAAG,CAAC,CA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AAE,IAAI;YAChB,YAAY,EAAE,IAAI;SACnB,CAAC;QAEF,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC;AAtBD,4BAsBC"}
@@ -1,30 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- var g = require("window-or-global");
3
+ exports.ensureRequired = exports.Required = exports.requiredMetadataKey = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const g = tslib_1.__importStar(require("window-or-global"));
5
6
  require("reflect-metadata");
6
7
  exports.requiredMetadataKey = g.ConvectorRequiredMetadataKey || Symbol('required');
7
8
  g.ConvectorRequiredMetadataKey = exports.requiredMetadataKey;
8
9
  function Required() {
9
- return function (target, key) {
10
- var required = Reflect.getMetadata(exports.requiredMetadataKey, target);
11
- Reflect.defineMetadata(exports.requiredMetadataKey, tslib_1.__assign({}, required, (_a = {}, _a[key] = true, _a)), target);
12
- var _a;
10
+ return (target, key) => {
11
+ const required = Reflect.getMetadata(exports.requiredMetadataKey, target);
12
+ Reflect.defineMetadata(exports.requiredMetadataKey, {
13
+ ...required,
14
+ [key]: true
15
+ }, target);
13
16
  };
14
17
  }
15
18
  exports.Required = Required;
16
19
  function ensureRequired(obj) {
17
- var required = {};
20
+ let required = {};
18
21
  try {
19
22
  required = Reflect.getMetadata(exports.requiredMetadataKey, obj) || {};
20
23
  }
21
24
  catch (e) {
22
25
  }
23
26
  return Object.keys(required)
24
- .every(function (k) {
25
- var res = !required[k] || obj[k] !== undefined;
27
+ .every(k => {
28
+ let res = !required[k] || obj[k] !== undefined;
26
29
  if (!res) {
27
- console.log("Validation error. Field " + k + " is required but was not found.");
30
+ console.log(`Validation error. Field ${k} is required but was not found.`);
28
31
  }
29
32
  return res;
30
33
  });
@@ -1 +1 @@
1
- {"version":3,"file":"required.decorator.js","sourceRoot":"","sources":["../../src/required.decorator.ts"],"names":[],"mappings":";;;AAEA,oCAAsC;AACtC,4BAA0B;AAEb,QAAA,mBAAmB,GAAG,CAAC,CAAC,4BAA4B,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC;AACxF,CAAC,CAAC,4BAA4B,GAAG,2BAAmB,CAAC;AAErD;IACE,OAAO,UAAC,MAAW,EAAE,GAAW;QAC9B,IAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,2BAAmB,EAAE,MAAM,CAAC,CAAC;QAElE,OAAO,CAAC,cAAc,CAAC,2BAAmB,uBACrC,QAAQ,eACV,GAAG,IAAG,IAAI,QACV,MAAM,CAAC,CAAC;;IACb,CAAC,CAAC;AACJ,CAAC;AATD,4BASC;AAED,wBAA+B,GAAQ;IACrC,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,IAAI;QACF,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,2BAAmB,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;KAChE;IAAC,OAAO,CAAC,EAAE;KAEX;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;SACzB,KAAK,CAAC,UAAA,CAAC;QACN,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;QAC/C,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,CAAC,GAAG,CAAC,6BAA2B,CAAC,oCAAiC,CAAC,CAAC;SAC5E;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACP,CAAC;AAjBD,wCAiBC"}
1
+ {"version":3,"file":"required.decorator.js","sourceRoot":"","sources":["../../src/required.decorator.ts"],"names":[],"mappings":";;;;AAEA,4DAAsC;AACtC,4BAA0B;AAEb,QAAA,mBAAmB,GAAG,CAAC,CAAC,4BAA4B,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC;AACxF,CAAC,CAAC,4BAA4B,GAAG,2BAAmB,CAAC;AAErD,SAAgB,QAAQ;IACtB,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,EAAE;QAClC,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,2BAAmB,EAAE,MAAM,CAAC,CAAC;QAElE,OAAO,CAAC,cAAc,CAAC,2BAAmB,EAAE;YAC1C,GAAG,QAAQ;YACX,CAAC,GAAG,CAAC,EAAE,IAAI;SACZ,EAAE,MAAM,CAAC,CAAC;IACb,CAAC,CAAC;AACJ,CAAC;AATD,4BASC;AAED,SAAgB,cAAc,CAAC,GAAQ;IACrC,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,IAAI,CAAC;QACH,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,2BAAmB,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;IAEb,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;SACzB,KAAK,CAAC,CAAC,CAAC,EAAE;QACT,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;QAC/C,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,iCAAiC,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACP,CAAC;AAjBD,wCAiBC"}
@@ -1,28 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- var g = require("window-or-global");
3
+ exports.getValidatedProperties = exports.getPropertiesValidation = exports.Validate = exports.validateMetadataKey = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const g = tslib_1.__importStar(require("window-or-global"));
5
6
  require("reflect-metadata");
6
7
  exports.validateMetadataKey = g.ConvectorValidateMetadataKey || Symbol('validate');
7
8
  g.ConvectorValidateMetadataKey = exports.validateMetadataKey;
8
9
  function Validate(input) {
9
- var schema = input;
10
+ let schema = input;
10
11
  if ('schema' in input) {
11
12
  schema = input.schema();
12
13
  }
13
- return function (target, key) {
14
- var getSet = {
15
- get: function () {
16
- return this["_" + key];
14
+ return (target, key) => {
15
+ const getSet = {
16
+ get() {
17
+ return this[`_${key}`];
17
18
  },
18
- set: function (newVal) {
19
- var setter = target.__lookupSetter__(key);
20
- setter = !setter || setter === getSet.set ? (function (v) { return v; }) : setter;
19
+ set(newVal) {
20
+ let setter = target.__lookupSetter__(key);
21
+ setter = !setter || setter === getSet.set ? (v => v) : setter;
21
22
  try {
22
- this["_" + key] = schema.validateSync(setter.call(this, newVal));
23
+ this[`_${key}`] = schema.validateSync(setter.call(this, newVal));
23
24
  }
24
25
  catch (ex) {
25
- ex.message = "Error for field '" + key + "' with val '" + JSON.stringify(newVal) + "' " + ex.message;
26
+ ex.message = `Error for field '${key}' with val '${JSON.stringify(newVal)}' ${ex.message}`;
26
27
  throw ex;
27
28
  }
28
29
  },
@@ -30,14 +31,16 @@ function Validate(input) {
30
31
  configurable: true
31
32
  };
32
33
  Object.defineProperty(target, key, getSet);
33
- var validated = Reflect.getMetadata(exports.validateMetadataKey, target);
34
- Reflect.defineMetadata(exports.validateMetadataKey, tslib_1.__assign({}, validated, (_a = {}, _a[key] = schema, _a)), target);
35
- var _a;
34
+ const validated = Reflect.getMetadata(exports.validateMetadataKey, target);
35
+ Reflect.defineMetadata(exports.validateMetadataKey, {
36
+ ...validated,
37
+ [key]: schema
38
+ }, target);
36
39
  };
37
40
  }
38
41
  exports.Validate = Validate;
39
42
  function getPropertiesValidation(obj) {
40
- var validated = {};
43
+ let validated = {};
41
44
  try {
42
45
  validated = Reflect.getMetadata(exports.validateMetadataKey, obj) || {};
43
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validate.decorator.js","sourceRoot":"","sources":["../../src/validate.decorator.ts"],"names":[],"mappings":";;;AAIA,oCAAsC;AACtC,4BAA0B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AAC;AAFD,wDAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apex-pub/convector-core-model",
3
- "version": "1.5.0",
3
+ "version": "2.0.0",
4
4
  "description": "Convector Model base class",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -34,7 +34,6 @@
34
34
  "clean:docs": "rimraf docs",
35
35
  "build": "npm run clean && tsc",
36
36
  "watch": "npm-scripts-watcher",
37
- "prepare": "npm run build",
38
37
  "lint": "tslint --fix -c '../../tslint.json' -p './tsconfig.json'",
39
38
  "test": "mocha -r ts-node/register tests/**/*.spec.ts --reporter spec",
40
39
  "predocs:generate": "npm run clean:docs",
@@ -50,21 +49,22 @@
50
49
  "reflect-metadata": ">=0.1.12"
51
50
  },
52
51
  "dependencies": {
53
- "@apex-pub/convector-core-errors": "^1.5.0",
54
- "@apex-pub/convector-core-storage": "^1.5.0",
52
+ "@apex-pub/convector-core-errors": "^2.0.0",
53
+ "@apex-pub/convector-core-storage": "^2.0.0",
55
54
  "tslib": "^1.9.0",
56
55
  "window-or-global": "^1.0.1",
57
56
  "yup": "^0.26.10"
58
57
  },
59
58
  "devDependencies": {
60
59
  "http-server": "^0.11.1",
61
- "mocha": "^5.0.3",
60
+ "mocha": "^10.8.2",
62
61
  "npm-scripts-watcher": "^1.0.2",
63
62
  "reflect-metadata": "^0.1.12",
64
63
  "rimraf": "^2.6.2",
65
- "ts-node": "^6.0.3",
66
- "tslint": "^5.9.1",
64
+ "ts-node": "^10.9.2",
65
+ "tslint": "^6.1.3",
67
66
  "typedoc": "^0.11.1",
68
- "typescript": "2.8.3"
69
- }
67
+ "typescript": "5.4.5"
68
+ },
69
+ "gitHead": "14214eba330c45c52fb0e80401ab38ed2ffa2239"
70
70
  }
package/CHANGELOG.md DELETED
@@ -1,36 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- <a name="1.5.0"></a>
7
- # 1.5.0 (2024-07-29)
8
-
9
-
10
- ### Bug Fixes
11
-
12
- * add semver package and enforceType validation ([96489cb](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/96489cb))
13
- * error handlers for testing and chaincode ([ef9bae6](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/ef9bae6))
14
- * fix conditional for enforceType ([f9e1105](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/f9e1105))
15
- * fix getOne conditional ([b1b143b](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/b1b143b))
16
- * **core-model:** Validate to accept convector moddels ([6efb592](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/6efb592)), closes [#45](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/issues/45)
17
- * **core-model,core-controller:** convector model to accept yup.lazy ([c7e67ed](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/c7e67ed)), closes [#50](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/issues/50)
18
- * flat-convector-model with optional props ([57ce2bb](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/57ce2bb))
19
- * getOne error when not found by id ([be2c099](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/be2c099))
20
- * handle global on browser environments ([44fcd22](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/44fcd22))
21
- * modify getone type validation ([6a21087](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/6a21087))
22
- * update access public to the packages (pull request [#27](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/issues/27)) ([f2eebde](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/f2eebde))
23
-
24
-
25
- ### Features
26
-
27
- * Add documentation (pull request [#28](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/issues/28)) ([fc8ddbc](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/fc8ddbc))
28
- * clean up dependencies to be front-end enabled (pull request [#46](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/issues/46)) ([fa1ee0a](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/fa1ee0a))
29
- * **core-model:** Add inheritance to convector models ([077f1ec](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/077f1ec)), closes [#43](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/issues/43)
30
- * enhance errors from yup to be more descriptive ([bcac669](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/bcac669))
31
- * group packages and update package.json's ([3971b44](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/3971b44))
32
- * Preparing versions for stable release (pull request [#25](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/issues/25)) ([1f5a876](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/1f5a876))
33
- * Production readiness (pull request [#48](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/issues/48)) ([5bb7287](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/5bb7287))
34
- * refactor convector client implementation and add browser support ([30ec673](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/30ec673))
35
- * Rename logically (pull request [#21](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/issues/21)) ([d1a78ad](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/d1a78ad))
36
- * transient and private data features ([3fa0442](https://github.com/hyperledger-labs/convector/tree/develop/%40worldsibu/convector-core-model/commit/3fa0442))