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
@@ -38,6 +38,32 @@ export default class Database {
38
38
  * @throws {Error} - Throws an error if the database does not exist.
39
39
  */
40
40
  getCollectionInfo(): Promise<SuccessInterface | undefined>;
41
+ /**
42
+ * Removes the metadata entry for a collection from the collection metadata file.
43
+ *
44
+ * Reads the JSON file located at `${this.path}/collection.meta`, validates that the
45
+ * file exists and contains an array of collection metadata objects, removes any entry
46
+ * whose `name` matches the provided `collectionName`, and writes the updated array
47
+ * back to the same file.
48
+ *
49
+ * The method returns a SuccessInterface on successful removal (even if no matching
50
+ * collection was found) or an ErrorInterface describing the failure.
51
+ *
52
+ * @param collectionName - The name of the collection whose metadata should be removed.
53
+ * @returns A promise that resolves to SuccessInterface on success or ErrorInterface on failure.
54
+ *
55
+ * @remarks
56
+ * - If the metadata file does not exist, an ErrorInterface is returned.
57
+ * - If the metadata file cannot be parsed as a JSON array, an ErrorInterface is returned.
58
+ * - This method performs I/O using a FileManager instance and uses this.ResponseHelper
59
+ * to construct success/error responses. It does not throw; failures are reported via
60
+ * the returned ErrorInterface.
61
+ *
62
+ * @example
63
+ * // Remove the "users" collection metadata
64
+ * await db.dropCollectionMetadata("users");
65
+ */
66
+ dropCollectionMetadata(collectionName: string): Promise<SuccessInterface | ErrorInterface>;
41
67
  /**
42
68
  * Adds metadata for a collection to the collection metadata file.
43
69
  *
@@ -21,6 +21,7 @@ const path_1 = __importDefault(require("path"));
21
21
  const Crypto_helper_1 = require("../../Helper/Crypto.helper");
22
22
  const response_helper_1 = __importDefault(require("../../Helper/response.helper"));
23
23
  const outers_1 = require("outers");
24
+ const Index_service_1 = require("../Index/Index.service");
24
25
  /**
25
26
  * Represents a database instance.
26
27
  * This class provides methods to create, delete, and manage collections within a database.
@@ -57,6 +58,9 @@ class Database {
57
58
  yield this.folderManager.CreateDirectory(collectionPath);
58
59
  console.log(`Collection Created: ${collectionPath}`);
59
60
  }
61
+ // Create AutoIndex meta for the collection
62
+ const Index = new Index_service_1.IndexManager(collectionPath);
63
+ yield Index.generateIndexMeta();
60
64
  // if crypto is enabled, hash the collection name
61
65
  if (crypto === true) {
62
66
  const newCryptoInstance = new Crypto_helper_1.CryptoHelper(key);
@@ -106,6 +110,11 @@ class Database {
106
110
  const collectionPath = path_1.default.join(this.path, collectionName);
107
111
  const exists = yield this.folderManager.DirectoryExists(collectionPath);
108
112
  if (exists.statusCode === outers_1.StatusCodes.OK) {
113
+ // Remove collection metadata
114
+ const status = yield this.dropCollectionMetadata(collectionName);
115
+ if (status && "statusCode" in status && status.statusCode !== 200) {
116
+ return status;
117
+ }
109
118
  yield this.folderManager.DeleteDirectory(collectionPath);
110
119
  return this.ResponseHelper.Success(`Collection: ${collectionName} deleted successfully`);
111
120
  }
@@ -142,6 +151,49 @@ class Database {
142
151
  }
143
152
  });
144
153
  }
154
+ /**
155
+ * Removes the metadata entry for a collection from the collection metadata file.
156
+ *
157
+ * Reads the JSON file located at `${this.path}/collection.meta`, validates that the
158
+ * file exists and contains an array of collection metadata objects, removes any entry
159
+ * whose `name` matches the provided `collectionName`, and writes the updated array
160
+ * back to the same file.
161
+ *
162
+ * The method returns a SuccessInterface on successful removal (even if no matching
163
+ * collection was found) or an ErrorInterface describing the failure.
164
+ *
165
+ * @param collectionName - The name of the collection whose metadata should be removed.
166
+ * @returns A promise that resolves to SuccessInterface on success or ErrorInterface on failure.
167
+ *
168
+ * @remarks
169
+ * - If the metadata file does not exist, an ErrorInterface is returned.
170
+ * - If the metadata file cannot be parsed as a JSON array, an ErrorInterface is returned.
171
+ * - This method performs I/O using a FileManager instance and uses this.ResponseHelper
172
+ * to construct success/error responses. It does not throw; failures are reported via
173
+ * the returned ErrorInterface.
174
+ *
175
+ * @example
176
+ * // Remove the "users" collection metadata
177
+ * await db.dropCollectionMetadata("users");
178
+ */
179
+ dropCollectionMetadata(collectionName) {
180
+ return __awaiter(this, void 0, void 0, function* () {
181
+ const FileManagement = new FileManager_1.default();
182
+ const isFileExist = yield FileManagement.FileExists(`${this.path}/collection.meta`);
183
+ if (isFileExist.status == false) {
184
+ return this.ResponseHelper.Error("Collection metadata file does not exist");
185
+ }
186
+ else {
187
+ const FullData = JSON.parse((yield FileManagement.ReadFile(`${this.path}/collection.meta`)).data);
188
+ if (!Array.isArray(FullData)) {
189
+ return this.ResponseHelper.Error("Invalid collection metadata format");
190
+ }
191
+ const UpdatedData = FullData.filter((data) => data.name !== collectionName);
192
+ yield FileManagement.WriteFile(`${this.path}/collection.meta`, JSON.stringify(UpdatedData));
193
+ return this.ResponseHelper.Success(`Collection metadata for ${collectionName} dropped successfully`);
194
+ }
195
+ });
196
+ }
145
197
  /**
146
198
  * Adds metadata for a collection to the collection metadata file.
147
199
  *
@@ -1 +1 @@
1
- {"version":3,"file":"database.operation.js","sourceRoot":"","sources":["../../../source/Services/Database/database.operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,8FAA4D;AAC5D,sFAA8D;AAC9D,0FAAkE;AAClE,gDAAwB;AAExB,qBAAqB;AACrB,8DAA0D;AAC1D,mFAA0D;AAC1D,mCAAqC;AAerC;;;GAGG;AACH,MAAqB,QAAQ;IAO3B,YAAY,IAAY,EAAE,IAAY;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,IAAI,qBAAW,EAAE,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,uBAAa,EAAE,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,yBAAc,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACU,gBAAgB;6DAC3B,cAAsB,EACtB,SAAkB,KAAK,EACvB,GAAwB;YAExB,yCAAyC;YACzC,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,CAC/D,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CACrC,CAAC;YACF,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;YAE5D,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;YAE3E,IAAI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EAAE,CAAC;YACtD,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,UAAU,CACjD,GAAG,IAAI,CAAC,IAAI,kBAAkB,CAC/B,CAAC;YACF,IAAI,WAAW,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;gBAChC,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,CAAC,MAAM,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,IAAI,CACrE,CAAC;YACF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC7B,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAClC,CAAC,IAAwB,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CAC3D,CAAC;YACF,OAAO,cAAc,CAAC;QACxB,CAAC;KAAA;CACF;AAzOD,2BAyOC"}
1
+ {"version":3,"file":"database.operation.js","sourceRoot":"","sources":["../../../source/Services/Database/database.operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,8FAA4D;AAC5D,sFAA8D;AAC9D,0FAAkE;AAClE,gDAAwB;AAExB,qBAAqB;AACrB,8DAA0D;AAC1D,mFAA0D;AAC1D,mCAAqC;AAMrC,0DAAsD;AAUtD;;;GAGG;AACH,MAAqB,QAAQ;IAO3B,YAAY,IAAY,EAAE,IAAY;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,IAAI,qBAAW,EAAE,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,uBAAa,EAAE,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,yBAAc,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;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face, SuccessInterface } from "../../config/Interfaces/Helper/response.helper.interface";
2
+ import FileManager from "../../engine/Filesystem/FileManager";
3
+ import FolderManager from "../../engine/Filesystem/FolderManager";
4
+ import Converter from "../../Helper/Converter.helper";
5
+ import ResponseHelper from "../../Helper/response.helper";
6
+ export declare class IndexManager {
7
+ readonly path: string;
8
+ readonly indexFolderPath: string;
9
+ readonly indexMetaPath: string;
10
+ readonly fileManager: FileManager;
11
+ readonly folderManager: FolderManager;
12
+ readonly converter: Converter;
13
+ readonly ResponseHelper: ResponseHelper;
14
+ constructor(path: string);
15
+ /**
16
+ * Create one or more index files and register them in the index metadata.
17
+ *
18
+ * For each supplied field name this method:
19
+ * 1. Determines the index file path as `${indexName}.axiodb` inside the configured index folder.
20
+ * 2. Checks whether the index file already exists. If it does not, creates the file with an empty
21
+ * index structure ({ fieldName, indexEntries: [] }).
22
+ * 3. Reads the index metadata file (index.meta.json), parses it, and if an entry for the index
23
+ * field does not already exist, appends a metadata record `{ indexFieldName, fileName, path }`
24
+ * and writes the metadata file back.
25
+ *
26
+ * Side effects:
27
+ * - Writes new index files to disk via `fileManager.WriteFile`.
28
+ * - Reads and updates the index metadata file via `fileManager.ReadFile` / `WriteFile`.
29
+ * - Uses the configured `converter` to serialize/deserialize index and metadata content.
30
+ *
31
+ * Notes:
32
+ * - The operation is not atomic: some indexes may be created while others fail. The method will
33
+ * collect created and failed index names and include them in the returned response.
34
+ * - A failure is recorded for a field when the index file already exists, when the index already
35
+ * exists in the metadata, or when reading/writing the metadata file fails.
36
+ * - The method relies on `indexFolderPath`, `indexMetaPath`, `fileManager`, and `converter`
37
+ * being correctly configured and available on the instance.
38
+ *
39
+ * @param fieldNames - One or more field names for which to create indexes.
40
+ * @returns A promise that resolves to either:
41
+ * - SuccessInterface: indicates which indexes were created and which already existed / failed,
42
+ * typically containing a human-readable message listing affected and existing indexes.
43
+ * - ErrorInterface: returned when underlying file/IO operations fail in a way that prevents
44
+ * producing the expected success response.
45
+ *
46
+ * @example
47
+ * // Create a single index
48
+ * await service.createIndex('email');
49
+ *
50
+ * @example
51
+ * // Create multiple indexes
52
+ * await service.createIndex('email', 'username', 'createdAt');
53
+ */
54
+ createIndex(...fieldNames: string[]): Promise<SuccessInterface | undefined>;
55
+ /**
56
+ * Deletes an index file and removes its entry from the index metadata.
57
+ *
58
+ * This asynchronous method attempts to delete the index file located at
59
+ * `${this.indexFolderPath}/${indexName}.axiodb`. If the file exists it is removed,
60
+ * and the index metadata file at `this.indexMetaPath` is read and updated by
61
+ * filtering out the metadata entry whose `indexFieldName` matches `indexName`.
62
+ * The metadata update is performed only if the metadata file can be read successfully.
63
+ *
64
+ * @param indexName - The name of the index to delete (without extension).
65
+ * @returns A Promise that resolves to a SuccessInterface when the index was deleted
66
+ * (and metadata updated when possible), or an ErrorInterface when the
67
+ * specified index does not exist.
68
+ *
69
+ * @async
70
+ * @remarks
71
+ * - Side effects: removes a file from the file system and may modify the index metadata file.
72
+ * - Uses injected helpers: `fileManager` for filesystem operations, `converter` for
73
+ * (de)serialization of metadata, and `ResponseHelper` to construct the returned result.
74
+ * - If the metadata file cannot be read, the method still succeeds after deleting the index file.
75
+ *
76
+ * @throws {Error} May propagate errors from underlying file operations if those utilities throw.
77
+ */
78
+ dropIndex(indexName: string): Promise<SuccessInterface | ErrorInterface>;
79
+ /**
80
+ * Ensures the index folder and the index metadata file exist, creating them if necessary.
81
+ *
82
+ * This asynchronous method performs the following steps:
83
+ * 1. Checks whether the index folder at `this.indexFolderPath` exists; if not, creates it.
84
+ * 2. Checks whether the index metadata file at `this.indexMetaPath` exists; if not:
85
+ * a. Constructs a default index metadata entry for a unique "documentId" index:
86
+ * - indexFieldName: "documentId"
87
+ * - fileName: "documentId.axiodb"
88
+ * - path: `${this.indexFolderPath}/documentId.axiodb`
89
+ * - unique: true
90
+ * b. Calls `this.createIndex("documentId")` to create the underlying index file/structure.
91
+ * c. Writes the metadata array to `this.indexMetaPath` using `this.converter.ToString(...)`.
92
+ *
93
+ * The operation is idempotent: if the folder or metadata file already exist, no changes are made.
94
+ *
95
+ * @remarks
96
+ * - This method performs filesystem modifications via `folderManager` and `fileManager`.
97
+ * - Any errors thrown by `folderManager`, `fileManager`, `converter`, or `createIndex` will propagate to the caller.
98
+ * - Callers should `await` this method to ensure the initialization is complete before proceeding.
99
+ *
100
+ * @returns A Promise that resolves when initialization is complete.
101
+ *
102
+ * @throws Will reject if directory creation, file checks/writes, conversion, or index creation fails.
103
+ *
104
+ * @example
105
+ * // Ensure index folder and metadata exist before using the index service
106
+ * await indexService.generateIndexMeta();
107
+ */
108
+ generateIndexMeta(): Promise<void>;
109
+ /**
110
+ * Finds index metadata entries that correspond to properties present on the provided document.
111
+ *
112
+ * Reads the index metadata file at `this.indexMetaPath`, converts its content into an object,
113
+ * and returns the subset of metadata entries whose `indexFieldName` is an own property of `doc`.
114
+ *
115
+ * @param doc - The document to check for matching index fields. The function tests own properties
116
+ * (via `Object.prototype.hasOwnProperty.call`) rather than inherited properties.
117
+ * @returns A Promise that resolves to an array of matching index metadata entries, or `undefined`
118
+ * if the index metadata file could not be successfully read. The array may be empty if
119
+ * no metadata entries match.
120
+ *
121
+ * @throws May propagate errors from `fileManager.ReadFile` or `converter.ToObject` if those
122
+ * operations throw or reject.
123
+ */
124
+ protected findMatchingIndexMeta(doc: any): Promise<any[] | undefined>;
125
+ }
@@ -0,0 +1,231 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.IndexManager = void 0;
16
+ const Keys_1 = require("../../config/Keys/Keys");
17
+ const FileManager_1 = __importDefault(require("../../engine/Filesystem/FileManager"));
18
+ const FolderManager_1 = __importDefault(require("../../engine/Filesystem/FolderManager"));
19
+ const Converter_helper_1 = __importDefault(require("../../Helper/Converter.helper"));
20
+ const response_helper_1 = __importDefault(require("../../Helper/response.helper"));
21
+ class IndexManager {
22
+ constructor(path) {
23
+ this.path = path;
24
+ this.indexFolderPath = `${this.path}/indexes`;
25
+ this.indexMetaPath = `${this.indexFolderPath}/index.meta.json`;
26
+ this.fileManager = new FileManager_1.default();
27
+ this.folderManager = new FolderManager_1.default();
28
+ this.converter = new Converter_helper_1.default();
29
+ this.ResponseHelper = new response_helper_1.default();
30
+ }
31
+ /**
32
+ * Create one or more index files and register them in the index metadata.
33
+ *
34
+ * For each supplied field name this method:
35
+ * 1. Determines the index file path as `${indexName}.axiodb` inside the configured index folder.
36
+ * 2. Checks whether the index file already exists. If it does not, creates the file with an empty
37
+ * index structure ({ fieldName, indexEntries: [] }).
38
+ * 3. Reads the index metadata file (index.meta.json), parses it, and if an entry for the index
39
+ * field does not already exist, appends a metadata record `{ indexFieldName, fileName, path }`
40
+ * and writes the metadata file back.
41
+ *
42
+ * Side effects:
43
+ * - Writes new index files to disk via `fileManager.WriteFile`.
44
+ * - Reads and updates the index metadata file via `fileManager.ReadFile` / `WriteFile`.
45
+ * - Uses the configured `converter` to serialize/deserialize index and metadata content.
46
+ *
47
+ * Notes:
48
+ * - The operation is not atomic: some indexes may be created while others fail. The method will
49
+ * collect created and failed index names and include them in the returned response.
50
+ * - A failure is recorded for a field when the index file already exists, when the index already
51
+ * exists in the metadata, or when reading/writing the metadata file fails.
52
+ * - The method relies on `indexFolderPath`, `indexMetaPath`, `fileManager`, and `converter`
53
+ * being correctly configured and available on the instance.
54
+ *
55
+ * @param fieldNames - One or more field names for which to create indexes.
56
+ * @returns A promise that resolves to either:
57
+ * - SuccessInterface: indicates which indexes were created and which already existed / failed,
58
+ * typically containing a human-readable message listing affected and existing indexes.
59
+ * - ErrorInterface: returned when underlying file/IO operations fail in a way that prevents
60
+ * producing the expected success response.
61
+ *
62
+ * @example
63
+ * // Create a single index
64
+ * await service.createIndex('email');
65
+ *
66
+ * @example
67
+ * // Create multiple indexes
68
+ * await service.createIndex('email', 'username', 'createdAt');
69
+ */
70
+ createIndex(...fieldNames) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const EffectedIndexes = [];
73
+ const FailedIndexes = [];
74
+ for (const fieldName of fieldNames) {
75
+ const indexName = fieldName;
76
+ const indexFilePath = `${this.indexFolderPath}/${indexName}${Keys_1.General.DBMS_File_EXT}`;
77
+ const DemoIndexHash = {
78
+ fieldName: indexName,
79
+ indexEntries: {},
80
+ };
81
+ const exists = yield this.fileManager.FileExists(indexFilePath);
82
+ if (!exists.status) {
83
+ // create empty index file
84
+ yield this.fileManager.WriteFile(indexFilePath, this.converter.ToString(DemoIndexHash));
85
+ // Update index.meta.json
86
+ const indexMetaContent = yield this.fileManager.ReadFile(this.indexMetaPath);
87
+ if (indexMetaContent.status) {
88
+ const indexMeta = this.converter.ToObject(indexMetaContent.data);
89
+ // check if index already exists in meta
90
+ const indexExists = indexMeta.find((index) => index.indexFieldName === indexName);
91
+ if (!indexExists) {
92
+ indexMeta.push({
93
+ indexFieldName: indexName,
94
+ fileName: `${indexName}${Keys_1.General.DBMS_File_EXT}`,
95
+ path: indexFilePath,
96
+ });
97
+ yield this.fileManager.WriteFile(this.indexMetaPath, this.converter.ToString(indexMeta));
98
+ EffectedIndexes.push(indexName);
99
+ return this.ResponseHelper.Success(`Indexes: ${EffectedIndexes.join(", ")} created Indexes: ${FailedIndexes.join(", ")}`);
100
+ }
101
+ else {
102
+ FailedIndexes.push(indexName);
103
+ }
104
+ }
105
+ }
106
+ }
107
+ });
108
+ }
109
+ /**
110
+ * Deletes an index file and removes its entry from the index metadata.
111
+ *
112
+ * This asynchronous method attempts to delete the index file located at
113
+ * `${this.indexFolderPath}/${indexName}.axiodb`. If the file exists it is removed,
114
+ * and the index metadata file at `this.indexMetaPath` is read and updated by
115
+ * filtering out the metadata entry whose `indexFieldName` matches `indexName`.
116
+ * The metadata update is performed only if the metadata file can be read successfully.
117
+ *
118
+ * @param indexName - The name of the index to delete (without extension).
119
+ * @returns A Promise that resolves to a SuccessInterface when the index was deleted
120
+ * (and metadata updated when possible), or an ErrorInterface when the
121
+ * specified index does not exist.
122
+ *
123
+ * @async
124
+ * @remarks
125
+ * - Side effects: removes a file from the file system and may modify the index metadata file.
126
+ * - Uses injected helpers: `fileManager` for filesystem operations, `converter` for
127
+ * (de)serialization of metadata, and `ResponseHelper` to construct the returned result.
128
+ * - If the metadata file cannot be read, the method still succeeds after deleting the index file.
129
+ *
130
+ * @throws {Error} May propagate errors from underlying file operations if those utilities throw.
131
+ */
132
+ dropIndex(indexName) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ const indexFilePath = `${this.indexFolderPath}/${indexName}${Keys_1.General.DBMS_File_EXT}`;
135
+ // check if index file exists
136
+ const exists = yield this.fileManager.FileExists(indexFilePath);
137
+ if (exists.status === true) {
138
+ // delete index file
139
+ yield this.fileManager.DeleteFile(indexFilePath);
140
+ // update index.meta.json
141
+ const indexMetaContent = yield this.fileManager.ReadFile(this.indexMetaPath);
142
+ if (indexMetaContent.status) {
143
+ let indexMeta = this.converter.ToObject(indexMetaContent.data);
144
+ indexMeta = indexMeta.filter((index) => index.indexFieldName !== indexName);
145
+ yield this.fileManager.WriteFile(this.indexMetaPath, this.converter.ToString(indexMeta));
146
+ }
147
+ return this.ResponseHelper.Success(`Index: ${indexName} deleted successfully`);
148
+ }
149
+ else {
150
+ return this.ResponseHelper.Error(`Index: ${indexName} does not exist`);
151
+ }
152
+ });
153
+ }
154
+ /**
155
+ * Ensures the index folder and the index metadata file exist, creating them if necessary.
156
+ *
157
+ * This asynchronous method performs the following steps:
158
+ * 1. Checks whether the index folder at `this.indexFolderPath` exists; if not, creates it.
159
+ * 2. Checks whether the index metadata file at `this.indexMetaPath` exists; if not:
160
+ * a. Constructs a default index metadata entry for a unique "documentId" index:
161
+ * - indexFieldName: "documentId"
162
+ * - fileName: "documentId.axiodb"
163
+ * - path: `${this.indexFolderPath}/documentId.axiodb`
164
+ * - unique: true
165
+ * b. Calls `this.createIndex("documentId")` to create the underlying index file/structure.
166
+ * c. Writes the metadata array to `this.indexMetaPath` using `this.converter.ToString(...)`.
167
+ *
168
+ * The operation is idempotent: if the folder or metadata file already exist, no changes are made.
169
+ *
170
+ * @remarks
171
+ * - This method performs filesystem modifications via `folderManager` and `fileManager`.
172
+ * - Any errors thrown by `folderManager`, `fileManager`, `converter`, or `createIndex` will propagate to the caller.
173
+ * - Callers should `await` this method to ensure the initialization is complete before proceeding.
174
+ *
175
+ * @returns A Promise that resolves when initialization is complete.
176
+ *
177
+ * @throws Will reject if directory creation, file checks/writes, conversion, or index creation fails.
178
+ *
179
+ * @example
180
+ * // Ensure index folder and metadata exist before using the index service
181
+ * await indexService.generateIndexMeta();
182
+ */
183
+ generateIndexMeta() {
184
+ return __awaiter(this, void 0, void 0, function* () {
185
+ // check is index.meta.json exists or not
186
+ const folderExists = yield this.folderManager.DirectoryExists(this.indexFolderPath);
187
+ if (!folderExists.status) {
188
+ yield this.folderManager.CreateDirectory(this.indexFolderPath);
189
+ }
190
+ const exists = yield this.fileManager.FileExists(this.indexMetaPath);
191
+ if (!exists.status) {
192
+ // create index.meta.json
193
+ const indexMeta = [
194
+ {
195
+ indexFieldName: "documentId",
196
+ path: `${this.indexFolderPath}/documentId${Keys_1.General.DBMS_File_EXT}`,
197
+ fileName: `documentId${Keys_1.General.DBMS_File_EXT}`
198
+ }
199
+ ];
200
+ yield this.createIndex("documentId");
201
+ yield this.fileManager.WriteFile(this.indexMetaPath, this.converter.ToString(indexMeta));
202
+ }
203
+ });
204
+ }
205
+ /**
206
+ * Finds index metadata entries that correspond to properties present on the provided document.
207
+ *
208
+ * Reads the index metadata file at `this.indexMetaPath`, converts its content into an object,
209
+ * and returns the subset of metadata entries whose `indexFieldName` is an own property of `doc`.
210
+ *
211
+ * @param doc - The document to check for matching index fields. The function tests own properties
212
+ * (via `Object.prototype.hasOwnProperty.call`) rather than inherited properties.
213
+ * @returns A Promise that resolves to an array of matching index metadata entries, or `undefined`
214
+ * if the index metadata file could not be successfully read. The array may be empty if
215
+ * no metadata entries match.
216
+ *
217
+ * @throws May propagate errors from `fileManager.ReadFile` or `converter.ToObject` if those
218
+ * operations throw or reject.
219
+ */
220
+ findMatchingIndexMeta(doc) {
221
+ return __awaiter(this, void 0, void 0, function* () {
222
+ const indexMetaContent = yield this.fileManager.ReadFile(this.indexMetaPath);
223
+ if (indexMetaContent.status) {
224
+ const indexMeta = this.converter.ToObject(indexMetaContent.data);
225
+ return indexMeta.filter((meta) => Object.prototype.hasOwnProperty.call(doc, meta.indexFieldName));
226
+ }
227
+ });
228
+ }
229
+ }
230
+ exports.IndexManager = IndexManager;
231
+ //# sourceMappingURL=Index.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Index.service.js","sourceRoot":"","sources":["../../../source/Services/Index/Index.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,iDAAiD;AACjD,sFAA8D;AAC9D,0FAAkE;AAClE,qFAAsD;AACtD,mFAA0D;AAE1D,MAAa,YAAY;IAUvB,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,GAAG,IAAI,CAAC,IAAI,UAAU,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,GAAG,IAAI,CAAC,eAAe,kBAAkB,CAAC;QAC/D,IAAI,CAAC,WAAW,GAAG,IAAI,qBAAW,EAAE,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,uBAAa,EAAE,CA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EAAE;qBAC/C;iBACF,CAAC;gBACF,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;gBACpC,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;YAC3F,CAAC;QACH,CAAC;KAAA;IAGD;;;;;;;;;;;;;;OAcG;IACa,qBAAqB,CAAE,GAAQ;;YAC7C,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,MAAM,CAAC,CAAC,IAA8B,EAAE,EAAE,CACzD,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,CAC/D,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF;AA3ND,oCA2NC"}
@@ -0,0 +1,34 @@
1
+ import { IndexManager } from "./Index.service";
2
+ export default class InsertIndex extends IndexManager {
3
+ constructor(path: string);
4
+ /**
5
+ * Inserts a document identifier into one or more index files as defined by the global index meta.
6
+ *
7
+ * The method:
8
+ * 1. Reads the global index meta from `this.indexMetaPath` and converts it to an object using `this.converter`.
9
+ * 2. Calls `this.findMatchingIndexMeta(document)` to determine which index files should be updated for the provided document.
10
+ * 3. For each matched index entry:
11
+ * - Reads the index file at `index.path`,
12
+ * - Converts its contents to an object,
13
+ * - Appends `${document.documentId}${General.DBMS_File_EXT}` to `indexMeta.indexEntries`,
14
+ * - Writes the updated index back to disk.
15
+ *
16
+ * @param document - Object representing the document to index. Must contain a `documentId` property (string | number).
17
+ * @returns A Promise that resolves to:
18
+ * - `true` if the last index file write operation returned a success status,
19
+ * - `false` if the global index meta could not be read, no matching index meta entries were found, or the final write returned a falsy status.
20
+ *
21
+ * @throws Propagates any exceptions thrown by file reads/writes or conversion (e.g., IO or parse/serialize errors).
22
+ *
23
+ * @remarks
24
+ * - The method appends the document entry and does not deduplicate existing entries.
25
+ * - When multiple index files are updated, the returned boolean reflects the status of the final write operation only.
26
+ * - The operation is not atomic across multiple index files; concurrent invocations may produce race conditions.
27
+ *
28
+ * @example
29
+ * // document must include documentId:
30
+ * // { documentId: "abc123", ... }
31
+ * const success = await indexService.InsertToIndex({ documentId: "abc123" });
32
+ */
33
+ InsertToIndex(document: any): Promise<boolean>;
34
+ }
@@ -0,0 +1,79 @@
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
+ /* eslint-disable @typescript-eslint/no-explicit-any */
13
+ const Keys_1 = require("../../config/Keys/Keys");
14
+ const Index_service_1 = require("./Index.service");
15
+ class InsertIndex extends Index_service_1.IndexManager {
16
+ constructor(path) {
17
+ super(path);
18
+ }
19
+ /**
20
+ * Inserts a document identifier into one or more index files as defined by the global index meta.
21
+ *
22
+ * The method:
23
+ * 1. Reads the global index meta from `this.indexMetaPath` and converts it to an object using `this.converter`.
24
+ * 2. Calls `this.findMatchingIndexMeta(document)` to determine which index files should be updated for the provided document.
25
+ * 3. For each matched index entry:
26
+ * - Reads the index file at `index.path`,
27
+ * - Converts its contents to an object,
28
+ * - Appends `${document.documentId}${General.DBMS_File_EXT}` to `indexMeta.indexEntries`,
29
+ * - Writes the updated index back to disk.
30
+ *
31
+ * @param document - Object representing the document to index. Must contain a `documentId` property (string | number).
32
+ * @returns A Promise that resolves to:
33
+ * - `true` if the last index file write operation returned a success status,
34
+ * - `false` if the global index meta could not be read, no matching index meta entries were found, or the final write returned a falsy status.
35
+ *
36
+ * @throws Propagates any exceptions thrown by file reads/writes or conversion (e.g., IO or parse/serialize errors).
37
+ *
38
+ * @remarks
39
+ * - The method appends the document entry and does not deduplicate existing entries.
40
+ * - When multiple index files are updated, the returned boolean reflects the status of the final write operation only.
41
+ * - The operation is not atomic across multiple index files; concurrent invocations may produce race conditions.
42
+ *
43
+ * @example
44
+ * // document must include documentId:
45
+ * // { documentId: "abc123", ... }
46
+ * const success = await indexService.InsertToIndex({ documentId: "abc123" });
47
+ */
48
+ InsertToIndex(document) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const matchedIndex = yield this.findMatchingIndexMeta(document);
51
+ if (matchedIndex) {
52
+ if (matchedIndex.length == 0) {
53
+ return false;
54
+ }
55
+ let status = false;
56
+ for (const indexes of matchedIndex) {
57
+ const path = indexes.path;
58
+ const IndexName = indexes.indexFieldName;
59
+ const indexContent = yield this.fileManager.ReadFile(path);
60
+ const indexMeta = this.converter.ToObject(indexContent.data);
61
+ const alreadyhave = Object.keys(indexMeta.indexEntries).some(keys => keys == document[IndexName]);
62
+ if (alreadyhave) {
63
+ indexMeta.indexEntries[document[IndexName]].push(`${document.documentId}${Keys_1.General.DBMS_File_EXT}`);
64
+ }
65
+ else {
66
+ indexMeta.indexEntries[document[IndexName]] = [`${document.documentId}${Keys_1.General.DBMS_File_EXT}`];
67
+ }
68
+ // Write it back
69
+ const staus = yield this.fileManager.WriteFile(path, this.converter.ToString(indexMeta));
70
+ status = staus.status;
71
+ }
72
+ return status;
73
+ }
74
+ return false;
75
+ });
76
+ }
77
+ }
78
+ exports.default = InsertIndex;
79
+ //# sourceMappingURL=InsertIndex.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InsertIndex.service.js","sourceRoot":"","sources":["../../../source/Services/Index/InsertIndex.service.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uDAAuD;AACvD,iDAAiD;AACjD,mDAA+C;AAE/C,MAAqB,WAAY,SAAQ,4BAAY;IAEnD,YAAa,IAAY;QACvB,KAAK,CAAC,IAAI,CAAC,CAAA;IACb,CAAC;IAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BC;IACY,aAAa,CAAC,QAAa;;YACpC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAA;YAE/D,IAAI,YAAY,EAAC,CAAC;gBAElB,IAAI,YAAY,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;oBAC7B,OAAO,KAAK,CAAA;gBACd,CAAC;gBAED,IAAI,MAAM,GAAY,KAAK,CAAC;gBAC5B,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;oBACnC,MAAM,IAAI,GAAW,OAAO,CAAC,IAAI,CAAC;oBAClC,MAAM,SAAS,GAAW,OAAO,CAAC,cAAc,CAAA;oBAChD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;oBAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;oBAC7D,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;oBACjG,IAAI,WAAW,EAAC,CAAC;wBACf,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,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