alepha 0.8.0 → 0.8.1

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.
@@ -3,6 +3,16 @@ import { DateTimeProvider, DurationLike } from "alepha/datetime";
3
3
 
4
4
  //#region src/descriptors/$cookie.d.ts
5
5
  declare const KEY = "COOKIE";
6
+ /**
7
+ * Declares a type-safe, configurable HTTP cookie.
8
+ * This descriptor provides methods to get, set, and delete the cookie
9
+ * within the server request/response cycle.
10
+ */
11
+ declare const $cookie: {
12
+ <T extends TSchema>(options: CookieDescriptorOptions<T>): CookieDescriptor<T>;
13
+ [KIND]: string;
14
+ };
15
+ // ---------------------------------------------------------------------------------------------------------------------
6
16
  interface CookieDescriptorOptions<T extends TSchema> {
7
17
  /** The schema for the cookie's value, used for validation and type safety. */
8
18
  schema: T;
@@ -44,16 +54,6 @@ interface CookieDescriptor<T extends TSchema> {
44
54
  cookies?: Cookies;
45
55
  }) => void;
46
56
  }
47
- /**
48
- * Declares a type-safe, configurable HTTP cookie.
49
- * This descriptor provides methods to get, set, and delete the cookie
50
- * within the server request/response cycle.
51
- */
52
- declare const $cookie: {
53
- <T extends TSchema>(options: CookieDescriptorOptions<T>): CookieDescriptor<T>;
54
- [KIND]: string;
55
- };
56
- // ---------------------------------------------------------------------------------------------------------------------
57
57
  interface Cookies {
58
58
  req: Record<string, string>;
59
59
  res: Record<string, Cookie | null>;
@@ -109,6 +109,183 @@ declare module "alepha/server" {
109
109
  cookies: Cookies;
110
110
  }
111
111
  }
112
+ /**
113
+ * Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie descriptors.
114
+ *
115
+ * The server-cookies module enables declarative cookie handling using the `$cookie` descriptor on class properties.
116
+ * It offers automatic cookie parsing, secure cookie configuration, and seamless integration with server routes
117
+ * for managing user sessions, preferences, and authentication tokens.
118
+ *
119
+ * **Key Features:**
120
+ * - Declarative cookie definition with `$cookie` descriptor
121
+ * - Automatic cookie parsing from requests
122
+ * - Secure cookie configuration (httpOnly, secure, sameSite)
123
+ * - Type-safe cookie values with schema validation
124
+ * - Automatic cookie serialization and deserialization
125
+ * - Integration with server request/response lifecycle
126
+ *
127
+ * **Basic Usage:**
128
+ * ```ts
129
+ * import { Alepha, run, t } from "alepha";
130
+ * import { AlephaServer, $route } from "alepha/server";
131
+ * import { AlephaServerCookies, $cookie } from "alepha/server/cookies";
132
+ *
133
+ * class AuthRoutes {
134
+ * // Define authentication cookie
135
+ * authToken = $cookie({
136
+ * name: "auth_token",
137
+ * httpOnly: true,
138
+ * secure: true,
139
+ * sameSite: "strict",
140
+ * maxAge: "7d",
141
+ * });
142
+ *
143
+ * // Define user preferences cookie
144
+ * userPrefs = $cookie({
145
+ * name: "user_prefs",
146
+ * schema: t.object({
147
+ * theme: t.union([t.literal("light"), t.literal("dark")]),
148
+ * language: t.string(),
149
+ * }),
150
+ * maxAge: "30d",
151
+ * });
152
+ *
153
+ * login = $route({
154
+ * path: "/login",
155
+ * method: "POST",
156
+ * schema: {
157
+ * body: t.object({
158
+ * email: t.string(),
159
+ * password: t.string(),
160
+ * }),
161
+ * },
162
+ * handler: async ({ body, reply }) => {
163
+ * const user = await authenticateUser(body.email, body.password);
164
+ * if (!user) {
165
+ * return new Response("Invalid credentials", { status: 401 });
166
+ * }
167
+ *
168
+ * const token = await generateJWT(user.id);
169
+ *
170
+ * // Set authentication cookie
171
+ * this.authToken.set(reply, token);
172
+ *
173
+ * return Response.json({ success: true, user });
174
+ * },
175
+ * });
176
+ *
177
+ * profile = $route({
178
+ * path: "/profile",
179
+ * method: "GET",
180
+ * handler: async ({ cookies }) => {
181
+ * // Get authentication token from cookie
182
+ * const token = this.authToken.get(cookies);
183
+ * if (!token) {
184
+ * return new Response("Unauthorized", { status: 401 });
185
+ * }
186
+ *
187
+ * const user = await validateJWT(token);
188
+ * const preferences = this.userPrefs.get(cookies) || {
189
+ * theme: "light",
190
+ * language: "en",
191
+ * };
192
+ *
193
+ * return Response.json({ user, preferences });
194
+ * },
195
+ * });
196
+ *
197
+ * logout = $route({
198
+ * path: "/logout",
199
+ * method: "POST",
200
+ * handler: async ({ reply }) => {
201
+ * // Clear authentication cookie
202
+ * this.authToken.clear(reply);
203
+ * return Response.json({ success: true });
204
+ * },
205
+ * });
206
+ * }
207
+ *
208
+ * const alepha = Alepha.create()
209
+ * .with(AlephaServer)
210
+ * .with(AlephaServerCookies)
211
+ * .with(AuthRoutes);
212
+ *
213
+ * run(alepha);
214
+ * ```
215
+ *
216
+ * **Advanced Cookie Management:**
217
+ * ```ts
218
+ * class SessionRoutes {
219
+ * // Session cookie with custom configuration
220
+ * sessionId = $cookie({
221
+ * name: "session_id",
222
+ * httpOnly: true,
223
+ * secure: process.env.NODE_ENV === "production",
224
+ * sameSite: "lax",
225
+ * path: "/",
226
+ * maxAge: "2h",
227
+ * encrypt: true, // Optional encryption
228
+ * });
229
+ *
230
+ * // Shopping cart cookie
231
+ * cart = $cookie({
232
+ * name: "shopping_cart",
233
+ * schema: t.object({
234
+ * items: t.array(t.object({
235
+ * id: t.string(),
236
+ * quantity: t.number(),
237
+ * })),
238
+ * total: t.number(),
239
+ * }),
240
+ * maxAge: "30d",
241
+ * });
242
+ *
243
+ * // Tracking consent cookie
244
+ * consent = $cookie({
245
+ * name: "tracking_consent",
246
+ * schema: t.object({
247
+ * analytics: t.boolean(),
248
+ * marketing: t.boolean(),
249
+ * functional: t.boolean(),
250
+ * }),
251
+ * maxAge: "1y",
252
+ * });
253
+ *
254
+ * updateCart = $route({
255
+ * path: "/cart",
256
+ * method: "POST",
257
+ * schema: {
258
+ * body: t.object({
259
+ * productId: t.string(),
260
+ * quantity: t.number(),
261
+ * }),
262
+ * },
263
+ * handler: async ({ body, cookies, reply }) => {
264
+ * const currentCart = this.cart.get(cookies) || { items: [], total: 0 };
265
+ *
266
+ * // Update cart logic
267
+ * const existingItem = currentCart.items.find(item => item.id === body.productId);
268
+ * if (existingItem) {
269
+ * existingItem.quantity = body.quantity;
270
+ * } else {
271
+ * currentCart.items.push({ id: body.productId, quantity: body.quantity });
272
+ * }
273
+ *
274
+ * // Recalculate total
275
+ * currentCart.total = await calculateCartTotal(currentCart.items);
276
+ *
277
+ * // Update cookie
278
+ * this.cart.set(reply, currentCart);
279
+ *
280
+ * return Response.json(currentCart);
281
+ * },
282
+ * });
283
+ * }
284
+ * ```
285
+ *
286
+ * @see {@link $cookie}
287
+ * @module alepha.server.cookies
288
+ */
112
289
  declare class AlephaServerCookies implements Module {
113
290
  readonly name = "alepha.server.cookies";
114
291
  readonly $services: (alepha: Alepha) => void;
@@ -25,9 +25,6 @@ declare class ServerHealthProvider {
25
25
  //#region src/index.d.ts
26
26
  // ---------------------------------------------------------------------------------------------------------------------
27
27
  /**
28
- * Alepha Server Health Module
29
- *
30
- * @description
31
28
  * Plugin for Alepha Server that provides health-check endpoints.
32
29
  *
33
30
  * @see {@link ServerHealthProvider}
@@ -55,8 +55,6 @@ declare class ServerHelmetProvider {
55
55
  //#region src/index.d.ts
56
56
  // ---------------------------------------------------------------------------------------------------------------------
57
57
  /**
58
- * Alepha Server Helmet Module
59
- *
60
58
  * Automatically adds important HTTP security headers to every response
61
59
  * to help protect your application from common web vulnerabilities.
62
60
  *
package/server/links.d.ts CHANGED
@@ -46,10 +46,26 @@ type HttpVirtualClient<T> = { [K in keyof T as T[K] extends ActionDescriptor ? K
46
46
  } : never };
47
47
  //#endregion
48
48
  //#region src/descriptors/$client.d.ts
49
+ /**
50
+ * Create a new client.
51
+ */
49
52
  declare const $client: <T extends object>(scope?: ClientScope) => HttpVirtualClient<T>;
50
53
  //#endregion
51
54
  //#region src/descriptors/$remote.d.ts
52
55
  declare const KEY = "REMOTE";
56
+ /**
57
+ * $remote is a descriptor that allows you to define remote service access.
58
+ *
59
+ * Use it only when you have 2 or more services that need to communicate with each other.
60
+ *
61
+ * All remote services can be exposed as actions, ... or not.
62
+ *
63
+ * You can add a service account if you want to use a security layer.
64
+ */
65
+ declare const $remote: {
66
+ (options: RemoteDescriptorOptions): RemoteDescriptor;
67
+ [KIND]: string;
68
+ };
53
69
  interface RemoteDescriptorOptions {
54
70
  /**
55
71
  * The URL of the remote service.
@@ -98,19 +114,6 @@ interface RemoteDescriptor {
98
114
  [KIND]: typeof KEY;
99
115
  [OPTIONS]: RemoteDescriptorOptions;
100
116
  }
101
- /**
102
- * $remote is a descriptor that allows you to define a remote service access.
103
- *
104
- * Use it only when you have 2 or more services that need to communicate with each other.
105
- *
106
- * All remote services can be exposed as actions, ... or not.
107
- *
108
- * You can add a service account if you want to use a security layer.
109
- */
110
- declare const $remote: {
111
- (options: RemoteDescriptorOptions): RemoteDescriptor;
112
- [KIND]: string;
113
- };
114
117
  //#endregion
115
118
  //#region src/providers/RemoteDescriptorProvider.d.ts
116
119
  declare class RemoteDescriptorProvider {
@@ -20,8 +20,6 @@ declare class ServerMetricsProvider {
20
20
  //#region src/index.d.ts
21
21
  // ---------------------------------------------------------------------------------------------------------------------
22
22
  /**
23
- * Alepha Server Metrics Module
24
- *
25
23
  * This module provides prometheus metrics for the Alepha server.
26
24
  * Metrics are exposed at the `/metrics` endpoint.
27
25
  *
@@ -31,8 +31,6 @@ interface HybridFile extends FileLike {
31
31
  //#region src/index.d.ts
32
32
  // ---------------------------------------------------------------------------------------------------------------------
33
33
  /**
34
- * Alepha Server Multipart Module
35
- *
36
34
  * This module provides support for handling multipart/form-data requests.
37
35
  * It allows to parse body data containing t.file().
38
36
  *
package/server/proxy.d.ts CHANGED
@@ -2,6 +2,10 @@ import { Alepha, Async, HookDescriptor, KIND, Logger, Module, OPTIONS } from "al
2
2
  import { ServerHandler, ServerRequest, ServerRouterProvider } from "alepha/server";
3
3
 
4
4
  //#region src/descriptors/$proxy.d.ts
5
+ declare const $proxy: {
6
+ (options: ProxyDescriptorOptions): ProxyDescriptor;
7
+ [KIND]: string;
8
+ };
5
9
  type ProxyDescriptorOptions = {
6
10
  path: string;
7
11
  target: string | (() => string);
@@ -14,10 +18,6 @@ interface ProxyDescriptor {
14
18
  [KIND]: "PROXY";
15
19
  [OPTIONS]: ProxyDescriptorOptions;
16
20
  }
17
- declare const $proxy: {
18
- (options: ProxyDescriptorOptions): ProxyDescriptor;
19
- [KIND]: string;
20
- };
21
21
  //#endregion
22
22
  //#region src/providers/ProxyDescriptorProvider.d.ts
23
23
  declare class ProxyDescriptorProvider {
@@ -4,6 +4,13 @@ import { DateTimeProvider, DurationLike } from "alepha/datetime";
4
4
 
5
5
  //#region src/descriptors/$serve.d.ts
6
6
  declare const KEY = "SERVE";
7
+ /**
8
+ * Create a new static file handler.
9
+ */
10
+ declare const $serve: {
11
+ (options?: ServeDescriptorOptions): ServeDescriptor;
12
+ [KIND]: string;
13
+ };
7
14
  interface ServeDescriptorOptions {
8
15
  /**
9
16
  * Prefix for the served path.
@@ -79,10 +86,6 @@ interface ServeDescriptor {
79
86
  [OPTIONS]: ServeDescriptorOptions;
80
87
  list(): string[];
81
88
  }
82
- declare const $serve: {
83
- (options?: ServeDescriptorOptions): ServeDescriptor;
84
- [KIND]: string;
85
- };
86
89
  //#endregion
87
90
  //#region src/providers/ServerStaticProvider.d.ts
88
91
  declare class ServerStaticProvider {
@@ -110,7 +113,7 @@ interface ServeDirectory {
110
113
  //#region src/index.d.ts
111
114
  // ---------------------------------------------------------------------------------------------------------------------
112
115
  /**
113
- * Alepha Server Static Module
116
+ * Create static file server with `$static()`.
114
117
  *
115
118
  * @see {@link ServerStaticProvider}
116
119
  * @module alepha.server.static
@@ -4,6 +4,13 @@ import { ServerStaticProvider } from "alepha/server/static";
4
4
  import { OpenAPIV3 } from "openapi-types";
5
5
 
6
6
  //#region src/descriptors/$swagger.d.ts
7
+ /**
8
+ * Create a new OpenAPI.
9
+ */
10
+ declare const $swagger: {
11
+ (options: SwaggerDescriptorOptions): SwaggerDescriptor;
12
+ [KIND]: string;
13
+ };
7
14
  interface SwaggerDescriptorOptions {
8
15
  info: OpenAPIV3.InfoObject;
9
16
  /**
@@ -77,10 +84,6 @@ interface SwaggerDescriptor {
77
84
  [OPTIONS]: SwaggerDescriptorOptions;
78
85
  json(): OpenAPIV3.Document;
79
86
  }
80
- declare const $swagger: {
81
- (options: SwaggerDescriptorOptions): SwaggerDescriptor;
82
- [KIND]: string;
83
- };
84
87
  //#endregion
85
88
  //#region src/ServerSwaggerProvider.d.ts
86
89
  declare class ServerSwaggerProvider {
@@ -104,8 +107,6 @@ declare class ServerSwaggerProvider {
104
107
  //#region src/index.d.ts
105
108
  // ---------------------------------------------------------------------------------------------------------------------
106
109
  /**
107
- * Alepha Server Swagger Module
108
- *
109
110
  * Plugin for Alepha Server that provides Swagger documentation capabilities.
110
111
  * It generates OpenAPI v3 documentation for the server's endpoints ($action).
111
112
  * It also provides a Swagger UI for interactive API documentation.
package/server.d.ts CHANGED
@@ -205,6 +205,10 @@ interface HttpAction {
205
205
  //#endregion
206
206
  //#region src/descriptors/$action.d.ts
207
207
  declare const KEY$1 = "ACTION";
208
+ declare const $action: {
209
+ <TConfig extends RequestConfigSchema>(options: ActionDescriptorOptions<TConfig>): ActionDescriptor<TConfig>;
210
+ [KIND]: string;
211
+ };
208
212
  interface ActionDescriptorOptions<TConfig extends RequestConfigSchema = RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema"> {
209
213
  /**
210
214
  * Name the route.
@@ -286,10 +290,6 @@ interface ActionDescriptor<TConfig extends RequestConfigSchema = RequestConfigSc
286
290
  */
287
291
  permission: () => string;
288
292
  }
289
- declare const $action: {
290
- <TConfig extends RequestConfigSchema>(options: ActionDescriptorOptions<TConfig>): ActionDescriptor<TConfig>;
291
- [KIND]: string;
292
- };
293
293
  type ClientRequestEntry<TConfig extends RequestConfigSchema = RequestConfigSchema, T = ClientRequestEntryContainer<TConfig>> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K] };
294
294
  type ClientRequestEntryContainer<TConfig extends RequestConfigSchema = RequestConfigSchema> = {
295
295
  body: TConfig["body"] extends TSchema ? Static<TConfig["body"]> : undefined;
@@ -354,15 +354,15 @@ interface HttpErrorLike extends Error {
354
354
  //#endregion
355
355
  //#region src/descriptors/$route.d.ts
356
356
  declare const KEY = "ROUTE";
357
+ declare const $route: {
358
+ <TConfig extends RequestConfigSchema = RequestConfigSchema>(options: RouteDescriptorOptions<TConfig>): RouteDescriptor<TConfig>;
359
+ [KIND]: string;
360
+ };
357
361
  interface RouteDescriptorOptions<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRoute<TConfig> {}
358
362
  type RouteDescriptor<TConfig extends RequestConfigSchema = RequestConfigSchema> = {
359
363
  [KIND]: typeof KEY;
360
364
  [OPTIONS]: RouteDescriptorOptions<TConfig>;
361
365
  };
362
- declare const $route: {
363
- <TConfig extends RequestConfigSchema = RequestConfigSchema>(options: RouteDescriptorOptions<TConfig>): RouteDescriptor<TConfig>;
364
- [KIND]: string;
365
- };
366
366
  //#endregion
367
367
  //#region src/errors/BadRequestError.d.ts
368
368
  declare class BadRequestError extends HttpError {
@@ -679,6 +679,159 @@ declare module "alepha" {
679
679
  };
680
680
  }
681
681
  }
682
+ /**
683
+ * Provides high-performance HTTP server capabilities with declarative routing and action descriptors.
684
+ *
685
+ * The server module enables building REST APIs and web applications using `$route` and `$action` descriptors
686
+ * on class properties. It provides automatic request/response handling, schema validation, middleware support,
687
+ * and seamless integration with other Alepha modules for a complete backend solution.
688
+ *
689
+ * **Key Features:**
690
+ * - Declarative route definition with `$route` descriptor
691
+ * - API action handlers with `$action` descriptor
692
+ * - Schema validation for requests and responses
693
+ * - Automatic body parsing and response formatting
694
+ * - Built-in middleware system and error handling
695
+ * - Type-safe request parameters and response data
696
+ * - Integration with authentication and security modules
697
+ *
698
+ * **Basic Routing:**
699
+ * ```ts
700
+ * import { Alepha, run, t } from "alepha";
701
+ * import { AlephaServer, $route } from "alepha/server";
702
+ *
703
+ * class ApiRoutes {
704
+ * // Simple GET route
705
+ * getUsers = $route({
706
+ * path: "/api/users",
707
+ * method: "GET",
708
+ * handler: async () => {
709
+ * const users = await getAllUsers();
710
+ * return Response.json(users);
711
+ * },
712
+ * });
713
+ *
714
+ * // POST route with body validation
715
+ * createUser = $route({
716
+ * path: "/api/users",
717
+ * method: "POST",
718
+ * schema: {
719
+ * body: t.object({
720
+ * name: t.string(),
721
+ * email: t.string(),
722
+ * }),
723
+ * },
724
+ * handler: async ({ body }) => {
725
+ * const user = await createUser(body);
726
+ * return Response.json(user, { status: 201 });
727
+ * },
728
+ * });
729
+ *
730
+ * // Dynamic route with parameters
731
+ * getUserById = $route({
732
+ * path: "/api/users/:id",
733
+ * method: "GET",
734
+ * schema: {
735
+ * params: t.object({
736
+ * id: t.string(),
737
+ * }),
738
+ * },
739
+ * handler: async ({ params }) => {
740
+ * const user = await findUserById(params.id);
741
+ * if (!user) {
742
+ * return new Response("User not found", { status: 404 });
743
+ * }
744
+ * return Response.json(user);
745
+ * },
746
+ * });
747
+ * }
748
+ *
749
+ * const alepha = Alepha.create()
750
+ * .with(AlephaServer)
751
+ * .with(ApiRoutes);
752
+ *
753
+ * run(alepha);
754
+ * ```
755
+ *
756
+ * **Action Descriptors:**
757
+ * ```ts
758
+ * import { $action } from "alepha/server";
759
+ *
760
+ * class UserController {
761
+ * // Reusable business logic action
762
+ * getUserProfile = $action({
763
+ * schema: {
764
+ * params: t.object({
765
+ * userId: t.string(),
766
+ * }),
767
+ * response: t.object({
768
+ * id: t.string(),
769
+ * name: t.string(),
770
+ * email: t.string(),
771
+ * }),
772
+ * },
773
+ * handler: async ({ params }) => {
774
+ * const user = await getUserById(params.userId);
775
+ * return {
776
+ * id: user.id,
777
+ * name: user.name,
778
+ * email: user.email,
779
+ * };
780
+ * },
781
+ * });
782
+ *
783
+ * // Route that uses the action
784
+ * profileRoute = $route({
785
+ * path: "/api/profile/:userId",
786
+ * method: "GET",
787
+ * handler: async ({ params }) => {
788
+ * const profile = await this.getUserProfile({ params });
789
+ * return Response.json(profile);
790
+ * },
791
+ * });
792
+ * }
793
+ * ```
794
+ *
795
+ * **Middleware and Error Handling:**
796
+ * ```ts
797
+ * class AppServer {
798
+ * // Global middleware
799
+ * middleware = $route({
800
+ * path: "*",
801
+ * method: "*",
802
+ * handler: async ({ request, next }) => {
803
+ * console.log(`${request.method} ${request.url}`);
804
+ * try {
805
+ * return await next();
806
+ * } catch (error) {
807
+ * console.error("Request failed:", error);
808
+ * return Response.json({ error: "Internal Server Error" }, { status: 500 });
809
+ * }
810
+ * },
811
+ * });
812
+ *
813
+ * // CORS preflight handling
814
+ * corsPrelight = $route({
815
+ * path: "*",
816
+ * method: "OPTIONS",
817
+ * handler: async () => {
818
+ * return new Response(null, {
819
+ * status: 200,
820
+ * headers: {
821
+ * "Access-Control-Allow-Origin": "*",
822
+ * "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE",
823
+ * "Access-Control-Allow-Headers": "Content-Type, Authorization",
824
+ * },
825
+ * });
826
+ * },
827
+ * });
828
+ * }
829
+ * ```
830
+ *
831
+ * @see {@link $route}
832
+ * @see {@link $action}
833
+ * @module alepha.server
834
+ */
682
835
  declare class AlephaServer implements Module {
683
836
  readonly name = "alepha.server";
684
837
  readonly $services: (alepha: Alepha) => void;
package/topic/redis.d.ts CHANGED
@@ -30,8 +30,6 @@ declare class RedisTopicProvider implements TopicProvider {
30
30
  //#region src/index.d.ts
31
31
  // ---------------------------------------------------------------------------------------------------------------------
32
32
  /**
33
- * Alepha Topic Redis Module.
34
- *
35
33
  * Plugin for Alepha Topic that provides Redis pub/sub capabilities.
36
34
  *
37
35
  * @see {@link RedisTopicProvider}
package/topic.d.ts CHANGED
@@ -32,6 +32,13 @@ type UnSubscribeFn = () => Promise<void>;
32
32
  //#endregion
33
33
  //#region src/descriptors/$topic.d.ts
34
34
  declare const KEY$1 = "TOPIC";
35
+ /**
36
+ * Create a new topic.
37
+ */
38
+ declare const $topic: {
39
+ <T extends TopicMessageSchema>(options: TopicDescriptorOptions<T>): TopicDescriptor<T>;
40
+ [KIND]: string;
41
+ };
35
42
  interface TopicMessageSchema {
36
43
  headers?: TSchema;
37
44
  payload: TSchema;
@@ -63,13 +70,19 @@ interface TopicWaitOptions<T extends TopicMessageSchema> {
63
70
  payload: Static<T["payload"]>;
64
71
  }) => boolean;
65
72
  }
66
- declare const $topic: {
67
- <T extends TopicMessageSchema>(options: TopicDescriptorOptions<T>): TopicDescriptor<T>;
68
- [KIND]: string;
69
- };
70
73
  //#endregion
71
74
  //#region src/descriptors/$subscriber.d.ts
72
75
  declare const KEY = "SUBSCRIBER";
76
+ /**
77
+ * Subscriber descriptor.
78
+ *
79
+ * @param options - The subscriber options.
80
+ * @returns The descriptor value.
81
+ */
82
+ declare const $subscriber: {
83
+ <T extends TopicMessageSchema>(options: SubscriberDescriptorOptions<T>): SubscriberDescriptor<T>;
84
+ [KIND]: string;
85
+ };
73
86
  interface SubscriberDescriptorOptions<T extends TopicMessageSchema = TopicMessageSchema> {
74
87
  topic: TopicDescriptor<T>;
75
88
  handler: (message: {
@@ -81,16 +94,6 @@ interface SubscriberDescriptor<T extends TopicMessageSchema = TopicMessageSchema
81
94
  [OPTIONS]: SubscriberDescriptorOptions<T>;
82
95
  topic: () => TopicDescriptor<T>;
83
96
  }
84
- /**
85
- * Subscriber descriptor.
86
- *
87
- * @param options - The subscriber options.
88
- * @returns The descriptor value.
89
- */
90
- declare const $subscriber: {
91
- <T extends TopicMessageSchema>(options: SubscriberDescriptorOptions<T>): SubscriberDescriptor<T>;
92
- [KIND]: string;
93
- };
94
97
  //#endregion
95
98
  //#region src/errors/TopicTimeoutError.d.ts
96
99
  declare class TopicTimeoutError extends Error {
@@ -196,8 +199,6 @@ declare class TopicDescriptorProvider {
196
199
  //#endregion
197
200
  //#region src/index.d.ts
198
201
  /**
199
- * Alepha Topic Module
200
- *
201
202
  * Generic interface for pub/sub messaging.
202
203
  * Gives you the ability to create topics and subscribers.
203
204
  * This module provides only a memory implementation of the topic provider.