@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/auth/index.d.ts
CHANGED
|
@@ -1,256 +1,57 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Alepha, AlephaError, Async,
|
|
3
|
-
import dayjsDuration from "dayjs/plugin/duration.js";
|
|
4
|
-
import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
|
|
1
|
+
import * as alepha20 from "alepha";
|
|
2
|
+
import { Alepha, AlephaError, Async, FileLike, InstantiableClass, LogLevel, LoggerInterface, Primitive, Static, StreamLike, TArray, TFile, TObject, TRecord, TSchema, TStream, TString, TVoid } from "alepha";
|
|
5
3
|
import { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
6
4
|
import { Readable } from "node:stream";
|
|
7
5
|
import { ReadableStream } from "node:stream/web";
|
|
6
|
+
import dayjsDuration from "dayjs/plugin/duration.js";
|
|
7
|
+
import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
|
|
8
8
|
|
|
9
9
|
//#region ../alepha/src/security/schemas/userAccountInfoSchema.d.ts
|
|
10
|
-
declare const userAccountInfoSchema:
|
|
11
|
-
id:
|
|
12
|
-
name:
|
|
13
|
-
email:
|
|
14
|
-
username:
|
|
15
|
-
picture:
|
|
16
|
-
sessionId:
|
|
17
|
-
organizations:
|
|
18
|
-
roles:
|
|
10
|
+
declare const userAccountInfoSchema: alepha20.TObject<{
|
|
11
|
+
id: alepha20.TString;
|
|
12
|
+
name: alepha20.TOptional<alepha20.TString>;
|
|
13
|
+
email: alepha20.TOptional<alepha20.TString>;
|
|
14
|
+
username: alepha20.TOptional<alepha20.TString>;
|
|
15
|
+
picture: alepha20.TOptional<alepha20.TString>;
|
|
16
|
+
sessionId: alepha20.TOptional<alepha20.TString>;
|
|
17
|
+
organizations: alepha20.TOptional<alepha20.TArray<alepha20.TString>>;
|
|
18
|
+
roles: alepha20.TOptional<alepha20.TArray<alepha20.TString>>;
|
|
19
19
|
}>;
|
|
20
20
|
type UserAccount = Static<typeof userAccountInfoSchema>;
|
|
21
21
|
//#endregion
|
|
22
|
-
//#region ../alepha/src/
|
|
23
|
-
declare const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
type LogEntry = Static<typeof logEntrySchema>;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region ../alepha/src/datetime/providers/DateTimeProvider.d.ts
|
|
36
|
-
type DateTime = DayjsApi.Dayjs;
|
|
37
|
-
type Duration = dayjsDuration.Duration;
|
|
38
|
-
type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
|
|
39
|
-
declare class DateTimeProvider {
|
|
40
|
-
static PLUGINS: Array<PluginFunc<any>>;
|
|
41
|
-
protected alepha: Alepha;
|
|
42
|
-
protected ref: DateTime | null;
|
|
43
|
-
protected readonly timeouts: Timeout[];
|
|
44
|
-
protected readonly intervals: Interval[];
|
|
45
|
-
constructor();
|
|
46
|
-
protected readonly onStart: alepha18.HookDescriptor<"start">;
|
|
47
|
-
protected readonly onStop: alepha18.HookDescriptor<"stop">;
|
|
48
|
-
setLocale(locale: string): void;
|
|
49
|
-
isDateTime(value: unknown): value is DateTime;
|
|
50
|
-
/**
|
|
51
|
-
* Create a new UTC DateTime instance.
|
|
52
|
-
*/
|
|
53
|
-
utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
54
|
-
/**
|
|
55
|
-
* Create a new DateTime instance.
|
|
56
|
-
*/
|
|
57
|
-
of(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
58
|
-
/**
|
|
59
|
-
* Get the current date as a string.
|
|
60
|
-
*/
|
|
61
|
-
toISOString(date?: Date | string | DateTime): string;
|
|
62
|
-
/**
|
|
63
|
-
* Get the current date.
|
|
64
|
-
*/
|
|
65
|
-
now(): DateTime;
|
|
66
|
-
/**
|
|
67
|
-
* Get the current date as a string.
|
|
68
|
-
*
|
|
69
|
-
* This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
|
|
70
|
-
*/
|
|
71
|
-
nowISOString(): string;
|
|
72
|
-
/**
|
|
73
|
-
* Get the current date as milliseconds since epoch.
|
|
74
|
-
*
|
|
75
|
-
* This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
|
|
76
|
-
*/
|
|
77
|
-
nowMillis(): number;
|
|
78
|
-
/**
|
|
79
|
-
* Get the current date as a string.
|
|
80
|
-
*
|
|
81
|
-
* @protected
|
|
82
|
-
*/
|
|
83
|
-
protected getCurrentDate(): DateTime;
|
|
84
|
-
/**
|
|
85
|
-
* Create a new Duration instance.
|
|
86
|
-
*/
|
|
87
|
-
duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
|
|
88
|
-
isDurationLike(value: unknown): value is DurationLike;
|
|
89
|
-
/**
|
|
90
|
-
* Return a promise that resolves after the next tick.
|
|
91
|
-
* It uses `setTimeout` with 0 ms delay.
|
|
92
|
-
*/
|
|
93
|
-
tick(): Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* Wait for a certain duration.
|
|
96
|
-
*
|
|
97
|
-
* You can clear the timeout by using the `AbortSignal` API.
|
|
98
|
-
* Aborted signal will resolve the promise immediately, it does not reject it.
|
|
99
|
-
*/
|
|
100
|
-
wait(duration: DurationLike, options?: {
|
|
101
|
-
signal?: AbortSignal;
|
|
102
|
-
now?: number;
|
|
103
|
-
}): Promise<void>;
|
|
104
|
-
createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
|
|
105
|
-
/**
|
|
106
|
-
* Run a callback after a certain duration.
|
|
107
|
-
*/
|
|
108
|
-
createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
|
|
109
|
-
clearTimeout(timeout: Timeout): void;
|
|
110
|
-
clearInterval(interval: Interval): void;
|
|
111
|
-
/**
|
|
112
|
-
* Run a function with a deadline.
|
|
113
|
-
*/
|
|
114
|
-
deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike): Promise<T>;
|
|
115
|
-
/**
|
|
116
|
-
* Add time to the current date.
|
|
117
|
-
*/
|
|
118
|
-
travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
|
|
119
|
-
/**
|
|
120
|
-
* Stop the time.
|
|
121
|
-
*/
|
|
122
|
-
pause(): DateTime;
|
|
123
|
-
/**
|
|
124
|
-
* Reset the reference date.
|
|
125
|
-
*/
|
|
126
|
-
reset(): void;
|
|
127
|
-
}
|
|
128
|
-
interface Interval {
|
|
129
|
-
timer?: any;
|
|
130
|
-
duration: number;
|
|
131
|
-
run: () => unknown;
|
|
132
|
-
}
|
|
133
|
-
interface Timeout {
|
|
134
|
-
now: number;
|
|
135
|
-
timer?: any;
|
|
136
|
-
duration: number;
|
|
137
|
-
callback: () => void;
|
|
138
|
-
clear: () => void;
|
|
139
|
-
}
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region ../alepha/src/logger/providers/LogDestinationProvider.d.ts
|
|
142
|
-
declare abstract class LogDestinationProvider {
|
|
143
|
-
abstract write(message: string, entry: LogEntry): void;
|
|
144
|
-
}
|
|
145
|
-
//#endregion
|
|
146
|
-
//#region ../alepha/src/logger/providers/LogFormatterProvider.d.ts
|
|
147
|
-
declare abstract class LogFormatterProvider {
|
|
148
|
-
abstract format(entry: LogEntry): string;
|
|
149
|
-
}
|
|
150
|
-
//#endregion
|
|
151
|
-
//#region ../alepha/src/logger/services/Logger.d.ts
|
|
152
|
-
declare class Logger implements LoggerInterface {
|
|
153
|
-
protected readonly alepha: Alepha;
|
|
154
|
-
protected readonly formatter: LogFormatterProvider;
|
|
155
|
-
protected readonly destination: LogDestinationProvider;
|
|
156
|
-
protected readonly dateTimeProvider: DateTimeProvider;
|
|
157
|
-
protected readonly levels: Record<string, number>;
|
|
158
|
-
protected readonly service: string;
|
|
159
|
-
protected readonly module: string;
|
|
160
|
-
protected readonly app?: string;
|
|
161
|
-
protected appLogLevel: string;
|
|
162
|
-
protected logLevel: LogLevel;
|
|
163
|
-
constructor(service: string, module: string);
|
|
164
|
-
get context(): string | undefined;
|
|
165
|
-
get level(): string;
|
|
166
|
-
parseLevel(level: string, app: string): LogLevel;
|
|
167
|
-
private matchesPattern;
|
|
168
|
-
asLogLevel(something: string): LogLevel;
|
|
169
|
-
error(message: string, data?: unknown): void;
|
|
170
|
-
warn(message: string, data?: unknown): void;
|
|
171
|
-
info(message: string, data?: unknown): void;
|
|
172
|
-
debug(message: string, data?: unknown): void;
|
|
173
|
-
trace(message: string, data?: unknown): void;
|
|
174
|
-
protected log(level: LogLevel, message: string, data?: unknown): void;
|
|
175
|
-
protected emit(entry: LogEntry, message?: string): void;
|
|
176
|
-
}
|
|
177
|
-
//#endregion
|
|
178
|
-
//#region ../alepha/src/logger/index.d.ts
|
|
179
|
-
declare const envSchema$3: alepha18.TObject<{
|
|
180
|
-
/**
|
|
181
|
-
* Default log level for the application.
|
|
182
|
-
*
|
|
183
|
-
* Default by environment:
|
|
184
|
-
* - dev = info
|
|
185
|
-
* - prod = info
|
|
186
|
-
* - test = error
|
|
187
|
-
*
|
|
188
|
-
* Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
|
|
189
|
-
*
|
|
190
|
-
* Level can be set for a specific module:
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
* LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
|
|
194
|
-
* LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
|
|
195
|
-
*/
|
|
196
|
-
LOG_LEVEL: alepha18.TOptional<alepha18.TString>;
|
|
197
|
-
/**
|
|
198
|
-
* Built-in log formats.
|
|
199
|
-
* - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
|
|
200
|
-
* - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
|
|
201
|
-
* - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
|
|
202
|
-
*/
|
|
203
|
-
LOG_FORMAT: alepha18.TOptional<alepha18.TUnsafe<"json" | "pretty" | "raw">>;
|
|
22
|
+
//#region ../alepha/src/server/schemas/errorSchema.d.ts
|
|
23
|
+
declare const errorSchema: alepha20.TObject<{
|
|
24
|
+
error: alepha20.TString;
|
|
25
|
+
status: alepha20.TInteger;
|
|
26
|
+
message: alepha20.TString;
|
|
27
|
+
details: alepha20.TOptional<alepha20.TString>;
|
|
28
|
+
requestId: alepha20.TOptional<alepha20.TString>;
|
|
29
|
+
cause: alepha20.TOptional<alepha20.TObject<{
|
|
30
|
+
name: alepha20.TString;
|
|
31
|
+
message: alepha20.TString;
|
|
32
|
+
}>>;
|
|
204
33
|
}>;
|
|
205
|
-
|
|
206
|
-
interface Env extends Partial<Static<typeof envSchema$3>> {}
|
|
207
|
-
interface State {
|
|
208
|
-
/**
|
|
209
|
-
* Current log level for the application or specific modules.
|
|
210
|
-
*/
|
|
211
|
-
"alepha.logger.level"?: string;
|
|
212
|
-
}
|
|
213
|
-
interface Hooks {
|
|
214
|
-
log: {
|
|
215
|
-
message?: string;
|
|
216
|
-
entry: LogEntry;
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
}
|
|
34
|
+
type ErrorSchema = Static<typeof errorSchema>;
|
|
220
35
|
//#endregion
|
|
221
|
-
//#region ../alepha/src/
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Is user dedicated to his own resources for this scope ?
|
|
237
|
-
* Mostly, Admin is false and Customer is true.
|
|
238
|
-
*/
|
|
239
|
-
ownership?: string | boolean;
|
|
36
|
+
//#region ../alepha/src/server/errors/HttpError.d.ts
|
|
37
|
+
declare class HttpError extends AlephaError {
|
|
38
|
+
name: string;
|
|
39
|
+
static is: (error: unknown, status?: number) => error is HttpErrorLike;
|
|
40
|
+
static toJSON(error: HttpError): ErrorSchema;
|
|
41
|
+
readonly error: string;
|
|
42
|
+
readonly status: number;
|
|
43
|
+
readonly requestId?: string;
|
|
44
|
+
readonly details?: string;
|
|
45
|
+
readonly reason?: {
|
|
46
|
+
name: string;
|
|
47
|
+
message: string;
|
|
48
|
+
};
|
|
49
|
+
constructor(options: Partial<ErrorSchema>, cause?: unknown);
|
|
240
50
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
declare const envSchema$2: alepha18.TObject<{
|
|
244
|
-
APP_SECRET: alepha18.TString;
|
|
245
|
-
}>;
|
|
246
|
-
declare module "alepha" {
|
|
247
|
-
interface Env extends Partial<Static<typeof envSchema$2>> {}
|
|
51
|
+
interface HttpErrorLike extends Error {
|
|
52
|
+
status: number;
|
|
248
53
|
}
|
|
249
54
|
//#endregion
|
|
250
|
-
//#region ../alepha/src/server/constants/routeMethods.d.ts
|
|
251
|
-
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
252
|
-
type RouteMethod = (typeof routeMethods)[number];
|
|
253
|
-
//#endregion
|
|
254
55
|
//#region ../alepha/src/router/providers/RouterProvider.d.ts
|
|
255
56
|
declare abstract class RouterProvider<T extends Route = Route> {
|
|
256
57
|
protected routePathRegex: RegExp;
|
|
@@ -295,6 +96,10 @@ interface Tree<T extends Route> {
|
|
|
295
96
|
};
|
|
296
97
|
}
|
|
297
98
|
//#endregion
|
|
99
|
+
//#region ../alepha/src/server/constants/routeMethods.d.ts
|
|
100
|
+
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
101
|
+
type RouteMethod = (typeof routeMethods)[number];
|
|
102
|
+
//#endregion
|
|
298
103
|
//#region ../alepha/src/server/helpers/ServerReply.d.ts
|
|
299
104
|
/**
|
|
300
105
|
* Helper for building server replies.
|
|
@@ -461,6 +266,205 @@ interface WebRequestEvent {
|
|
|
461
266
|
res?: Response;
|
|
462
267
|
}
|
|
463
268
|
//#endregion
|
|
269
|
+
//#region ../alepha/src/logger/schemas/logEntrySchema.d.ts
|
|
270
|
+
declare const logEntrySchema: alepha20.TObject<{
|
|
271
|
+
level: alepha20.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
|
|
272
|
+
message: alepha20.TString;
|
|
273
|
+
service: alepha20.TString;
|
|
274
|
+
module: alepha20.TString;
|
|
275
|
+
context: alepha20.TOptional<alepha20.TString>;
|
|
276
|
+
app: alepha20.TOptional<alepha20.TString>;
|
|
277
|
+
data: alepha20.TOptional<alepha20.TAny>;
|
|
278
|
+
timestamp: alepha20.TNumber;
|
|
279
|
+
}>;
|
|
280
|
+
type LogEntry = Static<typeof logEntrySchema>;
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region ../alepha/src/datetime/providers/DateTimeProvider.d.ts
|
|
283
|
+
type DateTime = DayjsApi.Dayjs;
|
|
284
|
+
type Duration = dayjsDuration.Duration;
|
|
285
|
+
type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
|
|
286
|
+
declare class DateTimeProvider {
|
|
287
|
+
static PLUGINS: Array<PluginFunc<any>>;
|
|
288
|
+
protected alepha: Alepha;
|
|
289
|
+
protected ref: DateTime | null;
|
|
290
|
+
protected readonly timeouts: Timeout[];
|
|
291
|
+
protected readonly intervals: Interval[];
|
|
292
|
+
constructor();
|
|
293
|
+
protected readonly onStart: alepha20.HookPrimitive<"start">;
|
|
294
|
+
protected readonly onStop: alepha20.HookPrimitive<"stop">;
|
|
295
|
+
setLocale(locale: string): void;
|
|
296
|
+
isDateTime(value: unknown): value is DateTime;
|
|
297
|
+
/**
|
|
298
|
+
* Create a new UTC DateTime instance.
|
|
299
|
+
*/
|
|
300
|
+
utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
301
|
+
/**
|
|
302
|
+
* Create a new DateTime instance.
|
|
303
|
+
*/
|
|
304
|
+
of(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
305
|
+
/**
|
|
306
|
+
* Get the current date as a string.
|
|
307
|
+
*/
|
|
308
|
+
toISOString(date?: Date | string | DateTime): string;
|
|
309
|
+
/**
|
|
310
|
+
* Get the current date.
|
|
311
|
+
*/
|
|
312
|
+
now(): DateTime;
|
|
313
|
+
/**
|
|
314
|
+
* Get the current date as a string.
|
|
315
|
+
*
|
|
316
|
+
* This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
|
|
317
|
+
*/
|
|
318
|
+
nowISOString(): string;
|
|
319
|
+
/**
|
|
320
|
+
* Get the current date as milliseconds since epoch.
|
|
321
|
+
*
|
|
322
|
+
* This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
|
|
323
|
+
*/
|
|
324
|
+
nowMillis(): number;
|
|
325
|
+
/**
|
|
326
|
+
* Get the current date as a string.
|
|
327
|
+
*
|
|
328
|
+
* @protected
|
|
329
|
+
*/
|
|
330
|
+
protected getCurrentDate(): DateTime;
|
|
331
|
+
/**
|
|
332
|
+
* Create a new Duration instance.
|
|
333
|
+
*/
|
|
334
|
+
duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
|
|
335
|
+
isDurationLike(value: unknown): value is DurationLike;
|
|
336
|
+
/**
|
|
337
|
+
* Return a promise that resolves after the next tick.
|
|
338
|
+
* It uses `setTimeout` with 0 ms delay.
|
|
339
|
+
*/
|
|
340
|
+
tick(): Promise<void>;
|
|
341
|
+
/**
|
|
342
|
+
* Wait for a certain duration.
|
|
343
|
+
*
|
|
344
|
+
* You can clear the timeout by using the `AbortSignal` API.
|
|
345
|
+
* Aborted signal will resolve the promise immediately, it does not reject it.
|
|
346
|
+
*/
|
|
347
|
+
wait(duration: DurationLike, options?: {
|
|
348
|
+
signal?: AbortSignal;
|
|
349
|
+
now?: number;
|
|
350
|
+
}): Promise<void>;
|
|
351
|
+
createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
|
|
352
|
+
/**
|
|
353
|
+
* Run a callback after a certain duration.
|
|
354
|
+
*/
|
|
355
|
+
createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
|
|
356
|
+
clearTimeout(timeout: Timeout): void;
|
|
357
|
+
clearInterval(interval: Interval): void;
|
|
358
|
+
/**
|
|
359
|
+
* Run a function with a deadline.
|
|
360
|
+
*/
|
|
361
|
+
deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike): Promise<T>;
|
|
362
|
+
/**
|
|
363
|
+
* Add time to the current date.
|
|
364
|
+
*/
|
|
365
|
+
travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
|
|
366
|
+
/**
|
|
367
|
+
* Stop the time.
|
|
368
|
+
*/
|
|
369
|
+
pause(): DateTime;
|
|
370
|
+
/**
|
|
371
|
+
* Reset the reference date.
|
|
372
|
+
*/
|
|
373
|
+
reset(): void;
|
|
374
|
+
}
|
|
375
|
+
interface Interval {
|
|
376
|
+
timer?: any;
|
|
377
|
+
duration: number;
|
|
378
|
+
run: () => unknown;
|
|
379
|
+
}
|
|
380
|
+
interface Timeout {
|
|
381
|
+
now: number;
|
|
382
|
+
timer?: any;
|
|
383
|
+
duration: number;
|
|
384
|
+
callback: () => void;
|
|
385
|
+
clear: () => void;
|
|
386
|
+
}
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region ../alepha/src/logger/providers/LogDestinationProvider.d.ts
|
|
389
|
+
declare abstract class LogDestinationProvider {
|
|
390
|
+
abstract write(message: string, entry: LogEntry): void;
|
|
391
|
+
}
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region ../alepha/src/logger/providers/LogFormatterProvider.d.ts
|
|
394
|
+
declare abstract class LogFormatterProvider {
|
|
395
|
+
abstract format(entry: LogEntry): string;
|
|
396
|
+
}
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region ../alepha/src/logger/services/Logger.d.ts
|
|
399
|
+
declare class Logger implements LoggerInterface {
|
|
400
|
+
protected readonly alepha: Alepha;
|
|
401
|
+
protected readonly formatter: LogFormatterProvider;
|
|
402
|
+
protected readonly destination: LogDestinationProvider;
|
|
403
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
404
|
+
protected readonly levels: Record<string, number>;
|
|
405
|
+
protected readonly service: string;
|
|
406
|
+
protected readonly module: string;
|
|
407
|
+
protected readonly app?: string;
|
|
408
|
+
protected appLogLevel: string;
|
|
409
|
+
protected logLevel: LogLevel;
|
|
410
|
+
constructor(service: string, module: string);
|
|
411
|
+
get context(): string | undefined;
|
|
412
|
+
get level(): string;
|
|
413
|
+
parseLevel(level: string, app: string): LogLevel;
|
|
414
|
+
private matchesPattern;
|
|
415
|
+
asLogLevel(something: string): LogLevel;
|
|
416
|
+
error(message: string, data?: unknown): void;
|
|
417
|
+
warn(message: string, data?: unknown): void;
|
|
418
|
+
info(message: string, data?: unknown): void;
|
|
419
|
+
debug(message: string, data?: unknown): void;
|
|
420
|
+
trace(message: string, data?: unknown): void;
|
|
421
|
+
protected log(level: LogLevel, message: string, data?: unknown): void;
|
|
422
|
+
protected emit(entry: LogEntry, message?: string): void;
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region ../alepha/src/logger/index.d.ts
|
|
426
|
+
declare const envSchema$3: alepha20.TObject<{
|
|
427
|
+
/**
|
|
428
|
+
* Default log level for the application.
|
|
429
|
+
*
|
|
430
|
+
* Default by environment:
|
|
431
|
+
* - dev = info
|
|
432
|
+
* - prod = info
|
|
433
|
+
* - test = error
|
|
434
|
+
*
|
|
435
|
+
* Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
|
|
436
|
+
*
|
|
437
|
+
* Level can be set for a specific module:
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
|
|
441
|
+
* LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
|
|
442
|
+
*/
|
|
443
|
+
LOG_LEVEL: alepha20.TOptional<alepha20.TString>;
|
|
444
|
+
/**
|
|
445
|
+
* Built-in log formats.
|
|
446
|
+
* - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
|
|
447
|
+
* - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
|
|
448
|
+
* - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
|
|
449
|
+
*/
|
|
450
|
+
LOG_FORMAT: alepha20.TOptional<alepha20.TUnsafe<"json" | "pretty" | "raw">>;
|
|
451
|
+
}>;
|
|
452
|
+
declare module "alepha" {
|
|
453
|
+
interface Env extends Partial<Static<typeof envSchema$3>> {}
|
|
454
|
+
interface State {
|
|
455
|
+
/**
|
|
456
|
+
* Current log level for the application or specific modules.
|
|
457
|
+
*/
|
|
458
|
+
"alepha.logger.level"?: string;
|
|
459
|
+
}
|
|
460
|
+
interface Hooks {
|
|
461
|
+
log: {
|
|
462
|
+
message?: string;
|
|
463
|
+
entry: LogEntry;
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
//#endregion
|
|
464
468
|
//#region ../alepha/src/server/services/ServerRequestParser.d.ts
|
|
465
469
|
declare class ServerRequestParser {
|
|
466
470
|
protected readonly alepha: Alepha;
|
|
@@ -480,8 +484,8 @@ declare class ServerTimingProvider {
|
|
|
480
484
|
prefix: string;
|
|
481
485
|
disabled: boolean;
|
|
482
486
|
};
|
|
483
|
-
readonly onRequest:
|
|
484
|
-
readonly onResponse:
|
|
487
|
+
readonly onRequest: alepha20.HookPrimitive<"server:onRequest">;
|
|
488
|
+
readonly onResponse: alepha20.HookPrimitive<"server:onResponse">;
|
|
485
489
|
protected get handlerName(): string;
|
|
486
490
|
beginTiming(name: string): void;
|
|
487
491
|
endTiming(name: string): void;
|
|
@@ -545,11 +549,11 @@ declare class ServerProvider {
|
|
|
545
549
|
/**
|
|
546
550
|
* When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
|
|
547
551
|
*/
|
|
548
|
-
protected readonly onNodeRequest:
|
|
552
|
+
protected readonly onNodeRequest: alepha20.HookPrimitive<"node:request">;
|
|
549
553
|
/**
|
|
550
554
|
* When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
|
|
551
555
|
*/
|
|
552
|
-
protected readonly onWebRequest:
|
|
556
|
+
protected readonly onWebRequest: alepha20.HookPrimitive<"web:request">;
|
|
553
557
|
/**
|
|
554
558
|
* Handle Node.js HTTP request event.
|
|
555
559
|
*
|
|
@@ -609,8 +613,8 @@ declare abstract class CacheProvider {
|
|
|
609
613
|
abstract clear(): Promise<void>;
|
|
610
614
|
}
|
|
611
615
|
//#endregion
|
|
612
|
-
//#region ../alepha/src/cache/
|
|
613
|
-
interface
|
|
616
|
+
//#region ../alepha/src/cache/primitives/$cache.d.ts
|
|
617
|
+
interface CachePrimitiveOptions<TReturn = any, TParameter extends any[] = any[]> {
|
|
614
618
|
/**
|
|
615
619
|
* The cache name. This is useful for invalidating multiple caches at once.
|
|
616
620
|
*
|
|
@@ -645,7 +649,7 @@ interface CacheDescriptorOptions<TReturn = any, TParameter extends any[] = any[]
|
|
|
645
649
|
*/
|
|
646
650
|
disabled?: boolean;
|
|
647
651
|
}
|
|
648
|
-
declare class
|
|
652
|
+
declare class CachePrimitive<TReturn = any, TParameter extends any[] = any[]> extends Primitive<CachePrimitiveOptions<TReturn, TParameter>> {
|
|
649
653
|
protected readonly env: {
|
|
650
654
|
CACHE_ENABLED: boolean;
|
|
651
655
|
CACHE_DEFAULT_TTL: number;
|
|
@@ -669,9 +673,9 @@ declare class CacheDescriptor<TReturn = any, TParameter extends any[] = any[]> e
|
|
|
669
673
|
protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
|
|
670
674
|
protected $provider(): CacheProvider;
|
|
671
675
|
}
|
|
672
|
-
interface
|
|
676
|
+
interface CachePrimitiveFn<TReturn = any, TParameter extends any[] = any[]> extends CachePrimitive<TReturn, TParameter> {
|
|
673
677
|
/**
|
|
674
|
-
* Run the cache
|
|
678
|
+
* Run the cache primitive with the provided arguments.
|
|
675
679
|
*/
|
|
676
680
|
(...args: TParameter): Promise<TReturn>;
|
|
677
681
|
}
|
|
@@ -680,7 +684,7 @@ interface CacheDescriptorFn<TReturn = any, TParameter extends any[] = any[]> ext
|
|
|
680
684
|
declare class HttpClient {
|
|
681
685
|
protected readonly log: Logger;
|
|
682
686
|
protected readonly alepha: Alepha;
|
|
683
|
-
readonly cache:
|
|
687
|
+
readonly cache: CachePrimitiveFn<HttpClientCache, any[]>;
|
|
684
688
|
protected readonly pendingRequests: HttpClientPendingRequests;
|
|
685
689
|
fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
|
|
686
690
|
fetch<T extends TSchema>(url: string, request?: RequestInitWithOptions<T>): Promise<FetchResponse<Static<T>>>;
|
|
@@ -748,8 +752,8 @@ interface HttpAction {
|
|
|
748
752
|
};
|
|
749
753
|
}
|
|
750
754
|
//#endregion
|
|
751
|
-
//#region ../alepha/src/server/
|
|
752
|
-
interface
|
|
755
|
+
//#region ../alepha/src/server/primitives/$action.d.ts
|
|
756
|
+
interface ActionPrimitiveOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
|
|
753
757
|
/**
|
|
754
758
|
* Name of the action.
|
|
755
759
|
*
|
|
@@ -815,7 +819,7 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends O
|
|
|
815
819
|
*/
|
|
816
820
|
handler: ServerActionHandler<TConfig>;
|
|
817
821
|
}
|
|
818
|
-
declare class
|
|
822
|
+
declare class ActionPrimitive<TConfig extends RequestConfigSchema> extends Primitive<ActionPrimitiveOptions<TConfig>> {
|
|
819
823
|
protected readonly log: Logger;
|
|
820
824
|
protected readonly env: {
|
|
821
825
|
SERVER_API_PREFIX: string;
|
|
@@ -883,55 +887,22 @@ type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSche
|
|
|
883
887
|
*/
|
|
884
888
|
interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
|
|
885
889
|
//#endregion
|
|
886
|
-
//#region ../alepha/src/server/schemas/errorSchema.d.ts
|
|
887
|
-
declare const errorSchema: alepha18.TObject<{
|
|
888
|
-
error: alepha18.TString;
|
|
889
|
-
status: alepha18.TInteger;
|
|
890
|
-
message: alepha18.TString;
|
|
891
|
-
details: alepha18.TOptional<alepha18.TString>;
|
|
892
|
-
requestId: alepha18.TOptional<alepha18.TString>;
|
|
893
|
-
cause: alepha18.TOptional<alepha18.TObject<{
|
|
894
|
-
name: alepha18.TString;
|
|
895
|
-
message: alepha18.TString;
|
|
896
|
-
}>>;
|
|
897
|
-
}>;
|
|
898
|
-
type ErrorSchema = Static<typeof errorSchema>;
|
|
899
|
-
//#endregion
|
|
900
|
-
//#region ../alepha/src/server/errors/HttpError.d.ts
|
|
901
|
-
declare class HttpError extends AlephaError {
|
|
902
|
-
name: string;
|
|
903
|
-
static is: (error: unknown, status?: number) => error is HttpErrorLike;
|
|
904
|
-
static toJSON(error: HttpError): ErrorSchema;
|
|
905
|
-
readonly error: string;
|
|
906
|
-
readonly status: number;
|
|
907
|
-
readonly requestId?: string;
|
|
908
|
-
readonly details?: string;
|
|
909
|
-
readonly reason?: {
|
|
910
|
-
name: string;
|
|
911
|
-
message: string;
|
|
912
|
-
};
|
|
913
|
-
constructor(options: Partial<ErrorSchema>, cause?: unknown);
|
|
914
|
-
}
|
|
915
|
-
interface HttpErrorLike extends Error {
|
|
916
|
-
status: number;
|
|
917
|
-
}
|
|
918
|
-
//#endregion
|
|
919
890
|
//#region ../alepha/src/server/providers/BunHttpServerProvider.d.ts
|
|
920
|
-
declare const envSchema$
|
|
921
|
-
SERVER_PORT:
|
|
922
|
-
SERVER_HOST:
|
|
891
|
+
declare const envSchema$2: alepha20.TObject<{
|
|
892
|
+
SERVER_PORT: alepha20.TInteger;
|
|
893
|
+
SERVER_HOST: alepha20.TString;
|
|
923
894
|
}>;
|
|
924
895
|
declare module "alepha" {
|
|
925
|
-
interface Env extends Partial<Static<typeof envSchema$
|
|
896
|
+
interface Env extends Partial<Static<typeof envSchema$2>> {}
|
|
926
897
|
}
|
|
927
898
|
//#endregion
|
|
928
899
|
//#region ../alepha/src/server/providers/NodeHttpServerProvider.d.ts
|
|
929
|
-
declare const envSchema:
|
|
930
|
-
SERVER_PORT:
|
|
931
|
-
SERVER_HOST:
|
|
900
|
+
declare const envSchema$1: alepha20.TObject<{
|
|
901
|
+
SERVER_PORT: alepha20.TInteger;
|
|
902
|
+
SERVER_HOST: alepha20.TString;
|
|
932
903
|
}>;
|
|
933
904
|
declare module "alepha" {
|
|
934
|
-
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
905
|
+
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
935
906
|
}
|
|
936
907
|
//#endregion
|
|
937
908
|
//#region ../alepha/src/server/index.d.ts
|
|
@@ -941,12 +912,12 @@ declare module "alepha" {
|
|
|
941
912
|
}
|
|
942
913
|
interface Hooks {
|
|
943
914
|
"action:onRequest": {
|
|
944
|
-
action:
|
|
915
|
+
action: ActionPrimitive<RequestConfigSchema>;
|
|
945
916
|
request: ServerRequest;
|
|
946
917
|
options: ClientRequestOptions;
|
|
947
918
|
};
|
|
948
919
|
"action:onResponse": {
|
|
949
|
-
action:
|
|
920
|
+
action: ActionPrimitive<RequestConfigSchema>;
|
|
950
921
|
request: ServerRequest;
|
|
951
922
|
options: ClientRequestOptions;
|
|
952
923
|
response: any;
|
|
@@ -990,6 +961,35 @@ declare module "alepha" {
|
|
|
990
961
|
}
|
|
991
962
|
}
|
|
992
963
|
//#endregion
|
|
964
|
+
//#region ../alepha/src/security/interfaces/UserAccountToken.d.ts
|
|
965
|
+
/**
|
|
966
|
+
* Add contextual metadata to a user account info.
|
|
967
|
+
* E.g. UserAccountToken is a UserAccountInfo during a request.
|
|
968
|
+
*/
|
|
969
|
+
interface UserAccountToken extends UserAccount {
|
|
970
|
+
/**
|
|
971
|
+
* Access token for the user.
|
|
972
|
+
*/
|
|
973
|
+
token?: string;
|
|
974
|
+
/**
|
|
975
|
+
* Realm name of the user.
|
|
976
|
+
*/
|
|
977
|
+
realm?: string;
|
|
978
|
+
/**
|
|
979
|
+
* Is user dedicated to his own resources for this scope ?
|
|
980
|
+
* Mostly, Admin is false and Customer is true.
|
|
981
|
+
*/
|
|
982
|
+
ownership?: string | boolean;
|
|
983
|
+
}
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region ../alepha/src/security/providers/SecurityProvider.d.ts
|
|
986
|
+
declare const envSchema: alepha20.TObject<{
|
|
987
|
+
APP_SECRET: alepha20.TString;
|
|
988
|
+
}>;
|
|
989
|
+
declare module "alepha" {
|
|
990
|
+
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
991
|
+
}
|
|
992
|
+
//#endregion
|
|
993
993
|
//#region ../alepha/src/security/index.d.ts
|
|
994
994
|
declare module "alepha" {
|
|
995
995
|
interface Hooks {
|
|
@@ -1002,7 +1002,7 @@ declare module "alepha" {
|
|
|
1002
1002
|
/**
|
|
1003
1003
|
* Provides comprehensive authentication and authorization capabilities with JWT tokens, role-based access control, and user management.
|
|
1004
1004
|
*
|
|
1005
|
-
* The security module enables building secure applications using
|
|
1005
|
+
* The security module enables building secure applications using primitives like `$realm`, `$role`, and `$permission`
|
|
1006
1006
|
* on class properties. It offers JWT-based authentication, fine-grained permissions, service accounts, and seamless
|
|
1007
1007
|
* integration with various authentication providers and user management systems.
|
|
1008
1008
|
*
|
|
@@ -1077,22 +1077,22 @@ declare module "alepha/server" {
|
|
|
1077
1077
|
*/
|
|
1078
1078
|
//#endregion
|
|
1079
1079
|
//#region ../alepha/src/server-links/schemas/apiLinksResponseSchema.d.ts
|
|
1080
|
-
declare const apiLinksResponseSchema:
|
|
1081
|
-
prefix:
|
|
1082
|
-
links:
|
|
1083
|
-
name:
|
|
1084
|
-
group:
|
|
1085
|
-
path:
|
|
1086
|
-
method:
|
|
1087
|
-
requestBodyType:
|
|
1088
|
-
service:
|
|
1080
|
+
declare const apiLinksResponseSchema: alepha20.TObject<{
|
|
1081
|
+
prefix: alepha20.TOptional<alepha20.TString>;
|
|
1082
|
+
links: alepha20.TArray<alepha20.TObject<{
|
|
1083
|
+
name: alepha20.TString;
|
|
1084
|
+
group: alepha20.TOptional<alepha20.TString>;
|
|
1085
|
+
path: alepha20.TString;
|
|
1086
|
+
method: alepha20.TOptional<alepha20.TString>;
|
|
1087
|
+
requestBodyType: alepha20.TOptional<alepha20.TString>;
|
|
1088
|
+
service: alepha20.TOptional<alepha20.TString>;
|
|
1089
1089
|
}>>;
|
|
1090
1090
|
}>;
|
|
1091
1091
|
type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
|
|
1092
1092
|
//#endregion
|
|
1093
1093
|
//#region ../alepha/src/server-links/providers/LinkProvider.d.ts
|
|
1094
|
-
type HttpVirtualClient<T> = { [K in keyof T as T[K] extends
|
|
1095
|
-
interface VirtualAction<T extends RequestConfigSchema> extends Pick<
|
|
1094
|
+
type HttpVirtualClient<T> = { [K in keyof T as T[K] extends ActionPrimitive<RequestConfigSchema> ? K : never]: T[K] extends ActionPrimitive<infer Schema> ? VirtualAction<Schema> : never };
|
|
1095
|
+
interface VirtualAction<T extends RequestConfigSchema> extends Pick<ActionPrimitive<T>, "name" | "run" | "fetch"> {
|
|
1096
1096
|
(config?: ClientRequestEntry<T>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T>>;
|
|
1097
1097
|
can: () => boolean;
|
|
1098
1098
|
}
|
|
@@ -1112,7 +1112,7 @@ declare module "alepha" {
|
|
|
1112
1112
|
/**
|
|
1113
1113
|
* Provides server-side link management and remote capabilities for client-server interactions.
|
|
1114
1114
|
*
|
|
1115
|
-
* The server-links module enables declarative link definitions using `$remote` and `$client`
|
|
1115
|
+
* The server-links module enables declarative link definitions using `$remote` and `$client` primitives,
|
|
1116
1116
|
* facilitating seamless API endpoint management and client-server communication. It integrates with server
|
|
1117
1117
|
* security features to ensure safe and controlled access to resources.
|
|
1118
1118
|
*
|
|
@@ -1143,7 +1143,21 @@ declare const useAuth: <T extends object = any>() => {
|
|
|
1143
1143
|
can: <Api extends object = any>(name: keyof HttpVirtualClient<Api>) => boolean;
|
|
1144
1144
|
};
|
|
1145
1145
|
//#endregion
|
|
1146
|
-
//#region ../alepha/src/server-
|
|
1146
|
+
//#region ../alepha/src/server-auth/schemas/tokensSchema.d.ts
|
|
1147
|
+
declare const tokensSchema: alepha20.TObject<{
|
|
1148
|
+
provider: alepha20.TString;
|
|
1149
|
+
access_token: alepha20.TString;
|
|
1150
|
+
issued_at: alepha20.TNumber;
|
|
1151
|
+
expires_in: alepha20.TOptional<alepha20.TNumber>;
|
|
1152
|
+
refresh_token: alepha20.TOptional<alepha20.TString>;
|
|
1153
|
+
refresh_token_expires_in: alepha20.TOptional<alepha20.TNumber>;
|
|
1154
|
+
refresh_expires_in: alepha20.TOptional<alepha20.TNumber>;
|
|
1155
|
+
id_token: alepha20.TOptional<alepha20.TString>;
|
|
1156
|
+
scope: alepha20.TOptional<alepha20.TString>;
|
|
1157
|
+
}>;
|
|
1158
|
+
type Tokens = Static<typeof tokensSchema>;
|
|
1159
|
+
//#endregion
|
|
1160
|
+
//#region ../alepha/src/server-cookies/primitives/$cookie.d.ts
|
|
1147
1161
|
interface Cookies {
|
|
1148
1162
|
req: Record<string, string>;
|
|
1149
1163
|
res: Record<string, Cookie | null>;
|
|
@@ -1165,9 +1179,9 @@ declare module "alepha/server" {
|
|
|
1165
1179
|
}
|
|
1166
1180
|
}
|
|
1167
1181
|
/**
|
|
1168
|
-
* Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie
|
|
1182
|
+
* Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie primitives.
|
|
1169
1183
|
*
|
|
1170
|
-
* The server-cookies module enables declarative cookie handling using the `$cookie`
|
|
1184
|
+
* The server-cookies module enables declarative cookie handling using the `$cookie` primitive on class properties.
|
|
1171
1185
|
* It offers automatic cookie parsing, secure cookie configuration, and seamless integration with server routes
|
|
1172
1186
|
* for managing user sessions, preferences, and authentication tokens.
|
|
1173
1187
|
*
|
|
@@ -1175,20 +1189,6 @@ declare module "alepha/server" {
|
|
|
1175
1189
|
* @module alepha.server.cookies
|
|
1176
1190
|
*/
|
|
1177
1191
|
//#endregion
|
|
1178
|
-
//#region ../alepha/src/server-auth/schemas/tokensSchema.d.ts
|
|
1179
|
-
declare const tokensSchema: alepha18.TObject<{
|
|
1180
|
-
provider: alepha18.TString;
|
|
1181
|
-
access_token: alepha18.TString;
|
|
1182
|
-
issued_at: alepha18.TNumber;
|
|
1183
|
-
expires_in: alepha18.TOptional<alepha18.TNumber>;
|
|
1184
|
-
refresh_token: alepha18.TOptional<alepha18.TString>;
|
|
1185
|
-
refresh_token_expires_in: alepha18.TOptional<alepha18.TNumber>;
|
|
1186
|
-
refresh_expires_in: alepha18.TOptional<alepha18.TNumber>;
|
|
1187
|
-
id_token: alepha18.TOptional<alepha18.TString>;
|
|
1188
|
-
scope: alepha18.TOptional<alepha18.TString>;
|
|
1189
|
-
}>;
|
|
1190
|
-
type Tokens = Static<typeof tokensSchema>;
|
|
1191
|
-
//#endregion
|
|
1192
1192
|
//#region ../alepha/src/server-auth/index.d.ts
|
|
1193
1193
|
declare module "alepha" {
|
|
1194
1194
|
interface State {
|
|
@@ -1222,8 +1222,8 @@ declare class ReactAuth {
|
|
|
1222
1222
|
protected readonly log: Logger;
|
|
1223
1223
|
protected readonly alepha: Alepha;
|
|
1224
1224
|
protected readonly httpClient: HttpClient;
|
|
1225
|
-
protected readonly onBeginTransition:
|
|
1226
|
-
protected readonly onFetchRequest:
|
|
1225
|
+
protected readonly onBeginTransition: alepha20.HookPrimitive<"react:transition:begin">;
|
|
1226
|
+
protected readonly onFetchRequest: alepha20.HookPrimitive<"client:onRequest">;
|
|
1227
1227
|
/**
|
|
1228
1228
|
* Get the current authenticated user.
|
|
1229
1229
|
*
|
|
@@ -1253,7 +1253,7 @@ declare class ReactAuth {
|
|
|
1253
1253
|
//#region src/auth/providers/ReactAuthProvider.d.ts
|
|
1254
1254
|
declare class ReactAuthProvider {
|
|
1255
1255
|
protected readonly alepha: Alepha;
|
|
1256
|
-
readonly onRender:
|
|
1256
|
+
readonly onRender: alepha20.HookPrimitive<"react:server:render:begin">;
|
|
1257
1257
|
}
|
|
1258
1258
|
//#endregion
|
|
1259
1259
|
//#region src/auth/index.d.ts
|
|
@@ -1268,7 +1268,7 @@ declare module "@alepha/react" {
|
|
|
1268
1268
|
* @see {@link ReactAuthProvider}
|
|
1269
1269
|
* @module alepha.react.auth
|
|
1270
1270
|
*/
|
|
1271
|
-
declare const AlephaReactAuth:
|
|
1271
|
+
declare const AlephaReactAuth: alepha20.Service<alepha20.Module>;
|
|
1272
1272
|
//#endregion
|
|
1273
1273
|
export { AlephaReactAuth, ReactAuth, ReactAuthProvider, useAuth };
|
|
1274
1274
|
//# sourceMappingURL=index.d.ts.map
|