@alepha/react 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.
- package/dist/auth/index.browser.js +5 -5
- package/dist/auth/index.browser.js.map +1 -1
- package/dist/auth/index.d.ts +330 -330
- package/dist/auth/index.js +7 -7
- package/dist/auth/index.js.map +1 -1
- package/dist/core/index.browser.js +19 -18
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +352 -344
- package/dist/core/index.js +25 -24
- 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 +7 -7
- package/dist/head/index.browser.js.map +1 -1
- package/dist/head/index.d.ts +265 -265
- package/dist/head/index.js +7 -7
- 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 +18 -9
- package/src/auth/index.ts +1 -1
- package/src/auth/providers/ReactAuthProvider.ts +1 -1
- package/src/auth/services/ReactAuth.ts +5 -5
- package/src/core/components/NestedView.tsx +1 -1
- 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 +2 -2
- package/src/core/providers/ReactPageProvider.ts +25 -11
- package/src/core/providers/ReactServerProvider.ts +12 -12
- package/src/core/services/ReactPageServerService.ts +6 -6
- package/src/core/services/ReactPageService.ts +6 -6
- package/src/core/services/ReactRouter.ts +3 -3
- package/src/head/index.browser.ts +3 -3
- package/src/head/index.ts +4 -4
- package/src/head/{descriptors → primitives}/$head.ts +6 -6
- 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 alepha60 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: alepha60.TObject<{
|
|
14
|
+
error: alepha60.TString;
|
|
15
|
+
status: alepha60.TInteger;
|
|
16
|
+
message: alepha60.TString;
|
|
17
|
+
details: alepha60.TOptional<alepha60.TString>;
|
|
18
|
+
requestId: alepha60.TOptional<alepha60.TString>;
|
|
19
|
+
cause: alepha60.TOptional<alepha60.TObject<{
|
|
20
|
+
name: alepha60.TString;
|
|
21
|
+
message: alepha60.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: alepha60.TObject<{
|
|
261
|
+
level: alepha60.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
|
|
262
|
+
message: alepha60.TString;
|
|
263
|
+
service: alepha60.TString;
|
|
264
|
+
module: alepha60.TString;
|
|
265
|
+
context: alepha60.TOptional<alepha60.TString>;
|
|
266
|
+
app: alepha60.TOptional<alepha60.TString>;
|
|
267
|
+
data: alepha60.TOptional<alepha60.TAny>;
|
|
268
|
+
timestamp: alepha60.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: alepha60.HookPrimitive<"start">;
|
|
284
|
+
protected readonly onStop: alepha60.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: alepha60.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: alepha60.TOptional<alepha60.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: alepha60.TOptional<alepha60.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: alepha60.HookPrimitive<"server:onRequest">;
|
|
478
|
+
readonly onResponse: alepha60.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: alepha60.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: alepha60.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: alepha60.TObject<{
|
|
882
|
+
SERVER_PORT: alepha60.TInteger;
|
|
883
|
+
SERVER_HOST: alepha60.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: alepha60.TObject<{
|
|
891
|
+
SERVER_PORT: alepha60.TInteger;
|
|
892
|
+
SERVER_HOST: alepha60.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: alepha60.TObject<{
|
|
1081
|
+
REACT_STRICT_MODE: alepha60.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: alepha60.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;
|
|
@@ -1202,18 +1210,18 @@ interface CreateLayersResult {
|
|
|
1202
1210
|
//#endregion
|
|
1203
1211
|
//#region src/core/services/ReactPageService.d.ts
|
|
1204
1212
|
declare class ReactPageService {
|
|
1205
|
-
fetch(pathname: string, options?:
|
|
1213
|
+
fetch(pathname: string, options?: PagePrimitiveRenderOptions): Promise<{
|
|
1206
1214
|
html: string;
|
|
1207
1215
|
response: Response;
|
|
1208
1216
|
}>;
|
|
1209
|
-
render(name: string, options?:
|
|
1217
|
+
render(name: string, options?: PagePrimitiveRenderOptions): Promise<PagePrimitiveRenderResult>;
|
|
1210
1218
|
}
|
|
1211
1219
|
//#endregion
|
|
1212
|
-
//#region src/core/
|
|
1220
|
+
//#region src/core/primitives/$page.d.ts
|
|
1213
1221
|
/**
|
|
1214
|
-
* Main
|
|
1222
|
+
* Main primitive for defining a React route in the application.
|
|
1215
1223
|
*
|
|
1216
|
-
* The $page
|
|
1224
|
+
* The $page primitive is the core building block for creating type-safe, SSR-enabled React routes.
|
|
1217
1225
|
* It provides a declarative way to define pages with powerful features:
|
|
1218
1226
|
*
|
|
1219
1227
|
* **Routing & Navigation**
|
|
@@ -1299,14 +1307,14 @@ declare class ReactPageService {
|
|
|
1299
1307
|
* ```
|
|
1300
1308
|
*/
|
|
1301
1309
|
declare const $page: {
|
|
1302
|
-
<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = any, TPropsParent extends object = TPropsParentDefault>(options:
|
|
1303
|
-
[KIND]: typeof
|
|
1310
|
+
<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = any, TPropsParent extends object = TPropsParentDefault>(options: PagePrimitiveOptions<TConfig, TProps, TPropsParent>): PagePrimitive<TConfig, TProps, TPropsParent>;
|
|
1311
|
+
[KIND]: typeof PagePrimitive;
|
|
1304
1312
|
};
|
|
1305
|
-
interface
|
|
1313
|
+
interface PagePrimitiveOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
1306
1314
|
/**
|
|
1307
1315
|
* Identifier name for the page. Must be unique.
|
|
1308
1316
|
*
|
|
1309
|
-
* @default
|
|
1317
|
+
* @default Primitive key
|
|
1310
1318
|
*/
|
|
1311
1319
|
name?: string;
|
|
1312
1320
|
/**
|
|
@@ -1358,11 +1366,11 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
|
|
|
1358
1366
|
* Attach child pages to create nested routes.
|
|
1359
1367
|
* This will make the page a parent route.
|
|
1360
1368
|
*/
|
|
1361
|
-
children?: Array<
|
|
1369
|
+
children?: Array<PagePrimitive> | (() => Array<PagePrimitive>);
|
|
1362
1370
|
/**
|
|
1363
1371
|
* Define a parent page for nested routing.
|
|
1364
1372
|
*/
|
|
1365
|
-
parent?:
|
|
1373
|
+
parent?: PagePrimitive<PageConfigSchema, TPropsParent, any>;
|
|
1366
1374
|
can?: () => boolean;
|
|
1367
1375
|
/**
|
|
1368
1376
|
* Catch any error from the `resolve` function or during `rendering`.
|
|
@@ -1472,7 +1480,7 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
|
|
|
1472
1480
|
animation?: PageAnimation;
|
|
1473
1481
|
}
|
|
1474
1482
|
type ErrorHandler = (error: Error, state: ReactRouterState) => ReactNode | Redirection | undefined;
|
|
1475
|
-
declare class
|
|
1483
|
+
declare class PagePrimitive<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> extends Primitive<PagePrimitiveOptions<TConfig, TProps, TPropsParent>> {
|
|
1476
1484
|
protected readonly reactPageService: ReactPageService;
|
|
1477
1485
|
protected onInit(): void;
|
|
1478
1486
|
get name(): string;
|
|
@@ -1482,8 +1490,8 @@ declare class PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema
|
|
|
1482
1490
|
* This will render the page (HTML layout included or not) and return the HTML + context.
|
|
1483
1491
|
* Only valid for server-side rendering, it will throw an error if called on the client-side.
|
|
1484
1492
|
*/
|
|
1485
|
-
render(options?:
|
|
1486
|
-
fetch(options?:
|
|
1493
|
+
render(options?: PagePrimitiveRenderOptions): Promise<PagePrimitiveRenderResult>;
|
|
1494
|
+
fetch(options?: PagePrimitiveRenderOptions): Promise<{
|
|
1487
1495
|
html: string;
|
|
1488
1496
|
response: Response;
|
|
1489
1497
|
}>;
|
|
@@ -1496,7 +1504,7 @@ interface PageConfigSchema {
|
|
|
1496
1504
|
}
|
|
1497
1505
|
type TPropsDefault = any;
|
|
1498
1506
|
type TPropsParentDefault = {};
|
|
1499
|
-
interface
|
|
1507
|
+
interface PagePrimitiveRenderOptions {
|
|
1500
1508
|
params?: Record<string, string>;
|
|
1501
1509
|
query?: Record<string, string>;
|
|
1502
1510
|
/**
|
|
@@ -1508,7 +1516,7 @@ interface PageDescriptorRenderOptions {
|
|
|
1508
1516
|
html?: boolean;
|
|
1509
1517
|
hydration?: boolean;
|
|
1510
1518
|
}
|
|
1511
|
-
interface
|
|
1519
|
+
interface PagePrimitiveRenderResult {
|
|
1512
1520
|
html: string;
|
|
1513
1521
|
state: ReactRouterState;
|
|
1514
1522
|
redirect?: string;
|
|
@@ -1531,15 +1539,15 @@ type CssAnimation = {
|
|
|
1531
1539
|
};
|
|
1532
1540
|
//#endregion
|
|
1533
1541
|
//#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:
|
|
1542
|
+
declare const userAccountInfoSchema: alepha60.TObject<{
|
|
1543
|
+
id: alepha60.TString;
|
|
1544
|
+
name: alepha60.TOptional<alepha60.TString>;
|
|
1545
|
+
email: alepha60.TOptional<alepha60.TString>;
|
|
1546
|
+
username: alepha60.TOptional<alepha60.TString>;
|
|
1547
|
+
picture: alepha60.TOptional<alepha60.TString>;
|
|
1548
|
+
sessionId: alepha60.TOptional<alepha60.TString>;
|
|
1549
|
+
organizations: alepha60.TOptional<alepha60.TArray<alepha60.TString>>;
|
|
1550
|
+
roles: alepha60.TOptional<alepha60.TArray<alepha60.TString>>;
|
|
1543
1551
|
}>;
|
|
1544
1552
|
type UserAccount = Static<typeof userAccountInfoSchema>;
|
|
1545
1553
|
//#endregion
|
|
@@ -1565,8 +1573,8 @@ interface UserAccountToken extends UserAccount {
|
|
|
1565
1573
|
}
|
|
1566
1574
|
//#endregion
|
|
1567
1575
|
//#region ../alepha/src/security/providers/SecurityProvider.d.ts
|
|
1568
|
-
declare const envSchema$2:
|
|
1569
|
-
APP_SECRET:
|
|
1576
|
+
declare const envSchema$2: alepha60.TObject<{
|
|
1577
|
+
APP_SECRET: alepha60.TString;
|
|
1570
1578
|
}>;
|
|
1571
1579
|
declare module "alepha" {
|
|
1572
1580
|
interface Env extends Partial<Static<typeof envSchema$2>> {}
|
|
@@ -1584,7 +1592,7 @@ declare module "alepha" {
|
|
|
1584
1592
|
/**
|
|
1585
1593
|
* Provides comprehensive authentication and authorization capabilities with JWT tokens, role-based access control, and user management.
|
|
1586
1594
|
*
|
|
1587
|
-
* The security module enables building secure applications using
|
|
1595
|
+
* The security module enables building secure applications using primitives like `$realm`, `$role`, and `$permission`
|
|
1588
1596
|
* on class properties. It offers JWT-based authentication, fine-grained permissions, service accounts, and seamless
|
|
1589
1597
|
* integration with various authentication providers and user management systems.
|
|
1590
1598
|
*
|
|
@@ -1659,23 +1667,23 @@ declare module "alepha/server" {
|
|
|
1659
1667
|
*/
|
|
1660
1668
|
//#endregion
|
|
1661
1669
|
//#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:
|
|
1670
|
+
declare const apiLinkSchema: alepha60.TObject<{
|
|
1671
|
+
name: alepha60.TString;
|
|
1672
|
+
group: alepha60.TOptional<alepha60.TString>;
|
|
1673
|
+
path: alepha60.TString;
|
|
1674
|
+
method: alepha60.TOptional<alepha60.TString>;
|
|
1675
|
+
requestBodyType: alepha60.TOptional<alepha60.TString>;
|
|
1676
|
+
service: alepha60.TOptional<alepha60.TString>;
|
|
1669
1677
|
}>;
|
|
1670
|
-
declare const apiLinksResponseSchema:
|
|
1671
|
-
prefix:
|
|
1672
|
-
links:
|
|
1673
|
-
name:
|
|
1674
|
-
group:
|
|
1675
|
-
path:
|
|
1676
|
-
method:
|
|
1677
|
-
requestBodyType:
|
|
1678
|
-
service:
|
|
1678
|
+
declare const apiLinksResponseSchema: alepha60.TObject<{
|
|
1679
|
+
prefix: alepha60.TOptional<alepha60.TString>;
|
|
1680
|
+
links: alepha60.TArray<alepha60.TObject<{
|
|
1681
|
+
name: alepha60.TString;
|
|
1682
|
+
group: alepha60.TOptional<alepha60.TString>;
|
|
1683
|
+
path: alepha60.TString;
|
|
1684
|
+
method: alepha60.TOptional<alepha60.TString>;
|
|
1685
|
+
requestBodyType: alepha60.TOptional<alepha60.TString>;
|
|
1686
|
+
service: alepha60.TOptional<alepha60.TString>;
|
|
1679
1687
|
}>>;
|
|
1680
1688
|
}>;
|
|
1681
1689
|
type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
|
|
@@ -1742,8 +1750,8 @@ interface ClientScope {
|
|
|
1742
1750
|
service?: string;
|
|
1743
1751
|
hostname?: string;
|
|
1744
1752
|
}
|
|
1745
|
-
type HttpVirtualClient<T$1> = { [K in keyof T$1 as T$1[K] extends
|
|
1746
|
-
interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<
|
|
1753
|
+
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 };
|
|
1754
|
+
interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<ActionPrimitive<T$1>, "name" | "run" | "fetch"> {
|
|
1747
1755
|
(config?: ClientRequestEntry<T$1>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T$1>>;
|
|
1748
1756
|
can: () => boolean;
|
|
1749
1757
|
}
|
|
@@ -1763,7 +1771,7 @@ declare module "alepha" {
|
|
|
1763
1771
|
/**
|
|
1764
1772
|
* Provides server-side link management and remote capabilities for client-server interactions.
|
|
1765
1773
|
*
|
|
1766
|
-
* The server-links module enables declarative link definitions using `$remote` and `$client`
|
|
1774
|
+
* The server-links module enables declarative link definitions using `$remote` and `$client` primitives,
|
|
1767
1775
|
* facilitating seamless API endpoint management and client-server communication. It integrates with server
|
|
1768
1776
|
* security features to ensure safe and controlled access to resources.
|
|
1769
1777
|
*
|
|
@@ -1781,14 +1789,14 @@ declare class ReactBrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
1781
1789
|
protected readonly alepha: Alepha;
|
|
1782
1790
|
protected readonly pageApi: ReactPageProvider;
|
|
1783
1791
|
add(entry: PageRouteEntry): void;
|
|
1784
|
-
protected readonly configure:
|
|
1792
|
+
protected readonly configure: alepha60.HookPrimitive<"configure">;
|
|
1785
1793
|
transition(url: URL, previous?: PreviousLayerData[], meta?: {}): Promise<string | void>;
|
|
1786
1794
|
root(state: ReactRouterState): ReactNode;
|
|
1787
1795
|
}
|
|
1788
1796
|
//#endregion
|
|
1789
1797
|
//#region src/core/providers/ReactBrowserProvider.d.ts
|
|
1790
|
-
declare const envSchema$1:
|
|
1791
|
-
REACT_ROOT_ID:
|
|
1798
|
+
declare const envSchema$1: alepha60.TObject<{
|
|
1799
|
+
REACT_ROOT_ID: alepha60.TString;
|
|
1792
1800
|
}>;
|
|
1793
1801
|
declare module "alepha" {
|
|
1794
1802
|
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
@@ -1796,8 +1804,8 @@ declare module "alepha" {
|
|
|
1796
1804
|
/**
|
|
1797
1805
|
* React browser renderer configuration atom
|
|
1798
1806
|
*/
|
|
1799
|
-
declare const reactBrowserOptions:
|
|
1800
|
-
scrollRestoration:
|
|
1807
|
+
declare const reactBrowserOptions: alepha60.Atom<alepha60.TObject<{
|
|
1808
|
+
scrollRestoration: alepha60.TUnsafe<"top" | "manual">;
|
|
1801
1809
|
}>, "alepha.react.browser.options">;
|
|
1802
1810
|
type ReactBrowserRendererOptions = Static<typeof reactBrowserOptions.schema>;
|
|
1803
1811
|
declare module "alepha" {
|
|
@@ -1845,8 +1853,8 @@ declare class ReactBrowserProvider {
|
|
|
1845
1853
|
* Get embedded layers from the server.
|
|
1846
1854
|
*/
|
|
1847
1855
|
protected getHydrationState(): ReactHydrationState | undefined;
|
|
1848
|
-
protected readonly onTransitionEnd:
|
|
1849
|
-
readonly ready:
|
|
1856
|
+
protected readonly onTransitionEnd: alepha60.HookPrimitive<"react:transition:end">;
|
|
1857
|
+
readonly ready: alepha60.HookPrimitive<"ready">;
|
|
1850
1858
|
}
|
|
1851
1859
|
interface RouterGoOptions {
|
|
1852
1860
|
replace?: boolean;
|
|
@@ -2284,7 +2292,7 @@ declare class ReactRouter<T$1 extends object> {
|
|
|
2284
2292
|
protected readonly pageApi: ReactPageProvider;
|
|
2285
2293
|
get state(): ReactRouterState;
|
|
2286
2294
|
get pages(): PageRoute[];
|
|
2287
|
-
get concretePages():
|
|
2295
|
+
get concretePages(): ConcretePageRoute[];
|
|
2288
2296
|
get browser(): ReactBrowserProvider | undefined;
|
|
2289
2297
|
isActive(href: string, options?: {
|
|
2290
2298
|
startWith?: boolean;
|
|
@@ -2324,7 +2332,7 @@ declare class ReactRouter<T$1 extends object> {
|
|
|
2324
2332
|
push?: boolean;
|
|
2325
2333
|
}): void;
|
|
2326
2334
|
}
|
|
2327
|
-
type VirtualRouter<T$1> = { [K in keyof T$1 as T$1[K] extends
|
|
2335
|
+
type VirtualRouter<T$1> = { [K in keyof T$1 as T$1[K] extends PagePrimitive ? K : never]: T$1[K] };
|
|
2328
2336
|
//#endregion
|
|
2329
2337
|
//#region src/core/hooks/useRouter.d.ts
|
|
2330
2338
|
/**
|
|
@@ -2346,8 +2354,8 @@ declare const useRouter: <T$1 extends object = any>() => ReactRouter<T$1>;
|
|
|
2346
2354
|
//#region src/core/hooks/useRouterState.d.ts
|
|
2347
2355
|
declare const useRouterState: () => ReactRouterState;
|
|
2348
2356
|
//#endregion
|
|
2349
|
-
//#region ../alepha/src/server-static/
|
|
2350
|
-
interface
|
|
2357
|
+
//#region ../alepha/src/server-static/primitives/$serve.d.ts
|
|
2358
|
+
interface ServePrimitiveOptions {
|
|
2351
2359
|
/**
|
|
2352
2360
|
* Prefix for the served path.
|
|
2353
2361
|
*
|
|
@@ -2361,7 +2369,7 @@ interface ServeDescriptorOptions {
|
|
|
2361
2369
|
*/
|
|
2362
2370
|
root?: string;
|
|
2363
2371
|
/**
|
|
2364
|
-
* If true,
|
|
2372
|
+
* If true, primitive will be ignored.
|
|
2365
2373
|
*
|
|
2366
2374
|
* @default false
|
|
2367
2375
|
*/
|
|
@@ -2384,7 +2392,7 @@ interface ServeDescriptorOptions {
|
|
|
2384
2392
|
*/
|
|
2385
2393
|
historyApiFallback?: boolean;
|
|
2386
2394
|
/**
|
|
2387
|
-
* Optional name of the
|
|
2395
|
+
* Optional name of the primitive.
|
|
2388
2396
|
* This is used for logging and debugging purposes.
|
|
2389
2397
|
*
|
|
2390
2398
|
* @default Key name.
|
|
@@ -2553,26 +2561,26 @@ declare class ServerStaticProvider {
|
|
|
2553
2561
|
protected readonly fileDetector: FileDetector;
|
|
2554
2562
|
protected readonly log: Logger;
|
|
2555
2563
|
protected readonly directories: ServeDirectory[];
|
|
2556
|
-
protected readonly configure:
|
|
2557
|
-
createStaticServer(options:
|
|
2558
|
-
createFileHandler(filepath: string, options:
|
|
2564
|
+
protected readonly configure: alepha60.HookPrimitive<"configure">;
|
|
2565
|
+
createStaticServer(options: ServePrimitiveOptions): Promise<void>;
|
|
2566
|
+
createFileHandler(filepath: string, options: ServePrimitiveOptions): Promise<ServerHandler>;
|
|
2559
2567
|
protected getCacheFileTypes(): string[];
|
|
2560
|
-
protected getCacheControl(filename: string, options:
|
|
2568
|
+
protected getCacheControl(filename: string, options: ServePrimitiveOptions): {
|
|
2561
2569
|
maxAge: number;
|
|
2562
2570
|
immutable: boolean;
|
|
2563
2571
|
} | undefined;
|
|
2564
2572
|
getAllFiles(dir: string, ignoreDotEnvFiles?: boolean): Promise<string[]>;
|
|
2565
2573
|
}
|
|
2566
2574
|
interface ServeDirectory {
|
|
2567
|
-
options:
|
|
2575
|
+
options: ServePrimitiveOptions;
|
|
2568
2576
|
files: string[];
|
|
2569
2577
|
}
|
|
2570
2578
|
//#endregion
|
|
2571
2579
|
//#region src/core/providers/ReactServerProvider.d.ts
|
|
2572
|
-
declare const envSchema:
|
|
2573
|
-
REACT_SSR_ENABLED:
|
|
2574
|
-
REACT_ROOT_ID:
|
|
2575
|
-
REACT_SERVER_TEMPLATE:
|
|
2580
|
+
declare const envSchema: alepha60.TObject<{
|
|
2581
|
+
REACT_SSR_ENABLED: alepha60.TOptional<alepha60.TBoolean>;
|
|
2582
|
+
REACT_ROOT_ID: alepha60.TString;
|
|
2583
|
+
REACT_SERVER_TEMPLATE: alepha60.TOptional<alepha60.TString>;
|
|
2576
2584
|
}>;
|
|
2577
2585
|
declare module "alepha" {
|
|
2578
2586
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
@@ -2583,11 +2591,11 @@ declare module "alepha" {
|
|
|
2583
2591
|
/**
|
|
2584
2592
|
* React server provider configuration atom
|
|
2585
2593
|
*/
|
|
2586
|
-
declare const reactServerOptions:
|
|
2587
|
-
publicDir:
|
|
2588
|
-
staticServer:
|
|
2589
|
-
disabled:
|
|
2590
|
-
path:
|
|
2594
|
+
declare const reactServerOptions: alepha60.Atom<alepha60.TObject<{
|
|
2595
|
+
publicDir: alepha60.TString;
|
|
2596
|
+
staticServer: alepha60.TObject<{
|
|
2597
|
+
disabled: alepha60.TBoolean;
|
|
2598
|
+
path: alepha60.TString;
|
|
2591
2599
|
}>;
|
|
2592
2600
|
}>, "alepha.react.server.options">;
|
|
2593
2601
|
type ReactServerProviderOptions = Static<typeof reactServerOptions.schema>;
|
|
@@ -2621,7 +2629,7 @@ declare class ReactServerProvider {
|
|
|
2621
2629
|
/**
|
|
2622
2630
|
* Configure the React server provider.
|
|
2623
2631
|
*/
|
|
2624
|
-
readonly onConfigure:
|
|
2632
|
+
readonly onConfigure: alepha60.HookPrimitive<"configure">;
|
|
2625
2633
|
get template(): string;
|
|
2626
2634
|
protected registerPages(templateLoader: TemplateLoader): Promise<void>;
|
|
2627
2635
|
/**
|
|
@@ -2639,7 +2647,7 @@ declare class ReactServerProvider {
|
|
|
2639
2647
|
/**
|
|
2640
2648
|
* For testing purposes, creates a render function that can be used.
|
|
2641
2649
|
*/
|
|
2642
|
-
render(name: string, options?:
|
|
2650
|
+
render(name: string, options?: PagePrimitiveRenderOptions): Promise<PagePrimitiveRenderResult>;
|
|
2643
2651
|
protected createHandler(route: PageRoute, templateLoader: TemplateLoader): ServerHandler;
|
|
2644
2652
|
renderToHtml(template: string, state: ReactRouterState, hydration?: boolean): string | Redirection;
|
|
2645
2653
|
protected preprocessTemplate(template: string): PreprocessedTemplate;
|
|
@@ -2750,14 +2758,14 @@ declare module "alepha" {
|
|
|
2750
2758
|
/**
|
|
2751
2759
|
* Provides full-stack React development with declarative routing, server-side rendering, and client-side hydration.
|
|
2752
2760
|
*
|
|
2753
|
-
* The React module enables building modern React applications using the `$page`
|
|
2761
|
+
* The React module enables building modern React applications using the `$page` primitive on class properties.
|
|
2754
2762
|
* It delivers seamless server-side rendering, automatic code splitting, and client-side navigation with full
|
|
2755
2763
|
* type safety and schema validation for route parameters and data.
|
|
2756
2764
|
*
|
|
2757
2765
|
* @see {@link $page}
|
|
2758
2766
|
* @module alepha.react
|
|
2759
2767
|
*/
|
|
2760
|
-
declare const AlephaReact:
|
|
2768
|
+
declare const AlephaReact: alepha60.Service<alepha60.Module>;
|
|
2761
2769
|
//#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,
|
|
2770
|
+
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
2771
|
//# sourceMappingURL=index.d.ts.map
|