From a6342213a929fed7d3cd4de399effc328eeb1bc5 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Thu, 22 Dec 2022 13:53:28 +0800 Subject: [PATCH] refactor: cleanup --- packages/core/src/libraries/session.ts | 3 +-- packages/core/src/middleware/koa-audit-log.ts | 3 --- packages/core/src/test-utils/koa-audit-log.ts | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/core/src/libraries/session.ts b/packages/core/src/libraries/session.ts index 85e8a3f49..32102419e 100644 --- a/packages/core/src/libraries/session.ts +++ b/packages/core/src/libraries/session.ts @@ -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 ) => { diff --git a/packages/core/src/middleware/koa-audit-log.ts b/packages/core/src/middleware/koa-audit-log.ts index 9e3845001..75ba0ae48 100644 --- a/packages/core/src/middleware/koa-audit-log.ts +++ b/packages/core/src/middleware/koa-audit-log.ts @@ -42,7 +42,6 @@ export type LogPayload = Partial & Record; 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); diff --git a/packages/core/src/test-utils/koa-audit-log.ts b/packages/core/src/test-utils/koa-audit-log.ts index 98e4401b8..5052a0f89 100644 --- a/packages/core/src/test-utils/koa-audit-log.ts +++ b/packages/core/src/test-utils/koa-audit-log.ts @@ -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, }; };