@docstack/client 0.0.1
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/README.md +214 -0
- package/lib/core/attribute.d.ts +174 -0
- package/lib/core/attribute.js +296 -0
- package/lib/core/attribute.js.map +1 -0
- package/lib/core/class.d.ts +340 -0
- package/lib/core/class.js +540 -0
- package/lib/core/class.js.map +1 -0
- package/lib/core/crypto-engine/index.d.ts +121 -0
- package/lib/core/crypto-engine/index.js +130 -0
- package/lib/core/crypto-engine/index.js.map +1 -0
- package/lib/core/crypto-engine/utils.d.ts +20 -0
- package/lib/core/crypto-engine/utils.js +76 -0
- package/lib/core/crypto-engine/utils.js.map +1 -0
- package/lib/core/datamodel/index.d.ts +3 -0
- package/lib/core/datamodel/index.js +1186 -0
- package/lib/core/datamodel/index.js.map +1 -0
- package/lib/core/domain.d.ts +200 -0
- package/lib/core/domain.js +285 -0
- package/lib/core/domain.js.map +1 -0
- package/lib/core/index.d.ts +176 -0
- package/lib/core/index.js +379 -0
- package/lib/core/index.js.map +1 -0
- package/lib/core/job-engine/index.d.ts +110 -0
- package/lib/core/job-engine/index.js +116 -0
- package/lib/core/job-engine/index.js.map +1 -0
- package/lib/core/policy-engine/index.d.ts +97 -0
- package/lib/core/policy-engine/index.js +150 -0
- package/lib/core/policy-engine/index.js.map +1 -0
- package/lib/core/query-engine/accumulators.d.ts +9 -0
- package/lib/core/query-engine/accumulators.js +258 -0
- package/lib/core/query-engine/accumulators.js.map +1 -0
- package/lib/core/query-engine/evaluator.d.ts +37 -0
- package/lib/core/query-engine/evaluator.js +179 -0
- package/lib/core/query-engine/evaluator.js.map +1 -0
- package/lib/core/query-engine/executor.d.ts +14 -0
- package/lib/core/query-engine/executor.js +405 -0
- package/lib/core/query-engine/executor.js.map +1 -0
- package/lib/core/query-engine/index.d.ts +4 -0
- package/lib/core/query-engine/index.js +4 -0
- package/lib/core/query-engine/index.js.map +1 -0
- package/lib/core/query-engine/parser.d.ts +10 -0
- package/lib/core/query-engine/parser.js +515 -0
- package/lib/core/query-engine/parser.js.map +1 -0
- package/lib/core/query-engine/planner.d.ts +27 -0
- package/lib/core/query-engine/planner.js +330 -0
- package/lib/core/query-engine/planner.js.map +1 -0
- package/lib/core/stack.d.ts +497 -0
- package/lib/core/stack.js +1507 -0
- package/lib/core/stack.js.map +1 -0
- package/lib/core/test-utils/docstack.d.ts +29 -0
- package/lib/core/test-utils/docstack.js +222 -0
- package/lib/core/test-utils/docstack.js.map +1 -0
- package/lib/core/trigger/index.d.ts +31 -0
- package/lib/core/trigger/index.js +81 -0
- package/lib/core/trigger/index.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +8237 -0
- package/lib/index.js.map +1 -0
- package/lib/plugins/pouchdb.d.ts +9 -0
- package/lib/plugins/pouchdb.js +403 -0
- package/lib/plugins/pouchdb.js.map +1 -0
- package/lib/utils/crypto/index.d.ts +3 -0
- package/lib/utils/crypto/index.js +34 -0
- package/lib/utils/crypto/index.js.map +1 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +58 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/logger/index.d.ts +4 -0
- package/lib/utils/logger/index.js +20 -0
- package/lib/utils/logger/index.js.map +1 -0
- package/lib/utils/logger/transport.d.ts +11 -0
- package/lib/utils/logger/transport.js +28 -0
- package/lib/utils/logger/transport.js.map +1 -0
- package/lib/workers/dataModel.d.ts +1 -0
- package/lib/workers/dataModel.js +48 -0
- package/lib/workers/dataModel.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { Class as Class_ } from "@docstack/shared";
|
|
3
|
+
import createLogger from "../utils/logger/index.js";
|
|
4
|
+
import Attribute from "./attribute.js";
|
|
5
|
+
import { Trigger } from "./trigger/index.js";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import clientLogger from "../utils/logger/index.js";
|
|
8
|
+
class Class extends Class_ {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.attributes = {};
|
|
12
|
+
this.schema = {};
|
|
13
|
+
this.schemaZOD = z.object({});
|
|
14
|
+
this.state = "idle";
|
|
15
|
+
this.triggers = [];
|
|
16
|
+
// TODO: Test
|
|
17
|
+
/*
|
|
18
|
+
inheritAttributes( parentClass: Class ) {
|
|
19
|
+
let parentAttributes = parentClass.getAttributes();
|
|
20
|
+
for ( let attribute of parentAttributes ) {
|
|
21
|
+
this.addAttribute(attribute);
|
|
22
|
+
}
|
|
23
|
+
} */
|
|
24
|
+
this.build = () => {
|
|
25
|
+
return new Promise(async (resolve, reject) => {
|
|
26
|
+
let stack = this.getStack();
|
|
27
|
+
if (stack) {
|
|
28
|
+
// if (parentClassName) this.setParentClass(parentClassName);
|
|
29
|
+
let classModel = await stack.addClass(this);
|
|
30
|
+
// Hydrate model
|
|
31
|
+
if (classModel) {
|
|
32
|
+
this.setModel(classModel);
|
|
33
|
+
_a.logger.info("build - classModel", { classModel: classModel });
|
|
34
|
+
this.setId(classModel._id);
|
|
35
|
+
resolve(this);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
reject("unable to get classModel. Check logs");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
reject("Missing stack assignment");
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
this.init = (stack, id, name, type, description, schema = {}
|
|
47
|
+
// parentClass: Class | null
|
|
48
|
+
) => {
|
|
49
|
+
// this.parentClass = parentClass;
|
|
50
|
+
if (stack) {
|
|
51
|
+
this.stack = stack;
|
|
52
|
+
}
|
|
53
|
+
this.name = name;
|
|
54
|
+
this.id = id;
|
|
55
|
+
this.description = description;
|
|
56
|
+
this.type = type;
|
|
57
|
+
// this.attributes = [];
|
|
58
|
+
// this.stack = null;
|
|
59
|
+
// this.id = null;
|
|
60
|
+
// if (schema) {
|
|
61
|
+
// this.schema = schema;
|
|
62
|
+
// }
|
|
63
|
+
this.setModel({
|
|
64
|
+
"~class": type, _id: id, active: true,
|
|
65
|
+
name, description,
|
|
66
|
+
schema, triggers: [],
|
|
67
|
+
});
|
|
68
|
+
this.logger = clientLogger(stack).child({ module: "class", className: this.name });
|
|
69
|
+
// TODO: Waiting for test of method
|
|
70
|
+
// if (parentClass) this.inheritAttributes(parentClass);
|
|
71
|
+
};
|
|
72
|
+
this.uniqueCheck = async (doc) => {
|
|
73
|
+
const fnLogger = this.logger.child({ method: "uniqueCheck", args: { doc } });
|
|
74
|
+
const duplicate = await this.getByPrimaryKeys(doc);
|
|
75
|
+
if (duplicate == null || duplicate._id == doc._id) {
|
|
76
|
+
fnLogger.info("No duplicate found for doc");
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
fnLogger.info("Duplicate found for doc", { duplicate });
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
this.bulkUniqueCheck = async (pKs) => {
|
|
85
|
+
var _b;
|
|
86
|
+
const fnLogger = this.logger.child({ method: "bulkUniqueCheck", args: { pKs } });
|
|
87
|
+
const ddocId = await ((_b = this.stack) === null || _b === void 0 ? void 0 : _b.addDesignDocumentPKs(this.name, pKs, true));
|
|
88
|
+
fnLogger.info(`Created temporary design document '${ddocId}'`);
|
|
89
|
+
if (this.stack && ddocId) {
|
|
90
|
+
try {
|
|
91
|
+
const result = await this.stack.db.query(`${ddocId}/by_pKeys`, {
|
|
92
|
+
group: true,
|
|
93
|
+
reduce: '_count'
|
|
94
|
+
});
|
|
95
|
+
const hasDuplicates = result.rows.some(row => row.value > 1);
|
|
96
|
+
if (hasDuplicates) {
|
|
97
|
+
// 3a. Rollback: new schema is invalid
|
|
98
|
+
fnLogger.error('Schema change invalid: new duplicates found.');
|
|
99
|
+
const finalTempDoc = await this.stack.db.get(ddocId);
|
|
100
|
+
await this.stack.db.remove(finalTempDoc);
|
|
101
|
+
return false; // Indicate failure
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
// 3b. Execute: new schema is valid. Replace the live document.
|
|
105
|
+
fnLogger.info('Bulk unique check completed: no new duplicates found');
|
|
106
|
+
const finalTempDoc = await this.stack.db.get(ddocId);
|
|
107
|
+
// Clean up the temporary document
|
|
108
|
+
await this.stack.db.remove(finalTempDoc);
|
|
109
|
+
return true; // Indicate success
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
console.error('Error during schema validation:', err);
|
|
114
|
+
// Ensure the temporary document is removed on error
|
|
115
|
+
try {
|
|
116
|
+
const finalTempDoc = await this.stack.db.get(ddocId);
|
|
117
|
+
await this.stack.db.remove(finalTempDoc);
|
|
118
|
+
}
|
|
119
|
+
catch (e) { /* ignore */ }
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
fnLogger.error(`Was unable to create temporary design document to group by`);
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
this.validate = async (data) => {
|
|
129
|
+
const fnLogger = this.logger.child({ method: "validate" });
|
|
130
|
+
const result = await this.schemaZOD.safeParseAsync(data);
|
|
131
|
+
fnLogger.debug("Got result", { result });
|
|
132
|
+
if (result.success) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
// TODO Turn into method (after factory method instantiation refactory is done)
|
|
140
|
+
this.setId = (id) => {
|
|
141
|
+
this.id = id;
|
|
142
|
+
};
|
|
143
|
+
this.getName = () => {
|
|
144
|
+
return this.name;
|
|
145
|
+
};
|
|
146
|
+
this.getStack = () => {
|
|
147
|
+
return this.stack;
|
|
148
|
+
};
|
|
149
|
+
this.getDescription = () => {
|
|
150
|
+
return this.description;
|
|
151
|
+
};
|
|
152
|
+
this.getType = () => {
|
|
153
|
+
return this.type;
|
|
154
|
+
};
|
|
155
|
+
this.getId = () => {
|
|
156
|
+
return this.id;
|
|
157
|
+
};
|
|
158
|
+
this.buildSchema = () => {
|
|
159
|
+
let schema = {};
|
|
160
|
+
Object.entries(this.attributes).forEach(t => {
|
|
161
|
+
schema[t[0]] = t[1].model;
|
|
162
|
+
});
|
|
163
|
+
return schema;
|
|
164
|
+
};
|
|
165
|
+
this.getModel = () => {
|
|
166
|
+
let triggers = [];
|
|
167
|
+
for (const trigger of this.triggers) {
|
|
168
|
+
triggers.push(trigger.model);
|
|
169
|
+
}
|
|
170
|
+
let model = {
|
|
171
|
+
_id: this.id,
|
|
172
|
+
name: this.getName(),
|
|
173
|
+
description: this.getDescription(),
|
|
174
|
+
"~class": this.getType(),
|
|
175
|
+
schema: this.buildSchema(),
|
|
176
|
+
triggers: triggers,
|
|
177
|
+
active: true,
|
|
178
|
+
_rev: this.model ? this.model._rev : "", // [TODO] Error prone
|
|
179
|
+
"~createTimestamp": this.model ? this.model["~createTimestamp"] : undefined,
|
|
180
|
+
};
|
|
181
|
+
return model;
|
|
182
|
+
};
|
|
183
|
+
// [TODO] Change into buildFromModel
|
|
184
|
+
/**
|
|
185
|
+
* It hydrates attributes and triggers from given model
|
|
186
|
+
* @param model
|
|
187
|
+
*/
|
|
188
|
+
this.setModel = (model) => {
|
|
189
|
+
_a.logger.info("setModel - got incoming model", { model: model });
|
|
190
|
+
// Retreive current class model
|
|
191
|
+
let currentModel = this.getModel();
|
|
192
|
+
// Set model arg to the overwrite of the current model with the given one
|
|
193
|
+
model = Object.assign(currentModel, model);
|
|
194
|
+
if (model.schema) {
|
|
195
|
+
// model.schema = {...this.model.schema, ...model.schema};
|
|
196
|
+
this.attributes = {};
|
|
197
|
+
this.schemaZOD = z.object({});
|
|
198
|
+
for (const [key, attrModel] of Object.entries(model.schema)) {
|
|
199
|
+
let attribute = new Attribute(this, attrModel.name, attrModel.type, attrModel.description, attrModel.config);
|
|
200
|
+
this.attributes[attrModel.name] = attribute;
|
|
201
|
+
this.schemaZOD = this.schemaZOD.extend({
|
|
202
|
+
[attrModel.name]: attribute.field
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (model.triggers) {
|
|
207
|
+
this.triggers = [];
|
|
208
|
+
for (const trigger of model.triggers) {
|
|
209
|
+
let trigger_ = new Trigger(trigger, this);
|
|
210
|
+
this.triggers.push(trigger_);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
this.name = model.name;
|
|
214
|
+
this.description = model.description;
|
|
215
|
+
this.type = model["~class"];
|
|
216
|
+
this.model = model;
|
|
217
|
+
_a.logger.info("setModel - model after processing", { model: model });
|
|
218
|
+
};
|
|
219
|
+
this.getPrimaryKeys = () => {
|
|
220
|
+
return Object.values(this.attributes).filter(attr => attr.isPrimaryKey())
|
|
221
|
+
.map(attr => attr.getName());
|
|
222
|
+
};
|
|
223
|
+
this.getAttributes = (...names) => {
|
|
224
|
+
let attributes = {};
|
|
225
|
+
for (const attribute of Object.values(this.attributes)) {
|
|
226
|
+
if (names.length > 0) {
|
|
227
|
+
// filter with given names
|
|
228
|
+
for (let name of names) {
|
|
229
|
+
// match?
|
|
230
|
+
if (name != null && attribute.getName() == name) {
|
|
231
|
+
attributes[attribute.name] = attribute;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
// no filter provided add all
|
|
237
|
+
attributes[attribute.name] = attribute;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return attributes;
|
|
241
|
+
};
|
|
242
|
+
this.hasAllAttributes = (...names) => {
|
|
243
|
+
let result = false;
|
|
244
|
+
let attributes = this.getAttributes(...names);
|
|
245
|
+
for (let attribute of Object.values(attributes)) {
|
|
246
|
+
result = names.includes(attribute.getName());
|
|
247
|
+
if (!result)
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
251
|
+
};
|
|
252
|
+
this.hasAnyAttributes = (...names) => {
|
|
253
|
+
let result = false;
|
|
254
|
+
let attributes = this.getAttributes(...names);
|
|
255
|
+
for (let attribute of Object.values(attributes)) {
|
|
256
|
+
result = names.includes(attribute.getName());
|
|
257
|
+
if (result)
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
return result;
|
|
261
|
+
};
|
|
262
|
+
this.getEncryptedAttributes = () => {
|
|
263
|
+
return Object.values(this.attributes).filter((attribute) => {
|
|
264
|
+
const config = attribute.model.config;
|
|
265
|
+
return (config === null || config === void 0 ? void 0 : config.encrypted) === true && (config === null || config === void 0 ? void 0 : config.primaryKey) !== true;
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
// interface of hasAnyAttributes
|
|
269
|
+
this.hasAttribute = (name) => {
|
|
270
|
+
return this.hasAnyAttributes(name);
|
|
271
|
+
};
|
|
272
|
+
this.addAttribute = async (attribute) => {
|
|
273
|
+
var _b;
|
|
274
|
+
const fnLogger = this.logger.child({ method: "addAttribute", args: { attribute: attribute.name } });
|
|
275
|
+
const attribute_ = attribute instanceof Attribute
|
|
276
|
+
? attribute : new Attribute(this, attribute.name, attribute.type, attribute.description, attribute.config);
|
|
277
|
+
try {
|
|
278
|
+
let name = attribute_.getName();
|
|
279
|
+
// console.log("Adding attribute", {className: this.name, attribute: name})
|
|
280
|
+
if (!this.hasAttribute(name)) {
|
|
281
|
+
fnLogger.info("Adding attribute", { name: name, type: attribute_.getModel() });
|
|
282
|
+
this.attributes[name] = attribute_;
|
|
283
|
+
let attributeModel = attribute_.getModel();
|
|
284
|
+
fnLogger.info("Adding attribute to schema", { attributeModel: attributeModel });
|
|
285
|
+
const currentSchema = (_b = this.model.schema) !== null && _b !== void 0 ? _b : {};
|
|
286
|
+
this.model.schema = Object.assign(Object.assign({}, currentSchema), { [name]: attributeModel });
|
|
287
|
+
this.schemaZOD = this.schemaZOD.extend({
|
|
288
|
+
[name]: attribute_.field
|
|
289
|
+
});
|
|
290
|
+
// TODO:
|
|
291
|
+
// this.schema[name] = attributeModel; // sometimes getting schema undefined
|
|
292
|
+
// update class on db
|
|
293
|
+
fnLogger.info("Checking for requirements before updating class on db", { stack: (this.stack != null), id: this.id });
|
|
294
|
+
if (this.stack && this.id) {
|
|
295
|
+
// debugger;
|
|
296
|
+
fnLogger.info("Updating class on db");
|
|
297
|
+
let res = await this.stack.updateClass(this);
|
|
298
|
+
return this;
|
|
299
|
+
// TODO: Check if this class has subclasses
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
fnLogger.error("Class not updated on db because of missing stack or id");
|
|
303
|
+
return this;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
fnLogger.error("Attribute with name " + name + " already exists within this Class");
|
|
308
|
+
return this;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
catch (e) {
|
|
312
|
+
fnLogger.error("Falied adding attribute because: ", e);
|
|
313
|
+
return this;
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
this.modifyAttribute = async (name, attribute) => {
|
|
317
|
+
const fnLogger = this.logger.child({ method: "modifyAttribute", args: { name } });
|
|
318
|
+
const originSchema = Object.assign({}, this.model.schema[name]), originAttr = this.attributes[name];
|
|
319
|
+
const attribute_ = attribute instanceof Attribute
|
|
320
|
+
? attribute : new Attribute(this, attribute.name, attribute.type, attribute.description, attribute.config);
|
|
321
|
+
try {
|
|
322
|
+
fnLogger.info(`Attempting to change attribute definition.`);
|
|
323
|
+
delete this.model.schema[name];
|
|
324
|
+
delete this.attributes[name];
|
|
325
|
+
this.schemaZOD = this.schemaZOD.omit({ [name]: true });
|
|
326
|
+
return this.addAttribute(attribute_);
|
|
327
|
+
}
|
|
328
|
+
catch (e) {
|
|
329
|
+
// Revert
|
|
330
|
+
this.model.schema[name] = originSchema;
|
|
331
|
+
this.attributes[name] = originAttr;
|
|
332
|
+
fnLogger.error(`Failed at removing attribute from class.'`);
|
|
333
|
+
}
|
|
334
|
+
return this;
|
|
335
|
+
};
|
|
336
|
+
this.removeAttribute = async (name) => {
|
|
337
|
+
const fnLogger = this.logger.child({ method: "removeAttribute", args: { name } });
|
|
338
|
+
const originSchema = Object.assign({}, this.model.schema[name]), originAttr = this.attributes[name];
|
|
339
|
+
try {
|
|
340
|
+
fnLogger.info(`Attempting to remove attribute from class.`);
|
|
341
|
+
delete this.model.schema[name];
|
|
342
|
+
delete this.attributes[name];
|
|
343
|
+
this.schemaZOD = this.schemaZOD.omit({ [name]: true });
|
|
344
|
+
if (this.stack) {
|
|
345
|
+
this.stack.updateClass(this);
|
|
346
|
+
}
|
|
347
|
+
else
|
|
348
|
+
throw new Error("Missing stack, cannot perform updates.");
|
|
349
|
+
}
|
|
350
|
+
catch (e) {
|
|
351
|
+
// Revert
|
|
352
|
+
this.model.schema[name] = originSchema;
|
|
353
|
+
this.attributes[name] = originAttr;
|
|
354
|
+
fnLogger.error(`Failed at removing attribute from class.'`);
|
|
355
|
+
}
|
|
356
|
+
return this;
|
|
357
|
+
};
|
|
358
|
+
// TODO: modify to pass also the current class model
|
|
359
|
+
// consider first fetching/updating the local class model
|
|
360
|
+
this.addCard = async (params) => {
|
|
361
|
+
const fnLogger = this.logger.child({ method: "addCard", args: { params } });
|
|
362
|
+
if (!this.stack) {
|
|
363
|
+
fnLogger.error("Stack is not defined");
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
return await this.stack.createDoc(null, this.getName(), this, params);
|
|
367
|
+
};
|
|
368
|
+
this.addCards = async (paramsArray) => {
|
|
369
|
+
const fnLogger = this.logger.child({ method: "addCards", args: { paramsArray } });
|
|
370
|
+
if (!this.stack) {
|
|
371
|
+
fnLogger.error("Stack is not defined");
|
|
372
|
+
return [];
|
|
373
|
+
}
|
|
374
|
+
let addedCards = [];
|
|
375
|
+
addedCards = await this.stack.createDocs(paramsArray.map(params => ({ docId: null, params })), this.getName(), this);
|
|
376
|
+
return addedCards;
|
|
377
|
+
};
|
|
378
|
+
this.getByPrimaryKeys = async (params) => {
|
|
379
|
+
const fnLogger = this.logger.child({ method: "getByPrimaryKeys" });
|
|
380
|
+
// attempt to retrieve card by primary key
|
|
381
|
+
let filter = {};
|
|
382
|
+
let primaryKeys = this.getPrimaryKeys();
|
|
383
|
+
fnLogger.info("Got primary keys", { primaryKeys });
|
|
384
|
+
if (primaryKeys.length) {
|
|
385
|
+
// executes a reducer function on each element of the primaryKeys array
|
|
386
|
+
// that sets each primary key prop to the corresponding param value
|
|
387
|
+
primaryKeys.reduce((accumulator, currentValue) => accumulator[currentValue] = params[currentValue], filter);
|
|
388
|
+
fnLogger.info("Defined filter", { filter });
|
|
389
|
+
let cards = await this.getCards(filter, undefined, 0, 1);
|
|
390
|
+
if (cards.length > 0) {
|
|
391
|
+
return cards[0];
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
fnLogger.info("Did not find any documents with given primary key", { filter });
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
fnLogger.info("Class has no field specified as primary key");
|
|
400
|
+
return null;
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
this.addOrUpdateCard = async (params, cardId) => {
|
|
404
|
+
const fnLogger = this.logger.child({ method: "addOrUpdateCard", args: { params, cardId } });
|
|
405
|
+
return new Promise(async (resolve, reject) => {
|
|
406
|
+
if (cardId) {
|
|
407
|
+
fnLogger.info("Provided document's id, performing an update");
|
|
408
|
+
const res = await this.updateCard(cardId, params);
|
|
409
|
+
resolve(res);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
fnLogger.info("No document id provided, checking for PKs");
|
|
413
|
+
const card = await this.getByPrimaryKeys(params);
|
|
414
|
+
if (card == null) {
|
|
415
|
+
const res = await this.addCard(params);
|
|
416
|
+
resolve(res);
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
fnLogger.error("Duplicate card by keys");
|
|
420
|
+
reject("Duplicate card by keys");
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
this.updateCard = async (cardId, params) => {
|
|
426
|
+
return new Promise(async (resolve, reject) => {
|
|
427
|
+
if (this.stack) {
|
|
428
|
+
const res = await this.stack.createDoc(cardId, this.getName(), this, params);
|
|
429
|
+
resolve(res);
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
_a.logger.info("no stack defined");
|
|
433
|
+
resolve(null);
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
this.deleteCard = async (cardId) => {
|
|
438
|
+
const fnLogger = this.logger.child({ method: "deleteCard", args: { cardId } });
|
|
439
|
+
if (this.stack) {
|
|
440
|
+
const res = await this.stack.deleteDocument(cardId);
|
|
441
|
+
return res;
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
fnLogger.error("Stack is not defined");
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
this.getCards = async (selector, fields, skip, limit) => {
|
|
449
|
+
const _selector = Object.assign(Object.assign({}, (selector || {})), { "~class": { $eq: this.name } });
|
|
450
|
+
this.logger.info("getCards - selector", { selector: _selector, fields, skip, limit });
|
|
451
|
+
let docs = (await this.stack.findDocuments(_selector, fields, skip, limit)).docs;
|
|
452
|
+
return docs;
|
|
453
|
+
};
|
|
454
|
+
this.addTrigger = async (name, model) => {
|
|
455
|
+
const fnLogger = this.logger.child({ method: "addTrigger" });
|
|
456
|
+
try {
|
|
457
|
+
const trigger = new Trigger(model, this);
|
|
458
|
+
this.triggers.push(trigger);
|
|
459
|
+
if (this.stack) {
|
|
460
|
+
this.setModel(); // [TODO] Change to buildFromModel();
|
|
461
|
+
let res = await this.stack.updateClass(this);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
throw new Error(`Stack is not defined. Can't update class`);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
catch (e) {
|
|
468
|
+
fnLogger.error(e);
|
|
469
|
+
}
|
|
470
|
+
return this;
|
|
471
|
+
};
|
|
472
|
+
this.removeTrigger = async (name) => {
|
|
473
|
+
this.triggers = this.triggers.filter(t => t.name != name);
|
|
474
|
+
return this;
|
|
475
|
+
};
|
|
476
|
+
// Private constructor to prevent direct instantiation
|
|
477
|
+
/* Populated on async build */
|
|
478
|
+
// this.id = null;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
_a = Class;
|
|
482
|
+
Class.logger = createLogger().child({ module: "class" });
|
|
483
|
+
Class.get = (stack, id, name, type, description, schema = {}) => {
|
|
484
|
+
const class_ = new _a();
|
|
485
|
+
_a.logger.info("Received schema", { schema });
|
|
486
|
+
class_.init(stack, id, name, type, description, schema);
|
|
487
|
+
// Add listener for new documents of this class type
|
|
488
|
+
class_.stack.onClassDoc(name)
|
|
489
|
+
.on("change", (change) => {
|
|
490
|
+
const evt = new CustomEvent("doc", {
|
|
491
|
+
detail: change
|
|
492
|
+
});
|
|
493
|
+
class_.dispatchEvent(evt);
|
|
494
|
+
});
|
|
495
|
+
return class_;
|
|
496
|
+
};
|
|
497
|
+
Class.create = async (stack, name, type, description, schema = {}) => {
|
|
498
|
+
const class_ = _a.get(stack, name, name, type, description, schema);
|
|
499
|
+
await class_.build();
|
|
500
|
+
return class_;
|
|
501
|
+
};
|
|
502
|
+
Class.buildFromModel = async (stack, classModel) => {
|
|
503
|
+
_a.logger.info("buildFromModel - Instantiate from model", { classModel });
|
|
504
|
+
// let parentClassModel = (classModel.parentClass ? await stack.getClassModel(classModel.parentClass) : null);
|
|
505
|
+
// let parentClass = (parentClassModel ? await Class.buildFromModel(stack, parentClassModel) : null);
|
|
506
|
+
// [TODO] Redundancy: Class.create retrieve model from db and builds it (therefore also setting the model)
|
|
507
|
+
if (classModel._rev) {
|
|
508
|
+
let classObj = _a.get(stack, classModel._id, classModel.name, classModel["~class"], classModel.description, classModel.schema);
|
|
509
|
+
classObj.setModel(classModel);
|
|
510
|
+
return classObj;
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
let classObj = await _a.create(stack, classModel.name, classModel["~class"], classModel["~class"], classModel.schema);
|
|
514
|
+
classObj.setModel(classModel);
|
|
515
|
+
return classObj;
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
Class.fetchById = async (stack, classId) => {
|
|
519
|
+
try {
|
|
520
|
+
let classModel = await stack.db.get(classId);
|
|
521
|
+
const classObj = await _a.buildFromModel(stack, classModel);
|
|
522
|
+
return classObj;
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
throw new Error(`Class not found: ${classId}`);
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
Class.fetch = async (stack, className) => {
|
|
529
|
+
let classModel = await stack.getClassModel(className);
|
|
530
|
+
if (classModel) {
|
|
531
|
+
// console.log("Fetched class model", {classModel});
|
|
532
|
+
return _a.buildFromModel(stack, classModel);
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
// throw new Error("Class not found: "+className);
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
export default Class;
|
|
540
|
+
//# sourceMappingURL=class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/core/class.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,IAAI,MAAM,EAAgC,MAAM,kBAAkB,CAAC;AACjF,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAGpD,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,MAAM,KAAM,SAAQ,MAAM;IAkBtB;QACI,KAAK,EAAE,CAAC;QAZZ,eAAU,GAAkC,EAAE,CAAC;QAC/C,WAAM,GAAyB,EAAE,CAAC;QAClC,cAAS,GAAgB,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,C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