axiodb 13.0.1 → 13.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,76 +8,55 @@ export default class DeleteOperation {
8
8
  private readonly baseQuery;
9
9
  private readonly path;
10
10
  private readonly ResponseHelper;
11
- private readonly fileManager;
12
11
  private allDataWithFileName;
13
12
  private sort;
14
13
  constructor(collectionName: string, path: string, baseQuery: object | any);
15
14
  /**
16
15
  * Deletes a single document that matches the base query.
17
16
  *
18
- * This method with ACID compliance:
19
- * 1. Loads all raw data from buffers
20
- * 2. Searches for documents matching the base query
21
- * 3. Selects the first matching document (applying sort if provided)
22
- * 4. Acquires lock on the document
23
- * 5. Deletes the file associated with the selected document
24
- * 6. Releases lock
17
+ * Routed through a single-operation Transaction, so the delete is WAL-backed:
18
+ * locking, the fresh re-read under lock, and index sync are all handled by
19
+ * Transaction/TransactionIndexManager. This method's own job is just picking
20
+ * *which* document to target (honoring .Sort()), since Transaction.delete()
21
+ * removes every document a query matches.
25
22
  *
26
23
  * @returns {Promise<object>} A response object containing either:
27
24
  * - Success: { message: "Data deleted successfully", deleteData: object }
28
25
  * - Error: An error message if no data found or deletion fails
29
- *
30
- * @throws Will propagate any errors from underlying operations
31
26
  */
32
27
  deleteOne(): Promise<SuccessInterface | ErrorInterface>;
33
28
  /**
34
29
  * Deletes multiple documents that match the base query.
35
30
  *
36
- * This method with ACID compliance:
37
- * 1. Searches for documents matching the base query
38
- * 2. Acquires locks on ALL matching documents (ensures atomicity)
39
- * 3. Deletes each matching file
40
- * 4. Releases all locks
41
- * 5. Returns success with the deleted data or an error
31
+ * Routed through a single Transaction covering the whole query, so the batch
32
+ * is WAL-backed: locking, fresh re-reads, and index sync (one rewrite per
33
+ * affected index field, not one per document) are all handled by
34
+ * Transaction/TransactionIndexManager.
42
35
  *
43
36
  * @returns {Promise<SuccessInterface | ErrorInterface>} A promise that resolves to either:
44
37
  * - Success with a success message and the deleted data
45
- * - Error if:
46
- * - No matching data is found
47
- * - Lock acquisition fails
48
- * - Any file deletion operation fails
49
- * - The initial buffer data loading fails
38
+ * - Error if no matching data is found or the transaction failed
50
39
  */
51
40
  deleteMany(): Promise<SuccessInterface | ErrorInterface>;
52
41
  /**
53
- * Loads all buffer raw data from the specified directory.
54
- *
55
- * This method performs the following steps:
56
- * 1. Checks if the directory is locked.
57
- * 2. If the directory is not locked, it lists all files in the directory.
58
- * 3. Reads each file.
59
- * 4. Stores the data in the `AllData` array.
60
- * 5. If the directory is locked, it unlocks the directory, reads the files, and then locks the directory again.
61
- *
62
- * @returns {Promise<SuccessInterface | ErrorInterface>} A promise that resolves to a success or error response.
63
- *
64
- * @throws {Error} Throws an error if any operation fails.
42
+ * to be sorted to the query
43
+ * @param {object} sort - The sort to be set.
44
+ * @returns {DeleteOperation} - An instance of the DeleteOperation class.
65
45
  */
66
- private LoadAllBufferRawData;
46
+ Sort(sort: object | any): DeleteOperation;
67
47
  /**
68
- * Deletes a file from the specified path.
48
+ * Resolves the single document deleteOne should target: runs the same
49
+ * index-or-full-scan search deleteMany's Transaction path uses internally,
50
+ * then applies .Sort() (if set) and picks the first match - matching the
51
+ * "one specific document" semantics deleteOne has always had.
69
52
  *
70
- * @param fileName - The name of the file to be deleted
71
- * @returns A response object indicating success or failure
72
- * Success response: { status: true, message: "File deleted successfully" }
73
- * Error response: { status: false, message: <error message> }
74
- * @private
53
+ * @returns The target document's ID, or null if nothing matched.
75
54
  */
76
- private deleteFile;
55
+ private resolveTargetDocumentId;
77
56
  /**
78
- * to be sorted to the query
79
- * @param {object} sort - The sort to be set.
80
- * @returns {DeleteOperation} - An instance of the DeleteOperation class.
57
+ * Loads all buffer raw data from the specified directory.
58
+ *
59
+ * @returns {Promise<SuccessInterface | ErrorInterface>} A promise that resolves to a success or error response.
81
60
  */
82
- Sort(sort: object | any): DeleteOperation;
61
+ private LoadAllBufferRawData;
83
62
  }
@@ -15,16 +15,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  const response_helper_1 = __importDefault(require("../../Helper/response.helper"));
17
17
  const DocumentLoader_helper_1 = __importDefault(require("../../Helper/DocumentLoader.helper"));
18
- const FileManager_1 = __importDefault(require("../../engine/Filesystem/FileManager"));
19
- const crypto_1 = require("crypto");
20
18
  // Import All Utility
21
19
  const Searcher_utils_1 = __importDefault(require("../../utility/Searcher.utils"));
22
20
  const SortData_utils_1 = __importDefault(require("../../utility/SortData.utils"));
23
- const memory_operation_1 = __importDefault(require("../../Memory/memory.operation"));
24
21
  const Keys_1 = require("../../config/Keys/Keys");
25
22
  const ReadIndex_service_1 = require("../Index/ReadIndex.service");
26
- const DeleteIndex_service_1 = __importDefault(require("../Index/DeleteIndex.service"));
27
- const LockManager_service_1 = __importDefault(require("../Transaction/LockManager.service"));
23
+ const Transaction_service_1 = __importDefault(require("../Transaction/Transaction.service"));
28
24
  /**
29
25
  * The DeleteOperation class is used to delete a document from a collection.
30
26
  * This class provides methods to delete a single document that matches the base query.
@@ -37,220 +33,143 @@ class DeleteOperation {
37
33
  this.baseQuery = baseQuery;
38
34
  this.sort = {};
39
35
  this.ResponseHelper = new response_helper_1.default();
40
- this.fileManager = new FileManager_1.default();
41
36
  this.allDataWithFileName = []; // To store all data with file name
42
37
  }
43
38
  // Methods
44
39
  /**
45
40
  * Deletes a single document that matches the base query.
46
41
  *
47
- * This method with ACID compliance:
48
- * 1. Loads all raw data from buffers
49
- * 2. Searches for documents matching the base query
50
- * 3. Selects the first matching document (applying sort if provided)
51
- * 4. Acquires lock on the document
52
- * 5. Deletes the file associated with the selected document
53
- * 6. Releases lock
42
+ * Routed through a single-operation Transaction, so the delete is WAL-backed:
43
+ * locking, the fresh re-read under lock, and index sync are all handled by
44
+ * Transaction/TransactionIndexManager. This method's own job is just picking
45
+ * *which* document to target (honoring .Sort()), since Transaction.delete()
46
+ * removes every document a query matches.
54
47
  *
55
48
  * @returns {Promise<object>} A response object containing either:
56
49
  * - Success: { message: "Data deleted successfully", deleteData: object }
57
50
  * - Error: An error message if no data found or deletion fails
58
- *
59
- * @throws Will propagate any errors from underlying operations
60
51
  */
61
52
  deleteOne() {
62
53
  return __awaiter(this, void 0, void 0, function* () {
63
54
  var _a;
64
- const lockManager = LockManager_service_1.default.getInstance(this.path);
65
- const operationId = (0, crypto_1.randomUUID)();
66
- const timestamp = Date.now();
67
- let documentId = null;
68
55
  try {
69
- // STEP 1: Find the document first
70
- let ReadResponse; // Read Response Holder
71
- if (((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.documentId) !== undefined) {
72
- const FilePath = [
73
- `${this.baseQuery.documentId}${Keys_1.General.DBMS_File_EXT}`,
74
- ];
75
- ReadResponse = yield this.LoadAllBufferRawData(FilePath);
76
- }
77
- else {
78
- const fileNames = yield new ReadIndex_service_1.ReadIndex(this.path).getFileFromIndex(this.baseQuery);
79
- if (fileNames.length > 0) {
80
- // Load File Names from Index
81
- ReadResponse = yield this.LoadAllBufferRawData(fileNames);
82
- }
83
- else {
84
- ReadResponse = yield this.LoadAllBufferRawData();
85
- }
86
- }
87
- if (!("data" in ReadResponse)) {
88
- return this.ResponseHelper.Error(ReadResponse);
89
- }
90
- const SearchedData = yield new Searcher_utils_1.default(ReadResponse.data, true).find(this.baseQuery, "data");
91
- if (SearchedData.length === 0) {
56
+ const documentId = yield this.resolveTargetDocumentId();
57
+ if (!documentId) {
92
58
  return this.ResponseHelper.Error("No data found with the specified query");
93
59
  }
94
- let selectedFirstData = SearchedData[0]; // Select the first data
95
- let fileName = selectedFirstData === null || selectedFirstData === void 0 ? void 0 : selectedFirstData.fileName; // Get the file name
96
- // Sort the data if sort is provided then select the first data for deletion
97
- if (Object.keys(this.sort).length !== 0) {
98
- const Sorter = new SortData_utils_1.default(SearchedData, this.sort);
99
- const SortedData = yield Sorter.sort("data"); // Sort the data
100
- selectedFirstData = SortedData[0]; // Select the first data
101
- fileName = selectedFirstData === null || selectedFirstData === void 0 ? void 0 : selectedFirstData.fileName; // Get the file name
102
- }
103
- documentId = fileName.split('.')[0];
104
- // STEP 2: Acquire lock on the document (ACID: Isolation)
105
- const lockResult = yield lockManager.acquireLock(documentId, operationId, timestamp);
106
- if (!("data" in lockResult)) {
107
- return this.ResponseHelper.Error("Lock acquisition failed");
60
+ const txn = new Transaction_service_1.default(this.path);
61
+ txn.delete({ documentId });
62
+ const commitResult = yield txn.commit();
63
+ if (!("data" in commitResult)) {
64
+ return commitResult;
108
65
  }
109
- // STEP 3: Re-read under lock. The Step 1 snapshot's field values can be stale if
110
- // another writer updated this document while we waited for the lock - deleting
111
- // the file is unaffected by that, but cleaning up the index with stale field
112
- // values would remove the wrong index entry and leave a dangling one behind.
113
- const freshRead = yield DocumentLoader_helper_1.default.loadDocuments(this.path, [fileName], true);
114
- if (!("data" in freshRead) || freshRead.data.length === 0) {
66
+ const deleteOp = ((_a = commitResult.data.resolvedOperations) !== null && _a !== void 0 ? _a : []).find((op) => op.type === "DELETE" && op.documentId === documentId);
67
+ if (!deleteOp) {
115
68
  return this.ResponseHelper.Error("Document no longer exists");
116
69
  }
117
- const currentData = freshRead.data[0].data;
118
- // STEP 4: Delete the file (now safe - locked)
119
- const deleteResponse = yield this.deleteFile(fileName);
120
- if (!("data" in deleteResponse)) {
121
- return this.ResponseHelper.Error("Failed to delete data");
122
- }
123
- // Fire-and-forget: Remove from indexes and invalidate cache asynchronously for faster response
124
- const isDeleted = yield new DeleteIndex_service_1.default(this.path).RemoveFromIndex(documentId, currentData).catch(() => { });
125
- if (isDeleted) {
126
- yield memory_operation_1.default.invalidateByDocument(this.path, documentId).catch(() => { });
127
- return this.ResponseHelper.Success({
128
- message: "Data deleted successfully",
129
- deleteData: currentData,
130
- });
131
- }
132
- else {
133
- return this.ResponseHelper.Error("Failed to remove from index & invalidate cache");
134
- }
70
+ return this.ResponseHelper.Success({
71
+ message: "Data deleted successfully",
72
+ deleteData: deleteOp.oldData,
73
+ });
135
74
  }
136
- finally {
137
- // STEP 4: Always release lock (ACID: ensures no deadlock)
138
- if (documentId) {
139
- yield lockManager.releaseLock(documentId).catch(() => { });
140
- }
75
+ catch (error) {
76
+ return this.ResponseHelper.Error("Failed to delete data");
141
77
  }
142
78
  });
143
79
  }
144
80
  /**
145
81
  * Deletes multiple documents that match the base query.
146
82
  *
147
- * This method with ACID compliance:
148
- * 1. Searches for documents matching the base query
149
- * 2. Acquires locks on ALL matching documents (ensures atomicity)
150
- * 3. Deletes each matching file
151
- * 4. Releases all locks
152
- * 5. Returns success with the deleted data or an error
83
+ * Routed through a single Transaction covering the whole query, so the batch
84
+ * is WAL-backed: locking, fresh re-reads, and index sync (one rewrite per
85
+ * affected index field, not one per document) are all handled by
86
+ * Transaction/TransactionIndexManager.
153
87
  *
154
88
  * @returns {Promise<SuccessInterface | ErrorInterface>} A promise that resolves to either:
155
89
  * - Success with a success message and the deleted data
156
- * - Error if:
157
- * - No matching data is found
158
- * - Lock acquisition fails
159
- * - Any file deletion operation fails
160
- * - The initial buffer data loading fails
90
+ * - Error if no matching data is found or the transaction failed
161
91
  */
162
92
  deleteMany() {
163
93
  return __awaiter(this, void 0, void 0, function* () {
164
- const lockManager = LockManager_service_1.default.getInstance(this.path);
165
- const operationId = (0, crypto_1.randomUUID)();
166
- const timestamp = Date.now();
167
- const acquiredLocks = [];
94
+ var _a;
168
95
  try {
169
- // STEP 1: Find all matching documents
170
- let response;
171
- const fileNames = yield new ReadIndex_service_1.ReadIndex(this.path).getFileFromIndex(this.baseQuery);
172
- if (fileNames.length > 0) {
173
- // Load File Names from Index
174
- response = yield this.LoadAllBufferRawData(fileNames);
175
- }
176
- else {
177
- response = yield this.LoadAllBufferRawData();
178
- }
179
- if (!("data" in response)) {
180
- return this.ResponseHelper.Error(response);
181
- }
182
- const SearchedData = yield new Searcher_utils_1.default(response.data, true).find(this.baseQuery, "data");
183
- if (SearchedData.length === 0) {
96
+ const txn = new Transaction_service_1.default(this.path);
97
+ txn.delete(this.baseQuery);
98
+ const commitResult = yield txn.commit();
99
+ if (!("data" in commitResult)) {
100
+ return commitResult;
101
+ }
102
+ const deleteOps = ((_a = commitResult.data.resolvedOperations) !== null && _a !== void 0 ? _a : []).filter((op) => op.type === "DELETE");
103
+ if (deleteOps.length === 0) {
184
104
  return this.ResponseHelper.Error("No data found with the specified query");
185
105
  }
186
- // STEP 2: Extract all document IDs and acquire locks on ALL documents
187
- const documentIds = SearchedData.map((data) => data.fileName.split('.')[0]);
188
- for (const docId of documentIds) {
189
- const lockResult = yield lockManager.acquireLock(docId, operationId, timestamp);
190
- if (!("data" in lockResult)) {
191
- // Lock acquisition failed - rollback
192
- return this.ResponseHelper.Error(`Lock acquisition failed for document ${docId}`);
193
- }
194
- acquiredLocks.push(docId);
195
- }
196
- // STEP 3: All locks acquired - re-read current data under lock. The Step 1
197
- // snapshot can be stale for any document another writer touched while we were
198
- // queued behind its lock (see UpdateOne for the full race) - deleting the file
199
- // is unaffected, but stale field values would clean up the wrong index entry.
200
- const fileNamesToRefresh = SearchedData.map((d) => d.fileName);
201
- const freshRead = yield DocumentLoader_helper_1.default.loadDocuments(this.path, fileNamesToRefresh, true);
202
- if (!("data" in freshRead)) {
203
- return this.ResponseHelper.Error("Failed to re-read documents under lock");
204
- }
205
- const freshDataByFileName = new Map(freshRead.data.map((d) => [d.fileName, d.data]));
206
- // STEP 4: All locks acquired - now perform deletions safely
207
- const deleteIndexService = new DeleteIndex_service_1.default(this.path);
208
- for (let i = 0; i < SearchedData.length; i++) {
209
- const fileName = SearchedData[i].fileName;
210
- const currentData = freshDataByFileName.get(fileName);
211
- if (!currentData) {
212
- return this.ResponseHelper.Error(`Document ${fileName} no longer exists`);
213
- }
214
- const deleteResponse = yield this.deleteFile(fileName);
215
- if (!("data" in deleteResponse)) {
216
- return this.ResponseHelper.Error("Failed to delete data");
217
- }
218
- // Fire-and-forget: Remove from indexes asynchronously
219
- yield deleteIndexService.RemoveFromIndex(fileName.split('.')[0], currentData).catch(() => { });
220
- }
221
- // Fire-and-forget: Invalidate cache asynchronously
222
- const isRemoved = yield memory_operation_1.default.invalidateByDocuments(this.path, documentIds).catch(() => { });
223
- if (isRemoved) {
224
- return this.ResponseHelper.Success({
225
- message: "Data deleted successfully",
226
- deleteData: SearchedData.map((data) => freshDataByFileName.get(data.fileName)),
227
- });
106
+ return this.ResponseHelper.Success({
107
+ message: "Data deleted successfully",
108
+ deleteData: deleteOps.map((op) => op.oldData),
109
+ });
110
+ }
111
+ catch (error) {
112
+ return this.ResponseHelper.Error("Failed to delete data");
113
+ }
114
+ });
115
+ }
116
+ /**
117
+ * to be sorted to the query
118
+ * @param {object} sort - The sort to be set.
119
+ * @returns {DeleteOperation} - An instance of the DeleteOperation class.
120
+ */
121
+ Sort(sort) {
122
+ this.sort = sort;
123
+ return this;
124
+ }
125
+ /**
126
+ * Resolves the single document deleteOne should target: runs the same
127
+ * index-or-full-scan search deleteMany's Transaction path uses internally,
128
+ * then applies .Sort() (if set) and picks the first match - matching the
129
+ * "one specific document" semantics deleteOne has always had.
130
+ *
131
+ * @returns The target document's ID, or null if nothing matched.
132
+ */
133
+ resolveTargetDocumentId() {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ var _a;
136
+ let ReadResponse;
137
+ if (((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.documentId) !== undefined) {
138
+ const FilePath = [
139
+ `${this.baseQuery.documentId}${Keys_1.General.DBMS_File_EXT}`,
140
+ ];
141
+ ReadResponse = yield this.LoadAllBufferRawData(FilePath);
142
+ }
143
+ else {
144
+ const fileNames = yield new ReadIndex_service_1.ReadIndex(this.path).getFileFromIndex(this.baseQuery);
145
+ if (fileNames.length > 0) {
146
+ ReadResponse = yield this.LoadAllBufferRawData(fileNames);
228
147
  }
229
148
  else {
230
- return this.ResponseHelper.Error("Failed to invalidate cache after deletion");
149
+ ReadResponse = yield this.LoadAllBufferRawData();
231
150
  }
232
151
  }
233
- finally {
234
- // STEP 4: Always release ALL acquired locks (ACID: ensures no deadlock)
235
- if (acquiredLocks.length > 0) {
236
- yield lockManager.releaseAllLocks(acquiredLocks).catch(() => { });
237
- }
152
+ if (!("data" in ReadResponse)) {
153
+ return null;
238
154
  }
155
+ const SearchedData = yield new Searcher_utils_1.default(ReadResponse.data, true).find(this.baseQuery, "data");
156
+ if (SearchedData.length === 0) {
157
+ return null;
158
+ }
159
+ let selectedFirstData = SearchedData[0];
160
+ if (Object.keys(this.sort).length !== 0) {
161
+ const Sorter = new SortData_utils_1.default(SearchedData, this.sort);
162
+ const SortedData = yield Sorter.sort("data");
163
+ selectedFirstData = SortedData[0];
164
+ }
165
+ const fileName = selectedFirstData === null || selectedFirstData === void 0 ? void 0 : selectedFirstData.fileName;
166
+ return fileName ? fileName.split(".")[0] : null;
239
167
  });
240
168
  }
241
169
  /**
242
170
  * Loads all buffer raw data from the specified directory.
243
171
  *
244
- * This method performs the following steps:
245
- * 1. Checks if the directory is locked.
246
- * 2. If the directory is not locked, it lists all files in the directory.
247
- * 3. Reads each file.
248
- * 4. Stores the data in the `AllData` array.
249
- * 5. If the directory is locked, it unlocks the directory, reads the files, and then locks the directory again.
250
- *
251
172
  * @returns {Promise<SuccessInterface | ErrorInterface>} A promise that resolves to a success or error response.
252
- *
253
- * @throws {Error} Throws an error if any operation fails.
254
173
  */
255
174
  LoadAllBufferRawData(documentIdDirectFile) {
256
175
  return __awaiter(this, void 0, void 0, function* () {
@@ -264,29 +183,6 @@ class DeleteOperation {
264
183
  return result;
265
184
  });
266
185
  }
267
- /**
268
- * Deletes a file from the specified path.
269
- *
270
- * @param fileName - The name of the file to be deleted
271
- * @returns A response object indicating success or failure
272
- * Success response: { status: true, message: "File deleted successfully" }
273
- * Error response: { status: false, message: <error message> }
274
- * @private
275
- */
276
- deleteFile(fileName) {
277
- return __awaiter(this, void 0, void 0, function* () {
278
- return yield this.fileManager.DeleteFileWithLock(this.path, fileName);
279
- });
280
- }
281
- /**
282
- * to be sorted to the query
283
- * @param {object} sort - The sort to be set.
284
- * @returns {DeleteOperation} - An instance of the DeleteOperation class.
285
- */
286
- Sort(sort) {
287
- this.sort = sort;
288
- return this;
289
- }
290
186
  }
291
187
  exports.default = DeleteOperation;
292
188
  //# sourceMappingURL=Delete.operation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Delete.operation.js","sourceRoot":"","sources":["../../../source/Services/CRUD Operation/Delete.operation.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;;;;;;;;;;;;AAMvD,mFAA0D;AAC1D,+FAAgE;AAChE,sFAA8D;AAC9D,mCAAoC;AAEpC,qBAAqB;AACrB,kFAAoD;AACpD,kFAAmD;AACnD,qFAA0D;AAC1D,iDAAiD;AACjD,kEAAuD;AACvD,uFAAuD;AACvD,6FAA6D;AAC7D;;;GAGG;AACH;IAUE,YACE,cAAsB,EACtB,IAAY,EACZ,SAAuB;QANjB,wBAAmB,GAAU,EAAE,CAAC;QAQtC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,cAAc,GAAG,IAAI,yBAAc,EAAE,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,IAAI,qBAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC,CAAC,mCAAmC;IACpE,CAAC;IAED,UAAU;IACV;;;;;;;;;;;;;;;;OAgBG;IACU,SAAS;;;YACpB,MAAM,WAAW,GAAG,6BAAW,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvD,MAAM,WAAW,GAAG,IAAA,mBAAU,GAAE,CAAC;YACjC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7B,IAAI,UAAU,GAAkB,IAAI,CAAC;YAErC,IAAI,CAAC;gBACH,kCAAkC;gBAClC,IAAI,YAAY,CAAC,CAAC,uBAAu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M,WAAW,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;OAaG;IACW,oBAAoB,CAChC,oBAA2C;;YAE3C,wEAAwE;YACxE,MAAM,MAAM,GAAG,MAAM,+BAAc,CAAC,aAAa,CAC/C,IAAI,CAAC,IAAI,EACT,oBAAoB,EACpB,IAAI,CAAE,yCAAyC;aAChD,CAAC;YAEF,oDAAoD;YACpD,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;gBACrB,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC;YACzC,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;IAED;;;;;;;;OAQG;IACW,UAAU,CAAC,QAAgB;;YACvC,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxE,CAAC;KAAA;IAED;;;;OAIG;IACI,IAAI,CAAC,IAAkB;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
1
+ {"version":3,"file":"Delete.operation.js","sourceRoot":"","sources":["../../../source/Services/CRUD Operation/Delete.operation.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;;;;;;;;;;;;AAMvD,mFAA0D;AAC1D,+FAAgE;AAEhE,qBAAqB;AACrB,kFAAoD;AACpD,kFAAmD;AACnD,iDAAiD;AACjD,kEAAuD;AACvD,6FAA6D;AAC7D;;;GAGG;AACH;IASE,YACE,cAAsB,EACtB,IAAY,EACZ,SAAuB;QANjB,wBAAmB,GAAU,EAAE,CAAC;QAQtC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,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AI,CAAC,IAAI,CAAC,CAAC;gBAC7D,MAAM,UAAU,GAAU,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACpD,iBAAiB,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YACpC,CAAC;YAED,MAAM,QAAQ,GAAW,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,QAAQ,CAAC;YACrD,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAClD,CAAC;KAAA;IAED;;;;OAIG;IACW,oBAAoB,CAChC,oBAA2C;;YAE3C,wEAAwE;YACxE,MAAM,MAAM,GAAG,MAAM,+BAAc,CAAC,aAAa,CAC/C,IAAI,CAAC,IAAI,EACT,oBAAoB,EACpB,IAAI,CAAE,yCAAyC;aAChD,CAAC;YAEF,oDAAoD;YACpD,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;gBACrB,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC;YACzC,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF"}
@@ -6,70 +6,56 @@ export default class UpdateOperation {
6
6
  private readonly ResponseHelper;
7
7
  private allDataWithFileName;
8
8
  private sort;
9
- private updatedAt;
10
- private readonly Insertion;
11
9
  constructor(collectionName: string, path: string, baseQuery: object | any);
12
10
  /**
13
11
  * Updates a single document that matches the base query.
14
12
  *
15
- * This method performs the following operations with ACID compliance:
16
- * 1. Acquires lock on document to ensure atomicity and isolation
17
- * 2. Searches for documents matching the base query
18
- * 3. If documents are found, selects the first document (or first after sorting if sort criteria are provided)
19
- * 4. Deletes the existing document file
20
- * 5. Inserts a new file with updated data using the same document ID
21
- * 6. Releases lock
13
+ * Routed through a single-operation Transaction, so the update is WAL-backed:
14
+ * locking, the fresh re-read under lock, atomic file replacement, and index
15
+ * sync are all handled by Transaction/TransactionIndexManager - the same
16
+ * machinery insert() already uses. This method's own job is just picking
17
+ * *which* document to target (honoring .Sort()), since Transaction.update()
18
+ * touches every document a query matches.
22
19
  *
23
20
  * @param newData - The new data to replace the existing document
24
21
  * @returns A Promise resolving to:
25
22
  * - Success with updated data and previous data if successful
26
- * - Error if any step fails (lock acquisition, read, update)
27
- * @throws May throw errors during file operations or data processing
23
+ * - Error if no document matched or the transaction failed
28
24
  */
29
25
  UpdateOne(newData: object | any): Promise<SuccessInterface | ErrorInterface>;
30
26
  /**
31
27
  * Updates multiple documents that match the base query.
32
28
  *
33
- * This method performs the following operations with ACID compliance:
34
- * 1. Searches for documents matching the base query
35
- * 2. Acquires locks on ALL matching documents (ensures atomicity across all updates)
36
- * 3. Deletes the existing documents
37
- * 4. Inserts new files with updated data for each document
38
- * 5. Releases all locks
29
+ * Routed through a single Transaction covering the whole query, so the batch
30
+ * is WAL-backed: locking, fresh re-reads, atomic file replacement, and index
31
+ * sync (one rewrite per affected index field, not one per document) are all
32
+ * handled by Transaction/TransactionIndexManager.
39
33
  *
40
34
  * @param newData - The new data to replace the existing documents
41
35
  * @returns A Promise resolving to:
42
- * - Success with updated data and previous data if successful
43
- * - Error if any step fails (rollback by releasing all acquired locks)
44
- * @throws May throw errors during file operations or data processing
36
+ * - Success with the count and IDs of updated documents
37
+ * - Error if no document matched or the transaction failed
45
38
  */
46
39
  UpdateMany(newData: object | any): Promise<SuccessInterface | ErrorInterface>;
47
40
  /**
48
- * to be sorted to the query this.createdAt = new Date().toISOString();
49
- this.updatedAt = this.createdAt; // Initially updatedAt is same as createdAt
41
+ * to be sorted to the query
50
42
  * @param {object} sort - The sort to be set.
51
- * @returns {DeleteOperation} - An instance of the DeleteOperation class.
43
+ * @returns {UpdateOperation} - An instance of the UpdateOperation class.
52
44
  */
53
45
  Sort(sort: object | any): UpdateOperation;
54
46
  /**
55
- * Loads all buffer raw data from the specified directory.
47
+ * Resolves the single document UpdateOne should target: runs the same
48
+ * index-or-full-scan search UpdateMany's Transaction path uses internally,
49
+ * then applies .Sort() (if set) and picks the first match - matching the
50
+ * "one specific document" semantics UpdateOne has always had.
56
51
  *
57
- * This method performs the following steps:
58
- * 1. Checks if the directory is locked.
59
- * 2. If the directory is not locked, it lists all files in the directory.
60
- * 3. Reads each file.
61
- * 4. Stores the data in the `AllData` array.
62
- * 5. If the directory is locked, it unlocks the directory, reads the files, and then locks the directory again.
52
+ * @returns The target document's ID, or null if nothing matched.
53
+ */
54
+ private resolveTargetDocumentId;
55
+ /**
56
+ * Loads all buffer raw data from the specified directory.
63
57
  *
64
58
  * @returns {Promise<SuccessInterface | ErrorInterface>} A promise that resolves to a success or error response.
65
- *
66
- * @throws {Error} Throws an error if any operation fails.
67
59
  */
68
60
  private LoadAllBufferRawData;
69
- /**
70
- * Inserts a document into the collection.
71
- * @param {object} data - The data to be inserted.
72
- * @returns {Promise<any>} - A promise that resolves with the response of the insertion operation.
73
- */
74
- private insertUpdate;
75
61
  }