canxjs 1.3.5 → 1.4.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 (329) hide show
  1. package/bin/canx.ts +4 -0
  2. package/dist/Application.d.ts +23 -0
  3. package/dist/Application.d.ts.map +1 -1
  4. package/dist/Application.js +35 -0
  5. package/dist/bin/canx.d.ts +3 -0
  6. package/dist/bin/canx.d.ts.map +1 -0
  7. package/dist/bin/canx.js +3 -0
  8. package/dist/core/Middleware.d.ts +10 -0
  9. package/dist/core/Middleware.d.ts.map +1 -1
  10. package/dist/core/Middleware.js +71 -0
  11. package/dist/core/Router.d.ts +5 -0
  12. package/dist/core/Router.d.ts.map +1 -1
  13. package/dist/core/Router.js +61 -7
  14. package/dist/core/Server.d.ts.map +1 -1
  15. package/dist/core/Server.js +2 -1
  16. package/dist/index.d.ts +6 -4
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +35497 -107
  19. package/dist/middlewares/CsrfMiddleware.d.ts +33 -0
  20. package/dist/middlewares/CsrfMiddleware.d.ts.map +1 -0
  21. package/dist/middlewares/CsrfMiddleware.js +82 -0
  22. package/dist/mvc/Controller.d.ts +20 -0
  23. package/dist/mvc/Controller.d.ts.map +1 -1
  24. package/dist/mvc/Controller.js +68 -0
  25. package/dist/mvc/Model.d.ts +14 -0
  26. package/dist/mvc/Model.d.ts.map +1 -1
  27. package/dist/mvc/Model.js +29 -0
  28. package/dist/src/Application.d.ts +75 -0
  29. package/dist/src/Application.d.ts.map +1 -0
  30. package/dist/src/Application.js +183 -0
  31. package/dist/src/auth/Auth.d.ts +81 -0
  32. package/dist/src/auth/Auth.d.ts.map +1 -0
  33. package/dist/src/auth/Auth.js +241 -0
  34. package/dist/src/auth/Gate.d.ts +155 -0
  35. package/dist/src/auth/Gate.d.ts.map +1 -0
  36. package/dist/src/auth/Gate.js +315 -0
  37. package/dist/src/auth/Guard.d.ts +142 -0
  38. package/dist/src/auth/Guard.d.ts.map +1 -0
  39. package/dist/src/auth/Guard.js +305 -0
  40. package/dist/src/auth/drivers/DatabaseSessionDriver.d.ts +13 -0
  41. package/dist/src/auth/drivers/DatabaseSessionDriver.d.ts.map +1 -0
  42. package/dist/src/auth/drivers/DatabaseSessionDriver.js +67 -0
  43. package/dist/src/cli/Command.d.ts +6 -0
  44. package/dist/src/cli/Command.d.ts.map +1 -0
  45. package/dist/src/cli/Command.js +1 -0
  46. package/dist/src/cli/commands/MakeCommand.d.ts +27 -0
  47. package/dist/src/cli/commands/MakeCommand.d.ts.map +1 -0
  48. package/dist/src/cli/commands/MakeCommand.js +469 -0
  49. package/dist/src/cli/commands/MigrateCommand.d.ts +7 -0
  50. package/dist/src/cli/commands/MigrateCommand.d.ts.map +1 -0
  51. package/dist/src/cli/commands/MigrateCommand.js +89 -0
  52. package/dist/src/cli/commands/OptimizeCommand.d.ts +7 -0
  53. package/dist/src/cli/commands/OptimizeCommand.d.ts.map +1 -0
  54. package/dist/src/cli/commands/OptimizeCommand.js +14 -0
  55. package/dist/src/cli/commands/QueueWorkCommand.d.ts +7 -0
  56. package/dist/src/cli/commands/QueueWorkCommand.d.ts.map +1 -0
  57. package/dist/src/cli/commands/QueueWorkCommand.js +52 -0
  58. package/dist/src/cli/commands/RouteListCommand.d.ts +8 -0
  59. package/dist/src/cli/commands/RouteListCommand.d.ts.map +1 -0
  60. package/dist/src/cli/commands/RouteListCommand.js +75 -0
  61. package/dist/src/cli/commands/ScheduleRunCommand.d.ts +7 -0
  62. package/dist/src/cli/commands/ScheduleRunCommand.d.ts.map +1 -0
  63. package/dist/src/cli/commands/ScheduleRunCommand.js +23 -0
  64. package/dist/src/cli/commands/TestCommand.d.ts +7 -0
  65. package/dist/src/cli/commands/TestCommand.d.ts.map +1 -0
  66. package/dist/src/cli/commands/TestCommand.js +19 -0
  67. package/dist/src/cli/index.d.ts +10 -0
  68. package/dist/src/cli/index.d.ts.map +1 -0
  69. package/dist/src/cli/index.js +86 -0
  70. package/dist/src/container/Container.d.ts +117 -0
  71. package/dist/src/container/Container.d.ts.map +1 -0
  72. package/dist/src/container/Container.js +290 -0
  73. package/dist/src/core/ErrorHandler.d.ts +28 -0
  74. package/dist/src/core/ErrorHandler.d.ts.map +1 -0
  75. package/dist/src/core/ErrorHandler.js +478 -0
  76. package/dist/src/core/Middleware.d.ts +34 -0
  77. package/dist/src/core/Middleware.d.ts.map +1 -0
  78. package/dist/src/core/Middleware.js +156 -0
  79. package/dist/src/core/Router.d.ts +44 -0
  80. package/dist/src/core/Router.d.ts.map +1 -0
  81. package/dist/src/core/Router.js +231 -0
  82. package/dist/src/core/Server.d.ts +35 -0
  83. package/dist/src/core/Server.d.ts.map +1 -0
  84. package/dist/src/core/Server.js +475 -0
  85. package/dist/src/core/exceptions/BadRequestException.d.ts +5 -0
  86. package/dist/src/core/exceptions/BadRequestException.d.ts.map +1 -0
  87. package/dist/src/core/exceptions/BadRequestException.js +7 -0
  88. package/dist/src/core/exceptions/CanxException.d.ts +7 -0
  89. package/dist/src/core/exceptions/CanxException.d.ts.map +1 -0
  90. package/dist/src/core/exceptions/CanxException.js +13 -0
  91. package/dist/src/core/exceptions/ConflictException.d.ts +5 -0
  92. package/dist/src/core/exceptions/ConflictException.d.ts.map +1 -0
  93. package/dist/src/core/exceptions/ConflictException.js +7 -0
  94. package/dist/src/core/exceptions/ForbiddenException.d.ts +5 -0
  95. package/dist/src/core/exceptions/ForbiddenException.d.ts.map +1 -0
  96. package/dist/src/core/exceptions/ForbiddenException.js +7 -0
  97. package/dist/src/core/exceptions/HttpException.d.ts +5 -0
  98. package/dist/src/core/exceptions/HttpException.d.ts.map +1 -0
  99. package/dist/src/core/exceptions/HttpException.js +6 -0
  100. package/dist/src/core/exceptions/InternalServerException.d.ts +5 -0
  101. package/dist/src/core/exceptions/InternalServerException.d.ts.map +1 -0
  102. package/dist/src/core/exceptions/InternalServerException.js +7 -0
  103. package/dist/src/core/exceptions/MethodNotAllowedException.d.ts +6 -0
  104. package/dist/src/core/exceptions/MethodNotAllowedException.d.ts.map +1 -0
  105. package/dist/src/core/exceptions/MethodNotAllowedException.js +9 -0
  106. package/dist/src/core/exceptions/NotFoundException.d.ts +5 -0
  107. package/dist/src/core/exceptions/NotFoundException.d.ts.map +1 -0
  108. package/dist/src/core/exceptions/NotFoundException.js +6 -0
  109. package/dist/src/core/exceptions/ServiceUnavailableException.d.ts +6 -0
  110. package/dist/src/core/exceptions/ServiceUnavailableException.d.ts.map +1 -0
  111. package/dist/src/core/exceptions/ServiceUnavailableException.js +9 -0
  112. package/dist/src/core/exceptions/TooManyRequestsException.d.ts +6 -0
  113. package/dist/src/core/exceptions/TooManyRequestsException.d.ts.map +1 -0
  114. package/dist/src/core/exceptions/TooManyRequestsException.js +9 -0
  115. package/dist/src/core/exceptions/UnauthorizedException.d.ts +5 -0
  116. package/dist/src/core/exceptions/UnauthorizedException.d.ts.map +1 -0
  117. package/dist/src/core/exceptions/UnauthorizedException.js +7 -0
  118. package/dist/src/core/exceptions/ValidationException.d.ts +5 -0
  119. package/dist/src/core/exceptions/ValidationException.d.ts.map +1 -0
  120. package/dist/src/core/exceptions/ValidationException.js +6 -0
  121. package/dist/src/core/exceptions/ViewNotFoundException.d.ts +7 -0
  122. package/dist/src/core/exceptions/ViewNotFoundException.d.ts.map +1 -0
  123. package/dist/src/core/exceptions/ViewNotFoundException.js +11 -0
  124. package/dist/src/database/Migration.d.ts +78 -0
  125. package/dist/src/database/Migration.d.ts.map +1 -0
  126. package/dist/src/database/Migration.js +331 -0
  127. package/dist/src/database/Seeder.d.ts +47 -0
  128. package/dist/src/database/Seeder.d.ts.map +1 -0
  129. package/dist/src/database/Seeder.js +69 -0
  130. package/dist/src/database/migrations/20240114000000_create_sessions_table.d.ts +3 -0
  131. package/dist/src/database/migrations/20240114000000_create_sessions_table.d.ts.map +1 -0
  132. package/dist/src/database/migrations/20240114000000_create_sessions_table.js +14 -0
  133. package/dist/src/docs/ApiDoc.d.ts +102 -0
  134. package/dist/src/docs/ApiDoc.d.ts.map +1 -0
  135. package/dist/src/docs/ApiDoc.js +145 -0
  136. package/dist/src/events/EventEmitter.d.ts +88 -0
  137. package/dist/src/events/EventEmitter.d.ts.map +1 -0
  138. package/dist/src/events/EventEmitter.js +266 -0
  139. package/dist/src/features/AutoCache.d.ts +41 -0
  140. package/dist/src/features/AutoCache.d.ts.map +1 -0
  141. package/dist/src/features/AutoCache.js +200 -0
  142. package/dist/src/features/HotWire.d.ts +51 -0
  143. package/dist/src/features/HotWire.d.ts.map +1 -0
  144. package/dist/src/features/HotWire.js +179 -0
  145. package/dist/src/features/JITCompiler.d.ts +67 -0
  146. package/dist/src/features/JITCompiler.d.ts.map +1 -0
  147. package/dist/src/features/JITCompiler.js +126 -0
  148. package/dist/src/features/RequestBatcher.d.ts +47 -0
  149. package/dist/src/features/RequestBatcher.d.ts.map +1 -0
  150. package/dist/src/features/RequestBatcher.js +119 -0
  151. package/dist/src/features/Scheduler.d.ts +67 -0
  152. package/dist/src/features/Scheduler.d.ts.map +1 -0
  153. package/dist/src/features/Scheduler.js +205 -0
  154. package/dist/src/generator/ClientGenerator.d.ts +7 -0
  155. package/dist/src/generator/ClientGenerator.d.ts.map +1 -0
  156. package/dist/src/generator/ClientGenerator.js +109 -0
  157. package/dist/src/index.d.ts +91 -0
  158. package/dist/src/index.d.ts.map +1 -0
  159. package/dist/src/index.js +148 -0
  160. package/dist/src/jsx-runtime.d.ts +5 -0
  161. package/dist/src/jsx-runtime.d.ts.map +1 -0
  162. package/dist/src/jsx-runtime.js +4 -0
  163. package/dist/src/middlewares/CsrfMiddleware.d.ts +33 -0
  164. package/dist/src/middlewares/CsrfMiddleware.d.ts.map +1 -0
  165. package/dist/src/middlewares/CsrfMiddleware.js +82 -0
  166. package/dist/src/middlewares/RateLimitMiddleware.d.ts +10 -0
  167. package/dist/src/middlewares/RateLimitMiddleware.d.ts.map +1 -0
  168. package/dist/src/middlewares/RateLimitMiddleware.js +38 -0
  169. package/dist/src/middlewares/SecurityMiddleware.d.ts +14 -0
  170. package/dist/src/middlewares/SecurityMiddleware.d.ts.map +1 -0
  171. package/dist/src/middlewares/SecurityMiddleware.js +38 -0
  172. package/dist/src/middlewares/ValidationMiddleware.d.ts +4 -0
  173. package/dist/src/middlewares/ValidationMiddleware.d.ts.map +1 -0
  174. package/dist/src/middlewares/ValidationMiddleware.js +33 -0
  175. package/dist/src/mvc/Controller.d.ts +48 -0
  176. package/dist/src/mvc/Controller.d.ts.map +1 -0
  177. package/dist/src/mvc/Controller.js +153 -0
  178. package/dist/src/mvc/Model.d.ts +135 -0
  179. package/dist/src/mvc/Model.d.ts.map +1 -0
  180. package/dist/src/mvc/Model.js +514 -0
  181. package/dist/src/mvc/View.d.ts +63 -0
  182. package/dist/src/mvc/View.d.ts.map +1 -0
  183. package/dist/src/mvc/View.js +189 -0
  184. package/dist/src/mvc/jsx-runtime.d.ts +3 -0
  185. package/dist/src/mvc/jsx-runtime.d.ts.map +1 -0
  186. package/dist/src/mvc/jsx-runtime.js +4 -0
  187. package/dist/src/notifications/Mail.d.ts +101 -0
  188. package/dist/src/notifications/Mail.d.ts.map +1 -0
  189. package/dist/src/notifications/Mail.js +320 -0
  190. package/dist/src/notifications/Notification.d.ts +147 -0
  191. package/dist/src/notifications/Notification.d.ts.map +1 -0
  192. package/dist/src/notifications/Notification.js +212 -0
  193. package/dist/src/queue/Queue.d.ts +56 -0
  194. package/dist/src/queue/Queue.d.ts.map +1 -0
  195. package/dist/src/queue/Queue.js +159 -0
  196. package/dist/src/queue/drivers/MemoryDriver.d.ts +24 -0
  197. package/dist/src/queue/drivers/MemoryDriver.d.ts.map +1 -0
  198. package/dist/src/queue/drivers/MemoryDriver.js +120 -0
  199. package/dist/src/queue/drivers/RedisDriver.d.ts +27 -0
  200. package/dist/src/queue/drivers/RedisDriver.d.ts.map +1 -0
  201. package/dist/src/queue/drivers/RedisDriver.js +144 -0
  202. package/dist/src/queue/drivers/types.d.ts +51 -0
  203. package/dist/src/queue/drivers/types.d.ts.map +1 -0
  204. package/dist/src/queue/drivers/types.js +1 -0
  205. package/dist/src/queue/ui/Dashboard.d.ts +2 -0
  206. package/dist/src/queue/ui/Dashboard.d.ts.map +1 -0
  207. package/dist/src/queue/ui/Dashboard.js +51 -0
  208. package/dist/src/queue/ui/QueueController.d.ts +10 -0
  209. package/dist/src/queue/ui/QueueController.d.ts.map +1 -0
  210. package/dist/src/queue/ui/QueueController.js +81 -0
  211. package/dist/src/realtime/Channel.d.ts +69 -0
  212. package/dist/src/realtime/Channel.d.ts.map +1 -0
  213. package/dist/src/realtime/Channel.js +169 -0
  214. package/dist/src/realtime/WebSocket.d.ts +138 -0
  215. package/dist/src/realtime/WebSocket.d.ts.map +1 -0
  216. package/dist/src/realtime/WebSocket.js +326 -0
  217. package/dist/src/schema/Schema.d.ts +64 -0
  218. package/dist/src/schema/Schema.d.ts.map +1 -0
  219. package/dist/src/schema/Schema.js +248 -0
  220. package/dist/src/storage/Storage.d.ts +116 -0
  221. package/dist/src/storage/Storage.d.ts.map +1 -0
  222. package/dist/src/storage/Storage.js +246 -0
  223. package/dist/src/storage/drivers/LocalDriver.d.ts +27 -0
  224. package/dist/src/storage/drivers/LocalDriver.d.ts.map +1 -0
  225. package/dist/src/storage/drivers/LocalDriver.js +191 -0
  226. package/dist/src/storage/drivers/S3Driver.d.ts +33 -0
  227. package/dist/src/storage/drivers/S3Driver.d.ts.map +1 -0
  228. package/dist/src/storage/drivers/S3Driver.js +291 -0
  229. package/dist/src/storage/drivers/types.d.ts +94 -0
  230. package/dist/src/storage/drivers/types.d.ts.map +1 -0
  231. package/dist/src/storage/drivers/types.js +4 -0
  232. package/dist/src/testing/TestCase.d.ts +190 -0
  233. package/dist/src/testing/TestCase.d.ts.map +1 -0
  234. package/dist/src/testing/TestCase.js +350 -0
  235. package/dist/src/testing/TestClient.d.ts +32 -0
  236. package/dist/src/testing/TestClient.d.ts.map +1 -0
  237. package/dist/src/testing/TestClient.js +85 -0
  238. package/dist/src/types/index.d.ts +498 -0
  239. package/dist/src/types/index.d.ts.map +1 -0
  240. package/dist/src/types/index.js +5 -0
  241. package/dist/src/utils/Collection.d.ts +256 -0
  242. package/dist/src/utils/Collection.d.ts.map +1 -0
  243. package/dist/src/utils/Collection.js +503 -0
  244. package/dist/src/utils/Encrypt.d.ts +74 -0
  245. package/dist/src/utils/Encrypt.d.ts.map +1 -0
  246. package/dist/src/utils/Encrypt.js +204 -0
  247. package/dist/src/utils/Env.d.ts +28 -0
  248. package/dist/src/utils/Env.d.ts.map +1 -0
  249. package/dist/src/utils/Env.js +57 -0
  250. package/dist/src/utils/ErrorHandler.d.ts +92 -0
  251. package/dist/src/utils/ErrorHandler.d.ts.map +1 -0
  252. package/dist/src/utils/ErrorHandler.js +220 -0
  253. package/dist/src/utils/FormRequest.d.ts +115 -0
  254. package/dist/src/utils/FormRequest.d.ts.map +1 -0
  255. package/dist/src/utils/FormRequest.js +273 -0
  256. package/dist/src/utils/Hash.d.ts +84 -0
  257. package/dist/src/utils/Hash.d.ts.map +1 -0
  258. package/dist/src/utils/Hash.js +227 -0
  259. package/dist/src/utils/Health.d.ts +111 -0
  260. package/dist/src/utils/Health.d.ts.map +1 -0
  261. package/dist/src/utils/Health.js +371 -0
  262. package/dist/src/utils/Logger.d.ts +71 -0
  263. package/dist/src/utils/Logger.d.ts.map +1 -0
  264. package/dist/src/utils/Logger.js +237 -0
  265. package/dist/src/utils/Paginator.d.ts +184 -0
  266. package/dist/src/utils/Paginator.d.ts.map +1 -0
  267. package/dist/src/utils/Paginator.js +321 -0
  268. package/dist/src/utils/Request.d.ts +33 -0
  269. package/dist/src/utils/Request.d.ts.map +1 -0
  270. package/dist/src/utils/Request.js +122 -0
  271. package/dist/src/utils/Resource.d.ts +154 -0
  272. package/dist/src/utils/Resource.d.ts.map +1 -0
  273. package/dist/src/utils/Resource.js +279 -0
  274. package/dist/src/utils/Response.d.ts +25 -0
  275. package/dist/src/utils/Response.d.ts.map +1 -0
  276. package/dist/src/utils/Response.js +103 -0
  277. package/dist/src/utils/Validator.d.ts +72 -0
  278. package/dist/src/utils/Validator.d.ts.map +1 -0
  279. package/dist/src/utils/Validator.js +272 -0
  280. package/dist/src/utils/i18n.d.ts +95 -0
  281. package/dist/src/utils/i18n.d.ts.map +1 -0
  282. package/dist/src/utils/i18n.js +264 -0
  283. package/dist/utils/Env.d.ts +28 -0
  284. package/dist/utils/Env.d.ts.map +1 -0
  285. package/dist/utils/Env.js +57 -0
  286. package/package.json +4 -4
  287. package/src/Application.ts +75 -26
  288. package/src/auth/Gate.ts +409 -0
  289. package/src/auth/Guard.ts +417 -0
  290. package/src/cli/Command.ts +5 -0
  291. package/src/cli/commands/MakeCommand.ts +496 -0
  292. package/src/cli/commands/MigrateCommand.ts +93 -0
  293. package/src/cli/commands/OptimizeCommand.ts +21 -0
  294. package/src/cli/commands/QueueWorkCommand.ts +58 -0
  295. package/src/cli/commands/RouteListCommand.ts +92 -0
  296. package/src/cli/commands/ScheduleRunCommand.ts +27 -0
  297. package/src/cli/commands/TestCommand.ts +25 -0
  298. package/src/cli/index.ts +98 -0
  299. package/src/core/ErrorHandler.ts +414 -139
  300. package/src/core/Middleware.ts +79 -0
  301. package/src/core/Router.ts +84 -7
  302. package/src/core/Server.ts +2 -1
  303. package/src/core/exceptions/BadRequestException.ts +8 -0
  304. package/src/core/exceptions/ConflictException.ts +8 -0
  305. package/src/core/exceptions/ForbiddenException.ts +8 -0
  306. package/src/core/exceptions/InternalServerException.ts +8 -0
  307. package/src/core/exceptions/MethodNotAllowedException.ts +11 -0
  308. package/src/core/exceptions/ServiceUnavailableException.ts +11 -0
  309. package/src/core/exceptions/TooManyRequestsException.ts +11 -0
  310. package/src/core/exceptions/UnauthorizedException.ts +8 -0
  311. package/src/core/exceptions/ViewNotFoundException.ts +13 -0
  312. package/src/features/Scheduler.ts +4 -0
  313. package/src/index.ts +144 -6
  314. package/src/middlewares/CsrfMiddleware.ts +113 -0
  315. package/src/middlewares/SecurityMiddleware.ts +16 -15
  316. package/src/mvc/Controller.ts +79 -0
  317. package/src/mvc/Model.ts +143 -82
  318. package/src/mvc/View.ts +96 -1
  319. package/src/testing/TestClient.ts +8 -0
  320. package/src/types/index.ts +15 -1
  321. package/src/utils/Collection.ts +583 -0
  322. package/src/utils/Encrypt.ts +281 -0
  323. package/src/utils/Env.ts +67 -0
  324. package/src/utils/FormRequest.ts +356 -0
  325. package/src/utils/Hash.ts +300 -0
  326. package/src/utils/Logger.ts +39 -0
  327. package/src/utils/Paginator.ts +451 -0
  328. package/src/utils/Resource.ts +370 -0
  329. package/src/utils/Validator.ts +83 -3
package/bin/canx.ts ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bun
2
+ import { cli } from '../src/cli';
3
+
4
+ cli.run(process.argv.slice(2));
@@ -46,7 +46,30 @@ export declare class Canx implements CanxApplication {
46
46
  put(path: string, ...handlers: any[]): this;
47
47
  patch(path: string, ...handlers: any[]): this;
48
48
  delete(path: string, ...handlers: any[]): this;
49
+ all(path: string, ...handlers: any[]): this;
50
+ /**
51
+ * Register a resource controller with RESTful routes
52
+ */
53
+ resource(path: string, controller: any, ...middlewares: MiddlewareHandler[]): this;
54
+ /**
55
+ * Group routes with a common prefix
56
+ */
57
+ group(prefix: string, callback: (router: RouterInstance) => void): this;
58
+ /**
59
+ * Register routes under a versioned API path
60
+ * @param version - Version identifier (e.g., 'v1', 'v2')
61
+ * @param callback - Route registration callback
62
+ */
63
+ version(version: string, callback: (router: RouterInstance) => void): this;
49
64
  }
65
+ /**
66
+ * Create a new CanxJS application instance
67
+ */
50
68
  export declare function createApp(config?: ServerConfig): Canx;
69
+ /**
70
+ * Define configuration with type checking
71
+ * Helper for creating typed configuration objects
72
+ */
73
+ export declare function defineConfig<T extends Record<string, any>>(config: T): T;
51
74
  export default Canx;
52
75
  //# sourceMappingURL=Application.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../src/Application.ts"],"names":[],"mappings":"AAAA;;GAEG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lers) { this.router.put(path, ...handlers); return this; }
133
133
  patch(path, ...handlers) { this.router.patch(path, ...handlers); return this; }
134
134
  delete(path, ...handlers) { this.router.delete(path, ...handlers); return this; }
135
+ all(path, ...handlers) { this.router.all(path, ...handlers); return this; }
136
+ /**
137
+ * Register a resource controller with RESTful routes
138
+ */
139
+ resource(path, controller, ...middlewares) {
140
+ this.router.resource(path, controller, ...middlewares);
141
+ return this;
142
+ }
143
+ /**
144
+ * Group routes with a common prefix
145
+ */
146
+ group(prefix, callback) {
147
+ this.router.group(prefix, callback);
148
+ return this;
149
+ }
150
+ /**
151
+ * Register routes under a versioned API path
152
+ * @param version - Version identifier (e.g., 'v1', 'v2')
153
+ * @param callback - Route registration callback
154
+ */
155
+ version(version, callback) {
156
+ const prefix = version.startsWith('/') ? version : '/api/' + version;
157
+ this.router.group(prefix, callback);
158
+ return this;
159
+ }
135
160
  }
161
+ /**
162
+ * Create a new CanxJS application instance
163
+ */
136
164
  export function createApp(config) {
137
165
  return new Canx(config);
138
166
  }
167
+ /**
168
+ * Define configuration with type checking
169
+ * Helper for creating typed configuration objects
170
+ */
171
+ export function defineConfig(config) {
172
+ return config;
173
+ }
139
174
  export default Canx;
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ export {};
3
+ //# sourceMappingURL=canx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canx.d.ts","sourceRoot":"","sources":["../../bin/canx.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ import { cli } from '../src/cli';
3
+ cli.run(process.argv.slice(2));
@@ -19,6 +19,16 @@ export declare const rateLimit: (options?: {
19
19
  max?: number;
20
20
  }) => MiddlewareHandler;
21
21
  export declare const compress: () => MiddlewareHandler;
22
+ /**
23
+ * Serve static files from a directory
24
+ * @param root - The root directory to serve files from (relative to cwd or absolute)
25
+ * @param options - Configuration options
26
+ */
27
+ export declare const serveStatic: (root?: string, options?: {
28
+ index?: string;
29
+ maxAge?: number;
30
+ extensions?: string[];
31
+ }) => MiddlewareHandler;
22
32
  export declare function createMiddlewarePipeline(): MiddlewarePipeline;
23
33
  export default MiddlewarePipeline;
24
34
  //# sourceMappingURL=Middleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Middleware.d.ts","sourceRoot":"","sources":["../../src/core/Middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAgB,MAAM,UAAU,CAAC;AAG3F,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,WAAW,CAA2B;IAE9C,GAAG,CAAC,GAAG,QAAQ,EAAE,iBAAiB,EAAE,GAAG,IAAI;IAKrC,OAAO,CACX,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,YAAY,EACjB,gBAAgB,EAAE,iBAAiB,EAAE,EACrC,YAAY,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAC/C,OAAO,CAAC,QAAQ,CAAC;CAuBrB;AAGD,eAAO,MAAM,IAAI,GAAI,UAAS;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,KAAG,iBAQ9G,CAAC;AAEF,eAAO,MAAM,MAAM,QAAO,iBAQzB,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,iBAO7B,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,UAAS;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,KAAG,iBAkB7E,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,iBAQ3B,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,kBAAkB,CAE7D;AAED,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"Middleware.d.ts","sourceRoot":"","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86
86
  return next();
87
87
  };
88
88
  };
89
+ /**
90
+ * Serve static files from a directory
91
+ * @param root - The root directory to serve files from (relative to cwd or absolute)
92
+ * @param options - Configuration options
93
+ */
94
+ export const serveStatic = (root = 'public', options = {}) => {
95
+ const { index = 'index.html', maxAge = 86400 } = options;
96
+ // Use path utilities inline to avoid import issues
97
+ const isAbsolute = (p) => p.startsWith('/') || /^[A-Za-z]:[\\/]/.test(p);
98
+ const join = (...parts) => parts.join('/').replace(/\/+/g, '/');
99
+ const extname = (p) => {
100
+ const lastDot = p.lastIndexOf('.');
101
+ const lastSlash = Math.max(p.lastIndexOf('/'), p.lastIndexOf('\\'));
102
+ return lastDot > lastSlash ? p.slice(lastDot) : '';
103
+ };
104
+ const rootPath = isAbsolute(root) ? root : join(process.cwd(), root);
105
+ const mimeTypes = {
106
+ '.html': 'text/html',
107
+ '.css': 'text/css',
108
+ '.js': 'application/javascript',
109
+ '.json': 'application/json',
110
+ '.png': 'image/png',
111
+ '.jpg': 'image/jpeg',
112
+ '.jpeg': 'image/jpeg',
113
+ '.gif': 'image/gif',
114
+ '.svg': 'image/svg+xml',
115
+ '.ico': 'image/x-icon',
116
+ '.woff': 'font/woff',
117
+ '.woff2': 'font/woff2',
118
+ '.ttf': 'font/ttf',
119
+ '.eot': 'application/vnd.ms-fontobject',
120
+ '.pdf': 'application/pdf',
121
+ '.webp': 'image/webp',
122
+ '.mp4': 'video/mp4',
123
+ '.webm': 'video/webm',
124
+ '.txt': 'text/plain',
125
+ '.xml': 'application/xml',
126
+ };
127
+ return async (req, res, next) => {
128
+ if (req.method !== 'GET' && req.method !== 'HEAD') {
129
+ return next();
130
+ }
131
+ // Clean the path to prevent directory traversal
132
+ const cleanPath = req.path.replace(/\.\./g, '').replace(/\/+/g, '/');
133
+ let filePath = join(rootPath, cleanPath);
134
+ try {
135
+ let file = Bun.file(filePath);
136
+ // Check if it's a directory by trying index file
137
+ if (!(await file.exists())) {
138
+ file = Bun.file(join(filePath, index));
139
+ if (!(await file.exists())) {
140
+ return next();
141
+ }
142
+ filePath = join(filePath, index);
143
+ }
144
+ const ext = extname(filePath).toLowerCase();
145
+ const contentType = mimeTypes[ext] || 'application/octet-stream';
146
+ return new Response(file, {
147
+ headers: {
148
+ 'Content-Type': contentType,
149
+ 'Cache-Control': `public, max-age=${maxAge}`,
150
+ 'Content-Length': String(file.size),
151
+ },
152
+ });
153
+ }
154
+ catch (e) {
155
+ // File not found, continue to next middleware
156
+ }
157
+ return next();
158
+ };
159
+ };
89
160
  export function createMiddlewarePipeline() {
90
161
  return new MiddlewarePipeline();
91
162
  }
@@ -31,6 +31,11 @@ export declare class Router implements RouterInstance {
31
31
  group(prefix: string, cb: (r: RouterInstance) => void): RouterInstance;
32
32
  middleware(...h: MiddlewareHandler[]): RouterInstance;
33
33
  use(...h: MiddlewareHandler[]): Router;
34
+ /**
35
+ * Register a resource controller with standard RESTful routes
36
+ * Creates: GET /, GET /:id, POST /, PUT /:id, DELETE /:id
37
+ */
38
+ resource(path: string, controller: any, ...middlewares: MiddlewareHandler[]): RouterInstance;
34
39
  getRoutes(): Route[];
35
40
  private collect;
36
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../src/core/Router.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,KAAK,EACL,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,EACf,MAAM,UAAU,CAAC;AAalB,UAAU,UAAU;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,MAAM,EAAE,WAAW,CAAC;CACrB;AAyCD,qBAAa,MAAO,YAAW,cAAc;IAC3C,OAAO,CAAC,KAAK,CAAyC;IACtD,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,iBAAiB,CAA2B;IACpD,OAAO,CAAC,kBAAkB,CAA2B;IACrD,OAAO,CAAC,MAAM,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AE,GAAG,CAAC,EAAE,CAAC,iBAAiB,GAAG,YAAY,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,GAAG,cAAc;IAE7F,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,GAAG,cAAc;IA6B9D,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,GAAG,cAAc;IAQtE,UAAU,CAAC,GAAG,CAAC,EAAE,iBAAiB,EAAE,GAAG,cAAc;IACrD,GAAG,CAAC,GAAG,CAAC,EAAE,iBAAiB,EAAE,GAAG,MAAM;IAEtC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,WAAW,EAAE,iBAAiB,EAAE,GAAG,cAAc;IA0C5F,SAAS,IAAI,KAAK,EAAE;IAMpB,OAAO,CAAC,OAAO;CAKhB;AAED,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAAgC;AAC7F,eAAe,MAAM,CAAC"}
@@ -55,20 +55,25 @@ export class Router {
55
55
  return p.startsWith('/') ? p : '/' + p;
56
56
  }
57
57
  addRoute(method, path, handler, mws = []) {
58
+ // Normalize path but preserve original for param name extraction
59
+ const originalPath = (this.prefix + path).startsWith('/') ? this.prefix + path : '/' + this.prefix + path;
58
60
  const normalized = this.normalizePath(this.prefix + path);
59
- const tree = this.trees.get(method);
60
61
  const segments = normalized.split('/').filter(Boolean);
61
- let node = tree;
62
- for (const seg of segments) {
62
+ const originalSegments = originalPath.split('/').filter(Boolean);
63
+ let node = this.trees.get(method);
64
+ for (let i = 0; i < segments.length; i++) {
65
+ const seg = segments[i];
66
+ const originalSeg = originalSegments[i] || seg;
63
67
  let key = seg, isParam = false, isWild = false, param = null;
64
- if (seg.startsWith(':')) {
68
+ // Extract param name from ORIGINAL segment to preserve casing
69
+ if (originalSeg.startsWith(':')) {
65
70
  isParam = true;
66
- param = seg.slice(1);
71
+ param = originalSeg.slice(1); // Use original casing
67
72
  key = ':';
68
73
  }
69
- else if (seg === '*' || seg.startsWith('*')) {
74
+ else if (originalSeg === '*' || originalSeg.startsWith('*')) {
70
75
  isWild = true;
71
- param = seg.length > 1 ? seg.slice(1) : 'wildcard';
76
+ param = originalSeg.length > 1 ? originalSeg.slice(1) : 'wildcard';
72
77
  key = '*';
73
78
  }
74
79
  if (!node.children.has(key)) {
@@ -99,12 +104,15 @@ export class Router {
99
104
  let node = tree;
100
105
  for (let i = 0; i < segments.length; i++) {
101
106
  const seg = segments[i];
107
+ // Try exact match first
102
108
  let child = node.children.get(this.routerOptions.caseSensitive ? seg : seg.toLowerCase());
109
+ // If no exact match, try parameter match
103
110
  if (!child) {
104
111
  child = node.children.get(':');
105
112
  if (child?.paramName)
106
113
  params[child.paramName] = seg;
107
114
  }
115
+ // If still no match, try wildcard
108
116
  if (!child) {
109
117
  child = node.children.get('*');
110
118
  if (child?.paramName) {
@@ -115,6 +123,10 @@ export class Router {
115
123
  }
116
124
  if (!child)
117
125
  return null;
126
+ // If this is a param node, capture the parameter value
127
+ if (child.isParam && child.paramName && !params[child.paramName]) {
128
+ params[child.paramName] = seg;
129
+ }
118
130
  node = child;
119
131
  }
120
132
  return node.handler ? { handler: node.handler, middlewares: node.middlewares, params } : null;
@@ -161,6 +173,48 @@ export class Router {
161
173
  }
162
174
  middleware(...h) { this.currentMiddlewares.push(...h); return this; }
163
175
  use(...h) { this.globalMiddlewares.push(...h); return this; }
176
+ /**
177
+ * Register a resource controller with standard RESTful routes
178
+ * Creates: GET /, GET /:id, POST /, PUT /:id, DELETE /:id
179
+ */
180
+ resource(path, controller, ...middlewares) {
181
+ const instance = typeof controller === 'function' ? new controller() : controller;
182
+ const basePath = path.startsWith('/') ? path : '/' + path;
183
+ // Helper to create handler
184
+ const createHandler = (method) => async (req, res) => {
185
+ if (typeof instance.setContext === 'function') {
186
+ instance.setContext(req, res);
187
+ }
188
+ if (typeof instance[method] === 'function') {
189
+ return instance[method](req, res);
190
+ }
191
+ return res.status(404).json({ error: `Method ${method} not found` });
192
+ };
193
+ // Standard RESTful routes
194
+ if (typeof instance.index === 'function') {
195
+ this.addRoute('GET', basePath, createHandler('index'), middlewares);
196
+ }
197
+ if (typeof instance.show === 'function') {
198
+ this.addRoute('GET', basePath + '/:id', createHandler('show'), middlewares);
199
+ }
200
+ if (typeof instance.store === 'function') {
201
+ this.addRoute('POST', basePath, createHandler('store'), middlewares);
202
+ }
203
+ if (typeof instance.update === 'function') {
204
+ this.addRoute('PUT', basePath + '/:id', createHandler('update'), middlewares);
205
+ }
206
+ if (typeof instance.destroy === 'function') {
207
+ this.addRoute('DELETE', basePath + '/:id', createHandler('destroy'), middlewares);
208
+ }
209
+ // Optional: create, edit for form-based apps
210
+ if (typeof instance.create === 'function') {
211
+ this.addRoute('GET', basePath + '/create', createHandler('create'), middlewares);
212
+ }
213
+ if (typeof instance.edit === 'function') {
214
+ this.addRoute('GET', basePath + '/:id/edit', createHandler('edit'), middlewares);
215
+ }
216
+ return this;
217
+ }
164
218
  getRoutes() {
165
219
  const routes = [];
166
220
  this.trees.forEach((tree, method) => this.collect(tree, '', method, routes));
@@ -1 +1 @@
1
- {"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../src/core/Server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EAEZ,WAAW,EAIZ,MAAM,UAAU,CAAC;AA+ClB;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,OAAO,EACZ,MAAM,GAAE,WAAgB,GACvB,WAAW,CAgFb;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAqMjD;AAkDD;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAA6C;IAC3D,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,cAAc,CAAiD;gBAGrE,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ;IAczD;;OAEG;IACG,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA+GlD;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B;;OAEG;IACH,IAAI,QAAQ,+BAEX;CACF;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../src/core/Server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EAEZ,WAAW,EAIZ,MAAM,UAAU,CAAC;AA+ClB;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,OAAO,EACZ,MAAM,GAAE,WAAgB,GACvB,WAAW,CAgFb;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAqMjD;AAkDD;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAA6C;IAC3D,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,cAAc,CAAiD;gBAGrE,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ;IAczD;;OAEG;IACG,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAgHlD;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B;;OAEG;IACH,IAAI,QAAQ,+BAEX;CACF;AAED,eAAe,MAAM,CAAC"}
@@ -420,12 +420,13 @@ export class Server {
420
420
  if (callback) {
421
421
  callback();
422
422
  }
423
+ const displayHost = this.config.hostname === '0.0.0.0' ? 'localhost' : this.config.hostname;
423
424
  console.log(`
424
425
  ╔══════════════════════════════════════════════════════════╗
425
426
  ║ ║
426
427
  ║ 🚀 CanxJS Server running ║
427
428
  ║ ║
428
- ║ → Local: http://${this.config.hostname}:${this.config.port}
429
+ ║ → Local: http://${displayHost}:${this.config.port}
429
430
  ║ → Mode: ${this.config.development ? 'Development' : 'Production'} ║
430
431
  ║ ║
431
432
  ╚══════════════════════════════════════════════════════════╝
package/dist/index.d.ts CHANGED
@@ -5,16 +5,17 @@
5
5
  */
6
6
  export { Server, createCanxRequest, createCanxResponse } from './core/Server';
7
7
  export { Router, createRouter } from './core/Router';
8
- export { MiddlewarePipeline, cors, logger, bodyParser, rateLimit, compress, createMiddlewarePipeline } from './core/Middleware';
8
+ export { MiddlewarePipeline, cors, logger, bodyParser, rateLimit, compress, serveStatic, createMiddlewarePipeline } from './core/Middleware';
9
9
  export { security } from './middlewares/SecurityMiddleware';
10
10
  export { rateLimit as rateLimitMiddleware } from './middlewares/RateLimitMiddleware';
11
11
  export { validateSchema } from './middlewares/ValidationMiddleware';
12
+ export { csrf, csrfField, csrfMeta } from './middlewares/CsrfMiddleware';
12
13
  export { z, Schema as ZSchema } from './schema/Schema';
13
14
  export type { Infer } from './schema/Schema';
14
15
  export { ClientGenerator } from './generator/ClientGenerator';
15
16
  export { TestClient } from './testing/TestClient';
16
- export { BaseController, Controller, Get, Post, Put, Patch, Delete, Middleware, getControllerMeta } from './mvc/Controller';
17
- export { Model, initDatabase, closeDatabase, query, execute } from './mvc/Model';
17
+ export { BaseController, Controller, Get, Post, Put, Patch, Delete, Middleware, Validate, getControllerMeta } from './mvc/Controller';
18
+ export { Model, QueryBuilderImpl, initDatabase, closeDatabase, query, execute } from './mvc/Model';
18
19
  export { jsx, jsxs, Fragment, html, render, renderPage, createLayout, View } from './mvc/View';
19
20
  export { hotWire, createHotWire } from './features/HotWire';
20
21
  export { autoCache, autoCacheMiddleware, createAutoCache } from './features/AutoCache';
@@ -44,6 +45,7 @@ export type { ServiceProvider } from './container/Container';
44
45
  export { validate, validateAsync, is } from './utils/Validator';
45
46
  export { ResponseBuilder, response } from './utils/Response';
46
47
  export { RequestParser, parseRequest } from './utils/Request';
48
+ export { env, isProduction, isDevelopment, isTest, requireEnv } from './utils/Env';
47
49
  export { ErrorHandler } from './core/ErrorHandler';
48
50
  export { CanxException } from './core/exceptions/CanxException';
49
51
  export { HttpException } from './core/exceptions/HttpException';
@@ -58,7 +60,7 @@ export { initI18n, useI18n, t, plural, I18n, i18nMiddleware } from './utils/i18n
58
60
  export type { I18nConfig, TranslationObject } from './utils/i18n';
59
61
  export { ResponseAssertions, MockFactory, createTestClient, assertResponse, factory, randomString, randomEmail, randomNumber, randomUuid, sleep, } from './testing/TestCase';
60
62
  export type { TestResponse, TestRequest } from './testing/TestCase';
61
- export { Canx, createApp } from './Application';
63
+ export { Canx, createApp, defineConfig } from './Application';
62
64
  export type * from './types';
63
65
  export type { CanxRequest as Request, CanxResponse as Response } from './types';
64
66
  export { Canx as default } from './Application';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIrD,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAChI,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,SAAS,IAAI,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAKpE,OAAO,EAAE,CAAC,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,iBA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