@common-stack/store-mongo 8.0.2-alpha.0 → 8.2.1-alpha.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 (77) hide show
  1. package/LICENSE +34 -21
  2. package/lib/containers/container.d.ts +14 -0
  3. package/lib/containers/container.js +17 -0
  4. package/lib/containers/container.js.map +1 -0
  5. package/lib/containers/index.d.ts +1 -0
  6. package/lib/dataloaders/bulk-dataloader-v2.d.ts +40 -0
  7. package/lib/dataloaders/bulk-dataloader-v2.js +118 -0
  8. package/lib/dataloaders/bulk-dataloader-v2.js.map +1 -0
  9. package/lib/dataloaders/bulk-dataloader-v2.test.d.ts +1 -0
  10. package/lib/dataloaders/bulk-dataloader.d.ts +1 -1
  11. package/lib/dataloaders/bulk-dataloader.js.map +1 -1
  12. package/lib/dataloaders/bulk-dataloader.test.d.ts +1 -0
  13. package/lib/dataloaders/index.d.ts +1 -0
  14. package/lib/graphql/schema/base-services.graphql +238 -0
  15. package/lib/helpers/mongoose-connection.js.map +1 -1
  16. package/lib/index.d.ts +2 -1
  17. package/lib/index.js +1 -1
  18. package/lib/interfaces/base-repository.d.ts +1 -5
  19. package/lib/interfaces/base-service.d.ts +1 -1
  20. package/lib/interfaces/getAllArgs.d.ts +135 -0
  21. package/lib/interfaces/getAllArgs.js +39 -0
  22. package/lib/interfaces/getAllArgs.js.map +1 -0
  23. package/lib/interfaces/index.d.ts +1 -4
  24. package/lib/interfaces/index.old.d.ts +3 -0
  25. package/lib/mixins/BaseServiceMixin.d.ts +45 -0
  26. package/lib/mixins/BaseServiceMixin.js +212 -0
  27. package/lib/mixins/BaseServiceMixin.js.map +1 -0
  28. package/lib/mixins/__tests__/BaseServiceMixin.test.d.ts +1 -0
  29. package/lib/mixins/base-service-mixin.js.map +1 -1
  30. package/lib/mixins/index.d.ts +1 -0
  31. package/lib/module.d.ts +2 -0
  32. package/lib/module.js +4 -0
  33. package/lib/module.js.map +1 -0
  34. package/lib/services/BaseProxyService.d.ts +28 -0
  35. package/lib/services/BaseProxyService.js +52 -0
  36. package/lib/services/BaseProxyService.js.map +1 -0
  37. package/lib/services/BaseService.d.ts +23 -0
  38. package/lib/services/BaseService.js +65 -0
  39. package/lib/services/BaseService.js.map +1 -0
  40. package/lib/services/BaseService.test.d.ts +1 -0
  41. package/lib/services/ConnectionPoolManager.d.ts +54 -0
  42. package/lib/services/ConnectionPoolManager.js +163 -0
  43. package/lib/services/ConnectionPoolManager.js.map +1 -0
  44. package/lib/services/base-proxy-service.d.ts +2 -1
  45. package/lib/services/base-proxy-service.js.map +1 -1
  46. package/lib/services/base-service.d.ts +2 -1
  47. package/lib/services/base-service.js.map +1 -1
  48. package/lib/services/index.d.ts +3 -0
  49. package/lib/store/models/common-options-v2.d.ts +16 -0
  50. package/lib/store/models/common-options-v2.js +40 -0
  51. package/lib/store/models/common-options-v2.js.map +1 -0
  52. package/lib/store/models/common-options.js.map +1 -1
  53. package/lib/store/models/index.d.ts +1 -0
  54. package/lib/store/repositories/BaseMongoRepository.d.ts +72 -0
  55. package/lib/store/repositories/BaseMongoRepository.js +423 -0
  56. package/lib/store/repositories/BaseMongoRepository.js.map +1 -0
  57. package/lib/store/repositories/BaseMongoRepository.test.d.ts +1 -0
  58. package/lib/store/repositories/CustomIdRepository.test.d.ts +1 -0
  59. package/lib/store/repositories/base-repository.d.ts +2 -1
  60. package/lib/store/repositories/base-repository.js +1 -1
  61. package/lib/store/repositories/base-repository.js.map +1 -1
  62. package/lib/store/repositories/index.d.ts +1 -0
  63. package/lib/templates/constants/SERVER_TYPES.ts.template +7 -0
  64. package/lib/templates/repositories/DataLoader.ts.template +211 -0
  65. package/lib/templates/repositories/DatabaseMigration.ts.template +13 -0
  66. package/lib/templates/repositories/IBaseMongoRepository.ts.template +284 -0
  67. package/lib/templates/repositories/IBaseService.ts.template +231 -0
  68. package/lib/templates/repositories/IBaseServiceMixin.ts.template +477 -0
  69. package/lib/templates/repositories/dbCommonTypes.ts.template +140 -0
  70. package/lib/templates/repositories/moleculerEventHandler.ts.template.toberemoved +118 -0
  71. package/lib/templates/repositories/mongoCommonTypes.ts.template +21 -0
  72. package/lib/templates/repositories/typedMoleculerService.ts.template.toberemoved +1188 -0
  73. package/lib/templates/repositories/zodToMoleculer.ts.template.toberemoved +133 -0
  74. package/package.json +21 -4
  75. package/lib/interfaces/base-repository.js +0 -5
  76. package/lib/interfaces/base-repository.js.map +0 -1
  77. package/lib/interfaces/get-all-args.d.ts +0 -9
package/LICENSE CHANGED
@@ -1,21 +1,34 @@
1
- The MIT License
2
-
3
- Copyright (c) 2017 CDMBase LLC.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ PROPRIETARY LICENSE
2
+
3
+ Copyright (c) 2017-2025 CDMBase LLC. All Rights Reserved.
4
+
5
+ This software and associated documentation files (the "Software") are the
6
+ proprietary and confidential information of CDMBase LLC ("Confidential Information").
7
+
8
+ NOTICE: All information contained herein is, and remains the property of
9
+ CDMBase LLC. The intellectual and technical concepts contained herein are
10
+ proprietary to CDMBase LLC and may be covered by U.S. and Foreign Patents,
11
+ patents in process, and are protected by trade secret or copyright law.
12
+
13
+ Dissemination of this information or reproduction of this material is strictly
14
+ forbidden unless prior written permission is obtained from CDMBase LLC.
15
+
16
+ NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL
17
+ PROPERTY RIGHTS ARE GRANTED BY THIS DOCUMENT.
18
+
19
+ RESTRICTIONS:
20
+ 1. You may NOT use, copy, modify, merge, publish, distribute, sublicense,
21
+ and/or sell copies of the Software without explicit written permission
22
+ from CDMBase LLC.
23
+ 2. You may NOT reverse engineer, decompile, or disassemble the Software.
24
+ 3. You may NOT remove or alter any proprietary notices or labels on the Software.
25
+ 4. The Software is licensed, not sold.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
30
+ CDMBASE LLC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
31
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
+
34
+ For licensing inquiries, please contact: legal@cdmbase.com
@@ -0,0 +1,14 @@
1
+ import { interfaces } from 'inversify';
2
+ /**
3
+ * Local services and exposed microservices to serve remote connections.
4
+ * Operates within in the Gateway.
5
+ *
6
+ */
7
+ export declare const localContainerModule: (settings: any) => interfaces.ContainerModule;
8
+ /**
9
+ * Operates external to the Gateway. Usually a broker listen to calls and invoke this service
10
+ * local to the micro container.
11
+ *
12
+ * @param settings Settings
13
+ */
14
+ export declare const externalContainerModule: (settings: any) => interfaces.ContainerModule;
@@ -0,0 +1,17 @@
1
+ import {ContainerModule}from'inversify';import {SERVER_TYPES}from'common/server';import {BaseMongoRepository}from'../store/repositories/BaseMongoRepository.js';import'../store/repositories/base-repository.js';/**
2
+ * Local services and exposed microservices to serve remote connections.
3
+ * Operates within in the Gateway.
4
+ *
5
+ */
6
+ const localContainerModule = () => new ContainerModule((bind) => {
7
+ bind(SERVER_TYPES.BaseMongoRepository).to(BaseMongoRepository).inSingletonScope().whenTargetIsDefault();
8
+ });
9
+ /**
10
+ * Operates external to the Gateway. Usually a broker listen to calls and invoke this service
11
+ * local to the micro container.
12
+ *
13
+ * @param settings Settings
14
+ */
15
+ const externalContainerModule = () => new ContainerModule((bind) => {
16
+ bind(SERVER_TYPES.BaseMongoRepository).to(BaseMongoRepository).inSingletonScope().whenTargetIsDefault();
17
+ });export{externalContainerModule,localContainerModule};//# sourceMappingURL=container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.js","sources":["../../src/containers/container.ts"],"sourcesContent":["import { ContainerModule, interfaces } from 'inversify';\nimport { SERVER_TYPES } from 'common/server';\nimport { BaseMongoRepository } from '../store';\n\n/**\n * Local services and exposed microservices to serve remote connections.\n * Operates within in the Gateway.\n *\n */\nexport const localContainerModule: (settings) => interfaces.ContainerModule = () =>\n new ContainerModule((bind: interfaces.Bind) => {\n bind(SERVER_TYPES.BaseMongoRepository).to(BaseMongoRepository).inSingletonScope().whenTargetIsDefault();\n });\n\n/**\n * Operates external to the Gateway. Usually a broker listen to calls and invoke this service\n * local to the micro container.\n *\n * @param settings Settings\n */\nexport const externalContainerModule: (settings) => interfaces.ContainerModule = () =>\n new ContainerModule((bind: interfaces.Bind) => {\n bind(SERVER_TYPES.BaseMongoRepository).to(BaseMongoRepository).inSingletonScope().whenTargetIsDefault();\n });\n"],"names":[],"mappings":"iNAIA;;;;AAIG;AACI,MAAM,oBAAoB,GAA6C,MAC1E,IAAI,eAAe,CAAC,CAAC,IAAqB,KAAI;AAC1C,IAAA,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,gBAAgB,EAAE,CAAC,mBAAmB,EAAE,CAAC;AAC5G,CAAC,EAAE;AAEP;;;;;AAKG;AACI,MAAM,uBAAuB,GAA6C,MAC7E,IAAI,eAAe,CAAC,CAAC,IAAqB,KAAI;AAC1C,IAAA,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,gBAAgB,EAAE,CAAC,mBAAmB,EAAE,CAAC;AAC5G,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './container';
@@ -0,0 +1,40 @@
1
+ import DataLoader from 'dataloader';
2
+ import { IBaseService, IDataLoader, AsDomainType } from 'common/server';
3
+ /**
4
+ * BulkDataLoader2 with Dual ID System Support
5
+ *
6
+ * Supports both ObjectId and UUID lookups:
7
+ * - ObjectId: MongoDB's native `_id` field
8
+ * - UUID: External identifier stored as `<collection>Id` (e.g., projectId, organizationId)
9
+ *
10
+ * The loader automatically detects the ID format and queries appropriately:
11
+ * - UUIDs contain hyphens (e.g., "550e8400-e29b-41d4-a957-446655440000")
12
+ * - ObjectIds are 24-character hex strings (e.g., "507f1f77bcf86cd799439011")
13
+ */
14
+ export declare class BulkDataLoader2<SchemaType> extends DataLoader<string, AsDomainType<SchemaType> | null> implements IDataLoader<SchemaType> {
15
+ private readonly service;
16
+ /**
17
+ * Optional UUID field name for this collection (e.g., 'projectId', 'organizationId')
18
+ * If not provided, the loader will only support ObjectId lookups
19
+ */
20
+ private readonly uuidFieldName?;
21
+ constructor(service: IBaseService<SchemaType>, uuidFieldName?: string);
22
+ /**
23
+ * Detects if an ID is a UUID (contains hyphens) or ObjectId (24-char hex)
24
+ */
25
+ private isUUID;
26
+ /**
27
+ * Detects if an ID is a valid ObjectId
28
+ */
29
+ private isObjectId;
30
+ /**
31
+ * Loads records by IDs, supporting both UUID and ObjectId formats
32
+ * Performs a single query with $or conditions for efficient lookup
33
+ */
34
+ private loadByIds;
35
+ /**
36
+ * Finds a record by ID, checking both ObjectId and UUID fields
37
+ */
38
+ private findRecordById;
39
+ withOptions: DataLoader<DataLoaderOptions<SchemaType>, AsDomainType<SchemaType>[], DataLoaderOptions<SchemaType>>;
40
+ }
@@ -0,0 +1,118 @@
1
+ import {__decorate,__param,__metadata}from'tslib';import DataLoader from'dataloader';import {injectable,unmanaged}from'inversify';import {Types}from'mongoose';import {IBaseService}from'common/server';var _a;
2
+ /**
3
+ * BulkDataLoader2 with Dual ID System Support
4
+ *
5
+ * Supports both ObjectId and UUID lookups:
6
+ * - ObjectId: MongoDB's native `_id` field
7
+ * - UUID: External identifier stored as `<collection>Id` (e.g., projectId, organizationId)
8
+ *
9
+ * The loader automatically detects the ID format and queries appropriately:
10
+ * - UUIDs contain hyphens (e.g., "550e8400-e29b-41d4-a957-446655440000")
11
+ * - ObjectIds are 24-character hex strings (e.g., "507f1f77bcf86cd799439011")
12
+ */
13
+ let BulkDataLoader2 = class BulkDataLoader2 extends DataLoader {
14
+ service;
15
+ /**
16
+ * Optional UUID field name for this collection (e.g., 'projectId', 'organizationId')
17
+ * If not provided, the loader will only support ObjectId lookups
18
+ */
19
+ uuidFieldName;
20
+ constructor(service, uuidFieldName) {
21
+ super(async (ids) => {
22
+ const data = await this.loadByIds(ids);
23
+ return ids.map((id) => this.findRecordById(data, id));
24
+ });
25
+ this.service = service;
26
+ this.uuidFieldName = uuidFieldName;
27
+ }
28
+ /**
29
+ * Detects if an ID is a UUID (contains hyphens) or ObjectId (24-char hex)
30
+ */
31
+ isUUID(id) {
32
+ return id.includes('-');
33
+ }
34
+ /**
35
+ * Detects if an ID is a valid ObjectId
36
+ */
37
+ isObjectId(id) {
38
+ return Types.ObjectId.isValid(id) && !this.isUUID(id);
39
+ }
40
+ /**
41
+ * Loads records by IDs, supporting both UUID and ObjectId formats
42
+ * Performs a single query with $or conditions for efficient lookup
43
+ */
44
+ async loadByIds(ids) {
45
+ // Separate UUIDs and ObjectIds for optimized querying
46
+ const uuidIds = [];
47
+ const objectIds = [];
48
+ ids.forEach((id) => {
49
+ if (this.isUUID(id)) {
50
+ uuidIds.push(id);
51
+ }
52
+ else if (this.isObjectId(id)) {
53
+ objectIds.push(id);
54
+ }
55
+ });
56
+ // If no UUID field is configured, only support ObjectId lookups
57
+ if (!this.uuidFieldName && uuidIds.length > 0) {
58
+ console.warn(`[BulkDataLoader2] UUID IDs detected but no uuidFieldName configured. UUIDs will not be resolved: ${uuidIds.join(', ')}`);
59
+ }
60
+ // Build query criteria using $or for mixed ID types
61
+ const criteria = [];
62
+ if (objectIds.length > 0) {
63
+ // Query by _id (ObjectId)
64
+ criteria.push({ _id: { $in: objectIds } });
65
+ }
66
+ if (uuidIds.length > 0 && this.uuidFieldName) {
67
+ // Query by UUID field (e.g., projectId, organizationId)
68
+ criteria.push({ [this.uuidFieldName]: { $in: uuidIds } });
69
+ }
70
+ // If no valid IDs, return empty array
71
+ if (criteria.length === 0) {
72
+ return [];
73
+ }
74
+ // Execute query with $or combining both lookup strategies
75
+ const query = criteria.length === 1 ? criteria[0] : { $or: criteria };
76
+ return await this.service.getAll({ criteria: query });
77
+ }
78
+ /**
79
+ * Finds a record by ID, checking both ObjectId and UUID fields
80
+ */
81
+ findRecordById(records, id) {
82
+ return (records.find((record) => {
83
+ // Check if ID matches the record's id field (transformed from _id)
84
+ if (record.id === id) {
85
+ return true;
86
+ }
87
+ // If UUID field is configured, check that field too
88
+ if (this.uuidFieldName && record[this.uuidFieldName] === id) {
89
+ return true;
90
+ }
91
+ return false;
92
+ }) || null);
93
+ }
94
+ withOptions = new DataLoader(async (options) => {
95
+ const [{ searchKey, comparator, ...rest }] = options;
96
+ const ids = options.map((option) => option.id);
97
+ // Create a properly typed criteria object with explicit type assertion
98
+ const criteria = {
99
+ ...(rest.criteria || {}),
100
+ [searchKey]: { $in: ids },
101
+ };
102
+ const results = await this.service.getAll({
103
+ ...rest,
104
+ criteria,
105
+ });
106
+ return options.map((option) => results.filter((item) => {
107
+ if (typeof comparator === 'function')
108
+ return comparator(option, item);
109
+ return item[searchKey]?.toString() === option.id.toString();
110
+ }));
111
+ });
112
+ };
113
+ BulkDataLoader2 = __decorate([
114
+ injectable(),
115
+ __param(0, unmanaged()),
116
+ __param(1, unmanaged()),
117
+ __metadata("design:paramtypes", [typeof (_a = typeof IBaseService !== "undefined" && IBaseService) === "function" ? _a : Object, String])
118
+ ], BulkDataLoader2);export{BulkDataLoader2};//# sourceMappingURL=bulk-dataloader-v2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-dataloader-v2.js","sources":["../../src/dataloaders/bulk-dataloader-v2.ts"],"sourcesContent":["/* eslint-disable import/no-extraneous-dependencies */\nimport DataLoader from 'dataloader';\nimport { injectable, unmanaged } from 'inversify';\nimport { FilterQuery, Types } from 'mongoose';\nimport { IBaseService, IDataLoader, AsDomainType, DataLoaderOptions } from 'common/server';\n\n/**\n * BulkDataLoader2 with Dual ID System Support\n *\n * Supports both ObjectId and UUID lookups:\n * - ObjectId: MongoDB's native `_id` field\n * - UUID: External identifier stored as `<collection>Id` (e.g., projectId, organizationId)\n *\n * The loader automatically detects the ID format and queries appropriately:\n * - UUIDs contain hyphens (e.g., \"550e8400-e29b-41d4-a957-446655440000\")\n * - ObjectIds are 24-character hex strings (e.g., \"507f1f77bcf86cd799439011\")\n */\n@injectable()\nexport class BulkDataLoader2<SchemaType>\n extends DataLoader<string, AsDomainType<SchemaType> | null>\n implements IDataLoader<SchemaType>\n{\n /**\n * Optional UUID field name for this collection (e.g., 'projectId', 'organizationId')\n * If not provided, the loader will only support ObjectId lookups\n */\n private readonly uuidFieldName?: string;\n\n constructor(\n @unmanaged() private readonly service: IBaseService<SchemaType>,\n @unmanaged() uuidFieldName?: string,\n ) {\n super(async (ids: string[]) => {\n const data = await this.loadByIds(ids);\n return ids.map((id) => this.findRecordById(data, id));\n });\n this.uuidFieldName = uuidFieldName;\n }\n\n /**\n * Detects if an ID is a UUID (contains hyphens) or ObjectId (24-char hex)\n */\n private isUUID(id: string): boolean {\n return id.includes('-');\n }\n\n /**\n * Detects if an ID is a valid ObjectId\n */\n private isObjectId(id: string): boolean {\n return Types.ObjectId.isValid(id) && !this.isUUID(id);\n }\n\n /**\n * Loads records by IDs, supporting both UUID and ObjectId formats\n * Performs a single query with $or conditions for efficient lookup\n */\n private async loadByIds(ids: string[]): Promise<AsDomainType<SchemaType>[]> {\n // Separate UUIDs and ObjectIds for optimized querying\n const uuidIds: string[] = [];\n const objectIds: string[] = [];\n\n ids.forEach((id) => {\n if (this.isUUID(id)) {\n uuidIds.push(id);\n } else if (this.isObjectId(id)) {\n objectIds.push(id);\n }\n });\n\n // If no UUID field is configured, only support ObjectId lookups\n if (!this.uuidFieldName && uuidIds.length > 0) {\n console.warn(\n `[BulkDataLoader2] UUID IDs detected but no uuidFieldName configured. UUIDs will not be resolved: ${uuidIds.join(', ')}`,\n );\n }\n\n // Build query criteria using $or for mixed ID types\n const criteria: FilterQuery<SchemaType>[] = [];\n\n if (objectIds.length > 0) {\n // Query by _id (ObjectId)\n criteria.push({ _id: { $in: objectIds } } as FilterQuery<SchemaType>);\n }\n\n if (uuidIds.length > 0 && this.uuidFieldName) {\n // Query by UUID field (e.g., projectId, organizationId)\n criteria.push({ [this.uuidFieldName]: { $in: uuidIds } } as FilterQuery<SchemaType>);\n }\n\n // If no valid IDs, return empty array\n if (criteria.length === 0) {\n return [];\n }\n\n // Execute query with $or combining both lookup strategies\n const query: FilterQuery<SchemaType> =\n criteria.length === 1 ? criteria[0] : ({ $or: criteria } as FilterQuery<SchemaType>);\n\n return await this.service.getAll({ criteria: query });\n }\n\n /**\n * Finds a record by ID, checking both ObjectId and UUID fields\n */\n private findRecordById(records: AsDomainType<SchemaType>[], id: string): AsDomainType<SchemaType> | null {\n return (\n records.find((record) => {\n // Check if ID matches the record's id field (transformed from _id)\n if (record.id === id) {\n return true;\n }\n\n // If UUID field is configured, check that field too\n if (this.uuidFieldName && (record as any)[this.uuidFieldName] === id) {\n return true;\n }\n\n return false;\n }) || null\n );\n }\n\n withOptions = new DataLoader<DataLoaderOptions<SchemaType>, AsDomainType<SchemaType>[]>(async (options) => {\n const [{ searchKey, comparator, ...rest }] = options;\n const ids = options.map((option) => option.id);\n\n // Create a properly typed criteria object with explicit type assertion\n const criteria = {\n ...(rest.criteria || {}),\n [searchKey as string]: { $in: ids },\n } as FilterQuery<SchemaType>;\n\n const results = await this.service.getAll({\n ...rest,\n criteria,\n });\n\n return options.map((option) =>\n results.filter((item) => {\n if (typeof comparator === 'function') return comparator(option, item);\n return item[searchKey as keyof AsDomainType<SchemaType>]?.toString() === option.id.toString();\n }),\n );\n });\n}\n"],"names":[],"mappings":";AAMA;;;;;;;;;;AAUG;AAEI,IAAM,eAAe,GAArB,MAAM,eACT,SAAQ,UAAmD,CAAA;AAUzB,IAAA,OAAA,CAAA;AAPlC;;;AAGG;AACc,IAAA,aAAa,CAAU;IAExC,WACkC,CAAA,OAAiC,EAClD,aAAsB,EAAA;AAEnC,QAAA,KAAK,CAAC,OAAO,GAAa,KAAI;YAC1B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AACvC,YAAA,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1D,SAAC,CAAC,CAAC;QAN2B,IAAO,CAAA,OAAA,GAAP,OAAO,CAA0B;AAO/D,QAAA,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;KACtC;AAED;;AAEG;AACK,IAAA,MAAM,CAAC,EAAU,EAAA;AACrB,QAAA,OAAO,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;KAC3B;AAED;;AAEG;AACK,IAAA,UAAU,CAAC,EAAU,EAAA;AACzB,QAAA,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI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AM,CAAC,CAAC,IAAI,KAAI;YACpB,IAAI,OAAO,UAAU,KAAK,UAAU;AAAE,gBAAA,OAAO,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACtE,YAAA,OAAO,IAAI,CAAC,SAA2C,CAAC,EAAE,QAAQ,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;SACjG,CAAC,CACL,CAAC;AACN,KAAC,CAAC,CAAC;EACN;AA/HY,eAAe,GAAA,UAAA,CAAA;AAD3B,IAAA,UAAU,EAAE;IAYJ,OAAA,CAAA,CAAA,EAAA,SAAS,EAAE,CAAA;IACX,OAAA,CAAA,CAAA,EAAA,SAAS,EAAE,CAAA;AAD2B,IAAA,UAAA,CAAA,mBAAA,EAAA,CAAA,QAAA,EAAA,GAAA,OAAA,YAAY,oBAAZ,YAAY,CAAA,KAAA,UAAA,GAAA,EAAA,GAAA,MAAA,EAAA,MAAA,CAAA,CAAA;AAX9C,CAAA,EAAA,eAAe,CA+H3B"}
@@ -0,0 +1 @@
1
+ import 'reflect-metadata';
@@ -1,5 +1,5 @@
1
1
  import DataLoader from 'dataloader';
2
- import { DataLoaderOptions, IBaseService, IDataLoader } from '../interfaces';
2
+ import { DataLoaderOptions, IBaseService, IDataLoader } from '../interfaces/index.old';
3
3
  export declare class BulkDataLoader<T extends {
4
4
  id: string;
5
5
  }> extends DataLoader<string, T | null> implements IDataLoader<T> {
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-dataloader.js","sources":["../../src/dataloaders/bulk-dataloader.ts"],"sourcesContent":[null],"names":[],"mappings":"kIAKO,IAAM,cAAc,GAApB,MAAM,cAAyC,SAAQ,UAA4B,CAAA;AAC5C,IAAA,OAAA,CAAA;AAA1C,IAAA,WAAA,CAA0C,OAAwB,EAAA;AAC9D,QAAA,KAAK,CAAC,OAAO,GAAa,KAAI;YAC1B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,C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,CAyB1B"}
1
+ {"version":3,"file":"bulk-dataloader.js","sources":["../../src/dataloaders/bulk-dataloader.ts"],"sourcesContent":["import DataLoader from 'dataloader';\nimport { injectable, unmanaged } from 'inversify';\nimport { DataLoaderOptions, IBaseService, IDataLoader } from '../interfaces/index.old';\n\n@injectable()\nexport class BulkDataLoader<T extends { id: string }> extends DataLoader<string, T | null> implements IDataLoader<T> {\n constructor(@unmanaged() private readonly service: IBaseService<T>) {\n super(async (ids: string[]) => {\n const data = await this.service.getByIds(ids);\n return ids.map((id) => data.find((record) => record.id === id) || null);\n });\n }\n\n withOptions = new DataLoader<DataLoaderOptions<T>, T[]>(async (options) => {\n const [{ searchKey, comparator, ...rest }] = options;\n const ids = options.map((option) => option.id);\n const results = await this.service.getAll({\n ...rest,\n criteria: {\n ...rest.criteria,\n [searchKey]: { $in: ids },\n },\n });\n return options.map((option) =>\n results.filter((item) => {\n if (typeof comparator === 'function') return comparator(option, item);\n return item[searchKey].toString() === option.id.toString();\n }),\n );\n });\n}\n"],"names":[],"mappings":"kIAKO,IAAM,cAAc,GAApB,MAAM,cAAyC,SAAQ,UAA4B,CAAA;AAC5C,IAAA,OAAA,CAAA;AAA1C,IAAA,WAAA,CAA0C,OAAwB,EAAA;AAC9D,QAAA,KAAK,CAAC,OAAO,GAAa,KAAI;YAC1B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC9C,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC;AAC5E,SAAC,CAAC,CAAC;QAJmC,IAAO,CAAA,OAAA,GAAP,OAAO,CAAiB;KAKjE;IAED,WAAW,GAAG,IAAI,UAAU,CAA4B,OAAO,OAAO,KAAI;AACtE,QAAA,MAAM,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;AACrD,QAAA,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AACtC,YAAA,GAAG,IAAI;AACP,YAAA,QAAQ,EAAE;gBACN,GAAG,IAAI,CAAC,QAAQ;AAChB,gBAAA,CAAC,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;AAC5B,aAAA;AACJ,SAAA,CAAC,CAAC;AACH,QAAA,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KACtB,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,KAAI;YACpB,IAAI,OAAO,UAAU,KAAK,UAAU;AAAE,gBAAA,OAAO,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACtE,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;SAC9D,CAAC,CACL,CAAC;AACN,KAAC,CAAC,CAAC;EACN;AAzBY,cAAc,GAAA,UAAA,CAAA;AAD1B,IAAA,UAAU,EAAE;IAEI,OAAA,CAAA,CAAA,EAAA,SAAS,EAAE,CAAA;;AADf,CAAA,EAAA,cAAc,CAyB1B"}
@@ -0,0 +1 @@
1
+ import 'reflect-metadata';
@@ -1 +1,2 @@
1
+ export * from './bulk-dataloader-v2';
1
2
  export * from './bulk-dataloader';
@@ -1,15 +1,253 @@
1
+ """
2
+ Standard service commands that represent the core CRUD operations available in the BaseServiceMixin.
3
+ These commands are used as action names in Moleculer services and for event emission.
4
+ They provide a consistent API across all services for common data operations.
5
+ """
1
6
  enum BaseServiceCommands {
7
+ """
8
+ Count documents matching criteria
9
+
10
+ This command counts entities matching the provided filter criteria.
11
+ It maps to the IBaseService.count method and handles parameter validation.
12
+
13
+ Example:
14
+ ```
15
+ // Count active users
16
+ const count = await broker.call('users.count', {
17
+ criteria: { active: true }
18
+ });
19
+ ```
20
+ """
2
21
  count
22
+
23
+ """
24
+ Get a single document by ID or criteria
25
+
26
+ This command retrieves a single entity by its unique identifier.
27
+ It maps to the IBaseService.get method and handles parameter validation.
28
+
29
+ Example:
30
+ ```
31
+ // Get user by ID
32
+ const user = await broker.call('users.get', { id: '123' });
33
+
34
+ // Get user by email
35
+ const user = await broker.call('users.get', {
36
+ criteria: { email: 'user@example.com' }
37
+ });
38
+ ```
39
+ """
3
40
  get
41
+
42
+ """
43
+ Get documents with pagination
44
+
45
+ This command retrieves multiple entities with filtering, sorting, and pagination.
46
+ It maps to the IBaseService.getAll method and handles parameter validation.
47
+
48
+ Example:
49
+ ```
50
+ // Get active users sorted by creation date
51
+ const users = await broker.call('users.getAll', {
52
+ criteria: { active: true },
53
+ sort: { createdAt: -1 },
54
+ skip: 0,
55
+ limit: 10
56
+ });
57
+ ```
58
+ """
4
59
  getAll
60
+
61
+ """
62
+ Get a single document by name field
63
+
64
+ This command retrieves a single entity by its name field.
65
+ It maps to the IBaseService.getByName method and handles parameter validation.
66
+ Commonly used for entities that have a unique name identifier.
67
+
68
+ Example:
69
+ ```
70
+ // Get product by name
71
+ const product = await broker.call('products.getByName', {
72
+ name: 'Premium Subscription'
73
+ });
74
+ ```
75
+ """
5
76
  getByName
77
+
78
+ """
79
+ Get multiple documents by their IDs
80
+
81
+ This command retrieves multiple entities by their unique identifiers.
82
+ It maps to the IBaseService.getByIds method and handles parameter validation.
83
+ Useful for retrieving a specific set of entities in a single operation.
84
+
85
+ Example:
86
+ ```
87
+ // Get multiple users by their IDs
88
+ const users = await broker.call('users.getByIds', {
89
+ ids: ['user1', 'user2', 'user3']
90
+ });
91
+ ```
92
+ """
6
93
  getByIds
94
+
95
+ """
96
+ Create a single document
97
+
98
+ This command creates a single entity.
99
+ It maps to the IBaseService.create method and handles parameter validation.
100
+ It also emits an event for the created entity if configured.
101
+
102
+ Example:
103
+ ```
104
+ // Create a new user
105
+ const user = await broker.call('users.create', {
106
+ data: { name: 'John', email: 'john@example.com' }
107
+ });
108
+ ```
109
+ """
7
110
  create
111
+
112
+ """
113
+ Create or update a document
114
+
115
+ This command creates a new entity or updates an existing one if an ID is provided.
116
+ It maps to the IBaseService.insert method and handles parameter validation.
117
+ It also emits an event for the created or updated entity if configured.
118
+
119
+ Example:
120
+ ```
121
+ // Create a new product
122
+ const newProduct = await broker.call('products.insert', {
123
+ data: { name: 'New Product', price: 99.99 }
124
+ });
125
+
126
+ // Update an existing product
127
+ const updatedProduct = await broker.call('products.insert', {
128
+ data: { id: 'product123', name: 'Updated Product', price: 129.99 }
129
+ });
130
+ ```
131
+ """
8
132
  insert
133
+
134
+ """
135
+ Create multiple documents
136
+
137
+ This command creates multiple entities in a single operation.
138
+ It maps to the IBaseService.bulkCreate method and handles parameter validation.
139
+ It also emits events for the created entities if configured.
140
+
141
+ Example:
142
+ ```
143
+ // Create multiple users
144
+ const users = await broker.call('users.bulkCreate', {
145
+ data: [
146
+ { name: 'John', email: 'john@example.com' },
147
+ { name: 'Jane', email: 'jane@example.com' }
148
+ ]
149
+ });
150
+ ```
151
+ """
9
152
  bulkCreate
153
+
154
+ """
155
+ Update a document by ID
156
+
157
+ This command updates an existing entity by its unique identifier.
158
+ It maps to the IBaseService.update method and handles parameter validation.
159
+ It also emits an event for the updated entity if configured.
160
+
161
+ Example:
162
+ ```
163
+ // Update a user's role
164
+ const updatedUser = await broker.call('users.update', {
165
+ id: 'user123',
166
+ data: { role: 'admin', active: true }
167
+ });
168
+
169
+ // Replace a user document entirely
170
+ const replacedUser = await broker.call('users.update', {
171
+ id: 'user123',
172
+ data: { name: 'New Name', email: 'new@example.com', role: 'user' },
173
+ overwrite: true
174
+ });
175
+ ```
176
+ """
10
177
  update
178
+
179
+ """
180
+ Delete a document by ID
181
+
182
+ This command deletes a single entity by its unique identifier.
183
+ It maps to the IBaseService.delete method and handles parameter validation.
184
+ It also emits an event for the deleted entity if configured.
185
+
186
+ Example:
187
+ ```
188
+ // Delete a user
189
+ const success = await broker.call('users.delete', { id: '123' });
190
+ ```
191
+ """
11
192
  delete
193
+
194
+ """
195
+ Delete multiple documents by IDs
196
+
197
+ This command deletes multiple entities by their unique identifiers.
198
+ It maps to the IBaseService.bulkDelete method and handles parameter validation.
199
+ It also emits events for the deleted entities if configured.
200
+
201
+ Example:
202
+ ```
203
+ // Delete multiple users
204
+ const deletedCount = await broker.call('users.BulkDelete', {
205
+ ids: ['user1', 'user2', 'user3']
206
+ });
207
+ ```
208
+ """
209
+ BulkDelete
210
+
211
+ """
212
+ Delete multiple documents matching criteria
213
+
214
+ This command deletes multiple entities matching the provided filter criteria.
215
+ It maps to the IBaseService.delete method and handles parameter validation.
216
+ It also emits an event with the deletion criteria if configured.
217
+
218
+ Example:
219
+ ```
220
+ // Delete all inactive users
221
+ const deletedCount = await broker.call('users.deleteMany', {
222
+ criteria: { active: false }
223
+ });
224
+
225
+ // Delete users with a specific role
226
+ const deletedCount = await broker.call('users.deleteMany', {
227
+ criteria: { role: 'guest' }
228
+ });
229
+ ```
230
+ """
12
231
  deleteMany
232
+
233
+ """
234
+ Get documents with pagination and total count
235
+
236
+ This command retrieves multiple entities with filtering, sorting, pagination,
237
+ and includes the total count of matching documents (useful for UI pagination).
238
+ It maps to the IBaseService.getAllWithCount method and handles parameter validation.
239
+
240
+ Example:
241
+ ```
242
+ // Get paginated users with total count for UI pagination
243
+ const { data, totalCount } = await broker.call('users.getAllWithCount', {
244
+ criteria: { role: 'user' },
245
+ skip: 20,
246
+ limit: 10,
247
+ sort: { createdAt: -1 }
248
+ });
249
+ ```
250
+ """
13
251
  getAllWithCount
14
252
  }
15
253
 
@@ -1 +1 @@
1
- {"version":3,"file":"mongoose-connection.js","sources":["../../src/helpers/mongoose-connection.ts"],"sourcesContent":[null],"names":[],"mappings":"kCAEA,MAAM,aAAa,GAAqC,CAAC,QAAQ,KAAI;;IAEjE,QAAQ;AACH,SAAA,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,IAAI,CAAC,MAAK;AACP,QAAA,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;;;AAG9C,KAAC,CAAC;AACD,SAAA,KAAK,CAAC,CAAC,GAAmB,KAAI;AAC3B,QAAA,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;;AAEjD,QAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC9B,KAAC,CAAC,CAAC;;AAEP,IAAA,MAAM,kBAAkB,GAAwB,QAAQ,CAAC,UAAU,CAAC;AAEpE,IAAA,OAAO,kBAAkB,CAAC;AAC9B"}
1
+ {"version":3,"file":"mongoose-connection.js","sources":["../../src/helpers/mongoose-connection.ts"],"sourcesContent":["import * as mongoose from 'mongoose';\n\nconst generateMongo: (monoUrl) => mongoose.Connection = (mongoUrl) => {\n // creates default connection\n mongoose\n .connect(mongoUrl, {})\n .then(() => {\n console.info('mogoose connect - success');\n // console.info(`uri - ${uri}`);\n // console.info(`connectionOptions - ${connectionOptions}`);\n })\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\nexport { generateMongo };\n"],"names":[],"mappings":"kCAEA,MAAM,aAAa,GAAqC,CAAC,QAAQ,KAAI;;IAEjE,QAAQ;AACH,SAAA,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,IAAI,CAAC,MAAK;AACP,QAAA,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;;;AAG9C,KAAC,CAAC;AACD,SAAA,KAAK,CAAC,CAAC,GAAmB,KAAI;AAC3B,QAAA,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;;AAEjD,QAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC9B,KAAC,CAAC,CAAC;;AAEP,IAAA,MAAM,kBAAkB,GAAwB,QAAQ,CAAC,UAAU,CAAC;AAEpE,IAAA,OAAO,kBAAkB,CAAC;AAC9B"}
package/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export * from './interfaces';
2
1
  export * from './helpers';
3
2
  export * from './services';
4
3
  export * from './store';
5
4
  export * from './dataloaders';
6
5
  export * from './mixins';
6
+ export * from './interfaces';
7
+ export * from './interfaces/index.old';
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export{PAGINATION_OPTIONS}from'./interfaces/base-repository.js';export{generateMongo}from'./helpers/mongoose-connection.js';export{BaseService}from'./services/base-service.js';export{BaseProxyService}from'./services/base-proxy-service.js';export{addIdVirtualFields,commonModeSchemaOptions}from'./store/models/common-options.js';export{BaseRepository}from'./store/repositories/base-repository.js';export{BulkDataLoader}from'./dataloaders/bulk-dataloader.js';export{BaseServiceMixin}from'./mixins/base-service-mixin.js';//# sourceMappingURL=index.js.map
1
+ export{generateMongo}from'./helpers/mongoose-connection.js';export{BaseService2}from'./services/BaseService.js';export{BaseProxyService2}from'./services/BaseProxyService.js';export{ConnectionPoolManager}from'./services/ConnectionPoolManager.js';export{BaseService}from'./services/base-service.js';export{BaseProxyService}from'./services/base-proxy-service.js';export{addIdVirtualFields2,commonModelSchemaOptions2}from'./store/models/common-options-v2.js';export{addIdVirtualFields,commonModeSchemaOptions}from'./store/models/common-options.js';export{BaseMongoRepository}from'./store/repositories/BaseMongoRepository.js';export{BaseRepository}from'./store/repositories/base-repository.js';export{BulkDataLoader2}from'./dataloaders/bulk-dataloader-v2.js';export{BulkDataLoader}from'./dataloaders/bulk-dataloader.js';export{BaseServiceMixin as BaseServiceMixin2}from'./mixins/BaseServiceMixin.js';export{BaseServiceMixin}from'./mixins/base-service-mixin.js';export{PAGINATION_OPTIONS}from'./interfaces/getAllArgs.js';//# sourceMappingURL=index.js.map
@@ -1,9 +1,5 @@
1
1
  import { Document, FilterQuery, Model, UpdateQuery } from 'mongoose';
2
- import { GetAllArgs } from './get-all-args';
3
- export declare enum PAGINATION_OPTIONS {
4
- limit = 10,
5
- skip = 0
6
- }
2
+ import { GetAllArgs } from './getAllArgs';
7
3
  export interface IBaseRepository<T, D = Document<T>> {
8
4
  model: Model<D>;
9
5
  count(conditions?: FilterQuery<D>): Promise<number>;
@@ -1,5 +1,5 @@
1
1
  import { FilterQuery, Document } from 'mongoose';
2
- import { GetAllArgs } from './get-all-args';
2
+ import { GetAllArgs } from './getAllArgs';
3
3
  export interface IBaseService<T, C = Omit<T, 'id'>, U = C> {
4
4
  count(conditions?: FilterQuery<Document<T>>): Promise<number>;
5
5
  get(id: string): Promise<T>;