@mbc-cqrs-serverless/core 1.3.2 → 1.3.3
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 +0 -37
- package/dist/app.module.js +0 -2
- package/dist/app.module.js.map +1 -1
- package/dist/commands/command.event.handler.js +2 -8
- package/dist/commands/command.event.handler.js.map +1 -1
- package/dist/commands/command.service.js +9 -35
- package/dist/commands/command.service.js.map +1 -1
- package/dist/context/invoke.d.ts +0 -1
- package/dist/context/invoke.js +1 -1
- package/dist/context/invoke.js.map +1 -1
- package/dist/context/user.d.ts +0 -4
- package/dist/context/user.js +0 -50
- package/dist/context/user.js.map +1 -1
- package/dist/decorators/constants.d.ts +0 -2
- package/dist/decorators/constants.js +1 -3
- package/dist/decorators/constants.js.map +1 -1
- package/dist/decorators/data-sync-handler.decorator.d.ts +0 -19
- package/dist/decorators/data-sync-handler.decorator.js +0 -19
- package/dist/decorators/data-sync-handler.decorator.js.map +1 -1
- package/dist/decorators/index.d.ts +0 -2
- package/dist/decorators/index.js +0 -2
- package/dist/decorators/index.js.map +1 -1
- package/dist/env.validation.d.ts +0 -19
- package/dist/env.validation.js +1 -22
- package/dist/env.validation.js.map +1 -1
- package/dist/guard/roles.guard.d.ts +1 -11
- package/dist/guard/roles.guard.js +8 -44
- package/dist/guard/roles.guard.js.map +1 -1
- package/dist/helpers/serializer.d.ts +2 -1
- package/dist/helpers/serializer.js +7 -34
- package/dist/helpers/serializer.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/command-module-options.interface.d.ts +1 -11
- package/dist/notifications/appsync.service.d.ts +2 -3
- package/dist/notifications/appsync.service.js +12 -20
- package/dist/notifications/appsync.service.js.map +1 -1
- package/dist/notifications/event/notification.event.handler.d.ts +5 -13
- package/dist/notifications/event/notification.event.handler.js +7 -31
- package/dist/notifications/event/notification.event.handler.js.map +1 -1
- package/dist/notifications/index.d.ts +0 -3
- package/dist/notifications/index.js +0 -3
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/notification.module.js +2 -12
- package/dist/notifications/notification.module.js.map +1 -1
- package/dist/services/explorer.service.d.ts +0 -5
- package/dist/services/explorer.service.js +1 -12
- package/dist/services/explorer.service.js.map +1 -1
- package/package.json +4 -4
- package/dist/auth/auth.module.d.ts +0 -2
- package/dist/auth/auth.module.js +0 -30
- package/dist/auth/auth.module.js.map +0 -1
- package/dist/auth/authz-bootstrap.service.d.ts +0 -11
- package/dist/auth/authz-bootstrap.service.js +0 -47
- package/dist/auth/authz-bootstrap.service.js.map +0 -1
- package/dist/auth/group-role-resolver.interface.d.ts +0 -13
- package/dist/auth/group-role-resolver.interface.js +0 -3
- package/dist/auth/group-role-resolver.interface.js.map +0 -1
- package/dist/auth/group-role-resolver.registry.d.ts +0 -6
- package/dist/auth/group-role-resolver.registry.js +0 -26
- package/dist/auth/group-role-resolver.registry.js.map +0 -1
- package/dist/auth/index.d.ts +0 -4
- package/dist/auth/index.js +0 -21
- package/dist/auth/index.js.map +0 -1
- package/dist/decorators/group-role-resolver.decorator.d.ts +0 -9
- package/dist/decorators/group-role-resolver.decorator.js +0 -17
- package/dist/decorators/group-role-resolver.decorator.js.map +0 -1
- package/dist/decorators/notification-transport.decorator.d.ts +0 -6
- package/dist/decorators/notification-transport.decorator.js +0 -14
- package/dist/decorators/notification-transport.decorator.js.map +0 -1
- package/dist/notification-env.validation.d.ts +0 -8
- package/dist/notification-env.validation.js +0 -36
- package/dist/notification-env.validation.js.map +0 -1
- package/dist/notifications/appsync-events.service.d.ts +0 -44
- package/dist/notifications/appsync-events.service.js +0 -147
- package/dist/notifications/appsync-events.service.js.map +0 -1
- package/dist/notifications/enums/index.d.ts +0 -1
- package/dist/notifications/enums/index.js +0 -18
- package/dist/notifications/enums/index.js.map +0 -1
- package/dist/notifications/enums/notification-transport.enum.d.ts +0 -4
- package/dist/notifications/enums/notification-transport.enum.js +0 -9
- package/dist/notifications/enums/notification-transport.enum.js.map +0 -1
- package/dist/notifications/interfaces/index.d.ts +0 -1
- package/dist/notifications/interfaces/index.js +0 -18
- package/dist/notifications/interfaces/index.js.map +0 -1
- package/dist/notifications/interfaces/notification-transport.interface.d.ts +0 -7
- package/dist/notifications/interfaces/notification-transport.interface.js +0 -5
- package/dist/notifications/interfaces/notification-transport.interface.js.map +0 -1
- package/dist/services/mocks/group-role-resolver.mock.d.ts +0 -4
- package/dist/services/mocks/group-role-resolver.mock.js +0 -20
- package/dist/services/mocks/group-role-resolver.mock.js.map +0 -1
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext, Logger } from '@nestjs/common';
|
|
2
2
|
import { Reflector } from '@nestjs/core';
|
|
3
|
-
import { GroupRoleResolverRegistry } from '../auth/group-role-resolver.registry';
|
|
4
3
|
import { UserContext } from '../context';
|
|
5
4
|
export declare class RolesGuard implements CanActivate {
|
|
6
5
|
protected reflector: Reflector;
|
|
7
|
-
protected registry?: GroupRoleResolverRegistry;
|
|
8
6
|
protected readonly logger: Logger;
|
|
9
|
-
constructor(reflector: Reflector
|
|
7
|
+
constructor(reflector: Reflector);
|
|
10
8
|
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
11
9
|
/**
|
|
12
10
|
* Verify tenant access.
|
|
@@ -61,14 +59,6 @@ export declare class RolesGuard implements CanActivate {
|
|
|
61
59
|
* This is a helper method that can be used by subclasses.
|
|
62
60
|
*/
|
|
63
61
|
protected getAuthorizerClaims(context: ExecutionContext): import("../context").JwtClaims;
|
|
64
|
-
protected hasAnyRole(requiredRoles: string[], userRoles: string[]): boolean;
|
|
65
|
-
protected resolveGroupRoles(context: ExecutionContext, groupIds: string[]): Promise<string[]>;
|
|
66
62
|
protected verifyRole(context: ExecutionContext): Promise<boolean>;
|
|
67
|
-
/**
|
|
68
|
-
* Returns the primary direct role string from JWT context.
|
|
69
|
-
*
|
|
70
|
-
* @deprecated Not invoked by `verifyRole`. For custom authorization, override
|
|
71
|
-
* `verifyRole`, `resolveGroupRoles`, or `canOverrideTenant` instead.
|
|
72
|
-
*/
|
|
73
63
|
protected getUserRole(context: ExecutionContext): Promise<string>;
|
|
74
64
|
}
|
|
@@ -8,22 +8,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
11
|
var RolesGuard_1;
|
|
15
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
13
|
exports.RolesGuard = void 0;
|
|
17
14
|
const common_1 = require("@nestjs/common");
|
|
18
15
|
const core_1 = require("@nestjs/core");
|
|
19
|
-
const group_role_resolver_registry_1 = require("../auth/group-role-resolver.registry");
|
|
20
16
|
const constants_1 = require("../constants");
|
|
21
17
|
const context_1 = require("../context");
|
|
22
18
|
const decorators_1 = require("../decorators");
|
|
23
19
|
let RolesGuard = RolesGuard_1 = class RolesGuard {
|
|
24
|
-
constructor(reflector
|
|
20
|
+
constructor(reflector) {
|
|
25
21
|
this.reflector = reflector;
|
|
26
|
-
this.registry = registry;
|
|
27
22
|
this.logger = new common_1.Logger(RolesGuard_1.name);
|
|
28
23
|
}
|
|
29
24
|
async canActivate(context) {
|
|
@@ -118,51 +113,22 @@ let RolesGuard = RolesGuard_1 = class RolesGuard {
|
|
|
118
113
|
const invokeContext = (0, context_1.extractInvokeContext)(context);
|
|
119
114
|
return (0, context_1.getAuthorizerClaims)(invokeContext);
|
|
120
115
|
}
|
|
121
|
-
hasAnyRole(requiredRoles, userRoles) {
|
|
122
|
-
return requiredRoles.some((role) => userRoles.includes(role));
|
|
123
|
-
}
|
|
124
|
-
async resolveGroupRoles(context, groupIds) {
|
|
125
|
-
const resolver = this.registry?.get();
|
|
126
|
-
if (!resolver || !groupIds.length) {
|
|
127
|
-
return [];
|
|
128
|
-
}
|
|
129
|
-
const userContext = (0, context_1.getUserContext)(context);
|
|
130
|
-
const claims = this.getAuthorizerClaims(context);
|
|
131
|
-
try {
|
|
132
|
-
return await resolver.resolveRoles({
|
|
133
|
-
tenantCode: userContext.tenantCode,
|
|
134
|
-
groupIds,
|
|
135
|
-
claims,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
this.logger.error('GroupRoleResolver.resolveRoles failed', err);
|
|
140
|
-
throw err;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
116
|
async verifyRole(context) {
|
|
144
117
|
const requiredRoles = this.reflector.getAllAndOverride(decorators_1.ROLE_METADATA, [context.getHandler(), context.getClass()]);
|
|
145
118
|
if (!requiredRoles || !requiredRoles.length) {
|
|
146
119
|
// all user can access
|
|
147
120
|
return true;
|
|
148
121
|
}
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return true;
|
|
122
|
+
const userRole = await this.getUserRole(context);
|
|
123
|
+
if (!userRole) {
|
|
124
|
+
return false;
|
|
153
125
|
}
|
|
154
|
-
if (
|
|
126
|
+
if (userRole === constants_1.ROLE_SYSTEM_ADMIN) {
|
|
155
127
|
return true;
|
|
156
128
|
}
|
|
157
|
-
|
|
158
|
-
return this.hasAnyRole(requiredRoles, groupRoles);
|
|
129
|
+
return requiredRoles.includes(userRole);
|
|
159
130
|
}
|
|
160
|
-
|
|
161
|
-
* Returns the primary direct role string from JWT context.
|
|
162
|
-
*
|
|
163
|
-
* @deprecated Not invoked by `verifyRole`. For custom authorization, override
|
|
164
|
-
* `verifyRole`, `resolveGroupRoles`, or `canOverrideTenant` instead.
|
|
165
|
-
*/
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
166
132
|
async getUserRole(context) {
|
|
167
133
|
const userContext = (0, context_1.getUserContext)(context);
|
|
168
134
|
return userContext.tenantRole;
|
|
@@ -171,8 +137,6 @@ let RolesGuard = RolesGuard_1 = class RolesGuard {
|
|
|
171
137
|
exports.RolesGuard = RolesGuard;
|
|
172
138
|
exports.RolesGuard = RolesGuard = RolesGuard_1 = __decorate([
|
|
173
139
|
(0, common_1.Injectable)(),
|
|
174
|
-
|
|
175
|
-
__metadata("design:paramtypes", [core_1.Reflector,
|
|
176
|
-
group_role_resolver_registry_1.GroupRoleResolverRegistry])
|
|
140
|
+
__metadata("design:paramtypes", [core_1.Reflector])
|
|
177
141
|
], RolesGuard);
|
|
178
142
|
//# sourceMappingURL=roles.guard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roles.guard.js","sourceRoot":"","sources":["../../src/guard/roles.guard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"roles.guard.js","sourceRoot":"","sources":["../../src/guard/roles.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAKuB;AACvB,uCAAwC;AAExC,4CAIqB;AACrB,wCAKmB;AACnB,8CAA6C;AAGtC,IAAM,UAAU,kBAAhB,MAAM,UAAU;IAGrB,YAAsB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;QAFvB,WAAM,GAAG,IAAI,eAAM,CAAC,YAAU,CAAC,IAAI,CAAC,CAAA;IAEV,CAAC;IAE9C,KAAK,CAAC,WAAW,CAAC,OAAyB;QACzC,eAAe;QACf,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QACtD,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO,KAAK,CAAA;QACd,CAAC;QAED,yBAAyB;QACzB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;QAClD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,YAAY,CAAC,OAAyB;QACpD,MAAM,WAAW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C,UAAU,CAAC,OAAyB;QAClD,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CACpD,0BAAa,EACb,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAC3C,CAAA;QACD,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;YAC5C,sBAAsB;YACtB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,KAAK,CAAA;QACd,CAAC;QACD,IAAI,QAAQ,KAAK,6BAAiB,EAAE,CAAC;YACnC,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACzC,CAAC;IAED,6DAA6D;IACnD,KAAK,CAAC,WAAW,CAAC,OAAyB;QACnD,MAAM,WAAW,GAAG,IAAA,wBAAc,EAAC,OAAO,CAAC,CAAA;QAE3C,OAAO,WAAW,CAAC,UAAU,CAAA;IAC/B,CAAC;CACF,CAAA;AA9IY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;qCAIsB,gBAAS;GAH/B,UAAU,CA8ItB"}
|
|
@@ -6,9 +6,10 @@ export interface SerializerOptions {
|
|
|
6
6
|
/**
|
|
7
7
|
* Converts internal DynamoDB structure to external flat structure
|
|
8
8
|
* @param item Internal item (CommandEntity or DataEntity)
|
|
9
|
+
* @param options Serialization options
|
|
9
10
|
* @returns Flattened external structure
|
|
10
11
|
*/
|
|
11
|
-
export declare function serializeToExternal<T extends CommandEntity | DataEntity>(item: T | null | undefined): Record<string, any> | null;
|
|
12
|
+
export declare function serializeToExternal<T extends CommandEntity | DataEntity>(item: T | null | undefined, options?: SerializerOptions): Record<string, any> | null;
|
|
12
13
|
/**
|
|
13
14
|
* Converts external flat structure to internal DynamoDB structure
|
|
14
15
|
* @param data External flat structure
|
|
@@ -5,9 +5,10 @@ exports.deserializeToInternal = deserializeToInternal;
|
|
|
5
5
|
/**
|
|
6
6
|
* Converts internal DynamoDB structure to external flat structure
|
|
7
7
|
* @param item Internal item (CommandEntity or DataEntity)
|
|
8
|
+
* @param options Serialization options
|
|
8
9
|
* @returns Flattened external structure
|
|
9
10
|
*/
|
|
10
|
-
function serializeToExternal(item) {
|
|
11
|
+
function serializeToExternal(item, options = {}) {
|
|
11
12
|
if (!item)
|
|
12
13
|
return null;
|
|
13
14
|
const result = {
|
|
@@ -16,7 +17,7 @@ function serializeToExternal(item) {
|
|
|
16
17
|
name: item.name,
|
|
17
18
|
};
|
|
18
19
|
// Copy first level properties
|
|
19
|
-
Object.keys(item).forEach(
|
|
20
|
+
Object.keys(item).forEach(key => {
|
|
20
21
|
if (key !== 'attributes' && typeof item[key] !== 'undefined') {
|
|
21
22
|
result[key] = item[key];
|
|
22
23
|
}
|
|
@@ -45,43 +46,15 @@ function deserializeToInternal(data, EntityClass) {
|
|
|
45
46
|
entity.pk = pk;
|
|
46
47
|
entity.sk = sk || data.code;
|
|
47
48
|
entity.name = data.name;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'tenantCode',
|
|
51
|
-
'type',
|
|
52
|
-
'isDeleted',
|
|
53
|
-
'status',
|
|
54
|
-
'createdAt',
|
|
55
|
-
'updatedAt',
|
|
56
|
-
'createdBy',
|
|
57
|
-
'updatedBy',
|
|
58
|
-
'createdIp',
|
|
59
|
-
'updatedIp',
|
|
60
|
-
].forEach((key) => {
|
|
49
|
+
// Copy entity-specific fields first
|
|
50
|
+
['version', 'tenantCode', 'type', 'isDeleted', 'status', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy', 'createdIp', 'updatedIp'].forEach(key => {
|
|
61
51
|
if (key in data) {
|
|
62
52
|
entity[key] = data[key];
|
|
63
53
|
}
|
|
64
54
|
});
|
|
65
55
|
// Separate remaining fields into attributes
|
|
66
|
-
Object.keys(data).forEach(
|
|
67
|
-
if (![
|
|
68
|
-
'id',
|
|
69
|
-
'code',
|
|
70
|
-
'pk',
|
|
71
|
-
'sk',
|
|
72
|
-
'name',
|
|
73
|
-
'version',
|
|
74
|
-
'tenantCode',
|
|
75
|
-
'type',
|
|
76
|
-
'isDeleted',
|
|
77
|
-
'status',
|
|
78
|
-
'createdAt',
|
|
79
|
-
'updatedAt',
|
|
80
|
-
'createdBy',
|
|
81
|
-
'updatedBy',
|
|
82
|
-
'createdIp',
|
|
83
|
-
'updatedIp',
|
|
84
|
-
].includes(key)) {
|
|
56
|
+
Object.keys(data).forEach(key => {
|
|
57
|
+
if (!['id', 'code', 'pk', 'sk', 'name', 'version', 'tenantCode', 'type', 'isDeleted', 'status', 'createdAt', 'updatedAt', 'createdBy', 'updatedBy', 'createdIp', 'updatedIp'].includes(key)) {
|
|
85
58
|
if (key in entity) {
|
|
86
59
|
entity[key] = data[key];
|
|
87
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/helpers/serializer.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/helpers/serializer.ts"],"names":[],"mappings":";;AAaA,kDA2BC;AAQD,sDAmCC;AA5ED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,IAA0B,EAC1B,UAA6B,EAAE;IAE/B,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,MAAM,MAAM,GAAwB;QAClC,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,EAAE;QAC3B,IAAI,EAAE,IAAI,CAAC,EAAE;QACb,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;IAEF,8BAA8B;IAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QA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AChB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,4CAA4C;IAC5C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC9B,IAAI,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5L,IAAI,GAAG,IAAI,MAAM,EAAE,CAAC;gBAClB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./app.module"), exports);
|
|
18
|
-
__exportStar(require("./auth"), exports);
|
|
19
18
|
__exportStar(require("./bootstrap"), exports);
|
|
20
19
|
__exportStar(require("./command-events"), exports);
|
|
21
20
|
__exportStar(require("./commands"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,8CAA2B;AAC3B,mDAAgC;AAChC,6CAA0B;AAC1B,8CAA2B;AAC3B,4CAAyB;AACzB,+CAA4B;AAC5B,+CAA4B;AAC5B,mDAAgC;AAChC,2CAAwB;AACxB,+CAA4B;AAC5B,4CAAyB;AACzB,0CAAuB;AACvB,4CAAyB;AACzB,+CAA4B;AAC5B,kDAA+B;AAC/B,yCAAsB;AACtB,0CAAuB;AACvB,6CAA0B;AAC1B,8CAA2B"}
|
|
@@ -15,17 +15,7 @@ export interface CommandModuleOptions {
|
|
|
15
15
|
tableName: string;
|
|
16
16
|
/** If true, skips errors from previous command versions */
|
|
17
17
|
skipError?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Custom handlers for syncing command data to read models.
|
|
20
|
-
*
|
|
21
|
-
* **Recommended (primary) registration path.**
|
|
22
|
-
* Classes listed here are automatically added as providers and resolved
|
|
23
|
-
* by the NestJS DI container. This path is explicit about module ownership
|
|
24
|
-
* and is fully covered by the duplicate-detection guard in CommandService.
|
|
25
|
-
*
|
|
26
|
-
* Avoid combining this with `@DataSyncHandler` decorator on the same class —
|
|
27
|
-
* that causes duplicate registration (detected and warned at startup).
|
|
28
|
-
*/
|
|
18
|
+
/** Custom handlers for syncing command data to read models */
|
|
29
19
|
dataSyncHandlers?: Type<IDataSyncHandler>[];
|
|
30
20
|
/** If true, disables the default data sync handler */
|
|
31
21
|
disableDefaultHandler?: boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ConfigService } from '@nestjs/config';
|
|
2
2
|
import { INotification } from '../interfaces';
|
|
3
|
-
|
|
4
|
-
export declare class AppSyncService implements INotificationTransport {
|
|
3
|
+
export declare class AppSyncService {
|
|
5
4
|
private readonly config;
|
|
6
5
|
private readonly logger;
|
|
7
6
|
private readonly endpoint;
|
|
@@ -10,5 +9,5 @@ export declare class AppSyncService implements INotificationTransport {
|
|
|
10
9
|
private readonly region;
|
|
11
10
|
private readonly signer;
|
|
12
11
|
constructor(config: ConfigService);
|
|
13
|
-
sendMessage(
|
|
12
|
+
sendMessage(msg: INotification): Promise<any>;
|
|
14
13
|
}
|
|
@@ -20,8 +20,6 @@ const signature_v4_1 = require("@aws-sdk/signature-v4");
|
|
|
20
20
|
const common_1 = require("@nestjs/common");
|
|
21
21
|
const config_1 = require("@nestjs/config");
|
|
22
22
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
23
|
-
const decorators_1 = require("../decorators");
|
|
24
|
-
const enums_1 = require("./enums");
|
|
25
23
|
const query = /* GraphQL */ `
|
|
26
24
|
mutation SEND_MESSAGE($message: AWSJSON!) {
|
|
27
25
|
sendMessage(message: $message) {
|
|
@@ -39,24 +37,18 @@ let AppSyncService = AppSyncService_1 = class AppSyncService {
|
|
|
39
37
|
constructor(config) {
|
|
40
38
|
this.config = config;
|
|
41
39
|
this.logger = new common_1.Logger(AppSyncService_1.name);
|
|
42
|
-
this.endpoint = config.get('APPSYNC_ENDPOINT')
|
|
43
|
-
this.apiKey = config.get('APPSYNC_API_KEY')
|
|
40
|
+
this.endpoint = config.get('APPSYNC_ENDPOINT');
|
|
41
|
+
this.apiKey = config.get('APPSYNC_API_KEY');
|
|
44
42
|
this.region = 'ap-northeast-1';
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
}
|
|
43
|
+
this.hostname = new URL(this.endpoint).hostname;
|
|
44
|
+
this.signer = new signature_v4_1.SignatureV4({
|
|
45
|
+
credentials: (0, credential_provider_node_1.defaultProvider)(),
|
|
46
|
+
region: this.region,
|
|
47
|
+
service: 'appsync',
|
|
48
|
+
sha256: sha256_js_1.Sha256,
|
|
49
|
+
});
|
|
54
50
|
}
|
|
55
|
-
async sendMessage(
|
|
56
|
-
if (!this.endpoint?.trim() || !this.hostname) {
|
|
57
|
-
this.logger.warn('APPSYNC_ENDPOINT is not set, skipping.');
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
51
|
+
async sendMessage(msg) {
|
|
60
52
|
const headers = {
|
|
61
53
|
'Content-Type': 'application/json',
|
|
62
54
|
host: this.hostname,
|
|
@@ -64,7 +56,7 @@ let AppSyncService = AppSyncService_1 = class AppSyncService {
|
|
|
64
56
|
const body = JSON.stringify({
|
|
65
57
|
query,
|
|
66
58
|
variables: {
|
|
67
|
-
message: JSON.stringify(
|
|
59
|
+
message: JSON.stringify(msg),
|
|
68
60
|
},
|
|
69
61
|
});
|
|
70
62
|
const method = 'POST';
|
|
@@ -104,7 +96,7 @@ let AppSyncService = AppSyncService_1 = class AppSyncService {
|
|
|
104
96
|
};
|
|
105
97
|
exports.AppSyncService = AppSyncService;
|
|
106
98
|
exports.AppSyncService = AppSyncService = AppSyncService_1 = __decorate([
|
|
107
|
-
(0,
|
|
99
|
+
(0, common_1.Injectable)(),
|
|
108
100
|
__metadata("design:paramtypes", [config_1.ConfigService])
|
|
109
101
|
], AppSyncService);
|
|
110
102
|
//# sourceMappingURL=appsync.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appsync.service.js","sourceRoot":"","sources":["../../src/notifications/appsync.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAA8C;AAC9C,gFAAmE;AACnE,wDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"appsync.service.js","sourceRoot":"","sources":["../../src/notifications/appsync.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAA8C;AAC9C,gFAAmE;AACnE,wDAAmD;AACnD,2CAAmD;AACnD,2CAA8C;AAC9C,4DAA4C;AAI5C,MAAM,KAAK,GAAG,aAAa,CAAC;;;;;;;;;;;;CAY3B,CAAA;AAGM,IAAM,cAAc,sBAApB,MAAM,cAAc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AG;gBACd,MAAM;gBACN,OAAO;gBACP,QAAQ,EAAE,QAAQ;gBAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI;gBACJ,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,OAAO,EAAE,SAAS;aACnB,CAAA;YACD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE;gBACpD,WAAW,EAAE,IAAI,IAAI,EAAE;aACxB,CAAC,CAAA;YACF,GAAG,GAAG,MAAM,IAAA,oBAAK,EAAC,IAAI,CAAC,QAAQ,EAAE;gBAC/B,MAAM,EAAE,aAAa,CAAC,MAAM;gBAC5B,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,IAAI,EAAE,aAAa,CAAC,IAAI;aACzB,CAAC,CAAA;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sCAAsC,EAAE,IAAI,CAAC,CAAA;QAE/D,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA;AAnEY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAU0B,sBAAa;GATvC,cAAc,CAmE1B"}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import { OnModuleInit } from '@nestjs/common';
|
|
2
|
-
import { ConfigService } from '@nestjs/config';
|
|
3
|
-
import { ModuleRef } from '@nestjs/core';
|
|
4
1
|
import { IEventHandler } from '../../interfaces';
|
|
5
|
-
import {
|
|
2
|
+
import { AppSyncService } from '../appsync.service';
|
|
6
3
|
import { NotificationEvent } from './notification.event';
|
|
7
|
-
export declare class NotificationEventHandler implements IEventHandler<NotificationEvent
|
|
8
|
-
private readonly
|
|
9
|
-
private readonly explorerService;
|
|
10
|
-
private readonly config;
|
|
4
|
+
export declare class NotificationEventHandler implements IEventHandler<NotificationEvent> {
|
|
5
|
+
private readonly appSyncService;
|
|
11
6
|
private readonly logger;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
constructor(moduleRef: ModuleRef, explorerService: ExplorerService, config: ConfigService);
|
|
15
|
-
onModuleInit(): void;
|
|
16
|
-
execute(event: NotificationEvent): Promise<void>;
|
|
7
|
+
constructor(appSyncService: AppSyncService);
|
|
8
|
+
execute(event: NotificationEvent): Promise<any>;
|
|
17
9
|
}
|
|
@@ -12,48 +12,24 @@ var NotificationEventHandler_1;
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.NotificationEventHandler = void 0;
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
|
-
const config_1 = require("@nestjs/config");
|
|
16
|
-
const core_1 = require("@nestjs/core");
|
|
17
15
|
const decorators_1 = require("../../decorators");
|
|
18
|
-
const
|
|
19
|
-
const services_1 = require("../../services");
|
|
16
|
+
const appsync_service_1 = require("../appsync.service");
|
|
20
17
|
const notification_event_1 = require("./notification.event");
|
|
21
18
|
let NotificationEventHandler = NotificationEventHandler_1 = class NotificationEventHandler {
|
|
22
|
-
constructor(
|
|
23
|
-
this.
|
|
24
|
-
this.explorerService = explorerService;
|
|
25
|
-
this.config = config;
|
|
19
|
+
constructor(appSyncService) {
|
|
20
|
+
this.appSyncService = appSyncService;
|
|
26
21
|
this.logger = new common_1.Logger(NotificationEventHandler_1.name);
|
|
27
|
-
this.transports = new Map();
|
|
28
|
-
this.activeTransportNames = (0, notification_env_validation_1.parseNotificationTransports)(this.config.get('NOTIFICATION_TRANSPORTS'));
|
|
29
|
-
}
|
|
30
|
-
onModuleInit() {
|
|
31
|
-
this.logger.debug('Finding notification transports from decorators');
|
|
32
|
-
const { notificationTransports } = this.explorerService.exploreNotificationTransports();
|
|
33
|
-
for (const TransportClass of notificationTransports) {
|
|
34
|
-
const name = Reflect.getMetadata(decorators_1.NOTIFICATION_TRANSPORT_METADATA, TransportClass);
|
|
35
|
-
if (this.activeTransportNames.includes(name)) {
|
|
36
|
-
const instance = this.moduleRef.get(TransportClass, { strict: false });
|
|
37
|
-
// Give the instance its decorator name automatically if it isn't set
|
|
38
|
-
if (!instance.name) {
|
|
39
|
-
instance.name = name;
|
|
40
|
-
}
|
|
41
|
-
this.transports.set(name, instance);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
this.logger.debug(`Initialized active transports: [${[...this.transports.keys()].join(', ')}]`);
|
|
45
22
|
}
|
|
46
23
|
async execute(event) {
|
|
24
|
+
this.logger.debug('notification event executing:: ', event);
|
|
25
|
+
//send to appsync
|
|
47
26
|
const body = JSON.parse(event.body);
|
|
48
|
-
|
|
49
|
-
await Promise.all([...this.transports.values()].map((t) => t.sendMessage(body)));
|
|
27
|
+
return await this.appSyncService.sendMessage(body);
|
|
50
28
|
}
|
|
51
29
|
};
|
|
52
30
|
exports.NotificationEventHandler = NotificationEventHandler;
|
|
53
31
|
exports.NotificationEventHandler = NotificationEventHandler = NotificationEventHandler_1 = __decorate([
|
|
54
32
|
(0, decorators_1.EventHandler)(notification_event_1.NotificationEvent),
|
|
55
|
-
__metadata("design:paramtypes", [
|
|
56
|
-
services_1.ExplorerService,
|
|
57
|
-
config_1.ConfigService])
|
|
33
|
+
__metadata("design:paramtypes", [appsync_service_1.AppSyncService])
|
|
58
34
|
], NotificationEventHandler);
|
|
59
35
|
//# sourceMappingURL=notification.event.handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.event.handler.js","sourceRoot":"","sources":["../../../src/notifications/event/notification.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"notification.event.handler.js","sourceRoot":"","sources":["../../../src/notifications/event/notification.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAuC;AAEvC,iDAA+C;AAE/C,wDAAmD;AACnD,6DAAwD;AAGjD,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAKnC,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAF1C,WAAM,GAAG,IAAI,eAAM,CAAC,0BAAwB,CAAC,IAAI,CAAC,CAAA;IAEL,CAAC;IAE/D,KAAK,CAAC,OAAO,CAAC,KAAwB;QACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAA;QAC3D,iBAAiB;QACjB,MAAM,IAAI,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAClD,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IACpD,CAAC;CACF,CAAA;AAbY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,yBAAY,EAAC,sCAAiB,CAAC;qCAMe,gCAAc;GALhD,wBAAwB,CAapC"}
|
|
@@ -15,10 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./appsync.service"), exports);
|
|
18
|
-
__exportStar(require("./appsync-events.service"), exports);
|
|
19
18
|
__exportStar(require("./email.service"), exports);
|
|
20
|
-
__exportStar(require("./enums"), exports);
|
|
21
19
|
__exportStar(require("./event"), exports);
|
|
22
|
-
__exportStar(require("./interfaces"), exports);
|
|
23
20
|
__exportStar(require("./notification.module"), exports);
|
|
24
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,kDAA+B;AAC/B,0CAAuB;AACvB,wDAAqC"}
|
|
@@ -8,10 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.NotificationModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
|
-
const config_1 = require("@nestjs/config");
|
|
12
|
-
const services_1 = require("../services");
|
|
13
11
|
const appsync_service_1 = require("./appsync.service");
|
|
14
|
-
const appsync_events_service_1 = require("./appsync-events.service");
|
|
15
12
|
const email_service_1 = require("./email.service");
|
|
16
13
|
const notification_event_handler_1 = require("./event/notification.event.handler");
|
|
17
14
|
let NotificationModule = class NotificationModule {
|
|
@@ -20,15 +17,8 @@ exports.NotificationModule = NotificationModule;
|
|
|
20
17
|
exports.NotificationModule = NotificationModule = __decorate([
|
|
21
18
|
(0, common_1.Global)(),
|
|
22
19
|
(0, common_1.Module)({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
services_1.ExplorerService,
|
|
26
|
-
email_service_1.EmailService,
|
|
27
|
-
notification_event_handler_1.NotificationEventHandler,
|
|
28
|
-
appsync_service_1.AppSyncService,
|
|
29
|
-
appsync_events_service_1.AppSyncEventsService,
|
|
30
|
-
],
|
|
31
|
-
exports: [email_service_1.EmailService, appsync_service_1.AppSyncService, appsync_events_service_1.AppSyncEventsService],
|
|
20
|
+
providers: [appsync_service_1.AppSyncService, email_service_1.EmailService, notification_event_handler_1.NotificationEventHandler],
|
|
21
|
+
exports: [appsync_service_1.AppSyncService, email_service_1.EmailService],
|
|
32
22
|
})
|
|
33
23
|
], NotificationModule);
|
|
34
24
|
//# sourceMappingURL=notification.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.module.js","sourceRoot":"","sources":["../../src/notifications/notification.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA+C;
|
|
1
|
+
{"version":3,"file":"notification.module.js","sourceRoot":"","sources":["../../src/notifications/notification.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA+C;AAE/C,uDAAkD;AAClD,mDAA8C;AAC9C,mFAA6E;AAOtE,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAAG,CAAA;AAArB,gDAAkB;6BAAlB,kBAAkB;IAL9B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,gCAAc,EAAE,4BAAY,EAAE,qDAAwB,CAAC;QACnE,OAAO,EAAE,CAAC,gCAAc,EAAE,4BAAY,CAAC;KACxC,CAAC;GACW,kBAAkB,CAAG"}
|
|
@@ -2,7 +2,6 @@ import { Type } from '@nestjs/common';
|
|
|
2
2
|
import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper';
|
|
3
3
|
import { Module } from '@nestjs/core/injector/module';
|
|
4
4
|
import { ModulesContainer } from '@nestjs/core/injector/modules-container';
|
|
5
|
-
import { IGroupRoleResolver } from '../auth/group-role-resolver.interface';
|
|
6
5
|
import { IDataSyncHandler, IEventFactory, IEventHandler } from '../interfaces';
|
|
7
6
|
export declare class ExplorerService {
|
|
8
7
|
private readonly modulesContainer;
|
|
@@ -15,10 +14,6 @@ export declare class ExplorerService {
|
|
|
15
14
|
exploreDataSyncHandlers(commandTableName: string): {
|
|
16
15
|
dataSyncHandlers: Type<IDataSyncHandler<any, any>>[];
|
|
17
16
|
};
|
|
18
|
-
exploreNotificationTransports(): {
|
|
19
|
-
notificationTransports: Type<any>[];
|
|
20
|
-
};
|
|
21
|
-
exploreGroupRoleResolvers(): Type<IGroupRoleResolver>[];
|
|
22
17
|
flatMap<T>(modules: Module[], callback: (instance: InstanceWrapper) => Type<any> | undefined): Type<T>[];
|
|
23
18
|
filterProvider(wrapper: InstanceWrapper, metadataKey: string, metadataValue?: string): Type<any> | undefined;
|
|
24
19
|
extractMetadata(instance: Record<string, any>, metadataKey: string, metadataValue?: string): Type<any>;
|
|
@@ -27,20 +27,9 @@ let ExplorerService = ExplorerService_1 = class ExplorerService {
|
|
|
27
27
|
}
|
|
28
28
|
exploreDataSyncHandlers(commandTableName) {
|
|
29
29
|
const modules = [...this.modulesContainer.values()];
|
|
30
|
-
const dataSyncHandlers =
|
|
31
|
-
...new Set(this.flatMap(modules, (instance) => this.filterProvider(instance, decorators_1.DATA_SYNC_HANDLER_METADATA, commandTableName))),
|
|
32
|
-
];
|
|
30
|
+
const dataSyncHandlers = this.flatMap(modules, (instance) => this.filterProvider(instance, decorators_1.DATA_SYNC_HANDLER_METADATA, commandTableName));
|
|
33
31
|
return { dataSyncHandlers };
|
|
34
32
|
}
|
|
35
|
-
exploreNotificationTransports() {
|
|
36
|
-
const modules = [...this.modulesContainer.values()];
|
|
37
|
-
const notificationTransports = this.flatMap(modules, (instance) => this.filterProvider(instance, decorators_1.NOTIFICATION_TRANSPORT_METADATA));
|
|
38
|
-
return { notificationTransports };
|
|
39
|
-
}
|
|
40
|
-
exploreGroupRoleResolvers() {
|
|
41
|
-
const modules = [...this.modulesContainer.values()];
|
|
42
|
-
return this.flatMap(modules, (instance) => this.filterProvider(instance, decorators_1.GROUP_ROLE_RESOLVER_METADATA));
|
|
43
|
-
}
|
|
44
33
|
flatMap(modules, callback) {
|
|
45
34
|
const items = modules
|
|
46
35
|
.map((module) => [...module.providers.values()].map(callback))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explorer.service.js","sourceRoot":"","sources":["../../src/services/explorer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAyD;AAGzD,+EAA0E;
|
|
1
|
+
{"version":3,"file":"explorer.service.js","sourceRoot":"","sources":["../../src/services/explorer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAyD;AAGzD,+EAA0E;AAE1E,8CAIsB;AAIf,IAAM,eAAe,uBAArB,MAAM,eAAe;IAG1B,YAA6B,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAF9C,WAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAA;IA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AAc,CAAA;IAC1D,CAAC;IAED,cAAc,CACZ,OAAwB,EACxB,WAAmB,EACnB,aAAsB;QAEtB,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;QAC5B,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,CAAC,CAAA;IACnE,CAAC;IAED,eAAe,CACb,QAA6B,EAC7B,WAAmB,EACnB,aAAsB;QAEtB,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAC1B,OAAM;QACR,CAAC;QACD,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAA;QACvE,IAAI,CAAC,QAAQ,IAAI,CAAC,aAAa,IAAI,QAAQ,KAAK,aAAa,CAAC,EAAE,CAAC;YAC/D,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,OAAO,QAAQ,CAAC,WAAwB,CAAA;IAC1C,CAAC;CACF,CAAA;AAnEY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAIoC,oCAAgB;GAHpD,eAAe,CAmE3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbc-cqrs-serverless/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "CQRS and event base core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mbc",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@aws-crypto/sha256-js": "^5.2.0",
|
|
54
54
|
"@codegenie/serverless-express": "^4.13.0",
|
|
55
55
|
"@nestjs/common": "^10.3.0",
|
|
56
|
-
"@nestjs/config": "^
|
|
56
|
+
"@nestjs/config": "^3.1.1",
|
|
57
57
|
"@nestjs/core": "^10.3.0",
|
|
58
58
|
"@nestjs/mapped-types": "^2.0.4",
|
|
59
59
|
"@nestjs/platform-express": "^10.3.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"class-validator": "^0.14.0",
|
|
63
63
|
"jwt-decode": "^4.0.0",
|
|
64
64
|
"node-fetch": "^2.7.0",
|
|
65
|
-
"nodemailer": "^
|
|
65
|
+
"nodemailer": "^8.0.5",
|
|
66
66
|
"reflect-metadata": "^0.2.2",
|
|
67
67
|
"ulid": "^2.3.0"
|
|
68
68
|
},
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"serverless-step-functions-local": "^0.5.1",
|
|
89
89
|
"supertest": "^7.0.0"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "3307005192eff1d8ac1eae7e72b838fe7ff95af9"
|
|
92
92
|
}
|