adminforth 1.3.54-next.9 → 1.3.55-next.2
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/dist/auth.d.ts +31 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +42 -56
- package/dist/auth.js.map +1 -0
- package/dist/basePlugin.d.ts +18 -0
- package/dist/basePlugin.d.ts.map +1 -0
- package/dist/basePlugin.js +1 -0
- package/dist/basePlugin.js.map +1 -0
- package/dist/dataConnectors/baseConnector.d.ts +94 -0
- package/dist/dataConnectors/baseConnector.d.ts.map +1 -0
- package/dist/dataConnectors/baseConnector.js +108 -122
- package/dist/dataConnectors/baseConnector.js.map +1 -0
- package/dist/dataConnectors/clickhouse.d.ts +92 -0
- package/dist/dataConnectors/clickhouse.d.ts.map +1 -0
- package/dist/dataConnectors/clickhouse.js +132 -149
- package/dist/dataConnectors/clickhouse.js.map +1 -0
- package/dist/dataConnectors/mongo.d.ts +93 -0
- package/dist/dataConnectors/mongo.d.ts.map +1 -0
- package/dist/dataConnectors/mongo.js +75 -101
- package/dist/dataConnectors/mongo.js.map +1 -0
- package/dist/dataConnectors/postgres.d.ts +71 -0
- package/dist/dataConnectors/postgres.d.ts.map +1 -0
- package/dist/dataConnectors/postgres.js +124 -143
- package/dist/dataConnectors/postgres.js.map +1 -0
- package/dist/dataConnectors/sqlite.d.ts +67 -0
- package/dist/dataConnectors/sqlite.d.ts.map +1 -0
- package/dist/dataConnectors/sqlite.js +113 -130
- package/dist/dataConnectors/sqlite.js.map +1 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +197 -217
- package/dist/index.js.map +1 -0
- package/dist/modules/codeInjector.d.ts +35 -0
- package/dist/modules/codeInjector.d.ts.map +1 -0
- package/dist/modules/codeInjector.js +480 -486
- package/dist/modules/codeInjector.js.map +1 -0
- package/dist/modules/configValidator.d.ts +12 -0
- package/dist/modules/configValidator.d.ts.map +1 -0
- package/dist/modules/configValidator.js +31 -22
- package/dist/modules/configValidator.js.map +1 -0
- package/dist/modules/operationalResource.d.ts +17 -0
- package/dist/modules/operationalResource.d.ts.map +1 -0
- package/dist/modules/operationalResource.js +50 -70
- package/dist/modules/operationalResource.js.map +1 -0
- package/dist/modules/restApi.d.ts +10 -0
- package/dist/modules/restApi.d.ts.map +1 -0
- package/dist/modules/restApi.js +104 -116
- package/dist/modules/restApi.js.map +1 -0
- package/dist/modules/styleGenerator.d.ts +9 -0
- package/dist/modules/styleGenerator.d.ts.map +1 -0
- package/dist/modules/styleGenerator.js +1 -0
- package/dist/modules/styleGenerator.js.map +1 -0
- package/dist/modules/styles.d.ts +96 -0
- package/dist/modules/styles.d.ts.map +1 -0
- package/dist/modules/styles.js +1 -0
- package/dist/modules/styles.js.map +1 -0
- package/dist/modules/utils.d.ts +39 -0
- package/dist/modules/utils.d.ts.map +1 -0
- package/dist/modules/utils.js +1 -0
- package/dist/modules/utils.js.map +1 -0
- package/dist/plugins/audit-log/types.d.ts +35 -0
- package/dist/plugins/audit-log/types.d.ts.map +1 -0
- package/dist/plugins/audit-log/types.js +2 -0
- package/dist/plugins/audit-log/types.js.map +1 -0
- package/dist/plugins/chat-gpt/types.d.ts +82 -0
- package/dist/plugins/chat-gpt/types.d.ts.map +1 -0
- package/dist/plugins/chat-gpt/types.js +2 -0
- package/dist/plugins/chat-gpt/types.js.map +1 -0
- package/dist/plugins/email-password-reset/types.d.ts +28 -0
- package/dist/plugins/email-password-reset/types.d.ts.map +1 -0
- package/dist/plugins/email-password-reset/types.js +2 -0
- package/dist/plugins/email-password-reset/types.js.map +1 -0
- package/dist/plugins/foreign-inline-list/types.d.ts +19 -0
- package/dist/plugins/foreign-inline-list/types.d.ts.map +1 -0
- package/dist/plugins/foreign-inline-list/types.js +2 -0
- package/dist/plugins/foreign-inline-list/types.js.map +1 -0
- package/dist/plugins/import-export/types.d.ts +3 -0
- package/dist/plugins/import-export/types.d.ts.map +1 -0
- package/dist/plugins/import-export/types.js +2 -0
- package/dist/plugins/import-export/types.js.map +1 -0
- package/dist/plugins/rich-editor/custom/async-queue.d.ts +8 -0
- package/dist/plugins/rich-editor/custom/async-queue.d.ts.map +1 -0
- package/dist/plugins/rich-editor/custom/async-queue.js +29 -0
- package/dist/plugins/rich-editor/custom/async-queue.js.map +1 -0
- package/dist/plugins/rich-editor/dist/custom/async-queue.d.ts +8 -0
- package/dist/plugins/rich-editor/dist/custom/async-queue.d.ts.map +1 -0
- package/dist/plugins/rich-editor/dist/custom/async-queue.js +29 -0
- package/dist/plugins/rich-editor/dist/custom/async-queue.js.map +1 -0
- package/dist/plugins/rich-editor/types.d.ts +153 -0
- package/dist/plugins/rich-editor/types.d.ts.map +1 -0
- package/dist/plugins/rich-editor/types.js +16 -0
- package/dist/plugins/rich-editor/types.js.map +1 -0
- package/dist/plugins/two-factors-auth/types.d.ts +18 -0
- package/dist/plugins/two-factors-auth/types.d.ts.map +1 -0
- package/dist/plugins/two-factors-auth/types.js +2 -0
- package/dist/plugins/two-factors-auth/types.js.map +1 -0
- package/dist/plugins/upload/types.d.ts +132 -0
- package/dist/plugins/upload/types.d.ts.map +1 -0
- package/dist/plugins/upload/types.js +2 -0
- package/dist/plugins/upload/types.js.map +1 -0
- package/dist/servers/express.d.ts +18 -0
- package/dist/servers/express.d.ts.map +1 -0
- package/dist/servers/express.js +30 -42
- package/dist/servers/express.js.map +1 -0
- package/dist/spa/index.html +2 -2
- package/dist/spa/package-lock.json +87 -1
- package/dist/spa/package.json +4 -1
- package/dist/spa/src/App.vue +154 -50
- package/dist/spa/src/components/AcceptModal.vue +1 -1
- package/dist/spa/src/components/Breadcrumbs.vue +1 -1
- package/dist/spa/src/components/CustomDatePicker.vue +1 -1
- package/dist/spa/src/components/CustomDateRangePicker.vue +1 -1
- package/dist/spa/src/components/CustomRangePicker.vue +9 -5
- package/dist/spa/src/components/Dropdown.vue +4 -4
- package/dist/spa/src/components/Filters.vue +2 -2
- package/dist/spa/src/components/MenuLink.vue +3 -0
- package/dist/spa/src/components/ResourceForm.vue +67 -36
- package/dist/spa/src/components/ResourceListTable.vue +216 -144
- package/dist/spa/src/components/SkeleteLoader.vue +4 -4
- package/dist/spa/src/components/Toast.vue +3 -2
- package/dist/spa/src/components/ValueRenderer.vue +81 -6
- package/dist/spa/src/composables/useFrontendApi.ts +1 -1
- package/dist/spa/src/composables/useStores.ts +18 -14
- package/dist/spa/src/index.scss +4 -0
- package/{spa → dist/spa}/src/renderers/CompactUUID.vue +4 -4
- package/{spa → dist/spa}/src/renderers/CountryFlag.vue +2 -2
- package/dist/spa/src/router/index.ts +4 -8
- package/dist/spa/src/spa_types/core.ts +2 -0
- package/dist/spa/src/stores/core.ts +6 -2
- package/dist/spa/src/stores/filters.ts +15 -10
- package/dist/spa/src/stores/toast.ts +22 -6
- package/dist/spa/src/types/AdminForthConfig.ts +340 -55
- package/dist/spa/src/types/FrontendAPI.ts +52 -30
- package/dist/spa/src/utils.ts +59 -2
- package/dist/spa/src/views/CreateView.vue +15 -4
- package/dist/spa/src/views/EditView.vue +20 -7
- package/dist/spa/src/views/ListView.vue +132 -38
- package/dist/spa/src/views/LoginView.vue +50 -18
- package/dist/spa/src/views/ShowView.vue +25 -15
- package/dist/types/AdminForthConfig.d.ts +1619 -0
- package/dist/types/AdminForthConfig.d.ts.map +1 -0
- package/dist/types/AdminForthConfig.js +1 -0
- package/dist/types/AdminForthConfig.js.map +1 -0
- package/{types/FrontendAPI.ts → dist/types/FrontendAPI.d.ts} +27 -52
- package/dist/types/FrontendAPI.d.ts.map +1 -0
- package/dist/types/FrontendAPI.js +1 -0
- package/dist/types/FrontendAPI.js.map +1 -0
- package/package.json +16 -6
- package/auth.ts +0 -140
- package/basePlugin.ts +0 -70
- package/dataConnectors/baseConnector.ts +0 -216
- package/dataConnectors/clickhouse.ts +0 -338
- package/dataConnectors/mongo.ts +0 -202
- package/dataConnectors/postgres.ts +0 -306
- package/dataConnectors/sqlite.ts +0 -254
- package/index.ts +0 -428
- package/modules/codeInjector.ts +0 -736
- package/modules/configValidator.ts +0 -571
- package/modules/operationalResource.ts +0 -98
- package/modules/restApi.ts +0 -718
- package/modules/styleGenerator.ts +0 -55
- package/modules/styles.ts +0 -126
- package/modules/utils.ts +0 -472
- package/servers/express.ts +0 -259
- package/spa/.eslintrc.cjs +0 -14
- package/spa/README.md +0 -39
- package/spa/env.d.ts +0 -1
- package/spa/index.html +0 -23
- package/spa/package-lock.json +0 -4602
- package/spa/package.json +0 -51
- package/spa/postcss.config.js +0 -6
- package/spa/public/assets/favicon.png +0 -0
- package/spa/src/App.vue +0 -418
- package/spa/src/assets/base.css +0 -2
- package/spa/src/assets/logo.svg +0 -19
- package/spa/src/components/AcceptModal.vue +0 -45
- package/spa/src/components/Breadcrumbs.vue +0 -41
- package/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
- package/spa/src/components/CustomDatePicker.vue +0 -176
- package/spa/src/components/CustomDateRangePicker.vue +0 -218
- package/spa/src/components/CustomRangePicker.vue +0 -156
- package/spa/src/components/Dropdown.vue +0 -168
- package/spa/src/components/Filters.vue +0 -222
- package/spa/src/components/HelloWorld.vue +0 -17
- package/spa/src/components/MenuLink.vue +0 -27
- package/spa/src/components/ResourceForm.vue +0 -290
- package/spa/src/components/ResourceListTable.vue +0 -466
- package/spa/src/components/SingleSkeletLoader.vue +0 -13
- package/spa/src/components/SkeleteLoader.vue +0 -23
- package/spa/src/components/Toast.vue +0 -78
- package/spa/src/components/ValueRenderer.vue +0 -114
- package/spa/src/components/icons/IconCalendar.vue +0 -5
- package/spa/src/components/icons/IconCommunity.vue +0 -7
- package/spa/src/components/icons/IconDocumentation.vue +0 -7
- package/spa/src/components/icons/IconEcosystem.vue +0 -7
- package/spa/src/components/icons/IconSupport.vue +0 -7
- package/spa/src/components/icons/IconTime.vue +0 -5
- package/spa/src/components/icons/IconTooling.vue +0 -19
- package/spa/src/composables/useFrontendApi.ts +0 -26
- package/spa/src/composables/useStores.ts +0 -131
- package/spa/src/index.scss +0 -31
- package/spa/src/main.ts +0 -18
- package/spa/src/router/index.ts +0 -59
- package/spa/src/spa_types/core.ts +0 -53
- package/spa/src/stores/core.ts +0 -148
- package/spa/src/stores/filters.ts +0 -27
- package/spa/src/stores/modal.ts +0 -48
- package/spa/src/stores/toast.ts +0 -31
- package/spa/src/stores/user.ts +0 -72
- package/spa/src/utils.ts +0 -160
- package/spa/src/views/CreateView.vue +0 -167
- package/spa/src/views/EditView.vue +0 -170
- package/spa/src/views/ListView.vue +0 -352
- package/spa/src/views/LoginView.vue +0 -192
- package/spa/src/views/ResourceParent.vue +0 -17
- package/spa/src/views/ShowView.vue +0 -186
- package/spa/tailwind.config.js +0 -17
- package/spa/tsconfig.app.json +0 -14
- package/spa/tsconfig.json +0 -11
- package/spa/tsconfig.node.json +0 -19
- package/spa/vite.config.ts +0 -56
- package/tsconfig.json +0 -112
- package/types/AdminForthConfig.ts +0 -1762
- /package/{spa → dist/spa}/src/components/ThreeDotsMenu.vue +0 -0
package/servers/express.ts
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import CodeInjector from '../modules/codeInjector.js';
|
|
5
|
-
import { Express } from 'express';
|
|
6
|
-
import fetch from 'node-fetch';
|
|
7
|
-
import { IAdminForth, IExpressHttpServer } from '../types/AdminForthConfig.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function replaceAtStart(string, substring) {
|
|
11
|
-
if (string.startsWith(substring)) {
|
|
12
|
-
return string.slice(substring.length);
|
|
13
|
-
}
|
|
14
|
-
return string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async function proxyTo(url, res) {
|
|
18
|
-
const actual = await fetch(url);
|
|
19
|
-
actual.headers.forEach((v, n) => res.setHeader(n, v));
|
|
20
|
-
actual.body.pipe(res);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function parseExpressCookie(req): Promise<
|
|
24
|
-
Array<{
|
|
25
|
-
key: string,
|
|
26
|
-
value: string
|
|
27
|
-
}>
|
|
28
|
-
> {
|
|
29
|
-
const cookies = req.headers.cookie;
|
|
30
|
-
if (!cookies) {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
const parts = cookies.split('; ');
|
|
34
|
-
const result = [];
|
|
35
|
-
parts.forEach(part => {
|
|
36
|
-
const [key, value] = part.split('=');
|
|
37
|
-
result.push({key, value});
|
|
38
|
-
});
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const respondNoServer = (title, explanation) => {
|
|
45
|
-
return `
|
|
46
|
-
<!DOCTYPE html>
|
|
47
|
-
<html lang="en">
|
|
48
|
-
<head>
|
|
49
|
-
<meta charset="UTF-8">
|
|
50
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
51
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
52
|
-
<title>AdminForth</title>
|
|
53
|
-
</head>
|
|
54
|
-
<body>
|
|
55
|
-
<div class="center">
|
|
56
|
-
<h1>Oops!</h1>
|
|
57
|
-
<h2>${title}</h2>
|
|
58
|
-
<p>${explanation}</p>
|
|
59
|
-
</div>
|
|
60
|
-
<style>
|
|
61
|
-
body {
|
|
62
|
-
font-family: Arial, sans-serif;
|
|
63
|
-
background-color: #f0f0f0;
|
|
64
|
-
margin: 0;
|
|
65
|
-
padding: 0;
|
|
66
|
-
}
|
|
67
|
-
.center {
|
|
68
|
-
display: flex;
|
|
69
|
-
justify-content: center;
|
|
70
|
-
align-items: center;
|
|
71
|
-
height: 100vh;
|
|
72
|
-
flex-direction: column;
|
|
73
|
-
}
|
|
74
|
-
</style>
|
|
75
|
-
<script>
|
|
76
|
-
setTimeout(() => {
|
|
77
|
-
location.reload();
|
|
78
|
-
}, 1500);
|
|
79
|
-
</script>
|
|
80
|
-
</body>
|
|
81
|
-
`;
|
|
82
|
-
}
|
|
83
|
-
class ExpressServer implements IExpressHttpServer {
|
|
84
|
-
|
|
85
|
-
expressApp: Express;
|
|
86
|
-
adminforth: IAdminForth;
|
|
87
|
-
|
|
88
|
-
constructor(adminforth: IAdminForth) {
|
|
89
|
-
this.adminforth = adminforth;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
setupSpaServer() {
|
|
93
|
-
const prefix = this.adminforth.config.baseUrl
|
|
94
|
-
|
|
95
|
-
const slashedPrefix = prefix.endsWith('/') ? prefix : `${prefix}/`;
|
|
96
|
-
|
|
97
|
-
if (this.adminforth.runningHotReload) {
|
|
98
|
-
const handler = async (req, res) => {
|
|
99
|
-
// proxy using fetch to webpack dev server
|
|
100
|
-
try {
|
|
101
|
-
await proxyTo(`http://localhost:5173${req.url}`, res);
|
|
102
|
-
} catch (e) {
|
|
103
|
-
// console.log('Failed to proxy', e);
|
|
104
|
-
res.status(500).send(respondNoServer('AdminForth SPA is not ready yet', 'Vite is still starting up. Please wait a moment...'));
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
this.expressApp.get(`${slashedPrefix}assets/*`, handler);
|
|
109
|
-
this.expressApp.get(`${prefix}*`, handler);
|
|
110
|
-
|
|
111
|
-
} else {
|
|
112
|
-
this.expressApp.get(`${slashedPrefix}assets/*`, (req, res) => {
|
|
113
|
-
res.sendFile(
|
|
114
|
-
path.join(CodeInjector.SPA_TMP_PATH, 'dist', replaceAtStart(req.url, prefix)),
|
|
115
|
-
{
|
|
116
|
-
cacheControl: false,
|
|
117
|
-
// store for a year
|
|
118
|
-
headers: {
|
|
119
|
-
'Cache-Control': 'public, max-age=31536000',
|
|
120
|
-
'Pragma': 'public',
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
this.expressApp.get(`${prefix}*`, async (req, res) => {
|
|
127
|
-
const fullPath = path.join(CodeInjector.SPA_TMP_PATH, 'dist', 'index.html');
|
|
128
|
-
|
|
129
|
-
let fileExists = true;
|
|
130
|
-
try {
|
|
131
|
-
await fs.promises.access(fullPath, fs.constants.F_OK);
|
|
132
|
-
} catch (e) {
|
|
133
|
-
fileExists = false;
|
|
134
|
-
}
|
|
135
|
-
if (!fileExists) {
|
|
136
|
-
res.status(500).send(respondNoServer(`${this.adminforth.config.customization.brandName} is still warming up`, 'Please wait a moment...'));
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
res.sendFile(fullPath, {
|
|
140
|
-
cacheControl: false,
|
|
141
|
-
headers: {
|
|
142
|
-
'Content-Type': 'text/html',
|
|
143
|
-
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
144
|
-
'Pragma': 'no-cache',
|
|
145
|
-
'Expires': '0'
|
|
146
|
-
} });
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
serve(app) {
|
|
152
|
-
this.expressApp = app;
|
|
153
|
-
this.adminforth.setupEndpoints(this);
|
|
154
|
-
this.setupSpaServer();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
authorize(handler) {
|
|
158
|
-
return async (req, res, next) => {
|
|
159
|
-
const cookies = await parseExpressCookie(req);
|
|
160
|
-
|
|
161
|
-
// check if multiple adminforth_jwt providerd and show warning
|
|
162
|
-
const jwts = cookies.filter(({key}) => key === 'adminforth_jwt');
|
|
163
|
-
if (jwts.length > 1) {
|
|
164
|
-
console.error('Multiple adminforth_jwt cookies provided');
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const jwt = jwts[0]?.value;
|
|
168
|
-
|
|
169
|
-
if (!jwt) {
|
|
170
|
-
res.status(401).send('Unauthorized by AdminForth');
|
|
171
|
-
return
|
|
172
|
-
}
|
|
173
|
-
const adminforthUser = await this.adminforth.auth.verify(jwt, 'auth');
|
|
174
|
-
if (!adminforthUser) {
|
|
175
|
-
res.status(401).send('Unauthorized by AdminForth');
|
|
176
|
-
} else {
|
|
177
|
-
req.adminUser = adminforthUser;
|
|
178
|
-
handler(req, res, next);
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
endpoint({ method='GET', path, handler, noAuth=false }) {
|
|
184
|
-
if (!path.startsWith('/')) {
|
|
185
|
-
throw new Error(`Path must start with /, got: ${path}`);
|
|
186
|
-
}
|
|
187
|
-
const fullPath = `${this.adminforth.config.baseUrl}/adminapi/v1${path}`;
|
|
188
|
-
|
|
189
|
-
const expressHandler = async (req, res) => {
|
|
190
|
-
let body = req.body || {};
|
|
191
|
-
if (typeof body === 'string') {
|
|
192
|
-
try {
|
|
193
|
-
body = JSON.parse(body);
|
|
194
|
-
} catch (e) {
|
|
195
|
-
console.error('Failed to parse body', e);
|
|
196
|
-
res.status(400).send('Invalid JSON body');
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const query = req.query;
|
|
201
|
-
const adminUser = req.adminUser;
|
|
202
|
-
// lower request headers
|
|
203
|
-
const headers = req.headers;
|
|
204
|
-
const cookies = await parseExpressCookie(req);
|
|
205
|
-
|
|
206
|
-
const response = {
|
|
207
|
-
headers: [],
|
|
208
|
-
status: 200,
|
|
209
|
-
message: undefined,
|
|
210
|
-
|
|
211
|
-
setHeader(name, value) {
|
|
212
|
-
process.env.HEAVY_DEBUG && console.log(' 🪲Setting header', name, value);
|
|
213
|
-
this.headers.push([name, value]);
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
setStatus(code, message) {
|
|
217
|
-
this.status = code;
|
|
218
|
-
this.message = message;
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
blobStream() {
|
|
222
|
-
return res;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
};
|
|
226
|
-
const input = { body, query, headers, cookies, adminUser, response, _raw_express_req: req, _raw_express_res: res};
|
|
227
|
-
|
|
228
|
-
let output;
|
|
229
|
-
try {
|
|
230
|
-
output = await handler(input);
|
|
231
|
-
} catch (e) {
|
|
232
|
-
console.error('Error in handler', e);
|
|
233
|
-
// print full stack trace
|
|
234
|
-
console.error(e.stack);
|
|
235
|
-
res.status(500).send('Internal server error');
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
response.headers.forEach(([name, value]) => {
|
|
239
|
-
res.setHeader(name, value);
|
|
240
|
-
});
|
|
241
|
-
res.status(response.status);
|
|
242
|
-
if (response.message) {
|
|
243
|
-
res.send(response.message);
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (output === null) {
|
|
247
|
-
// nothing should be returned anymore
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
res.json(output);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
console.log(`Adding endpoint ${method} ${fullPath}`);
|
|
254
|
-
this.expressApp[method.toLowerCase()](fullPath, noAuth ? expressHandler : this.authorize(expressHandler));
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
export default ExpressServer;
|
package/spa/.eslintrc.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* eslint-env node */
|
|
2
|
-
require('@rushstack/eslint-patch/modern-module-resolution')
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
root: true,
|
|
6
|
-
'extends': [
|
|
7
|
-
'plugin:vue/vue3-essential',
|
|
8
|
-
'eslint:recommended',
|
|
9
|
-
'@vue/eslint-config-typescript'
|
|
10
|
-
],
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaVersion: 'latest'
|
|
13
|
-
}
|
|
14
|
-
}
|
package/spa/README.md
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# spa
|
|
2
|
-
|
|
3
|
-
This template should help get you started developing with Vue 3 in Vite.
|
|
4
|
-
|
|
5
|
-
## Recommended IDE Setup
|
|
6
|
-
|
|
7
|
-
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
|
8
|
-
|
|
9
|
-
## Type Support for `.vue` Imports in TS
|
|
10
|
-
|
|
11
|
-
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
|
|
12
|
-
|
|
13
|
-
## Customize configuration
|
|
14
|
-
|
|
15
|
-
See [Vite Configuration Reference](https://vitejs.dev/config/).
|
|
16
|
-
|
|
17
|
-
## Project Setup
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
npm install
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Compile and Hot-Reload for Development
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
npm run dev
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Type-Check, Compile and Minify for Production
|
|
30
|
-
|
|
31
|
-
```sh
|
|
32
|
-
npm run build
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Lint with [ESLint](https://eslint.org/)
|
|
36
|
-
|
|
37
|
-
```sh
|
|
38
|
-
npm run lint
|
|
39
|
-
```
|
package/spa/env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
package/spa/index.html
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<link rel="icon" href="/* IMPORTANT:ADMINFORTH FAVICON */">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>/* IMPORTANT:ADMINFORTH TITLE */</title>
|
|
8
|
-
<!--
|
|
9
|
-
<script>
|
|
10
|
-
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
|
11
|
-
if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
|
12
|
-
document.documentElement.classList.add('dark');
|
|
13
|
-
} else {
|
|
14
|
-
document.documentElement.classList.remove('dark')
|
|
15
|
-
}
|
|
16
|
-
</script> -->
|
|
17
|
-
|
|
18
|
-
</head>
|
|
19
|
-
<body class="min-h-screen flex flex-column">
|
|
20
|
-
<div id="app" class="grow bg-lightHtml dark:bg-darkHtml"></div>
|
|
21
|
-
<script type="module" src="/src/main.ts"></script>
|
|
22
|
-
</body>
|
|
23
|
-
</html>
|