docs: updated services reference (#1809)
This commit is contained in:
@@ -4,7 +4,7 @@ Provides layer to manipulate store settings.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
- `TransactionBaseService`<[`StoreService`](StoreService.md)\>
|
||||
|
||||
↳ **`StoreService`**
|
||||
|
||||
@@ -18,21 +18,99 @@ Provides layer to manipulate store settings.
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `__namedParameters` | `Object` |
|
||||
| `__namedParameters` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
BaseService.constructor
|
||||
TransactionBaseService<StoreService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.js:10](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/store.js#L10)
|
||||
[services/store.ts:33](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L33)
|
||||
|
||||
## Properties
|
||||
|
||||
### configModule
|
||||
|
||||
• `Protected` `Optional` `Readonly` **configModule**: `Record`<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.configModule
|
||||
|
||||
___
|
||||
|
||||
### container
|
||||
|
||||
• `Protected` `Readonly` **container**: `unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.container
|
||||
|
||||
___
|
||||
|
||||
### currencyRepository\_
|
||||
|
||||
• `Protected` `Readonly` **currencyRepository\_**: typeof `CurrencyRepository`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:30](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
### eventBus\_
|
||||
|
||||
• `Protected` `Readonly` **eventBus\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:31](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
• `Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:26](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
### storeRepository\_
|
||||
|
||||
• `Protected` `Readonly` **storeRepository\_**: typeof `StoreRepository`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:29](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
• `Protected` **transactionManager\_**: `EntityManager`
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:27](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L27)
|
||||
|
||||
## Methods
|
||||
|
||||
### addCurrency
|
||||
|
||||
▸ **addCurrency**(`code`): `Promise`<`any`\>
|
||||
▸ **addCurrency**(`code`): `Promise`<`Store`\>
|
||||
|
||||
Add a currency to the store
|
||||
|
||||
@@ -44,13 +122,52 @@ Add a currency to the store
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
`Promise`<`Store`\>
|
||||
|
||||
result after update
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.js:203](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/store.js#L203)
|
||||
[services/store.ts:219](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L219)
|
||||
|
||||
___
|
||||
|
||||
### 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
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -64,64 +181,31 @@ Creates a store if it doesn't already exist.
|
||||
|
||||
`Promise`<`Store`\>
|
||||
|
||||
the store.
|
||||
The store.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.js:52](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/store.js#L52)
|
||||
|
||||
___
|
||||
|
||||
### decorate
|
||||
|
||||
▸ **decorate**(`store`, `fields`, `expandFields?`): `Store`
|
||||
|
||||
Decorates a store object.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `store` | `Store` | `undefined` | the store to decorate. |
|
||||
| `fields` | `string`[] | `undefined` | the fields to include. |
|
||||
| `expandFields` | `string`[] | `[]` | fields to expand. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Store`
|
||||
|
||||
return the decorated Store.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.js:266](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/store.js#L266)
|
||||
[services/store.ts:56](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### getDefaultCurrency\_
|
||||
|
||||
▸ **getDefaultCurrency_**(`code`): `Object`
|
||||
▸ `Protected` **getDefaultCurrency_**(`code`): `Partial`<`Currency`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `code` | `any` |
|
||||
| `code` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `code` | `any` |
|
||||
| `name` | `any` |
|
||||
| `symbol` | `any` |
|
||||
| `symbol_native` | `any` |
|
||||
`Partial`<`Currency`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.js:92](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/store.js#L92)
|
||||
[services/store.ts:113](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L113)
|
||||
|
||||
___
|
||||
|
||||
@@ -145,21 +229,21 @@ result after update
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.js:242](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/store.js#L242)
|
||||
[services/store.ts:263](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L263)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
▸ **retrieve**(`relations?`): `Promise`<`Store`\>
|
||||
▸ **retrieve**(`config?`): `Promise`<`Store`\>
|
||||
|
||||
Retrieve the store settings. There is always a maximum of one store.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `relations` | `string`[] | `[]` | relations to fetch with store |
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `config` | `FindConfig`<`Store`\> | The config object from which the query will be built |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -169,13 +253,37 @@ the store
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.js:84](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/store.js#L84)
|
||||
[services/store.ts:92](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L92)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
▸ `Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `err` | `Record`<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
▸ **update**(`update`): `Promise`<`any`\>
|
||||
▸ **update**(`data`): `Promise`<`Store`\>
|
||||
|
||||
Updates a store
|
||||
|
||||
@@ -183,34 +291,38 @@ Updates a store
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `update` | `any` | an object with the update values. |
|
||||
| `data` | `UpdateStoreInput` | an object with the update values. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
`Promise`<`Store`\>
|
||||
|
||||
resolves to the update result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.js:108](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/store.js#L108)
|
||||
[services/store.ts:129](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L129)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
▸ **withTransaction**(`transactionManager`): [`StoreService`](StoreService.md)
|
||||
▸ **withTransaction**(`transactionManager?`): [`StoreService`](StoreService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `transactionManager` | `any` |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`StoreService`](StoreService.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.js:31](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/store.js#L31)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
|
||||
Reference in New Issue
Block a user