@alepha/react 0.13.6 → 0.13.8

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 (37) 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 +105 -103
  4. package/dist/auth/index.js +5 -5
  5. package/dist/auth/index.js.map +1 -1
  6. package/dist/core/index.browser.js +407 -142
  7. package/dist/core/index.browser.js.map +1 -1
  8. package/dist/core/index.d.ts +144 -116
  9. package/dist/core/index.js +409 -145
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/core/index.native.js +24 -2
  12. package/dist/core/index.native.js.map +1 -1
  13. package/dist/form/index.d.ts +14 -6
  14. package/dist/form/index.js +32 -12
  15. package/dist/form/index.js.map +1 -1
  16. package/dist/head/index.d.ts +18 -18
  17. package/dist/head/index.js +5 -1
  18. package/dist/head/index.js.map +1 -1
  19. package/dist/i18n/index.d.ts +25 -25
  20. package/dist/i18n/index.js +4 -3
  21. package/dist/i18n/index.js.map +1 -1
  22. package/dist/websocket/index.d.ts +1 -1
  23. package/package.json +22 -23
  24. package/src/auth/hooks/useAuth.ts +1 -0
  25. package/src/auth/services/ReactAuth.ts +6 -4
  26. package/src/core/components/ErrorViewer.tsx +378 -130
  27. package/src/core/components/NestedView.tsx +16 -11
  28. package/src/core/contexts/AlephaProvider.tsx +41 -0
  29. package/src/core/contexts/RouterLayerContext.ts +2 -0
  30. package/src/core/hooks/useAction.ts +4 -1
  31. package/src/core/index.shared.ts +1 -0
  32. package/src/core/primitives/$page.ts +15 -2
  33. package/src/core/providers/ReactPageProvider.ts +6 -7
  34. package/src/core/providers/ReactServerProvider.ts +2 -6
  35. package/src/form/services/FormModel.ts +81 -26
  36. package/src/head/index.ts +2 -1
  37. package/src/i18n/providers/I18nProvider.ts +4 -2
@@ -1,4 +1,4 @@
1
- import * as alepha60 from "alepha";
1
+ import * as alepha48 from "alepha";
2
2
  import { Alepha, AlephaError, Async, Atom, FileLike, Hook, Hooks, InstantiableClass, KIND, LogLevel, LoggerInterface, Primitive, Service, State, Static, StreamLike, TArray, TAtomObject, TFile, TObject, TRecord, TSchema, TStream, TString, TVoid } from "alepha";
3
3
  import * as react0 from "react";
4
4
  import React, { AnchorHTMLAttributes, CSSProperties, DependencyList, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
@@ -9,21 +9,21 @@ import { ReadableStream } from "node:stream/web";
9
9
  import dayjsDuration from "dayjs/plugin/duration.js";
10
10
  import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
11
11
 
12
- //#region ../../../alepha/src/server/schemas/errorSchema.d.ts
13
- declare const errorSchema: alepha60.TObject<{
14
- error: alepha60.TString;
15
- status: alepha60.TInteger;
16
- message: alepha60.TString;
17
- details: alepha60.TOptional<alepha60.TString>;
18
- requestId: alepha60.TOptional<alepha60.TString>;
19
- cause: alepha60.TOptional<alepha60.TObject<{
20
- name: alepha60.TString;
21
- message: alepha60.TString;
12
+ //#region ../../../alepha/src/server/core/schemas/errorSchema.d.ts
13
+ declare const errorSchema: alepha48.TObject<{
14
+ error: alepha48.TString;
15
+ status: alepha48.TInteger;
16
+ message: alepha48.TString;
17
+ details: alepha48.TOptional<alepha48.TString>;
18
+ requestId: alepha48.TOptional<alepha48.TString>;
19
+ cause: alepha48.TOptional<alepha48.TObject<{
20
+ name: alepha48.TString;
21
+ message: alepha48.TString;
22
22
  }>>;
23
23
  }>;
24
24
  type ErrorSchema = Static<typeof errorSchema>;
25
25
  //#endregion
26
- //#region ../../../alepha/src/server/errors/HttpError.d.ts
26
+ //#region ../../../alepha/src/server/core/errors/HttpError.d.ts
27
27
  declare class HttpError extends AlephaError {
28
28
  name: string;
29
29
  static is: (error: unknown, status?: number) => error is HttpErrorLike;
@@ -86,11 +86,11 @@ interface Tree<T$1 extends Route> {
86
86
  };
87
87
  }
88
88
  //#endregion
89
- //#region ../../../alepha/src/server/constants/routeMethods.d.ts
89
+ //#region ../../../alepha/src/server/core/constants/routeMethods.d.ts
90
90
  declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
91
91
  type RouteMethod = (typeof routeMethods)[number];
92
92
  //#endregion
93
- //#region ../../../alepha/src/server/helpers/ServerReply.d.ts
93
+ //#region ../../../alepha/src/server/core/helpers/ServerReply.d.ts
94
94
  /**
95
95
  * Helper for building server replies.
96
96
  */
@@ -118,7 +118,7 @@ declare class ServerReply {
118
118
  setBody(body: any): this;
119
119
  }
120
120
  //#endregion
121
- //#region ../../../alepha/src/server/services/UserAgentParser.d.ts
121
+ //#region ../../../alepha/src/server/core/services/UserAgentParser.d.ts
122
122
  interface UserAgentInfo {
123
123
  os: "Windows" | "Android" | "Ubuntu" | "MacOS" | "iOS" | "Linux" | "FreeBSD" | "OpenBSD" | "ChromeOS" | "BlackBerry" | "Symbian" | "Windows Phone";
124
124
  browser: "Chrome" | "Firefox" | "Safari" | "Edge" | "Opera" | "Internet Explorer" | "Brave" | "Vivaldi" | "Samsung Browser" | "UC Browser" | "Yandex";
@@ -134,7 +134,7 @@ declare class UserAgentParser {
134
134
  parse(userAgent?: string): UserAgentInfo;
135
135
  }
136
136
  //#endregion
137
- //#region ../../../alepha/src/server/interfaces/ServerRequest.d.ts
137
+ //#region ../../../alepha/src/server/core/interfaces/ServerRequest.d.ts
138
138
  type TRequestBody = TObject | TString | TArray | TRecord | TStream;
139
139
  type TResponseBody = TObject | TString | TRecord | TFile | TArray | TStream | TVoid;
140
140
  interface RequestConfigSchema {
@@ -257,15 +257,15 @@ interface WebRequestEvent {
257
257
  }
258
258
  //#endregion
259
259
  //#region ../../../alepha/src/logger/schemas/logEntrySchema.d.ts
260
- declare const logEntrySchema: alepha60.TObject<{
261
- level: alepha60.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
262
- message: alepha60.TString;
263
- service: alepha60.TString;
264
- module: alepha60.TString;
265
- context: alepha60.TOptional<alepha60.TString>;
266
- app: alepha60.TOptional<alepha60.TString>;
267
- data: alepha60.TOptional<alepha60.TAny>;
268
- timestamp: alepha60.TNumber;
260
+ declare const logEntrySchema: alepha48.TObject<{
261
+ level: alepha48.TUnsafe<"TRACE" | "SILENT" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
262
+ message: alepha48.TString;
263
+ service: alepha48.TString;
264
+ module: alepha48.TString;
265
+ context: alepha48.TOptional<alepha48.TString>;
266
+ app: alepha48.TOptional<alepha48.TString>;
267
+ data: alepha48.TOptional<alepha48.TAny>;
268
+ timestamp: alepha48.TNumber;
269
269
  }>;
270
270
  type LogEntry = Static<typeof logEntrySchema>;
271
271
  //#endregion
@@ -280,8 +280,8 @@ declare class DateTimeProvider {
280
280
  protected readonly timeouts: Timeout[];
281
281
  protected readonly intervals: Interval[];
282
282
  constructor();
283
- protected readonly onStart: alepha60.HookPrimitive<"start">;
284
- protected readonly onStop: alepha60.HookPrimitive<"stop">;
283
+ protected readonly onStart: alepha48.HookPrimitive<"start">;
284
+ protected readonly onStop: alepha48.HookPrimitive<"stop">;
285
285
  setLocale(locale: string): void;
286
286
  isDateTime(value: unknown): value is DateTime;
287
287
  /**
@@ -413,7 +413,7 @@ declare class Logger implements LoggerInterface {
413
413
  }
414
414
  //#endregion
415
415
  //#region ../../../alepha/src/logger/index.d.ts
416
- declare const envSchema$6: alepha60.TObject<{
416
+ declare const envSchema$6: alepha48.TObject<{
417
417
  /**
418
418
  * Default log level for the application.
419
419
  *
@@ -430,14 +430,14 @@ declare const envSchema$6: alepha60.TObject<{
430
430
  * LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
431
431
  * LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
432
432
  */
433
- LOG_LEVEL: alepha60.TOptional<alepha60.TString>;
433
+ LOG_LEVEL: alepha48.TOptional<alepha48.TString>;
434
434
  /**
435
435
  * Built-in log formats.
436
436
  * - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
437
- * - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
437
+ * - "pretty" - Simple text format, human-readable, with colors. {@link PrettyFormatterProvider}
438
438
  * - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
439
439
  */
440
- LOG_FORMAT: alepha60.TOptional<alepha60.TUnsafe<"json" | "pretty" | "raw">>;
440
+ LOG_FORMAT: alepha48.TOptional<alepha48.TUnsafe<"json" | "pretty" | "raw">>;
441
441
  }>;
442
442
  declare module "alepha" {
443
443
  interface Env extends Partial<Static<typeof envSchema$6>> {}
@@ -455,7 +455,7 @@ declare module "alepha" {
455
455
  }
456
456
  }
457
457
  //#endregion
458
- //#region ../../../alepha/src/server/services/ServerRequestParser.d.ts
458
+ //#region ../../../alepha/src/server/core/services/ServerRequestParser.d.ts
459
459
  declare class ServerRequestParser {
460
460
  protected readonly alepha: Alepha;
461
461
  protected readonly userAgentParser: UserAgentParser;
@@ -465,7 +465,7 @@ declare class ServerRequestParser {
465
465
  getRequestIp(request: ServerRequestData): string | undefined;
466
466
  }
467
467
  //#endregion
468
- //#region ../../../alepha/src/server/providers/ServerTimingProvider.d.ts
468
+ //#region ../../../alepha/src/server/core/providers/ServerTimingProvider.d.ts
469
469
  type TimingMap = Record<string, [number, number]>;
470
470
  declare class ServerTimingProvider {
471
471
  protected readonly log: Logger;
@@ -474,15 +474,15 @@ declare class ServerTimingProvider {
474
474
  prefix: string;
475
475
  disabled: boolean;
476
476
  };
477
- readonly onRequest: alepha60.HookPrimitive<"server:onRequest">;
478
- readonly onResponse: alepha60.HookPrimitive<"server:onResponse">;
477
+ readonly onRequest: alepha48.HookPrimitive<"server:onRequest">;
478
+ readonly onResponse: alepha48.HookPrimitive<"server:onResponse">;
479
479
  protected get handlerName(): string;
480
480
  beginTiming(name: string): void;
481
481
  endTiming(name: string): void;
482
482
  protected setDuration(name: string, timing: TimingMap): void;
483
483
  }
484
484
  //#endregion
485
- //#region ../../../alepha/src/server/providers/ServerRouterProvider.d.ts
485
+ //#region ../../../alepha/src/server/core/providers/ServerRouterProvider.d.ts
486
486
  /**
487
487
  * Main router for all routes on the server side.
488
488
  *
@@ -521,7 +521,7 @@ declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
521
521
  }, request: ServerRequestConfig): void;
522
522
  }
523
523
  //#endregion
524
- //#region ../../../alepha/src/server/providers/ServerProvider.d.ts
524
+ //#region ../../../alepha/src/server/core/providers/ServerProvider.d.ts
525
525
  /**
526
526
  * Base server provider to handle incoming requests and route them.
527
527
  *
@@ -539,11 +539,11 @@ declare class ServerProvider {
539
539
  /**
540
540
  * When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
541
541
  */
542
- protected readonly onNodeRequest: alepha60.HookPrimitive<"node:request">;
542
+ protected readonly onNodeRequest: alepha48.HookPrimitive<"node:request">;
543
543
  /**
544
544
  * When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
545
545
  */
546
- protected readonly onWebRequest: alepha60.HookPrimitive<"web:request">;
546
+ protected readonly onWebRequest: alepha48.HookPrimitive<"web:request">;
547
547
  /**
548
548
  * Handle Node.js HTTP request event.
549
549
  *
@@ -560,7 +560,7 @@ declare class ServerProvider {
560
560
  protected isViteNotFound(url?: string, route?: Route, params?: Record<string, string>): boolean;
561
561
  }
562
562
  //#endregion
563
- //#region ../../../alepha/src/cache/providers/CacheProvider.d.ts
563
+ //#region ../../../alepha/src/cache/core/providers/CacheProvider.d.ts
564
564
  /**
565
565
  * Cache provider interface.
566
566
  *
@@ -603,7 +603,7 @@ declare abstract class CacheProvider {
603
603
  abstract clear(): Promise<void>;
604
604
  }
605
605
  //#endregion
606
- //#region ../../../alepha/src/cache/primitives/$cache.d.ts
606
+ //#region ../../../alepha/src/cache/core/primitives/$cache.d.ts
607
607
  interface CachePrimitiveOptions<TReturn = any, TParameter extends any[] = any[]> {
608
608
  /**
609
609
  * The cache name. This is useful for invalidating multiple caches at once.
@@ -670,7 +670,7 @@ interface CachePrimitiveFn<TReturn = any, TParameter extends any[] = any[]> exte
670
670
  (...args: TParameter): Promise<TReturn>;
671
671
  }
672
672
  //#endregion
673
- //#region ../../../alepha/src/server/services/HttpClient.d.ts
673
+ //#region ../../../alepha/src/server/core/services/HttpClient.d.ts
674
674
  declare class HttpClient {
675
675
  protected readonly log: Logger;
676
676
  protected readonly alepha: Alepha;
@@ -742,7 +742,7 @@ interface HttpAction {
742
742
  };
743
743
  }
744
744
  //#endregion
745
- //#region ../../../alepha/src/server/primitives/$action.d.ts
745
+ //#region ../../../alepha/src/server/core/primitives/$action.d.ts
746
746
  interface ActionPrimitiveOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
747
747
  /**
748
748
  * Name of the action.
@@ -877,25 +877,25 @@ type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSche
877
877
  */
878
878
  interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
879
879
  //#endregion
880
- //#region ../../../alepha/src/server/providers/BunHttpServerProvider.d.ts
881
- declare const envSchema$5: alepha60.TObject<{
882
- SERVER_PORT: alepha60.TInteger;
883
- SERVER_HOST: alepha60.TString;
880
+ //#region ../../../alepha/src/server/core/providers/BunHttpServerProvider.d.ts
881
+ declare const envSchema$5: alepha48.TObject<{
882
+ SERVER_PORT: alepha48.TInteger;
883
+ SERVER_HOST: alepha48.TString;
884
884
  }>;
885
885
  declare module "alepha" {
886
886
  interface Env extends Partial<Static<typeof envSchema$5>> {}
887
887
  }
888
888
  //#endregion
889
- //#region ../../../alepha/src/server/providers/NodeHttpServerProvider.d.ts
890
- declare const envSchema$4: alepha60.TObject<{
891
- SERVER_PORT: alepha60.TInteger;
892
- SERVER_HOST: alepha60.TString;
889
+ //#region ../../../alepha/src/server/core/providers/NodeHttpServerProvider.d.ts
890
+ declare const envSchema$4: alepha48.TObject<{
891
+ SERVER_PORT: alepha48.TInteger;
892
+ SERVER_HOST: alepha48.TString;
893
893
  }>;
894
894
  declare module "alepha" {
895
895
  interface Env extends Partial<Static<typeof envSchema$4>> {}
896
896
  }
897
897
  //#endregion
898
- //#region ../../../alepha/src/server/index.d.ts
898
+ //#region ../../../alepha/src/server/core/index.d.ts
899
899
  declare module "alepha" {
900
900
  interface State {
901
901
  "alepha.node.server"?: Server;
@@ -951,7 +951,7 @@ declare module "alepha" {
951
951
  }
952
952
  }
953
953
  //#endregion
954
- //#region ../../../alepha/src/server-cache/providers/ServerCacheProvider.d.ts
954
+ //#region ../../../alepha/src/server/cache/providers/ServerCacheProvider.d.ts
955
955
  declare module "alepha/server" {
956
956
  interface ServerRoute {
957
957
  /**
@@ -1077,8 +1077,8 @@ declare class Redirection extends Error {
1077
1077
  }
1078
1078
  //#endregion
1079
1079
  //#region ../../src/core/providers/ReactPageProvider.d.ts
1080
- declare const envSchema$3: alepha60.TObject<{
1081
- REACT_STRICT_MODE: alepha60.TBoolean;
1080
+ declare const envSchema$3: alepha48.TObject<{
1081
+ REACT_STRICT_MODE: alepha48.TBoolean;
1082
1082
  }>;
1083
1083
  declare module "alepha" {
1084
1084
  interface Env extends Partial<Static<typeof envSchema$3>> {}
@@ -1109,7 +1109,6 @@ declare class ReactPageProvider {
1109
1109
  * It also handles errors and redirects.
1110
1110
  */
1111
1111
  createLayers(route: PageRoute, state: ReactRouterState, previous?: PreviousLayerData[]): Promise<CreateLayersResult>;
1112
- protected createRedirectionLayer(redirect: string): CreateLayersResult;
1113
1112
  protected getErrorHandler(route: PageRoute): ErrorHandler | undefined;
1114
1113
  protected createElement(page: PageRoute, props: Record<string, any>): Promise<ReactNode>;
1115
1114
  renderError(error: Error): ReactNode;
@@ -1121,7 +1120,7 @@ declare class ReactPageProvider {
1121
1120
  }, params?: Record<string, any>): string;
1122
1121
  compile(path: string, params?: Record<string, string>): string;
1123
1122
  protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
1124
- protected readonly configure: alepha60.HookPrimitive<"configure">;
1123
+ protected readonly configure: alepha48.HookPrimitive<"configure">;
1125
1124
  protected map(pages: Array<PagePrimitive>, target: PagePrimitive): PageRouteEntry;
1126
1125
  add(entry: PageRouteEntry): void;
1127
1126
  protected createMatch(page: PageRoute): string;
@@ -1336,10 +1335,10 @@ interface PagePrimitiveOptions<TConfig extends PageConfigSchema = PageConfigSche
1336
1335
  * Load data before rendering the page.
1337
1336
  *
1338
1337
  * This function receives
1339
- * - the request context and
1338
+ * - the request context (params, query, etc.)
1340
1339
  * - the parent props (if page has a parent)
1341
1340
  *
1342
- * In SSR, the returned data will be serialized and sent to the client, then reused during the client-side hydration.
1341
+ * > In SSR, the returned data will be serialized and sent to the client, then reused during the client-side hydration.
1343
1342
  *
1344
1343
  * Resolve can be stopped by throwing an error, which will be handled by the `errorHandler` function.
1345
1344
  * It's common to throw a `NotFoundError` to display a 404 page.
@@ -1347,6 +1346,12 @@ interface PagePrimitiveOptions<TConfig extends PageConfigSchema = PageConfigSche
1347
1346
  * RedirectError can be thrown to redirect the user to another page.
1348
1347
  */
1349
1348
  resolve?: (context: PageResolve<TConfig, TPropsParent>) => Async<TProps>;
1349
+ /**
1350
+ * Default props to pass to the component when rendering the page.
1351
+ *
1352
+ * Resolved props from the `resolve` function will override these default props.
1353
+ */
1354
+ props?: () => Partial<TProps>;
1350
1355
  /**
1351
1356
  * The component to render when the page is loaded.
1352
1357
  *
@@ -1372,6 +1377,12 @@ interface PagePrimitiveOptions<TConfig extends PageConfigSchema = PageConfigSche
1372
1377
  * Define a parent page for nested routing.
1373
1378
  */
1374
1379
  parent?: PagePrimitive<PageConfigSchema, TPropsParent, any>;
1380
+ /**
1381
+ * Function to determine if the page can be accessed.
1382
+ *
1383
+ * If it returns false, the page will not be accessible and a 403 Forbidden error will be returned.
1384
+ * This function can be used to implement permission-based access control.
1385
+ */
1375
1386
  can?: () => boolean;
1376
1387
  /**
1377
1388
  * Catch any error from the `resolve` function or during `rendering`.
@@ -1540,15 +1551,15 @@ type CssAnimation = {
1540
1551
  };
1541
1552
  //#endregion
1542
1553
  //#region ../../../alepha/src/security/schemas/userAccountInfoSchema.d.ts
1543
- declare const userAccountInfoSchema: alepha60.TObject<{
1544
- id: alepha60.TString;
1545
- name: alepha60.TOptional<alepha60.TString>;
1546
- email: alepha60.TOptional<alepha60.TString>;
1547
- username: alepha60.TOptional<alepha60.TString>;
1548
- picture: alepha60.TOptional<alepha60.TString>;
1549
- sessionId: alepha60.TOptional<alepha60.TString>;
1550
- organizations: alepha60.TOptional<alepha60.TArray<alepha60.TString>>;
1551
- roles: alepha60.TOptional<alepha60.TArray<alepha60.TString>>;
1554
+ declare const userAccountInfoSchema: alepha48.TObject<{
1555
+ id: alepha48.TString;
1556
+ name: alepha48.TOptional<alepha48.TString>;
1557
+ email: alepha48.TOptional<alepha48.TString>;
1558
+ username: alepha48.TOptional<alepha48.TString>;
1559
+ picture: alepha48.TOptional<alepha48.TString>;
1560
+ sessionId: alepha48.TOptional<alepha48.TString>;
1561
+ organizations: alepha48.TOptional<alepha48.TArray<alepha48.TString>>;
1562
+ roles: alepha48.TOptional<alepha48.TArray<alepha48.TString>>;
1552
1563
  }>;
1553
1564
  type UserAccount = Static<typeof userAccountInfoSchema>;
1554
1565
  //#endregion
@@ -1574,8 +1585,8 @@ interface UserAccountToken extends UserAccount {
1574
1585
  }
1575
1586
  //#endregion
1576
1587
  //#region ../../../alepha/src/security/providers/SecurityProvider.d.ts
1577
- declare const envSchema$2: alepha60.TObject<{
1578
- APP_SECRET: alepha60.TString;
1588
+ declare const envSchema$2: alepha48.TObject<{
1589
+ APP_SECRET: alepha48.TString;
1579
1590
  }>;
1580
1591
  declare module "alepha" {
1581
1592
  interface Env extends Partial<Static<typeof envSchema$2>> {}
@@ -1603,19 +1614,19 @@ declare module "alepha" {
1603
1614
  * @module alepha.security
1604
1615
  */
1605
1616
  //#endregion
1606
- //#region ../../../alepha/src/server-security/providers/ServerBasicAuthProvider.d.ts
1617
+ //#region ../../../alepha/src/server/security/providers/ServerBasicAuthProvider.d.ts
1607
1618
  interface BasicAuthOptions {
1608
1619
  username: string;
1609
1620
  password: string;
1610
1621
  }
1611
1622
  //#endregion
1612
- //#region ../../../alepha/src/server-security/providers/ServerSecurityProvider.d.ts
1623
+ //#region ../../../alepha/src/server/security/providers/ServerSecurityProvider.d.ts
1613
1624
  type ServerRouteSecure = {
1614
1625
  realm?: string;
1615
1626
  basic?: BasicAuthOptions;
1616
1627
  };
1617
1628
  //#endregion
1618
- //#region ../../../alepha/src/server-security/index.d.ts
1629
+ //#region ../../../alepha/src/server/security/index.d.ts
1619
1630
  declare module "alepha" {
1620
1631
  interface State {
1621
1632
  /**
@@ -1667,30 +1678,30 @@ declare module "alepha/server" {
1667
1678
  * @module alepha.server.security
1668
1679
  */
1669
1680
  //#endregion
1670
- //#region ../../../alepha/src/server-links/schemas/apiLinksResponseSchema.d.ts
1671
- declare const apiLinkSchema: alepha60.TObject<{
1672
- name: alepha60.TString;
1673
- group: alepha60.TOptional<alepha60.TString>;
1674
- path: alepha60.TString;
1675
- method: alepha60.TOptional<alepha60.TString>;
1676
- requestBodyType: alepha60.TOptional<alepha60.TString>;
1677
- service: alepha60.TOptional<alepha60.TString>;
1681
+ //#region ../../../alepha/src/server/links/schemas/apiLinksResponseSchema.d.ts
1682
+ declare const apiLinkSchema: alepha48.TObject<{
1683
+ name: alepha48.TString;
1684
+ group: alepha48.TOptional<alepha48.TString>;
1685
+ path: alepha48.TString;
1686
+ method: alepha48.TOptional<alepha48.TString>;
1687
+ requestBodyType: alepha48.TOptional<alepha48.TString>;
1688
+ service: alepha48.TOptional<alepha48.TString>;
1678
1689
  }>;
1679
- declare const apiLinksResponseSchema: alepha60.TObject<{
1680
- prefix: alepha60.TOptional<alepha60.TString>;
1681
- links: alepha60.TArray<alepha60.TObject<{
1682
- name: alepha60.TString;
1683
- group: alepha60.TOptional<alepha60.TString>;
1684
- path: alepha60.TString;
1685
- method: alepha60.TOptional<alepha60.TString>;
1686
- requestBodyType: alepha60.TOptional<alepha60.TString>;
1687
- service: alepha60.TOptional<alepha60.TString>;
1690
+ declare const apiLinksResponseSchema: alepha48.TObject<{
1691
+ prefix: alepha48.TOptional<alepha48.TString>;
1692
+ links: alepha48.TArray<alepha48.TObject<{
1693
+ name: alepha48.TString;
1694
+ group: alepha48.TOptional<alepha48.TString>;
1695
+ path: alepha48.TString;
1696
+ method: alepha48.TOptional<alepha48.TString>;
1697
+ requestBodyType: alepha48.TOptional<alepha48.TString>;
1698
+ service: alepha48.TOptional<alepha48.TString>;
1688
1699
  }>>;
1689
1700
  }>;
1690
1701
  type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
1691
1702
  type ApiLink = Static<typeof apiLinkSchema>;
1692
1703
  //#endregion
1693
- //#region ../../../alepha/src/server-links/providers/LinkProvider.d.ts
1704
+ //#region ../../../alepha/src/server/links/providers/LinkProvider.d.ts
1694
1705
  /**
1695
1706
  * Browser, SSR friendly, service to handle links.
1696
1707
  */
@@ -1757,7 +1768,7 @@ interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<ActionPrim
1757
1768
  can: () => boolean;
1758
1769
  }
1759
1770
  //#endregion
1760
- //#region ../../../alepha/src/server-links/index.d.ts
1771
+ //#region ../../../alepha/src/server/links/index.d.ts
1761
1772
  declare module "alepha" {
1762
1773
  interface State {
1763
1774
  /**
@@ -1790,14 +1801,14 @@ declare class ReactBrowserRouterProvider extends RouterProvider<BrowserRoute> {
1790
1801
  protected readonly alepha: Alepha;
1791
1802
  protected readonly pageApi: ReactPageProvider;
1792
1803
  add(entry: PageRouteEntry): void;
1793
- protected readonly configure: alepha60.HookPrimitive<"configure">;
1804
+ protected readonly configure: alepha48.HookPrimitive<"configure">;
1794
1805
  transition(url: URL, previous?: PreviousLayerData[], meta?: {}): Promise<string | void>;
1795
1806
  root(state: ReactRouterState): ReactNode;
1796
1807
  }
1797
1808
  //#endregion
1798
1809
  //#region ../../src/core/providers/ReactBrowserProvider.d.ts
1799
- declare const envSchema$1: alepha60.TObject<{
1800
- REACT_ROOT_ID: alepha60.TString;
1810
+ declare const envSchema$1: alepha48.TObject<{
1811
+ REACT_ROOT_ID: alepha48.TString;
1801
1812
  }>;
1802
1813
  declare module "alepha" {
1803
1814
  interface Env extends Partial<Static<typeof envSchema$1>> {}
@@ -1805,8 +1816,8 @@ declare module "alepha" {
1805
1816
  /**
1806
1817
  * React browser renderer configuration atom
1807
1818
  */
1808
- declare const reactBrowserOptions: alepha60.Atom<alepha60.TObject<{
1809
- scrollRestoration: alepha60.TUnsafe<"top" | "manual">;
1819
+ declare const reactBrowserOptions: alepha48.Atom<alepha48.TObject<{
1820
+ scrollRestoration: alepha48.TUnsafe<"top" | "manual">;
1810
1821
  }>, "alepha.react.browser.options">;
1811
1822
  type ReactBrowserRendererOptions = Static<typeof reactBrowserOptions.schema>;
1812
1823
  declare module "alepha" {
@@ -1854,8 +1865,8 @@ declare class ReactBrowserProvider {
1854
1865
  * Get embedded layers from the server.
1855
1866
  */
1856
1867
  protected getHydrationState(): ReactHydrationState | undefined;
1857
- protected readonly onTransitionEnd: alepha60.HookPrimitive<"react:transition:end">;
1858
- readonly ready: alepha60.HookPrimitive<"ready">;
1868
+ protected readonly onTransitionEnd: alepha48.HookPrimitive<"react:transition:end">;
1869
+ readonly ready: alepha48.HookPrimitive<"ready">;
1859
1870
  }
1860
1871
  interface RouterGoOptions {
1861
1872
  replace?: boolean;
@@ -1879,6 +1890,18 @@ interface RouterRenderOptions {
1879
1890
  meta?: Record<string, any>;
1880
1891
  }
1881
1892
  //#endregion
1893
+ //#region ../../src/core/contexts/AlephaProvider.d.ts
1894
+ interface AlephaProviderProps {
1895
+ children: ReactNode;
1896
+ onError: (error: Error) => ReactNode;
1897
+ onLoading: () => ReactNode;
1898
+ }
1899
+ /**
1900
+ * AlephaProvider component to initialize and provide Alepha instance to the app.
1901
+ * This isn't recommended for apps using alepha/react/router, as Router will handle this for you.
1902
+ */
1903
+ declare const AlephaProvider: (props: AlephaProviderProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element | null | undefined;
1904
+ //#endregion
1882
1905
  //#region ../../src/core/contexts/AlephaContext.d.ts
1883
1906
  declare const AlephaContext: react0.Context<Alepha | undefined>;
1884
1907
  //#endregion
@@ -2017,7 +2040,7 @@ interface UseActionOptions<Args extends any[] = any[], Result = any> {
2017
2040
  * The async action handler function.
2018
2041
  * Receives the action arguments plus an ActionContext as the last parameter.
2019
2042
  */
2020
- handler: (...args: [...Args, ActionContext]) => Promise<Result>;
2043
+ handler: (...args: [...Args, ActionContext]) => Async<Result>;
2021
2044
  /**
2022
2045
  * Custom error handler. If provided, prevents default error re-throw.
2023
2046
  */
@@ -2030,6 +2053,7 @@ interface UseActionOptions<Args extends any[] = any[], Result = any> {
2030
2053
  * Optional identifier for this action (useful for debugging/analytics)
2031
2054
  */
2032
2055
  id?: string;
2056
+ name?: string;
2033
2057
  /**
2034
2058
  * Debounce delay in milliseconds. If specified, the action will only execute
2035
2059
  * after the specified delay has passed since the last call. Useful for search inputs
@@ -2234,6 +2258,9 @@ interface ErrorViewerProps {
2234
2258
  error: Error;
2235
2259
  alepha: Alepha;
2236
2260
  }
2261
+ /**
2262
+ * Error viewer component that displays error details in development mode
2263
+ */
2237
2264
  declare const ErrorViewer: ({
2238
2265
  error,
2239
2266
  alepha
@@ -2261,6 +2288,7 @@ declare function NotFoundPage(props: {
2261
2288
  interface RouterLayerContextValue {
2262
2289
  index: number;
2263
2290
  path: string;
2291
+ onError: ErrorHandler;
2264
2292
  }
2265
2293
  declare const RouterLayerContext: react0.Context<RouterLayerContextValue | undefined>;
2266
2294
  //#endregion
@@ -2312,6 +2340,7 @@ declare class ReactRouter<T$1 extends object> {
2312
2340
  path?: string | undefined;
2313
2341
  schema?: PageConfigSchema | undefined;
2314
2342
  resolve?: ((context: PageResolve<PageConfigSchema, TPropsParentDefault>) => any) | undefined;
2343
+ props?: (() => Partial<any>) | undefined;
2315
2344
  component?: react0.FC<any> | undefined;
2316
2345
  lazy?: (() => Promise<{
2317
2346
  default: react0.FC<any>;
@@ -2384,7 +2413,7 @@ declare const useRouter: <T$1 extends object = any>() => ReactRouter<T$1>;
2384
2413
  //#region ../../src/core/hooks/useRouterState.d.ts
2385
2414
  declare const useRouterState: () => ReactRouterState;
2386
2415
  //#endregion
2387
- //#region ../../../alepha/src/server-static/primitives/$serve.d.ts
2416
+ //#region ../../../alepha/src/server/static/primitives/$serve.d.ts
2388
2417
  interface ServePrimitiveOptions {
2389
2418
  /**
2390
2419
  * Prefix for the served path.
@@ -2583,7 +2612,7 @@ declare class FileDetector {
2583
2612
  protected matchesSignature(buffer: Buffer, signature: (number | null)[]): boolean;
2584
2613
  }
2585
2614
  //#endregion
2586
- //#region ../../../alepha/src/server-static/providers/ServerStaticProvider.d.ts
2615
+ //#region ../../../alepha/src/server/static/providers/ServerStaticProvider.d.ts
2587
2616
  declare class ServerStaticProvider {
2588
2617
  protected readonly alepha: Alepha;
2589
2618
  protected readonly routerProvider: ServerRouterProvider;
@@ -2591,7 +2620,7 @@ declare class ServerStaticProvider {
2591
2620
  protected readonly fileDetector: FileDetector;
2592
2621
  protected readonly log: Logger;
2593
2622
  protected readonly directories: ServeDirectory[];
2594
- protected readonly configure: alepha60.HookPrimitive<"configure">;
2623
+ protected readonly configure: alepha48.HookPrimitive<"configure">;
2595
2624
  createStaticServer(options: ServePrimitiveOptions): Promise<void>;
2596
2625
  createFileHandler(filepath: string, options: ServePrimitiveOptions): Promise<ServerHandler>;
2597
2626
  protected getCacheFileTypes(): string[];
@@ -2607,25 +2636,25 @@ interface ServeDirectory {
2607
2636
  }
2608
2637
  //#endregion
2609
2638
  //#region ../../src/core/providers/ReactServerProvider.d.ts
2610
- declare const envSchema: alepha60.TObject<{
2611
- REACT_SSR_ENABLED: alepha60.TOptional<alepha60.TBoolean>;
2612
- REACT_ROOT_ID: alepha60.TString;
2613
- REACT_SERVER_TEMPLATE: alepha60.TOptional<alepha60.TString>;
2639
+ declare const envSchema: alepha48.TObject<{
2640
+ REACT_SSR_ENABLED: alepha48.TOptional<alepha48.TBoolean>;
2641
+ REACT_ROOT_ID: alepha48.TString;
2614
2642
  }>;
2615
2643
  declare module "alepha" {
2616
2644
  interface Env extends Partial<Static<typeof envSchema>> {}
2617
2645
  interface State {
2618
2646
  "alepha.react.server.ssr"?: boolean;
2647
+ "alepha.react.server.template"?: string;
2619
2648
  }
2620
2649
  }
2621
2650
  /**
2622
2651
  * React server provider configuration atom
2623
2652
  */
2624
- declare const reactServerOptions: alepha60.Atom<alepha60.TObject<{
2625
- publicDir: alepha60.TString;
2626
- staticServer: alepha60.TObject<{
2627
- disabled: alepha60.TBoolean;
2628
- path: alepha60.TString;
2653
+ declare const reactServerOptions: alepha48.Atom<alepha48.TObject<{
2654
+ publicDir: alepha48.TString;
2655
+ staticServer: alepha48.TObject<{
2656
+ disabled: alepha48.TBoolean;
2657
+ path: alepha48.TString;
2629
2658
  }>;
2630
2659
  }>, "alepha.react.server.options">;
2631
2660
  type ReactServerProviderOptions = Static<typeof reactServerOptions.schema>;
@@ -2639,7 +2668,6 @@ declare class ReactServerProvider {
2639
2668
  protected readonly alepha: Alepha;
2640
2669
  protected readonly env: {
2641
2670
  REACT_SSR_ENABLED?: boolean | undefined;
2642
- REACT_SERVER_TEMPLATE?: string | undefined;
2643
2671
  REACT_ROOT_ID: string;
2644
2672
  };
2645
2673
  protected readonly pageApi: ReactPageProvider;
@@ -2659,7 +2687,7 @@ declare class ReactServerProvider {
2659
2687
  /**
2660
2688
  * Configure the React server provider.
2661
2689
  */
2662
- readonly onConfigure: alepha60.HookPrimitive<"configure">;
2690
+ readonly onConfigure: alepha48.HookPrimitive<"configure">;
2663
2691
  get template(): string;
2664
2692
  protected registerPages(templateLoader: TemplateLoader): Promise<void>;
2665
2693
  /**
@@ -2795,7 +2823,7 @@ declare module "alepha" {
2795
2823
  * @see {@link $page}
2796
2824
  * @module alepha.react
2797
2825
  */
2798
- declare const AlephaReact: alepha60.Service<alepha60.Module>;
2826
+ declare const AlephaReact: alepha48.Service<alepha48.Module>;
2799
2827
  //#endregion
2800
- export { $page, ActionContext, AlephaContext, AlephaReact, AnchorProps, ClientOnly, ConcretePageRoute, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, type LinkProps, _default as NestedView, NotFoundPage as NotFound, PageAnimation, PageConfigSchema, PagePrimitive, PagePrimitiveOptions, PagePrimitiveRenderOptions, PagePrimitiveRenderResult, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactRouter, ReactRouterState, ReactServerProvider, ReactServerProviderOptions, Redirection, RouterGoOptions, RouterLayerContext, RouterLayerContextValue, RouterRenderOptions, RouterStackItem, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActionOptions, UseActionReturn, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, UseSchemaReturn, UseStoreReturn, VirtualRouter, isPageRoute, reactBrowserOptions, reactServerOptions, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
2828
+ export { $page, ActionContext, AlephaContext, AlephaProvider, AlephaProviderProps, AlephaReact, AnchorProps, ClientOnly, ConcretePageRoute, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, type LinkProps, _default as NestedView, NotFoundPage as NotFound, PageAnimation, PageConfigSchema, PagePrimitive, PagePrimitiveOptions, PagePrimitiveRenderOptions, PagePrimitiveRenderResult, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactRouter, ReactRouterState, ReactServerProvider, ReactServerProviderOptions, Redirection, RouterGoOptions, RouterLayerContext, RouterLayerContextValue, RouterRenderOptions, RouterStackItem, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActionOptions, UseActionReturn, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, UseSchemaReturn, UseStoreReturn, VirtualRouter, isPageRoute, reactBrowserOptions, reactServerOptions, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
2801
2829
  //# sourceMappingURL=index.d.ts.map