Skip to content

Commit cdd42db

Browse files
github-actions[bot]olivermrblshahednasser
authored
chore(docs): Generated References (medusajs#5743)
Generated the following references: - `entities` - `inventory` - `js-client` - `pricing` - `product` - `services` - `stock-location` - `workflows` Co-authored-by: Oli Juhl <[email protected]> Co-authored-by: Shahed Nasser <[email protected]>
1 parent dc6b815 commit cdd42db

File tree

1,383 files changed

+18978
-20154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,383 files changed

+18978
-20154
lines changed

packages/types/src/product/service.ts

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,11 +1491,57 @@ export interface IProductModuleService {
14911491
sharedContext?: Context
14921492
): Promise<ProductVariantDTO[]>
14931493

1494+
/**
1495+
* This method is used to update a product's variants.
1496+
*
1497+
* @param {UpdateProductVariantDTO[]} data - The product variants to update.
1498+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
1499+
* @returns {Promise<ProductVariantDTO[]>} The updated product variants's details.
1500+
*
1501+
* @example
1502+
* import {
1503+
* initialize as initializeProductModule,
1504+
* } from "@medusajs/product"
1505+
* import {
1506+
* UpdateProductVariantDTO
1507+
* } from "@medusajs/product/dist/types/services/product-variant"
1508+
*
1509+
* async function updateProductVariants (items: UpdateProductVariantDTO[]) {
1510+
* const productModule = await initializeProductModule()
1511+
*
1512+
* const productVariants = await productModule.updateVariants(items)
1513+
*
1514+
* // do something with the product variants or return them
1515+
* }
1516+
*/
14941517
updateVariants(
14951518
data: UpdateProductVariantDTO[],
14961519
sharedContext?: Context
14971520
): Promise<ProductVariantDTO[]>
14981521

1522+
/**
1523+
* This method is used to create variants for a product.
1524+
*
1525+
* @param {CreateProductVariantDTO[]} data - The product variants to create.
1526+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
1527+
* @returns {Promise<ProductVariantDTO[]>} The created product variants' details.
1528+
*
1529+
* @example
1530+
* import {
1531+
* initialize as initializeProductModule,
1532+
* } from "@medusajs/product"
1533+
*
1534+
* async function createProductVariants (items: {
1535+
* product_id: string,
1536+
* title: string
1537+
* }[]) {
1538+
* const productModule = await initializeProductModule()
1539+
*
1540+
* const productVariants = await productModule.createVariants(items)
1541+
*
1542+
* // do something with the product variants or return them
1543+
* }
1544+
*/
14991545
createVariants(
15001546
data: CreateProductVariantDTO[],
15011547
sharedContext?: Context
@@ -2437,7 +2483,7 @@ export interface IProductModuleService {
24372483
*
24382484
* @param {string[]} productIds - The IDs of the products to restore.
24392485
* @param {RestoreReturn<TReturnableLinkableKeys>} config -
2440-
* Configurations determining which relations to restore along with the each of the products. You can pass to its `returnLinkableKeys`
2486+
* Configurations determining which relations to restore along with each of the products. You can pass to its `returnLinkableKeys`
24412487
* property any of the product's relation attribute names, such as `variant_id`.
24422488
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
24432489
* @returns {Promise<Record<string, string[]> | void>}
@@ -2466,6 +2512,32 @@ export interface IProductModuleService {
24662512
sharedContext?: Context
24672513
): Promise<Record<string, string[]> | void>
24682514

2515+
/**
2516+
* This method is used to restore product varaints that were soft deleted. Product variants are soft deleted when they're not
2517+
* provided in a product's details passed to the {@link update} method.
2518+
*
2519+
* @param {string[]} variantIds - The IDs of the variants to restore.
2520+
* @param {RestoreReturn<TReturnableLinkableKeys>} config -
2521+
* Configurations determining which relations to restore along with each of the product variants. You can pass to its `returnLinkableKeys`
2522+
* property any of the product variant's relation attribute names.
2523+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
2524+
* @returns {Promise<Record<string, string[]> | void>}
2525+
* An object that includes the IDs of related records that were restored. The object's keys are the ID attribute names of the product variant entity's relations
2526+
* and its value is an array of strings, each being the ID of the record associated with the product variant through this relation.
2527+
*
2528+
* If there are no related records that were restored, the promise resolved to `void`.
2529+
*
2530+
* @example
2531+
* import {
2532+
* initialize as initializeProductModule,
2533+
* } from "@medusajs/product"
2534+
*
2535+
* async function restoreProductVariants (ids: string[]) {
2536+
* const productModule = await initializeProductModule()
2537+
*
2538+
* await productModule.restoreVariants(ids)
2539+
* }
2540+
*/
24692541
restoreVariants<TReturnableLinkableKeys extends string = string>(
24702542
variantIds: string[],
24712543
config?: RestoreReturn<TReturnableLinkableKeys>,

www/apps/docs/content/references/entities/classes/MoneyAmount.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ A Money Amount represent a price amount, for example, a product variant's price
332332
},
333333
{
334334
"name": "region_id",
335-
"type": "`string`",
335+
"type": "`null` \\| `string`",
336336
"description": "The region's ID",
337337
"optional": false,
338338
"defaultValue": "",

www/apps/docs/content/references/entities/classes/PriceList.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ A Price List represents a set of prices that override the default price for one
266266
},
267267
{
268268
"name": "region_id",
269-
"type": "`string`",
269+
"type": "`null` \\| `string`",
270270
"description": "The region's ID",
271271
"optional": false,
272272
"defaultValue": "",

www/apps/docs/content/references/entities/classes/ProductVariant.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ A Product Variant represents a Product with a specific set of Product Option con
437437
},
438438
{
439439
"name": "region_id",
440-
"type": "`string`",
440+
"type": "`null` \\| `string`",
441441
"description": "The region's ID",
442442
"optional": false,
443443
"defaultValue": "",

www/apps/docs/content/references/entities/enums/AllocationType.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ The scope that the discount should apply to.
1010

1111
## Enumeration Members
1212

13-
### ITEM
13+
#### ITEM
1414

1515
**ITEM** = `"item"`
1616

1717
The discount should be applied to applicable items in the cart.
1818

1919
___
2020

21-
### TOTAL
21+
#### TOTAL
2222

2323
**TOTAL** = `"total"`
2424

www/apps/docs/content/references/entities/enums/BatchJobStatus.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,42 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
88

99
## Enumeration Members
1010

11-
### CANCELED
11+
#### CANCELED
1212

1313
**CANCELED** = `"canceled"`
1414

1515
___
1616

17-
### COMPLETED
17+
#### COMPLETED
1818

1919
**COMPLETED** = `"completed"`
2020

2121
___
2222

23-
### CONFIRMED
23+
#### CONFIRMED
2424

2525
**CONFIRMED** = `"confirmed"`
2626

2727
___
2828

29-
### CREATED
29+
#### CREATED
3030

3131
**CREATED** = `"created"`
3232

3333
___
3434

35-
### FAILED
35+
#### FAILED
3636

3737
**FAILED** = `"failed"`
3838

3939
___
4040

41-
### PRE\_PROCESSED
41+
#### PRE\_PROCESSED
4242

4343
**PRE\_PROCESSED** = `"pre_processed"`
4444

4545
___
4646

47-
### PROCESSING
47+
#### PROCESSING
4848

4949
**PROCESSING** = `"processing"`

www/apps/docs/content/references/entities/enums/CartType.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
88

99
## Enumeration Members
1010

11-
### CLAIM
11+
#### CLAIM
1212

1313
**CLAIM** = `"claim"`
1414

1515
___
1616

17-
### DEFAULT
17+
#### DEFAULT
1818

1919
**DEFAULT** = `"default"`
2020

2121
___
2222

23-
### DRAFT\_ORDER
23+
#### DRAFT\_ORDER
2424

2525
**DRAFT\_ORDER** = `"draft_order"`
2626

2727
___
2828

29-
### PAYMENT\_LINK
29+
#### PAYMENT\_LINK
3030

3131
**PAYMENT\_LINK** = `"payment_link"`
3232

3333
___
3434

35-
### SWAP
35+
#### SWAP
3636

3737
**SWAP** = `"swap"`

www/apps/docs/content/references/entities/enums/ClaimFulfillmentStatus.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,71 +10,71 @@ The claim's fulfillment status.
1010

1111
## Enumeration Members
1212

13-
### CANCELED
13+
#### CANCELED
1414

1515
**CANCELED** = `"canceled"`
1616

1717
The claim's fulfillments are canceled.
1818

1919
___
2020

21-
### FULFILLED
21+
#### FULFILLED
2222

2323
**FULFILLED** = `"fulfilled"`
2424

2525
The claim's replacement items are fulfilled.
2626

2727
___
2828

29-
### NOT\_FULFILLED
29+
#### NOT\_FULFILLED
3030

3131
**NOT\_FULFILLED** = `"not_fulfilled"`
3232

3333
The claim's replacement items are not fulfilled.
3434

3535
___
3636

37-
### PARTIALLY\_FULFILLED
37+
#### PARTIALLY\_FULFILLED
3838

3939
**PARTIALLY\_FULFILLED** = `"partially_fulfilled"`
4040

4141
Some of the claim's replacement items, but not all, are fulfilled.
4242

4343
___
4444

45-
### PARTIALLY\_RETURNED
45+
#### PARTIALLY\_RETURNED
4646

4747
**PARTIALLY\_RETURNED** = `"partially_returned"`
4848

4949
Some of the claim's items, but not all, are returned.
5050

5151
___
5252

53-
### PARTIALLY\_SHIPPED
53+
#### PARTIALLY\_SHIPPED
5454

5555
**PARTIALLY\_SHIPPED** = `"partially_shipped"`
5656

5757
Some of the claim's replacement items, but not all, are shipped.
5858

5959
___
6060

61-
### REQUIRES\_ACTION
61+
#### REQUIRES\_ACTION
6262

6363
**REQUIRES\_ACTION** = `"requires_action"`
6464

6565
The claim's fulfillment requires action.
6666

6767
___
6868

69-
### RETURNED
69+
#### RETURNED
7070

7171
**RETURNED** = `"returned"`
7272

7373
The claim's items are returned.
7474

7575
___
7676

77-
### SHIPPED
77+
#### SHIPPED
7878

7979
**SHIPPED** = `"shipped"`
8080

www/apps/docs/content/references/entities/enums/ClaimPaymentStatus.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ The claim's payment status
1010

1111
## Enumeration Members
1212

13-
### NA
13+
#### NA
1414

1515
**NA** = `"na"`
1616

1717
The payment status isn't set, which is typically used when the claim's type is `replace`.
1818

1919
___
2020

21-
### NOT\_REFUNDED
21+
#### NOT\_REFUNDED
2222

2323
**NOT\_REFUNDED** = `"not_refunded"`
2424

2525
The payment isn't refunded.
2626

2727
___
2828

29-
### REFUNDED
29+
#### REFUNDED
3030

3131
**REFUNDED** = `"refunded"`
3232

www/apps/docs/content/references/entities/enums/ClaimReason.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
88

99
## Enumeration Members
1010

11-
### MISSING\_ITEM
11+
#### MISSING\_ITEM
1212

1313
**MISSING\_ITEM** = `"missing_item"`
1414

1515
___
1616

17-
### OTHER
17+
#### OTHER
1818

1919
**OTHER** = `"other"`
2020

2121
___
2222

23-
### PRODUCTION\_FAILURE
23+
#### PRODUCTION\_FAILURE
2424

2525
**PRODUCTION\_FAILURE** = `"production_failure"`
2626

2727
___
2828

29-
### WRONG\_ITEM
29+
#### WRONG\_ITEM
3030

3131
**WRONG\_ITEM** = `"wrong_item"`

0 commit comments

Comments
 (0)