@alepha/react 0.13.7 → 0.13.8
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 +102 -102
- package/dist/core/index.browser.js +22 -1
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +121 -109
- 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/head/index.d.ts +17 -17
- package/dist/i18n/index.d.ts +22 -22
- package/dist/websocket/index.d.ts +19 -19
- package/package.json +20 -22
- package/src/core/contexts/AlephaProvider.tsx +41 -0
- package/src/core/index.shared.ts +1 -0
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as alepha18 from "alepha";
|
|
2
2
|
import { Alepha, AlephaError, Async, FileLike, InstantiableClass, LogLevel, LoggerInterface, Primitive, Static, StreamLike, TArray, TFile, TObject, TRecord, TSchema, TStream, TString, TVoid } from "alepha";
|
|
3
3
|
import { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
4
4
|
import { Readable } from "node:stream";
|
|
@@ -7,33 +7,33 @@ import dayjsDuration from "dayjs/plugin/duration.js";
|
|
|
7
7
|
import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
|
|
8
8
|
|
|
9
9
|
//#region ../../../alepha/src/security/schemas/userAccountInfoSchema.d.ts
|
|
10
|
-
declare const userAccountInfoSchema:
|
|
11
|
-
id:
|
|
12
|
-
name:
|
|
13
|
-
email:
|
|
14
|
-
username:
|
|
15
|
-
picture:
|
|
16
|
-
sessionId:
|
|
17
|
-
organizations:
|
|
18
|
-
roles:
|
|
10
|
+
declare const userAccountInfoSchema: alepha18.TObject<{
|
|
11
|
+
id: alepha18.TString;
|
|
12
|
+
name: alepha18.TOptional<alepha18.TString>;
|
|
13
|
+
email: alepha18.TOptional<alepha18.TString>;
|
|
14
|
+
username: alepha18.TOptional<alepha18.TString>;
|
|
15
|
+
picture: alepha18.TOptional<alepha18.TString>;
|
|
16
|
+
sessionId: alepha18.TOptional<alepha18.TString>;
|
|
17
|
+
organizations: alepha18.TOptional<alepha18.TArray<alepha18.TString>>;
|
|
18
|
+
roles: alepha18.TOptional<alepha18.TArray<alepha18.TString>>;
|
|
19
19
|
}>;
|
|
20
20
|
type UserAccount = Static<typeof userAccountInfoSchema>;
|
|
21
21
|
//#endregion
|
|
22
|
-
//#region ../../../alepha/src/server/schemas/errorSchema.d.ts
|
|
23
|
-
declare const errorSchema:
|
|
24
|
-
error:
|
|
25
|
-
status:
|
|
26
|
-
message:
|
|
27
|
-
details:
|
|
28
|
-
requestId:
|
|
29
|
-
cause:
|
|
30
|
-
name:
|
|
31
|
-
message:
|
|
22
|
+
//#region ../../../alepha/src/server/core/schemas/errorSchema.d.ts
|
|
23
|
+
declare const errorSchema: alepha18.TObject<{
|
|
24
|
+
error: alepha18.TString;
|
|
25
|
+
status: alepha18.TInteger;
|
|
26
|
+
message: alepha18.TString;
|
|
27
|
+
details: alepha18.TOptional<alepha18.TString>;
|
|
28
|
+
requestId: alepha18.TOptional<alepha18.TString>;
|
|
29
|
+
cause: alepha18.TOptional<alepha18.TObject<{
|
|
30
|
+
name: alepha18.TString;
|
|
31
|
+
message: alepha18.TString;
|
|
32
32
|
}>>;
|
|
33
33
|
}>;
|
|
34
34
|
type ErrorSchema = Static<typeof errorSchema>;
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region ../../../alepha/src/server/errors/HttpError.d.ts
|
|
36
|
+
//#region ../../../alepha/src/server/core/errors/HttpError.d.ts
|
|
37
37
|
declare class HttpError extends AlephaError {
|
|
38
38
|
name: string;
|
|
39
39
|
static is: (error: unknown, status?: number) => error is HttpErrorLike;
|
|
@@ -96,11 +96,11 @@ interface Tree<T extends Route> {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
//#endregion
|
|
99
|
-
//#region ../../../alepha/src/server/constants/routeMethods.d.ts
|
|
99
|
+
//#region ../../../alepha/src/server/core/constants/routeMethods.d.ts
|
|
100
100
|
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
101
101
|
type RouteMethod = (typeof routeMethods)[number];
|
|
102
102
|
//#endregion
|
|
103
|
-
//#region ../../../alepha/src/server/helpers/ServerReply.d.ts
|
|
103
|
+
//#region ../../../alepha/src/server/core/helpers/ServerReply.d.ts
|
|
104
104
|
/**
|
|
105
105
|
* Helper for building server replies.
|
|
106
106
|
*/
|
|
@@ -128,7 +128,7 @@ declare class ServerReply {
|
|
|
128
128
|
setBody(body: any): this;
|
|
129
129
|
}
|
|
130
130
|
//#endregion
|
|
131
|
-
//#region ../../../alepha/src/server/services/UserAgentParser.d.ts
|
|
131
|
+
//#region ../../../alepha/src/server/core/services/UserAgentParser.d.ts
|
|
132
132
|
interface UserAgentInfo {
|
|
133
133
|
os: "Windows" | "Android" | "Ubuntu" | "MacOS" | "iOS" | "Linux" | "FreeBSD" | "OpenBSD" | "ChromeOS" | "BlackBerry" | "Symbian" | "Windows Phone";
|
|
134
134
|
browser: "Chrome" | "Firefox" | "Safari" | "Edge" | "Opera" | "Internet Explorer" | "Brave" | "Vivaldi" | "Samsung Browser" | "UC Browser" | "Yandex";
|
|
@@ -144,7 +144,7 @@ declare class UserAgentParser {
|
|
|
144
144
|
parse(userAgent?: string): UserAgentInfo;
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
|
-
//#region ../../../alepha/src/server/interfaces/ServerRequest.d.ts
|
|
147
|
+
//#region ../../../alepha/src/server/core/interfaces/ServerRequest.d.ts
|
|
148
148
|
type TRequestBody = TObject | TString | TArray | TRecord | TStream;
|
|
149
149
|
type TResponseBody = TObject | TString | TRecord | TFile | TArray | TStream | TVoid;
|
|
150
150
|
interface RequestConfigSchema {
|
|
@@ -267,15 +267,15 @@ interface WebRequestEvent {
|
|
|
267
267
|
}
|
|
268
268
|
//#endregion
|
|
269
269
|
//#region ../../../alepha/src/logger/schemas/logEntrySchema.d.ts
|
|
270
|
-
declare const logEntrySchema:
|
|
271
|
-
level:
|
|
272
|
-
message:
|
|
273
|
-
service:
|
|
274
|
-
module:
|
|
275
|
-
context:
|
|
276
|
-
app:
|
|
277
|
-
data:
|
|
278
|
-
timestamp:
|
|
270
|
+
declare const logEntrySchema: alepha18.TObject<{
|
|
271
|
+
level: alepha18.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
|
|
272
|
+
message: alepha18.TString;
|
|
273
|
+
service: alepha18.TString;
|
|
274
|
+
module: alepha18.TString;
|
|
275
|
+
context: alepha18.TOptional<alepha18.TString>;
|
|
276
|
+
app: alepha18.TOptional<alepha18.TString>;
|
|
277
|
+
data: alepha18.TOptional<alepha18.TAny>;
|
|
278
|
+
timestamp: alepha18.TNumber;
|
|
279
279
|
}>;
|
|
280
280
|
type LogEntry = Static<typeof logEntrySchema>;
|
|
281
281
|
//#endregion
|
|
@@ -290,8 +290,8 @@ declare class DateTimeProvider {
|
|
|
290
290
|
protected readonly timeouts: Timeout[];
|
|
291
291
|
protected readonly intervals: Interval[];
|
|
292
292
|
constructor();
|
|
293
|
-
protected readonly onStart:
|
|
294
|
-
protected readonly onStop:
|
|
293
|
+
protected readonly onStart: alepha18.HookPrimitive<"start">;
|
|
294
|
+
protected readonly onStop: alepha18.HookPrimitive<"stop">;
|
|
295
295
|
setLocale(locale: string): void;
|
|
296
296
|
isDateTime(value: unknown): value is DateTime;
|
|
297
297
|
/**
|
|
@@ -423,7 +423,7 @@ declare class Logger implements LoggerInterface {
|
|
|
423
423
|
}
|
|
424
424
|
//#endregion
|
|
425
425
|
//#region ../../../alepha/src/logger/index.d.ts
|
|
426
|
-
declare const envSchema$3:
|
|
426
|
+
declare const envSchema$3: alepha18.TObject<{
|
|
427
427
|
/**
|
|
428
428
|
* Default log level for the application.
|
|
429
429
|
*
|
|
@@ -440,14 +440,14 @@ declare const envSchema$3: alepha20.TObject<{
|
|
|
440
440
|
* LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
|
|
441
441
|
* LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
|
|
442
442
|
*/
|
|
443
|
-
LOG_LEVEL:
|
|
443
|
+
LOG_LEVEL: alepha18.TOptional<alepha18.TString>;
|
|
444
444
|
/**
|
|
445
445
|
* Built-in log formats.
|
|
446
446
|
* - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
|
|
447
447
|
* - "pretty" - Simple text format, human-readable, with colors. {@link PrettyFormatterProvider}
|
|
448
448
|
* - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
|
|
449
449
|
*/
|
|
450
|
-
LOG_FORMAT:
|
|
450
|
+
LOG_FORMAT: alepha18.TOptional<alepha18.TUnsafe<"json" | "pretty" | "raw">>;
|
|
451
451
|
}>;
|
|
452
452
|
declare module "alepha" {
|
|
453
453
|
interface Env extends Partial<Static<typeof envSchema$3>> {}
|
|
@@ -465,7 +465,7 @@ declare module "alepha" {
|
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
//#endregion
|
|
468
|
-
//#region ../../../alepha/src/server/services/ServerRequestParser.d.ts
|
|
468
|
+
//#region ../../../alepha/src/server/core/services/ServerRequestParser.d.ts
|
|
469
469
|
declare class ServerRequestParser {
|
|
470
470
|
protected readonly alepha: Alepha;
|
|
471
471
|
protected readonly userAgentParser: UserAgentParser;
|
|
@@ -475,7 +475,7 @@ declare class ServerRequestParser {
|
|
|
475
475
|
getRequestIp(request: ServerRequestData): string | undefined;
|
|
476
476
|
}
|
|
477
477
|
//#endregion
|
|
478
|
-
//#region ../../../alepha/src/server/providers/ServerTimingProvider.d.ts
|
|
478
|
+
//#region ../../../alepha/src/server/core/providers/ServerTimingProvider.d.ts
|
|
479
479
|
type TimingMap = Record<string, [number, number]>;
|
|
480
480
|
declare class ServerTimingProvider {
|
|
481
481
|
protected readonly log: Logger;
|
|
@@ -484,15 +484,15 @@ declare class ServerTimingProvider {
|
|
|
484
484
|
prefix: string;
|
|
485
485
|
disabled: boolean;
|
|
486
486
|
};
|
|
487
|
-
readonly onRequest:
|
|
488
|
-
readonly onResponse:
|
|
487
|
+
readonly onRequest: alepha18.HookPrimitive<"server:onRequest">;
|
|
488
|
+
readonly onResponse: alepha18.HookPrimitive<"server:onResponse">;
|
|
489
489
|
protected get handlerName(): string;
|
|
490
490
|
beginTiming(name: string): void;
|
|
491
491
|
endTiming(name: string): void;
|
|
492
492
|
protected setDuration(name: string, timing: TimingMap): void;
|
|
493
493
|
}
|
|
494
494
|
//#endregion
|
|
495
|
-
//#region ../../../alepha/src/server/providers/ServerRouterProvider.d.ts
|
|
495
|
+
//#region ../../../alepha/src/server/core/providers/ServerRouterProvider.d.ts
|
|
496
496
|
/**
|
|
497
497
|
* Main router for all routes on the server side.
|
|
498
498
|
*
|
|
@@ -531,7 +531,7 @@ declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
|
|
|
531
531
|
}, request: ServerRequestConfig): void;
|
|
532
532
|
}
|
|
533
533
|
//#endregion
|
|
534
|
-
//#region ../../../alepha/src/server/providers/ServerProvider.d.ts
|
|
534
|
+
//#region ../../../alepha/src/server/core/providers/ServerProvider.d.ts
|
|
535
535
|
/**
|
|
536
536
|
* Base server provider to handle incoming requests and route them.
|
|
537
537
|
*
|
|
@@ -549,11 +549,11 @@ declare class ServerProvider {
|
|
|
549
549
|
/**
|
|
550
550
|
* When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
|
|
551
551
|
*/
|
|
552
|
-
protected readonly onNodeRequest:
|
|
552
|
+
protected readonly onNodeRequest: alepha18.HookPrimitive<"node:request">;
|
|
553
553
|
/**
|
|
554
554
|
* When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
|
|
555
555
|
*/
|
|
556
|
-
protected readonly onWebRequest:
|
|
556
|
+
protected readonly onWebRequest: alepha18.HookPrimitive<"web:request">;
|
|
557
557
|
/**
|
|
558
558
|
* Handle Node.js HTTP request event.
|
|
559
559
|
*
|
|
@@ -570,7 +570,7 @@ declare class ServerProvider {
|
|
|
570
570
|
protected isViteNotFound(url?: string, route?: Route, params?: Record<string, string>): boolean;
|
|
571
571
|
}
|
|
572
572
|
//#endregion
|
|
573
|
-
//#region ../../../alepha/src/cache/providers/CacheProvider.d.ts
|
|
573
|
+
//#region ../../../alepha/src/cache/core/providers/CacheProvider.d.ts
|
|
574
574
|
/**
|
|
575
575
|
* Cache provider interface.
|
|
576
576
|
*
|
|
@@ -613,7 +613,7 @@ declare abstract class CacheProvider {
|
|
|
613
613
|
abstract clear(): Promise<void>;
|
|
614
614
|
}
|
|
615
615
|
//#endregion
|
|
616
|
-
//#region ../../../alepha/src/cache/primitives/$cache.d.ts
|
|
616
|
+
//#region ../../../alepha/src/cache/core/primitives/$cache.d.ts
|
|
617
617
|
interface CachePrimitiveOptions<TReturn = any, TParameter extends any[] = any[]> {
|
|
618
618
|
/**
|
|
619
619
|
* The cache name. This is useful for invalidating multiple caches at once.
|
|
@@ -680,7 +680,7 @@ interface CachePrimitiveFn<TReturn = any, TParameter extends any[] = any[]> exte
|
|
|
680
680
|
(...args: TParameter): Promise<TReturn>;
|
|
681
681
|
}
|
|
682
682
|
//#endregion
|
|
683
|
-
//#region ../../../alepha/src/server/services/HttpClient.d.ts
|
|
683
|
+
//#region ../../../alepha/src/server/core/services/HttpClient.d.ts
|
|
684
684
|
declare class HttpClient {
|
|
685
685
|
protected readonly log: Logger;
|
|
686
686
|
protected readonly alepha: Alepha;
|
|
@@ -752,7 +752,7 @@ interface HttpAction {
|
|
|
752
752
|
};
|
|
753
753
|
}
|
|
754
754
|
//#endregion
|
|
755
|
-
//#region ../../../alepha/src/server/primitives/$action.d.ts
|
|
755
|
+
//#region ../../../alepha/src/server/core/primitives/$action.d.ts
|
|
756
756
|
interface ActionPrimitiveOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
|
|
757
757
|
/**
|
|
758
758
|
* Name of the action.
|
|
@@ -887,25 +887,25 @@ type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSche
|
|
|
887
887
|
*/
|
|
888
888
|
interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
|
|
889
889
|
//#endregion
|
|
890
|
-
//#region ../../../alepha/src/server/providers/BunHttpServerProvider.d.ts
|
|
891
|
-
declare const envSchema$2:
|
|
892
|
-
SERVER_PORT:
|
|
893
|
-
SERVER_HOST:
|
|
890
|
+
//#region ../../../alepha/src/server/core/providers/BunHttpServerProvider.d.ts
|
|
891
|
+
declare const envSchema$2: alepha18.TObject<{
|
|
892
|
+
SERVER_PORT: alepha18.TInteger;
|
|
893
|
+
SERVER_HOST: alepha18.TString;
|
|
894
894
|
}>;
|
|
895
895
|
declare module "alepha" {
|
|
896
896
|
interface Env extends Partial<Static<typeof envSchema$2>> {}
|
|
897
897
|
}
|
|
898
898
|
//#endregion
|
|
899
|
-
//#region ../../../alepha/src/server/providers/NodeHttpServerProvider.d.ts
|
|
900
|
-
declare const envSchema$1:
|
|
901
|
-
SERVER_PORT:
|
|
902
|
-
SERVER_HOST:
|
|
899
|
+
//#region ../../../alepha/src/server/core/providers/NodeHttpServerProvider.d.ts
|
|
900
|
+
declare const envSchema$1: alepha18.TObject<{
|
|
901
|
+
SERVER_PORT: alepha18.TInteger;
|
|
902
|
+
SERVER_HOST: alepha18.TString;
|
|
903
903
|
}>;
|
|
904
904
|
declare module "alepha" {
|
|
905
905
|
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
906
906
|
}
|
|
907
907
|
//#endregion
|
|
908
|
-
//#region ../../../alepha/src/server/index.d.ts
|
|
908
|
+
//#region ../../../alepha/src/server/core/index.d.ts
|
|
909
909
|
declare module "alepha" {
|
|
910
910
|
interface State {
|
|
911
911
|
"alepha.node.server"?: Server;
|
|
@@ -983,8 +983,8 @@ interface UserAccountToken extends UserAccount {
|
|
|
983
983
|
}
|
|
984
984
|
//#endregion
|
|
985
985
|
//#region ../../../alepha/src/security/providers/SecurityProvider.d.ts
|
|
986
|
-
declare const envSchema:
|
|
987
|
-
APP_SECRET:
|
|
986
|
+
declare const envSchema: alepha18.TObject<{
|
|
987
|
+
APP_SECRET: alepha18.TString;
|
|
988
988
|
}>;
|
|
989
989
|
declare module "alepha" {
|
|
990
990
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
@@ -1012,19 +1012,19 @@ declare module "alepha" {
|
|
|
1012
1012
|
* @module alepha.security
|
|
1013
1013
|
*/
|
|
1014
1014
|
//#endregion
|
|
1015
|
-
//#region ../../../alepha/src/server
|
|
1015
|
+
//#region ../../../alepha/src/server/security/providers/ServerBasicAuthProvider.d.ts
|
|
1016
1016
|
interface BasicAuthOptions {
|
|
1017
1017
|
username: string;
|
|
1018
1018
|
password: string;
|
|
1019
1019
|
}
|
|
1020
1020
|
//#endregion
|
|
1021
|
-
//#region ../../../alepha/src/server
|
|
1021
|
+
//#region ../../../alepha/src/server/security/providers/ServerSecurityProvider.d.ts
|
|
1022
1022
|
type ServerRouteSecure = {
|
|
1023
1023
|
realm?: string;
|
|
1024
1024
|
basic?: BasicAuthOptions;
|
|
1025
1025
|
};
|
|
1026
1026
|
//#endregion
|
|
1027
|
-
//#region ../../../alepha/src/server
|
|
1027
|
+
//#region ../../../alepha/src/server/security/index.d.ts
|
|
1028
1028
|
declare module "alepha" {
|
|
1029
1029
|
interface State {
|
|
1030
1030
|
/**
|
|
@@ -1076,30 +1076,30 @@ declare module "alepha/server" {
|
|
|
1076
1076
|
* @module alepha.server.security
|
|
1077
1077
|
*/
|
|
1078
1078
|
//#endregion
|
|
1079
|
-
//#region ../../../alepha/src/server
|
|
1080
|
-
declare const apiLinkSchema:
|
|
1081
|
-
name:
|
|
1082
|
-
group:
|
|
1083
|
-
path:
|
|
1084
|
-
method:
|
|
1085
|
-
requestBodyType:
|
|
1086
|
-
service:
|
|
1079
|
+
//#region ../../../alepha/src/server/links/schemas/apiLinksResponseSchema.d.ts
|
|
1080
|
+
declare const apiLinkSchema: alepha18.TObject<{
|
|
1081
|
+
name: alepha18.TString;
|
|
1082
|
+
group: alepha18.TOptional<alepha18.TString>;
|
|
1083
|
+
path: alepha18.TString;
|
|
1084
|
+
method: alepha18.TOptional<alepha18.TString>;
|
|
1085
|
+
requestBodyType: alepha18.TOptional<alepha18.TString>;
|
|
1086
|
+
service: alepha18.TOptional<alepha18.TString>;
|
|
1087
1087
|
}>;
|
|
1088
|
-
declare const apiLinksResponseSchema:
|
|
1089
|
-
prefix:
|
|
1090
|
-
links:
|
|
1091
|
-
name:
|
|
1092
|
-
group:
|
|
1093
|
-
path:
|
|
1094
|
-
method:
|
|
1095
|
-
requestBodyType:
|
|
1096
|
-
service:
|
|
1088
|
+
declare const apiLinksResponseSchema: alepha18.TObject<{
|
|
1089
|
+
prefix: alepha18.TOptional<alepha18.TString>;
|
|
1090
|
+
links: alepha18.TArray<alepha18.TObject<{
|
|
1091
|
+
name: alepha18.TString;
|
|
1092
|
+
group: alepha18.TOptional<alepha18.TString>;
|
|
1093
|
+
path: alepha18.TString;
|
|
1094
|
+
method: alepha18.TOptional<alepha18.TString>;
|
|
1095
|
+
requestBodyType: alepha18.TOptional<alepha18.TString>;
|
|
1096
|
+
service: alepha18.TOptional<alepha18.TString>;
|
|
1097
1097
|
}>>;
|
|
1098
1098
|
}>;
|
|
1099
1099
|
type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
|
|
1100
1100
|
type ApiLink = Static<typeof apiLinkSchema>;
|
|
1101
1101
|
//#endregion
|
|
1102
|
-
//#region ../../../alepha/src/server
|
|
1102
|
+
//#region ../../../alepha/src/server/links/providers/LinkProvider.d.ts
|
|
1103
1103
|
/**
|
|
1104
1104
|
* Browser, SSR friendly, service to handle links.
|
|
1105
1105
|
*/
|
|
@@ -1166,7 +1166,7 @@ interface VirtualAction<T extends RequestConfigSchema> extends Pick<ActionPrimit
|
|
|
1166
1166
|
can: () => boolean;
|
|
1167
1167
|
}
|
|
1168
1168
|
//#endregion
|
|
1169
|
-
//#region ../../../alepha/src/server
|
|
1169
|
+
//#region ../../../alepha/src/server/links/index.d.ts
|
|
1170
1170
|
declare module "alepha" {
|
|
1171
1171
|
interface State {
|
|
1172
1172
|
/**
|
|
@@ -1213,21 +1213,21 @@ declare const useAuth: <T extends object = any>() => {
|
|
|
1213
1213
|
can: <Api extends object = any>(name: keyof HttpVirtualClient<Api>) => boolean;
|
|
1214
1214
|
};
|
|
1215
1215
|
//#endregion
|
|
1216
|
-
//#region ../../../alepha/src/server
|
|
1217
|
-
declare const tokensSchema:
|
|
1218
|
-
provider:
|
|
1219
|
-
access_token:
|
|
1220
|
-
issued_at:
|
|
1221
|
-
expires_in:
|
|
1222
|
-
refresh_token:
|
|
1223
|
-
refresh_token_expires_in:
|
|
1224
|
-
refresh_expires_in:
|
|
1225
|
-
id_token:
|
|
1226
|
-
scope:
|
|
1216
|
+
//#region ../../../alepha/src/server/auth/schemas/tokensSchema.d.ts
|
|
1217
|
+
declare const tokensSchema: alepha18.TObject<{
|
|
1218
|
+
provider: alepha18.TString;
|
|
1219
|
+
access_token: alepha18.TString;
|
|
1220
|
+
issued_at: alepha18.TNumber;
|
|
1221
|
+
expires_in: alepha18.TOptional<alepha18.TNumber>;
|
|
1222
|
+
refresh_token: alepha18.TOptional<alepha18.TString>;
|
|
1223
|
+
refresh_token_expires_in: alepha18.TOptional<alepha18.TNumber>;
|
|
1224
|
+
refresh_expires_in: alepha18.TOptional<alepha18.TNumber>;
|
|
1225
|
+
id_token: alepha18.TOptional<alepha18.TString>;
|
|
1226
|
+
scope: alepha18.TOptional<alepha18.TString>;
|
|
1227
1227
|
}>;
|
|
1228
1228
|
type Tokens = Static<typeof tokensSchema>;
|
|
1229
1229
|
//#endregion
|
|
1230
|
-
//#region ../../../alepha/src/server
|
|
1230
|
+
//#region ../../../alepha/src/server/cookies/primitives/$cookie.d.ts
|
|
1231
1231
|
interface Cookies {
|
|
1232
1232
|
req: Record<string, string>;
|
|
1233
1233
|
res: Record<string, Cookie | null>;
|
|
@@ -1242,7 +1242,7 @@ interface Cookie {
|
|
|
1242
1242
|
domain?: string;
|
|
1243
1243
|
}
|
|
1244
1244
|
//#endregion
|
|
1245
|
-
//#region ../../../alepha/src/server
|
|
1245
|
+
//#region ../../../alepha/src/server/cookies/index.d.ts
|
|
1246
1246
|
declare module "alepha/server" {
|
|
1247
1247
|
interface ServerRequest {
|
|
1248
1248
|
cookies: Cookies;
|
|
@@ -1259,7 +1259,7 @@ declare module "alepha/server" {
|
|
|
1259
1259
|
* @module alepha.server.cookies
|
|
1260
1260
|
*/
|
|
1261
1261
|
//#endregion
|
|
1262
|
-
//#region ../../../alepha/src/server
|
|
1262
|
+
//#region ../../../alepha/src/server/auth/index.d.ts
|
|
1263
1263
|
declare module "alepha" {
|
|
1264
1264
|
interface State {
|
|
1265
1265
|
/**
|
|
@@ -1293,8 +1293,8 @@ declare class ReactAuth {
|
|
|
1293
1293
|
protected readonly alepha: Alepha;
|
|
1294
1294
|
protected readonly httpClient: HttpClient;
|
|
1295
1295
|
protected readonly linkProvider: LinkProvider;
|
|
1296
|
-
protected readonly onBeginTransition:
|
|
1297
|
-
protected readonly onFetchRequest:
|
|
1296
|
+
protected readonly onBeginTransition: alepha18.HookPrimitive<"react:transition:begin">;
|
|
1297
|
+
protected readonly onFetchRequest: alepha18.HookPrimitive<"client:onRequest">;
|
|
1298
1298
|
/**
|
|
1299
1299
|
* Get the current authenticated user.
|
|
1300
1300
|
*
|
|
@@ -1326,7 +1326,7 @@ declare class ReactAuth {
|
|
|
1326
1326
|
//#region ../../src/auth/providers/ReactAuthProvider.d.ts
|
|
1327
1327
|
declare class ReactAuthProvider {
|
|
1328
1328
|
protected readonly alepha: Alepha;
|
|
1329
|
-
readonly onRender:
|
|
1329
|
+
readonly onRender: alepha18.HookPrimitive<"react:server:render:begin">;
|
|
1330
1330
|
}
|
|
1331
1331
|
//#endregion
|
|
1332
1332
|
//#region ../../src/auth/index.d.ts
|
|
@@ -1341,7 +1341,7 @@ declare module "@alepha/react" {
|
|
|
1341
1341
|
* @see {@link ReactAuthProvider}
|
|
1342
1342
|
* @module alepha.react.auth
|
|
1343
1343
|
*/
|
|
1344
|
-
declare const AlephaReactAuth:
|
|
1344
|
+
declare const AlephaReactAuth: alepha18.Service<alepha18.Module>;
|
|
1345
1345
|
//#endregion
|
|
1346
1346
|
export { AlephaReactAuth, ReactAuth, ReactAuthProvider, useAuth };
|
|
1347
1347
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1565,6 +1565,27 @@ var ReactRouter = class {
|
|
|
1565
1565
|
}
|
|
1566
1566
|
};
|
|
1567
1567
|
|
|
1568
|
+
//#endregion
|
|
1569
|
+
//#region ../../src/core/contexts/AlephaProvider.tsx
|
|
1570
|
+
/**
|
|
1571
|
+
* AlephaProvider component to initialize and provide Alepha instance to the app.
|
|
1572
|
+
* This isn't recommended for apps using alepha/react/router, as Router will handle this for you.
|
|
1573
|
+
*/
|
|
1574
|
+
const AlephaProvider = (props) => {
|
|
1575
|
+
const alepha = useMemo(() => Alepha.create(), []);
|
|
1576
|
+
const [started, setStarted] = useState(false);
|
|
1577
|
+
const [error, setError] = useState();
|
|
1578
|
+
useEffect(() => {
|
|
1579
|
+
alepha.start().then(() => setStarted(true)).catch((err) => setError(err));
|
|
1580
|
+
}, [alepha]);
|
|
1581
|
+
if (error) return props.onError(error);
|
|
1582
|
+
if (!started) return props.onLoading();
|
|
1583
|
+
return /* @__PURE__ */ jsx(AlephaContext.Provider, {
|
|
1584
|
+
value: alepha,
|
|
1585
|
+
children: props.children
|
|
1586
|
+
});
|
|
1587
|
+
};
|
|
1588
|
+
|
|
1568
1589
|
//#endregion
|
|
1569
1590
|
//#region ../../src/core/hooks/useInject.ts
|
|
1570
1591
|
/**
|
|
@@ -1965,5 +1986,5 @@ const AlephaReact = $module({
|
|
|
1965
1986
|
});
|
|
1966
1987
|
|
|
1967
1988
|
//#endregion
|
|
1968
|
-
export { $page, AlephaContext, AlephaReact, ClientOnly_default as ClientOnly, ErrorBoundary_default as ErrorBoundary, ErrorViewer_default as ErrorViewer, Link_default as Link, NestedView_default as NestedView, NotFoundPage as NotFound, PagePrimitive, ReactBrowserProvider, ReactBrowserRouterProvider, ReactPageProvider, ReactRouter, Redirection, RouterLayerContext, isPageRoute, reactBrowserOptions, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
|
|
1989
|
+
export { $page, AlephaContext, AlephaProvider, AlephaReact, ClientOnly_default as ClientOnly, ErrorBoundary_default as ErrorBoundary, ErrorViewer_default as ErrorViewer, Link_default as Link, NestedView_default as NestedView, NotFoundPage as NotFound, PagePrimitive, ReactBrowserProvider, ReactBrowserRouterProvider, ReactPageProvider, ReactRouter, Redirection, RouterLayerContext, isPageRoute, reactBrowserOptions, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
|
|
1969
1990
|
//# sourceMappingURL=index.browser.js.map
|