Created
January 29, 2021 11:43
-
-
Save LironHazan/5d83ea4e7b6833d5d7ca7041a3943cb5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const readCreds: Task<string> = async () => readFromFile('src/private/credentials.json', 'utf-8'); | |
const fail = <T>(reason: T) => new Error(`${reason}`); | |
const auth = (creds: string) => authorize(JSON.parse(creds), fetchTables); | |
export async function exportTables<E>(): Promise<Either<Error, Promise<Either<void, void>>>> { | |
const result: TaskEither<Error, string> = tryCatch(readCreds, fail); | |
return await pipe(result, map(auth))(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment