@akanjs/dictionary 0.9.56 → 0.9.57
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/cjs/src/base.dictionary.js +28 -45
- package/cjs/src/dictInfo.js +484 -0
- package/cjs/src/dictionary.js +5 -4
- package/cjs/src/index.js +4 -0
- package/cjs/src/locale.js +33 -0
- package/cjs/src/serverTranslator.js +1 -4
- package/cjs/src/trans.js +23 -103
- package/esm/src/base.dictionary.js +28 -45
- package/esm/src/dictInfo.js +465 -0
- package/esm/src/dictionary.js +5 -4
- package/esm/src/index.js +13 -1
- package/esm/src/locale.js +14 -0
- package/esm/src/serverTranslator.js +2 -5
- package/esm/src/trans.js +24 -104
- package/package.json +1 -1
- package/src/base.dictionary.d.ts +1 -93
- package/src/dictInfo.d.ts +204 -0
- package/src/dictionary.d.ts +12 -111
- package/src/index.d.ts +3 -1
- package/src/locale.d.ts +107 -0
- package/src/serverTranslator.d.ts +1 -1
- package/src/trans.d.ts +20 -82
package/esm/src/trans.js
CHANGED
|
@@ -1,87 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const baseTrans = {
|
|
3
|
-
id: ["Id", "\uC544\uC774\uB514"],
|
|
4
|
-
"desc-id": ["Unique ID value", "\uC720\uB2C8\uD06C\uD55C \uC544\uC774\uB514\uAC12"],
|
|
5
|
-
createdAt: ["CreatedAt", "\uC0DD\uC131\uC77C"],
|
|
6
|
-
"desc-createdAt": ["Data created time", "\uB370\uC774\uD130 \uC0DD\uC131 \uC2DC\uAC01"],
|
|
7
|
-
updatedAt: ["UpdatedAt", "\uC218\uC815\uC77C"],
|
|
8
|
-
"desc-updatedAt": ["Data updated time", "\uB370\uC774\uD130 \uB9C8\uC9C0\uB9C9 \uC218\uC815 \uC2DC\uAC01"],
|
|
9
|
-
removedAt: ["RemovedAt", "\uC0AD\uC81C\uC77C"],
|
|
10
|
-
"desc-removedAt": ["Data removed time", "\uB370\uC774\uD130 \uC0AD\uC81C \uC2DC\uAC01"],
|
|
11
|
-
status: ["Status", "\uC0C1\uD0DC"],
|
|
12
|
-
"desc-status": ["Data status", "\uB370\uC774\uD130 \uC0C1\uD0DC"],
|
|
13
|
-
count: ["Count", "\uAC1C\uC218"],
|
|
14
|
-
"desc-count": ["Data count", "\uB370\uC774\uD130 \uAC1C\uC218"],
|
|
15
|
-
latest: ["latest", "\uCD5C\uC2E0\uC21C"],
|
|
16
|
-
"desc-latest": ["latest", "\uCD5C\uC2E0\uC21C"],
|
|
17
|
-
oldest: ["oldest", "\uC624\uB798\uB41C\uC21C"],
|
|
18
|
-
"desc-oldest": ["oldest", "\uC624\uB798\uB41C\uC21C"],
|
|
19
|
-
"qry-any": ["All", "\uC804\uCCB4"],
|
|
20
|
-
"qrydesc-any": ["All", "\uC804\uCCB4"],
|
|
21
|
-
"qry-byStatuses": ["By Statuses", "\uC0C1\uD0DC\uBCC4 \uC870\uD68C"],
|
|
22
|
-
"qrydesc-byStatuses": ["By Statuses", "\uC0C1\uD0DC\uBCC4 \uC870\uD68C"],
|
|
23
|
-
"qarg-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"],
|
|
24
|
-
"qargdesc-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"]
|
|
25
|
-
};
|
|
26
|
-
const getBaseSignalTrans = (modelName) => {
|
|
27
|
-
const className = capitalize(modelName);
|
|
28
|
-
return {
|
|
29
|
-
// * ==================== Endpoint ==================== * //
|
|
30
|
-
[`api-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
|
|
31
|
-
[`apidesc-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
|
|
32
|
-
[`arg-light${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
|
|
33
|
-
[`argdesc-light${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
|
|
34
|
-
[`api-${modelName}`]: [`Get ${modelName}`, `${modelName} \uC870\uD68C`],
|
|
35
|
-
[`apidesc-${modelName}`]: [`Get ${modelName}`, `${modelName} \uC870\uD68C`],
|
|
36
|
-
[`arg-${modelName}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
|
|
37
|
-
[`argdesc-${modelName}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
|
|
38
|
-
[`api-${modelName}List`]: [`Get ${modelName} list`, `${modelName} \uB9AC\uC2A4\uD2B8 \uC870\uD68C`],
|
|
39
|
-
[`apidesc-${modelName}List`]: [`Get ${modelName} list`, `${modelName} \uB9AC\uC2A4\uD2B8 \uC870\uD68C`],
|
|
40
|
-
[`arg-${modelName}List-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
|
|
41
|
-
[`argdesc-${modelName}List-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
|
|
42
|
-
[`arg-${modelName}List-skip`]: [`Skip of ${modelName}`, `${modelName} \uC2A4\uD0B5`],
|
|
43
|
-
[`argdesc-${modelName}List-skip`]: [`Skip of ${modelName}`, `${modelName} \uC2A4\uD0B5`],
|
|
44
|
-
[`arg-${modelName}List-limit`]: [`Limit of ${modelName}`, `${modelName} \uC81C\uD55C`],
|
|
45
|
-
[`argdesc-${modelName}List-limit`]: [`Limit of ${modelName}`, `${modelName} \uC81C\uD55C`],
|
|
46
|
-
[`arg-${modelName}List-sort`]: [`Sort of ${modelName}`, `${modelName} \uC815\uB82C`],
|
|
47
|
-
[`argdesc-${modelName}List-sort`]: [`Sort of ${modelName}`, `${modelName} \uC815\uB82C`],
|
|
48
|
-
[`api-${modelName}Insight`]: [`Get ${modelName} insight`, `${modelName} \uC778\uC0AC\uC774\uD2B8 \uC870\uD68C`],
|
|
49
|
-
[`apidesc-${modelName}Insight`]: [`Get ${modelName} insight`, `${modelName} \uC778\uC0AC\uC774\uD2B8 \uC870\uD68C`],
|
|
50
|
-
[`arg-${modelName}Insight-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
|
|
51
|
-
[`argdesc-${modelName}Insight-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
|
|
52
|
-
[`api-${modelName}Exists`]: [`Check ${modelName} exists`, `${modelName} \uC874\uC7AC \uC5EC\uBD80 \uD655\uC778`],
|
|
53
|
-
[`apidesc-${modelName}Exists`]: [`Check ${modelName} exists`, `${modelName} \uC874\uC7AC \uC5EC\uBD80 \uD655\uC778`],
|
|
54
|
-
[`arg-${modelName}Exists-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
|
|
55
|
-
[`argdesc-${modelName}Exists-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
|
|
56
|
-
[`api-create${className}`]: [`Create ${modelName}`, `${modelName} \uC0DD\uC131`],
|
|
57
|
-
[`apidesc-create${className}`]: [`Create ${modelName}`, `${modelName} \uC0DD\uC131`],
|
|
58
|
-
[`arg-create${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
|
|
59
|
-
[`argdesc-create${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
|
|
60
|
-
[`api-update${className}`]: [`Update ${modelName}`, `${modelName} \uC218\uC815`],
|
|
61
|
-
[`apidesc-update${className}`]: [`Update ${modelName}`, `${modelName} \uC218\uC815`],
|
|
62
|
-
[`arg-update${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
|
|
63
|
-
[`argdesc-update${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
|
|
64
|
-
[`arg-update${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
|
|
65
|
-
[`argdesc-update${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
|
|
66
|
-
[`api-remove${className}`]: [`Remove ${modelName}`, `${modelName} \uC0AD\uC81C`],
|
|
67
|
-
[`apidesc-remove${className}`]: [`Remove ${modelName}`, `${modelName} \uC0AD\uC81C`],
|
|
68
|
-
[`arg-remove${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
|
|
69
|
-
[`argdesc-remove${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`]
|
|
70
|
-
// * ==================== Endpoint ==================== * //
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
const rootDictionary = {};
|
|
1
|
+
import { pathGet } from "@akanjs/common";
|
|
74
2
|
const makeDictionary = (...dicts) => {
|
|
75
|
-
|
|
76
|
-
additionalDicts.forEach((dict) => {
|
|
77
|
-
Object.entries(dict).forEach(([key, value]) => {
|
|
78
|
-
if (!rootDict[key])
|
|
79
|
-
rootDict[key] = value;
|
|
80
|
-
else
|
|
81
|
-
rootDict[key] = { ...rootDict[key], ...value };
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
return rootDict;
|
|
3
|
+
return Object.assign(...dicts);
|
|
85
4
|
};
|
|
86
5
|
const languages = ["en", "ko", "zhChs", "zhCht"];
|
|
87
6
|
const msg = {
|
|
@@ -91,7 +10,11 @@ const msg = {
|
|
|
91
10
|
warning: () => null,
|
|
92
11
|
loading: () => null
|
|
93
12
|
};
|
|
94
|
-
const
|
|
13
|
+
const rootDictionary = {};
|
|
14
|
+
const makeTrans = (transMap, { build = false } = {}) => {
|
|
15
|
+
Object.entries(transMap).forEach(([refName, trans]) => {
|
|
16
|
+
trans.dict._registerToRoot(refName, rootDictionary);
|
|
17
|
+
});
|
|
95
18
|
const revert = (key, data) => {
|
|
96
19
|
throw new Error(key);
|
|
97
20
|
};
|
|
@@ -101,34 +24,31 @@ const makeTrans = (locale) => {
|
|
|
101
24
|
}
|
|
102
25
|
}
|
|
103
26
|
const translate = (lang, key, data) => {
|
|
104
|
-
const langIdx = languages.indexOf(lang);
|
|
105
27
|
const [modelName, msgKey] = key.split(".");
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return message;
|
|
28
|
+
const langDict = rootDictionary[lang] ?? {};
|
|
29
|
+
const model = langDict[modelName] ?? {};
|
|
30
|
+
const message = pathGet(msgKey, model, ".", { t: key });
|
|
31
|
+
return message.t;
|
|
111
32
|
};
|
|
112
33
|
const getDictionary = (lang) => {
|
|
113
|
-
|
|
114
|
-
const dictionary = {};
|
|
115
|
-
Object.entries(locale).forEach(([key, value]) => {
|
|
116
|
-
dictionary[key] = Object.fromEntries(
|
|
117
|
-
Object.entries(value).map(([key2, value2]) => [key2, value2[langIdx]])
|
|
118
|
-
);
|
|
119
|
-
});
|
|
120
|
-
return dictionary;
|
|
34
|
+
return rootDictionary[lang];
|
|
121
35
|
};
|
|
122
36
|
const getAllDictionary = () => {
|
|
123
|
-
return
|
|
37
|
+
return rootDictionary;
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
revert,
|
|
41
|
+
Revert,
|
|
42
|
+
translate,
|
|
43
|
+
msg,
|
|
44
|
+
getDictionary,
|
|
45
|
+
getAllDictionary,
|
|
46
|
+
__Dict_Key__: null,
|
|
47
|
+
__Error_Key__: null
|
|
124
48
|
};
|
|
125
|
-
return { revert, Revert, translate, msg, getDictionary, getAllDictionary };
|
|
126
49
|
};
|
|
127
50
|
export {
|
|
128
|
-
baseTrans,
|
|
129
|
-
getBaseSignalTrans,
|
|
130
51
|
makeDictionary,
|
|
131
52
|
makeTrans,
|
|
132
|
-
msg
|
|
133
|
-
rootDictionary
|
|
53
|
+
msg
|
|
134
54
|
};
|
package/package.json
CHANGED
package/src/base.dictionary.d.ts
CHANGED
|
@@ -1,93 +1 @@
|
|
|
1
|
-
export declare const baseDictionary:
|
|
2
|
-
"api-publishPing": [string, string];
|
|
3
|
-
"apidesc-publishPing": [string, string];
|
|
4
|
-
"api-ping": [string, string];
|
|
5
|
-
"apidesc-ping": [string, string];
|
|
6
|
-
"api-pingBody": [string, string];
|
|
7
|
-
"apidesc-pingBody": [string, string];
|
|
8
|
-
"arg-pingBody-data": [string, string];
|
|
9
|
-
"argdesc-pingBody-data": [string, string];
|
|
10
|
-
"api-pingParam": [string, string];
|
|
11
|
-
"apidesc-pingParam": [string, string];
|
|
12
|
-
"arg-pingParam-id": [string, string];
|
|
13
|
-
"argdesc-pingParam-id": [string, string];
|
|
14
|
-
"api-pingQuery": [string, string];
|
|
15
|
-
"apidesc-pingQuery": [string, string];
|
|
16
|
-
"arg-pingQuery-id": [string, string];
|
|
17
|
-
"argdesc-pingQuery-id": [string, string];
|
|
18
|
-
"api-pingEvery": [string, string];
|
|
19
|
-
"apidesc-pingEvery": [string, string];
|
|
20
|
-
"api-pingUser": [string, string];
|
|
21
|
-
"apidesc-pingUser": [string, string];
|
|
22
|
-
"api-pingAdmin": [string, string];
|
|
23
|
-
"apidesc-pingAdmin": [string, string];
|
|
24
|
-
"api-cleanup": [string, string];
|
|
25
|
-
"apidesc-cleanup": [string, string];
|
|
26
|
-
"api-wsPing": [string, string];
|
|
27
|
-
"apidesc-wsPing": [string, string];
|
|
28
|
-
"arg-wsPing-data": [string, string];
|
|
29
|
-
"argdesc-wsPing-data": [string, string];
|
|
30
|
-
"api-pubsubPing": [string, string];
|
|
31
|
-
"apidesc-pubsubPing": [string, string];
|
|
32
|
-
"api-getDictionary": [string, string];
|
|
33
|
-
"apidesc-getDictionary": [string, string];
|
|
34
|
-
"arg-getDictionary-lang": [string, string];
|
|
35
|
-
"argdesc-getDictionary-lang": [string, string];
|
|
36
|
-
"api-getAllDictionary": [string, string];
|
|
37
|
-
"apidesc-getAllDictionary": [string, string];
|
|
38
|
-
"api-getSignals": [string, string];
|
|
39
|
-
"apidesc-getSignals": [string, string];
|
|
40
|
-
somethingWrong: [string, string];
|
|
41
|
-
connecting: [string, string];
|
|
42
|
-
connected: [string, string];
|
|
43
|
-
serverDisconnected: [string, string];
|
|
44
|
-
refreshing: [string, string];
|
|
45
|
-
tryReconnecting: [string, string];
|
|
46
|
-
serverHasProblem: [string, string];
|
|
47
|
-
checkServerStatus: [string, string];
|
|
48
|
-
success: [string, string];
|
|
49
|
-
failed: [string, string];
|
|
50
|
-
processing: [string, string];
|
|
51
|
-
processed: [string, string];
|
|
52
|
-
noData: [string, string];
|
|
53
|
-
error: [string, string];
|
|
54
|
-
invalidValueError: [string, string];
|
|
55
|
-
emailInvalidError: [string, string];
|
|
56
|
-
phoneInvalidError: [string, string];
|
|
57
|
-
ok: [string, string];
|
|
58
|
-
cancel: [string, string];
|
|
59
|
-
unauthorized: [string, string];
|
|
60
|
-
confirmClose: [string, string];
|
|
61
|
-
textTooShortError: [string, string];
|
|
62
|
-
textTooLongError: [string, string];
|
|
63
|
-
selectTooShortError: [string, string];
|
|
64
|
-
selectTooLongError: [string, string];
|
|
65
|
-
numberTooSmallError: [string, string];
|
|
66
|
-
numberTooBigError: [string, string];
|
|
67
|
-
passwordNotMatchError: [string, string];
|
|
68
|
-
selectDateError: [string, string];
|
|
69
|
-
priceUnit: [string, string];
|
|
70
|
-
password: [string, string];
|
|
71
|
-
passwordConfirm: [string, string];
|
|
72
|
-
noOptions: [string, string];
|
|
73
|
-
addModel: [string, string];
|
|
74
|
-
createModel: [string, string];
|
|
75
|
-
createSuccess: [string, string];
|
|
76
|
-
updateModel: [string, string];
|
|
77
|
-
removeModel: [string, string];
|
|
78
|
-
updateSuccess: [string, string];
|
|
79
|
-
removeSuccess: [string, string];
|
|
80
|
-
sureToRemove: [string, string];
|
|
81
|
-
irreversibleOps: [string, string];
|
|
82
|
-
typeNameToRemove: [string, string];
|
|
83
|
-
yesRemove: [string, string];
|
|
84
|
-
removeMsg: [string, string];
|
|
85
|
-
confirmMsg: [string, string];
|
|
86
|
-
perPage: [string, string];
|
|
87
|
-
actions: [string, string];
|
|
88
|
-
new: [string, string];
|
|
89
|
-
edit: [string, string];
|
|
90
|
-
save: [string, string];
|
|
91
|
-
remove: [string, string];
|
|
92
|
-
view: [string, string];
|
|
93
|
-
};
|
|
1
|
+
export declare const baseDictionary: import("./dictInfo").ServiceDictInfo<[string, string], "ping" | "pingBody" | "pingParam" | "pingQuery" | "pingEvery" | "pingUser" | "pingAdmin" | "getDictionary" | "getAllDictionary" | "cleanup" | "wsPing" | "pubsubPing" | "getSignals", never, "error" | "password" | "save" | "remove" | "ok" | "new" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { BaseInsight, BaseObject, GetStateObject } from "@akanjs/base";
|
|
2
|
+
import { BaseFilterQueryKey, BaseFilterSortKey, FilterInfo, FilterInstance } from "@akanjs/document";
|
|
3
|
+
import { ApiInfo, SliceInfo } from "@akanjs/signal";
|
|
4
|
+
declare class FieldTranslation<Languages extends [string, ...string[]]> {
|
|
5
|
+
static translate: <Languages_1 extends [string, ...string[]]>(trans: Languages_1) => FieldTranslation<Languages_1>;
|
|
6
|
+
trans: Languages;
|
|
7
|
+
descTrans?: Languages;
|
|
8
|
+
constructor(trans: Languages);
|
|
9
|
+
desc(descTrans: Languages): this;
|
|
10
|
+
}
|
|
11
|
+
declare class FunctionTranslation<Languages extends [string, ...string[]], ArgName extends string = never> {
|
|
12
|
+
trans: Languages;
|
|
13
|
+
descTrans?: Languages;
|
|
14
|
+
argTrans: {
|
|
15
|
+
[key in ArgName]: FieldTranslation<Languages>;
|
|
16
|
+
};
|
|
17
|
+
constructor(trans: Languages);
|
|
18
|
+
desc(descTrans: Languages): this;
|
|
19
|
+
arg<TransMap extends {
|
|
20
|
+
[key: string]: FieldTranslation<Languages>;
|
|
21
|
+
}>(translate: (t: (trans: Languages) => FieldTranslation<Languages>) => TransMap): FunctionTranslation<Languages, keyof TransMap & string>;
|
|
22
|
+
}
|
|
23
|
+
type BaseModelCrudGetSignalTranslation<T extends string, Languages extends [string, ...string[]] = [string], _CapitalizedT extends string = Capitalize<T>> = {
|
|
24
|
+
[K in T]: FunctionTranslation<Languages, `${T}Id`>;
|
|
25
|
+
} & {
|
|
26
|
+
[K in `light${_CapitalizedT}`]: FunctionTranslation<Languages, `${T}Id`>;
|
|
27
|
+
} & {
|
|
28
|
+
[K in `create${_CapitalizedT}`]: FunctionTranslation<Languages, "data">;
|
|
29
|
+
} & {
|
|
30
|
+
[K in `update${_CapitalizedT}`]: FunctionTranslation<Languages, `${T}Id` | "data">;
|
|
31
|
+
} & {
|
|
32
|
+
[K in `remove${_CapitalizedT}`]: FunctionTranslation<Languages, `${T}Id`>;
|
|
33
|
+
};
|
|
34
|
+
type GetBaseSignalKey<T extends string> = keyof BaseModelCrudGetSignalTranslation<T>;
|
|
35
|
+
export declare class ModelDictInfo<Languages extends [string, ...string[]] = [string], ModelKey extends string = keyof BaseObject, InsightKey extends string = keyof BaseInsight, QueryKey extends string = BaseFilterQueryKey, SortKey extends string = BaseFilterSortKey, EnumKey extends string = never, BaseSignalKey extends string = never, SliceKey extends string = "", EndpointKey extends string = never, ErrorKey extends string = never, EtcKey extends string = never> {
|
|
36
|
+
#private;
|
|
37
|
+
static baseModelDictionary: {
|
|
38
|
+
[key in keyof BaseObject]: FieldTranslation<[string, string]>;
|
|
39
|
+
};
|
|
40
|
+
static baseInsightDictionary: {
|
|
41
|
+
[key in keyof BaseInsight]: FieldTranslation<[string, string]>;
|
|
42
|
+
};
|
|
43
|
+
static baseQueryDictionary: {
|
|
44
|
+
[key in BaseFilterQueryKey]: FieldTranslation<[string, string]>;
|
|
45
|
+
};
|
|
46
|
+
static baseSortDictionary: {
|
|
47
|
+
[key in BaseFilterSortKey]: FieldTranslation<[string, string]>;
|
|
48
|
+
};
|
|
49
|
+
static getBaseSignalDictionary<T extends string>(refName: T): BaseModelCrudGetSignalTranslation<T, [string, string]>;
|
|
50
|
+
static baseSliceDictionary: {
|
|
51
|
+
[key in ""]: FunctionTranslation<[string, string], "query">;
|
|
52
|
+
};
|
|
53
|
+
languages: Languages;
|
|
54
|
+
modelTranslation?: FieldTranslation<Languages>;
|
|
55
|
+
modelDictionary: {
|
|
56
|
+
[K in ModelKey]: FieldTranslation<Languages>;
|
|
57
|
+
};
|
|
58
|
+
insightDictionary: {
|
|
59
|
+
[K in InsightKey]: FieldTranslation<Languages>;
|
|
60
|
+
};
|
|
61
|
+
queryDictionary: {
|
|
62
|
+
[K in QueryKey]: FunctionTranslation<Languages>;
|
|
63
|
+
};
|
|
64
|
+
sortDictionary: {
|
|
65
|
+
[K in SortKey]: FieldTranslation<Languages>;
|
|
66
|
+
};
|
|
67
|
+
enumDictionary: {
|
|
68
|
+
[K in EnumKey]: {
|
|
69
|
+
[key: string]: FieldTranslation<Languages>;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
baseSignalDictionary: {
|
|
73
|
+
[K in BaseSignalKey]: FunctionTranslation<Languages>;
|
|
74
|
+
};
|
|
75
|
+
sliceDictionary: {
|
|
76
|
+
[K in SliceKey]: FunctionTranslation<Languages>;
|
|
77
|
+
};
|
|
78
|
+
endpointDictionary: {
|
|
79
|
+
[K in EndpointKey]: FunctionTranslation<Languages>;
|
|
80
|
+
};
|
|
81
|
+
errorDictionary: {
|
|
82
|
+
[K in ErrorKey]: Languages;
|
|
83
|
+
};
|
|
84
|
+
etcDictionary: {
|
|
85
|
+
[K in EtcKey]: Languages;
|
|
86
|
+
};
|
|
87
|
+
constructor(languages: Languages);
|
|
88
|
+
of(translate: (t: (trans: Languages) => FieldTranslation<Languages>) => FieldTranslation<Languages>): this;
|
|
89
|
+
model<Model extends {
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
}>(translate: (t: (trans: Languages) => FieldTranslation<Languages>) => {
|
|
92
|
+
[K in Exclude<keyof GetStateObject<Model>, ModelKey>]: FieldTranslation<Languages>;
|
|
93
|
+
}): ModelDictInfo<Languages, keyof GetStateObject<Model> & string, InsightKey, QueryKey, SortKey, EnumKey, BaseSignalKey, SliceKey, EndpointKey, ErrorKey, EtcKey>;
|
|
94
|
+
insight<Insight extends {
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
}>(translate: (t: (trans: Languages) => FieldTranslation<Languages>) => {
|
|
97
|
+
[K in Exclude<keyof GetStateObject<Insight>, InsightKey>]: FieldTranslation<Languages>;
|
|
98
|
+
}): ModelDictInfo<Languages, ModelKey, keyof GetStateObject<Insight> & string, QueryKey, SortKey, EnumKey, BaseSignalKey, SliceKey, EndpointKey, ErrorKey, EtcKey>;
|
|
99
|
+
query<Filter extends FilterInstance>(translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
100
|
+
[K in Exclude<keyof Filter["query"], QueryKey>]: Filter["query"][K] extends FilterInfo<infer ArgNames, any> ? FunctionTranslation<Languages, ArgNames[number]> : never;
|
|
101
|
+
}): ModelDictInfo<Languages, ModelKey, InsightKey, keyof Filter["query"] & string, SortKey, EnumKey, BaseSignalKey, SliceKey, EndpointKey, ErrorKey, EtcKey>;
|
|
102
|
+
sort<Filter extends FilterInstance>(translate: (t: (trans: Languages) => FieldTranslation<Languages>) => {
|
|
103
|
+
[K in Exclude<keyof Filter["sort"], SortKey>]: FieldTranslation<Languages>;
|
|
104
|
+
}): ModelDictInfo<Languages, ModelKey, InsightKey, QueryKey, keyof Filter["sort"] & string, EnumKey, BaseSignalKey, SliceKey, EndpointKey, ErrorKey, EtcKey>;
|
|
105
|
+
enum<Enum extends {
|
|
106
|
+
refName: string;
|
|
107
|
+
value: any;
|
|
108
|
+
}>(enumName: Enum["refName"], translate: (t: (trans: Languages) => FieldTranslation<Languages>) => {
|
|
109
|
+
[K in Enum["value"]]: FieldTranslation<Languages>;
|
|
110
|
+
}): ModelDictInfo<Languages, ModelKey, InsightKey, QueryKey, SortKey, EnumKey | Enum["refName"], BaseSignalKey, SliceKey, EndpointKey, ErrorKey, EtcKey>;
|
|
111
|
+
slice<Slice>(translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
112
|
+
[K in Exclude<keyof Slice, SliceKey>]: Slice[K] extends SliceInfo<any, any, any, any, any, infer ArgNames, any, any, any> ? FunctionTranslation<Languages, ArgNames[number]> : never;
|
|
113
|
+
}): ModelDictInfo<Languages, ModelKey, InsightKey, QueryKey, SortKey, EnumKey, BaseSignalKey, keyof Slice & string, EndpointKey, ErrorKey, EtcKey>;
|
|
114
|
+
endpoint<Endpoint>(translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
115
|
+
[K in Exclude<keyof Endpoint, EndpointKey>]: Endpoint[K] extends ApiInfo<any, any, infer ArgNames, any, any, any, any, any, any> ? FunctionTranslation<Languages, ArgNames[number]> : never;
|
|
116
|
+
}): ModelDictInfo<Languages, ModelKey, InsightKey, QueryKey, SortKey, EnumKey, BaseSignalKey, SliceKey, keyof Endpoint & string, ErrorKey, EtcKey>;
|
|
117
|
+
error<ErrorDict extends {
|
|
118
|
+
[key: string]: Languages;
|
|
119
|
+
}>(errorDictionary: ErrorDict): ModelDictInfo<Languages, ModelKey, InsightKey, QueryKey, SortKey, EnumKey, BaseSignalKey, SliceKey, EndpointKey, ErrorKey | (keyof ErrorDict & string), EtcKey>;
|
|
120
|
+
translate<EtcDict extends {
|
|
121
|
+
[key: string]: Languages;
|
|
122
|
+
}>(etcDictionary: EtcDict): ModelDictInfo<Languages, ModelKey, InsightKey, QueryKey, SortKey, EnumKey, BaseSignalKey, SliceKey, EndpointKey, ErrorKey, EtcKey | (keyof EtcDict & string)>;
|
|
123
|
+
_applyBaseSignal<T extends string>(refName: T): ModelDictInfo<Languages, ModelKey, InsightKey, QueryKey, SortKey, EnumKey, GetBaseSignalKey<T>, SliceKey, EndpointKey, ErrorKey, EtcKey>;
|
|
124
|
+
_registerToRoot(refName: string, rootDict: {
|
|
125
|
+
[key: string]: object;
|
|
126
|
+
}): void;
|
|
127
|
+
}
|
|
128
|
+
type MergeTwoModelDicts<ModelDict1, ModelDict2> = ModelDict1 extends ModelDictInfo<infer Languages1, infer ModelKey1, infer InsightKey1, infer QueryKey1, infer SortKey1, infer EnumKey1, infer BaseSignalKey1, infer SliceKey1, infer EndpointKey1, infer ErrorKey1, infer EtcKey1> ? ModelDict2 extends ModelDictInfo<any, infer ModelKey2, infer InsightKey2, infer QueryKey2, infer SortKey2, infer EnumKey2, infer BaseSignalKey2, infer SliceKey2, infer EndpointKey2, infer ErrorKey2, infer EtcKey2> ? ModelDictInfo<Languages1, ModelKey1 | ModelKey2, InsightKey1 | InsightKey2, QueryKey1 | QueryKey2, SortKey1 | SortKey2, EnumKey1 | EnumKey2, BaseSignalKey1 | BaseSignalKey2, SliceKey1 | SliceKey2, EndpointKey1 | EndpointKey2, ErrorKey1 | ErrorKey2, EtcKey1 | EtcKey2> : ModelDict1 : never;
|
|
129
|
+
type MergeModelDicts<ModelDicts extends ModelDictInfo<any>[]> = ModelDicts extends [
|
|
130
|
+
infer First extends ModelDictInfo<any>,
|
|
131
|
+
...infer Rest extends ModelDictInfo<any>[]
|
|
132
|
+
] ? Rest extends [] ? First : MergeTwoModelDicts<First, MergeModelDicts<Rest>> : never;
|
|
133
|
+
export declare const modelDictionary: <Languages extends [string, ...string[]] = [string], ExtendModelDicts extends ModelDictInfo<any>[] = []>(languages?: Languages, ...extendModelDicts: ExtendModelDicts) => MergeModelDicts<[ModelDictInfo<Languages>, ...ExtendModelDicts]>;
|
|
134
|
+
export declare class ScalarDictInfo<Languages extends [string, ...string[]] = [string], ModelKey extends string = keyof BaseObject, EnumKey extends string = never, ErrorKey extends string = never, EtcKey extends string = never> {
|
|
135
|
+
#private;
|
|
136
|
+
languages: Languages;
|
|
137
|
+
modelTranslation?: FieldTranslation<Languages>;
|
|
138
|
+
modelDictionary: {
|
|
139
|
+
[K in ModelKey]: FieldTranslation<Languages>;
|
|
140
|
+
};
|
|
141
|
+
enumDictionary: {
|
|
142
|
+
[K in EnumKey]: {
|
|
143
|
+
[key: string]: FieldTranslation<Languages>;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
errorDictionary: {
|
|
147
|
+
[K in ErrorKey]: Languages;
|
|
148
|
+
};
|
|
149
|
+
etcDictionary: {
|
|
150
|
+
[K in EtcKey]: Languages;
|
|
151
|
+
};
|
|
152
|
+
constructor(languages: Languages);
|
|
153
|
+
of(translate: (t: (trans: Languages) => FieldTranslation<Languages>) => FieldTranslation<Languages>): this;
|
|
154
|
+
model<Model>(translate: (t: (trans: Languages) => FieldTranslation<Languages>) => {
|
|
155
|
+
[K in keyof GetStateObject<Model>]: FieldTranslation<Languages>;
|
|
156
|
+
}): ScalarDictInfo<Languages, keyof GetStateObject<Model> & string, EnumKey, ErrorKey, EtcKey>;
|
|
157
|
+
enum<Enum extends {
|
|
158
|
+
refName: string;
|
|
159
|
+
value: any;
|
|
160
|
+
}>(enumName: Enum["refName"], translate: (t: (trans: Languages) => FieldTranslation<Languages>) => {
|
|
161
|
+
[K in Enum["value"]]: FieldTranslation<Languages>;
|
|
162
|
+
}): ScalarDictInfo<Languages, ModelKey, EnumKey | Enum["refName"], ErrorKey, EtcKey>;
|
|
163
|
+
error<ErrorDict extends {
|
|
164
|
+
[key: string]: Languages;
|
|
165
|
+
}>(errorDictionary: ErrorDict): ScalarDictInfo<Languages, ModelKey, EnumKey, keyof ErrorDict & string, EtcKey>;
|
|
166
|
+
translate<EtcDict extends {
|
|
167
|
+
[key: string]: Languages;
|
|
168
|
+
}>(etcDictionary: EtcDict): ScalarDictInfo<Languages, ModelKey, EnumKey, ErrorKey, keyof EtcDict & string>;
|
|
169
|
+
_registerToRoot(refName: string, rootDict: {
|
|
170
|
+
[key: string]: object;
|
|
171
|
+
}): void;
|
|
172
|
+
}
|
|
173
|
+
export declare const scalarDictionary: <Languages extends [string, ...string[]] = [string]>(languages?: Languages) => ScalarDictInfo<Languages, keyof BaseObject, never, never, never>;
|
|
174
|
+
export declare class ServiceDictInfo<Languages extends [string, ...string[]] = [string], EndpointKey extends string = never, ErrorKey extends string = never, EtcKey extends string = never> {
|
|
175
|
+
#private;
|
|
176
|
+
languages: Languages;
|
|
177
|
+
endpointDictionary: {
|
|
178
|
+
[K in EndpointKey]: FunctionTranslation<Languages>;
|
|
179
|
+
};
|
|
180
|
+
errorDictionary: {
|
|
181
|
+
[K in ErrorKey]: Languages;
|
|
182
|
+
};
|
|
183
|
+
etcDictionary: {
|
|
184
|
+
[K in EtcKey]: Languages;
|
|
185
|
+
};
|
|
186
|
+
constructor(languages: Languages);
|
|
187
|
+
endpoint<Endpoint>(translate: (fn: (trans: Languages) => FunctionTranslation<Languages>) => {
|
|
188
|
+
[K in keyof Endpoint]: Endpoint[K] extends ApiInfo<any, any, infer ArgNames, any, any, any, any, any, any> ? FunctionTranslation<Languages, ArgNames[number]> : never;
|
|
189
|
+
}): ServiceDictInfo<Languages, keyof Endpoint & string, ErrorKey, EtcKey>;
|
|
190
|
+
error<ErrorDict extends {
|
|
191
|
+
[key: string]: Languages;
|
|
192
|
+
}>(errorDictionary: ErrorDict): ServiceDictInfo<Languages, EndpointKey, keyof ErrorDict & string, EtcKey>;
|
|
193
|
+
translate<EtcDict extends {
|
|
194
|
+
[key: string]: Languages;
|
|
195
|
+
}>(etcDictionary: EtcDict): ServiceDictInfo<Languages, EndpointKey, ErrorKey, keyof EtcDict & string>;
|
|
196
|
+
_toTranslation(): {
|
|
197
|
+
[key: string]: string[];
|
|
198
|
+
};
|
|
199
|
+
_registerToRoot(refName: string, rootDict: {
|
|
200
|
+
[key: string]: object;
|
|
201
|
+
}): void;
|
|
202
|
+
}
|
|
203
|
+
export declare const serviceDictionary: <Languages extends [string, ...string[]] = [string]>(languages?: Languages) => ServiceDictInfo<Languages, never, never, never>;
|
|
204
|
+
export {};
|