exisjs 0.6.0 → 0.7.0

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 (519) hide show
  1. package/dist/cli/commands/build.d.ts.map +1 -1
  2. package/dist/cli/commands/build.js +11 -9
  3. package/dist/cli/commands/build.js.map +1 -1
  4. package/dist/cli/commands/dev.d.ts.map +1 -1
  5. package/dist/cli/commands/dev.js +34 -36
  6. package/dist/cli/commands/dev.js.map +1 -1
  7. package/dist/cli/commands/exports.d.ts.map +1 -1
  8. package/dist/cli/commands/exports.js +5 -32
  9. package/dist/cli/commands/exports.js.map +1 -1
  10. package/dist/cli/commands/generate.d.ts +2 -13
  11. package/dist/cli/commands/generate.d.ts.map +1 -1
  12. package/dist/cli/commands/generate.js +27 -60
  13. package/dist/cli/commands/generate.js.map +1 -1
  14. package/dist/cli/commands/init.d.ts.map +1 -1
  15. package/dist/cli/commands/init.js +4 -4
  16. package/dist/cli/commands/init.js.map +1 -1
  17. package/dist/cli/commands/start.d.ts.map +1 -1
  18. package/dist/cli/commands/start.js +2 -6
  19. package/dist/cli/commands/start.js.map +1 -1
  20. package/dist/cli/index.js +11 -23
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/cli/routes.d.ts.map +1 -1
  23. package/dist/cli/routes.js +20 -8
  24. package/dist/cli/routes.js.map +1 -1
  25. package/dist/config/config.d.ts +2 -1
  26. package/dist/config/config.d.ts.map +1 -1
  27. package/dist/config/config.js +3 -2
  28. package/dist/config/config.js.map +1 -1
  29. package/dist/config/types.d.ts +7 -2
  30. package/dist/config/types.d.ts.map +1 -1
  31. package/dist/decorators/constants.d.ts +2 -2
  32. package/dist/decorators/constants.d.ts.map +1 -1
  33. package/dist/decorators/constants.js +2 -2
  34. package/dist/decorators/constants.js.map +1 -1
  35. package/dist/decorators/core.d.ts +4 -3
  36. package/dist/decorators/core.d.ts.map +1 -1
  37. package/dist/decorators/core.js +7 -4
  38. package/dist/decorators/core.js.map +1 -1
  39. package/dist/decorators/middleware.d.ts +0 -10
  40. package/dist/decorators/middleware.d.ts.map +1 -1
  41. package/dist/decorators/middleware.js +0 -25
  42. package/dist/decorators/middleware.js.map +1 -1
  43. package/dist/decorators/routing.d.ts +0 -2
  44. package/dist/decorators/routing.d.ts.map +1 -1
  45. package/dist/decorators/routing.js +1 -3
  46. package/dist/decorators/routing.js.map +1 -1
  47. package/dist/di/inject.d.ts +1 -2
  48. package/dist/di/inject.d.ts.map +1 -1
  49. package/dist/di/inject.js.map +1 -1
  50. package/dist/docs/ARCHITECTURE.md +46 -285
  51. package/dist/docs/BENCHMARKS.md +5 -5
  52. package/dist/docs/README.md +8 -11
  53. package/dist/docs/content/boundaries.mdx +151 -0
  54. package/dist/docs/content/cli/commands.mdx +66 -104
  55. package/dist/docs/content/cli/overview.mdx +37 -47
  56. package/dist/docs/content/cli/usage.mdx +29 -15
  57. package/dist/docs/content/decorators.mdx +107 -80
  58. package/dist/docs/content/installation.mdx +20 -1
  59. package/dist/docs/content/middleware.mdx +65 -291
  60. package/dist/docs/content/security.mdx +44 -246
  61. package/dist/docs/content/structure.mdx +227 -100
  62. package/dist/docs/content/validation.mdx +0 -17
  63. package/dist/docs/reference/decorators.mdx +24 -217
  64. package/dist/docs/reference/middleware.mdx +41 -217
  65. package/dist/docs/reference/validator.mdx +2 -5
  66. package/dist/error/errors.d.ts.map +1 -1
  67. package/dist/error/errors.js +16 -0
  68. package/dist/error/errors.js.map +1 -1
  69. package/dist/index.d.ts +1 -1
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +5 -2
  72. package/dist/index.js.map +1 -1
  73. package/dist/lib/start-repl.js +2 -4
  74. package/dist/lib/start-repl.js.map +1 -1
  75. package/dist/lib/start-server.js +12 -4
  76. package/dist/lib/start-server.js.map +1 -1
  77. package/dist/logger/index.d.ts +81 -0
  78. package/dist/logger/index.d.ts.map +1 -0
  79. package/dist/logger/index.js +142 -0
  80. package/dist/logger/index.js.map +1 -0
  81. package/dist/middleware/dedupe.d.ts +1 -1
  82. package/dist/middleware/dedupe.js +1 -1
  83. package/dist/middleware/middleware.d.ts +3 -5
  84. package/dist/middleware/middleware.d.ts.map +1 -1
  85. package/dist/middleware/middleware.js +2 -6
  86. package/dist/middleware/middleware.js.map +1 -1
  87. package/dist/router/{gateway.d.ts → boundary.d.ts} +21 -13
  88. package/dist/router/boundary.d.ts.map +1 -0
  89. package/dist/router/boundary.js +11 -0
  90. package/dist/router/boundary.js.map +1 -0
  91. package/dist/router/index.d.ts +3 -6
  92. package/dist/router/index.d.ts.map +1 -1
  93. package/dist/router/index.js +3 -7
  94. package/dist/router/index.js.map +1 -1
  95. package/dist/router/route-builder.d.ts +0 -28
  96. package/dist/router/route-builder.d.ts.map +1 -1
  97. package/dist/router/route-builder.js +0 -4
  98. package/dist/router/route-builder.js.map +1 -1
  99. package/dist/router/route-scanner.d.ts +1 -2
  100. package/dist/router/route-scanner.d.ts.map +1 -1
  101. package/dist/router/route-scanner.js +216 -193
  102. package/dist/router/route-scanner.js.map +1 -1
  103. package/dist/router/router.d.ts +4 -6
  104. package/dist/router/router.d.ts.map +1 -1
  105. package/dist/router/router.js +36 -72
  106. package/dist/router/router.js.map +1 -1
  107. package/dist/router/types.d.ts +2 -6
  108. package/dist/router/types.d.ts.map +1 -1
  109. package/dist/server/{bun-adapter.d.ts → adapters/bun-adapter.d.ts} +1 -1
  110. package/dist/server/adapters/bun-adapter.d.ts.map +1 -0
  111. package/dist/server/{bun-adapter.js → adapters/bun-adapter.js} +2 -24
  112. package/dist/server/adapters/bun-adapter.js.map +1 -0
  113. package/dist/server/{uws-adapter.d.ts → adapters/uws-adapter.d.ts} +1 -1
  114. package/dist/server/adapters/uws-adapter.d.ts.map +1 -0
  115. package/dist/server/{uws-adapter.js → adapters/uws-adapter.js} +1 -28
  116. package/dist/server/adapters/uws-adapter.js.map +1 -0
  117. package/dist/server/app.d.ts +9 -30
  118. package/dist/server/app.d.ts.map +1 -1
  119. package/dist/server/app.js +19 -134
  120. package/dist/server/app.js.map +1 -1
  121. package/dist/server/bootstrapper.d.ts +4 -15
  122. package/dist/server/bootstrapper.d.ts.map +1 -1
  123. package/dist/server/bootstrapper.js +31 -222
  124. package/dist/server/bootstrapper.js.map +1 -1
  125. package/dist/server/define.d.ts +2 -2
  126. package/dist/server/define.d.ts.map +1 -1
  127. package/dist/server/define.js +3 -3
  128. package/dist/server/define.js.map +1 -1
  129. package/dist/server/engines/bun-engine.d.ts +16 -0
  130. package/dist/server/engines/bun-engine.d.ts.map +1 -0
  131. package/dist/server/engines/bun-engine.js +41 -0
  132. package/dist/server/engines/bun-engine.js.map +1 -0
  133. package/dist/server/engines/engine.d.ts +16 -0
  134. package/dist/server/engines/engine.d.ts.map +1 -0
  135. package/dist/{queue/types.js → server/engines/engine.js} +1 -1
  136. package/dist/server/engines/engine.js.map +1 -0
  137. package/dist/server/engines/node-engine.d.ts +22 -0
  138. package/dist/server/engines/node-engine.d.ts.map +1 -0
  139. package/dist/server/engines/node-engine.js +130 -0
  140. package/dist/server/engines/node-engine.js.map +1 -0
  141. package/dist/server/engines/uws-engine.d.ts +16 -0
  142. package/dist/server/engines/uws-engine.d.ts.map +1 -0
  143. package/dist/server/engines/uws-engine.js +48 -0
  144. package/dist/server/engines/uws-engine.js.map +1 -0
  145. package/dist/server/request-handler.d.ts +0 -1
  146. package/dist/server/request-handler.d.ts.map +1 -1
  147. package/dist/server/request-handler.js +74 -48
  148. package/dist/server/request-handler.js.map +1 -1
  149. package/dist/server/request.d.ts +0 -8
  150. package/dist/server/request.d.ts.map +1 -1
  151. package/dist/server/request.js +0 -16
  152. package/dist/server/request.js.map +1 -1
  153. package/dist/utils/time.d.ts +6 -0
  154. package/dist/utils/time.d.ts.map +1 -0
  155. package/dist/utils/time.js +15 -0
  156. package/dist/utils/time.js.map +1 -0
  157. package/dist/validator/index.d.ts +1 -7
  158. package/dist/validator/index.d.ts.map +1 -1
  159. package/dist/validator/index.js +1 -5
  160. package/dist/validator/index.js.map +1 -1
  161. package/dist/validator/tex-types.d.ts +15 -2
  162. package/dist/validator/tex-types.d.ts.map +1 -1
  163. package/dist/validator/tex-types.js +8 -0
  164. package/dist/validator/tex-types.js.map +1 -1
  165. package/dist/validator/tex.d.ts.map +1 -1
  166. package/dist/validator/tex.js +21 -2
  167. package/dist/validator/tex.js.map +1 -1
  168. package/package.json +9 -151
  169. package/dist/adapters/aws-lambda.d.ts +0 -21
  170. package/dist/adapters/aws-lambda.d.ts.map +0 -1
  171. package/dist/adapters/aws-lambda.js +0 -125
  172. package/dist/adapters/aws-lambda.js.map +0 -1
  173. package/dist/adapters/bun.d.ts +0 -9
  174. package/dist/adapters/bun.d.ts.map +0 -1
  175. package/dist/adapters/bun.js +0 -23
  176. package/dist/adapters/bun.js.map +0 -1
  177. package/dist/adapters/cloudflare.d.ts +0 -10
  178. package/dist/adapters/cloudflare.d.ts.map +0 -1
  179. package/dist/adapters/cloudflare.js +0 -22
  180. package/dist/adapters/cloudflare.js.map +0 -1
  181. package/dist/adapters/deno.d.ts +0 -7
  182. package/dist/adapters/deno.d.ts.map +0 -1
  183. package/dist/adapters/deno.js +0 -21
  184. package/dist/adapters/deno.js.map +0 -1
  185. package/dist/adapters/fastly.d.ts +0 -6
  186. package/dist/adapters/fastly.d.ts.map +0 -1
  187. package/dist/adapters/fastly.js +0 -20
  188. package/dist/adapters/fastly.js.map +0 -1
  189. package/dist/adapters/fetch.d.ts +0 -30
  190. package/dist/adapters/fetch.d.ts.map +0 -1
  191. package/dist/adapters/fetch.js +0 -119
  192. package/dist/adapters/fetch.js.map +0 -1
  193. package/dist/adapters/index.d.ts +0 -9
  194. package/dist/adapters/index.d.ts.map +0 -1
  195. package/dist/adapters/index.js +0 -28
  196. package/dist/adapters/index.js.map +0 -1
  197. package/dist/adapters/netlify.d.ts +0 -8
  198. package/dist/adapters/netlify.d.ts.map +0 -1
  199. package/dist/adapters/netlify.js +0 -20
  200. package/dist/adapters/netlify.js.map +0 -1
  201. package/dist/adapters/vercel.d.ts +0 -17
  202. package/dist/adapters/vercel.d.ts.map +0 -1
  203. package/dist/adapters/vercel.js +0 -23
  204. package/dist/adapters/vercel.js.map +0 -1
  205. package/dist/auth/index.d.ts +0 -8
  206. package/dist/auth/index.d.ts.map +0 -1
  207. package/dist/auth/index.js +0 -49
  208. package/dist/auth/index.js.map +0 -1
  209. package/dist/auth/jwt.d.ts +0 -20
  210. package/dist/auth/jwt.d.ts.map +0 -1
  211. package/dist/auth/jwt.js +0 -59
  212. package/dist/auth/jwt.js.map +0 -1
  213. package/dist/auth/oauth/core.d.ts +0 -96
  214. package/dist/auth/oauth/core.d.ts.map +0 -1
  215. package/dist/auth/oauth/core.js +0 -203
  216. package/dist/auth/oauth/core.js.map +0 -1
  217. package/dist/auth/oauth/index.d.ts +0 -45
  218. package/dist/auth/oauth/index.d.ts.map +0 -1
  219. package/dist/auth/oauth/index.js +0 -64
  220. package/dist/auth/oauth/index.js.map +0 -1
  221. package/dist/auth/oauth/middleware.d.ts +0 -63
  222. package/dist/auth/oauth/middleware.d.ts.map +0 -1
  223. package/dist/auth/oauth/middleware.js +0 -164
  224. package/dist/auth/oauth/middleware.js.map +0 -1
  225. package/dist/auth/oauth/providers/custom.d.ts +0 -41
  226. package/dist/auth/oauth/providers/custom.d.ts.map +0 -1
  227. package/dist/auth/oauth/providers/custom.js +0 -204
  228. package/dist/auth/oauth/providers/custom.js.map +0 -1
  229. package/dist/auth/oauth/providers/discord.d.ts +0 -23
  230. package/dist/auth/oauth/providers/discord.d.ts.map +0 -1
  231. package/dist/auth/oauth/providers/discord.js +0 -130
  232. package/dist/auth/oauth/providers/discord.js.map +0 -1
  233. package/dist/auth/oauth/providers/facebook.d.ts +0 -28
  234. package/dist/auth/oauth/providers/facebook.d.ts.map +0 -1
  235. package/dist/auth/oauth/providers/facebook.js +0 -124
  236. package/dist/auth/oauth/providers/facebook.js.map +0 -1
  237. package/dist/auth/oauth/providers/github.d.ts +0 -25
  238. package/dist/auth/oauth/providers/github.d.ts.map +0 -1
  239. package/dist/auth/oauth/providers/github.js +0 -132
  240. package/dist/auth/oauth/providers/github.js.map +0 -1
  241. package/dist/auth/oauth/providers/google.d.ts +0 -23
  242. package/dist/auth/oauth/providers/google.d.ts.map +0 -1
  243. package/dist/auth/oauth/providers/google.js +0 -134
  244. package/dist/auth/oauth/providers/google.js.map +0 -1
  245. package/dist/auth/oauth/providers/microsoft.d.ts +0 -28
  246. package/dist/auth/oauth/providers/microsoft.d.ts.map +0 -1
  247. package/dist/auth/oauth/providers/microsoft.js +0 -136
  248. package/dist/auth/oauth/providers/microsoft.js.map +0 -1
  249. package/dist/auth/oauth/types.d.ts +0 -158
  250. package/dist/auth/oauth/types.d.ts.map +0 -1
  251. package/dist/auth/oauth/types.js +0 -4
  252. package/dist/auth/oauth/types.js.map +0 -1
  253. package/dist/auth/password.d.ts +0 -25
  254. package/dist/auth/password.d.ts.map +0 -1
  255. package/dist/auth/password.js +0 -93
  256. package/dist/auth/password.js.map +0 -1
  257. package/dist/auth/rbac.d.ts +0 -10
  258. package/dist/auth/rbac.d.ts.map +0 -1
  259. package/dist/auth/rbac.js +0 -34
  260. package/dist/auth/rbac.js.map +0 -1
  261. package/dist/auth/session.d.ts +0 -26
  262. package/dist/auth/session.d.ts.map +0 -1
  263. package/dist/auth/session.js +0 -134
  264. package/dist/auth/session.js.map +0 -1
  265. package/dist/cache/index.d.ts +0 -4
  266. package/dist/cache/index.d.ts.map +0 -1
  267. package/dist/cache/index.js +0 -25
  268. package/dist/cache/index.js.map +0 -1
  269. package/dist/cache/store.d.ts +0 -58
  270. package/dist/cache/store.d.ts.map +0 -1
  271. package/dist/cache/store.js +0 -298
  272. package/dist/cache/store.js.map +0 -1
  273. package/dist/cron/parser.d.ts +0 -2
  274. package/dist/cron/parser.d.ts.map +0 -1
  275. package/dist/cron/parser.js +0 -52
  276. package/dist/cron/parser.js.map +0 -1
  277. package/dist/cron/scheduler.d.ts +0 -23
  278. package/dist/cron/scheduler.d.ts.map +0 -1
  279. package/dist/cron/scheduler.js +0 -114
  280. package/dist/cron/scheduler.js.map +0 -1
  281. package/dist/database/adapters/mongodb.d.ts +0 -58
  282. package/dist/database/adapters/mongodb.d.ts.map +0 -1
  283. package/dist/database/adapters/mongodb.js +0 -264
  284. package/dist/database/adapters/mongodb.js.map +0 -1
  285. package/dist/database/adapters/mysql.d.ts +0 -27
  286. package/dist/database/adapters/mysql.d.ts.map +0 -1
  287. package/dist/database/adapters/mysql.js +0 -188
  288. package/dist/database/adapters/mysql.js.map +0 -1
  289. package/dist/database/adapters/postgres.d.ts +0 -28
  290. package/dist/database/adapters/postgres.d.ts.map +0 -1
  291. package/dist/database/adapters/postgres.js +0 -174
  292. package/dist/database/adapters/postgres.js.map +0 -1
  293. package/dist/database/adapters/sqlite.d.ts +0 -27
  294. package/dist/database/adapters/sqlite.d.ts.map +0 -1
  295. package/dist/database/adapters/sqlite.js +0 -149
  296. package/dist/database/adapters/sqlite.js.map +0 -1
  297. package/dist/database/index.d.ts +0 -42
  298. package/dist/database/index.d.ts.map +0 -1
  299. package/dist/database/index.js +0 -58
  300. package/dist/database/index.js.map +0 -1
  301. package/dist/database/manager.d.ts +0 -141
  302. package/dist/database/manager.d.ts.map +0 -1
  303. package/dist/database/manager.js +0 -337
  304. package/dist/database/manager.js.map +0 -1
  305. package/dist/database/migration.d.ts +0 -57
  306. package/dist/database/migration.d.ts.map +0 -1
  307. package/dist/database/migration.js +0 -329
  308. package/dist/database/migration.js.map +0 -1
  309. package/dist/database/query-builder.d.ts +0 -95
  310. package/dist/database/query-builder.d.ts.map +0 -1
  311. package/dist/database/query-builder.js +0 -404
  312. package/dist/database/query-builder.js.map +0 -1
  313. package/dist/database/sql/index.d.ts +0 -18
  314. package/dist/database/sql/index.d.ts.map +0 -1
  315. package/dist/database/sql/index.js +0 -74
  316. package/dist/database/sql/index.js.map +0 -1
  317. package/dist/database/sql/schema.d.ts +0 -38
  318. package/dist/database/sql/schema.d.ts.map +0 -1
  319. package/dist/database/sql/schema.js +0 -80
  320. package/dist/database/sql/schema.js.map +0 -1
  321. package/dist/database/synchronizer.d.ts +0 -12
  322. package/dist/database/synchronizer.d.ts.map +0 -1
  323. package/dist/database/synchronizer.js +0 -82
  324. package/dist/database/synchronizer.js.map +0 -1
  325. package/dist/database/types.d.ts +0 -184
  326. package/dist/database/types.d.ts.map +0 -1
  327. package/dist/database/types.js +0 -4
  328. package/dist/database/types.js.map +0 -1
  329. package/dist/dataloader/dataloader.d.ts +0 -23
  330. package/dist/dataloader/dataloader.d.ts.map +0 -1
  331. package/dist/dataloader/dataloader.js +0 -98
  332. package/dist/dataloader/dataloader.js.map +0 -1
  333. package/dist/dataloader/index.d.ts +0 -3
  334. package/dist/dataloader/index.d.ts.map +0 -1
  335. package/dist/dataloader/index.js +0 -19
  336. package/dist/dataloader/index.js.map +0 -1
  337. package/dist/dataloader/registry.d.ts +0 -17
  338. package/dist/dataloader/registry.d.ts.map +0 -1
  339. package/dist/dataloader/registry.js +0 -47
  340. package/dist/dataloader/registry.js.map +0 -1
  341. package/dist/dev/dep-graph.d.ts +0 -2
  342. package/dist/dev/dep-graph.d.ts.map +0 -1
  343. package/dist/dev/dep-graph.js +0 -111
  344. package/dist/dev/dep-graph.js.map +0 -1
  345. package/dist/dev/hot-reload.d.ts +0 -30
  346. package/dist/dev/hot-reload.d.ts.map +0 -1
  347. package/dist/dev/hot-reload.js +0 -262
  348. package/dist/dev/hot-reload.js.map +0 -1
  349. package/dist/docs/content/adapters.mdx +0 -199
  350. package/dist/docs/content/cache.mdx +0 -239
  351. package/dist/docs/content/circuit-breaker.mdx +0 -130
  352. package/dist/docs/content/cron.mdx +0 -109
  353. package/dist/docs/content/database.mdx +0 -278
  354. package/dist/docs/content/gateways.mdx +0 -376
  355. package/dist/docs/content/oauth.mdx +0 -179
  356. package/dist/docs/content/queues.mdx +0 -177
  357. package/dist/docs/content/rpc.mdx +0 -146
  358. package/dist/docs/content/sse.mdx +0 -159
  359. package/dist/docs/content/websockets.mdx +0 -289
  360. package/dist/docs/integrations/README.md +0 -23
  361. package/dist/docs/integrations/jwt.mdx +0 -151
  362. package/dist/docs/integrations/mongo.mdx +0 -183
  363. package/dist/docs/integrations/observability.mdx +0 -125
  364. package/dist/docs/integrations/openai.mdx +0 -108
  365. package/dist/docs/integrations/postgres.mdx +0 -190
  366. package/dist/docs/integrations/posthog.mdx +0 -122
  367. package/dist/docs/integrations/redis.mdx +0 -141
  368. package/dist/docs/integrations/resend.mdx +0 -117
  369. package/dist/docs/integrations/s3.mdx +0 -122
  370. package/dist/docs/integrations/swagger.mdx +0 -113
  371. package/dist/docs/reference/adapters.mdx +0 -130
  372. package/dist/docs/reference/auth.mdx +0 -183
  373. package/dist/docs/reference/cache.mdx +0 -132
  374. package/dist/docs/reference/circuit-breaker.mdx +0 -71
  375. package/dist/docs/reference/queue.mdx +0 -155
  376. package/dist/docs/reference/storage.mdx +0 -116
  377. package/dist/docs/reference/swagger.mdx +0 -132
  378. package/dist/integrations/drizzle.d.ts +0 -10
  379. package/dist/integrations/drizzle.d.ts.map +0 -1
  380. package/dist/integrations/drizzle.js +0 -34
  381. package/dist/integrations/drizzle.js.map +0 -1
  382. package/dist/integrations/jwt.d.ts +0 -12
  383. package/dist/integrations/jwt.d.ts.map +0 -1
  384. package/dist/integrations/jwt.js +0 -29
  385. package/dist/integrations/jwt.js.map +0 -1
  386. package/dist/integrations/mongodb.d.ts +0 -13
  387. package/dist/integrations/mongodb.d.ts.map +0 -1
  388. package/dist/integrations/mongodb.js +0 -48
  389. package/dist/integrations/mongodb.js.map +0 -1
  390. package/dist/integrations/mongoose.d.ts +0 -13
  391. package/dist/integrations/mongoose.d.ts.map +0 -1
  392. package/dist/integrations/mongoose.js +0 -84
  393. package/dist/integrations/mongoose.js.map +0 -1
  394. package/dist/integrations/openai.d.ts +0 -12
  395. package/dist/integrations/openai.d.ts.map +0 -1
  396. package/dist/integrations/openai.js +0 -47
  397. package/dist/integrations/openai.js.map +0 -1
  398. package/dist/integrations/postgres.d.ts +0 -13
  399. package/dist/integrations/postgres.d.ts.map +0 -1
  400. package/dist/integrations/postgres.js +0 -55
  401. package/dist/integrations/postgres.js.map +0 -1
  402. package/dist/integrations/posthog.d.ts +0 -13
  403. package/dist/integrations/posthog.d.ts.map +0 -1
  404. package/dist/integrations/posthog.js +0 -49
  405. package/dist/integrations/posthog.js.map +0 -1
  406. package/dist/integrations/prisma.d.ts +0 -10
  407. package/dist/integrations/prisma.d.ts.map +0 -1
  408. package/dist/integrations/prisma.js +0 -39
  409. package/dist/integrations/prisma.js.map +0 -1
  410. package/dist/integrations/redis.d.ts +0 -12
  411. package/dist/integrations/redis.d.ts.map +0 -1
  412. package/dist/integrations/redis.js +0 -48
  413. package/dist/integrations/redis.js.map +0 -1
  414. package/dist/integrations/resend.d.ts +0 -12
  415. package/dist/integrations/resend.d.ts.map +0 -1
  416. package/dist/integrations/resend.js +0 -47
  417. package/dist/integrations/resend.js.map +0 -1
  418. package/dist/integrations/s3.d.ts +0 -15
  419. package/dist/integrations/s3.d.ts.map +0 -1
  420. package/dist/integrations/s3.js +0 -60
  421. package/dist/integrations/s3.js.map +0 -1
  422. package/dist/integrations/supabase.d.ts +0 -13
  423. package/dist/integrations/supabase.d.ts.map +0 -1
  424. package/dist/integrations/supabase.js +0 -51
  425. package/dist/integrations/supabase.js.map +0 -1
  426. package/dist/middleware/cache.d.ts +0 -21
  427. package/dist/middleware/cache.d.ts.map +0 -1
  428. package/dist/middleware/cache.js +0 -156
  429. package/dist/middleware/cache.js.map +0 -1
  430. package/dist/observability/health.d.ts +0 -23
  431. package/dist/observability/health.d.ts.map +0 -1
  432. package/dist/observability/health.js +0 -49
  433. package/dist/observability/health.js.map +0 -1
  434. package/dist/observability/index.d.ts +0 -4
  435. package/dist/observability/index.d.ts.map +0 -1
  436. package/dist/observability/index.js +0 -10
  437. package/dist/observability/index.js.map +0 -1
  438. package/dist/observability/metrics.d.ts +0 -6
  439. package/dist/observability/metrics.d.ts.map +0 -1
  440. package/dist/observability/metrics.js +0 -60
  441. package/dist/observability/metrics.js.map +0 -1
  442. package/dist/observability/otel.d.ts +0 -27
  443. package/dist/observability/otel.d.ts.map +0 -1
  444. package/dist/observability/otel.js +0 -45
  445. package/dist/observability/otel.js.map +0 -1
  446. package/dist/observability/prometheus.d.ts +0 -30
  447. package/dist/observability/prometheus.d.ts.map +0 -1
  448. package/dist/observability/prometheus.js +0 -31
  449. package/dist/observability/prometheus.js.map +0 -1
  450. package/dist/queue/client.d.ts +0 -13
  451. package/dist/queue/client.d.ts.map +0 -1
  452. package/dist/queue/client.js +0 -83
  453. package/dist/queue/client.js.map +0 -1
  454. package/dist/queue/drivers/MemoryDriver.d.ts +0 -21
  455. package/dist/queue/drivers/MemoryDriver.d.ts.map +0 -1
  456. package/dist/queue/drivers/MemoryDriver.js +0 -176
  457. package/dist/queue/drivers/MemoryDriver.js.map +0 -1
  458. package/dist/queue/drivers/RedisDriver.d.ts +0 -19
  459. package/dist/queue/drivers/RedisDriver.d.ts.map +0 -1
  460. package/dist/queue/drivers/RedisDriver.js +0 -130
  461. package/dist/queue/drivers/RedisDriver.js.map +0 -1
  462. package/dist/queue/index.d.ts +0 -18
  463. package/dist/queue/index.d.ts.map +0 -1
  464. package/dist/queue/index.js +0 -37
  465. package/dist/queue/index.js.map +0 -1
  466. package/dist/queue/manager.d.ts +0 -18
  467. package/dist/queue/manager.d.ts.map +0 -1
  468. package/dist/queue/manager.js +0 -59
  469. package/dist/queue/manager.js.map +0 -1
  470. package/dist/queue/types.d.ts +0 -55
  471. package/dist/queue/types.d.ts.map +0 -1
  472. package/dist/queue/types.js.map +0 -1
  473. package/dist/queue/worker.d.ts +0 -18
  474. package/dist/queue/worker.d.ts.map +0 -1
  475. package/dist/queue/worker.js +0 -176
  476. package/dist/queue/worker.js.map +0 -1
  477. package/dist/router/gateway.d.ts.map +0 -1
  478. package/dist/router/gateway.js +0 -11
  479. package/dist/router/gateway.js.map +0 -1
  480. package/dist/server/bun-adapter.d.ts.map +0 -1
  481. package/dist/server/bun-adapter.js.map +0 -1
  482. package/dist/server/sse.d.ts +0 -16
  483. package/dist/server/sse.d.ts.map +0 -1
  484. package/dist/server/sse.js +0 -51
  485. package/dist/server/sse.js.map +0 -1
  486. package/dist/server/uws-adapter.d.ts.map +0 -1
  487. package/dist/server/uws-adapter.js.map +0 -1
  488. package/dist/storage/index.d.ts +0 -15
  489. package/dist/storage/index.d.ts.map +0 -1
  490. package/dist/storage/index.js +0 -7
  491. package/dist/storage/index.js.map +0 -1
  492. package/dist/swagger/index.d.ts +0 -9
  493. package/dist/swagger/index.d.ts.map +0 -1
  494. package/dist/swagger/index.js +0 -165
  495. package/dist/swagger/index.js.map +0 -1
  496. package/dist/threads/pool.d.ts +0 -14
  497. package/dist/threads/pool.d.ts.map +0 -1
  498. package/dist/threads/pool.js +0 -93
  499. package/dist/threads/pool.js.map +0 -1
  500. package/dist/threads/worker-runner.d.ts +0 -2
  501. package/dist/threads/worker-runner.d.ts.map +0 -1
  502. package/dist/threads/worker-runner.js +0 -71
  503. package/dist/threads/worker-runner.js.map +0 -1
  504. package/dist/validator/validator.d.ts +0 -360
  505. package/dist/validator/validator.d.ts.map +0 -1
  506. package/dist/validator/validator.js +0 -931
  507. package/dist/validator/validator.js.map +0 -1
  508. package/dist/websocket/orchestrator.d.ts +0 -11
  509. package/dist/websocket/orchestrator.d.ts.map +0 -1
  510. package/dist/websocket/orchestrator.js +0 -238
  511. package/dist/websocket/orchestrator.js.map +0 -1
  512. package/dist/websocket/server.d.ts +0 -66
  513. package/dist/websocket/server.d.ts.map +0 -1
  514. package/dist/websocket/server.js +0 -158
  515. package/dist/websocket/server.js.map +0 -1
  516. package/dist/websocket/socket.d.ts +0 -119
  517. package/dist/websocket/socket.d.ts.map +0 -1
  518. package/dist/websocket/socket.js +0 -242
  519. 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"}