@akanjs/dictionary 0.0.46 → 0.0.48

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/index.js CHANGED
@@ -2,10 +2,6 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
5
  var __copyProps = (to, from, except, desc) => {
10
6
  if (from && typeof from === "object" || typeof from === "function") {
11
7
  for (let key of __getOwnPropNames(from))
@@ -14,358 +10,8 @@ var __copyProps = (to, from, except, desc) => {
14
10
  }
15
11
  return to;
16
12
  };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // pkgs/@akanjs/dictionary/index.ts
20
15
  var dictionary_exports = {};
21
- __export(dictionary_exports, {
22
- baseTrans: () => baseTrans,
23
- checkDictCoverage: () => checkDictCoverage,
24
- getBaseSignalTrans: () => getBaseSignalTrans,
25
- makeDictionary: () => makeDictionary,
26
- makeTrans: () => makeTrans,
27
- msg: () => msg,
28
- rootDictionary: () => rootDictionary
29
- });
30
16
  module.exports = __toCommonJS(dictionary_exports);
31
-
32
- // pkgs/@akanjs/dictionary/src/trans.ts
33
- var import_common = require("@akanjs/common");
34
- var import_constant = require("@akanjs/constant");
35
- var import_signal = require("@akanjs/signal");
36
- var baseTrans = {
37
- id: ["Id", "\uC544\uC774\uB514"],
38
- "desc-id": ["Unique ID value", "\uC720\uB2C8\uD06C\uD55C \uC544\uC774\uB514\uAC12"],
39
- createdAt: ["CreatedAt", "\uC0DD\uC131\uC77C"],
40
- "desc-createdAt": ["Data created time", "\uB370\uC774\uD130 \uC0DD\uC131 \uC2DC\uAC01"],
41
- updatedAt: ["UpdatedAt", "\uC218\uC815\uC77C"],
42
- "desc-updatedAt": ["Data updated time", "\uB370\uC774\uD130 \uB9C8\uC9C0\uB9C9 \uC218\uC815 \uC2DC\uAC01"],
43
- removedAt: ["RemovedAt", "\uC0AD\uC81C\uC77C"],
44
- "desc-removedAt": ["Data removed time", "\uB370\uC774\uD130 \uC0AD\uC81C \uC2DC\uAC01"],
45
- status: ["Status", "\uC0C1\uD0DC"],
46
- "desc-status": ["Data status", "\uB370\uC774\uD130 \uC0C1\uD0DC"],
47
- count: ["Count", "\uAC1C\uC218"],
48
- "desc-count": ["Data count", "\uB370\uC774\uD130 \uAC1C\uC218"],
49
- latest: ["latest", "\uCD5C\uC2E0\uC21C"],
50
- "desc-latest": ["latest", "\uCD5C\uC2E0\uC21C"],
51
- oldest: ["oldest", "\uC624\uB798\uB41C\uC21C"],
52
- "desc-oldest": ["oldest", "\uC624\uB798\uB41C\uC21C"],
53
- "qry-any": ["All", "\uC804\uCCB4"],
54
- "qrydesc-any": ["All", "\uC804\uCCB4"],
55
- "qry-byStatuses": ["By Statuses", "\uC0C1\uD0DC\uBCC4 \uC870\uD68C"],
56
- "qrydesc-byStatuses": ["By Statuses", "\uC0C1\uD0DC\uBCC4 \uC870\uD68C"],
57
- "qarg-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"],
58
- "qargdesc-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"]
59
- };
60
- var getBaseSignalTrans = (modelName) => {
61
- const className = (0, import_common.capitalize)(modelName);
62
- return {
63
- // * ==================== Endpoint ==================== * //
64
- [`api-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
65
- [`apidesc-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
66
- [`arg-light${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
67
- [`argdesc-light${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
68
- [`api-${modelName}`]: [`Get ${modelName}`, `${modelName} \uC870\uD68C`],
69
- [`apidesc-${modelName}`]: [`Get ${modelName}`, `${modelName} \uC870\uD68C`],
70
- [`arg-${modelName}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
71
- [`argdesc-${modelName}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
72
- [`api-${modelName}List`]: [`Get ${modelName} list`, `${modelName} \uB9AC\uC2A4\uD2B8 \uC870\uD68C`],
73
- [`apidesc-${modelName}List`]: [`Get ${modelName} list`, `${modelName} \uB9AC\uC2A4\uD2B8 \uC870\uD68C`],
74
- [`arg-${modelName}List-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
75
- [`argdesc-${modelName}List-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
76
- [`arg-${modelName}List-skip`]: [`Skip of ${modelName}`, `${modelName} \uC2A4\uD0B5`],
77
- [`argdesc-${modelName}List-skip`]: [`Skip of ${modelName}`, `${modelName} \uC2A4\uD0B5`],
78
- [`arg-${modelName}List-limit`]: [`Limit of ${modelName}`, `${modelName} \uC81C\uD55C`],
79
- [`argdesc-${modelName}List-limit`]: [`Limit of ${modelName}`, `${modelName} \uC81C\uD55C`],
80
- [`arg-${modelName}List-sort`]: [`Sort of ${modelName}`, `${modelName} \uC815\uB82C`],
81
- [`argdesc-${modelName}List-sort`]: [`Sort of ${modelName}`, `${modelName} \uC815\uB82C`],
82
- [`api-${modelName}Insight`]: [`Get ${modelName} insight`, `${modelName} \uC778\uC0AC\uC774\uD2B8 \uC870\uD68C`],
83
- [`apidesc-${modelName}Insight`]: [`Get ${modelName} insight`, `${modelName} \uC778\uC0AC\uC774\uD2B8 \uC870\uD68C`],
84
- [`arg-${modelName}Insight-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
85
- [`argdesc-${modelName}Insight-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
86
- [`api-${modelName}Exists`]: [`Check ${modelName} exists`, `${modelName} \uC874\uC7AC \uC5EC\uBD80 \uD655\uC778`],
87
- [`apidesc-${modelName}Exists`]: [`Check ${modelName} exists`, `${modelName} \uC874\uC7AC \uC5EC\uBD80 \uD655\uC778`],
88
- [`arg-${modelName}Exists-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
89
- [`argdesc-${modelName}Exists-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
90
- [`api-create${className}`]: [`Create ${modelName}`, `${modelName} \uC0DD\uC131`],
91
- [`apidesc-create${className}`]: [`Create ${modelName}`, `${modelName} \uC0DD\uC131`],
92
- [`arg-create${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
93
- [`argdesc-create${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
94
- [`api-update${className}`]: [`Update ${modelName}`, `${modelName} \uC218\uC815`],
95
- [`apidesc-update${className}`]: [`Update ${modelName}`, `${modelName} \uC218\uC815`],
96
- [`arg-update${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
97
- [`argdesc-update${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
98
- [`arg-update${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
99
- [`argdesc-update${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
100
- [`api-remove${className}`]: [`Remove ${modelName}`, `${modelName} \uC0AD\uC81C`],
101
- [`apidesc-remove${className}`]: [`Remove ${modelName}`, `${modelName} \uC0AD\uC81C`],
102
- [`arg-remove${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
103
- [`argdesc-remove${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`]
104
- // * ==================== Endpoint ==================== * //
105
- };
106
- };
107
- var checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) => {
108
- const enumKeyMap = /* @__PURE__ */ new Map();
109
- modelRefs.forEach((modelRef) => {
110
- const fieldMetaMap = (0, import_constant.getFieldMetaMap)(modelRef);
111
- [...fieldMetaMap.values()].forEach((fieldMeta) => {
112
- if (!fieldMeta.enum)
113
- return;
114
- enumKeyMap.set(fieldMeta.key, new Set(fieldMeta.enum.map((value) => value.toString())));
115
- fieldMeta.enum.forEach((value) => {
116
- const enumDict = dictionary[`enum-${fieldMeta.key}-${value}`];
117
- const modelDict = rootDictionary[modelName];
118
- const rootEnumDict = modelDict?.[`enum-${fieldMeta.key}-${value}`];
119
- if (!enumDict && !rootEnumDict) {
120
- import_common.Logger.warn(`\u2620\uFE0F Missing enum translation: ${modelName}.enum-${fieldMeta.key}-${value}`);
121
- }
122
- const enumDescDict = dictionary[`enumdesc-${fieldMeta.key}-${value}`];
123
- const rootEnumDescDict = modelDict?.[`enumdesc-${fieldMeta.key}-${value}`];
124
- if (!enumDescDict && !rootEnumDescDict) {
125
- import_common.Logger.warn(`\u2620\uFE0F Missing enum description: ${modelName}.enumdesc-${fieldMeta.key}-${value}`);
126
- }
127
- });
128
- });
129
- });
130
- Object.keys(dictionary).filter((key) => key.startsWith("enum-")).forEach((key) => {
131
- const [, fieldKey, ...values] = key.split("-");
132
- const value = values.join("-");
133
- if (!enumKeyMap.get(fieldKey)?.has(value)) {
134
- import_common.Logger.error(
135
- `\u{1F47B} Unused enum translation, need to delete: ${modelName}.enum-${fieldKey}-${value} & ${modelName}.enumdesc-${fieldKey}-${value}`
136
- );
137
- }
138
- });
139
- const fieldKeySet = /* @__PURE__ */ new Set([
140
- ...modelRefs.map((modelRef) => [...(0, import_constant.getFieldMetaMap)(modelRef).keys()]).flat(),
141
- ...filterRefs.map((filterRef) => Object.keys((0, import_constant.getFilterSortMap)(filterRef))).flat()
142
- ]);
143
- Object.keys(dictionary).filter((key) => key.startsWith("desc-")).forEach((key) => {
144
- const [, fieldKey] = key.split("-");
145
- if (!fieldKeySet.has(fieldKey))
146
- import_common.Logger.error(
147
- `\u{1F47B} Unused description translation, need to delete: ${modelName}.${fieldKey} & ${modelName}.desc-${fieldKey}`
148
- );
149
- });
150
- };
151
- var checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
152
- const argKeyMap = /* @__PURE__ */ new Map();
153
- sigRefs.forEach((sigRef) => {
154
- const gqlMetas = (0, import_signal.getGqlMetas)(sigRef);
155
- gqlMetas.filter((gqlMeta) => gqlMeta.type !== "Process").forEach((gqlMeta) => {
156
- const [argMetas] = (0, import_signal.getArgMetas)(sigRef, gqlMeta.key);
157
- argKeyMap.set(gqlMeta.key, new Set(argMetas.map((argMeta) => argMeta.name)));
158
- argMetas.forEach((argMeta) => {
159
- const argDict = dictionary[`arg-${gqlMeta.key}-${argMeta.name}`];
160
- if (!argDict) {
161
- import_common.Logger.warn(`\u2620\uFE0F Missing arg translation: ${modelName}.arg-${gqlMeta.key}-${argMeta.name}`);
162
- }
163
- const argDescDict = dictionary[`argdesc-${gqlMeta.key}-${argMeta.name}`];
164
- if (!argDescDict) {
165
- import_common.Logger.warn(`\u2620\uFE0F Missing arg description: ${modelName}.argdesc-${gqlMeta.key}-${argMeta.name}`);
166
- }
167
- });
168
- });
169
- });
170
- Object.keys(dictionary).filter((key) => key.startsWith("arg-")).forEach((key) => {
171
- const [, gqlKey, argKey] = key.split("-");
172
- if (!argKeyMap.get(gqlKey)?.has(argKey))
173
- import_common.Logger.error(
174
- `\u{1F47B} Unused arg translation, need to delete: ${modelName}.arg-${gqlKey}-${argKey} & ${modelName}.argdesc-${gqlKey}-${argKey}`
175
- );
176
- });
177
- };
178
- var checkFilterDictCoverages = (modelName, filterRefs, dictionary) => {
179
- const qargKeyMap = /* @__PURE__ */ new Map();
180
- filterRefs.forEach((filterRef) => {
181
- const filterMetaMap = (0, import_constant.getFilterQueryMap)(filterRef);
182
- filterMetaMap.forEach((filterMeta) => {
183
- const filterArgMetas = (0, import_constant.getFilterArgMetas)(filterRef, filterMeta.key);
184
- qargKeyMap.set(filterMeta.key, new Set(filterArgMetas.map((filterArgMeta) => filterArgMeta.name)));
185
- filterArgMetas.forEach((filterArgMeta) => {
186
- const qargDict = dictionary[`qarg-${filterMeta.key}-${filterArgMeta.name}`];
187
- if (!qargDict)
188
- import_common.Logger.warn(`\u2620\uFE0F Missing qarg translation: ${modelName}.qarg-${filterMeta.key}-${filterArgMeta.name}`);
189
- const qargDescDict = dictionary[`qargdesc-${filterMeta.key}-${filterArgMeta.name}`];
190
- if (!qargDescDict)
191
- import_common.Logger.warn(`\u2620\uFE0F Missing qarg description: ${modelName}.qargdesc-${filterMeta.key}-${filterArgMeta.name}`);
192
- });
193
- });
194
- });
195
- Object.keys(dictionary).filter((key) => key.startsWith("qarg-")).forEach((key) => {
196
- const [, filterKey, filterArgKey] = key.split("-");
197
- if (!qargKeyMap.get(filterKey)?.has(filterArgKey))
198
- import_common.Logger.error(
199
- `\u{1F47B} Unused qarg translation, need to delete: ${modelName}.qarg-${filterKey}-${filterArgKey} & ${modelName}.qargdesc-${filterKey}-${filterArgKey}`
200
- );
201
- });
202
- };
203
- var checkDictCoverage = () => {
204
- const fullModelRefEntries = (0, import_constant.getAllFullModelRefs)().filter((modelRef) => {
205
- const classMeta = (0, import_constant.getClassMeta)(modelRef);
206
- return classMeta.type === "full" && classMeta.modelType === "data";
207
- }).map((modelRef) => {
208
- const classMeta = (0, import_constant.getClassMeta)(modelRef);
209
- const modelName = (0, import_common.lowerlize)(classMeta.refName);
210
- return { modelName, modelRef };
211
- });
212
- const scalarModelRefs = (0, import_constant.getAllScalarModelRefs)();
213
- const insightModelRefEntries = scalarModelRefs.filter((ref) => (0, import_constant.getClassMeta)(ref).modelType === "insight").map((modelRef) => {
214
- const classMeta = (0, import_constant.getClassMeta)(modelRef);
215
- if (!classMeta.refName.endsWith("Insight"))
216
- throw new Error(`Invalid insight model name: ${classMeta.refName}`);
217
- const modelName = (0, import_common.lowerlize)(classMeta.refName.slice(0, -7));
218
- return { modelName, modelRef };
219
- });
220
- const pureScalarModelRefEntries = scalarModelRefs.filter((ref) => (0, import_constant.getClassMeta)(ref).modelType === "data").map((modelRef) => {
221
- const classMeta = (0, import_constant.getClassMeta)(modelRef);
222
- const modelName = (0, import_common.lowerlize)(classMeta.refName);
223
- return { modelName, modelRef };
224
- });
225
- const filterModelRefEntries = (0, import_constant.getAllFilterModelRefs)().map((filterModelRef) => {
226
- const filterMeta = (0, import_constant.getFilterMeta)(filterModelRef);
227
- if (!filterMeta.refName.endsWith("Filter"))
228
- throw new Error(`Invalid filter model name: ${filterMeta.refName}`);
229
- const modelName = (0, import_common.lowerlize)(filterMeta.refName.slice(0, -6));
230
- return { modelName, filterModelRef };
231
- });
232
- const signalRefs = (0, import_signal.getAllSignalRefs)();
233
- const fullModelSignalRefEntries = signalRefs.filter((ref) => {
234
- const sigMeta = (0, import_signal.getSigMeta)(ref);
235
- if (!sigMeta.returns)
236
- return false;
237
- const modelRef = sigMeta.returns();
238
- const classMeta = (0, import_constant.getClassMeta)(modelRef);
239
- return classMeta.type === "full";
240
- }).map((sigRef) => {
241
- const sigMeta = (0, import_signal.getSigMeta)(sigRef);
242
- const modelName = (0, import_common.lowerlize)(sigMeta.refName);
243
- return { modelName, sigRef };
244
- });
245
- const scalarModelSignalRefEntries = signalRefs.filter((ref) => {
246
- const sigMeta = (0, import_signal.getSigMeta)(ref);
247
- if (!sigMeta.returns)
248
- return false;
249
- const modelRef = sigMeta.returns();
250
- const classMeta = (0, import_constant.getClassMeta)(modelRef);
251
- return classMeta.type === "scalar";
252
- }).map((sigRef) => {
253
- const sigMeta = (0, import_signal.getSigMeta)(sigRef);
254
- const modelName = (0, import_common.lowerlize)(sigMeta.refName);
255
- return { modelName, sigRef };
256
- });
257
- const pureSignalRefEntries = signalRefs.filter((ref) => !(0, import_signal.getSigMeta)(ref).returns).map((sigRef) => {
258
- const sigMeta = (0, import_signal.getSigMeta)(sigRef);
259
- const modelName = (0, import_common.lowerlize)(sigMeta.refName);
260
- return { modelName, sigRef };
261
- });
262
- const modelDictExamMap = /* @__PURE__ */ new Map();
263
- const scalarDictExamMap = /* @__PURE__ */ new Map();
264
- const signalDictExamMap = /* @__PURE__ */ new Map();
265
- const getDefaultModelDict = () => ({ modelRefs: [], insightRefs: [], sigRefs: [], filterRefs: [] });
266
- fullModelRefEntries.forEach(({ modelName, modelRef }) => {
267
- const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
268
- modelDictExam.modelRefs.push(modelRef);
269
- modelDictExamMap.set(modelName, modelDictExam);
270
- });
271
- insightModelRefEntries.forEach(({ modelName, modelRef }) => {
272
- const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
273
- modelDictExam.insightRefs.push(modelRef);
274
- modelDictExamMap.set(modelName, modelDictExam);
275
- });
276
- fullModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
277
- const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
278
- modelDictExam.sigRefs.push(sigRef);
279
- modelDictExamMap.set(modelName, modelDictExam);
280
- });
281
- filterModelRefEntries.forEach(({ modelName, filterModelRef }) => {
282
- const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
283
- modelDictExam.filterRefs.push(filterModelRef);
284
- modelDictExamMap.set(modelName, modelDictExam);
285
- });
286
- const getDefaultScalarDict = () => ({ modelRefs: [], sigRefs: [] });
287
- pureScalarModelRefEntries.forEach(({ modelName, modelRef }) => {
288
- const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
289
- scalarDictExam.modelRefs.push(modelRef);
290
- scalarDictExamMap.set(modelName, scalarDictExam);
291
- });
292
- scalarModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
293
- const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
294
- scalarDictExam.sigRefs.push(sigRef);
295
- scalarDictExamMap.set(modelName, scalarDictExam);
296
- });
297
- const getDefaultSignalDict = () => ({ sigRefs: [] });
298
- pureSignalRefEntries.forEach(({ modelName, sigRef }) => {
299
- const signalDictExam = signalDictExamMap.get(modelName) ?? getDefaultSignalDict();
300
- signalDictExam.sigRefs.push(sigRef);
301
- signalDictExamMap.set(modelName, signalDictExam);
302
- });
303
- modelDictExamMap.forEach(({ modelRefs, insightRefs, sigRefs, filterRefs }, modelName) => {
304
- const dictionary = rootDictionary[modelName];
305
- if (!dictionary)
306
- return;
307
- checkModelDictCoverages(modelName, dictionary, [...modelRefs, ...insightRefs], filterRefs);
308
- checkSignalDictCoverages(modelName, sigRefs, dictionary);
309
- checkFilterDictCoverages(modelName, filterRefs, dictionary);
310
- });
311
- scalarDictExamMap.forEach(({ modelRefs, sigRefs }, modelName) => {
312
- const dictionary = rootDictionary[modelName];
313
- if (!dictionary)
314
- return;
315
- checkModelDictCoverages(modelName, dictionary, modelRefs, []);
316
- checkSignalDictCoverages(modelName, sigRefs, dictionary);
317
- });
318
- signalDictExamMap.forEach(({ sigRefs }, modelName) => {
319
- const dictionary = rootDictionary[modelName];
320
- if (!dictionary)
321
- return;
322
- checkSignalDictCoverages(modelName, sigRefs, dictionary);
323
- });
324
- };
325
- var rootDictionary = {};
326
- var makeDictionary = (rootDict, dict1, dict2, dict3, dict4, dict5) => {
327
- const dicts = [dict1, dict2, dict3, dict4, dict5].filter((d) => !!d);
328
- dicts.forEach((dict) => {
329
- Object.entries(dict).forEach(([key, value]) => {
330
- const rootValue = rootDict[key];
331
- if (!rootValue)
332
- Object.assign(rootDict, { [key]: value });
333
- else
334
- Object.assign(rootDict[key], value);
335
- });
336
- });
337
- return rootDict;
338
- };
339
- var languages = ["ko", "en", "zhChs", "zhCht"];
340
- var msg = {
341
- info: () => null,
342
- success: () => null,
343
- error: () => null,
344
- warning: () => null,
345
- loading: () => null
346
- };
347
- var makeTrans = (locale) => {
348
- const revert = (key, data) => {
349
- throw new Error(key);
350
- };
351
- class Revert extends Error {
352
- constructor(key, data) {
353
- super(key);
354
- }
355
- }
356
- const translate = (lang, key, data) => {
357
- const langIdx = languages.indexOf(lang);
358
- const [modelName, msgKey] = key.split(".");
359
- const model = locale[modelName];
360
- const message = model[msgKey][langIdx];
361
- if (!message)
362
- throw new Error("Invalid message");
363
- return message;
364
- };
365
- return {
366
- revert,
367
- Revert,
368
- translate,
369
- msg
370
- };
371
- };
17
+ __reExport(dictionary_exports, require("./src"), module.exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/dictionary",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/index.js ADDED
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var src_exports = {};
16
+ module.exports = __toCommonJS(src_exports);
17
+ __reExport(src_exports, require("./trans"), module.exports);
package/src/trans.js ADDED
@@ -0,0 +1,367 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var trans_exports = {};
19
+ __export(trans_exports, {
20
+ baseTrans: () => baseTrans,
21
+ checkDictCoverage: () => checkDictCoverage,
22
+ getBaseSignalTrans: () => getBaseSignalTrans,
23
+ makeDictionary: () => makeDictionary,
24
+ makeTrans: () => makeTrans,
25
+ msg: () => msg,
26
+ rootDictionary: () => rootDictionary
27
+ });
28
+ module.exports = __toCommonJS(trans_exports);
29
+ var import_common = require("@akanjs/common");
30
+ var import_constant = require("@akanjs/constant");
31
+ var import_signal = require("@akanjs/signal");
32
+ const baseTrans = {
33
+ id: ["Id", "\uC544\uC774\uB514"],
34
+ "desc-id": ["Unique ID value", "\uC720\uB2C8\uD06C\uD55C \uC544\uC774\uB514\uAC12"],
35
+ createdAt: ["CreatedAt", "\uC0DD\uC131\uC77C"],
36
+ "desc-createdAt": ["Data created time", "\uB370\uC774\uD130 \uC0DD\uC131 \uC2DC\uAC01"],
37
+ updatedAt: ["UpdatedAt", "\uC218\uC815\uC77C"],
38
+ "desc-updatedAt": ["Data updated time", "\uB370\uC774\uD130 \uB9C8\uC9C0\uB9C9 \uC218\uC815 \uC2DC\uAC01"],
39
+ removedAt: ["RemovedAt", "\uC0AD\uC81C\uC77C"],
40
+ "desc-removedAt": ["Data removed time", "\uB370\uC774\uD130 \uC0AD\uC81C \uC2DC\uAC01"],
41
+ status: ["Status", "\uC0C1\uD0DC"],
42
+ "desc-status": ["Data status", "\uB370\uC774\uD130 \uC0C1\uD0DC"],
43
+ count: ["Count", "\uAC1C\uC218"],
44
+ "desc-count": ["Data count", "\uB370\uC774\uD130 \uAC1C\uC218"],
45
+ latest: ["latest", "\uCD5C\uC2E0\uC21C"],
46
+ "desc-latest": ["latest", "\uCD5C\uC2E0\uC21C"],
47
+ oldest: ["oldest", "\uC624\uB798\uB41C\uC21C"],
48
+ "desc-oldest": ["oldest", "\uC624\uB798\uB41C\uC21C"],
49
+ "qry-any": ["All", "\uC804\uCCB4"],
50
+ "qrydesc-any": ["All", "\uC804\uCCB4"],
51
+ "qry-byStatuses": ["By Statuses", "\uC0C1\uD0DC\uBCC4 \uC870\uD68C"],
52
+ "qrydesc-byStatuses": ["By Statuses", "\uC0C1\uD0DC\uBCC4 \uC870\uD68C"],
53
+ "qarg-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"],
54
+ "qargdesc-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"]
55
+ };
56
+ const getBaseSignalTrans = (modelName) => {
57
+ const className = (0, import_common.capitalize)(modelName);
58
+ return {
59
+ // * ==================== Endpoint ==================== * //
60
+ [`api-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
61
+ [`apidesc-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
62
+ [`arg-light${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
63
+ [`argdesc-light${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
64
+ [`api-${modelName}`]: [`Get ${modelName}`, `${modelName} \uC870\uD68C`],
65
+ [`apidesc-${modelName}`]: [`Get ${modelName}`, `${modelName} \uC870\uD68C`],
66
+ [`arg-${modelName}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
67
+ [`argdesc-${modelName}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
68
+ [`api-${modelName}List`]: [`Get ${modelName} list`, `${modelName} \uB9AC\uC2A4\uD2B8 \uC870\uD68C`],
69
+ [`apidesc-${modelName}List`]: [`Get ${modelName} list`, `${modelName} \uB9AC\uC2A4\uD2B8 \uC870\uD68C`],
70
+ [`arg-${modelName}List-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
71
+ [`argdesc-${modelName}List-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
72
+ [`arg-${modelName}List-skip`]: [`Skip of ${modelName}`, `${modelName} \uC2A4\uD0B5`],
73
+ [`argdesc-${modelName}List-skip`]: [`Skip of ${modelName}`, `${modelName} \uC2A4\uD0B5`],
74
+ [`arg-${modelName}List-limit`]: [`Limit of ${modelName}`, `${modelName} \uC81C\uD55C`],
75
+ [`argdesc-${modelName}List-limit`]: [`Limit of ${modelName}`, `${modelName} \uC81C\uD55C`],
76
+ [`arg-${modelName}List-sort`]: [`Sort of ${modelName}`, `${modelName} \uC815\uB82C`],
77
+ [`argdesc-${modelName}List-sort`]: [`Sort of ${modelName}`, `${modelName} \uC815\uB82C`],
78
+ [`api-${modelName}Insight`]: [`Get ${modelName} insight`, `${modelName} \uC778\uC0AC\uC774\uD2B8 \uC870\uD68C`],
79
+ [`apidesc-${modelName}Insight`]: [`Get ${modelName} insight`, `${modelName} \uC778\uC0AC\uC774\uD2B8 \uC870\uD68C`],
80
+ [`arg-${modelName}Insight-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
81
+ [`argdesc-${modelName}Insight-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
82
+ [`api-${modelName}Exists`]: [`Check ${modelName} exists`, `${modelName} \uC874\uC7AC \uC5EC\uBD80 \uD655\uC778`],
83
+ [`apidesc-${modelName}Exists`]: [`Check ${modelName} exists`, `${modelName} \uC874\uC7AC \uC5EC\uBD80 \uD655\uC778`],
84
+ [`arg-${modelName}Exists-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
85
+ [`argdesc-${modelName}Exists-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
86
+ [`api-create${className}`]: [`Create ${modelName}`, `${modelName} \uC0DD\uC131`],
87
+ [`apidesc-create${className}`]: [`Create ${modelName}`, `${modelName} \uC0DD\uC131`],
88
+ [`arg-create${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
89
+ [`argdesc-create${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
90
+ [`api-update${className}`]: [`Update ${modelName}`, `${modelName} \uC218\uC815`],
91
+ [`apidesc-update${className}`]: [`Update ${modelName}`, `${modelName} \uC218\uC815`],
92
+ [`arg-update${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
93
+ [`argdesc-update${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
94
+ [`arg-update${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
95
+ [`argdesc-update${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
96
+ [`api-remove${className}`]: [`Remove ${modelName}`, `${modelName} \uC0AD\uC81C`],
97
+ [`apidesc-remove${className}`]: [`Remove ${modelName}`, `${modelName} \uC0AD\uC81C`],
98
+ [`arg-remove${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
99
+ [`argdesc-remove${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`]
100
+ // * ==================== Endpoint ==================== * //
101
+ };
102
+ };
103
+ const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) => {
104
+ const enumKeyMap = /* @__PURE__ */ new Map();
105
+ modelRefs.forEach((modelRef) => {
106
+ const fieldMetaMap = (0, import_constant.getFieldMetaMap)(modelRef);
107
+ [...fieldMetaMap.values()].forEach((fieldMeta) => {
108
+ if (!fieldMeta.enum)
109
+ return;
110
+ enumKeyMap.set(fieldMeta.key, new Set(fieldMeta.enum.map((value) => value.toString())));
111
+ fieldMeta.enum.forEach((value) => {
112
+ const enumDict = dictionary[`enum-${fieldMeta.key}-${value}`];
113
+ const modelDict = rootDictionary[modelName];
114
+ const rootEnumDict = modelDict?.[`enum-${fieldMeta.key}-${value}`];
115
+ if (!enumDict && !rootEnumDict) {
116
+ import_common.Logger.warn(`\u2620\uFE0F Missing enum translation: ${modelName}.enum-${fieldMeta.key}-${value}`);
117
+ }
118
+ const enumDescDict = dictionary[`enumdesc-${fieldMeta.key}-${value}`];
119
+ const rootEnumDescDict = modelDict?.[`enumdesc-${fieldMeta.key}-${value}`];
120
+ if (!enumDescDict && !rootEnumDescDict) {
121
+ import_common.Logger.warn(`\u2620\uFE0F Missing enum description: ${modelName}.enumdesc-${fieldMeta.key}-${value}`);
122
+ }
123
+ });
124
+ });
125
+ });
126
+ Object.keys(dictionary).filter((key) => key.startsWith("enum-")).forEach((key) => {
127
+ const [, fieldKey, ...values] = key.split("-");
128
+ const value = values.join("-");
129
+ if (!enumKeyMap.get(fieldKey)?.has(value)) {
130
+ import_common.Logger.error(
131
+ `\u{1F47B} Unused enum translation, need to delete: ${modelName}.enum-${fieldKey}-${value} & ${modelName}.enumdesc-${fieldKey}-${value}`
132
+ );
133
+ }
134
+ });
135
+ const fieldKeySet = /* @__PURE__ */ new Set([
136
+ ...modelRefs.map((modelRef) => [...(0, import_constant.getFieldMetaMap)(modelRef).keys()]).flat(),
137
+ ...filterRefs.map((filterRef) => Object.keys((0, import_constant.getFilterSortMap)(filterRef))).flat()
138
+ ]);
139
+ Object.keys(dictionary).filter((key) => key.startsWith("desc-")).forEach((key) => {
140
+ const [, fieldKey] = key.split("-");
141
+ if (!fieldKeySet.has(fieldKey))
142
+ import_common.Logger.error(
143
+ `\u{1F47B} Unused description translation, need to delete: ${modelName}.${fieldKey} & ${modelName}.desc-${fieldKey}`
144
+ );
145
+ });
146
+ };
147
+ const checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
148
+ const argKeyMap = /* @__PURE__ */ new Map();
149
+ sigRefs.forEach((sigRef) => {
150
+ const gqlMetas = (0, import_signal.getGqlMetas)(sigRef);
151
+ gqlMetas.filter((gqlMeta) => gqlMeta.type !== "Process").forEach((gqlMeta) => {
152
+ const [argMetas] = (0, import_signal.getArgMetas)(sigRef, gqlMeta.key);
153
+ argKeyMap.set(gqlMeta.key, new Set(argMetas.map((argMeta) => argMeta.name)));
154
+ argMetas.forEach((argMeta) => {
155
+ const argDict = dictionary[`arg-${gqlMeta.key}-${argMeta.name}`];
156
+ if (!argDict) {
157
+ import_common.Logger.warn(`\u2620\uFE0F Missing arg translation: ${modelName}.arg-${gqlMeta.key}-${argMeta.name}`);
158
+ }
159
+ const argDescDict = dictionary[`argdesc-${gqlMeta.key}-${argMeta.name}`];
160
+ if (!argDescDict) {
161
+ import_common.Logger.warn(`\u2620\uFE0F Missing arg description: ${modelName}.argdesc-${gqlMeta.key}-${argMeta.name}`);
162
+ }
163
+ });
164
+ });
165
+ });
166
+ Object.keys(dictionary).filter((key) => key.startsWith("arg-")).forEach((key) => {
167
+ const [, gqlKey, argKey] = key.split("-");
168
+ if (!argKeyMap.get(gqlKey)?.has(argKey))
169
+ import_common.Logger.error(
170
+ `\u{1F47B} Unused arg translation, need to delete: ${modelName}.arg-${gqlKey}-${argKey} & ${modelName}.argdesc-${gqlKey}-${argKey}`
171
+ );
172
+ });
173
+ };
174
+ const checkFilterDictCoverages = (modelName, filterRefs, dictionary) => {
175
+ const qargKeyMap = /* @__PURE__ */ new Map();
176
+ filterRefs.forEach((filterRef) => {
177
+ const filterMetaMap = (0, import_constant.getFilterQueryMap)(filterRef);
178
+ filterMetaMap.forEach((filterMeta) => {
179
+ const filterArgMetas = (0, import_constant.getFilterArgMetas)(filterRef, filterMeta.key);
180
+ qargKeyMap.set(filterMeta.key, new Set(filterArgMetas.map((filterArgMeta) => filterArgMeta.name)));
181
+ filterArgMetas.forEach((filterArgMeta) => {
182
+ const qargDict = dictionary[`qarg-${filterMeta.key}-${filterArgMeta.name}`];
183
+ if (!qargDict)
184
+ import_common.Logger.warn(`\u2620\uFE0F Missing qarg translation: ${modelName}.qarg-${filterMeta.key}-${filterArgMeta.name}`);
185
+ const qargDescDict = dictionary[`qargdesc-${filterMeta.key}-${filterArgMeta.name}`];
186
+ if (!qargDescDict)
187
+ import_common.Logger.warn(`\u2620\uFE0F Missing qarg description: ${modelName}.qargdesc-${filterMeta.key}-${filterArgMeta.name}`);
188
+ });
189
+ });
190
+ });
191
+ Object.keys(dictionary).filter((key) => key.startsWith("qarg-")).forEach((key) => {
192
+ const [, filterKey, filterArgKey] = key.split("-");
193
+ if (!qargKeyMap.get(filterKey)?.has(filterArgKey))
194
+ import_common.Logger.error(
195
+ `\u{1F47B} Unused qarg translation, need to delete: ${modelName}.qarg-${filterKey}-${filterArgKey} & ${modelName}.qargdesc-${filterKey}-${filterArgKey}`
196
+ );
197
+ });
198
+ };
199
+ const checkDictCoverage = () => {
200
+ const fullModelRefEntries = (0, import_constant.getAllFullModelRefs)().filter((modelRef) => {
201
+ const classMeta = (0, import_constant.getClassMeta)(modelRef);
202
+ return classMeta.type === "full" && classMeta.modelType === "data";
203
+ }).map((modelRef) => {
204
+ const classMeta = (0, import_constant.getClassMeta)(modelRef);
205
+ const modelName = (0, import_common.lowerlize)(classMeta.refName);
206
+ return { modelName, modelRef };
207
+ });
208
+ const scalarModelRefs = (0, import_constant.getAllScalarModelRefs)();
209
+ const insightModelRefEntries = scalarModelRefs.filter((ref) => (0, import_constant.getClassMeta)(ref).modelType === "insight").map((modelRef) => {
210
+ const classMeta = (0, import_constant.getClassMeta)(modelRef);
211
+ if (!classMeta.refName.endsWith("Insight"))
212
+ throw new Error(`Invalid insight model name: ${classMeta.refName}`);
213
+ const modelName = (0, import_common.lowerlize)(classMeta.refName.slice(0, -7));
214
+ return { modelName, modelRef };
215
+ });
216
+ const pureScalarModelRefEntries = scalarModelRefs.filter((ref) => (0, import_constant.getClassMeta)(ref).modelType === "data").map((modelRef) => {
217
+ const classMeta = (0, import_constant.getClassMeta)(modelRef);
218
+ const modelName = (0, import_common.lowerlize)(classMeta.refName);
219
+ return { modelName, modelRef };
220
+ });
221
+ const filterModelRefEntries = (0, import_constant.getAllFilterModelRefs)().map((filterModelRef) => {
222
+ const filterMeta = (0, import_constant.getFilterMeta)(filterModelRef);
223
+ if (!filterMeta.refName.endsWith("Filter"))
224
+ throw new Error(`Invalid filter model name: ${filterMeta.refName}`);
225
+ const modelName = (0, import_common.lowerlize)(filterMeta.refName.slice(0, -6));
226
+ return { modelName, filterModelRef };
227
+ });
228
+ const signalRefs = (0, import_signal.getAllSignalRefs)();
229
+ const fullModelSignalRefEntries = signalRefs.filter((ref) => {
230
+ const sigMeta = (0, import_signal.getSigMeta)(ref);
231
+ if (!sigMeta.returns)
232
+ return false;
233
+ const modelRef = sigMeta.returns();
234
+ const classMeta = (0, import_constant.getClassMeta)(modelRef);
235
+ return classMeta.type === "full";
236
+ }).map((sigRef) => {
237
+ const sigMeta = (0, import_signal.getSigMeta)(sigRef);
238
+ const modelName = (0, import_common.lowerlize)(sigMeta.refName);
239
+ return { modelName, sigRef };
240
+ });
241
+ const scalarModelSignalRefEntries = signalRefs.filter((ref) => {
242
+ const sigMeta = (0, import_signal.getSigMeta)(ref);
243
+ if (!sigMeta.returns)
244
+ return false;
245
+ const modelRef = sigMeta.returns();
246
+ const classMeta = (0, import_constant.getClassMeta)(modelRef);
247
+ return classMeta.type === "scalar";
248
+ }).map((sigRef) => {
249
+ const sigMeta = (0, import_signal.getSigMeta)(sigRef);
250
+ const modelName = (0, import_common.lowerlize)(sigMeta.refName);
251
+ return { modelName, sigRef };
252
+ });
253
+ const pureSignalRefEntries = signalRefs.filter((ref) => !(0, import_signal.getSigMeta)(ref).returns).map((sigRef) => {
254
+ const sigMeta = (0, import_signal.getSigMeta)(sigRef);
255
+ const modelName = (0, import_common.lowerlize)(sigMeta.refName);
256
+ return { modelName, sigRef };
257
+ });
258
+ const modelDictExamMap = /* @__PURE__ */ new Map();
259
+ const scalarDictExamMap = /* @__PURE__ */ new Map();
260
+ const signalDictExamMap = /* @__PURE__ */ new Map();
261
+ const getDefaultModelDict = () => ({ modelRefs: [], insightRefs: [], sigRefs: [], filterRefs: [] });
262
+ fullModelRefEntries.forEach(({ modelName, modelRef }) => {
263
+ const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
264
+ modelDictExam.modelRefs.push(modelRef);
265
+ modelDictExamMap.set(modelName, modelDictExam);
266
+ });
267
+ insightModelRefEntries.forEach(({ modelName, modelRef }) => {
268
+ const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
269
+ modelDictExam.insightRefs.push(modelRef);
270
+ modelDictExamMap.set(modelName, modelDictExam);
271
+ });
272
+ fullModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
273
+ const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
274
+ modelDictExam.sigRefs.push(sigRef);
275
+ modelDictExamMap.set(modelName, modelDictExam);
276
+ });
277
+ filterModelRefEntries.forEach(({ modelName, filterModelRef }) => {
278
+ const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
279
+ modelDictExam.filterRefs.push(filterModelRef);
280
+ modelDictExamMap.set(modelName, modelDictExam);
281
+ });
282
+ const getDefaultScalarDict = () => ({ modelRefs: [], sigRefs: [] });
283
+ pureScalarModelRefEntries.forEach(({ modelName, modelRef }) => {
284
+ const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
285
+ scalarDictExam.modelRefs.push(modelRef);
286
+ scalarDictExamMap.set(modelName, scalarDictExam);
287
+ });
288
+ scalarModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
289
+ const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
290
+ scalarDictExam.sigRefs.push(sigRef);
291
+ scalarDictExamMap.set(modelName, scalarDictExam);
292
+ });
293
+ const getDefaultSignalDict = () => ({ sigRefs: [] });
294
+ pureSignalRefEntries.forEach(({ modelName, sigRef }) => {
295
+ const signalDictExam = signalDictExamMap.get(modelName) ?? getDefaultSignalDict();
296
+ signalDictExam.sigRefs.push(sigRef);
297
+ signalDictExamMap.set(modelName, signalDictExam);
298
+ });
299
+ modelDictExamMap.forEach(({ modelRefs, insightRefs, sigRefs, filterRefs }, modelName) => {
300
+ const dictionary = rootDictionary[modelName];
301
+ if (!dictionary)
302
+ return;
303
+ checkModelDictCoverages(modelName, dictionary, [...modelRefs, ...insightRefs], filterRefs);
304
+ checkSignalDictCoverages(modelName, sigRefs, dictionary);
305
+ checkFilterDictCoverages(modelName, filterRefs, dictionary);
306
+ });
307
+ scalarDictExamMap.forEach(({ modelRefs, sigRefs }, modelName) => {
308
+ const dictionary = rootDictionary[modelName];
309
+ if (!dictionary)
310
+ return;
311
+ checkModelDictCoverages(modelName, dictionary, modelRefs, []);
312
+ checkSignalDictCoverages(modelName, sigRefs, dictionary);
313
+ });
314
+ signalDictExamMap.forEach(({ sigRefs }, modelName) => {
315
+ const dictionary = rootDictionary[modelName];
316
+ if (!dictionary)
317
+ return;
318
+ checkSignalDictCoverages(modelName, sigRefs, dictionary);
319
+ });
320
+ };
321
+ const rootDictionary = {};
322
+ const makeDictionary = (rootDict, dict1, dict2, dict3, dict4, dict5) => {
323
+ const dicts = [dict1, dict2, dict3, dict4, dict5].filter((d) => !!d);
324
+ dicts.forEach((dict) => {
325
+ Object.entries(dict).forEach(([key, value]) => {
326
+ const rootValue = rootDict[key];
327
+ if (!rootValue)
328
+ Object.assign(rootDict, { [key]: value });
329
+ else
330
+ Object.assign(rootDict[key], value);
331
+ });
332
+ });
333
+ return rootDict;
334
+ };
335
+ const languages = ["ko", "en", "zhChs", "zhCht"];
336
+ const msg = {
337
+ info: () => null,
338
+ success: () => null,
339
+ error: () => null,
340
+ warning: () => null,
341
+ loading: () => null
342
+ };
343
+ const makeTrans = (locale) => {
344
+ const revert = (key, data) => {
345
+ throw new Error(key);
346
+ };
347
+ class Revert extends Error {
348
+ constructor(key, data) {
349
+ super(key);
350
+ }
351
+ }
352
+ const translate = (lang, key, data) => {
353
+ const langIdx = languages.indexOf(lang);
354
+ const [modelName, msgKey] = key.split(".");
355
+ const model = locale[modelName];
356
+ const message = model[msgKey][langIdx];
357
+ if (!message)
358
+ throw new Error("Invalid message");
359
+ return message;
360
+ };
361
+ return {
362
+ revert,
363
+ Revert,
364
+ translate,
365
+ msg
366
+ };
367
+ };