@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
package/fesm/692.js
ADDED
|
@@ -0,0 +1,1205 @@
|
|
|
1
|
+
import * as __rspack_external__flusys_nestjs_shared_classes_6076a329 from "@flusys/nestjs-shared/classes";
|
|
2
|
+
import * as __rspack_external__flusys_nestjs_shared_modules_24702bee from "@flusys/nestjs-shared/modules";
|
|
3
|
+
import * as __rspack_external__nestjs_common_a04939da from "@nestjs/common";
|
|
4
|
+
import * as __rspack_external_typeorm from "typeorm";
|
|
5
|
+
import * as __rspack_external__nestjs_core_d7b00a1a from "@nestjs/core";
|
|
6
|
+
import * as __rspack_external__flusys_nestjs_shared_entities_420e6d19 from "@flusys/nestjs-shared/entities";
|
|
7
|
+
import * as __rspack_external__flusys_nestjs_shared_393d2cae from "@flusys/nestjs-shared";
|
|
8
|
+
export const __rspack_esm_id = 692;
|
|
9
|
+
export const __rspack_esm_ids = [692];
|
|
10
|
+
export const __webpack_modules__ = {
|
|
11
|
+
102(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
12
|
+
/**
|
|
13
|
+
* Domain event actions published by the localization module, alongside the CRUD
|
|
14
|
+
* lifecycle actions every ApiService emits.
|
|
15
|
+
*/ const LOCALIZATION_EVENT_ACTIONS = {
|
|
16
|
+
BULK_UPDATED: 'bulk-updated'
|
|
17
|
+
};
|
|
18
|
+
/** Every entity the localization module publishes under */ const LOCALIZATION_EVENT_ENTITIES = {
|
|
19
|
+
LANGUAGE: 'language',
|
|
20
|
+
TRANSLATION_KEY: 'translationKey',
|
|
21
|
+
TRANSLATION: 'translation'
|
|
22
|
+
};
|
|
23
|
+
const LOCALIZATION_EVENT_MODULE = 'localization';
|
|
24
|
+
|
|
25
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
26
|
+
}, {
|
|
27
|
+
JX: LOCALIZATION_EVENT_ENTITIES,
|
|
28
|
+
ec: LOCALIZATION_EVENT_MODULE,
|
|
29
|
+
f_: LOCALIZATION_EVENT_ACTIONS
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
},
|
|
34
|
+
88(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
35
|
+
const LOCALIZATION_MODULE_OPTIONS = 'LOCALIZATION_MODULE_OPTIONS';
|
|
36
|
+
|
|
37
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
38
|
+
}, {
|
|
39
|
+
A: LOCALIZATION_MODULE_OPTIONS
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
},
|
|
44
|
+
68(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
45
|
+
// ==================== LOCALIZATION MODULE MESSAGE KEYS ====================
|
|
46
|
+
const LANGUAGE_MESSAGES = {
|
|
47
|
+
ACTIVE_SUCCESS: 'language.active.success',
|
|
48
|
+
SET_DEFAULT_SUCCESS: 'language.set.default.success',
|
|
49
|
+
GET_DEFAULT_SUCCESS: 'language.get.default.success',
|
|
50
|
+
READONLY_UPDATE_FORBIDDEN: 'language.readonly.update.forbidden',
|
|
51
|
+
READONLY_DELETE_FORBIDDEN: 'language.readonly.delete.forbidden',
|
|
52
|
+
DEFAULT_DELETE_FORBIDDEN: 'language.default.delete.forbidden'
|
|
53
|
+
};
|
|
54
|
+
const TRANSLATION_KEY_MESSAGES = {
|
|
55
|
+
MODULES_SUCCESS: 'translation.key.modules.success',
|
|
56
|
+
READONLY_DELETE_FORBIDDEN: 'translation.key.readonly.delete.forbidden',
|
|
57
|
+
READONLY_UPDATE_FORBIDDEN: 'translation.key.readonly.update.forbidden',
|
|
58
|
+
DUPLICATE_KEY_IN_MODULE: 'translation.key.duplicate.key.in.module'
|
|
59
|
+
};
|
|
60
|
+
const TRANSLATION_MESSAGES = {
|
|
61
|
+
GET_ALL_SUCCESS: 'translation.get.all.success',
|
|
62
|
+
UPDATE_MANY_SUCCESS: 'translation.update.many.success',
|
|
63
|
+
BY_LANGUAGE_SUCCESS: 'translation.by.language.success'
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
67
|
+
}, {
|
|
68
|
+
Bc: TRANSLATION_KEY_MESSAGES,
|
|
69
|
+
Ju: TRANSLATION_MESSAGES,
|
|
70
|
+
ew: LANGUAGE_MESSAGES
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
},
|
|
75
|
+
710(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
76
|
+
|
|
77
|
+
// EXPORTS
|
|
78
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
79
|
+
TM: () => (/* reexport */ Language),
|
|
80
|
+
VZ: () => (/* binding */ LocalizationEntities),
|
|
81
|
+
wD: () => (/* reexport */ Translation),
|
|
82
|
+
Br: () => (/* reexport */ TranslationKey),
|
|
83
|
+
pw: () => (/* binding */ getLocalizationEntities)
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
;// CONCATENATED MODULE: external "@flusys/nestjs-shared/entities"
|
|
87
|
+
|
|
88
|
+
// EXTERNAL MODULE: external "typeorm"
|
|
89
|
+
var external_typeorm_ = __webpack_require__(158);
|
|
90
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/entities/language.entity.ts
|
|
91
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
92
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
93
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
94
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
95
|
+
} else {
|
|
96
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
97
|
+
if (d = decorators[i]) {
|
|
98
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
103
|
+
}
|
|
104
|
+
function _ts_metadata(metadataKey, metadataValue) {
|
|
105
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
106
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class Language extends __rspack_external__flusys_nestjs_shared_entities_420e6d19.Identity {
|
|
112
|
+
code;
|
|
113
|
+
name;
|
|
114
|
+
nativeName;
|
|
115
|
+
direction;
|
|
116
|
+
isActive;
|
|
117
|
+
isDefault;
|
|
118
|
+
serial;
|
|
119
|
+
isReadonly;
|
|
120
|
+
translations;
|
|
121
|
+
}
|
|
122
|
+
_ts_decorate([
|
|
123
|
+
(0,external_typeorm_.Column)({
|
|
124
|
+
type: 'varchar',
|
|
125
|
+
length: 10,
|
|
126
|
+
nullable: false
|
|
127
|
+
}),
|
|
128
|
+
_ts_metadata("design:type", String)
|
|
129
|
+
], Language.prototype, "code", void 0);
|
|
130
|
+
_ts_decorate([
|
|
131
|
+
(0,external_typeorm_.Column)({
|
|
132
|
+
type: 'varchar',
|
|
133
|
+
length: 100,
|
|
134
|
+
nullable: false
|
|
135
|
+
}),
|
|
136
|
+
_ts_metadata("design:type", String)
|
|
137
|
+
], Language.prototype, "name", void 0);
|
|
138
|
+
_ts_decorate([
|
|
139
|
+
(0,external_typeorm_.Column)({
|
|
140
|
+
type: 'varchar',
|
|
141
|
+
length: 100,
|
|
142
|
+
nullable: true,
|
|
143
|
+
name: 'native_name'
|
|
144
|
+
}),
|
|
145
|
+
_ts_metadata("design:type", Object)
|
|
146
|
+
], Language.prototype, "nativeName", void 0);
|
|
147
|
+
_ts_decorate([
|
|
148
|
+
(0,external_typeorm_.Column)({
|
|
149
|
+
type: 'varchar',
|
|
150
|
+
length: 3,
|
|
151
|
+
nullable: true
|
|
152
|
+
}),
|
|
153
|
+
_ts_metadata("design:type", Object)
|
|
154
|
+
], Language.prototype, "direction", void 0);
|
|
155
|
+
_ts_decorate([
|
|
156
|
+
(0,external_typeorm_.Column)({
|
|
157
|
+
type: 'boolean',
|
|
158
|
+
default: true,
|
|
159
|
+
name: 'is_active'
|
|
160
|
+
}),
|
|
161
|
+
_ts_metadata("design:type", Boolean)
|
|
162
|
+
], Language.prototype, "isActive", void 0);
|
|
163
|
+
_ts_decorate([
|
|
164
|
+
(0,external_typeorm_.Column)({
|
|
165
|
+
type: 'boolean',
|
|
166
|
+
default: false,
|
|
167
|
+
name: 'is_default'
|
|
168
|
+
}),
|
|
169
|
+
_ts_metadata("design:type", Boolean)
|
|
170
|
+
], Language.prototype, "isDefault", void 0);
|
|
171
|
+
_ts_decorate([
|
|
172
|
+
(0,external_typeorm_.Column)({
|
|
173
|
+
type: 'int',
|
|
174
|
+
nullable: true
|
|
175
|
+
}),
|
|
176
|
+
_ts_metadata("design:type", Object)
|
|
177
|
+
], Language.prototype, "serial", void 0);
|
|
178
|
+
_ts_decorate([
|
|
179
|
+
(0,external_typeorm_.Column)({
|
|
180
|
+
type: 'boolean',
|
|
181
|
+
default: false,
|
|
182
|
+
name: 'is_readonly'
|
|
183
|
+
}),
|
|
184
|
+
_ts_metadata("design:type", Boolean)
|
|
185
|
+
], Language.prototype, "isReadonly", void 0);
|
|
186
|
+
_ts_decorate([
|
|
187
|
+
(0,external_typeorm_.OneToMany)('Translation', 'language'),
|
|
188
|
+
_ts_metadata("design:type", Array)
|
|
189
|
+
], Language.prototype, "translations", void 0);
|
|
190
|
+
Language = _ts_decorate([
|
|
191
|
+
(0,external_typeorm_.Entity)({
|
|
192
|
+
name: 'language'
|
|
193
|
+
}),
|
|
194
|
+
(0,external_typeorm_.Index)([
|
|
195
|
+
'code'
|
|
196
|
+
], {
|
|
197
|
+
unique: true
|
|
198
|
+
}),
|
|
199
|
+
(0,external_typeorm_.Index)([
|
|
200
|
+
'isActive'
|
|
201
|
+
]),
|
|
202
|
+
(0,external_typeorm_.Index)([
|
|
203
|
+
'isDefault'
|
|
204
|
+
]),
|
|
205
|
+
(0,external_typeorm_.Index)([
|
|
206
|
+
'isReadonly'
|
|
207
|
+
])
|
|
208
|
+
], Language);
|
|
209
|
+
|
|
210
|
+
;// CONCATENATED MODULE: external "@flusys/nestjs-shared"
|
|
211
|
+
|
|
212
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/entities/translation-key.entity.ts
|
|
213
|
+
function translation_key_entity_ts_decorate(decorators, target, key, desc) {
|
|
214
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
215
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
216
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
217
|
+
} else {
|
|
218
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
219
|
+
if (d = decorators[i]) {
|
|
220
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
225
|
+
}
|
|
226
|
+
function translation_key_entity_ts_metadata(metadataKey, metadataValue) {
|
|
227
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
228
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class TranslationKey extends __rspack_external__flusys_nestjs_shared_entities_420e6d19.Identity {
|
|
235
|
+
module;
|
|
236
|
+
key;
|
|
237
|
+
defaultMessage;
|
|
238
|
+
description;
|
|
239
|
+
variables;
|
|
240
|
+
isActive;
|
|
241
|
+
isReadonly;
|
|
242
|
+
serial;
|
|
243
|
+
translations;
|
|
244
|
+
}
|
|
245
|
+
translation_key_entity_ts_decorate([
|
|
246
|
+
(0,external_typeorm_.Column)({
|
|
247
|
+
type: 'varchar',
|
|
248
|
+
length: 100,
|
|
249
|
+
nullable: false
|
|
250
|
+
}),
|
|
251
|
+
translation_key_entity_ts_metadata("design:type", String)
|
|
252
|
+
], TranslationKey.prototype, "module", void 0);
|
|
253
|
+
translation_key_entity_ts_decorate([
|
|
254
|
+
(0,external_typeorm_.Column)({
|
|
255
|
+
type: 'varchar',
|
|
256
|
+
length: 255,
|
|
257
|
+
nullable: false
|
|
258
|
+
}),
|
|
259
|
+
translation_key_entity_ts_metadata("design:type", String)
|
|
260
|
+
], TranslationKey.prototype, "key", void 0);
|
|
261
|
+
translation_key_entity_ts_decorate([
|
|
262
|
+
(0,external_typeorm_.Column)({
|
|
263
|
+
type: 'varchar',
|
|
264
|
+
length: 500,
|
|
265
|
+
nullable: false,
|
|
266
|
+
name: 'default_message'
|
|
267
|
+
}),
|
|
268
|
+
translation_key_entity_ts_metadata("design:type", String)
|
|
269
|
+
], TranslationKey.prototype, "defaultMessage", void 0);
|
|
270
|
+
translation_key_entity_ts_decorate([
|
|
271
|
+
(0,external_typeorm_.Column)({
|
|
272
|
+
type: 'text',
|
|
273
|
+
nullable: true
|
|
274
|
+
}),
|
|
275
|
+
translation_key_entity_ts_metadata("design:type", Object)
|
|
276
|
+
], TranslationKey.prototype, "description", void 0);
|
|
277
|
+
translation_key_entity_ts_decorate([
|
|
278
|
+
(0,external_typeorm_.Column)({
|
|
279
|
+
type: (0,__rspack_external__flusys_nestjs_shared_393d2cae.getJsonColumnType)(),
|
|
280
|
+
nullable: true
|
|
281
|
+
}),
|
|
282
|
+
translation_key_entity_ts_metadata("design:type", Object)
|
|
283
|
+
], TranslationKey.prototype, "variables", void 0);
|
|
284
|
+
translation_key_entity_ts_decorate([
|
|
285
|
+
(0,external_typeorm_.Column)({
|
|
286
|
+
type: 'boolean',
|
|
287
|
+
default: true,
|
|
288
|
+
name: 'is_active'
|
|
289
|
+
}),
|
|
290
|
+
translation_key_entity_ts_metadata("design:type", Boolean)
|
|
291
|
+
], TranslationKey.prototype, "isActive", void 0);
|
|
292
|
+
translation_key_entity_ts_decorate([
|
|
293
|
+
(0,external_typeorm_.Column)({
|
|
294
|
+
type: 'boolean',
|
|
295
|
+
default: false,
|
|
296
|
+
name: 'is_readonly'
|
|
297
|
+
}),
|
|
298
|
+
translation_key_entity_ts_metadata("design:type", Boolean)
|
|
299
|
+
], TranslationKey.prototype, "isReadonly", void 0);
|
|
300
|
+
translation_key_entity_ts_decorate([
|
|
301
|
+
(0,external_typeorm_.Column)({
|
|
302
|
+
type: 'int',
|
|
303
|
+
nullable: true
|
|
304
|
+
}),
|
|
305
|
+
translation_key_entity_ts_metadata("design:type", Object)
|
|
306
|
+
], TranslationKey.prototype, "serial", void 0);
|
|
307
|
+
translation_key_entity_ts_decorate([
|
|
308
|
+
(0,external_typeorm_.OneToMany)('Translation', 'translationKey'),
|
|
309
|
+
translation_key_entity_ts_metadata("design:type", Array)
|
|
310
|
+
], TranslationKey.prototype, "translations", void 0);
|
|
311
|
+
TranslationKey = translation_key_entity_ts_decorate([
|
|
312
|
+
(0,external_typeorm_.Entity)({
|
|
313
|
+
name: 'translation_key'
|
|
314
|
+
}),
|
|
315
|
+
(0,external_typeorm_.Index)([
|
|
316
|
+
'module'
|
|
317
|
+
]),
|
|
318
|
+
(0,external_typeorm_.Index)([
|
|
319
|
+
'module',
|
|
320
|
+
'key'
|
|
321
|
+
], {
|
|
322
|
+
unique: true
|
|
323
|
+
}),
|
|
324
|
+
(0,external_typeorm_.Index)([
|
|
325
|
+
'isActive'
|
|
326
|
+
]),
|
|
327
|
+
(0,external_typeorm_.Index)([
|
|
328
|
+
'isReadonly'
|
|
329
|
+
])
|
|
330
|
+
], TranslationKey);
|
|
331
|
+
|
|
332
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/entities/translation.entity.ts
|
|
333
|
+
function translation_entity_ts_decorate(decorators, target, key, desc) {
|
|
334
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
335
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
336
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
337
|
+
} else {
|
|
338
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
339
|
+
if (d = decorators[i]) {
|
|
340
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
345
|
+
}
|
|
346
|
+
function translation_entity_ts_metadata(metadataKey, metadataValue) {
|
|
347
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
348
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
class Translation extends __rspack_external__flusys_nestjs_shared_entities_420e6d19.Identity {
|
|
356
|
+
languageId;
|
|
357
|
+
translationKeyId;
|
|
358
|
+
value;
|
|
359
|
+
isVerified;
|
|
360
|
+
isActive;
|
|
361
|
+
language;
|
|
362
|
+
translationKey;
|
|
363
|
+
}
|
|
364
|
+
translation_entity_ts_decorate([
|
|
365
|
+
(0,external_typeorm_.Column)({
|
|
366
|
+
type: 'uuid',
|
|
367
|
+
name: 'language_id',
|
|
368
|
+
nullable: false
|
|
369
|
+
}),
|
|
370
|
+
translation_entity_ts_metadata("design:type", String)
|
|
371
|
+
], Translation.prototype, "languageId", void 0);
|
|
372
|
+
translation_entity_ts_decorate([
|
|
373
|
+
(0,external_typeorm_.Column)({
|
|
374
|
+
type: 'uuid',
|
|
375
|
+
name: 'translation_key_id',
|
|
376
|
+
nullable: false
|
|
377
|
+
}),
|
|
378
|
+
translation_entity_ts_metadata("design:type", String)
|
|
379
|
+
], Translation.prototype, "translationKeyId", void 0);
|
|
380
|
+
translation_entity_ts_decorate([
|
|
381
|
+
(0,external_typeorm_.Column)({
|
|
382
|
+
type: 'text',
|
|
383
|
+
nullable: false
|
|
384
|
+
}),
|
|
385
|
+
translation_entity_ts_metadata("design:type", String)
|
|
386
|
+
], Translation.prototype, "value", void 0);
|
|
387
|
+
translation_entity_ts_decorate([
|
|
388
|
+
(0,external_typeorm_.Column)({
|
|
389
|
+
type: 'boolean',
|
|
390
|
+
default: false,
|
|
391
|
+
name: 'is_verified'
|
|
392
|
+
}),
|
|
393
|
+
translation_entity_ts_metadata("design:type", Boolean)
|
|
394
|
+
], Translation.prototype, "isVerified", void 0);
|
|
395
|
+
translation_entity_ts_decorate([
|
|
396
|
+
(0,external_typeorm_.Column)({
|
|
397
|
+
type: 'boolean',
|
|
398
|
+
default: true,
|
|
399
|
+
name: 'is_active'
|
|
400
|
+
}),
|
|
401
|
+
translation_entity_ts_metadata("design:type", Boolean)
|
|
402
|
+
], Translation.prototype, "isActive", void 0);
|
|
403
|
+
translation_entity_ts_decorate([
|
|
404
|
+
(0,external_typeorm_.ManyToOne)(()=>Language, {
|
|
405
|
+
nullable: false,
|
|
406
|
+
onDelete: 'CASCADE'
|
|
407
|
+
}),
|
|
408
|
+
(0,external_typeorm_.JoinColumn)({
|
|
409
|
+
name: 'language_id'
|
|
410
|
+
}),
|
|
411
|
+
translation_entity_ts_metadata("design:type", typeof Language === "undefined" ? Object : Language)
|
|
412
|
+
], Translation.prototype, "language", void 0);
|
|
413
|
+
translation_entity_ts_decorate([
|
|
414
|
+
(0,external_typeorm_.ManyToOne)(()=>TranslationKey, {
|
|
415
|
+
nullable: false,
|
|
416
|
+
onDelete: 'CASCADE'
|
|
417
|
+
}),
|
|
418
|
+
(0,external_typeorm_.JoinColumn)({
|
|
419
|
+
name: 'translation_key_id'
|
|
420
|
+
}),
|
|
421
|
+
translation_entity_ts_metadata("design:type", typeof TranslationKey === "undefined" ? Object : TranslationKey)
|
|
422
|
+
], Translation.prototype, "translationKey", void 0);
|
|
423
|
+
Translation = translation_entity_ts_decorate([
|
|
424
|
+
(0,external_typeorm_.Entity)({
|
|
425
|
+
name: 'translation'
|
|
426
|
+
}),
|
|
427
|
+
(0,external_typeorm_.Index)([
|
|
428
|
+
'languageId',
|
|
429
|
+
'translationKeyId'
|
|
430
|
+
], {
|
|
431
|
+
unique: true
|
|
432
|
+
}),
|
|
433
|
+
(0,external_typeorm_.Index)([
|
|
434
|
+
'languageId'
|
|
435
|
+
]),
|
|
436
|
+
(0,external_typeorm_.Index)([
|
|
437
|
+
'translationKeyId'
|
|
438
|
+
]),
|
|
439
|
+
(0,external_typeorm_.Index)([
|
|
440
|
+
'isActive'
|
|
441
|
+
])
|
|
442
|
+
], Translation);
|
|
443
|
+
|
|
444
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/entities/index.ts
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
const LocalizationEntities = [
|
|
452
|
+
Language,
|
|
453
|
+
TranslationKey,
|
|
454
|
+
Translation
|
|
455
|
+
];
|
|
456
|
+
function getLocalizationEntities() {
|
|
457
|
+
return LocalizationEntities;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
},
|
|
462
|
+
367(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
463
|
+
|
|
464
|
+
// EXPORTS
|
|
465
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
466
|
+
gw: () => (/* reexport */ LanguageService),
|
|
467
|
+
lg: () => (/* reexport */ LocalizationConfigService),
|
|
468
|
+
ue: () => (/* reexport */ LocalizationDataSourceProvider),
|
|
469
|
+
q3: () => (/* reexport */ TranslationKeyService),
|
|
470
|
+
L0: () => (/* reexport */ TranslationService)
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
// EXTERNAL MODULE: external "@nestjs/common"
|
|
474
|
+
var common_ = __webpack_require__(157);
|
|
475
|
+
// EXTERNAL MODULE: ./projects/nestjs-localization/src/config/localization.constants.ts
|
|
476
|
+
var localization_constants = __webpack_require__(88);
|
|
477
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/services/localization-config.service.ts
|
|
478
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
479
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
480
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
481
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
482
|
+
} else {
|
|
483
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
484
|
+
if (d = decorators[i]) {
|
|
485
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
490
|
+
}
|
|
491
|
+
function _ts_metadata(metadataKey, metadataValue) {
|
|
492
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
493
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
function _ts_param(paramIndex, decorator) {
|
|
497
|
+
return function(target, key) {
|
|
498
|
+
decorator(target, key, paramIndex);
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
class LocalizationConfigService {
|
|
504
|
+
options;
|
|
505
|
+
constructor(options){
|
|
506
|
+
this.options = options;
|
|
507
|
+
}
|
|
508
|
+
isCompanyFeatureEnabled() {
|
|
509
|
+
return false;
|
|
510
|
+
}
|
|
511
|
+
getDatabaseMode() {
|
|
512
|
+
return this.options.bootstrapAppConfig?.databaseMode ?? 'single';
|
|
513
|
+
}
|
|
514
|
+
isMultiTenant() {
|
|
515
|
+
return this.getDatabaseMode() === 'multi-tenant';
|
|
516
|
+
}
|
|
517
|
+
getOptions() {
|
|
518
|
+
return this.options;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
LocalizationConfigService = _ts_decorate([
|
|
522
|
+
(0,common_.Injectable)(),
|
|
523
|
+
_ts_param(0, (0,common_.Inject)(localization_constants/* .LOCALIZATION_MODULE_OPTIONS */.A)),
|
|
524
|
+
_ts_metadata("design:type", Function),
|
|
525
|
+
_ts_metadata("design:paramtypes", [
|
|
526
|
+
typeof LocalizationModuleOptions === "undefined" ? Object : LocalizationModuleOptions
|
|
527
|
+
])
|
|
528
|
+
], LocalizationConfigService);
|
|
529
|
+
|
|
530
|
+
// EXTERNAL MODULE: external "@flusys/nestjs-shared/modules"
|
|
531
|
+
var modules_ = __webpack_require__(236);
|
|
532
|
+
;// CONCATENATED MODULE: external "@nestjs/core"
|
|
533
|
+
|
|
534
|
+
// EXTERNAL MODULE: ./projects/nestjs-localization/src/entities/index.ts + 5 modules
|
|
535
|
+
var src_entities = __webpack_require__(710);
|
|
536
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/services/localization-datasource.provider.ts
|
|
537
|
+
function localization_datasource_provider_ts_decorate(decorators, target, key, desc) {
|
|
538
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
539
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
540
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
541
|
+
} else {
|
|
542
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
543
|
+
if (d = decorators[i]) {
|
|
544
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
549
|
+
}
|
|
550
|
+
function localization_datasource_provider_ts_metadata(metadataKey, metadataValue) {
|
|
551
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
552
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function localization_datasource_provider_ts_param(paramIndex, decorator) {
|
|
556
|
+
return function(target, key) {
|
|
557
|
+
decorator(target, key, paramIndex);
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
class LocalizationDataSourceProvider extends modules_.MultiTenantDataSourceService {
|
|
566
|
+
static tenantConnections = new Map();
|
|
567
|
+
static singleDataSource = null;
|
|
568
|
+
static tenantsRegistry = new Map();
|
|
569
|
+
static initialized = false;
|
|
570
|
+
static connectionLocks = new Map();
|
|
571
|
+
static singleConnectionLock = null;
|
|
572
|
+
constructor(configService, request){
|
|
573
|
+
super(LocalizationDataSourceProvider.buildParentOptions(configService.getOptions()), request);
|
|
574
|
+
}
|
|
575
|
+
static buildParentOptions(options) {
|
|
576
|
+
return {
|
|
577
|
+
bootstrapAppConfig: options.bootstrapAppConfig,
|
|
578
|
+
defaultDatabaseConfig: options.config?.defaultDatabaseConfig,
|
|
579
|
+
tenantDefaultDatabaseConfig: options.config?.tenantDefaultDatabaseConfig,
|
|
580
|
+
tenants: options.config?.tenants
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
async createDataSourceFromConfig(config) {
|
|
584
|
+
const entities = (0,src_entities/* .getLocalizationEntities */.pw)();
|
|
585
|
+
return super.createDataSourceFromConfig(config, entities);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
LocalizationDataSourceProvider = localization_datasource_provider_ts_decorate([
|
|
589
|
+
(0,common_.Injectable)({
|
|
590
|
+
scope: common_.Scope.REQUEST
|
|
591
|
+
}),
|
|
592
|
+
localization_datasource_provider_ts_param(0, (0,common_.Inject)(LocalizationConfigService)),
|
|
593
|
+
localization_datasource_provider_ts_param(1, (0,common_.Optional)()),
|
|
594
|
+
localization_datasource_provider_ts_param(1, (0,common_.Inject)(__rspack_external__nestjs_core_d7b00a1a.REQUEST)),
|
|
595
|
+
localization_datasource_provider_ts_metadata("design:type", Function),
|
|
596
|
+
localization_datasource_provider_ts_metadata("design:paramtypes", [
|
|
597
|
+
typeof LocalizationConfigService === "undefined" ? Object : LocalizationConfigService,
|
|
598
|
+
typeof Request === "undefined" ? Object : Request
|
|
599
|
+
])
|
|
600
|
+
], LocalizationDataSourceProvider);
|
|
601
|
+
|
|
602
|
+
// EXTERNAL MODULE: external "@flusys/nestjs-shared/classes"
|
|
603
|
+
var classes_ = __webpack_require__(937);
|
|
604
|
+
// EXTERNAL MODULE: external "typeorm"
|
|
605
|
+
var external_typeorm_ = __webpack_require__(158);
|
|
606
|
+
// EXTERNAL MODULE: ./projects/nestjs-localization/src/config/event-actions.ts
|
|
607
|
+
var event_actions = __webpack_require__(102);
|
|
608
|
+
// EXTERNAL MODULE: ./projects/nestjs-localization/src/config/message-keys.ts
|
|
609
|
+
var message_keys = __webpack_require__(68);
|
|
610
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/services/language.service.ts
|
|
611
|
+
function language_service_ts_decorate(decorators, target, key, desc) {
|
|
612
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
613
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
614
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
615
|
+
} else {
|
|
616
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
617
|
+
if (d = decorators[i]) {
|
|
618
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
623
|
+
}
|
|
624
|
+
function language_service_ts_metadata(metadataKey, metadataValue) {
|
|
625
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
626
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
function language_service_ts_param(paramIndex, decorator) {
|
|
630
|
+
return function(target, key) {
|
|
631
|
+
decorator(target, key, paramIndex);
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
class LanguageService extends classes_.ApiService {
|
|
642
|
+
cacheManager;
|
|
643
|
+
utilsService;
|
|
644
|
+
constructor(cacheManager, utilsService, dataSourceProvider){
|
|
645
|
+
super(event_actions/* .LOCALIZATION_EVENT_ENTITIES.LANGUAGE */.JX.LANGUAGE, cacheManager, utilsService, LanguageService.name, true, event_actions/* .LOCALIZATION_EVENT_MODULE */.ec, dataSourceProvider, src_entities/* .Language */.TM), this.cacheManager = cacheManager, this.utilsService = utilsService;
|
|
646
|
+
}
|
|
647
|
+
async beforeUpdateOperation(dto, _user, _queryRunner) {
|
|
648
|
+
const dtos = Array.isArray(dto) ? dto : [
|
|
649
|
+
dto
|
|
650
|
+
];
|
|
651
|
+
const ids = dtos.map((d)=>d.id);
|
|
652
|
+
await this.ensureDataSourceRepository();
|
|
653
|
+
const existingLanguages = await this.repository.find({
|
|
654
|
+
where: {
|
|
655
|
+
id: (0,external_typeorm_.In)(ids),
|
|
656
|
+
deletedAt: (0,external_typeorm_.IsNull)()
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
for (const d of dtos){
|
|
660
|
+
const existing = existingLanguages.find((e)=>e.id === d.id);
|
|
661
|
+
if (!existing) {
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
const changesIdentity = d.code !== undefined && d.code !== existing.code || d.name !== undefined && d.name !== existing.name || d.nativeName !== undefined && d.nativeName !== (existing.nativeName ?? undefined) || d.direction !== undefined && d.direction !== existing.direction;
|
|
665
|
+
if (existing.isReadonly && changesIdentity) {
|
|
666
|
+
throw new common_.ForbiddenException({
|
|
667
|
+
message: `Cannot modify code/name of readonly language "${existing.name}"`,
|
|
668
|
+
messageKey: message_keys/* .LANGUAGE_MESSAGES.READONLY_UPDATE_FORBIDDEN */.ew.READONLY_UPDATE_FORBIDDEN,
|
|
669
|
+
messageVariables: {
|
|
670
|
+
name: existing.name
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
async beforeDeleteOperation(dto, _user, _queryRunner) {
|
|
677
|
+
const ids = Array.isArray(dto.id) ? dto.id : [
|
|
678
|
+
dto.id
|
|
679
|
+
];
|
|
680
|
+
await this.ensureDataSourceRepository();
|
|
681
|
+
const languages = await this.repository.find({
|
|
682
|
+
where: {
|
|
683
|
+
id: (0,external_typeorm_.In)(ids),
|
|
684
|
+
deletedAt: (0,external_typeorm_.IsNull)()
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
const readonlyLanguages = languages.filter((l)=>l.isReadonly);
|
|
688
|
+
if (readonlyLanguages.length > 0) {
|
|
689
|
+
const names = readonlyLanguages.map((l)=>l.name).join(', ');
|
|
690
|
+
throw new common_.ForbiddenException({
|
|
691
|
+
message: `Cannot delete readonly language(s): ${names}`,
|
|
692
|
+
messageKey: message_keys/* .LANGUAGE_MESSAGES.READONLY_DELETE_FORBIDDEN */.ew.READONLY_DELETE_FORBIDDEN,
|
|
693
|
+
messageVariables: {
|
|
694
|
+
names
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
const defaultLanguages = languages.filter((l)=>l.isDefault);
|
|
699
|
+
if (defaultLanguages.length > 0) {
|
|
700
|
+
const names = defaultLanguages.map((l)=>l.name).join(', ');
|
|
701
|
+
throw new common_.ForbiddenException({
|
|
702
|
+
message: `Cannot delete the default language(s): ${names}. Set another language as default first.`,
|
|
703
|
+
messageKey: message_keys/* .LANGUAGE_MESSAGES.DEFAULT_DELETE_FORBIDDEN */.ew.DEFAULT_DELETE_FORBIDDEN,
|
|
704
|
+
messageVariables: {
|
|
705
|
+
names
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
async getDefaultLanguage() {
|
|
711
|
+
await this.ensureDataSourceRepository();
|
|
712
|
+
return this.repository.findOne({
|
|
713
|
+
where: {
|
|
714
|
+
isDefault: true,
|
|
715
|
+
deletedAt: (0,external_typeorm_.IsNull)()
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
async getActiveLanguages() {
|
|
720
|
+
await this.ensureDataSourceRepository();
|
|
721
|
+
return this.repository.find({
|
|
722
|
+
where: {
|
|
723
|
+
isActive: true,
|
|
724
|
+
deletedAt: (0,external_typeorm_.IsNull)()
|
|
725
|
+
},
|
|
726
|
+
order: {
|
|
727
|
+
serial: 'ASC',
|
|
728
|
+
name: 'ASC'
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
async setAsDefault(id) {
|
|
733
|
+
await this.ensureDataSourceRepository();
|
|
734
|
+
const previousDefaults = await this.repository.find({
|
|
735
|
+
where: {
|
|
736
|
+
isDefault: true
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
await this.repository.update({
|
|
740
|
+
isDefault: true
|
|
741
|
+
}, {
|
|
742
|
+
isDefault: false
|
|
743
|
+
});
|
|
744
|
+
await this.repository.update({
|
|
745
|
+
id
|
|
746
|
+
}, {
|
|
747
|
+
isDefault: true
|
|
748
|
+
});
|
|
749
|
+
const language = await this.repository.findOne({
|
|
750
|
+
where: {
|
|
751
|
+
id
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
await Promise.all([
|
|
755
|
+
this.clearCacheForAll(),
|
|
756
|
+
this.clearCacheForId([
|
|
757
|
+
...previousDefaults,
|
|
758
|
+
{
|
|
759
|
+
id
|
|
760
|
+
}
|
|
761
|
+
])
|
|
762
|
+
]);
|
|
763
|
+
return language;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
LanguageService = language_service_ts_decorate([
|
|
767
|
+
(0,common_.Injectable)({
|
|
768
|
+
scope: common_.Scope.REQUEST
|
|
769
|
+
}),
|
|
770
|
+
language_service_ts_param(0, (0,common_.Inject)('CACHE_INSTANCE')),
|
|
771
|
+
language_service_ts_param(1, (0,common_.Inject)(modules_.UtilsService)),
|
|
772
|
+
language_service_ts_param(2, (0,common_.Inject)(LocalizationDataSourceProvider)),
|
|
773
|
+
language_service_ts_metadata("design:type", Function),
|
|
774
|
+
language_service_ts_metadata("design:paramtypes", [
|
|
775
|
+
typeof classes_.HybridCache === "undefined" ? Object : classes_.HybridCache,
|
|
776
|
+
typeof modules_.UtilsService === "undefined" ? Object : modules_.UtilsService,
|
|
777
|
+
typeof LocalizationDataSourceProvider === "undefined" ? Object : LocalizationDataSourceProvider
|
|
778
|
+
])
|
|
779
|
+
], LanguageService);
|
|
780
|
+
|
|
781
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/services/translation-key.service.ts
|
|
782
|
+
function translation_key_service_ts_decorate(decorators, target, key, desc) {
|
|
783
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
784
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
785
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
786
|
+
} else {
|
|
787
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
788
|
+
if (d = decorators[i]) {
|
|
789
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
794
|
+
}
|
|
795
|
+
function translation_key_service_ts_metadata(metadataKey, metadataValue) {
|
|
796
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
797
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
function translation_key_service_ts_param(paramIndex, decorator) {
|
|
801
|
+
return function(target, key) {
|
|
802
|
+
decorator(target, key, paramIndex);
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
class TranslationKeyService extends classes_.ApiService {
|
|
813
|
+
cacheManager;
|
|
814
|
+
utilsService;
|
|
815
|
+
constructor(cacheManager, utilsService, dataSourceProvider){
|
|
816
|
+
super(event_actions/* .LOCALIZATION_EVENT_ENTITIES.TRANSLATION_KEY */.JX.TRANSLATION_KEY, cacheManager, utilsService, TranslationKeyService.name, true, event_actions/* .LOCALIZATION_EVENT_MODULE */.ec, dataSourceProvider, src_entities/* .TranslationKey */.Br), this.cacheManager = cacheManager, this.utilsService = utilsService;
|
|
817
|
+
}
|
|
818
|
+
async beforeInsertOperation(dto, _user, _queryRunner) {
|
|
819
|
+
const dtos = Array.isArray(dto) ? dto : [
|
|
820
|
+
dto
|
|
821
|
+
];
|
|
822
|
+
await this.validateNoDuplicateKeys(dtos.map((d)=>({
|
|
823
|
+
module: d.module,
|
|
824
|
+
key: d.key
|
|
825
|
+
})));
|
|
826
|
+
}
|
|
827
|
+
async beforeUpdateOperation(dto, _user, _queryRunner) {
|
|
828
|
+
const dtos = Array.isArray(dto) ? dto : [
|
|
829
|
+
dto
|
|
830
|
+
];
|
|
831
|
+
const ids = dtos.map((d)=>d.id);
|
|
832
|
+
await this.ensureDataSourceRepository();
|
|
833
|
+
const existingKeys = await this.repository.find({
|
|
834
|
+
where: {
|
|
835
|
+
id: (0,external_typeorm_.In)(ids),
|
|
836
|
+
deletedAt: (0,external_typeorm_.IsNull)()
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
// Check if any readonly keys are being updated with key/module changes
|
|
840
|
+
for (const d of dtos){
|
|
841
|
+
const existing = existingKeys.find((e)=>e.id === d.id);
|
|
842
|
+
const changesIdentity = d.key !== undefined && d.key !== existing?.key || d.module !== undefined && d.module !== existing?.module;
|
|
843
|
+
if (existing?.isReadonly && changesIdentity) {
|
|
844
|
+
throw new common_.ForbiddenException({
|
|
845
|
+
message: `Cannot modify key or module of readonly translation key "${existing.key}"`,
|
|
846
|
+
messageKey: message_keys/* .TRANSLATION_KEY_MESSAGES.READONLY_UPDATE_FORBIDDEN */.Bc.READONLY_UPDATE_FORBIDDEN,
|
|
847
|
+
messageVariables: {
|
|
848
|
+
key: existing.key
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
// Validate no duplicates for keys being changed
|
|
854
|
+
const keysToValidate = dtos.filter((d)=>d.key || d.module).map((d)=>{
|
|
855
|
+
const existing = existingKeys.find((e)=>e.id === d.id);
|
|
856
|
+
return {
|
|
857
|
+
module: d.module ?? existing?.module ?? '',
|
|
858
|
+
key: d.key ?? existing?.key ?? '',
|
|
859
|
+
excludeId: d.id
|
|
860
|
+
};
|
|
861
|
+
});
|
|
862
|
+
if (keysToValidate.length > 0) {
|
|
863
|
+
await this.validateNoDuplicateKeys(keysToValidate);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
async beforeDeleteOperation(option, _user, _queryRunner) {
|
|
867
|
+
const ids = Array.isArray(option.id) ? option.id : [
|
|
868
|
+
option.id
|
|
869
|
+
];
|
|
870
|
+
await this.ensureDataSourceRepository();
|
|
871
|
+
const readonlyKeys = await this.repository.find({
|
|
872
|
+
where: {
|
|
873
|
+
id: (0,external_typeorm_.In)(ids),
|
|
874
|
+
isReadonly: true,
|
|
875
|
+
deletedAt: (0,external_typeorm_.IsNull)()
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
if (readonlyKeys.length > 0) {
|
|
879
|
+
const keys = readonlyKeys.map((k)=>k.key).join(', ');
|
|
880
|
+
throw new common_.ForbiddenException({
|
|
881
|
+
message: `Cannot delete readonly translation keys: ${keys}`,
|
|
882
|
+
messageKey: message_keys/* .TRANSLATION_KEY_MESSAGES.READONLY_DELETE_FORBIDDEN */.Bc.READONLY_DELETE_FORBIDDEN,
|
|
883
|
+
messageVariables: {
|
|
884
|
+
keys
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
async findByModule(module) {
|
|
890
|
+
await this.ensureDataSourceRepository();
|
|
891
|
+
return this.repository.find({
|
|
892
|
+
where: {
|
|
893
|
+
module,
|
|
894
|
+
isActive: true,
|
|
895
|
+
deletedAt: (0,external_typeorm_.IsNull)()
|
|
896
|
+
},
|
|
897
|
+
order: {
|
|
898
|
+
serial: 'ASC',
|
|
899
|
+
key: 'ASC'
|
|
900
|
+
}
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
async getModules() {
|
|
904
|
+
await this.ensureDataSourceRepository();
|
|
905
|
+
const result = await this.repository.createQueryBuilder('tk').select('DISTINCT tk.module', 'module').where('tk.deleted_at IS NULL').getRawMany();
|
|
906
|
+
return result.map((r)=>r.module);
|
|
907
|
+
}
|
|
908
|
+
async validateNoDuplicateKeys(keys) {
|
|
909
|
+
await this.ensureDataSourceRepository();
|
|
910
|
+
for (const { module, key, excludeId } of keys){
|
|
911
|
+
const query = this.repository.createQueryBuilder('tk').where('tk.module = :module', {
|
|
912
|
+
module
|
|
913
|
+
}).andWhere('tk.key = :key', {
|
|
914
|
+
key
|
|
915
|
+
}).andWhere('tk.deleted_at IS NULL');
|
|
916
|
+
if (excludeId) {
|
|
917
|
+
query.andWhere('tk.id != :excludeId', {
|
|
918
|
+
excludeId
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
const existing = await query.getOne();
|
|
922
|
+
if (existing) {
|
|
923
|
+
throw new common_.BadRequestException({
|
|
924
|
+
message: `Translation key "${key}" already exists in module "${module}"`,
|
|
925
|
+
messageKey: message_keys/* .TRANSLATION_KEY_MESSAGES.DUPLICATE_KEY_IN_MODULE */.Bc.DUPLICATE_KEY_IN_MODULE,
|
|
926
|
+
messageVariables: {
|
|
927
|
+
key,
|
|
928
|
+
module
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
TranslationKeyService = translation_key_service_ts_decorate([
|
|
936
|
+
(0,common_.Injectable)({
|
|
937
|
+
scope: common_.Scope.REQUEST
|
|
938
|
+
}),
|
|
939
|
+
translation_key_service_ts_param(0, (0,common_.Inject)('CACHE_INSTANCE')),
|
|
940
|
+
translation_key_service_ts_param(1, (0,common_.Inject)(modules_.UtilsService)),
|
|
941
|
+
translation_key_service_ts_param(2, (0,common_.Inject)(LocalizationDataSourceProvider)),
|
|
942
|
+
translation_key_service_ts_metadata("design:type", Function),
|
|
943
|
+
translation_key_service_ts_metadata("design:paramtypes", [
|
|
944
|
+
typeof classes_.HybridCache === "undefined" ? Object : classes_.HybridCache,
|
|
945
|
+
typeof modules_.UtilsService === "undefined" ? Object : modules_.UtilsService,
|
|
946
|
+
typeof LocalizationDataSourceProvider === "undefined" ? Object : LocalizationDataSourceProvider
|
|
947
|
+
])
|
|
948
|
+
], TranslationKeyService);
|
|
949
|
+
|
|
950
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/services/translation.service.ts
|
|
951
|
+
function translation_service_ts_decorate(decorators, target, key, desc) {
|
|
952
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
953
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
954
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
955
|
+
} else {
|
|
956
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
957
|
+
if (d = decorators[i]) {
|
|
958
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
963
|
+
}
|
|
964
|
+
function translation_service_ts_metadata(metadataKey, metadataValue) {
|
|
965
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
966
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
function translation_service_ts_param(paramIndex, decorator) {
|
|
970
|
+
return function(target, key) {
|
|
971
|
+
decorator(target, key, paramIndex);
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
class TranslationService extends classes_.ApiService {
|
|
982
|
+
cacheManager;
|
|
983
|
+
utilsService;
|
|
984
|
+
dataSourceProvider;
|
|
985
|
+
languageRepo = null;
|
|
986
|
+
translationKeyRepo = null;
|
|
987
|
+
constructor(cacheManager, utilsService, dataSourceProvider){
|
|
988
|
+
super(event_actions/* .LOCALIZATION_EVENT_ENTITIES.TRANSLATION */.JX.TRANSLATION, cacheManager, utilsService, TranslationService.name, true, event_actions/* .LOCALIZATION_EVENT_MODULE */.ec, dataSourceProvider, src_entities/* .Translation */.wD), this.cacheManager = cacheManager, this.utilsService = utilsService, this.dataSourceProvider = dataSourceProvider;
|
|
989
|
+
}
|
|
990
|
+
async getFilterQuery(query, filter, _user) {
|
|
991
|
+
// Handle module filter by joining to translation_key table
|
|
992
|
+
if (filter.module) {
|
|
993
|
+
query.innerJoin('translation.translationKey', 'tk');
|
|
994
|
+
query.andWhere('tk.module = :module', {
|
|
995
|
+
module: filter.module
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
// Handle standard filters on translation table
|
|
999
|
+
if (filter.languageId) {
|
|
1000
|
+
query.andWhere('translation.languageId = :languageId', {
|
|
1001
|
+
languageId: filter.languageId
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
if (filter.translationKeyId) {
|
|
1005
|
+
query.andWhere('translation.translationKeyId = :translationKeyId', {
|
|
1006
|
+
translationKeyId: filter.translationKeyId
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
return {
|
|
1010
|
+
query,
|
|
1011
|
+
isRaw: false
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
async ensureAllReposInitialized() {
|
|
1015
|
+
await this.ensureDataSourceRepository();
|
|
1016
|
+
if (!this.languageRepo) {
|
|
1017
|
+
const ds = await this.dataSourceProvider.getDataSource();
|
|
1018
|
+
this.languageRepo = ds.getRepository(src_entities/* .Language */.TM);
|
|
1019
|
+
this.translationKeyRepo = ds.getRepository(src_entities/* .TranslationKey */.Br);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
async getByLanguageCode(languageCode, modules) {
|
|
1023
|
+
await this.ensureAllReposInitialized();
|
|
1024
|
+
const language = await this.findActiveLanguageByCode(languageCode);
|
|
1025
|
+
if (!language) return {};
|
|
1026
|
+
const qb = this.repository.createQueryBuilder('t').innerJoinAndSelect('t.translationKey', 'tk').where('t.language_id = :languageId', {
|
|
1027
|
+
languageId: language.id
|
|
1028
|
+
}).andWhere('t.is_active = true').andWhere('t.deleted_at IS NULL').andWhere('tk.is_active = true').andWhere('tk.deleted_at IS NULL');
|
|
1029
|
+
if (modules && modules.length > 0) {
|
|
1030
|
+
qb.andWhere('tk.module IN (:...modules)', {
|
|
1031
|
+
modules
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
return this.toTranslationsMap(await qb.getMany());
|
|
1035
|
+
}
|
|
1036
|
+
async getByModuleAndLanguage(module, languageCode) {
|
|
1037
|
+
await this.ensureAllReposInitialized();
|
|
1038
|
+
const language = await this.findActiveLanguageByCode(languageCode);
|
|
1039
|
+
if (!language) return {};
|
|
1040
|
+
const translations = await this.repository.createQueryBuilder('t').innerJoinAndSelect('t.translationKey', 'tk').where('t.language_id = :languageId', {
|
|
1041
|
+
languageId: language.id
|
|
1042
|
+
}).andWhere('tk.module = :module', {
|
|
1043
|
+
module
|
|
1044
|
+
}).andWhere('t.is_active = true').andWhere('t.deleted_at IS NULL').andWhere('tk.is_active = true').andWhere('tk.deleted_at IS NULL').getMany();
|
|
1045
|
+
return this.toTranslationsMap(translations);
|
|
1046
|
+
}
|
|
1047
|
+
async bulkUpdate(updates) {
|
|
1048
|
+
await this.ensureDataSourceRepository();
|
|
1049
|
+
if (updates.length === 0) return [];
|
|
1050
|
+
const ds = await this.dataSourceProvider.getDataSource();
|
|
1051
|
+
const queryRunner = ds.createQueryRunner();
|
|
1052
|
+
await queryRunner.connect();
|
|
1053
|
+
await queryRunner.startTransaction();
|
|
1054
|
+
try {
|
|
1055
|
+
const resultIds = [];
|
|
1056
|
+
for (const update of updates){
|
|
1057
|
+
if (update.id) {
|
|
1058
|
+
// Update existing translation
|
|
1059
|
+
await queryRunner.manager.update(src_entities/* .Translation */.wD, {
|
|
1060
|
+
id: update.id
|
|
1061
|
+
}, {
|
|
1062
|
+
value: update.value,
|
|
1063
|
+
isVerified: update.isVerified ?? false
|
|
1064
|
+
});
|
|
1065
|
+
resultIds.push(update.id);
|
|
1066
|
+
} else {
|
|
1067
|
+
// Create new translation
|
|
1068
|
+
const newTranslation = queryRunner.manager.create(src_entities/* .Translation */.wD, {
|
|
1069
|
+
languageId: update.languageId,
|
|
1070
|
+
translationKeyId: update.translationKeyId,
|
|
1071
|
+
value: update.value,
|
|
1072
|
+
isVerified: update.isVerified ?? false,
|
|
1073
|
+
isActive: true
|
|
1074
|
+
});
|
|
1075
|
+
const saved = await queryRunner.manager.save(newTranslation);
|
|
1076
|
+
resultIds.push(saved.id);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
await queryRunner.commitTransaction();
|
|
1080
|
+
const saved = await this.repository.find({
|
|
1081
|
+
where: {
|
|
1082
|
+
id: (0,external_typeorm_.In)(resultIds)
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
await Promise.all([
|
|
1086
|
+
this.clearCacheForAll(),
|
|
1087
|
+
this.clearCacheForId(saved)
|
|
1088
|
+
]);
|
|
1089
|
+
await this.publishDomainAction(event_actions/* .LOCALIZATION_EVENT_ACTIONS.BULK_UPDATED */.f_.BULK_UPDATED, {
|
|
1090
|
+
ids: saved.map((translation)=>translation.id),
|
|
1091
|
+
metadata: {
|
|
1092
|
+
count: saved.length
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
return saved;
|
|
1096
|
+
} catch (error) {
|
|
1097
|
+
await queryRunner.rollbackTransaction();
|
|
1098
|
+
throw error;
|
|
1099
|
+
} finally{
|
|
1100
|
+
await queryRunner.release();
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
async getMissingTranslations(languageCode) {
|
|
1104
|
+
await this.ensureAllReposInitialized();
|
|
1105
|
+
const language = await this.findActiveLanguageByCode(languageCode);
|
|
1106
|
+
if (!language) return [];
|
|
1107
|
+
if (!this.translationKeyRepo) return [];
|
|
1108
|
+
const allKeys = await this.translationKeyRepo.find({
|
|
1109
|
+
where: {
|
|
1110
|
+
isActive: true,
|
|
1111
|
+
deletedAt: (0,external_typeorm_.IsNull)()
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
const existingTranslations = await this.repository.find({
|
|
1115
|
+
where: {
|
|
1116
|
+
languageId: language.id,
|
|
1117
|
+
isActive: true,
|
|
1118
|
+
deletedAt: (0,external_typeorm_.IsNull)()
|
|
1119
|
+
},
|
|
1120
|
+
select: [
|
|
1121
|
+
'translationKeyId'
|
|
1122
|
+
]
|
|
1123
|
+
});
|
|
1124
|
+
const existingKeyIds = new Set(existingTranslations.map((t)=>t.translationKeyId));
|
|
1125
|
+
return allKeys.filter((k)=>!existingKeyIds.has(k.id));
|
|
1126
|
+
}
|
|
1127
|
+
async getTranslationCounts() {
|
|
1128
|
+
await this.ensureDataSourceRepository();
|
|
1129
|
+
const counts = await this.repository.createQueryBuilder('t').select('t.translation_key_id', 'keyId').addSelect('COUNT(t.id)', 'count').where('t.is_active = true').andWhere('t.deleted_at IS NULL').groupBy('t.translation_key_id').getRawMany();
|
|
1130
|
+
const result = {};
|
|
1131
|
+
for (const row of counts){
|
|
1132
|
+
result[row.keyId] = parseInt(row.count, 10);
|
|
1133
|
+
}
|
|
1134
|
+
return result;
|
|
1135
|
+
}
|
|
1136
|
+
async findActiveLanguageByCode(code) {
|
|
1137
|
+
if (!this.languageRepo) return null;
|
|
1138
|
+
return this.languageRepo.findOne({
|
|
1139
|
+
where: {
|
|
1140
|
+
code,
|
|
1141
|
+
isActive: true,
|
|
1142
|
+
deletedAt: (0,external_typeorm_.IsNull)()
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
toTranslationsMap(translations) {
|
|
1147
|
+
const result = {};
|
|
1148
|
+
for (const t of translations){
|
|
1149
|
+
if (t.translationKey) {
|
|
1150
|
+
result[t.translationKey.key] = t.value;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
return result;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
TranslationService = translation_service_ts_decorate([
|
|
1157
|
+
(0,common_.Injectable)({
|
|
1158
|
+
scope: common_.Scope.REQUEST
|
|
1159
|
+
}),
|
|
1160
|
+
translation_service_ts_param(0, (0,common_.Inject)('CACHE_INSTANCE')),
|
|
1161
|
+
translation_service_ts_param(1, (0,common_.Inject)(modules_.UtilsService)),
|
|
1162
|
+
translation_service_ts_param(2, (0,common_.Inject)(LocalizationDataSourceProvider)),
|
|
1163
|
+
translation_service_ts_metadata("design:type", Function),
|
|
1164
|
+
translation_service_ts_metadata("design:paramtypes", [
|
|
1165
|
+
typeof classes_.HybridCache === "undefined" ? Object : classes_.HybridCache,
|
|
1166
|
+
typeof modules_.UtilsService === "undefined" ? Object : modules_.UtilsService,
|
|
1167
|
+
typeof LocalizationDataSourceProvider === "undefined" ? Object : LocalizationDataSourceProvider
|
|
1168
|
+
])
|
|
1169
|
+
], TranslationService);
|
|
1170
|
+
|
|
1171
|
+
;// CONCATENATED MODULE: ./projects/nestjs-localization/src/services/index.ts
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
},
|
|
1180
|
+
937(module) {
|
|
1181
|
+
|
|
1182
|
+
module.exports = __rspack_external__flusys_nestjs_shared_classes_6076a329;
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
},
|
|
1186
|
+
236(module) {
|
|
1187
|
+
|
|
1188
|
+
module.exports = __rspack_external__flusys_nestjs_shared_modules_24702bee;
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
},
|
|
1192
|
+
157(module) {
|
|
1193
|
+
|
|
1194
|
+
module.exports = __rspack_external__nestjs_common_a04939da;
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
},
|
|
1198
|
+
158(module) {
|
|
1199
|
+
|
|
1200
|
+
module.exports = __rspack_external_typeorm;
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
},
|
|
1204
|
+
|
|
1205
|
+
};
|