exisjs 0.6.1 → 0.7.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 (564) hide show
  1. package/README.md +9 -3
  2. package/dist/cli/commands/build.d.ts.map +1 -1
  3. package/dist/cli/commands/build.js +2 -8
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/dev.d.ts.map +1 -1
  6. package/dist/cli/commands/dev.js +33 -44
  7. package/dist/cli/commands/dev.js.map +1 -1
  8. package/dist/cli/commands/exports.d.ts.map +1 -1
  9. package/dist/cli/commands/exports.js +5 -32
  10. package/dist/cli/commands/exports.js.map +1 -1
  11. package/dist/cli/commands/generate.d.ts +2 -13
  12. package/dist/cli/commands/generate.d.ts.map +1 -1
  13. package/dist/cli/commands/generate.js +27 -60
  14. package/dist/cli/commands/generate.js.map +1 -1
  15. package/dist/cli/commands/init.d.ts.map +1 -1
  16. package/dist/cli/commands/init.js +4 -4
  17. package/dist/cli/commands/init.js.map +1 -1
  18. package/dist/cli/commands/start.d.ts.map +1 -1
  19. package/dist/cli/commands/start.js +2 -6
  20. package/dist/cli/commands/start.js.map +1 -1
  21. package/dist/cli/index.js +11 -23
  22. package/dist/cli/index.js.map +1 -1
  23. package/dist/cli/routes.d.ts.map +1 -1
  24. package/dist/cli/routes.js +20 -8
  25. package/dist/cli/routes.js.map +1 -1
  26. package/dist/config/config.d.ts +2 -1
  27. package/dist/config/config.d.ts.map +1 -1
  28. package/dist/config/config.js +7 -5
  29. package/dist/config/config.js.map +1 -1
  30. package/dist/config/env.d.ts.map +1 -1
  31. package/dist/config/env.js +3 -2
  32. package/dist/config/env.js.map +1 -1
  33. package/dist/config/types.d.ts +7 -2
  34. package/dist/config/types.d.ts.map +1 -1
  35. package/dist/decorators/constants.d.ts +9 -2
  36. package/dist/decorators/constants.d.ts.map +1 -1
  37. package/dist/decorators/constants.js +3 -2
  38. package/dist/decorators/constants.js.map +1 -1
  39. package/dist/decorators/core/metadata.d.ts +31 -0
  40. package/dist/decorators/core/metadata.d.ts.map +1 -1
  41. package/dist/decorators/core/metadata.js +110 -1
  42. package/dist/decorators/core/metadata.js.map +1 -1
  43. package/dist/decorators/core.d.ts +19 -4
  44. package/dist/decorators/core.d.ts.map +1 -1
  45. package/dist/decorators/core.js +29 -4
  46. package/dist/decorators/core.js.map +1 -1
  47. package/dist/decorators/middleware.d.ts +17 -17
  48. package/dist/decorators/middleware.d.ts.map +1 -1
  49. package/dist/decorators/middleware.js +111 -208
  50. package/dist/decorators/middleware.js.map +1 -1
  51. package/dist/decorators/params.d.ts +54 -12
  52. package/dist/decorators/params.d.ts.map +1 -1
  53. package/dist/decorators/params.js +40 -20
  54. package/dist/decorators/params.js.map +1 -1
  55. package/dist/decorators/routing.d.ts +0 -2
  56. package/dist/decorators/routing.d.ts.map +1 -1
  57. package/dist/decorators/routing.js +3 -4
  58. package/dist/decorators/routing.js.map +1 -1
  59. package/dist/di/container.d.ts +5 -1
  60. package/dist/di/container.d.ts.map +1 -1
  61. package/dist/di/container.js +56 -8
  62. package/dist/di/container.js.map +1 -1
  63. package/dist/di/decorators.d.ts +30 -0
  64. package/dist/di/decorators.d.ts.map +1 -0
  65. package/dist/di/decorators.js +59 -0
  66. package/dist/di/decorators.js.map +1 -0
  67. package/dist/di/index.d.ts +1 -0
  68. package/dist/di/index.d.ts.map +1 -1
  69. package/dist/di/index.js +4 -1
  70. package/dist/di/index.js.map +1 -1
  71. package/dist/docs/ARCHITECTURE.md +46 -285
  72. package/dist/docs/BENCHMARKS.md +5 -5
  73. package/dist/docs/README.md +8 -11
  74. package/dist/docs/content/boundaries.mdx +151 -0
  75. package/dist/docs/content/cli/commands.mdx +66 -104
  76. package/dist/docs/content/cli/overview.mdx +37 -47
  77. package/dist/docs/content/cli/usage.mdx +29 -15
  78. package/dist/docs/content/decorators.mdx +142 -81
  79. package/dist/docs/content/installation.mdx +20 -1
  80. package/dist/docs/content/middleware.mdx +65 -291
  81. package/dist/docs/content/modules.mdx +22 -1
  82. package/dist/docs/content/providers.mdx +33 -1
  83. package/dist/docs/content/security.mdx +44 -246
  84. package/dist/docs/content/structure.mdx +227 -100
  85. package/dist/docs/content/validation.mdx +0 -17
  86. package/dist/docs/reference/decorators.mdx +34 -216
  87. package/dist/docs/reference/di.mdx +35 -11
  88. package/dist/docs/reference/logger.mdx +100 -0
  89. package/dist/docs/reference/middleware.mdx +41 -217
  90. package/dist/docs/reference/router.mdx +9 -9
  91. package/dist/docs/reference/validator.mdx +2 -5
  92. package/dist/error/errors.d.ts.map +1 -1
  93. package/dist/error/errors.js +19 -5
  94. package/dist/error/errors.js.map +1 -1
  95. package/dist/index.d.ts +0 -1
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +1 -4
  98. package/dist/index.js.map +1 -1
  99. package/dist/lib/start-server.js +10 -0
  100. package/dist/lib/start-server.js.map +1 -1
  101. package/dist/logger/index.d.ts +81 -0
  102. package/dist/logger/index.d.ts.map +1 -0
  103. package/dist/logger/index.js +142 -0
  104. package/dist/logger/index.js.map +1 -0
  105. package/dist/middleware/dedupe.d.ts +1 -1
  106. package/dist/middleware/dedupe.js +1 -1
  107. package/dist/middleware/middleware.d.ts +3 -5
  108. package/dist/middleware/middleware.d.ts.map +1 -1
  109. package/dist/middleware/middleware.js +2 -6
  110. package/dist/middleware/middleware.js.map +1 -1
  111. package/dist/middleware/rate-limit.d.ts +0 -2
  112. package/dist/middleware/rate-limit.d.ts.map +1 -1
  113. package/dist/middleware/rate-limit.js +2 -14
  114. package/dist/middleware/rate-limit.js.map +1 -1
  115. package/dist/module/index.d.ts +2 -0
  116. package/dist/module/index.d.ts.map +1 -1
  117. package/dist/module/index.js +3 -1
  118. package/dist/module/index.js.map +1 -1
  119. package/dist/plugin/manager.d.ts +1 -1
  120. package/dist/plugin/manager.d.ts.map +1 -1
  121. package/dist/plugin/manager.js +47 -0
  122. package/dist/plugin/manager.js.map +1 -1
  123. package/dist/router/{gateway.d.ts → boundary.d.ts} +21 -13
  124. package/dist/router/boundary.d.ts.map +1 -0
  125. package/dist/router/boundary.js +11 -0
  126. package/dist/router/boundary.js.map +1 -0
  127. package/dist/router/controller-registrar.d.ts.map +1 -1
  128. package/dist/router/controller-registrar.js +33 -6
  129. package/dist/router/controller-registrar.js.map +1 -1
  130. package/dist/router/index.d.ts +3 -6
  131. package/dist/router/index.d.ts.map +1 -1
  132. package/dist/router/index.js +3 -7
  133. package/dist/router/index.js.map +1 -1
  134. package/dist/router/route-builder.d.ts +0 -28
  135. package/dist/router/route-builder.d.ts.map +1 -1
  136. package/dist/router/route-builder.js +2 -5
  137. package/dist/router/route-builder.js.map +1 -1
  138. package/dist/router/route-scanner.d.ts +1 -2
  139. package/dist/router/route-scanner.d.ts.map +1 -1
  140. package/dist/router/route-scanner.js +225 -203
  141. package/dist/router/route-scanner.js.map +1 -1
  142. package/dist/router/router.d.ts +4 -6
  143. package/dist/router/router.d.ts.map +1 -1
  144. package/dist/router/router.js +36 -72
  145. package/dist/router/router.js.map +1 -1
  146. package/dist/router/types.d.ts +2 -6
  147. package/dist/router/types.d.ts.map +1 -1
  148. package/dist/server/{bun-adapter.d.ts → adapters/bun-adapter.d.ts} +1 -1
  149. package/dist/server/adapters/bun-adapter.d.ts.map +1 -0
  150. package/dist/server/{bun-adapter.js → adapters/bun-adapter.js} +2 -24
  151. package/dist/server/adapters/bun-adapter.js.map +1 -0
  152. package/dist/server/{uws-adapter.d.ts → adapters/uws-adapter.d.ts} +1 -1
  153. package/dist/server/adapters/uws-adapter.d.ts.map +1 -0
  154. package/dist/server/{uws-adapter.js → adapters/uws-adapter.js} +1 -28
  155. package/dist/server/adapters/uws-adapter.js.map +1 -0
  156. package/dist/server/app.d.ts +10 -31
  157. package/dist/server/app.d.ts.map +1 -1
  158. package/dist/server/app.js +20 -135
  159. package/dist/server/app.js.map +1 -1
  160. package/dist/server/bootstrapper.d.ts +4 -15
  161. package/dist/server/bootstrapper.d.ts.map +1 -1
  162. package/dist/server/bootstrapper.js +30 -229
  163. package/dist/server/bootstrapper.js.map +1 -1
  164. package/dist/server/define.d.ts +2 -2
  165. package/dist/server/define.d.ts.map +1 -1
  166. package/dist/server/define.js +3 -3
  167. package/dist/server/define.js.map +1 -1
  168. package/dist/server/engines/bun-engine.d.ts +16 -0
  169. package/dist/server/engines/bun-engine.d.ts.map +1 -0
  170. package/dist/server/engines/bun-engine.js +41 -0
  171. package/dist/server/engines/bun-engine.js.map +1 -0
  172. package/dist/server/engines/engine.d.ts +16 -0
  173. package/dist/server/engines/engine.d.ts.map +1 -0
  174. package/dist/{queue/types.js → server/engines/engine.js} +1 -1
  175. package/dist/server/engines/engine.js.map +1 -0
  176. package/dist/server/engines/node-engine.d.ts +22 -0
  177. package/dist/server/engines/node-engine.d.ts.map +1 -0
  178. package/dist/server/engines/node-engine.js +130 -0
  179. package/dist/server/engines/node-engine.js.map +1 -0
  180. package/dist/server/engines/uws-engine.d.ts +16 -0
  181. package/dist/server/engines/uws-engine.d.ts.map +1 -0
  182. package/dist/server/engines/uws-engine.js +48 -0
  183. package/dist/server/engines/uws-engine.js.map +1 -0
  184. package/dist/server/request-handler.d.ts +0 -1
  185. package/dist/server/request-handler.d.ts.map +1 -1
  186. package/dist/server/request-handler.js +74 -48
  187. package/dist/server/request-handler.js.map +1 -1
  188. package/dist/server/request.d.ts +0 -8
  189. package/dist/server/request.d.ts.map +1 -1
  190. package/dist/server/request.js +0 -16
  191. package/dist/server/request.js.map +1 -1
  192. package/dist/server/response.d.ts.map +1 -1
  193. package/dist/server/response.js +2 -1
  194. package/dist/server/response.js.map +1 -1
  195. package/dist/utils/logger.d.ts.map +1 -1
  196. package/dist/utils/logger.js +0 -1
  197. package/dist/utils/logger.js.map +1 -1
  198. package/dist/utils/time.d.ts +6 -0
  199. package/dist/utils/time.d.ts.map +1 -0
  200. package/dist/utils/time.js +15 -0
  201. package/dist/utils/time.js.map +1 -0
  202. package/dist/validator/index.d.ts +1 -7
  203. package/dist/validator/index.d.ts.map +1 -1
  204. package/dist/validator/index.js +1 -5
  205. package/dist/validator/index.js.map +1 -1
  206. package/dist/validator/tex-types.d.ts +15 -2
  207. package/dist/validator/tex-types.d.ts.map +1 -1
  208. package/dist/validator/tex-types.js +8 -0
  209. package/dist/validator/tex-types.js.map +1 -1
  210. package/dist/validator/tex.d.ts.map +1 -1
  211. package/dist/validator/tex.js +21 -2
  212. package/dist/validator/tex.js.map +1 -1
  213. package/package.json +9 -151
  214. package/dist/adapters/aws-lambda.d.ts +0 -21
  215. package/dist/adapters/aws-lambda.d.ts.map +0 -1
  216. package/dist/adapters/aws-lambda.js +0 -125
  217. package/dist/adapters/aws-lambda.js.map +0 -1
  218. package/dist/adapters/bun.d.ts +0 -9
  219. package/dist/adapters/bun.d.ts.map +0 -1
  220. package/dist/adapters/bun.js +0 -23
  221. package/dist/adapters/bun.js.map +0 -1
  222. package/dist/adapters/cloudflare.d.ts +0 -10
  223. package/dist/adapters/cloudflare.d.ts.map +0 -1
  224. package/dist/adapters/cloudflare.js +0 -22
  225. package/dist/adapters/cloudflare.js.map +0 -1
  226. package/dist/adapters/deno.d.ts +0 -7
  227. package/dist/adapters/deno.d.ts.map +0 -1
  228. package/dist/adapters/deno.js +0 -21
  229. package/dist/adapters/deno.js.map +0 -1
  230. package/dist/adapters/fastly.d.ts +0 -6
  231. package/dist/adapters/fastly.d.ts.map +0 -1
  232. package/dist/adapters/fastly.js +0 -20
  233. package/dist/adapters/fastly.js.map +0 -1
  234. package/dist/adapters/fetch.d.ts +0 -30
  235. package/dist/adapters/fetch.d.ts.map +0 -1
  236. package/dist/adapters/fetch.js +0 -119
  237. package/dist/adapters/fetch.js.map +0 -1
  238. package/dist/adapters/index.d.ts +0 -9
  239. package/dist/adapters/index.d.ts.map +0 -1
  240. package/dist/adapters/index.js +0 -28
  241. package/dist/adapters/index.js.map +0 -1
  242. package/dist/adapters/netlify.d.ts +0 -8
  243. package/dist/adapters/netlify.d.ts.map +0 -1
  244. package/dist/adapters/netlify.js +0 -20
  245. package/dist/adapters/netlify.js.map +0 -1
  246. package/dist/adapters/vercel.d.ts +0 -17
  247. package/dist/adapters/vercel.d.ts.map +0 -1
  248. package/dist/adapters/vercel.js +0 -23
  249. package/dist/adapters/vercel.js.map +0 -1
  250. package/dist/auth/index.d.ts +0 -8
  251. package/dist/auth/index.d.ts.map +0 -1
  252. package/dist/auth/index.js +0 -49
  253. package/dist/auth/index.js.map +0 -1
  254. package/dist/auth/jwt.d.ts +0 -20
  255. package/dist/auth/jwt.d.ts.map +0 -1
  256. package/dist/auth/jwt.js +0 -59
  257. package/dist/auth/jwt.js.map +0 -1
  258. package/dist/auth/oauth/core.d.ts +0 -96
  259. package/dist/auth/oauth/core.d.ts.map +0 -1
  260. package/dist/auth/oauth/core.js +0 -203
  261. package/dist/auth/oauth/core.js.map +0 -1
  262. package/dist/auth/oauth/index.d.ts +0 -45
  263. package/dist/auth/oauth/index.d.ts.map +0 -1
  264. package/dist/auth/oauth/index.js +0 -64
  265. package/dist/auth/oauth/index.js.map +0 -1
  266. package/dist/auth/oauth/middleware.d.ts +0 -63
  267. package/dist/auth/oauth/middleware.d.ts.map +0 -1
  268. package/dist/auth/oauth/middleware.js +0 -164
  269. package/dist/auth/oauth/middleware.js.map +0 -1
  270. package/dist/auth/oauth/providers/custom.d.ts +0 -41
  271. package/dist/auth/oauth/providers/custom.d.ts.map +0 -1
  272. package/dist/auth/oauth/providers/custom.js +0 -204
  273. package/dist/auth/oauth/providers/custom.js.map +0 -1
  274. package/dist/auth/oauth/providers/discord.d.ts +0 -23
  275. package/dist/auth/oauth/providers/discord.d.ts.map +0 -1
  276. package/dist/auth/oauth/providers/discord.js +0 -130
  277. package/dist/auth/oauth/providers/discord.js.map +0 -1
  278. package/dist/auth/oauth/providers/facebook.d.ts +0 -28
  279. package/dist/auth/oauth/providers/facebook.d.ts.map +0 -1
  280. package/dist/auth/oauth/providers/facebook.js +0 -124
  281. package/dist/auth/oauth/providers/facebook.js.map +0 -1
  282. package/dist/auth/oauth/providers/github.d.ts +0 -25
  283. package/dist/auth/oauth/providers/github.d.ts.map +0 -1
  284. package/dist/auth/oauth/providers/github.js +0 -132
  285. package/dist/auth/oauth/providers/github.js.map +0 -1
  286. package/dist/auth/oauth/providers/google.d.ts +0 -23
  287. package/dist/auth/oauth/providers/google.d.ts.map +0 -1
  288. package/dist/auth/oauth/providers/google.js +0 -134
  289. package/dist/auth/oauth/providers/google.js.map +0 -1
  290. package/dist/auth/oauth/providers/microsoft.d.ts +0 -28
  291. package/dist/auth/oauth/providers/microsoft.d.ts.map +0 -1
  292. package/dist/auth/oauth/providers/microsoft.js +0 -136
  293. package/dist/auth/oauth/providers/microsoft.js.map +0 -1
  294. package/dist/auth/oauth/types.d.ts +0 -158
  295. package/dist/auth/oauth/types.d.ts.map +0 -1
  296. package/dist/auth/oauth/types.js +0 -4
  297. package/dist/auth/oauth/types.js.map +0 -1
  298. package/dist/auth/password.d.ts +0 -25
  299. package/dist/auth/password.d.ts.map +0 -1
  300. package/dist/auth/password.js +0 -93
  301. package/dist/auth/password.js.map +0 -1
  302. package/dist/auth/rbac.d.ts +0 -10
  303. package/dist/auth/rbac.d.ts.map +0 -1
  304. package/dist/auth/rbac.js +0 -34
  305. package/dist/auth/rbac.js.map +0 -1
  306. package/dist/auth/session.d.ts +0 -26
  307. package/dist/auth/session.d.ts.map +0 -1
  308. package/dist/auth/session.js +0 -134
  309. package/dist/auth/session.js.map +0 -1
  310. package/dist/cache/index.d.ts +0 -4
  311. package/dist/cache/index.d.ts.map +0 -1
  312. package/dist/cache/index.js +0 -25
  313. package/dist/cache/index.js.map +0 -1
  314. package/dist/cache/store.d.ts +0 -58
  315. package/dist/cache/store.d.ts.map +0 -1
  316. package/dist/cache/store.js +0 -298
  317. package/dist/cache/store.js.map +0 -1
  318. package/dist/cron/parser.d.ts +0 -2
  319. package/dist/cron/parser.d.ts.map +0 -1
  320. package/dist/cron/parser.js +0 -52
  321. package/dist/cron/parser.js.map +0 -1
  322. package/dist/cron/scheduler.d.ts +0 -23
  323. package/dist/cron/scheduler.d.ts.map +0 -1
  324. package/dist/cron/scheduler.js +0 -114
  325. package/dist/cron/scheduler.js.map +0 -1
  326. package/dist/database/adapters/mongodb.d.ts +0 -58
  327. package/dist/database/adapters/mongodb.d.ts.map +0 -1
  328. package/dist/database/adapters/mongodb.js +0 -264
  329. package/dist/database/adapters/mongodb.js.map +0 -1
  330. package/dist/database/adapters/mysql.d.ts +0 -27
  331. package/dist/database/adapters/mysql.d.ts.map +0 -1
  332. package/dist/database/adapters/mysql.js +0 -188
  333. package/dist/database/adapters/mysql.js.map +0 -1
  334. package/dist/database/adapters/postgres.d.ts +0 -28
  335. package/dist/database/adapters/postgres.d.ts.map +0 -1
  336. package/dist/database/adapters/postgres.js +0 -174
  337. package/dist/database/adapters/postgres.js.map +0 -1
  338. package/dist/database/adapters/sqlite.d.ts +0 -27
  339. package/dist/database/adapters/sqlite.d.ts.map +0 -1
  340. package/dist/database/adapters/sqlite.js +0 -149
  341. package/dist/database/adapters/sqlite.js.map +0 -1
  342. package/dist/database/index.d.ts +0 -42
  343. package/dist/database/index.d.ts.map +0 -1
  344. package/dist/database/index.js +0 -58
  345. package/dist/database/index.js.map +0 -1
  346. package/dist/database/manager.d.ts +0 -141
  347. package/dist/database/manager.d.ts.map +0 -1
  348. package/dist/database/manager.js +0 -337
  349. package/dist/database/manager.js.map +0 -1
  350. package/dist/database/migration.d.ts +0 -57
  351. package/dist/database/migration.d.ts.map +0 -1
  352. package/dist/database/migration.js +0 -329
  353. package/dist/database/migration.js.map +0 -1
  354. package/dist/database/query-builder.d.ts +0 -95
  355. package/dist/database/query-builder.d.ts.map +0 -1
  356. package/dist/database/query-builder.js +0 -404
  357. package/dist/database/query-builder.js.map +0 -1
  358. package/dist/database/sql/index.d.ts +0 -18
  359. package/dist/database/sql/index.d.ts.map +0 -1
  360. package/dist/database/sql/index.js +0 -74
  361. package/dist/database/sql/index.js.map +0 -1
  362. package/dist/database/sql/schema.d.ts +0 -38
  363. package/dist/database/sql/schema.d.ts.map +0 -1
  364. package/dist/database/sql/schema.js +0 -80
  365. package/dist/database/sql/schema.js.map +0 -1
  366. package/dist/database/synchronizer.d.ts +0 -12
  367. package/dist/database/synchronizer.d.ts.map +0 -1
  368. package/dist/database/synchronizer.js +0 -82
  369. package/dist/database/synchronizer.js.map +0 -1
  370. package/dist/database/types.d.ts +0 -184
  371. package/dist/database/types.d.ts.map +0 -1
  372. package/dist/database/types.js +0 -4
  373. package/dist/database/types.js.map +0 -1
  374. package/dist/dataloader/dataloader.d.ts +0 -23
  375. package/dist/dataloader/dataloader.d.ts.map +0 -1
  376. package/dist/dataloader/dataloader.js +0 -98
  377. package/dist/dataloader/dataloader.js.map +0 -1
  378. package/dist/dataloader/index.d.ts +0 -3
  379. package/dist/dataloader/index.d.ts.map +0 -1
  380. package/dist/dataloader/index.js +0 -19
  381. package/dist/dataloader/index.js.map +0 -1
  382. package/dist/dataloader/registry.d.ts +0 -17
  383. package/dist/dataloader/registry.d.ts.map +0 -1
  384. package/dist/dataloader/registry.js +0 -47
  385. package/dist/dataloader/registry.js.map +0 -1
  386. package/dist/dev/dep-graph.d.ts +0 -2
  387. package/dist/dev/dep-graph.d.ts.map +0 -1
  388. package/dist/dev/dep-graph.js +0 -111
  389. package/dist/dev/dep-graph.js.map +0 -1
  390. package/dist/dev/hot-reload.d.ts +0 -30
  391. package/dist/dev/hot-reload.d.ts.map +0 -1
  392. package/dist/dev/hot-reload.js +0 -262
  393. package/dist/dev/hot-reload.js.map +0 -1
  394. package/dist/docs/content/adapters.mdx +0 -199
  395. package/dist/docs/content/cache.mdx +0 -239
  396. package/dist/docs/content/circuit-breaker.mdx +0 -130
  397. package/dist/docs/content/cron.mdx +0 -109
  398. package/dist/docs/content/database.mdx +0 -278
  399. package/dist/docs/content/gateways.mdx +0 -376
  400. package/dist/docs/content/oauth.mdx +0 -179
  401. package/dist/docs/content/queues.mdx +0 -177
  402. package/dist/docs/content/rpc.mdx +0 -146
  403. package/dist/docs/content/sse.mdx +0 -159
  404. package/dist/docs/content/websockets.mdx +0 -289
  405. package/dist/docs/integrations/README.md +0 -23
  406. package/dist/docs/integrations/jwt.mdx +0 -151
  407. package/dist/docs/integrations/mongo.mdx +0 -183
  408. package/dist/docs/integrations/observability.mdx +0 -125
  409. package/dist/docs/integrations/openai.mdx +0 -108
  410. package/dist/docs/integrations/postgres.mdx +0 -190
  411. package/dist/docs/integrations/posthog.mdx +0 -122
  412. package/dist/docs/integrations/redis.mdx +0 -141
  413. package/dist/docs/integrations/resend.mdx +0 -117
  414. package/dist/docs/integrations/s3.mdx +0 -122
  415. package/dist/docs/integrations/swagger.mdx +0 -113
  416. package/dist/docs/reference/adapters.mdx +0 -130
  417. package/dist/docs/reference/auth.mdx +0 -183
  418. package/dist/docs/reference/cache.mdx +0 -132
  419. package/dist/docs/reference/circuit-breaker.mdx +0 -71
  420. package/dist/docs/reference/queue.mdx +0 -155
  421. package/dist/docs/reference/storage.mdx +0 -116
  422. package/dist/docs/reference/swagger.mdx +0 -132
  423. package/dist/integrations/drizzle.d.ts +0 -10
  424. package/dist/integrations/drizzle.d.ts.map +0 -1
  425. package/dist/integrations/drizzle.js +0 -34
  426. package/dist/integrations/drizzle.js.map +0 -1
  427. package/dist/integrations/jwt.d.ts +0 -12
  428. package/dist/integrations/jwt.d.ts.map +0 -1
  429. package/dist/integrations/jwt.js +0 -29
  430. package/dist/integrations/jwt.js.map +0 -1
  431. package/dist/integrations/mongodb.d.ts +0 -13
  432. package/dist/integrations/mongodb.d.ts.map +0 -1
  433. package/dist/integrations/mongodb.js +0 -48
  434. package/dist/integrations/mongodb.js.map +0 -1
  435. package/dist/integrations/mongoose.d.ts +0 -13
  436. package/dist/integrations/mongoose.d.ts.map +0 -1
  437. package/dist/integrations/mongoose.js +0 -84
  438. package/dist/integrations/mongoose.js.map +0 -1
  439. package/dist/integrations/openai.d.ts +0 -12
  440. package/dist/integrations/openai.d.ts.map +0 -1
  441. package/dist/integrations/openai.js +0 -47
  442. package/dist/integrations/openai.js.map +0 -1
  443. package/dist/integrations/postgres.d.ts +0 -13
  444. package/dist/integrations/postgres.d.ts.map +0 -1
  445. package/dist/integrations/postgres.js +0 -55
  446. package/dist/integrations/postgres.js.map +0 -1
  447. package/dist/integrations/posthog.d.ts +0 -13
  448. package/dist/integrations/posthog.d.ts.map +0 -1
  449. package/dist/integrations/posthog.js +0 -49
  450. package/dist/integrations/posthog.js.map +0 -1
  451. package/dist/integrations/prisma.d.ts +0 -10
  452. package/dist/integrations/prisma.d.ts.map +0 -1
  453. package/dist/integrations/prisma.js +0 -39
  454. package/dist/integrations/prisma.js.map +0 -1
  455. package/dist/integrations/redis.d.ts +0 -12
  456. package/dist/integrations/redis.d.ts.map +0 -1
  457. package/dist/integrations/redis.js +0 -48
  458. package/dist/integrations/redis.js.map +0 -1
  459. package/dist/integrations/resend.d.ts +0 -12
  460. package/dist/integrations/resend.d.ts.map +0 -1
  461. package/dist/integrations/resend.js +0 -47
  462. package/dist/integrations/resend.js.map +0 -1
  463. package/dist/integrations/s3.d.ts +0 -15
  464. package/dist/integrations/s3.d.ts.map +0 -1
  465. package/dist/integrations/s3.js +0 -60
  466. package/dist/integrations/s3.js.map +0 -1
  467. package/dist/integrations/supabase.d.ts +0 -13
  468. package/dist/integrations/supabase.d.ts.map +0 -1
  469. package/dist/integrations/supabase.js +0 -51
  470. package/dist/integrations/supabase.js.map +0 -1
  471. package/dist/middleware/cache.d.ts +0 -21
  472. package/dist/middleware/cache.d.ts.map +0 -1
  473. package/dist/middleware/cache.js +0 -156
  474. package/dist/middleware/cache.js.map +0 -1
  475. package/dist/observability/health.d.ts +0 -23
  476. package/dist/observability/health.d.ts.map +0 -1
  477. package/dist/observability/health.js +0 -49
  478. package/dist/observability/health.js.map +0 -1
  479. package/dist/observability/index.d.ts +0 -4
  480. package/dist/observability/index.d.ts.map +0 -1
  481. package/dist/observability/index.js +0 -10
  482. package/dist/observability/index.js.map +0 -1
  483. package/dist/observability/metrics.d.ts +0 -6
  484. package/dist/observability/metrics.d.ts.map +0 -1
  485. package/dist/observability/metrics.js +0 -60
  486. package/dist/observability/metrics.js.map +0 -1
  487. package/dist/observability/otel.d.ts +0 -27
  488. package/dist/observability/otel.d.ts.map +0 -1
  489. package/dist/observability/otel.js +0 -45
  490. package/dist/observability/otel.js.map +0 -1
  491. package/dist/observability/prometheus.d.ts +0 -30
  492. package/dist/observability/prometheus.d.ts.map +0 -1
  493. package/dist/observability/prometheus.js +0 -31
  494. package/dist/observability/prometheus.js.map +0 -1
  495. package/dist/queue/client.d.ts +0 -13
  496. package/dist/queue/client.d.ts.map +0 -1
  497. package/dist/queue/client.js +0 -83
  498. package/dist/queue/client.js.map +0 -1
  499. package/dist/queue/drivers/MemoryDriver.d.ts +0 -21
  500. package/dist/queue/drivers/MemoryDriver.d.ts.map +0 -1
  501. package/dist/queue/drivers/MemoryDriver.js +0 -176
  502. package/dist/queue/drivers/MemoryDriver.js.map +0 -1
  503. package/dist/queue/drivers/RedisDriver.d.ts +0 -19
  504. package/dist/queue/drivers/RedisDriver.d.ts.map +0 -1
  505. package/dist/queue/drivers/RedisDriver.js +0 -130
  506. package/dist/queue/drivers/RedisDriver.js.map +0 -1
  507. package/dist/queue/index.d.ts +0 -18
  508. package/dist/queue/index.d.ts.map +0 -1
  509. package/dist/queue/index.js +0 -37
  510. package/dist/queue/index.js.map +0 -1
  511. package/dist/queue/manager.d.ts +0 -18
  512. package/dist/queue/manager.d.ts.map +0 -1
  513. package/dist/queue/manager.js +0 -59
  514. package/dist/queue/manager.js.map +0 -1
  515. package/dist/queue/types.d.ts +0 -55
  516. package/dist/queue/types.d.ts.map +0 -1
  517. package/dist/queue/types.js.map +0 -1
  518. package/dist/queue/worker.d.ts +0 -18
  519. package/dist/queue/worker.d.ts.map +0 -1
  520. package/dist/queue/worker.js +0 -176
  521. package/dist/queue/worker.js.map +0 -1
  522. package/dist/router/gateway.d.ts.map +0 -1
  523. package/dist/router/gateway.js +0 -11
  524. package/dist/router/gateway.js.map +0 -1
  525. package/dist/server/bun-adapter.d.ts.map +0 -1
  526. package/dist/server/bun-adapter.js.map +0 -1
  527. package/dist/server/sse.d.ts +0 -16
  528. package/dist/server/sse.d.ts.map +0 -1
  529. package/dist/server/sse.js +0 -51
  530. package/dist/server/sse.js.map +0 -1
  531. package/dist/server/uws-adapter.d.ts.map +0 -1
  532. package/dist/server/uws-adapter.js.map +0 -1
  533. package/dist/storage/index.d.ts +0 -15
  534. package/dist/storage/index.d.ts.map +0 -1
  535. package/dist/storage/index.js +0 -7
  536. package/dist/storage/index.js.map +0 -1
  537. package/dist/swagger/index.d.ts +0 -9
  538. package/dist/swagger/index.d.ts.map +0 -1
  539. package/dist/swagger/index.js +0 -165
  540. package/dist/swagger/index.js.map +0 -1
  541. package/dist/threads/pool.d.ts +0 -14
  542. package/dist/threads/pool.d.ts.map +0 -1
  543. package/dist/threads/pool.js +0 -93
  544. package/dist/threads/pool.js.map +0 -1
  545. package/dist/threads/worker-runner.d.ts +0 -2
  546. package/dist/threads/worker-runner.d.ts.map +0 -1
  547. package/dist/threads/worker-runner.js +0 -71
  548. package/dist/threads/worker-runner.js.map +0 -1
  549. package/dist/validator/validator.d.ts +0 -360
  550. package/dist/validator/validator.d.ts.map +0 -1
  551. package/dist/validator/validator.js +0 -931
  552. package/dist/validator/validator.js.map +0 -1
  553. package/dist/websocket/orchestrator.d.ts +0 -11
  554. package/dist/websocket/orchestrator.d.ts.map +0 -1
  555. package/dist/websocket/orchestrator.js +0 -238
  556. package/dist/websocket/orchestrator.js.map +0 -1
  557. package/dist/websocket/server.d.ts +0 -66
  558. package/dist/websocket/server.d.ts.map +0 -1
  559. package/dist/websocket/server.js +0 -158
  560. package/dist/websocket/server.js.map +0 -1
  561. package/dist/websocket/socket.d.ts +0 -119
  562. package/dist/websocket/socket.d.ts.map +0 -1
  563. package/dist/websocket/socket.js +0 -242
  564. package/dist/websocket/socket.js.map +0 -1
@@ -1,132 +0,0 @@
1
- ---
2
- title: "Caching"
3
- description: "API Reference for ExisJS Caching and Revalidation (`exisjs/cache`)."
4
- ---
5
-
6
- # Caching (`exisjs/cache`)
7
-
8
- ExisJS comes with a highly sophisticated built-in caching system that natively supports **stale-while-revalidate** semantics, intelligent `tags`-based cache invalidation, and multiple backing stores (Memory, FileSystem, and Redis).
9
-
10
- ---
11
-
12
- ## `cacheMiddleware(options)`
13
-
14
- The primary way to use the cache is by attaching the `cacheMiddleware` directly to your GET routes. It intercepts responses, stores them in the cache, and serves them efficiently on subsequent identical requests.
15
-
16
- ExisJS automatically injects an `X-Exis-Cache: HIT` or `X-Exis-Cache: MISS` header into the HTTP response so you can debug your cache behavior instantly!
17
-
18
- **Class-Based (OOP)**
19
- ```typescript filename="src/http/stats/route.ts"
20
- import { Controller, Get, Use } from 'exisjs/decorators'
21
- import { cacheMiddleware } from 'exisjs/cache'
22
-
23
- @Controller('/stats')
24
- export default class StatsController {
25
-
26
- @Get('/')
27
- @Use(
28
- cacheMiddleware({
29
- ttlMs: 60 * 1000, // 60 seconds
30
- keyGenerator: (req) => `stats:${req.query.period || 'all'}`
31
- })
32
- )
33
- async getStats() {
34
- return db.queryHeavyStats()
35
- }
36
- }
37
- ```
38
-
39
- **Functional**
40
- ```typescript filename="src/http/stats/route.ts"
41
- import { controller, route } from 'exisjs/router'
42
- import { cacheMiddleware } from 'exisjs/cache'
43
-
44
- export default controller({
45
- getStats: route.get('/', {
46
- middleware: [
47
- cacheMiddleware({
48
- ttlMs: 60 * 1000, // 60 seconds
49
-
50
- // You MUST provide a keyGenerator to prevent data leaking between users!
51
- keyGenerator: (req) => `stats:${req.query.period || 'all'}`
52
- })
53
- ],
54
- async handle() {
55
- // This heavy query only runs once every 60 seconds per period
56
- return db.queryHeavyStats()
57
- }
58
- })
59
- })
60
- ```
61
-
62
- ### Options
63
-
64
- - **`keyGenerator`** `(req => string)`: **Required.** Generates a unique cache key for the request. Never use a static key if the response varies by User ID or Query Parameters.
65
- - **`ttlMs`** `(number)`: Time to live in milliseconds. If omitted, the cache never inherently expires based on time (relies on manual tags instead).
66
- - **`tags`** `(string[] | function)`: A list of tags to associate with this cache entry, used for Next.js-style on-demand revalidation.
67
-
68
- ---
69
-
70
- ## Tag-Based Cache Invalidation
71
-
72
- Instead of waiting for a TTL to expire, you can invalidate caches instantly using tags. This is exactly how Next.js App Router caching works.
73
-
74
- When you cache a route, assign it a tag:
75
-
76
- ```typescript filename="src/http/products/route.ts"
77
- import { cacheMiddleware } from 'exisjs/cache'
78
-
79
- route.get('/:id', {
80
- middleware: [
81
- cacheMiddleware({
82
- // We tag this cache entry with the specific product ID
83
- tags: (req) => [`product-${req.params.id}`, 'all-products'],
84
- keyGenerator: (req) => `product:${req.params.id}`
85
- })
86
- ],
87
- async handle(ctx) {
88
- return db.products.find(ctx.params.id)
89
- }
90
- })
91
- ```
92
-
93
- Later, when a user updates the product via a `POST` or `PUT` route, you can instantly bust all caches tied to that tag using `revalidateTag()`!
94
-
95
- ```typescript filename="src/http/products/route.ts"
96
- import { revalidateTag } from 'exisjs/cache'
97
-
98
- route.put('/:id', {
99
- async handle(ctx) {
100
- await db.products.update(ctx.params.id, ctx.body)
101
-
102
- // Instantly purge the cache across the entire cluster!
103
- await revalidateTag(`product-${ctx.params.id}`)
104
-
105
- return { success: true }
106
- }
107
- })
108
- ```
109
-
110
- ---
111
-
112
- ## Cache Drivers
113
-
114
- ExisJS natively provides three driver implementations:
115
-
116
- 1. **`FileSystemCacheStore`**: (Default). Writes cache data to `.exis/cache/*.json` on the disk. Extremely fast for static data and survives server reboots.
117
- 2. **`MemoryCacheStore`**: Keeps caches purely in RAM. Perfect for development or extremely high-throughput, short-TTL data. (Includes automatic broadcast sync if running in an ExisJS Cluster).
118
- 3. **`RedisCacheStore`**: The standard for production. Uses a minimal Redis client to handle distributed caching across massive fleets of servers.
119
-
120
- ### Switching Stores Globally
121
-
122
- While you can pass a `store` option directly into `cacheMiddleware()`, it is usually better to set the global cache store during application boot:
123
-
124
- ```typescript filename="src/server.ts"
125
- import { exis } from 'exisjs'
126
- import { setCacheStore, RedisCacheStore } from 'exisjs/cache'
127
-
128
- const app = exis()
129
-
130
- // Use Redis instead of the default FileSystem cache
131
- setCacheStore(new RedisCacheStore(myRedisClient))
132
- ```
@@ -1,71 +0,0 @@
1
- ---
2
- title: "Circuit Breaker"
3
- description: "Strict API Reference for the Circuit Breaker resilience utility."
4
- ---
5
-
6
- # Circuit Breaker (`exisjs/app`)
7
-
8
- This document provides the strict API signatures and TypeScript interfaces exported for the `CircuitBreaker` utility. For high-level resilience guides, see the [Circuit Breaker Guide](/docs/circuit-breaker).
9
-
10
- ---
11
-
12
- ## `CircuitBreaker` Class
13
-
14
- The `CircuitBreaker` class is a state machine that monitors the execution of async actions to prevent cascading failures.
15
-
16
- ```typescript
17
- import { CircuitBreaker } from 'exisjs/app'
18
-
19
- class CircuitBreaker {
20
- constructor(options?: CircuitBreakerOptions)
21
-
22
- // The current state of the breaker
23
- public state: CircuitState
24
-
25
- // Executes the provided async action through the breaker
26
- fire<T>(action: () => Promise<T>): Promise<T>
27
- }
28
- ```
29
-
30
- ### `CircuitBreakerOptions`
31
-
32
- ```typescript
33
- interface CircuitBreakerOptions {
34
- /** Maximum number of sequential failures before the breaker transitions to OPEN */
35
- failureThreshold?: number // Default: 5
36
-
37
- /** Time to wait (in ms) before transitioning from OPEN to HALF_OPEN to test recovery */
38
- resetTimeoutMs?: number // Default: 10000 (10 seconds)
39
- }
40
- ```
41
-
42
- ---
43
-
44
- ## `CircuitState` Enum
45
-
46
- The circuit breaker operates in one of three states.
47
-
48
- ```typescript
49
- enum CircuitState {
50
- // Normal operation, all requests pass
51
- CLOSED = 'CLOSED',
52
-
53
- // Failing, all requests are instantly rejected
54
- OPEN = 'OPEN',
55
-
56
- // Testing recovery, exactly ONE request is allowed through
57
- HALF_OPEN = 'HALF_OPEN',
58
- }
59
- ```
60
-
61
- ---
62
-
63
- ## `CircuitBreakerError`
64
-
65
- If `fire()` is called while the breaker is `OPEN` (or if it is `HALF_OPEN` and a probe is already in flight), the breaker will instantly reject the promise with a `CircuitBreakerError`.
66
-
67
- ```typescript
68
- class CircuitBreakerError extends Error {
69
- constructor(message: string)
70
- }
71
- ```
@@ -1,155 +0,0 @@
1
- ---
2
- title: "Queues"
3
- description: "API Reference for ExisJS Background Queues (`exisjs/queue`)."
4
- ---
5
-
6
- # Queues (`exisjs/queue`)
7
-
8
- ExisJS ships with a highly robust, Redis-backed background job queue mechanism. It supports strict payload validation, exponential backoff, delayed execution, and lifecycle observability hooks, seamlessly integrated right into the core framework.
9
-
10
- ---
11
-
12
- ## Configuration (`exis.config.ts`)
13
-
14
- Before using the queue system, you must configure your driver (either `memory` for local development or `redis` for production). This is defined globally in your `exis.config.ts` file.
15
-
16
- ```typescript filename="exis.config.ts"
17
- import { defineConfig } from 'exisjs/config'
18
-
19
- export default async (phase: string) => {
20
- return defineConfig({
21
- queue: {
22
- driver: phase === 'development' ? 'memory' : 'redis',
23
- redisUrl: process.env.REDIS_URL,
24
- maxConcurrent: 100, // Maximum active workers
25
- maxQueue: 1000 // Maximum waiting jobs
26
- }
27
- })
28
- }
29
- ```
30
-
31
- ---
32
-
33
- ## Defining Jobs (File-Based Routing)
34
-
35
- ExisJS uses highly intuitive **File-Based Job Routing**.
36
-
37
- To create a new background job, simply create a file in the `src/jobs/` directory and `export default defineJob(...)`. The framework will automatically discover, load, and bind the job queue on boot!
38
-
39
- ```typescript filename="src/jobs/SendEmailJob.ts"
40
- import { defineJob } from 'exisjs/queue'
41
- import { tex } from 'exisjs/validator'
42
-
43
- export default defineJob({
44
- name: 'send-email',
45
-
46
- // ExisJS will automatically validate incoming queue payloads against this schema!
47
- schema: tex.object({
48
- to: tex.email(),
49
- subject: tex.string(),
50
- html: tex.string()
51
- }),
52
-
53
- // Set default retry and backoff behavior
54
- defaultOptions: {
55
- attempts: 3,
56
- backoff: {
57
- type: 'exponential',
58
- delay: 5000 // 5s, 25s, 125s...
59
- }
60
- },
61
-
62
- // Observability Hooks
63
- onJobFailed(payload, err) {
64
- console.error(`Job failed on attempt ${payload.attemptsMade}`, err)
65
- },
66
-
67
- onJobFailedPermanently(payload, err) {
68
- // Alert Sentry or Slack!
69
- console.error(`Job fatally died after all retries!`, err)
70
- },
71
-
72
- // The actual background execution logic
73
- async handler(job) {
74
- // job.data is completely type-safe and strictly validated by the schema!
75
- const { to, subject, html } = job.data
76
-
77
- await mailer.send({ to, subject, html })
78
- }
79
- })
80
- ```
81
-
82
- ### Job Definition Properties
83
- - **`name`** *(string)*: Unique identifier for the queue.
84
- - **`schema`** *(Validator)*: An ExisJS validator object to validate the payload structure.
85
- - **`handler`** *(function)*: The logic to execute (optional if using file-based job routing).
86
- - **`defaultOptions`** *(JobOptions)*: Global options for retry counts and delays.
87
- - **`cron`** *(string)*: A cron expression (e.g. `'0 * * * *'`) for scheduling the job recursively.
88
- - **Hooks**: `onJobStart`, `onJobSuccess`, `onJobFailed`, `onJobFailedPermanently`.
89
-
90
- ---
91
-
92
- ## Enqueuing Jobs
93
-
94
- You can dispatch a job from anywhere in your application (Controllers, Gateways, Services) using the `enqueue` function.
95
-
96
- ```typescript filename="src/http/users/route.ts"
97
- import { controller, route } from 'exisjs/router'
98
- import { enqueue } from 'exisjs/queue'
99
- import { SendEmailJob } from '../../jobs/SendEmailJob'
100
-
101
- export default controller({
102
- register: route.post('/register', {
103
- async handle(ctx) {
104
- const user = await db.users.create(ctx.body)
105
-
106
- // Dispatch the job to the background queue!
107
- await enqueue('send-email', {
108
- to: user.email,
109
- subject: 'Welcome to ExisJS!',
110
- html: '<h1>Welcome aboard!</h1>'
111
- })
112
-
113
- return { success: true }
114
- }
115
- })
116
- })
117
- ```
118
-
119
- ### Delaying Execution
120
- You can override the `defaultOptions` on a per-dispatch basis. For example, to delay a job by 15 minutes:
121
-
122
- ```typescript
123
- await enqueue('send-email', payload, {
124
- delay: 15 * 60 * 1000, // 15 minutes in milliseconds
125
- attempts: 5
126
- })
127
- ```
128
-
129
- ---
130
-
131
- ### Cron / Scheduled Jobs
132
-
133
- Because ExisJS uses file-based routing for jobs, implementing recurring Cron jobs is completely trivial. Just add a `cron` property to your `defineJob` config!
134
-
135
- ```typescript filename="src/jobs/CleanupJob.ts"
136
- import { defineJob } from 'exisjs/queue'
137
-
138
- export default defineJob({
139
- name: 'cleanup-stale-sessions',
140
- cron: '0 0 * * *', // Run every day at midnight
141
-
142
- async handler() {
143
- await db.query('DELETE FROM sessions WHERE expiresAt < NOW()')
144
- }
145
- })
146
- ```
147
-
148
- ### The `JobPayload` Object
149
-
150
- When your handler executes, it receives a `JobPayload` containing the following properties:
151
- - **`id`**: The unique generated UUID for this specific job execution.
152
- - **`name`**: The name of the queue.
153
- - **`data`**: The raw, strongly-typed, validated payload.
154
- - **`attemptsMade`**: How many times this specific job has failed and retried.
155
- - **`opts`**: The options (delays, backoff strategy) this job is running under.
@@ -1,116 +0,0 @@
1
- ---
2
- title: "Storage & Uploads"
3
- description: "API Reference for ExisJS Storage and File Uploads (`exisjs/storage`)."
4
- ---
5
-
6
- # Storage & Uploads (`exisjs/storage`)
7
-
8
- ExisJS provides native, extremely memory-efficient support for handling `multipart/form-data` file uploads.
9
-
10
- Instead of buffering large files into RAM (which can easily crash Node.js servers under heavy load), ExisJS streams file chunks directly from the network socket into the disk using a highly optimized Busboy integration.
11
-
12
- ---
13
-
14
- ## How it Works
15
-
16
- When you invoke `streamUpload`, ExisJS takes over the raw socket stream. As bytes come in from the network, they are instantly piped to the disk.
17
-
18
- Because ExisJS parses the multipart stream on the fly:
19
- 1. Your Node.js RAM footprint stays incredibly flat, even when users upload massive 10GB video files.
20
- 2. Form text fields are extracted in real-time. Once the upload finishes, ExisJS automatically merges all text fields directly into `req.body` so your subsequent logic (or validators) can treat them like a normal JSON payload!
21
-
22
- ---
23
-
24
- ## 1. Functional Example (`streamUpload`)
25
-
26
- If you are using the Functional architecture, import the `streamUpload` helper from `exisjs/storage` and pass it your request context.
27
-
28
- ### Example Usage
29
-
30
- ```typescript filename="src/http/upload/route.ts"
31
- import { controller, route } from 'exisjs/router'
32
- import { streamUpload } from 'exisjs/storage'
33
- import { HttpError } from 'exisjs/error'
34
-
35
- export default controller({
36
- uploadAvatar: route.post('/avatar', {
37
- async handle(ctx) {
38
- try {
39
- const { files, fields } = await streamUpload(ctx.req, {
40
- dest: './storage/avatars'
41
- })
42
-
43
- if (files.length === 0) {
44
- throw HttpError.badRequest('No file provided')
45
- }
46
-
47
- const uploadedFile = files[0]
48
-
49
- // Log the fields submitted with the form
50
- console.log('User ID associated with upload:', fields.userId)
51
-
52
- return {
53
- success: true,
54
- filename: uploadedFile.filename,
55
- savedAt: uploadedFile.destPath,
56
- size: uploadedFile.size,
57
- mimetype: uploadedFile.mimetype
58
- }
59
- } catch (err) {
60
- // streamUpload throws HttpErrors if the request isn't valid multipart/form-data
61
- throw err
62
- }
63
- }
64
- })
65
- })
66
- ```
67
-
68
- ### Return Value
69
-
70
- `streamUpload` resolves a Promise containing an object with two properties:
71
-
72
- #### 1. `fields` (`Record<string, string>`)
73
- An object containing all the non-file text fields submitted in the `multipart/form-data` payload. Note that `streamUpload` automatically populates `ctx.req.body` with these fields as well upon completion.
74
-
75
- #### 2. `files` (`Array<object>`)
76
- An array of successfully streamed files. Each object contains:
77
- - **`fieldname`**: The name of the HTML form field (e.g., `avatar`).
78
- - **`filename`**: The original name of the file uploaded by the user.
79
- - **`mimetype`**: The MIME type of the file (e.g., `image/png`).
80
- - **`destPath`**: The absolute path on your server's disk where the file was safely saved. *Note: ExisJS appends a randomized unique suffix to the filename to prevent overwrites.*
81
- - **`size`**: The total file size in bytes.
82
-
83
- ---
84
-
85
- ## 2. Class-Based Example (`req.streamUpload`)
86
-
87
- If you are using Object-Oriented `@Controller` classes, ExisJS natively extends the Request object. You do not even need to import `streamUpload`!
88
-
89
- Simply inject the Request object via the `@Req()` decorator and call `req.streamUpload(dest)` directly.
90
-
91
- ```typescript filename="src/http/upload/route.ts"
92
- import { Controller, Post, Req } from 'exisjs/decorators'
93
- import type { Request } from 'exisjs'
94
- import { HttpError } from 'exisjs/error'
95
-
96
- @Controller('/upload')
97
- export default class UploadController {
98
-
99
- @Post('/avatar')
100
- async handleUpload(@Req() req: Request) {
101
- // Exactly identical to streamUpload(req, { dest: ... })
102
- // We pass the destination path directly into the Request method
103
- const { files, fields } = await req.streamUpload('./storage/avatars')
104
-
105
- if (!files.length) throw HttpError.badRequest('Missing file')
106
-
107
- // Remember: fields are also populated into req.body!
108
- console.log(req.body.userId === fields.userId) // true!
109
-
110
- return {
111
- message: 'Upload successful',
112
- files
113
- }
114
- }
115
- }
116
- ```
@@ -1,132 +0,0 @@
1
- ---
2
- title: "Swagger & OpenAPI"
3
- description: "API Reference for ExisJS auto-generated Swagger UI (`exisjs/swagger`)."
4
- ---
5
-
6
- # Swagger / OpenAPI (`exisjs/swagger`)
7
-
8
- ExisJS ships with native, zero-configuration OpenAPI 3.0 generation.
9
-
10
- Because ExisJS routes strongly integrate with `exisjs/validator`, the framework automatically introspects your validators (`tex.object`, `tex.string`, etc.) across all controllers and automatically generates a fully interactive Swagger UI!
11
-
12
- ---
13
-
14
- ## 1. Global Setup (`exis.config.ts`)
15
-
16
- Because the Swagger engine needs to read all registered routes at boot time, you mount it globally using a Plugin.
17
-
18
- Create a new file in your `plugins` directory:
19
-
20
- ```typescript filename="src/plugins/swagger.ts"
21
- import { definePlugin } from 'exisjs/plugin'
22
- import { serveSwagger } from 'exisjs/swagger'
23
-
24
- export const swaggerPlugin = definePlugin({
25
- name: 'swagger-ui',
26
- register(app) {
27
- serveSwagger(app, {
28
- path: '/docs', // The URL where the UI will be served
29
- title: 'My ExisJS API',
30
- version: '1.0.0',
31
-
32
- // Optionally attach global OpenAPI components (like Bearer Auth definitions)
33
- components: {
34
- securitySchemes: {
35
- bearerAuth: {
36
- type: 'http',
37
- scheme: 'bearer',
38
- bearerFormat: 'JWT',
39
- }
40
- }
41
- }
42
- })
43
- }
44
- })
45
- ```
46
-
47
- Then, natively register your plugin in `exis.config.ts`:
48
-
49
- ```typescript filename="exis.config.ts"
50
- import { defineConfig } from 'exisjs/config'
51
- import { swaggerPlugin } from './src/plugins/swagger'
52
-
53
- export default defineConfig({
54
- plugins: [
55
- swaggerPlugin()
56
- ]
57
- })
58
- ```
59
-
60
- ---
61
-
62
- ## 2. Automatic Schema Inference
63
-
64
- You do not need to write YAML files or manually define your request bodies in Swagger. ExisJS reads the schemas directly from your code!
65
-
66
- ### Functional Architecture
67
-
68
- When using the `route.*` functions, anything you pass to `schema.body`, `schema.query`, or `schema.response` is instantly injected into the Swagger documentation.
69
-
70
- ```typescript filename="src/http/users/route.ts"
71
- import { controller, route } from 'exisjs/router'
72
- import { tex } from 'exisjs/validator'
73
-
74
- export default controller({
75
- createUser: route.post('/', {
76
- schema: {
77
- // ExisJS automatically builds an OpenAPI schema from this validator!
78
- body: tex.object({
79
- email: tex.email(),
80
- age: tex.number({ min: 18 })
81
- }),
82
- response: tex.object({
83
- id: tex.string(),
84
- success: tex.boolean()
85
- })
86
- },
87
- async handle(ctx) {
88
- return { id: '123', success: true }
89
- }
90
- })
91
- })
92
- ```
93
-
94
- ### Class-Based (OOP) Architecture
95
-
96
- If you are using OOP Decorators, ExisJS achieves the exact same result by reading your `@Body()`, `@Query()`, and `@Returns()` decorators.
97
-
98
- ```typescript filename="src/http/users/route.ts"
99
- import { Controller, Post, Body, Returns } from 'exisjs/decorators'
100
- import { tex } from 'exisjs/validator'
101
-
102
- const CreateUserSchema = tex.object({
103
- email: tex.email(),
104
- age: tex.number({ min: 18 })
105
- })
106
-
107
- const ResponseSchema = tex.object({
108
- id: tex.string(),
109
- success: tex.boolean()
110
- })
111
-
112
- @Controller('/users')
113
- export default class UserController {
114
-
115
- @Post('/')
116
- @Returns(ResponseSchema)
117
- async createUser(@Body(CreateUserSchema) body: any) {
118
- return { id: '123', success: true }
119
- }
120
- }
121
- ```
122
-
123
- ---
124
-
125
- ## 3. Accessing the UI
126
-
127
- Once you boot your application, simply navigate to the `path` you defined in your plugin:
128
-
129
- - **Swagger UI**: `http://localhost:4000/docs`
130
- - **Raw OpenAPI JSON**: `http://localhost:4000/docs/json`
131
-
132
- The generated Swagger UI is fully interactive, meaning you can authenticate and test your API directly from the browser!
@@ -1,10 +0,0 @@
1
- /**
2
- * Zero-config Drizzle ORM Integration.
3
- *
4
- * Automatically initializes Drizzle using `process.env.DATABASE_URL`.
5
- *
6
- * Peer Dependencies required:
7
- * npm install drizzle-orm postgres
8
- */
9
- export declare function drizzle<TSchema extends Record<string, unknown>>(schema: TSchema): any;
10
- //# sourceMappingURL=drizzle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drizzle.d.ts","sourceRoot":"","sources":["../../src/integrations/drizzle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wBAAgB,OAAO,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7D,MAAM,EAAE,OAAO,OA6BhB"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- /**
3
- * Zero-config Drizzle ORM Integration.
4
- *
5
- * Automatically initializes Drizzle using `process.env.DATABASE_URL`.
6
- *
7
- * Peer Dependencies required:
8
- * npm install drizzle-orm postgres
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.drizzle = drizzle;
12
- function drizzle(schema) {
13
- const url = process.env.DATABASE_URL;
14
- if (!url) {
15
- throw new Error('process.env.DATABASE_URL is missing. Cannot initialize Drizzle.');
16
- }
17
- // Dynamic require to avoid bloating the core framework bundle if Drizzle isn't used.
18
- let postgres;
19
- let drizzleOrm;
20
- try {
21
- // eslint-disable-next-line @typescript-eslint/no-require-imports
22
- postgres = require('postgres');
23
- // eslint-disable-next-line @typescript-eslint/no-require-imports
24
- drizzleOrm = require('drizzle-orm/postgres-js');
25
- }
26
- catch {
27
- throw new Error('Missing dependencies. Please run: npm install drizzle-orm postgres');
28
- }
29
- // Initialize the connection pool
30
- const sql = postgres(url, { max: 10 });
31
- // Return the drizzle client
32
- return drizzleOrm.drizzle(sql, { schema });
33
- }
34
- //# sourceMappingURL=drizzle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drizzle.js","sourceRoot":"","sources":["../../src/integrations/drizzle.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAEH,0BA8BC;AA9BD,SAAgB,OAAO,CACrB,MAAe;IAEf,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAA;IACpC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAA;IACH,CAAC;IAED,qFAAqF;IACrF,IAAI,QAAa,CAAA;IACjB,IAAI,UAAe,CAAA;IAEnB,IAAI,CAAC;QACH,iEAAiE;QACjE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;QAC9B,iEAAiE;QACjE,UAAU,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAA;IACH,CAAC;IAED,iCAAiC;IACjC,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAA;IAEtC,4BAA4B;IAC5B,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;AAC5C,CAAC"}
@@ -1,12 +0,0 @@
1
- import { type JWTOptions } from '../auth/jwt';
2
- export declare const jwt: {
3
- /**
4
- * Automatically signs a JWT token using `process.env.JWT_SECRET`.
5
- */
6
- sign(payload: Record<string, unknown>, options?: JWTOptions): string;
7
- /**
8
- * Automatically verifies a JWT token using `process.env.JWT_SECRET`.
9
- */
10
- verify<T = unknown>(token: string): T;
11
- };
12
- //# sourceMappingURL=jwt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/integrations/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAEjE,eAAO,MAAM,GAAG;IACd;;OAEG;kBACW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,UAAU,GAAG,MAAM;IASpE;;OAEG;WACI,CAAC,mBAAmB,MAAM,GAAG,CAAC;CAQtC,CAAA"}