@flusys/nestjs-localization 9.1.2 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/controllers/language.controller.d.ts +5 -7
- package/controllers/translation-key.controller.d.ts +1 -0
- package/controllers/translation.controller.d.ts +3 -2
- package/dtos/dto-transforms.d.ts +4 -0
- package/dtos/language.dto.d.ts +3 -0
- package/fesm/349.js +102 -51
- package/fesm/{692.js → 901.js} +127 -52
- package/fesm/controllers/index.js +1 -1
- package/fesm/docs/index.js +1 -3
- package/fesm/dtos/index.js +79 -45
- package/fesm/index.js +9 -7
- package/fesm/modules/index.js +3 -3
- package/fesm/services/index.js +2 -2
- package/package.json +3 -3
- package/services/language.service.d.ts +8 -2
- package/services/translation-key.service.d.ts +1 -0
- package/services/translation.service.d.ts +1 -0
package/README.md
CHANGED
|
@@ -31,8 +31,6 @@ LocalizationModule.forRoot({
|
|
|
31
31
|
},
|
|
32
32
|
config: {
|
|
33
33
|
defaultLanguageCode: 'en', // fallback language code
|
|
34
|
-
enableCaching: false, // optional HybridCache for translation lookups
|
|
35
|
-
cacheTtlSeconds: 300,
|
|
36
34
|
defaultDatabaseConfig: {
|
|
37
35
|
type: 'mysql',
|
|
38
36
|
host: process.env.DB_HOST,
|
|
@@ -60,8 +58,6 @@ LocalizationModule.forRootAsync({
|
|
|
60
58
|
imports: [ConfigModule],
|
|
61
59
|
useFactory: (cfg: ConfigService) => ({
|
|
62
60
|
defaultLanguageCode: cfg.get('DEFAULT_LANGUAGE', 'en'),
|
|
63
|
-
enableCaching: cfg.get<boolean>('LOCALIZATION_CACHE_ENABLED', false),
|
|
64
|
-
cacheTtlSeconds: cfg.get<number>('LOCALIZATION_CACHE_TTL', 300),
|
|
65
61
|
defaultDatabaseConfig: {
|
|
66
62
|
type: 'mysql',
|
|
67
63
|
host: cfg.get('DB_HOST'),
|
|
@@ -89,6 +85,14 @@ TypeOrmModule.forRoot({
|
|
|
89
85
|
|
|
90
86
|
---
|
|
91
87
|
|
|
88
|
+
## 3. Caching and the default language
|
|
89
|
+
|
|
90
|
+
`LanguageService`, `TranslationKeyService` and `TranslationService` cache their `get-all` / `get-by-id` reads through the shared `HybridCache` (version stamps, see nestjs-shared README section 7). The `enableCaching` / `cacheTtlSeconds` config fields are not read; the shared cache's TTL applies.
|
|
91
|
+
|
|
92
|
+
- Every write bumps its own entity's stamp after commit. The translation cache also depends on `translationKey` (the `module` filter joins it) and `language`, so key and language changes invalidate it; a permanent delete of a language or key (which cascades to translations by FK) bumps the translation stamp explicitly as well.
|
|
93
|
+
- `update-many-values` (bulk translation upsert) bumps the translation stamp once after its transaction commits.
|
|
94
|
+
- `get-by-language` (the frontend's module lazy-load endpoint), `get-active`, `get-default`, `get-modules` and `get-counts` are not cached - they always read the database, so a translation, key or language change (active flag, default) is visible on the next request on every instance.
|
|
95
|
+
- One default language: `set-default`, and any insert/update that sets `isDefault: true`, lock all language rows (`SELECT ... FOR UPDATE`, id order) before demoting the others in the same transaction; language delete takes the same lock before its default/readonly check. Concurrent switches serialize, so they cannot leave two defaults or delete the language that just became default.
|
|
92
96
|
|
|
93
97
|
## 4. How API responses use messageKey
|
|
94
98
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ListResponseDto, SingleResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
2
2
|
import { type ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
3
|
-
import { CreateLanguageDto, LanguageResponseDto, UpdateLanguageDto } from '../dtos/index.js';
|
|
4
|
-
import { type ILanguage } from '../interfaces/index.js';
|
|
3
|
+
import { CreateLanguageDto, LanguageResponseDto, SetDefaultLanguageDto, UpdateLanguageDto } from '../dtos/index.js';
|
|
5
4
|
import { LanguageService } from '../services/index.js';
|
|
6
5
|
declare const LanguageController_base: abstract new (service: LanguageService) => {
|
|
7
6
|
readonly enabledEndpoints: import("@flusys/nestjs-shared").ApiEndpoint[] | "all";
|
|
8
7
|
service: LanguageService;
|
|
9
8
|
isEnabled(endpoint: import("@flusys/nestjs-shared").ApiEndpoint): boolean;
|
|
9
|
+
assertEnabled(endpoint: import("@flusys/nestjs-shared").ApiEndpoint): void;
|
|
10
10
|
insert(addDto: CreateLanguageDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<LanguageResponseDto>>;
|
|
11
11
|
insertMany(addDto: CreateLanguageDto[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").BulkResponseDto<LanguageResponseDto>>;
|
|
12
12
|
getById(id: string, body: import("@flusys/nestjs-shared").GetByIdBodyDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<LanguageResponseDto>>;
|
|
@@ -21,10 +21,8 @@ declare const LanguageController_base: abstract new (service: LanguageService) =
|
|
|
21
21
|
export declare class LanguageController extends LanguageController_base {
|
|
22
22
|
service: LanguageService;
|
|
23
23
|
constructor(service: LanguageService);
|
|
24
|
-
getActive(): Promise<ListResponseDto<
|
|
25
|
-
getDefault(): Promise<SingleResponseDto<
|
|
26
|
-
setDefault(body:
|
|
27
|
-
id: string;
|
|
28
|
-
}, _user: ILoggedUserInfo): Promise<SingleResponseDto<ILanguage>>;
|
|
24
|
+
getActive(): Promise<ListResponseDto<LanguageResponseDto>>;
|
|
25
|
+
getDefault(): Promise<SingleResponseDto<LanguageResponseDto>>;
|
|
26
|
+
setDefault(body: SetDefaultLanguageDto, _user: ILoggedUserInfo): Promise<SingleResponseDto<LanguageResponseDto>>;
|
|
29
27
|
}
|
|
30
28
|
export {};
|
|
@@ -6,6 +6,7 @@ declare const TranslationKeyController_base: abstract new (service: TranslationK
|
|
|
6
6
|
readonly enabledEndpoints: import("@flusys/nestjs-shared").ApiEndpoint[] | "all";
|
|
7
7
|
service: TranslationKeyService;
|
|
8
8
|
isEnabled(endpoint: import("@flusys/nestjs-shared").ApiEndpoint): boolean;
|
|
9
|
+
assertEnabled(endpoint: import("@flusys/nestjs-shared").ApiEndpoint): void;
|
|
9
10
|
insert(addDto: CreateTranslationKeyDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<TranslationKeyResponseDto>>;
|
|
10
11
|
insertMany(addDto: CreateTranslationKeyDto[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").BulkResponseDto<TranslationKeyResponseDto>>;
|
|
11
12
|
getById(id: string, body: import("@flusys/nestjs-shared").GetByIdBodyDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<TranslationKeyResponseDto>>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { BulkResponseDto, SingleResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
2
2
|
import { type ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
3
3
|
import { BulkUpdateTranslationsDto, CreateTranslationDto, GetTranslationsByLanguageDto, TranslationResponseDto, UpdateTranslationDto } from '../dtos/index.js';
|
|
4
|
-
import { type
|
|
4
|
+
import { type ITranslationsMap } from '../interfaces/index.js';
|
|
5
5
|
import { TranslationService } from '../services/index.js';
|
|
6
6
|
declare const TranslationController_base: abstract new (service: TranslationService) => {
|
|
7
7
|
readonly enabledEndpoints: import("@flusys/nestjs-shared").ApiEndpoint[] | "all";
|
|
8
8
|
service: TranslationService;
|
|
9
9
|
isEnabled(endpoint: import("@flusys/nestjs-shared").ApiEndpoint): boolean;
|
|
10
|
+
assertEnabled(endpoint: import("@flusys/nestjs-shared").ApiEndpoint): void;
|
|
10
11
|
insert(addDto: CreateTranslationDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<TranslationResponseDto>>;
|
|
11
12
|
insertMany(addDto: CreateTranslationDto[], user: ILoggedUserInfo | null): Promise<BulkResponseDto<TranslationResponseDto>>;
|
|
12
13
|
getById(id: string, body: import("@flusys/nestjs-shared").GetByIdBodyDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<TranslationResponseDto>>;
|
|
@@ -22,7 +23,7 @@ export declare class TranslationController extends TranslationController_base {
|
|
|
22
23
|
service: TranslationService;
|
|
23
24
|
constructor(service: TranslationService);
|
|
24
25
|
getByLanguage(body: GetTranslationsByLanguageDto): Promise<SingleResponseDto<ITranslationsMap>>;
|
|
25
|
-
updateManyValues(body: BulkUpdateTranslationsDto, _user: ILoggedUserInfo): Promise<BulkResponseDto<
|
|
26
|
+
updateManyValues(body: BulkUpdateTranslationsDto, _user: ILoggedUserInfo): Promise<BulkResponseDto<TranslationResponseDto>>;
|
|
26
27
|
getCounts(_user: ILoggedUserInfo): Promise<SingleResponseDto<Record<string, number>>>;
|
|
27
28
|
}
|
|
28
29
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type TransformFnParams } from 'class-transformer';
|
|
2
|
+
export declare const trimString: ({ value }: TransformFnParams) => unknown;
|
|
3
|
+
export declare const trimLowerString: ({ value }: TransformFnParams) => unknown;
|
|
4
|
+
export declare const trimStringArray: ({ value }: TransformFnParams) => unknown;
|
package/dtos/language.dto.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ declare const UpdateLanguageDto_base: import("@nestjs/common").Type<Partial<Crea
|
|
|
12
12
|
export declare class UpdateLanguageDto extends UpdateLanguageDto_base {
|
|
13
13
|
id: string;
|
|
14
14
|
}
|
|
15
|
+
export declare class SetDefaultLanguageDto {
|
|
16
|
+
id: string;
|
|
17
|
+
}
|
|
15
18
|
export declare class LanguageResponseDto extends IdentityResponseDto {
|
|
16
19
|
code: string;
|
|
17
20
|
name: string;
|
package/fesm/349.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IdentityResponseDto } from "@flusys/nestjs-shared/dtos";
|
|
2
|
-
import {
|
|
3
|
-
import { IsArray, IsBoolean, IsIn, IsNumber, IsOptional, IsString, IsUUID, MaxLength, ValidateNested } from "class-validator";
|
|
2
|
+
import { IsArray, IsBoolean, IsIn, IsNotEmpty, IsNumber, IsOptional, IsString, IsUUID, MaxLength, ValidateNested } from "class-validator";
|
|
4
3
|
import * as __rspack_external__nestjs_swagger_7cd450b5 from "@nestjs/swagger";
|
|
4
|
+
import * as __rspack_external_class_transformer_c5a479fb from "class-transformer";
|
|
5
5
|
import * as __rspack_external__flusys_nestjs_shared_decorators_c129b601 from "@flusys/nestjs-shared/decorators";
|
|
6
6
|
import * as __rspack_external__flusys_nestjs_shared_guards_3f79ddd1 from "@flusys/nestjs-shared/guards";
|
|
7
7
|
export const __rspack_esm_id = 349;
|
|
@@ -26,12 +26,14 @@ var classes_ = __webpack_require__(937);
|
|
|
26
26
|
var common_ = __webpack_require__(157);
|
|
27
27
|
// EXTERNAL MODULE: external "@nestjs/swagger"
|
|
28
28
|
var swagger_ = __webpack_require__(176);
|
|
29
|
+
// EXTERNAL MODULE: external "class-transformer"
|
|
30
|
+
var external_class_transformer_ = __webpack_require__(812);
|
|
29
31
|
// EXTERNAL MODULE: ./projects/nestjs-localization/src/config/message-keys.ts
|
|
30
32
|
var message_keys = __webpack_require__(68);
|
|
31
33
|
// EXTERNAL MODULE: ./projects/nestjs-localization/src/dtos/index.ts + 6 modules
|
|
32
|
-
var dtos = __webpack_require__(
|
|
33
|
-
// EXTERNAL MODULE: ./projects/nestjs-localization/src/services/index.ts +
|
|
34
|
-
var services = __webpack_require__(
|
|
34
|
+
var dtos = __webpack_require__(384);
|
|
35
|
+
// EXTERNAL MODULE: ./projects/nestjs-localization/src/services/index.ts + 7 modules
|
|
36
|
+
var services = __webpack_require__(140);
|
|
35
37
|
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/controllers/language.controller.ts
|
|
36
38
|
function _ts_decorate(decorators, target, key, desc) {
|
|
37
39
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -64,6 +66,12 @@ function _ts_param(paramIndex, decorator) {
|
|
|
64
66
|
|
|
65
67
|
|
|
66
68
|
|
|
69
|
+
|
|
70
|
+
function toLanguageResponse(input) {
|
|
71
|
+
return (0,external_class_transformer_.plainToInstance)(dtos/* .LanguageResponseDto */.Z_, input, {
|
|
72
|
+
excludeExtraneousValues: true
|
|
73
|
+
});
|
|
74
|
+
}
|
|
67
75
|
class LanguageController extends (0,classes_.createApiController)(dtos/* .CreateLanguageDto */.qk, dtos/* .UpdateLanguageDto */.xd, dtos/* .LanguageResponseDto */.Z_, {
|
|
68
76
|
entityName: 'language',
|
|
69
77
|
security: {
|
|
@@ -116,7 +124,7 @@ class LanguageController extends (0,classes_.createApiController)(dtos/* .Create
|
|
|
116
124
|
super(service), this.service = service;
|
|
117
125
|
}
|
|
118
126
|
async getActive() {
|
|
119
|
-
const data = await this.service.getActiveLanguages();
|
|
127
|
+
const data = toLanguageResponse(await this.service.getActiveLanguages());
|
|
120
128
|
return {
|
|
121
129
|
success: true,
|
|
122
130
|
message: 'Active languages retrieved successfully',
|
|
@@ -136,7 +144,7 @@ class LanguageController extends (0,classes_.createApiController)(dtos/* .Create
|
|
|
136
144
|
success: true,
|
|
137
145
|
message: 'Default language retrieved successfully',
|
|
138
146
|
messageKey: message_keys/* .LANGUAGE_MESSAGES.GET_DEFAULT_SUCCESS */.ew.GET_DEFAULT_SUCCESS,
|
|
139
|
-
data: data
|
|
147
|
+
data: data ? toLanguageResponse(data) : undefined
|
|
140
148
|
};
|
|
141
149
|
}
|
|
142
150
|
async setDefault(body, _user) {
|
|
@@ -145,12 +153,13 @@ class LanguageController extends (0,classes_.createApiController)(dtos/* .Create
|
|
|
145
153
|
success: true,
|
|
146
154
|
message: 'Default language updated successfully',
|
|
147
155
|
messageKey: message_keys/* .LANGUAGE_MESSAGES.SET_DEFAULT_SUCCESS */.ew.SET_DEFAULT_SUCCESS,
|
|
148
|
-
data: data
|
|
156
|
+
data: data ? toLanguageResponse(data) : undefined
|
|
149
157
|
};
|
|
150
158
|
}
|
|
151
159
|
}
|
|
152
160
|
_ts_decorate([
|
|
153
161
|
(0,common_.Post)('get-active'),
|
|
162
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
154
163
|
(0,swagger_.ApiOperation)({
|
|
155
164
|
summary: 'Get all active languages'
|
|
156
165
|
}),
|
|
@@ -166,6 +175,7 @@ _ts_decorate([
|
|
|
166
175
|
], LanguageController.prototype, "getActive", null);
|
|
167
176
|
_ts_decorate([
|
|
168
177
|
(0,common_.Post)('get-default'),
|
|
178
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
169
179
|
(0,swagger_.ApiOperation)({
|
|
170
180
|
summary: 'Get default language'
|
|
171
181
|
}),
|
|
@@ -181,6 +191,7 @@ _ts_decorate([
|
|
|
181
191
|
(0,common_.Post)('set-default'),
|
|
182
192
|
(0,common_.UseGuards)(__rspack_external__flusys_nestjs_shared_guards_3f79ddd1.JwtAuthGuard, __rspack_external__flusys_nestjs_shared_guards_3f79ddd1.PermissionGuard),
|
|
183
193
|
(0,swagger_.ApiBearerAuth)(),
|
|
194
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
184
195
|
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(classes_.LANGUAGE_PERMISSIONS.UPDATE),
|
|
185
196
|
(0,swagger_.ApiOperation)({
|
|
186
197
|
summary: 'Set a language as default'
|
|
@@ -193,7 +204,7 @@ _ts_decorate([
|
|
|
193
204
|
_ts_param(1, (0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.CurrentUser)()),
|
|
194
205
|
_ts_metadata("design:type", Function),
|
|
195
206
|
_ts_metadata("design:paramtypes", [
|
|
196
|
-
Object,
|
|
207
|
+
typeof dtos/* .SetDefaultLanguageDto */.xt === "undefined" ? Object : dtos/* .SetDefaultLanguageDto */.xt,
|
|
197
208
|
typeof ILoggedUserInfo === "undefined" ? Object : ILoggedUserInfo
|
|
198
209
|
]),
|
|
199
210
|
_ts_metadata("design:returntype", Promise)
|
|
@@ -305,6 +316,7 @@ translation_key_controller_ts_decorate([
|
|
|
305
316
|
(0,common_.Post)('get-modules'),
|
|
306
317
|
(0,common_.UseGuards)(__rspack_external__flusys_nestjs_shared_guards_3f79ddd1.JwtAuthGuard),
|
|
307
318
|
(0,swagger_.ApiBearerAuth)(),
|
|
319
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
308
320
|
(0,swagger_.ApiOperation)({
|
|
309
321
|
summary: 'Get all distinct module names'
|
|
310
322
|
}),
|
|
@@ -363,6 +375,7 @@ function translation_controller_ts_param(paramIndex, decorator) {
|
|
|
363
375
|
|
|
364
376
|
|
|
365
377
|
|
|
378
|
+
|
|
366
379
|
class TranslationController extends (0,classes_.createApiController)(dtos/* .CreateTranslationDto */.li, dtos/* .UpdateTranslationDto */.qq, dtos/* .TranslationResponseDto */.uG, {
|
|
367
380
|
entityName: 'translation',
|
|
368
381
|
security: {
|
|
@@ -424,7 +437,9 @@ class TranslationController extends (0,classes_.createApiController)(dtos/* .Cre
|
|
|
424
437
|
};
|
|
425
438
|
}
|
|
426
439
|
async updateManyValues(body, _user) {
|
|
427
|
-
const data = await this.service.bulkUpdate(body.translations)
|
|
440
|
+
const data = (0,external_class_transformer_.plainToInstance)(dtos/* .TranslationResponseDto */.uG, await this.service.bulkUpdate(body.translations), {
|
|
441
|
+
excludeExtraneousValues: true
|
|
442
|
+
});
|
|
428
443
|
return {
|
|
429
444
|
success: true,
|
|
430
445
|
message: `${data.length} translations updated`,
|
|
@@ -450,6 +465,7 @@ class TranslationController extends (0,classes_.createApiController)(dtos/* .Cre
|
|
|
450
465
|
}
|
|
451
466
|
translation_controller_ts_decorate([
|
|
452
467
|
(0,common_.Post)('get-by-language'),
|
|
468
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
453
469
|
(0,swagger_.ApiOperation)({
|
|
454
470
|
summary: 'Get translations for a language (optionally filtered by modules)'
|
|
455
471
|
}),
|
|
@@ -467,6 +483,7 @@ translation_controller_ts_decorate([
|
|
|
467
483
|
(0,common_.Post)('update-many-values'),
|
|
468
484
|
(0,common_.UseGuards)(__rspack_external__flusys_nestjs_shared_guards_3f79ddd1.JwtAuthGuard, __rspack_external__flusys_nestjs_shared_guards_3f79ddd1.PermissionGuard),
|
|
469
485
|
(0,swagger_.ApiBearerAuth)(),
|
|
486
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
470
487
|
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(classes_.TRANSLATION_PERMISSIONS.UPDATE),
|
|
471
488
|
(0,swagger_.ApiOperation)({
|
|
472
489
|
summary: 'Bulk update translation values'
|
|
@@ -490,6 +507,7 @@ translation_controller_ts_decorate([
|
|
|
490
507
|
(0,common_.Post)('get-counts'),
|
|
491
508
|
(0,common_.UseGuards)(__rspack_external__flusys_nestjs_shared_guards_3f79ddd1.JwtAuthGuard, __rspack_external__flusys_nestjs_shared_guards_3f79ddd1.PermissionGuard),
|
|
492
509
|
(0,swagger_.ApiBearerAuth)(),
|
|
510
|
+
(0,common_.HttpCode)(common_.HttpStatus.OK),
|
|
493
511
|
(0,__rspack_external__flusys_nestjs_shared_decorators_c129b601.RequirePermission)(classes_.TRANSLATION_PERMISSIONS.READ),
|
|
494
512
|
(0,swagger_.ApiOperation)({
|
|
495
513
|
summary: 'Get translation counts per translation key'
|
|
@@ -521,7 +539,7 @@ TranslationController = translation_controller_ts_decorate([
|
|
|
521
539
|
|
|
522
540
|
|
|
523
541
|
},
|
|
524
|
-
|
|
542
|
+
384(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
525
543
|
|
|
526
544
|
// EXPORTS
|
|
527
545
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -532,6 +550,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
532
550
|
I3: () => (/* reexport */ CreateTranslationKeyDto),
|
|
533
551
|
Td: () => (/* reexport */ GetTranslationsByLanguageDto),
|
|
534
552
|
Z_: () => (/* reexport */ LanguageResponseDto),
|
|
553
|
+
xt: () => (/* reexport */ SetDefaultLanguageDto),
|
|
535
554
|
Ld: () => (/* reexport */ TranslationKeyResponseDto),
|
|
536
555
|
uG: () => (/* reexport */ TranslationResponseDto),
|
|
537
556
|
xd: () => (/* reexport */ UpdateLanguageDto),
|
|
@@ -543,10 +562,15 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
543
562
|
|
|
544
563
|
// EXTERNAL MODULE: external "@nestjs/swagger"
|
|
545
564
|
var swagger_ = __webpack_require__(176);
|
|
546
|
-
|
|
547
|
-
|
|
565
|
+
// EXTERNAL MODULE: external "class-transformer"
|
|
566
|
+
var external_class_transformer_ = __webpack_require__(812);
|
|
548
567
|
;// CONCATENATED MODULE: external "class-validator"
|
|
549
568
|
|
|
569
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/dtos/dto-transforms.ts
|
|
570
|
+
const trimString = ({ value })=>typeof value === 'string' ? value.trim() : value;
|
|
571
|
+
const trimLowerString = ({ value })=>typeof value === 'string' ? value.trim().toLowerCase() : value;
|
|
572
|
+
const trimStringArray = ({ value })=>Array.isArray(value) ? value.map((item)=>typeof item === 'string' ? item.trim() : item) : value;
|
|
573
|
+
|
|
550
574
|
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/dtos/language.dto.ts
|
|
551
575
|
function _ts_decorate(decorators, target, key, desc) {
|
|
552
576
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -570,6 +594,7 @@ function _ts_metadata(metadataKey, metadataValue) {
|
|
|
570
594
|
|
|
571
595
|
|
|
572
596
|
|
|
597
|
+
|
|
573
598
|
class CreateLanguageDto {
|
|
574
599
|
code;
|
|
575
600
|
name;
|
|
@@ -581,8 +606,9 @@ class CreateLanguageDto {
|
|
|
581
606
|
}
|
|
582
607
|
_ts_decorate([
|
|
583
608
|
IsString(),
|
|
609
|
+
IsNotEmpty(),
|
|
584
610
|
MaxLength(10),
|
|
585
|
-
Transform
|
|
611
|
+
(0,external_class_transformer_.Transform)(trimLowerString),
|
|
586
612
|
(0,swagger_.ApiProperty)({
|
|
587
613
|
example: 'en',
|
|
588
614
|
description: 'Language code (ISO 639-1)'
|
|
@@ -591,8 +617,9 @@ _ts_decorate([
|
|
|
591
617
|
], CreateLanguageDto.prototype, "code", void 0);
|
|
592
618
|
_ts_decorate([
|
|
593
619
|
IsString(),
|
|
620
|
+
IsNotEmpty(),
|
|
594
621
|
MaxLength(100),
|
|
595
|
-
Transform
|
|
622
|
+
(0,external_class_transformer_.Transform)(trimString),
|
|
596
623
|
(0,swagger_.ApiProperty)({
|
|
597
624
|
example: 'English',
|
|
598
625
|
description: 'Language name'
|
|
@@ -603,7 +630,7 @@ _ts_decorate([
|
|
|
603
630
|
IsOptional(),
|
|
604
631
|
IsString(),
|
|
605
632
|
MaxLength(100),
|
|
606
|
-
Transform
|
|
633
|
+
(0,external_class_transformer_.Transform)(trimString),
|
|
607
634
|
(0,swagger_.ApiPropertyOptional)({
|
|
608
635
|
example: 'English',
|
|
609
636
|
description: 'Native name of the language'
|
|
@@ -663,6 +690,16 @@ _ts_decorate([
|
|
|
663
690
|
}),
|
|
664
691
|
_ts_metadata("design:type", String)
|
|
665
692
|
], UpdateLanguageDto.prototype, "id", void 0);
|
|
693
|
+
class SetDefaultLanguageDto {
|
|
694
|
+
id;
|
|
695
|
+
}
|
|
696
|
+
_ts_decorate([
|
|
697
|
+
IsUUID(),
|
|
698
|
+
(0,swagger_.ApiProperty)({
|
|
699
|
+
description: 'Language ID'
|
|
700
|
+
}),
|
|
701
|
+
_ts_metadata("design:type", String)
|
|
702
|
+
], SetDefaultLanguageDto.prototype, "id", void 0);
|
|
666
703
|
class LanguageResponseDto extends IdentityResponseDto {
|
|
667
704
|
code;
|
|
668
705
|
name;
|
|
@@ -677,21 +714,21 @@ _ts_decorate([
|
|
|
677
714
|
(0,swagger_.ApiProperty)({
|
|
678
715
|
example: 'en'
|
|
679
716
|
}),
|
|
680
|
-
Expose(),
|
|
717
|
+
(0,external_class_transformer_.Expose)(),
|
|
681
718
|
_ts_metadata("design:type", String)
|
|
682
719
|
], LanguageResponseDto.prototype, "code", void 0);
|
|
683
720
|
_ts_decorate([
|
|
684
721
|
(0,swagger_.ApiProperty)({
|
|
685
722
|
example: 'English'
|
|
686
723
|
}),
|
|
687
|
-
Expose(),
|
|
724
|
+
(0,external_class_transformer_.Expose)(),
|
|
688
725
|
_ts_metadata("design:type", String)
|
|
689
726
|
], LanguageResponseDto.prototype, "name", void 0);
|
|
690
727
|
_ts_decorate([
|
|
691
728
|
(0,swagger_.ApiPropertyOptional)({
|
|
692
729
|
example: 'English'
|
|
693
730
|
}),
|
|
694
|
-
Expose(),
|
|
731
|
+
(0,external_class_transformer_.Expose)(),
|
|
695
732
|
_ts_metadata("design:type", Object)
|
|
696
733
|
], LanguageResponseDto.prototype, "nativeName", void 0);
|
|
697
734
|
_ts_decorate([
|
|
@@ -702,21 +739,21 @@ _ts_decorate([
|
|
|
702
739
|
'rtl'
|
|
703
740
|
]
|
|
704
741
|
}),
|
|
705
|
-
Expose(),
|
|
742
|
+
(0,external_class_transformer_.Expose)(),
|
|
706
743
|
_ts_metadata("design:type", Object)
|
|
707
744
|
], LanguageResponseDto.prototype, "direction", void 0);
|
|
708
745
|
_ts_decorate([
|
|
709
746
|
(0,swagger_.ApiProperty)({
|
|
710
747
|
example: true
|
|
711
748
|
}),
|
|
712
|
-
Expose(),
|
|
749
|
+
(0,external_class_transformer_.Expose)(),
|
|
713
750
|
_ts_metadata("design:type", Boolean)
|
|
714
751
|
], LanguageResponseDto.prototype, "isActive", void 0);
|
|
715
752
|
_ts_decorate([
|
|
716
753
|
(0,swagger_.ApiProperty)({
|
|
717
754
|
example: false
|
|
718
755
|
}),
|
|
719
|
-
Expose(),
|
|
756
|
+
(0,external_class_transformer_.Expose)(),
|
|
720
757
|
_ts_metadata("design:type", Boolean)
|
|
721
758
|
], LanguageResponseDto.prototype, "isDefault", void 0);
|
|
722
759
|
_ts_decorate([
|
|
@@ -724,18 +761,18 @@ _ts_decorate([
|
|
|
724
761
|
example: false,
|
|
725
762
|
description: 'System language: cannot be renamed or deleted'
|
|
726
763
|
}),
|
|
727
|
-
Expose(),
|
|
764
|
+
(0,external_class_transformer_.Expose)(),
|
|
728
765
|
_ts_metadata("design:type", Boolean)
|
|
729
766
|
], LanguageResponseDto.prototype, "isReadonly", void 0);
|
|
730
767
|
_ts_decorate([
|
|
731
768
|
(0,swagger_.ApiPropertyOptional)({
|
|
732
769
|
example: 1
|
|
733
770
|
}),
|
|
734
|
-
Expose(),
|
|
771
|
+
(0,external_class_transformer_.Expose)(),
|
|
735
772
|
_ts_metadata("design:type", Object)
|
|
736
773
|
], LanguageResponseDto.prototype, "serial", void 0);
|
|
737
774
|
LanguageResponseDto = _ts_decorate([
|
|
738
|
-
Exclude()
|
|
775
|
+
(0,external_class_transformer_.Exclude)()
|
|
739
776
|
], LanguageResponseDto);
|
|
740
777
|
|
|
741
778
|
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/dtos/translation-key.dto.ts
|
|
@@ -761,6 +798,7 @@ function translation_key_dto_ts_metadata(metadataKey, metadataValue) {
|
|
|
761
798
|
|
|
762
799
|
|
|
763
800
|
|
|
801
|
+
|
|
764
802
|
class CreateTranslationKeyDto {
|
|
765
803
|
module;
|
|
766
804
|
key;
|
|
@@ -773,8 +811,9 @@ class CreateTranslationKeyDto {
|
|
|
773
811
|
}
|
|
774
812
|
translation_key_dto_ts_decorate([
|
|
775
813
|
IsString(),
|
|
814
|
+
IsNotEmpty(),
|
|
776
815
|
MaxLength(100),
|
|
777
|
-
Transform
|
|
816
|
+
(0,external_class_transformer_.Transform)(trimLowerString),
|
|
778
817
|
(0,swagger_.ApiProperty)({
|
|
779
818
|
example: 'auth',
|
|
780
819
|
description: 'Module name'
|
|
@@ -783,8 +822,9 @@ translation_key_dto_ts_decorate([
|
|
|
783
822
|
], CreateTranslationKeyDto.prototype, "module", void 0);
|
|
784
823
|
translation_key_dto_ts_decorate([
|
|
785
824
|
IsString(),
|
|
825
|
+
IsNotEmpty(),
|
|
786
826
|
MaxLength(255),
|
|
787
|
-
Transform
|
|
827
|
+
(0,external_class_transformer_.Transform)(trimString),
|
|
788
828
|
(0,swagger_.ApiProperty)({
|
|
789
829
|
example: 'auth.login.success',
|
|
790
830
|
description: 'Translation key'
|
|
@@ -793,8 +833,9 @@ translation_key_dto_ts_decorate([
|
|
|
793
833
|
], CreateTranslationKeyDto.prototype, "key", void 0);
|
|
794
834
|
translation_key_dto_ts_decorate([
|
|
795
835
|
IsString(),
|
|
836
|
+
IsNotEmpty(),
|
|
796
837
|
MaxLength(500),
|
|
797
|
-
Transform
|
|
838
|
+
(0,external_class_transformer_.Transform)(trimString),
|
|
798
839
|
(0,swagger_.ApiProperty)({
|
|
799
840
|
example: 'Login successful',
|
|
800
841
|
description: 'Default English message'
|
|
@@ -804,7 +845,7 @@ translation_key_dto_ts_decorate([
|
|
|
804
845
|
translation_key_dto_ts_decorate([
|
|
805
846
|
IsOptional(),
|
|
806
847
|
IsString(),
|
|
807
|
-
Transform
|
|
848
|
+
(0,external_class_transformer_.Transform)(trimString),
|
|
808
849
|
(0,swagger_.ApiPropertyOptional)({
|
|
809
850
|
description: 'Developer notes'
|
|
810
851
|
}),
|
|
@@ -875,26 +916,26 @@ translation_key_dto_ts_decorate([
|
|
|
875
916
|
(0,swagger_.ApiProperty)({
|
|
876
917
|
example: 'auth'
|
|
877
918
|
}),
|
|
878
|
-
Expose(),
|
|
919
|
+
(0,external_class_transformer_.Expose)(),
|
|
879
920
|
translation_key_dto_ts_metadata("design:type", String)
|
|
880
921
|
], TranslationKeyResponseDto.prototype, "module", void 0);
|
|
881
922
|
translation_key_dto_ts_decorate([
|
|
882
923
|
(0,swagger_.ApiProperty)({
|
|
883
924
|
example: 'auth.login.success'
|
|
884
925
|
}),
|
|
885
|
-
Expose(),
|
|
926
|
+
(0,external_class_transformer_.Expose)(),
|
|
886
927
|
translation_key_dto_ts_metadata("design:type", String)
|
|
887
928
|
], TranslationKeyResponseDto.prototype, "key", void 0);
|
|
888
929
|
translation_key_dto_ts_decorate([
|
|
889
930
|
(0,swagger_.ApiProperty)({
|
|
890
931
|
example: 'Login successful'
|
|
891
932
|
}),
|
|
892
|
-
Expose(),
|
|
933
|
+
(0,external_class_transformer_.Expose)(),
|
|
893
934
|
translation_key_dto_ts_metadata("design:type", String)
|
|
894
935
|
], TranslationKeyResponseDto.prototype, "defaultMessage", void 0);
|
|
895
936
|
translation_key_dto_ts_decorate([
|
|
896
937
|
(0,swagger_.ApiPropertyOptional)(),
|
|
897
|
-
Expose(),
|
|
938
|
+
(0,external_class_transformer_.Expose)(),
|
|
898
939
|
translation_key_dto_ts_metadata("design:type", Object)
|
|
899
940
|
], TranslationKeyResponseDto.prototype, "description", void 0);
|
|
900
941
|
translation_key_dto_ts_decorate([
|
|
@@ -903,32 +944,32 @@ translation_key_dto_ts_decorate([
|
|
|
903
944
|
'name'
|
|
904
945
|
]
|
|
905
946
|
}),
|
|
906
|
-
Expose(),
|
|
947
|
+
(0,external_class_transformer_.Expose)(),
|
|
907
948
|
translation_key_dto_ts_metadata("design:type", Object)
|
|
908
949
|
], TranslationKeyResponseDto.prototype, "variables", void 0);
|
|
909
950
|
translation_key_dto_ts_decorate([
|
|
910
951
|
(0,swagger_.ApiProperty)({
|
|
911
952
|
example: true
|
|
912
953
|
}),
|
|
913
|
-
Expose(),
|
|
954
|
+
(0,external_class_transformer_.Expose)(),
|
|
914
955
|
translation_key_dto_ts_metadata("design:type", Boolean)
|
|
915
956
|
], TranslationKeyResponseDto.prototype, "isActive", void 0);
|
|
916
957
|
translation_key_dto_ts_decorate([
|
|
917
958
|
(0,swagger_.ApiProperty)({
|
|
918
959
|
example: false
|
|
919
960
|
}),
|
|
920
|
-
Expose(),
|
|
961
|
+
(0,external_class_transformer_.Expose)(),
|
|
921
962
|
translation_key_dto_ts_metadata("design:type", Boolean)
|
|
922
963
|
], TranslationKeyResponseDto.prototype, "isReadonly", void 0);
|
|
923
964
|
translation_key_dto_ts_decorate([
|
|
924
965
|
(0,swagger_.ApiPropertyOptional)({
|
|
925
966
|
example: 1
|
|
926
967
|
}),
|
|
927
|
-
Expose(),
|
|
968
|
+
(0,external_class_transformer_.Expose)(),
|
|
928
969
|
translation_key_dto_ts_metadata("design:type", Object)
|
|
929
970
|
], TranslationKeyResponseDto.prototype, "serial", void 0);
|
|
930
971
|
TranslationKeyResponseDto = translation_key_dto_ts_decorate([
|
|
931
|
-
Exclude()
|
|
972
|
+
(0,external_class_transformer_.Exclude)()
|
|
932
973
|
], TranslationKeyResponseDto);
|
|
933
974
|
|
|
934
975
|
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/dtos/translation.dto.ts
|
|
@@ -956,6 +997,7 @@ function translation_dto_ts_metadata(metadataKey, metadataValue) {
|
|
|
956
997
|
|
|
957
998
|
|
|
958
999
|
|
|
1000
|
+
|
|
959
1001
|
class CreateTranslationDto {
|
|
960
1002
|
languageId;
|
|
961
1003
|
translationKeyId;
|
|
@@ -979,7 +1021,7 @@ translation_dto_ts_decorate([
|
|
|
979
1021
|
], CreateTranslationDto.prototype, "translationKeyId", void 0);
|
|
980
1022
|
translation_dto_ts_decorate([
|
|
981
1023
|
IsString(),
|
|
982
|
-
Transform
|
|
1024
|
+
(0,external_class_transformer_.Transform)(trimString),
|
|
983
1025
|
(0,swagger_.ApiProperty)({
|
|
984
1026
|
example: 'Login successful',
|
|
985
1027
|
description: 'Translated value'
|
|
@@ -1044,7 +1086,7 @@ translation_dto_ts_decorate([
|
|
|
1044
1086
|
], BulkUpdateTranslationDto.prototype, "translationKeyId", void 0);
|
|
1045
1087
|
translation_dto_ts_decorate([
|
|
1046
1088
|
IsString(),
|
|
1047
|
-
Transform
|
|
1089
|
+
(0,external_class_transformer_.Transform)(trimString),
|
|
1048
1090
|
(0,swagger_.ApiProperty)({
|
|
1049
1091
|
example: 'Updated translation value'
|
|
1050
1092
|
}),
|
|
@@ -1066,7 +1108,7 @@ translation_dto_ts_decorate([
|
|
|
1066
1108
|
ValidateNested({
|
|
1067
1109
|
each: true
|
|
1068
1110
|
}),
|
|
1069
|
-
Type(()=>BulkUpdateTranslationDto),
|
|
1111
|
+
(0,external_class_transformer_.Type)(()=>BulkUpdateTranslationDto),
|
|
1070
1112
|
(0,swagger_.ApiProperty)({
|
|
1071
1113
|
type: [
|
|
1072
1114
|
BulkUpdateTranslationDto
|
|
@@ -1085,51 +1127,53 @@ class TranslationResponseDto extends IdentityResponseDto {
|
|
|
1085
1127
|
}
|
|
1086
1128
|
translation_dto_ts_decorate([
|
|
1087
1129
|
(0,swagger_.ApiProperty)(),
|
|
1088
|
-
Expose(),
|
|
1130
|
+
(0,external_class_transformer_.Expose)(),
|
|
1089
1131
|
translation_dto_ts_metadata("design:type", String)
|
|
1090
1132
|
], TranslationResponseDto.prototype, "languageId", void 0);
|
|
1091
1133
|
translation_dto_ts_decorate([
|
|
1092
1134
|
(0,swagger_.ApiProperty)(),
|
|
1093
|
-
Expose(),
|
|
1135
|
+
(0,external_class_transformer_.Expose)(),
|
|
1094
1136
|
translation_dto_ts_metadata("design:type", String)
|
|
1095
1137
|
], TranslationResponseDto.prototype, "translationKeyId", void 0);
|
|
1096
1138
|
translation_dto_ts_decorate([
|
|
1097
1139
|
(0,swagger_.ApiProperty)({
|
|
1098
1140
|
example: 'Login successful'
|
|
1099
1141
|
}),
|
|
1100
|
-
Expose(),
|
|
1142
|
+
(0,external_class_transformer_.Expose)(),
|
|
1101
1143
|
translation_dto_ts_metadata("design:type", String)
|
|
1102
1144
|
], TranslationResponseDto.prototype, "value", void 0);
|
|
1103
1145
|
translation_dto_ts_decorate([
|
|
1104
1146
|
(0,swagger_.ApiProperty)({
|
|
1105
1147
|
example: false
|
|
1106
1148
|
}),
|
|
1107
|
-
Expose(),
|
|
1149
|
+
(0,external_class_transformer_.Expose)(),
|
|
1108
1150
|
translation_dto_ts_metadata("design:type", Boolean)
|
|
1109
1151
|
], TranslationResponseDto.prototype, "isVerified", void 0);
|
|
1110
1152
|
translation_dto_ts_decorate([
|
|
1111
1153
|
(0,swagger_.ApiProperty)({
|
|
1112
1154
|
example: true
|
|
1113
1155
|
}),
|
|
1114
|
-
Expose(),
|
|
1156
|
+
(0,external_class_transformer_.Expose)(),
|
|
1115
1157
|
translation_dto_ts_metadata("design:type", Boolean)
|
|
1116
1158
|
], TranslationResponseDto.prototype, "isActive", void 0);
|
|
1117
1159
|
translation_dto_ts_decorate([
|
|
1118
1160
|
(0,swagger_.ApiPropertyOptional)({
|
|
1119
1161
|
type: ()=>LanguageResponseDto
|
|
1120
1162
|
}),
|
|
1121
|
-
Expose(),
|
|
1163
|
+
(0,external_class_transformer_.Expose)(),
|
|
1164
|
+
(0,external_class_transformer_.Type)(()=>LanguageResponseDto),
|
|
1122
1165
|
translation_dto_ts_metadata("design:type", typeof LanguageResponseDto === "undefined" ? Object : LanguageResponseDto)
|
|
1123
1166
|
], TranslationResponseDto.prototype, "language", void 0);
|
|
1124
1167
|
translation_dto_ts_decorate([
|
|
1125
1168
|
(0,swagger_.ApiPropertyOptional)({
|
|
1126
1169
|
type: ()=>TranslationKeyResponseDto
|
|
1127
1170
|
}),
|
|
1128
|
-
Expose(),
|
|
1171
|
+
(0,external_class_transformer_.Expose)(),
|
|
1172
|
+
(0,external_class_transformer_.Type)(()=>TranslationKeyResponseDto),
|
|
1129
1173
|
translation_dto_ts_metadata("design:type", typeof TranslationKeyResponseDto === "undefined" ? Object : TranslationKeyResponseDto)
|
|
1130
1174
|
], TranslationResponseDto.prototype, "translationKey", void 0);
|
|
1131
1175
|
TranslationResponseDto = translation_dto_ts_decorate([
|
|
1132
|
-
Exclude()
|
|
1176
|
+
(0,external_class_transformer_.Exclude)()
|
|
1133
1177
|
], TranslationResponseDto);
|
|
1134
1178
|
class GetTranslationsByLanguageDto {
|
|
1135
1179
|
languageCode;
|
|
@@ -1137,8 +1181,9 @@ class GetTranslationsByLanguageDto {
|
|
|
1137
1181
|
}
|
|
1138
1182
|
translation_dto_ts_decorate([
|
|
1139
1183
|
IsString(),
|
|
1184
|
+
IsNotEmpty(),
|
|
1140
1185
|
MaxLength(10),
|
|
1141
|
-
Transform
|
|
1186
|
+
(0,external_class_transformer_.Transform)(trimLowerString),
|
|
1142
1187
|
(0,swagger_.ApiProperty)({
|
|
1143
1188
|
example: 'en',
|
|
1144
1189
|
description: 'Language code'
|
|
@@ -1151,7 +1196,7 @@ translation_dto_ts_decorate([
|
|
|
1151
1196
|
IsString({
|
|
1152
1197
|
each: true
|
|
1153
1198
|
}),
|
|
1154
|
-
Transform
|
|
1199
|
+
(0,external_class_transformer_.Transform)(trimStringArray),
|
|
1155
1200
|
(0,swagger_.ApiPropertyOptional)({
|
|
1156
1201
|
example: [
|
|
1157
1202
|
'shared',
|
|
@@ -1174,6 +1219,12 @@ translation_dto_ts_decorate([
|
|
|
1174
1219
|
module.exports = __rspack_external__nestjs_swagger_7cd450b5;
|
|
1175
1220
|
|
|
1176
1221
|
|
|
1222
|
+
},
|
|
1223
|
+
812(module) {
|
|
1224
|
+
|
|
1225
|
+
module.exports = __rspack_external_class_transformer_c5a479fb;
|
|
1226
|
+
|
|
1227
|
+
|
|
1177
1228
|
},
|
|
1178
1229
|
|
|
1179
1230
|
};
|