@aidc-toolkit/core 1.0.25-beta → 1.0.27-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +21 -230
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -128
- package/dist/index.js.map +1 -1
- package/dist/locale/i18n.d.ts +56 -0
- package/dist/locale/i18n.d.ts.map +1 -0
- package/dist/locale/i18n.js +97 -0
- package/dist/locale/i18n.js.map +1 -0
- package/dist/logger.d.ts +32 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +41 -0
- package/dist/logger.js.map +1 -0
- package/dist/type-helper.d.ts +93 -0
- package/dist/type-helper.d.ts.map +1 -0
- package/dist/type-helper.js +138 -0
- package/dist/type-helper.js.map +1 -0
- package/dist/type.d.ts +69 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +2 -0
- package/dist/type.js.map +1 -0
- package/package.json +10 -6
- package/src/index.ts +4 -4
- package/src/type-helper.ts +26 -0
- package/tsconfig-config.json +4 -0
- package/tsconfig-src.json +8 -0
- package/tsconfig.json +9 -1
- package/tsup.config.ts +3 -2
- package/dist/index.cjs +0 -173
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -230
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an object with omitted entries.
|
|
3
|
+
*
|
|
4
|
+
* @template T
|
|
5
|
+
* Object type.
|
|
6
|
+
*
|
|
7
|
+
* @template K
|
|
8
|
+
* Object key type.
|
|
9
|
+
*
|
|
10
|
+
* @param o
|
|
11
|
+
* Object.
|
|
12
|
+
*
|
|
13
|
+
* @param keys
|
|
14
|
+
* Keys to omit.
|
|
15
|
+
*
|
|
16
|
+
* @returns
|
|
17
|
+
* Edited object.
|
|
18
|
+
*/
|
|
19
|
+
export declare function omit<T extends object, K extends keyof T>(o: T, ...keys: K[]): Omit<T, K>;
|
|
20
|
+
/**
|
|
21
|
+
* Create an object with picked entries.
|
|
22
|
+
*
|
|
23
|
+
* @template T
|
|
24
|
+
* Object type.
|
|
25
|
+
*
|
|
26
|
+
* @template K
|
|
27
|
+
* Object key type.
|
|
28
|
+
*
|
|
29
|
+
* @param o
|
|
30
|
+
* Object.
|
|
31
|
+
*
|
|
32
|
+
* @param keys
|
|
33
|
+
* Keys to pick.
|
|
34
|
+
*
|
|
35
|
+
* @returns
|
|
36
|
+
* Edited object.
|
|
37
|
+
*/
|
|
38
|
+
export declare function pick<T extends object, K extends keyof T>(o: T, ...keys: K[]): Pick<T, K>;
|
|
39
|
+
/**
|
|
40
|
+
* Create an object with entries from a narrower object excluded.
|
|
41
|
+
*
|
|
42
|
+
* @template TWide
|
|
43
|
+
* Wide object type.
|
|
44
|
+
*
|
|
45
|
+
* @template TNarrow
|
|
46
|
+
* Narrow object type.
|
|
47
|
+
*
|
|
48
|
+
* @template K
|
|
49
|
+
* Narrow object key type, subset of wide object key type.
|
|
50
|
+
*
|
|
51
|
+
* @param wide
|
|
52
|
+
* Wide object.
|
|
53
|
+
*
|
|
54
|
+
* @param narrow
|
|
55
|
+
* Narrow object.
|
|
56
|
+
*
|
|
57
|
+
* @returns
|
|
58
|
+
* Edited object.
|
|
59
|
+
*/
|
|
60
|
+
export declare function exclude<TWide extends TNarrow, TNarrow extends object, K extends keyof TNarrow>(wide: TWide, narrow: TNarrow): Omit<TWide, K>;
|
|
61
|
+
/**
|
|
62
|
+
* Cast a property as a more narrow type.
|
|
63
|
+
*
|
|
64
|
+
* @template T
|
|
65
|
+
* Object type.
|
|
66
|
+
*
|
|
67
|
+
* @template K
|
|
68
|
+
* Object key type.
|
|
69
|
+
*
|
|
70
|
+
* @template TAsType
|
|
71
|
+
* Desired type.
|
|
72
|
+
*
|
|
73
|
+
* @param o
|
|
74
|
+
* Object.
|
|
75
|
+
*
|
|
76
|
+
* @param key
|
|
77
|
+
* Key of property to cast.
|
|
78
|
+
*
|
|
79
|
+
* @returns
|
|
80
|
+
* Single-key object with property cast as desired type.
|
|
81
|
+
*/
|
|
82
|
+
export declare function propertyAs<T extends object, K extends keyof T, TAsType extends T[K]>(o: T, key: K): Readonly<Omit<T, K> extends T ? Partial<Record<K, TAsType>> : Record<K, TAsType>>;
|
|
83
|
+
/**
|
|
84
|
+
* Determine if argument is nullish. Application extension may pass `null` or `undefined` to missing parameters.
|
|
85
|
+
*
|
|
86
|
+
* @param argument
|
|
87
|
+
* Argument.
|
|
88
|
+
*
|
|
89
|
+
* @returns
|
|
90
|
+
* True if argument is undefined or null.
|
|
91
|
+
*/
|
|
92
|
+
export declare function isNullish(argument: unknown): argument is null | undefined;
|
|
93
|
+
//# sourceMappingURL=type-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-helper.d.ts","sourceRoot":"","sources":["../src/type-helper.ts"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAExF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAExF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,OAAO,CAAC,KAAK,SAAS,OAAO,EAAE,OAAO,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAG5I;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CASrL;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,IAAI,GAAG,SAAS,CAEzE"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an object with omitted or picked entries.
|
|
3
|
+
*
|
|
4
|
+
* @template Omitting
|
|
5
|
+
* Type representation of `omitting` parameter for return type determination.
|
|
6
|
+
*
|
|
7
|
+
* @template T
|
|
8
|
+
* Object type.
|
|
9
|
+
*
|
|
10
|
+
* @template K
|
|
11
|
+
* Object key type.
|
|
12
|
+
*
|
|
13
|
+
* @param omitting
|
|
14
|
+
* True if omitting.
|
|
15
|
+
*
|
|
16
|
+
* @param o
|
|
17
|
+
* Object.
|
|
18
|
+
*
|
|
19
|
+
* @param keys
|
|
20
|
+
* Keys to omit or pick.
|
|
21
|
+
*
|
|
22
|
+
* @returns
|
|
23
|
+
* Edited object.
|
|
24
|
+
*/
|
|
25
|
+
function omitOrPick(omitting, o, ...keys) {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Key and value types are known.
|
|
27
|
+
return Object.fromEntries(Object.entries(o).filter(([key]) => keys.includes(key) !== omitting));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create an object with omitted entries.
|
|
31
|
+
*
|
|
32
|
+
* @template T
|
|
33
|
+
* Object type.
|
|
34
|
+
*
|
|
35
|
+
* @template K
|
|
36
|
+
* Object key type.
|
|
37
|
+
*
|
|
38
|
+
* @param o
|
|
39
|
+
* Object.
|
|
40
|
+
*
|
|
41
|
+
* @param keys
|
|
42
|
+
* Keys to omit.
|
|
43
|
+
*
|
|
44
|
+
* @returns
|
|
45
|
+
* Edited object.
|
|
46
|
+
*/
|
|
47
|
+
export function omit(o, ...keys) {
|
|
48
|
+
return omitOrPick(true, o, ...keys);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create an object with picked entries.
|
|
52
|
+
*
|
|
53
|
+
* @template T
|
|
54
|
+
* Object type.
|
|
55
|
+
*
|
|
56
|
+
* @template K
|
|
57
|
+
* Object key type.
|
|
58
|
+
*
|
|
59
|
+
* @param o
|
|
60
|
+
* Object.
|
|
61
|
+
*
|
|
62
|
+
* @param keys
|
|
63
|
+
* Keys to pick.
|
|
64
|
+
*
|
|
65
|
+
* @returns
|
|
66
|
+
* Edited object.
|
|
67
|
+
*/
|
|
68
|
+
export function pick(o, ...keys) {
|
|
69
|
+
return omitOrPick(false, o, ...keys);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create an object with entries from a narrower object excluded.
|
|
73
|
+
*
|
|
74
|
+
* @template TWide
|
|
75
|
+
* Wide object type.
|
|
76
|
+
*
|
|
77
|
+
* @template TNarrow
|
|
78
|
+
* Narrow object type.
|
|
79
|
+
*
|
|
80
|
+
* @template K
|
|
81
|
+
* Narrow object key type, subset of wide object key type.
|
|
82
|
+
*
|
|
83
|
+
* @param wide
|
|
84
|
+
* Wide object.
|
|
85
|
+
*
|
|
86
|
+
* @param narrow
|
|
87
|
+
* Narrow object.
|
|
88
|
+
*
|
|
89
|
+
* @returns
|
|
90
|
+
* Edited object.
|
|
91
|
+
*/
|
|
92
|
+
export function exclude(wide, narrow) {
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Keys are valid.
|
|
94
|
+
return omit(wide, ...Object.keys(narrow));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Cast a property as a more narrow type.
|
|
98
|
+
*
|
|
99
|
+
* @template T
|
|
100
|
+
* Object type.
|
|
101
|
+
*
|
|
102
|
+
* @template K
|
|
103
|
+
* Object key type.
|
|
104
|
+
*
|
|
105
|
+
* @template TAsType
|
|
106
|
+
* Desired type.
|
|
107
|
+
*
|
|
108
|
+
* @param o
|
|
109
|
+
* Object.
|
|
110
|
+
*
|
|
111
|
+
* @param key
|
|
112
|
+
* Key of property to cast.
|
|
113
|
+
*
|
|
114
|
+
* @returns
|
|
115
|
+
* Single-key object with property cast as desired type.
|
|
116
|
+
*/
|
|
117
|
+
export function propertyAs(o, key) {
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type is determined by condition.
|
|
119
|
+
return (key in o ?
|
|
120
|
+
{
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Force cast.
|
|
122
|
+
[key]: o[key]
|
|
123
|
+
} :
|
|
124
|
+
{});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Determine if argument is nullish. Application extension may pass `null` or `undefined` to missing parameters.
|
|
128
|
+
*
|
|
129
|
+
* @param argument
|
|
130
|
+
* Argument.
|
|
131
|
+
*
|
|
132
|
+
* @returns
|
|
133
|
+
* True if argument is undefined or null.
|
|
134
|
+
*/
|
|
135
|
+
export function isNullish(argument) {
|
|
136
|
+
return argument === null || argument === undefined;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=type-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-helper.js","sourceRoot":"","sources":["../src/type-helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAS,UAAU,CAAgE,QAAkB,EAAE,CAAI,EAAE,GAAG,IAAS;IACrH,yGAAyG;IACzG,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAA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
*
|
|
4
|
+
* @template TFunction
|
|
5
|
+
* Function type.
|
|
6
|
+
*/
|
|
7
|
+
export type TypedFunction<TFunction extends (...args: Parameters<TFunction>) => ReturnType<TFunction>> = (...args: Parameters<TFunction>) => ReturnType<TFunction>;
|
|
8
|
+
/**
|
|
9
|
+
* Typed synchronous function, applicable to any function that doesn't return a {@linkcode Promise}.
|
|
10
|
+
*
|
|
11
|
+
* @template TFunction
|
|
12
|
+
* Function type.
|
|
13
|
+
*/
|
|
14
|
+
export type TypedSyncFunction<TFunction extends TypedFunction<TFunction>> = [ReturnType<TFunction>] extends [PromiseLike<unknown>] ? never : TypedFunction<TFunction>;
|
|
15
|
+
/**
|
|
16
|
+
* Determine the fundamental promised type. This is stricter than `Awaited<Type>` in that it requires a {@linkcode
|
|
17
|
+
* Promise}.
|
|
18
|
+
*
|
|
19
|
+
* @template T
|
|
20
|
+
* Promised type.
|
|
21
|
+
*/
|
|
22
|
+
export type PromisedType<T> = [T] extends [PromiseLike<infer TPromised>] ? TPromised : never;
|
|
23
|
+
/**
|
|
24
|
+
* Typed asynchronous function, applicable to any function that returns a {@linkcode Promise}.
|
|
25
|
+
*
|
|
26
|
+
* @template TFunction
|
|
27
|
+
* Function type.
|
|
28
|
+
*/
|
|
29
|
+
export type TypedAsyncFunction<TMethod extends (...args: Parameters<TMethod>) => PromiseLike<PromisedType<ReturnType<TMethod>>>> = (...args: Parameters<TMethod>) => Promise<PromisedType<ReturnType<TMethod>>>;
|
|
30
|
+
/**
|
|
31
|
+
* Nullishable type. Extends a type by allowing `null` and `undefined`.
|
|
32
|
+
*
|
|
33
|
+
* @template T
|
|
34
|
+
* Type.
|
|
35
|
+
*/
|
|
36
|
+
export type Nullishable<T> = T | null | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Non-nullishable type. If T is an object type, it is spread and attributes within it are made non-nullishable.
|
|
39
|
+
* Equivalent to a deep `Required<T>` for an object and `NonNullable<T>` for any other type.
|
|
40
|
+
*
|
|
41
|
+
* @template T
|
|
42
|
+
* Type.
|
|
43
|
+
*/
|
|
44
|
+
export type NonNullishable<T> = T extends object ? {
|
|
45
|
+
[P in keyof T]-?: NonNullishable<T[P]>;
|
|
46
|
+
} : NonNullable<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Make some keys within a type optional.
|
|
49
|
+
*
|
|
50
|
+
* @template T
|
|
51
|
+
* Object type.
|
|
52
|
+
*
|
|
53
|
+
* @template K
|
|
54
|
+
* Object key type.
|
|
55
|
+
*/
|
|
56
|
+
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
57
|
+
/**
|
|
58
|
+
* Type to restrict property keys to those that are strings and that support a specified type.
|
|
59
|
+
*
|
|
60
|
+
* @template T
|
|
61
|
+
* Object type.
|
|
62
|
+
*
|
|
63
|
+
* @template P
|
|
64
|
+
* Object property type.
|
|
65
|
+
*/
|
|
66
|
+
export type PropertyKeys<T, P> = {
|
|
67
|
+
[K in keyof T]: K extends string ? T[K] extends P ? K : never : never;
|
|
68
|
+
}[keyof T];
|
|
69
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,UAAU,CAAC,SAAS,CAAC,CAAC;AAEnK;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;AAEtK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type.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27-beta",
|
|
4
4
|
"description": "Core functionality for AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"homepage": "https://aidc-toolkit.com/",
|
|
8
|
-
"repository":
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/aidc-toolkit/core.git"
|
|
11
|
+
},
|
|
9
12
|
"bugs": {
|
|
10
13
|
"url": "https://github.com/aidc-toolkit/core/issues"
|
|
11
14
|
},
|
|
@@ -17,15 +20,16 @@
|
|
|
17
20
|
},
|
|
18
21
|
"scripts": {
|
|
19
22
|
"lint": "eslint",
|
|
20
|
-
"
|
|
21
|
-
"build:
|
|
23
|
+
"tsc:core": "tsc --project tsconfig-src.json",
|
|
24
|
+
"build:dev": "rimraf dist && npm run tsc:core -- --declarationMap --sourceMap",
|
|
25
|
+
"build:release": "npm run tsc:core -- --noEmit && tsup",
|
|
22
26
|
"build:doc": "npm run build:dev"
|
|
23
27
|
},
|
|
24
28
|
"devDependencies": {
|
|
25
|
-
"@aidc-toolkit/dev": "1.0.
|
|
29
|
+
"@aidc-toolkit/dev": "1.0.27-beta"
|
|
26
30
|
},
|
|
27
31
|
"dependencies": {
|
|
28
|
-
"i18next": "^25.7.
|
|
32
|
+
"i18next": "^25.7.2",
|
|
29
33
|
"i18next-browser-languagedetector": "^8.2.0",
|
|
30
34
|
"i18next-cli-language-detector": "^1.1.8",
|
|
31
35
|
"tslog": "^4.10.2"
|
package/src/index.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
export type * from "./type";
|
|
18
|
-
export * from "./type-helper";
|
|
19
|
-
export * from "./logger";
|
|
20
|
-
export * from "./locale/i18n";
|
|
17
|
+
export type * from "./type.js";
|
|
18
|
+
export * from "./type-helper.js";
|
|
19
|
+
export * from "./logger.js";
|
|
20
|
+
export * from "./locale/i18n.js";
|
package/src/type-helper.ts
CHANGED
|
@@ -71,6 +71,32 @@ export function pick<T extends object, K extends keyof T>(o: T, ...keys: K[]): P
|
|
|
71
71
|
return omitOrPick(false, o, ...keys);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Create an object with entries from a narrower object excluded.
|
|
76
|
+
*
|
|
77
|
+
* @template TWide
|
|
78
|
+
* Wide object type.
|
|
79
|
+
*
|
|
80
|
+
* @template TNarrow
|
|
81
|
+
* Narrow object type.
|
|
82
|
+
*
|
|
83
|
+
* @template K
|
|
84
|
+
* Narrow object key type, subset of wide object key type.
|
|
85
|
+
*
|
|
86
|
+
* @param wide
|
|
87
|
+
* Wide object.
|
|
88
|
+
*
|
|
89
|
+
* @param narrow
|
|
90
|
+
* Narrow object.
|
|
91
|
+
*
|
|
92
|
+
* @returns
|
|
93
|
+
* Edited object.
|
|
94
|
+
*/
|
|
95
|
+
export function exclude<TWide extends TNarrow, TNarrow extends object, K extends keyof TNarrow>(wide: TWide, narrow: TNarrow): Omit<TWide, K> {
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Keys are valid.
|
|
97
|
+
return omit(wide, ...(Object.keys(narrow) as K[]));
|
|
98
|
+
}
|
|
99
|
+
|
|
74
100
|
/**
|
|
75
101
|
* Cast a property as a more narrow type.
|
|
76
102
|
*
|
package/tsconfig.json
CHANGED
package/tsup.config.ts
CHANGED
package/dist/index.cjs
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
I18nEnvironments: () => I18nEnvironments,
|
|
34
|
-
LogLevels: () => LogLevels,
|
|
35
|
-
getLogger: () => getLogger,
|
|
36
|
-
i18nCoreInit: () => i18nCoreInit,
|
|
37
|
-
isNullish: () => isNullish,
|
|
38
|
-
omit: () => omit,
|
|
39
|
-
pick: () => pick,
|
|
40
|
-
propertyAs: () => propertyAs
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(index_exports);
|
|
43
|
-
|
|
44
|
-
// src/type-helper.ts
|
|
45
|
-
function omitOrPick(omitting, o, ...keys) {
|
|
46
|
-
return Object.fromEntries(Object.entries(o).filter(([key]) => keys.includes(key) !== omitting));
|
|
47
|
-
}
|
|
48
|
-
function omit(o, ...keys) {
|
|
49
|
-
return omitOrPick(true, o, ...keys);
|
|
50
|
-
}
|
|
51
|
-
function pick(o, ...keys) {
|
|
52
|
-
return omitOrPick(false, o, ...keys);
|
|
53
|
-
}
|
|
54
|
-
function propertyAs(o, key) {
|
|
55
|
-
return key in o ? {
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Force cast.
|
|
57
|
-
[key]: o[key]
|
|
58
|
-
} : {};
|
|
59
|
-
}
|
|
60
|
-
function isNullish(argument) {
|
|
61
|
-
return argument === null || argument === void 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// src/logger.ts
|
|
65
|
-
var import_tslog = require("tslog");
|
|
66
|
-
var LogLevels = {
|
|
67
|
-
Silly: 0,
|
|
68
|
-
Trace: 1,
|
|
69
|
-
Debug: 2,
|
|
70
|
-
Info: 3,
|
|
71
|
-
Warn: 4,
|
|
72
|
-
Error: 5,
|
|
73
|
-
Fatal: 6
|
|
74
|
-
};
|
|
75
|
-
function getLogger(logLevel) {
|
|
76
|
-
let minLevel;
|
|
77
|
-
if (typeof logLevel === "string") {
|
|
78
|
-
if (logLevel in LogLevels) {
|
|
79
|
-
minLevel = LogLevels[logLevel];
|
|
80
|
-
} else {
|
|
81
|
-
throw new Error(`Unknown log level ${logLevel}`);
|
|
82
|
-
}
|
|
83
|
-
} else {
|
|
84
|
-
minLevel = logLevel ?? LogLevels.Info;
|
|
85
|
-
}
|
|
86
|
-
return new import_tslog.Logger({
|
|
87
|
-
minLevel
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// src/locale/i18n.ts
|
|
92
|
-
var import_i18next_browser_languagedetector = __toESM(require("i18next-browser-languagedetector"), 1);
|
|
93
|
-
var import_i18next_cli_language_detector = __toESM(require("i18next-cli-language-detector"), 1);
|
|
94
|
-
var I18nEnvironments = {
|
|
95
|
-
/**
|
|
96
|
-
* Command-line interface (e.g., unit tests).
|
|
97
|
-
*/
|
|
98
|
-
CLI: 0,
|
|
99
|
-
/**
|
|
100
|
-
* Web server.
|
|
101
|
-
*/
|
|
102
|
-
Server: 1,
|
|
103
|
-
/**
|
|
104
|
-
* Web browser.
|
|
105
|
-
*/
|
|
106
|
-
Browser: 2
|
|
107
|
-
};
|
|
108
|
-
function toLowerCase(s) {
|
|
109
|
-
return s.split(" ").map((word) => /[a-z]/.test(word) ? word.toLowerCase() : word).join(" ");
|
|
110
|
-
}
|
|
111
|
-
async function i18nCoreInit(i18next, environment, debug, defaultNS, ...resources) {
|
|
112
|
-
if (!i18next.isInitialized) {
|
|
113
|
-
const mergedResource = {};
|
|
114
|
-
for (const resource of resources) {
|
|
115
|
-
for (const [language, resourceLanguage] of Object.entries(resource)) {
|
|
116
|
-
if (!(language in mergedResource)) {
|
|
117
|
-
mergedResource[language] = {};
|
|
118
|
-
}
|
|
119
|
-
const mergedResourceLanguage = mergedResource[language];
|
|
120
|
-
for (const [namespace, resourceKey] of Object.entries(resourceLanguage)) {
|
|
121
|
-
mergedResourceLanguage[namespace] = resourceKey;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
let module2;
|
|
126
|
-
switch (environment) {
|
|
127
|
-
case I18nEnvironments.CLI:
|
|
128
|
-
module2 = import_i18next_cli_language_detector.default;
|
|
129
|
-
break;
|
|
130
|
-
case I18nEnvironments.Browser:
|
|
131
|
-
module2 = import_i18next_browser_languagedetector.default;
|
|
132
|
-
break;
|
|
133
|
-
default:
|
|
134
|
-
throw new Error("Not supported");
|
|
135
|
-
}
|
|
136
|
-
await i18next.use(module2).init({
|
|
137
|
-
debug,
|
|
138
|
-
resources: mergedResource,
|
|
139
|
-
fallbackLng: "en",
|
|
140
|
-
defaultNS
|
|
141
|
-
}).then(() => {
|
|
142
|
-
i18next.services.formatter?.add("toLowerCase", (value) => typeof value === "string" ? toLowerCase(value) : String(value));
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
-
0 && (module.exports = {
|
|
148
|
-
I18nEnvironments,
|
|
149
|
-
LogLevels,
|
|
150
|
-
getLogger,
|
|
151
|
-
i18nCoreInit,
|
|
152
|
-
isNullish,
|
|
153
|
-
omit,
|
|
154
|
-
pick,
|
|
155
|
-
propertyAs
|
|
156
|
-
});
|
|
157
|
-
/*!
|
|
158
|
-
* Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit
|
|
159
|
-
* contributors
|
|
160
|
-
*
|
|
161
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
162
|
-
* you may not use this file except in compliance with the License.
|
|
163
|
-
* You may obtain a copy of the License at
|
|
164
|
-
*
|
|
165
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
166
|
-
*
|
|
167
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
168
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
169
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
170
|
-
* See the License for the specific language governing permissions and
|
|
171
|
-
* limitations under the License.
|
|
172
|
-
*/
|
|
173
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/type-helper.ts","../src/logger.ts","../src/locale/i18n.ts"],"sourcesContent":["/*!\n * Copyright © 2024-2025 Dolphin Data Development Ltd. and AIDC Toolkit\n * contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport type * from \"./type\";\nexport * from \"./type-helper\";\nexport * from \"./logger\";\nexport * from \"./locale/i18n\";\n","/**\n * Create an object with omitted or picked entries.\n *\n * @template Omitting\n * Type representation of `omitting` parameter for return type determination.\n *\n * @template T\n * Object type.\n *\n * @template K\n * Object key type.\n *\n * @param omitting\n * True if omitting.\n *\n * @param o\n * Object.\n *\n * @param keys\n * Keys to omit or pick.\n *\n * @returns\n * Edited object.\n */\nfunction omitOrPick<Omitting extends boolean, T extends object, K extends keyof T>(omitting: Omitting, o: T, ...keys: K[]): Omitting extends true ? Omit<T, K> : Pick<T, K> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Key and value types are known.\n return Object.fromEntries(Object.entries(o).filter(([key]) => keys.includes(key as K) !== omitting)) as ReturnType<typeof omitOrPick<Omitting, T, K>>;\n}\n\n/**\n * Create an object with omitted entries.\n *\n * @template T\n * Object type.\n *\n * @template K\n * Object key type.\n *\n * @param o\n * Object.\n *\n * @param keys\n * Keys to omit.\n *\n * @returns\n * Edited object.\n */\nexport function omit<T extends object, K extends keyof T>(o: T, ...keys: K[]): Omit<T, K> {\n return omitOrPick(true, o, ...keys);\n}\n\n/**\n * Create an object with picked entries.\n *\n * @template T\n * Object type.\n *\n * @template K\n * Object key type.\n *\n * @param o\n * Object.\n *\n * @param keys\n * Keys to pick.\n *\n * @returns\n * Edited object.\n */\nexport function pick<T extends object, K extends keyof T>(o: T, ...keys: K[]): Pick<T, K> {\n return omitOrPick(false, o, ...keys);\n}\n\n/**\n * Cast a property as a more narrow type.\n *\n * @template T\n * Object type.\n *\n * @template K\n * Object key type.\n *\n * @template TAsType\n * Desired type.\n *\n * @param o\n * Object.\n *\n * @param key\n * Key of property to cast.\n *\n * @returns\n * Single-key object with property cast as desired type.\n */\nexport function propertyAs<T extends object, K extends keyof T, TAsType extends T[K]>(o: T, key: K): Readonly<Omit<T, K> extends T ? Partial<Record<K, TAsType>> : Record<K, TAsType>> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type is determined by condition.\n return (key in o ?\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Force cast.\n [key]: o[key] as TAsType\n } :\n {}\n ) as ReturnType<typeof propertyAs<T, K, TAsType>>;\n}\n\n/**\n * Determine if argument is nullish. Application extension may pass `null` or `undefined` to missing parameters.\n *\n * @param argument\n * Argument.\n *\n * @returns\n * True if argument is undefined or null.\n */\nexport function isNullish(argument: unknown): argument is null | undefined {\n return argument === null || argument === undefined;\n}\n","import { Logger } from \"tslog\";\n\n/**\n * Log levels.\n */\nexport const LogLevels = {\n Silly: 0,\n Trace: 1,\n Debug: 2,\n Info: 3,\n Warn: 4,\n Error: 5,\n Fatal: 6\n} as const;\n\n/**\n * Log level key.\n */\nexport type LogLevelKey = keyof typeof LogLevels;\n\n/**\n * Log level.\n */\nexport type LogLevel = typeof LogLevels[LogLevelKey];\n\n/**\n * Get a simple logger with an optional log level.\n *\n * @param logLevel\n * Log level as enumeration value or string.\n *\n * @returns\n * Logger.\n */\nexport function getLogger(logLevel?: string | number): Logger<unknown> {\n let minLevel: number;\n\n if (typeof logLevel === \"string\") {\n if (logLevel in LogLevels) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- String exists as a key.\n minLevel = LogLevels[logLevel as LogLevelKey];\n } else {\n throw new Error(`Unknown log level ${logLevel}`);\n }\n } else {\n minLevel = logLevel ?? LogLevels.Info;\n }\n\n return new Logger({\n minLevel\n });\n}\n","import type { i18n, LanguageDetectorModule, Resource } from \"i18next\";\nimport I18nextBrowserLanguageDetector from \"i18next-browser-languagedetector\";\nimport I18nextCLILanguageDetector from \"i18next-cli-language-detector\";\n\n/**\n * Locale strings type for generic manipulation.\n */\nexport interface LocaleResources {\n [key: string]: LocaleResources | string;\n}\n\n/**\n * Internationalization operating environments.\n */\nexport const I18nEnvironments = {\n /**\n * Command-line interface (e.g., unit tests).\n */\n CLI: 0,\n\n /**\n * Web server.\n */\n Server: 1,\n\n /**\n * Web browser.\n */\n Browser: 2\n} as const;\n\n/**\n * Internationalization operating environment key.\n */\nexport type I18nEnvironmentKey = keyof typeof I18nEnvironments;\n\n/**\n * Internationalization operating environment.\n */\nexport type I18nEnvironment = typeof I18nEnvironments[I18nEnvironmentKey];\n\n/**\n * Convert a string to lower case, skipping words that are all upper case.\n *\n * @param s\n * String.\n *\n * @returns\n * Lower case string.\n */\nfunction toLowerCase(s: string): string {\n // Words with no lower case letters are preserved as they are likely mnemonics.\n return s.split(\" \").map(word => /[a-z]/.test(word) ? word.toLowerCase() : word).join(\" \");\n}\n\n/**\n * Initialize internationalization.\n *\n * @param i18next\n * Internationalization object. As multiple objects exists, this parameter represents the one for the module for which\n * internationalization is being initialized.\n *\n * @param environment\n * Environment in which the application is running.\n *\n * @param debug\n * Debug setting.\n *\n * @param defaultNS\n * Default namespace.\n *\n * @param resources\n * Resources.\n *\n * @returns\n * Void promise.\n */\nexport async function i18nCoreInit(i18next: i18n, environment: I18nEnvironment, debug: boolean, defaultNS: string, ...resources: Resource[]): Promise<void> {\n // Initialization may be called more than once.\n if (!i18next.isInitialized) {\n const mergedResource: Resource = {};\n\n // Merge resources.\n for (const resource of resources) {\n // Merge languages.\n for (const [language, resourceLanguage] of Object.entries(resource)) {\n if (!(language in mergedResource)) {\n mergedResource[language] = {};\n }\n\n const mergedResourceLanguage = mergedResource[language];\n\n // Merge namespaces.\n for (const [namespace, resourceKey] of Object.entries(resourceLanguage)) {\n mergedResourceLanguage[namespace] = resourceKey;\n }\n }\n }\n\n let module: Parameters<typeof i18next.use>[0];\n\n switch (environment) {\n case I18nEnvironments.CLI:\n // TODO Refactor when https://github.com/neet/i18next-cli-language-detector/issues/281 resolved.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Per above.\n module = I18nextCLILanguageDetector as unknown as LanguageDetectorModule;\n break;\n\n case I18nEnvironments.Browser:\n module = I18nextBrowserLanguageDetector;\n break;\n\n default:\n throw new Error(\"Not supported\");\n }\n\n await i18next.use(module).init({\n debug,\n resources: mergedResource,\n fallbackLng: \"en\",\n defaultNS\n }).then(() => {\n // Add toLowerCase function.\n i18next.services.formatter?.add(\"toLowerCase\", value => typeof value === \"string\" ? toLowerCase(value) : String(value));\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACwBA,SAAS,WAA0E,UAAoB,MAAS,MAA4D;AAExK,SAAO,OAAO,YAAY,OAAO,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,KAAK,SAAS,GAAQ,MAAM,QAAQ,CAAC;AACvG;AAoBO,SAAS,KAA0C,MAAS,MAAuB;AACtF,SAAO,WAAW,MAAM,GAAG,GAAG,IAAI;AACtC;AAoBO,SAAS,KAA0C,MAAS,MAAuB;AACtF,SAAO,WAAW,OAAO,GAAG,GAAG,IAAI;AACvC;AAuBO,SAAS,WAAsE,GAAM,KAA2F;AAEnL,SAAQ,OAAO,IACX;AAAA;AAAA,IAEI,CAAC,GAAG,GAAG,EAAE,GAAG;AAAA,EAChB,IACA,CAAC;AAET;AAWO,SAAS,UAAU,UAAiD;AACvE,SAAO,aAAa,QAAQ,aAAa;AAC7C;;;ACpHA,mBAAuB;AAKhB,IAAM,YAAY;AAAA,EACrB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACX;AAqBO,SAAS,U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