feature: introduce additional_data to the product endpoints (#8405)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
import { AdditionalData, ProductTypes } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
@@ -9,8 +9,7 @@ import { createCollectionsStep } from "../steps"
|
||||
|
||||
type WorkflowInput = {
|
||||
collections: ProductTypes.CreateProductCollectionDTO[]
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
export const createCollectionsWorkflowId = "create-collections"
|
||||
export const createCollectionsWorkflow = createWorkflow(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
import { AdditionalData, ProductTypes } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
@@ -9,8 +9,7 @@ import { createProductOptionsStep } from "../steps"
|
||||
|
||||
type WorkflowInput = {
|
||||
product_options: ProductTypes.CreateProductOptionDTO[]
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
export const createProductOptionsWorkflowId = "create-product-options"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
import { AdditionalData, ProductTypes } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
@@ -9,8 +9,7 @@ import { createProductTagsStep } from "../steps"
|
||||
|
||||
type WorkflowInput = {
|
||||
product_tags: ProductTypes.CreateProductTagDTO[]
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
export const createProductTagsWorkflowId = "create-product-tags"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
import { AdditionalData, ProductTypes } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
@@ -9,8 +9,7 @@ import { createProductTypesStep } from "../steps"
|
||||
|
||||
type WorkflowInput = {
|
||||
product_types: ProductTypes.CreateProductTypeDTO[]
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
export const createProductTypesWorkflowId = "create-product-types"
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { LinkDefinition } from "@medusajs/modules-sdk"
|
||||
import { InventoryTypes, PricingTypes, ProductTypes } from "@medusajs/types"
|
||||
import {
|
||||
AdditionalData,
|
||||
InventoryTypes,
|
||||
PricingTypes,
|
||||
ProductTypes,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
@@ -25,8 +30,7 @@ type WorkflowInput = {
|
||||
required_quantity?: number
|
||||
}[]
|
||||
})[]
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
const buildLink = (
|
||||
variant_id: string,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
AdditionalData,
|
||||
CreateProductWorkflowInputDTO,
|
||||
PricingTypes,
|
||||
ProductTypes,
|
||||
@@ -17,8 +18,7 @@ import { createProductVariantsWorkflow } from "./create-product-variants"
|
||||
|
||||
type WorkflowInput = {
|
||||
products: CreateProductWorkflowInputDTO[]
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
export const createProductsWorkflowId = "create-products"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
import { AdditionalData, ProductTypes } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
@@ -10,8 +10,7 @@ import { updateCollectionsStep } from "../steps"
|
||||
type UpdateCollectionsStepInput = {
|
||||
selector: ProductTypes.FilterableProductCollectionProps
|
||||
update: ProductTypes.UpdateProductCollectionDTO
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
type WorkflowInput = UpdateCollectionsStepInput
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
import { AdditionalData, ProductTypes } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
@@ -10,8 +10,7 @@ import { updateProductOptionsStep } from "../steps"
|
||||
type UpdateProductOptionsStepInput = {
|
||||
selector: ProductTypes.FilterableProductOptionProps
|
||||
update: ProductTypes.UpdateProductOptionDTO
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
type WorkflowInput = UpdateProductOptionsStepInput
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
import { AdditionalData, ProductTypes } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
@@ -10,8 +10,7 @@ import { updateProductTagsStep } from "../steps"
|
||||
type UpdateProductTagsStepInput = {
|
||||
selector: ProductTypes.FilterableProductTypeProps
|
||||
update: ProductTypes.UpdateProductTypeDTO
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
type WorkflowInput = UpdateProductTagsStepInput
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
import { AdditionalData, ProductTypes } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
@@ -10,8 +10,7 @@ import { updateProductTypesStep } from "../steps"
|
||||
type UpdateProductTypesStepInput = {
|
||||
selector: ProductTypes.FilterableProductTypeProps
|
||||
update: ProductTypes.UpdateProductTypeDTO
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
type WorkflowInput = UpdateProductTypesStepInput
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PricingTypes, ProductTypes } from "@medusajs/types"
|
||||
import { AdditionalData, PricingTypes, ProductTypes } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
@@ -23,9 +23,7 @@ type UpdateProductVariantsStepInput =
|
||||
})[]
|
||||
}
|
||||
|
||||
type WorkflowInput = UpdateProductVariantsStepInput & {
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
type WorkflowInput = UpdateProductVariantsStepInput & AdditionalData
|
||||
|
||||
export const updateProductVariantsWorkflowId = "update-product-variants"
|
||||
export const updateProductVariantsWorkflow = createWorkflow(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { updateProductsStep } from "../steps/update-products"
|
||||
|
||||
import {
|
||||
AdditionalData,
|
||||
CreateMoneyAmountDTO,
|
||||
ProductTypes,
|
||||
UpdateProductVariantWorkflowInputDTO,
|
||||
@@ -26,16 +27,14 @@ type UpdateProductsStepInputSelector = {
|
||||
sales_channels?: { id: string }[]
|
||||
variants?: UpdateProductVariantWorkflowInputDTO[]
|
||||
}
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
type UpdateProductsStepInputProducts = {
|
||||
products: (Omit<ProductTypes.UpsertProductDTO, "variants"> & {
|
||||
sales_channels?: { id: string }[]
|
||||
variants?: UpdateProductVariantWorkflowInputDTO[]
|
||||
})[]
|
||||
additional_data?: Record<string, unknown>
|
||||
}
|
||||
} & AdditionalData
|
||||
|
||||
type UpdateProductsStepInput =
|
||||
| UpdateProductsStepInputSelector
|
||||
|
||||
Reference in New Issue
Block a user