quiz-mcp 0.0.5 → 0.0.7
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/client/_app/immutable/assets/0.BdUfdP7M.css +1 -0
- package/dist/client/_app/immutable/assets/0.BdUfdP7M.css.br +0 -0
- package/dist/client/_app/immutable/assets/0.BdUfdP7M.css.gz +0 -0
- package/dist/client/_app/immutable/chunks/BBbVH-DX.js +2 -0
- package/dist/client/_app/immutable/chunks/BBbVH-DX.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BBbVH-DX.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/BYAtt_Gu.js +1 -0
- package/dist/client/_app/immutable/chunks/BYAtt_Gu.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BYAtt_Gu.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/BrxBJB61.js +3 -0
- package/dist/client/_app/immutable/chunks/BrxBJB61.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BrxBJB61.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/C12jez52.js +1 -0
- package/dist/client/_app/immutable/chunks/C12jez52.js.br +0 -0
- package/dist/client/_app/immutable/chunks/C12jez52.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/C9b1VZtB.js +1 -0
- package/dist/client/_app/immutable/chunks/C9b1VZtB.js.br +0 -0
- package/dist/client/_app/immutable/chunks/C9b1VZtB.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/DnSqigra.js +1 -0
- package/dist/client/_app/immutable/chunks/DnSqigra.js.br +0 -0
- package/dist/client/_app/immutable/chunks/DnSqigra.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/hqRb622q.js +1 -0
- package/dist/client/_app/immutable/chunks/hqRb622q.js.br +0 -0
- package/dist/client/_app/immutable/chunks/hqRb622q.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/qgn7L4n5.js +1 -0
- package/dist/client/_app/immutable/chunks/qgn7L4n5.js.br +0 -0
- package/dist/client/_app/immutable/chunks/qgn7L4n5.js.gz +0 -0
- package/dist/client/_app/immutable/entry/app.BKlqc9Ov.js +2 -0
- package/dist/client/_app/immutable/entry/app.BKlqc9Ov.js.br +0 -0
- package/dist/client/_app/immutable/entry/app.BKlqc9Ov.js.gz +0 -0
- package/dist/client/_app/immutable/entry/start.PX539qph.js +1 -0
- package/dist/client/_app/immutable/entry/start.PX539qph.js.br +0 -0
- package/dist/client/_app/immutable/entry/start.PX539qph.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/0.B29QW3gO.js +9 -0
- package/dist/client/_app/immutable/nodes/0.B29QW3gO.js.br +0 -0
- package/dist/client/_app/immutable/nodes/0.B29QW3gO.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/1.D4qkuJBA.js +1 -0
- package/dist/client/_app/immutable/nodes/1.D4qkuJBA.js.br +0 -0
- package/dist/client/_app/immutable/nodes/1.D4qkuJBA.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/2.B9MLTE_H.js +2 -0
- package/dist/client/_app/immutable/nodes/2.B9MLTE_H.js.br +0 -0
- package/dist/client/_app/immutable/nodes/2.B9MLTE_H.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/3.w4AbulQF.js +1 -0
- package/dist/client/_app/immutable/nodes/3.w4AbulQF.js.br +0 -0
- package/dist/client/_app/immutable/nodes/3.w4AbulQF.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/4.DxNxvh2P.js +4 -0
- package/dist/client/_app/immutable/nodes/4.DxNxvh2P.js.br +0 -0
- package/dist/client/_app/immutable/nodes/4.DxNxvh2P.js.gz +0 -0
- package/dist/client/_app/version.json +1 -0
- package/dist/client/_app/version.json.br +0 -0
- package/dist/client/_app/version.json.gz +0 -0
- package/dist/client/robots.txt +3 -0
- package/dist/env.js +94 -0
- package/dist/handler.js +1435 -0
- package/dist/index.js +345 -0
- package/dist/server/chunks/0-DMbzliU5.js +44 -0
- package/dist/server/chunks/0-DMbzliU5.js.map +1 -0
- package/dist/server/chunks/1-BPgly3Wz.js +9 -0
- package/dist/server/chunks/1-BPgly3Wz.js.map +1 -0
- package/dist/server/chunks/2-NzZFDUaQ.js +60 -0
- package/dist/server/chunks/2-NzZFDUaQ.js.map +1 -0
- package/dist/server/chunks/3-mMAf4OfT.js +37 -0
- package/dist/server/chunks/3-mMAf4OfT.js.map +1 -0
- package/dist/server/chunks/4-B6xeTrA4.js +37 -0
- package/dist/server/chunks/4-B6xeTrA4.js.map +1 -0
- package/dist/server/chunks/_error.svelte-DdU-RsvI.js +82 -0
- package/dist/server/chunks/_error.svelte-DdU-RsvI.js.map +1 -0
- package/dist/server/chunks/_layout.svelte-ByxFsgXH.js +106 -0
- package/dist/server/chunks/_layout.svelte-ByxFsgXH.js.map +1 -0
- package/dist/server/chunks/_page.svelte-CRU5jaGZ.js +653 -0
- package/dist/server/chunks/_page.svelte-CRU5jaGZ.js.map +1 -0
- package/dist/server/chunks/_page.svelte-Cm8ocLsi.js +572 -0
- package/dist/server/chunks/_page.svelte-Cm8ocLsi.js.map +1 -0
- package/dist/server/chunks/_page.svelte-DkIV_2wP.js +73 -0
- package/dist/server/chunks/_page.svelte-DkIV_2wP.js.map +1 -0
- package/dist/server/chunks/_server.ts-D6J6LtvY.js +39 -0
- package/dist/server/chunks/_server.ts-D6J6LtvY.js.map +1 -0
- package/dist/server/chunks/_server.ts-DCk3MOtj.js +35 -0
- package/dist/server/chunks/_server.ts-DCk3MOtj.js.map +1 -0
- package/dist/server/chunks/_server.ts-DLmpRTXg.js +101 -0
- package/dist/server/chunks/_server.ts-DLmpRTXg.js.map +1 -0
- package/dist/server/chunks/_server.ts-DSbw8FX3.js +219 -0
- package/dist/server/chunks/_server.ts-DSbw8FX3.js.map +1 -0
- package/dist/server/chunks/_server.ts-Dhx3VnxA.js +51 -0
- package/dist/server/chunks/_server.ts-Dhx3VnxA.js.map +1 -0
- package/dist/server/chunks/client-Bik_FcIp.js +27 -0
- package/dist/server/chunks/client-Bik_FcIp.js.map +1 -0
- package/dist/server/chunks/exports-zEtqeh3Y.js +286 -0
- package/dist/server/chunks/exports-zEtqeh3Y.js.map +1 -0
- package/dist/server/chunks/hooks.server-B6FrjICA.js +66 -0
- package/dist/server/chunks/hooks.server-B6FrjICA.js.map +1 -0
- package/dist/server/chunks/hooks.universal-B3lncnqn.js +6 -0
- package/dist/server/chunks/hooks.universal-B3lncnqn.js.map +1 -0
- package/dist/server/chunks/html-FW6Ia4bL.js +8 -0
- package/dist/server/chunks/html-FW6Ia4bL.js.map +1 -0
- package/dist/server/chunks/index-Ch5Bqlgz.js +1411 -0
- package/dist/server/chunks/index-Ch5Bqlgz.js.map +1 -0
- package/dist/server/chunks/runtime-Bf5HkYyl.js +318 -0
- package/dist/server/chunks/runtime-Bf5HkYyl.js.map +1 -0
- package/dist/server/chunks/sessions-CEbRx2vt.js +169 -0
- package/dist/server/chunks/sessions-CEbRx2vt.js.map +1 -0
- package/dist/server/index.js +7595 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/manifest.js +97 -0
- package/dist/server/manifest.js.map +1 -0
- package/dist/shims.js +32 -0
- package/package.json +3 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import http from 'node:http';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { handler } from './handler.js';
|
|
4
|
+
import { env, timeout_env } from './env.js';
|
|
5
|
+
import { setImmediate } from 'node:timers';
|
|
6
|
+
import * as qs from 'node:querystring';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {string|RegExp} input The route pattern
|
|
10
|
+
* @param {boolean} [loose] Allow open-ended matching. Ignored with `RegExp` input.
|
|
11
|
+
*/
|
|
12
|
+
function parse$1(input, loose) {
|
|
13
|
+
if (input instanceof RegExp) return { keys:false, pattern:input };
|
|
14
|
+
var c, o, tmp, ext, keys=[], pattern='', arr = input.split('/');
|
|
15
|
+
arr[0] || arr.shift();
|
|
16
|
+
|
|
17
|
+
while (tmp = arr.shift()) {
|
|
18
|
+
c = tmp[0];
|
|
19
|
+
if (c === '*') {
|
|
20
|
+
keys.push(c);
|
|
21
|
+
pattern += tmp[1] === '?' ? '(?:/(.*))?' : '/(.*)';
|
|
22
|
+
} else if (c === ':') {
|
|
23
|
+
o = tmp.indexOf('?', 1);
|
|
24
|
+
ext = tmp.indexOf('.', 1);
|
|
25
|
+
keys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) );
|
|
26
|
+
pattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)';
|
|
27
|
+
if (!!~ext) pattern += (!!~o ? '?' : '') + '\\' + tmp.substring(ext);
|
|
28
|
+
} else {
|
|
29
|
+
pattern += '/' + tmp;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
keys: keys,
|
|
35
|
+
pattern: new RegExp('^' + pattern + (loose ? '(?=$|\/)' : '\/?$'), 'i')
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const MAP = {
|
|
40
|
+
"": 0,
|
|
41
|
+
GET: 1,
|
|
42
|
+
HEAD: 2,
|
|
43
|
+
PATCH: 3,
|
|
44
|
+
OPTIONS: 4,
|
|
45
|
+
CONNECT: 5,
|
|
46
|
+
DELETE: 6,
|
|
47
|
+
TRACE: 7,
|
|
48
|
+
POST: 8,
|
|
49
|
+
PUT: 9,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
class Trouter {
|
|
53
|
+
constructor() {
|
|
54
|
+
this.routes = [];
|
|
55
|
+
|
|
56
|
+
this.all = this.add.bind(this, '');
|
|
57
|
+
this.get = this.add.bind(this, 'GET');
|
|
58
|
+
this.head = this.add.bind(this, 'HEAD');
|
|
59
|
+
this.patch = this.add.bind(this, 'PATCH');
|
|
60
|
+
this.options = this.add.bind(this, 'OPTIONS');
|
|
61
|
+
this.connect = this.add.bind(this, 'CONNECT');
|
|
62
|
+
this.delete = this.add.bind(this, 'DELETE');
|
|
63
|
+
this.trace = this.add.bind(this, 'TRACE');
|
|
64
|
+
this.post = this.add.bind(this, 'POST');
|
|
65
|
+
this.put = this.add.bind(this, 'PUT');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
use(route, ...fns) {
|
|
69
|
+
let handlers = [].concat.apply([], fns);
|
|
70
|
+
let { keys, pattern } = parse$1(route, true);
|
|
71
|
+
this.routes.push({ keys, pattern, method: '', handlers, midx: MAP[''] });
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
add(method, route, ...fns) {
|
|
76
|
+
let { keys, pattern } = parse$1(route);
|
|
77
|
+
let handlers = [].concat.apply([], fns);
|
|
78
|
+
this.routes.push({ keys, pattern, method, handlers, midx: MAP[method] });
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
find(method, url) {
|
|
83
|
+
let midx = MAP[method];
|
|
84
|
+
let isHEAD = (midx === 2);
|
|
85
|
+
let i=0, j=0, k, tmp, arr=this.routes;
|
|
86
|
+
let matches=[], params={}, handlers=[];
|
|
87
|
+
for (; i < arr.length; i++) {
|
|
88
|
+
tmp = arr[i];
|
|
89
|
+
if (tmp.midx === midx || tmp.midx === 0 || (isHEAD && tmp.midx===1) ) {
|
|
90
|
+
if (tmp.keys === false) {
|
|
91
|
+
matches = tmp.pattern.exec(url);
|
|
92
|
+
if (matches === null) continue;
|
|
93
|
+
if (matches.groups !== void 0) for (k in matches.groups) params[k]=matches.groups[k];
|
|
94
|
+
tmp.handlers.length > 1 ? (handlers=handlers.concat(tmp.handlers)) : handlers.push(tmp.handlers[0]);
|
|
95
|
+
} else if (tmp.keys.length > 0) {
|
|
96
|
+
matches = tmp.pattern.exec(url);
|
|
97
|
+
if (matches === null) continue;
|
|
98
|
+
for (j=0; j < tmp.keys.length;) params[tmp.keys[j]]=matches[++j];
|
|
99
|
+
tmp.handlers.length > 1 ? (handlers=handlers.concat(tmp.handlers)) : handlers.push(tmp.handlers[0]);
|
|
100
|
+
} else if (tmp.pattern.test(url)) {
|
|
101
|
+
tmp.handlers.length > 1 ? (handlers=handlers.concat(tmp.handlers)) : handlers.push(tmp.handlers[0]);
|
|
102
|
+
}
|
|
103
|
+
} // else not a match
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return { params, handlers };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @typedef ParsedURL
|
|
112
|
+
* @type {import('.').ParsedURL}
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @typedef Request
|
|
117
|
+
* @property {string} url
|
|
118
|
+
* @property {ParsedURL} _parsedUrl
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @param {Request} req
|
|
123
|
+
* @returns {ParsedURL|void}
|
|
124
|
+
*/
|
|
125
|
+
function parse(req) {
|
|
126
|
+
let raw = req.url;
|
|
127
|
+
if (raw == null) return;
|
|
128
|
+
|
|
129
|
+
let prev = req._parsedUrl;
|
|
130
|
+
if (prev && prev.raw === raw) return prev;
|
|
131
|
+
|
|
132
|
+
let pathname=raw, search='', query;
|
|
133
|
+
|
|
134
|
+
if (raw.length > 1) {
|
|
135
|
+
let idx = raw.indexOf('?', 1);
|
|
136
|
+
|
|
137
|
+
if (idx !== -1) {
|
|
138
|
+
search = raw.substring(idx);
|
|
139
|
+
pathname = raw.substring(0, idx);
|
|
140
|
+
if (search.length > 1) {
|
|
141
|
+
query = qs.parse(search.substring(1));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return req._parsedUrl = { pathname, search, query, raw };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function onError(err, req, res) {
|
|
150
|
+
let code = typeof err.status === 'number' && err.status;
|
|
151
|
+
code = res.statusCode = (code && code >= 100 ? code : 500);
|
|
152
|
+
if (typeof err === 'string' || Buffer.isBuffer(err)) res.end(err);
|
|
153
|
+
else res.end(err.message || http.STATUS_CODES[code]);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const mount = fn => fn instanceof Polka ? fn.attach : fn;
|
|
157
|
+
|
|
158
|
+
class Polka extends Trouter {
|
|
159
|
+
constructor(opts={}) {
|
|
160
|
+
super();
|
|
161
|
+
this.parse = parse;
|
|
162
|
+
this.server = opts.server;
|
|
163
|
+
this.handler = this.handler.bind(this);
|
|
164
|
+
this.onError = opts.onError || onError; // catch-all handler
|
|
165
|
+
this.onNoMatch = opts.onNoMatch || this.onError.bind(null, { status: 404 });
|
|
166
|
+
this.attach = (req, res) => setImmediate(this.handler, req, res);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
use(base, ...fns) {
|
|
170
|
+
if (base === '/') {
|
|
171
|
+
super.use(base, fns.map(mount));
|
|
172
|
+
} else if (typeof base === 'function' || base instanceof Polka) {
|
|
173
|
+
super.use('/', [base, ...fns].map(mount));
|
|
174
|
+
} else {
|
|
175
|
+
super.use(base,
|
|
176
|
+
(req, _, next) => {
|
|
177
|
+
if (typeof base === 'string') {
|
|
178
|
+
let len = base.length;
|
|
179
|
+
base.startsWith('/') || len++;
|
|
180
|
+
req.url = req.url.substring(len) || '/';
|
|
181
|
+
req.path = req.path.substring(len) || '/';
|
|
182
|
+
} else {
|
|
183
|
+
req.url = req.url.replace(base, '') || '/';
|
|
184
|
+
req.path = req.path.replace(base, '') || '/';
|
|
185
|
+
}
|
|
186
|
+
if (req.url.charAt(0) !== '/') {
|
|
187
|
+
req.url = '/' + req.url;
|
|
188
|
+
}
|
|
189
|
+
next();
|
|
190
|
+
},
|
|
191
|
+
fns.map(mount),
|
|
192
|
+
(req, _, next) => {
|
|
193
|
+
req.path = req._parsedUrl.pathname;
|
|
194
|
+
req.url = req.path + req._parsedUrl.search;
|
|
195
|
+
next();
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
return this; // chainable
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
listen() {
|
|
203
|
+
(this.server = this.server || http.createServer()).on('request', this.attach);
|
|
204
|
+
this.server.listen.apply(this.server, arguments);
|
|
205
|
+
return this;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
handler(req, res, next) {
|
|
209
|
+
let info = this.parse(req), path = info.pathname;
|
|
210
|
+
let obj = this.find(req.method, req.path=path);
|
|
211
|
+
|
|
212
|
+
req.url = path + info.search;
|
|
213
|
+
req.originalUrl = req.originalUrl || req.url;
|
|
214
|
+
req.query = info.query || {};
|
|
215
|
+
req.search = info.search;
|
|
216
|
+
req.params = obj.params;
|
|
217
|
+
|
|
218
|
+
if (path.length > 1 && path.indexOf('%', 1) !== -1) {
|
|
219
|
+
for (let k in req.params) {
|
|
220
|
+
try { req.params[k] = decodeURIComponent(req.params[k]); }
|
|
221
|
+
catch (e) { /* malform uri segment */ }
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
let i=0, arr=obj.handlers.concat(this.onNoMatch), len=arr.length;
|
|
226
|
+
let loop = async () => res.finished || (i < len) && arr[i++](req, res, next);
|
|
227
|
+
(next = next || (err => err ? this.onError(err, req, res, next) : loop().catch(next)))(); // init
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function polka (opts) {
|
|
232
|
+
return new Polka(opts);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const path = env('SOCKET_PATH', false);
|
|
236
|
+
const host = env('HOST', '0.0.0.0');
|
|
237
|
+
const port = env('PORT', !path && '3000');
|
|
238
|
+
|
|
239
|
+
const shutdown_timeout = parseInt(env('SHUTDOWN_TIMEOUT', '30'));
|
|
240
|
+
const idle_timeout = parseInt(env('IDLE_TIMEOUT', '0'));
|
|
241
|
+
const listen_pid = parseInt(env('LISTEN_PID', '0'));
|
|
242
|
+
const listen_fds = parseInt(env('LISTEN_FDS', '0'));
|
|
243
|
+
// https://www.freedesktop.org/software/systemd/man/latest/sd_listen_fds.html
|
|
244
|
+
const SD_LISTEN_FDS_START = 3;
|
|
245
|
+
|
|
246
|
+
if (listen_pid !== 0 && listen_pid !== process.pid) {
|
|
247
|
+
throw new Error(`received LISTEN_PID ${listen_pid} but current process id is ${process.pid}`);
|
|
248
|
+
}
|
|
249
|
+
if (listen_fds > 1) {
|
|
250
|
+
throw new Error(
|
|
251
|
+
`only one socket is allowed for socket activation, but LISTEN_FDS was set to ${listen_fds}`
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const socket_activation = listen_pid === process.pid && listen_fds === 1;
|
|
256
|
+
|
|
257
|
+
let requests = 0;
|
|
258
|
+
/** @type {NodeJS.Timeout | void} */
|
|
259
|
+
let shutdown_timeout_id;
|
|
260
|
+
/** @type {NodeJS.Timeout | void} */
|
|
261
|
+
let idle_timeout_id;
|
|
262
|
+
|
|
263
|
+
// Initialize the HTTP server here so that we can set properties before starting to listen.
|
|
264
|
+
// Otherwise, polka delays creating the server until listen() is called. Settings these
|
|
265
|
+
// properties after the server has started listening could lead to race conditions.
|
|
266
|
+
const httpServer = http.createServer();
|
|
267
|
+
|
|
268
|
+
const keep_alive_timeout = timeout_env('KEEP_ALIVE_TIMEOUT');
|
|
269
|
+
if (keep_alive_timeout !== undefined) {
|
|
270
|
+
// Convert the keep-alive timeout from seconds to milliseconds (the unit Node.js expects).
|
|
271
|
+
httpServer.keepAliveTimeout = keep_alive_timeout * 1000;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const headers_timeout = timeout_env('HEADERS_TIMEOUT');
|
|
275
|
+
if (headers_timeout !== undefined) {
|
|
276
|
+
// Convert the headers timeout from seconds to milliseconds (the unit Node.js expects).
|
|
277
|
+
httpServer.headersTimeout = headers_timeout * 1000;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const server = polka({ server: httpServer }).use(handler);
|
|
281
|
+
|
|
282
|
+
if (socket_activation) {
|
|
283
|
+
server.listen({ fd: SD_LISTEN_FDS_START }, () => {
|
|
284
|
+
console.log(`Listening on file descriptor ${SD_LISTEN_FDS_START}`);
|
|
285
|
+
});
|
|
286
|
+
} else {
|
|
287
|
+
server.listen({ path, host, port }, () => {
|
|
288
|
+
console.log(`Listening on ${path || `http://${host}:${port}`}`);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** @param {'SIGINT' | 'SIGTERM' | 'IDLE'} reason */
|
|
293
|
+
function graceful_shutdown(reason) {
|
|
294
|
+
if (shutdown_timeout_id) return;
|
|
295
|
+
|
|
296
|
+
// If a connection was opened with a keep-alive header close() will wait for the connection to
|
|
297
|
+
// time out rather than close it even if it is not handling any requests, so call this first
|
|
298
|
+
httpServer.closeIdleConnections();
|
|
299
|
+
|
|
300
|
+
httpServer.close((error) => {
|
|
301
|
+
// occurs if the server is already closed
|
|
302
|
+
if (error) return;
|
|
303
|
+
|
|
304
|
+
if (shutdown_timeout_id) {
|
|
305
|
+
clearTimeout(shutdown_timeout_id);
|
|
306
|
+
}
|
|
307
|
+
if (idle_timeout_id) {
|
|
308
|
+
clearTimeout(idle_timeout_id);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// @ts-expect-error custom events cannot be typed
|
|
312
|
+
process.emit('sveltekit:shutdown', reason);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
shutdown_timeout_id = setTimeout(() => httpServer.closeAllConnections(), shutdown_timeout * 1000);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
httpServer.on(
|
|
319
|
+
'request',
|
|
320
|
+
/** @param {import('node:http').IncomingMessage} req */
|
|
321
|
+
(req) => {
|
|
322
|
+
requests++;
|
|
323
|
+
|
|
324
|
+
if (socket_activation && idle_timeout_id) {
|
|
325
|
+
idle_timeout_id = clearTimeout(idle_timeout_id);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
req.on('close', () => {
|
|
329
|
+
requests--;
|
|
330
|
+
|
|
331
|
+
if (shutdown_timeout_id) {
|
|
332
|
+
// close connections as soon as they become idle, so they don't accept new requests
|
|
333
|
+
httpServer.closeIdleConnections();
|
|
334
|
+
}
|
|
335
|
+
if (requests === 0 && socket_activation && idle_timeout) {
|
|
336
|
+
idle_timeout_id = setTimeout(() => graceful_shutdown('IDLE'), idle_timeout * 1000);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
process.on('SIGTERM', graceful_shutdown);
|
|
343
|
+
process.on('SIGINT', graceful_shutdown);
|
|
344
|
+
|
|
345
|
+
export { host, path, port, server };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
|
|
3
|
+
function loadConfig() {
|
|
4
|
+
const configPath = process.env.QUIZ_CONFIG;
|
|
5
|
+
if (configPath && existsSync(configPath)) {
|
|
6
|
+
try {
|
|
7
|
+
const configFile = readFileSync(configPath, "utf-8");
|
|
8
|
+
return JSON.parse(configFile);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.error("Failed to load config file:", e);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
theme: "auto"
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const load = async () => {
|
|
18
|
+
const config = loadConfig();
|
|
19
|
+
return {
|
|
20
|
+
config: {
|
|
21
|
+
layout: config.layout ?? {},
|
|
22
|
+
theme: config.theme ?? "auto",
|
|
23
|
+
favicon: config.favicon,
|
|
24
|
+
css: config.css,
|
|
25
|
+
language: config.language
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var _layout_server_ts = /*#__PURE__*/Object.freeze({
|
|
31
|
+
__proto__: null,
|
|
32
|
+
load: load
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const index = 0;
|
|
36
|
+
let component_cache;
|
|
37
|
+
const component = async () => component_cache ??= (await import('./_layout.svelte-ByxFsgXH.js')).default;
|
|
38
|
+
const server_id = "src/routes/+layout.server.ts";
|
|
39
|
+
const imports = ["_app/immutable/nodes/0.B29QW3gO.js","_app/immutable/chunks/BBbVH-DX.js","_app/immutable/chunks/DnSqigra.js","_app/immutable/chunks/hqRb622q.js","_app/immutable/chunks/BYAtt_Gu.js","_app/immutable/chunks/C12jez52.js","_app/immutable/chunks/BrxBJB61.js","_app/immutable/chunks/C9b1VZtB.js","_app/immutable/chunks/qgn7L4n5.js"];
|
|
40
|
+
const stylesheets = ["_app/immutable/assets/0.BdUfdP7M.css"];
|
|
41
|
+
const fonts = [];
|
|
42
|
+
|
|
43
|
+
export { component, fonts, imports, index, _layout_server_ts as server, server_id, stylesheets };
|
|
44
|
+
//# sourceMappingURL=0-DMbzliU5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0-DMbzliU5.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/_layout.server.ts.js","../../../.svelte-kit/adapter-node/nodes/0.js"],"sourcesContent":["import { existsSync, readFileSync } from \"fs\";\nfunction loadConfig() {\n const configPath = process.env.QUIZ_CONFIG;\n if (configPath && existsSync(configPath)) {\n try {\n const configFile = readFileSync(configPath, \"utf-8\");\n return JSON.parse(configFile);\n } catch (e) {\n console.error(\"Failed to load config file:\", e);\n }\n }\n return {\n theme: \"auto\"\n };\n}\nconst load = async () => {\n const config = loadConfig();\n return {\n config: {\n layout: config.layout ?? {},\n theme: config.theme ?? \"auto\",\n favicon: config.favicon,\n css: config.css,\n language: config.language\n }\n };\n};\nexport {\n load\n};\n","import * as server from '../entries/pages/_layout.server.ts.js';\n\nexport const index = 0;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_layout.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/+layout.server.ts\";\nexport const imports = [\"_app/immutable/nodes/0.B29QW3gO.js\",\"_app/immutable/chunks/BBbVH-DX.js\",\"_app/immutable/chunks/DnSqigra.js\",\"_app/immutable/chunks/hqRb622q.js\",\"_app/immutable/chunks/BYAtt_Gu.js\",\"_app/immutable/chunks/C12jez52.js\",\"_app/immutable/chunks/BrxBJB61.js\",\"_app/immutable/chunks/C9b1VZtB.js\",\"_app/immutable/chunks/qgn7L4n5.js\"];\nexport const stylesheets = [\"_app/immutable/assets/0.BdUfdP7M.css\"];\nexport const fonts = [];\n"],"names":[],"mappings":";;AACA,SAAS,UAAU,GAAG;AACtB,EAAE,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW;AAC5C,EAAE,IAAI,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;AAC5C,IAAI,IAAI;AACR,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC;AAC1D,MAAM,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;AACnC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE;AAChB,MAAM,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,CAAC,CAAC;AACrD,IAAI;AACJ,EAAE;AACF,EAAE,OAAO;AACT,IAAI,KAAK,EAAE;AACX,GAAG;AACH;AACA,MAAM,IAAI,GAAG,YAAY;AACzB,EAAE,MAAM,MAAM,GAAG,UAAU,EAAE;AAC7B,EAAE,OAAO;AACT,IAAI,MAAM,EAAE;AACZ,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;AACjC,MAAM,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,MAAM;AACnC,MAAM,OAAO,EAAE,MAAM,CAAC,OAAO;AAC7B,MAAM,GAAG,EAAE,MAAM,CAAC,GAAG;AACrB,MAAM,QAAQ,EAAE,MAAM,CAAC;AACvB;AACA,GAAG;AACH,CAAC;;;;;;;ACxBW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,8BAAoC,CAAC,EAAE;AAElG,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AAChV,MAAC,WAAW,GAAG,CAAC,sCAAsC;AACtD,MAAC,KAAK,GAAG;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const index = 1;
|
|
2
|
+
let component_cache;
|
|
3
|
+
const component = async () => component_cache ??= (await import('./_error.svelte-DdU-RsvI.js')).default;
|
|
4
|
+
const imports = ["_app/immutable/nodes/1.D4qkuJBA.js","_app/immutable/chunks/BBbVH-DX.js","_app/immutable/chunks/DnSqigra.js","_app/immutable/chunks/hqRb622q.js","_app/immutable/chunks/C12jez52.js","_app/immutable/chunks/BrxBJB61.js"];
|
|
5
|
+
const stylesheets = [];
|
|
6
|
+
const fonts = [];
|
|
7
|
+
|
|
8
|
+
export { component, fonts, imports, index, stylesheets };
|
|
9
|
+
//# sourceMappingURL=1-BPgly3Wz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1-BPgly3Wz.js","sources":["../../../.svelte-kit/adapter-node/nodes/1.js"],"sourcesContent":["\n\nexport const index = 1;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_error.svelte.js')).default;\nexport const imports = [\"_app/immutable/nodes/1.D4qkuJBA.js\",\"_app/immutable/chunks/BBbVH-DX.js\",\"_app/immutable/chunks/DnSqigra.js\",\"_app/immutable/chunks/hqRb622q.js\",\"_app/immutable/chunks/C12jez52.js\",\"_app/immutable/chunks/BrxBJB61.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":"AAEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,6BAAmC,CAAC,EAAE;AACjG,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AACpO,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { g as getSessionStore } from './sessions-CEbRx2vt.js';
|
|
2
|
+
|
|
3
|
+
const load = async () => {
|
|
4
|
+
const store = getSessionStore();
|
|
5
|
+
const activeSessions = store.getActiveSessions();
|
|
6
|
+
const sessions = activeSessions.map((session) => ({
|
|
7
|
+
quizId: session.quizId,
|
|
8
|
+
sessionId: session.sessionId,
|
|
9
|
+
quizTitle: session.quiz.title || "Untitled Quiz",
|
|
10
|
+
status: session.status,
|
|
11
|
+
startedAt: session.startedAt,
|
|
12
|
+
expiresAt: session.expiresAt,
|
|
13
|
+
questionCount: session.quiz.questions?.length || 0
|
|
14
|
+
}));
|
|
15
|
+
const projectInfo = {
|
|
16
|
+
name: "Quiz MCP",
|
|
17
|
+
version: "0.0.1",
|
|
18
|
+
title: void 0,
|
|
19
|
+
description: void 0,
|
|
20
|
+
logo: void 0,
|
|
21
|
+
features: [
|
|
22
|
+
"Multi-question types (single, multiple, remove-extra, order, match, text)",
|
|
23
|
+
"Polished UI with DaisyUI components",
|
|
24
|
+
"Local-first - no external services required",
|
|
25
|
+
"MCP server integration for AI agents",
|
|
26
|
+
"Structured JSON output for LLM evaluation",
|
|
27
|
+
"Theme support (light/dark mode)"
|
|
28
|
+
],
|
|
29
|
+
githubUrl: "https://github.com/igorolshevsky/quiz-mcp",
|
|
30
|
+
hideFeatures: false
|
|
31
|
+
};
|
|
32
|
+
const layoutConfig = {
|
|
33
|
+
title: projectInfo.title,
|
|
34
|
+
logo: projectInfo.logo
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
sessions,
|
|
38
|
+
projectInfo,
|
|
39
|
+
layoutConfig,
|
|
40
|
+
config: {
|
|
41
|
+
theme: "auto"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var _page_server_ts = /*#__PURE__*/Object.freeze({
|
|
47
|
+
__proto__: null,
|
|
48
|
+
load: load
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const index = 2;
|
|
52
|
+
let component_cache;
|
|
53
|
+
const component = async () => component_cache ??= (await import('./_page.svelte-Cm8ocLsi.js')).default;
|
|
54
|
+
const server_id = "src/routes/+page.server.ts";
|
|
55
|
+
const imports = ["_app/immutable/nodes/2.B9MLTE_H.js","_app/immutable/chunks/BBbVH-DX.js","_app/immutable/chunks/DnSqigra.js","_app/immutable/chunks/BYAtt_Gu.js","_app/immutable/chunks/hqRb622q.js","_app/immutable/chunks/C9b1VZtB.js"];
|
|
56
|
+
const stylesheets = [];
|
|
57
|
+
const fonts = [];
|
|
58
|
+
|
|
59
|
+
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
|
|
60
|
+
//# sourceMappingURL=2-NzZFDUaQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"2-NzZFDUaQ.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/2.js"],"sourcesContent":["import { g as getSessionStore } from \"../../chunks/sessions.js\";\nconst load = async () => {\n const store = getSessionStore();\n const activeSessions = store.getActiveSessions();\n const sessions = activeSessions.map((session) => ({\n quizId: session.quizId,\n sessionId: session.sessionId,\n quizTitle: session.quiz.title || \"Untitled Quiz\",\n status: session.status,\n startedAt: session.startedAt,\n expiresAt: session.expiresAt,\n questionCount: session.quiz.questions?.length || 0\n }));\n const projectInfo = {\n name: \"Quiz MCP\",\n version: \"0.0.1\",\n title: void 0,\n description: void 0,\n logo: void 0,\n features: [\n \"Multi-question types (single, multiple, remove-extra, order, match, text)\",\n \"Polished UI with DaisyUI components\",\n \"Local-first - no external services required\",\n \"MCP server integration for AI agents\",\n \"Structured JSON output for LLM evaluation\",\n \"Theme support (light/dark mode)\"\n ],\n githubUrl: \"https://github.com/igorolshevsky/quiz-mcp\",\n hideFeatures: false\n };\n const layoutConfig = {\n title: projectInfo.title,\n logo: projectInfo.logo\n };\n return {\n sessions,\n projectInfo,\n layoutConfig,\n config: {\n theme: \"auto\"\n }\n };\n};\nexport {\n load\n};\n","import * as server from '../entries/pages/_page.server.ts.js';\n\nexport const index = 2;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/2.B9MLTE_H.js\",\"_app/immutable/chunks/BBbVH-DX.js\",\"_app/immutable/chunks/DnSqigra.js\",\"_app/immutable/chunks/BYAtt_Gu.js\",\"_app/immutable/chunks/hqRb622q.js\",\"_app/immutable/chunks/C9b1VZtB.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;AACA,MAAM,IAAI,GAAG,YAAY;AACzB,EAAE,MAAM,KAAK,GAAG,eAAe,EAAE;AACjC,EAAE,MAAM,cAAc,GAAG,KAAK,CAAC,iBAAiB,EAAE;AAClD,EAAE,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,MAAM;AACpD,IAAI,MAAM,EAAE,OAAO,CAAC,MAAM;AAC1B,IAAI,SAAS,EAAE,OAAO,CAAC,SAAS;AAChC,IAAI,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,eAAe;AACpD,IAAI,MAAM,EAAE,OAAO,CAAC,MAAM;AAC1B,IAAI,SAAS,EAAE,OAAO,CAAC,SAAS;AAChC,IAAI,SAAS,EAAE,OAAO,CAAC,SAAS;AAChC,IAAI,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,IAAI;AACrD,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,WAAW,GAAG;AACtB,IAAI,IAAI,EAAE,UAAU;AACpB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,KAAK,EAAE,MAAM;AACjB,IAAI,WAAW,EAAE,MAAM;AACvB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,QAAQ,EAAE;AACd,MAAM,2EAA2E;AACjF,MAAM,qCAAqC;AAC3C,MAAM,6CAA6C;AACnD,MAAM,sCAAsC;AAC5C,MAAM,2CAA2C;AACjD,MAAM;AACN,KAAK;AACL,IAAI,SAAS,EAAE,2CAA2C;AAC1D,IAAI,YAAY,EAAE;AAClB,GAAG;AACH,EAAE,MAAM,YAAY,GAAG;AACvB,IAAI,KAAK,EAAE,WAAW,CAAC,KAAK;AAC5B,IAAI,IAAI,EAAE,WAAW,CAAC;AACtB,GAAG;AACH,EAAE,OAAO;AACT,IAAI,QAAQ;AACZ,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,MAAM,EAAE;AACZ,MAAM,KAAK,EAAE;AACb;AACA,GAAG;AACH,CAAC;;;;;;;ACxCW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAkC,CAAC,EAAE;AAEhG,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AACpO,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { redirect } from '@sveltejs/kit';
|
|
2
|
+
import { g as getSessionStore } from './sessions-CEbRx2vt.js';
|
|
3
|
+
|
|
4
|
+
const load = async ({ params }) => {
|
|
5
|
+
const { quizId, sessionId } = params;
|
|
6
|
+
const store = getSessionStore();
|
|
7
|
+
const session = store.getSession(quizId, sessionId);
|
|
8
|
+
if (!session) {
|
|
9
|
+
throw redirect(302, `/${quizId}/${sessionId}/expired`);
|
|
10
|
+
}
|
|
11
|
+
if (session.status !== "active") {
|
|
12
|
+
throw redirect(302, `/${quizId}/${sessionId}/expired`);
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
quiz: session.quiz,
|
|
16
|
+
config: session.config,
|
|
17
|
+
quizId,
|
|
18
|
+
sessionId,
|
|
19
|
+
startedAt: session.startedAt
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var _page_server_ts = /*#__PURE__*/Object.freeze({
|
|
24
|
+
__proto__: null,
|
|
25
|
+
load: load
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const index = 3;
|
|
29
|
+
let component_cache;
|
|
30
|
+
const component = async () => component_cache ??= (await import('./_page.svelte-CRU5jaGZ.js')).default;
|
|
31
|
+
const server_id = "src/routes/[quizId]/[sessionId]/+page.server.ts";
|
|
32
|
+
const imports = ["_app/immutable/nodes/3.w4AbulQF.js","_app/immutable/chunks/BBbVH-DX.js","_app/immutable/chunks/DnSqigra.js","_app/immutable/chunks/BYAtt_Gu.js","_app/immutable/chunks/qgn7L4n5.js","_app/immutable/chunks/hqRb622q.js","_app/immutable/chunks/C9b1VZtB.js"];
|
|
33
|
+
const stylesheets = [];
|
|
34
|
+
const fonts = [];
|
|
35
|
+
|
|
36
|
+
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
|
|
37
|
+
//# sourceMappingURL=3-mMAf4OfT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"3-mMAf4OfT.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/_quizId_/_sessionId_/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/3.js"],"sourcesContent":["import { redirect } from \"@sveltejs/kit\";\nimport { g as getSessionStore } from \"../../../../chunks/sessions.js\";\nconst load = async ({ params }) => {\n const { quizId, sessionId } = params;\n const store = getSessionStore();\n const session = store.getSession(quizId, sessionId);\n if (!session) {\n throw redirect(302, `/${quizId}/${sessionId}/expired`);\n }\n if (session.status !== \"active\") {\n throw redirect(302, `/${quizId}/${sessionId}/expired`);\n }\n return {\n quiz: session.quiz,\n config: session.config,\n quizId,\n sessionId,\n startedAt: session.startedAt\n };\n};\nexport {\n load\n};\n","import * as server from '../entries/pages/_quizId_/_sessionId_/_page.server.ts.js';\n\nexport const index = 3;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_quizId_/_sessionId_/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/[quizId]/[sessionId]/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/3.w4AbulQF.js\",\"_app/immutable/chunks/BBbVH-DX.js\",\"_app/immutable/chunks/DnSqigra.js\",\"_app/immutable/chunks/BYAtt_Gu.js\",\"_app/immutable/chunks/qgn7L4n5.js\",\"_app/immutable/chunks/hqRb622q.js\",\"_app/immutable/chunks/C9b1VZtB.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;;AAEA,MAAM,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AACnC,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM;AACtC,EAAE,MAAM,KAAK,GAAG,eAAe,EAAE;AACjC,EAAE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC;AACrD,EAAE,IAAI,CAAC,OAAO,EAAE;AAChB,IAAI,MAAM,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1D,EAAE;AACF,EAAE,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;AACnC,IAAI,MAAM,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1D,EAAE;AACF,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,OAAO,CAAC,IAAI;AACtB,IAAI,MAAM,EAAE,OAAO,CAAC,MAAM;AAC1B,IAAI,MAAM;AACV,IAAI,SAAS;AACb,IAAI,SAAS,EAAE,OAAO,CAAC;AACvB,GAAG;AACH,CAAC;;;;;;;ACjBW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAuD,CAAC,EAAE;AAErH,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AACxQ,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { g as getSessionStore } from './sessions-CEbRx2vt.js';
|
|
2
|
+
|
|
3
|
+
const load = async ({ params }) => {
|
|
4
|
+
const { quizId, sessionId } = params;
|
|
5
|
+
const store = getSessionStore();
|
|
6
|
+
const session = store.getSession(quizId, sessionId);
|
|
7
|
+
let status = "not_found";
|
|
8
|
+
if (session) {
|
|
9
|
+
if (session.status === "expired") {
|
|
10
|
+
status = "expired";
|
|
11
|
+
} else if (session.status === "completed") {
|
|
12
|
+
status = "completed";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
quizId,
|
|
17
|
+
sessionId,
|
|
18
|
+
quiz: session?.quiz,
|
|
19
|
+
status
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var _page_server_ts = /*#__PURE__*/Object.freeze({
|
|
24
|
+
__proto__: null,
|
|
25
|
+
load: load
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const index = 4;
|
|
29
|
+
let component_cache;
|
|
30
|
+
const component = async () => component_cache ??= (await import('./_page.svelte-DkIV_2wP.js')).default;
|
|
31
|
+
const server_id = "src/routes/[quizId]/[sessionId]/expired/+page.server.ts";
|
|
32
|
+
const imports = ["_app/immutable/nodes/4.DxNxvh2P.js","_app/immutable/chunks/BBbVH-DX.js","_app/immutable/chunks/DnSqigra.js","_app/immutable/chunks/hqRb622q.js","_app/immutable/chunks/C12jez52.js","_app/immutable/chunks/BrxBJB61.js"];
|
|
33
|
+
const stylesheets = [];
|
|
34
|
+
const fonts = [];
|
|
35
|
+
|
|
36
|
+
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
|
|
37
|
+
//# sourceMappingURL=4-B6xeTrA4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"4-B6xeTrA4.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/_quizId_/_sessionId_/expired/_page.server.ts.js","../../../.svelte-kit/adapter-node/nodes/4.js"],"sourcesContent":["import { g as getSessionStore } from \"../../../../../chunks/sessions.js\";\nconst load = async ({ params }) => {\n const { quizId, sessionId } = params;\n const store = getSessionStore();\n const session = store.getSession(quizId, sessionId);\n let status = \"not_found\";\n if (session) {\n if (session.status === \"expired\") {\n status = \"expired\";\n } else if (session.status === \"completed\") {\n status = \"completed\";\n }\n }\n return {\n quizId,\n sessionId,\n quiz: session?.quiz,\n status\n };\n};\nexport {\n load\n};\n","import * as server from '../entries/pages/_quizId_/_sessionId_/expired/_page.server.ts.js';\n\nexport const index = 4;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_quizId_/_sessionId_/expired/_page.svelte.js')).default;\nexport { server };\nexport const server_id = \"src/routes/[quizId]/[sessionId]/expired/+page.server.ts\";\nexport const imports = [\"_app/immutable/nodes/4.DxNxvh2P.js\",\"_app/immutable/chunks/BBbVH-DX.js\",\"_app/immutable/chunks/DnSqigra.js\",\"_app/immutable/chunks/hqRb622q.js\",\"_app/immutable/chunks/C12jez52.js\",\"_app/immutable/chunks/BrxBJB61.js\"];\nexport const stylesheets = [];\nexport const fonts = [];\n"],"names":[],"mappings":";;AACA,MAAM,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK;AACnC,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM;AACtC,EAAE,MAAM,KAAK,GAAG,eAAe,EAAE;AACjC,EAAE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC;AACrD,EAAE,IAAI,MAAM,GAAG,WAAW;AAC1B,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE;AACtC,MAAM,MAAM,GAAG,SAAS;AACxB,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW,EAAE;AAC/C,MAAM,MAAM,GAAG,WAAW;AAC1B,IAAI;AACJ,EAAE;AACF,EAAE,OAAO;AACT,IAAI,MAAM;AACV,IAAI,SAAS;AACb,IAAI,IAAI,EAAE,OAAO,EAAE,IAAI;AACvB,IAAI;AACJ,GAAG;AACH,CAAC;;;;;;;ACjBW,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAA+D,CAAC,EAAE;AAE7H,MAAC,SAAS,GAAG;AACb,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AACpO,MAAC,WAAW,GAAG;AACf,MAAC,KAAK,GAAG;;;;"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { O as head, Q as escape_html, X as getContext } from './index-Ch5Bqlgz.js';
|
|
2
|
+
import './client-Bik_FcIp.js';
|
|
3
|
+
import './exports-zEtqeh3Y.js';
|
|
4
|
+
import '@sveltejs/kit/internal/server';
|
|
5
|
+
import '@sveltejs/kit/internal';
|
|
6
|
+
|
|
7
|
+
function context() {
|
|
8
|
+
return getContext("__request__");
|
|
9
|
+
}
|
|
10
|
+
const page$1 = {
|
|
11
|
+
get error() {
|
|
12
|
+
return context().page.error;
|
|
13
|
+
},
|
|
14
|
+
get status() {
|
|
15
|
+
return context().page.status;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const page = page$1;
|
|
19
|
+
function _error($$renderer, $$props) {
|
|
20
|
+
$$renderer.component(($$renderer2) => {
|
|
21
|
+
let error = page.error;
|
|
22
|
+
let errorMessage = error?.message || "An unexpected error occurred";
|
|
23
|
+
let errorCode = page.status || 500;
|
|
24
|
+
function getErrorStack() {
|
|
25
|
+
if (error && typeof error === "object" && "stack" in error) {
|
|
26
|
+
return error.stack;
|
|
27
|
+
}
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
getErrorStack();
|
|
31
|
+
head("1j96wlh", $$renderer2, ($$renderer3) => {
|
|
32
|
+
$$renderer3.title(($$renderer4) => {
|
|
33
|
+
$$renderer4.push(`<title>Error ${escape_html(errorCode)} - Quiz MCP</title>`);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
$$renderer2.push(`<div class="flex min-h-screen items-center justify-center bg-base-200 p-4"><div class="card w-full max-w-lg bg-base-100 shadow-xl"><div class="card-body text-center"><div class="mb-6 flex justify-center">`);
|
|
37
|
+
if (errorCode === 404) {
|
|
38
|
+
$$renderer2.push("<!--[-->");
|
|
39
|
+
$$renderer2.push(`<div class="flex h-24 w-24 items-center justify-center rounded-full bg-warning/20"><svg xmlns="http://www.w3.org/2000/svg" class="h-14 w-14 text-warning" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div>`);
|
|
40
|
+
} else {
|
|
41
|
+
$$renderer2.push("<!--[!-->");
|
|
42
|
+
if (errorCode === 400) {
|
|
43
|
+
$$renderer2.push("<!--[-->");
|
|
44
|
+
$$renderer2.push(`<div class="flex h-24 w-24 items-center justify-center rounded-full bg-error/20"><svg xmlns="http://www.w3.org/2000/svg" class="h-14 w-14 text-error" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg></div>`);
|
|
45
|
+
} else {
|
|
46
|
+
$$renderer2.push("<!--[!-->");
|
|
47
|
+
$$renderer2.push(`<div class="flex h-24 w-24 items-center justify-center rounded-full bg-error/20"><svg xmlns="http://www.w3.org/2000/svg" class="h-14 w-14 text-error" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div>`);
|
|
48
|
+
}
|
|
49
|
+
$$renderer2.push(`<!--]-->`);
|
|
50
|
+
}
|
|
51
|
+
$$renderer2.push(`<!--]--></div> <h1 class="text-6xl font-bold text-base-content/20">${escape_html(errorCode)}</h1> <h2 class="mt-[-1rem] card-title justify-center text-2xl">`);
|
|
52
|
+
if (errorCode === 404) {
|
|
53
|
+
$$renderer2.push("<!--[-->");
|
|
54
|
+
$$renderer2.push(`Page Not Found`);
|
|
55
|
+
} else {
|
|
56
|
+
$$renderer2.push("<!--[!-->");
|
|
57
|
+
if (errorCode === 400) {
|
|
58
|
+
$$renderer2.push("<!--[-->");
|
|
59
|
+
$$renderer2.push(`Invalid Request`);
|
|
60
|
+
} else {
|
|
61
|
+
$$renderer2.push("<!--[!-->");
|
|
62
|
+
if (errorCode === 500) {
|
|
63
|
+
$$renderer2.push("<!--[-->");
|
|
64
|
+
$$renderer2.push(`Server Error`);
|
|
65
|
+
} else {
|
|
66
|
+
$$renderer2.push("<!--[!-->");
|
|
67
|
+
$$renderer2.push(`Error`);
|
|
68
|
+
}
|
|
69
|
+
$$renderer2.push(`<!--]-->`);
|
|
70
|
+
}
|
|
71
|
+
$$renderer2.push(`<!--]-->`);
|
|
72
|
+
}
|
|
73
|
+
$$renderer2.push(`<!--]--></h2> <p class="mt-2 text-base-content/70">${escape_html(errorMessage)}</p> `);
|
|
74
|
+
{
|
|
75
|
+
$$renderer2.push("<!--[!-->");
|
|
76
|
+
}
|
|
77
|
+
$$renderer2.push(`<!--]--> <div class="mt-6 card-actions justify-center"><a href="/" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path></svg> Go Home</a> <button type="button" class="btn btn-ghost">Go Back</button></div> <p class="mt-4 text-sm text-base-content/50">If you believe this is a mistake, please check the URL or try again later.</p></div></div></div>`);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { _error as default };
|
|
82
|
+
//# sourceMappingURL=_error.svelte-DdU-RsvI.js.map
|