@smartsoft001/mongo 1.1.91 → 1.2.0

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.
Files changed (43) hide show
  1. package/.eslintrc +13 -0
  2. package/jest.config.ts +27 -0
  3. package/package.json +2 -26
  4. package/project.json +48 -0
  5. package/src/index.ts +3 -0
  6. package/src/lib/mongo.config.ts +10 -0
  7. package/src/lib/mongo.module.ts +28 -0
  8. package/src/lib/mongo.unitofwork.spec.ts +84 -0
  9. package/src/lib/mongo.unitofwork.ts +58 -0
  10. package/src/lib/mongo.utils.spec.ts +54 -0
  11. package/src/lib/mongo.utils.ts +17 -0
  12. package/src/lib/repositories/attachment.repository.spec.ts +249 -0
  13. package/src/lib/repositories/attachment.repository.ts +113 -0
  14. package/src/lib/repositories/interfaces.ts +28 -0
  15. package/src/lib/repositories/item.repository.spec.ts +1269 -0
  16. package/src/lib/repositories/item.repository.ts +582 -0
  17. package/tsconfig.json +13 -0
  18. package/tsconfig.lib.json +11 -0
  19. package/tsconfig.spec.json +20 -0
  20. package/src/index.d.ts +0 -3
  21. package/src/index.js +0 -7
  22. package/src/index.js.map +0 -1
  23. package/src/lib/mongo.config.d.ts +0 -9
  24. package/src/lib/mongo.config.js +0 -7
  25. package/src/lib/mongo.config.js.map +0 -1
  26. package/src/lib/mongo.module.d.ts +0 -5
  27. package/src/lib/mongo.module.js +0 -25
  28. package/src/lib/mongo.module.js.map +0 -1
  29. package/src/lib/mongo.unitofwork.d.ts +0 -12
  30. package/src/lib/mongo.unitofwork.js +0 -56
  31. package/src/lib/mongo.unitofwork.js.map +0 -1
  32. package/src/lib/mongo.utils.d.ts +0 -2
  33. package/src/lib/mongo.utils.js +0 -13
  34. package/src/lib/mongo.utils.js.map +0 -1
  35. package/src/lib/repositories/attachment.repository.d.ts +0 -28
  36. package/src/lib/repositories/attachment.repository.js +0 -88
  37. package/src/lib/repositories/attachment.repository.js.map +0 -1
  38. package/src/lib/repositories/item.repository.d.ts +0 -51
  39. package/src/lib/repositories/item.repository.js +0 -411
  40. package/src/lib/repositories/item.repository.js.map +0 -1
  41. package/test-setup.js +0 -1
  42. package/test-setup.js.map +0 -1
  43. /package/{test-setup.d.ts → test-setup.ts} +0 -0
@@ -0,0 +1,582 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import {
3
+ ChangeStream,
4
+ Collection,
5
+ Condition,
6
+ Db,
7
+ MongoClient,
8
+ ObjectId,
9
+ } from 'mongodb';
10
+ import { Observable, Observer } from 'rxjs';
11
+ import { finalize, share } from 'rxjs/operators';
12
+
13
+ import {
14
+ IEntity,
15
+ IItemRepository,
16
+ IItemRepositoryOptions,
17
+ ISpecification,
18
+ } from '@smartsoft001/domain-core';
19
+ import { getModelFieldsWithOptions } from '@smartsoft001/models';
20
+ import { MongoConfig } from '@smartsoft001/mongo';
21
+ import { IUser } from '@smartsoft001/users';
22
+ import { ObjectService } from '@smartsoft001/utils';
23
+
24
+ import { IMongoTransaction } from '../mongo.unitofwork';
25
+ import { getMongoUrl } from '../mongo.utils';
26
+ import { ItemChangedData } from './interfaces';
27
+
28
+ @Injectable()
29
+ export class MongoItemRepository<
30
+ T extends IEntity<string>,
31
+ > extends IItemRepository<T> {
32
+ constructor(protected config: MongoConfig) {
33
+ super();
34
+ }
35
+
36
+ async create(
37
+ item: T,
38
+ user: IUser,
39
+ repoOptions?: IItemRepositoryOptions,
40
+ ): Promise<void> {
41
+ await this.collectionContext(async (collection) => {
42
+ try {
43
+ await collection.insertOne(this.getModelToCreate(item as T, user), {
44
+ session: (repoOptions?.transaction as IMongoTransaction)?.session,
45
+ });
46
+ this.logChange('create', item, repoOptions, user, null).then();
47
+ } catch (errInsert) {
48
+ this.logChange('create', item, repoOptions, user, errInsert).then();
49
+ throw errInsert;
50
+ }
51
+ });
52
+ }
53
+
54
+ async clear(
55
+ user: IUser,
56
+ repoOptions?: IItemRepositoryOptions,
57
+ ): Promise<void> {
58
+ await this.collectionContext(async (collection) => {
59
+ try {
60
+ await collection.deleteMany(
61
+ {},
62
+ { session: (repoOptions?.transaction as IMongoTransaction)?.session },
63
+ );
64
+ this.logChange('clear', null, repoOptions, user, null).then();
65
+ } catch (errClear) {
66
+ this.logChange('clear', null, repoOptions, user, errClear).then();
67
+ throw errClear;
68
+ }
69
+ });
70
+ }
71
+
72
+ async createMany(
73
+ list: T[],
74
+ user: IUser,
75
+ repoOptions?: IItemRepositoryOptions,
76
+ ): Promise<void> {
77
+ await this.collectionContext(async (collection) => {
78
+ try {
79
+ await collection.insertMany(
80
+ list.map((item) => this.getModelToCreate(item as T, user)),
81
+ { session: (repoOptions?.transaction as IMongoTransaction)?.session },
82
+ );
83
+ this.logChange('createMany', null, repoOptions, user, null).then();
84
+ } catch (errInsert) {
85
+ this.logChange('createMany', null, repoOptions, user, errInsert).then();
86
+ throw errInsert;
87
+ }
88
+ });
89
+ }
90
+
91
+ async update(
92
+ item: T,
93
+ user: IUser,
94
+ repoOptions?: IItemRepositoryOptions,
95
+ ): Promise<void> {
96
+ await this.collectionContext(async (collection) => {
97
+ try {
98
+ const info = await this.getInfo(item.id, collection);
99
+
100
+ await collection.replaceOne(
101
+ { _id: item.id as any },
102
+ this.getModelToUpdate(item as T, user, info),
103
+ { session: (repoOptions?.transaction as IMongoTransaction)?.session },
104
+ );
105
+ this.logChange('update', item, repoOptions, user, null).then();
106
+ } catch (errInsert) {
107
+ this.logChange('update', item, repoOptions, user, errInsert).then();
108
+ throw errInsert;
109
+ }
110
+ });
111
+ }
112
+
113
+ async updatePartial(
114
+ item: Partial<T> & { id: string },
115
+ user: IUser,
116
+ repoOptions?: IItemRepositoryOptions,
117
+ ): Promise<void> {
118
+ await this.collectionContext(async (collection) => {
119
+ try {
120
+ const info = await this.getInfo(item.id, collection);
121
+
122
+ await collection.updateOne(
123
+ { _id: item.id as unknown as Condition<ObjectId> },
124
+ {
125
+ $set: this.getModelToUpdate(item as T, user, info),
126
+ },
127
+ { session: (repoOptions?.transaction as IMongoTransaction)?.session },
128
+ );
129
+ this.logChange('updatePartial', item, repoOptions, user, null).then();
130
+ } catch (errUpdate) {
131
+ this.logChange(
132
+ 'updatePartial',
133
+ item,
134
+ repoOptions,
135
+ user,
136
+ errUpdate,
137
+ ).then();
138
+ throw errUpdate;
139
+ }
140
+ });
141
+ }
142
+
143
+ async updatePartialManyByCriteria(
144
+ criteria: any,
145
+ set: Partial<T>,
146
+ user: IUser,
147
+ repoOptions?: IItemRepositoryOptions,
148
+ ): Promise<void> {
149
+ await this.collectionContext(async (collection) => {
150
+ try {
151
+ this.convertIdInCriteria(criteria);
152
+
153
+ await collection.updateMany(
154
+ criteria,
155
+ {
156
+ $set: {
157
+ ...set,
158
+ '__info.update': {
159
+ username: user?.username,
160
+ date: new Date(),
161
+ },
162
+ },
163
+ },
164
+ { session: (repoOptions?.transaction as IMongoTransaction)?.session },
165
+ );
166
+ this.logChange(
167
+ 'updatePartialManyByCriteria',
168
+ {
169
+ ...criteria,
170
+ set,
171
+ },
172
+ repoOptions,
173
+ user,
174
+ null,
175
+ ).then();
176
+ } catch (errUpdate) {
177
+ this.logChange(
178
+ 'updatePartialManyByCriteria',
179
+ {
180
+ ...criteria,
181
+ set,
182
+ },
183
+ repoOptions,
184
+ user,
185
+ errUpdate,
186
+ ).then();
187
+ throw errUpdate;
188
+ }
189
+ });
190
+ }
191
+
192
+ updatePartialManyBySpecification(
193
+ spec: ISpecification,
194
+ set: Partial<T>,
195
+ user: IUser,
196
+ repoOptions?: IItemRepositoryOptions,
197
+ ): Promise<void> {
198
+ return this.updatePartialManyByCriteria(
199
+ spec.criteria,
200
+ set,
201
+ user,
202
+ repoOptions,
203
+ );
204
+ }
205
+
206
+ async delete(
207
+ id: string,
208
+ user: IUser,
209
+ repoOptions?: IItemRepositoryOptions,
210
+ ): Promise<void> {
211
+ await this.collectionContext(async (collection) => {
212
+ try {
213
+ await collection.deleteOne(
214
+ { _id: id as any },
215
+ { session: (repoOptions?.transaction as IMongoTransaction)?.session },
216
+ );
217
+ this.logChange(
218
+ 'delete',
219
+ {
220
+ id,
221
+ },
222
+ repoOptions,
223
+ user,
224
+ null,
225
+ ).then();
226
+ } catch (errDelete) {
227
+ this.logChange(
228
+ 'delete',
229
+ {
230
+ id,
231
+ },
232
+ repoOptions,
233
+ user,
234
+ errDelete,
235
+ ).then();
236
+ throw errDelete;
237
+ }
238
+ });
239
+ }
240
+
241
+ async getById(id: string, repoOptions?: IItemRepositoryOptions): Promise<T> {
242
+ return await this.collectionContext<T>(async (collection) => {
243
+ const item = await collection.findOne<T>(
244
+ { _id: id as any },
245
+ {
246
+ session: (repoOptions?.transaction as IMongoTransaction)?.session,
247
+ },
248
+ );
249
+
250
+ return this.getModelToResult(item);
251
+ });
252
+ }
253
+
254
+ async getByCriteria(
255
+ criteria: any,
256
+ options: any = {},
257
+ ): Promise<{ data: T[]; totalCount: number }> {
258
+ return await this.collectionContext<T>(async (collection) => {
259
+ this.convertIdInCriteria(criteria);
260
+ this.generateSearch(criteria);
261
+
262
+ const totalCount = await this.getCount(criteria, collection);
263
+
264
+ const aggregate = [];
265
+
266
+ if (criteria) {
267
+ aggregate.push({ $match: criteria });
268
+ }
269
+
270
+ if (options?.sort) {
271
+ aggregate.push({ $sort: options.sort });
272
+ }
273
+
274
+ if (options?.skip) {
275
+ aggregate.push({ $skip: options.skip });
276
+ }
277
+
278
+ if (options?.limit) {
279
+ aggregate.push({ $limit: options.limit });
280
+ }
281
+
282
+ if (options?.project) {
283
+ aggregate.push({ $project: options.project });
284
+ }
285
+
286
+ if (options?.min) {
287
+ aggregate.push({ $min: options.min });
288
+ }
289
+
290
+ if (options?.max) {
291
+ aggregate.push({ $max: options.max });
292
+ }
293
+
294
+ if (options?.group) {
295
+ aggregate.push({ $group: options.group });
296
+ }
297
+
298
+ const list = await collection
299
+ .aggregate<T>(aggregate, {
300
+ allowDiskUse: options?.allowDiskUse,
301
+ session: options?.session,
302
+ })
303
+ .toArray();
304
+
305
+ return {
306
+ data: list.map((item) => this.getModelToResult(item)),
307
+ totalCount,
308
+ };
309
+ });
310
+ }
311
+
312
+ getBySpecification(
313
+ spec: ISpecification,
314
+ options: any = {},
315
+ ): Promise<{ data: T[]; totalCount: number }> {
316
+ return this.getByCriteria(spec.criteria, options);
317
+ }
318
+
319
+ async countByCriteria(criteria: any): Promise<number> {
320
+ return await this.collectionContext<number>(async (collection) => {
321
+ this.convertIdInCriteria(criteria);
322
+ this.generateSearch(criteria);
323
+
324
+ return await this.getCount(criteria, collection);
325
+ });
326
+ }
327
+
328
+ countBySpecification(spec: ISpecification): Promise<number> {
329
+ return this.countByCriteria(spec.criteria);
330
+ }
331
+
332
+ changesByCriteria(criteria: { id?: string }): Observable<ItemChangedData> {
333
+ let stream: ChangeStream<any>;
334
+ let client: MongoClient;
335
+
336
+ return new Observable((observer: Observer<ItemChangedData>) => {
337
+ (async () => {
338
+ try {
339
+ client = await MongoClient.connect(this.getUrl());
340
+ const db = client.db(this.config.database);
341
+ const collection = db.collection(this.config.collection);
342
+
343
+ const pipeline = criteria.id
344
+ ? [
345
+ {
346
+ $match: {
347
+ 'documentKey._id': criteria.id,
348
+ },
349
+ },
350
+ ]
351
+ : [];
352
+
353
+ stream = collection.watch(pipeline).on('change', (result) => {
354
+ observer.next({
355
+ id: result['documentKey']['_id'],
356
+ type: this.mapChangeType(result.operationType),
357
+ data:
358
+ result.operationType === 'update'
359
+ ? result['updateDescription']
360
+ : this.getModelToResult(result['fullDocument']),
361
+ } as any);
362
+ });
363
+ } catch (err) {
364
+ observer.error(err);
365
+ }
366
+ })();
367
+ }).pipe(
368
+ finalize(async () => {
369
+ console.log('Stop watch');
370
+
371
+ await stream.close();
372
+ await client.close();
373
+ }),
374
+ share(),
375
+ );
376
+ }
377
+
378
+ protected async getContext<TResult>(
379
+ handler: (db: Db) => Promise<TResult>,
380
+ ): Promise<TResult> {
381
+ const client = await MongoClient.connect(this.getUrl());
382
+
383
+ const db = client.db(this.config.database);
384
+
385
+ try {
386
+ const result = await handler(db);
387
+ await client.close();
388
+ return result;
389
+ } catch (e) {
390
+ await client.close();
391
+ throw e;
392
+ }
393
+ }
394
+
395
+ protected async getCount(criteria: any, collection: any): Promise<any> {
396
+ this.convertIdInCriteria(criteria);
397
+ return await collection.countDocuments(criteria);
398
+ }
399
+
400
+ protected async getInfo(
401
+ id: string,
402
+ collection: Collection<any>,
403
+ ): Promise<any> {
404
+ const array = await collection
405
+ .aggregate([{ $match: { _id: id } }, { $project: { __info: 1 } }])
406
+ .toArray();
407
+
408
+ return array[0] ? array[0]['__info'] : {};
409
+ }
410
+
411
+ protected getModelToCreate(item: T, user: IUser): T {
412
+ const result = ObjectService.removeTypes(item);
413
+ result['_id'] = result.id;
414
+ delete result.id;
415
+
416
+ result['__info'] = {
417
+ create: {
418
+ username: user ? user.username : null,
419
+ date: new Date(),
420
+ },
421
+ };
422
+
423
+ return result;
424
+ }
425
+
426
+ protected mapChangeType(dbType: string) {
427
+ const map = {
428
+ insert: 'create',
429
+ update: 'update',
430
+ delete: 'delete',
431
+ };
432
+
433
+ return map[dbType];
434
+ }
435
+
436
+ protected getModelToUpdate(
437
+ item: { id: string },
438
+ user: IUser,
439
+ info: any,
440
+ ): { id: string } {
441
+ const result = ObjectService.removeTypes(item);
442
+ result['_id'] = result.id;
443
+ delete result.id;
444
+
445
+ result['__info'] = {
446
+ ...info,
447
+ update: {
448
+ username: user ? user.username : null,
449
+ date: new Date(),
450
+ },
451
+ };
452
+
453
+ return result;
454
+ }
455
+
456
+ protected getModelToResult(item: T): T {
457
+ if (!item) return null;
458
+
459
+ const result = ObjectService.removeTypes(item) as any;
460
+ result['id'] = result._id;
461
+
462
+ delete result._id;
463
+ delete result['__info'];
464
+
465
+ return result as T;
466
+ }
467
+
468
+ protected getUrl(): string {
469
+ return getMongoUrl(this.config);
470
+ }
471
+
472
+ protected async logChange(
473
+ type: any,
474
+ item: any,
475
+ options: any,
476
+ user: any,
477
+ error: any,
478
+ ) {
479
+ const client = await MongoClient.connect(this.getUrl());
480
+
481
+ const db = client.db(this.config.database);
482
+
483
+ try {
484
+ await db.collection('changes').insertOne({
485
+ type,
486
+ collection: this.config.collection,
487
+ item,
488
+ options,
489
+ user,
490
+ error,
491
+ date: new Date(),
492
+ });
493
+ } catch (e) {
494
+ console.warn(e);
495
+ } finally {
496
+ await client.close();
497
+ }
498
+ }
499
+
500
+ protected generateSearch(criteria: any): void {
501
+ if (!criteria['$search']) return;
502
+
503
+ if (this.config.type) {
504
+ const modelFields = getModelFieldsWithOptions(
505
+ new this.config.type(),
506
+ ).filter((i) => i.options.search);
507
+
508
+ if (modelFields.length) {
509
+ const searchArray = [];
510
+
511
+ modelFields.forEach((val) => {
512
+ const res = {};
513
+
514
+ res[val.key] = {
515
+ $regex: this.convertRegex(criteria['$search']),
516
+ $options: 'i',
517
+ };
518
+
519
+ searchArray.push(res);
520
+ });
521
+
522
+ if (!criteria['$or']) criteria['$or'] = searchArray;
523
+ else if (criteria['$or'] && !criteria['$and']) {
524
+ criteria['$and'] = [{ $or: criteria['$or'] }, { $or: searchArray }];
525
+
526
+ delete criteria['$or'];
527
+ } else if (criteria['$and']) {
528
+ criteria['$and'] = [...criteria['$and'], { $or: searchArray }];
529
+ }
530
+
531
+ delete criteria['$search'];
532
+
533
+ return;
534
+ }
535
+ }
536
+
537
+ const customCriteria = {
538
+ $text: { $search: ' "' + this.convertRegex(criteria['$search']) + '" ' },
539
+ };
540
+
541
+ delete criteria['$search'];
542
+
543
+ criteria = {
544
+ ...criteria,
545
+ ...customCriteria,
546
+ };
547
+ }
548
+
549
+ protected convertIdInCriteria(criteria: any) {
550
+ if (criteria['id']) {
551
+ criteria['_id'] = criteria['id'];
552
+ delete criteria['id'];
553
+ }
554
+ }
555
+
556
+ protected convertRegex(val: string): string {
557
+ return val.toString().replace(/\*/g, '[*]');
558
+ }
559
+
560
+ protected async collectionContext<T>(
561
+ callback: (collection: Collection) => Promise<any>,
562
+ repoOptions?: IItemRepositoryOptions,
563
+ ): Promise<any> {
564
+ const client: MongoClient = (repoOptions?.transaction as IMongoTransaction)
565
+ ?.connection
566
+ ? (repoOptions.transaction as IMongoTransaction).connection
567
+ : await MongoClient.connect(this.getUrl());
568
+
569
+ const db = client.db(this.config.database);
570
+
571
+ let result: T;
572
+
573
+ try {
574
+ result = await callback(db.collection(this.config.collection));
575
+ } finally {
576
+ if (!(repoOptions?.transaction as IMongoTransaction))
577
+ await client.close();
578
+ }
579
+
580
+ return result;
581
+ }
582
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "../../../tsconfig.base.json",
3
+ "files": [],
4
+ "include": [],
5
+ "references": [
6
+ {
7
+ "path": "./tsconfig.lib.json"
8
+ },
9
+ {
10
+ "path": "./tsconfig.spec.json"
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "outDir": "../../../dist/out-tsc",
6
+ "declaration": true,
7
+ "types": ["node"]
8
+ },
9
+ "exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"],
10
+ "include": ["**/*.ts"]
11
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["jest", "node"]
7
+ },
8
+ "include": [
9
+ "**/*.spec.ts",
10
+ "**/*.test.ts",
11
+ "**/*.spec.tsx",
12
+ "**/*.test.tsx",
13
+ "**/*.spec.js",
14
+ "**/*.test.js",
15
+ "**/*.spec.jsx",
16
+ "**/*.test.jsx",
17
+ "**/*.d.ts",
18
+ "jest.config.ts"
19
+ ]
20
+ }
package/src/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./lib/mongo.module";
2
- export * from "./lib/repositories/item.repository";
3
- export * from "./lib/mongo.config";
package/src/index.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./lib/mongo.module"), exports);
5
- tslib_1.__exportStar(require("./lib/repositories/item.repository"), exports);
6
- tslib_1.__exportStar(require("./lib/mongo.config"), exports);
7
- //# sourceMappingURL=index.js.map
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/shared/mongo/src/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,6EAAmD;AACnD,6DAAmC"}
@@ -1,9 +0,0 @@
1
- export declare class MongoConfig {
2
- host: string;
3
- port: number;
4
- database: string;
5
- username?: string;
6
- password?: string;
7
- collection?: string;
8
- type?: any;
9
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MongoConfig = void 0;
4
- class MongoConfig {
5
- }
6
- exports.MongoConfig = MongoConfig;
7
- //# sourceMappingURL=mongo.config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mongo.config.js","sourceRoot":"","sources":["../../../../../../libs/shared/mongo/src/lib/mongo.config.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;CAQvB;AARD,kCAQC"}
@@ -1,5 +0,0 @@
1
- import { DynamicModule } from "@nestjs/common";
2
- import { MongoConfig } from "./mongo.config";
3
- export declare class MongoModule {
4
- static forRoot(config: MongoConfig): DynamicModule;
5
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MongoModule = void 0;
4
- const domain_core_1 = require("@smartsoft001/domain-core");
5
- const mongo_config_1 = require("./mongo.config");
6
- const item_repository_1 = require("./repositories/item.repository");
7
- const mongo_unitofwork_1 = require("./mongo.unitofwork");
8
- const attachment_repository_1 = require("./repositories/attachment.repository");
9
- class MongoModule {
10
- static forRoot(config) {
11
- const providers = [
12
- { provide: mongo_config_1.MongoConfig, useValue: config },
13
- { provide: domain_core_1.IItemRepository, useClass: item_repository_1.MongoItemRepository },
14
- { provide: domain_core_1.IAttachmentRepository, useClass: attachment_repository_1.MongoAttachmentRepository },
15
- { provide: domain_core_1.IUnitOfWork, useClass: mongo_unitofwork_1.MongoUnitOfWork }
16
- ];
17
- return {
18
- module: MongoModule,
19
- providers: providers,
20
- exports: providers
21
- };
22
- }
23
- }
24
- exports.MongoModule = MongoModule;
25
- //# sourceMappingURL=mongo.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mongo.module.js","sourceRoot":"","sources":["../../../../../../libs/shared/mongo/src/lib/mongo.module.ts"],"names":[],"mappings":";;;AAEA,2DAA8F;AAE9F,iDAA2C;AAC3C,oEAAmE;AACnE,yDAAmD;AACnD,gFAA+E;AAE/E,MAAa,WAAW;IACpB,MAAM,CAAC,OAAO,CAAC,MAAmB;QAC9B,MAAM,SAAS,GAAG;YACd,EAAE,OAAO,EAAE,0BAAW,EAAE,QAAQ,EAAE,MAAM,EAAE;YAC1C,EAAE,OAAO,EAAE,6BAAe,EAAE,QAAQ,EAAE,qCAAmB,EAAE;YAC3D,EAAE,OAAO,EAAE,mCAAqB,EAAE,QAAQ,EAAE,iDAAyB,EAAE;YACvE,EAAE,OAAO,EAAE,yBAAW,EAAE,QAAQ,EAAE,kCAAe,EAAE;SACtD,CAAC;QAEF,OAAO;YACH,MAAM,EAAE,WAAW;YACnB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,SAAS;SACrB,CAAC;IACN,CAAC;CACJ;AAfD,kCAeC"}