@alepha/react 0.13.3 → 0.13.5
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.browser.js +3 -3
- package/dist/auth/index.d.ts +117 -117
- package/dist/auth/index.js +4 -4
- package/dist/core/index.browser.js +28 -28
- package/dist/core/index.d.ts +149 -149
- package/dist/core/index.js +29 -29
- package/dist/core/index.native.js +9 -9
- package/dist/form/index.d.ts +12 -12
- package/dist/form/index.js +6 -6
- package/dist/head/index.browser.js +5 -5
- package/dist/head/index.d.ts +30 -30
- package/dist/head/index.js +6 -6
- package/dist/i18n/index.d.ts +13 -13
- package/dist/i18n/index.js +5 -5
- package/dist/websocket/index.d.ts +7 -7
- package/dist/websocket/index.js +1 -1
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ import { HttpClient } from "alepha/server";
|
|
|
5
5
|
import { alephaServerAuthRoutes, tokenResponseSchema, userinfoResponseSchema } from "alepha/server/auth";
|
|
6
6
|
import { LinkProvider } from "alepha/server/links";
|
|
7
7
|
|
|
8
|
-
//#region src/auth/services/ReactAuth.ts
|
|
8
|
+
//#region ../../src/auth/services/ReactAuth.ts
|
|
9
9
|
/**
|
|
10
10
|
* Browser, SSR friendly, service to handle authentication.
|
|
11
11
|
*/
|
|
@@ -77,7 +77,7 @@ var ReactAuth = class {
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
//#endregion
|
|
80
|
-
//#region src/auth/hooks/useAuth.ts
|
|
80
|
+
//#region ../../src/auth/hooks/useAuth.ts
|
|
81
81
|
const useAuth = () => {
|
|
82
82
|
const alepha = useAlepha();
|
|
83
83
|
const [user] = useStore("alepha.server.request.user");
|
|
@@ -96,7 +96,7 @@ const useAuth = () => {
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
//#endregion
|
|
99
|
-
//#region src/auth/index.browser.ts
|
|
99
|
+
//#region ../../src/auth/index.browser.ts
|
|
100
100
|
const AlephaReactAuth = $module({
|
|
101
101
|
name: "alepha.react.auth",
|
|
102
102
|
services: [ReactAuth]
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as alepha20 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";
|
|
@@ -6,34 +6,34 @@ import { ReadableStream } from "node:stream/web";
|
|
|
6
6
|
import dayjsDuration from "dayjs/plugin/duration.js";
|
|
7
7
|
import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
|
|
8
8
|
|
|
9
|
-
//#region
|
|
10
|
-
declare const userAccountInfoSchema:
|
|
11
|
-
id:
|
|
12
|
-
name:
|
|
13
|
-
email:
|
|
14
|
-
username:
|
|
15
|
-
picture:
|
|
16
|
-
sessionId:
|
|
17
|
-
organizations:
|
|
18
|
-
roles:
|
|
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
19
|
}>;
|
|
20
20
|
type UserAccount = Static<typeof userAccountInfoSchema>;
|
|
21
21
|
//#endregion
|
|
22
|
-
//#region
|
|
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/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
32
|
}>>;
|
|
33
33
|
}>;
|
|
34
34
|
type ErrorSchema = Static<typeof errorSchema>;
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region
|
|
36
|
+
//#region ../../../alepha/src/server/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;
|
|
@@ -52,7 +52,7 @@ interface HttpErrorLike extends Error {
|
|
|
52
52
|
status: number;
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
55
|
-
//#region
|
|
55
|
+
//#region ../../../alepha/src/router/providers/RouterProvider.d.ts
|
|
56
56
|
declare abstract class RouterProvider<T extends Route = Route> {
|
|
57
57
|
protected routePathRegex: RegExp;
|
|
58
58
|
protected tree: Tree<T>;
|
|
@@ -96,11 +96,11 @@ interface Tree<T extends Route> {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
//#endregion
|
|
99
|
-
//#region
|
|
99
|
+
//#region ../../../alepha/src/server/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
|
|
103
|
+
//#region ../../../alepha/src/server/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
|
|
131
|
+
//#region ../../../alepha/src/server/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
|
|
147
|
+
//#region ../../../alepha/src/server/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 {
|
|
@@ -266,20 +266,20 @@ interface WebRequestEvent {
|
|
|
266
266
|
res?: Response;
|
|
267
267
|
}
|
|
268
268
|
//#endregion
|
|
269
|
-
//#region
|
|
270
|
-
declare const logEntrySchema:
|
|
271
|
-
level:
|
|
272
|
-
message:
|
|
273
|
-
service:
|
|
274
|
-
module:
|
|
275
|
-
context:
|
|
276
|
-
app:
|
|
277
|
-
data:
|
|
278
|
-
timestamp:
|
|
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
279
|
}>;
|
|
280
280
|
type LogEntry = Static<typeof logEntrySchema>;
|
|
281
281
|
//#endregion
|
|
282
|
-
//#region
|
|
282
|
+
//#region ../../../alepha/src/datetime/providers/DateTimeProvider.d.ts
|
|
283
283
|
type DateTime = DayjsApi.Dayjs;
|
|
284
284
|
type Duration = dayjsDuration.Duration;
|
|
285
285
|
type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
|
|
@@ -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: alepha20.HookPrimitive<"start">;
|
|
294
|
+
protected readonly onStop: alepha20.HookPrimitive<"stop">;
|
|
295
295
|
setLocale(locale: string): void;
|
|
296
296
|
isDateTime(value: unknown): value is DateTime;
|
|
297
297
|
/**
|
|
@@ -385,17 +385,17 @@ interface Timeout {
|
|
|
385
385
|
clear: () => void;
|
|
386
386
|
}
|
|
387
387
|
//#endregion
|
|
388
|
-
//#region
|
|
388
|
+
//#region ../../../alepha/src/logger/providers/LogDestinationProvider.d.ts
|
|
389
389
|
declare abstract class LogDestinationProvider {
|
|
390
390
|
abstract write(message: string, entry: LogEntry): void;
|
|
391
391
|
}
|
|
392
392
|
//#endregion
|
|
393
|
-
//#region
|
|
393
|
+
//#region ../../../alepha/src/logger/providers/LogFormatterProvider.d.ts
|
|
394
394
|
declare abstract class LogFormatterProvider {
|
|
395
395
|
abstract format(entry: LogEntry): string;
|
|
396
396
|
}
|
|
397
397
|
//#endregion
|
|
398
|
-
//#region
|
|
398
|
+
//#region ../../../alepha/src/logger/services/Logger.d.ts
|
|
399
399
|
declare class Logger implements LoggerInterface {
|
|
400
400
|
protected readonly alepha: Alepha;
|
|
401
401
|
protected readonly formatter: LogFormatterProvider;
|
|
@@ -422,8 +422,8 @@ declare class Logger implements LoggerInterface {
|
|
|
422
422
|
protected emit(entry: LogEntry, message?: string): void;
|
|
423
423
|
}
|
|
424
424
|
//#endregion
|
|
425
|
-
//#region
|
|
426
|
-
declare const envSchema$3:
|
|
425
|
+
//#region ../../../alepha/src/logger/index.d.ts
|
|
426
|
+
declare const envSchema$3: alepha20.TObject<{
|
|
427
427
|
/**
|
|
428
428
|
* Default log level for the application.
|
|
429
429
|
*
|
|
@@ -440,14 +440,14 @@ declare const envSchema$3: alepha4.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: alepha20.TOptional<alepha20.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 SimpleFormatterProvider}
|
|
448
448
|
* - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
|
|
449
449
|
*/
|
|
450
|
-
LOG_FORMAT:
|
|
450
|
+
LOG_FORMAT: alepha20.TOptional<alepha20.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
|
|
468
|
+
//#region ../../../alepha/src/server/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
|
|
478
|
+
//#region ../../../alepha/src/server/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: alepha20.HookPrimitive<"server:onRequest">;
|
|
488
|
+
readonly onResponse: alepha20.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
|
|
495
|
+
//#region ../../../alepha/src/server/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
|
|
534
|
+
//#region ../../../alepha/src/server/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: alepha20.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: alepha20.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
|
|
573
|
+
//#region ../../../alepha/src/cache/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
|
|
616
|
+
//#region ../../../alepha/src/cache/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
|
|
683
|
+
//#region ../../../alepha/src/server/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
|
|
755
|
+
//#region ../../../alepha/src/server/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
|
|
891
|
-
declare const envSchema$2:
|
|
892
|
-
SERVER_PORT:
|
|
893
|
-
SERVER_HOST:
|
|
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
894
|
}>;
|
|
895
895
|
declare module "alepha" {
|
|
896
896
|
interface Env extends Partial<Static<typeof envSchema$2>> {}
|
|
897
897
|
}
|
|
898
898
|
//#endregion
|
|
899
|
-
//#region
|
|
900
|
-
declare const envSchema$1:
|
|
901
|
-
SERVER_PORT:
|
|
902
|
-
SERVER_HOST:
|
|
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
903
|
}>;
|
|
904
904
|
declare module "alepha" {
|
|
905
905
|
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
906
906
|
}
|
|
907
907
|
//#endregion
|
|
908
|
-
//#region
|
|
908
|
+
//#region ../../../alepha/src/server/index.d.ts
|
|
909
909
|
declare module "alepha" {
|
|
910
910
|
interface State {
|
|
911
911
|
"alepha.node.server"?: Server;
|
|
@@ -961,7 +961,7 @@ declare module "alepha" {
|
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
963
|
//#endregion
|
|
964
|
-
//#region
|
|
964
|
+
//#region ../../../alepha/src/security/interfaces/UserAccountToken.d.ts
|
|
965
965
|
/**
|
|
966
966
|
* Add contextual metadata to a user account info.
|
|
967
967
|
* E.g. UserAccountToken is a UserAccountInfo during a request.
|
|
@@ -982,15 +982,15 @@ interface UserAccountToken extends UserAccount {
|
|
|
982
982
|
ownership?: string | boolean;
|
|
983
983
|
}
|
|
984
984
|
//#endregion
|
|
985
|
-
//#region
|
|
986
|
-
declare const envSchema:
|
|
987
|
-
APP_SECRET:
|
|
985
|
+
//#region ../../../alepha/src/security/providers/SecurityProvider.d.ts
|
|
986
|
+
declare const envSchema: alepha20.TObject<{
|
|
987
|
+
APP_SECRET: alepha20.TString;
|
|
988
988
|
}>;
|
|
989
989
|
declare module "alepha" {
|
|
990
990
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
991
991
|
}
|
|
992
992
|
//#endregion
|
|
993
|
-
//#region
|
|
993
|
+
//#region ../../../alepha/src/security/index.d.ts
|
|
994
994
|
declare module "alepha" {
|
|
995
995
|
interface Hooks {
|
|
996
996
|
"security:user:created": {
|
|
@@ -1012,19 +1012,19 @@ declare module "alepha" {
|
|
|
1012
1012
|
* @module alepha.security
|
|
1013
1013
|
*/
|
|
1014
1014
|
//#endregion
|
|
1015
|
-
//#region
|
|
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
|
|
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
|
|
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
|
|
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: 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
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: 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
1097
|
}>>;
|
|
1098
1098
|
}>;
|
|
1099
1099
|
type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
|
|
1100
1100
|
type ApiLink = Static<typeof apiLinkSchema>;
|
|
1101
1101
|
//#endregion
|
|
1102
|
-
//#region
|
|
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
|
|
1169
|
+
//#region ../../../alepha/src/server-links/index.d.ts
|
|
1170
1170
|
declare module "alepha" {
|
|
1171
1171
|
interface State {
|
|
1172
1172
|
/**
|
|
@@ -1190,7 +1190,7 @@ declare module "alepha" {
|
|
|
1190
1190
|
* @module alepha.server.links
|
|
1191
1191
|
*/
|
|
1192
1192
|
//#endregion
|
|
1193
|
-
//#region src/auth/hooks/useAuth.d.ts
|
|
1193
|
+
//#region ../../src/auth/hooks/useAuth.d.ts
|
|
1194
1194
|
declare const useAuth: <T extends object = any>() => {
|
|
1195
1195
|
user: {
|
|
1196
1196
|
name?: string | undefined;
|
|
@@ -1212,21 +1212,21 @@ declare const useAuth: <T extends object = any>() => {
|
|
|
1212
1212
|
can: <Api extends object = any>(name: keyof HttpVirtualClient<Api>) => boolean;
|
|
1213
1213
|
};
|
|
1214
1214
|
//#endregion
|
|
1215
|
-
//#region
|
|
1216
|
-
declare const tokensSchema:
|
|
1217
|
-
provider:
|
|
1218
|
-
access_token:
|
|
1219
|
-
issued_at:
|
|
1220
|
-
expires_in:
|
|
1221
|
-
refresh_token:
|
|
1222
|
-
refresh_token_expires_in:
|
|
1223
|
-
refresh_expires_in:
|
|
1224
|
-
id_token:
|
|
1225
|
-
scope:
|
|
1215
|
+
//#region ../../../alepha/src/server-auth/schemas/tokensSchema.d.ts
|
|
1216
|
+
declare const tokensSchema: alepha20.TObject<{
|
|
1217
|
+
provider: alepha20.TString;
|
|
1218
|
+
access_token: alepha20.TString;
|
|
1219
|
+
issued_at: alepha20.TNumber;
|
|
1220
|
+
expires_in: alepha20.TOptional<alepha20.TNumber>;
|
|
1221
|
+
refresh_token: alepha20.TOptional<alepha20.TString>;
|
|
1222
|
+
refresh_token_expires_in: alepha20.TOptional<alepha20.TNumber>;
|
|
1223
|
+
refresh_expires_in: alepha20.TOptional<alepha20.TNumber>;
|
|
1224
|
+
id_token: alepha20.TOptional<alepha20.TString>;
|
|
1225
|
+
scope: alepha20.TOptional<alepha20.TString>;
|
|
1226
1226
|
}>;
|
|
1227
1227
|
type Tokens = Static<typeof tokensSchema>;
|
|
1228
1228
|
//#endregion
|
|
1229
|
-
//#region
|
|
1229
|
+
//#region ../../../alepha/src/server-cookies/primitives/$cookie.d.ts
|
|
1230
1230
|
interface Cookies {
|
|
1231
1231
|
req: Record<string, string>;
|
|
1232
1232
|
res: Record<string, Cookie | null>;
|
|
@@ -1241,7 +1241,7 @@ interface Cookie {
|
|
|
1241
1241
|
domain?: string;
|
|
1242
1242
|
}
|
|
1243
1243
|
//#endregion
|
|
1244
|
-
//#region
|
|
1244
|
+
//#region ../../../alepha/src/server-cookies/index.d.ts
|
|
1245
1245
|
declare module "alepha/server" {
|
|
1246
1246
|
interface ServerRequest {
|
|
1247
1247
|
cookies: Cookies;
|
|
@@ -1258,7 +1258,7 @@ declare module "alepha/server" {
|
|
|
1258
1258
|
* @module alepha.server.cookies
|
|
1259
1259
|
*/
|
|
1260
1260
|
//#endregion
|
|
1261
|
-
//#region
|
|
1261
|
+
//#region ../../../alepha/src/server-auth/index.d.ts
|
|
1262
1262
|
declare module "alepha" {
|
|
1263
1263
|
interface State {
|
|
1264
1264
|
/**
|
|
@@ -1283,7 +1283,7 @@ declare module "alepha" {
|
|
|
1283
1283
|
* @module alepha.server.auth
|
|
1284
1284
|
*/
|
|
1285
1285
|
//#endregion
|
|
1286
|
-
//#region src/auth/services/ReactAuth.d.ts
|
|
1286
|
+
//#region ../../src/auth/services/ReactAuth.d.ts
|
|
1287
1287
|
/**
|
|
1288
1288
|
* Browser, SSR friendly, service to handle authentication.
|
|
1289
1289
|
*/
|
|
@@ -1292,8 +1292,8 @@ declare class ReactAuth {
|
|
|
1292
1292
|
protected readonly alepha: Alepha;
|
|
1293
1293
|
protected readonly httpClient: HttpClient;
|
|
1294
1294
|
protected readonly linkProvider: LinkProvider;
|
|
1295
|
-
protected readonly onBeginTransition:
|
|
1296
|
-
protected readonly onFetchRequest:
|
|
1295
|
+
protected readonly onBeginTransition: alepha20.HookPrimitive<"react:transition:begin">;
|
|
1296
|
+
protected readonly onFetchRequest: alepha20.HookPrimitive<"client:onRequest">;
|
|
1297
1297
|
/**
|
|
1298
1298
|
* Get the current authenticated user.
|
|
1299
1299
|
*
|
|
@@ -1321,13 +1321,13 @@ declare class ReactAuth {
|
|
|
1321
1321
|
logout(): void;
|
|
1322
1322
|
}
|
|
1323
1323
|
//#endregion
|
|
1324
|
-
//#region src/auth/providers/ReactAuthProvider.d.ts
|
|
1324
|
+
//#region ../../src/auth/providers/ReactAuthProvider.d.ts
|
|
1325
1325
|
declare class ReactAuthProvider {
|
|
1326
1326
|
protected readonly alepha: Alepha;
|
|
1327
|
-
readonly onRender:
|
|
1327
|
+
readonly onRender: alepha20.HookPrimitive<"react:server:render:begin">;
|
|
1328
1328
|
}
|
|
1329
1329
|
//#endregion
|
|
1330
|
-
//#region src/auth/index.d.ts
|
|
1330
|
+
//#region ../../src/auth/index.d.ts
|
|
1331
1331
|
declare module "@alepha/react" {
|
|
1332
1332
|
interface ReactRouterState {
|
|
1333
1333
|
user?: UserAccount;
|
|
@@ -1339,7 +1339,7 @@ declare module "@alepha/react" {
|
|
|
1339
1339
|
* @see {@link ReactAuthProvider}
|
|
1340
1340
|
* @module alepha.react.auth
|
|
1341
1341
|
*/
|
|
1342
|
-
declare const AlephaReactAuth:
|
|
1342
|
+
declare const AlephaReactAuth: alepha20.Service<alepha20.Module>;
|
|
1343
1343
|
//#endregion
|
|
1344
1344
|
export { AlephaReactAuth, ReactAuth, ReactAuthProvider, useAuth };
|
|
1345
1345
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/auth/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { HttpClient } from "alepha/server";
|
|
|
5
5
|
import { $auth, AlephaServerAuth, alephaServerAuthRoutes, tokenResponseSchema, userinfoResponseSchema } from "alepha/server/auth";
|
|
6
6
|
import { AlephaServerLinks, LinkProvider } from "alepha/server/links";
|
|
7
7
|
|
|
8
|
-
//#region src/auth/providers/ReactAuthProvider.ts
|
|
8
|
+
//#region ../../src/auth/providers/ReactAuthProvider.ts
|
|
9
9
|
var ReactAuthProvider = class {
|
|
10
10
|
alepha = $inject(Alepha);
|
|
11
11
|
onRender = $hook({
|
|
@@ -21,7 +21,7 @@ var ReactAuthProvider = class {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
|
-
//#region src/auth/services/ReactAuth.ts
|
|
24
|
+
//#region ../../src/auth/services/ReactAuth.ts
|
|
25
25
|
/**
|
|
26
26
|
* Browser, SSR friendly, service to handle authentication.
|
|
27
27
|
*/
|
|
@@ -93,7 +93,7 @@ var ReactAuth = class {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
//#endregion
|
|
96
|
-
//#region src/auth/hooks/useAuth.ts
|
|
96
|
+
//#region ../../src/auth/hooks/useAuth.ts
|
|
97
97
|
const useAuth = () => {
|
|
98
98
|
const alepha = useAlepha();
|
|
99
99
|
const [user] = useStore("alepha.server.request.user");
|
|
@@ -112,7 +112,7 @@ const useAuth = () => {
|
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
//#endregion
|
|
115
|
-
//#region src/auth/index.ts
|
|
115
|
+
//#region ../../src/auth/index.ts
|
|
116
116
|
/**
|
|
117
117
|
* The ReactAuthModule provides authentication services for React applications.
|
|
118
118
|
*
|