@opra/mongodb 0.33.4 → 0.33.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/cjs/mongo-array-service.js +9 -0
- package/cjs/mongo-collection-service.js +12 -1
- package/esm/mongo-array-service.js +9 -0
- package/esm/mongo-collection-service.js +12 -1
- package/package.json +3 -3
- package/types/mongo-array-service.d.ts +17 -10
- package/types/mongo-collection-service.d.ts +14 -9
|
@@ -57,6 +57,7 @@ class MongoArrayService extends mongo_service_js_1.MongoService {
|
|
|
57
57
|
const info = {
|
|
58
58
|
crud: 'create',
|
|
59
59
|
method: 'create',
|
|
60
|
+
byId: false,
|
|
60
61
|
documentId,
|
|
61
62
|
itemId: input._id,
|
|
62
63
|
input,
|
|
@@ -98,6 +99,7 @@ class MongoArrayService extends mongo_service_js_1.MongoService {
|
|
|
98
99
|
const info = {
|
|
99
100
|
crud: 'read',
|
|
100
101
|
method: 'count',
|
|
102
|
+
byId: false,
|
|
101
103
|
documentId,
|
|
102
104
|
options
|
|
103
105
|
};
|
|
@@ -148,6 +150,7 @@ class MongoArrayService extends mongo_service_js_1.MongoService {
|
|
|
148
150
|
const info = {
|
|
149
151
|
crud: 'delete',
|
|
150
152
|
method: 'delete',
|
|
153
|
+
byId: true,
|
|
151
154
|
documentId,
|
|
152
155
|
itemId: id,
|
|
153
156
|
options
|
|
@@ -188,6 +191,7 @@ class MongoArrayService extends mongo_service_js_1.MongoService {
|
|
|
188
191
|
const info = {
|
|
189
192
|
crud: 'delete',
|
|
190
193
|
method: 'deleteMany',
|
|
194
|
+
byId: false,
|
|
191
195
|
documentId,
|
|
192
196
|
options
|
|
193
197
|
};
|
|
@@ -240,6 +244,7 @@ class MongoArrayService extends mongo_service_js_1.MongoService {
|
|
|
240
244
|
const info = {
|
|
241
245
|
crud: 'read',
|
|
242
246
|
method: 'findById',
|
|
247
|
+
byId: true,
|
|
243
248
|
documentId,
|
|
244
249
|
itemId: id,
|
|
245
250
|
options
|
|
@@ -280,6 +285,7 @@ class MongoArrayService extends mongo_service_js_1.MongoService {
|
|
|
280
285
|
const info = {
|
|
281
286
|
crud: 'read',
|
|
282
287
|
method: 'findOne',
|
|
288
|
+
byId: false,
|
|
283
289
|
documentId,
|
|
284
290
|
options
|
|
285
291
|
};
|
|
@@ -312,6 +318,7 @@ class MongoArrayService extends mongo_service_js_1.MongoService {
|
|
|
312
318
|
const args = {
|
|
313
319
|
crud: 'read',
|
|
314
320
|
method: 'findMany',
|
|
321
|
+
byId: false,
|
|
315
322
|
documentId,
|
|
316
323
|
options
|
|
317
324
|
};
|
|
@@ -429,6 +436,7 @@ class MongoArrayService extends mongo_service_js_1.MongoService {
|
|
|
429
436
|
const info = {
|
|
430
437
|
crud: 'update',
|
|
431
438
|
method: 'update',
|
|
439
|
+
byId: true,
|
|
432
440
|
documentId,
|
|
433
441
|
itemId: id,
|
|
434
442
|
options
|
|
@@ -463,6 +471,7 @@ class MongoArrayService extends mongo_service_js_1.MongoService {
|
|
|
463
471
|
crud: 'update',
|
|
464
472
|
method: 'updateMany',
|
|
465
473
|
documentId,
|
|
474
|
+
byId: false,
|
|
466
475
|
input,
|
|
467
476
|
options
|
|
468
477
|
};
|
|
@@ -51,6 +51,7 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
51
51
|
const info = {
|
|
52
52
|
crud: 'create',
|
|
53
53
|
method: 'create',
|
|
54
|
+
byId: false,
|
|
54
55
|
documentId: input._id,
|
|
55
56
|
input,
|
|
56
57
|
options
|
|
@@ -86,6 +87,7 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
86
87
|
const info = {
|
|
87
88
|
crud: 'read',
|
|
88
89
|
method: 'count',
|
|
90
|
+
byId: false,
|
|
89
91
|
options
|
|
90
92
|
};
|
|
91
93
|
return this._intercept(async () => {
|
|
@@ -111,6 +113,7 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
111
113
|
const info = {
|
|
112
114
|
crud: 'delete',
|
|
113
115
|
method: 'delete',
|
|
116
|
+
byId: false,
|
|
114
117
|
documentId: id,
|
|
115
118
|
options
|
|
116
119
|
};
|
|
@@ -139,7 +142,8 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
139
142
|
async deleteMany(options) {
|
|
140
143
|
const info = {
|
|
141
144
|
crud: 'delete',
|
|
142
|
-
method: '
|
|
145
|
+
method: 'deleteMany',
|
|
146
|
+
byId: false,
|
|
143
147
|
options
|
|
144
148
|
};
|
|
145
149
|
return this._intercept(async () => {
|
|
@@ -159,6 +163,7 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
159
163
|
const info = {
|
|
160
164
|
crud: 'read',
|
|
161
165
|
method: 'distinct',
|
|
166
|
+
byId: true,
|
|
162
167
|
options
|
|
163
168
|
};
|
|
164
169
|
return this._intercept(async () => {
|
|
@@ -203,6 +208,7 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
203
208
|
const info = {
|
|
204
209
|
crud: 'read',
|
|
205
210
|
method: 'findById',
|
|
211
|
+
byId: true,
|
|
206
212
|
documentId: id,
|
|
207
213
|
options
|
|
208
214
|
};
|
|
@@ -241,6 +247,7 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
241
247
|
const info = {
|
|
242
248
|
crud: 'read',
|
|
243
249
|
method: 'findOne',
|
|
250
|
+
byId: false,
|
|
244
251
|
options
|
|
245
252
|
};
|
|
246
253
|
return this._intercept(async () => {
|
|
@@ -282,6 +289,7 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
282
289
|
const info = {
|
|
283
290
|
crud: 'read',
|
|
284
291
|
method: 'findMany',
|
|
292
|
+
byId: false,
|
|
285
293
|
options
|
|
286
294
|
};
|
|
287
295
|
return this._intercept(async () => {
|
|
@@ -371,6 +379,7 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
371
379
|
crud: 'update',
|
|
372
380
|
method: 'update',
|
|
373
381
|
documentId: id,
|
|
382
|
+
byId: true,
|
|
374
383
|
input,
|
|
375
384
|
options,
|
|
376
385
|
};
|
|
@@ -425,6 +434,7 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
425
434
|
crud: 'update',
|
|
426
435
|
method: 'update',
|
|
427
436
|
documentId: id,
|
|
437
|
+
byId: true,
|
|
428
438
|
input,
|
|
429
439
|
options,
|
|
430
440
|
};
|
|
@@ -477,6 +487,7 @@ class MongoCollectionService extends mongo_service_js_1.MongoService {
|
|
|
477
487
|
const info = {
|
|
478
488
|
crud: 'update',
|
|
479
489
|
method: 'updateMany',
|
|
490
|
+
byId: false,
|
|
480
491
|
input,
|
|
481
492
|
options,
|
|
482
493
|
};
|
|
@@ -53,6 +53,7 @@ export class MongoArrayService extends MongoService {
|
|
|
53
53
|
const info = {
|
|
54
54
|
crud: 'create',
|
|
55
55
|
method: 'create',
|
|
56
|
+
byId: false,
|
|
56
57
|
documentId,
|
|
57
58
|
itemId: input._id,
|
|
58
59
|
input,
|
|
@@ -94,6 +95,7 @@ export class MongoArrayService extends MongoService {
|
|
|
94
95
|
const info = {
|
|
95
96
|
crud: 'read',
|
|
96
97
|
method: 'count',
|
|
98
|
+
byId: false,
|
|
97
99
|
documentId,
|
|
98
100
|
options
|
|
99
101
|
};
|
|
@@ -144,6 +146,7 @@ export class MongoArrayService extends MongoService {
|
|
|
144
146
|
const info = {
|
|
145
147
|
crud: 'delete',
|
|
146
148
|
method: 'delete',
|
|
149
|
+
byId: true,
|
|
147
150
|
documentId,
|
|
148
151
|
itemId: id,
|
|
149
152
|
options
|
|
@@ -184,6 +187,7 @@ export class MongoArrayService extends MongoService {
|
|
|
184
187
|
const info = {
|
|
185
188
|
crud: 'delete',
|
|
186
189
|
method: 'deleteMany',
|
|
190
|
+
byId: false,
|
|
187
191
|
documentId,
|
|
188
192
|
options
|
|
189
193
|
};
|
|
@@ -236,6 +240,7 @@ export class MongoArrayService extends MongoService {
|
|
|
236
240
|
const info = {
|
|
237
241
|
crud: 'read',
|
|
238
242
|
method: 'findById',
|
|
243
|
+
byId: true,
|
|
239
244
|
documentId,
|
|
240
245
|
itemId: id,
|
|
241
246
|
options
|
|
@@ -276,6 +281,7 @@ export class MongoArrayService extends MongoService {
|
|
|
276
281
|
const info = {
|
|
277
282
|
crud: 'read',
|
|
278
283
|
method: 'findOne',
|
|
284
|
+
byId: false,
|
|
279
285
|
documentId,
|
|
280
286
|
options
|
|
281
287
|
};
|
|
@@ -308,6 +314,7 @@ export class MongoArrayService extends MongoService {
|
|
|
308
314
|
const args = {
|
|
309
315
|
crud: 'read',
|
|
310
316
|
method: 'findMany',
|
|
317
|
+
byId: false,
|
|
311
318
|
documentId,
|
|
312
319
|
options
|
|
313
320
|
};
|
|
@@ -425,6 +432,7 @@ export class MongoArrayService extends MongoService {
|
|
|
425
432
|
const info = {
|
|
426
433
|
crud: 'update',
|
|
427
434
|
method: 'update',
|
|
435
|
+
byId: true,
|
|
428
436
|
documentId,
|
|
429
437
|
itemId: id,
|
|
430
438
|
options
|
|
@@ -459,6 +467,7 @@ export class MongoArrayService extends MongoService {
|
|
|
459
467
|
crud: 'update',
|
|
460
468
|
method: 'updateMany',
|
|
461
469
|
documentId,
|
|
470
|
+
byId: false,
|
|
462
471
|
input,
|
|
463
472
|
options
|
|
464
473
|
};
|
|
@@ -47,6 +47,7 @@ export class MongoCollectionService extends MongoService {
|
|
|
47
47
|
const info = {
|
|
48
48
|
crud: 'create',
|
|
49
49
|
method: 'create',
|
|
50
|
+
byId: false,
|
|
50
51
|
documentId: input._id,
|
|
51
52
|
input,
|
|
52
53
|
options
|
|
@@ -82,6 +83,7 @@ export class MongoCollectionService extends MongoService {
|
|
|
82
83
|
const info = {
|
|
83
84
|
crud: 'read',
|
|
84
85
|
method: 'count',
|
|
86
|
+
byId: false,
|
|
85
87
|
options
|
|
86
88
|
};
|
|
87
89
|
return this._intercept(async () => {
|
|
@@ -107,6 +109,7 @@ export class MongoCollectionService extends MongoService {
|
|
|
107
109
|
const info = {
|
|
108
110
|
crud: 'delete',
|
|
109
111
|
method: 'delete',
|
|
112
|
+
byId: false,
|
|
110
113
|
documentId: id,
|
|
111
114
|
options
|
|
112
115
|
};
|
|
@@ -135,7 +138,8 @@ export class MongoCollectionService extends MongoService {
|
|
|
135
138
|
async deleteMany(options) {
|
|
136
139
|
const info = {
|
|
137
140
|
crud: 'delete',
|
|
138
|
-
method: '
|
|
141
|
+
method: 'deleteMany',
|
|
142
|
+
byId: false,
|
|
139
143
|
options
|
|
140
144
|
};
|
|
141
145
|
return this._intercept(async () => {
|
|
@@ -155,6 +159,7 @@ export class MongoCollectionService extends MongoService {
|
|
|
155
159
|
const info = {
|
|
156
160
|
crud: 'read',
|
|
157
161
|
method: 'distinct',
|
|
162
|
+
byId: true,
|
|
158
163
|
options
|
|
159
164
|
};
|
|
160
165
|
return this._intercept(async () => {
|
|
@@ -199,6 +204,7 @@ export class MongoCollectionService extends MongoService {
|
|
|
199
204
|
const info = {
|
|
200
205
|
crud: 'read',
|
|
201
206
|
method: 'findById',
|
|
207
|
+
byId: true,
|
|
202
208
|
documentId: id,
|
|
203
209
|
options
|
|
204
210
|
};
|
|
@@ -237,6 +243,7 @@ export class MongoCollectionService extends MongoService {
|
|
|
237
243
|
const info = {
|
|
238
244
|
crud: 'read',
|
|
239
245
|
method: 'findOne',
|
|
246
|
+
byId: false,
|
|
240
247
|
options
|
|
241
248
|
};
|
|
242
249
|
return this._intercept(async () => {
|
|
@@ -278,6 +285,7 @@ export class MongoCollectionService extends MongoService {
|
|
|
278
285
|
const info = {
|
|
279
286
|
crud: 'read',
|
|
280
287
|
method: 'findMany',
|
|
288
|
+
byId: false,
|
|
281
289
|
options
|
|
282
290
|
};
|
|
283
291
|
return this._intercept(async () => {
|
|
@@ -367,6 +375,7 @@ export class MongoCollectionService extends MongoService {
|
|
|
367
375
|
crud: 'update',
|
|
368
376
|
method: 'update',
|
|
369
377
|
documentId: id,
|
|
378
|
+
byId: true,
|
|
370
379
|
input,
|
|
371
380
|
options,
|
|
372
381
|
};
|
|
@@ -421,6 +430,7 @@ export class MongoCollectionService extends MongoService {
|
|
|
421
430
|
crud: 'update',
|
|
422
431
|
method: 'update',
|
|
423
432
|
documentId: id,
|
|
433
|
+
byId: true,
|
|
424
434
|
input,
|
|
425
435
|
options,
|
|
426
436
|
};
|
|
@@ -473,6 +483,7 @@ export class MongoCollectionService extends MongoService {
|
|
|
473
483
|
const info = {
|
|
474
484
|
crud: 'update',
|
|
475
485
|
method: 'updateMany',
|
|
486
|
+
byId: false,
|
|
476
487
|
input,
|
|
477
488
|
options,
|
|
478
489
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/mongodb",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.6",
|
|
4
4
|
"description": "Opra MongoDB adapter package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"ts-gems": "^3.1.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@opra/common": "^0.33.
|
|
34
|
-
"@opra/core": "^0.33.
|
|
33
|
+
"@opra/common": "^0.33.6",
|
|
34
|
+
"@opra/core": "^0.33.6",
|
|
35
35
|
"mongodb": ">=6.x.x"
|
|
36
36
|
},
|
|
37
37
|
"type": "module",
|
|
@@ -42,6 +42,7 @@ export declare class MongoArrayService<T extends mongodb.Document> extends Mongo
|
|
|
42
42
|
$documentFilter?: FilterInput | ((args: {
|
|
43
43
|
crud: MongoService.CrudOp;
|
|
44
44
|
method: string;
|
|
45
|
+
byId: boolean;
|
|
45
46
|
documentId?: AnyId;
|
|
46
47
|
itemId?: AnyId;
|
|
47
48
|
input?: Record<string, any>;
|
|
@@ -55,6 +56,7 @@ export declare class MongoArrayService<T extends mongodb.Document> extends Mongo
|
|
|
55
56
|
$arrayFilter?: FilterInput | ((args: {
|
|
56
57
|
crud: MongoService.CrudOp;
|
|
57
58
|
method: string;
|
|
59
|
+
byId: boolean;
|
|
58
60
|
documentId?: AnyId;
|
|
59
61
|
itemId?: AnyId;
|
|
60
62
|
input?: Record<string, any>;
|
|
@@ -63,21 +65,23 @@ export declare class MongoArrayService<T extends mongodb.Document> extends Mongo
|
|
|
63
65
|
/**
|
|
64
66
|
* Interceptor function for handling callback execution with provided arguments.
|
|
65
67
|
*
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
70
|
-
* @param
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
*
|
|
75
|
-
* @
|
|
68
|
+
* @param callback - The callback function to be intercepted.
|
|
69
|
+
* @param args - The arguments object containing the following properties:
|
|
70
|
+
* @param crud - The CRUD operation type.
|
|
71
|
+
* @param method - The method name.
|
|
72
|
+
* @param byId - True if current operation affects byId records (updateMany, deleteMany etc)
|
|
73
|
+
* @param documentId - The document ID (optional).
|
|
74
|
+
* @param itemId - ID for an item. (optional).
|
|
75
|
+
* @param input - The input object (optional).
|
|
76
|
+
* @param options - Additional options (optional).
|
|
77
|
+
* @param _this - The reference to the current object.
|
|
78
|
+
* @returns - The promise that resolves to the result of the callback execution.
|
|
76
79
|
*/
|
|
77
80
|
$interceptor?: (callback: (...args: any[]) => any, args: {
|
|
78
81
|
crud: MongoService.CrudOp;
|
|
79
82
|
method: string;
|
|
80
83
|
documentId?: AnyId;
|
|
84
|
+
byId: boolean;
|
|
81
85
|
itemId?: AnyId;
|
|
82
86
|
input?: Record<string, any>;
|
|
83
87
|
options?: Record<string, any>;
|
|
@@ -263,6 +267,7 @@ export declare class MongoArrayService<T extends mongodb.Document> extends Mongo
|
|
|
263
267
|
protected _getDocumentFilter(args: {
|
|
264
268
|
crud: MongoService.CrudOp;
|
|
265
269
|
method: string;
|
|
270
|
+
byId: boolean;
|
|
266
271
|
documentId?: AnyId;
|
|
267
272
|
itemId?: AnyId;
|
|
268
273
|
input?: Object;
|
|
@@ -279,6 +284,7 @@ export declare class MongoArrayService<T extends mongodb.Document> extends Mongo
|
|
|
279
284
|
protected _getArrayFilter(args: {
|
|
280
285
|
crud: MongoService.CrudOp;
|
|
281
286
|
method: string;
|
|
287
|
+
byId: boolean;
|
|
282
288
|
documentId?: AnyId;
|
|
283
289
|
itemId?: AnyId;
|
|
284
290
|
input?: Object;
|
|
@@ -287,6 +293,7 @@ export declare class MongoArrayService<T extends mongodb.Document> extends Mongo
|
|
|
287
293
|
protected _intercept(callback: (...args: any[]) => any, args: {
|
|
288
294
|
crud: MongoService.CrudOp;
|
|
289
295
|
method: string;
|
|
296
|
+
byId: boolean;
|
|
290
297
|
documentId?: AnyId;
|
|
291
298
|
itemId?: AnyId;
|
|
292
299
|
input?: Object;
|
|
@@ -30,6 +30,7 @@ export declare class MongoCollectionService<T extends mongodb.Document> extends
|
|
|
30
30
|
$documentFilter?: FilterInput | ((args: {
|
|
31
31
|
crud: MongoService.CrudOp;
|
|
32
32
|
method: string;
|
|
33
|
+
byId: boolean;
|
|
33
34
|
documentId?: AnyId;
|
|
34
35
|
input?: Record<string, any>;
|
|
35
36
|
options?: Record<string, any>;
|
|
@@ -37,19 +38,21 @@ export declare class MongoCollectionService<T extends mongodb.Document> extends
|
|
|
37
38
|
/**
|
|
38
39
|
* Interceptor function for handling callback execution with provided arguments.
|
|
39
40
|
*
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
*
|
|
48
|
-
* @
|
|
41
|
+
* @param callback - The callback function to be intercepted.
|
|
42
|
+
* @param args - The arguments object containing the following properties:
|
|
43
|
+
* @param crud - The CRUD operation type.
|
|
44
|
+
* @param method - The method name.
|
|
45
|
+
* @param byId - True if current operation affects byId records (updateMany, deleteMany etc)
|
|
46
|
+
* @param documentId - The document ID (optional).
|
|
47
|
+
* @param input - The input object (optional).
|
|
48
|
+
* @param options - Additional options (optional).
|
|
49
|
+
* @param _this - The reference to the current object.
|
|
50
|
+
* @returns - The promise that resolves to the result of the callback execution.
|
|
49
51
|
*/
|
|
50
52
|
$interceptor?: (callback: () => any, args: {
|
|
51
53
|
crud: MongoService.CrudOp;
|
|
52
54
|
method: string;
|
|
55
|
+
byId: boolean;
|
|
53
56
|
documentId?: AnyId;
|
|
54
57
|
input?: Record<string, any>;
|
|
55
58
|
options?: Record<string, any>;
|
|
@@ -216,6 +219,7 @@ export declare class MongoCollectionService<T extends mongodb.Document> extends
|
|
|
216
219
|
protected _getDocumentFilter(args: {
|
|
217
220
|
crud: MongoService.CrudOp;
|
|
218
221
|
method: string;
|
|
222
|
+
byId: boolean;
|
|
219
223
|
documentId?: AnyId;
|
|
220
224
|
input?: Object;
|
|
221
225
|
options?: Record<string, any>;
|
|
@@ -223,6 +227,7 @@ export declare class MongoCollectionService<T extends mongodb.Document> extends
|
|
|
223
227
|
protected _intercept(callback: (...args: any[]) => any, args: {
|
|
224
228
|
crud: MongoService.CrudOp;
|
|
225
229
|
method: string;
|
|
230
|
+
byId: boolean;
|
|
226
231
|
documentId?: AnyId;
|
|
227
232
|
input?: Object;
|
|
228
233
|
options?: Record<string, any>;
|