2
0
Files
bot/packages/models/features/credentials.ts

59 lines
1.2 KiB
TypeScript
Raw Normal View History

import { Credentials as CredentialsFromPrisma } from 'db'
2022-05-24 14:25:15 -07:00
export type Credentials =
| SmtpCredentials
| GoogleSheetsCredentials
| StripeCredentials
export type CredentialsBase = Omit<CredentialsFromPrisma, 'data' | 'type'>
export enum CredentialsType {
GOOGLE_SHEETS = 'google sheets',
SMTP = 'smtp',
2022-05-24 14:25:15 -07:00
STRIPE = 'stripe',
}
export type SmtpCredentials = CredentialsBase & {
type: CredentialsType.SMTP
data: SmtpCredentialsData
}
export type GoogleSheetsCredentials = CredentialsBase & {
type: CredentialsType.GOOGLE_SHEETS
data: GoogleSheetsCredentialsData
}
2022-05-24 14:25:15 -07:00
export type StripeCredentials = CredentialsBase & {
type: CredentialsType.STRIPE
data: StripeCredentialsData
}
export type GoogleSheetsCredentialsData = {
refresh_token?: string | null
expiry_date?: number | null
access_token?: string | null
token_type?: string | null
id_token?: string | null
scope?: string
}
export type SmtpCredentialsData = {
host?: string
username?: string
password?: string
isTlsEnabled?: boolean
port: number
from: { email?: string; name?: string }
}
2022-05-24 14:25:15 -07:00
export type StripeCredentialsData = {
live: {
secretKey: string
publicKey: string
}
test?: {
secretKey?: string
publicKey?: string
}
}