diff --git a/.eslintrc.yml b/.eslintrc.yml index 1d08356..fbd4155 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -12,6 +12,7 @@ parserOptions: ignorePatterns: - dist - dist-cjs + - lib/__tests__/** - lib/apis/** - lib/models/** - lib/index.ts diff --git a/.github/workflows/build-test-ci.yml b/.github/workflows/build-test-ci.yml index 56ac11d..3065a36 100644 --- a/.github/workflows/build-test-ci.yml +++ b/.github/workflows/build-test-ci.yml @@ -32,4 +32,5 @@ jobs: run: pnpm config set enable-pre-post-scripts true - run: pnpm install - run: pnpm build + - run: pnpm lint - run: pnpm test diff --git a/lib/sdk/clients/browser/authcode-with-pkce.ts b/lib/sdk/clients/browser/authcode-with-pkce.ts index ac2fbd4..f586df6 100644 --- a/lib/sdk/clients/browser/authcode-with-pkce.ts +++ b/lib/sdk/clients/browser/authcode-with-pkce.ts @@ -175,7 +175,7 @@ const createAuthCodeWithPKCEClient = (options: BrowserPKCEClientOptions) => { `Cannot return claim "${claim}", no authentication credential found` ); } - return tokenClaims.getClaimValue(sessionManager, claim, type); + return await tokenClaims.getClaimValue(sessionManager, claim, type); }; /** diff --git a/lib/sdk/clients/server/authorization-code.ts b/lib/sdk/clients/server/authorization-code.ts index 352ee05..b9a62de 100644 --- a/lib/sdk/clients/server/authorization-code.ts +++ b/lib/sdk/clients/server/authorization-code.ts @@ -1,5 +1,5 @@ import { AuthorizationCode, AuthCodeWithPKCE } from '../../oauth2-flows/index.js'; -import { default as withAuthUtilities } from './with-auth-utilities.js'; +import withAuthUtilities from './with-auth-utilities.js'; import { type SessionManager } from '../../session-managers/index.js'; import type { UserType } from '../../utilities/index.js'; import * as utilities from '../../utilities/index.js'; diff --git a/lib/sdk/clients/server/client-credentials.ts b/lib/sdk/clients/server/client-credentials.ts index 41fbe23..6cf48d9 100644 --- a/lib/sdk/clients/server/client-credentials.ts +++ b/lib/sdk/clients/server/client-credentials.ts @@ -1,4 +1,4 @@ -import { default as withAuthUtilities } from './with-auth-utilities.js'; +import withAuthUtilities from './with-auth-utilities.js'; import { type SessionManager } from '../../session-managers/index.js'; import { ClientCredentials } from '../../oauth2-flows/index.js'; import type { CCClientOptions } from '../types.js'; diff --git a/lib/sdk/clients/server/with-auth-utilities.ts b/lib/sdk/clients/server/with-auth-utilities.ts index 554f2ee..fae130c 100644 --- a/lib/sdk/clients/server/with-auth-utilities.ts +++ b/lib/sdk/clients/server/with-auth-utilities.ts @@ -1,4 +1,4 @@ -import { SessionManager } from '../../session-managers'; +import { type SessionManager } from '../../session-managers'; import * as utilities from '../../utilities/index.js'; import type { @@ -93,7 +93,7 @@ const withAuthUtilities = ( `Cannot return claim "${claim}", no authentication credential found` ); } - return tokenClaims.getClaimValue(sessionManager, claim, type); + return await tokenClaims.getClaimValue(sessionManager, claim, type); }; /** diff --git a/lib/sdk/utilities/token-claims.ts b/lib/sdk/utilities/token-claims.ts index 3ad4411..4be1c89 100644 --- a/lib/sdk/utilities/token-claims.ts +++ b/lib/sdk/utilities/token-claims.ts @@ -1,5 +1,4 @@ import { type SessionManager } from '../session-managers/index.js'; -import { isTokenExpired } from './token-utils.js'; import { type ClaimTokenType } from './types.js'; import { jwtDecode } from 'jwt-decode'; diff --git a/lib/sdk/utilities/token-utils.ts b/lib/sdk/utilities/token-utils.ts index ec210bb..96ee783 100644 --- a/lib/sdk/utilities/token-utils.ts +++ b/lib/sdk/utilities/token-utils.ts @@ -133,5 +133,5 @@ export const isTokenExpired = (token: string | null): boolean => { const currentUnixTime = Math.floor(Date.now() / 1000); const tokenPayload = jwtDecode(token); if (!tokenPayload.exp) return true; - return currentUnixTime >= tokenPayload.exp!; + return currentUnixTime >= tokenPayload.exp; };