0.3.12 • Published 4 years ago

functional-cloudstorage v0.3.12

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

functional-cloudstorage

functional-cloudstorage

functional-cloudstorage

functional-cloudstorage

Index

Modules

Interfaces

functional-cloudstorage"CloudStorage"Config

Interface: Config

Hierarchy

  • Config

Index

Properties

Properties

expires_in

expires_in: number

Defined in src/CloudStorage.ts:37


file_type

file_type: FileType

Defined in src/CloudStorage.ts:36

functional-cloudstorage"CloudStorage"ListFilesOptions

Interface: ListFilesOptions

Hierarchy

  • ListFilesOptions

Index

Properties

Properties

Optional delimiter

delimiter? : string

Defined in src/CloudStorage.ts:42


Optional prefix

prefix? : string

Defined in src/CloudStorage.ts:41

functional-cloudstorage"CloudStorage"Metadata

Interface: Metadata

Hierarchy

  • Metadata

Index

Properties

Properties

bucket

bucket: string

Defined in src/CloudStorage.ts:51


contentType

contentType: string

Defined in src/CloudStorage.ts:53


generation

generation: string

Defined in src/CloudStorage.ts:52


id

id: string

Defined in src/CloudStorage.ts:47


kind

kind: string

Defined in src/CloudStorage.ts:46


mediaLink

mediaLink: string

Defined in src/CloudStorage.ts:49


name

name: string

Defined in src/CloudStorage.ts:50


selfLink

selfLink: string

Defined in src/CloudStorage.ts:48


size

size: string

Defined in src/CloudStorage.ts:54


timeCreated

timeCreated: string

Defined in src/CloudStorage.ts:55


updated

updated: string

Defined in src/CloudStorage.ts:56

functional-cloudstorage"CloudStorage"Path

Interface: Path

Hierarchy

  • Path

Index

Properties

Properties

bucket

bucket: string

Defined in src/CloudStorage.ts:31


filename

filename: string

Defined in src/CloudStorage.ts:32

functional-cloudstorage"Stubs"ReturnValues

Interface: ReturnValues

Hierarchy

  • ReturnValues

Index

Properties

Properties

buffer

buffer: Buffer

Defined in src/Stubs.ts:12


url

url: string

Defined in src/Stubs.ts:11

Modules

functional-cloudstorage"Arbitraries"

Module: "Arbitraries"

Index

Functions

Functions

Const bucket

bucket(): Arbitrary‹SinonStubbedInstance‹Bucket››

Defined in src/Arbitraries.ts:41

Returns: Arbitrary‹SinonStubbedInstance‹Bucket››


Const buffer

buffer(): Arbitrary‹Buffer›

Defined in src/Arbitraries.ts:29

Returns: Arbitrary‹Buffer›


Const config

config(): Arbitrary‹Config

Defined in src/Arbitraries.ts:14

Returns: Arbitrary‹Config


Const error

error(): Arbitrary‹Error›

Defined in src/Arbitraries.ts:20

Returns: Arbitrary‹Error›


Const file

file(): Arbitrary‹SinonStubbedInstance‹File››

Defined in src/Arbitraries.ts:38

Returns: Arbitrary‹SinonStubbedInstance‹File››


Const path

path(): Arbitrary‹Path

Defined in src/Arbitraries.ts:23

Returns: Arbitrary‹Path


Const returnValues

returnValues(): Arbitrary‹ReturnValues

Defined in src/Arbitraries.ts:32

Returns: Arbitrary‹ReturnValues


Const storage

storage(arb?: Arbitrary‹ReturnValues›): Arbitrary‹SinonStubbedInstance‹Storage››

Defined in src/Arbitraries.ts:44

Parameters:

NameType
arb?Arbitrary‹ReturnValues

Returns: Arbitrary‹SinonStubbedInstance‹Storage››

functional-cloudstorage"CloudStorage"

Module: "CloudStorage"

Index

Interfaces

Type aliases

Variables

Functions

Type aliases

FileType

Ƭ FileType: FileType.FileType

Defined in src/CloudStorage.ts:27

Variables

Const fetchFile

fetchFile: function = pipe( fetchFileTask, TEUtils.fromTask )

Defined in src/CloudStorage.ts:187

fetchFile :: File -> TaskEither File Error
Type declaration:

▸ (file: File): TaskEither‹Error, File›

Parameters:

NameType
fileFile

Const fetchFileFromStorage

fetchFileFromStorage: function = pipe( getFileFromStorage, R.map(fetchFile) )

Defined in src/CloudStorage.ts:197

fetchFileFromStorage :: Storage -> ReaderTaskEither Path File Error
Type declaration:

▸ (storage: Storage): ReaderTaskEither‹Path, Error, File›

Parameters:

NameType
storageStorage

Const getBufferFromFile

getBufferFromFile: function = pipe( getBufferSingletonFromFile, TE.map(head as R.Reader<Buffer, Buffer>) )

Defined in src/CloudStorage.ts:242

getBufferFromFile :: File -> TaskEither Buffer Error
Type declaration:

▸ (file: File): TaskEither‹Error, Buffer›

Parameters:

NameType
fileFile

Const getBufferFromStorage

getBufferFromStorage: function = pipe( getFileFromStorage, R.map(getBufferFromFile) )

Defined in src/CloudStorage.ts:254

getBufferFromStorage :: Storage -> ReaderTaskEither Path File Error
Type declaration:

▸ (storage: Storage): ReaderTaskEither‹Path, Error, Buffer›

Parameters:

NameType
storageStorage

Const getBufferSingletonFromFile

getBufferSingletonFromFile: function = pipe( getBufferSingletonFromFileTask, partialRight(TE.tryCatch, E.toError) )

Defined in src/CloudStorage.ts:230

getBufferSingletonFromFile :: File -> TaskEither [Buffer] Error
Type declaration:

▸ (file: File): TaskEither‹Error, Buffer

Parameters:

NameType
fileFile

Const getFileFromStorage

getFileFromStorage: function = pipe( getBucketFromStorageWithPath, R.chain(getFileFromBucket) )

Defined in src/CloudStorage.ts:163

getFileFromStorage :: Storage -> Reader Path File
Type declaration:

▸ (storage: Storage): Reader‹Path, File›

Parameters:

NameType
storageStorage

Const getSignedUrlArrayFromFileTask

getSignedUrlArrayFromFileTask: function = useWith(call, getSignedUrlTask, getSignedUrlConfigFromConfig, )

Defined in src/CloudStorage.ts:99

getSignedUrlArrayFromFileTask :: File -> ReaderTask Config [String]
Type declaration:

▸ (file: File): Reader‹Config, Task‹string››

Parameters:

NameType
fileFile

Const getUploadUrlFromFile

getUploadUrlFromFile: function = pipe( getUploadUrlFromFileTask, R.map(getTaskEitherFromTask) )

Defined in src/CloudStorage.ts:132

getUploadUrlFromFile :: File -> ReaderTaskEither Config String Error
Type declaration:

▸ (file: File): ReaderTaskEither‹Config, Error, string›

Parameters:

NameType
fileFile

Const getUploadUrlFromFileTask

getUploadUrlFromFileTask: function = pipe( getSignedUrlArrayFromFileTask, RT.map<string[], string>(head) )

Defined in src/CloudStorage.ts:111

getUploadUrlFromFileTask :: File -> ReaderTask Config String
Type declaration:

▸ (file: File): ReaderTask‹Config, string›

Parameters:

NameType
fileFile

Const getUploadUrlFromStorage

getUploadUrlFromStorage: function = pipe( getFileFromStorage, R.map(getUploadUrlFromFile) )

Defined in src/CloudStorage.ts:209

getUploadUrlFromStorage :: Storage -> Path -> ReaderTaskEither Config String Error
Type declaration:

▸ (storage: Storage): Reader‹Path, ReaderTaskEither‹Config, Error, string››

Parameters:

NameType
storageStorage

Const listFilesInBucket

listFilesInBucket: function = pipe( listFilesInBucketTask, R.map(TEUtils.fromTask) )

Defined in src/CloudStorage.ts:366

listFilesInBucket :: Bucket -> ReaderTaskEither ListFilesOptions [File] Error
Type declaration:

▸ (bucket: Bucket): ReaderTaskEither‹ListFilesOptions, Error, File[]›

Parameters:

NameType
bucketBucket

Const listFilesInStorage

listFilesInStorage: function = pipe(getBucketFromStorage, R.map(listFilesInBucket))

Defined in src/CloudStorage.ts:378

listFilesInStorage :: Storage -> Reader String (ReaderTaskEither ListFilesOptions [File] Error)
Type declaration:

▸ (storage: Storage): Reader‹string, ReaderTaskEither‹ListFilesOptions, Error, File[]››

Parameters:

NameType
storageStorage

Const storeBufferToFile

storeBufferToFile: function = pipe( storeBufferToFileTask, R.map(getTaskEitherFromTask) )

Defined in src/CloudStorage.ts:280

storeBufferToFile :: File -> ReaderTaskEither Buffer File Error
Type declaration:

▸ (file: File): ReaderTaskEither‹Buffer, Error, File›

Parameters:

NameType
fileFile

Const storeBufferToStorage

storeBufferToStorage: function = pipe( getFileFromStorage, R.map(storeBufferToFile) )

Defined in src/CloudStorage.ts:292

storeBufferToStorage :: Storage -> Reader Path ReaderTaskEither Buffer File Error
Type declaration:

▸ (storage: Storage): Reader‹Path, ReaderTaskEither‹Buffer, Error, File››

Parameters:

NameType
storageStorage

Const storeMetadataToFile

storeMetadataToFile: function = pipe( storeMetadataToFileTask, R.map(getTaskEitherFromTask) )

Defined in src/CloudStorage.ts:318

storeMetadataToFile :: File -> ReaderTaskEither Metadata File Error
Type declaration:

▸ (file: File): ReaderTaskEither‹Partial‹Metadata›, Error, File›

Parameters:

NameType
fileFile

Const storeMetadataToStorage

storeMetadataToStorage: function = pipe(getFileFromStorage, R.map(storeMetadataToFile))

Defined in src/CloudStorage.ts:330

storeMetadataToStorage :: Metadata -> Reader Path ReaderTaskEither Metadata File Error
Type declaration:

▸ (storage: Storage): Reader‹Path, ReaderTaskEither‹Partial‹Metadata›, Error, File››

Parameters:

NameType
storageStorage

Functions

Const getBucketFromStorage

getBucketFromStorage(storage: Storage‹›): (Anonymous function)

Defined in src/CloudStorage.ts:344

getBucketFromStorage :: Storage -> Reader String Bucket

Parameters:

NameType
storageStorage‹›

Returns: (Anonymous function)


Const getBufferSingletonFromFileTask

getBufferSingletonFromFileTask(file: File‹›): (Anonymous function)

Defined in src/CloudStorage.ts:223

getBufferSingletonFromFilePromise :: File -> Task [Buffer]

Parameters:

NameType
fileFile‹›

Returns: (Anonymous function)


Const getFileFromBucket

getFileFromBucket(bucket: Bucket‹›): (Anonymous function)

Defined in src/CloudStorage.ts:144

getFileFromBucket :: Bucket -> Reader Path File

Parameters:

NameType
bucketBucket‹›

Returns: (Anonymous function)


Const getSignedUrlConfigFromConfig

getSignedUrlConfigFromConfig(__namedParameters: object): object

Defined in src/CloudStorage.ts:76

getSignedUrlConfigFromConfig :: Config -> GetSignedUrlConfig

Parameters:

__namedParameters: object

NameType
expiresInnumber
fileType"pdf" | "excel" | "json" | "png" | "jpeg"

Returns: object

  • action: "write" = "write"

  • contentType: "application/pdf" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/json" | "image/png" | "image/jpeg" = FileType.toContentType(fileType)

  • expires: number = getUnixTimestampIn(expiresIn)

  • version: "v4" = "v4"


Const getSignedUrlTask

getSignedUrlTask(file: File‹›): (Anonymous function)

Defined in src/CloudStorage.ts:90

getSignedUrlTask :: File -> ReaderTask GetSignedUrlConfig [String]

Parameters:

NameType
fileFile‹›

Returns: (Anonymous function)


Const getTaskEitherFromTask

getTaskEitherFromTask(task: Task‹A›): TaskEither‹Error, A›

Defined in src/CloudStorage.ts:125

getTaskEitherFromTask :: Task -> TaskEither

Parameters:

NameType
taskTask‹A›

Returns: TaskEither‹Error, A›


Const isPath

isPath(a: unknown): a is Path

Defined in src/CloudStorage.ts:64

isPath :: a -> bool

Parameters:

NameType
aunknown

Returns: a is Path


Const storeBufferToFileTask

storeBufferToFileTask(file: File‹›): (Anonymous function)

Defined in src/CloudStorage.ts:268

storeBufferToFileTask :: File -> ReaderTask Buffer File

Parameters:

NameType
fileFile‹›

Returns: (Anonymous function)


Const storeMetadataToFileTask

storeMetadataToFileTask(file: File‹›): (Anonymous function)

Defined in src/CloudStorage.ts:306

storeMetadataToFileTask :: File -> ReaderTask Metadata File

Parameters:

NameType
fileFile‹›

Returns: (Anonymous function)

functional-cloudstorage"DateTime"

Module: "DateTime"

Index

Functions

Functions

Const getUnixTimestampIn

getUnixTimestampIn(seconds: number): number

Defined in src/DateTime.ts:6

getUnixTimestampInMinutes :: Int -> Int

Parameters:

NameType
secondsnumber

Returns: number

functional-cloudstorage"index"

Module: "index"

Index

References

References

Config

Config:


FileType

FileType:


ListFilesOptions

ListFilesOptions:


Metadata

Metadata:


Path

Path:


fetchFile

fetchFile:


fetchFileFromStorage

fetchFileFromStorage:


getBucketFromStorage

getBucketFromStorage:


getBufferFromFile

getBufferFromFile:


getBufferFromStorage

getBufferFromStorage:


getBufferSingletonFromFile

getBufferSingletonFromFile:


getBufferSingletonFromFileTask

getBufferSingletonFromFileTask:


getFileFromBucket

getFileFromBucket:


getFileFromStorage

getFileFromStorage:


getSignedUrlArrayFromFileTask

getSignedUrlArrayFromFileTask:


getSignedUrlConfigFromConfig

getSignedUrlConfigFromConfig:


getSignedUrlTask

getSignedUrlTask:


getTaskEitherFromTask

getTaskEitherFromTask:


getUploadUrlFromFile

getUploadUrlFromFile:


getUploadUrlFromFileTask

getUploadUrlFromFileTask:


getUploadUrlFromStorage

getUploadUrlFromStorage:


isPath

isPath:


listFilesInBucket

listFilesInBucket:


listFilesInStorage

listFilesInStorage:


storeBufferToFile

storeBufferToFile:


storeBufferToFileTask

storeBufferToFileTask:


storeBufferToStorage

storeBufferToStorage:


storeMetadataToFile

storeMetadataToFile:


storeMetadataToFileTask

storeMetadataToFileTask:


storeMetadataToStorage

storeMetadataToStorage:

functional-cloudstorage"StorageObject"

Module: "StorageObject"

Index

Variables

Functions

Variables

Const getBufferFromCloudStorage

getBufferFromCloudStorage: function = pipe( getFileFromCloudStorage, RTE.fromReaderEither, RTE.chainTaskEitherK(getBufferFromFile) )

Defined in src/StorageObject.ts:48

getBufferFromCloudStorage :: CloudStorage -> ReaderTaskEither StorageObject Buffer Error
Type declaration:

▸ (storage: CloudStorage): ReaderTaskEither‹StorageObject, Error, Buffer›

Parameters:

NameType
storageCloudStorage

Const getFileNameFromStorageObject

getFileNameFromStorageObject: function = pipe(getFolderNameFromStorageObject, concat)

Defined in src/StorageObject.ts:81

getFileNameFromStorageObject :: StorageObject -> Reader String String
Type declaration:

▸ (object: StorageObject): Reader‹string, string›

Parameters:

NameType
objectStorageObject

Const getFolderNameFromPath

getFolderNameFromPath: function = pipe( split('/'), dropLast(1), join('/') )

Defined in src/StorageObject.ts:61

getFolderNameFromPath :: String -> String
Type declaration:

▸ (path: string): string

Parameters:

NameType
pathstring

Const getFolderNameFromStorageObject

getFolderNameFromStorageObject: function = pipe(prop<string, string>('name'), getFolderNameFromPath)

Defined in src/StorageObject.ts:72

getFolderNameFromStorageObject :: StorageObject -> String
Type declaration:

▸ (object: StorageObject): string

Parameters:

NameType
objectStorageObject

Const getPathFromStorageObject

getPathFromStorageObject: function = pipe( E.fromPredicate( allPass(has('bucket'), has('name')), () => new Error('StorageObject missing properties "bucket" and "name".') ), E.map( (object: StorageObject): Path => ({ bucket: object.bucket, filename: object.name, }) ) )

Defined in src/StorageObject.ts:18

getPathFromStorageObject :: StorageObject -> Either Path Error
Type declaration:

▸ (object: StorageObject): E.Either‹Error, Path

Parameters:

NameType
objectStorageObject

Functions

Const getFileFromCloudStorage

getFileFromCloudStorage(storage: Storage‹›): function

Defined in src/StorageObject.ts:40

getFileFromCloudStorage :: CloudStorage -> ReaderTaskEither StorageObject File Error

Parameters:

NameType
storageStorage‹›

Returns: function

▸ (x0: V0): T2

Parameters:

NameType
x0V0

Const getPathFromFilePath

getPathFromFilePath(bucket: string): (Anonymous function)

Defined in src/StorageObject.ts:90

getPathFromFilePath :: String -> Reader String Path

Parameters:

NameType
bucketstring

Returns: (Anonymous function)


Const getPathWithNameFromBucket

getPathWithNameFromBucket(bucket: string): function

Defined in src/StorageObject.ts:104

getPathWithNameFromBucket :: String -> Reader StorageObject (Reader String Path)

Parameters:

NameType
bucketstring

Returns: function

▸ (x0: V0): T2

Parameters:

NameType
x0V0

functional-cloudstorage"Stubs"

Module: "Stubs"

Index

Interfaces

Functions

Functions

Const bucket

bucket(values: ReturnValues): object

Defined in src/Stubs.ts:59

Parameters:

NameType
valuesReturnValues

Returns: object


Const download

download(buffer: Buffer‹›): (Anonymous function)

Defined in src/Stubs.ts:23

Parameters:

NameType
bufferBuffer‹›

Returns: (Anonymous function)


Const failedFile

failedFile(error: Error): object

Defined in src/Stubs.ts:48

Parameters:

NameType
errorError

Returns: object


Const file

file(values: ReturnValues): object

Defined in src/Stubs.ts:37

Parameters:

NameType
valuesReturnValues

Returns: object


Const getFailedSignedUrl

getFailedSignedUrl(error: Error): (Anonymous function)

Defined in src/Stubs.ts:30

Parameters:

NameType
errorError

Returns: (Anonymous function)


Const getSignedUrl

getSignedUrl(url: string): (Anonymous function)

Defined in src/Stubs.ts:18

Parameters:

NameType
urlstring

Returns: (Anonymous function)


Const storage

storage(values: ReturnValues): object

Defined in src/Stubs.ts:74

Parameters:

NameType
valuesReturnValues

Returns: object

0.3.12

4 years ago

0.3.11

4 years ago

0.3.10

4 years ago

0.3.9

4 years ago

0.3.8

4 years ago

0.3.6

4 years ago

0.3.7

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.2.4

4 years ago

0.3.0

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.2

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago