@common-stack/store-mongo 0.1.13 → 0.2.1

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/README.md CHANGED
@@ -4,6 +4,6 @@
4
4
 
5
5
  `npm link`
6
6
  `npm link @xtermstack/xterm-core`
7
- `npm install`
7
+ `yarn install`
8
8
  `tsc`
9
- `npm run test`
9
+ `yarn test`
package/lib/index.js CHANGED
@@ -122,7 +122,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
122
122
  o[k2] = m[k];
123
123
  }));
124
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);
125
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
126
126
  };
127
127
  Object.defineProperty(exports, "__esModule", { value: true });
128
128
  __exportStar(__webpack_require__(/*! ./default-options */ "./src/constants/default-options.ts"), exports);
@@ -186,7 +186,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
186
186
  o[k2] = m[k];
187
187
  }));
188
188
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
189
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
189
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
190
190
  };
191
191
  Object.defineProperty(exports, "__esModule", { value: true });
192
192
  __exportStar(__webpack_require__(/*! ./bulk-dataloader */ "./src/dataloaders/bulk-dataloader.ts"), exports);
@@ -211,7 +211,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
211
211
  o[k2] = m[k];
212
212
  }));
213
213
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
214
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
214
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
215
215
  };
216
216
  Object.defineProperty(exports, "__esModule", { value: true });
217
217
  __exportStar(__webpack_require__(/*! ./mongoose-connection */ "./src/helpers/mongoose-connection.ts"), exports);
@@ -270,7 +270,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
270
270
  o[k2] = m[k];
271
271
  }));
272
272
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
273
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
273
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
274
274
  };
275
275
  Object.defineProperty(exports, "__esModule", { value: true });
276
276
  __exportStar(__webpack_require__(/*! ./interfaces */ "./src/interfaces/index.ts"), exports);
@@ -361,7 +361,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
361
361
  o[k2] = m[k];
362
362
  }));
363
363
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
364
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
364
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
365
365
  };
366
366
  Object.defineProperty(exports, "__esModule", { value: true });
367
367
  __exportStar(__webpack_require__(/*! ./mongoose-settings */ "./src/interfaces/mongoose-settings.ts"), exports);
@@ -492,7 +492,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
492
492
  o[k2] = m[k];
493
493
  }));
494
494
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
495
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
495
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
496
496
  };
497
497
  Object.defineProperty(exports, "__esModule", { value: true });
498
498
  __exportStar(__webpack_require__(/*! ./base-service */ "./src/services/base-service.ts"), exports);
@@ -517,7 +517,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
517
517
  o[k2] = m[k];
518
518
  }));
519
519
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
520
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
520
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
521
521
  };
522
522
  Object.defineProperty(exports, "__esModule", { value: true });
523
523
  __exportStar(__webpack_require__(/*! ./models */ "./src/store/models/index.ts"), exports);
@@ -551,12 +551,13 @@ exports.commonModeSchemaOptions = {
551
551
  },
552
552
  },
553
553
  };
554
- exports.addIdVirtualFields = (schema) => {
554
+ const addIdVirtualFields = (schema) => {
555
555
  schema.set('toJSON', {
556
556
  virtuals: true,
557
557
  });
558
558
  return schema;
559
559
  };
560
+ exports.addIdVirtualFields = addIdVirtualFields;
560
561
 
561
562
 
562
563
  /***/ }),
@@ -578,7 +579,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
578
579
  o[k2] = m[k];
579
580
  }));
580
581
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
581
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
582
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
582
583
  };
583
584
  Object.defineProperty(exports, "__esModule", { value: true });
584
585
  __exportStar(__webpack_require__(/*! ./common-options */ "./src/store/models/common-options.ts"), exports);
@@ -785,7 +786,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
785
786
  o[k2] = m[k];
786
787
  }));
787
788
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
788
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
789
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
789
790
  };
790
791
  Object.defineProperty(exports, "__esModule", { value: true });
791
792
  __exportStar(__webpack_require__(/*! ./base-repository */ "./src/store/repositories/base-repository.ts"), exports);
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;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;;AClFa,uBAAe,GAAG;IAC3B,EAAE,EAAE,KAAK;CACZ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;ACFF,0GAAkC;;;;;;;;;;;;;;;;;;;;;;;;;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,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;AArKY,cAAc;IAD1B,sBAAU,EAAE;IASJ,gCAAS,EAAE;IAEX,gCAAS,EAAE;IAEX,gCAAS,EAAE;IAEX,gCAAS,EAAE;GAdP,cAAc,CAqK1B;AArKY,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 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/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;QA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,uBAAR,QAAQ,CAAE,EAAE,EAAE;gBACd,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;aAC7D;iBAAM;gBACH,OAAO,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;AArKY,cAAc;IAD1B,sBAAU,EAAE;IASJ,gCAAS,EAAE;IAEX,gCAAS,EAAE;IAEX,gCAAS,EAAE;IAEX,gCAAS,EAAE;GAdP,cAAc,CAqK1B;AArKY,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 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":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common-stack/store-mongo",
3
- "version": "0.1.13",
3
+ "version": "0.2.1",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -19,7 +19,7 @@
19
19
  "watch": "npm run build:lib:watch"
20
20
  },
21
21
  "dependencies": {
22
- "@common-stack/core": "^0.1.11"
22
+ "@common-stack/core": "^0.2.1"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "dataloader": ">=2.0.0",
@@ -31,5 +31,5 @@
31
31
  "typescript": {
32
32
  "definition": "lib/index.d.ts"
33
33
  },
34
- "gitHead": "22011dd3699304c3d0e77b9d9f8a87ec03a5c9b2"
34
+ "gitHead": "8cc362c6c7307e7ea43a9563ccdcb938c93c6008"
35
35
  }
package/CHANGELOG.md DELETED
@@ -1,184 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [0.1.13](https://github.com/cdmbase/common-stack/compare/v0.1.12...v0.1.13) (2021-12-10)
7
-
8
- **Note:** Version bump only for package @common-stack/store-mongo
9
-
10
-
11
-
12
-
13
-
14
- ## [0.1.12](https://github.com/cdmbase/common-stack/compare/v0.1.11...v0.1.12) (2021-12-10)
15
-
16
- **Note:** Version bump only for package @common-stack/store-mongo
17
-
18
-
19
-
20
-
21
-
22
- ## [0.1.11](https://github.com/cdmbase/common-stack/compare/v0.1.10...v0.1.11) (2021-11-07)
23
-
24
- **Note:** Version bump only for package @common-stack/store-mongo
25
-
26
-
27
-
28
-
29
-
30
- ## [0.1.9](https://github.com/cdmbase/common-stack/compare/v0.1.8...v0.1.9) (2021-10-07)
31
-
32
- **Note:** Version bump only for package @common-stack/store-mongo
33
-
34
-
35
-
36
-
37
-
38
- ## [0.1.7](https://github.com/cdmbase/common-stack/compare/v0.1.6...v0.1.7) (2021-08-11)
39
-
40
- **Note:** Version bump only for package @common-stack/store-mongo
41
-
42
-
43
-
44
-
45
-
46
- ## [0.1.6](https://github.com/cdmbase/common-stack/compare/v0.1.5...v0.1.6) (2021-08-11)
47
-
48
- **Note:** Version bump only for package @common-stack/store-mongo
49
-
50
-
51
-
52
-
53
-
54
- ## [0.1.5](https://github.com/cdmbase/common-stack/compare/v0.1.4...v0.1.5) (2021-08-11)
55
-
56
- **Note:** Version bump only for package @common-stack/store-mongo
57
-
58
-
59
-
60
-
61
-
62
- ## [0.1.4](https://github.com/cdmbase/common-stack/compare/v0.1.3...v0.1.4) (2021-08-11)
63
-
64
- **Note:** Version bump only for package @common-stack/store-mongo
65
-
66
-
67
-
68
-
69
-
70
- ## [0.1.3](https://github.com/cdmbase/common-stack/compare/v0.1.2...v0.1.3) (2021-08-11)
71
-
72
- **Note:** Version bump only for package @common-stack/store-mongo
73
-
74
-
75
-
76
-
77
-
78
- ## [0.1.1](https://github.com/cdmbase/common-stack/compare/v0.0.264...v0.1.1) (2021-08-05)
79
-
80
- **Note:** Version bump only for package @common-stack/store-mongo
81
-
82
-
83
-
84
-
85
-
86
- ## [0.0.264](https://github.com/cdmbase/common-stack/compare/v0.0.263...v0.0.264) (2021-07-04)
87
-
88
- **Note:** Version bump only for package @common-stack/store-mongo
89
-
90
-
91
-
92
-
93
-
94
- ## [0.0.263](https://github.com/cdmbase/common-stack/compare/v0.0.262...v0.0.263) (2021-07-03)
95
-
96
- **Note:** Version bump only for package @common-stack/store-mongo
97
-
98
-
99
-
100
-
101
-
102
- ## [0.0.262](https://github.com/cdmbase/common-stack/compare/v0.0.261...v0.0.262) (2021-06-23)
103
-
104
- **Note:** Version bump only for package @common-stack/store-mongo
105
-
106
-
107
-
108
-
109
-
110
- ## [0.0.261](https://github.com/cdmbase/common-stack/compare/v0.0.260...v0.0.261) (2021-06-01)
111
-
112
- **Note:** Version bump only for package @common-stack/store-mongo
113
-
114
-
115
-
116
-
117
-
118
- ## [0.0.260](https://github.com/cdmbase/common-stack/compare/v0.0.259...v0.0.260) (2021-05-28)
119
-
120
- **Note:** Version bump only for package @common-stack/store-mongo
121
-
122
-
123
-
124
-
125
-
126
- ## [0.0.259](https://github.com/cdmbase/common-stack/compare/v0.0.258...v0.0.259) (2021-05-28)
127
-
128
- **Note:** Version bump only for package @common-stack/store-mongo
129
-
130
-
131
-
132
-
133
-
134
- ## [0.0.258](https://github.com/cdmbase/common-stack/compare/v0.0.257...v0.0.258) (2021-05-14)
135
-
136
- **Note:** Version bump only for package @common-stack/store-mongo
137
-
138
-
139
-
140
-
141
-
142
- ## [0.0.257](https://github.com/cdmbase/common-stack/compare/v0.0.256...v0.0.257) (2021-05-05)
143
-
144
- **Note:** Version bump only for package @common-stack/store-mongo
145
-
146
-
147
-
148
-
149
-
150
- ## [0.0.256](https://github.com/cdmbase/common-stack/compare/v0.0.255...v0.0.256) (2021-05-05)
151
-
152
- **Note:** Version bump only for package @common-stack/store-mongo
153
-
154
-
155
-
156
-
157
-
158
- ## [0.0.255](https://github.com/cdmbase/common-stack/compare/v0.0.254...v0.0.255) (2021-04-03)
159
-
160
- **Note:** Version bump only for package @common-stack/store-mongo
161
-
162
-
163
-
164
-
165
-
166
- ## [0.0.254](https://github.com/cdmbase/common-stack/compare/v0.0.253...v0.0.254) (2021-03-31)
167
-
168
- **Note:** Version bump only for package @common-stack/store-mongo
169
-
170
-
171
-
172
-
173
-
174
- ## [0.0.253](https://github.com/cdmbase/common-stack/compare/v0.0.252...v0.0.253) (2021-03-31)
175
-
176
- **Note:** Version bump only for package @common-stack/store-mongo
177
-
178
-
179
-
180
-
181
-
182
- ## [0.0.252](https://github.com/cdmbase/common-stack/compare/v0.0.251...v0.0.252) (2021-03-29)
183
-
184
- **Note:** Version bump only for package @common-stack/store-mongo