axiodb 3.32.114 → 4.32.117

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 (26) hide show
  1. package/lib/Services/Aggregation/Aggregation.Operation.js +33 -17
  2. package/lib/Services/Aggregation/Aggregation.Operation.js.map +1 -1
  3. package/lib/Services/CRUD Operation/Create.operation.js +1 -1
  4. package/lib/Services/CRUD Operation/Create.operation.js.map +1 -1
  5. package/lib/Services/CRUD Operation/Delete.operation.js +30 -13
  6. package/lib/Services/CRUD Operation/Delete.operation.js.map +1 -1
  7. package/lib/Services/CRUD Operation/Reader.operation.js +10 -2
  8. package/lib/Services/CRUD Operation/Reader.operation.js.map +1 -1
  9. package/lib/Services/CRUD Operation/Update.operation.js +32 -19
  10. package/lib/Services/CRUD Operation/Update.operation.js.map +1 -1
  11. package/lib/Services/Collection/collection.operation.d.ts +22 -0
  12. package/lib/Services/Collection/collection.operation.js +32 -0
  13. package/lib/Services/Collection/collection.operation.js.map +1 -1
  14. package/lib/Services/Database/database.operation.d.ts +26 -0
  15. package/lib/Services/Database/database.operation.js +52 -0
  16. package/lib/Services/Database/database.operation.js.map +1 -1
  17. package/lib/Services/Index/Index.service.d.ts +125 -0
  18. package/lib/Services/Index/Index.service.js +231 -0
  19. package/lib/Services/Index/Index.service.js.map +1 -0
  20. package/lib/Services/Index/InsertIndex.service.d.ts +34 -0
  21. package/lib/Services/Index/InsertIndex.service.js +79 -0
  22. package/lib/Services/Index/InsertIndex.service.js.map +1 -0
  23. package/lib/Services/Index/ReadIndex.service.d.ts +44 -0
  24. package/lib/Services/Index/ReadIndex.service.js +81 -0
  25. package/lib/Services/Index/ReadIndex.service.js.map +1 -0
  26. package/package.json +1 -1
@@ -0,0 +1,44 @@
1
+ import { IndexManager } from "./Index.service";
2
+ export declare class ReadIndex extends IndexManager {
3
+ constructor(path: string);
4
+ /**
5
+ * Retrieve file path(s) from an index that match the provided query.
6
+ *
7
+ * @param query - An object containing the value to look up. The concrete lookup key is determined
8
+ * by the matched index metadata's `fieldName` (i.e. the method will use
9
+ * query[metaContent.fieldName] to find entries).
10
+ *
11
+ * @returns A Promise that resolves to an array of string file paths associated with the query value.
12
+ * If no matching index metadata is found, the promise resolves to an empty array.
13
+ * If a matching index is found but no entries exist for the queried value, the returned
14
+ * value may be undefined at runtime (callers should guard against a missing entry).
15
+ *
16
+ * @remarks
17
+ * - This method calls `findMatchingIndexMeta(query)` to locate the appropriate index metadata.
18
+ * - When a match is found, it reads the index file via `fileManager.ReadFile(...)` and converts the
19
+ * file content to an object using `converter.ToObject(...)`.
20
+ * - The resolved object is expected to have `indexEntries` and `fieldName` properties. The method
21
+ * uses `indexEntries[query[fieldName]]` to obtain the associated file list.
22
+ * - The index object is logged to the console for debugging purposes.
23
+ *
24
+ * @throws The returned promise will reject if reading or parsing the index file fails (for example,
25
+ * due to I/O errors or converter failures).
26
+ */
27
+ getFileFromIndex(query: any): Promise<string[]>;
28
+ /**
29
+ * Finds index metadata entries that correspond to properties present on the provided document.
30
+ *
31
+ * Reads the index metadata file at `this.indexMetaPath`, converts its content into an object,
32
+ * and returns the subset of metadata entries whose `indexFieldName` is an own property of `doc`.
33
+ *
34
+ * @param doc - The document to check for matching index fields. The function tests own properties
35
+ * (via `Object.prototype.hasOwnProperty.call`) rather than inherited properties.
36
+ * @returns A Promise that resolves to an array of matching index metadata entries, or `undefined`
37
+ * if the index metadata file could not be successfully read. The array may be empty if
38
+ * no metadata entries match.
39
+ *
40
+ * @throws May propagate errors from `fileManager.ReadFile` or `converter.ToObject` if those
41
+ * operations throw or reject.
42
+ */
43
+ protected findMatchingIndexMeta(document: any): Promise<any | undefined>;
44
+ }
@@ -0,0 +1,81 @@
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
+ exports.ReadIndex = void 0;
13
+ /* eslint-disable @typescript-eslint/no-explicit-any */
14
+ const Index_service_1 = require("./Index.service");
15
+ class ReadIndex extends Index_service_1.IndexManager {
16
+ constructor(path) {
17
+ super(path);
18
+ }
19
+ /**
20
+ * Retrieve file path(s) from an index that match the provided query.
21
+ *
22
+ * @param query - An object containing the value to look up. The concrete lookup key is determined
23
+ * by the matched index metadata's `fieldName` (i.e. the method will use
24
+ * query[metaContent.fieldName] to find entries).
25
+ *
26
+ * @returns A Promise that resolves to an array of string file paths associated with the query value.
27
+ * If no matching index metadata is found, the promise resolves to an empty array.
28
+ * If a matching index is found but no entries exist for the queried value, the returned
29
+ * value may be undefined at runtime (callers should guard against a missing entry).
30
+ *
31
+ * @remarks
32
+ * - This method calls `findMatchingIndexMeta(query)` to locate the appropriate index metadata.
33
+ * - When a match is found, it reads the index file via `fileManager.ReadFile(...)` and converts the
34
+ * file content to an object using `converter.ToObject(...)`.
35
+ * - The resolved object is expected to have `indexEntries` and `fieldName` properties. The method
36
+ * uses `indexEntries[query[fieldName]]` to obtain the associated file list.
37
+ * - The index object is logged to the console for debugging purposes.
38
+ *
39
+ * @throws The returned promise will reject if reading or parsing the index file fails (for example,
40
+ * due to I/O errors or converter failures).
41
+ */
42
+ getFileFromIndex(query) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const matchedIndexFile = yield this.findMatchingIndexMeta(query);
45
+ if (matchedIndexFile !== undefined) {
46
+ const metaContent = this.converter.ToObject((yield this.fileManager.ReadFile(matchedIndexFile.path)).data);
47
+ const finalValueFiles = metaContent.indexEntries[query[metaContent.fieldName]];
48
+ return finalValueFiles;
49
+ }
50
+ else {
51
+ return [];
52
+ }
53
+ });
54
+ }
55
+ /**
56
+ * Finds index metadata entries that correspond to properties present on the provided document.
57
+ *
58
+ * Reads the index metadata file at `this.indexMetaPath`, converts its content into an object,
59
+ * and returns the subset of metadata entries whose `indexFieldName` is an own property of `doc`.
60
+ *
61
+ * @param doc - The document to check for matching index fields. The function tests own properties
62
+ * (via `Object.prototype.hasOwnProperty.call`) rather than inherited properties.
63
+ * @returns A Promise that resolves to an array of matching index metadata entries, or `undefined`
64
+ * if the index metadata file could not be successfully read. The array may be empty if
65
+ * no metadata entries match.
66
+ *
67
+ * @throws May propagate errors from `fileManager.ReadFile` or `converter.ToObject` if those
68
+ * operations throw or reject.
69
+ */
70
+ findMatchingIndexMeta(document) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const indexMetaContent = yield this.fileManager.ReadFile(this.indexMetaPath);
73
+ if (indexMetaContent.status) {
74
+ const indexMeta = this.converter.ToObject(indexMetaContent.data);
75
+ return indexMeta.find((meta) => Object.prototype.hasOwnProperty.call(document, meta.indexFieldName));
76
+ }
77
+ });
78
+ }
79
+ }
80
+ exports.ReadIndex = ReadIndex;
81
+ //# sourceMappingURL=ReadIndex.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadIndex.service.js","sourceRoot":"","sources":["../../../source/Services/Index/ReadIndex.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAuD;AACvD,mDAA+C;AAE/C,MAAa,SAAU,SAAQ,4BAAY;IAEzC,YAAa,IAAY;QACvB,KAAK,CAAC,IAAI,CAAC,CAAA;IACb,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,gBAAgB,CAAE,KAAU;;YACvC,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAA;YAChE,IAAG,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBAClC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC3G,MAAM,eAAe,GAAG,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAA;gBAC9E,OAAO,eAAe,CAAC;YACzB,CAAC;iBACI,CAAC;gBACJ,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;KAcC;IACe,qBAAqB,CAAC,QAAa;;YACjD,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC7E,IAAI,gBAAgB,CAAC,MAAM,EAAE,CAAC;gBAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBACjE,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,IAA8B,EAAE,EAAE,CACvD,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CACpE,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF;AAjED,8BAiEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axiodb",
3
- "version": "3.32.114",
3
+ "version": "4.32.117",
4
4
  "description": "The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platform issues—pure JavaScript from npm install to production.",
5
5
  "main": "./lib/config/DB.js",
6
6
  "types": "./lib/config/DB.d.ts",