@common-stack/store-mongo 0.2.3 → 0.2.7
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 +244 -54
- package/lib/index.js.map +1 -1
- package/lib/interfaces/base-repository.d.ts +7 -0
- package/lib/interfaces/base-service.d.ts +3 -1
- package/lib/interfaces/generated-models.d.ts +32 -0
- 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/base-service.d.ts +2 -2
- 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
|
/***/ }),
|
|
@@ -322,6 +289,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
322
289
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
323
290
|
|
|
324
291
|
|
|
292
|
+
/***/ }),
|
|
293
|
+
|
|
294
|
+
/***/ "./src/interfaces/generated-models.ts":
|
|
295
|
+
/*!********************************************!*\
|
|
296
|
+
!*** ./src/interfaces/generated-models.ts ***!
|
|
297
|
+
\********************************************/
|
|
298
|
+
/*! no static exports found */
|
|
299
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
300
|
+
|
|
301
|
+
"use strict";
|
|
302
|
+
|
|
303
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
304
|
+
exports.BaseServiceCommands = void 0;
|
|
305
|
+
var BaseServiceCommands;
|
|
306
|
+
(function (BaseServiceCommands) {
|
|
307
|
+
BaseServiceCommands["count"] = "count";
|
|
308
|
+
BaseServiceCommands["get"] = "get";
|
|
309
|
+
BaseServiceCommands["getAll"] = "getAll";
|
|
310
|
+
BaseServiceCommands["getByIds"] = "getByIds";
|
|
311
|
+
BaseServiceCommands["create"] = "create";
|
|
312
|
+
BaseServiceCommands["insert"] = "insert";
|
|
313
|
+
BaseServiceCommands["bulkCreate"] = "bulkCreate";
|
|
314
|
+
BaseServiceCommands["update"] = "update";
|
|
315
|
+
BaseServiceCommands["delete"] = "delete";
|
|
316
|
+
BaseServiceCommands["getAllWithCount"] = "getAllWithCount";
|
|
317
|
+
})(BaseServiceCommands = exports.BaseServiceCommands || (exports.BaseServiceCommands = {}));
|
|
318
|
+
|
|
319
|
+
|
|
325
320
|
/***/ }),
|
|
326
321
|
|
|
327
322
|
/***/ "./src/interfaces/get-all-args.ts":
|
|
@@ -369,6 +364,7 @@ __exportStar(__webpack_require__(/*! ./get-all-args */ "./src/interfaces/get-all
|
|
|
369
364
|
__exportStar(__webpack_require__(/*! ./base-repository */ "./src/interfaces/base-repository.ts"), exports);
|
|
370
365
|
__exportStar(__webpack_require__(/*! ./base-service */ "./src/interfaces/base-service.ts"), exports);
|
|
371
366
|
__exportStar(__webpack_require__(/*! ./dataloaders */ "./src/interfaces/dataloaders.ts"), exports);
|
|
367
|
+
__exportStar(__webpack_require__(/*! ./generated-models */ "./src/interfaces/generated-models.ts"), exports);
|
|
372
368
|
|
|
373
369
|
|
|
374
370
|
/***/ }),
|
|
@@ -385,6 +381,182 @@ __exportStar(__webpack_require__(/*! ./dataloaders */ "./src/interfaces/dataload
|
|
|
385
381
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
386
382
|
|
|
387
383
|
|
|
384
|
+
/***/ }),
|
|
385
|
+
|
|
386
|
+
/***/ "./src/mixins/base-service-mixin.ts":
|
|
387
|
+
/*!******************************************!*\
|
|
388
|
+
!*** ./src/mixins/base-service-mixin.ts ***!
|
|
389
|
+
\******************************************/
|
|
390
|
+
/*! no static exports found */
|
|
391
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
392
|
+
|
|
393
|
+
"use strict";
|
|
394
|
+
|
|
395
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
396
|
+
exports.BaseServiceMixin = void 0;
|
|
397
|
+
const interfaces_1 = __webpack_require__(/*! ../interfaces */ "./src/interfaces/index.ts");
|
|
398
|
+
const BaseServiceMixin = (service) => ({
|
|
399
|
+
name: 'BaseServiceMixin',
|
|
400
|
+
actions: {
|
|
401
|
+
[interfaces_1.BaseServiceCommands.get]: {
|
|
402
|
+
params: {
|
|
403
|
+
id: 'string',
|
|
404
|
+
},
|
|
405
|
+
handler: async (ctx) => service.get(ctx.params.id),
|
|
406
|
+
},
|
|
407
|
+
[interfaces_1.BaseServiceCommands.count]: {
|
|
408
|
+
params: {
|
|
409
|
+
criteria: { type: 'object', optional: true },
|
|
410
|
+
},
|
|
411
|
+
handler: async (ctx) => service.count(ctx.params.criteria),
|
|
412
|
+
},
|
|
413
|
+
[interfaces_1.BaseServiceCommands.bulkCreate]: {
|
|
414
|
+
params: {
|
|
415
|
+
data: { type: 'array', items: 'object' },
|
|
416
|
+
},
|
|
417
|
+
handler: async (ctx) => service.bulkCreate(ctx.params.data),
|
|
418
|
+
},
|
|
419
|
+
[interfaces_1.BaseServiceCommands.create]: {
|
|
420
|
+
params: {
|
|
421
|
+
data: 'object',
|
|
422
|
+
},
|
|
423
|
+
handler: async (ctx) => service.create(ctx.params.data),
|
|
424
|
+
},
|
|
425
|
+
[interfaces_1.BaseServiceCommands.delete]: {
|
|
426
|
+
params: {
|
|
427
|
+
id: 'string',
|
|
428
|
+
},
|
|
429
|
+
handler: async (ctx) => service.delete(ctx.params.id),
|
|
430
|
+
},
|
|
431
|
+
[interfaces_1.BaseServiceCommands.getAll]: {
|
|
432
|
+
params: {
|
|
433
|
+
criteria: 'object|optional',
|
|
434
|
+
sort: 'object|optional',
|
|
435
|
+
skip: 'number|optional',
|
|
436
|
+
limit: 'number|optional',
|
|
437
|
+
selectedFields: 'string|optional',
|
|
438
|
+
},
|
|
439
|
+
handler: async (ctx) => service.getAll(ctx.params),
|
|
440
|
+
},
|
|
441
|
+
[interfaces_1.BaseServiceCommands.getAllWithCount]: {
|
|
442
|
+
params: {
|
|
443
|
+
criteria: 'object|optional',
|
|
444
|
+
sort: 'object|optional',
|
|
445
|
+
skip: 'number|optional',
|
|
446
|
+
limit: 'number|optional',
|
|
447
|
+
selectedFields: 'string|optional',
|
|
448
|
+
},
|
|
449
|
+
handler: async (ctx) => service.getAllWithCount(ctx.params),
|
|
450
|
+
},
|
|
451
|
+
[interfaces_1.BaseServiceCommands.insert]: {
|
|
452
|
+
params: {
|
|
453
|
+
data: 'object',
|
|
454
|
+
overwrite: 'boolean|optional',
|
|
455
|
+
},
|
|
456
|
+
handler: async (ctx) => service.insert(ctx.params.data, ctx.params.overwrite),
|
|
457
|
+
},
|
|
458
|
+
[interfaces_1.BaseServiceCommands.update]: {
|
|
459
|
+
params: {
|
|
460
|
+
id: 'string',
|
|
461
|
+
data: 'object',
|
|
462
|
+
overwrite: 'boolean|optional',
|
|
463
|
+
},
|
|
464
|
+
handler: async (ctx) => service.update(ctx.params.id, ctx.params.data, ctx.params.overwrite),
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
});
|
|
468
|
+
exports.BaseServiceMixin = BaseServiceMixin;
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
/***/ }),
|
|
472
|
+
|
|
473
|
+
/***/ "./src/mixins/index.ts":
|
|
474
|
+
/*!*****************************!*\
|
|
475
|
+
!*** ./src/mixins/index.ts ***!
|
|
476
|
+
\*****************************/
|
|
477
|
+
/*! no static exports found */
|
|
478
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
479
|
+
|
|
480
|
+
"use strict";
|
|
481
|
+
|
|
482
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
483
|
+
exports.BaseServiceMixin = void 0;
|
|
484
|
+
var base_service_mixin_1 = __webpack_require__(/*! ./base-service-mixin */ "./src/mixins/base-service-mixin.ts");
|
|
485
|
+
Object.defineProperty(exports, "BaseServiceMixin", { enumerable: true, get: function () { return base_service_mixin_1.BaseServiceMixin; } });
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
/***/ }),
|
|
489
|
+
|
|
490
|
+
/***/ "./src/services/base-proxy-service.ts":
|
|
491
|
+
/*!********************************************!*\
|
|
492
|
+
!*** ./src/services/base-proxy-service.ts ***!
|
|
493
|
+
\********************************************/
|
|
494
|
+
/*! no static exports found */
|
|
495
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
496
|
+
|
|
497
|
+
"use strict";
|
|
498
|
+
|
|
499
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
500
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
501
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
502
|
+
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;
|
|
503
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
504
|
+
};
|
|
505
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
506
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
507
|
+
};
|
|
508
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
509
|
+
exports.BaseProxyService = void 0;
|
|
510
|
+
const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
|
|
511
|
+
const core_1 = __webpack_require__(/*! @common-stack/core */ "@common-stack/core");
|
|
512
|
+
const interfaces_1 = __webpack_require__(/*! ../interfaces */ "./src/interfaces/index.ts");
|
|
513
|
+
let BaseProxyService = class BaseProxyService {
|
|
514
|
+
constructor(broker, logger) {
|
|
515
|
+
this.broker = broker;
|
|
516
|
+
this.logger = logger.child({ className: 'BaseProxyService' });
|
|
517
|
+
}
|
|
518
|
+
bulkCreate(data) {
|
|
519
|
+
return this.callAction(interfaces_1.BaseServiceCommands.bulkCreate, { data });
|
|
520
|
+
}
|
|
521
|
+
count(criteria) {
|
|
522
|
+
return this.callAction(interfaces_1.BaseServiceCommands.count, { criteria });
|
|
523
|
+
}
|
|
524
|
+
create(data) {
|
|
525
|
+
return this.callAction(interfaces_1.BaseServiceCommands.create, { data });
|
|
526
|
+
}
|
|
527
|
+
delete(id) {
|
|
528
|
+
return this.callAction(interfaces_1.BaseServiceCommands.delete, { id });
|
|
529
|
+
}
|
|
530
|
+
get(id) {
|
|
531
|
+
return this.callAction(interfaces_1.BaseServiceCommands.get, { id });
|
|
532
|
+
}
|
|
533
|
+
getAll(options) {
|
|
534
|
+
return this.callAction(interfaces_1.BaseServiceCommands.getAll, options);
|
|
535
|
+
}
|
|
536
|
+
getByIds(ids) {
|
|
537
|
+
return this.callAction(interfaces_1.BaseServiceCommands.getByIds, { ids });
|
|
538
|
+
}
|
|
539
|
+
getAllWithCount(options) {
|
|
540
|
+
return this.callAction(interfaces_1.BaseServiceCommands.getAllWithCount, options);
|
|
541
|
+
}
|
|
542
|
+
insert(data, overwrite) {
|
|
543
|
+
return this.callAction(interfaces_1.BaseServiceCommands.insert, { data, overwrite });
|
|
544
|
+
}
|
|
545
|
+
update(id, data, overwrite) {
|
|
546
|
+
return this.callAction(interfaces_1.BaseServiceCommands.update, { id, data, overwrite });
|
|
547
|
+
}
|
|
548
|
+
async callAction(command, params) {
|
|
549
|
+
return this.broker.call(`${this.topic}.${command}`, params);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
BaseProxyService = __decorate([
|
|
553
|
+
inversify_1.injectable(),
|
|
554
|
+
__param(0, inversify_1.inject(core_1.CommonType.MOLECULER_BROKER)),
|
|
555
|
+
__param(1, inversify_1.inject('Logger'))
|
|
556
|
+
], BaseProxyService);
|
|
557
|
+
exports.BaseProxyService = BaseProxyService;
|
|
558
|
+
|
|
559
|
+
|
|
388
560
|
/***/ }),
|
|
389
561
|
|
|
390
562
|
/***/ "./src/services/base-service.ts":
|
|
@@ -432,8 +604,11 @@ let BaseService = class BaseService {
|
|
|
432
604
|
count(conditions) {
|
|
433
605
|
return this.repository.count(conditions);
|
|
434
606
|
}
|
|
435
|
-
get(
|
|
436
|
-
|
|
607
|
+
get(conditions) {
|
|
608
|
+
if (typeof conditions === 'string') {
|
|
609
|
+
return this.repository.get({ id: conditions });
|
|
610
|
+
}
|
|
611
|
+
return this.repository.get(conditions);
|
|
437
612
|
}
|
|
438
613
|
getName(name) {
|
|
439
614
|
return this.repository.get({ name });
|
|
@@ -464,7 +639,10 @@ let BaseService = class BaseService {
|
|
|
464
639
|
return this.create(rest);
|
|
465
640
|
}
|
|
466
641
|
delete(id) {
|
|
467
|
-
|
|
642
|
+
if (typeof id === 'string') {
|
|
643
|
+
return this.repository.delete({ id });
|
|
644
|
+
}
|
|
645
|
+
return this.repository.delete(id);
|
|
468
646
|
}
|
|
469
647
|
};
|
|
470
648
|
BaseService = __decorate([
|
|
@@ -496,6 +674,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
496
674
|
};
|
|
497
675
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
498
676
|
__exportStar(__webpack_require__(/*! ./base-service */ "./src/services/base-service.ts"), exports);
|
|
677
|
+
__exportStar(__webpack_require__(/*! ./base-proxy-service */ "./src/services/base-proxy-service.ts"), exports);
|
|
499
678
|
|
|
500
679
|
|
|
501
680
|
/***/ }),
|
|
@@ -621,8 +800,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
621
800
|
exports.BaseRepository = void 0;
|
|
622
801
|
const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
|
|
623
802
|
const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
|
|
624
|
-
const
|
|
625
|
-
const DEFAULT_PAGINATION_LIMIT = 10;
|
|
803
|
+
const interfaces_1 = __webpack_require__(/*! ../../interfaces */ "./src/interfaces/index.ts");
|
|
626
804
|
let BaseRepository = BaseRepository_1 = class BaseRepository {
|
|
627
805
|
constructor(modelFunc, db, logger, options) {
|
|
628
806
|
this.modelFunc = modelFunc;
|
|
@@ -635,11 +813,12 @@ let BaseRepository = BaseRepository_1 = class BaseRepository {
|
|
|
635
813
|
const { criteria, selectedFields, sort, limit, skip } = options;
|
|
636
814
|
// map id to mongoose _id
|
|
637
815
|
const _a = criteria || { id: undefined }, { id } = _a, rest = __rest(_a, ["id"]);
|
|
816
|
+
const sortBy = lodash_1.isObject(sort) ? { [sort === null || sort === void 0 ? void 0 : sort.key]: sort.value } : interfaces_1.DEFAULT_SORTING;
|
|
638
817
|
const response = await this.model
|
|
639
818
|
.find(Object.assign(Object.assign({}, rest), (id ? { _id: id } : {})), selectedFields)
|
|
640
|
-
.limit(limit ||
|
|
641
|
-
.skip(skip ||
|
|
642
|
-
.sort(
|
|
819
|
+
.limit(limit || interfaces_1.PAGINATION_OPTIONS.limit)
|
|
820
|
+
.skip(skip || interfaces_1.PAGINATION_OPTIONS.skip)
|
|
821
|
+
.sort(sortBy)
|
|
643
822
|
.exec();
|
|
644
823
|
return response.map((i) => i === null || i === void 0 ? void 0 : i.toObject());
|
|
645
824
|
}
|
|
@@ -767,13 +946,13 @@ let BaseRepository = BaseRepository_1 = class BaseRepository {
|
|
|
767
946
|
throw e;
|
|
768
947
|
}
|
|
769
948
|
}
|
|
770
|
-
async bulkDelete(
|
|
949
|
+
async bulkDelete(criteria) {
|
|
771
950
|
try {
|
|
772
|
-
const deleted = await this.model.deleteMany(
|
|
951
|
+
const deleted = await this.model.deleteMany(this.mapConditions(criteria));
|
|
773
952
|
return (deleted === null || deleted === void 0 ? void 0 : deleted.deletedCount) || 0;
|
|
774
953
|
}
|
|
775
954
|
catch (e) {
|
|
776
|
-
this.logger.error(`Unable to delete the model with criteria`,
|
|
955
|
+
this.logger.error(`Unable to delete the model with criteria`, criteria);
|
|
777
956
|
throw e;
|
|
778
957
|
}
|
|
779
958
|
}
|
|
@@ -813,6 +992,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
813
992
|
__exportStar(__webpack_require__(/*! ./base-repository */ "./src/store/repositories/base-repository.ts"), exports);
|
|
814
993
|
|
|
815
994
|
|
|
995
|
+
/***/ }),
|
|
996
|
+
|
|
997
|
+
/***/ "@common-stack/core":
|
|
998
|
+
/*!*************************************!*\
|
|
999
|
+
!*** external "@common-stack/core" ***!
|
|
1000
|
+
\*************************************/
|
|
1001
|
+
/*! no static exports found */
|
|
1002
|
+
/***/ (function(module, exports) {
|
|
1003
|
+
|
|
1004
|
+
module.exports = require("@common-stack/core");
|
|
1005
|
+
|
|
816
1006
|
/***/ }),
|
|
817
1007
|
|
|
818
1008
|
/***/ "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":[],"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;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe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AO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC7E;YACD,OAAO,CAAC,CAAC,OAAO,CAAC;SACpB;QAAC,OAAO,CAAC,EAAE;YACR,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,EAAE,QAAQ,CAAC,CAAC;YACxE,MAAM,CAAC,CAAC;SACX;IACL,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,UAA0B;QAC9C,IAAI;YACA,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YACxD,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,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(id: string): Promise<T> {\n return this.repository.get({ id });\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): Promise<boolean> {\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/get-all-args.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;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;;;;;;;;;;;AClFA,uEAAyC;AACzC,sEAAkD;AAIlD,IAAa,cAAc,GAA3B,MAAa,cAAyC,SAAQ,UAAqB;IAC/E,YAEI,OAAwB;QAExB,KAAK,CAAC,KAAK,EAAE,GAAa,EAAE,EAAE;YAC1B,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACzC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAVY,cAAc;IAD1B,sBAAU,EAAE;IAGJ,gCAA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,KAAK,CAAC,0CAA0C,EAAE,QAAQ,CAAC,CAAC;YACxE,MAAM,CAAC,CAAC;SACX;IACL,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,QAAwB;QAC5C,IAAI;YACA,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,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};\n\nexport enum BaseServiceCommands {\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","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';\nexport * from './generated-models';\n","import { Context, ServiceSchema } from 'moleculer';\nimport { Document, FilterQuery } from 'mongoose';\nimport { BaseServiceCommands, GetAllArgs, IBaseService } from '../interfaces';\n\nexport const BaseServiceMixin = <T, C, U>(service: IBaseService<T, C, U>): Partial<ServiceSchema> => ({\n name: 'BaseServiceMixin',\n actions: {\n [BaseServiceCommands.get]: {\n params: {\n id: 'string',\n },\n handler: async (ctx: Context<{ id: string }>) => service.get(ctx.params.id),\n },\n [BaseServiceCommands.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 [BaseServiceCommands.bulkCreate]: {\n params: {\n data: { type: 'array', items: 'object' },\n },\n handler: async (ctx: Context<{ data: never[] }>) => service.bulkCreate(ctx.params.data),\n },\n [BaseServiceCommands.create]: {\n params: {\n data: 'object',\n },\n handler: async (ctx: Context<{ data: never }>) => service.create(ctx.params.data),\n },\n [BaseServiceCommands.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 [BaseServiceCommands.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 [BaseServiceCommands.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 [BaseServiceCommands.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 [BaseServiceCommands.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 { BaseServiceCommands, 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[] }>(BaseServiceCommands.bulkCreate, { data });\n }\n\n count(criteria?: FilterQuery<Document>): MethodResponse<T, C, U, 'count'> {\n return this.callAction(BaseServiceCommands.count, { criteria });\n }\n\n create(data: C): MethodResponse<T, C, U, 'create'> {\n return this.callAction(BaseServiceCommands.create, { data });\n }\n\n delete(id: string | FilterQuery<Document>): MethodResponse<T, C, U, 'delete'> {\n return this.callAction(BaseServiceCommands.delete, { id });\n }\n\n get(id?: string | FilterQuery<Document>): MethodResponse<T, C, U, 'get'> {\n return this.callAction(BaseServiceCommands.get, { id });\n }\n\n getAll(options?: GetAllArgs<Document>): MethodResponse<T, C, U, 'getAll'> {\n return this.callAction(BaseServiceCommands.getAll, options);\n }\n\n getByIds(ids: string[]): Promise<T[]> {\n return this.callAction(BaseServiceCommands.getByIds, { ids });\n }\n\n getAllWithCount(options: GetAllArgs<Document>): MethodResponse<T, C, U, 'getAllWithCount'> {\n return this.callAction(BaseServiceCommands.getAllWithCount, options);\n }\n\n insert(data: C | U, overwrite?: boolean): MethodResponse<T, C, U, 'insert'> {\n return this.callAction(BaseServiceCommands.insert, { data, overwrite });\n }\n\n update(id: string, data: U, overwrite?: boolean): MethodResponse<T, C, U, 'update'> {\n return this.callAction<T>(BaseServiceCommands.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>;
|
|
@@ -3,6 +3,7 @@ import { GetAllArgs } from './get-all-args';
|
|
|
3
3
|
export interface IBaseService<T, C = Omit<T, 'id'>, U = C> {
|
|
4
4
|
count(conditions?: FilterQuery<Document<T>>): Promise<number>;
|
|
5
5
|
get(id: string): Promise<T>;
|
|
6
|
+
get(conditions?: FilterQuery<Document<T>>): Promise<T>;
|
|
6
7
|
getAll(options?: GetAllArgs<Document<T>>): Promise<T[]>;
|
|
7
8
|
getByIds(ids: string[]): Promise<T[]>;
|
|
8
9
|
create(data: C): Promise<T>;
|
|
@@ -10,8 +11,9 @@ export interface IBaseService<T, C = Omit<T, 'id'>, U = C> {
|
|
|
10
11
|
id?: string;
|
|
11
12
|
}, overwrite?: boolean): Promise<T>;
|
|
12
13
|
bulkCreate(data: C[]): Promise<T[]>;
|
|
13
|
-
update(id: string, data:
|
|
14
|
+
update(id: string, data: U, overwrite?: boolean): Promise<T>;
|
|
14
15
|
delete(id: string): Promise<boolean>;
|
|
16
|
+
delete(conditions: FilterQuery<Document<T>>): Promise<boolean>;
|
|
15
17
|
getAllWithCount(options: GetAllArgs<Document<T>>): Promise<{
|
|
16
18
|
data: T[];
|
|
17
19
|
totalCount: number;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
};
|
|
21
|
+
export declare enum BaseServiceCommands {
|
|
22
|
+
count = "count",
|
|
23
|
+
get = "get",
|
|
24
|
+
getAll = "getAll",
|
|
25
|
+
getByIds = "getByIds",
|
|
26
|
+
create = "create",
|
|
27
|
+
insert = "insert",
|
|
28
|
+
bulkCreate = "bulkCreate",
|
|
29
|
+
update = "update",
|
|
30
|
+
delete = "delete",
|
|
31
|
+
getAllWithCount = "getAllWithCount"
|
|
32
|
+
}
|
|
@@ -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 {};
|
|
@@ -8,7 +8,7 @@ export declare class BaseService<T, C = Omit<T, 'id'>, U = C> implements IBaseSe
|
|
|
8
8
|
totalCount: number;
|
|
9
9
|
}>;
|
|
10
10
|
count(conditions?: FilterQuery<Document<T>>): Promise<number>;
|
|
11
|
-
get(
|
|
11
|
+
get(conditions: string | FilterQuery<Document<T>>): Promise<T>;
|
|
12
12
|
getName(name: string): Promise<T>;
|
|
13
13
|
getAll(options: GetAllArgs<Document<T>>): Promise<T[]>;
|
|
14
14
|
getByIds(ids: string[]): Promise<T[]>;
|
|
@@ -18,5 +18,5 @@ export declare class BaseService<T, C = Omit<T, 'id'>, U = C> implements IBaseSe
|
|
|
18
18
|
insert(data: (C | U) & {
|
|
19
19
|
id?: string;
|
|
20
20
|
}, overwrite?: boolean): Promise<T>;
|
|
21
|
-
delete(id: string): Promise<boolean>;
|
|
21
|
+
delete(id: string | FilterQuery<Document<T>>): Promise<boolean>;
|
|
22
22
|
}
|
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.7",
|
|
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": "1003ef69b3b4c1e73e5b92fb617f89023a7f14e9"
|
|
35
35
|
}
|
package/lib/constants/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './default-options';
|