Class: SalesChannelService
Hierarchy
TransactionBaseService
Copy to Clipboard↳
SalesChannelService
Copy to Clipboard
Constructors
constructor
• new SalesChannelService(__namedParameters
Copy to Clipboard)
Parameters
Name | Type |
---|---|
__namedParameters Copy to Clipboard | InjectedDependencies Copy to Clipboard |
Overrides
TransactionBaseService.constructor
Defined in
packages/medusa/src/services/sales-channel.ts:37
Properties
__configModule__
• Protected
Copy to Clipboard Optional
Copy to Clipboard Readonly
Copy to Clipboard __configModule__: Record
Copy to Clipboard<string
Copy to Clipboard, unknown
Copy to Clipboard>
Inherited from
TransactionBaseService.__configModule__
Defined in
packages/medusa/src/interfaces/transaction-base-service.ts:10
__container__
• Protected
Copy to Clipboard Readonly
Copy to Clipboard __container__: any
Copy to Clipboard
Inherited from
TransactionBaseService.__container__
Defined in
packages/medusa/src/interfaces/transaction-base-service.ts:9
__moduleDeclaration__
• Protected
Copy to Clipboard Optional
Copy to Clipboard Readonly
Copy to Clipboard __moduleDeclaration__: Record
Copy to Clipboard<string
Copy to Clipboard, unknown
Copy to Clipboard>
Inherited from
TransactionBaseService.__moduleDeclaration__
Defined in
packages/medusa/src/interfaces/transaction-base-service.ts:11
eventBusService_
• Protected
Copy to Clipboard Readonly
Copy to Clipboard eventBusService_: EventBusService
Copy to Clipboard
Defined in
packages/medusa/src/services/sales-channel.ts:34
manager_
• Protected
Copy to Clipboard manager_: EntityManager
Copy to Clipboard
Overrides
TransactionBaseService.manager_
Defined in
packages/medusa/src/services/sales-channel.ts:30
salesChannelRepository_
• Protected
Copy to Clipboard Readonly
Copy to Clipboard salesChannelRepository_: typeof SalesChannelRepository
Copy to Clipboard
Defined in
packages/medusa/src/services/sales-channel.ts:33
storeService_
• Protected
Copy to Clipboard Readonly
Copy to Clipboard storeService_: StoreService
Copy to Clipboard
Defined in
packages/medusa/src/services/sales-channel.ts:35
transactionManager_
• Protected
Copy to Clipboard transactionManager_: undefined
Copy to Clipboard | EntityManager
Copy to Clipboard
Overrides
TransactionBaseService.transactionManager_
Defined in
packages/medusa/src/services/sales-channel.ts:31
Events
▪ Static
Copy to Clipboard Events: Object
Copy to Clipboard
Type declaration
Name | Type |
---|---|
CREATED Copy to Clipboard | string Copy to Clipboard |
DELETED Copy to Clipboard | string Copy to Clipboard |
UPDATED Copy to Clipboard | string Copy to Clipboard |
Defined in
packages/medusa/src/services/sales-channel.ts:24
Methods
addProducts
▸ addProducts(salesChannelId
Copy to Clipboard, productIds
Copy to Clipboard): Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
Add a batch of product to a sales channel
Parameters
Name | Type | Description |
---|---|---|
salesChannelId Copy to Clipboard | string Copy to Clipboard | The id of the sales channel on which to add the products |
productIds Copy to Clipboard | string Copy to Clipboard[] | The products ids to attach to the sales channel |
Returns
Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
the sales channel on which the products have been added
Defined in
packages/medusa/src/services/sales-channel.ts:344
atomicPhase_
▸ Protected
Copy to Clipboard atomicPhase_<TResult
Copy to Clipboard, TError
Copy to Clipboard>(work
Copy to Clipboard, isolationOrErrorHandler?
Copy to Clipboard, maybeErrorHandlerOrDontFail?
Copy to Clipboard): Promise
Copy to Clipboard<TResult
Copy 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 |
---|
TResult Copy to Clipboard |
TError Copy to Clipboard |
Parameters
Name | Type | Description |
---|---|---|
work Copy to Clipboard | (transactionManager Copy to Clipboard: EntityManager Copy to Clipboard) => Promise Copy to Clipboard<TResult Copy to Clipboard> | the transactional work to be done |
isolationOrErrorHandler? Copy to Clipboard | IsolationLevel Copy to Clipboard | (error Copy to Clipboard: TError Copy to Clipboard) => Promise Copy to Clipboard<void Copy to Clipboard | TResult Copy to Clipboard> | the isolation level to be used for the work. |
maybeErrorHandlerOrDontFail? Copy to Clipboard | (error Copy to Clipboard: TError Copy to Clipboard) => Promise Copy to Clipboard<void Copy to Clipboard | TResult Copy to Clipboard> | Potential error handler |
Returns
Promise
Copy to Clipboard<TResult
Copy 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(data
Copy to Clipboard): Promise
Copy to Clipboard<SalesChannel
Copy 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
Name | Type |
---|---|
data Copy to Clipboard | CreateSalesChannelInput Copy to Clipboard |
Returns
Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
the created channel
Defined in
packages/medusa/src/services/sales-channel.ts:180
createDefault
▸ createDefault(): Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
Creates a default sales channel, if this does not already exist.
Returns
Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
the sales channel
Defined in
packages/medusa/src/services/sales-channel.ts:270
delete
▸ delete(salesChannelId
Copy to Clipboard): Promise
Copy to Clipboard<void
Copy 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
Name | Type | Description |
---|---|---|
salesChannelId Copy to Clipboard | string Copy to Clipboard | the id of the sales channel to delete |
Returns
Promise
Copy to Clipboard<void
Copy to Clipboard>
Defined in
packages/medusa/src/services/sales-channel.ts:231
getManager
▸ Private
Copy to Clipboard getManager(): EntityManager
Copy to Clipboard
Returns
EntityManager
Copy to Clipboard
Defined in
packages/medusa/src/services/sales-channel.ts:52
listAndCount
▸ listAndCount(selector
Copy to Clipboard, config?
Copy to Clipboard): Promise
Copy to Clipboard<[SalesChannel
Copy to Clipboard[], number
Copy to Clipboard]>
Lists sales channels based on the provided parameters and includes the count of sales channels that match the query.
Parameters
Name | Type |
---|---|
selector Copy to Clipboard | QuerySelector Copy to Clipboard<SalesChannel Copy to Clipboard> |
config Copy to Clipboard | FindConfig Copy to Clipboard<SalesChannel Copy to Clipboard> |
Returns
Promise
Copy to Clipboard<[SalesChannel
Copy to Clipboard[], number
Copy 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(salesChannelId
Copy to Clipboard, productIds
Copy to Clipboard): Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
Remove a batch of product from a sales channel
Parameters
Name | Type | Description |
---|---|---|
salesChannelId Copy to Clipboard | string Copy to Clipboard | The id of the sales channel on which to remove the products |
productIds Copy to Clipboard | string Copy to Clipboard[] | The products ids to remove from the sales channel |
Returns
Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
the sales channel on which the products have been removed
Defined in
packages/medusa/src/services/sales-channel.ts:323
retrieve
▸ retrieve(salesChannelId
Copy to Clipboard, config?
Copy to Clipboard): Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
Retrieve a SalesChannel by id
Parameters
Name | Type | Description |
---|---|---|
salesChannelId Copy to Clipboard | string Copy to Clipboard | id of the channel to retrieve |
config Copy to Clipboard | FindConfig Copy to Clipboard<SalesChannel Copy 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
Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
a sales channel
Defined in
packages/medusa/src/services/sales-channel.ts:103
retrieveByName
▸ retrieveByName(name
Copy to Clipboard, config?
Copy to Clipboard): Promise
Copy to Clipboard<unknown
Copy to Clipboard>
Find a sales channel by name.
Parameters
Name | Type | Description |
---|---|---|
name Copy to Clipboard | string Copy to Clipboard | of the sales channel |
config Copy to Clipboard | FindConfig Copy to Clipboard<SalesChannel Copy to Clipboard> | find config |
Returns
Promise
Copy to Clipboard<unknown
Copy to Clipboard>
a sales channel with matching name
Defined in
packages/medusa/src/services/sales-channel.ts:124
retrieveDefault
▸ retrieveDefault(): Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
Retrieves the default sales channel.
Returns
Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
the sales channel
Defined in
packages/medusa/src/services/sales-channel.ts:300
retrieve_
▸ Protected
Copy to Clipboard retrieve_(selector
Copy to Clipboard, config?
Copy to Clipboard): Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
A generic retrieve used to find a sales channel by different attributes.
Parameters
Name | Type | Description |
---|---|---|
selector Copy to Clipboard | Selector Copy to Clipboard<SalesChannel Copy to Clipboard> | SC selector |
config Copy to Clipboard | FindConfig Copy to Clipboard<SalesChannel Copy to Clipboard> | find config |
Returns
Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
a single SC matching the query or throws
Defined in
packages/medusa/src/services/sales-channel.ts:63
shouldRetryTransaction_
▸ Protected
Copy to Clipboard shouldRetryTransaction_(err
Copy to Clipboard): boolean
Copy to Clipboard
Parameters
Name | Type |
---|---|
err Copy to Clipboard | Record Copy to Clipboard<string Copy to Clipboard, unknown Copy to Clipboard> | { code Copy to Clipboard: string Copy to Clipboard } |
Returns
boolean
Copy to Clipboard
Inherited from
TransactionBaseService.shouldRetryTransaction_
Defined in
packages/medusa/src/interfaces/transaction-base-service.ts:31
update
▸ update(salesChannelId
Copy to Clipboard, data
Copy to Clipboard): Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
Parameters
Name | Type |
---|---|
salesChannelId Copy to Clipboard | string Copy to Clipboard |
data Copy to Clipboard | Partial Copy to Clipboard<CreateSalesChannelInput Copy to Clipboard> |
Returns
Promise
Copy to Clipboard<SalesChannel
Copy to Clipboard>
Defined in
packages/medusa/src/services/sales-channel.ts:197
withTransaction
▸ withTransaction(transactionManager?
Copy to Clipboard): SalesChannelService
Copy to Clipboard
Parameters
Name | Type |
---|---|
transactionManager? Copy to Clipboard | EntityManager Copy to Clipboard |
Returns
SalesChannelService
Copy to Clipboard
Inherited from
TransactionBaseService.withTransaction
Defined in
packages/medusa/src/interfaces/transaction-base-service.ts:14