@alepha/ui 0.13.0 → 0.13.2
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/admin/{AdminFiles-CllAxb1B.js → AdminFiles-BjofP3OC.js} +11 -11
- package/dist/admin/AdminFiles-BjofP3OC.js.map +1 -0
- package/dist/admin/AdminFiles-DldZB7oo.js +3 -0
- package/dist/admin/AdminJobs-BOq6AZOW.js +3 -0
- package/dist/admin/{AdminJobs-BXkFtlVo.js → AdminJobs-CDnVxEv6.js} +11 -11
- package/dist/admin/AdminJobs-CDnVxEv6.js.map +1 -0
- package/dist/admin/AdminLayout-Bgx25J8m.js +3 -0
- package/dist/admin/{AdminLayout-CtkVYk-u.js → AdminLayout-CervL8LV.js} +6 -6
- package/dist/admin/AdminLayout-CervL8LV.js.map +1 -0
- package/dist/admin/AdminNotifications-BDQXt3-e.js +3 -0
- package/dist/admin/{AdminNotifications-DnnulNNV.js → AdminNotifications-DvI2989x.js} +6 -6
- package/dist/admin/AdminNotifications-DvI2989x.js.map +1 -0
- package/dist/admin/AdminParameters-D_v0GAvI.js +3 -0
- package/dist/admin/{AdminParameters-B3hvpLpu.js → AdminParameters-P1LB6ZI1.js} +7 -7
- package/dist/admin/AdminParameters-P1LB6ZI1.js.map +1 -0
- package/dist/admin/{AdminSessions-Pjdz-iZx.js → AdminSessions-CmDVneE2.js} +11 -11
- package/dist/admin/AdminSessions-CmDVneE2.js.map +1 -0
- package/dist/admin/AdminSessions-Dkk_fzWK.js +3 -0
- package/dist/admin/{AdminUsers-C1HsrRxn.js → AdminUsers-88De5pev.js} +9 -9
- package/dist/admin/AdminUsers-88De5pev.js.map +1 -0
- package/dist/admin/AdminUsers-oyAXqZ5l.js +3 -0
- package/dist/admin/AdminVerifications-D93TKymL.js +3 -0
- package/dist/admin/{AdminVerifications-VMpm30mS.js → AdminVerifications-DBVEoqJe.js} +6 -6
- package/dist/admin/AdminVerifications-DBVEoqJe.js.map +1 -0
- package/dist/admin/index.d.ts +320 -320
- package/dist/admin/index.js +17 -17
- package/dist/auth/{IconGoogle-Bfmuv9Rv.js → IconGoogle-v_58os2T.js} +1 -1
- package/dist/auth/{IconGoogle-Bfmuv9Rv.js.map → IconGoogle-v_58os2T.js.map} +1 -1
- package/dist/auth/Login-BC2jTczq.js +4 -0
- package/dist/auth/{Login-JeXFsUf5.js → Login-OCrvjs9U.js} +12 -12
- package/dist/auth/Login-OCrvjs9U.js.map +1 -0
- package/dist/auth/Register-Dh0lsQmI.js +4 -0
- package/dist/auth/{Register-CPQnvXCZ.js → Register-Ei34GSba.js} +16 -16
- package/dist/auth/Register-Ei34GSba.js.map +1 -0
- package/dist/auth/ResetPassword-BnlAQAOE.js +3 -0
- package/dist/auth/{ResetPassword-BzUjGG_-.js → ResetPassword-tO0oMzfo.js} +12 -12
- package/dist/auth/ResetPassword-tO0oMzfo.js.map +1 -0
- package/dist/auth/index.d.ts +1528 -1898
- package/dist/auth/index.js +10 -10
- package/dist/auth/index.js.map +1 -1
- package/dist/core/index.d.ts +152 -152
- package/dist/core/index.js +13 -6
- package/dist/core/index.js.map +1 -1
- package/package.json +6 -6
- package/src/admin/components/AdminParameters.tsx +1 -1
- package/src/core/components/buttons/OmnibarButton.tsx +10 -5
- package/src/core/components/layout/Omnibar.tsx +6 -1
- package/src/core/index.ts +1 -1
- package/dist/admin/AdminFiles-BM6_7_5A.cjs +0 -4
- package/dist/admin/AdminFiles-BaCIMeNt.js +0 -4
- package/dist/admin/AdminFiles-CllAxb1B.js.map +0 -1
- package/dist/admin/AdminFiles-DC3T8uWZ.cjs +0 -122
- package/dist/admin/AdminFiles-DC3T8uWZ.cjs.map +0 -1
- package/dist/admin/AdminJobs-BXkFtlVo.js.map +0 -1
- package/dist/admin/AdminJobs-C428qrNQ.cjs +0 -130
- package/dist/admin/AdminJobs-C428qrNQ.cjs.map +0 -1
- package/dist/admin/AdminJobs-DCPPaJ4i.cjs +0 -4
- package/dist/admin/AdminJobs-yC6DarGO.js +0 -4
- package/dist/admin/AdminLayout-Bqo4cd33.cjs +0 -4
- package/dist/admin/AdminLayout-CQpxfko6.js +0 -4
- package/dist/admin/AdminLayout-CiLlywAQ.cjs +0 -93
- package/dist/admin/AdminLayout-CiLlywAQ.cjs.map +0 -1
- package/dist/admin/AdminLayout-CtkVYk-u.js.map +0 -1
- package/dist/admin/AdminNotifications-DNUeJ-PW.cjs +0 -44
- package/dist/admin/AdminNotifications-DNUeJ-PW.cjs.map +0 -1
- package/dist/admin/AdminNotifications-DaMu1AQ4.js +0 -4
- package/dist/admin/AdminNotifications-DnnulNNV.js.map +0 -1
- package/dist/admin/AdminNotifications-ihgbKVCx.cjs +0 -4
- package/dist/admin/AdminParameters-B3hvpLpu.js.map +0 -1
- package/dist/admin/AdminParameters-U4lU1rUF.cjs +0 -4
- package/dist/admin/AdminParameters-gdf7036N.cjs +0 -44
- package/dist/admin/AdminParameters-gdf7036N.cjs.map +0 -1
- package/dist/admin/AdminParameters-prMcCgxf.js +0 -4
- package/dist/admin/AdminSessions-BF_P4lHs.cjs +0 -128
- package/dist/admin/AdminSessions-BF_P4lHs.cjs.map +0 -1
- package/dist/admin/AdminSessions-CATIU61I.cjs +0 -4
- package/dist/admin/AdminSessions-DqOXOpYR.js +0 -4
- package/dist/admin/AdminSessions-Pjdz-iZx.js.map +0 -1
- package/dist/admin/AdminUsers-BgTL-zSY.js +0 -4
- package/dist/admin/AdminUsers-C1HsrRxn.js.map +0 -1
- package/dist/admin/AdminUsers-HqvxwNGZ.cjs +0 -4
- package/dist/admin/AdminUsers-M2uEQbp5.cjs +0 -109
- package/dist/admin/AdminUsers-M2uEQbp5.cjs.map +0 -1
- package/dist/admin/AdminVerifications-BVssbtfU.cjs +0 -44
- package/dist/admin/AdminVerifications-BVssbtfU.cjs.map +0 -1
- package/dist/admin/AdminVerifications-Df6DRgNo.js +0 -4
- package/dist/admin/AdminVerifications-DxAtcYUR.cjs +0 -4
- package/dist/admin/AdminVerifications-VMpm30mS.js.map +0 -1
- package/dist/admin/core-CzO6aavT.js +0 -2507
- package/dist/admin/core-CzO6aavT.js.map +0 -1
- package/dist/admin/core-aFtK4l9I.cjs +0 -2530
- package/dist/admin/core-aFtK4l9I.cjs.map +0 -1
- package/dist/admin/index.cjs +0 -87
- package/dist/admin/index.cjs.map +0 -1
- package/dist/admin/index.d.cts +0 -1739
- package/dist/auth/IconGoogle-B17BTQyD.cjs +0 -69
- package/dist/auth/IconGoogle-B17BTQyD.cjs.map +0 -1
- package/dist/auth/Login-BTBmbnWl.cjs +0 -181
- package/dist/auth/Login-BTBmbnWl.cjs.map +0 -1
- package/dist/auth/Login-BcQOtG3v.js +0 -5
- package/dist/auth/Login-Btmd70Um.cjs +0 -5
- package/dist/auth/Login-JeXFsUf5.js.map +0 -1
- package/dist/auth/Register-CPQnvXCZ.js.map +0 -1
- package/dist/auth/Register-CbesZal3.cjs +0 -5
- package/dist/auth/Register-DpI_JdyO.js +0 -5
- package/dist/auth/Register-HP3rP71B.cjs +0 -323
- package/dist/auth/Register-HP3rP71B.cjs.map +0 -1
- package/dist/auth/ResetPassword-B-tkzV7g.cjs +0 -248
- package/dist/auth/ResetPassword-B-tkzV7g.cjs.map +0 -1
- package/dist/auth/ResetPassword-BlK3xEpU.js +0 -4
- package/dist/auth/ResetPassword-BzUjGG_-.js.map +0 -1
- package/dist/auth/ResetPassword-W3xjOnWy.cjs +0 -4
- package/dist/auth/chunk-DhGyd7sr.js +0 -28
- package/dist/auth/core-D1MHij1j.js +0 -1795
- package/dist/auth/core-D1MHij1j.js.map +0 -1
- package/dist/auth/core-rDZ9d92K.cjs +0 -1824
- package/dist/auth/core-rDZ9d92K.cjs.map +0 -1
- package/dist/auth/index.cjs +0 -211
- package/dist/auth/index.cjs.map +0 -1
- package/dist/auth/index.d.cts +0 -6265
- package/dist/core/index.cjs +0 -2620
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -2737
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import "@mantine/modals";
|
|
5
|
-
import "@mantine/notifications";
|
|
6
|
-
import "@mantine/nprogress";
|
|
1
|
+
import { ActionMenuConfig, ActionMenuItem, ActionProps } from "@alepha/ui";
|
|
2
|
+
import * as alepha1672 from "alepha";
|
|
3
|
+
import { Alepha, AlephaError, Async, FileLike, InstantiableClass, LogLevel, LoggerInterface, Page, PageQuery, Primitive, PrimitiveArgs, Service, Static, StaticEncode, StreamLike, TArray, TFile, TNull, TObject, TOptional, TRecord, TSchema, TStream, TString, TUnion, TVoid } from "alepha";
|
|
7
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { FC, ReactNode } from "react";
|
|
6
|
+
import { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
7
|
+
import { Readable } from "node:stream";
|
|
8
|
+
import { ReadableStream } from "node:stream/web";
|
|
10
9
|
import "dayjs/plugin/relativeTime.js";
|
|
11
10
|
import dayjsDuration from "dayjs/plugin/duration.js";
|
|
12
11
|
import "dayjs/plugin/utc.js";
|
|
@@ -17,9 +16,6 @@ import "dayjs/locale/fr.js";
|
|
|
17
16
|
import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
|
|
18
17
|
import { CryptoKey, FlattenedJWSInput, JSONWebKeySet, JWSHeaderParameters, JWTHeaderParameters, JWTPayload, JWTVerifyResult, KeyObject } from "jose";
|
|
19
18
|
import { JWTVerifyOptions } from "jose/jwt/verify";
|
|
20
|
-
import { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
21
|
-
import { Readable } from "node:stream";
|
|
22
|
-
import { ReadableStream } from "node:stream/web";
|
|
23
19
|
import * as drizzle_orm0 from "drizzle-orm";
|
|
24
20
|
import { BuildExtraConfigColumns, SQL, SQLWrapper } from "drizzle-orm";
|
|
25
21
|
import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
|
|
@@ -29,28 +25,275 @@ import * as DrizzleKit from "drizzle-kit/api";
|
|
|
29
25
|
import { Configuration } from "openid-client";
|
|
30
26
|
|
|
31
27
|
//#region ../alepha/src/security/schemas/userAccountInfoSchema.d.ts
|
|
32
|
-
declare const userAccountInfoSchema:
|
|
33
|
-
id:
|
|
34
|
-
name:
|
|
35
|
-
email:
|
|
36
|
-
username:
|
|
37
|
-
picture:
|
|
38
|
-
sessionId:
|
|
39
|
-
organizations:
|
|
40
|
-
roles:
|
|
28
|
+
declare const userAccountInfoSchema: alepha1672.TObject<{
|
|
29
|
+
id: alepha1672.TString;
|
|
30
|
+
name: alepha1672.TOptional<alepha1672.TString>;
|
|
31
|
+
email: alepha1672.TOptional<alepha1672.TString>;
|
|
32
|
+
username: alepha1672.TOptional<alepha1672.TString>;
|
|
33
|
+
picture: alepha1672.TOptional<alepha1672.TString>;
|
|
34
|
+
sessionId: alepha1672.TOptional<alepha1672.TString>;
|
|
35
|
+
organizations: alepha1672.TOptional<alepha1672.TArray<alepha1672.TString>>;
|
|
36
|
+
roles: alepha1672.TOptional<alepha1672.TArray<alepha1672.TString>>;
|
|
41
37
|
}>;
|
|
42
38
|
type UserAccount = Static<typeof userAccountInfoSchema>;
|
|
43
39
|
//#endregion
|
|
40
|
+
//#region ../alepha/src/server/schemas/errorSchema.d.ts
|
|
41
|
+
declare const errorSchema: alepha1672.TObject<{
|
|
42
|
+
error: alepha1672.TString;
|
|
43
|
+
status: alepha1672.TInteger;
|
|
44
|
+
message: alepha1672.TString;
|
|
45
|
+
details: alepha1672.TOptional<alepha1672.TString>;
|
|
46
|
+
requestId: alepha1672.TOptional<alepha1672.TString>;
|
|
47
|
+
cause: alepha1672.TOptional<alepha1672.TObject<{
|
|
48
|
+
name: alepha1672.TString;
|
|
49
|
+
message: alepha1672.TString;
|
|
50
|
+
}>>;
|
|
51
|
+
}>;
|
|
52
|
+
type ErrorSchema = Static<typeof errorSchema>;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region ../alepha/src/server/errors/HttpError.d.ts
|
|
55
|
+
declare class HttpError extends AlephaError {
|
|
56
|
+
name: string;
|
|
57
|
+
static is: (error: unknown, status?: number) => error is HttpErrorLike;
|
|
58
|
+
static toJSON(error: HttpError): ErrorSchema;
|
|
59
|
+
readonly error: string;
|
|
60
|
+
readonly status: number;
|
|
61
|
+
readonly requestId?: string;
|
|
62
|
+
readonly details?: string;
|
|
63
|
+
readonly reason?: {
|
|
64
|
+
name: string;
|
|
65
|
+
message: string;
|
|
66
|
+
};
|
|
67
|
+
constructor(options: Partial<ErrorSchema>, cause?: unknown);
|
|
68
|
+
}
|
|
69
|
+
interface HttpErrorLike extends Error {
|
|
70
|
+
status: number;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region ../alepha/src/router/providers/RouterProvider.d.ts
|
|
74
|
+
declare abstract class RouterProvider<T$1 extends Route = Route> {
|
|
75
|
+
protected routePathRegex: RegExp;
|
|
76
|
+
protected tree: Tree<T$1>;
|
|
77
|
+
protected cache: Map<string, RouteMatch<T$1>>;
|
|
78
|
+
match(path: string): RouteMatch<T$1>;
|
|
79
|
+
protected test(path: string): void;
|
|
80
|
+
protected push(route: T$1): void;
|
|
81
|
+
protected createRouteMatch(path: string): RouteMatch<T$1>;
|
|
82
|
+
protected mapParams(match: RouteMatch<T$1>): RouteMatch<T$1>;
|
|
83
|
+
protected createParts(path: string): string[];
|
|
84
|
+
}
|
|
85
|
+
interface RouteMatch<T$1 extends Route> {
|
|
86
|
+
route?: T$1;
|
|
87
|
+
params?: Record<string, string>;
|
|
88
|
+
}
|
|
89
|
+
interface Route {
|
|
90
|
+
path: string;
|
|
91
|
+
/**
|
|
92
|
+
* Rename a param in the route.
|
|
93
|
+
* This is automatically filled when you have scenarios like:
|
|
94
|
+
* `/customers/:id` and `/customers/:userId/payments`
|
|
95
|
+
*
|
|
96
|
+
* In this case, `:id` will be renamed to `:userId` in the second route.
|
|
97
|
+
*/
|
|
98
|
+
mapParams?: Record<string, string>;
|
|
99
|
+
}
|
|
100
|
+
interface Tree<T$1 extends Route> {
|
|
101
|
+
route?: T$1;
|
|
102
|
+
children: {
|
|
103
|
+
[key: string]: Tree<T$1>;
|
|
104
|
+
};
|
|
105
|
+
param?: {
|
|
106
|
+
route?: T$1;
|
|
107
|
+
name: string;
|
|
108
|
+
children: {
|
|
109
|
+
[key: string]: Tree<T$1>;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
wildcard?: {
|
|
113
|
+
route: T$1;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region ../alepha/src/server/constants/routeMethods.d.ts
|
|
118
|
+
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
119
|
+
type RouteMethod = (typeof routeMethods)[number];
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region ../alepha/src/server/helpers/ServerReply.d.ts
|
|
122
|
+
/**
|
|
123
|
+
* Helper for building server replies.
|
|
124
|
+
*/
|
|
125
|
+
declare class ServerReply {
|
|
126
|
+
headers: Record<string, string> & {
|
|
127
|
+
"set-cookie"?: string[];
|
|
128
|
+
};
|
|
129
|
+
status?: number;
|
|
130
|
+
body?: any;
|
|
131
|
+
/**
|
|
132
|
+
* Redirect to a given URL with optional status code (default 302).
|
|
133
|
+
*/
|
|
134
|
+
redirect(url: string, status?: number): void;
|
|
135
|
+
/**
|
|
136
|
+
* Set the response status code.
|
|
137
|
+
*/
|
|
138
|
+
setStatus(status: number): this;
|
|
139
|
+
/**
|
|
140
|
+
* Set a response header.
|
|
141
|
+
*/
|
|
142
|
+
setHeader(name: string, value: string): this;
|
|
143
|
+
/**
|
|
144
|
+
* Set the response body.
|
|
145
|
+
*/
|
|
146
|
+
setBody(body: any): this;
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region ../alepha/src/server/services/UserAgentParser.d.ts
|
|
150
|
+
interface UserAgentInfo {
|
|
151
|
+
os: "Windows" | "Android" | "Ubuntu" | "MacOS" | "iOS" | "Linux" | "FreeBSD" | "OpenBSD" | "ChromeOS" | "BlackBerry" | "Symbian" | "Windows Phone";
|
|
152
|
+
browser: "Chrome" | "Firefox" | "Safari" | "Edge" | "Opera" | "Internet Explorer" | "Brave" | "Vivaldi" | "Samsung Browser" | "UC Browser" | "Yandex";
|
|
153
|
+
device: "MOBILE" | "DESKTOP" | "TABLET";
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Simple User-Agent parser to detect OS, browser, and device type.
|
|
157
|
+
* This parser is not exhaustive and may not cover all edge cases.
|
|
158
|
+
*
|
|
159
|
+
* Use result for non
|
|
160
|
+
*/
|
|
161
|
+
declare class UserAgentParser {
|
|
162
|
+
parse(userAgent?: string): UserAgentInfo;
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region ../alepha/src/server/interfaces/ServerRequest.d.ts
|
|
166
|
+
type TRequestBody = TObject | TString | TArray | TRecord | TStream;
|
|
167
|
+
type TResponseBody = TObject | TString | TRecord | TFile | TArray | TStream | TVoid;
|
|
168
|
+
interface RequestConfigSchema {
|
|
169
|
+
body?: TRequestBody;
|
|
170
|
+
params?: TObject;
|
|
171
|
+
query?: TObject;
|
|
172
|
+
headers?: TObject;
|
|
173
|
+
response?: TResponseBody;
|
|
174
|
+
}
|
|
175
|
+
interface ServerRequestConfig<TConfig extends RequestConfigSchema = RequestConfigSchema> {
|
|
176
|
+
body: TConfig["body"] extends TRequestBody ? Static<TConfig["body"]> : any;
|
|
177
|
+
headers: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : Record<string, string>;
|
|
178
|
+
params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : Record<string, string>;
|
|
179
|
+
query: TConfig["query"] extends TObject ? Static<TConfig["query"]> : Record<string, any>;
|
|
180
|
+
}
|
|
181
|
+
type ServerRequestConfigEntry<TConfig extends RequestConfigSchema = RequestConfigSchema> = Partial<ServerRequestConfig<TConfig>>;
|
|
182
|
+
interface ServerRequest<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRequestConfig<TConfig> {
|
|
183
|
+
/**
|
|
184
|
+
* HTTP method used for this request.
|
|
185
|
+
*/
|
|
186
|
+
method: RouteMethod;
|
|
187
|
+
/**
|
|
188
|
+
* Full request URL.
|
|
189
|
+
*/
|
|
190
|
+
url: URL;
|
|
191
|
+
/**
|
|
192
|
+
* Unique request ID assigned to this request.
|
|
193
|
+
*/
|
|
194
|
+
requestId: string;
|
|
195
|
+
/**
|
|
196
|
+
* Client IP address.
|
|
197
|
+
* Will parse `X-Forwarded-For` header if present.
|
|
198
|
+
*/
|
|
199
|
+
ip?: string;
|
|
200
|
+
/**
|
|
201
|
+
* Value of the `Host` header sent by the client.
|
|
202
|
+
*/
|
|
203
|
+
host?: string;
|
|
204
|
+
/**
|
|
205
|
+
* Browser user agent information.
|
|
206
|
+
* Information are not guaranteed to be accurate. Use with caution.
|
|
207
|
+
*
|
|
208
|
+
* @see {@link UserAgentParser}
|
|
209
|
+
*/
|
|
210
|
+
userAgent: UserAgentInfo;
|
|
211
|
+
/**
|
|
212
|
+
* Arbitrary metadata attached to the request. Can be used by middlewares to store information.
|
|
213
|
+
*/
|
|
214
|
+
metadata: Record<string, any>;
|
|
215
|
+
/**
|
|
216
|
+
* Reply object to be used to send response.
|
|
217
|
+
*/
|
|
218
|
+
reply: ServerReply;
|
|
219
|
+
/**
|
|
220
|
+
* The raw underlying request object (Web Request).
|
|
221
|
+
*/
|
|
222
|
+
raw: ServerRawRequest;
|
|
223
|
+
}
|
|
224
|
+
interface ServerRoute<TConfig extends RequestConfigSchema = RequestConfigSchema> extends Route {
|
|
225
|
+
/**
|
|
226
|
+
* Handler function for this route.
|
|
227
|
+
*/
|
|
228
|
+
handler: ServerHandler<TConfig>;
|
|
229
|
+
/**
|
|
230
|
+
* HTTP method for this route.
|
|
231
|
+
*/
|
|
232
|
+
method?: RouteMethod;
|
|
233
|
+
/**
|
|
234
|
+
* Request/response schema for this route.
|
|
235
|
+
*
|
|
236
|
+
* Request schema contains:
|
|
237
|
+
* - body, for POST/PUT/PATCH requests
|
|
238
|
+
* - params, for URL parameters (e.g. /user/:id)
|
|
239
|
+
* - query, for URL query parameters (e.g. /user?id=123)
|
|
240
|
+
* - headers, for HTTP headers
|
|
241
|
+
*
|
|
242
|
+
* Response schema contains:
|
|
243
|
+
* - response
|
|
244
|
+
*
|
|
245
|
+
* Response schema is used to validate and serialize the response sent by the handler.
|
|
246
|
+
*/
|
|
247
|
+
schema?: TConfig;
|
|
248
|
+
/**
|
|
249
|
+
* @see ServerLoggerProvider
|
|
250
|
+
*/
|
|
251
|
+
silent?: boolean;
|
|
252
|
+
}
|
|
253
|
+
type ServerResponseBody<TConfig extends RequestConfigSchema = RequestConfigSchema> = TConfig["response"] extends TResponseBody ? Static<TConfig["response"]> : ResponseBodyType;
|
|
254
|
+
type ResponseKind = "json" | "text" | "void" | "file" | "any";
|
|
255
|
+
type ResponseBodyType = string | Buffer | StreamLike | undefined | null | void;
|
|
256
|
+
type ServerHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
|
|
257
|
+
interface ServerResponse$1 {
|
|
258
|
+
body: string | Buffer | ArrayBuffer | Readable | ReadableStream;
|
|
259
|
+
headers: Record<string, string>;
|
|
260
|
+
status: number;
|
|
261
|
+
}
|
|
262
|
+
type ServerRouteRequestHandler = (request: ServerRequestData) => Promise<ServerResponse$1>;
|
|
263
|
+
interface ServerRouteMatcher extends Route {
|
|
264
|
+
handler: ServerRouteRequestHandler;
|
|
265
|
+
}
|
|
266
|
+
interface ServerRequestData {
|
|
267
|
+
method: RouteMethod;
|
|
268
|
+
url: URL;
|
|
269
|
+
headers: Record<string, string>;
|
|
270
|
+
query: Record<string, string>;
|
|
271
|
+
params: Record<string, string>;
|
|
272
|
+
raw: ServerRawRequest;
|
|
273
|
+
}
|
|
274
|
+
interface ServerRawRequest {
|
|
275
|
+
node?: NodeRequestEvent;
|
|
276
|
+
web?: WebRequestEvent;
|
|
277
|
+
}
|
|
278
|
+
interface NodeRequestEvent {
|
|
279
|
+
req: IncomingMessage;
|
|
280
|
+
res: ServerResponse;
|
|
281
|
+
}
|
|
282
|
+
interface WebRequestEvent {
|
|
283
|
+
req: Request;
|
|
284
|
+
res?: Response;
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
44
287
|
//#region ../alepha/src/logger/schemas/logEntrySchema.d.ts
|
|
45
|
-
declare const logEntrySchema:
|
|
46
|
-
level:
|
|
47
|
-
message:
|
|
48
|
-
service:
|
|
49
|
-
module:
|
|
50
|
-
context:
|
|
51
|
-
app:
|
|
52
|
-
data:
|
|
53
|
-
timestamp:
|
|
288
|
+
declare const logEntrySchema: alepha1672.TObject<{
|
|
289
|
+
level: alepha1672.TUnsafe<"TRACE" | "SILENT" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
|
|
290
|
+
message: alepha1672.TString;
|
|
291
|
+
service: alepha1672.TString;
|
|
292
|
+
module: alepha1672.TString;
|
|
293
|
+
context: alepha1672.TOptional<alepha1672.TString>;
|
|
294
|
+
app: alepha1672.TOptional<alepha1672.TString>;
|
|
295
|
+
data: alepha1672.TOptional<alepha1672.TAny>;
|
|
296
|
+
timestamp: alepha1672.TNumber;
|
|
54
297
|
}>;
|
|
55
298
|
type LogEntry = Static<typeof logEntrySchema>;
|
|
56
299
|
//#endregion
|
|
@@ -65,8 +308,8 @@ declare class DateTimeProvider {
|
|
|
65
308
|
protected readonly timeouts: Timeout[];
|
|
66
309
|
protected readonly intervals: Interval[];
|
|
67
310
|
constructor();
|
|
68
|
-
protected readonly onStart:
|
|
69
|
-
protected readonly onStop:
|
|
311
|
+
protected readonly onStart: alepha1672.HookPrimitive<"start">;
|
|
312
|
+
protected readonly onStop: alepha1672.HookPrimitive<"stop">;
|
|
70
313
|
setLocale(locale: string): void;
|
|
71
314
|
isDateTime(value: unknown): value is DateTime;
|
|
72
315
|
/**
|
|
@@ -198,7 +441,7 @@ declare class Logger implements LoggerInterface {
|
|
|
198
441
|
}
|
|
199
442
|
//#endregion
|
|
200
443
|
//#region ../alepha/src/logger/index.d.ts
|
|
201
|
-
declare const envSchema$9:
|
|
444
|
+
declare const envSchema$9: alepha1672.TObject<{
|
|
202
445
|
/**
|
|
203
446
|
* Default log level for the application.
|
|
204
447
|
*
|
|
@@ -215,14 +458,14 @@ declare const envSchema$9: alepha1223.TObject<{
|
|
|
215
458
|
* LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
|
|
216
459
|
* LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
|
|
217
460
|
*/
|
|
218
|
-
LOG_LEVEL:
|
|
461
|
+
LOG_LEVEL: alepha1672.TOptional<alepha1672.TString>;
|
|
219
462
|
/**
|
|
220
463
|
* Built-in log formats.
|
|
221
464
|
* - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
|
|
222
465
|
* - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
|
|
223
466
|
* - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
|
|
224
467
|
*/
|
|
225
|
-
LOG_FORMAT:
|
|
468
|
+
LOG_FORMAT: alepha1672.TOptional<alepha1672.TUnsafe<"json" | "pretty" | "raw">>;
|
|
226
469
|
}>;
|
|
227
470
|
declare module "alepha" {
|
|
228
471
|
interface Env extends Partial<Static<typeof envSchema$9>> {}
|
|
@@ -240,1142 +483,895 @@ declare module "alepha" {
|
|
|
240
483
|
}
|
|
241
484
|
}
|
|
242
485
|
//#endregion
|
|
243
|
-
//#region ../alepha/src/
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
*/
|
|
252
|
-
token?: string;
|
|
253
|
-
/**
|
|
254
|
-
* Realm name of the user.
|
|
255
|
-
*/
|
|
256
|
-
realm?: string;
|
|
257
|
-
/**
|
|
258
|
-
* Is user dedicated to his own resources for this scope ?
|
|
259
|
-
* Mostly, Admin is false and Customer is true.
|
|
260
|
-
*/
|
|
261
|
-
ownership?: string | boolean;
|
|
486
|
+
//#region ../alepha/src/server/services/ServerRequestParser.d.ts
|
|
487
|
+
declare class ServerRequestParser {
|
|
488
|
+
protected readonly alepha: Alepha;
|
|
489
|
+
protected readonly userAgentParser: UserAgentParser;
|
|
490
|
+
createServerRequest(rawRequest: ServerRequestData): ServerRequest;
|
|
491
|
+
getRequestId(request: ServerRequestData): string | undefined;
|
|
492
|
+
getRequestUserAgent(request: ServerRequestData): UserAgentInfo;
|
|
493
|
+
getRequestIp(request: ServerRequestData): string | undefined;
|
|
262
494
|
}
|
|
263
495
|
//#endregion
|
|
264
|
-
//#region ../alepha/src/
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
name:
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
name: alepha1223.TString;
|
|
281
|
-
ownership: alepha1223.TOptional<alepha1223.TBoolean>;
|
|
282
|
-
exclude: alepha1223.TOptional<alepha1223.TArray<alepha1223.TString>>;
|
|
283
|
-
}>>;
|
|
284
|
-
}>;
|
|
285
|
-
type Role = Static<typeof roleSchema>;
|
|
496
|
+
//#region ../alepha/src/server/providers/ServerTimingProvider.d.ts
|
|
497
|
+
type TimingMap = Record<string, [number, number]>;
|
|
498
|
+
declare class ServerTimingProvider {
|
|
499
|
+
protected readonly log: Logger;
|
|
500
|
+
protected readonly alepha: Alepha;
|
|
501
|
+
options: {
|
|
502
|
+
prefix: string;
|
|
503
|
+
disabled: boolean;
|
|
504
|
+
};
|
|
505
|
+
readonly onRequest: alepha1672.HookPrimitive<"server:onRequest">;
|
|
506
|
+
readonly onResponse: alepha1672.HookPrimitive<"server:onResponse">;
|
|
507
|
+
protected get handlerName(): string;
|
|
508
|
+
beginTiming(name: string): void;
|
|
509
|
+
endTiming(name: string): void;
|
|
510
|
+
protected setDuration(name: string, timing: TimingMap): void;
|
|
511
|
+
}
|
|
286
512
|
//#endregion
|
|
287
|
-
//#region ../alepha/src/
|
|
513
|
+
//#region ../alepha/src/server/providers/ServerRouterProvider.d.ts
|
|
288
514
|
/**
|
|
289
|
-
*
|
|
515
|
+
* Main router for all routes on the server side.
|
|
516
|
+
*
|
|
517
|
+
* - $route => generic route
|
|
518
|
+
* - $action => action route (for API calls)
|
|
519
|
+
* - $page => React route (for SSR)
|
|
290
520
|
*/
|
|
291
|
-
declare class
|
|
521
|
+
declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
|
|
292
522
|
protected readonly log: Logger;
|
|
293
|
-
protected readonly
|
|
294
|
-
protected readonly
|
|
295
|
-
protected readonly
|
|
296
|
-
|
|
297
|
-
* Adds a key loader to the embedded keystore.
|
|
298
|
-
*
|
|
299
|
-
* @param name
|
|
300
|
-
* @param secretKeyOrJwks
|
|
301
|
-
*/
|
|
302
|
-
setKeyLoader(name: string, secretKeyOrJwks: string | JSONWebKeySet): void;
|
|
303
|
-
/**
|
|
304
|
-
* Retrieves the payload from a JSON Web Token (JWT).
|
|
305
|
-
*
|
|
306
|
-
* @param token - The JWT to extract the payload from.
|
|
307
|
-
*
|
|
308
|
-
* @return A Promise that resolves with the payload object from the token.
|
|
309
|
-
*/
|
|
310
|
-
parse(token: string, keyName?: string, options?: JWTVerifyOptions): Promise<JwtParseResult>;
|
|
311
|
-
/**
|
|
312
|
-
* Creates a JWT token with the provided payload and secret key.
|
|
313
|
-
*
|
|
314
|
-
* @param payload - The payload to be encoded in the token.
|
|
315
|
-
* It should include the `realm_access` property which contains an array of roles.
|
|
316
|
-
* @param keyName - The name of the key to use when signing the token.
|
|
317
|
-
*
|
|
318
|
-
* @returns The signed JWT token.
|
|
319
|
-
*/
|
|
320
|
-
create(payload: ExtendedJWTPayload, keyName?: string, signOptions?: JwtSignOptions): Promise<string>;
|
|
523
|
+
protected readonly alepha: Alepha;
|
|
524
|
+
protected readonly routes: ServerRoute[];
|
|
525
|
+
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
526
|
+
protected readonly serverRequestParser: ServerRequestParser;
|
|
321
527
|
/**
|
|
322
|
-
*
|
|
528
|
+
* Get all registered routes, optionally filtered by a pattern.
|
|
323
529
|
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
530
|
+
* Pattern accept simple wildcard '*' at the end.
|
|
531
|
+
* Example: '/api/*' will match all routes starting with '/api/' but '/api/' will match only that exact route.
|
|
326
532
|
*/
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
realm_access?: {
|
|
345
|
-
roles: string[];
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
interface JwtParseResult {
|
|
349
|
-
keyName: string;
|
|
350
|
-
result: JWTVerifyResult<ExtendedJWTPayload>;
|
|
533
|
+
getRoutes(pattern?: string): ServerRoute[];
|
|
534
|
+
createRoute<TConfig extends RequestConfigSchema = RequestConfigSchema>(route: ServerRoute<TConfig>): void;
|
|
535
|
+
protected getContextId(headers: Record<string, string>): string;
|
|
536
|
+
protected processRequest(request: ServerRequest, route: ServerRoute, responseKind: ResponseKind): Promise<{
|
|
537
|
+
status: number;
|
|
538
|
+
headers: Record<string, string> & {
|
|
539
|
+
"set-cookie"?: string[];
|
|
540
|
+
};
|
|
541
|
+
body: any;
|
|
542
|
+
}>;
|
|
543
|
+
protected runRouteHandler(route: ServerRoute, request: ServerRequest, responseKind: ResponseKind): Promise<void>;
|
|
544
|
+
serializeResponse(route: ServerRoute, reply: ServerReply, responseKind: ResponseKind): void;
|
|
545
|
+
protected getResponseType(schema?: RequestConfigSchema): ResponseKind;
|
|
546
|
+
protected errorHandler(route: ServerRoute, request: ServerRequest, error: Error): Promise<void>;
|
|
547
|
+
validateRequest(route: {
|
|
548
|
+
schema?: RequestConfigSchema;
|
|
549
|
+
}, request: ServerRequestConfig): void;
|
|
351
550
|
}
|
|
352
551
|
//#endregion
|
|
353
|
-
//#region ../alepha/src/
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
protected readonly PERMISSION_REGEXP: RegExp;
|
|
363
|
-
protected readonly PERMISSION_REGEXP_WILDCARD: RegExp;
|
|
552
|
+
//#region ../alepha/src/server/providers/ServerProvider.d.ts
|
|
553
|
+
/**
|
|
554
|
+
* Base server provider to handle incoming requests and route them.
|
|
555
|
+
*
|
|
556
|
+
* This is the default implementation for serverless environments.
|
|
557
|
+
*
|
|
558
|
+
* ServerProvider supports both Node.js HTTP requests and Web (Fetch API) requests.
|
|
559
|
+
*/
|
|
560
|
+
declare class ServerProvider {
|
|
364
561
|
protected readonly log: Logger;
|
|
365
|
-
protected readonly jwt: JwtProvider;
|
|
366
|
-
protected readonly env: {
|
|
367
|
-
APP_SECRET: string;
|
|
368
|
-
};
|
|
369
562
|
protected readonly alepha: Alepha;
|
|
370
|
-
|
|
563
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
564
|
+
protected readonly router: ServerRouterProvider;
|
|
565
|
+
protected readonly internalServerErrorMessage = "Internal Server Error";
|
|
566
|
+
get hostname(): string;
|
|
371
567
|
/**
|
|
372
|
-
*
|
|
568
|
+
* When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
|
|
373
569
|
*/
|
|
374
|
-
protected readonly
|
|
570
|
+
protected readonly onNodeRequest: alepha1672.HookPrimitive<"node:request">;
|
|
375
571
|
/**
|
|
376
|
-
*
|
|
572
|
+
* When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
|
|
377
573
|
*/
|
|
378
|
-
protected readonly
|
|
379
|
-
protected start: alepha1223.HookDescriptor<"start">;
|
|
574
|
+
protected readonly onWebRequest: alepha1672.HookPrimitive<"web:request">;
|
|
380
575
|
/**
|
|
381
|
-
*
|
|
576
|
+
* Handle Node.js HTTP request event.
|
|
382
577
|
*
|
|
383
|
-
*
|
|
384
|
-
* @param realms
|
|
578
|
+
* Technically, we just convert Node.js request to Web Standard Request.
|
|
385
579
|
*/
|
|
386
|
-
|
|
580
|
+
handleNodeRequest(nodeRequestEvent: NodeRequestEvent): Promise<void>;
|
|
387
581
|
/**
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
* @param raw - The permission to add.
|
|
582
|
+
* Handle Web (Fetch API) request event.
|
|
391
583
|
*/
|
|
392
|
-
|
|
393
|
-
createRealm(realm: Realm): void;
|
|
584
|
+
handleWebRequest(ev: WebRequestEvent): Promise<void>;
|
|
394
585
|
/**
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
* Only available when the app is started.
|
|
398
|
-
*
|
|
399
|
-
* @param realm - The realm to update the roles for.
|
|
400
|
-
* @param roles - The roles to update.
|
|
586
|
+
* Helper for Vite development mode to let Vite handle (or not) 404.
|
|
401
587
|
*/
|
|
402
|
-
|
|
588
|
+
protected isViteNotFound(url?: string, route?: Route, params?: Record<string, string>): boolean;
|
|
589
|
+
}
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region ../alepha/src/cache/providers/CacheProvider.d.ts
|
|
592
|
+
/**
|
|
593
|
+
* Cache provider interface.
|
|
594
|
+
*
|
|
595
|
+
* All methods are asynchronous and return promises.
|
|
596
|
+
* Values are stored as Uint8Array.
|
|
597
|
+
*/
|
|
598
|
+
declare abstract class CacheProvider {
|
|
403
599
|
/**
|
|
404
|
-
*
|
|
600
|
+
* Get the value of a key.
|
|
405
601
|
*
|
|
406
|
-
* @param
|
|
407
|
-
* @param
|
|
602
|
+
* @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
|
|
603
|
+
* @param key The key of the value to get.
|
|
408
604
|
*
|
|
409
|
-
* @
|
|
605
|
+
* @return The value of the key, or undefined if the key does not exist.
|
|
410
606
|
*/
|
|
411
|
-
|
|
607
|
+
abstract get(name: string, key: string): Promise<Uint8Array | undefined>;
|
|
412
608
|
/**
|
|
413
|
-
*
|
|
609
|
+
* Set the string value of a key.
|
|
414
610
|
*
|
|
415
|
-
*
|
|
611
|
+
* @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
|
|
612
|
+
* @param key The key of the value to set.
|
|
613
|
+
* @param value The value to set.
|
|
614
|
+
* @param ttl The time-to-live of the key, in milliseconds.
|
|
416
615
|
*
|
|
417
|
-
* @
|
|
418
|
-
* @param roleEntries - The roles to check for the permission.
|
|
419
|
-
*/
|
|
420
|
-
checkPermission(permissionLike: string | Permission, ...roleEntries: string[]): SecurityCheckResult;
|
|
421
|
-
/**
|
|
422
|
-
* Creates a user account from the provided payload.
|
|
616
|
+
* @return The value of the key.
|
|
423
617
|
*/
|
|
424
|
-
|
|
425
|
-
permission?: Permission | string;
|
|
426
|
-
realm?: string;
|
|
427
|
-
verify?: JWTVerifyOptions;
|
|
428
|
-
}): Promise<UserAccountToken>;
|
|
618
|
+
abstract set(name: string, key: string, value: Uint8Array, ttl?: number): Promise<Uint8Array>;
|
|
429
619
|
/**
|
|
430
|
-
*
|
|
620
|
+
* Remove the specified keys.
|
|
431
621
|
*
|
|
432
|
-
* @param
|
|
433
|
-
* @param
|
|
434
|
-
* @returns True if the user has the role, false otherwise.
|
|
622
|
+
* @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
|
|
623
|
+
* @param keys The keys to delete.
|
|
435
624
|
*/
|
|
436
|
-
|
|
625
|
+
abstract del(name: string, ...keys: string[]): Promise<void>;
|
|
626
|
+
abstract has(name: string, key: string): Promise<boolean>;
|
|
627
|
+
abstract keys(name: string, filter?: string): Promise<string[]>;
|
|
437
628
|
/**
|
|
438
|
-
*
|
|
629
|
+
* Remove all keys from all cache names.
|
|
439
630
|
*/
|
|
440
|
-
|
|
631
|
+
abstract clear(): Promise<void>;
|
|
632
|
+
}
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region ../alepha/src/cache/primitives/$cache.d.ts
|
|
635
|
+
interface CachePrimitiveOptions<TReturn = any, TParameter extends any[] = any[]> {
|
|
441
636
|
/**
|
|
442
|
-
*
|
|
637
|
+
* The cache name. This is useful for invalidating multiple caches at once.
|
|
443
638
|
*
|
|
444
|
-
*
|
|
639
|
+
* Store key as `cache:$name:$key`.
|
|
640
|
+
*
|
|
641
|
+
* @default Name of the key of the class.
|
|
445
642
|
*/
|
|
446
|
-
|
|
447
|
-
getRealms(): Realm[];
|
|
643
|
+
name?: string;
|
|
448
644
|
/**
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
* @param realm
|
|
645
|
+
* Function which returns cached data.
|
|
452
646
|
*/
|
|
453
|
-
|
|
647
|
+
handler?: (...args: TParameter) => TReturn;
|
|
454
648
|
/**
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* @param user - Filter permissions by user.
|
|
458
|
-
*
|
|
459
|
-
* @return An array containing all permissions.
|
|
649
|
+
* The key generator for the cache.
|
|
650
|
+
* If not provided, the arguments will be json.stringify().
|
|
460
651
|
*/
|
|
461
|
-
|
|
462
|
-
roles?: Array<Role | string>;
|
|
463
|
-
realm?: string;
|
|
464
|
-
}): Permission[];
|
|
652
|
+
key?: (...args: TParameter) => string;
|
|
465
653
|
/**
|
|
466
|
-
*
|
|
654
|
+
* The store provider for the cache.
|
|
655
|
+
* If not provided, the default store provider will be used.
|
|
656
|
+
*/
|
|
657
|
+
provider?: InstantiableClass<CacheProvider> | "memory";
|
|
658
|
+
/**
|
|
659
|
+
* The time-to-live for the cache in seconds.
|
|
660
|
+
* Set 0 to skip expiration.
|
|
467
661
|
*
|
|
468
|
-
* @
|
|
469
|
-
* @return The user ID as a string.
|
|
662
|
+
* @default 300 (5 minutes).
|
|
470
663
|
*/
|
|
471
|
-
|
|
472
|
-
getSessionIdFromPayload(payload: Record<string, any>): string | undefined;
|
|
664
|
+
ttl?: DurationLike;
|
|
473
665
|
/**
|
|
474
|
-
*
|
|
475
|
-
* @param payload - The payload object from which to extract the roles.
|
|
476
|
-
* @return An array of role strings.
|
|
666
|
+
* If the cache is disabled.
|
|
477
667
|
*/
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
668
|
+
disabled?: boolean;
|
|
669
|
+
}
|
|
670
|
+
declare class CachePrimitive<TReturn = any, TParameter extends any[] = any[]> extends Primitive<CachePrimitiveOptions<TReturn, TParameter>> {
|
|
671
|
+
protected readonly env: {
|
|
672
|
+
CACHE_ENABLED: boolean;
|
|
673
|
+
CACHE_DEFAULT_TTL: number;
|
|
674
|
+
};
|
|
675
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
676
|
+
protected readonly provider: CacheProvider;
|
|
677
|
+
protected encoder: TextEncoder;
|
|
678
|
+
protected decoder: TextDecoder;
|
|
679
|
+
protected codes: {
|
|
680
|
+
BINARY: number;
|
|
681
|
+
JSON: number;
|
|
682
|
+
STRING: number;
|
|
683
|
+
};
|
|
684
|
+
get container(): string;
|
|
685
|
+
run(...args: TParameter): Promise<TReturn>;
|
|
686
|
+
key(...args: TParameter): string;
|
|
687
|
+
invalidate(...keys: string[]): Promise<void>;
|
|
688
|
+
set(key: string, value: TReturn, ttl?: DurationLike): Promise<void>;
|
|
689
|
+
get(key: string): Promise<TReturn | undefined>;
|
|
690
|
+
protected serialize<TReturn>(value: TReturn): Uint8Array;
|
|
691
|
+
protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
|
|
692
|
+
protected $provider(): CacheProvider;
|
|
693
|
+
}
|
|
694
|
+
interface CachePrimitiveFn<TReturn = any, TParameter extends any[] = any[]> extends CachePrimitive<TReturn, TParameter> {
|
|
482
695
|
/**
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
* @param payload - The payload object.
|
|
486
|
-
* @returns The name extracted from the payload, or an empty string if the payload is falsy or no name is found.
|
|
696
|
+
* Run the cache primitive with the provided arguments.
|
|
487
697
|
*/
|
|
488
|
-
|
|
489
|
-
getOrganizationsFromPayload(payload: Record<string, any>): string[] | undefined;
|
|
698
|
+
(...args: TParameter): Promise<TReturn>;
|
|
490
699
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
700
|
+
//#endregion
|
|
701
|
+
//#region ../alepha/src/server/services/HttpClient.d.ts
|
|
702
|
+
declare class HttpClient {
|
|
703
|
+
protected readonly log: Logger;
|
|
704
|
+
protected readonly alepha: Alepha;
|
|
705
|
+
readonly cache: CachePrimitiveFn<HttpClientCache, any[]>;
|
|
706
|
+
protected readonly pendingRequests: HttpClientPendingRequests;
|
|
707
|
+
fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
|
|
708
|
+
fetch<T$1 extends TSchema>(url: string, request?: RequestInitWithOptions<T$1>): Promise<FetchResponse<Static<T$1>>>;
|
|
709
|
+
protected url(host: string, action: HttpAction, args: ServerRequestConfigEntry): string;
|
|
710
|
+
protected body(init: RequestInit, headers: Record<string, string>, action: HttpAction, args?: ServerRequestConfigEntry): Promise<void>;
|
|
711
|
+
protected responseData(response: Response, options: FetchOptions): Promise<any>;
|
|
712
|
+
protected isMaybeFile(response: Response): boolean;
|
|
713
|
+
protected createFileLike(response: Response, defaultFileName?: string): FileLike;
|
|
714
|
+
pathVariables(url: string, action: {
|
|
715
|
+
schema?: {
|
|
716
|
+
params?: TObject;
|
|
717
|
+
};
|
|
718
|
+
}, args?: ServerRequestConfigEntry): string;
|
|
719
|
+
queryParams(url: string, action: {
|
|
720
|
+
schema?: {
|
|
721
|
+
query?: TObject;
|
|
722
|
+
};
|
|
723
|
+
}, args?: ServerRequestConfigEntry): string;
|
|
724
|
+
}
|
|
725
|
+
interface FetchOptions<T$1 extends TSchema = TSchema> {
|
|
497
726
|
/**
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
* Can be also a JWKS URL.
|
|
727
|
+
* Key to identify the request in the pending requests.
|
|
501
728
|
*/
|
|
502
|
-
|
|
729
|
+
key?: string;
|
|
503
730
|
/**
|
|
504
|
-
*
|
|
505
|
-
* By default, SecurityProvider has his own implementation, but this method allow to override it.
|
|
731
|
+
* The schema to validate the response against.
|
|
506
732
|
*/
|
|
507
|
-
|
|
733
|
+
schema?: {
|
|
734
|
+
response?: T$1;
|
|
735
|
+
};
|
|
736
|
+
/**
|
|
737
|
+
* Built-in cache options.
|
|
738
|
+
*/
|
|
739
|
+
localCache?: boolean | number | DurationLike;
|
|
508
740
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
741
|
+
type RequestInitWithOptions<T$1 extends TSchema = TSchema> = RequestInit & FetchOptions<T$1>;
|
|
742
|
+
interface FetchResponse<T$1 = any> {
|
|
743
|
+
data: T$1;
|
|
744
|
+
status: number;
|
|
745
|
+
statusText: string;
|
|
746
|
+
headers: Headers;
|
|
747
|
+
raw?: Response;
|
|
748
|
+
}
|
|
749
|
+
type HttpClientPendingRequests = Record<string, Promise<any> | undefined>;
|
|
750
|
+
interface HttpClientCache {
|
|
751
|
+
data: any;
|
|
752
|
+
etag?: string;
|
|
753
|
+
}
|
|
754
|
+
interface FetchActionArgs {
|
|
755
|
+
action: HttpAction;
|
|
756
|
+
host?: string;
|
|
757
|
+
config?: ServerRequestConfigEntry;
|
|
758
|
+
options?: ClientRequestOptions;
|
|
759
|
+
}
|
|
760
|
+
interface HttpAction {
|
|
761
|
+
method?: string;
|
|
762
|
+
prefix?: string;
|
|
763
|
+
path: string;
|
|
764
|
+
requestBodyType?: string;
|
|
765
|
+
schema?: {
|
|
766
|
+
params?: TObject;
|
|
767
|
+
query?: TObject;
|
|
768
|
+
body?: TRequestBody;
|
|
769
|
+
response?: TResponseBody;
|
|
770
|
+
};
|
|
512
771
|
}
|
|
513
772
|
//#endregion
|
|
514
|
-
//#region ../alepha/src/
|
|
515
|
-
|
|
773
|
+
//#region ../alepha/src/server/primitives/$action.d.ts
|
|
774
|
+
interface ActionPrimitiveOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
|
|
516
775
|
/**
|
|
517
|
-
*
|
|
518
|
-
*
|
|
776
|
+
* Name of the action.
|
|
777
|
+
*
|
|
778
|
+
* - It will be used to generate the route path if `path` is not provided.
|
|
779
|
+
* - It will be used to generate the permission name if `security` is enabled.
|
|
519
780
|
*/
|
|
520
781
|
name?: string;
|
|
521
782
|
/**
|
|
522
|
-
*
|
|
783
|
+
* Group actions together.
|
|
784
|
+
*
|
|
785
|
+
* - If not provided, the service name containing the route will be used.
|
|
786
|
+
* - It will be used as Tag for documentation purposes.
|
|
787
|
+
* - It will be used for permission name generation if `security` is enabled.
|
|
788
|
+
*
|
|
789
|
+
* @example
|
|
790
|
+
* ```ts
|
|
791
|
+
* // group = "MyController"
|
|
792
|
+
* class MyController {
|
|
793
|
+
* hello = $action({ handler: () => "Hello World" });
|
|
794
|
+
* }
|
|
795
|
+
*
|
|
796
|
+
* // group = "users"
|
|
797
|
+
* class MyOtherController {
|
|
798
|
+
* group = "users";
|
|
799
|
+
* a1 = $action({ handler: () => "Action 1", group: this.group });
|
|
800
|
+
* a2 = $action({ handler: () => "Action 2", group: this.group });
|
|
801
|
+
* }
|
|
802
|
+
* ```
|
|
523
803
|
*/
|
|
524
|
-
|
|
804
|
+
group?: string;
|
|
525
805
|
/**
|
|
526
|
-
*
|
|
806
|
+
* Pathname of the route. If not provided, property key is used.
|
|
527
807
|
*/
|
|
528
|
-
|
|
808
|
+
path?: string;
|
|
529
809
|
/**
|
|
530
|
-
*
|
|
810
|
+
* The route method.
|
|
811
|
+
*
|
|
812
|
+
* - If not provided, it will be set to "GET" by default.
|
|
813
|
+
* - If not provider and a body is provided, it will be set to "POST".
|
|
814
|
+
*
|
|
815
|
+
* Wildcard methods are not supported for now. (e.g. "ALL", "ANY", etc.)
|
|
531
816
|
*/
|
|
532
|
-
|
|
817
|
+
method?: RouteMethod;
|
|
533
818
|
/**
|
|
534
|
-
*
|
|
819
|
+
* The config schema of the route.
|
|
820
|
+
* - body: The request body schema.
|
|
821
|
+
* - params: Path variables schema.
|
|
822
|
+
* - query: The request query-params schema.
|
|
823
|
+
* - response: The response schema.
|
|
535
824
|
*/
|
|
536
|
-
|
|
537
|
-
} & (RealmInternal | RealmExternal);
|
|
538
|
-
interface RealmSettings {
|
|
539
|
-
accessToken?: {
|
|
540
|
-
/**
|
|
541
|
-
* Lifetime of the access token.
|
|
542
|
-
* @default 15 minutes
|
|
543
|
-
*/
|
|
544
|
-
expiration?: DurationLike;
|
|
545
|
-
};
|
|
546
|
-
refreshToken?: {
|
|
547
|
-
/**
|
|
548
|
-
* Lifetime of the refresh token.
|
|
549
|
-
* @default 30 days
|
|
550
|
-
*/
|
|
551
|
-
expiration?: DurationLike;
|
|
552
|
-
};
|
|
553
|
-
onCreateSession?: (user: UserAccount, config: {
|
|
554
|
-
expiresIn: number;
|
|
555
|
-
}) => Promise<{
|
|
556
|
-
refreshToken: string;
|
|
557
|
-
sessionId?: string;
|
|
558
|
-
}>;
|
|
559
|
-
onRefreshSession?: (refreshToken: string) => Promise<{
|
|
560
|
-
user: UserAccount;
|
|
561
|
-
expiresIn: number;
|
|
562
|
-
sessionId?: string;
|
|
563
|
-
}>;
|
|
564
|
-
onDeleteSession?: (refreshToken: string) => Promise<void>;
|
|
565
|
-
}
|
|
566
|
-
type RealmInternal = {
|
|
825
|
+
schema?: TConfig;
|
|
567
826
|
/**
|
|
568
|
-
*
|
|
827
|
+
* A short description of the action. Used for documentation purposes.
|
|
569
828
|
*/
|
|
570
|
-
|
|
571
|
-
};
|
|
572
|
-
interface RealmExternal {
|
|
829
|
+
description?: string;
|
|
573
830
|
/**
|
|
574
|
-
*
|
|
831
|
+
* Disable the route. Useful with env variables do disable one specific route.
|
|
832
|
+
* Route won't be available in the API but can still be called locally!
|
|
575
833
|
*/
|
|
576
|
-
|
|
834
|
+
disabled?: boolean;
|
|
835
|
+
/**
|
|
836
|
+
* Main route handler. This is where the route logic is implemented.
|
|
837
|
+
*/
|
|
838
|
+
handler: ServerActionHandler<TConfig>;
|
|
577
839
|
}
|
|
578
|
-
declare class
|
|
579
|
-
protected readonly securityProvider: SecurityProvider;
|
|
580
|
-
protected readonly dateTimeProvider: DateTimeProvider;
|
|
581
|
-
protected readonly jwt: JwtProvider;
|
|
840
|
+
declare class ActionPrimitive<TConfig extends RequestConfigSchema> extends Primitive<ActionPrimitiveOptions<TConfig>> {
|
|
582
841
|
protected readonly log: Logger;
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
842
|
+
protected readonly env: {
|
|
843
|
+
SERVER_API_PREFIX: string;
|
|
844
|
+
};
|
|
845
|
+
protected readonly httpClient: HttpClient;
|
|
846
|
+
protected readonly serverProvider: ServerProvider;
|
|
847
|
+
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
586
848
|
protected onInit(): void;
|
|
849
|
+
get prefix(): string;
|
|
850
|
+
get route(): ServerRoute;
|
|
587
851
|
/**
|
|
588
|
-
*
|
|
852
|
+
* Returns the name of the action.
|
|
589
853
|
*/
|
|
590
|
-
|
|
591
|
-
/**
|
|
592
|
-
* Set all roles in the realm.
|
|
593
|
-
*/
|
|
594
|
-
setRoles(roles: Role[]): Promise<void>;
|
|
854
|
+
get name(): string;
|
|
595
855
|
/**
|
|
596
|
-
*
|
|
856
|
+
* Returns the group of the action. (e.g. "orders", "admin", etc.)
|
|
597
857
|
*/
|
|
598
|
-
|
|
599
|
-
parseToken(token: string): Promise<JWTPayload>;
|
|
858
|
+
get group(): string;
|
|
600
859
|
/**
|
|
601
|
-
*
|
|
860
|
+
* Returns the HTTP method of the action.
|
|
602
861
|
*/
|
|
603
|
-
|
|
604
|
-
sid?: string;
|
|
605
|
-
refresh_token?: string;
|
|
606
|
-
refresh_token_expires_in?: number;
|
|
607
|
-
}): Promise<AccessTokenResponse>;
|
|
608
|
-
refreshToken(refreshToken: string, accessToken?: string): Promise<{
|
|
609
|
-
tokens: AccessTokenResponse;
|
|
610
|
-
user: UserAccount;
|
|
611
|
-
}>;
|
|
612
|
-
}
|
|
613
|
-
interface AccessTokenResponse {
|
|
614
|
-
access_token: string;
|
|
615
|
-
token_type: string;
|
|
616
|
-
expires_in?: number;
|
|
617
|
-
issued_at: number;
|
|
618
|
-
refresh_token?: string;
|
|
619
|
-
refresh_token_expires_in?: number;
|
|
620
|
-
scope?: string;
|
|
621
|
-
}
|
|
622
|
-
//#endregion
|
|
623
|
-
//#region ../alepha/src/security/descriptors/$serviceAccount.d.ts
|
|
624
|
-
interface ServiceAccountDescriptor {
|
|
625
|
-
token: () => Promise<string>;
|
|
626
|
-
}
|
|
627
|
-
//#endregion
|
|
628
|
-
//#region ../alepha/src/server/constants/routeMethods.d.ts
|
|
629
|
-
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
630
|
-
type RouteMethod = (typeof routeMethods)[number];
|
|
631
|
-
//#endregion
|
|
632
|
-
//#region ../alepha/src/router/providers/RouterProvider.d.ts
|
|
633
|
-
declare abstract class RouterProvider<T$1 extends Route = Route> {
|
|
634
|
-
protected routePathRegex: RegExp;
|
|
635
|
-
protected tree: Tree<T$1>;
|
|
636
|
-
protected cache: Map<string, RouteMatch<T$1>>;
|
|
637
|
-
match(path: string): RouteMatch<T$1>;
|
|
638
|
-
protected test(path: string): void;
|
|
639
|
-
protected push(route: T$1): void;
|
|
640
|
-
protected createRouteMatch(path: string): RouteMatch<T$1>;
|
|
641
|
-
protected mapParams(match: RouteMatch<T$1>): RouteMatch<T$1>;
|
|
642
|
-
protected createParts(path: string): string[];
|
|
643
|
-
}
|
|
644
|
-
interface RouteMatch<T$1 extends Route> {
|
|
645
|
-
route?: T$1;
|
|
646
|
-
params?: Record<string, string>;
|
|
647
|
-
}
|
|
648
|
-
interface Route {
|
|
649
|
-
path: string;
|
|
862
|
+
get method(): RouteMethod;
|
|
650
863
|
/**
|
|
651
|
-
*
|
|
652
|
-
* This is automatically filled when you have scenarios like:
|
|
653
|
-
* `/customers/:id` and `/customers/:userId/payments`
|
|
864
|
+
* Returns the path of the action.
|
|
654
865
|
*
|
|
655
|
-
*
|
|
656
|
-
*/
|
|
657
|
-
mapParams?: Record<string, string>;
|
|
658
|
-
}
|
|
659
|
-
interface Tree<T$1 extends Route> {
|
|
660
|
-
route?: T$1;
|
|
661
|
-
children: {
|
|
662
|
-
[key: string]: Tree<T$1>;
|
|
663
|
-
};
|
|
664
|
-
param?: {
|
|
665
|
-
route?: T$1;
|
|
666
|
-
name: string;
|
|
667
|
-
children: {
|
|
668
|
-
[key: string]: Tree<T$1>;
|
|
669
|
-
};
|
|
670
|
-
};
|
|
671
|
-
wildcard?: {
|
|
672
|
-
route: T$1;
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
//#endregion
|
|
676
|
-
//#region ../alepha/src/server/helpers/ServerReply.d.ts
|
|
677
|
-
/**
|
|
678
|
-
* Helper for building server replies.
|
|
679
|
-
*/
|
|
680
|
-
declare class ServerReply {
|
|
681
|
-
headers: Record<string, string> & {
|
|
682
|
-
"set-cookie"?: string[];
|
|
683
|
-
};
|
|
684
|
-
status?: number;
|
|
685
|
-
body?: any;
|
|
686
|
-
/**
|
|
687
|
-
* Redirect to a given URL with optional status code (default 302).
|
|
866
|
+
* Path is prefixed by `/api` by default.
|
|
688
867
|
*/
|
|
689
|
-
|
|
868
|
+
get path(): string;
|
|
869
|
+
get schema(): TConfig | undefined;
|
|
870
|
+
getBodyContentType(): string | undefined;
|
|
690
871
|
/**
|
|
691
|
-
*
|
|
872
|
+
* Call the action handler directly.
|
|
873
|
+
* There is no HTTP layer involved.
|
|
692
874
|
*/
|
|
693
|
-
|
|
875
|
+
run(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
|
|
694
876
|
/**
|
|
695
|
-
*
|
|
877
|
+
* Works like `run`, but always fetches (http request) the route.
|
|
696
878
|
*/
|
|
697
|
-
|
|
879
|
+
fetch(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<FetchResponse<ClientRequestResponse<TConfig>>>;
|
|
880
|
+
}
|
|
881
|
+
interface ActionPrimitiveFn<TConfig extends RequestConfigSchema> extends ActionPrimitive<TConfig> {
|
|
882
|
+
(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
|
|
883
|
+
}
|
|
884
|
+
type ClientRequestEntry<TConfig extends RequestConfigSchema, T$1 = ClientRequestEntryContainer<TConfig>> = { [K in keyof T$1 as T$1[K] extends undefined ? never : K]: T$1[K] };
|
|
885
|
+
type ClientRequestEntryContainer<TConfig extends RequestConfigSchema> = {
|
|
886
|
+
body: TConfig["body"] extends TObject ? Static<TConfig["body"]> : undefined;
|
|
887
|
+
params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : undefined;
|
|
888
|
+
headers?: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : undefined;
|
|
889
|
+
query?: TConfig["query"] extends TObject ? Partial<Static<TConfig["query"]>> : undefined;
|
|
890
|
+
};
|
|
891
|
+
interface ClientRequestOptions extends FetchOptions {
|
|
698
892
|
/**
|
|
699
|
-
*
|
|
893
|
+
* Standard request fetch options.
|
|
700
894
|
*/
|
|
701
|
-
|
|
702
|
-
}
|
|
703
|
-
//#endregion
|
|
704
|
-
//#region ../alepha/src/server/services/UserAgentParser.d.ts
|
|
705
|
-
interface UserAgentInfo {
|
|
706
|
-
os: "Windows" | "Android" | "Ubuntu" | "MacOS" | "iOS" | "Linux" | "FreeBSD" | "OpenBSD" | "ChromeOS" | "BlackBerry" | "Symbian" | "Windows Phone";
|
|
707
|
-
browser: "Chrome" | "Firefox" | "Safari" | "Edge" | "Opera" | "Internet Explorer" | "Brave" | "Vivaldi" | "Samsung Browser" | "UC Browser" | "Yandex";
|
|
708
|
-
device: "MOBILE" | "DESKTOP" | "TABLET";
|
|
895
|
+
request?: RequestInit;
|
|
709
896
|
}
|
|
897
|
+
type ClientRequestResponse<TConfig extends RequestConfigSchema> = TConfig["response"] extends TSchema ? Static<TConfig["response"]> : any;
|
|
710
898
|
/**
|
|
711
|
-
*
|
|
712
|
-
|
|
899
|
+
* Specific handler for server actions.
|
|
900
|
+
*/
|
|
901
|
+
type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerActionRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
|
|
902
|
+
/**
|
|
903
|
+
* Server Action Request Interface
|
|
713
904
|
*
|
|
714
|
-
*
|
|
905
|
+
* Can be extended with module augmentation to add custom properties (like `user` in Server Security).
|
|
906
|
+
*
|
|
907
|
+
* This is NOT Server Request, but a specific type for actions.
|
|
715
908
|
*/
|
|
716
|
-
|
|
717
|
-
|
|
909
|
+
interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
|
|
910
|
+
//#endregion
|
|
911
|
+
//#region ../alepha/src/server/primitives/$route.d.ts
|
|
912
|
+
interface RoutePrimitiveOptions<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRoute<TConfig> {}
|
|
913
|
+
declare class RoutePrimitive<TConfig extends RequestConfigSchema> extends Primitive<RoutePrimitiveOptions<TConfig>> {
|
|
914
|
+
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
915
|
+
protected onInit(): void;
|
|
718
916
|
}
|
|
719
917
|
//#endregion
|
|
720
|
-
//#region ../alepha/src/server/
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
headers?: TObject;
|
|
728
|
-
response?: TResponseBody;
|
|
918
|
+
//#region ../alepha/src/server/providers/BunHttpServerProvider.d.ts
|
|
919
|
+
declare const envSchema$8: alepha1672.TObject<{
|
|
920
|
+
SERVER_PORT: alepha1672.TInteger;
|
|
921
|
+
SERVER_HOST: alepha1672.TString;
|
|
922
|
+
}>;
|
|
923
|
+
declare module "alepha" {
|
|
924
|
+
interface Env extends Partial<Static<typeof envSchema$8>> {}
|
|
729
925
|
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
926
|
+
//#endregion
|
|
927
|
+
//#region ../alepha/src/server/providers/NodeHttpServerProvider.d.ts
|
|
928
|
+
declare const envSchema$7: alepha1672.TObject<{
|
|
929
|
+
SERVER_PORT: alepha1672.TInteger;
|
|
930
|
+
SERVER_HOST: alepha1672.TString;
|
|
931
|
+
}>;
|
|
932
|
+
declare module "alepha" {
|
|
933
|
+
interface Env extends Partial<Static<typeof envSchema$7>> {}
|
|
735
934
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
935
|
+
//#endregion
|
|
936
|
+
//#region ../alepha/src/server/index.d.ts
|
|
937
|
+
declare module "alepha" {
|
|
938
|
+
interface State {
|
|
939
|
+
"alepha.node.server"?: Server;
|
|
940
|
+
}
|
|
941
|
+
interface Hooks {
|
|
942
|
+
"action:onRequest": {
|
|
943
|
+
action: ActionPrimitive<RequestConfigSchema>;
|
|
944
|
+
request: ServerRequest;
|
|
945
|
+
options: ClientRequestOptions;
|
|
946
|
+
};
|
|
947
|
+
"action:onResponse": {
|
|
948
|
+
action: ActionPrimitive<RequestConfigSchema>;
|
|
949
|
+
request: ServerRequest;
|
|
950
|
+
options: ClientRequestOptions;
|
|
951
|
+
response: any;
|
|
952
|
+
};
|
|
953
|
+
"server:onRequest": {
|
|
954
|
+
route: ServerRoute;
|
|
955
|
+
request: ServerRequest;
|
|
956
|
+
};
|
|
957
|
+
"server:onError": {
|
|
958
|
+
route: ServerRoute;
|
|
959
|
+
request: ServerRequest;
|
|
960
|
+
error: Error;
|
|
961
|
+
};
|
|
962
|
+
"server:onSend": {
|
|
963
|
+
route: ServerRoute;
|
|
964
|
+
request: ServerRequest;
|
|
965
|
+
};
|
|
966
|
+
"server:onResponse": {
|
|
967
|
+
route: ServerRoute;
|
|
968
|
+
request: ServerRequest;
|
|
969
|
+
response: ServerResponse$1;
|
|
970
|
+
};
|
|
971
|
+
"client:onRequest": {
|
|
972
|
+
route: HttpAction;
|
|
973
|
+
config: ServerRequestConfigEntry;
|
|
974
|
+
options: ClientRequestOptions;
|
|
975
|
+
headers: Record<string, string>;
|
|
976
|
+
request: RequestInit;
|
|
977
|
+
};
|
|
978
|
+
"client:beforeFetch": {
|
|
979
|
+
url: string;
|
|
980
|
+
options: FetchOptions;
|
|
981
|
+
request: RequestInit;
|
|
982
|
+
};
|
|
983
|
+
"client:onError": {
|
|
984
|
+
route?: HttpAction;
|
|
985
|
+
error: HttpError;
|
|
986
|
+
};
|
|
987
|
+
"node:request": NodeRequestEvent;
|
|
988
|
+
"web:request": WebRequestEvent;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
//#endregion
|
|
992
|
+
//#region ../alepha/src/security/interfaces/UserAccountToken.d.ts
|
|
993
|
+
/**
|
|
994
|
+
* Add contextual metadata to a user account info.
|
|
995
|
+
* E.g. UserAccountToken is a UserAccountInfo during a request.
|
|
996
|
+
*/
|
|
997
|
+
interface UserAccountToken extends UserAccount {
|
|
766
998
|
/**
|
|
767
|
-
*
|
|
999
|
+
* Access token for the user.
|
|
768
1000
|
*/
|
|
769
|
-
|
|
1001
|
+
token?: string;
|
|
770
1002
|
/**
|
|
771
|
-
*
|
|
1003
|
+
* Realm name of the user.
|
|
772
1004
|
*/
|
|
773
|
-
|
|
1005
|
+
realm?: string;
|
|
774
1006
|
/**
|
|
775
|
-
*
|
|
1007
|
+
* Is user dedicated to his own resources for this scope ?
|
|
1008
|
+
* Mostly, Admin is false and Customer is true.
|
|
776
1009
|
*/
|
|
777
|
-
|
|
1010
|
+
ownership?: string | boolean;
|
|
778
1011
|
}
|
|
779
|
-
|
|
1012
|
+
//#endregion
|
|
1013
|
+
//#region ../alepha/src/security/schemas/permissionSchema.d.ts
|
|
1014
|
+
declare const permissionSchema: alepha1672.TObject<{
|
|
1015
|
+
name: alepha1672.TString;
|
|
1016
|
+
group: alepha1672.TOptional<alepha1672.TString>;
|
|
1017
|
+
description: alepha1672.TOptional<alepha1672.TString>;
|
|
1018
|
+
method: alepha1672.TOptional<alepha1672.TString>;
|
|
1019
|
+
path: alepha1672.TOptional<alepha1672.TString>;
|
|
1020
|
+
}>;
|
|
1021
|
+
type Permission = Static<typeof permissionSchema>;
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region ../alepha/src/security/schemas/roleSchema.d.ts
|
|
1024
|
+
declare const roleSchema: alepha1672.TObject<{
|
|
1025
|
+
name: alepha1672.TString;
|
|
1026
|
+
description: alepha1672.TOptional<alepha1672.TString>;
|
|
1027
|
+
default: alepha1672.TOptional<alepha1672.TBoolean>;
|
|
1028
|
+
permissions: alepha1672.TArray<alepha1672.TObject<{
|
|
1029
|
+
name: alepha1672.TString;
|
|
1030
|
+
ownership: alepha1672.TOptional<alepha1672.TBoolean>;
|
|
1031
|
+
exclude: alepha1672.TOptional<alepha1672.TArray<alepha1672.TString>>;
|
|
1032
|
+
}>>;
|
|
1033
|
+
}>;
|
|
1034
|
+
type Role = Static<typeof roleSchema>;
|
|
1035
|
+
//#endregion
|
|
1036
|
+
//#region ../alepha/src/security/providers/JwtProvider.d.ts
|
|
1037
|
+
/**
|
|
1038
|
+
* Provides utilities for working with JSON Web Tokens (JWT).
|
|
1039
|
+
*/
|
|
1040
|
+
declare class JwtProvider {
|
|
1041
|
+
protected readonly log: Logger;
|
|
1042
|
+
protected readonly keystore: KeyLoaderHolder[];
|
|
1043
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
1044
|
+
protected readonly encoder: TextEncoder;
|
|
780
1045
|
/**
|
|
781
|
-
*
|
|
1046
|
+
* Adds a key loader to the embedded keystore.
|
|
1047
|
+
*
|
|
1048
|
+
* @param name
|
|
1049
|
+
* @param secretKeyOrJwks
|
|
782
1050
|
*/
|
|
783
|
-
|
|
1051
|
+
setKeyLoader(name: string, secretKeyOrJwks: string | JSONWebKeySet): void;
|
|
784
1052
|
/**
|
|
785
|
-
*
|
|
1053
|
+
* Retrieves the payload from a JSON Web Token (JWT).
|
|
1054
|
+
*
|
|
1055
|
+
* @param token - The JWT to extract the payload from.
|
|
1056
|
+
*
|
|
1057
|
+
* @return A Promise that resolves with the payload object from the token.
|
|
786
1058
|
*/
|
|
787
|
-
|
|
1059
|
+
parse(token: string, keyName?: string, options?: JWTVerifyOptions): Promise<JwtParseResult>;
|
|
788
1060
|
/**
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
* Request schema contains:
|
|
792
|
-
* - body, for POST/PUT/PATCH requests
|
|
793
|
-
* - params, for URL parameters (e.g. /user/:id)
|
|
794
|
-
* - query, for URL query parameters (e.g. /user?id=123)
|
|
795
|
-
* - headers, for HTTP headers
|
|
1061
|
+
* Creates a JWT token with the provided payload and secret key.
|
|
796
1062
|
*
|
|
797
|
-
*
|
|
798
|
-
*
|
|
1063
|
+
* @param payload - The payload to be encoded in the token.
|
|
1064
|
+
* It should include the `realm_access` property which contains an array of roles.
|
|
1065
|
+
* @param keyName - The name of the key to use when signing the token.
|
|
799
1066
|
*
|
|
800
|
-
*
|
|
1067
|
+
* @returns The signed JWT token.
|
|
801
1068
|
*/
|
|
802
|
-
|
|
1069
|
+
create(payload: ExtendedJWTPayload, keyName?: string, signOptions?: JwtSignOptions): Promise<string>;
|
|
803
1070
|
/**
|
|
804
|
-
*
|
|
1071
|
+
* Determines if the provided key is a secret key.
|
|
1072
|
+
*
|
|
1073
|
+
* @param key
|
|
1074
|
+
* @protected
|
|
805
1075
|
*/
|
|
806
|
-
|
|
807
|
-
}
|
|
808
|
-
type ServerResponseBody<TConfig extends RequestConfigSchema = RequestConfigSchema> = TConfig["response"] extends TResponseBody ? Static<TConfig["response"]> : ResponseBodyType;
|
|
809
|
-
type ResponseKind = "json" | "text" | "void" | "file" | "any";
|
|
810
|
-
type ResponseBodyType = string | Buffer | StreamLike | undefined | null | void;
|
|
811
|
-
type ServerHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
|
|
812
|
-
interface ServerResponse$1 {
|
|
813
|
-
body: string | Buffer | ArrayBuffer | Readable | ReadableStream;
|
|
814
|
-
headers: Record<string, string>;
|
|
815
|
-
status: number;
|
|
816
|
-
}
|
|
817
|
-
type ServerRouteRequestHandler = (request: ServerRequestData) => Promise<ServerResponse$1>;
|
|
818
|
-
interface ServerRouteMatcher extends Route {
|
|
819
|
-
handler: ServerRouteRequestHandler;
|
|
1076
|
+
protected isSecretKey(key: string): boolean;
|
|
820
1077
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
params: Record<string, string>;
|
|
827
|
-
raw: ServerRawRequest;
|
|
1078
|
+
type KeyLoader = (protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput) => Promise<CryptoKey | KeyObject>;
|
|
1079
|
+
interface KeyLoaderHolder {
|
|
1080
|
+
name: string;
|
|
1081
|
+
keyLoader: KeyLoader;
|
|
1082
|
+
secretKey?: string;
|
|
828
1083
|
}
|
|
829
|
-
interface
|
|
830
|
-
|
|
831
|
-
web?: WebRequestEvent;
|
|
1084
|
+
interface JwtSignOptions {
|
|
1085
|
+
header?: Partial<JWTHeaderParameters>;
|
|
832
1086
|
}
|
|
833
|
-
interface
|
|
834
|
-
|
|
835
|
-
|
|
1087
|
+
interface ExtendedJWTPayload extends JWTPayload {
|
|
1088
|
+
sid?: string;
|
|
1089
|
+
name?: string;
|
|
1090
|
+
roles?: string[];
|
|
1091
|
+
email?: string;
|
|
1092
|
+
organizations?: string[];
|
|
1093
|
+
realm_access?: {
|
|
1094
|
+
roles: string[];
|
|
1095
|
+
};
|
|
836
1096
|
}
|
|
837
|
-
interface
|
|
838
|
-
|
|
839
|
-
|
|
1097
|
+
interface JwtParseResult {
|
|
1098
|
+
keyName: string;
|
|
1099
|
+
result: JWTVerifyResult<ExtendedJWTPayload>;
|
|
840
1100
|
}
|
|
841
1101
|
//#endregion
|
|
842
|
-
//#region ../alepha/src/
|
|
843
|
-
declare
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
getRequestUserAgent(request: ServerRequestData): UserAgentInfo;
|
|
849
|
-
getRequestIp(request: ServerRequestData): string | undefined;
|
|
1102
|
+
//#region ../alepha/src/security/providers/SecurityProvider.d.ts
|
|
1103
|
+
declare const envSchema$6: alepha1672.TObject<{
|
|
1104
|
+
APP_SECRET: alepha1672.TString;
|
|
1105
|
+
}>;
|
|
1106
|
+
declare module "alepha" {
|
|
1107
|
+
interface Env extends Partial<Static<typeof envSchema$6>> {}
|
|
850
1108
|
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
1109
|
+
declare class SecurityProvider {
|
|
1110
|
+
protected readonly UNKNOWN_USER_NAME = "Anonymous User";
|
|
1111
|
+
protected readonly PERMISSION_REGEXP: RegExp;
|
|
1112
|
+
protected readonly PERMISSION_REGEXP_WILDCARD: RegExp;
|
|
855
1113
|
protected readonly log: Logger;
|
|
856
|
-
protected readonly
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
disabled: boolean;
|
|
1114
|
+
protected readonly jwt: JwtProvider;
|
|
1115
|
+
protected readonly env: {
|
|
1116
|
+
APP_SECRET: string;
|
|
860
1117
|
};
|
|
861
|
-
readonly onRequest: alepha1223.HookDescriptor<"server:onRequest">;
|
|
862
|
-
readonly onResponse: alepha1223.HookDescriptor<"server:onResponse">;
|
|
863
|
-
protected get handlerName(): string;
|
|
864
|
-
beginTiming(name: string): void;
|
|
865
|
-
endTiming(name: string): void;
|
|
866
|
-
protected setDuration(name: string, timing: TimingMap): void;
|
|
867
|
-
}
|
|
868
|
-
//#endregion
|
|
869
|
-
//#region ../alepha/src/server/providers/ServerRouterProvider.d.ts
|
|
870
|
-
/**
|
|
871
|
-
* Main router for all routes on the server side.
|
|
872
|
-
*
|
|
873
|
-
* - $route => generic route
|
|
874
|
-
* - $action => action route (for API calls)
|
|
875
|
-
* - $page => React route (for SSR)
|
|
876
|
-
*/
|
|
877
|
-
declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
|
|
878
|
-
protected readonly log: Logger;
|
|
879
|
-
protected readonly alepha: Alepha;
|
|
880
|
-
protected readonly routes: ServerRoute[];
|
|
881
|
-
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
882
|
-
protected readonly serverRequestParser: ServerRequestParser;
|
|
883
|
-
/**
|
|
884
|
-
* Get all registered routes, optionally filtered by a pattern.
|
|
885
|
-
*
|
|
886
|
-
* Pattern accept simple wildcard '*' at the end.
|
|
887
|
-
* Example: '/api/*' will match all routes starting with '/api/' but '/api/' will match only that exact route.
|
|
888
|
-
*/
|
|
889
|
-
getRoutes(pattern?: string): ServerRoute[];
|
|
890
|
-
createRoute<TConfig extends RequestConfigSchema = RequestConfigSchema>(route: ServerRoute<TConfig>): void;
|
|
891
|
-
protected getContextId(headers: Record<string, string>): string;
|
|
892
|
-
protected processRequest(request: ServerRequest, route: ServerRoute, responseKind: ResponseKind): Promise<{
|
|
893
|
-
status: number;
|
|
894
|
-
headers: Record<string, string> & {
|
|
895
|
-
"set-cookie"?: string[];
|
|
896
|
-
};
|
|
897
|
-
body: any;
|
|
898
|
-
}>;
|
|
899
|
-
protected runRouteHandler(route: ServerRoute, request: ServerRequest, responseKind: ResponseKind): Promise<void>;
|
|
900
|
-
serializeResponse(route: ServerRoute, reply: ServerReply, responseKind: ResponseKind): void;
|
|
901
|
-
protected getResponseType(schema?: RequestConfigSchema): ResponseKind;
|
|
902
|
-
protected errorHandler(route: ServerRoute, request: ServerRequest, error: Error): Promise<void>;
|
|
903
|
-
validateRequest(route: {
|
|
904
|
-
schema?: RequestConfigSchema;
|
|
905
|
-
}, request: ServerRequestConfig): void;
|
|
906
|
-
}
|
|
907
|
-
//#endregion
|
|
908
|
-
//#region ../alepha/src/server/providers/ServerProvider.d.ts
|
|
909
|
-
/**
|
|
910
|
-
* Base server provider to handle incoming requests and route them.
|
|
911
|
-
*
|
|
912
|
-
* This is the default implementation for serverless environments.
|
|
913
|
-
*
|
|
914
|
-
* ServerProvider supports both Node.js HTTP requests and Web (Fetch API) requests.
|
|
915
|
-
*/
|
|
916
|
-
declare class ServerProvider {
|
|
917
|
-
protected readonly log: Logger;
|
|
918
1118
|
protected readonly alepha: Alepha;
|
|
919
|
-
|
|
920
|
-
protected readonly router: ServerRouterProvider;
|
|
921
|
-
protected readonly internalServerErrorMessage = "Internal Server Error";
|
|
922
|
-
get hostname(): string;
|
|
1119
|
+
get secretKey(): string;
|
|
923
1120
|
/**
|
|
924
|
-
*
|
|
1121
|
+
* The permissions configured for the security provider.
|
|
925
1122
|
*/
|
|
926
|
-
protected readonly
|
|
1123
|
+
protected readonly permissions: Permission[];
|
|
927
1124
|
/**
|
|
928
|
-
*
|
|
1125
|
+
* The realms configured for the security provider.
|
|
929
1126
|
*/
|
|
930
|
-
protected readonly
|
|
1127
|
+
protected readonly realms: Realm[];
|
|
1128
|
+
protected start: alepha1672.HookPrimitive<"start">;
|
|
931
1129
|
/**
|
|
932
|
-
*
|
|
1130
|
+
* Adds a role to one or more realms.
|
|
933
1131
|
*
|
|
934
|
-
*
|
|
935
|
-
|
|
936
|
-
handleNodeRequest(nodeRequestEvent: NodeRequestEvent): Promise<void>;
|
|
937
|
-
/**
|
|
938
|
-
* Handle Web (Fetch API) request event.
|
|
1132
|
+
* @param role
|
|
1133
|
+
* @param realms
|
|
939
1134
|
*/
|
|
940
|
-
|
|
1135
|
+
createRole(role: Role, ...realms: string[]): Role;
|
|
941
1136
|
/**
|
|
942
|
-
*
|
|
1137
|
+
* Adds a permission to the security provider.
|
|
1138
|
+
*
|
|
1139
|
+
* @param raw - The permission to add.
|
|
943
1140
|
*/
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
//#endregion
|
|
947
|
-
//#region ../alepha/src/cache/providers/CacheProvider.d.ts
|
|
948
|
-
/**
|
|
949
|
-
* Cache provider interface.
|
|
950
|
-
*
|
|
951
|
-
* All methods are asynchronous and return promises.
|
|
952
|
-
* Values are stored as Uint8Array.
|
|
953
|
-
*/
|
|
954
|
-
declare abstract class CacheProvider {
|
|
1141
|
+
createPermission(raw: Permission | string): Permission;
|
|
1142
|
+
createRealm(realm: Realm): void;
|
|
955
1143
|
/**
|
|
956
|
-
*
|
|
1144
|
+
* Updates the roles for a realm then synchronizes the user account provider if available.
|
|
957
1145
|
*
|
|
958
|
-
*
|
|
959
|
-
* @param key The key of the value to get.
|
|
1146
|
+
* Only available when the app is started.
|
|
960
1147
|
*
|
|
961
|
-
* @
|
|
1148
|
+
* @param realm - The realm to update the roles for.
|
|
1149
|
+
* @param roles - The roles to update.
|
|
962
1150
|
*/
|
|
963
|
-
|
|
1151
|
+
updateRealm(realm: string, roles: Role[]): Promise<void>;
|
|
964
1152
|
/**
|
|
965
|
-
*
|
|
1153
|
+
* Creates a user account from the provided payload.
|
|
966
1154
|
*
|
|
967
|
-
* @param
|
|
968
|
-
* @param
|
|
969
|
-
* @param value The value to set.
|
|
970
|
-
* @param ttl The time-to-live of the key, in milliseconds.
|
|
1155
|
+
* @param payload - The payload to create the user account from.
|
|
1156
|
+
* @param [realmName] - The realm containing the roles. Default is all.
|
|
971
1157
|
*
|
|
972
|
-
* @
|
|
1158
|
+
* @returns The user info created from the payload.
|
|
973
1159
|
*/
|
|
974
|
-
|
|
1160
|
+
createUserFromPayload(payload: JWTPayload, realmName?: string): UserAccount;
|
|
975
1161
|
/**
|
|
976
|
-
*
|
|
1162
|
+
* Checks if the user has the specified permission.
|
|
977
1163
|
*
|
|
978
|
-
*
|
|
979
|
-
*
|
|
1164
|
+
* Bonus: we check also if the user has "ownership" flag.
|
|
1165
|
+
*
|
|
1166
|
+
* @param permissionLike - The permission to check for.
|
|
1167
|
+
* @param roleEntries - The roles to check for the permission.
|
|
980
1168
|
*/
|
|
981
|
-
|
|
982
|
-
abstract has(name: string, key: string): Promise<boolean>;
|
|
983
|
-
abstract keys(name: string, filter?: string): Promise<string[]>;
|
|
1169
|
+
checkPermission(permissionLike: string | Permission, ...roleEntries: string[]): SecurityCheckResult;
|
|
984
1170
|
/**
|
|
985
|
-
*
|
|
1171
|
+
* Creates a user account from the provided payload.
|
|
986
1172
|
*/
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1173
|
+
createUserFromToken(headerOrToken?: string, options?: {
|
|
1174
|
+
permission?: Permission | string;
|
|
1175
|
+
realm?: string;
|
|
1176
|
+
verify?: JWTVerifyOptions;
|
|
1177
|
+
}): Promise<UserAccountToken>;
|
|
992
1178
|
/**
|
|
993
|
-
*
|
|
994
|
-
*
|
|
995
|
-
* Store key as `cache:$name:$key`.
|
|
1179
|
+
* Checks if a user has a specific role.
|
|
996
1180
|
*
|
|
997
|
-
* @
|
|
1181
|
+
* @param roleName - The role to check for.
|
|
1182
|
+
* @param permission - The permission to check for.
|
|
1183
|
+
* @returns True if the user has the role, false otherwise.
|
|
998
1184
|
*/
|
|
999
|
-
|
|
1185
|
+
can(roleName: string, permission: string | Permission): boolean;
|
|
1000
1186
|
/**
|
|
1001
|
-
*
|
|
1187
|
+
* Checks if a user has ownership of a specific permission.
|
|
1002
1188
|
*/
|
|
1003
|
-
|
|
1189
|
+
ownership(roleName: string, permission: string | Permission): string | boolean | undefined;
|
|
1004
1190
|
/**
|
|
1005
|
-
*
|
|
1006
|
-
*
|
|
1191
|
+
* Converts a permission object to a string.
|
|
1192
|
+
*
|
|
1193
|
+
* @param permission
|
|
1007
1194
|
*/
|
|
1008
|
-
|
|
1195
|
+
permissionToString(permission: Permission | string): string;
|
|
1196
|
+
getRealms(): Realm[];
|
|
1009
1197
|
/**
|
|
1010
|
-
*
|
|
1011
|
-
*
|
|
1198
|
+
* Retrieves the user account from the provided user ID.
|
|
1199
|
+
*
|
|
1200
|
+
* @param realm
|
|
1012
1201
|
*/
|
|
1013
|
-
|
|
1202
|
+
getRoles(realm?: string): Role[];
|
|
1014
1203
|
/**
|
|
1015
|
-
*
|
|
1016
|
-
* Set 0 to skip expiration.
|
|
1204
|
+
* Returns all permissions.
|
|
1017
1205
|
*
|
|
1018
|
-
* @
|
|
1206
|
+
* @param user - Filter permissions by user.
|
|
1207
|
+
*
|
|
1208
|
+
* @return An array containing all permissions.
|
|
1019
1209
|
*/
|
|
1020
|
-
|
|
1210
|
+
getPermissions(user?: {
|
|
1211
|
+
roles?: Array<Role | string>;
|
|
1212
|
+
realm?: string;
|
|
1213
|
+
}): Permission[];
|
|
1021
1214
|
/**
|
|
1022
|
-
*
|
|
1215
|
+
* Retrieves the user ID from the provided payload object.
|
|
1216
|
+
*
|
|
1217
|
+
* @param payload - The payload object from which to extract the user ID.
|
|
1218
|
+
* @return The user ID as a string.
|
|
1023
1219
|
*/
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
declare class CacheDescriptor<TReturn = any, TParameter extends any[] = any[]> extends Descriptor<CacheDescriptorOptions<TReturn, TParameter>> {
|
|
1027
|
-
protected readonly env: {
|
|
1028
|
-
CACHE_ENABLED: boolean;
|
|
1029
|
-
CACHE_DEFAULT_TTL: number;
|
|
1030
|
-
};
|
|
1031
|
-
protected readonly dateTimeProvider: DateTimeProvider;
|
|
1032
|
-
protected readonly provider: CacheProvider;
|
|
1033
|
-
protected encoder: TextEncoder;
|
|
1034
|
-
protected decoder: TextDecoder;
|
|
1035
|
-
protected codes: {
|
|
1036
|
-
BINARY: number;
|
|
1037
|
-
JSON: number;
|
|
1038
|
-
STRING: number;
|
|
1039
|
-
};
|
|
1040
|
-
get container(): string;
|
|
1041
|
-
run(...args: TParameter): Promise<TReturn>;
|
|
1042
|
-
key(...args: TParameter): string;
|
|
1043
|
-
invalidate(...keys: string[]): Promise<void>;
|
|
1044
|
-
set(key: string, value: TReturn, ttl?: DurationLike): Promise<void>;
|
|
1045
|
-
get(key: string): Promise<TReturn | undefined>;
|
|
1046
|
-
protected serialize<TReturn>(value: TReturn): Uint8Array;
|
|
1047
|
-
protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
|
|
1048
|
-
protected $provider(): CacheProvider;
|
|
1049
|
-
}
|
|
1050
|
-
interface CacheDescriptorFn<TReturn = any, TParameter extends any[] = any[]> extends CacheDescriptor<TReturn, TParameter> {
|
|
1220
|
+
getIdFromPayload(payload: Record<string, any>): string;
|
|
1221
|
+
getSessionIdFromPayload(payload: Record<string, any>): string | undefined;
|
|
1051
1222
|
/**
|
|
1052
|
-
*
|
|
1223
|
+
* Retrieves the roles from the provided payload object.
|
|
1224
|
+
* @param payload - The payload object from which to extract the roles.
|
|
1225
|
+
* @return An array of role strings.
|
|
1053
1226
|
*/
|
|
1054
|
-
(
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
declare class HttpClient {
|
|
1059
|
-
protected readonly log: Logger;
|
|
1060
|
-
protected readonly alepha: Alepha;
|
|
1061
|
-
readonly cache: CacheDescriptorFn<HttpClientCache, any[]>;
|
|
1062
|
-
protected readonly pendingRequests: HttpClientPendingRequests;
|
|
1063
|
-
fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
|
|
1064
|
-
fetch<T$1 extends TSchema>(url: string, request?: RequestInitWithOptions<T$1>): Promise<FetchResponse<Static<T$1>>>;
|
|
1065
|
-
protected url(host: string, action: HttpAction, args: ServerRequestConfigEntry): string;
|
|
1066
|
-
protected body(init: RequestInit, headers: Record<string, string>, action: HttpAction, args?: ServerRequestConfigEntry): Promise<void>;
|
|
1067
|
-
protected responseData(response: Response, options: FetchOptions): Promise<any>;
|
|
1068
|
-
protected isMaybeFile(response: Response): boolean;
|
|
1069
|
-
protected createFileLike(response: Response, defaultFileName?: string): FileLike;
|
|
1070
|
-
pathVariables(url: string, action: {
|
|
1071
|
-
schema?: {
|
|
1072
|
-
params?: TObject;
|
|
1073
|
-
};
|
|
1074
|
-
}, args?: ServerRequestConfigEntry): string;
|
|
1075
|
-
queryParams(url: string, action: {
|
|
1076
|
-
schema?: {
|
|
1077
|
-
query?: TObject;
|
|
1078
|
-
};
|
|
1079
|
-
}, args?: ServerRequestConfigEntry): string;
|
|
1080
|
-
}
|
|
1081
|
-
interface FetchOptions<T$1 extends TSchema = TSchema> {
|
|
1227
|
+
getRolesFromPayload(payload: Record<string, any>): string[];
|
|
1228
|
+
getPictureFromPayload(payload: Record<string, any>): string | undefined;
|
|
1229
|
+
getUsernameFromPayload(payload: Record<string, any>): string | undefined;
|
|
1230
|
+
getEmailFromPayload(payload: Record<string, any>): string | undefined;
|
|
1082
1231
|
/**
|
|
1083
|
-
*
|
|
1232
|
+
* Returns the name from the given payload.
|
|
1233
|
+
*
|
|
1234
|
+
* @param payload - The payload object.
|
|
1235
|
+
* @returns The name extracted from the payload, or an empty string if the payload is falsy or no name is found.
|
|
1084
1236
|
*/
|
|
1085
|
-
|
|
1237
|
+
getNameFromPayload(payload: Record<string, any>): string;
|
|
1238
|
+
getOrganizationsFromPayload(payload: Record<string, any>): string[] | undefined;
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* A realm definition.
|
|
1242
|
+
*/
|
|
1243
|
+
interface Realm {
|
|
1244
|
+
name: string;
|
|
1245
|
+
roles: Role[];
|
|
1086
1246
|
/**
|
|
1087
|
-
* The
|
|
1247
|
+
* The secret key for the realm.
|
|
1248
|
+
*
|
|
1249
|
+
* Can be also a JWKS URL.
|
|
1088
1250
|
*/
|
|
1089
|
-
|
|
1090
|
-
response?: T$1;
|
|
1091
|
-
};
|
|
1251
|
+
secret?: string | JSONWebKeySet | (() => string);
|
|
1092
1252
|
/**
|
|
1093
|
-
*
|
|
1253
|
+
* Create the user account info based on the raw JWT payload.
|
|
1254
|
+
* By default, SecurityProvider has his own implementation, but this method allow to override it.
|
|
1094
1255
|
*/
|
|
1095
|
-
|
|
1096
|
-
}
|
|
1097
|
-
type RequestInitWithOptions<T$1 extends TSchema = TSchema> = RequestInit & FetchOptions<T$1>;
|
|
1098
|
-
interface FetchResponse<T$1 = any> {
|
|
1099
|
-
data: T$1;
|
|
1100
|
-
status: number;
|
|
1101
|
-
statusText: string;
|
|
1102
|
-
headers: Headers;
|
|
1103
|
-
raw?: Response;
|
|
1104
|
-
}
|
|
1105
|
-
type HttpClientPendingRequests = Record<string, Promise<any> | undefined>;
|
|
1106
|
-
interface HttpClientCache {
|
|
1107
|
-
data: any;
|
|
1108
|
-
etag?: string;
|
|
1109
|
-
}
|
|
1110
|
-
interface FetchActionArgs {
|
|
1111
|
-
action: HttpAction;
|
|
1112
|
-
host?: string;
|
|
1113
|
-
config?: ServerRequestConfigEntry;
|
|
1114
|
-
options?: ClientRequestOptions;
|
|
1256
|
+
profile?: (raw: Record<string, any>) => UserAccount;
|
|
1115
1257
|
}
|
|
1116
|
-
interface
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
path: string;
|
|
1120
|
-
requestBodyType?: string;
|
|
1121
|
-
schema?: {
|
|
1122
|
-
params?: TObject;
|
|
1123
|
-
query?: TObject;
|
|
1124
|
-
body?: TRequestBody;
|
|
1125
|
-
response?: TResponseBody;
|
|
1126
|
-
};
|
|
1258
|
+
interface SecurityCheckResult {
|
|
1259
|
+
isAuthorized: boolean;
|
|
1260
|
+
ownership: string | boolean | undefined;
|
|
1127
1261
|
}
|
|
1128
1262
|
//#endregion
|
|
1129
|
-
//#region ../alepha/src/
|
|
1130
|
-
|
|
1263
|
+
//#region ../alepha/src/security/primitives/$realm.d.ts
|
|
1264
|
+
type RealmPrimitiveOptions = {
|
|
1131
1265
|
/**
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
1134
|
-
* - It will be used to generate the route path if `path` is not provided.
|
|
1135
|
-
* - It will be used to generate the permission name if `security` is enabled.
|
|
1266
|
+
* Define the realm name.
|
|
1267
|
+
* If not provided, it will use the property key.
|
|
1136
1268
|
*/
|
|
1137
1269
|
name?: string;
|
|
1138
1270
|
/**
|
|
1139
|
-
*
|
|
1140
|
-
*
|
|
1141
|
-
* - If not provided, the service name containing the route will be used.
|
|
1142
|
-
* - It will be used as Tag for documentation purposes.
|
|
1143
|
-
* - It will be used for permission name generation if `security` is enabled.
|
|
1144
|
-
*
|
|
1145
|
-
* @example
|
|
1146
|
-
* ```ts
|
|
1147
|
-
* // group = "MyController"
|
|
1148
|
-
* class MyController {
|
|
1149
|
-
* hello = $action({ handler: () => "Hello World" });
|
|
1150
|
-
* }
|
|
1151
|
-
*
|
|
1152
|
-
* // group = "users"
|
|
1153
|
-
* class MyOtherController {
|
|
1154
|
-
* group = "users";
|
|
1155
|
-
* a1 = $action({ handler: () => "Action 1", group: this.group });
|
|
1156
|
-
* a2 = $action({ handler: () => "Action 2", group: this.group });
|
|
1157
|
-
* }
|
|
1158
|
-
* ```
|
|
1159
|
-
*/
|
|
1160
|
-
group?: string;
|
|
1161
|
-
/**
|
|
1162
|
-
* Pathname of the route. If not provided, property key is used.
|
|
1271
|
+
* Short description about the realm.
|
|
1163
1272
|
*/
|
|
1164
|
-
|
|
1273
|
+
description?: string;
|
|
1165
1274
|
/**
|
|
1166
|
-
*
|
|
1167
|
-
*
|
|
1168
|
-
* - If not provided, it will be set to "GET" by default.
|
|
1169
|
-
* - If not provider and a body is provided, it will be set to "POST".
|
|
1170
|
-
*
|
|
1171
|
-
* Wildcard methods are not supported for now. (e.g. "ALL", "ANY", etc.)
|
|
1275
|
+
* All roles available in the realm. Role is a string (role name) or a Role object (embedded role).
|
|
1172
1276
|
*/
|
|
1173
|
-
|
|
1277
|
+
roles?: Array<string | Role>;
|
|
1174
1278
|
/**
|
|
1175
|
-
*
|
|
1176
|
-
* - body: The request body schema.
|
|
1177
|
-
* - params: Path variables schema.
|
|
1178
|
-
* - query: The request query-params schema.
|
|
1179
|
-
* - response: The response schema.
|
|
1279
|
+
* Realm settings.
|
|
1180
1280
|
*/
|
|
1181
|
-
|
|
1281
|
+
settings?: RealmSettings;
|
|
1182
1282
|
/**
|
|
1183
|
-
*
|
|
1283
|
+
* Parse the JWT payload to create a user account info.
|
|
1184
1284
|
*/
|
|
1185
|
-
|
|
1285
|
+
profile?: (jwtPayload: Record<string, any>) => UserAccount;
|
|
1286
|
+
} & (RealmInternal | RealmExternal);
|
|
1287
|
+
interface RealmSettings {
|
|
1288
|
+
accessToken?: {
|
|
1289
|
+
/**
|
|
1290
|
+
* Lifetime of the access token.
|
|
1291
|
+
* @default 15 minutes
|
|
1292
|
+
*/
|
|
1293
|
+
expiration?: DurationLike;
|
|
1294
|
+
};
|
|
1295
|
+
refreshToken?: {
|
|
1296
|
+
/**
|
|
1297
|
+
* Lifetime of the refresh token.
|
|
1298
|
+
* @default 30 days
|
|
1299
|
+
*/
|
|
1300
|
+
expiration?: DurationLike;
|
|
1301
|
+
};
|
|
1302
|
+
onCreateSession?: (user: UserAccount, config: {
|
|
1303
|
+
expiresIn: number;
|
|
1304
|
+
}) => Promise<{
|
|
1305
|
+
refreshToken: string;
|
|
1306
|
+
sessionId?: string;
|
|
1307
|
+
}>;
|
|
1308
|
+
onRefreshSession?: (refreshToken: string) => Promise<{
|
|
1309
|
+
user: UserAccount;
|
|
1310
|
+
expiresIn: number;
|
|
1311
|
+
sessionId?: string;
|
|
1312
|
+
}>;
|
|
1313
|
+
onDeleteSession?: (refreshToken: string) => Promise<void>;
|
|
1314
|
+
}
|
|
1315
|
+
type RealmInternal = {
|
|
1186
1316
|
/**
|
|
1187
|
-
*
|
|
1188
|
-
* Route won't be available in the API but can still be called locally!
|
|
1317
|
+
* Internal secret to sign JWT tokens and verify them.
|
|
1189
1318
|
*/
|
|
1190
|
-
|
|
1319
|
+
secret: string;
|
|
1320
|
+
};
|
|
1321
|
+
interface RealmExternal {
|
|
1191
1322
|
/**
|
|
1192
|
-
*
|
|
1323
|
+
* URL to the JWKS (JSON Web Key Set) to verify JWT tokens from external providers.
|
|
1193
1324
|
*/
|
|
1194
|
-
|
|
1325
|
+
jwks: (() => string) | JSONWebKeySet;
|
|
1195
1326
|
}
|
|
1196
|
-
declare class
|
|
1327
|
+
declare class RealmPrimitive extends Primitive<RealmPrimitiveOptions> {
|
|
1328
|
+
protected readonly securityProvider: SecurityProvider;
|
|
1329
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
1330
|
+
protected readonly jwt: JwtProvider;
|
|
1197
1331
|
protected readonly log: Logger;
|
|
1198
|
-
protected readonly env: {
|
|
1199
|
-
SERVER_API_PREFIX: string;
|
|
1200
|
-
};
|
|
1201
|
-
protected readonly httpClient: HttpClient;
|
|
1202
|
-
protected readonly serverProvider: ServerProvider;
|
|
1203
|
-
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
1204
|
-
protected onInit(): void;
|
|
1205
|
-
get prefix(): string;
|
|
1206
|
-
get route(): ServerRoute;
|
|
1207
|
-
/**
|
|
1208
|
-
* Returns the name of the action.
|
|
1209
|
-
*/
|
|
1210
1332
|
get name(): string;
|
|
1333
|
+
get accessTokenExpiration(): Duration;
|
|
1334
|
+
get refreshTokenExpiration(): Duration;
|
|
1335
|
+
protected onInit(): void;
|
|
1211
1336
|
/**
|
|
1212
|
-
*
|
|
1213
|
-
*/
|
|
1214
|
-
get group(): string;
|
|
1215
|
-
/**
|
|
1216
|
-
* Returns the HTTP method of the action.
|
|
1217
|
-
*/
|
|
1218
|
-
get method(): RouteMethod;
|
|
1219
|
-
/**
|
|
1220
|
-
* Returns the path of the action.
|
|
1221
|
-
*
|
|
1222
|
-
* Path is prefixed by `/api` by default.
|
|
1337
|
+
* Get all roles in the realm.
|
|
1223
1338
|
*/
|
|
1224
|
-
|
|
1225
|
-
get schema(): TConfig | undefined;
|
|
1226
|
-
getBodyContentType(): string | undefined;
|
|
1339
|
+
getRoles(): Role[];
|
|
1227
1340
|
/**
|
|
1228
|
-
*
|
|
1229
|
-
* There is no HTTP layer involved.
|
|
1341
|
+
* Set all roles in the realm.
|
|
1230
1342
|
*/
|
|
1231
|
-
|
|
1343
|
+
setRoles(roles: Role[]): Promise<void>;
|
|
1232
1344
|
/**
|
|
1233
|
-
*
|
|
1345
|
+
* Get a role by name, throws an error if not found.
|
|
1234
1346
|
*/
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
interface ActionDescriptorFn<TConfig extends RequestConfigSchema> extends ActionDescriptor<TConfig> {
|
|
1238
|
-
(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
|
|
1239
|
-
}
|
|
1240
|
-
type ClientRequestEntry<TConfig extends RequestConfigSchema, T$1 = ClientRequestEntryContainer<TConfig>> = { [K in keyof T$1 as T$1[K] extends undefined ? never : K]: T$1[K] };
|
|
1241
|
-
type ClientRequestEntryContainer<TConfig extends RequestConfigSchema> = {
|
|
1242
|
-
body: TConfig["body"] extends TObject ? Static<TConfig["body"]> : undefined;
|
|
1243
|
-
params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : undefined;
|
|
1244
|
-
headers?: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : undefined;
|
|
1245
|
-
query?: TConfig["query"] extends TObject ? Partial<Static<TConfig["query"]>> : undefined;
|
|
1246
|
-
};
|
|
1247
|
-
interface ClientRequestOptions extends FetchOptions {
|
|
1347
|
+
getRoleByName(name: string): Role;
|
|
1348
|
+
parseToken(token: string): Promise<JWTPayload>;
|
|
1248
1349
|
/**
|
|
1249
|
-
*
|
|
1350
|
+
* Create a token for the subject.
|
|
1250
1351
|
*/
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
*
|
|
1261
|
-
* Can be extended with module augmentation to add custom properties (like `user` in Server Security).
|
|
1262
|
-
*
|
|
1263
|
-
* This is NOT Server Request, but a specific type for actions.
|
|
1264
|
-
*/
|
|
1265
|
-
interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
|
|
1266
|
-
//#endregion
|
|
1267
|
-
//#region ../alepha/src/server/schemas/errorSchema.d.ts
|
|
1268
|
-
declare const errorSchema: alepha1223.TObject<{
|
|
1269
|
-
error: alepha1223.TString;
|
|
1270
|
-
status: alepha1223.TInteger;
|
|
1271
|
-
message: alepha1223.TString;
|
|
1272
|
-
details: alepha1223.TOptional<alepha1223.TString>;
|
|
1273
|
-
requestId: alepha1223.TOptional<alepha1223.TString>;
|
|
1274
|
-
cause: alepha1223.TOptional<alepha1223.TObject<{
|
|
1275
|
-
name: alepha1223.TString;
|
|
1276
|
-
message: alepha1223.TString;
|
|
1277
|
-
}>>;
|
|
1278
|
-
}>;
|
|
1279
|
-
type ErrorSchema = Static<typeof errorSchema>;
|
|
1280
|
-
//#endregion
|
|
1281
|
-
//#region ../alepha/src/server/errors/HttpError.d.ts
|
|
1282
|
-
declare class HttpError extends AlephaError {
|
|
1283
|
-
name: string;
|
|
1284
|
-
static is: (error: unknown, status?: number) => error is HttpErrorLike;
|
|
1285
|
-
static toJSON(error: HttpError): ErrorSchema;
|
|
1286
|
-
readonly error: string;
|
|
1287
|
-
readonly status: number;
|
|
1288
|
-
readonly requestId?: string;
|
|
1289
|
-
readonly details?: string;
|
|
1290
|
-
readonly reason?: {
|
|
1291
|
-
name: string;
|
|
1292
|
-
message: string;
|
|
1293
|
-
};
|
|
1294
|
-
constructor(options: Partial<ErrorSchema>, cause?: unknown);
|
|
1295
|
-
}
|
|
1296
|
-
interface HttpErrorLike extends Error {
|
|
1297
|
-
status: number;
|
|
1298
|
-
}
|
|
1299
|
-
//#endregion
|
|
1300
|
-
//#region ../alepha/src/server/descriptors/$route.d.ts
|
|
1301
|
-
interface RouteDescriptorOptions<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRoute<TConfig> {}
|
|
1302
|
-
declare class RouteDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<RouteDescriptorOptions<TConfig>> {
|
|
1303
|
-
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
1304
|
-
protected onInit(): void;
|
|
1305
|
-
}
|
|
1306
|
-
//#endregion
|
|
1307
|
-
//#region ../alepha/src/server/providers/BunHttpServerProvider.d.ts
|
|
1308
|
-
declare const envSchema$7: alepha1223.TObject<{
|
|
1309
|
-
SERVER_PORT: alepha1223.TInteger;
|
|
1310
|
-
SERVER_HOST: alepha1223.TString;
|
|
1311
|
-
}>;
|
|
1312
|
-
declare module "alepha" {
|
|
1313
|
-
interface Env extends Partial<Static<typeof envSchema$7>> {}
|
|
1352
|
+
createToken(user: UserAccount, refreshToken?: {
|
|
1353
|
+
sid?: string;
|
|
1354
|
+
refresh_token?: string;
|
|
1355
|
+
refresh_token_expires_in?: number;
|
|
1356
|
+
}): Promise<AccessTokenResponse>;
|
|
1357
|
+
refreshToken(refreshToken: string, accessToken?: string): Promise<{
|
|
1358
|
+
tokens: AccessTokenResponse;
|
|
1359
|
+
user: UserAccount;
|
|
1360
|
+
}>;
|
|
1314
1361
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1362
|
+
interface AccessTokenResponse {
|
|
1363
|
+
access_token: string;
|
|
1364
|
+
token_type: string;
|
|
1365
|
+
expires_in?: number;
|
|
1366
|
+
issued_at: number;
|
|
1367
|
+
refresh_token?: string;
|
|
1368
|
+
refresh_token_expires_in?: number;
|
|
1369
|
+
scope?: string;
|
|
1323
1370
|
}
|
|
1324
1371
|
//#endregion
|
|
1325
|
-
//#region ../alepha/src/
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
"alepha.node.server"?: Server;
|
|
1329
|
-
}
|
|
1330
|
-
interface Hooks {
|
|
1331
|
-
"action:onRequest": {
|
|
1332
|
-
action: ActionDescriptor<RequestConfigSchema>;
|
|
1333
|
-
request: ServerRequest;
|
|
1334
|
-
options: ClientRequestOptions;
|
|
1335
|
-
};
|
|
1336
|
-
"action:onResponse": {
|
|
1337
|
-
action: ActionDescriptor<RequestConfigSchema>;
|
|
1338
|
-
request: ServerRequest;
|
|
1339
|
-
options: ClientRequestOptions;
|
|
1340
|
-
response: any;
|
|
1341
|
-
};
|
|
1342
|
-
"server:onRequest": {
|
|
1343
|
-
route: ServerRoute;
|
|
1344
|
-
request: ServerRequest;
|
|
1345
|
-
};
|
|
1346
|
-
"server:onError": {
|
|
1347
|
-
route: ServerRoute;
|
|
1348
|
-
request: ServerRequest;
|
|
1349
|
-
error: Error;
|
|
1350
|
-
};
|
|
1351
|
-
"server:onSend": {
|
|
1352
|
-
route: ServerRoute;
|
|
1353
|
-
request: ServerRequest;
|
|
1354
|
-
};
|
|
1355
|
-
"server:onResponse": {
|
|
1356
|
-
route: ServerRoute;
|
|
1357
|
-
request: ServerRequest;
|
|
1358
|
-
response: ServerResponse$1;
|
|
1359
|
-
};
|
|
1360
|
-
"client:onRequest": {
|
|
1361
|
-
route: HttpAction;
|
|
1362
|
-
config: ServerRequestConfigEntry;
|
|
1363
|
-
options: ClientRequestOptions;
|
|
1364
|
-
headers: Record<string, string>;
|
|
1365
|
-
request: RequestInit;
|
|
1366
|
-
};
|
|
1367
|
-
"client:beforeFetch": {
|
|
1368
|
-
url: string;
|
|
1369
|
-
options: FetchOptions;
|
|
1370
|
-
request: RequestInit;
|
|
1371
|
-
};
|
|
1372
|
-
"client:onError": {
|
|
1373
|
-
route?: HttpAction;
|
|
1374
|
-
error: HttpError;
|
|
1375
|
-
};
|
|
1376
|
-
"node:request": NodeRequestEvent;
|
|
1377
|
-
"web:request": WebRequestEvent;
|
|
1378
|
-
}
|
|
1372
|
+
//#region ../alepha/src/security/primitives/$serviceAccount.d.ts
|
|
1373
|
+
interface ServiceAccountPrimitive {
|
|
1374
|
+
token: () => Promise<string>;
|
|
1379
1375
|
}
|
|
1380
1376
|
//#endregion
|
|
1381
1377
|
//#region ../alepha/src/security/providers/CryptoProvider.d.ts
|
|
@@ -1397,7 +1393,7 @@ declare module "alepha" {
|
|
|
1397
1393
|
/**
|
|
1398
1394
|
* Provides comprehensive authentication and authorization capabilities with JWT tokens, role-based access control, and user management.
|
|
1399
1395
|
*
|
|
1400
|
-
* The security module enables building secure applications using
|
|
1396
|
+
* The security module enables building secure applications using primitives like `$realm`, `$role`, and `$permission`
|
|
1401
1397
|
* on class properties. It offers JWT-based authentication, fine-grained permissions, service accounts, and seamless
|
|
1402
1398
|
* integration with various authentication providers and user management systems.
|
|
1403
1399
|
*
|
|
@@ -1472,23 +1468,23 @@ declare module "alepha/server" {
|
|
|
1472
1468
|
*/
|
|
1473
1469
|
//#endregion
|
|
1474
1470
|
//#region ../alepha/src/server-links/schemas/apiLinksResponseSchema.d.ts
|
|
1475
|
-
declare const apiLinkSchema:
|
|
1476
|
-
name:
|
|
1477
|
-
group:
|
|
1478
|
-
path:
|
|
1479
|
-
method:
|
|
1480
|
-
requestBodyType:
|
|
1481
|
-
service:
|
|
1471
|
+
declare const apiLinkSchema: alepha1672.TObject<{
|
|
1472
|
+
name: alepha1672.TString;
|
|
1473
|
+
group: alepha1672.TOptional<alepha1672.TString>;
|
|
1474
|
+
path: alepha1672.TString;
|
|
1475
|
+
method: alepha1672.TOptional<alepha1672.TString>;
|
|
1476
|
+
requestBodyType: alepha1672.TOptional<alepha1672.TString>;
|
|
1477
|
+
service: alepha1672.TOptional<alepha1672.TString>;
|
|
1482
1478
|
}>;
|
|
1483
|
-
declare const apiLinksResponseSchema:
|
|
1484
|
-
prefix:
|
|
1485
|
-
links:
|
|
1486
|
-
name:
|
|
1487
|
-
group:
|
|
1488
|
-
path:
|
|
1489
|
-
method:
|
|
1490
|
-
requestBodyType:
|
|
1491
|
-
service:
|
|
1479
|
+
declare const apiLinksResponseSchema: alepha1672.TObject<{
|
|
1480
|
+
prefix: alepha1672.TOptional<alepha1672.TString>;
|
|
1481
|
+
links: alepha1672.TArray<alepha1672.TObject<{
|
|
1482
|
+
name: alepha1672.TString;
|
|
1483
|
+
group: alepha1672.TOptional<alepha1672.TString>;
|
|
1484
|
+
path: alepha1672.TString;
|
|
1485
|
+
method: alepha1672.TOptional<alepha1672.TString>;
|
|
1486
|
+
requestBodyType: alepha1672.TOptional<alepha1672.TString>;
|
|
1487
|
+
service: alepha1672.TOptional<alepha1672.TString>;
|
|
1492
1488
|
}>>;
|
|
1493
1489
|
}>;
|
|
1494
1490
|
type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
|
|
@@ -1555,14 +1551,14 @@ interface ClientScope {
|
|
|
1555
1551
|
service?: string;
|
|
1556
1552
|
hostname?: string;
|
|
1557
1553
|
}
|
|
1558
|
-
type HttpVirtualClient<T$1> = { [K in keyof T$1 as T$1[K] extends
|
|
1559
|
-
interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<
|
|
1554
|
+
type HttpVirtualClient<T$1> = { [K in keyof T$1 as T$1[K] extends ActionPrimitive<RequestConfigSchema> ? K : never]: T$1[K] extends ActionPrimitive<infer Schema> ? VirtualAction<Schema> : never };
|
|
1555
|
+
interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<ActionPrimitive<T$1>, "name" | "run" | "fetch"> {
|
|
1560
1556
|
(config?: ClientRequestEntry<T$1>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T$1>>;
|
|
1561
1557
|
can: () => boolean;
|
|
1562
1558
|
}
|
|
1563
1559
|
//#endregion
|
|
1564
|
-
//#region ../alepha/src/server-proxy/
|
|
1565
|
-
type
|
|
1560
|
+
//#region ../alepha/src/server-proxy/primitives/$proxy.d.ts
|
|
1561
|
+
type ProxyPrimitiveOptions = {
|
|
1566
1562
|
/**
|
|
1567
1563
|
* Path pattern to match for proxying requests.
|
|
1568
1564
|
*
|
|
@@ -1684,14 +1680,14 @@ declare class ServerProxyProvider {
|
|
|
1684
1680
|
protected readonly log: Logger;
|
|
1685
1681
|
protected readonly routerProvider: ServerRouterProvider;
|
|
1686
1682
|
protected readonly alepha: Alepha;
|
|
1687
|
-
protected readonly configure:
|
|
1688
|
-
createProxy(options:
|
|
1689
|
-
createProxyHandler(target: string, options: Omit<
|
|
1683
|
+
protected readonly configure: alepha1672.HookPrimitive<"configure">;
|
|
1684
|
+
createProxy(options: ProxyPrimitiveOptions): void;
|
|
1685
|
+
createProxyHandler(target: string, options: Omit<ProxyPrimitiveOptions, "path">): ServerHandler;
|
|
1690
1686
|
private getRawRequestBody;
|
|
1691
1687
|
}
|
|
1692
1688
|
//#endregion
|
|
1693
|
-
//#region ../alepha/src/server-links/
|
|
1694
|
-
interface
|
|
1689
|
+
//#region ../alepha/src/server-links/primitives/$remote.d.ts
|
|
1690
|
+
interface RemotePrimitiveOptions {
|
|
1695
1691
|
/**
|
|
1696
1692
|
* The URL of the remote service.
|
|
1697
1693
|
* You can use a function to generate the URL dynamically.
|
|
@@ -1723,7 +1719,7 @@ interface RemoteDescriptorOptions {
|
|
|
1723
1719
|
* If true, all methods of the remote service will be exposed as actions in this context.
|
|
1724
1720
|
* > Note: Proxy will never use the service account, it just... proxies the request.
|
|
1725
1721
|
*/
|
|
1726
|
-
proxy?: boolean | Partial<
|
|
1722
|
+
proxy?: boolean | Partial<ProxyPrimitiveOptions & {
|
|
1727
1723
|
/**
|
|
1728
1724
|
* If true, the remote service won't be available internally, only through the proxy.
|
|
1729
1725
|
*/
|
|
@@ -1733,9 +1729,9 @@ interface RemoteDescriptorOptions {
|
|
|
1733
1729
|
* For communication between the server and the remote service with a security layer.
|
|
1734
1730
|
* This will be used for internal communication and will not be exposed to the client.
|
|
1735
1731
|
*/
|
|
1736
|
-
serviceAccount?:
|
|
1732
|
+
serviceAccount?: ServiceAccountPrimitive;
|
|
1737
1733
|
}
|
|
1738
|
-
declare class
|
|
1734
|
+
declare class RemotePrimitive extends Primitive<RemotePrimitiveOptions> {
|
|
1739
1735
|
get name(): string;
|
|
1740
1736
|
}
|
|
1741
1737
|
//#endregion
|
|
@@ -1826,8 +1822,8 @@ declare class RetryProvider {
|
|
|
1826
1822
|
protected calculateBackoff(attempt: number, options?: number | RetryBackoffOptions): number;
|
|
1827
1823
|
}
|
|
1828
1824
|
//#endregion
|
|
1829
|
-
//#region ../alepha/src/retry/
|
|
1830
|
-
interface
|
|
1825
|
+
//#region ../alepha/src/retry/primitives/$retry.d.ts
|
|
1826
|
+
interface RetryPrimitiveOptions<T$1 extends (...args: any[]) => any> {
|
|
1831
1827
|
/**
|
|
1832
1828
|
* The function to retry.
|
|
1833
1829
|
*/
|
|
@@ -1867,18 +1863,18 @@ interface RetryDescriptorOptions<T$1 extends (...args: any[]) => any> {
|
|
|
1867
1863
|
*/
|
|
1868
1864
|
signal?: AbortSignal;
|
|
1869
1865
|
}
|
|
1870
|
-
declare class
|
|
1866
|
+
declare class RetryPrimitive<T$1 extends (...args: any[]) => any> extends Primitive<RetryPrimitiveOptions<T$1>> {
|
|
1871
1867
|
protected readonly retryProvider: RetryProvider;
|
|
1872
|
-
protected appAbortController
|
|
1873
|
-
constructor(args:
|
|
1868
|
+
protected appAbortController?: AbortController;
|
|
1869
|
+
constructor(args: PrimitiveArgs<RetryPrimitiveOptions<T$1>>);
|
|
1874
1870
|
run(...args: Parameters<T$1>): Promise<ReturnType<T$1>>;
|
|
1875
1871
|
}
|
|
1876
|
-
interface
|
|
1872
|
+
interface RetryPrimitiveFn<T$1 extends (...args: any[]) => any> extends RetryPrimitive<T$1> {
|
|
1877
1873
|
(...args: Parameters<T$1>): Promise<ReturnType<T$1>>;
|
|
1878
1874
|
}
|
|
1879
1875
|
//#endregion
|
|
1880
|
-
//#region ../alepha/src/server-links/providers/
|
|
1881
|
-
declare class
|
|
1876
|
+
//#region ../alepha/src/server-links/providers/RemotePrimitiveProvider.d.ts
|
|
1877
|
+
declare class RemotePrimitiveProvider {
|
|
1882
1878
|
protected readonly env: {
|
|
1883
1879
|
SERVER_API_PREFIX: string;
|
|
1884
1880
|
};
|
|
@@ -1888,10 +1884,10 @@ declare class RemoteDescriptorProvider {
|
|
|
1888
1884
|
protected readonly remotes: Array<ServerRemote>;
|
|
1889
1885
|
protected readonly log: Logger;
|
|
1890
1886
|
getRemotes(): ServerRemote[];
|
|
1891
|
-
readonly configure:
|
|
1892
|
-
readonly start:
|
|
1893
|
-
registerRemote(value:
|
|
1894
|
-
protected readonly fetchLinks:
|
|
1887
|
+
readonly configure: alepha1672.HookPrimitive<"configure">;
|
|
1888
|
+
readonly start: alepha1672.HookPrimitive<"start">;
|
|
1889
|
+
registerRemote(value: RemotePrimitive): Promise<void>;
|
|
1890
|
+
protected readonly fetchLinks: RetryPrimitiveFn<(opts: FetchLinksOptions) => Promise<ApiLinksResponse>>;
|
|
1895
1891
|
}
|
|
1896
1892
|
interface FetchLinksOptions {
|
|
1897
1893
|
/**
|
|
@@ -1940,7 +1936,7 @@ interface ServerRemote {
|
|
|
1940
1936
|
/**
|
|
1941
1937
|
* Force a default access token provider when not provided.
|
|
1942
1938
|
*/
|
|
1943
|
-
serviceAccount?:
|
|
1939
|
+
serviceAccount?: ServiceAccountPrimitive;
|
|
1944
1940
|
/**
|
|
1945
1941
|
* Prefix for the remote service links.
|
|
1946
1942
|
*/
|
|
@@ -1954,25 +1950,25 @@ declare class ServerLinksProvider {
|
|
|
1954
1950
|
};
|
|
1955
1951
|
protected readonly alepha: Alepha;
|
|
1956
1952
|
protected readonly linkProvider: LinkProvider;
|
|
1957
|
-
protected readonly remoteProvider:
|
|
1953
|
+
protected readonly remoteProvider: RemotePrimitiveProvider;
|
|
1958
1954
|
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
1959
1955
|
get prefix(): string;
|
|
1960
|
-
readonly onRoute:
|
|
1956
|
+
readonly onRoute: alepha1672.HookPrimitive<"configure">;
|
|
1961
1957
|
/**
|
|
1962
1958
|
* First API - Get all API links for the user.
|
|
1963
1959
|
*
|
|
1964
1960
|
* This is based on the user's permissions.
|
|
1965
1961
|
*/
|
|
1966
|
-
readonly links:
|
|
1967
|
-
response:
|
|
1968
|
-
prefix:
|
|
1969
|
-
links:
|
|
1970
|
-
name:
|
|
1971
|
-
group:
|
|
1972
|
-
path:
|
|
1973
|
-
method:
|
|
1974
|
-
requestBodyType:
|
|
1975
|
-
service:
|
|
1962
|
+
readonly links: RoutePrimitive<{
|
|
1963
|
+
response: alepha1672.TObject<{
|
|
1964
|
+
prefix: alepha1672.TOptional<alepha1672.TString>;
|
|
1965
|
+
links: alepha1672.TArray<alepha1672.TObject<{
|
|
1966
|
+
name: alepha1672.TString;
|
|
1967
|
+
group: alepha1672.TOptional<alepha1672.TString>;
|
|
1968
|
+
path: alepha1672.TString;
|
|
1969
|
+
method: alepha1672.TOptional<alepha1672.TString>;
|
|
1970
|
+
requestBodyType: alepha1672.TOptional<alepha1672.TString>;
|
|
1971
|
+
service: alepha1672.TOptional<alepha1672.TString>;
|
|
1976
1972
|
}>>;
|
|
1977
1973
|
}>;
|
|
1978
1974
|
}>;
|
|
@@ -1982,11 +1978,11 @@ declare class ServerLinksProvider {
|
|
|
1982
1978
|
* Note: Body/Response schema are not included in `links` API because it's TOO BIG.
|
|
1983
1979
|
* I mean for 150+ links, you got 50ms of serialization time.
|
|
1984
1980
|
*/
|
|
1985
|
-
readonly schema:
|
|
1986
|
-
params:
|
|
1987
|
-
name:
|
|
1981
|
+
readonly schema: RoutePrimitive<{
|
|
1982
|
+
params: alepha1672.TObject<{
|
|
1983
|
+
name: alepha1672.TString;
|
|
1988
1984
|
}>;
|
|
1989
|
-
response:
|
|
1985
|
+
response: alepha1672.TRecord<string, alepha1672.TAny>;
|
|
1990
1986
|
}>;
|
|
1991
1987
|
getSchemaByName(name: string, options?: GetApiLinksOptions): Promise<RequestConfigSchema>;
|
|
1992
1988
|
/**
|
|
@@ -2015,7 +2011,7 @@ declare module "alepha" {
|
|
|
2015
2011
|
/**
|
|
2016
2012
|
* Provides server-side link management and remote capabilities for client-server interactions.
|
|
2017
2013
|
*
|
|
2018
|
-
* The server-links module enables declarative link definitions using `$remote` and `$client`
|
|
2014
|
+
* The server-links module enables declarative link definitions using `$remote` and `$client` primitives,
|
|
2019
2015
|
* facilitating seamless API endpoint management and client-server communication. It integrates with server
|
|
2020
2016
|
* security features to ensure safe and controlled access to resources.
|
|
2021
2017
|
*
|
|
@@ -2036,7 +2032,7 @@ declare module "alepha/server" {
|
|
|
2036
2032
|
*/
|
|
2037
2033
|
cache?: ServerRouteCache;
|
|
2038
2034
|
}
|
|
2039
|
-
interface
|
|
2035
|
+
interface ActionPrimitive<TConfig extends RequestConfigSchema> {
|
|
2040
2036
|
invalidate: () => Promise<void>;
|
|
2041
2037
|
}
|
|
2042
2038
|
}
|
|
@@ -2055,11 +2051,11 @@ boolean
|
|
|
2055
2051
|
/**
|
|
2056
2052
|
* If true, enables storing cached responses. (in-memory, Redis, @see alepha/cache for other providers)
|
|
2057
2053
|
* If a DurationLike is provided, it will be used as the TTL for the cache.
|
|
2058
|
-
* If
|
|
2054
|
+
* If CachePrimitiveOptions is provided, it will be used to configure the cache storage.
|
|
2059
2055
|
*
|
|
2060
2056
|
* @default false
|
|
2061
2057
|
*/
|
|
2062
|
-
store?: true | DurationLike |
|
|
2058
|
+
store?: true | DurationLike | CachePrimitiveOptions;
|
|
2063
2059
|
/**
|
|
2064
2060
|
* If true, enables ETag support for the cached responses.
|
|
2065
2061
|
*/
|
|
@@ -2139,13 +2135,13 @@ declare class Redirection extends Error {
|
|
|
2139
2135
|
}
|
|
2140
2136
|
//#endregion
|
|
2141
2137
|
//#region ../react/src/core/providers/ReactPageProvider.d.ts
|
|
2142
|
-
declare const envSchema$5:
|
|
2143
|
-
REACT_STRICT_MODE:
|
|
2138
|
+
declare const envSchema$5: alepha1672.TObject<{
|
|
2139
|
+
REACT_STRICT_MODE: alepha1672.TBoolean;
|
|
2144
2140
|
}>;
|
|
2145
2141
|
declare module "alepha" {
|
|
2146
2142
|
interface Env extends Partial<Static<typeof envSchema$5>> {}
|
|
2147
2143
|
}
|
|
2148
|
-
interface PageRouteEntry extends Omit<
|
|
2144
|
+
interface PageRouteEntry extends Omit<PagePrimitiveOptions, "children" | "parent"> {
|
|
2149
2145
|
children?: PageRouteEntry[];
|
|
2150
2146
|
}
|
|
2151
2147
|
interface PageRoute extends PageRouteEntry {
|
|
@@ -2197,25 +2193,22 @@ interface ReactRouterState {
|
|
|
2197
2193
|
*/
|
|
2198
2194
|
meta: Record<string, any>;
|
|
2199
2195
|
}
|
|
2200
|
-
interface TransitionOptions {
|
|
2201
|
-
previous?: PreviousLayerData[];
|
|
2202
|
-
}
|
|
2203
2196
|
//#endregion
|
|
2204
2197
|
//#region ../react/src/core/services/ReactPageService.d.ts
|
|
2205
2198
|
declare class ReactPageService {
|
|
2206
|
-
fetch(pathname: string, options?:
|
|
2199
|
+
fetch(pathname: string, options?: PagePrimitiveRenderOptions): Promise<{
|
|
2207
2200
|
html: string;
|
|
2208
2201
|
response: Response;
|
|
2209
2202
|
}>;
|
|
2210
|
-
render(name: string, options?:
|
|
2203
|
+
render(name: string, options?: PagePrimitiveRenderOptions): Promise<PagePrimitiveRenderResult>;
|
|
2211
2204
|
}
|
|
2212
2205
|
//#endregion
|
|
2213
|
-
//#region ../react/src/core/
|
|
2214
|
-
interface
|
|
2206
|
+
//#region ../react/src/core/primitives/$page.d.ts
|
|
2207
|
+
interface PagePrimitiveOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
2215
2208
|
/**
|
|
2216
2209
|
* Identifier name for the page. Must be unique.
|
|
2217
2210
|
*
|
|
2218
|
-
* @default
|
|
2211
|
+
* @default Primitive key
|
|
2219
2212
|
*/
|
|
2220
2213
|
name?: string;
|
|
2221
2214
|
/**
|
|
@@ -2267,11 +2260,11 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
|
|
|
2267
2260
|
* Attach child pages to create nested routes.
|
|
2268
2261
|
* This will make the page a parent route.
|
|
2269
2262
|
*/
|
|
2270
|
-
children?: Array<
|
|
2263
|
+
children?: Array<PagePrimitive> | (() => Array<PagePrimitive>);
|
|
2271
2264
|
/**
|
|
2272
2265
|
* Define a parent page for nested routing.
|
|
2273
2266
|
*/
|
|
2274
|
-
parent?:
|
|
2267
|
+
parent?: PagePrimitive<PageConfigSchema, TPropsParent, any>;
|
|
2275
2268
|
can?: () => boolean;
|
|
2276
2269
|
/**
|
|
2277
2270
|
* Catch any error from the `resolve` function or during `rendering`.
|
|
@@ -2381,7 +2374,7 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
|
|
|
2381
2374
|
animation?: PageAnimation;
|
|
2382
2375
|
}
|
|
2383
2376
|
type ErrorHandler = (error: Error, state: ReactRouterState) => ReactNode | Redirection | undefined;
|
|
2384
|
-
declare class
|
|
2377
|
+
declare class PagePrimitive<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> extends Primitive<PagePrimitiveOptions<TConfig, TProps, TPropsParent>> {
|
|
2385
2378
|
protected readonly reactPageService: ReactPageService;
|
|
2386
2379
|
protected onInit(): void;
|
|
2387
2380
|
get name(): string;
|
|
@@ -2391,8 +2384,8 @@ declare class PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema
|
|
|
2391
2384
|
* This will render the page (HTML layout included or not) and return the HTML + context.
|
|
2392
2385
|
* Only valid for server-side rendering, it will throw an error if called on the client-side.
|
|
2393
2386
|
*/
|
|
2394
|
-
render(options?:
|
|
2395
|
-
fetch(options?:
|
|
2387
|
+
render(options?: PagePrimitiveRenderOptions): Promise<PagePrimitiveRenderResult>;
|
|
2388
|
+
fetch(options?: PagePrimitiveRenderOptions): Promise<{
|
|
2396
2389
|
html: string;
|
|
2397
2390
|
response: Response;
|
|
2398
2391
|
}>;
|
|
@@ -2405,7 +2398,7 @@ interface PageConfigSchema {
|
|
|
2405
2398
|
}
|
|
2406
2399
|
type TPropsDefault = any;
|
|
2407
2400
|
type TPropsParentDefault = {};
|
|
2408
|
-
interface
|
|
2401
|
+
interface PagePrimitiveRenderOptions {
|
|
2409
2402
|
params?: Record<string, string>;
|
|
2410
2403
|
query?: Record<string, string>;
|
|
2411
2404
|
/**
|
|
@@ -2417,7 +2410,7 @@ interface PageDescriptorRenderOptions {
|
|
|
2417
2410
|
html?: boolean;
|
|
2418
2411
|
hydration?: boolean;
|
|
2419
2412
|
}
|
|
2420
|
-
interface
|
|
2413
|
+
interface PagePrimitiveRenderResult {
|
|
2421
2414
|
html: string;
|
|
2422
2415
|
state: ReactRouterState;
|
|
2423
2416
|
redirect?: string;
|
|
@@ -2440,8 +2433,8 @@ type CssAnimation = {
|
|
|
2440
2433
|
};
|
|
2441
2434
|
//#endregion
|
|
2442
2435
|
//#region ../react/src/core/providers/ReactBrowserProvider.d.ts
|
|
2443
|
-
declare const envSchema$4:
|
|
2444
|
-
REACT_ROOT_ID:
|
|
2436
|
+
declare const envSchema$4: alepha1672.TObject<{
|
|
2437
|
+
REACT_ROOT_ID: alepha1672.TString;
|
|
2445
2438
|
}>;
|
|
2446
2439
|
declare module "alepha" {
|
|
2447
2440
|
interface Env extends Partial<Static<typeof envSchema$4>> {}
|
|
@@ -2449,8 +2442,8 @@ declare module "alepha" {
|
|
|
2449
2442
|
/**
|
|
2450
2443
|
* React browser renderer configuration atom
|
|
2451
2444
|
*/
|
|
2452
|
-
declare const reactBrowserOptions:
|
|
2453
|
-
scrollRestoration:
|
|
2445
|
+
declare const reactBrowserOptions: alepha1672.Atom<alepha1672.TObject<{
|
|
2446
|
+
scrollRestoration: alepha1672.TUnsafe<"top" | "manual">;
|
|
2454
2447
|
}>, "alepha.react.browser.options">;
|
|
2455
2448
|
type ReactBrowserRendererOptions = Static<typeof reactBrowserOptions.schema>;
|
|
2456
2449
|
declare module "alepha" {
|
|
@@ -2458,64 +2451,12 @@ declare module "alepha" {
|
|
|
2458
2451
|
[reactBrowserOptions.key]: ReactBrowserRendererOptions;
|
|
2459
2452
|
}
|
|
2460
2453
|
}
|
|
2461
|
-
interface RouterGoOptions {
|
|
2462
|
-
replace?: boolean;
|
|
2463
|
-
match?: TransitionOptions;
|
|
2464
|
-
params?: Record<string, string>;
|
|
2465
|
-
query?: Record<string, string>;
|
|
2466
|
-
meta?: Record<string, any>;
|
|
2467
|
-
/**
|
|
2468
|
-
* Recreate the whole page, ignoring the current state.
|
|
2469
|
-
*/
|
|
2470
|
-
force?: boolean;
|
|
2471
|
-
}
|
|
2472
2454
|
type ReactHydrationState = {
|
|
2473
2455
|
layers?: Array<PreviousLayerData>;
|
|
2474
2456
|
} & {
|
|
2475
2457
|
[key: string]: any;
|
|
2476
2458
|
};
|
|
2477
2459
|
//#endregion
|
|
2478
|
-
//#region ../react/src/core/hooks/useAction.d.ts
|
|
2479
|
-
interface UseActionReturn<Args extends any[], Result> {
|
|
2480
|
-
/**
|
|
2481
|
-
* Execute the action with the provided arguments.
|
|
2482
|
-
*
|
|
2483
|
-
* @example
|
|
2484
|
-
* ```tsx
|
|
2485
|
-
* const action = useAction({ handler: async (data) => { ... } }, []);
|
|
2486
|
-
* action.run(data);
|
|
2487
|
-
* ```
|
|
2488
|
-
*/
|
|
2489
|
-
run: (...args: Args) => Promise<Result | undefined>;
|
|
2490
|
-
/**
|
|
2491
|
-
* Loading state - true when action is executing.
|
|
2492
|
-
*/
|
|
2493
|
-
loading: boolean;
|
|
2494
|
-
/**
|
|
2495
|
-
* Error state - contains error if action failed, undefined otherwise.
|
|
2496
|
-
*/
|
|
2497
|
-
error?: Error;
|
|
2498
|
-
/**
|
|
2499
|
-
* Cancel any pending debounced action or abort the current in-flight request.
|
|
2500
|
-
*
|
|
2501
|
-
* @example
|
|
2502
|
-
* ```tsx
|
|
2503
|
-
* const action = useAction({ ... }, []);
|
|
2504
|
-
*
|
|
2505
|
-
* <button onClick={action.cancel} disabled={!action.loading}>
|
|
2506
|
-
* Cancel
|
|
2507
|
-
* </button>
|
|
2508
|
-
* ```
|
|
2509
|
-
*/
|
|
2510
|
-
cancel: () => void;
|
|
2511
|
-
}
|
|
2512
|
-
//#endregion
|
|
2513
|
-
//#region ../react/src/core/hooks/useActive.d.ts
|
|
2514
|
-
interface UseActiveOptions {
|
|
2515
|
-
href: string;
|
|
2516
|
-
startWith?: boolean;
|
|
2517
|
-
}
|
|
2518
|
-
//#endregion
|
|
2519
2460
|
//#region ../alepha/src/file/providers/FileSystemProvider.d.ts
|
|
2520
2461
|
/**
|
|
2521
2462
|
* Options for creating a file from a URL
|
|
@@ -2913,10 +2854,10 @@ declare class FileDetector {
|
|
|
2913
2854
|
}
|
|
2914
2855
|
//#endregion
|
|
2915
2856
|
//#region ../react/src/core/providers/ReactServerProvider.d.ts
|
|
2916
|
-
declare const envSchema$3:
|
|
2917
|
-
REACT_SSR_ENABLED:
|
|
2918
|
-
REACT_ROOT_ID:
|
|
2919
|
-
REACT_SERVER_TEMPLATE:
|
|
2857
|
+
declare const envSchema$3: alepha1672.TObject<{
|
|
2858
|
+
REACT_SSR_ENABLED: alepha1672.TOptional<alepha1672.TBoolean>;
|
|
2859
|
+
REACT_ROOT_ID: alepha1672.TString;
|
|
2860
|
+
REACT_SERVER_TEMPLATE: alepha1672.TOptional<alepha1672.TString>;
|
|
2920
2861
|
}>;
|
|
2921
2862
|
declare module "alepha" {
|
|
2922
2863
|
interface Env extends Partial<Static<typeof envSchema$3>> {}
|
|
@@ -2927,11 +2868,11 @@ declare module "alepha" {
|
|
|
2927
2868
|
/**
|
|
2928
2869
|
* React server provider configuration atom
|
|
2929
2870
|
*/
|
|
2930
|
-
declare const reactServerOptions:
|
|
2931
|
-
publicDir:
|
|
2932
|
-
staticServer:
|
|
2933
|
-
disabled:
|
|
2934
|
-
path:
|
|
2871
|
+
declare const reactServerOptions: alepha1672.Atom<alepha1672.TObject<{
|
|
2872
|
+
publicDir: alepha1672.TString;
|
|
2873
|
+
staticServer: alepha1672.TObject<{
|
|
2874
|
+
disabled: alepha1672.TBoolean;
|
|
2875
|
+
path: alepha1672.TString;
|
|
2935
2876
|
}>;
|
|
2936
2877
|
}>, "alepha.react.server.options">;
|
|
2937
2878
|
type ReactServerProviderOptions = Static<typeof reactServerOptions.schema>;
|
|
@@ -3036,7 +2977,7 @@ declare module "alepha" {
|
|
|
3036
2977
|
/**
|
|
3037
2978
|
* Provides full-stack React development with declarative routing, server-side rendering, and client-side hydration.
|
|
3038
2979
|
*
|
|
3039
|
-
* The React module enables building modern React applications using the `$page`
|
|
2980
|
+
* The React module enables building modern React applications using the `$page` primitive on class properties.
|
|
3040
2981
|
* It delivers seamless server-side rendering, automatic code splitting, and client-side navigation with full
|
|
3041
2982
|
* type safety and schema validation for route parameters and data.
|
|
3042
2983
|
*
|
|
@@ -3045,25 +2986,25 @@ declare module "alepha" {
|
|
|
3045
2986
|
*/
|
|
3046
2987
|
//#endregion
|
|
3047
2988
|
//#region ../alepha/src/api-users/atoms/realmAuthSettingsAtom.d.ts
|
|
3048
|
-
declare const realmAuthSettingsAtom:
|
|
3049
|
-
registrationAllowed:
|
|
3050
|
-
emailEnabled:
|
|
3051
|
-
emailRequired:
|
|
3052
|
-
usernameEnabled:
|
|
3053
|
-
usernameRequired:
|
|
3054
|
-
phoneEnabled:
|
|
3055
|
-
phoneRequired:
|
|
3056
|
-
verifyEmailRequired:
|
|
3057
|
-
verifyPhoneRequired:
|
|
3058
|
-
firstNameLastNameEnabled:
|
|
3059
|
-
firstNameLastNameRequired:
|
|
3060
|
-
resetPasswordAllowed:
|
|
3061
|
-
passwordPolicy:
|
|
3062
|
-
minLength:
|
|
3063
|
-
requireUppercase:
|
|
3064
|
-
requireLowercase:
|
|
3065
|
-
requireNumbers:
|
|
3066
|
-
requireSpecialCharacters:
|
|
2989
|
+
declare const realmAuthSettingsAtom: alepha1672.Atom<alepha1672.TObject<{
|
|
2990
|
+
registrationAllowed: alepha1672.TBoolean;
|
|
2991
|
+
emailEnabled: alepha1672.TBoolean;
|
|
2992
|
+
emailRequired: alepha1672.TBoolean;
|
|
2993
|
+
usernameEnabled: alepha1672.TBoolean;
|
|
2994
|
+
usernameRequired: alepha1672.TBoolean;
|
|
2995
|
+
phoneEnabled: alepha1672.TBoolean;
|
|
2996
|
+
phoneRequired: alepha1672.TBoolean;
|
|
2997
|
+
verifyEmailRequired: alepha1672.TBoolean;
|
|
2998
|
+
verifyPhoneRequired: alepha1672.TBoolean;
|
|
2999
|
+
firstNameLastNameEnabled: alepha1672.TBoolean;
|
|
3000
|
+
firstNameLastNameRequired: alepha1672.TBoolean;
|
|
3001
|
+
resetPasswordAllowed: alepha1672.TBoolean;
|
|
3002
|
+
passwordPolicy: alepha1672.TObject<{
|
|
3003
|
+
minLength: alepha1672.TInteger;
|
|
3004
|
+
requireUppercase: alepha1672.TBoolean;
|
|
3005
|
+
requireLowercase: alepha1672.TBoolean;
|
|
3006
|
+
requireNumbers: alepha1672.TBoolean;
|
|
3007
|
+
requireSpecialCharacters: alepha1672.TBoolean;
|
|
3067
3008
|
}>;
|
|
3068
3009
|
}>, "alepha.api.users.realmAuthSettings">;
|
|
3069
3010
|
type RealmAuthSettings = Static<typeof realmAuthSettingsAtom.schema>;
|
|
@@ -3095,8 +3036,8 @@ type TObjectInsert<T$1 extends TObject> = TObject<{ [K in keyof T$1["properties"
|
|
|
3095
3036
|
*/
|
|
3096
3037
|
type TObjectUpdate<T$1 extends TObject> = TObject<{ [K in keyof T$1["properties"]]: T$1["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T$1["properties"][K] }>;
|
|
3097
3038
|
//#endregion
|
|
3098
|
-
//#region ../alepha/src/orm/
|
|
3099
|
-
interface
|
|
3039
|
+
//#region ../alepha/src/orm/primitives/$entity.d.ts
|
|
3040
|
+
interface EntityPrimitiveOptions<T$1 extends TObject, Keys = keyof Static<T$1>> {
|
|
3100
3041
|
/**
|
|
3101
3042
|
* The database table name that will be created for this entity.
|
|
3102
3043
|
* If not provided, name will be inferred from the $repository variable name.
|
|
@@ -3208,9 +3149,9 @@ interface EntityDescriptorOptions<T$1 extends TObject, Keys = keyof Static<T$1>>
|
|
|
3208
3149
|
*/
|
|
3209
3150
|
config?: (self: BuildExtraConfigColumns<string, FromSchema<T$1>, "pg">) => PgTableExtraConfigValue[];
|
|
3210
3151
|
}
|
|
3211
|
-
declare class
|
|
3212
|
-
readonly options:
|
|
3213
|
-
constructor(options:
|
|
3152
|
+
declare class EntityPrimitive<T$1 extends TObject = TObject> {
|
|
3153
|
+
readonly options: EntityPrimitiveOptions<T$1>;
|
|
3154
|
+
constructor(options: EntityPrimitiveOptions<T$1>);
|
|
3214
3155
|
alias(alias: string): this;
|
|
3215
3156
|
get cols(): EntityColumns<T$1>;
|
|
3216
3157
|
get name(): string;
|
|
@@ -3230,7 +3171,7 @@ type SchemaToTableConfig<T$1 extends TObject> = {
|
|
|
3230
3171
|
};
|
|
3231
3172
|
type EntityColumn<T$1 extends TObject> = {
|
|
3232
3173
|
name: string;
|
|
3233
|
-
entity:
|
|
3174
|
+
entity: EntityPrimitive<T$1>;
|
|
3234
3175
|
};
|
|
3235
3176
|
type EntityColumns<T$1 extends TObject> = { [key in keyof T$1["properties"]]: EntityColumn<T$1> };
|
|
3236
3177
|
//#endregion
|
|
@@ -3276,7 +3217,7 @@ interface PgEnumOptions {
|
|
|
3276
3217
|
interface PgRefOptions {
|
|
3277
3218
|
ref: () => {
|
|
3278
3219
|
name: string;
|
|
3279
|
-
entity:
|
|
3220
|
+
entity: EntityPrimitive;
|
|
3280
3221
|
};
|
|
3281
3222
|
actions?: {
|
|
3282
3223
|
onUpdate?: UpdateDeleteAction;
|
|
@@ -3290,19 +3231,6 @@ declare class DbError extends AlephaError {
|
|
|
3290
3231
|
constructor(message: string, cause?: unknown);
|
|
3291
3232
|
}
|
|
3292
3233
|
//#endregion
|
|
3293
|
-
//#region ../alepha/src/orm/helpers/pgAttr.d.ts
|
|
3294
|
-
/**
|
|
3295
|
-
* Type representation.
|
|
3296
|
-
*/
|
|
3297
|
-
type PgAttr<T$1 extends TSchema, TAttr extends PgSymbolKeys> = T$1 & { [K in TAttr]: PgSymbols[K] };
|
|
3298
|
-
interface PgAttrField {
|
|
3299
|
-
key: string;
|
|
3300
|
-
type: TSchema;
|
|
3301
|
-
data: any;
|
|
3302
|
-
nested?: any[];
|
|
3303
|
-
one?: boolean;
|
|
3304
|
-
}
|
|
3305
|
-
//#endregion
|
|
3306
3234
|
//#region ../alepha/src/orm/interfaces/FilterOperators.d.ts
|
|
3307
3235
|
interface FilterOperators<TValue> {
|
|
3308
3236
|
/**
|
|
@@ -3719,6 +3647,55 @@ interface FilterOperators<TValue> {
|
|
|
3719
3647
|
arrayOverlaps?: TValue;
|
|
3720
3648
|
}
|
|
3721
3649
|
//#endregion
|
|
3650
|
+
//#region ../alepha/src/orm/interfaces/PgQuery.d.ts
|
|
3651
|
+
/**
|
|
3652
|
+
* Order direction for sorting
|
|
3653
|
+
*/
|
|
3654
|
+
type OrderDirection = "asc" | "desc";
|
|
3655
|
+
/**
|
|
3656
|
+
* Single order by clause with column and direction
|
|
3657
|
+
*/
|
|
3658
|
+
interface OrderByClause<T$1> {
|
|
3659
|
+
column: keyof T$1;
|
|
3660
|
+
direction?: OrderDirection;
|
|
3661
|
+
}
|
|
3662
|
+
/**
|
|
3663
|
+
* Order by parameter - supports 3 modes:
|
|
3664
|
+
* 1. String: orderBy: "name" (defaults to ASC)
|
|
3665
|
+
* 2. Single object: orderBy: { column: "name", direction: "desc" }
|
|
3666
|
+
* 3. Array: orderBy: [{ column: "name", direction: "asc" }, { column: "age", direction: "desc" }]
|
|
3667
|
+
*/
|
|
3668
|
+
type OrderBy<T$1> = keyof T$1 | OrderByClause<T$1> | Array<OrderByClause<T$1>>;
|
|
3669
|
+
/**
|
|
3670
|
+
* Generic query interface for PostgreSQL entities
|
|
3671
|
+
*/
|
|
3672
|
+
interface PgQuery<T$1 extends TObject = TObject> {
|
|
3673
|
+
distinct?: (keyof Static<T$1>)[];
|
|
3674
|
+
columns?: (keyof Static<T$1>)[];
|
|
3675
|
+
where?: PgQueryWhereOrSQL<T$1>;
|
|
3676
|
+
limit?: number;
|
|
3677
|
+
offset?: number;
|
|
3678
|
+
orderBy?: OrderBy<Static<T$1>>;
|
|
3679
|
+
groupBy?: (keyof Static<T$1>)[];
|
|
3680
|
+
}
|
|
3681
|
+
type PgStatic<T$1 extends TObject, Relations extends PgRelationMap<T$1>> = Static<T$1> & { [K in keyof Relations]: Static<Relations[K]["join"]["schema"]> & (Relations[K]["with"] extends PgRelationMap<TObject> ? PgStatic<Relations[K]["join"]["schema"], Relations[K]["with"]> : {}) };
|
|
3682
|
+
interface PgQueryRelations<T$1 extends TObject = TObject, Relations extends PgRelationMap<T$1> | undefined = undefined> extends PgQuery<T$1> {
|
|
3683
|
+
with?: Relations;
|
|
3684
|
+
where?: PgQueryWhereOrSQL<T$1, Relations>;
|
|
3685
|
+
}
|
|
3686
|
+
type PgRelationMap<Base extends TObject> = Record<string, PgRelation<Base>>;
|
|
3687
|
+
type PgRelation<Base extends TObject> = {
|
|
3688
|
+
type?: "left" | "inner" | "right";
|
|
3689
|
+
join: {
|
|
3690
|
+
schema: TObject;
|
|
3691
|
+
name: string;
|
|
3692
|
+
};
|
|
3693
|
+
on: SQLWrapper | [keyof Static<Base>, {
|
|
3694
|
+
name: string;
|
|
3695
|
+
}];
|
|
3696
|
+
with?: PgRelationMap<TObject>;
|
|
3697
|
+
};
|
|
3698
|
+
//#endregion
|
|
3722
3699
|
//#region ../alepha/src/orm/interfaces/PgQueryWhere.d.ts
|
|
3723
3700
|
type PgQueryWhere<T$1 extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = (PgQueryWhereOperators<T$1> & PgQueryWhereConditions<T$1>) | (PgQueryWhereRelations<Relations> & PgQueryWhereOperators<T$1> & PgQueryWhereConditions<T$1, Relations>);
|
|
3724
3701
|
type PgQueryWhereOrSQL<T$1 extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = SQLWrapper | PgQueryWhere<T$1, Relations>;
|
|
@@ -3798,64 +3775,28 @@ type PgQueryWhereRelations<Relations extends PgRelationMap<TObject> | undefined
|
|
|
3798
3775
|
*/
|
|
3799
3776
|
type NestedJsonbQuery<T$1> = T$1 extends object ? T$1 extends Array<infer U> ? U extends object ? { [K in keyof U]?: FilterOperators<U[K]> | U[K] } : FilterOperators<U> | U : { [K in keyof T$1]?: FilterOperators<T$1[K]> | T$1[K] | (T$1[K] extends object ? NestedJsonbQuery<T$1[K]> : never) } : FilterOperators<T$1> | T$1;
|
|
3800
3777
|
//#endregion
|
|
3801
|
-
//#region ../alepha/src/orm/
|
|
3802
|
-
/**
|
|
3803
|
-
* Order direction for sorting
|
|
3804
|
-
*/
|
|
3805
|
-
type OrderDirection = "asc" | "desc";
|
|
3806
|
-
/**
|
|
3807
|
-
* Single order by clause with column and direction
|
|
3808
|
-
*/
|
|
3809
|
-
interface OrderByClause<T$1> {
|
|
3810
|
-
column: keyof T$1;
|
|
3811
|
-
direction?: OrderDirection;
|
|
3812
|
-
}
|
|
3813
|
-
/**
|
|
3814
|
-
* Order by parameter - supports 3 modes:
|
|
3815
|
-
* 1. String: orderBy: "name" (defaults to ASC)
|
|
3816
|
-
* 2. Single object: orderBy: { column: "name", direction: "desc" }
|
|
3817
|
-
* 3. Array: orderBy: [{ column: "name", direction: "asc" }, { column: "age", direction: "desc" }]
|
|
3818
|
-
*/
|
|
3819
|
-
type OrderBy<T$1> = keyof T$1 | OrderByClause<T$1> | Array<OrderByClause<T$1>>;
|
|
3778
|
+
//#region ../alepha/src/orm/helpers/pgAttr.d.ts
|
|
3820
3779
|
/**
|
|
3821
|
-
*
|
|
3780
|
+
* Type representation.
|
|
3822
3781
|
*/
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
groupBy?: (keyof Static<T$1>)[];
|
|
3831
|
-
}
|
|
3832
|
-
type PgStatic<T$1 extends TObject, Relations extends PgRelationMap<T$1>> = Static<T$1> & { [K in keyof Relations]: Static<Relations[K]["join"]["schema"]> & (Relations[K]["with"] extends PgRelationMap<TObject> ? PgStatic<Relations[K]["join"]["schema"], Relations[K]["with"]> : {}) };
|
|
3833
|
-
interface PgQueryRelations<T$1 extends TObject = TObject, Relations extends PgRelationMap<T$1> | undefined = undefined> extends PgQuery<T$1> {
|
|
3834
|
-
with?: Relations;
|
|
3835
|
-
where?: PgQueryWhereOrSQL<T$1, Relations>;
|
|
3782
|
+
type PgAttr<T$1 extends TSchema, TAttr extends PgSymbolKeys> = T$1 & { [K in TAttr]: PgSymbols[K] };
|
|
3783
|
+
interface PgAttrField {
|
|
3784
|
+
key: string;
|
|
3785
|
+
type: TSchema;
|
|
3786
|
+
data: any;
|
|
3787
|
+
nested?: any[];
|
|
3788
|
+
one?: boolean;
|
|
3836
3789
|
}
|
|
3837
|
-
type PgRelationMap<Base extends TObject> = Record<string, PgRelation<Base>>;
|
|
3838
|
-
type PgRelation<Base extends TObject> = {
|
|
3839
|
-
type?: "left" | "inner" | "right";
|
|
3840
|
-
join: {
|
|
3841
|
-
schema: TObject;
|
|
3842
|
-
name: string;
|
|
3843
|
-
};
|
|
3844
|
-
on: SQLWrapper | [keyof Static<Base>, {
|
|
3845
|
-
name: string;
|
|
3846
|
-
}];
|
|
3847
|
-
with?: PgRelationMap<TObject>;
|
|
3848
|
-
};
|
|
3849
3790
|
//#endregion
|
|
3850
|
-
//#region ../alepha/src/orm/
|
|
3851
|
-
interface
|
|
3791
|
+
//#region ../alepha/src/orm/primitives/$sequence.d.ts
|
|
3792
|
+
interface SequencePrimitiveOptions extends PgSequenceOptions {
|
|
3852
3793
|
/**
|
|
3853
3794
|
* The name of the sequence. If not provided, the property key will be used.
|
|
3854
3795
|
*/
|
|
3855
3796
|
name?: string;
|
|
3856
3797
|
provider?: DatabaseProvider;
|
|
3857
3798
|
}
|
|
3858
|
-
declare class
|
|
3799
|
+
declare class SequencePrimitive extends Primitive<SequencePrimitiveOptions> {
|
|
3859
3800
|
readonly provider: DatabaseProvider;
|
|
3860
3801
|
onInit(): void;
|
|
3861
3802
|
get name(): string;
|
|
@@ -3886,22 +3827,22 @@ interface TableConfigBuilders<TConfig> {
|
|
|
3886
3827
|
}) => TConfig;
|
|
3887
3828
|
}
|
|
3888
3829
|
/**
|
|
3889
|
-
* Abstract base class for transforming Alepha
|
|
3830
|
+
* Abstract base class for transforming Alepha Primitives (Entity, Sequence, etc...)
|
|
3890
3831
|
* into drizzle models (tables, enums, sequences, etc...).
|
|
3891
3832
|
*/
|
|
3892
3833
|
declare abstract class ModelBuilder {
|
|
3893
3834
|
/**
|
|
3894
|
-
* Build a table from an entity
|
|
3835
|
+
* Build a table from an entity primitive.
|
|
3895
3836
|
*/
|
|
3896
|
-
abstract buildTable(entity:
|
|
3837
|
+
abstract buildTable(entity: EntityPrimitive, options: {
|
|
3897
3838
|
tables: Map<string, unknown>;
|
|
3898
3839
|
enums: Map<string, unknown>;
|
|
3899
3840
|
schema: string;
|
|
3900
3841
|
}): void;
|
|
3901
3842
|
/**
|
|
3902
|
-
* Build a sequence from a sequence
|
|
3843
|
+
* Build a sequence from a sequence primitive.
|
|
3903
3844
|
*/
|
|
3904
|
-
abstract buildSequence(sequence:
|
|
3845
|
+
abstract buildSequence(sequence: SequencePrimitive, options: {
|
|
3905
3846
|
sequences: Map<string, unknown>;
|
|
3906
3847
|
schema: string;
|
|
3907
3848
|
}): void;
|
|
@@ -3913,12 +3854,12 @@ declare abstract class ModelBuilder {
|
|
|
3913
3854
|
* Build the table configuration function for any database.
|
|
3914
3855
|
* This includes indexes, foreign keys, constraints, and custom config.
|
|
3915
3856
|
*
|
|
3916
|
-
* @param entity - The entity
|
|
3857
|
+
* @param entity - The entity primitive
|
|
3917
3858
|
* @param builders - Database-specific builder functions
|
|
3918
3859
|
* @param tableResolver - Function to resolve entity references to table columns
|
|
3919
3860
|
* @param customConfigHandler - Optional handler for custom config
|
|
3920
3861
|
*/
|
|
3921
|
-
protected buildTableConfig<TConfig, TSelf>(entity:
|
|
3862
|
+
protected buildTableConfig<TConfig, TSelf>(entity: EntityPrimitive, builders: TableConfigBuilders<TConfig>, tableResolver?: (entityName: string) => any, customConfigHandler?: (config: any, self: TSelf) => TConfig[]): ((self: TSelf) => TConfig[]) | undefined;
|
|
3922
3863
|
}
|
|
3923
3864
|
//#endregion
|
|
3924
3865
|
//#region ../alepha/src/orm/providers/DrizzleKitProvider.d.ts
|
|
@@ -3957,13 +3898,13 @@ declare class DrizzleKitProvider {
|
|
|
3957
3898
|
* Try to load the official Drizzle Kit API.
|
|
3958
3899
|
* If not available, fallback to the local kit import.
|
|
3959
3900
|
*/
|
|
3960
|
-
|
|
3901
|
+
importDrizzleKit(): typeof DrizzleKit;
|
|
3961
3902
|
}
|
|
3962
|
-
declare const devMigrationsSchema:
|
|
3963
|
-
id:
|
|
3964
|
-
name:
|
|
3965
|
-
snapshot:
|
|
3966
|
-
created_at:
|
|
3903
|
+
declare const devMigrationsSchema: alepha1672.TObject<{
|
|
3904
|
+
id: alepha1672.TNumber;
|
|
3905
|
+
name: alepha1672.TString;
|
|
3906
|
+
snapshot: alepha1672.TString;
|
|
3907
|
+
created_at: alepha1672.TString;
|
|
3967
3908
|
}>;
|
|
3968
3909
|
type DevMigrations = Static<typeof devMigrationsSchema>;
|
|
3969
3910
|
//#endregion
|
|
@@ -3982,9 +3923,9 @@ declare abstract class DatabaseProvider {
|
|
|
3982
3923
|
readonly sequences: Map<string, unknown>;
|
|
3983
3924
|
get name(): string;
|
|
3984
3925
|
get schema(): string;
|
|
3985
|
-
table<T$1 extends TObject>(entity:
|
|
3986
|
-
registerEntity(entity:
|
|
3987
|
-
registerSequence(sequence:
|
|
3926
|
+
table<T$1 extends TObject>(entity: EntityPrimitive<T$1>): PgTableWithColumns<SchemaToTableConfig<T$1>>;
|
|
3927
|
+
registerEntity(entity: EntityPrimitive): void;
|
|
3928
|
+
registerSequence(sequence: SequencePrimitive): void;
|
|
3988
3929
|
abstract execute(statement: SQLLike): Promise<Record<string, unknown>[]>;
|
|
3989
3930
|
run<T$1 extends TObject>(statement: SQLLike, schema: T$1): Promise<Array<Static<T$1>>>;
|
|
3990
3931
|
/**
|
|
@@ -4160,7 +4101,7 @@ declare class QueryManager {
|
|
|
4160
4101
|
createPagination<T$1>(entities: T$1[], limit?: number, offset?: number, sort?: Array<{
|
|
4161
4102
|
column: string;
|
|
4162
4103
|
direction: "asc" | "desc";
|
|
4163
|
-
}>):
|
|
4104
|
+
}>): alepha1672.Page<T$1>;
|
|
4164
4105
|
}
|
|
4165
4106
|
interface PgJoin {
|
|
4166
4107
|
table: string;
|
|
@@ -4192,13 +4133,13 @@ declare class PgRelationManager {
|
|
|
4192
4133
|
//#endregion
|
|
4193
4134
|
//#region ../alepha/src/orm/services/Repository.d.ts
|
|
4194
4135
|
declare abstract class Repository<T$1 extends TObject> {
|
|
4195
|
-
readonly entity:
|
|
4136
|
+
readonly entity: EntityPrimitive<T$1>;
|
|
4196
4137
|
readonly provider: DatabaseProvider;
|
|
4197
4138
|
protected readonly relationManager: PgRelationManager;
|
|
4198
4139
|
protected readonly queryManager: QueryManager;
|
|
4199
4140
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
4200
4141
|
protected readonly alepha: Alepha;
|
|
4201
|
-
constructor(entity:
|
|
4142
|
+
constructor(entity: EntityPrimitive<T$1>, provider?: typeof DatabaseProvider);
|
|
4202
4143
|
/**
|
|
4203
4144
|
* Represents the primary key of the table.
|
|
4204
4145
|
* - Key is the name of the primary key column.
|
|
@@ -4464,9 +4405,9 @@ interface StatementOptions {
|
|
|
4464
4405
|
now?: DateTime | string;
|
|
4465
4406
|
}
|
|
4466
4407
|
//#endregion
|
|
4467
|
-
//#region ../alepha/src/lock/
|
|
4468
|
-
declare const envSchema$2:
|
|
4469
|
-
LOCK_PREFIX_KEY:
|
|
4408
|
+
//#region ../alepha/src/lock/primitives/$lock.d.ts
|
|
4409
|
+
declare const envSchema$2: alepha1672.TObject<{
|
|
4410
|
+
LOCK_PREFIX_KEY: alepha1672.TString;
|
|
4470
4411
|
}>;
|
|
4471
4412
|
declare module "alepha" {
|
|
4472
4413
|
interface Env extends Partial<Static<typeof envSchema$2>> {}
|
|
@@ -4476,7 +4417,7 @@ declare module "alepha" {
|
|
|
4476
4417
|
declare module "alepha" {
|
|
4477
4418
|
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
4478
4419
|
}
|
|
4479
|
-
declare const envSchema$1:
|
|
4420
|
+
declare const envSchema$1: alepha1672.TObject<{
|
|
4480
4421
|
/**
|
|
4481
4422
|
* Main configuration for database connection.
|
|
4482
4423
|
* Accept a string in the format of a Postgres connection URL.
|
|
@@ -4484,21 +4425,21 @@ declare const envSchema$1: alepha1223.TObject<{
|
|
|
4484
4425
|
* or
|
|
4485
4426
|
* Example: postgres://user:password@localhost:5432/database?sslmode=require
|
|
4486
4427
|
*/
|
|
4487
|
-
DATABASE_URL:
|
|
4428
|
+
DATABASE_URL: alepha1672.TOptional<alepha1672.TString>;
|
|
4488
4429
|
/**
|
|
4489
4430
|
* In addition to the DATABASE_URL, you can specify the postgres schema name.
|
|
4490
4431
|
*
|
|
4491
4432
|
* It will monkey patch drizzle tables.
|
|
4492
4433
|
*/
|
|
4493
|
-
POSTGRES_SCHEMA:
|
|
4434
|
+
POSTGRES_SCHEMA: alepha1672.TOptional<alepha1672.TString>;
|
|
4494
4435
|
}>;
|
|
4495
4436
|
//#endregion
|
|
4496
4437
|
//#region ../alepha/src/orm/providers/drivers/NodeSqliteProvider.d.ts
|
|
4497
4438
|
/**
|
|
4498
4439
|
* Configuration options for the Node.js SQLite database provider.
|
|
4499
4440
|
*/
|
|
4500
|
-
declare const nodeSqliteOptions:
|
|
4501
|
-
path:
|
|
4441
|
+
declare const nodeSqliteOptions: alepha1672.Atom<alepha1672.TObject<{
|
|
4442
|
+
path: alepha1672.TOptional<alepha1672.TString>;
|
|
4502
4443
|
}>, "alepha.postgres.node-sqlite.options">;
|
|
4503
4444
|
type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
|
|
4504
4445
|
declare module "alepha" {
|
|
@@ -4582,16 +4523,16 @@ declare module "alepha" {
|
|
|
4582
4523
|
}
|
|
4583
4524
|
//#endregion
|
|
4584
4525
|
//#region ../alepha/src/api-users/entities/identities.d.ts
|
|
4585
|
-
declare const identities:
|
|
4586
|
-
id: PgAttr<PgAttr<
|
|
4587
|
-
version: PgAttr<PgAttr<
|
|
4588
|
-
createdAt: PgAttr<PgAttr<
|
|
4589
|
-
updatedAt: PgAttr<PgAttr<
|
|
4590
|
-
userId: PgAttr<
|
|
4591
|
-
password:
|
|
4592
|
-
provider:
|
|
4593
|
-
providerUserId:
|
|
4594
|
-
providerData:
|
|
4526
|
+
declare const identities: EntityPrimitive<alepha1672.TObject<{
|
|
4527
|
+
id: PgAttr<PgAttr<alepha1672.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
4528
|
+
version: PgAttr<PgAttr<alepha1672.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
4529
|
+
createdAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
4530
|
+
updatedAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
4531
|
+
userId: PgAttr<alepha1672.TString, typeof PG_REF>;
|
|
4532
|
+
password: alepha1672.TOptional<alepha1672.TString>;
|
|
4533
|
+
provider: alepha1672.TString;
|
|
4534
|
+
providerUserId: alepha1672.TOptional<alepha1672.TString>;
|
|
4535
|
+
providerData: alepha1672.TOptional<alepha1672.TRecord<string, alepha1672.TAny>>;
|
|
4595
4536
|
}>>;
|
|
4596
4537
|
//#endregion
|
|
4597
4538
|
//#region ../alepha/src/bucket/providers/FileStorageProvider.d.ts
|
|
@@ -4642,8 +4583,8 @@ declare class MemoryFileStorageProvider implements FileStorageProvider {
|
|
|
4642
4583
|
protected createId(): string;
|
|
4643
4584
|
}
|
|
4644
4585
|
//#endregion
|
|
4645
|
-
//#region ../alepha/src/bucket/
|
|
4646
|
-
interface
|
|
4586
|
+
//#region ../alepha/src/bucket/primitives/$bucket.d.ts
|
|
4587
|
+
interface BucketPrimitiveOptions extends BucketFileOptions {
|
|
4647
4588
|
/**
|
|
4648
4589
|
* File storage provider configuration for the bucket.
|
|
4649
4590
|
*
|
|
@@ -4775,7 +4716,7 @@ interface BucketFileOptions {
|
|
|
4775
4716
|
*/
|
|
4776
4717
|
maxSize?: number;
|
|
4777
4718
|
}
|
|
4778
|
-
declare class
|
|
4719
|
+
declare class BucketPrimitive extends Primitive<BucketPrimitiveOptions> {
|
|
4779
4720
|
readonly provider: FileStorageProvider | MemoryFileStorageProvider;
|
|
4780
4721
|
private readonly fileSystem;
|
|
4781
4722
|
get name(): string;
|
|
@@ -4818,8 +4759,8 @@ interface BucketFileOptions {
|
|
|
4818
4759
|
/**
|
|
4819
4760
|
* Local file storage configuration atom
|
|
4820
4761
|
*/
|
|
4821
|
-
declare const localFileStorageOptions:
|
|
4822
|
-
storagePath:
|
|
4762
|
+
declare const localFileStorageOptions: alepha1672.Atom<alepha1672.TObject<{
|
|
4763
|
+
storagePath: alepha1672.TString;
|
|
4823
4764
|
}>, "alepha.bucket.local.options">;
|
|
4824
4765
|
type LocalFileStorageProviderOptions = Static<typeof localFileStorageOptions.schema>;
|
|
4825
4766
|
declare module "alepha" {
|
|
@@ -4838,7 +4779,7 @@ declare module "alepha" {
|
|
|
4838
4779
|
"bucket:file:uploaded": {
|
|
4839
4780
|
id: string;
|
|
4840
4781
|
file: FileLike;
|
|
4841
|
-
bucket:
|
|
4782
|
+
bucket: BucketPrimitive;
|
|
4842
4783
|
options: BucketFileOptions;
|
|
4843
4784
|
};
|
|
4844
4785
|
/**
|
|
@@ -4846,14 +4787,14 @@ declare module "alepha" {
|
|
|
4846
4787
|
*/
|
|
4847
4788
|
"bucket:file:deleted": {
|
|
4848
4789
|
id: string;
|
|
4849
|
-
bucket:
|
|
4790
|
+
bucket: BucketPrimitive;
|
|
4850
4791
|
};
|
|
4851
4792
|
}
|
|
4852
4793
|
}
|
|
4853
4794
|
/**
|
|
4854
|
-
* Provides file storage capabilities through declarative bucket
|
|
4795
|
+
* Provides file storage capabilities through declarative bucket primitives with support for multiple storage backends.
|
|
4855
4796
|
*
|
|
4856
|
-
* The bucket module enables unified file operations across different storage systems using the `$bucket`
|
|
4797
|
+
* The bucket module enables unified file operations across different storage systems using the `$bucket` primitive
|
|
4857
4798
|
* on class properties. It abstracts storage provider differences, offering consistent APIs for local filesystem,
|
|
4858
4799
|
* cloud storage, or in-memory storage for testing environments.
|
|
4859
4800
|
*
|
|
@@ -4863,38 +4804,38 @@ declare module "alepha" {
|
|
|
4863
4804
|
*/
|
|
4864
4805
|
//#endregion
|
|
4865
4806
|
//#region ../alepha/src/api-users/entities/sessions.d.ts
|
|
4866
|
-
declare const sessions:
|
|
4867
|
-
id: PgAttr<PgAttr<
|
|
4868
|
-
version: PgAttr<PgAttr<
|
|
4869
|
-
createdAt: PgAttr<PgAttr<
|
|
4870
|
-
updatedAt: PgAttr<PgAttr<
|
|
4871
|
-
refreshToken:
|
|
4872
|
-
userId: PgAttr<
|
|
4873
|
-
expiresAt:
|
|
4874
|
-
ip:
|
|
4875
|
-
userAgent:
|
|
4876
|
-
os:
|
|
4877
|
-
browser:
|
|
4878
|
-
device:
|
|
4807
|
+
declare const sessions: EntityPrimitive<alepha1672.TObject<{
|
|
4808
|
+
id: PgAttr<PgAttr<alepha1672.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
4809
|
+
version: PgAttr<PgAttr<alepha1672.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
4810
|
+
createdAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
4811
|
+
updatedAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
4812
|
+
refreshToken: alepha1672.TString;
|
|
4813
|
+
userId: PgAttr<alepha1672.TString, typeof PG_REF>;
|
|
4814
|
+
expiresAt: alepha1672.TString;
|
|
4815
|
+
ip: alepha1672.TOptional<alepha1672.TString>;
|
|
4816
|
+
userAgent: alepha1672.TOptional<alepha1672.TObject<{
|
|
4817
|
+
os: alepha1672.TString;
|
|
4818
|
+
browser: alepha1672.TString;
|
|
4819
|
+
device: alepha1672.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
|
|
4879
4820
|
}>>;
|
|
4880
4821
|
}>>;
|
|
4881
4822
|
//#endregion
|
|
4882
4823
|
//#region ../alepha/src/api-users/entities/users.d.ts
|
|
4883
|
-
declare const users:
|
|
4884
|
-
id: PgAttr<PgAttr<
|
|
4885
|
-
version: PgAttr<PgAttr<
|
|
4886
|
-
createdAt: PgAttr<PgAttr<
|
|
4887
|
-
updatedAt: PgAttr<PgAttr<
|
|
4888
|
-
realm: PgAttr<
|
|
4889
|
-
username:
|
|
4890
|
-
email:
|
|
4891
|
-
phoneNumber:
|
|
4892
|
-
roles: PgAttr<
|
|
4893
|
-
firstName:
|
|
4894
|
-
lastName:
|
|
4895
|
-
picture:
|
|
4896
|
-
enabled: PgAttr<
|
|
4897
|
-
emailVerified: PgAttr<
|
|
4824
|
+
declare const users: EntityPrimitive<alepha1672.TObject<{
|
|
4825
|
+
id: PgAttr<PgAttr<alepha1672.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
4826
|
+
version: PgAttr<PgAttr<alepha1672.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
4827
|
+
createdAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
4828
|
+
updatedAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
4829
|
+
realm: PgAttr<alepha1672.TString, typeof PG_DEFAULT>;
|
|
4830
|
+
username: alepha1672.TOptional<alepha1672.TString>;
|
|
4831
|
+
email: alepha1672.TOptional<alepha1672.TString>;
|
|
4832
|
+
phoneNumber: alepha1672.TOptional<alepha1672.TString>;
|
|
4833
|
+
roles: PgAttr<alepha1672.TArray<alepha1672.TString>, typeof PG_DEFAULT>;
|
|
4834
|
+
firstName: alepha1672.TOptional<alepha1672.TString>;
|
|
4835
|
+
lastName: alepha1672.TOptional<alepha1672.TString>;
|
|
4836
|
+
picture: alepha1672.TOptional<alepha1672.TString>;
|
|
4837
|
+
enabled: PgAttr<alepha1672.TBoolean, typeof PG_DEFAULT>;
|
|
4838
|
+
emailVerified: PgAttr<alepha1672.TBoolean, typeof PG_DEFAULT>;
|
|
4898
4839
|
}>>;
|
|
4899
4840
|
//#endregion
|
|
4900
4841
|
//#region ../alepha/src/api-users/providers/UserRealmProvider.d.ts
|
|
@@ -4910,51 +4851,51 @@ interface UserRealm {
|
|
|
4910
4851
|
}
|
|
4911
4852
|
declare class UserRealmProvider {
|
|
4912
4853
|
protected readonly alepha: Alepha;
|
|
4913
|
-
protected readonly defaultIdentities: Repository<
|
|
4914
|
-
id: PgAttr<PgAttr<
|
|
4915
|
-
version: PgAttr<PgAttr<
|
|
4916
|
-
createdAt: PgAttr<PgAttr<
|
|
4917
|
-
updatedAt: PgAttr<PgAttr<
|
|
4918
|
-
userId: PgAttr<
|
|
4919
|
-
password:
|
|
4920
|
-
provider:
|
|
4921
|
-
providerUserId:
|
|
4922
|
-
providerData:
|
|
4854
|
+
protected readonly defaultIdentities: Repository<alepha1672.TObject<{
|
|
4855
|
+
id: PgAttr<PgAttr<alepha1672.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
4856
|
+
version: PgAttr<PgAttr<alepha1672.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
4857
|
+
createdAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
4858
|
+
updatedAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
4859
|
+
userId: PgAttr<alepha1672.TString, typeof PG_REF>;
|
|
4860
|
+
password: alepha1672.TOptional<alepha1672.TString>;
|
|
4861
|
+
provider: alepha1672.TString;
|
|
4862
|
+
providerUserId: alepha1672.TOptional<alepha1672.TString>;
|
|
4863
|
+
providerData: alepha1672.TOptional<alepha1672.TRecord<string, alepha1672.TAny>>;
|
|
4923
4864
|
}>>;
|
|
4924
|
-
protected readonly defaultSessions: Repository<
|
|
4925
|
-
id: PgAttr<PgAttr<
|
|
4926
|
-
version: PgAttr<PgAttr<
|
|
4927
|
-
createdAt: PgAttr<PgAttr<
|
|
4928
|
-
updatedAt: PgAttr<PgAttr<
|
|
4929
|
-
refreshToken:
|
|
4930
|
-
userId: PgAttr<
|
|
4931
|
-
expiresAt:
|
|
4932
|
-
ip:
|
|
4933
|
-
userAgent:
|
|
4934
|
-
os:
|
|
4935
|
-
browser:
|
|
4936
|
-
device:
|
|
4865
|
+
protected readonly defaultSessions: Repository<alepha1672.TObject<{
|
|
4866
|
+
id: PgAttr<PgAttr<alepha1672.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
4867
|
+
version: PgAttr<PgAttr<alepha1672.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
4868
|
+
createdAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
4869
|
+
updatedAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
4870
|
+
refreshToken: alepha1672.TString;
|
|
4871
|
+
userId: PgAttr<alepha1672.TString, typeof PG_REF>;
|
|
4872
|
+
expiresAt: alepha1672.TString;
|
|
4873
|
+
ip: alepha1672.TOptional<alepha1672.TString>;
|
|
4874
|
+
userAgent: alepha1672.TOptional<alepha1672.TObject<{
|
|
4875
|
+
os: alepha1672.TString;
|
|
4876
|
+
browser: alepha1672.TString;
|
|
4877
|
+
device: alepha1672.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
|
|
4937
4878
|
}>>;
|
|
4938
4879
|
}>>;
|
|
4939
|
-
protected readonly defaultUsers: Repository<
|
|
4940
|
-
id: PgAttr<PgAttr<
|
|
4941
|
-
version: PgAttr<PgAttr<
|
|
4942
|
-
createdAt: PgAttr<PgAttr<
|
|
4943
|
-
updatedAt: PgAttr<PgAttr<
|
|
4944
|
-
realm: PgAttr<
|
|
4945
|
-
username:
|
|
4946
|
-
email:
|
|
4947
|
-
phoneNumber:
|
|
4948
|
-
roles: PgAttr<
|
|
4949
|
-
firstName:
|
|
4950
|
-
lastName:
|
|
4951
|
-
picture:
|
|
4952
|
-
enabled: PgAttr<
|
|
4953
|
-
emailVerified: PgAttr<
|
|
4880
|
+
protected readonly defaultUsers: Repository<alepha1672.TObject<{
|
|
4881
|
+
id: PgAttr<PgAttr<alepha1672.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
4882
|
+
version: PgAttr<PgAttr<alepha1672.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
4883
|
+
createdAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
4884
|
+
updatedAt: PgAttr<PgAttr<alepha1672.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
4885
|
+
realm: PgAttr<alepha1672.TString, typeof PG_DEFAULT>;
|
|
4886
|
+
username: alepha1672.TOptional<alepha1672.TString>;
|
|
4887
|
+
email: alepha1672.TOptional<alepha1672.TString>;
|
|
4888
|
+
phoneNumber: alepha1672.TOptional<alepha1672.TString>;
|
|
4889
|
+
roles: PgAttr<alepha1672.TArray<alepha1672.TString>, typeof PG_DEFAULT>;
|
|
4890
|
+
firstName: alepha1672.TOptional<alepha1672.TString>;
|
|
4891
|
+
lastName: alepha1672.TOptional<alepha1672.TString>;
|
|
4892
|
+
picture: alepha1672.TOptional<alepha1672.TString>;
|
|
4893
|
+
enabled: PgAttr<alepha1672.TBoolean, typeof PG_DEFAULT>;
|
|
4894
|
+
emailVerified: PgAttr<alepha1672.TBoolean, typeof PG_DEFAULT>;
|
|
4954
4895
|
}>>;
|
|
4955
4896
|
protected realms: Map<string, UserRealm>;
|
|
4956
|
-
avatars:
|
|
4957
|
-
protected readonly onConfigure:
|
|
4897
|
+
avatars: BucketPrimitive;
|
|
4898
|
+
protected readonly onConfigure: alepha1672.HookPrimitive<"configure">;
|
|
4958
4899
|
register(userRealmName: string, userRealmOptions?: UserRealmOptions): void;
|
|
4959
4900
|
/**
|
|
4960
4901
|
* Gets a registered realm by name, auto-creating default if needed.
|
|
@@ -4969,21 +4910,21 @@ declare class UserRealmProvider {
|
|
|
4969
4910
|
/**
|
|
4970
4911
|
* Verification settings configuration atom
|
|
4971
4912
|
*/
|
|
4972
|
-
declare const verificationOptions:
|
|
4973
|
-
code:
|
|
4974
|
-
maxAttempts:
|
|
4975
|
-
codeLength:
|
|
4976
|
-
codeExpiration:
|
|
4977
|
-
verificationCooldown:
|
|
4978
|
-
limitPerDay:
|
|
4913
|
+
declare const verificationOptions: alepha1672.Atom<alepha1672.TObject<{
|
|
4914
|
+
code: alepha1672.TObject<{
|
|
4915
|
+
maxAttempts: alepha1672.TInteger;
|
|
4916
|
+
codeLength: alepha1672.TInteger;
|
|
4917
|
+
codeExpiration: alepha1672.TInteger;
|
|
4918
|
+
verificationCooldown: alepha1672.TInteger;
|
|
4919
|
+
limitPerDay: alepha1672.TInteger;
|
|
4979
4920
|
}>;
|
|
4980
|
-
link:
|
|
4981
|
-
maxAttempts:
|
|
4982
|
-
codeExpiration:
|
|
4983
|
-
verificationCooldown:
|
|
4984
|
-
limitPerDay:
|
|
4921
|
+
link: alepha1672.TObject<{
|
|
4922
|
+
maxAttempts: alepha1672.TInteger;
|
|
4923
|
+
codeExpiration: alepha1672.TInteger;
|
|
4924
|
+
verificationCooldown: alepha1672.TInteger;
|
|
4925
|
+
limitPerDay: alepha1672.TInteger;
|
|
4985
4926
|
}>;
|
|
4986
|
-
purgeDays:
|
|
4927
|
+
purgeDays: alepha1672.TInteger;
|
|
4987
4928
|
}>, "alepha.api.verifications.options">;
|
|
4988
4929
|
type VerificationOptions = Static<typeof verificationOptions.schema>;
|
|
4989
4930
|
declare module "alepha" {
|
|
@@ -5032,7 +4973,7 @@ declare module "alepha" {
|
|
|
5032
4973
|
/**
|
|
5033
4974
|
* Provides email sending capabilities for Alepha applications with multiple provider backends.
|
|
5034
4975
|
*
|
|
5035
|
-
* The email module enables declarative email sending through the `$email`
|
|
4976
|
+
* The email module enables declarative email sending through the `$email` primitive, allowing you to send
|
|
5036
4977
|
* emails through different providers: memory (for testing), local file system, or SMTP via Nodemailer.
|
|
5037
4978
|
* It supports HTML email content and automatic provider selection based on environment configuration.
|
|
5038
4979
|
*
|
|
@@ -5040,44 +4981,112 @@ declare module "alepha" {
|
|
|
5040
4981
|
* @module alepha.email
|
|
5041
4982
|
*/
|
|
5042
4983
|
//#endregion
|
|
4984
|
+
//#region ../alepha/src/sms/providers/SmsProvider.d.ts
|
|
4985
|
+
/**
|
|
4986
|
+
* SMS provider interface.
|
|
4987
|
+
*
|
|
4988
|
+
* All methods are asynchronous and return promises.
|
|
4989
|
+
*/
|
|
4990
|
+
declare abstract class SmsProvider {
|
|
4991
|
+
/**
|
|
4992
|
+
* Send an SMS.
|
|
4993
|
+
*
|
|
4994
|
+
* @return Promise that resolves when the SMS is sent.
|
|
4995
|
+
*/
|
|
4996
|
+
abstract send(options: SmsSendOptions): Promise<void>;
|
|
4997
|
+
}
|
|
4998
|
+
type SmsSendOptions = {
|
|
4999
|
+
to: string | string[];
|
|
5000
|
+
message: string;
|
|
5001
|
+
};
|
|
5002
|
+
//#endregion
|
|
5003
|
+
//#region ../alepha/src/sms/index.d.ts
|
|
5004
|
+
declare module "alepha" {
|
|
5005
|
+
interface Hooks {
|
|
5006
|
+
"sms:sending": {
|
|
5007
|
+
to: string | string[];
|
|
5008
|
+
template: string;
|
|
5009
|
+
variables: Record<string, unknown>;
|
|
5010
|
+
provider: SmsProvider;
|
|
5011
|
+
abort(): void;
|
|
5012
|
+
};
|
|
5013
|
+
"sms:sent": {
|
|
5014
|
+
to: string | string[];
|
|
5015
|
+
template: string;
|
|
5016
|
+
provider: SmsProvider;
|
|
5017
|
+
};
|
|
5018
|
+
}
|
|
5019
|
+
}
|
|
5020
|
+
/**
|
|
5021
|
+
* Provides SMS sending capabilities for Alepha applications with multiple provider backends.
|
|
5022
|
+
*
|
|
5023
|
+
* The SMS module enables declarative SMS sending through the `$sms` primitive, allowing you to send
|
|
5024
|
+
* text messages through different providers: memory (for testing) or local file system.
|
|
5025
|
+
* It supports automatic provider selection based on environment configuration.
|
|
5026
|
+
*
|
|
5027
|
+
* @see {@link SmsProvider}
|
|
5028
|
+
* @module alepha.sms
|
|
5029
|
+
*/
|
|
5030
|
+
//#endregion
|
|
5043
5031
|
//#region ../alepha/src/api-notifications/services/NotificationService.d.ts
|
|
5044
|
-
declare const notificationServiceEnvSchema:
|
|
5045
|
-
NOTIFICATION_QUEUE:
|
|
5032
|
+
declare const notificationServiceEnvSchema: alepha1672.TObject<{
|
|
5033
|
+
NOTIFICATION_QUEUE: alepha1672.TOptional<alepha1672.TBoolean>;
|
|
5046
5034
|
}>;
|
|
5047
5035
|
declare module "alepha" {
|
|
5048
5036
|
interface Env extends Partial<Static<typeof notificationServiceEnvSchema>> {}
|
|
5049
5037
|
}
|
|
5050
5038
|
//#endregion
|
|
5051
5039
|
//#region ../alepha/src/queue/providers/WorkerProvider.d.ts
|
|
5052
|
-
declare const envSchema:
|
|
5040
|
+
declare const envSchema: alepha1672.TObject<{
|
|
5053
5041
|
/**
|
|
5054
5042
|
* The timeout in seconds for blocking job acquisition.
|
|
5055
5043
|
* Workers will check for shutdown after each timeout period.
|
|
5056
5044
|
*/
|
|
5057
|
-
QUEUE_WORKER_BLOCKING_TIMEOUT:
|
|
5045
|
+
QUEUE_WORKER_BLOCKING_TIMEOUT: alepha1672.TInteger;
|
|
5058
5046
|
/**
|
|
5059
5047
|
* The number of workers to run concurrently. Defaults to 1.
|
|
5060
5048
|
* Useful only if you are doing a lot of I/O.
|
|
5061
5049
|
*/
|
|
5062
|
-
QUEUE_WORKER_CONCURRENCY:
|
|
5050
|
+
QUEUE_WORKER_CONCURRENCY: alepha1672.TInteger;
|
|
5063
5051
|
/**
|
|
5064
5052
|
* Interval in milliseconds for renewing job locks during processing.
|
|
5065
5053
|
* Should be less than the job's lock duration.
|
|
5066
5054
|
*/
|
|
5067
|
-
QUEUE_WORKER_LOCK_RENEWAL_INTERVAL:
|
|
5055
|
+
QUEUE_WORKER_LOCK_RENEWAL_INTERVAL: alepha1672.TInteger;
|
|
5068
5056
|
/**
|
|
5069
5057
|
* Interval in milliseconds for the scheduler to check delayed jobs and stalled jobs.
|
|
5070
5058
|
*/
|
|
5071
|
-
QUEUE_SCHEDULER_INTERVAL:
|
|
5059
|
+
QUEUE_SCHEDULER_INTERVAL: alepha1672.TInteger;
|
|
5072
5060
|
/**
|
|
5073
5061
|
* Threshold in milliseconds after lock expiration to consider a job stalled.
|
|
5074
5062
|
*/
|
|
5075
|
-
QUEUE_STALLED_THRESHOLD:
|
|
5063
|
+
QUEUE_STALLED_THRESHOLD: alepha1672.TInteger;
|
|
5076
5064
|
}>;
|
|
5077
5065
|
declare module "alepha" {
|
|
5078
5066
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
5079
5067
|
}
|
|
5080
5068
|
//#endregion
|
|
5069
|
+
//#region ../alepha/src/server-auth/schemas/authenticationProviderSchema.d.ts
|
|
5070
|
+
declare const authenticationProviderSchema: alepha1672.TObject<{
|
|
5071
|
+
name: alepha1672.TString;
|
|
5072
|
+
type: alepha1672.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
|
|
5073
|
+
}>;
|
|
5074
|
+
type AuthenticationProvider = Static<typeof authenticationProviderSchema>;
|
|
5075
|
+
//#endregion
|
|
5076
|
+
//#region ../alepha/src/server-auth/schemas/tokensSchema.d.ts
|
|
5077
|
+
declare const tokensSchema: alepha1672.TObject<{
|
|
5078
|
+
provider: alepha1672.TString;
|
|
5079
|
+
access_token: alepha1672.TString;
|
|
5080
|
+
issued_at: alepha1672.TNumber;
|
|
5081
|
+
expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5082
|
+
refresh_token: alepha1672.TOptional<alepha1672.TString>;
|
|
5083
|
+
refresh_token_expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5084
|
+
refresh_expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5085
|
+
id_token: alepha1672.TOptional<alepha1672.TString>;
|
|
5086
|
+
scope: alepha1672.TOptional<alepha1672.TString>;
|
|
5087
|
+
}>;
|
|
5088
|
+
type Tokens = Static<typeof tokensSchema>;
|
|
5089
|
+
//#endregion
|
|
5081
5090
|
//#region ../alepha/src/server-cookies/services/CookieParser.d.ts
|
|
5082
5091
|
declare class CookieParser {
|
|
5083
5092
|
parseRequestCookies(header: string): Record<string, string>;
|
|
@@ -5098,12 +5107,12 @@ declare class ServerCookiesProvider {
|
|
|
5098
5107
|
protected readonly IV_LENGTH = 16;
|
|
5099
5108
|
protected readonly AUTH_TAG_LENGTH = 16;
|
|
5100
5109
|
protected readonly SIGNATURE_LENGTH = 32;
|
|
5101
|
-
readonly onRequest:
|
|
5102
|
-
readonly onAction:
|
|
5103
|
-
readonly onSend:
|
|
5110
|
+
readonly onRequest: alepha1672.HookPrimitive<"server:onRequest">;
|
|
5111
|
+
readonly onAction: alepha1672.HookPrimitive<"action:onRequest">;
|
|
5112
|
+
readonly onSend: alepha1672.HookPrimitive<"server:onSend">;
|
|
5104
5113
|
protected getCookiesFromContext(cookies?: Cookies): Cookies;
|
|
5105
|
-
getCookie<T$1 extends TSchema>(name: string, options:
|
|
5106
|
-
setCookie<T$1 extends TSchema>(name: string, options:
|
|
5114
|
+
getCookie<T$1 extends TSchema>(name: string, options: CookiePrimitiveOptions<T$1>, contextCookies?: Cookies): Static<T$1> | undefined;
|
|
5115
|
+
setCookie<T$1 extends TSchema>(name: string, options: CookiePrimitiveOptions<T$1>, data: Static<T$1>, contextCookies?: Cookies): void;
|
|
5107
5116
|
deleteCookie<T$1 extends TSchema>(name: string, contextCookies?: Cookies): void;
|
|
5108
5117
|
protected encrypt(text: string): string;
|
|
5109
5118
|
protected decrypt(encryptedText: string): string;
|
|
@@ -5111,8 +5120,8 @@ declare class ServerCookiesProvider {
|
|
|
5111
5120
|
protected sign(data: string): string;
|
|
5112
5121
|
}
|
|
5113
5122
|
//#endregion
|
|
5114
|
-
//#region ../alepha/src/server-cookies/
|
|
5115
|
-
interface
|
|
5123
|
+
//#region ../alepha/src/server-cookies/primitives/$cookie.d.ts
|
|
5124
|
+
interface CookiePrimitiveOptions<T$1 extends TSchema> {
|
|
5116
5125
|
/** The schema for the cookie's value, used for validation and type safety. */
|
|
5117
5126
|
schema: T$1;
|
|
5118
5127
|
/** The name of the cookie. */
|
|
@@ -5136,9 +5145,9 @@ interface CookieDescriptorOptions<T$1 extends TSchema> {
|
|
|
5136
5145
|
/** If true, the cookie will be signed to prevent tampering. Requires `COOKIE_SECRET` env var. */
|
|
5137
5146
|
sign?: boolean;
|
|
5138
5147
|
}
|
|
5139
|
-
interface
|
|
5148
|
+
interface AbstractCookiePrimitive<T$1 extends TSchema> {
|
|
5140
5149
|
readonly name: string;
|
|
5141
|
-
readonly options:
|
|
5150
|
+
readonly options: CookiePrimitiveOptions<T$1>;
|
|
5142
5151
|
set(value: Static<T$1>, options?: {
|
|
5143
5152
|
cookies?: Cookies;
|
|
5144
5153
|
ttl?: DurationLike;
|
|
@@ -5171,9 +5180,9 @@ declare module "alepha/server" {
|
|
|
5171
5180
|
}
|
|
5172
5181
|
}
|
|
5173
5182
|
/**
|
|
5174
|
-
* Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie
|
|
5183
|
+
* Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie primitives.
|
|
5175
5184
|
*
|
|
5176
|
-
* The server-cookies module enables declarative cookie handling using the `$cookie`
|
|
5185
|
+
* The server-cookies module enables declarative cookie handling using the `$cookie` primitive on class properties.
|
|
5177
5186
|
* It offers automatic cookie parsing, secure cookie configuration, and seamless integration with server routes
|
|
5178
5187
|
* for managing user sessions, preferences, and authentication tokens.
|
|
5179
5188
|
*
|
|
@@ -5181,27 +5190,6 @@ declare module "alepha/server" {
|
|
|
5181
5190
|
* @module alepha.server.cookies
|
|
5182
5191
|
*/
|
|
5183
5192
|
//#endregion
|
|
5184
|
-
//#region ../alepha/src/server-auth/schemas/authenticationProviderSchema.d.ts
|
|
5185
|
-
declare const authenticationProviderSchema: alepha1223.TObject<{
|
|
5186
|
-
name: alepha1223.TString;
|
|
5187
|
-
type: alepha1223.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
|
|
5188
|
-
}>;
|
|
5189
|
-
type AuthenticationProvider = Static<typeof authenticationProviderSchema>;
|
|
5190
|
-
//#endregion
|
|
5191
|
-
//#region ../alepha/src/server-auth/schemas/tokensSchema.d.ts
|
|
5192
|
-
declare const tokensSchema: alepha1223.TObject<{
|
|
5193
|
-
provider: alepha1223.TString;
|
|
5194
|
-
access_token: alepha1223.TString;
|
|
5195
|
-
issued_at: alepha1223.TNumber;
|
|
5196
|
-
expires_in: alepha1223.TOptional<alepha1223.TNumber>;
|
|
5197
|
-
refresh_token: alepha1223.TOptional<alepha1223.TString>;
|
|
5198
|
-
refresh_token_expires_in: alepha1223.TOptional<alepha1223.TNumber>;
|
|
5199
|
-
refresh_expires_in: alepha1223.TOptional<alepha1223.TNumber>;
|
|
5200
|
-
id_token: alepha1223.TOptional<alepha1223.TString>;
|
|
5201
|
-
scope: alepha1223.TOptional<alepha1223.TString>;
|
|
5202
|
-
}>;
|
|
5203
|
-
type Tokens = Static<typeof tokensSchema>;
|
|
5204
|
-
//#endregion
|
|
5205
5193
|
//#region ../alepha/src/server-auth/providers/ServerAuthProvider.d.ts
|
|
5206
5194
|
declare class ServerAuthProvider {
|
|
5207
5195
|
protected readonly log: Logger;
|
|
@@ -5209,34 +5197,34 @@ declare class ServerAuthProvider {
|
|
|
5209
5197
|
protected readonly serverCookiesProvider: ServerCookiesProvider;
|
|
5210
5198
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
5211
5199
|
protected readonly serverLinksProvider: ServerLinksProvider;
|
|
5212
|
-
protected readonly authorizationCode:
|
|
5213
|
-
provider:
|
|
5214
|
-
codeVerifier:
|
|
5215
|
-
redirectUri:
|
|
5216
|
-
state:
|
|
5217
|
-
nonce:
|
|
5200
|
+
protected readonly authorizationCode: AbstractCookiePrimitive<alepha1672.TObject<{
|
|
5201
|
+
provider: alepha1672.TString;
|
|
5202
|
+
codeVerifier: alepha1672.TOptional<alepha1672.TString>;
|
|
5203
|
+
redirectUri: alepha1672.TOptional<alepha1672.TString>;
|
|
5204
|
+
state: alepha1672.TOptional<alepha1672.TString>;
|
|
5205
|
+
nonce: alepha1672.TOptional<alepha1672.TString>;
|
|
5218
5206
|
}>>;
|
|
5219
|
-
readonly tokens:
|
|
5220
|
-
provider:
|
|
5221
|
-
access_token:
|
|
5222
|
-
issued_at:
|
|
5223
|
-
expires_in:
|
|
5224
|
-
refresh_token:
|
|
5225
|
-
refresh_token_expires_in:
|
|
5226
|
-
refresh_expires_in:
|
|
5227
|
-
id_token:
|
|
5228
|
-
scope:
|
|
5207
|
+
readonly tokens: AbstractCookiePrimitive<alepha1672.TObject<{
|
|
5208
|
+
provider: alepha1672.TString;
|
|
5209
|
+
access_token: alepha1672.TString;
|
|
5210
|
+
issued_at: alepha1672.TNumber;
|
|
5211
|
+
expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5212
|
+
refresh_token: alepha1672.TOptional<alepha1672.TString>;
|
|
5213
|
+
refresh_token_expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5214
|
+
refresh_expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5215
|
+
id_token: alepha1672.TOptional<alepha1672.TString>;
|
|
5216
|
+
scope: alepha1672.TOptional<alepha1672.TString>;
|
|
5229
5217
|
}>>;
|
|
5230
|
-
get identities(): Array<
|
|
5218
|
+
get identities(): Array<AuthPrimitive>;
|
|
5231
5219
|
getAuthenticationProviders(filters?: {
|
|
5232
5220
|
realmName?: string;
|
|
5233
5221
|
}): AuthenticationProvider[];
|
|
5234
|
-
protected readonly configure:
|
|
5222
|
+
protected readonly configure: alepha1672.HookPrimitive<"configure">;
|
|
5235
5223
|
protected getAccessTokens(tokens: Tokens): string | undefined;
|
|
5236
5224
|
/**
|
|
5237
5225
|
* Fill request headers with access token from cookies or fallback to provider's fallback function.
|
|
5238
5226
|
*/
|
|
5239
|
-
protected readonly onRequest:
|
|
5227
|
+
protected readonly onRequest: alepha1672.HookPrimitive<"server:onRequest">;
|
|
5240
5228
|
/**
|
|
5241
5229
|
* Convert cookies to tokens.
|
|
5242
5230
|
* If the tokens are expired, try to refresh them using the refresh token.
|
|
@@ -5246,27 +5234,27 @@ declare class ServerAuthProvider {
|
|
|
5246
5234
|
/**
|
|
5247
5235
|
* Get user information.
|
|
5248
5236
|
*/
|
|
5249
|
-
readonly userinfo:
|
|
5250
|
-
response:
|
|
5251
|
-
user:
|
|
5252
|
-
id:
|
|
5253
|
-
name:
|
|
5254
|
-
email:
|
|
5255
|
-
username:
|
|
5256
|
-
picture:
|
|
5257
|
-
sessionId:
|
|
5258
|
-
organizations:
|
|
5259
|
-
roles:
|
|
5237
|
+
readonly userinfo: RoutePrimitive<{
|
|
5238
|
+
response: alepha1672.TObject<{
|
|
5239
|
+
user: alepha1672.TOptional<alepha1672.TObject<{
|
|
5240
|
+
id: alepha1672.TString;
|
|
5241
|
+
name: alepha1672.TOptional<alepha1672.TString>;
|
|
5242
|
+
email: alepha1672.TOptional<alepha1672.TString>;
|
|
5243
|
+
username: alepha1672.TOptional<alepha1672.TString>;
|
|
5244
|
+
picture: alepha1672.TOptional<alepha1672.TString>;
|
|
5245
|
+
sessionId: alepha1672.TOptional<alepha1672.TString>;
|
|
5246
|
+
organizations: alepha1672.TOptional<alepha1672.TArray<alepha1672.TString>>;
|
|
5247
|
+
roles: alepha1672.TOptional<alepha1672.TArray<alepha1672.TString>>;
|
|
5260
5248
|
}>>;
|
|
5261
|
-
api:
|
|
5262
|
-
prefix:
|
|
5263
|
-
links:
|
|
5264
|
-
name:
|
|
5265
|
-
group:
|
|
5266
|
-
path:
|
|
5267
|
-
method:
|
|
5268
|
-
requestBodyType:
|
|
5269
|
-
service:
|
|
5249
|
+
api: alepha1672.TObject<{
|
|
5250
|
+
prefix: alepha1672.TOptional<alepha1672.TString>;
|
|
5251
|
+
links: alepha1672.TArray<alepha1672.TObject<{
|
|
5252
|
+
name: alepha1672.TString;
|
|
5253
|
+
group: alepha1672.TOptional<alepha1672.TString>;
|
|
5254
|
+
path: alepha1672.TString;
|
|
5255
|
+
method: alepha1672.TOptional<alepha1672.TString>;
|
|
5256
|
+
requestBodyType: alepha1672.TOptional<alepha1672.TString>;
|
|
5257
|
+
service: alepha1672.TOptional<alepha1672.TString>;
|
|
5270
5258
|
}>>;
|
|
5271
5259
|
}>;
|
|
5272
5260
|
}>;
|
|
@@ -5274,66 +5262,66 @@ declare class ServerAuthProvider {
|
|
|
5274
5262
|
/**
|
|
5275
5263
|
* Refresh a token for internal providers.
|
|
5276
5264
|
*/
|
|
5277
|
-
readonly refresh:
|
|
5278
|
-
query:
|
|
5279
|
-
provider:
|
|
5265
|
+
readonly refresh: RoutePrimitive<{
|
|
5266
|
+
query: alepha1672.TObject<{
|
|
5267
|
+
provider: alepha1672.TString;
|
|
5280
5268
|
}>;
|
|
5281
|
-
body:
|
|
5282
|
-
refresh_token:
|
|
5283
|
-
access_token:
|
|
5269
|
+
body: alepha1672.TObject<{
|
|
5270
|
+
refresh_token: alepha1672.TString;
|
|
5271
|
+
access_token: alepha1672.TOptional<alepha1672.TString>;
|
|
5284
5272
|
}>;
|
|
5285
|
-
response:
|
|
5286
|
-
provider:
|
|
5287
|
-
access_token:
|
|
5288
|
-
issued_at:
|
|
5289
|
-
expires_in:
|
|
5290
|
-
refresh_token:
|
|
5291
|
-
refresh_token_expires_in:
|
|
5292
|
-
refresh_expires_in:
|
|
5293
|
-
id_token:
|
|
5294
|
-
scope:
|
|
5273
|
+
response: alepha1672.TObject<{
|
|
5274
|
+
provider: alepha1672.TString;
|
|
5275
|
+
access_token: alepha1672.TString;
|
|
5276
|
+
issued_at: alepha1672.TNumber;
|
|
5277
|
+
expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5278
|
+
refresh_token: alepha1672.TOptional<alepha1672.TString>;
|
|
5279
|
+
refresh_token_expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5280
|
+
refresh_expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5281
|
+
id_token: alepha1672.TOptional<alepha1672.TString>;
|
|
5282
|
+
scope: alepha1672.TOptional<alepha1672.TString>;
|
|
5295
5283
|
}>;
|
|
5296
5284
|
}>;
|
|
5297
5285
|
/**
|
|
5298
5286
|
* Login for local password-based authentication.
|
|
5299
5287
|
*/
|
|
5300
|
-
readonly token:
|
|
5301
|
-
query:
|
|
5302
|
-
provider:
|
|
5288
|
+
readonly token: RoutePrimitive<{
|
|
5289
|
+
query: alepha1672.TObject<{
|
|
5290
|
+
provider: alepha1672.TString;
|
|
5303
5291
|
}>;
|
|
5304
|
-
body:
|
|
5305
|
-
username:
|
|
5306
|
-
password:
|
|
5292
|
+
body: alepha1672.TObject<{
|
|
5293
|
+
username: alepha1672.TString;
|
|
5294
|
+
password: alepha1672.TString;
|
|
5307
5295
|
}>;
|
|
5308
|
-
response:
|
|
5309
|
-
provider:
|
|
5310
|
-
access_token:
|
|
5311
|
-
issued_at:
|
|
5312
|
-
expires_in:
|
|
5313
|
-
refresh_token:
|
|
5314
|
-
refresh_token_expires_in:
|
|
5315
|
-
refresh_expires_in:
|
|
5316
|
-
id_token:
|
|
5317
|
-
scope:
|
|
5318
|
-
user:
|
|
5319
|
-
id:
|
|
5320
|
-
name:
|
|
5321
|
-
email:
|
|
5322
|
-
username:
|
|
5323
|
-
picture:
|
|
5324
|
-
sessionId:
|
|
5325
|
-
organizations:
|
|
5326
|
-
roles:
|
|
5296
|
+
response: alepha1672.TObject<{
|
|
5297
|
+
provider: alepha1672.TString;
|
|
5298
|
+
access_token: alepha1672.TString;
|
|
5299
|
+
issued_at: alepha1672.TNumber;
|
|
5300
|
+
expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5301
|
+
refresh_token: alepha1672.TOptional<alepha1672.TString>;
|
|
5302
|
+
refresh_token_expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5303
|
+
refresh_expires_in: alepha1672.TOptional<alepha1672.TNumber>;
|
|
5304
|
+
id_token: alepha1672.TOptional<alepha1672.TString>;
|
|
5305
|
+
scope: alepha1672.TOptional<alepha1672.TString>;
|
|
5306
|
+
user: alepha1672.TObject<{
|
|
5307
|
+
id: alepha1672.TString;
|
|
5308
|
+
name: alepha1672.TOptional<alepha1672.TString>;
|
|
5309
|
+
email: alepha1672.TOptional<alepha1672.TString>;
|
|
5310
|
+
username: alepha1672.TOptional<alepha1672.TString>;
|
|
5311
|
+
picture: alepha1672.TOptional<alepha1672.TString>;
|
|
5312
|
+
sessionId: alepha1672.TOptional<alepha1672.TString>;
|
|
5313
|
+
organizations: alepha1672.TOptional<alepha1672.TArray<alepha1672.TString>>;
|
|
5314
|
+
roles: alepha1672.TOptional<alepha1672.TArray<alepha1672.TString>>;
|
|
5327
5315
|
}>;
|
|
5328
|
-
api:
|
|
5329
|
-
prefix:
|
|
5330
|
-
links:
|
|
5331
|
-
name:
|
|
5332
|
-
group:
|
|
5333
|
-
path:
|
|
5334
|
-
method:
|
|
5335
|
-
requestBodyType:
|
|
5336
|
-
service:
|
|
5316
|
+
api: alepha1672.TObject<{
|
|
5317
|
+
prefix: alepha1672.TOptional<alepha1672.TString>;
|
|
5318
|
+
links: alepha1672.TArray<alepha1672.TObject<{
|
|
5319
|
+
name: alepha1672.TString;
|
|
5320
|
+
group: alepha1672.TOptional<alepha1672.TString>;
|
|
5321
|
+
path: alepha1672.TString;
|
|
5322
|
+
method: alepha1672.TOptional<alepha1672.TString>;
|
|
5323
|
+
requestBodyType: alepha1672.TOptional<alepha1672.TString>;
|
|
5324
|
+
service: alepha1672.TOptional<alepha1672.TString>;
|
|
5337
5325
|
}>>;
|
|
5338
5326
|
}>;
|
|
5339
5327
|
}>;
|
|
@@ -5341,28 +5329,28 @@ declare class ServerAuthProvider {
|
|
|
5341
5329
|
/**
|
|
5342
5330
|
* Oauth2/OIDC login route.
|
|
5343
5331
|
*/
|
|
5344
|
-
readonly login:
|
|
5345
|
-
query:
|
|
5346
|
-
provider:
|
|
5347
|
-
redirect_uri:
|
|
5332
|
+
readonly login: RoutePrimitive<{
|
|
5333
|
+
query: alepha1672.TObject<{
|
|
5334
|
+
provider: alepha1672.TString;
|
|
5335
|
+
redirect_uri: alepha1672.TOptional<alepha1672.TString>;
|
|
5348
5336
|
}>;
|
|
5349
5337
|
}>;
|
|
5350
5338
|
/**
|
|
5351
5339
|
* Callback for OAuth2/OIDC providers.
|
|
5352
5340
|
* It handles the authorization code flow and retrieves the access token.
|
|
5353
5341
|
*/
|
|
5354
|
-
readonly callback:
|
|
5342
|
+
readonly callback: RoutePrimitive<RequestConfigSchema>;
|
|
5355
5343
|
/**
|
|
5356
5344
|
* Logout route for OAuth2/OIDC providers.
|
|
5357
5345
|
*/
|
|
5358
|
-
readonly logout:
|
|
5359
|
-
query:
|
|
5360
|
-
post_logout_redirect_uri:
|
|
5346
|
+
readonly logout: RoutePrimitive<{
|
|
5347
|
+
query: alepha1672.TObject<{
|
|
5348
|
+
post_logout_redirect_uri: alepha1672.TOptional<alepha1672.TString>;
|
|
5361
5349
|
}>;
|
|
5362
5350
|
}>;
|
|
5363
5351
|
protected provider(opts: string | {
|
|
5364
5352
|
provider: string;
|
|
5365
|
-
}):
|
|
5353
|
+
}): AuthPrimitive;
|
|
5366
5354
|
protected setTokens(tokens: Tokens, cookies?: Cookies): void;
|
|
5367
5355
|
}
|
|
5368
5356
|
interface OAuth2Profile {
|
|
@@ -5396,8 +5384,8 @@ interface OAuth2Profile {
|
|
|
5396
5384
|
[key: string]: unknown;
|
|
5397
5385
|
}
|
|
5398
5386
|
//#endregion
|
|
5399
|
-
//#region ../alepha/src/server-auth/
|
|
5400
|
-
type
|
|
5387
|
+
//#region ../alepha/src/server-auth/primitives/$auth.d.ts
|
|
5388
|
+
type AuthPrimitiveOptions = {
|
|
5401
5389
|
/**
|
|
5402
5390
|
* Name of the identity provider.
|
|
5403
5391
|
* If not provided, it will be derived from the property key.
|
|
@@ -5438,7 +5426,7 @@ type AuthExternal = {
|
|
|
5438
5426
|
* This relies on the `realm`, which is used to create/verify the access token.
|
|
5439
5427
|
*/
|
|
5440
5428
|
type AuthInternal = {
|
|
5441
|
-
realm:
|
|
5429
|
+
realm: RealmPrimitive;
|
|
5442
5430
|
} & ({
|
|
5443
5431
|
/**
|
|
5444
5432
|
* The common username/password authentication.
|
|
@@ -5551,7 +5539,7 @@ interface OAuth2Options {
|
|
|
5551
5539
|
*/
|
|
5552
5540
|
scope?: string;
|
|
5553
5541
|
}
|
|
5554
|
-
declare class
|
|
5542
|
+
declare class AuthPrimitive extends Primitive<AuthPrimitiveOptions> {
|
|
5555
5543
|
protected readonly securityProvider: SecurityProvider;
|
|
5556
5544
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
5557
5545
|
oauth?: Configuration;
|
|
@@ -5615,53 +5603,53 @@ declare class UserRealmController {
|
|
|
5615
5603
|
* Get realm configuration settings.
|
|
5616
5604
|
* This endpoint is not exposed in the API documentation.
|
|
5617
5605
|
*/
|
|
5618
|
-
readonly getRealmConfig:
|
|
5619
|
-
query:
|
|
5620
|
-
userRealmName:
|
|
5606
|
+
readonly getRealmConfig: ActionPrimitiveFn<{
|
|
5607
|
+
query: alepha1672.TObject<{
|
|
5608
|
+
userRealmName: alepha1672.TOptional<alepha1672.TString>;
|
|
5621
5609
|
}>;
|
|
5622
|
-
response:
|
|
5623
|
-
settings:
|
|
5624
|
-
registrationAllowed:
|
|
5625
|
-
emailEnabled:
|
|
5626
|
-
emailRequired:
|
|
5627
|
-
usernameEnabled:
|
|
5628
|
-
usernameRequired:
|
|
5629
|
-
phoneEnabled:
|
|
5630
|
-
phoneRequired:
|
|
5631
|
-
verifyEmailRequired:
|
|
5632
|
-
verifyPhoneRequired:
|
|
5633
|
-
firstNameLastNameEnabled:
|
|
5634
|
-
firstNameLastNameRequired:
|
|
5635
|
-
resetPasswordAllowed:
|
|
5636
|
-
passwordPolicy:
|
|
5637
|
-
minLength:
|
|
5638
|
-
requireUppercase:
|
|
5639
|
-
requireLowercase:
|
|
5640
|
-
requireNumbers:
|
|
5641
|
-
requireSpecialCharacters:
|
|
5610
|
+
response: alepha1672.TObject<{
|
|
5611
|
+
settings: alepha1672.TObject<{
|
|
5612
|
+
registrationAllowed: alepha1672.TBoolean;
|
|
5613
|
+
emailEnabled: alepha1672.TBoolean;
|
|
5614
|
+
emailRequired: alepha1672.TBoolean;
|
|
5615
|
+
usernameEnabled: alepha1672.TBoolean;
|
|
5616
|
+
usernameRequired: alepha1672.TBoolean;
|
|
5617
|
+
phoneEnabled: alepha1672.TBoolean;
|
|
5618
|
+
phoneRequired: alepha1672.TBoolean;
|
|
5619
|
+
verifyEmailRequired: alepha1672.TBoolean;
|
|
5620
|
+
verifyPhoneRequired: alepha1672.TBoolean;
|
|
5621
|
+
firstNameLastNameEnabled: alepha1672.TBoolean;
|
|
5622
|
+
firstNameLastNameRequired: alepha1672.TBoolean;
|
|
5623
|
+
resetPasswordAllowed: alepha1672.TBoolean;
|
|
5624
|
+
passwordPolicy: alepha1672.TObject<{
|
|
5625
|
+
minLength: alepha1672.TInteger;
|
|
5626
|
+
requireUppercase: alepha1672.TBoolean;
|
|
5627
|
+
requireLowercase: alepha1672.TBoolean;
|
|
5628
|
+
requireNumbers: alepha1672.TBoolean;
|
|
5629
|
+
requireSpecialCharacters: alepha1672.TBoolean;
|
|
5642
5630
|
}>;
|
|
5643
5631
|
}>;
|
|
5644
|
-
realmName:
|
|
5645
|
-
authenticationMethods:
|
|
5646
|
-
name:
|
|
5647
|
-
type:
|
|
5632
|
+
realmName: alepha1672.TString;
|
|
5633
|
+
authenticationMethods: alepha1672.TArray<alepha1672.TObject<{
|
|
5634
|
+
name: alepha1672.TString;
|
|
5635
|
+
type: alepha1672.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
|
|
5648
5636
|
}>>;
|
|
5649
5637
|
}>;
|
|
5650
5638
|
}>;
|
|
5651
|
-
readonly checkUsernameAvailability:
|
|
5652
|
-
query:
|
|
5653
|
-
userRealmName:
|
|
5639
|
+
readonly checkUsernameAvailability: ActionPrimitiveFn<{
|
|
5640
|
+
query: alepha1672.TObject<{
|
|
5641
|
+
userRealmName: alepha1672.TOptional<alepha1672.TString>;
|
|
5654
5642
|
}>;
|
|
5655
|
-
body:
|
|
5656
|
-
username:
|
|
5643
|
+
body: alepha1672.TObject<{
|
|
5644
|
+
username: alepha1672.TString;
|
|
5657
5645
|
}>;
|
|
5658
|
-
response:
|
|
5659
|
-
available:
|
|
5646
|
+
response: alepha1672.TObject<{
|
|
5647
|
+
available: alepha1672.TBoolean;
|
|
5660
5648
|
}>;
|
|
5661
5649
|
}>;
|
|
5662
5650
|
}
|
|
5663
5651
|
//#endregion
|
|
5664
|
-
//#region ../alepha/src/api-users/
|
|
5652
|
+
//#region ../alepha/src/api-users/primitives/$userRealm.d.ts
|
|
5665
5653
|
interface UserRealmOptions {
|
|
5666
5654
|
/**
|
|
5667
5655
|
* Secret key for signing tokens.
|
|
@@ -5674,7 +5662,7 @@ interface UserRealmOptions {
|
|
|
5674
5662
|
*
|
|
5675
5663
|
* It's already pre-configured for user management with admin and user roles.
|
|
5676
5664
|
*/
|
|
5677
|
-
realm?: Partial<
|
|
5665
|
+
realm?: Partial<RealmPrimitiveOptions>;
|
|
5678
5666
|
/**
|
|
5679
5667
|
* Override entities.
|
|
5680
5668
|
*/
|
|
@@ -5692,32 +5680,32 @@ interface UserRealmOptions {
|
|
|
5692
5680
|
}
|
|
5693
5681
|
//#endregion
|
|
5694
5682
|
//#region ../alepha/src/api-users/schemas/userRealmConfigSchema.d.ts
|
|
5695
|
-
declare const userRealmConfigSchema:
|
|
5696
|
-
settings:
|
|
5697
|
-
registrationAllowed:
|
|
5698
|
-
emailEnabled:
|
|
5699
|
-
emailRequired:
|
|
5700
|
-
usernameEnabled:
|
|
5701
|
-
usernameRequired:
|
|
5702
|
-
phoneEnabled:
|
|
5703
|
-
phoneRequired:
|
|
5704
|
-
verifyEmailRequired:
|
|
5705
|
-
verifyPhoneRequired:
|
|
5706
|
-
firstNameLastNameEnabled:
|
|
5707
|
-
firstNameLastNameRequired:
|
|
5708
|
-
resetPasswordAllowed:
|
|
5709
|
-
passwordPolicy:
|
|
5710
|
-
minLength:
|
|
5711
|
-
requireUppercase:
|
|
5712
|
-
requireLowercase:
|
|
5713
|
-
requireNumbers:
|
|
5714
|
-
requireSpecialCharacters:
|
|
5683
|
+
declare const userRealmConfigSchema: alepha1672.TObject<{
|
|
5684
|
+
settings: alepha1672.TObject<{
|
|
5685
|
+
registrationAllowed: alepha1672.TBoolean;
|
|
5686
|
+
emailEnabled: alepha1672.TBoolean;
|
|
5687
|
+
emailRequired: alepha1672.TBoolean;
|
|
5688
|
+
usernameEnabled: alepha1672.TBoolean;
|
|
5689
|
+
usernameRequired: alepha1672.TBoolean;
|
|
5690
|
+
phoneEnabled: alepha1672.TBoolean;
|
|
5691
|
+
phoneRequired: alepha1672.TBoolean;
|
|
5692
|
+
verifyEmailRequired: alepha1672.TBoolean;
|
|
5693
|
+
verifyPhoneRequired: alepha1672.TBoolean;
|
|
5694
|
+
firstNameLastNameEnabled: alepha1672.TBoolean;
|
|
5695
|
+
firstNameLastNameRequired: alepha1672.TBoolean;
|
|
5696
|
+
resetPasswordAllowed: alepha1672.TBoolean;
|
|
5697
|
+
passwordPolicy: alepha1672.TObject<{
|
|
5698
|
+
minLength: alepha1672.TInteger;
|
|
5699
|
+
requireUppercase: alepha1672.TBoolean;
|
|
5700
|
+
requireLowercase: alepha1672.TBoolean;
|
|
5701
|
+
requireNumbers: alepha1672.TBoolean;
|
|
5702
|
+
requireSpecialCharacters: alepha1672.TBoolean;
|
|
5715
5703
|
}>;
|
|
5716
5704
|
}>;
|
|
5717
|
-
realmName:
|
|
5718
|
-
authenticationMethods:
|
|
5719
|
-
name:
|
|
5720
|
-
type:
|
|
5705
|
+
realmName: alepha1672.TString;
|
|
5706
|
+
authenticationMethods: alepha1672.TArray<alepha1672.TObject<{
|
|
5707
|
+
name: alepha1672.TString;
|
|
5708
|
+
type: alepha1672.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
|
|
5721
5709
|
}>>;
|
|
5722
5710
|
}>;
|
|
5723
5711
|
type UserRealmConfig = Static<typeof userRealmConfigSchema>;
|
|
@@ -5757,9 +5745,9 @@ declare module "alepha/bucket" {
|
|
|
5757
5745
|
//#region src/auth/AuthRouter.d.ts
|
|
5758
5746
|
declare class AuthRouter {
|
|
5759
5747
|
userRealmClient: HttpVirtualClient<UserRealmController>;
|
|
5760
|
-
login:
|
|
5761
|
-
query:
|
|
5762
|
-
redirect:
|
|
5748
|
+
login: PagePrimitive<{
|
|
5749
|
+
query: alepha1672.TObject<{
|
|
5750
|
+
redirect: alepha1672.TOptional<alepha1672.TString>;
|
|
5763
5751
|
}>;
|
|
5764
5752
|
}, {
|
|
5765
5753
|
realmConfig: {
|
|
@@ -5791,9 +5779,9 @@ declare class AuthRouter {
|
|
|
5791
5779
|
}[];
|
|
5792
5780
|
};
|
|
5793
5781
|
}, TPropsParentDefault>;
|
|
5794
|
-
register:
|
|
5795
|
-
query:
|
|
5796
|
-
redirect:
|
|
5782
|
+
register: PagePrimitive<{
|
|
5783
|
+
query: alepha1672.TObject<{
|
|
5784
|
+
redirect: alepha1672.TOptional<alepha1672.TString>;
|
|
5797
5785
|
}>;
|
|
5798
5786
|
}, {
|
|
5799
5787
|
realmConfig: {
|
|
@@ -5825,9 +5813,9 @@ declare class AuthRouter {
|
|
|
5825
5813
|
}[];
|
|
5826
5814
|
};
|
|
5827
5815
|
}, TPropsParentDefault>;
|
|
5828
|
-
resetPassword:
|
|
5829
|
-
query:
|
|
5830
|
-
redirect:
|
|
5816
|
+
resetPassword: PagePrimitive<{
|
|
5817
|
+
query: alepha1672.TObject<{
|
|
5818
|
+
redirect: alepha1672.TOptional<alepha1672.TString>;
|
|
5831
5819
|
}>;
|
|
5832
5820
|
}, {
|
|
5833
5821
|
realmConfig: {
|
|
@@ -5861,364 +5849,6 @@ declare class AuthRouter {
|
|
|
5861
5849
|
}, TPropsParentDefault>;
|
|
5862
5850
|
}
|
|
5863
5851
|
//#endregion
|
|
5864
|
-
//#region ../react/src/form/services/FormModel.d.ts
|
|
5865
|
-
/**
|
|
5866
|
-
* FormModel is a dynamic form handler that generates form inputs based on a provided TypeBox schema.
|
|
5867
|
-
* It manages form state, handles input changes, and processes form submissions with validation.
|
|
5868
|
-
*
|
|
5869
|
-
* It means to be injected and used within React components to provide a structured way to create and manage forms.
|
|
5870
|
-
*
|
|
5871
|
-
* @see {@link useForm}
|
|
5872
|
-
*/
|
|
5873
|
-
declare class FormModel<T$1 extends TObject> {
|
|
5874
|
-
readonly id: string;
|
|
5875
|
-
readonly options: FormCtrlOptions<T$1>;
|
|
5876
|
-
protected readonly log: Logger;
|
|
5877
|
-
protected readonly alepha: Alepha;
|
|
5878
|
-
protected readonly values: Record<string, any>;
|
|
5879
|
-
protected submitInProgress: boolean;
|
|
5880
|
-
input: SchemaToInput<T$1>;
|
|
5881
|
-
get submitting(): boolean;
|
|
5882
|
-
constructor(id: string, options: FormCtrlOptions<T$1>);
|
|
5883
|
-
get element(): HTMLFormElement;
|
|
5884
|
-
get currentValues(): Record<string, any>;
|
|
5885
|
-
get props(): {
|
|
5886
|
-
id: string;
|
|
5887
|
-
noValidate: boolean;
|
|
5888
|
-
onSubmit: (ev?: FormEventLike) => void;
|
|
5889
|
-
onReset: (event: FormEventLike) => Promise<void>;
|
|
5890
|
-
};
|
|
5891
|
-
readonly reset: (event: FormEventLike) => Promise<void>;
|
|
5892
|
-
readonly submit: () => Promise<void>;
|
|
5893
|
-
/**
|
|
5894
|
-
* Restructures flat keys like "address.city" into nested objects like { address: { city: ... } }
|
|
5895
|
-
* Values are already typed from onChange, so no conversion is needed.
|
|
5896
|
-
*/
|
|
5897
|
-
protected restructureValues(store: Record<string, any>): Record<string, any>;
|
|
5898
|
-
/**
|
|
5899
|
-
* Helper to restructure a flat key like "address.city" into nested object structure.
|
|
5900
|
-
* The value is already typed, so we just assign it to the nested path.
|
|
5901
|
-
*/
|
|
5902
|
-
protected restructureNestedValue(values: Record<string, any>, key: string, value: any): void;
|
|
5903
|
-
protected createProxyFromSchema<T$1 extends TObject>(options: FormCtrlOptions<T$1>, schema: TSchema, context: {
|
|
5904
|
-
parent: string;
|
|
5905
|
-
store: Record<string, any>;
|
|
5906
|
-
}): SchemaToInput<T$1>;
|
|
5907
|
-
protected createInputFromSchema<T$1 extends TObject>(name: keyof Static<T$1> & string, options: FormCtrlOptions<T$1>, schema: TObject, required: boolean, context: {
|
|
5908
|
-
parent: string;
|
|
5909
|
-
store: Record<string, any>;
|
|
5910
|
-
}): InputField;
|
|
5911
|
-
/**
|
|
5912
|
-
* Convert an input value to the correct type based on the schema.
|
|
5913
|
-
* Handles raw DOM values (strings, booleans from checkboxes, Files, etc.)
|
|
5914
|
-
*/
|
|
5915
|
-
protected getValueFromInput(input: any, schema: TSchema): any;
|
|
5916
|
-
protected valueToInputEntry(value: any): string | number | boolean;
|
|
5917
|
-
}
|
|
5918
|
-
type SchemaToInput<T$1 extends TObject> = { [K in keyof T$1["properties"]]: T$1["properties"][K] extends TObject ? SchemaToInput<T$1["properties"][K]> : InputField };
|
|
5919
|
-
interface FormEventLike {
|
|
5920
|
-
preventDefault?: () => void;
|
|
5921
|
-
stopPropagation?: () => void;
|
|
5922
|
-
}
|
|
5923
|
-
interface InputField {
|
|
5924
|
-
path: string;
|
|
5925
|
-
required: boolean;
|
|
5926
|
-
props: InputHTMLAttributesLike;
|
|
5927
|
-
schema: TSchema;
|
|
5928
|
-
set: (value: any) => void;
|
|
5929
|
-
form: FormModel<any>;
|
|
5930
|
-
}
|
|
5931
|
-
type InputHTMLAttributesLike = Pick<InputHTMLAttributes<unknown>, "id" | "name" | "type" | "value" | "defaultValue" | "required" | "maxLength" | "minLength" | "aria-label" | "autoComplete"> & {
|
|
5932
|
-
value?: any;
|
|
5933
|
-
defaultValue?: any;
|
|
5934
|
-
onChange?: (event: any) => void;
|
|
5935
|
-
};
|
|
5936
|
-
type FormCtrlOptions<T$1 extends TObject> = {
|
|
5937
|
-
/**
|
|
5938
|
-
* The schema defining the structure and validation rules for the form.
|
|
5939
|
-
* This should be a TypeBox schema object.
|
|
5940
|
-
*/
|
|
5941
|
-
schema: T$1;
|
|
5942
|
-
/**
|
|
5943
|
-
* Callback function to handle form submission.
|
|
5944
|
-
* This function will receive the parsed and validated form values.
|
|
5945
|
-
*/
|
|
5946
|
-
handler: (values: Static<T$1>, args: {
|
|
5947
|
-
form: HTMLFormElement;
|
|
5948
|
-
}) => unknown;
|
|
5949
|
-
/**
|
|
5950
|
-
* Optional initial values for the form fields.
|
|
5951
|
-
* This can be used to pre-populate the form with existing data.
|
|
5952
|
-
*/
|
|
5953
|
-
initialValues?: Partial<Static<T$1>>;
|
|
5954
|
-
/**
|
|
5955
|
-
* Optional function to create custom field attributes.
|
|
5956
|
-
* This can be used to add custom validation, styles, or other attributes.
|
|
5957
|
-
*/
|
|
5958
|
-
onCreateField?: (name: keyof Static<T$1> & string, schema: TSchema) => InputHTMLAttributes<unknown>;
|
|
5959
|
-
/**
|
|
5960
|
-
* If defined, this will generate a unique ID for each field, prefixed with this string.
|
|
5961
|
-
*
|
|
5962
|
-
* > "username" with id="form-123" will become "form-123-username".
|
|
5963
|
-
*
|
|
5964
|
-
* If omitted, IDs will not be generated.
|
|
5965
|
-
*/
|
|
5966
|
-
id?: string;
|
|
5967
|
-
onError?: (error: Error, args: {
|
|
5968
|
-
form: HTMLFormElement;
|
|
5969
|
-
}) => void;
|
|
5970
|
-
onChange?: (key: string, value: any, store: Record<string, any>) => void;
|
|
5971
|
-
onReset?: () => void;
|
|
5972
|
-
};
|
|
5973
|
-
//#endregion
|
|
5974
|
-
//#region ../react/src/form/index.d.ts
|
|
5975
|
-
declare module "alepha" {
|
|
5976
|
-
interface Hooks {
|
|
5977
|
-
"form:change": {
|
|
5978
|
-
id: string;
|
|
5979
|
-
path: string;
|
|
5980
|
-
value: any;
|
|
5981
|
-
};
|
|
5982
|
-
"form:reset": {
|
|
5983
|
-
id: string;
|
|
5984
|
-
values: Record<string, any>;
|
|
5985
|
-
};
|
|
5986
|
-
"form:submit:begin": {
|
|
5987
|
-
id: string;
|
|
5988
|
-
};
|
|
5989
|
-
"form:submit:success": {
|
|
5990
|
-
id: string;
|
|
5991
|
-
values: Record<string, any>;
|
|
5992
|
-
};
|
|
5993
|
-
"form:submit:error": {
|
|
5994
|
-
id: string;
|
|
5995
|
-
error: Error;
|
|
5996
|
-
};
|
|
5997
|
-
"form:submit:end": {
|
|
5998
|
-
id: string;
|
|
5999
|
-
};
|
|
6000
|
-
}
|
|
6001
|
-
}
|
|
6002
|
-
/**
|
|
6003
|
-
* React hooks for managing forms in Alepha applications.
|
|
6004
|
-
*
|
|
6005
|
-
* This module provides a set of hooks to simplify form handling, validation, and submission in React applications built with Alepha.
|
|
6006
|
-
*
|
|
6007
|
-
* It includes:
|
|
6008
|
-
* - `useForm`: A hook for managing form state, validation, and submission.
|
|
6009
|
-
*
|
|
6010
|
-
* @see {@link useForm}
|
|
6011
|
-
* @module alepha.react.form
|
|
6012
|
-
*/
|
|
6013
|
-
//#endregion
|
|
6014
|
-
//#region src/core/utils/parseInput.d.ts
|
|
6015
|
-
interface GenericControlProps {
|
|
6016
|
-
input: InputField;
|
|
6017
|
-
title?: string;
|
|
6018
|
-
description?: string;
|
|
6019
|
-
icon?: ReactElement | ((props: {
|
|
6020
|
-
size: number;
|
|
6021
|
-
}) => ReactNode);
|
|
6022
|
-
}
|
|
6023
|
-
//#endregion
|
|
6024
|
-
//#region src/core/components/form/ControlNumber.d.ts
|
|
6025
|
-
interface ControlNumberProps extends GenericControlProps {
|
|
6026
|
-
numberInputProps?: Partial<NumberInputProps>;
|
|
6027
|
-
sliderProps?: Partial<SliderProps>;
|
|
6028
|
-
}
|
|
6029
|
-
//#endregion
|
|
6030
|
-
//#region src/core/components/form/ControlSelect.d.ts
|
|
6031
|
-
type SelectValueLabel = string | {
|
|
6032
|
-
value: string;
|
|
6033
|
-
label: string;
|
|
6034
|
-
icon?: string;
|
|
6035
|
-
};
|
|
6036
|
-
interface ControlSelectProps extends GenericControlProps {
|
|
6037
|
-
select?: boolean | SelectProps;
|
|
6038
|
-
multi?: boolean | MultiSelectProps;
|
|
6039
|
-
tags?: boolean | TagsInputProps;
|
|
6040
|
-
autocomplete?: boolean | AutocompleteProps;
|
|
6041
|
-
segmented?: boolean | Partial<SegmentedControlProps>;
|
|
6042
|
-
loader?: () => Promise<SelectValueLabel[]>;
|
|
6043
|
-
}
|
|
6044
|
-
//#endregion
|
|
6045
|
-
//#region src/core/components/form/Control.d.ts
|
|
6046
|
-
interface ControlProps extends GenericControlProps {
|
|
6047
|
-
text?: TextInputProps;
|
|
6048
|
-
area?: boolean | TextareaProps;
|
|
6049
|
-
select?: boolean | Partial<ControlSelectProps>;
|
|
6050
|
-
password?: boolean | PasswordInputProps;
|
|
6051
|
-
switch?: boolean | SwitchProps;
|
|
6052
|
-
number?: boolean | Partial<ControlNumberProps>;
|
|
6053
|
-
file?: boolean | FileInputProps;
|
|
6054
|
-
color?: boolean | ColorInputProps;
|
|
6055
|
-
date?: boolean | DateInputProps;
|
|
6056
|
-
datetime?: boolean | DateTimePickerProps;
|
|
6057
|
-
time?: boolean | TimeInputProps;
|
|
6058
|
-
query?: any;
|
|
6059
|
-
custom?: ComponentType<CustomControlProps>;
|
|
6060
|
-
}
|
|
6061
|
-
type CustomControlProps = {
|
|
6062
|
-
defaultValue: any;
|
|
6063
|
-
onChange: (value: any) => void;
|
|
6064
|
-
};
|
|
6065
|
-
//#endregion
|
|
6066
|
-
//#region src/core/components/buttons/ActionButton.d.ts
|
|
6067
|
-
interface ActionMenuItem {
|
|
6068
|
-
/**
|
|
6069
|
-
* Menu item type
|
|
6070
|
-
*/
|
|
6071
|
-
type?: "item" | "divider" | "label";
|
|
6072
|
-
/**
|
|
6073
|
-
* Label text for the menu item
|
|
6074
|
-
*/
|
|
6075
|
-
label?: string | ReactNode;
|
|
6076
|
-
/**
|
|
6077
|
-
* Icon element to display before the label
|
|
6078
|
-
*/
|
|
6079
|
-
icon?: ReactNode;
|
|
6080
|
-
/**
|
|
6081
|
-
* Click handler for menu items
|
|
6082
|
-
*/
|
|
6083
|
-
onClick?: () => void;
|
|
6084
|
-
/**
|
|
6085
|
-
* Href for navigation menu items
|
|
6086
|
-
*/
|
|
6087
|
-
href?: string;
|
|
6088
|
-
/**
|
|
6089
|
-
* Color for the menu item (e.g., "red" for danger actions)
|
|
6090
|
-
*/
|
|
6091
|
-
color?: string;
|
|
6092
|
-
/**
|
|
6093
|
-
* Nested submenu items
|
|
6094
|
-
*/
|
|
6095
|
-
children?: ActionMenuItem[];
|
|
6096
|
-
/**
|
|
6097
|
-
* Whether the menu item is active
|
|
6098
|
-
*/
|
|
6099
|
-
active?: boolean;
|
|
6100
|
-
}
|
|
6101
|
-
interface ActionMenuConfig {
|
|
6102
|
-
/**
|
|
6103
|
-
* Array of menu items to display
|
|
6104
|
-
*/
|
|
6105
|
-
items: ActionMenuItem[];
|
|
6106
|
-
/**
|
|
6107
|
-
* Menu position relative to the button
|
|
6108
|
-
*/
|
|
6109
|
-
position?: "bottom" | "bottom-start" | "bottom-end" | "top" | "top-start" | "top-end" | "left" | "right";
|
|
6110
|
-
/**
|
|
6111
|
-
* Menu width
|
|
6112
|
-
*/
|
|
6113
|
-
width?: number | string;
|
|
6114
|
-
/**
|
|
6115
|
-
* Menu shadow
|
|
6116
|
-
*/
|
|
6117
|
-
shadow?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
6118
|
-
on?: "hover" | "click";
|
|
6119
|
-
targetProps?: MenuTargetProps;
|
|
6120
|
-
menuProps?: MenuProps;
|
|
6121
|
-
}
|
|
6122
|
-
interface ActionCommonProps extends ButtonProps {
|
|
6123
|
-
children?: ReactNode;
|
|
6124
|
-
textVisibleFrom?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
6125
|
-
/**
|
|
6126
|
-
* Tooltip to display on hover. Can be a string for simple tooltips
|
|
6127
|
-
* or a TooltipProps object for advanced configuration.
|
|
6128
|
-
*/
|
|
6129
|
-
tooltip?: string | TooltipProps;
|
|
6130
|
-
/**
|
|
6131
|
-
* Menu configuration. When provided, the action will display a dropdown menu.
|
|
6132
|
-
*/
|
|
6133
|
-
menu?: ActionMenuConfig;
|
|
6134
|
-
/**
|
|
6135
|
-
* If set, a confirmation dialog will be shown before performing the action.
|
|
6136
|
-
* If `true`, a default title and message will be used.
|
|
6137
|
-
* If a string, it will be used as the message with a default title.
|
|
6138
|
-
* If an object, it can contain `title` and `message` properties to customize the dialog.
|
|
6139
|
-
*/
|
|
6140
|
-
confirm?: boolean | string | {
|
|
6141
|
-
title?: string;
|
|
6142
|
-
message: string;
|
|
6143
|
-
};
|
|
6144
|
-
/**
|
|
6145
|
-
* Icon to display on the left side of the button.
|
|
6146
|
-
* If no children are provided, the button will be styled as an icon-only button.
|
|
6147
|
-
*/
|
|
6148
|
-
icon?: ReactNode | ComponentType;
|
|
6149
|
-
/**
|
|
6150
|
-
* Additional props to pass to the ThemeIcon wrapping the icon.
|
|
6151
|
-
*/
|
|
6152
|
-
themeIconProps?: ThemeIconProps;
|
|
6153
|
-
}
|
|
6154
|
-
type ActionProps = ActionCommonProps & (ActionNavigationButtonProps | ActionClickButtonProps | ActionSubmitButtonProps | ActionHookButtonProps | {});
|
|
6155
|
-
interface ActionSubmitButtonProps extends ButtonProps {
|
|
6156
|
-
form: FormModel<any>;
|
|
6157
|
-
type?: "submit" | "reset";
|
|
6158
|
-
}
|
|
6159
|
-
interface ActionHookButtonProps extends ButtonProps {
|
|
6160
|
-
action: UseActionReturn<any[], any>;
|
|
6161
|
-
}
|
|
6162
|
-
interface ActionClickButtonProps extends ButtonProps {
|
|
6163
|
-
onClick: (e: any) => any;
|
|
6164
|
-
}
|
|
6165
|
-
interface ActionNavigationButtonProps extends ButtonProps {
|
|
6166
|
-
href: string;
|
|
6167
|
-
active?: Partial<UseActiveOptions> | false;
|
|
6168
|
-
routerGoOptions?: RouterGoOptions;
|
|
6169
|
-
classNameActive?: string;
|
|
6170
|
-
variantActive?: ButtonProps["variant"];
|
|
6171
|
-
target?: string;
|
|
6172
|
-
anchorProps?: AnchorProps;
|
|
6173
|
-
}
|
|
6174
|
-
//#endregion
|
|
6175
|
-
//#region src/core/components/layout/AdminShell.d.ts
|
|
6176
|
-
declare module "alepha" {
|
|
6177
|
-
interface State {
|
|
6178
|
-
/**
|
|
6179
|
-
* Whether the sidebar is opened or closed.
|
|
6180
|
-
*/
|
|
6181
|
-
"alepha.ui.sidebar.opened"?: boolean;
|
|
6182
|
-
/**
|
|
6183
|
-
* Whether the sidebar is collapsed (narrow) or expanded (wide).
|
|
6184
|
-
*/
|
|
6185
|
-
"alepha.ui.sidebar.collapsed"?: boolean;
|
|
6186
|
-
}
|
|
6187
|
-
}
|
|
6188
|
-
//#endregion
|
|
6189
|
-
//#region src/core/index.d.ts
|
|
6190
|
-
declare module "typebox" {
|
|
6191
|
-
interface TSchemaOptions {
|
|
6192
|
-
$control?: Omit<ControlProps, "input">;
|
|
6193
|
-
}
|
|
6194
|
-
}
|
|
6195
|
-
declare module "@alepha/react" {
|
|
6196
|
-
interface PageDescriptorOptions {
|
|
6197
|
-
/**
|
|
6198
|
-
* Human-readable title for the page.
|
|
6199
|
-
* - for Sidebar navigation
|
|
6200
|
-
* - for Omnibar navigation
|
|
6201
|
-
* (soon)
|
|
6202
|
-
* - for Breadcrumbs
|
|
6203
|
-
* - for document title (with AlephaReactHead)
|
|
6204
|
-
*/
|
|
6205
|
-
label?: string;
|
|
6206
|
-
/**
|
|
6207
|
-
* Optional description of the page.
|
|
6208
|
-
*/
|
|
6209
|
-
description?: string;
|
|
6210
|
-
/**
|
|
6211
|
-
* Optional icon for the page.
|
|
6212
|
-
*/
|
|
6213
|
-
icon?: ReactNode;
|
|
6214
|
-
}
|
|
6215
|
-
}
|
|
6216
|
-
/**
|
|
6217
|
-
* Mantine
|
|
6218
|
-
*
|
|
6219
|
-
* @module alepha.ui
|
|
6220
|
-
*/
|
|
6221
|
-
//#endregion
|
|
6222
5852
|
//#region src/auth/components/buttons/UserButton.d.ts
|
|
6223
5853
|
interface UserButtonProps extends Omit<ActionProps, "menu" | "icon" | "onClick"> {
|
|
6224
5854
|
/**
|
|
@@ -6268,7 +5898,7 @@ declare const ResetPassword: (props: ResetPasswordProps) => react_jsx_runtime0.J
|
|
|
6268
5898
|
*
|
|
6269
5899
|
* @module alepha.ui.auth
|
|
6270
5900
|
*/
|
|
6271
|
-
declare const AlephaUIAuth:
|
|
5901
|
+
declare const AlephaUIAuth: alepha1672.Service<alepha1672.Module>;
|
|
6272
5902
|
//#endregion
|
|
6273
5903
|
export { AlephaUIAuth, AuthRouter, Login, Register, ResetPassword, UserButton, type UserButtonProps };
|
|
6274
5904
|
//# sourceMappingURL=index.d.ts.map
|