More build fixes

This commit is contained in:
Darren Clarke 2023-05-26 08:27:16 +00:00
parent 8fabcbaba2
commit 67b9b3e20a
11 changed files with 34 additions and 53 deletions

View file

@ -58,16 +58,16 @@ const validateAuth = (sharedSecret) => (request, username, password) => {
return { isValid, credentials };
};
const register = async <TUser, TProfile, TSession>(
const register = async (
server: Hapi.Server,
pluginOpts?: NextAuthPluginOptions<TUser, TProfile, TSession>
pluginOpts?: any
): Promise<void> => {
const options: NextAuthPluginOptions<TUser, TProfile, TSession> =
const options: any =
Hoek.applyToDefaults(
// a little type gymnastics here to workaround poor typing
defaultOptions as unknown,
defaultOptions as any,
pluginOpts
) as NextAuthPluginOptions<TUser, TProfile, TSession>;
) as any;
if (!options.nextAuthAdapterFactory) {
throw new Error(

View file

@ -1,7 +1,6 @@
/* eslint-disable unicorn/no-null */
import * as Joi from "joi";
import * as Hapi from "@hapi/hapi";
import { NextAuthPluginOptions } from "./types";
import { ResponseToolkit, ResponseObject } from "@hapi/hapi";
export interface LinkAccountPayload {
@ -14,9 +13,9 @@ export interface LinkAccountPayload {
accessTokenExpires?: null;
}
export const register = async <TUser, TProfile, TSession>(
export const register = async <TUser, TProfile>(
server: Hapi.Server,
opts: NextAuthPluginOptions<TUser, TProfile, TSession>,
opts: any,
auth?: string
): Promise<void> => {
const { tags, basePath, validators } = opts;

View file

@ -1,14 +1,13 @@
// @ts-nocheck
import type { AdapterInstance } from "next-auth/adapters";
import type { Adapter } from "next-auth/adapters";
import type { NumberSchema, StringSchema, ObjectSchema } from "joi";
import type { Request } from "@hapi/hapi";
export type AdapterFactory<TUser, TProfile, TSession> = (
export type AdapterFactory = (
request: Request
) => AdapterInstance<TUser, TProfile, TSession>;
) => Adapter;
export interface NextAuthPluginOptions<TUser, TProfile, TSession> {
nextAuthAdapterFactory: AdapterFactory<TUser, TProfile, TSession>;
export interface NextAuthPluginOptions {
nextAuthAdapterFactory: Adapter;
validators?: {
profile: ObjectSchema;