Skip to content

Commit

Permalink
fix(ipInfo): fix CI typings
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienZ committed Sep 3, 2024
1 parent 562b234 commit d416d7f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/runtime/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { generateRandomString, alphabet } from "oslo/crypto";
import { checkDbAndTables, type tableNames } from "../database";
import { getOAuthAccountsTableSchema, getSessionsTableSchema, getUsersTableSchema } from "../database/lib/schema";
import { drizzle as drizzleIntegration } from "db0/integrations/drizzle/index";
import type { checkDbAndTablesParameters, ICreateOrLoginParams, ISlipAuthCoreOptions, SchemasMockValue, SlipAuthSession } from "./types";
import type { checkDbAndTablesParameters, ICreateOrLoginParams, ISlipAuthCoreOptions, SchemasMockValue } from "./types";
import { createSlipHooks } from "./hooks";
import { UsersRepository } from "./repositories/UsersRepository";
import { SessionsRepository } from "./repositories/SessionsRepository";
import { OAuthAccountsRepository } from "./repositories/OAuthAccountsRepository";
import type { SlipAuthPublicSession } from "../types";

const defaultIdGenerationMethod = () => generateRandomString(15, alphabet("a-z", "A-Z", "0-9"));

Expand Down Expand Up @@ -69,7 +70,7 @@ export class SlipAuthCore {
*/
public async registerUserIfMissingInDb(
params: ICreateOrLoginParams,
): Promise<[ string, SlipAuthSession]> {
): Promise<[ string, SlipAuthPublicSession]> {
const existingUser = await this.#repos.users.findByEmail(params.email);

if (!existingUser) {
Expand All @@ -91,7 +92,7 @@ export class SlipAuthCore {
ua: params.ua,
});

return [userId, sessionFromRegistration as SlipAuthSession];
return [userId, sessionFromRegistration];
}

const existingAccount = await this.#repos.oAuthAccounts.findByProviderData(
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/server/utils/useSlipAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function useSlipAuth() {
sessionMaxAge: slipAuthConfig.sessionMaxAge,
});

if (config.slipAuthIpInfoToken) {
if (config.slipAuthIpInfoToken && typeof config.slipAuthIpInfoToken === "string" && config.slipAuthIpInfoToken.length > 0) {
setupIpInfoAddOn(instance, config.slipAuthIpInfoToken);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface SlipModuleOptions extends ISlipAuthCoreOptions {
declare module "nuxt/schema" {
interface RuntimeConfig {
slipAuth: SlipModuleOptions
slipAuthIpInfoToken?: string
slipAuthIpInfoToken: string
}
}

Expand Down

0 comments on commit d416d7f

Please sign in to comment.