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.
- package/.tmp/_body.txt +1 -0
- package/.tmp/_idx.txt +1 -0
- package/.tmp/_token.txt +1 -0
- package/.tmp/check-a/app/.vex/meta.json +216 -0
- package/.tmp/check-a/app/Dockerfile +20 -0
- package/.tmp/check-a/app/README.md +39 -0
- package/.tmp/check-a/app/public/css/style.css +8 -0
- package/.tmp/check-a/app/public/js/deleteaccount.js +80 -0
- package/.tmp/check-a/app/public/js/login.js +59 -0
- package/.tmp/check-a/app/public/js/logincallback.js +19 -0
- package/.tmp/check-a/app/public/js/mytokens.js +11 -0
- package/.tmp/check-a/app/public/js/refreshtokens.js +23 -0
- package/.tmp/check-a/app/scripts/build.js +39 -0
- package/.tmp/check-a/app/scripts/oacg-fix.js +83 -0
- package/.tmp/check-a/app/tsconfig.json +30 -0
- package/.tmp/check-a/schemas/Project.json +41 -0
- package/.tmp/check-a/schemas/Session.json +49 -0
- package/.tmp/check-a/schemas/UserAuthProfiles.json +54 -0
- package/.tmp/check-a/vex.config.json +26 -0
- package/.tmp/check-b/app/.env +41 -0
- package/.tmp/check-b/app/.vex/meta.json +219 -0
- package/.tmp/check-b/app/Dockerfile +20 -0
- package/.tmp/check-b/app/README.md +39 -0
- package/.tmp/check-b/app/package.json +51 -0
- package/.tmp/check-b/app/public/css/style.css +8 -0
- package/.tmp/check-b/app/public/js/deleteaccount.js +80 -0
- package/.tmp/check-b/app/public/js/login.js +59 -0
- package/.tmp/check-b/app/public/js/logincallback.js +19 -0
- package/.tmp/check-b/app/public/js/mytokens.js +11 -0
- package/.tmp/check-b/app/public/js/refreshtokens.js +23 -0
- package/.tmp/check-b/app/scripts/build.js +39 -0
- package/.tmp/check-b/app/scripts/oacg-fix.js +83 -0
- package/.tmp/check-b/app/tsconfig.json +30 -0
- package/.tmp/check-b/app/tsoa.json +32 -0
- package/.tmp/check-b/schemas/Project.json +41 -0
- package/.tmp/check-b/vex.config.json +30 -0
- package/.tmp/check-c/app/.env +41 -0
- package/.tmp/check-c/app/.vex/meta.json +231 -0
- package/.tmp/check-c/app/Dockerfile +20 -0
- package/.tmp/check-c/app/README.md +39 -0
- package/.tmp/check-c/app/package.json +51 -0
- package/.tmp/check-c/app/public/css/style.css +8 -0
- package/.tmp/check-c/app/public/js/deleteaccount.js +80 -0
- package/.tmp/check-c/app/public/js/login.js +59 -0
- package/.tmp/check-c/app/public/js/logincallback.js +19 -0
- package/.tmp/check-c/app/public/js/mytokens.js +11 -0
- package/.tmp/check-c/app/public/js/refreshtokens.js +23 -0
- package/.tmp/check-c/app/scripts/build.js +39 -0
- package/.tmp/check-c/app/scripts/oacg-fix.js +83 -0
- package/.tmp/check-c/app/tsconfig.json +30 -0
- package/.tmp/check-c/app/tsoa.json +32 -0
- package/.tmp/check-c/schemas/Project.json +41 -0
- package/.tmp/check-c/schemas/User.json +81 -0
- package/.tmp/check-c/vex.config.json +30 -0
- package/.tmp/demo-project/vex.config.json +43 -0
- package/.tmp/demo-project2/vex.config.json +43 -0
- package/.tmp/demo-schemas/Client.json +65 -0
- package/.tmp/demo-schemas/FnbOrder.json +33 -0
- package/.tmp/demo-schemas/Job.json +86 -0
- package/.tmp/demo-schemas/KernelEvent.json +29 -0
- package/.tmp/demo-schemas/Package.json +77 -0
- package/.tmp/demo-schemas/Session.json +49 -0
- package/.tmp/demo-schemas/Tenant.json +22 -0
- package/.tmp/demo-schemas/User.json +81 -0
- package/.tmp/demo-schemas/UserAuthProfiles.json +54 -0
- package/.tmp/demo-schemas/UserContact.json +76 -0
- package/.tmp/demo-schemas/UserRole.json +40 -0
- package/.tmp/demo-schemas/UserTenant.json +39 -0
- package/.tmp/demo-schemas2/Client.json +65 -0
- package/.tmp/demo-schemas2/FnbOrder.json +33 -0
- package/.tmp/demo-schemas2/Job.json +86 -0
- package/.tmp/demo-schemas2/KernelEvent.json +29 -0
- package/.tmp/demo-schemas2/Package.json +77 -0
- package/.tmp/demo-schemas2/Session.json +49 -0
- package/.tmp/demo-schemas2/Tenant.json +22 -0
- package/.tmp/demo-schemas2/User.json +81 -0
- package/.tmp/demo-schemas2/UserAuthProfiles.json +54 -0
- package/.tmp/demo-schemas2/UserContact.json +76 -0
- package/.tmp/demo-schemas2/UserRole.json +40 -0
- package/.tmp/demo-schemas2/UserTenant.json +39 -0
- package/.tmp/e2e-db.url +1 -0
- package/.tmp/nouser/out/.env +41 -0
- package/.tmp/nouser/out/.vex/meta.json +323 -0
- package/.tmp/nouser/out/Dockerfile +20 -0
- package/.tmp/nouser/out/README.md +39 -0
- package/.tmp/nouser/out/package.json +51 -0
- package/.tmp/nouser/out/public/css/style.css +8 -0
- package/.tmp/nouser/out/public/js/deleteaccount.js +80 -0
- package/.tmp/nouser/out/public/js/login.js +59 -0
- package/.tmp/nouser/out/public/js/logincallback.js +19 -0
- package/.tmp/nouser/out/public/js/mytokens.js +11 -0
- package/.tmp/nouser/out/public/js/refreshtokens.js +23 -0
- package/.tmp/nouser/out/scripts/build.js +39 -0
- package/.tmp/nouser/out/scripts/oacg-fix.js +83 -0
- package/.tmp/nouser/out/tsconfig.json +30 -0
- package/.tmp/nouser/out/tsoa.json +32 -0
- package/.tmp/nouser/schemas/Project.json +41 -0
- package/.tmp/nouser/schemas/Session.json +49 -0
- package/.tmp/nouser/schemas/User.json +81 -0
- package/.tmp/nouser/schemas/UserAuthProfiles.json +54 -0
- package/.tmp/nouser/schemas/UserTenant.json +39 -0
- package/.tmp/nouser/vex.config.json +34 -0
- package/.tmp/npm-test-after-fix.log +217 -0
- package/.tmp/npm-test-final.log +165 -0
- package/.tmp/npm-test-final2.log +163 -0
- package/.tmp/npm-test-recheck.log +192 -0
- package/.tmp/npm-test-update.log +164 -0
- package/.tmp/npm-test.log +166 -0
- package/.tmp/output-build-after-fix.log +8 -0
- package/.tmp/output-build-baseline.log +8 -0
- package/.tmp/output-build-canonical.log +8 -0
- package/.tmp/output-build-final2.log +8 -0
- package/.tmp/output-build-reapply.log +8 -0
- package/.tmp/output-build.log +8 -0
- package/.tmp/output.env.bak +34 -0
- package/.tmp/probe_body.txt +1 -0
- package/.tmp/provision-e2e-db.js +41 -0
- package/.tmp/retry-nodestroy.log +18 -0
- package/.tmp/retry-recovery-final2.log +8 -0
- package/.tmp/retry-recovery-reapply.log +8 -0
- package/.tmp/retry-recovery.js +38 -0
- package/.tmp/run-e2e-single.js +21 -0
- package/.tmp/run-e2e.js +18 -0
- package/.tmp/verify-noauth/app/.env +41 -0
- package/.tmp/verify-noauth/app/.vex/meta.json +333 -0
- package/.tmp/verify-noauth/app/Dockerfile +20 -0
- package/.tmp/verify-noauth/app/README.md +39 -0
- package/.tmp/verify-noauth/app/package.json +51 -0
- package/.tmp/verify-noauth/app/public/css/style.css +8 -0
- package/.tmp/verify-noauth/app/public/js/deleteaccount.js +80 -0
- package/.tmp/verify-noauth/app/public/js/login.js +59 -0
- package/.tmp/verify-noauth/app/public/js/logincallback.js +19 -0
- package/.tmp/verify-noauth/app/public/js/mytokens.js +11 -0
- package/.tmp/verify-noauth/app/public/js/refreshtokens.js +23 -0
- package/.tmp/verify-noauth/app/scripts/build.js +39 -0
- package/.tmp/verify-noauth/app/scripts/oacg-fix.js +83 -0
- package/.tmp/verify-noauth/app/tsconfig.json +30 -0
- package/.tmp/verify-noauth/app/tsoa.json +32 -0
- package/.tmp/verify-noauth/schemas/Project.json +41 -0
- package/.tmp/verify-noauth/schemas/Session.json +49 -0
- package/.tmp/verify-noauth/schemas/User.json +81 -0
- package/.tmp/verify-noauth/schemas/UserAuthProfiles.json +54 -0
- package/.tmp/verify-noauth/schemas/UserTenant.json +39 -0
- package/.tmp/verify-noauth/vex.config.json +33 -0
- package/.tmp/verify-noauth-rbac/app/.env +41 -0
- package/.tmp/verify-noauth-rbac/app/.vex/meta.json +273 -0
- package/.tmp/verify-noauth-rbac/app/Dockerfile +20 -0
- package/.tmp/verify-noauth-rbac/app/README.md +39 -0
- package/.tmp/verify-noauth-rbac/app/package.json +51 -0
- package/.tmp/verify-noauth-rbac/app/public/css/style.css +8 -0
- package/.tmp/verify-noauth-rbac/app/public/js/deleteaccount.js +80 -0
- package/.tmp/verify-noauth-rbac/app/public/js/login.js +59 -0
- package/.tmp/verify-noauth-rbac/app/public/js/logincallback.js +19 -0
- package/.tmp/verify-noauth-rbac/app/public/js/mytokens.js +11 -0
- package/.tmp/verify-noauth-rbac/app/public/js/refreshtokens.js +23 -0
- package/.tmp/verify-noauth-rbac/app/scripts/build.js +39 -0
- package/.tmp/verify-noauth-rbac/app/scripts/oacg-fix.js +83 -0
- package/.tmp/verify-noauth-rbac/app/tsconfig.json +30 -0
- package/.tmp/verify-noauth-rbac/app/tsoa.json +32 -0
- package/.tmp/verify-noauth-rbac/schemas/Project.json +41 -0
- package/.tmp/verify-noauth-rbac/schemas/User.json +81 -0
- package/.tmp/verify-noauth-rbac/schemas/UserRole.json +38 -0
- package/.tmp/verify-noauth-rbac/vex.config.json +36 -0
- package/.tmp/verify.sh +103 -0
- package/.tmp/verify2.sh +103 -0
- package/.tmp/vex-gen-after-fix.log +221 -0
- package/.tmp/vex-gen-baseline.log +221 -0
- package/.tmp/vex-gen-canonical.log +221 -0
- package/.tmp/vex-gen-final.log +220 -0
- package/.tmp/vex-gen-final2.log +221 -0
- package/.tmp/vex-gen-reapply.log +221 -0
- package/.tmp/vex-gen.log +220 -0
- package/.tmp/vex-run-after-fix.log +3 -0
- package/.tmp/vex-run-baseline.log +11 -0
- package/.tmp/vex-run-before-fix.log +11 -0
- package/.tmp/vex-run-canonical.log +3 -0
- package/.tmp/vex-run-final2.log +3 -0
- package/.tmp/vex-run.log +3 -0
- package/.tmp/vo/app/.env +41 -0
- package/.tmp/vo/app/.vex/meta.json +231 -0
- package/.tmp/vo/app/Dockerfile +20 -0
- package/.tmp/vo/app/README.md +39 -0
- package/.tmp/vo/app/package.json +51 -0
- package/.tmp/vo/app/public/css/style.css +8 -0
- package/.tmp/vo/app/public/js/deleteaccount.js +80 -0
- package/.tmp/vo/app/public/js/login.js +59 -0
- package/.tmp/vo/app/public/js/logincallback.js +19 -0
- package/.tmp/vo/app/public/js/mytokens.js +11 -0
- package/.tmp/vo/app/public/js/refreshtokens.js +23 -0
- package/.tmp/vo/app/scripts/build.js +39 -0
- package/.tmp/vo/app/scripts/oacg-fix.js +83 -0
- package/.tmp/vo/app/tsconfig.json +30 -0
- package/.tmp/vo/app/tsoa.json +32 -0
- package/.tmp/vo/schemas/Project.json +41 -0
- package/.tmp/vo/vex.config.json +33 -0
- package/.tmp/vo-bad1/app/.env +41 -0
- package/.tmp/vo-bad1/app/.vex/meta.json +237 -0
- package/.tmp/vo-bad1/app/Dockerfile +20 -0
- package/.tmp/vo-bad1/app/README.md +39 -0
- package/.tmp/vo-bad1/app/package.json +51 -0
- package/.tmp/vo-bad1/app/public/css/style.css +8 -0
- package/.tmp/vo-bad1/app/public/js/deleteaccount.js +80 -0
- package/.tmp/vo-bad1/app/public/js/login.js +59 -0
- package/.tmp/vo-bad1/app/public/js/logincallback.js +19 -0
- package/.tmp/vo-bad1/app/public/js/mytokens.js +11 -0
- package/.tmp/vo-bad1/app/public/js/refreshtokens.js +23 -0
- package/.tmp/vo-bad1/app/scripts/build.js +39 -0
- package/.tmp/vo-bad1/app/scripts/oacg-fix.js +83 -0
- package/.tmp/vo-bad1/app/tsconfig.json +30 -0
- package/.tmp/vo-bad1/app/tsoa.json +32 -0
- package/.tmp/vo-bad1/schemas/Project.json +41 -0
- package/.tmp/vo-bad1/vex.config.json +33 -0
- package/.tmp/vo-bad2/app/.env +41 -0
- package/.tmp/vo-bad2/app/.vex/meta.json +237 -0
- package/.tmp/vo-bad2/app/Dockerfile +20 -0
- package/.tmp/vo-bad2/app/README.md +39 -0
- package/.tmp/vo-bad2/app/package.json +51 -0
- package/.tmp/vo-bad2/app/public/css/style.css +8 -0
- package/.tmp/vo-bad2/app/public/js/deleteaccount.js +80 -0
- package/.tmp/vo-bad2/app/public/js/login.js +59 -0
- package/.tmp/vo-bad2/app/public/js/logincallback.js +19 -0
- package/.tmp/vo-bad2/app/public/js/mytokens.js +11 -0
- package/.tmp/vo-bad2/app/public/js/refreshtokens.js +23 -0
- package/.tmp/vo-bad2/app/scripts/build.js +39 -0
- package/.tmp/vo-bad2/app/scripts/oacg-fix.js +83 -0
- package/.tmp/vo-bad2/app/tsconfig.json +30 -0
- package/.tmp/vo-bad2/app/tsoa.json +32 -0
- package/.tmp/vo-bad2/schemas/Project.json +41 -0
- package/.tmp/vo-bad2/vex.config.json +39 -0
- package/.tmp/vo-bad3/app/.env +41 -0
- package/.tmp/vo-bad3/app/.vex/meta.json +237 -0
- package/.tmp/vo-bad3/app/Dockerfile +20 -0
- package/.tmp/vo-bad3/app/README.md +39 -0
- package/.tmp/vo-bad3/app/package.json +51 -0
- package/.tmp/vo-bad3/app/public/css/style.css +8 -0
- package/.tmp/vo-bad3/app/public/js/deleteaccount.js +80 -0
- package/.tmp/vo-bad3/app/public/js/login.js +59 -0
- package/.tmp/vo-bad3/app/public/js/logincallback.js +19 -0
- package/.tmp/vo-bad3/app/public/js/mytokens.js +11 -0
- package/.tmp/vo-bad3/app/public/js/refreshtokens.js +23 -0
- package/.tmp/vo-bad3/app/scripts/build.js +39 -0
- package/.tmp/vo-bad3/app/scripts/oacg-fix.js +83 -0
- package/.tmp/vo-bad3/app/tsconfig.json +30 -0
- package/.tmp/vo-bad3/app/tsoa.json +32 -0
- package/.tmp/vo-bad3/schemas/Project.json +41 -0
- package/.tmp/vo-bad3/vex.config.json +33 -0
- package/dist/index.js +1156 -698
- package/dist/templates/_middlewares/UserContext.ts +1 -1
- package/dist/templates/_routes/FirebaseAuthUI.gen.ts +2 -2
- package/dist/templates/_routes/{LoginUI.ts → StarterUI.ts} +122 -8
- package/dist/templates/_utils/hash.ts +9 -4
- package/dist/templates/tenantJsonSchema/Tenant.json +22 -0
- package/docs/appGenerated/auth.md +50 -0
- package/docs/architecture/databaseTargets.md +23 -2
- package/docs/architecture/templates.md +7 -0
- package/docs/features/accountDeletion.md +5 -4
- package/docs/features/auditFields.md +2 -2
- package/docs/features/tenantIsolation.md +108 -15
- package/docs/releaseNote/v0-10-3.md +61 -0
- package/docs/releaseNote/v0-10-4.md +102 -0
- package/docs/releaseNote/v0-11-0.md +82 -0
- package/docs/vexJsonSchema.md +34 -1
- package/package.json +1 -1
- package/vex.config.json +6 -1
- package/dist/templates/_services/VexDbConnector.ts +0 -188
- package/dist/templates/_tenant/TenantScopeContext.ts +0 -56
package/.tmp/_body.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ret_code":"success","ret_msg":"Success","elapse":37,"result":{"_id":"6ce5cc55-c632-4092-8a59-04cd06624d94","tableNo":"A12","total":38.5}}
|
package/.tmp/_idx.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vAq0
|
package/.tmp/_token.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI4YmVkYmU5Yy0xZGJjLTQ4ZGEtYTIzNS1jNWMyMjQ4M2JhYjgiLCJlbWFpbCI6InZleC1zY2hlbWEtY2hlY2tAZXhhbXBsZS50ZXN0IiwibmFtZSI6InZleC1zY2hlbWEtY2hlY2siLCJsb2NhbGUiOm51bGwsInJvbGVzIjpbImFkbWluIl0sInByb2ZpbGVFcnJvcnMiOm51bGwsImFjdGl2ZSI6dHJ1ZSwidmV4VXNlcklkIjoiOGJlZGJlOWMtMWRiYy00OGRhLWEyMzUtYzVjMjI0ODNiYWI4IiwidmV4Um9sZSI6WyJhZG1pbiJdLCJ0ZW5hbnRJZCI6IjEzYjEwMWNmLTBmNGYtNDIwZC1iMjhlLTRhYTVkYWZhMjM2NCIsImlhdCI6MTc5NTkxMjk2MSwiZXhwIjoxNzk1OTE2NTYxfQ.W_rrgcT-pT8fbyUjodYqDmu7zgSfqT1vTc0TZzkZ0KY
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": {
|
|
3
|
+
"..": {
|
|
4
|
+
"vex.config.json": {
|
|
5
|
+
"lastWriteVersion": "0.10.3",
|
|
6
|
+
"allowOverwrite": true
|
|
7
|
+
},
|
|
8
|
+
"schemas": {
|
|
9
|
+
"Session.json": {
|
|
10
|
+
"lastWriteVersion": "0.10.3",
|
|
11
|
+
"allowOverwrite": true
|
|
12
|
+
},
|
|
13
|
+
"UserAuthProfiles.json": {
|
|
14
|
+
"lastWriteVersion": "0.10.3",
|
|
15
|
+
"allowOverwrite": true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"src": {
|
|
20
|
+
"system": {
|
|
21
|
+
"_controllers": {
|
|
22
|
+
"_ControllerFactory.gen.ts": {
|
|
23
|
+
"lastWriteVersion": "0.10.3",
|
|
24
|
+
"allowOverwrite": true
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"_middlewares": {
|
|
28
|
+
"Authentication.gen.ts": {
|
|
29
|
+
"lastWriteVersion": "0.10.3",
|
|
30
|
+
"allowOverwrite": true
|
|
31
|
+
},
|
|
32
|
+
"JoinWhitelistMiddleware.gen.ts": {
|
|
33
|
+
"lastWriteVersion": "0.10.3",
|
|
34
|
+
"allowOverwrite": true
|
|
35
|
+
},
|
|
36
|
+
"UserContext.gen.ts": {
|
|
37
|
+
"lastWriteVersion": "0.10.3",
|
|
38
|
+
"allowOverwrite": true
|
|
39
|
+
},
|
|
40
|
+
"tsoaAuthentication.gen.ts": {
|
|
41
|
+
"lastWriteVersion": "0.10.3",
|
|
42
|
+
"allowOverwrite": true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"_routes": {
|
|
46
|
+
"FirebaseAuthUI.gen.ts": {
|
|
47
|
+
"lastWriteVersion": "0.10.3",
|
|
48
|
+
"allowOverwrite": true
|
|
49
|
+
},
|
|
50
|
+
"LoginUI.gen.ts": {
|
|
51
|
+
"lastWriteVersion": "0.10.3",
|
|
52
|
+
"allowOverwrite": true
|
|
53
|
+
},
|
|
54
|
+
"oauth": {
|
|
55
|
+
"OAuthRouteFactory.gen.ts": {
|
|
56
|
+
"lastWriteVersion": "0.10.3",
|
|
57
|
+
"allowOverwrite": true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"_services": {
|
|
62
|
+
"MongooseRepositoryAdapter.gen.ts": {
|
|
63
|
+
"lastWriteVersion": "0.10.3",
|
|
64
|
+
"allowOverwrite": true
|
|
65
|
+
},
|
|
66
|
+
"TypeOrmRepositoryAdapter.gen.ts": {
|
|
67
|
+
"lastWriteVersion": "0.10.3",
|
|
68
|
+
"allowOverwrite": true
|
|
69
|
+
},
|
|
70
|
+
"VexDb.gen.ts": {
|
|
71
|
+
"lastWriteVersion": "0.10.3",
|
|
72
|
+
"allowOverwrite": true
|
|
73
|
+
},
|
|
74
|
+
"VexDbConnector.gen.ts": {
|
|
75
|
+
"lastWriteVersion": "0.10.3",
|
|
76
|
+
"allowOverwrite": true
|
|
77
|
+
},
|
|
78
|
+
"VexSystem.gen.ts": {
|
|
79
|
+
"lastWriteVersion": "0.10.3",
|
|
80
|
+
"allowOverwrite": true
|
|
81
|
+
},
|
|
82
|
+
"auth": {
|
|
83
|
+
"JWTKeyStore.gen.ts": {
|
|
84
|
+
"lastWriteVersion": "0.10.3",
|
|
85
|
+
"allowOverwrite": true
|
|
86
|
+
},
|
|
87
|
+
"JWTService.gen.ts": {
|
|
88
|
+
"lastWriteVersion": "0.10.3",
|
|
89
|
+
"allowOverwrite": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"oauth": {
|
|
93
|
+
"OAuthProfileMap.gen.ts": {
|
|
94
|
+
"lastWriteVersion": "0.10.3",
|
|
95
|
+
"allowOverwrite": true
|
|
96
|
+
},
|
|
97
|
+
"OAuthStrategyService.gen.ts": {
|
|
98
|
+
"lastWriteVersion": "0.10.3",
|
|
99
|
+
"allowOverwrite": true
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"_types": {
|
|
104
|
+
"auth.gen.ts": {
|
|
105
|
+
"lastWriteVersion": "0.10.3",
|
|
106
|
+
"allowOverwrite": true
|
|
107
|
+
},
|
|
108
|
+
"vex": {
|
|
109
|
+
"VexRepository.gen.ts": {
|
|
110
|
+
"lastWriteVersion": "0.10.3",
|
|
111
|
+
"allowOverwrite": true
|
|
112
|
+
},
|
|
113
|
+
"VexRequest.gen.ts": {
|
|
114
|
+
"lastWriteVersion": "0.10.3",
|
|
115
|
+
"allowOverwrite": true
|
|
116
|
+
},
|
|
117
|
+
"VexResErr.gen.ts": {
|
|
118
|
+
"lastWriteVersion": "0.10.3",
|
|
119
|
+
"allowOverwrite": true
|
|
120
|
+
},
|
|
121
|
+
"VexResOk.gen.ts": {
|
|
122
|
+
"lastWriteVersion": "0.10.3",
|
|
123
|
+
"allowOverwrite": true
|
|
124
|
+
},
|
|
125
|
+
"VexResponse.gen.ts": {
|
|
126
|
+
"lastWriteVersion": "0.10.3",
|
|
127
|
+
"allowOverwrite": true
|
|
128
|
+
},
|
|
129
|
+
"index.ts": {
|
|
130
|
+
"lastWriteVersion": "0.10.3",
|
|
131
|
+
"allowOverwrite": true
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"_utils": {
|
|
136
|
+
"hash.gen.ts": {
|
|
137
|
+
"lastWriteVersion": "0.10.3",
|
|
138
|
+
"allowOverwrite": true
|
|
139
|
+
},
|
|
140
|
+
"index.ts": {
|
|
141
|
+
"lastWriteVersion": "0.10.3",
|
|
142
|
+
"allowOverwrite": true
|
|
143
|
+
},
|
|
144
|
+
"logger.gen.ts": {
|
|
145
|
+
"lastWriteVersion": "0.10.3",
|
|
146
|
+
"allowOverwrite": true
|
|
147
|
+
},
|
|
148
|
+
"processTimer.gen.ts": {
|
|
149
|
+
"lastWriteVersion": "0.10.3",
|
|
150
|
+
"allowOverwrite": true
|
|
151
|
+
},
|
|
152
|
+
"response.gen.ts": {
|
|
153
|
+
"lastWriteVersion": "0.10.3",
|
|
154
|
+
"allowOverwrite": true
|
|
155
|
+
},
|
|
156
|
+
"validator.gen.ts": {
|
|
157
|
+
"lastWriteVersion": "0.10.3",
|
|
158
|
+
"allowOverwrite": true
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"Dockerfile": {
|
|
164
|
+
"lastWriteVersion": "0.10.3",
|
|
165
|
+
"allowOverwrite": true
|
|
166
|
+
},
|
|
167
|
+
"README.md": {
|
|
168
|
+
"lastWriteVersion": "0.10.3",
|
|
169
|
+
"allowOverwrite": true
|
|
170
|
+
},
|
|
171
|
+
"public": {
|
|
172
|
+
"css": {
|
|
173
|
+
"style.css": {
|
|
174
|
+
"lastWriteVersion": "0.10.3",
|
|
175
|
+
"allowOverwrite": true
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"js": {
|
|
179
|
+
"deleteaccount.js": {
|
|
180
|
+
"lastWriteVersion": "0.10.3",
|
|
181
|
+
"allowOverwrite": true
|
|
182
|
+
},
|
|
183
|
+
"login.js": {
|
|
184
|
+
"lastWriteVersion": "0.10.3",
|
|
185
|
+
"allowOverwrite": true
|
|
186
|
+
},
|
|
187
|
+
"logincallback.js": {
|
|
188
|
+
"lastWriteVersion": "0.10.3",
|
|
189
|
+
"allowOverwrite": true
|
|
190
|
+
},
|
|
191
|
+
"mytokens.js": {
|
|
192
|
+
"lastWriteVersion": "0.10.3",
|
|
193
|
+
"allowOverwrite": true
|
|
194
|
+
},
|
|
195
|
+
"refreshtokens.js": {
|
|
196
|
+
"lastWriteVersion": "0.10.3",
|
|
197
|
+
"allowOverwrite": true
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"scripts": {
|
|
202
|
+
"build.js": {
|
|
203
|
+
"lastWriteVersion": "0.10.3",
|
|
204
|
+
"allowOverwrite": true
|
|
205
|
+
},
|
|
206
|
+
"oacg-fix.js": {
|
|
207
|
+
"lastWriteVersion": "0.10.3",
|
|
208
|
+
"allowOverwrite": true
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"tsconfig.json": {
|
|
212
|
+
"lastWriteVersion": "0.10.3",
|
|
213
|
+
"allowOverwrite": true
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -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,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
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
3
|
+
// add event listener to login button
|
|
4
|
+
document.querySelector("#localLoginBtn").addEventListener("click", function () {
|
|
5
|
+
// call /api/auth/local
|
|
6
|
+
fetch("/api/auth/local", {
|
|
7
|
+
method: "POST",
|
|
8
|
+
headers: {
|
|
9
|
+
"Content-Type": "application/json"
|
|
10
|
+
},
|
|
11
|
+
body: JSON.stringify({
|
|
12
|
+
email: document.querySelector("#email").value,
|
|
13
|
+
password: document.querySelector("#password").value
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
.then(async (res) => {
|
|
17
|
+
if (res.status === 301 || res.status === 302) {
|
|
18
|
+
const data = await res.json();
|
|
19
|
+
if (data.result?.url) {
|
|
20
|
+
window.location.href = data.result?.url;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
alert("Login successful, but no redirect URL provided.");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const data = await res.json();
|
|
28
|
+
alert("Login Failed: " + data.message);
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
.catch((err) => {
|
|
32
|
+
console.error("Error during login:", err);
|
|
33
|
+
alert("Login Error: " + err.message);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
document.querySelector("#localRegisterBtn").addEventListener("click", function () {
|
|
38
|
+
// call /api/auth/register
|
|
39
|
+
fetch("/api/auth/register", {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: {
|
|
42
|
+
"Content-Type": "application/json"
|
|
43
|
+
},
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
email: document.querySelector("#email").value,
|
|
46
|
+
password: document.querySelector("#password").value
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
.then(async (res) => {
|
|
50
|
+
if (res.status === 201) {
|
|
51
|
+
alert("Registration successful. You can now log in.");
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
.catch((err) => {
|
|
55
|
+
console.error("Error during registration:", err);
|
|
56
|
+
alert("An error occurred during registration. Please try again later.");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
document.addEventListener("DOMContentLoaded", function() {
|
|
3
|
+
console.log('Exchange Tokens from /api/auth/token');
|
|
4
|
+
let sessionCode = new URLSearchParams(location.search).get('code');
|
|
5
|
+
fetch(
|
|
6
|
+
'/api/auth/token?code=' + sessionCode, {
|
|
7
|
+
method: 'POST'
|
|
8
|
+
}
|
|
9
|
+
)
|
|
10
|
+
.then((res) => res.text())
|
|
11
|
+
.then((data) => {
|
|
12
|
+
const jsonData = JSON.parse(data);
|
|
13
|
+
document.querySelector("#tokenData").innerHTML = JSON.stringify(jsonData, null, 2);
|
|
14
|
+
localStorage.setItem('accessToken', jsonData.result.accessToken);
|
|
15
|
+
localStorage.setItem('accessTokenIndex', jsonData.result.accessTokenIndex);
|
|
16
|
+
localStorage.setItem('refreshToken', jsonData.result.refreshToken);
|
|
17
|
+
localStorage.setItem('refreshTokenIndex', jsonData.result.refreshTokenIndex);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
let jsonData = {};
|
|
2
|
+
|
|
3
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
4
|
+
jsonData = {
|
|
5
|
+
accessToken: localStorage.getItem("accessToken"),
|
|
6
|
+
accessTokenIndex: localStorage.getItem("accessTokenIndex"),
|
|
7
|
+
refreshToken: localStorage.getItem("refreshToken"),
|
|
8
|
+
refreshTokenIndex: localStorage.getItem("refreshTokenIndex"),
|
|
9
|
+
};
|
|
10
|
+
document.querySelector("#tokenData").innerHTML = JSON.stringify(jsonData, null, 2);
|
|
11
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
2
|
+
jsonPayload = {
|
|
3
|
+
refreshToken: localStorage.getItem("refreshToken"),
|
|
4
|
+
refreshTokenIndex: localStorage.getItem("refreshTokenIndex"),
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
fetch("/api/auth/refresh", {
|
|
8
|
+
method: "POST",
|
|
9
|
+
body: JSON.stringify(jsonPayload),
|
|
10
|
+
headers: {
|
|
11
|
+
"Content-Type": "application/json",
|
|
12
|
+
"Accept": "application/json",
|
|
13
|
+
"Authorization": "Bearer " + localStorage.getItem("accessToken"),
|
|
14
|
+
"X-Auth-Index": localStorage.getItem("accessTokenIndex")
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
.then(res => res.json())
|
|
18
|
+
.then((response) => {
|
|
19
|
+
localStorage.setItem("accessToken", response.accessToken);
|
|
20
|
+
localStorage.setItem("accessTokenIndex", response.accessTokenIndex);
|
|
21
|
+
document.querySelector("#tokenData").innerHTML = JSON.stringify(response, null, 2);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// copy openapiDir to tsconfig's outDir
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
async function loadStripJsonComments() {
|
|
7
|
+
const { default: stripJsonComments } = await import('strip-json-comments');
|
|
8
|
+
return stripJsonComments;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function main() {
|
|
12
|
+
// Load strip-json-comments dynamically
|
|
13
|
+
const stripJsonComments = await loadStripJsonComments();
|
|
14
|
+
|
|
15
|
+
const openapiDir = "{{openapiDir}}";
|
|
16
|
+
const tsconfigPath = "tsconfig.json"
|
|
17
|
+
|
|
18
|
+
// 1. read tsconfig.json to get outDir
|
|
19
|
+
const tsconfigContent = fs.readFileSync(tsconfigPath, 'utf-8');
|
|
20
|
+
const tsconfig = JSON.parse(stripJsonComments(tsconfigContent));
|
|
21
|
+
const outDir = tsconfig.compilerOptions.outDir;
|
|
22
|
+
|
|
23
|
+
// 2. copy ./openapi to outDir
|
|
24
|
+
const outDirOpenapi = path.resolve(outDir, 'openapi');
|
|
25
|
+
if (!fs.existsSync(outDirOpenapi)) {
|
|
26
|
+
fs.mkdirSync(outDirOpenapi, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
fs.readdirSync(openapiDir).forEach((file) => {
|
|
29
|
+
fs.copyFileSync(path.resolve(openapiDir, file), path.resolve(outDirOpenapi, file));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// Execute the main function
|
|
35
|
+
main()
|
|
36
|
+
.catch(err => {
|
|
37
|
+
console.error(err);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Fix openapi-generated filter types to allow primitives, based on swagger schema info.
|
|
4
|
+
|
|
5
|
+
import { readdirSync, readFileSync, writeFileSync } from 'fs';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
|
|
9
|
+
const __dir = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const modelsDir = join(__dir, '../src/api-client/models');
|
|
11
|
+
const swaggerPath = join(__dir, '../../api/src/openapi/swagger.json');
|
|
12
|
+
|
|
13
|
+
const swagger = JSON.parse(readFileSync(swaggerPath, 'utf8'));
|
|
14
|
+
const schemas = swagger?.components?.schemas ?? {};
|
|
15
|
+
|
|
16
|
+
function primitiveTypeFromSwaggerProp(prop) {
|
|
17
|
+
if (!prop?.anyOf) return null;
|
|
18
|
+
const primitive = prop.anyOf.find(s => s.type && !s['$ref']);
|
|
19
|
+
if (!primitive) return null;
|
|
20
|
+
if (primitive.type === 'boolean') return 'boolean';
|
|
21
|
+
if (primitive.type === 'number' || primitive.type === 'integer') return 'number';
|
|
22
|
+
return 'string';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function primitiveTypeFromTsTypeName(tsType, swaggerEntityName, fieldKey) {
|
|
26
|
+
if (tsType === 'FieldFilterBoolean') return 'boolean';
|
|
27
|
+
if (tsType === 'FieldFilterNumber') return 'number';
|
|
28
|
+
if (tsType === 'FieldFilterString') return 'string';
|
|
29
|
+
if (/^FieldFilter[A-Z]/.test(tsType)) return 'string';
|
|
30
|
+
if (swaggerEntityName && fieldKey && schemas[swaggerEntityName]?.properties) {
|
|
31
|
+
const swaggerKey = fieldKey === 'id' ? '_id' : fieldKey;
|
|
32
|
+
const prop = schemas[swaggerEntityName].properties[swaggerKey];
|
|
33
|
+
if (prop) return primitiveTypeFromSwaggerProp(prop);
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Field-level: FieldFilterBoolean, FilterAreaActive, FilterAreaCountryCode, etc.
|
|
39
|
+
const FIELD_FILTER_RE = /^(FieldFilter[A-Z]|Filter[A-Z][a-z]+[A-Z])[a-zA-Z]*\.ts$/;
|
|
40
|
+
// Top-level aggregates: FilterArea, FilterClient, FilterJob, etc.
|
|
41
|
+
const TOP_FILTER_RE = /^Filter([A-Z][a-zA-Z]+)\.ts$/;
|
|
42
|
+
|
|
43
|
+
const NULL_CHECK = ' if (value == null) {\n return value;\n }';
|
|
44
|
+
const PRIMITIVE_GUARD = '\n // patch: pass primitives unchanged\n if (typeof value !== \'object\') return value;';
|
|
45
|
+
|
|
46
|
+
let stats = { fieldPatched: 0, topPatched: 0, skipped: 0 };
|
|
47
|
+
|
|
48
|
+
// Pass 1: patch field-level ToJSONTyped / FromJSONTyped
|
|
49
|
+
for (const file of readdirSync(modelsDir)) {
|
|
50
|
+
if (!FIELD_FILTER_RE.test(file)) continue;
|
|
51
|
+
const filePath = join(modelsDir, file);
|
|
52
|
+
let src = readFileSync(filePath, 'utf8');
|
|
53
|
+
if (src.includes('// patch:') || !src.includes(NULL_CHECK)) { stats.skipped++; continue; }
|
|
54
|
+
src = src.replaceAll(NULL_CHECK, NULL_CHECK + PRIMITIVE_GUARD);
|
|
55
|
+
writeFileSync(filePath, src, 'utf8');
|
|
56
|
+
console.log('[patch] field v ' + file);
|
|
57
|
+
stats.fieldPatched++;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Pass 2: patch top-level filter interface property types
|
|
61
|
+
for (const file of readdirSync(modelsDir)) {
|
|
62
|
+
const match = TOP_FILTER_RE.exec(file);
|
|
63
|
+
if (!match) continue;
|
|
64
|
+
const filePath = join(modelsDir, file);
|
|
65
|
+
let src = readFileSync(filePath, 'utf8');
|
|
66
|
+
if (src.includes('// patch:')) { stats.skipped++; continue; }
|
|
67
|
+
const swaggerEntityName = file.replace('.ts', '');
|
|
68
|
+
// Match: ` fieldName?: SomeType;` — skip $or/$and lines
|
|
69
|
+
const PROP_RE = /^( {4}(?!\$or|\$and)(\w+)\?:\s*)([A-Za-z]+)(;)$/gm;
|
|
70
|
+
let modified = false;
|
|
71
|
+
const patched = src.replace(PROP_RE, (line, prefix, fieldKey, tsType, semi) => {
|
|
72
|
+
const primitive = primitiveTypeFromTsTypeName(tsType, swaggerEntityName, fieldKey);
|
|
73
|
+
if (!primitive || line.includes(' | ' + primitive)) return line;
|
|
74
|
+
modified = true;
|
|
75
|
+
return prefix + tsType + ' | ' + primitive + semi;
|
|
76
|
+
});
|
|
77
|
+
if (!modified) { stats.skipped++; continue; }
|
|
78
|
+
writeFileSync(filePath, patched, 'utf8');
|
|
79
|
+
console.log('[patch] top v ' + file);
|
|
80
|
+
stats.topPatched++;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
console.log('\n[patch-filter-types] Done. Field: ' + stats.fieldPatched + ', Top: ' + stats.topPatched + ', Skipped: ' + stats.skipped);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@": ["src"],
|
|
8
|
+
"@/*": ["src/*"]
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
/* Language and Environment */
|
|
12
|
+
"target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
13
|
+
|
|
14
|
+
/* Modules */
|
|
15
|
+
"module": "commonjs",
|
|
16
|
+
|
|
17
|
+
/* Emit */
|
|
18
|
+
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
|
19
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
20
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
21
|
+
"allowArbitraryExtensions": true, /* Allow arbitrary file extensions. */
|
|
22
|
+
|
|
23
|
+
/* Type Checking */
|
|
24
|
+
"experimentalDecorators": true, /* Enable experimental support for TC39 stage 2+ decorators. */
|
|
25
|
+
"emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations. */
|
|
26
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
27
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|