@flusys/nestjs-shared 7.1.0 → 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/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 -307
- 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 -215
- 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
package/fesm/utils/index.js
CHANGED
|
@@ -1,8 +1,1045 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import * as __rspack_external__flusys_nestjs_core_config_197fa0a9 from "@flusys/nestjs-core/config";
|
|
2
|
+
import * as __rspack_external__nestjs_common_a04939da from "@nestjs/common";
|
|
3
|
+
export const __rspack_esm_id = 152;
|
|
4
|
+
export const __rspack_esm_ids = [152];
|
|
5
|
+
export const __webpack_modules__ = {
|
|
6
|
+
43(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7
|
+
/* import */ var _permissions_js__rspack_import_0 = __webpack_require__(975);
|
|
8
|
+
/* import */ var _message_keys_js__rspack_import_1 = __webpack_require__(389);
|
|
9
|
+
// Metadata keys
|
|
10
|
+
const IS_PUBLIC_KEY = 'isPublic';
|
|
11
|
+
const PERMISSIONS_KEY = 'permissions';
|
|
12
|
+
const DOMAIN_EVENT_HANDLER_KEY = 'domainEventHandler';
|
|
13
|
+
// Injection tokens
|
|
14
|
+
const CACHE_INSTANCE = 'CACHE_INSTANCE';
|
|
15
|
+
const PERMISSION_GUARD_CONFIG = 'PERMISSION_GUARD_CONFIG';
|
|
16
|
+
const EVENT_BUS_INSTANCE = 'EVENT_BUS_INSTANCE';
|
|
17
|
+
const EVENT_BUS_MODULE_OPTIONS = 'EVENT_BUS_MODULE_OPTIONS';
|
|
18
|
+
// Header names
|
|
19
|
+
const IDEMPOTENCY_KEY_HEADER = 'x-idempotency-key';
|
|
20
|
+
const REQUEST_ID_HEADER = 'x-request-id';
|
|
21
|
+
const CLIENT_TYPE_HEADER = 'x-client-type';
|
|
22
|
+
// Cache key prefixes
|
|
23
|
+
const PERMISSIONS_CACHE_PREFIX = 'my-permissions';
|
|
24
|
+
const IDEMPOTENCY_CACHE_PREFIX = 'idempotency';
|
|
25
|
+
// Event bus defaults
|
|
26
|
+
const DEFAULT_EVENT_EXCHANGE = 'flusys.events';
|
|
27
|
+
const DEFAULT_EVENT_TOPIC = 'flusys.domain-events';
|
|
28
|
+
const DEFAULT_EVENT_SERVICE_NAME = 'flusys';
|
|
29
|
+
// Permission codes
|
|
30
|
+
|
|
31
|
+
// Message keys for localization
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
35
|
+
BC: () => (/* reexport safe */ _permissions_js__rspack_import_0.BC),
|
|
36
|
+
Bz: () => (/* reexport safe */ _permissions_js__rspack_import_0.Bz),
|
|
37
|
+
Em: () => (/* reexport safe */ _permissions_js__rspack_import_0.Em),
|
|
38
|
+
GT: () => (/* reexport safe */ _permissions_js__rspack_import_0.GT),
|
|
39
|
+
Jj: () => (/* reexport safe */ _permissions_js__rspack_import_0.Jj),
|
|
40
|
+
N3: () => (/* reexport safe */ _permissions_js__rspack_import_0.N3),
|
|
41
|
+
ON: () => (/* reexport safe */ _permissions_js__rspack_import_0.ON),
|
|
42
|
+
P0: () => (/* reexport safe */ _permissions_js__rspack_import_0.P0),
|
|
43
|
+
Q5: () => (/* reexport safe */ _permissions_js__rspack_import_0.Q5),
|
|
44
|
+
S6: () => (/* reexport safe */ _permissions_js__rspack_import_0.S6),
|
|
45
|
+
T: () => (/* reexport safe */ _permissions_js__rspack_import_0.T),
|
|
46
|
+
UB: () => (/* reexport safe */ _permissions_js__rspack_import_0.UB),
|
|
47
|
+
UG: () => (/* reexport safe */ _permissions_js__rspack_import_0.UG),
|
|
48
|
+
UU: () => (/* reexport safe */ _message_keys_js__rspack_import_1.UU),
|
|
49
|
+
Ub: () => (/* reexport safe */ _permissions_js__rspack_import_0.Ub),
|
|
50
|
+
V0: () => (/* reexport safe */ _permissions_js__rspack_import_0.V0),
|
|
51
|
+
Wc: () => (/* reexport safe */ _permissions_js__rspack_import_0.Wc),
|
|
52
|
+
Y3: () => (/* reexport safe */ _permissions_js__rspack_import_0.Y3),
|
|
53
|
+
Y7: () => (/* reexport safe */ _permissions_js__rspack_import_0.Y7),
|
|
54
|
+
_X: () => (/* reexport safe */ _permissions_js__rspack_import_0._X),
|
|
55
|
+
aO: () => (/* reexport safe */ _permissions_js__rspack_import_0.aO),
|
|
56
|
+
fS: () => (/* reexport safe */ _permissions_js__rspack_import_0.fS),
|
|
57
|
+
hg: () => (/* reexport safe */ _message_keys_js__rspack_import_1.hg),
|
|
58
|
+
l3: () => (/* reexport safe */ _permissions_js__rspack_import_0.l3),
|
|
59
|
+
mK: () => (/* reexport safe */ _message_keys_js__rspack_import_1.mK),
|
|
60
|
+
mV: () => (/* reexport safe */ _permissions_js__rspack_import_0.mV),
|
|
61
|
+
rH: () => (/* reexport safe */ _permissions_js__rspack_import_0.rH),
|
|
62
|
+
t$: () => (/* reexport safe */ _permissions_js__rspack_import_0.t$),
|
|
63
|
+
w7: () => (/* reexport safe */ _permissions_js__rspack_import_0.w7),
|
|
64
|
+
wA: () => (/* reexport safe */ _permissions_js__rspack_import_0.wA),
|
|
65
|
+
wM: () => (/* reexport safe */ _permissions_js__rspack_import_0.wM),
|
|
66
|
+
z$: () => (/* reexport safe */ _permissions_js__rspack_import_0.z$),
|
|
67
|
+
zd: () => (/* reexport safe */ _permissions_js__rspack_import_0.zd)
|
|
68
|
+
}, {
|
|
69
|
+
Hq: DEFAULT_EVENT_EXCHANGE,
|
|
70
|
+
Lw: PERMISSION_GUARD_CONFIG,
|
|
71
|
+
N7: PERMISSIONS_KEY,
|
|
72
|
+
PT: DOMAIN_EVENT_HANDLER_KEY,
|
|
73
|
+
Qj: EVENT_BUS_INSTANCE,
|
|
74
|
+
SL: EVENT_BUS_MODULE_OPTIONS,
|
|
75
|
+
fG: PERMISSIONS_CACHE_PREFIX,
|
|
76
|
+
iH: IDEMPOTENCY_KEY_HEADER,
|
|
77
|
+
jA: IS_PUBLIC_KEY,
|
|
78
|
+
kC: REQUEST_ID_HEADER,
|
|
79
|
+
mg: IDEMPOTENCY_CACHE_PREFIX,
|
|
80
|
+
nx: DEFAULT_EVENT_TOPIC,
|
|
81
|
+
xw: CLIENT_TYPE_HEADER,
|
|
82
|
+
zl: CACHE_INSTANCE
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
},
|
|
87
|
+
389(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
88
|
+
// ==================== AUTH (Shared across guards/interceptors) ====================
|
|
89
|
+
// These are duplicated in nestjs-auth but needed here to avoid circular dependencies
|
|
90
|
+
const AUTH_MESSAGES = {
|
|
91
|
+
TOKEN_REQUIRED: 'auth.token.required',
|
|
92
|
+
TOKEN_INVALID: 'auth.token.invalid',
|
|
93
|
+
ENTITY_BELOG_ANOTHER_COMPANY: 'entity.belongs.another.company',
|
|
94
|
+
COMPANY_NO_ACCESS: 'auth.company.no.access'
|
|
95
|
+
};
|
|
96
|
+
// ==================== ERROR (HTTP Exceptions) ====================
|
|
97
|
+
const ERROR_MESSAGES = {
|
|
98
|
+
NOT_FOUND: 'error.not.found',
|
|
99
|
+
VALIDATION: 'error.validation',
|
|
100
|
+
UNAUTHORIZED: 'error.unauthorized',
|
|
101
|
+
FORBIDDEN: 'error.forbidden',
|
|
102
|
+
CONFLICT: 'error.conflict',
|
|
103
|
+
DB_FOREIGN_KEY: 'error.db.foreign.key',
|
|
104
|
+
DB_NOT_NULL: 'error.db.not.null',
|
|
105
|
+
DB_INVALID_INPUT: 'error.db.invalid.input',
|
|
106
|
+
DB_VALUE_TOO_LONG: 'error.db.value.too.long',
|
|
107
|
+
DB_CHECK_CONSTRAINT: 'error.db.check.constraint',
|
|
108
|
+
DB_DEADLOCK: 'error.db.deadlock',
|
|
109
|
+
INTERNAL: 'error.internal',
|
|
110
|
+
SERVICE_UNAVAILABLE: 'error.service.unavailable',
|
|
111
|
+
UNKNOWN: 'error.unknown',
|
|
112
|
+
HTTP: 'error.http',
|
|
113
|
+
GENERIC: 'error.generic',
|
|
114
|
+
PERMISSION_SYSTEM_UNAVAILABLE: 'error.permission.system.unavailable',
|
|
115
|
+
INSUFFICIENT_PERMISSIONS: 'error.insufficient.permissions',
|
|
116
|
+
INSUFFICIENT_PERMISSIONS_OR: 'error.insufficient.permissions.or',
|
|
117
|
+
NO_PERMISSIONS_FOUND: 'error.no.permissions.found',
|
|
118
|
+
ENDPOINT_DISABLED: 'error.endpoint.disabled'
|
|
119
|
+
};
|
|
120
|
+
// ==================== SYSTEM (Infrastructure) ====================
|
|
121
|
+
const SYSTEM_MESSAGES = {
|
|
122
|
+
REPOSITORY_NOT_AVAILABLE: 'system.repository.not.available',
|
|
123
|
+
DATASOURCE_NOT_AVAILABLE: 'system.datasource.not.available',
|
|
124
|
+
DATABASE_CONFIG_NOT_AVAILABLE: 'system.database.config.not.available',
|
|
125
|
+
SERVICE_NOT_AVAILABLE: 'system.service.not.available',
|
|
126
|
+
CONFIG_REQUIRED: 'system.config.required',
|
|
127
|
+
INTERNAL_ERROR: 'system.internal.error',
|
|
128
|
+
DUPLICATE_REQUEST: 'system.duplicate.request',
|
|
129
|
+
INVALID_TENANT_ID: 'system.invalid.tenant.id',
|
|
130
|
+
TENANT_NOT_FOUND: 'system.tenant.not.found',
|
|
131
|
+
TENANT_HEADER_REQUIRED: 'system.tenant.header.required',
|
|
132
|
+
MISSING_PARAMETER: 'system.missing.parameter',
|
|
133
|
+
SDK_NOT_INSTALLED: 'system.sdk.not.installed',
|
|
134
|
+
PATH_TRAVERSAL_DETECTED: 'system.path.traversal.detected',
|
|
135
|
+
INVALID_FILE_KEY: 'system.invalid.file.key'
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
139
|
+
}, {
|
|
140
|
+
UU: ERROR_MESSAGES,
|
|
141
|
+
hg: SYSTEM_MESSAGES,
|
|
142
|
+
mK: AUTH_MESSAGES
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
},
|
|
147
|
+
975(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
148
|
+
// ==================== AUTH MODULE ====================
|
|
149
|
+
const USER_PERMISSIONS = {
|
|
150
|
+
CREATE: 'user.create',
|
|
151
|
+
READ: 'user.read',
|
|
152
|
+
UPDATE: 'user.update',
|
|
153
|
+
DELETE: 'user.delete',
|
|
154
|
+
LOOKUP: 'user.lookup'
|
|
155
|
+
};
|
|
156
|
+
const COMPANY_PERMISSIONS = {
|
|
157
|
+
CREATE: 'company.create',
|
|
158
|
+
READ: 'company.read',
|
|
159
|
+
UPDATE: 'company.update',
|
|
160
|
+
DELETE: 'company.delete'
|
|
161
|
+
};
|
|
162
|
+
const BRANCH_PERMISSIONS = {
|
|
163
|
+
CREATE: 'branch.create',
|
|
164
|
+
READ: 'branch.read',
|
|
165
|
+
UPDATE: 'branch.update',
|
|
166
|
+
DELETE: 'branch.delete'
|
|
167
|
+
};
|
|
168
|
+
const SOCIAL_AUTH_CONFIG_PERMISSIONS = {
|
|
169
|
+
CREATE: 'social-config.create',
|
|
170
|
+
READ: 'social-config.read',
|
|
171
|
+
UPDATE: 'social-config.update',
|
|
172
|
+
DELETE: 'social-config.delete'
|
|
173
|
+
};
|
|
174
|
+
// ==================== IAM MODULE ====================
|
|
175
|
+
const ACTION_PERMISSIONS = {
|
|
176
|
+
CREATE: 'action.create',
|
|
177
|
+
READ: 'action.read',
|
|
178
|
+
UPDATE: 'action.update',
|
|
179
|
+
DELETE: 'action.delete'
|
|
180
|
+
};
|
|
181
|
+
const ROLE_PERMISSIONS = {
|
|
182
|
+
CREATE: 'role.create',
|
|
183
|
+
READ: 'role.read',
|
|
184
|
+
UPDATE: 'role.update',
|
|
185
|
+
DELETE: 'role.delete'
|
|
186
|
+
};
|
|
187
|
+
const ROLE_ACTION_PERMISSIONS = {
|
|
188
|
+
READ: 'role-action.read',
|
|
189
|
+
ASSIGN: 'role-action.assign'
|
|
190
|
+
};
|
|
191
|
+
const USER_ROLE_PERMISSIONS = {
|
|
192
|
+
READ: 'user-role.read',
|
|
193
|
+
ASSIGN: 'user-role.assign'
|
|
194
|
+
};
|
|
195
|
+
const USER_ACTION_PERMISSIONS = {
|
|
196
|
+
READ: 'user-action.read',
|
|
197
|
+
ASSIGN: 'user-action.assign'
|
|
198
|
+
};
|
|
199
|
+
const COMPANY_ACTION_PERMISSIONS = {
|
|
200
|
+
READ: 'company-action.read',
|
|
201
|
+
ASSIGN: 'company-action.assign'
|
|
202
|
+
};
|
|
203
|
+
// ==================== STORAGE MODULE ====================
|
|
204
|
+
const FILE_PERMISSIONS = {
|
|
205
|
+
CREATE: 'file.create',
|
|
206
|
+
READ: 'file.read',
|
|
207
|
+
UPDATE: 'file.update',
|
|
208
|
+
DELETE: 'file.delete',
|
|
209
|
+
VIEW_PRIVATE_ACTION: 'file.view.private'
|
|
210
|
+
};
|
|
211
|
+
const FOLDER_PERMISSIONS = {
|
|
212
|
+
CREATE: 'folder.create',
|
|
213
|
+
READ: 'folder.read',
|
|
214
|
+
UPDATE: 'folder.update',
|
|
215
|
+
DELETE: 'folder.delete'
|
|
216
|
+
};
|
|
217
|
+
const STORAGE_CONFIG_PERMISSIONS = {
|
|
218
|
+
CREATE: 'storage-config.create',
|
|
219
|
+
READ: 'storage-config.read',
|
|
220
|
+
UPDATE: 'storage-config.update',
|
|
221
|
+
DELETE: 'storage-config.delete'
|
|
222
|
+
};
|
|
223
|
+
const UPLOAD_CONFIG_PERMISSIONS = {
|
|
224
|
+
DELETE: 'upload-config.delete'
|
|
225
|
+
};
|
|
226
|
+
// ==================== EMAIL MODULE ====================
|
|
227
|
+
const EMAIL_CONFIG_PERMISSIONS = {
|
|
228
|
+
CREATE: 'email-config.create',
|
|
229
|
+
READ: 'email-config.read',
|
|
230
|
+
UPDATE: 'email-config.update',
|
|
231
|
+
DELETE: 'email-config.delete'
|
|
232
|
+
};
|
|
233
|
+
const EMAIL_TEMPLATE_PERMISSIONS = {
|
|
234
|
+
CREATE: 'email-template.create',
|
|
235
|
+
READ: 'email-template.read',
|
|
236
|
+
UPDATE: 'email-template.update',
|
|
237
|
+
DELETE: 'email-template.delete'
|
|
238
|
+
};
|
|
239
|
+
// ==================== FORM BUILDER MODULE ====================
|
|
240
|
+
const FORM_PERMISSIONS = {
|
|
241
|
+
CREATE: 'form.create',
|
|
242
|
+
READ: 'form.read',
|
|
243
|
+
UPDATE: 'form.update',
|
|
244
|
+
DELETE: 'form.delete'
|
|
245
|
+
};
|
|
246
|
+
const FORM_RESULT_PERMISSIONS = {
|
|
247
|
+
CREATE: 'form-result.create',
|
|
248
|
+
READ: 'form-result.read',
|
|
249
|
+
UPDATE: 'form-result.update',
|
|
250
|
+
DELETE: 'form-result.delete'
|
|
251
|
+
};
|
|
252
|
+
// ==================== EVENT MANAGER MODULE ====================
|
|
253
|
+
const EVENT_PERMISSIONS = {
|
|
254
|
+
CREATE: 'event.create',
|
|
255
|
+
READ: 'event.read',
|
|
256
|
+
UPDATE: 'event.update',
|
|
257
|
+
DELETE: 'event.delete'
|
|
258
|
+
};
|
|
259
|
+
// ==================== NOTIFICATION MODULE ====================
|
|
260
|
+
const NOTIFICATION_PERMISSIONS = {
|
|
261
|
+
CREATE: 'notification.create',
|
|
262
|
+
READ: 'notification.read',
|
|
263
|
+
UPDATE: 'notification.update',
|
|
264
|
+
DELETE: 'notification.delete'
|
|
265
|
+
};
|
|
266
|
+
// ==================== LOCALIZATION MODULE ====================
|
|
267
|
+
const LANGUAGE_PERMISSIONS = {
|
|
268
|
+
CREATE: 'language.create',
|
|
269
|
+
READ: 'language.read',
|
|
270
|
+
UPDATE: 'language.update',
|
|
271
|
+
DELETE: 'language.delete'
|
|
272
|
+
};
|
|
273
|
+
const TRANSLATION_KEY_PERMISSIONS = {
|
|
274
|
+
CREATE: 'translation-key.create',
|
|
275
|
+
READ: 'translation-key.read',
|
|
276
|
+
UPDATE: 'translation-key.update',
|
|
277
|
+
DELETE: 'translation-key.delete'
|
|
278
|
+
};
|
|
279
|
+
const TRANSLATION_PERMISSIONS = {
|
|
280
|
+
CREATE: 'translation.create',
|
|
281
|
+
READ: 'translation.read',
|
|
282
|
+
UPDATE: 'translation.update',
|
|
283
|
+
DELETE: 'translation.delete'
|
|
284
|
+
};
|
|
285
|
+
// ==================== TASK MANAGER MODULE ====================
|
|
286
|
+
const TASK_BOARD_PERMISSIONS = {
|
|
287
|
+
CREATE: 'task-board.create',
|
|
288
|
+
READ: 'task-board.read',
|
|
289
|
+
UPDATE: 'task-board.update',
|
|
290
|
+
DELETE: 'task-board.delete',
|
|
291
|
+
MANAGE_MEMBERS: 'task-board.manage-members'
|
|
292
|
+
};
|
|
293
|
+
const TASK_LIST_PERMISSIONS = {
|
|
294
|
+
CREATE: 'task-list.create',
|
|
295
|
+
READ: 'task-list.read',
|
|
296
|
+
UPDATE: 'task-list.update',
|
|
297
|
+
DELETE: 'task-list.delete'
|
|
298
|
+
};
|
|
299
|
+
const TASK_PERMISSIONS = {
|
|
300
|
+
CREATE: 'task.create',
|
|
301
|
+
READ: 'task.read',
|
|
302
|
+
UPDATE: 'task.update',
|
|
303
|
+
DELETE: 'task.delete',
|
|
304
|
+
MOVE: 'task.move',
|
|
305
|
+
ASSIGN: 'task.assign'
|
|
306
|
+
};
|
|
307
|
+
const TASK_LABEL_PERMISSIONS = {
|
|
308
|
+
CREATE: 'task-label.create',
|
|
309
|
+
READ: 'task-label.read',
|
|
310
|
+
UPDATE: 'task-label.update',
|
|
311
|
+
DELETE: 'task-label.delete'
|
|
312
|
+
};
|
|
313
|
+
const TASK_COMMENT_PERMISSIONS = {
|
|
314
|
+
CREATE: 'task-comment.create',
|
|
315
|
+
READ: 'task-comment.read',
|
|
316
|
+
DELETE: 'task-comment.delete'
|
|
317
|
+
};
|
|
318
|
+
// ==================== AI ASSISTANT MODULE ====================
|
|
319
|
+
const AI_ASSISTANT_PERMISSIONS = {
|
|
320
|
+
VIEW_ALL_HISTORY: 'ai-assistant.view-all-history'
|
|
321
|
+
};
|
|
322
|
+
// ==================== AGGREGATED EXPORTS ====================
|
|
323
|
+
const PERMISSIONS = {
|
|
324
|
+
// Auth
|
|
325
|
+
USER: USER_PERMISSIONS,
|
|
326
|
+
COMPANY: COMPANY_PERMISSIONS,
|
|
327
|
+
BRANCH: BRANCH_PERMISSIONS,
|
|
328
|
+
SOCIAL_AUTH_CONFIG: SOCIAL_AUTH_CONFIG_PERMISSIONS,
|
|
329
|
+
// IAM
|
|
330
|
+
ACTION: ACTION_PERMISSIONS,
|
|
331
|
+
ROLE: ROLE_PERMISSIONS,
|
|
332
|
+
ROLE_ACTION: ROLE_ACTION_PERMISSIONS,
|
|
333
|
+
USER_ROLE: USER_ROLE_PERMISSIONS,
|
|
334
|
+
USER_ACTION: USER_ACTION_PERMISSIONS,
|
|
335
|
+
COMPANY_ACTION: COMPANY_ACTION_PERMISSIONS,
|
|
336
|
+
// Storage
|
|
337
|
+
FILE: FILE_PERMISSIONS,
|
|
338
|
+
FOLDER: FOLDER_PERMISSIONS,
|
|
339
|
+
STORAGE_CONFIG: STORAGE_CONFIG_PERMISSIONS,
|
|
340
|
+
// Email
|
|
341
|
+
EMAIL_CONFIG: EMAIL_CONFIG_PERMISSIONS,
|
|
342
|
+
EMAIL_TEMPLATE: EMAIL_TEMPLATE_PERMISSIONS,
|
|
343
|
+
// Form Builder
|
|
344
|
+
FORM: FORM_PERMISSIONS,
|
|
345
|
+
FORM_RESULT: FORM_RESULT_PERMISSIONS,
|
|
346
|
+
// Event Manager
|
|
347
|
+
EVENT: EVENT_PERMISSIONS,
|
|
348
|
+
// Notification
|
|
349
|
+
NOTIFICATION: NOTIFICATION_PERMISSIONS,
|
|
350
|
+
// Localization
|
|
351
|
+
LANGUAGE: LANGUAGE_PERMISSIONS,
|
|
352
|
+
TRANSLATION_KEY: TRANSLATION_KEY_PERMISSIONS,
|
|
353
|
+
TRANSLATION: TRANSLATION_PERMISSIONS,
|
|
354
|
+
// Task Manager
|
|
355
|
+
TASK_BOARD: TASK_BOARD_PERMISSIONS,
|
|
356
|
+
TASK_LIST: TASK_LIST_PERMISSIONS,
|
|
357
|
+
TASK: TASK_PERMISSIONS,
|
|
358
|
+
TASK_LABEL: TASK_LABEL_PERMISSIONS,
|
|
359
|
+
TASK_COMMENT: TASK_COMMENT_PERMISSIONS,
|
|
360
|
+
// AI Assistant
|
|
361
|
+
AI_ASSISTANT: AI_ASSISTANT_PERMISSIONS
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
365
|
+
}, {
|
|
366
|
+
BC: USER_PERMISSIONS,
|
|
367
|
+
Bz: AI_ASSISTANT_PERMISSIONS,
|
|
368
|
+
Em: STORAGE_CONFIG_PERMISSIONS,
|
|
369
|
+
GT: FORM_RESULT_PERMISSIONS,
|
|
370
|
+
Jj: PERMISSIONS,
|
|
371
|
+
N3: TRANSLATION_KEY_PERMISSIONS,
|
|
372
|
+
ON: TASK_LIST_PERMISSIONS,
|
|
373
|
+
P0: ROLE_ACTION_PERMISSIONS,
|
|
374
|
+
Q5: LANGUAGE_PERMISSIONS,
|
|
375
|
+
S6: FILE_PERMISSIONS,
|
|
376
|
+
T: TASK_PERMISSIONS,
|
|
377
|
+
UB: UPLOAD_CONFIG_PERMISSIONS,
|
|
378
|
+
UG: TASK_LABEL_PERMISSIONS,
|
|
379
|
+
Ub: EVENT_PERMISSIONS,
|
|
380
|
+
V0: EMAIL_CONFIG_PERMISSIONS,
|
|
381
|
+
Wc: FORM_PERMISSIONS,
|
|
382
|
+
Y3: TASK_BOARD_PERMISSIONS,
|
|
383
|
+
Y7: ACTION_PERMISSIONS,
|
|
384
|
+
_X: USER_ACTION_PERMISSIONS,
|
|
385
|
+
aO: COMPANY_ACTION_PERMISSIONS,
|
|
386
|
+
fS: TRANSLATION_PERMISSIONS,
|
|
387
|
+
l3: SOCIAL_AUTH_CONFIG_PERMISSIONS,
|
|
388
|
+
mV: ROLE_PERMISSIONS,
|
|
389
|
+
rH: NOTIFICATION_PERMISSIONS,
|
|
390
|
+
t$: COMPANY_PERMISSIONS,
|
|
391
|
+
w7: USER_ROLE_PERMISSIONS,
|
|
392
|
+
wA: BRANCH_PERMISSIONS,
|
|
393
|
+
wM: FOLDER_PERMISSIONS,
|
|
394
|
+
z$: EMAIL_TEMPLATE_PERMISSIONS,
|
|
395
|
+
zd: TASK_COMMENT_PERMISSIONS
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
},
|
|
400
|
+
456(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
401
|
+
const SENSITIVE_KEYS = [
|
|
402
|
+
'password',
|
|
403
|
+
'secret',
|
|
404
|
+
'token',
|
|
405
|
+
'apikey',
|
|
406
|
+
'authorization',
|
|
407
|
+
'salt',
|
|
408
|
+
'hash',
|
|
409
|
+
'credential',
|
|
410
|
+
'accesskey',
|
|
411
|
+
'accountkey',
|
|
412
|
+
'privatekey',
|
|
413
|
+
'connectionstring',
|
|
414
|
+
'passphrase'
|
|
415
|
+
];
|
|
416
|
+
/**
|
|
417
|
+
* Matched whole, not as a substring - `pass` must be redacted without also
|
|
418
|
+
* redacting `bypassCache`, and a storage row's `key` is a path, not a secret.
|
|
419
|
+
*
|
|
420
|
+
* `config` is the provider settings blob on the storage and email config rows:
|
|
421
|
+
* S3, Azure, SFTP and SMTP credentials live in it, so it never leaves the
|
|
422
|
+
* process, even though the row itself still publishes.
|
|
423
|
+
*/ const SENSITIVE_EXACT_KEYS = [
|
|
424
|
+
'pass',
|
|
425
|
+
'pwd',
|
|
426
|
+
'config'
|
|
427
|
+
];
|
|
428
|
+
const REDACTED = '[REDACTED]';
|
|
429
|
+
const CIRCULAR = '[CIRCULAR]';
|
|
430
|
+
const TRUNCATED = '[TRUNCATED]';
|
|
431
|
+
const BINARY = '[BINARY]';
|
|
432
|
+
const MAX_DEPTH = 8;
|
|
433
|
+
/**
|
|
434
|
+
* Matches a dot separated event name against a routing pattern.
|
|
435
|
+
* `*` matches exactly one segment, `#` and `**` match zero or more segments.
|
|
436
|
+
*/ function matchEventPattern(pattern, eventName) {
|
|
437
|
+
if (pattern === eventName) return true;
|
|
438
|
+
const patternSegments = pattern.split('.');
|
|
439
|
+
const nameSegments = eventName.split('.');
|
|
440
|
+
return matchSegments(patternSegments, 0, nameSegments, 0);
|
|
441
|
+
}
|
|
442
|
+
function isMultiWildcard(segment) {
|
|
443
|
+
return segment === '#' || segment === '**';
|
|
444
|
+
}
|
|
445
|
+
function matchSegments(pattern, patternIndex, name, nameIndex) {
|
|
446
|
+
if (patternIndex === pattern.length) return nameIndex === name.length;
|
|
447
|
+
const segment = pattern[patternIndex];
|
|
448
|
+
if (isMultiWildcard(segment)) {
|
|
449
|
+
for(let skip = nameIndex; skip <= name.length; skip++){
|
|
450
|
+
if (matchSegments(pattern, patternIndex + 1, name, skip)) return true;
|
|
451
|
+
}
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
if (nameIndex === name.length) return false;
|
|
455
|
+
if (segment !== '*' && segment !== name[nameIndex]) return false;
|
|
456
|
+
return matchSegments(pattern, patternIndex + 1, name, nameIndex + 1);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Strips credential-like fields before a row leaves the process on an event.
|
|
460
|
+
*
|
|
461
|
+
* Saved TypeORM rows routinely carry bidirectional relations, so the walk
|
|
462
|
+
* tracks the current path and caps its depth - a cycle or a very deep graph
|
|
463
|
+
* must never turn an event into a stack overflow.
|
|
464
|
+
*/ function sanitizeEventPayload(value) {
|
|
465
|
+
return sanitizeValue(value, new WeakSet(), 0);
|
|
466
|
+
}
|
|
467
|
+
function sanitizeValue(value, ancestors, depth) {
|
|
468
|
+
if (value === null || typeof value !== 'object') return value;
|
|
469
|
+
if (value instanceof Date) return value;
|
|
470
|
+
if (Buffer.isBuffer(value)) return BINARY;
|
|
471
|
+
if (ancestors.has(value)) return CIRCULAR;
|
|
472
|
+
if (depth >= MAX_DEPTH) return TRUNCATED;
|
|
473
|
+
ancestors.add(value);
|
|
474
|
+
try {
|
|
475
|
+
if (Array.isArray(value)) {
|
|
476
|
+
return value.map((item)=>sanitizeValue(item, ancestors, depth + 1));
|
|
477
|
+
}
|
|
478
|
+
const sanitized = {};
|
|
479
|
+
for (const [key, entry] of Object.entries(value)){
|
|
480
|
+
sanitized[key] = isSensitiveKey(key) ? REDACTED : sanitizeValue(entry, ancestors, depth + 1);
|
|
481
|
+
}
|
|
482
|
+
return sanitized;
|
|
483
|
+
} finally{
|
|
484
|
+
ancestors.delete(value);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
function isSensitiveKey(key) {
|
|
488
|
+
const lowered = key.toLowerCase();
|
|
489
|
+
if (SENSITIVE_EXACT_KEYS.includes(lowered)) return true;
|
|
490
|
+
return SENSITIVE_KEYS.some((sensitive)=>lowered.includes(sensitive));
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
494
|
+
IN: () => (sanitizeEventPayload),
|
|
495
|
+
_c: () => (isMultiWildcard),
|
|
496
|
+
qe: () => (matchEventPattern)
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
},
|
|
501
|
+
306(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
502
|
+
|
|
503
|
+
// EXPORTS
|
|
504
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
505
|
+
s8: () => (/* reexport */ permission_cache_key_util/* .DEFAULT_COMPANY_PERMISSION_KEY_FORMAT */.s8),
|
|
506
|
+
q6: () => (/* reexport */ permission_cache_key_util/* .DEFAULT_USER_PERMISSION_KEY_FORMAT */.q6),
|
|
507
|
+
wf: () => (/* reexport */ applyCompanyFilter),
|
|
508
|
+
kQ: () => (/* reexport */ buildCompanyWhereCondition),
|
|
509
|
+
fJ: () => (/* reexport */ buildCookieOptions),
|
|
510
|
+
oV: () => (/* reexport */ buildFrontendUrl),
|
|
511
|
+
nt: () => (/* reexport */ permission_cache_key_util/* .buildPermissionCacheKey */.nt),
|
|
512
|
+
ZD: () => (/* reexport */ escapeHtml),
|
|
513
|
+
qo: () => (/* reexport */ escapeHtmlVariables),
|
|
514
|
+
hX: () => (/* reexport */ extractFrontendUrl),
|
|
515
|
+
Sd: () => (/* reexport */ formatInTimezone),
|
|
516
|
+
z9: () => (/* reexport */ generateSlug),
|
|
517
|
+
oo: () => (/* reexport */ generateUniqueSlug),
|
|
518
|
+
oB: () => (/* reexport */ getTodayInTimezone),
|
|
519
|
+
f: () => (/* reexport */ hasCompanyId),
|
|
520
|
+
wh: () => (/* reexport */ isBrowserRequest),
|
|
521
|
+
_c: () => (/* reexport */ event_pattern_util/* .isMultiWildcard */._c),
|
|
522
|
+
lk: () => (/* reexport */ optional_module_util/* .loadOptionalModule */.l),
|
|
523
|
+
vf: () => (/* reexport */ localToUtc),
|
|
524
|
+
qe: () => (/* reexport */ event_pattern_util/* .matchEventPattern */.qe),
|
|
525
|
+
Ju: () => (/* reexport */ parseDurationToMs),
|
|
526
|
+
IN: () => (/* reexport */ event_pattern_util/* .sanitizeEventPayload */.IN),
|
|
527
|
+
v4: () => (/* reexport */ utcToLocal),
|
|
528
|
+
bE: () => (/* reexport */ validateCompanyOwnership)
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
;// CONCATENATED MODULE: ./projects/nestjs-shared/src/utils/date-time.util.ts
|
|
532
|
+
function getOffsetMinutes(utcDate, timezone) {
|
|
533
|
+
const extract = (tz)=>{
|
|
534
|
+
const parts = new Intl.DateTimeFormat('en-US', {
|
|
535
|
+
timeZone: tz,
|
|
536
|
+
year: 'numeric',
|
|
537
|
+
month: '2-digit',
|
|
538
|
+
day: '2-digit',
|
|
539
|
+
hour: '2-digit',
|
|
540
|
+
minute: '2-digit',
|
|
541
|
+
second: '2-digit',
|
|
542
|
+
hour12: false
|
|
543
|
+
}).formatToParts(utcDate);
|
|
544
|
+
const p = Object.fromEntries(parts.filter((x)=>x.type !== 'literal').map((x)=>[
|
|
545
|
+
x.type,
|
|
546
|
+
parseInt(x.value)
|
|
547
|
+
]));
|
|
548
|
+
return Date.UTC(p['year'], p['month'] - 1, p['day'], p['hour'], p['minute'], p['second']);
|
|
549
|
+
};
|
|
550
|
+
return (extract(timezone) - extract('UTC')) / 60_000;
|
|
551
|
+
}
|
|
552
|
+
function localToUtc(dateStr, timeStr, timezone) {
|
|
553
|
+
const [year, month, day] = dateStr.split('-').map(Number);
|
|
554
|
+
const [hours, minutes] = timeStr.split(':').map(Number);
|
|
555
|
+
const approx = new Date(Date.UTC(year, month - 1, day, hours, minutes, 0));
|
|
556
|
+
const offset = getOffsetMinutes(approx, timezone);
|
|
557
|
+
const utcDate = new Date(approx.getTime() - offset * 60_000);
|
|
558
|
+
// DST boundary guard: re-check offset after adjustment
|
|
559
|
+
const finalOffset = getOffsetMinutes(utcDate, timezone);
|
|
560
|
+
return finalOffset !== offset ? new Date(approx.getTime() - finalOffset * 60_000) : utcDate;
|
|
561
|
+
}
|
|
562
|
+
function utcToLocal(utcDate, timezone) {
|
|
563
|
+
const d = typeof utcDate === 'string' ? new Date(utcDate) : utcDate;
|
|
564
|
+
const parts = new Intl.DateTimeFormat('en-CA', {
|
|
565
|
+
timeZone: timezone,
|
|
566
|
+
year: 'numeric',
|
|
567
|
+
month: '2-digit',
|
|
568
|
+
day: '2-digit',
|
|
569
|
+
hour: '2-digit',
|
|
570
|
+
minute: '2-digit',
|
|
571
|
+
hour12: false
|
|
572
|
+
}).formatToParts(d);
|
|
573
|
+
const p = Object.fromEntries(parts.filter((x)=>x.type !== 'literal').map((x)=>[
|
|
574
|
+
x.type,
|
|
575
|
+
x.value
|
|
576
|
+
]));
|
|
577
|
+
// en-CA formats midnight hour as '24' — normalize to '00'
|
|
578
|
+
const hour = p['hour'] === '24' ? '00' : p['hour'];
|
|
579
|
+
return {
|
|
580
|
+
date: `${p['year']}-${p['month']}-${p['day']}`,
|
|
581
|
+
time: `${hour}:${p['minute']}`,
|
|
582
|
+
display: new Intl.DateTimeFormat('en-US', {
|
|
583
|
+
timeZone: timezone,
|
|
584
|
+
dateStyle: 'medium',
|
|
585
|
+
timeStyle: 'short'
|
|
586
|
+
}).format(d)
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function formatInTimezone(utcDate, timezone, options = {
|
|
590
|
+
dateStyle: 'medium',
|
|
591
|
+
timeStyle: 'short'
|
|
592
|
+
}) {
|
|
593
|
+
const d = typeof utcDate === 'string' ? new Date(utcDate) : utcDate;
|
|
594
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
595
|
+
...options,
|
|
596
|
+
timeZone: timezone
|
|
597
|
+
}).format(d);
|
|
598
|
+
}
|
|
599
|
+
function getTodayInTimezone(timezone) {
|
|
600
|
+
return utcToLocal(new Date(), timezone).date;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// EXTERNAL MODULE: ./projects/nestjs-shared/src/utils/event-pattern.util.ts
|
|
604
|
+
var event_pattern_util = __webpack_require__(456);
|
|
605
|
+
;// CONCATENATED MODULE: ./projects/nestjs-shared/src/utils/html-sanitizer.util.ts
|
|
606
|
+
/**
|
|
607
|
+
* HTML Sanitizer Utilities
|
|
608
|
+
*
|
|
609
|
+
* Provides functions for escaping HTML content to prevent XSS attacks.
|
|
610
|
+
* Use these utilities when interpolating user-provided variables into HTML content.
|
|
611
|
+
*/ /**
|
|
612
|
+
* HTML entity mapping for escaping special characters
|
|
613
|
+
*/ const HTML_ESCAPE_MAP = {
|
|
614
|
+
'&': '&',
|
|
615
|
+
'<': '<',
|
|
616
|
+
'>': '>',
|
|
617
|
+
'"': '"',
|
|
618
|
+
"'": ''',
|
|
619
|
+
'/': '/',
|
|
620
|
+
'`': '`',
|
|
621
|
+
'=': '='
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
* Regex pattern matching characters that need HTML escaping
|
|
625
|
+
*/ const HTML_ESCAPE_REGEX = /[&<>"'`=/]/g;
|
|
626
|
+
/**
|
|
627
|
+
* Escapes HTML special characters to prevent XSS attacks.
|
|
628
|
+
*
|
|
629
|
+
* @param str - The string to escape
|
|
630
|
+
* @returns The escaped string safe for HTML insertion
|
|
631
|
+
*
|
|
632
|
+
* @example
|
|
633
|
+
* ```typescript
|
|
634
|
+
* escapeHtml('<script>alert("xss")</script>')
|
|
635
|
+
* // Returns: '<script>alert("xss")</script>'
|
|
636
|
+
* ```
|
|
637
|
+
*/ function escapeHtml(str) {
|
|
638
|
+
if (!str || typeof str !== 'string') {
|
|
639
|
+
return str ?? '';
|
|
640
|
+
}
|
|
641
|
+
return str.replace(HTML_ESCAPE_REGEX, (char)=>HTML_ESCAPE_MAP[char]);
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Escapes all string values in a variables object for safe HTML interpolation.
|
|
645
|
+
* Non-string values are converted to strings and escaped.
|
|
646
|
+
*
|
|
647
|
+
* @param variables - Object containing template variables
|
|
648
|
+
* @returns New object with all string values HTML-escaped
|
|
649
|
+
*
|
|
650
|
+
* @example
|
|
651
|
+
* ```typescript
|
|
652
|
+
* escapeHtmlVariables({ name: '<script>xss</script>', count: 5 })
|
|
653
|
+
* // Returns: { name: '<script>xss</script>', count: '5' }
|
|
654
|
+
* ```
|
|
655
|
+
*/ function escapeHtmlVariables(variables) {
|
|
656
|
+
if (!variables || typeof variables !== 'object') {
|
|
657
|
+
return {};
|
|
658
|
+
}
|
|
659
|
+
const escaped = {};
|
|
660
|
+
for (const [key, value] of Object.entries(variables)){
|
|
661
|
+
if (value === null || value === undefined) {
|
|
662
|
+
escaped[key] = '';
|
|
663
|
+
} else if (typeof value === 'string') {
|
|
664
|
+
escaped[key] = escapeHtml(value);
|
|
665
|
+
} else if (typeof value === 'object') {
|
|
666
|
+
// For objects/arrays, stringify and escape
|
|
667
|
+
escaped[key] = escapeHtml(JSON.stringify(value));
|
|
668
|
+
} else {
|
|
669
|
+
// For numbers, booleans, etc., convert to string (no escaping needed)
|
|
670
|
+
escaped[key] = String(value);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return escaped;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// EXTERNAL MODULE: ./projects/nestjs-shared/src/utils/optional-module.util.ts
|
|
677
|
+
var optional_module_util = __webpack_require__(368);
|
|
678
|
+
// EXTERNAL MODULE: ./projects/nestjs-shared/src/utils/permission-cache-key.util.ts
|
|
679
|
+
var permission_cache_key_util = __webpack_require__(199);
|
|
680
|
+
// EXTERNAL MODULE: external "@nestjs/common"
|
|
681
|
+
var common_ = __webpack_require__(157);
|
|
682
|
+
// EXTERNAL MODULE: ./projects/nestjs-shared/src/constants/message-keys.ts
|
|
683
|
+
var message_keys = __webpack_require__(389);
|
|
684
|
+
;// CONCATENATED MODULE: ./projects/nestjs-shared/src/utils/query-helpers.util.ts
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Apply company filter to a query builder if company feature is enabled.
|
|
689
|
+
* Centralizes the common pattern of filtering by user's company.
|
|
690
|
+
*
|
|
691
|
+
* @param query - TypeORM SelectQueryBuilder
|
|
692
|
+
* @param config - Company filter configuration
|
|
693
|
+
* @param user - Current logged user (may be null)
|
|
694
|
+
* @returns The modified query builder
|
|
695
|
+
*
|
|
696
|
+
* @example
|
|
697
|
+
* ```typescript
|
|
698
|
+
* applyCompanyFilter(query, {
|
|
699
|
+
* isCompanyFeatureEnabled: this.config.isCompanyFeatureEnabled(),
|
|
700
|
+
* entityAlias: 'file_manager',
|
|
701
|
+
* }, user);
|
|
702
|
+
* ```
|
|
703
|
+
*/ function applyCompanyFilter(query, config, user) {
|
|
704
|
+
const columnName = config.columnName ?? 'companyId';
|
|
705
|
+
if (config.isCompanyFeatureEnabled && user?.companyId) {
|
|
706
|
+
query.andWhere(`${config.entityAlias}.${columnName} = :companyId`, {
|
|
707
|
+
companyId: user.companyId
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
return query;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Build a where condition object with optional company filter.
|
|
714
|
+
*
|
|
715
|
+
* @param baseWhere - Base where condition object
|
|
716
|
+
* @param isCompanyFeatureEnabled - Whether company feature is enabled
|
|
717
|
+
* @param user - Current logged user
|
|
718
|
+
* @returns Where condition with companyId added if applicable
|
|
719
|
+
*
|
|
720
|
+
* @example
|
|
721
|
+
* ```typescript
|
|
722
|
+
* const where = buildCompanyWhereCondition(
|
|
723
|
+
* { id: dto.id },
|
|
724
|
+
* this.config.isCompanyFeatureEnabled(),
|
|
725
|
+
* user
|
|
726
|
+
* );
|
|
727
|
+
* // Returns { id: dto.id, companyId: user.companyId } if company feature enabled
|
|
728
|
+
* ```
|
|
729
|
+
*/ function buildCompanyWhereCondition(baseWhere, isCompanyFeatureEnabled, user) {
|
|
730
|
+
if (isCompanyFeatureEnabled && user?.companyId) {
|
|
731
|
+
return {
|
|
732
|
+
...baseWhere,
|
|
733
|
+
companyId: user.companyId
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
return baseWhere;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Type guard to check if entity has companyId property
|
|
740
|
+
*/ function hasCompanyId(entity) {
|
|
741
|
+
return entity !== null && typeof entity === 'object' && 'companyId' in entity;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Validates that an entity with companyId belongs to the user's company.
|
|
745
|
+
* Throws BadRequestException if the entity belongs to another company.
|
|
746
|
+
*
|
|
747
|
+
* @param entity - Entity to validate
|
|
748
|
+
* @param user - Current logged user
|
|
749
|
+
* @param isCompanyFeatureEnabled - Whether company feature is enabled
|
|
750
|
+
* @param entityName - Name of entity for error message (e.g., 'Email configuration')
|
|
751
|
+
* @throws BadRequestException if entity belongs to another company
|
|
752
|
+
*
|
|
753
|
+
* @example
|
|
754
|
+
* ```typescript
|
|
755
|
+
* validateCompanyOwnership(config, user, this.config.isCompanyFeatureEnabled(), 'Email configuration');
|
|
756
|
+
* ```
|
|
757
|
+
*/ function validateCompanyOwnership(entity, user, isCompanyFeatureEnabled, entityName) {
|
|
758
|
+
if (isCompanyFeatureEnabled && user?.companyId && hasCompanyId(entity)) {
|
|
759
|
+
if (entity.companyId && entity.companyId !== user.companyId) {
|
|
760
|
+
throw new common_.BadRequestException({
|
|
761
|
+
message: `${entityName} belongs to another company`,
|
|
762
|
+
messageKey: message_keys/* .AUTH_MESSAGES.ENTITY_BELOG_ANOTHER_COMPANY */.mK.ENTITY_BELOG_ANOTHER_COMPANY,
|
|
763
|
+
messageVariables: {
|
|
764
|
+
entity: entityName
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// EXTERNAL MODULE: external "@flusys/nestjs-core/config"
|
|
772
|
+
var config_ = __webpack_require__(307);
|
|
773
|
+
// EXTERNAL MODULE: ./projects/nestjs-shared/src/constants/index.ts
|
|
774
|
+
var constants = __webpack_require__(43);
|
|
775
|
+
;// CONCATENATED MODULE: ./projects/nestjs-shared/src/utils/request.util.ts
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
/** Time unit multipliers in milliseconds */ const TIME_UNIT_MS = {
|
|
780
|
+
s: 1000,
|
|
781
|
+
m: 60 * 1000,
|
|
782
|
+
h: 60 * 60 * 1000,
|
|
783
|
+
d: 24 * 60 * 60 * 1000,
|
|
784
|
+
w: 7 * 24 * 60 * 60 * 1000
|
|
785
|
+
};
|
|
786
|
+
/** Get normalized client type from request header */ function getClientType(req) {
|
|
787
|
+
const clientType = req.headers[constants/* .CLIENT_TYPE_HEADER */.xw];
|
|
788
|
+
return clientType ? clientType.toLowerCase() : null;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Detect if request is from a browser client.
|
|
792
|
+
* Uses x-client-type header first, then falls back to user-agent detection.
|
|
793
|
+
*/ function isBrowserRequest(req) {
|
|
794
|
+
const clientType = getClientType(req);
|
|
795
|
+
if (clientType) {
|
|
796
|
+
return clientType === 'browser' || clientType === 'web';
|
|
797
|
+
}
|
|
798
|
+
const accept = req.headers['accept'] || '';
|
|
799
|
+
if (accept.includes('text/html')) return true;
|
|
800
|
+
const userAgent = req.headers['user-agent'] || '';
|
|
801
|
+
const browserPatterns = /mozilla|chrome|safari|firefox|edge|opera|msie/i;
|
|
802
|
+
return browserPatterns.test(userAgent) && !userAgent.includes('Postman');
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Build secure cookie options based on request context.
|
|
806
|
+
* Handles HTTPS detection for TLS-terminating proxies.
|
|
807
|
+
*/ function buildCookieOptions(req) {
|
|
808
|
+
const hostname = req.hostname || '';
|
|
809
|
+
const origin = req.headers.origin || '';
|
|
810
|
+
const isProduction = config_.envConfig.isProduction();
|
|
811
|
+
const forwardedProto = req.headers['x-forwarded-proto'];
|
|
812
|
+
const isHttps = isProduction || forwardedProto === 'https' || origin.startsWith('https://') || req.secure;
|
|
813
|
+
let domain;
|
|
814
|
+
const domainParts = hostname.split('.');
|
|
815
|
+
if (domainParts.length > 2 && !hostname.includes('localhost')) {
|
|
816
|
+
domain = '.' + domainParts.slice(-2).join('.');
|
|
817
|
+
}
|
|
818
|
+
return {
|
|
819
|
+
secure: isHttps,
|
|
820
|
+
sameSite: isHttps ? 'strict' : 'lax',
|
|
821
|
+
...domain && {
|
|
822
|
+
domain
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Parse duration string to milliseconds.
|
|
828
|
+
* @example '7d' → 604800000, '24h' → 86400000, '30m' → 1800000
|
|
829
|
+
*/ function parseDurationToMs(duration, defaultMs = TIME_UNIT_MS.w) {
|
|
830
|
+
const match = duration.match(/^(\d+)(s|m|h|d|w)$/);
|
|
831
|
+
if (!match) return defaultMs;
|
|
832
|
+
const value = parseInt(match[1], 10);
|
|
833
|
+
const unit = match[2];
|
|
834
|
+
return value * (TIME_UNIT_MS[unit] ?? TIME_UNIT_MS.d);
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Determine the frontend base URL for auth-related links.
|
|
838
|
+
* Matches the request's Origin/Referer against configured allowed origins.
|
|
839
|
+
* Never trusts the request's Host header - it is client-controlled and would
|
|
840
|
+
* let an attacker redirect password-reset/verification links to their own domain.
|
|
841
|
+
*/ function extractFrontendUrl(req) {
|
|
842
|
+
const allowedOrigins = config_.envConfig.getOrigins();
|
|
843
|
+
const origin = (req.get('origin') ?? req.get('referer') ?? '').trim();
|
|
844
|
+
if (origin && allowedOrigins.length) {
|
|
845
|
+
const matched = allowedOrigins.find((u)=>origin.startsWith(u));
|
|
846
|
+
if (matched) {
|
|
847
|
+
return matched;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (allowedOrigins.length) {
|
|
851
|
+
return allowedOrigins[0];
|
|
852
|
+
}
|
|
853
|
+
throw new common_.BadRequestException({
|
|
854
|
+
message: 'Unable to determine frontend URL from request',
|
|
855
|
+
messageKey: message_keys/* .ERROR_MESSAGES.VALIDATION */.UU.VALIDATION
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
function buildFrontendUrl(req, path) {
|
|
859
|
+
const baseUrl = extractFrontendUrl(req);
|
|
860
|
+
return `${baseUrl}${path}`;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
;// CONCATENATED MODULE: ./projects/nestjs-shared/src/utils/string.util.ts
|
|
864
|
+
/**
|
|
865
|
+
* String utility functions
|
|
866
|
+
*/ /**
|
|
867
|
+
* Generate URL-friendly slug from a string
|
|
868
|
+
* @param text - The text to convert to slug
|
|
869
|
+
* @param maxLength - Maximum length of the slug (default: 100)
|
|
870
|
+
* @returns URL-friendly slug
|
|
871
|
+
*
|
|
872
|
+
* @example
|
|
873
|
+
* generateSlug('My Company Name') // 'my-company-name'
|
|
874
|
+
* generateSlug('Hello World!') // 'hello-world'
|
|
875
|
+
*/ function generateSlug(text, maxLength = 100) {
|
|
876
|
+
return text.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, '') // Remove special characters
|
|
877
|
+
.replace(/\s+/g, '-') // Replace spaces with hyphens
|
|
878
|
+
.replace(/-+/g, '-') // Replace multiple hyphens with single
|
|
879
|
+
.replace(/^-+|-+$/g, '') // Remove leading/trailing hyphens
|
|
880
|
+
.substring(0, maxLength);
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Generate unique slug using single database query (optimized for large datasets)
|
|
884
|
+
* Appends numeric suffix if collision exists (e.g., 'my-company-1', 'my-company-2')
|
|
885
|
+
*
|
|
886
|
+
* Performance: O(1) database query regardless of collision count
|
|
887
|
+
* - Works efficiently with millions of records
|
|
888
|
+
* - Requires index on slug column for best performance
|
|
889
|
+
*
|
|
890
|
+
* @param text - The text to convert to slug
|
|
891
|
+
* @param findMatchingSlugs - Async function that returns all slugs matching base pattern
|
|
892
|
+
* Should query: WHERE slug = baseSlug OR slug LIKE 'baseSlug-%'
|
|
893
|
+
* @param maxLength - Maximum length of the base slug (default: 100)
|
|
894
|
+
* @returns Unique URL-friendly slug
|
|
895
|
+
*
|
|
896
|
+
* @example
|
|
897
|
+
* const slug = await generateUniqueSlug('My Company', async (baseSlug) => {
|
|
898
|
+
* return repo
|
|
899
|
+
* .createQueryBuilder('c')
|
|
900
|
+
* .select('c.slug')
|
|
901
|
+
* .where('c.slug = :base OR c.slug LIKE :pattern', {
|
|
902
|
+
* base: baseSlug,
|
|
903
|
+
* pattern: `${baseSlug}-%`,
|
|
904
|
+
* })
|
|
905
|
+
* .getMany()
|
|
906
|
+
* .then(rows => rows.map(r => r.slug));
|
|
907
|
+
* });
|
|
908
|
+
*/ async function generateUniqueSlug(text, findMatchingSlugs, maxLength = 100) {
|
|
909
|
+
const baseSlug = generateSlug(text, maxLength);
|
|
910
|
+
// Single query to get all matching slugs
|
|
911
|
+
const existingSlugs = await findMatchingSlugs(baseSlug);
|
|
912
|
+
// No collisions - base slug is available
|
|
913
|
+
if (existingSlugs.length === 0) {
|
|
914
|
+
return baseSlug;
|
|
915
|
+
}
|
|
916
|
+
// Build set for O(1) lookup
|
|
917
|
+
const existingSet = new Set(existingSlugs);
|
|
918
|
+
// Base slug not taken (only suffixed versions exist)
|
|
919
|
+
if (!existingSet.has(baseSlug)) {
|
|
920
|
+
return baseSlug;
|
|
921
|
+
}
|
|
922
|
+
// Find next available suffix in memory (fast)
|
|
923
|
+
let counter = 1;
|
|
924
|
+
while(counter < 10000){
|
|
925
|
+
const slugWithSuffix = `${baseSlug}-${counter}`;
|
|
926
|
+
if (!existingSet.has(slugWithSuffix)) {
|
|
927
|
+
return slugWithSuffix;
|
|
928
|
+
}
|
|
929
|
+
counter++;
|
|
930
|
+
}
|
|
931
|
+
// Fallback: append random string (extremely rare edge case)
|
|
932
|
+
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
933
|
+
return `${baseSlug}-${randomSuffix}`;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
;// CONCATENATED MODULE: ./projects/nestjs-shared/src/utils/index.ts
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
},
|
|
948
|
+
368(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
949
|
+
/**
|
|
950
|
+
* Loads an optional peer dependency at runtime.
|
|
951
|
+
*
|
|
952
|
+
* The specifier has to stay invisible to the bundler. A plain `import(name)`
|
|
953
|
+
* looks dynamic in source but webpack rewrites it into a context module rooted
|
|
954
|
+
* at this directory - one that can only ever resolve files sitting next to this
|
|
955
|
+
* one - so `amqplib` and `kafkajs` fail to load in the bundled app no matter how
|
|
956
|
+
* correctly they are installed. Both lookups below are assembled at runtime,
|
|
957
|
+
* where no bundler can rewrite them.
|
|
958
|
+
*
|
|
959
|
+
* `require` is used first because it is what the CommonJS builds actually run
|
|
960
|
+
* on; native ESM has no `require`, and there `import()` is the only way in.
|
|
961
|
+
*/ async function loadOptionalModule(name) {
|
|
962
|
+
const runtimeRequire = resolveRuntimeRequire();
|
|
963
|
+
if (runtimeRequire) return runtimeRequire(name);
|
|
964
|
+
const runtimeImport = new Function('specifier', 'return import(specifier);');
|
|
965
|
+
return runtimeImport(name);
|
|
966
|
+
}
|
|
967
|
+
/** Undefined under native ESM and inside a bundle that shadows nothing back */ function resolveRuntimeRequire() {
|
|
968
|
+
try {
|
|
969
|
+
return eval('typeof require === "function" ? require : undefined');
|
|
970
|
+
} catch {
|
|
971
|
+
return undefined;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
976
|
+
l: () => (loadOptionalModule)
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
},
|
|
981
|
+
199(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
982
|
+
/* import */ var _constants_index_js__rspack_import_0 = __webpack_require__(43);
|
|
983
|
+
|
|
984
|
+
const DEFAULT_USER_PERMISSION_KEY_FORMAT = `${_constants_index_js__rspack_import_0/* .PERMISSIONS_CACHE_PREFIX */.fG}:user:{userId}`;
|
|
985
|
+
const DEFAULT_COMPANY_PERMISSION_KEY_FORMAT = `${_constants_index_js__rspack_import_0/* .PERMISSIONS_CACHE_PREFIX */.fG}:company:{companyId}:branch:{branchId}:user:{userId}`;
|
|
986
|
+
/** Single source of truth for permission cache keys, shared by the guard (reader) and cache service (writer) so a config override can't desync them; company scope requires enableCompanyFeature, not just a companyId */ function buildPermissionCacheKey(options, config) {
|
|
987
|
+
const isCompanyScope = Boolean(config?.enableCompanyFeature && options.companyId);
|
|
988
|
+
if (isCompanyScope) {
|
|
989
|
+
return (config?.companyPermissionKeyFormat || DEFAULT_COMPANY_PERMISSION_KEY_FORMAT).replace('{userId}', options.userId).replace('{companyId}', options.companyId).replace('{branchId}', options.branchId || 'null');
|
|
990
|
+
}
|
|
991
|
+
return (config?.userPermissionKeyFormat || DEFAULT_USER_PERMISSION_KEY_FORMAT).replace('{userId}', options.userId);
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
995
|
+
nt: () => (buildPermissionCacheKey)
|
|
996
|
+
}, {
|
|
997
|
+
q6: DEFAULT_USER_PERMISSION_KEY_FORMAT,
|
|
998
|
+
s8: DEFAULT_COMPANY_PERMISSION_KEY_FORMAT
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
},
|
|
1003
|
+
307(module) {
|
|
1004
|
+
|
|
1005
|
+
module.exports = __rspack_external__flusys_nestjs_core_config_197fa0a9;
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
},
|
|
1009
|
+
157(module) {
|
|
1010
|
+
|
|
1011
|
+
module.exports = __rspack_external__nestjs_common_a04939da;
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
},
|
|
1015
|
+
|
|
1016
|
+
};
|
|
1017
|
+
import { __webpack_require__ } from '../runtime.js';
|
|
1018
|
+
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
1019
|
+
import * as __rspack_chunk_1 from './index.js';
|
|
1020
|
+
__webpack_require__.C(__rspack_chunk_1);
|
|
1021
|
+
var __webpack_exports__ = __webpack_exec__(306);var __webpack_exports__DEFAULT_COMPANY_PERMISSION_KEY_FORMAT = __webpack_exports__.s8;
|
|
1022
|
+
var __webpack_exports__DEFAULT_USER_PERMISSION_KEY_FORMAT = __webpack_exports__.q6;
|
|
1023
|
+
var __webpack_exports__applyCompanyFilter = __webpack_exports__.wf;
|
|
1024
|
+
var __webpack_exports__buildCompanyWhereCondition = __webpack_exports__.kQ;
|
|
1025
|
+
var __webpack_exports__buildCookieOptions = __webpack_exports__.fJ;
|
|
1026
|
+
var __webpack_exports__buildFrontendUrl = __webpack_exports__.oV;
|
|
1027
|
+
var __webpack_exports__buildPermissionCacheKey = __webpack_exports__.nt;
|
|
1028
|
+
var __webpack_exports__escapeHtml = __webpack_exports__.ZD;
|
|
1029
|
+
var __webpack_exports__escapeHtmlVariables = __webpack_exports__.qo;
|
|
1030
|
+
var __webpack_exports__extractFrontendUrl = __webpack_exports__.hX;
|
|
1031
|
+
var __webpack_exports__formatInTimezone = __webpack_exports__.Sd;
|
|
1032
|
+
var __webpack_exports__generateSlug = __webpack_exports__.z9;
|
|
1033
|
+
var __webpack_exports__generateUniqueSlug = __webpack_exports__.oo;
|
|
1034
|
+
var __webpack_exports__getTodayInTimezone = __webpack_exports__.oB;
|
|
1035
|
+
var __webpack_exports__hasCompanyId = __webpack_exports__.f;
|
|
1036
|
+
var __webpack_exports__isBrowserRequest = __webpack_exports__.wh;
|
|
1037
|
+
var __webpack_exports__isMultiWildcard = __webpack_exports__._c;
|
|
1038
|
+
var __webpack_exports__loadOptionalModule = __webpack_exports__.lk;
|
|
1039
|
+
var __webpack_exports__localToUtc = __webpack_exports__.vf;
|
|
1040
|
+
var __webpack_exports__matchEventPattern = __webpack_exports__.qe;
|
|
1041
|
+
var __webpack_exports__parseDurationToMs = __webpack_exports__.Ju;
|
|
1042
|
+
var __webpack_exports__sanitizeEventPayload = __webpack_exports__.IN;
|
|
1043
|
+
var __webpack_exports__utcToLocal = __webpack_exports__.v4;
|
|
1044
|
+
var __webpack_exports__validateCompanyOwnership = __webpack_exports__.bE;
|
|
1045
|
+
export { __webpack_exports__DEFAULT_COMPANY_PERMISSION_KEY_FORMAT as DEFAULT_COMPANY_PERMISSION_KEY_FORMAT, __webpack_exports__DEFAULT_USER_PERMISSION_KEY_FORMAT as DEFAULT_USER_PERMISSION_KEY_FORMAT, __webpack_exports__applyCompanyFilter as applyCompanyFilter, __webpack_exports__buildCompanyWhereCondition as buildCompanyWhereCondition, __webpack_exports__buildCookieOptions as buildCookieOptions, __webpack_exports__buildFrontendUrl as buildFrontendUrl, __webpack_exports__buildPermissionCacheKey as buildPermissionCacheKey, __webpack_exports__escapeHtml as escapeHtml, __webpack_exports__escapeHtmlVariables as escapeHtmlVariables, __webpack_exports__extractFrontendUrl as extractFrontendUrl, __webpack_exports__formatInTimezone as formatInTimezone, __webpack_exports__generateSlug as generateSlug, __webpack_exports__generateUniqueSlug as generateUniqueSlug, __webpack_exports__getTodayInTimezone as getTodayInTimezone, __webpack_exports__hasCompanyId as hasCompanyId, __webpack_exports__isBrowserRequest as isBrowserRequest, __webpack_exports__isMultiWildcard as isMultiWildcard, __webpack_exports__loadOptionalModule as loadOptionalModule, __webpack_exports__localToUtc as localToUtc, __webpack_exports__matchEventPattern as matchEventPattern, __webpack_exports__parseDurationToMs as parseDurationToMs, __webpack_exports__sanitizeEventPayload as sanitizeEventPayload, __webpack_exports__utcToLocal as utcToLocal, __webpack_exports__validateCompanyOwnership as validateCompanyOwnership };
|