alepha 0.9.4 → 0.10.0
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/LICENSE +21 -21
- package/README.md +47 -93
- package/batch.d.ts +491 -16
- package/bucket.d.ts +449 -12
- package/cache.d.ts +132 -1
- package/command.d.ts +32 -8
- package/core.d.ts +462 -369
- package/email.cjs +8 -0
- package/email.d.ts +328 -0
- package/email.js +1 -0
- package/lock.d.ts +412 -23
- package/logger.d.ts +83 -45
- package/package.json +62 -44
- package/postgres.d.ts +1731 -205
- package/queue/redis.d.ts +3 -3
- package/queue.d.ts +591 -8
- package/react/auth.d.ts +101 -112
- package/react/form.d.ts +14 -4
- package/react/head.d.ts +1 -1
- package/react/i18n.d.ts +13 -5
- package/react.d.ts +318 -180
- package/redis.d.ts +11 -11
- package/router.d.ts +1 -0
- package/security.d.ts +29 -29
- package/server/cache.d.ts +1 -0
- package/server/health.d.ts +6 -6
- package/server/links.d.ts +40 -29
- package/server/proxy.d.ts +192 -0
- package/server.d.ts +645 -88
- package/topic.d.ts +803 -12
- package/vite.d.ts +32 -4
package/react/auth.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _alepha_core4 from "alepha";
|
|
2
2
|
import { Alepha, AlephaError, Async, Descriptor, KIND, Static } from "alepha";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alepha_server_cookies0 from "alepha/server/cookies";
|
|
4
4
|
import { Cookies, ServerCookiesProvider } from "alepha/server/cookies";
|
|
5
5
|
import { DateTimeProvider } from "alepha/datetime";
|
|
6
6
|
import { AccessTokenResponse, RealmDescriptor, SecurityProvider, UserAccount, UserAccountToken } from "alepha/security";
|
|
@@ -8,22 +8,20 @@ import { Configuration } from "openid-client";
|
|
|
8
8
|
import * as _alepha_logger0 from "alepha/logger";
|
|
9
9
|
import * as _alepha_server0 from "alepha/server";
|
|
10
10
|
import { HttpClient } from "alepha/server";
|
|
11
|
-
import { HttpVirtualClient,
|
|
12
|
-
import * as
|
|
11
|
+
import { HttpVirtualClient, ServerLinksProvider } from "alepha/server/links";
|
|
12
|
+
import * as typebox143 from "typebox";
|
|
13
13
|
|
|
14
14
|
//#region src/schemas/tokensSchema.d.ts
|
|
15
|
-
declare const tokensSchema:
|
|
16
|
-
provider:
|
|
17
|
-
access_token:
|
|
18
|
-
issued_at:
|
|
19
|
-
expires_in:
|
|
20
|
-
refresh_token:
|
|
21
|
-
refresh_token_expires_in:
|
|
22
|
-
refresh_expires_in:
|
|
23
|
-
id_token:
|
|
24
|
-
scope:
|
|
25
|
-
token: _sinclair_typebox156.TOptional<_sinclair_typebox156.TString>;
|
|
26
|
-
realm: _sinclair_typebox156.TOptional<_sinclair_typebox156.TString>;
|
|
15
|
+
declare const tokensSchema: typebox143.TObject<{
|
|
16
|
+
provider: typebox143.TString;
|
|
17
|
+
access_token: typebox143.TString;
|
|
18
|
+
issued_at: typebox143.TNumber;
|
|
19
|
+
expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
20
|
+
refresh_token: typebox143.TOptional<typebox143.TString>;
|
|
21
|
+
refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
22
|
+
refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
23
|
+
id_token: typebox143.TOptional<typebox143.TString>;
|
|
24
|
+
scope: typebox143.TOptional<typebox143.TString>;
|
|
27
25
|
}>;
|
|
28
26
|
type Tokens = Static<typeof tokensSchema>;
|
|
29
27
|
//#endregion
|
|
@@ -34,7 +32,6 @@ type Tokens = Static<typeof tokensSchema>;
|
|
|
34
32
|
declare class ReactAuth {
|
|
35
33
|
protected readonly log: _alepha_logger0.Logger;
|
|
36
34
|
protected readonly alepha: Alepha;
|
|
37
|
-
protected readonly linkProvider: LinkProvider;
|
|
38
35
|
protected readonly httpClient: HttpClient;
|
|
39
36
|
static path: {
|
|
40
37
|
login: string;
|
|
@@ -45,7 +42,6 @@ declare class ReactAuth {
|
|
|
45
42
|
userinfo: string;
|
|
46
43
|
};
|
|
47
44
|
protected readonly onBeginTransition: _alepha_core4.HookDescriptor<"react:transition:begin">;
|
|
48
|
-
csrfCookie: _alepha_server_cookies1.AbstractCookieDescriptor<_sinclair_typebox156.TString>;
|
|
49
45
|
protected readonly onFetchRequest: _alepha_core4.HookDescriptor<"client:onRequest">;
|
|
50
46
|
get user(): UserAccountToken | undefined;
|
|
51
47
|
ping(): Promise<{
|
|
@@ -76,25 +72,23 @@ declare class ReactAuthProvider {
|
|
|
76
72
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
77
73
|
protected readonly serverLinksProvider: ServerLinksProvider;
|
|
78
74
|
protected readonly reactAuth: ReactAuth;
|
|
79
|
-
protected readonly authorizationCode:
|
|
80
|
-
provider:
|
|
81
|
-
codeVerifier:
|
|
82
|
-
redirectUri:
|
|
83
|
-
state:
|
|
84
|
-
nonce:
|
|
75
|
+
protected readonly authorizationCode: _alepha_server_cookies0.AbstractCookieDescriptor<typebox143.TObject<{
|
|
76
|
+
provider: typebox143.TString;
|
|
77
|
+
codeVerifier: typebox143.TOptional<typebox143.TString>;
|
|
78
|
+
redirectUri: typebox143.TOptional<typebox143.TString>;
|
|
79
|
+
state: typebox143.TOptional<typebox143.TString>;
|
|
80
|
+
nonce: typebox143.TOptional<typebox143.TString>;
|
|
85
81
|
}>>;
|
|
86
|
-
readonly tokens:
|
|
87
|
-
provider:
|
|
88
|
-
access_token:
|
|
89
|
-
issued_at:
|
|
90
|
-
expires_in:
|
|
91
|
-
refresh_token:
|
|
92
|
-
refresh_token_expires_in:
|
|
93
|
-
refresh_expires_in:
|
|
94
|
-
id_token:
|
|
95
|
-
scope:
|
|
96
|
-
token: _sinclair_typebox156.TOptional<_sinclair_typebox156.TString>;
|
|
97
|
-
realm: _sinclair_typebox156.TOptional<_sinclair_typebox156.TString>;
|
|
82
|
+
readonly tokens: _alepha_server_cookies0.AbstractCookieDescriptor<typebox143.TObject<{
|
|
83
|
+
provider: typebox143.TString;
|
|
84
|
+
access_token: typebox143.TString;
|
|
85
|
+
issued_at: typebox143.TNumber;
|
|
86
|
+
expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
87
|
+
refresh_token: typebox143.TOptional<typebox143.TString>;
|
|
88
|
+
refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
89
|
+
refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
90
|
+
id_token: typebox143.TOptional<typebox143.TString>;
|
|
91
|
+
scope: typebox143.TOptional<typebox143.TString>;
|
|
98
92
|
}>>;
|
|
99
93
|
readonly onRender: _alepha_core4.HookDescriptor<"react:server:render:begin">;
|
|
100
94
|
get identities(): Array<AuthDescriptor>;
|
|
@@ -109,32 +103,31 @@ declare class ReactAuthProvider {
|
|
|
109
103
|
* If the tokens are expired, try to refresh them using the refresh token.
|
|
110
104
|
*/
|
|
111
105
|
protected cookiesToTokens(cookies: Cookies): Promise<Tokens | undefined>;
|
|
112
|
-
protected checkCsrf(cookies: Cookies, csrfHeader: string): Promise<void>;
|
|
113
106
|
protected refreshTokens(tokens: Tokens): Promise<Tokens | undefined>;
|
|
114
107
|
/**
|
|
115
108
|
* Get user information.
|
|
116
109
|
*/
|
|
117
110
|
readonly userinfo: _alepha_server0.RouteDescriptor<{
|
|
118
|
-
response:
|
|
119
|
-
user:
|
|
120
|
-
id:
|
|
121
|
-
name:
|
|
122
|
-
email:
|
|
123
|
-
username:
|
|
124
|
-
picture:
|
|
125
|
-
sessionId:
|
|
126
|
-
organizations:
|
|
127
|
-
roles:
|
|
111
|
+
response: typebox143.TObject<{
|
|
112
|
+
user: typebox143.TOptional<typebox143.TObject<{
|
|
113
|
+
id: typebox143.TString;
|
|
114
|
+
name: typebox143.TOptional<typebox143.TString>;
|
|
115
|
+
email: typebox143.TOptional<typebox143.TString>;
|
|
116
|
+
username: typebox143.TOptional<typebox143.TString>;
|
|
117
|
+
picture: typebox143.TOptional<typebox143.TString>;
|
|
118
|
+
sessionId: typebox143.TOptional<typebox143.TString>;
|
|
119
|
+
organizations: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
|
|
120
|
+
roles: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
|
|
128
121
|
}>>;
|
|
129
|
-
api:
|
|
130
|
-
prefix:
|
|
131
|
-
links:
|
|
132
|
-
name:
|
|
133
|
-
group:
|
|
134
|
-
path:
|
|
135
|
-
method:
|
|
136
|
-
requestBodyType:
|
|
137
|
-
service:
|
|
122
|
+
api: typebox143.TObject<{
|
|
123
|
+
prefix: typebox143.TOptional<typebox143.TString>;
|
|
124
|
+
links: typebox143.TArray<typebox143.TObject<{
|
|
125
|
+
name: typebox143.TString;
|
|
126
|
+
group: typebox143.TOptional<typebox143.TString>;
|
|
127
|
+
path: typebox143.TString;
|
|
128
|
+
method: typebox143.TOptional<typebox143.TString>;
|
|
129
|
+
requestBodyType: typebox143.TOptional<typebox143.TString>;
|
|
130
|
+
service: typebox143.TOptional<typebox143.TString>;
|
|
138
131
|
}>>;
|
|
139
132
|
}>;
|
|
140
133
|
}>;
|
|
@@ -143,69 +136,65 @@ declare class ReactAuthProvider {
|
|
|
143
136
|
* Refresh a token for internal providers.
|
|
144
137
|
*/
|
|
145
138
|
readonly refresh: _alepha_server0.RouteDescriptor<{
|
|
146
|
-
query:
|
|
147
|
-
provider:
|
|
139
|
+
query: typebox143.TObject<{
|
|
140
|
+
provider: typebox143.TString;
|
|
148
141
|
}>;
|
|
149
|
-
body:
|
|
150
|
-
refresh_token:
|
|
151
|
-
access_token:
|
|
142
|
+
body: typebox143.TObject<{
|
|
143
|
+
refresh_token: typebox143.TString;
|
|
144
|
+
access_token: typebox143.TOptional<typebox143.TString>;
|
|
152
145
|
}>;
|
|
153
|
-
response:
|
|
154
|
-
provider:
|
|
155
|
-
access_token:
|
|
156
|
-
issued_at:
|
|
157
|
-
expires_in:
|
|
158
|
-
refresh_token:
|
|
159
|
-
refresh_token_expires_in:
|
|
160
|
-
refresh_expires_in:
|
|
161
|
-
id_token:
|
|
162
|
-
scope:
|
|
163
|
-
token: _sinclair_typebox156.TOptional<_sinclair_typebox156.TString>;
|
|
164
|
-
realm: _sinclair_typebox156.TOptional<_sinclair_typebox156.TString>;
|
|
146
|
+
response: typebox143.TObject<{
|
|
147
|
+
provider: typebox143.TString;
|
|
148
|
+
access_token: typebox143.TString;
|
|
149
|
+
issued_at: typebox143.TNumber;
|
|
150
|
+
expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
151
|
+
refresh_token: typebox143.TOptional<typebox143.TString>;
|
|
152
|
+
refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
153
|
+
refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
154
|
+
id_token: typebox143.TOptional<typebox143.TString>;
|
|
155
|
+
scope: typebox143.TOptional<typebox143.TString>;
|
|
165
156
|
}>;
|
|
166
157
|
}>;
|
|
167
158
|
/**
|
|
168
159
|
* Login for local password-based authentication.
|
|
169
160
|
*/
|
|
170
161
|
readonly token: _alepha_server0.RouteDescriptor<{
|
|
171
|
-
query:
|
|
172
|
-
provider:
|
|
162
|
+
query: typebox143.TObject<{
|
|
163
|
+
provider: typebox143.TString;
|
|
173
164
|
}>;
|
|
174
|
-
body:
|
|
175
|
-
username:
|
|
176
|
-
password:
|
|
165
|
+
body: typebox143.TObject<{
|
|
166
|
+
username: typebox143.TString;
|
|
167
|
+
password: typebox143.TString;
|
|
177
168
|
}>;
|
|
178
|
-
response:
|
|
179
|
-
provider:
|
|
180
|
-
access_token:
|
|
181
|
-
issued_at:
|
|
182
|
-
expires_in:
|
|
183
|
-
refresh_token:
|
|
184
|
-
refresh_token_expires_in:
|
|
185
|
-
refresh_expires_in:
|
|
186
|
-
id_token:
|
|
187
|
-
scope:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
organizations: _sinclair_typebox156.TOptional<_sinclair_typebox156.TArray<_sinclair_typebox156.TString>>;
|
|
198
|
-
roles: _sinclair_typebox156.TOptional<_sinclair_typebox156.TArray<_sinclair_typebox156.TString>>;
|
|
169
|
+
response: typebox143.TObject<{
|
|
170
|
+
provider: typebox143.TString;
|
|
171
|
+
access_token: typebox143.TString;
|
|
172
|
+
issued_at: typebox143.TNumber;
|
|
173
|
+
expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
174
|
+
refresh_token: typebox143.TOptional<typebox143.TString>;
|
|
175
|
+
refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
176
|
+
refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
177
|
+
id_token: typebox143.TOptional<typebox143.TString>;
|
|
178
|
+
scope: typebox143.TOptional<typebox143.TString>;
|
|
179
|
+
user: typebox143.TObject<{
|
|
180
|
+
id: typebox143.TString;
|
|
181
|
+
name: typebox143.TOptional<typebox143.TString>;
|
|
182
|
+
email: typebox143.TOptional<typebox143.TString>;
|
|
183
|
+
username: typebox143.TOptional<typebox143.TString>;
|
|
184
|
+
picture: typebox143.TOptional<typebox143.TString>;
|
|
185
|
+
sessionId: typebox143.TOptional<typebox143.TString>;
|
|
186
|
+
organizations: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
|
|
187
|
+
roles: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
|
|
199
188
|
}>;
|
|
200
|
-
api:
|
|
201
|
-
prefix:
|
|
202
|
-
links:
|
|
203
|
-
name:
|
|
204
|
-
group:
|
|
205
|
-
path:
|
|
206
|
-
method:
|
|
207
|
-
requestBodyType:
|
|
208
|
-
service:
|
|
189
|
+
api: typebox143.TObject<{
|
|
190
|
+
prefix: typebox143.TOptional<typebox143.TString>;
|
|
191
|
+
links: typebox143.TArray<typebox143.TObject<{
|
|
192
|
+
name: typebox143.TString;
|
|
193
|
+
group: typebox143.TOptional<typebox143.TString>;
|
|
194
|
+
path: typebox143.TString;
|
|
195
|
+
method: typebox143.TOptional<typebox143.TString>;
|
|
196
|
+
requestBodyType: typebox143.TOptional<typebox143.TString>;
|
|
197
|
+
service: typebox143.TOptional<typebox143.TString>;
|
|
209
198
|
}>>;
|
|
210
199
|
}>;
|
|
211
200
|
}>;
|
|
@@ -214,9 +203,9 @@ declare class ReactAuthProvider {
|
|
|
214
203
|
* Oauth2/OIDC login route.
|
|
215
204
|
*/
|
|
216
205
|
readonly login: _alepha_server0.RouteDescriptor<{
|
|
217
|
-
query:
|
|
218
|
-
provider:
|
|
219
|
-
redirect_uri:
|
|
206
|
+
query: typebox143.TObject<{
|
|
207
|
+
provider: typebox143.TString;
|
|
208
|
+
redirect_uri: typebox143.TOptional<typebox143.TString>;
|
|
220
209
|
}>;
|
|
221
210
|
}>;
|
|
222
211
|
/**
|
|
@@ -228,8 +217,8 @@ declare class ReactAuthProvider {
|
|
|
228
217
|
* Logout route for OAuth2/OIDC providers.
|
|
229
218
|
*/
|
|
230
219
|
readonly logout: _alepha_server0.RouteDescriptor<{
|
|
231
|
-
query:
|
|
232
|
-
post_logout_redirect_uri:
|
|
220
|
+
query: typebox143.TObject<{
|
|
221
|
+
post_logout_redirect_uri: typebox143.TOptional<typebox143.TString>;
|
|
233
222
|
}>;
|
|
234
223
|
}>;
|
|
235
224
|
protected provider(opts: string | {
|
package/react/form.d.ts
CHANGED
|
@@ -19,24 +19,29 @@ declare class FormModel<T extends TObject> {
|
|
|
19
19
|
parent: string;
|
|
20
20
|
store: Record<string, any>;
|
|
21
21
|
}): SchemaToInput<T>;
|
|
22
|
-
protected createInputFromSchema<T extends TObject>(name: keyof Static<T> & string, options: FormCtrlOptions<T>, schema:
|
|
22
|
+
protected createInputFromSchema<T extends TObject>(name: keyof Static<T> & string, options: FormCtrlOptions<T>, schema: TObject, required: boolean, context: {
|
|
23
23
|
parent: string;
|
|
24
24
|
store: Record<string, any>;
|
|
25
25
|
}): InputField;
|
|
26
|
+
/**
|
|
27
|
+
* Convert an input value from HTML to the correct type based on the schema.
|
|
28
|
+
*/
|
|
26
29
|
protected getValueFromInput(input: FormDataEntryValue, schema: TSchema): any;
|
|
27
30
|
protected valueToInputEntry(value: any): string | number | boolean;
|
|
28
31
|
}
|
|
29
32
|
type SchemaToInput<T extends TObject> = { [K in keyof T["properties"]]: T["properties"][K] extends TObject ? SchemaToInput<T["properties"][K]> : InputField };
|
|
30
33
|
interface FormEventLike {
|
|
31
|
-
currentTarget:
|
|
34
|
+
currentTarget: any;
|
|
32
35
|
preventDefault: () => void;
|
|
33
36
|
stopPropagation: () => void;
|
|
34
37
|
}
|
|
35
38
|
interface InputField {
|
|
36
39
|
path: string;
|
|
40
|
+
required: boolean;
|
|
37
41
|
props: InputHTMLAttributesLike;
|
|
38
42
|
schema: TSchema;
|
|
39
43
|
set: (value: any) => void;
|
|
44
|
+
form: FormModel<any>;
|
|
40
45
|
}
|
|
41
46
|
type InputHTMLAttributesLike = Pick<InputHTMLAttributes<unknown>, "id" | "name" | "type" | "value" | "defaultValue" | "required" | "maxLength" | "minLength" | "aria-label"> & {
|
|
42
47
|
value?: any;
|
|
@@ -127,13 +132,18 @@ interface UseFormStateReturn<T extends TObject> {
|
|
|
127
132
|
values?: T;
|
|
128
133
|
error?: Error;
|
|
129
134
|
}
|
|
130
|
-
|
|
135
|
+
type FormStateEvent = "change" | "submit" | "error";
|
|
136
|
+
declare const useFormState: <T extends TObject>(target: FormModel<T> | {
|
|
137
|
+
form: FormModel<T>;
|
|
138
|
+
path: string;
|
|
139
|
+
}, events?: FormStateEvent[]) => UseFormStateReturn<T>;
|
|
131
140
|
//#endregion
|
|
132
141
|
//#region src/index.d.ts
|
|
133
142
|
declare module "alepha" {
|
|
134
143
|
interface Hooks {
|
|
135
144
|
"form:change": {
|
|
136
145
|
id: string;
|
|
146
|
+
path: string;
|
|
137
147
|
};
|
|
138
148
|
"form:submit:begin": {
|
|
139
149
|
id: string;
|
|
@@ -163,5 +173,5 @@ declare module "alepha" {
|
|
|
163
173
|
*/
|
|
164
174
|
declare const AlephaReactForm: _alepha_core0.Service<_alepha_core0.Module>;
|
|
165
175
|
//#endregion
|
|
166
|
-
export { AlephaReactForm, FormCtrlOptions, FormEventLike, FormModel, FormState, InputField, InputHTMLAttributesLike, SchemaToInput, UseFormStateReturn, useForm, useFormState };
|
|
176
|
+
export { AlephaReactForm, FormCtrlOptions, FormEventLike, FormModel, FormState, FormStateEvent, InputField, InputHTMLAttributesLike, SchemaToInput, UseFormStateReturn, useForm, useFormState };
|
|
167
177
|
//# sourceMappingURL=index.d.ts.map
|
package/react/head.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ declare class HeadDescriptor extends Descriptor<HeadDescriptorOptions> {
|
|
|
84
84
|
* }
|
|
85
85
|
* ```
|
|
86
86
|
*/
|
|
87
|
-
declare const useHead: (options?: UseHeadOptions) =>
|
|
87
|
+
declare const useHead: (options?: UseHeadOptions) => UseHeadReturn;
|
|
88
88
|
type UseHeadOptions = Head | ((previous?: Head) => Head);
|
|
89
89
|
type UseHeadReturn = [Head, (head?: Head | ((previous?: Head) => Head)) => void];
|
|
90
90
|
//#endregion
|
package/react/i18n.d.ts
CHANGED
|
@@ -2,20 +2,25 @@ import * as _alepha_core1 from "alepha";
|
|
|
2
2
|
import { Alepha, Descriptor, KIND } from "alepha";
|
|
3
3
|
import * as _alepha_logger0 from "alepha/logger";
|
|
4
4
|
import * as _alepha_server_cookies0 from "alepha/server/cookies";
|
|
5
|
-
import * as
|
|
5
|
+
import * as typebox0 from "typebox";
|
|
6
6
|
|
|
7
7
|
//#region src/hooks/useI18n.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Hook to access the i18n service.
|
|
10
10
|
*/
|
|
11
|
-
declare const useI18n: <S extends object, K extends keyof ServiceDictionary<S>>() => I18nProvider<
|
|
11
|
+
declare const useI18n: <S extends object, K extends keyof ServiceDictionary<S>>() => I18nProvider<S, K> & {
|
|
12
|
+
tr(key: keyof ServiceDictionary<S>[K] | string, options?: {
|
|
13
|
+
args?: string[];
|
|
14
|
+
default?: string;
|
|
15
|
+
}): string;
|
|
16
|
+
};
|
|
12
17
|
type ServiceDictionary<T extends object> = { [K in keyof T]: T[K] extends DictionaryDescriptor<infer U> ? U : never };
|
|
13
18
|
//#endregion
|
|
14
19
|
//#region src/providers/I18nProvider.d.ts
|
|
15
20
|
declare class I18nProvider<S extends object, K extends keyof ServiceDictionary<S>> {
|
|
16
21
|
protected logger: _alepha_logger0.Logger;
|
|
17
22
|
protected alepha: Alepha;
|
|
18
|
-
protected cookie: _alepha_server_cookies0.AbstractCookieDescriptor<
|
|
23
|
+
protected cookie: _alepha_server_cookies0.AbstractCookieDescriptor<typebox0.TString>;
|
|
19
24
|
readonly registry: Array<{
|
|
20
25
|
name: string;
|
|
21
26
|
lang: string;
|
|
@@ -36,7 +41,10 @@ declare class I18nProvider<S extends object, K extends keyof ServiceDictionary<S
|
|
|
36
41
|
protected readonly mutate: _alepha_core1.HookDescriptor<"state:mutate">;
|
|
37
42
|
get lang(): string;
|
|
38
43
|
translate: (key: string, args?: string[]) => string;
|
|
39
|
-
readonly tr: (key: keyof ServiceDictionary<S>[K] | string,
|
|
44
|
+
readonly tr: (key: keyof ServiceDictionary<S>[K] | string, options?: {
|
|
45
|
+
args?: string[];
|
|
46
|
+
default?: string;
|
|
47
|
+
}) => string;
|
|
40
48
|
protected render(item: string, args: string[]): string;
|
|
41
49
|
}
|
|
42
50
|
//#endregion
|
|
@@ -49,7 +57,7 @@ declare class I18nProvider<S extends object, K extends keyof ServiceDictionary<S
|
|
|
49
57
|
*
|
|
50
58
|
* @example
|
|
51
59
|
* ```ts
|
|
52
|
-
* import { $dictionary } from "alepha/react
|
|
60
|
+
* import { $dictionary } from "alepha/react-i18n";
|
|
53
61
|
*
|
|
54
62
|
* const Example = () => {
|
|
55
63
|
* const { tr } = useI18n<App, "en">();
|