@ruiapp/rapid-configure-tools 0.3.0 → 0.4.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/dist/meta-file-generator/generators/model-locales-generator.d.ts +1 -0
- package/dist/mod.js +138 -4
- package/package.json +2 -2
- package/src/meta-file-generator/generators/model-locales-generator.ts +154 -0
- package/src/meta-file-generator/mod.ts +3 -0
- package/src/rapid-models-updater/DictionaryEntryUpdater.ts +1 -1
- package/src/rapid-models-updater/DictionaryUpdater.ts +3 -3
- package/src/rapid-models-updater/ModelUpdater.ts +1 -0
- package/src/rapid-models-updater/PropertyUpdater.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateSdRpdModelLocales(declarationsDirectory: string): void;
|
package/dist/mod.js
CHANGED
|
@@ -374,6 +374,136 @@ function generateSdRpdModelTypes(declarationsDirectory) {
|
|
|
374
374
|
generateEntityTypes(metaDir);
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
+
function generateDictionaryLocales(metaDir) {
|
|
378
|
+
const dictionaries = require(path__default["default"].join(metaDir, "data-dictionary-models")).default;
|
|
379
|
+
const codes = [];
|
|
380
|
+
const linguals = new Set();
|
|
381
|
+
for (const dictionary of dictionaries) {
|
|
382
|
+
if (dictionary.locales) {
|
|
383
|
+
for (const locale of Object.keys(dictionary.locales)) {
|
|
384
|
+
linguals.add(locale);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
for (const entry of dictionary.entries) {
|
|
388
|
+
if (entry.locales) {
|
|
389
|
+
for (const locale of Object.keys(entry.locales)) {
|
|
390
|
+
linguals.add(locale);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
codes.push(`const dictionaryLocales: Record<string, {translation: Record<string, any>}> = {`);
|
|
396
|
+
for (const lingual of linguals) {
|
|
397
|
+
codes.push(` "${lingual}": {`);
|
|
398
|
+
codes.push(` translation: {`);
|
|
399
|
+
codes.push(` dictionaries: {`);
|
|
400
|
+
for (const dictionary of dictionaries) {
|
|
401
|
+
const dictionaryLocale = dictionary.locales?.[lingual];
|
|
402
|
+
codes.push(` "${dictionary.code}": {`);
|
|
403
|
+
if (dictionaryLocale) {
|
|
404
|
+
codes.push(` name: "${dictionaryLocale.name}",`);
|
|
405
|
+
codes.push(` description: "${dictionaryLocale.description}",`);
|
|
406
|
+
}
|
|
407
|
+
codes.push(` entries: {`);
|
|
408
|
+
for (const entry of dictionary.entries) {
|
|
409
|
+
let entryLocaleName;
|
|
410
|
+
let entryLocaleDescription;
|
|
411
|
+
const entryLocale = entry.locales?.[lingual];
|
|
412
|
+
if (entryLocale) {
|
|
413
|
+
entryLocaleName = entryLocale.name || dictionaryLocale?.entries?.[entry.value]?.name;
|
|
414
|
+
entryLocaleDescription = entryLocale.description || dictionaryLocale?.entries?.[entry.value]?.description;
|
|
415
|
+
}
|
|
416
|
+
if (entryLocaleName || entryLocaleDescription) {
|
|
417
|
+
codes.push(` "${entry.value}": {`);
|
|
418
|
+
if (entryLocaleName) {
|
|
419
|
+
codes.push(` name: "${entryLocaleName}",`);
|
|
420
|
+
}
|
|
421
|
+
if (entryLocaleDescription) {
|
|
422
|
+
codes.push(` description: "${entryLocaleDescription}",`);
|
|
423
|
+
}
|
|
424
|
+
codes.push(` },`);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
codes.push(` },`);
|
|
428
|
+
codes.push(` },`);
|
|
429
|
+
}
|
|
430
|
+
codes.push(` },`);
|
|
431
|
+
codes.push(` },`);
|
|
432
|
+
codes.push(` },`);
|
|
433
|
+
}
|
|
434
|
+
codes.push(`};`);
|
|
435
|
+
codes.push(`export default dictionaryLocales;`);
|
|
436
|
+
const fileName = path__default["default"].join(metaDir, "data-dictionary-locales.ts");
|
|
437
|
+
fs__default["default"].writeFileSync(fileName, codes.join("\n"));
|
|
438
|
+
}
|
|
439
|
+
function generateEntityLocales(metaDir) {
|
|
440
|
+
const entities = require(path__default["default"].join(metaDir, "entity-models")).default;
|
|
441
|
+
const codes = [];
|
|
442
|
+
const linguals = new Set();
|
|
443
|
+
for (const entity of entities) {
|
|
444
|
+
if (entity.locales) {
|
|
445
|
+
for (const locale of Object.keys(entity.locales)) {
|
|
446
|
+
linguals.add(locale);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
for (const field of entity.fields) {
|
|
450
|
+
if (field.locales) {
|
|
451
|
+
for (const locale of Object.keys(field.locales)) {
|
|
452
|
+
linguals.add(locale);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
codes.push(`const entityLocales: Record<string, {translation: Record<string, any>}> = {`);
|
|
458
|
+
for (const lingual of linguals) {
|
|
459
|
+
codes.push(` "${lingual}": {`);
|
|
460
|
+
codes.push(` translation: {`);
|
|
461
|
+
codes.push(` entities: {`);
|
|
462
|
+
for (const entity of entities) {
|
|
463
|
+
const entityLocale = entity.locales?.[lingual];
|
|
464
|
+
codes.push(` "${entity.code}": {`);
|
|
465
|
+
if (entityLocale) {
|
|
466
|
+
codes.push(` name: "${entityLocale.name}",`);
|
|
467
|
+
codes.push(` description: "${entityLocale.description}",`);
|
|
468
|
+
}
|
|
469
|
+
codes.push(` fields: {`);
|
|
470
|
+
for (const field of entity.fields) {
|
|
471
|
+
let fieldLocaleName;
|
|
472
|
+
let fieldLocaleDescription;
|
|
473
|
+
const fieldLocale = field.locales?.[lingual];
|
|
474
|
+
if (fieldLocale) {
|
|
475
|
+
fieldLocaleName = fieldLocale.name || entityLocale?.fields?.[field.code]?.name;
|
|
476
|
+
fieldLocaleDescription = fieldLocale.description || entityLocale?.fields?.[field.code]?.description;
|
|
477
|
+
}
|
|
478
|
+
if (fieldLocaleName || fieldLocaleDescription) {
|
|
479
|
+
codes.push(` "${field.code}": {`);
|
|
480
|
+
if (fieldLocaleName) {
|
|
481
|
+
codes.push(` name: "${fieldLocaleName}",`);
|
|
482
|
+
}
|
|
483
|
+
if (fieldLocaleDescription) {
|
|
484
|
+
codes.push(` description: "${fieldLocaleDescription}",`);
|
|
485
|
+
}
|
|
486
|
+
codes.push(` },`);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
codes.push(` },`);
|
|
490
|
+
codes.push(` },`);
|
|
491
|
+
}
|
|
492
|
+
codes.push(` },`);
|
|
493
|
+
codes.push(` },`);
|
|
494
|
+
codes.push(` },`);
|
|
495
|
+
}
|
|
496
|
+
codes.push(`};`);
|
|
497
|
+
codes.push(`export default entityLocales;`);
|
|
498
|
+
const fileName = path__default["default"].join(metaDir, "entity-locales.ts");
|
|
499
|
+
fs__default["default"].writeFileSync(fileName, codes.join("\n"));
|
|
500
|
+
}
|
|
501
|
+
function generateSdRpdModelLocales(declarationsDirectory) {
|
|
502
|
+
const metaDir = path__default["default"].join(declarationsDirectory, "meta");
|
|
503
|
+
generateDictionaryLocales(metaDir);
|
|
504
|
+
generateEntityLocales(metaDir);
|
|
505
|
+
}
|
|
506
|
+
|
|
377
507
|
class MetaFileGenerator {
|
|
378
508
|
generateFiles(option) {
|
|
379
509
|
let { declarationsDirectory } = option;
|
|
@@ -389,6 +519,8 @@ class MetaFileGenerator {
|
|
|
389
519
|
generateModelCodes(declarationsDirectory);
|
|
390
520
|
console.log("generateSdRpdModelTypes");
|
|
391
521
|
generateSdRpdModelTypes(declarationsDirectory);
|
|
522
|
+
console.log("generateSdRpdModelLocales");
|
|
523
|
+
generateSdRpdModelLocales(declarationsDirectory);
|
|
392
524
|
console.log("Done.");
|
|
393
525
|
}
|
|
394
526
|
}
|
|
@@ -509,20 +641,20 @@ function newDictionaryUpdater(rapidConfigApi) {
|
|
|
509
641
|
return entity.code === input.code;
|
|
510
642
|
},
|
|
511
643
|
isEntityChanged(inputEntity, remoteEntity) {
|
|
512
|
-
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["name", "valueType", "description"]);
|
|
644
|
+
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["name", "valueType", "description", "locales"]);
|
|
513
645
|
if (changedFieldNames.length) {
|
|
514
646
|
console.log(`${this.modelType} ${this.inputTitlePrinter(inputEntity)} changed with these fields:`, changedFieldNames);
|
|
515
647
|
}
|
|
516
648
|
return changedFieldNames.length > 0;
|
|
517
649
|
},
|
|
518
650
|
async createEntity(input) {
|
|
519
|
-
const createEntityInput = lodash.pick(input, ["code", "name", "valueType", "level", "description"]);
|
|
651
|
+
const createEntityInput = lodash.pick(input, ["code", "name", "valueType", "level", "description", "locales"]);
|
|
520
652
|
const res = await rapidConfigApi.post(`meta/data_dictionaries`, createEntityInput);
|
|
521
653
|
return res.data;
|
|
522
654
|
},
|
|
523
655
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
524
656
|
async updateEntity(input, remoteEntity, mainEntity, inputIndex) {
|
|
525
|
-
const updateEntityInput = lodash.pick(input, ["code", "name", "valueType", "level", "description"]);
|
|
657
|
+
const updateEntityInput = lodash.pick(input, ["code", "name", "valueType", "level", "description", "locales"]);
|
|
526
658
|
const res = await rapidConfigApi.patch(`meta/data_dictionaries/${remoteEntity.id}`, updateEntityInput);
|
|
527
659
|
return res.data;
|
|
528
660
|
},
|
|
@@ -559,7 +691,7 @@ function newDictionaryEntryUpdater(rapidConfigApi) {
|
|
|
559
691
|
return entity.name === input.name;
|
|
560
692
|
},
|
|
561
693
|
isEntityChanged(inputEntity, remoteEntity) {
|
|
562
|
-
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["value", "description"]);
|
|
694
|
+
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["value", "description", "locales"]);
|
|
563
695
|
if (changedFieldNames.length) {
|
|
564
696
|
console.log(`${this.modelType} ${this.inputTitlePrinter(inputEntity)} changed with these fields:`, changedFieldNames);
|
|
565
697
|
}
|
|
@@ -633,6 +765,7 @@ function newModelUpdater(rapidConfigApi) {
|
|
|
633
765
|
"indexes",
|
|
634
766
|
"permissionPolicies",
|
|
635
767
|
"softDelete",
|
|
768
|
+
"locales",
|
|
636
769
|
]);
|
|
637
770
|
if (changedFieldNames.length) {
|
|
638
771
|
console.log(`${this.modelType} ${this.inputTitlePrinter(inputEntity)} changed with these fields:`, changedFieldNames);
|
|
@@ -718,6 +851,7 @@ function newPropertyUpdater(rapidConfigApi) {
|
|
|
718
851
|
"linkDbSchema",
|
|
719
852
|
"entityDeletingReaction",
|
|
720
853
|
"readonly",
|
|
854
|
+
"locales",
|
|
721
855
|
]);
|
|
722
856
|
if (changedFieldNames.length) {
|
|
723
857
|
console.log(`${this.modelType} ${this.inputTitlePrinter(inputEntity)} changed with these fields:`, changedFieldNames);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruiapp/rapid-configure-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/mod.js",
|
|
6
6
|
"keywords": [],
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"axios-cookiejar-support": "^4.0.7",
|
|
21
21
|
"lodash": "^4.17.21",
|
|
22
22
|
"tough-cookie": "^4.1.3",
|
|
23
|
-
"@ruiapp/rapid-extension": "^0.
|
|
23
|
+
"@ruiapp/rapid-extension": "^0.4.2"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {},
|
|
26
26
|
"scripts": {
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import type { RapidDataDictionary, RapidEntity, RapidField } from "@ruiapp/rapid-extension";
|
|
4
|
+
|
|
5
|
+
function generateDictionaryLocales(metaDir: string) {
|
|
6
|
+
const dictionaries: RapidDataDictionary[] = require(path.join(metaDir, "data-dictionary-models")).default;
|
|
7
|
+
|
|
8
|
+
const codes: string[] = [];
|
|
9
|
+
|
|
10
|
+
const linguals: Set<string> = new Set();
|
|
11
|
+
for (const dictionary of dictionaries) {
|
|
12
|
+
if (dictionary.locales) {
|
|
13
|
+
for (const locale of Object.keys(dictionary.locales)) {
|
|
14
|
+
linguals.add(locale);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
for (const entry of dictionary.entries) {
|
|
18
|
+
if (entry.locales) {
|
|
19
|
+
for (const locale of Object.keys(entry.locales)) {
|
|
20
|
+
linguals.add(locale);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
codes.push(`const dictionaryLocales: Record<string, {translation: Record<string, any>}> = {`);
|
|
27
|
+
for (const lingual of linguals) {
|
|
28
|
+
codes.push(` "${lingual}": {`);
|
|
29
|
+
codes.push(` translation: {`);
|
|
30
|
+
codes.push(` dictionaries: {`);
|
|
31
|
+
|
|
32
|
+
for (const dictionary of dictionaries) {
|
|
33
|
+
const dictionaryLocale = dictionary.locales?.[lingual];
|
|
34
|
+
codes.push(` "${dictionary.code}": {`);
|
|
35
|
+
if (dictionaryLocale) {
|
|
36
|
+
codes.push(` name: "${dictionaryLocale.name}",`);
|
|
37
|
+
codes.push(` description: "${dictionaryLocale.description}",`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
codes.push(` entries: {`);
|
|
41
|
+
for (const entry of dictionary.entries) {
|
|
42
|
+
let entryLocaleName;
|
|
43
|
+
let entryLocaleDescription;
|
|
44
|
+
const entryLocale = entry.locales?.[lingual];
|
|
45
|
+
if (entryLocale) {
|
|
46
|
+
entryLocaleName = entryLocale.name || dictionaryLocale?.entries?.[entry.value]?.name;
|
|
47
|
+
entryLocaleDescription = entryLocale.description || dictionaryLocale?.entries?.[entry.value]?.description;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (entryLocaleName || entryLocaleDescription) {
|
|
51
|
+
codes.push(` "${entry.value}": {`);
|
|
52
|
+
if (entryLocaleName) {
|
|
53
|
+
codes.push(` name: "${entryLocaleName}",`);
|
|
54
|
+
}
|
|
55
|
+
if (entryLocaleDescription) {
|
|
56
|
+
codes.push(` description: "${entryLocaleDescription}",`);
|
|
57
|
+
}
|
|
58
|
+
codes.push(` },`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
codes.push(` },`);
|
|
62
|
+
codes.push(` },`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
codes.push(` },`);
|
|
66
|
+
codes.push(` },`);
|
|
67
|
+
codes.push(` },`);
|
|
68
|
+
}
|
|
69
|
+
codes.push(`};`);
|
|
70
|
+
|
|
71
|
+
codes.push(`export default dictionaryLocales;`);
|
|
72
|
+
|
|
73
|
+
const fileName = path.join(metaDir, "data-dictionary-locales.ts");
|
|
74
|
+
fs.writeFileSync(fileName, codes.join("\n"));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function generateEntityLocales(metaDir: string) {
|
|
78
|
+
const entities: RapidEntity[] = require(path.join(metaDir, "entity-models")).default;
|
|
79
|
+
|
|
80
|
+
const codes: string[] = [];
|
|
81
|
+
|
|
82
|
+
const linguals: Set<string> = new Set();
|
|
83
|
+
for (const entity of entities) {
|
|
84
|
+
if (entity.locales) {
|
|
85
|
+
for (const locale of Object.keys(entity.locales)) {
|
|
86
|
+
linguals.add(locale);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (const field of entity.fields) {
|
|
90
|
+
if (field.locales) {
|
|
91
|
+
for (const locale of Object.keys(field.locales)) {
|
|
92
|
+
linguals.add(locale);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
codes.push(`const entityLocales: Record<string, {translation: Record<string, any>}> = {`);
|
|
99
|
+
for (const lingual of linguals) {
|
|
100
|
+
codes.push(` "${lingual}": {`);
|
|
101
|
+
codes.push(` translation: {`);
|
|
102
|
+
codes.push(` entities: {`);
|
|
103
|
+
|
|
104
|
+
for (const entity of entities) {
|
|
105
|
+
const entityLocale = entity.locales?.[lingual];
|
|
106
|
+
codes.push(` "${entity.code}": {`);
|
|
107
|
+
if (entityLocale) {
|
|
108
|
+
codes.push(` name: "${entityLocale.name}",`);
|
|
109
|
+
codes.push(` description: "${entityLocale.description}",`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
codes.push(` fields: {`);
|
|
113
|
+
for (const field of entity.fields) {
|
|
114
|
+
let fieldLocaleName;
|
|
115
|
+
let fieldLocaleDescription;
|
|
116
|
+
const fieldLocale = field.locales?.[lingual];
|
|
117
|
+
if (fieldLocale) {
|
|
118
|
+
fieldLocaleName = fieldLocale.name || entityLocale?.fields?.[field.code]?.name;
|
|
119
|
+
fieldLocaleDescription = fieldLocale.description || entityLocale?.fields?.[field.code]?.description;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (fieldLocaleName || fieldLocaleDescription) {
|
|
123
|
+
codes.push(` "${field.code}": {`);
|
|
124
|
+
if (fieldLocaleName) {
|
|
125
|
+
codes.push(` name: "${fieldLocaleName}",`);
|
|
126
|
+
}
|
|
127
|
+
if (fieldLocaleDescription) {
|
|
128
|
+
codes.push(` description: "${fieldLocaleDescription}",`);
|
|
129
|
+
}
|
|
130
|
+
codes.push(` },`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
codes.push(` },`);
|
|
134
|
+
codes.push(` },`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
codes.push(` },`);
|
|
138
|
+
codes.push(` },`);
|
|
139
|
+
codes.push(` },`);
|
|
140
|
+
}
|
|
141
|
+
codes.push(`};`);
|
|
142
|
+
|
|
143
|
+
codes.push(`export default entityLocales;`);
|
|
144
|
+
|
|
145
|
+
const fileName = path.join(metaDir, "entity-locales.ts");
|
|
146
|
+
fs.writeFileSync(fileName, codes.join("\n"));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function generateSdRpdModelLocales(declarationsDirectory: string) {
|
|
150
|
+
const metaDir = path.join(declarationsDirectory, "meta");
|
|
151
|
+
|
|
152
|
+
generateDictionaryLocales(metaDir);
|
|
153
|
+
generateEntityLocales(metaDir);
|
|
154
|
+
}
|
|
@@ -2,6 +2,7 @@ import path from "path";
|
|
|
2
2
|
import { generateModelIndexFiles } from "./generators/model-index-generator";
|
|
3
3
|
import { generateModelCodes, generateDictionaryCodes } from "./generators/model-codes-generator";
|
|
4
4
|
import { generateSdRpdModelTypes } from "./generators/model-types-generator";
|
|
5
|
+
import { generateSdRpdModelLocales } from "./generators/model-locales-generator";
|
|
5
6
|
|
|
6
7
|
export interface FileGenerateOption {
|
|
7
8
|
declarationsDirectory: string;
|
|
@@ -24,6 +25,8 @@ export default class MetaFileGenerator {
|
|
|
24
25
|
generateModelCodes(declarationsDirectory);
|
|
25
26
|
console.log("generateSdRpdModelTypes");
|
|
26
27
|
generateSdRpdModelTypes(declarationsDirectory);
|
|
28
|
+
console.log("generateSdRpdModelLocales");
|
|
29
|
+
generateSdRpdModelLocales(declarationsDirectory);
|
|
27
30
|
console.log("Done.");
|
|
28
31
|
}
|
|
29
32
|
}
|
|
@@ -42,7 +42,7 @@ export function newDictionaryEntryUpdater(rapidConfigApi: AxiosInstance) {
|
|
|
42
42
|
},
|
|
43
43
|
|
|
44
44
|
isEntityChanged(inputEntity, remoteEntity) {
|
|
45
|
-
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["value", "description"]);
|
|
45
|
+
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["value", "description", "locales"]);
|
|
46
46
|
if (changedFieldNames.length) {
|
|
47
47
|
console.log(`${this.modelType} ${this.inputTitlePrinter(inputEntity)} changed with these fields:`, changedFieldNames);
|
|
48
48
|
}
|
|
@@ -30,7 +30,7 @@ export function newDictionaryUpdater(rapidConfigApi: AxiosInstance) {
|
|
|
30
30
|
},
|
|
31
31
|
|
|
32
32
|
isEntityChanged(inputEntity, remoteEntity) {
|
|
33
|
-
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["name", "valueType", "description"]);
|
|
33
|
+
const changedFieldNames = detectChangedFields(inputEntity, remoteEntity, ["name", "valueType", "description", "locales"]);
|
|
34
34
|
if (changedFieldNames.length) {
|
|
35
35
|
console.log(`${this.modelType} ${this.inputTitlePrinter(inputEntity)} changed with these fields:`, changedFieldNames);
|
|
36
36
|
}
|
|
@@ -38,14 +38,14 @@ export function newDictionaryUpdater(rapidConfigApi: AxiosInstance) {
|
|
|
38
38
|
},
|
|
39
39
|
|
|
40
40
|
async createEntity(input) {
|
|
41
|
-
const createEntityInput: CreateDataDictionaryInput = pick(input, ["code", "name", "valueType", "level", "description"]);
|
|
41
|
+
const createEntityInput: CreateDataDictionaryInput = pick(input, ["code", "name", "valueType", "level", "description", "locales"]);
|
|
42
42
|
const res = await rapidConfigApi.post(`meta/data_dictionaries`, createEntityInput);
|
|
43
43
|
return res.data;
|
|
44
44
|
},
|
|
45
45
|
|
|
46
46
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47
47
|
async updateEntity(input, remoteEntity, mainEntity, inputIndex) {
|
|
48
|
-
const updateEntityInput: UpdateDataDictionaryInput = pick(input, ["code", "name", "valueType", "level", "description"]);
|
|
48
|
+
const updateEntityInput: UpdateDataDictionaryInput = pick(input, ["code", "name", "valueType", "level", "description", "locales"]);
|
|
49
49
|
const res = await rapidConfigApi.patch(`meta/data_dictionaries/${remoteEntity.id}`, updateEntityInput);
|
|
50
50
|
return res.data;
|
|
51
51
|
},
|
|
@@ -45,6 +45,7 @@ export function newModelUpdater(rapidConfigApi: AxiosInstance) {
|
|
|
45
45
|
"indexes",
|
|
46
46
|
"permissionPolicies",
|
|
47
47
|
"softDelete",
|
|
48
|
+
"locales",
|
|
48
49
|
]);
|
|
49
50
|
if (changedFieldNames.length) {
|
|
50
51
|
console.log(`${this.modelType} ${this.inputTitlePrinter(inputEntity)} changed with these fields:`, changedFieldNames);
|
|
@@ -55,6 +55,7 @@ export function newPropertyUpdater(rapidConfigApi: AxiosInstance) {
|
|
|
55
55
|
"linkDbSchema",
|
|
56
56
|
"entityDeletingReaction",
|
|
57
57
|
"readonly",
|
|
58
|
+
"locales",
|
|
58
59
|
]);
|
|
59
60
|
if (changedFieldNames.length) {
|
|
60
61
|
console.log(`${this.modelType} ${this.inputTitlePrinter(inputEntity)} changed with these fields:`, changedFieldNames);
|