Files
medusa-store/www/apps/docs/content/references/js-client/classes/internal-8.internal.AbstractFileService.md
github-actions[bot] daea35fe73 chore(docs): Generated JS Client Reference (#5334)
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
2023-10-10 17:47:07 +00:00

10 KiB

displayed_sidebar
displayed_sidebar
jsClientSidebar

Class: AbstractFileService

internal.internal.AbstractFileService

Hierarchy

Implements

Properties

__configModule__

Protected Optional Readonly __configModule__: Record<string, unknown>

Implementation of

IFileService.configModule

Inherited from

TransactionBaseService.configModule

Defined in

packages/medusa/dist/interfaces/transaction-base-service.d.ts:5


__container__

Protected Readonly __container__: any

Implementation of

IFileService.container

Inherited from

TransactionBaseService.container

Defined in

packages/medusa/dist/interfaces/transaction-base-service.d.ts:4


__moduleDeclaration__

Protected Optional Readonly __moduleDeclaration__: Record<string, unknown>

Implementation of

IFileService.moduleDeclaration

Inherited from

TransactionBaseService.moduleDeclaration

Defined in

packages/medusa/dist/interfaces/transaction-base-service.d.ts:6


manager_

Protected manager_: EntityManager

Implementation of

IFileService.manager_

Inherited from

TransactionBaseService.manager_

Defined in

packages/medusa/dist/interfaces/transaction-base-service.d.ts:7


transactionManager_

Protected transactionManager_: undefined | EntityManager

Implementation of

IFileService.transactionManager_

Inherited from

TransactionBaseService.transactionManager_

Defined in

packages/medusa/dist/interfaces/transaction-base-service.d.ts:8

Accessors

activeManager_

Protected get activeManager_(): EntityManager

Returns

EntityManager

Implementation of

IFileService.activeManager_

Inherited from

TransactionBaseService.activeManager_

Defined in

packages/medusa/dist/interfaces/transaction-base-service.d.ts:9

Methods

atomicPhase_

Protected atomicPhase_<TResult, TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise<TResult>

Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.

Type parameters

Name
TResult
TError

Parameters

Name Type Description
work (transactionManager: EntityManager) => Promise<TResult> the transactional work to be done
isolationOrErrorHandler? IsolationLevel | (error: TError) => Promise<void | TResult> the isolation level to be used for the work.
maybeErrorHandlerOrDontFail? (error: TError) => Promise<void | TResult> Potential error handler

Returns

Promise<TResult>

the result of the transactional work

Implementation of

IFileService.atomicPhase_

Inherited from

TransactionBaseService.atomicPhase_

Defined in

packages/medusa/dist/interfaces/transaction-base-service.d.ts:24


delete

Abstract delete(fileData): Promise<void>

remove file from fileservice

Parameters

Name Type Description
fileData DeleteFileType Remove file described by record

Returns

Promise<void>

Implementation of

IFileService.delete

Defined in

packages/medusa/dist/interfaces/file-service.d.ts:43


getDownloadStream

Abstract getDownloadStream(fileData): Promise<ReadableStream>

download file from fileservice as stream

Parameters

Name Type Description
fileData GetUploadedFileType file metadata relevant for fileservice to download the file

Returns

Promise<ReadableStream>

readable stream of the file to download

Implementation of

IFileService.getDownloadStream

Defined in

packages/medusa/dist/interfaces/file-service.d.ts:45


getPresignedDownloadUrl

Abstract getPresignedDownloadUrl(fileData): Promise<string>

Generate a presigned download url to obtain a file

Parameters

Name Type Description
fileData GetUploadedFileType file metadata relevant for fileservice to download the file

Returns

Promise<string>

presigned url to download the file

Implementation of

IFileService.getPresignedDownloadUrl

Defined in

packages/medusa/dist/interfaces/file-service.d.ts:46


getUploadStreamDescriptor

Abstract getUploadStreamDescriptor(fileData): Promise<FileServiceGetUploadStreamResult>

upload file to fileservice from stream

Parameters

Name Type Description
fileData UploadStreamDescriptorType file metadata relevant for fileservice to create and upload the file

Returns

Promise<FileServiceGetUploadStreamResult>

Implementation of

IFileService.getUploadStreamDescriptor

Defined in

packages/medusa/dist/interfaces/file-service.d.ts:44


shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

Name Type
err Record<string, unknown> | { code: string }

Returns

boolean

Implementation of

IFileService.shouldRetryTransaction_

Inherited from

TransactionBaseService.shouldRetryTransaction_

Defined in

packages/medusa/dist/interfaces/transaction-base-service.d.ts:12


upload

Abstract upload(fileData): Promise<FileServiceUploadResult>

upload file to fileservice

Parameters

Name Type Description
fileData File Multer file from express multipart/form-data

Returns

Promise<FileServiceUploadResult>

Implementation of

IFileService.upload

Defined in

packages/medusa/dist/interfaces/file-service.d.ts:41


uploadProtected

Abstract uploadProtected(fileData): Promise<FileServiceUploadResult>

upload private file to fileservice

Parameters

Name Type Description
fileData File Multer file from express multipart/form-data

Returns

Promise<FileServiceUploadResult>

Implementation of

IFileService.uploadProtected

Defined in

packages/medusa/dist/interfaces/file-service.d.ts:42


withTransaction

withTransaction(transactionManager?): AbstractFileService

Parameters

Name Type
transactionManager? EntityManager

Returns

AbstractFileService

Implementation of

IFileService.withTransaction

Inherited from

TransactionBaseService.withTransaction

Defined in

packages/medusa/dist/interfaces/transaction-base-service.d.ts:11