mirror of
https://github.com/JoshiCodes/knock.git
synced 2026-12-04 15:09:41 +01:00
Make the dev mock a module
This commit is contained in:
+3
-2
@@ -138,7 +138,7 @@ const vars = [
|
|||||||
{ name: 'token', value: 'eyJhbGciOi…', scope: 'runtime', source: 'runtime', secret: false, problem: null }
|
{ 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: 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: 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 }
|
{ 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':
|
case 'request_preview':
|
||||||
return { request: response.output.request, auth: response.output.auth, missing: [], error: null };
|
return { request: response.output.request, auth: response.output.auth, missing: [], error: null };
|
||||||
case 'history_list':
|
case 'history_list':
|
||||||
return history;
|
return historyEntries;
|
||||||
case 'env_get':
|
case 'env_get':
|
||||||
return { name: args.id === 'prod' ? 'Production' : 'local', vars: { BASE: 'http://localhost:5173', clientId: 'knock', clientSecret: { secret: true } } };
|
return { name: args.id === 'prod' ? 'Production' : 'local', vars: { BASE: 'http://localhost:5173', clientId: 'knock', clientSecret: { secret: true } } };
|
||||||
case 'env_secrets':
|
case 'env_secrets':
|
||||||
@@ -220,3 +220,4 @@ try {
|
|||||||
} catch {
|
} catch {
|
||||||
/* storage blocked */
|
/* storage blocked */
|
||||||
}
|
}
|
||||||
|
export {};
|
||||||
|
|||||||
Reference in New Issue
Block a user