@flusys/nestjs-localization 7.0.2 → 8.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/index.d.ts +3 -3
- package/controllers/index.d.ts +3 -3
- package/controllers/language.controller.d.ts +4 -4
- package/controllers/translation-key.controller.d.ts +3 -3
- package/controllers/translation.controller.d.ts +4 -4
- package/docs/index.d.ts +1 -1
- package/docs/localization-swagger.config.d.ts +1 -1
- package/dtos/index.d.ts +3 -3
- package/dtos/translation.dto.d.ts +2 -2
- package/entities/index.d.ts +6 -6
- package/entities/language.entity.d.ts +1 -1
- package/entities/translation-key.entity.d.ts +1 -1
- package/entities/translation.entity.d.ts +2 -2
- package/fesm/349.js +1179 -0
- package/fesm/692.js +1205 -0
- package/fesm/config/index.js +101 -3
- package/fesm/controllers/index.js +15 -3
- package/fesm/docs/index.js +126 -1
- package/fesm/dtos/index.js +680 -3
- package/fesm/entities/index.js +405 -8
- package/fesm/index.js +257 -7
- package/fesm/interfaces/index.js +18 -4
- package/fesm/modules/index.js +152 -1
- package/fesm/runtime.js +85 -0
- package/fesm/services/index.js +15 -5
- package/index.d.ts +7 -7
- package/interfaces/index.d.ts +4 -4
- package/interfaces/language.interface.d.ts +1 -1
- package/interfaces/localization-module-options.interface.d.ts +3 -3
- package/interfaces/translation-key.interface.d.ts +1 -1
- package/interfaces/translation.interface.d.ts +3 -3
- package/modules/index.d.ts +1 -1
- package/modules/localization.module.d.ts +2 -2
- package/package.json +25 -34
- package/services/index.d.ts +5 -5
- package/services/language.service.d.ts +6 -6
- package/services/localization-config.service.d.ts +3 -3
- package/services/localization-datasource.provider.d.ts +3 -3
- package/services/translation-key.service.d.ts +6 -6
- package/services/translation.service.d.ts +5 -5
- package/cjs/config/event-actions.js +0 -33
- package/cjs/config/index.js +0 -20
- package/cjs/config/localization.constants.js +0 -11
- package/cjs/config/message-keys.js +0 -41
- package/cjs/controllers/index.js +0 -20
- package/cjs/controllers/language.controller.js +0 -188
- package/cjs/controllers/language.controller.spec.js +0 -154
- package/cjs/controllers/translation-key.controller.js +0 -135
- package/cjs/controllers/translation-key.controller.spec.js +0 -70
- package/cjs/controllers/translation.controller.js +0 -195
- package/cjs/controllers/translation.controller.spec.js +0 -169
- package/cjs/docs/index.js +0 -11
- package/cjs/docs/localization-swagger.config.js +0 -111
- package/cjs/docs/localization-swagger.config.spec.js +0 -30
- package/cjs/dtos/index.js +0 -20
- package/cjs/dtos/language.dto.js +0 -213
- package/cjs/dtos/translation-key.dto.js +0 -215
- package/cjs/dtos/translation.dto.js +0 -269
- package/cjs/entities/index.js +0 -42
- package/cjs/entities/index.spec.js +0 -18
- package/cjs/entities/language.entity.js +0 -126
- package/cjs/entities/translation-key.entity.js +0 -126
- package/cjs/entities/translation.entity.js +0 -120
- package/cjs/index.js +0 -24
- package/cjs/interfaces/index.js +0 -21
- package/cjs/interfaces/language.interface.js +0 -4
- package/cjs/interfaces/localization-module-options.interface.js +0 -4
- package/cjs/interfaces/translation-key.interface.js +0 -4
- package/cjs/interfaces/translation.interface.js +0 -4
- package/cjs/modules/index.js +0 -18
- package/cjs/modules/localization.module.js +0 -116
- package/cjs/modules/localization.module.spec.js +0 -132
- package/cjs/services/index.js +0 -22
- package/cjs/services/language.service.js +0 -181
- package/cjs/services/language.service.spec.js +0 -256
- package/cjs/services/localization-config.service.js +0 -66
- package/cjs/services/localization-config.service.spec.js +0 -80
- package/cjs/services/localization-datasource.provider.js +0 -79
- package/cjs/services/localization-datasource.provider.spec.js +0 -85
- package/cjs/services/translation-key.service.js +0 -179
- package/cjs/services/translation-key.service.spec.js +0 -303
- package/cjs/services/translation.service.js +0 -228
- package/cjs/services/translation.service.spec.js +0 -530
- package/fesm/config/event-actions.js +0 -12
- package/fesm/config/localization.constants.js +0 -1
- package/fesm/config/message-keys.js +0 -20
- package/fesm/controllers/language.controller.js +0 -178
- package/fesm/controllers/language.controller.spec.js +0 -150
- package/fesm/controllers/translation-key.controller.js +0 -125
- package/fesm/controllers/translation-key.controller.spec.js +0 -66
- package/fesm/controllers/translation.controller.js +0 -185
- package/fesm/controllers/translation.controller.spec.js +0 -165
- package/fesm/docs/localization-swagger.config.js +0 -101
- package/fesm/docs/localization-swagger.config.spec.js +0 -26
- package/fesm/dtos/language.dto.js +0 -192
- package/fesm/dtos/translation-key.dto.js +0 -194
- package/fesm/dtos/translation.dto.js +0 -239
- package/fesm/entities/index.spec.js +0 -14
- package/fesm/entities/language.entity.js +0 -116
- package/fesm/entities/translation-key.entity.js +0 -116
- package/fesm/entities/translation.entity.js +0 -110
- package/fesm/interfaces/language.interface.js +0 -1
- package/fesm/interfaces/localization-module-options.interface.js +0 -1
- package/fesm/interfaces/translation-key.interface.js +0 -1
- package/fesm/interfaces/translation.interface.js +0 -1
- package/fesm/modules/localization.module.js +0 -106
- package/fesm/modules/localization.module.spec.js +0 -128
- package/fesm/services/language.service.js +0 -171
- package/fesm/services/language.service.spec.js +0 -252
- package/fesm/services/localization-config.service.js +0 -56
- package/fesm/services/localization-config.service.spec.js +0 -76
- package/fesm/services/localization-datasource.provider.js +0 -69
- package/fesm/services/localization-datasource.provider.spec.js +0 -81
- package/fesm/services/translation-key.service.js +0 -169
- package/fesm/services/translation-key.service.spec.js +0 -299
- package/fesm/services/translation.service.js +0 -218
- package/fesm/services/translation.service.spec.js +0 -526
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
15
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
}
|
|
20
|
-
function _ts_metadata(k, v) {
|
|
21
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
-
}
|
|
23
|
-
import { IdentityResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
24
|
-
import { ApiProperty, ApiPropertyOptional, OmitType, PartialType } from '@nestjs/swagger';
|
|
25
|
-
import { Exclude, Expose, Transform } from 'class-transformer';
|
|
26
|
-
import { IsArray, IsBoolean, IsNumber, IsOptional, IsString, IsUUID, MaxLength } from 'class-validator';
|
|
27
|
-
export class CreateTranslationKeyDto {
|
|
28
|
-
constructor(){
|
|
29
|
-
_define_property(this, "module", void 0);
|
|
30
|
-
_define_property(this, "key", void 0);
|
|
31
|
-
_define_property(this, "defaultMessage", void 0);
|
|
32
|
-
_define_property(this, "description", void 0);
|
|
33
|
-
_define_property(this, "variables", void 0);
|
|
34
|
-
_define_property(this, "isActive", void 0);
|
|
35
|
-
_define_property(this, "isReadonly", void 0);
|
|
36
|
-
_define_property(this, "serial", void 0);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
_ts_decorate([
|
|
40
|
-
IsString(),
|
|
41
|
-
MaxLength(100),
|
|
42
|
-
Transform(({ value })=>value?.trim()?.toLowerCase()),
|
|
43
|
-
ApiProperty({
|
|
44
|
-
example: 'auth',
|
|
45
|
-
description: 'Module name'
|
|
46
|
-
}),
|
|
47
|
-
_ts_metadata("design:type", String)
|
|
48
|
-
], CreateTranslationKeyDto.prototype, "module", void 0);
|
|
49
|
-
_ts_decorate([
|
|
50
|
-
IsString(),
|
|
51
|
-
MaxLength(255),
|
|
52
|
-
Transform(({ value })=>value?.trim()),
|
|
53
|
-
ApiProperty({
|
|
54
|
-
example: 'auth.login.success',
|
|
55
|
-
description: 'Translation key'
|
|
56
|
-
}),
|
|
57
|
-
_ts_metadata("design:type", String)
|
|
58
|
-
], CreateTranslationKeyDto.prototype, "key", void 0);
|
|
59
|
-
_ts_decorate([
|
|
60
|
-
IsString(),
|
|
61
|
-
MaxLength(500),
|
|
62
|
-
Transform(({ value })=>value?.trim()),
|
|
63
|
-
ApiProperty({
|
|
64
|
-
example: 'Login successful',
|
|
65
|
-
description: 'Default English message'
|
|
66
|
-
}),
|
|
67
|
-
_ts_metadata("design:type", String)
|
|
68
|
-
], CreateTranslationKeyDto.prototype, "defaultMessage", void 0);
|
|
69
|
-
_ts_decorate([
|
|
70
|
-
IsOptional(),
|
|
71
|
-
IsString(),
|
|
72
|
-
Transform(({ value })=>value?.trim()),
|
|
73
|
-
ApiPropertyOptional({
|
|
74
|
-
description: 'Developer notes'
|
|
75
|
-
}),
|
|
76
|
-
_ts_metadata("design:type", String)
|
|
77
|
-
], CreateTranslationKeyDto.prototype, "description", void 0);
|
|
78
|
-
_ts_decorate([
|
|
79
|
-
IsOptional(),
|
|
80
|
-
IsArray(),
|
|
81
|
-
IsString({
|
|
82
|
-
each: true
|
|
83
|
-
}),
|
|
84
|
-
ApiPropertyOptional({
|
|
85
|
-
example: [
|
|
86
|
-
'name'
|
|
87
|
-
],
|
|
88
|
-
description: 'Variable names used in the message'
|
|
89
|
-
}),
|
|
90
|
-
_ts_metadata("design:type", Array)
|
|
91
|
-
], CreateTranslationKeyDto.prototype, "variables", void 0);
|
|
92
|
-
_ts_decorate([
|
|
93
|
-
IsOptional(),
|
|
94
|
-
IsBoolean(),
|
|
95
|
-
ApiPropertyOptional({
|
|
96
|
-
example: true
|
|
97
|
-
}),
|
|
98
|
-
_ts_metadata("design:type", Boolean)
|
|
99
|
-
], CreateTranslationKeyDto.prototype, "isActive", void 0);
|
|
100
|
-
_ts_decorate([
|
|
101
|
-
IsOptional(),
|
|
102
|
-
IsBoolean(),
|
|
103
|
-
ApiPropertyOptional({
|
|
104
|
-
example: false,
|
|
105
|
-
description: 'Readonly keys cannot be deleted by users'
|
|
106
|
-
}),
|
|
107
|
-
_ts_metadata("design:type", Boolean)
|
|
108
|
-
], CreateTranslationKeyDto.prototype, "isReadonly", void 0);
|
|
109
|
-
_ts_decorate([
|
|
110
|
-
IsOptional(),
|
|
111
|
-
IsNumber(),
|
|
112
|
-
ApiPropertyOptional({
|
|
113
|
-
example: 1
|
|
114
|
-
}),
|
|
115
|
-
_ts_metadata("design:type", Number)
|
|
116
|
-
], CreateTranslationKeyDto.prototype, "serial", void 0);
|
|
117
|
-
export class UpdateTranslationKeyDto extends PartialType(OmitType(CreateTranslationKeyDto, [
|
|
118
|
-
'isReadonly'
|
|
119
|
-
])) {
|
|
120
|
-
constructor(...args){
|
|
121
|
-
super(...args), _define_property(this, "id", void 0);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
_ts_decorate([
|
|
125
|
-
IsUUID(),
|
|
126
|
-
ApiProperty({
|
|
127
|
-
description: 'Translation key ID'
|
|
128
|
-
}),
|
|
129
|
-
_ts_metadata("design:type", String)
|
|
130
|
-
], UpdateTranslationKeyDto.prototype, "id", void 0);
|
|
131
|
-
export class TranslationKeyResponseDto extends IdentityResponseDto {
|
|
132
|
-
constructor(...args){
|
|
133
|
-
super(...args), _define_property(this, "module", void 0), _define_property(this, "key", void 0), _define_property(this, "defaultMessage", void 0), _define_property(this, "description", void 0), _define_property(this, "variables", void 0), _define_property(this, "isActive", void 0), _define_property(this, "isReadonly", void 0), _define_property(this, "serial", void 0);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
_ts_decorate([
|
|
137
|
-
ApiProperty({
|
|
138
|
-
example: 'auth'
|
|
139
|
-
}),
|
|
140
|
-
Expose(),
|
|
141
|
-
_ts_metadata("design:type", String)
|
|
142
|
-
], TranslationKeyResponseDto.prototype, "module", void 0);
|
|
143
|
-
_ts_decorate([
|
|
144
|
-
ApiProperty({
|
|
145
|
-
example: 'auth.login.success'
|
|
146
|
-
}),
|
|
147
|
-
Expose(),
|
|
148
|
-
_ts_metadata("design:type", String)
|
|
149
|
-
], TranslationKeyResponseDto.prototype, "key", void 0);
|
|
150
|
-
_ts_decorate([
|
|
151
|
-
ApiProperty({
|
|
152
|
-
example: 'Login successful'
|
|
153
|
-
}),
|
|
154
|
-
Expose(),
|
|
155
|
-
_ts_metadata("design:type", String)
|
|
156
|
-
], TranslationKeyResponseDto.prototype, "defaultMessage", void 0);
|
|
157
|
-
_ts_decorate([
|
|
158
|
-
ApiPropertyOptional(),
|
|
159
|
-
Expose(),
|
|
160
|
-
_ts_metadata("design:type", Object)
|
|
161
|
-
], TranslationKeyResponseDto.prototype, "description", void 0);
|
|
162
|
-
_ts_decorate([
|
|
163
|
-
ApiPropertyOptional({
|
|
164
|
-
example: [
|
|
165
|
-
'name'
|
|
166
|
-
]
|
|
167
|
-
}),
|
|
168
|
-
Expose(),
|
|
169
|
-
_ts_metadata("design:type", Object)
|
|
170
|
-
], TranslationKeyResponseDto.prototype, "variables", void 0);
|
|
171
|
-
_ts_decorate([
|
|
172
|
-
ApiProperty({
|
|
173
|
-
example: true
|
|
174
|
-
}),
|
|
175
|
-
Expose(),
|
|
176
|
-
_ts_metadata("design:type", Boolean)
|
|
177
|
-
], TranslationKeyResponseDto.prototype, "isActive", void 0);
|
|
178
|
-
_ts_decorate([
|
|
179
|
-
ApiProperty({
|
|
180
|
-
example: false
|
|
181
|
-
}),
|
|
182
|
-
Expose(),
|
|
183
|
-
_ts_metadata("design:type", Boolean)
|
|
184
|
-
], TranslationKeyResponseDto.prototype, "isReadonly", void 0);
|
|
185
|
-
_ts_decorate([
|
|
186
|
-
ApiPropertyOptional({
|
|
187
|
-
example: 1
|
|
188
|
-
}),
|
|
189
|
-
Expose(),
|
|
190
|
-
_ts_metadata("design:type", Object)
|
|
191
|
-
], TranslationKeyResponseDto.prototype, "serial", void 0);
|
|
192
|
-
TranslationKeyResponseDto = _ts_decorate([
|
|
193
|
-
Exclude()
|
|
194
|
-
], TranslationKeyResponseDto);
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
15
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
}
|
|
20
|
-
function _ts_metadata(k, v) {
|
|
21
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
-
}
|
|
23
|
-
import { IdentityResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
24
|
-
import { ApiProperty, ApiPropertyOptional, PartialType } from '@nestjs/swagger';
|
|
25
|
-
import { Exclude, Expose, Transform, Type } from 'class-transformer';
|
|
26
|
-
import { IsArray, IsBoolean, IsOptional, IsString, IsUUID, MaxLength, ValidateNested } from 'class-validator';
|
|
27
|
-
import { LanguageResponseDto } from './language.dto';
|
|
28
|
-
import { TranslationKeyResponseDto } from './translation-key.dto';
|
|
29
|
-
export class CreateTranslationDto {
|
|
30
|
-
constructor(){
|
|
31
|
-
_define_property(this, "languageId", void 0);
|
|
32
|
-
_define_property(this, "translationKeyId", void 0);
|
|
33
|
-
_define_property(this, "value", void 0);
|
|
34
|
-
_define_property(this, "isVerified", void 0);
|
|
35
|
-
_define_property(this, "isActive", void 0);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
_ts_decorate([
|
|
39
|
-
IsUUID(),
|
|
40
|
-
ApiProperty({
|
|
41
|
-
description: 'Language ID'
|
|
42
|
-
}),
|
|
43
|
-
_ts_metadata("design:type", String)
|
|
44
|
-
], CreateTranslationDto.prototype, "languageId", void 0);
|
|
45
|
-
_ts_decorate([
|
|
46
|
-
IsUUID(),
|
|
47
|
-
ApiProperty({
|
|
48
|
-
description: 'Translation key ID'
|
|
49
|
-
}),
|
|
50
|
-
_ts_metadata("design:type", String)
|
|
51
|
-
], CreateTranslationDto.prototype, "translationKeyId", void 0);
|
|
52
|
-
_ts_decorate([
|
|
53
|
-
IsString(),
|
|
54
|
-
Transform(({ value })=>value?.trim()),
|
|
55
|
-
ApiProperty({
|
|
56
|
-
example: 'Login successful',
|
|
57
|
-
description: 'Translated value'
|
|
58
|
-
}),
|
|
59
|
-
_ts_metadata("design:type", String)
|
|
60
|
-
], CreateTranslationDto.prototype, "value", void 0);
|
|
61
|
-
_ts_decorate([
|
|
62
|
-
IsOptional(),
|
|
63
|
-
IsBoolean(),
|
|
64
|
-
ApiPropertyOptional({
|
|
65
|
-
example: false,
|
|
66
|
-
description: 'Whether translation is verified'
|
|
67
|
-
}),
|
|
68
|
-
_ts_metadata("design:type", Boolean)
|
|
69
|
-
], CreateTranslationDto.prototype, "isVerified", void 0);
|
|
70
|
-
_ts_decorate([
|
|
71
|
-
IsOptional(),
|
|
72
|
-
IsBoolean(),
|
|
73
|
-
ApiPropertyOptional({
|
|
74
|
-
example: true
|
|
75
|
-
}),
|
|
76
|
-
_ts_metadata("design:type", Boolean)
|
|
77
|
-
], CreateTranslationDto.prototype, "isActive", void 0);
|
|
78
|
-
export class UpdateTranslationDto extends PartialType(CreateTranslationDto) {
|
|
79
|
-
constructor(...args){
|
|
80
|
-
super(...args), _define_property(this, "id", void 0);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
_ts_decorate([
|
|
84
|
-
IsUUID(),
|
|
85
|
-
ApiProperty({
|
|
86
|
-
description: 'Translation ID'
|
|
87
|
-
}),
|
|
88
|
-
_ts_metadata("design:type", String)
|
|
89
|
-
], UpdateTranslationDto.prototype, "id", void 0);
|
|
90
|
-
export class BulkUpdateTranslationDto {
|
|
91
|
-
constructor(){
|
|
92
|
-
_define_property(this, "id", void 0);
|
|
93
|
-
_define_property(this, "languageId", void 0);
|
|
94
|
-
_define_property(this, "translationKeyId", void 0);
|
|
95
|
-
_define_property(this, "value", void 0);
|
|
96
|
-
_define_property(this, "isVerified", void 0);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
_ts_decorate([
|
|
100
|
-
IsOptional(),
|
|
101
|
-
IsUUID(),
|
|
102
|
-
ApiPropertyOptional({
|
|
103
|
-
description: 'Translation ID (if updating existing)'
|
|
104
|
-
}),
|
|
105
|
-
_ts_metadata("design:type", String)
|
|
106
|
-
], BulkUpdateTranslationDto.prototype, "id", void 0);
|
|
107
|
-
_ts_decorate([
|
|
108
|
-
IsUUID(),
|
|
109
|
-
ApiProperty({
|
|
110
|
-
description: 'Language ID'
|
|
111
|
-
}),
|
|
112
|
-
_ts_metadata("design:type", String)
|
|
113
|
-
], BulkUpdateTranslationDto.prototype, "languageId", void 0);
|
|
114
|
-
_ts_decorate([
|
|
115
|
-
IsUUID(),
|
|
116
|
-
ApiProperty({
|
|
117
|
-
description: 'Translation key ID'
|
|
118
|
-
}),
|
|
119
|
-
_ts_metadata("design:type", String)
|
|
120
|
-
], BulkUpdateTranslationDto.prototype, "translationKeyId", void 0);
|
|
121
|
-
_ts_decorate([
|
|
122
|
-
IsString(),
|
|
123
|
-
Transform(({ value })=>value?.trim()),
|
|
124
|
-
ApiProperty({
|
|
125
|
-
example: 'Updated translation value'
|
|
126
|
-
}),
|
|
127
|
-
_ts_metadata("design:type", String)
|
|
128
|
-
], BulkUpdateTranslationDto.prototype, "value", void 0);
|
|
129
|
-
_ts_decorate([
|
|
130
|
-
IsOptional(),
|
|
131
|
-
IsBoolean(),
|
|
132
|
-
ApiPropertyOptional({
|
|
133
|
-
example: true
|
|
134
|
-
}),
|
|
135
|
-
_ts_metadata("design:type", Boolean)
|
|
136
|
-
], BulkUpdateTranslationDto.prototype, "isVerified", void 0);
|
|
137
|
-
export class BulkUpdateTranslationsDto {
|
|
138
|
-
constructor(){
|
|
139
|
-
_define_property(this, "translations", void 0);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
_ts_decorate([
|
|
143
|
-
IsArray(),
|
|
144
|
-
ValidateNested({
|
|
145
|
-
each: true
|
|
146
|
-
}),
|
|
147
|
-
Type(()=>BulkUpdateTranslationDto),
|
|
148
|
-
ApiProperty({
|
|
149
|
-
type: [
|
|
150
|
-
BulkUpdateTranslationDto
|
|
151
|
-
]
|
|
152
|
-
}),
|
|
153
|
-
_ts_metadata("design:type", Array)
|
|
154
|
-
], BulkUpdateTranslationsDto.prototype, "translations", void 0);
|
|
155
|
-
export class TranslationResponseDto extends IdentityResponseDto {
|
|
156
|
-
constructor(...args){
|
|
157
|
-
super(...args), _define_property(this, "languageId", void 0), _define_property(this, "translationKeyId", void 0), _define_property(this, "value", void 0), _define_property(this, "isVerified", void 0), _define_property(this, "isActive", void 0), _define_property(this, "language", void 0), _define_property(this, "translationKey", void 0);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
_ts_decorate([
|
|
161
|
-
ApiProperty(),
|
|
162
|
-
Expose(),
|
|
163
|
-
_ts_metadata("design:type", String)
|
|
164
|
-
], TranslationResponseDto.prototype, "languageId", void 0);
|
|
165
|
-
_ts_decorate([
|
|
166
|
-
ApiProperty(),
|
|
167
|
-
Expose(),
|
|
168
|
-
_ts_metadata("design:type", String)
|
|
169
|
-
], TranslationResponseDto.prototype, "translationKeyId", void 0);
|
|
170
|
-
_ts_decorate([
|
|
171
|
-
ApiProperty({
|
|
172
|
-
example: 'Login successful'
|
|
173
|
-
}),
|
|
174
|
-
Expose(),
|
|
175
|
-
_ts_metadata("design:type", String)
|
|
176
|
-
], TranslationResponseDto.prototype, "value", void 0);
|
|
177
|
-
_ts_decorate([
|
|
178
|
-
ApiProperty({
|
|
179
|
-
example: false
|
|
180
|
-
}),
|
|
181
|
-
Expose(),
|
|
182
|
-
_ts_metadata("design:type", Boolean)
|
|
183
|
-
], TranslationResponseDto.prototype, "isVerified", void 0);
|
|
184
|
-
_ts_decorate([
|
|
185
|
-
ApiProperty({
|
|
186
|
-
example: true
|
|
187
|
-
}),
|
|
188
|
-
Expose(),
|
|
189
|
-
_ts_metadata("design:type", Boolean)
|
|
190
|
-
], TranslationResponseDto.prototype, "isActive", void 0);
|
|
191
|
-
_ts_decorate([
|
|
192
|
-
ApiPropertyOptional({
|
|
193
|
-
type: ()=>LanguageResponseDto
|
|
194
|
-
}),
|
|
195
|
-
Expose(),
|
|
196
|
-
_ts_metadata("design:type", typeof LanguageResponseDto === "undefined" ? Object : LanguageResponseDto)
|
|
197
|
-
], TranslationResponseDto.prototype, "language", void 0);
|
|
198
|
-
_ts_decorate([
|
|
199
|
-
ApiPropertyOptional({
|
|
200
|
-
type: ()=>TranslationKeyResponseDto
|
|
201
|
-
}),
|
|
202
|
-
Expose(),
|
|
203
|
-
_ts_metadata("design:type", typeof TranslationKeyResponseDto === "undefined" ? Object : TranslationKeyResponseDto)
|
|
204
|
-
], TranslationResponseDto.prototype, "translationKey", void 0);
|
|
205
|
-
TranslationResponseDto = _ts_decorate([
|
|
206
|
-
Exclude()
|
|
207
|
-
], TranslationResponseDto);
|
|
208
|
-
export class GetTranslationsByLanguageDto {
|
|
209
|
-
constructor(){
|
|
210
|
-
_define_property(this, "languageCode", void 0);
|
|
211
|
-
_define_property(this, "modules", void 0);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
_ts_decorate([
|
|
215
|
-
IsString(),
|
|
216
|
-
MaxLength(10),
|
|
217
|
-
Transform(({ value })=>value?.trim()?.toLowerCase()),
|
|
218
|
-
ApiProperty({
|
|
219
|
-
example: 'en',
|
|
220
|
-
description: 'Language code'
|
|
221
|
-
}),
|
|
222
|
-
_ts_metadata("design:type", String)
|
|
223
|
-
], GetTranslationsByLanguageDto.prototype, "languageCode", void 0);
|
|
224
|
-
_ts_decorate([
|
|
225
|
-
IsOptional(),
|
|
226
|
-
IsArray(),
|
|
227
|
-
IsString({
|
|
228
|
-
each: true
|
|
229
|
-
}),
|
|
230
|
-
Transform(({ value })=>value?.map((v)=>v?.trim())),
|
|
231
|
-
ApiPropertyOptional({
|
|
232
|
-
example: [
|
|
233
|
-
'shared',
|
|
234
|
-
'auth'
|
|
235
|
-
],
|
|
236
|
-
description: 'Filter by modules (optional)'
|
|
237
|
-
}),
|
|
238
|
-
_ts_metadata("design:type", Array)
|
|
239
|
-
], GetTranslationsByLanguageDto.prototype, "modules", void 0);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { getLocalizationEntities, LocalizationEntities } from './index';
|
|
2
|
-
import { Language } from './language.entity';
|
|
3
|
-
import { TranslationKey } from './translation-key.entity';
|
|
4
|
-
import { Translation } from './translation.entity';
|
|
5
|
-
describe('getLocalizationEntities', ()=>{
|
|
6
|
-
it('returns the fixed entity list (no company/core split for localization)', ()=>{
|
|
7
|
-
expect(getLocalizationEntities()).toBe(LocalizationEntities);
|
|
8
|
-
expect(getLocalizationEntities()).toEqual([
|
|
9
|
-
Language,
|
|
10
|
-
TranslationKey,
|
|
11
|
-
Translation
|
|
12
|
-
]);
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
15
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
}
|
|
20
|
-
function _ts_metadata(k, v) {
|
|
21
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
-
}
|
|
23
|
-
import { Identity } from '@flusys/nestjs-shared/entities';
|
|
24
|
-
import { Column, Entity, Index, OneToMany } from 'typeorm';
|
|
25
|
-
export class Language extends Identity {
|
|
26
|
-
constructor(...args){
|
|
27
|
-
super(...args), _define_property(this, "code", void 0), _define_property(this, "name", void 0), _define_property(this, "nativeName", void 0), _define_property(this, "direction", void 0), _define_property(this, "isActive", void 0), _define_property(this, "isDefault", void 0), _define_property(this, "serial", void 0), _define_property(this, "isReadonly", void 0), _define_property(this, "translations", void 0);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
_ts_decorate([
|
|
31
|
-
Column({
|
|
32
|
-
type: 'varchar',
|
|
33
|
-
length: 10,
|
|
34
|
-
nullable: false
|
|
35
|
-
}),
|
|
36
|
-
_ts_metadata("design:type", String)
|
|
37
|
-
], Language.prototype, "code", void 0);
|
|
38
|
-
_ts_decorate([
|
|
39
|
-
Column({
|
|
40
|
-
type: 'varchar',
|
|
41
|
-
length: 100,
|
|
42
|
-
nullable: false
|
|
43
|
-
}),
|
|
44
|
-
_ts_metadata("design:type", String)
|
|
45
|
-
], Language.prototype, "name", void 0);
|
|
46
|
-
_ts_decorate([
|
|
47
|
-
Column({
|
|
48
|
-
type: 'varchar',
|
|
49
|
-
length: 100,
|
|
50
|
-
nullable: true,
|
|
51
|
-
name: 'native_name'
|
|
52
|
-
}),
|
|
53
|
-
_ts_metadata("design:type", Object)
|
|
54
|
-
], Language.prototype, "nativeName", void 0);
|
|
55
|
-
_ts_decorate([
|
|
56
|
-
Column({
|
|
57
|
-
type: 'varchar',
|
|
58
|
-
length: 3,
|
|
59
|
-
nullable: true
|
|
60
|
-
}),
|
|
61
|
-
_ts_metadata("design:type", Object)
|
|
62
|
-
], Language.prototype, "direction", void 0);
|
|
63
|
-
_ts_decorate([
|
|
64
|
-
Column({
|
|
65
|
-
type: 'boolean',
|
|
66
|
-
default: true,
|
|
67
|
-
name: 'is_active'
|
|
68
|
-
}),
|
|
69
|
-
_ts_metadata("design:type", Boolean)
|
|
70
|
-
], Language.prototype, "isActive", void 0);
|
|
71
|
-
_ts_decorate([
|
|
72
|
-
Column({
|
|
73
|
-
type: 'boolean',
|
|
74
|
-
default: false,
|
|
75
|
-
name: 'is_default'
|
|
76
|
-
}),
|
|
77
|
-
_ts_metadata("design:type", Boolean)
|
|
78
|
-
], Language.prototype, "isDefault", void 0);
|
|
79
|
-
_ts_decorate([
|
|
80
|
-
Column({
|
|
81
|
-
type: 'int',
|
|
82
|
-
nullable: true
|
|
83
|
-
}),
|
|
84
|
-
_ts_metadata("design:type", Object)
|
|
85
|
-
], Language.prototype, "serial", void 0);
|
|
86
|
-
_ts_decorate([
|
|
87
|
-
Column({
|
|
88
|
-
type: 'boolean',
|
|
89
|
-
default: false,
|
|
90
|
-
name: 'is_readonly'
|
|
91
|
-
}),
|
|
92
|
-
_ts_metadata("design:type", Boolean)
|
|
93
|
-
], Language.prototype, "isReadonly", void 0);
|
|
94
|
-
_ts_decorate([
|
|
95
|
-
OneToMany('Translation', 'language'),
|
|
96
|
-
_ts_metadata("design:type", Array)
|
|
97
|
-
], Language.prototype, "translations", void 0);
|
|
98
|
-
Language = _ts_decorate([
|
|
99
|
-
Entity({
|
|
100
|
-
name: 'language'
|
|
101
|
-
}),
|
|
102
|
-
Index([
|
|
103
|
-
'code'
|
|
104
|
-
], {
|
|
105
|
-
unique: true
|
|
106
|
-
}),
|
|
107
|
-
Index([
|
|
108
|
-
'isActive'
|
|
109
|
-
]),
|
|
110
|
-
Index([
|
|
111
|
-
'isDefault'
|
|
112
|
-
]),
|
|
113
|
-
Index([
|
|
114
|
-
'isReadonly'
|
|
115
|
-
])
|
|
116
|
-
], Language);
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
15
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
}
|
|
20
|
-
function _ts_metadata(k, v) {
|
|
21
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
-
}
|
|
23
|
-
import { getJsonColumnType } from '@flusys/nestjs-shared';
|
|
24
|
-
import { Identity } from '@flusys/nestjs-shared/entities';
|
|
25
|
-
import { Column, Entity, Index, OneToMany } from 'typeorm';
|
|
26
|
-
export class TranslationKey extends Identity {
|
|
27
|
-
constructor(...args){
|
|
28
|
-
super(...args), _define_property(this, "module", void 0), _define_property(this, "key", void 0), _define_property(this, "defaultMessage", void 0), _define_property(this, "description", void 0), _define_property(this, "variables", void 0), _define_property(this, "isActive", void 0), _define_property(this, "isReadonly", void 0), _define_property(this, "serial", void 0), _define_property(this, "translations", void 0);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
_ts_decorate([
|
|
32
|
-
Column({
|
|
33
|
-
type: 'varchar',
|
|
34
|
-
length: 100,
|
|
35
|
-
nullable: false
|
|
36
|
-
}),
|
|
37
|
-
_ts_metadata("design:type", String)
|
|
38
|
-
], TranslationKey.prototype, "module", void 0);
|
|
39
|
-
_ts_decorate([
|
|
40
|
-
Column({
|
|
41
|
-
type: 'varchar',
|
|
42
|
-
length: 255,
|
|
43
|
-
nullable: false
|
|
44
|
-
}),
|
|
45
|
-
_ts_metadata("design:type", String)
|
|
46
|
-
], TranslationKey.prototype, "key", void 0);
|
|
47
|
-
_ts_decorate([
|
|
48
|
-
Column({
|
|
49
|
-
type: 'varchar',
|
|
50
|
-
length: 500,
|
|
51
|
-
nullable: false,
|
|
52
|
-
name: 'default_message'
|
|
53
|
-
}),
|
|
54
|
-
_ts_metadata("design:type", String)
|
|
55
|
-
], TranslationKey.prototype, "defaultMessage", void 0);
|
|
56
|
-
_ts_decorate([
|
|
57
|
-
Column({
|
|
58
|
-
type: 'text',
|
|
59
|
-
nullable: true
|
|
60
|
-
}),
|
|
61
|
-
_ts_metadata("design:type", Object)
|
|
62
|
-
], TranslationKey.prototype, "description", void 0);
|
|
63
|
-
_ts_decorate([
|
|
64
|
-
Column({
|
|
65
|
-
type: getJsonColumnType(),
|
|
66
|
-
nullable: true
|
|
67
|
-
}),
|
|
68
|
-
_ts_metadata("design:type", Object)
|
|
69
|
-
], TranslationKey.prototype, "variables", void 0);
|
|
70
|
-
_ts_decorate([
|
|
71
|
-
Column({
|
|
72
|
-
type: 'boolean',
|
|
73
|
-
default: true,
|
|
74
|
-
name: 'is_active'
|
|
75
|
-
}),
|
|
76
|
-
_ts_metadata("design:type", Boolean)
|
|
77
|
-
], TranslationKey.prototype, "isActive", void 0);
|
|
78
|
-
_ts_decorate([
|
|
79
|
-
Column({
|
|
80
|
-
type: 'boolean',
|
|
81
|
-
default: false,
|
|
82
|
-
name: 'is_readonly'
|
|
83
|
-
}),
|
|
84
|
-
_ts_metadata("design:type", Boolean)
|
|
85
|
-
], TranslationKey.prototype, "isReadonly", void 0);
|
|
86
|
-
_ts_decorate([
|
|
87
|
-
Column({
|
|
88
|
-
type: 'int',
|
|
89
|
-
nullable: true
|
|
90
|
-
}),
|
|
91
|
-
_ts_metadata("design:type", Object)
|
|
92
|
-
], TranslationKey.prototype, "serial", void 0);
|
|
93
|
-
_ts_decorate([
|
|
94
|
-
OneToMany('Translation', 'translationKey'),
|
|
95
|
-
_ts_metadata("design:type", Array)
|
|
96
|
-
], TranslationKey.prototype, "translations", void 0);
|
|
97
|
-
TranslationKey = _ts_decorate([
|
|
98
|
-
Entity({
|
|
99
|
-
name: 'translation_key'
|
|
100
|
-
}),
|
|
101
|
-
Index([
|
|
102
|
-
'module'
|
|
103
|
-
]),
|
|
104
|
-
Index([
|
|
105
|
-
'module',
|
|
106
|
-
'key'
|
|
107
|
-
], {
|
|
108
|
-
unique: true
|
|
109
|
-
}),
|
|
110
|
-
Index([
|
|
111
|
-
'isActive'
|
|
112
|
-
]),
|
|
113
|
-
Index([
|
|
114
|
-
'isReadonly'
|
|
115
|
-
])
|
|
116
|
-
], TranslationKey);
|