jcc-express-mvc 1.8.7 → 1.8.21

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 (296) hide show
  1. package/Core/index.d.ts +4 -0
  2. package/Core/index.d.ts.map +1 -1
  3. package/Core/index.js +5 -0
  4. package/__tests__/Job.test.d.ts +2 -0
  5. package/__tests__/Job.test.d.ts.map +1 -0
  6. package/__tests__/Job.test.js +205 -0
  7. package/__tests__/MySqlSchemaBlueprint.test.d.ts +2 -0
  8. package/__tests__/MySqlSchemaBlueprint.test.d.ts.map +1 -0
  9. package/__tests__/MySqlSchemaBlueprint.test.js +55 -0
  10. package/__tests__/PostgresTranslator.test.d.ts +2 -0
  11. package/__tests__/PostgresTranslator.test.d.ts.map +1 -0
  12. package/__tests__/PostgresTranslator.test.js +82 -0
  13. package/__tests__/SQLiteTranslator.test.d.ts +2 -0
  14. package/__tests__/SQLiteTranslator.test.d.ts.map +1 -0
  15. package/__tests__/SQLiteTranslator.test.js +125 -0
  16. package/__tests__/SchemaAlterBlueprint.test.d.ts +2 -0
  17. package/__tests__/SchemaAlterBlueprint.test.d.ts.map +1 -0
  18. package/__tests__/SchemaAlterBlueprint.test.js +35 -0
  19. package/global.d.ts +3 -1
  20. package/index.d.ts +28 -3
  21. package/index.d.ts.map +1 -1
  22. package/index.js +33 -75
  23. package/lib/Application/Application.d.ts.map +1 -1
  24. package/lib/Application/Application.js +2 -2
  25. package/lib/Application/ApplicationBuilder.d.ts.map +1 -1
  26. package/lib/Application/ApplicationBuilder.js +22 -11
  27. package/lib/Auth/AuthMiddleware.d.ts.map +1 -1
  28. package/lib/Auth/AuthMiddleware.js +29 -12
  29. package/lib/Auth/index.d.ts +17 -3
  30. package/lib/Auth/index.d.ts.map +1 -1
  31. package/lib/Auth/index.js +128 -26
  32. package/lib/Auth/loginRateLimit.d.ts +6 -0
  33. package/lib/Auth/loginRateLimit.d.ts.map +1 -0
  34. package/lib/Auth/loginRateLimit.js +25 -0
  35. package/lib/Auth/refreshTokenStore.d.ts +24 -0
  36. package/lib/Auth/refreshTokenStore.d.ts.map +1 -0
  37. package/lib/Auth/refreshTokenStore.js +46 -0
  38. package/lib/Command-Line/DBCommand.d.ts.map +1 -1
  39. package/lib/Command-Line/DBCommand.js +9 -3
  40. package/lib/Command-Line/KeyGenerateCommand.d.ts +6 -0
  41. package/lib/Command-Line/KeyGenerateCommand.d.ts.map +1 -0
  42. package/lib/Command-Line/KeyGenerateCommand.js +47 -0
  43. package/lib/Command-Line/MakeCommand.d.ts +1 -0
  44. package/lib/Command-Line/MakeCommand.d.ts.map +1 -1
  45. package/lib/Command-Line/MakeCommand.js +36 -32
  46. package/lib/Command-Line/NodeArtisanCommand.d.ts +2 -0
  47. package/lib/Command-Line/NodeArtisanCommand.d.ts.map +1 -1
  48. package/lib/Command-Line/NodeArtisanCommand.js +24 -6
  49. package/lib/Command-Line/NodeTinker/Tinker.d.ts +5 -2
  50. package/lib/Command-Line/NodeTinker/Tinker.d.ts.map +1 -1
  51. package/lib/Command-Line/NodeTinker/Tinker.js +13 -3
  52. package/lib/Command-Line/WatchCommand.d.ts +29 -0
  53. package/lib/Command-Line/WatchCommand.d.ts.map +1 -0
  54. package/lib/Command-Line/WatchCommand.js +234 -0
  55. package/lib/Command-Line/files/Models.d.ts.map +1 -1
  56. package/lib/Command-Line/files/Models.js +67 -0
  57. package/lib/Console/Command.d.ts +18 -0
  58. package/lib/Console/Command.d.ts.map +1 -1
  59. package/lib/Console/Command.js +29 -0
  60. package/lib/Container/index.d.ts.map +1 -1
  61. package/lib/Container/index.js +22 -8
  62. package/lib/Database/Database.d.ts +21 -0
  63. package/lib/Database/Database.d.ts.map +1 -0
  64. package/lib/Database/Database.js +55 -0
  65. package/lib/Database/DatabaseServiceProvider.d.ts +22 -0
  66. package/lib/Database/DatabaseServiceProvider.d.ts.map +1 -0
  67. package/lib/Database/DatabaseServiceProvider.js +50 -0
  68. package/lib/Database/Drivers/KnexDriver.d.ts +13 -0
  69. package/lib/Database/Drivers/KnexDriver.d.ts.map +1 -0
  70. package/lib/Database/Drivers/KnexDriver.js +29 -0
  71. package/lib/Database/Drivers/MongooseDriver.d.ts +20 -0
  72. package/lib/Database/Drivers/MongooseDriver.d.ts.map +1 -0
  73. package/lib/Database/Drivers/MongooseDriver.js +57 -0
  74. package/lib/Database/Drivers/SequelizeDriver.d.ts +24 -0
  75. package/lib/Database/Drivers/SequelizeDriver.d.ts.map +1 -0
  76. package/lib/Database/Drivers/SequelizeDriver.js +82 -0
  77. package/lib/Database/index.d.ts +7 -0
  78. package/lib/Database/index.d.ts.map +1 -0
  79. package/lib/Database/index.js +11 -0
  80. package/lib/Database/interface.d.ts +14 -0
  81. package/lib/Database/interface.d.ts.map +1 -0
  82. package/lib/Database/interface.js +2 -0
  83. package/lib/Database/type.d.ts +18 -0
  84. package/lib/Database/type.d.ts.map +1 -0
  85. package/lib/Database/type.js +2 -0
  86. package/lib/Error/DisplayErrorCode.d.ts.map +1 -1
  87. package/lib/Error/DisplayErrorCode.js +27 -17
  88. package/lib/Error/MissMatchTokenException/index.d.ts +4 -0
  89. package/lib/Error/MissMatchTokenException/index.d.ts.map +1 -0
  90. package/lib/Error/MissMatchTokenException/index.js +9 -0
  91. package/lib/Error/SocialiteAuthError/SocialiteAuthError.d.ts +9 -0
  92. package/lib/Error/SocialiteAuthError/SocialiteAuthError.d.ts.map +1 -0
  93. package/lib/Error/SocialiteAuthError/SocialiteAuthError.js +17 -0
  94. package/lib/Global/helpers.d.ts.map +1 -1
  95. package/lib/Global/helpers.js +7 -6
  96. package/lib/Http/index.d.ts +3 -1
  97. package/lib/Http/index.d.ts.map +1 -1
  98. package/lib/Http/index.js +26 -5
  99. package/lib/Interface/index.d.ts +17 -3
  100. package/lib/Interface/index.d.ts.map +1 -1
  101. package/lib/Jcc-eloquent/lib/Builder.d.ts +12 -1
  102. package/lib/Jcc-eloquent/lib/Builder.d.ts.map +1 -1
  103. package/lib/Jcc-eloquent/lib/Builder.js +119 -5
  104. package/lib/Jcc-eloquent/lib/Database/index.d.ts.map +1 -1
  105. package/lib/Jcc-eloquent/lib/Database/index.js +2 -1
  106. package/lib/Jcc-eloquent/lib/Interfaces/index.d.ts +37 -2
  107. package/lib/Jcc-eloquent/lib/Interfaces/index.d.ts.map +1 -1
  108. package/lib/Jcc-eloquent/lib/Migration.d.ts +6 -0
  109. package/lib/Jcc-eloquent/lib/Migration.d.ts.map +1 -1
  110. package/lib/Jcc-eloquent/lib/Migration.js +24 -2
  111. package/lib/Jcc-eloquent/lib/Model.d.ts +24 -7
  112. package/lib/Jcc-eloquent/lib/Model.d.ts.map +1 -1
  113. package/lib/Jcc-eloquent/lib/Model.js +35 -2
  114. package/lib/Jcc-eloquent/lib/QueryBuilder.d.ts +2 -1
  115. package/lib/Jcc-eloquent/lib/QueryBuilder.d.ts.map +1 -1
  116. package/lib/Jcc-eloquent/lib/QueryBuilder.js +10 -1
  117. package/lib/Jcc-eloquent/lib/Rollback.d.ts.map +1 -1
  118. package/lib/Jcc-eloquent/lib/Rollback.js +9 -2
  119. package/lib/Jcc-eloquent/lib/Schema/BaseSchemaEntity/index.d.ts.map +1 -1
  120. package/lib/Jcc-eloquent/lib/Schema/BaseSchemaEntity/index.js +3 -3
  121. package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.d.ts +6 -2
  122. package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.d.ts.map +1 -1
  123. package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.js +41 -12
  124. package/lib/Jcc-eloquent/lib/Schema/Translator/Sqlite.d.ts.map +1 -1
  125. package/lib/Jcc-eloquent/lib/Schema/Translator/Sqlite.js +21 -3
  126. package/lib/Jcc-eloquent/lib/Schema/Translator/postgres.d.ts +1 -0
  127. package/lib/Jcc-eloquent/lib/Schema/Translator/postgres.d.ts.map +1 -1
  128. package/lib/Jcc-eloquent/lib/Schema/Translator/postgres.js +70 -14
  129. package/lib/Jcc-eloquent/lib/Schema/index.d.ts +12 -0
  130. package/lib/Jcc-eloquent/lib/Schema/index.d.ts.map +1 -1
  131. package/lib/Jcc-eloquent/lib/Schema/index.js +27 -6
  132. package/lib/Jcc-eloquent/lib/utils/index.d.ts +13 -0
  133. package/lib/Jcc-eloquent/lib/utils/index.d.ts.map +1 -1
  134. package/lib/Jcc-eloquent/lib/utils/index.js +62 -0
  135. package/lib/Middleware/index.d.ts +1 -0
  136. package/lib/Middleware/index.d.ts.map +1 -1
  137. package/lib/Middleware/index.js +20 -8
  138. package/lib/Model/Sequelize.d.ts +3 -0
  139. package/lib/Model/Sequelize.d.ts.map +1 -0
  140. package/lib/Model/Sequelize.js +6 -0
  141. package/lib/Providers/RouteServiceProvider.d.ts.map +1 -1
  142. package/lib/Providers/RouteServiceProvider.js +3 -0
  143. package/lib/Providers/SessionServiceProvider.d.ts +12 -0
  144. package/lib/Providers/SessionServiceProvider.d.ts.map +1 -0
  145. package/lib/Providers/SessionServiceProvider.js +47 -0
  146. package/lib/Queue/Controllers/QueueControllers.d.ts +31 -0
  147. package/lib/Queue/Controllers/QueueControllers.d.ts.map +1 -0
  148. package/lib/Queue/Controllers/QueueControllers.js +126 -0
  149. package/lib/Queue/Drivers/DatabaseDriver.d.ts +6 -1
  150. package/lib/Queue/Drivers/DatabaseDriver.d.ts.map +1 -1
  151. package/lib/Queue/Drivers/DatabaseDriver.js +76 -21
  152. package/lib/Queue/Drivers/MemoryDriver.d.ts +17 -6
  153. package/lib/Queue/Drivers/MemoryDriver.d.ts.map +1 -1
  154. package/lib/Queue/Drivers/MemoryDriver.js +323 -14
  155. package/lib/Queue/Drivers/RedisDriver.d.ts +48 -0
  156. package/lib/Queue/Drivers/RedisDriver.d.ts.map +1 -0
  157. package/lib/Queue/Drivers/RedisDriver.js +533 -0
  158. package/lib/Queue/Job.d.ts +8 -0
  159. package/lib/Queue/Job.d.ts.map +1 -1
  160. package/lib/Queue/Job.js +25 -1
  161. package/lib/Queue/JobsLogger.d.ts.map +1 -1
  162. package/lib/Queue/JobsLogger.js +6 -3
  163. package/lib/Queue/Queue.d.ts +17 -0
  164. package/lib/Queue/Queue.d.ts.map +1 -1
  165. package/lib/Queue/Queue.js +146 -11
  166. package/lib/Queue/QueueServiceProvider.d.ts +6 -0
  167. package/lib/Queue/QueueServiceProvider.d.ts.map +1 -0
  168. package/lib/Queue/QueueServiceProvider.js +18 -0
  169. package/lib/Queue/Route/web.d.ts +2 -0
  170. package/lib/Queue/Route/web.d.ts.map +1 -0
  171. package/lib/Queue/Route/web.js +16 -0
  172. package/lib/Queue/index.d.ts +1 -0
  173. package/lib/Queue/index.d.ts.map +1 -1
  174. package/lib/Queue/index.js +3 -0
  175. package/lib/Queue/interface.d.ts +25 -0
  176. package/lib/Queue/interface.d.ts.map +1 -1
  177. package/lib/Queue/middleware/queueDashboardGuard.d.ts +7 -0
  178. package/lib/Queue/middleware/queueDashboardGuard.d.ts.map +1 -0
  179. package/lib/Queue/middleware/queueDashboardGuard.js +43 -0
  180. package/lib/Queue/type.d.ts +12 -1
  181. package/lib/Queue/type.d.ts.map +1 -1
  182. package/lib/Response/index.d.ts.map +1 -1
  183. package/lib/Response/index.js +6 -1
  184. package/lib/Routes/Route.d.ts +2 -2
  185. package/lib/Routes/Route.d.ts.map +1 -1
  186. package/lib/Routes/RouteBuilder.d.ts +2 -2
  187. package/lib/Routes/RouteBuilder.d.ts.map +1 -1
  188. package/lib/Security/CsrfMiddleware.d.ts +37 -0
  189. package/lib/Security/CsrfMiddleware.d.ts.map +1 -0
  190. package/lib/Security/CsrfMiddleware.js +85 -0
  191. package/lib/Security/MethodSpoofingMiddleware.d.ts +36 -0
  192. package/lib/Security/MethodSpoofingMiddleware.d.ts.map +1 -0
  193. package/lib/Security/MethodSpoofingMiddleware.js +51 -0
  194. package/lib/Security/index.d.ts +5 -0
  195. package/lib/Security/index.d.ts.map +1 -0
  196. package/lib/Security/index.js +7 -0
  197. package/lib/Session/DatabaseSession.d.ts +9 -3
  198. package/lib/Session/DatabaseSession.d.ts.map +1 -1
  199. package/lib/Session/DatabaseSession.js +38 -36
  200. package/lib/Session/ExpressJccSession.d.ts +23 -0
  201. package/lib/Session/ExpressJccSession.d.ts.map +1 -0
  202. package/lib/Session/ExpressJccSession.js +110 -0
  203. package/lib/Session/RedisSession.d.ts +2 -2
  204. package/lib/Session/RedisSession.d.ts.map +1 -1
  205. package/lib/Session/RedisSession.js +19 -5
  206. package/lib/Session/SessionManager.d.ts +18 -4
  207. package/lib/Session/SessionManager.d.ts.map +1 -1
  208. package/lib/Session/SessionManager.js +53 -17
  209. package/lib/Socialite/AbstractProvider.d.ts +60 -0
  210. package/lib/Socialite/AbstractProvider.d.ts.map +1 -0
  211. package/lib/Socialite/AbstractProvider.js +136 -0
  212. package/lib/Socialite/Drivers/facebook/FacebookDriver.d.ts +9 -0
  213. package/lib/Socialite/Drivers/facebook/FacebookDriver.d.ts.map +1 -0
  214. package/lib/Socialite/Drivers/facebook/FacebookDriver.js +40 -0
  215. package/lib/Socialite/Drivers/facebook/FacebookProvider.d.ts +15 -0
  216. package/lib/Socialite/Drivers/facebook/FacebookProvider.d.ts.map +1 -0
  217. package/lib/Socialite/Drivers/facebook/FacebookProvider.js +28 -0
  218. package/lib/Socialite/Drivers/github/GitHubDriver.d.ts +9 -0
  219. package/lib/Socialite/Drivers/github/GitHubDriver.d.ts.map +1 -0
  220. package/lib/Socialite/Drivers/github/GitHubDriver.js +54 -0
  221. package/lib/Socialite/Drivers/github/GitHubProvider.d.ts +15 -0
  222. package/lib/Socialite/Drivers/github/GitHubProvider.d.ts.map +1 -0
  223. package/lib/Socialite/Drivers/github/GitHubProvider.js +28 -0
  224. package/lib/Socialite/Drivers/gitlab/GitLabDriver.d.ts +10 -0
  225. package/lib/Socialite/Drivers/gitlab/GitLabDriver.d.ts.map +1 -0
  226. package/lib/Socialite/Drivers/gitlab/GitLabDriver.js +37 -0
  227. package/lib/Socialite/Drivers/gitlab/GitLabProvider.d.ts +15 -0
  228. package/lib/Socialite/Drivers/gitlab/GitLabProvider.d.ts.map +1 -0
  229. package/lib/Socialite/Drivers/gitlab/GitLabProvider.js +28 -0
  230. package/lib/Socialite/Drivers/google/GoogleDriver.d.ts +9 -0
  231. package/lib/Socialite/Drivers/google/GoogleDriver.d.ts.map +1 -0
  232. package/lib/Socialite/Drivers/google/GoogleDriver.js +39 -0
  233. package/lib/Socialite/Drivers/google/GoogleProvider.d.ts +15 -0
  234. package/lib/Socialite/Drivers/google/GoogleProvider.d.ts.map +1 -0
  235. package/lib/Socialite/Drivers/google/GoogleProvider.js +28 -0
  236. package/lib/Socialite/Drivers/slack/SlackDriver.d.ts +9 -0
  237. package/lib/Socialite/Drivers/slack/SlackDriver.d.ts.map +1 -0
  238. package/lib/Socialite/Drivers/slack/SlackDriver.js +41 -0
  239. package/lib/Socialite/Drivers/slack/SlackProvider.d.ts +16 -0
  240. package/lib/Socialite/Drivers/slack/SlackProvider.d.ts.map +1 -0
  241. package/lib/Socialite/Drivers/slack/SlackProvider.js +37 -0
  242. package/lib/Socialite/Drivers/twitter/TwitterDriver.d.ts +9 -0
  243. package/lib/Socialite/Drivers/twitter/TwitterDriver.d.ts.map +1 -0
  244. package/lib/Socialite/Drivers/twitter/TwitterDriver.js +57 -0
  245. package/lib/Socialite/Drivers/twitter/TwitterProvider.d.ts +16 -0
  246. package/lib/Socialite/Drivers/twitter/TwitterProvider.d.ts.map +1 -0
  247. package/lib/Socialite/Drivers/twitter/TwitterProvider.js +38 -0
  248. package/lib/Socialite/SocialUser.d.ts +42 -0
  249. package/lib/Socialite/SocialUser.d.ts.map +1 -0
  250. package/lib/Socialite/SocialUser.js +116 -0
  251. package/lib/Socialite/Socialite.d.ts +13 -0
  252. package/lib/Socialite/Socialite.d.ts.map +1 -0
  253. package/lib/Socialite/Socialite.js +41 -0
  254. package/lib/Socialite/SocialiteProvider.d.ts +9 -0
  255. package/lib/Socialite/SocialiteProvider.d.ts.map +1 -0
  256. package/lib/Socialite/SocialiteProvider.js +15 -0
  257. package/lib/Socialite/config.d.ts +7 -0
  258. package/lib/Socialite/config.d.ts.map +1 -0
  259. package/lib/Socialite/config.js +44 -0
  260. package/lib/Socialite/constant.d.ts +18 -0
  261. package/lib/Socialite/constant.d.ts.map +1 -0
  262. package/lib/Socialite/constant.js +20 -0
  263. package/lib/Socialite/index.d.ts +13 -0
  264. package/lib/Socialite/index.d.ts.map +1 -0
  265. package/lib/Socialite/index.js +25 -0
  266. package/lib/Socialite/types.d.ts +13 -0
  267. package/lib/Socialite/types.d.ts.map +1 -0
  268. package/lib/Socialite/types.js +2 -0
  269. package/lib/Templating-engine/benchmark.d.ts +7 -0
  270. package/lib/Templating-engine/benchmark.d.ts.map +1 -0
  271. package/lib/Templating-engine/benchmark.js +44 -0
  272. package/lib/Templating-engine/engineHelper.d.ts +37 -8
  273. package/lib/Templating-engine/engineHelper.d.ts.map +1 -1
  274. package/lib/Templating-engine/engineHelper.js +203 -26
  275. package/lib/Templating-engine/errors.d.ts +15 -0
  276. package/lib/Templating-engine/errors.d.ts.map +1 -0
  277. package/lib/Templating-engine/errors.js +35 -0
  278. package/lib/Templating-engine/expressions.d.ts +24 -0
  279. package/lib/Templating-engine/expressions.d.ts.map +1 -1
  280. package/lib/Templating-engine/expressions.js +27 -5
  281. package/lib/Templating-engine/index.d.ts +87 -17
  282. package/lib/Templating-engine/index.d.ts.map +1 -1
  283. package/lib/Templating-engine/index.js +701 -96
  284. package/lib/Templating-engine/plugins.d.ts +30 -0
  285. package/lib/Templating-engine/plugins.d.ts.map +1 -0
  286. package/lib/Templating-engine/plugins.js +47 -0
  287. package/lib/Type/index.d.ts +1 -0
  288. package/lib/Type/index.d.ts.map +1 -1
  289. package/lib/Validation/Validator/CustomValidation.d.ts.map +1 -1
  290. package/lib/Validation/Validator/CustomValidation.js +2 -2
  291. package/lib/Validation/Validator/helper.d.ts.map +1 -1
  292. package/lib/Validation/Validator/helper.js +8 -1
  293. package/lib/util/index.d.ts +42 -1
  294. package/lib/util/index.d.ts.map +1 -1
  295. package/lib/util/index.js +154 -17
  296. package/package.json +1 -1
package/Core/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
1
  export * from "../lib/Application/Application";
2
2
  export * from "../lib/Routes/Route";
3
+ export { csrf } from "../lib/Security/CsrfMiddleware";
4
+ export type { CsrfOptions } from "../lib/Security/CsrfMiddleware";
5
+ export { methodSpoofing } from "../lib/Security/MethodSpoofingMiddleware";
6
+ export type { MethodSpoofingOptions } from "../lib/Security/MethodSpoofingMiddleware";
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../jcc-express-mvc/Core/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../jcc-express-mvc/Core/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,YAAY,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC"}
package/Core/index.js CHANGED
@@ -14,5 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.methodSpoofing = exports.csrf = void 0;
17
18
  __exportStar(require("../lib/Application/Application"), exports);
18
19
  __exportStar(require("../lib/Routes/Route"), exports);
20
+ var CsrfMiddleware_1 = require("../lib/Security/CsrfMiddleware");
21
+ Object.defineProperty(exports, "csrf", { enumerable: true, get: function () { return CsrfMiddleware_1.csrf; } });
22
+ var MethodSpoofingMiddleware_1 = require("../lib/Security/MethodSpoofingMiddleware");
23
+ Object.defineProperty(exports, "methodSpoofing", { enumerable: true, get: function () { return MethodSpoofingMiddleware_1.methodSpoofing; } });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Job.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Job.test.d.ts","sourceRoot":"","sources":["../../jcc-express-mvc/__tests__/Job.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const Job_1 = require("../lib/Queue/Job");
5
+ const Application_1 = require("../lib/Application/Application");
6
+ const ApplicationBuilder_1 = require("../lib/Application/ApplicationBuilder");
7
+ const util_1 = require("../lib/util");
8
+ class TestJob extends Job_1.Job {
9
+ async handle() {
10
+ // no-op for tests
11
+ }
12
+ }
13
+ class DelayedTestJob extends Job_1.Job {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.delay = 5;
17
+ }
18
+ async handle() {
19
+ // no-op for tests
20
+ }
21
+ }
22
+ class NestedFolderJob extends Job_1.Job {
23
+ constructor() {
24
+ super(...arguments);
25
+ this.path = "Notifications/SendEmail";
26
+ }
27
+ async handle() {
28
+ // no-op for tests
29
+ }
30
+ }
31
+ (0, vitest_1.describe)("Job", () => {
32
+ (0, vitest_1.describe)("serialize", () => {
33
+ (0, vitest_1.it)("includes job name, data, and metadata", () => {
34
+ const job = new TestJob({ value: "hello" });
35
+ const serialized = job.serialize();
36
+ const parsed = JSON.parse(serialized);
37
+ (0, vitest_1.expect)(parsed.job).toBe("TestJob");
38
+ (0, vitest_1.expect)(parsed.data).toEqual({ value: "hello" });
39
+ (0, vitest_1.expect)(parsed.displayName).toBe("TestJob");
40
+ (0, vitest_1.expect)(parsed.maxAttempts).toBe(3);
41
+ (0, vitest_1.expect)(parsed.timeout).toBe(60);
42
+ (0, vitest_1.expect)(parsed.attempts).toBe(0);
43
+ (0, vitest_1.expect)(parsed.delay).toBe(0);
44
+ });
45
+ (0, vitest_1.it)("includes delay when set", () => {
46
+ const job = new DelayedTestJob({ value: "delayed" });
47
+ const serialized = job.serialize();
48
+ const parsed = JSON.parse(serialized);
49
+ (0, vitest_1.expect)(parsed.delay).toBe(5);
50
+ });
51
+ (0, vitest_1.it)("uses default path (constructor name) when path is empty", () => {
52
+ const job = new TestJob({ value: "x" });
53
+ (0, vitest_1.expect)(job.jobPath).toBe("TestJob");
54
+ const serialized = job.serialize();
55
+ const parsed = JSON.parse(serialized);
56
+ (0, vitest_1.expect)(parsed.path).toBe("TestJob");
57
+ });
58
+ (0, vitest_1.it)("includes custom path when set for nested folders", () => {
59
+ const job = new NestedFolderJob({ value: "x" });
60
+ (0, vitest_1.expect)(job.jobPath).toBe("Notifications/SendEmail");
61
+ const serialized = job.serialize();
62
+ const parsed = JSON.parse(serialized);
63
+ (0, vitest_1.expect)(parsed.path).toBe("Notifications/SendEmail");
64
+ });
65
+ });
66
+ (0, vitest_1.describe)("fromSerialized", () => {
67
+ (0, vitest_1.it)("reconstructs job from serialized string", () => {
68
+ const job = new TestJob({ value: "restored" });
69
+ job.id = "test-id";
70
+ job.attempts = 2;
71
+ const serialized = job.serialize();
72
+ const jobClasses = { TestJob };
73
+ const restored = Job_1.Job.fromSerialized(serialized, jobClasses);
74
+ (0, vitest_1.expect)(restored).toBeInstanceOf(TestJob);
75
+ (0, vitest_1.expect)(restored.data).toEqual({ value: "restored" });
76
+ (0, vitest_1.expect)(restored.id).toBe("test-id");
77
+ (0, vitest_1.expect)(restored.attempts).toBe(2);
78
+ (0, vitest_1.expect)(restored.path).toBe("TestJob");
79
+ });
80
+ (0, vitest_1.it)("restores custom path from serialized string", () => {
81
+ const job = new NestedFolderJob({ value: "x" });
82
+ const serialized = job.serialize();
83
+ const jobClasses = { NestedFolderJob };
84
+ const restored = Job_1.Job.fromSerialized(serialized, jobClasses);
85
+ (0, vitest_1.expect)(restored.path).toBe("Notifications/SendEmail");
86
+ });
87
+ (0, vitest_1.it)("throws for unknown job class", () => {
88
+ const serialized = JSON.stringify({
89
+ job: "UnknownJob",
90
+ data: {},
91
+ id: "x",
92
+ displayName: "UnknownJob",
93
+ maxAttempts: 3,
94
+ timeout: 60,
95
+ attempts: 0,
96
+ });
97
+ (0, vitest_1.expect)(() => Job_1.Job.fromSerialized(serialized, { TestJob })).toThrow(/Unknown job class: UnknownJob/);
98
+ });
99
+ });
100
+ (0, vitest_1.describe)("backoff", () => {
101
+ (0, vitest_1.it)("returns exponential backoff in ms", () => {
102
+ const job = new TestJob({ value: "x" });
103
+ (0, vitest_1.expect)(job.backoff(0)).toBe(1000);
104
+ (0, vitest_1.expect)(job.backoff(1)).toBe(2000);
105
+ (0, vitest_1.expect)(job.backoff(2)).toBe(4000);
106
+ });
107
+ });
108
+ (0, vitest_1.describe)("dispatch", () => {
109
+ let app;
110
+ let originalApp;
111
+ (0, vitest_1.beforeEach)(() => {
112
+ app = Application_1.Application.getInstance();
113
+ originalApp = globalThis.app;
114
+ globalThis.app = app;
115
+ const config = {
116
+ queue: {
117
+ default: "memory",
118
+ connections: {
119
+ memory: { driver: "memory", queue: "default" },
120
+ },
121
+ },
122
+ };
123
+ new ApplicationBuilder_1.ApplicationBuilder(app).withConfig(config);
124
+ });
125
+ (0, vitest_1.afterEach)(() => {
126
+ globalThis.app = originalApp;
127
+ });
128
+ (0, vitest_1.it)("dispatches job to queue and returns job id", async () => {
129
+ const id = await TestJob.dispatch({ value: "dispatched" });
130
+ (0, vitest_1.expect)(id).toBeDefined();
131
+ (0, vitest_1.expect)(typeof id).toBe("string");
132
+ (0, vitest_1.expect)(id.length).toBeGreaterThan(0);
133
+ });
134
+ (0, vitest_1.it)("throws when Queue is not registered", async () => {
135
+ globalThis.app = { resolve: () => undefined };
136
+ await (0, vitest_1.expect)(TestJob.dispatch({ value: "x" })).rejects.toThrow(/Queue not registered/);
137
+ });
138
+ });
139
+ });
140
+ (0, vitest_1.describe)("Queue", () => {
141
+ let queue;
142
+ let app;
143
+ let originalApp;
144
+ (0, vitest_1.beforeEach)(() => {
145
+ app = Application_1.Application.getInstance();
146
+ originalApp = globalThis.app;
147
+ globalThis.app = app;
148
+ const config = {
149
+ queue: {
150
+ default: "memory",
151
+ connections: {
152
+ memory: { driver: "memory", queue: "default" },
153
+ },
154
+ },
155
+ };
156
+ new ApplicationBuilder_1.ApplicationBuilder(app).withConfig(config);
157
+ queue = app.resolve("Queue");
158
+ });
159
+ (0, vitest_1.afterEach)(() => {
160
+ globalThis.app = originalApp;
161
+ });
162
+ (0, vitest_1.describe)("push", () => {
163
+ (0, vitest_1.it)("stores job class (constructor) not instance for later resolution", async () => {
164
+ const job = new TestJob({ value: "push-test" });
165
+ const id = await queue.push(job);
166
+ (0, vitest_1.expect)(id).toBeDefined();
167
+ // Process the job - this would fail if we stored the instance
168
+ // because we need to instantiate a fresh job from the class
169
+ const processed = await queue.processNext();
170
+ (0, vitest_1.expect)(processed).toBe(true);
171
+ });
172
+ (0, vitest_1.it)("returns a valid uuid", async () => {
173
+ const job = new TestJob({ value: "uuid-test" });
174
+ const id = await queue.push(job);
175
+ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
176
+ (0, vitest_1.expect)(id).toMatch(uuidRegex);
177
+ });
178
+ });
179
+ (0, vitest_1.describe)("later", () => {
180
+ (0, vitest_1.it)("registers job class for delayed jobs", async () => {
181
+ const job = new TestJob({ value: "later-test" });
182
+ const id = await queue.later(job, 0);
183
+ (0, vitest_1.expect)(id).toBeDefined();
184
+ // With delay 0, job should be available immediately
185
+ const processed = await queue.processNext();
186
+ (0, vitest_1.expect)(processed).toBe(true);
187
+ });
188
+ (0, vitest_1.it)("processes job with custom path (nested folder)", async () => {
189
+ const job = new NestedFolderJob({ value: "nested-test" });
190
+ const id = await queue.push(job);
191
+ (0, vitest_1.expect)(id).toBeDefined();
192
+ // jobClasses has the class, so path is used for getJobClass fallback only
193
+ const processed = await queue.processNext();
194
+ (0, vitest_1.expect)(processed).toBe(true);
195
+ });
196
+ });
197
+ });
198
+ (0, vitest_1.describe)("getJobClass", () => {
199
+ (0, vitest_1.it)("returns false for non-existent job", () => {
200
+ const spy = vitest_1.vi.spyOn(console, "log").mockImplementation(() => { });
201
+ const result = (0, util_1.getJobClass)("NonExistentJob12345");
202
+ (0, vitest_1.expect)(result).toBe(false);
203
+ spy.mockRestore();
204
+ });
205
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=MySqlSchemaBlueprint.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MySqlSchemaBlueprint.test.d.ts","sourceRoot":"","sources":["../../jcc-express-mvc/__tests__/MySqlSchemaBlueprint.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const BluePrint_1 = require("../lib/Jcc-eloquent/lib/Schema/BluePrint");
5
+ const Translator_1 = require("../lib/Jcc-eloquent/lib/Schema/Translator");
6
+ (0, vitest_1.describe)("MySQL schema blueprint behavior", () => {
7
+ const originalDbConnection = process.env.DB_CONNECTION;
8
+ (0, vitest_1.beforeEach)(() => {
9
+ process.env.DB_CONNECTION = "mysql2";
10
+ });
11
+ (0, vitest_1.afterEach)(() => {
12
+ process.env.DB_CONNECTION = originalDbConnection;
13
+ });
14
+ (0, vitest_1.it)("builds Laravel-style index SQL for a single column", () => {
15
+ const table = new BluePrint_1.Blueprint("users");
16
+ table.index("email");
17
+ const sql = table.toSQL("CREATE", "users");
18
+ (0, vitest_1.expect)(sql).toContain("INDEX idx_users_email (email)");
19
+ });
20
+ (0, vitest_1.it)("builds Laravel-style index SQL for composite columns", () => {
21
+ const table = new BluePrint_1.Blueprint("users");
22
+ table.index(["email", "status"]);
23
+ const sql = table.toSQL("CREATE", "users");
24
+ (0, vitest_1.expect)(sql).toContain("INDEX idx_users_email_status (email, status)");
25
+ });
26
+ (0, vitest_1.it)("supports custom index names", () => {
27
+ const table = new BluePrint_1.Blueprint("users");
28
+ table.index("email", "idx_custom_email");
29
+ const sql = table.toSQL("CREATE", "users");
30
+ (0, vitest_1.expect)(sql).toContain("INDEX idx_custom_email (email)");
31
+ });
32
+ (0, vitest_1.it)("emits ADD ... AFTER for alter add-column positioning", () => {
33
+ const table = new BluePrint_1.Blueprint("users");
34
+ table.string("nickname").after("email");
35
+ const sql = table.toSQL("ALTER", "users");
36
+ (0, vitest_1.expect)(sql).toBe("ALTER TABLE users ADD nickname VARCHAR(255) NOT NULL AFTER email;");
37
+ });
38
+ (0, vitest_1.it)("emits ADD ... FIRST for alter add-column positioning", () => {
39
+ const table = new BluePrint_1.Blueprint("users");
40
+ table.string("nickname").first();
41
+ const sql = table.toSQL("ALTER", "users");
42
+ (0, vitest_1.expect)(sql).toBe("ALTER TABLE users ADD nickname VARCHAR(255) NOT NULL FIRST;");
43
+ });
44
+ (0, vitest_1.it)("applies change() as MODIFY COLUMN on the same declared column", () => {
45
+ const table = new BluePrint_1.Blueprint("users");
46
+ table.string("display_name").change();
47
+ const sql = table.toSQL("ALTER", "users");
48
+ (0, vitest_1.expect)(sql).toBe("ALTER TABLE users MODIFY COLUMN display_name VARCHAR(255) NOT NULL;");
49
+ });
50
+ (0, vitest_1.it)("keeps SQL unchanged for mysql client in Translator.compile", () => {
51
+ const raw = "ALTER TABLE users ADD nickname VARCHAR(255) NOT NULL AFTER email;";
52
+ const out = Translator_1.Translator.compile("mysql2", raw);
53
+ (0, vitest_1.expect)(out).toBe(raw);
54
+ });
55
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PostgresTranslator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgresTranslator.test.d.ts","sourceRoot":"","sources":["../../jcc-express-mvc/__tests__/PostgresTranslator.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const postgres_1 = require("../lib/Jcc-eloquent/lib/Schema/Translator/postgres");
5
+ (0, vitest_1.describe)("PostgresTranslator", () => {
6
+ (0, vitest_1.it)("translates CREATE TABLE core MySQL types and auto increment", () => {
7
+ const sql = "CREATE TABLE users (id BIGINT UNSIGNED AUTO_INCREMENT, age INT NOT NULL, score DOUBLE NOT NULL, ratio FLOAT NOT NULL, body LONGTEXT NOT NULL, data MEDIUMBLOB NOT NULL, created_at DATETIME NOT NULL);";
8
+ const out = postgres_1.PostgresTranslator.translate(sql);
9
+ (0, vitest_1.expect)(out).toContain("id BIGSERIAL");
10
+ (0, vitest_1.expect)(out).toContain("age INTEGER NOT NULL");
11
+ (0, vitest_1.expect)(out).toContain("score DOUBLE PRECISION NOT NULL");
12
+ (0, vitest_1.expect)(out).toContain("ratio REAL NOT NULL");
13
+ (0, vitest_1.expect)(out).toContain("body TEXT NOT NULL");
14
+ (0, vitest_1.expect)(out).toContain("data BYTEA NOT NULL");
15
+ (0, vitest_1.expect)(out).toContain("created_at TIMESTAMP NOT NULL");
16
+ (0, vitest_1.expect)(out).not.toContain("UNSIGNED");
17
+ (0, vitest_1.expect)(out).not.toContain("AUTO_INCREMENT");
18
+ });
19
+ (0, vitest_1.it)("converts composite UNIQUE KEY to CONSTRAINT UNIQUE", () => {
20
+ const sql = "CREATE TABLE docs (slug VARCHAR(255) NOT NULL, version_id BIGINT NOT NULL, UNIQUE KEY uk_docs_slug_version (slug, version_id));";
21
+ const out = postgres_1.PostgresTranslator.translate(sql);
22
+ (0, vitest_1.expect)(out).toContain("CONSTRAINT uk_docs_slug_version UNIQUE (slug, version_id)");
23
+ (0, vitest_1.expect)(out).not.toContain("UNIQUE KEY");
24
+ });
25
+ (0, vitest_1.it)("converts boolean numeric defaults to TRUE/FALSE", () => {
26
+ const sql = "CREATE TABLE flags (is_active BOOLEAN NOT NULL DEFAULT 1, is_public BOOLEAN DEFAULT 0, attempts INT DEFAULT 0);";
27
+ const out = postgres_1.PostgresTranslator.translate(sql);
28
+ (0, vitest_1.expect)(out).toContain("is_active BOOLEAN NOT NULL DEFAULT TRUE");
29
+ (0, vitest_1.expect)(out).toContain("is_public BOOLEAN DEFAULT FALSE");
30
+ (0, vitest_1.expect)(out).toContain("attempts INTEGER DEFAULT 0");
31
+ });
32
+ (0, vitest_1.it)("removes MySQL ON UPDATE CURRENT_TIMESTAMP and table options", () => {
33
+ const sql = "CREATE TABLE logs (updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;";
34
+ const out = postgres_1.PostgresTranslator.translate(sql);
35
+ (0, vitest_1.expect)(out).toContain("updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP");
36
+ (0, vitest_1.expect)(out).not.toContain("ON UPDATE CURRENT_TIMESTAMP");
37
+ (0, vitest_1.expect)(out).not.toContain("ENGINE=");
38
+ (0, vitest_1.expect)(out).not.toContain("DEFAULT CHARSET=");
39
+ (0, vitest_1.expect)(out).not.toContain("COLLATE=");
40
+ });
41
+ (0, vitest_1.it)("removes MySQL inline INDEX/KEY clauses inside CREATE TABLE", () => {
42
+ const sql = "CREATE TABLE users (id BIGINT UNSIGNED AUTO_INCREMENT, email VARCHAR(255) NOT NULL, INDEX idx_users_email (email), KEY idx_users_email2 (email));";
43
+ const out = postgres_1.PostgresTranslator.translate(sql);
44
+ (0, vitest_1.expect)(out).not.toContain("INDEX idx_users_email");
45
+ (0, vitest_1.expect)(out).not.toContain("KEY idx_users_email2");
46
+ (0, vitest_1.expect)(out).not.toMatch(/,\s*\)/);
47
+ });
48
+ (0, vitest_1.it)("converts ALTER TABLE drop foreign/index to drop constraint", () => {
49
+ const sql = "ALTER TABLE posts DROP FOREIGN KEY fk_posts_user, DROP INDEX idx_posts_title;";
50
+ const out = postgres_1.PostgresTranslator.translate(sql);
51
+ (0, vitest_1.expect)(out).toContain("DROP CONSTRAINT fk_posts_user");
52
+ (0, vitest_1.expect)(out).toContain("DROP CONSTRAINT idx_posts_title");
53
+ });
54
+ (0, vitest_1.it)("converts ALTER TABLE MODIFY COLUMN with nullability/default", () => {
55
+ const sql = "ALTER TABLE users MODIFY COLUMN is_active BOOLEAN NOT NULL DEFAULT 1;";
56
+ const out = postgres_1.PostgresTranslator.translate(sql);
57
+ (0, vitest_1.expect)(out).toContain("ALTER COLUMN is_active TYPE BOOLEAN");
58
+ (0, vitest_1.expect)(out).toContain("ALTER COLUMN is_active SET NOT NULL");
59
+ (0, vitest_1.expect)(out).toContain("ALTER COLUMN is_active SET DEFAULT TRUE");
60
+ });
61
+ (0, vitest_1.it)("converts ALTER TABLE CHANGE COLUMN with rename/type/default", () => {
62
+ const sql = "ALTER TABLE users CHANGE COLUMN old_name name VARCHAR(255) NOT NULL DEFAULT 'guest';";
63
+ const out = postgres_1.PostgresTranslator.translate(sql);
64
+ (0, vitest_1.expect)(out).toContain("RENAME COLUMN old_name TO name");
65
+ (0, vitest_1.expect)(out).toContain("ALTER COLUMN name TYPE VARCHAR(255)");
66
+ (0, vitest_1.expect)(out).toContain("ALTER COLUMN name SET NOT NULL");
67
+ (0, vitest_1.expect)(out).toContain("ALTER COLUMN name SET DEFAULT 'guest'");
68
+ });
69
+ (0, vitest_1.it)("removes MySQL-only ALTER hints AFTER/FIRST", () => {
70
+ const sql = "ALTER TABLE users MODIFY COLUMN score INT NOT NULL AFTER id, MODIFY COLUMN rank INT NOT NULL FIRST;";
71
+ const out = postgres_1.PostgresTranslator.translate(sql);
72
+ (0, vitest_1.expect)(out).not.toContain("AFTER id");
73
+ (0, vitest_1.expect)(out).not.toContain(" FIRST");
74
+ (0, vitest_1.expect)(out).toContain("ALTER COLUMN score TYPE INTEGER");
75
+ (0, vitest_1.expect)(out).toContain("ALTER COLUMN rank TYPE INTEGER");
76
+ });
77
+ (0, vitest_1.it)("removes backticks and replaces question marks with positional params", () => {
78
+ const sql = "SELECT * FROM `users` WHERE `id` = ? AND `email` = ?;";
79
+ const out = postgres_1.PostgresTranslator.translate(sql);
80
+ (0, vitest_1.expect)(out).toBe("SELECT * FROM users WHERE id = $1 AND email = $2;");
81
+ });
82
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SQLiteTranslator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SQLiteTranslator.test.d.ts","sourceRoot":"","sources":["../../jcc-express-mvc/__tests__/SQLiteTranslator.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const Sqlite_1 = require("../lib/Jcc-eloquent/lib/Schema/Translator/Sqlite");
5
+ (0, vitest_1.describe)("SQLiteTranslator", () => {
6
+ (0, vitest_1.it)("translates integer and float family types", () => {
7
+ const sql = "CREATE TABLE nums (a TINYINT, b SMALLINT, c MEDIUMINT, d INT, e BIGINT, f FLOAT(8,2), g DOUBLE(10,2), h DECIMAL(12,4));";
8
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
9
+ (0, vitest_1.expect)(out).toContain("a INTEGER");
10
+ (0, vitest_1.expect)(out).toContain("b INTEGER");
11
+ (0, vitest_1.expect)(out).toContain("c INTEGER");
12
+ (0, vitest_1.expect)(out).toContain("d INTEGER");
13
+ (0, vitest_1.expect)(out).toContain("e INTEGER");
14
+ (0, vitest_1.expect)(out).toContain("f REAL");
15
+ (0, vitest_1.expect)(out).toContain("g REAL");
16
+ (0, vitest_1.expect)(out).toContain("h REAL");
17
+ });
18
+ (0, vitest_1.it)("translates text and binary families", () => {
19
+ const sql = "CREATE TABLE docs (a CHAR(36), b VARCHAR(255), c TINYTEXT, d MEDIUMTEXT, e LONGTEXT, f BINARY(8), g VARBINARY(255), h MEDIUMBLOB, i LONGBLOB);";
20
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
21
+ (0, vitest_1.expect)(out).toContain("a TEXT");
22
+ (0, vitest_1.expect)(out).toContain("b TEXT");
23
+ (0, vitest_1.expect)(out).toContain("c TEXT");
24
+ (0, vitest_1.expect)(out).toContain("d TEXT");
25
+ (0, vitest_1.expect)(out).toContain("e TEXT");
26
+ (0, vitest_1.expect)(out).toContain("f BLOB");
27
+ (0, vitest_1.expect)(out).toContain("g BLOB");
28
+ (0, vitest_1.expect)(out).toContain("h BLOB");
29
+ (0, vitest_1.expect)(out).toContain("i BLOB");
30
+ });
31
+ (0, vitest_1.it)("translates date/time and special types", () => {
32
+ const sql = "CREATE TABLE meta (a DATETIME, b TIMESTAMP, c DATE, d TIME, e YEAR, f ENUM('a','b'), g SET('x','y'), h BOOLEAN, i JSON);";
33
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
34
+ (0, vitest_1.expect)(out).toContain("a TEXT");
35
+ (0, vitest_1.expect)(out).toContain("b TEXT");
36
+ (0, vitest_1.expect)(out).toContain("c TEXT");
37
+ (0, vitest_1.expect)(out).toContain("d TEXT");
38
+ (0, vitest_1.expect)(out).toContain("e INTEGER");
39
+ (0, vitest_1.expect)(out).toContain("f TEXT");
40
+ (0, vitest_1.expect)(out).toContain("g TEXT");
41
+ (0, vitest_1.expect)(out).toContain("h INTEGER");
42
+ (0, vitest_1.expect)(out).toContain("i TEXT");
43
+ });
44
+ (0, vitest_1.it)("removes mysql table options and unsupported modifiers", () => {
45
+ const sql = "CREATE TABLE users (id INT UNSIGNED ZEROFILL AUTO_INCREMENT, name VARCHAR(255)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;";
46
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
47
+ (0, vitest_1.expect)(out).toContain("id INTEGER AUTOINCREMENT");
48
+ (0, vitest_1.expect)(out).not.toContain("UNSIGNED");
49
+ (0, vitest_1.expect)(out).not.toContain("ZEROFILL");
50
+ (0, vitest_1.expect)(out).not.toContain("ENGINE=");
51
+ (0, vitest_1.expect)(out).not.toContain("DEFAULT CHARSET=");
52
+ (0, vitest_1.expect)(out).not.toContain("COLLATE ");
53
+ (0, vitest_1.expect)(out).not.toContain("ROW_FORMAT=");
54
+ });
55
+ (0, vitest_1.it)("converts mysql functions and limit syntax", () => {
56
+ const sql = "SELECT DATE_FORMAT(created_at, '%Y-%m-%d'), NOW(), IFNULL(name, 'n/a'), SUBSTRING(title,1,3), CONVERT(age, SIGNED) FROM users LIMIT 10, 20;";
57
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
58
+ (0, vitest_1.expect)(out).toContain("strftime('%Y-%m-%d', created_at)");
59
+ (0, vitest_1.expect)(out).toContain("datetime('now', 'localtime')");
60
+ (0, vitest_1.expect)(out).toContain("COALESCE(name, 'n/a')");
61
+ (0, vitest_1.expect)(out).toContain("SUBSTR(title,1,3)");
62
+ (0, vitest_1.expect)(out).toContain("CAST(age AS SIGNED)");
63
+ (0, vitest_1.expect)(out).toContain("LIMIT 20 OFFSET 10");
64
+ });
65
+ (0, vitest_1.it)("converts DATE_ADD and DATE_SUB", () => {
66
+ const sql = "SELECT DATE_ADD(created_at, INTERVAL 7 DAY), DATE_SUB(created_at, INTERVAL 2 MONTH) FROM users;";
67
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
68
+ (0, vitest_1.expect)(out).toContain("datetime(created_at, '+7 days')");
69
+ (0, vitest_1.expect)(out).toContain("datetime(created_at, '-2 months')");
70
+ });
71
+ (0, vitest_1.it)("strips backticks and normalizes IF NOT EXISTS", () => {
72
+ const sql = "CREATE TABLE IF NOT EXISTS `users` (`id` INT, `name` VARCHAR(255));";
73
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
74
+ (0, vitest_1.expect)(out).toContain("CREATE TABLE IF NOT EXISTS users");
75
+ (0, vitest_1.expect)(out).not.toContain("`");
76
+ });
77
+ (0, vitest_1.it)("keeps foreign keys and moves them after columns", () => {
78
+ const sql = "CREATE TABLE posts (id INT, user_id INT, FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, title VARCHAR(255));";
79
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
80
+ const idxTitle = out.indexOf("title TEXT");
81
+ const idxFk = out.indexOf("FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE");
82
+ (0, vitest_1.expect)(idxTitle).toBeGreaterThan(-1);
83
+ (0, vitest_1.expect)(idxFk).toBeGreaterThan(-1);
84
+ (0, vitest_1.expect)(idxFk).toBeGreaterThan(idxTitle);
85
+ });
86
+ (0, vitest_1.it)("converts key declarations to index", () => {
87
+ const sql = "CREATE TABLE users (email VARCHAR(255), KEY idx_users_email (email));";
88
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
89
+ (0, vitest_1.expect)(out).toContain("INDEX idx_users_email(email)");
90
+ });
91
+ (0, vitest_1.it)("converts multi-column key declarations to index", () => {
92
+ const sql = "CREATE TABLE users (email VARCHAR(255), role VARCHAR(50), KEY idx_users_email_role (email, role));";
93
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
94
+ (0, vitest_1.expect)(out).toContain("INDEX idx_users_email_role(email, role)");
95
+ });
96
+ (0, vitest_1.it)("rewrites unsupported ALTER MODIFY with guidance comment", () => {
97
+ const sql = "ALTER TABLE users MODIFY COLUMN name VARCHAR(100);";
98
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
99
+ (0, vitest_1.expect)(out).toContain("SQLite doesn't support MODIFY COLUMN directly");
100
+ (0, vitest_1.expect)(out).toContain("ALTER TABLE users attempted to modify column name");
101
+ });
102
+ (0, vitest_1.it)("rewrites unsupported ALTER CHANGE with guidance comment", () => {
103
+ const sql = "ALTER TABLE users CHANGE COLUMN old_name name VARCHAR(100) NOT NULL;";
104
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
105
+ (0, vitest_1.expect)(out).toContain("SQLite doesn't support CHANGE COLUMN directly");
106
+ (0, vitest_1.expect)(out).toContain("ALTER TABLE users attempted to change column old_name to name");
107
+ });
108
+ (0, vitest_1.it)("rewrites ALTER TABLE DROP COLUMN with guidance comment", () => {
109
+ const sql = "ALTER TABLE users DROP COLUMN middle_name;";
110
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
111
+ (0, vitest_1.expect)(out).toContain("Safer cross-version approach is table rebuild");
112
+ (0, vitest_1.expect)(out).toContain("ALTER TABLE users attempted to drop column middle_name");
113
+ });
114
+ (0, vitest_1.it)("rewrites ALTER TABLE DROP INDEX to SQLite DROP INDEX", () => {
115
+ const sql = "ALTER TABLE users DROP INDEX idx_users_email;";
116
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
117
+ (0, vitest_1.expect)(out).toContain("DROP INDEX IF EXISTS idx_users_email;");
118
+ });
119
+ (0, vitest_1.it)("rewrites ALTER TABLE DROP FOREIGN KEY with rebuild guidance", () => {
120
+ const sql = "ALTER TABLE users DROP FOREIGN KEY fk_users_roles;";
121
+ const out = Sqlite_1.SQLiteTranslator.translate(sql);
122
+ (0, vitest_1.expect)(out).toContain("doesn't support dropping a foreign key constraint directly");
123
+ (0, vitest_1.expect)(out).toContain("ALTER TABLE users attempted to drop foreign key fk_users_roles");
124
+ });
125
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SchemaAlterBlueprint.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaAlterBlueprint.test.d.ts","sourceRoot":"","sources":["../../jcc-express-mvc/__tests__/SchemaAlterBlueprint.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const BluePrint_1 = require("../lib/Jcc-eloquent/lib/Schema/BluePrint");
5
+ (0, vitest_1.describe)("Schema ALTER blueprint behavior", () => {
6
+ const originalDbConnection = process.env.DB_CONNECTION;
7
+ (0, vitest_1.beforeEach)(() => {
8
+ // Use mysql-like output to assert raw ALTER SQL shape.
9
+ process.env.DB_CONNECTION = "mysql2";
10
+ });
11
+ (0, vitest_1.afterEach)(() => {
12
+ process.env.DB_CONNECTION = originalDbConnection;
13
+ });
14
+ (0, vitest_1.it)("adds ADD prefix for new column with after()", () => {
15
+ const table = new BluePrint_1.Blueprint("users");
16
+ table.string("nickname").after("email");
17
+ const sql = table.toSQL("ALTER", "users");
18
+ (0, vitest_1.expect)(sql).toContain("ALTER TABLE users ADD nickname VARCHAR(255) NOT NULL AFTER email;");
19
+ });
20
+ (0, vitest_1.it)("adds ADD prefix for new column with first()", () => {
21
+ const table = new BluePrint_1.Blueprint("users");
22
+ table.string("nickname").first();
23
+ const sql = table.toSQL("ALTER", "users");
24
+ (0, vitest_1.expect)(sql).toContain("ALTER TABLE users ADD nickname VARCHAR(255) NOT NULL FIRST;");
25
+ });
26
+ (0, vitest_1.it)("change() applies MODIFY COLUMN to the last declared column", () => {
27
+ const table = new BluePrint_1.Blueprint("users");
28
+ table.string("first_col");
29
+ table.string("last_col").change();
30
+ const sql = table.toSQL("ALTER", "users");
31
+ (0, vitest_1.expect)(sql).toContain("ADD first_col VARCHAR(255) NOT NULL");
32
+ (0, vitest_1.expect)(sql).toContain("MODIFY COLUMN last_col VARCHAR(255) NOT NULL");
33
+ (0, vitest_1.expect)(sql).not.toContain("MODIFY COLUMN first_col");
34
+ });
35
+ });
package/global.d.ts CHANGED
@@ -15,6 +15,7 @@ import { Queue } from "./lib/Queue";
15
15
  import { Container } from "./lib/Container";
16
16
  import { Carbon } from "./lib/Date";
17
17
  import { GateFacade } from "./lib/Authorization";
18
+ import { Authentication as Auth } from "./lib/Auth/index";
18
19
 
19
20
  declare global {
20
21
  var app: Container;
@@ -32,7 +33,7 @@ declare global {
32
33
  var request: () => Request;
33
34
  var response: () => Response;
34
35
  var next: () => Next;
35
- var auth: () => Request["user"];
36
+ var auth: () => typeof Auth;
36
37
 
37
38
  var view: (
38
39
  view: string,
@@ -58,6 +59,7 @@ declare global {
58
59
  var Gate: typeof GateFacade;
59
60
  var can: typeof GateFacade.can;
60
61
  var authorize: typeof GateFacade.authorize;
62
+ var session: () => Request["jccSession"];
61
63
  }
62
64
 
63
65
  export {};