@liminalfunctions/framework-vitamins 1.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.
package/.mocharc.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/mocharc.json",
3
+ "require": "tsx",
4
+ "spec": "test/*.ts"
5
+ }
@@ -0,0 +1,16 @@
1
+ export type result = {
2
+ _id: string;
3
+ };
4
+ export type generated_collection_interface<T extends result> = {
5
+ path: string[];
6
+ collection_id: string;
7
+ query: (query: any) => Promise<T[]>;
8
+ document: (document_id: string) => generated_document_interface<T>;
9
+ };
10
+ export type generated_document_interface<T extends result> = {
11
+ path: string[];
12
+ collection_id: string;
13
+ document_id: string;
14
+ get: () => Promise<T>;
15
+ };
16
+ export type Infer_Collection_Returntype<Type> = Type extends generated_collection_interface<infer E> ? E : never;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type_generated_collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type_generated_collection.js","sourceRoot":"","sources":["../src/type_generated_collection.ts"],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ import { App } from 'vue';
2
+ import { generated_collection_interface, generated_document_interface, Infer_Collection_Returntype, result } from './type_generated_collection.js';
3
+ type query_operation = "get" | "query";
4
+ type child_generator<T extends result> = (result: T) => Query;
5
+ declare class Document {
6
+ id: string;
7
+ vitamins: Vitamins;
8
+ children: Set<string>;
9
+ parents: Set<string>;
10
+ reference: generated_collection_interface<result> | generated_document_interface<result>;
11
+ document: result;
12
+ constructor(vitamins: Vitamins, reference: generated_collection_interface<result> | generated_document_interface<result>, document: result);
13
+ unlink_parent(id: string): void;
14
+ }
15
+ declare class Query {
16
+ id: string;
17
+ vitamins: Vitamins;
18
+ children: Set<string>;
19
+ parents: Set<string>;
20
+ reference: generated_collection_interface<result> | generated_document_interface<result>;
21
+ collection_path: string;
22
+ operation: query_operation;
23
+ document_id?: string;
24
+ query_parameters?: any;
25
+ child_generators: child_generator<result>[];
26
+ has_run: boolean;
27
+ constructor(vitamins: Vitamins, reference: generated_collection_interface<result> | generated_document_interface<result>, argument?: object, child_generators?: child_generator<result>[]);
28
+ rerun(): Promise<void>;
29
+ run(run_from_root?: boolean): Promise<Query>;
30
+ _fetch(): Promise<never>;
31
+ link_child(document: Document): void;
32
+ link_parent(document: Document): void;
33
+ unlink_child(id: string): void;
34
+ unlink_parent(id: string): void;
35
+ equals(query: Query): boolean;
36
+ static find_query(queries: Query[], target: Query): Query;
37
+ }
38
+ export declare class Vitamins {
39
+ vue: App;
40
+ documents: Map<string, Document>;
41
+ all_queries: Map<string, Query>;
42
+ queries_by_collection: Map<string, Set<Query>>;
43
+ debug_on: boolean;
44
+ constructor(vue: App);
45
+ query<Collection extends generated_collection_interface<result>>(collection: Collection, query_parameters: any, ...generators: child_generator<Infer_Collection_Returntype<Collection>>[]): Query;
46
+ delete_document_from_external(document_id: string): void;
47
+ update_document_from_external(document_id: string, data: result): void;
48
+ _debug(...print: any[]): void;
49
+ _find_existing_query(query: Query): Query;
50
+ _add_query(query: Query): void;
51
+ _delete_query(query: Query): void;
52
+ _add_document(document: Document): void;
53
+ _update_data(reference: generated_collection_interface<result> | generated_document_interface<result> | undefined, document_id: string, data: result, query?: Query): void;
54
+ _generate_child_queries(document: Document): Query[];
55
+ _cleanup(queries: Query[], documents: Document[]): void;
56
+ }
57
+ export {};
@@ -0,0 +1,360 @@
1
+ import { v4 as uuid } from 'uuid';
2
+ class Document {
3
+ id;
4
+ vitamins;
5
+ children;
6
+ parents;
7
+ reference;
8
+ document;
9
+ constructor(vitamins, reference, document) {
10
+ this.vitamins = vitamins;
11
+ this.children = new Set();
12
+ this.parents = new Set();
13
+ this.reference = reference;
14
+ this.document = document;
15
+ this.id = document._id;
16
+ }
17
+ unlink_parent(id) {
18
+ this.parents.delete(id);
19
+ }
20
+ }
21
+ class Query {
22
+ id;
23
+ vitamins;
24
+ children;
25
+ parents;
26
+ reference;
27
+ collection_path;
28
+ operation;
29
+ document_id;
30
+ query_parameters;
31
+ child_generators;
32
+ has_run;
33
+ constructor(vitamins, reference, argument, child_generators = []) {
34
+ this.id = uuid();
35
+ vitamins._debug(`constructing query ${reference.collection_id} ${this.id}`);
36
+ this.children = new Set();
37
+ this.parents = new Set();
38
+ this.vitamins = vitamins;
39
+ this.reference = reference;
40
+ this.child_generators = child_generators;
41
+ if (reference.query) {
42
+ this.query_parameters = argument;
43
+ this.collection_path = this.reference.path.join('/');
44
+ this.operation = 'query';
45
+ }
46
+ else if (reference.get) {
47
+ this.document_id = reference.document_id;
48
+ this.collection_path = [...this.reference.path, this.document_id].join('/');
49
+ this.operation = 'get';
50
+ }
51
+ else {
52
+ throw new Error(`reference is not a collection reference or a query reference. Reexamine that argument.`);
53
+ }
54
+ this.has_run = false;
55
+ }
56
+ async rerun() {
57
+ this.vitamins._debug(`RERUNNING QUERY`);
58
+ this.has_run = false;
59
+ await this._fetch();
60
+ }
61
+ async run(run_from_root = true) {
62
+ this.vitamins._debug(`running ${this.reference.collection_id}`);
63
+ let self = this.vitamins._find_existing_query(this) ?? this;
64
+ if (self.id !== this.id) {
65
+ this.vitamins._debug('replacing self with doppleganger');
66
+ }
67
+ if (run_from_root && !self.parents.has('root')) {
68
+ self.parents.add('root');
69
+ }
70
+ self.vitamins._add_query(self);
71
+ if (self.id !== this.id) {
72
+ for (let generator of this.child_generators) {
73
+ if (!self.child_generators.includes(generator)) {
74
+ this.vitamins._debug(`ADDING CHILD GENERATOR`);
75
+ this.vitamins._debug(generator);
76
+ self.child_generators.push(generator);
77
+ }
78
+ }
79
+ for (let child_id of this.children) {
80
+ let document = this.vitamins.documents.get(child_id);
81
+ let generated_child_queries = this.vitamins._generate_child_queries(document);
82
+ generated_child_queries.forEach(ele => this.vitamins._add_query(ele));
83
+ generated_child_queries.forEach(ele => ele.run());
84
+ }
85
+ }
86
+ else {
87
+ await self._fetch();
88
+ }
89
+ return self;
90
+ }
91
+ async _fetch() {
92
+ if (this.has_run) {
93
+ return;
94
+ }
95
+ this.has_run = true;
96
+ try {
97
+ if (this.operation === 'get') {
98
+ let reference = this.reference;
99
+ let result = await reference.get();
100
+ this.vitamins._update_data(reference, result._id, result, this);
101
+ }
102
+ else if (this.operation === 'query') {
103
+ let reference = this.reference;
104
+ let results = await reference.query(this.query_parameters);
105
+ for (let result of results) {
106
+ this.vitamins._update_data(reference, result._id, result, this);
107
+ }
108
+ }
109
+ }
110
+ catch (err) {
111
+ return Promise.reject(err);
112
+ }
113
+ }
114
+ link_child(document) {
115
+ this.children.add(document.id);
116
+ document.parents.add(this.id);
117
+ }
118
+ link_parent(document) {
119
+ this.parents.add(document.id);
120
+ document.children.add(this.id);
121
+ }
122
+ unlink_child(id) {
123
+ this.children.delete(id);
124
+ }
125
+ unlink_parent(id) {
126
+ this.parents.delete(id);
127
+ }
128
+ equals(query) {
129
+ if (this === query) {
130
+ return true;
131
+ }
132
+ if (query.operation !== this.operation) {
133
+ return false;
134
+ }
135
+ if (query.collection_path !== this.collection_path) {
136
+ return false;
137
+ }
138
+ if (query.document_id !== this.document_id) {
139
+ return false;
140
+ }
141
+ if (this.query_parameters || query.query_parameters) {
142
+ if (!this.query_parameters || !query.query_parameters) {
143
+ return false;
144
+ }
145
+ if (!compare_query_parameters(query.query_parameters, this.query_parameters)) {
146
+ return false;
147
+ }
148
+ }
149
+ return true;
150
+ }
151
+ static find_query(queries, target) {
152
+ for (let query of queries) {
153
+ if (query.equals(target)) {
154
+ return query;
155
+ }
156
+ }
157
+ return undefined;
158
+ }
159
+ }
160
+ function compare_query_parameters(a, b) {
161
+ let key_value_a = Object.entries(a);
162
+ if (key_value_a.length !== Object.keys(b).length) {
163
+ return false;
164
+ }
165
+ for (let [key, value_a] of key_value_a) {
166
+ let value_b = b[key];
167
+ if (typeof value_a !== typeof value_b) {
168
+ return false;
169
+ }
170
+ if (Array.isArray(value_a)) {
171
+ if (!Array.isArray(value_b)) {
172
+ return false;
173
+ }
174
+ if (!compare_array(value_a, value_b)) {
175
+ return false;
176
+ }
177
+ }
178
+ else if (value_a !== value_b) {
179
+ return false;
180
+ }
181
+ }
182
+ return true;
183
+ }
184
+ function compare_array(a, b) {
185
+ if (a.length !== b.length) {
186
+ return false;
187
+ }
188
+ for (let q = 0; q < a.length; q++) {
189
+ if (a[q] !== b[q]) {
190
+ return false;
191
+ }
192
+ }
193
+ return true;
194
+ }
195
+ function quickprint(query) {
196
+ return {
197
+ id: query.id,
198
+ collection: query.reference.collection_id,
199
+ query_parameters: query.query_parameters
200
+ };
201
+ }
202
+ export class Vitamins {
203
+ vue;
204
+ documents;
205
+ all_queries;
206
+ queries_by_collection;
207
+ debug_on;
208
+ constructor(vue) {
209
+ this.vue = vue;
210
+ this.documents = new Map();
211
+ this.queries_by_collection = new Map();
212
+ this.all_queries = new Map();
213
+ this.debug_on = false;
214
+ }
215
+ query(collection, query_parameters, ...generators) {
216
+ if (!this.queries_by_collection.has(collection.collection_id)) {
217
+ this.queries_by_collection.set(collection.collection_id, new Set());
218
+ }
219
+ let generated_query = new Query(this, collection, query_parameters, generators);
220
+ return generated_query;
221
+ }
222
+ delete_document_from_external(document_id) {
223
+ let document = this.documents.get(document_id);
224
+ if (!document) {
225
+ return;
226
+ }
227
+ let parent_queries = Array.from(document.parents).map(ele => this.all_queries.get(ele));
228
+ document.parents.clear();
229
+ let child_queries = Array.from(document.children).map(ele => this.all_queries.get(ele));
230
+ document.children.clear();
231
+ parent_queries.forEach(ele => ele.unlink_child(document_id));
232
+ child_queries.forEach(ele => ele.unlink_parent(document_id));
233
+ this._cleanup([...parent_queries, ...child_queries], [document]);
234
+ }
235
+ update_document_from_external(document_id, data) {
236
+ return this._update_data(undefined, document_id, data);
237
+ }
238
+ _debug(...print) {
239
+ if (this.debug_on) {
240
+ console.log(print);
241
+ }
242
+ }
243
+ _find_existing_query(query) {
244
+ let collection_queries = this.queries_by_collection.get(query.reference.collection_id);
245
+ let existing_query = Query.find_query(Array.from(collection_queries), query);
246
+ return existing_query;
247
+ }
248
+ _add_query(query) {
249
+ this._debug(`attaching query ${query.id}`);
250
+ if (!this.queries_by_collection.has(query.reference.collection_id)) {
251
+ this.queries_by_collection.set(query.reference.collection_id, new Set());
252
+ }
253
+ let queries = this.queries_by_collection.get(query.reference.collection_id);
254
+ queries.add(query);
255
+ this.all_queries.set(query.id, query);
256
+ }
257
+ _delete_query(query) {
258
+ this.queries_by_collection.get(query.reference.collection_id).delete(query);
259
+ this.all_queries.delete(query.id);
260
+ }
261
+ _add_document(document) {
262
+ this.documents.set(document.document._id, document);
263
+ }
264
+ _update_data(reference, document_id, data, query) {
265
+ let document = this.documents.get(document_id);
266
+ if (!document && reference) {
267
+ document = new Document(this, reference, data);
268
+ this._add_document(document);
269
+ }
270
+ if (!document && !reference) {
271
+ return;
272
+ }
273
+ this._debug(`updating data for a ${document.reference.collection_id} ${document_id}`);
274
+ document.document = data;
275
+ if (query) {
276
+ query.link_child(document);
277
+ }
278
+ let document_previous_children = Array.from(document.children);
279
+ document.children.clear();
280
+ for (let child_query_id of document_previous_children) {
281
+ this.all_queries.get(child_query_id).unlink_parent(document.id);
282
+ }
283
+ let generated_child_queries = this._generate_child_queries(document);
284
+ generated_child_queries.forEach(ele => this._add_query(ele));
285
+ generated_child_queries.forEach(ele => this._debug(quickprint(ele)));
286
+ generated_child_queries.forEach(ele => ele.run(false));
287
+ let test_queries_for_deletion = document_previous_children.map(query_id => this.all_queries.get(query_id));
288
+ let bugfind = Array.from(document_previous_children).filter(id => !this.all_queries.has(id));
289
+ if (bugfind.length > 0) {
290
+ this._debug(`BREAKING ID:`);
291
+ this._debug(bugfind);
292
+ }
293
+ this._cleanup(test_queries_for_deletion, []);
294
+ let cloned_data = structuredClone(data);
295
+ if (!this.vue[document.reference.collection_id]) {
296
+ throw new Error(`when updating ${document.reference.collection_id}, found that the vue app does not have a ${document.reference.collection_id} key`);
297
+ }
298
+ if (!(this.vue[document.reference.collection_id] instanceof Map)) {
299
+ throw new Error(`when updating ${document.reference.collection_id}, found that the vue app key ${document.reference.collection_id} is not a map. It should be a Map<string, ${document.reference.collection_id}>`);
300
+ }
301
+ this.vue[document.reference.collection_id].set(document_id, cloned_data);
302
+ }
303
+ _generate_child_queries(document) {
304
+ let all_generated_child_queries = [];
305
+ for (let query_parent_id of document.parents) {
306
+ let query_parent = this.all_queries.get(query_parent_id);
307
+ let generated_child_queries = query_parent.child_generators.map(generator => generator(document.document));
308
+ for (let q = 0; q < generated_child_queries.length; q++) {
309
+ let generated_child_query = generated_child_queries[q];
310
+ let query = this._find_existing_query(generated_child_query) ?? generated_child_query;
311
+ if (generated_child_query.id !== query.id) {
312
+ generated_child_queries[q] = query;
313
+ }
314
+ generated_child_query.link_parent(document);
315
+ }
316
+ all_generated_child_queries.push(...generated_child_queries);
317
+ }
318
+ return Array.from(new Set(all_generated_child_queries));
319
+ }
320
+ _cleanup(queries, documents) {
321
+ let check_queries_queue = queries.slice();
322
+ let check_documents_queue = documents.slice();
323
+ while (check_queries_queue.length > 0 || check_documents_queue.length > 0) {
324
+ while (check_queries_queue.length > 0) {
325
+ let query = check_queries_queue.pop();
326
+ if (query.parents.size > 0) {
327
+ continue;
328
+ }
329
+ for (let child_id of query.children) {
330
+ let child = this.documents.get(child_id);
331
+ check_documents_queue.push(child);
332
+ child.unlink_parent(query.id);
333
+ }
334
+ this._delete_query(query);
335
+ }
336
+ while (check_documents_queue.length > 0) {
337
+ let document = check_documents_queue.pop();
338
+ if (document.parents.size > 0) {
339
+ continue;
340
+ }
341
+ for (let child_id of document.children) {
342
+ let child = this.all_queries.get(child_id);
343
+ check_queries_queue.push(this.all_queries.get(child_id));
344
+ child.unlink_parent(document.id);
345
+ }
346
+ this.documents.delete(document.id);
347
+ if (!this.vue[document.reference.collection_id]) {
348
+ throw new Error(`when updating ${document.reference.collection_id}, found that the vue app does not have a ${document.reference.collection_id} key`);
349
+ }
350
+ ;
351
+ if (!this.vue[document.reference.collection_id] instanceof Map) {
352
+ throw new Error(`when updating ${document.reference.collection_id}, found that the vue app key ${document.reference.collection_id} is not a map. It should be a Map<string, ${document.reference.collection_id}>`);
353
+ }
354
+ ;
355
+ this.vue[document.reference.collection_id].delete(document.id);
356
+ }
357
+ }
358
+ }
359
+ }
360
+ //# sourceMappingURL=vitamins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitamins.js","sourceRoot":"","sources":["../src/vitamins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AASjC,MAAM,QAAQ;IACV,EAAE,CAAS;IAEX,QAAQ,CAAW;IACnB,QAAQ,CAAc;IACtB,OAAO,CAAc;IACrB,SAAS,CAAgF;IACzF,QAAQ,CAAS;IAEjB,YAAY,QAAkB,EAAE,SAAwF,EAAE,QAAgB;QACtI,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QAEzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC;IAC3B,CAAC;IAED,aAAa,CAAC,EAAU;QACpB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;CACJ;AAED,MAAM,KAAK;IACP,EAAE,CAAS;IACX,QAAQ,CAAW;IACnB,QAAQ,CAAc;IACtB,OAAO,CAAc;IAErB,SAAS,CAAgF;IACzF,eAAe,CAAS;IACxB,SAAS,CAAkB;IAC3B,WAAW,CAAU;IACrB,gBAAgB,CAAO;IAEvB,gBAAgB,CAA4B;IAC5C,OAAO,CAAU;IAEjB,YAAY,QAAkB,EAAE,SAAwF,EAAE,QAAiB,EAAE,mBAA8C,EAAE;QACzL,IAAI,C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AG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBAC3C,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;oBACzD,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACrC,CAAC;gBAED,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBAEnC,IAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,EAAC,CAAC;oBAC5C,MAAM,IAAI,KAAK,CAAC,iBAAiB,QAAQ,CAAC,SAAS,CAAC,aAAa,4CAA4C,QAAQ,CAAC,SAAS,CAAC,aAAa,MAAM,CAAC,CAAA;gBACxJ,CAAC;gBAAA,CAAC;gBAGF,IAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,YAAY,GAAG,EAAC,CAAC;oBAC3D,MAAM,IAAI,KAAK,CAAC,iBAAiB,QAAQ,CAAC,SAAS,CAAC,aAAa,gCAAgC,QAAQ,CAAC,SAAS,CAAC,aAAa,6CAA6C,QAAQ,CAAC,SAAS,CAAC,aAAa,GAAG,CAAC,CAAA;gBACtN,CAAC;gBAAA,CAAC;gBAEF,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YACnE,CAAC;QACL,CAAC;IACL,CAAC;CAGJ"}
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@liminalfunctions/framework-vitamins",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "license": "ISC",
6
+ "author": "",
7
+ "type": "module",
8
+ "main": "./dist/vitamins.js",
9
+ "scripts": {
10
+ "test": "npm run-script build && mocha",
11
+ "build": "tsc"
12
+ },
13
+ "dependencies": {
14
+ "uuid": "^12.0.0"
15
+ },
16
+ "devDependencies": {
17
+ "@types/mocha": "^10.0.10",
18
+ "@types/node": "^24.3.1",
19
+ "mocha": "^11.7.2",
20
+ "tsx": "^4.20.5",
21
+ "typescript": "^5.9.2"
22
+ },
23
+ "peerDependencies": {
24
+ "vue": "^3.5.21"
25
+ }
26
+ }
@@ -0,0 +1,16 @@
1
+ export type result = { _id: string };
2
+ export type generated_collection_interface<T extends result> = {
3
+ path: string[]
4
+ collection_id: string
5
+
6
+ query: (query: any) => Promise<T[]>;
7
+ document: (document_id: string) => generated_document_interface<T>
8
+ }
9
+
10
+ export type generated_document_interface<T extends result> = {
11
+ path: string[]
12
+ collection_id: string,
13
+ document_id: string
14
+ get: () => Promise<T>;
15
+ }
16
+ export type Infer_Collection_Returntype<Type> = Type extends generated_collection_interface<infer E> ? E : never;