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

This commit is contained in:
Adrien de Peretti
2023-08-05 16:03:45 +02:00
committed by GitHub
parent 433914ae01
commit dc46927bc6
68 changed files with 1224 additions and 1064 deletions
+3
View File
@@ -3,3 +3,6 @@ export * as EventBusUtils from "./event-bus"
export * as SearchUtils from "./search"
export * as ModulesSdkUtils from "./modules-sdk"
export * as DALUtils from "./dal"
export * as FeatureFlagUtils from "./feature-flags"
export * as ShippingProfileUtils from "./shipping"
export * as ProductUtils from "./product"
@@ -0,0 +1,9 @@
import { FeatureFlagTypes } from "@medusajs/types"
export const AnalyticsFeatureFlag: FeatureFlagTypes.FlagSettings = {
key: "analytics",
default_val: true,
env_key: "MEDUSA_FF_ANALYTICS",
description:
"Enable Medusa to collect data on usage, errors and performance for the purpose of improving the product",
}
@@ -0,0 +1,7 @@
export * from "./analytics"
export * from "./order-editing"
export * from "./sales-channels"
export * from "./product-categories"
export * from "./publishable-api-keys"
export * from "./tax-inclusive-pricing"
export * from "./utils"
@@ -0,0 +1,8 @@
import { FeatureFlagTypes } from "@medusajs/types"
export const OrderEditingFeatureFlag: FeatureFlagTypes.FlagSettings = {
key: "order_editing",
default_val: true,
env_key: "MEDUSA_FF_ORDER_EDITING",
description: "[WIP] Enable the order editing feature",
}
@@ -0,0 +1,8 @@
import { FeatureFlagTypes } from "@medusajs/types"
export const ProductCategoryFeatureFlag: FeatureFlagTypes.FlagSettings = {
key: "product_categories",
default_val: false,
env_key: "MEDUSA_FF_PRODUCT_CATEGORIES",
description: "[WIP] Enable the product categories feature",
}
@@ -0,0 +1,8 @@
import { FeatureFlagTypes } from "@medusajs/types"
export const PublishableAPIKeysFeatureFlag: FeatureFlagTypes.FlagSettings = {
key: "publishable_api_keys",
default_val: true,
env_key: "MEDUSA_FF_PUBLISHABLE_API_KEYS",
description: "[WIP] Enable the publishable API keys feature",
}
@@ -0,0 +1,8 @@
import { FeatureFlagTypes } from "@medusajs/types"
export const SalesChannelFeatureFlag: FeatureFlagTypes.FlagSettings = {
key: "sales_channels",
default_val: true,
env_key: "MEDUSA_FF_SALES_CHANNELS",
description: "[WIP] Enable the sales channels feature",
}
@@ -0,0 +1,8 @@
import { FeatureFlagTypes } from "@medusajs/types"
export const TaxInclusivePricingFeatureFlag: FeatureFlagTypes.FlagSettings = {
key: "tax_inclusive_pricing",
default_val: false,
env_key: "MEDUSA_FF_TAX_INCLUSIVE_PRICING",
description: "[WIP] Enable tax inclusive pricing",
}
@@ -0,0 +1,24 @@
import { FeatureFlagTypes } from "@medusajs/types"
export class FlagRouter implements FeatureFlagTypes.IFlagRouter {
private readonly flags: Record<string, boolean> = {}
constructor(flags: Record<string, boolean>) {
this.flags = flags
}
public isFeatureEnabled(key: string): boolean {
return !!this.flags[key]
}
public setFlag(key: string, value = true): void {
this.flags[key] = value
}
public listFlags(): FeatureFlagTypes.FeatureFlagsResponse {
return Object.entries(this.flags || {}).map(([key, value]) => ({
key,
value,
}))
}
}
@@ -0,0 +1 @@
export * from "./flag-router"
+3
View File
@@ -6,3 +6,6 @@ export * from "./event-bus"
export * from "./search"
export * from "./modules-sdk"
export * from "./dal"
export * from "./feature-flags"
export * from "./shipping"
export * from "./product"
+6
View File
@@ -0,0 +1,6 @@
export enum ProductStatus {
DRAFT = "draft",
PROPOSED = "proposed",
PUBLISHED = "published",
REJECTED = "rejected",
}
+5
View File
@@ -0,0 +1,5 @@
export enum ShippingProfileType {
DEFAULT = "default",
GIFT_CARD = "gift_card",
CUSTOM = "custom",
}