@medusajs/workflow-engine-inmemory 0.0.5 → 1.0.0-rc-20241003153304

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/dist/index.d.ts +5 -6
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +8 -41
  4. package/dist/index.js.map +1 -0
  5. package/dist/loaders/index.d.ts +1 -3
  6. package/dist/loaders/index.d.ts.map +1 -1
  7. package/dist/loaders/index.js +6 -16
  8. package/dist/loaders/index.js.map +1 -0
  9. package/dist/loaders/utils.d.ts.map +1 -1
  10. package/dist/loaders/utils.js +1 -0
  11. package/dist/loaders/utils.js.map +1 -0
  12. package/dist/migrations/Migration20231228143900.js +1 -0
  13. package/dist/migrations/Migration20231228143900.js.map +1 -0
  14. package/dist/models/index.js +1 -0
  15. package/dist/models/index.js.map +1 -0
  16. package/dist/models/workflow-execution.d.ts +1 -1
  17. package/dist/models/workflow-execution.d.ts.map +1 -1
  18. package/dist/models/workflow-execution.js +3 -2
  19. package/dist/models/workflow-execution.js.map +1 -0
  20. package/dist/schema/index.d.ts +1 -1
  21. package/dist/schema/index.d.ts.map +1 -1
  22. package/dist/schema/index.js +1 -3
  23. package/dist/schema/index.js.map +1 -0
  24. package/dist/services/index.js +1 -0
  25. package/dist/services/index.js.map +1 -0
  26. package/dist/services/workflow-orchestrator.d.ts +9 -6
  27. package/dist/services/workflow-orchestrator.d.ts.map +1 -1
  28. package/dist/services/workflow-orchestrator.js +61 -21
  29. package/dist/services/workflow-orchestrator.js.map +1 -0
  30. package/dist/services/workflows-module.d.ts +15 -14
  31. package/dist/services/workflows-module.d.ts.map +1 -1
  32. package/dist/services/workflows-module.js +10 -89
  33. package/dist/services/workflows-module.js.map +1 -0
  34. package/dist/tsconfig.tsbuildinfo +1 -0
  35. package/dist/types/index.d.ts +1 -1
  36. package/dist/types/index.d.ts.map +1 -1
  37. package/dist/types/index.js +1 -0
  38. package/dist/types/index.js.map +1 -0
  39. package/dist/utils/index.js +1 -0
  40. package/dist/utils/index.js.map +1 -0
  41. package/dist/utils/workflow-orchestrator-storage.d.ts +22 -13
  42. package/dist/utils/workflow-orchestrator-storage.d.ts.map +1 -1
  43. package/dist/utils/workflow-orchestrator-storage.js +104 -27
  44. package/dist/utils/workflow-orchestrator-storage.js.map +1 -0
  45. package/package.json +29 -24
  46. package/dist/initialize/index.d.ts +0 -6
  47. package/dist/initialize/index.d.ts.map +0 -1
  48. package/dist/initialize/index.js +0 -18
  49. package/dist/joiner-config.d.ts +0 -8
  50. package/dist/joiner-config.d.ts.map +0 -1
  51. package/dist/joiner-config.js +0 -34
  52. package/dist/loaders/connection.d.ts +0 -5
  53. package/dist/loaders/connection.d.ts.map +0 -1
  54. package/dist/loaders/connection.js +0 -41
  55. package/dist/loaders/container.d.ts +0 -3
  56. package/dist/loaders/container.d.ts.map +0 -1
  57. package/dist/loaders/container.js +0 -33
  58. package/dist/module-definition.d.ts +0 -3
  59. package/dist/module-definition.d.ts.map +0 -1
  60. package/dist/module-definition.js +0 -16
  61. package/dist/repositories/index.d.ts +0 -3
  62. package/dist/repositories/index.d.ts.map +0 -1
  63. package/dist/repositories/index.js +0 -7
  64. package/dist/repositories/workflow-execution.d.ts +0 -8
  65. package/dist/repositories/workflow-execution.d.ts.map +0 -1
  66. package/dist/repositories/workflow-execution.js +0 -9
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { moduleDefinition } from "./module-definition";
2
- export default moduleDefinition;
3
- export declare const runMigrations: ({ options, logger, }?: Pick<import("@medusajs/modules-sdk").LoaderOptions<import("@medusajs/modules-sdk").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
4
- export declare const revertMigration: ({ options, logger, }?: Pick<import("@medusajs/modules-sdk").LoaderOptions<import("@medusajs/modules-sdk").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
5
- export * from "./initialize";
6
- export * from "./loaders";
1
+ import { WorkflowsModuleService } from "./services";
2
+ declare const _default: import("@medusajs/types").ModuleExports<typeof WorkflowsModuleService> & {
3
+ linkable: Record<string, any>;
4
+ };
5
+ export default _default;
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,eAAe,gBAAgB,CAAA;AAQ/B,eAAO,MAAM,aAAa,iMAEzB,CAAA;AACD,eAAO,MAAM,eAAe,iMAE3B,CAAA;AAED,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;;;;AAGlD,wBAGE"}
package/dist/index.js CHANGED
@@ -1,43 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
2
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.revertMigration = exports.runMigrations = void 0;
30
- const modules_sdk_1 = require("@medusajs/modules-sdk");
31
- const utils_1 = require("@medusajs/utils");
32
- const models = __importStar(require("./models"));
33
- const module_definition_1 = require("./module-definition");
34
- exports.default = module_definition_1.moduleDefinition;
35
- const migrationScriptOptions = {
36
- moduleName: modules_sdk_1.Modules.WORKFLOW_ENGINE,
37
- models: models,
38
- pathToMigrations: __dirname + "/migrations",
39
- };
40
- exports.runMigrations = utils_1.ModulesSdkUtils.buildMigrationScript(migrationScriptOptions);
41
- exports.revertMigration = utils_1.ModulesSdkUtils.buildRevertMigrationScript(migrationScriptOptions);
42
- __exportStar(require("./initialize"), exports);
43
- __exportStar(require("./loaders"), exports);
3
+ const utils_1 = require("@medusajs/framework/utils");
4
+ const _services_1 = require("./services");
5
+ const loaders_1 = require("./loaders");
6
+ exports.default = (0, utils_1.Module)(utils_1.Modules.WORKFLOW_ENGINE, {
7
+ service: _services_1.WorkflowsModuleService,
8
+ loaders: [loaders_1.loadUtils],
9
+ });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,qDAA2D;AAC3D,yCAAkD;AAClD,uCAAqC;AAErC,kBAAe,IAAA,cAAM,EAAC,eAAO,CAAC,eAAe,EAAE;IAC7C,OAAO,EAAE,kCAAsB;IAC/B,OAAO,EAAE,CAAC,mBAAS,CAAC;CACrB,CAAC,CAAA"}
@@ -1,4 +1,2 @@
1
- export * from "./connection";
2
- export * from "./container";
3
- export * from "./utils";
1
+ export { default as loadUtils } from "./utils";
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA"}
@@ -1,19 +1,9 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
5
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./connection"), exports);
18
- __exportStar(require("./container"), exports);
19
- __exportStar(require("./utils"), exports);
6
+ exports.loadUtils = void 0;
7
+ var utils_1 = require("./utils");
8
+ Object.defineProperty(exports, "loadUtils", { enumerable: true, get: function () { return __importDefault(utils_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA8C;AAArC,mHAAA,OAAO,OAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":";;MAGsC,QAAQ,IAAI,CAAC;AAAnD,wBAMC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":";;MAGsC,OAAO,CAAC,IAAI,CAAC;AAAnD,wBAMC"}
@@ -7,3 +7,4 @@ exports.default = async ({ container }) => {
7
7
  inMemoryDistributedTransactionStorage: (0, awilix_1.asClass)(utils_1.InMemoryDistributedTransactionStorage).singleton(),
8
8
  });
9
9
  };
10
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":";;AAAA,mCAAgC;AAChC,oCAAgE;AAEhE,kBAAe,KAAK,EAAE,EAAE,SAAS,EAAE,EAAiB,EAAE;IACpD,SAAS,CAAC,QAAQ,CAAC;QACjB,qCAAqC,EAAE,IAAA,gBAAO,EAC5C,6CAAqC,CACtC,CAAC,SAAS,EAAE;KACd,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -37,3 +37,4 @@ class Migration20231221104256 extends migrations_1.Migration {
37
37
  }
38
38
  }
39
39
  exports.Migration20231221104256 = Migration20231221104256;
40
+ //# sourceMappingURL=Migration20231228143900.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20231228143900.js","sourceRoot":"","sources":["../../src/migrations/Migration20231228143900.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT;;;;;;;;;;;;;;;;;;;OAmBC,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,CACT;;;;;;;OAOC,CACF,CAAA;IACH,CAAC;CACF;AAtCD,0DAsCC"}
@@ -6,3 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.WorkflowExecution = void 0;
7
7
  var workflow_execution_1 = require("./workflow-execution");
8
8
  Object.defineProperty(exports, "WorkflowExecution", { enumerable: true, get: function () { return __importDefault(workflow_execution_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAmE;AAA1D,wIAAA,OAAO,OAAqB"}
@@ -1,4 +1,4 @@
1
- import { TransactionState } from "@medusajs/orchestration";
1
+ import { TransactionState } from "@medusajs/framework/orchestration";
2
2
  import { OptionalProps } from "@mikro-orm/core";
3
3
  type OptionalFields = "deleted_at";
4
4
  export default class WorkflowExecution {
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-execution.d.ts","sourceRoot":"","sources":["../../src/models/workflow-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,EAOL,aAAa,EAId,MAAM,iBAAiB,CAAA;AAExB,KAAK,cAAc,GAAG,YAAY,CAAA;AAQlC,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC,CAAC,aAAa,CAAC,CAAC,EAAE,cAAc,CAAA;IAIhC,EAAE,EAAG,MAAM,CAAA;IAIX,WAAW,EAAE,MAAM,CAAA;IAInB,cAAc,EAAE,MAAM,CAAA;IAGtB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAO;IAGhD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAO;IAI9C,KAAK,EAAE,gBAAgB,CAAA;IAOvB,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAGhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
1
+ {"version":3,"file":"workflow-execution.d.ts","sourceRoot":"","sources":["../../src/models/workflow-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAEpE,OAAO,EAOL,aAAa,EAId,MAAM,iBAAiB,CAAA;AAExB,KAAK,cAAc,GAAG,YAAY,CAAA;AAQlC,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC,CAAC,aAAa,CAAC,CAAC,EAAE,cAAc,CAAA;IAIhC,EAAE,EAAG,MAAM,CAAA;IAIX,WAAW,EAAE,MAAM,CAAA;IAInB,cAAc,EAAE,MAAM,CAAA;IAGtB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAO;IAGhD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAO;IAI9C,KAAK,EAAE,gBAAgB,CAAA;IAOvB,UAAU,EAAE,IAAI,CAAA;IAQhB,UAAU,EAAE,IAAI,CAAA;IAGhB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAO;IAG9B,QAAQ;IAKR,MAAM;CAGP"}
@@ -9,8 +9,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const orchestration_1 = require("@medusajs/orchestration");
13
- const utils_1 = require("@medusajs/utils");
12
+ const orchestration_1 = require("@medusajs/framework/orchestration");
13
+ const utils_1 = require("@medusajs/framework/utils");
14
14
  const core_1 = require("@mikro-orm/core");
15
15
  let WorkflowExecution = class WorkflowExecution {
16
16
  constructor() {
@@ -95,3 +95,4 @@ WorkflowExecution = __decorate([
95
95
  (0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
96
96
  ], WorkflowExecution);
97
97
  exports.default = WorkflowExecution;
98
+ //# sourceMappingURL=workflow-execution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-execution.js","sourceRoot":"","sources":["../../src/models/workflow-execution.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qEAAoE;AACpE,qDAAsE;AACtE,0CAWw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GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;qDAAA;AAQhB;IANC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;qDAAA;AAGhB;IADC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDAC1B;AAG9B;IADC,IAAA,mBAAY,GAAE;;;;iDAGd;AAGD;IADC,IAAA,aAAM,GAAE;;;;+CAGR;AAnDkB,iBAAiB;IANrC,IAAA,aAAM,GAAE;IACR,IAAA,aAAM,EAAC;QACN,IAAI,EAAE,0DAA0D;QAChE,UAAU,EAAE,CAAC,aAAa,EAAE,gBAAgB,CAAC;KAC9C,CAAC;IACD,IAAA,aAAM,EAAC,gBAAQ,CAAC,kCAAkC,CAAC;GAC/B,iBAAiB,CAoDrC;kBApDoB,iBAAiB"}
@@ -1,3 +1,3 @@
1
- declare const _default: "\nscalar DateTime\nscalar JSON\n\nenum TransactionState {\n NOT_STARTED\n INVOKING\n WAITING_TO_COMPENSATE\n COMPENSATING\n DONE\n REVERTED\n FAILED\n}\n\ntype WorkflowExecution {\n id: ID!\n created_at: DateTime!\n updated_at: DateTime!\n deleted_at: DateTime\n workflow_id: string\n transaction_id: string\n execution: JSON\n context: JSON\n state: TransactionState\n}\n";
1
+ declare const _default: "\nenum TransactionState {\n NOT_STARTED\n INVOKING\n WAITING_TO_COMPENSATE\n COMPENSATING\n DONE\n REVERTED\n FAILED\n}\n\ntype WorkflowExecution {\n id: ID!\n created_at: DateTime!\n updated_at: DateTime!\n deleted_at: DateTime\n workflow_id: string\n transaction_id: string\n execution: JSON\n context: JSON\n state: TransactionState\n}\n";
2
2
  export default _default;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":";AAAA,wBAyBC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":";AAAA,wBAsBC"}
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = `
4
- scalar DateTime
5
- scalar JSON
6
-
7
4
  enum TransactionState {
8
5
  NOT_STARTED
9
6
  INVOKING
@@ -26,3 +23,4 @@ type WorkflowExecution {
26
23
  state: TransactionState
27
24
  }
28
25
  `;
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":";;AAAA,kBAAe;;;;;;;;;;;;;;;;;;;;;;CAsBd,CAAA"}
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./workflow-orchestrator"), exports);
18
18
  __exportStar(require("./workflows-module"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AACvC,qDAAkC"}
@@ -1,8 +1,8 @@
1
- import { DistributedTransaction, DistributedTransactionEvents, TransactionStep } from "@medusajs/orchestration";
2
- import { ContainerLike, Context } from "@medusajs/types";
3
- import { ReturnWorkflow, type FlowRunOptions } from "@medusajs/workflows-sdk";
1
+ import { DistributedTransactionEvents, DistributedTransactionType, TransactionStep } from "@medusajs/framework/orchestration";
2
+ import { ContainerLike, Context, MedusaContainer } from "@medusajs/framework/types";
3
+ import { type FlowRunOptions, ReturnWorkflow } from "@medusajs/framework/workflows-sdk";
4
4
  import { InMemoryDistributedTransactionStorage } from "../utils";
5
- export type WorkflowOrchestratorRunOptions<T> = FlowRunOptions<T> & {
5
+ export type WorkflowOrchestratorRunOptions<T> = Omit<FlowRunOptions<T>, "container"> & {
6
6
  transactionId?: string;
7
7
  container?: ContainerLike;
8
8
  };
@@ -40,12 +40,15 @@ type UnsubscribeOptions = {
40
40
  };
41
41
  export declare class WorkflowOrchestratorService {
42
42
  private subscribers;
43
- constructor({ inMemoryDistributedTransactionStorage, }: {
43
+ private container_;
44
+ constructor({ inMemoryDistributedTransactionStorage, sharedContainer, }: {
44
45
  inMemoryDistributedTransactionStorage: InMemoryDistributedTransactionStorage;
45
46
  workflowOrchestratorService: WorkflowOrchestratorService;
47
+ sharedContainer: MedusaContainer;
46
48
  });
49
+ private triggerParentStep;
47
50
  run<T = unknown>(workflowIdOrWorkflow: string | ReturnWorkflow<any, any, any>, options?: WorkflowOrchestratorRunOptions<T>, sharedContext?: Context): Promise<any>;
48
- getRunningTransaction(workflowId: string, transactionId: string, options?: WorkflowOrchestratorRunOptions<undefined>, sharedContext?: Context): Promise<DistributedTransaction>;
51
+ getRunningTransaction(workflowId: string, transactionId: string, options?: WorkflowOrchestratorRunOptions<undefined>, sharedContext?: Context): Promise<DistributedTransactionType>;
49
52
  setStepSuccess<T = unknown>({ idempotencyKey, stepResponse, options, }: {
50
53
  idempotencyKey: string | IdempotencyKeyParts;
51
54
  stepResponse: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-orchestrator.d.ts","sourceRoot":"","sources":["../../src/services/workflow-orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAE5B,eAAe,EAChB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAmB,MAAM,iBAAiB,CAAA;AAEzE,OAAO,EAEL,cAAc,EAEd,KAAK,cAA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GAAG,mBAAmB,CAAA;QAC5C,YAAY,EAAE,OAAO,CAAA;QACrB,OAAO,CAAC,EAAE,0BAA0B,CAAC,CAAC,CAAC,CAAA;KACxC,EACgB,aAAa,GAAE,OAAY;IAsDxC,cAAc,CAAC,CAAC,GAAG,OAAO,EAC9B,EACE,cAAc,EACd,YAAY,EACZ,OAAO,GACR,EAAE;QACD,cAAc,EAAE,MAAM,GAAG,mBAAmB,CAAA;QAC5C,YAAY,EAAE,OAAO,CAAA;QACrB,OAAO,CAAC,EAAE,0BAA0B,CAAC,CAAC,CAAC,CAAA;KACxC,EACgB,aAAa,GAAE,OAAY;IAsD9C,SAAS,CACP,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,gBAAgB,EACxD,aAAa,GAAE,OAAY;IAkC9C,WAAW,CACT,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,kBAAkB,EAChD,aAAa,GAAE,OAAY;IA4B9C,OAAO,CAAC,MAAM;IAqCd,OAAO,CAAC,mBAAmB;IA2G3B,OAAO,CAAC,2BAA2B;CA+BpC"}
@@ -13,27 +13,51 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.WorkflowOrchestratorService = void 0;
16
- const orchestration_1 = require("@medusajs/orchestration");
17
- const utils_1 = require("@medusajs/utils");
18
- const workflows_sdk_1 = require("@medusajs/workflows-sdk");
16
+ const orchestration_1 = require("@medusajs/framework/orchestration");
17
+ const utils_1 = require("@medusajs/framework/utils");
18
+ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
19
19
  const ulid_1 = require("ulid");
20
20
  const AnySubscriber = "any";
21
21
  class WorkflowOrchestratorService {
22
- constructor({ inMemoryDistributedTransactionStorage, }) {
22
+ constructor({ inMemoryDistributedTransactionStorage, sharedContainer, }) {
23
23
  this.subscribers = new Map();
24
+ this.container_ = sharedContainer;
24
25
  inMemoryDistributedTransactionStorage.setWorkflowOrchestratorService(this);
25
26
  orchestration_1.DistributedTransaction.setStorage(inMemoryDistributedTransactionStorage);
27
+ orchestration_1.WorkflowScheduler.setStorage(inMemoryDistributedTransactionStorage);
28
+ }
29
+ async triggerParentStep(transaction, result) {
30
+ const metadata = transaction.flow.metadata;
31
+ const { parentStepIdempotencyKey } = metadata ?? {};
32
+ if (parentStepIdempotencyKey) {
33
+ const hasFailed = [
34
+ utils_1.TransactionState.REVERTED,
35
+ utils_1.TransactionState.FAILED,
36
+ ].includes(transaction.flow.state);
37
+ if (hasFailed) {
38
+ await this.setStepFailure({
39
+ idempotencyKey: parentStepIdempotencyKey,
40
+ stepResponse: result,
41
+ });
42
+ }
43
+ else {
44
+ await this.setStepSuccess({
45
+ idempotencyKey: parentStepIdempotencyKey,
46
+ stepResponse: result,
47
+ });
48
+ }
49
+ }
26
50
  }
27
51
  async run(workflowIdOrWorkflow, options, sharedContext = {}) {
28
- let { input, context, transactionId, resultFrom, throwOnError, events: eventHandlers, container, } = options ?? {};
52
+ let { input, context, transactionId, resultFrom, throwOnError, logOnError, events: eventHandlers, container, } = options ?? {};
29
53
  const workflowId = (0, utils_1.isString)(workflowIdOrWorkflow)
30
54
  ? workflowIdOrWorkflow
31
55
  : workflowIdOrWorkflow.getName();
32
56
  if (!workflowId) {
33
- throw new Error("Workflow ID is required");
57
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.NOT_FOUND, `Workflow ID is required`);
34
58
  }
35
- context ?? (context = {});
36
- context.transactionId ?? (context.transactionId = transactionId ?? (0, ulid_1.ulid)());
59
+ context ??= {};
60
+ context.transactionId ??= transactionId ?? (0, ulid_1.ulid)();
37
61
  const events = this.buildWorkflowEvents({
38
62
  customEventHandlers: eventHandlers,
39
63
  workflowId,
@@ -41,20 +65,30 @@ class WorkflowOrchestratorService {
41
65
  });
42
66
  const exportedWorkflow = workflows_sdk_1.MedusaWorkflow.getWorkflow(workflowId);
43
67
  if (!exportedWorkflow) {
44
- throw new Error(`Workflow with id "${workflowId}" not found.`);
68
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.NOT_FOUND, `Workflow with id "${workflowId}" not found.`);
45
69
  }
46
- const flow = exportedWorkflow(container);
47
- const ret = await flow.run({
70
+ const ret = await exportedWorkflow.run({
48
71
  input,
49
72
  throwOnError,
73
+ logOnError,
50
74
  resultFrom,
51
75
  context,
52
76
  events,
77
+ container: container ?? this.container_,
53
78
  });
54
- // TODO: temporary
79
+ const hasFinished = ret.transaction.hasFinished();
80
+ const metadata = ret.transaction.getFlow().metadata;
81
+ const { parentStepIdempotencyKey } = metadata ?? {};
82
+ const hasFailed = [
83
+ utils_1.TransactionState.REVERTED,
84
+ utils_1.TransactionState.FAILED,
85
+ ].includes(ret.transaction.getFlow().state);
55
86
  const acknowledgement = {
56
87
  transactionId: context.transactionId,
57
88
  workflowId: workflowId,
89
+ parentStepIdempotencyKey,
90
+ hasFinished,
91
+ hasFailed,
58
92
  };
59
93
  if (ret.transaction.hasFinished()) {
60
94
  const { result, errors } = ret;
@@ -65,6 +99,7 @@ class WorkflowOrchestratorService {
65
99
  result,
66
100
  errors,
67
101
  });
102
+ await this.triggerParentStep(ret.transaction, result);
68
103
  }
69
104
  return { acknowledgement, ...ret };
70
105
  }
@@ -76,36 +111,37 @@ class WorkflowOrchestratorService {
76
111
  if (!transactionId) {
77
112
  throw new Error("TransactionId ID is required");
78
113
  }
79
- context ?? (context = {});
80
- context.transactionId ?? (context.transactionId = transactionId);
114
+ context ??= {};
115
+ context.transactionId ??= transactionId;
81
116
  const exportedWorkflow = workflows_sdk_1.MedusaWorkflow.getWorkflow(workflowId);
82
117
  if (!exportedWorkflow) {
83
118
  throw new Error(`Workflow with id "${workflowId}" not found.`);
84
119
  }
85
- const flow = exportedWorkflow(container);
120
+ const flow = exportedWorkflow(container ?? this.container_);
86
121
  const transaction = await flow.getRunningTransaction(transactionId, context);
87
122
  return transaction;
88
123
  }
89
124
  async setStepSuccess({ idempotencyKey, stepResponse, options, }, sharedContext = {}) {
90
- const { context, throwOnError, resultFrom, container, events: eventHandlers, } = options ?? {};
125
+ const { context, throwOnError, logOnError, resultFrom, container, events: eventHandlers, } = options ?? {};
91
126
  const [idempotencyKey_, { workflowId, transactionId }] = this.buildIdempotencyKeyAndParts(idempotencyKey);
92
127
  const exportedWorkflow = workflows_sdk_1.MedusaWorkflow.getWorkflow(workflowId);
93
128
  if (!exportedWorkflow) {
94
129
  throw new Error(`Workflow with id "${workflowId}" not found.`);
95
130
  }
96
- const flow = exportedWorkflow(container);
97
131
  const events = this.buildWorkflowEvents({
98
132
  customEventHandlers: eventHandlers,
99
133
  transactionId,
100
134
  workflowId,
101
135
  });
102
- const ret = await flow.registerStepSuccess({
136
+ const ret = await exportedWorkflow.registerStepSuccess({
103
137
  idempotencyKey: idempotencyKey_,
104
138
  context,
105
139
  resultFrom,
106
140
  throwOnError,
141
+ logOnError,
107
142
  events,
108
143
  response: stepResponse,
144
+ container: container ?? this.container_,
109
145
  });
110
146
  if (ret.transaction.hasFinished()) {
111
147
  const { result, errors } = ret;
@@ -116,29 +152,31 @@ class WorkflowOrchestratorService {
116
152
  result,
117
153
  errors,
118
154
  });
155
+ await this.triggerParentStep(ret.transaction, result);
119
156
  }
120
157
  return ret;
121
158
  }
122
159
  async setStepFailure({ idempotencyKey, stepResponse, options, }, sharedContext = {}) {
123
- const { context, throwOnError, resultFrom, container, events: eventHandlers, } = options ?? {};
160
+ const { context, throwOnError, logOnError, resultFrom, container, events: eventHandlers, } = options ?? {};
124
161
  const [idempotencyKey_, { workflowId, transactionId }] = this.buildIdempotencyKeyAndParts(idempotencyKey);
125
162
  const exportedWorkflow = workflows_sdk_1.MedusaWorkflow.getWorkflow(workflowId);
126
163
  if (!exportedWorkflow) {
127
164
  throw new Error(`Workflow with id "${workflowId}" not found.`);
128
165
  }
129
- const flow = exportedWorkflow(container);
130
166
  const events = this.buildWorkflowEvents({
131
167
  customEventHandlers: eventHandlers,
132
168
  transactionId,
133
169
  workflowId,
134
170
  });
135
- const ret = await flow.registerStepFailure({
171
+ const ret = await exportedWorkflow.registerStepFailure({
136
172
  idempotencyKey: idempotencyKey_,
137
173
  context,
138
174
  resultFrom,
139
175
  throwOnError,
176
+ logOnError,
140
177
  events,
141
178
  response: stepResponse,
179
+ container: container ?? this.container_,
142
180
  });
143
181
  if (ret.transaction.hasFinished()) {
144
182
  const { result, errors } = ret;
@@ -149,6 +187,7 @@ class WorkflowOrchestratorService {
149
187
  result,
150
188
  errors,
151
189
  });
190
+ await this.triggerParentStep(ret.transaction, result);
152
191
  }
153
192
  return ret;
154
193
  }
@@ -366,3 +405,4 @@ __decorate([
366
405
  __metadata("design:paramtypes", [Object, Object]),
367
406
  __metadata("design:returntype", void 0)
368
407
  ], WorkflowOrchestratorService.prototype, "unsubscribe", null);
408
+ //# sourceMappingURL=workflow-orchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-orchestrator.js","sourceRoot":"","sources":["../../src/services/workflow-orchestrator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qEAO0C;AAM1C,qDAMkC;AAClC,qEAK0C;AAC1C,+BAA2B;AA0D3B,MAAM,aAAa,GAAG,KAAK,CAAA;AAE3B,MAAa,2BAA2B;IAItC,YAAY,EACV,qCAAqC,EACrC,eAAe,GAKhB;QAVO,gBAAW,GAAgB,IAAI,GAAG,EAAE,CAAA;QAW1C,IAAI,CAAC,UAAU,GAAG,eAAe,CAAA;QACjC,qCAAqC,CAAC,8BAA8B,CAAC,IAAI,CAAC,CAAA;QAC1E,sCAAsB,CAAC,UAAU,CAAC,qCAAqC,CAAC,CAAA;QACxE,iCAAiB,CAAC,UAAU,CAAC,qCAAqC,CAAC,CAAA;IACrE,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAAC,WAAW,EAAE,MAAM;QACjD,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAA;QAC1C,MAAM,EAAE,wBAAwB,EAAE,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UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACvE,QAAQ,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QACrD,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,GAC/C,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC5B,QAAQ,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QACrD,CAAC;QAED,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;IACjC,CAAC;CACF;AArhBD,kEAqhBC;AA3eO;IADL,IAAA,2BAAmB,GAAE;IAInB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;sDAkFjB;AAGK;IADL,IAAA,2BAAmB,GAAE;IAKnB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;wEA2BjB;AAGK;IADL,IAAA,2BAAmB,GAAE;IAWnB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;iEAmDjB;AAGK;IADL,IAAA,2BAAmB,GAAE;IAWnB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;iEAmDjB;AAGD;IADC,IAAA,2BAAmB,GAAE;IAGnB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;4DA+BjB;AAGD;IADC,IAAA,2BAAmB,GAAE;IAGnB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;8DA0BjB"}
@@ -1,26 +1,27 @@
1
- import { Context, DAL, FindConfig, InternalModuleDeclaration, ModuleJoinerConfig, ModulesSdkTypes } from "@medusajs/types";
2
- import type { IWorkflowEngineService, ReturnWorkflow, UnwrapWorkflowInputDataType, WorkflowOrchestratorTypes } from "@medusajs/workflows-sdk";
1
+ import { Context, DAL, InternalModuleDeclaration, MedusaContainer, ModulesSdkTypes, WorkflowsSdkTypes } from "@medusajs/framework/types";
2
+ import { ModulesSdkUtils } from "@medusajs/framework/utils";
3
+ import type { ReturnWorkflow, UnwrapWorkflowInputDataType } from "@medusajs/framework/workflows-sdk";
4
+ import { WorkflowExecution } from "../models";
3
5
  import { WorkflowOrchestratorService } from ".";
4
6
  type InjectedDependencies = {
5
7
  baseRepository: DAL.RepositoryService;
6
- workflowExecutionService: ModulesSdkTypes.InternalModuleService<any>;
8
+ workflowExecutionService: ModulesSdkTypes.IMedusaInternalService<any>;
7
9
  workflowOrchestratorService: WorkflowOrchestratorService;
8
10
  };
9
- export declare class WorkflowsModuleService implements IWorkflowEngineService {
11
+ declare const WorkflowsModuleService_base: ModulesSdkUtils.MedusaServiceReturnType<{
12
+ WorkflowExecution: {
13
+ dto: WorkflowExecution;
14
+ };
15
+ }>;
16
+ export declare class WorkflowsModuleService<TWorkflowExecution extends WorkflowExecution = WorkflowExecution> extends WorkflowsModuleService_base {
10
17
  protected readonly moduleDeclaration: InternalModuleDeclaration;
11
18
  protected baseRepository_: DAL.RepositoryService;
12
- protected workflowExecutionService_: ModulesSdkTypes.InternalModuleService<any>;
19
+ protected workflowExecutionService_: ModulesSdkTypes.IMedusaInternalService<TWorkflowExecution>;
13
20
  protected workflowOrchestratorService_: WorkflowOrchestratorService;
21
+ protected container_: MedusaContainer;
14
22
  constructor({ baseRepository, workflowExecutionService, workflowOrchestratorService, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
15
- __joinerConfig(): ModuleJoinerConfig;
16
- retrieveWorkflowExecution(idOrObject: string | {
17
- workflow_id: string;
18
- transaction_id: string;
19
- }, config?: FindConfig<WorkflowOrchestratorTypes.WorkflowExecutionDTO>, sharedContext?: Context): Promise<WorkflowOrchestratorTypes.WorkflowExecutionDTO>;
20
- listWorkflowExecution(filters?: WorkflowOrchestratorTypes.FilterableWorkflowExecutionProps, config?: FindConfig<WorkflowOrchestratorTypes.WorkflowExecutionDTO>, sharedContext?: Context): Promise<WorkflowOrchestratorTypes.WorkflowExecutionDTO[]>;
21
- listAndCountWorkflowExecution(filters?: WorkflowOrchestratorTypes.FilterableWorkflowExecutionProps, config?: FindConfig<WorkflowOrchestratorTypes.WorkflowExecutionDTO>, sharedContext?: Context): Promise<[WorkflowOrchestratorTypes.WorkflowExecutionDTO[], number]>;
22
- run<TWorkflow extends string | ReturnWorkflow<any, any, any>>(workflowIdOrWorkflow: TWorkflow, options?: WorkflowOrchestratorTypes.WorkflowOrchestratorRunDTO<TWorkflow extends ReturnWorkflow<any, any, any> ? UnwrapWorkflowInputDataType<TWorkflow> : unknown>, context?: Context): Promise<any>;
23
- getRunningTransaction(workflowId: string, transactionId: string, context?: Context): Promise<import("@medusajs/orchestration").DistributedTransaction>;
23
+ run<TWorkflow extends string | ReturnWorkflow<any, any, any>>(workflowIdOrWorkflow: TWorkflow, options?: WorkflowsSdkTypes.WorkflowOrchestratorRunDTO<TWorkflow extends ReturnWorkflow<any, any, any> ? UnwrapWorkflowInputDataType<TWorkflow> : unknown>, context?: Context): Promise<any>;
24
+ getRunningTransaction(workflowId: string, transactionId: string, context?: Context): Promise<import("@medusajs/orchestration").DistributedTransactionType>;
24
25
  setStepSuccess({ idempotencyKey, stepResponse, options, }: {
25
26
  idempotencyKey: string | object;
26
27
  stepResponse: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"workflows-module.d.ts","sourceRoot":"","sources":["../../src/services/workflows-module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,GAAG,EACH,UAAU,EACV,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EAChB,MAAM,iBAAiB,CAAA;AAQxB,OAAO,KAAK,EACV,sBAAsB,EACtB,cAAc,EACd,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAA;AAGvD,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,GAAG,CAAC,iBAAiB,CAAA;IACrC,wBAAwB,EAAE,eAAe,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E,oBAAoB,EAAE,SAAS,EAC/B,OAAO,GAAE,yBAAyB,CAAC,0BAA0B,CAC3D,SAAS,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAC3C,2BAA2B,CAAC,SAAS,CAAC,GACtC,OAAO,CACP,EACW,OAAO,GAAE,OAAY;IAYlC,qBAAqB,CACzB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACJ,OAAO,GAAE,OAAY;IAUlC,cAAc,CAClB,EACE,cAAc,EACd,YAAY,EACZ,OAAO,GACR,EAAE;QACD,cAAc,EAAE,MAAM,GAAG,MAAM,CAAA;QAC/B,YAAY,EAAE,OAAO,CAAA;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAC9B,EACgB,OAAO,GAAE,OAAY;IAalC,cAAc,CAClB,EACE,cAAc,EACd,YAAY,EACZ,OAAO,GACR,EAAE;QACD,cAAc,EAAE,MAAM,GAAG,MAAM,CAAA;QAC/B,YAAY,EAAE,OAAO,CAAA;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAC9B,EACgB,OAAO,GAAE,OAAY;IAalC,SAAS,CACb,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,CAAA;QAClB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,UAAU,EAAE,QAAQ,CAAA;QACpB,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,EACgB,OAAO,GAAE,OAAY;IAMlC,WAAW,CACf,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,CAAA;QAClB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,cAAc,EAAE,MAAM,GAAG,QAAQ,CAAA;KAClC,EACgB,OAAO,GAAE,OAAY;CAIzC"}
1
+ {"version":3,"file":"workflows-module.d.ts","sourceRoot":"","sources":["../../src/services/workflows-module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,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