Skip to main content
Skip to main content

StoreService

Provides layer to manipulate store settings.

constructor

Parameters

__namedParametersInjectedDependenciesRequired

Properties

manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired
__container__anyRequired
storeRepository_Repository<Store>Required
currencyRepository_Repository<Currency>Required
eventBus_EventBusServiceRequired
__configModule__Record<string, unknown>
__moduleDeclaration__Record<string, unknown>

Accessors

activeManager_

Returns

EntityManagerEntityManagerRequired

Methods

withTransaction

Parameters

transactionManagerEntityManager

Returns

thisthisRequired

shouldRetryTransaction_

Parameters

errRecord<string, unknown> | objectRequired

Returns

booleanbooleanRequired

atomicPhase_

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

TResultobjectRequired
TErrorobjectRequired

Parameters

work(transactionManager: EntityManager) => Promise<TResult>Required
the transactional work to be done
isolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>
the isolation level to be used for the work.
maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>
Potential error handler

Returns

PromisePromise<TResult>Required
the result of the transactional work

create

Creates a store if it doesn't already exist.

Returns

PromisePromise<Store>Required
The store.

retrieve

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

Parameters

configFindConfig<Store>Required
The config object from which the query will be built

Default: {}

Returns

PromisePromise<Store>Required
the store

getDefaultCurrency_

Parameters

codestringRequired

Returns

PartialPartial<Currency>Required

update

Updates a store

Parameters

dataUpdateStoreInputRequired
an object with the update values.

Returns

PromisePromise<Store>Required
resolves to the update result.

addCurrency

Add a currency to the store

Parameters

codestringRequired
3 character ISO currency code

Returns

PromisePromise<Store>Required
result after update

removeCurrency

Removes a currency from the store

Parameters

codestringRequired
3 character ISO currency code

Returns

PromisePromise<any>Required
result after update
Was this section helpful?