@common-stack/store-mongo 0.2.5 → 0.2.8
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/lib/index.d.ts +1 -0
- package/lib/index.js +249 -56
- package/lib/index.js.map +1 -1
- package/lib/interfaces/base-repository.d.ts +7 -0
- package/lib/interfaces/generated-models.d.ts +96 -0
- package/lib/interfaces/get-all-args.d.ts +1 -8
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/mixins/base-service-mixin.d.ts +3 -0
- package/lib/mixins/index.d.ts +1 -0
- package/lib/services/base-proxy-service.d.ts +24 -0
- package/lib/services/index.d.ts +1 -0
- package/lib/store/repositories/base-repository.d.ts +1 -1
- package/package.json +2 -2
- package/lib/constants/default-options.d.ts +0 -3
- package/lib/constants/index.d.ts +0 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -87,49 +87,6 @@ module.exports =
|
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
89
89
|
|
|
90
|
-
/***/ "./src/constants/default-options.ts":
|
|
91
|
-
/*!******************************************!*\
|
|
92
|
-
!*** ./src/constants/default-options.ts ***!
|
|
93
|
-
\******************************************/
|
|
94
|
-
/*! no static exports found */
|
|
95
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
96
|
-
|
|
97
|
-
"use strict";
|
|
98
|
-
|
|
99
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
100
|
-
exports.DEFAULT_SORTING = void 0;
|
|
101
|
-
exports.DEFAULT_SORTING = {
|
|
102
|
-
id: 'asc',
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
/***/ }),
|
|
107
|
-
|
|
108
|
-
/***/ "./src/constants/index.ts":
|
|
109
|
-
/*!********************************!*\
|
|
110
|
-
!*** ./src/constants/index.ts ***!
|
|
111
|
-
\********************************/
|
|
112
|
-
/*! no static exports found */
|
|
113
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
114
|
-
|
|
115
|
-
"use strict";
|
|
116
|
-
|
|
117
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
118
|
-
if (k2 === undefined) k2 = k;
|
|
119
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
120
|
-
}) : (function(o, m, k, k2) {
|
|
121
|
-
if (k2 === undefined) k2 = k;
|
|
122
|
-
o[k2] = m[k];
|
|
123
|
-
}));
|
|
124
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
125
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
126
|
-
};
|
|
127
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
128
|
-
__exportStar(__webpack_require__(/*! ./default-options */ "./src/constants/default-options.ts"), exports);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
/***/ }),
|
|
132
|
-
|
|
133
90
|
/***/ "./src/dataloaders/bulk-dataloader.ts":
|
|
134
91
|
/*!********************************************!*\
|
|
135
92
|
!*** ./src/dataloaders/bulk-dataloader.ts ***!
|
|
@@ -278,6 +235,7 @@ __exportStar(__webpack_require__(/*! ./helpers */ "./src/helpers/index.ts"), exp
|
|
|
278
235
|
__exportStar(__webpack_require__(/*! ./services */ "./src/services/index.ts"), exports);
|
|
279
236
|
__exportStar(__webpack_require__(/*! ./store */ "./src/store/index.ts"), exports);
|
|
280
237
|
__exportStar(__webpack_require__(/*! ./dataloaders */ "./src/dataloaders/index.ts"), exports);
|
|
238
|
+
__exportStar(__webpack_require__(/*! ./mixins */ "./src/mixins/index.ts"), exports);
|
|
281
239
|
|
|
282
240
|
|
|
283
241
|
/***/ }),
|
|
@@ -292,6 +250,15 @@ __exportStar(__webpack_require__(/*! ./dataloaders */ "./src/dataloaders/index.t
|
|
|
292
250
|
"use strict";
|
|
293
251
|
|
|
294
252
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
253
|
+
exports.DEFAULT_SORTING = exports.PAGINATION_OPTIONS = void 0;
|
|
254
|
+
var PAGINATION_OPTIONS;
|
|
255
|
+
(function (PAGINATION_OPTIONS) {
|
|
256
|
+
PAGINATION_OPTIONS[PAGINATION_OPTIONS["limit"] = 10] = "limit";
|
|
257
|
+
PAGINATION_OPTIONS[PAGINATION_OPTIONS["skip"] = 0] = "skip";
|
|
258
|
+
})(PAGINATION_OPTIONS = exports.PAGINATION_OPTIONS || (exports.PAGINATION_OPTIONS = {}));
|
|
259
|
+
exports.DEFAULT_SORTING = {
|
|
260
|
+
id: 'asc',
|
|
261
|
+
};
|
|
295
262
|
|
|
296
263
|
|
|
297
264
|
/***/ }),
|
|
@@ -324,17 +291,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
324
291
|
|
|
325
292
|
/***/ }),
|
|
326
293
|
|
|
327
|
-
/***/ "./src/interfaces/
|
|
328
|
-
|
|
329
|
-
!*** ./src/interfaces/
|
|
330
|
-
|
|
294
|
+
/***/ "./src/interfaces/generated-models.ts":
|
|
295
|
+
/*!********************************************!*\
|
|
296
|
+
!*** ./src/interfaces/generated-models.ts ***!
|
|
297
|
+
\********************************************/
|
|
331
298
|
/*! no static exports found */
|
|
332
299
|
/***/ (function(module, exports, __webpack_require__) {
|
|
333
300
|
|
|
334
301
|
"use strict";
|
|
335
302
|
|
|
336
303
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
337
|
-
exports.ISortEnum = void 0;
|
|
304
|
+
exports.ISortEnum = exports.IMoleculerServiceName = exports.ICacheControlScope = exports.IBaseServiceCommands = void 0;
|
|
305
|
+
var IBaseServiceCommands;
|
|
306
|
+
(function (IBaseServiceCommands) {
|
|
307
|
+
IBaseServiceCommands["count"] = "count";
|
|
308
|
+
IBaseServiceCommands["get"] = "get";
|
|
309
|
+
IBaseServiceCommands["getAll"] = "getAll";
|
|
310
|
+
IBaseServiceCommands["getByIds"] = "getByIds";
|
|
311
|
+
IBaseServiceCommands["create"] = "create";
|
|
312
|
+
IBaseServiceCommands["insert"] = "insert";
|
|
313
|
+
IBaseServiceCommands["bulkCreate"] = "bulkCreate";
|
|
314
|
+
IBaseServiceCommands["update"] = "update";
|
|
315
|
+
IBaseServiceCommands["delete"] = "delete";
|
|
316
|
+
IBaseServiceCommands["getAllWithCount"] = "getAllWithCount";
|
|
317
|
+
})(IBaseServiceCommands = exports.IBaseServiceCommands || (exports.IBaseServiceCommands = {}));
|
|
318
|
+
var ICacheControlScope;
|
|
319
|
+
(function (ICacheControlScope) {
|
|
320
|
+
ICacheControlScope["PUBLIC"] = "PUBLIC";
|
|
321
|
+
ICacheControlScope["PRIVATE"] = "PRIVATE";
|
|
322
|
+
})(ICacheControlScope = exports.ICacheControlScope || (exports.ICacheControlScope = {}));
|
|
323
|
+
/** All Moleculer Topic names are extended from this. */
|
|
324
|
+
var IMoleculerServiceName;
|
|
325
|
+
(function (IMoleculerServiceName) {
|
|
326
|
+
IMoleculerServiceName["dummy"] = "dummy";
|
|
327
|
+
})(IMoleculerServiceName = exports.IMoleculerServiceName || (exports.IMoleculerServiceName = {}));
|
|
338
328
|
var ISortEnum;
|
|
339
329
|
(function (ISortEnum) {
|
|
340
330
|
ISortEnum["ASC"] = "ASC";
|
|
@@ -342,6 +332,20 @@ var ISortEnum;
|
|
|
342
332
|
})(ISortEnum = exports.ISortEnum || (exports.ISortEnum = {}));
|
|
343
333
|
|
|
344
334
|
|
|
335
|
+
/***/ }),
|
|
336
|
+
|
|
337
|
+
/***/ "./src/interfaces/get-all-args.ts":
|
|
338
|
+
/*!****************************************!*\
|
|
339
|
+
!*** ./src/interfaces/get-all-args.ts ***!
|
|
340
|
+
\****************************************/
|
|
341
|
+
/*! no static exports found */
|
|
342
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
343
|
+
|
|
344
|
+
"use strict";
|
|
345
|
+
|
|
346
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
347
|
+
|
|
348
|
+
|
|
345
349
|
/***/ }),
|
|
346
350
|
|
|
347
351
|
/***/ "./src/interfaces/index.ts":
|
|
@@ -369,6 +373,7 @@ __exportStar(__webpack_require__(/*! ./get-all-args */ "./src/interfaces/get-all
|
|
|
369
373
|
__exportStar(__webpack_require__(/*! ./base-repository */ "./src/interfaces/base-repository.ts"), exports);
|
|
370
374
|
__exportStar(__webpack_require__(/*! ./base-service */ "./src/interfaces/base-service.ts"), exports);
|
|
371
375
|
__exportStar(__webpack_require__(/*! ./dataloaders */ "./src/interfaces/dataloaders.ts"), exports);
|
|
376
|
+
__exportStar(__webpack_require__(/*! ./generated-models */ "./src/interfaces/generated-models.ts"), exports);
|
|
372
377
|
|
|
373
378
|
|
|
374
379
|
/***/ }),
|
|
@@ -385,6 +390,182 @@ __exportStar(__webpack_require__(/*! ./dataloaders */ "./src/interfaces/dataload
|
|
|
385
390
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
386
391
|
|
|
387
392
|
|
|
393
|
+
/***/ }),
|
|
394
|
+
|
|
395
|
+
/***/ "./src/mixins/base-service-mixin.ts":
|
|
396
|
+
/*!******************************************!*\
|
|
397
|
+
!*** ./src/mixins/base-service-mixin.ts ***!
|
|
398
|
+
\******************************************/
|
|
399
|
+
/*! no static exports found */
|
|
400
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
401
|
+
|
|
402
|
+
"use strict";
|
|
403
|
+
|
|
404
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
405
|
+
exports.BaseServiceMixin = void 0;
|
|
406
|
+
const interfaces_1 = __webpack_require__(/*! ../interfaces */ "./src/interfaces/index.ts");
|
|
407
|
+
const BaseServiceMixin = (service) => ({
|
|
408
|
+
name: 'BaseServiceMixin',
|
|
409
|
+
actions: {
|
|
410
|
+
[interfaces_1.IBaseServiceCommands.get]: {
|
|
411
|
+
params: {
|
|
412
|
+
id: 'string',
|
|
413
|
+
},
|
|
414
|
+
handler: async (ctx) => service.get(ctx.params.id),
|
|
415
|
+
},
|
|
416
|
+
[interfaces_1.IBaseServiceCommands.count]: {
|
|
417
|
+
params: {
|
|
418
|
+
criteria: { type: 'object', optional: true },
|
|
419
|
+
},
|
|
420
|
+
handler: async (ctx) => service.count(ctx.params.criteria),
|
|
421
|
+
},
|
|
422
|
+
[interfaces_1.IBaseServiceCommands.bulkCreate]: {
|
|
423
|
+
params: {
|
|
424
|
+
data: { type: 'array', items: 'object' },
|
|
425
|
+
},
|
|
426
|
+
handler: async (ctx) => service.bulkCreate(ctx.params.data),
|
|
427
|
+
},
|
|
428
|
+
[interfaces_1.IBaseServiceCommands.create]: {
|
|
429
|
+
params: {
|
|
430
|
+
data: 'object',
|
|
431
|
+
},
|
|
432
|
+
handler: async (ctx) => service.create(ctx.params.data),
|
|
433
|
+
},
|
|
434
|
+
[interfaces_1.IBaseServiceCommands.delete]: {
|
|
435
|
+
params: {
|
|
436
|
+
id: 'string',
|
|
437
|
+
},
|
|
438
|
+
handler: async (ctx) => service.delete(ctx.params.id),
|
|
439
|
+
},
|
|
440
|
+
[interfaces_1.IBaseServiceCommands.getAll]: {
|
|
441
|
+
params: {
|
|
442
|
+
criteria: 'object|optional',
|
|
443
|
+
sort: 'object|optional',
|
|
444
|
+
skip: 'number|optional',
|
|
445
|
+
limit: 'number|optional',
|
|
446
|
+
selectedFields: 'string|optional',
|
|
447
|
+
},
|
|
448
|
+
handler: async (ctx) => service.getAll(ctx.params),
|
|
449
|
+
},
|
|
450
|
+
[interfaces_1.IBaseServiceCommands.getAllWithCount]: {
|
|
451
|
+
params: {
|
|
452
|
+
criteria: 'object|optional',
|
|
453
|
+
sort: 'object|optional',
|
|
454
|
+
skip: 'number|optional',
|
|
455
|
+
limit: 'number|optional',
|
|
456
|
+
selectedFields: 'string|optional',
|
|
457
|
+
},
|
|
458
|
+
handler: async (ctx) => service.getAllWithCount(ctx.params),
|
|
459
|
+
},
|
|
460
|
+
[interfaces_1.IBaseServiceCommands.insert]: {
|
|
461
|
+
params: {
|
|
462
|
+
data: 'object',
|
|
463
|
+
overwrite: 'boolean|optional',
|
|
464
|
+
},
|
|
465
|
+
handler: async (ctx) => service.insert(ctx.params.data, ctx.params.overwrite),
|
|
466
|
+
},
|
|
467
|
+
[interfaces_1.IBaseServiceCommands.update]: {
|
|
468
|
+
params: {
|
|
469
|
+
id: 'string',
|
|
470
|
+
data: 'object',
|
|
471
|
+
overwrite: 'boolean|optional',
|
|
472
|
+
},
|
|
473
|
+
handler: async (ctx) => service.update(ctx.params.id, ctx.params.data, ctx.params.overwrite),
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
});
|
|
477
|
+
exports.BaseServiceMixin = BaseServiceMixin;
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
/***/ }),
|
|
481
|
+
|
|
482
|
+
/***/ "./src/mixins/index.ts":
|
|
483
|
+
/*!*****************************!*\
|
|
484
|
+
!*** ./src/mixins/index.ts ***!
|
|
485
|
+
\*****************************/
|
|
486
|
+
/*! no static exports found */
|
|
487
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
488
|
+
|
|
489
|
+
"use strict";
|
|
490
|
+
|
|
491
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
492
|
+
exports.BaseServiceMixin = void 0;
|
|
493
|
+
var base_service_mixin_1 = __webpack_require__(/*! ./base-service-mixin */ "./src/mixins/base-service-mixin.ts");
|
|
494
|
+
Object.defineProperty(exports, "BaseServiceMixin", { enumerable: true, get: function () { return base_service_mixin_1.BaseServiceMixin; } });
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
/***/ }),
|
|
498
|
+
|
|
499
|
+
/***/ "./src/services/base-proxy-service.ts":
|
|
500
|
+
/*!********************************************!*\
|
|
501
|
+
!*** ./src/services/base-proxy-service.ts ***!
|
|
502
|
+
\********************************************/
|
|
503
|
+
/*! no static exports found */
|
|
504
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
505
|
+
|
|
506
|
+
"use strict";
|
|
507
|
+
|
|
508
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
509
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
510
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
511
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
512
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
513
|
+
};
|
|
514
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
515
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
516
|
+
};
|
|
517
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
518
|
+
exports.BaseProxyService = void 0;
|
|
519
|
+
const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
|
|
520
|
+
const core_1 = __webpack_require__(/*! @common-stack/core */ "@common-stack/core");
|
|
521
|
+
const interfaces_1 = __webpack_require__(/*! ../interfaces */ "./src/interfaces/index.ts");
|
|
522
|
+
let BaseProxyService = class BaseProxyService {
|
|
523
|
+
constructor(broker, logger) {
|
|
524
|
+
this.broker = broker;
|
|
525
|
+
this.logger = logger.child({ className: 'BaseProxyService' });
|
|
526
|
+
}
|
|
527
|
+
bulkCreate(data) {
|
|
528
|
+
return this.callAction(interfaces_1.IBaseServiceCommands.bulkCreate, { data });
|
|
529
|
+
}
|
|
530
|
+
count(criteria) {
|
|
531
|
+
return this.callAction(interfaces_1.IBaseServiceCommands.count, { criteria });
|
|
532
|
+
}
|
|
533
|
+
create(data) {
|
|
534
|
+
return this.callAction(interfaces_1.IBaseServiceCommands.create, { data });
|
|
535
|
+
}
|
|
536
|
+
delete(id) {
|
|
537
|
+
return this.callAction(interfaces_1.IBaseServiceCommands.delete, { id });
|
|
538
|
+
}
|
|
539
|
+
get(id) {
|
|
540
|
+
return this.callAction(interfaces_1.IBaseServiceCommands.get, { id });
|
|
541
|
+
}
|
|
542
|
+
getAll(options) {
|
|
543
|
+
return this.callAction(interfaces_1.IBaseServiceCommands.getAll, options);
|
|
544
|
+
}
|
|
545
|
+
getByIds(ids) {
|
|
546
|
+
return this.callAction(interfaces_1.IBaseServiceCommands.getByIds, { ids });
|
|
547
|
+
}
|
|
548
|
+
getAllWithCount(options) {
|
|
549
|
+
return this.callAction(interfaces_1.IBaseServiceCommands.getAllWithCount, options);
|
|
550
|
+
}
|
|
551
|
+
insert(data, overwrite) {
|
|
552
|
+
return this.callAction(interfaces_1.IBaseServiceCommands.insert, { data, overwrite });
|
|
553
|
+
}
|
|
554
|
+
update(id, data, overwrite) {
|
|
555
|
+
return this.callAction(interfaces_1.IBaseServiceCommands.update, { id, data, overwrite });
|
|
556
|
+
}
|
|
557
|
+
async callAction(command, params) {
|
|
558
|
+
return this.broker.call(`${this.topic}.${command}`, params);
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
BaseProxyService = __decorate([
|
|
562
|
+
inversify_1.injectable(),
|
|
563
|
+
__param(0, inversify_1.inject(core_1.CommonType.MOLECULER_BROKER)),
|
|
564
|
+
__param(1, inversify_1.inject('Logger'))
|
|
565
|
+
], BaseProxyService);
|
|
566
|
+
exports.BaseProxyService = BaseProxyService;
|
|
567
|
+
|
|
568
|
+
|
|
388
569
|
/***/ }),
|
|
389
570
|
|
|
390
571
|
/***/ "./src/services/base-service.ts":
|
|
@@ -502,6 +683,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
502
683
|
};
|
|
503
684
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
504
685
|
__exportStar(__webpack_require__(/*! ./base-service */ "./src/services/base-service.ts"), exports);
|
|
686
|
+
__exportStar(__webpack_require__(/*! ./base-proxy-service */ "./src/services/base-proxy-service.ts"), exports);
|
|
505
687
|
|
|
506
688
|
|
|
507
689
|
/***/ }),
|
|
@@ -627,8 +809,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
627
809
|
exports.BaseRepository = void 0;
|
|
628
810
|
const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
|
|
629
811
|
const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
|
|
630
|
-
const
|
|
631
|
-
const DEFAULT_PAGINATION_LIMIT = 10;
|
|
812
|
+
const interfaces_1 = __webpack_require__(/*! ../../interfaces */ "./src/interfaces/index.ts");
|
|
632
813
|
let BaseRepository = BaseRepository_1 = class BaseRepository {
|
|
633
814
|
constructor(modelFunc, db, logger, options) {
|
|
634
815
|
this.modelFunc = modelFunc;
|
|
@@ -641,11 +822,12 @@ let BaseRepository = BaseRepository_1 = class BaseRepository {
|
|
|
641
822
|
const { criteria, selectedFields, sort, limit, skip } = options;
|
|
642
823
|
// map id to mongoose _id
|
|
643
824
|
const _a = criteria || { id: undefined }, { id } = _a, rest = __rest(_a, ["id"]);
|
|
825
|
+
const sortBy = lodash_1.isObject(sort) ? { [sort === null || sort === void 0 ? void 0 : sort.key]: sort.value } : interfaces_1.DEFAULT_SORTING;
|
|
644
826
|
const response = await this.model
|
|
645
827
|
.find(Object.assign(Object.assign({}, rest), (id ? { _id: id } : {})), selectedFields)
|
|
646
|
-
.limit(limit ||
|
|
647
|
-
.skip(skip ||
|
|
648
|
-
.sort(
|
|
828
|
+
.limit(limit || interfaces_1.PAGINATION_OPTIONS.limit)
|
|
829
|
+
.skip(skip || interfaces_1.PAGINATION_OPTIONS.skip)
|
|
830
|
+
.sort(sortBy)
|
|
649
831
|
.exec();
|
|
650
832
|
return response.map((i) => i === null || i === void 0 ? void 0 : i.toObject());
|
|
651
833
|
}
|
|
@@ -773,13 +955,13 @@ let BaseRepository = BaseRepository_1 = class BaseRepository {
|
|
|
773
955
|
throw e;
|
|
774
956
|
}
|
|
775
957
|
}
|
|
776
|
-
async bulkDelete(
|
|
958
|
+
async bulkDelete(criteria) {
|
|
777
959
|
try {
|
|
778
|
-
const deleted = await this.model.deleteMany(
|
|
960
|
+
const deleted = await this.model.deleteMany(this.mapConditions(criteria));
|
|
779
961
|
return (deleted === null || deleted === void 0 ? void 0 : deleted.deletedCount) || 0;
|
|
780
962
|
}
|
|
781
963
|
catch (e) {
|
|
782
|
-
this.logger.error(`Unable to delete the model with criteria`,
|
|
964
|
+
this.logger.error(`Unable to delete the model with criteria`, criteria);
|
|
783
965
|
throw e;
|
|
784
966
|
}
|
|
785
967
|
}
|
|
@@ -819,6 +1001,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
819
1001
|
__exportStar(__webpack_require__(/*! ./base-repository */ "./src/store/repositories/base-repository.ts"), exports);
|
|
820
1002
|
|
|
821
1003
|
|
|
1004
|
+
/***/ }),
|
|
1005
|
+
|
|
1006
|
+
/***/ "@common-stack/core":
|
|
1007
|
+
/*!*************************************!*\
|
|
1008
|
+
!*** external "@common-stack/core" ***!
|
|
1009
|
+
\*************************************/
|
|
1010
|
+
/*! no static exports found */
|
|
1011
|
+
/***/ (function(module, exports) {
|
|
1012
|
+
|
|
1013
|
+
module.exports = require("@common-stack/core");
|
|
1014
|
+
|
|
822
1015
|
/***/ }),
|
|
823
1016
|
|
|
824
1017
|
/***/ "dataloader":
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/constants/default-options.ts","webpack:///./src/constants/index.ts","webpack:///./src/dataloaders/bulk-dataloader.ts","webpack:///./src/dataloaders/index.ts","webpack:///./src/helpers/index.ts","webpack:///./src/helpers/mongoose-connection.ts","webpack:///./src/index.ts","webpack:///./src/interfaces/get-all-args.ts","webpack:///./src/interfaces/index.ts","webpack:///./src/services/base-service.ts","webpack:///./src/services/index.ts","webpack:///./src/store/index.ts","webpack:///./src/store/models/common-options.ts","webpack:///./src/store/models/index.ts","webpack:///./src/store/repositories/base-repository.ts","webpack:///./src/store/repositories/index.ts","webpack:///external \"dataloader\"","webpack:///external \"inversify\"","webpack:///external \"lodash\"","webpack:///external \"mongoose\""],"names":[],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AAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,EAAE,UAAU,CAAC,CAAC;YAC1E,MAAM,CAAC,CAAC;SACX;IACL,CAAC;CACJ;AAlMY,cAAc;IAD1B,sBAAU,EAAE;IASJ,gCAAS,EAAE;IAEX,gCAAS,EAAE;IAEX,gCAAS,EAAE;IAEX,gCAAS,EAAE;GAdP,cAAc,CAkM1B;AAlMY,wCAAc;;;;;;;;;;;;;;;;;;;;;;;;;ACT3B,mHAAkC;;;;;;;;;;;;ACAlC,uC;;;;;;;;;;;ACAA,sC;;;;;;;;;;;ACAA,mC;;;;;;;;;;;ACAA,qC","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n","export const DEFAULT_SORTING = {\n id: 'asc',\n};\n","export * from './default-options';\n","import * as DataLoader from 'dataloader';\nimport { injectable, unmanaged } from 'inversify';\nimport { IBaseService } from '../interfaces';\n\n@injectable()\nexport class BulkDataLoader<T extends { id: string }> extends DataLoader<string, T> {\n constructor(\n @unmanaged()\n service: IBaseService<T>,\n ) {\n super(async (ids: string[]) => {\n const data = await service.getByIds(ids);\n return ids.map((id) => data.find((record) => record.id === id));\n });\n }\n}\n","export * from './bulk-dataloader';\n","export * from './mongoose-connection';\n","import * as mongoose from 'mongoose';\n\nlet connectionOptions: mongoose.ConnectionOptions | undefined;\n// (mongoose as any).Promise = global.Promise;\n\nconst generateMongo: (monoUrl) => mongoose.Connection = (mongoUrl) => {\n\n // creates default connection\n mongoose.connect(mongoUrl, {\n }).then(() => {\n console.info('mogoose connect - success');\n // console.info(`uri - ${uri}`);\n // console.info(`connectionOptions - ${connectionOptions}`);\n }).catch((err: mongoose.Error) => {\n console.error('mogoose connect - error - ', err);\n // throw err;\n process.kill(process.pid);\n });\n // to access default connection\n const mongooseConnection: mongoose.Connection = mongoose.connection;\n\n return mongooseConnection;\n};\n\n\n\nexport { generateMongo };\n","export * from './interfaces';\nexport * from './helpers';\nexport * from './services';\nexport * from './store';\nexport * from './dataloaders';\n","import { FilterQuery } from 'mongoose';\n\nexport type ISort = {\n key: string;\n value: ISortEnum;\n};\n\nexport enum ISortEnum {\n ASC = 'ASC',\n DESC = 'DESC'\n}\n\nexport interface GetAllArgs<T> {\n criteria?: FilterQuery<T>;\n sort?: ISort;\n skip?: number;\n limit?: number;\n selectedFields?: string;\n}\n","export * from './mongoose-settings';\nexport * from './get-all-args';\nexport * from './base-repository';\nexport * from './base-service';\nexport * from './dataloaders';\n","import { Document, FilterQuery } from 'mongoose';\nimport { injectable } from 'inversify';\nimport { GetAllArgs, IBaseRepository, IBaseService } from '../interfaces';\n\n@injectable()\nexport class BaseService<T, C = Omit<T, 'id'>, U = C> implements IBaseService<T, C, U> {\n constructor(protected repository: IBaseRepository<T>) {\n this.repository = repository;\n }\n\n async getAllWithCount(options: GetAllArgs<Document<T>>): Promise<{ data: T[]; totalCount: number }> {\n const totalCount = await this.count(options.criteria);\n const data = await this.getAll(options);\n return {\n totalCount,\n data,\n };\n }\n\n count(conditions?: FilterQuery<Document<T>>): Promise<number> {\n return this.repository.count(conditions);\n }\n\n get(conditions: string | FilterQuery<Document<T>>): Promise<T> {\n if (typeof conditions === 'string') {\n return this.repository.get({ id: conditions });\n }\n return this.repository.get(conditions);\n }\n\n getName(name: string): Promise<T> {\n return this.repository.get({ name });\n }\n\n getAll(options: GetAllArgs<Document<T>>): Promise<T[]> {\n return this.repository.getAll(options);\n }\n\n getByIds(ids: string[]): Promise<T[]> {\n return this.repository.bulkGet(ids);\n }\n\n create(data: C): Promise<T> {\n return this.repository.create<C>(data);\n }\n\n bulkCreate(data: C[]): Promise<T[]> {\n return this.repository.bulkCreate<C>(data);\n }\n\n async update(id: string, data: Partial<U>, overwrite = false): Promise<T> {\n return this.repository.update<U>({ id }, data, { overwrite });\n }\n\n insert(data: (C | U) & { id?: string }, overwrite = true): Promise<T> {\n const { id, ...rest } = data;\n if (id) {\n const existing = this.repository.get({ id });\n if (existing) {\n return this.update(id, rest as U, overwrite);\n }\n }\n return this.create(rest as C);\n }\n\n delete(id: string | FilterQuery<Document<T>>): Promise<boolean> {\n if (typeof id === 'string') {\n return this.repository.delete({ id });\n }\n return this.repository.delete(id);\n }\n}\n","export * from './base-service';\n","export * from './models';\nexport * from './repositories';\n","import { Schema } from 'mongoose';\n\nexport const commonModeSchemaOptions = {\n timestamps: true,\n toJSON: {\n virtuals: true,\n },\n toObject: {\n virtuals: true,\n getters: true,\n transform(doc, ret) {\n delete ret.__v;\n delete ret._id;\n },\n },\n};\n\nexport const addIdVirtualFields = (schema: Schema) => {\n schema.set('toJSON', {\n virtuals: true,\n });\n return schema;\n};\n","export * from './common-options';\n","import { isObject } from 'lodash';\nimport { logger as Logger } from '@cdm-logger/server';\nimport { Connection, Document, FilterQuery, Model, UpdateQuery } from 'mongoose';\nimport { injectable, unmanaged } from 'inversify';\nimport { GetAllArgs, IBaseRepository, IMongoOptions } from '../../interfaces';\nimport { DEFAULT_SORTING } from '../../constants';\n\nconst DEFAULT_PAGINATION_LIMIT = 10;\n@injectable()\nexport class BaseRepository<T, D = Document<T>> implements IBaseRepository<T, D> {\n private options: IMongoOptions;\n\n protected logger: typeof Logger;\n\n model: Model<D>;\n\n constructor(\n @unmanaged()\n private modelFunc: (db: Connection) => Model<D>,\n @unmanaged()\n db: Connection,\n @unmanaged()\n logger: typeof Logger,\n @unmanaged()\n options?: IMongoOptions,\n ) {\n this.model = modelFunc(db);\n this.options = options;\n this.logger = logger.child({ className: BaseRepository.name });\n }\n\n public async getAll(options: GetAllArgs<D>): Promise<T[]> {\n try {\n const { criteria, selectedFields, sort, limit, skip } = options;\n // map id to mongoose _id\n const { id, ...rest } = criteria || { id: undefined };\n const response = await this.model\n .find({ ...rest, ...(id ? { _id: id } : {}) }, selectedFields)\n .limit(limit || DEFAULT_PAGINATION_LIMIT)\n .skip(skip || 0)\n .sort(isObject(sort) ? { [sort?.key]: sort.value } : DEFAULT_SORTING)\n .exec();\n return response.map((i) => i?.toObject()) as T[];\n } catch (e) {\n this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(options)}`);\n throw e;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n private mapConditions(conditions: FilterQuery<D>): FilterQuery<D> {\n const { id: _id, ...remaining } = conditions;\n return {\n ...(_id ? { _id } : {}),\n ...remaining,\n };\n }\n\n public async count(conditions?: FilterQuery<D>): Promise<number> {\n return this.model.count(conditions).exec();\n }\n\n public async get(conditions?: FilterQuery<D>, selectedFields?: string): Promise<T> {\n try {\n const response = await this.model.findOne(this.mapConditions(conditions), selectedFields).exec();\n return response?.toObject() as T;\n } catch (e) {\n this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(conditions)}`);\n throw e;\n }\n }\n\n public async bulkGet(ids: string[]): Promise<T[]> {\n try {\n const results = await this.model.find().setOptions({ batchSize: 100 }).where('_id').in(ids).exec();\n return results.map((i) => i.toObject()) as T[];\n } catch (e) {\n this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(ids)}`);\n throw e;\n }\n }\n\n public async find(conditions: Partial<FilterQuery<D>>, selectedFields?: string): Promise<T> {\n try {\n const response = await this.model.findOne(conditions, selectedFields).exec();\n return response?.toObject() as T;\n } catch (e) {\n this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(conditions)}`);\n throw e;\n }\n }\n\n public async create<I>(data: I): Promise<T> {\n try {\n const response = await this.model.create(data);\n return response.toObject() as T;\n } catch (e) {\n this.logger.error(`Unable to create Model with data ${JSON.stringify(data)} due to ${e?.message}`);\n throw e;\n }\n }\n\n public async bulkCreate<I>(data: I[]): Promise<T[]> {\n try {\n const response = await this.model.insertMany(data, {\n lean: true,\n ordered: true,\n });\n return response as unknown as T[];\n } catch (e) {\n this.logger.error(`Unable to bulk create due to error`, e.message);\n }\n }\n\n public async upsert<I>(conditions: FilterQuery<D>, update: I, options?: Record<string, unknown>): Promise<T> {\n return this.update<I>(conditions, update, {\n upsert: true,\n ...options,\n });\n }\n\n public async bulkUpdate<I>(\n criteria: FilterQuery<D>,\n update: UpdateQuery<D>,\n options: Record<string, unknown>,\n ): Promise<T[]> {\n try {\n const { id, ...rest } = criteria;\n const processedCriteria = id ? { _id: id, ...rest } : criteria;\n const res = await this.model.updateMany(processedCriteria, update);\n if (res) {\n const response = await this.model\n .find(processedCriteria)\n .exec();\n return response.map((i) => i?.toObject()) as T[];\n } else {\n this.logger.error(\n `Unable to Bulk Update with criteria ${JSON.stringify(criteria)} and data ${JSON.stringify(update)}`,\n );\n throw new Error('Unable to do bulk update');\n }\n\n } catch (e) {\n this.logger.error(\n `Unable to Bulk Update with criteria ${JSON.stringify(criteria)} and data ${JSON.stringify(update)}`,\n );\n throw e;\n }\n }\n\n public async update<I>(\n criteria: FilterQuery<D>,\n update: UpdateQuery<D>,\n options: Record<string, unknown>,\n ): Promise<T> {\n try {\n const { id, ...rest } = criteria;\n const processedCriteria = id ? { _id: id, ...rest } : criteria;\n const mergedOptions = {\n new: true,\n useFindAndModify: false,\n ...options,\n };\n if (id) {\n return (await this.model\n .findByIdAndUpdate(id, update as unknown as never, mergedOptions)\n .exec()) as unknown as Promise<T>;\n }\n return (await this.model\n .findOneAndUpdate(processedCriteria, update as unknown as never, mergedOptions)\n .exec()) as unknown as Promise<T>;\n } catch (e) {\n this.logger.error(\n `Unable to Update with criteria ${JSON.stringify(criteria)} and data ${JSON.stringify(update)}`,\n );\n throw e;\n }\n }\n\n public async delete(criteria: FilterQuery<D>): Promise<boolean> {\n try {\n let deleted;\n if (criteria?.id) {\n deleted = await this.model.findByIdAndDelete(criteria.id);\n } else {\n deleted = await this.model.findOneAndDelete(this.mapConditions(criteria));\n }\n return !!deleted;\n } catch (e) {\n this.logger.error(`Unable to delete the model with criteria`, criteria);\n throw e;\n }\n }\n\n public async bulkDelete(conditions: FilterQuery<D>): Promise<number> {\n try {\n const deleted = await this.model.deleteMany(conditions);\n return deleted?.deletedCount || 0;\n } catch (e) {\n this.logger.error(`Unable to delete the model with criteria`, conditions);\n throw e;\n }\n }\n}\n","export * from './base-repository';\n","module.exports = require(\"dataloader\");","module.exports = require(\"inversify\");","module.exports = require(\"lodash\");","module.exports = require(\"mongoose\");"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/dataloaders/bulk-dataloader.ts","webpack:///./src/dataloaders/index.ts","webpack:///./src/helpers/index.ts","webpack:///./src/helpers/mongoose-connection.ts","webpack:///./src/index.ts","webpack:///./src/interfaces/base-repository.ts","webpack:///./src/interfaces/generated-models.ts","webpack:///./src/interfaces/index.ts","webpack:///./src/mixins/base-service-mixin.ts","webpack:///./src/mixins/index.ts","webpack:///./src/services/base-proxy-service.ts","webpack:///./src/services/base-service.ts","webpack:///./src/services/index.ts","webpack:///./src/store/index.ts","webpack:///./src/store/models/common-options.ts","webpack:///./src/store/models/index.ts","webpack:///./src/store/repositories/base-repository.ts","webpack:///./src/store/repositories/index.ts","webpack:///external \"@common-stack/core\"","webpack:///external \"dataloader\"","webpack:///external \"inversify\"","webpack:///external \"lodash\"","webpack:///external \"mongoose\""],"names":[],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E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,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC1E,OAAO,QAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,KAAI,CAAC,CAAC;SACrC;QAAC,OAAO,CAAC,EAAE;YACR,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,EAAE,QAAQ,CAAC,CAAC;YACxE,MAAM,CAAC,CAAC;SACX;IACL,CAAC;CAEJ;AApMY,cAAc;IAD1B,sBAAU,EAAE;IASJ,gCAAS,EAAE;IAEX,gCAAS,EAAE;IAEX,gCAAS,EAAE;IAEX,gCAAS,EAAE;GAdP,cAAc,CAoM1B;AApMY,wCAAc;;;;;;;;;;;;;;;;;;;;;;;;;ACP3B,mHAAkC;;;;;;;;;;;;ACAlC,+C;;;;;;;;;;;ACAA,uC;;;;;;;;;;;ACAA,sC;;;;;;;;;;;ACAA,mC;;;;;;;;;;;ACAA,qC","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n","import * as DataLoader from 'dataloader';\nimport { injectable, unmanaged } from 'inversify';\nimport { IBaseService } from '../interfaces';\n\n@injectable()\nexport class BulkDataLoader<T extends { id: string }> extends DataLoader<string, T> {\n constructor(\n @unmanaged()\n service: IBaseService<T>,\n ) {\n super(async (ids: string[]) => {\n const data = await service.getByIds(ids);\n return ids.map((id) => data.find((record) => record.id === id));\n });\n }\n}\n","export * from './bulk-dataloader';\n","export * from './mongoose-connection';\n","import * as mongoose from 'mongoose';\n\nlet connectionOptions: mongoose.ConnectionOptions | undefined;\n// (mongoose as any).Promise = global.Promise;\n\nconst generateMongo: (monoUrl) => mongoose.Connection = (mongoUrl) => {\n\n // creates default connection\n mongoose.connect(mongoUrl, {\n }).then(() => {\n console.info('mogoose connect - success');\n // console.info(`uri - ${uri}`);\n // console.info(`connectionOptions - ${connectionOptions}`);\n }).catch((err: mongoose.Error) => {\n console.error('mogoose connect - error - ', err);\n // throw err;\n process.kill(process.pid);\n });\n // to access default connection\n const mongooseConnection: mongoose.Connection = mongoose.connection;\n\n return mongooseConnection;\n};\n\n\n\nexport { generateMongo };\n","export * from './interfaces';\nexport * from './helpers';\nexport * from './services';\nexport * from './store';\nexport * from './dataloaders';\nexport * from './mixins';\n","import { FilterQuery, Document, Model, UpdateQuery } from 'mongoose';\nimport { GetAllArgs } from './get-all-args';\n\nexport enum PAGINATION_OPTIONS {\n limit = 10,\n skip = 0,\n}\n\nexport const DEFAULT_SORTING = {\n id: 'asc',\n};\n\nexport interface IBaseRepository<T, D = Document<T>> {\n model: Model<D>;\n count(conditions?: FilterQuery<D>): Promise<number>;\n getAll(options: GetAllArgs<D>): Promise<T[]>;\n get(conditions?: FilterQuery<D>, selectedFields?: string): Promise<T>;\n create<I>(data: I): Promise<T>;\n upsert<I>(conditions: FilterQuery<D>, update: I, options): Promise<T>;\n update<I>(criteria: FilterQuery<D>, update: UpdateQuery<D>, options?): Promise<T>;\n bulkUpdate<I>(criteria: FilterQuery<D>, update: UpdateQuery<D>, options?): Promise<T[]>;\n delete(criteria: FilterQuery<D>): Promise<boolean>;\n bulkGet(ids: string[], selectedFields?: string): Promise<T[]>;\n bulkCreate<I>(data: I[]): Promise<T[]>;\n bulkDelete(criteria: FilterQuery<D>): Promise<number>;\n}\n","/* tslint:disable */\nexport type Maybe<T> = T | null;\nexport type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };\nexport type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };\nexport type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };\n/** All built-in and custom scalars, mapped to their actual values */\nexport type Scalars = {\n ID: string;\n String: string;\n Boolean: boolean;\n Int: number;\n Float: number;\n AnyObject: any;\n Date: any;\n DateTime: any;\n JSON: any;\n JSONObject: any;\n Observable: any;\n Time: any;\n URI: any;\n URIInput: any;\n};\n\n\nexport type IAdminIdeSettings = {\n __typename?: 'AdminIdeSettings';\n dummy?: Maybe<Scalars['Int']>;\n};\n\n\nexport enum IBaseServiceCommands {\n count = 'count',\n get = 'get',\n getAll = 'getAll',\n getByIds = 'getByIds',\n create = 'create',\n insert = 'insert',\n bulkCreate = 'bulkCreate',\n update = 'update',\n delete = 'delete',\n getAllWithCount = 'getAllWithCount'\n}\n\nexport enum ICacheControlScope {\n PUBLIC = 'PUBLIC',\n PRIVATE = 'PRIVATE'\n}\n\n\n\n/** Represents a null return value. */\nexport type IEmptyResponse = {\n __typename?: 'EmptyResponse';\n alwaysNil?: Maybe<Scalars['String']>;\n};\n\nexport type IFieldError = {\n __typename?: 'FieldError';\n field: Scalars['String'];\n message: Scalars['String'];\n};\n\n\n\n/** All Moleculer Topic names are extended from this. */\nexport enum IMoleculerServiceName {\n dummy = 'dummy'\n}\n\nexport type IMutation = {\n __typename?: 'Mutation';\n dummy?: Maybe<Scalars['Int']>;\n};\n\n/** An object with an ID. */\nexport type INode = {\n /** The ID of the node. */\n id: Scalars['ID'];\n};\n\n\nexport type IPageInfo = {\n __typename?: 'PageInfo';\n hasNextPage: Scalars['Boolean'];\n};\n\nexport type IQuery = {\n __typename?: 'Query';\n /** Looks up a node by ID. */\n node?: Maybe<INode>;\n};\n\n\nexport type IQuerynodeArgs = {\n id: Scalars['ID'];\n};\n\nexport type ISort = {\n key: Scalars['String'];\n value: ISortEnum;\n};\n\nexport enum ISortEnum {\n ASC = 'ASC',\n DESC = 'DESC'\n}\n\nexport type ISubscription = {\n __typename?: 'Subscription';\n dummy?: Maybe<Scalars['Int']>;\n};\n\n\n\n","export * from './mongoose-settings';\nexport * from './get-all-args';\nexport * from './base-repository';\nexport * from './base-service';\nexport * from './dataloaders';\nexport * from './generated-models';\n","import { Context, ServiceSchema } from 'moleculer';\nimport { Document, FilterQuery } from 'mongoose';\nimport { IBaseServiceCommands, GetAllArgs, IBaseService } from '../interfaces';\n\nexport const BaseServiceMixin = <T, C, U>(service: IBaseService<T, C, U>): Partial<ServiceSchema> => ({\n name: 'BaseServiceMixin',\n actions: {\n [IBaseServiceCommands.get]: {\n params: {\n id: 'string',\n },\n handler: async (ctx: Context<{ id: string }>) => service.get(ctx.params.id),\n },\n [IBaseServiceCommands.count]: {\n params: {\n criteria: { type: 'object', optional: true },\n },\n handler: async (ctx: Context<{ criteria?: FilterQuery<Document<T>> }>) =>\n service.count(ctx.params.criteria),\n },\n [IBaseServiceCommands.bulkCreate]: {\n params: {\n data: { type: 'array', items: 'object' },\n },\n handler: async (ctx: Context<{ data: never[] }>) => service.bulkCreate(ctx.params.data),\n },\n [IBaseServiceCommands.create]: {\n params: {\n data: 'object',\n },\n handler: async (ctx: Context<{ data: never }>) => service.create(ctx.params.data),\n },\n [IBaseServiceCommands.delete]: {\n params: {\n id: 'string',\n },\n handler: async (ctx: Context<{ id: string | FilterQuery<Document<T>> }>) =>\n service.delete(ctx.params.id as never),\n },\n [IBaseServiceCommands.getAll]: {\n params: {\n criteria: 'object|optional',\n sort: 'object|optional',\n skip: 'number|optional',\n limit: 'number|optional',\n selectedFields: 'string|optional',\n },\n handler: async (ctx: Context<GetAllArgs<Document<T>>>) => service.getAll(ctx.params),\n },\n [IBaseServiceCommands.getAllWithCount]: {\n params: {\n criteria: 'object|optional',\n sort: 'object|optional',\n skip: 'number|optional',\n limit: 'number|optional',\n selectedFields: 'string|optional',\n },\n handler: async (ctx: Context<GetAllArgs<Document<T>>>) => service.getAllWithCount(ctx.params),\n },\n [IBaseServiceCommands.insert]: {\n params: {\n data: 'object',\n overwrite: 'boolean|optional',\n },\n handler: async (ctx: Context<{ data: never & { id?: string }; overwrite: boolean }>) =>\n service.insert(ctx.params.data, ctx.params.overwrite),\n },\n [IBaseServiceCommands.update]: {\n params: {\n id: 'string',\n data: 'object',\n overwrite: 'boolean|optional',\n },\n handler: async (ctx: Context<{ id: string; data: never; overwrite: boolean }>) =>\n service.update(ctx.params.id, ctx.params.data, ctx.params.overwrite),\n },\n },\n});\n","export { BaseServiceMixin } from './base-service-mixin';\n","import { inject, injectable } from 'inversify';\nimport { ServiceBroker } from 'moleculer';\nimport { FilterQuery } from 'mongoose';\nimport * as Logger from 'bunyan';\nimport { CommonType } from '@common-stack/core';\nimport { IBaseServiceCommands, GetAllArgs, IBaseService } from '../interfaces';\n\ntype MethodsNames<T, C, U> = keyof IBaseService<T, C, U>;\ntype MethodResponse<T, C, U, M extends MethodsNames<T, C, U>> = ReturnType<IBaseService<T, C, U>[M]>;\n\n@injectable()\nexport abstract class BaseProxyService<T, C = T, U = T> implements IBaseService<T, C, U> {\n protected logger: Logger;\n\n protected abstract topic;\n\n constructor(\n @inject(CommonType.MOLECULER_BROKER)\n private readonly broker: ServiceBroker,\n @inject('Logger')\n logger: Logger,\n ) {\n this.logger = logger.child({ className: 'BaseProxyService' });\n }\n\n bulkCreate(data: C[]): MethodResponse<T, C, U, 'bulkCreate'> {\n return this.callAction<T[], { data: C[] }>(IBaseServiceCommands.bulkCreate, { data });\n }\n\n count(criteria?: FilterQuery<Document>): MethodResponse<T, C, U, 'count'> {\n return this.callAction(IBaseServiceCommands.count, { criteria });\n }\n\n create(data: C): MethodResponse<T, C, U, 'create'> {\n return this.callAction(IBaseServiceCommands.create, { data });\n }\n\n delete(id: string | FilterQuery<Document>): MethodResponse<T, C, U, 'delete'> {\n return this.callAction(IBaseServiceCommands.delete, { id });\n }\n\n get(id?: string | FilterQuery<Document>): MethodResponse<T, C, U, 'get'> {\n return this.callAction(IBaseServiceCommands.get, { id });\n }\n\n getAll(options?: GetAllArgs<Document>): MethodResponse<T, C, U, 'getAll'> {\n return this.callAction(IBaseServiceCommands.getAll, options);\n }\n\n getByIds(ids: string[]): Promise<T[]> {\n return this.callAction(IBaseServiceCommands.getByIds, { ids });\n }\n\n getAllWithCount(options: GetAllArgs<Document>): MethodResponse<T, C, U, 'getAllWithCount'> {\n return this.callAction(IBaseServiceCommands.getAllWithCount, options);\n }\n\n insert(data: C | U, overwrite?: boolean): MethodResponse<T, C, U, 'insert'> {\n return this.callAction(IBaseServiceCommands.insert, { data, overwrite });\n }\n\n update(id: string, data: U, overwrite?: boolean): MethodResponse<T, C, U, 'update'> {\n return this.callAction<T>(IBaseServiceCommands.update, { id, data, overwrite });\n }\n\n protected async callAction<T, P = unknown>(command: string, params?: P): Promise<T> {\n return this.broker.call<T, P>(`${this.topic}.${command}`, params);\n }\n}\n","import { Document, FilterQuery } from 'mongoose';\nimport { injectable } from 'inversify';\nimport { GetAllArgs, IBaseRepository, IBaseService } from '../interfaces';\n\n@injectable()\nexport class BaseService<T, C = Omit<T, 'id'>, U = C> implements IBaseService<T, C, U> {\n constructor(protected repository: IBaseRepository<T>) {\n this.repository = repository;\n }\n\n async getAllWithCount(options: GetAllArgs<Document<T>>): Promise<{ data: T[]; totalCount: number }> {\n const totalCount = await this.count(options.criteria);\n const data = await this.getAll(options);\n return {\n totalCount,\n data,\n };\n }\n\n count(conditions?: FilterQuery<Document<T>>): Promise<number> {\n return this.repository.count(conditions);\n }\n\n get(conditions: string | FilterQuery<Document<T>>): Promise<T> {\n if (typeof conditions === 'string') {\n return this.repository.get({ id: conditions });\n }\n return this.repository.get(conditions);\n }\n\n getName(name: string): Promise<T> {\n return this.repository.get({ name });\n }\n\n getAll(options: GetAllArgs<Document<T>>): Promise<T[]> {\n return this.repository.getAll(options);\n }\n\n getByIds(ids: string[]): Promise<T[]> {\n return this.repository.bulkGet(ids);\n }\n\n create(data: C): Promise<T> {\n return this.repository.create<C>(data);\n }\n\n bulkCreate(data: C[]): Promise<T[]> {\n return this.repository.bulkCreate<C>(data);\n }\n\n async update(id: string, data: Partial<U>, overwrite = false): Promise<T> {\n return this.repository.update<U>({ id }, data, { overwrite });\n }\n\n insert(data: (C | U) & { id?: string }, overwrite = true): Promise<T> {\n const { id, ...rest } = data;\n if (id) {\n const existing = this.repository.get({ id });\n if (existing) {\n return this.update(id, rest as U, overwrite);\n }\n }\n return this.create(rest as C);\n }\n\n delete(id: string | FilterQuery<Document<T>>): Promise<boolean> {\n if (typeof id === 'string') {\n return this.repository.delete({ id });\n }\n return this.repository.delete(id);\n }\n}\n","export * from './base-service';\nexport * from './base-proxy-service';\n","export * from './models';\nexport * from './repositories';\n","import { Schema } from 'mongoose';\n\nexport const commonModeSchemaOptions = {\n timestamps: true,\n toJSON: {\n virtuals: true,\n },\n toObject: {\n virtuals: true,\n getters: true,\n transform(doc, ret) {\n delete ret.__v;\n delete ret._id;\n },\n },\n};\n\nexport const addIdVirtualFields = (schema: Schema) => {\n schema.set('toJSON', {\n virtuals: true,\n });\n return schema;\n};\n","export * from './common-options';\n","import { isObject } from 'lodash';\nimport { logger as Logger } from '@cdm-logger/server';\nimport { Connection, Document, FilterQuery, Model, UpdateQuery } from 'mongoose';\nimport { injectable, unmanaged } from 'inversify';\nimport { GetAllArgs, IBaseRepository, IMongoOptions, DEFAULT_SORTING, PAGINATION_OPTIONS, } from '../../interfaces';\n\n@injectable()\nexport class BaseRepository<T, D = Document<T>> implements IBaseRepository<T, D> {\n private options: IMongoOptions;\n\n protected logger: typeof Logger;\n\n model: Model<D>;\n\n constructor(\n @unmanaged()\n private modelFunc: (db: Connection) => Model<D>,\n @unmanaged()\n db: Connection,\n @unmanaged()\n logger: typeof Logger,\n @unmanaged()\n options?: IMongoOptions,\n ) {\n this.model = modelFunc(db);\n this.options = options;\n this.logger = logger.child({ className: BaseRepository.name });\n }\n\n public async getAll(options: GetAllArgs<D>): Promise<T[]> {\n try {\n const { criteria, selectedFields, sort, limit, skip } = options;\n // map id to mongoose _id\n const { id, ...rest } = criteria || { id: undefined };\n const sortBy = isObject(sort) ? { [sort?.key]: sort.value } : DEFAULT_SORTING;\n const response = await this.model\n .find({ ...rest, ...(id ? { _id: id } : {}) }, selectedFields)\n .limit(limit || PAGINATION_OPTIONS.limit)\n .skip(skip || PAGINATION_OPTIONS.skip)\n .sort(sortBy as never)\n .exec();\n return response.map((i) => i?.toObject()) as T[];\n } catch (e) {\n this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(options)}`);\n throw e;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n private mapConditions(conditions: FilterQuery<D>): FilterQuery<D> {\n const { id: _id, ...remaining } = conditions;\n return {\n ...(_id ? { _id } : {}),\n ...remaining,\n };\n }\n\n public async count(conditions?: FilterQuery<D>): Promise<number> {\n return this.model.count(conditions).exec();\n }\n\n public async get(conditions?: FilterQuery<D>, selectedFields?: string): Promise<T> {\n try {\n const response = await this.model.findOne(this.mapConditions(conditions), selectedFields).exec();\n return response?.toObject() as T;\n } catch (e) {\n this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(conditions)}`);\n throw e;\n }\n }\n\n public async bulkGet(ids: string[]): Promise<T[]> {\n try {\n const results = await this.model.find().setOptions({ batchSize: 100 }).where('_id').in(ids).exec();\n return results.map((i) => i.toObject()) as T[];\n } catch (e) {\n this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(ids)}`);\n throw e;\n }\n }\n\n public async find(conditions: Partial<FilterQuery<D>>, selectedFields?: string): Promise<T> {\n try {\n const response = await this.model.findOne(conditions, selectedFields).exec();\n return response?.toObject() as T;\n } catch (e) {\n this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(conditions)}`);\n throw e;\n }\n }\n\n public async create<I>(data: I): Promise<T> {\n try {\n const response = await this.model.create(data);\n return response.toObject() as T;\n } catch (e) {\n this.logger.error(`Unable to create Model with data ${JSON.stringify(data)} due to ${e?.message}`);\n throw e;\n }\n }\n\n public async bulkCreate<I>(data: I[]): Promise<T[]> {\n try {\n const response = await this.model.insertMany(data, {\n lean: true,\n ordered: true,\n });\n return response as unknown as T[];\n } catch (e) {\n this.logger.error(`Unable to bulk create due to error`, e.message);\n }\n }\n\n public async upsert<I>(conditions: FilterQuery<D>, update: I, options?: Record<string, unknown>): Promise<T> {\n return this.update<I>(conditions, update, {\n upsert: true,\n ...options,\n });\n }\n\n public async bulkUpdate<I>(\n criteria: FilterQuery<D>,\n update: UpdateQuery<D>,\n options: Record<string, unknown>,\n ): Promise<T[]> {\n try {\n const { id, ...rest } = criteria;\n const processedCriteria = id ? { _id: id, ...rest } : criteria;\n const res = await this.model.updateMany(processedCriteria, update);\n if (res) {\n const response = await this.model\n .find(processedCriteria)\n .exec();\n return response.map((i) => i?.toObject()) as T[];\n } else {\n this.logger.error(\n `Unable to Bulk Update with criteria ${JSON.stringify(criteria)} and data ${JSON.stringify(update)}`,\n );\n throw new Error('Unable to do bulk update');\n }\n\n } catch (e) {\n this.logger.error(\n `Unable to Bulk Update with criteria ${JSON.stringify(criteria)} and data ${JSON.stringify(update)}`,\n );\n throw e;\n }\n }\n\n public async update<I>(\n criteria: FilterQuery<D>,\n update: UpdateQuery<D>,\n options: Record<string, unknown>,\n ): Promise<T> {\n try {\n const { id, ...rest } = criteria;\n const processedCriteria = id ? { _id: id, ...rest } : criteria;\n const mergedOptions = {\n new: true,\n useFindAndModify: false,\n ...options,\n };\n if (id) {\n return (await this.model\n .findByIdAndUpdate(id, update as unknown as never, mergedOptions)\n .exec()) as unknown as Promise<T>;\n }\n return (await this.model\n .findOneAndUpdate(processedCriteria, update as unknown as never, mergedOptions)\n .exec()) as unknown as Promise<T>;\n } catch (e) {\n this.logger.error(\n `Unable to Update with criteria ${JSON.stringify(criteria)} and data ${JSON.stringify(update)}`,\n );\n throw e;\n }\n }\n\n public async delete(criteria: FilterQuery<D>): Promise<boolean> {\n try {\n let deleted;\n if (criteria?.id) {\n deleted = await this.model.findByIdAndDelete(criteria.id);\n } else {\n deleted = await this.model.findOneAndDelete(this.mapConditions(criteria));\n }\n return !!deleted;\n } catch (e) {\n this.logger.error(`Unable to delete the model with criteria`, criteria);\n throw e;\n }\n }\n\n public async bulkDelete(criteria: FilterQuery<D>): Promise<number> {\n try {\n const deleted = await this.model.deleteMany(this.mapConditions(criteria));\n return deleted?.deletedCount || 0;\n } catch (e) {\n this.logger.error(`Unable to delete the model with criteria`, criteria);\n throw e;\n }\n }\n \n}\n","export * from './base-repository';\n","module.exports = require(\"@common-stack/core\");","module.exports = require(\"dataloader\");","module.exports = require(\"inversify\");","module.exports = require(\"lodash\");","module.exports = require(\"mongoose\");"],"sourceRoot":""}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { FilterQuery, Document, Model, UpdateQuery } from 'mongoose';
|
|
2
2
|
import { GetAllArgs } from './get-all-args';
|
|
3
|
+
export declare enum PAGINATION_OPTIONS {
|
|
4
|
+
limit = 10,
|
|
5
|
+
skip = 0
|
|
6
|
+
}
|
|
7
|
+
export declare const DEFAULT_SORTING: {
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
3
10
|
export interface IBaseRepository<T, D = Document<T>> {
|
|
4
11
|
model: Model<D>;
|
|
5
12
|
count(conditions?: FilterQuery<D>): Promise<number>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export declare type Maybe<T> = T | null;
|
|
2
|
+
export declare type Exact<T extends {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
}> = {
|
|
5
|
+
[K in keyof T]: T[K];
|
|
6
|
+
};
|
|
7
|
+
export declare type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
8
|
+
[SubKey in K]?: Maybe<T[SubKey]>;
|
|
9
|
+
};
|
|
10
|
+
export declare type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
11
|
+
[SubKey in K]: Maybe<T[SubKey]>;
|
|
12
|
+
};
|
|
13
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
14
|
+
export declare type Scalars = {
|
|
15
|
+
ID: string;
|
|
16
|
+
String: string;
|
|
17
|
+
Boolean: boolean;
|
|
18
|
+
Int: number;
|
|
19
|
+
Float: number;
|
|
20
|
+
AnyObject: any;
|
|
21
|
+
Date: any;
|
|
22
|
+
DateTime: any;
|
|
23
|
+
JSON: any;
|
|
24
|
+
JSONObject: any;
|
|
25
|
+
Observable: any;
|
|
26
|
+
Time: any;
|
|
27
|
+
URI: any;
|
|
28
|
+
URIInput: any;
|
|
29
|
+
};
|
|
30
|
+
export declare type IAdminIdeSettings = {
|
|
31
|
+
__typename?: 'AdminIdeSettings';
|
|
32
|
+
dummy?: Maybe<Scalars['Int']>;
|
|
33
|
+
};
|
|
34
|
+
export declare enum IBaseServiceCommands {
|
|
35
|
+
count = "count",
|
|
36
|
+
get = "get",
|
|
37
|
+
getAll = "getAll",
|
|
38
|
+
getByIds = "getByIds",
|
|
39
|
+
create = "create",
|
|
40
|
+
insert = "insert",
|
|
41
|
+
bulkCreate = "bulkCreate",
|
|
42
|
+
update = "update",
|
|
43
|
+
delete = "delete",
|
|
44
|
+
getAllWithCount = "getAllWithCount"
|
|
45
|
+
}
|
|
46
|
+
export declare enum ICacheControlScope {
|
|
47
|
+
PUBLIC = "PUBLIC",
|
|
48
|
+
PRIVATE = "PRIVATE"
|
|
49
|
+
}
|
|
50
|
+
/** Represents a null return value. */
|
|
51
|
+
export declare type IEmptyResponse = {
|
|
52
|
+
__typename?: 'EmptyResponse';
|
|
53
|
+
alwaysNil?: Maybe<Scalars['String']>;
|
|
54
|
+
};
|
|
55
|
+
export declare type IFieldError = {
|
|
56
|
+
__typename?: 'FieldError';
|
|
57
|
+
field: Scalars['String'];
|
|
58
|
+
message: Scalars['String'];
|
|
59
|
+
};
|
|
60
|
+
/** All Moleculer Topic names are extended from this. */
|
|
61
|
+
export declare enum IMoleculerServiceName {
|
|
62
|
+
dummy = "dummy"
|
|
63
|
+
}
|
|
64
|
+
export declare type IMutation = {
|
|
65
|
+
__typename?: 'Mutation';
|
|
66
|
+
dummy?: Maybe<Scalars['Int']>;
|
|
67
|
+
};
|
|
68
|
+
/** An object with an ID. */
|
|
69
|
+
export declare type INode = {
|
|
70
|
+
/** The ID of the node. */
|
|
71
|
+
id: Scalars['ID'];
|
|
72
|
+
};
|
|
73
|
+
export declare type IPageInfo = {
|
|
74
|
+
__typename?: 'PageInfo';
|
|
75
|
+
hasNextPage: Scalars['Boolean'];
|
|
76
|
+
};
|
|
77
|
+
export declare type IQuery = {
|
|
78
|
+
__typename?: 'Query';
|
|
79
|
+
/** Looks up a node by ID. */
|
|
80
|
+
node?: Maybe<INode>;
|
|
81
|
+
};
|
|
82
|
+
export declare type IQuerynodeArgs = {
|
|
83
|
+
id: Scalars['ID'];
|
|
84
|
+
};
|
|
85
|
+
export declare type ISort = {
|
|
86
|
+
key: Scalars['String'];
|
|
87
|
+
value: ISortEnum;
|
|
88
|
+
};
|
|
89
|
+
export declare enum ISortEnum {
|
|
90
|
+
ASC = "ASC",
|
|
91
|
+
DESC = "DESC"
|
|
92
|
+
}
|
|
93
|
+
export declare type ISubscription = {
|
|
94
|
+
__typename?: 'Subscription';
|
|
95
|
+
dummy?: Maybe<Scalars['Int']>;
|
|
96
|
+
};
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { FilterQuery } from 'mongoose';
|
|
2
|
-
|
|
3
|
-
key: string;
|
|
4
|
-
value: ISortEnum;
|
|
5
|
-
};
|
|
6
|
-
export declare enum ISortEnum {
|
|
7
|
-
ASC = "ASC",
|
|
8
|
-
DESC = "DESC"
|
|
9
|
-
}
|
|
2
|
+
import { ISort } from './generated-models';
|
|
10
3
|
export interface GetAllArgs<T> {
|
|
11
4
|
criteria?: FilterQuery<T>;
|
|
12
5
|
sort?: ISort;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BaseServiceMixin } from './base-service-mixin';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ServiceBroker } from 'moleculer';
|
|
2
|
+
import { FilterQuery } from 'mongoose';
|
|
3
|
+
import * as Logger from 'bunyan';
|
|
4
|
+
import { GetAllArgs, IBaseService } from '../interfaces';
|
|
5
|
+
declare type MethodsNames<T, C, U> = keyof IBaseService<T, C, U>;
|
|
6
|
+
declare type MethodResponse<T, C, U, M extends MethodsNames<T, C, U>> = ReturnType<IBaseService<T, C, U>[M]>;
|
|
7
|
+
export declare abstract class BaseProxyService<T, C = T, U = T> implements IBaseService<T, C, U> {
|
|
8
|
+
private readonly broker;
|
|
9
|
+
protected logger: Logger;
|
|
10
|
+
protected abstract topic: any;
|
|
11
|
+
constructor(broker: ServiceBroker, logger: Logger);
|
|
12
|
+
bulkCreate(data: C[]): MethodResponse<T, C, U, 'bulkCreate'>;
|
|
13
|
+
count(criteria?: FilterQuery<Document>): MethodResponse<T, C, U, 'count'>;
|
|
14
|
+
create(data: C): MethodResponse<T, C, U, 'create'>;
|
|
15
|
+
delete(id: string | FilterQuery<Document>): MethodResponse<T, C, U, 'delete'>;
|
|
16
|
+
get(id?: string | FilterQuery<Document>): MethodResponse<T, C, U, 'get'>;
|
|
17
|
+
getAll(options?: GetAllArgs<Document>): MethodResponse<T, C, U, 'getAll'>;
|
|
18
|
+
getByIds(ids: string[]): Promise<T[]>;
|
|
19
|
+
getAllWithCount(options: GetAllArgs<Document>): MethodResponse<T, C, U, 'getAllWithCount'>;
|
|
20
|
+
insert(data: C | U, overwrite?: boolean): MethodResponse<T, C, U, 'insert'>;
|
|
21
|
+
update(id: string, data: U, overwrite?: boolean): MethodResponse<T, C, U, 'update'>;
|
|
22
|
+
protected callAction<T, P = unknown>(command: string, params?: P): Promise<T>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
package/lib/services/index.d.ts
CHANGED
|
@@ -19,5 +19,5 @@ export declare class BaseRepository<T, D = Document<T>> implements IBaseReposito
|
|
|
19
19
|
bulkUpdate<I>(criteria: FilterQuery<D>, update: UpdateQuery<D>, options: Record<string, unknown>): Promise<T[]>;
|
|
20
20
|
update<I>(criteria: FilterQuery<D>, update: UpdateQuery<D>, options: Record<string, unknown>): Promise<T>;
|
|
21
21
|
delete(criteria: FilterQuery<D>): Promise<boolean>;
|
|
22
|
-
bulkDelete(
|
|
22
|
+
bulkDelete(criteria: FilterQuery<D>): Promise<number>;
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/store-mongo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Sample core for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"typescript": {
|
|
32
32
|
"definition": "lib/index.d.ts"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "d3dede25f08437855fdc6f2e829a5e9bb825f348"
|
|
35
35
|
}
|
package/lib/constants/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './default-options';
|