backfarm 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.
Files changed (141) hide show
  1. package/dist/chunk-7QVYU63E.js +7 -0
  2. package/dist/chunk-7QVYU63E.js.map +1 -0
  3. package/dist/chunk-BMPUYKJJ.js +148 -0
  4. package/dist/chunk-BMPUYKJJ.js.map +1 -0
  5. package/dist/chunk-EB35KLDE.js +49 -0
  6. package/dist/chunk-EB35KLDE.js.map +1 -0
  7. package/dist/chunk-EWQYVPOL.js +30 -0
  8. package/dist/chunk-EWQYVPOL.js.map +1 -0
  9. package/dist/chunk-FMCW72HO.js +110 -0
  10. package/dist/chunk-FMCW72HO.js.map +1 -0
  11. package/dist/chunk-GBXVVI2R.js +528 -0
  12. package/dist/chunk-GBXVVI2R.js.map +1 -0
  13. package/dist/chunk-HZ4GLSOO.js +91 -0
  14. package/dist/chunk-HZ4GLSOO.js.map +1 -0
  15. package/dist/chunk-I6VD2JKM.js +72 -0
  16. package/dist/chunk-I6VD2JKM.js.map +1 -0
  17. package/dist/chunk-IN3YY526.js +165 -0
  18. package/dist/chunk-IN3YY526.js.map +1 -0
  19. package/dist/chunk-MEQAHLW6.js +135 -0
  20. package/dist/chunk-MEQAHLW6.js.map +1 -0
  21. package/dist/chunk-MNSQSU7T.js +90 -0
  22. package/dist/chunk-MNSQSU7T.js.map +1 -0
  23. package/dist/chunk-NDJVYPUT.js +61 -0
  24. package/dist/chunk-NDJVYPUT.js.map +1 -0
  25. package/dist/chunk-NMNAPTVV.js +91 -0
  26. package/dist/chunk-NMNAPTVV.js.map +1 -0
  27. package/dist/chunk-P5XJG7OG.js +71 -0
  28. package/dist/chunk-P5XJG7OG.js.map +1 -0
  29. package/dist/chunk-SSFPGDA3.js +73 -0
  30. package/dist/chunk-SSFPGDA3.js.map +1 -0
  31. package/dist/chunk-UWIMSKL5.js +35 -0
  32. package/dist/chunk-UWIMSKL5.js.map +1 -0
  33. package/dist/chunk-W2745SOE.js +38 -0
  34. package/dist/chunk-W2745SOE.js.map +1 -0
  35. package/dist/chunk-X3R3RLXY.js +62 -0
  36. package/dist/chunk-X3R3RLXY.js.map +1 -0
  37. package/dist/engine/cloudBucket/r2Storage.d.ts +5 -0
  38. package/dist/engine/cloudBucket/r2Storage.js +10 -0
  39. package/dist/engine/cloudBucket/r2Storage.js.map +1 -0
  40. package/dist/engine/mondoDb/mongoDB.d.ts +6 -0
  41. package/dist/engine/mondoDb/mongoDB.js +11 -0
  42. package/dist/engine/mondoDb/mongoDB.js.map +1 -0
  43. package/dist/engine/multer/multer_configs.d.ts +6 -0
  44. package/dist/engine/multer/multer_configs.js +11 -0
  45. package/dist/engine/multer/multer_configs.js.map +1 -0
  46. package/dist/engine/server/app.d.ts +5 -0
  47. package/dist/engine/server/app.js +8 -0
  48. package/dist/engine/server/app.js.map +1 -0
  49. package/dist/engine/server/server.d.ts +6 -0
  50. package/dist/engine/server/server.js +17 -0
  51. package/dist/engine/server/server.js.map +1 -0
  52. package/dist/engine/sql/mySql.d.ts +7 -0
  53. package/dist/engine/sql/mySql.js +13 -0
  54. package/dist/engine/sql/mySql.js.map +1 -0
  55. package/dist/engine/sql/pgSql.d.ts +7 -0
  56. package/dist/engine/sql/pgSql.js +13 -0
  57. package/dist/engine/sql/pgSql.js.map +1 -0
  58. package/dist/event-streams-PM4LQKAH.js +993 -0
  59. package/dist/event-streams-PM4LQKAH.js.map +1 -0
  60. package/dist/utility/libs/env.d.ts +24 -0
  61. package/dist/utility/libs/env.js +8 -0
  62. package/dist/utility/libs/env.js.map +1 -0
  63. package/dist/utility/libs/interface.d.ts +114 -0
  64. package/dist/utility/libs/interface.js +1 -0
  65. package/dist/utility/libs/interface.js.map +1 -0
  66. package/dist/utility/libs/types.d.ts +207 -0
  67. package/dist/utility/libs/types.js +6 -0
  68. package/dist/utility/libs/types.js.map +1 -0
  69. package/dist/utility/utilis/cloud_storage/deleteFile.d.ts +9 -0
  70. package/dist/utility/utilis/cloud_storage/deleteFile.js +60 -0
  71. package/dist/utility/utilis/cloud_storage/deleteFile.js.map +1 -0
  72. package/dist/utility/utilis/cloud_storage/deleteFiles.d.ts +9 -0
  73. package/dist/utility/utilis/cloud_storage/deleteFiles.js +89 -0
  74. package/dist/utility/utilis/cloud_storage/deleteFiles.js.map +1 -0
  75. package/dist/utility/utilis/cloud_storage/downloadFile.d.ts +9 -0
  76. package/dist/utility/utilis/cloud_storage/downloadFile.js +74 -0
  77. package/dist/utility/utilis/cloud_storage/downloadFile.js.map +1 -0
  78. package/dist/utility/utilis/cloud_storage/downloadFiles.d.ts +9 -0
  79. package/dist/utility/utilis/cloud_storage/downloadFiles.js +88 -0
  80. package/dist/utility/utilis/cloud_storage/downloadFiles.js.map +1 -0
  81. package/dist/utility/utilis/cloud_storage/s3Client.d.ts +5 -0
  82. package/dist/utility/utilis/cloud_storage/s3Client.js +17 -0
  83. package/dist/utility/utilis/cloud_storage/s3Client.js.map +1 -0
  84. package/dist/utility/utilis/cloud_storage/uploadFile.d.ts +51 -0
  85. package/dist/utility/utilis/cloud_storage/uploadFile.js +14 -0
  86. package/dist/utility/utilis/cloud_storage/uploadFile.js.map +1 -0
  87. package/dist/utility/utilis/cloud_storage/uploadFiles.d.ts +73 -0
  88. package/dist/utility/utilis/cloud_storage/uploadFiles.js +49 -0
  89. package/dist/utility/utilis/cloud_storage/uploadFiles.js.map +1 -0
  90. package/dist/utility/utilis/general/error_handler.d.ts +31 -0
  91. package/dist/utility/utilis/general/error_handler.js +8 -0
  92. package/dist/utility/utilis/general/error_handler.js.map +1 -0
  93. package/dist/utility/utilis/general/file-operations.d.ts +140 -0
  94. package/dist/utility/utilis/general/file-operations.js +19 -0
  95. package/dist/utility/utilis/general/file-operations.js.map +1 -0
  96. package/dist/utility/utilis/general/sqlDb.js.d.ts +151 -0
  97. package/dist/utility/utilis/general/sqlDb.js.js +13 -0
  98. package/dist/utility/utilis/general/sqlDb.js.js.map +1 -0
  99. package/dist/utility/utilis/general/uuids.d.ts +55 -0
  100. package/dist/utility/utilis/general/uuids.js +8 -0
  101. package/dist/utility/utilis/general/uuids.js.map +1 -0
  102. package/dist/utility/utilis/general/web.d.ts +247 -0
  103. package/dist/utility/utilis/general/web.js +13 -0
  104. package/dist/utility/utilis/general/web.js.map +1 -0
  105. package/dist/utility/utilis/mongoDb/buldWrite.d.ts +53 -0
  106. package/dist/utility/utilis/mongoDb/buldWrite.js +32 -0
  107. package/dist/utility/utilis/mongoDb/buldWrite.js.map +1 -0
  108. package/dist/utility/utilis/mongoDb/deleteDocument.d.ts +54 -0
  109. package/dist/utility/utilis/mongoDb/deleteDocument.js +34 -0
  110. package/dist/utility/utilis/mongoDb/deleteDocument.js.map +1 -0
  111. package/dist/utility/utilis/mongoDb/insertField.d.ts +40 -0
  112. package/dist/utility/utilis/mongoDb/insertField.js +33 -0
  113. package/dist/utility/utilis/mongoDb/insertField.js.map +1 -0
  114. package/dist/utility/utilis/mongoDb/insertFields.d.ts +48 -0
  115. package/dist/utility/utilis/mongoDb/insertFields.js +35 -0
  116. package/dist/utility/utilis/mongoDb/insertFields.js.map +1 -0
  117. package/dist/utility/utilis/mongoDb/updateFiled.d.ts +65 -0
  118. package/dist/utility/utilis/mongoDb/updateFiled.js +40 -0
  119. package/dist/utility/utilis/mongoDb/updateFiled.js.map +1 -0
  120. package/dist/utility/utilis/multer/upload_batch.d.ts +7 -0
  121. package/dist/utility/utilis/multer/upload_batch.js +17 -0
  122. package/dist/utility/utilis/multer/upload_batch.js.map +1 -0
  123. package/dist/utility/utilis/multer/upload_single.d.ts +7 -0
  124. package/dist/utility/utilis/multer/upload_single.js +16 -0
  125. package/dist/utility/utilis/multer/upload_single.js.map +1 -0
  126. package/dist/utility/utilis/postgres/executeQuery.d.ts +215 -0
  127. package/dist/utility/utilis/postgres/executeQuery.js +46 -0
  128. package/dist/utility/utilis/postgres/executeQuery.js.map +1 -0
  129. package/dist/utility/utilis/postgres/subSqlfiles/executeMySqlQuery.d.ts +9 -0
  130. package/dist/utility/utilis/postgres/subSqlfiles/executeMySqlQuery.js +10 -0
  131. package/dist/utility/utilis/postgres/subSqlfiles/executeMySqlQuery.js.map +1 -0
  132. package/dist/utility/utilis/postgres/subSqlfiles/executePgQuery.d.ts +11 -0
  133. package/dist/utility/utilis/postgres/subSqlfiles/executePgQuery.js +12 -0
  134. package/dist/utility/utilis/postgres/subSqlfiles/executePgQuery.js.map +1 -0
  135. package/dist/utility/utilis/server/app.d.ts +5 -0
  136. package/dist/utility/utilis/server/app.js +15 -0
  137. package/dist/utility/utilis/server/app.js.map +1 -0
  138. package/dist/utility/utilis/server/server.d.ts +5 -0
  139. package/dist/utility/utilis/server/server.js +24 -0
  140. package/dist/utility/utilis/server/server.js.map +1 -0
  141. package/package.json +55 -0
@@ -0,0 +1,53 @@
1
+ import { CustomBulkWriteResult } from '../../libs/types.js';
2
+ import { BulkWriteInterface } from '../../libs/interface.js';
3
+ import 'mongodb';
4
+ import 'express';
5
+ import '../../libs/env.js';
6
+
7
+ /**
8
+ * Executes multiple write operations against a MongoDB collection in a single
9
+ * bulk operation.
10
+ *
11
+ * The function connects to the specified database and collection, executes
12
+ * the provided bulk write operations, and returns a standardized result
13
+ * indicating whether the operation succeeded or failed.
14
+ *
15
+ * @param params - Configuration and operations required for the bulk write.
16
+ * @param params.dbName - The name of the MongoDB database.
17
+ * @param params.collectionName - The name of the collection to modify.
18
+ * @param params.writable - An array of MongoDB bulk write operations to execute.
19
+ * @param params.options - Optional MongoDB bulk write configuration.
20
+ * @returns A promise resolving to a `CustomBulkWriteResult` containing either
21
+ * the `BulkWriteResult` on success or an `Error` on failure.
22
+ *
23
+ * @example
24
+ * const result = await bulkWrite({
25
+ * dbName: 'my_database',
26
+ * collectionName: 'users',
27
+ * writable: [
28
+ * {
29
+ * insertOne: {
30
+ * document: {
31
+ * name: 'John',
32
+ * email: 'john@example.com',
33
+ * },
34
+ * },
35
+ * },
36
+ * {
37
+ * updateOne: {
38
+ * filter: { name: 'Jane' },
39
+ * update: { $set: { active: true } },
40
+ * },
41
+ * },
42
+ * ],
43
+ * });
44
+ *
45
+ * if (result.status) {
46
+ * console.log(result.result);
47
+ * } else {
48
+ * console.error(result.error);
49
+ * }
50
+ */
51
+ declare const mongoBulkWrite: (params: BulkWriteInterface) => Promise<CustomBulkWriteResult>;
52
+
53
+ export { mongoBulkWrite };
@@ -0,0 +1,32 @@
1
+ import {
2
+ getMongoServer
3
+ } from "../../../chunk-EB35KLDE.js";
4
+ import "../../../chunk-EWQYVPOL.js";
5
+ import {
6
+ __name
7
+ } from "../../../chunk-7QVYU63E.js";
8
+
9
+ // src/utility/utilis/mongoDb/buldWrite.ts
10
+ var mongoBulkWrite = /* @__PURE__ */ __name(async (params) => {
11
+ const { dbName, collectionName, writable, options } = params;
12
+ try {
13
+ const col = getMongoServer().db(dbName).collection(collectionName);
14
+ const result = await col.bulkWrite(writable, options);
15
+ return {
16
+ status: true,
17
+ result,
18
+ error: null
19
+ };
20
+ } catch (err) {
21
+ const error = err instanceof Error ? err : new Error(String(err));
22
+ return {
23
+ status: false,
24
+ result: null,
25
+ error
26
+ };
27
+ }
28
+ }, "mongoBulkWrite");
29
+ export {
30
+ mongoBulkWrite
31
+ };
32
+ //# sourceMappingURL=buldWrite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/utility/utilis/mongoDb/buldWrite.ts"],"sourcesContent":["import {getMongoServer} from \"../../../engine/mondoDb/mongoDB.js\";\r\nimport type {CustomBulkWriteResult} from \"../../libs/types.js\";\r\nimport type {BulkWriteInterface} from \"../../libs/interface.js\";\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Executes multiple write operations against a MongoDB collection in a single\r\n * bulk operation.\r\n *\r\n * The function connects to the specified database and collection, executes\r\n * the provided bulk write operations, and returns a standardized result\r\n * indicating whether the operation succeeded or failed.\r\n *\r\n * @param params - Configuration and operations required for the bulk write.\r\n * @param params.dbName - The name of the MongoDB database.\r\n * @param params.collectionName - The name of the collection to modify.\r\n * @param params.writable - An array of MongoDB bulk write operations to execute.\r\n * @param params.options - Optional MongoDB bulk write configuration.\r\n * @returns A promise resolving to a `CustomBulkWriteResult` containing either\r\n * the `BulkWriteResult` on success or an `Error` on failure.\r\n *\r\n * @example\r\n * const result = await bulkWrite({\r\n * dbName: 'my_database',\r\n * collectionName: 'users',\r\n * writable: [\r\n * {\r\n * insertOne: {\r\n * document: {\r\n * name: 'John',\r\n * email: 'john@example.com',\r\n * },\r\n * },\r\n * },\r\n * {\r\n * updateOne: {\r\n * filter: { name: 'Jane' },\r\n * update: { $set: { active: true } },\r\n * },\r\n * },\r\n * ],\r\n * });\r\n *\r\n * if (result.status) {\r\n * console.log(result.result);\r\n * } else {\r\n * console.error(result.error);\r\n * }\r\n */\r\nexport const mongoBulkWrite = async (\r\n params: BulkWriteInterface\r\n): Promise<CustomBulkWriteResult> => {\r\n const { dbName, collectionName, writable, options } = params;\r\n\r\n try {\r\n const col = getMongoServer().db(dbName).collection(collectionName);\r\n\r\n // Added 'await' to ensure operations complete\r\n const result = await col.bulkWrite(writable, options);\r\n\r\n return {\r\n status: true,\r\n result,\r\n error: null,\r\n };\r\n } catch (err) {\r\n const error = err instanceof Error ? err : new Error(String(err));\r\n return {\r\n status: false,\r\n result: null,\r\n error,\r\n };\r\n }\r\n};\r\n"],"mappings":";;;;;;;;;AAuDO,IAAM,iBAAiB,8BAC1B,WACiC;AACjC,QAAM,EAAE,QAAQ,gBAAgB,UAAU,QAAQ,IAAI;AAEtD,MAAI;AACA,UAAM,MAAM,eAAe,EAAE,GAAG,MAAM,EAAE,WAAW,cAAc;AAGjE,UAAM,SAAS,MAAM,IAAI,UAAU,UAAU,OAAO;AAEpD,WAAO;AAAA,MACH,QAAQ;AAAA,MACR;AAAA,MACA,OAAO;AAAA,IACX;AAAA,EACJ,SAAS,KAAK;AACV,UAAM,QAAQ,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAChE,WAAO;AAAA,MACH,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR;AAAA,IACJ;AAAA,EACJ;AACJ,GAxB8B;","names":[]}
@@ -0,0 +1,54 @@
1
+ import { CustomDeleteResult } from '../../libs/types.js';
2
+ import { DeleteDocuments } from '../../libs/interface.js';
3
+ import 'mongodb';
4
+ import 'express';
5
+ import '../../libs/env.js';
6
+
7
+ /**
8
+ * Deletes one or more documents from a MongoDB collection.
9
+ *
10
+ * By default, the function deletes a single document matching the provided
11
+ * query. When `deleteMany` is set to `true`, all documents matching the query
12
+ * are deleted.
13
+ *
14
+ * @param params - Configuration options for the delete operation.
15
+ * @param params.dbName - The name of the MongoDB database.
16
+ * @param params.collection - The name of the collection to delete from.
17
+ * @param params.query - The MongoDB filter used to identify the documents.
18
+ * @param params.deleteMany - Whether to delete all matching documents instead
19
+ * of only the first matching document. Defaults to `false`.
20
+ * @param params.options - Optional MongoDB delete operation options.
21
+ * @returns A promise resolving to a `CustomDeleteResult` containing the
22
+ * `DeleteResult` and number of deleted documents on success, or an `Error`
23
+ * on failure.
24
+ *
25
+ * @example
26
+ * const result = await deleteDocument({
27
+ * dbName: 'my_database',
28
+ * collection: 'users',
29
+ * query: {
30
+ * email: 'john@example.com',
31
+ * },
32
+ * });
33
+ *
34
+ * if (result.status) {
35
+ * console.log(`Deleted ${result.deletedCount} document(s)`);
36
+ * } else {
37
+ * console.error(result.error);
38
+ * }
39
+ *
40
+ * @example
41
+ * const result = await deleteDocument({
42
+ * dbName: 'my_database',
43
+ * collection: 'users',
44
+ * query: {
45
+ * active: false,
46
+ * },
47
+ * deleteMany: true,
48
+ * });
49
+ *
50
+ * // Deletes all inactive users matching the query.
51
+ */
52
+ declare const mongoDeleteDocument: (params: DeleteDocuments) => Promise<CustomDeleteResult>;
53
+
54
+ export { mongoDeleteDocument };
@@ -0,0 +1,34 @@
1
+ import {
2
+ getMongoServer
3
+ } from "../../../chunk-EB35KLDE.js";
4
+ import "../../../chunk-EWQYVPOL.js";
5
+ import {
6
+ __name
7
+ } from "../../../chunk-7QVYU63E.js";
8
+
9
+ // src/utility/utilis/mongoDb/deleteDocument.ts
10
+ var mongoDeleteDocument = /* @__PURE__ */ __name(async (params) => {
11
+ const { dbName, collection, query, deleteMany = false, options } = params;
12
+ try {
13
+ const col = getMongoServer().db(dbName).collection(collection);
14
+ const result = deleteMany ? await col.deleteMany(query, options) : await col.deleteOne(query, options);
15
+ return {
16
+ status: true,
17
+ result,
18
+ deletedCount: result.deletedCount,
19
+ error: null
20
+ };
21
+ } catch (err) {
22
+ const error = err instanceof Error ? err : new Error(String(err));
23
+ return {
24
+ status: false,
25
+ result: null,
26
+ deletedCount: 0,
27
+ error
28
+ };
29
+ }
30
+ }, "mongoDeleteDocument");
31
+ export {
32
+ mongoDeleteDocument
33
+ };
34
+ //# sourceMappingURL=deleteDocument.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/utility/utilis/mongoDb/deleteDocument.ts"],"sourcesContent":["import { getMongoServer } from \"../../../engine/mondoDb/mongoDB.js\";\r\nimport type {CustomDeleteResult} from \"../../libs/types.js\";\r\nimport type {DeleteDocuments} from \"../../libs/interface.js\";\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Deletes one or more documents from a MongoDB collection.\r\n *\r\n * By default, the function deletes a single document matching the provided\r\n * query. When `deleteMany` is set to `true`, all documents matching the query\r\n * are deleted.\r\n *\r\n * @param params - Configuration options for the delete operation.\r\n * @param params.dbName - The name of the MongoDB database.\r\n * @param params.collection - The name of the collection to delete from.\r\n * @param params.query - The MongoDB filter used to identify the documents.\r\n * @param params.deleteMany - Whether to delete all matching documents instead\r\n * of only the first matching document. Defaults to `false`.\r\n * @param params.options - Optional MongoDB delete operation options.\r\n * @returns A promise resolving to a `CustomDeleteResult` containing the\r\n * `DeleteResult` and number of deleted documents on success, or an `Error`\r\n * on failure.\r\n *\r\n * @example\r\n * const result = await deleteDocument({\r\n * dbName: 'my_database',\r\n * collection: 'users',\r\n * query: {\r\n * email: 'john@example.com',\r\n * },\r\n * });\r\n *\r\n * if (result.status) {\r\n * console.log(`Deleted ${result.deletedCount} document(s)`);\r\n * } else {\r\n * console.error(result.error);\r\n * }\r\n *\r\n * @example\r\n * const result = await deleteDocument({\r\n * dbName: 'my_database',\r\n * collection: 'users',\r\n * query: {\r\n * active: false,\r\n * },\r\n * deleteMany: true,\r\n * });\r\n *\r\n * // Deletes all inactive users matching the query.\r\n */\r\nexport const mongoDeleteDocument = async (\r\n params: DeleteDocuments\r\n): Promise<CustomDeleteResult> => {\r\n\r\n\r\n const { dbName, collection, query, deleteMany = false, options } = params;\r\n\r\n try {\r\n const col = getMongoServer().db(dbName).collection(collection);\r\n\r\n const result = deleteMany\r\n ? await col.deleteMany(query, options)\r\n : await col.deleteOne(query, options);\r\n\r\n return {\r\n status: true,\r\n result,\r\n deletedCount: result.deletedCount,\r\n error: null,\r\n };\r\n } catch (err) {\r\n const error = err instanceof Error ? err : new Error(String(err));\r\n\r\n return {\r\n status: false,\r\n result: null,\r\n deletedCount: 0,\r\n error,\r\n };\r\n }\r\n};\r\n"],"mappings":";;;;;;;;;AAuDO,IAAM,sBAAsB,8BAC/B,WAC8B;AAG9B,QAAM,EAAE,QAAQ,YAAY,OAAO,aAAa,OAAO,QAAQ,IAAI;AAEnE,MAAI;AACA,UAAM,MAAM,eAAe,EAAE,GAAG,MAAM,EAAE,WAAW,UAAU;AAE7D,UAAM,SAAS,aACT,MAAM,IAAI,WAAW,OAAO,OAAO,IACnC,MAAM,IAAI,UAAU,OAAO,OAAO;AAExC,WAAO;AAAA,MACH,QAAQ;AAAA,MACR;AAAA,MACA,cAAc,OAAO;AAAA,MACrB,OAAO;AAAA,IACX;AAAA,EACJ,SAAS,KAAK;AACV,UAAM,QAAQ,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAEhE,WAAO;AAAA,MACH,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,cAAc;AAAA,MACd;AAAA,IACJ;AAAA,EACJ;AACJ,GA9BmC;","names":[]}
@@ -0,0 +1,40 @@
1
+ import { CustomInsertOneResult } from '../../libs/types.js';
2
+ import { InsertOneInterface } from '../../libs/interface.js';
3
+ import 'mongodb';
4
+ import 'express';
5
+ import '../../libs/env.js';
6
+
7
+ /**
8
+ * Inserts a single document into a MongoDB collection.
9
+ *
10
+ * The document is inserted into the specified database and collection using
11
+ * the provided MongoDB insertion options. The generic type `T` allows the
12
+ * inserted document and resulting operation to remain type-safe.
13
+ *
14
+ * @param params - Configuration options for the insert operation.
15
+ * @param params.dbName - The name of the MongoDB database.
16
+ * @param params.collectionName - The name of the collection to insert into.
17
+ * @param params.field - The document to insert.
18
+ * @param params.options - Optional MongoDB insert operation options.
19
+ * @returns A promise resolving to a `CustomInsertOneResult<T>` containing the
20
+ * `InsertOneResult` on success or an `Error` on failure.
21
+ *
22
+ * @example
23
+ * const result = await insertOneField({
24
+ * dbName: 'my_database',
25
+ * collectionName: 'users',
26
+ * field: {
27
+ * name: 'John Doe',
28
+ * email: 'john@example.com',
29
+ * },
30
+ * });
31
+ *
32
+ * if (result.status) {
33
+ * console.log('Inserted ID:', result.result.insertedId);
34
+ * } else {
35
+ * console.error(result.error);
36
+ * }
37
+ */
38
+ declare const mongoInsertOneField: <T>(params: InsertOneInterface<T>) => Promise<CustomInsertOneResult<T>>;
39
+
40
+ export { mongoInsertOneField };
@@ -0,0 +1,33 @@
1
+ import {
2
+ getMongoServer
3
+ } from "../../../chunk-EB35KLDE.js";
4
+ import "../../../chunk-EWQYVPOL.js";
5
+ import {
6
+ __name
7
+ } from "../../../chunk-7QVYU63E.js";
8
+
9
+ // src/utility/utilis/mongoDb/insertField.ts
10
+ var mongoInsertOneField = /* @__PURE__ */ __name(async (params) => {
11
+ const { dbName, collectionName, field, options } = params;
12
+ try {
13
+ const db = getMongoServer().db(dbName);
14
+ const collection = db.collection(collectionName);
15
+ const result = await collection.insertOne(field, options);
16
+ return {
17
+ status: true,
18
+ result,
19
+ error: null
20
+ };
21
+ } catch (err) {
22
+ const error = err instanceof Error ? err : new Error(String(err));
23
+ return {
24
+ status: false,
25
+ result: null,
26
+ error
27
+ };
28
+ }
29
+ }, "mongoInsertOneField");
30
+ export {
31
+ mongoInsertOneField
32
+ };
33
+ //# sourceMappingURL=insertField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/utility/utilis/mongoDb/insertField.ts"],"sourcesContent":["import {getMongoServer} from \"../../../engine/mondoDb/mongoDB.js\";\r\nimport type {CustomInsertOneResult} from \"../../libs/types.js\";\r\nimport type {InsertOneInterface} from \"../../libs/interface.js\";\r\nimport type {Document } from \"mongodb\";\r\n\r\n\r\n\r\n/**\r\n * Inserts a single document into a MongoDB collection.\r\n *\r\n * The document is inserted into the specified database and collection using\r\n * the provided MongoDB insertion options. The generic type `T` allows the\r\n * inserted document and resulting operation to remain type-safe.\r\n *\r\n * @param params - Configuration options for the insert operation.\r\n * @param params.dbName - The name of the MongoDB database.\r\n * @param params.collectionName - The name of the collection to insert into.\r\n * @param params.field - The document to insert.\r\n * @param params.options - Optional MongoDB insert operation options.\r\n * @returns A promise resolving to a `CustomInsertOneResult<T>` containing the\r\n * `InsertOneResult` on success or an `Error` on failure.\r\n *\r\n * @example\r\n * const result = await insertOneField({\r\n * dbName: 'my_database',\r\n * collectionName: 'users',\r\n * field: {\r\n * name: 'John Doe',\r\n * email: 'john@example.com',\r\n * },\r\n * });\r\n *\r\n * if (result.status) {\r\n * console.log('Inserted ID:', result.result.insertedId);\r\n * } else {\r\n * console.error(result.error);\r\n * }\r\n */\r\nexport const mongoInsertOneField = async <T>(\r\n params: InsertOneInterface<T>\r\n): Promise<CustomInsertOneResult<T>> => {\r\n const { dbName, collectionName, field, options } = params;\r\n\r\n try {\r\n const db = getMongoServer().db(dbName);\r\n const collection = db.collection<T & Document>(collectionName);\r\n\r\n const result = await collection.insertOne(field, options);\r\n\r\n return {\r\n status: true,\r\n result,\r\n error: null,\r\n };\r\n } catch (err) {\r\n const error = err instanceof Error ? err : new Error(String(err));\r\n return {\r\n status: false,\r\n result: null,\r\n error,\r\n };\r\n }\r\n};\r\n"],"mappings":";;;;;;;;;AAsCO,IAAM,sBAAsB,8BAC/B,WACoC;AACpC,QAAM,EAAE,QAAQ,gBAAgB,OAAO,QAAQ,IAAI;AAEnD,MAAI;AACA,UAAM,KAAK,eAAe,EAAE,GAAG,MAAM;AACrC,UAAM,aAAa,GAAG,WAAyB,cAAc;AAE7D,UAAM,SAAS,MAAM,WAAW,UAAU,OAAO,OAAO;AAExD,WAAO;AAAA,MACH,QAAQ;AAAA,MACR;AAAA,MACA,OAAO;AAAA,IACX;AAAA,EACJ,SAAS,KAAK;AACV,UAAM,QAAQ,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAChE,WAAO;AAAA,MACH,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR;AAAA,IACJ;AAAA,EACJ;AACJ,GAxBmC;","names":[]}
@@ -0,0 +1,48 @@
1
+ import { InsertManyInterface } from '../../libs/interface.js';
2
+ import { CustomInsertManyResult } from '../../libs/types.js';
3
+ import 'mongodb';
4
+ import 'express';
5
+ import '../../libs/env.js';
6
+
7
+ /**
8
+ * Inserts multiple documents into a MongoDB collection.
9
+ *
10
+ * The documents are inserted into the specified database and collection
11
+ * using the provided MongoDB insertion options. The generic type `T`
12
+ * ensures that the inserted documents and resulting operation remain
13
+ * type-safe.
14
+ *
15
+ * @param params - Configuration options for the bulk insert operation.
16
+ * @param params.dbName - The name of the MongoDB database.
17
+ * @param params.collectionName - The name of the collection to insert into.
18
+ * @param params.fields - An array of documents to insert.
19
+ * @param params.options - Optional MongoDB bulk write options.
20
+ * @returns A promise resolving to a `CustomInsertManyResult<T>` containing
21
+ * the `InsertManyResult` and number of inserted documents on success, or
22
+ * an `Error` on failure.
23
+ *
24
+ * @example
25
+ * const result = await insertManyFields({
26
+ * dbName: 'my_database',
27
+ * collectionName: 'users',
28
+ * fields: [
29
+ * {
30
+ * name: 'John Doe',
31
+ * email: 'john@example.com',
32
+ * },
33
+ * {
34
+ * name: 'Jane Doe',
35
+ * email: 'jane@example.com',
36
+ * },
37
+ * ],
38
+ * });
39
+ *
40
+ * if (result.status) {
41
+ * console.log(`Inserted ${result.insertedCount} documents`);
42
+ * } else {
43
+ * console.error(result.error);
44
+ * }
45
+ */
46
+ declare const mongoInsertManyFields: <T>(params: InsertManyInterface<T>) => Promise<CustomInsertManyResult<T>>;
47
+
48
+ export { mongoInsertManyFields };
@@ -0,0 +1,35 @@
1
+ import {
2
+ getMongoServer
3
+ } from "../../../chunk-EB35KLDE.js";
4
+ import "../../../chunk-EWQYVPOL.js";
5
+ import {
6
+ __name
7
+ } from "../../../chunk-7QVYU63E.js";
8
+
9
+ // src/utility/utilis/mongoDb/insertFields.ts
10
+ var mongoInsertManyFields = /* @__PURE__ */ __name(async (params) => {
11
+ const { dbName, collectionName, fields, options } = params;
12
+ try {
13
+ const db = getMongoServer().db(dbName);
14
+ const collection = db.collection(collectionName);
15
+ const result = await collection.insertMany(fields, options);
16
+ return {
17
+ status: true,
18
+ result,
19
+ insertedCount: result.insertedCount,
20
+ error: null
21
+ };
22
+ } catch (err) {
23
+ const error = err instanceof Error ? err : new Error(String(err));
24
+ return {
25
+ status: false,
26
+ result: null,
27
+ insertedCount: 0,
28
+ error
29
+ };
30
+ }
31
+ }, "mongoInsertManyFields");
32
+ export {
33
+ mongoInsertManyFields
34
+ };
35
+ //# sourceMappingURL=insertFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/utility/utilis/mongoDb/insertFields.ts"],"sourcesContent":["import type {InsertManyInterface} from \"../../libs/interface.js\";\r\nimport type {CustomInsertManyResult} from \"../../libs/types.js\";\r\nimport {getMongoServer} from \"../../../engine/mondoDb/mongoDB.js\";\r\nimport type {Document} from \"mongodb\";\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Inserts multiple documents into a MongoDB collection.\r\n *\r\n * The documents are inserted into the specified database and collection\r\n * using the provided MongoDB insertion options. The generic type `T`\r\n * ensures that the inserted documents and resulting operation remain\r\n * type-safe.\r\n *\r\n * @param params - Configuration options for the bulk insert operation.\r\n * @param params.dbName - The name of the MongoDB database.\r\n * @param params.collectionName - The name of the collection to insert into.\r\n * @param params.fields - An array of documents to insert.\r\n * @param params.options - Optional MongoDB bulk write options.\r\n * @returns A promise resolving to a `CustomInsertManyResult<T>` containing\r\n * the `InsertManyResult` and number of inserted documents on success, or\r\n * an `Error` on failure.\r\n *\r\n * @example\r\n * const result = await insertManyFields({\r\n * dbName: 'my_database',\r\n * collectionName: 'users',\r\n * fields: [\r\n * {\r\n * name: 'John Doe',\r\n * email: 'john@example.com',\r\n * },\r\n * {\r\n * name: 'Jane Doe',\r\n * email: 'jane@example.com',\r\n * },\r\n * ],\r\n * });\r\n *\r\n * if (result.status) {\r\n * console.log(`Inserted ${result.insertedCount} documents`);\r\n * } else {\r\n * console.error(result.error);\r\n * }\r\n */\r\nexport const mongoInsertManyFields = async <T>(\r\n params: InsertManyInterface<T>\r\n): Promise<CustomInsertManyResult<T>> => {\r\n const { dbName, collectionName, fields, options } = params;\r\n\r\n try {\r\n const db = getMongoServer().db(dbName);\r\n const collection = db.collection<T & Document>(collectionName);\r\n\r\n const result = await collection.insertMany(fields, options);\r\n\r\n return {\r\n status: true,\r\n result,\r\n insertedCount: result.insertedCount,\r\n error: null,\r\n };\r\n }\r\n catch (err) {\r\n const error = err instanceof Error ? err : new Error(String(err));\r\n return {\r\n status: false,\r\n result: null,\r\n insertedCount: 0,\r\n error,\r\n };\r\n }\r\n};\r\n"],"mappings":";;;;;;;;;AAkDO,IAAM,wBAAwB,8BACjC,WACqC;AACrC,QAAM,EAAE,QAAQ,gBAAgB,QAAQ,QAAQ,IAAI;AAEpD,MAAI;AACA,UAAM,KAAK,eAAe,EAAE,GAAG,MAAM;AACrC,UAAM,aAAa,GAAG,WAAyB,cAAc;AAE7D,UAAM,SAAS,MAAM,WAAW,WAAW,QAAQ,OAAO;AAE1D,WAAO;AAAA,MACH,QAAQ;AAAA,MACR;AAAA,MACA,eAAe,OAAO;AAAA,MACtB,OAAO;AAAA,IACX;AAAA,EACJ,SACO,KAAK;AACR,UAAM,QAAQ,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAChE,WAAO;AAAA,MACH,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,eAAe;AAAA,MACf;AAAA,IACJ;AAAA,EACJ;AACJ,GA3BqC;","names":[]}
@@ -0,0 +1,65 @@
1
+ import { CustomUpdateResult } from '../../libs/types.js';
2
+ import { UpdateDocument } from '../../libs/interface.js';
3
+ import 'mongodb';
4
+ import 'express';
5
+ import '../../libs/env.js';
6
+
7
+ /**
8
+ * Updates one or more documents in a MongoDB collection.
9
+ *
10
+ * By default, the function updates a single document matching the provided
11
+ * query. When `updateMany` is set to `true`, all documents matching the query
12
+ * are updated.
13
+ *
14
+ * @param params - Configuration options for the update operation.
15
+ * @param params.dbName - The name of the MongoDB database.
16
+ * @param params.collectionName - The name of the collection to update.
17
+ * @param params.query - The MongoDB filter used to identify the documents.
18
+ * @param params.updatable - The update operations or update pipeline to apply
19
+ * to the matching documents.
20
+ * @param params.updateMany - Whether to update all matching documents instead
21
+ * of only the first matching document. Defaults to `false`.
22
+ * @param params.options - Optional MongoDB update operation options.
23
+ * @returns A promise resolving to a `CustomUpdateResult` containing the
24
+ * `UpdateResult` on success or an `Error` on failure.
25
+ *
26
+ * @example
27
+ * const result = await updateField({
28
+ * dbName: 'my_database',
29
+ * collectionName: 'users',
30
+ * query: {
31
+ * email: 'john@example.com',
32
+ * },
33
+ * updatable: {
34
+ * $set: {
35
+ * active: true,
36
+ * },
37
+ * },
38
+ * });
39
+ *
40
+ * if (result.status) {
41
+ * console.log('User updated successfully');
42
+ * } else {
43
+ * console.error(result.error);
44
+ * }
45
+ *
46
+ * @example
47
+ * const result = await updateField({
48
+ * dbName: 'my_database',
49
+ * collectionName: 'users',
50
+ * query: {
51
+ * active: false,
52
+ * },
53
+ * updatable: {
54
+ * $set: {
55
+ * status: 'inactive',
56
+ * },
57
+ * },
58
+ * updateMany: true,
59
+ * });
60
+ *
61
+ * // Updates all users matching the query.
62
+ */
63
+ declare const mongoUpdateField: (params: UpdateDocument) => Promise<CustomUpdateResult>;
64
+
65
+ export { mongoUpdateField };
@@ -0,0 +1,40 @@
1
+ import {
2
+ getMongoServer
3
+ } from "../../../chunk-EB35KLDE.js";
4
+ import "../../../chunk-EWQYVPOL.js";
5
+ import {
6
+ __name
7
+ } from "../../../chunk-7QVYU63E.js";
8
+
9
+ // src/utility/utilis/mongoDb/updateFiled.ts
10
+ var mongoUpdateField = /* @__PURE__ */ __name(async (params) => {
11
+ const {
12
+ dbName,
13
+ collectionName,
14
+ query,
15
+ updatable,
16
+ updateMany = false,
17
+ options
18
+ } = params;
19
+ try {
20
+ const db = getMongoServer().db(dbName);
21
+ const collection = db.collection(collectionName);
22
+ const result = updateMany ? await collection.updateMany(query, updatable, options) : await collection.updateOne(query, updatable, options);
23
+ return {
24
+ status: true,
25
+ result,
26
+ error: null
27
+ };
28
+ } catch (err) {
29
+ const error = err instanceof Error ? err : new Error(String(err));
30
+ return {
31
+ status: false,
32
+ result: null,
33
+ error
34
+ };
35
+ }
36
+ }, "mongoUpdateField");
37
+ export {
38
+ mongoUpdateField
39
+ };
40
+ //# sourceMappingURL=updateFiled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/utility/utilis/mongoDb/updateFiled.ts"],"sourcesContent":["import type {CustomUpdateResult} from \"../../libs/types.js\";\r\nimport {getMongoServer} from \"../../../engine/mondoDb/mongoDB.js\";\r\nimport type {UpdateDocument} from \"../../libs/interface.js\";\r\n\r\n\r\n\r\n/**\r\n * Updates one or more documents in a MongoDB collection.\r\n *\r\n * By default, the function updates a single document matching the provided\r\n * query. When `updateMany` is set to `true`, all documents matching the query\r\n * are updated.\r\n *\r\n * @param params - Configuration options for the update operation.\r\n * @param params.dbName - The name of the MongoDB database.\r\n * @param params.collectionName - The name of the collection to update.\r\n * @param params.query - The MongoDB filter used to identify the documents.\r\n * @param params.updatable - The update operations or update pipeline to apply\r\n * to the matching documents.\r\n * @param params.updateMany - Whether to update all matching documents instead\r\n * of only the first matching document. Defaults to `false`.\r\n * @param params.options - Optional MongoDB update operation options.\r\n * @returns A promise resolving to a `CustomUpdateResult` containing the\r\n * `UpdateResult` on success or an `Error` on failure.\r\n *\r\n * @example\r\n * const result = await updateField({\r\n * dbName: 'my_database',\r\n * collectionName: 'users',\r\n * query: {\r\n * email: 'john@example.com',\r\n * },\r\n * updatable: {\r\n * $set: {\r\n * active: true,\r\n * },\r\n * },\r\n * });\r\n *\r\n * if (result.status) {\r\n * console.log('User updated successfully');\r\n * } else {\r\n * console.error(result.error);\r\n * }\r\n *\r\n * @example\r\n * const result = await updateField({\r\n * dbName: 'my_database',\r\n * collectionName: 'users',\r\n * query: {\r\n * active: false,\r\n * },\r\n * updatable: {\r\n * $set: {\r\n * status: 'inactive',\r\n * },\r\n * },\r\n * updateMany: true,\r\n * });\r\n *\r\n * // Updates all users matching the query.\r\n */\r\nexport const mongoUpdateField = async (\r\n params: UpdateDocument\r\n): Promise<CustomUpdateResult> => {\r\n const {\r\n dbName,\r\n collectionName,\r\n query,\r\n updatable,\r\n updateMany = false,\r\n options\r\n } = params;\r\n\r\n try {\r\n const db = getMongoServer().db(dbName);\r\n const collection = db.collection(collectionName);\r\n\r\n // Perform update with await\r\n const result = updateMany\r\n ? await collection.updateMany(query, updatable, options)\r\n : await collection.updateOne(query, updatable, options);\r\n\r\n return {\r\n status: true,\r\n result,\r\n error: null,\r\n };\r\n } catch (err) {\r\n const error = err instanceof Error ? err : new Error(String(err));\r\n\r\n return {\r\n status: false,\r\n result: null,\r\n error,\r\n };\r\n }\r\n};\r\n"],"mappings":";;;;;;;;;AA8DO,IAAM,mBAAmB,8BAC5B,WAC8B;AAC9B,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,EACJ,IAAI;AAEJ,MAAI;AACA,UAAM,KAAK,eAAe,EAAE,GAAG,MAAM;AACrC,UAAM,aAAa,GAAG,WAAW,cAAc;AAG/C,UAAM,SAAS,aACT,MAAM,WAAW,WAAW,OAAO,WAAW,OAAO,IACrD,MAAM,WAAW,UAAU,OAAO,WAAW,OAAO;AAE1D,WAAO;AAAA,MACH,QAAQ;AAAA,MACR;AAAA,MACA,OAAO;AAAA,IACX;AAAA,EACJ,SAAS,KAAK;AACV,UAAM,QAAQ,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAEhE,WAAO;AAAA,MACH,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR;AAAA,IACJ;AAAA,EACJ;AACJ,GAnCgC;","names":[]}
@@ -0,0 +1,7 @@
1
+ import * as express from 'express';
2
+ import * as qs from 'qs';
3
+ import * as express_serve_static_core from 'express-serve-static-core';
4
+
5
+ declare const upload_batch: (fieldName?: string, maxCount?: number) => express.RequestHandler<express_serve_static_core.ParamsDictionary, any, any, qs.ParsedQs, Record<string, any>>;
6
+
7
+ export { upload_batch };
@@ -0,0 +1,17 @@
1
+ import {
2
+ MAX_BATCH_FILES,
3
+ multerInstance
4
+ } from "../../../chunk-UWIMSKL5.js";
5
+ import {
6
+ ENV
7
+ } from "../../../chunk-EWQYVPOL.js";
8
+ import {
9
+ __name
10
+ } from "../../../chunk-7QVYU63E.js";
11
+
12
+ // src/utility/utilis/multer/upload_batch.ts
13
+ var upload_batch = /* @__PURE__ */ __name((fieldName = ENV.FILES, maxCount = MAX_BATCH_FILES) => multerInstance.array(fieldName, maxCount), "upload_batch");
14
+ export {
15
+ upload_batch
16
+ };
17
+ //# sourceMappingURL=upload_batch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/utility/utilis/multer/upload_batch.ts"],"sourcesContent":["import {MAX_BATCH_FILES, multerInstance} from \"../../../engine/multer/multer_configs.js\";\r\nimport {ENV} from \"../../libs/env.js\";\r\n\r\nexport const upload_batch = (fieldName: string = ENV.FILES, maxCount: number = MAX_BATCH_FILES) =>\r\n multerInstance.array(fieldName, maxCount);\r\n"],"mappings":";;;;;;;;;;;;AAGO,IAAM,eAAe,wBAAC,YAAoB,IAAI,OAAO,WAAmB,oBAC3E,eAAe,MAAM,WAAW,QAAQ,GADhB;","names":[]}
@@ -0,0 +1,7 @@
1
+ import * as express from 'express';
2
+ import * as qs from 'qs';
3
+ import * as express_serve_static_core from 'express-serve-static-core';
4
+
5
+ declare const upload_single: (fieldName?: string) => express.RequestHandler<express_serve_static_core.ParamsDictionary, any, any, qs.ParsedQs, Record<string, any>>;
6
+
7
+ export { upload_single };
@@ -0,0 +1,16 @@
1
+ import {
2
+ multerInstance
3
+ } from "../../../chunk-UWIMSKL5.js";
4
+ import {
5
+ ENV
6
+ } from "../../../chunk-EWQYVPOL.js";
7
+ import {
8
+ __name
9
+ } from "../../../chunk-7QVYU63E.js";
10
+
11
+ // src/utility/utilis/multer/upload_single.ts
12
+ var upload_single = /* @__PURE__ */ __name((fieldName = ENV.FILE) => multerInstance.single(fieldName), "upload_single");
13
+ export {
14
+ upload_single
15
+ };
16
+ //# sourceMappingURL=upload_single.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/utility/utilis/multer/upload_single.ts"],"sourcesContent":["import {multerInstance} from \"../../../engine/multer/multer_configs.js\";\r\nimport {ENV} from \"../../libs/env.js\";\r\n\r\nexport const upload_single = (fieldName: string = ENV.FILE) =>\r\n multerInstance.single(fieldName);\r\n"],"mappings":";;;;;;;;;;;AAGO,IAAM,gBAAgB,wBAAC,YAAoB,IAAI,SAClD,eAAe,OAAO,SAAS,GADN;","names":[]}