@flusys/nestjs-shared 7.0.2 → 8.0.0-beta.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/classes/api-controller.class.d.ts +4 -4
- package/classes/api-service.class.d.ts +7 -7
- package/classes/disabled-event-bus.class.d.ts +1 -1
- package/classes/domain-event.publisher.d.ts +1 -1
- package/classes/event-bus.registry.d.ts +1 -1
- package/classes/event-transports/event-transport.registry.d.ts +1 -1
- package/classes/event-transports/index.d.ts +2 -2
- package/classes/event-transports/kafka-transport.optional.d.ts +1 -1
- package/classes/event-transports/memory-transport.d.ts +1 -1
- package/classes/event-transports/rabbitmq-transport.optional.d.ts +1 -1
- package/classes/hybrid-event-bus.class.d.ts +1 -1
- package/classes/index.d.ts +11 -11
- package/constants/index.d.ts +2 -2
- package/constants/permissions.d.ts +12 -0
- package/decorators/api-response.decorator.d.ts +1 -1
- package/decorators/current-user.decorator.d.ts +1 -1
- package/decorators/index.d.ts +6 -6
- package/decorators/require-permission.decorator.d.ts +1 -1
- package/dtos/filter-and-pagination.dto.d.ts +1 -1
- package/dtos/index.d.ts +6 -6
- package/entities/index.d.ts +3 -3
- package/enums/index.d.ts +3 -3
- package/exceptions/index.d.ts +2 -2
- package/fesm/470.js +2713 -0
- package/fesm/509.js +793 -0
- package/fesm/667.js +606 -0
- package/fesm/67.js +808 -0
- package/fesm/720.js +914 -0
- package/{cjs/classes/event-transports/rabbitmq-transport.optional.js → fesm/chunks/123.js} +78 -55
- package/fesm/{classes/event-transports/kafka-transport.optional.js → chunks/37.js} +74 -41
- package/fesm/classes/index.js +62 -12
- package/fesm/constants/index.js +445 -17
- package/fesm/decorators/index.js +341 -6
- package/fesm/dtos/index.js +23 -6
- package/fesm/entities/index.js +336 -3
- package/fesm/enums/index.js +57 -3
- package/fesm/exceptions/index.js +280 -2
- package/fesm/guards/index.js +1003 -3
- package/fesm/index.js +1524 -14
- package/fesm/interceptors/index.js +924 -5
- package/fesm/interfaces/index.js +57 -11
- package/fesm/middlewares/index.js +33 -1
- package/fesm/modules/index.js +432 -9
- package/fesm/runtime.js +134 -0
- package/fesm/utils/index.js +1045 -8
- package/filters/global-exception.filter.d.ts +1 -1
- package/filters/index.d.ts +1 -1
- package/guards/index.d.ts +3 -3
- package/guards/jwt-auth.guard.d.ts +1 -1
- package/guards/optional-jwt-auth.guard.d.ts +1 -1
- package/guards/permission.guard.d.ts +2 -2
- package/index.d.ts +14 -14
- package/interceptors/delete-empty-id-from-body.interceptor.d.ts +1 -1
- package/interceptors/idempotency.interceptor.d.ts +2 -2
- package/interceptors/index.d.ts +5 -5
- package/interceptors/response-meta.interceptor.d.ts +1 -1
- package/interceptors/set-user-field-on-body.interceptor.d.ts +1 -1
- package/interceptors/slug.interceptor.d.ts +2 -2
- package/interfaces/ai-assistant-adapter.interface.d.ts +1 -1
- package/interfaces/api.interface.d.ts +2 -2
- package/interfaces/datasource.interface.d.ts +1 -1
- package/interfaces/event-manager-adapter.interface.d.ts +2 -2
- package/interfaces/index.d.ts +11 -11
- package/interfaces/module-config.interface.d.ts +1 -1
- package/interfaces/notification-adapter.interface.d.ts +1 -1
- package/middlewares/index.d.ts +1 -1
- package/middlewares/logger.middleware.d.ts +2 -2
- package/modules/cache/cache.module.d.ts +1 -1
- package/modules/datasource/index.d.ts +1 -1
- package/modules/datasource/multi-tenant-datasource.service.d.ts +4 -4
- package/modules/event-bus/event-bus.explorer.d.ts +2 -2
- package/modules/event-bus/event-bus.module.d.ts +2 -2
- package/modules/event-bus/module-events.provider.d.ts +1 -1
- package/modules/index.d.ts +9 -9
- package/modules/shared-permission-cache/shared-permission-cache.service.d.ts +3 -3
- package/modules/utils/utils.service.d.ts +1 -1
- package/package.json +30 -44
- package/utils/index.d.ts +8 -8
- package/utils/permission-cache-key.util.d.ts +1 -1
- package/utils/query-helpers.util.d.ts +2 -2
- package/utils/request.util.d.ts +1 -1
- package/cjs/classes/api-controller.class.js +0 -728
- package/cjs/classes/api-controller.class.spec.js +0 -684
- package/cjs/classes/api-service.class.js +0 -631
- package/cjs/classes/api-service.class.spec.js +0 -1137
- package/cjs/classes/disabled-event-bus.class.js +0 -15
- package/cjs/classes/disabled-event-bus.class.spec.js +0 -40
- package/cjs/classes/domain-event.publisher.js +0 -76
- package/cjs/classes/domain-event.publisher.spec.js +0 -234
- package/cjs/classes/event-bus.registry.js +0 -68
- package/cjs/classes/event-bus.registry.spec.js +0 -141
- package/cjs/classes/event-transports/event-transport.registry.js +0 -41
- package/cjs/classes/event-transports/event-transport.registry.spec.js +0 -31
- package/cjs/classes/event-transports/index.js +0 -23
- package/cjs/classes/event-transports/kafka-transport.optional.js +0 -151
- package/cjs/classes/event-transports/kafka-transport.optional.spec.js +0 -198
- package/cjs/classes/event-transports/memory-transport.js +0 -53
- package/cjs/classes/event-transports/memory-transport.spec.js +0 -57
- package/cjs/classes/event-transports/rabbitmq-transport.optional.spec.js +0 -255
- package/cjs/classes/handle-custome-db.js +0 -37
- package/cjs/classes/handle-custome-db.spec.js +0 -82
- package/cjs/classes/hybrid-cache.class.js +0 -96
- package/cjs/classes/hybrid-cache.class.spec.js +0 -168
- package/cjs/classes/hybrid-event-bus.class.js +0 -281
- package/cjs/classes/hybrid-event-bus.class.spec.js +0 -218
- package/cjs/classes/index.js +0 -28
- package/cjs/classes/winston.logger.class.js +0 -274
- package/cjs/classes/winston.logger.class.spec.js +0 -330
- package/cjs/constants/index.js +0 -88
- package/cjs/constants/message-keys.js +0 -68
- package/cjs/constants/permissions.js +0 -297
- package/cjs/decorators/api-response.decorator.js +0 -52
- package/cjs/decorators/api-response.decorator.spec.js +0 -126
- package/cjs/decorators/current-user.decorator.js +0 -16
- package/cjs/decorators/current-user.decorator.spec.js +0 -74
- package/cjs/decorators/index.js +0 -23
- package/cjs/decorators/log-action.decorator.js +0 -149
- package/cjs/decorators/log-action.decorator.spec.js +0 -353
- package/cjs/decorators/on-domain-event.decorator.js +0 -13
- package/cjs/decorators/on-domain-event.decorator.spec.js +0 -50
- package/cjs/decorators/public.decorator.js +0 -13
- package/cjs/decorators/public.decorator.spec.js +0 -50
- package/cjs/decorators/require-permission.decorator.js +0 -32
- package/cjs/decorators/require-permission.decorator.spec.js +0 -147
- package/cjs/dtos/delete.dto.js +0 -92
- package/cjs/dtos/filter-and-pagination.dto.js +0 -164
- package/cjs/dtos/get-by-ids.dto.js +0 -65
- package/cjs/dtos/identity-response.dto.js +0 -108
- package/cjs/dtos/index.js +0 -23
- package/cjs/dtos/pagination.dto.js +0 -67
- package/cjs/dtos/response-payload.dto.js +0 -369
- package/cjs/entities/identity.js +0 -100
- package/cjs/entities/index.js +0 -20
- package/cjs/entities/raw-type.js +0 -4
- package/cjs/entities/user-root.js +0 -189
- package/cjs/enums/index.js +0 -20
- package/cjs/enums/notification-type.enum.js +0 -17
- package/cjs/enums/participant-status.enum.js +0 -17
- package/cjs/enums/recurrence-type.enum.js +0 -18
- package/cjs/exceptions/base-app.exception.js +0 -151
- package/cjs/exceptions/base-app.exception.spec.js +0 -157
- package/cjs/exceptions/index.js +0 -19
- package/cjs/exceptions/permission.exception.js +0 -56
- package/cjs/exceptions/permission.exception.spec.js +0 -82
- package/cjs/filters/global-exception.filter.js +0 -279
- package/cjs/filters/global-exception.filter.spec.js +0 -440
- package/cjs/filters/index.js +0 -18
- package/cjs/guards/index.js +0 -20
- package/cjs/guards/jwt-auth.guard.js +0 -75
- package/cjs/guards/jwt-auth.guard.spec.js +0 -75
- package/cjs/guards/optional-jwt-auth.guard.js +0 -67
- package/cjs/guards/optional-jwt-auth.guard.spec.js +0 -55
- package/cjs/guards/permission.guard.js +0 -179
- package/cjs/guards/permission.guard.spec.js +0 -373
- package/cjs/index.js +0 -31
- package/cjs/interceptors/delete-empty-id-from-body.interceptor.js +0 -40
- package/cjs/interceptors/delete-empty-id-from-body.interceptor.spec.js +0 -107
- package/cjs/interceptors/idempotency.interceptor.js +0 -96
- package/cjs/interceptors/idempotency.interceptor.spec.js +0 -116
- package/cjs/interceptors/index.js +0 -22
- package/cjs/interceptors/response-meta.interceptor.js +0 -47
- package/cjs/interceptors/response-meta.interceptor.spec.js +0 -89
- package/cjs/interceptors/set-user-field-on-body.interceptor.js +0 -60
- package/cjs/interceptors/set-user-field-on-body.interceptor.spec.js +0 -128
- package/cjs/interceptors/slug.interceptor.js +0 -75
- package/cjs/interceptors/slug.interceptor.spec.js +0 -110
- package/cjs/interfaces/ai-assistant-adapter.interface.js +0 -24
- package/cjs/interfaces/api.interface.js +0 -4
- package/cjs/interfaces/datasource.interface.js +0 -4
- package/cjs/interfaces/event-bus.interface.js +0 -4
- package/cjs/interfaces/event-manager-adapter.interface.js +0 -11
- package/cjs/interfaces/identity.interface.js +0 -4
- package/cjs/interfaces/index.js +0 -28
- package/cjs/interfaces/logged-user-info.interface.js +0 -6
- package/cjs/interfaces/module-config.interface.js +0 -4
- package/cjs/interfaces/notification-adapter.interface.js +0 -11
- package/cjs/interfaces/permission-sync-adapter.interface.js +0 -11
- package/cjs/interfaces/permission.interface.js +0 -4
- package/cjs/middlewares/index.js +0 -18
- package/cjs/middlewares/logger.middleware.js +0 -264
- package/cjs/middlewares/logger.middleware.spec.js +0 -462
- package/cjs/modules/cache/cache.module.js +0 -39
- package/cjs/modules/cache/cache.module.spec.js +0 -48
- package/cjs/modules/datasource/index.js +0 -18
- package/cjs/modules/datasource/multi-tenant-datasource.service.js +0 -222
- package/cjs/modules/datasource/multi-tenant-datasource.service.spec.js +0 -381
- package/cjs/modules/event-bus/event-bus.explorer.js +0 -124
- package/cjs/modules/event-bus/event-bus.explorer.spec.js +0 -189
- package/cjs/modules/event-bus/event-bus.integration.spec.js +0 -253
- package/cjs/modules/event-bus/event-bus.module.js +0 -94
- package/cjs/modules/event-bus/event-bus.module.spec.js +0 -149
- package/cjs/modules/event-bus/module-events.provider.js +0 -39
- package/cjs/modules/event-bus/module-events.provider.spec.js +0 -56
- package/cjs/modules/index.js +0 -26
- package/cjs/modules/shared-permission-cache/shared-permission-cache.module.js +0 -32
- package/cjs/modules/shared-permission-cache/shared-permission-cache.service.js +0 -101
- package/cjs/modules/shared-permission-cache/shared-permission-cache.service.spec.js +0 -165
- package/cjs/modules/utils/utils.module.js +0 -32
- package/cjs/modules/utils/utils.service.js +0 -76
- package/cjs/modules/utils/utils.service.spec.js +0 -169
- package/cjs/utils/date-time.util.js +0 -94
- package/cjs/utils/date-time.util.spec.js +0 -84
- package/cjs/utils/event-pattern.util.js +0 -103
- package/cjs/utils/event-pattern.util.spec.js +0 -251
- package/cjs/utils/html-sanitizer.util.js +0 -64
- package/cjs/utils/html-sanitizer.util.spec.js +0 -76
- package/cjs/utils/index.js +0 -25
- package/cjs/utils/optional-module.util.js +0 -35
- package/cjs/utils/optional-module.util.spec.js +0 -14
- package/cjs/utils/permission-cache-key.util.js +0 -31
- package/cjs/utils/permission-cache-key.util.spec.js +0 -88
- package/cjs/utils/query-helpers.util.js +0 -60
- package/cjs/utils/query-helpers.util.spec.js +0 -209
- package/cjs/utils/request.util.js +0 -96
- package/cjs/utils/request.util.spec.js +0 -249
- package/cjs/utils/string.util.js +0 -63
- package/cjs/utils/string.util.spec.js +0 -63
- package/fesm/classes/api-controller.class.js +0 -718
- package/fesm/classes/api-controller.class.spec.js +0 -680
- package/fesm/classes/api-service.class.js +0 -621
- package/fesm/classes/api-service.class.spec.js +0 -1133
- package/fesm/classes/disabled-event-bus.class.js +0 -11
- package/fesm/classes/disabled-event-bus.class.spec.js +0 -36
- package/fesm/classes/domain-event.publisher.js +0 -63
- package/fesm/classes/domain-event.publisher.spec.js +0 -230
- package/fesm/classes/event-bus.registry.js +0 -64
- package/fesm/classes/event-bus.registry.spec.js +0 -137
- package/fesm/classes/event-transports/event-transport.registry.js +0 -35
- package/fesm/classes/event-transports/event-transport.registry.spec.js +0 -27
- package/fesm/classes/event-transports/index.js +0 -6
- package/fesm/classes/event-transports/kafka-transport.optional.spec.js +0 -194
- package/fesm/classes/event-transports/memory-transport.js +0 -49
- package/fesm/classes/event-transports/memory-transport.spec.js +0 -53
- package/fesm/classes/event-transports/rabbitmq-transport.optional.js +0 -174
- package/fesm/classes/event-transports/rabbitmq-transport.optional.spec.js +0 -251
- package/fesm/classes/handle-custome-db.js +0 -19
- package/fesm/classes/handle-custome-db.spec.js +0 -78
- package/fesm/classes/hybrid-cache.class.js +0 -81
- package/fesm/classes/hybrid-cache.class.spec.js +0 -164
- package/fesm/classes/hybrid-event-bus.class.js +0 -237
- package/fesm/classes/hybrid-event-bus.class.spec.js +0 -214
- package/fesm/classes/winston.logger.class.js +0 -228
- package/fesm/classes/winston.logger.class.spec.js +0 -327
- package/fesm/constants/message-keys.js +0 -49
- package/fesm/constants/permissions.js +0 -208
- package/fesm/decorators/api-response.decorator.js +0 -42
- package/fesm/decorators/api-response.decorator.spec.js +0 -122
- package/fesm/decorators/current-user.decorator.js +0 -18
- package/fesm/decorators/current-user.decorator.spec.js +0 -73
- package/fesm/decorators/log-action.decorator.js +0 -139
- package/fesm/decorators/log-action.decorator.spec.js +0 -349
- package/fesm/decorators/on-domain-event.decorator.js +0 -10
- package/fesm/decorators/on-domain-event.decorator.spec.js +0 -46
- package/fesm/decorators/public.decorator.js +0 -20
- package/fesm/decorators/public.decorator.spec.js +0 -46
- package/fesm/decorators/require-permission.decorator.js +0 -27
- package/fesm/decorators/require-permission.decorator.spec.js +0 -143
- package/fesm/dtos/delete.dto.js +0 -82
- package/fesm/dtos/filter-and-pagination.dto.js +0 -148
- package/fesm/dtos/get-by-ids.dto.js +0 -55
- package/fesm/dtos/identity-response.dto.js +0 -98
- package/fesm/dtos/pagination.dto.js +0 -57
- package/fesm/dtos/response-payload.dto.js +0 -336
- package/fesm/entities/identity.js +0 -90
- package/fesm/entities/raw-type.js +0 -1
- package/fesm/entities/user-root.js +0 -179
- package/fesm/enums/notification-type.enum.js +0 -7
- package/fesm/enums/participant-status.enum.js +0 -7
- package/fesm/enums/recurrence-type.enum.js +0 -8
- package/fesm/exceptions/base-app.exception.js +0 -115
- package/fesm/exceptions/base-app.exception.spec.js +0 -153
- package/fesm/exceptions/permission.exception.js +0 -35
- package/fesm/exceptions/permission.exception.spec.js +0 -78
- package/fesm/filters/global-exception.filter.js +0 -269
- package/fesm/filters/global-exception.filter.spec.js +0 -436
- package/fesm/filters/index.js +0 -1
- package/fesm/guards/jwt-auth.guard.js +0 -65
- package/fesm/guards/jwt-auth.guard.spec.js +0 -71
- package/fesm/guards/optional-jwt-auth.guard.js +0 -57
- package/fesm/guards/optional-jwt-auth.guard.spec.js +0 -51
- package/fesm/guards/permission.guard.js +0 -169
- package/fesm/guards/permission.guard.spec.js +0 -369
- package/fesm/interceptors/delete-empty-id-from-body.interceptor.js +0 -30
- package/fesm/interceptors/delete-empty-id-from-body.interceptor.spec.js +0 -103
- package/fesm/interceptors/idempotency.interceptor.js +0 -86
- package/fesm/interceptors/idempotency.interceptor.spec.js +0 -112
- package/fesm/interceptors/response-meta.interceptor.js +0 -37
- package/fesm/interceptors/response-meta.interceptor.spec.js +0 -85
- package/fesm/interceptors/set-user-field-on-body.interceptor.js +0 -39
- package/fesm/interceptors/set-user-field-on-body.interceptor.spec.js +0 -124
- package/fesm/interceptors/slug.interceptor.js +0 -65
- package/fesm/interceptors/slug.interceptor.spec.js +0 -106
- package/fesm/interfaces/ai-assistant-adapter.interface.js +0 -3
- package/fesm/interfaces/api.interface.js +0 -1
- package/fesm/interfaces/datasource.interface.js +0 -1
- package/fesm/interfaces/event-bus.interface.js +0 -1
- package/fesm/interfaces/event-manager-adapter.interface.js +0 -1
- package/fesm/interfaces/identity.interface.js +0 -1
- package/fesm/interfaces/logged-user-info.interface.js +0 -3
- package/fesm/interfaces/module-config.interface.js +0 -5
- package/fesm/interfaces/notification-adapter.interface.js +0 -1
- package/fesm/interfaces/permission-sync-adapter.interface.js +0 -1
- package/fesm/interfaces/permission.interface.js +0 -1
- package/fesm/middlewares/logger.middleware.js +0 -235
- package/fesm/middlewares/logger.middleware.spec.js +0 -459
- package/fesm/modules/cache/cache.module.js +0 -29
- package/fesm/modules/cache/cache.module.spec.js +0 -44
- package/fesm/modules/datasource/index.js +0 -1
- package/fesm/modules/datasource/multi-tenant-datasource.service.js +0 -212
- package/fesm/modules/datasource/multi-tenant-datasource.service.spec.js +0 -377
- package/fesm/modules/event-bus/event-bus.explorer.js +0 -114
- package/fesm/modules/event-bus/event-bus.explorer.spec.js +0 -185
- package/fesm/modules/event-bus/event-bus.integration.spec.js +0 -249
- package/fesm/modules/event-bus/event-bus.module.js +0 -84
- package/fesm/modules/event-bus/event-bus.module.spec.js +0 -145
- package/fesm/modules/event-bus/module-events.provider.js +0 -26
- package/fesm/modules/event-bus/module-events.provider.spec.js +0 -52
- package/fesm/modules/shared-permission-cache/shared-permission-cache.module.js +0 -22
- package/fesm/modules/shared-permission-cache/shared-permission-cache.service.js +0 -91
- package/fesm/modules/shared-permission-cache/shared-permission-cache.service.spec.js +0 -161
- package/fesm/modules/utils/utils.module.js +0 -22
- package/fesm/modules/utils/utils.service.js +0 -66
- package/fesm/modules/utils/utils.service.spec.js +0 -165
- package/fesm/utils/date-time.util.js +0 -70
- package/fesm/utils/date-time.util.spec.js +0 -80
- package/fesm/utils/event-pattern.util.js +0 -91
- package/fesm/utils/event-pattern.util.spec.js +0 -247
- package/fesm/utils/html-sanitizer.util.js +0 -69
- package/fesm/utils/html-sanitizer.util.spec.js +0 -72
- package/fesm/utils/optional-module.util.js +0 -25
- package/fesm/utils/optional-module.util.spec.js +0 -10
- package/fesm/utils/permission-cache-key.util.js +0 -10
- package/fesm/utils/permission-cache-key.util.spec.js +0 -84
- package/fesm/utils/query-helpers.util.js +0 -85
- package/fesm/utils/query-helpers.util.spec.js +0 -205
- package/fesm/utils/request.util.js +0 -81
- package/fesm/utils/request.util.spec.js +0 -245
- package/fesm/utils/string.util.js +0 -71
- package/fesm/utils/string.util.spec.js +0 -59
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "NotificationType", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return NotificationType;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var NotificationType = /*#__PURE__*/ function(NotificationType) {
|
|
12
|
-
NotificationType["INFO"] = "info";
|
|
13
|
-
NotificationType["WARNING"] = "warning";
|
|
14
|
-
NotificationType["SUCCESS"] = "success";
|
|
15
|
-
NotificationType["ERROR"] = "error";
|
|
16
|
-
return NotificationType;
|
|
17
|
-
}({});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "ParticipantStatus", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return ParticipantStatus;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var ParticipantStatus = /*#__PURE__*/ function(ParticipantStatus) {
|
|
12
|
-
ParticipantStatus["PENDING"] = "pending";
|
|
13
|
-
ParticipantStatus["ACCEPTED"] = "accepted";
|
|
14
|
-
ParticipantStatus["DECLINED"] = "declined";
|
|
15
|
-
ParticipantStatus["TENTATIVE"] = "tentative";
|
|
16
|
-
return ParticipantStatus;
|
|
17
|
-
}({});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "RecurrenceType", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return RecurrenceType;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var RecurrenceType = /*#__PURE__*/ function(RecurrenceType) {
|
|
12
|
-
RecurrenceType["NONE"] = "none";
|
|
13
|
-
RecurrenceType["DAILY"] = "daily";
|
|
14
|
-
RecurrenceType["WEEKLY"] = "weekly";
|
|
15
|
-
RecurrenceType["BIWEEKLY"] = "biweekly";
|
|
16
|
-
RecurrenceType["MONTHLY"] = "monthly";
|
|
17
|
-
return RecurrenceType;
|
|
18
|
-
}({});
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get BaseAppException () {
|
|
13
|
-
return BaseAppException;
|
|
14
|
-
},
|
|
15
|
-
get ConflictException () {
|
|
16
|
-
return ConflictException;
|
|
17
|
-
},
|
|
18
|
-
get ForbiddenException () {
|
|
19
|
-
return ForbiddenException;
|
|
20
|
-
},
|
|
21
|
-
get InternalServerException () {
|
|
22
|
-
return InternalServerException;
|
|
23
|
-
},
|
|
24
|
-
get NotFoundException () {
|
|
25
|
-
return NotFoundException;
|
|
26
|
-
},
|
|
27
|
-
get ServiceUnavailableException () {
|
|
28
|
-
return ServiceUnavailableException;
|
|
29
|
-
},
|
|
30
|
-
get UnauthorizedException () {
|
|
31
|
-
return UnauthorizedException;
|
|
32
|
-
},
|
|
33
|
-
get ValidationException () {
|
|
34
|
-
return ValidationException;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const _common = require("@nestjs/common");
|
|
38
|
-
const _messagekeys = require("../constants/message-keys");
|
|
39
|
-
function _define_property(obj, key, value) {
|
|
40
|
-
if (key in obj) {
|
|
41
|
-
Object.defineProperty(obj, key, {
|
|
42
|
-
value: value,
|
|
43
|
-
enumerable: true,
|
|
44
|
-
configurable: true,
|
|
45
|
-
writable: true
|
|
46
|
-
});
|
|
47
|
-
} else {
|
|
48
|
-
obj[key] = value;
|
|
49
|
-
}
|
|
50
|
-
return obj;
|
|
51
|
-
}
|
|
52
|
-
let BaseAppException = class BaseAppException extends _common.HttpException {
|
|
53
|
-
constructor(options){
|
|
54
|
-
const status = options.status || _common.HttpStatus.BAD_REQUEST;
|
|
55
|
-
super({
|
|
56
|
-
success: false,
|
|
57
|
-
message: options.message,
|
|
58
|
-
messageKey: options.messageKey || _messagekeys.ERROR_MESSAGES.GENERIC,
|
|
59
|
-
messageVariables: options.messageVariables,
|
|
60
|
-
errors: options.errors
|
|
61
|
-
}, status), _define_property(this, "messageKey", void 0), _define_property(this, "messageVariables", void 0), _define_property(this, "errors", void 0), _define_property(this, "metadata", void 0);
|
|
62
|
-
this.messageKey = options.messageKey || _messagekeys.ERROR_MESSAGES.GENERIC;
|
|
63
|
-
this.messageVariables = options.messageVariables;
|
|
64
|
-
this.errors = options.errors;
|
|
65
|
-
this.metadata = options.metadata;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
let NotFoundException = class NotFoundException extends BaseAppException {
|
|
69
|
-
constructor(entity, id){
|
|
70
|
-
super({
|
|
71
|
-
message: id ? `${entity} with id "${id}" not found` : `${entity} not found`,
|
|
72
|
-
messageKey: _messagekeys.ERROR_MESSAGES.NOT_FOUND,
|
|
73
|
-
status: _common.HttpStatus.NOT_FOUND,
|
|
74
|
-
metadata: {
|
|
75
|
-
entity,
|
|
76
|
-
id
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
let ValidationException = class ValidationException extends BaseAppException {
|
|
82
|
-
constructor(errors){
|
|
83
|
-
super({
|
|
84
|
-
message: 'Validation failed',
|
|
85
|
-
messageKey: _messagekeys.ERROR_MESSAGES.VALIDATION,
|
|
86
|
-
status: _common.HttpStatus.BAD_REQUEST,
|
|
87
|
-
errors
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
let UnauthorizedException = class UnauthorizedException extends BaseAppException {
|
|
92
|
-
constructor(message = 'Unauthorized access'){
|
|
93
|
-
super({
|
|
94
|
-
message,
|
|
95
|
-
messageKey: _messagekeys.ERROR_MESSAGES.UNAUTHORIZED,
|
|
96
|
-
status: _common.HttpStatus.UNAUTHORIZED
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
let ForbiddenException = class ForbiddenException extends BaseAppException {
|
|
101
|
-
constructor(message = 'Access forbidden'){
|
|
102
|
-
super({
|
|
103
|
-
message,
|
|
104
|
-
messageKey: _messagekeys.ERROR_MESSAGES.FORBIDDEN,
|
|
105
|
-
status: _common.HttpStatus.FORBIDDEN
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
let ConflictException = class ConflictException extends BaseAppException {
|
|
110
|
-
constructor(entity, field){
|
|
111
|
-
super({
|
|
112
|
-
message: field ? `${entity} with this ${field} already exists` : `${entity} already exists`,
|
|
113
|
-
messageKey: _messagekeys.ERROR_MESSAGES.CONFLICT,
|
|
114
|
-
messageVariables: {
|
|
115
|
-
entity,
|
|
116
|
-
...field !== undefined && {
|
|
117
|
-
field
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
status: _common.HttpStatus.CONFLICT,
|
|
121
|
-
metadata: {
|
|
122
|
-
entity,
|
|
123
|
-
field
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
let InternalServerException = class InternalServerException extends BaseAppException {
|
|
129
|
-
constructor(message = 'Internal server error'){
|
|
130
|
-
super({
|
|
131
|
-
message,
|
|
132
|
-
messageKey: _messagekeys.ERROR_MESSAGES.INTERNAL,
|
|
133
|
-
status: _common.HttpStatus.INTERNAL_SERVER_ERROR
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
let ServiceUnavailableException = class ServiceUnavailableException extends BaseAppException {
|
|
138
|
-
constructor(service){
|
|
139
|
-
super({
|
|
140
|
-
message: `${service} is temporarily unavailable`,
|
|
141
|
-
messageKey: _messagekeys.ERROR_MESSAGES.SERVICE_UNAVAILABLE,
|
|
142
|
-
messageVariables: {
|
|
143
|
-
service
|
|
144
|
-
},
|
|
145
|
-
status: _common.HttpStatus.SERVICE_UNAVAILABLE,
|
|
146
|
-
metadata: {
|
|
147
|
-
service
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
};
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
const _common = require("@nestjs/common");
|
|
6
|
-
const _messagekeys = require("../constants/message-keys");
|
|
7
|
-
const _baseappexception = require("./base-app.exception");
|
|
8
|
-
describe('BaseAppException', ()=>{
|
|
9
|
-
it('should default status to BAD_REQUEST when not provided', ()=>{
|
|
10
|
-
const exception = new _baseappexception.BaseAppException({
|
|
11
|
-
message: 'oops'
|
|
12
|
-
});
|
|
13
|
-
expect(exception.getStatus()).toBe(_common.HttpStatus.BAD_REQUEST);
|
|
14
|
-
});
|
|
15
|
-
it('should default messageKey to ERROR_MESSAGES.GENERIC when not provided', ()=>{
|
|
16
|
-
const exception = new _baseappexception.BaseAppException({
|
|
17
|
-
message: 'oops'
|
|
18
|
-
});
|
|
19
|
-
expect(exception.messageKey).toBe(_messagekeys.ERROR_MESSAGES.GENERIC);
|
|
20
|
-
});
|
|
21
|
-
it('should use the provided status, messageKey, messageVariables, errors, and metadata', ()=>{
|
|
22
|
-
const errors = [
|
|
23
|
-
{
|
|
24
|
-
field: 'name',
|
|
25
|
-
message: 'required'
|
|
26
|
-
}
|
|
27
|
-
];
|
|
28
|
-
const exception = new _baseappexception.BaseAppException({
|
|
29
|
-
message: 'Invalid',
|
|
30
|
-
messageKey: 'custom.key',
|
|
31
|
-
messageVariables: {
|
|
32
|
-
foo: 'bar'
|
|
33
|
-
},
|
|
34
|
-
status: _common.HttpStatus.UNPROCESSABLE_ENTITY,
|
|
35
|
-
errors,
|
|
36
|
-
metadata: {
|
|
37
|
-
extra: true
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
expect(exception.getStatus()).toBe(_common.HttpStatus.UNPROCESSABLE_ENTITY);
|
|
41
|
-
expect(exception.messageKey).toBe('custom.key');
|
|
42
|
-
expect(exception.messageVariables).toEqual({
|
|
43
|
-
foo: 'bar'
|
|
44
|
-
});
|
|
45
|
-
expect(exception.errors).toEqual(errors);
|
|
46
|
-
expect(exception.metadata).toEqual({
|
|
47
|
-
extra: true
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
it('should build an HttpException response body with success:false', ()=>{
|
|
51
|
-
const exception = new _baseappexception.BaseAppException({
|
|
52
|
-
message: 'oops',
|
|
53
|
-
messageKey: 'k'
|
|
54
|
-
});
|
|
55
|
-
expect(exception.getResponse()).toEqual({
|
|
56
|
-
success: false,
|
|
57
|
-
message: 'oops',
|
|
58
|
-
messageKey: 'k',
|
|
59
|
-
messageVariables: undefined,
|
|
60
|
-
errors: undefined
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
describe('NotFoundException', ()=>{
|
|
64
|
-
it('should build a message with id when id is provided', ()=>{
|
|
65
|
-
const exception = new _baseappexception.NotFoundException('User', 'uuid-1');
|
|
66
|
-
expect(exception.getStatus()).toBe(_common.HttpStatus.NOT_FOUND);
|
|
67
|
-
expect(exception.message).toBe('User with id "uuid-1" not found');
|
|
68
|
-
expect(exception.messageKey).toBe(_messagekeys.ERROR_MESSAGES.NOT_FOUND);
|
|
69
|
-
expect(exception.metadata).toEqual({
|
|
70
|
-
entity: 'User',
|
|
71
|
-
id: 'uuid-1'
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
it('should build a message without id when id is omitted', ()=>{
|
|
75
|
-
const exception = new _baseappexception.NotFoundException('User');
|
|
76
|
-
expect(exception.message).toBe('User not found');
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
describe('ValidationException', ()=>{
|
|
80
|
-
it('should carry the validation errors and BAD_REQUEST status', ()=>{
|
|
81
|
-
const errors = [
|
|
82
|
-
{
|
|
83
|
-
field: 'email',
|
|
84
|
-
message: 'invalid format'
|
|
85
|
-
}
|
|
86
|
-
];
|
|
87
|
-
const exception = new _baseappexception.ValidationException(errors);
|
|
88
|
-
expect(exception.getStatus()).toBe(_common.HttpStatus.BAD_REQUEST);
|
|
89
|
-
expect(exception.messageKey).toBe(_messagekeys.ERROR_MESSAGES.VALIDATION);
|
|
90
|
-
expect(exception.errors).toEqual(errors);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
describe('UnauthorizedException', ()=>{
|
|
94
|
-
it('should use the default message when none is provided', ()=>{
|
|
95
|
-
const exception = new _baseappexception.UnauthorizedException();
|
|
96
|
-
expect(exception.getStatus()).toBe(_common.HttpStatus.UNAUTHORIZED);
|
|
97
|
-
expect(exception.message).toBe('Unauthorized access');
|
|
98
|
-
expect(exception.messageKey).toBe(_messagekeys.ERROR_MESSAGES.UNAUTHORIZED);
|
|
99
|
-
});
|
|
100
|
-
it('should use a custom message when provided', ()=>{
|
|
101
|
-
const exception = new _baseappexception.UnauthorizedException('Custom message');
|
|
102
|
-
expect(exception.message).toBe('Custom message');
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
describe('ForbiddenException', ()=>{
|
|
106
|
-
it('should default to "Access forbidden"', ()=>{
|
|
107
|
-
const exception = new _baseappexception.ForbiddenException();
|
|
108
|
-
expect(exception.getStatus()).toBe(_common.HttpStatus.FORBIDDEN);
|
|
109
|
-
expect(exception.message).toBe('Access forbidden');
|
|
110
|
-
expect(exception.messageKey).toBe(_messagekeys.ERROR_MESSAGES.FORBIDDEN);
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
describe('ConflictException', ()=>{
|
|
114
|
-
it('should include the field in the message and metadata when provided', ()=>{
|
|
115
|
-
const exception = new _baseappexception.ConflictException('User', 'email');
|
|
116
|
-
expect(exception.getStatus()).toBe(_common.HttpStatus.CONFLICT);
|
|
117
|
-
expect(exception.message).toBe('User with this email already exists');
|
|
118
|
-
expect(exception.messageVariables).toEqual({
|
|
119
|
-
entity: 'User',
|
|
120
|
-
field: 'email'
|
|
121
|
-
});
|
|
122
|
-
expect(exception.metadata).toEqual({
|
|
123
|
-
entity: 'User',
|
|
124
|
-
field: 'email'
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
it('should omit the field when not provided', ()=>{
|
|
128
|
-
const exception = new _baseappexception.ConflictException('User');
|
|
129
|
-
expect(exception.message).toBe('User already exists');
|
|
130
|
-
expect(exception.messageVariables).toEqual({
|
|
131
|
-
entity: 'User'
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
describe('InternalServerException', ()=>{
|
|
136
|
-
it('should default to "Internal server error"', ()=>{
|
|
137
|
-
const exception = new _baseappexception.InternalServerException();
|
|
138
|
-
expect(exception.getStatus()).toBe(_common.HttpStatus.INTERNAL_SERVER_ERROR);
|
|
139
|
-
expect(exception.message).toBe('Internal server error');
|
|
140
|
-
expect(exception.messageKey).toBe(_messagekeys.ERROR_MESSAGES.INTERNAL);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
describe('ServiceUnavailableException', ()=>{
|
|
144
|
-
it('should build a message including the service name', ()=>{
|
|
145
|
-
const exception = new _baseappexception.ServiceUnavailableException('Email');
|
|
146
|
-
expect(exception.getStatus()).toBe(_common.HttpStatus.SERVICE_UNAVAILABLE);
|
|
147
|
-
expect(exception.message).toBe('Email is temporarily unavailable');
|
|
148
|
-
expect(exception.messageKey).toBe(_messagekeys.ERROR_MESSAGES.SERVICE_UNAVAILABLE);
|
|
149
|
-
expect(exception.messageVariables).toEqual({
|
|
150
|
-
service: 'Email'
|
|
151
|
-
});
|
|
152
|
-
expect(exception.metadata).toEqual({
|
|
153
|
-
service: 'Email'
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
});
|
package/cjs/exceptions/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./base-app.exception"), exports);
|
|
6
|
-
_export_star(require("./permission.exception"), exports);
|
|
7
|
-
function _export_star(from, to) {
|
|
8
|
-
Object.keys(from).forEach(function(k) {
|
|
9
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
10
|
-
Object.defineProperty(to, k, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function() {
|
|
13
|
-
return from[k];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
return from;
|
|
19
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get InsufficientPermissionsException () {
|
|
13
|
-
return InsufficientPermissionsException;
|
|
14
|
-
},
|
|
15
|
-
get NoPermissionsFoundException () {
|
|
16
|
-
return NoPermissionsFoundException;
|
|
17
|
-
},
|
|
18
|
-
get PermissionSystemUnavailableException () {
|
|
19
|
-
return PermissionSystemUnavailableException;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _common = require("@nestjs/common");
|
|
23
|
-
const _messagekeys = require("../constants/message-keys");
|
|
24
|
-
let PermissionSystemUnavailableException = class PermissionSystemUnavailableException extends _common.InternalServerErrorException {
|
|
25
|
-
constructor(){
|
|
26
|
-
super({
|
|
27
|
-
success: false,
|
|
28
|
-
message: 'Permission system temporarily unavailable',
|
|
29
|
-
messageKey: _messagekeys.ERROR_MESSAGES.PERMISSION_SYSTEM_UNAVAILABLE
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
let InsufficientPermissionsException = class InsufficientPermissionsException extends _common.ForbiddenException {
|
|
34
|
-
constructor(missingPermissions, operator = 'AND'){
|
|
35
|
-
const messageKey = operator === 'OR' ? _messagekeys.ERROR_MESSAGES.INSUFFICIENT_PERMISSIONS_OR : _messagekeys.ERROR_MESSAGES.INSUFFICIENT_PERMISSIONS;
|
|
36
|
-
super({
|
|
37
|
-
success: false,
|
|
38
|
-
message: 'Insufficient permissions',
|
|
39
|
-
messageKey,
|
|
40
|
-
messageVariables: {
|
|
41
|
-
permissions: missingPermissions.join(', ')
|
|
42
|
-
},
|
|
43
|
-
missingPermissions,
|
|
44
|
-
operator
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
let NoPermissionsFoundException = class NoPermissionsFoundException extends _common.ForbiddenException {
|
|
49
|
-
constructor(){
|
|
50
|
-
super({
|
|
51
|
-
success: false,
|
|
52
|
-
message: 'No permissions found',
|
|
53
|
-
messageKey: _messagekeys.ERROR_MESSAGES.NO_PERMISSIONS_FOUND
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
const _common = require("@nestjs/common");
|
|
6
|
-
const _messagekeys = require("../constants/message-keys");
|
|
7
|
-
const _permissionexception = require("./permission.exception");
|
|
8
|
-
describe('permission exceptions', ()=>{
|
|
9
|
-
describe('PermissionSystemUnavailableException', ()=>{
|
|
10
|
-
it('should be an InternalServerErrorException with the expected response body', ()=>{
|
|
11
|
-
const exception = new _permissionexception.PermissionSystemUnavailableException();
|
|
12
|
-
expect(exception).toBeInstanceOf(_common.InternalServerErrorException);
|
|
13
|
-
expect(exception.getResponse()).toMatchObject({
|
|
14
|
-
success: false,
|
|
15
|
-
message: 'Permission system temporarily unavailable',
|
|
16
|
-
messageKey: _messagekeys.ERROR_MESSAGES.PERMISSION_SYSTEM_UNAVAILABLE
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
describe('InsufficientPermissionsException', ()=>{
|
|
21
|
-
it('should default to AND operator and matching messageKey', ()=>{
|
|
22
|
-
const exception = new _permissionexception.InsufficientPermissionsException([
|
|
23
|
-
'user.create',
|
|
24
|
-
'user.update'
|
|
25
|
-
]);
|
|
26
|
-
expect(exception).toBeInstanceOf(_common.ForbiddenException);
|
|
27
|
-
expect(exception.getResponse()).toMatchObject({
|
|
28
|
-
success: false,
|
|
29
|
-
message: 'Insufficient permissions',
|
|
30
|
-
messageKey: _messagekeys.ERROR_MESSAGES.INSUFFICIENT_PERMISSIONS,
|
|
31
|
-
messageVariables: {
|
|
32
|
-
permissions: 'user.create, user.update'
|
|
33
|
-
},
|
|
34
|
-
missingPermissions: [
|
|
35
|
-
'user.create',
|
|
36
|
-
'user.update'
|
|
37
|
-
],
|
|
38
|
-
operator: 'AND'
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
it('should use the OR messageKey when operator is OR', ()=>{
|
|
42
|
-
const exception = new _permissionexception.InsufficientPermissionsException([
|
|
43
|
-
'admin',
|
|
44
|
-
'manager'
|
|
45
|
-
], 'OR');
|
|
46
|
-
expect(exception.getResponse()).toMatchObject({
|
|
47
|
-
messageKey: _messagekeys.ERROR_MESSAGES.INSUFFICIENT_PERMISSIONS_OR,
|
|
48
|
-
operator: 'OR'
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
it('should join a single missing permission without a separator', ()=>{
|
|
52
|
-
const exception = new _permissionexception.InsufficientPermissionsException([
|
|
53
|
-
'user.create'
|
|
54
|
-
]);
|
|
55
|
-
expect(exception.getResponse()).toMatchObject({
|
|
56
|
-
messageVariables: {
|
|
57
|
-
permissions: 'user.create'
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
it('should handle an empty missing-permissions list', ()=>{
|
|
62
|
-
const exception = new _permissionexception.InsufficientPermissionsException([]);
|
|
63
|
-
expect(exception.getResponse()).toMatchObject({
|
|
64
|
-
messageVariables: {
|
|
65
|
-
permissions: ''
|
|
66
|
-
},
|
|
67
|
-
missingPermissions: []
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
describe('NoPermissionsFoundException', ()=>{
|
|
72
|
-
it('should be a ForbiddenException with the expected response body', ()=>{
|
|
73
|
-
const exception = new _permissionexception.NoPermissionsFoundException();
|
|
74
|
-
expect(exception).toBeInstanceOf(_common.ForbiddenException);
|
|
75
|
-
expect(exception.getResponse()).toMatchObject({
|
|
76
|
-
success: false,
|
|
77
|
-
message: 'No permissions found',
|
|
78
|
-
messageKey: _messagekeys.ERROR_MESSAGES.NO_PERMISSIONS_FOUND
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|