UNPKG

functional-google-cloud

Version:

Google Cloud Utilities functions in Functional Programming Style

15 lines (14 loc) 971 B
/// <reference types="node" /> import { Message, PubSub, Topic } from '@google-cloud/pubsub'; import * as E from 'fp-ts/lib/Either'; import * as R from 'fp-ts/lib/Reader'; import * as RT from 'fp-ts/lib/ReaderTask'; import * as RTE from 'fp-ts/lib/ReaderTaskEither'; export declare type Payload = Record<string, unknown>; export declare const isPayload: (a: unknown) => a is Record<string, unknown>; export declare const getBufferFromPayload: (payload: Payload) => Buffer; export declare const publishBufferToTopicTask: (buffer: Buffer) => RT.ReaderTask<Topic, string>; export declare const publishBufferToTopic: (buffer: Buffer) => RTE.ReaderTaskEither<Topic, Error, string>; export declare const publishToTopic: (payload: Payload) => RTE.ReaderTaskEither<Topic, Error, string>; export declare const getTopicFromPubSub: (topic: string) => R.Reader<PubSub, Topic>; export declare const getPayloadFromMessage: (message: Message) => E.Either<Error, Payload>;