@aidc-toolkit/core 1.0.25-beta → 1.0.26-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.cts DELETED
@@ -1,230 +0,0 @@
1
- import { Logger } from 'tslog';
2
- import { i18n, Resource } from 'i18next';
3
-
4
- /**
5
- * Typed function, applicable to any function, stricter than {@linkcode Function}.
6
- *
7
- * @template TFunction
8
- * Function type.
9
- */
10
- type TypedFunction<TFunction extends (...args: Parameters<TFunction>) => ReturnType<TFunction>> = (...args: Parameters<TFunction>) => ReturnType<TFunction>;
11
- /**
12
- * Typed synchronous function, applicable to any function that doesn't return a {@linkcode Promise}.
13
- *
14
- * @template TFunction
15
- * Function type.
16
- */
17
- type TypedSyncFunction<TFunction extends TypedFunction<TFunction>> = [ReturnType<TFunction>] extends [PromiseLike<unknown>] ? never : TypedFunction<TFunction>;
18
- /**
19
- * Determine the fundamental promised type. This is stricter than `Awaited<Type>` in that it requires a {@linkcode
20
- * Promise}.
21
- *
22
- * @template T
23
- * Promised type.
24
- */
25
- type PromisedType<T> = [T] extends [PromiseLike<infer TPromised>] ? TPromised : never;
26
- /**
27
- * Typed asynchronous function, applicable to any function that returns a {@linkcode Promise}.
28
- *
29
- * @template TFunction
30
- * Function type.
31
- */
32
- type TypedAsyncFunction<TMethod extends (...args: Parameters<TMethod>) => PromiseLike<PromisedType<ReturnType<TMethod>>>> = (...args: Parameters<TMethod>) => Promise<PromisedType<ReturnType<TMethod>>>;
33
- /**
34
- * Nullishable type. Extends a type by allowing `null` and `undefined`.
35
- *
36
- * @template T
37
- * Type.
38
- */
39
- type Nullishable<T> = T | null | undefined;
40
- /**
41
- * Non-nullishable type. If T is an object type, it is spread and attributes within it are made non-nullishable.
42
- * Equivalent to a deep `Required<T>` for an object and `NonNullable<T>` for any other type.
43
- *
44
- * @template T
45
- * Type.
46
- */
47
- type NonNullishable<T> = T extends object ? {
48
- [P in keyof T]-?: NonNullishable<T[P]>;
49
- } : NonNullable<T>;
50
- /**
51
- * Make some keys within a type optional.
52
- *
53
- * @template T
54
- * Object type.
55
- *
56
- * @template K
57
- * Object key type.
58
- */
59
- type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
60
- /**
61
- * Type to restrict property keys to those that are strings and that support a specified type.
62
- *
63
- * @template T
64
- * Object type.
65
- *
66
- * @template P
67
- * Object property type.
68
- */
69
- type PropertyKeys<T, P> = {
70
- [K in keyof T]: K extends string ? T[K] extends P ? K : never : never;
71
- }[keyof T];
72
-
73
- /**
74
- * Create an object with omitted entries.
75
- *
76
- * @template T
77
- * Object type.
78
- *
79
- * @template K
80
- * Object key type.
81
- *
82
- * @param o
83
- * Object.
84
- *
85
- * @param keys
86
- * Keys to omit.
87
- *
88
- * @returns
89
- * Edited object.
90
- */
91
- declare function omit<T extends object, K extends keyof T>(o: T, ...keys: K[]): Omit<T, K>;
92
- /**
93
- * Create an object with picked entries.
94
- *
95
- * @template T
96
- * Object type.
97
- *
98
- * @template K
99
- * Object key type.
100
- *
101
- * @param o
102
- * Object.
103
- *
104
- * @param keys
105
- * Keys to pick.
106
- *
107
- * @returns
108
- * Edited object.
109
- */
110
- declare function pick<T extends object, K extends keyof T>(o: T, ...keys: K[]): Pick<T, K>;
111
- /**
112
- * Cast a property as a more narrow type.
113
- *
114
- * @template T
115
- * Object type.
116
- *
117
- * @template K
118
- * Object key type.
119
- *
120
- * @template TAsType
121
- * Desired type.
122
- *
123
- * @param o
124
- * Object.
125
- *
126
- * @param key
127
- * Key of property to cast.
128
- *
129
- * @returns
130
- * Single-key object with property cast as desired type.
131
- */
132
- 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>>;
133
- /**
134
- * Determine if argument is nullish. Application extension may pass `null` or `undefined` to missing parameters.
135
- *
136
- * @param argument
137
- * Argument.
138
- *
139
- * @returns
140
- * True if argument is undefined or null.
141
- */
142
- declare function isNullish(argument: unknown): argument is null | undefined;
143
-
144
- /**
145
- * Log levels.
146
- */
147
- declare const LogLevels: {
148
- readonly Silly: 0;
149
- readonly Trace: 1;
150
- readonly Debug: 2;
151
- readonly Info: 3;
152
- readonly Warn: 4;
153
- readonly Error: 5;
154
- readonly Fatal: 6;
155
- };
156
- /**
157
- * Log level key.
158
- */
159
- type LogLevelKey = keyof typeof LogLevels;
160
- /**
161
- * Log level.
162
- */
163
- type LogLevel = typeof LogLevels[LogLevelKey];
164
- /**
165
- * Get a simple logger with an optional log level.
166
- *
167
- * @param logLevel
168
- * Log level as enumeration value or string.
169
- *
170
- * @returns
171
- * Logger.
172
- */
173
- declare function getLogger(logLevel?: string | number): Logger<unknown>;
174
-
175
- /**
176
- * Locale strings type for generic manipulation.
177
- */
178
- interface LocaleResources {
179
- [key: string]: LocaleResources | string;
180
- }
181
- /**
182
- * Internationalization operating environments.
183
- */
184
- declare const I18nEnvironments: {
185
- /**
186
- * Command-line interface (e.g., unit tests).
187
- */
188
- readonly CLI: 0;
189
- /**
190
- * Web server.
191
- */
192
- readonly Server: 1;
193
- /**
194
- * Web browser.
195
- */
196
- readonly Browser: 2;
197
- };
198
- /**
199
- * Internationalization operating environment key.
200
- */
201
- type I18nEnvironmentKey = keyof typeof I18nEnvironments;
202
- /**
203
- * Internationalization operating environment.
204
- */
205
- type I18nEnvironment = typeof I18nEnvironments[I18nEnvironmentKey];
206
- /**
207
- * Initialize internationalization.
208
- *
209
- * @param i18next
210
- * Internationalization object. As multiple objects exists, this parameter represents the one for the module for which
211
- * internationalization is being initialized.
212
- *
213
- * @param environment
214
- * Environment in which the application is running.
215
- *
216
- * @param debug
217
- * Debug setting.
218
- *
219
- * @param defaultNS
220
- * Default namespace.
221
- *
222
- * @param resources
223
- * Resources.
224
- *
225
- * @returns
226
- * Void promise.
227
- */
228
- declare function i18nCoreInit(i18next: i18n, environment: I18nEnvironment, debug: boolean, defaultNS: string, ...resources: Resource[]): Promise<void>;
229
-
230
- export { type I18nEnvironment, type I18nEnvironmentKey, I18nEnvironments, type LocaleResources, type LogLevel, type LogLevelKey, LogLevels, type NonNullishable, type Nullishable, type Optional, type PromisedType, type PropertyKeys, type TypedAsyncFunction, type TypedFunction, type TypedSyncFunction, getLogger, i18nCoreInit, isNullish, omit, pick, propertyAs };