backfarm 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-22GJTNKR.js +47 -0
- package/dist/chunk-22GJTNKR.js.map +1 -0
- package/dist/{chunk-XBJ3SJ26.js → chunk-2QNCQ5L5.js} +3 -3
- package/dist/chunk-2QNCQ5L5.js.map +1 -0
- package/dist/chunk-3DJ6GERS.js +17 -0
- package/dist/chunk-3DJ6GERS.js.map +1 -0
- package/dist/chunk-452DWS46.js +88 -0
- package/dist/chunk-452DWS46.js.map +1 -0
- package/dist/{chunk-UWIMSKL5.js → chunk-4L35JPDH.js} +2 -2
- package/dist/chunk-4L35JPDH.js.map +1 -0
- package/dist/{chunk-VFF4YFA3.js → chunk-5AJKFCEE.js} +3 -3
- package/dist/chunk-5AJKFCEE.js.map +1 -0
- package/dist/chunk-6BNQOIVA.js +34 -0
- package/dist/chunk-6BNQOIVA.js.map +1 -0
- package/dist/{chunk-P5XJG7OG.js → chunk-A7GR4LD2.js} +1 -1
- package/dist/chunk-A7GR4LD2.js.map +1 -0
- package/dist/chunk-EEQ2SXDE.js +32 -0
- package/dist/chunk-EEQ2SXDE.js.map +1 -0
- package/dist/chunk-EUWCMMGI.js +35 -0
- package/dist/chunk-EUWCMMGI.js.map +1 -0
- package/dist/chunk-HC4IDQP6.js +89 -0
- package/dist/chunk-HC4IDQP6.js.map +1 -0
- package/dist/{chunk-QVTKG7FD.js → chunk-HV3IQJH3.js} +3 -3
- package/dist/chunk-HV3IQJH3.js.map +1 -0
- package/dist/{chunk-X3R3RLXY.js → chunk-IZEPCXYK.js} +1 -1
- package/dist/chunk-IZEPCXYK.js.map +1 -0
- package/dist/{chunk-YTBSGKGF.js → chunk-J3P6W53K.js} +2 -2
- package/dist/chunk-J3P6W53K.js.map +1 -0
- package/dist/{chunk-EWQYVPOL.js → chunk-LE2SDA4O.js} +1 -1
- package/dist/chunk-LE2SDA4O.js.map +1 -0
- package/dist/chunk-M7PVDT2D.js +60 -0
- package/dist/chunk-M7PVDT2D.js.map +1 -0
- package/dist/chunk-O2ZDXQ2Z.js +44 -0
- package/dist/chunk-O2ZDXQ2Z.js.map +1 -0
- package/dist/{chunk-MNSQSU7T.js → chunk-O5ILFRFV.js} +2 -2
- package/dist/chunk-O5ILFRFV.js.map +1 -0
- package/dist/chunk-O76OK6Y7.js +40 -0
- package/dist/chunk-O76OK6Y7.js.map +1 -0
- package/dist/{chunk-W3W3X2OE.js → chunk-QW2GGDEG.js} +54 -19
- package/dist/chunk-QW2GGDEG.js.map +1 -0
- package/dist/chunk-RZ7XHAUV.js +74 -0
- package/dist/chunk-RZ7XHAUV.js.map +1 -0
- package/dist/{chunk-TP3K7DMH.js → chunk-U7BCM2WN.js} +2 -2
- package/dist/chunk-U7BCM2WN.js.map +1 -0
- package/dist/chunk-UPP2FW3G.js +336 -0
- package/dist/chunk-UPP2FW3G.js.map +1 -0
- package/dist/chunk-YA3MW2CJ.js +33 -0
- package/dist/chunk-YA3MW2CJ.js.map +1 -0
- package/dist/{chunk-SSFPGDA3.js → chunk-ZC33GE2U.js} +5 -5
- package/dist/chunk-ZC33GE2U.js.map +1 -0
- package/dist/{chunk-D7A4TEXY.js → chunk-ZC6ZFZ2J.js} +2 -2
- package/dist/chunk-ZC6ZFZ2J.js.map +1 -0
- package/dist/{chunk-ZMDJ45KH.js → chunk-ZGOMCU4T.js} +7 -7
- package/dist/chunk-ZGOMCU4T.js.map +1 -0
- package/dist/chunk-ZTTB4NMA.js +18 -0
- package/dist/chunk-ZTTB4NMA.js.map +1 -0
- package/dist/engine/cloudBucket/r2Storage.js +3 -3
- package/dist/engine/mondoDb/mongoDB.js +3 -3
- package/dist/engine/multer/multer_configs.js +2 -2
- package/dist/engine/server/server.d.ts +5 -3
- package/dist/engine/server/server.js +30 -9
- package/dist/engine/sql/mySql.d.ts +2 -2
- package/dist/engine/sql/mySql.js +3 -3
- package/dist/engine/sql/pgSql.js +3 -3
- package/dist/utility/libs/env.js +1 -1
- package/dist/utility/libs/index.d.ts +1772 -0
- package/dist/utility/libs/index.js +101 -0
- package/dist/utility/libs/interface.d.ts +5 -7
- package/dist/utility/libs/run-all.js +46 -0
- package/dist/utility/libs/run-all.js.map +1 -0
- package/dist/{chunk-LFRKRR7G.js → utility/libs/run-bucket.js} +4 -7
- package/dist/utility/libs/run-bucket.js.map +1 -0
- package/dist/utility/libs/run-node-server.js +35 -0
- package/dist/utility/libs/run-node-server.js.map +1 -0
- package/dist/utility/libs/types.d.ts +11 -31
- package/dist/utility/libs/types.js +1 -1
- package/dist/utility/libs/types.js.map +1 -1
- package/dist/utility/utilis/cloud_storage/deleteFile.js +7 -54
- package/dist/utility/utilis/cloud_storage/deleteFile.js.map +1 -1
- package/dist/utility/utilis/cloud_storage/deleteFiles.js +7 -83
- package/dist/utility/utilis/cloud_storage/deleteFiles.js.map +1 -1
- package/dist/utility/utilis/cloud_storage/downloadFile.js +8 -68
- package/dist/utility/utilis/cloud_storage/downloadFile.js.map +1 -1
- package/dist/utility/utilis/cloud_storage/downloadFiles.js +8 -82
- package/dist/utility/utilis/cloud_storage/downloadFiles.js.map +1 -1
- package/dist/utility/utilis/cloud_storage/uploadFile.js +6 -6
- package/dist/utility/utilis/cloud_storage/uploadFiles.d.ts +0 -64
- package/dist/utility/utilis/cloud_storage/uploadFiles.js +9 -43
- package/dist/utility/utilis/cloud_storage/uploadFiles.js.map +1 -1
- package/dist/utility/utilis/general/error_handler.js +1 -1
- package/dist/utility/utilis/general/file-operations.d.ts +7 -132
- package/dist/utility/utilis/general/file-operations.js +6 -4
- package/dist/utility/utilis/general/sqlDb.js.d.ts +0 -141
- package/dist/utility/utilis/general/sqlDb.js.js +2 -2
- package/dist/utility/utilis/general/uuids.d.ts +0 -43
- package/dist/utility/utilis/general/uuids.js +1 -1
- package/dist/utility/utilis/general/web.d.ts +2 -238
- package/dist/utility/utilis/general/web.js +4 -4
- package/dist/utility/utilis/mongoDb/buldWrite.d.ts +0 -44
- package/dist/utility/utilis/mongoDb/buldWrite.js +6 -28
- package/dist/utility/utilis/mongoDb/buldWrite.js.map +1 -1
- package/dist/utility/utilis/mongoDb/deleteDocument.d.ts +0 -45
- package/dist/utility/utilis/mongoDb/deleteDocument.js +6 -30
- package/dist/utility/utilis/mongoDb/deleteDocument.js.map +1 -1
- package/dist/utility/utilis/mongoDb/insertField.d.ts +2 -33
- package/dist/utility/utilis/mongoDb/insertField.js +7 -30
- package/dist/utility/utilis/mongoDb/insertField.js.map +1 -1
- package/dist/utility/utilis/mongoDb/insertFields.d.ts +2 -41
- package/dist/utility/utilis/mongoDb/insertFields.js +7 -32
- package/dist/utility/utilis/mongoDb/insertFields.js.map +1 -1
- package/dist/utility/utilis/mongoDb/updateFiled.d.ts +0 -56
- package/dist/utility/utilis/mongoDb/updateFiled.js +6 -36
- package/dist/utility/utilis/mongoDb/updateFiled.js.map +1 -1
- package/dist/utility/utilis/multer/upload_batch.js +5 -12
- package/dist/utility/utilis/multer/upload_batch.js.map +1 -1
- package/dist/utility/utilis/multer/upload_single.d.ts +41 -0
- package/dist/utility/utilis/multer/upload_single.js +5 -11
- package/dist/utility/utilis/multer/upload_single.js.map +1 -1
- package/dist/utility/utilis/postgres/executeQuery.d.ts +2 -205
- package/dist/utility/utilis/postgres/executeQuery.js +11 -41
- package/dist/utility/utilis/postgres/executeQuery.js.map +1 -1
- package/dist/utility/utilis/postgres/subSqlfiles/executeMySqlQuery.js +4 -4
- package/dist/utility/utilis/postgres/subSqlfiles/executePgQuery.js +4 -4
- package/dist/utility/utilis/server/app.js +30 -12
- package/dist/utility/utilis/server/app.js.map +1 -1
- package/dist/utility/utilis/server/server.d.ts +2 -2
- package/dist/utility/utilis/server/server.js +30 -20
- package/dist/utility/utilis/server/server.js.map +1 -1
- package/package.json +55 -56
- package/dist/chunk-5A3RVJNT.js +0 -19
- package/dist/chunk-5A3RVJNT.js.map +0 -1
- package/dist/chunk-D7A4TEXY.js.map +0 -1
- package/dist/chunk-EWQYVPOL.js.map +0 -1
- package/dist/chunk-ICFMWIIJ.js +0 -53
- package/dist/chunk-ICFMWIIJ.js.map +0 -1
- package/dist/chunk-LFRKRR7G.js.map +0 -1
- package/dist/chunk-MNSQSU7T.js.map +0 -1
- package/dist/chunk-NIOLLLJJ.js +0 -44
- package/dist/chunk-NIOLLLJJ.js.map +0 -1
- package/dist/chunk-P5XJG7OG.js.map +0 -1
- package/dist/chunk-QVTKG7FD.js.map +0 -1
- package/dist/chunk-SSFPGDA3.js.map +0 -1
- package/dist/chunk-TP3K7DMH.js.map +0 -1
- package/dist/chunk-UWIMSKL5.js.map +0 -1
- package/dist/chunk-VFF4YFA3.js.map +0 -1
- package/dist/chunk-W3W3X2OE.js.map +0 -1
- package/dist/chunk-X3R3RLXY.js.map +0 -1
- package/dist/chunk-XBJ3SJ26.js.map +0 -1
- package/dist/chunk-YTBSGKGF.js.map +0 -1
- package/dist/chunk-YWFCWT6R.js +0 -23
- package/dist/chunk-YWFCWT6R.js.map +0 -1
- package/dist/chunk-ZMDJ45KH.js.map +0 -1
- package/dist/engine/script/run-all.d.ts +0 -3
- package/dist/engine/script/run-all.js +0 -8
- package/dist/engine/script/run-bucket.d.ts +0 -3
- package/dist/engine/script/run-bucket.js +0 -8
- package/dist/engine/script/run-bucket.js.map +0 -1
- package/dist/engine/script/run-node-server.d.ts +0 -3
- package/dist/engine/script/run-node-server.js +0 -8
- package/dist/engine/script/run-node-server.js.map +0 -1
- package/dist/engine/server/app.d.ts +0 -5
- package/dist/engine/server/app.js +0 -10
- package/dist/engine/server/app.js.map +0 -1
- package/dist/utility/script/run-all.js +0 -8
- package/dist/utility/script/run-all.js.map +0 -1
- package/dist/utility/script/run-bucket.js +0 -8
- package/dist/utility/script/run-bucket.js.map +0 -1
- package/dist/utility/script/run-node-server.js +0 -8
- package/dist/utility/script/run-node-server.js.map +0 -1
- package/dist/utility/utilis/cloud_storage/s3Client.d.ts +0 -5
- package/dist/utility/utilis/cloud_storage/s3Client.js +0 -17
- package/dist/utility/utilis/cloud_storage/s3Client.js.map +0 -1
- /package/dist/{engine/script/run-all.js.map → utility/libs/index.js.map} +0 -0
- /package/dist/utility/{script → libs}/run-all.d.ts +0 -0
- /package/dist/utility/{script → libs}/run-bucket.d.ts +0 -0
- /package/dist/utility/{script → libs}/run-node-server.d.ts +0 -0
|
@@ -4,244 +4,8 @@ import { ResponseInterface } from '../../libs/types.js';
|
|
|
4
4
|
import 'mongodb';
|
|
5
5
|
import '../../libs/env.js';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Builds a normalized URL or path from an optional endpoint, path segments,
|
|
9
|
-
* and file name.
|
|
10
|
-
*
|
|
11
|
-
* The function safely combines all provided segments while removing empty
|
|
12
|
-
* values and normalizing slashes between segments. If the endpoint contains
|
|
13
|
-
* an HTTP or HTTPS protocol, the protocol is preserved separately so that
|
|
14
|
-
* slash normalization does not alter it.
|
|
15
|
-
*
|
|
16
|
-
* A `File` object can also be provided as `fileName`; in that case, its
|
|
17
|
-
* original file name is extracted automatically.
|
|
18
|
-
*
|
|
19
|
-
* @param options - Options used to construct the URL.
|
|
20
|
-
* @param options.end_point - Optional base URL or endpoint. Supports
|
|
21
|
-
* `http://` and `https://` protocols.
|
|
22
|
-
* @param options.path - Optional array of path segments to append to the
|
|
23
|
-
* endpoint.
|
|
24
|
-
* @param options.fileName - Optional file name or Web API `File` object.
|
|
25
|
-
*
|
|
26
|
-
* @returns A normalized URL/path containing the provided endpoint, path
|
|
27
|
-
* segments, and file name. Returns an empty string when no valid segments
|
|
28
|
-
* are provided.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* // Build a URL from an endpoint, path, and file name.
|
|
32
|
-
* const url = buildURL({
|
|
33
|
-
* end_point: 'https://storage.example.com',
|
|
34
|
-
* path: ['uploads', 'images'],
|
|
35
|
-
* fileName: 'profile.jpg',
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* // Returns:
|
|
39
|
-
* // https://storage.example.com/uploads/images/profile.jpg
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* // Extra slashes are automatically normalized.
|
|
43
|
-
* const url = buildURL({
|
|
44
|
-
* end_point: 'https://storage.example.com/',
|
|
45
|
-
* path: ['/uploads/', '/images//'],
|
|
46
|
-
* fileName: '/profile.jpg',
|
|
47
|
-
* });
|
|
48
|
-
*
|
|
49
|
-
* // Returns:
|
|
50
|
-
* // https://storage.example.com/uploads/images/profile.jpg
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* // A File object can be used as the file name.
|
|
54
|
-
* const url = buildURL({
|
|
55
|
-
* end_point: 'https://storage.example.com',
|
|
56
|
-
* path: ['uploads'],
|
|
57
|
-
* fileName: file,
|
|
58
|
-
* });
|
|
59
|
-
*
|
|
60
|
-
* // If file.name is "document.pdf":
|
|
61
|
-
* // https://storage.example.com/uploads/document.pdf
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* // The function can also build a path without a URL endpoint.
|
|
65
|
-
* const path = buildURL({
|
|
66
|
-
* path: ['uploads', 'documents'],
|
|
67
|
-
* fileName: 'report.pdf',
|
|
68
|
-
* });
|
|
69
|
-
*
|
|
70
|
-
* // Returns:
|
|
71
|
-
* // uploads/documents/report.pdf
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* // Empty or undefined segments are ignored.
|
|
75
|
-
* const url = buildURL({
|
|
76
|
-
* end_point: 'https://storage.example.com/',
|
|
77
|
-
* path: ['', 'uploads', '', 'documents'],
|
|
78
|
-
* fileName: 'report.pdf',
|
|
79
|
-
* });
|
|
80
|
-
*
|
|
81
|
-
* // Returns:
|
|
82
|
-
* // https://storage.example.com/uploads/documents/report.pdf
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* // Returns an empty string when no usable values are provided.
|
|
86
|
-
* const url = buildURL({});
|
|
87
|
-
*
|
|
88
|
-
* // Returns:
|
|
89
|
-
* // ''
|
|
90
|
-
*/
|
|
91
7
|
declare function buildURL({ end_point, path, fileName, }: URLOptions): string;
|
|
92
|
-
/**
|
|
93
|
-
* Extracts the object key/path from a full public file URL.
|
|
94
|
-
*
|
|
95
|
-
* This function is intended for files stored in the configured bucket.
|
|
96
|
-
* It parses the URL, extracts the pathname, removes the configured bucket
|
|
97
|
-
* name when it appears as the first path segment, and decodes any
|
|
98
|
-
* URL-encoded characters in the resulting object key.
|
|
99
|
-
*
|
|
100
|
-
* For example, a URL such as:
|
|
101
|
-
*
|
|
102
|
-
* `https://storage.example.com/my-bucket/uploads/images/profile%20photo.jpg`
|
|
103
|
-
*
|
|
104
|
-
* will produce:
|
|
105
|
-
*
|
|
106
|
-
* `uploads/images/profile photo.jpg`
|
|
107
|
-
*
|
|
108
|
-
* @param url - The full public URL of the stored file.
|
|
109
|
-
* @returns The decoded object key/path without the bucket name.
|
|
110
|
-
*
|
|
111
|
-
* @throws {TypeError} If the provided value is not a valid URL.
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* // Extract the object key from a bucket URL.
|
|
115
|
-
* const key = getKeyFromUrl(
|
|
116
|
-
* 'https://storage.example.com/my-bucket/uploads/profile.jpg'
|
|
117
|
-
* );
|
|
118
|
-
*
|
|
119
|
-
* // Returns:
|
|
120
|
-
* // 'uploads/profile.jpg'
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* // URL-encoded characters are decoded automatically.
|
|
124
|
-
* const key = getKeyFromUrl(
|
|
125
|
-
* 'https://storage.example.com/my-bucket/uploads/profile%20photo.jpg'
|
|
126
|
-
* );
|
|
127
|
-
*
|
|
128
|
-
* // Returns:
|
|
129
|
-
* // 'uploads/profile photo.jpg'
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* // Nested directories are preserved.
|
|
133
|
-
* const key = getKeyFromUrl(
|
|
134
|
-
* 'https://storage.example.com/my-bucket/users/123/avatar/image.png'
|
|
135
|
-
* );
|
|
136
|
-
*
|
|
137
|
-
* // Returns:
|
|
138
|
-
* // 'users/123/avatar/image.png'
|
|
139
|
-
*/
|
|
140
8
|
declare const getKeyFromUrl: (url: string) => string;
|
|
141
|
-
|
|
142
|
-
* Sends a standardized API response to the client.
|
|
143
|
-
*
|
|
144
|
-
* This function provides a consistent response structure for both successful
|
|
145
|
-
* and failed requests. The `success` property acts as the discriminator
|
|
146
|
-
* between the two response types.
|
|
147
|
-
*
|
|
148
|
-
* For successful responses, the function returns the supplied status,
|
|
149
|
-
* message, data, and metadata. For failed responses, it returns the supplied
|
|
150
|
-
* status, message, error information, and metadata.
|
|
151
|
-
*
|
|
152
|
-
* A response timestamp is automatically generated when one is not already
|
|
153
|
-
* provided through `meta.timestamp`.
|
|
154
|
-
*
|
|
155
|
-
* @param response - Express `Response` object used to send the HTTP response.
|
|
156
|
-
* @param success - Indicates whether the request was successful.
|
|
157
|
-
* @param status - HTTP status code returned to the client.
|
|
158
|
-
* @param message - Optional human-readable response message.
|
|
159
|
-
* @param data - Optional data returned by a successful operation.
|
|
160
|
-
* @param error - Error information returned when the operation fails.
|
|
161
|
-
* @param meta - Optional response metadata such as request ID, timestamp,
|
|
162
|
-
* pagination information, or other request-related information.
|
|
163
|
-
*
|
|
164
|
-
* @returns The Express response containing the standardized API payload.
|
|
165
|
-
*
|
|
166
|
-
* @example
|
|
167
|
-
* // Successful response.
|
|
168
|
-
* return response_to_client({
|
|
169
|
-
* response: res,
|
|
170
|
-
* success: true,
|
|
171
|
-
* status: 200,
|
|
172
|
-
* message: 'User fetched successfully.',
|
|
173
|
-
* data: user,
|
|
174
|
-
* });
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* // Successful response with pagination metadata.
|
|
178
|
-
* return response_to_client({
|
|
179
|
-
* response: res,
|
|
180
|
-
* success: true,
|
|
181
|
-
* status: 200,
|
|
182
|
-
* message: 'Users fetched successfully.',
|
|
183
|
-
* data: users,
|
|
184
|
-
* meta: {
|
|
185
|
-
* timestamp: new Date().toISOString(),
|
|
186
|
-
* requestId: 'req_123456',
|
|
187
|
-
* page: 1,
|
|
188
|
-
* limit: 20,
|
|
189
|
-
* totalItems: 100,
|
|
190
|
-
* totalPages: 5,
|
|
191
|
-
* },
|
|
192
|
-
* });
|
|
193
|
-
*
|
|
194
|
-
* @example
|
|
195
|
-
* // Error response.
|
|
196
|
-
* return response_to_client({
|
|
197
|
-
* response: res,
|
|
198
|
-
* success: false,
|
|
199
|
-
* status: 404,
|
|
200
|
-
* message: 'File not found.',
|
|
201
|
-
* error: {
|
|
202
|
-
* code: 'FILE_NOT_FOUND',
|
|
203
|
-
* path: '/files/profile.jpg',
|
|
204
|
-
* },
|
|
205
|
-
* });
|
|
206
|
-
*
|
|
207
|
-
* @example
|
|
208
|
-
* // Validation error with structured details.
|
|
209
|
-
* return response_to_client({
|
|
210
|
-
* response: res,
|
|
211
|
-
* success: false,
|
|
212
|
-
* status: 400,
|
|
213
|
-
* message: 'Validation failed.',
|
|
214
|
-
* error: {
|
|
215
|
-
* code: 'VALIDATION_ERROR',
|
|
216
|
-
* details: [
|
|
217
|
-
* {
|
|
218
|
-
* field: 'email',
|
|
219
|
-
* message: 'Invalid email address.',
|
|
220
|
-
* },
|
|
221
|
-
* {
|
|
222
|
-
* field: 'password',
|
|
223
|
-
* message: 'Password is required.',
|
|
224
|
-
* },
|
|
225
|
-
* ],
|
|
226
|
-
* },
|
|
227
|
-
* });
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* // Error response with a request ID for tracing.
|
|
231
|
-
* return response_to_client({
|
|
232
|
-
* response: res,
|
|
233
|
-
* success: false,
|
|
234
|
-
* status: 500,
|
|
235
|
-
* message: 'Internal server error.',
|
|
236
|
-
* error: {
|
|
237
|
-
* code: 'INTERNAL_SERVER_ERROR',
|
|
238
|
-
* },
|
|
239
|
-
* meta: {
|
|
240
|
-
* timestamp: new Date().toISOString(),
|
|
241
|
-
* requestId: 'req_abc123',
|
|
242
|
-
* },
|
|
243
|
-
* });
|
|
244
|
-
*/
|
|
245
|
-
declare const response_to_client: ({ response, ...payload }: ResponseInterface) => express.Response<any, Record<string, any>>;
|
|
9
|
+
declare const responseToClient: ({ response, ...payload }: ResponseInterface) => express.Response<any, Record<string, any>>;
|
|
246
10
|
|
|
247
|
-
export { buildURL, getKeyFromUrl,
|
|
11
|
+
export { buildURL, getKeyFromUrl, responseToClient };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildURL,
|
|
3
3
|
getKeyFromUrl,
|
|
4
|
-
|
|
5
|
-
} from "../../../chunk-
|
|
6
|
-
import "../../../chunk-
|
|
4
|
+
responseToClient
|
|
5
|
+
} from "../../../chunk-ZC33GE2U.js";
|
|
6
|
+
import "../../../chunk-LE2SDA4O.js";
|
|
7
7
|
import "../../../chunk-7QVYU63E.js";
|
|
8
8
|
export {
|
|
9
9
|
buildURL,
|
|
10
10
|
getKeyFromUrl,
|
|
11
|
-
|
|
11
|
+
responseToClient
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=web.js.map
|
|
@@ -4,50 +4,6 @@ import 'mongodb';
|
|
|
4
4
|
import 'express';
|
|
5
5
|
import '../../libs/env.js';
|
|
6
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
7
|
declare const mongoBulkWrite: (params: BulkWriteInterface) => Promise<CustomBulkWriteResult>;
|
|
52
8
|
|
|
53
9
|
export { mongoBulkWrite };
|
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
} from "../../../chunk-7QVYU63E.js";
|
|
9
|
-
|
|
10
|
-
// src/utility/utilis/mongoDb/buldWrite.ts
|
|
11
|
-
var mongoBulkWrite = /* @__PURE__ */ __name(async (params) => {
|
|
12
|
-
const { dbName, collectionName, writable, options } = params;
|
|
13
|
-
try {
|
|
14
|
-
const col = getMongoServer().db(dbName).collection(collectionName);
|
|
15
|
-
const result = await col.bulkWrite(writable, 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
|
-
}, "mongoBulkWrite");
|
|
2
|
+
mongoBulkWrite
|
|
3
|
+
} from "../../../chunk-EEQ2SXDE.js";
|
|
4
|
+
import "../../../chunk-2QNCQ5L5.js";
|
|
5
|
+
import "../../../chunk-QW2GGDEG.js";
|
|
6
|
+
import "../../../chunk-LE2SDA4O.js";
|
|
7
|
+
import "../../../chunk-7QVYU63E.js";
|
|
30
8
|
export {
|
|
31
9
|
mongoBulkWrite
|
|
32
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -4,51 +4,6 @@ import 'mongodb';
|
|
|
4
4
|
import 'express';
|
|
5
5
|
import '../../libs/env.js';
|
|
6
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
7
|
declare const mongoDeleteDocument: (params: DeleteDocuments) => Promise<CustomDeleteResult>;
|
|
53
8
|
|
|
54
9
|
export { mongoDeleteDocument };
|
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
} from "../../../chunk-7QVYU63E.js";
|
|
9
|
-
|
|
10
|
-
// src/utility/utilis/mongoDb/deleteDocument.ts
|
|
11
|
-
var mongoDeleteDocument = /* @__PURE__ */ __name(async (params) => {
|
|
12
|
-
const { dbName, collection, query, deleteMany = false, options } = params;
|
|
13
|
-
try {
|
|
14
|
-
const col = getMongoServer().db(dbName).collection(collection);
|
|
15
|
-
const result = deleteMany ? await col.deleteMany(query, options) : await col.deleteOne(query, options);
|
|
16
|
-
return {
|
|
17
|
-
status: true,
|
|
18
|
-
result,
|
|
19
|
-
deletedCount: result.deletedCount,
|
|
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
|
-
deletedCount: 0,
|
|
28
|
-
error
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}, "mongoDeleteDocument");
|
|
2
|
+
mongoDeleteDocument
|
|
3
|
+
} from "../../../chunk-6BNQOIVA.js";
|
|
4
|
+
import "../../../chunk-2QNCQ5L5.js";
|
|
5
|
+
import "../../../chunk-QW2GGDEG.js";
|
|
6
|
+
import "../../../chunk-LE2SDA4O.js";
|
|
7
|
+
import "../../../chunk-7QVYU63E.js";
|
|
32
8
|
export {
|
|
33
9
|
mongoDeleteDocument
|
|
34
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -4,37 +4,6 @@ import 'mongodb';
|
|
|
4
4
|
import 'express';
|
|
5
5
|
import '../../libs/env.js';
|
|
6
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>>;
|
|
7
|
+
declare const mongoInsertField: <T>(params: InsertOneInterface<T>) => Promise<CustomInsertOneResult<T>>;
|
|
39
8
|
|
|
40
|
-
export {
|
|
9
|
+
export { mongoInsertField };
|
|
@@ -1,34 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
} from "../../../chunk-7QVYU63E.js";
|
|
9
|
-
|
|
10
|
-
// src/utility/utilis/mongoDb/insertField.ts
|
|
11
|
-
var mongoInsertOneField = /* @__PURE__ */ __name(async (params) => {
|
|
12
|
-
const { dbName, collectionName, field, options } = params;
|
|
13
|
-
try {
|
|
14
|
-
const db = getMongoServer().db(dbName);
|
|
15
|
-
const collection = db.collection(collectionName);
|
|
16
|
-
const result = await collection.insertOne(field, options);
|
|
17
|
-
return {
|
|
18
|
-
status: true,
|
|
19
|
-
result,
|
|
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
|
-
error
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}, "mongoInsertOneField");
|
|
2
|
+
mongoInsertField
|
|
3
|
+
} from "../../../chunk-YA3MW2CJ.js";
|
|
4
|
+
import "../../../chunk-2QNCQ5L5.js";
|
|
5
|
+
import "../../../chunk-QW2GGDEG.js";
|
|
6
|
+
import "../../../chunk-LE2SDA4O.js";
|
|
7
|
+
import "../../../chunk-7QVYU63E.js";
|
|
31
8
|
export {
|
|
32
|
-
|
|
9
|
+
mongoInsertField
|
|
33
10
|
};
|
|
34
11
|
//# sourceMappingURL=insertField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -4,45 +4,6 @@ import 'mongodb';
|
|
|
4
4
|
import 'express';
|
|
5
5
|
import '../../libs/env.js';
|
|
6
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>>;
|
|
7
|
+
declare const mongoInsertFields: <T>(params: InsertManyInterface<T>) => Promise<CustomInsertManyResult<T>>;
|
|
47
8
|
|
|
48
|
-
export {
|
|
9
|
+
export { mongoInsertFields };
|
|
@@ -1,36 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
} from "../../../chunk-7QVYU63E.js";
|
|
9
|
-
|
|
10
|
-
// src/utility/utilis/mongoDb/insertFields.ts
|
|
11
|
-
var mongoInsertManyFields = /* @__PURE__ */ __name(async (params) => {
|
|
12
|
-
const { dbName, collectionName, fields, options } = params;
|
|
13
|
-
try {
|
|
14
|
-
const db = getMongoServer().db(dbName);
|
|
15
|
-
const collection = db.collection(collectionName);
|
|
16
|
-
const result = await collection.insertMany(fields, options);
|
|
17
|
-
return {
|
|
18
|
-
status: true,
|
|
19
|
-
result,
|
|
20
|
-
insertedCount: result.insertedCount,
|
|
21
|
-
error: null
|
|
22
|
-
};
|
|
23
|
-
} catch (err) {
|
|
24
|
-
const error = err instanceof Error ? err : new Error(String(err));
|
|
25
|
-
return {
|
|
26
|
-
status: false,
|
|
27
|
-
result: null,
|
|
28
|
-
insertedCount: 0,
|
|
29
|
-
error
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}, "mongoInsertManyFields");
|
|
2
|
+
mongoInsertFields
|
|
3
|
+
} from "../../../chunk-EUWCMMGI.js";
|
|
4
|
+
import "../../../chunk-2QNCQ5L5.js";
|
|
5
|
+
import "../../../chunk-QW2GGDEG.js";
|
|
6
|
+
import "../../../chunk-LE2SDA4O.js";
|
|
7
|
+
import "../../../chunk-7QVYU63E.js";
|
|
33
8
|
export {
|
|
34
|
-
|
|
9
|
+
mongoInsertFields
|
|
35
10
|
};
|
|
36
11
|
//# sourceMappingURL=insertFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|