docs: generate medusa-react reference (#6004)

* add new plugin for better organization

* added handling in theme for mutations and query types

* added tsdoc to hooks

* added tsdocs to utility functions

* added tsdoc to providers

* generated reference

* general fixes for generated reference

* generated api reference specs + general fixes

* add missing import react

* split utilities into different directories

* added overview page

* added link to customer authentication section

* fix lint errors

* added changeset

* fix readme

* fixed build error

* added expand fields + other sections to overview

* updated what's new section

* general refactoring

* remove unnecessary query field

* fix links

* added ignoreApi option
This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-01-05 17:03:38 +02:00
1 parent 6fc6a9de6a
commit 7d650771d1
2811 files changed
+231856 -455063

No files matched your search

@@ -295,7 +295,7 @@ For example, this creates a batch job of the type `publish-products`:
<Tabs groupId="request-types" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
```jsx
```ts
medusa.admin.batchJobs.create({
type: "publish-products",
context: { },
@@ -306,10 +306,38 @@ For example, this creates a batch job of the type `publish-products`:
})
```
</TabItem>
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminCreateBatchJob } from "medusa-react"
const CreateBatchJob = () => {
const createBatchJob = useAdminCreateBatchJob()
// ...
const handleCreateBatchJob = () => {
createBatchJob.mutate({
type: "publish-products",
context: {},
dry_run: true
}, {
onSuccess: ({ batch_job }) => {
console.log(batch_job)
}
})
}
// ...
}
export default CreateBatchJob
```
</TabItem>
<TabItem value="fetch" label="Fetch API">
```jsx
```ts
fetch(`<BACKEND_URL>/admin/batch-jobs`, {
method: "POST",
credentials: "include",
@@ -356,17 +384,41 @@ You can retrieve the batch job afterward to get its status and view details abou
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
```jsx
```ts
medusa.admin.batchJobs.retrieve(batchJobId)
.then(( batch_job ) => {
console.log(batch_job.status, batch_job.result)
})
```
</TabItem>
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminBatchJob } from "medusa-react"
type Props = {
batchJobId: string
}
const BatchJob = ({ batchJobId }: Props) => {
const { batch_job, isLoading } = useAdminBatchJob(batchJobId)
return (
<div>
{isLoading && <span>Loading...</span>}
{batch_job && <span>{batch_job.created_by}</span>}
</div>
)
}
export default BatchJob
```
</TabItem>
<TabItem value="fetch" label="Fetch API">
```jsx
```ts
fetch(`<BACKEND_URL>/admin/batch-jobs/${batchJobId}`, {
credentials: "include",
})
@@ -411,17 +463,45 @@ To process the batch job, send a request to [confirm the batch job](https://docs
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
```jsx
```ts
medusa.admin.batchJobs.confirm(batchJobId)
.then(( batch_job ) => {
console.log(batch_job.status)
})
```
</TabItem>
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminConfirmBatchJob } from "medusa-react"
type Props = {
batchJobId: string
}
const BatchJob = ({ batchJobId }: Props) => {
const confirmBatchJob = useAdminConfirmBatchJob(batchJobId)
// ...
const handleConfirm = () => {
confirmBatchJob.mutate(undefined, {
onSuccess: ({ batch_job }) => {
console.log(batch_job)
}
})
}
// ...
}
export default BatchJob
```
</TabItem>
<TabItem value="fetch" label="Fetch API">
```jsx
```ts
fetch(`<BACKEND_URL>/admin/batch-jobs/${batchJobId}/confirm`, {
method: "POST",
credentials: "include",
@@ -179,6 +179,10 @@ You can create a publishable API key by sending a request to the [Create Publish
const handleCreate = (title: string) => {
createKey.mutate({
title,
}, {
onSuccess: ({ publishable_api_key }) => {
console.log(publishable_api_key.id)
}
})
}
@@ -249,9 +253,15 @@ You can update a publishable API key’s details by sending a request to the [Up
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminUpdatePublishableApiKey } from "medusa-react"
import { useAdminUpdatePublishableApiKey } from "medusa-react"
const UpdatePublishableApiKey = () => {
type Props = {
publishableApiKeyId: string
}
const PublishableApiKey = ({
publishableApiKeyId
}: Props) => {
const updateKey = useAdminUpdatePublishableApiKey(
publishableApiKeyId
)
@@ -260,13 +270,17 @@ You can update a publishable API key’s details by sending a request to the [Up
const handleUpdate = (title: string) => {
updateKey.mutate({
title,
}, {
onSuccess: ({ publishable_api_key }) => {
console.log(publishable_api_key.id)
}
})
}
// ...
}
export default UpdatePublishableApiKey
export default PublishableApiKey
```
</TabItem>
@@ -334,14 +348,24 @@ You can revoke a publishable API key by sending a request to the [Revoke Publish
```tsx
import { useAdminRevokePublishableApiKey } from "medusa-react"
const PublishableApiKey = () => {
type Props = {
publishableApiKeyId: string
}
const PublishableApiKey = ({
publishableApiKeyId
}: Props) => {
const revokeKey = useAdminRevokePublishableApiKey(
publishableApiKeyId
)
// ...
const handleRevoke = () => {
revokeKey.mutate()
revokeKey.mutate(void 0, {
onSuccess: ({ publishable_api_key }) => {
console.log(publishable_api_key.revoked_at)
}
})
}
// ...
@@ -404,14 +428,24 @@ You can delete a publishable API key by sending a request to the [Delete Publish
```tsx
import { useAdminDeletePublishableApiKey } from "medusa-react"
const PublishableApiKey = () => {
type Props = {
publishableApiKeyId: string
}
const PublishableApiKey = ({
publishableApiKeyId
}: Props) => {
const deleteKey = useAdminDeletePublishableApiKey(
publishableApiKeyId
)
// ...
const handleDelete = () => {
deleteKey.mutate()
deleteKey.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
@@ -480,12 +514,17 @@ You can retrieve the list of sales channels associated with a publishable API ke
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { SalesChannel } from "@medusajs/medusa"
import {
useAdminPublishableApiKeySalesChannels,
} from "medusa-react"
const SalesChannels = () => {
type Props = {
publishableApiKeyId: string
}
const SalesChannels = ({
publishableApiKeyId
}: Props) => {
const { sales_channels, isLoading } =
useAdminPublishableApiKeySalesChannels(
publishableApiKeyId
@@ -499,7 +538,7 @@ You can retrieve the list of sales channels associated with a publishable API ke
)}
{sales_channels && sales_channels.length > 0 && (
<ul>
{sales_channels.map((salesChannel: SalesChannel) => (
{sales_channels.map((salesChannel) => (
<li key={salesChannel.id}>{salesChannel.name}</li>
))}
</ul>
@@ -575,7 +614,13 @@ You can add a sales channel to a publishable API key by sending a request to the
useAdminAddPublishableKeySalesChannelsBatch,
} from "medusa-react"
const PublishableApiKey = () => {
type Props = {
publishableApiKeyId: string
}
const PublishableApiKey = ({
publishableApiKeyId
}: Props) => {
const addSalesChannels =
useAdminAddPublishableKeySalesChannelsBatch(
publishableApiKeyId
@@ -589,6 +634,10 @@ You can add a sales channel to a publishable API key by sending a request to the
id: salesChannelId,
},
],
}, {
onSuccess: ({ publishable_api_key }) => {
console.log(publishable_api_key.id)
}
})
}
@@ -685,13 +734,19 @@ You can delete a sales channel from a publishable API key by sending a request t
useAdminRemovePublishableKeySalesChannelsBatch,
} from "medusa-react"
const PublishableApiKey = () => {
type Props = {
publishableApiKeyId: string
}
const PublishableApiKey = ({
publishableApiKeyId
}: Props) => {
const deleteSalesChannels =
useAdminRemovePublishableKeySalesChannelsBatch(
publishableApiKeyId
)
// ...
const handleDelete = (salesChannelId: string) => {
deleteSalesChannels.mutate({
sales_channel_ids: [
@@ -699,12 +754,16 @@ You can delete a sales channel from a publishable API key by sending a request t
id: salesChannelId,
},
],
}, {
onSuccess: ({ publishable_api_key }) => {
console.log(publishable_api_key.id)
}
})
}
// ...
}
export default PublishableApiKey
```
+20 -24
View File
@@ -160,35 +160,31 @@ Medusa provides the essential building blocks that developers can put together t
Learn about all the new features and enhancements in Medusa.
<DocCardList colSize={4} items={[
{
type: 'link',
href: '/medusa-react/overview',
label: 'Medusa React reference',
customProps: {
icon: Icons['react'],
description: 'Explore all hooks, providers, and utilities of Medusa React.',
}
},
{
type: 'link',
href: '/development/events/create-subscriber',
label: 'Subscribers',
customProps: {
icon: Icons['cog-six-tooth-solid'],
description: 'Create subscribers with an improved developer experienece.',
}
},
{
type: 'link',
href: '/development/api-routes/create',
label: 'API Routes',
customProps: {
icon: Icons['computer-desktop-solid'],
description: 'Create API Routes and middlewares with an improved developer experience.',
}
},
{
type: 'link',
href: 'https://docs.medusajs.com/ui',
label: 'Medusa UI',
customProps: {
icon: Icons['tag-solid'],
description: 'Check out the Medusa UI package, a React implementation of the Medusa design system.',
}
},
{
type: 'link',
href: '/admin/widgets',
label: 'Admin Widgets',
customProps: {
icon: Icons['component-solid'],
description: 'Learn how you can customize the admin dashboard with admin widgets.',
badge: {
variant: 'orange',
children: 'Beta'
}
icon: Icons['server-stack-solid'],
description: 'Create API Routes with an improved developer experience.',
}
},
]} />
+2 -2
View File
@@ -117,7 +117,7 @@ const medusa = new Medusa({
### JWT Token
You can use a JWT token to authenticate both admin users and customers. Authentication state is managed by the client, which is ideal for Jamstack applications and mobile applications.
You can use a JWT token to authenticate both admin users and customers. Authentication state is managed by the client, which is ideal for Jamstack and mobile applications.
You can authenticate the admin user using the [admin.auth.getToken](../references/js_client/classes/js_client.AdminAuthResource.mdx#getToken) method, and the customer using the [auth.getToken](../references/js_client/classes/js_client.AuthResource.mdx#getToken) method.
@@ -209,7 +209,7 @@ For example:
You can authenticate admin users with a personal API Token.
If a user doesn't have a personal API token, create one with the [admin.users.update](../references/js_client/classes/js_client.AdminUsersResource.mdx#update) method:
If a user doesn't have a personal API token, create one with the [admin.users.update](../references/js_client/classes/js_client.AdminUsersResource.mdx#update) method or the [Update User API route](https://docs.medusajs.com/api/admin#users_postusersuser):
<Tabs groupId="client-type" isCodeTabs={true}>
<TabItem value="js-client" label="JS Client" default>
File diff suppressed because it is too large. Load diff
@@ -475,10 +475,17 @@ To create a line item of a product and add it to a cart, you can use the followi
const createLineItem = useCreateLineItem(cart_id)
const handleAddItem = () => {
const handleAddItem = (
variantId: string,
quantity: amount
) => {
createLineItem.mutate({
variant_id,
variant_id: variantId,
quantity,
}, {
onSuccess: ({ cart }) => {
console.log(cart.items)
}
})
}
@@ -549,10 +556,17 @@ To update a line item's quantity in the cart, you can use the following code sni
const updateLineItem = useUpdateLineItem(cart_id)
const handleUpdateItem = () => {
const handleUpdateItem = (
lineItemId: string,
quantity: number
) => {
updateLineItem.mutate({
lineId,
quantity: 3,
lineId: lineItemId,
quantity,
}, {
onSuccess: ({ cart }) => {
console.log(cart.items)
}
})
}
@@ -614,9 +628,15 @@ To delete a line item from the cart, you can use the following code snippet:
const deleteLineItem = useDeleteLineItem(cart_id)
const handleDeleteItem = () => {
const handleDeleteItem = (
lineItemId: string
) => {
deleteLineItem.mutate({
lineId,
lineId: lineItemId,
}, {
onSuccess: ({ cart }) => {
console.log(cart.items)
}
})
}
@@ -253,22 +253,30 @@ Once the customer chooses one of the available shipping options, send a `POST` r
```tsx
import { useAddShippingMethodToCart } from "medusa-react"
// ...
const ShippingOptions = ({ cartId }: Props) => {
// ...
type Props = {
cartId: string
}
const Cart = ({ cartId }: Props) => {
const addShippingMethod = useAddShippingMethodToCart(cartId)
const handleAddShippingMethod = (option_id: string) => {
const handleAddShippingMethod = (
optionId: string
) => {
addShippingMethod.mutate({
option_id,
option_id: optionId,
}, {
onSuccess: ({ cart }) => {
console.log(cart.shipping_methods)
}
})
}
// ...
}
export default ShippingOptions
export default Cart
```
</TabItem>
@@ -72,19 +72,13 @@ You can create a customer group by sending a request to the Create Customer Grou
const createCustomerGroup = useAdminCreateCustomerGroup()
// ...
const handleCreate = () => {
const handleCreate = (name: string) => {
createCustomerGroup.mutate({
name,
})
}
// ...
return (
<form>
{/* Render form */}
</form>
)
}
export default CreateCustomerGroup
@@ -147,7 +141,6 @@ You can get a list of all customer groups by sending a request to the List Custo
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { CustomerGroup } from "@medusajs/medusa"
import { useAdminCustomerGroups } from "medusa-react"
const CustomerGroups = () => {
@@ -165,7 +158,7 @@ You can get a list of all customer groups by sending a request to the List Custo
{customer_groups && customer_groups.length > 0 && (
<ul>
{customer_groups.map(
(customerGroup: CustomerGroup) => (
(customerGroup) => (
<li key={customerGroup.id}>
{customerGroup.name}
</li>
@@ -301,28 +294,26 @@ You can update a customer group’s data by sending a request to the Update Cust
```tsx
import { useAdminUpdateCustomerGroup } from "medusa-react"
const UpdateCustomerGroup = () => {
type Props = {
customerGroupId: string
}
const CustomerGroup = ({ customerGroupId }: Props) => {
const updateCustomerGroup = useAdminUpdateCustomerGroup(
customerGroupId
)
// ..
const handleUpdate = () => {
const handleUpdate = (name: string) => {
updateCustomerGroup.mutate({
name,
})
}
// ...
return (
<form>
{/* Render form */}
</form>
)
}
export default UpdateCustomerGroup
export default CustomerGroup
```
</TabItem>
@@ -391,7 +382,11 @@ You can delete a customer group by sending a request to the Delete a Customer Gr
```tsx
import { useAdminDeleteCustomerGroup } from "medusa-react"
const CustomerGroup = () => {
type Props = {
customerGroupId: string
}
const CustomerGroup = ({ customerGroupId }: Props) => {
const deleteCustomerGroup = useAdminDeleteCustomerGroup(
customerGroupId
)
@@ -468,13 +463,13 @@ You can add a customer to a group by sending a request to the Customer Group’s
import {
useAdminAddCustomersToCustomerGroup,
} from "medusa-react"
const CustomerGroup = () => {
const CustomerGroup = (customerGroupId: string) => {
const addCustomers = useAdminAddCustomersToCustomerGroup(
customerGroupId
)
// ...
const handleAddCustomers= (customerId: string) => {
addCustomers.mutate({
customer_ids: [
@@ -484,10 +479,10 @@ You can add a customer to a group by sending a request to the Customer Group’s
],
})
}
// ...
}
export default CustomerGroup
```
@@ -559,10 +554,13 @@ You can retrieve a list of all customers in a customer group using the List Cust
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { Customer } from "@medusajs/medusa"
import { useAdminCustomerGroupCustomers } from "medusa-react"
const CustomerGroup = () => {
type Props = {
customerGroupId: string
}
const CustomerGroup = ({ customerGroupId }: Props) => {
const {
customers,
isLoading,
@@ -578,7 +576,7 @@ You can retrieve a list of all customers in a customer group using the List Cust
)}
{customers && customers.length > 0 && (
<ul>
{customers.map((customer: Customer) => (
{customers.map((customer) => (
<li key={customer.id}>{customer.first_name}</li>
))}
</ul>
@@ -651,23 +649,26 @@ You can remove customers from a customer group by sending a request to the Remov
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { Customer } from "@medusajs/medusa"
import {
useAdminRemoveCustomersFromCustomerGroup,
} from "medusa-react"
const CustomerGroup = () => {
type Props = {
customerGroupId: string
}
const CustomerGroup = ({ customerGroupId }: Props) => {
const removeCustomers =
useAdminRemoveCustomersFromCustomerGroup(
customerGroupId
)
// ...
const handleRemoveCustomer = (customer_id: string) => {
const handleRemoveCustomer = (customerId: string) => {
removeCustomers.mutate({
customer_ids: [
{
id: customer_id,
id: customerId,
},
],
})
@@ -68,7 +68,6 @@ You can show a list of customers by sending a request to the [List Customers API
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { Customer } from "@medusajs/medusa"
import { useAdminCustomers } from "medusa-react"
const Customers = () => {
@@ -82,7 +81,7 @@ You can show a list of customers by sending a request to the [List Customers API
)}
{customers && customers.length > 0 && (
<ul>
{customers.map((customer: Customer) => (
{customers.map((customer) => (
<li key={customer.id}>{customer.first_name}</li>
))}
</ul>
@@ -162,27 +161,26 @@ You can create a customer account by sending a request to the [Create a Customer
```tsx
import { useAdminCreateCustomer } from "medusa-react"
type CustomerData = {
first_name: string
last_name: string
email: string
password: string
}
const CreateCustomer = () => {
const createCustomer = useAdminCreateCustomer()
// ...
const handleCreate = () => {
// ...
createCustomer.mutate({
first_name,
last_name,
email,
password,
const handleCreate = (customerData: CustomerData) => {
createCustomer.mutate(customerData, {
onSuccess: ({ customer }) => {
console.log(customer.id)
}
})
}
// ...
return (
<form>
{/* Render form */}
</form>
)
}
export default CreateCustomer
@@ -265,31 +263,30 @@ You can edit a customer’s information by sending a request to the [Update a Cu
```tsx
import { useAdminUpdateCustomer } from "medusa-react"
const UpdateCustomer = () => {
const updateCustomer = useAdminUpdateCustomer(customerId)
// ...
const handleUpdate = () => {
// ...
updateCustomer.mutate({
email,
password,
first_name,
last_name,
})
}
// ...
return (
<form>
{/* Render form */}
</form>
)
type CustomerData = {
first_name: string
last_name: string
email: string
password: string
}
export default UpdateCustomer
type Props = {
customerId: string
}
const Customer = ({ customerId }: Props) => {
const updateCustomer = useAdminUpdateCustomer(customerId)
// ...
const handleUpdate = (customerData: CustomerData) => {
updateCustomer.mutate(customerData)
}
// ...
}
export default Customer
```
</TabItem>
@@ -85,23 +85,23 @@ You can register a new customer by sending a request to the [Create a Customer A
const createCustomer = useCreateCustomer()
// ...
const handleCreate = () => {
const handleCreate = (
customerData: {
first_name: string
last_name: string
email: string
password: string
}
) => {
// ...
createCustomer.mutate({
first_name,
last_name,
email,
password,
createCustomer.mutate(customerData, {
onSuccess: ({ customer }) => {
console.log(customer.id)
}
})
}
// ...
return (
<form>
{/* Render form */}
</form>
)
}
export default RegisterCustomer
@@ -370,28 +370,32 @@ You can edit a customer’s info using the [Update Customer API Route](https://d
```tsx
import { useUpdateMe } from "medusa-react"
const UpdateCustomer = () => {
type Props = {
customerId: string
}
const Customer = ({ customerId }: Props) => {
const updateCustomer = useUpdateMe()
// ...
const handleUpdate = () => {
const handleUpdate = (
firstName: string
) => {
// ...
updateCustomer.mutate({
id: customer_id,
first_name,
id: customerId,
first_name: firstName,
}, {
onSuccess: ({ customer }) => {
console.log(customer.first_name)
}
})
}
// ...
return (
<form>
{/* Render form */}
</form>
)
}
export default UpdateCustomer
export default Customer
```
</TabItem>
@@ -612,19 +616,18 @@ You can retrieve a customer’s orders by sending a request to the [List Orders
```tsx
import { useCustomerOrders } from "medusa-react"
import { Order } from "@medusajs/medusa"
const Orders = () => {
// refetch a function that can be used to
// re-retrieve orders after the customer logs in
const { orders, isLoading, refetch } = useCustomerOrders()
const { orders, isLoading } = useCustomerOrders()
return (
<div>
{isLoading && <span>Loading orders...</span>}
{orders?.length && (
<ul>
{orders.map((order: Order) => (
{orders.map((order) => (
<li key={order.id}>{order.display_id}</li>
))}
</ul>
@@ -104,15 +104,18 @@ You can create a discount by sending a request to the [Create Discount API Route
AllocationType,
DiscountRuleType,
} from "@medusajs/medusa"
const CreateDiscount = () => {
const createDiscount = useAdminCreateDiscount()
// ...
const handleCreate = () => {
const handleCreate = (
currencyCode: string,
regionId: string
) => {
// ...
createDiscount.mutate({
code,
code: currencyCode,
rule: {
type: DiscountRuleType.FIXED,
value: 10,
@@ -125,10 +128,10 @@ You can create a discount by sending a request to the [Create Discount API Route
is_disabled: false,
})
}
// ...
}
export default CreateDiscount
```
@@ -224,21 +227,24 @@ For example, you can update the discount’s description and status by sending t
```tsx
import { useAdminUpdateDiscount } from "medusa-react"
const UpdateDiscount = () => {
const updateDiscount = useAdminUpdateDiscount(discount_id)
type Props = {
discountId: string
}
const Discount = ({ discountId }: Props) => {
const updateDiscount = useAdminUpdateDiscount(discountId)
// ...
const handleUpdate = () => {
// ...
const handleUpdate = (isDisabled: boolean) => {
updateDiscount.mutate({
is_disabled: true,
is_disabled: isDisabled,
})
}
// ...
}
export default UpdateDiscount
export default Discount
```
</TabItem>
@@ -317,25 +323,28 @@ You can send a request to the [Create Condition API Route](https://docs.medusajs
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminDiscountCreateCondition } from "medusa-react"
import { DiscountConditionOperator } from "@medusajs/medusa"
import { useAdminDiscountCreateCondition } from "medusa-react"
const Discount = () => {
const createCondition = useAdminDiscountCreateCondition(
discount_id
)
type Props = {
discountId: string
}
const Discount = ({ discountId }: Props) => {
const createCondition = useAdminDiscountCreateCondition(discountId)
// ...
const handleCreateCondition = (
operator: DiscountConditionOperator,
productId: string
operator: DiscountConditionOperator,
products: string[]
) => {
// ...
createCondition.mutate({
operator,
products: [
productId,
],
products
}, {
onSuccess: ({ discount }) => {
console.log(discount.id)
}
})
}
@@ -433,32 +442,29 @@ You can retrieve a condition and its resources by sending a request to the [Get
```tsx
import { useAdminGetDiscountCondition } from "medusa-react"
import { Product } from "@medusajs/medusa"
const DiscountCondition = () => {
type Props = {
discountId: string
discountConditionId: string
}
const DiscountCondition = ({
discountId,
discountConditionId
}: Props) => {
const {
discount_condition,
isLoading,
isLoading
} = useAdminGetDiscountCondition(
discount_id,
conditionId
discountId,
discountConditionId
)
// ...
return (
<div>
{isLoading && <span>Loading</span>}
{isLoading && <span>Loading...</span>}
{discount_condition && (
<>
<span>{discount_condition.id}</span>
<ul>
{discount_condition.products.map(
(product: Product) => (
<li key={product.id}>{product.title}</li>
)
)}
</ul>
</>
<span>{discount_condition.type}</span>
)}
</div>
)
@@ -533,18 +539,31 @@ For example, to update the products in a condition:
```tsx
import { useAdminDiscountUpdateCondition } from "medusa-react"
import { Product } from "@medusajs/medusa"
const DiscountCondition = () => {
const updateCondition = useAdminDiscountUpdateCondition(
discount_id,
type Props = {
discountId: string
conditionId: string
}
const DiscountCondition = ({
discountId,
conditionId
}: Props) => {
const update = useAdminDiscountUpdateCondition(
discountId,
conditionId
)
// ...
const handleUpdateCondition = (productIds: string[]) => {
updateCondition.mutate({
products: productIds,
const handleUpdate = (
products: string[]
) => {
update.mutate({
products
}, {
onSuccess: ({ discount }) => {
console.log(discount.id)
}
})
}
@@ -629,14 +648,24 @@ You can delete a condition by sending a request to the [Delete Condition API Rou
```tsx
import { useAdminDiscountRemoveCondition } from "medusa-react"
const Discount = () => {
type Props = {
discountId: string
}
const Discount = ({ discountId }: Props) => {
const deleteCondition = useAdminDiscountRemoveCondition(
discount_id
discountId
)
// ...
const handleUpdateCondition = (conditionId: string) => {
deleteCondition.mutate(conditionId)
const handleDelete = (
conditionId: string
) => {
deleteCondition.mutate(conditionId, {
onSuccess: ({ id, object, deleted }) => {
console.log(deleted)
}
})
}
// ...
@@ -373,20 +373,30 @@ You can update a gift card product’s details by sending a request to the [Upda
```tsx
import { useAdminUpdateProduct } from "medusa-react"
const UpdateGiftCard = () => {
const createGiftCard = useAdminUpdateProduct(giftCardId)
type Props = {
giftCardId: string
}
const GiftCard = ({
giftCardId
}: Props) => {
const updateGiftCard = useAdminUpdateProduct(giftCardId)
// ...
const handleUpdate = () => {
createGiftCard.mutate({
updateGiftCard.mutate({
description: "The best gift card",
}, {
onSuccess: ({ product }) => {
console.log(product.description)
}
})
}
// ...
}
export default UpdateGiftCard
export default GiftCard
```
</TabItem>
@@ -450,12 +460,20 @@ You can delete a gift card product by sending a request to the [Delete a Product
```tsx
import { useAdminDeleteProduct } from "medusa-react"
const GiftCard = () => {
type Props = {
giftCardId: string
}
const GiftCard = ({ giftCardId }: Props) => {
const deleteGiftCard = useAdminDeleteProduct(giftCardId)
// ...
const handleDelete = () => {
deleteGiftCard.mutate()
deleteGiftCard.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
@@ -521,7 +539,6 @@ You can retrieve all custom gift cards by sending a request to the [List Gift Ca
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { GiftCard } from "@medusajs/medusa"
import { useAdminGiftCards } from "medusa-react"
const CustomGiftCards = () => {
@@ -535,7 +552,7 @@ You can retrieve all custom gift cards by sending a request to the [List Gift Ca
)}
{gift_cards && gift_cards.length > 0 && (
<ul>
{gift_cards.map((giftCard: GiftCard) => (
{gift_cards.map((giftCard) => (
<li key={giftCard.id}>{giftCard.code}</li>
))}
</ul>
@@ -604,10 +621,17 @@ You can create a custom gift card by sending a request to the [Create a Gift Car
const createGiftCard = useAdminCreateGiftCard()
// ...
const handleCreate = (regionId: string, value: number) => {
const handleCreate = (
regionId: string,
value: number
) => {
createGiftCard.mutate({
region_id: regionId,
value,
}, {
onSuccess: ({ gift_card }) => {
console.log(gift_card.id)
}
})
}
@@ -684,7 +708,11 @@ You can update a gift card by sending a request to the [Update a Gift Card API R
```tsx
import { useAdminUpdateGiftCard } from "medusa-react"
const UpdateCustomGiftCards = () => {
type Props = {
customGiftCardId: string
}
const CustomGiftCard = ({ customGiftCardId }: Props) => {
const updateGiftCard = useAdminUpdateGiftCard(
customGiftCardId
)
@@ -699,7 +727,7 @@ You can update a gift card by sending a request to the [Update a Gift Card API R
// ...
}
export default UpdateCustomGiftCards
export default CustomGiftCard
```
</TabItem>
@@ -763,14 +791,22 @@ You can delete a custom gift card by sending a request to the [Delete a Gift Car
```tsx
import { useAdminDeleteGiftCard } from "medusa-react"
const CustomGiftCard = () => {
type Props = {
customGiftCardId: string
}
const CustomGiftCard = ({ customGiftCardId }: Props) => {
const deleteGiftCard = useAdminDeleteGiftCard(
customGiftCardId
)
// ...
const handleDelete = () => {
deleteGiftCard.mutate()
deleteGiftCard.mutate(void 0, {
onSuccess: ({ id, object, deleted}) => {
console.log(id)
}
})
}
// ...
@@ -168,8 +168,14 @@ You can retrieve the details of a gift card by sending a request to the [Get Gif
```tsx
import { useGiftCard } from "medusa-react"
const GiftCard = () => {
const { gift_card, isLoading, isError } = useGiftCard("code")
type Props = {
giftCardCode: string
}
const GiftCard = ({ giftCardCode }: Props) => {
const { gift_card, isLoading, isError } = useGiftCard(
giftCardCode
)
return (
<div>
@@ -78,7 +78,8 @@ You can list inventory items by sending a request to the [List Inventory Items A
function InventoryItems() {
const {
inventory_items,
isLoading } = useAdminInventoryItems()
isLoading
} = useAdminInventoryItems()
return (
<div>
@@ -164,9 +165,13 @@ You can create an inventory item by sending a request to the [Create Inventory I
const createInventoryItem = useAdminCreateInventoryItem()
// ...
const handleCreate = () => {
const handleCreate = (variantId: string) => {
createInventoryItem.mutate({
variant_id,
variant_id: variantId,
}, {
onSuccess: ({ inventory_item }) => {
console.log(inventory_item.id)
}
})
}
@@ -237,10 +242,15 @@ You can retrieve an inventory item by sending a request to the [Get Inventory It
```tsx
import { useAdminInventoryItem } from "medusa-react"
function InventoryItem() {
type Props = {
inventoryItemId: string
}
const InventoryItem = ({ inventoryItemId }: Props) => {
const {
inventory_item,
isLoading } = useAdminInventoryItem(inventoryItemId)
isLoading
} = useAdminInventoryItem(inventoryItemId)
return (
<div>
@@ -309,22 +319,30 @@ You can update an inventory item by sending a request to the [Update Inventory I
```tsx
import { useAdminUpdateInventoryItem } from "medusa-react"
const UpdateInventoryItem = () => {
type Props = {
inventoryItemId: string
}
const InventoryItem = ({ inventoryItemId }: Props) => {
const updateInventoryItem = useAdminUpdateInventoryItem(
inventoryItemId
)
// ...
const handleUpdate = () => {
const handleUpdate = (origin_country: string) => {
updateInventoryItem.mutate({
origin_country: "US",
origin_country,
}, {
onSuccess: ({ inventory_item }) => {
console.log(inventory_item.origin_country)
}
})
}
// ...
}
export default UpdateInventoryItem
export default InventoryItem
```
</TabItem>
@@ -395,13 +413,17 @@ You can list inventory levels of an inventory item by sending a request to the [
import {
useAdminInventoryItemLocationLevels,
} from "medusa-react"
function InventoryItem() {
type Props = {
inventoryItemId: string
}
const InventoryItem = ({ inventoryItemId }: Props) => {
const {
inventory_item,
isLoading,
} = useAdminInventoryItemLocationLevels(inventoryItemId)
return (
<div>
{isLoading && <span>Loading...</span>}
@@ -415,7 +437,7 @@ You can list inventory levels of an inventory item by sending a request to the [
</div>
)
}
export default InventoryItem
```
@@ -475,23 +497,34 @@ You can create a location level by sending a request to the [Create Inventory Le
```tsx
import { useAdminCreateLocationLevel } from "medusa-react"
const CreateLocationLevel = () => {
type Props = {
inventoryItemId: string
}
const InventoryItem = ({ inventoryItemId }: Props) => {
const createLocationLevel = useAdminCreateLocationLevel(
inventoryItemId
)
// ...
const handleCreate = () => {
const handleCreateLocationLevel = (
locationId: string,
stockedQuantity: number
) => {
createLocationLevel.mutate({
location_id,
stocked_quantity: 10,
location_id: locationId,
stocked_quantity: stockedQuantity,
}, {
onSuccess: ({ inventory_item }) => {
console.log(inventory_item.id)
}
})
}
// ...
}
export default CreateLocationLevel
export default InventoryItem
```
</TabItem>
@@ -568,23 +601,34 @@ You can update a location level by sending a request to the [Update Location Lev
```tsx
import { useAdminUpdateLocationLevel } from "medusa-react"
const UpdateLocationLevel = () => {
type Props = {
inventoryItemId: string
}
const InventoryItem = ({ inventoryItemId }: Props) => {
const updateLocationLevel = useAdminUpdateLocationLevel(
inventoryItemId
)
// ...
const handleUpdate = () => {
const handleUpdate = (
stockLocationId: string,
stockedQuantity: number
) => {
updateLocationLevel.mutate({
stockLocationId,
stocked_quantity: 10,
stocked_quantity: stockedQuantity,
}, {
onSuccess: ({ inventory_item }) => {
console.log(inventory_item.id)
}
})
}
// ...
}
export default UpdateLocationLevel
export default InventoryItem
```
</TabItem>
@@ -653,20 +697,26 @@ You can delete a location level of an inventory item by sending a request to the
```tsx
import { useAdminDeleteLocationLevel } from "medusa-react"
const DeleteLocationLevel = () => {
type Props = {
inventoryItemId: string
}
const InventoryItem = ({ inventoryItemId }: Props) => {
const deleteLocationLevel = useAdminDeleteLocationLevel(
inventoryItemId
)
// ...
const handleDelete = () => {
const handleDelete = (
locationId: string
) => {
deleteLocationLevel.mutate(locationId)
}
// ...
}
export default DeleteLocationLevel
export default InventoryItem
```
</TabItem>
@@ -722,7 +772,11 @@ You can delete an inventory item by sending a request to the [Delete Inventory I
```tsx
import { useAdminDeleteInventoryItem } from "medusa-react"
const DeleteInventoryItem = () => {
type Props = {
inventoryItemId: string
}
const InventoryItem = ({ inventoryItemId }: Props) => {
const deleteInventoryItem = useAdminDeleteInventoryItem(
inventoryItemId
)
@@ -735,7 +789,7 @@ You can delete an inventory item by sending a request to the [Delete Inventory I
// ...
}
export default DeleteInventoryItem
export default InventoryItem
```
</TabItem>
@@ -267,16 +267,20 @@ You can retrieve a single item allocation by its ID using the [Get a Reservation
```tsx
import { useAdminReservation } from "medusa-react"
function Reservation() {
const {
reservation,
isLoading } = useAdminReservation(reservationId)
type Props = {
reservationId: string
}
const Reservation = ({ reservationId }: Props) => {
const { reservation, isLoading } = useAdminReservation(
reservationId
)
return (
<div>
{isLoading && <span>Loading...</span>}
{reservation && (
<span>{reservation.quantity}</span>
<span>{reservation.inventory_item_id}</span>
)}
</div>
)
@@ -335,22 +339,30 @@ You can update an item allocation to change the location to allocate from or the
```tsx
import { useAdminUpdateReservation } from "medusa-react"
const UpdateReservation = () => {
type Props = {
reservationId: string
}
const Reservation = ({ reservationId }: Props) => {
const updateReservation = useAdminUpdateReservation(
reservationId
)
// ...
const handleCreate = () => {
const handleCreate = (quantity: number) => {
updateReservation.mutate({
quantity,
}, {
onSuccess: ({ reservation }) => {
console.log(reservation.id)
}
})
}
// ...
}
export default UpdateReservation
export default Reservation
```
</TabItem>
@@ -420,20 +432,28 @@ You can delete an item allocation by sending a request to the [Delete Reservatio
```tsx
import { useAdminDeleteReservation } from "medusa-react"
const DeleteReservation = () => {
type Props = {
reservationId: string
}
const Reservation = ({ reservationId }: Props) => {
const deleteReservation = useAdminDeleteReservation(
reservationId
)
// ...
const handleDelete = () => {
deleteReservation.mutate()
deleteReservation.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
}
export default DeleteReservation
export default Reservation
```
</TabItem>
@@ -596,7 +616,7 @@ When requesting a return, you can specify the location to return the item to by
location_id,
})
.then(({ order }) => {
console.log(order.id)
console.log(order.returns)
})
```
@@ -606,7 +626,11 @@ When requesting a return, you can specify the location to return the item to by
```tsx
import { useAdminRequestReturn } from "medusa-react"
const RequestReturn = () => {
type Props = {
orderId: string
}
const RequestReturn = ({ orderId }: Props) => {
const requestReturn = useAdminRequestReturn(orderId)
// ...
@@ -620,6 +644,10 @@ When requesting a return, you can specify the location to return the item to by
],
// ...other parameters
location_id,
}, {
onSuccess: ({ order }) => {
console.log(order.returns)
}
})
}
@@ -174,11 +174,19 @@ You can create a reservation by sending a request to the [Create Reservation API
const createReservation = useAdminCreateReservation()
// ...
const handleCreate = () => {
const handleCreate = (
locationId: string,
inventoryItemId: string,
quantity: number
) => {
createReservation.mutate({
location_id,
inventory_item_id,
location_id: locationId,
inventory_item_id: inventoryItemId,
quantity,
}, {
onSuccess: ({ reservation }) => {
console.log(reservation.id)
}
})
}
@@ -259,13 +267,19 @@ You can update a reservation by sending a request to the [Update Reservation API
```tsx
import { useAdminUpdateReservation } from "medusa-react"
const UpdateReservation = () => {
type Props = {
reservationId: string
}
const Reservation = ({ reservationId }: Props) => {
const updateReservation = useAdminUpdateReservation(
reservationId
)
// ...
const handleCreate = () => {
const handleUpdate = (
quantity: number
) => {
updateReservation.mutate({
quantity,
})
@@ -274,7 +288,7 @@ You can update a reservation by sending a request to the [Update Reservation API
// ...
}
export default UpdateReservation
export default Reservation
```
</TabItem>
@@ -344,20 +358,28 @@ You can delete a reservation by sending a request to the [Delete Reservation API
```tsx
import { useAdminDeleteReservation } from "medusa-react"
const DeleteReservation = () => {
type Props = {
reservationId: string
}
const Reservation = ({ reservationId }: Props) => {
const deleteReservation = useAdminDeleteReservation(
reservationId
)
// ...
const handleDelete = () => {
deleteReservation.mutate()
deleteReservation.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
}
export default DeleteReservation
export default Reservation
```
</TabItem>
@@ -80,7 +80,8 @@ You can list stock locations by using the [List Stock Locations API Route](https
function StockLocations() {
const {
stock_locations,
isLoading } = useAdminStockLocations()
isLoading
} = useAdminStockLocations()
return (
<div>
@@ -160,9 +161,13 @@ You can create a stock location using the [Create a Stock Location API Route](ht
const createStockLocation = useAdminCreateStockLocation()
// ...
const handleCreate = () => {
const handleCreate = (name: string) => {
createStockLocation.mutate({
name: "Main Warehouse",
name,
}, {
onSuccess: ({ stock_location }) => {
console.log(stock_location.id)
}
})
}
@@ -233,10 +238,15 @@ You can retrieve a stock location by sending a request to the [Get Stock Locatio
```tsx
import { useAdminStockLocation } from "medusa-react"
function StockLocation() {
type Props = {
stockLocationId: string
}
const StockLocation = ({ stockLocationId }: Props) => {
const {
stock_location,
isLoading } = useAdminStockLocation(stockLocationId)
isLoading
} = useAdminStockLocation(stockLocationId)
return (
<div>
@@ -303,21 +313,33 @@ You can associate a stock location with a sales channel by sending a request to
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminAddLocationToSalesChannel } from "medusa-react"
import {
useAdminAddLocationToSalesChannel
} from "medusa-react"
function StockLocation() {
type Props = {
salesChannelId: string
}
const SalesChannel = ({ salesChannelId }: Props) => {
const addLocation = useAdminAddLocationToSalesChannel()
// ...
const handleAdd = () => {
const handleAddLocation = (locationId: string) => {
addLocation.mutate({
sales_channel_id,
location_id,
sales_channel_id: salesChannelId,
location_id: locationId
}, {
onSuccess: ({ sales_channel }) => {
console.log(sales_channel.locations)
}
})
}
// ...
}
export default StockLocation
export default SalesChannel
```
</TabItem>
@@ -390,23 +412,32 @@ You can remove the association between a stock location and a sales channel by s
```tsx
import {
useAdminRemoveLocationFromSalesChannel,
useAdminRemoveLocationFromSalesChannel
} from "medusa-react"
function StockLocation() {
const removeLocation =
useAdminRemoveLocationFromSalesChannel()
type Props = {
salesChannelId: string
}
const SalesChannel = ({ salesChannelId }: Props) => {
const removeLocation = useAdminRemoveLocationFromSalesChannel()
// ...
const handleRemove = () => {
const handleRemoveLocation = (locationId: string) => {
removeLocation.mutate({
sales_channel_id,
location_id,
sales_channel_id: salesChannelId,
location_id: locationId
}, {
onSuccess: ({ sales_channel }) => {
console.log(sales_channel.locations)
}
})
}
// ...
}
export default StockLocation
export default SalesChannel
```
</TabItem>
@@ -484,15 +515,25 @@ You can update a stock location by sending a request to the [Update Stock Locati
```tsx
import { useAdminUpdateStockLocation } from "medusa-react"
function StockLocation() {
type Props = {
stockLocationId: string
}
const StockLocation = ({ stockLocationId }: Props) => {
const updateLocation = useAdminUpdateStockLocation(
stockLocationId
)
// ...
const handleRemove = () => {
const handleUpdate = (
name: string
) => {
updateLocation.mutate({
name: "Warehouse",
name
}, {
onSuccess: ({ stock_location }) => {
console.log(stock_location.name)
}
})
}
}
@@ -563,14 +604,22 @@ You can delete a stock location by sending a request to the [Delete Stock Locati
```tsx
import { useAdminDeleteStockLocation } from "medusa-react"
function StockLocation() {
type Props = {
stockLocationId: string
}
const StockLocation = ({ stockLocationId }: Props) => {
const deleteLocation = useAdminDeleteStockLocation(
stockLocationId
)
// ...
const handleDelete = () => {
deleteLocation.mutate()
deleteLocation.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
}
@@ -100,19 +100,23 @@ To do that, send a request to the [Create an OrderEdit API Route](https://docs.m
```tsx
import { useAdminCreateOrderEdit } from "medusa-react"
const OrderEdit = () => {
const CreateOrderEdit = () => {
const createOrderEdit = useAdminCreateOrderEdit()
const handleCreateOrderEdit = (orderId: string) => {
createOrderEdit.mutate({
order_id: orderId,
}, {
onSuccess: ({ order_edit }) => {
console.log(order_edit.id)
}
})
}
// ...
}
export default OrderEdit
export default CreateOrderEdit
```
</TabItem>
@@ -195,14 +199,24 @@ To add a new item to the original order, send a request to the [Add Line Item AP
```tsx
import { useAdminOrderEditAddLineItem } from "medusa-react"
const OrderEdit = () => {
const addLineItem = useAdminOrderEditAddLineItem(orderEditId)
type Props = {
orderEditId: string
}
const OrderEdit = ({ orderEditId }: Props) => {
const addLineItem = useAdminOrderEditAddLineItem(
orderEditId
)
const handleAddLineItem =
(quantity: number, variantId: string) => {
addLineItem.mutate({
quantity,
variant_id: variantId,
}, {
onSuccess: ({ order_edit }) => {
console.log(order_edit.changes)
}
})
}
@@ -279,7 +293,10 @@ To update an item, send a request to the [Update Line Item API Route](https://do
```tsx
import { useAdminOrderEditUpdateLineItem } from "medusa-react"
const OrderEdit = () => {
const OrderEditItemChange = (
orderEditId: string,
itemId: string
) => {
const updateLineItem = useAdminOrderEditUpdateLineItem(
orderEditId,
itemId
@@ -288,13 +305,17 @@ To update an item, send a request to the [Update Line Item API Route](https://do
const handleUpdateLineItem = (quantity: number) => {
updateLineItem.mutate({
quantity,
}, {
onSuccess: ({ order_edit }) => {
console.log(order_edit.items)
}
})
}
// ...
}
export default OrderEdit
export default OrderEditItemChange
```
</TabItem>
@@ -359,20 +380,32 @@ You can remove an item from the original order by sending a request to the [Remo
```tsx
import { useAdminOrderEditDeleteLineItem } from "medusa-react"
const OrderEdit = () => {
type Props = {
orderEditId: string
itemId: string
}
const OrderEditLineItem = ({
orderEditId,
itemId
}: Props) => {
const removeLineItem = useAdminOrderEditDeleteLineItem(
orderEditId,
itemId
)
const handleRemoveLineItem = () => {
removeLineItem.mutate()
removeLineItem.mutate(void 0, {
onSuccess: ({ order_edit }) => {
console.log(order_edit.changes)
}
})
}
// ...
}
export default OrderEdit
export default OrderEditLineItem
```
</TabItem>
@@ -428,16 +461,23 @@ To revert an item change, send a request to the [Delete Item Change API Route](h
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminDeleteOrderEditItemChange } from "medusa-react"
import { useAdminDeleteOrderEdit } from "medusa-react"
const OrderEdit = () => {
const deleteItemChange = useAdminDeleteOrderEditItemChange(
orderEditId,
itemChangeId
type Props = {
orderEditId: string
}
const OrderEdit = ({ orderEditId }: Props) => {
const deleteOrderEdit = useAdminDeleteOrderEdit(
orderEditId
)
const handleDeleteItemChange = () => {
deleteItemChange.mutate()
const handleDelete = () => {
deleteOrderEdit.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
@@ -513,14 +553,25 @@ To move an Order Edit into the request state, send a request to the [Request Con
useAdminRequestOrderEditConfirmation,
} from "medusa-react"
const OrderEdit = () => {
type Props = {
orderEditId: string
}
const OrderEdit = ({ orderEditId }: Props) => {
const requestOrderConfirmation =
useAdminRequestOrderEditConfirmation(
orderEditId
)
const handleRequestConfirmation = () => {
requestOrderConfirmation.mutate()
requestOrderConfirmation.mutate(void 0, {
onSuccess: ({ order_edit }) => {
console.log(
order_edit.requested_at,
order_edit.requested_by
)
}
})
}
// ...
@@ -604,11 +655,24 @@ To confirm an Order Edit, send a request to the [Confirm Order Edit API Route](h
```tsx
import { useAdminConfirmOrderEdit } from "medusa-react"
const OrderEdit = () => {
const confirmOrderEdit = useAdminConfirmOrderEdit(orderEditId)
type Props = {
orderEditId: string
}
const OrderEdit = ({ orderEditId }: Props) => {
const confirmOrderEdit = useAdminConfirmOrderEdit(
orderEditId
)
const handleConfirmOrderEdit = () => {
confirmOrderEdit.mutate()
confirmOrderEdit.mutate(void 0, {
onSuccess: ({ order_edit }) => {
console.log(
order_edit.confirmed_at,
order_edit.confirmed_by
)
}
})
}
// ...
@@ -687,13 +751,22 @@ If the payment is authorized by the customer, it can be captured by sending a re
```tsx
import { useAdminPaymentsCapturePayment } from "medusa-react"
const OrderEditPayment = () => {
const capturePayment = useAdminPaymentsCapturePayment(
type Props = {
paymentId: string
}
const OrderEditPayment = ({ paymentId }: Props) => {
const capture = useAdminPaymentsCapturePayment(
paymentId
)
const handleCapturePayment = () => {
capturePayment.mutate()
// ...
const handleCapture = () => {
capture.mutate(void 0, {
onSuccess: ({ payment }) => {
console.log(payment.amount)
}
})
}
// ...
@@ -757,24 +830,39 @@ To refund the difference to the customer, send a request to the [Refund Payment
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminPaymentsRefundPayment } from "medusa-react"
import { RefundReason } from "@medusajs/medusa"
import { useAdminPaymentsRefundPayment } from "medusa-react"
const OrderEditPayment = () => {
const refundPayment = useAdminPaymentsRefundPayment(paymentId)
const handleRefundPayment =
(amount: number, reason: RefundReason) => {
refundPayment.mutate({
amount,
reason,
})
}
type Props = {
paymentId: string
}
const Payment = ({ paymentId }: Props) => {
const refund = useAdminPaymentsRefundPayment(
paymentId
)
// ...
const handleRefund = (
amount: number,
reason: RefundReason,
note: string
) => {
refund.mutate({
amount,
reason,
note
}, {
onSuccess: ({ refund }) => {
console.log(refund.amount)
}
})
}
// ...
}
export default OrderEditPayment
export default Payment
```
</TabItem>
@@ -163,19 +163,27 @@ You can create a claim by sending a request to the [Create Claim API Route](http
```tsx
import { useAdminCreateClaim } from "medusa-react"
const CreateClaim = () => {
type Props = {
orderId: string
}
const CreateClaim = ({ orderId }: Props) => {
const createClaim = useAdminCreateClaim(orderId)
// ...
const handleCreate = () => {
const handleCreate = (itemId: string) => {
createClaim.mutate({
type: "refund",
claim_items: [
{
item_id,
item_id: itemId,
quantity: 1,
},
],
}, {
onSuccess: ({ order }) => {
console.log(order.claims)
}
})
}
@@ -275,21 +283,30 @@ You can update a claim by sending a request to the [Update Claim API Route](http
```tsx
import { useAdminUpdateClaim } from "medusa-react"
const UpdateClaim = () => {
type Props = {
orderId: string
claimId: string
}
const Claim = ({ orderId, claimId }: Props) => {
const updateClaim = useAdminUpdateClaim(orderId)
// ...
const handleUpdate = () => {
updateClaim.mutate({
claim_id,
no_notification: true,
claim_id: claimId,
no_notification: false
}, {
onSuccess: ({ order }) => {
console.log(order.claims)
}
})
}
// ...
}
export default UpdateClaim
export default Claim
```
</TabItem>
@@ -365,20 +382,29 @@ You can create a fulfillment for a claim by sending a request to the [Create Cla
```tsx
import { useAdminFulfillClaim } from "medusa-react"
const FulfillClaim = () => {
type Props = {
orderId: string
claimId: string
}
const Claim = ({ orderId, claimId }: Props) => {
const fulfillClaim = useAdminFulfillClaim(orderId)
// ...
const handleFulfill = () => {
fulfillClaim.mutate({
claim_id,
claim_id: claimId,
}, {
onSuccess: ({ order }) => {
console.log(order.claims)
}
})
}
// ...
}
export default FulfillClaim
export default Claim
```
</TabItem>
@@ -436,21 +462,30 @@ You can create a shipment for a claim by sending a request to the [Create Claim
```tsx
import { useAdminCreateClaimShipment } from "medusa-react"
const CreateShipment = () => {
type Props = {
orderId: string
claimId: string
}
const Claim = ({ orderId, claimId }: Props) => {
const createShipment = useAdminCreateClaimShipment(orderId)
// ...
const handleCreate = () => {
const handleCreateShipment = (fulfillmentId: string) => {
createShipment.mutate({
claim_id,
fulfillment_id,
claim_id: claimId,
fulfillment_id: fulfillmentId,
}, {
onSuccess: ({ order }) => {
console.log(order.claims)
}
})
}
// ...
}
export default CreateShipment
export default Claim
```
</TabItem>
@@ -530,23 +565,32 @@ You can cancel a fulfillment by sending a request to the [Cancel Fulfillment API
```tsx
import { useAdminCancelClaimFulfillment } from "medusa-react"
const CancelFulfillment = () => {
type Props = {
orderId: string
claimId: string
}
const Claim = ({ orderId, claimId }: Props) => {
const cancelFulfillment = useAdminCancelClaimFulfillment(
orderId
)
// ...
const handleCancel = () => {
const handleCancel = (fulfillmentId: string) => {
cancelFulfillment.mutate({
claim_id,
fulfillment_id,
claim_id: claimId,
fulfillment_id: fulfillmentId,
}, {
onSuccess: ({ order }) => {
console.log(order.claims)
}
})
}
// ...
}
export default CancelFulfillment
export default Claim
```
</TabItem>
@@ -610,7 +654,12 @@ You can cancel a claim by sending a request to the [Cancel Claim API Route](http
```tsx
import { useAdminCancelClaim } from "medusa-react"
const CancelClaim = () => {
type Props = {
orderId: string
claimId: string
}
const Claim = ({ orderId, claimId }: Props) => {
const cancelClaim = useAdminCancelClaim(orderId)
// ...
@@ -621,7 +670,7 @@ You can cancel a claim by sending a request to the [Cancel Claim API Route](http
// ...
}
export default CancelClaim
export default Claim
```
</TabItem>
@@ -166,34 +166,28 @@ You can create a draft order by sending a request to the [Create Draft Order API
```tsx
import { useAdminCreateDraftOrder } from "medusa-react"
type DraftOrderData = {
email: string
region_id: string
items: {
quantity: number,
variant_id: string
}[]
shipping_methods: {
option_id: string
price: number
}[]
}
const CreateDraftOrder = () => {
const createDraftOrder = useAdminCreateDraftOrder()
// ...
const handleCreate = () => {
createDraftOrder.mutate({
email,
region_id,
items: [
{
// defined product
quantity: 1,
variant_id,
},
{
// custom product
quantity: 1,
unit_price: 1000,
title: "Custom Product",
},
],
shipping_methods: [
{
option_id,
// for custom shipping price
price,
},
],
const handleCreate = (data: DraftOrderData) => {
createDraftOrder.mutate(data, {
onSuccess: ({ draft_order }) => {
console.log(draft_order.id)
}
})
}
@@ -316,12 +310,16 @@ You can retrieve a draft order by sending a request to the [Get Draft Order API
```tsx
import { useAdminDraftOrder } from "medusa-react"
const DraftOrder = () => {
type Props = {
draftOrderId: string
}
const DraftOrder = ({ draftOrderId }: Props) => {
const {
draft_order,
isLoading,
} = useAdminDraftOrder(draftOrderId)
return (
<div>
{isLoading && <span>Loading...</span>}
@@ -386,22 +384,30 @@ You can update a draft order by sending a request to the [Update Draft Order API
```tsx
import { useAdminUpdateDraftOrder } from "medusa-react"
const UpdateDraftOrder = () => {
type Props = {
draftOrderId: string
}
const DraftOrder = ({ draftOrderId }: Props) => {
const updateDraftOrder = useAdminUpdateDraftOrder(
draftOrderId
)
// ...
const handleUpdate = () => {
const handleUpdate = (email: string) => {
updateDraftOrder.mutate({
email: "user@example.com",
email,
}, {
onSuccess: ({ draft_order }) => {
console.log(draft_order.id)
}
})
}
// ...
}
export default UpdateDraftOrder
export default DraftOrder
```
</TabItem>
@@ -471,22 +477,30 @@ You can add line items to a draft order by sending a request to the [Create Line
```tsx
import { useAdminDraftOrderAddLineItem } from "medusa-react"
const AddLineItem = () => {
type Props = {
draftOrderId: string
}
const DraftOrder = ({ draftOrderId }: Props) => {
const addLineItem = useAdminDraftOrderAddLineItem(
draftOrderId
)
// ...
const handleAdd = () => {
const handleAdd = (quantity: number) => {
addLineItem.mutate({
quantity: 1,
quantity,
}, {
onSuccess: ({ draft_order }) => {
console.log(draft_order.cart)
}
})
}
// ...
}
export default AddLineItem
export default DraftOrder
```
</TabItem>
@@ -561,23 +575,30 @@ You can update a line item by sending a request to the [Update Line Item API Rou
```tsx
import { useAdminDraftOrderUpdateLineItem } from "medusa-react"
const UpdateLineItem = () => {
type Props = {
draftOrderId: string
}
const DraftOrder = ({ draftOrderId }: Props) => {
const updateLineItem = useAdminDraftOrderUpdateLineItem(
draftOrderId
)
// ...
const handleUpdate = () => {
const handleUpdate = (
itemId: string,
quantity: number
) => {
updateLineItem.mutate({
item_id,
quantity: 1,
item_id: itemId,
quantity,
})
}
// ...
}
export default UpdateLineItem
export default DraftOrder
```
</TabItem>
@@ -643,20 +664,24 @@ You can delete a line item by sending a request to the [Delete Line Item API Rou
```tsx
import { useAdminDraftOrderRemoveLineItem } from "medusa-react"
const DeleteLineItem = () => {
type Props = {
draftOrderId: string
}
const DraftOrder = ({ draftOrderId }: Props) => {
const deleteLineItem = useAdminDraftOrderRemoveLineItem(
draftOrderId
)
// ...
const handleDelete = () => {
const handleDelete = (itemId: string) => {
deleteLineItem.mutate(itemId)
}
// ...
}
export default DeleteLineItem
export default DraftOrder
```
</TabItem>
@@ -714,20 +739,28 @@ You can register the draft order payment by sending a request to the [Register D
```tsx
import { useAdminDraftOrderRegisterPayment } from "medusa-react"
const RegisterPayment = () => {
type Props = {
draftOrderId: string
}
const DraftOrder = ({ draftOrderId }: Props) => {
const registerPayment = useAdminDraftOrderRegisterPayment(
draftOrderId
)
// ...
const handlePayment = () => {
registerPayment.mutate()
registerPayment.mutate(void 0, {
onSuccess: ({ order }) => {
console.log(order.id)
}
})
}
// ...
}
export default RegisterPayment
export default DraftOrder
```
</TabItem>
@@ -781,20 +814,28 @@ You can delete a draft order by sending a request to the [Delete Draft Order API
```tsx
import { useAdminDeleteDraftOrder } from "medusa-react"
const DeleteDraftOrder = () => {
type Props = {
draftOrderId: string
}
const DraftOrder = ({ draftOrderId }: Props) => {
const deleteDraftOrder = useAdminDeleteDraftOrder(
draftOrderId
)
// ...
const handleDelete = () => {
deleteDraftOrder.mutate()
deleteDraftOrder.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
}
export default DeleteDraftOrder
export default DraftOrder
```
</TabItem>
@@ -398,7 +398,11 @@ You can retrieve an order by sending a request to the [Get an Order API Route](h
```tsx
import { useAdminOrder } from "medusa-react"
const Order = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const {
order,
isLoading,
@@ -481,22 +485,31 @@ You can update any of the above details of an order by sending a request to the
```tsx
import { useAdminUpdateOrder } from "medusa-react"
const UpdateOrder = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const updateOrder = useAdminUpdateOrder(
orderId
)
// ...
const handleUpdate = () => {
const handleUpdate = (
email: string
) => {
updateOrder.mutate({
email,
}, {
onSuccess: ({ order }) => {
console.log(order.email)
}
})
}
// ...
}
export default UpdateOrder
export default Order
```
</TabItem>
@@ -564,20 +577,28 @@ You can capture an order’s payment by sending a request to the [Capture Order
```tsx
import { useAdminCapturePayment } from "medusa-react"
const CapturePayment = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const capturePayment = useAdminCapturePayment(
orderId
)
// ...
const handleCapture = () => {
capturePayment.mutate()
capturePayment.mutate(void 0, {
onSuccess: ({ order }) => {
console.log(order.status)
}
})
}
// ...
}
export default CapturePayment
export default Order
```
</TabItem>
@@ -634,23 +655,34 @@ To refund payment, send a request to the [Refund Payment API Route](https://docs
```tsx
import { useAdminRefundPayment } from "medusa-react"
const RefundPayment = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const refundPayment = useAdminRefundPayment(
orderId
)
// ...
const handleRefund = () => {
const handleRefund = (
amount: number,
reason: string
) => {
refundPayment.mutate({
amount,
reason,
}, {
onSuccess: ({ order }) => {
console.log(order.refunds)
}
})
}
// ...
}
export default RefundPayment
export default Order
```
</TabItem>
@@ -732,27 +764,38 @@ You can create a fulfillment by sending a request to the [Create a Fulfillment A
```tsx
import { useAdminCreateFulfillment } from "medusa-react"
const CreateFullfillment = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const createFulfillment = useAdminCreateFulfillment(
orderId
)
// ...
const handleCreate = () => {
const handleCreateFulfillment = (
itemId: string,
quantity: number
) => {
createFulfillment.mutate({
items: [
{
itemId,
item_id: itemId,
quantity,
},
],
}, {
onSuccess: ({ order }) => {
console.log(order.fulfillments)
}
})
}
// ...
}
export default CreateFullfillment
export default Order
```
</TabItem>
@@ -835,22 +878,32 @@ You can create a shipment for a fulfillment by sending a request to the [Create
```tsx
import { useAdminCreateShipment } from "medusa-react"
const CreateShipment = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const createShipment = useAdminCreateShipment(
orderId
)
// ...
const handleCreate = () => {
const handleCreate = (
fulfillmentId: string
) => {
createShipment.mutate({
fulfillment_id,
fulfillment_id: fulfillmentId,
}, {
onSuccess: ({ order }) => {
console.log(order.fulfillment_status)
}
})
}
// ...
}
export default CreateShipment
export default Order
```
</TabItem>
@@ -914,20 +967,30 @@ You can cancel a fulfillment by sending a request to the [Cancel Fulfillment API
```tsx
import { useAdminCancelFulfillment } from "medusa-react"
const CancelFulfillment = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const cancelFulfillment = useAdminCancelFulfillment(
orderId
)
// ...
const handleCancel = () => {
cancelFulfillment.mutate(fulfillment_id)
const handleCancel = (
fulfillmentId: string
) => {
cancelFulfillment.mutate(fulfillmentId, {
onSuccess: ({ order }) => {
console.log(order.fulfillments)
}
})
}
// ...
}
export default CancelFulfillment
export default Order
```
</TabItem>
@@ -983,20 +1046,28 @@ You can mark an order completed, changing its status, by sending a request to th
```tsx
import { useAdminCompleteOrder } from "medusa-react"
const CompleteOrder = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const completeOrder = useAdminCompleteOrder(
orderId
)
// ...
const handleComplete = () => {
completeOrder.mutate()
completeOrder.mutate(void 0, {
onSuccess: ({ order }) => {
console.log(order.status)
}
})
}
// ...
}
export default CompleteOrder
export default Order
```
</TabItem>
@@ -1050,20 +1121,28 @@ You can cancel an order by sending a request to the [Cancel Order API Route](htt
```tsx
import { useAdminCancelOrder } from "medusa-react"
const CancelOrder = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const cancelOrder = useAdminCancelOrder(
orderId
)
// ...
const handleCancel = () => {
cancelOrder.mutate()
cancelOrder.mutate(void 0, {
onSuccess: ({ order }) => {
console.log(order.status)
}
})
}
// ...
}
export default CancelOrder
export default Order
```
</TabItem>
@@ -1117,20 +1196,28 @@ You can archive an order by sending a request to the [Archive Order API Route](h
```tsx
import { useAdminArchiveOrder } from "medusa-react"
const ArchiveOrder = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const archiveOrder = useAdminArchiveOrder(
orderId
)
// ...
const handleArchive = () => {
archiveOrder.mutate()
const handleArchivingOrder = () => {
archiveOrder.mutate(void 0, {
onSuccess: ({ order }) => {
console.log(order.status)
}
})
}
// ...
}
export default ArchiveOrder
export default Order
```
</TabItem>
@@ -155,10 +155,17 @@ You can create a return reason using the [Create Return Reason API Route](https:
const createReturnReason = useAdminCreateReturnReason()
// ...
const handleCreate = () => {
const handleCreate = (
label: string,
value: string
) => {
createReturnReason.mutate({
label: "Damaged",
value: "damaged",
label,
value,
}, {
onSuccess: ({ return_reason }) => {
console.log(return_reason.id)
}
})
}
@@ -236,22 +243,32 @@ You can update a return reason by sending a request to the [Update Return Reason
```tsx
import { useAdminUpdateReturnReason } from "medusa-react"
const UpdateReturnReason = () => {
type Props = {
returnReasonId: string
}
const ReturnReason = ({ returnReasonId }: Props) => {
const updateReturnReason = useAdminUpdateReturnReason(
returnReasonId
)
// ...
const handleUpdate = () => {
const handleUpdate = (
label: string
) => {
updateReturnReason.mutate({
label: "Damaged",
label,
}, {
onSuccess: ({ return_reason }) => {
console.log(return_reason.label)
}
})
}
// ...
}
export default UpdateReturnReason
export default ReturnReason
```
</TabItem>
@@ -315,20 +332,28 @@ You can delete a return reason by sending a request to the [Delete Return Reason
```tsx
import { useAdminDeleteReturnReason } from "medusa-react"
const DeleteReturnReason = () => {
type Props = {
returnReasonId: string
}
const ReturnReason = ({ returnReasonId }: Props) => {
const deleteReturnReason = useAdminDeleteReturnReason(
returnReasonId
)
// ...
const handleDelete = () => {
deleteReturnReason.mutate()
deleteReturnReason.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
}
export default DeleteReturnReason
export default ReturnReason
```
</TabItem>
@@ -492,22 +517,35 @@ You can mark a return as received by sending a request to the [Receive a Return
```tsx
import { useAdminReceiveReturn } from "medusa-react"
const ReceiveReturn = () => {
type ReceiveReturnData = {
items: {
item_id: string
quantity: number
}[]
}
type Props = {
returnId: string
}
const Return = ({ returnId }: Props) => {
const receiveReturn = useAdminReceiveReturn(
returnId
)
// ...
const handleReceive = () => {
receiveReturn.mutate({
email,
const handleReceive = (data: ReceiveReturnData) => {
receiveReturn.mutate(data, {
onSuccess: ({ return: dataReturn }) => {
console.log(dataReturn.status)
}
})
}
// ...
}
export default ReceiveReturn
export default Return
```
</TabItem>
@@ -594,20 +632,28 @@ You can cancel a return by sending a request to the [Cancel Return API Route](ht
```tsx
import { useAdminCancelReturn } from "medusa-react"
const CancelReturn = () => {
type Props = {
returnId: string
}
const Return = ({ returnId }: Props) => {
const cancelReturn = useAdminCancelReturn(
returnId
)
// ...
const handleCancel = () => {
cancelReturn.mutate()
cancelReturn.mutate(void 0, {
onSuccess: ({ order }) => {
console.log(order.returns)
}
})
}
// ...
}
export default CancelReturn
export default Return
```
</TabItem>
@@ -163,20 +163,32 @@ Regardless of whether you need to refund or capture the payment, you can process
```tsx
import { useAdminProcessSwapPayment } from "medusa-react"
const ProcessPayment = () => {
type Props = {
orderId: string,
swapId: string
}
const Swap = ({
orderId,
swapId
}: Props) => {
const processPayment = useAdminProcessSwapPayment(
orderId
)
// ...
const handleProcess = () => {
processPayment.mutate(swapId)
const handleProcessPayment = () => {
processPayment.mutate(swapId, {
onSuccess: ({ order }) => {
console.log(order.swaps)
}
})
}
// ...
}
export default ProcessPayment
export default Swap
```
</TabItem>
@@ -239,7 +251,15 @@ You can create a fulfillment for a swap by sending a request to the [Create Swap
```tsx
import { useAdminFulfillSwap } from "medusa-react"
const FulfillSwap = () => {
type Props = {
orderId: string,
swapId: string
}
const Swap = ({
orderId,
swapId
}: Props) => {
const fulfillSwap = useAdminFulfillSwap(
orderId
)
@@ -248,13 +268,17 @@ You can create a fulfillment for a swap by sending a request to the [Create Swap
const handleFulfill = () => {
fulfillSwap.mutate({
swap_id: swapId,
}, {
onSuccess: ({ order }) => {
console.log(order.swaps)
}
})
}
// ...
}
export default FulfillSwap
export default Swap
```
</TabItem>
@@ -312,23 +336,37 @@ You can create a shipment for a swap’s fulfillment using the [Create Swap Ship
```tsx
import { useAdminCreateSwapShipment } from "medusa-react"
const CreateShipment = () => {
type Props = {
orderId: string,
swapId: string
}
const Swap = ({
orderId,
swapId
}: Props) => {
const createShipment = useAdminCreateSwapShipment(
orderId
)
// ...
const handleCreate = () => {
const handleCreateShipment = (
fulfillmentId: string
) => {
createShipment.mutate({
swap_id,
fulfillment_id,
swap_id: swapId,
fulfillment_id: fulfillmentId,
}, {
onSuccess: ({ order }) => {
console.log(order.swaps)
}
})
}
// ...
}
export default CreateShipment
export default Swap
```
</TabItem>
@@ -408,23 +446,33 @@ You can cancel a fulfillment by sending a request to the [Cancel Swap Fulfillmen
```tsx
import { useAdminCancelSwapFulfillment } from "medusa-react"
const CancelFulfillment = () => {
type Props = {
orderId: string,
swapId: string
}
const Swap = ({
orderId,
swapId
}: Props) => {
const cancelFulfillment = useAdminCancelSwapFulfillment(
orderId
)
// ...
const handleCancel = () => {
const handleCancelFulfillment = (
fulfillmentId: string
) => {
cancelFulfillment.mutate({
swap_id,
fulfillment_id,
swap_id: swapId,
fulfillment_id: fulfillmentId,
})
}
// ...
}
export default CancelFulfillment
export default Swap
```
</TabItem>
@@ -488,20 +536,32 @@ You can cancel a swap by sending a request to the [Cancel Swap API Route](https:
```tsx
import { useAdminCancelSwap } from "medusa-react"
const CancelSwap = () => {
type Props = {
orderId: string,
swapId: string
}
const Swap = ({
orderId,
swapId
}: Props) => {
const cancelSwap = useAdminCancelSwap(
orderId
)
// ...
const handleCancel = () => {
cancelSwap.mutate(swapId)
cancelSwap.mutate(swapId, {
onSuccess: ({ order }) => {
console.log(order.swaps)
}
})
}
// ...
}
export default CancelSwap
export default Swap
```
</TabItem>
@@ -158,22 +158,32 @@ You can create the return by sending a request to the [Create Return API Route](
```tsx
import { useCreateReturn } from "medusa-react"
const CreateReturn = () => {
type CreateReturnData = {
items: {
item_id: string,
quantity: number
}[]
return_shipping: {
option_id: string
}
}
type Props = {
orderId: string
}
const CreateReturn = ({ orderId }: Props) => {
const createReturn = useCreateReturn()
// ...
const handleCreate = () => {
const handleCreate = (data: CreateReturnData) => {
createReturn.mutate({
order_id,
items: [
{
item_id,
quantity: 1,
},
],
return_shipping: {
option_id,
},
...data,
order_id: orderId
}, {
onSuccess: ({ return: returnData }) => {
console.log(returnData.id)
}
})
}
@@ -113,6 +113,10 @@ After collecting the swap details in step 1, you can create a swap in the Medusa
},
],
return_shipping_option,
}, {
onSuccess: ({ swap }) => {
console.log(swap.id)
}
})
}
@@ -205,8 +209,11 @@ During your checkout flow, you might need to retrieve the swap using the cart’
```tsx
import { useCartSwap } from "medusa-react"
type Props = {
cartId: string
}
const Swap = () => {
const Swap = ({ cartId }: Props) => {
const {
swap,
isLoading,
@@ -89,10 +89,25 @@ You can retrieve a single order edit by its ID by sending a request to the [Get
```tsx
import { useOrderEdit } from "medusa-react"
const OrderEdit = () => {
type Props = {
orderEditId: string
}
const OrderEdit = ({ orderEditId }: Props) => {
const { order_edit, isLoading } = useOrderEdit(orderEditId)
// ...
return (
<div>
{isLoading && <span>Loading...</span>}
{order_edit && (
<ul>
{order_edit.changes.map((change) => (
<li key={change.id}>{change.type}</li>
))}
</ul>
)}
</div>
)
}
export default OrderEdit
@@ -220,7 +235,13 @@ If `difference_due` is greater than 0, then additional payment from the customer
```tsx
import { useManagePaymentSession } from "medusa-react"
const OrderEditPayment = () => {
type Props = {
paymentCollectionId: string
}
const OrderEditPayment = ({
paymentCollectionId
}: Props) => {
const managePaymentSession = useManagePaymentSession(
paymentCollectionId
)
@@ -229,6 +250,10 @@ If `difference_due` is greater than 0, then additional payment from the customer
const handleAdditionalPayment = (provider_id: string) => {
managePaymentSession.mutate({
provider_id,
}, {
onSuccess: ({ payment_collection }) => {
console.log(payment_collection.payment_sessions)
}
})
}
@@ -279,8 +304,8 @@ If `difference_due` is greater than 0, then additional payment from the customer
paymentCollectionId,
paymentSessionId
)
.then(({ payment_session }) => {
console.log(payment_session.id)
.then(({ payment_collection }) => {
console.log(payment_collection.payment_sessions)
})
```
@@ -290,14 +315,24 @@ If `difference_due` is greater than 0, then additional payment from the customer
```tsx
import { useAuthorizePaymentSession } from "medusa-react"
const OrderEditPayment = () => {
type Props = {
paymentCollectionId: string
}
const OrderEditPayment = ({
paymentCollectionId
}: Props) => {
const authorizePaymentSession = useAuthorizePaymentSession(
paymentCollectionId
)
// ...
const handleAuthorizePayment = (paymentSessionId: string) => {
authorizePaymentSession.mutate(paymentSessionId)
authorizePaymentSession.mutate(paymentSessionId, {
onSuccess: ({ payment_collection }) => {
console.log(payment_collection.payment_sessions)
}
})
}
// ...
@@ -321,8 +356,8 @@ If `difference_due` is greater than 0, then additional payment from the customer
}
)
.then((response) => response.json())
.then(({ payment_session }) => {
console.log(payment_session.id)
.then(({ payment_collection }) => {
console.log(payment_collection.payment_sessions)
})
```
@@ -353,12 +388,22 @@ To confirm and complete the order edit, send a request to the [Complete Order Ed
```tsx
import { useCompleteOrderEdit } from "medusa-react"
const OrderEdit = () => {
const completeOrderEdit = useCompleteOrderEdit(orderEditId)
type Props = {
orderEditId: string
}
const OrderEdit = ({ orderEditId }: Props) => {
const completeOrderEdit = useCompleteOrderEdit(
orderEditId
)
// ...
const handleCompleteOrderEdit = () => {
completeOrderEdit.mutate()
completeOrderEdit.mutate(void 0, {
onSuccess: ({ order_edit }) => {
console.log(order_edit.confirmed_at)
}
})
}
// ...
@@ -422,13 +467,23 @@ If the customer wants to decline the Order Edit, you can do that by sending a re
```tsx
import { useDeclineOrderEdit } from "medusa-react"
const OrderEdit = () => {
type Props = {
orderEditId: string
}
const OrderEdit = ({ orderEditId }: Props) => {
const declineOrderEdit = useDeclineOrderEdit(orderEditId)
// ...
const handleDeclineOrderEdit = () => {
const handleDeclineOrderEdit = (
declinedReason: string
) => {
declineOrderEdit.mutate({
declined_reason: "I am not satisfied",
declined_reason: declinedReason,
}, {
onSuccess: ({ order_edit }) => {
console.log(order_edit.declined_at)
}
})
}
@@ -96,6 +96,36 @@ To allow the customer to claim an order, send a request to the Claim an Order AP
})
```
</TabItem>
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useRequestOrderAccess } from "medusa-react"
const ClaimOrder = () => {
const claimOrder = useRequestOrderAccess()
const handleClaimOrder = (
orderIds: string[]
) => {
claimOrder.mutate({
order_ids: orderIds
}, {
onSuccess: () => {
// successful
},
onError: () => {
// an error occurred.
}
})
}
// ...
}
export default ClaimOrder
```
</TabItem>
<TabItem value="fetch" label="Fetch API">
@@ -159,15 +189,23 @@ Then, you send a request to the Verify Claim Order API Route:
import { useGrantOrderAccess } from "medusa-react"
const ClaimOrder = () => {
const grantOrderAccess = useGrantOrderAccess()
// ...
const confirmOrderRequest = useGrantOrderAccess()
const handleVerifyOrderClaim = (token: string) => {
grantOrderAccess.mutate(({
token,
}))
const handleOrderRequestConfirmation = (
token: string
) => {
confirmOrderRequest.mutate({
token
}, {
onSuccess: () => {
// successful
},
onError: () => {
// an error occurred.
}
})
}
// ...
}
@@ -54,7 +54,11 @@ You can retrieve an order by its ID using the [Get Order API Route](https://docs
```tsx
import { useOrder } from "medusa-react"
const Order = () => {
type Props = {
orderId: string
}
const Order = ({ orderId }: Props) => {
const {
order,
isLoading,
@@ -119,13 +123,21 @@ You can retrieve an order by its display ID using the [Look Up Order API Route](
```tsx
import { useOrders } from "medusa-react"
const Order = () => {
type Props = {
displayId: number
email: string
}
const Order = ({
displayId,
email
}: Props) => {
const {
order,
isLoading,
} = useOrders({
display_id: 1,
email: "user@example.com",
display_id: displayId,
email,
})
return (
@@ -191,7 +203,11 @@ You can retrieve an order by the cart ID using the [Get by Cart ID API Route](ht
```tsx
import { useCartOrder } from "medusa-react"
const Order = () => {
type Props = {
cartId: string
}
const Order = ({ cartId }: Props) => {
const {
order,
isLoading,
@@ -350,7 +350,11 @@ You can retrieve all the details of the batch job, including its status and the
```tsx
import { useAdminBatchJob } from "medusa-react"
const ImportPrices = () => {
type Props = {
batchJobId: string
}
const ImportPrices = ({ batchJobId }: Props) => {
const { batch_job, isLoading } = useAdminBatchJob(batchJobId)
// ...
@@ -440,7 +444,11 @@ To confirm a batch job send the following request:
```tsx
import { useAdminConfirmBatchJob } from "medusa-react"
const ImportPrices = () => {
type Props = {
batchJobId: string
}
const BatchJob = ({ batchJobId }: Props) => {
const confirmBatchJob = useAdminConfirmBatchJob(batchJobId)
// ...
@@ -114,36 +114,36 @@ For example, sending the following request creates a price list with two prices:
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminCreatePriceList } from "medusa-react"
import {
PriceListStatus,
PriceListType,
} from "@medusajs/medusa"
import { useAdminCreatePriceList } from "medusa-react"
type CreateData = {
name: string
description: string
type: PriceListType
status: PriceListStatus
prices: {
amount: number
variant_id: string
currency_code: string
max_quantity: number
}[]
}
const CreatePriceList = () => {
const createPriceList = useAdminCreatePriceList()
// ...
const handleCreate = () => {
createPriceList.mutate({
name: "New Price List",
description: "A new price list",
type: PriceListType.SALE,
status: PriceListStatus.ACTIVE,
prices: [
{
amount: 1000,
variant_id,
currency_code: "eur",
max_quantity: 3,
},
{
amount: 1500,
variant_id,
currency_code: "eur",
min_quantity: 4,
},
],
const handleCreate = (
data: CreateData
) => {
createPriceList.mutate(data, {
onSuccess: ({ price_list }) => {
console.log(price_list.id)
}
})
}
@@ -246,15 +246,20 @@ You can retrieve all of a price list’s details using the Get a Price List API
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { CustomerGroup } from "@medusajs/medusa"
import { useAdminPriceList } from "medusa-react"
const PriceList = () => {
type Props = {
priceListId: string
}
const PriceList = ({
priceListId
}: Props) => {
const {
price_list,
isLoading,
} = useAdminPriceList(priceListId)
return (
<div>
{isLoading && <span>Loading...</span>}
@@ -262,7 +267,7 @@ You can retrieve all of a price list’s details using the Get a Price List API
</div>
)
}
export default PriceList
```
@@ -314,26 +319,34 @@ For example, by sending the following request the end date of the price list wil
<TabItem value="medusa-react" label="Medusa React">
```tsx
import {
PriceListStatus,
PriceListType,
} from "@medusajs/medusa"
import { useAdminUpdatePriceList } from "medusa-react"
const CreatePriceList = () => {
type Props = {
priceListId: string
}
const PriceList = ({
priceListId
}: Props) => {
const updatePriceList = useAdminUpdatePriceList(priceListId)
// ...
const handleUpdate = () => {
const handleUpdate = (
endsAt: Date
) => {
updatePriceList.mutate({
ends_at: "2022-10-11",
ends_at: endsAt,
}, {
onSuccess: ({ price_list }) => {
console.log(price_list.ends_at)
}
})
}
// ...
}
export default CreatePriceList
export default PriceList
```
</TabItem>
@@ -411,25 +424,35 @@ For example, sending the following request adds a new price to the price list:
```tsx
import { useAdminCreatePriceListPrices } from "medusa-react"
const PriceList = () => {
const addPrice = useAdminCreatePriceListPrices(priceListId)
// ...
const handleAddPrice = () => {
addPrice.mutate({
prices: [
{
amount: 1200,
variant_id,
currency_code: "eur",
},
],
})
}
// ...
type PriceData = {
amount: number
variant_id: string
currency_code: string
}
type Props = {
priceListId: string
}
const PriceList = ({
priceListId
}: Props) => {
const addPrices = useAdminCreatePriceListPrices(priceListId)
// ...
const handleAddPrices = (prices: PriceData[]) => {
addPrices.mutate({
prices
}, {
onSuccess: ({ price_list }) => {
console.log(price_list.prices)
}
})
}
// ...
}
export default PriceList
```
@@ -508,24 +531,36 @@ You can delete all the prices of a product’s variants using the [Delete Produc
```tsx
import {
useAdminDeletePriceListProductPrices,
useAdminDeletePriceListProductPrices
} from "medusa-react"
const PriceList = () => {
const deletePrices = useAdminDeletePriceListProductPrices(
type Props = {
priceListId: string
productId: string
}
const PriceListProduct = ({
priceListId,
productId
}: Props) => {
const deleteProductPrices = useAdminDeletePriceListProductPrices(
priceListId,
productId
)
// ...
const handleDeletePrices = () => {
deletePrices.mutate()
const handleDeleteProductPrices = () => {
deleteProductPrices.mutate(void 0, {
onSuccess: ({ ids, deleted, object }) => {
console.log(ids)
}
})
}
// ...
}
export default PriceList
export default PriceListProduct
```
</TabItem>
@@ -582,25 +617,36 @@ You can delete all the prices of a variant using the [Delete Variant Prices API
```tsx
import {
useAdminDeletePriceListVariantPrices,
useAdminDeletePriceListVariantPrices
} from "medusa-react"
const PriceList = () => {
const deleteVariantPrices =
useAdminDeletePriceListVariantPrices(
priceListId,
variantId
)
type Props = {
priceListId: string
variantId: string
}
const PriceListVariant = ({
priceListId,
variantId
}: Props) => {
const deleteVariantPrices = useAdminDeletePriceListVariantPrices(
priceListId,
variantId
)
// ...
const handleDeletePrices = () => {
deleteVariantPrices.mutate()
const handleDeleteVariantPrices = () => {
deleteVariantPrices.mutate(void 0, {
onSuccess: ({ ids, deleted, object }) => {
console.log(ids)
}
})
}
// ...
}
export default PriceList
export default PriceListVariant
```
</TabItem>
@@ -657,12 +703,22 @@ You can delete a price list, and subsequently all prices defined in it, using th
```tsx
import { useAdminDeletePriceList } from "medusa-react"
const PriceList = () => {
type Props = {
priceListId: string
}
const PriceList = ({
priceListId
}: Props) => {
const deletePriceList = useAdminDeletePriceList(priceListId)
// ...
const handleDeletePriceList = () => {
deletePriceList.mutate()
const handleDelete = () => {
deletePriceList.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
@@ -889,7 +889,11 @@ You can do that by sending the following request to the [Upload Files API Route]
// ...
const handleFileUpload = (file: File) => {
uploadFile.mutate(file)
uploadFile.mutate(file, {
onSuccess: ({ uploads }) => {
console.log(uploads[0].key)
}
})
}
// ...
@@ -1067,7 +1071,11 @@ You can retrieve all the details of the batch job, including its status and the
```tsx
import { useAdminBatchJob } from "medusa-react"
const ImportProducts = () => {
type Props = {
batchJobId: string
}
const ImportProducts = ({ batchJobId }: Props) => {
const { batch_job, isLoading } = useAdminBatchJob(batchJobId)
// ...
@@ -1157,7 +1165,11 @@ To confirm a batch job send the following request:
```tsx
import { useAdminConfirmBatchJob } from "medusa-react"
const ImportProducts = () => {
type Props = {
batchJobId: string
}
const BatchJob = ({ batchJobId }: Props) => {
const confirmBatchJob = useAdminConfirmBatchJob(batchJobId)
// ...
@@ -69,12 +69,12 @@ You can retrieve available categories by sending a request to the [List Categori
```tsx
import { useAdminProductCategories } from "medusa-react"
import { ProductCategory } from "@medusajs/medusa"
function Categories() {
const {
product_categories,
isLoading } = useAdminProductCategories()
isLoading
} = useAdminProductCategories()
return (
<div>
@@ -85,7 +85,7 @@ You can retrieve available categories by sending a request to the [List Categori
{product_categories && product_categories.length > 0 && (
<ul>
{product_categories.map(
(category: ProductCategory) => (
(category) => (
<li key={category.id}>{category.name}</li>
)
)}
@@ -155,9 +155,15 @@ You can create a category by sending a request to the [Create a Category API Rou
const createCategory = useAdminCreateProductCategory()
// ...
const handleCreate = () => {
const handleCreate = (
name: string
) => {
createCategory.mutate({
name: "Skinny Jeans",
name,
}, {
onSuccess: ({ product_category }) => {
console.log(product_category.id)
}
})
}
@@ -233,7 +239,13 @@ You can retrieve a product category by sending a request to the [Get a Product C
```tsx
import { useAdminProductCategory } from "medusa-react"
const Category = () => {
type Props = {
productCategoryId: string
}
const Category = ({
productCategoryId
}: Props) => {
const {
product_category,
isLoading,
@@ -305,22 +317,34 @@ You can edit a product category by sending a request to the [Update a Product Ca
```tsx
import { useAdminUpdateProductCategory } from "medusa-react"
const UpdateCategory = () => {
type Props = {
productCategoryId: string
}
const Category = ({
productCategoryId
}: Props) => {
const updateCategory = useAdminUpdateProductCategory(
productCategoryId
)
// ...
const handleUpdate = () => {
const handleUpdate = (
name: string
) => {
updateCategory.mutate({
name: "Skinny Jeans",
name,
}, {
onSuccess: ({ product_category }) => {
console.log(product_category.id)
}
})
}
// ...
}
export default UpdateCategory
export default Category
```
</TabItem>
@@ -407,29 +431,34 @@ You can add more than one product to a category using the [Add Products to a Cat
```tsx
import { useAdminAddProductsToCategory } from "medusa-react"
const UpdateProductsInCategory = () => {
const addProductsToCategory = useAdminAddProductsToCategory(
type Props = {
productCategoryId: string
}
const Category = ({
productCategoryId
}: Props) => {
const addProducts = useAdminAddProductsToCategory(
productCategoryId
)
// ...
const handleAdd = () => {
addProductsToCategory.mutate({
product_ids: [
{
id: productId1,
},
{
id: productId2,
},
],
const handleAddProducts = (
productIds: ProductsData[]
) => {
addProducts.mutate({
product_ids: productIds
}, {
onSuccess: ({ product_category }) => {
console.log(product_category.products)
}
})
}
// ...
}
export default UpdateProductsInCategory
export default Category
```
</TabItem>
@@ -519,32 +548,40 @@ You can remove products from a category by sending a request to the [Delete Prod
<TabItem value="medusa-react" label="Medusa React">
```tsx
import {
useAdminDeleteProductsFromCategory,
} from "medusa-react"
import { useAdminDeleteProductsFromCategory } from "medusa-react"
const DeleteProductsFromCategory = () => {
const deleteProductsFromCategory =
useAdminDeleteProductsFromCategory(productCategoryId)
type ProductsData = {
id: string
}
type Props = {
productCategoryId: string
}
const Category = ({
productCategoryId
}: Props) => {
const deleteProducts = useAdminDeleteProductsFromCategory(
productCategoryId
)
// ...
const handleDelete = () => {
deleteProductsFromCategory.mutate({
product_ids: [
{
id: productId1,
},
{
id: productId2,
},
],
const handleDeleteProducts = (
productIds: ProductsData[]
) => {
deleteProducts.mutate({
product_ids: productIds
}, {
onSuccess: ({ product_category }) => {
console.log(product_category.products)
}
})
}
// ...
}
export default DeleteProductsFromCategory
export default Category
```
</TabItem>
@@ -626,14 +663,24 @@ You can delete a product category by sending a request to the [Delete a Product
```tsx
import { useAdminDeleteProductCategory } from "medusa-react"
const Category = () => {
type Props = {
productCategoryId: string
}
const Category = ({
productCategoryId
}: Props) => {
const deleteCategory = useAdminDeleteProductCategory(
productCategoryId
)
// ...
const handleDelete = () => {
deleteCategory.mutate()
deleteCategory.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
@@ -238,6 +238,10 @@ You can create a product by sending a request to the [Create a Product API Route
value: tagValue,
},
],
}, {
onSuccess: ({ product }) => {
console.log(product.id)
}
})
}
@@ -417,7 +421,11 @@ You can retrieve a single product as an admin by sending a request to the [Get a
```tsx
import { useAdminProduct } from "medusa-react"
const Product = () => {
type Props = {
productId: string
}
const Product = ({ productId }: Props) => {
const {
product,
isLoading,
@@ -487,22 +495,32 @@ You can update a product by sending a request to the [Update Product API Route](
```tsx
import { useAdminUpdateProduct } from "medusa-react"
const UpdateProduct = () => {
type Props = {
productId: string
}
const Product = ({ productId }: Props) => {
const updateProduct = useAdminUpdateProduct(
productId
)
// ...
const handleUpdate = () => {
const handleUpdate = (
title: string
) => {
updateProduct.mutate({
title: "Shirt",
title,
}, {
onSuccess: ({ product }) => {
console.log(product.id)
}
})
}
// ...
}
export default UpdateProduct
export default Product
```
</TabItem>
@@ -578,15 +596,27 @@ You can add a product option to a product by sending a request to the [Add Produ
```tsx
import { useAdminCreateProductOption } from "medusa-react"
const CreateProductOption = () => {
type Props = {
productId: string
}
const CreateProductOption = ({
productId
}: Props) => {
const createOption = useAdminCreateProductOption(
productId
)
// ...
const handleCreate = () => {
const handleCreate = (
title: string
) => {
createOption.mutate({
title: "Size",
title
}, {
onSuccess: ({ product }) => {
console.log(product.options)
}
})
}
@@ -657,23 +687,37 @@ You can update a product option by sending a request to the [Update Product Opti
```tsx
import { useAdminUpdateProductOption } from "medusa-react"
const UpdateProductOption = () => {
type Props = {
productId: string
optionId: string
}
const ProductOption = ({
productId,
optionId
}: Props) => {
const updateOption = useAdminUpdateProductOption(
productId
)
// ...
const handleUpdate = () => {
const handleUpdate = (
title: string
) => {
updateOption.mutate({
option_id,
title: "Size",
option_id: optionId,
title,
}, {
onSuccess: ({ product }) => {
console.log(product.options)
}
})
}
// ...
}
export default UpdateProductOption
export default ProductOption
```
</TabItem>
@@ -739,20 +783,32 @@ You can delete a product option by sending a request to the [Delete Product Opti
```tsx
import { useAdminDeleteProductOption } from "medusa-react"
const DeleteProductOption = () => {
type Props = {
productId: string
optionId: string
}
const ProductOption = ({
productId,
optionId
}: Props) => {
const deleteOption = useAdminDeleteProductOption(
productId
)
// ...
const handleDelete = () => {
deleteOption.mutate(option_id)
deleteOption.mutate(optionId, {
onSuccess: ({ option_id, object, deleted, product }) => {
console.log(product.options)
}
})
}
// ...
}
export default DeleteProductOption
export default ProductOption
```
</TabItem>
@@ -835,27 +891,35 @@ You can create a product variant by sending a request to the [Create Product Var
```tsx
import { useAdminCreateVariant } from "medusa-react"
const CreateProductVariant = () => {
type CreateVariantData = {
title: string
prices: {
amount: number
currency_code: string
}[]
options: {
option_id: string
value: string
}[]
}
type Props = {
productId: string
}
const CreateProductVariant = ({ productId }: Props) => {
const createVariant = useAdminCreateVariant(
productId
)
// ...
const handleCreate = () => {
createVariant.mutate({
title: "White Shirt",
prices: [
{
amount: 1000,
currency_code: "USD",
},
],
options: [
{
option_id,
value: "White",
},
],
const handleCreate = (
variantData: CreateVariantData
) => {
createVariant.mutate(variantData, {
onSuccess: ({ product }) => {
console.log(product.variants)
}
})
}
@@ -958,23 +1022,35 @@ You can update a product variant by sending a request to the [Update a Product V
```tsx
import { useAdminUpdateVariant } from "medusa-react"
const UpdateProductVariant = () => {
type Props = {
productId: string
variantId: string
}
const ProductVariant = ({
productId,
variantId
}: Props) => {
const updateVariant = useAdminUpdateVariant(
productId
)
// ...
const handleUpdate = () => {
const handleUpdate = (title: string) => {
updateVariant.mutate({
variant_id,
title: "White Shirt",
variant_id: variantId,
title,
}, {
onSuccess: ({ product }) => {
console.log(product.variants)
}
})
}
// ...
}
export default UpdateProductVariant
export default ProductVariant
```
</TabItem>
@@ -1040,20 +1116,32 @@ You can delete a product variant by sending a request to the [Delete a Product V
```tsx
import { useAdminDeleteVariant } from "medusa-react"
const DeleteProductVariant = () => {
type Props = {
productId: string
variantId: string
}
const ProductVariant = ({
productId,
variantId
}: Props) => {
const deleteVariant = useAdminDeleteVariant(
productId
)
// ...
const handleDelete = () => {
deleteVariant.mutate(variant_id)
deleteVariant.mutate(variantId, {
onSuccess: ({ variant_id, object, deleted, product }) => {
console.log(product.variants)
}
})
}
// ...
}
export default DeleteProductVariant
export default ProductVariant
```
</TabItem>
@@ -1114,20 +1202,28 @@ You can delete a product by sending a request to the [Delete a Product API Route
```tsx
import { useAdminDeleteProduct } from "medusa-react"
const DeleteProduct = () => {
type Props = {
productId: string
}
const Product = ({ productId }: Props) => {
const deleteProduct = useAdminDeleteProduct(
productId
)
// ...
const handleDelete = () => {
deleteProduct.mutate()
deleteProduct.mutate(void 0, {
onSuccess: ({ id, object, deleted}) => {
console.log(id)
}
})
}
// ...
}
export default DeleteProduct
export default Product
```
</TabItem>
@@ -662,7 +662,11 @@ You can retrieve the details of a single product by its ID using the [Get a Prod
```tsx
import { useProduct } from "medusa-react"
const Products = () => {
type Props = {
productId: string
}
const Product = ({ productId }: Props) => {
const { product, isLoading } = useProduct(productId)
return (
@@ -673,7 +677,7 @@ You can retrieve the details of a single product by its ID using the [Get a Prod
)
}
export default Products
export default Product
```
</TabItem>
@@ -71,7 +71,6 @@ You can list product categories by sending a request to the [List Product Catego
```tsx
import { useProductCategories } from "medusa-react"
import { ProductCategory } from "@medusajs/medusa"
function Categories() {
const {
@@ -88,7 +87,7 @@ You can list product categories by sending a request to the [List Product Catego
{product_categories && product_categories.length > 0 && (
<ul>
{product_categories.map(
(category: ProductCategory) => (
(category) => (
<li key={category.id}>{category.name}</li>
)
)}
@@ -178,8 +177,14 @@ You can retrieve a single product category by its ID using the [Get a Product Ca
```tsx
import { useProductCategory } from "medusa-react"
function Category() {
const { product_category, isLoading } = useProductCategory()
type Props = {
categoryId: string
}
const Category = ({ categoryId }: Props) => {
const { product_category, isLoading } = useProductCategory(
categoryId
)
return (
<div>
@@ -154,20 +154,24 @@ You can update a currency by sending a request to the [Update Currency API Route
```tsx
import { useAdminUpdateCurrency } from "medusa-react"
const UpdateCode = () => {
const updateCode = useAdminUpdateCurrency(code)
const Currency = (currencyCode: string) => {
const updateCurrency = useAdminUpdateCurrency(currencyCode)
// ...
const handleUpdate = () => {
updateCode.mutate({
const handleUpdate = (includes_tax: boolean) => {
updateCurrency.mutate({
includes_tax,
}, {
onSuccess: ({ currency }) => {
console.log(currency)
}
})
}
// ...
}
export default UpdateCode
export default Currency
```
</TabItem>
@@ -321,18 +325,22 @@ You can add a currency to a store using the [Add a Currency Code API Route](http
```tsx
import { useAdminAddStoreCurrency } from "medusa-react"
const AddCurrency = () => {
const addCode = useAdminAddStoreCurrency()
const Store = () => {
const addCurrency = useAdminAddStoreCurrency()
// ...
const handleAdd = () => {
addCode.mutate(code)
const handleAdd = (code: string) => {
addCurrency.mutate(code, {
onSuccess: ({ store }) => {
console.log(store.currencies)
}
})
}
// ...
}
export default AddCurrency
export default Store
```
</TabItem>
@@ -384,18 +392,22 @@ You can remove a currency from a store by sending a request to the [Delete Curre
```tsx
import { useAdminDeleteStoreCurrency } from "medusa-react"
const DeleteCurrency = () => {
const Store = () => {
const deleteCurrency = useAdminDeleteStoreCurrency()
// ...
const handleDelete = () => {
deleteCurrency.mutate(code)
const handleAdd = (code: string) => {
deleteCurrency.mutate(code, {
onSuccess: ({ store }) => {
console.log(store.currencies)
}
})
}
// ...
}
export default DeleteCurrency
export default Store
```
</TabItem>
@@ -77,7 +77,6 @@ You can retrieve regions available on your backend using the [List Regions API R
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { Region } from "@medusajs/medusa"
import { useAdminRegions } from "medusa-react"
const Regions = () => {
@@ -89,7 +88,7 @@ You can retrieve regions available on your backend using the [List Regions API R
{regions && !regions.length && <span>No Regions</span>}
{regions && regions.length > 0 && (
<ul>
{regions.map((region: Region) => (
{regions.map((region) => (
<li key={region.id}>{region.name}</li>
))}
</ul>
@@ -183,6 +182,10 @@ You can create a region by sending a request to the [Create a Region API Route](
countries: [
"DK",
],
}, {
onSuccess: ({ region }) => {
console.log(region.id)
}
})
}
@@ -291,23 +294,32 @@ Alternatively, you can update the details of a region using the [Update a Region
```tsx
import { useAdminUpdateRegion } from "medusa-react"
const UpdateRegion = () => {
type Props = {
regionId: string
}
const Region = ({
regionId
}: Props) => {
const updateRegion = useAdminUpdateRegion(regionId)
// ...
const handleUpdate = () => {
const handleUpdate = (
countries: string[]
) => {
updateRegion.mutate({
countries: [
"DK",
"DE",
],
countries,
}, {
onSuccess: ({ region }) => {
console.log(region.id)
}
})
}
// ...
}
export default UpdateRegion
export default Region
```
</TabItem>
@@ -393,7 +405,11 @@ You can add a shipping option to a region by sending a request to the [Create Sh
```tsx
import { useAdminCreateShippingOption } from "medusa-react"
const Region = () => {
type Props = {
regionId: string
}
const Region = ({ regionId }: Props) => {
const createShippingOption = useAdminCreateShippingOption()
// ...
@@ -406,6 +422,10 @@ You can add a shipping option to a region by sending a request to the [Create Sh
},
price_type: "flat_rate",
amount: 1000,
}, {
onSuccess: ({ shipping_option }) => {
console.log(shipping_option.id)
}
})
}
@@ -504,12 +524,20 @@ You can delete a region by sending a request to the [Delete a Region API Route](
```tsx
import { useAdminDeleteRegion } from "medusa-react"
const Region = () => {
type Props = {
regionId: string
}
const Region = ({ regionId }: Props) => {
const deleteRegion = useAdminDeleteRegion(regionId)
// ...
const handleDelete = () => {
deleteRegion.mutate()
deleteRegion.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
@@ -69,7 +69,6 @@ You can retrieve available regions by sending a request to the [List Regions API
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { Region } from "@medusajs/medusa"
import { useRegions } from "medusa-react"
const Regions = () => {
@@ -80,7 +79,7 @@ You can retrieve available regions by sending a request to the [List Regions API
{isLoading && <span>Loading...</span>}
{regions?.length && (
<ul>
{regions.map((region: Region) => (
{regions.map((region) => (
<li key={region.id}>
{region.name}
</li>
@@ -81,6 +81,10 @@ You can create a sales channel by sending a request to the Create a Sales Channe
createSalesChannel.mutate({
name,
description,
}, {
onSuccess: ({ sales_channel }) => {
console.log(sales_channel.id)
}
})
}
@@ -151,7 +155,6 @@ You can list all sales channels by sending a request to the List Sales Channels
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { SalesChannel } from "@medusajs/medusa"
import { useAdminSalesChannels } from "medusa-react"
const SalesChannels = () => {
@@ -165,7 +168,7 @@ You can list all sales channels by sending a request to the List Sales Channels
)}
{sales_channels && sales_channels.length > 0 && (
<ul>
{sales_channels.map((salesChannel: SalesChannel) => (
{sales_channels.map((salesChannel) => (
<li key={salesChannel.id}>{salesChannel.name}</li>
))}
</ul>
@@ -224,8 +227,12 @@ You can retrieve a sales channel’s details by its ID using the Get Sales Chann
```tsx
import { useAdminSalesChannel } from "medusa-react"
const SalesChannel = () => {
type Props = {
salesChannelId: string
}
const SalesChannel = ({ salesChannelId }: Props) => {
const {
sales_channel,
isLoading,
@@ -292,22 +299,32 @@ You can update a Sales Channel’s details and attributes by sending a request t
```tsx
import { useAdminUpdateSalesChannel } from "medusa-react"
const UpdateSalesChannel = () => {
type Props = {
salesChannelId: string
}
const SalesChannel = ({ salesChannelId }: Props) => {
const updateSalesChannel = useAdminUpdateSalesChannel(
salesChannelId
)
// ...
const handleUpdate = () => {
const handleUpdate = (
is_disabled: boolean
) => {
updateSalesChannel.mutate({
is_disabled: false,
is_disabled,
}, {
onSuccess: ({ sales_channel }) => {
console.log(sales_channel.is_disabled)
}
})
}
// ...
}
export default UpdateSalesChannel
export default SalesChannel
```
</TabItem>
@@ -373,14 +390,22 @@ You can delete a sales channel by sending a request to the Delete Sales Channel
```tsx
import { useAdminDeleteSalesChannel } from "medusa-react"
const SalesChannel = () => {
type Props = {
salesChannelId: string
}
const SalesChannel = ({ salesChannelId }: Props) => {
const deleteSalesChannel = useAdminDeleteSalesChannel(
salesChannelId
)
// ...
const handleDelete = () => {
deleteSalesChannel.mutate()
deleteSalesChannel.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
@@ -446,7 +471,11 @@ To add a product to a sales channel, send a request to the Sales Channel’s Add
```tsx
import { useAdminAddProductsToSalesChannel } from "medusa-react"
const SalesChannel = () => {
type Props = {
salesChannelId: string
}
const SalesChannel = ({ salesChannelId }: Props) => {
const addProducts = useAdminAddProductsToSalesChannel(
salesChannelId
)
@@ -459,6 +488,10 @@ To add a product to a sales channel, send a request to the Sales Channel’s Add
id: productId,
},
],
}, {
onSuccess: ({ sales_channel }) => {
console.log(sales_channel.id)
}
})
}
@@ -642,7 +675,11 @@ You can delete a product from a sales channel by sending a request to the Sales
useAdminDeleteProductsFromSalesChannel,
} from "medusa-react"
const SalesChannel = () => {
type Props = {
salesChannelId: string
}
const SalesChannel = ({ salesChannelId }: Props) => {
const deleteProducts = useAdminDeleteProductsFromSalesChannel(
salesChannelId
)
@@ -655,6 +692,10 @@ You can delete a product from a sales channel by sending a request to the Sales
id: productId,
},
],
}, {
onSuccess: ({ sales_channel }) => {
console.log(sales_channel.id)
}
})
}
@@ -291,16 +291,28 @@ You can create a tax rate by sending a request to the [Create Tax Rate API Route
```tsx
import { useAdminCreateTaxRate } from "medusa-react"
const CreateTaxRate = () => {
type Props = {
regionId: string
}
const CreateTaxRate = ({ regionId }: Props) => {
const createTaxRate = useAdminCreateTaxRate()
// ...
const handleCreate = () => {
const handleCreate = (
code: string,
name: string,
rate: number
) => {
createTaxRate.mutate({
code: "TEST",
name: "New Tax Rate",
region_id,
rate: 10,
code,
name,
region_id: regionId,
rate,
}, {
onSuccess: ({ tax_rate }) => {
console.log(tax_rate.id)
}
})
}
@@ -391,20 +403,30 @@ You can update a tax rate by sending a request to the [Update Tax Rate API Route
```tsx
import { useAdminUpdateTaxRate } from "medusa-react"
const UpdateTaxRate = () => {
type Props = {
taxRateId: string
}
const TaxRate = ({ taxRateId }: Props) => {
const updateTaxRate = useAdminUpdateTaxRate(taxRateId)
// ...
const handleUpdate = () => {
const handleUpdate = (
name: string
) => {
updateTaxRate.mutate({
name: "New Tax Rate",
name
}, {
onSuccess: ({ tax_rate }) => {
console.log(tax_rate.name)
}
})
}
// ...
}
export default UpdateTaxRate
export default TaxRate
```
</TabItem>
@@ -478,22 +500,28 @@ You can add a product to a tax rate by sending a request to the [Add Products AP
```tsx
import { useAdminCreateProductTaxRates } from "medusa-react"
const AddProduct = () => {
type Props = {
taxRateId: string
}
const TaxRate = ({ taxRateId }: Props) => {
const addProduct = useAdminCreateProductTaxRates(taxRateId)
// ...
const handleAdd = () => {
const handleAddProduct = (productIds: string[]) => {
addProduct.mutate({
products: [
productId1,
],
products: productIds,
}, {
onSuccess: ({ tax_rate }) => {
console.log(tax_rate.products)
}
})
}
// ...
}
export default AddProduct
export default TaxRate
```
</TabItem>
@@ -567,22 +595,26 @@ You can remove a product from a tax rate by sending a request to the [Delete Pro
```tsx
import { useAdminDeleteProductTaxRates } from "medusa-react"
const RemoveProduct = () => {
const TaxRate = (
taxRateId: string
) => {
const removeProduct = useAdminDeleteProductTaxRates(taxRateId)
// ...
const handleRemove = () => {
const handleRemoveProduct = (productIds: string[]) => {
removeProduct.mutate({
products: [
productId1,
],
products: productIds,
}, {
onSuccess: ({ tax_rate }) => {
console.log(tax_rate.products)
}
})
}
// ...
}
export default RemoveProduct
export default TaxRate
```
</TabItem>
@@ -664,24 +696,30 @@ You can add a product type to a tax rate by sending a request to the [Add Produc
useAdminCreateProductTypeTaxRates,
} from "medusa-react"
const AddProductTypes = () => {
type Props = {
taxRateId: string
}
const TaxRate = ({ taxRateId }: Props) => {
const addProductTypes = useAdminCreateProductTypeTaxRates(
taxRateId
)
// ...
const handleAdd = () => {
const handleAddProductTypes = (productTypeIds: string[]) => {
addProductTypes.mutate({
product_types: [
productTypeId,
],
product_types: productTypeIds,
}, {
onSuccess: ({ tax_rate }) => {
console.log(tax_rate.product_types)
}
})
}
// ...
}
export default AddProductTypes
export default TaxRate
```
</TabItem>
@@ -757,24 +795,32 @@ You can remove a product type from a tax rate by sending a request to the [Delet
useAdminDeleteProductTypeTaxRates,
} from "medusa-react"
const RemoveProductTypes = () => {
type Props = {
taxRateId: string
}
const TaxRate = ({ taxRateId }: Props) => {
const removeProductTypes = useAdminDeleteProductTypeTaxRates(
taxRateId
)
// ...
const handleRemove = () => {
const handleRemoveProductTypes = (
productTypeIds: string[]
) => {
removeProductTypes.mutate({
product_types: [
productTypeId,
],
product_types: productTypeIds,
}, {
onSuccess: ({ tax_rate }) => {
console.log(tax_rate.product_types)
}
})
}
// ...
}
export default RemoveProductTypes
export default TaxRate
```
</TabItem>
@@ -854,24 +900,32 @@ You can add a shipping option to a tax rate by sending a request to the [Add Shi
```tsx
import { useAdminCreateShippingTaxRates } from "medusa-react"
const AddShippingOptions = () => {
type Props = {
taxRateId: string
}
const TaxRate = ({ taxRateId }: Props) => {
const addShippingOption = useAdminCreateShippingTaxRates(
taxRateId
)
// ...
const handleAdd = () => {
const handleAddShippingOptions = (
shippingOptionIds: string[]
) => {
addShippingOption.mutate({
shipping_options: [
shippingOptionId,
],
shipping_options: shippingOptionIds,
}, {
onSuccess: ({ tax_rate }) => {
console.log(tax_rate.shipping_options)
}
})
}
// ...
}
export default AddShippingOptions
export default TaxRate
```
</TabItem>
@@ -945,24 +999,30 @@ You can remove a shipping option from a tax rate by sending a request to the [De
```tsx
import { useAdminDeleteShippingTaxRates } from "medusa-react"
const RemoveShippingOptions = () => {
const TaxRate = (
taxRateId: string
) => {
const removeShippingOptions = useAdminDeleteShippingTaxRates(
taxRateId
)
// ...
const handleRemove = () => {
const handleRemoveShippingOptions = (
shippingOptionIds: string[]
) => {
removeShippingOptions.mutate({
shipping_options: [
shippingOptionId,
],
shipping_options: shippingOptionIds,
}, {
onSuccess: ({ tax_rate }) => {
console.log(tax_rate.shipping_options)
}
})
}
// ...
}
export default RemoveShippingOptions
export default TaxRate
```
</TabItem>
@@ -1034,18 +1094,26 @@ You can delete a tax rate by sending a request to the [Delete Tax Rate API Route
```tsx
import { useAdminDeleteTaxRate } from "medusa-react"
const DeleteTaxRate = () => {
type Props = {
taxRateId: string
}
const TaxRate = ({ taxRateId }: Props) => {
const deleteTaxRate = useAdminDeleteTaxRate(taxRateId)
// ...
const handleDelete = () => {
deleteTaxRate.mutate()
deleteTaxRate.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
}
export default DeleteTaxRate
export default TaxRate
```
</TabItem>
@@ -148,20 +148,24 @@ You can change the tax provider of a region using the [Update Region API Route](
```tsx
import { useAdminUpdateRegion } from "medusa-react"
const UpdateRegion = () => {
type Props = {
regionId: string
}
const Region = ({ regionId }: Props) => {
const updateRegion = useAdminUpdateRegion(regionId)
// ...
const handleUpdate = () => {
const handleUpdate = (taxProviderId: string) => {
updateRegion.mutate({
tax_provider_id,
tax_provider_id: taxProviderId,
})
}
// ...
}
export default UpdateRegion
export default Region
```
</TabItem>
@@ -233,24 +237,30 @@ In addition to changing the tax provider, you can use the same [Update Region AP
```tsx
import { useAdminUpdateRegion } from "medusa-react"
const UpdateRegion = () => {
type RegionData = {
tax_provider_id: string
automatic_taxes?: boolean
gift_cards_taxable?: boolean
tax_code: string
tax_rate: number
}
type Props = {
regionId: string
}
const Region = ({ regionId }: Props) => {
const updateRegion = useAdminUpdateRegion(regionId)
// ...
const handleUpdate = () => {
updateRegion.mutate({
tax_provider_id,
automatic_taxes,
gift_cards_taxable,
tax_code,
tax_rate,
})
const handleUpdate = (data: RegionData) => {
updateRegion.mutate(data)
}
// ...
}
export default UpdateRegion
export default Region
```
</TabItem>
@@ -78,7 +78,9 @@ You can list invites by sending a request to the [List Invite API Route](https:/
return (
<div>
{isLoading && <span>Loading...</span>}
{invites && !invites.length && <span>No Invites</span>}
{invites && !invites.length && (
<span>No Invites</span>
)}
{invites && invites.length > 0 && (
<ul>
{invites.map((invite) => (
@@ -242,13 +244,18 @@ You can accept an invite by sending a request to the [Accept Invite API Route](h
const acceptInvite = useAdminAcceptInvite()
// ...
const handleAccept = () => {
const handleAccept = (
token: string,
firstName: string,
lastName: string,
password: string
) => {
acceptInvite.mutate({
token,
user: {
first_name: "Brigitte",
last_name: "Collier",
password: "supersecret",
first_name: firstName,
last_name: lastName,
password,
},
})
}
@@ -335,7 +342,11 @@ You can resend an invite if it’s not accepted yet. To resend an invite, send a
```tsx
import { useAdminResendInvite } from "medusa-react"
const ResendInvite = () => {
type Props = {
inviteId: string
}
const ResendInvite = ({ inviteId }: Props) => {
const resendInvite = useAdminResendInvite(inviteId)
// ...
@@ -400,18 +411,26 @@ You can delete an invite by sending a request to the [Delete Invite API Route](h
```tsx
import { useAdminDeleteInvite } from "medusa-react"
const DeleteInvite = () => {
type Props = {
inviteId: string
}
const DeleteInvite = ({ inviteId }: Props) => {
const deleteInvite = useAdminDeleteInvite(inviteId)
// ...
const handleDelete = () => {
deleteInvite.mutate()
deleteInvite.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
}
export default DeleteInvite
export default Invite
```
</TabItem>
@@ -283,17 +283,24 @@ You can update a user’s details in their profile by sending a request to the [
```tsx
import {
useAdminDeleteSession,
useAdminUpdateUser,
} from "medusa-react"
const Profile = () => {
type Props = {
userId: string
}
const Profile = ({ userId }: Props) => {
const updateUser = useAdminUpdateUser(userId)
// ...
const handleUpdate = () => {
const handleUpdate = (firstName: string) => {
updateUser.mutate({
first_name: "Marcellus",
first_name: firstName,
}, {
onSuccess: ({ user }) => {
console.log(user.first_name)
}
})
}
@@ -384,9 +391,15 @@ You can request a password reset by sending a request to the [Request Password R
const requestPasswordReset = useAdminSendResetPasswordToken()
// ...
const handleResetPassword = () => {
const handleResetPassword = (
email: string
) => {
requestPasswordReset.mutate({
email: "user@example.com",
email
}, {
onSuccess: () => {
// successful
}
})
}
@@ -463,10 +476,17 @@ You can reset the password by sending a request to the [Reset Password API Route
const resetPassword = useAdminResetPassword()
// ...
const handleResetPassword = () => {
const handleResetPassword = (
token: string,
password: string
) => {
resetPassword.mutate({
token: "supersecrettoken",
password: "supersecret",
token,
password,
}, {
onSuccess: ({ user }) => {
console.log(user.id)
}
})
}
@@ -153,6 +153,10 @@ You can create a user by sending a request to the [Create User API Route](https:
createUser.mutate({
email: "user@example.com",
password: "supersecret",
}, {
onSuccess: ({ user }) => {
console.log(user.id)
}
})
}
@@ -232,20 +236,30 @@ You can update a user’s details by sending a request to the [Update User API R
```tsx
import { useAdminUpdateUser } from "medusa-react"
const UpdateUser = () => {
type Props = {
userId: string
}
const User = ({ userId }: Props) => {
const updateUser = useAdminUpdateUser(userId)
// ...
const handleUpdateUser = () => {
const handleUpdateUser = (
firstName: string
) => {
updateUser.mutate({
first_name: "Marcellus",
first_name: firstName,
}, {
onSuccess: ({ user }) => {
console.log(user.first_name)
}
})
}
// ...
}
export default UpdateUser
export default User
```
</TabItem>
@@ -311,18 +325,26 @@ You can delete a user by sending a request to the [Delete User API Route](https:
```tsx
import { useAdminDeleteUser } from "medusa-react"
const DeleteUser = () => {
type Props = {
userId: string
}
const User = ({ userId }: Props) => {
const deleteUser = useAdminDeleteUser(userId)
// ...
const handleDeleteUser = () => {
deleteUser.mutate()
deleteUser.mutate(void 0, {
onSuccess: ({ id, object, deleted }) => {
console.log(id)
}
})
}
// ...
}
export default DeleteUser
export default User
```
</TabItem>
@@ -1,141 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# ICacheService
## Methods
### get
#### Type Parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Parameters
<ParameterTypes parameters={[
{
"name": "key",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;null \\| T&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "null \\| T",
"type": "`null` \\| `T`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
___
### invalidate
#### Parameters
<ParameterTypes parameters={[
{
"name": "key",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### set
#### Parameters
<ParameterTypes parameters={[
{
"name": "key",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "data",
"type": "`unknown`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ttl",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
@@ -1,362 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# CreateCartWorkflowInputDTO
## Properties
<ParameterTypes parameters={[
{
"name": "billing_address",
"type": "[AddressDTO](../../types/types/types.AddressDTO.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "address_1",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "address_2",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "city",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "company",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "country_code",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "phone",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "postal_code",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "province",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "billing_address_id",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "`object`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "country_code",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "customer_id",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "email",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "items",
"type": "[CreateLineItemInputDTO](types.WorkflowTypes.CartWorkflow.CreateLineItemInputDTO.mdx)[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "quantity",
"type": "`number`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variant_id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "region_id",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sales_channel_id",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "shipping_address",
"type": "[AddressDTO](../../types/types/types.AddressDTO.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "address_1",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "address_2",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "city",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "company",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "country_code",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "created_at",
"type": "`string` \\| `Date`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`string` \\| `Date` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "phone",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "postal_code",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "province",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`string` \\| `Date`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "shipping_address_id",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,26 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# CreateLineItemInputDTO
## Properties
<ParameterTypes parameters={[
{
"name": "quantity",
"type": "`number`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variant_id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,107 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# AddressCreatePayload
## Properties
<ParameterTypes parameters={[
{
"name": "address_1",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "address_2",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "city",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "company",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "country_code",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "first_name",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "last_name",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "phone",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "postal_code",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "province",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,107 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# AddressPayload
## Properties
<ParameterTypes parameters={[
{
"name": "address_1",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "address_2",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "city",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "company",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "country_code",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "first_name",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "last_name",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "phone",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "postal_code",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "province",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,35 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# BaseEntity
## Properties
<ParameterTypes parameters={[
{
"name": "created_at",
"type": "`Date`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,76 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# CustomFindOptions
## Type parameters
<ParameterTypes parameters={[
{
"name": "TModel",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "InKeys",
"type": "keyof `TModel`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Properties
<ParameterTypes parameters={[
{
"name": "order",
"type": "`OrderByCondition`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "select",
"type": "FindOptionsSelect&#60;TModel&#62; \\| FindOptionsSelectByString&#60;TModel&#62;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "skip",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "where",
"type": "FindOptionsWhere&#60;TModel&#62; & &#123; [P in string \\| number \\| symbol]?: TModel[P][] &#125; \\| FindOptionsWhere&#60;TModel&#62;[] & &#123; [P in string \\| number \\| symbol]?: TModel[P][] &#125;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,44 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# DateComparisonOperator
## Properties
<ParameterTypes parameters={[
{
"name": "gt",
"type": "`Date`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "gte",
"type": "`Date`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lt",
"type": "`Date`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lte",
"type": "`Date`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,79 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# FindConfig
An object that is used to configure how an entity is retrieved from the database. It accepts as a typed parameter an `Entity` class,
which provides correct typing of field names in its properties.
## Type parameters
<ParameterTypes parameters={[
{
"name": "Entity",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Properties
<ParameterTypes parameters={[
{
"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": []
}
]} />
@@ -1,26 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# FindPaginationParams
## Properties
<ParameterTypes parameters={[
{
"name": "limit",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,26 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# FindParams
## Properties
<ParameterTypes parameters={[
{
"name": "expand",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fields",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,44 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# NumericalComparisonOperator
## Properties
<ParameterTypes parameters={[
{
"name": "gt",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "gte",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lt",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lte",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,44 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# SoftDeletableEntity
## Properties
<ParameterTypes parameters={[
{
"name": "created_at",
"type": "`Date`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`null` \\| `Date`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,71 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# StringComparisonOperator
## Properties
<ParameterTypes parameters={[
{
"name": "contains",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ends_with",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "gt",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "gte",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lt",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lte",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "starts_with",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,284 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# ConfigModule
**ConfigModule**: `Object`
## Type declaration
<ParameterTypes parameters={[
{
"name": "featureFlags",
"type": "`Record<string, boolean \\| string>`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "modules",
"type": "`Record<string, boolean \\| Partial&#60;[InternalModuleDeclaration](../../ModulesSdkTypes/types/types.ModulesSdkTypes.InternalModuleDeclaration.mdx) \\| [ExternalModuleDeclaration](../../ModulesSdkTypes/types/types.ModulesSdkTypes.ExternalModuleDeclaration.mdx)&#62;>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "plugins",
"type": "(`object` \\| `string`)[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "projectConfig",
"type": "[ProjectConfigOptions](types.CommonTypes.ProjectConfigOptions.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "admin_cors",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "cookie_secret",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "database_database",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "database_extra",
"type": "`Record<string, unknown>` & `object`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ssl",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "database_logging",
"type": "`LoggerOptions`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "database_schema",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "database_type",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "database_url",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "http_compression",
"type": "[HttpCompressionOptions](types.CommonTypes.HttpCompressionOptions.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enabled",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "level",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "memLevel",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "threshold",
"type": "`number` \\| `string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "jwt_secret",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "redis_options",
"type": "`RedisOptions`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "redis_prefix",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "redis_url",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "session_options",
"type": "[SessionOptions](../../types/types/types.SessionOptions.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "name",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "resave",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rolling",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "saveUninitialized",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "secret",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ttl",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "store_cors",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
@@ -1,39 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# DeleteResponse
**DeleteResponse**: `Object`
The fields returned in the response of a DELETE request.
## Type declaration
<ParameterTypes parameters={[
{
"name": "deleted",
"type": "`boolean`",
"description": "Whether the item was deleted successfully.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the item that was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "object",
"type": "`string`",
"description": "The type of the item that was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,46 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# HttpCompressionOptions
**HttpCompressionOptions**: `Object`
## Type declaration
<ParameterTypes parameters={[
{
"name": "enabled",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "level",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "memLevel",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "threshold",
"type": "`number` \\| `string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,37 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# PaginatedResponse
**PaginatedResponse**: `Object`
## Type declaration
<ParameterTypes parameters={[
{
"name": "count",
"type": "`number`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,28 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# PartialPick
**PartialPick**: &#123; [P in K]?: T[P] &#125;
## Type Parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "K",
"type": "keyof `T`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,257 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# ProjectConfigOptions
**ProjectConfigOptions**: `Object`
## Type declaration
<ParameterTypes parameters={[
{
"name": "admin_cors",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "cookie_secret",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "database_database",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "database_extra",
"type": "`Record<string, unknown>` & `object`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ssl",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "rejectUnauthorized",
"type": "`false`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
},
{
"name": "database_logging",
"type": "`LoggerOptions`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "database_schema",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "database_type",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "database_url",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "http_compression",
"type": "[HttpCompressionOptions](types.CommonTypes.HttpCompressionOptions.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enabled",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "level",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "memLevel",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "threshold",
"type": "`number` \\| `string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "jwt_secret",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "redis_options",
"type": "`RedisOptions`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "redis_prefix",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "redis_url",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "session_options",
"type": "[SessionOptions](../../types/types/types.SessionOptions.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "name",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "resave",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rolling",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "saveUninitialized",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "secret",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ttl",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "store_cors",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,106 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# QueryConfig
**QueryConfig**: `Object`
## Type Parameters
<ParameterTypes parameters={[
{
"name": "TEntity",
"type": "[BaseEntity](../interfaces/types.CommonTypes.BaseEntity.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_at",
"type": "`Date`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Type declaration
<ParameterTypes parameters={[
{
"name": "allowedFields",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "allowedRelations",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "defaultFields",
"type": "(keyof `TEntity` \\| `string`)[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "defaultLimit",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "defaultRelations",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isList",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,19 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# QuerySelector
**QuerySelector**: [Selector](types.CommonTypes.Selector.mdx)&#60;TEntity&#62; & `object`
## Type Parameters
<ParameterTypes parameters={[
{
"name": "TEntity",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,55 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# RequestQueryFields
**RequestQueryFields**: `Object`
## Type declaration
<ParameterTypes parameters={[
{
"name": "expand",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fields",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "order",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,30 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# WithRequiredProperty
**WithRequiredProperty**: `T` & &#123; [Property in K]-?: T[Property] &#125;
Utility type used to remove some optional attributes (coming from K) from a type T
## Type Parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "K",
"type": "keyof `T`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,100 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# WorkflowInputConfig
## Properties
<ParameterTypes parameters={[
{
"name": "listConfig",
"type": "`object`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "relations",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "select",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "listConfig.relations",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "listConfig.select",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "retrieveConfig",
"type": "`object`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "relations",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "select",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "retrieveConfig.relations",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "retrieveConfig.select",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,42 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# BaseFilterable
An object used to allow specifying flexible queries with and/or conditions.
## Type parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Properties
<ParameterTypes parameters={[
{
"name": "$and",
"type": "(`T` \\| [BaseFilterable](types.DAL.BaseFilterable.mdx)&#60;T&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "$or",
"type": "(`T` \\| [BaseFilterable](types.DAL.BaseFilterable.mdx)&#60;T&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,94 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# OptionsQuery
## Type parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "P",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Properties
<ParameterTypes parameters={[
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "filters",
"type": "`boolean` \\| `string`[] \\| [Dictionary](../../types/types/types.Dictionary.mdx)&#60;boolean \\| [Dictionary](../../types/types/types.Dictionary.mdx)&#62;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "groupBy",
"type": "`string` \\| `string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "orderBy",
"type": "[Order](../../types/types/types.Order.mdx)&#60;T&#62; \\| [Order](../../types/types/types.Order.mdx)&#60;T&#62;[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "populate",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
File diff suppressed because it is too large. Load diff
@@ -1,33 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# RestoreReturn
An object that is used to specify an entity's related entities that should be restored when the main entity is restored.
## Type parameters
<ParameterTypes parameters={[
{
"name": "TReturnableLinkableKeys",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Properties
<ParameterTypes parameters={[
{
"name": "returnLinkableKeys",
"type": "`TReturnableLinkableKeys`[]",
"description": "An array of strings, each being the ID attribute names of the entity's relations.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,33 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# SoftDeleteReturn
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
## Type parameters
<ParameterTypes parameters={[
{
"name": "TReturnableLinkableKeys",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Properties
<ParameterTypes parameters={[
{
"name": "returnLinkableKeys",
"type": "`TReturnableLinkableKeys`[]",
"description": "An array of strings, each being the ID attribute names of the entity's relations.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,889 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# TreeRepositoryService
Data access layer (DAL) interface to implements for any repository service.
This layer helps to separate the business logic (service layer) from accessing the
ORM directly and allows to switch to another ORM without changing the business logic.
## Type parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Methods
### create
#### Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "`unknown`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[Context](../../types/interfaces/types.Context.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;T&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "T",
"type": "`T`",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
___
### delete
#### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[Context](../../types/interfaces/types.Context.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### find
#### Parameters
<ParameterTypes parameters={[
{
"name": "options",
"type": "[FindOptions](../types/types.DAL.FindOptions.mdx)&#60;T&#62;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "options",
"type": "[OptionsQuery](types.DAL.OptionsQuery.mdx)&#60;T, any&#62;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "filters",
"type": "`boolean` \\| `string`[] \\| [Dictionary](../../types/types/types.Dictionary.mdx)&#60;boolean \\| [Dictionary](../../types/types/types.Dictionary.mdx)&#62;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "groupBy",
"type": "`string` \\| `string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "orderBy",
"type": "[Order](../../types/types/types.Order.mdx)&#60;T&#62; \\| [Order](../../types/types/types.Order.mdx)&#60;T&#62;[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "populate",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "where",
"type": "[FilterQuery](../types/types.DAL.FilterQuery.mdx)&#60;T&#62; & [BaseFilterable](types.DAL.BaseFilterable.mdx)&#60;[FilterQuery](../types/types.DAL.FilterQuery.mdx)&#60;T&#62;&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "$and",
"type": "(`T` \\| [BaseFilterable](types.DAL.BaseFilterable.mdx)&#60;T&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "$or",
"type": "(`T` \\| [BaseFilterable](types.DAL.BaseFilterable.mdx)&#60;T&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
},
{
"name": "transformOptions",
"type": "[RepositoryTransformOptions](../../CommonTypes/interfaces/types.CommonTypes.RepositoryTransformOptions.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[Context](../../types/interfaces/types.Context.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;T[]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "T[]",
"type": "`T`[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "T",
"type": "`T`",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />
___
### findAndCount
#### Parameters
<ParameterTypes parameters={[
{
"name": "options",
"type": "[FindOptions](../types/types.DAL.FindOptions.mdx)&#60;T&#62;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "options",
"type": "[OptionsQuery](types.DAL.OptionsQuery.mdx)&#60;T, any&#62;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "filters",
"type": "`boolean` \\| `string`[] \\| [Dictionary](../../types/types/types.Dictionary.mdx)&#60;boolean \\| [Dictionary](../../types/types/types.Dictionary.mdx)&#62;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "groupBy",
"type": "`string` \\| `string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "orderBy",
"type": "[Order](../../types/types/types.Order.mdx)&#60;T&#62; \\| [Order](../../types/types/types.Order.mdx)&#60;T&#62;[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "populate",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "where",
"type": "[FilterQuery](../types/types.DAL.FilterQuery.mdx)&#60;T&#62; & [BaseFilterable](types.DAL.BaseFilterable.mdx)&#60;[FilterQuery](../types/types.DAL.FilterQuery.mdx)&#60;T&#62;&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "$and",
"type": "(`T` \\| [BaseFilterable](types.DAL.BaseFilterable.mdx)&#60;T&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "$or",
"type": "(`T` \\| [BaseFilterable](types.DAL.BaseFilterable.mdx)&#60;T&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
},
{
"name": "transformOptions",
"type": "[RepositoryTransformOptions](../../CommonTypes/interfaces/types.CommonTypes.RepositoryTransformOptions.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[Context](../../types/interfaces/types.Context.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[T[], number]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "T[]",
"type": "`T`[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
},
{
"name": "number",
"type": "`number`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
___
### getActiveManager
#### Type Parameters
<ParameterTypes parameters={[
{
"name": "TManager",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "TManager",
"type": "`TManager`",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### getFreshManager
#### Type Parameters
<ParameterTypes parameters={[
{
"name": "TManager",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "TManager",
"type": "`TManager`",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### serialize
#### Type Parameters
<ParameterTypes parameters={[
{
"name": "TOutput",
"type": "`object` \\| `object`[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`any`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;TOutput&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "TOutput",
"type": "`TOutput`",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
___
### transaction
#### Type Parameters
<ParameterTypes parameters={[
{
"name": "TManager",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Parameters
<ParameterTypes parameters={[
{
"name": "task",
"type": "(`transactionManager`: `TManager`) => Promise&#60;any&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "`object`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transaction",
"type": "`TManager`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context.enableNestedTransactions",
"type": "`boolean`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context.isolationLevel",
"type": "`string`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context.transaction",
"type": "`TManager`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;any&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "any",
"type": "`any`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
@@ -1,125 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# FindOptions
**FindOptions**: `Object`
## Type Parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Type declaration
<ParameterTypes parameters={[
{
"name": "options",
"type": "[OptionsQuery](../interfaces/types.DAL.OptionsQuery.mdx)&#60;T, any&#62;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "fields",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "filters",
"type": "`boolean` \\| `string`[] \\| [Dictionary](../../types/types/types.Dictionary.mdx)&#60;boolean \\| [Dictionary](../../types/types/types.Dictionary.mdx)&#62;",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "groupBy",
"type": "`string` \\| `string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "orderBy",
"type": "[Order](../../types/types/types.Order.mdx)&#60;T&#62; \\| [Order](../../types/types/types.Order.mdx)&#60;T&#62;[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "populate",
"type": "`string`[]",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "where",
"type": "[FilterQuery](types.DAL.FilterQuery.mdx)&#60;T&#62; & [BaseFilterable](../interfaces/types.DAL.BaseFilterable.mdx)&#60;[FilterQuery](types.DAL.FilterQuery.mdx)&#60;T&#62;&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "$and",
"type": "(`T` \\| [BaseFilterable](../interfaces/types.DAL.BaseFilterable.mdx)&#60;T&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "$or",
"type": "(`T` \\| [BaseFilterable](../interfaces/types.DAL.BaseFilterable.mdx)&#60;T&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
@@ -1,297 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# IEventBusModuleService
## Methods
### emit
`**emit**<TypeParameter T>(eventName, data, options?): Promise&#60;void&#62;`
#### Type Parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Parameters
<ParameterTypes parameters={[
{
"name": "eventName",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "data",
"type": "`T`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`Record<string, unknown>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
`**emit**<TypeParameter T>(data): Promise&#60;void&#62;`
#### Type Parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[EmitData](../types/types.EventBusTypes.EmitData.mdx)&#60;T&#62;[]",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "data",
"type": "`T`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "eventName",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`Record<string, unknown>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### subscribe
#### Parameters
<ParameterTypes parameters={[
{
"name": "eventName",
"type": "`string` \\| `symbol`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscriber",
"type": "[Subscriber](../types/types.EventBusTypes.Subscriber.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "subscriberId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "emit",
"type": "`<T>`(`eventName`: `string`, `data`: `T`, `options?`: `Record<string, unknown>`) => Promise&#60;void&#62;`<T>`(`data`: [EmitData](../types/types.EventBusTypes.EmitData.mdx)&#60;T&#62;[]) => Promise&#60;void&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscribe",
"type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusModuleService](types.EventBusTypes.IEventBusModuleService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "unsubscribe",
"type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusModuleService](types.EventBusTypes.IEventBusModuleService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
___
### unsubscribe
#### Parameters
<ParameterTypes parameters={[
{
"name": "eventName",
"type": "`string` \\| `symbol`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscriber",
"type": "[Subscriber](../types/types.EventBusTypes.Subscriber.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "subscriberId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "emit",
"type": "`<T>`(`eventName`: `string`, `data`: `T`, `options?`: `Record<string, unknown>`) => Promise&#60;void&#62;`<T>`(`data`: [EmitData](../types/types.EventBusTypes.EmitData.mdx)&#60;T&#62;[]) => Promise&#60;void&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscribe",
"type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusModuleService](types.EventBusTypes.IEventBusModuleService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "unsubscribe",
"type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusModuleService](types.EventBusTypes.IEventBusModuleService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,310 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# IEventBusService
## Methods
### emit
#### Type Parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Parameters
<ParameterTypes parameters={[
{
"name": "event",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "data",
"type": "`T`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`unknown`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;unknown&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "unknown",
"type": "`unknown`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
___
### subscribe
#### Parameters
<ParameterTypes parameters={[
{
"name": "eventName",
"type": "`string` \\| `symbol`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscriber",
"type": "[Subscriber](../types/types.EventBusTypes.Subscriber.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "subscriberId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "emit",
"type": "`<T>`(`event`: `string`, `data`: `T`, `options?`: `unknown`) => Promise&#60;unknown&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscribe",
"type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "unsubscribe",
"type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withTransaction",
"type": "(`transactionManager?`: `EntityManager`) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
___
### unsubscribe
#### Parameters
<ParameterTypes parameters={[
{
"name": "eventName",
"type": "`string` \\| `symbol`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscriber",
"type": "[Subscriber](../types/types.EventBusTypes.Subscriber.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "subscriberId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "emit",
"type": "`<T>`(`event`: `string`, `data`: `T`, `options?`: `unknown`) => Promise&#60;unknown&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscribe",
"type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "unsubscribe",
"type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withTransaction",
"type": "(`transactionManager?`: `EntityManager`) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
___
### withTransaction
#### Parameters
<ParameterTypes parameters={[
{
"name": "transactionManager",
"type": "`EntityManager`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "emit",
"type": "`<T>`(`event`: `string`, `data`: `T`, `options?`: `unknown`) => Promise&#60;unknown&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscribe",
"type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "unsubscribe",
"type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withTransaction",
"type": "(`transactionManager?`: `EntityManager`) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,51 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# EmitData
**EmitData**: `Object`
## Type Parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Type declaration
<ParameterTypes parameters={[
{
"name": "data",
"type": "`T`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "eventName",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`Record<string, unknown>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,58 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# EventHandler
**EventHandler**: (`data`: `T`, `eventName`: `string`) => Promise&#60;void&#62;
## Type Parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Type declaration
### Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "`T`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "eventName",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
@@ -1,58 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# Subscriber
**Subscriber**: (`data`: `T`, `eventName`: `string`) => Promise&#60;void&#62;
## Type Parameters
<ParameterTypes parameters={[
{
"name": "T",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Type declaration
### Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "`T`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "eventName",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
@@ -1,19 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# SubscriberContext
**SubscriberContext**: `Object`
## Type declaration
<ParameterTypes parameters={[
{
"name": "subscriberId",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,28 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# SubscriberDescriptor
**SubscriberDescriptor**: `Object`
## Type declaration
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscriber",
"type": "[Subscriber](types.EventBusTypes.Subscriber.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,26 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# IFlagRouter
## Properties
<ParameterTypes parameters={[
{
"name": "isFeatureEnabled",
"type": "(`key`: `string`) => `boolean`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "listFlags",
"type": "() => [FeatureFlagsResponse](../types/types.FeatureFlagTypes.FeatureFlagsResponse.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,46 +0,0 @@
import ParameterTypes from "@site/src/components/ParameterTypes"
# FlagSettings
**FlagSettings**: `Object`
## Type declaration
<ParameterTypes parameters={[
{
"name": "default_val",
"type": "`boolean`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "env_key",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "key",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
@@ -1,202 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/adjustInventory
sidebar_label: adjustInventory
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# adjustInventory - Inventory Module Reference
This documentation provides a reference to the `adjustInventory` method. This belongs to the Inventory Module.
This method is used to adjust the inventory level's stocked quantity. The inventory level is identified by the IDs of its associated inventory item and location.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function adjustInventory (
inventoryItemId: string,
locationId: string,
adjustment: number
) {
const inventoryModule = await initializeInventoryModule({})
const inventoryLevel = await inventoryModule.adjustInventory(
inventoryItemId,
locationId,
adjustment
)
// do something with the inventory level or return it.
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "inventoryItemId",
"type": "`string`",
"description": "The ID of the associated inventory item.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "locationId",
"type": "`string`",
"description": "The ID of the associated location.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "adjustment",
"type": "`number`",
"description": "A positive or negative number used to adjust the inventory level's stocked quantity.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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;[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The inventory level's details.",
"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": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "incoming_quantity",
"type": "`number`",
"description": "the incoming stock quantity of an inventory item at the given location ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_item_id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "location_id",
"type": "`string`",
"description": "the item location 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": "reserved_quantity",
"type": "`number`",
"description": "the reserved stock quantity of an inventory item at the given location ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "stocked_quantity",
"type": "`number`",
"description": "the total stock quantity of an inventory item at the given location ID",
"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": []
}
]
}
]} />
@@ -1,119 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/confirmInventory
sidebar_label: confirmInventory
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# confirmInventory - Inventory Module Reference
This documentation provides a reference to the `confirmInventory` method. This belongs to the Inventory Module.
This method is used to confirm whether the specified quantity of an inventory item is available in the specified locations.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function confirmInventory (
inventoryItemId: string,
locationIds: string[],
quantity: number
) {
const inventoryModule = await initializeInventoryModule({})
return await inventoryModule.confirmInventory(
inventoryItemId,
locationIds,
quantity
)
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "inventoryItemId",
"type": "`string`",
"description": "The ID of the inventory item to check its availability.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "locationIds",
"type": "`string`[]",
"description": "The IDs of the locations to check the quantity availability in.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "quantity",
"type": "`number`",
"description": "The quantity to check if available for the inventory item in the specified locations.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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;boolean&#62;",
"optional": false,
"defaultValue": "",
"description": "Whether the specified quantity is available for the inventory item in the specified locations.",
"expandable": false,
"children": [
{
"name": "boolean",
"type": "`boolean`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
@@ -1,380 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/createInventoryItem
sidebar_label: createInventoryItem
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# createInventoryItem - Inventory Module Reference
This documentation provides a reference to the `createInventoryItem` method. This belongs to the Inventory Module.
This method is used to create an inventory item.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function createInventoryItem (item: {
sku: string,
requires_shipping: boolean
}) {
const inventoryModule = await initializeInventoryModule({})
const inventoryItem = await inventoryModule.createInventoryItem(
item
)
// do something with the inventory item or return it
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "input",
"type": "[CreateInventoryItemInput](../../inventory/interfaces/inventory.CreateInventoryItemInput.mdx)",
"description": "The details of the inventory item to create.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "description",
"type": "`null` \\| `string`",
"description": "The description of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`null` \\| `number`",
"description": "The height of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`null` \\| `string`",
"description": "The HS code of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`null` \\| `number`",
"description": "The length of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`null` \\| `string`",
"description": "The material of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "`null` \\| `string`",
"description": "The MID code of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "origin_country",
"type": "`null` \\| `string`",
"description": "The origin country of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "requires_shipping",
"type": "`boolean`",
"description": "Whether the inventory item requires shipping.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sku",
"type": "`null` \\| `string`",
"description": "The SKU of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "thumbnail",
"type": "`null` \\| `string`",
"description": "The thumbnail of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`null` \\| `string`",
"description": "The title of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "weight",
"type": "`null` \\| `number`",
"description": "The weight of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`null` \\| `number`",
"description": "The width of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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;[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The created inventory item's details.",
"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": "description",
"type": "`string` \\| `null`",
"description": "Description of the inventory item",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`number` \\| `null`",
"description": "The height of the Inventory Item. May be used in shipping rate calculations.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`string` \\| `null`",
"description": "The Harmonized System code of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The inventory item's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`number` \\| `null`",
"description": "The length of the Inventory Item. May be used in shipping rate calculations.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`string` \\| `null`",
"description": "The material and composition that the Inventory Item is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"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": "mid_code",
"type": "`string` \\| `null`",
"description": "The Manufacturers Identification code that identifies the manufacturer of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "origin_country",
"type": "`string` \\| `null`",
"description": "The country in which the Inventory Item was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "requires_shipping",
"type": "`boolean`",
"description": "Whether the item requires shipping.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sku",
"type": "`string` \\| `null`",
"description": "The Stock Keeping Unit (SKU) code of the Inventory Item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "thumbnail",
"type": "`string` \\| `null`",
"description": "Thumbnail for the inventory item",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string` \\| `null`",
"description": "Title of the inventory item",
"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": "weight",
"type": "`number` \\| `null`",
"description": "The weight of the Inventory Item. May be used in shipping rate calculations.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`number` \\| `null`",
"description": "The width of the Inventory Item. May be used in shipping rate calculations.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
@@ -1,237 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/createInventoryItems
sidebar_label: createInventoryItems
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# createInventoryItems - Inventory Module Reference
This documentation provides a reference to the `createInventoryItems` method. This belongs to the Inventory Module.
This method is used to create inventory items.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function createInventoryItems (items: {
sku: string,
requires_shipping: boolean
}[]) {
const inventoryModule = await initializeInventoryModule({})
const inventoryItems = await inventoryModule.createInventoryItems(
items
)
// do something with the inventory items or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "input",
"type": "[CreateInventoryItemInput](../../inventory/interfaces/inventory.CreateInventoryItemInput.mdx)[]",
"description": "The details of the inventory items to create.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "description",
"type": "`null` \\| `string`",
"description": "The description of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "`null` \\| `number`",
"description": "The height of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "`null` \\| `string`",
"description": "The HS code of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "`null` \\| `number`",
"description": "The length of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "`null` \\| `string`",
"description": "The material of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "`null` \\| `string`",
"description": "The MID code of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "origin_country",
"type": "`null` \\| `string`",
"description": "The origin country of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "requires_shipping",
"type": "`boolean`",
"description": "Whether the inventory item requires shipping.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sku",
"type": "`null` \\| `string`",
"description": "The SKU of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "thumbnail",
"type": "`null` \\| `string`",
"description": "The thumbnail of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`null` \\| `string`",
"description": "The title of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "weight",
"type": "`null` \\| `number`",
"description": "The weight of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "`null` \\| `number`",
"description": "The width of the inventory item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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;[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The created inventory items' details.",
"expandable": false,
"children": [
{
"name": "InventoryItemDTO[]",
"type": "[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "InventoryItemDTO",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />
@@ -1,228 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/createInventoryLevel
sidebar_label: createInventoryLevel
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# createInventoryLevel - Inventory Module Reference
This documentation provides a reference to the `createInventoryLevel` method. This belongs to the Inventory Module.
This method is used to create inventory level.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function createInventoryLevel (item: {
inventory_item_id: string
location_id: string
stocked_quantity: number
}) {
const inventoryModule = await initializeInventoryModule({})
const inventoryLevel = await inventoryModule.createInventoryLevel(
item
)
// do something with the inventory level or return it
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[CreateInventoryLevelInput](../../inventory/interfaces/inventory.CreateInventoryLevelInput.mdx)",
"description": "The details of the inventory level to create.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "incoming_quantity",
"type": "`number`",
"description": "The incoming quantity of the associated inventory item in the associated location.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_item_id",
"type": "`string`",
"description": "The ID of the associated inventory item.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "location_id",
"type": "`string`",
"description": "The ID of the associated location.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "reserved_quantity",
"type": "`number`",
"description": "The reserved quantity of the associated inventory item in the associated location.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "stocked_quantity",
"type": "`number`",
"description": "The stocked quantity of the associated inventory item in the associated location.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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;[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The created inventory level's details.",
"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": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "incoming_quantity",
"type": "`number`",
"description": "the incoming stock quantity of an inventory item at the given location ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_item_id",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "location_id",
"type": "`string`",
"description": "the item location 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": "reserved_quantity",
"type": "`number`",
"description": "the reserved stock quantity of an inventory item at the given location ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "stocked_quantity",
"type": "`number`",
"description": "the total stock quantity of an inventory item at the given location ID",
"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": []
}
]
}
]} />
@@ -1,157 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/createInventoryLevels
sidebar_label: createInventoryLevels
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# createInventoryLevels - Inventory Module Reference
This documentation provides a reference to the `createInventoryLevels` method. This belongs to the Inventory Module.
This method is used to create inventory levels.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function createInventoryLevels (items: {
inventory_item_id: string
location_id: string
stocked_quantity: number
}[]) {
const inventoryModule = await initializeInventoryModule({})
const inventoryLevels = await inventoryModule.createInventoryLevels(
items
)
// do something with the inventory levels or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[CreateInventoryLevelInput](../../inventory/interfaces/inventory.CreateInventoryLevelInput.mdx)[]",
"description": "The details of the inventory levels to create.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "incoming_quantity",
"type": "`number`",
"description": "The incoming quantity of the associated inventory item in the associated location.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_item_id",
"type": "`string`",
"description": "The ID of the associated inventory item.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "location_id",
"type": "`string`",
"description": "The ID of the associated location.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "reserved_quantity",
"type": "`number`",
"description": "The reserved quantity of the associated inventory item in the associated location.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "stocked_quantity",
"type": "`number`",
"description": "The stocked quantity of the associated inventory item in the associated location.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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;[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The created inventory levels' details.",
"expandable": false,
"children": [
{
"name": "InventoryLevelDTO[]",
"type": "[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "InventoryLevelDTO",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />
@@ -1,264 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/createReservationItem
sidebar_label: createReservationItem
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# createReservationItem - Inventory Module Reference
This documentation provides a reference to the `createReservationItem` method. This belongs to the Inventory Module.
This method is used to create a reservation item.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function createReservationItem (item: {
inventory_item_id: string,
location_id: string,
quantity: number
}) {
const inventoryModule = await initializeInventoryModule({})
const reservationItem = await inventoryModule.createReservationItems(
item
)
// do something with the reservation item or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "input",
"type": "[CreateReservationItemInput](../../inventory/interfaces/inventory.CreateReservationItemInput.mdx)",
"description": "The details of the reservation item to create.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_by",
"type": "`string`",
"description": "The user or system that created the reservation. Can be any form of identification string.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`string`",
"description": "The description of the reservation.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "external_id",
"type": "`string`",
"description": "An ID associated with an external third-party system that the reservation item is connected to.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_item_id",
"type": "`string`",
"description": "The ID of the associated inventory item.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "line_item_id",
"type": "`string`",
"description": "The ID of the associated line item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "location_id",
"type": "`string`",
"description": "The ID of the associated location.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "quantity",
"type": "`number`",
"description": "The reserved quantity.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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;[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The created reservation item's details.",
"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": "created_by",
"type": "`string` \\| `null`",
"description": "UserId of user who created the reservation item",
"optional": true,
"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": "description",
"type": "`string` \\| `null`",
"description": "Description of the reservation item",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The id of the reservation item",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_item_id",
"type": "`string`",
"description": "The id of the inventory item the reservation relates to",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "line_item_id",
"type": "`string` \\| `null`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "location_id",
"type": "`string`",
"description": "The id of the location of the reservation",
"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": "quantity",
"type": "`number`",
"description": "The id of the reservation item",
"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": []
}
]
}
]} />
@@ -1,184 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/createReservationItems
sidebar_label: createReservationItems
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# createReservationItems - Inventory Module Reference
This documentation provides a reference to the `createReservationItems` method. This belongs to the Inventory Module.
This method is used to create reservation items.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function createReservationItems (items: {
inventory_item_id: string,
location_id: string,
quantity: number
}[]) {
const inventoryModule = await initializeInventoryModule({})
const reservationItems = await inventoryModule.createReservationItems(
items
)
// do something with the reservation items or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "input",
"type": "[CreateReservationItemInput](../../inventory/interfaces/inventory.CreateReservationItemInput.mdx)[]",
"description": "The details of the reservation items to create.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_by",
"type": "`string`",
"description": "The user or system that created the reservation. Can be any form of identification string.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "description",
"type": "`string`",
"description": "The description of the reservation.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "external_id",
"type": "`string`",
"description": "An ID associated with an external third-party system that the reservation item is connected to.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_item_id",
"type": "`string`",
"description": "The ID of the associated inventory item.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "line_item_id",
"type": "`string`",
"description": "The ID of the associated line item.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "location_id",
"type": "`string`",
"description": "The ID of the associated location.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`null` \\| `Record<string, unknown>`",
"description": "Holds custom data in key-value pairs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "quantity",
"type": "`number`",
"description": "The reserved quantity.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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;[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The created reservation items' details.",
"expandable": false,
"children": [
{
"name": "ReservationItemDTO[]",
"type": "[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "ReservationItemDTO",
"type": "`object`",
"description": "Represents a reservation of an inventory item at a stock location",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />
@@ -1,88 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/deleteInventoryItem
sidebar_label: deleteInventoryItem
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# deleteInventoryItem - Inventory Module Reference
This documentation provides a reference to the `deleteInventoryItem` method. This belongs to the Inventory Module.
This method is used to delete an inventory item or multiple inventory items. The inventory items are only soft deleted and can be restored using the
[restoreInventoryItem](inventory.IInventoryService.restoreInventoryItem.mdx) method.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function deleteInventoryItem (
inventoryItems: string[]
) {
const inventoryModule = await initializeInventoryModule({})
await inventoryModule.deleteInventoryItem(
inventoryItems
)
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "inventoryItemId",
"type": "`string` \\| `string`[]",
"description": "The ID(s) of the inventory item(s) to delete.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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 inventory item(s) are successfully deleted.",
"expandable": false,
"children": []
}
]} />
@@ -1,87 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/deleteInventoryItemLevelByLocationId
sidebar_label: deleteInventoryItemLevelByLocationId
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# deleteInventoryItemLevelByLocationId - Inventory Module Reference
This documentation provides a reference to the `deleteInventoryItemLevelByLocationId` method. This belongs to the Inventory Module.
This method deletes the inventory item level(s) for the ID(s) of associated location(s).
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function deleteInventoryItemLevelByLocationId (
locationIds: string[]
) {
const inventoryModule = await initializeInventoryModule({})
await inventoryModule.deleteInventoryItemLevelByLocationId(
locationIds
)
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "locationId",
"type": "`string` \\| `string`[]",
"description": "The ID(s) of the associated location(s).",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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 inventory item level(s) are successfully restored.",
"expandable": false,
"children": []
}
]} />
@@ -1,98 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/deleteInventoryLevel
sidebar_label: deleteInventoryLevel
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# deleteInventoryLevel - Inventory Module Reference
This documentation provides a reference to the `deleteInventoryLevel` method. This belongs to the Inventory Module.
This method is used to delete an inventory level. The inventory level is identified by the IDs of its associated inventory item and location.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function deleteInventoryLevel (
inventoryItemId: string,
locationId: string
) {
const inventoryModule = await initializeInventoryModule({})
await inventoryModule.deleteInventoryLevel(
inventoryItemId,
locationId
)
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "inventoryItemId",
"type": "`string`",
"description": "The ID of the associated inventory item.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "locationId",
"type": "`string`",
"description": "The ID of the associated location.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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 inventory level(s) are successfully restored.",
"expandable": false,
"children": []
}
]} />
@@ -1,87 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/deleteReservationItem
sidebar_label: deleteReservationItem
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# deleteReservationItem - Inventory Module Reference
This documentation provides a reference to the `deleteReservationItem` method. This belongs to the Inventory Module.
This method is used to delete a reservation item or multiple reservation items by their IDs.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function deleteReservationItems (
reservationItemIds: string[]
) {
const inventoryModule = await initializeInventoryModule({})
await inventoryModule.deleteReservationItem(
reservationItemIds
)
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "reservationItemId",
"type": "`string` \\| `string`[]",
"description": "The ID(s) of the reservation item(s) to delete.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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 reservation item(s) are successfully deleted.",
"expandable": false,
"children": []
}
]} />
@@ -1,87 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/deleteReservationItemByLocationId
sidebar_label: deleteReservationItemByLocationId
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# deleteReservationItemByLocationId - Inventory Module Reference
This documentation provides a reference to the `deleteReservationItemByLocationId` method. This belongs to the Inventory Module.
This method deletes reservation item(s) by the ID(s) of associated location(s).
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function deleteReservationItemByLocationId (
locationIds: string[]
) {
const inventoryModule = await initializeInventoryModule({})
await inventoryModule.deleteReservationItemByLocationId(
locationIds
)
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "locationId",
"type": "`string` \\| `string`[]",
"description": "The ID(s) of the associated location(s).",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.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 reservation item(s) are successfully restored.",
"expandable": false,
"children": []
}
]} />
@@ -1,87 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/deleteReservationItemsByLineItem
sidebar_label: deleteReservationItemsByLineItem
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# deleteReservationItemsByLineItem - Inventory Module Reference
This documentation provides a reference to the `deleteReservationItemsByLineItem` method. This belongs to the Inventory Module.
This method is used to delete the reservation items associated with a line item or multiple line items.
## Example
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function deleteReservationItemsByLineItem (
lineItemIds: string[]
) {
const inventoryModule = await initializeInventoryModule({})
await inventoryModule.deleteReservationItemsByLineItem(
lineItemIds
)
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "lineItemId",
"type": "`string` \\| `string`[]",
"description": "The ID(s) of the line item(s).",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "context",
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
"description": "A context used to share re9sources, 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 reservation items are successfully deleted.",
"expandable": false,
"children": []
}
]} />
@@ -1,278 +0,0 @@
---
displayed_sidebar: inventoryReference
slug: /references/inventory/listInventoryItems
sidebar_label: listInventoryItems
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# listInventoryItems - Inventory Module Reference
This documentation provides a reference to the `listInventoryItems` method. This belongs to the Inventory Module.
This method is used to retrieve a paginated list of inventory items along with the total count of available inventory items satisfying the provided filters.
## Example
To retrieve a list of inventory items using their IDs:
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function retrieveInventoryItems (ids: string[]) {
const inventoryModule = await initializeInventoryModule({})
const [inventoryItems, count] = await inventoryModule.listInventoryItems({
id: ids
})
// do something with the inventory items or return them
}
```
To specify relations that should be retrieved within the inventory items:
```ts
import {
initialize as initializeInventoryModule,
} from "@medusajs/inventory"
async function retrieveInventoryItems (ids: string[]) {
const inventoryModule = await initializeInventoryModule({})
const [inventoryItems, count] = await inventoryModule.listInventoryItems({
id: ids
}, {
relations: ["inventory_level"]
})
// do something with the inventory items 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 initializeInventoryModule,
} from "@medusajs/inventory"
async function retrieveInventoryItems (ids: string[], skip: number, take: number) {
const inventoryModule = await initializeInventoryModule({})
const [inventoryItems, count] = await inventoryModule.listInventoryItems({
id: ids
}, {
relations: ["inventory_level"],
skip,
take
})
// do something with the inventory items or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "selector",
"type": "[FilterableInventoryItemProps](../../inventory/interfaces/inventory.FilterableInventoryItemProps.mdx)",
"description": "The filters to apply on the retrieved inventory items.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "hs_code",
"type": "`string` \\| `string`[] \\| [StringComparisonOperator](../../inventory/interfaces/inventory.StringComparisonOperator.mdx)",
"description": "The HS Codes to filter inventory items by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string` \\| `string`[]",
"description": "The IDs to filter inventory items by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "location_id",
"type": "`string` \\| `string`[]",
"description": "Filter inventory items by the ID of their associated location.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "origin_country",
"type": "`string` \\| `string`[]",
"description": "The origin country to filter inventory items by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "q",
"type": "`string`",
"description": "Search term to search inventory items' attributes.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "requires_shipping",
"type": "`boolean`",
"description": "Filter inventory items by whether they require shipping.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sku",
"type": "`string` \\| `string`[] \\| [StringComparisonOperator](../../inventory/interfaces/inventory.StringComparisonOperator.mdx)",
"description": "The SKUs to filter inventory items by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "config",
"type": "[FindConfig](../../inventory/interfaces/inventory.FindConfig.mdx)&#60;[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)&#62;",
"description": "The configurations determining how the inventory items are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a inventory item.",
"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](../../inventory/interfaces/inventory.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;[[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)[], number]&#62;",
"optional": false,
"defaultValue": "",
"description": "The list of inventory items along with the total count.",
"expandable": false,
"children": [
{
"name": "InventoryItemDTO[]",
"type": "[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
},
{
"name": "number",
"type": "`number`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
Loaded 100 of 2811 files, more files were not shown because too many files have changed in this diff. Show more