alepha 0.15.0 → 0.15.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.
Files changed (222) hide show
  1. package/README.md +43 -98
  2. package/dist/api/audits/index.d.ts +240 -240
  3. package/dist/api/audits/index.d.ts.map +1 -1
  4. package/dist/api/audits/index.js +2 -2
  5. package/dist/api/audits/index.js.map +1 -1
  6. package/dist/api/files/index.d.ts +185 -185
  7. package/dist/api/files/index.d.ts.map +1 -1
  8. package/dist/api/files/index.js +2 -2
  9. package/dist/api/files/index.js.map +1 -1
  10. package/dist/api/jobs/index.d.ts +245 -245
  11. package/dist/api/jobs/index.d.ts.map +1 -1
  12. package/dist/api/notifications/index.browser.js +4 -4
  13. package/dist/api/notifications/index.browser.js.map +1 -1
  14. package/dist/api/notifications/index.d.ts +74 -74
  15. package/dist/api/notifications/index.d.ts.map +1 -1
  16. package/dist/api/notifications/index.js +4 -4
  17. package/dist/api/notifications/index.js.map +1 -1
  18. package/dist/api/parameters/index.d.ts +221 -221
  19. package/dist/api/parameters/index.d.ts.map +1 -1
  20. package/dist/api/users/index.d.ts +1632 -1631
  21. package/dist/api/users/index.d.ts.map +1 -1
  22. package/dist/api/users/index.js +26 -34
  23. package/dist/api/users/index.js.map +1 -1
  24. package/dist/api/verifications/index.d.ts +132 -132
  25. package/dist/api/verifications/index.d.ts.map +1 -1
  26. package/dist/batch/index.d.ts +122 -122
  27. package/dist/batch/index.d.ts.map +1 -1
  28. package/dist/bucket/index.d.ts +163 -163
  29. package/dist/bucket/index.d.ts.map +1 -1
  30. package/dist/cache/core/index.d.ts +46 -46
  31. package/dist/cache/core/index.d.ts.map +1 -1
  32. package/dist/cache/redis/index.d.ts.map +1 -1
  33. package/dist/cache/redis/index.js +2 -2
  34. package/dist/cache/redis/index.js.map +1 -1
  35. package/dist/cli/index.d.ts +5933 -201
  36. package/dist/cli/index.d.ts.map +1 -1
  37. package/dist/cli/index.js +609 -169
  38. package/dist/cli/index.js.map +1 -1
  39. package/dist/command/index.d.ts +296 -296
  40. package/dist/command/index.d.ts.map +1 -1
  41. package/dist/command/index.js +19 -19
  42. package/dist/command/index.js.map +1 -1
  43. package/dist/core/index.browser.js +268 -79
  44. package/dist/core/index.browser.js.map +1 -1
  45. package/dist/core/index.d.ts +768 -694
  46. package/dist/core/index.d.ts.map +1 -1
  47. package/dist/core/index.js +268 -79
  48. package/dist/core/index.js.map +1 -1
  49. package/dist/core/index.native.js +268 -79
  50. package/dist/core/index.native.js.map +1 -1
  51. package/dist/datetime/index.d.ts +44 -44
  52. package/dist/datetime/index.d.ts.map +1 -1
  53. package/dist/email/index.d.ts +25 -25
  54. package/dist/email/index.d.ts.map +1 -1
  55. package/dist/fake/index.d.ts +5409 -5409
  56. package/dist/fake/index.d.ts.map +1 -1
  57. package/dist/fake/index.js +22 -22
  58. package/dist/fake/index.js.map +1 -1
  59. package/dist/file/index.d.ts +435 -435
  60. package/dist/file/index.d.ts.map +1 -1
  61. package/dist/lock/core/index.d.ts +208 -208
  62. package/dist/lock/core/index.d.ts.map +1 -1
  63. package/dist/lock/redis/index.d.ts.map +1 -1
  64. package/dist/logger/index.d.ts +24 -24
  65. package/dist/logger/index.d.ts.map +1 -1
  66. package/dist/logger/index.js +1 -5
  67. package/dist/logger/index.js.map +1 -1
  68. package/dist/mcp/index.d.ts +216 -198
  69. package/dist/mcp/index.d.ts.map +1 -1
  70. package/dist/mcp/index.js +28 -4
  71. package/dist/mcp/index.js.map +1 -1
  72. package/dist/orm/index.browser.js +9 -9
  73. package/dist/orm/index.browser.js.map +1 -1
  74. package/dist/orm/index.bun.js +83 -76
  75. package/dist/orm/index.bun.js.map +1 -1
  76. package/dist/orm/index.d.ts +961 -960
  77. package/dist/orm/index.d.ts.map +1 -1
  78. package/dist/orm/index.js +88 -81
  79. package/dist/orm/index.js.map +1 -1
  80. package/dist/queue/core/index.d.ts +244 -244
  81. package/dist/queue/core/index.d.ts.map +1 -1
  82. package/dist/queue/redis/index.d.ts.map +1 -1
  83. package/dist/redis/index.d.ts +105 -105
  84. package/dist/redis/index.d.ts.map +1 -1
  85. package/dist/retry/index.d.ts +69 -69
  86. package/dist/retry/index.d.ts.map +1 -1
  87. package/dist/router/index.d.ts +6 -6
  88. package/dist/router/index.d.ts.map +1 -1
  89. package/dist/scheduler/index.d.ts +108 -26
  90. package/dist/scheduler/index.d.ts.map +1 -1
  91. package/dist/scheduler/index.js +393 -1
  92. package/dist/scheduler/index.js.map +1 -1
  93. package/dist/security/index.d.ts +532 -209
  94. package/dist/security/index.d.ts.map +1 -1
  95. package/dist/security/index.js +1422 -11
  96. package/dist/security/index.js.map +1 -1
  97. package/dist/server/auth/index.d.ts +1296 -271
  98. package/dist/server/auth/index.d.ts.map +1 -1
  99. package/dist/server/auth/index.js +1249 -18
  100. package/dist/server/auth/index.js.map +1 -1
  101. package/dist/server/cache/index.d.ts +56 -56
  102. package/dist/server/cache/index.d.ts.map +1 -1
  103. package/dist/server/compress/index.d.ts +3 -3
  104. package/dist/server/compress/index.d.ts.map +1 -1
  105. package/dist/server/cookies/index.d.ts +6 -6
  106. package/dist/server/cookies/index.d.ts.map +1 -1
  107. package/dist/server/core/index.d.ts +196 -186
  108. package/dist/server/core/index.d.ts.map +1 -1
  109. package/dist/server/core/index.js +43 -27
  110. package/dist/server/core/index.js.map +1 -1
  111. package/dist/server/cors/index.d.ts +11 -11
  112. package/dist/server/cors/index.d.ts.map +1 -1
  113. package/dist/server/health/index.d.ts.map +1 -1
  114. package/dist/server/helmet/index.d.ts +2 -2
  115. package/dist/server/helmet/index.d.ts.map +1 -1
  116. package/dist/server/links/index.browser.js +9 -1
  117. package/dist/server/links/index.browser.js.map +1 -1
  118. package/dist/server/links/index.d.ts +83 -83
  119. package/dist/server/links/index.d.ts.map +1 -1
  120. package/dist/server/links/index.js +13 -5
  121. package/dist/server/links/index.js.map +1 -1
  122. package/dist/server/metrics/index.d.ts +514 -1
  123. package/dist/server/metrics/index.d.ts.map +1 -1
  124. package/dist/server/metrics/index.js +4462 -4
  125. package/dist/server/metrics/index.js.map +1 -1
  126. package/dist/server/multipart/index.d.ts +6 -6
  127. package/dist/server/multipart/index.d.ts.map +1 -1
  128. package/dist/server/proxy/index.d.ts +102 -102
  129. package/dist/server/proxy/index.d.ts.map +1 -1
  130. package/dist/server/rate-limit/index.d.ts +16 -16
  131. package/dist/server/rate-limit/index.d.ts.map +1 -1
  132. package/dist/server/static/index.d.ts +44 -44
  133. package/dist/server/static/index.d.ts.map +1 -1
  134. package/dist/server/swagger/index.d.ts +47 -47
  135. package/dist/server/swagger/index.d.ts.map +1 -1
  136. package/dist/sms/index.d.ts +11 -11
  137. package/dist/sms/index.d.ts.map +1 -1
  138. package/dist/sms/index.js +3 -3
  139. package/dist/sms/index.js.map +1 -1
  140. package/dist/thread/index.d.ts +71 -71
  141. package/dist/thread/index.d.ts.map +1 -1
  142. package/dist/thread/index.js +2 -2
  143. package/dist/thread/index.js.map +1 -1
  144. package/dist/topic/core/index.d.ts +318 -318
  145. package/dist/topic/core/index.d.ts.map +1 -1
  146. package/dist/topic/redis/index.d.ts +6 -6
  147. package/dist/topic/redis/index.d.ts.map +1 -1
  148. package/dist/vite/index.d.ts +2324 -1719
  149. package/dist/vite/index.d.ts.map +1 -1
  150. package/dist/vite/index.js +123 -475
  151. package/dist/vite/index.js.map +1 -1
  152. package/dist/websocket/index.browser.js +3 -3
  153. package/dist/websocket/index.browser.js.map +1 -1
  154. package/dist/websocket/index.d.ts +275 -275
  155. package/dist/websocket/index.d.ts.map +1 -1
  156. package/dist/websocket/index.js +3 -3
  157. package/dist/websocket/index.js.map +1 -1
  158. package/package.json +9 -9
  159. package/src/api/users/services/SessionService.ts +0 -10
  160. package/src/cli/apps/AlephaCli.ts +2 -2
  161. package/src/cli/apps/AlephaPackageBuilderCli.ts +9 -1
  162. package/src/cli/assets/apiHelloControllerTs.ts +2 -1
  163. package/src/cli/assets/biomeJson.ts +2 -1
  164. package/src/cli/assets/claudeMd.ts +9 -4
  165. package/src/cli/assets/dummySpecTs.ts +2 -1
  166. package/src/cli/assets/editorconfig.ts +2 -1
  167. package/src/cli/assets/mainBrowserTs.ts +2 -1
  168. package/src/cli/assets/mainCss.ts +24 -0
  169. package/src/cli/assets/tsconfigJson.ts +2 -1
  170. package/src/cli/assets/webAppRouterTs.ts +2 -1
  171. package/src/cli/assets/webHelloComponentTsx.ts +6 -2
  172. package/src/cli/atoms/appEntryOptions.ts +13 -0
  173. package/src/cli/atoms/buildOptions.ts +1 -1
  174. package/src/cli/atoms/changelogOptions.ts +1 -1
  175. package/src/cli/commands/build.ts +63 -47
  176. package/src/cli/commands/dev.ts +16 -33
  177. package/src/cli/commands/gen/env.ts +1 -1
  178. package/src/cli/commands/init.ts +17 -8
  179. package/src/cli/commands/lint.ts +1 -1
  180. package/src/cli/defineConfig.ts +9 -0
  181. package/src/cli/index.ts +2 -1
  182. package/src/cli/providers/AppEntryProvider.ts +131 -0
  183. package/src/cli/providers/ViteBuildProvider.ts +82 -0
  184. package/src/cli/providers/ViteDevServerProvider.ts +350 -0
  185. package/src/cli/providers/ViteTemplateProvider.ts +27 -0
  186. package/src/cli/services/AlephaCliUtils.ts +33 -2
  187. package/src/cli/services/PackageManagerUtils.ts +13 -6
  188. package/src/cli/services/ProjectScaffolder.ts +72 -49
  189. package/src/core/Alepha.ts +2 -8
  190. package/src/core/primitives/$module.ts +12 -0
  191. package/src/core/providers/KeylessJsonSchemaCodec.spec.ts +257 -0
  192. package/src/core/providers/KeylessJsonSchemaCodec.ts +396 -14
  193. package/src/core/providers/SchemaValidator.spec.ts +236 -0
  194. package/src/logger/providers/PrettyFormatterProvider.ts +0 -9
  195. package/src/mcp/errors/McpError.ts +30 -0
  196. package/src/mcp/index.ts +3 -0
  197. package/src/mcp/transports/SseMcpTransport.ts +16 -6
  198. package/src/orm/providers/DrizzleKitProvider.ts +3 -5
  199. package/src/orm/services/Repository.ts +11 -0
  200. package/src/server/core/index.ts +1 -1
  201. package/src/server/core/providers/BunHttpServerProvider.ts +1 -1
  202. package/src/server/core/providers/NodeHttpServerProvider.spec.ts +125 -0
  203. package/src/server/core/providers/NodeHttpServerProvider.ts +71 -22
  204. package/src/server/core/providers/ServerLoggerProvider.ts +2 -2
  205. package/src/server/core/providers/ServerProvider.ts +9 -12
  206. package/src/server/links/atoms/apiLinksAtom.ts +7 -0
  207. package/src/server/links/index.browser.ts +2 -0
  208. package/src/server/links/index.ts +2 -0
  209. package/src/vite/index.ts +3 -2
  210. package/src/vite/tasks/buildClient.ts +0 -1
  211. package/src/vite/tasks/buildServer.ts +68 -21
  212. package/src/vite/tasks/copyAssets.ts +5 -4
  213. package/src/vite/tasks/generateSitemap.ts +64 -23
  214. package/src/vite/tasks/index.ts +0 -2
  215. package/src/vite/tasks/prerenderPages.ts +49 -24
  216. package/src/cli/assets/indexHtml.ts +0 -15
  217. package/src/cli/commands/format.ts +0 -23
  218. package/src/vite/helpers/boot.ts +0 -117
  219. package/src/vite/plugins/viteAlephaDev.ts +0 -177
  220. package/src/vite/tasks/devServer.ts +0 -71
  221. package/src/vite/tasks/runAlepha.ts +0 -270
  222. /package/dist/orm/{chunk-DtkW-qnP.js → chunk-DH6iiROE.js} +0 -0
@@ -1,7 +1,7 @@
1
- import * as alepha42 from "alepha";
1
+ import * as alepha6 from "alepha";
2
2
  import { Alepha, KIND, Primitive, Static, TObject, TString, TUnion } from "alepha";
3
3
  import * as alepha_topic0 from "alepha/topic";
4
- import * as alepha_logger2 from "alepha/logger";
4
+ import * as alepha_logger1 from "alepha/logger";
5
5
  import { WebSocket as WebSocket$1, WebSocketServer } from "ws";
6
6
  import { IncomingMessage } from "node:http";
7
7
 
@@ -33,32 +33,32 @@ type TWSObject = TObject | TUnion;
33
33
  */
34
34
  interface ChannelPrimitiveOptions<TClient extends TWSObject, TServer extends TWSObject> {
35
35
  /**
36
- * WebSocket endpoint path (e.g., "/ws/chat")
37
- */
36
+ * WebSocket endpoint path (e.g., "/ws/chat")
37
+ */
38
38
  path: string;
39
39
  /**
40
- * Optional description for documentation
41
- */
40
+ * Optional description for documentation
41
+ */
42
42
  description?: string;
43
43
  /**
44
- * Message schemas for bidirectional communication
45
- */
44
+ * Message schemas for bidirectional communication
45
+ */
46
46
  schema: {
47
47
  /**
48
- * Optional room ID schema validation
49
- * Default: t.text() (any string)
50
- * Can be enforced at application level: t.uuid(), t.regex(/^[a-f0-9\-]{36}$/)
51
- */
48
+ * Optional room ID schema validation
49
+ * Default: t.text() (any string)
50
+ * Can be enforced at application level: t.uuid(), t.regex(/^[a-f0-9\-]{36}$/)
51
+ */
52
52
  roomId?: TString;
53
53
  /**
54
- * Messages from server to client
55
- * This is what clients will receive
56
- */
54
+ * Messages from server to client
55
+ * This is what clients will receive
56
+ */
57
57
  in: TClient;
58
58
  /**
59
- * Messages from client to server
60
- * This is what the server will receive
61
- */
59
+ * Messages from client to server
60
+ * This is what the server will receive
61
+ */
62
62
  out: TServer;
63
63
  };
64
64
  }
@@ -136,32 +136,32 @@ declare class ChannelPrimitive<TClient extends TWSObject, TServer extends TWSObj
136
136
  */
137
137
  interface WebSocketConnection {
138
138
  /**
139
- * Unique connection ID
140
- */
139
+ * Unique connection ID
140
+ */
141
141
  id: string;
142
142
  /**
143
- * User ID (if authenticated and security module is used)
144
- */
143
+ * User ID (if authenticated and security module is used)
144
+ */
145
145
  userId?: string;
146
146
  /**
147
- * Room IDs that this connection is currently in
148
- */
147
+ * Room IDs that this connection is currently in
148
+ */
149
149
  roomIds: string[];
150
150
  /**
151
- * Send a message to this connection
152
- */
151
+ * Send a message to this connection
152
+ */
153
153
  send(message: any): Promise<void>;
154
154
  /**
155
- * Close this connection
156
- */
155
+ * Close this connection
156
+ */
157
157
  close(code?: number, reason?: string): Promise<void>;
158
158
  /**
159
- * Connection metadata (custom data)
160
- */
159
+ * Connection metadata (custom data)
160
+ */
161
161
  metadata?: Record<string, any>;
162
162
  /**
163
- * Connection state
164
- */
163
+ * Connection state
164
+ */
165
165
  readyState: WebSocketState;
166
166
  }
167
167
  /**
@@ -171,66 +171,66 @@ declare enum WebSocketState {
171
171
  CONNECTING = 0,
172
172
  OPEN = 1,
173
173
  CLOSING = 2,
174
- CLOSED = 3,
174
+ CLOSED = 3
175
175
  }
176
176
  /**
177
177
  * WebSocket endpoint configuration (server-side)
178
178
  */
179
179
  interface WebSocketPrimitiveOptions<TClient extends TWSObject, TServer extends TWSObject> {
180
180
  /**
181
- * Channel definition with schema and path
182
- */
181
+ * Channel definition with schema and path
182
+ */
183
183
  channel: ChannelPrimitive<TClient, TServer>;
184
184
  /**
185
- * Handler for incoming messages from clients
186
- */
185
+ * Handler for incoming messages from clients
186
+ */
187
187
  handler: WebSocketHandler<TClient, TServer>;
188
188
  /**
189
- * Optional connection handler (called when a client connects)
190
- */
189
+ * Optional connection handler (called when a client connects)
190
+ */
191
191
  onConnect?: (params: {
192
192
  /**
193
- * Unique connection ID of the client
194
- */
193
+ * Unique connection ID of the client
194
+ */
195
195
  connectionId: string;
196
196
  /**
197
- * User ID of the connected client (if authenticated and security module is used)
198
- */
197
+ * User ID of the connected client (if authenticated and security module is used)
198
+ */
199
199
  userId?: string;
200
200
  /**
201
- * Room IDs that the client is connecting to
202
- */
201
+ * Room IDs that the client is connecting to
202
+ */
203
203
  roomIds: string[];
204
204
  }) => Promise<void> | void;
205
205
  /**
206
- * Optional disconnection handler (called when a client disconnects)
207
- */
206
+ * Optional disconnection handler (called when a client disconnects)
207
+ */
208
208
  onDisconnect?: (params: {
209
209
  /**
210
- * Unique connection ID of the client
211
- */
210
+ * Unique connection ID of the client
211
+ */
212
212
  connectionId: string;
213
213
  /**
214
- * User ID of the connected client (if authenticated and security module is used)
215
- */
214
+ * User ID of the connected client (if authenticated and security module is used)
215
+ */
216
216
  userId?: string;
217
217
  /**
218
- * Room IDs that the client was connected to
219
- */
218
+ * Room IDs that the client was connected to
219
+ */
220
220
  roomIds: string[];
221
221
  }) => Promise<void> | void;
222
222
  /**
223
- * Change WebSocket server provider (for custom implementations)
224
- */
223
+ * Change WebSocket server provider (for custom implementations)
224
+ */
225
225
  provider?: any;
226
226
  /**
227
- * Whether to enforce security (authentication, authorization) on this WebSocket endpoint
228
- * Requires alepha/security integration
229
- */
227
+ * Whether to enforce security (authentication, authorization) on this WebSocket endpoint
228
+ * Requires alepha/security integration
229
+ */
230
230
  secure?: boolean;
231
231
  /**
232
- * Limit number of connections per user (if authenticated)
233
- */
232
+ * Limit number of connections per user (if authenticated)
233
+ */
234
234
  maxConnectionsPerUser?: number;
235
235
  }
236
236
  /**
@@ -242,46 +242,46 @@ type WebSocketHandler<TClient extends TWSObject, TServer extends TWSObject> = (c
242
242
  */
243
243
  interface WebSocketHandlerContext<TClient extends TWSObject, TServer extends TWSObject> {
244
244
  /**
245
- * Unique connection ID of the client
246
- */
245
+ * Unique connection ID of the client
246
+ */
247
247
  connectionId: string;
248
248
  /**
249
- * User ID of the connected client (if authenticated and security module is used)
250
- */
249
+ * User ID of the connected client (if authenticated and security module is used)
250
+ */
251
251
  userId?: string;
252
252
  /**
253
- * Room ID that the client sent the message from
254
- */
253
+ * Room ID that the client sent the message from
254
+ */
255
255
  roomId: string;
256
256
  /**
257
- * The parsed and validated message from the client
258
- */
257
+ * The parsed and validated message from the client
258
+ */
259
259
  message: Static<TServer>;
260
260
  /**
261
- * Reply function tailored to current context (connectionId, roomId)
262
- */
261
+ * Reply function tailored to current context (connectionId, roomId)
262
+ */
263
263
  reply: (options: {
264
264
  /**
265
- * Message to send
266
- */
265
+ * Message to send
266
+ */
267
267
  message: Static<TClient>;
268
268
  /**
269
- * Optional: specify room ID to send to (defaults to sender's room ID)
270
- */
269
+ * Optional: specify room ID to send to (defaults to sender's room ID)
270
+ */
271
271
  roomId?: string;
272
272
  /**
273
- * Optional: exclude the sender connection from receiving the message
274
- * Will populate exceptConnectionIds with sender connection ID behind the scenes
275
- */
273
+ * Optional: exclude the sender connection from receiving the message
274
+ * Will populate exceptConnectionIds with sender connection ID behind the scenes
275
+ */
276
276
  exceptSelf?: boolean;
277
277
  /**
278
- * Optional: exclude specific connection IDs from receiving the message
279
- */
278
+ * Optional: exclude specific connection IDs from receiving the message
279
+ */
280
280
  exceptConnectionIds?: string[];
281
281
  /**
282
- * Optional: exclude specific user IDs from receiving the message
283
- * Requires alepha/security integration
284
- */
282
+ * Optional: exclude specific user IDs from receiving the message
283
+ * Requires alepha/security integration
284
+ */
285
285
  exceptUserIds?: string[];
286
286
  }) => Promise<void>;
287
287
  }
@@ -290,41 +290,41 @@ interface WebSocketHandlerContext<TClient extends TWSObject, TServer extends TWS
290
290
  */
291
291
  interface EmitOptions<TClient extends TWSObject> {
292
292
  /**
293
- * Message to send to clients
294
- */
293
+ * Message to send to clients
294
+ */
295
295
  message: Static<TClient>;
296
296
  /**
297
- * Room ID to send the message to
298
- */
297
+ * Room ID to send the message to
298
+ */
299
299
  roomId?: string;
300
300
  /**
301
- * Room IDs to send the message to
302
- */
301
+ * Room IDs to send the message to
302
+ */
303
303
  roomIds?: string[];
304
304
  /**
305
- * User ID to send the message to (if authenticated)
306
- */
305
+ * User ID to send the message to (if authenticated)
306
+ */
307
307
  userId?: string;
308
308
  /**
309
- * User IDs to send the message to (if authenticated)
310
- */
309
+ * User IDs to send the message to (if authenticated)
310
+ */
311
311
  userIds?: string[];
312
312
  /**
313
- * Connection ID to send the message to
314
- */
313
+ * Connection ID to send the message to
314
+ */
315
315
  connectionId?: string;
316
316
  /**
317
- * Connection IDs to send the message to
318
- */
317
+ * Connection IDs to send the message to
318
+ */
319
319
  connectionIds?: string[];
320
320
  /**
321
- * Optional: exclude specific connection IDs from receiving the message
322
- */
321
+ * Optional: exclude specific connection IDs from receiving the message
322
+ */
323
323
  exceptConnectionIds?: string[];
324
324
  /**
325
- * Optional: exclude specific user IDs from receiving the message
326
- * Requires alepha/security integration
327
- */
325
+ * Optional: exclude specific user IDs from receiving the message
326
+ * Requires alepha/security integration
327
+ */
328
328
  exceptUserIds?: string[];
329
329
  }
330
330
  //#endregion
@@ -337,30 +337,30 @@ interface EmitOptions<TClient extends TWSObject> {
337
337
  */
338
338
  declare abstract class WebSocketServerProvider {
339
339
  /**
340
- * Register a WebSocket endpoint with its channel configuration
341
- */
340
+ * Register a WebSocket endpoint with its channel configuration
341
+ */
342
342
  abstract registerEndpoint<TClient extends TWSObject, TServer extends TWSObject>(config: WebSocketPrimitiveOptions<TClient, TServer>): void;
343
343
  /**
344
- * Emit a message to clients based on targeting criteria
345
- *
346
- * This method distributes messages across all server instances via pub/sub.
347
- */
344
+ * Emit a message to clients based on targeting criteria
345
+ *
346
+ * This method distributes messages across all server instances via pub/sub.
347
+ */
348
348
  abstract emit<TClient extends TWSObject>(channelPath: string, options: EmitOptions<TClient>): Promise<void>;
349
349
  /**
350
- * Get all active connections (local to this server instance)
351
- */
350
+ * Get all active connections (local to this server instance)
351
+ */
352
352
  abstract getConnections(): WebSocketConnection[];
353
353
  /**
354
- * Get connections in a specific room (local to this server instance)
355
- */
354
+ * Get connections in a specific room (local to this server instance)
355
+ */
356
356
  abstract getRoomConnections(roomId: string): WebSocketConnection[];
357
357
  /**
358
- * Get connections for a specific user (local to this server instance)
359
- */
358
+ * Get connections for a specific user (local to this server instance)
359
+ */
360
360
  abstract getUserConnections(userId: string): WebSocketConnection[];
361
361
  /**
362
- * Close a specific connection
363
- */
362
+ * Close a specific connection
363
+ */
364
364
  abstract closeConnection(connectionId: string, code?: number, reason?: string): Promise<void>;
365
365
  }
366
366
  //#endregion
@@ -414,33 +414,33 @@ declare class WebSocketPrimitive<TClient extends TWSObject, TServer extends TWSO
414
414
  protected readonly webSocketServerProvider: WebSocketServerProvider;
415
415
  protected onInit(): void;
416
416
  /**
417
- * Emit message to clients
418
- *
419
- * Send messages from the server to connected clients based on targeting criteria.
420
- * Messages are distributed across all server instances via pub/sub.
421
- *
422
- * @example
423
- * ```typescript
424
- * // Send to specific room
425
- * await websocket.emit({
426
- * roomId: "room-123",
427
- * message: { type: "update", data: {...} }
428
- * });
429
- *
430
- * // Send to specific user (all their connections)
431
- * await websocket.emit({
432
- * userId: "user-456",
433
- * message: { type: "notification", text: "Hello!" }
434
- * });
435
- *
436
- * // Send to multiple rooms, except certain users
437
- * await websocket.emit({
438
- * roomIds: ["room-1", "room-2"],
439
- * exceptUserIds: ["user-123"],
440
- * message: { type: "broadcast", content: "System announcement" }
441
- * });
442
- * ```
443
- */
417
+ * Emit message to clients
418
+ *
419
+ * Send messages from the server to connected clients based on targeting criteria.
420
+ * Messages are distributed across all server instances via pub/sub.
421
+ *
422
+ * @example
423
+ * ```typescript
424
+ * // Send to specific room
425
+ * await websocket.emit({
426
+ * roomId: "room-123",
427
+ * message: { type: "update", data: {...} }
428
+ * });
429
+ *
430
+ * // Send to specific user (all their connections)
431
+ * await websocket.emit({
432
+ * userId: "user-456",
433
+ * message: { type: "notification", text: "Hello!" }
434
+ * });
435
+ *
436
+ * // Send to multiple rooms, except certain users
437
+ * await websocket.emit({
438
+ * roomIds: ["room-1", "room-2"],
439
+ * exceptUserIds: ["user-123"],
440
+ * message: { type: "broadcast", content: "System announcement" }
441
+ * });
442
+ * ```
443
+ */
444
444
  emit(options: EmitOptions<TClient>): Promise<void>;
445
445
  }
446
446
  //#endregion
@@ -452,55 +452,55 @@ declare class WebSocketPrimitive<TClient extends TWSObject, TServer extends TWSO
452
452
  * and messages can be targeted to specific rooms.
453
453
  */
454
454
  declare class RoomManager {
455
- protected readonly log: alepha_logger2.Logger;
455
+ protected readonly log: alepha_logger1.Logger;
456
456
  /**
457
- * Maps roomId → Set<connectionId>
458
- */
457
+ * Maps roomId → Set<connectionId>
458
+ */
459
459
  protected readonly rooms: Map<string, Set<string>>;
460
460
  /**
461
- * Maps connectionId → Set<roomId>
462
- * Inverse index for fast lookup of connection's rooms
463
- */
461
+ * Maps connectionId → Set<roomId>
462
+ * Inverse index for fast lookup of connection's rooms
463
+ */
464
464
  protected readonly connectionRooms: Map<string, Set<string>>;
465
465
  /**
466
- * Join a connection to one or more rooms
467
- */
466
+ * Join a connection to one or more rooms
467
+ */
468
468
  joinRooms(connectionId: string, roomIds: string[]): void;
469
469
  /**
470
- * Join a connection to a room
471
- */
470
+ * Join a connection to a room
471
+ */
472
472
  joinRoom(connectionId: string, roomId: string): void;
473
473
  /**
474
- * Leave a connection from a room
475
- */
474
+ * Leave a connection from a room
475
+ */
476
476
  leaveRoom(connectionId: string, roomId: string): void;
477
477
  /**
478
- * Remove a connection from all rooms
479
- */
478
+ * Remove a connection from all rooms
479
+ */
480
480
  leaveAllRooms(connectionId: string): void;
481
481
  /**
482
- * Get all connection IDs in a room
483
- */
482
+ * Get all connection IDs in a room
483
+ */
484
484
  getRoomConnections(roomId: string): string[];
485
485
  /**
486
- * Get all room IDs for a connection
487
- */
486
+ * Get all room IDs for a connection
487
+ */
488
488
  getConnectionRooms(connectionId: string): string[];
489
489
  /**
490
- * Check if a connection is in a room
491
- */
490
+ * Check if a connection is in a room
491
+ */
492
492
  isInRoom(connectionId: string, roomId: string): boolean;
493
493
  /**
494
- * Get all active rooms
495
- */
494
+ * Get all active rooms
495
+ */
496
496
  getAllRooms(): string[];
497
497
  /**
498
- * Get total number of connections across all rooms
499
- */
498
+ * Get total number of connections across all rooms
499
+ */
500
500
  getTotalConnections(): number;
501
501
  /**
502
- * Get room statistics
503
- */
502
+ * Get room statistics
503
+ */
504
504
  getStats(): {
505
505
  totalRooms: number;
506
506
  totalConnections: number;
@@ -509,10 +509,10 @@ declare class RoomManager {
509
509
  }
510
510
  //#endregion
511
511
  //#region ../../src/websocket/services/WebSocketClient.d.ts
512
- declare const envSchema$1: alepha42.TObject<{
513
- WEBSOCKET_URL: alepha42.TString;
514
- WEBSOCKET_RECONNECT_INTERVAL: alepha42.TInteger;
515
- WEBSOCKET_MAX_RECONNECT_ATTEMPTS: alepha42.TInteger;
512
+ declare const envSchema$1: alepha6.TObject<{
513
+ WEBSOCKET_URL: alepha6.TString;
514
+ WEBSOCKET_RECONNECT_INTERVAL: alepha6.TInteger;
515
+ WEBSOCKET_MAX_RECONNECT_ATTEMPTS: alepha6.TInteger;
516
516
  }>;
517
517
  declare module "alepha" {
518
518
  interface Env extends Partial<Static<typeof envSchema$1>> {}
@@ -533,7 +533,7 @@ declare class WebSocketChannelConnection<TClient extends TWSObject, TServer exte
533
533
  };
534
534
  protected readonly env: Static<typeof envSchema$1>;
535
535
  protected readonly alepha: Alepha;
536
- protected readonly log: alepha_logger2.Logger;
536
+ protected readonly log: alepha_logger1.Logger;
537
537
  protected ws?: WebSocket;
538
538
  protected reconnectAttempts: number;
539
539
  protected reconnectTimer?: number;
@@ -556,48 +556,48 @@ declare class WebSocketChannelConnection<TClient extends TWSObject, TServer exte
556
556
  maxReconnectAttempts?: number;
557
557
  }, env: Static<typeof envSchema$1>);
558
558
  /**
559
- * Build WebSocket URL
560
- */
559
+ * Build WebSocket URL
560
+ */
561
561
  protected buildUrl(): string;
562
562
  /**
563
- * Subscribe to a room on this channel
564
- */
563
+ * Subscribe to a room on this channel
564
+ */
565
565
  subscribe(roomId: string, handler: (message: Static<TClient>) => void, callbacks?: {
566
566
  onConnect?: () => void;
567
567
  onDisconnect?: () => void;
568
568
  onError?: (error: Error) => void;
569
569
  }): () => void;
570
570
  /**
571
- * Connect to WebSocket server
572
- */
571
+ * Connect to WebSocket server
572
+ */
573
573
  protected connect(): Promise<void>;
574
574
  /**
575
- * Handle incoming message
576
- */
575
+ * Handle incoming message
576
+ */
577
577
  protected handleMessage(data: string): void;
578
578
  /**
579
- * Send message to a specific room
580
- */
579
+ * Send message to a specific room
580
+ */
581
581
  send(roomId: string, message: Static<TServer>): Promise<void>;
582
582
  /**
583
- * Schedule reconnection
584
- */
583
+ * Schedule reconnection
584
+ */
585
585
  protected scheduleReconnect(): void;
586
586
  /**
587
- * Disconnect from server
588
- */
587
+ * Disconnect from server
588
+ */
589
589
  disconnect(): void;
590
590
  /**
591
- * Reconnect manually
592
- */
591
+ * Reconnect manually
592
+ */
593
593
  reconnect(): void;
594
594
  /**
595
- * Check if subscribed to a room
596
- */
595
+ * Check if subscribed to a room
596
+ */
597
597
  hasRoom(roomId: string): boolean;
598
598
  /**
599
- * Get all subscribed rooms
600
- */
599
+ * Get all subscribed rooms
600
+ */
601
601
  getRooms(): string[];
602
602
  }
603
603
  /**
@@ -607,7 +607,7 @@ declare class WebSocketChannelConnection<TClient extends TWSObject, TServer exte
607
607
  * One connection per channel, multiple rooms per connection.
608
608
  */
609
609
  declare class WebSocketClient {
610
- protected readonly log: alepha_logger2.Logger;
610
+ protected readonly log: alepha_logger1.Logger;
611
611
  protected readonly alepha: Alepha;
612
612
  protected readonly env: {
613
613
  WEBSOCKET_URL: string;
@@ -616,8 +616,8 @@ declare class WebSocketClient {
616
616
  };
617
617
  protected connections: Map<string, WebSocketChannelConnection<any, any>>;
618
618
  /**
619
- * Subscribe to a room on a channel
620
- */
619
+ * Subscribe to a room on a channel
620
+ */
621
621
  subscribe<TClient extends TWSObject, TServer extends TWSObject>(roomId: string, channel: ChannelPrimitive<TClient, TServer>, handler: (message: Static<TClient>) => void, options?: {
622
622
  url?: string;
623
623
  autoReconnect?: boolean;
@@ -628,16 +628,16 @@ declare class WebSocketClient {
628
628
  onError?: (error: Error) => void;
629
629
  }): () => void;
630
630
  /**
631
- * Send message to a room on a channel
632
- */
631
+ * Send message to a room on a channel
632
+ */
633
633
  send<TClient extends TWSObject, TServer extends TWSObject>(roomId: string, channel: ChannelPrimitive<TClient, TServer>, message: Static<TServer>): Promise<void>;
634
634
  /**
635
- * Get connection for a channel
636
- */
635
+ * Get connection for a channel
636
+ */
637
637
  getConnection<TClient extends TWSObject, TServer extends TWSObject>(channel: ChannelPrimitive<TClient, TServer>): WebSocketChannelConnection<TClient, TServer> | undefined;
638
638
  /**
639
- * Disconnect all connections
640
- */
639
+ * Disconnect all connections
640
+ */
641
641
  disconnectAll(): void;
642
642
  }
643
643
  //#endregion
@@ -646,35 +646,35 @@ declare class WebSocketClient {
646
646
  * WebSocket message distribution event
647
647
  */
648
648
  declare const webSocketMessageSchema: {
649
- payload: alepha42.TObject<{
649
+ payload: alepha6.TObject<{
650
650
  /**
651
- * Channel path (e.g., "/ws/chat")
652
- */
653
- channelPath: alepha42.TString;
651
+ * Channel path (e.g., "/ws/chat")
652
+ */
653
+ channelPath: alepha6.TString;
654
654
  /**
655
- * Target room ID(s)
656
- */
657
- roomIds: alepha42.TOptional<alepha42.TArray<alepha42.TString>>;
655
+ * Target room ID(s)
656
+ */
657
+ roomIds: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
658
658
  /**
659
- * Target user ID(s)
660
- */
661
- userIds: alepha42.TOptional<alepha42.TArray<alepha42.TString>>;
659
+ * Target user ID(s)
660
+ */
661
+ userIds: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
662
662
  /**
663
- * Target connection ID(s)
664
- */
665
- connectionIds: alepha42.TOptional<alepha42.TArray<alepha42.TString>>;
663
+ * Target connection ID(s)
664
+ */
665
+ connectionIds: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
666
666
  /**
667
- * Exclude connection ID(s) from receiving the message
668
- */
669
- exceptConnectionIds: alepha42.TOptional<alepha42.TArray<alepha42.TString>>;
667
+ * Exclude connection ID(s) from receiving the message
668
+ */
669
+ exceptConnectionIds: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
670
670
  /**
671
- * Exclude user ID(s) from receiving the message
672
- */
673
- exceptUserIds: alepha42.TOptional<alepha42.TArray<alepha42.TString>>;
671
+ * Exclude user ID(s) from receiving the message
672
+ */
673
+ exceptUserIds: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
674
674
  /**
675
- * The message payload to send
676
- */
677
- message: alepha42.TAny;
675
+ * The message payload to send
676
+ */
677
+ message: alepha6.TAny;
678
678
  }>;
679
679
  };
680
680
  /**
@@ -694,60 +694,60 @@ declare const webSocketMessageSchema: {
694
694
  * - Horizontal scaling without losing messages
695
695
  */
696
696
  declare class WebSocketTopicService {
697
- protected readonly log: alepha_logger2.Logger;
697
+ protected readonly log: alepha_logger1.Logger;
698
698
  /**
699
- * Handler function to be called when a message is received from the topic
700
- * This is set by the WebSocket provider during initialization
701
- */
699
+ * Handler function to be called when a message is received from the topic
700
+ * This is set by the WebSocket provider during initialization
701
+ */
702
702
  messageHandler?: (event: Static<(typeof webSocketMessageSchema)["payload"]>) => Promise<void>;
703
703
  /**
704
- * Topic for distributing WebSocket messages across server instances
705
- */
704
+ * Topic for distributing WebSocket messages across server instances
705
+ */
706
706
  readonly topic: alepha_topic0.TopicPrimitive<{
707
- payload: alepha42.TObject<{
707
+ payload: alepha6.TObject<{
708
708
  /**
709
- * Channel path (e.g., "/ws/chat")
710
- */
711
- channelPath: alepha42.TString;
709
+ * Channel path (e.g., "/ws/chat")
710
+ */
711
+ channelPath: alepha6.TString;
712
712
  /**
713
- * Target room ID(s)
714
- */
715
- roomIds: alepha42.TOptional<alepha42.TArray<alepha42.TString>>;
713
+ * Target room ID(s)
714
+ */
715
+ roomIds: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
716
716
  /**
717
- * Target user ID(s)
718
- */
719
- userIds: alepha42.TOptional<alepha42.TArray<alepha42.TString>>;
717
+ * Target user ID(s)
718
+ */
719
+ userIds: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
720
720
  /**
721
- * Target connection ID(s)
722
- */
723
- connectionIds: alepha42.TOptional<alepha42.TArray<alepha42.TString>>;
721
+ * Target connection ID(s)
722
+ */
723
+ connectionIds: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
724
724
  /**
725
- * Exclude connection ID(s) from receiving the message
726
- */
727
- exceptConnectionIds: alepha42.TOptional<alepha42.TArray<alepha42.TString>>;
725
+ * Exclude connection ID(s) from receiving the message
726
+ */
727
+ exceptConnectionIds: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
728
728
  /**
729
- * Exclude user ID(s) from receiving the message
730
- */
731
- exceptUserIds: alepha42.TOptional<alepha42.TArray<alepha42.TString>>;
729
+ * Exclude user ID(s) from receiving the message
730
+ */
731
+ exceptUserIds: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
732
732
  /**
733
- * The message payload to send
734
- */
735
- message: alepha42.TAny;
733
+ * The message payload to send
734
+ */
735
+ message: alepha6.TAny;
736
736
  }>;
737
737
  }>;
738
738
  /**
739
- * Publish a message to be distributed across all server instances
740
- */
739
+ * Publish a message to be distributed across all server instances
740
+ */
741
741
  publish(event: Static<(typeof webSocketMessageSchema)["payload"]>): Promise<void>;
742
742
  /**
743
- * Set the handler for incoming messages
744
- */
743
+ * Set the handler for incoming messages
744
+ */
745
745
  setMessageHandler(handler: (event: Static<(typeof webSocketMessageSchema)["payload"]>) => Promise<void>): void;
746
746
  }
747
747
  //#endregion
748
748
  //#region ../../src/websocket/providers/NodeWebSocketServerProvider.d.ts
749
- declare const envSchema: alepha42.TObject<{
750
- WEBSOCKET_PATH: alepha42.TString;
749
+ declare const envSchema: alepha6.TObject<{
750
+ WEBSOCKET_PATH: alepha6.TString;
751
751
  }>;
752
752
  declare module "alepha" {
753
753
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -756,7 +756,7 @@ declare class NodeWebSocketServerProvider extends WebSocketServerProvider {
756
756
  protected readonly alepha: Alepha;
757
757
  protected readonly roomManager: RoomManager;
758
758
  protected readonly topicService: WebSocketTopicService;
759
- protected readonly log: alepha_logger2.Logger;
759
+ protected readonly log: alepha_logger1.Logger;
760
760
  protected readonly env: {
761
761
  WEBSOCKET_PATH: string;
762
762
  };
@@ -775,9 +775,9 @@ declare class NodeWebSocketServerProvider extends WebSocketServerProvider {
775
775
  protected handleConnection<TClient extends TWSObject, TServer extends TWSObject>(ws: WebSocket$1, endpoint: WebSocketPrimitiveOptions<TClient, TServer>, request: IncomingMessage): void;
776
776
  protected extractRoomIds(url: URL): string[];
777
777
  /**
778
- * Send message to local connections based on targeting criteria
779
- * This is called by the topic service when a message is received
780
- */
778
+ * Send message to local connections based on targeting criteria
779
+ * This is called by the topic service when a message is received
780
+ */
781
781
  protected sendToLocalConnections(channelPath: string, message: any, criteria: {
782
782
  roomIds?: string[];
783
783
  userIds?: string[];
@@ -785,9 +785,9 @@ declare class NodeWebSocketServerProvider extends WebSocketServerProvider {
785
785
  exceptConnectionIds?: string[];
786
786
  exceptUserIds?: string[];
787
787
  }): Promise<void>;
788
- protected readonly start: alepha42.HookPrimitive<"start">;
789
- protected readonly ready: alepha42.HookPrimitive<"ready">;
790
- protected readonly stop: alepha42.HookPrimitive<"stop">;
788
+ protected readonly start: alepha6.HookPrimitive<"start">;
789
+ protected readonly ready: alepha6.HookPrimitive<"ready">;
790
+ protected readonly stop: alepha6.HookPrimitive<"stop">;
791
791
  }
792
792
  declare class NodeWebSocketConnection implements WebSocketConnection {
793
793
  readonly id: string;
@@ -796,7 +796,7 @@ declare class NodeWebSocketConnection implements WebSocketConnection {
796
796
  protected readonly ws: WebSocket$1;
797
797
  protected readonly provider: NodeWebSocketServerProvider;
798
798
  protected readonly endpoint: WebSocketPrimitiveOptions<any, any>;
799
- protected readonly log: alepha_logger2.Logger;
799
+ protected readonly log: alepha_logger1.Logger;
800
800
  metadata?: Record<string, any>;
801
801
  constructor(id: string, userId: string | undefined, roomIds: string[], ws: WebSocket$1, provider: NodeWebSocketServerProvider, endpoint: WebSocketPrimitiveOptions<any, any>);
802
802
  get readyState(): WebSocketState;
@@ -809,15 +809,15 @@ declare class NodeWebSocketConnection implements WebSocketConnection {
809
809
  declare module "alepha" {
810
810
  interface Hooks {
811
811
  /**
812
- * Fires when a WebSocket connection is established
813
- */
812
+ * Fires when a WebSocket connection is established
813
+ */
814
814
  "websocket:connect": {
815
815
  connectionId: string;
816
816
  path: string;
817
817
  };
818
818
  /**
819
- * Fires when a WebSocket connection is closed
820
- */
819
+ * Fires when a WebSocket connection is closed
820
+ */
821
821
  "websocket:disconnect": {
822
822
  connectionId: string;
823
823
  path: string;
@@ -825,16 +825,16 @@ declare module "alepha" {
825
825
  reason?: string;
826
826
  };
827
827
  /**
828
- * Fires when a WebSocket message is received
829
- */
828
+ * Fires when a WebSocket message is received
829
+ */
830
830
  "websocket:message": {
831
831
  connectionId: string;
832
832
  path: string;
833
833
  message: any;
834
834
  };
835
835
  /**
836
- * Fires when a WebSocket error occurs
837
- */
836
+ * Fires when a WebSocket error occurs
837
+ */
838
838
  "websocket:error": {
839
839
  connectionId: string;
840
840
  path: string;
@@ -855,7 +855,7 @@ declare module "alepha" {
855
855
  * @see {@link $websocket}
856
856
  * @module alepha.websockets
857
857
  */
858
- declare const AlephaWebSocket: alepha42.Service<alepha42.Module>;
858
+ declare const AlephaWebSocket: alepha6.Service<alepha6.Module>;
859
859
  //#endregion
860
860
  export { $channel, $websocket, AlephaWebSocket, ChannelPrimitive, ChannelPrimitiveOptions, EmitOptions, NodeWebSocketConnection, NodeWebSocketServerProvider, RoomManager, TWSObject, WebSocketChannelConnection, WebSocketClient, WebSocketConnection, WebSocketConnectionError, WebSocketError, WebSocketHandler, WebSocketHandlerContext, WebSocketPrimitive, WebSocketPrimitiveOptions, WebSocketServerProvider, WebSocketState, WebSocketTopicService, WebSocketValidationError };
861
861
  //# sourceMappingURL=index.d.ts.map