owservable 0.8.39 → 0.8.41
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.
- package/lib/_enums/store.type.enum.d.ts +6 -6
- package/lib/_enums/store.type.enum.js +9 -9
- package/lib/_types/connection.manager.refresh.type.d.ts +9 -9
- package/lib/_types/connection.manager.refresh.type.js +2 -2
- package/lib/_types/cronjob.type.d.ts +7 -7
- package/lib/_types/cronjob.type.js +2 -2
- package/lib/_types/store.scope.type.d.ts +2 -2
- package/lib/_types/store.scope.type.js +2 -2
- package/lib/_types/store.subscription.config.type.d.ts +15 -15
- package/lib/_types/store.subscription.config.type.js +2 -2
- package/lib/_types/store.subscription.update.type.d.ts +9 -9
- package/lib/_types/store.subscription.update.type.js +2 -2
- package/lib/_types/subscription.methods.type.d.ts +6 -6
- package/lib/_types/subscription.methods.type.js +2 -2
- package/lib/_types/watcher.type.d.ts +6 -5
- package/lib/_types/watcher.type.js +2 -2
- package/lib/_types/worker.type.d.ts +5 -5
- package/lib/_types/worker.type.js +2 -2
- package/lib/auth/i.connection.manager.d.ts +9 -9
- package/lib/auth/i.connection.manager.js +2 -2
- package/lib/functions/action/add.action.cronjobs.d.ts +1 -1
- package/lib/functions/action/add.action.cronjobs.js +25 -25
- package/lib/functions/action/add.action.watchers.d.ts +1 -1
- package/lib/functions/action/add.action.watchers.js +22 -22
- package/lib/functions/action/add.action.workers.d.ts +1 -1
- package/lib/functions/action/add.action.workers.js +22 -22
- package/lib/functions/execute/execute.cronjob.d.ts +3 -3
- package/lib/functions/execute/execute.cronjob.js +12 -12
- package/lib/functions/execute/execute.on.files.recursively.d.ts +2 -2
- package/lib/functions/execute/execute.on.files.recursively.js +17 -17
- package/lib/functions/execute/execute.processes.in.folder.d.ts +2 -2
- package/lib/functions/execute/execute.processes.in.folder.js +10 -10
- package/lib/functions/execute/execute.watcher.d.ts +3 -3
- package/lib/functions/execute/execute.watcher.js +16 -11
- package/lib/functions/execute/execute.watcher.js.map +1 -1
- package/lib/functions/execute/execute.worker.d.ts +3 -3
- package/lib/functions/execute/execute.worker.js +11 -11
- package/lib/functions/initiate.cronjobs.d.ts +2 -2
- package/lib/functions/initiate.cronjobs.js +8 -8
- package/lib/functions/initiate.watchers.d.ts +2 -2
- package/lib/functions/initiate.watchers.js +8 -8
- package/lib/functions/initiate.workers.d.ts +2 -2
- package/lib/functions/initiate.workers.js +8 -8
- package/lib/middleware/data.middleware.map.d.ts +7 -7
- package/lib/middleware/data.middleware.map.js +18 -18
- package/lib/middleware/data.middleware.map.js.map +1 -1
- package/lib/mongodb/collections.models.map.d.ts +8 -8
- package/lib/mongodb/collections.models.map.js +22 -22
- package/lib/mongodb/collections.models.map.js.map +1 -1
- package/lib/mongodb/functions/index/add.both.indices.to.attributes.d.ts +3 -3
- package/lib/mongodb/functions/index/add.both.indices.to.attributes.js +8 -8
- package/lib/mongodb/functions/index/add.down.indices.to.attributes.d.ts +3 -3
- package/lib/mongodb/functions/index/add.down.indices.to.attributes.js +5 -5
- package/lib/mongodb/functions/index/add.index.to.attributes.d.ts +3 -3
- package/lib/mongodb/functions/index/add.index.to.attributes.js +11 -11
- package/lib/mongodb/functions/index/add.up.and.down.indices.to.attributes.d.ts +3 -3
- package/lib/mongodb/functions/index/add.up.and.down.indices.to.attributes.js +9 -9
- package/lib/mongodb/functions/index/add.up.indices.to.attributes.d.ts +3 -3
- package/lib/mongodb/functions/index/add.up.indices.to.attributes.js +5 -5
- package/lib/mongodb/functions/observable.database.d.ts +3 -3
- package/lib/mongodb/functions/observable.database.js +22 -22
- package/lib/mongodb/functions/observable.model.d.ts +4 -4
- package/lib/mongodb/functions/observable.model.js +41 -41
- package/lib/mongodb/functions/process.models.d.ts +2 -2
- package/lib/mongodb/functions/process.models.js +40 -40
- package/lib/mongodb/mongodb.connector.d.ts +7 -7
- package/lib/mongodb/mongodb.connector.js +51 -51
- package/lib/owservable.client.d.ts +23 -23
- package/lib/owservable.client.js +162 -162
- package/lib/owservable.d.ts +41 -41
- package/lib/owservable.js +63 -63
- package/lib/store/a.store.d.ts +37 -37
- package/lib/store/a.store.js +126 -126
- package/lib/store/collection.store.d.ts +8 -8
- package/lib/store/collection.store.js +111 -112
- package/lib/store/collection.store.js.map +1 -1
- package/lib/store/count.store.d.ts +7 -7
- package/lib/store/count.store.js +46 -46
- package/lib/store/document.store.d.ts +12 -12
- package/lib/store/document.store.js +134 -135
- package/lib/store/document.store.js.map +1 -1
- package/lib/store/factories/store.factory.d.ts +4 -4
- package/lib/store/factories/store.factory.js +15 -15
- package/package.json +8 -8
|
@@ -1,136 +1,135 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const sift_1 = require("sift");
|
|
13
|
-
const _ = require("lodash");
|
|
14
|
-
const rxjs_1 = require("rxjs");
|
|
15
|
-
const operators_1 = require("rxjs/operators");
|
|
16
|
-
const a_store_1 = require("./a.store");
|
|
17
|
-
const store_type_enum_1 = require("../_enums/store.type.enum");
|
|
18
|
-
const observable_model_1 = require("../mongodb/functions/observable.model");
|
|
19
|
-
const _getIdFromQuery = (query) => (_.isString(query) ? query : _.get(query, '_id', '').toString());
|
|
20
|
-
class DocumentStore extends a_store_1.default {
|
|
21
|
-
constructor(model, target) {
|
|
22
|
-
super(model, target);
|
|
23
|
-
this._type = store_type_enum_1.default.DOCUMENT;
|
|
24
|
-
Object.setPrototypeOf(this, DocumentStore.prototype);
|
|
25
|
-
}
|
|
26
|
-
extractFromConfig() {
|
|
27
|
-
super.extractFromConfig();
|
|
28
|
-
const { skip = 0 } = this._config;
|
|
29
|
-
this._paging = skip ? {} : { skip, limit: 1 };
|
|
30
|
-
}
|
|
31
|
-
restartSubscription() {
|
|
32
|
-
this.subscription = (0, observable_model_1.default)(this.model)
|
|
33
|
-
.pipe((0, operators_1.throttleTime)(this._delay, rxjs_1.asyncScheduler, { leading: true, trailing: true }))
|
|
34
|
-
.pipe((0, operators_1.filter)((change) => this._pipeFilter(change)))
|
|
35
|
-
.subscribe({
|
|
36
|
-
next: (change) => this.load(change)
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
shouldReload(change) {
|
|
40
|
-
if (this.isInitialSubscription(change))
|
|
41
|
-
return true;
|
|
42
|
-
const id = _getIdFromQuery(this._query);
|
|
43
|
-
const { operationType: type, documentKey, updateDescription: description } = change;
|
|
44
|
-
const key = _.get(documentKey, '_id', '').toString();
|
|
45
|
-
switch (type) {
|
|
46
|
-
case 'delete':
|
|
47
|
-
return true;
|
|
48
|
-
case 'insert':
|
|
49
|
-
return !id;
|
|
50
|
-
case 'replace':
|
|
51
|
-
case 'update':
|
|
52
|
-
if (id && id === key)
|
|
53
|
-
return true;
|
|
54
|
-
if (!description)
|
|
55
|
-
return true;
|
|
56
|
-
if (!this.shouldConsiderFields())
|
|
57
|
-
return true;
|
|
58
|
-
const { updatedFields, removedFields } = description;
|
|
59
|
-
const us = _.concat(removedFields, _.keys(updatedFields));
|
|
60
|
-
const qs = _.keys(this._fields);
|
|
61
|
-
return !_.isEmpty(_.intersection(qs, us));
|
|
62
|
-
}
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
load(change) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
if (_.isEmpty(this._config))
|
|
68
|
-
return this.emitOne();
|
|
69
|
-
if (!this.shouldReload(change))
|
|
70
|
-
return;
|
|
71
|
-
const id = _getIdFromQuery(this._query);
|
|
72
|
-
const { operationType: type, documentKey } = change;
|
|
73
|
-
const key = _.get(documentKey, '_id', '').toString();
|
|
74
|
-
if (type === 'delete' && id === key)
|
|
75
|
-
return this.emitDelete(key);
|
|
76
|
-
try {
|
|
77
|
-
let data;
|
|
78
|
-
if (!_.isEmpty(this._sort))
|
|
79
|
-
data = yield this._loadSortedFirstDocument();
|
|
80
|
-
else
|
|
81
|
-
data = id ? yield this._loadDocumentById(id) : yield this._loadDocument();
|
|
82
|
-
if (!data)
|
|
83
|
-
return this.emitOne();
|
|
84
|
-
for (const populate of this._populates) {
|
|
85
|
-
if (data === null || data === void 0 ? void 0 : data.populate)
|
|
86
|
-
yield data.populate(populate).execPopulate();
|
|
87
|
-
}
|
|
88
|
-
if (_.isEmpty(this._virtuals))
|
|
89
|
-
return this.emitOne(data.toJSON());
|
|
90
|
-
const jsonData = _.cloneDeep(_.omit(data.toJSON(), this._virtuals));
|
|
91
|
-
for (const virtual of this._virtuals) {
|
|
92
|
-
jsonData[virtual] = yield Promise.resolve(data[virtual]);
|
|
93
|
-
}
|
|
94
|
-
this.emitOne(jsonData);
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
this.emitError(error);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
_pipeFilter(change) {
|
|
102
|
-
if (!_.isEmpty(this._sort))
|
|
103
|
-
return true;
|
|
104
|
-
const { operationType: type } = change;
|
|
105
|
-
if ('delete' === type)
|
|
106
|
-
return true;
|
|
107
|
-
const { documentKey, fullDocument: document } = change;
|
|
108
|
-
const key = _.get(documentKey, '_id', '').toString();
|
|
109
|
-
if (key === _getIdFromQuery(this._query))
|
|
110
|
-
return true;
|
|
111
|
-
const test = (0, sift_1.default)(_.omit(this._query, ['createdAt', 'updatedAt']));
|
|
112
|
-
return test(document);
|
|
113
|
-
}
|
|
114
|
-
_loadDocumentById(id) {
|
|
115
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
return this._model.findById(id, this._fields);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
_loadSortedFirstDocument() {
|
|
120
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
const docs = yield this._model
|
|
122
|
-
.find(this._query, this._fields, this._paging)
|
|
123
|
-
.
|
|
124
|
-
.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
exports.default = DocumentStore;
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const sift_1 = require("sift");
|
|
13
|
+
const _ = require("lodash");
|
|
14
|
+
const rxjs_1 = require("rxjs");
|
|
15
|
+
const operators_1 = require("rxjs/operators");
|
|
16
|
+
const a_store_1 = require("./a.store");
|
|
17
|
+
const store_type_enum_1 = require("../_enums/store.type.enum");
|
|
18
|
+
const observable_model_1 = require("../mongodb/functions/observable.model");
|
|
19
|
+
const _getIdFromQuery = (query) => (_.isString(query) ? query : _.get(query, '_id', '').toString());
|
|
20
|
+
class DocumentStore extends a_store_1.default {
|
|
21
|
+
constructor(model, target) {
|
|
22
|
+
super(model, target);
|
|
23
|
+
this._type = store_type_enum_1.default.DOCUMENT;
|
|
24
|
+
Object.setPrototypeOf(this, DocumentStore.prototype);
|
|
25
|
+
}
|
|
26
|
+
extractFromConfig() {
|
|
27
|
+
super.extractFromConfig();
|
|
28
|
+
const { skip = 0 } = this._config;
|
|
29
|
+
this._paging = skip ? {} : { skip, limit: 1 };
|
|
30
|
+
}
|
|
31
|
+
restartSubscription() {
|
|
32
|
+
this.subscription = (0, observable_model_1.default)(this.model)
|
|
33
|
+
.pipe((0, operators_1.throttleTime)(this._delay, rxjs_1.asyncScheduler, { leading: true, trailing: true }))
|
|
34
|
+
.pipe((0, operators_1.filter)((change) => this._pipeFilter(change)))
|
|
35
|
+
.subscribe({
|
|
36
|
+
next: (change) => this.load(change)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
shouldReload(change) {
|
|
40
|
+
if (this.isInitialSubscription(change))
|
|
41
|
+
return true;
|
|
42
|
+
const id = _getIdFromQuery(this._query);
|
|
43
|
+
const { operationType: type, documentKey, updateDescription: description } = change;
|
|
44
|
+
const key = _.get(documentKey, '_id', '').toString();
|
|
45
|
+
switch (type) {
|
|
46
|
+
case 'delete':
|
|
47
|
+
return true;
|
|
48
|
+
case 'insert':
|
|
49
|
+
return !id;
|
|
50
|
+
case 'replace':
|
|
51
|
+
case 'update':
|
|
52
|
+
if (id && id === key)
|
|
53
|
+
return true;
|
|
54
|
+
if (!description)
|
|
55
|
+
return true;
|
|
56
|
+
if (!this.shouldConsiderFields())
|
|
57
|
+
return true;
|
|
58
|
+
const { updatedFields, removedFields } = description;
|
|
59
|
+
const us = _.concat(removedFields, _.keys(updatedFields));
|
|
60
|
+
const qs = _.keys(this._fields);
|
|
61
|
+
return !_.isEmpty(_.intersection(qs, us));
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
load(change) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
if (_.isEmpty(this._config))
|
|
68
|
+
return this.emitOne();
|
|
69
|
+
if (!this.shouldReload(change))
|
|
70
|
+
return;
|
|
71
|
+
const id = _getIdFromQuery(this._query);
|
|
72
|
+
const { operationType: type, documentKey } = change;
|
|
73
|
+
const key = _.get(documentKey, '_id', '').toString();
|
|
74
|
+
if (type === 'delete' && id === key)
|
|
75
|
+
return this.emitDelete(key);
|
|
76
|
+
try {
|
|
77
|
+
let data;
|
|
78
|
+
if (!_.isEmpty(this._sort))
|
|
79
|
+
data = yield this._loadSortedFirstDocument();
|
|
80
|
+
else
|
|
81
|
+
data = id ? yield this._loadDocumentById(id) : yield this._loadDocument();
|
|
82
|
+
if (!data)
|
|
83
|
+
return this.emitOne();
|
|
84
|
+
for (const populate of this._populates) {
|
|
85
|
+
if (data === null || data === void 0 ? void 0 : data.populate)
|
|
86
|
+
yield data.populate(populate).execPopulate();
|
|
87
|
+
}
|
|
88
|
+
if (_.isEmpty(this._virtuals))
|
|
89
|
+
return this.emitOne(data.toJSON());
|
|
90
|
+
const jsonData = _.cloneDeep(_.omit(data.toJSON(), this._virtuals));
|
|
91
|
+
for (const virtual of this._virtuals) {
|
|
92
|
+
jsonData[virtual] = yield Promise.resolve(data[virtual]);
|
|
93
|
+
}
|
|
94
|
+
this.emitOne(jsonData);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
this.emitError(error);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
_pipeFilter(change) {
|
|
102
|
+
if (!_.isEmpty(this._sort))
|
|
103
|
+
return true;
|
|
104
|
+
const { operationType: type } = change;
|
|
105
|
+
if ('delete' === type)
|
|
106
|
+
return true;
|
|
107
|
+
const { documentKey, fullDocument: document } = change;
|
|
108
|
+
const key = _.get(documentKey, '_id', '').toString();
|
|
109
|
+
if (key === _getIdFromQuery(this._query))
|
|
110
|
+
return true;
|
|
111
|
+
const test = (0, sift_1.default)(_.omit(this._query, ['createdAt', 'updatedAt']));
|
|
112
|
+
return test(document);
|
|
113
|
+
}
|
|
114
|
+
_loadDocumentById(id) {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
return this._model.findById(id, this._fields);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
_loadSortedFirstDocument() {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const docs = yield this._model
|
|
122
|
+
.find(this._query, this._fields, this._paging)
|
|
123
|
+
.sort(this._sort)
|
|
124
|
+
.setOptions({ allowDiskUse: true });
|
|
125
|
+
return _.first(docs);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
_loadDocument() {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
return this._model.findOne(this._query, this._fields);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.default = DocumentStore;
|
|
136
135
|
//# sourceMappingURL=document.store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.store.js","sourceRoot":"","sources":["../../src/store/document.store.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;AAEb,+BAAwB;AACxB,4BAA4B;AAE5B,+BAAoC;AACpC,8CAAoD;AAEpD,uCAA+B;AAC/B,+DAAmD;AACnD,4EAAoE;AAIpE,MAAM,eAAe,GAAG,CAAC,KAAU,EAAU,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEjH,MAAqB,aAAc,SAAQ,iBAAM;IAChD,YAAY,KAAU,EAAE,MAAc;QACrC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,KAAK,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GAAG,MAAM,IAAI,CAAC,MAAM;iBAC5B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC;iBAE7C,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;iBAChB,UAAU,CAAC,EAAC,YAAY,EAAE,IAAI,EAAC,CAAC,CAAC;YACnC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;KAAA;IAEa,aAAa;;YAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACvD,CAAC;KAAA;CACD;AAtHD,gCAsHC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import AStore from '../a.store';
|
|
2
|
-
import StoreScopeType from '../../_types/store.scope.type';
|
|
3
|
-
declare const storeFactory: (scope: StoreScopeType, observe: string, target: string) => AStore;
|
|
4
|
-
export default storeFactory;
|
|
1
|
+
import AStore from '../a.store';
|
|
2
|
+
import StoreScopeType from '../../_types/store.scope.type';
|
|
3
|
+
declare const storeFactory: (scope: StoreScopeType, observe: string, target: string) => AStore;
|
|
4
|
+
export default storeFactory;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const count_store_1 = require("../count.store");
|
|
4
|
-
const document_store_1 = require("../document.store");
|
|
5
|
-
const collection_store_1 = require("../collection.store");
|
|
6
|
-
const collections_models_map_1 = require("../../mongodb/collections.models.map");
|
|
7
|
-
const storeFactory = (scope, observe, target) => {
|
|
8
|
-
const model = collections_models_map_1.default.getModelByCollection(observe);
|
|
9
|
-
if (scope === 'many')
|
|
10
|
-
return new collection_store_1.default(model, target);
|
|
11
|
-
if (scope === 'count')
|
|
12
|
-
return new count_store_1.default(model, target);
|
|
13
|
-
return new document_store_1.default(model, target);
|
|
14
|
-
};
|
|
15
|
-
exports.default = storeFactory;
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const count_store_1 = require("../count.store");
|
|
4
|
+
const document_store_1 = require("../document.store");
|
|
5
|
+
const collection_store_1 = require("../collection.store");
|
|
6
|
+
const collections_models_map_1 = require("../../mongodb/collections.models.map");
|
|
7
|
+
const storeFactory = (scope, observe, target) => {
|
|
8
|
+
const model = collections_models_map_1.default.getModelByCollection(observe);
|
|
9
|
+
if (scope === 'many')
|
|
10
|
+
return new collection_store_1.default(model, target);
|
|
11
|
+
if (scope === 'count')
|
|
12
|
+
return new count_store_1.default(model, target);
|
|
13
|
+
return new document_store_1.default(model, target);
|
|
14
|
+
};
|
|
15
|
+
exports.default = storeFactory;
|
|
16
16
|
//# sourceMappingURL=store.factory.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "owservable",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.41",
|
|
4
4
|
"description": "owservable backend",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16"
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"srctree": "dir src /s /b > srctree.txt"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@owservable/actions": "^0.0
|
|
38
|
-
"@owservable/folders": "^0.0
|
|
39
|
-
"@types/lodash": "^4.14.
|
|
40
|
-
"@types/node": "^18.
|
|
37
|
+
"@owservable/actions": "^0.1.0",
|
|
38
|
+
"@owservable/folders": "^0.1.0",
|
|
39
|
+
"@types/lodash": "^4.14.192",
|
|
40
|
+
"@types/node": "^18.15.11",
|
|
41
41
|
"@types/node-cron": "^3.0.7",
|
|
42
42
|
"deprecated-decorator": "^0.1.6",
|
|
43
43
|
"jsondiffpatch": "^0.4.1",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"coveralls": "^3.0.9",
|
|
58
58
|
"mocha": "^10.2.0",
|
|
59
59
|
"nyc": "^15.1.0",
|
|
60
|
-
"prettier": "^2.8.
|
|
60
|
+
"prettier": "^2.8.7",
|
|
61
61
|
"rewire": "^6.0.0",
|
|
62
62
|
"sonarjs": "^1.0.0",
|
|
63
63
|
"source-map-support": "^0.5.21",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"tslint-config-prettier": "^1.18.0",
|
|
67
67
|
"tslint-etc": "^1.13.7",
|
|
68
68
|
"tslint-no-unused-expression-chai": "^0.1.4",
|
|
69
|
-
"typedoc": "^0.
|
|
70
|
-
"typescript": "^
|
|
69
|
+
"typedoc": "^0.24.1",
|
|
70
|
+
"typescript": "^5.0.4"
|
|
71
71
|
}
|
|
72
72
|
}
|