feat(medusa, types, utils, workflow): Migrate medusa workflow to the workflow package (#4682)

This commit is contained in:
Adrien de Peretti authored and GitHub committed 2023-08-05 16:03:45 +02:00
1 parent 433914ae01
commit dc46927bc6
68 files changed
+1224 -1064

No files matched your search

+3
View File
@@ -9,3 +9,6 @@ export * as StockLocationTypes from "./stock-location"
export * as TransactionBaseTypes from "./transaction-base"
export * as DAL from "./dal"
export * as LoggerTypes from "./logger"
export * as FeatureFlagTypes from "./feature-flag"
export * as SalesChannelTypes from "./sales-channel"
export * as WorkflowTypes from "./workflow"
+32
View File
@@ -0,0 +1,32 @@
export interface IFlagRouter {
isFeatureEnabled: (key: string) => boolean
listFlags: () => FeatureFlagsResponse
}
/**
* @schema FeatureFlagsResponse
* type: array
* items:
* type: object
* required:
* - key
* - value
* properties:
* key:
* description: The key of the feature flag.
* type: string
* value:
* description: The value of the feature flag.
* type: boolean
*/
export type FeatureFlagsResponse = {
key: string
value: boolean
}[]
export type FlagSettings = {
key: string
description: string
env_key: string
default_val: boolean
}
+1
View File
@@ -0,0 +1 @@
export * from "./common"
+3
View File
@@ -13,3 +13,6 @@ export * from "./stock-location"
export * from "./transaction-base"
export * from "./dal"
export * from "./logger"
export * from "./feature-flag"
export * from "./sales-channel"
export * from "./workflow"
+1 -1
View File
@@ -425,7 +425,7 @@ export interface CreateProductVariantOnlyDTO {
}
export interface UpdateProductVariantOnlyDTO {
id: string,
id: string
title?: string
sku?: string
barcode?: string
@@ -0,0 +1,13 @@
export interface SalesChannelLocationDTO {
sales_channel_id: string
location_id: string
sales_channel: SalesChannelDTO
}
export interface SalesChannelDTO {
id: string
description: string | null
is_disabled: boolean
metadata: Record<string, unknown> | null
locations?: SalesChannelLocationDTO[]
}
@@ -0,0 +1 @@
export * from "./common"
+10
View File
@@ -0,0 +1,10 @@
export interface WorkflowInputConfig {
listConfig?: {
select?: string[]
relations?: string[]
}
retrieveConfig?: {
select?: string[]
relations?: string[]
}
}
+2
View File
@@ -0,0 +1,2 @@
export * as ProductWorkflow from "./product"
export * as CommonWorkflow from "./common"
@@ -0,0 +1,100 @@
import { ProductStatus } from "../../product"
import { WorkflowInputConfig } from "../common"
export interface CreateProductTypeInputDTO {
id?: string
value: string
}
export interface CreateProductTagInputDTO {
id?: string
value: string
}
export interface CreateProductSalesChannelInputDTO {
id: string
}
export interface CraeteProductProductCategoryInputDTO {
id: string
}
export interface CreateProductOptionInputDTO {
title: string
}
export interface CreateProductVariantPricesInputDTO {
id?: string
region_id?: string
currency_code?: string
amount: number
min_quantity?: number
max_quantity?: number
}
export interface CraeteProductVariantOptionInputDTO {
value: string
option_id: string
}
export interface CreateProductVariantInputDTO {
id?: string
title?: string
sku?: string
ean?: string
upc?: string
barcode?: string
hs_code?: string
inventory_quantity?: number
allow_backorder?: boolean
manage_inventory?: boolean
weight?: number
length?: number
height?: number
width?: number
origin_country?: string
mid_code?: string
material?: string
metadata?: Record<string, unknown>
prices?: CreateProductVariantPricesInputDTO[]
options?: CraeteProductVariantOptionInputDTO[]
}
export interface CreateProductInputDTO {
title: string
subtitle?: string
description?: string
is_giftcard?: boolean
discountable?: boolean
images?: string[]
thumbnail?: string
handle?: string
status?: ProductStatus
type?: CreateProductTypeInputDTO
collection_id?: string
tags?: CreateProductTagInputDTO[]
categories?: CraeteProductProductCategoryInputDTO[]
options?: CreateProductOptionInputDTO[]
variants?: CreateProductVariantInputDTO[]
weight?: number
length?: number
height?: number
width?: number
hs_code?: string
origin_country?: string
mid_code?: string
material?: string
metadata?: Record<string, unknown>
sales_channels?: CreateProductSalesChannelInputDTO[]
listConfig: {
select: string[]
relations: string[]
}
}
export interface CreateProductsWorkflowInputDTO {
products: CreateProductInputDTO[]
config?: WorkflowInputConfig
}
@@ -0,0 +1 @@
export * from "./create-products"