@cudenix/cudenix 0.0.43 → 0.0.46

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 (275) hide show
  1. package/dist/core/app.d.ts +39 -0
  2. package/dist/core/app.d.ts.map +1 -0
  3. package/dist/{app.js → core/app.js} +44 -46
  4. package/dist/core/app.js.map +1 -0
  5. package/dist/core/compile.d.ts +3 -0
  6. package/dist/core/compile.d.ts.map +1 -0
  7. package/dist/{compile.js → core/compile.js} +42 -8
  8. package/dist/core/compile.js.map +1 -0
  9. package/dist/{context.d.ts → core/context.d.ts} +5 -8
  10. package/dist/core/context.d.ts.map +1 -0
  11. package/dist/{context.js → core/context.js} +1 -2
  12. package/dist/core/context.js.map +1 -0
  13. package/dist/{error.d.ts → core/error.d.ts} +9 -4
  14. package/dist/core/error.d.ts.map +1 -0
  15. package/dist/core/error.js +13 -0
  16. package/dist/core/error.js.map +1 -0
  17. package/dist/{global.d.ts → core/global.d.ts} +1 -1
  18. package/dist/core/global.d.ts.map +1 -0
  19. package/dist/core/global.js.map +1 -0
  20. package/dist/{group.d.ts → core/group.d.ts} +1 -1
  21. package/dist/core/group.d.ts.map +1 -0
  22. package/dist/core/group.js +10 -0
  23. package/dist/core/group.js.map +1 -0
  24. package/dist/core/index.d.ts +15 -0
  25. package/dist/core/index.d.ts.map +1 -0
  26. package/dist/core/index.js +15 -0
  27. package/dist/core/index.js.map +1 -0
  28. package/dist/{middleware.d.ts → core/middleware.d.ts} +2 -4
  29. package/dist/{middleware.d.ts.map → core/middleware.d.ts.map} +1 -1
  30. package/dist/core/middleware.js.map +1 -0
  31. package/dist/{module.d.ts → core/module.d.ts} +2 -9
  32. package/dist/core/module.d.ts.map +1 -0
  33. package/dist/{module.js → core/module.js} +2 -6
  34. package/dist/core/module.js.map +1 -0
  35. package/dist/core/response.d.ts +3 -0
  36. package/dist/core/response.d.ts.map +1 -0
  37. package/dist/core/response.js.map +1 -0
  38. package/dist/{route.d.ts → core/route.d.ts} +2 -5
  39. package/dist/core/route.d.ts.map +1 -0
  40. package/dist/{route.js → core/route.js} +6 -4
  41. package/dist/core/route.js.map +1 -0
  42. package/dist/{storage.d.ts → core/storage.d.ts} +1 -1
  43. package/dist/core/storage.d.ts.map +1 -0
  44. package/dist/core/storage.js.map +1 -0
  45. package/dist/{store.d.ts → core/store.d.ts} +1 -2
  46. package/dist/core/store.d.ts.map +1 -0
  47. package/dist/core/store.js.map +1 -0
  48. package/dist/{success.d.ts → core/success.d.ts} +9 -4
  49. package/dist/core/success.d.ts.map +1 -0
  50. package/dist/core/success.js +13 -0
  51. package/dist/core/success.js.map +1 -0
  52. package/dist/{validator.d.ts → core/validator.d.ts} +3 -3
  53. package/dist/core/validator.d.ts.map +1 -0
  54. package/dist/core/validator.js +9 -0
  55. package/dist/core/validator.js.map +1 -0
  56. package/dist/ecosystem/client/index.d.ts +21 -1
  57. package/dist/ecosystem/client/index.d.ts.map +1 -1
  58. package/dist/ecosystem/client/index.js +154 -1
  59. package/dist/ecosystem/client/index.js.map +1 -1
  60. package/dist/ecosystem/client/ws.js +1 -1
  61. package/dist/ecosystem/client/ws.js.map +1 -1
  62. package/dist/ecosystem/modules/compress/compression-stream.d.ts.map +1 -0
  63. package/dist/ecosystem/modules/compress/compression-stream.js.map +1 -0
  64. package/dist/ecosystem/modules/compress/index.d.ts +9 -0
  65. package/dist/ecosystem/modules/compress/index.d.ts.map +1 -0
  66. package/dist/ecosystem/modules/compress/index.js +93 -0
  67. package/dist/ecosystem/modules/compress/index.js.map +1 -0
  68. package/dist/ecosystem/modules/cors/index.d.ts +27 -0
  69. package/dist/ecosystem/modules/cors/index.d.ts.map +1 -0
  70. package/dist/ecosystem/modules/cors/index.js +66 -0
  71. package/dist/ecosystem/modules/cors/index.js.map +1 -0
  72. package/dist/ecosystem/modules/trycatch/index.d.ts +5 -0
  73. package/dist/ecosystem/modules/trycatch/index.d.ts.map +1 -0
  74. package/dist/ecosystem/modules/trycatch/index.js +14 -0
  75. package/dist/ecosystem/modules/trycatch/index.js.map +1 -0
  76. package/dist/ecosystem/{cluster/cluster.d.ts → plugins/cluster/index.d.ts} +1 -1
  77. package/dist/ecosystem/plugins/cluster/index.d.ts.map +1 -0
  78. package/dist/ecosystem/{cluster/cluster.js → plugins/cluster/index.js} +1 -1
  79. package/dist/ecosystem/plugins/cluster/index.js.map +1 -0
  80. package/dist/ecosystem/{events/events.d.ts → plugins/events/index.d.ts} +1 -1
  81. package/dist/ecosystem/plugins/events/index.d.ts.map +1 -0
  82. package/dist/ecosystem/{events/events.js → plugins/events/index.js} +1 -1
  83. package/dist/ecosystem/plugins/events/index.js.map +1 -0
  84. package/dist/ecosystem/plugins/events/types.d.ts.map +1 -0
  85. package/dist/ecosystem/plugins/events/types.js.map +1 -0
  86. package/dist/ecosystem/plugins/i18n/index.d.ts +33 -0
  87. package/dist/ecosystem/plugins/i18n/index.d.ts.map +1 -0
  88. package/dist/ecosystem/plugins/i18n/index.js +115 -0
  89. package/dist/ecosystem/plugins/i18n/index.js.map +1 -0
  90. package/dist/ecosystem/plugins/i18n/types.d.ts.map +1 -0
  91. package/dist/ecosystem/plugins/i18n/types.js.map +1 -0
  92. package/dist/ecosystem/plugins/openapi/index.d.ts +35 -0
  93. package/dist/ecosystem/plugins/openapi/index.d.ts.map +1 -0
  94. package/dist/ecosystem/plugins/openapi/index.js +159 -0
  95. package/dist/ecosystem/plugins/openapi/index.js.map +1 -0
  96. package/dist/ecosystem/plugins/openapi/scalar.d.ts.map +1 -0
  97. package/dist/ecosystem/plugins/openapi/scalar.js.map +1 -0
  98. package/dist/index.d.ts +3 -16
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +3 -15
  101. package/dist/index.js.map +1 -1
  102. package/dist/types/generator-sse.d.ts +1 -2
  103. package/dist/types/generator-sse.d.ts.map +1 -1
  104. package/dist/types/index.d.ts +1 -0
  105. package/dist/types/index.d.ts.map +1 -1
  106. package/dist/utils/{get-cookies.d.ts → cookies/get.d.ts} +1 -1
  107. package/dist/utils/cookies/get.d.ts.map +1 -0
  108. package/dist/utils/{get-cookies.js → cookies/get.js} +2 -2
  109. package/dist/utils/cookies/get.js.map +1 -0
  110. package/dist/utils/cookies/index.d.ts +2 -0
  111. package/dist/utils/cookies/index.d.ts.map +1 -0
  112. package/dist/utils/cookies/index.js +2 -0
  113. package/dist/utils/cookies/index.js.map +1 -0
  114. package/dist/utils/files/index.d.ts +2 -0
  115. package/dist/utils/files/index.d.ts.map +1 -0
  116. package/dist/utils/files/index.js +2 -0
  117. package/dist/utils/files/index.js.map +1 -0
  118. package/dist/utils/{file.d.ts → files/is-file.d.ts} +1 -1
  119. package/dist/utils/files/is-file.d.ts.map +1 -0
  120. package/dist/utils/{file.js → files/is-file.js} +1 -1
  121. package/dist/utils/files/is-file.js.map +1 -0
  122. package/dist/utils/index.d.ts +5 -0
  123. package/dist/utils/index.d.ts.map +1 -0
  124. package/dist/utils/index.js +5 -0
  125. package/dist/utils/index.js.map +1 -0
  126. package/dist/utils/objects/empty.d.ts.map +1 -0
  127. package/dist/utils/objects/empty.js.map +1 -0
  128. package/dist/utils/objects/index.d.ts +3 -0
  129. package/dist/utils/objects/index.d.ts.map +1 -0
  130. package/dist/utils/objects/index.js +3 -0
  131. package/dist/utils/objects/index.js.map +1 -0
  132. package/dist/utils/objects/merge.d.ts.map +1 -0
  133. package/dist/utils/objects/merge.js.map +1 -0
  134. package/dist/utils/standard-schema/index.d.ts +2 -0
  135. package/dist/utils/standard-schema/index.d.ts.map +1 -0
  136. package/dist/utils/standard-schema/index.js +2 -0
  137. package/dist/utils/standard-schema/index.js.map +1 -0
  138. package/dist/utils/{standard-schema.d.ts → standard-schema/validate.d.ts} +1 -1
  139. package/dist/utils/standard-schema/validate.d.ts.map +1 -0
  140. package/dist/utils/{standard-schema.js → standard-schema/validate.js} +1 -1
  141. package/dist/utils/standard-schema/validate.js.map +1 -0
  142. package/package.json +17 -17
  143. package/dist/addon.d.ts +0 -5
  144. package/dist/addon.d.ts.map +0 -1
  145. package/dist/addon.js +0 -2
  146. package/dist/addon.js.map +0 -1
  147. package/dist/app.d.ts +0 -39
  148. package/dist/app.d.ts.map +0 -1
  149. package/dist/app.js.map +0 -1
  150. package/dist/compile.d.ts +0 -4
  151. package/dist/compile.d.ts.map +0 -1
  152. package/dist/compile.js.map +0 -1
  153. package/dist/context.d.ts.map +0 -1
  154. package/dist/context.js.map +0 -1
  155. package/dist/ecosystem/client/client.d.ts +0 -26
  156. package/dist/ecosystem/client/client.d.ts.map +0 -1
  157. package/dist/ecosystem/client/client.js +0 -156
  158. package/dist/ecosystem/client/client.js.map +0 -1
  159. package/dist/ecosystem/cluster/cluster.d.ts.map +0 -1
  160. package/dist/ecosystem/cluster/cluster.js.map +0 -1
  161. package/dist/ecosystem/cluster/index.d.ts +0 -2
  162. package/dist/ecosystem/cluster/index.d.ts.map +0 -1
  163. package/dist/ecosystem/cluster/index.js +0 -2
  164. package/dist/ecosystem/cluster/index.js.map +0 -1
  165. package/dist/ecosystem/compress/compress.d.ts +0 -13
  166. package/dist/ecosystem/compress/compress.d.ts.map +0 -1
  167. package/dist/ecosystem/compress/compress.js +0 -92
  168. package/dist/ecosystem/compress/compress.js.map +0 -1
  169. package/dist/ecosystem/compress/compression-stream.d.ts.map +0 -1
  170. package/dist/ecosystem/compress/compression-stream.js.map +0 -1
  171. package/dist/ecosystem/compress/index.d.ts +0 -2
  172. package/dist/ecosystem/compress/index.d.ts.map +0 -1
  173. package/dist/ecosystem/compress/index.js +0 -2
  174. package/dist/ecosystem/compress/index.js.map +0 -1
  175. package/dist/ecosystem/cors/cors.d.ts +0 -30
  176. package/dist/ecosystem/cors/cors.d.ts.map +0 -1
  177. package/dist/ecosystem/cors/cors.js +0 -66
  178. package/dist/ecosystem/cors/cors.js.map +0 -1
  179. package/dist/ecosystem/cors/index.d.ts +0 -2
  180. package/dist/ecosystem/cors/index.d.ts.map +0 -1
  181. package/dist/ecosystem/cors/index.js +0 -2
  182. package/dist/ecosystem/cors/index.js.map +0 -1
  183. package/dist/ecosystem/events/events.d.ts.map +0 -1
  184. package/dist/ecosystem/events/events.js.map +0 -1
  185. package/dist/ecosystem/events/index.d.ts +0 -3
  186. package/dist/ecosystem/events/index.d.ts.map +0 -1
  187. package/dist/ecosystem/events/index.js +0 -3
  188. package/dist/ecosystem/events/index.js.map +0 -1
  189. package/dist/ecosystem/events/types.d.ts.map +0 -1
  190. package/dist/ecosystem/events/types.js.map +0 -1
  191. package/dist/ecosystem/i18n/i18n.d.ts +0 -36
  192. package/dist/ecosystem/i18n/i18n.d.ts.map +0 -1
  193. package/dist/ecosystem/i18n/i18n.js +0 -128
  194. package/dist/ecosystem/i18n/i18n.js.map +0 -1
  195. package/dist/ecosystem/i18n/index.d.ts +0 -3
  196. package/dist/ecosystem/i18n/index.d.ts.map +0 -1
  197. package/dist/ecosystem/i18n/index.js +0 -3
  198. package/dist/ecosystem/i18n/index.js.map +0 -1
  199. package/dist/ecosystem/i18n/types.d.ts.map +0 -1
  200. package/dist/ecosystem/i18n/types.js.map +0 -1
  201. package/dist/ecosystem/openapi/index.d.ts +0 -2
  202. package/dist/ecosystem/openapi/index.d.ts.map +0 -1
  203. package/dist/ecosystem/openapi/index.js +0 -2
  204. package/dist/ecosystem/openapi/index.js.map +0 -1
  205. package/dist/ecosystem/openapi/openapi.d.ts +0 -39
  206. package/dist/ecosystem/openapi/openapi.d.ts.map +0 -1
  207. package/dist/ecosystem/openapi/openapi.js +0 -159
  208. package/dist/ecosystem/openapi/openapi.js.map +0 -1
  209. package/dist/ecosystem/openapi/scalar.d.ts.map +0 -1
  210. package/dist/ecosystem/openapi/scalar.js.map +0 -1
  211. package/dist/ecosystem/trycatch/index.d.ts +0 -2
  212. package/dist/ecosystem/trycatch/index.d.ts.map +0 -1
  213. package/dist/ecosystem/trycatch/index.js +0 -2
  214. package/dist/ecosystem/trycatch/index.js.map +0 -1
  215. package/dist/ecosystem/trycatch/trycatch.d.ts +0 -7
  216. package/dist/ecosystem/trycatch/trycatch.d.ts.map +0 -1
  217. package/dist/ecosystem/trycatch/trycatch.js +0 -15
  218. package/dist/ecosystem/trycatch/trycatch.js.map +0 -1
  219. package/dist/error.d.ts.map +0 -1
  220. package/dist/error.js +0 -10
  221. package/dist/error.js.map +0 -1
  222. package/dist/global.d.ts.map +0 -1
  223. package/dist/global.js.map +0 -1
  224. package/dist/group.d.ts.map +0 -1
  225. package/dist/group.js +0 -10
  226. package/dist/group.js.map +0 -1
  227. package/dist/middleware.js.map +0 -1
  228. package/dist/module.d.ts.map +0 -1
  229. package/dist/module.js.map +0 -1
  230. package/dist/response.d.ts +0 -3
  231. package/dist/response.d.ts.map +0 -1
  232. package/dist/response.js.map +0 -1
  233. package/dist/route.d.ts.map +0 -1
  234. package/dist/route.js.map +0 -1
  235. package/dist/storage.d.ts.map +0 -1
  236. package/dist/storage.js.map +0 -1
  237. package/dist/store.d.ts.map +0 -1
  238. package/dist/store.js.map +0 -1
  239. package/dist/success.d.ts.map +0 -1
  240. package/dist/success.js +0 -10
  241. package/dist/success.js.map +0 -1
  242. package/dist/utils/empty.d.ts.map +0 -1
  243. package/dist/utils/empty.js.map +0 -1
  244. package/dist/utils/file.d.ts.map +0 -1
  245. package/dist/utils/file.js.map +0 -1
  246. package/dist/utils/get-cookies.d.ts.map +0 -1
  247. package/dist/utils/get-cookies.js.map +0 -1
  248. package/dist/utils/merge.d.ts.map +0 -1
  249. package/dist/utils/merge.js.map +0 -1
  250. package/dist/utils/regexp.d.ts +0 -11
  251. package/dist/utils/regexp.d.ts.map +0 -1
  252. package/dist/utils/regexp.js +0 -41
  253. package/dist/utils/regexp.js.map +0 -1
  254. package/dist/utils/standard-schema.d.ts.map +0 -1
  255. package/dist/utils/standard-schema.js.map +0 -1
  256. package/dist/validator.d.ts.map +0 -1
  257. package/dist/validator.js +0 -9
  258. package/dist/validator.js.map +0 -1
  259. /package/dist/{global.js → core/global.js} +0 -0
  260. /package/dist/{middleware.js → core/middleware.js} +0 -0
  261. /package/dist/{response.js → core/response.js} +0 -0
  262. /package/dist/{storage.js → core/storage.js} +0 -0
  263. /package/dist/{store.js → core/store.js} +0 -0
  264. /package/dist/ecosystem/{compress → modules/compress}/compression-stream.d.ts +0 -0
  265. /package/dist/ecosystem/{compress → modules/compress}/compression-stream.js +0 -0
  266. /package/dist/ecosystem/{events → plugins/events}/types.d.ts +0 -0
  267. /package/dist/ecosystem/{events → plugins/events}/types.js +0 -0
  268. /package/dist/ecosystem/{i18n → plugins/i18n}/types.d.ts +0 -0
  269. /package/dist/ecosystem/{i18n → plugins/i18n}/types.js +0 -0
  270. /package/dist/ecosystem/{openapi → plugins/openapi}/scalar.d.ts +0 -0
  271. /package/dist/ecosystem/{openapi → plugins/openapi}/scalar.js +0 -0
  272. /package/dist/utils/{empty.d.ts → objects/empty.d.ts} +0 -0
  273. /package/dist/utils/{empty.js → objects/empty.js} +0 -0
  274. /package/dist/utils/{merge.d.ts → objects/merge.d.ts} +0 -0
  275. /package/dist/utils/{merge.js → objects/merge.js} +0 -0
@@ -0,0 +1,5 @@
1
+ export declare const trycatch: () => import("../../../core/index.js").Module<import("../../../core/index.js").MergeErrors<{}, import("../../../core/index.js").TransformError<never>>, "/", {}, {}, import("../../../core/index.js").MergeSuccesses<{}, import("../../../core/index.js").TransformSuccess<never>>, {
2
+ inputs: NonNullable<unknown>;
3
+ outputs: NonNullable<unknown>;
4
+ }>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ecosystem/modules/trycatch/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;EAUpB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { error, module } from "../../../core/index.js";
2
+ export const trycatch = () => {
3
+ return module().middleware(async (context, next) => {
4
+ try {
5
+ await next();
6
+ }
7
+ catch (exception) {
8
+ return error(exception || "An unknown error has occurred.", {
9
+ status: 500,
10
+ });
11
+ }
12
+ });
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ecosystem/modules/trycatch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC5B,OAAO,MAAM,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAClD,IAAI,CAAC;YACJ,MAAM,IAAI,EAAE,CAAC;QACd,CAAC;QAAC,OAAO,SAAS,EAAE,CAAC;YACpB,OAAO,KAAK,CAAC,SAAS,IAAI,gCAAgC,EAAE;gBAC3D,MAAM,EAAE,GAAG;aACX,CAAC,CAAC;QACJ,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export declare const cluster: (command: string) => void;
2
- //# sourceMappingURL=cluster.d.ts.map
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/cluster/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,SA4BtC,CAAC"}
@@ -23,4 +23,4 @@ export const cluster = (command) => {
23
23
  process.once("SIGINT", kill);
24
24
  process.once("exit", kill);
25
25
  };
26
- //# sourceMappingURL=cluster.js.map
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/cluster/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,EAAE;IAC1C,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAC7C,OAAO;IACR,CAAC;IAED,MAAM,IAAI,GAAG,SAAS,CAAC,mBAAmB,CAAC;IAC3C,MAAM,IAAI,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;IAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC;YACnB,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC;YACxC,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,SAAS;SACjB,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,EAAE;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/B,IAAI,CAAC;gBACJ,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAChB,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;QACX,CAAC;IACF,CAAC,CAAC;IAEF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAE7B,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAC"}
@@ -6,4 +6,4 @@ export declare const Event: Constructor;
6
6
  export declare const event: <const Events extends Record<keyof Events, unknown[]> = Cudenix.Events.List>() => Event<Events>;
7
7
  export declare const events: Event<Cudenix.Events.List>;
8
8
  export {};
9
- //# sourceMappingURL=events.d.ts.map
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/events/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,KAAK,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,MAAM,EAAE,OAAO,EAAE,CAAC,IAC/D,YAAY,CAAC,MAAM,CAAC,CAAC;AAEtB,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAElC,KAAK,WAAW,GAAG,UAAU,QAAQ,CAAC;AAEtC,eAAO,MAAM,KAAK,EAEF,WAAW,CAAC;AAK5B,eAAO,MAAM,KAAK,GACjB,KAAK,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,OAEpD,KAAK,CAAC,MAAM,CAClC,CAAC;AAEF,eAAO,MAAM,MAAM,4BAAU,CAAC"}
@@ -8,4 +8,4 @@ export const event = () => {
8
8
  return new Event();
9
9
  };
10
10
  export const events = event();
11
- //# sourceMappingURL=events.js.map
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/events/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAS3C,MAAM,CAAC,MAAM,KAAK,GAAG;IACpB,OAAO,IAAI,YAAY,EAAE,CAAC;AAC3B,CAA2B,CAAC;AAE5B,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;AACxD,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,KAAK,CAAC;AAEpC,MAAM,CAAC,MAAM,KAAK,GAAG,GAEjB,EAAE;IACL,OAAO,IAAI,KAAK,EAAmB,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/events/types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,OAAO,CAAC,MAAM,CAAC;QACxB,KAAK,IAAI,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;KAC3C;CACD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/events/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ export type DeepPaths<Type extends Record<PropertyKey, unknown>> = {
2
+ [Key in keyof Type]: Key extends string ? Type[Key] extends Record<PropertyKey, unknown> ? `${Key}` | `${Key}.${DeepPaths<Type[Key]>}` : `${Key}` : never;
3
+ }[keyof Type];
4
+ export type DeepValue<Type extends Record<PropertyKey, unknown>, Path extends string> = Path extends `${infer Key}.${infer Rest}` ? Key extends keyof Type ? Type[Key] extends Record<PropertyKey, unknown> ? DeepValue<Type[Key], Rest> : never : never : Path extends keyof Type ? Type[Path] : never;
5
+ export type ExtractPlaceholders<String extends string> = String extends `${infer _Start}\${${infer Param}}${infer Rest}` ? Param | ExtractPlaceholders<Rest> : never;
6
+ export interface Translation {
7
+ [key: string]: string | Translation | (string | Translation)[];
8
+ }
9
+ export interface TranslateOptions<Translation> {
10
+ language?: string;
11
+ replace?: Translation extends string ? {
12
+ [Key in ExtractPlaceholders<Translation>]?: string;
13
+ } : undefined;
14
+ }
15
+ export interface I18n {
16
+ path: string;
17
+ cookie?: string;
18
+ header?: string;
19
+ language: string;
20
+ languages: string[];
21
+ translations: Translation;
22
+ }
23
+ export declare const replace: <Translation extends string>(translation: Translation, replace: { [Key in ExtractPlaceholders<Translation>]?: string; }) => Translation;
24
+ export declare const load: (path: string, language: string, options?: Pick<I18n, "cookie" | "header"> & {
25
+ types: boolean;
26
+ }) => Promise<void>;
27
+ export declare const getLanguage: () => string;
28
+ export declare const translate: <const Path extends DeepPaths<Cudenix.i18n.Translations>>(path: Path, { language, replace, }?: TranslateOptions<DeepValue<Cudenix.i18n.Translations, Path>>) => DeepValue<Cudenix.i18n.Translations, Path>;
29
+ export declare const i18n: () => import("../../../core/index.js").Module<import("../../../core/index.js").MergeErrors<{}, import("../../../core/index.js").TransformError<never>>, "/", {}, {}, import("../../../core/index.js").MergeSuccesses<{}, import("../../../core/index.js").TransformSuccess<never>>, {
30
+ inputs: NonNullable<unknown>;
31
+ outputs: NonNullable<unknown>;
32
+ }>;
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/i18n/index.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,SAAS,CAAC,IAAI,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI;KACjE,GAAG,IAAI,MAAM,IAAI,GAAG,GAAG,SAAS,MAAM,GACpC,IAAI,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GAC7C,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAC3C,GAAG,GAAG,EAAE,GACT,KAAK;CACR,CAAC,MAAM,IAAI,CAAC,CAAC;AAEd,MAAM,MAAM,SAAS,CACpB,IAAI,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EACzC,IAAI,SAAS,MAAM,IAChB,IAAI,SAAS,GAAG,MAAM,GAAG,IAAI,MAAM,IAAI,EAAE,GAC1C,GAAG,SAAS,MAAM,IAAI,GACrB,IAAI,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GAC7C,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAC1B,KAAK,GACN,KAAK,GACN,IAAI,SAAS,MAAM,IAAI,GACtB,IAAI,CAAC,IAAI,CAAC,GACV,KAAK,CAAC;AAEV,MAAM,MAAM,mBAAmB,CAAC,MA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EAEvD,MAAM,IAAI,EACV,yBAGG,gBAAgB,CAClB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAC5B,KACb,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAuC3C,CAAC;AAEF,eAAO,MAAM,IAAI;;;EAgBhB,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { readdir } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { getRequestContext, module } from "../../../core/index.js";
4
+ import { Empty, getCookies } from "../../../utils/index.js";
5
+ const store = new Empty();
6
+ const loadTranslations = async (directory) => {
7
+ const result = new Empty();
8
+ const entries = await readdir(directory, {
9
+ withFileTypes: true,
10
+ });
11
+ for (let i = 0; i < entries.length; i++) {
12
+ const entry = entries[i];
13
+ if (!entry) {
14
+ continue;
15
+ }
16
+ const fullPath = join(directory, entry.name);
17
+ if (entry.isDirectory()) {
18
+ result[entry.name] = await loadTranslations(fullPath);
19
+ continue;
20
+ }
21
+ if (entry.isFile() && entry.name.endsWith(".json")) {
22
+ const data = await Bun.file(fullPath).json();
23
+ if (entry.name === "index.json") {
24
+ Object.assign(result, data);
25
+ continue;
26
+ }
27
+ result[entry.name.slice(0, -5)] = data;
28
+ }
29
+ }
30
+ return result;
31
+ };
32
+ export const replace = (translation, replace) => {
33
+ const keys = Object.keys(replace);
34
+ let replaced = translation;
35
+ for (let i = 0; i < keys.length; i++) {
36
+ const key = keys[i];
37
+ if (!key) {
38
+ continue;
39
+ }
40
+ replaced = replaced.replaceAll(`\${${key}}`, replace[key] ?? "");
41
+ }
42
+ return replaced;
43
+ };
44
+ export const load = async (path, language, options) => {
45
+ const directories = await readdir(path, {
46
+ withFileTypes: true,
47
+ });
48
+ const languages = directories
49
+ .filter((directory) => {
50
+ return directory.isDirectory();
51
+ })
52
+ .map((directory) => {
53
+ return directory.name;
54
+ });
55
+ store.cookie = options?.cookie;
56
+ store.header = options?.header;
57
+ store.language = language;
58
+ store.languages = languages;
59
+ store.path = path;
60
+ store.translations = new Empty();
61
+ for (let i = 0; i < languages.length; i++) {
62
+ const language = languages[i];
63
+ if (!language) {
64
+ continue;
65
+ }
66
+ store.translations[language] = await loadTranslations(join(path, language));
67
+ }
68
+ if (options?.types !== false) {
69
+ await Bun.write(join(path, "types.d.ts"), `namespace Cudenix.i18n { interface Translations ${JSON.stringify(store.translations[language])}; };`);
70
+ }
71
+ };
72
+ export const getLanguage = () => {
73
+ return (getRequestContext()?.store.i18n
74
+ ?.language ?? store.language);
75
+ };
76
+ export const translate = (path, { language, replace, } = new Empty()) => {
77
+ const translations = store.translations[language ?? getLanguage()];
78
+ if (!translations) {
79
+ return path;
80
+ }
81
+ const split = path.split(".");
82
+ let translation = translations;
83
+ for (let i = 0; i < split.length; i++) {
84
+ const key = split[i];
85
+ if (!key) {
86
+ continue;
87
+ }
88
+ translation = translation[key] ?? "";
89
+ }
90
+ if (replace) {
91
+ const keys = Object.keys(replace);
92
+ for (let i = 0; i < keys.length; i++) {
93
+ const key = keys[i];
94
+ if (!key) {
95
+ continue;
96
+ }
97
+ translation = translation.replaceAll(`\${${key}}`, replace[key] ?? "");
98
+ }
99
+ }
100
+ return translation;
101
+ };
102
+ export const i18n = () => {
103
+ return module().middleware(({ request: { raw }, store: _store }, next) => {
104
+ const language = getCookies(raw.headers)[store.cookie ?? "Accept-Language"] ??
105
+ raw.headers.get(store.header ?? "Accept-Language") ??
106
+ getLanguage();
107
+ _store.i18n = {
108
+ language: store.languages.indexOf(language) !== -1
109
+ ? language
110
+ : getLanguage(),
111
+ };
112
+ return next();
113
+ });
114
+ };
115
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE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iB,CAAC;YAClD,WAAW,EAAE,CAAC;QAEd,MAAiD,CAAC,IAAI,GAAG;YACzD,QAAQ,EACP,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACvC,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,WAAW,EAAE;SACjB,CAAC;QAEF,OAAO,IAAI,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/i18n/types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,OAAO,CAAC,IAAI,CAAC;QACtB,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC5C;CACD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/i18n/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ import { type App } from "../../../core/index.js";
2
+ export interface OpenapiPluginOptions {
3
+ description?: string;
4
+ title?: string;
5
+ version?: string;
6
+ }
7
+ export interface OpenapiModuleOptions {
8
+ path?: `/${string}`;
9
+ }
10
+ export declare const plugin: (toJsonSchema: (schema: any) => Record<string, unknown>, { description, title, version, }?: OpenapiPluginOptions) => (this: App) => string;
11
+ export declare const openapi: ({ path }?: OpenapiModuleOptions) => import("../../../core/index.js").Module<{}, "/", {
12
+ [x: string]: {
13
+ get: {
14
+ method: "GET";
15
+ path: `/${string}`;
16
+ request: import("../../../core/index.js").MergeInferValidatorRequest<{}, import("../../../core/index.js").DeepInferValidatorInput<Partial<import("../../../core/index.js").ValidatorRequest<unknown, unknown, unknown, unknown, unknown>>>>;
17
+ response: import("../../../core/index.js").Success<string, 200, false>;
18
+ };
19
+ };
20
+ } & {
21
+ [x: string]: {
22
+ json: {
23
+ get: {
24
+ method: "GET";
25
+ path: `/${string}/json`;
26
+ request: import("../../../core/index.js").MergeInferValidatorRequest<{}, import("../../../core/index.js").DeepInferValidatorInput<Partial<import("../../../core/index.js").ValidatorRequest<unknown, unknown, unknown, unknown, unknown>>>>;
27
+ response: import("../../../core/index.js").Success<unknown, 200, true>;
28
+ };
29
+ };
30
+ };
31
+ }, {}, {}, {
32
+ inputs: NonNullable<unknown>;
33
+ outputs: NonNullable<unknown>;
34
+ }>;
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/openapi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAmB,MAAM,QAAQ,CAAC;AAInD,MAAM,WAAW,oBAAoB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACpC,IAAI,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;CACpB;AAaD,eAAO,MAAM,MAAM,GAClB,cAAc,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtD,mCAIG,oBAAkC,MAEpB,MAAM,GAAG,WAuN1B,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,WAAU,oBAAkC;;;;;;;;;;;;;;;;;;;;;;;EAuBnE,CAAC"}
@@ -0,0 +1,159 @@
1
+ import { module, success } from "../../../core/index.js";
2
+ import { scalar } from "../../../ecosystem/plugins/openapi/scalar.js";
3
+ import { Empty } from "../../../utils/index.js";
4
+ const endsWithQuestionMarkRegexp = /\?$/;
5
+ const endsWithSRegexp = /s$/;
6
+ const startsWithEllipsisRegexp = /^\.{3}/;
7
+ const startsWithSlashRegexp = /^\/{/;
8
+ const contentTypes = [
9
+ "application/json",
10
+ "multipart/form-data",
11
+ "text/plain",
12
+ ];
13
+ export const plugin = (toJsonSchema, { description = "Cudenix Documentation", title = "Cudenix Documentation", version = "0.0.1", } = new Empty()) => {
14
+ return function () {
15
+ const paths = new Empty();
16
+ const methods = Array.from(this.endpoints.keys());
17
+ const tags = new Set();
18
+ for (let i = 0; i < methods.length; i++) {
19
+ const method = methods[i];
20
+ if (!method) {
21
+ continue;
22
+ }
23
+ const endpoints = this.endpoints.get(method);
24
+ if (!endpoints) {
25
+ continue;
26
+ }
27
+ for (let j = 0; j < endpoints.length; j++) {
28
+ const endpoint = endpoints[j];
29
+ if (!endpoint) {
30
+ continue;
31
+ }
32
+ const path = endpoint.path
33
+ .replaceAll(/:(\w+)/g, "{$1}")
34
+ .replaceAll(/\.{3}(\w+)/g, "{$1}");
35
+ const operation = new Empty();
36
+ for (let k = 0; k < endpoint.chain.length; k++) {
37
+ const link = endpoint.chain[k];
38
+ if (link?.type !== "VALIDATOR") {
39
+ continue;
40
+ }
41
+ const keys = Object.keys(link.request);
42
+ for (let l = 0; l < keys.length; l++) {
43
+ const key = keys[l];
44
+ if (!key) {
45
+ continue;
46
+ }
47
+ if (key !== "body") {
48
+ const _in = key.replace(endsWithSRegexp, "");
49
+ const schema = toJsonSchema(link.request[key]);
50
+ operation.parameters ??= [];
51
+ if (schema.type === "object") {
52
+ const keys = Object.keys(schema.properties);
53
+ for (let m = 0; m < keys.length; m++) {
54
+ const key = keys[m];
55
+ if (!key) {
56
+ continue;
57
+ }
58
+ const property = schema.properties[key];
59
+ operation.parameters.push({
60
+ in: _in,
61
+ name: key,
62
+ required: schema.required?.includes(key) ?? false,
63
+ schema: property,
64
+ });
65
+ }
66
+ continue;
67
+ }
68
+ operation.parameters.push({
69
+ in: _in,
70
+ schema,
71
+ });
72
+ continue;
73
+ }
74
+ operation.requestBody ??= {
75
+ content: new Empty(),
76
+ };
77
+ for (let m = 0; m < contentTypes.length; m++) {
78
+ const contentType = contentTypes[m];
79
+ if (!contentType) {
80
+ continue;
81
+ }
82
+ operation.requestBody.content[contentType] = {
83
+ schema: toJsonSchema(link.request[key]),
84
+ };
85
+ }
86
+ }
87
+ }
88
+ const params = endpoint.path.match(/(?::|\.{3})(\w+)\??/g);
89
+ if (params) {
90
+ for (let k = 0; k < params.length; k++) {
91
+ const param = params[k];
92
+ if (!param) {
93
+ continue;
94
+ }
95
+ const name = param
96
+ .replaceAll(/^[:.]*/g, "")
97
+ .replace("?", "");
98
+ if (operation.parameters?.some((parameter) => {
99
+ return (parameter.in === "path" &&
100
+ parameter.name === name);
101
+ })) {
102
+ continue;
103
+ }
104
+ operation.parameters ??= [];
105
+ operation.parameters.push({
106
+ in: "path",
107
+ name,
108
+ required: !endsWithQuestionMarkRegexp.test(param),
109
+ schema: {
110
+ pattern: startsWithEllipsisRegexp.test(param)
111
+ ? ".*"
112
+ : undefined,
113
+ type: "string",
114
+ },
115
+ });
116
+ }
117
+ }
118
+ if (!startsWithSlashRegexp.test(path)) {
119
+ const tag = path.split("/")[1];
120
+ if (!tag) {
121
+ continue;
122
+ }
123
+ operation.tags = [tag];
124
+ tags.add(tag);
125
+ }
126
+ paths[path] ??= new Empty();
127
+ paths[path][method.toLowerCase()] =
128
+ operation;
129
+ }
130
+ }
131
+ this.memory.set("openapi", {
132
+ info: {
133
+ description,
134
+ title,
135
+ version,
136
+ },
137
+ openapi: "3.1.0",
138
+ paths,
139
+ tags: Array.from(tags).map((tag) => ({
140
+ name: tag,
141
+ })),
142
+ });
143
+ return "openapi";
144
+ };
145
+ };
146
+ export const openapi = ({ path } = new Empty()) => {
147
+ const url = `${path ?? "/openapi"}`;
148
+ return module()
149
+ .route("GET", url, ({ memory, response: { headers } }) => {
150
+ headers.set("Content-Type", "text/html");
151
+ return success(scalar("Cudenix Documentation", JSON.stringify(memory.get("openapi")), JSON.stringify({})), {
152
+ transform: false,
153
+ });
154
+ })
155
+ .route("GET", `${url}/json`, ({ memory }) => {
156
+ return success(memory.get("openapi"));
157
+ });
158
+ };
159
+ //# sourceMappingURL=index.js.map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AAC,EACrC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAClB,EACD;YACC,SAAS,EAAE,KAAK;SAChB,CACD,CAAC;IACH,CAAC,CAAC;SAED,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;QAC3C,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalar.d.ts","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/openapi/scalar.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,EAAE,MAAM,MAAM,EAAE,eAAe,MAAM,WAwBxE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalar.js","sourceRoot":"","sources":["../../../../src/ecosystem/plugins/openapi/scalar.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,aAAqB,EAAE,EAAE;IAC5E,OAAO;;;;yBAIiB,KAAK;;;;;;;;sBAQR,IAAI;;;;wFAI8D,aAAa;;;;;;KAMhG,CAAC;AACN,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,17 +1,4 @@
1
- export * from "./addon.js";
2
- export * from "./app.js";
3
- export * from "./compile.js";
4
- export * from "./context.js";
5
- export * from "./error.js";
6
- export * from "./global.js";
7
- export * from "./group.js";
8
- export * from "./middleware.js";
9
- export * from "./module.js";
10
- export * from "./response.js";
11
- export * from "./route.js";
12
- export * from "./storage.js";
13
- export * from "./store.js";
14
- export * from "./success.js";
15
- export type * from "./types/index.js";
16
- export * from "./validator.js";
1
+ export * from "./core/index.js";
2
+ export * from "./types/index.js";
3
+ export * from "./utils/index.js";
17
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,mBAAmB,SAAS,CAAC;AAC7B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,16 +1,4 @@
1
- export * from "./addon.js";
2
- export * from "./app.js";
3
- export * from "./compile.js";
4
- export * from "./context.js";
5
- export * from "./error.js";
6
- export * from "./global.js";
7
- export * from "./group.js";
8
- export * from "./middleware.js";
9
- export * from "./module.js";
10
- export * from "./response.js";
11
- export * from "./route.js";
12
- export * from "./storage.js";
13
- export * from "./store.js";
14
- export * from "./success.js";
15
- export * from "./validator.js";
1
+ export * from "./core/index.js";
2
+ export * from "./types/index.js";
3
+ export * from "./utils/index.js";
16
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAE1B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -1,5 +1,4 @@
1
- import type { AnyError } from "../error.js";
2
- import type { AnySuccess } from "../success.js";
1
+ import type { AnyError, AnySuccess } from "../core/index.js";
3
2
  export interface GeneratorSSE<Data extends AnyError | AnySuccess, Event extends string = "message"> {
4
3
  data: Data;
5
4
  event?: Event;
@@ -1 +1 @@
1
- {"version":3,"file":"generator-sse.d.ts","sourceRoot":"","sources":["../../src/types/generator-sse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,YAAY,CAC5B,IAAI,SAAS,QAAQ,GAAG,UAAU,EAClC,KAAK,SAAS,MAAM,GAAG,SAAS;IAEhC,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"generator-sse.d.ts","sourceRoot":"","sources":["../../src/types/generator-sse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEnD,MAAM,WAAW,YAAY,CAC5B,IAAI,SAAS,QAAQ,GAAG,UAAU,EAClC,KAAK,SAAS,MAAM,GAAG,SAAS;IAEhC,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC"}
@@ -6,6 +6,7 @@ export type * from "../types/extract-content.js";
6
6
  export type * from "../types/extract-url-params.js";
7
7
  export type * from "../types/generator-sse.js";
8
8
  export type * from "../types/http-method.js";
9
+ export type * from "../types/maybe-function.js";
9
10
  export type * from "../types/maybe-promise.js";
10
11
  export type * from "../types/merge.js";
11
12
  export type * from "../types/merge-paths.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,oCAAoC,CAAC;AACxD,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,oCAAoC,CAAC;AACxD,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,YAAY,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export declare const getCookies: (headers: Request["headers"]) => Record<string, string>;
2
- //# sourceMappingURL=get-cookies.d.ts.map
2
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/utils/cookies/get.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GAAI,SAAS,OAAO,CAAC,SAAS,CAAC,2BAqBrD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Empty } from "../utils/empty.js";
1
+ import { Empty } from "../../utils/objects/empty.js";
2
2
  export const getCookies = (headers) => {
3
3
  const splittedCookies = headers.get("Cookie")?.split(";");
4
4
  const cookies = new Empty();
@@ -15,4 +15,4 @@ export const getCookies = (headers) => {
15
15
  }
16
16
  return cookies;
17
17
  };
18
- //# sourceMappingURL=get-cookies.js.map
18
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/utils/cookies/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAA2B,EAAE,EAAE;IACzD,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAI,KAAK,EAA4B,CAAC;IAEtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACzD,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QAE5C,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,SAAS;QACV,CAAC;QAED,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAExC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACrB,SAAS;QACV,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "../../utils/cookies/get.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/cookies/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "../../utils/cookies/get.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/cookies/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "../../utils/files/is-file.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/files/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "../../utils/files/is-file.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/files/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}