very-express 0.9.0 → 0.10.1

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 (131) hide show
  1. package/.tmp/als-proof.mjs +15 -0
  2. package/.tmp/als-proof2.mjs +9 -0
  3. package/.tmp/gen/out/.env +41 -0
  4. package/.tmp/gen/out/.vex/meta.json +387 -0
  5. package/.tmp/gen/out/Dockerfile +20 -0
  6. package/.tmp/gen/out/README.md +39 -0
  7. package/.tmp/gen/out/package.json +51 -0
  8. package/.tmp/gen/out/public/css/style.css +8 -0
  9. package/.tmp/gen/out/public/js/deleteaccount.js +80 -0
  10. package/.tmp/gen/out/public/js/login.js +59 -0
  11. package/.tmp/gen/out/public/js/logincallback.js +19 -0
  12. package/.tmp/gen/out/public/js/mytokens.js +11 -0
  13. package/.tmp/gen/out/public/js/refreshtokens.js +23 -0
  14. package/.tmp/gen/out/scripts/build.js +39 -0
  15. package/.tmp/gen/out/scripts/oacg-fix.js +83 -0
  16. package/.tmp/gen/out/tsconfig.json +30 -0
  17. package/.tmp/gen/out/tsoa.json +32 -0
  18. package/.tmp/gen/schemas/Project.json +50 -0
  19. package/.tmp/gen/schemas/Session.json +49 -0
  20. package/.tmp/gen/schemas/User.json +81 -0
  21. package/.tmp/gen/schemas/UserAuthProfiles.json +54 -0
  22. package/.tmp/gen/schemas/UserRole.json +40 -0
  23. package/.tmp/gen/schemas/UserTenant.json +39 -0
  24. package/.tmp/gen/vex.config.json +39 -0
  25. package/.tmp/gen0/out/.env +41 -0
  26. package/.tmp/gen0/out/.vex/meta.json +323 -0
  27. package/.tmp/gen0/out/Dockerfile +20 -0
  28. package/.tmp/gen0/out/README.md +39 -0
  29. package/.tmp/gen0/out/package.json +51 -0
  30. package/.tmp/gen0/out/public/css/style.css +8 -0
  31. package/.tmp/gen0/out/public/js/deleteaccount.js +80 -0
  32. package/.tmp/gen0/out/public/js/login.js +59 -0
  33. package/.tmp/gen0/out/public/js/logincallback.js +19 -0
  34. package/.tmp/gen0/out/public/js/mytokens.js +11 -0
  35. package/.tmp/gen0/out/public/js/refreshtokens.js +23 -0
  36. package/.tmp/gen0/out/scripts/build.js +39 -0
  37. package/.tmp/gen0/out/scripts/oacg-fix.js +83 -0
  38. package/.tmp/gen0/out/tsconfig.json +30 -0
  39. package/.tmp/gen0/out/tsoa.json +32 -0
  40. package/.tmp/gen0/schemas/Session.json +49 -0
  41. package/.tmp/gen0/schemas/User.json +81 -0
  42. package/.tmp/gen0/schemas/UserAuthProfiles.json +54 -0
  43. package/.tmp/gen0/schemas/UserRole.json +38 -0
  44. package/.tmp/gen0/vex.config.json +32 -0
  45. package/.tmp/gend/out/.env +41 -0
  46. package/.tmp/gend/out/.vex/meta.json +317 -0
  47. package/.tmp/gend/out/Dockerfile +20 -0
  48. package/.tmp/gend/out/README.md +39 -0
  49. package/.tmp/gend/out/package.json +51 -0
  50. package/.tmp/gend/out/public/css/style.css +8 -0
  51. package/.tmp/gend/out/public/js/deleteaccount.js +80 -0
  52. package/.tmp/gend/out/public/js/login.js +59 -0
  53. package/.tmp/gend/out/public/js/logincallback.js +19 -0
  54. package/.tmp/gend/out/public/js/mytokens.js +11 -0
  55. package/.tmp/gend/out/public/js/refreshtokens.js +23 -0
  56. package/.tmp/gend/out/scripts/build.js +39 -0
  57. package/.tmp/gend/out/scripts/oacg-fix.js +83 -0
  58. package/.tmp/gend/out/tsconfig.json +30 -0
  59. package/.tmp/gend/out/tsoa.json +32 -0
  60. package/.tmp/gend/schemas/Session.json +49 -0
  61. package/.tmp/gend/schemas/User.json +81 -0
  62. package/.tmp/gend/schemas/UserAuthProfiles.json +54 -0
  63. package/.tmp/gend/schemas/UserContact.json +40 -0
  64. package/.tmp/gend/schemas/UserNote.json +27 -0
  65. package/.tmp/gend/vex.config.json +33 -0
  66. package/.tmp/genh/out/.env +41 -0
  67. package/.tmp/genh/out/.vex/meta.json +323 -0
  68. package/.tmp/genh/out/Dockerfile +20 -0
  69. package/.tmp/genh/out/README.md +39 -0
  70. package/.tmp/genh/out/package.json +51 -0
  71. package/.tmp/genh/out/public/css/style.css +8 -0
  72. package/.tmp/genh/out/public/js/deleteaccount.js +80 -0
  73. package/.tmp/genh/out/public/js/login.js +59 -0
  74. package/.tmp/genh/out/public/js/logincallback.js +19 -0
  75. package/.tmp/genh/out/public/js/mytokens.js +11 -0
  76. package/.tmp/genh/out/public/js/refreshtokens.js +23 -0
  77. package/.tmp/genh/out/scripts/build.js +39 -0
  78. package/.tmp/genh/out/scripts/oacg-fix.js +83 -0
  79. package/.tmp/genh/out/tsconfig.json +30 -0
  80. package/.tmp/genh/out/tsoa.json +32 -0
  81. package/.tmp/genh/schemas/Project.json +41 -0
  82. package/.tmp/genh/schemas/Session.json +49 -0
  83. package/.tmp/genh/schemas/User.json +81 -0
  84. package/.tmp/genh/schemas/UserAuthProfiles.json +54 -0
  85. package/.tmp/genh/schemas/UserTenant.json +39 -0
  86. package/.tmp/genh/vex.config.json +34 -0
  87. package/.tmp/gens/out/.env +41 -0
  88. package/.tmp/gens/out/.vex/meta.json +335 -0
  89. package/.tmp/gens/out/Dockerfile +20 -0
  90. package/.tmp/gens/out/README.md +39 -0
  91. package/.tmp/gens/out/package.json +51 -0
  92. package/.tmp/gens/out/public/css/style.css +8 -0
  93. package/.tmp/gens/out/public/js/deleteaccount.js +80 -0
  94. package/.tmp/gens/out/public/js/login.js +59 -0
  95. package/.tmp/gens/out/public/js/logincallback.js +19 -0
  96. package/.tmp/gens/out/public/js/mytokens.js +11 -0
  97. package/.tmp/gens/out/public/js/refreshtokens.js +23 -0
  98. package/.tmp/gens/out/scripts/build.js +39 -0
  99. package/.tmp/gens/out/scripts/oacg-fix.js +83 -0
  100. package/.tmp/gens/out/tsconfig.json +30 -0
  101. package/.tmp/gens/out/tsoa.json +32 -0
  102. package/.tmp/gens/schemas/Session.json +49 -0
  103. package/.tmp/gens/schemas/User.json +81 -0
  104. package/.tmp/gens/schemas/UserAuthProfiles.json +54 -0
  105. package/.tmp/gens/schemas/UserRole.json +38 -0
  106. package/.tmp/gens/vex.config.json +32 -0
  107. package/.tmp/npmtest/package.json +1 -0
  108. package/.tmp/ro-test +0 -0
  109. package/AGENTS.md +4 -3
  110. package/README.md +1 -0
  111. package/dist/index.js +955 -653
  112. package/dist/templates/_middlewares/Authentication.ts +1 -1
  113. package/dist/templates/_middlewares/UserContext.ts +30 -4
  114. package/dist/templates/_services/MongooseRepositoryAdapter.ts +94 -4
  115. package/dist/templates/_services/TypeOrmRepositoryAdapter.ts +92 -17
  116. package/dist/templates/_services/VexDbConnector.ts +36 -1
  117. package/dist/templates/_services/auth/JWTService.ts +13 -2
  118. package/dist/templates/_tenant/TenantScopeContext.ts +56 -0
  119. package/dist/templates/_types/auth.ts +7 -1
  120. package/dist/templates/_types/vex/VexRepository.ts +9 -2
  121. package/dist/templates/tenantJsonSchema/UserTenant.json +33 -0
  122. package/docs/architecture/databaseTargets.md +37 -8
  123. package/docs/architecture/generatorPipeline.md +2 -1
  124. package/docs/features/accountDeletion.md +61 -9
  125. package/docs/features/dataIsolation.md +58 -31
  126. package/docs/features/tenantIsolation.md +147 -0
  127. package/docs/releaseNote/v0-10-0.md +147 -0
  128. package/docs/releaseNote/v0-10-1.md +84 -0
  129. package/docs/vexJsonSchema.md +22 -0
  130. package/package.json +1 -1
  131. package/vitest.config.ts +3 -0
@@ -0,0 +1,15 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ const als = new AsyncLocalStorage();
3
+
4
+ // L0 middleware: tenant known from header
5
+ als.run({ tenantId: "t1" }, () => {
6
+ // L1 Auth middleware: token known
7
+ als.run({ tokenData: { vexUserId: "u1" } }, () => {
8
+ // L2 repository adapter
9
+ Promise.resolve().then(() => {
10
+ console.log("downstream store:", JSON.stringify(als.getStore()));
11
+ // after inner run returns, outer store is restored
12
+ setImmediate(() => console.log("after inner callback (outer frame):", JSON.stringify(als.getStore())));
13
+ });
14
+ });
15
+ });
@@ -0,0 +1,9 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ const als = new AsyncLocalStorage();
3
+ als.run({ tenantId: "t1" }, () => {
4
+ console.log("outer:", JSON.stringify(als.getStore()));
5
+ als.run({ tokenData: { vexUserId: "u1" } }, () => {
6
+ console.log("inner:", JSON.stringify(als.getStore()));
7
+ });
8
+ console.log("sync after inner returns:", JSON.stringify(als.getStore()));
9
+ });
@@ -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,387 @@
1
+ {
2
+ "lastGeneratedVersion": "0.10.0",
3
+ "files": {
4
+ "..": {
5
+ "vex.config.json": {
6
+ "lastWriteVersion": "0.10.0",
7
+ "allowOverwrite": true
8
+ },
9
+ "schemas": {
10
+ "Session.json": {
11
+ "lastWriteVersion": "0.10.0",
12
+ "allowOverwrite": true
13
+ },
14
+ "User.json": {
15
+ "lastWriteVersion": "0.10.0",
16
+ "allowOverwrite": true
17
+ },
18
+ "UserAuthProfiles.json": {
19
+ "lastWriteVersion": "0.10.0",
20
+ "allowOverwrite": true
21
+ },
22
+ "UserRole.json": {
23
+ "lastWriteVersion": "0.10.0",
24
+ "allowOverwrite": true
25
+ },
26
+ "UserTenant.json": {
27
+ "lastWriteVersion": "0.10.0",
28
+ "allowOverwrite": true
29
+ }
30
+ }
31
+ },
32
+ "src": {
33
+ "system": {
34
+ "_controllers": {
35
+ "_ControllerFactory.gen.ts": {
36
+ "lastWriteVersion": "0.10.0",
37
+ "allowOverwrite": true
38
+ },
39
+ "ProjectController.gen.ts": {
40
+ "lastWriteVersion": "0.10.0",
41
+ "allowOverwrite": true
42
+ },
43
+ "UserController.gen.ts": {
44
+ "lastWriteVersion": "0.10.0",
45
+ "allowOverwrite": true
46
+ },
47
+ "TenantController.gen.ts": {
48
+ "lastWriteVersion": "0.10.0",
49
+ "allowOverwrite": true
50
+ },
51
+ "AuthController.gen.ts": {
52
+ "lastWriteVersion": "0.10.0",
53
+ "allowOverwrite": true
54
+ }
55
+ },
56
+ "_middlewares": {
57
+ "Authentication.gen.ts": {
58
+ "lastWriteVersion": "0.10.0",
59
+ "allowOverwrite": true
60
+ },
61
+ "JoinWhitelistMiddleware.gen.ts": {
62
+ "lastWriteVersion": "0.10.0",
63
+ "allowOverwrite": true
64
+ },
65
+ "UserContext.gen.ts": {
66
+ "lastWriteVersion": "0.10.0",
67
+ "allowOverwrite": true
68
+ },
69
+ "tsoaAuthentication.gen.ts": {
70
+ "lastWriteVersion": "0.10.0",
71
+ "allowOverwrite": true
72
+ },
73
+ "RoleBaseAccessControl.gen.ts": {
74
+ "lastWriteVersion": "0.10.0",
75
+ "allowOverwrite": true
76
+ },
77
+ "JoinWhitelistRegistry.gen.ts": {
78
+ "lastWriteVersion": "0.10.0",
79
+ "allowOverwrite": true
80
+ },
81
+ "DataIsolationRegistry.gen.ts": {
82
+ "lastWriteVersion": "0.10.0",
83
+ "allowOverwrite": true
84
+ },
85
+ "VexFieldRegistry.gen.ts": {
86
+ "lastWriteVersion": "0.10.0",
87
+ "allowOverwrite": true
88
+ },
89
+ "TenantScopeContext.gen.ts": {
90
+ "lastWriteVersion": "0.10.0",
91
+ "allowOverwrite": true
92
+ },
93
+ "TenantScope.gen.ts": {
94
+ "lastWriteVersion": "0.10.0",
95
+ "allowOverwrite": true
96
+ }
97
+ },
98
+ "_routes": {
99
+ "FirebaseAuthUI.gen.ts": {
100
+ "lastWriteVersion": "0.10.0",
101
+ "allowOverwrite": true
102
+ },
103
+ "LoginUI.gen.ts": {
104
+ "lastWriteVersion": "0.10.0",
105
+ "allowOverwrite": true
106
+ },
107
+ "oauth": {
108
+ "OAuthRouteFactory.gen.ts": {
109
+ "lastWriteVersion": "0.10.0",
110
+ "allowOverwrite": true
111
+ }
112
+ },
113
+ "SwaggerRouter.gen.ts": {
114
+ "lastWriteVersion": "0.10.0",
115
+ "allowOverwrite": true
116
+ }
117
+ },
118
+ "_services": {
119
+ "MongooseRepositoryAdapter.gen.ts": {
120
+ "lastWriteVersion": "0.10.0",
121
+ "allowOverwrite": true
122
+ },
123
+ "TypeOrmRepositoryAdapter.gen.ts": {
124
+ "lastWriteVersion": "0.10.0",
125
+ "allowOverwrite": true
126
+ },
127
+ "VexDb.gen.ts": {
128
+ "lastWriteVersion": "0.10.0",
129
+ "allowOverwrite": true
130
+ },
131
+ "VexDbConnector.gen.ts": {
132
+ "lastWriteVersion": "0.10.0",
133
+ "allowOverwrite": true
134
+ },
135
+ "VexSystem.gen.ts": {
136
+ "lastWriteVersion": "0.10.0",
137
+ "allowOverwrite": true
138
+ },
139
+ "auth": {
140
+ "JWTKeyStore.gen.ts": {
141
+ "lastWriteVersion": "0.10.0",
142
+ "allowOverwrite": true
143
+ },
144
+ "JWTService.gen.ts": {
145
+ "lastWriteVersion": "0.10.0",
146
+ "allowOverwrite": true
147
+ },
148
+ "AccountStateGuard.gen.ts": {
149
+ "lastWriteVersion": "0.10.0",
150
+ "allowOverwrite": true
151
+ }
152
+ },
153
+ "oauth": {
154
+ "OAuthProfileMap.gen.ts": {
155
+ "lastWriteVersion": "0.10.0",
156
+ "allowOverwrite": true
157
+ },
158
+ "OAuthStrategyService.gen.ts": {
159
+ "lastWriteVersion": "0.10.0",
160
+ "allowOverwrite": true
161
+ }
162
+ },
163
+ "TenantService.gen.ts": {
164
+ "lastWriteVersion": "0.10.0",
165
+ "allowOverwrite": true
166
+ }
167
+ },
168
+ "_types": {
169
+ "auth.gen.ts": {
170
+ "lastWriteVersion": "0.10.0",
171
+ "allowOverwrite": true
172
+ },
173
+ "vex": {
174
+ "VexRepository.gen.ts": {
175
+ "lastWriteVersion": "0.10.0",
176
+ "allowOverwrite": true
177
+ },
178
+ "VexRequest.gen.ts": {
179
+ "lastWriteVersion": "0.10.0",
180
+ "allowOverwrite": true
181
+ },
182
+ "VexResErr.gen.ts": {
183
+ "lastWriteVersion": "0.10.0",
184
+ "allowOverwrite": true
185
+ },
186
+ "VexResOk.gen.ts": {
187
+ "lastWriteVersion": "0.10.0",
188
+ "allowOverwrite": true
189
+ },
190
+ "VexResponse.gen.ts": {
191
+ "lastWriteVersion": "0.10.0",
192
+ "allowOverwrite": true
193
+ },
194
+ "index.ts": {
195
+ "lastWriteVersion": "0.10.0",
196
+ "allowOverwrite": true
197
+ }
198
+ },
199
+ "Project.gen.ts": {
200
+ "lastWriteVersion": "0.10.0",
201
+ "allowOverwrite": true
202
+ },
203
+ "Session.gen.ts": {
204
+ "lastWriteVersion": "0.10.0",
205
+ "allowOverwrite": true
206
+ },
207
+ "User.gen.ts": {
208
+ "lastWriteVersion": "0.10.0",
209
+ "allowOverwrite": true
210
+ },
211
+ "UserAuthProfiles.gen.ts": {
212
+ "lastWriteVersion": "0.10.0",
213
+ "allowOverwrite": true
214
+ },
215
+ "UserRole.gen.ts": {
216
+ "lastWriteVersion": "0.10.0",
217
+ "allowOverwrite": true
218
+ },
219
+ "UserTenant.gen.ts": {
220
+ "lastWriteVersion": "0.10.0",
221
+ "allowOverwrite": true
222
+ },
223
+ "Tenant.gen.ts": {
224
+ "lastWriteVersion": "0.10.0",
225
+ "allowOverwrite": true
226
+ }
227
+ },
228
+ "_utils": {
229
+ "hash.gen.ts": {
230
+ "lastWriteVersion": "0.10.0",
231
+ "allowOverwrite": true
232
+ },
233
+ "index.ts": {
234
+ "lastWriteVersion": "0.10.0",
235
+ "allowOverwrite": true
236
+ },
237
+ "logger.gen.ts": {
238
+ "lastWriteVersion": "0.10.0",
239
+ "allowOverwrite": true
240
+ },
241
+ "processTimer.gen.ts": {
242
+ "lastWriteVersion": "0.10.0",
243
+ "allowOverwrite": true
244
+ },
245
+ "response.gen.ts": {
246
+ "lastWriteVersion": "0.10.0",
247
+ "allowOverwrite": true
248
+ },
249
+ "validator.gen.ts": {
250
+ "lastWriteVersion": "0.10.0",
251
+ "allowOverwrite": true
252
+ }
253
+ },
254
+ "_roles": {
255
+ "_RoleFactory.gen.ts": {
256
+ "lastWriteVersion": "0.10.0",
257
+ "allowOverwrite": true
258
+ },
259
+ "visitor.gen.ts": {
260
+ "lastWriteVersion": "0.10.0",
261
+ "allowOverwrite": true
262
+ },
263
+ "member.gen.ts": {
264
+ "lastWriteVersion": "0.10.0",
265
+ "allowOverwrite": true
266
+ },
267
+ "admin.gen.ts": {
268
+ "lastWriteVersion": "0.10.0",
269
+ "allowOverwrite": true
270
+ },
271
+ "index.ts": {
272
+ "lastWriteVersion": "0.10.0",
273
+ "allowOverwrite": true
274
+ }
275
+ },
276
+ "_models": {
277
+ "ProjectModel.gen.ts": {
278
+ "lastWriteVersion": "0.10.0",
279
+ "allowOverwrite": true
280
+ },
281
+ "SessionModel.gen.ts": {
282
+ "lastWriteVersion": "0.10.0",
283
+ "allowOverwrite": true
284
+ },
285
+ "UserModel.gen.ts": {
286
+ "lastWriteVersion": "0.10.0",
287
+ "allowOverwrite": true
288
+ },
289
+ "UserAuthProfilesModel.gen.ts": {
290
+ "lastWriteVersion": "0.10.0",
291
+ "allowOverwrite": true
292
+ },
293
+ "UserRoleModel.gen.ts": {
294
+ "lastWriteVersion": "0.10.0",
295
+ "allowOverwrite": true
296
+ },
297
+ "UserTenantModel.gen.ts": {
298
+ "lastWriteVersion": "0.10.0",
299
+ "allowOverwrite": true
300
+ }
301
+ }
302
+ },
303
+ "roles": {
304
+ "visitor.json": {
305
+ "lastWriteVersion": "0.10.0",
306
+ "allowOverwrite": true
307
+ },
308
+ "member.json": {
309
+ "lastWriteVersion": "0.10.0",
310
+ "allowOverwrite": true
311
+ },
312
+ "admin.json": {
313
+ "lastWriteVersion": "0.10.0",
314
+ "allowOverwrite": true
315
+ }
316
+ },
317
+ "server.ts": {
318
+ "lastWriteVersion": "0.10.0",
319
+ "allowOverwrite": true
320
+ }
321
+ },
322
+ "Dockerfile": {
323
+ "lastWriteVersion": "0.10.0",
324
+ "allowOverwrite": true
325
+ },
326
+ "README.md": {
327
+ "lastWriteVersion": "0.10.0",
328
+ "allowOverwrite": true
329
+ },
330
+ "public": {
331
+ "css": {
332
+ "style.css": {
333
+ "lastWriteVersion": "0.10.0",
334
+ "allowOverwrite": true
335
+ }
336
+ },
337
+ "js": {
338
+ "deleteaccount.js": {
339
+ "lastWriteVersion": "0.10.0",
340
+ "allowOverwrite": true
341
+ },
342
+ "login.js": {
343
+ "lastWriteVersion": "0.10.0",
344
+ "allowOverwrite": true
345
+ },
346
+ "logincallback.js": {
347
+ "lastWriteVersion": "0.10.0",
348
+ "allowOverwrite": true
349
+ },
350
+ "mytokens.js": {
351
+ "lastWriteVersion": "0.10.0",
352
+ "allowOverwrite": true
353
+ },
354
+ "refreshtokens.js": {
355
+ "lastWriteVersion": "0.10.0",
356
+ "allowOverwrite": true
357
+ }
358
+ }
359
+ },
360
+ "scripts": {
361
+ "build.js": {
362
+ "lastWriteVersion": "0.10.0",
363
+ "allowOverwrite": true
364
+ },
365
+ "oacg-fix.js": {
366
+ "lastWriteVersion": "0.10.0",
367
+ "allowOverwrite": true
368
+ }
369
+ },
370
+ "tsconfig.json": {
371
+ "lastWriteVersion": "0.10.0",
372
+ "allowOverwrite": true
373
+ },
374
+ "package.json": {
375
+ "lastWriteVersion": "0.10.0",
376
+ "allowOverwrite": true
377
+ },
378
+ ".env": {
379
+ "lastWriteVersion": "0.10.0",
380
+ "allowOverwrite": true
381
+ },
382
+ "tsoa.json": {
383
+ "lastWriteVersion": "0.10.0",
384
+ "allowOverwrite": true
385
+ }
386
+ }
387
+ }
@@ -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
+ }
@@ -0,0 +1,80 @@
1
+ // Self-service account deletion page.
2
+ //
3
+ // Sends the access token the same way the rest of the app does — Authorization + X-Auth-Index —
4
+ // and clears the stored tokens on success, because the account is gone the moment the tombstone
5
+ // is written: keeping a token the server will now reject only produces confusing 401s.
6
+
7
+ // The page loads this script from <head>, so it must wait for the DOM: at parse time the
8
+ // button does not exist yet and getElementById would return null.
9
+ document.addEventListener("DOMContentLoaded", function () {
10
+ var button = document.getElementById("deleteAccountBtn");
11
+ var input = document.getElementById("confirmInput");
12
+ var result = document.getElementById("deleteResult");
13
+
14
+ if (!button || !input || !result) return;
15
+
16
+ function clearTokens() {
17
+ localStorage.removeItem("accessToken");
18
+ localStorage.removeItem("accessTokenIndex");
19
+ localStorage.removeItem("refreshToken");
20
+ localStorage.removeItem("refreshTokenIndex");
21
+ }
22
+
23
+ function render(data) {
24
+ result.textContent = JSON.stringify(data, null, 2);
25
+ }
26
+
27
+ button.addEventListener("click", function () {
28
+ if (input.value !== "DELETE") {
29
+ render({ error: 'Type DELETE in the box to confirm.' });
30
+ return;
31
+ }
32
+
33
+ button.disabled = true;
34
+ render({ status: "Deleting…" });
35
+
36
+ fetch("/api/auth/delete-account", {
37
+ method: "POST",
38
+ credentials: "include",
39
+ headers: {
40
+ "Content-Type": "application/json",
41
+ "Authorization": "Bearer " + (localStorage.getItem("accessToken") || ""),
42
+ "X-Auth-Index": localStorage.getItem("accessTokenIndex") || "",
43
+ },
44
+ })
45
+ .then(function (response) {
46
+ // read as text first: an error response may not be JSON (a proxy or the
47
+ // express error handler can return HTML), and response.json() would then
48
+ // reject and hide the real status behind a parse error
49
+ return response.text().then(function (text) {
50
+ var body;
51
+ try {
52
+ body = text ? JSON.parse(text) : {};
53
+ }
54
+ catch (e) {
55
+ body = { raw: text };
56
+ }
57
+
58
+ return { ok: response.ok, status: response.status, body: body };
59
+ });
60
+ })
61
+ .then(function (outcome) {
62
+ if (!outcome.ok) {
63
+ render({ status: outcome.status, error: outcome.body });
64
+ button.disabled = false;
65
+ return;
66
+ }
67
+
68
+ clearTokens();
69
+ render({
70
+ status: "Account deleted. You have been signed out.",
71
+ result: outcome.body,
72
+ });
73
+ input.value = "";
74
+ })
75
+ .catch(function (err) {
76
+ render({ error: String(err) });
77
+ button.disabled = false;
78
+ });
79
+ });
80
+ });