@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.
Files changed (49) hide show
  1. package/dist/auth/index.browser.js +5 -5
  2. package/dist/auth/index.browser.js.map +1 -1
  3. package/dist/auth/index.d.ts +330 -330
  4. package/dist/auth/index.js +7 -7
  5. package/dist/auth/index.js.map +1 -1
  6. package/dist/core/index.browser.js +19 -18
  7. package/dist/core/index.browser.js.map +1 -1
  8. package/dist/core/index.d.ts +352 -344
  9. package/dist/core/index.js +25 -24
  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 +7 -7
  15. package/dist/head/index.browser.js.map +1 -1
  16. package/dist/head/index.d.ts +265 -265
  17. package/dist/head/index.js +7 -7
  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 +18 -9
  25. package/src/auth/index.ts +1 -1
  26. package/src/auth/providers/ReactAuthProvider.ts +1 -1
  27. package/src/auth/services/ReactAuth.ts +5 -5
  28. package/src/core/components/NestedView.tsx +1 -1
  29. package/src/core/hooks/useStore.ts +4 -4
  30. package/src/core/index.browser.ts +2 -2
  31. package/src/core/index.native.ts +1 -1
  32. package/src/core/index.shared-router.ts +1 -1
  33. package/src/core/index.ts +3 -3
  34. package/src/core/{descriptors → primitives}/$page.ts +20 -20
  35. package/src/core/providers/ReactBrowserProvider.ts +2 -2
  36. package/src/core/providers/ReactBrowserRouterProvider.ts +2 -2
  37. package/src/core/providers/ReactPageProvider.ts +25 -11
  38. package/src/core/providers/ReactServerProvider.ts +12 -12
  39. package/src/core/services/ReactPageServerService.ts +6 -6
  40. package/src/core/services/ReactPageService.ts +6 -6
  41. package/src/core/services/ReactRouter.ts +3 -3
  42. package/src/head/index.browser.ts +3 -3
  43. package/src/head/index.ts +4 -4
  44. package/src/head/{descriptors → primitives}/$head.ts +6 -6
  45. package/src/i18n/hooks/useI18n.ts +2 -2
  46. package/src/i18n/index.ts +3 -3
  47. package/src/i18n/{descriptors → primitives}/$dictionary.ts +8 -8
  48. package/src/i18n/providers/I18nProvider.ts +5 -5
  49. 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 alepha30 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 {
@@ -56,16 +56,16 @@ declare class HeadProvider {
56
56
  protected fillHeadByPage(page: PageRoute, state: ReactRouterState, props: Record<string, any>): void;
57
57
  }
58
58
  //#endregion
59
- //#region src/head/descriptors/$head.d.ts
59
+ //#region src/head/primitives/$head.d.ts
60
60
  /**
61
61
  * Set global `<head>` options for the application.
62
62
  */
63
63
  declare const $head: {
64
- (options: HeadDescriptorOptions): HeadDescriptor;
65
- [KIND]: typeof HeadDescriptor;
64
+ (options: HeadPrimitiveOptions): HeadPrimitive;
65
+ [KIND]: typeof HeadPrimitive;
66
66
  };
67
- type HeadDescriptorOptions = Head | (() => Head);
68
- declare class HeadDescriptor extends Descriptor<HeadDescriptorOptions> {
67
+ type HeadPrimitiveOptions = Head | (() => Head);
68
+ declare class HeadPrimitive extends Primitive<HeadPrimitiveOptions> {
69
69
  protected readonly provider: HeadProvider;
70
70
  protected onInit(): void;
71
71
  }
@@ -92,209 +92,39 @@ declare const useHead: (options?: UseHeadOptions) => UseHeadReturn;
92
92
  type UseHeadOptions = Head | ((previous?: Head) => Head);
93
93
  type UseHeadReturn = [Head, (head?: Head | ((previous?: Head) => Head)) => void];
94
94
  //#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;
95
+ //#region ../alepha/src/server/schemas/errorSchema.d.ts
96
+ declare const errorSchema: alepha30.TObject<{
97
+ error: alepha30.TString;
98
+ status: alepha30.TInteger;
99
+ message: alepha30.TString;
100
+ details: alepha30.TOptional<alepha30.TString>;
101
+ requestId: alepha30.TOptional<alepha30.TString>;
102
+ cause: alepha30.TOptional<alepha30.TObject<{
103
+ name: alepha30.TString;
104
+ message: alepha30.TString;
105
+ }>>;
105
106
  }>;
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
- }
107
+ type ErrorSchema = Static<typeof errorSchema>;
223
108
  //#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;
109
+ //#region ../alepha/src/server/errors/HttpError.d.ts
110
+ declare class HttpError extends AlephaError {
111
+ name: string;
112
+ static is: (error: unknown, status?: number) => error is HttpErrorLike;
113
+ static toJSON(error: HttpError): ErrorSchema;
114
+ readonly error: string;
115
+ readonly status: number;
116
+ readonly requestId?: string;
117
+ readonly details?: string;
118
+ readonly reason?: {
119
+ name: string;
120
+ message: string;
121
+ };
122
+ constructor(options: Partial<ErrorSchema>, cause?: unknown);
249
123
  }
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
- }
124
+ interface HttpErrorLike extends Error {
125
+ status: number;
292
126
  }
293
127
  //#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
128
  //#region ../alepha/src/router/providers/RouterProvider.d.ts
299
129
  declare abstract class RouterProvider<T extends Route = Route> {
300
130
  protected routePathRegex: RegExp;
@@ -339,6 +169,10 @@ interface Tree<T extends Route> {
339
169
  };
340
170
  }
341
171
  //#endregion
172
+ //#region ../alepha/src/server/constants/routeMethods.d.ts
173
+ declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
174
+ type RouteMethod = (typeof routeMethods)[number];
175
+ //#endregion
342
176
  //#region ../alepha/src/server/helpers/ServerReply.d.ts
343
177
  /**
344
178
  * Helper for building server replies.
@@ -505,6 +339,205 @@ interface WebRequestEvent {
505
339
  res?: Response;
506
340
  }
507
341
  //#endregion
342
+ //#region ../alepha/src/logger/schemas/logEntrySchema.d.ts
343
+ declare const logEntrySchema: alepha30.TObject<{
344
+ level: alepha30.TUnsafe<"TRACE" | "SILENT" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
345
+ message: alepha30.TString;
346
+ service: alepha30.TString;
347
+ module: alepha30.TString;
348
+ context: alepha30.TOptional<alepha30.TString>;
349
+ app: alepha30.TOptional<alepha30.TString>;
350
+ data: alepha30.TOptional<alepha30.TAny>;
351
+ timestamp: alepha30.TNumber;
352
+ }>;
353
+ type LogEntry = Static<typeof logEntrySchema>;
354
+ //#endregion
355
+ //#region ../alepha/src/datetime/providers/DateTimeProvider.d.ts
356
+ type DateTime = DayjsApi.Dayjs;
357
+ type Duration = dayjsDuration.Duration;
358
+ type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
359
+ declare class DateTimeProvider {
360
+ static PLUGINS: Array<PluginFunc<any>>;
361
+ protected alepha: Alepha;
362
+ protected ref: DateTime | null;
363
+ protected readonly timeouts: Timeout[];
364
+ protected readonly intervals: Interval[];
365
+ constructor();
366
+ protected readonly onStart: alepha30.HookPrimitive<"start">;
367
+ protected readonly onStop: alepha30.HookPrimitive<"stop">;
368
+ setLocale(locale: string): void;
369
+ isDateTime(value: unknown): value is DateTime;
370
+ /**
371
+ * Create a new UTC DateTime instance.
372
+ */
373
+ utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
374
+ /**
375
+ * Create a new DateTime instance.
376
+ */
377
+ of(date: string | number | Date | Dayjs | null | undefined): DateTime;
378
+ /**
379
+ * Get the current date as a string.
380
+ */
381
+ toISOString(date?: Date | string | DateTime): string;
382
+ /**
383
+ * Get the current date.
384
+ */
385
+ now(): DateTime;
386
+ /**
387
+ * Get the current date as a string.
388
+ *
389
+ * This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
390
+ */
391
+ nowISOString(): string;
392
+ /**
393
+ * Get the current date as milliseconds since epoch.
394
+ *
395
+ * This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
396
+ */
397
+ nowMillis(): number;
398
+ /**
399
+ * Get the current date as a string.
400
+ *
401
+ * @protected
402
+ */
403
+ protected getCurrentDate(): DateTime;
404
+ /**
405
+ * Create a new Duration instance.
406
+ */
407
+ duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
408
+ isDurationLike(value: unknown): value is DurationLike;
409
+ /**
410
+ * Return a promise that resolves after the next tick.
411
+ * It uses `setTimeout` with 0 ms delay.
412
+ */
413
+ tick(): Promise<void>;
414
+ /**
415
+ * Wait for a certain duration.
416
+ *
417
+ * You can clear the timeout by using the `AbortSignal` API.
418
+ * Aborted signal will resolve the promise immediately, it does not reject it.
419
+ */
420
+ wait(duration: DurationLike, options?: {
421
+ signal?: AbortSignal;
422
+ now?: number;
423
+ }): Promise<void>;
424
+ createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
425
+ /**
426
+ * Run a callback after a certain duration.
427
+ */
428
+ createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
429
+ clearTimeout(timeout: Timeout): void;
430
+ clearInterval(interval: Interval): void;
431
+ /**
432
+ * Run a function with a deadline.
433
+ */
434
+ deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike): Promise<T>;
435
+ /**
436
+ * Add time to the current date.
437
+ */
438
+ travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
439
+ /**
440
+ * Stop the time.
441
+ */
442
+ pause(): DateTime;
443
+ /**
444
+ * Reset the reference date.
445
+ */
446
+ reset(): void;
447
+ }
448
+ interface Interval {
449
+ timer?: any;
450
+ duration: number;
451
+ run: () => unknown;
452
+ }
453
+ interface Timeout {
454
+ now: number;
455
+ timer?: any;
456
+ duration: number;
457
+ callback: () => void;
458
+ clear: () => void;
459
+ }
460
+ //#endregion
461
+ //#region ../alepha/src/logger/providers/LogDestinationProvider.d.ts
462
+ declare abstract class LogDestinationProvider {
463
+ abstract write(message: string, entry: LogEntry): void;
464
+ }
465
+ //#endregion
466
+ //#region ../alepha/src/logger/providers/LogFormatterProvider.d.ts
467
+ declare abstract class LogFormatterProvider {
468
+ abstract format(entry: LogEntry): string;
469
+ }
470
+ //#endregion
471
+ //#region ../alepha/src/logger/services/Logger.d.ts
472
+ declare class Logger implements LoggerInterface {
473
+ protected readonly alepha: Alepha;
474
+ protected readonly formatter: LogFormatterProvider;
475
+ protected readonly destination: LogDestinationProvider;
476
+ protected readonly dateTimeProvider: DateTimeProvider;
477
+ protected readonly levels: Record<string, number>;
478
+ protected readonly service: string;
479
+ protected readonly module: string;
480
+ protected readonly app?: string;
481
+ protected appLogLevel: string;
482
+ protected logLevel: LogLevel;
483
+ constructor(service: string, module: string);
484
+ get context(): string | undefined;
485
+ get level(): string;
486
+ parseLevel(level: string, app: string): LogLevel;
487
+ private matchesPattern;
488
+ asLogLevel(something: string): LogLevel;
489
+ error(message: string, data?: unknown): void;
490
+ warn(message: string, data?: unknown): void;
491
+ info(message: string, data?: unknown): void;
492
+ debug(message: string, data?: unknown): void;
493
+ trace(message: string, data?: unknown): void;
494
+ protected log(level: LogLevel, message: string, data?: unknown): void;
495
+ protected emit(entry: LogEntry, message?: string): void;
496
+ }
497
+ //#endregion
498
+ //#region ../alepha/src/logger/index.d.ts
499
+ declare const envSchema$2: alepha30.TObject<{
500
+ /**
501
+ * Default log level for the application.
502
+ *
503
+ * Default by environment:
504
+ * - dev = info
505
+ * - prod = info
506
+ * - test = error
507
+ *
508
+ * Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
509
+ *
510
+ * Level can be set for a specific module:
511
+ *
512
+ * @example
513
+ * LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
514
+ * LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
515
+ */
516
+ LOG_LEVEL: alepha30.TOptional<alepha30.TString>;
517
+ /**
518
+ * Built-in log formats.
519
+ * - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
520
+ * - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
521
+ * - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
522
+ */
523
+ LOG_FORMAT: alepha30.TOptional<alepha30.TUnsafe<"json" | "pretty" | "raw">>;
524
+ }>;
525
+ declare module "alepha" {
526
+ interface Env extends Partial<Static<typeof envSchema$2>> {}
527
+ interface State {
528
+ /**
529
+ * Current log level for the application or specific modules.
530
+ */
531
+ "alepha.logger.level"?: string;
532
+ }
533
+ interface Hooks {
534
+ log: {
535
+ message?: string;
536
+ entry: LogEntry;
537
+ };
538
+ }
539
+ }
540
+ //#endregion
508
541
  //#region ../alepha/src/server/services/ServerRequestParser.d.ts
509
542
  declare class ServerRequestParser {
510
543
  protected readonly alepha: Alepha;
@@ -524,8 +557,8 @@ declare class ServerTimingProvider {
524
557
  prefix: string;
525
558
  disabled: boolean;
526
559
  };
527
- readonly onRequest: alepha53.HookDescriptor<"server:onRequest">;
528
- readonly onResponse: alepha53.HookDescriptor<"server:onResponse">;
560
+ readonly onRequest: alepha30.HookPrimitive<"server:onRequest">;
561
+ readonly onResponse: alepha30.HookPrimitive<"server:onResponse">;
529
562
  protected get handlerName(): string;
530
563
  beginTiming(name: string): void;
531
564
  endTiming(name: string): void;
@@ -589,11 +622,11 @@ declare class ServerProvider {
589
622
  /**
590
623
  * When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
591
624
  */
592
- protected readonly onNodeRequest: alepha53.HookDescriptor<"node:request">;
625
+ protected readonly onNodeRequest: alepha30.HookPrimitive<"node:request">;
593
626
  /**
594
627
  * When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
595
628
  */
596
- protected readonly onWebRequest: alepha53.HookDescriptor<"web:request">;
629
+ protected readonly onWebRequest: alepha30.HookPrimitive<"web:request">;
597
630
  /**
598
631
  * Handle Node.js HTTP request event.
599
632
  *
@@ -653,8 +686,8 @@ declare abstract class CacheProvider {
653
686
  abstract clear(): Promise<void>;
654
687
  }
655
688
  //#endregion
656
- //#region ../alepha/src/cache/descriptors/$cache.d.ts
657
- interface CacheDescriptorOptions<TReturn = any, TParameter extends any[] = any[]> {
689
+ //#region ../alepha/src/cache/primitives/$cache.d.ts
690
+ interface CachePrimitiveOptions<TReturn = any, TParameter extends any[] = any[]> {
658
691
  /**
659
692
  * The cache name. This is useful for invalidating multiple caches at once.
660
693
  *
@@ -689,7 +722,7 @@ interface CacheDescriptorOptions<TReturn = any, TParameter extends any[] = any[]
689
722
  */
690
723
  disabled?: boolean;
691
724
  }
692
- declare class CacheDescriptor<TReturn = any, TParameter extends any[] = any[]> extends Descriptor<CacheDescriptorOptions<TReturn, TParameter>> {
725
+ declare class CachePrimitive<TReturn = any, TParameter extends any[] = any[]> extends Primitive<CachePrimitiveOptions<TReturn, TParameter>> {
693
726
  protected readonly env: {
694
727
  CACHE_ENABLED: boolean;
695
728
  CACHE_DEFAULT_TTL: number;
@@ -713,9 +746,9 @@ declare class CacheDescriptor<TReturn = any, TParameter extends any[] = any[]> e
713
746
  protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
714
747
  protected $provider(): CacheProvider;
715
748
  }
716
- interface CacheDescriptorFn<TReturn = any, TParameter extends any[] = any[]> extends CacheDescriptor<TReturn, TParameter> {
749
+ interface CachePrimitiveFn<TReturn = any, TParameter extends any[] = any[]> extends CachePrimitive<TReturn, TParameter> {
717
750
  /**
718
- * Run the cache descriptor with the provided arguments.
751
+ * Run the cache primitive with the provided arguments.
719
752
  */
720
753
  (...args: TParameter): Promise<TReturn>;
721
754
  }
@@ -724,7 +757,7 @@ interface CacheDescriptorFn<TReturn = any, TParameter extends any[] = any[]> ext
724
757
  declare class HttpClient {
725
758
  protected readonly log: Logger;
726
759
  protected readonly alepha: Alepha;
727
- readonly cache: CacheDescriptorFn<HttpClientCache, any[]>;
760
+ readonly cache: CachePrimitiveFn<HttpClientCache, any[]>;
728
761
  protected readonly pendingRequests: HttpClientPendingRequests;
729
762
  fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
730
763
  fetch<T extends TSchema>(url: string, request?: RequestInitWithOptions<T>): Promise<FetchResponse<Static<T>>>;
@@ -792,8 +825,8 @@ interface HttpAction {
792
825
  };
793
826
  }
794
827
  //#endregion
795
- //#region ../alepha/src/server/descriptors/$action.d.ts
796
- interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
828
+ //#region ../alepha/src/server/primitives/$action.d.ts
829
+ interface ActionPrimitiveOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
797
830
  /**
798
831
  * Name of the action.
799
832
  *
@@ -859,7 +892,7 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends O
859
892
  */
860
893
  handler: ServerActionHandler<TConfig>;
861
894
  }
862
- declare class ActionDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<ActionDescriptorOptions<TConfig>> {
895
+ declare class ActionPrimitive<TConfig extends RequestConfigSchema> extends Primitive<ActionPrimitiveOptions<TConfig>> {
863
896
  protected readonly log: Logger;
864
897
  protected readonly env: {
865
898
  SERVER_API_PREFIX: string;
@@ -927,52 +960,19 @@ type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSche
927
960
  */
928
961
  interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
929
962
  //#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
963
  //#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;
964
+ declare const envSchema$1: alepha30.TObject<{
965
+ SERVER_PORT: alepha30.TInteger;
966
+ SERVER_HOST: alepha30.TString;
967
967
  }>;
968
968
  declare module "alepha" {
969
969
  interface Env extends Partial<Static<typeof envSchema$1>> {}
970
970
  }
971
971
  //#endregion
972
972
  //#region ../alepha/src/server/providers/NodeHttpServerProvider.d.ts
973
- declare const envSchema: alepha53.TObject<{
974
- SERVER_PORT: alepha53.TInteger;
975
- SERVER_HOST: alepha53.TString;
973
+ declare const envSchema: alepha30.TObject<{
974
+ SERVER_PORT: alepha30.TInteger;
975
+ SERVER_HOST: alepha30.TString;
976
976
  }>;
977
977
  declare module "alepha" {
978
978
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -985,12 +985,12 @@ declare module "alepha" {
985
985
  }
986
986
  interface Hooks {
987
987
  "action:onRequest": {
988
- action: ActionDescriptor<RequestConfigSchema>;
988
+ action: ActionPrimitive<RequestConfigSchema>;
989
989
  request: ServerRequest;
990
990
  options: ClientRequestOptions;
991
991
  };
992
992
  "action:onResponse": {
993
- action: ActionDescriptor<RequestConfigSchema>;
993
+ action: ActionPrimitive<RequestConfigSchema>;
994
994
  request: ServerRequest;
995
995
  options: ClientRequestOptions;
996
996
  response: any;
@@ -1038,7 +1038,7 @@ declare module "alepha" {
1038
1038
  declare class ServerHeadProvider {
1039
1039
  protected readonly headProvider: HeadProvider;
1040
1040
  protected readonly serverTimingProvider: ServerTimingProvider;
1041
- protected readonly onServerRenderEnd: alepha53.HookDescriptor<"react:server:render:end">;
1041
+ protected readonly onServerRenderEnd: alepha30.HookPrimitive<"react:server:render:end">;
1042
1042
  renderHead(template: string, head: SimpleHead): string;
1043
1043
  protected mergeAttributes(existing: string, attrs: Record<string, string>): string;
1044
1044
  protected parseAttributes(attrStr: string): Record<string, string>;
@@ -1047,7 +1047,7 @@ declare class ServerHeadProvider {
1047
1047
  //#endregion
1048
1048
  //#region src/head/index.d.ts
1049
1049
  declare module "@alepha/react" {
1050
- interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
1050
+ interface PagePrimitiveOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
1051
1051
  head?: Head | ((props: TProps, previous?: Head) => Head);
1052
1052
  }
1053
1053
  interface ReactRouterState {
@@ -1060,7 +1060,7 @@ declare module "@alepha/react" {
1060
1060
  * @see {@link ServerHeadProvider}
1061
1061
  * @module alepha.react.head
1062
1062
  */
1063
- declare const AlephaReactHead: alepha53.Service<alepha53.Module>;
1063
+ declare const AlephaReactHead: alepha30.Service<alepha30.Module>;
1064
1064
  //#endregion
1065
- export { $head, AlephaReactHead, Head, HeadDescriptor, HeadDescriptorOptions, ServerHeadProvider, SimpleHead, UseHeadOptions, UseHeadReturn, useHead };
1065
+ export { $head, AlephaReactHead, Head, HeadPrimitive, HeadPrimitiveOptions, ServerHeadProvider, SimpleHead, UseHeadOptions, UseHeadReturn, useHead };
1066
1066
  //# sourceMappingURL=index.d.ts.map