@alepha/react 0.13.7 → 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.
@@ -1,4 +1,4 @@
1
- import * as alepha44 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: alepha44.TObject<{
14
- error: alepha44.TString;
15
- status: alepha44.TInteger;
16
- message: alepha44.TString;
17
- details: alepha44.TOptional<alepha44.TString>;
18
- requestId: alepha44.TOptional<alepha44.TString>;
19
- cause: alepha44.TOptional<alepha44.TObject<{
20
- name: alepha44.TString;
21
- message: alepha44.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: alepha44.TObject<{
261
- level: alepha44.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
262
- message: alepha44.TString;
263
- service: alepha44.TString;
264
- module: alepha44.TString;
265
- context: alepha44.TOptional<alepha44.TString>;
266
- app: alepha44.TOptional<alepha44.TString>;
267
- data: alepha44.TOptional<alepha44.TAny>;
268
- timestamp: alepha44.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: alepha44.HookPrimitive<"start">;
284
- protected readonly onStop: alepha44.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: alepha44.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: alepha44.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: alepha44.TOptional<alepha44.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
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: alepha44.TOptional<alepha44.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: alepha44.HookPrimitive<"server:onRequest">;
478
- readonly onResponse: alepha44.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: alepha44.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: alepha44.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: alepha44.TObject<{
882
- SERVER_PORT: alepha44.TInteger;
883
- SERVER_HOST: alepha44.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: alepha44.TObject<{
891
- SERVER_PORT: alepha44.TInteger;
892
- SERVER_HOST: alepha44.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: alepha44.TObject<{
1081
- REACT_STRICT_MODE: alepha44.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>> {}
@@ -1120,7 +1120,7 @@ declare class ReactPageProvider {
1120
1120
  }, params?: Record<string, any>): string;
1121
1121
  compile(path: string, params?: Record<string, string>): string;
1122
1122
  protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
1123
- protected readonly configure: alepha44.HookPrimitive<"configure">;
1123
+ protected readonly configure: alepha48.HookPrimitive<"configure">;
1124
1124
  protected map(pages: Array<PagePrimitive>, target: PagePrimitive): PageRouteEntry;
1125
1125
  add(entry: PageRouteEntry): void;
1126
1126
  protected createMatch(page: PageRoute): string;
@@ -1551,15 +1551,15 @@ type CssAnimation = {
1551
1551
  };
1552
1552
  //#endregion
1553
1553
  //#region ../../../alepha/src/security/schemas/userAccountInfoSchema.d.ts
1554
- declare const userAccountInfoSchema: alepha44.TObject<{
1555
- id: alepha44.TString;
1556
- name: alepha44.TOptional<alepha44.TString>;
1557
- email: alepha44.TOptional<alepha44.TString>;
1558
- username: alepha44.TOptional<alepha44.TString>;
1559
- picture: alepha44.TOptional<alepha44.TString>;
1560
- sessionId: alepha44.TOptional<alepha44.TString>;
1561
- organizations: alepha44.TOptional<alepha44.TArray<alepha44.TString>>;
1562
- roles: alepha44.TOptional<alepha44.TArray<alepha44.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>>;
1563
1563
  }>;
1564
1564
  type UserAccount = Static<typeof userAccountInfoSchema>;
1565
1565
  //#endregion
@@ -1585,8 +1585,8 @@ interface UserAccountToken extends UserAccount {
1585
1585
  }
1586
1586
  //#endregion
1587
1587
  //#region ../../../alepha/src/security/providers/SecurityProvider.d.ts
1588
- declare const envSchema$2: alepha44.TObject<{
1589
- APP_SECRET: alepha44.TString;
1588
+ declare const envSchema$2: alepha48.TObject<{
1589
+ APP_SECRET: alepha48.TString;
1590
1590
  }>;
1591
1591
  declare module "alepha" {
1592
1592
  interface Env extends Partial<Static<typeof envSchema$2>> {}
@@ -1614,19 +1614,19 @@ declare module "alepha" {
1614
1614
  * @module alepha.security
1615
1615
  */
1616
1616
  //#endregion
1617
- //#region ../../../alepha/src/server-security/providers/ServerBasicAuthProvider.d.ts
1617
+ //#region ../../../alepha/src/server/security/providers/ServerBasicAuthProvider.d.ts
1618
1618
  interface BasicAuthOptions {
1619
1619
  username: string;
1620
1620
  password: string;
1621
1621
  }
1622
1622
  //#endregion
1623
- //#region ../../../alepha/src/server-security/providers/ServerSecurityProvider.d.ts
1623
+ //#region ../../../alepha/src/server/security/providers/ServerSecurityProvider.d.ts
1624
1624
  type ServerRouteSecure = {
1625
1625
  realm?: string;
1626
1626
  basic?: BasicAuthOptions;
1627
1627
  };
1628
1628
  //#endregion
1629
- //#region ../../../alepha/src/server-security/index.d.ts
1629
+ //#region ../../../alepha/src/server/security/index.d.ts
1630
1630
  declare module "alepha" {
1631
1631
  interface State {
1632
1632
  /**
@@ -1678,30 +1678,30 @@ declare module "alepha/server" {
1678
1678
  * @module alepha.server.security
1679
1679
  */
1680
1680
  //#endregion
1681
- //#region ../../../alepha/src/server-links/schemas/apiLinksResponseSchema.d.ts
1682
- declare const apiLinkSchema: alepha44.TObject<{
1683
- name: alepha44.TString;
1684
- group: alepha44.TOptional<alepha44.TString>;
1685
- path: alepha44.TString;
1686
- method: alepha44.TOptional<alepha44.TString>;
1687
- requestBodyType: alepha44.TOptional<alepha44.TString>;
1688
- service: alepha44.TOptional<alepha44.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>;
1689
1689
  }>;
1690
- declare const apiLinksResponseSchema: alepha44.TObject<{
1691
- prefix: alepha44.TOptional<alepha44.TString>;
1692
- links: alepha44.TArray<alepha44.TObject<{
1693
- name: alepha44.TString;
1694
- group: alepha44.TOptional<alepha44.TString>;
1695
- path: alepha44.TString;
1696
- method: alepha44.TOptional<alepha44.TString>;
1697
- requestBodyType: alepha44.TOptional<alepha44.TString>;
1698
- service: alepha44.TOptional<alepha44.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>;
1699
1699
  }>>;
1700
1700
  }>;
1701
1701
  type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
1702
1702
  type ApiLink = Static<typeof apiLinkSchema>;
1703
1703
  //#endregion
1704
- //#region ../../../alepha/src/server-links/providers/LinkProvider.d.ts
1704
+ //#region ../../../alepha/src/server/links/providers/LinkProvider.d.ts
1705
1705
  /**
1706
1706
  * Browser, SSR friendly, service to handle links.
1707
1707
  */
@@ -1768,7 +1768,7 @@ interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<ActionPrim
1768
1768
  can: () => boolean;
1769
1769
  }
1770
1770
  //#endregion
1771
- //#region ../../../alepha/src/server-links/index.d.ts
1771
+ //#region ../../../alepha/src/server/links/index.d.ts
1772
1772
  declare module "alepha" {
1773
1773
  interface State {
1774
1774
  /**
@@ -1801,14 +1801,14 @@ declare class ReactBrowserRouterProvider extends RouterProvider<BrowserRoute> {
1801
1801
  protected readonly alepha: Alepha;
1802
1802
  protected readonly pageApi: ReactPageProvider;
1803
1803
  add(entry: PageRouteEntry): void;
1804
- protected readonly configure: alepha44.HookPrimitive<"configure">;
1804
+ protected readonly configure: alepha48.HookPrimitive<"configure">;
1805
1805
  transition(url: URL, previous?: PreviousLayerData[], meta?: {}): Promise<string | void>;
1806
1806
  root(state: ReactRouterState): ReactNode;
1807
1807
  }
1808
1808
  //#endregion
1809
1809
  //#region ../../src/core/providers/ReactBrowserProvider.d.ts
1810
- declare const envSchema$1: alepha44.TObject<{
1811
- REACT_ROOT_ID: alepha44.TString;
1810
+ declare const envSchema$1: alepha48.TObject<{
1811
+ REACT_ROOT_ID: alepha48.TString;
1812
1812
  }>;
1813
1813
  declare module "alepha" {
1814
1814
  interface Env extends Partial<Static<typeof envSchema$1>> {}
@@ -1816,8 +1816,8 @@ declare module "alepha" {
1816
1816
  /**
1817
1817
  * React browser renderer configuration atom
1818
1818
  */
1819
- declare const reactBrowserOptions: alepha44.Atom<alepha44.TObject<{
1820
- scrollRestoration: alepha44.TUnsafe<"top" | "manual">;
1819
+ declare const reactBrowserOptions: alepha48.Atom<alepha48.TObject<{
1820
+ scrollRestoration: alepha48.TUnsafe<"top" | "manual">;
1821
1821
  }>, "alepha.react.browser.options">;
1822
1822
  type ReactBrowserRendererOptions = Static<typeof reactBrowserOptions.schema>;
1823
1823
  declare module "alepha" {
@@ -1865,8 +1865,8 @@ declare class ReactBrowserProvider {
1865
1865
  * Get embedded layers from the server.
1866
1866
  */
1867
1867
  protected getHydrationState(): ReactHydrationState | undefined;
1868
- protected readonly onTransitionEnd: alepha44.HookPrimitive<"react:transition:end">;
1869
- readonly ready: alepha44.HookPrimitive<"ready">;
1868
+ protected readonly onTransitionEnd: alepha48.HookPrimitive<"react:transition:end">;
1869
+ readonly ready: alepha48.HookPrimitive<"ready">;
1870
1870
  }
1871
1871
  interface RouterGoOptions {
1872
1872
  replace?: boolean;
@@ -1890,6 +1890,18 @@ interface RouterRenderOptions {
1890
1890
  meta?: Record<string, any>;
1891
1891
  }
1892
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
1893
1905
  //#region ../../src/core/contexts/AlephaContext.d.ts
1894
1906
  declare const AlephaContext: react0.Context<Alepha | undefined>;
1895
1907
  //#endregion
@@ -2401,7 +2413,7 @@ declare const useRouter: <T$1 extends object = any>() => ReactRouter<T$1>;
2401
2413
  //#region ../../src/core/hooks/useRouterState.d.ts
2402
2414
  declare const useRouterState: () => ReactRouterState;
2403
2415
  //#endregion
2404
- //#region ../../../alepha/src/server-static/primitives/$serve.d.ts
2416
+ //#region ../../../alepha/src/server/static/primitives/$serve.d.ts
2405
2417
  interface ServePrimitiveOptions {
2406
2418
  /**
2407
2419
  * Prefix for the served path.
@@ -2600,7 +2612,7 @@ declare class FileDetector {
2600
2612
  protected matchesSignature(buffer: Buffer, signature: (number | null)[]): boolean;
2601
2613
  }
2602
2614
  //#endregion
2603
- //#region ../../../alepha/src/server-static/providers/ServerStaticProvider.d.ts
2615
+ //#region ../../../alepha/src/server/static/providers/ServerStaticProvider.d.ts
2604
2616
  declare class ServerStaticProvider {
2605
2617
  protected readonly alepha: Alepha;
2606
2618
  protected readonly routerProvider: ServerRouterProvider;
@@ -2608,7 +2620,7 @@ declare class ServerStaticProvider {
2608
2620
  protected readonly fileDetector: FileDetector;
2609
2621
  protected readonly log: Logger;
2610
2622
  protected readonly directories: ServeDirectory[];
2611
- protected readonly configure: alepha44.HookPrimitive<"configure">;
2623
+ protected readonly configure: alepha48.HookPrimitive<"configure">;
2612
2624
  createStaticServer(options: ServePrimitiveOptions): Promise<void>;
2613
2625
  createFileHandler(filepath: string, options: ServePrimitiveOptions): Promise<ServerHandler>;
2614
2626
  protected getCacheFileTypes(): string[];
@@ -2624,9 +2636,9 @@ interface ServeDirectory {
2624
2636
  }
2625
2637
  //#endregion
2626
2638
  //#region ../../src/core/providers/ReactServerProvider.d.ts
2627
- declare const envSchema: alepha44.TObject<{
2628
- REACT_SSR_ENABLED: alepha44.TOptional<alepha44.TBoolean>;
2629
- REACT_ROOT_ID: alepha44.TString;
2639
+ declare const envSchema: alepha48.TObject<{
2640
+ REACT_SSR_ENABLED: alepha48.TOptional<alepha48.TBoolean>;
2641
+ REACT_ROOT_ID: alepha48.TString;
2630
2642
  }>;
2631
2643
  declare module "alepha" {
2632
2644
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -2638,11 +2650,11 @@ declare module "alepha" {
2638
2650
  /**
2639
2651
  * React server provider configuration atom
2640
2652
  */
2641
- declare const reactServerOptions: alepha44.Atom<alepha44.TObject<{
2642
- publicDir: alepha44.TString;
2643
- staticServer: alepha44.TObject<{
2644
- disabled: alepha44.TBoolean;
2645
- path: alepha44.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;
2646
2658
  }>;
2647
2659
  }>, "alepha.react.server.options">;
2648
2660
  type ReactServerProviderOptions = Static<typeof reactServerOptions.schema>;
@@ -2675,7 +2687,7 @@ declare class ReactServerProvider {
2675
2687
  /**
2676
2688
  * Configure the React server provider.
2677
2689
  */
2678
- readonly onConfigure: alepha44.HookPrimitive<"configure">;
2690
+ readonly onConfigure: alepha48.HookPrimitive<"configure">;
2679
2691
  get template(): string;
2680
2692
  protected registerPages(templateLoader: TemplateLoader): Promise<void>;
2681
2693
  /**
@@ -2811,7 +2823,7 @@ declare module "alepha" {
2811
2823
  * @see {@link $page}
2812
2824
  * @module alepha.react
2813
2825
  */
2814
- declare const AlephaReact: alepha44.Service<alepha44.Module>;
2826
+ declare const AlephaReact: alepha48.Service<alepha48.Module>;
2815
2827
  //#endregion
2816
- 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 };
2817
2829
  //# sourceMappingURL=index.d.ts.map
@@ -1884,6 +1884,27 @@ var ReactRouter = class {
1884
1884
  }
1885
1885
  };
1886
1886
 
1887
+ //#endregion
1888
+ //#region ../../src/core/contexts/AlephaProvider.tsx
1889
+ /**
1890
+ * AlephaProvider component to initialize and provide Alepha instance to the app.
1891
+ * This isn't recommended for apps using alepha/react/router, as Router will handle this for you.
1892
+ */
1893
+ const AlephaProvider = (props) => {
1894
+ const alepha = useMemo(() => Alepha.create(), []);
1895
+ const [started, setStarted] = useState(false);
1896
+ const [error, setError] = useState();
1897
+ useEffect(() => {
1898
+ alepha.start().then(() => setStarted(true)).catch((err) => setError(err));
1899
+ }, [alepha]);
1900
+ if (error) return props.onError(error);
1901
+ if (!started) return props.onLoading();
1902
+ return /* @__PURE__ */ jsx(AlephaContext.Provider, {
1903
+ value: alepha,
1904
+ children: props.children
1905
+ });
1906
+ };
1907
+
1887
1908
  //#endregion
1888
1909
  //#region ../../src/core/hooks/useInject.ts
1889
1910
  /**
@@ -2296,5 +2317,5 @@ const AlephaReact = $module({
2296
2317
  });
2297
2318
 
2298
2319
  //#endregion
2299
- export { $page, AlephaContext, AlephaReact, ClientOnly_default as ClientOnly, ErrorBoundary_default as ErrorBoundary, ErrorViewer_default as ErrorViewer, Link_default as Link, NestedView_default as NestedView, NotFoundPage as NotFound, PagePrimitive, ReactBrowserProvider, ReactPageProvider, ReactRouter, ReactServerProvider, Redirection, RouterLayerContext, isPageRoute, reactBrowserOptions, reactServerOptions, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
2320
+ export { $page, AlephaContext, AlephaProvider, AlephaReact, ClientOnly_default as ClientOnly, ErrorBoundary_default as ErrorBoundary, ErrorViewer_default as ErrorViewer, Link_default as Link, NestedView_default as NestedView, NotFoundPage as NotFound, PagePrimitive, ReactBrowserProvider, ReactPageProvider, ReactRouter, ReactServerProvider, Redirection, RouterLayerContext, isPageRoute, reactBrowserOptions, reactServerOptions, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
2300
2321
  //# sourceMappingURL=index.js.map