feat: Workflow engine modules (#6128)

This commit is contained in:
Carlos R. L. Rodrigues
2024-01-23 10:08:08 -03:00
committed by GitHub
parent d85fee42ee
commit 302323916b
119 changed files with 5339 additions and 263 deletions
@@ -18,8 +18,8 @@ export async function mikroOrmCreateConnection(
// It is important that the knex package version is the same as the one used by MikroORM knex package
driverOptions = database.connection
clientUrl =
database.connection.context.client.config.connection.connectionString
schema = database.connection.context.client.config.searchPath
database.connection.context?.client?.config?.connection?.connectionString
schema = database.connection.context?.client?.config?.searchPath
}
const { MikroORM } = await import("@mikro-orm/postgresql")
@@ -1,3 +1,3 @@
export * from "./inject-transaction-manager"
export * from "./inject-manager"
export * from "./inject-shared-context"
export * from "./inject-transaction-manager"
@@ -93,7 +93,7 @@ export function loadDatabaseConfig(
database.connection = options.database!.connection
}
if (!database.clientUrl && !silent) {
if (!database.clientUrl && !silent && !database.connection) {
throw new MedusaError(
MedusaError.Types.INVALID_ARGUMENT,
"No database clientUrl provided. Please provide the clientUrl through the [MODULE]_POSTGRES_URL, MEDUSA_POSTGRES_URL or POSTGRES_URL environment variable or the options object in the initialize function."
@@ -1 +1,2 @@
export * from "./symbol"
export * from "./types"
+34
View File
@@ -0,0 +1,34 @@
export enum TransactionHandlerType {
INVOKE = "invoke",
COMPENSATE = "compensate",
}
export enum TransactionStepStatus {
IDLE = "idle",
OK = "ok",
WAITING = "waiting_response",
TEMPORARY_FAILURE = "temp_failure",
PERMANENT_FAILURE = "permanent_failure",
}
export enum TransactionState {
NOT_STARTED = "not_started",
INVOKING = "invoking",
WAITING_TO_COMPENSATE = "waiting_to_compensate",
COMPENSATING = "compensating",
DONE = "done",
REVERTED = "reverted",
FAILED = "failed",
}
export enum TransactionStepState {
NOT_STARTED = "not_started",
INVOKING = "invoking",
COMPENSATING = "compensating",
DONE = "done",
REVERTED = "reverted",
FAILED = "failed",
DORMANT = "dormant",
SKIPPED = "skipped",
TIMEOUT = "timeout",
}