Commit Graph

74 Commits

Author SHA1 Message Date
Adrien de Peretti 7d8f6cf39f fix(): Workflow cancellation + gracefully handle non serializable state (#10674)
FIXES FRMW-2852

**What**
A workflow distributed transaction expect any response and error to be serializable. When it is not the case, the distributed transaction might fail during the save checkpoint that occurs for async steps. This can lead to unexpected behaviour.

With this pr, we introduce a way to handle non serialazable object in a more sustainable manner, this means the following:

- If a workflow throw any non serialazable error (e.g AWS error that contains full IncomingMessage object that related to network communication, think of req/res) then we identify that this object is not serialzable and we clean up the object to make it serializable without loosing the main information, add a new error to the workflow to informed of this issue and can be handled by the user.
- If a response is not serializable (which should not happen at this point because it is handled before by the value resolver), in that case, we wont be able to reuse that response to continue the workflow which means that the workflow is in a non runnable state. In that case we throw a specific error stating that a non serializable context is being provided

**second what**
This pr refactor the `runAsStep` to add better support for workflow cancelation, especially async ones
2025-01-05 13:30:17 +00:00
olivermrbl 348f866ffe chore: Version packages 2024-12-20 11:25:36 +01:00
olivermrbl a391a29aa8 chore: Version packages 2024-12-17 14:41:05 +01:00
olivermrbl 0e342b491d chore: Version packages 2024-12-10 14:01:50 +01:00
Shahed Nasser 7c76ee24cb chore: fix documentation links in TSDocs (#10511) 2024-12-09 18:52:02 +02:00
Carlos R. L. Rodrigues 90ae187e09 fix(workflows-sdk): name for when/then step (#10459) 2024-12-05 15:47:42 -03:00
olivermrbl 4723acd949 chore: Version packages 2024-12-04 18:36:57 +01:00
Carlos R. L. Rodrigues 1f3754a75e chore(workflows-sdk): add unit test (#10419) 2024-12-04 10:32:03 +00:00
olivermrbl e9c1b1127e chore: Version packages 2024-11-27 15:40:07 +01:00
olivermrbl ccf4e801f3 chore: Version packages 2024-11-25 12:14:36 +01:00
olivermrbl 4245312d8d chore: Version packages 2024-11-25 09:57:00 +01:00
Carlos R. L. Rodrigues aeb5b43692 feat(workflows-sdk): add response to permanent failure (#10177) 2024-11-20 17:29:37 -03:00
Adrien de Peretti 10da8b379f chore(workflows-sdk): Display each error individually instead of packed (#10072)
**What**
Instead of displaying a single string prepared with all the errors, log each error individually
2024-11-15 11:27:52 +00:00
Carlos R. L. Rodrigues 1eef324af3 fix(orchestration): fix set step failure (#10031)
What:
 - copy data before saving checkpoint
 - removed unused data format function
 - properly handle registerStepFailure to not throw
 - emit onFinish event even when execution failed
2024-11-12 10:06:36 +00:00
olivermrbl d5605656ae chore: Version packages 2024-11-12 10:10:07 +01:00
olivermrbl ecece05b72 chore: Version packages 2024-11-11 10:58:20 +01:00
olivermrbl 8feb589659 chore: Release 2024-11-06 21:47:01 +01:00
Adrien de Peretti c0368cca28 fix(workflows-sdk): Paralellize steps rollback issue with config (#9921)
* fix(workflows-sdk): Paralellize steps rollback issue with config

* Create tall-starfishes-travel.md
2024-11-05 08:54:04 +01:00
olivermrbl 4ccab16336 chore: Version packages 2024-10-25 17:19:36 +02:00
Shahed Nasser 92bbd7953b chore: update links to v2 docs in source code and comments (#9732) 2024-10-24 15:18:38 +03:00
olivermrbl 2fbebb60e3 chore: Release 2024-10-22 20:43:47 +02:00
Oli Juhl c3418a2b93 chore: Prepare versions + changeset (#9707)
* chore: Prepare version + changeset

* chore: Bump dependencies

* chore: Update lock-file
2024-10-22 20:31:33 +02:00
Adrien de Peretti 7c5415ba3a fix(workflows-sdk):transaction id inheritence (#9507) 2024-10-10 17:08:42 +02:00
Adrien de Peretti 34d57870ad chore: workflow internals improvementss (#9455) 2024-10-10 09:11:56 +02:00
Adrien de Peretti ad3524ffbe feat: Add useQueryStep (#9384)
* feat: Query step replacement

* fix

* fix types
2024-10-07 12:07:06 +02:00
Harminder Virk d98f22c7d6 Feat: Move container bindings declaration merging within the framework (#9467) 2024-10-04 15:47:06 +05:30
Harminder Virk 48e00169d2 breaking: move shared HTTP utils to the framework (#9402)
Fixes: FRMW-2728, FRMW-2729

After this PR gets merged the following middleware will be exported from the `@medusajs/framework/http` import path.

- applyParamsAsFilters
- clearFiltersByKey
- applyDefaultFilters
- setContext
- getQueryConfig
- httpCompression
- maybeApplyLinkFilter
- refetchEntities
- unlessPath
- validateBody
- validateQuery

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-10-03 09:42:00 +00:00
Carlos R. L. Rodrigues 8155c4e9ee fix(workflows-sdk): when then return value (#9427) 2024-10-02 07:40:39 -03:00
Adrien de Peretti 02629625ec feat(orchestration): Provide hint in workflows error (#9400)
* feat(orchestration): Provide hint in workflows error

* remove log

* fix tests

* improve stack

* fix type

* formatting

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2024-10-02 11:54:07 +02:00
Shahed Nasser 20943902f9 chore: update imports in tsdocs (#9379) 2024-10-01 11:04:03 +02:00
Harminder Virk a578313db9 feature: bundle all modules (#9324) 2024-09-30 09:04:03 +02:00
Harminder Virk 48bea267dc chore: perform dependencies scan and fix all dependencies (#9296) 2024-09-26 14:14:38 +05:30
Harminder Virk 9e711720dd chore: upgrade moduleResolution to Node16 (#9269) 2024-09-24 17:19:20 +05:30
Harminder Virk 9f72fb5902 Chore: cleanup workflows SDK (#9244)
Fixes: FRMW-2712
2024-09-23 11:04:38 +00:00
Adrien de Peretti a227d73e4f fix(workflow-sdk): Use the correct event group ID from the flow metadata (#9177) 2024-09-18 12:52:21 +02:00
Harminder Virk 653a4bff71 feat: add tracing to workflow steps (#9140) 2024-09-17 11:35:38 +05:30
Carlos R. L. Rodrigues ef8dc4087e feat: run nested async workflows (#9119) 2024-09-16 13:06:45 +00:00
Carlos R. L. Rodrigues 950cf9af79 chore: remove container registration name (#9137) 2024-09-16 06:22:24 -03:00
Adrien de Peretti f0c470cb08 chore(workflows-sdk): Update hook functions type (#9117)
RESOLVES FRMW-2703

**What**
Update types to reflect both invoke and compensate function for hooks
2024-09-13 07:11:45 +00:00
matteoxplo 91f17fb176 fix: Workflow always print "error:" even if there are none (#8978)
Fix issue [https://github.com/medusajs/medusa/issues/8976](https://github.com/medusajs/medusa/issues/8976)
2024-09-04 12:17:25 +00:00
Adrien de Peretti b09c19912b fix(orchestration, workflow-sdk): Local workflow separated orchestrator (#8765)
FIXES TRI-174

**What**
Currently, every time a Local workflow is being instantiated, it will grab the global workflow definition including the orchestrator instance. This leads to issues when we have concurrent running workflows which all register their event listeners to this single orchestrator instance which can lead to exhausting the listerners. 
With this fix, every local workflow will have a copy of the global workflow definition plus a new instance (cloned) of the orchestrator meaning that from now on, every local workflow will have its own orchestrator.
2024-08-27 08:59:56 +00:00
Oli Juhl 2bacf86d3c chore: Remove prepublishOnly script (#8699)
* wip

* wip

* verbose logging

* remove prepublish scripts

* chore: add back prepublish scripts

* wip

* remove prepublishOnly script

* chore: Clean up rest of build scripts

* add back build script

* feedback

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2024-08-27 10:31:38 +02:00
Carlos R. L. Rodrigues 3b4eea08ef chore: peer dependency version (#8771)
* fix peer dependency version

* dotenv

* commands

* dotenv cli
2024-08-26 21:55:57 +02:00
Carlos R. L. Rodrigues 058378970a chore: dependecies reorg (#8535) 2024-08-23 07:16:04 -03:00
Carlos R. L. Rodrigues eb0bfe9f33 feat(workflows-sdk): log on error (#8666) 2024-08-20 06:23:24 -03:00
Harminder Virk 9cd66bc842 feature: share execution context with hook handlers (#8501) 2024-08-08 17:18:07 +05:30
Stevche Radevski 4155d0354f fix: Use a global reference to distributed transaction and scheduler (#8462)
* fix: Add storage cleanup on scheduled jobs

* fix: Use a global reference to distributed transaction and scheduler classes
2024-08-06 14:14:51 +02:00
Shahed Nasser 6fc2019534 chore(workflows-sdk): add TSDocs related to create-hook (#8380) 2024-08-01 09:57:14 +03:00
Harminder Virk 864bb0df05 breaking: implement workflow hooks (first iteration) (#8346) 2024-07-31 15:36:38 +05:30
Carlos R. L. Rodrigues 24c105f288 feat(orchestration,workflows-sdk): Skip step (#8334) 2024-07-29 14:26:47 -03:00