Skip to main content

Class: StoreService

Provides layer to manipulate store settings.

Hierarchy

  • TransactionBaseServiceCopy to Clipboard

    StoreServiceCopy to Clipboard

Constructors

constructor

new StoreService(__namedParametersCopy to Clipboard)

Parameters

NameType
__namedParametersCopy to ClipboardInjectedDependenciesCopy to Clipboard

Overrides

TransactionBaseService.constructor

Defined in

packages/medusa/src/services/store.ts:31

Properties

__configModule__

ProtectedCopy to Clipboard OptionalCopy to Clipboard ReadonlyCopy to Clipboard __configModule__: RecordCopy to Clipboard<stringCopy to Clipboard, unknownCopy to Clipboard>

Inherited from

TransactionBaseService.__configModule__

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:10


__container__

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard __container__: anyCopy to Clipboard

Inherited from

TransactionBaseService.__container__

Defined in

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


__moduleDeclaration__

ProtectedCopy to Clipboard OptionalCopy to Clipboard ReadonlyCopy to Clipboard __moduleDeclaration__: RecordCopy to Clipboard<stringCopy to Clipboard, unknownCopy to Clipboard>

Inherited from

TransactionBaseService.__moduleDeclaration__

Defined in

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


currencyRepository_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard currencyRepository_: typeof CurrencyRepositoryCopy to Clipboard

Defined in

packages/medusa/src/services/store.ts:28


eventBus_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard eventBus_: EventBusServiceCopy to Clipboard

Defined in

packages/medusa/src/services/store.ts:29


manager_

ProtectedCopy to Clipboard manager_: EntityManagerCopy to Clipboard

Overrides

TransactionBaseService.manager_

Defined in

packages/medusa/src/services/store.ts:24


storeRepository_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard storeRepository_: typeof StoreRepositoryCopy to Clipboard

Defined in

packages/medusa/src/services/store.ts:27


transactionManager_

ProtectedCopy to Clipboard transactionManager_: EntityManagerCopy to Clipboard

Overrides

TransactionBaseService.transactionManager_

Defined in

packages/medusa/src/services/store.ts:25

Methods

addCurrency

addCurrency(codeCopy to Clipboard): PromiseCopy to Clipboard<StoreCopy to Clipboard>

Add a currency to the store

Parameters

NameTypeDescription
codeCopy to ClipboardstringCopy to Clipboard3 character ISO currency code

Returns

PromiseCopy to Clipboard<StoreCopy to Clipboard>

result after update

Defined in

packages/medusa/src/services/store.ts:204


atomicPhase_

ProtectedCopy to Clipboard atomicPhase_<TResultCopy to Clipboard, TErrorCopy to Clipboard>(workCopy to Clipboard, isolationOrErrorHandler?Copy to Clipboard, maybeErrorHandlerOrDontFail?Copy to Clipboard): PromiseCopy to Clipboard<TResultCopy to Clipboard>

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
TResultCopy to Clipboard
TErrorCopy to Clipboard

Parameters

NameTypeDescription
workCopy to Clipboard(transactionManagerCopy to Clipboard: EntityManagerCopy to Clipboard) => PromiseCopy to Clipboard<TResultCopy to Clipboard>the transactional work to be done
isolationOrErrorHandler?Copy to ClipboardIsolationLevelCopy to Clipboard | (errorCopy to Clipboard: TErrorCopy to Clipboard) => PromiseCopy to Clipboard<voidCopy to Clipboard | TResultCopy to Clipboard>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail?Copy to Clipboard(errorCopy to Clipboard: TErrorCopy to Clipboard) => PromiseCopy to Clipboard<voidCopy to Clipboard | TResultCopy to Clipboard>Potential error handler

Returns

PromiseCopy to Clipboard<TResultCopy to Clipboard>

the result of the transactional work

Inherited from

TransactionBaseService.atomicPhase_

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:50


create

create(): PromiseCopy to Clipboard<StoreCopy to Clipboard>

Creates a store if it doesn't already exist.

Returns

PromiseCopy to Clipboard<StoreCopy to Clipboard>

The store.

Defined in

packages/medusa/src/services/store.ts:49


getDefaultCurrency_

ProtectedCopy to Clipboard getDefaultCurrency_(codeCopy to Clipboard): PartialCopy to Clipboard<CurrencyCopy to Clipboard>

Parameters

NameType
codeCopy to ClipboardstringCopy to Clipboard

Returns

PartialCopy to Clipboard<CurrencyCopy to Clipboard>

Defined in

packages/medusa/src/services/store.ts:98


removeCurrency

removeCurrency(codeCopy to Clipboard): PromiseCopy to Clipboard<anyCopy to Clipboard>

Removes a currency from the store

Parameters

NameTypeDescription
codeCopy to ClipboardstringCopy to Clipboard3 character ISO currency code

Returns

PromiseCopy to Clipboard<anyCopy to Clipboard>

result after update

Defined in

packages/medusa/src/services/store.ts:248


retrieve

retrieve(config?Copy to Clipboard): PromiseCopy to Clipboard<StoreCopy to Clipboard>

Retrieve the store settings. There is always a maximum of one store.

Parameters

NameTypeDescription
configCopy to ClipboardFindConfigCopy to Clipboard<StoreCopy to Clipboard>The config object from which the query will be built

Returns

PromiseCopy to Clipboard<StoreCopy to Clipboard>

the store

Defined in

packages/medusa/src/services/store.ts:85


shouldRetryTransaction_

ProtectedCopy to Clipboard shouldRetryTransaction_(errCopy to Clipboard): booleanCopy to Clipboard

Parameters

NameType
errCopy to ClipboardRecordCopy to Clipboard<stringCopy to Clipboard, unknownCopy to Clipboard> | { codeCopy to Clipboard: stringCopy to Clipboard }

Returns

booleanCopy to Clipboard

Inherited from

TransactionBaseService.shouldRetryTransaction_

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:31


update

update(dataCopy to Clipboard): PromiseCopy to Clipboard<StoreCopy to Clipboard>

Updates a store

Parameters

NameTypeDescription
dataCopy to ClipboardUpdateStoreInputCopy to Clipboardan object with the update values.

Returns

PromiseCopy to Clipboard<StoreCopy to Clipboard>

resolves to the update result.

Defined in

packages/medusa/src/services/store.ts:114


withTransaction

withTransaction(transactionManager?Copy to Clipboard): StoreServiceCopy to Clipboard

Parameters

NameType
transactionManager?Copy to ClipboardEntityManagerCopy to Clipboard

Returns

StoreServiceCopy to Clipboard

Inherited from

TransactionBaseService.withTransaction

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:14