jcc-express-mvc 1.8.8 → 1.8.22

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 (237) hide show
  1. package/__tests__/MySqlSchemaBlueprint.test.d.ts +2 -0
  2. package/__tests__/MySqlSchemaBlueprint.test.d.ts.map +1 -0
  3. package/__tests__/MySqlSchemaBlueprint.test.js +55 -0
  4. package/__tests__/PostgresTranslator.test.d.ts +2 -0
  5. package/__tests__/PostgresTranslator.test.d.ts.map +1 -0
  6. package/__tests__/PostgresTranslator.test.js +82 -0
  7. package/__tests__/SQLiteTranslator.test.d.ts +2 -0
  8. package/__tests__/SQLiteTranslator.test.d.ts.map +1 -0
  9. package/__tests__/SQLiteTranslator.test.js +125 -0
  10. package/__tests__/SchemaAlterBlueprint.test.d.ts +2 -0
  11. package/__tests__/SchemaAlterBlueprint.test.d.ts.map +1 -0
  12. package/__tests__/SchemaAlterBlueprint.test.js +35 -0
  13. package/global.d.ts +3 -1
  14. package/index.d.ts +28 -3
  15. package/index.d.ts.map +1 -1
  16. package/index.js +33 -75
  17. package/lib/Application/Application.d.ts +1 -1
  18. package/lib/Application/Application.d.ts.map +1 -1
  19. package/lib/Application/Application.js +2 -2
  20. package/lib/Application/ApplicationBuilder.d.ts.map +1 -1
  21. package/lib/Application/ApplicationBuilder.js +9 -2
  22. package/lib/Auth/Auth.d.ts +1 -1
  23. package/lib/Auth/Auth.js +1 -1
  24. package/lib/Auth/AuthMiddleware.d.ts.map +1 -1
  25. package/lib/Auth/AuthMiddleware.js +30 -13
  26. package/lib/Auth/index.d.ts +17 -3
  27. package/lib/Auth/index.d.ts.map +1 -1
  28. package/lib/Auth/index.js +128 -26
  29. package/lib/Auth/loginRateLimit.d.ts +6 -0
  30. package/lib/Auth/loginRateLimit.d.ts.map +1 -0
  31. package/lib/Auth/loginRateLimit.js +25 -0
  32. package/lib/Auth/refreshTokenStore.d.ts +24 -0
  33. package/lib/Auth/refreshTokenStore.d.ts.map +1 -0
  34. package/lib/Auth/refreshTokenStore.js +46 -0
  35. package/lib/Cache/RedisDriver.d.ts +1 -0
  36. package/lib/Cache/RedisDriver.d.ts.map +1 -1
  37. package/lib/Cache/RedisDriver.js +5 -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/NodeArtisanCommand.d.ts +2 -0
  44. package/lib/Command-Line/NodeArtisanCommand.d.ts.map +1 -1
  45. package/lib/Command-Line/NodeArtisanCommand.js +20 -3
  46. package/lib/Command-Line/NodeTinker/Tinker.d.ts +5 -2
  47. package/lib/Command-Line/NodeTinker/Tinker.d.ts.map +1 -1
  48. package/lib/Command-Line/NodeTinker/Tinker.js +13 -3
  49. package/lib/Command-Line/WatchCommand.d.ts +29 -0
  50. package/lib/Command-Line/WatchCommand.d.ts.map +1 -0
  51. package/lib/Command-Line/WatchCommand.js +234 -0
  52. package/lib/Command-Line/files/Models.d.ts.map +1 -1
  53. package/lib/Command-Line/files/Models.js +41 -16
  54. package/lib/Console/Command.d.ts +18 -0
  55. package/lib/Console/Command.d.ts.map +1 -1
  56. package/lib/Console/Command.js +29 -0
  57. package/lib/Container/index.d.ts.map +1 -1
  58. package/lib/Container/index.js +21 -7
  59. package/lib/Database/Database.d.ts +2 -1
  60. package/lib/Database/Database.d.ts.map +1 -1
  61. package/lib/Database/Database.js +6 -5
  62. package/lib/Database/DatabaseServiceProvider.d.ts +0 -4
  63. package/lib/Database/DatabaseServiceProvider.d.ts.map +1 -1
  64. package/lib/Database/DatabaseServiceProvider.js +9 -56
  65. package/lib/Database/Drivers/MongooseDriver.d.ts +2 -0
  66. package/lib/Database/Drivers/MongooseDriver.d.ts.map +1 -1
  67. package/lib/Database/Drivers/MongooseDriver.js +11 -13
  68. package/lib/Database/Drivers/SequelizeDriver.d.ts +9 -1
  69. package/lib/Database/Drivers/SequelizeDriver.d.ts.map +1 -1
  70. package/lib/Database/Drivers/SequelizeDriver.js +43 -18
  71. package/lib/Error/SocialiteAuthError/SocialiteAuthError.d.ts +9 -0
  72. package/lib/Error/SocialiteAuthError/SocialiteAuthError.d.ts.map +1 -0
  73. package/lib/Error/SocialiteAuthError/SocialiteAuthError.js +17 -0
  74. package/lib/Event/Event.d.ts.map +1 -1
  75. package/lib/Event/Event.js +10 -5
  76. package/lib/Global/helpers.d.ts.map +1 -1
  77. package/lib/Global/helpers.js +6 -4
  78. package/lib/Http/index.d.ts +3 -1
  79. package/lib/Http/index.d.ts.map +1 -1
  80. package/lib/Http/index.js +26 -5
  81. package/lib/Interface/index.d.ts +12 -3
  82. package/lib/Interface/index.d.ts.map +1 -1
  83. package/lib/Jcc-eloquent/lib/Builder.d.ts +14 -8
  84. package/lib/Jcc-eloquent/lib/Builder.d.ts.map +1 -1
  85. package/lib/Jcc-eloquent/lib/Builder.js +127 -60
  86. package/lib/Jcc-eloquent/lib/Database/index.js +1 -1
  87. package/lib/Jcc-eloquent/lib/Interfaces/index.d.ts +37 -2
  88. package/lib/Jcc-eloquent/lib/Interfaces/index.d.ts.map +1 -1
  89. package/lib/Jcc-eloquent/lib/Migration.d.ts +6 -0
  90. package/lib/Jcc-eloquent/lib/Migration.d.ts.map +1 -1
  91. package/lib/Jcc-eloquent/lib/Migration.js +24 -2
  92. package/lib/Jcc-eloquent/lib/Model.d.ts +24 -7
  93. package/lib/Jcc-eloquent/lib/Model.d.ts.map +1 -1
  94. package/lib/Jcc-eloquent/lib/Model.js +35 -2
  95. package/lib/Jcc-eloquent/lib/QueryBuilder.d.ts +2 -1
  96. package/lib/Jcc-eloquent/lib/QueryBuilder.d.ts.map +1 -1
  97. package/lib/Jcc-eloquent/lib/QueryBuilder.js +10 -1
  98. package/lib/Jcc-eloquent/lib/Rollback.d.ts.map +1 -1
  99. package/lib/Jcc-eloquent/lib/Rollback.js +9 -2
  100. package/lib/Jcc-eloquent/lib/Schema/BaseSchemaEntity/index.d.ts.map +1 -1
  101. package/lib/Jcc-eloquent/lib/Schema/BaseSchemaEntity/index.js +3 -3
  102. package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.d.ts +6 -2
  103. package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.d.ts.map +1 -1
  104. package/lib/Jcc-eloquent/lib/Schema/BluePrint/index.js +41 -12
  105. package/lib/Jcc-eloquent/lib/Schema/Translator/Sqlite.d.ts.map +1 -1
  106. package/lib/Jcc-eloquent/lib/Schema/Translator/Sqlite.js +21 -3
  107. package/lib/Jcc-eloquent/lib/Schema/Translator/postgres.d.ts +1 -0
  108. package/lib/Jcc-eloquent/lib/Schema/Translator/postgres.d.ts.map +1 -1
  109. package/lib/Jcc-eloquent/lib/Schema/Translator/postgres.js +70 -14
  110. package/lib/Jcc-eloquent/lib/Schema/index.d.ts +12 -0
  111. package/lib/Jcc-eloquent/lib/Schema/index.d.ts.map +1 -1
  112. package/lib/Jcc-eloquent/lib/Schema/index.js +27 -6
  113. package/lib/Jcc-eloquent/lib/utils/index.d.ts +13 -0
  114. package/lib/Jcc-eloquent/lib/utils/index.d.ts.map +1 -1
  115. package/lib/Jcc-eloquent/lib/utils/index.js +62 -0
  116. package/lib/Mail/index.d.ts.map +1 -1
  117. package/lib/Mail/index.js +12 -1
  118. package/lib/Middleware/index.d.ts.map +1 -1
  119. package/lib/Middleware/index.js +4 -7
  120. package/lib/Model/Sequelize.d.ts +3 -0
  121. package/lib/Model/Sequelize.d.ts.map +1 -0
  122. package/lib/Model/Sequelize.js +6 -0
  123. package/lib/Providers/SessionServiceProvider.d.ts +12 -0
  124. package/lib/Providers/SessionServiceProvider.d.ts.map +1 -0
  125. package/lib/Providers/SessionServiceProvider.js +47 -0
  126. package/lib/Queue/Controllers/QueueControllers.d.ts +4 -13
  127. package/lib/Queue/Controllers/QueueControllers.d.ts.map +1 -1
  128. package/lib/Queue/Controllers/QueueControllers.js +1 -16
  129. package/lib/Queue/Route/web.js +4 -1
  130. package/lib/Queue/index.d.ts +1 -0
  131. package/lib/Queue/index.d.ts.map +1 -1
  132. package/lib/Queue/index.js +3 -0
  133. package/lib/Queue/middleware/queueDashboardGuard.d.ts +7 -0
  134. package/lib/Queue/middleware/queueDashboardGuard.d.ts.map +1 -0
  135. package/lib/Queue/middleware/queueDashboardGuard.js +43 -0
  136. package/lib/Request/FormRequest.js +1 -1
  137. package/lib/Response/index.d.ts +2 -1
  138. package/lib/Response/index.d.ts.map +1 -1
  139. package/lib/Response/index.js +13 -11
  140. package/lib/Routes/Route.d.ts +2 -2
  141. package/lib/Routes/Route.d.ts.map +1 -1
  142. package/lib/Routes/RouteBuilder.d.ts +2 -2
  143. package/lib/Routes/RouteBuilder.d.ts.map +1 -1
  144. package/lib/Security/CsrfMiddleware.d.ts.map +1 -1
  145. package/lib/Security/CsrfMiddleware.js +6 -4
  146. package/lib/Session/DatabaseSession.d.ts +9 -3
  147. package/lib/Session/DatabaseSession.d.ts.map +1 -1
  148. package/lib/Session/DatabaseSession.js +38 -36
  149. package/lib/Session/ExpressJccSession.d.ts +23 -0
  150. package/lib/Session/ExpressJccSession.d.ts.map +1 -0
  151. package/lib/Session/ExpressJccSession.js +110 -0
  152. package/lib/Session/RedisSession.d.ts +2 -2
  153. package/lib/Session/RedisSession.d.ts.map +1 -1
  154. package/lib/Session/RedisSession.js +21 -5
  155. package/lib/Session/SessionManager.d.ts +18 -4
  156. package/lib/Session/SessionManager.d.ts.map +1 -1
  157. package/lib/Session/SessionManager.js +53 -17
  158. package/lib/Socialite/AbstractProvider.d.ts +60 -0
  159. package/lib/Socialite/AbstractProvider.d.ts.map +1 -0
  160. package/lib/Socialite/AbstractProvider.js +136 -0
  161. package/lib/Socialite/Drivers/facebook/FacebookDriver.d.ts +9 -0
  162. package/lib/Socialite/Drivers/facebook/FacebookDriver.d.ts.map +1 -0
  163. package/lib/Socialite/Drivers/facebook/FacebookDriver.js +40 -0
  164. package/lib/Socialite/Drivers/facebook/FacebookProvider.d.ts +15 -0
  165. package/lib/Socialite/Drivers/facebook/FacebookProvider.d.ts.map +1 -0
  166. package/lib/Socialite/Drivers/facebook/FacebookProvider.js +28 -0
  167. package/lib/Socialite/Drivers/github/GitHubDriver.d.ts +9 -0
  168. package/lib/Socialite/Drivers/github/GitHubDriver.d.ts.map +1 -0
  169. package/lib/Socialite/Drivers/github/GitHubDriver.js +54 -0
  170. package/lib/Socialite/Drivers/github/GitHubProvider.d.ts +15 -0
  171. package/lib/Socialite/Drivers/github/GitHubProvider.d.ts.map +1 -0
  172. package/lib/Socialite/Drivers/github/GitHubProvider.js +28 -0
  173. package/lib/Socialite/Drivers/gitlab/GitLabDriver.d.ts +10 -0
  174. package/lib/Socialite/Drivers/gitlab/GitLabDriver.d.ts.map +1 -0
  175. package/lib/Socialite/Drivers/gitlab/GitLabDriver.js +37 -0
  176. package/lib/Socialite/Drivers/gitlab/GitLabProvider.d.ts +15 -0
  177. package/lib/Socialite/Drivers/gitlab/GitLabProvider.d.ts.map +1 -0
  178. package/lib/Socialite/Drivers/gitlab/GitLabProvider.js +28 -0
  179. package/lib/Socialite/Drivers/google/GoogleDriver.d.ts +9 -0
  180. package/lib/Socialite/Drivers/google/GoogleDriver.d.ts.map +1 -0
  181. package/lib/Socialite/Drivers/google/GoogleDriver.js +39 -0
  182. package/lib/Socialite/Drivers/google/GoogleProvider.d.ts +15 -0
  183. package/lib/Socialite/Drivers/google/GoogleProvider.d.ts.map +1 -0
  184. package/lib/Socialite/Drivers/google/GoogleProvider.js +28 -0
  185. package/lib/Socialite/Drivers/slack/SlackDriver.d.ts +9 -0
  186. package/lib/Socialite/Drivers/slack/SlackDriver.d.ts.map +1 -0
  187. package/lib/Socialite/Drivers/slack/SlackDriver.js +41 -0
  188. package/lib/Socialite/Drivers/slack/SlackProvider.d.ts +16 -0
  189. package/lib/Socialite/Drivers/slack/SlackProvider.d.ts.map +1 -0
  190. package/lib/Socialite/Drivers/slack/SlackProvider.js +37 -0
  191. package/lib/Socialite/Drivers/twitter/TwitterDriver.d.ts +9 -0
  192. package/lib/Socialite/Drivers/twitter/TwitterDriver.d.ts.map +1 -0
  193. package/lib/Socialite/Drivers/twitter/TwitterDriver.js +57 -0
  194. package/lib/Socialite/Drivers/twitter/TwitterProvider.d.ts +16 -0
  195. package/lib/Socialite/Drivers/twitter/TwitterProvider.d.ts.map +1 -0
  196. package/lib/Socialite/Drivers/twitter/TwitterProvider.js +38 -0
  197. package/lib/Socialite/SocialUser.d.ts +42 -0
  198. package/lib/Socialite/SocialUser.d.ts.map +1 -0
  199. package/lib/Socialite/SocialUser.js +116 -0
  200. package/lib/Socialite/Socialite.d.ts +13 -0
  201. package/lib/Socialite/Socialite.d.ts.map +1 -0
  202. package/lib/Socialite/Socialite.js +41 -0
  203. package/lib/Socialite/SocialiteProvider.d.ts +9 -0
  204. package/lib/Socialite/SocialiteProvider.d.ts.map +1 -0
  205. package/lib/Socialite/SocialiteProvider.js +15 -0
  206. package/lib/Socialite/config.d.ts +7 -0
  207. package/lib/Socialite/config.d.ts.map +1 -0
  208. package/lib/Socialite/config.js +44 -0
  209. package/lib/Socialite/constant.d.ts +18 -0
  210. package/lib/Socialite/constant.d.ts.map +1 -0
  211. package/lib/Socialite/constant.js +20 -0
  212. package/lib/Socialite/index.d.ts +13 -0
  213. package/lib/Socialite/index.d.ts.map +1 -0
  214. package/lib/Socialite/index.js +25 -0
  215. package/lib/Socialite/types.d.ts +13 -0
  216. package/lib/Socialite/types.d.ts.map +1 -0
  217. package/lib/Socialite/types.js +2 -0
  218. package/lib/Templating-engine/index.d.ts.map +1 -1
  219. package/lib/Templating-engine/index.js +6 -2
  220. package/lib/Testing/Concerns/MakesHttpRequests.d.ts.map +1 -1
  221. package/lib/Testing/Concerns/MakesHttpRequests.js +2 -0
  222. package/lib/Testing/TestCase.d.ts +13 -2
  223. package/lib/Testing/TestCase.d.ts.map +1 -1
  224. package/lib/Testing/TestCase.js +29 -5
  225. package/lib/Testing/TestResponse.d.ts +18 -2
  226. package/lib/Testing/TestResponse.d.ts.map +1 -1
  227. package/lib/Testing/TestResponse.js +45 -9
  228. package/lib/Type/index.d.ts +1 -0
  229. package/lib/Type/index.d.ts.map +1 -1
  230. package/lib/Validation/Validator/CustomValidation.d.ts.map +1 -1
  231. package/lib/Validation/Validator/CustomValidation.js +2 -2
  232. package/lib/Validation/Validator/helper.d.ts.map +1 -1
  233. package/lib/Validation/Validator/helper.js +8 -1
  234. package/lib/util/index.d.ts +36 -1
  235. package/lib/util/index.d.ts.map +1 -1
  236. package/lib/util/index.js +123 -26
  237. package/package.json +1 -1
@@ -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 {};
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference path="./global.d.ts" />
2
+
2
3
  export { Authentication as Auth } from "./lib/Auth";
3
4
  export { config } from "./lib/Config/Config";
4
5
  export type {
@@ -12,25 +13,49 @@ export {
12
13
  verifyHash,
13
14
  jwtSign,
14
15
  jwtVerify,
16
+ jwtTokenType,
17
+ assertProductionJwtSecret,
18
+ authSessionCookieOptions,
19
+ checkJwtAccessTokenPayload,
15
20
  saveImage,
16
21
  asyncHandler,
17
22
  cloudinaryUpload,
18
23
  rootPath,
19
24
  } from "./lib/util";
25
+ export type { JwtAccessTokenPayloadResult } from "./lib/util";
26
+ export { loginRateLimit, registerRateLimit } from "./lib/Auth/loginRateLimit";
27
+ export {
28
+ Socialite,
29
+ AbstractProvider,
30
+ SocialiteProvider,
31
+ resolveSocialiteConfig,
32
+ GoogleProvider,
33
+ GitHubProvider,
34
+ FacebookProvider,
35
+ GitLabProvider,
36
+ TwitterProvider,
37
+ SlackProvider,
38
+ } from "./lib/Socialite";
39
+ export type {
40
+ OAuthAuthorizeContext,
41
+ OAuthProviderConfig,
42
+ } from "./lib/Socialite/types";
43
+ /** Laravel Socialite-style OAuth user profile (class with getters + `toPlainObject()`). */
44
+ export { SocialUser as SocialiteOAuthUser } from "./lib/Socialite/SocialUser";
20
45
  export declare const guest: (
21
46
  req: import("./lib/Interface").AppRequest,
22
47
  res: import("./lib/Interface").AppResponse,
23
- next: import("./lib/Interface").AppNext
48
+ next: import("./lib/Interface").AppNext,
24
49
  ) => any;
25
50
  export declare const apiAuth: (
26
51
  req: import("./lib/Interface").AppRequest,
27
52
  res: import("./lib/Interface").AppResponse,
28
- next: import("./lib/Interface").AppNext
53
+ next: import("./lib/Interface").AppNext,
29
54
  ) => Promise<import("./lib/Interface").AppResponse | undefined>;
30
55
  export declare const auth: (
31
56
  req: import("./lib/Interface").AppRequest,
32
57
  res: import("./lib/Interface").AppResponse,
33
- next: import("./lib/Interface").AppNext
58
+ next: import("./lib/Interface").AppNext,
34
59
  ) => Promise<void>;
35
60
  export declare const httpContext: AppHttpContext;
36
61
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../jcc-express-mvc/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,IAAI,IAAI,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EACV,UAAU,IAAI,OAAO,EACrB,WAAW,IAAI,QAAQ,EACvB,OAAO,IAAI,IAAI,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,EACT,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,KAAK,yIAAuB,CAAC;AAC1C,eAAO,MAAM,OAAO,gMAAyB,CAAC;AAC9C,eAAO,MAAM,IAAI,mJAAsB,CAAC;AACxC,eAAO,MAAM,WAAW,EAAS,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../jcc-express-mvc/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,IAAI,IAAI,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EACV,UAAU,IAAI,OAAO,EACrB,WAAW,IAAI,QAAQ,EACvB,OAAO,IAAI,IAAI,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,EACT,YAAY,EACZ,yBAAyB,EACzB,wBAAwB,EACxB,0BAA0B,EAC1B,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9E,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,2FAA2F;AAC3F,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAE9E,eAAO,MAAM,KAAK,yIAAuB,CAAC;AAC1C,eAAO,MAAM,OAAO,gMAAyB,CAAC;AAC9C,eAAO,MAAM,IAAI,mJAAsB,CAAC;AACxC,eAAO,MAAM,WAAW,EAAS,cAAc,CAAC"}
package/index.js CHANGED
@@ -1,84 +1,42 @@
1
1
  "use strict";
2
+ /// <reference path="./global.d.ts" />
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.httpContext =
4
- exports.auth =
5
- exports.apiAuth =
6
- exports.guest =
7
- exports.rootPath =
8
- exports.cloudinaryUpload =
9
- exports.asyncHandler =
10
- exports.saveImage =
11
- exports.jwtVerify =
12
- exports.jwtSign =
13
- exports.verifyHash =
14
- exports.bcrypt =
15
- exports.config =
16
- exports.Auth =
17
- void 0;
4
+ exports.httpContext = exports.auth = exports.apiAuth = exports.guest = exports.SocialiteOAuthUser = exports.SlackProvider = exports.TwitterProvider = exports.GitLabProvider = exports.FacebookProvider = exports.GitHubProvider = exports.GoogleProvider = exports.resolveSocialiteConfig = exports.SocialiteProvider = exports.AbstractProvider = exports.Socialite = exports.registerRateLimit = exports.loginRateLimit = exports.rootPath = exports.cloudinaryUpload = exports.asyncHandler = exports.saveImage = exports.checkJwtAccessTokenPayload = exports.authSessionCookieOptions = exports.assertProductionJwtSecret = exports.jwtTokenType = exports.jwtVerify = exports.jwtSign = exports.verifyHash = exports.bcrypt = exports.config = exports.Auth = void 0;
18
5
  const AuthMiddleware_1 = require("./lib/Auth/AuthMiddleware");
19
6
  var Auth_1 = require("./lib/Auth");
20
- Object.defineProperty(exports, "Auth", {
21
- enumerable: true,
22
- get: function () {
23
- return Auth_1.Authentication;
24
- },
25
- });
7
+ Object.defineProperty(exports, "Auth", { enumerable: true, get: function () { return Auth_1.Authentication; } });
26
8
  var Config_1 = require("./lib/Config/Config");
27
- Object.defineProperty(exports, "config", {
28
- enumerable: true,
29
- get: function () {
30
- return Config_1.config;
31
- },
32
- });
9
+ Object.defineProperty(exports, "config", { enumerable: true, get: function () { return Config_1.config; } });
33
10
  var util_1 = require("./lib/util");
34
- Object.defineProperty(exports, "bcrypt", {
35
- enumerable: true,
36
- get: function () {
37
- return util_1.bcrypt;
38
- },
39
- });
40
- Object.defineProperty(exports, "verifyHash", {
41
- enumerable: true,
42
- get: function () {
43
- return util_1.verifyHash;
44
- },
45
- });
46
- Object.defineProperty(exports, "jwtSign", {
47
- enumerable: true,
48
- get: function () {
49
- return util_1.jwtSign;
50
- },
51
- });
52
- Object.defineProperty(exports, "jwtVerify", {
53
- enumerable: true,
54
- get: function () {
55
- return util_1.jwtVerify;
56
- },
57
- });
58
- Object.defineProperty(exports, "saveImage", {
59
- enumerable: true,
60
- get: function () {
61
- return util_1.saveImage;
62
- },
63
- });
64
- Object.defineProperty(exports, "asyncHandler", {
65
- enumerable: true,
66
- get: function () {
67
- return util_1.asyncHandler;
68
- },
69
- });
70
- Object.defineProperty(exports, "cloudinaryUpload", {
71
- enumerable: true,
72
- get: function () {
73
- return util_1.cloudinaryUpload;
74
- },
75
- });
76
- Object.defineProperty(exports, "rootPath", {
77
- enumerable: true,
78
- get: function () {
79
- return util_1.rootPath;
80
- },
81
- });
11
+ Object.defineProperty(exports, "bcrypt", { enumerable: true, get: function () { return util_1.bcrypt; } });
12
+ Object.defineProperty(exports, "verifyHash", { enumerable: true, get: function () { return util_1.verifyHash; } });
13
+ Object.defineProperty(exports, "jwtSign", { enumerable: true, get: function () { return util_1.jwtSign; } });
14
+ Object.defineProperty(exports, "jwtVerify", { enumerable: true, get: function () { return util_1.jwtVerify; } });
15
+ Object.defineProperty(exports, "jwtTokenType", { enumerable: true, get: function () { return util_1.jwtTokenType; } });
16
+ Object.defineProperty(exports, "assertProductionJwtSecret", { enumerable: true, get: function () { return util_1.assertProductionJwtSecret; } });
17
+ Object.defineProperty(exports, "authSessionCookieOptions", { enumerable: true, get: function () { return util_1.authSessionCookieOptions; } });
18
+ Object.defineProperty(exports, "checkJwtAccessTokenPayload", { enumerable: true, get: function () { return util_1.checkJwtAccessTokenPayload; } });
19
+ Object.defineProperty(exports, "saveImage", { enumerable: true, get: function () { return util_1.saveImage; } });
20
+ Object.defineProperty(exports, "asyncHandler", { enumerable: true, get: function () { return util_1.asyncHandler; } });
21
+ Object.defineProperty(exports, "cloudinaryUpload", { enumerable: true, get: function () { return util_1.cloudinaryUpload; } });
22
+ Object.defineProperty(exports, "rootPath", { enumerable: true, get: function () { return util_1.rootPath; } });
23
+ var loginRateLimit_1 = require("./lib/Auth/loginRateLimit");
24
+ Object.defineProperty(exports, "loginRateLimit", { enumerable: true, get: function () { return loginRateLimit_1.loginRateLimit; } });
25
+ Object.defineProperty(exports, "registerRateLimit", { enumerable: true, get: function () { return loginRateLimit_1.registerRateLimit; } });
26
+ var Socialite_1 = require("./lib/Socialite");
27
+ Object.defineProperty(exports, "Socialite", { enumerable: true, get: function () { return Socialite_1.Socialite; } });
28
+ Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return Socialite_1.AbstractProvider; } });
29
+ Object.defineProperty(exports, "SocialiteProvider", { enumerable: true, get: function () { return Socialite_1.SocialiteProvider; } });
30
+ Object.defineProperty(exports, "resolveSocialiteConfig", { enumerable: true, get: function () { return Socialite_1.resolveSocialiteConfig; } });
31
+ Object.defineProperty(exports, "GoogleProvider", { enumerable: true, get: function () { return Socialite_1.GoogleProvider; } });
32
+ Object.defineProperty(exports, "GitHubProvider", { enumerable: true, get: function () { return Socialite_1.GitHubProvider; } });
33
+ Object.defineProperty(exports, "FacebookProvider", { enumerable: true, get: function () { return Socialite_1.FacebookProvider; } });
34
+ Object.defineProperty(exports, "GitLabProvider", { enumerable: true, get: function () { return Socialite_1.GitLabProvider; } });
35
+ Object.defineProperty(exports, "TwitterProvider", { enumerable: true, get: function () { return Socialite_1.TwitterProvider; } });
36
+ Object.defineProperty(exports, "SlackProvider", { enumerable: true, get: function () { return Socialite_1.SlackProvider; } });
37
+ /** Laravel Socialite-style OAuth user profile (class with getters + `toPlainObject()`). */
38
+ var SocialUser_1 = require("./lib/Socialite/SocialUser");
39
+ Object.defineProperty(exports, "SocialiteOAuthUser", { enumerable: true, get: function () { return SocialUser_1.SocialUser; } });
82
40
  exports.guest = AuthMiddleware_1.authMiddleware.guest;
83
41
  exports.apiAuth = AuthMiddleware_1.authMiddleware.apiAuth;
84
42
  exports.auth = AuthMiddleware_1.authMiddleware.auth;
@@ -10,7 +10,7 @@ export declare class Application extends ExpressApplication {
10
10
  private VERSION;
11
11
  config: Record<string, any>;
12
12
  constructor();
13
- registerProviders(Provider: new (app: Application) => ServiceProvider): Promise<this>;
13
+ registerProviders(Provider: new (app: Application) => ServiceProvider): this;
14
14
  boot(): this;
15
15
  private bootProvider;
16
16
  private bootSubscribers;
@@ -1 +1 @@
1
- {"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../jcc-express-mvc/lib/Application/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAQnE,qBAAa,WAAY,SAAQ,kBAAkB;IACjD,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,SAAS,CAAyB;IACnC,QAAQ,EAAE,MAAM,CAAY;IAC5B,YAAY,EAAE,WAAW,EAAE,CAAM;IACxC,OAAO,CAAC,OAAO,CAAW;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;;IAYlC,iBAAiB,CACrB,QAAQ,EAAE,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,GAClD,OAAO,CAAC,IAAI,CAAC;IAqBhB,IAAI,IAAI,IAAI;YAUE,YAAY;IAI1B,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,aAAa;IAId,OAAO;IAKR,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB1B,MAAM,CAAC,aAAa;IAIpB,MAAM,CAAC,WAAW;CAGnB"}
1
+ {"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../jcc-express-mvc/lib/Application/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAQnE,qBAAa,WAAY,SAAQ,kBAAkB;IACjD,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,SAAS,CAAyB;IACnC,QAAQ,EAAE,MAAM,CAAY;IAC5B,YAAY,EAAE,WAAW,EAAE,CAAM;IACxC,OAAO,CAAC,OAAO,CAAW;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;;IAYxC,iBAAiB,CAAC,QAAQ,EAAE,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,GAAG,IAAI;IAoB5E,IAAI,IAAI,IAAI;YAUE,YAAY;IAI1B,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,aAAa;IAId,OAAO;IAKR,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB1B,MAAM,CAAC,aAAa;IAIpB,MAAM,CAAC,WAAW;CAGnB"}
@@ -29,9 +29,9 @@ class Application extends ExpressApplication_1.ExpressApplication {
29
29
  });
30
30
  }
31
31
  // Register a service provider
32
- async registerProviders(Provider) {
32
+ registerProviders(Provider) {
33
33
  const provider = new Provider(this);
34
- await provider.register();
34
+ provider.register();
35
35
  this.providers.push(provider);
36
36
  if (this.booted) {
37
37
  this.bootProvider(provider);
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationBuilder.d.ts","sourceRoot":"","sources":["../../../jcc-express-mvc/lib/Application/ApplicationBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAS3C,qBAAa,kBAAkB;IACtB,GAAG,EAAE,WAAW,CAAC;gBAEZ,GAAG,EAAE,WAAW;IAIrB,UAAU,CAAC,MAAM,EAAE,GAAG;IAKtB,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IActC,WAAW,CAAC,WAAW,EAAE,WAAW,EAAE;IAOtC,aAAa,CAClB,SAAS,EAAE,KAAK,CAAC,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,CAAC;IAqB7D,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,gBAAgB;IAIjB,WAAW;IAKX,cAAc;IAWd,MAAM;CAKd"}
1
+ {"version":3,"file":"ApplicationBuilder.d.ts","sourceRoot":"","sources":["../../../jcc-express-mvc/lib/Application/ApplicationBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAU3C,qBAAa,kBAAkB;IACtB,GAAG,EAAE,WAAW,CAAC;gBAEZ,GAAG,EAAE,WAAW;IAIrB,UAAU,CAAC,MAAM,EAAE,GAAG;IAKtB,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IActC,WAAW,CAAC,WAAW,EAAE,WAAW,EAAE;IAOtC,aAAa,CAClB,SAAS,EAAE,KAAK,CAAC,KAAK,GAAG,EAAE,WAAW,KAAK,eAAe,CAAC;IAyB7D,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,gBAAgB;IAIjB,WAAW;IAKX,cAAc;IAWd,MAAM;CAKd"}
@@ -6,6 +6,7 @@ const Middleware_1 = require("../Middleware");
6
6
  const NodeArtisanCommand_1 = require("../Command-Line/NodeArtisanCommand");
7
7
  const helpers_1 = require("../Global/helpers");
8
8
  const AuthServiceProvider_1 = require("../Providers/AuthServiceProvider");
9
+ const SessionServiceProvider_1 = require("../Providers/SessionServiceProvider");
9
10
  const QueueServiceProvider_1 = require("../Queue/QueueServiceProvider");
10
11
  class ApplicationBuilder {
11
12
  constructor(app) {
@@ -41,9 +42,15 @@ class ApplicationBuilder {
41
42
  ...providers.filter((P) => P !== AuthServiceProvider_1.AuthServiceProvider),
42
43
  ]
43
44
  : providers;
44
- [DatabaseServiceProvider_1.DatabaseServiceProvider, ...ordered, QueueServiceProvider_1.QueueServiceProvider].forEach((Provider) => {
45
+ const chain = [
46
+ DatabaseServiceProvider_1.DatabaseServiceProvider,
47
+ SessionServiceProvider_1.SessionServiceProvider,
48
+ ...ordered,
49
+ QueueServiceProvider_1.QueueServiceProvider,
50
+ ];
51
+ for (const Provider of chain) {
45
52
  this.app.registerProviders(Provider);
46
- });
53
+ }
47
54
  return this;
48
55
  }
49
56
  withEvents() {
@@ -3,6 +3,6 @@ export declare class Auth {
3
3
  user(): Record<string, any>;
4
4
  isAuthenticated(): boolean;
5
5
  isGuest(): boolean;
6
- check(): () => boolean;
6
+ check(): boolean;
7
7
  }
8
8
  //# sourceMappingURL=Auth.d.ts.map
package/lib/Auth/Auth.js CHANGED
@@ -16,7 +16,7 @@ class Auth {
16
16
  return request().user ? false : true;
17
17
  }
18
18
  check() {
19
- return this.isAuthenticated;
19
+ return this.isAuthenticated();
20
20
  }
21
21
  }
22
22
  exports.Auth = Auth;
@@ -1 +1 @@
1
- {"version":3,"file":"AuthMiddleware.d.ts","sourceRoot":"","sources":["../../../jcc-express-mvc/lib/Auth/AuthMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhE,cAAM,cAAc;IAClB,qCAAqC;IACxB,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO;IAuBxD,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO;IAuB3D,KAAK,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO;CAgB9D;AAED,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
1
+ {"version":3,"file":"AuthMiddleware.d.ts","sourceRoot":"","sources":["../../../jcc-express-mvc/lib/Auth/AuthMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAUhE,cAAM,cAAc;IAClB,qCAAqC;IACxB,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO;IA6BxD,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO;IAmC3D,KAAK,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO;CAgB9D;AAED,eAAO,MAAM,cAAc,gBAAuB,CAAC"}