alepha 0.10.6 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/server/cache.d.ts CHANGED
@@ -11,20 +11,12 @@ declare module "alepha/server" {
11
11
  interface ServerRoute {
12
12
  /**
13
13
  * Enable caching for this route.
14
- * If set to true, a default cache configuration will be applied (5 minutes TTL).
15
- * If a DurationLike is provided, it will be used as the TTL for the cache.
14
+ * - If true: enables both store and etag
15
+ * - If object: fine-grained control over store, etag, and cache-control headers
16
16
  *
17
17
  * @default false
18
18
  */
19
19
  cache?: ServerRouteCache;
20
- /**
21
- * Enable ETag support for this route.
22
- * If set to true, the server will generate and manage ETags automatically.
23
- * If a string is provided, it will be used as a static ETag value.
24
- *
25
- * @default false
26
- */
27
- etag?: boolean | string;
28
20
  }
29
21
  interface ActionDescriptor<TConfig extends RequestConfigSchema> {
30
22
  invalidate: () => Promise<void>;
@@ -42,9 +34,92 @@ declare class ServerCacheProvider {
42
34
  protected readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
43
35
  protected readonly onSend: _alepha_core1.HookDescriptor<"server:onSend">;
44
36
  protected readonly onResponse: _alepha_core1.HookDescriptor<"server:onResponse">;
37
+ buildCacheControlHeader(cache?: ServerRouteCache): string | undefined;
38
+ protected durationToSeconds(duration: number | DurationLike): number;
39
+ protected shouldStore(cache?: ServerRouteCache): boolean;
40
+ protected shouldUseEtag(cache?: ServerRouteCache): boolean;
45
41
  protected createCacheKey(route: ServerRoute, config?: ServerRequest): string;
46
42
  }
47
- type ServerRouteCache = boolean | DurationLike | Omit<CacheDescriptorOptions<any>, "handler" | "key">;
43
+ type ServerRouteCache =
44
+ /**
45
+ * If true, enables caching with:
46
+ * - store: true
47
+ * - etag: true
48
+ */
49
+ boolean
50
+ /**
51
+ * Object configuration for fine-grained cache control.
52
+ *
53
+ * If empty, no caching will be applied.
54
+ */ | {
55
+ /**
56
+ * If true, enables storing cached responses. (in-memory, Redis, @see @alepha/cache for other providers)
57
+ * If a DurationLike is provided, it will be used as the TTL for the cache.
58
+ * If CacheDescriptorOptions is provided, it will be used to configure the cache storage.
59
+ *
60
+ * @default false
61
+ */
62
+ store?: true | DurationLike | CacheDescriptorOptions;
63
+ /**
64
+ * If true, enables ETag support for the cached responses.
65
+ */
66
+ etag?: true;
67
+ /**
68
+ * - If true, sets Cache-Control to "public, max-age=300" (5 minutes).
69
+ * - If string, sets Cache-Control to the provided value directly.
70
+ * - If object, configures Cache-Control directives.
71
+ */
72
+ control?: true
73
+ /**
74
+ * If string, sets Cache-Control to the provided value directly.
75
+ */ | string
76
+ /**
77
+ * If object, configures Cache-Control directives.
78
+ */ | {
79
+ /**
80
+ * Indicates that the response may be cached by any cache.
81
+ */
82
+ public?: boolean;
83
+ /**
84
+ * Indicates that the response is intended for a single user and must not be stored by a shared cache.
85
+ */
86
+ private?: boolean;
87
+ /**
88
+ * Forces caches to submit the request to the origin server for validation before releasing a cached copy.
89
+ */
90
+ noCache?: boolean;
91
+ /**
92
+ * Instructs caches not to store the response.
93
+ */
94
+ noStore?: boolean;
95
+ /**
96
+ * Maximum amount of time a resource is considered fresh.
97
+ * Can be specified as a number (seconds) or as a DurationLike object.
98
+ *
99
+ * @example 300 // 5 minutes in seconds
100
+ * @example { minutes: 5 } // 5 minutes
101
+ * @example { hours: 1 } // 1 hour
102
+ */
103
+ maxAge?: number | DurationLike;
104
+ /**
105
+ * Overrides max-age for shared caches (e.g., CDNs).
106
+ * Can be specified as a number (seconds) or as a DurationLike object.
107
+ */
108
+ sMaxAge?: number | DurationLike;
109
+ /**
110
+ * Indicates that once a resource becomes stale, caches must not use it without successful validation.
111
+ */
112
+ mustRevalidate?: boolean;
113
+ /**
114
+ * Similar to must-revalidate, but only for shared caches.
115
+ */
116
+ proxyRevalidate?: boolean;
117
+ /**
118
+ * Indicates that the response can be stored but must be revalidated before each use.
119
+ */
120
+ immutable?: boolean;
121
+ };
122
+ };
48
123
  interface RouteCacheEntry {
49
124
  contentType?: string;
50
125
  body: any;
@@ -45,9 +45,9 @@ declare const $cookie: {
45
45
  <T extends TSchema>(options: CookieDescriptorOptions<T>): AbstractCookieDescriptor<T>;
46
46
  [KIND]: typeof CookieDescriptor;
47
47
  };
48
- interface CookieDescriptorOptions<T extends TSchema> {
48
+ interface CookieDescriptorOptions<T$1 extends TSchema> {
49
49
  /** The schema for the cookie's value, used for validation and type safety. */
50
- schema: T;
50
+ schema: T$1;
51
51
  /** The name of the cookie. */
52
52
  name?: string;
53
53
  /** The cookie's path. Defaults to "/". */
@@ -69,28 +69,28 @@ interface CookieDescriptorOptions<T extends TSchema> {
69
69
  /** If true, the cookie will be signed to prevent tampering. Requires `COOKIE_SECRET` env var. */
70
70
  sign?: boolean;
71
71
  }
72
- interface AbstractCookieDescriptor<T extends TSchema> {
72
+ interface AbstractCookieDescriptor<T$1 extends TSchema> {
73
73
  readonly name: string;
74
- readonly options: CookieDescriptorOptions<T>;
75
- set(value: Static<T>, options?: {
74
+ readonly options: CookieDescriptorOptions<T$1>;
75
+ set(value: Static<T$1>, options?: {
76
76
  cookies?: Cookies;
77
77
  ttl?: DurationLike;
78
78
  }): void;
79
79
  get(options?: {
80
80
  cookies?: Cookies;
81
- }): Static<T> | undefined;
81
+ }): Static<T$1> | undefined;
82
82
  del(options?: {
83
83
  cookies?: Cookies;
84
84
  }): void;
85
85
  }
86
- declare class CookieDescriptor<T extends TSchema> extends Descriptor<CookieDescriptorOptions<T>> implements AbstractCookieDescriptor<T> {
86
+ declare class CookieDescriptor<T$1 extends TSchema> extends Descriptor<CookieDescriptorOptions<T$1>> implements AbstractCookieDescriptor<T$1> {
87
87
  protected readonly serverCookiesProvider: ServerCookiesProvider;
88
- get schema(): T;
88
+ get schema(): T$1;
89
89
  get name(): string;
90
90
  /**
91
91
  * Sets the cookie with the given value in the current request's response.
92
92
  */
93
- set(value: Static<T>, options?: {
93
+ set(value: Static<T$1>, options?: {
94
94
  cookies?: Cookies;
95
95
  ttl?: DurationLike;
96
96
  }): void;
@@ -99,7 +99,7 @@ declare class CookieDescriptor<T extends TSchema> extends Descriptor<CookieDescr
99
99
  */
100
100
  get(options?: {
101
101
  cookies?: Cookies;
102
- }): Static<T> | undefined;
102
+ }): Static<T$1> | undefined;
103
103
  /**
104
104
  * Deletes the cookie in the current request's response.
105
105
  */
package/server/links.d.ts CHANGED
@@ -93,9 +93,9 @@ interface ClientScope {
93
93
  service?: string;
94
94
  hostname?: string;
95
95
  }
96
- type HttpVirtualClient<T> = { [K in keyof T as T[K] extends ActionDescriptor<RequestConfigSchema> ? K : never]: T[K] extends ActionDescriptor<infer Schema> ? VirtualAction<Schema> : never };
97
- interface VirtualAction<T extends RequestConfigSchema> extends Pick<ActionDescriptor<T>, "name" | "run" | "fetch"> {
98
- (config?: ClientRequestEntry<T>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T>>;
96
+ type HttpVirtualClient<T$1> = { [K in keyof T$1 as T$1[K] extends ActionDescriptor<RequestConfigSchema> ? K : never]: T$1[K] extends ActionDescriptor<infer Schema> ? VirtualAction<Schema> : never };
97
+ interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<ActionDescriptor<T$1>, "name" | "run" | "fetch"> {
98
+ (config?: ClientRequestEntry<T$1>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T$1>>;
99
99
  can: () => boolean;
100
100
  }
101
101
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import "alepha/server/security";
2
2
  import * as _alepha_core1 from "alepha";
3
3
  import { Alepha, Descriptor, KIND, TObject } from "alepha";
4
- import { ActionDescriptor, RequestConfigSchema, ServerRouterProvider } from "alepha/server";
4
+ import { ActionDescriptor, RequestConfigSchema, ServerProvider, ServerRouterProvider } from "alepha/server";
5
5
  import * as _alepha_logger0 from "alepha/logger";
6
6
  import { ServerStaticProvider } from "alepha/server/static";
7
7
  import { OpenAPIV3 } from "openapi-types";
@@ -99,6 +99,7 @@ declare class SwaggerDescriptor extends Descriptor<SwaggerDescriptorOptions> {}
99
99
  declare class ServerSwaggerProvider {
100
100
  protected readonly serverStaticProvider: ServerStaticProvider;
101
101
  protected readonly serverRouterProvider: ServerRouterProvider;
102
+ protected readonly serverProvider: ServerProvider;
102
103
  protected readonly alepha: Alepha;
103
104
  protected readonly log: _alepha_logger0.Logger;
104
105
  json?: OpenAPIV3.Document;
package/server.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as _alepha_core1 from "alepha";
1
+ import * as _alepha_core11 from "alepha";
2
2
  import { Alepha, AlephaError, Async, Descriptor, FileLike, KIND, Static, StreamLike, TArray, TFile, TObject, TRecord, TSchema, TStream, TString, TVoid } from "alepha";
3
- import * as _alepha_logger0 from "alepha/logger";
3
+ import * as _alepha_logger3 from "alepha/logger";
4
4
  import { Readable } from "node:stream";
5
5
  import { ReadableStream } from "node:stream/web";
6
6
  import { Route, RouterProvider } from "alepha/router";
@@ -68,14 +68,14 @@ interface RequestConfigSchema {
68
68
  headers?: TObject;
69
69
  response?: TResponseBody;
70
70
  }
71
- interface ServerRequestConfig<TConfig extends RequestConfigSchema = RequestConfigSchema> {
72
- body: TConfig["body"] extends TRequestBody ? Static<TConfig["body"]> : any;
73
- headers: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : Record<string, string>;
74
- params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : Record<string, string>;
75
- query: TConfig["query"] extends TObject ? Static<TConfig["query"]> : Record<string, any>;
71
+ interface ServerRequestConfig<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> {
72
+ body: TConfig$1["body"] extends TRequestBody ? Static<TConfig$1["body"]> : any;
73
+ headers: TConfig$1["headers"] extends TObject ? Static<TConfig$1["headers"]> : Record<string, string>;
74
+ params: TConfig$1["params"] extends TObject ? Static<TConfig$1["params"]> : Record<string, string>;
75
+ query: TConfig$1["query"] extends TObject ? Static<TConfig$1["query"]> : Record<string, any>;
76
76
  }
77
- type ServerRequestConfigEntry<TConfig extends RequestConfigSchema = RequestConfigSchema> = Partial<ServerRequestConfig<TConfig>>;
78
- interface ServerRequest<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRequestConfig<TConfig> {
77
+ type ServerRequestConfigEntry<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> = Partial<ServerRequestConfig<TConfig$1>>;
78
+ interface ServerRequest<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> extends ServerRequestConfig<TConfig$1> {
79
79
  method: RouteMethod;
80
80
  url: URL;
81
81
  requestId: string;
@@ -120,19 +120,19 @@ interface ServerRequest<TConfig extends RequestConfigSchema = RequestConfigSchem
120
120
  };
121
121
  };
122
122
  }
123
- interface ServerRoute<TConfig extends RequestConfigSchema = RequestConfigSchema> extends Route {
124
- handler: ServerHandler<TConfig>;
123
+ interface ServerRoute<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> extends Route {
124
+ handler: ServerHandler<TConfig$1>;
125
125
  method?: RouteMethod;
126
- schema?: TConfig;
126
+ schema?: TConfig$1;
127
127
  /**
128
128
  * @see ServerLoggerProvider
129
129
  */
130
130
  silent?: boolean;
131
131
  }
132
- type ServerResponseBody<TConfig extends RequestConfigSchema = RequestConfigSchema> = TConfig["response"] extends TResponseBody ? Static<TConfig["response"]> : ResponseBodyType;
132
+ type ServerResponseBody<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> = TConfig$1["response"] extends TResponseBody ? Static<TConfig$1["response"]> : ResponseBodyType;
133
133
  type ResponseKind = "json" | "text" | "void" | "file" | "any";
134
134
  type ResponseBodyType = string | Buffer | StreamLike | undefined | null | void;
135
- type ServerHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
135
+ type ServerHandler<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig$1>) => Async<ServerResponseBody<TConfig$1>>;
136
136
  interface ServerResponse {
137
137
  body: string | Buffer | ArrayBuffer | Readable | ReadableStream;
138
138
  headers: Record<string, string>;
@@ -153,6 +153,10 @@ interface ServerRawRequest {
153
153
  req: IncomingMessage;
154
154
  res: ServerResponse$1;
155
155
  };
156
+ web?: {
157
+ req: Request;
158
+ res?: Response;
159
+ };
156
160
  };
157
161
  }
158
162
  //#endregion
@@ -161,6 +165,12 @@ declare abstract class ServerProvider {
161
165
  protected readonly alepha: Alepha;
162
166
  abstract get hostname(): string;
163
167
  protected isViteNotFound(url?: string, route?: Route, params?: Record<string, string>): boolean;
168
+ protected createRouterRequest(req: {
169
+ method?: string;
170
+ url?: string;
171
+ headers?: Record<string, string | string[] | undefined>;
172
+ }, params?: Record<string, string>): ServerRawRequest;
173
+ protected getProtocol(headers: Record<string, string>): "http" | "https";
164
174
  }
165
175
  //#endregion
166
176
  //#region src/services/ServerRequestParser.d.ts
@@ -176,13 +186,14 @@ declare class ServerRequestParser {
176
186
  //#region src/providers/ServerTimingProvider.d.ts
177
187
  type TimingMap = Record<string, [number, number]>;
178
188
  declare class ServerTimingProvider {
179
- protected readonly log: _alepha_logger0.Logger;
189
+ protected readonly log: _alepha_logger3.Logger;
180
190
  protected readonly alepha: Alepha;
181
191
  options: {
192
+ prefix: string;
182
193
  disabled: boolean;
183
194
  };
184
- readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
185
- readonly onResponse: _alepha_core1.HookDescriptor<"server:onResponse">;
195
+ readonly onRequest: _alepha_core11.HookDescriptor<"server:onRequest">;
196
+ readonly onResponse: _alepha_core11.HookDescriptor<"server:onResponse">;
186
197
  protected get handlerName(): string;
187
198
  beginTiming(name: string): void;
188
199
  endTiming(name: string): void;
@@ -222,7 +233,7 @@ declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
222
233
  //#endregion
223
234
  //#region src/services/HttpClient.d.ts
224
235
  declare class HttpClient {
225
- protected readonly log: _alepha_logger0.Logger;
236
+ protected readonly log: _alepha_logger3.Logger;
226
237
  protected readonly alepha: Alepha;
227
238
  readonly cache: _alepha_cache0.CacheDescriptorFn<HttpClientCache, any[]>;
228
239
  protected readonly pendingRequests: HttpClientPendingRequests;
@@ -260,8 +271,8 @@ interface FetchOptions {
260
271
  */
261
272
  cache?: boolean | number | DurationLike;
262
273
  }
263
- interface FetchResponse<T = any> {
264
- data: T;
274
+ interface FetchResponse<T$1 = any> {
275
+ data: T$1;
265
276
  status: number;
266
277
  statusText: string;
267
278
  headers: Headers;
@@ -474,7 +485,7 @@ declare const $action: {
474
485
  <TConfig extends RequestConfigSchema>(options: ActionDescriptorOptions<TConfig>): ActionDescriptorFn<TConfig>;
475
486
  [KIND]: typeof ActionDescriptor;
476
487
  };
477
- interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
488
+ interface ActionDescriptorOptions<TConfig$1 extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
478
489
  /**
479
490
  * Name of the action.
480
491
  *
@@ -525,7 +536,7 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends O
525
536
  * - query: The request query-params schema.
526
537
  * - response: The response schema.
527
538
  */
528
- schema?: TConfig;
539
+ schema?: TConfig$1;
529
540
  /**
530
541
  * A short description of the action. Used for documentation purposes.
531
542
  */
@@ -538,10 +549,10 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends O
538
549
  /**
539
550
  * Main route handler. This is where the route logic is implemented.
540
551
  */
541
- handler: ServerActionHandler<TConfig>;
552
+ handler: ServerActionHandler<TConfig$1>;
542
553
  }
543
- declare class ActionDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<ActionDescriptorOptions<TConfig>> {
544
- protected readonly log: _alepha_logger0.Logger;
554
+ declare class ActionDescriptor<TConfig$1 extends RequestConfigSchema> extends Descriptor<ActionDescriptorOptions<TConfig$1>> {
555
+ protected readonly log: _alepha_logger3.Logger;
545
556
  protected readonly env: {
546
557
  SERVER_API_PREFIX: string;
547
558
  };
@@ -569,27 +580,27 @@ declare class ActionDescriptor<TConfig extends RequestConfigSchema> extends Desc
569
580
  * Path is prefixed by `/api` by default.
570
581
  */
571
582
  get path(): string;
572
- get schema(): TConfig | undefined;
583
+ get schema(): TConfig$1 | undefined;
573
584
  getBodyContentType(): string | undefined;
574
585
  /**
575
586
  * Call the action handler directly.
576
587
  * There is no HTTP layer involved.
577
588
  */
578
- run(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
589
+ run(config?: ClientRequestEntry<TConfig$1>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig$1>>;
579
590
  /**
580
591
  * Works like `run`, but always fetches (http request) the route.
581
592
  */
582
- fetch(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<FetchResponse<ClientRequestResponse<TConfig>>>;
593
+ fetch(config?: ClientRequestEntry<TConfig$1>, options?: ClientRequestOptions): Promise<FetchResponse<ClientRequestResponse<TConfig$1>>>;
583
594
  }
584
- interface ActionDescriptorFn<TConfig extends RequestConfigSchema> extends ActionDescriptor<TConfig> {
585
- (config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
595
+ interface ActionDescriptorFn<TConfig$1 extends RequestConfigSchema> extends ActionDescriptor<TConfig$1> {
596
+ (config?: ClientRequestEntry<TConfig$1>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig$1>>;
586
597
  }
587
- type ClientRequestEntry<TConfig extends RequestConfigSchema, T = ClientRequestEntryContainer<TConfig>> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K] };
588
- type ClientRequestEntryContainer<TConfig extends RequestConfigSchema> = {
589
- body: TConfig["body"] extends TObject ? Static<TConfig["body"]> : undefined;
590
- params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : undefined;
591
- headers?: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : undefined;
592
- query?: TConfig["query"] extends TObject ? Partial<Static<TConfig["query"]>> : undefined;
598
+ type ClientRequestEntry<TConfig$1 extends RequestConfigSchema, T$1 = ClientRequestEntryContainer<TConfig$1>> = { [K in keyof T$1 as T$1[K] extends undefined ? never : K]: T$1[K] };
599
+ type ClientRequestEntryContainer<TConfig$1 extends RequestConfigSchema> = {
600
+ body: TConfig$1["body"] extends TObject ? Static<TConfig$1["body"]> : undefined;
601
+ params: TConfig$1["params"] extends TObject ? Static<TConfig$1["params"]> : undefined;
602
+ headers?: TConfig$1["headers"] extends TObject ? Static<TConfig$1["headers"]> : undefined;
603
+ query?: TConfig$1["query"] extends TObject ? Partial<Static<TConfig$1["query"]>> : undefined;
593
604
  };
594
605
  interface ClientRequestOptions extends FetchOptions {
595
606
  /**
@@ -597,11 +608,11 @@ interface ClientRequestOptions extends FetchOptions {
597
608
  */
598
609
  request?: RequestInit;
599
610
  }
600
- type ClientRequestResponse<TConfig extends RequestConfigSchema> = TConfig["response"] extends TSchema ? Static<TConfig["response"]> : any;
611
+ type ClientRequestResponse<TConfig$1 extends RequestConfigSchema> = TConfig$1["response"] extends TSchema ? Static<TConfig$1["response"]> : any;
601
612
  /**
602
613
  * Specific handler for server actions.
603
614
  */
604
- type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerActionRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
615
+ type ServerActionHandler<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> = (request: ServerActionRequest<TConfig$1>) => Async<ServerResponseBody<TConfig$1>>;
605
616
  /**
606
617
  * Server Action Request Interface
607
618
  *
@@ -609,7 +620,7 @@ type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSche
609
620
  *
610
621
  * This is NOT Server Request, but a specific type for actions.
611
622
  */
612
- interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
623
+ interface ServerActionRequest<TConfig$1 extends RequestConfigSchema> extends ServerRequest<TConfig$1> {}
613
624
  //#endregion
614
625
  //#region src/schemas/errorSchema.d.ts
615
626
  declare const errorSchema: typebox0.TObject<{
@@ -659,8 +670,8 @@ declare const $route: {
659
670
  <TConfig extends RequestConfigSchema>(options: RouteDescriptorOptions<TConfig>): RouteDescriptor<TConfig>;
660
671
  [KIND]: typeof RouteDescriptor;
661
672
  };
662
- interface RouteDescriptorOptions<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRoute<TConfig> {}
663
- declare class RouteDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<RouteDescriptorOptions<TConfig>> {
673
+ interface RouteDescriptorOptions<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> extends ServerRoute<TConfig$1> {}
674
+ declare class RouteDescriptor<TConfig$1 extends RequestConfigSchema> extends Descriptor<RouteDescriptorOptions<TConfig$1>> {
664
675
  protected readonly serverRouterProvider: ServerRouterProvider;
665
676
  protected onInit(): void;
666
677
  }
@@ -713,9 +724,9 @@ declare const okSchema: typebox0.TObject<{
713
724
  type Ok = Static<typeof okSchema>;
714
725
  //#endregion
715
726
  //#region src/providers/NodeHttpServerProvider.d.ts
716
- declare const envSchema: _alepha_core1.TObject<{
717
- SERVER_PORT: _alepha_core1.TInteger;
718
- SERVER_HOST: _alepha_core1.TString;
727
+ declare const envSchema: _alepha_core11.TObject<{
728
+ SERVER_PORT: _alepha_core11.TInteger;
729
+ SERVER_HOST: _alepha_core11.TString;
719
730
  }>;
720
731
  declare module "alepha" {
721
732
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -723,31 +734,29 @@ declare module "alepha" {
723
734
  declare class NodeHttpServerProvider extends ServerProvider {
724
735
  protected readonly alepha: Alepha;
725
736
  protected readonly dateTimeProvider: DateTimeProvider;
726
- protected readonly log: _alepha_logger0.Logger;
737
+ protected readonly log: _alepha_logger3.Logger;
727
738
  protected readonly env: {
728
739
  SERVER_PORT: number;
729
740
  SERVER_HOST: string;
730
741
  };
731
742
  protected readonly router: ServerRouterProvider;
732
743
  protected readonly server: http0.Server<typeof IncomingMessage, typeof ServerResponse$1>;
733
- protected readonly onNodeRequest: _alepha_core1.HookDescriptor<"node:request">;
744
+ protected readonly onNodeRequest: _alepha_core11.HookDescriptor<"node:request">;
734
745
  handle(req: IncomingMessage, res: ServerResponse$1): Promise<void>;
735
- createRouterRequest(req: IncomingMessage, res: ServerResponse$1, params?: Record<string, string>): ServerRawRequest;
736
- getProtocol(req: IncomingMessage): "http" | "https";
737
746
  get hostname(): string;
738
- readonly start: _alepha_core1.HookDescriptor<"start">;
739
- protected readonly stop: _alepha_core1.HookDescriptor<"stop">;
747
+ readonly start: _alepha_core11.HookDescriptor<"start">;
748
+ protected readonly stop: _alepha_core11.HookDescriptor<"stop">;
740
749
  protected listen(): Promise<void>;
741
750
  protected close(): Promise<void>;
742
751
  }
743
752
  //#endregion
744
753
  //#region src/providers/ServerLoggerProvider.d.ts
745
754
  declare class ServerLoggerProvider {
746
- protected readonly log: _alepha_logger0.Logger;
755
+ protected readonly log: _alepha_logger3.Logger;
747
756
  protected readonly alepha: Alepha;
748
- readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
749
- readonly onError: _alepha_core1.HookDescriptor<"server:onError">;
750
- readonly onResponse: _alepha_core1.HookDescriptor<"server:onResponse">;
757
+ readonly onRequest: _alepha_core11.HookDescriptor<"server:onRequest">;
758
+ readonly onError: _alepha_core11.HookDescriptor<"server:onError">;
759
+ readonly onResponse: _alepha_core11.HookDescriptor<"server:onResponse">;
751
760
  }
752
761
  //#endregion
753
762
  //#region src/providers/ServerNotReadyProvider.d.ts
@@ -760,7 +769,7 @@ declare class ServerLoggerProvider {
760
769
  */
761
770
  declare class ServerNotReadyProvider {
762
771
  protected readonly alepha: Alepha;
763
- readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
772
+ readonly onRequest: _alepha_core11.HookDescriptor<"server:onRequest">;
764
773
  }
765
774
  //#endregion
766
775
  //#region src/index.d.ts
@@ -815,6 +824,10 @@ declare module "alepha" {
815
824
  req: IncomingMessage;
816
825
  res: ServerResponse$1;
817
826
  };
827
+ "web:request": {
828
+ req: Request;
829
+ res?: Response;
830
+ };
818
831
  }
819
832
  }
820
833
  /**
@@ -828,7 +841,7 @@ declare module "alepha" {
828
841
  * @see {@link $action}
829
842
  * @module alepha.server
830
843
  */
831
- declare const AlephaServer: _alepha_core1.Service<_alepha_core1.Module<{}>>;
844
+ declare const AlephaServer: _alepha_core11.Service<_alepha_core11.Module<{}>>;
832
845
  //#endregion
833
846
  export { $action, $route, ActionDescriptor, ActionDescriptorFn, ActionDescriptorOptions, AlephaServer, BadRequestError, ClientRequestEntry, ClientRequestEntryContainer, ClientRequestOptions, ClientRequestResponse, ConflictError, ErrorSchema, FetchActionArgs, FetchOptions, FetchResponse, ForbiddenError, HttpAction, HttpClient, HttpClientPendingRequests, HttpError, HttpErrorLike, NodeHttpServerProvider, NotFoundError, Ok, RequestConfigSchema, ResponseBodyType, ResponseKind, RouteDescriptor, RouteDescriptorOptions, RouteMethod, ServerActionHandler, ServerActionRequest, ServerHandler, ServerLoggerProvider, ServerNotReadyProvider, ServerProvider, ServerRawRequest, ServerReply, ServerRequest, ServerRequestConfig, ServerRequestConfigEntry, ServerResponse, ServerResponseBody, ServerRoute, ServerRouteMatcher, ServerRouteRequestHandler, ServerRouterProvider, ServerTimingProvider, TRequestBody, TResponseBody, UnauthorizedError, ValidationError, errorNameByStatus, errorSchema, isHttpError, isMultipart, okSchema, routeMethods };
834
847
  //# sourceMappingURL=index.d.ts.map
package/topic.d.ts CHANGED
@@ -220,7 +220,7 @@ declare const $topic: {
220
220
  <T extends TopicMessageSchema>(options: TopicDescriptorOptions<T>): TopicDescriptor<T>;
221
221
  [KIND]: typeof TopicDescriptor;
222
222
  };
223
- interface TopicDescriptorOptions<T extends TopicMessageSchema> {
223
+ interface TopicDescriptorOptions<T$1 extends TopicMessageSchema> {
224
224
  /**
225
225
  * Unique name identifier for the topic.
226
226
  *
@@ -329,7 +329,7 @@ interface TopicDescriptorOptions<T extends TopicMessageSchema> {
329
329
  * }
330
330
  * ```
331
331
  */
332
- schema: T;
332
+ schema: T$1;
333
333
  /**
334
334
  * Default subscriber handler function that processes messages published to this topic.
335
335
  *
@@ -393,32 +393,32 @@ interface TopicDescriptorOptions<T extends TopicMessageSchema> {
393
393
  * }
394
394
  * ```
395
395
  */
396
- handler?: TopicHandler<T>;
396
+ handler?: TopicHandler<T$1>;
397
397
  }
398
- declare class TopicDescriptor<T extends TopicMessageSchema> extends Descriptor<TopicDescriptorOptions<T>> {
398
+ declare class TopicDescriptor<T$1 extends TopicMessageSchema> extends Descriptor<TopicDescriptorOptions<T$1>> {
399
399
  protected readonly log: _alepha_logger0.Logger;
400
400
  protected readonly dateTimeProvider: DateTimeProvider;
401
401
  readonly provider: TopicProvider;
402
402
  get name(): string;
403
- publish(payload: TopicMessage<T>["payload"]): Promise<void>;
404
- subscribe(handler: TopicHandler<T>): Promise<UnSubscribeFn>;
405
- wait(options?: TopicWaitOptions<T>): Promise<TopicMessage<T>>;
403
+ publish(payload: TopicMessage<T$1>["payload"]): Promise<void>;
404
+ subscribe(handler: TopicHandler<T$1>): Promise<UnSubscribeFn>;
405
+ wait(options?: TopicWaitOptions<T$1>): Promise<TopicMessage<T$1>>;
406
406
  protected $provider(): TopicProvider;
407
- protected parseMessage(message: string): TopicMessage<T>;
407
+ protected parseMessage(message: string): TopicMessage<T$1>;
408
408
  }
409
- interface TopicMessage<T extends TopicMessageSchema> {
410
- payload: Static<T["payload"]>;
409
+ interface TopicMessage<T$1 extends TopicMessageSchema> {
410
+ payload: Static<T$1["payload"]>;
411
411
  }
412
- interface TopicWaitOptions<T extends TopicMessageSchema> {
412
+ interface TopicWaitOptions<T$1 extends TopicMessageSchema> {
413
413
  timeout?: DurationLike;
414
414
  filter?: (message: {
415
- payload: Static<T["payload"]>;
415
+ payload: Static<T$1["payload"]>;
416
416
  }) => boolean;
417
417
  }
418
418
  interface TopicMessageSchema {
419
419
  payload: TSchema;
420
420
  }
421
- type TopicHandler<T extends TopicMessageSchema = TopicMessageSchema> = (message: TopicMessage<T>) => unknown;
421
+ type TopicHandler<T$1 extends TopicMessageSchema = TopicMessageSchema> = (message: TopicMessage<T$1>) => unknown;
422
422
  //#endregion
423
423
  //#region src/descriptors/$subscriber.d.ts
424
424
  /**
@@ -636,7 +636,7 @@ declare const $subscriber: {
636
636
  <T extends TopicMessageSchema>(options: SubscriberDescriptorOptions<T>): SubscriberDescriptor<T>;
637
637
  [KIND]: typeof SubscriberDescriptor;
638
638
  };
639
- interface SubscriberDescriptorOptions<T extends TopicMessageSchema> {
639
+ interface SubscriberDescriptorOptions<T$1 extends TopicMessageSchema> {
640
640
  /**
641
641
  * The topic descriptor that this subscriber will listen to for messages.
642
642
  *
@@ -670,7 +670,7 @@ interface SubscriberDescriptorOptions<T extends TopicMessageSchema> {
670
670
  * });
671
671
  * ```
672
672
  */
673
- topic: TopicDescriptor<T>;
673
+ topic: TopicDescriptor<T$1>;
674
674
  /**
675
675
  * Message handler function that processes individual messages from the topic.
676
676
  *
@@ -765,9 +765,9 @@ interface SubscriberDescriptorOptions<T extends TopicMessageSchema> {
765
765
  * }
766
766
  * ```
767
767
  */
768
- handler: TopicHandler<T>;
768
+ handler: TopicHandler<T$1>;
769
769
  }
770
- declare class SubscriberDescriptor<T extends TopicMessageSchema> extends Descriptor<SubscriberDescriptorOptions<T>> {}
770
+ declare class SubscriberDescriptor<T$1 extends TopicMessageSchema> extends Descriptor<SubscriberDescriptorOptions<T$1>> {}
771
771
  //#endregion
772
772
  //#region src/errors/TopicTimeoutError.d.ts
773
773
  declare class TopicTimeoutError extends Error {
package/ui.cjs ADDED
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ var m = require('@alepha/ui');
3
+ Object.keys(m).forEach(function (k) {
4
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
+ enumerable: true,
6
+ get: function () { return m[k]; }
7
+ });
8
+ });