@alepha/ui 0.13.1 → 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.
@@ -1,8 +1,11 @@
1
1
  import { ActionMenuConfig, ActionMenuItem, ActionProps } from "@alepha/ui";
2
- import * as alepha1246 from "alepha";
3
- import { Alepha, AlephaError, Async, Descriptor, DescriptorArgs, FileLike, InstantiableClass, LogLevel, LoggerInterface, Page, PageQuery, Service, Static, StaticEncode, StreamLike, TArray, TFile, TNull, TObject, TOptional, TRecord, TSchema, TStream, TString, TUnion, TVoid } from "alepha";
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";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
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";
6
9
  import "dayjs/plugin/relativeTime.js";
7
10
  import dayjsDuration from "dayjs/plugin/duration.js";
8
11
  import "dayjs/plugin/utc.js";
@@ -13,9 +16,6 @@ import "dayjs/locale/fr.js";
13
16
  import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
14
17
  import { CryptoKey, FlattenedJWSInput, JSONWebKeySet, JWSHeaderParameters, JWTHeaderParameters, JWTPayload, JWTVerifyResult, KeyObject } from "jose";
15
18
  import { JWTVerifyOptions } from "jose/jwt/verify";
16
- import { IncomingMessage, Server, ServerResponse } from "node:http";
17
- import { Readable } from "node:stream";
18
- import { ReadableStream } from "node:stream/web";
19
19
  import * as drizzle_orm0 from "drizzle-orm";
20
20
  import { BuildExtraConfigColumns, SQL, SQLWrapper } from "drizzle-orm";
21
21
  import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
@@ -25,28 +25,275 @@ import * as DrizzleKit from "drizzle-kit/api";
25
25
  import { Configuration } from "openid-client";
26
26
 
27
27
  //#region ../alepha/src/security/schemas/userAccountInfoSchema.d.ts
28
- declare const userAccountInfoSchema: alepha1246.TObject<{
29
- id: alepha1246.TString;
30
- name: alepha1246.TOptional<alepha1246.TString>;
31
- email: alepha1246.TOptional<alepha1246.TString>;
32
- username: alepha1246.TOptional<alepha1246.TString>;
33
- picture: alepha1246.TOptional<alepha1246.TString>;
34
- sessionId: alepha1246.TOptional<alepha1246.TString>;
35
- organizations: alepha1246.TOptional<alepha1246.TArray<alepha1246.TString>>;
36
- roles: alepha1246.TOptional<alepha1246.TArray<alepha1246.TString>>;
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>>;
37
37
  }>;
38
38
  type UserAccount = Static<typeof userAccountInfoSchema>;
39
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
40
287
  //#region ../alepha/src/logger/schemas/logEntrySchema.d.ts
41
- declare const logEntrySchema: alepha1246.TObject<{
42
- level: alepha1246.TUnsafe<"TRACE" | "SILENT" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
43
- message: alepha1246.TString;
44
- service: alepha1246.TString;
45
- module: alepha1246.TString;
46
- context: alepha1246.TOptional<alepha1246.TString>;
47
- app: alepha1246.TOptional<alepha1246.TString>;
48
- data: alepha1246.TOptional<alepha1246.TAny>;
49
- timestamp: alepha1246.TNumber;
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;
50
297
  }>;
51
298
  type LogEntry = Static<typeof logEntrySchema>;
52
299
  //#endregion
@@ -61,8 +308,8 @@ declare class DateTimeProvider {
61
308
  protected readonly timeouts: Timeout[];
62
309
  protected readonly intervals: Interval[];
63
310
  constructor();
64
- protected readonly onStart: alepha1246.HookDescriptor<"start">;
65
- protected readonly onStop: alepha1246.HookDescriptor<"stop">;
311
+ protected readonly onStart: alepha1672.HookPrimitive<"start">;
312
+ protected readonly onStop: alepha1672.HookPrimitive<"stop">;
66
313
  setLocale(locale: string): void;
67
314
  isDateTime(value: unknown): value is DateTime;
68
315
  /**
@@ -194,7 +441,7 @@ declare class Logger implements LoggerInterface {
194
441
  }
195
442
  //#endregion
196
443
  //#region ../alepha/src/logger/index.d.ts
197
- declare const envSchema$9: alepha1246.TObject<{
444
+ declare const envSchema$9: alepha1672.TObject<{
198
445
  /**
199
446
  * Default log level for the application.
200
447
  *
@@ -211,14 +458,14 @@ declare const envSchema$9: alepha1246.TObject<{
211
458
  * LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
212
459
  * LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
213
460
  */
214
- LOG_LEVEL: alepha1246.TOptional<alepha1246.TString>;
461
+ LOG_LEVEL: alepha1672.TOptional<alepha1672.TString>;
215
462
  /**
216
463
  * Built-in log formats.
217
464
  * - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
218
465
  * - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
219
466
  * - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
220
467
  */
221
- LOG_FORMAT: alepha1246.TOptional<alepha1246.TUnsafe<"json" | "pretty" | "raw">>;
468
+ LOG_FORMAT: alepha1672.TOptional<alepha1672.TUnsafe<"json" | "pretty" | "raw">>;
222
469
  }>;
223
470
  declare module "alepha" {
224
471
  interface Env extends Partial<Static<typeof envSchema$9>> {}
@@ -236,1142 +483,895 @@ declare module "alepha" {
236
483
  }
237
484
  }
238
485
  //#endregion
239
- //#region ../alepha/src/security/interfaces/UserAccountToken.d.ts
240
- /**
241
- * Add contextual metadata to a user account info.
242
- * E.g. UserAccountToken is a UserAccountInfo during a request.
243
- */
244
- interface UserAccountToken extends UserAccount {
245
- /**
246
- * Access token for the user.
247
- */
248
- token?: string;
249
- /**
250
- * Realm name of the user.
251
- */
252
- realm?: string;
253
- /**
254
- * Is user dedicated to his own resources for this scope ?
255
- * Mostly, Admin is false and Customer is true.
256
- */
257
- 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;
258
494
  }
259
495
  //#endregion
260
- //#region ../alepha/src/security/schemas/permissionSchema.d.ts
261
- declare const permissionSchema: alepha1246.TObject<{
262
- name: alepha1246.TString;
263
- group: alepha1246.TOptional<alepha1246.TString>;
264
- description: alepha1246.TOptional<alepha1246.TString>;
265
- method: alepha1246.TOptional<alepha1246.TString>;
266
- path: alepha1246.TOptional<alepha1246.TString>;
267
- }>;
268
- type Permission = Static<typeof permissionSchema>;
269
- //#endregion
270
- //#region ../alepha/src/security/schemas/roleSchema.d.ts
271
- declare const roleSchema: alepha1246.TObject<{
272
- name: alepha1246.TString;
273
- description: alepha1246.TOptional<alepha1246.TString>;
274
- default: alepha1246.TOptional<alepha1246.TBoolean>;
275
- permissions: alepha1246.TArray<alepha1246.TObject<{
276
- name: alepha1246.TString;
277
- ownership: alepha1246.TOptional<alepha1246.TBoolean>;
278
- exclude: alepha1246.TOptional<alepha1246.TArray<alepha1246.TString>>;
279
- }>>;
280
- }>;
281
- 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
+ }
282
512
  //#endregion
283
- //#region ../alepha/src/security/providers/JwtProvider.d.ts
513
+ //#region ../alepha/src/server/providers/ServerRouterProvider.d.ts
284
514
  /**
285
- * Provides utilities for working with JSON Web Tokens (JWT).
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)
286
520
  */
287
- declare class JwtProvider {
521
+ declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
288
522
  protected readonly log: Logger;
289
- protected readonly keystore: KeyLoaderHolder[];
290
- protected readonly dateTimeProvider: DateTimeProvider;
291
- protected readonly encoder: TextEncoder;
292
- /**
293
- * Adds a key loader to the embedded keystore.
294
- *
295
- * @param name
296
- * @param secretKeyOrJwks
297
- */
298
- setKeyLoader(name: string, secretKeyOrJwks: string | JSONWebKeySet): void;
299
- /**
300
- * Retrieves the payload from a JSON Web Token (JWT).
301
- *
302
- * @param token - The JWT to extract the payload from.
303
- *
304
- * @return A Promise that resolves with the payload object from the token.
305
- */
306
- parse(token: string, keyName?: string, options?: JWTVerifyOptions): Promise<JwtParseResult>;
307
- /**
308
- * Creates a JWT token with the provided payload and secret key.
309
- *
310
- * @param payload - The payload to be encoded in the token.
311
- * It should include the `realm_access` property which contains an array of roles.
312
- * @param keyName - The name of the key to use when signing the token.
313
- *
314
- * @returns The signed JWT token.
315
- */
316
- 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;
317
527
  /**
318
- * Determines if the provided key is a secret key.
528
+ * Get all registered routes, optionally filtered by a pattern.
319
529
  *
320
- * @param key
321
- * @protected
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.
322
532
  */
323
- protected isSecretKey(key: string): boolean;
324
- }
325
- type KeyLoader = (protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput) => Promise<CryptoKey | KeyObject>;
326
- interface KeyLoaderHolder {
327
- name: string;
328
- keyLoader: KeyLoader;
329
- secretKey?: string;
330
- }
331
- interface JwtSignOptions {
332
- header?: Partial<JWTHeaderParameters>;
333
- }
334
- interface ExtendedJWTPayload extends JWTPayload {
335
- sid?: string;
336
- name?: string;
337
- roles?: string[];
338
- email?: string;
339
- organizations?: string[];
340
- realm_access?: {
341
- roles: string[];
342
- };
343
- }
344
- interface JwtParseResult {
345
- keyName: string;
346
- 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;
347
550
  }
348
551
  //#endregion
349
- //#region ../alepha/src/security/providers/SecurityProvider.d.ts
350
- declare const envSchema$8: alepha1246.TObject<{
351
- APP_SECRET: alepha1246.TString;
352
- }>;
353
- declare module "alepha" {
354
- interface Env extends Partial<Static<typeof envSchema$8>> {}
355
- }
356
- declare class SecurityProvider {
357
- protected readonly UNKNOWN_USER_NAME = "Anonymous User";
358
- protected readonly PERMISSION_REGEXP: RegExp;
359
- 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 {
360
561
  protected readonly log: Logger;
361
- protected readonly jwt: JwtProvider;
362
- protected readonly env: {
363
- APP_SECRET: string;
364
- };
365
562
  protected readonly alepha: Alepha;
366
- get secretKey(): string;
563
+ protected readonly dateTimeProvider: DateTimeProvider;
564
+ protected readonly router: ServerRouterProvider;
565
+ protected readonly internalServerErrorMessage = "Internal Server Error";
566
+ get hostname(): string;
367
567
  /**
368
- * The permissions configured for the security provider.
568
+ * When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
369
569
  */
370
- protected readonly permissions: Permission[];
570
+ protected readonly onNodeRequest: alepha1672.HookPrimitive<"node:request">;
371
571
  /**
372
- * The realms configured for the security provider.
572
+ * When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
373
573
  */
374
- protected readonly realms: Realm[];
375
- protected start: alepha1246.HookDescriptor<"start">;
574
+ protected readonly onWebRequest: alepha1672.HookPrimitive<"web:request">;
376
575
  /**
377
- * Adds a role to one or more realms.
576
+ * Handle Node.js HTTP request event.
378
577
  *
379
- * @param role
380
- * @param realms
578
+ * Technically, we just convert Node.js request to Web Standard Request.
381
579
  */
382
- createRole(role: Role, ...realms: string[]): Role;
580
+ handleNodeRequest(nodeRequestEvent: NodeRequestEvent): Promise<void>;
383
581
  /**
384
- * Adds a permission to the security provider.
385
- *
386
- * @param raw - The permission to add.
582
+ * Handle Web (Fetch API) request event.
387
583
  */
388
- createPermission(raw: Permission | string): Permission;
389
- createRealm(realm: Realm): void;
584
+ handleWebRequest(ev: WebRequestEvent): Promise<void>;
390
585
  /**
391
- * Updates the roles for a realm then synchronizes the user account provider if available.
392
- *
393
- * Only available when the app is started.
394
- *
395
- * @param realm - The realm to update the roles for.
396
- * @param roles - The roles to update.
586
+ * Helper for Vite development mode to let Vite handle (or not) 404.
397
587
  */
398
- updateRealm(realm: string, roles: Role[]): Promise<void>;
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 {
399
599
  /**
400
- * Creates a user account from the provided payload.
600
+ * Get the value of a key.
401
601
  *
402
- * @param payload - The payload to create the user account from.
403
- * @param [realmName] - The realm containing the roles. Default is all.
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.
404
604
  *
405
- * @returns The user info created from the payload.
605
+ * @return The value of the key, or undefined if the key does not exist.
406
606
  */
407
- createUserFromPayload(payload: JWTPayload, realmName?: string): UserAccount;
607
+ abstract get(name: string, key: string): Promise<Uint8Array | undefined>;
408
608
  /**
409
- * Checks if the user has the specified permission.
609
+ * Set the string value of a key.
410
610
  *
411
- * Bonus: we check also if the user has "ownership" flag.
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.
412
615
  *
413
- * @param permissionLike - The permission to check for.
414
- * @param roleEntries - The roles to check for the permission.
415
- */
416
- checkPermission(permissionLike: string | Permission, ...roleEntries: string[]): SecurityCheckResult;
417
- /**
418
- * Creates a user account from the provided payload.
616
+ * @return The value of the key.
419
617
  */
420
- createUserFromToken(headerOrToken?: string, options?: {
421
- permission?: Permission | string;
422
- realm?: string;
423
- verify?: JWTVerifyOptions;
424
- }): Promise<UserAccountToken>;
618
+ abstract set(name: string, key: string, value: Uint8Array, ttl?: number): Promise<Uint8Array>;
425
619
  /**
426
- * Checks if a user has a specific role.
620
+ * Remove the specified keys.
427
621
  *
428
- * @param roleName - The role to check for.
429
- * @param permission - The permission to check for.
430
- * @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.
431
624
  */
432
- can(roleName: string, permission: string | Permission): boolean;
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[]>;
433
628
  /**
434
- * Checks if a user has ownership of a specific permission.
629
+ * Remove all keys from all cache names.
435
630
  */
436
- ownership(roleName: string, permission: string | Permission): string | boolean | undefined;
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[]> {
437
636
  /**
438
- * Converts a permission object to a string.
637
+ * The cache name. This is useful for invalidating multiple caches at once.
439
638
  *
440
- * @param permission
639
+ * Store key as `cache:$name:$key`.
640
+ *
641
+ * @default Name of the key of the class.
441
642
  */
442
- permissionToString(permission: Permission | string): string;
443
- getRealms(): Realm[];
643
+ name?: string;
444
644
  /**
445
- * Retrieves the user account from the provided user ID.
446
- *
447
- * @param realm
645
+ * Function which returns cached data.
448
646
  */
449
- getRoles(realm?: string): Role[];
647
+ handler?: (...args: TParameter) => TReturn;
450
648
  /**
451
- * Returns all permissions.
452
- *
453
- * @param user - Filter permissions by user.
454
- *
455
- * @return An array containing all permissions.
649
+ * The key generator for the cache.
650
+ * If not provided, the arguments will be json.stringify().
456
651
  */
457
- getPermissions(user?: {
458
- roles?: Array<Role | string>;
459
- realm?: string;
460
- }): Permission[];
652
+ key?: (...args: TParameter) => string;
461
653
  /**
462
- * Retrieves the user ID from the provided payload object.
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.
463
661
  *
464
- * @param payload - The payload object from which to extract the user ID.
465
- * @return The user ID as a string.
662
+ * @default 300 (5 minutes).
466
663
  */
467
- getIdFromPayload(payload: Record<string, any>): string;
468
- getSessionIdFromPayload(payload: Record<string, any>): string | undefined;
664
+ ttl?: DurationLike;
469
665
  /**
470
- * Retrieves the roles from the provided payload object.
471
- * @param payload - The payload object from which to extract the roles.
472
- * @return An array of role strings.
666
+ * If the cache is disabled.
473
667
  */
474
- getRolesFromPayload(payload: Record<string, any>): string[];
475
- getPictureFromPayload(payload: Record<string, any>): string | undefined;
476
- getUsernameFromPayload(payload: Record<string, any>): string | undefined;
477
- getEmailFromPayload(payload: Record<string, any>): string | undefined;
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> {
478
695
  /**
479
- * Returns the name from the given payload.
480
- *
481
- * @param payload - The payload object.
482
- * @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.
483
697
  */
484
- getNameFromPayload(payload: Record<string, any>): string;
485
- getOrganizationsFromPayload(payload: Record<string, any>): string[] | undefined;
698
+ (...args: TParameter): Promise<TReturn>;
486
699
  }
487
- /**
488
- * A realm definition.
489
- */
490
- interface Realm {
491
- name: string;
492
- roles: Role[];
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> {
493
726
  /**
494
- * The secret key for the realm.
495
- *
496
- * Can be also a JWKS URL.
727
+ * Key to identify the request in the pending requests.
497
728
  */
498
- secret?: string | JSONWebKeySet | (() => string);
729
+ key?: string;
499
730
  /**
500
- * Create the user account info based on the raw JWT payload.
501
- * By default, SecurityProvider has his own implementation, but this method allow to override it.
731
+ * The schema to validate the response against.
502
732
  */
503
- profile?: (raw: Record<string, any>) => UserAccount;
733
+ schema?: {
734
+ response?: T$1;
735
+ };
736
+ /**
737
+ * Built-in cache options.
738
+ */
739
+ localCache?: boolean | number | DurationLike;
504
740
  }
505
- interface SecurityCheckResult {
506
- isAuthorized: boolean;
507
- ownership: string | boolean | undefined;
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
+ };
508
771
  }
509
772
  //#endregion
510
- //#region ../alepha/src/security/descriptors/$realm.d.ts
511
- type RealmDescriptorOptions = {
773
+ //#region ../alepha/src/server/primitives/$action.d.ts
774
+ interface ActionPrimitiveOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
512
775
  /**
513
- * Define the realm name.
514
- * If not provided, it will use the property key.
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.
515
780
  */
516
781
  name?: string;
517
782
  /**
518
- * Short description about the realm.
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
+ * ```
519
803
  */
520
- description?: string;
804
+ group?: string;
521
805
  /**
522
- * All roles available in the realm. Role is a string (role name) or a Role object (embedded role).
806
+ * Pathname of the route. If not provided, property key is used.
523
807
  */
524
- roles?: Array<string | Role>;
808
+ path?: string;
525
809
  /**
526
- * Realm settings.
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.)
527
816
  */
528
- settings?: RealmSettings;
817
+ method?: RouteMethod;
529
818
  /**
530
- * Parse the JWT payload to create a user account info.
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.
531
824
  */
532
- profile?: (jwtPayload: Record<string, any>) => UserAccount;
533
- } & (RealmInternal | RealmExternal);
534
- interface RealmSettings {
535
- accessToken?: {
536
- /**
537
- * Lifetime of the access token.
538
- * @default 15 minutes
539
- */
540
- expiration?: DurationLike;
541
- };
542
- refreshToken?: {
543
- /**
544
- * Lifetime of the refresh token.
545
- * @default 30 days
546
- */
547
- expiration?: DurationLike;
548
- };
549
- onCreateSession?: (user: UserAccount, config: {
550
- expiresIn: number;
551
- }) => Promise<{
552
- refreshToken: string;
553
- sessionId?: string;
554
- }>;
555
- onRefreshSession?: (refreshToken: string) => Promise<{
556
- user: UserAccount;
557
- expiresIn: number;
558
- sessionId?: string;
559
- }>;
560
- onDeleteSession?: (refreshToken: string) => Promise<void>;
561
- }
562
- type RealmInternal = {
825
+ schema?: TConfig;
563
826
  /**
564
- * Internal secret to sign JWT tokens and verify them.
827
+ * A short description of the action. Used for documentation purposes.
565
828
  */
566
- secret: string;
567
- };
568
- interface RealmExternal {
829
+ description?: string;
569
830
  /**
570
- * URL to the JWKS (JSON Web Key Set) to verify JWT tokens from external providers.
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!
571
833
  */
572
- jwks: (() => string) | JSONWebKeySet;
834
+ disabled?: boolean;
835
+ /**
836
+ * Main route handler. This is where the route logic is implemented.
837
+ */
838
+ handler: ServerActionHandler<TConfig>;
573
839
  }
574
- declare class RealmDescriptor extends Descriptor<RealmDescriptorOptions> {
575
- protected readonly securityProvider: SecurityProvider;
576
- protected readonly dateTimeProvider: DateTimeProvider;
577
- protected readonly jwt: JwtProvider;
840
+ declare class ActionPrimitive<TConfig extends RequestConfigSchema> extends Primitive<ActionPrimitiveOptions<TConfig>> {
578
841
  protected readonly log: Logger;
579
- get name(): string;
580
- get accessTokenExpiration(): Duration;
581
- get refreshTokenExpiration(): Duration;
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;
582
848
  protected onInit(): void;
849
+ get prefix(): string;
850
+ get route(): ServerRoute;
583
851
  /**
584
- * Get all roles in the realm.
852
+ * Returns the name of the action.
585
853
  */
586
- getRoles(): Role[];
587
- /**
588
- * Set all roles in the realm.
589
- */
590
- setRoles(roles: Role[]): Promise<void>;
854
+ get name(): string;
591
855
  /**
592
- * Get a role by name, throws an error if not found.
856
+ * Returns the group of the action. (e.g. "orders", "admin", etc.)
593
857
  */
594
- getRoleByName(name: string): Role;
595
- parseToken(token: string): Promise<JWTPayload>;
858
+ get group(): string;
596
859
  /**
597
- * Create a token for the subject.
860
+ * Returns the HTTP method of the action.
598
861
  */
599
- createToken(user: UserAccount, refreshToken?: {
600
- sid?: string;
601
- refresh_token?: string;
602
- refresh_token_expires_in?: number;
603
- }): Promise<AccessTokenResponse>;
604
- refreshToken(refreshToken: string, accessToken?: string): Promise<{
605
- tokens: AccessTokenResponse;
606
- user: UserAccount;
607
- }>;
608
- }
609
- interface AccessTokenResponse {
610
- access_token: string;
611
- token_type: string;
612
- expires_in?: number;
613
- issued_at: number;
614
- refresh_token?: string;
615
- refresh_token_expires_in?: number;
616
- scope?: string;
617
- }
618
- //#endregion
619
- //#region ../alepha/src/security/descriptors/$serviceAccount.d.ts
620
- interface ServiceAccountDescriptor {
621
- token: () => Promise<string>;
622
- }
623
- //#endregion
624
- //#region ../alepha/src/server/constants/routeMethods.d.ts
625
- declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
626
- type RouteMethod = (typeof routeMethods)[number];
627
- //#endregion
628
- //#region ../alepha/src/router/providers/RouterProvider.d.ts
629
- declare abstract class RouterProvider<T$1 extends Route = Route> {
630
- protected routePathRegex: RegExp;
631
- protected tree: Tree<T$1>;
632
- protected cache: Map<string, RouteMatch<T$1>>;
633
- match(path: string): RouteMatch<T$1>;
634
- protected test(path: string): void;
635
- protected push(route: T$1): void;
636
- protected createRouteMatch(path: string): RouteMatch<T$1>;
637
- protected mapParams(match: RouteMatch<T$1>): RouteMatch<T$1>;
638
- protected createParts(path: string): string[];
639
- }
640
- interface RouteMatch<T$1 extends Route> {
641
- route?: T$1;
642
- params?: Record<string, string>;
643
- }
644
- interface Route {
645
- path: string;
862
+ get method(): RouteMethod;
646
863
  /**
647
- * Rename a param in the route.
648
- * This is automatically filled when you have scenarios like:
649
- * `/customers/:id` and `/customers/:userId/payments`
864
+ * Returns the path of the action.
650
865
  *
651
- * In this case, `:id` will be renamed to `:userId` in the second route.
652
- */
653
- mapParams?: Record<string, string>;
654
- }
655
- interface Tree<T$1 extends Route> {
656
- route?: T$1;
657
- children: {
658
- [key: string]: Tree<T$1>;
659
- };
660
- param?: {
661
- route?: T$1;
662
- name: string;
663
- children: {
664
- [key: string]: Tree<T$1>;
665
- };
666
- };
667
- wildcard?: {
668
- route: T$1;
669
- };
670
- }
671
- //#endregion
672
- //#region ../alepha/src/server/helpers/ServerReply.d.ts
673
- /**
674
- * Helper for building server replies.
675
- */
676
- declare class ServerReply {
677
- headers: Record<string, string> & {
678
- "set-cookie"?: string[];
679
- };
680
- status?: number;
681
- body?: any;
682
- /**
683
- * Redirect to a given URL with optional status code (default 302).
866
+ * Path is prefixed by `/api` by default.
684
867
  */
685
- redirect(url: string, status?: number): void;
868
+ get path(): string;
869
+ get schema(): TConfig | undefined;
870
+ getBodyContentType(): string | undefined;
686
871
  /**
687
- * Set the response status code.
872
+ * Call the action handler directly.
873
+ * There is no HTTP layer involved.
688
874
  */
689
- setStatus(status: number): this;
875
+ run(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
690
876
  /**
691
- * Set a response header.
877
+ * Works like `run`, but always fetches (http request) the route.
692
878
  */
693
- setHeader(name: string, value: string): this;
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 {
694
892
  /**
695
- * Set the response body.
893
+ * Standard request fetch options.
696
894
  */
697
- setBody(body: any): this;
698
- }
699
- //#endregion
700
- //#region ../alepha/src/server/services/UserAgentParser.d.ts
701
- interface UserAgentInfo {
702
- os: "Windows" | "Android" | "Ubuntu" | "MacOS" | "iOS" | "Linux" | "FreeBSD" | "OpenBSD" | "ChromeOS" | "BlackBerry" | "Symbian" | "Windows Phone";
703
- browser: "Chrome" | "Firefox" | "Safari" | "Edge" | "Opera" | "Internet Explorer" | "Brave" | "Vivaldi" | "Samsung Browser" | "UC Browser" | "Yandex";
704
- device: "MOBILE" | "DESKTOP" | "TABLET";
895
+ request?: RequestInit;
705
896
  }
897
+ type ClientRequestResponse<TConfig extends RequestConfigSchema> = TConfig["response"] extends TSchema ? Static<TConfig["response"]> : any;
706
898
  /**
707
- * Simple User-Agent parser to detect OS, browser, and device type.
708
- * This parser is not exhaustive and may not cover all edge cases.
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
709
904
  *
710
- * Use result for non
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.
711
908
  */
712
- declare class UserAgentParser {
713
- parse(userAgent?: string): UserAgentInfo;
714
- }
909
+ interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
715
910
  //#endregion
716
- //#region ../alepha/src/server/interfaces/ServerRequest.d.ts
717
- type TRequestBody = TObject | TString | TArray | TRecord | TStream;
718
- type TResponseBody = TObject | TString | TRecord | TFile | TArray | TStream | TVoid;
719
- interface RequestConfigSchema {
720
- body?: TRequestBody;
721
- params?: TObject;
722
- query?: TObject;
723
- headers?: TObject;
724
- response?: TResponseBody;
725
- }
726
- interface ServerRequestConfig<TConfig extends RequestConfigSchema = RequestConfigSchema> {
727
- body: TConfig["body"] extends TRequestBody ? Static<TConfig["body"]> : any;
728
- headers: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : Record<string, string>;
729
- params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : Record<string, string>;
730
- query: TConfig["query"] extends TObject ? Static<TConfig["query"]> : Record<string, any>;
731
- }
732
- type ServerRequestConfigEntry<TConfig extends RequestConfigSchema = RequestConfigSchema> = Partial<ServerRequestConfig<TConfig>>;
733
- interface ServerRequest<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRequestConfig<TConfig> {
734
- /**
735
- * HTTP method used for this request.
736
- */
737
- method: RouteMethod;
738
- /**
739
- * Full request URL.
740
- */
741
- url: URL;
742
- /**
743
- * Unique request ID assigned to this request.
744
- */
745
- requestId: string;
746
- /**
747
- * Client IP address.
748
- * Will parse `X-Forwarded-For` header if present.
749
- */
750
- ip?: string;
751
- /**
752
- * Value of the `Host` header sent by the client.
753
- */
754
- host?: string;
755
- /**
756
- * Browser user agent information.
757
- * Information are not guaranteed to be accurate. Use with caution.
758
- *
759
- * @see {@link UserAgentParser}
760
- */
761
- userAgent: UserAgentInfo;
762
- /**
763
- * Arbitrary metadata attached to the request. Can be used by middlewares to store information.
764
- */
765
- metadata: Record<string, any>;
766
- /**
767
- * Reply object to be used to send response.
768
- */
769
- reply: ServerReply;
770
- /**
771
- * The raw underlying request object (Web Request).
772
- */
773
- raw: ServerRawRequest;
774
- }
775
- interface ServerRoute<TConfig extends RequestConfigSchema = RequestConfigSchema> extends Route {
776
- /**
777
- * Handler function for this route.
778
- */
779
- handler: ServerHandler<TConfig>;
780
- /**
781
- * HTTP method for this route.
782
- */
783
- method?: RouteMethod;
784
- /**
785
- * Request/response schema for this route.
786
- *
787
- * Request schema contains:
788
- * - body, for POST/PUT/PATCH requests
789
- * - params, for URL parameters (e.g. /user/:id)
790
- * - query, for URL query parameters (e.g. /user?id=123)
791
- * - headers, for HTTP headers
792
- *
793
- * Response schema contains:
794
- * - response
795
- *
796
- * Response schema is used to validate and serialize the response sent by the handler.
797
- */
798
- schema?: TConfig;
799
- /**
800
- * @see ServerLoggerProvider
801
- */
802
- silent?: boolean;
803
- }
804
- type ServerResponseBody<TConfig extends RequestConfigSchema = RequestConfigSchema> = TConfig["response"] extends TResponseBody ? Static<TConfig["response"]> : ResponseBodyType;
805
- type ResponseKind = "json" | "text" | "void" | "file" | "any";
806
- type ResponseBodyType = string | Buffer | StreamLike | undefined | null | void;
807
- type ServerHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
808
- interface ServerResponse$1 {
809
- body: string | Buffer | ArrayBuffer | Readable | ReadableStream;
810
- headers: Record<string, string>;
811
- status: number;
812
- }
813
- type ServerRouteRequestHandler = (request: ServerRequestData) => Promise<ServerResponse$1>;
814
- interface ServerRouteMatcher extends Route {
815
- handler: ServerRouteRequestHandler;
816
- }
817
- interface ServerRequestData {
818
- method: RouteMethod;
819
- url: URL;
820
- headers: Record<string, string>;
821
- query: Record<string, string>;
822
- params: Record<string, string>;
823
- raw: ServerRawRequest;
824
- }
825
- interface ServerRawRequest {
826
- node?: NodeRequestEvent;
827
- web?: WebRequestEvent;
828
- }
829
- interface NodeRequestEvent {
830
- req: IncomingMessage;
831
- res: ServerResponse;
832
- }
833
- interface WebRequestEvent {
834
- req: Request;
835
- res?: Response;
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;
836
916
  }
837
917
  //#endregion
838
- //#region ../alepha/src/server/services/ServerRequestParser.d.ts
839
- declare class ServerRequestParser {
840
- protected readonly alepha: Alepha;
841
- protected readonly userAgentParser: UserAgentParser;
842
- createServerRequest(rawRequest: ServerRequestData): ServerRequest;
843
- getRequestId(request: ServerRequestData): string | undefined;
844
- getRequestUserAgent(request: ServerRequestData): UserAgentInfo;
845
- getRequestIp(request: ServerRequestData): string | undefined;
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>> {}
846
925
  }
847
926
  //#endregion
848
- //#region ../alepha/src/server/providers/ServerTimingProvider.d.ts
849
- type TimingMap = Record<string, [number, number]>;
850
- declare class ServerTimingProvider {
851
- protected readonly log: Logger;
852
- protected readonly alepha: Alepha;
853
- options: {
854
- prefix: string;
855
- disabled: boolean;
856
- };
857
- readonly onRequest: alepha1246.HookDescriptor<"server:onRequest">;
858
- readonly onResponse: alepha1246.HookDescriptor<"server:onResponse">;
859
- protected get handlerName(): string;
860
- beginTiming(name: string): void;
861
- endTiming(name: string): void;
862
- protected setDuration(name: string, timing: TimingMap): void;
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>> {}
863
934
  }
864
935
  //#endregion
865
- //#region ../alepha/src/server/providers/ServerRouterProvider.d.ts
866
- /**
867
- * Main router for all routes on the server side.
868
- *
869
- * - $route => generic route
870
- * - $action => action route (for API calls)
871
- * - $page => React route (for SSR)
872
- */
873
- declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
874
- protected readonly log: Logger;
875
- protected readonly alepha: Alepha;
876
- protected readonly routes: ServerRoute[];
877
- protected readonly serverTimingProvider: ServerTimingProvider;
878
- protected readonly serverRequestParser: ServerRequestParser;
879
- /**
880
- * Get all registered routes, optionally filtered by a pattern.
881
- *
882
- * Pattern accept simple wildcard '*' at the end.
883
- * Example: '/api/*' will match all routes starting with '/api/' but '/api/' will match only that exact route.
884
- */
885
- getRoutes(pattern?: string): ServerRoute[];
886
- createRoute<TConfig extends RequestConfigSchema = RequestConfigSchema>(route: ServerRoute<TConfig>): void;
887
- protected getContextId(headers: Record<string, string>): string;
888
- protected processRequest(request: ServerRequest, route: ServerRoute, responseKind: ResponseKind): Promise<{
889
- status: number;
890
- headers: Record<string, string> & {
891
- "set-cookie"?: string[];
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;
892
946
  };
893
- body: any;
894
- }>;
895
- protected runRouteHandler(route: ServerRoute, request: ServerRequest, responseKind: ResponseKind): Promise<void>;
896
- serializeResponse(route: ServerRoute, reply: ServerReply, responseKind: ResponseKind): void;
897
- protected getResponseType(schema?: RequestConfigSchema): ResponseKind;
898
- protected errorHandler(route: ServerRoute, request: ServerRequest, error: Error): Promise<void>;
899
- validateRequest(route: {
900
- schema?: RequestConfigSchema;
901
- }, request: ServerRequestConfig): void;
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
+ }
902
990
  }
903
991
  //#endregion
904
- //#region ../alepha/src/server/providers/ServerProvider.d.ts
992
+ //#region ../alepha/src/security/interfaces/UserAccountToken.d.ts
905
993
  /**
906
- * Base server provider to handle incoming requests and route them.
907
- *
908
- * This is the default implementation for serverless environments.
909
- *
910
- * ServerProvider supports both Node.js HTTP requests and Web (Fetch API) requests.
994
+ * Add contextual metadata to a user account info.
995
+ * E.g. UserAccountToken is a UserAccountInfo during a request.
911
996
  */
912
- declare class ServerProvider {
913
- protected readonly log: Logger;
914
- protected readonly alepha: Alepha;
915
- protected readonly dateTimeProvider: DateTimeProvider;
916
- protected readonly router: ServerRouterProvider;
917
- protected readonly internalServerErrorMessage = "Internal Server Error";
918
- get hostname(): string;
919
- /**
920
- * When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
921
- */
922
- protected readonly onNodeRequest: alepha1246.HookDescriptor<"node:request">;
923
- /**
924
- * When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
925
- */
926
- protected readonly onWebRequest: alepha1246.HookDescriptor<"web:request">;
997
+ interface UserAccountToken extends UserAccount {
927
998
  /**
928
- * Handle Node.js HTTP request event.
929
- *
930
- * Technically, we just convert Node.js request to Web Standard Request.
999
+ * Access token for the user.
931
1000
  */
932
- handleNodeRequest(nodeRequestEvent: NodeRequestEvent): Promise<void>;
1001
+ token?: string;
933
1002
  /**
934
- * Handle Web (Fetch API) request event.
1003
+ * Realm name of the user.
935
1004
  */
936
- handleWebRequest(ev: WebRequestEvent): Promise<void>;
1005
+ realm?: string;
937
1006
  /**
938
- * Helper for Vite development mode to let Vite handle (or not) 404.
1007
+ * Is user dedicated to his own resources for this scope ?
1008
+ * Mostly, Admin is false and Customer is true.
939
1009
  */
940
- protected isViteNotFound(url?: string, route?: Route, params?: Record<string, string>): boolean;
1010
+ ownership?: string | boolean;
941
1011
  }
942
1012
  //#endregion
943
- //#region ../alepha/src/cache/providers/CacheProvider.d.ts
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
944
1037
  /**
945
- * Cache provider interface.
946
- *
947
- * All methods are asynchronous and return promises.
948
- * Values are stored as Uint8Array.
1038
+ * Provides utilities for working with JSON Web Tokens (JWT).
949
1039
  */
950
- declare abstract class CacheProvider {
1040
+ declare class JwtProvider {
1041
+ protected readonly log: Logger;
1042
+ protected readonly keystore: KeyLoaderHolder[];
1043
+ protected readonly dateTimeProvider: DateTimeProvider;
1044
+ protected readonly encoder: TextEncoder;
951
1045
  /**
952
- * Get the value of a key.
953
- *
954
- * @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
955
- * @param key The key of the value to get.
1046
+ * Adds a key loader to the embedded keystore.
956
1047
  *
957
- * @return The value of the key, or undefined if the key does not exist.
1048
+ * @param name
1049
+ * @param secretKeyOrJwks
958
1050
  */
959
- abstract get(name: string, key: string): Promise<Uint8Array | undefined>;
1051
+ setKeyLoader(name: string, secretKeyOrJwks: string | JSONWebKeySet): void;
960
1052
  /**
961
- * Set the string value of a key.
962
- *
963
- * @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
964
- * @param key The key of the value to set.
965
- * @param value The value to set.
966
- * @param ttl The time-to-live of the key, in milliseconds.
1053
+ * Retrieves the payload from a JSON Web Token (JWT).
967
1054
  *
968
- * @return The value of the key.
969
- */
970
- abstract set(name: string, key: string, value: Uint8Array, ttl?: number): Promise<Uint8Array>;
971
- /**
972
- * Remove the specified keys.
1055
+ * @param token - The JWT to extract the payload from.
973
1056
  *
974
- * @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
975
- * @param keys The keys to delete.
976
- */
977
- abstract del(name: string, ...keys: string[]): Promise<void>;
978
- abstract has(name: string, key: string): Promise<boolean>;
979
- abstract keys(name: string, filter?: string): Promise<string[]>;
980
- /**
981
- * Remove all keys from all cache names.
1057
+ * @return A Promise that resolves with the payload object from the token.
982
1058
  */
983
- abstract clear(): Promise<void>;
984
- }
985
- //#endregion
986
- //#region ../alepha/src/cache/descriptors/$cache.d.ts
987
- interface CacheDescriptorOptions<TReturn = any, TParameter extends any[] = any[]> {
1059
+ parse(token: string, keyName?: string, options?: JWTVerifyOptions): Promise<JwtParseResult>;
988
1060
  /**
989
- * The cache name. This is useful for invalidating multiple caches at once.
1061
+ * Creates a JWT token with the provided payload and secret key.
990
1062
  *
991
- * Store key as `cache:$name:$key`.
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.
992
1066
  *
993
- * @default Name of the key of the class.
994
- */
995
- name?: string;
996
- /**
997
- * Function which returns cached data.
998
- */
999
- handler?: (...args: TParameter) => TReturn;
1000
- /**
1001
- * The key generator for the cache.
1002
- * If not provided, the arguments will be json.stringify().
1003
- */
1004
- key?: (...args: TParameter) => string;
1005
- /**
1006
- * The store provider for the cache.
1007
- * If not provided, the default store provider will be used.
1067
+ * @returns The signed JWT token.
1008
1068
  */
1009
- provider?: InstantiableClass<CacheProvider> | "memory";
1069
+ create(payload: ExtendedJWTPayload, keyName?: string, signOptions?: JwtSignOptions): Promise<string>;
1010
1070
  /**
1011
- * The time-to-live for the cache in seconds.
1012
- * Set 0 to skip expiration.
1071
+ * Determines if the provided key is a secret key.
1013
1072
  *
1014
- * @default 300 (5 minutes).
1015
- */
1016
- ttl?: DurationLike;
1017
- /**
1018
- * If the cache is disabled.
1073
+ * @param key
1074
+ * @protected
1019
1075
  */
1020
- disabled?: boolean;
1076
+ protected isSecretKey(key: string): boolean;
1021
1077
  }
1022
- declare class CacheDescriptor<TReturn = any, TParameter extends any[] = any[]> extends Descriptor<CacheDescriptorOptions<TReturn, TParameter>> {
1023
- protected readonly env: {
1024
- CACHE_ENABLED: boolean;
1025
- CACHE_DEFAULT_TTL: number;
1026
- };
1027
- protected readonly dateTimeProvider: DateTimeProvider;
1028
- protected readonly provider: CacheProvider;
1029
- protected encoder: TextEncoder;
1030
- protected decoder: TextDecoder;
1031
- protected codes: {
1032
- BINARY: number;
1033
- JSON: number;
1034
- STRING: number;
1078
+ type KeyLoader = (protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput) => Promise<CryptoKey | KeyObject>;
1079
+ interface KeyLoaderHolder {
1080
+ name: string;
1081
+ keyLoader: KeyLoader;
1082
+ secretKey?: string;
1083
+ }
1084
+ interface JwtSignOptions {
1085
+ header?: Partial<JWTHeaderParameters>;
1086
+ }
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[];
1035
1095
  };
1036
- get container(): string;
1037
- run(...args: TParameter): Promise<TReturn>;
1038
- key(...args: TParameter): string;
1039
- invalidate(...keys: string[]): Promise<void>;
1040
- set(key: string, value: TReturn, ttl?: DurationLike): Promise<void>;
1041
- get(key: string): Promise<TReturn | undefined>;
1042
- protected serialize<TReturn>(value: TReturn): Uint8Array;
1043
- protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
1044
- protected $provider(): CacheProvider;
1045
1096
  }
1046
- interface CacheDescriptorFn<TReturn = any, TParameter extends any[] = any[]> extends CacheDescriptor<TReturn, TParameter> {
1047
- /**
1048
- * Run the cache descriptor with the provided arguments.
1049
- */
1050
- (...args: TParameter): Promise<TReturn>;
1097
+ interface JwtParseResult {
1098
+ keyName: string;
1099
+ result: JWTVerifyResult<ExtendedJWTPayload>;
1051
1100
  }
1052
1101
  //#endregion
1053
- //#region ../alepha/src/server/services/HttpClient.d.ts
1054
- declare class HttpClient {
1055
- protected readonly log: Logger;
1056
- protected readonly alepha: Alepha;
1057
- readonly cache: CacheDescriptorFn<HttpClientCache, any[]>;
1058
- protected readonly pendingRequests: HttpClientPendingRequests;
1059
- fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
1060
- fetch<T$1 extends TSchema>(url: string, request?: RequestInitWithOptions<T$1>): Promise<FetchResponse<Static<T$1>>>;
1061
- protected url(host: string, action: HttpAction, args: ServerRequestConfigEntry): string;
1062
- protected body(init: RequestInit, headers: Record<string, string>, action: HttpAction, args?: ServerRequestConfigEntry): Promise<void>;
1063
- protected responseData(response: Response, options: FetchOptions): Promise<any>;
1064
- protected isMaybeFile(response: Response): boolean;
1065
- protected createFileLike(response: Response, defaultFileName?: string): FileLike;
1066
- pathVariables(url: string, action: {
1067
- schema?: {
1068
- params?: TObject;
1069
- };
1070
- }, args?: ServerRequestConfigEntry): string;
1071
- queryParams(url: string, action: {
1072
- schema?: {
1073
- query?: TObject;
1074
- };
1075
- }, args?: ServerRequestConfigEntry): string;
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>> {}
1076
1108
  }
1077
- interface FetchOptions<T$1 extends TSchema = TSchema> {
1078
- /**
1079
- * Key to identify the request in the pending requests.
1080
- */
1081
- key?: string;
1082
- /**
1083
- * The schema to validate the response against.
1084
- */
1085
- schema?: {
1086
- response?: T$1;
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;
1113
+ protected readonly log: Logger;
1114
+ protected readonly jwt: JwtProvider;
1115
+ protected readonly env: {
1116
+ APP_SECRET: string;
1087
1117
  };
1118
+ protected readonly alepha: Alepha;
1119
+ get secretKey(): string;
1088
1120
  /**
1089
- * Built-in cache options.
1121
+ * The permissions configured for the security provider.
1090
1122
  */
1091
- localCache?: boolean | number | DurationLike;
1092
- }
1093
- type RequestInitWithOptions<T$1 extends TSchema = TSchema> = RequestInit & FetchOptions<T$1>;
1094
- interface FetchResponse<T$1 = any> {
1095
- data: T$1;
1096
- status: number;
1097
- statusText: string;
1098
- headers: Headers;
1099
- raw?: Response;
1100
- }
1101
- type HttpClientPendingRequests = Record<string, Promise<any> | undefined>;
1102
- interface HttpClientCache {
1103
- data: any;
1104
- etag?: string;
1105
- }
1106
- interface FetchActionArgs {
1107
- action: HttpAction;
1108
- host?: string;
1109
- config?: ServerRequestConfigEntry;
1110
- options?: ClientRequestOptions;
1111
- }
1112
- interface HttpAction {
1113
- method?: string;
1114
- prefix?: string;
1115
- path: string;
1116
- requestBodyType?: string;
1117
- schema?: {
1118
- params?: TObject;
1119
- query?: TObject;
1120
- body?: TRequestBody;
1121
- response?: TResponseBody;
1122
- };
1123
- }
1124
- //#endregion
1125
- //#region ../alepha/src/server/descriptors/$action.d.ts
1126
- interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
1123
+ protected readonly permissions: Permission[];
1127
1124
  /**
1128
- * Name of the action.
1129
- *
1130
- * - It will be used to generate the route path if `path` is not provided.
1131
- * - It will be used to generate the permission name if `security` is enabled.
1125
+ * The realms configured for the security provider.
1132
1126
  */
1133
- name?: string;
1127
+ protected readonly realms: Realm[];
1128
+ protected start: alepha1672.HookPrimitive<"start">;
1134
1129
  /**
1135
- * Group actions together.
1136
- *
1137
- * - If not provided, the service name containing the route will be used.
1138
- * - It will be used as Tag for documentation purposes.
1139
- * - It will be used for permission name generation if `security` is enabled.
1140
- *
1141
- * @example
1142
- * ```ts
1143
- * // group = "MyController"
1144
- * class MyController {
1145
- * hello = $action({ handler: () => "Hello World" });
1146
- * }
1130
+ * Adds a role to one or more realms.
1147
1131
  *
1148
- * // group = "users"
1149
- * class MyOtherController {
1150
- * group = "users";
1151
- * a1 = $action({ handler: () => "Action 1", group: this.group });
1152
- * a2 = $action({ handler: () => "Action 2", group: this.group });
1153
- * }
1154
- * ```
1132
+ * @param role
1133
+ * @param realms
1155
1134
  */
1156
- group?: string;
1135
+ createRole(role: Role, ...realms: string[]): Role;
1157
1136
  /**
1158
- * Pathname of the route. If not provided, property key is used.
1137
+ * Adds a permission to the security provider.
1138
+ *
1139
+ * @param raw - The permission to add.
1159
1140
  */
1160
- path?: string;
1141
+ createPermission(raw: Permission | string): Permission;
1142
+ createRealm(realm: Realm): void;
1161
1143
  /**
1162
- * The route method.
1144
+ * Updates the roles for a realm then synchronizes the user account provider if available.
1163
1145
  *
1164
- * - If not provided, it will be set to "GET" by default.
1165
- * - If not provider and a body is provided, it will be set to "POST".
1146
+ * Only available when the app is started.
1166
1147
  *
1167
- * Wildcard methods are not supported for now. (e.g. "ALL", "ANY", etc.)
1148
+ * @param realm - The realm to update the roles for.
1149
+ * @param roles - The roles to update.
1168
1150
  */
1169
- method?: RouteMethod;
1151
+ updateRealm(realm: string, roles: Role[]): Promise<void>;
1170
1152
  /**
1171
- * The config schema of the route.
1172
- * - body: The request body schema.
1173
- * - params: Path variables schema.
1174
- * - query: The request query-params schema.
1175
- * - response: The response schema.
1153
+ * Creates a user account from the provided payload.
1154
+ *
1155
+ * @param payload - The payload to create the user account from.
1156
+ * @param [realmName] - The realm containing the roles. Default is all.
1157
+ *
1158
+ * @returns The user info created from the payload.
1176
1159
  */
1177
- schema?: TConfig;
1160
+ createUserFromPayload(payload: JWTPayload, realmName?: string): UserAccount;
1178
1161
  /**
1179
- * A short description of the action. Used for documentation purposes.
1162
+ * Checks if the user has the specified permission.
1163
+ *
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.
1180
1168
  */
1181
- description?: string;
1169
+ checkPermission(permissionLike: string | Permission, ...roleEntries: string[]): SecurityCheckResult;
1182
1170
  /**
1183
- * Disable the route. Useful with env variables do disable one specific route.
1184
- * Route won't be available in the API but can still be called locally!
1171
+ * Creates a user account from the provided payload.
1185
1172
  */
1186
- disabled?: boolean;
1173
+ createUserFromToken(headerOrToken?: string, options?: {
1174
+ permission?: Permission | string;
1175
+ realm?: string;
1176
+ verify?: JWTVerifyOptions;
1177
+ }): Promise<UserAccountToken>;
1187
1178
  /**
1188
- * Main route handler. This is where the route logic is implemented.
1179
+ * Checks if a user has a specific role.
1180
+ *
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.
1189
1184
  */
1190
- handler: ServerActionHandler<TConfig>;
1191
- }
1192
- declare class ActionDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<ActionDescriptorOptions<TConfig>> {
1193
- protected readonly log: Logger;
1194
- protected readonly env: {
1195
- SERVER_API_PREFIX: string;
1196
- };
1197
- protected readonly httpClient: HttpClient;
1198
- protected readonly serverProvider: ServerProvider;
1199
- protected readonly serverRouterProvider: ServerRouterProvider;
1200
- protected onInit(): void;
1201
- get prefix(): string;
1202
- get route(): ServerRoute;
1185
+ can(roleName: string, permission: string | Permission): boolean;
1203
1186
  /**
1204
- * Returns the name of the action.
1187
+ * Checks if a user has ownership of a specific permission.
1205
1188
  */
1206
- get name(): string;
1189
+ ownership(roleName: string, permission: string | Permission): string | boolean | undefined;
1207
1190
  /**
1208
- * Returns the group of the action. (e.g. "orders", "admin", etc.)
1191
+ * Converts a permission object to a string.
1192
+ *
1193
+ * @param permission
1209
1194
  */
1210
- get group(): string;
1195
+ permissionToString(permission: Permission | string): string;
1196
+ getRealms(): Realm[];
1211
1197
  /**
1212
- * Returns the HTTP method of the action.
1198
+ * Retrieves the user account from the provided user ID.
1199
+ *
1200
+ * @param realm
1213
1201
  */
1214
- get method(): RouteMethod;
1202
+ getRoles(realm?: string): Role[];
1215
1203
  /**
1216
- * Returns the path of the action.
1204
+ * Returns all permissions.
1217
1205
  *
1218
- * Path is prefixed by `/api` by default.
1206
+ * @param user - Filter permissions by user.
1207
+ *
1208
+ * @return An array containing all permissions.
1219
1209
  */
1220
- get path(): string;
1221
- get schema(): TConfig | undefined;
1222
- getBodyContentType(): string | undefined;
1210
+ getPermissions(user?: {
1211
+ roles?: Array<Role | string>;
1212
+ realm?: string;
1213
+ }): Permission[];
1223
1214
  /**
1224
- * Call the action handler directly.
1225
- * There is no HTTP layer involved.
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.
1226
1219
  */
1227
- run(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
1220
+ getIdFromPayload(payload: Record<string, any>): string;
1221
+ getSessionIdFromPayload(payload: Record<string, any>): string | undefined;
1228
1222
  /**
1229
- * Works like `run`, but always fetches (http request) the route.
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.
1230
1226
  */
1231
- fetch(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<FetchResponse<ClientRequestResponse<TConfig>>>;
1232
- }
1233
- interface ActionDescriptorFn<TConfig extends RequestConfigSchema> extends ActionDescriptor<TConfig> {
1234
- (config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
1235
- }
1236
- 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] };
1237
- type ClientRequestEntryContainer<TConfig extends RequestConfigSchema> = {
1238
- body: TConfig["body"] extends TObject ? Static<TConfig["body"]> : undefined;
1239
- params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : undefined;
1240
- headers?: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : undefined;
1241
- query?: TConfig["query"] extends TObject ? Partial<Static<TConfig["query"]>> : undefined;
1242
- };
1243
- interface ClientRequestOptions extends FetchOptions {
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;
1244
1231
  /**
1245
- * Standard request fetch options.
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.
1246
1236
  */
1247
- request?: RequestInit;
1237
+ getNameFromPayload(payload: Record<string, any>): string;
1238
+ getOrganizationsFromPayload(payload: Record<string, any>): string[] | undefined;
1248
1239
  }
1249
- type ClientRequestResponse<TConfig extends RequestConfigSchema> = TConfig["response"] extends TSchema ? Static<TConfig["response"]> : any;
1250
- /**
1251
- * Specific handler for server actions.
1252
- */
1253
- type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerActionRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
1254
1240
  /**
1255
- * Server Action Request Interface
1256
- *
1257
- * Can be extended with module augmentation to add custom properties (like `user` in Server Security).
1258
- *
1259
- * This is NOT Server Request, but a specific type for actions.
1241
+ * A realm definition.
1260
1242
  */
1261
- interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
1262
- //#endregion
1263
- //#region ../alepha/src/server/schemas/errorSchema.d.ts
1264
- declare const errorSchema: alepha1246.TObject<{
1265
- error: alepha1246.TString;
1266
- status: alepha1246.TInteger;
1267
- message: alepha1246.TString;
1268
- details: alepha1246.TOptional<alepha1246.TString>;
1269
- requestId: alepha1246.TOptional<alepha1246.TString>;
1270
- cause: alepha1246.TOptional<alepha1246.TObject<{
1271
- name: alepha1246.TString;
1272
- message: alepha1246.TString;
1273
- }>>;
1274
- }>;
1275
- type ErrorSchema = Static<typeof errorSchema>;
1276
- //#endregion
1277
- //#region ../alepha/src/server/errors/HttpError.d.ts
1278
- declare class HttpError extends AlephaError {
1243
+ interface Realm {
1279
1244
  name: string;
1280
- static is: (error: unknown, status?: number) => error is HttpErrorLike;
1281
- static toJSON(error: HttpError): ErrorSchema;
1282
- readonly error: string;
1283
- readonly status: number;
1284
- readonly requestId?: string;
1285
- readonly details?: string;
1286
- readonly reason?: {
1287
- name: string;
1288
- message: string;
1289
- };
1290
- constructor(options: Partial<ErrorSchema>, cause?: unknown);
1245
+ roles: Role[];
1246
+ /**
1247
+ * The secret key for the realm.
1248
+ *
1249
+ * Can be also a JWKS URL.
1250
+ */
1251
+ secret?: string | JSONWebKeySet | (() => string);
1252
+ /**
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.
1255
+ */
1256
+ profile?: (raw: Record<string, any>) => UserAccount;
1291
1257
  }
1292
- interface HttpErrorLike extends Error {
1293
- status: number;
1258
+ interface SecurityCheckResult {
1259
+ isAuthorized: boolean;
1260
+ ownership: string | boolean | undefined;
1294
1261
  }
1295
1262
  //#endregion
1296
- //#region ../alepha/src/server/descriptors/$route.d.ts
1297
- interface RouteDescriptorOptions<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRoute<TConfig> {}
1298
- declare class RouteDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<RouteDescriptorOptions<TConfig>> {
1299
- protected readonly serverRouterProvider: ServerRouterProvider;
1300
- protected onInit(): void;
1263
+ //#region ../alepha/src/security/primitives/$realm.d.ts
1264
+ type RealmPrimitiveOptions = {
1265
+ /**
1266
+ * Define the realm name.
1267
+ * If not provided, it will use the property key.
1268
+ */
1269
+ name?: string;
1270
+ /**
1271
+ * Short description about the realm.
1272
+ */
1273
+ description?: string;
1274
+ /**
1275
+ * All roles available in the realm. Role is a string (role name) or a Role object (embedded role).
1276
+ */
1277
+ roles?: Array<string | Role>;
1278
+ /**
1279
+ * Realm settings.
1280
+ */
1281
+ settings?: RealmSettings;
1282
+ /**
1283
+ * Parse the JWT payload to create a user account info.
1284
+ */
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>;
1301
1314
  }
1302
- //#endregion
1303
- //#region ../alepha/src/server/providers/BunHttpServerProvider.d.ts
1304
- declare const envSchema$7: alepha1246.TObject<{
1305
- SERVER_PORT: alepha1246.TInteger;
1306
- SERVER_HOST: alepha1246.TString;
1307
- }>;
1308
- declare module "alepha" {
1309
- interface Env extends Partial<Static<typeof envSchema$7>> {}
1315
+ type RealmInternal = {
1316
+ /**
1317
+ * Internal secret to sign JWT tokens and verify them.
1318
+ */
1319
+ secret: string;
1320
+ };
1321
+ interface RealmExternal {
1322
+ /**
1323
+ * URL to the JWKS (JSON Web Key Set) to verify JWT tokens from external providers.
1324
+ */
1325
+ jwks: (() => string) | JSONWebKeySet;
1326
+ }
1327
+ declare class RealmPrimitive extends Primitive<RealmPrimitiveOptions> {
1328
+ protected readonly securityProvider: SecurityProvider;
1329
+ protected readonly dateTimeProvider: DateTimeProvider;
1330
+ protected readonly jwt: JwtProvider;
1331
+ protected readonly log: Logger;
1332
+ get name(): string;
1333
+ get accessTokenExpiration(): Duration;
1334
+ get refreshTokenExpiration(): Duration;
1335
+ protected onInit(): void;
1336
+ /**
1337
+ * Get all roles in the realm.
1338
+ */
1339
+ getRoles(): Role[];
1340
+ /**
1341
+ * Set all roles in the realm.
1342
+ */
1343
+ setRoles(roles: Role[]): Promise<void>;
1344
+ /**
1345
+ * Get a role by name, throws an error if not found.
1346
+ */
1347
+ getRoleByName(name: string): Role;
1348
+ parseToken(token: string): Promise<JWTPayload>;
1349
+ /**
1350
+ * Create a token for the subject.
1351
+ */
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
+ }>;
1310
1361
  }
1311
- //#endregion
1312
- //#region ../alepha/src/server/providers/NodeHttpServerProvider.d.ts
1313
- declare const envSchema$6: alepha1246.TObject<{
1314
- SERVER_PORT: alepha1246.TInteger;
1315
- SERVER_HOST: alepha1246.TString;
1316
- }>;
1317
- declare module "alepha" {
1318
- interface Env extends Partial<Static<typeof envSchema$6>> {}
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;
1319
1370
  }
1320
1371
  //#endregion
1321
- //#region ../alepha/src/server/index.d.ts
1322
- declare module "alepha" {
1323
- interface State {
1324
- "alepha.node.server"?: Server;
1325
- }
1326
- interface Hooks {
1327
- "action:onRequest": {
1328
- action: ActionDescriptor<RequestConfigSchema>;
1329
- request: ServerRequest;
1330
- options: ClientRequestOptions;
1331
- };
1332
- "action:onResponse": {
1333
- action: ActionDescriptor<RequestConfigSchema>;
1334
- request: ServerRequest;
1335
- options: ClientRequestOptions;
1336
- response: any;
1337
- };
1338
- "server:onRequest": {
1339
- route: ServerRoute;
1340
- request: ServerRequest;
1341
- };
1342
- "server:onError": {
1343
- route: ServerRoute;
1344
- request: ServerRequest;
1345
- error: Error;
1346
- };
1347
- "server:onSend": {
1348
- route: ServerRoute;
1349
- request: ServerRequest;
1350
- };
1351
- "server:onResponse": {
1352
- route: ServerRoute;
1353
- request: ServerRequest;
1354
- response: ServerResponse$1;
1355
- };
1356
- "client:onRequest": {
1357
- route: HttpAction;
1358
- config: ServerRequestConfigEntry;
1359
- options: ClientRequestOptions;
1360
- headers: Record<string, string>;
1361
- request: RequestInit;
1362
- };
1363
- "client:beforeFetch": {
1364
- url: string;
1365
- options: FetchOptions;
1366
- request: RequestInit;
1367
- };
1368
- "client:onError": {
1369
- route?: HttpAction;
1370
- error: HttpError;
1371
- };
1372
- "node:request": NodeRequestEvent;
1373
- "web:request": WebRequestEvent;
1374
- }
1372
+ //#region ../alepha/src/security/primitives/$serviceAccount.d.ts
1373
+ interface ServiceAccountPrimitive {
1374
+ token: () => Promise<string>;
1375
1375
  }
1376
1376
  //#endregion
1377
1377
  //#region ../alepha/src/security/providers/CryptoProvider.d.ts
@@ -1393,7 +1393,7 @@ declare module "alepha" {
1393
1393
  /**
1394
1394
  * Provides comprehensive authentication and authorization capabilities with JWT tokens, role-based access control, and user management.
1395
1395
  *
1396
- * The security module enables building secure applications using descriptors like `$realm`, `$role`, and `$permission`
1396
+ * The security module enables building secure applications using primitives like `$realm`, `$role`, and `$permission`
1397
1397
  * on class properties. It offers JWT-based authentication, fine-grained permissions, service accounts, and seamless
1398
1398
  * integration with various authentication providers and user management systems.
1399
1399
  *
@@ -1468,23 +1468,23 @@ declare module "alepha/server" {
1468
1468
  */
1469
1469
  //#endregion
1470
1470
  //#region ../alepha/src/server-links/schemas/apiLinksResponseSchema.d.ts
1471
- declare const apiLinkSchema: alepha1246.TObject<{
1472
- name: alepha1246.TString;
1473
- group: alepha1246.TOptional<alepha1246.TString>;
1474
- path: alepha1246.TString;
1475
- method: alepha1246.TOptional<alepha1246.TString>;
1476
- requestBodyType: alepha1246.TOptional<alepha1246.TString>;
1477
- service: alepha1246.TOptional<alepha1246.TString>;
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>;
1478
1478
  }>;
1479
- declare const apiLinksResponseSchema: alepha1246.TObject<{
1480
- prefix: alepha1246.TOptional<alepha1246.TString>;
1481
- links: alepha1246.TArray<alepha1246.TObject<{
1482
- name: alepha1246.TString;
1483
- group: alepha1246.TOptional<alepha1246.TString>;
1484
- path: alepha1246.TString;
1485
- method: alepha1246.TOptional<alepha1246.TString>;
1486
- requestBodyType: alepha1246.TOptional<alepha1246.TString>;
1487
- service: alepha1246.TOptional<alepha1246.TString>;
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>;
1488
1488
  }>>;
1489
1489
  }>;
1490
1490
  type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
@@ -1551,14 +1551,14 @@ interface ClientScope {
1551
1551
  service?: string;
1552
1552
  hostname?: string;
1553
1553
  }
1554
- type HttpVirtualClient<T$1> = { [K in keyof T$1 as T$1[K] extends ActionDescriptor<RequestConfigSchema> ? K : never]: T$1[K] extends ActionDescriptor<infer Schema> ? VirtualAction<Schema> : never };
1555
- interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<ActionDescriptor<T$1>, "name" | "run" | "fetch"> {
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"> {
1556
1556
  (config?: ClientRequestEntry<T$1>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T$1>>;
1557
1557
  can: () => boolean;
1558
1558
  }
1559
1559
  //#endregion
1560
- //#region ../alepha/src/server-proxy/descriptors/$proxy.d.ts
1561
- type ProxyDescriptorOptions = {
1560
+ //#region ../alepha/src/server-proxy/primitives/$proxy.d.ts
1561
+ type ProxyPrimitiveOptions = {
1562
1562
  /**
1563
1563
  * Path pattern to match for proxying requests.
1564
1564
  *
@@ -1680,14 +1680,14 @@ declare class ServerProxyProvider {
1680
1680
  protected readonly log: Logger;
1681
1681
  protected readonly routerProvider: ServerRouterProvider;
1682
1682
  protected readonly alepha: Alepha;
1683
- protected readonly configure: alepha1246.HookDescriptor<"configure">;
1684
- createProxy(options: ProxyDescriptorOptions): void;
1685
- createProxyHandler(target: string, options: Omit<ProxyDescriptorOptions, "path">): ServerHandler;
1683
+ protected readonly configure: alepha1672.HookPrimitive<"configure">;
1684
+ createProxy(options: ProxyPrimitiveOptions): void;
1685
+ createProxyHandler(target: string, options: Omit<ProxyPrimitiveOptions, "path">): ServerHandler;
1686
1686
  private getRawRequestBody;
1687
1687
  }
1688
1688
  //#endregion
1689
- //#region ../alepha/src/server-links/descriptors/$remote.d.ts
1690
- interface RemoteDescriptorOptions {
1689
+ //#region ../alepha/src/server-links/primitives/$remote.d.ts
1690
+ interface RemotePrimitiveOptions {
1691
1691
  /**
1692
1692
  * The URL of the remote service.
1693
1693
  * You can use a function to generate the URL dynamically.
@@ -1719,7 +1719,7 @@ interface RemoteDescriptorOptions {
1719
1719
  * If true, all methods of the remote service will be exposed as actions in this context.
1720
1720
  * > Note: Proxy will never use the service account, it just... proxies the request.
1721
1721
  */
1722
- proxy?: boolean | Partial<ProxyDescriptorOptions & {
1722
+ proxy?: boolean | Partial<ProxyPrimitiveOptions & {
1723
1723
  /**
1724
1724
  * If true, the remote service won't be available internally, only through the proxy.
1725
1725
  */
@@ -1729,9 +1729,9 @@ interface RemoteDescriptorOptions {
1729
1729
  * For communication between the server and the remote service with a security layer.
1730
1730
  * This will be used for internal communication and will not be exposed to the client.
1731
1731
  */
1732
- serviceAccount?: ServiceAccountDescriptor;
1732
+ serviceAccount?: ServiceAccountPrimitive;
1733
1733
  }
1734
- declare class RemoteDescriptor extends Descriptor<RemoteDescriptorOptions> {
1734
+ declare class RemotePrimitive extends Primitive<RemotePrimitiveOptions> {
1735
1735
  get name(): string;
1736
1736
  }
1737
1737
  //#endregion
@@ -1822,8 +1822,8 @@ declare class RetryProvider {
1822
1822
  protected calculateBackoff(attempt: number, options?: number | RetryBackoffOptions): number;
1823
1823
  }
1824
1824
  //#endregion
1825
- //#region ../alepha/src/retry/descriptors/$retry.d.ts
1826
- interface RetryDescriptorOptions<T$1 extends (...args: any[]) => any> {
1825
+ //#region ../alepha/src/retry/primitives/$retry.d.ts
1826
+ interface RetryPrimitiveOptions<T$1 extends (...args: any[]) => any> {
1827
1827
  /**
1828
1828
  * The function to retry.
1829
1829
  */
@@ -1863,18 +1863,18 @@ interface RetryDescriptorOptions<T$1 extends (...args: any[]) => any> {
1863
1863
  */
1864
1864
  signal?: AbortSignal;
1865
1865
  }
1866
- declare class RetryDescriptor<T$1 extends (...args: any[]) => any> extends Descriptor<RetryDescriptorOptions<T$1>> {
1866
+ declare class RetryPrimitive<T$1 extends (...args: any[]) => any> extends Primitive<RetryPrimitiveOptions<T$1>> {
1867
1867
  protected readonly retryProvider: RetryProvider;
1868
1868
  protected appAbortController?: AbortController;
1869
- constructor(args: DescriptorArgs<RetryDescriptorOptions<T$1>>);
1869
+ constructor(args: PrimitiveArgs<RetryPrimitiveOptions<T$1>>);
1870
1870
  run(...args: Parameters<T$1>): Promise<ReturnType<T$1>>;
1871
1871
  }
1872
- interface RetryDescriptorFn<T$1 extends (...args: any[]) => any> extends RetryDescriptor<T$1> {
1872
+ interface RetryPrimitiveFn<T$1 extends (...args: any[]) => any> extends RetryPrimitive<T$1> {
1873
1873
  (...args: Parameters<T$1>): Promise<ReturnType<T$1>>;
1874
1874
  }
1875
1875
  //#endregion
1876
- //#region ../alepha/src/server-links/providers/RemoteDescriptorProvider.d.ts
1877
- declare class RemoteDescriptorProvider {
1876
+ //#region ../alepha/src/server-links/providers/RemotePrimitiveProvider.d.ts
1877
+ declare class RemotePrimitiveProvider {
1878
1878
  protected readonly env: {
1879
1879
  SERVER_API_PREFIX: string;
1880
1880
  };
@@ -1884,10 +1884,10 @@ declare class RemoteDescriptorProvider {
1884
1884
  protected readonly remotes: Array<ServerRemote>;
1885
1885
  protected readonly log: Logger;
1886
1886
  getRemotes(): ServerRemote[];
1887
- readonly configure: alepha1246.HookDescriptor<"configure">;
1888
- readonly start: alepha1246.HookDescriptor<"start">;
1889
- registerRemote(value: RemoteDescriptor): Promise<void>;
1890
- protected readonly fetchLinks: RetryDescriptorFn<(opts: FetchLinksOptions) => Promise<ApiLinksResponse>>;
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>>;
1891
1891
  }
1892
1892
  interface FetchLinksOptions {
1893
1893
  /**
@@ -1936,7 +1936,7 @@ interface ServerRemote {
1936
1936
  /**
1937
1937
  * Force a default access token provider when not provided.
1938
1938
  */
1939
- serviceAccount?: ServiceAccountDescriptor;
1939
+ serviceAccount?: ServiceAccountPrimitive;
1940
1940
  /**
1941
1941
  * Prefix for the remote service links.
1942
1942
  */
@@ -1950,25 +1950,25 @@ declare class ServerLinksProvider {
1950
1950
  };
1951
1951
  protected readonly alepha: Alepha;
1952
1952
  protected readonly linkProvider: LinkProvider;
1953
- protected readonly remoteProvider: RemoteDescriptorProvider;
1953
+ protected readonly remoteProvider: RemotePrimitiveProvider;
1954
1954
  protected readonly serverTimingProvider: ServerTimingProvider;
1955
1955
  get prefix(): string;
1956
- readonly onRoute: alepha1246.HookDescriptor<"configure">;
1956
+ readonly onRoute: alepha1672.HookPrimitive<"configure">;
1957
1957
  /**
1958
1958
  * First API - Get all API links for the user.
1959
1959
  *
1960
1960
  * This is based on the user's permissions.
1961
1961
  */
1962
- readonly links: RouteDescriptor<{
1963
- response: alepha1246.TObject<{
1964
- prefix: alepha1246.TOptional<alepha1246.TString>;
1965
- links: alepha1246.TArray<alepha1246.TObject<{
1966
- name: alepha1246.TString;
1967
- group: alepha1246.TOptional<alepha1246.TString>;
1968
- path: alepha1246.TString;
1969
- method: alepha1246.TOptional<alepha1246.TString>;
1970
- requestBodyType: alepha1246.TOptional<alepha1246.TString>;
1971
- service: alepha1246.TOptional<alepha1246.TString>;
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>;
1972
1972
  }>>;
1973
1973
  }>;
1974
1974
  }>;
@@ -1978,11 +1978,11 @@ declare class ServerLinksProvider {
1978
1978
  * Note: Body/Response schema are not included in `links` API because it's TOO BIG.
1979
1979
  * I mean for 150+ links, you got 50ms of serialization time.
1980
1980
  */
1981
- readonly schema: RouteDescriptor<{
1982
- params: alepha1246.TObject<{
1983
- name: alepha1246.TString;
1981
+ readonly schema: RoutePrimitive<{
1982
+ params: alepha1672.TObject<{
1983
+ name: alepha1672.TString;
1984
1984
  }>;
1985
- response: alepha1246.TRecord<string, alepha1246.TAny>;
1985
+ response: alepha1672.TRecord<string, alepha1672.TAny>;
1986
1986
  }>;
1987
1987
  getSchemaByName(name: string, options?: GetApiLinksOptions): Promise<RequestConfigSchema>;
1988
1988
  /**
@@ -2011,7 +2011,7 @@ declare module "alepha" {
2011
2011
  /**
2012
2012
  * Provides server-side link management and remote capabilities for client-server interactions.
2013
2013
  *
2014
- * The server-links module enables declarative link definitions using `$remote` and `$client` descriptors,
2014
+ * The server-links module enables declarative link definitions using `$remote` and `$client` primitives,
2015
2015
  * facilitating seamless API endpoint management and client-server communication. It integrates with server
2016
2016
  * security features to ensure safe and controlled access to resources.
2017
2017
  *
@@ -2032,7 +2032,7 @@ declare module "alepha/server" {
2032
2032
  */
2033
2033
  cache?: ServerRouteCache;
2034
2034
  }
2035
- interface ActionDescriptor<TConfig extends RequestConfigSchema> {
2035
+ interface ActionPrimitive<TConfig extends RequestConfigSchema> {
2036
2036
  invalidate: () => Promise<void>;
2037
2037
  }
2038
2038
  }
@@ -2051,11 +2051,11 @@ boolean
2051
2051
  /**
2052
2052
  * If true, enables storing cached responses. (in-memory, Redis, @see alepha/cache for other providers)
2053
2053
  * If a DurationLike is provided, it will be used as the TTL for the cache.
2054
- * If CacheDescriptorOptions is provided, it will be used to configure the cache storage.
2054
+ * If CachePrimitiveOptions is provided, it will be used to configure the cache storage.
2055
2055
  *
2056
2056
  * @default false
2057
2057
  */
2058
- store?: true | DurationLike | CacheDescriptorOptions;
2058
+ store?: true | DurationLike | CachePrimitiveOptions;
2059
2059
  /**
2060
2060
  * If true, enables ETag support for the cached responses.
2061
2061
  */
@@ -2135,13 +2135,13 @@ declare class Redirection extends Error {
2135
2135
  }
2136
2136
  //#endregion
2137
2137
  //#region ../react/src/core/providers/ReactPageProvider.d.ts
2138
- declare const envSchema$5: alepha1246.TObject<{
2139
- REACT_STRICT_MODE: alepha1246.TBoolean;
2138
+ declare const envSchema$5: alepha1672.TObject<{
2139
+ REACT_STRICT_MODE: alepha1672.TBoolean;
2140
2140
  }>;
2141
2141
  declare module "alepha" {
2142
2142
  interface Env extends Partial<Static<typeof envSchema$5>> {}
2143
2143
  }
2144
- interface PageRouteEntry extends Omit<PageDescriptorOptions, "children" | "parent"> {
2144
+ interface PageRouteEntry extends Omit<PagePrimitiveOptions, "children" | "parent"> {
2145
2145
  children?: PageRouteEntry[];
2146
2146
  }
2147
2147
  interface PageRoute extends PageRouteEntry {
@@ -2196,19 +2196,19 @@ interface ReactRouterState {
2196
2196
  //#endregion
2197
2197
  //#region ../react/src/core/services/ReactPageService.d.ts
2198
2198
  declare class ReactPageService {
2199
- fetch(pathname: string, options?: PageDescriptorRenderOptions): Promise<{
2199
+ fetch(pathname: string, options?: PagePrimitiveRenderOptions): Promise<{
2200
2200
  html: string;
2201
2201
  response: Response;
2202
2202
  }>;
2203
- render(name: string, options?: PageDescriptorRenderOptions): Promise<PageDescriptorRenderResult>;
2203
+ render(name: string, options?: PagePrimitiveRenderOptions): Promise<PagePrimitiveRenderResult>;
2204
2204
  }
2205
2205
  //#endregion
2206
- //#region ../react/src/core/descriptors/$page.d.ts
2207
- interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
2206
+ //#region ../react/src/core/primitives/$page.d.ts
2207
+ interface PagePrimitiveOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
2208
2208
  /**
2209
2209
  * Identifier name for the page. Must be unique.
2210
2210
  *
2211
- * @default Descriptor key
2211
+ * @default Primitive key
2212
2212
  */
2213
2213
  name?: string;
2214
2214
  /**
@@ -2260,11 +2260,11 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
2260
2260
  * Attach child pages to create nested routes.
2261
2261
  * This will make the page a parent route.
2262
2262
  */
2263
- children?: Array<PageDescriptor> | (() => Array<PageDescriptor>);
2263
+ children?: Array<PagePrimitive> | (() => Array<PagePrimitive>);
2264
2264
  /**
2265
2265
  * Define a parent page for nested routing.
2266
2266
  */
2267
- parent?: PageDescriptor<PageConfigSchema, TPropsParent, any>;
2267
+ parent?: PagePrimitive<PageConfigSchema, TPropsParent, any>;
2268
2268
  can?: () => boolean;
2269
2269
  /**
2270
2270
  * Catch any error from the `resolve` function or during `rendering`.
@@ -2374,7 +2374,7 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
2374
2374
  animation?: PageAnimation;
2375
2375
  }
2376
2376
  type ErrorHandler = (error: Error, state: ReactRouterState) => ReactNode | Redirection | undefined;
2377
- declare class PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> extends Descriptor<PageDescriptorOptions<TConfig, TProps, TPropsParent>> {
2377
+ declare class PagePrimitive<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> extends Primitive<PagePrimitiveOptions<TConfig, TProps, TPropsParent>> {
2378
2378
  protected readonly reactPageService: ReactPageService;
2379
2379
  protected onInit(): void;
2380
2380
  get name(): string;
@@ -2384,8 +2384,8 @@ declare class PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema
2384
2384
  * This will render the page (HTML layout included or not) and return the HTML + context.
2385
2385
  * Only valid for server-side rendering, it will throw an error if called on the client-side.
2386
2386
  */
2387
- render(options?: PageDescriptorRenderOptions): Promise<PageDescriptorRenderResult>;
2388
- fetch(options?: PageDescriptorRenderOptions): Promise<{
2387
+ render(options?: PagePrimitiveRenderOptions): Promise<PagePrimitiveRenderResult>;
2388
+ fetch(options?: PagePrimitiveRenderOptions): Promise<{
2389
2389
  html: string;
2390
2390
  response: Response;
2391
2391
  }>;
@@ -2398,7 +2398,7 @@ interface PageConfigSchema {
2398
2398
  }
2399
2399
  type TPropsDefault = any;
2400
2400
  type TPropsParentDefault = {};
2401
- interface PageDescriptorRenderOptions {
2401
+ interface PagePrimitiveRenderOptions {
2402
2402
  params?: Record<string, string>;
2403
2403
  query?: Record<string, string>;
2404
2404
  /**
@@ -2410,7 +2410,7 @@ interface PageDescriptorRenderOptions {
2410
2410
  html?: boolean;
2411
2411
  hydration?: boolean;
2412
2412
  }
2413
- interface PageDescriptorRenderResult {
2413
+ interface PagePrimitiveRenderResult {
2414
2414
  html: string;
2415
2415
  state: ReactRouterState;
2416
2416
  redirect?: string;
@@ -2433,8 +2433,8 @@ type CssAnimation = {
2433
2433
  };
2434
2434
  //#endregion
2435
2435
  //#region ../react/src/core/providers/ReactBrowserProvider.d.ts
2436
- declare const envSchema$4: alepha1246.TObject<{
2437
- REACT_ROOT_ID: alepha1246.TString;
2436
+ declare const envSchema$4: alepha1672.TObject<{
2437
+ REACT_ROOT_ID: alepha1672.TString;
2438
2438
  }>;
2439
2439
  declare module "alepha" {
2440
2440
  interface Env extends Partial<Static<typeof envSchema$4>> {}
@@ -2442,8 +2442,8 @@ declare module "alepha" {
2442
2442
  /**
2443
2443
  * React browser renderer configuration atom
2444
2444
  */
2445
- declare const reactBrowserOptions: alepha1246.Atom<alepha1246.TObject<{
2446
- scrollRestoration: alepha1246.TUnsafe<"top" | "manual">;
2445
+ declare const reactBrowserOptions: alepha1672.Atom<alepha1672.TObject<{
2446
+ scrollRestoration: alepha1672.TUnsafe<"top" | "manual">;
2447
2447
  }>, "alepha.react.browser.options">;
2448
2448
  type ReactBrowserRendererOptions = Static<typeof reactBrowserOptions.schema>;
2449
2449
  declare module "alepha" {
@@ -2854,10 +2854,10 @@ declare class FileDetector {
2854
2854
  }
2855
2855
  //#endregion
2856
2856
  //#region ../react/src/core/providers/ReactServerProvider.d.ts
2857
- declare const envSchema$3: alepha1246.TObject<{
2858
- REACT_SSR_ENABLED: alepha1246.TOptional<alepha1246.TBoolean>;
2859
- REACT_ROOT_ID: alepha1246.TString;
2860
- REACT_SERVER_TEMPLATE: alepha1246.TOptional<alepha1246.TString>;
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>;
2861
2861
  }>;
2862
2862
  declare module "alepha" {
2863
2863
  interface Env extends Partial<Static<typeof envSchema$3>> {}
@@ -2868,11 +2868,11 @@ declare module "alepha" {
2868
2868
  /**
2869
2869
  * React server provider configuration atom
2870
2870
  */
2871
- declare const reactServerOptions: alepha1246.Atom<alepha1246.TObject<{
2872
- publicDir: alepha1246.TString;
2873
- staticServer: alepha1246.TObject<{
2874
- disabled: alepha1246.TBoolean;
2875
- path: alepha1246.TString;
2871
+ declare const reactServerOptions: alepha1672.Atom<alepha1672.TObject<{
2872
+ publicDir: alepha1672.TString;
2873
+ staticServer: alepha1672.TObject<{
2874
+ disabled: alepha1672.TBoolean;
2875
+ path: alepha1672.TString;
2876
2876
  }>;
2877
2877
  }>, "alepha.react.server.options">;
2878
2878
  type ReactServerProviderOptions = Static<typeof reactServerOptions.schema>;
@@ -2977,7 +2977,7 @@ declare module "alepha" {
2977
2977
  /**
2978
2978
  * Provides full-stack React development with declarative routing, server-side rendering, and client-side hydration.
2979
2979
  *
2980
- * The React module enables building modern React applications using the `$page` descriptor on class properties.
2980
+ * The React module enables building modern React applications using the `$page` primitive on class properties.
2981
2981
  * It delivers seamless server-side rendering, automatic code splitting, and client-side navigation with full
2982
2982
  * type safety and schema validation for route parameters and data.
2983
2983
  *
@@ -2986,25 +2986,25 @@ declare module "alepha" {
2986
2986
  */
2987
2987
  //#endregion
2988
2988
  //#region ../alepha/src/api-users/atoms/realmAuthSettingsAtom.d.ts
2989
- declare const realmAuthSettingsAtom: alepha1246.Atom<alepha1246.TObject<{
2990
- registrationAllowed: alepha1246.TBoolean;
2991
- emailEnabled: alepha1246.TBoolean;
2992
- emailRequired: alepha1246.TBoolean;
2993
- usernameEnabled: alepha1246.TBoolean;
2994
- usernameRequired: alepha1246.TBoolean;
2995
- phoneEnabled: alepha1246.TBoolean;
2996
- phoneRequired: alepha1246.TBoolean;
2997
- verifyEmailRequired: alepha1246.TBoolean;
2998
- verifyPhoneRequired: alepha1246.TBoolean;
2999
- firstNameLastNameEnabled: alepha1246.TBoolean;
3000
- firstNameLastNameRequired: alepha1246.TBoolean;
3001
- resetPasswordAllowed: alepha1246.TBoolean;
3002
- passwordPolicy: alepha1246.TObject<{
3003
- minLength: alepha1246.TInteger;
3004
- requireUppercase: alepha1246.TBoolean;
3005
- requireLowercase: alepha1246.TBoolean;
3006
- requireNumbers: alepha1246.TBoolean;
3007
- requireSpecialCharacters: alepha1246.TBoolean;
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;
3008
3008
  }>;
3009
3009
  }>, "alepha.api.users.realmAuthSettings">;
3010
3010
  type RealmAuthSettings = Static<typeof realmAuthSettingsAtom.schema>;
@@ -3036,8 +3036,8 @@ type TObjectInsert<T$1 extends TObject> = TObject<{ [K in keyof T$1["properties"
3036
3036
  */
3037
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] }>;
3038
3038
  //#endregion
3039
- //#region ../alepha/src/orm/descriptors/$entity.d.ts
3040
- interface EntityDescriptorOptions<T$1 extends TObject, Keys = keyof Static<T$1>> {
3039
+ //#region ../alepha/src/orm/primitives/$entity.d.ts
3040
+ interface EntityPrimitiveOptions<T$1 extends TObject, Keys = keyof Static<T$1>> {
3041
3041
  /**
3042
3042
  * The database table name that will be created for this entity.
3043
3043
  * If not provided, name will be inferred from the $repository variable name.
@@ -3149,9 +3149,9 @@ interface EntityDescriptorOptions<T$1 extends TObject, Keys = keyof Static<T$1>>
3149
3149
  */
3150
3150
  config?: (self: BuildExtraConfigColumns<string, FromSchema<T$1>, "pg">) => PgTableExtraConfigValue[];
3151
3151
  }
3152
- declare class EntityDescriptor<T$1 extends TObject = TObject> {
3153
- readonly options: EntityDescriptorOptions<T$1>;
3154
- constructor(options: EntityDescriptorOptions<T$1>);
3152
+ declare class EntityPrimitive<T$1 extends TObject = TObject> {
3153
+ readonly options: EntityPrimitiveOptions<T$1>;
3154
+ constructor(options: EntityPrimitiveOptions<T$1>);
3155
3155
  alias(alias: string): this;
3156
3156
  get cols(): EntityColumns<T$1>;
3157
3157
  get name(): string;
@@ -3171,7 +3171,7 @@ type SchemaToTableConfig<T$1 extends TObject> = {
3171
3171
  };
3172
3172
  type EntityColumn<T$1 extends TObject> = {
3173
3173
  name: string;
3174
- entity: EntityDescriptor<T$1>;
3174
+ entity: EntityPrimitive<T$1>;
3175
3175
  };
3176
3176
  type EntityColumns<T$1 extends TObject> = { [key in keyof T$1["properties"]]: EntityColumn<T$1> };
3177
3177
  //#endregion
@@ -3217,7 +3217,7 @@ interface PgEnumOptions {
3217
3217
  interface PgRefOptions {
3218
3218
  ref: () => {
3219
3219
  name: string;
3220
- entity: EntityDescriptor;
3220
+ entity: EntityPrimitive;
3221
3221
  };
3222
3222
  actions?: {
3223
3223
  onUpdate?: UpdateDeleteAction;
@@ -3231,19 +3231,6 @@ declare class DbError extends AlephaError {
3231
3231
  constructor(message: string, cause?: unknown);
3232
3232
  }
3233
3233
  //#endregion
3234
- //#region ../alepha/src/orm/helpers/pgAttr.d.ts
3235
- /**
3236
- * Type representation.
3237
- */
3238
- type PgAttr<T$1 extends TSchema, TAttr extends PgSymbolKeys> = T$1 & { [K in TAttr]: PgSymbols[K] };
3239
- interface PgAttrField {
3240
- key: string;
3241
- type: TSchema;
3242
- data: any;
3243
- nested?: any[];
3244
- one?: boolean;
3245
- }
3246
- //#endregion
3247
3234
  //#region ../alepha/src/orm/interfaces/FilterOperators.d.ts
3248
3235
  interface FilterOperators<TValue> {
3249
3236
  /**
@@ -3660,6 +3647,55 @@ interface FilterOperators<TValue> {
3660
3647
  arrayOverlaps?: TValue;
3661
3648
  }
3662
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
3663
3699
  //#region ../alepha/src/orm/interfaces/PgQueryWhere.d.ts
3664
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>);
3665
3701
  type PgQueryWhereOrSQL<T$1 extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = SQLWrapper | PgQueryWhere<T$1, Relations>;
@@ -3739,64 +3775,28 @@ type PgQueryWhereRelations<Relations extends PgRelationMap<TObject> | undefined
3739
3775
  */
3740
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;
3741
3777
  //#endregion
3742
- //#region ../alepha/src/orm/interfaces/PgQuery.d.ts
3743
- /**
3744
- * Order direction for sorting
3745
- */
3746
- type OrderDirection = "asc" | "desc";
3747
- /**
3748
- * Single order by clause with column and direction
3749
- */
3750
- interface OrderByClause<T$1> {
3751
- column: keyof T$1;
3752
- direction?: OrderDirection;
3753
- }
3754
- /**
3755
- * Order by parameter - supports 3 modes:
3756
- * 1. String: orderBy: "name" (defaults to ASC)
3757
- * 2. Single object: orderBy: { column: "name", direction: "desc" }
3758
- * 3. Array: orderBy: [{ column: "name", direction: "asc" }, { column: "age", direction: "desc" }]
3759
- */
3760
- type OrderBy<T$1> = keyof T$1 | OrderByClause<T$1> | Array<OrderByClause<T$1>>;
3778
+ //#region ../alepha/src/orm/helpers/pgAttr.d.ts
3761
3779
  /**
3762
- * Generic query interface for PostgreSQL entities
3780
+ * Type representation.
3763
3781
  */
3764
- interface PgQuery<T$1 extends TObject = TObject> {
3765
- distinct?: (keyof Static<T$1>)[];
3766
- columns?: (keyof Static<T$1>)[];
3767
- where?: PgQueryWhereOrSQL<T$1>;
3768
- limit?: number;
3769
- offset?: number;
3770
- orderBy?: OrderBy<Static<T$1>>;
3771
- groupBy?: (keyof Static<T$1>)[];
3772
- }
3773
- 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"]> : {}) };
3774
- interface PgQueryRelations<T$1 extends TObject = TObject, Relations extends PgRelationMap<T$1> | undefined = undefined> extends PgQuery<T$1> {
3775
- with?: Relations;
3776
- 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;
3777
3789
  }
3778
- type PgRelationMap<Base extends TObject> = Record<string, PgRelation<Base>>;
3779
- type PgRelation<Base extends TObject> = {
3780
- type?: "left" | "inner" | "right";
3781
- join: {
3782
- schema: TObject;
3783
- name: string;
3784
- };
3785
- on: SQLWrapper | [keyof Static<Base>, {
3786
- name: string;
3787
- }];
3788
- with?: PgRelationMap<TObject>;
3789
- };
3790
3790
  //#endregion
3791
- //#region ../alepha/src/orm/descriptors/$sequence.d.ts
3792
- interface SequenceDescriptorOptions extends PgSequenceOptions {
3791
+ //#region ../alepha/src/orm/primitives/$sequence.d.ts
3792
+ interface SequencePrimitiveOptions extends PgSequenceOptions {
3793
3793
  /**
3794
3794
  * The name of the sequence. If not provided, the property key will be used.
3795
3795
  */
3796
3796
  name?: string;
3797
3797
  provider?: DatabaseProvider;
3798
3798
  }
3799
- declare class SequenceDescriptor extends Descriptor<SequenceDescriptorOptions> {
3799
+ declare class SequencePrimitive extends Primitive<SequencePrimitiveOptions> {
3800
3800
  readonly provider: DatabaseProvider;
3801
3801
  onInit(): void;
3802
3802
  get name(): string;
@@ -3827,22 +3827,22 @@ interface TableConfigBuilders<TConfig> {
3827
3827
  }) => TConfig;
3828
3828
  }
3829
3829
  /**
3830
- * Abstract base class for transforming Alepha Descriptors (Entity, Sequence, etc...)
3830
+ * Abstract base class for transforming Alepha Primitives (Entity, Sequence, etc...)
3831
3831
  * into drizzle models (tables, enums, sequences, etc...).
3832
3832
  */
3833
3833
  declare abstract class ModelBuilder {
3834
3834
  /**
3835
- * Build a table from an entity descriptor.
3835
+ * Build a table from an entity primitive.
3836
3836
  */
3837
- abstract buildTable(entity: EntityDescriptor, options: {
3837
+ abstract buildTable(entity: EntityPrimitive, options: {
3838
3838
  tables: Map<string, unknown>;
3839
3839
  enums: Map<string, unknown>;
3840
3840
  schema: string;
3841
3841
  }): void;
3842
3842
  /**
3843
- * Build a sequence from a sequence descriptor.
3843
+ * Build a sequence from a sequence primitive.
3844
3844
  */
3845
- abstract buildSequence(sequence: SequenceDescriptor, options: {
3845
+ abstract buildSequence(sequence: SequencePrimitive, options: {
3846
3846
  sequences: Map<string, unknown>;
3847
3847
  schema: string;
3848
3848
  }): void;
@@ -3854,12 +3854,12 @@ declare abstract class ModelBuilder {
3854
3854
  * Build the table configuration function for any database.
3855
3855
  * This includes indexes, foreign keys, constraints, and custom config.
3856
3856
  *
3857
- * @param entity - The entity descriptor
3857
+ * @param entity - The entity primitive
3858
3858
  * @param builders - Database-specific builder functions
3859
3859
  * @param tableResolver - Function to resolve entity references to table columns
3860
3860
  * @param customConfigHandler - Optional handler for custom config
3861
3861
  */
3862
- protected buildTableConfig<TConfig, TSelf>(entity: EntityDescriptor, builders: TableConfigBuilders<TConfig>, tableResolver?: (entityName: string) => any, customConfigHandler?: (config: any, self: TSelf) => TConfig[]): ((self: TSelf) => TConfig[]) | undefined;
3862
+ protected buildTableConfig<TConfig, TSelf>(entity: EntityPrimitive, builders: TableConfigBuilders<TConfig>, tableResolver?: (entityName: string) => any, customConfigHandler?: (config: any, self: TSelf) => TConfig[]): ((self: TSelf) => TConfig[]) | undefined;
3863
3863
  }
3864
3864
  //#endregion
3865
3865
  //#region ../alepha/src/orm/providers/DrizzleKitProvider.d.ts
@@ -3900,11 +3900,11 @@ declare class DrizzleKitProvider {
3900
3900
  */
3901
3901
  importDrizzleKit(): typeof DrizzleKit;
3902
3902
  }
3903
- declare const devMigrationsSchema: alepha1246.TObject<{
3904
- id: alepha1246.TNumber;
3905
- name: alepha1246.TString;
3906
- snapshot: alepha1246.TString;
3907
- created_at: alepha1246.TString;
3903
+ declare const devMigrationsSchema: alepha1672.TObject<{
3904
+ id: alepha1672.TNumber;
3905
+ name: alepha1672.TString;
3906
+ snapshot: alepha1672.TString;
3907
+ created_at: alepha1672.TString;
3908
3908
  }>;
3909
3909
  type DevMigrations = Static<typeof devMigrationsSchema>;
3910
3910
  //#endregion
@@ -3923,9 +3923,9 @@ declare abstract class DatabaseProvider {
3923
3923
  readonly sequences: Map<string, unknown>;
3924
3924
  get name(): string;
3925
3925
  get schema(): string;
3926
- table<T$1 extends TObject>(entity: EntityDescriptor<T$1>): PgTableWithColumns<SchemaToTableConfig<T$1>>;
3927
- registerEntity(entity: EntityDescriptor): void;
3928
- registerSequence(sequence: SequenceDescriptor): void;
3926
+ table<T$1 extends TObject>(entity: EntityPrimitive<T$1>): PgTableWithColumns<SchemaToTableConfig<T$1>>;
3927
+ registerEntity(entity: EntityPrimitive): void;
3928
+ registerSequence(sequence: SequencePrimitive): void;
3929
3929
  abstract execute(statement: SQLLike): Promise<Record<string, unknown>[]>;
3930
3930
  run<T$1 extends TObject>(statement: SQLLike, schema: T$1): Promise<Array<Static<T$1>>>;
3931
3931
  /**
@@ -4101,7 +4101,7 @@ declare class QueryManager {
4101
4101
  createPagination<T$1>(entities: T$1[], limit?: number, offset?: number, sort?: Array<{
4102
4102
  column: string;
4103
4103
  direction: "asc" | "desc";
4104
- }>): alepha1246.Page<T$1>;
4104
+ }>): alepha1672.Page<T$1>;
4105
4105
  }
4106
4106
  interface PgJoin {
4107
4107
  table: string;
@@ -4133,13 +4133,13 @@ declare class PgRelationManager {
4133
4133
  //#endregion
4134
4134
  //#region ../alepha/src/orm/services/Repository.d.ts
4135
4135
  declare abstract class Repository<T$1 extends TObject> {
4136
- readonly entity: EntityDescriptor<T$1>;
4136
+ readonly entity: EntityPrimitive<T$1>;
4137
4137
  readonly provider: DatabaseProvider;
4138
4138
  protected readonly relationManager: PgRelationManager;
4139
4139
  protected readonly queryManager: QueryManager;
4140
4140
  protected readonly dateTimeProvider: DateTimeProvider;
4141
4141
  protected readonly alepha: Alepha;
4142
- constructor(entity: EntityDescriptor<T$1>, provider?: typeof DatabaseProvider);
4142
+ constructor(entity: EntityPrimitive<T$1>, provider?: typeof DatabaseProvider);
4143
4143
  /**
4144
4144
  * Represents the primary key of the table.
4145
4145
  * - Key is the name of the primary key column.
@@ -4405,9 +4405,9 @@ interface StatementOptions {
4405
4405
  now?: DateTime | string;
4406
4406
  }
4407
4407
  //#endregion
4408
- //#region ../alepha/src/lock/descriptors/$lock.d.ts
4409
- declare const envSchema$2: alepha1246.TObject<{
4410
- LOCK_PREFIX_KEY: alepha1246.TString;
4408
+ //#region ../alepha/src/lock/primitives/$lock.d.ts
4409
+ declare const envSchema$2: alepha1672.TObject<{
4410
+ LOCK_PREFIX_KEY: alepha1672.TString;
4411
4411
  }>;
4412
4412
  declare module "alepha" {
4413
4413
  interface Env extends Partial<Static<typeof envSchema$2>> {}
@@ -4417,7 +4417,7 @@ declare module "alepha" {
4417
4417
  declare module "alepha" {
4418
4418
  interface Env extends Partial<Static<typeof envSchema$1>> {}
4419
4419
  }
4420
- declare const envSchema$1: alepha1246.TObject<{
4420
+ declare const envSchema$1: alepha1672.TObject<{
4421
4421
  /**
4422
4422
  * Main configuration for database connection.
4423
4423
  * Accept a string in the format of a Postgres connection URL.
@@ -4425,21 +4425,21 @@ declare const envSchema$1: alepha1246.TObject<{
4425
4425
  * or
4426
4426
  * Example: postgres://user:password@localhost:5432/database?sslmode=require
4427
4427
  */
4428
- DATABASE_URL: alepha1246.TOptional<alepha1246.TString>;
4428
+ DATABASE_URL: alepha1672.TOptional<alepha1672.TString>;
4429
4429
  /**
4430
4430
  * In addition to the DATABASE_URL, you can specify the postgres schema name.
4431
4431
  *
4432
4432
  * It will monkey patch drizzle tables.
4433
4433
  */
4434
- POSTGRES_SCHEMA: alepha1246.TOptional<alepha1246.TString>;
4434
+ POSTGRES_SCHEMA: alepha1672.TOptional<alepha1672.TString>;
4435
4435
  }>;
4436
4436
  //#endregion
4437
4437
  //#region ../alepha/src/orm/providers/drivers/NodeSqliteProvider.d.ts
4438
4438
  /**
4439
4439
  * Configuration options for the Node.js SQLite database provider.
4440
4440
  */
4441
- declare const nodeSqliteOptions: alepha1246.Atom<alepha1246.TObject<{
4442
- path: alepha1246.TOptional<alepha1246.TString>;
4441
+ declare const nodeSqliteOptions: alepha1672.Atom<alepha1672.TObject<{
4442
+ path: alepha1672.TOptional<alepha1672.TString>;
4443
4443
  }>, "alepha.postgres.node-sqlite.options">;
4444
4444
  type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
4445
4445
  declare module "alepha" {
@@ -4523,16 +4523,16 @@ declare module "alepha" {
4523
4523
  }
4524
4524
  //#endregion
4525
4525
  //#region ../alepha/src/api-users/entities/identities.d.ts
4526
- declare const identities: EntityDescriptor<alepha1246.TObject<{
4527
- id: PgAttr<PgAttr<alepha1246.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
4528
- version: PgAttr<PgAttr<alepha1246.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
4529
- createdAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
4530
- updatedAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
4531
- userId: PgAttr<alepha1246.TString, typeof PG_REF>;
4532
- password: alepha1246.TOptional<alepha1246.TString>;
4533
- provider: alepha1246.TString;
4534
- providerUserId: alepha1246.TOptional<alepha1246.TString>;
4535
- providerData: alepha1246.TOptional<alepha1246.TRecord<string, alepha1246.TAny>>;
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>>;
4536
4536
  }>>;
4537
4537
  //#endregion
4538
4538
  //#region ../alepha/src/bucket/providers/FileStorageProvider.d.ts
@@ -4583,8 +4583,8 @@ declare class MemoryFileStorageProvider implements FileStorageProvider {
4583
4583
  protected createId(): string;
4584
4584
  }
4585
4585
  //#endregion
4586
- //#region ../alepha/src/bucket/descriptors/$bucket.d.ts
4587
- interface BucketDescriptorOptions extends BucketFileOptions {
4586
+ //#region ../alepha/src/bucket/primitives/$bucket.d.ts
4587
+ interface BucketPrimitiveOptions extends BucketFileOptions {
4588
4588
  /**
4589
4589
  * File storage provider configuration for the bucket.
4590
4590
  *
@@ -4716,7 +4716,7 @@ interface BucketFileOptions {
4716
4716
  */
4717
4717
  maxSize?: number;
4718
4718
  }
4719
- declare class BucketDescriptor extends Descriptor<BucketDescriptorOptions> {
4719
+ declare class BucketPrimitive extends Primitive<BucketPrimitiveOptions> {
4720
4720
  readonly provider: FileStorageProvider | MemoryFileStorageProvider;
4721
4721
  private readonly fileSystem;
4722
4722
  get name(): string;
@@ -4759,8 +4759,8 @@ interface BucketFileOptions {
4759
4759
  /**
4760
4760
  * Local file storage configuration atom
4761
4761
  */
4762
- declare const localFileStorageOptions: alepha1246.Atom<alepha1246.TObject<{
4763
- storagePath: alepha1246.TString;
4762
+ declare const localFileStorageOptions: alepha1672.Atom<alepha1672.TObject<{
4763
+ storagePath: alepha1672.TString;
4764
4764
  }>, "alepha.bucket.local.options">;
4765
4765
  type LocalFileStorageProviderOptions = Static<typeof localFileStorageOptions.schema>;
4766
4766
  declare module "alepha" {
@@ -4779,7 +4779,7 @@ declare module "alepha" {
4779
4779
  "bucket:file:uploaded": {
4780
4780
  id: string;
4781
4781
  file: FileLike;
4782
- bucket: BucketDescriptor;
4782
+ bucket: BucketPrimitive;
4783
4783
  options: BucketFileOptions;
4784
4784
  };
4785
4785
  /**
@@ -4787,14 +4787,14 @@ declare module "alepha" {
4787
4787
  */
4788
4788
  "bucket:file:deleted": {
4789
4789
  id: string;
4790
- bucket: BucketDescriptor;
4790
+ bucket: BucketPrimitive;
4791
4791
  };
4792
4792
  }
4793
4793
  }
4794
4794
  /**
4795
- * Provides file storage capabilities through declarative bucket descriptors with support for multiple storage backends.
4795
+ * Provides file storage capabilities through declarative bucket primitives with support for multiple storage backends.
4796
4796
  *
4797
- * The bucket module enables unified file operations across different storage systems using the `$bucket` descriptor
4797
+ * The bucket module enables unified file operations across different storage systems using the `$bucket` primitive
4798
4798
  * on class properties. It abstracts storage provider differences, offering consistent APIs for local filesystem,
4799
4799
  * cloud storage, or in-memory storage for testing environments.
4800
4800
  *
@@ -4804,38 +4804,38 @@ declare module "alepha" {
4804
4804
  */
4805
4805
  //#endregion
4806
4806
  //#region ../alepha/src/api-users/entities/sessions.d.ts
4807
- declare const sessions: EntityDescriptor<alepha1246.TObject<{
4808
- id: PgAttr<PgAttr<alepha1246.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
4809
- version: PgAttr<PgAttr<alepha1246.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
4810
- createdAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
4811
- updatedAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
4812
- refreshToken: alepha1246.TString;
4813
- userId: PgAttr<alepha1246.TString, typeof PG_REF>;
4814
- expiresAt: alepha1246.TString;
4815
- ip: alepha1246.TOptional<alepha1246.TString>;
4816
- userAgent: alepha1246.TOptional<alepha1246.TObject<{
4817
- os: alepha1246.TString;
4818
- browser: alepha1246.TString;
4819
- device: alepha1246.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
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">;
4820
4820
  }>>;
4821
4821
  }>>;
4822
4822
  //#endregion
4823
4823
  //#region ../alepha/src/api-users/entities/users.d.ts
4824
- declare const users: EntityDescriptor<alepha1246.TObject<{
4825
- id: PgAttr<PgAttr<alepha1246.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
4826
- version: PgAttr<PgAttr<alepha1246.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
4827
- createdAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
4828
- updatedAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
4829
- realm: PgAttr<alepha1246.TString, typeof PG_DEFAULT>;
4830
- username: alepha1246.TOptional<alepha1246.TString>;
4831
- email: alepha1246.TOptional<alepha1246.TString>;
4832
- phoneNumber: alepha1246.TOptional<alepha1246.TString>;
4833
- roles: PgAttr<alepha1246.TArray<alepha1246.TString>, typeof PG_DEFAULT>;
4834
- firstName: alepha1246.TOptional<alepha1246.TString>;
4835
- lastName: alepha1246.TOptional<alepha1246.TString>;
4836
- picture: alepha1246.TOptional<alepha1246.TString>;
4837
- enabled: PgAttr<alepha1246.TBoolean, typeof PG_DEFAULT>;
4838
- emailVerified: PgAttr<alepha1246.TBoolean, typeof PG_DEFAULT>;
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>;
4839
4839
  }>>;
4840
4840
  //#endregion
4841
4841
  //#region ../alepha/src/api-users/providers/UserRealmProvider.d.ts
@@ -4851,51 +4851,51 @@ interface UserRealm {
4851
4851
  }
4852
4852
  declare class UserRealmProvider {
4853
4853
  protected readonly alepha: Alepha;
4854
- protected readonly defaultIdentities: Repository<alepha1246.TObject<{
4855
- id: PgAttr<PgAttr<alepha1246.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
4856
- version: PgAttr<PgAttr<alepha1246.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
4857
- createdAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
4858
- updatedAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
4859
- userId: PgAttr<alepha1246.TString, typeof PG_REF>;
4860
- password: alepha1246.TOptional<alepha1246.TString>;
4861
- provider: alepha1246.TString;
4862
- providerUserId: alepha1246.TOptional<alepha1246.TString>;
4863
- providerData: alepha1246.TOptional<alepha1246.TRecord<string, alepha1246.TAny>>;
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>>;
4864
4864
  }>>;
4865
- protected readonly defaultSessions: Repository<alepha1246.TObject<{
4866
- id: PgAttr<PgAttr<alepha1246.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
4867
- version: PgAttr<PgAttr<alepha1246.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
4868
- createdAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
4869
- updatedAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
4870
- refreshToken: alepha1246.TString;
4871
- userId: PgAttr<alepha1246.TString, typeof PG_REF>;
4872
- expiresAt: alepha1246.TString;
4873
- ip: alepha1246.TOptional<alepha1246.TString>;
4874
- userAgent: alepha1246.TOptional<alepha1246.TObject<{
4875
- os: alepha1246.TString;
4876
- browser: alepha1246.TString;
4877
- device: alepha1246.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
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">;
4878
4878
  }>>;
4879
4879
  }>>;
4880
- protected readonly defaultUsers: Repository<alepha1246.TObject<{
4881
- id: PgAttr<PgAttr<alepha1246.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
4882
- version: PgAttr<PgAttr<alepha1246.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
4883
- createdAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
4884
- updatedAt: PgAttr<PgAttr<alepha1246.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
4885
- realm: PgAttr<alepha1246.TString, typeof PG_DEFAULT>;
4886
- username: alepha1246.TOptional<alepha1246.TString>;
4887
- email: alepha1246.TOptional<alepha1246.TString>;
4888
- phoneNumber: alepha1246.TOptional<alepha1246.TString>;
4889
- roles: PgAttr<alepha1246.TArray<alepha1246.TString>, typeof PG_DEFAULT>;
4890
- firstName: alepha1246.TOptional<alepha1246.TString>;
4891
- lastName: alepha1246.TOptional<alepha1246.TString>;
4892
- picture: alepha1246.TOptional<alepha1246.TString>;
4893
- enabled: PgAttr<alepha1246.TBoolean, typeof PG_DEFAULT>;
4894
- emailVerified: PgAttr<alepha1246.TBoolean, typeof PG_DEFAULT>;
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>;
4895
4895
  }>>;
4896
4896
  protected realms: Map<string, UserRealm>;
4897
- avatars: BucketDescriptor;
4898
- protected readonly onConfigure: alepha1246.HookDescriptor<"configure">;
4897
+ avatars: BucketPrimitive;
4898
+ protected readonly onConfigure: alepha1672.HookPrimitive<"configure">;
4899
4899
  register(userRealmName: string, userRealmOptions?: UserRealmOptions): void;
4900
4900
  /**
4901
4901
  * Gets a registered realm by name, auto-creating default if needed.
@@ -4910,21 +4910,21 @@ declare class UserRealmProvider {
4910
4910
  /**
4911
4911
  * Verification settings configuration atom
4912
4912
  */
4913
- declare const verificationOptions: alepha1246.Atom<alepha1246.TObject<{
4914
- code: alepha1246.TObject<{
4915
- maxAttempts: alepha1246.TInteger;
4916
- codeLength: alepha1246.TInteger;
4917
- codeExpiration: alepha1246.TInteger;
4918
- verificationCooldown: alepha1246.TInteger;
4919
- limitPerDay: alepha1246.TInteger;
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;
4920
4920
  }>;
4921
- link: alepha1246.TObject<{
4922
- maxAttempts: alepha1246.TInteger;
4923
- codeExpiration: alepha1246.TInteger;
4924
- verificationCooldown: alepha1246.TInteger;
4925
- limitPerDay: alepha1246.TInteger;
4921
+ link: alepha1672.TObject<{
4922
+ maxAttempts: alepha1672.TInteger;
4923
+ codeExpiration: alepha1672.TInteger;
4924
+ verificationCooldown: alepha1672.TInteger;
4925
+ limitPerDay: alepha1672.TInteger;
4926
4926
  }>;
4927
- purgeDays: alepha1246.TInteger;
4927
+ purgeDays: alepha1672.TInteger;
4928
4928
  }>, "alepha.api.verifications.options">;
4929
4929
  type VerificationOptions = Static<typeof verificationOptions.schema>;
4930
4930
  declare module "alepha" {
@@ -4973,7 +4973,7 @@ declare module "alepha" {
4973
4973
  /**
4974
4974
  * Provides email sending capabilities for Alepha applications with multiple provider backends.
4975
4975
  *
4976
- * The email module enables declarative email sending through the `$email` descriptor, allowing you to send
4976
+ * The email module enables declarative email sending through the `$email` primitive, allowing you to send
4977
4977
  * emails through different providers: memory (for testing), local file system, or SMTP via Nodemailer.
4978
4978
  * It supports HTML email content and automatic provider selection based on environment configuration.
4979
4979
  *
@@ -4981,44 +4981,112 @@ declare module "alepha" {
4981
4981
  * @module alepha.email
4982
4982
  */
4983
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
4984
5031
  //#region ../alepha/src/api-notifications/services/NotificationService.d.ts
4985
- declare const notificationServiceEnvSchema: alepha1246.TObject<{
4986
- NOTIFICATION_QUEUE: alepha1246.TOptional<alepha1246.TBoolean>;
5032
+ declare const notificationServiceEnvSchema: alepha1672.TObject<{
5033
+ NOTIFICATION_QUEUE: alepha1672.TOptional<alepha1672.TBoolean>;
4987
5034
  }>;
4988
5035
  declare module "alepha" {
4989
5036
  interface Env extends Partial<Static<typeof notificationServiceEnvSchema>> {}
4990
5037
  }
4991
5038
  //#endregion
4992
5039
  //#region ../alepha/src/queue/providers/WorkerProvider.d.ts
4993
- declare const envSchema: alepha1246.TObject<{
5040
+ declare const envSchema: alepha1672.TObject<{
4994
5041
  /**
4995
5042
  * The timeout in seconds for blocking job acquisition.
4996
5043
  * Workers will check for shutdown after each timeout period.
4997
5044
  */
4998
- QUEUE_WORKER_BLOCKING_TIMEOUT: alepha1246.TInteger;
5045
+ QUEUE_WORKER_BLOCKING_TIMEOUT: alepha1672.TInteger;
4999
5046
  /**
5000
5047
  * The number of workers to run concurrently. Defaults to 1.
5001
5048
  * Useful only if you are doing a lot of I/O.
5002
5049
  */
5003
- QUEUE_WORKER_CONCURRENCY: alepha1246.TInteger;
5050
+ QUEUE_WORKER_CONCURRENCY: alepha1672.TInteger;
5004
5051
  /**
5005
5052
  * Interval in milliseconds for renewing job locks during processing.
5006
5053
  * Should be less than the job's lock duration.
5007
5054
  */
5008
- QUEUE_WORKER_LOCK_RENEWAL_INTERVAL: alepha1246.TInteger;
5055
+ QUEUE_WORKER_LOCK_RENEWAL_INTERVAL: alepha1672.TInteger;
5009
5056
  /**
5010
5057
  * Interval in milliseconds for the scheduler to check delayed jobs and stalled jobs.
5011
5058
  */
5012
- QUEUE_SCHEDULER_INTERVAL: alepha1246.TInteger;
5059
+ QUEUE_SCHEDULER_INTERVAL: alepha1672.TInteger;
5013
5060
  /**
5014
5061
  * Threshold in milliseconds after lock expiration to consider a job stalled.
5015
5062
  */
5016
- QUEUE_STALLED_THRESHOLD: alepha1246.TInteger;
5063
+ QUEUE_STALLED_THRESHOLD: alepha1672.TInteger;
5017
5064
  }>;
5018
5065
  declare module "alepha" {
5019
5066
  interface Env extends Partial<Static<typeof envSchema>> {}
5020
5067
  }
5021
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
5022
5090
  //#region ../alepha/src/server-cookies/services/CookieParser.d.ts
5023
5091
  declare class CookieParser {
5024
5092
  parseRequestCookies(header: string): Record<string, string>;
@@ -5039,12 +5107,12 @@ declare class ServerCookiesProvider {
5039
5107
  protected readonly IV_LENGTH = 16;
5040
5108
  protected readonly AUTH_TAG_LENGTH = 16;
5041
5109
  protected readonly SIGNATURE_LENGTH = 32;
5042
- readonly onRequest: alepha1246.HookDescriptor<"server:onRequest">;
5043
- readonly onAction: alepha1246.HookDescriptor<"action:onRequest">;
5044
- readonly onSend: alepha1246.HookDescriptor<"server:onSend">;
5110
+ readonly onRequest: alepha1672.HookPrimitive<"server:onRequest">;
5111
+ readonly onAction: alepha1672.HookPrimitive<"action:onRequest">;
5112
+ readonly onSend: alepha1672.HookPrimitive<"server:onSend">;
5045
5113
  protected getCookiesFromContext(cookies?: Cookies): Cookies;
5046
- getCookie<T$1 extends TSchema>(name: string, options: CookieDescriptorOptions<T$1>, contextCookies?: Cookies): Static<T$1> | undefined;
5047
- setCookie<T$1 extends TSchema>(name: string, options: CookieDescriptorOptions<T$1>, data: Static<T$1>, contextCookies?: Cookies): void;
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;
5048
5116
  deleteCookie<T$1 extends TSchema>(name: string, contextCookies?: Cookies): void;
5049
5117
  protected encrypt(text: string): string;
5050
5118
  protected decrypt(encryptedText: string): string;
@@ -5052,8 +5120,8 @@ declare class ServerCookiesProvider {
5052
5120
  protected sign(data: string): string;
5053
5121
  }
5054
5122
  //#endregion
5055
- //#region ../alepha/src/server-cookies/descriptors/$cookie.d.ts
5056
- interface CookieDescriptorOptions<T$1 extends TSchema> {
5123
+ //#region ../alepha/src/server-cookies/primitives/$cookie.d.ts
5124
+ interface CookiePrimitiveOptions<T$1 extends TSchema> {
5057
5125
  /** The schema for the cookie's value, used for validation and type safety. */
5058
5126
  schema: T$1;
5059
5127
  /** The name of the cookie. */
@@ -5077,9 +5145,9 @@ interface CookieDescriptorOptions<T$1 extends TSchema> {
5077
5145
  /** If true, the cookie will be signed to prevent tampering. Requires `COOKIE_SECRET` env var. */
5078
5146
  sign?: boolean;
5079
5147
  }
5080
- interface AbstractCookieDescriptor<T$1 extends TSchema> {
5148
+ interface AbstractCookiePrimitive<T$1 extends TSchema> {
5081
5149
  readonly name: string;
5082
- readonly options: CookieDescriptorOptions<T$1>;
5150
+ readonly options: CookiePrimitiveOptions<T$1>;
5083
5151
  set(value: Static<T$1>, options?: {
5084
5152
  cookies?: Cookies;
5085
5153
  ttl?: DurationLike;
@@ -5112,9 +5180,9 @@ declare module "alepha/server" {
5112
5180
  }
5113
5181
  }
5114
5182
  /**
5115
- * Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie descriptors.
5183
+ * Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie primitives.
5116
5184
  *
5117
- * The server-cookies module enables declarative cookie handling using the `$cookie` descriptor on class properties.
5185
+ * The server-cookies module enables declarative cookie handling using the `$cookie` primitive on class properties.
5118
5186
  * It offers automatic cookie parsing, secure cookie configuration, and seamless integration with server routes
5119
5187
  * for managing user sessions, preferences, and authentication tokens.
5120
5188
  *
@@ -5122,27 +5190,6 @@ declare module "alepha/server" {
5122
5190
  * @module alepha.server.cookies
5123
5191
  */
5124
5192
  //#endregion
5125
- //#region ../alepha/src/server-auth/schemas/authenticationProviderSchema.d.ts
5126
- declare const authenticationProviderSchema: alepha1246.TObject<{
5127
- name: alepha1246.TString;
5128
- type: alepha1246.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
5129
- }>;
5130
- type AuthenticationProvider = Static<typeof authenticationProviderSchema>;
5131
- //#endregion
5132
- //#region ../alepha/src/server-auth/schemas/tokensSchema.d.ts
5133
- declare const tokensSchema: alepha1246.TObject<{
5134
- provider: alepha1246.TString;
5135
- access_token: alepha1246.TString;
5136
- issued_at: alepha1246.TNumber;
5137
- expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5138
- refresh_token: alepha1246.TOptional<alepha1246.TString>;
5139
- refresh_token_expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5140
- refresh_expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5141
- id_token: alepha1246.TOptional<alepha1246.TString>;
5142
- scope: alepha1246.TOptional<alepha1246.TString>;
5143
- }>;
5144
- type Tokens = Static<typeof tokensSchema>;
5145
- //#endregion
5146
5193
  //#region ../alepha/src/server-auth/providers/ServerAuthProvider.d.ts
5147
5194
  declare class ServerAuthProvider {
5148
5195
  protected readonly log: Logger;
@@ -5150,34 +5197,34 @@ declare class ServerAuthProvider {
5150
5197
  protected readonly serverCookiesProvider: ServerCookiesProvider;
5151
5198
  protected readonly dateTimeProvider: DateTimeProvider;
5152
5199
  protected readonly serverLinksProvider: ServerLinksProvider;
5153
- protected readonly authorizationCode: AbstractCookieDescriptor<alepha1246.TObject<{
5154
- provider: alepha1246.TString;
5155
- codeVerifier: alepha1246.TOptional<alepha1246.TString>;
5156
- redirectUri: alepha1246.TOptional<alepha1246.TString>;
5157
- state: alepha1246.TOptional<alepha1246.TString>;
5158
- nonce: alepha1246.TOptional<alepha1246.TString>;
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>;
5159
5206
  }>>;
5160
- readonly tokens: AbstractCookieDescriptor<alepha1246.TObject<{
5161
- provider: alepha1246.TString;
5162
- access_token: alepha1246.TString;
5163
- issued_at: alepha1246.TNumber;
5164
- expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5165
- refresh_token: alepha1246.TOptional<alepha1246.TString>;
5166
- refresh_token_expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5167
- refresh_expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5168
- id_token: alepha1246.TOptional<alepha1246.TString>;
5169
- scope: alepha1246.TOptional<alepha1246.TString>;
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>;
5170
5217
  }>>;
5171
- get identities(): Array<AuthDescriptor>;
5218
+ get identities(): Array<AuthPrimitive>;
5172
5219
  getAuthenticationProviders(filters?: {
5173
5220
  realmName?: string;
5174
5221
  }): AuthenticationProvider[];
5175
- protected readonly configure: alepha1246.HookDescriptor<"configure">;
5222
+ protected readonly configure: alepha1672.HookPrimitive<"configure">;
5176
5223
  protected getAccessTokens(tokens: Tokens): string | undefined;
5177
5224
  /**
5178
5225
  * Fill request headers with access token from cookies or fallback to provider's fallback function.
5179
5226
  */
5180
- protected readonly onRequest: alepha1246.HookDescriptor<"server:onRequest">;
5227
+ protected readonly onRequest: alepha1672.HookPrimitive<"server:onRequest">;
5181
5228
  /**
5182
5229
  * Convert cookies to tokens.
5183
5230
  * If the tokens are expired, try to refresh them using the refresh token.
@@ -5187,27 +5234,27 @@ declare class ServerAuthProvider {
5187
5234
  /**
5188
5235
  * Get user information.
5189
5236
  */
5190
- readonly userinfo: RouteDescriptor<{
5191
- response: alepha1246.TObject<{
5192
- user: alepha1246.TOptional<alepha1246.TObject<{
5193
- id: alepha1246.TString;
5194
- name: alepha1246.TOptional<alepha1246.TString>;
5195
- email: alepha1246.TOptional<alepha1246.TString>;
5196
- username: alepha1246.TOptional<alepha1246.TString>;
5197
- picture: alepha1246.TOptional<alepha1246.TString>;
5198
- sessionId: alepha1246.TOptional<alepha1246.TString>;
5199
- organizations: alepha1246.TOptional<alepha1246.TArray<alepha1246.TString>>;
5200
- roles: alepha1246.TOptional<alepha1246.TArray<alepha1246.TString>>;
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>>;
5201
5248
  }>>;
5202
- api: alepha1246.TObject<{
5203
- prefix: alepha1246.TOptional<alepha1246.TString>;
5204
- links: alepha1246.TArray<alepha1246.TObject<{
5205
- name: alepha1246.TString;
5206
- group: alepha1246.TOptional<alepha1246.TString>;
5207
- path: alepha1246.TString;
5208
- method: alepha1246.TOptional<alepha1246.TString>;
5209
- requestBodyType: alepha1246.TOptional<alepha1246.TString>;
5210
- service: alepha1246.TOptional<alepha1246.TString>;
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>;
5211
5258
  }>>;
5212
5259
  }>;
5213
5260
  }>;
@@ -5215,66 +5262,66 @@ declare class ServerAuthProvider {
5215
5262
  /**
5216
5263
  * Refresh a token for internal providers.
5217
5264
  */
5218
- readonly refresh: RouteDescriptor<{
5219
- query: alepha1246.TObject<{
5220
- provider: alepha1246.TString;
5265
+ readonly refresh: RoutePrimitive<{
5266
+ query: alepha1672.TObject<{
5267
+ provider: alepha1672.TString;
5221
5268
  }>;
5222
- body: alepha1246.TObject<{
5223
- refresh_token: alepha1246.TString;
5224
- access_token: alepha1246.TOptional<alepha1246.TString>;
5269
+ body: alepha1672.TObject<{
5270
+ refresh_token: alepha1672.TString;
5271
+ access_token: alepha1672.TOptional<alepha1672.TString>;
5225
5272
  }>;
5226
- response: alepha1246.TObject<{
5227
- provider: alepha1246.TString;
5228
- access_token: alepha1246.TString;
5229
- issued_at: alepha1246.TNumber;
5230
- expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5231
- refresh_token: alepha1246.TOptional<alepha1246.TString>;
5232
- refresh_token_expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5233
- refresh_expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5234
- id_token: alepha1246.TOptional<alepha1246.TString>;
5235
- scope: alepha1246.TOptional<alepha1246.TString>;
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>;
5236
5283
  }>;
5237
5284
  }>;
5238
5285
  /**
5239
5286
  * Login for local password-based authentication.
5240
5287
  */
5241
- readonly token: RouteDescriptor<{
5242
- query: alepha1246.TObject<{
5243
- provider: alepha1246.TString;
5288
+ readonly token: RoutePrimitive<{
5289
+ query: alepha1672.TObject<{
5290
+ provider: alepha1672.TString;
5244
5291
  }>;
5245
- body: alepha1246.TObject<{
5246
- username: alepha1246.TString;
5247
- password: alepha1246.TString;
5292
+ body: alepha1672.TObject<{
5293
+ username: alepha1672.TString;
5294
+ password: alepha1672.TString;
5248
5295
  }>;
5249
- response: alepha1246.TObject<{
5250
- provider: alepha1246.TString;
5251
- access_token: alepha1246.TString;
5252
- issued_at: alepha1246.TNumber;
5253
- expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5254
- refresh_token: alepha1246.TOptional<alepha1246.TString>;
5255
- refresh_token_expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5256
- refresh_expires_in: alepha1246.TOptional<alepha1246.TNumber>;
5257
- id_token: alepha1246.TOptional<alepha1246.TString>;
5258
- scope: alepha1246.TOptional<alepha1246.TString>;
5259
- user: alepha1246.TObject<{
5260
- id: alepha1246.TString;
5261
- name: alepha1246.TOptional<alepha1246.TString>;
5262
- email: alepha1246.TOptional<alepha1246.TString>;
5263
- username: alepha1246.TOptional<alepha1246.TString>;
5264
- picture: alepha1246.TOptional<alepha1246.TString>;
5265
- sessionId: alepha1246.TOptional<alepha1246.TString>;
5266
- organizations: alepha1246.TOptional<alepha1246.TArray<alepha1246.TString>>;
5267
- roles: alepha1246.TOptional<alepha1246.TArray<alepha1246.TString>>;
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>>;
5268
5315
  }>;
5269
- api: alepha1246.TObject<{
5270
- prefix: alepha1246.TOptional<alepha1246.TString>;
5271
- links: alepha1246.TArray<alepha1246.TObject<{
5272
- name: alepha1246.TString;
5273
- group: alepha1246.TOptional<alepha1246.TString>;
5274
- path: alepha1246.TString;
5275
- method: alepha1246.TOptional<alepha1246.TString>;
5276
- requestBodyType: alepha1246.TOptional<alepha1246.TString>;
5277
- service: alepha1246.TOptional<alepha1246.TString>;
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>;
5278
5325
  }>>;
5279
5326
  }>;
5280
5327
  }>;
@@ -5282,28 +5329,28 @@ declare class ServerAuthProvider {
5282
5329
  /**
5283
5330
  * Oauth2/OIDC login route.
5284
5331
  */
5285
- readonly login: RouteDescriptor<{
5286
- query: alepha1246.TObject<{
5287
- provider: alepha1246.TString;
5288
- redirect_uri: alepha1246.TOptional<alepha1246.TString>;
5332
+ readonly login: RoutePrimitive<{
5333
+ query: alepha1672.TObject<{
5334
+ provider: alepha1672.TString;
5335
+ redirect_uri: alepha1672.TOptional<alepha1672.TString>;
5289
5336
  }>;
5290
5337
  }>;
5291
5338
  /**
5292
5339
  * Callback for OAuth2/OIDC providers.
5293
5340
  * It handles the authorization code flow and retrieves the access token.
5294
5341
  */
5295
- readonly callback: RouteDescriptor<RequestConfigSchema>;
5342
+ readonly callback: RoutePrimitive<RequestConfigSchema>;
5296
5343
  /**
5297
5344
  * Logout route for OAuth2/OIDC providers.
5298
5345
  */
5299
- readonly logout: RouteDescriptor<{
5300
- query: alepha1246.TObject<{
5301
- post_logout_redirect_uri: alepha1246.TOptional<alepha1246.TString>;
5346
+ readonly logout: RoutePrimitive<{
5347
+ query: alepha1672.TObject<{
5348
+ post_logout_redirect_uri: alepha1672.TOptional<alepha1672.TString>;
5302
5349
  }>;
5303
5350
  }>;
5304
5351
  protected provider(opts: string | {
5305
5352
  provider: string;
5306
- }): AuthDescriptor;
5353
+ }): AuthPrimitive;
5307
5354
  protected setTokens(tokens: Tokens, cookies?: Cookies): void;
5308
5355
  }
5309
5356
  interface OAuth2Profile {
@@ -5337,8 +5384,8 @@ interface OAuth2Profile {
5337
5384
  [key: string]: unknown;
5338
5385
  }
5339
5386
  //#endregion
5340
- //#region ../alepha/src/server-auth/descriptors/$auth.d.ts
5341
- type AuthDescriptorOptions = {
5387
+ //#region ../alepha/src/server-auth/primitives/$auth.d.ts
5388
+ type AuthPrimitiveOptions = {
5342
5389
  /**
5343
5390
  * Name of the identity provider.
5344
5391
  * If not provided, it will be derived from the property key.
@@ -5379,7 +5426,7 @@ type AuthExternal = {
5379
5426
  * This relies on the `realm`, which is used to create/verify the access token.
5380
5427
  */
5381
5428
  type AuthInternal = {
5382
- realm: RealmDescriptor;
5429
+ realm: RealmPrimitive;
5383
5430
  } & ({
5384
5431
  /**
5385
5432
  * The common username/password authentication.
@@ -5492,7 +5539,7 @@ interface OAuth2Options {
5492
5539
  */
5493
5540
  scope?: string;
5494
5541
  }
5495
- declare class AuthDescriptor extends Descriptor<AuthDescriptorOptions> {
5542
+ declare class AuthPrimitive extends Primitive<AuthPrimitiveOptions> {
5496
5543
  protected readonly securityProvider: SecurityProvider;
5497
5544
  protected readonly dateTimeProvider: DateTimeProvider;
5498
5545
  oauth?: Configuration;
@@ -5556,53 +5603,53 @@ declare class UserRealmController {
5556
5603
  * Get realm configuration settings.
5557
5604
  * This endpoint is not exposed in the API documentation.
5558
5605
  */
5559
- readonly getRealmConfig: ActionDescriptorFn<{
5560
- query: alepha1246.TObject<{
5561
- userRealmName: alepha1246.TOptional<alepha1246.TString>;
5606
+ readonly getRealmConfig: ActionPrimitiveFn<{
5607
+ query: alepha1672.TObject<{
5608
+ userRealmName: alepha1672.TOptional<alepha1672.TString>;
5562
5609
  }>;
5563
- response: alepha1246.TObject<{
5564
- settings: alepha1246.TObject<{
5565
- registrationAllowed: alepha1246.TBoolean;
5566
- emailEnabled: alepha1246.TBoolean;
5567
- emailRequired: alepha1246.TBoolean;
5568
- usernameEnabled: alepha1246.TBoolean;
5569
- usernameRequired: alepha1246.TBoolean;
5570
- phoneEnabled: alepha1246.TBoolean;
5571
- phoneRequired: alepha1246.TBoolean;
5572
- verifyEmailRequired: alepha1246.TBoolean;
5573
- verifyPhoneRequired: alepha1246.TBoolean;
5574
- firstNameLastNameEnabled: alepha1246.TBoolean;
5575
- firstNameLastNameRequired: alepha1246.TBoolean;
5576
- resetPasswordAllowed: alepha1246.TBoolean;
5577
- passwordPolicy: alepha1246.TObject<{
5578
- minLength: alepha1246.TInteger;
5579
- requireUppercase: alepha1246.TBoolean;
5580
- requireLowercase: alepha1246.TBoolean;
5581
- requireNumbers: alepha1246.TBoolean;
5582
- requireSpecialCharacters: alepha1246.TBoolean;
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;
5583
5630
  }>;
5584
5631
  }>;
5585
- realmName: alepha1246.TString;
5586
- authenticationMethods: alepha1246.TArray<alepha1246.TObject<{
5587
- name: alepha1246.TString;
5588
- type: alepha1246.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
5632
+ realmName: alepha1672.TString;
5633
+ authenticationMethods: alepha1672.TArray<alepha1672.TObject<{
5634
+ name: alepha1672.TString;
5635
+ type: alepha1672.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
5589
5636
  }>>;
5590
5637
  }>;
5591
5638
  }>;
5592
- readonly checkUsernameAvailability: ActionDescriptorFn<{
5593
- query: alepha1246.TObject<{
5594
- userRealmName: alepha1246.TOptional<alepha1246.TString>;
5639
+ readonly checkUsernameAvailability: ActionPrimitiveFn<{
5640
+ query: alepha1672.TObject<{
5641
+ userRealmName: alepha1672.TOptional<alepha1672.TString>;
5595
5642
  }>;
5596
- body: alepha1246.TObject<{
5597
- username: alepha1246.TString;
5643
+ body: alepha1672.TObject<{
5644
+ username: alepha1672.TString;
5598
5645
  }>;
5599
- response: alepha1246.TObject<{
5600
- available: alepha1246.TBoolean;
5646
+ response: alepha1672.TObject<{
5647
+ available: alepha1672.TBoolean;
5601
5648
  }>;
5602
5649
  }>;
5603
5650
  }
5604
5651
  //#endregion
5605
- //#region ../alepha/src/api-users/descriptors/$userRealm.d.ts
5652
+ //#region ../alepha/src/api-users/primitives/$userRealm.d.ts
5606
5653
  interface UserRealmOptions {
5607
5654
  /**
5608
5655
  * Secret key for signing tokens.
@@ -5615,7 +5662,7 @@ interface UserRealmOptions {
5615
5662
  *
5616
5663
  * It's already pre-configured for user management with admin and user roles.
5617
5664
  */
5618
- realm?: Partial<RealmDescriptorOptions>;
5665
+ realm?: Partial<RealmPrimitiveOptions>;
5619
5666
  /**
5620
5667
  * Override entities.
5621
5668
  */
@@ -5633,32 +5680,32 @@ interface UserRealmOptions {
5633
5680
  }
5634
5681
  //#endregion
5635
5682
  //#region ../alepha/src/api-users/schemas/userRealmConfigSchema.d.ts
5636
- declare const userRealmConfigSchema: alepha1246.TObject<{
5637
- settings: alepha1246.TObject<{
5638
- registrationAllowed: alepha1246.TBoolean;
5639
- emailEnabled: alepha1246.TBoolean;
5640
- emailRequired: alepha1246.TBoolean;
5641
- usernameEnabled: alepha1246.TBoolean;
5642
- usernameRequired: alepha1246.TBoolean;
5643
- phoneEnabled: alepha1246.TBoolean;
5644
- phoneRequired: alepha1246.TBoolean;
5645
- verifyEmailRequired: alepha1246.TBoolean;
5646
- verifyPhoneRequired: alepha1246.TBoolean;
5647
- firstNameLastNameEnabled: alepha1246.TBoolean;
5648
- firstNameLastNameRequired: alepha1246.TBoolean;
5649
- resetPasswordAllowed: alepha1246.TBoolean;
5650
- passwordPolicy: alepha1246.TObject<{
5651
- minLength: alepha1246.TInteger;
5652
- requireUppercase: alepha1246.TBoolean;
5653
- requireLowercase: alepha1246.TBoolean;
5654
- requireNumbers: alepha1246.TBoolean;
5655
- requireSpecialCharacters: alepha1246.TBoolean;
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;
5656
5703
  }>;
5657
5704
  }>;
5658
- realmName: alepha1246.TString;
5659
- authenticationMethods: alepha1246.TArray<alepha1246.TObject<{
5660
- name: alepha1246.TString;
5661
- type: alepha1246.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
5705
+ realmName: alepha1672.TString;
5706
+ authenticationMethods: alepha1672.TArray<alepha1672.TObject<{
5707
+ name: alepha1672.TString;
5708
+ type: alepha1672.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
5662
5709
  }>>;
5663
5710
  }>;
5664
5711
  type UserRealmConfig = Static<typeof userRealmConfigSchema>;
@@ -5698,9 +5745,9 @@ declare module "alepha/bucket" {
5698
5745
  //#region src/auth/AuthRouter.d.ts
5699
5746
  declare class AuthRouter {
5700
5747
  userRealmClient: HttpVirtualClient<UserRealmController>;
5701
- login: PageDescriptor<{
5702
- query: alepha1246.TObject<{
5703
- redirect: alepha1246.TOptional<alepha1246.TString>;
5748
+ login: PagePrimitive<{
5749
+ query: alepha1672.TObject<{
5750
+ redirect: alepha1672.TOptional<alepha1672.TString>;
5704
5751
  }>;
5705
5752
  }, {
5706
5753
  realmConfig: {
@@ -5732,9 +5779,9 @@ declare class AuthRouter {
5732
5779
  }[];
5733
5780
  };
5734
5781
  }, TPropsParentDefault>;
5735
- register: PageDescriptor<{
5736
- query: alepha1246.TObject<{
5737
- redirect: alepha1246.TOptional<alepha1246.TString>;
5782
+ register: PagePrimitive<{
5783
+ query: alepha1672.TObject<{
5784
+ redirect: alepha1672.TOptional<alepha1672.TString>;
5738
5785
  }>;
5739
5786
  }, {
5740
5787
  realmConfig: {
@@ -5766,9 +5813,9 @@ declare class AuthRouter {
5766
5813
  }[];
5767
5814
  };
5768
5815
  }, TPropsParentDefault>;
5769
- resetPassword: PageDescriptor<{
5770
- query: alepha1246.TObject<{
5771
- redirect: alepha1246.TOptional<alepha1246.TString>;
5816
+ resetPassword: PagePrimitive<{
5817
+ query: alepha1672.TObject<{
5818
+ redirect: alepha1672.TOptional<alepha1672.TString>;
5772
5819
  }>;
5773
5820
  }, {
5774
5821
  realmConfig: {
@@ -5851,7 +5898,7 @@ declare const ResetPassword: (props: ResetPasswordProps) => react_jsx_runtime0.J
5851
5898
  *
5852
5899
  * @module alepha.ui.auth
5853
5900
  */
5854
- declare const AlephaUIAuth: alepha1246.Service<alepha1246.Module>;
5901
+ declare const AlephaUIAuth: alepha1672.Service<alepha1672.Module>;
5855
5902
  //#endregion
5856
5903
  export { AlephaUIAuth, AuthRouter, Login, Register, ResetPassword, UserButton, type UserButtonProps };
5857
5904
  //# sourceMappingURL=index.d.ts.map