201 lines
4.7 KiB
Markdown
201 lines
4.7 KiB
Markdown
# Class: StrategyResolverService
|
|
|
|
## Hierarchy
|
|
|
|
- `TransactionBaseService`
|
|
|
|
↳ **`StrategyResolverService`**
|
|
|
|
## Constructors
|
|
|
|
### constructor
|
|
|
|
• **new StrategyResolverService**(`container`)
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type |
|
|
| :------ | :------ |
|
|
| `container` | `InjectedDependencies` |
|
|
|
|
#### Overrides
|
|
|
|
TransactionBaseService.constructor
|
|
|
|
#### Defined in
|
|
|
|
[packages/medusa/src/services/strategy-resolver.ts:14](https://github.com/medusajs/medusa/blob/70139d0bb/packages/medusa/src/services/strategy-resolver.ts#L14)
|
|
|
|
## Properties
|
|
|
|
### \_\_configModule\_\_
|
|
|
|
• `Protected` `Optional` `Readonly` **\_\_configModule\_\_**: `Record`<`string`, `unknown`\>
|
|
|
|
#### Inherited from
|
|
|
|
TransactionBaseService.\_\_configModule\_\_
|
|
|
|
#### Defined in
|
|
|
|
[packages/medusa/src/interfaces/transaction-base-service.ts:10](https://github.com/medusajs/medusa/blob/70139d0bb/packages/medusa/src/interfaces/transaction-base-service.ts#L10)
|
|
|
|
___
|
|
|
|
### \_\_container\_\_
|
|
|
|
• `Protected` `Readonly` **\_\_container\_\_**: `any`
|
|
|
|
#### Inherited from
|
|
|
|
TransactionBaseService.\_\_container\_\_
|
|
|
|
#### Defined in
|
|
|
|
[packages/medusa/src/interfaces/transaction-base-service.ts:9](https://github.com/medusajs/medusa/blob/70139d0bb/packages/medusa/src/interfaces/transaction-base-service.ts#L9)
|
|
|
|
___
|
|
|
|
### container
|
|
|
|
• `Protected` `Readonly` **container**: `InjectedDependencies`
|
|
|
|
#### Defined in
|
|
|
|
[packages/medusa/src/services/strategy-resolver.ts:14](https://github.com/medusajs/medusa/blob/70139d0bb/packages/medusa/src/services/strategy-resolver.ts#L14)
|
|
|
|
___
|
|
|
|
### manager\_
|
|
|
|
• `Protected` **manager\_**: `EntityManager`
|
|
|
|
#### Overrides
|
|
|
|
TransactionBaseService.manager\_
|
|
|
|
#### Defined in
|
|
|
|
[packages/medusa/src/services/strategy-resolver.ts:11](https://github.com/medusajs/medusa/blob/70139d0bb/packages/medusa/src/services/strategy-resolver.ts#L11)
|
|
|
|
___
|
|
|
|
### transactionManager\_
|
|
|
|
• `Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
|
|
|
#### Overrides
|
|
|
|
TransactionBaseService.transactionManager\_
|
|
|
|
#### Defined in
|
|
|
|
[packages/medusa/src/services/strategy-resolver.ts:12](https://github.com/medusajs/medusa/blob/70139d0bb/packages/medusa/src/services/strategy-resolver.ts#L12)
|
|
|
|
## 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
|
|
|
|
#### Inherited from
|
|
|
|
TransactionBaseService.atomicPhase\_
|
|
|
|
#### Defined in
|
|
|
|
[packages/medusa/src/interfaces/transaction-base-service.ts:50](https://github.com/medusajs/medusa/blob/70139d0bb/packages/medusa/src/interfaces/transaction-base-service.ts#L50)
|
|
|
|
___
|
|
|
|
### resolveBatchJobByType
|
|
|
|
▸ **resolveBatchJobByType**(`type`): `AbstractBatchJobStrategy`
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type |
|
|
| :------ | :------ |
|
|
| `type` | `string` |
|
|
|
|
#### Returns
|
|
|
|
`AbstractBatchJobStrategy`
|
|
|
|
#### Defined in
|
|
|
|
[packages/medusa/src/services/strategy-resolver.ts:19](https://github.com/medusajs/medusa/blob/70139d0bb/packages/medusa/src/services/strategy-resolver.ts#L19)
|
|
|
|
___
|
|
|
|
### shouldRetryTransaction\_
|
|
|
|
▸ `Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type |
|
|
| :------ | :------ |
|
|
| `err` | `Record`<`string`, `unknown`\> \| { `code`: `string` } |
|
|
|
|
#### Returns
|
|
|
|
`boolean`
|
|
|
|
#### Inherited from
|
|
|
|
TransactionBaseService.shouldRetryTransaction\_
|
|
|
|
#### Defined in
|
|
|
|
[packages/medusa/src/interfaces/transaction-base-service.ts:31](https://github.com/medusajs/medusa/blob/70139d0bb/packages/medusa/src/interfaces/transaction-base-service.ts#L31)
|
|
|
|
___
|
|
|
|
### withTransaction
|
|
|
|
▸ **withTransaction**(`transactionManager?`): [`StrategyResolverService`](StrategyResolverService.md)
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type |
|
|
| :------ | :------ |
|
|
| `transactionManager?` | `EntityManager` |
|
|
|
|
#### Returns
|
|
|
|
[`StrategyResolverService`](StrategyResolverService.md)
|
|
|
|
#### Inherited from
|
|
|
|
TransactionBaseService.withTransaction
|
|
|
|
#### Defined in
|
|
|
|
[packages/medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/70139d0bb/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|