@alepha/react 0.13.7 → 0.14.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/dist/auth/index.d.ts +12 -1267
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/core/index.browser.js +22 -1
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +51 -1538
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +22 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +24 -2
- package/dist/core/index.native.js.map +1 -1
- package/dist/form/index.d.ts +6 -205
- package/dist/form/index.d.ts.map +1 -0
- package/dist/head/index.d.ts +5 -951
- package/dist/head/index.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +11 -280
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/websocket/index.d.ts +3 -159
- package/dist/websocket/index.d.ts.map +1 -0
- package/package.json +21 -23
- package/src/core/contexts/AlephaProvider.tsx +41 -0
- package/src/core/index.shared.ts +1 -0
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,1195 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Alepha
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import * as alepha2 from "alepha";
|
|
2
|
+
import { Alepha } from "alepha";
|
|
3
|
+
import * as alepha_logger0 from "alepha/logger";
|
|
4
|
+
import { HttpClient } from "alepha/server";
|
|
5
|
+
import { Tokens } from "alepha/server/auth";
|
|
6
|
+
import { HttpVirtualClient, LinkProvider } from "alepha/server/links";
|
|
7
|
+
import { UserAccount, UserAccountToken } from "alepha/security";
|
|
8
8
|
|
|
9
|
-
//#region ../../../alepha/src/security/schemas/userAccountInfoSchema.d.ts
|
|
10
|
-
declare const userAccountInfoSchema: alepha20.TObject<{
|
|
11
|
-
id: alepha20.TString;
|
|
12
|
-
name: alepha20.TOptional<alepha20.TString>;
|
|
13
|
-
email: alepha20.TOptional<alepha20.TString>;
|
|
14
|
-
username: alepha20.TOptional<alepha20.TString>;
|
|
15
|
-
picture: alepha20.TOptional<alepha20.TString>;
|
|
16
|
-
sessionId: alepha20.TOptional<alepha20.TString>;
|
|
17
|
-
organizations: alepha20.TOptional<alepha20.TArray<alepha20.TString>>;
|
|
18
|
-
roles: alepha20.TOptional<alepha20.TArray<alepha20.TString>>;
|
|
19
|
-
}>;
|
|
20
|
-
type UserAccount = Static<typeof userAccountInfoSchema>;
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region ../../../alepha/src/server/schemas/errorSchema.d.ts
|
|
23
|
-
declare const errorSchema: alepha20.TObject<{
|
|
24
|
-
error: alepha20.TString;
|
|
25
|
-
status: alepha20.TInteger;
|
|
26
|
-
message: alepha20.TString;
|
|
27
|
-
details: alepha20.TOptional<alepha20.TString>;
|
|
28
|
-
requestId: alepha20.TOptional<alepha20.TString>;
|
|
29
|
-
cause: alepha20.TOptional<alepha20.TObject<{
|
|
30
|
-
name: alepha20.TString;
|
|
31
|
-
message: alepha20.TString;
|
|
32
|
-
}>>;
|
|
33
|
-
}>;
|
|
34
|
-
type ErrorSchema = Static<typeof errorSchema>;
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region ../../../alepha/src/server/errors/HttpError.d.ts
|
|
37
|
-
declare class HttpError extends AlephaError {
|
|
38
|
-
name: string;
|
|
39
|
-
static is: (error: unknown, status?: number) => error is HttpErrorLike;
|
|
40
|
-
static toJSON(error: HttpError): ErrorSchema;
|
|
41
|
-
readonly error: string;
|
|
42
|
-
readonly status: number;
|
|
43
|
-
readonly requestId?: string;
|
|
44
|
-
readonly details?: string;
|
|
45
|
-
readonly reason?: {
|
|
46
|
-
name: string;
|
|
47
|
-
message: string;
|
|
48
|
-
};
|
|
49
|
-
constructor(options: Partial<ErrorSchema>, cause?: unknown);
|
|
50
|
-
}
|
|
51
|
-
interface HttpErrorLike extends Error {
|
|
52
|
-
status: number;
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region ../../../alepha/src/router/providers/RouterProvider.d.ts
|
|
56
|
-
declare abstract class RouterProvider<T extends Route = Route> {
|
|
57
|
-
protected routePathRegex: RegExp;
|
|
58
|
-
protected tree: Tree<T>;
|
|
59
|
-
protected cache: Map<string, RouteMatch<T>>;
|
|
60
|
-
match(path: string): RouteMatch<T>;
|
|
61
|
-
protected test(path: string): void;
|
|
62
|
-
protected push(route: T): void;
|
|
63
|
-
protected createRouteMatch(path: string): RouteMatch<T>;
|
|
64
|
-
protected mapParams(match: RouteMatch<T>): RouteMatch<T>;
|
|
65
|
-
protected createParts(path: string): string[];
|
|
66
|
-
}
|
|
67
|
-
interface RouteMatch<T extends Route> {
|
|
68
|
-
route?: T;
|
|
69
|
-
params?: Record<string, string>;
|
|
70
|
-
}
|
|
71
|
-
interface Route {
|
|
72
|
-
path: string;
|
|
73
|
-
/**
|
|
74
|
-
* Rename a param in the route.
|
|
75
|
-
* This is automatically filled when you have scenarios like:
|
|
76
|
-
* `/customers/:id` and `/customers/:userId/payments`
|
|
77
|
-
*
|
|
78
|
-
* In this case, `:id` will be renamed to `:userId` in the second route.
|
|
79
|
-
*/
|
|
80
|
-
mapParams?: Record<string, string>;
|
|
81
|
-
}
|
|
82
|
-
interface Tree<T extends Route> {
|
|
83
|
-
route?: T;
|
|
84
|
-
children: {
|
|
85
|
-
[key: string]: Tree<T>;
|
|
86
|
-
};
|
|
87
|
-
param?: {
|
|
88
|
-
route?: T;
|
|
89
|
-
name: string;
|
|
90
|
-
children: {
|
|
91
|
-
[key: string]: Tree<T>;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
wildcard?: {
|
|
95
|
-
route: T;
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region ../../../alepha/src/server/constants/routeMethods.d.ts
|
|
100
|
-
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
101
|
-
type RouteMethod = (typeof routeMethods)[number];
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region ../../../alepha/src/server/helpers/ServerReply.d.ts
|
|
104
|
-
/**
|
|
105
|
-
* Helper for building server replies.
|
|
106
|
-
*/
|
|
107
|
-
declare class ServerReply {
|
|
108
|
-
headers: Record<string, string> & {
|
|
109
|
-
"set-cookie"?: string[];
|
|
110
|
-
};
|
|
111
|
-
status?: number;
|
|
112
|
-
body?: any;
|
|
113
|
-
/**
|
|
114
|
-
* Redirect to a given URL with optional status code (default 302).
|
|
115
|
-
*/
|
|
116
|
-
redirect(url: string, status?: number): void;
|
|
117
|
-
/**
|
|
118
|
-
* Set the response status code.
|
|
119
|
-
*/
|
|
120
|
-
setStatus(status: number): this;
|
|
121
|
-
/**
|
|
122
|
-
* Set a response header.
|
|
123
|
-
*/
|
|
124
|
-
setHeader(name: string, value: string): this;
|
|
125
|
-
/**
|
|
126
|
-
* Set the response body.
|
|
127
|
-
*/
|
|
128
|
-
setBody(body: any): this;
|
|
129
|
-
}
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region ../../../alepha/src/server/services/UserAgentParser.d.ts
|
|
132
|
-
interface UserAgentInfo {
|
|
133
|
-
os: "Windows" | "Android" | "Ubuntu" | "MacOS" | "iOS" | "Linux" | "FreeBSD" | "OpenBSD" | "ChromeOS" | "BlackBerry" | "Symbian" | "Windows Phone";
|
|
134
|
-
browser: "Chrome" | "Firefox" | "Safari" | "Edge" | "Opera" | "Internet Explorer" | "Brave" | "Vivaldi" | "Samsung Browser" | "UC Browser" | "Yandex";
|
|
135
|
-
device: "MOBILE" | "DESKTOP" | "TABLET";
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Simple User-Agent parser to detect OS, browser, and device type.
|
|
139
|
-
* This parser is not exhaustive and may not cover all edge cases.
|
|
140
|
-
*
|
|
141
|
-
* Use result for non
|
|
142
|
-
*/
|
|
143
|
-
declare class UserAgentParser {
|
|
144
|
-
parse(userAgent?: string): UserAgentInfo;
|
|
145
|
-
}
|
|
146
|
-
//#endregion
|
|
147
|
-
//#region ../../../alepha/src/server/interfaces/ServerRequest.d.ts
|
|
148
|
-
type TRequestBody = TObject | TString | TArray | TRecord | TStream;
|
|
149
|
-
type TResponseBody = TObject | TString | TRecord | TFile | TArray | TStream | TVoid;
|
|
150
|
-
interface RequestConfigSchema {
|
|
151
|
-
body?: TRequestBody;
|
|
152
|
-
params?: TObject;
|
|
153
|
-
query?: TObject;
|
|
154
|
-
headers?: TObject;
|
|
155
|
-
response?: TResponseBody;
|
|
156
|
-
}
|
|
157
|
-
interface ServerRequestConfig<TConfig extends RequestConfigSchema = RequestConfigSchema> {
|
|
158
|
-
body: TConfig["body"] extends TRequestBody ? Static<TConfig["body"]> : any;
|
|
159
|
-
headers: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : Record<string, string>;
|
|
160
|
-
params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : Record<string, string>;
|
|
161
|
-
query: TConfig["query"] extends TObject ? Static<TConfig["query"]> : Record<string, any>;
|
|
162
|
-
}
|
|
163
|
-
type ServerRequestConfigEntry<TConfig extends RequestConfigSchema = RequestConfigSchema> = Partial<ServerRequestConfig<TConfig>>;
|
|
164
|
-
interface ServerRequest<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRequestConfig<TConfig> {
|
|
165
|
-
/**
|
|
166
|
-
* HTTP method used for this request.
|
|
167
|
-
*/
|
|
168
|
-
method: RouteMethod;
|
|
169
|
-
/**
|
|
170
|
-
* Full request URL.
|
|
171
|
-
*/
|
|
172
|
-
url: URL;
|
|
173
|
-
/**
|
|
174
|
-
* Unique request ID assigned to this request.
|
|
175
|
-
*/
|
|
176
|
-
requestId: string;
|
|
177
|
-
/**
|
|
178
|
-
* Client IP address.
|
|
179
|
-
* Will parse `X-Forwarded-For` header if present.
|
|
180
|
-
*/
|
|
181
|
-
ip?: string;
|
|
182
|
-
/**
|
|
183
|
-
* Value of the `Host` header sent by the client.
|
|
184
|
-
*/
|
|
185
|
-
host?: string;
|
|
186
|
-
/**
|
|
187
|
-
* Browser user agent information.
|
|
188
|
-
* Information are not guaranteed to be accurate. Use with caution.
|
|
189
|
-
*
|
|
190
|
-
* @see {@link UserAgentParser}
|
|
191
|
-
*/
|
|
192
|
-
userAgent: UserAgentInfo;
|
|
193
|
-
/**
|
|
194
|
-
* Arbitrary metadata attached to the request. Can be used by middlewares to store information.
|
|
195
|
-
*/
|
|
196
|
-
metadata: Record<string, any>;
|
|
197
|
-
/**
|
|
198
|
-
* Reply object to be used to send response.
|
|
199
|
-
*/
|
|
200
|
-
reply: ServerReply;
|
|
201
|
-
/**
|
|
202
|
-
* The raw underlying request object (Web Request).
|
|
203
|
-
*/
|
|
204
|
-
raw: ServerRawRequest;
|
|
205
|
-
}
|
|
206
|
-
interface ServerRoute<TConfig extends RequestConfigSchema = RequestConfigSchema> extends Route {
|
|
207
|
-
/**
|
|
208
|
-
* Handler function for this route.
|
|
209
|
-
*/
|
|
210
|
-
handler: ServerHandler<TConfig>;
|
|
211
|
-
/**
|
|
212
|
-
* HTTP method for this route.
|
|
213
|
-
*/
|
|
214
|
-
method?: RouteMethod;
|
|
215
|
-
/**
|
|
216
|
-
* Request/response schema for this route.
|
|
217
|
-
*
|
|
218
|
-
* Request schema contains:
|
|
219
|
-
* - body, for POST/PUT/PATCH requests
|
|
220
|
-
* - params, for URL parameters (e.g. /user/:id)
|
|
221
|
-
* - query, for URL query parameters (e.g. /user?id=123)
|
|
222
|
-
* - headers, for HTTP headers
|
|
223
|
-
*
|
|
224
|
-
* Response schema contains:
|
|
225
|
-
* - response
|
|
226
|
-
*
|
|
227
|
-
* Response schema is used to validate and serialize the response sent by the handler.
|
|
228
|
-
*/
|
|
229
|
-
schema?: TConfig;
|
|
230
|
-
/**
|
|
231
|
-
* @see ServerLoggerProvider
|
|
232
|
-
*/
|
|
233
|
-
silent?: boolean;
|
|
234
|
-
}
|
|
235
|
-
type ServerResponseBody<TConfig extends RequestConfigSchema = RequestConfigSchema> = TConfig["response"] extends TResponseBody ? Static<TConfig["response"]> : ResponseBodyType;
|
|
236
|
-
type ResponseKind = "json" | "text" | "void" | "file" | "any";
|
|
237
|
-
type ResponseBodyType = string | Buffer | StreamLike | undefined | null | void;
|
|
238
|
-
type ServerHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
|
|
239
|
-
interface ServerResponse$1 {
|
|
240
|
-
body: string | Buffer | ArrayBuffer | Readable | ReadableStream;
|
|
241
|
-
headers: Record<string, string>;
|
|
242
|
-
status: number;
|
|
243
|
-
}
|
|
244
|
-
type ServerRouteRequestHandler = (request: ServerRequestData) => Promise<ServerResponse$1>;
|
|
245
|
-
interface ServerRouteMatcher extends Route {
|
|
246
|
-
handler: ServerRouteRequestHandler;
|
|
247
|
-
}
|
|
248
|
-
interface ServerRequestData {
|
|
249
|
-
method: RouteMethod;
|
|
250
|
-
url: URL;
|
|
251
|
-
headers: Record<string, string>;
|
|
252
|
-
query: Record<string, string>;
|
|
253
|
-
params: Record<string, string>;
|
|
254
|
-
raw: ServerRawRequest;
|
|
255
|
-
}
|
|
256
|
-
interface ServerRawRequest {
|
|
257
|
-
node?: NodeRequestEvent;
|
|
258
|
-
web?: WebRequestEvent;
|
|
259
|
-
}
|
|
260
|
-
interface NodeRequestEvent {
|
|
261
|
-
req: IncomingMessage;
|
|
262
|
-
res: ServerResponse;
|
|
263
|
-
}
|
|
264
|
-
interface WebRequestEvent {
|
|
265
|
-
req: Request;
|
|
266
|
-
res?: Response;
|
|
267
|
-
}
|
|
268
|
-
//#endregion
|
|
269
|
-
//#region ../../../alepha/src/logger/schemas/logEntrySchema.d.ts
|
|
270
|
-
declare const logEntrySchema: alepha20.TObject<{
|
|
271
|
-
level: alepha20.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
|
|
272
|
-
message: alepha20.TString;
|
|
273
|
-
service: alepha20.TString;
|
|
274
|
-
module: alepha20.TString;
|
|
275
|
-
context: alepha20.TOptional<alepha20.TString>;
|
|
276
|
-
app: alepha20.TOptional<alepha20.TString>;
|
|
277
|
-
data: alepha20.TOptional<alepha20.TAny>;
|
|
278
|
-
timestamp: alepha20.TNumber;
|
|
279
|
-
}>;
|
|
280
|
-
type LogEntry = Static<typeof logEntrySchema>;
|
|
281
|
-
//#endregion
|
|
282
|
-
//#region ../../../alepha/src/datetime/providers/DateTimeProvider.d.ts
|
|
283
|
-
type DateTime = DayjsApi.Dayjs;
|
|
284
|
-
type Duration = dayjsDuration.Duration;
|
|
285
|
-
type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
|
|
286
|
-
declare class DateTimeProvider {
|
|
287
|
-
static PLUGINS: Array<PluginFunc<any>>;
|
|
288
|
-
protected alepha: Alepha;
|
|
289
|
-
protected ref: DateTime | null;
|
|
290
|
-
protected readonly timeouts: Timeout[];
|
|
291
|
-
protected readonly intervals: Interval[];
|
|
292
|
-
constructor();
|
|
293
|
-
protected readonly onStart: alepha20.HookPrimitive<"start">;
|
|
294
|
-
protected readonly onStop: alepha20.HookPrimitive<"stop">;
|
|
295
|
-
setLocale(locale: string): void;
|
|
296
|
-
isDateTime(value: unknown): value is DateTime;
|
|
297
|
-
/**
|
|
298
|
-
* Create a new UTC DateTime instance.
|
|
299
|
-
*/
|
|
300
|
-
utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
301
|
-
/**
|
|
302
|
-
* Create a new DateTime instance.
|
|
303
|
-
*/
|
|
304
|
-
of(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
305
|
-
/**
|
|
306
|
-
* Get the current date as a string.
|
|
307
|
-
*/
|
|
308
|
-
toISOString(date?: Date | string | DateTime): string;
|
|
309
|
-
/**
|
|
310
|
-
* Get the current date.
|
|
311
|
-
*/
|
|
312
|
-
now(): DateTime;
|
|
313
|
-
/**
|
|
314
|
-
* Get the current date as a string.
|
|
315
|
-
*
|
|
316
|
-
* This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
|
|
317
|
-
*/
|
|
318
|
-
nowISOString(): string;
|
|
319
|
-
/**
|
|
320
|
-
* Get the current date as milliseconds since epoch.
|
|
321
|
-
*
|
|
322
|
-
* This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
|
|
323
|
-
*/
|
|
324
|
-
nowMillis(): number;
|
|
325
|
-
/**
|
|
326
|
-
* Get the current date as a string.
|
|
327
|
-
*
|
|
328
|
-
* @protected
|
|
329
|
-
*/
|
|
330
|
-
protected getCurrentDate(): DateTime;
|
|
331
|
-
/**
|
|
332
|
-
* Create a new Duration instance.
|
|
333
|
-
*/
|
|
334
|
-
duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
|
|
335
|
-
isDurationLike(value: unknown): value is DurationLike;
|
|
336
|
-
/**
|
|
337
|
-
* Return a promise that resolves after the next tick.
|
|
338
|
-
* It uses `setTimeout` with 0 ms delay.
|
|
339
|
-
*/
|
|
340
|
-
tick(): Promise<void>;
|
|
341
|
-
/**
|
|
342
|
-
* Wait for a certain duration.
|
|
343
|
-
*
|
|
344
|
-
* You can clear the timeout by using the `AbortSignal` API.
|
|
345
|
-
* Aborted signal will resolve the promise immediately, it does not reject it.
|
|
346
|
-
*/
|
|
347
|
-
wait(duration: DurationLike, options?: {
|
|
348
|
-
signal?: AbortSignal;
|
|
349
|
-
now?: number;
|
|
350
|
-
}): Promise<void>;
|
|
351
|
-
createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
|
|
352
|
-
/**
|
|
353
|
-
* Run a callback after a certain duration.
|
|
354
|
-
*/
|
|
355
|
-
createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
|
|
356
|
-
clearTimeout(timeout: Timeout): void;
|
|
357
|
-
clearInterval(interval: Interval): void;
|
|
358
|
-
/**
|
|
359
|
-
* Run a function with a deadline.
|
|
360
|
-
*/
|
|
361
|
-
deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike): Promise<T>;
|
|
362
|
-
/**
|
|
363
|
-
* Add time to the current date.
|
|
364
|
-
*/
|
|
365
|
-
travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
|
|
366
|
-
/**
|
|
367
|
-
* Stop the time.
|
|
368
|
-
*/
|
|
369
|
-
pause(): DateTime;
|
|
370
|
-
/**
|
|
371
|
-
* Reset the reference date.
|
|
372
|
-
*/
|
|
373
|
-
reset(): void;
|
|
374
|
-
}
|
|
375
|
-
interface Interval {
|
|
376
|
-
timer?: any;
|
|
377
|
-
duration: number;
|
|
378
|
-
run: () => unknown;
|
|
379
|
-
}
|
|
380
|
-
interface Timeout {
|
|
381
|
-
now: number;
|
|
382
|
-
timer?: any;
|
|
383
|
-
duration: number;
|
|
384
|
-
callback: () => void;
|
|
385
|
-
clear: () => void;
|
|
386
|
-
}
|
|
387
|
-
//#endregion
|
|
388
|
-
//#region ../../../alepha/src/logger/providers/LogDestinationProvider.d.ts
|
|
389
|
-
declare abstract class LogDestinationProvider {
|
|
390
|
-
abstract write(message: string, entry: LogEntry): void;
|
|
391
|
-
}
|
|
392
|
-
//#endregion
|
|
393
|
-
//#region ../../../alepha/src/logger/providers/LogFormatterProvider.d.ts
|
|
394
|
-
declare abstract class LogFormatterProvider {
|
|
395
|
-
abstract format(entry: LogEntry): string;
|
|
396
|
-
}
|
|
397
|
-
//#endregion
|
|
398
|
-
//#region ../../../alepha/src/logger/services/Logger.d.ts
|
|
399
|
-
declare class Logger implements LoggerInterface {
|
|
400
|
-
protected readonly alepha: Alepha;
|
|
401
|
-
protected readonly formatter: LogFormatterProvider;
|
|
402
|
-
protected readonly destination: LogDestinationProvider;
|
|
403
|
-
protected readonly dateTimeProvider: DateTimeProvider;
|
|
404
|
-
protected readonly levels: Record<string, number>;
|
|
405
|
-
protected readonly service: string;
|
|
406
|
-
protected readonly module: string;
|
|
407
|
-
protected readonly app?: string;
|
|
408
|
-
protected appLogLevel: string;
|
|
409
|
-
protected logLevel: LogLevel;
|
|
410
|
-
constructor(service: string, module: string);
|
|
411
|
-
get context(): string | undefined;
|
|
412
|
-
get level(): string;
|
|
413
|
-
parseLevel(level: string, app: string): LogLevel;
|
|
414
|
-
private matchesPattern;
|
|
415
|
-
asLogLevel(something: string): LogLevel;
|
|
416
|
-
error(message: string, data?: unknown): void;
|
|
417
|
-
warn(message: string, data?: unknown): void;
|
|
418
|
-
info(message: string, data?: unknown): void;
|
|
419
|
-
debug(message: string, data?: unknown): void;
|
|
420
|
-
trace(message: string, data?: unknown): void;
|
|
421
|
-
protected log(level: LogLevel, message: string, data?: unknown): void;
|
|
422
|
-
protected emit(entry: LogEntry, message?: string): void;
|
|
423
|
-
}
|
|
424
|
-
//#endregion
|
|
425
|
-
//#region ../../../alepha/src/logger/index.d.ts
|
|
426
|
-
declare const envSchema$3: alepha20.TObject<{
|
|
427
|
-
/**
|
|
428
|
-
* Default log level for the application.
|
|
429
|
-
*
|
|
430
|
-
* Default by environment:
|
|
431
|
-
* - dev = info
|
|
432
|
-
* - prod = info
|
|
433
|
-
* - test = error
|
|
434
|
-
*
|
|
435
|
-
* Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
|
|
436
|
-
*
|
|
437
|
-
* Level can be set for a specific module:
|
|
438
|
-
*
|
|
439
|
-
* @example
|
|
440
|
-
* LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
|
|
441
|
-
* LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
|
|
442
|
-
*/
|
|
443
|
-
LOG_LEVEL: alepha20.TOptional<alepha20.TString>;
|
|
444
|
-
/**
|
|
445
|
-
* Built-in log formats.
|
|
446
|
-
* - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
|
|
447
|
-
* - "pretty" - Simple text format, human-readable, with colors. {@link PrettyFormatterProvider}
|
|
448
|
-
* - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
|
|
449
|
-
*/
|
|
450
|
-
LOG_FORMAT: alepha20.TOptional<alepha20.TUnsafe<"json" | "pretty" | "raw">>;
|
|
451
|
-
}>;
|
|
452
|
-
declare module "alepha" {
|
|
453
|
-
interface Env extends Partial<Static<typeof envSchema$3>> {}
|
|
454
|
-
interface State {
|
|
455
|
-
/**
|
|
456
|
-
* Current log level for the application or specific modules.
|
|
457
|
-
*/
|
|
458
|
-
"alepha.logger.level"?: string;
|
|
459
|
-
}
|
|
460
|
-
interface Hooks {
|
|
461
|
-
log: {
|
|
462
|
-
message?: string;
|
|
463
|
-
entry: LogEntry;
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
//#endregion
|
|
468
|
-
//#region ../../../alepha/src/server/services/ServerRequestParser.d.ts
|
|
469
|
-
declare class ServerRequestParser {
|
|
470
|
-
protected readonly alepha: Alepha;
|
|
471
|
-
protected readonly userAgentParser: UserAgentParser;
|
|
472
|
-
createServerRequest(rawRequest: ServerRequestData): ServerRequest;
|
|
473
|
-
getRequestId(request: ServerRequestData): string | undefined;
|
|
474
|
-
getRequestUserAgent(request: ServerRequestData): UserAgentInfo;
|
|
475
|
-
getRequestIp(request: ServerRequestData): string | undefined;
|
|
476
|
-
}
|
|
477
|
-
//#endregion
|
|
478
|
-
//#region ../../../alepha/src/server/providers/ServerTimingProvider.d.ts
|
|
479
|
-
type TimingMap = Record<string, [number, number]>;
|
|
480
|
-
declare class ServerTimingProvider {
|
|
481
|
-
protected readonly log: Logger;
|
|
482
|
-
protected readonly alepha: Alepha;
|
|
483
|
-
options: {
|
|
484
|
-
prefix: string;
|
|
485
|
-
disabled: boolean;
|
|
486
|
-
};
|
|
487
|
-
readonly onRequest: alepha20.HookPrimitive<"server:onRequest">;
|
|
488
|
-
readonly onResponse: alepha20.HookPrimitive<"server:onResponse">;
|
|
489
|
-
protected get handlerName(): string;
|
|
490
|
-
beginTiming(name: string): void;
|
|
491
|
-
endTiming(name: string): void;
|
|
492
|
-
protected setDuration(name: string, timing: TimingMap): void;
|
|
493
|
-
}
|
|
494
|
-
//#endregion
|
|
495
|
-
//#region ../../../alepha/src/server/providers/ServerRouterProvider.d.ts
|
|
496
|
-
/**
|
|
497
|
-
* Main router for all routes on the server side.
|
|
498
|
-
*
|
|
499
|
-
* - $route => generic route
|
|
500
|
-
* - $action => action route (for API calls)
|
|
501
|
-
* - $page => React route (for SSR)
|
|
502
|
-
*/
|
|
503
|
-
declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
|
|
504
|
-
protected readonly log: Logger;
|
|
505
|
-
protected readonly alepha: Alepha;
|
|
506
|
-
protected readonly routes: ServerRoute[];
|
|
507
|
-
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
508
|
-
protected readonly serverRequestParser: ServerRequestParser;
|
|
509
|
-
/**
|
|
510
|
-
* Get all registered routes, optionally filtered by a pattern.
|
|
511
|
-
*
|
|
512
|
-
* Pattern accept simple wildcard '*' at the end.
|
|
513
|
-
* Example: '/api/*' will match all routes starting with '/api/' but '/api/' will match only that exact route.
|
|
514
|
-
*/
|
|
515
|
-
getRoutes(pattern?: string): ServerRoute[];
|
|
516
|
-
createRoute<TConfig extends RequestConfigSchema = RequestConfigSchema>(route: ServerRoute<TConfig>): void;
|
|
517
|
-
protected getContextId(headers: Record<string, string>): string;
|
|
518
|
-
protected processRequest(request: ServerRequest, route: ServerRoute, responseKind: ResponseKind): Promise<{
|
|
519
|
-
status: number;
|
|
520
|
-
headers: Record<string, string> & {
|
|
521
|
-
"set-cookie"?: string[];
|
|
522
|
-
};
|
|
523
|
-
body: any;
|
|
524
|
-
}>;
|
|
525
|
-
protected runRouteHandler(route: ServerRoute, request: ServerRequest, responseKind: ResponseKind): Promise<void>;
|
|
526
|
-
serializeResponse(route: ServerRoute, reply: ServerReply, responseKind: ResponseKind): void;
|
|
527
|
-
protected getResponseType(schema?: RequestConfigSchema): ResponseKind;
|
|
528
|
-
protected errorHandler(route: ServerRoute, request: ServerRequest, error: Error): Promise<void>;
|
|
529
|
-
validateRequest(route: {
|
|
530
|
-
schema?: RequestConfigSchema;
|
|
531
|
-
}, request: ServerRequestConfig): void;
|
|
532
|
-
}
|
|
533
|
-
//#endregion
|
|
534
|
-
//#region ../../../alepha/src/server/providers/ServerProvider.d.ts
|
|
535
|
-
/**
|
|
536
|
-
* Base server provider to handle incoming requests and route them.
|
|
537
|
-
*
|
|
538
|
-
* This is the default implementation for serverless environments.
|
|
539
|
-
*
|
|
540
|
-
* ServerProvider supports both Node.js HTTP requests and Web (Fetch API) requests.
|
|
541
|
-
*/
|
|
542
|
-
declare class ServerProvider {
|
|
543
|
-
protected readonly log: Logger;
|
|
544
|
-
protected readonly alepha: Alepha;
|
|
545
|
-
protected readonly dateTimeProvider: DateTimeProvider;
|
|
546
|
-
protected readonly router: ServerRouterProvider;
|
|
547
|
-
protected readonly internalServerErrorMessage = "Internal Server Error";
|
|
548
|
-
get hostname(): string;
|
|
549
|
-
/**
|
|
550
|
-
* When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
|
|
551
|
-
*/
|
|
552
|
-
protected readonly onNodeRequest: alepha20.HookPrimitive<"node:request">;
|
|
553
|
-
/**
|
|
554
|
-
* When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
|
|
555
|
-
*/
|
|
556
|
-
protected readonly onWebRequest: alepha20.HookPrimitive<"web:request">;
|
|
557
|
-
/**
|
|
558
|
-
* Handle Node.js HTTP request event.
|
|
559
|
-
*
|
|
560
|
-
* Technically, we just convert Node.js request to Web Standard Request.
|
|
561
|
-
*/
|
|
562
|
-
handleNodeRequest(nodeRequestEvent: NodeRequestEvent): Promise<void>;
|
|
563
|
-
/**
|
|
564
|
-
* Handle Web (Fetch API) request event.
|
|
565
|
-
*/
|
|
566
|
-
handleWebRequest(ev: WebRequestEvent): Promise<void>;
|
|
567
|
-
/**
|
|
568
|
-
* Helper for Vite development mode to let Vite handle (or not) 404.
|
|
569
|
-
*/
|
|
570
|
-
protected isViteNotFound(url?: string, route?: Route, params?: Record<string, string>): boolean;
|
|
571
|
-
}
|
|
572
|
-
//#endregion
|
|
573
|
-
//#region ../../../alepha/src/cache/providers/CacheProvider.d.ts
|
|
574
|
-
/**
|
|
575
|
-
* Cache provider interface.
|
|
576
|
-
*
|
|
577
|
-
* All methods are asynchronous and return promises.
|
|
578
|
-
* Values are stored as Uint8Array.
|
|
579
|
-
*/
|
|
580
|
-
declare abstract class CacheProvider {
|
|
581
|
-
/**
|
|
582
|
-
* Get the value of a key.
|
|
583
|
-
*
|
|
584
|
-
* @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
|
|
585
|
-
* @param key The key of the value to get.
|
|
586
|
-
*
|
|
587
|
-
* @return The value of the key, or undefined if the key does not exist.
|
|
588
|
-
*/
|
|
589
|
-
abstract get(name: string, key: string): Promise<Uint8Array | undefined>;
|
|
590
|
-
/**
|
|
591
|
-
* Set the string value of a key.
|
|
592
|
-
*
|
|
593
|
-
* @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
|
|
594
|
-
* @param key The key of the value to set.
|
|
595
|
-
* @param value The value to set.
|
|
596
|
-
* @param ttl The time-to-live of the key, in milliseconds.
|
|
597
|
-
*
|
|
598
|
-
* @return The value of the key.
|
|
599
|
-
*/
|
|
600
|
-
abstract set(name: string, key: string, value: Uint8Array, ttl?: number): Promise<Uint8Array>;
|
|
601
|
-
/**
|
|
602
|
-
* Remove the specified keys.
|
|
603
|
-
*
|
|
604
|
-
* @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
|
|
605
|
-
* @param keys The keys to delete.
|
|
606
|
-
*/
|
|
607
|
-
abstract del(name: string, ...keys: string[]): Promise<void>;
|
|
608
|
-
abstract has(name: string, key: string): Promise<boolean>;
|
|
609
|
-
abstract keys(name: string, filter?: string): Promise<string[]>;
|
|
610
|
-
/**
|
|
611
|
-
* Remove all keys from all cache names.
|
|
612
|
-
*/
|
|
613
|
-
abstract clear(): Promise<void>;
|
|
614
|
-
}
|
|
615
|
-
//#endregion
|
|
616
|
-
//#region ../../../alepha/src/cache/primitives/$cache.d.ts
|
|
617
|
-
interface CachePrimitiveOptions<TReturn = any, TParameter extends any[] = any[]> {
|
|
618
|
-
/**
|
|
619
|
-
* The cache name. This is useful for invalidating multiple caches at once.
|
|
620
|
-
*
|
|
621
|
-
* Store key as `cache:$name:$key`.
|
|
622
|
-
*
|
|
623
|
-
* @default Name of the key of the class.
|
|
624
|
-
*/
|
|
625
|
-
name?: string;
|
|
626
|
-
/**
|
|
627
|
-
* Function which returns cached data.
|
|
628
|
-
*/
|
|
629
|
-
handler?: (...args: TParameter) => TReturn;
|
|
630
|
-
/**
|
|
631
|
-
* The key generator for the cache.
|
|
632
|
-
* If not provided, the arguments will be json.stringify().
|
|
633
|
-
*/
|
|
634
|
-
key?: (...args: TParameter) => string;
|
|
635
|
-
/**
|
|
636
|
-
* The store provider for the cache.
|
|
637
|
-
* If not provided, the default store provider will be used.
|
|
638
|
-
*/
|
|
639
|
-
provider?: InstantiableClass<CacheProvider> | "memory";
|
|
640
|
-
/**
|
|
641
|
-
* The time-to-live for the cache in seconds.
|
|
642
|
-
* Set 0 to skip expiration.
|
|
643
|
-
*
|
|
644
|
-
* @default 300 (5 minutes).
|
|
645
|
-
*/
|
|
646
|
-
ttl?: DurationLike;
|
|
647
|
-
/**
|
|
648
|
-
* If the cache is disabled.
|
|
649
|
-
*/
|
|
650
|
-
disabled?: boolean;
|
|
651
|
-
}
|
|
652
|
-
declare class CachePrimitive<TReturn = any, TParameter extends any[] = any[]> extends Primitive<CachePrimitiveOptions<TReturn, TParameter>> {
|
|
653
|
-
protected readonly env: {
|
|
654
|
-
CACHE_ENABLED: boolean;
|
|
655
|
-
CACHE_DEFAULT_TTL: number;
|
|
656
|
-
};
|
|
657
|
-
protected readonly dateTimeProvider: DateTimeProvider;
|
|
658
|
-
protected readonly provider: CacheProvider;
|
|
659
|
-
protected encoder: TextEncoder;
|
|
660
|
-
protected decoder: TextDecoder;
|
|
661
|
-
protected codes: {
|
|
662
|
-
BINARY: number;
|
|
663
|
-
JSON: number;
|
|
664
|
-
STRING: number;
|
|
665
|
-
};
|
|
666
|
-
get container(): string;
|
|
667
|
-
run(...args: TParameter): Promise<TReturn>;
|
|
668
|
-
key(...args: TParameter): string;
|
|
669
|
-
invalidate(...keys: string[]): Promise<void>;
|
|
670
|
-
set(key: string, value: TReturn, ttl?: DurationLike): Promise<void>;
|
|
671
|
-
get(key: string): Promise<TReturn | undefined>;
|
|
672
|
-
protected serialize<TReturn>(value: TReturn): Uint8Array;
|
|
673
|
-
protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
|
|
674
|
-
protected $provider(): CacheProvider;
|
|
675
|
-
}
|
|
676
|
-
interface CachePrimitiveFn<TReturn = any, TParameter extends any[] = any[]> extends CachePrimitive<TReturn, TParameter> {
|
|
677
|
-
/**
|
|
678
|
-
* Run the cache primitive with the provided arguments.
|
|
679
|
-
*/
|
|
680
|
-
(...args: TParameter): Promise<TReturn>;
|
|
681
|
-
}
|
|
682
|
-
//#endregion
|
|
683
|
-
//#region ../../../alepha/src/server/services/HttpClient.d.ts
|
|
684
|
-
declare class HttpClient {
|
|
685
|
-
protected readonly log: Logger;
|
|
686
|
-
protected readonly alepha: Alepha;
|
|
687
|
-
readonly cache: CachePrimitiveFn<HttpClientCache, any[]>;
|
|
688
|
-
protected readonly pendingRequests: HttpClientPendingRequests;
|
|
689
|
-
fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
|
|
690
|
-
fetch<T extends TSchema>(url: string, request?: RequestInitWithOptions<T>): Promise<FetchResponse<Static<T>>>;
|
|
691
|
-
protected url(host: string, action: HttpAction, args: ServerRequestConfigEntry): string;
|
|
692
|
-
protected body(init: RequestInit, headers: Record<string, string>, action: HttpAction, args?: ServerRequestConfigEntry): Promise<void>;
|
|
693
|
-
protected responseData(response: Response, options: FetchOptions): Promise<any>;
|
|
694
|
-
protected isMaybeFile(response: Response): boolean;
|
|
695
|
-
protected createFileLike(response: Response, defaultFileName?: string): FileLike;
|
|
696
|
-
pathVariables(url: string, action: {
|
|
697
|
-
schema?: {
|
|
698
|
-
params?: TObject;
|
|
699
|
-
};
|
|
700
|
-
}, args?: ServerRequestConfigEntry): string;
|
|
701
|
-
queryParams(url: string, action: {
|
|
702
|
-
schema?: {
|
|
703
|
-
query?: TObject;
|
|
704
|
-
};
|
|
705
|
-
}, args?: ServerRequestConfigEntry): string;
|
|
706
|
-
}
|
|
707
|
-
interface FetchOptions<T extends TSchema = TSchema> {
|
|
708
|
-
/**
|
|
709
|
-
* Key to identify the request in the pending requests.
|
|
710
|
-
*/
|
|
711
|
-
key?: string;
|
|
712
|
-
/**
|
|
713
|
-
* The schema to validate the response against.
|
|
714
|
-
*/
|
|
715
|
-
schema?: {
|
|
716
|
-
response?: T;
|
|
717
|
-
};
|
|
718
|
-
/**
|
|
719
|
-
* Built-in cache options.
|
|
720
|
-
*/
|
|
721
|
-
localCache?: boolean | number | DurationLike;
|
|
722
|
-
}
|
|
723
|
-
type RequestInitWithOptions<T extends TSchema = TSchema> = RequestInit & FetchOptions<T>;
|
|
724
|
-
interface FetchResponse<T = any> {
|
|
725
|
-
data: T;
|
|
726
|
-
status: number;
|
|
727
|
-
statusText: string;
|
|
728
|
-
headers: Headers;
|
|
729
|
-
raw?: Response;
|
|
730
|
-
}
|
|
731
|
-
type HttpClientPendingRequests = Record<string, Promise<any> | undefined>;
|
|
732
|
-
interface HttpClientCache {
|
|
733
|
-
data: any;
|
|
734
|
-
etag?: string;
|
|
735
|
-
}
|
|
736
|
-
interface FetchActionArgs {
|
|
737
|
-
action: HttpAction;
|
|
738
|
-
host?: string;
|
|
739
|
-
config?: ServerRequestConfigEntry;
|
|
740
|
-
options?: ClientRequestOptions;
|
|
741
|
-
}
|
|
742
|
-
interface HttpAction {
|
|
743
|
-
method?: string;
|
|
744
|
-
prefix?: string;
|
|
745
|
-
path: string;
|
|
746
|
-
requestBodyType?: string;
|
|
747
|
-
schema?: {
|
|
748
|
-
params?: TObject;
|
|
749
|
-
query?: TObject;
|
|
750
|
-
body?: TRequestBody;
|
|
751
|
-
response?: TResponseBody;
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
//#endregion
|
|
755
|
-
//#region ../../../alepha/src/server/primitives/$action.d.ts
|
|
756
|
-
interface ActionPrimitiveOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
|
|
757
|
-
/**
|
|
758
|
-
* Name of the action.
|
|
759
|
-
*
|
|
760
|
-
* - It will be used to generate the route path if `path` is not provided.
|
|
761
|
-
* - It will be used to generate the permission name if `security` is enabled.
|
|
762
|
-
*/
|
|
763
|
-
name?: string;
|
|
764
|
-
/**
|
|
765
|
-
* Group actions together.
|
|
766
|
-
*
|
|
767
|
-
* - If not provided, the service name containing the route will be used.
|
|
768
|
-
* - It will be used as Tag for documentation purposes.
|
|
769
|
-
* - It will be used for permission name generation if `security` is enabled.
|
|
770
|
-
*
|
|
771
|
-
* @example
|
|
772
|
-
* ```ts
|
|
773
|
-
* // group = "MyController"
|
|
774
|
-
* class MyController {
|
|
775
|
-
* hello = $action({ handler: () => "Hello World" });
|
|
776
|
-
* }
|
|
777
|
-
*
|
|
778
|
-
* // group = "users"
|
|
779
|
-
* class MyOtherController {
|
|
780
|
-
* group = "users";
|
|
781
|
-
* a1 = $action({ handler: () => "Action 1", group: this.group });
|
|
782
|
-
* a2 = $action({ handler: () => "Action 2", group: this.group });
|
|
783
|
-
* }
|
|
784
|
-
* ```
|
|
785
|
-
*/
|
|
786
|
-
group?: string;
|
|
787
|
-
/**
|
|
788
|
-
* Pathname of the route. If not provided, property key is used.
|
|
789
|
-
*/
|
|
790
|
-
path?: string;
|
|
791
|
-
/**
|
|
792
|
-
* The route method.
|
|
793
|
-
*
|
|
794
|
-
* - If not provided, it will be set to "GET" by default.
|
|
795
|
-
* - If not provider and a body is provided, it will be set to "POST".
|
|
796
|
-
*
|
|
797
|
-
* Wildcard methods are not supported for now. (e.g. "ALL", "ANY", etc.)
|
|
798
|
-
*/
|
|
799
|
-
method?: RouteMethod;
|
|
800
|
-
/**
|
|
801
|
-
* The config schema of the route.
|
|
802
|
-
* - body: The request body schema.
|
|
803
|
-
* - params: Path variables schema.
|
|
804
|
-
* - query: The request query-params schema.
|
|
805
|
-
* - response: The response schema.
|
|
806
|
-
*/
|
|
807
|
-
schema?: TConfig;
|
|
808
|
-
/**
|
|
809
|
-
* A short description of the action. Used for documentation purposes.
|
|
810
|
-
*/
|
|
811
|
-
description?: string;
|
|
812
|
-
/**
|
|
813
|
-
* Disable the route. Useful with env variables do disable one specific route.
|
|
814
|
-
* Route won't be available in the API but can still be called locally!
|
|
815
|
-
*/
|
|
816
|
-
disabled?: boolean;
|
|
817
|
-
/**
|
|
818
|
-
* Main route handler. This is where the route logic is implemented.
|
|
819
|
-
*/
|
|
820
|
-
handler: ServerActionHandler<TConfig>;
|
|
821
|
-
}
|
|
822
|
-
declare class ActionPrimitive<TConfig extends RequestConfigSchema> extends Primitive<ActionPrimitiveOptions<TConfig>> {
|
|
823
|
-
protected readonly log: Logger;
|
|
824
|
-
protected readonly env: {
|
|
825
|
-
SERVER_API_PREFIX: string;
|
|
826
|
-
};
|
|
827
|
-
protected readonly httpClient: HttpClient;
|
|
828
|
-
protected readonly serverProvider: ServerProvider;
|
|
829
|
-
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
830
|
-
protected onInit(): void;
|
|
831
|
-
get prefix(): string;
|
|
832
|
-
get route(): ServerRoute;
|
|
833
|
-
/**
|
|
834
|
-
* Returns the name of the action.
|
|
835
|
-
*/
|
|
836
|
-
get name(): string;
|
|
837
|
-
/**
|
|
838
|
-
* Returns the group of the action. (e.g. "orders", "admin", etc.)
|
|
839
|
-
*/
|
|
840
|
-
get group(): string;
|
|
841
|
-
/**
|
|
842
|
-
* Returns the HTTP method of the action.
|
|
843
|
-
*/
|
|
844
|
-
get method(): RouteMethod;
|
|
845
|
-
/**
|
|
846
|
-
* Returns the path of the action.
|
|
847
|
-
*
|
|
848
|
-
* Path is prefixed by `/api` by default.
|
|
849
|
-
*/
|
|
850
|
-
get path(): string;
|
|
851
|
-
get schema(): TConfig | undefined;
|
|
852
|
-
getBodyContentType(): string | undefined;
|
|
853
|
-
/**
|
|
854
|
-
* Call the action handler directly.
|
|
855
|
-
* There is no HTTP layer involved.
|
|
856
|
-
*/
|
|
857
|
-
run(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
|
|
858
|
-
/**
|
|
859
|
-
* Works like `run`, but always fetches (http request) the route.
|
|
860
|
-
*/
|
|
861
|
-
fetch(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<FetchResponse<ClientRequestResponse<TConfig>>>;
|
|
862
|
-
}
|
|
863
|
-
type ClientRequestEntry<TConfig extends RequestConfigSchema, T = ClientRequestEntryContainer<TConfig>> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K] };
|
|
864
|
-
type ClientRequestEntryContainer<TConfig extends RequestConfigSchema> = {
|
|
865
|
-
body: TConfig["body"] extends TObject ? Static<TConfig["body"]> : undefined;
|
|
866
|
-
params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : undefined;
|
|
867
|
-
headers?: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : undefined;
|
|
868
|
-
query?: TConfig["query"] extends TObject ? Partial<Static<TConfig["query"]>> : undefined;
|
|
869
|
-
};
|
|
870
|
-
interface ClientRequestOptions extends FetchOptions {
|
|
871
|
-
/**
|
|
872
|
-
* Standard request fetch options.
|
|
873
|
-
*/
|
|
874
|
-
request?: RequestInit;
|
|
875
|
-
}
|
|
876
|
-
type ClientRequestResponse<TConfig extends RequestConfigSchema> = TConfig["response"] extends TSchema ? Static<TConfig["response"]> : any;
|
|
877
|
-
/**
|
|
878
|
-
* Specific handler for server actions.
|
|
879
|
-
*/
|
|
880
|
-
type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerActionRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
|
|
881
|
-
/**
|
|
882
|
-
* Server Action Request Interface
|
|
883
|
-
*
|
|
884
|
-
* Can be extended with module augmentation to add custom properties (like `user` in Server Security).
|
|
885
|
-
*
|
|
886
|
-
* This is NOT Server Request, but a specific type for actions.
|
|
887
|
-
*/
|
|
888
|
-
interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
|
|
889
|
-
//#endregion
|
|
890
|
-
//#region ../../../alepha/src/server/providers/BunHttpServerProvider.d.ts
|
|
891
|
-
declare const envSchema$2: alepha20.TObject<{
|
|
892
|
-
SERVER_PORT: alepha20.TInteger;
|
|
893
|
-
SERVER_HOST: alepha20.TString;
|
|
894
|
-
}>;
|
|
895
|
-
declare module "alepha" {
|
|
896
|
-
interface Env extends Partial<Static<typeof envSchema$2>> {}
|
|
897
|
-
}
|
|
898
|
-
//#endregion
|
|
899
|
-
//#region ../../../alepha/src/server/providers/NodeHttpServerProvider.d.ts
|
|
900
|
-
declare const envSchema$1: alepha20.TObject<{
|
|
901
|
-
SERVER_PORT: alepha20.TInteger;
|
|
902
|
-
SERVER_HOST: alepha20.TString;
|
|
903
|
-
}>;
|
|
904
|
-
declare module "alepha" {
|
|
905
|
-
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
906
|
-
}
|
|
907
|
-
//#endregion
|
|
908
|
-
//#region ../../../alepha/src/server/index.d.ts
|
|
909
|
-
declare module "alepha" {
|
|
910
|
-
interface State {
|
|
911
|
-
"alepha.node.server"?: Server;
|
|
912
|
-
}
|
|
913
|
-
interface Hooks {
|
|
914
|
-
"action:onRequest": {
|
|
915
|
-
action: ActionPrimitive<RequestConfigSchema>;
|
|
916
|
-
request: ServerRequest;
|
|
917
|
-
options: ClientRequestOptions;
|
|
918
|
-
};
|
|
919
|
-
"action:onResponse": {
|
|
920
|
-
action: ActionPrimitive<RequestConfigSchema>;
|
|
921
|
-
request: ServerRequest;
|
|
922
|
-
options: ClientRequestOptions;
|
|
923
|
-
response: any;
|
|
924
|
-
};
|
|
925
|
-
"server:onRequest": {
|
|
926
|
-
route: ServerRoute;
|
|
927
|
-
request: ServerRequest;
|
|
928
|
-
};
|
|
929
|
-
"server:onError": {
|
|
930
|
-
route: ServerRoute;
|
|
931
|
-
request: ServerRequest;
|
|
932
|
-
error: Error;
|
|
933
|
-
};
|
|
934
|
-
"server:onSend": {
|
|
935
|
-
route: ServerRoute;
|
|
936
|
-
request: ServerRequest;
|
|
937
|
-
};
|
|
938
|
-
"server:onResponse": {
|
|
939
|
-
route: ServerRoute;
|
|
940
|
-
request: ServerRequest;
|
|
941
|
-
response: ServerResponse$1;
|
|
942
|
-
};
|
|
943
|
-
"client:onRequest": {
|
|
944
|
-
route: HttpAction;
|
|
945
|
-
config: ServerRequestConfigEntry;
|
|
946
|
-
options: ClientRequestOptions;
|
|
947
|
-
headers: Record<string, string>;
|
|
948
|
-
request: RequestInit;
|
|
949
|
-
};
|
|
950
|
-
"client:beforeFetch": {
|
|
951
|
-
url: string;
|
|
952
|
-
options: FetchOptions;
|
|
953
|
-
request: RequestInit;
|
|
954
|
-
};
|
|
955
|
-
"client:onError": {
|
|
956
|
-
route?: HttpAction;
|
|
957
|
-
error: HttpError;
|
|
958
|
-
};
|
|
959
|
-
"node:request": NodeRequestEvent;
|
|
960
|
-
"web:request": WebRequestEvent;
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
//#endregion
|
|
964
|
-
//#region ../../../alepha/src/security/interfaces/UserAccountToken.d.ts
|
|
965
|
-
/**
|
|
966
|
-
* Add contextual metadata to a user account info.
|
|
967
|
-
* E.g. UserAccountToken is a UserAccountInfo during a request.
|
|
968
|
-
*/
|
|
969
|
-
interface UserAccountToken extends UserAccount {
|
|
970
|
-
/**
|
|
971
|
-
* Access token for the user.
|
|
972
|
-
*/
|
|
973
|
-
token?: string;
|
|
974
|
-
/**
|
|
975
|
-
* Realm name of the user.
|
|
976
|
-
*/
|
|
977
|
-
realm?: string;
|
|
978
|
-
/**
|
|
979
|
-
* Is user dedicated to his own resources for this scope ?
|
|
980
|
-
* Mostly, Admin is false and Customer is true.
|
|
981
|
-
*/
|
|
982
|
-
ownership?: string | boolean;
|
|
983
|
-
}
|
|
984
|
-
//#endregion
|
|
985
|
-
//#region ../../../alepha/src/security/providers/SecurityProvider.d.ts
|
|
986
|
-
declare const envSchema: alepha20.TObject<{
|
|
987
|
-
APP_SECRET: alepha20.TString;
|
|
988
|
-
}>;
|
|
989
|
-
declare module "alepha" {
|
|
990
|
-
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
991
|
-
}
|
|
992
|
-
//#endregion
|
|
993
|
-
//#region ../../../alepha/src/security/index.d.ts
|
|
994
|
-
declare module "alepha" {
|
|
995
|
-
interface Hooks {
|
|
996
|
-
"security:user:created": {
|
|
997
|
-
realm: string;
|
|
998
|
-
user: UserAccount;
|
|
999
|
-
};
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
/**
|
|
1003
|
-
* Provides comprehensive authentication and authorization capabilities with JWT tokens, role-based access control, and user management.
|
|
1004
|
-
*
|
|
1005
|
-
* The security module enables building secure applications using primitives like `$realm`, `$role`, and `$permission`
|
|
1006
|
-
* on class properties. It offers JWT-based authentication, fine-grained permissions, service accounts, and seamless
|
|
1007
|
-
* integration with various authentication providers and user management systems.
|
|
1008
|
-
*
|
|
1009
|
-
* @see {@link $realm}
|
|
1010
|
-
* @see {@link $role}
|
|
1011
|
-
* @see {@link $permission}
|
|
1012
|
-
* @module alepha.security
|
|
1013
|
-
*/
|
|
1014
|
-
//#endregion
|
|
1015
|
-
//#region ../../../alepha/src/server-security/providers/ServerBasicAuthProvider.d.ts
|
|
1016
|
-
interface BasicAuthOptions {
|
|
1017
|
-
username: string;
|
|
1018
|
-
password: string;
|
|
1019
|
-
}
|
|
1020
|
-
//#endregion
|
|
1021
|
-
//#region ../../../alepha/src/server-security/providers/ServerSecurityProvider.d.ts
|
|
1022
|
-
type ServerRouteSecure = {
|
|
1023
|
-
realm?: string;
|
|
1024
|
-
basic?: BasicAuthOptions;
|
|
1025
|
-
};
|
|
1026
|
-
//#endregion
|
|
1027
|
-
//#region ../../../alepha/src/server-security/index.d.ts
|
|
1028
|
-
declare module "alepha" {
|
|
1029
|
-
interface State {
|
|
1030
|
-
/**
|
|
1031
|
-
* Real (or fake) user account, used for internal actions.
|
|
1032
|
-
*
|
|
1033
|
-
* If you define this, you assume that all actions are executed by this user by default.
|
|
1034
|
-
* > To force a different user, you need to pass it explicitly in the options.
|
|
1035
|
-
*/
|
|
1036
|
-
"alepha.server.security.system.user"?: UserAccountToken;
|
|
1037
|
-
/**
|
|
1038
|
-
* The authenticated user account attached to the server request state.
|
|
1039
|
-
*
|
|
1040
|
-
* @internal
|
|
1041
|
-
*/
|
|
1042
|
-
"alepha.server.request.user"?: UserAccount;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
declare module "alepha/server" {
|
|
1046
|
-
interface ServerRequest<TConfig> {
|
|
1047
|
-
user?: UserAccountToken;
|
|
1048
|
-
}
|
|
1049
|
-
interface ServerActionRequest<TConfig> {
|
|
1050
|
-
user: UserAccountToken;
|
|
1051
|
-
}
|
|
1052
|
-
interface ServerRoute {
|
|
1053
|
-
/**
|
|
1054
|
-
* If true, the route will be protected by the security provider.
|
|
1055
|
-
* All actions are secure by default, but you can disable it for specific actions.
|
|
1056
|
-
*/
|
|
1057
|
-
secure?: boolean | ServerRouteSecure;
|
|
1058
|
-
}
|
|
1059
|
-
interface ClientRequestOptions extends FetchOptions {
|
|
1060
|
-
/**
|
|
1061
|
-
* Forward user from the previous request.
|
|
1062
|
-
* If "system", use system user. @see {ServerSecurityProvider.localSystemUser}
|
|
1063
|
-
* If "context", use the user from the current context (e.g. request).
|
|
1064
|
-
*
|
|
1065
|
-
* @default "system" if provided, else "context" if available.
|
|
1066
|
-
*/
|
|
1067
|
-
user?: UserAccountToken | "system" | "context";
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* Plugin for Alepha Server that provides security features. Based on the Alepha Security module.
|
|
1072
|
-
*
|
|
1073
|
-
* By default, all $action will be guarded by a permission check.
|
|
1074
|
-
*
|
|
1075
|
-
* @see {@link ServerSecurityProvider}
|
|
1076
|
-
* @module alepha.server.security
|
|
1077
|
-
*/
|
|
1078
|
-
//#endregion
|
|
1079
|
-
//#region ../../../alepha/src/server-links/schemas/apiLinksResponseSchema.d.ts
|
|
1080
|
-
declare const apiLinkSchema: alepha20.TObject<{
|
|
1081
|
-
name: alepha20.TString;
|
|
1082
|
-
group: alepha20.TOptional<alepha20.TString>;
|
|
1083
|
-
path: alepha20.TString;
|
|
1084
|
-
method: alepha20.TOptional<alepha20.TString>;
|
|
1085
|
-
requestBodyType: alepha20.TOptional<alepha20.TString>;
|
|
1086
|
-
service: alepha20.TOptional<alepha20.TString>;
|
|
1087
|
-
}>;
|
|
1088
|
-
declare const apiLinksResponseSchema: alepha20.TObject<{
|
|
1089
|
-
prefix: alepha20.TOptional<alepha20.TString>;
|
|
1090
|
-
links: alepha20.TArray<alepha20.TObject<{
|
|
1091
|
-
name: alepha20.TString;
|
|
1092
|
-
group: alepha20.TOptional<alepha20.TString>;
|
|
1093
|
-
path: alepha20.TString;
|
|
1094
|
-
method: alepha20.TOptional<alepha20.TString>;
|
|
1095
|
-
requestBodyType: alepha20.TOptional<alepha20.TString>;
|
|
1096
|
-
service: alepha20.TOptional<alepha20.TString>;
|
|
1097
|
-
}>>;
|
|
1098
|
-
}>;
|
|
1099
|
-
type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
|
|
1100
|
-
type ApiLink = Static<typeof apiLinkSchema>;
|
|
1101
|
-
//#endregion
|
|
1102
|
-
//#region ../../../alepha/src/server-links/providers/LinkProvider.d.ts
|
|
1103
|
-
/**
|
|
1104
|
-
* Browser, SSR friendly, service to handle links.
|
|
1105
|
-
*/
|
|
1106
|
-
declare class LinkProvider {
|
|
1107
|
-
static path: {
|
|
1108
|
-
apiLinks: string;
|
|
1109
|
-
apiSchema: string;
|
|
1110
|
-
};
|
|
1111
|
-
protected readonly log: Logger;
|
|
1112
|
-
protected readonly alepha: Alepha;
|
|
1113
|
-
protected readonly httpClient: HttpClient;
|
|
1114
|
-
protected serverLinks: Array<HttpClientLink>;
|
|
1115
|
-
/**
|
|
1116
|
-
* Get applicative links registered on the server.
|
|
1117
|
-
* This does not include lazy-loaded remote links.
|
|
1118
|
-
*/
|
|
1119
|
-
getServerLinks(): HttpClientLink[];
|
|
1120
|
-
/**
|
|
1121
|
-
* Register a new link for the application.
|
|
1122
|
-
*/
|
|
1123
|
-
registerLink(link: HttpClientLink): void;
|
|
1124
|
-
get links(): HttpClientLink[];
|
|
1125
|
-
/**
|
|
1126
|
-
* Force browser to refresh links from the server.
|
|
1127
|
-
*/
|
|
1128
|
-
fetchLinks(): Promise<HttpClientLink[]>;
|
|
1129
|
-
/**
|
|
1130
|
-
* Create a virtual client that can be used to call actions.
|
|
1131
|
-
*
|
|
1132
|
-
* Use js Proxy under the hood.
|
|
1133
|
-
*/
|
|
1134
|
-
client<T extends object>(scope?: ClientScope): HttpVirtualClient<T>;
|
|
1135
|
-
/**
|
|
1136
|
-
* Check if a link with the given name exists.
|
|
1137
|
-
* @param name
|
|
1138
|
-
*/
|
|
1139
|
-
can(name: string): boolean;
|
|
1140
|
-
/**
|
|
1141
|
-
* Resolve a link by its name and call it.
|
|
1142
|
-
* - If link is local, it will call the local handler.
|
|
1143
|
-
* - If link is remote, it will make a fetch request to the remote server.
|
|
1144
|
-
*/
|
|
1145
|
-
follow(name: string, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions & ClientScope): Promise<any>;
|
|
1146
|
-
protected createVirtualAction<T extends RequestConfigSchema>(name: string, scope?: ClientScope): VirtualAction<T>;
|
|
1147
|
-
protected followRemote(link: HttpClientLink, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions): Promise<FetchResponse>;
|
|
1148
|
-
protected getLinkByName(name: string, options?: ClientScope): Promise<HttpClientLink>;
|
|
1149
|
-
}
|
|
1150
|
-
interface HttpClientLink extends ApiLink {
|
|
1151
|
-
secured?: boolean | ServerRouteSecure;
|
|
1152
|
-
prefix?: string;
|
|
1153
|
-
host?: string;
|
|
1154
|
-
service?: string;
|
|
1155
|
-
schema?: RequestConfigSchema;
|
|
1156
|
-
handler?: (request: ServerRequest, options: ClientRequestOptions) => Async<ServerResponseBody>;
|
|
1157
|
-
}
|
|
1158
|
-
interface ClientScope {
|
|
1159
|
-
group?: string;
|
|
1160
|
-
service?: string;
|
|
1161
|
-
hostname?: string;
|
|
1162
|
-
}
|
|
1163
|
-
type HttpVirtualClient<T> = { [K in keyof T as T[K] extends ActionPrimitive<RequestConfigSchema> ? K : never]: T[K] extends ActionPrimitive<infer Schema> ? VirtualAction<Schema> : never };
|
|
1164
|
-
interface VirtualAction<T extends RequestConfigSchema> extends Pick<ActionPrimitive<T>, "name" | "run" | "fetch"> {
|
|
1165
|
-
(config?: ClientRequestEntry<T>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T>>;
|
|
1166
|
-
can: () => boolean;
|
|
1167
|
-
}
|
|
1168
|
-
//#endregion
|
|
1169
|
-
//#region ../../../alepha/src/server-links/index.d.ts
|
|
1170
|
-
declare module "alepha" {
|
|
1171
|
-
interface State {
|
|
1172
|
-
/**
|
|
1173
|
-
* API links attached to the server request state.
|
|
1174
|
-
*
|
|
1175
|
-
* @see {@link ApiLinksResponse}
|
|
1176
|
-
* @internal
|
|
1177
|
-
*/
|
|
1178
|
-
"alepha.server.request.apiLinks"?: ApiLinksResponse;
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
/**
|
|
1182
|
-
* Provides server-side link management and remote capabilities for client-server interactions.
|
|
1183
|
-
*
|
|
1184
|
-
* The server-links module enables declarative link definitions using `$remote` and `$client` primitives,
|
|
1185
|
-
* facilitating seamless API endpoint management and client-server communication. It integrates with server
|
|
1186
|
-
* security features to ensure safe and controlled access to resources.
|
|
1187
|
-
*
|
|
1188
|
-
* @see {@link $remote}
|
|
1189
|
-
* @see {@link $client}
|
|
1190
|
-
* @module alepha.server.links
|
|
1191
|
-
*/
|
|
1192
|
-
//#endregion
|
|
1193
9
|
//#region ../../src/auth/hooks/useAuth.d.ts
|
|
1194
10
|
declare const useAuth: <T extends object = any>() => {
|
|
1195
11
|
user: {
|
|
@@ -1213,88 +29,17 @@ declare const useAuth: <T extends object = any>() => {
|
|
|
1213
29
|
can: <Api extends object = any>(name: keyof HttpVirtualClient<Api>) => boolean;
|
|
1214
30
|
};
|
|
1215
31
|
//#endregion
|
|
1216
|
-
//#region ../../../alepha/src/server-auth/schemas/tokensSchema.d.ts
|
|
1217
|
-
declare const tokensSchema: alepha20.TObject<{
|
|
1218
|
-
provider: alepha20.TString;
|
|
1219
|
-
access_token: alepha20.TString;
|
|
1220
|
-
issued_at: alepha20.TNumber;
|
|
1221
|
-
expires_in: alepha20.TOptional<alepha20.TNumber>;
|
|
1222
|
-
refresh_token: alepha20.TOptional<alepha20.TString>;
|
|
1223
|
-
refresh_token_expires_in: alepha20.TOptional<alepha20.TNumber>;
|
|
1224
|
-
refresh_expires_in: alepha20.TOptional<alepha20.TNumber>;
|
|
1225
|
-
id_token: alepha20.TOptional<alepha20.TString>;
|
|
1226
|
-
scope: alepha20.TOptional<alepha20.TString>;
|
|
1227
|
-
}>;
|
|
1228
|
-
type Tokens = Static<typeof tokensSchema>;
|
|
1229
|
-
//#endregion
|
|
1230
|
-
//#region ../../../alepha/src/server-cookies/primitives/$cookie.d.ts
|
|
1231
|
-
interface Cookies {
|
|
1232
|
-
req: Record<string, string>;
|
|
1233
|
-
res: Record<string, Cookie | null>;
|
|
1234
|
-
}
|
|
1235
|
-
interface Cookie {
|
|
1236
|
-
value: string;
|
|
1237
|
-
path?: string;
|
|
1238
|
-
maxAge?: number;
|
|
1239
|
-
secure?: boolean;
|
|
1240
|
-
httpOnly?: boolean;
|
|
1241
|
-
sameSite?: "strict" | "lax" | "none";
|
|
1242
|
-
domain?: string;
|
|
1243
|
-
}
|
|
1244
|
-
//#endregion
|
|
1245
|
-
//#region ../../../alepha/src/server-cookies/index.d.ts
|
|
1246
|
-
declare module "alepha/server" {
|
|
1247
|
-
interface ServerRequest {
|
|
1248
|
-
cookies: Cookies;
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie primitives.
|
|
1253
|
-
*
|
|
1254
|
-
* The server-cookies module enables declarative cookie handling using the `$cookie` primitive on class properties.
|
|
1255
|
-
* It offers automatic cookie parsing, secure cookie configuration, and seamless integration with server routes
|
|
1256
|
-
* for managing user sessions, preferences, and authentication tokens.
|
|
1257
|
-
*
|
|
1258
|
-
* @see {@link $cookie}
|
|
1259
|
-
* @module alepha.server.cookies
|
|
1260
|
-
*/
|
|
1261
|
-
//#endregion
|
|
1262
|
-
//#region ../../../alepha/src/server-auth/index.d.ts
|
|
1263
|
-
declare module "alepha" {
|
|
1264
|
-
interface State {
|
|
1265
|
-
/**
|
|
1266
|
-
* The authenticated user account attached to the server request state.
|
|
1267
|
-
*
|
|
1268
|
-
* @internal
|
|
1269
|
-
*/
|
|
1270
|
-
"alepha.server.request.user"?: UserAccount;
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
/**
|
|
1274
|
-
* Allow authentication services for server applications.
|
|
1275
|
-
* It provides login and logout functionalities.
|
|
1276
|
-
*
|
|
1277
|
-
* There are multiple authentication providers available (e.g., Google, GitHub).
|
|
1278
|
-
* You can also delegate authentication to your own OIDC/OAuth2, for example using Keycloak or Auth0.
|
|
1279
|
-
*
|
|
1280
|
-
* It's cookie-based and SSR friendly.
|
|
1281
|
-
*
|
|
1282
|
-
* @see {@link $auth}
|
|
1283
|
-
* @see {@link ServerAuthProvider}
|
|
1284
|
-
* @module alepha.server.auth
|
|
1285
|
-
*/
|
|
1286
|
-
//#endregion
|
|
1287
32
|
//#region ../../src/auth/services/ReactAuth.d.ts
|
|
1288
33
|
/**
|
|
1289
34
|
* Browser, SSR friendly, service to handle authentication.
|
|
1290
35
|
*/
|
|
1291
36
|
declare class ReactAuth {
|
|
1292
|
-
protected readonly log: Logger;
|
|
37
|
+
protected readonly log: alepha_logger0.Logger;
|
|
1293
38
|
protected readonly alepha: Alepha;
|
|
1294
39
|
protected readonly httpClient: HttpClient;
|
|
1295
40
|
protected readonly linkProvider: LinkProvider;
|
|
1296
|
-
protected readonly onBeginTransition:
|
|
1297
|
-
protected readonly onFetchRequest:
|
|
41
|
+
protected readonly onBeginTransition: alepha2.HookPrimitive<"react:transition:begin">;
|
|
42
|
+
protected readonly onFetchRequest: alepha2.HookPrimitive<"client:onRequest">;
|
|
1298
43
|
/**
|
|
1299
44
|
* Get the current authenticated user.
|
|
1300
45
|
*
|
|
@@ -1326,7 +71,7 @@ declare class ReactAuth {
|
|
|
1326
71
|
//#region ../../src/auth/providers/ReactAuthProvider.d.ts
|
|
1327
72
|
declare class ReactAuthProvider {
|
|
1328
73
|
protected readonly alepha: Alepha;
|
|
1329
|
-
readonly onRender:
|
|
74
|
+
readonly onRender: alepha2.HookPrimitive<"react:server:render:begin">;
|
|
1330
75
|
}
|
|
1331
76
|
//#endregion
|
|
1332
77
|
//#region ../../src/auth/index.d.ts
|
|
@@ -1341,7 +86,7 @@ declare module "@alepha/react" {
|
|
|
1341
86
|
* @see {@link ReactAuthProvider}
|
|
1342
87
|
* @module alepha.react.auth
|
|
1343
88
|
*/
|
|
1344
|
-
declare const AlephaReactAuth:
|
|
89
|
+
declare const AlephaReactAuth: alepha2.Service<alepha2.Module>;
|
|
1345
90
|
//#endregion
|
|
1346
91
|
export { AlephaReactAuth, ReactAuth, ReactAuthProvider, useAuth };
|
|
1347
92
|
//# sourceMappingURL=index.d.ts.map
|