mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
refactor: cleanup
This commit is contained in:
parent
464a4a9133
commit
a6342213a9
3 changed files with 1 additions and 6 deletions
|
@ -1,6 +1,5 @@
|
|||
import { getUnixTime } from 'date-fns';
|
||||
import type { Context } from 'koa';
|
||||
import type { IRouterParamContext } from 'koa-router';
|
||||
import type { InteractionResults, Provider } from 'oidc-provider';
|
||||
import { errors } from 'oidc-provider';
|
||||
|
||||
|
@ -36,7 +35,7 @@ export const assignInteractionResults = async (
|
|||
};
|
||||
|
||||
export const checkSessionHealth = async (
|
||||
ctx: IRouterParamContext & Context,
|
||||
ctx: Context,
|
||||
provider: Provider,
|
||||
tolerance = 10 * 60 // 10 mins
|
||||
) => {
|
||||
|
|
|
@ -42,7 +42,6 @@ export type LogPayload = Partial<LogContextPayload> & Record<string, unknown>;
|
|||
|
||||
export type LogContext = {
|
||||
createLog: (key: LogKey) => LogEntry;
|
||||
getLogs: () => readonly LogEntry[];
|
||||
prependAllLogEntries: (payload: LogPayload) => void;
|
||||
};
|
||||
|
||||
|
@ -110,8 +109,6 @@ export default function koaAuditLog<
|
|||
return entry;
|
||||
};
|
||||
|
||||
ctx.getLogs = () => Object.freeze(entries);
|
||||
|
||||
ctx.prependAllLogEntries = (payload) => {
|
||||
for (const entry of entries) {
|
||||
entry.prepend(payload);
|
||||
|
|
|
@ -13,7 +13,6 @@ export const createMockLogContext = (): LogContext & { mockAppend: jest.Mock } =
|
|||
return {
|
||||
createLog: jest.fn(() => mockLogEntry),
|
||||
prependAllLogEntries: jest.fn(),
|
||||
getLogs: jest.fn(),
|
||||
mockAppend: mockLogEntry.append,
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue