@8medusa/workflows-sdk 2.7.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/dist/helper/index.d.ts +3 -0
- package/dist/helper/index.d.ts.map +1 -0
- package/dist/helper/index.js +19 -0
- package/dist/helper/index.js.map +1 -0
- package/dist/helper/type.d.ts +66 -0
- package/dist/helper/type.d.ts.map +1 -0
- package/dist/helper/type.js +3 -0
- package/dist/helper/type.js.map +1 -0
- package/dist/helper/workflow-export.d.ts +6 -0
- package/dist/helper/workflow-export.d.ts.map +1 -0
- package/dist/helper/workflow-export.js +253 -0
- package/dist/helper/workflow-export.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/medusa-workflow.d.ts +3 -0
- package/dist/medusa-workflow.d.ts.map +1 -0
- package/dist/medusa-workflow.js +19 -0
- package/dist/medusa-workflow.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/_playground.d.ts +2 -0
- package/dist/utils/_playground.d.ts.map +1 -0
- package/dist/utils/_playground.js +79 -0
- package/dist/utils/_playground.js.map +1 -0
- package/dist/utils/composer/create-hook.d.ts +60 -0
- package/dist/utils/composer/create-hook.d.ts.map +1 -0
- package/dist/utils/composer/create-hook.js +93 -0
- package/dist/utils/composer/create-hook.js.map +1 -0
- package/dist/utils/composer/create-step.d.ts +134 -0
- package/dist/utils/composer/create-step.d.ts.map +1 -0
- package/dist/utils/composer/create-step.js +237 -0
- package/dist/utils/composer/create-step.js.map +1 -0
- package/dist/utils/composer/create-workflow.d.ts +71 -0
- package/dist/utils/composer/create-workflow.d.ts.map +1 -0
- package/dist/utils/composer/create-workflow.js +209 -0
- package/dist/utils/composer/create-workflow.js.map +1 -0
- package/dist/utils/composer/helpers/create-step-handler.d.ts +20 -0
- package/dist/utils/composer/helpers/create-step-handler.d.ts.map +1 -0
- package/dist/utils/composer/helpers/create-step-handler.js +70 -0
- package/dist/utils/composer/helpers/create-step-handler.js.map +1 -0
- package/dist/utils/composer/helpers/index.d.ts +3 -0
- package/dist/utils/composer/helpers/index.d.ts.map +1 -0
- package/dist/utils/composer/helpers/index.js +19 -0
- package/dist/utils/composer/helpers/index.js.map +1 -0
- package/dist/utils/composer/helpers/proxy.d.ts +3 -0
- package/dist/utils/composer/helpers/proxy.d.ts.map +1 -0
- package/dist/utils/composer/helpers/proxy.js +25 -0
- package/dist/utils/composer/helpers/proxy.js.map +1 -0
- package/dist/utils/composer/helpers/resolve-value.d.ts +5 -0
- package/dist/utils/composer/helpers/resolve-value.d.ts.map +1 -0
- package/dist/utils/composer/helpers/resolve-value.js +64 -0
- package/dist/utils/composer/helpers/resolve-value.js.map +1 -0
- package/dist/utils/composer/helpers/step-response.d.ts +126 -0
- package/dist/utils/composer/helpers/step-response.d.ts.map +1 -0
- package/dist/utils/composer/helpers/step-response.js +166 -0
- package/dist/utils/composer/helpers/step-response.js.map +1 -0
- package/dist/utils/composer/helpers/workflow-response.d.ts +20 -0
- package/dist/utils/composer/helpers/workflow-response.d.ts.map +1 -0
- package/dist/utils/composer/helpers/workflow-response.js +16 -0
- package/dist/utils/composer/helpers/workflow-response.js.map +1 -0
- package/dist/utils/composer/index.d.ts +11 -0
- package/dist/utils/composer/index.d.ts.map +1 -0
- package/dist/utils/composer/index.js +27 -0
- package/dist/utils/composer/index.js.map +1 -0
- package/dist/utils/composer/parallelize.d.ts +43 -0
- package/dist/utils/composer/parallelize.d.ts.map +1 -0
- package/dist/utils/composer/parallelize.js +57 -0
- package/dist/utils/composer/parallelize.js.map +1 -0
- package/dist/utils/composer/transform.d.ts +79 -0
- package/dist/utils/composer/transform.d.ts.map +1 -0
- package/dist/utils/composer/transform.js +40 -0
- package/dist/utils/composer/transform.js.map +1 -0
- package/dist/utils/composer/type.d.ts +227 -0
- package/dist/utils/composer/type.d.ts.map +1 -0
- package/dist/utils/composer/type.js +3 -0
- package/dist/utils/composer/type.js.map +1 -0
- package/dist/utils/composer/when.d.ts +58 -0
- package/dist/utils/composer/when.d.ts.map +1 -0
- package/dist/utils/composer/when.js +56 -0
- package/dist/utils/composer/when.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./type"), exports);
|
|
18
|
+
__exportStar(require("./workflow-export"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,oDAAiC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DistributedTransactionEvents, DistributedTransactionType, LocalWorkflow, TransactionStepError } from "@8medusa/orchestration";
|
|
2
|
+
import { Context, LoadedModule, MedusaContainer } from "@8medusa/types";
|
|
3
|
+
type BaseFlowRunOptions = {
|
|
4
|
+
context?: Context;
|
|
5
|
+
resultFrom?: string | string[] | Symbol;
|
|
6
|
+
throwOnError?: boolean;
|
|
7
|
+
logOnError?: boolean;
|
|
8
|
+
events?: DistributedTransactionEvents;
|
|
9
|
+
container?: LoadedModule[] | MedusaContainer;
|
|
10
|
+
};
|
|
11
|
+
export type FlowRunOptions<TData = unknown> = BaseFlowRunOptions & {
|
|
12
|
+
input?: TData;
|
|
13
|
+
};
|
|
14
|
+
export type FlowRegisterStepSuccessOptions<TData = unknown> = BaseFlowRunOptions & {
|
|
15
|
+
idempotencyKey: string;
|
|
16
|
+
response?: TData;
|
|
17
|
+
};
|
|
18
|
+
export type FlowRegisterStepFailureOptions<TData = unknown> = BaseFlowRunOptions & {
|
|
19
|
+
idempotencyKey: string;
|
|
20
|
+
response?: TData;
|
|
21
|
+
};
|
|
22
|
+
export type FlowCancelOptions = {
|
|
23
|
+
transaction?: DistributedTransactionType;
|
|
24
|
+
transactionId?: string;
|
|
25
|
+
context?: Context;
|
|
26
|
+
throwOnError?: boolean;
|
|
27
|
+
logOnError?: boolean;
|
|
28
|
+
events?: DistributedTransactionEvents;
|
|
29
|
+
container?: LoadedModule[] | MedusaContainer;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The details of a workflow's execution.
|
|
33
|
+
*/
|
|
34
|
+
export type WorkflowResult<TResult = unknown> = {
|
|
35
|
+
/**
|
|
36
|
+
* Any errors that occured in the workflow.
|
|
37
|
+
*/
|
|
38
|
+
errors: TransactionStepError[];
|
|
39
|
+
/**
|
|
40
|
+
* The transaction details of the workflow's execution.
|
|
41
|
+
*/
|
|
42
|
+
transaction: DistributedTransactionType;
|
|
43
|
+
/**
|
|
44
|
+
* The result returned by the workflow.
|
|
45
|
+
*/
|
|
46
|
+
result: TResult;
|
|
47
|
+
};
|
|
48
|
+
export type ExportedWorkflow<TData = unknown, TResult = unknown, TDataOverride = undefined, TResultOverride = undefined> = {
|
|
49
|
+
run: (args?: FlowRunOptions<TDataOverride extends undefined ? TData : TDataOverride>) => Promise<WorkflowResult<TResultOverride extends undefined ? TResult : TResultOverride>>;
|
|
50
|
+
registerStepSuccess: (args?: FlowRegisterStepSuccessOptions<TDataOverride extends undefined ? TData : TDataOverride>) => Promise<WorkflowResult<TResultOverride extends undefined ? TResult : TResultOverride>>;
|
|
51
|
+
registerStepFailure: (args?: FlowRegisterStepFailureOptions<TDataOverride extends undefined ? TData : TDataOverride>) => Promise<WorkflowResult<TResultOverride extends undefined ? TResult : TResultOverride>>;
|
|
52
|
+
cancel: (args?: FlowCancelOptions) => Promise<WorkflowResult>;
|
|
53
|
+
};
|
|
54
|
+
export type MainExportedWorkflow<TData = unknown, TResult = unknown> = {
|
|
55
|
+
<TDataOverride = undefined, TResultOverride = undefined>(container?: LoadedModule[] | MedusaContainer): Omit<LocalWorkflow, "run" | "registerStepSuccess" | "registerStepFailure" | "cancel"> & ExportedWorkflow<TData, TResult, TDataOverride, TResultOverride>;
|
|
56
|
+
} & {
|
|
57
|
+
/**
|
|
58
|
+
* You can also directly call run, registerStepSuccess, registerStepFailure and cancel on the exported workflow
|
|
59
|
+
*/
|
|
60
|
+
run<TDataOverride = undefined, TResultOverride = undefined>(args?: FlowRunOptions<TDataOverride extends undefined ? TData : TDataOverride>): Promise<WorkflowResult<TResultOverride extends undefined ? TResult : TResultOverride>>;
|
|
61
|
+
registerStepSuccess<TDataOverride = undefined, TResultOverride = undefined>(args?: FlowRegisterStepSuccessOptions<TDataOverride extends undefined ? TData : TDataOverride>): Promise<WorkflowResult<TResultOverride extends undefined ? TResult : TResultOverride>>;
|
|
62
|
+
registerStepFailure<TDataOverride = undefined, TResultOverride = undefined>(args?: FlowRegisterStepFailureOptions<TDataOverride extends undefined ? TData : TDataOverride>): Promise<WorkflowResult<TResultOverride extends undefined ? TResult : TResultOverride>>;
|
|
63
|
+
cancel(args?: FlowCancelOptions): Promise<WorkflowResult>;
|
|
64
|
+
};
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/helper/type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,aAAa,EACb,oBAAoB,EACrB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEvE,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAA;IACvC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,SAAS,CAAC,EAAE,YAAY,EAAE,GAAG,eAAe,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,KAAK,GAAG,OAAO,IAAI,kBAAkB,GAAG;IACjE,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,MAAM,MAAM,8BAA8B,CAAC,KAAK,GAAG,OAAO,IACxD,kBAAkB,GAAG;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB,CAAA;AAEH,MAAM,MAAM,8BAA8B,CAAC,KAAK,GAAG,OAAO,IACxD,kBAAkB,GAAG;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB,CAAA;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,CAAC,EAAE,0BAA0B,CAAA;IACxC,aAAa,CAAC,EAAE,MAA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","sources":["../../src/helper/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MainExportedWorkflow } from "./type";
|
|
2
|
+
export declare const exportWorkflow: <TData = unknown, TResult = unknown>(workflowId: string, defaultResult?: string | Symbol, options?: {
|
|
3
|
+
wrappedInput?: boolean;
|
|
4
|
+
sourcePath?: string;
|
|
5
|
+
}) => MainExportedWorkflow<TData, TResult>;
|
|
6
|
+
//# sourceMappingURL=workflow-export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-export.d.ts","sourceRoot":"","sources":["../../src/helper/workflow-export.ts"],"names":[],"mappings":"AAyBA,OAAO,EAML,oBAAoB,EAErB,MAAM,QAAQ,CAAA;AAiTf,eAAO,MAAM,cAAc,GAAI,KAAK,YAAY,OAAO,wBACzC,MAAM,kBACF,MAAM,GAAG,MAAM,YACrB;IACR,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,KACA,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAwJrC,CAAA"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exportWorkflow = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@8medusa/modules-sdk");
|
|
5
|
+
const orchestration_1 = require("@8medusa/orchestration");
|
|
6
|
+
const utils_1 = require("@8medusa/utils");
|
|
7
|
+
const os_1 = require("os");
|
|
8
|
+
const ulid_1 = require("ulid");
|
|
9
|
+
const medusa_workflow_1 = require("../medusa-workflow");
|
|
10
|
+
const resolve_value_1 = require("../utils/composer/helpers/resolve-value");
|
|
11
|
+
function createContextualWorkflowRunner({ workflowId, defaultResult, options, container, }) {
|
|
12
|
+
const flow = new orchestration_1.LocalWorkflow(workflowId, container);
|
|
13
|
+
const originalRun = flow.run.bind(flow);
|
|
14
|
+
const originalRegisterStepSuccess = flow.registerStepSuccess.bind(flow);
|
|
15
|
+
const originalRegisterStepFailure = flow.registerStepFailure.bind(flow);
|
|
16
|
+
const originalCancel = flow.cancel.bind(flow);
|
|
17
|
+
const originalExecution = async (method, { throwOnError, logOnError = false, resultFrom, isCancel = false, container: executionContainer, }, transactionOrIdOrIdempotencyKey, input, context, events = {}) => {
|
|
18
|
+
if (!executionContainer) {
|
|
19
|
+
const container_ = flow.container;
|
|
20
|
+
if (!container_ || !(0, utils_1.isPresent)(container_?.registrations)) {
|
|
21
|
+
executionContainer = modules_sdk_1.MedusaModule.getLoadedModules().map((mod) => Object.values(mod)[0]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (executionContainer) {
|
|
25
|
+
flow.container = executionContainer;
|
|
26
|
+
}
|
|
27
|
+
const { eventGroupId, parentStepIdempotencyKey, preventReleaseEvents } = context;
|
|
28
|
+
if (!preventReleaseEvents) {
|
|
29
|
+
attachOnFinishReleaseEvents(events, flow, { logOnError });
|
|
30
|
+
}
|
|
31
|
+
const flowMetadata = {
|
|
32
|
+
eventGroupId,
|
|
33
|
+
parentStepIdempotencyKey,
|
|
34
|
+
sourcePath: options?.sourcePath,
|
|
35
|
+
preventReleaseEvents,
|
|
36
|
+
};
|
|
37
|
+
const args = [
|
|
38
|
+
transactionOrIdOrIdempotencyKey,
|
|
39
|
+
input,
|
|
40
|
+
context,
|
|
41
|
+
events,
|
|
42
|
+
flowMetadata,
|
|
43
|
+
];
|
|
44
|
+
const transaction = (await method.apply(method, args));
|
|
45
|
+
let errors = transaction.getErrors(utils_1.TransactionHandlerType.INVOKE);
|
|
46
|
+
const failedStatus = [orchestration_1.TransactionState.FAILED, orchestration_1.TransactionState.REVERTED];
|
|
47
|
+
const isCancelled = isCancel && transaction.getState() === orchestration_1.TransactionState.REVERTED;
|
|
48
|
+
const isRegisterStepFailure = method === originalRegisterStepFailure &&
|
|
49
|
+
transaction.getState() === orchestration_1.TransactionState.REVERTED;
|
|
50
|
+
let thrownError = null;
|
|
51
|
+
if (failedStatus.includes(transaction.getState()) &&
|
|
52
|
+
!isCancelled &&
|
|
53
|
+
!isRegisterStepFailure) {
|
|
54
|
+
const firstError = errors?.[0]?.error ?? new Error("Unknown error");
|
|
55
|
+
thrownError = firstError;
|
|
56
|
+
if (throwOnError) {
|
|
57
|
+
throw firstError;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
let result;
|
|
61
|
+
if (options?.wrappedInput) {
|
|
62
|
+
result = (0, resolve_value_1.resolveValue)(resultFrom, transaction.getContext());
|
|
63
|
+
if (result instanceof Promise) {
|
|
64
|
+
result = await result.catch((e) => {
|
|
65
|
+
thrownError = e;
|
|
66
|
+
if (throwOnError) {
|
|
67
|
+
throw e;
|
|
68
|
+
}
|
|
69
|
+
errors ??= [];
|
|
70
|
+
errors.push(e);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
result = transaction.getContext().invoke?.[resultFrom];
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
errors,
|
|
79
|
+
transaction,
|
|
80
|
+
result,
|
|
81
|
+
thrownError,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const newRun = async ({ input, context: outerContext, throwOnError, logOnError, resultFrom, events, container, } = {}) => {
|
|
85
|
+
resultFrom ??= defaultResult;
|
|
86
|
+
throwOnError ??= true;
|
|
87
|
+
logOnError ??= false;
|
|
88
|
+
const context = {
|
|
89
|
+
...outerContext,
|
|
90
|
+
__type: utils_1.MedusaContextType,
|
|
91
|
+
};
|
|
92
|
+
context.transactionId ??= (0, ulid_1.ulid)();
|
|
93
|
+
context.eventGroupId ??= (0, ulid_1.ulid)();
|
|
94
|
+
return await originalExecution(originalRun, {
|
|
95
|
+
throwOnError,
|
|
96
|
+
resultFrom,
|
|
97
|
+
container,
|
|
98
|
+
logOnError,
|
|
99
|
+
}, context.transactionId, input, context, events);
|
|
100
|
+
};
|
|
101
|
+
flow.run = newRun;
|
|
102
|
+
const newRegisterStepSuccess = async ({ response, idempotencyKey, context: outerContext, throwOnError, logOnError, resultFrom, events, container, } = {
|
|
103
|
+
idempotencyKey: "",
|
|
104
|
+
}) => {
|
|
105
|
+
idempotencyKey ??= "";
|
|
106
|
+
resultFrom ??= defaultResult;
|
|
107
|
+
throwOnError ??= true;
|
|
108
|
+
logOnError ??= false;
|
|
109
|
+
const [, transactionId] = idempotencyKey.split(":");
|
|
110
|
+
const context = {
|
|
111
|
+
...outerContext,
|
|
112
|
+
transactionId,
|
|
113
|
+
__type: utils_1.MedusaContextType,
|
|
114
|
+
};
|
|
115
|
+
context.eventGroupId ??= (0, ulid_1.ulid)();
|
|
116
|
+
return await originalExecution(originalRegisterStepSuccess, {
|
|
117
|
+
throwOnError,
|
|
118
|
+
resultFrom,
|
|
119
|
+
container,
|
|
120
|
+
logOnError,
|
|
121
|
+
}, idempotencyKey, response, context, events);
|
|
122
|
+
};
|
|
123
|
+
flow.registerStepSuccess = newRegisterStepSuccess;
|
|
124
|
+
const newRegisterStepFailure = async ({ response, idempotencyKey, context: outerContext, throwOnError, logOnError, resultFrom, events, container, } = {
|
|
125
|
+
idempotencyKey: "",
|
|
126
|
+
}) => {
|
|
127
|
+
idempotencyKey ??= "";
|
|
128
|
+
resultFrom ??= defaultResult;
|
|
129
|
+
throwOnError ??= true;
|
|
130
|
+
logOnError ??= false;
|
|
131
|
+
const [, transactionId] = idempotencyKey.split(":");
|
|
132
|
+
const context = {
|
|
133
|
+
...outerContext,
|
|
134
|
+
transactionId,
|
|
135
|
+
__type: utils_1.MedusaContextType,
|
|
136
|
+
};
|
|
137
|
+
context.eventGroupId ??= (0, ulid_1.ulid)();
|
|
138
|
+
return await originalExecution(originalRegisterStepFailure, {
|
|
139
|
+
throwOnError,
|
|
140
|
+
resultFrom,
|
|
141
|
+
container,
|
|
142
|
+
logOnError,
|
|
143
|
+
}, idempotencyKey, response, context, events);
|
|
144
|
+
};
|
|
145
|
+
flow.registerStepFailure = newRegisterStepFailure;
|
|
146
|
+
const newCancel = async ({ transaction, transactionId, context: outerContext, throwOnError, logOnError, events, container, } = {}) => {
|
|
147
|
+
throwOnError ??= true;
|
|
148
|
+
logOnError ??= false;
|
|
149
|
+
const context = {
|
|
150
|
+
...outerContext,
|
|
151
|
+
transactionId,
|
|
152
|
+
__type: utils_1.MedusaContextType,
|
|
153
|
+
};
|
|
154
|
+
context.eventGroupId ??= (0, ulid_1.ulid)();
|
|
155
|
+
return await originalExecution(originalCancel, {
|
|
156
|
+
throwOnError,
|
|
157
|
+
resultFrom: undefined,
|
|
158
|
+
isCancel: true,
|
|
159
|
+
container,
|
|
160
|
+
logOnError,
|
|
161
|
+
}, transaction ?? transactionId, undefined, context, events);
|
|
162
|
+
};
|
|
163
|
+
flow.cancel = newCancel;
|
|
164
|
+
return flow;
|
|
165
|
+
}
|
|
166
|
+
const exportWorkflow = (workflowId, defaultResult, options) => {
|
|
167
|
+
function exportedWorkflow(
|
|
168
|
+
// TODO: rm when all usage have been migrated
|
|
169
|
+
container) {
|
|
170
|
+
return createContextualWorkflowRunner({
|
|
171
|
+
workflowId,
|
|
172
|
+
defaultResult,
|
|
173
|
+
options,
|
|
174
|
+
container,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
const buildRunnerFn = (action, container) => {
|
|
178
|
+
const contextualRunner = createContextualWorkflowRunner({
|
|
179
|
+
workflowId,
|
|
180
|
+
defaultResult,
|
|
181
|
+
options,
|
|
182
|
+
container,
|
|
183
|
+
});
|
|
184
|
+
return contextualRunner[action];
|
|
185
|
+
};
|
|
186
|
+
exportedWorkflow.run = async (args) => {
|
|
187
|
+
const container = args?.container;
|
|
188
|
+
delete args?.container;
|
|
189
|
+
const inputArgs = { ...args };
|
|
190
|
+
return await buildRunnerFn("run", container)(inputArgs);
|
|
191
|
+
};
|
|
192
|
+
exportedWorkflow.registerStepSuccess = async (args) => {
|
|
193
|
+
const container = args?.container;
|
|
194
|
+
delete args?.container;
|
|
195
|
+
const inputArgs = { ...args };
|
|
196
|
+
return await buildRunnerFn("registerStepSuccess", container)(inputArgs);
|
|
197
|
+
};
|
|
198
|
+
exportedWorkflow.registerStepFailure = async (args) => {
|
|
199
|
+
const container = args?.container;
|
|
200
|
+
delete args?.container;
|
|
201
|
+
const inputArgs = { ...args };
|
|
202
|
+
return await buildRunnerFn("registerStepFailure", container)(inputArgs);
|
|
203
|
+
};
|
|
204
|
+
exportedWorkflow.cancel = async (args) => {
|
|
205
|
+
const container = args?.container;
|
|
206
|
+
delete args?.container;
|
|
207
|
+
const inputArgs = { ...args };
|
|
208
|
+
return await buildRunnerFn("cancel", container)(inputArgs);
|
|
209
|
+
};
|
|
210
|
+
medusa_workflow_1.MedusaWorkflow.registerWorkflow(workflowId, exportedWorkflow);
|
|
211
|
+
return exportedWorkflow;
|
|
212
|
+
};
|
|
213
|
+
exports.exportWorkflow = exportWorkflow;
|
|
214
|
+
function attachOnFinishReleaseEvents(events = {}, flow, { logOnError, } = {}) {
|
|
215
|
+
const onFinish = events.onFinish;
|
|
216
|
+
const wrappedOnFinish = async (args) => {
|
|
217
|
+
const { transaction } = args;
|
|
218
|
+
const flowEventGroupId = transaction.getFlow().metadata?.eventGroupId;
|
|
219
|
+
const logger = flow.container.resolve(utils_1.ContainerRegistrationKeys.LOGGER, { allowUnregistered: true }) || console;
|
|
220
|
+
if (logOnError) {
|
|
221
|
+
const workflowName = transaction.getFlow().modelId;
|
|
222
|
+
transaction
|
|
223
|
+
.getErrors()
|
|
224
|
+
.forEach((err) => logger.error(`${workflowName}:${err?.action}:${err?.handlerType} - ${err?.error?.message}${os_1.EOL}${err?.error?.stack}`));
|
|
225
|
+
}
|
|
226
|
+
const eventBusService = flow.container.resolve(utils_1.Modules.EVENT_BUS, {
|
|
227
|
+
allowUnregistered: true,
|
|
228
|
+
});
|
|
229
|
+
if (!eventBusService || !flowEventGroupId) {
|
|
230
|
+
await onFinish?.(args);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const failedStatus = [orchestration_1.TransactionState.FAILED, orchestration_1.TransactionState.REVERTED];
|
|
234
|
+
if (failedStatus.includes(transaction.getState())) {
|
|
235
|
+
return await eventBusService
|
|
236
|
+
.clearGroupedEvents(flowEventGroupId)
|
|
237
|
+
.catch(() => {
|
|
238
|
+
logger.warn(`Failed to clear events for eventGroupId - ${flowEventGroupId}`);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
await eventBusService
|
|
242
|
+
.releaseGroupedEvents(flowEventGroupId)
|
|
243
|
+
.then(async () => {
|
|
244
|
+
await onFinish?.(args);
|
|
245
|
+
})
|
|
246
|
+
.catch((e) => {
|
|
247
|
+
logger.error(`Failed to release grouped events for eventGroupId: ${flowEventGroupId}`, e);
|
|
248
|
+
return flow.cancel(transaction);
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
events.onFinish = wrappedOnFinish;
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=workflow-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-export.js","sourceRoot":"","sources":["../../src/helper/workflow-export.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AACnD,0DAK+B;AAQ/B,0CAMuB;AACvB,2BAAwB;AACxB,+BAA2B;AAC3B,wDAAmD;AACnD,2EAAsE;AAWtE,SAAS,8BAA8B,CAKrC,EACA,UAAU,EACV,aAAa,EACb,OAAO,EACP,SAAS,GASV;IAKC,MAAM,IAAI,GAAG,IAAI,6BAAa,CAAC,UAAU,EAAE,SAAU,CAAC,CAAA;IAEtD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACvC,MAAM,2BAA2B,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACvE,MAAM,2BAA2B,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACvE,MA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AC,GAAG,EAAE;gBACV,MAAM,CAAC,IAAI,CACT,6CAA6C,gBAAgB,EAAE,CAChE,CAAA;YACH,CAAC,CAAC,CAAA;QACN,CAAC;QAED,MAAM,eAAe;aAClB,oBAAoB,CAAC,gBAAgB,CAAC;aACtC,IAAI,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAA;QACxB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACX,MAAM,CAAC,KAAK,CACV,sDAAsD,gBAAgB,EAAE,EACxE,CAAC,CACF,CAAA;YAED,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;IACN,CAAC,CAAA;IAED,MAAM,CAAC,QAAQ,GAAG,eAAe,CAAA;AACnC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Composer = void 0;
|
|
30
|
+
__exportStar(require("./helper"), exports);
|
|
31
|
+
__exportStar(require("./medusa-workflow"), exports);
|
|
32
|
+
__exportStar(require("./utils/composer"), exports);
|
|
33
|
+
exports.Composer = __importStar(require("./utils/composer"));
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,oDAAiC;AACjC,mDAAgC;AAChC,6DAA4C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"medusa-workflow.d.ts","sourceRoot":"","sources":["../src/medusa-workflow.ts"],"names":[],"mappings":"AA8BA,QAAA,MAAM,oBAAoB,KAAwB,CAAA;AAElD,OAAO,EAAE,oBAAoB,IAAI,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MedusaWorkflow = void 0;
|
|
4
|
+
class MedusaWorkflow {
|
|
5
|
+
static registerWorkflow(workflowId, exportedWorkflow) {
|
|
6
|
+
if (workflowId in MedusaWorkflow.workflows) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
MedusaWorkflow.workflows[workflowId] = exportedWorkflow;
|
|
10
|
+
}
|
|
11
|
+
static getWorkflow(workflowId) {
|
|
12
|
+
return MedusaWorkflow.workflows[workflowId];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
MedusaWorkflow.workflows = {};
|
|
16
|
+
global.MedusaWorkflow ??= MedusaWorkflow;
|
|
17
|
+
const GlobalMedusaWorkflow = global.MedusaWorkflow;
|
|
18
|
+
exports.MedusaWorkflow = GlobalMedusaWorkflow;
|
|
19
|
+
//# sourceMappingURL=medusa-workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,WAAW,CAAC,UAAU;QAC3B,OAAO,cAAc,CAAC,SAAS,CAAC,UAAU,CAAgC,CAAA;IAC5E,CAAC;;AArBM,wBAAS,GASZ,EAAE,CAAA;AAeR,MAAM,CAAC,cAAc,KAAK,cAAc,CAAA;AACxC,MAAM,oBAAoB,GAAG,MAAM,CAAC,cAAc,CAAA;AAEjB,8CAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/index.ts","../src/medusa-workflow.ts","../src/helper/index.ts","../src/helper/type.ts","../src/helper/workflow-export.ts","../src/utils/_playground.ts","../src/utils/composer/create-hook.ts","../src/utils/composer/create-step.ts","../src/utils/composer/create-workflow.ts","../src/utils/composer/index.ts","../src/utils/composer/parallelize.ts","../src/utils/composer/transform.ts","../src/utils/composer/type.ts","../src/utils/composer/when.ts","../src/utils/composer/__tests__/compose.ts","../src/utils/composer/__tests__/index.spec.ts","../src/utils/composer/helpers/create-step-handler.ts","../src/utils/composer/helpers/index.ts","../src/utils/composer/helpers/proxy.ts","../src/utils/composer/helpers/resolve-value.ts","../src/utils/composer/helpers/step-response.ts","../src/utils/composer/helpers/workflow-response.ts"],"version":"5.6.2"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_playground.d.ts","sourceRoot":"","sources":["../../src/utils/_playground.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const zod_1 = require("zod");
|
|
4
|
+
const composer_1 = require("./composer");
|
|
5
|
+
const create_hook_1 = require("./composer/create-hook");
|
|
6
|
+
const workflow_response_1 = require("./composer/helpers/workflow-response");
|
|
7
|
+
const step1 = (0, composer_1.createStep)("step1", async (input, context) => {
|
|
8
|
+
return new composer_1.StepResponse({ step1: "step1" });
|
|
9
|
+
});
|
|
10
|
+
const step2 = (0, composer_1.createStep)("step2", async (input, context) => {
|
|
11
|
+
return new composer_1.StepResponse({ step2: input });
|
|
12
|
+
});
|
|
13
|
+
const step3 = (0, composer_1.createStep)("step3", async function (_, context) {
|
|
14
|
+
return new composer_1.StepResponse({ step3: "step3" });
|
|
15
|
+
});
|
|
16
|
+
const workflow = (0, composer_1.createWorkflow)("sub-workflow", function (input) {
|
|
17
|
+
step1();
|
|
18
|
+
step2({ filters: { id: [] } });
|
|
19
|
+
let somethingHook = (0, create_hook_1.createHook)("something", { id: "1" }, {
|
|
20
|
+
resultValidator: zod_1.z.object({
|
|
21
|
+
id: zod_1.z.number(),
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
return new workflow_response_1.WorkflowResponse({ r: somethingHook.getResult(), step3: step3() }, { hooks: [somethingHook] });
|
|
25
|
+
});
|
|
26
|
+
workflow.hooks.something((input, context) => {
|
|
27
|
+
console.log("input>", input);
|
|
28
|
+
console.log("context>", context);
|
|
29
|
+
return new composer_1.StepResponse({ id: 2, foo: "bar" });
|
|
30
|
+
});
|
|
31
|
+
workflow.run().then((res) => {
|
|
32
|
+
console.log("res", res);
|
|
33
|
+
});
|
|
34
|
+
/*const workflow2 = createWorkflow("workflow", function () {
|
|
35
|
+
const step1Res = step1()
|
|
36
|
+
|
|
37
|
+
const step3Res = when({ value: true }, ({ value }) => {
|
|
38
|
+
return value
|
|
39
|
+
}).then(() => {
|
|
40
|
+
return step3()
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
transform({ step3Res }, ({ step3Res }) => {
|
|
44
|
+
console.log(step3Res)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const workflowRes = workflow.asStep({ outsideWorkflowData: step1Res.step1 })
|
|
48
|
+
|
|
49
|
+
return workflowRes
|
|
50
|
+
})*/
|
|
51
|
+
// workflow()
|
|
52
|
+
// .run({})
|
|
53
|
+
// .then((res) => {
|
|
54
|
+
// console.log(res.result)
|
|
55
|
+
// })
|
|
56
|
+
/*const step1 = createStep("step1", async (input: {}, context) => {
|
|
57
|
+
return new StepResponse({ step1: ["step1"] })
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const step2 = createStep("step2", async (input: string[], context) => {
|
|
61
|
+
return new StepResponse({ step2: input })
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const step3 = createStep("step3", async () => {
|
|
65
|
+
return new StepResponse({ step3: "step3" })
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const workflow = createWorkflow("workflow", function () {
|
|
69
|
+
const step1Res = step1()
|
|
70
|
+
step3()
|
|
71
|
+
return step2(step1Res.step1)
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
workflow()
|
|
75
|
+
.run({})
|
|
76
|
+
.then((res) => {
|
|
77
|
+
console.log(res.result)
|
|
78
|
+
})*/
|
|
79
|
+
//# sourceMappingURL=_playground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_playground.js","sourceRoot":"","sources":["../../src/utils/_playground.ts"],"names":[],"mappings":";;AAAA,6BAAuB;AACvB,yCAKmB;AACnB,wDAAmD;AACnD,4EAAuE;AAEvE,MAAM,KAAK,GAAG,IAAA,qBAAU,EAAC,OAAO,EAAE,KAAK,EAAE,KAAS,EAAE,OAAO,EAAE,EAAE;IAC7D,OAAO,IAAI,uBAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AAC7C,CAAC,CAAC,CAAA;AAGF,MAAM,KAAK,GAAG,IAAA,qBAAU,EAAC,OAAO,EAAE,KAAK,EAAE,KAAiB,EAAE,OAAO,EAAE,EAAE;IACrE,OAAO,IAAI,uBAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;AAC3C,CAAC,CAAC,CAAA;AAEF,MAAM,KAAK,GAAG,IAAA,qBAAU,EAAC,OAAO,EAAE,KAAK,WAAW,CAAC,EAAE,OAAO;IAC1D,OAAO,IAAI,uBAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AAC7C,CAAC,CAAC,CAAA;AAEF,MAAM,QAAQ,GAAG,IAAA,yBAAc,EAC7B,cAAc,EACd,UAAU,KAAoD;IAC5D,KAAK,EAAE,CAAA;IACP,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAE9B,IAAI,aAAa,GAAG,IAAA,wBAAU,EAC5B,WAAW,EACX,EAAE,EAAE,EAAE,GAAG,EAAE,EACX;QACE,eAAe,EAAE,OAAC,CAAC,MAAM,CAAC;YACxB,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;SACf,CAAC;KACH,CACF,CAAA;IAED,OAAO,IAAI,oCAAgB,CACzB,EAAE,CAAC,EAAE,aAAa,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAChD,EAAE,KAAK,EAAE,CAAC,aAAa,CAAC,EAAE,CAC3B,CAAA;AACH,CAAC,CACF,CAAA;AAED,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAC1C,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAC5B,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAChC,OAAO,IAAI,uBAAY,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;AAChD,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;IAC1B,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACzB,CAAC,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;IAgBI;AAEJ,aAAa;AACb,aAAa;AACb,qBAAqB;AACrB,8BAA8B;AAC9B,OAAO;AAEP;;;;;;;;;;;;;;;;;;;;;;MAsBM"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ZodSchema } from "zod";
|
|
2
|
+
import { OrchestrationUtils } from "@8medusa/utils";
|
|
3
|
+
/**
|
|
4
|
+
* Representation of a hook definition.
|
|
5
|
+
*/
|
|
6
|
+
export type Hook<Name extends string, Input, Output> = {
|
|
7
|
+
__type: typeof OrchestrationUtils.SymbolWorkflowHook;
|
|
8
|
+
name: Name;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the result of the hook
|
|
11
|
+
*/
|
|
12
|
+
getResult(): Output | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* By prefixing a key with a space, we remove it from the
|
|
15
|
+
* intellisense of TypeScript. This is needed because
|
|
16
|
+
* input is not set at runtime. It is a type-only
|
|
17
|
+
* property to infer input data type of a hook
|
|
18
|
+
*/
|
|
19
|
+
" output": Output;
|
|
20
|
+
" input": Input;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Expose a hook in your workflow where you can inject custom functionality as a step function.
|
|
24
|
+
*
|
|
25
|
+
* A handler hook can later be registered to consume the hook and perform custom functionality.
|
|
26
|
+
*
|
|
27
|
+
* Learn more in [this documentation](https://docs.medusajs.com/learn/fundamentals/workflows/workflow-hooks).
|
|
28
|
+
*
|
|
29
|
+
* @param name - The hook's name. This is used when the hook handler is registered to consume the workflow.
|
|
30
|
+
* @param input - The input to pass to the hook handler.
|
|
31
|
+
* @returns A workflow hook.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* import {
|
|
35
|
+
* createStep,
|
|
36
|
+
* createHook,
|
|
37
|
+
* createWorkflow,
|
|
38
|
+
* WorkflowResponse,
|
|
39
|
+
* } from "@8medusa/framework/workflows-sdk"
|
|
40
|
+
* import { createProductStep } from "./steps/create-product"
|
|
41
|
+
*
|
|
42
|
+
* export const myWorkflow = createWorkflow(
|
|
43
|
+
* "my-workflow",
|
|
44
|
+
* function (input) {
|
|
45
|
+
* const product = createProductStep(input)
|
|
46
|
+
* const productCreatedHook = createHook(
|
|
47
|
+
* "productCreated",
|
|
48
|
+
* { productId: product.id }
|
|
49
|
+
* )
|
|
50
|
+
*
|
|
51
|
+
* return new WorkflowResponse(product, {
|
|
52
|
+
* hooks: [productCreatedHook],
|
|
53
|
+
* })
|
|
54
|
+
* }
|
|
55
|
+
* )
|
|
56
|
+
*/
|
|
57
|
+
export declare function createHook<Name extends string, TInvokeInput, TInvokeOutput>(name: Name, input: TInvokeInput, options?: {
|
|
58
|
+
resultValidator?: ZodSchema<TInvokeOutput>;
|
|
59
|
+
}): Hook<Name, TInvokeInput, TInvokeOutput>;
|
|
60
|
+
//# sourceMappingURL=create-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-hook.d.ts","sourceRoot":"","sources":["../../../src/utils/composer/create-hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAQnD;;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,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE;IACP,eAAe,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,CAAA;CACtC,GACL,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,aAAa,CAAC,CAqEzC"}
|