@alepha/react 0.13.1 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/auth/index.browser.js +10 -5
  2. package/dist/auth/index.browser.js.map +1 -1
  3. package/dist/auth/index.d.ts +401 -330
  4. package/dist/auth/index.js +12 -7
  5. package/dist/auth/index.js.map +1 -1
  6. package/dist/core/index.browser.js +50 -28
  7. package/dist/core/index.browser.js.map +1 -1
  8. package/dist/core/index.d.ts +382 -344
  9. package/dist/core/index.js +65 -37
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/core/index.native.js +381 -0
  12. package/dist/core/index.native.js.map +1 -0
  13. package/dist/form/index.d.ts +2 -2
  14. package/dist/head/index.browser.js +28 -17
  15. package/dist/head/index.browser.js.map +1 -1
  16. package/dist/head/index.d.ts +270 -267
  17. package/dist/head/index.js +29 -17
  18. package/dist/head/index.js.map +1 -1
  19. package/dist/i18n/index.d.ts +20 -20
  20. package/dist/i18n/index.js +12 -12
  21. package/dist/i18n/index.js.map +1 -1
  22. package/dist/websocket/index.d.ts +7 -7
  23. package/dist/websocket/index.js.map +1 -1
  24. package/package.json +21 -12
  25. package/src/auth/index.ts +1 -1
  26. package/src/auth/providers/ReactAuthProvider.ts +1 -1
  27. package/src/auth/services/ReactAuth.ts +15 -5
  28. package/src/core/components/NestedView.tsx +6 -2
  29. package/src/core/components/NotFound.tsx +10 -6
  30. package/src/core/hooks/useStore.ts +4 -4
  31. package/src/core/index.browser.ts +2 -2
  32. package/src/core/index.native.ts +1 -1
  33. package/src/core/index.shared-router.ts +1 -1
  34. package/src/core/index.ts +3 -3
  35. package/src/core/{descriptors → primitives}/$page.ts +20 -20
  36. package/src/core/providers/ReactBrowserProvider.ts +2 -2
  37. package/src/core/providers/ReactBrowserRouterProvider.ts +3 -2
  38. package/src/core/providers/ReactPageProvider.ts +28 -11
  39. package/src/core/providers/ReactServerProvider.ts +34 -23
  40. package/src/core/services/ReactPageServerService.ts +6 -6
  41. package/src/core/services/ReactPageService.ts +6 -6
  42. package/src/core/services/ReactRouter.ts +19 -3
  43. package/src/head/index.browser.ts +3 -3
  44. package/src/head/index.ts +4 -4
  45. package/src/head/interfaces/Head.ts +1 -0
  46. package/src/head/{descriptors → primitives}/$head.ts +10 -7
  47. package/src/head/providers/BrowserHeadProvider.ts +13 -0
  48. package/src/head/providers/HeadProvider.ts +11 -9
  49. package/src/head/providers/ServerHeadProvider.ts +6 -0
  50. package/src/i18n/hooks/useI18n.ts +2 -2
  51. package/src/i18n/index.ts +3 -3
  52. package/src/i18n/{descriptors → primitives}/$dictionary.ts +8 -8
  53. package/src/i18n/providers/I18nProvider.ts +5 -5
  54. package/src/websocket/hooks/useRoom.tsx +3 -3
@@ -1,11 +1,11 @@
1
1
  import { PageConfigSchema, PageRoute, ReactRouterState, TPropsDefault, TPropsParentDefault } from "@alepha/react";
2
- import * as alepha53 from "alepha";
3
- import { Alepha, AlephaError, Async, Descriptor, FileLike, InstantiableClass, KIND, LogLevel, LoggerInterface, Static, StreamLike, TArray, TFile, TObject, TRecord, TSchema, TStream, TString, TVoid } from "alepha";
2
+ import * as alepha22 from "alepha";
3
+ import { Alepha, AlephaError, Async, FileLike, InstantiableClass, KIND, LogLevel, LoggerInterface, Primitive, Static, StreamLike, TArray, TFile, TObject, TRecord, TSchema, TStream, TString, TVoid } from "alepha";
4
4
  import { IncomingMessage, Server, ServerResponse } from "node:http";
5
- import dayjsDuration from "dayjs/plugin/duration.js";
6
- import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
7
5
  import { Readable } from "node:stream";
8
6
  import { ReadableStream } from "node:stream/web";
7
+ import dayjsDuration from "dayjs/plugin/duration.js";
8
+ import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
9
9
 
10
10
  //#region src/head/interfaces/Head.d.ts
11
11
  interface Head extends SimpleHead {
@@ -46,26 +46,29 @@ interface SimpleHead {
46
46
  name: string;
47
47
  content: string;
48
48
  }>;
49
+ link?: Array<{
50
+ rel: string;
51
+ href: string;
52
+ }>;
49
53
  }
50
54
  //#endregion
51
55
  //#region src/head/providers/HeadProvider.d.ts
52
56
  declare class HeadProvider {
53
- global?: Head | (() => Head);
54
- protected getGlobalHead(): Head | undefined;
57
+ global?: Array<Head | (() => Head)>;
55
58
  fillHead(state: ReactRouterState): void;
56
59
  protected fillHeadByPage(page: PageRoute, state: ReactRouterState, props: Record<string, any>): void;
57
60
  }
58
61
  //#endregion
59
- //#region src/head/descriptors/$head.d.ts
62
+ //#region src/head/primitives/$head.d.ts
60
63
  /**
61
64
  * Set global `<head>` options for the application.
62
65
  */
63
66
  declare const $head: {
64
- (options: HeadDescriptorOptions): HeadDescriptor;
65
- [KIND]: typeof HeadDescriptor;
67
+ (options: HeadPrimitiveOptions): HeadPrimitive;
68
+ [KIND]: typeof HeadPrimitive;
66
69
  };
67
- type HeadDescriptorOptions = Head | (() => Head);
68
- declare class HeadDescriptor extends Descriptor<HeadDescriptorOptions> {
70
+ type HeadPrimitiveOptions = Head | (() => Head);
71
+ declare class HeadPrimitive extends Primitive<HeadPrimitiveOptions> {
69
72
  protected readonly provider: HeadProvider;
70
73
  protected onInit(): void;
71
74
  }
@@ -92,209 +95,39 @@ declare const useHead: (options?: UseHeadOptions) => UseHeadReturn;
92
95
  type UseHeadOptions = Head | ((previous?: Head) => Head);
93
96
  type UseHeadReturn = [Head, (head?: Head | ((previous?: Head) => Head)) => void];
94
97
  //#endregion
95
- //#region ../alepha/src/logger/schemas/logEntrySchema.d.ts
96
- declare const logEntrySchema: alepha53.TObject<{
97
- level: alepha53.TUnsafe<"TRACE" | "SILENT" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
98
- message: alepha53.TString;
99
- service: alepha53.TString;
100
- module: alepha53.TString;
101
- context: alepha53.TOptional<alepha53.TString>;
102
- app: alepha53.TOptional<alepha53.TString>;
103
- data: alepha53.TOptional<alepha53.TAny>;
104
- timestamp: alepha53.TNumber;
98
+ //#region ../alepha/src/server/schemas/errorSchema.d.ts
99
+ declare const errorSchema: alepha22.TObject<{
100
+ error: alepha22.TString;
101
+ status: alepha22.TInteger;
102
+ message: alepha22.TString;
103
+ details: alepha22.TOptional<alepha22.TString>;
104
+ requestId: alepha22.TOptional<alepha22.TString>;
105
+ cause: alepha22.TOptional<alepha22.TObject<{
106
+ name: alepha22.TString;
107
+ message: alepha22.TString;
108
+ }>>;
105
109
  }>;
106
- type LogEntry = Static<typeof logEntrySchema>;
107
- //#endregion
108
- //#region ../alepha/src/datetime/providers/DateTimeProvider.d.ts
109
- type DateTime = DayjsApi.Dayjs;
110
- type Duration = dayjsDuration.Duration;
111
- type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
112
- declare class DateTimeProvider {
113
- static PLUGINS: Array<PluginFunc<any>>;
114
- protected alepha: Alepha;
115
- protected ref: DateTime | null;
116
- protected readonly timeouts: Timeout[];
117
- protected readonly intervals: Interval[];
118
- constructor();
119
- protected readonly onStart: alepha53.HookDescriptor<"start">;
120
- protected readonly onStop: alepha53.HookDescriptor<"stop">;
121
- setLocale(locale: string): void;
122
- isDateTime(value: unknown): value is DateTime;
123
- /**
124
- * Create a new UTC DateTime instance.
125
- */
126
- utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
127
- /**
128
- * Create a new DateTime instance.
129
- */
130
- of(date: string | number | Date | Dayjs | null | undefined): DateTime;
131
- /**
132
- * Get the current date as a string.
133
- */
134
- toISOString(date?: Date | string | DateTime): string;
135
- /**
136
- * Get the current date.
137
- */
138
- now(): DateTime;
139
- /**
140
- * Get the current date as a string.
141
- *
142
- * This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
143
- */
144
- nowISOString(): string;
145
- /**
146
- * Get the current date as milliseconds since epoch.
147
- *
148
- * This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
149
- */
150
- nowMillis(): number;
151
- /**
152
- * Get the current date as a string.
153
- *
154
- * @protected
155
- */
156
- protected getCurrentDate(): DateTime;
157
- /**
158
- * Create a new Duration instance.
159
- */
160
- duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
161
- isDurationLike(value: unknown): value is DurationLike;
162
- /**
163
- * Return a promise that resolves after the next tick.
164
- * It uses `setTimeout` with 0 ms delay.
165
- */
166
- tick(): Promise<void>;
167
- /**
168
- * Wait for a certain duration.
169
- *
170
- * You can clear the timeout by using the `AbortSignal` API.
171
- * Aborted signal will resolve the promise immediately, it does not reject it.
172
- */
173
- wait(duration: DurationLike, options?: {
174
- signal?: AbortSignal;
175
- now?: number;
176
- }): Promise<void>;
177
- createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
178
- /**
179
- * Run a callback after a certain duration.
180
- */
181
- createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
182
- clearTimeout(timeout: Timeout): void;
183
- clearInterval(interval: Interval): void;
184
- /**
185
- * Run a function with a deadline.
186
- */
187
- deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike): Promise<T>;
188
- /**
189
- * Add time to the current date.
190
- */
191
- travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
192
- /**
193
- * Stop the time.
194
- */
195
- pause(): DateTime;
196
- /**
197
- * Reset the reference date.
198
- */
199
- reset(): void;
200
- }
201
- interface Interval {
202
- timer?: any;
203
- duration: number;
204
- run: () => unknown;
205
- }
206
- interface Timeout {
207
- now: number;
208
- timer?: any;
209
- duration: number;
210
- callback: () => void;
211
- clear: () => void;
212
- }
213
- //#endregion
214
- //#region ../alepha/src/logger/providers/LogDestinationProvider.d.ts
215
- declare abstract class LogDestinationProvider {
216
- abstract write(message: string, entry: LogEntry): void;
217
- }
218
- //#endregion
219
- //#region ../alepha/src/logger/providers/LogFormatterProvider.d.ts
220
- declare abstract class LogFormatterProvider {
221
- abstract format(entry: LogEntry): string;
222
- }
110
+ type ErrorSchema = Static<typeof errorSchema>;
223
111
  //#endregion
224
- //#region ../alepha/src/logger/services/Logger.d.ts
225
- declare class Logger implements LoggerInterface {
226
- protected readonly alepha: Alepha;
227
- protected readonly formatter: LogFormatterProvider;
228
- protected readonly destination: LogDestinationProvider;
229
- protected readonly dateTimeProvider: DateTimeProvider;
230
- protected readonly levels: Record<string, number>;
231
- protected readonly service: string;
232
- protected readonly module: string;
233
- protected readonly app?: string;
234
- protected appLogLevel: string;
235
- protected logLevel: LogLevel;
236
- constructor(service: string, module: string);
237
- get context(): string | undefined;
238
- get level(): string;
239
- parseLevel(level: string, app: string): LogLevel;
240
- private matchesPattern;
241
- asLogLevel(something: string): LogLevel;
242
- error(message: string, data?: unknown): void;
243
- warn(message: string, data?: unknown): void;
244
- info(message: string, data?: unknown): void;
245
- debug(message: string, data?: unknown): void;
246
- trace(message: string, data?: unknown): void;
247
- protected log(level: LogLevel, message: string, data?: unknown): void;
248
- protected emit(entry: LogEntry, message?: string): void;
112
+ //#region ../alepha/src/server/errors/HttpError.d.ts
113
+ declare class HttpError extends AlephaError {
114
+ name: string;
115
+ static is: (error: unknown, status?: number) => error is HttpErrorLike;
116
+ static toJSON(error: HttpError): ErrorSchema;
117
+ readonly error: string;
118
+ readonly status: number;
119
+ readonly requestId?: string;
120
+ readonly details?: string;
121
+ readonly reason?: {
122
+ name: string;
123
+ message: string;
124
+ };
125
+ constructor(options: Partial<ErrorSchema>, cause?: unknown);
249
126
  }
250
- //#endregion
251
- //#region ../alepha/src/logger/index.d.ts
252
- declare const envSchema$2: alepha53.TObject<{
253
- /**
254
- * Default log level for the application.
255
- *
256
- * Default by environment:
257
- * - dev = info
258
- * - prod = info
259
- * - test = error
260
- *
261
- * Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
262
- *
263
- * Level can be set for a specific module:
264
- *
265
- * @example
266
- * LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
267
- * LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
268
- */
269
- LOG_LEVEL: alepha53.TOptional<alepha53.TString>;
270
- /**
271
- * Built-in log formats.
272
- * - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
273
- * - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
274
- * - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
275
- */
276
- LOG_FORMAT: alepha53.TOptional<alepha53.TUnsafe<"json" | "pretty" | "raw">>;
277
- }>;
278
- declare module "alepha" {
279
- interface Env extends Partial<Static<typeof envSchema$2>> {}
280
- interface State {
281
- /**
282
- * Current log level for the application or specific modules.
283
- */
284
- "alepha.logger.level"?: string;
285
- }
286
- interface Hooks {
287
- log: {
288
- message?: string;
289
- entry: LogEntry;
290
- };
291
- }
127
+ interface HttpErrorLike extends Error {
128
+ status: number;
292
129
  }
293
130
  //#endregion
294
- //#region ../alepha/src/server/constants/routeMethods.d.ts
295
- declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
296
- type RouteMethod = (typeof routeMethods)[number];
297
- //#endregion
298
131
  //#region ../alepha/src/router/providers/RouterProvider.d.ts
299
132
  declare abstract class RouterProvider<T extends Route = Route> {
300
133
  protected routePathRegex: RegExp;
@@ -339,6 +172,10 @@ interface Tree<T extends Route> {
339
172
  };
340
173
  }
341
174
  //#endregion
175
+ //#region ../alepha/src/server/constants/routeMethods.d.ts
176
+ declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
177
+ type RouteMethod = (typeof routeMethods)[number];
178
+ //#endregion
342
179
  //#region ../alepha/src/server/helpers/ServerReply.d.ts
343
180
  /**
344
181
  * Helper for building server replies.
@@ -505,6 +342,205 @@ interface WebRequestEvent {
505
342
  res?: Response;
506
343
  }
507
344
  //#endregion
345
+ //#region ../alepha/src/logger/schemas/logEntrySchema.d.ts
346
+ declare const logEntrySchema: alepha22.TObject<{
347
+ level: alepha22.TUnsafe<"TRACE" | "SILENT" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
348
+ message: alepha22.TString;
349
+ service: alepha22.TString;
350
+ module: alepha22.TString;
351
+ context: alepha22.TOptional<alepha22.TString>;
352
+ app: alepha22.TOptional<alepha22.TString>;
353
+ data: alepha22.TOptional<alepha22.TAny>;
354
+ timestamp: alepha22.TNumber;
355
+ }>;
356
+ type LogEntry = Static<typeof logEntrySchema>;
357
+ //#endregion
358
+ //#region ../alepha/src/datetime/providers/DateTimeProvider.d.ts
359
+ type DateTime = DayjsApi.Dayjs;
360
+ type Duration = dayjsDuration.Duration;
361
+ type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
362
+ declare class DateTimeProvider {
363
+ static PLUGINS: Array<PluginFunc<any>>;
364
+ protected alepha: Alepha;
365
+ protected ref: DateTime | null;
366
+ protected readonly timeouts: Timeout[];
367
+ protected readonly intervals: Interval[];
368
+ constructor();
369
+ protected readonly onStart: alepha22.HookPrimitive<"start">;
370
+ protected readonly onStop: alepha22.HookPrimitive<"stop">;
371
+ setLocale(locale: string): void;
372
+ isDateTime(value: unknown): value is DateTime;
373
+ /**
374
+ * Create a new UTC DateTime instance.
375
+ */
376
+ utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
377
+ /**
378
+ * Create a new DateTime instance.
379
+ */
380
+ of(date: string | number | Date | Dayjs | null | undefined): DateTime;
381
+ /**
382
+ * Get the current date as a string.
383
+ */
384
+ toISOString(date?: Date | string | DateTime): string;
385
+ /**
386
+ * Get the current date.
387
+ */
388
+ now(): DateTime;
389
+ /**
390
+ * Get the current date as a string.
391
+ *
392
+ * This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
393
+ */
394
+ nowISOString(): string;
395
+ /**
396
+ * Get the current date as milliseconds since epoch.
397
+ *
398
+ * This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
399
+ */
400
+ nowMillis(): number;
401
+ /**
402
+ * Get the current date as a string.
403
+ *
404
+ * @protected
405
+ */
406
+ protected getCurrentDate(): DateTime;
407
+ /**
408
+ * Create a new Duration instance.
409
+ */
410
+ duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
411
+ isDurationLike(value: unknown): value is DurationLike;
412
+ /**
413
+ * Return a promise that resolves after the next tick.
414
+ * It uses `setTimeout` with 0 ms delay.
415
+ */
416
+ tick(): Promise<void>;
417
+ /**
418
+ * Wait for a certain duration.
419
+ *
420
+ * You can clear the timeout by using the `AbortSignal` API.
421
+ * Aborted signal will resolve the promise immediately, it does not reject it.
422
+ */
423
+ wait(duration: DurationLike, options?: {
424
+ signal?: AbortSignal;
425
+ now?: number;
426
+ }): Promise<void>;
427
+ createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
428
+ /**
429
+ * Run a callback after a certain duration.
430
+ */
431
+ createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
432
+ clearTimeout(timeout: Timeout): void;
433
+ clearInterval(interval: Interval): void;
434
+ /**
435
+ * Run a function with a deadline.
436
+ */
437
+ deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike): Promise<T>;
438
+ /**
439
+ * Add time to the current date.
440
+ */
441
+ travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
442
+ /**
443
+ * Stop the time.
444
+ */
445
+ pause(): DateTime;
446
+ /**
447
+ * Reset the reference date.
448
+ */
449
+ reset(): void;
450
+ }
451
+ interface Interval {
452
+ timer?: any;
453
+ duration: number;
454
+ run: () => unknown;
455
+ }
456
+ interface Timeout {
457
+ now: number;
458
+ timer?: any;
459
+ duration: number;
460
+ callback: () => void;
461
+ clear: () => void;
462
+ }
463
+ //#endregion
464
+ //#region ../alepha/src/logger/providers/LogDestinationProvider.d.ts
465
+ declare abstract class LogDestinationProvider {
466
+ abstract write(message: string, entry: LogEntry): void;
467
+ }
468
+ //#endregion
469
+ //#region ../alepha/src/logger/providers/LogFormatterProvider.d.ts
470
+ declare abstract class LogFormatterProvider {
471
+ abstract format(entry: LogEntry): string;
472
+ }
473
+ //#endregion
474
+ //#region ../alepha/src/logger/services/Logger.d.ts
475
+ declare class Logger implements LoggerInterface {
476
+ protected readonly alepha: Alepha;
477
+ protected readonly formatter: LogFormatterProvider;
478
+ protected readonly destination: LogDestinationProvider;
479
+ protected readonly dateTimeProvider: DateTimeProvider;
480
+ protected readonly levels: Record<string, number>;
481
+ protected readonly service: string;
482
+ protected readonly module: string;
483
+ protected readonly app?: string;
484
+ protected appLogLevel: string;
485
+ protected logLevel: LogLevel;
486
+ constructor(service: string, module: string);
487
+ get context(): string | undefined;
488
+ get level(): string;
489
+ parseLevel(level: string, app: string): LogLevel;
490
+ private matchesPattern;
491
+ asLogLevel(something: string): LogLevel;
492
+ error(message: string, data?: unknown): void;
493
+ warn(message: string, data?: unknown): void;
494
+ info(message: string, data?: unknown): void;
495
+ debug(message: string, data?: unknown): void;
496
+ trace(message: string, data?: unknown): void;
497
+ protected log(level: LogLevel, message: string, data?: unknown): void;
498
+ protected emit(entry: LogEntry, message?: string): void;
499
+ }
500
+ //#endregion
501
+ //#region ../alepha/src/logger/index.d.ts
502
+ declare const envSchema$2: alepha22.TObject<{
503
+ /**
504
+ * Default log level for the application.
505
+ *
506
+ * Default by environment:
507
+ * - dev = info
508
+ * - prod = info
509
+ * - test = error
510
+ *
511
+ * Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
512
+ *
513
+ * Level can be set for a specific module:
514
+ *
515
+ * @example
516
+ * LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
517
+ * LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
518
+ */
519
+ LOG_LEVEL: alepha22.TOptional<alepha22.TString>;
520
+ /**
521
+ * Built-in log formats.
522
+ * - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
523
+ * - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
524
+ * - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
525
+ */
526
+ LOG_FORMAT: alepha22.TOptional<alepha22.TUnsafe<"json" | "pretty" | "raw">>;
527
+ }>;
528
+ declare module "alepha" {
529
+ interface Env extends Partial<Static<typeof envSchema$2>> {}
530
+ interface State {
531
+ /**
532
+ * Current log level for the application or specific modules.
533
+ */
534
+ "alepha.logger.level"?: string;
535
+ }
536
+ interface Hooks {
537
+ log: {
538
+ message?: string;
539
+ entry: LogEntry;
540
+ };
541
+ }
542
+ }
543
+ //#endregion
508
544
  //#region ../alepha/src/server/services/ServerRequestParser.d.ts
509
545
  declare class ServerRequestParser {
510
546
  protected readonly alepha: Alepha;
@@ -524,8 +560,8 @@ declare class ServerTimingProvider {
524
560
  prefix: string;
525
561
  disabled: boolean;
526
562
  };
527
- readonly onRequest: alepha53.HookDescriptor<"server:onRequest">;
528
- readonly onResponse: alepha53.HookDescriptor<"server:onResponse">;
563
+ readonly onRequest: alepha22.HookPrimitive<"server:onRequest">;
564
+ readonly onResponse: alepha22.HookPrimitive<"server:onResponse">;
529
565
  protected get handlerName(): string;
530
566
  beginTiming(name: string): void;
531
567
  endTiming(name: string): void;
@@ -589,11 +625,11 @@ declare class ServerProvider {
589
625
  /**
590
626
  * When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
591
627
  */
592
- protected readonly onNodeRequest: alepha53.HookDescriptor<"node:request">;
628
+ protected readonly onNodeRequest: alepha22.HookPrimitive<"node:request">;
593
629
  /**
594
630
  * When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
595
631
  */
596
- protected readonly onWebRequest: alepha53.HookDescriptor<"web:request">;
632
+ protected readonly onWebRequest: alepha22.HookPrimitive<"web:request">;
597
633
  /**
598
634
  * Handle Node.js HTTP request event.
599
635
  *
@@ -653,8 +689,8 @@ declare abstract class CacheProvider {
653
689
  abstract clear(): Promise<void>;
654
690
  }
655
691
  //#endregion
656
- //#region ../alepha/src/cache/descriptors/$cache.d.ts
657
- interface CacheDescriptorOptions<TReturn = any, TParameter extends any[] = any[]> {
692
+ //#region ../alepha/src/cache/primitives/$cache.d.ts
693
+ interface CachePrimitiveOptions<TReturn = any, TParameter extends any[] = any[]> {
658
694
  /**
659
695
  * The cache name. This is useful for invalidating multiple caches at once.
660
696
  *
@@ -689,7 +725,7 @@ interface CacheDescriptorOptions<TReturn = any, TParameter extends any[] = any[]
689
725
  */
690
726
  disabled?: boolean;
691
727
  }
692
- declare class CacheDescriptor<TReturn = any, TParameter extends any[] = any[]> extends Descriptor<CacheDescriptorOptions<TReturn, TParameter>> {
728
+ declare class CachePrimitive<TReturn = any, TParameter extends any[] = any[]> extends Primitive<CachePrimitiveOptions<TReturn, TParameter>> {
693
729
  protected readonly env: {
694
730
  CACHE_ENABLED: boolean;
695
731
  CACHE_DEFAULT_TTL: number;
@@ -713,9 +749,9 @@ declare class CacheDescriptor<TReturn = any, TParameter extends any[] = any[]> e
713
749
  protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
714
750
  protected $provider(): CacheProvider;
715
751
  }
716
- interface CacheDescriptorFn<TReturn = any, TParameter extends any[] = any[]> extends CacheDescriptor<TReturn, TParameter> {
752
+ interface CachePrimitiveFn<TReturn = any, TParameter extends any[] = any[]> extends CachePrimitive<TReturn, TParameter> {
717
753
  /**
718
- * Run the cache descriptor with the provided arguments.
754
+ * Run the cache primitive with the provided arguments.
719
755
  */
720
756
  (...args: TParameter): Promise<TReturn>;
721
757
  }
@@ -724,7 +760,7 @@ interface CacheDescriptorFn<TReturn = any, TParameter extends any[] = any[]> ext
724
760
  declare class HttpClient {
725
761
  protected readonly log: Logger;
726
762
  protected readonly alepha: Alepha;
727
- readonly cache: CacheDescriptorFn<HttpClientCache, any[]>;
763
+ readonly cache: CachePrimitiveFn<HttpClientCache, any[]>;
728
764
  protected readonly pendingRequests: HttpClientPendingRequests;
729
765
  fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
730
766
  fetch<T extends TSchema>(url: string, request?: RequestInitWithOptions<T>): Promise<FetchResponse<Static<T>>>;
@@ -792,8 +828,8 @@ interface HttpAction {
792
828
  };
793
829
  }
794
830
  //#endregion
795
- //#region ../alepha/src/server/descriptors/$action.d.ts
796
- interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
831
+ //#region ../alepha/src/server/primitives/$action.d.ts
832
+ interface ActionPrimitiveOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
797
833
  /**
798
834
  * Name of the action.
799
835
  *
@@ -859,7 +895,7 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends O
859
895
  */
860
896
  handler: ServerActionHandler<TConfig>;
861
897
  }
862
- declare class ActionDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<ActionDescriptorOptions<TConfig>> {
898
+ declare class ActionPrimitive<TConfig extends RequestConfigSchema> extends Primitive<ActionPrimitiveOptions<TConfig>> {
863
899
  protected readonly log: Logger;
864
900
  protected readonly env: {
865
901
  SERVER_API_PREFIX: string;
@@ -927,52 +963,19 @@ type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSche
927
963
  */
928
964
  interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
929
965
  //#endregion
930
- //#region ../alepha/src/server/schemas/errorSchema.d.ts
931
- declare const errorSchema: alepha53.TObject<{
932
- error: alepha53.TString;
933
- status: alepha53.TInteger;
934
- message: alepha53.TString;
935
- details: alepha53.TOptional<alepha53.TString>;
936
- requestId: alepha53.TOptional<alepha53.TString>;
937
- cause: alepha53.TOptional<alepha53.TObject<{
938
- name: alepha53.TString;
939
- message: alepha53.TString;
940
- }>>;
941
- }>;
942
- type ErrorSchema = Static<typeof errorSchema>;
943
- //#endregion
944
- //#region ../alepha/src/server/errors/HttpError.d.ts
945
- declare class HttpError extends AlephaError {
946
- name: string;
947
- static is: (error: unknown, status?: number) => error is HttpErrorLike;
948
- static toJSON(error: HttpError): ErrorSchema;
949
- readonly error: string;
950
- readonly status: number;
951
- readonly requestId?: string;
952
- readonly details?: string;
953
- readonly reason?: {
954
- name: string;
955
- message: string;
956
- };
957
- constructor(options: Partial<ErrorSchema>, cause?: unknown);
958
- }
959
- interface HttpErrorLike extends Error {
960
- status: number;
961
- }
962
- //#endregion
963
966
  //#region ../alepha/src/server/providers/BunHttpServerProvider.d.ts
964
- declare const envSchema$1: alepha53.TObject<{
965
- SERVER_PORT: alepha53.TInteger;
966
- SERVER_HOST: alepha53.TString;
967
+ declare const envSchema$1: alepha22.TObject<{
968
+ SERVER_PORT: alepha22.TInteger;
969
+ SERVER_HOST: alepha22.TString;
967
970
  }>;
968
971
  declare module "alepha" {
969
972
  interface Env extends Partial<Static<typeof envSchema$1>> {}
970
973
  }
971
974
  //#endregion
972
975
  //#region ../alepha/src/server/providers/NodeHttpServerProvider.d.ts
973
- declare const envSchema: alepha53.TObject<{
974
- SERVER_PORT: alepha53.TInteger;
975
- SERVER_HOST: alepha53.TString;
976
+ declare const envSchema: alepha22.TObject<{
977
+ SERVER_PORT: alepha22.TInteger;
978
+ SERVER_HOST: alepha22.TString;
976
979
  }>;
977
980
  declare module "alepha" {
978
981
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -985,12 +988,12 @@ declare module "alepha" {
985
988
  }
986
989
  interface Hooks {
987
990
  "action:onRequest": {
988
- action: ActionDescriptor<RequestConfigSchema>;
991
+ action: ActionPrimitive<RequestConfigSchema>;
989
992
  request: ServerRequest;
990
993
  options: ClientRequestOptions;
991
994
  };
992
995
  "action:onResponse": {
993
- action: ActionDescriptor<RequestConfigSchema>;
996
+ action: ActionPrimitive<RequestConfigSchema>;
994
997
  request: ServerRequest;
995
998
  options: ClientRequestOptions;
996
999
  response: any;
@@ -1038,7 +1041,7 @@ declare module "alepha" {
1038
1041
  declare class ServerHeadProvider {
1039
1042
  protected readonly headProvider: HeadProvider;
1040
1043
  protected readonly serverTimingProvider: ServerTimingProvider;
1041
- protected readonly onServerRenderEnd: alepha53.HookDescriptor<"react:server:render:end">;
1044
+ protected readonly onServerRenderEnd: alepha22.HookPrimitive<"react:server:render:end">;
1042
1045
  renderHead(template: string, head: SimpleHead): string;
1043
1046
  protected mergeAttributes(existing: string, attrs: Record<string, string>): string;
1044
1047
  protected parseAttributes(attrStr: string): Record<string, string>;
@@ -1047,7 +1050,7 @@ declare class ServerHeadProvider {
1047
1050
  //#endregion
1048
1051
  //#region src/head/index.d.ts
1049
1052
  declare module "@alepha/react" {
1050
- interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
1053
+ interface PagePrimitiveOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
1051
1054
  head?: Head | ((props: TProps, previous?: Head) => Head);
1052
1055
  }
1053
1056
  interface ReactRouterState {
@@ -1060,7 +1063,7 @@ declare module "@alepha/react" {
1060
1063
  * @see {@link ServerHeadProvider}
1061
1064
  * @module alepha.react.head
1062
1065
  */
1063
- declare const AlephaReactHead: alepha53.Service<alepha53.Module>;
1066
+ declare const AlephaReactHead: alepha22.Service<alepha22.Module>;
1064
1067
  //#endregion
1065
- export { $head, AlephaReactHead, Head, HeadDescriptor, HeadDescriptorOptions, ServerHeadProvider, SimpleHead, UseHeadOptions, UseHeadReturn, useHead };
1068
+ export { $head, AlephaReactHead, Head, HeadPrimitive, HeadPrimitiveOptions, ServerHeadProvider, SimpleHead, UseHeadOptions, UseHeadReturn, useHead };
1066
1069
  //# sourceMappingURL=index.d.ts.map