@alepha/react 0.13.1 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.browser.js +10 -5
- package/dist/auth/index.browser.js.map +1 -1
- package/dist/auth/index.d.ts +401 -330
- package/dist/auth/index.js +12 -7
- package/dist/auth/index.js.map +1 -1
- package/dist/core/index.browser.js +50 -28
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +382 -344
- package/dist/core/index.js +65 -37
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +381 -0
- package/dist/core/index.native.js.map +1 -0
- package/dist/form/index.d.ts +2 -2
- package/dist/head/index.browser.js +28 -17
- package/dist/head/index.browser.js.map +1 -1
- package/dist/head/index.d.ts +270 -267
- package/dist/head/index.js +29 -17
- package/dist/head/index.js.map +1 -1
- package/dist/i18n/index.d.ts +20 -20
- package/dist/i18n/index.js +12 -12
- package/dist/i18n/index.js.map +1 -1
- package/dist/websocket/index.d.ts +7 -7
- package/dist/websocket/index.js.map +1 -1
- package/package.json +21 -12
- package/src/auth/index.ts +1 -1
- package/src/auth/providers/ReactAuthProvider.ts +1 -1
- package/src/auth/services/ReactAuth.ts +15 -5
- package/src/core/components/NestedView.tsx +6 -2
- package/src/core/components/NotFound.tsx +10 -6
- package/src/core/hooks/useStore.ts +4 -4
- package/src/core/index.browser.ts +2 -2
- package/src/core/index.native.ts +1 -1
- package/src/core/index.shared-router.ts +1 -1
- package/src/core/index.ts +3 -3
- package/src/core/{descriptors → primitives}/$page.ts +20 -20
- package/src/core/providers/ReactBrowserProvider.ts +2 -2
- package/src/core/providers/ReactBrowserRouterProvider.ts +3 -2
- package/src/core/providers/ReactPageProvider.ts +28 -11
- package/src/core/providers/ReactServerProvider.ts +34 -23
- package/src/core/services/ReactPageServerService.ts +6 -6
- package/src/core/services/ReactPageService.ts +6 -6
- package/src/core/services/ReactRouter.ts +19 -3
- package/src/head/index.browser.ts +3 -3
- package/src/head/index.ts +4 -4
- package/src/head/interfaces/Head.ts +1 -0
- package/src/head/{descriptors → primitives}/$head.ts +10 -7
- package/src/head/providers/BrowserHeadProvider.ts +13 -0
- package/src/head/providers/HeadProvider.ts +11 -9
- package/src/head/providers/ServerHeadProvider.ts +6 -0
- package/src/i18n/hooks/useI18n.ts +2 -2
- package/src/i18n/index.ts +3 -3
- package/src/i18n/{descriptors → primitives}/$dictionary.ts +8 -8
- package/src/i18n/providers/I18nProvider.ts +5 -5
- package/src/websocket/hooks/useRoom.tsx +3 -3
package/dist/core/index.d.ts
CHANGED
|
@@ -1,217 +1,47 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Alepha, AlephaError, Async, Atom,
|
|
1
|
+
import * as alepha48 from "alepha";
|
|
2
|
+
import { Alepha, AlephaError, Async, Atom, FileLike, Hook, Hooks, InstantiableClass, KIND, LogLevel, LoggerInterface, Primitive, Service, State, Static, StreamLike, TArray, TAtomObject, TFile, TObject, TRecord, TSchema, TStream, TString, TVoid } from "alepha";
|
|
3
3
|
import * as react0 from "react";
|
|
4
4
|
import React, { AnchorHTMLAttributes, CSSProperties, DependencyList, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
|
|
5
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
import { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
7
|
-
import dayjsDuration from "dayjs/plugin/duration.js";
|
|
8
|
-
import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
|
|
9
7
|
import { Readable } from "node:stream";
|
|
10
8
|
import { ReadableStream } from "node:stream/web";
|
|
9
|
+
import dayjsDuration from "dayjs/plugin/duration.js";
|
|
10
|
+
import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
|
|
11
11
|
|
|
12
|
-
//#region ../alepha/src/
|
|
13
|
-
declare const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
//#region ../alepha/src/server/schemas/errorSchema.d.ts
|
|
13
|
+
declare const errorSchema: alepha48.TObject<{
|
|
14
|
+
error: alepha48.TString;
|
|
15
|
+
status: alepha48.TInteger;
|
|
16
|
+
message: alepha48.TString;
|
|
17
|
+
details: alepha48.TOptional<alepha48.TString>;
|
|
18
|
+
requestId: alepha48.TOptional<alepha48.TString>;
|
|
19
|
+
cause: alepha48.TOptional<alepha48.TObject<{
|
|
20
|
+
name: alepha48.TString;
|
|
21
|
+
message: alepha48.TString;
|
|
22
|
+
}>>;
|
|
22
23
|
}>;
|
|
23
|
-
type
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region ../alepha/src/datetime/providers/DateTimeProvider.d.ts
|
|
26
|
-
type DateTime = DayjsApi.Dayjs;
|
|
27
|
-
type Duration = dayjsDuration.Duration;
|
|
28
|
-
type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
|
|
29
|
-
declare class DateTimeProvider {
|
|
30
|
-
static PLUGINS: Array<PluginFunc<any>>;
|
|
31
|
-
protected alepha: Alepha;
|
|
32
|
-
protected ref: DateTime | null;
|
|
33
|
-
protected readonly timeouts: Timeout[];
|
|
34
|
-
protected readonly intervals: Interval[];
|
|
35
|
-
constructor();
|
|
36
|
-
protected readonly onStart: alepha81.HookDescriptor<"start">;
|
|
37
|
-
protected readonly onStop: alepha81.HookDescriptor<"stop">;
|
|
38
|
-
setLocale(locale: string): void;
|
|
39
|
-
isDateTime(value: unknown): value is DateTime;
|
|
40
|
-
/**
|
|
41
|
-
* Create a new UTC DateTime instance.
|
|
42
|
-
*/
|
|
43
|
-
utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
44
|
-
/**
|
|
45
|
-
* Create a new DateTime instance.
|
|
46
|
-
*/
|
|
47
|
-
of(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
48
|
-
/**
|
|
49
|
-
* Get the current date as a string.
|
|
50
|
-
*/
|
|
51
|
-
toISOString(date?: Date | string | DateTime): string;
|
|
52
|
-
/**
|
|
53
|
-
* Get the current date.
|
|
54
|
-
*/
|
|
55
|
-
now(): DateTime;
|
|
56
|
-
/**
|
|
57
|
-
* Get the current date as a string.
|
|
58
|
-
*
|
|
59
|
-
* This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
|
|
60
|
-
*/
|
|
61
|
-
nowISOString(): string;
|
|
62
|
-
/**
|
|
63
|
-
* Get the current date as milliseconds since epoch.
|
|
64
|
-
*
|
|
65
|
-
* This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
|
|
66
|
-
*/
|
|
67
|
-
nowMillis(): number;
|
|
68
|
-
/**
|
|
69
|
-
* Get the current date as a string.
|
|
70
|
-
*
|
|
71
|
-
* @protected
|
|
72
|
-
*/
|
|
73
|
-
protected getCurrentDate(): DateTime;
|
|
74
|
-
/**
|
|
75
|
-
* Create a new Duration instance.
|
|
76
|
-
*/
|
|
77
|
-
duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
|
|
78
|
-
isDurationLike(value: unknown): value is DurationLike;
|
|
79
|
-
/**
|
|
80
|
-
* Return a promise that resolves after the next tick.
|
|
81
|
-
* It uses `setTimeout` with 0 ms delay.
|
|
82
|
-
*/
|
|
83
|
-
tick(): Promise<void>;
|
|
84
|
-
/**
|
|
85
|
-
* Wait for a certain duration.
|
|
86
|
-
*
|
|
87
|
-
* You can clear the timeout by using the `AbortSignal` API.
|
|
88
|
-
* Aborted signal will resolve the promise immediately, it does not reject it.
|
|
89
|
-
*/
|
|
90
|
-
wait(duration: DurationLike, options?: {
|
|
91
|
-
signal?: AbortSignal;
|
|
92
|
-
now?: number;
|
|
93
|
-
}): Promise<void>;
|
|
94
|
-
createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
|
|
95
|
-
/**
|
|
96
|
-
* Run a callback after a certain duration.
|
|
97
|
-
*/
|
|
98
|
-
createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
|
|
99
|
-
clearTimeout(timeout: Timeout): void;
|
|
100
|
-
clearInterval(interval: Interval): void;
|
|
101
|
-
/**
|
|
102
|
-
* Run a function with a deadline.
|
|
103
|
-
*/
|
|
104
|
-
deadline<T$1>(fn: (signal: AbortSignal) => Promise<T$1>, duration: DurationLike): Promise<T$1>;
|
|
105
|
-
/**
|
|
106
|
-
* Add time to the current date.
|
|
107
|
-
*/
|
|
108
|
-
travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
|
|
109
|
-
/**
|
|
110
|
-
* Stop the time.
|
|
111
|
-
*/
|
|
112
|
-
pause(): DateTime;
|
|
113
|
-
/**
|
|
114
|
-
* Reset the reference date.
|
|
115
|
-
*/
|
|
116
|
-
reset(): void;
|
|
117
|
-
}
|
|
118
|
-
interface Interval {
|
|
119
|
-
timer?: any;
|
|
120
|
-
duration: number;
|
|
121
|
-
run: () => unknown;
|
|
122
|
-
}
|
|
123
|
-
interface Timeout {
|
|
124
|
-
now: number;
|
|
125
|
-
timer?: any;
|
|
126
|
-
duration: number;
|
|
127
|
-
callback: () => void;
|
|
128
|
-
clear: () => void;
|
|
129
|
-
}
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region ../alepha/src/logger/providers/LogDestinationProvider.d.ts
|
|
132
|
-
declare abstract class LogDestinationProvider {
|
|
133
|
-
abstract write(message: string, entry: LogEntry): void;
|
|
134
|
-
}
|
|
135
|
-
//#endregion
|
|
136
|
-
//#region ../alepha/src/logger/providers/LogFormatterProvider.d.ts
|
|
137
|
-
declare abstract class LogFormatterProvider {
|
|
138
|
-
abstract format(entry: LogEntry): string;
|
|
139
|
-
}
|
|
24
|
+
type ErrorSchema = Static<typeof errorSchema>;
|
|
140
25
|
//#endregion
|
|
141
|
-
//#region ../alepha/src/
|
|
142
|
-
declare class
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
get level(): string;
|
|
156
|
-
parseLevel(level: string, app: string): LogLevel;
|
|
157
|
-
private matchesPattern;
|
|
158
|
-
asLogLevel(something: string): LogLevel;
|
|
159
|
-
error(message: string, data?: unknown): void;
|
|
160
|
-
warn(message: string, data?: unknown): void;
|
|
161
|
-
info(message: string, data?: unknown): void;
|
|
162
|
-
debug(message: string, data?: unknown): void;
|
|
163
|
-
trace(message: string, data?: unknown): void;
|
|
164
|
-
protected log(level: LogLevel, message: string, data?: unknown): void;
|
|
165
|
-
protected emit(entry: LogEntry, message?: string): void;
|
|
26
|
+
//#region ../alepha/src/server/errors/HttpError.d.ts
|
|
27
|
+
declare class HttpError extends AlephaError {
|
|
28
|
+
name: string;
|
|
29
|
+
static is: (error: unknown, status?: number) => error is HttpErrorLike;
|
|
30
|
+
static toJSON(error: HttpError): ErrorSchema;
|
|
31
|
+
readonly error: string;
|
|
32
|
+
readonly status: number;
|
|
33
|
+
readonly requestId?: string;
|
|
34
|
+
readonly details?: string;
|
|
35
|
+
readonly reason?: {
|
|
36
|
+
name: string;
|
|
37
|
+
message: string;
|
|
38
|
+
};
|
|
39
|
+
constructor(options: Partial<ErrorSchema>, cause?: unknown);
|
|
166
40
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
declare const envSchema$6: alepha81.TObject<{
|
|
170
|
-
/**
|
|
171
|
-
* Default log level for the application.
|
|
172
|
-
*
|
|
173
|
-
* Default by environment:
|
|
174
|
-
* - dev = info
|
|
175
|
-
* - prod = info
|
|
176
|
-
* - test = error
|
|
177
|
-
*
|
|
178
|
-
* Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
|
|
179
|
-
*
|
|
180
|
-
* Level can be set for a specific module:
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
|
|
184
|
-
* LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
|
|
185
|
-
*/
|
|
186
|
-
LOG_LEVEL: alepha81.TOptional<alepha81.TString>;
|
|
187
|
-
/**
|
|
188
|
-
* Built-in log formats.
|
|
189
|
-
* - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
|
|
190
|
-
* - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
|
|
191
|
-
* - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
|
|
192
|
-
*/
|
|
193
|
-
LOG_FORMAT: alepha81.TOptional<alepha81.TUnsafe<"json" | "pretty" | "raw">>;
|
|
194
|
-
}>;
|
|
195
|
-
declare module "alepha" {
|
|
196
|
-
interface Env extends Partial<Static<typeof envSchema$6>> {}
|
|
197
|
-
interface State {
|
|
198
|
-
/**
|
|
199
|
-
* Current log level for the application or specific modules.
|
|
200
|
-
*/
|
|
201
|
-
"alepha.logger.level"?: string;
|
|
202
|
-
}
|
|
203
|
-
interface Hooks {
|
|
204
|
-
log: {
|
|
205
|
-
message?: string;
|
|
206
|
-
entry: LogEntry;
|
|
207
|
-
};
|
|
208
|
-
}
|
|
41
|
+
interface HttpErrorLike extends Error {
|
|
42
|
+
status: number;
|
|
209
43
|
}
|
|
210
44
|
//#endregion
|
|
211
|
-
//#region ../alepha/src/server/constants/routeMethods.d.ts
|
|
212
|
-
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
213
|
-
type RouteMethod = (typeof routeMethods)[number];
|
|
214
|
-
//#endregion
|
|
215
45
|
//#region ../alepha/src/router/providers/RouterProvider.d.ts
|
|
216
46
|
declare abstract class RouterProvider<T$1 extends Route = Route> {
|
|
217
47
|
protected routePathRegex: RegExp;
|
|
@@ -256,6 +86,10 @@ interface Tree<T$1 extends Route> {
|
|
|
256
86
|
};
|
|
257
87
|
}
|
|
258
88
|
//#endregion
|
|
89
|
+
//#region ../alepha/src/server/constants/routeMethods.d.ts
|
|
90
|
+
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
91
|
+
type RouteMethod = (typeof routeMethods)[number];
|
|
92
|
+
//#endregion
|
|
259
93
|
//#region ../alepha/src/server/helpers/ServerReply.d.ts
|
|
260
94
|
/**
|
|
261
95
|
* Helper for building server replies.
|
|
@@ -422,6 +256,205 @@ interface WebRequestEvent {
|
|
|
422
256
|
res?: Response;
|
|
423
257
|
}
|
|
424
258
|
//#endregion
|
|
259
|
+
//#region ../alepha/src/logger/schemas/logEntrySchema.d.ts
|
|
260
|
+
declare const logEntrySchema: alepha48.TObject<{
|
|
261
|
+
level: alepha48.TUnsafe<"TRACE" | "SILENT" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
|
|
262
|
+
message: alepha48.TString;
|
|
263
|
+
service: alepha48.TString;
|
|
264
|
+
module: alepha48.TString;
|
|
265
|
+
context: alepha48.TOptional<alepha48.TString>;
|
|
266
|
+
app: alepha48.TOptional<alepha48.TString>;
|
|
267
|
+
data: alepha48.TOptional<alepha48.TAny>;
|
|
268
|
+
timestamp: alepha48.TNumber;
|
|
269
|
+
}>;
|
|
270
|
+
type LogEntry = Static<typeof logEntrySchema>;
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region ../alepha/src/datetime/providers/DateTimeProvider.d.ts
|
|
273
|
+
type DateTime = DayjsApi.Dayjs;
|
|
274
|
+
type Duration = dayjsDuration.Duration;
|
|
275
|
+
type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
|
|
276
|
+
declare class DateTimeProvider {
|
|
277
|
+
static PLUGINS: Array<PluginFunc<any>>;
|
|
278
|
+
protected alepha: Alepha;
|
|
279
|
+
protected ref: DateTime | null;
|
|
280
|
+
protected readonly timeouts: Timeout[];
|
|
281
|
+
protected readonly intervals: Interval[];
|
|
282
|
+
constructor();
|
|
283
|
+
protected readonly onStart: alepha48.HookPrimitive<"start">;
|
|
284
|
+
protected readonly onStop: alepha48.HookPrimitive<"stop">;
|
|
285
|
+
setLocale(locale: string): void;
|
|
286
|
+
isDateTime(value: unknown): value is DateTime;
|
|
287
|
+
/**
|
|
288
|
+
* Create a new UTC DateTime instance.
|
|
289
|
+
*/
|
|
290
|
+
utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
291
|
+
/**
|
|
292
|
+
* Create a new DateTime instance.
|
|
293
|
+
*/
|
|
294
|
+
of(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
295
|
+
/**
|
|
296
|
+
* Get the current date as a string.
|
|
297
|
+
*/
|
|
298
|
+
toISOString(date?: Date | string | DateTime): string;
|
|
299
|
+
/**
|
|
300
|
+
* Get the current date.
|
|
301
|
+
*/
|
|
302
|
+
now(): DateTime;
|
|
303
|
+
/**
|
|
304
|
+
* Get the current date as a string.
|
|
305
|
+
*
|
|
306
|
+
* This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
|
|
307
|
+
*/
|
|
308
|
+
nowISOString(): string;
|
|
309
|
+
/**
|
|
310
|
+
* Get the current date as milliseconds since epoch.
|
|
311
|
+
*
|
|
312
|
+
* This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
|
|
313
|
+
*/
|
|
314
|
+
nowMillis(): number;
|
|
315
|
+
/**
|
|
316
|
+
* Get the current date as a string.
|
|
317
|
+
*
|
|
318
|
+
* @protected
|
|
319
|
+
*/
|
|
320
|
+
protected getCurrentDate(): DateTime;
|
|
321
|
+
/**
|
|
322
|
+
* Create a new Duration instance.
|
|
323
|
+
*/
|
|
324
|
+
duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
|
|
325
|
+
isDurationLike(value: unknown): value is DurationLike;
|
|
326
|
+
/**
|
|
327
|
+
* Return a promise that resolves after the next tick.
|
|
328
|
+
* It uses `setTimeout` with 0 ms delay.
|
|
329
|
+
*/
|
|
330
|
+
tick(): Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Wait for a certain duration.
|
|
333
|
+
*
|
|
334
|
+
* You can clear the timeout by using the `AbortSignal` API.
|
|
335
|
+
* Aborted signal will resolve the promise immediately, it does not reject it.
|
|
336
|
+
*/
|
|
337
|
+
wait(duration: DurationLike, options?: {
|
|
338
|
+
signal?: AbortSignal;
|
|
339
|
+
now?: number;
|
|
340
|
+
}): Promise<void>;
|
|
341
|
+
createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
|
|
342
|
+
/**
|
|
343
|
+
* Run a callback after a certain duration.
|
|
344
|
+
*/
|
|
345
|
+
createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
|
|
346
|
+
clearTimeout(timeout: Timeout): void;
|
|
347
|
+
clearInterval(interval: Interval): void;
|
|
348
|
+
/**
|
|
349
|
+
* Run a function with a deadline.
|
|
350
|
+
*/
|
|
351
|
+
deadline<T$1>(fn: (signal: AbortSignal) => Promise<T$1>, duration: DurationLike): Promise<T$1>;
|
|
352
|
+
/**
|
|
353
|
+
* Add time to the current date.
|
|
354
|
+
*/
|
|
355
|
+
travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
|
|
356
|
+
/**
|
|
357
|
+
* Stop the time.
|
|
358
|
+
*/
|
|
359
|
+
pause(): DateTime;
|
|
360
|
+
/**
|
|
361
|
+
* Reset the reference date.
|
|
362
|
+
*/
|
|
363
|
+
reset(): void;
|
|
364
|
+
}
|
|
365
|
+
interface Interval {
|
|
366
|
+
timer?: any;
|
|
367
|
+
duration: number;
|
|
368
|
+
run: () => unknown;
|
|
369
|
+
}
|
|
370
|
+
interface Timeout {
|
|
371
|
+
now: number;
|
|
372
|
+
timer?: any;
|
|
373
|
+
duration: number;
|
|
374
|
+
callback: () => void;
|
|
375
|
+
clear: () => void;
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region ../alepha/src/logger/providers/LogDestinationProvider.d.ts
|
|
379
|
+
declare abstract class LogDestinationProvider {
|
|
380
|
+
abstract write(message: string, entry: LogEntry): void;
|
|
381
|
+
}
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region ../alepha/src/logger/providers/LogFormatterProvider.d.ts
|
|
384
|
+
declare abstract class LogFormatterProvider {
|
|
385
|
+
abstract format(entry: LogEntry): string;
|
|
386
|
+
}
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region ../alepha/src/logger/services/Logger.d.ts
|
|
389
|
+
declare class Logger implements LoggerInterface {
|
|
390
|
+
protected readonly alepha: Alepha;
|
|
391
|
+
protected readonly formatter: LogFormatterProvider;
|
|
392
|
+
protected readonly destination: LogDestinationProvider;
|
|
393
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
394
|
+
protected readonly levels: Record<string, number>;
|
|
395
|
+
protected readonly service: string;
|
|
396
|
+
protected readonly module: string;
|
|
397
|
+
protected readonly app?: string;
|
|
398
|
+
protected appLogLevel: string;
|
|
399
|
+
protected logLevel: LogLevel;
|
|
400
|
+
constructor(service: string, module: string);
|
|
401
|
+
get context(): string | undefined;
|
|
402
|
+
get level(): string;
|
|
403
|
+
parseLevel(level: string, app: string): LogLevel;
|
|
404
|
+
private matchesPattern;
|
|
405
|
+
asLogLevel(something: string): LogLevel;
|
|
406
|
+
error(message: string, data?: unknown): void;
|
|
407
|
+
warn(message: string, data?: unknown): void;
|
|
408
|
+
info(message: string, data?: unknown): void;
|
|
409
|
+
debug(message: string, data?: unknown): void;
|
|
410
|
+
trace(message: string, data?: unknown): void;
|
|
411
|
+
protected log(level: LogLevel, message: string, data?: unknown): void;
|
|
412
|
+
protected emit(entry: LogEntry, message?: string): void;
|
|
413
|
+
}
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region ../alepha/src/logger/index.d.ts
|
|
416
|
+
declare const envSchema$6: alepha48.TObject<{
|
|
417
|
+
/**
|
|
418
|
+
* Default log level for the application.
|
|
419
|
+
*
|
|
420
|
+
* Default by environment:
|
|
421
|
+
* - dev = info
|
|
422
|
+
* - prod = info
|
|
423
|
+
* - test = error
|
|
424
|
+
*
|
|
425
|
+
* Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
|
|
426
|
+
*
|
|
427
|
+
* Level can be set for a specific module:
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
|
|
431
|
+
* LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
|
|
432
|
+
*/
|
|
433
|
+
LOG_LEVEL: alepha48.TOptional<alepha48.TString>;
|
|
434
|
+
/**
|
|
435
|
+
* Built-in log formats.
|
|
436
|
+
* - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
|
|
437
|
+
* - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
|
|
438
|
+
* - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
|
|
439
|
+
*/
|
|
440
|
+
LOG_FORMAT: alepha48.TOptional<alepha48.TUnsafe<"json" | "pretty" | "raw">>;
|
|
441
|
+
}>;
|
|
442
|
+
declare module "alepha" {
|
|
443
|
+
interface Env extends Partial<Static<typeof envSchema$6>> {}
|
|
444
|
+
interface State {
|
|
445
|
+
/**
|
|
446
|
+
* Current log level for the application or specific modules.
|
|
447
|
+
*/
|
|
448
|
+
"alepha.logger.level"?: string;
|
|
449
|
+
}
|
|
450
|
+
interface Hooks {
|
|
451
|
+
log: {
|
|
452
|
+
message?: string;
|
|
453
|
+
entry: LogEntry;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
//#endregion
|
|
425
458
|
//#region ../alepha/src/server/services/ServerRequestParser.d.ts
|
|
426
459
|
declare class ServerRequestParser {
|
|
427
460
|
protected readonly alepha: Alepha;
|
|
@@ -441,8 +474,8 @@ declare class ServerTimingProvider {
|
|
|
441
474
|
prefix: string;
|
|
442
475
|
disabled: boolean;
|
|
443
476
|
};
|
|
444
|
-
readonly onRequest:
|
|
445
|
-
readonly onResponse:
|
|
477
|
+
readonly onRequest: alepha48.HookPrimitive<"server:onRequest">;
|
|
478
|
+
readonly onResponse: alepha48.HookPrimitive<"server:onResponse">;
|
|
446
479
|
protected get handlerName(): string;
|
|
447
480
|
beginTiming(name: string): void;
|
|
448
481
|
endTiming(name: string): void;
|
|
@@ -506,11 +539,11 @@ declare class ServerProvider {
|
|
|
506
539
|
/**
|
|
507
540
|
* When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
|
|
508
541
|
*/
|
|
509
|
-
protected readonly onNodeRequest:
|
|
542
|
+
protected readonly onNodeRequest: alepha48.HookPrimitive<"node:request">;
|
|
510
543
|
/**
|
|
511
544
|
* When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
|
|
512
545
|
*/
|
|
513
|
-
protected readonly onWebRequest:
|
|
546
|
+
protected readonly onWebRequest: alepha48.HookPrimitive<"web:request">;
|
|
514
547
|
/**
|
|
515
548
|
* Handle Node.js HTTP request event.
|
|
516
549
|
*
|
|
@@ -570,8 +603,8 @@ declare abstract class CacheProvider {
|
|
|
570
603
|
abstract clear(): Promise<void>;
|
|
571
604
|
}
|
|
572
605
|
//#endregion
|
|
573
|
-
//#region ../alepha/src/cache/
|
|
574
|
-
interface
|
|
606
|
+
//#region ../alepha/src/cache/primitives/$cache.d.ts
|
|
607
|
+
interface CachePrimitiveOptions<TReturn = any, TParameter extends any[] = any[]> {
|
|
575
608
|
/**
|
|
576
609
|
* The cache name. This is useful for invalidating multiple caches at once.
|
|
577
610
|
*
|
|
@@ -606,7 +639,7 @@ interface CacheDescriptorOptions<TReturn = any, TParameter extends any[] = any[]
|
|
|
606
639
|
*/
|
|
607
640
|
disabled?: boolean;
|
|
608
641
|
}
|
|
609
|
-
declare class
|
|
642
|
+
declare class CachePrimitive<TReturn = any, TParameter extends any[] = any[]> extends Primitive<CachePrimitiveOptions<TReturn, TParameter>> {
|
|
610
643
|
protected readonly env: {
|
|
611
644
|
CACHE_ENABLED: boolean;
|
|
612
645
|
CACHE_DEFAULT_TTL: number;
|
|
@@ -630,9 +663,9 @@ declare class CacheDescriptor<TReturn = any, TParameter extends any[] = any[]> e
|
|
|
630
663
|
protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
|
|
631
664
|
protected $provider(): CacheProvider;
|
|
632
665
|
}
|
|
633
|
-
interface
|
|
666
|
+
interface CachePrimitiveFn<TReturn = any, TParameter extends any[] = any[]> extends CachePrimitive<TReturn, TParameter> {
|
|
634
667
|
/**
|
|
635
|
-
* Run the cache
|
|
668
|
+
* Run the cache primitive with the provided arguments.
|
|
636
669
|
*/
|
|
637
670
|
(...args: TParameter): Promise<TReturn>;
|
|
638
671
|
}
|
|
@@ -641,7 +674,7 @@ interface CacheDescriptorFn<TReturn = any, TParameter extends any[] = any[]> ext
|
|
|
641
674
|
declare class HttpClient {
|
|
642
675
|
protected readonly log: Logger;
|
|
643
676
|
protected readonly alepha: Alepha;
|
|
644
|
-
readonly cache:
|
|
677
|
+
readonly cache: CachePrimitiveFn<HttpClientCache, any[]>;
|
|
645
678
|
protected readonly pendingRequests: HttpClientPendingRequests;
|
|
646
679
|
fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
|
|
647
680
|
fetch<T$1 extends TSchema>(url: string, request?: RequestInitWithOptions<T$1>): Promise<FetchResponse<Static<T$1>>>;
|
|
@@ -709,8 +742,8 @@ interface HttpAction {
|
|
|
709
742
|
};
|
|
710
743
|
}
|
|
711
744
|
//#endregion
|
|
712
|
-
//#region ../alepha/src/server/
|
|
713
|
-
interface
|
|
745
|
+
//#region ../alepha/src/server/primitives/$action.d.ts
|
|
746
|
+
interface ActionPrimitiveOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
|
|
714
747
|
/**
|
|
715
748
|
* Name of the action.
|
|
716
749
|
*
|
|
@@ -776,7 +809,7 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends O
|
|
|
776
809
|
*/
|
|
777
810
|
handler: ServerActionHandler<TConfig>;
|
|
778
811
|
}
|
|
779
|
-
declare class
|
|
812
|
+
declare class ActionPrimitive<TConfig extends RequestConfigSchema> extends Primitive<ActionPrimitiveOptions<TConfig>> {
|
|
780
813
|
protected readonly log: Logger;
|
|
781
814
|
protected readonly env: {
|
|
782
815
|
SERVER_API_PREFIX: string;
|
|
@@ -844,52 +877,19 @@ type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSche
|
|
|
844
877
|
*/
|
|
845
878
|
interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
|
|
846
879
|
//#endregion
|
|
847
|
-
//#region ../alepha/src/server/schemas/errorSchema.d.ts
|
|
848
|
-
declare const errorSchema: alepha81.TObject<{
|
|
849
|
-
error: alepha81.TString;
|
|
850
|
-
status: alepha81.TInteger;
|
|
851
|
-
message: alepha81.TString;
|
|
852
|
-
details: alepha81.TOptional<alepha81.TString>;
|
|
853
|
-
requestId: alepha81.TOptional<alepha81.TString>;
|
|
854
|
-
cause: alepha81.TOptional<alepha81.TObject<{
|
|
855
|
-
name: alepha81.TString;
|
|
856
|
-
message: alepha81.TString;
|
|
857
|
-
}>>;
|
|
858
|
-
}>;
|
|
859
|
-
type ErrorSchema = Static<typeof errorSchema>;
|
|
860
|
-
//#endregion
|
|
861
|
-
//#region ../alepha/src/server/errors/HttpError.d.ts
|
|
862
|
-
declare class HttpError extends AlephaError {
|
|
863
|
-
name: string;
|
|
864
|
-
static is: (error: unknown, status?: number) => error is HttpErrorLike;
|
|
865
|
-
static toJSON(error: HttpError): ErrorSchema;
|
|
866
|
-
readonly error: string;
|
|
867
|
-
readonly status: number;
|
|
868
|
-
readonly requestId?: string;
|
|
869
|
-
readonly details?: string;
|
|
870
|
-
readonly reason?: {
|
|
871
|
-
name: string;
|
|
872
|
-
message: string;
|
|
873
|
-
};
|
|
874
|
-
constructor(options: Partial<ErrorSchema>, cause?: unknown);
|
|
875
|
-
}
|
|
876
|
-
interface HttpErrorLike extends Error {
|
|
877
|
-
status: number;
|
|
878
|
-
}
|
|
879
|
-
//#endregion
|
|
880
880
|
//#region ../alepha/src/server/providers/BunHttpServerProvider.d.ts
|
|
881
|
-
declare const envSchema$5:
|
|
882
|
-
SERVER_PORT:
|
|
883
|
-
SERVER_HOST:
|
|
881
|
+
declare const envSchema$5: alepha48.TObject<{
|
|
882
|
+
SERVER_PORT: alepha48.TInteger;
|
|
883
|
+
SERVER_HOST: alepha48.TString;
|
|
884
884
|
}>;
|
|
885
885
|
declare module "alepha" {
|
|
886
886
|
interface Env extends Partial<Static<typeof envSchema$5>> {}
|
|
887
887
|
}
|
|
888
888
|
//#endregion
|
|
889
889
|
//#region ../alepha/src/server/providers/NodeHttpServerProvider.d.ts
|
|
890
|
-
declare const envSchema$4:
|
|
891
|
-
SERVER_PORT:
|
|
892
|
-
SERVER_HOST:
|
|
890
|
+
declare const envSchema$4: alepha48.TObject<{
|
|
891
|
+
SERVER_PORT: alepha48.TInteger;
|
|
892
|
+
SERVER_HOST: alepha48.TString;
|
|
893
893
|
}>;
|
|
894
894
|
declare module "alepha" {
|
|
895
895
|
interface Env extends Partial<Static<typeof envSchema$4>> {}
|
|
@@ -902,12 +902,12 @@ declare module "alepha" {
|
|
|
902
902
|
}
|
|
903
903
|
interface Hooks {
|
|
904
904
|
"action:onRequest": {
|
|
905
|
-
action:
|
|
905
|
+
action: ActionPrimitive<RequestConfigSchema>;
|
|
906
906
|
request: ServerRequest;
|
|
907
907
|
options: ClientRequestOptions;
|
|
908
908
|
};
|
|
909
909
|
"action:onResponse": {
|
|
910
|
-
action:
|
|
910
|
+
action: ActionPrimitive<RequestConfigSchema>;
|
|
911
911
|
request: ServerRequest;
|
|
912
912
|
options: ClientRequestOptions;
|
|
913
913
|
response: any;
|
|
@@ -963,7 +963,7 @@ declare module "alepha/server" {
|
|
|
963
963
|
*/
|
|
964
964
|
cache?: ServerRouteCache;
|
|
965
965
|
}
|
|
966
|
-
interface
|
|
966
|
+
interface ActionPrimitive<TConfig extends RequestConfigSchema> {
|
|
967
967
|
invalidate: () => Promise<void>;
|
|
968
968
|
}
|
|
969
969
|
}
|
|
@@ -982,11 +982,11 @@ boolean
|
|
|
982
982
|
/**
|
|
983
983
|
* If true, enables storing cached responses. (in-memory, Redis, @see alepha/cache for other providers)
|
|
984
984
|
* If a DurationLike is provided, it will be used as the TTL for the cache.
|
|
985
|
-
* If
|
|
985
|
+
* If CachePrimitiveOptions is provided, it will be used to configure the cache storage.
|
|
986
986
|
*
|
|
987
987
|
* @default false
|
|
988
988
|
*/
|
|
989
|
-
store?: true | DurationLike |
|
|
989
|
+
store?: true | DurationLike | CachePrimitiveOptions;
|
|
990
990
|
/**
|
|
991
991
|
* If true, enables ETag support for the cached responses.
|
|
992
992
|
*/
|
|
@@ -1077,8 +1077,8 @@ declare class Redirection extends Error {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
//#endregion
|
|
1079
1079
|
//#region src/core/providers/ReactPageProvider.d.ts
|
|
1080
|
-
declare const envSchema$3:
|
|
1081
|
-
REACT_STRICT_MODE:
|
|
1080
|
+
declare const envSchema$3: alepha48.TObject<{
|
|
1081
|
+
REACT_STRICT_MODE: alepha48.TBoolean;
|
|
1082
1082
|
}>;
|
|
1083
1083
|
declare module "alepha" {
|
|
1084
1084
|
interface Env extends Partial<Static<typeof envSchema$3>> {}
|
|
@@ -1091,7 +1091,7 @@ declare class ReactPageProvider {
|
|
|
1091
1091
|
protected readonly alepha: Alepha;
|
|
1092
1092
|
protected readonly pages: PageRoute[];
|
|
1093
1093
|
getPages(): PageRoute[];
|
|
1094
|
-
getConcretePages():
|
|
1094
|
+
getConcretePages(): ConcretePageRoute[];
|
|
1095
1095
|
page(name: string): PageRoute;
|
|
1096
1096
|
pathname(name: string, options?: {
|
|
1097
1097
|
params?: Record<string, string>;
|
|
@@ -1121,17 +1121,25 @@ declare class ReactPageProvider {
|
|
|
1121
1121
|
}, params?: Record<string, any>): string;
|
|
1122
1122
|
compile(path: string, params?: Record<string, string>): string;
|
|
1123
1123
|
protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
|
|
1124
|
-
protected readonly configure:
|
|
1125
|
-
protected map(pages: Array<
|
|
1124
|
+
protected readonly configure: alepha48.HookPrimitive<"configure">;
|
|
1125
|
+
protected map(pages: Array<PagePrimitive>, target: PagePrimitive): PageRouteEntry;
|
|
1126
1126
|
add(entry: PageRouteEntry): void;
|
|
1127
1127
|
protected createMatch(page: PageRoute): string;
|
|
1128
1128
|
protected _next: number;
|
|
1129
1129
|
protected nextId(): string;
|
|
1130
1130
|
}
|
|
1131
1131
|
declare const isPageRoute: (it: any) => it is PageRoute;
|
|
1132
|
-
interface PageRouteEntry extends Omit<
|
|
1132
|
+
interface PageRouteEntry extends Omit<PagePrimitiveOptions, "children" | "parent"> {
|
|
1133
1133
|
children?: PageRouteEntry[];
|
|
1134
1134
|
}
|
|
1135
|
+
interface ConcretePageRoute extends PageRoute {
|
|
1136
|
+
/**
|
|
1137
|
+
* When exported, static routes can be split into multiple pages with different params.
|
|
1138
|
+
* We replace 'name' by the new name for each static entry, and old 'name' becomes 'staticName'.
|
|
1139
|
+
*/
|
|
1140
|
+
staticName?: string;
|
|
1141
|
+
params?: Record<string, string>;
|
|
1142
|
+
}
|
|
1135
1143
|
interface PageRoute extends PageRouteEntry {
|
|
1136
1144
|
type: "page";
|
|
1137
1145
|
name: string;
|
|
@@ -1184,6 +1192,7 @@ interface ReactRouterState {
|
|
|
1184
1192
|
* Optional meta information associated with the current page.
|
|
1185
1193
|
*/
|
|
1186
1194
|
meta: Record<string, any>;
|
|
1195
|
+
name?: string;
|
|
1187
1196
|
}
|
|
1188
1197
|
interface RouterStackItem {
|
|
1189
1198
|
route: PageRoute;
|
|
@@ -1202,18 +1211,18 @@ interface CreateLayersResult {
|
|
|
1202
1211
|
//#endregion
|
|
1203
1212
|
//#region src/core/services/ReactPageService.d.ts
|
|
1204
1213
|
declare class ReactPageService {
|
|
1205
|
-
fetch(pathname: string, options?:
|
|
1214
|
+
fetch(pathname: string, options?: PagePrimitiveRenderOptions): Promise<{
|
|
1206
1215
|
html: string;
|
|
1207
1216
|
response: Response;
|
|
1208
1217
|
}>;
|
|
1209
|
-
render(name: string, options?:
|
|
1218
|
+
render(name: string, options?: PagePrimitiveRenderOptions): Promise<PagePrimitiveRenderResult>;
|
|
1210
1219
|
}
|
|
1211
1220
|
//#endregion
|
|
1212
|
-
//#region src/core/
|
|
1221
|
+
//#region src/core/primitives/$page.d.ts
|
|
1213
1222
|
/**
|
|
1214
|
-
* Main
|
|
1223
|
+
* Main primitive for defining a React route in the application.
|
|
1215
1224
|
*
|
|
1216
|
-
* The $page
|
|
1225
|
+
* The $page primitive is the core building block for creating type-safe, SSR-enabled React routes.
|
|
1217
1226
|
* It provides a declarative way to define pages with powerful features:
|
|
1218
1227
|
*
|
|
1219
1228
|
* **Routing & Navigation**
|
|
@@ -1299,14 +1308,14 @@ declare class ReactPageService {
|
|
|
1299
1308
|
* ```
|
|
1300
1309
|
*/
|
|
1301
1310
|
declare const $page: {
|
|
1302
|
-
<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = any, TPropsParent extends object = TPropsParentDefault>(options:
|
|
1303
|
-
[KIND]: typeof
|
|
1311
|
+
<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = any, TPropsParent extends object = TPropsParentDefault>(options: PagePrimitiveOptions<TConfig, TProps, TPropsParent>): PagePrimitive<TConfig, TProps, TPropsParent>;
|
|
1312
|
+
[KIND]: typeof PagePrimitive;
|
|
1304
1313
|
};
|
|
1305
|
-
interface
|
|
1314
|
+
interface PagePrimitiveOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
1306
1315
|
/**
|
|
1307
1316
|
* Identifier name for the page. Must be unique.
|
|
1308
1317
|
*
|
|
1309
|
-
* @default
|
|
1318
|
+
* @default Primitive key
|
|
1310
1319
|
*/
|
|
1311
1320
|
name?: string;
|
|
1312
1321
|
/**
|
|
@@ -1358,11 +1367,11 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
|
|
|
1358
1367
|
* Attach child pages to create nested routes.
|
|
1359
1368
|
* This will make the page a parent route.
|
|
1360
1369
|
*/
|
|
1361
|
-
children?: Array<
|
|
1370
|
+
children?: Array<PagePrimitive> | (() => Array<PagePrimitive>);
|
|
1362
1371
|
/**
|
|
1363
1372
|
* Define a parent page for nested routing.
|
|
1364
1373
|
*/
|
|
1365
|
-
parent?:
|
|
1374
|
+
parent?: PagePrimitive<PageConfigSchema, TPropsParent, any>;
|
|
1366
1375
|
can?: () => boolean;
|
|
1367
1376
|
/**
|
|
1368
1377
|
* Catch any error from the `resolve` function or during `rendering`.
|
|
@@ -1472,7 +1481,7 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
|
|
|
1472
1481
|
animation?: PageAnimation;
|
|
1473
1482
|
}
|
|
1474
1483
|
type ErrorHandler = (error: Error, state: ReactRouterState) => ReactNode | Redirection | undefined;
|
|
1475
|
-
declare class
|
|
1484
|
+
declare class PagePrimitive<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> extends Primitive<PagePrimitiveOptions<TConfig, TProps, TPropsParent>> {
|
|
1476
1485
|
protected readonly reactPageService: ReactPageService;
|
|
1477
1486
|
protected onInit(): void;
|
|
1478
1487
|
get name(): string;
|
|
@@ -1482,8 +1491,8 @@ declare class PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema
|
|
|
1482
1491
|
* This will render the page (HTML layout included or not) and return the HTML + context.
|
|
1483
1492
|
* Only valid for server-side rendering, it will throw an error if called on the client-side.
|
|
1484
1493
|
*/
|
|
1485
|
-
render(options?:
|
|
1486
|
-
fetch(options?:
|
|
1494
|
+
render(options?: PagePrimitiveRenderOptions): Promise<PagePrimitiveRenderResult>;
|
|
1495
|
+
fetch(options?: PagePrimitiveRenderOptions): Promise<{
|
|
1487
1496
|
html: string;
|
|
1488
1497
|
response: Response;
|
|
1489
1498
|
}>;
|
|
@@ -1496,7 +1505,7 @@ interface PageConfigSchema {
|
|
|
1496
1505
|
}
|
|
1497
1506
|
type TPropsDefault = any;
|
|
1498
1507
|
type TPropsParentDefault = {};
|
|
1499
|
-
interface
|
|
1508
|
+
interface PagePrimitiveRenderOptions {
|
|
1500
1509
|
params?: Record<string, string>;
|
|
1501
1510
|
query?: Record<string, string>;
|
|
1502
1511
|
/**
|
|
@@ -1508,7 +1517,7 @@ interface PageDescriptorRenderOptions {
|
|
|
1508
1517
|
html?: boolean;
|
|
1509
1518
|
hydration?: boolean;
|
|
1510
1519
|
}
|
|
1511
|
-
interface
|
|
1520
|
+
interface PagePrimitiveRenderResult {
|
|
1512
1521
|
html: string;
|
|
1513
1522
|
state: ReactRouterState;
|
|
1514
1523
|
redirect?: string;
|
|
@@ -1531,15 +1540,15 @@ type CssAnimation = {
|
|
|
1531
1540
|
};
|
|
1532
1541
|
//#endregion
|
|
1533
1542
|
//#region ../alepha/src/security/schemas/userAccountInfoSchema.d.ts
|
|
1534
|
-
declare const userAccountInfoSchema:
|
|
1535
|
-
id:
|
|
1536
|
-
name:
|
|
1537
|
-
email:
|
|
1538
|
-
username:
|
|
1539
|
-
picture:
|
|
1540
|
-
sessionId:
|
|
1541
|
-
organizations:
|
|
1542
|
-
roles:
|
|
1543
|
+
declare const userAccountInfoSchema: alepha48.TObject<{
|
|
1544
|
+
id: alepha48.TString;
|
|
1545
|
+
name: alepha48.TOptional<alepha48.TString>;
|
|
1546
|
+
email: alepha48.TOptional<alepha48.TString>;
|
|
1547
|
+
username: alepha48.TOptional<alepha48.TString>;
|
|
1548
|
+
picture: alepha48.TOptional<alepha48.TString>;
|
|
1549
|
+
sessionId: alepha48.TOptional<alepha48.TString>;
|
|
1550
|
+
organizations: alepha48.TOptional<alepha48.TArray<alepha48.TString>>;
|
|
1551
|
+
roles: alepha48.TOptional<alepha48.TArray<alepha48.TString>>;
|
|
1543
1552
|
}>;
|
|
1544
1553
|
type UserAccount = Static<typeof userAccountInfoSchema>;
|
|
1545
1554
|
//#endregion
|
|
@@ -1565,8 +1574,8 @@ interface UserAccountToken extends UserAccount {
|
|
|
1565
1574
|
}
|
|
1566
1575
|
//#endregion
|
|
1567
1576
|
//#region ../alepha/src/security/providers/SecurityProvider.d.ts
|
|
1568
|
-
declare const envSchema$2:
|
|
1569
|
-
APP_SECRET:
|
|
1577
|
+
declare const envSchema$2: alepha48.TObject<{
|
|
1578
|
+
APP_SECRET: alepha48.TString;
|
|
1570
1579
|
}>;
|
|
1571
1580
|
declare module "alepha" {
|
|
1572
1581
|
interface Env extends Partial<Static<typeof envSchema$2>> {}
|
|
@@ -1584,7 +1593,7 @@ declare module "alepha" {
|
|
|
1584
1593
|
/**
|
|
1585
1594
|
* Provides comprehensive authentication and authorization capabilities with JWT tokens, role-based access control, and user management.
|
|
1586
1595
|
*
|
|
1587
|
-
* The security module enables building secure applications using
|
|
1596
|
+
* The security module enables building secure applications using primitives like `$realm`, `$role`, and `$permission`
|
|
1588
1597
|
* on class properties. It offers JWT-based authentication, fine-grained permissions, service accounts, and seamless
|
|
1589
1598
|
* integration with various authentication providers and user management systems.
|
|
1590
1599
|
*
|
|
@@ -1659,23 +1668,23 @@ declare module "alepha/server" {
|
|
|
1659
1668
|
*/
|
|
1660
1669
|
//#endregion
|
|
1661
1670
|
//#region ../alepha/src/server-links/schemas/apiLinksResponseSchema.d.ts
|
|
1662
|
-
declare const apiLinkSchema:
|
|
1663
|
-
name:
|
|
1664
|
-
group:
|
|
1665
|
-
path:
|
|
1666
|
-
method:
|
|
1667
|
-
requestBodyType:
|
|
1668
|
-
service:
|
|
1671
|
+
declare const apiLinkSchema: alepha48.TObject<{
|
|
1672
|
+
name: alepha48.TString;
|
|
1673
|
+
group: alepha48.TOptional<alepha48.TString>;
|
|
1674
|
+
path: alepha48.TString;
|
|
1675
|
+
method: alepha48.TOptional<alepha48.TString>;
|
|
1676
|
+
requestBodyType: alepha48.TOptional<alepha48.TString>;
|
|
1677
|
+
service: alepha48.TOptional<alepha48.TString>;
|
|
1669
1678
|
}>;
|
|
1670
|
-
declare const apiLinksResponseSchema:
|
|
1671
|
-
prefix:
|
|
1672
|
-
links:
|
|
1673
|
-
name:
|
|
1674
|
-
group:
|
|
1675
|
-
path:
|
|
1676
|
-
method:
|
|
1677
|
-
requestBodyType:
|
|
1678
|
-
service:
|
|
1679
|
+
declare const apiLinksResponseSchema: alepha48.TObject<{
|
|
1680
|
+
prefix: alepha48.TOptional<alepha48.TString>;
|
|
1681
|
+
links: alepha48.TArray<alepha48.TObject<{
|
|
1682
|
+
name: alepha48.TString;
|
|
1683
|
+
group: alepha48.TOptional<alepha48.TString>;
|
|
1684
|
+
path: alepha48.TString;
|
|
1685
|
+
method: alepha48.TOptional<alepha48.TString>;
|
|
1686
|
+
requestBodyType: alepha48.TOptional<alepha48.TString>;
|
|
1687
|
+
service: alepha48.TOptional<alepha48.TString>;
|
|
1679
1688
|
}>>;
|
|
1680
1689
|
}>;
|
|
1681
1690
|
type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
|
|
@@ -1742,8 +1751,8 @@ interface ClientScope {
|
|
|
1742
1751
|
service?: string;
|
|
1743
1752
|
hostname?: string;
|
|
1744
1753
|
}
|
|
1745
|
-
type HttpVirtualClient<T$1> = { [K in keyof T$1 as T$1[K] extends
|
|
1746
|
-
interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<
|
|
1754
|
+
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 };
|
|
1755
|
+
interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<ActionPrimitive<T$1>, "name" | "run" | "fetch"> {
|
|
1747
1756
|
(config?: ClientRequestEntry<T$1>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T$1>>;
|
|
1748
1757
|
can: () => boolean;
|
|
1749
1758
|
}
|
|
@@ -1763,7 +1772,7 @@ declare module "alepha" {
|
|
|
1763
1772
|
/**
|
|
1764
1773
|
* Provides server-side link management and remote capabilities for client-server interactions.
|
|
1765
1774
|
*
|
|
1766
|
-
* The server-links module enables declarative link definitions using `$remote` and `$client`
|
|
1775
|
+
* The server-links module enables declarative link definitions using `$remote` and `$client` primitives,
|
|
1767
1776
|
* facilitating seamless API endpoint management and client-server communication. It integrates with server
|
|
1768
1777
|
* security features to ensure safe and controlled access to resources.
|
|
1769
1778
|
*
|
|
@@ -1781,14 +1790,14 @@ declare class ReactBrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
1781
1790
|
protected readonly alepha: Alepha;
|
|
1782
1791
|
protected readonly pageApi: ReactPageProvider;
|
|
1783
1792
|
add(entry: PageRouteEntry): void;
|
|
1784
|
-
protected readonly configure:
|
|
1793
|
+
protected readonly configure: alepha48.HookPrimitive<"configure">;
|
|
1785
1794
|
transition(url: URL, previous?: PreviousLayerData[], meta?: {}): Promise<string | void>;
|
|
1786
1795
|
root(state: ReactRouterState): ReactNode;
|
|
1787
1796
|
}
|
|
1788
1797
|
//#endregion
|
|
1789
1798
|
//#region src/core/providers/ReactBrowserProvider.d.ts
|
|
1790
|
-
declare const envSchema$1:
|
|
1791
|
-
REACT_ROOT_ID:
|
|
1799
|
+
declare const envSchema$1: alepha48.TObject<{
|
|
1800
|
+
REACT_ROOT_ID: alepha48.TString;
|
|
1792
1801
|
}>;
|
|
1793
1802
|
declare module "alepha" {
|
|
1794
1803
|
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
@@ -1796,8 +1805,8 @@ declare module "alepha" {
|
|
|
1796
1805
|
/**
|
|
1797
1806
|
* React browser renderer configuration atom
|
|
1798
1807
|
*/
|
|
1799
|
-
declare const reactBrowserOptions:
|
|
1800
|
-
scrollRestoration:
|
|
1808
|
+
declare const reactBrowserOptions: alepha48.Atom<alepha48.TObject<{
|
|
1809
|
+
scrollRestoration: alepha48.TUnsafe<"top" | "manual">;
|
|
1801
1810
|
}>, "alepha.react.browser.options">;
|
|
1802
1811
|
type ReactBrowserRendererOptions = Static<typeof reactBrowserOptions.schema>;
|
|
1803
1812
|
declare module "alepha" {
|
|
@@ -1845,8 +1854,8 @@ declare class ReactBrowserProvider {
|
|
|
1845
1854
|
* Get embedded layers from the server.
|
|
1846
1855
|
*/
|
|
1847
1856
|
protected getHydrationState(): ReactHydrationState | undefined;
|
|
1848
|
-
protected readonly onTransitionEnd:
|
|
1849
|
-
readonly ready:
|
|
1857
|
+
protected readonly onTransitionEnd: alepha48.HookPrimitive<"react:transition:end">;
|
|
1858
|
+
readonly ready: alepha48.HookPrimitive<"ready">;
|
|
1850
1859
|
}
|
|
1851
1860
|
interface RouterGoOptions {
|
|
1852
1861
|
replace?: boolean;
|
|
@@ -2284,11 +2293,40 @@ declare class ReactRouter<T$1 extends object> {
|
|
|
2284
2293
|
protected readonly pageApi: ReactPageProvider;
|
|
2285
2294
|
get state(): ReactRouterState;
|
|
2286
2295
|
get pages(): PageRoute[];
|
|
2287
|
-
get concretePages():
|
|
2296
|
+
get concretePages(): ConcretePageRoute[];
|
|
2288
2297
|
get browser(): ReactBrowserProvider | undefined;
|
|
2289
2298
|
isActive(href: string, options?: {
|
|
2290
2299
|
startWith?: boolean;
|
|
2291
2300
|
}): boolean;
|
|
2301
|
+
node(name: keyof VirtualRouter<T$1> | string, config?: {
|
|
2302
|
+
params?: Record<string, any>;
|
|
2303
|
+
query?: Record<string, any>;
|
|
2304
|
+
}): {
|
|
2305
|
+
label: any;
|
|
2306
|
+
href: string;
|
|
2307
|
+
children: undefined;
|
|
2308
|
+
type: "page";
|
|
2309
|
+
name: string;
|
|
2310
|
+
parent?: PageRoute;
|
|
2311
|
+
match: string;
|
|
2312
|
+
path?: string | undefined;
|
|
2313
|
+
schema?: PageConfigSchema | undefined;
|
|
2314
|
+
resolve?: ((context: PageResolve<PageConfigSchema, TPropsParentDefault>) => any) | undefined;
|
|
2315
|
+
component?: react0.FC<any> | undefined;
|
|
2316
|
+
lazy?: (() => Promise<{
|
|
2317
|
+
default: react0.FC<any>;
|
|
2318
|
+
}>) | undefined;
|
|
2319
|
+
can?: (() => boolean) | undefined;
|
|
2320
|
+
errorHandler?: ErrorHandler | undefined;
|
|
2321
|
+
static?: boolean | {
|
|
2322
|
+
entries?: Partial<PageRequestConfig<PageConfigSchema>>[] | undefined;
|
|
2323
|
+
} | undefined;
|
|
2324
|
+
cache?: ServerRouteCache | undefined;
|
|
2325
|
+
client?: (boolean | ClientOnlyProps) | undefined;
|
|
2326
|
+
onServerResponse?: ((request: ServerRequest) => unknown) | undefined;
|
|
2327
|
+
onLeave?: (() => void) | undefined;
|
|
2328
|
+
animation?: PageAnimation | undefined;
|
|
2329
|
+
};
|
|
2292
2330
|
path(name: keyof VirtualRouter<T$1> | string, config?: {
|
|
2293
2331
|
params?: Record<string, any>;
|
|
2294
2332
|
query?: Record<string, any>;
|
|
@@ -2324,7 +2362,7 @@ declare class ReactRouter<T$1 extends object> {
|
|
|
2324
2362
|
push?: boolean;
|
|
2325
2363
|
}): void;
|
|
2326
2364
|
}
|
|
2327
|
-
type VirtualRouter<T$1> = { [K in keyof T$1 as T$1[K] extends
|
|
2365
|
+
type VirtualRouter<T$1> = { [K in keyof T$1 as T$1[K] extends PagePrimitive ? K : never]: T$1[K] };
|
|
2328
2366
|
//#endregion
|
|
2329
2367
|
//#region src/core/hooks/useRouter.d.ts
|
|
2330
2368
|
/**
|
|
@@ -2346,8 +2384,8 @@ declare const useRouter: <T$1 extends object = any>() => ReactRouter<T$1>;
|
|
|
2346
2384
|
//#region src/core/hooks/useRouterState.d.ts
|
|
2347
2385
|
declare const useRouterState: () => ReactRouterState;
|
|
2348
2386
|
//#endregion
|
|
2349
|
-
//#region ../alepha/src/server-static/
|
|
2350
|
-
interface
|
|
2387
|
+
//#region ../alepha/src/server-static/primitives/$serve.d.ts
|
|
2388
|
+
interface ServePrimitiveOptions {
|
|
2351
2389
|
/**
|
|
2352
2390
|
* Prefix for the served path.
|
|
2353
2391
|
*
|
|
@@ -2361,7 +2399,7 @@ interface ServeDescriptorOptions {
|
|
|
2361
2399
|
*/
|
|
2362
2400
|
root?: string;
|
|
2363
2401
|
/**
|
|
2364
|
-
* If true,
|
|
2402
|
+
* If true, primitive will be ignored.
|
|
2365
2403
|
*
|
|
2366
2404
|
* @default false
|
|
2367
2405
|
*/
|
|
@@ -2384,7 +2422,7 @@ interface ServeDescriptorOptions {
|
|
|
2384
2422
|
*/
|
|
2385
2423
|
historyApiFallback?: boolean;
|
|
2386
2424
|
/**
|
|
2387
|
-
* Optional name of the
|
|
2425
|
+
* Optional name of the primitive.
|
|
2388
2426
|
* This is used for logging and debugging purposes.
|
|
2389
2427
|
*
|
|
2390
2428
|
* @default Key name.
|
|
@@ -2553,26 +2591,26 @@ declare class ServerStaticProvider {
|
|
|
2553
2591
|
protected readonly fileDetector: FileDetector;
|
|
2554
2592
|
protected readonly log: Logger;
|
|
2555
2593
|
protected readonly directories: ServeDirectory[];
|
|
2556
|
-
protected readonly configure:
|
|
2557
|
-
createStaticServer(options:
|
|
2558
|
-
createFileHandler(filepath: string, options:
|
|
2594
|
+
protected readonly configure: alepha48.HookPrimitive<"configure">;
|
|
2595
|
+
createStaticServer(options: ServePrimitiveOptions): Promise<void>;
|
|
2596
|
+
createFileHandler(filepath: string, options: ServePrimitiveOptions): Promise<ServerHandler>;
|
|
2559
2597
|
protected getCacheFileTypes(): string[];
|
|
2560
|
-
protected getCacheControl(filename: string, options:
|
|
2598
|
+
protected getCacheControl(filename: string, options: ServePrimitiveOptions): {
|
|
2561
2599
|
maxAge: number;
|
|
2562
2600
|
immutable: boolean;
|
|
2563
2601
|
} | undefined;
|
|
2564
2602
|
getAllFiles(dir: string, ignoreDotEnvFiles?: boolean): Promise<string[]>;
|
|
2565
2603
|
}
|
|
2566
2604
|
interface ServeDirectory {
|
|
2567
|
-
options:
|
|
2605
|
+
options: ServePrimitiveOptions;
|
|
2568
2606
|
files: string[];
|
|
2569
2607
|
}
|
|
2570
2608
|
//#endregion
|
|
2571
2609
|
//#region src/core/providers/ReactServerProvider.d.ts
|
|
2572
|
-
declare const envSchema:
|
|
2573
|
-
REACT_SSR_ENABLED:
|
|
2574
|
-
REACT_ROOT_ID:
|
|
2575
|
-
REACT_SERVER_TEMPLATE:
|
|
2610
|
+
declare const envSchema: alepha48.TObject<{
|
|
2611
|
+
REACT_SSR_ENABLED: alepha48.TOptional<alepha48.TBoolean>;
|
|
2612
|
+
REACT_ROOT_ID: alepha48.TString;
|
|
2613
|
+
REACT_SERVER_TEMPLATE: alepha48.TOptional<alepha48.TString>;
|
|
2576
2614
|
}>;
|
|
2577
2615
|
declare module "alepha" {
|
|
2578
2616
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
@@ -2583,11 +2621,11 @@ declare module "alepha" {
|
|
|
2583
2621
|
/**
|
|
2584
2622
|
* React server provider configuration atom
|
|
2585
2623
|
*/
|
|
2586
|
-
declare const reactServerOptions:
|
|
2587
|
-
publicDir:
|
|
2588
|
-
staticServer:
|
|
2589
|
-
disabled:
|
|
2590
|
-
path:
|
|
2624
|
+
declare const reactServerOptions: alepha48.Atom<alepha48.TObject<{
|
|
2625
|
+
publicDir: alepha48.TString;
|
|
2626
|
+
staticServer: alepha48.TObject<{
|
|
2627
|
+
disabled: alepha48.TBoolean;
|
|
2628
|
+
path: alepha48.TString;
|
|
2591
2629
|
}>;
|
|
2592
2630
|
}>, "alepha.react.server.options">;
|
|
2593
2631
|
type ReactServerProviderOptions = Static<typeof reactServerOptions.schema>;
|
|
@@ -2621,7 +2659,7 @@ declare class ReactServerProvider {
|
|
|
2621
2659
|
/**
|
|
2622
2660
|
* Configure the React server provider.
|
|
2623
2661
|
*/
|
|
2624
|
-
readonly onConfigure:
|
|
2662
|
+
readonly onConfigure: alepha48.HookPrimitive<"configure">;
|
|
2625
2663
|
get template(): string;
|
|
2626
2664
|
protected registerPages(templateLoader: TemplateLoader): Promise<void>;
|
|
2627
2665
|
/**
|
|
@@ -2639,7 +2677,7 @@ declare class ReactServerProvider {
|
|
|
2639
2677
|
/**
|
|
2640
2678
|
* For testing purposes, creates a render function that can be used.
|
|
2641
2679
|
*/
|
|
2642
|
-
render(name: string, options?:
|
|
2680
|
+
render(name: string, options?: PagePrimitiveRenderOptions): Promise<PagePrimitiveRenderResult>;
|
|
2643
2681
|
protected createHandler(route: PageRoute, templateLoader: TemplateLoader): ServerHandler;
|
|
2644
2682
|
renderToHtml(template: string, state: ReactRouterState, hydration?: boolean): string | Redirection;
|
|
2645
2683
|
protected preprocessTemplate(template: string): PreprocessedTemplate;
|
|
@@ -2750,14 +2788,14 @@ declare module "alepha" {
|
|
|
2750
2788
|
/**
|
|
2751
2789
|
* Provides full-stack React development with declarative routing, server-side rendering, and client-side hydration.
|
|
2752
2790
|
*
|
|
2753
|
-
* The React module enables building modern React applications using the `$page`
|
|
2791
|
+
* The React module enables building modern React applications using the `$page` primitive on class properties.
|
|
2754
2792
|
* It delivers seamless server-side rendering, automatic code splitting, and client-side navigation with full
|
|
2755
2793
|
* type safety and schema validation for route parameters and data.
|
|
2756
2794
|
*
|
|
2757
2795
|
* @see {@link $page}
|
|
2758
2796
|
* @module alepha.react
|
|
2759
2797
|
*/
|
|
2760
|
-
declare const AlephaReact:
|
|
2798
|
+
declare const AlephaReact: alepha48.Service<alepha48.Module>;
|
|
2761
2799
|
//#endregion
|
|
2762
|
-
export { $page, ActionContext, AlephaContext, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, type LinkProps, _default as NestedView, NotFoundPage as NotFound, PageAnimation, PageConfigSchema,
|
|
2800
|
+
export { $page, ActionContext, AlephaContext, AlephaReact, AnchorProps, ClientOnly, ConcretePageRoute, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, type LinkProps, _default as NestedView, NotFoundPage as NotFound, PageAnimation, PageConfigSchema, PagePrimitive, PagePrimitiveOptions, PagePrimitiveRenderOptions, PagePrimitiveRenderResult, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactRouter, ReactRouterState, ReactServerProvider, ReactServerProviderOptions, Redirection, RouterGoOptions, RouterLayerContext, RouterLayerContextValue, RouterRenderOptions, RouterStackItem, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActionOptions, UseActionReturn, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, UseSchemaReturn, UseStoreReturn, VirtualRouter, isPageRoute, reactBrowserOptions, reactServerOptions, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
|
|
2763
2801
|
//# sourceMappingURL=index.d.ts.map
|