@akanjs/dictionary 0.0.97 → 0.0.98

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.cjs 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 dictionary_exports = {};
16
+ module.exports = __toCommonJS(dictionary_exports);
17
+ __reExport(dictionary_exports, require("./src"), module.exports);
package/index.js CHANGED
@@ -1,17 +1 @@
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 dictionary_exports = {};
16
- module.exports = __toCommonJS(dictionary_exports);
17
- __reExport(dictionary_exports, require("./src"), module.exports);
1
+ export * from "./src";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akanjs/dictionary",
3
- "version": "0.0.97",
4
- "type": "commonjs",
3
+ "version": "0.0.98",
4
+ "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -22,6 +22,6 @@
22
22
  }
23
23
  },
24
24
  "esbuild": {
25
- "platform": "browser"
25
+ "platform": "neutral"
26
26
  }
27
27
  }
package/src/index.cjs 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/index.js CHANGED
@@ -1,17 +1 @@
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);
1
+ export * from "./trans";
@@ -1,16 +1,34 @@
1
- import { capitalize, Logger, lowerlize } from "@akanjs/common";
2
- import {
3
- getAllFilterModelRefs,
4
- getAllFullModelRefs,
5
- getAllScalarModelRefs,
6
- getClassMeta,
7
- getFieldMetaMap,
8
- getFilterArgMetas,
9
- getFilterMeta,
10
- getFilterQueryMap,
11
- getFilterSortMap
12
- } from "@akanjs/constant";
13
- import { getAllSignalRefs, getArgMetas, getGqlMetas, getSigMeta } from "@akanjs/signal";
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");
14
32
  const baseTrans = {
15
33
  id: ["Id", "\uC544\uC774\uB514"],
16
34
  "desc-id": ["Unique ID value", "\uC720\uB2C8\uD06C\uD55C \uC544\uC774\uB514\uAC12"],
@@ -36,7 +54,7 @@ const baseTrans = {
36
54
  "qargdesc-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"]
37
55
  };
38
56
  const getBaseSignalTrans = (modelName) => {
39
- const className = capitalize(modelName);
57
+ const className = (0, import_common.capitalize)(modelName);
40
58
  return {
41
59
  // * ==================== Endpoint ==================== * //
42
60
  [`api-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
@@ -85,7 +103,7 @@ const getBaseSignalTrans = (modelName) => {
85
103
  const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) => {
86
104
  const enumKeyMap = /* @__PURE__ */ new Map();
87
105
  modelRefs.forEach((modelRef) => {
88
- const fieldMetaMap = getFieldMetaMap(modelRef);
106
+ const fieldMetaMap = (0, import_constant.getFieldMetaMap)(modelRef);
89
107
  [...fieldMetaMap.values()].forEach((fieldMeta) => {
90
108
  if (!fieldMeta.enum)
91
109
  return;
@@ -95,12 +113,12 @@ const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) =
95
113
  const modelDict = rootDictionary[modelName];
96
114
  const rootEnumDict = modelDict?.[`enum-${fieldMeta.key}-${value}`];
97
115
  if (!enumDict && !rootEnumDict) {
98
- Logger.warn(`\u2620\uFE0F Missing enum translation: ${modelName}.enum-${fieldMeta.key}-${value}`);
116
+ import_common.Logger.warn(`\u2620\uFE0F Missing enum translation: ${modelName}.enum-${fieldMeta.key}-${value}`);
99
117
  }
100
118
  const enumDescDict = dictionary[`enumdesc-${fieldMeta.key}-${value}`];
101
119
  const rootEnumDescDict = modelDict?.[`enumdesc-${fieldMeta.key}-${value}`];
102
120
  if (!enumDescDict && !rootEnumDescDict) {
103
- Logger.warn(`\u2620\uFE0F Missing enum description: ${modelName}.enumdesc-${fieldMeta.key}-${value}`);
121
+ import_common.Logger.warn(`\u2620\uFE0F Missing enum description: ${modelName}.enumdesc-${fieldMeta.key}-${value}`);
104
122
  }
105
123
  });
106
124
  });
@@ -109,19 +127,19 @@ const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) =
109
127
  const [, fieldKey, ...values] = key.split("-");
110
128
  const value = values.join("-");
111
129
  if (!enumKeyMap.get(fieldKey)?.has(value)) {
112
- Logger.error(
130
+ import_common.Logger.error(
113
131
  `\u{1F47B} Unused enum translation, need to delete: ${modelName}.enum-${fieldKey}-${value} & ${modelName}.enumdesc-${fieldKey}-${value}`
114
132
  );
115
133
  }
116
134
  });
117
135
  const fieldKeySet = /* @__PURE__ */ new Set([
118
- ...modelRefs.map((modelRef) => [...getFieldMetaMap(modelRef).keys()]).flat(),
119
- ...filterRefs.map((filterRef) => Object.keys(getFilterSortMap(filterRef))).flat()
136
+ ...modelRefs.map((modelRef) => [...(0, import_constant.getFieldMetaMap)(modelRef).keys()]).flat(),
137
+ ...filterRefs.map((filterRef) => Object.keys((0, import_constant.getFilterSortMap)(filterRef))).flat()
120
138
  ]);
121
139
  Object.keys(dictionary).filter((key) => key.startsWith("desc-")).forEach((key) => {
122
140
  const [, fieldKey] = key.split("-");
123
141
  if (!fieldKeySet.has(fieldKey))
124
- Logger.error(
142
+ import_common.Logger.error(
125
143
  `\u{1F47B} Unused description translation, need to delete: ${modelName}.${fieldKey} & ${modelName}.desc-${fieldKey}`
126
144
  );
127
145
  });
@@ -129,18 +147,18 @@ const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) =
129
147
  const checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
130
148
  const argKeyMap = /* @__PURE__ */ new Map();
131
149
  sigRefs.forEach((sigRef) => {
132
- const gqlMetas = getGqlMetas(sigRef);
150
+ const gqlMetas = (0, import_signal.getGqlMetas)(sigRef);
133
151
  gqlMetas.filter((gqlMeta) => gqlMeta.type !== "Process").forEach((gqlMeta) => {
134
- const [argMetas] = getArgMetas(sigRef, gqlMeta.key);
152
+ const [argMetas] = (0, import_signal.getArgMetas)(sigRef, gqlMeta.key);
135
153
  argKeyMap.set(gqlMeta.key, new Set(argMetas.map((argMeta) => argMeta.name)));
136
154
  argMetas.forEach((argMeta) => {
137
155
  const argDict = dictionary[`arg-${gqlMeta.key}-${argMeta.name}`];
138
156
  if (!argDict) {
139
- Logger.warn(`\u2620\uFE0F Missing arg translation: ${modelName}.arg-${gqlMeta.key}-${argMeta.name}`);
157
+ import_common.Logger.warn(`\u2620\uFE0F Missing arg translation: ${modelName}.arg-${gqlMeta.key}-${argMeta.name}`);
140
158
  }
141
159
  const argDescDict = dictionary[`argdesc-${gqlMeta.key}-${argMeta.name}`];
142
160
  if (!argDescDict) {
143
- Logger.warn(`\u2620\uFE0F Missing arg description: ${modelName}.argdesc-${gqlMeta.key}-${argMeta.name}`);
161
+ import_common.Logger.warn(`\u2620\uFE0F Missing arg description: ${modelName}.argdesc-${gqlMeta.key}-${argMeta.name}`);
144
162
  }
145
163
  });
146
164
  });
@@ -148,7 +166,7 @@ const checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
148
166
  Object.keys(dictionary).filter((key) => key.startsWith("arg-")).forEach((key) => {
149
167
  const [, gqlKey, argKey] = key.split("-");
150
168
  if (!argKeyMap.get(gqlKey)?.has(argKey))
151
- Logger.error(
169
+ import_common.Logger.error(
152
170
  `\u{1F47B} Unused arg translation, need to delete: ${modelName}.arg-${gqlKey}-${argKey} & ${modelName}.argdesc-${gqlKey}-${argKey}`
153
171
  );
154
172
  });
@@ -156,85 +174,85 @@ const checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
156
174
  const checkFilterDictCoverages = (modelName, filterRefs, dictionary) => {
157
175
  const qargKeyMap = /* @__PURE__ */ new Map();
158
176
  filterRefs.forEach((filterRef) => {
159
- const filterMetaMap = getFilterQueryMap(filterRef);
177
+ const filterMetaMap = (0, import_constant.getFilterQueryMap)(filterRef);
160
178
  filterMetaMap.forEach((filterMeta) => {
161
- const filterArgMetas = getFilterArgMetas(filterRef, filterMeta.key);
179
+ const filterArgMetas = (0, import_constant.getFilterArgMetas)(filterRef, filterMeta.key);
162
180
  qargKeyMap.set(filterMeta.key, new Set(filterArgMetas.map((filterArgMeta) => filterArgMeta.name)));
163
181
  filterArgMetas.forEach((filterArgMeta) => {
164
182
  const qargDict = dictionary[`qarg-${filterMeta.key}-${filterArgMeta.name}`];
165
183
  if (!qargDict)
166
- Logger.warn(`\u2620\uFE0F Missing qarg translation: ${modelName}.qarg-${filterMeta.key}-${filterArgMeta.name}`);
184
+ import_common.Logger.warn(`\u2620\uFE0F Missing qarg translation: ${modelName}.qarg-${filterMeta.key}-${filterArgMeta.name}`);
167
185
  const qargDescDict = dictionary[`qargdesc-${filterMeta.key}-${filterArgMeta.name}`];
168
186
  if (!qargDescDict)
169
- Logger.warn(`\u2620\uFE0F Missing qarg description: ${modelName}.qargdesc-${filterMeta.key}-${filterArgMeta.name}`);
187
+ import_common.Logger.warn(`\u2620\uFE0F Missing qarg description: ${modelName}.qargdesc-${filterMeta.key}-${filterArgMeta.name}`);
170
188
  });
171
189
  });
172
190
  });
173
191
  Object.keys(dictionary).filter((key) => key.startsWith("qarg-")).forEach((key) => {
174
192
  const [, filterKey, filterArgKey] = key.split("-");
175
193
  if (!qargKeyMap.get(filterKey)?.has(filterArgKey))
176
- Logger.error(
194
+ import_common.Logger.error(
177
195
  `\u{1F47B} Unused qarg translation, need to delete: ${modelName}.qarg-${filterKey}-${filterArgKey} & ${modelName}.qargdesc-${filterKey}-${filterArgKey}`
178
196
  );
179
197
  });
180
198
  };
181
199
  const checkDictCoverage = () => {
182
- const fullModelRefEntries = getAllFullModelRefs().filter((modelRef) => {
183
- const classMeta = getClassMeta(modelRef);
200
+ const fullModelRefEntries = (0, import_constant.getAllFullModelRefs)().filter((modelRef) => {
201
+ const classMeta = (0, import_constant.getClassMeta)(modelRef);
184
202
  return classMeta.type === "full" && classMeta.modelType === "data";
185
203
  }).map((modelRef) => {
186
- const classMeta = getClassMeta(modelRef);
187
- const modelName = lowerlize(classMeta.refName);
204
+ const classMeta = (0, import_constant.getClassMeta)(modelRef);
205
+ const modelName = (0, import_common.lowerlize)(classMeta.refName);
188
206
  return { modelName, modelRef };
189
207
  });
190
- const scalarModelRefs = getAllScalarModelRefs();
191
- const insightModelRefEntries = scalarModelRefs.filter((ref) => getClassMeta(ref).modelType === "insight").map((modelRef) => {
192
- const classMeta = getClassMeta(modelRef);
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);
193
211
  if (!classMeta.refName.endsWith("Insight"))
194
212
  throw new Error(`Invalid insight model name: ${classMeta.refName}`);
195
- const modelName = lowerlize(classMeta.refName.slice(0, -7));
213
+ const modelName = (0, import_common.lowerlize)(classMeta.refName.slice(0, -7));
196
214
  return { modelName, modelRef };
197
215
  });
198
- const pureScalarModelRefEntries = scalarModelRefs.filter((ref) => getClassMeta(ref).modelType === "data").map((modelRef) => {
199
- const classMeta = getClassMeta(modelRef);
200
- const modelName = lowerlize(classMeta.refName);
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);
201
219
  return { modelName, modelRef };
202
220
  });
203
- const filterModelRefEntries = getAllFilterModelRefs().map((filterModelRef) => {
204
- const filterMeta = getFilterMeta(filterModelRef);
221
+ const filterModelRefEntries = (0, import_constant.getAllFilterModelRefs)().map((filterModelRef) => {
222
+ const filterMeta = (0, import_constant.getFilterMeta)(filterModelRef);
205
223
  if (!filterMeta.refName.endsWith("Filter"))
206
224
  throw new Error(`Invalid filter model name: ${filterMeta.refName}`);
207
- const modelName = lowerlize(filterMeta.refName.slice(0, -6));
225
+ const modelName = (0, import_common.lowerlize)(filterMeta.refName.slice(0, -6));
208
226
  return { modelName, filterModelRef };
209
227
  });
210
- const signalRefs = getAllSignalRefs();
228
+ const signalRefs = (0, import_signal.getAllSignalRefs)();
211
229
  const fullModelSignalRefEntries = signalRefs.filter((ref) => {
212
- const sigMeta = getSigMeta(ref);
230
+ const sigMeta = (0, import_signal.getSigMeta)(ref);
213
231
  if (!sigMeta.returns)
214
232
  return false;
215
233
  const modelRef = sigMeta.returns();
216
- const classMeta = getClassMeta(modelRef);
234
+ const classMeta = (0, import_constant.getClassMeta)(modelRef);
217
235
  return classMeta.type === "full";
218
236
  }).map((sigRef) => {
219
- const sigMeta = getSigMeta(sigRef);
220
- const modelName = lowerlize(sigMeta.refName);
237
+ const sigMeta = (0, import_signal.getSigMeta)(sigRef);
238
+ const modelName = (0, import_common.lowerlize)(sigMeta.refName);
221
239
  return { modelName, sigRef };
222
240
  });
223
241
  const scalarModelSignalRefEntries = signalRefs.filter((ref) => {
224
- const sigMeta = getSigMeta(ref);
242
+ const sigMeta = (0, import_signal.getSigMeta)(ref);
225
243
  if (!sigMeta.returns)
226
244
  return false;
227
245
  const modelRef = sigMeta.returns();
228
- const classMeta = getClassMeta(modelRef);
246
+ const classMeta = (0, import_constant.getClassMeta)(modelRef);
229
247
  return classMeta.type === "scalar";
230
248
  }).map((sigRef) => {
231
- const sigMeta = getSigMeta(sigRef);
232
- const modelName = lowerlize(sigMeta.refName);
249
+ const sigMeta = (0, import_signal.getSigMeta)(sigRef);
250
+ const modelName = (0, import_common.lowerlize)(sigMeta.refName);
233
251
  return { modelName, sigRef };
234
252
  });
235
- const pureSignalRefEntries = signalRefs.filter((ref) => !getSigMeta(ref).returns).map((sigRef) => {
236
- const sigMeta = getSigMeta(sigRef);
237
- const modelName = lowerlize(sigMeta.refName);
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);
238
256
  return { modelName, sigRef };
239
257
  });
240
258
  const modelDictExamMap = /* @__PURE__ */ new Map();
@@ -347,12 +365,3 @@ const makeTrans = (locale) => {
347
365
  msg
348
366
  };
349
367
  };
350
- export {
351
- baseTrans,
352
- checkDictCoverage,
353
- getBaseSignalTrans,
354
- makeDictionary,
355
- makeTrans,
356
- msg,
357
- rootDictionary
358
- };
package/src/trans.js CHANGED
@@ -1,34 +1,16 @@
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");
1
+ import { capitalize, Logger, lowerlize } from "@akanjs/common";
2
+ import {
3
+ getAllFilterModelRefs,
4
+ getAllFullModelRefs,
5
+ getAllScalarModelRefs,
6
+ getClassMeta,
7
+ getFieldMetaMap,
8
+ getFilterArgMetas,
9
+ getFilterMeta,
10
+ getFilterQueryMap,
11
+ getFilterSortMap
12
+ } from "@akanjs/constant";
13
+ import { getAllSignalRefs, getArgMetas, getGqlMetas, getSigMeta } from "@akanjs/signal";
32
14
  const baseTrans = {
33
15
  id: ["Id", "\uC544\uC774\uB514"],
34
16
  "desc-id": ["Unique ID value", "\uC720\uB2C8\uD06C\uD55C \uC544\uC774\uB514\uAC12"],
@@ -54,7 +36,7 @@ const baseTrans = {
54
36
  "qargdesc-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"]
55
37
  };
56
38
  const getBaseSignalTrans = (modelName) => {
57
- const className = (0, import_common.capitalize)(modelName);
39
+ const className = capitalize(modelName);
58
40
  return {
59
41
  // * ==================== Endpoint ==================== * //
60
42
  [`api-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
@@ -103,7 +85,7 @@ const getBaseSignalTrans = (modelName) => {
103
85
  const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) => {
104
86
  const enumKeyMap = /* @__PURE__ */ new Map();
105
87
  modelRefs.forEach((modelRef) => {
106
- const fieldMetaMap = (0, import_constant.getFieldMetaMap)(modelRef);
88
+ const fieldMetaMap = getFieldMetaMap(modelRef);
107
89
  [...fieldMetaMap.values()].forEach((fieldMeta) => {
108
90
  if (!fieldMeta.enum)
109
91
  return;
@@ -113,12 +95,12 @@ const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) =
113
95
  const modelDict = rootDictionary[modelName];
114
96
  const rootEnumDict = modelDict?.[`enum-${fieldMeta.key}-${value}`];
115
97
  if (!enumDict && !rootEnumDict) {
116
- import_common.Logger.warn(`\u2620\uFE0F Missing enum translation: ${modelName}.enum-${fieldMeta.key}-${value}`);
98
+ Logger.warn(`\u2620\uFE0F Missing enum translation: ${modelName}.enum-${fieldMeta.key}-${value}`);
117
99
  }
118
100
  const enumDescDict = dictionary[`enumdesc-${fieldMeta.key}-${value}`];
119
101
  const rootEnumDescDict = modelDict?.[`enumdesc-${fieldMeta.key}-${value}`];
120
102
  if (!enumDescDict && !rootEnumDescDict) {
121
- import_common.Logger.warn(`\u2620\uFE0F Missing enum description: ${modelName}.enumdesc-${fieldMeta.key}-${value}`);
103
+ Logger.warn(`\u2620\uFE0F Missing enum description: ${modelName}.enumdesc-${fieldMeta.key}-${value}`);
122
104
  }
123
105
  });
124
106
  });
@@ -127,19 +109,19 @@ const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) =
127
109
  const [, fieldKey, ...values] = key.split("-");
128
110
  const value = values.join("-");
129
111
  if (!enumKeyMap.get(fieldKey)?.has(value)) {
130
- import_common.Logger.error(
112
+ Logger.error(
131
113
  `\u{1F47B} Unused enum translation, need to delete: ${modelName}.enum-${fieldKey}-${value} & ${modelName}.enumdesc-${fieldKey}-${value}`
132
114
  );
133
115
  }
134
116
  });
135
117
  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()
118
+ ...modelRefs.map((modelRef) => [...getFieldMetaMap(modelRef).keys()]).flat(),
119
+ ...filterRefs.map((filterRef) => Object.keys(getFilterSortMap(filterRef))).flat()
138
120
  ]);
139
121
  Object.keys(dictionary).filter((key) => key.startsWith("desc-")).forEach((key) => {
140
122
  const [, fieldKey] = key.split("-");
141
123
  if (!fieldKeySet.has(fieldKey))
142
- import_common.Logger.error(
124
+ Logger.error(
143
125
  `\u{1F47B} Unused description translation, need to delete: ${modelName}.${fieldKey} & ${modelName}.desc-${fieldKey}`
144
126
  );
145
127
  });
@@ -147,18 +129,18 @@ const checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) =
147
129
  const checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
148
130
  const argKeyMap = /* @__PURE__ */ new Map();
149
131
  sigRefs.forEach((sigRef) => {
150
- const gqlMetas = (0, import_signal.getGqlMetas)(sigRef);
132
+ const gqlMetas = getGqlMetas(sigRef);
151
133
  gqlMetas.filter((gqlMeta) => gqlMeta.type !== "Process").forEach((gqlMeta) => {
152
- const [argMetas] = (0, import_signal.getArgMetas)(sigRef, gqlMeta.key);
134
+ const [argMetas] = getArgMetas(sigRef, gqlMeta.key);
153
135
  argKeyMap.set(gqlMeta.key, new Set(argMetas.map((argMeta) => argMeta.name)));
154
136
  argMetas.forEach((argMeta) => {
155
137
  const argDict = dictionary[`arg-${gqlMeta.key}-${argMeta.name}`];
156
138
  if (!argDict) {
157
- import_common.Logger.warn(`\u2620\uFE0F Missing arg translation: ${modelName}.arg-${gqlMeta.key}-${argMeta.name}`);
139
+ Logger.warn(`\u2620\uFE0F Missing arg translation: ${modelName}.arg-${gqlMeta.key}-${argMeta.name}`);
158
140
  }
159
141
  const argDescDict = dictionary[`argdesc-${gqlMeta.key}-${argMeta.name}`];
160
142
  if (!argDescDict) {
161
- import_common.Logger.warn(`\u2620\uFE0F Missing arg description: ${modelName}.argdesc-${gqlMeta.key}-${argMeta.name}`);
143
+ Logger.warn(`\u2620\uFE0F Missing arg description: ${modelName}.argdesc-${gqlMeta.key}-${argMeta.name}`);
162
144
  }
163
145
  });
164
146
  });
@@ -166,7 +148,7 @@ const checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
166
148
  Object.keys(dictionary).filter((key) => key.startsWith("arg-")).forEach((key) => {
167
149
  const [, gqlKey, argKey] = key.split("-");
168
150
  if (!argKeyMap.get(gqlKey)?.has(argKey))
169
- import_common.Logger.error(
151
+ Logger.error(
170
152
  `\u{1F47B} Unused arg translation, need to delete: ${modelName}.arg-${gqlKey}-${argKey} & ${modelName}.argdesc-${gqlKey}-${argKey}`
171
153
  );
172
154
  });
@@ -174,85 +156,85 @@ const checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
174
156
  const checkFilterDictCoverages = (modelName, filterRefs, dictionary) => {
175
157
  const qargKeyMap = /* @__PURE__ */ new Map();
176
158
  filterRefs.forEach((filterRef) => {
177
- const filterMetaMap = (0, import_constant.getFilterQueryMap)(filterRef);
159
+ const filterMetaMap = getFilterQueryMap(filterRef);
178
160
  filterMetaMap.forEach((filterMeta) => {
179
- const filterArgMetas = (0, import_constant.getFilterArgMetas)(filterRef, filterMeta.key);
161
+ const filterArgMetas = getFilterArgMetas(filterRef, filterMeta.key);
180
162
  qargKeyMap.set(filterMeta.key, new Set(filterArgMetas.map((filterArgMeta) => filterArgMeta.name)));
181
163
  filterArgMetas.forEach((filterArgMeta) => {
182
164
  const qargDict = dictionary[`qarg-${filterMeta.key}-${filterArgMeta.name}`];
183
165
  if (!qargDict)
184
- import_common.Logger.warn(`\u2620\uFE0F Missing qarg translation: ${modelName}.qarg-${filterMeta.key}-${filterArgMeta.name}`);
166
+ Logger.warn(`\u2620\uFE0F Missing qarg translation: ${modelName}.qarg-${filterMeta.key}-${filterArgMeta.name}`);
185
167
  const qargDescDict = dictionary[`qargdesc-${filterMeta.key}-${filterArgMeta.name}`];
186
168
  if (!qargDescDict)
187
- import_common.Logger.warn(`\u2620\uFE0F Missing qarg description: ${modelName}.qargdesc-${filterMeta.key}-${filterArgMeta.name}`);
169
+ Logger.warn(`\u2620\uFE0F Missing qarg description: ${modelName}.qargdesc-${filterMeta.key}-${filterArgMeta.name}`);
188
170
  });
189
171
  });
190
172
  });
191
173
  Object.keys(dictionary).filter((key) => key.startsWith("qarg-")).forEach((key) => {
192
174
  const [, filterKey, filterArgKey] = key.split("-");
193
175
  if (!qargKeyMap.get(filterKey)?.has(filterArgKey))
194
- import_common.Logger.error(
176
+ Logger.error(
195
177
  `\u{1F47B} Unused qarg translation, need to delete: ${modelName}.qarg-${filterKey}-${filterArgKey} & ${modelName}.qargdesc-${filterKey}-${filterArgKey}`
196
178
  );
197
179
  });
198
180
  };
199
181
  const checkDictCoverage = () => {
200
- const fullModelRefEntries = (0, import_constant.getAllFullModelRefs)().filter((modelRef) => {
201
- const classMeta = (0, import_constant.getClassMeta)(modelRef);
182
+ const fullModelRefEntries = getAllFullModelRefs().filter((modelRef) => {
183
+ const classMeta = getClassMeta(modelRef);
202
184
  return classMeta.type === "full" && classMeta.modelType === "data";
203
185
  }).map((modelRef) => {
204
- const classMeta = (0, import_constant.getClassMeta)(modelRef);
205
- const modelName = (0, import_common.lowerlize)(classMeta.refName);
186
+ const classMeta = getClassMeta(modelRef);
187
+ const modelName = lowerlize(classMeta.refName);
206
188
  return { modelName, modelRef };
207
189
  });
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);
190
+ const scalarModelRefs = getAllScalarModelRefs();
191
+ const insightModelRefEntries = scalarModelRefs.filter((ref) => getClassMeta(ref).modelType === "insight").map((modelRef) => {
192
+ const classMeta = getClassMeta(modelRef);
211
193
  if (!classMeta.refName.endsWith("Insight"))
212
194
  throw new Error(`Invalid insight model name: ${classMeta.refName}`);
213
- const modelName = (0, import_common.lowerlize)(classMeta.refName.slice(0, -7));
195
+ const modelName = lowerlize(classMeta.refName.slice(0, -7));
214
196
  return { modelName, modelRef };
215
197
  });
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);
198
+ const pureScalarModelRefEntries = scalarModelRefs.filter((ref) => getClassMeta(ref).modelType === "data").map((modelRef) => {
199
+ const classMeta = getClassMeta(modelRef);
200
+ const modelName = lowerlize(classMeta.refName);
219
201
  return { modelName, modelRef };
220
202
  });
221
- const filterModelRefEntries = (0, import_constant.getAllFilterModelRefs)().map((filterModelRef) => {
222
- const filterMeta = (0, import_constant.getFilterMeta)(filterModelRef);
203
+ const filterModelRefEntries = getAllFilterModelRefs().map((filterModelRef) => {
204
+ const filterMeta = getFilterMeta(filterModelRef);
223
205
  if (!filterMeta.refName.endsWith("Filter"))
224
206
  throw new Error(`Invalid filter model name: ${filterMeta.refName}`);
225
- const modelName = (0, import_common.lowerlize)(filterMeta.refName.slice(0, -6));
207
+ const modelName = lowerlize(filterMeta.refName.slice(0, -6));
226
208
  return { modelName, filterModelRef };
227
209
  });
228
- const signalRefs = (0, import_signal.getAllSignalRefs)();
210
+ const signalRefs = getAllSignalRefs();
229
211
  const fullModelSignalRefEntries = signalRefs.filter((ref) => {
230
- const sigMeta = (0, import_signal.getSigMeta)(ref);
212
+ const sigMeta = getSigMeta(ref);
231
213
  if (!sigMeta.returns)
232
214
  return false;
233
215
  const modelRef = sigMeta.returns();
234
- const classMeta = (0, import_constant.getClassMeta)(modelRef);
216
+ const classMeta = getClassMeta(modelRef);
235
217
  return classMeta.type === "full";
236
218
  }).map((sigRef) => {
237
- const sigMeta = (0, import_signal.getSigMeta)(sigRef);
238
- const modelName = (0, import_common.lowerlize)(sigMeta.refName);
219
+ const sigMeta = getSigMeta(sigRef);
220
+ const modelName = lowerlize(sigMeta.refName);
239
221
  return { modelName, sigRef };
240
222
  });
241
223
  const scalarModelSignalRefEntries = signalRefs.filter((ref) => {
242
- const sigMeta = (0, import_signal.getSigMeta)(ref);
224
+ const sigMeta = getSigMeta(ref);
243
225
  if (!sigMeta.returns)
244
226
  return false;
245
227
  const modelRef = sigMeta.returns();
246
- const classMeta = (0, import_constant.getClassMeta)(modelRef);
228
+ const classMeta = getClassMeta(modelRef);
247
229
  return classMeta.type === "scalar";
248
230
  }).map((sigRef) => {
249
- const sigMeta = (0, import_signal.getSigMeta)(sigRef);
250
- const modelName = (0, import_common.lowerlize)(sigMeta.refName);
231
+ const sigMeta = getSigMeta(sigRef);
232
+ const modelName = lowerlize(sigMeta.refName);
251
233
  return { modelName, sigRef };
252
234
  });
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);
235
+ const pureSignalRefEntries = signalRefs.filter((ref) => !getSigMeta(ref).returns).map((sigRef) => {
236
+ const sigMeta = getSigMeta(sigRef);
237
+ const modelName = lowerlize(sigMeta.refName);
256
238
  return { modelName, sigRef };
257
239
  });
258
240
  const modelDictExamMap = /* @__PURE__ */ new Map();
@@ -365,3 +347,12 @@ const makeTrans = (locale) => {
365
347
  msg
366
348
  };
367
349
  };
350
+ export {
351
+ baseTrans,
352
+ checkDictCoverage,
353
+ getBaseSignalTrans,
354
+ makeDictionary,
355
+ makeTrans,
356
+ msg,
357
+ rootDictionary
358
+ };
package/index.mjs DELETED
@@ -1 +0,0 @@
1
- export * from "./src";
package/src/index.mjs DELETED
@@ -1 +0,0 @@
1
- export * from "./trans";