Skip to main content

Class: SalesChannelService

Hierarchy

  • TransactionBaseServiceCopy to Clipboard

    SalesChannelServiceCopy to Clipboard

Constructors

constructor

new SalesChannelService(__namedParametersCopy to Clipboard)

Parameters

NameType
__namedParametersCopy to ClipboardInjectedDependenciesCopy to Clipboard

Overrides

TransactionBaseService.constructor

Defined in

packages/medusa/src/services/sales-channel.ts:37

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


eventBusService_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard eventBusService_: EventBusServiceCopy to Clipboard

Defined in

packages/medusa/src/services/sales-channel.ts:34


manager_

ProtectedCopy to Clipboard manager_: EntityManagerCopy to Clipboard

Overrides

TransactionBaseService.manager_

Defined in

packages/medusa/src/services/sales-channel.ts:30


salesChannelRepository_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard salesChannelRepository_: typeof SalesChannelRepositoryCopy to Clipboard

Defined in

packages/medusa/src/services/sales-channel.ts:33


storeService_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard storeService_: StoreServiceCopy to Clipboard

Defined in

packages/medusa/src/services/sales-channel.ts:35


transactionManager_

ProtectedCopy to Clipboard transactionManager_: undefinedCopy to Clipboard | EntityManagerCopy to Clipboard

Overrides

TransactionBaseService.transactionManager_

Defined in

packages/medusa/src/services/sales-channel.ts:31


Events

StaticCopy to Clipboard Events: ObjectCopy to Clipboard

Type declaration

NameType
CREATEDCopy to ClipboardstringCopy to Clipboard
DELETEDCopy to ClipboardstringCopy to Clipboard
UPDATEDCopy to ClipboardstringCopy to Clipboard

Defined in

packages/medusa/src/services/sales-channel.ts:24

Methods

addProducts

addProducts(salesChannelIdCopy to Clipboard, productIdsCopy to Clipboard): PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

Add a batch of product to a sales channel

Parameters

NameTypeDescription
salesChannelIdCopy to ClipboardstringCopy to ClipboardThe id of the sales channel on which to add the products
productIdsCopy to ClipboardstringCopy to Clipboard[]The products ids to attach to the sales channel

Returns

PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

the sales channel on which the products have been added

Defined in

packages/medusa/src/services/sales-channel.ts:344


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(dataCopy to Clipboard): PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

Creates a SalesChannel

This feature is under development and may change in the future. To use this feature please enable the corresponding feature flag in your medusa backend project.

Parameters

NameType
dataCopy to ClipboardCreateSalesChannelInputCopy to Clipboard

Returns

PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

the created channel

Defined in

packages/medusa/src/services/sales-channel.ts:180


createDefault

createDefault(): PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

Creates a default sales channel, if this does not already exist.

Returns

PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

the sales channel

Defined in

packages/medusa/src/services/sales-channel.ts:270


delete

delete(salesChannelIdCopy to Clipboard): PromiseCopy to Clipboard<voidCopy to Clipboard>

Deletes a sales channel from This feature is under development and may change in the future. To use this feature please enable the corresponding feature flag in your medusa backend project.

Parameters

NameTypeDescription
salesChannelIdCopy to ClipboardstringCopy to Clipboardthe id of the sales channel to delete

Returns

PromiseCopy to Clipboard<voidCopy to Clipboard>

Defined in

packages/medusa/src/services/sales-channel.ts:231


getManager

PrivateCopy to Clipboard getManager(): EntityManagerCopy to Clipboard

Returns

EntityManagerCopy to Clipboard

Defined in

packages/medusa/src/services/sales-channel.ts:52


listAndCount

listAndCount(selectorCopy to Clipboard, config?Copy to Clipboard): PromiseCopy to Clipboard<[SalesChannelCopy to Clipboard[], numberCopy to Clipboard]>

Lists sales channels based on the provided parameters and includes the count of sales channels that match the query.

Parameters

NameType
selectorCopy to ClipboardQuerySelectorCopy to Clipboard<SalesChannelCopy to Clipboard>
configCopy to ClipboardFindConfigCopy to Clipboard<SalesChannelCopy to Clipboard>

Returns

PromiseCopy to Clipboard<[SalesChannelCopy to Clipboard[], numberCopy to Clipboard]>

an array containing the sales channels as the first element and the total count of sales channels that matches the query as the second element.

Defined in

packages/medusa/src/services/sales-channel.ts:145


removeProducts

removeProducts(salesChannelIdCopy to Clipboard, productIdsCopy to Clipboard): PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

Remove a batch of product from a sales channel

Parameters

NameTypeDescription
salesChannelIdCopy to ClipboardstringCopy to ClipboardThe id of the sales channel on which to remove the products
productIdsCopy to ClipboardstringCopy to Clipboard[]The products ids to remove from the sales channel

Returns

PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

the sales channel on which the products have been removed

Defined in

packages/medusa/src/services/sales-channel.ts:323


retrieve

retrieve(salesChannelIdCopy to Clipboard, config?Copy to Clipboard): PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

Retrieve a SalesChannel by id

Parameters

NameTypeDescription
salesChannelIdCopy to ClipboardstringCopy to Clipboardid of the channel to retrieve
configCopy to ClipboardFindConfigCopy to Clipboard<SalesChannelCopy to Clipboard>SC config This feature is under development and may change in the future. To use this feature please enable the corresponding feature flag in your medusa backend project.

Returns

PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

a sales channel

Defined in

packages/medusa/src/services/sales-channel.ts:103


retrieveByName

retrieveByName(nameCopy to Clipboard, config?Copy to Clipboard): PromiseCopy to Clipboard<unknownCopy to Clipboard>

Find a sales channel by name.

Parameters

NameTypeDescription
nameCopy to ClipboardstringCopy to Clipboardof the sales channel
configCopy to ClipboardFindConfigCopy to Clipboard<SalesChannelCopy to Clipboard>find config

Returns

PromiseCopy to Clipboard<unknownCopy to Clipboard>

a sales channel with matching name

Defined in

packages/medusa/src/services/sales-channel.ts:124


retrieveDefault

retrieveDefault(): PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

Retrieves the default sales channel.

Returns

PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

the sales channel

Defined in

packages/medusa/src/services/sales-channel.ts:300


retrieve_

ProtectedCopy to Clipboard retrieve_(selectorCopy to Clipboard, config?Copy to Clipboard): PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

A generic retrieve used to find a sales channel by different attributes.

Parameters

NameTypeDescription
selectorCopy to ClipboardSelectorCopy to Clipboard<SalesChannelCopy to Clipboard>SC selector
configCopy to ClipboardFindConfigCopy to Clipboard<SalesChannelCopy to Clipboard>find config

Returns

PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

a single SC matching the query or throws

Defined in

packages/medusa/src/services/sales-channel.ts:63


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(salesChannelIdCopy to Clipboard, dataCopy to Clipboard): PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

Parameters

NameType
salesChannelIdCopy to ClipboardstringCopy to Clipboard
dataCopy to ClipboardPartialCopy to Clipboard<CreateSalesChannelInputCopy to Clipboard>

Returns

PromiseCopy to Clipboard<SalesChannelCopy to Clipboard>

Defined in

packages/medusa/src/services/sales-channel.ts:197


withTransaction

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

Parameters

NameType
transactionManager?Copy to ClipboardEntityManagerCopy to Clipboard

Returns

SalesChannelServiceCopy to Clipboard

Inherited from

TransactionBaseService.withTransaction

Defined in

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