@medusajs/workflows-sdk 2.22.0-snapshot-20261020204851 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +123 -0
- package/README.md +105 -0
- package/dist/medusa-workflow.d.ts.map +1 -1
- package/dist/medusa-workflow.js +0 -5
- package/dist/medusa-workflow.js.map +1 -1
- package/dist/utils/composer/create-hook.d.ts.map +1 -1
- package/dist/utils/composer/create-hook.js +0 -6
- package/dist/utils/composer/create-hook.js.map +1 -1
- package/dist/utils/composer/create-workflow.d.ts.map +1 -1
- package/dist/utils/composer/create-workflow.js +1 -19
- package/dist/utils/composer/create-workflow.js.map +1 -1
- package/dist/utils/composer/when.js +3 -15
- package/dist/utils/composer/when.js.map +1 -1
- package/package.json +10 -6
package/AGENTS.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# @medusajs/workflows-sdk
|
|
2
|
+
|
|
3
|
+
Composition API for Medusa workflows (`createWorkflow`, `createStep`, `transform`, `when`, `parallelize`, `createHook`). It builds a step graph on top of `@medusajs/orchestration`; execution is handled by the workflow engine module.
|
|
4
|
+
|
|
5
|
+
## Using this package
|
|
6
|
+
|
|
7
|
+
- Import from `@medusajs/framework/workflows-sdk` in apps and plugins (re-exports this package), not from `@medusajs/workflows-sdk` directly.
|
|
8
|
+
- Docs: https://docs.medusajs.com/learn/fundamentals/workflows.md, constraints: https://docs.medusajs.com/learn/fundamentals/workflows/constructor-constraints.md
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import {
|
|
12
|
+
createStep,
|
|
13
|
+
createWorkflow,
|
|
14
|
+
StepResponse,
|
|
15
|
+
transform,
|
|
16
|
+
when,
|
|
17
|
+
WorkflowResponse,
|
|
18
|
+
} from "@medusajs/framework/workflows-sdk"
|
|
19
|
+
|
|
20
|
+
const createBrandStep = createStep(
|
|
21
|
+
"create-brand",
|
|
22
|
+
async (input: { name: string }, { container }) => {
|
|
23
|
+
const brandService = container.resolve("brand")
|
|
24
|
+
const brand = await brandService.createBrands(input)
|
|
25
|
+
return new StepResponse(brand, brand.id)
|
|
26
|
+
},
|
|
27
|
+
async (brandId, { container }) => {
|
|
28
|
+
if (!brandId) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
await container.resolve("brand").deleteBrands(brandId)
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
export const createBrandWorkflow = createWorkflow(
|
|
36
|
+
"create-brand",
|
|
37
|
+
function (input: { name: string; notify?: boolean }) {
|
|
38
|
+
const brand = createBrandStep({ name: input.name })
|
|
39
|
+
const payload = transform({ brand }, ({ brand }) => ({ id: brand.id }))
|
|
40
|
+
when("notify-brand", { input }, ({ input }) => !!input.notify).then(
|
|
41
|
+
() => {
|
|
42
|
+
notifyBrandStep(payload)
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
return new WorkflowResponse(brand)
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
const { result } = await createBrandWorkflow(req.scope).run({
|
|
50
|
+
input: { name: "Acme" },
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Composition rules (the constructor runs once, at definition time)
|
|
55
|
+
|
|
56
|
+
- `createWorkflow` calls the constructor immediately to record the step graph (`composer.apply(context, [inputPlaceHolder])` in `create-workflow.ts`). At that time `input` and every step result are proxies, not values.
|
|
57
|
+
- Therefore no `if`/ternary/`??`/`||`/`?.`/`!!`/spread/loops/`try-catch`/`new Date()` on workflow data in the constructor. Use `transform()` to compute values and `when(...).then(...)` for branching. The constructor must not be `async`.
|
|
58
|
+
- `transform(values, fn1, fn2, ...)` chains up to 7 functions; results are cached per transaction in temporary data, so a transform runs once per execution.
|
|
59
|
+
- `when(input, cond).then(fn)`: if `then` returns a non-step value, give the `when` a name (`when("name", input, cond)`), otherwise a random `when-then-<ulid>` name is used with a console warning ("not recommended for production"). Forgetting `.then` throws `".then" is missing after "when" condition` on next tick.
|
|
60
|
+
- Calling `createStep(...)` result outside a `createWorkflow` constructor throws `createStep must be used inside a createWorkflow definition`.
|
|
61
|
+
- Reusing the same step twice in one workflow needs `.config({ name: "unique-name" })`, otherwise orchestration throws `Step <name> is already defined in workflow.`
|
|
62
|
+
- `parallelize(stepA(), stepB())` merges the actions to run in parallel.
|
|
63
|
+
- Run another workflow inside a workflow with `otherWorkflow.runAsStep({ input })`, not `.run()`.
|
|
64
|
+
- Step and workflow outputs are serialized for storage: return only serializable data (no `Map`, class instances).
|
|
65
|
+
|
|
66
|
+
### Steps and compensation
|
|
67
|
+
|
|
68
|
+
- `new StepResponse(output, compensateInput?)`: compensate input defaults to `output` when omitted. The compensation function receives it (may be `undefined`), so guard for it.
|
|
69
|
+
- `StepResponse.permanentFailure(message, compensateInput?)` fails without retries; `StepResponse.skip()` marks the step skipped.
|
|
70
|
+
- Step config (`createStep({ name, ...config }, fn)` or `.config({...})`): `async`, `compensateAsync`, `maxRetries`, `retryInterval`, `timeout`, `continueOnPermanentFailure`, `skipOnPermanentFailure`, `saveResponse`, `nested` (from `TransactionStepsDefinition` in orchestration).
|
|
71
|
+
- Step context (`StepExecutionContext`): `container`, `context`, `workflowId`, `stepName`, `action`, `attempt`, `idempotencyKey`, `transactionId`, `metadata`, `eventGroupId`.
|
|
72
|
+
|
|
73
|
+
### Long-running / async steps
|
|
74
|
+
|
|
75
|
+
- A step with `async: true` that returns no `StepResponse` leaves the workflow waiting in the background; if it does return a `StepResponse` it completes immediately (`wrapAsyncHandler`).
|
|
76
|
+
- Complete it later with the workflow engine service (`Modules.WORKFLOW_ENGINE`) `setStepSuccess` / `setStepFailure`, passing `idempotencyKey: { action, transactionId, stepId, workflowId }`. Docs: https://docs.medusajs.com/learn/fundamentals/workflows/long-running-workflow.md
|
|
77
|
+
|
|
78
|
+
### Hooks
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const productCreated = createHook("productCreated", { product })
|
|
82
|
+
return new WorkflowResponse(product, { hooks: [productCreated] })
|
|
83
|
+
|
|
84
|
+
// consumer, e.g. src/workflows/hooks/product-created.ts
|
|
85
|
+
myWorkflow.hooks.productCreated(async ({ product }, { container }) => {
|
|
86
|
+
// ...
|
|
87
|
+
}, async (compensateInput, { container }) => {})
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- One handler per hook: a second registration throws `Cannot define multiple hook handlers for the <name> hook`. Unconsumed hooks run as no-op steps.
|
|
91
|
+
- `createHook(name, input, { resultValidator })` + `hook.getResult()` lets a workflow read the handler's return value (validated with a Zod-like `parse`).
|
|
92
|
+
- Docs: https://docs.medusajs.com/learn/fundamentals/workflows/workflow-hooks.md
|
|
93
|
+
|
|
94
|
+
### Running
|
|
95
|
+
|
|
96
|
+
- `workflow(container).run({ input, context, throwOnError, resultFrom, logOnError })`. `throwOnError` defaults to `true`; with `false`, inspect `errors` on the returned `{ result, errors, transaction }`.
|
|
97
|
+
- Exported workflow also has `registerStepSuccess`, `registerStepFailure`, `retryStep`, `cancel`.
|
|
98
|
+
|
|
99
|
+
## Architecture
|
|
100
|
+
|
|
101
|
+
- `src/utils/composer/`: `create-workflow.ts`, `create-step.ts`, `transform.ts`, `when.ts`, `parallelize.ts`, `create-hook.ts`, `helpers/` (`StepResponse`, `WorkflowResponse`, proxy, `resolveValue`, step handler).
|
|
102
|
+
- `src/helper/workflow-export.ts`: `exportWorkflow` wraps a `LocalWorkflow` with `run`/`cancel`/etc. and resolves results.
|
|
103
|
+
- `src/medusa-workflow.ts`: global `MedusaWorkflow` registry (stored on `global`, so duplicated package copies share it).
|
|
104
|
+
- Composition state lives on `global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext]` and the `when` condition on `global[...SymbolMedusaWorkflowComposerCondition]`; steps attach to whatever context is current.
|
|
105
|
+
- Workflow names are global: re-calling `createWorkflow` with an existing name re-registers it in `WorkflowManager` (this is how definitions are overridden).
|
|
106
|
+
- Subpath export `@medusajs/workflows-sdk/composer` (re-exported as `@medusajs/framework/workflows-sdk/composer`).
|
|
107
|
+
|
|
108
|
+
## Development
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
yarn workspace @medusajs/workflows-sdk build
|
|
112
|
+
yarn workspace @medusajs/workflows-sdk test
|
|
113
|
+
cd packages/core/workflows-sdk && ../../../node_modules/.bin/jest src/utils/composer/__tests__/compose.spec.ts
|
|
114
|
+
yarn workspace @medusajs/workflows-sdk test:run # runs dist/utils/_playground.js after build
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
- Unit tests: `src/utils/composer/__tests__/` (`compose.spec.ts`, `index.spec.ts`).
|
|
118
|
+
- Engine-level behavior (async steps, retries, subscribe, races) is tested in `packages/modules/workflow-engine-inmemory/integration-tests/__tests__/` and `packages/modules/workflow-engine-redis/integration-tests/__tests__/`.
|
|
119
|
+
|
|
120
|
+
## Gotchas
|
|
121
|
+
|
|
122
|
+
- Hook handlers are wrapped in the same `when` condition as the hook if declared inside one.
|
|
123
|
+
- `runAsStep` of an async workflow runs it via the workflow engine as a nested transaction with id `<name>-as-step-<parentTransactionId>`; its compensation cancels that nested transaction.
|
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://www.medusajs.com">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/59018053/229103275-b5e482bb-4601-46e6-8142-244f531cebdb.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
|
|
6
|
+
<img alt="Medusa logo" src="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
<h1 align="center">
|
|
11
|
+
@medusajs/workflows-sdk
|
|
12
|
+
</h1>
|
|
13
|
+
|
|
14
|
+
<h4 align="center">
|
|
15
|
+
<a href="https://docs.medusajs.com">Documentation</a> |
|
|
16
|
+
<a href="https://www.medusajs.com">Website</a>
|
|
17
|
+
</h4>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
Building blocks for digital commerce
|
|
21
|
+
</p>
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://github.com/medusajs/medusa/blob/develop/LICENSE">
|
|
24
|
+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Medusa is released under the MIT license." />
|
|
25
|
+
</a>
|
|
26
|
+
<a href="https://github.com/medusajs/medusa/blob/develop/CONTRIBUTING.md">
|
|
27
|
+
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" alt="PRs welcome!" />
|
|
28
|
+
</a>
|
|
29
|
+
<a href="https://discord.gg/xpCwq3Kfn8">
|
|
30
|
+
<img src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" alt="Discord Chat" />
|
|
31
|
+
</a>
|
|
32
|
+
<a href="https://twitter.com/intent/follow?screen_name=medusajs">
|
|
33
|
+
<img src="https://img.shields.io/twitter/follow/medusajs.svg?label=Follow%20@medusajs" alt="Follow @medusajs" />
|
|
34
|
+
</a>
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
Workflows SDK for Medusa: the tools to define durable, multi-step workflows with steps, compensation (rollback), hooks, and conditions. Use it to build custom commerce flows in a Medusa application, module, or plugin. Applications import it through `@medusajs/framework/workflows-sdk`, which re-exports this package; importing `@medusajs/workflows-sdk` directly is discouraged.
|
|
38
|
+
|
|
39
|
+
## At a glance
|
|
40
|
+
|
|
41
|
+
| | |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| Package | `@medusajs/workflows-sdk` |
|
|
44
|
+
| Type | Core library |
|
|
45
|
+
| Import from | `@medusajs/framework/workflows-sdk` |
|
|
46
|
+
| Entry points | `.`, `./composer` (available as `@medusajs/framework/workflows-sdk/composer`) |
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- `createStep` and `StepResponse` to define steps with an optional compensation function.
|
|
51
|
+
- `createWorkflow` and `WorkflowResponse` to compose steps into a workflow.
|
|
52
|
+
- `transform`, `when`, and `parallelize` to manipulate data, run steps conditionally, and run steps in parallel inside a workflow.
|
|
53
|
+
- `createHook` to expose hooks that other code can consume to extend a workflow.
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
No separate installation is needed in a Medusa application. It's installed with `@medusajs/framework`.
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import {
|
|
63
|
+
createStep,
|
|
64
|
+
createWorkflow,
|
|
65
|
+
StepResponse,
|
|
66
|
+
WorkflowResponse,
|
|
67
|
+
} from "@medusajs/framework/workflows-sdk"
|
|
68
|
+
|
|
69
|
+
type WorkflowInput = {
|
|
70
|
+
name: string
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const greetStep = createStep(
|
|
74
|
+
"greet-step",
|
|
75
|
+
async ({ name }: WorkflowInput) => {
|
|
76
|
+
return new StepResponse(`Hello ${name}!`)
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
const helloWorldWorkflow = createWorkflow(
|
|
81
|
+
"hello-world",
|
|
82
|
+
function (input: WorkflowInput) {
|
|
83
|
+
const message = greetStep(input)
|
|
84
|
+
|
|
85
|
+
return new WorkflowResponse({ message })
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
export default helloWorldWorkflow
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Execute the workflow by passing it the Medusa container, for example in an API route:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const { result } = await helloWorldWorkflow(req.scope).run({
|
|
96
|
+
input: { name: "John" },
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Resources
|
|
101
|
+
|
|
102
|
+
- [Workflows](https://docs.medusajs.com/learn/fundamentals/workflows)
|
|
103
|
+
- [Compensation function](https://docs.medusajs.com/learn/fundamentals/workflows/compensation-function)
|
|
104
|
+
- [Workflow hooks](https://docs.medusajs.com/learn/fundamentals/workflows/workflow-hooks)
|
|
105
|
+
- [Long-running workflows](https://docs.medusajs.com/learn/fundamentals/workflows/long-running-workflow)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"medusa-workflow.d.ts","sourceRoot":"","sources":["../src/medusa-workflow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"medusa-workflow.d.ts","sourceRoot":"","sources":["../src/medusa-workflow.ts"],"names":[],"mappings":"AAkCA,QAAA,MAAM,oBAAoB,KAAwB,CAAA;AAElD,OAAO,EAAE,oBAAoB,IAAI,cAAc,EAAE,CAAA"}
|
package/dist/medusa-workflow.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MedusaWorkflow = void 0;
|
|
4
|
-
const utils_1 = require("@medusajs/utils");
|
|
5
4
|
class MedusaWorkflow {
|
|
6
5
|
static registerWorkflow(workflowId, exportedWorkflow) {
|
|
7
6
|
if (workflowId in MedusaWorkflow.workflows) {
|
|
@@ -13,10 +12,6 @@ class MedusaWorkflow {
|
|
|
13
12
|
delete MedusaWorkflow.workflows[workflowId];
|
|
14
13
|
}
|
|
15
14
|
static getWorkflow(workflowId) {
|
|
16
|
-
// Workflows listed in the build manifest are loaded on first use
|
|
17
|
-
if (!(workflowId in MedusaWorkflow.workflows)) {
|
|
18
|
-
(0, utils_1.loadWorkflowFromManifest)(workflowId);
|
|
19
|
-
}
|
|
20
15
|
return MedusaWorkflow.workflows[workflowId];
|
|
21
16
|
}
|
|
22
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"medusa-workflow.js","sourceRoot":"","sources":["../src/medusa-workflow.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"medusa-workflow.js","sourceRoot":"","sources":["../src/medusa-workflow.ts"],"names":[],"mappings":";;;AAIA,MAAM,cAAc;IAYlB,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,gBAAgB;QAClD,IAAI,UAAU,IAAI,cAAc,CAAC,SAAS,EAAE,CAAC;YAC3C,OAAM;QACR,CAAC;QAED,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,gBAAgB,CAAA;IACzD,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,UAAU;QAClC,OAAO,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IAC7C,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,UAAU;QAC3B,OAAO,cAAc,CAAC,SAAS,CAAC,UAAU,CAAgC,CAAA;IAC5E,CAAC;;AAzBM,wBAAS,GASZ,EAAE,CAAA;AAmBR,MAAM,CAAC,cAAc,KAAK,cAAc,CAAA;AACxC,MAAM,oBAAoB,GAAG,MAAM,CAAC,cAAc,CAAA;AAEjB,8CAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-hook.d.ts","sourceRoot":"","sources":["../../../src/utils/composer/create-hook.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"create-hook.d.ts","sourceRoot":"","sources":["../../../src/utils/composer/create-hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAWpD,KAAK,OAAO,CAAC,CAAC,GAAG,GAAG,IAAI;IACtB,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,CAAC,CAAA;CACxB,CAAA;AAID;;GAEG;AACH,MAAM,MAAM,IAAI,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI;IACrD,MAAM,EAAE,OAAO,kBAAkB,CAAC,kBAAkB,CAAA;IACpD,IAAI,EAAE,IAAI,CAAA;IAEV;;OAEG;IACH,SAAS,IAAI,MAAM,GAAG,SAAS,CAAA;IAE/B;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAA;CAChB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,UAAU,CAAC,IAAI,SAAS,MAAM,EAAE,YAAY,EAAE,aAAa,EACzE,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,YAAY,EACvB,OAAO,GAAE;IACP,eAAe,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;CACpC,GACL,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,aAAa,CAAC,CA0EzC"}
|
|
@@ -78,12 +78,6 @@ function createHook(name, hookInput, options = {}) {
|
|
|
78
78
|
}
|
|
79
79
|
this.hooks_.registered.push(name);
|
|
80
80
|
this.handlers.set(name, handlers);
|
|
81
|
-
// Build-time collection of which file registers which hook
|
|
82
|
-
global[utils_1.HOOK_REGISTRATIONS_KEY]?.push({
|
|
83
|
-
workflowId: this.workflowId,
|
|
84
|
-
hook: name,
|
|
85
|
-
file: (0, utils_1.getCallerFilePath)(),
|
|
86
|
-
});
|
|
87
81
|
}
|
|
88
82
|
return hook;
|
|
89
83
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-hook.js","sourceRoot":"","sources":["../../../src/utils/composer/create-hook.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"create-hook.js","sourceRoot":"","sources":["../../../src/utils/composer/create-hook.ts"],"names":[],"mappings":";;AA0EA,gCAgFC;AA1JD,2CAAoD;AACpD,+CAKsB;AACtB,uCAAwC;AACxC,uEAAiE;AAOjE,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAwBtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,SAAgB,UAAU,CACxB,I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,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1C,MAAM,IAAI,KAAK,CACb,gDAAgD,IAAI,OAAO,CAC5D,CAAA;YACH,CAAC;YAED,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;YAC9C,IAAI,WAAW,EAAE,CAAC;gBAChB,IAAA,iCAAmB,EAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;YACzE,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACjC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;QACnC,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,MAAM,EAAE,0BAAkB,CAAC,kBAAkB;QAC7C,IAAI;QACJ,SAAS;YACP,IAAI,cAAc,IAAI,IAAI,EAAE,CAAC;gBAC3B,OAAO,IAAI,CAAC,YAAY,CAAA;YAC1B,CAAC;YACD,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAA;YAClC,IAAI,CAAC,cAAc,CAAC,GAAG,MAAM,CAAA;YAC7B,OAAO,MAAM,CAAA;QACf,CAAC;KACyC,CAAA;AAC9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-workflow.d.ts","sourceRoot":"","sources":["../../../src/utils/composer/create-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAGxB,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"create-workflow.d.ts","sourceRoot":"","sources":["../../../src/utils/composer/create-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAGxB,MAAM,yBAAyB,CAAA;AAkBhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAGL,cAAc,EAGd,YAAY,EACb,MAAM,QAAQ,CAAA;AAgBf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,GAAG,EAAE;AACjE;;GAEG;AACH,YAAY,EAAE,MAAM,GAAG,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,uBAAuB,CAAC;AACnE;;;;GAIG;AACH,QAAQ,EAAE,CACR,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,KACvB,IAAI,GAAG,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,GAC5C,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAwLxC"}
|
|
@@ -82,7 +82,6 @@ nameOrConfig,
|
|
|
82
82
|
composer) {
|
|
83
83
|
const fileSourcePath = (0, utils_1.getCallerFilePath)();
|
|
84
84
|
const name = (0, utils_1.isString)(nameOrConfig) ? nameOrConfig : nameOrConfig.name;
|
|
85
|
-
(0, utils_1.setWorkflowBeingDefined)(name, true);
|
|
86
85
|
const options = (0, utils_1.isString)(nameOrConfig) ? {} : nameOrConfig;
|
|
87
86
|
(0, utils_1.registerDevServerResource)({
|
|
88
87
|
sourcePath: fileSourcePath,
|
|
@@ -119,13 +118,7 @@ composer) {
|
|
|
119
118
|
return fn.bind(context)();
|
|
120
119
|
},
|
|
121
120
|
};
|
|
122
|
-
// A workflow can be created while another one is being composed (e.g. when
|
|
123
|
-
// composing references a workflow whose module loads lazily), so restore
|
|
124
|
-
// the outer context afterwards instead of clearing it.
|
|
125
|
-
const parentContext = global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerContext];
|
|
126
|
-
const parentCondition = global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerCondition];
|
|
127
121
|
global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = context;
|
|
128
|
-
delete global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerCondition];
|
|
129
122
|
const inputPlaceHolder = (0, proxy_1.proxify)({
|
|
130
123
|
__type: utils_1.OrchestrationUtils.SymbolInputReference,
|
|
131
124
|
__step__: "",
|
|
@@ -135,17 +128,7 @@ composer) {
|
|
|
135
128
|
},
|
|
136
129
|
});
|
|
137
130
|
const returnedStep = composer.apply(context, [inputPlaceHolder]);
|
|
138
|
-
|
|
139
|
-
global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerContext] =
|
|
140
|
-
parentContext;
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
delete global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerContext];
|
|
144
|
-
}
|
|
145
|
-
if (parentCondition) {
|
|
146
|
-
global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerCondition] =
|
|
147
|
-
parentCondition;
|
|
148
|
-
}
|
|
131
|
+
delete global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerContext];
|
|
149
132
|
if (newWorkflow) {
|
|
150
133
|
orchestration_1.WorkflowManager.update(name, context.flow, handlers, options);
|
|
151
134
|
}
|
|
@@ -170,7 +153,6 @@ composer) {
|
|
|
170
153
|
}
|
|
171
154
|
mainFlow.getName = () => name;
|
|
172
155
|
mainFlow.run = mainFlow().run;
|
|
173
|
-
(0, utils_1.setWorkflowBeingDefined)(name, false);
|
|
174
156
|
mainFlow.runAsStep = ({ input, }) => {
|
|
175
157
|
// Get current workflow composition context
|
|
176
158
|
const workflowCompositionContext = global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerContext];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-workflow.js","sourceRoot":"","sources":["../../../src/utils/composer/create-workflow.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"create-workflow.js","sourceRoot":"","sources":["../../../src/utils/composer/create-workflow.ts"],"names":[],"mappings":";;AAqGA,wCAqMC;AA1SD,2DAI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7C,SAAS;oBACT,OAAO,EAAE,gBAAgB;iBAC1B,CAAC,CAAA;YACJ,CAAC;YAED,OAAM;QACR,CAAC,CACF,CAAC,KAAK,CAA6C,CAAA;QAEpD,OAAO,IAAI,CAAA;IACb,CAAC,CAAA;IAED,OAAO,QAAkD,CAAA;AAC3D,CAAC"}
|
|
@@ -18,17 +18,11 @@ function when(...args) {
|
|
|
18
18
|
if (typeof condition !== "function") {
|
|
19
19
|
throw new Error(`"when condition" must be a function`);
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
// steps are being defined (e.g. a lazily loaded workflow module), which
|
|
23
|
-
// replaces the global until it's done.
|
|
24
|
-
const parentCondition = global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerCondition];
|
|
25
|
-
const conditionContext = {
|
|
21
|
+
global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerCondition] = {
|
|
26
22
|
input,
|
|
27
23
|
condition,
|
|
28
24
|
steps: [],
|
|
29
25
|
};
|
|
30
|
-
global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerCondition] =
|
|
31
|
-
conditionContext;
|
|
32
26
|
let thenCalled = false;
|
|
33
27
|
process.nextTick(() => {
|
|
34
28
|
if (!thenCalled) {
|
|
@@ -40,7 +34,7 @@ function when(...args) {
|
|
|
40
34
|
thenCalled = true;
|
|
41
35
|
const ret = fn();
|
|
42
36
|
let returnStep = ret;
|
|
43
|
-
const applyCondition =
|
|
37
|
+
const applyCondition = global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerCondition].steps;
|
|
44
38
|
if ((0, utils_1.isDefined)(ret) &&
|
|
45
39
|
ret?.__type !== utils_1.OrchestrationUtils.SymbolWorkflowStep) {
|
|
46
40
|
if (!(0, utils_1.isDefined)(name)) {
|
|
@@ -65,13 +59,7 @@ function when(...args) {
|
|
|
65
59
|
for (const step of applyCondition) {
|
|
66
60
|
step.if(input, condition);
|
|
67
61
|
}
|
|
68
|
-
|
|
69
|
-
global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerCondition] =
|
|
70
|
-
parentCondition;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
delete global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerCondition];
|
|
74
|
-
}
|
|
62
|
+
delete global[utils_1.OrchestrationUtils.SymbolMedusaWorkflowComposerCondition];
|
|
75
63
|
return returnStep;
|
|
76
64
|
},
|
|
77
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"when.js","sourceRoot":"","sources":["../../../src/utils/composer/when.ts"],"names":[],"mappings":";;AAoFA,
|
|
1
|
+
{"version":3,"file":"when.js","sourceRoot":"","sources":["../../../src/utils/composer/when.ts"],"names":[],"mappings":";;AAoFA,oBA4EC;AAhKD,2CAAyE;AACzE,+BAA2B;AAC3B,+CAA0C;AAC1C,2DAAsD;AA8EtD;;GAEG;AACH,SAAgB,IAAI,CAAC,GAAG,IAAI;IAC1B,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,GAAG,IAAI,CAAA;IACnC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,SAAS,GAAG,KAAK,CAAA;QACjB,KAAK,GAAG,IAAI,CAAA;QACZ,IAAI,GAAG,SAAS,CAAA;IAClB,CAAC;IAED,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IAED,MAAM,CAAC,0BAAkB,CAAC,qCAAqC,CAAC,GAAG;QACjE,KAAK;QACL,SAAS;QACT,KAAK,EAAE,EAAE;KACV,CAAA;IAED,IAAI,UAAU,GAAG,KAAK,CAAA;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;QAC9D,CAAC;IACH,CAAC,CAAC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,EAAE,CAAC;gBAClC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;YAC3B,CAAC;YAED,OAAO,MAAM,CAAC,0BAAkB,CAAC,qCAAqC,CAAC,CAAA;YAEvE,OAAO,UAAU,CAAA;QACnB,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/workflows-sdk",
|
|
3
|
-
"version": "2.22.0
|
|
3
|
+
"version": "2.22.0",
|
|
4
4
|
"description": "Set of workflows tooling for Medusa",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -23,20 +23,24 @@
|
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|
|
26
|
+
"AGENTS.md",
|
|
26
27
|
"!dist/**/__tests__",
|
|
27
28
|
"!dist/**/__mocks__",
|
|
28
29
|
"!dist/**/__fixtures__"
|
|
29
30
|
],
|
|
31
|
+
"llms": "https://docs.medusajs.com/llms.txt",
|
|
32
|
+
"llmsFull": "https://docs.medusajs.com/llms-full.txt",
|
|
33
|
+
"mcpServer": "https://docs.medusajs.com/mcp",
|
|
30
34
|
"author": "Medusa",
|
|
31
35
|
"license": "MIT",
|
|
32
36
|
"devDependencies": {
|
|
33
|
-
"@medusajs/types": "2.22.0
|
|
37
|
+
"@medusajs/types": "2.22.0"
|
|
34
38
|
},
|
|
35
39
|
"dependencies": {
|
|
36
|
-
"@medusajs/deps": "2.22.0
|
|
37
|
-
"@medusajs/modules-sdk": "2.22.0
|
|
38
|
-
"@medusajs/orchestration": "2.22.0
|
|
39
|
-
"@medusajs/utils": "2.22.0
|
|
40
|
+
"@medusajs/deps": "2.22.0",
|
|
41
|
+
"@medusajs/modules-sdk": "2.22.0",
|
|
42
|
+
"@medusajs/orchestration": "2.22.0",
|
|
43
|
+
"@medusajs/utils": "2.22.0",
|
|
40
44
|
"ulid": "^2.3.0"
|
|
41
45
|
},
|
|
42
46
|
"scripts": {
|