docs: enhance how references are generated (#5805)

* adjusted configurations

* enhancements to tool and configurations

* change reference in docs

* fixed issue in workflows reference

* added project name

* more optimizations

* fix context error

* added a types reference

* resolved missing types

* fix reference reflection types not having children

* add an expand url parameter

* added new option to the README

* added details about new option
This commit is contained in:
Shahed Nasser
2023-12-05 15:29:41 +02:00
committed by GitHub
parent a418e6cebc
commit 892d737c1f
4358 changed files with 947876 additions and 534760 deletions
@@ -0,0 +1,315 @@
---
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](../../stock_location/types/stock_location.CreateStockLocationInput.mdx)",
"description": "The details of the stock location to create.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "address",
"type": "`string` \\| [StockLocationAddressInput](../../stock_location/types/stock_location.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](../../stock_location/interfaces/stock_location.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&#60;[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The created stock location's details.",
"expandable": false,
"children": [
{
"name": "address",
"type": "[StockLocationAddressDTO](../../stock_location/types/stock_location.StockLocationAddressDTO.mdx)",
"description": "The Address of the Stock Location",
"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` \\| `null`",
"description": "Stock location address' complement",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "city",
"type": "`string` \\| `null`",
"description": "Stock location address' city",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "company",
"type": "`string` \\| `null`",
"description": "Stock location company' name",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "country_code",
"type": "`string`",
"description": "Stock location address' country",
"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 address' ID",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>` \\| `null`",
"description": "An optional key-value map with additional details",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "phone",
"type": "`string` \\| `null`",
"description": "Stock location address' phone number",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "postal_code",
"type": "`string` \\| `null`",
"description": "Stock location address' postal code",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "province",
"type": "`string` \\| `null`",
"description": "Stock location address' province",
"optional": true,
"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": []
}
]
},
{
"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": []
}
]
}
]} />
@@ -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](../../stock_location/interfaces/stock_location.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&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "Resolves when the stock location is successfully deleted.",
"expandable": false,
"children": []
}
]} />
@@ -0,0 +1,234 @@
---
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](../../stock_location/interfaces/stock_location.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](../../stock_location/interfaces/stock_location.StringComparisonOperator.mdx)",
"description": "The names to filter stock locations by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "config",
"type": "[FindConfig](../../stock_location/interfaces/stock_location.FindConfig.mdx)&#60;[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)&#62;",
"description": "The configurations determining how the stock locations are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes 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`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
"optional": true,
"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": "`null` \\| `number`",
"description": "A number indicating the number of records to skip before retrieving the results.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`null` \\| `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\n`SoftDeletableEntity` class.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context",
"type": "[SharedContext](../../stock_location/interfaces/stock_location.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&#60;[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The list of stock locations.",
"expandable": false,
"children": [
{
"name": "StockLocationDTO[]",
"type": "[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "StockLocationDTO",
"type": "`object`",
"description": "Represents a Stock Location",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />
@@ -0,0 +1,233 @@
---
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](../../stock_location/interfaces/stock_location.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](../../stock_location/interfaces/stock_location.StringComparisonOperator.mdx)",
"description": "The names to filter stock locations by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "config",
"type": "[FindConfig](../../stock_location/interfaces/stock_location.FindConfig.mdx)&#60;[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)&#62;",
"description": "The configurations determining how the stock locations are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes 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`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
"optional": true,
"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": "`null` \\| `number`",
"description": "A number indicating the number of records to skip before retrieving the results.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`null` \\| `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\n`SoftDeletableEntity` class.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context",
"type": "[SharedContext](../../stock_location/interfaces/stock_location.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&#60;[[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)[], number]&#62;",
"optional": false,
"defaultValue": "",
"description": "The list of stock locations along with the total count.",
"expandable": false,
"children": [
{
"name": "StockLocationDTO[]",
"type": "[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
},
{
"name": "number",
"type": "`number`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
@@ -0,0 +1,360 @@
---
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](../../stock_location/interfaces/stock_location.FindConfig.mdx)&#60;[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)&#62;",
"description": "The configurations determining how the stock location is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes 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`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
"optional": true,
"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": "`null` \\| `number`",
"description": "A number indicating the number of records to skip before retrieving the results.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`null` \\| `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\n`SoftDeletableEntity` class.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context",
"type": "[SharedContext](../../stock_location/interfaces/stock_location.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&#60;[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The stock location's details.",
"expandable": false,
"children": [
{
"name": "address",
"type": "[StockLocationAddressDTO](../../stock_location/types/stock_location.StockLocationAddressDTO.mdx)",
"description": "The Address of the Stock Location",
"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` \\| `null`",
"description": "Stock location address' complement",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "city",
"type": "`string` \\| `null`",
"description": "Stock location address' city",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "company",
"type": "`string` \\| `null`",
"description": "Stock location company' name",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "country_code",
"type": "`string`",
"description": "Stock location address' country",
"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 address' ID",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>` \\| `null`",
"description": "An optional key-value map with additional details",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "phone",
"type": "`string` \\| `null`",
"description": "Stock location address' phone number",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "postal_code",
"type": "`string` \\| `null`",
"description": "Stock location address' postal code",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "province",
"type": "`string` \\| `null`",
"description": "Stock location address' province",
"optional": true,
"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": []
}
]
},
{
"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": []
}
]
}
]} />
@@ -0,0 +1,397 @@
---
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](../../stock_location/types/stock_location.UpdateStockLocationInput.mdx)",
"description": "The attributes to update in the stock location.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "address",
"type": "[StockLocationAddressInput](../../stock_location/types/stock_location.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](../../stock_location/interfaces/stock_location.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&#60;[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The stock location's details.",
"expandable": false,
"children": [
{
"name": "address",
"type": "[StockLocationAddressDTO](../../stock_location/types/stock_location.StockLocationAddressDTO.mdx)",
"description": "The Address of the Stock Location",
"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` \\| `null`",
"description": "Stock location address' complement",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "city",
"type": "`string` \\| `null`",
"description": "Stock location address' city",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "company",
"type": "`string` \\| `null`",
"description": "Stock location company' name",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "country_code",
"type": "`string`",
"description": "Stock location address' country",
"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 address' ID",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>` \\| `null`",
"description": "An optional key-value map with additional details",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "phone",
"type": "`string` \\| `null`",
"description": "Stock location address' phone number",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "postal_code",
"type": "`string` \\| `null`",
"description": "Stock location address' postal code",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "province",
"type": "`string` \\| `null`",
"description": "Stock location address' province",
"optional": true,
"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": []
}
]
},
{
"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": []
}
]
}
]} />