very-express 0.10.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of very-express might be problematic. Click here for more details.

Files changed (266) hide show
  1. package/.tmp/_body.txt +1 -0
  2. package/.tmp/_idx.txt +1 -0
  3. package/.tmp/_token.txt +1 -0
  4. package/.tmp/check-a/app/.vex/meta.json +216 -0
  5. package/.tmp/check-a/app/Dockerfile +20 -0
  6. package/.tmp/check-a/app/README.md +39 -0
  7. package/.tmp/check-a/app/public/css/style.css +8 -0
  8. package/.tmp/check-a/app/public/js/deleteaccount.js +80 -0
  9. package/.tmp/check-a/app/public/js/login.js +59 -0
  10. package/.tmp/check-a/app/public/js/logincallback.js +19 -0
  11. package/.tmp/check-a/app/public/js/mytokens.js +11 -0
  12. package/.tmp/check-a/app/public/js/refreshtokens.js +23 -0
  13. package/.tmp/check-a/app/scripts/build.js +39 -0
  14. package/.tmp/check-a/app/scripts/oacg-fix.js +83 -0
  15. package/.tmp/check-a/app/tsconfig.json +30 -0
  16. package/.tmp/check-a/schemas/Project.json +41 -0
  17. package/.tmp/check-a/schemas/Session.json +49 -0
  18. package/.tmp/check-a/schemas/UserAuthProfiles.json +54 -0
  19. package/.tmp/check-a/vex.config.json +26 -0
  20. package/.tmp/check-b/app/.env +41 -0
  21. package/.tmp/check-b/app/.vex/meta.json +219 -0
  22. package/.tmp/check-b/app/Dockerfile +20 -0
  23. package/.tmp/check-b/app/README.md +39 -0
  24. package/.tmp/check-b/app/package.json +51 -0
  25. package/.tmp/check-b/app/public/css/style.css +8 -0
  26. package/.tmp/check-b/app/public/js/deleteaccount.js +80 -0
  27. package/.tmp/check-b/app/public/js/login.js +59 -0
  28. package/.tmp/check-b/app/public/js/logincallback.js +19 -0
  29. package/.tmp/check-b/app/public/js/mytokens.js +11 -0
  30. package/.tmp/check-b/app/public/js/refreshtokens.js +23 -0
  31. package/.tmp/check-b/app/scripts/build.js +39 -0
  32. package/.tmp/check-b/app/scripts/oacg-fix.js +83 -0
  33. package/.tmp/check-b/app/tsconfig.json +30 -0
  34. package/.tmp/check-b/app/tsoa.json +32 -0
  35. package/.tmp/check-b/schemas/Project.json +41 -0
  36. package/.tmp/check-b/vex.config.json +30 -0
  37. package/.tmp/check-c/app/.env +41 -0
  38. package/.tmp/check-c/app/.vex/meta.json +231 -0
  39. package/.tmp/check-c/app/Dockerfile +20 -0
  40. package/.tmp/check-c/app/README.md +39 -0
  41. package/.tmp/check-c/app/package.json +51 -0
  42. package/.tmp/check-c/app/public/css/style.css +8 -0
  43. package/.tmp/check-c/app/public/js/deleteaccount.js +80 -0
  44. package/.tmp/check-c/app/public/js/login.js +59 -0
  45. package/.tmp/check-c/app/public/js/logincallback.js +19 -0
  46. package/.tmp/check-c/app/public/js/mytokens.js +11 -0
  47. package/.tmp/check-c/app/public/js/refreshtokens.js +23 -0
  48. package/.tmp/check-c/app/scripts/build.js +39 -0
  49. package/.tmp/check-c/app/scripts/oacg-fix.js +83 -0
  50. package/.tmp/check-c/app/tsconfig.json +30 -0
  51. package/.tmp/check-c/app/tsoa.json +32 -0
  52. package/.tmp/check-c/schemas/Project.json +41 -0
  53. package/.tmp/check-c/schemas/User.json +81 -0
  54. package/.tmp/check-c/vex.config.json +30 -0
  55. package/.tmp/demo-project/vex.config.json +43 -0
  56. package/.tmp/demo-project2/vex.config.json +43 -0
  57. package/.tmp/demo-schemas/Client.json +65 -0
  58. package/.tmp/demo-schemas/FnbOrder.json +33 -0
  59. package/.tmp/demo-schemas/Job.json +86 -0
  60. package/.tmp/demo-schemas/KernelEvent.json +29 -0
  61. package/.tmp/demo-schemas/Package.json +77 -0
  62. package/.tmp/demo-schemas/Session.json +49 -0
  63. package/.tmp/demo-schemas/Tenant.json +22 -0
  64. package/.tmp/demo-schemas/User.json +81 -0
  65. package/.tmp/demo-schemas/UserAuthProfiles.json +54 -0
  66. package/.tmp/demo-schemas/UserContact.json +76 -0
  67. package/.tmp/demo-schemas/UserRole.json +40 -0
  68. package/.tmp/demo-schemas/UserTenant.json +39 -0
  69. package/.tmp/demo-schemas2/Client.json +65 -0
  70. package/.tmp/demo-schemas2/FnbOrder.json +33 -0
  71. package/.tmp/demo-schemas2/Job.json +86 -0
  72. package/.tmp/demo-schemas2/KernelEvent.json +29 -0
  73. package/.tmp/demo-schemas2/Package.json +77 -0
  74. package/.tmp/demo-schemas2/Session.json +49 -0
  75. package/.tmp/demo-schemas2/Tenant.json +22 -0
  76. package/.tmp/demo-schemas2/User.json +81 -0
  77. package/.tmp/demo-schemas2/UserAuthProfiles.json +54 -0
  78. package/.tmp/demo-schemas2/UserContact.json +76 -0
  79. package/.tmp/demo-schemas2/UserRole.json +40 -0
  80. package/.tmp/demo-schemas2/UserTenant.json +39 -0
  81. package/.tmp/e2e-db.url +1 -0
  82. package/.tmp/nouser/out/.env +41 -0
  83. package/.tmp/nouser/out/.vex/meta.json +323 -0
  84. package/.tmp/nouser/out/Dockerfile +20 -0
  85. package/.tmp/nouser/out/README.md +39 -0
  86. package/.tmp/nouser/out/package.json +51 -0
  87. package/.tmp/nouser/out/public/css/style.css +8 -0
  88. package/.tmp/nouser/out/public/js/deleteaccount.js +80 -0
  89. package/.tmp/nouser/out/public/js/login.js +59 -0
  90. package/.tmp/nouser/out/public/js/logincallback.js +19 -0
  91. package/.tmp/nouser/out/public/js/mytokens.js +11 -0
  92. package/.tmp/nouser/out/public/js/refreshtokens.js +23 -0
  93. package/.tmp/nouser/out/scripts/build.js +39 -0
  94. package/.tmp/nouser/out/scripts/oacg-fix.js +83 -0
  95. package/.tmp/nouser/out/tsconfig.json +30 -0
  96. package/.tmp/nouser/out/tsoa.json +32 -0
  97. package/.tmp/nouser/schemas/Project.json +41 -0
  98. package/.tmp/nouser/schemas/Session.json +49 -0
  99. package/.tmp/nouser/schemas/User.json +81 -0
  100. package/.tmp/nouser/schemas/UserAuthProfiles.json +54 -0
  101. package/.tmp/nouser/schemas/UserTenant.json +39 -0
  102. package/.tmp/nouser/vex.config.json +34 -0
  103. package/.tmp/npm-test-after-fix.log +217 -0
  104. package/.tmp/npm-test-final.log +165 -0
  105. package/.tmp/npm-test-final2.log +163 -0
  106. package/.tmp/npm-test-recheck.log +192 -0
  107. package/.tmp/npm-test-update.log +164 -0
  108. package/.tmp/npm-test.log +166 -0
  109. package/.tmp/output-build-after-fix.log +8 -0
  110. package/.tmp/output-build-baseline.log +8 -0
  111. package/.tmp/output-build-canonical.log +8 -0
  112. package/.tmp/output-build-final2.log +8 -0
  113. package/.tmp/output-build-reapply.log +8 -0
  114. package/.tmp/output-build.log +8 -0
  115. package/.tmp/output.env.bak +34 -0
  116. package/.tmp/probe_body.txt +1 -0
  117. package/.tmp/provision-e2e-db.js +41 -0
  118. package/.tmp/retry-nodestroy.log +18 -0
  119. package/.tmp/retry-recovery-final2.log +8 -0
  120. package/.tmp/retry-recovery-reapply.log +8 -0
  121. package/.tmp/retry-recovery.js +38 -0
  122. package/.tmp/run-e2e-single.js +21 -0
  123. package/.tmp/run-e2e.js +18 -0
  124. package/.tmp/verify-noauth/app/.env +41 -0
  125. package/.tmp/verify-noauth/app/.vex/meta.json +333 -0
  126. package/.tmp/verify-noauth/app/Dockerfile +20 -0
  127. package/.tmp/verify-noauth/app/README.md +39 -0
  128. package/.tmp/verify-noauth/app/package.json +51 -0
  129. package/.tmp/verify-noauth/app/public/css/style.css +8 -0
  130. package/.tmp/verify-noauth/app/public/js/deleteaccount.js +80 -0
  131. package/.tmp/verify-noauth/app/public/js/login.js +59 -0
  132. package/.tmp/verify-noauth/app/public/js/logincallback.js +19 -0
  133. package/.tmp/verify-noauth/app/public/js/mytokens.js +11 -0
  134. package/.tmp/verify-noauth/app/public/js/refreshtokens.js +23 -0
  135. package/.tmp/verify-noauth/app/scripts/build.js +39 -0
  136. package/.tmp/verify-noauth/app/scripts/oacg-fix.js +83 -0
  137. package/.tmp/verify-noauth/app/tsconfig.json +30 -0
  138. package/.tmp/verify-noauth/app/tsoa.json +32 -0
  139. package/.tmp/verify-noauth/schemas/Project.json +41 -0
  140. package/.tmp/verify-noauth/schemas/Session.json +49 -0
  141. package/.tmp/verify-noauth/schemas/User.json +81 -0
  142. package/.tmp/verify-noauth/schemas/UserAuthProfiles.json +54 -0
  143. package/.tmp/verify-noauth/schemas/UserTenant.json +39 -0
  144. package/.tmp/verify-noauth/vex.config.json +33 -0
  145. package/.tmp/verify-noauth-rbac/app/.env +41 -0
  146. package/.tmp/verify-noauth-rbac/app/.vex/meta.json +273 -0
  147. package/.tmp/verify-noauth-rbac/app/Dockerfile +20 -0
  148. package/.tmp/verify-noauth-rbac/app/README.md +39 -0
  149. package/.tmp/verify-noauth-rbac/app/package.json +51 -0
  150. package/.tmp/verify-noauth-rbac/app/public/css/style.css +8 -0
  151. package/.tmp/verify-noauth-rbac/app/public/js/deleteaccount.js +80 -0
  152. package/.tmp/verify-noauth-rbac/app/public/js/login.js +59 -0
  153. package/.tmp/verify-noauth-rbac/app/public/js/logincallback.js +19 -0
  154. package/.tmp/verify-noauth-rbac/app/public/js/mytokens.js +11 -0
  155. package/.tmp/verify-noauth-rbac/app/public/js/refreshtokens.js +23 -0
  156. package/.tmp/verify-noauth-rbac/app/scripts/build.js +39 -0
  157. package/.tmp/verify-noauth-rbac/app/scripts/oacg-fix.js +83 -0
  158. package/.tmp/verify-noauth-rbac/app/tsconfig.json +30 -0
  159. package/.tmp/verify-noauth-rbac/app/tsoa.json +32 -0
  160. package/.tmp/verify-noauth-rbac/schemas/Project.json +41 -0
  161. package/.tmp/verify-noauth-rbac/schemas/User.json +81 -0
  162. package/.tmp/verify-noauth-rbac/schemas/UserRole.json +38 -0
  163. package/.tmp/verify-noauth-rbac/vex.config.json +36 -0
  164. package/.tmp/verify.sh +103 -0
  165. package/.tmp/verify2.sh +103 -0
  166. package/.tmp/vex-gen-after-fix.log +221 -0
  167. package/.tmp/vex-gen-baseline.log +221 -0
  168. package/.tmp/vex-gen-canonical.log +221 -0
  169. package/.tmp/vex-gen-final.log +220 -0
  170. package/.tmp/vex-gen-final2.log +221 -0
  171. package/.tmp/vex-gen-reapply.log +221 -0
  172. package/.tmp/vex-gen.log +220 -0
  173. package/.tmp/vex-run-after-fix.log +3 -0
  174. package/.tmp/vex-run-baseline.log +11 -0
  175. package/.tmp/vex-run-before-fix.log +11 -0
  176. package/.tmp/vex-run-canonical.log +3 -0
  177. package/.tmp/vex-run-final2.log +3 -0
  178. package/.tmp/vex-run.log +3 -0
  179. package/.tmp/vo/app/.env +41 -0
  180. package/.tmp/vo/app/.vex/meta.json +231 -0
  181. package/.tmp/vo/app/Dockerfile +20 -0
  182. package/.tmp/vo/app/README.md +39 -0
  183. package/.tmp/vo/app/package.json +51 -0
  184. package/.tmp/vo/app/public/css/style.css +8 -0
  185. package/.tmp/vo/app/public/js/deleteaccount.js +80 -0
  186. package/.tmp/vo/app/public/js/login.js +59 -0
  187. package/.tmp/vo/app/public/js/logincallback.js +19 -0
  188. package/.tmp/vo/app/public/js/mytokens.js +11 -0
  189. package/.tmp/vo/app/public/js/refreshtokens.js +23 -0
  190. package/.tmp/vo/app/scripts/build.js +39 -0
  191. package/.tmp/vo/app/scripts/oacg-fix.js +83 -0
  192. package/.tmp/vo/app/tsconfig.json +30 -0
  193. package/.tmp/vo/app/tsoa.json +32 -0
  194. package/.tmp/vo/schemas/Project.json +41 -0
  195. package/.tmp/vo/vex.config.json +33 -0
  196. package/.tmp/vo-bad1/app/.env +41 -0
  197. package/.tmp/vo-bad1/app/.vex/meta.json +237 -0
  198. package/.tmp/vo-bad1/app/Dockerfile +20 -0
  199. package/.tmp/vo-bad1/app/README.md +39 -0
  200. package/.tmp/vo-bad1/app/package.json +51 -0
  201. package/.tmp/vo-bad1/app/public/css/style.css +8 -0
  202. package/.tmp/vo-bad1/app/public/js/deleteaccount.js +80 -0
  203. package/.tmp/vo-bad1/app/public/js/login.js +59 -0
  204. package/.tmp/vo-bad1/app/public/js/logincallback.js +19 -0
  205. package/.tmp/vo-bad1/app/public/js/mytokens.js +11 -0
  206. package/.tmp/vo-bad1/app/public/js/refreshtokens.js +23 -0
  207. package/.tmp/vo-bad1/app/scripts/build.js +39 -0
  208. package/.tmp/vo-bad1/app/scripts/oacg-fix.js +83 -0
  209. package/.tmp/vo-bad1/app/tsconfig.json +30 -0
  210. package/.tmp/vo-bad1/app/tsoa.json +32 -0
  211. package/.tmp/vo-bad1/schemas/Project.json +41 -0
  212. package/.tmp/vo-bad1/vex.config.json +33 -0
  213. package/.tmp/vo-bad2/app/.env +41 -0
  214. package/.tmp/vo-bad2/app/.vex/meta.json +237 -0
  215. package/.tmp/vo-bad2/app/Dockerfile +20 -0
  216. package/.tmp/vo-bad2/app/README.md +39 -0
  217. package/.tmp/vo-bad2/app/package.json +51 -0
  218. package/.tmp/vo-bad2/app/public/css/style.css +8 -0
  219. package/.tmp/vo-bad2/app/public/js/deleteaccount.js +80 -0
  220. package/.tmp/vo-bad2/app/public/js/login.js +59 -0
  221. package/.tmp/vo-bad2/app/public/js/logincallback.js +19 -0
  222. package/.tmp/vo-bad2/app/public/js/mytokens.js +11 -0
  223. package/.tmp/vo-bad2/app/public/js/refreshtokens.js +23 -0
  224. package/.tmp/vo-bad2/app/scripts/build.js +39 -0
  225. package/.tmp/vo-bad2/app/scripts/oacg-fix.js +83 -0
  226. package/.tmp/vo-bad2/app/tsconfig.json +30 -0
  227. package/.tmp/vo-bad2/app/tsoa.json +32 -0
  228. package/.tmp/vo-bad2/schemas/Project.json +41 -0
  229. package/.tmp/vo-bad2/vex.config.json +39 -0
  230. package/.tmp/vo-bad3/app/.env +41 -0
  231. package/.tmp/vo-bad3/app/.vex/meta.json +237 -0
  232. package/.tmp/vo-bad3/app/Dockerfile +20 -0
  233. package/.tmp/vo-bad3/app/README.md +39 -0
  234. package/.tmp/vo-bad3/app/package.json +51 -0
  235. package/.tmp/vo-bad3/app/public/css/style.css +8 -0
  236. package/.tmp/vo-bad3/app/public/js/deleteaccount.js +80 -0
  237. package/.tmp/vo-bad3/app/public/js/login.js +59 -0
  238. package/.tmp/vo-bad3/app/public/js/logincallback.js +19 -0
  239. package/.tmp/vo-bad3/app/public/js/mytokens.js +11 -0
  240. package/.tmp/vo-bad3/app/public/js/refreshtokens.js +23 -0
  241. package/.tmp/vo-bad3/app/scripts/build.js +39 -0
  242. package/.tmp/vo-bad3/app/scripts/oacg-fix.js +83 -0
  243. package/.tmp/vo-bad3/app/tsconfig.json +30 -0
  244. package/.tmp/vo-bad3/app/tsoa.json +32 -0
  245. package/.tmp/vo-bad3/schemas/Project.json +41 -0
  246. package/.tmp/vo-bad3/vex.config.json +33 -0
  247. package/dist/index.js +1156 -698
  248. package/dist/templates/_middlewares/UserContext.ts +1 -1
  249. package/dist/templates/_routes/FirebaseAuthUI.gen.ts +2 -2
  250. package/dist/templates/_routes/{LoginUI.ts → StarterUI.ts} +122 -8
  251. package/dist/templates/_utils/hash.ts +9 -4
  252. package/dist/templates/tenantJsonSchema/Tenant.json +22 -0
  253. package/docs/appGenerated/auth.md +50 -0
  254. package/docs/architecture/databaseTargets.md +23 -2
  255. package/docs/architecture/templates.md +7 -0
  256. package/docs/features/accountDeletion.md +5 -4
  257. package/docs/features/auditFields.md +2 -2
  258. package/docs/features/tenantIsolation.md +108 -15
  259. package/docs/releaseNote/v0-10-3.md +61 -0
  260. package/docs/releaseNote/v0-10-4.md +102 -0
  261. package/docs/releaseNote/v0-11-0.md +82 -0
  262. package/docs/vexJsonSchema.md +34 -1
  263. package/package.json +1 -1
  264. package/vex.config.json +6 -1
  265. package/dist/templates/_services/VexDbConnector.ts +0 -188
  266. package/dist/templates/_tenant/TenantScopeContext.ts +0 -56
@@ -0,0 +1,41 @@
1
+ // Derive an isolated test database on the configured remote Postgres.
2
+ // Writes the connection URL to .tmp/e2e-db.url (never printed).
3
+ const fs = require("node:fs");
4
+ const path = require("node:path");
5
+ const dotenv = require("dotenv");
6
+ const { Client } = require("pg");
7
+
8
+ dotenv.config({ path: path.join(__dirname, "..", "output", ".env") });
9
+
10
+ const TARGET_DB = "vex_e2e";
11
+
12
+ function sslOf(url) {
13
+ const required = url.searchParams.get("sslmode") === "require";
14
+ if (!required) return undefined;
15
+ const raw = process.env.SQL_CA;
16
+ const ca = !raw ? undefined : raw.startsWith("-----BEGIN") ? raw : Buffer.from(raw, "base64").toString("utf8");
17
+ const insecure = (process.env.SQL_INSECURE_TLS || "").toLowerCase() === "true";
18
+ return { rejectUnauthorized: insecure ? false : true, ca };
19
+ }
20
+
21
+ (async () => {
22
+ const base = new URL(process.env.SQL_URI);
23
+ const admin = new Client({ connectionString: base.toString(), ssl: sslOf(base) });
24
+ await admin.connect();
25
+
26
+ const existing = await admin.query("select 1 from pg_database where datname = $1", [TARGET_DB]);
27
+ if (existing.rowCount === 0) {
28
+ await admin.query(`create database ${TARGET_DB}`);
29
+ console.log(`created database ${TARGET_DB}`);
30
+ } else {
31
+ console.log(`reusing database ${TARGET_DB}`);
32
+ }
33
+ await admin.end();
34
+
35
+ const target = new URL(base.toString());
36
+ target.pathname = `/${TARGET_DB}`;
37
+ fs.writeFileSync(path.join(__dirname, "e2e-db.url"), target.toString());
38
+ })().catch((error) => {
39
+ console.error(`provisioning failed: ${error.message}`);
40
+ process.exit(1);
41
+ });
@@ -0,0 +1,18 @@
1
+ [INFO] 11/29/2026, 8:40:26 AM - [SQL] Connecting to SQL DB (TypeORM)...
2
+ [ERROR] 11/29/2026, 8:40:26 AM - [SQL] Failed to initialize TypeORM, retrying in 10s Error: injected failure after initialize()
3
+ at DataSource.createQueryRunner (/home/justin/Documents/VeryExpress/.tmp/retry-recovery.js:14:15)
4
+ at /home/justin/Documents/VeryExpress/output/dist/system/_services/_probe-nodestroy.js:92:40
5
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
6
+ [ERROR] 11/29/2026, 8:40:36 AM - [SQL] Failed to initialize TypeORM, retrying in 10s CannotConnectAlreadyConnectedError: Cannot create a "default" connection because connection to the database already established.
7
+ at DataSource.initialize (/home/justin/Documents/VeryExpress/output/node_modules/typeorm/data-source/DataSource.js:135:19)
8
+ at connectWithRetry (/home/justin/Documents/VeryExpress/output/dist/system/_services/_probe-nodestroy.js:90:16)
9
+ at Timeout._onTimeout (/home/justin/Documents/VeryExpress/output/dist/system/_services/_probe-nodestroy.js:109:34)
10
+ at listOnTimeout (node:internal/timers:685:17)
11
+ at process.processTimers (node:internal/timers:618:7)
12
+ [ERROR] 11/29/2026, 8:40:46 AM - [SQL] Failed to initialize TypeORM, retrying in 10s CannotConnectAlreadyConnectedError: Cannot create a "default" connection because connection to the database already established.
13
+ at DataSource.initialize (/home/justin/Documents/VeryExpress/output/node_modules/typeorm/data-source/DataSource.js:135:19)
14
+ at connectWithRetry (/home/justin/Documents/VeryExpress/output/dist/system/_services/_probe-nodestroy.js:90:16)
15
+ at Timeout._onTimeout (/home/justin/Documents/VeryExpress/output/dist/system/_services/_probe-nodestroy.js:109:34)
16
+ at listOnTimeout (node:internal/timers:685:17)
17
+ at process.processTimers (node:internal/timers:618:7)
18
+ RESULT: no recovery within 30s
@@ -0,0 +1,8 @@
1
+ [INFO] 11/29/2026, 8:42:12 AM - [SQL] Connecting to SQL DB (TypeORM)...
2
+ [ERROR] 11/29/2026, 8:42:12 AM - [SQL] Failed to initialize TypeORM, retrying in 10s Error: injected failure after initialize()
3
+ at DataSource.createQueryRunner (/home/justin/Documents/VeryExpress/.tmp/retry-recovery.js:14:15)
4
+ at /home/justin/Documents/VeryExpress/output/dist/system/_services/VexDbConnector.gen.js:92:40
5
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
6
+ [INFO] 11/29/2026, 8:42:22 AM - [SQL] TypeORM DataSource initialized
7
+ RESULT: recovered — dataSource initialized after 11s, createQueryRunner injections=1, attempts=2
8
+ [INFO] 11/29/2026, 8:42:23 AM - [SQL] TypeORM DataSource closed
@@ -0,0 +1,8 @@
1
+ [INFO] 11/29/2026, 8:40:09 AM - [SQL] Connecting to SQL DB (TypeORM)...
2
+ [ERROR] 11/29/2026, 8:40:09 AM - [SQL] Failed to initialize TypeORM, retrying in 10s Error: injected failure after initialize()
3
+ at DataSource.createQueryRunner (/home/justin/Documents/VeryExpress/.tmp/retry-recovery.js:14:15)
4
+ at /home/justin/Documents/VeryExpress/output/dist/system/_services/VexDbConnector.gen.js:92:40
5
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
6
+ [INFO] 11/29/2026, 8:40:19 AM - [SQL] TypeORM DataSource initialized
7
+ RESULT: recovered — dataSource initialized after 11s, createQueryRunner injections=1, attempts=2
8
+ [INFO] 11/29/2026, 8:40:19 AM - [SQL] TypeORM DataSource closed
@@ -0,0 +1,38 @@
1
+ // Prove the generated retry path recovers: the first attempt fails after initialize() resolved,
2
+ // the retry must not hit CannotConnectAlreadyConnectedError.
3
+ const path = require("path");
4
+ require("dotenv").config({ path: path.join(__dirname, "..", "output", ".env") });
5
+
6
+ const { DataSource } = require(path.join(__dirname, "..", "output", "node_modules", "typeorm"));
7
+ const original = DataSource.prototype.createQueryRunner;
8
+ let calls = 0;
9
+ let injected = 0;
10
+ DataSource.prototype.createQueryRunner = function (...args) {
11
+ calls += 1;
12
+ if (calls === 1) {
13
+ injected += 1;
14
+ throw new Error("injected failure after initialize()");
15
+ }
16
+ return original.apply(this, args);
17
+ };
18
+
19
+ const Connector = require(path.join(__dirname, "..", "output", "dist", "system", "_services", "VexDbConnector.gen.js")).default;
20
+ const connector = new Connector({ sqlUrl: process.env.SQL_URI });
21
+ connector.connectSql();
22
+
23
+ const started = Date.now();
24
+ const timer = setInterval(() => {
25
+ if (connector.dataSource?.isInitialized) {
26
+ clearInterval(timer);
27
+ console.log(
28
+ `RESULT: recovered — dataSource initialized after ${Math.round((Date.now() - started) / 1000)}s, `
29
+ + `createQueryRunner injections=${injected}, attempts=${injected + 1}`,
30
+ );
31
+ connector.closeSql();
32
+ setTimeout(() => process.exit(0), 1500);
33
+ } else if (Date.now() - started > 30000) {
34
+ clearInterval(timer);
35
+ console.log("RESULT: no recovery within 30s");
36
+ process.exit(1);
37
+ }
38
+ }, 250);
@@ -0,0 +1,21 @@
1
+ // Run the tenant `single` e2e suite against the isolated remote database, with no local Docker.
2
+ const fs = require("node:fs");
3
+ const path = require("node:path");
4
+ const { spawnSync } = require("node:child_process");
5
+ const dotenv = require("dotenv");
6
+
7
+ const root = path.join(__dirname, "..");
8
+ dotenv.config({ path: path.join(root, "output", ".env") });
9
+
10
+ const dbUrl = fs.readFileSync(path.join(__dirname, "e2e-db.url"), "utf8").trim();
11
+ const result = spawnSync(
12
+ "npx",
13
+ ["vitest", "run", "test/e2e/tenantSingle.test.ts"],
14
+ {
15
+ cwd: root,
16
+ stdio: "inherit",
17
+ env: { ...process.env, VEX_E2E: "1", VEX_E2E_DB_URL: dbUrl },
18
+ },
19
+ );
20
+
21
+ process.exit(result.status ?? 1);
@@ -0,0 +1,18 @@
1
+ // Run one opt-in e2e suite against the isolated remote database, with no local Docker.
2
+ const fs = require("node:fs");
3
+ const path = require("node:path");
4
+ const { spawnSync } = require("node:child_process");
5
+ const dotenv = require("dotenv");
6
+
7
+ const root = path.join(__dirname, "..");
8
+ dotenv.config({ path: path.join(root, "output", ".env") });
9
+
10
+ const suite = process.argv[2];
11
+ const dbUrl = fs.readFileSync(path.join(__dirname, "e2e-db.url"), "utf8").trim();
12
+ const result = spawnSync("npx", ["vitest", "run", suite], {
13
+ cwd: root,
14
+ stdio: "inherit",
15
+ env: { ...process.env, VEX_E2E: "1", VEX_E2E_DB_URL: dbUrl },
16
+ });
17
+
18
+ process.exit(result.status ?? 1);
@@ -0,0 +1,41 @@
1
+ APP_HOST=http://localhost
2
+ APP_PORT=3000
3
+ MONGODB_URI=mongodb://localhost:27017/veryExpressDB
4
+ SQL_URI=postgresql://username:password@localhost:5432/mydatabase
5
+ SQL_CA=""
6
+ SQL_INSECURE_TLS=true
7
+ SQL_SYNCHRONIZE=true
8
+
9
+ LOGIN_SUCCESS_REDIRECT_PATH=/logincallback
10
+ LOGIN_FAILED_REDIRECT_PATH=/logincallback
11
+
12
+ # OAUTH
13
+ OAUTH_GOOGLE_CLIENTID=
14
+ OAUTH_GOOGLE_CLIENTSECRET=
15
+ OAUTH_GITHUB_CLIENTID=
16
+ OAUTH_GITHUB_CLIENTSECRET=
17
+ # OAUTH_MICROSOFT_CLIENTID=
18
+ # OAUTH_MICROSOFT_CLIENTSECRET=
19
+ # OAUTH_APPLE_CLIENTID=
20
+ # OAUTH_APPLE_CLIENTSECRET=
21
+
22
+ # FIREBASE (auth.firebase in vex.config.json) — see docs/appGenerated/auth.md
23
+ # Server credential: firebase-admin verifies ID tokens, so the project's service account is required.
24
+ # The JSON itself, as one value — generate it in the Firebase console:
25
+ # Project settings > Service accounts > Generate new private key.
26
+ FIREBASE_SERVICE_ACCOUNT_JSON=
27
+ # Browser config: Firebase's *public* web app values, served to the login page by design. There is no
28
+ # secret among them, and no appId — Firebase Auth does not read one.
29
+ FIREBASE_WEB_API_KEY=
30
+ FIREBASE_WEB_AUTH_DOMAIN=
31
+ FIREBASE_WEB_PROJECT_ID=
32
+ # Optional: which sign-in methods the login page renders a button for, comma separated. Defaults to
33
+ # google. The server accepts any provider it knows regardless of this list.
34
+ # FIREBASE_PROVIDERS=google
35
+
36
+ # JWT token
37
+ ACCESS_TOKEN_EXPIRE_TIME='1h'
38
+ REFRESH_TOKEN_EXPIRE_TIME='24h'
39
+ SESSION_COOKIE_SECRET='my-session-cookie-secret'
40
+ JWT_ALGORITHM='HS256'
41
+ JWT_SECRET0='my-secret-key0'
@@ -0,0 +1,333 @@
1
+ {
2
+ "lastGeneratedVersion": "0.10.3",
3
+ "files": {
4
+ "src": {
5
+ "system": {
6
+ "_controllers": {
7
+ "_ControllerFactory.gen.ts": {
8
+ "lastWriteVersion": "0.10.3",
9
+ "allowOverwrite": true
10
+ },
11
+ "ProjectController.gen.ts": {
12
+ "lastWriteVersion": "0.10.3",
13
+ "allowOverwrite": true
14
+ },
15
+ "UserController.gen.ts": {
16
+ "lastWriteVersion": "0.10.3",
17
+ "allowOverwrite": true
18
+ },
19
+ "AuthController.gen.ts": {
20
+ "lastWriteVersion": "0.10.3",
21
+ "allowOverwrite": true
22
+ }
23
+ },
24
+ "_middlewares": {
25
+ "JoinWhitelistMiddleware.gen.ts": {
26
+ "lastWriteVersion": "0.10.3",
27
+ "allowOverwrite": true
28
+ },
29
+ "UserContext.gen.ts": {
30
+ "lastWriteVersion": "0.10.3",
31
+ "allowOverwrite": true
32
+ },
33
+ "tsoaAuthentication.gen.ts": {
34
+ "lastWriteVersion": "0.10.3",
35
+ "allowOverwrite": true
36
+ },
37
+ "JoinWhitelistRegistry.gen.ts": {
38
+ "lastWriteVersion": "0.10.3",
39
+ "allowOverwrite": true
40
+ },
41
+ "DataIsolationRegistry.gen.ts": {
42
+ "lastWriteVersion": "0.10.3",
43
+ "allowOverwrite": true
44
+ },
45
+ "VexFieldRegistry.gen.ts": {
46
+ "lastWriteVersion": "0.10.3",
47
+ "allowOverwrite": true
48
+ },
49
+ "TenantScopeContext.gen.ts": {
50
+ "lastWriteVersion": "0.10.3",
51
+ "allowOverwrite": true
52
+ },
53
+ "TenantScope.gen.ts": {
54
+ "lastWriteVersion": "0.10.3",
55
+ "allowOverwrite": true
56
+ },
57
+ "Authentication.gen.ts": {
58
+ "lastWriteVersion": "0.10.3",
59
+ "allowOverwrite": true
60
+ }
61
+ },
62
+ "_services": {
63
+ "MongooseRepositoryAdapter.gen.ts": {
64
+ "lastWriteVersion": "0.10.3",
65
+ "allowOverwrite": true
66
+ },
67
+ "TypeOrmRepositoryAdapter.gen.ts": {
68
+ "lastWriteVersion": "0.10.3",
69
+ "allowOverwrite": true
70
+ },
71
+ "VexDb.gen.ts": {
72
+ "lastWriteVersion": "0.10.3",
73
+ "allowOverwrite": true
74
+ },
75
+ "VexDbConnector.gen.ts": {
76
+ "lastWriteVersion": "0.10.3",
77
+ "allowOverwrite": true
78
+ },
79
+ "VexSystem.gen.ts": {
80
+ "lastWriteVersion": "0.10.3",
81
+ "allowOverwrite": true
82
+ },
83
+ "auth": {
84
+ "JWTKeyStore.gen.ts": {
85
+ "lastWriteVersion": "0.10.3",
86
+ "allowOverwrite": true
87
+ },
88
+ "JWTService.gen.ts": {
89
+ "lastWriteVersion": "0.10.3",
90
+ "allowOverwrite": true
91
+ },
92
+ "AccountStateGuard.gen.ts": {
93
+ "lastWriteVersion": "0.10.3",
94
+ "allowOverwrite": true
95
+ }
96
+ },
97
+ "oauth": {
98
+ "OAuthProfileMap.gen.ts": {
99
+ "lastWriteVersion": "0.10.3",
100
+ "allowOverwrite": true
101
+ },
102
+ "OAuthStrategyService.gen.ts": {
103
+ "lastWriteVersion": "0.10.3",
104
+ "allowOverwrite": true
105
+ }
106
+ },
107
+ "TenantService.gen.ts": {
108
+ "lastWriteVersion": "0.10.3",
109
+ "allowOverwrite": true
110
+ },
111
+ "account": {
112
+ "AccountDeletionService.gen.ts": {
113
+ "lastWriteVersion": "0.10.3",
114
+ "allowOverwrite": true
115
+ }
116
+ }
117
+ },
118
+ "_types": {
119
+ "vex": {
120
+ "VexRepository.gen.ts": {
121
+ "lastWriteVersion": "0.10.3",
122
+ "allowOverwrite": true
123
+ },
124
+ "VexRequest.gen.ts": {
125
+ "lastWriteVersion": "0.10.3",
126
+ "allowOverwrite": true
127
+ },
128
+ "VexResErr.gen.ts": {
129
+ "lastWriteVersion": "0.10.3",
130
+ "allowOverwrite": true
131
+ },
132
+ "VexResOk.gen.ts": {
133
+ "lastWriteVersion": "0.10.3",
134
+ "allowOverwrite": true
135
+ },
136
+ "VexResponse.gen.ts": {
137
+ "lastWriteVersion": "0.10.3",
138
+ "allowOverwrite": true
139
+ },
140
+ "index.ts": {
141
+ "lastWriteVersion": "0.10.3",
142
+ "allowOverwrite": true
143
+ }
144
+ },
145
+ "Project.gen.ts": {
146
+ "lastWriteVersion": "0.10.3",
147
+ "allowOverwrite": true
148
+ },
149
+ "auth.gen.ts": {
150
+ "lastWriteVersion": "0.10.3",
151
+ "allowOverwrite": true
152
+ },
153
+ "Session.gen.ts": {
154
+ "lastWriteVersion": "0.10.3",
155
+ "allowOverwrite": true
156
+ },
157
+ "User.gen.ts": {
158
+ "lastWriteVersion": "0.10.3",
159
+ "allowOverwrite": true
160
+ },
161
+ "UserAuthProfiles.gen.ts": {
162
+ "lastWriteVersion": "0.10.3",
163
+ "allowOverwrite": true
164
+ },
165
+ "UserTenant.gen.ts": {
166
+ "lastWriteVersion": "0.10.3",
167
+ "allowOverwrite": true
168
+ }
169
+ },
170
+ "_utils": {
171
+ "hash.gen.ts": {
172
+ "lastWriteVersion": "0.10.3",
173
+ "allowOverwrite": true
174
+ },
175
+ "index.ts": {
176
+ "lastWriteVersion": "0.10.3",
177
+ "allowOverwrite": true
178
+ },
179
+ "logger.gen.ts": {
180
+ "lastWriteVersion": "0.10.3",
181
+ "allowOverwrite": true
182
+ },
183
+ "processTimer.gen.ts": {
184
+ "lastWriteVersion": "0.10.3",
185
+ "allowOverwrite": true
186
+ },
187
+ "response.gen.ts": {
188
+ "lastWriteVersion": "0.10.3",
189
+ "allowOverwrite": true
190
+ },
191
+ "validator.gen.ts": {
192
+ "lastWriteVersion": "0.10.3",
193
+ "allowOverwrite": true
194
+ }
195
+ },
196
+ "_models": {
197
+ "ProjectModel.gen.ts": {
198
+ "lastWriteVersion": "0.10.3",
199
+ "allowOverwrite": true
200
+ },
201
+ "SessionModel.gen.ts": {
202
+ "lastWriteVersion": "0.10.3",
203
+ "allowOverwrite": true
204
+ },
205
+ "UserModel.gen.ts": {
206
+ "lastWriteVersion": "0.10.3",
207
+ "allowOverwrite": true
208
+ },
209
+ "UserAuthProfilesModel.gen.ts": {
210
+ "lastWriteVersion": "0.10.3",
211
+ "allowOverwrite": true
212
+ },
213
+ "UserTenantModel.gen.ts": {
214
+ "lastWriteVersion": "0.10.3",
215
+ "allowOverwrite": true
216
+ }
217
+ },
218
+ "_routes": {
219
+ "SwaggerRouter.gen.ts": {
220
+ "lastWriteVersion": "0.10.3",
221
+ "allowOverwrite": true
222
+ },
223
+ "FirebaseAuthUI.gen.ts": {
224
+ "lastWriteVersion": "0.10.3",
225
+ "allowOverwrite": true
226
+ },
227
+ "LoginUI.gen.ts": {
228
+ "lastWriteVersion": "0.10.3",
229
+ "allowOverwrite": true
230
+ },
231
+ "oauth": {
232
+ "OAuthRouteFactory.gen.ts": {
233
+ "lastWriteVersion": "0.10.3",
234
+ "allowOverwrite": true
235
+ }
236
+ }
237
+ }
238
+ },
239
+ "server.ts": {
240
+ "lastWriteVersion": "0.10.3",
241
+ "allowOverwrite": true
242
+ }
243
+ },
244
+ "Dockerfile": {
245
+ "lastWriteVersion": "0.10.3",
246
+ "allowOverwrite": true
247
+ },
248
+ "README.md": {
249
+ "lastWriteVersion": "0.10.3",
250
+ "allowOverwrite": true
251
+ },
252
+ "public": {
253
+ "css": {
254
+ "style.css": {
255
+ "lastWriteVersion": "0.10.3",
256
+ "allowOverwrite": true
257
+ }
258
+ },
259
+ "js": {
260
+ "deleteaccount.js": {
261
+ "lastWriteVersion": "0.10.3",
262
+ "allowOverwrite": true
263
+ },
264
+ "login.js": {
265
+ "lastWriteVersion": "0.10.3",
266
+ "allowOverwrite": true
267
+ },
268
+ "logincallback.js": {
269
+ "lastWriteVersion": "0.10.3",
270
+ "allowOverwrite": true
271
+ },
272
+ "mytokens.js": {
273
+ "lastWriteVersion": "0.10.3",
274
+ "allowOverwrite": true
275
+ },
276
+ "refreshtokens.js": {
277
+ "lastWriteVersion": "0.10.3",
278
+ "allowOverwrite": true
279
+ }
280
+ }
281
+ },
282
+ "scripts": {
283
+ "build.js": {
284
+ "lastWriteVersion": "0.10.3",
285
+ "allowOverwrite": true
286
+ },
287
+ "oacg-fix.js": {
288
+ "lastWriteVersion": "0.10.3",
289
+ "allowOverwrite": true
290
+ }
291
+ },
292
+ "tsconfig.json": {
293
+ "lastWriteVersion": "0.10.3",
294
+ "allowOverwrite": true
295
+ },
296
+ "package.json": {
297
+ "lastWriteVersion": "0.10.3",
298
+ "allowOverwrite": true
299
+ },
300
+ ".env": {
301
+ "lastWriteVersion": "0.10.3",
302
+ "allowOverwrite": true
303
+ },
304
+ "tsoa.json": {
305
+ "lastWriteVersion": "0.10.3",
306
+ "allowOverwrite": true
307
+ },
308
+ "..": {
309
+ "vex.config.json": {
310
+ "lastWriteVersion": "0.10.3",
311
+ "allowOverwrite": true
312
+ },
313
+ "schemas": {
314
+ "Session.json": {
315
+ "lastWriteVersion": "0.10.3",
316
+ "allowOverwrite": true
317
+ },
318
+ "User.json": {
319
+ "lastWriteVersion": "0.10.3",
320
+ "allowOverwrite": true
321
+ },
322
+ "UserAuthProfiles.json": {
323
+ "lastWriteVersion": "0.10.3",
324
+ "allowOverwrite": true
325
+ },
326
+ "UserTenant.json": {
327
+ "lastWriteVersion": "0.10.3",
328
+ "allowOverwrite": true
329
+ }
330
+ }
331
+ }
332
+ }
333
+ }
@@ -0,0 +1,20 @@
1
+ # Use the official Node.js image as the base image
2
+ FROM node:14
3
+
4
+ # Set the working directory inside the container
5
+ WORKDIR /app
6
+
7
+ # Copy package.json and package-lock.json to the working directory
8
+ COPY package*.json ./
9
+
10
+ # Install dependencies
11
+ RUN npm install
12
+
13
+ # Copy only the /dist directory to the working directory
14
+ COPY dist ./dist
15
+
16
+ # Expose the port the app runs on
17
+ EXPOSE 3000
18
+
19
+ # Define the command to run the application
20
+ CMD ["npm", "start"]
@@ -0,0 +1,39 @@
1
+ # This app is generated by [VeryExpress](https://github.com/Justin26l/VeryExpress)
2
+
3
+
4
+ # Quick Start
5
+ 1. install `very-express` from npm
6
+ `npm install -g very-express` or `npm update -g very-express`
7
+
8
+ 2. check configuration file [vex.config.json](./vex.config.json) under project root directory and keep it updated (re-generate the app with very-express).
9
+ `vex`
10
+
11
+ 3. we should have a express typescript app.
12
+ ```
13
+ ├── src/
14
+ │ └── openapi
15
+ │ └── roles (role based access control settings)
16
+ │ └── system (very express generated app)
17
+ ├── package.json
18
+ ├── tsconfig.json
19
+ ├── vex.config.json
20
+ ├── .env
21
+ └── ...
22
+ ```
23
+
24
+ 4. start the generated express app.
25
+ ```
26
+ npm i
27
+ npm build
28
+ npm run start
29
+ ```
30
+
31
+ 5. start the app in docker.
32
+ ```
33
+ npm run docker-build
34
+ npm run docker-start
35
+ ```
36
+
37
+ # Resource
38
+ - [Documents](https://github.com/Justin26l/VeryExpress/blob/main/README.md)
39
+ - [VeryExpress Discord](https://discord.gg/PZGMzDp7)
@@ -0,0 +1,51 @@
1
+ {
2
+ "main": "index.js",
3
+ "scripts": {
4
+ "build": "npm run openapi && tsc -p . && node scripts/build.js",
5
+ "start": "node dist/server.js",
6
+ "dev": "nodemon --watch src --ext ts --ignore src/system/_routes/tsoa_routes.ts --ignore src/openapi/ --exec \"tsoa spec-and-routes && ts-node src/server.ts\"",
7
+ "openapi": "tsoa spec-and-routes",
8
+ "docker-build": "docker build -t very-express .",
9
+ "docker-start": "docker run -p 3000:3000 very-express"
10
+ },
11
+ "dependencies": {
12
+ "cookie": "^0.6.0",
13
+ "cookie-parser": "^1.4.6",
14
+ "dotenv": "^16.4.4",
15
+ "express": "^4.18.2",
16
+ "firebase-admin": "^14.1.0",
17
+ "helmet": "^7.1.0",
18
+ "js-yaml": "^4.1.0",
19
+ "jsonwebtoken": "^9.0.2",
20
+ "passport": "^0.7.0",
21
+ "passport-github": "^1.1.0",
22
+ "passport-google-oauth20": "^2.0.0",
23
+ "passport-jwt": "^4.0.1",
24
+ "pg": "^8.20.0",
25
+ "reflect-metadata": "^0.2.2",
26
+ "swagger-ui-express": "^5.0.0",
27
+ "tsoa": "^7.0.0-alpha.0",
28
+ "typeorm": "^0.3.20"
29
+ },
30
+ "devDependencies": {
31
+ "@types/cookie-parser": "^1.4.7",
32
+ "@types/crypto-js": "^4.1.2",
33
+ "@types/dotenv": "^8.2.0",
34
+ "@types/express": "^4.17.17",
35
+ "@types/js-yaml": "^4.0.9",
36
+ "@types/jsonwebtoken": "^9.0.7",
37
+ "@types/mongodb": "^4.0.7",
38
+ "@types/ms": "^2.1.0",
39
+ "@types/node": "^20.4.2",
40
+ "@types/passport": "^1.0.16",
41
+ "@types/passport-github": "^1.1.12",
42
+ "@types/passport-google-oauth20": "^2.0.14",
43
+ "@types/pg": "^8.11.0",
44
+ "@types/swagger-ui-express": "^4.1.6",
45
+ "@types/ws": "^8.5.5",
46
+ "nodemon": "^2.0.22",
47
+ "strip-json-comments": "^5.0.1",
48
+ "ts-node": "^10.9.1",
49
+ "typescript": "^5.1.6"
50
+ }
51
+ }
@@ -0,0 +1,8 @@
1
+
2
+ pre {
3
+ background-color: #f4f4f4;
4
+ padding: 20px;
5
+ overflow: auto;
6
+ border: 1px solid #ccc;
7
+ white-space: pre-wrap;
8
+ }