@docstack/client 0.0.1 → 0.0.2

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.
Files changed (60) hide show
  1. package/lib/core/attribute.d.ts +4 -4
  2. package/lib/core/class.d.ts +3 -3
  3. package/lib/core/crypto-engine/index.d.ts +5 -5
  4. package/lib/core/query-engine/executor.d.ts +1 -1
  5. package/lib/core/query-engine/index.d.ts +3 -3
  6. package/lib/core/stack.d.ts +6 -6
  7. package/lib/index.d.ts +1 -1
  8. package/lib/index.js +2 -8237
  9. package/lib/index.js.map +1 -1
  10. package/lib/utils/index.d.ts +1 -1
  11. package/package.json +11 -3
  12. package/webpack.config.js +62 -0
  13. package/lib/core/attribute.js +0 -296
  14. package/lib/core/attribute.js.map +0 -1
  15. package/lib/core/class.js +0 -540
  16. package/lib/core/class.js.map +0 -1
  17. package/lib/core/crypto-engine/index.js +0 -130
  18. package/lib/core/crypto-engine/index.js.map +0 -1
  19. package/lib/core/crypto-engine/utils.js +0 -76
  20. package/lib/core/crypto-engine/utils.js.map +0 -1
  21. package/lib/core/datamodel/index.js +0 -1186
  22. package/lib/core/datamodel/index.js.map +0 -1
  23. package/lib/core/domain.js +0 -285
  24. package/lib/core/domain.js.map +0 -1
  25. package/lib/core/index.js +0 -379
  26. package/lib/core/index.js.map +0 -1
  27. package/lib/core/job-engine/index.js +0 -116
  28. package/lib/core/job-engine/index.js.map +0 -1
  29. package/lib/core/policy-engine/index.js +0 -150
  30. package/lib/core/policy-engine/index.js.map +0 -1
  31. package/lib/core/query-engine/accumulators.js +0 -258
  32. package/lib/core/query-engine/accumulators.js.map +0 -1
  33. package/lib/core/query-engine/evaluator.js +0 -179
  34. package/lib/core/query-engine/evaluator.js.map +0 -1
  35. package/lib/core/query-engine/executor.js +0 -405
  36. package/lib/core/query-engine/executor.js.map +0 -1
  37. package/lib/core/query-engine/index.js +0 -4
  38. package/lib/core/query-engine/index.js.map +0 -1
  39. package/lib/core/query-engine/parser.js +0 -515
  40. package/lib/core/query-engine/parser.js.map +0 -1
  41. package/lib/core/query-engine/planner.js +0 -330
  42. package/lib/core/query-engine/planner.js.map +0 -1
  43. package/lib/core/stack.js +0 -1507
  44. package/lib/core/stack.js.map +0 -1
  45. package/lib/core/test-utils/docstack.js +0 -222
  46. package/lib/core/test-utils/docstack.js.map +0 -1
  47. package/lib/core/trigger/index.js +0 -81
  48. package/lib/core/trigger/index.js.map +0 -1
  49. package/lib/plugins/pouchdb.js +0 -403
  50. package/lib/plugins/pouchdb.js.map +0 -1
  51. package/lib/utils/crypto/index.js +0 -34
  52. package/lib/utils/crypto/index.js.map +0 -1
  53. package/lib/utils/index.js +0 -58
  54. package/lib/utils/index.js.map +0 -1
  55. package/lib/utils/logger/index.js +0 -20
  56. package/lib/utils/logger/index.js.map +0 -1
  57. package/lib/utils/logger/transport.js +0 -28
  58. package/lib/utils/logger/transport.js.map +0 -1
  59. package/lib/workers/dataModel.js +0 -48
  60. package/lib/workers/dataModel.js.map +0 -1
@@ -1,403 +0,0 @@
1
- import { isClassModel, isDocument, isRelation } from "@docstack/shared";
2
- import PouchDB from "pouchdb-browser";
3
- import createLogger from "../utils/logger/index.js";
4
- import { diff } from 'jsondiffpatch';
5
- import { applySchemaDelta } from "../utils/index.js";
6
- import Class from "../core/class.js";
7
- const logger = createLogger().child({ module: "pouchdb" });
8
- /**
9
- * Plugin Factory method that returns a PouchDB plugin object
10
- * which performs on documents (before) triggers and validation against
11
- * their class schema
12
- * @param stack
13
- * @returns
14
- */
15
- export const StackPlugin = (pouch, stack, conn) => {
16
- const pouchBulkDocs = PouchDB.prototype.bulkDocs;
17
- const pouchGet = PouchDB.prototype.get;
18
- // const pouchPut = PouchDB.prototype.put;
19
- // const parallelPouch = new PouchDB(conn);
20
- // const pouchBulkDocs = parallelPouch.bulkDocs;
21
- // const pouchGet = parallelPouch.get;
22
- //.bulkDocs;
23
- // const pouchPut = pouch.prototype.put;
24
- return {
25
- bulkDocs: async function (docs, options, callback) {
26
- const fnLogger = logger.child({ method: "bulkDocs" });
27
- if (typeof options == 'function') {
28
- callback = options;
29
- options = {};
30
- }
31
- // The `isPatch` flag is reserved for bootstrapping system patches where
32
- // schema documents might not yet validate against the current runtime
33
- // (e.g. during initial migration). Regular application code should not
34
- // set this flag because it bypasses validation and trigger execution.
35
- const skipPatchValidation = Boolean(options === null || options === void 0 ? void 0 : options.isPatch);
36
- const originalFn = () => {
37
- if (callback) {
38
- return pouchBulkDocs.call(this, docs, options, callback);
39
- }
40
- else {
41
- return pouchBulkDocs.call(this, docs, options);
42
- }
43
- };
44
- // if (skipPatchValidation && process.env.NODE_ENV === 'test') {
45
- // return originalFn();
46
- // }
47
- let documentsToProcess;
48
- if (Array.isArray(docs)) {
49
- documentsToProcess = docs;
50
- }
51
- else {
52
- documentsToProcess = docs.docs;
53
- }
54
- const relationQueue = [];
55
- const flushRelationQueue = async () => {
56
- if (!relationQueue.length)
57
- return;
58
- const grouped = new Map();
59
- while (relationQueue.length) {
60
- const entry = relationQueue.shift();
61
- if (!entry)
62
- continue;
63
- const key = entry.domain.name;
64
- if (!grouped.has(key)) {
65
- grouped.set(key, { domain: entry.domain, drafts: [] });
66
- }
67
- grouped.get(key).drafts.push({ docId: null, params: entry.params });
68
- }
69
- for (const { domain, drafts } of grouped.values()) {
70
- await stack.createRelationDocs(drafts, domain.name, domain);
71
- }
72
- };
73
- const triggerQueue = Object.create(null);
74
- const classCache = new Map();
75
- const postOperations = async (error, result) => {
76
- if (error) {
77
- return { error, result };
78
- }
79
- else if (result) {
80
- const docs = [];
81
- for (const docRes of result) {
82
- if (docRes.id) {
83
- // const doc = await stack.db.get(docRes.id, { rev: (docRes as any).rev }) as Document;
84
- const doc = documentsToProcess.find(d => d._id === docRes.id);
85
- if (doc) {
86
- const updatedRev = docRes.rev;
87
- if (updatedRev) {
88
- doc._rev = updatedRev;
89
- }
90
- const afterTriggers = triggerQueue[docRes.id];
91
- if (afterTriggers && afterTriggers.length) {
92
- // debugger;
93
- for (const afterTrigger of afterTriggers) {
94
- const updatedDoc = await afterTrigger.execute(doc);
95
- Object.assign(doc, updatedDoc);
96
- }
97
- docs.push(doc);
98
- }
99
- }
100
- }
101
- }
102
- if (docs.length) {
103
- const recurse = new Promise((resolve, reject) => {
104
- this.bulkDocs.apply(this, [docs, {
105
- isPostOp: true
106
- }, (rErr, rRes) => resolve({
107
- error: rErr,
108
- result: rRes
109
- })]);
110
- });
111
- const { error: rErr, result: rRes } = await recurse;
112
- await flushRelationQueue();
113
- return { error: rErr, result: rRes };
114
- }
115
- }
116
- await flushRelationQueue();
117
- return { error, result };
118
- };
119
- const postExec = async (error, result) => {
120
- if (!(options === null || options === void 0 ? void 0 : options.isPostOp)) {
121
- const { error: err, result: res } = await postOperations(error, result);
122
- if (callback)
123
- return callback(err, res);
124
- }
125
- else if (callback) {
126
- return callback(error, result);
127
- }
128
- };
129
- await Promise.all(documentsToProcess.map(async (doc) => {
130
- if (isClassModel(doc)) {
131
- // Validate against parent class
132
- if (doc["~class"] !== "~self") {
133
- if (doc._id == "~User") {
134
- const test = await stack.getClass("class");
135
- if (!test) {
136
- const batch = await stack.db.allDocs();
137
- console.log("Docs in DB:", batch.rows);
138
- }
139
- }
140
- const parentClass = await stack.getClass(doc["~class"]);
141
- if (parentClass) {
142
- fnLogger.info("Validating class model against parent class", { doc, parentClass: parentClass.name });
143
- const validationResult = await parentClass.validate(doc);
144
- if (!validationResult) {
145
- fnLogger.error("Class model is not valid for its parent class", { doc, parentClass: parentClass.name });
146
- throw new Error(`Discarded class model because model not valid for its parent class '${parentClass.name}' schema`);
147
- }
148
- }
149
- else {
150
- fnLogger.error("Parent class not found", { doc });
151
- throw new Error(`Parent class '${doc["~class"]}' not found for class model '${doc._id}'`);
152
- }
153
- }
154
- else {
155
- // TODO: Consider validating against self after registering the class?
156
- console.log("Class model is of type '~self', skipping parent class validation", { doc });
157
- }
158
- fnLogger.info("Document is class model, following update propagation procedure.");
159
- // When a class document is updated, its change must have an effect on its children
160
- const classDocId = doc._id;
161
- const className = typeof doc.name === "string" ? doc.name : classDocId;
162
- try {
163
- // Get the previous version of the class model
164
- const docWithRevs = await stack.db.get(classDocId, { revs: true });
165
- const revisionIDList = docWithRevs._revisions.ids;
166
- if (revisionIDList.length == 1) {
167
- fnLogger.info(`Class '${className}' (doc '${classDocId}') was just created. Nothing to do.`);
168
- return;
169
- }
170
- }
171
- catch (e) {
172
- if (e.name === 'not_found') {
173
- fnLogger.info(`Class '${className}' (doc '${classDocId}') was just created. Nothing to do.`);
174
- return;
175
- }
176
- }
177
- // Fetch the current (next old) version of the class document.
178
- try {
179
- const previousClassDoc = await stack.db.get(classDocId);
180
- const classObj = await Class.buildFromModel(stack, previousClassDoc);
181
- fnLogger.info("Retrieved documents", { doc, previousClassDoc });
182
- const schemaDelta = diff(previousClassDoc.schema, doc.schema);
183
- if (!schemaDelta) {
184
- fnLogger.info(`Class '${className}' has no changes on schema.`);
185
- return;
186
- }
187
- const documents = await classObj.getCards();
188
- if (documents.length === 0) {
189
- fnLogger.info(`No documents found for class '${className}' after its update.`);
190
- return;
191
- }
192
- const updates = await Promise.all(documents.map(async (doc) => {
193
- const updatedDoc = await applySchemaDelta(doc, schemaDelta, classObj);
194
- return updatedDoc;
195
- }));
196
- const result = await stack.db.bulkDocs(updates);
197
- fnLogger.info('Propagated updates');
198
- }
199
- catch (e) {
200
- fnLogger.error(`Failed to propagate class model updates for class '${className}' (doc '${classDocId}').`, { error: e });
201
- throw new Error(`Failed to propagate class model updates for class '${stack.db.name}'.'${className}' (doc '${classDocId}'). ${e}`);
202
- }
203
- finally {
204
- fnLogger.info(`Finished propagating class model updates for class '${className}' (doc '${classDocId}').`);
205
- }
206
- }
207
- else if (isRelation(doc)) {
208
- const domain = await stack.getDomain(doc["~domain"]);
209
- if (!domain) {
210
- throw new Error(`Domain not found: ${doc["~domain"]}`);
211
- }
212
- if (doc.sourceClass !== domain.sourceClass.id || doc.targetClass !== domain.targetClass.id) {
213
- throw new Error(`Relation document classes do not match domain '${domain.name}'.`);
214
- }
215
- const [sourceDoc, targetDoc] = await Promise.all([
216
- stack.db.get(doc.sourceId).catch(() => null),
217
- stack.db.get(doc.targetId).catch(() => null),
218
- ]);
219
- if (!sourceDoc) {
220
- throw new Error(`Source document '${doc.sourceId}' does not exist for domain '${domain.name}'.`);
221
- }
222
- if (!targetDoc) {
223
- throw new Error(`Target document '${doc.targetId}' does not exist for domain '${domain.name}'.`);
224
- }
225
- }
226
- else if (isDocument(doc)) {
227
- const className = doc["~class"];
228
- try {
229
- let classObj;
230
- try {
231
- classObj = await stack.getClass(className, true);
232
- }
233
- catch (error) {
234
- try {
235
- throw new Error(`Class '${stack.db.name === stack.connection
236
- ? stack.db.name
237
- : `${stack.db.name}/${stack.connection}`}'.'${className}' not found for document '${doc._id}'.
238
- Database info '${JSON.stringify(await stack.db.info())}' Error: ${error}`);
239
- }
240
- catch (error2) {
241
- throw new Error(`Class '${stack.connection}'.'${className}' not found for document '${doc._id}'. Database info could not be retrieved: ${error2}. ${error}`);
242
- }
243
- }
244
- if (!classObj) {
245
- const stackTrace = await stack.getClasses({});
246
- console.log("Find me", stackTrace);
247
- throw new Error(`Class '${className}' not found for document '${doc._id}'.`);
248
- }
249
- classCache.set(className, classObj);
250
- const encryptableAttributes = classObj.getEncryptedAttributes();
251
- if (stack.cryptoEngine.isEnabled() && encryptableAttributes.length) {
252
- await stack.cryptoEngine.decryptDocument(doc, classObj);
253
- }
254
- const relationalAttrs = Object.values(classObj.getAttributes()).filter(a => {
255
- if (classObj.getName().startsWith("Account-")) {
256
- // console.log("Checking attribute for relation", { class: classObj.getName(), attr: a.name, type: a.model.type })
257
- }
258
- return a.model.type === "reference";
259
- });
260
- for (const attr of relationalAttrs) {
261
- const relationValue = doc[attr.name];
262
- if (!relationValue)
263
- continue;
264
- const domainId = attr.model.config.domain;
265
- const domain = await stack.getDomain(domainId);
266
- if (!domain)
267
- throw new Error(`Domain not found: ${domainId}`);
268
- // Validate relation constraint
269
- const validation = await domain.validateRelation(doc, relationValue);
270
- if (!validation.exists) {
271
- // console.log("Queuing relation creation for doc", {docId: doc._id, domain: domain.name, params: validation.params})
272
- relationQueue.push({
273
- domain,
274
- params: validation.params,
275
- });
276
- }
277
- }
278
- // TODO: skip execution of before triggers if option.isPostOp
279
- const beforeTriggers = classObj.triggers.filter(t => t.order === "before");
280
- const afterTriggers = classObj.triggers.filter(t => t.order === "after");
281
- for (const trigger of beforeTriggers) {
282
- const updatedDoc = await trigger.execute(doc);
283
- Object.assign(doc, updatedDoc); // Merge changes back.
284
- }
285
- triggerQueue[doc._id] = [
286
- ...(triggerQueue[doc._id] || []),
287
- ...afterTriggers
288
- ];
289
- // Perform validation using the schema.
290
- const validationResult = await classObj.validate(doc);
291
- if (!validationResult) {
292
- fnLogger.error("Validation failed for document", { id: doc._id, className, doc });
293
- throw new Error(`Discarded document ${JSON.stringify(doc)} because object not valid for its Class schema: ${JSON.stringify(classObj.buildSchema())}`);
294
- }
295
- }
296
- catch (error) {
297
- throw error;
298
- }
299
- }
300
- }));
301
- if (true) {
302
- // if (!stack.cryptoEngine.isEnabled()) {
303
- if (skipPatchValidation) {
304
- console.log("Crypto engine not enabled, skipping encryption.");
305
- console.log("Docs:", docs);
306
- }
307
- await new Promise((resolve, reject) => {
308
- pouchBulkDocs.call(this, docs, options, async (error, result) => {
309
- try {
310
- postExec(error, result).then(() => {
311
- resolve();
312
- }).catch((e) => {
313
- reject(e);
314
- });
315
- }
316
- catch (e) {
317
- reject(e);
318
- }
319
- });
320
- });
321
- if (skipPatchValidation) {
322
- console.log("Bulk docs operation completed without encryption.");
323
- }
324
- return;
325
- }
326
- else {
327
- console.log("Crypto engine enabled, processing encryption.");
328
- }
329
- const originalDocs = Array.isArray(docs) ? documentsToProcess : docs.docs;
330
- const encryptedDocs = await Promise.all((originalDocs || []).map(async (doc) => {
331
- if (isDocument(doc)) {
332
- const className = doc["~class"];
333
- const classObj = classCache.get(className) || await stack.getClass(className, true);
334
- if (classObj) {
335
- const encryptableAttributes = classObj.getEncryptedAttributes();
336
- if (!stack.cryptoEngine.isEnabled() || !encryptableAttributes.length) {
337
- return doc;
338
- }
339
- classCache.set(className, classObj);
340
- const clone = Object.assign({}, doc);
341
- await stack.cryptoEngine.encryptDocument(clone, classObj);
342
- return clone;
343
- }
344
- }
345
- return doc;
346
- }));
347
- const payload = Array.isArray(docs)
348
- ? encryptedDocs
349
- : Object.assign(Object.assign({}, docs), { docs: encryptedDocs });
350
- return pouchBulkDocs.call(this, payload, options, postExec);
351
- },
352
- /*
353
- get: async function (docId, options?: PouchDB.Core.GetOptions | null, callback?) {
354
- if (typeof options === "function") {
355
- callback = options;
356
- options = undefined;
357
- }
358
-
359
- const exec = async () => {
360
- const result = await pouchGet.call(this, docId, options ?? {});
361
- if (result && isDocument(result) && stack.cryptoEngine.isEnabled()) {
362
- const classObj = await stack.getClass(result["~class"], true).catch(() => null);
363
- if (classObj && classObj.getEncryptedAttributes().length) {
364
- await stack.cryptoEngine.decryptDocument(result as Document, classObj);
365
- }
366
- }
367
- return result;
368
- };
369
-
370
- if (callback) {
371
- exec().then((res) => callback(null, res)).catch((err) => callback(err, undefined));
372
- return;
373
- }
374
- return exec();
375
- }, */
376
- /*
377
- put: async function (doc, options?: PouchDB.Core.PutOptions | null, callback?) {
378
- if (typeof options === "function") {
379
- callback = options;
380
- options = undefined;
381
- }
382
- const exec = async () => {
383
- let payload = doc as any;
384
- if (isDocument(doc) && stack.cryptoEngine.isEnabled()) {
385
- const classObj = await stack.getClass(doc["~class"], true).catch(() => null);
386
- if (classObj && classObj.getEncryptedAttributes().length) {
387
- payload = { ...doc } as Document;
388
- await stack.cryptoEngine.encryptDocument(payload as Document, classObj);
389
- }
390
- }
391
- return pouchPut.call(this, payload, options ?? {});
392
- };
393
-
394
- if (callback) {
395
- exec().then((res) => callback(null, res)).catch((err) => callback(err));
396
- return;
397
- }
398
- return exec();
399
- },
400
- */
401
- };
402
- };
403
- //# sourceMappingURL=pouchdb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EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACvE,CAAC;QAED;;;;;;;;;;;;;;;;;;;;;;;aAuBK;QACL;;;;;;;;;;;;;;;;;;;;;;;;UAwBE;KAEL,CAAC;AACN,CAAC,CAAC"}
@@ -1,34 +0,0 @@
1
- // Function to convert a string to an ArrayBuffer
2
- const str2ab = (str) => {
3
- const buf = new ArrayBuffer(str.length);
4
- const bufView = new Uint8Array(buf);
5
- for (let i = 0, strLen = str.length; i < strLen; i++) {
6
- bufView[i] = str.charCodeAt(i);
7
- }
8
- return buf;
9
- };
10
- // Function to import the public key
11
- export const importPublicKey = async (pem) => {
12
- // Remove the PEM header and footer
13
- const pemHeader = "-----BEGIN PUBLIC KEY-----";
14
- const pemFooter = "-----END PUBLIC KEY-----";
15
- const pemContents = pem.replace(pemHeader, "").replace(pemFooter, "").replace(/\n/g, "");
16
- // the pemContent is translated into a base64 string
17
- const binaryDerString = window.atob(pemContents);
18
- // the base64 string is converted to an ArrayBuffer
19
- const binaryDer = str2ab(binaryDerString);
20
- return window.crypto.subtle.importKey("spki", binaryDer, {
21
- name: "RSA-OAEP",
22
- hash: "SHA-256"
23
- }, true, ["encrypt"]);
24
- };
25
- export const decryptString = (encrypted) => {
26
- };
27
- export const encryptStringWithPublicKey = async (publicKey, data) => {
28
- const enc = new TextEncoder();
29
- const encryptedData = await window.crypto.subtle.encrypt({
30
- name: "RSA-OAEP"
31
- }, publicKey, enc.encode(data));
32
- return encryptedData;
33
- };
34
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/crypto/index.ts"],"names":[],"mappings":"AACA,iDAAiD;AACjD,MAAM,MAAM,GAAG,CAAC,GAAW,EAAe,EAAE;IACxC,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IACpC,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IAAI,EAAE,UAAU;KACjB,EACD,SAAS,EACT,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CACjB,CAAC;IACF,OAAO,aAAa,CAAC;AACvB,CAAC,CAAA"}
@@ -1,58 +0,0 @@
1
- import Attribute from "../core/attribute.js";
2
- import createLogger from "./logger/index.js";
3
- const attributeEffect = async (operation, model, classObj, doc) => {
4
- const attribute = new Attribute(null, model.name, model.type, model.description, model.config);
5
- if (operation === "add") {
6
- doc = Object.assign(Object.assign({}, doc), attribute.getEmpty());
7
- }
8
- if (operation === "delete") {
9
- delete doc[attribute.name];
10
- }
11
- else { // when addition or change also perform validation
12
- const res = await attribute.validate(doc[attribute.name]);
13
- if (!res)
14
- throw new Error(`Attribute '${classObj.name}.${attribute.name}' ${operation} fails for current document because of its validation`);
15
- }
16
- if (attribute.isPrimaryKey()) {
17
- const result = classObj.bulkUniqueCheck(classObj.getPrimaryKeys());
18
- if (!result) {
19
- throw new Error(`With attribute '${attribute.name}' ${operation} of class '${classObj.name}', docs fail primary keys check.`);
20
- }
21
- }
22
- if (operation !== "delete" && attribute.isMandatory() && doc[attribute.name] == undefined) {
23
- throw new Error(`Attribute '${classObj.name}.${attribute.name}' is mandatory but has no value.`);
24
- }
25
- return doc;
26
- };
27
- export const applySchemaDelta = async (doc, schemaDelta, classObj) => {
28
- const fnLogger = createLogger().child({ method: "applySchemaDelta" });
29
- let updatedDoc = Object.assign({}, doc);
30
- const t = Object.entries(schemaDelta);
31
- for (const e of t) {
32
- fnLogger.debug(`Delta of attribute '${e[0]}'`);
33
- if (Array.isArray(e[1])) {
34
- // e[1] can represent an addition, a deletion or an edit
35
- // it's an addition when the array has only one element
36
- if (e[1].length === 1) {
37
- const attrModel = e[1][0];
38
- updatedDoc = await attributeEffect("add", attrModel, classObj, updatedDoc);
39
- }
40
- // it's an edit when it has 2 elements
41
- if (e[1].length === 1) {
42
- const attrModel = e[1][0];
43
- updatedDoc = await attributeEffect("change", attrModel, classObj, updatedDoc);
44
- }
45
- // it's a removal when it has 3 elements
46
- if (e[1].length === 3) {
47
- const attrModel = e[1][0];
48
- updatedDoc = await attributeEffect("delete", attrModel, classObj, updatedDoc);
49
- }
50
- return updatedDoc;
51
- }
52
- else {
53
- // TODO: The change is nested within the attribute model
54
- }
55
- }
56
- return updatedDoc;
57
- };
58
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAG7C,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,MAAM,eAAe,GAAG,KAAK,EACzB,SAAsC,EACtC,KAAqB,EACrB,QAAe,EACf,GAAa,EACf,EAAE;IACA,MAAM,SAAS,GAAG,IAAI,SAAS,CAC3B,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAC5B,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAClC,CAAC;IACF,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACtB,GAAG,mCAAO,GAAG,GAAK,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC,CAAC,kDAAkD;QACvD,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,cAAc,QAAQ,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,uDAAuD,CAAC,CAAC;IAClJ,CAAC;IAGD,IAAI,SAAS,CAAC,YAAY,EAAE,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,QAAQ,CAAC,eAA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AE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;YAC/E,CAAC;YACD,sCAAsC;YACtC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpB,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAmB,CAAC;gBAC5C,UAAU,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;YAClF,CAAC;YAED,wCAAwC;YACxC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpB,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAmB,CAAC;gBAC5C,UAAU,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;YAClF,CAAC;YACD,OAAO,UAAU,CAAC;QACtB,CAAC;aAAM,CAAC;YACJ,wDAAwD;QAC5D,CAAC;IACL,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC,CAAA"}
@@ -1,20 +0,0 @@
1
- import * as winston from "winston";
2
- import { createLogger } from "winston";
3
- import PouchDBTransport from "./transport.js";
4
- const clientLogger = (stack) => {
5
- const transports = [];
6
- if (stack) {
7
- transports.push(new PouchDBTransport({ stack }));
8
- }
9
- // if (process.env.NODE_ENV !== "test") {
10
- const consoleTransport = new winston.transports.Console({
11
- level: "warn"
12
- });
13
- transports.push(consoleTransport);
14
- // }
15
- return createLogger({
16
- transports: transports
17
- });
18
- };
19
- export default clientLogger;
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/logger/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,gBAAgB,MAAM,gBAAgB,CAAC;AAG9C,MAAM,YAAY,GAAG,CAAC,KAAoB,EAAE,EAAE;IAC1C,MAAM,UAAU,GAAuB,EAAE,CAAC;IAC1C,IAAI,KAAK,EAAE,CAAC;QACR,UAAU,CAAC,IAAI,CAAC,IAAI,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,yCAAyC;IACrC,MAAM,gBAAgB,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;QACpD,KAAK,EAAE,MAAM;KAChB,CAAC,CAAC;IACH,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACtC,IAAI;IAEJ,OAAO,YAAY,CAAC;QAChB,UAAU,EAAE,UAAU;KACzB,CAAC,CAAC;AACP,CAAC,CAAA;AAED,eAAe,YAAY,CAAC"}
@@ -1,28 +0,0 @@
1
- import Transport from "winston-transport";
2
- import 'setimmediate';
3
- //
4
- // Inherit from `winston-transport` so you can take advantage
5
- // of the base functionality and `.exceptions.handle()`.
6
- //
7
- class PouchDBTransport extends Transport {
8
- // fields for storing database connection information
9
- constructor(opts) {
10
- super(opts);
11
- // Make sure that the database connection information is passed
12
- // and use that information to connect to the database
13
- this.stack = opts.stack;
14
- }
15
- async log(info, callback) {
16
- queueMicrotask(() => {
17
- this.emit('logged', info);
18
- });
19
- const response = await this.stack.db.post({
20
- log: info
21
- });
22
- // Perform the writing to the remote service
23
- callback();
24
- }
25
- }
26
- ;
27
- export default PouchDBTransport;
28
- //# sourceMappingURL=transport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/utils/logger/transport.ts"],"names":[],"mappings":"AAAA,OAAO,SAAqC,MAAM,mBAAmB,CAAC;AACtE,OAAO,cAAc,CAAC;AAEtB,EAAE;AACF,6DAA6D;AAC7D,wDAAwD;AACxD,EAAE;AACF,MAAM,gBAAiB,SAAQ,SAAS;IAEtC,qDAAqD;IACrD,YAAY,IAEc;QACxB,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,+DAA+D;QAC/D,sDAAsD;QACtD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,QAAkB;QACxC,cAAc,CAAC,GAAG,EAAE;YAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC;YACxC,GAAG,EAAE,IAAI;SACV,CAAC,CAAC;QACH,4CAA4C;QAC5C,QAAQ,EAAE,CAAC;IACb,CAAC;CACF;AAAA,CAAC;AAEF,eAAe,gBAAgB,CAAA"}
@@ -1,48 +0,0 @@
1
- import createLogger from "../utils/logger/index.js";
2
- const logger = createLogger().child({ module: "dataModel" });
3
- logger.info("Worker successfully registered");
4
- // Implement a message queue to handle requests sequentially.
5
- const messageQueue = [];
6
- let isProcessing = false;
7
- // Function to process messages from the queue.
8
- const processQueue = async () => {
9
- const fnLogger = logger.child({ method: "processQueue" });
10
- fnLogger.info("Started to process model worker queue");
11
- if (isProcessing || messageQueue.length === 0) {
12
- return;
13
- }
14
- isProcessing = true;
15
- const nextMessage = messageQueue.shift();
16
- if (nextMessage) {
17
- const { command, payload } = nextMessage;
18
- try {
19
- //
20
- }
21
- catch (error) {
22
- // If anything goes wrong, send an error message back.
23
- self.postMessage({
24
- status: 'error',
25
- message: `Failed.`,
26
- error: error.message
27
- });
28
- }
29
- finally {
30
- // We are done with the current message.
31
- isProcessing = false;
32
- // Check if there are more messages to process.
33
- processQueue();
34
- }
35
- }
36
- };
37
- // Listen for messages from the main application thread.
38
- self.onmessage = (event) => {
39
- if (event.data.command) {
40
- messageQueue.push(event.data);
41
- // Start processing the queue if not already busy.
42
- processQueue();
43
- }
44
- };
45
- self.onmessageerror = (event) => {
46
- logger.error("Got error", { event });
47
- };
48
- //# sourceMappingURL=dataModel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../src/workers/dataModel.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,WAAW,EAAC,CAAC,CAAC;AAE3D,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AAO9C,6DAA6D;AAC7D,MAAM,YAAY,GAAmB,EAAE,CAAC;AACxC,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB,+CAA+C;AAC/C,MAAM,YAAY,GAAG,KAAK,IAAI,EAAE;IAC5B,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,cAAc,EAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IACvD,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,OAAO;IACX,CAAC;IAED,YAAY,GAAG,IAAI,CAAC;IACpB,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;IACzC,IAAI,WAAW,EAAE,CAAC;QACd,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;QAEzC,IAAI,CAAC;YACD,EAAE;QACN,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YAClB,sDAAsD;YACtD,IAAI,CAAC,WAAW,CAAC;gBACb,MAAM,EAAE,OAAO;gBACf,OAAO,EAAE,SAAS;gBAClB,KAAK,EAAE,KAAK,CAAC,OAAO;aACvB,CAAC,CAAC;QACP,CAAC;gBAAS,CAAC;YACP,wCAAwC;YACxC,YAAY,GAAG,KAAK,CAAC;YACrB,+CAA+C;YAC/C,YAAY,EAAE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