docs: generate inventory and stock location references (#5645)
This commit is contained in:
+207
@@ -0,0 +1,207 @@
|
||||
---
|
||||
displayed_sidebar: stockLocationReference
|
||||
slug: /references/stock-location/create
|
||||
sidebar_label: create
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# create - Stock Location Module Reference
|
||||
|
||||
This documentation provides a reference to the `create` method. This belongs to the Stock Location Module.
|
||||
|
||||
This method is used to create a stock location.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function createStockLocation (name: string) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
const stockLocation = await stockLocationModule.create({
|
||||
name
|
||||
})
|
||||
|
||||
// do something with the stock location or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "input",
|
||||
"type": "[CreateStockLocationInput](../../types/CreateStockLocationInput.mdx)",
|
||||
"description": "The details of the stock location to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "address",
|
||||
"type": "`string` \\| [StockLocationAddressInput](../../types/StockLocationAddressInput.mdx)",
|
||||
"description": "Stock location address object",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "address_id",
|
||||
"type": "`string`",
|
||||
"description": "The Stock location address ID",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The stock location name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../interfaces/SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[StockLocationDTO](../../types/StockLocationDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The created stock location's details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "StockLocationDTO",
|
||||
"type": "`object`",
|
||||
"description": "Represents a Stock Location",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "address",
|
||||
"type": "[StockLocationAddressDTO](../../types/StockLocationAddressDTO.mdx)",
|
||||
"description": "The Address of the Stock Location",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "address_id",
|
||||
"type": "`string`",
|
||||
"description": "Stock location address' ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| ``null``",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The stock location's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| ``null``",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The name of the stock location",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
---
|
||||
displayed_sidebar: stockLocationReference
|
||||
slug: /references/stock-location/delete
|
||||
sidebar_label: delete
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# delete - Stock Location Module Reference
|
||||
|
||||
This documentation provides a reference to the `delete` method. This belongs to the Stock Location Module.
|
||||
|
||||
This method is used to delete a stock location.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function deleteStockLocation (id:string) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
await stockLocationModule.delete(id)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the stock location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../interfaces/SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the stock location is successfully deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
---
|
||||
displayed_sidebar: stockLocationReference
|
||||
slug: /references/stock-location/list
|
||||
sidebar_label: list
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# list - Stock Location Module Reference
|
||||
|
||||
This documentation provides a reference to the `list` method. This belongs to the Stock Location Module.
|
||||
|
||||
This method is used to retrieve a paginated list of stock locations based on optional filters and configuration.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of stock locations using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function listStockLocations (ids: string[]) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
const stockLocations = await stockLocationModule.list({
|
||||
id: ids
|
||||
})
|
||||
|
||||
// do something with the stock locations or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the stock locations:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function listStockLocations (ids: string[]) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
const stockLocations = await stockLocationModule.list({
|
||||
id: ids
|
||||
}, {
|
||||
relations: ["address"]
|
||||
})
|
||||
|
||||
// do something with the stock locations or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function listStockLocations (ids: string[], skip: number, take: number) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
const stockLocations = await stockLocationModule.list({
|
||||
id: ids
|
||||
}, {
|
||||
relations: ["address"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the stock locations or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[FilterableStockLocationProps](../../interfaces/FilterableStockLocationProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved stock locations.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The IDs to filter stock locations by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string` \\| `string`[] \\| [StringComparisonOperator](../../interfaces/StringComparisonOperator.mdx)",
|
||||
"description": "The names to filter stock locations by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../interfaces/FindConfig.mdx)<[StockLocationDTO](../../types/StockLocationDTO.mdx)>",
|
||||
"description": "The configurations determining how the stock locations are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a stock location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "__type",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../interfaces/SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[StockLocationDTO](../../types/StockLocationDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of stock locations.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "StockLocationDTO[]",
|
||||
"type": "[StockLocationDTO](../../types/StockLocationDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "StockLocationDTO",
|
||||
"type": "`object`",
|
||||
"description": "Represents a Stock Location",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
---
|
||||
displayed_sidebar: stockLocationReference
|
||||
slug: /references/stock-location/listAndCount
|
||||
sidebar_label: listAndCount
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listAndCount - Stock Location Module Reference
|
||||
|
||||
This documentation provides a reference to the `listAndCount` method. This belongs to the Stock Location Module.
|
||||
|
||||
This method is used to retrieve a paginated list of stock locations along with the total count of available stock locations satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of stock locations using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function listStockLocations (ids: string[]) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
const [stockLocations, count] = await stockLocationModule.listAndCount({
|
||||
id: ids
|
||||
})
|
||||
|
||||
// do something with the stock locations or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the stock locations:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function listStockLocations (ids: string[]) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
const [stockLocations, count] = await stockLocationModule.listAndCount({
|
||||
id: ids
|
||||
}, {
|
||||
relations: ["address"]
|
||||
})
|
||||
|
||||
// do something with the stock locations or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function listStockLocations (ids: string[], skip: number, take: number) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
const [stockLocations, count] = await stockLocationModule.listAndCount({
|
||||
id: ids
|
||||
}, {
|
||||
relations: ["address"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the stock locations or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[FilterableStockLocationProps](../../interfaces/FilterableStockLocationProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved stock locations.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The IDs to filter stock locations by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string` \\| `string`[] \\| [StringComparisonOperator](../../interfaces/StringComparisonOperator.mdx)",
|
||||
"description": "The names to filter stock locations by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../interfaces/FindConfig.mdx)<[StockLocationDTO](../../types/StockLocationDTO.mdx)>",
|
||||
"description": "The configurations determining how the stock locations are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a stock location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "__type",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../interfaces/SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[StockLocationDTO](../../types/StockLocationDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of stock locations along with the total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "StockLocationDTO[]",
|
||||
"type": "[StockLocationDTO](../../types/StockLocationDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+262
@@ -0,0 +1,262 @@
|
||||
---
|
||||
displayed_sidebar: stockLocationReference
|
||||
slug: /references/stock-location/retrieve
|
||||
sidebar_label: retrieve
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieve - Stock Location Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieve` method. This belongs to the Stock Location Module.
|
||||
|
||||
This method is used to retrieve a stock location by its ID
|
||||
|
||||
## Example
|
||||
|
||||
A simple example that retrieves a inventory item by its ID:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function retrieveStockLocation (id: string) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
const stockLocation = await stockLocationModule.retrieve(id)
|
||||
|
||||
// do something with the stock location or return it
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function retrieveStockLocation (id: string) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
const stockLocation = await stockLocationModule.retrieve(id, {
|
||||
relations: ["address"]
|
||||
})
|
||||
|
||||
// do something with the stock location or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the stock location",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../interfaces/FindConfig.mdx)<[StockLocationDTO](../../types/StockLocationDTO.mdx)>",
|
||||
"description": "The configurations determining how the stock location is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a stock location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "__type",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../interfaces/SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[StockLocationDTO](../../types/StockLocationDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The stock location's details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "StockLocationDTO",
|
||||
"type": "`object`",
|
||||
"description": "Represents a Stock Location",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "address",
|
||||
"type": "[StockLocationAddressDTO](../../types/StockLocationAddressDTO.mdx)",
|
||||
"description": "The Address of the Stock Location",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "address_id",
|
||||
"type": "`string`",
|
||||
"description": "Stock location address' ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| ``null``",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The stock location's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| ``null``",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The name of the stock location",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+289
@@ -0,0 +1,289 @@
|
||||
---
|
||||
displayed_sidebar: stockLocationReference
|
||||
slug: /references/stock-location/update
|
||||
sidebar_label: update
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# update - Stock Location Module Reference
|
||||
|
||||
This documentation provides a reference to the `update` method. This belongs to the Stock Location Module.
|
||||
|
||||
This method is used to update a stock location.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeStockLocationModule,
|
||||
} from "@medusajs/stock-location"
|
||||
|
||||
async function updateStockLocation (id:string, name: string) {
|
||||
const stockLocationModule = await initializeStockLocationModule({})
|
||||
|
||||
const stockLocation = await stockLocationModule.update(id, {
|
||||
name
|
||||
})
|
||||
|
||||
// do something with the stock location or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the stock location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "input",
|
||||
"type": "[UpdateStockLocationInput](../../types/UpdateStockLocationInput.mdx)",
|
||||
"description": "The attributes to update in the stock location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "address",
|
||||
"type": "[StockLocationAddressInput](../../types/StockLocationAddressInput.mdx)",
|
||||
"description": "Stock location address object",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "address_1",
|
||||
"type": "`string`",
|
||||
"description": "Stock location address",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "address_2",
|
||||
"type": "`string`",
|
||||
"description": "Stock location address' complement",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "city",
|
||||
"type": "`string`",
|
||||
"description": "Stock location address' city",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "country_code",
|
||||
"type": "`string`",
|
||||
"description": "Stock location address' country",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "phone",
|
||||
"type": "`string`",
|
||||
"description": "Stock location address' phone number",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "postal_code",
|
||||
"type": "`string`",
|
||||
"description": "Stock location address' postal code",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "province",
|
||||
"type": "`string`",
|
||||
"description": "Stock location address' province",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "address_id",
|
||||
"type": "`string`",
|
||||
"description": "The Stock location address ID",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The stock location name",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../interfaces/SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "EntityManager",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[StockLocationDTO](../../types/StockLocationDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The stock location's details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "StockLocationDTO",
|
||||
"type": "`object`",
|
||||
"description": "Represents a Stock Location",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "address",
|
||||
"type": "[StockLocationAddressDTO](../../types/StockLocationAddressDTO.mdx)",
|
||||
"description": "The Address of the Stock Location",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "address_id",
|
||||
"type": "`string`",
|
||||
"description": "Stock location address' ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| ``null``",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The stock location's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| ``null``",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The name of the stock location",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
Reference in New Issue
Block a user