All files interfaces.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63                                                                                                                  4x   4x 4x    
import {GOOGLE_STRATEGY_NAME, FACEBOOK_STRATEGY_NAME} from './constants'
 
export type SUPPORTED_THIRD_PARTIES = typeof GOOGLE_STRATEGY_NAME | typeof FACEBOOK_STRATEGY_NAME
 
export type ConfigDetail = {
    /**
     * @description
     * This is also known as **App ID**
     * 
     * Basicaly, a provider will ask you to create an app with their platform
     * 
     * Once your app created, it will have an **id** and **secret**
     */
    clientId: string
    clientSecret: string
    /**
     * @description 
     * Enable authentication to Shop Api
     * 
     * @default
     * false
     * 
     */
}
 
export type IThirdPartyAuthPluginOptions = {
    [T in SUPPORTED_THIRD_PARTIES]?: ConfigDetail
}
 
export type GoogleAuthData = {
    token: string;
}
 
export type FacebookAuthData = {
    token: string;
}
 
export interface FacebookDebugTokenInfo {
    app_id: string
    type: 'USER'
    application: string
    expires_at: number
    is_valid: boolean
    issued_at: number
    metadata: any 
    scopes: string[]
    user_id: string
}
 
export interface FacebookUserInfo {
    id: string
    first_name?: string
    last_name?: string
    email: string
}
 
export class UserExistedInAnotherStrategyError extends Error {
    name = 'UserExistedInAnotherStrategy'
    constructor(strategy: string) {
        super()
        this.message = `User existed in "${strategy}" strategy`
    }
}