Make the dev mock a module

This commit is contained in:
2026-11-27 21:48:41 +01:00
parent 14888c3748
commit f40c3975fb
+3 -2
View File
@@ -138,7 +138,7 @@ const vars = [
{ name: 'token', value: 'eyJhbGciOi…', scope: 'runtime', source: 'runtime', secret: false, problem: null }
];
const history = [
const historyEntries = [
{ id: 3, at: new Date(Date.now() - 60_000).toISOString(), collection: 'demo', request_id: 'auth/login.yaml', name: 'Login', method: 'POST', url: 'http://localhost:5173/api/login', status: 200, duration_ms: 41.7, size: 734, error: null, has_body: true },
{ id: 2, at: new Date(Date.now() - 600_000).toISOString(), collection: 'demo', request_id: null, name: 'User Info', method: 'GET', url: 'http://localhost:8080/oauth2/userinfo', status: 401, duration_ms: 12, size: 64, error: null, has_body: true },
{ id: 1, at: new Date(Date.now() - 3_600_000).toISOString(), collection: 'demo', request_id: null, name: 'Delete user', method: 'DELETE', url: 'http://localhost:5173/api/users/7', status: 204, duration_ms: 18, size: 0, error: null, has_body: false }
@@ -170,7 +170,7 @@ function handle(cmd: string, args: Record<string, unknown>): unknown {
case 'request_preview':
return { request: response.output.request, auth: response.output.auth, missing: [], error: null };
case 'history_list':
return history;
return historyEntries;
case 'env_get':
return { name: args.id === 'prod' ? 'Production' : 'local', vars: { BASE: 'http://localhost:5173', clientId: 'knock', clientSecret: { secret: true } } };
case 'env_secrets':
@@ -220,3 +220,4 @@ try {
} catch {
/* storage blocked */
}
export {};