@common-stack/store-mongo 0.1.11 → 0.1.12

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.1.12](https://github.com/cdmbase/common-stack/compare/v0.1.11...v0.1.12) (2021-12-10)
7
+
8
+ **Note:** Version bump only for package @common-stack/store-mongo
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.1.11](https://github.com/cdmbase/common-stack/compare/v0.1.10...v0.1.11) (2021-11-07)
7
15
 
8
16
  **Note:** Version bump only for package @common-stack/store-mongo
@@ -0,0 +1,3 @@
1
+ export declare const DEFAULT_SORTING: {
2
+ id: string;
3
+ };
@@ -0,0 +1 @@
1
+ export * from './default-options';
package/lib/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export * from './interfaces';
2
2
  export * from './helpers';
3
+ export * from './services';
4
+ export * from './store';
package/lib/index.js CHANGED
@@ -87,6 +87,49 @@ 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" && !exports.hasOwnProperty(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
+
90
133
  /***/ "./src/helpers/index.ts":
91
134
  /*!******************************!*\
92
135
  !*** ./src/helpers/index.ts ***!
@@ -168,6 +211,56 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
168
211
  Object.defineProperty(exports, "__esModule", { value: true });
169
212
  __exportStar(__webpack_require__(/*! ./interfaces */ "./src/interfaces/index.ts"), exports);
170
213
  __exportStar(__webpack_require__(/*! ./helpers */ "./src/helpers/index.ts"), exports);
214
+ __exportStar(__webpack_require__(/*! ./services */ "./src/services/index.ts"), exports);
215
+ __exportStar(__webpack_require__(/*! ./store */ "./src/store/index.ts"), exports);
216
+
217
+
218
+ /***/ }),
219
+
220
+ /***/ "./src/interfaces/base-repository.ts":
221
+ /*!*******************************************!*\
222
+ !*** ./src/interfaces/base-repository.ts ***!
223
+ \*******************************************/
224
+ /*! no static exports found */
225
+ /***/ (function(module, exports, __webpack_require__) {
226
+
227
+ "use strict";
228
+
229
+ Object.defineProperty(exports, "__esModule", { value: true });
230
+
231
+
232
+ /***/ }),
233
+
234
+ /***/ "./src/interfaces/base-service.ts":
235
+ /*!****************************************!*\
236
+ !*** ./src/interfaces/base-service.ts ***!
237
+ \****************************************/
238
+ /*! no static exports found */
239
+ /***/ (function(module, exports, __webpack_require__) {
240
+
241
+ "use strict";
242
+
243
+ Object.defineProperty(exports, "__esModule", { value: true });
244
+
245
+
246
+ /***/ }),
247
+
248
+ /***/ "./src/interfaces/get-all-args.ts":
249
+ /*!****************************************!*\
250
+ !*** ./src/interfaces/get-all-args.ts ***!
251
+ \****************************************/
252
+ /*! no static exports found */
253
+ /***/ (function(module, exports, __webpack_require__) {
254
+
255
+ "use strict";
256
+
257
+ Object.defineProperty(exports, "__esModule", { value: true });
258
+ exports.ISortEnum = void 0;
259
+ var ISortEnum;
260
+ (function (ISortEnum) {
261
+ ISortEnum["ASC"] = "ASC";
262
+ ISortEnum["DESC"] = "DESC";
263
+ })(ISortEnum = exports.ISortEnum || (exports.ISortEnum = {}));
171
264
 
172
265
 
173
266
  /***/ }),
@@ -193,6 +286,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
193
286
  };
194
287
  Object.defineProperty(exports, "__esModule", { value: true });
195
288
  __exportStar(__webpack_require__(/*! ./mongoose-settings */ "./src/interfaces/mongoose-settings.ts"), exports);
289
+ __exportStar(__webpack_require__(/*! ./get-all-args */ "./src/interfaces/get-all-args.ts"), exports);
290
+ __exportStar(__webpack_require__(/*! ./base-repository */ "./src/interfaces/base-repository.ts"), exports);
291
+ __exportStar(__webpack_require__(/*! ./base-service */ "./src/interfaces/base-service.ts"), exports);
196
292
 
197
293
 
198
294
  /***/ }),
@@ -209,6 +305,434 @@ __exportStar(__webpack_require__(/*! ./mongoose-settings */ "./src/interfaces/mo
209
305
  Object.defineProperty(exports, "__esModule", { value: true });
210
306
 
211
307
 
308
+ /***/ }),
309
+
310
+ /***/ "./src/services/base-service.ts":
311
+ /*!**************************************!*\
312
+ !*** ./src/services/base-service.ts ***!
313
+ \**************************************/
314
+ /*! no static exports found */
315
+ /***/ (function(module, exports, __webpack_require__) {
316
+
317
+ "use strict";
318
+
319
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
320
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
321
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
322
+ 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;
323
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
324
+ };
325
+ var __rest = (this && this.__rest) || function (s, e) {
326
+ var t = {};
327
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
328
+ t[p] = s[p];
329
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
330
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
331
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
332
+ t[p[i]] = s[p[i]];
333
+ }
334
+ return t;
335
+ };
336
+ Object.defineProperty(exports, "__esModule", { value: true });
337
+ exports.BaseService = void 0;
338
+ const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
339
+ let BaseService = class BaseService {
340
+ constructor(repository) {
341
+ this.repository = repository;
342
+ this.repository = repository;
343
+ }
344
+ async getAllWithCount(options) {
345
+ const totalCount = await this.count(options.criteria);
346
+ const data = await this.getAll(options);
347
+ return {
348
+ totalCount,
349
+ data,
350
+ };
351
+ }
352
+ count(conditions) {
353
+ return this.repository.count(conditions);
354
+ }
355
+ get(id) {
356
+ return this.repository.get({ id });
357
+ }
358
+ getName(name) {
359
+ return this.repository.get({ name });
360
+ }
361
+ getAll(options) {
362
+ return this.repository.getAll(options);
363
+ }
364
+ getByIds(ids) {
365
+ return this.repository.bulkGet(ids);
366
+ }
367
+ create(data) {
368
+ return this.repository.create(data);
369
+ }
370
+ bulkCreate(data) {
371
+ return this.repository.bulkCreate(data);
372
+ }
373
+ async update(id, data, overwrite = false) {
374
+ return this.repository.update({ id }, data, { overwrite });
375
+ }
376
+ insert(data, overwrite = true) {
377
+ const { id } = data, rest = __rest(data, ["id"]);
378
+ if (id) {
379
+ const existing = this.repository.get({ id });
380
+ if (existing) {
381
+ return this.update(id, rest, overwrite);
382
+ }
383
+ }
384
+ return this.create(rest);
385
+ }
386
+ delete(id) {
387
+ return this.repository.delete({ id });
388
+ }
389
+ };
390
+ BaseService = __decorate([
391
+ inversify_1.injectable()
392
+ ], BaseService);
393
+ exports.BaseService = BaseService;
394
+
395
+
396
+ /***/ }),
397
+
398
+ /***/ "./src/services/index.ts":
399
+ /*!*******************************!*\
400
+ !*** ./src/services/index.ts ***!
401
+ \*******************************/
402
+ /*! no static exports found */
403
+ /***/ (function(module, exports, __webpack_require__) {
404
+
405
+ "use strict";
406
+
407
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
408
+ if (k2 === undefined) k2 = k;
409
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
410
+ }) : (function(o, m, k, k2) {
411
+ if (k2 === undefined) k2 = k;
412
+ o[k2] = m[k];
413
+ }));
414
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
415
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
416
+ };
417
+ Object.defineProperty(exports, "__esModule", { value: true });
418
+ __exportStar(__webpack_require__(/*! ./base-service */ "./src/services/base-service.ts"), exports);
419
+
420
+
421
+ /***/ }),
422
+
423
+ /***/ "./src/store/index.ts":
424
+ /*!****************************!*\
425
+ !*** ./src/store/index.ts ***!
426
+ \****************************/
427
+ /*! no static exports found */
428
+ /***/ (function(module, exports, __webpack_require__) {
429
+
430
+ "use strict";
431
+
432
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
433
+ if (k2 === undefined) k2 = k;
434
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
435
+ }) : (function(o, m, k, k2) {
436
+ if (k2 === undefined) k2 = k;
437
+ o[k2] = m[k];
438
+ }));
439
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
440
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
441
+ };
442
+ Object.defineProperty(exports, "__esModule", { value: true });
443
+ __exportStar(__webpack_require__(/*! ./models */ "./src/store/models/index.ts"), exports);
444
+ __exportStar(__webpack_require__(/*! ./repositories */ "./src/store/repositories/index.ts"), exports);
445
+
446
+
447
+ /***/ }),
448
+
449
+ /***/ "./src/store/models/common-options.ts":
450
+ /*!********************************************!*\
451
+ !*** ./src/store/models/common-options.ts ***!
452
+ \********************************************/
453
+ /*! no static exports found */
454
+ /***/ (function(module, exports, __webpack_require__) {
455
+
456
+ "use strict";
457
+
458
+ Object.defineProperty(exports, "__esModule", { value: true });
459
+ exports.addIdVirtualFields = exports.commonModeSchemaOptions = void 0;
460
+ exports.commonModeSchemaOptions = {
461
+ timestamps: true,
462
+ toJSON: {
463
+ virtuals: true,
464
+ },
465
+ toObject: {
466
+ virtuals: true,
467
+ getters: true,
468
+ transform(doc, ret) {
469
+ delete ret.__v;
470
+ delete ret._id;
471
+ },
472
+ },
473
+ };
474
+ exports.addIdVirtualFields = (schema) => {
475
+ schema.set('toJSON', {
476
+ virtuals: true,
477
+ });
478
+ return schema;
479
+ };
480
+
481
+
482
+ /***/ }),
483
+
484
+ /***/ "./src/store/models/index.ts":
485
+ /*!***********************************!*\
486
+ !*** ./src/store/models/index.ts ***!
487
+ \***********************************/
488
+ /*! no static exports found */
489
+ /***/ (function(module, exports, __webpack_require__) {
490
+
491
+ "use strict";
492
+
493
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
494
+ if (k2 === undefined) k2 = k;
495
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
496
+ }) : (function(o, m, k, k2) {
497
+ if (k2 === undefined) k2 = k;
498
+ o[k2] = m[k];
499
+ }));
500
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
501
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
502
+ };
503
+ Object.defineProperty(exports, "__esModule", { value: true });
504
+ __exportStar(__webpack_require__(/*! ./common-options */ "./src/store/models/common-options.ts"), exports);
505
+
506
+
507
+ /***/ }),
508
+
509
+ /***/ "./src/store/repositories/base-repository.ts":
510
+ /*!***************************************************!*\
511
+ !*** ./src/store/repositories/base-repository.ts ***!
512
+ \***************************************************/
513
+ /*! no static exports found */
514
+ /***/ (function(module, exports, __webpack_require__) {
515
+
516
+ "use strict";
517
+
518
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
519
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
520
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
521
+ 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;
522
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
523
+ };
524
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
525
+ return function (target, key) { decorator(target, key, paramIndex); }
526
+ };
527
+ var __rest = (this && this.__rest) || function (s, e) {
528
+ var t = {};
529
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
530
+ t[p] = s[p];
531
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
532
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
533
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
534
+ t[p[i]] = s[p[i]];
535
+ }
536
+ return t;
537
+ };
538
+ var BaseRepository_1;
539
+ Object.defineProperty(exports, "__esModule", { value: true });
540
+ exports.BaseRepository = void 0;
541
+ const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
542
+ const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
543
+ const constants_1 = __webpack_require__(/*! ../../constants */ "./src/constants/index.ts");
544
+ const DEFAULT_PAGINATION_LIMIT = 10;
545
+ let BaseRepository = BaseRepository_1 = class BaseRepository {
546
+ constructor(modelFunc, db, logger, options) {
547
+ this.modelFunc = modelFunc;
548
+ this.model = modelFunc(db);
549
+ this.options = options;
550
+ this.logger = logger.child({ className: BaseRepository_1.name });
551
+ }
552
+ async getAll(options) {
553
+ try {
554
+ const { criteria, selectedFields, sort, limit, skip } = options;
555
+ // map id to mongoose _id
556
+ const _a = criteria || { id: undefined }, { id } = _a, rest = __rest(_a, ["id"]);
557
+ const response = await this.model
558
+ .find(Object.assign(Object.assign({}, rest), (id ? { _id: id } : {})), selectedFields)
559
+ .limit(limit || DEFAULT_PAGINATION_LIMIT)
560
+ .skip(skip || 0)
561
+ .sort(lodash_1.isObject(sort) ? { [sort === null || sort === void 0 ? void 0 : sort.key]: sort.value } : constants_1.DEFAULT_SORTING)
562
+ .exec();
563
+ return response.map((i) => i === null || i === void 0 ? void 0 : i.toObject());
564
+ }
565
+ catch (e) {
566
+ this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(options)}`);
567
+ throw e;
568
+ }
569
+ }
570
+ // eslint-disable-next-line class-methods-use-this
571
+ mapConditions(conditions) {
572
+ const { id: _id } = conditions, remaining = __rest(conditions, ["id"]);
573
+ return Object.assign(Object.assign({}, (_id ? { _id } : {})), remaining);
574
+ }
575
+ async count(conditions) {
576
+ return this.model.count(conditions).exec();
577
+ }
578
+ async get(conditions, selectedFields) {
579
+ try {
580
+ const response = await this.model.findOne(this.mapConditions(conditions), selectedFields).exec();
581
+ return response === null || response === void 0 ? void 0 : response.toObject();
582
+ }
583
+ catch (e) {
584
+ this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(conditions)}`);
585
+ throw e;
586
+ }
587
+ }
588
+ async bulkGet(ids) {
589
+ try {
590
+ const results = await this.model.find().setOptions({ batchSize: 100 }).where('_id').in(ids).exec();
591
+ return results.map((i) => i.toObject());
592
+ }
593
+ catch (e) {
594
+ this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(ids)}`);
595
+ throw e;
596
+ }
597
+ }
598
+ async find(conditions, selectedFields) {
599
+ try {
600
+ const response = await this.model.findOne(conditions, selectedFields).exec();
601
+ return response === null || response === void 0 ? void 0 : response.toObject();
602
+ }
603
+ catch (e) {
604
+ this.logger.error(`Unable to retrieve Model with criteria ${JSON.stringify(conditions)}`);
605
+ throw e;
606
+ }
607
+ }
608
+ async create(data) {
609
+ try {
610
+ const response = await this.model.create(data);
611
+ return response.toObject();
612
+ }
613
+ catch (e) {
614
+ this.logger.error(`Unable to create Model with data ${JSON.stringify(data)} due to ${e === null || e === void 0 ? void 0 : e.message}`);
615
+ throw e;
616
+ }
617
+ }
618
+ async bulkCreate(data) {
619
+ try {
620
+ const response = await this.model.insertMany(data, {
621
+ lean: true,
622
+ ordered: true,
623
+ });
624
+ return response;
625
+ }
626
+ catch (e) {
627
+ this.logger.error(`Unable to bulk create due to error`, e.message);
628
+ }
629
+ }
630
+ async upsert(conditions, update, options) {
631
+ return this.update(conditions, update, Object.assign({ upsert: true }, options));
632
+ }
633
+ async update(criteria, update, options) {
634
+ try {
635
+ const { id } = criteria, rest = __rest(criteria, ["id"]);
636
+ const processedCriteria = id ? Object.assign({ _id: id }, rest) : criteria;
637
+ const mergedOptions = Object.assign({ new: true, useFindAndModify: false }, options);
638
+ if (id) {
639
+ return (await this.model
640
+ .findByIdAndUpdate(id, update, mergedOptions)
641
+ .exec());
642
+ }
643
+ return (await this.model
644
+ .findOneAndUpdate(processedCriteria, update, mergedOptions)
645
+ .exec());
646
+ }
647
+ catch (e) {
648
+ this.logger.error(`Unable to Update with criteria ${JSON.stringify(criteria)} and data ${JSON.stringify(update)}`);
649
+ throw e;
650
+ }
651
+ }
652
+ async delete(criteria) {
653
+ try {
654
+ let deleted;
655
+ if (criteria === null || criteria === void 0 ? void 0 : criteria.id) {
656
+ deleted = await this.model.findByIdAndDelete(criteria.id);
657
+ }
658
+ else {
659
+ deleted = await this.model.findOneAndDelete(this.mapConditions(criteria));
660
+ }
661
+ return !!deleted;
662
+ }
663
+ catch (e) {
664
+ this.logger.error(`Unable to delete the model with criteria`, criteria);
665
+ throw e;
666
+ }
667
+ }
668
+ async bulkDelete(conditions) {
669
+ try {
670
+ const deleted = await this.model.deleteMany(conditions);
671
+ return (deleted === null || deleted === void 0 ? void 0 : deleted.deletedCount) || 0;
672
+ }
673
+ catch (e) {
674
+ this.logger.error(`Unable to delete the model with criteria`, conditions);
675
+ throw e;
676
+ }
677
+ }
678
+ };
679
+ BaseRepository = BaseRepository_1 = __decorate([
680
+ inversify_1.injectable(),
681
+ __param(0, inversify_1.unmanaged()),
682
+ __param(1, inversify_1.unmanaged()),
683
+ __param(2, inversify_1.unmanaged()),
684
+ __param(3, inversify_1.unmanaged())
685
+ ], BaseRepository);
686
+ exports.BaseRepository = BaseRepository;
687
+
688
+
689
+ /***/ }),
690
+
691
+ /***/ "./src/store/repositories/index.ts":
692
+ /*!*****************************************!*\
693
+ !*** ./src/store/repositories/index.ts ***!
694
+ \*****************************************/
695
+ /*! no static exports found */
696
+ /***/ (function(module, exports, __webpack_require__) {
697
+
698
+ "use strict";
699
+
700
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
701
+ if (k2 === undefined) k2 = k;
702
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
703
+ }) : (function(o, m, k, k2) {
704
+ if (k2 === undefined) k2 = k;
705
+ o[k2] = m[k];
706
+ }));
707
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
708
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
709
+ };
710
+ Object.defineProperty(exports, "__esModule", { value: true });
711
+ __exportStar(__webpack_require__(/*! ./base-repository */ "./src/store/repositories/base-repository.ts"), exports);
712
+
713
+
714
+ /***/ }),
715
+
716
+ /***/ "inversify":
717
+ /*!****************************!*\
718
+ !*** external "inversify" ***!
719
+ \****************************/
720
+ /*! no static exports found */
721
+ /***/ (function(module, exports) {
722
+
723
+ module.exports = require("inversify");
724
+
725
+ /***/ }),
726
+
727
+ /***/ "lodash":
728
+ /*!*************************!*\
729
+ !*** external "lodash" ***!
730
+ \*************************/
731
+ /*! no static exports found */
732
+ /***/ (function(module, exports) {
733
+
734
+ module.exports = require("lodash");
735
+
212
736
  /***/ }),
213
737
 
214
738
  /***/ "mongoose":
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/helpers/index.ts","webpack:///./src/helpers/mongoose-connection.ts","webpack:///./src/index.ts","webpack:///./src/interfaces/index.ts","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,gHAAsC;;;;;;;;;;;;;;;;ACAtC,iEAAqC;AAErC,IAAI,iBAAyD,CAAC;AAC9D,8CAA8C;AAE9C,MAAM,aAAa,GAAqC,CAAC,QAAQ,EAAE,EAAE;IAEjE,6BAA6B;IAC7B,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,EAC1B,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACT,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAC1C,gCAAgC;QAChC,4DAA4D;IAChE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAmB,EAAE,EAAE;QAC7B,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;QACjD,aAAa;QACb,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IACH,+BAA+B;IAC/B,MAAM,kBAAkB,GAAwB,QAAQ,CAAC,UAAU,CAAC;IAEpE,OAAO,kBAAkB,CAAC;AAC9B,CAAC,CAAC;AAIO,sCAAa;;;;;;;;;;;;;;;;;;;;;;;;;AC1BtB,4FAA6B;AAC7B,sFAA0B;;;;;;;;;;;;;;;;;;;;;;;;;ACD1B,+GAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;ACApC,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 * 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';\n","export * from './mongoose-settings';\n","module.exports = require(\"mongoose\");"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/constants/default-options.ts","webpack:///./src/constants/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 \"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,uBAAe,GAAG;IAC3B,EAAE,EAAE,KAAK;CACZ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;ACFF,0GAAkC;;;;;;;;;;;;;;;;;;;;;;;;;ACAlC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AEX,gCAAS,EAAE;GAdP,cAAc,CAqK1B;AArKY,wCAAc;;;;;;;;;;;;;;;;;;;;;;;;;ACT3B,mHAAkC;;;;;;;;;;;;ACAlC,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","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';\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';\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 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(\"inversify\");","module.exports = require(\"lodash\");","module.exports = require(\"mongoose\");"],"sourceRoot":""}
@@ -0,0 +1,15 @@
1
+ import { FilterQuery, Document, Model, UpdateQuery } from 'mongoose';
2
+ import { GetAllArgs } from './get-all-args';
3
+ export interface IBaseRepository<T, D = Document<T>> {
4
+ model: Model<D>;
5
+ count(conditions?: FilterQuery<D>): Promise<number>;
6
+ getAll(options: GetAllArgs<D>): Promise<T[]>;
7
+ get(conditions?: FilterQuery<D>, selectedFields?: string): Promise<T>;
8
+ create<I>(data: I): Promise<T>;
9
+ upsert<I>(conditions: FilterQuery<D>, update: I, options: any): Promise<T>;
10
+ update<I>(criteria: FilterQuery<D>, update: UpdateQuery<D>, options?: any): Promise<T>;
11
+ delete(criteria: FilterQuery<D>): Promise<boolean>;
12
+ bulkGet(ids: string[], selectedFields?: string): Promise<T[]>;
13
+ bulkCreate<I>(data: I[]): Promise<T[]>;
14
+ bulkDelete(criteria: FilterQuery<D>): Promise<number>;
15
+ }
@@ -0,0 +1,19 @@
1
+ import { FilterQuery, Document } from 'mongoose';
2
+ import { GetAllArgs } from './get-all-args';
3
+ export interface IBaseService<T, C = Omit<T, 'id'>, U = C> {
4
+ count(conditions?: FilterQuery<Document<T>>): Promise<number>;
5
+ get(id: string): Promise<T>;
6
+ getAll(options?: GetAllArgs<Document<T>>): Promise<T[]>;
7
+ getByIds(ids: string[]): Promise<T[]>;
8
+ create(data: C): Promise<T>;
9
+ insert(data: (C | U) & {
10
+ id?: string;
11
+ }, overwrite?: boolean): Promise<T>;
12
+ bulkCreate(data: C[]): Promise<T[]>;
13
+ update(id: string, data: Partial<U>, overwrite?: boolean): Promise<T>;
14
+ delete(id: string): Promise<boolean>;
15
+ getAllWithCount(options: GetAllArgs<Document<T>>): Promise<{
16
+ data: T[];
17
+ totalCount: number;
18
+ }>;
19
+ }
@@ -0,0 +1,16 @@
1
+ import { FilterQuery } from 'mongoose';
2
+ export declare type ISort = {
3
+ key: string;
4
+ value: ISortEnum;
5
+ };
6
+ export declare enum ISortEnum {
7
+ ASC = "ASC",
8
+ DESC = "DESC"
9
+ }
10
+ export interface GetAllArgs<T> {
11
+ criteria?: FilterQuery<T>;
12
+ sort?: ISort;
13
+ skip?: number;
14
+ limit?: number;
15
+ selectedFields?: string;
16
+ }
@@ -1 +1,4 @@
1
1
  export * from './mongoose-settings';
2
+ export * from './get-all-args';
3
+ export * from './base-repository';
4
+ export * from './base-service';
@@ -0,0 +1,22 @@
1
+ import { Document, FilterQuery } from 'mongoose';
2
+ import { GetAllArgs, IBaseRepository, IBaseService } from '../interfaces';
3
+ export declare class BaseService<T, C = Omit<T, 'id'>, U = C> implements IBaseService<T, C, U> {
4
+ protected repository: IBaseRepository<T>;
5
+ constructor(repository: IBaseRepository<T>);
6
+ getAllWithCount(options: GetAllArgs<Document<T>>): Promise<{
7
+ data: T[];
8
+ totalCount: number;
9
+ }>;
10
+ count(conditions?: FilterQuery<Document<T>>): Promise<number>;
11
+ get(id: string): Promise<T>;
12
+ getName(name: string): Promise<T>;
13
+ getAll(options: GetAllArgs<Document<T>>): Promise<T[]>;
14
+ getByIds(ids: string[]): Promise<T[]>;
15
+ create(data: C): Promise<T>;
16
+ bulkCreate(data: C[]): Promise<T[]>;
17
+ update(id: string, data: Partial<U>, overwrite?: boolean): Promise<T>;
18
+ insert(data: (C | U) & {
19
+ id?: string;
20
+ }, overwrite?: boolean): Promise<T>;
21
+ delete(id: string): Promise<boolean>;
22
+ }
@@ -0,0 +1 @@
1
+ export * from './base-service';
@@ -0,0 +1,2 @@
1
+ export * from './models';
2
+ export * from './repositories';
@@ -0,0 +1,13 @@
1
+ import { Schema } from 'mongoose';
2
+ export declare const commonModeSchemaOptions: {
3
+ timestamps: boolean;
4
+ toJSON: {
5
+ virtuals: boolean;
6
+ };
7
+ toObject: {
8
+ virtuals: boolean;
9
+ getters: boolean;
10
+ transform(doc: any, ret: any): void;
11
+ };
12
+ };
13
+ export declare const addIdVirtualFields: (schema: Schema) => Schema<import("mongoose").Document<any, any, any>, import("mongoose").Model<import("mongoose").Document<any, any, any>, any, any>, undefined, {}>;
@@ -0,0 +1 @@
1
+ export * from './common-options';
@@ -0,0 +1,22 @@
1
+ import { logger as Logger } from '@cdm-logger/server';
2
+ import { Connection, Document, FilterQuery, Model, UpdateQuery } from 'mongoose';
3
+ import { GetAllArgs, IBaseRepository, IMongoOptions } from '../../interfaces';
4
+ export declare class BaseRepository<T, D = Document<T>> implements IBaseRepository<T, D> {
5
+ private modelFunc;
6
+ private options;
7
+ protected logger: typeof Logger;
8
+ model: Model<D>;
9
+ constructor(modelFunc: (db: Connection) => Model<D>, db: Connection, logger: typeof Logger, options?: IMongoOptions);
10
+ getAll(options: GetAllArgs<D>): Promise<T[]>;
11
+ private mapConditions;
12
+ count(conditions?: FilterQuery<D>): Promise<number>;
13
+ get(conditions?: FilterQuery<D>, selectedFields?: string): Promise<T>;
14
+ bulkGet(ids: string[]): Promise<T[]>;
15
+ find(conditions: Partial<FilterQuery<D>>, selectedFields?: string): Promise<T>;
16
+ create<I>(data: I): Promise<T>;
17
+ bulkCreate<I>(data: I[]): Promise<T[]>;
18
+ upsert<I>(conditions: FilterQuery<D>, update: I, options?: Record<string, unknown>): Promise<T>;
19
+ update<I>(criteria: FilterQuery<D>, update: UpdateQuery<D>, options: Record<string, unknown>): Promise<T>;
20
+ delete(criteria: FilterQuery<D>): Promise<boolean>;
21
+ bulkDelete(conditions: FilterQuery<D>): Promise<number>;
22
+ }
@@ -0,0 +1 @@
1
+ export * from './base-repository';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common-stack/store-mongo",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -19,8 +19,10 @@
19
19
  "watch": "npm run build:lib:watch"
20
20
  },
21
21
  "dependencies": {
22
- "@common-stack/core": "^0.1.11",
23
- "sequelize": "^5.21.3"
22
+ "@common-stack/core": "^0.1.11"
23
+ },
24
+ "peerDependencies": {
25
+ "mongoose": ">=5.13.5"
24
26
  },
25
27
  "publishConfig": {
26
28
  "access": "public"
@@ -28,5 +30,5 @@
28
30
  "typescript": {
29
31
  "definition": "lib/index.d.ts"
30
32
  },
31
- "gitHead": "2cd1b1ab35c4e330de4fffbdbe028200e02a4beb"
33
+ "gitHead": "5401856aa2b7ee8ddb1c641eb56ab0ef5303f8c7"
32
34
  }