@medusajs/workflow-engine-inmemory 3.0.0-snapshot-20250410112222 → 3.0.0-snapshot-20251104004624
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/loaders/utils.d.ts.map +1 -1
- package/dist/loaders/utils.js +1 -1
- package/dist/loaders/utils.js.map +1 -1
- package/dist/migrations/Migration20231228143900.d.ts +1 -1
- package/dist/migrations/Migration20231228143900.d.ts.map +1 -1
- package/dist/migrations/Migration20231228143900.js +1 -1
- package/dist/migrations/Migration20231228143900.js.map +1 -1
- package/dist/migrations/Migration20241206101446.d.ts +1 -1
- package/dist/migrations/Migration20241206101446.d.ts.map +1 -1
- package/dist/migrations/Migration20241206101446.js +1 -1
- package/dist/migrations/Migration20241206101446.js.map +1 -1
- package/dist/migrations/Migration20250128174331.d.ts +1 -1
- package/dist/migrations/Migration20250128174331.d.ts.map +1 -1
- package/dist/migrations/Migration20250128174331.js +1 -1
- package/dist/migrations/Migration20250128174331.js.map +1 -1
- package/dist/migrations/Migration20250505092459.d.ts +6 -0
- package/dist/migrations/Migration20250505092459.d.ts.map +1 -0
- package/dist/migrations/Migration20250505092459.js +40 -0
- package/dist/migrations/Migration20250505092459.js.map +1 -0
- package/dist/migrations/Migration20250819104213.d.ts +6 -0
- package/dist/migrations/Migration20250819104213.d.ts.map +1 -0
- package/dist/migrations/Migration20250819104213.js +14 -0
- package/dist/migrations/Migration20250819104213.js.map +1 -0
- package/dist/migrations/Migration20250819110924.d.ts +6 -0
- package/dist/migrations/Migration20250819110924.d.ts.map +1 -0
- package/dist/migrations/Migration20250819110924.js +16 -0
- package/dist/migrations/Migration20250819110924.js.map +1 -0
- package/dist/migrations/Migration20250908080305.d.ts +6 -0
- package/dist/migrations/Migration20250908080305.d.ts.map +1 -0
- package/dist/migrations/Migration20250908080305.js +20 -0
- package/dist/migrations/Migration20250908080305.js.map +1 -0
- package/dist/models/workflow-execution.d.ts +1 -0
- package/dist/models/workflow-execution.d.ts.map +1 -1
- package/dist/models/workflow-execution.js +22 -1
- package/dist/models/workflow-execution.js.map +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +1 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/services/workflow-orchestrator.d.ts +18 -3
- package/dist/services/workflow-orchestrator.d.ts.map +1 -1
- package/dist/services/workflow-orchestrator.js +176 -53
- package/dist/services/workflow-orchestrator.js.map +1 -1
- package/dist/services/workflows-module.d.ts +113 -8
- package/dist/services/workflows-module.d.ts.map +1 -1
- package/dist/services/workflows-module.js +114 -48
- package/dist/services/workflows-module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/workflow-orchestrator-storage.d.ts +11 -3
- package/dist/utils/workflow-orchestrator-storage.d.ts.map +1 -1
- package/dist/utils/workflow-orchestrator-storage.js +336 -139
- package/dist/utils/workflow-orchestrator-storage.js.map +1 -1
- package/package.json +14 -28
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var _a
|
|
14
|
+
var _a;
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.WorkflowsModuleService = void 0;
|
|
17
17
|
const types_1 = require("@medusajs/framework/types");
|
|
@@ -24,16 +24,10 @@ class WorkflowsModuleService extends utils_1.ModulesSdkUtils.MedusaService({ Wor
|
|
|
24
24
|
this.moduleDeclaration = moduleDeclaration;
|
|
25
25
|
this.__hooks = {
|
|
26
26
|
onApplicationStart: async () => {
|
|
27
|
-
await this.
|
|
28
|
-
this.clearTimeout_ = setInterval(async () => {
|
|
29
|
-
try {
|
|
30
|
-
await this.clearExpiredExecutions();
|
|
31
|
-
}
|
|
32
|
-
catch { }
|
|
33
|
-
}, 1000 * 60 * 60);
|
|
27
|
+
await this.workflowOrchestratorService_.onApplicationStart();
|
|
34
28
|
},
|
|
35
29
|
onApplicationShutdown: async () => {
|
|
36
|
-
|
|
30
|
+
await this.workflowOrchestratorService_.onApplicationShutdown();
|
|
37
31
|
},
|
|
38
32
|
};
|
|
39
33
|
this.manager_ = manager;
|
|
@@ -41,22 +35,96 @@ class WorkflowsModuleService extends utils_1.ModulesSdkUtils.MedusaService({ Wor
|
|
|
41
35
|
this.workflowExecutionService_ = workflowExecutionService;
|
|
42
36
|
this.workflowOrchestratorService_ = workflowOrchestratorService;
|
|
43
37
|
}
|
|
38
|
+
static prepareFilters(filters) {
|
|
39
|
+
const filters_ = { ...filters }; // shallow copy
|
|
40
|
+
if (filters_?.q) {
|
|
41
|
+
const q = filters_.q;
|
|
42
|
+
delete filters_.q;
|
|
43
|
+
const textSearch = { $ilike: `%${q}%` };
|
|
44
|
+
const textSearchFilters = {
|
|
45
|
+
$or: [
|
|
46
|
+
{
|
|
47
|
+
transaction_id: textSearch,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
workflow_id: textSearch,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
state: textSearch,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
execution: {
|
|
57
|
+
runId: textSearch,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
if (!Object.keys(filters_).length) {
|
|
63
|
+
return textSearchFilters;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return { $and: [filters, textSearchFilters] };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return filters;
|
|
70
|
+
}
|
|
71
|
+
// @ts-expect-error
|
|
72
|
+
async listWorkflowExecutions(filters = {}, config, sharedContext) {
|
|
73
|
+
const filters_ = WorkflowsModuleService.prepareFilters(filters);
|
|
74
|
+
return await super.listWorkflowExecutions(filters_, config, sharedContext);
|
|
75
|
+
}
|
|
76
|
+
// @ts-expect-error
|
|
77
|
+
async listAndCountWorkflowExecutions(filters = {}, config, sharedContext) {
|
|
78
|
+
const filters_ = WorkflowsModuleService.prepareFilters(filters);
|
|
79
|
+
return await super.listAndCountWorkflowExecutions(filters_, config, sharedContext);
|
|
80
|
+
}
|
|
44
81
|
async run(workflowIdOrWorkflow, options = {}, context = {}) {
|
|
45
|
-
options
|
|
46
|
-
const { manager, transactionManager, preventReleaseEvents, ...restContext } = context;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
82
|
+
const options_ = JSON.parse(JSON.stringify(options ?? {}));
|
|
83
|
+
const { manager, transactionManager, preventReleaseEvents, transactionId, parentStepIdempotencyKey, ...restContext } = context;
|
|
84
|
+
let localPreventReleaseEvents = false;
|
|
85
|
+
if ((0, utils_1.isDefined)(options_.context?.preventReleaseEvents)) {
|
|
86
|
+
localPreventReleaseEvents = options_.context.preventReleaseEvents;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
if ((0, utils_1.isDefined)(context.eventGroupId) &&
|
|
90
|
+
(0, utils_1.isDefined)(options_.context?.eventGroupId) &&
|
|
91
|
+
context.eventGroupId === options_.context?.eventGroupId) {
|
|
92
|
+
localPreventReleaseEvents = true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
let eventGroupId;
|
|
96
|
+
if (options_.context?.eventGroupId) {
|
|
97
|
+
eventGroupId = options_.context.eventGroupId;
|
|
98
|
+
}
|
|
99
|
+
else if (localPreventReleaseEvents && context.eventGroupId) {
|
|
100
|
+
eventGroupId = context.eventGroupId;
|
|
101
|
+
}
|
|
102
|
+
options_.context = {
|
|
103
|
+
...(restContext ?? {}),
|
|
104
|
+
...(options_.context ?? {}),
|
|
105
|
+
eventGroupId,
|
|
106
|
+
runId: options_.runId,
|
|
107
|
+
preventReleaseEvents: localPreventReleaseEvents,
|
|
108
|
+
};
|
|
109
|
+
const ret = await this.workflowOrchestratorService_.run(workflowIdOrWorkflow, options_);
|
|
52
110
|
return ret;
|
|
53
111
|
}
|
|
54
112
|
async getRunningTransaction(workflowId, transactionId, context = {}) {
|
|
55
113
|
return await this.workflowOrchestratorService_.getRunningTransaction(workflowId, transactionId, context);
|
|
56
114
|
}
|
|
115
|
+
async retryStep({ idempotencyKey, options, }, context = {}) {
|
|
116
|
+
const options_ = JSON.parse(JSON.stringify(options ?? {}));
|
|
117
|
+
const { manager, transactionManager, ...restContext } = context;
|
|
118
|
+
options_.context ??= restContext;
|
|
119
|
+
return await this.workflowOrchestratorService_.retryStep({
|
|
120
|
+
idempotencyKey,
|
|
121
|
+
options: options_,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
57
124
|
async setStepSuccess({ idempotencyKey, stepResponse, options, }, context = {}) {
|
|
58
|
-
options
|
|
59
|
-
|
|
125
|
+
const options_ = JSON.parse(JSON.stringify(options ?? {}));
|
|
126
|
+
const { manager, transactionManager, ...restContext } = context;
|
|
127
|
+
options_.context ??= restContext;
|
|
60
128
|
return await this.workflowOrchestratorService_.setStepSuccess({
|
|
61
129
|
idempotencyKey,
|
|
62
130
|
stepResponse,
|
|
@@ -64,79 +132,77 @@ class WorkflowsModuleService extends utils_1.ModulesSdkUtils.MedusaService({ Wor
|
|
|
64
132
|
});
|
|
65
133
|
}
|
|
66
134
|
async setStepFailure({ idempotencyKey, stepResponse, options, }, context = {}) {
|
|
67
|
-
options
|
|
68
|
-
|
|
135
|
+
const options_ = JSON.parse(JSON.stringify(options ?? {}));
|
|
136
|
+
const { manager, transactionManager, ...restContext } = context;
|
|
137
|
+
options_.context ??= restContext;
|
|
69
138
|
return await this.workflowOrchestratorService_.setStepFailure({
|
|
70
139
|
idempotencyKey,
|
|
71
140
|
stepResponse,
|
|
72
141
|
options,
|
|
73
142
|
});
|
|
74
143
|
}
|
|
75
|
-
async subscribe(args
|
|
144
|
+
async subscribe(args) {
|
|
76
145
|
return this.workflowOrchestratorService_.subscribe(args);
|
|
77
146
|
}
|
|
78
|
-
async unsubscribe(args
|
|
147
|
+
async unsubscribe(args) {
|
|
79
148
|
return this.workflowOrchestratorService_.unsubscribe(args);
|
|
80
149
|
}
|
|
81
|
-
async
|
|
82
|
-
return this.
|
|
83
|
-
DELETE FROM workflow_execution
|
|
84
|
-
WHERE retention_time IS NOT NULL AND
|
|
85
|
-
updated_at <= (CURRENT_TIMESTAMP - INTERVAL '1 second' * retention_time);
|
|
86
|
-
`);
|
|
87
|
-
}
|
|
88
|
-
async cancel(workflowIdOrWorkflow, options, context = {}) {
|
|
89
|
-
return this.workflowOrchestratorService_.cancel(workflowIdOrWorkflow, options);
|
|
150
|
+
async cancel(workflowIdOrWorkflow, options) {
|
|
151
|
+
return await this.workflowOrchestratorService_.cancel(workflowIdOrWorkflow, options);
|
|
90
152
|
}
|
|
91
153
|
}
|
|
92
154
|
exports.WorkflowsModuleService = WorkflowsModuleService;
|
|
93
155
|
__decorate([
|
|
94
|
-
(0, utils_1.
|
|
156
|
+
(0, utils_1.InjectManager)()
|
|
157
|
+
// @ts-expect-error
|
|
158
|
+
,
|
|
95
159
|
__param(2, (0, utils_1.MedusaContext)()),
|
|
96
160
|
__metadata("design:type", Function),
|
|
97
|
-
__metadata("design:paramtypes", [
|
|
161
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
98
162
|
__metadata("design:returntype", Promise)
|
|
99
|
-
], WorkflowsModuleService.prototype, "
|
|
163
|
+
], WorkflowsModuleService.prototype, "listWorkflowExecutions", null);
|
|
100
164
|
__decorate([
|
|
101
|
-
(0, utils_1.
|
|
165
|
+
(0, utils_1.InjectManager)()
|
|
166
|
+
// @ts-expect-error
|
|
167
|
+
,
|
|
102
168
|
__param(2, (0, utils_1.MedusaContext)()),
|
|
103
169
|
__metadata("design:type", Function),
|
|
104
|
-
__metadata("design:paramtypes", [
|
|
170
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
105
171
|
__metadata("design:returntype", Promise)
|
|
106
|
-
], WorkflowsModuleService.prototype, "
|
|
172
|
+
], WorkflowsModuleService.prototype, "listAndCountWorkflowExecutions", null);
|
|
107
173
|
__decorate([
|
|
108
174
|
(0, utils_1.InjectSharedContext)(),
|
|
109
|
-
__param(
|
|
175
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
|
110
176
|
__metadata("design:type", Function),
|
|
111
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
177
|
+
__metadata("design:paramtypes", [typeof (_a = typeof TWorkflow !== "undefined" && TWorkflow) === "function" ? _a : Object, Object, Object]),
|
|
112
178
|
__metadata("design:returntype", Promise)
|
|
113
|
-
], WorkflowsModuleService.prototype, "
|
|
179
|
+
], WorkflowsModuleService.prototype, "run", null);
|
|
114
180
|
__decorate([
|
|
115
181
|
(0, utils_1.InjectSharedContext)(),
|
|
116
|
-
__param(
|
|
182
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
|
117
183
|
__metadata("design:type", Function),
|
|
118
|
-
__metadata("design:paramtypes", [
|
|
184
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
119
185
|
__metadata("design:returntype", Promise)
|
|
120
|
-
], WorkflowsModuleService.prototype, "
|
|
186
|
+
], WorkflowsModuleService.prototype, "getRunningTransaction", null);
|
|
121
187
|
__decorate([
|
|
122
188
|
(0, utils_1.InjectSharedContext)(),
|
|
123
189
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
124
190
|
__metadata("design:type", Function),
|
|
125
191
|
__metadata("design:paramtypes", [Object, Object]),
|
|
126
192
|
__metadata("design:returntype", Promise)
|
|
127
|
-
], WorkflowsModuleService.prototype, "
|
|
193
|
+
], WorkflowsModuleService.prototype, "retryStep", null);
|
|
128
194
|
__decorate([
|
|
129
195
|
(0, utils_1.InjectSharedContext)(),
|
|
130
196
|
__param(1, (0, utils_1.MedusaContext)()),
|
|
131
197
|
__metadata("design:type", Function),
|
|
132
198
|
__metadata("design:paramtypes", [Object, Object]),
|
|
133
199
|
__metadata("design:returntype", Promise)
|
|
134
|
-
], WorkflowsModuleService.prototype, "
|
|
200
|
+
], WorkflowsModuleService.prototype, "setStepSuccess", null);
|
|
135
201
|
__decorate([
|
|
136
202
|
(0, utils_1.InjectSharedContext)(),
|
|
137
|
-
__param(
|
|
203
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
|
138
204
|
__metadata("design:type", Function),
|
|
139
|
-
__metadata("design:paramtypes", [
|
|
205
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
140
206
|
__metadata("design:returntype", Promise)
|
|
141
|
-
], WorkflowsModuleService.prototype, "
|
|
207
|
+
], WorkflowsModuleService.prototype, "setStepFailure", null);
|
|
142
208
|
//# sourceMappingURL=workflows-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows-module.js","sourceRoot":"","sources":["../../src/services/workflows-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"workflows-module.js","sourceRoot":"","sources":["../../src/services/workflows-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAWkC;AAClC,qDAMkC;AAMlC,qCAA2C;AAW3C,MAAa,sBAIX,SAAQ,uBAAe,CAAC,aAAa,CAEpC,EAAE,iBAAiB,EAAjB,2BAAiB,EAAE,CAAC;IAMvB,YACE,EACE,OAAO,EACP,cAAc,EACd,wBAAwB,EACxB,2BAA2B,GACN,EACJ,iBAA4C;QAE/D,aAAa;QACb,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QAHA,sBAAiB,GAAjB,iBAAiB,CAA2B;QAWjE,YAAO,GAAG;YACR,kBAAkB,EAAE,KAAK,IAAI,EAAE;gBAC7B,MAAM,IAAI,CAAC,4BAA4B,CAAC,kBAAkB,EAAE,CAAA;YAC9D,CAAC;YACD,qBAAqB,EAAE,KAAK,IAAI,EAAE;gBAChC,MAAM,IAAI,CAAC,4BAA4B,CAAC,qBAAqB,EAAE,CAAA;YACjE,CAAC;SACF,CAAA;QAbC,IAAI,CAAC,QAAQ,GA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FL,IAAA,qBAAa,GAAE;IAChB,mBAAmB;;IAIhB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;4EAQjB;AAGK;IADL,IAAA,2BAAmB,GAAE;IAQnB,WAAA,IAAA,qBAAa,GAAE,CAAA;;yDANM,SAAS,oBAAT,SAAS;;iDAwDhC;AAGK;IADL,IAAA,2BAAmB,GAAE;IAInB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;mEAOjB;AAGK;IADL,IAAA,2BAAmB,GAAE;IASnB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;uDAYjB;AAGK;IADL,IAAA,2BAAmB,GAAE;IAWnB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;4DAajB;AAGK;IADL,IAAA,2BAAmB,GAAE;IAanB,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;4DAajB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/loaders/index.ts","../src/loaders/utils.ts","../src/migrations/Migration20231228143900.ts","../src/migrations/Migration20241206101446.ts","../src/migrations/Migration20250128174331.ts","../src/models/index.ts","../src/models/workflow-execution.ts","../src/schema/index.ts","../src/services/index.ts","../src/services/workflow-orchestrator.ts","../src/services/workflows-module.ts","../src/types/index.ts","../src/utils/index.ts","../src/utils/workflow-orchestrator-storage.ts"],"version":"5.
|
|
1
|
+
{"root":["../src/index.ts","../src/loaders/index.ts","../src/loaders/utils.ts","../src/migrations/Migration20231228143900.ts","../src/migrations/Migration20241206101446.ts","../src/migrations/Migration20250128174331.ts","../src/migrations/Migration20250505092459.ts","../src/migrations/Migration20250819104213.ts","../src/migrations/Migration20250819110924.ts","../src/migrations/Migration20250908080305.ts","../src/models/index.ts","../src/models/workflow-execution.ts","../src/schema/index.ts","../src/services/index.ts","../src/services/workflow-orchestrator.ts","../src/services/workflows-module.ts","../src/types/index.ts","../src/utils/index.ts","../src/utils/workflow-orchestrator-storage.ts"],"version":"5.9.3"}
|
|
@@ -9,16 +9,23 @@ export declare class InMemoryDistributedTransactionStorage implements IDistribut
|
|
|
9
9
|
private scheduled;
|
|
10
10
|
private retries;
|
|
11
11
|
private timeouts;
|
|
12
|
+
private pendingTimers;
|
|
13
|
+
private clearTimeout_;
|
|
14
|
+
private isLocked;
|
|
12
15
|
constructor({ workflowExecutionService, logger, }: {
|
|
13
16
|
workflowExecutionService: ModulesSdkTypes.IMedusaInternalService<any>;
|
|
14
17
|
logger: Logger;
|
|
15
18
|
});
|
|
19
|
+
onApplicationStart(): Promise<void>;
|
|
20
|
+
onApplicationShutdown(): Promise<void>;
|
|
16
21
|
setWorkflowOrchestratorService(workflowOrchestratorService: any): void;
|
|
22
|
+
private createManagedTimer;
|
|
17
23
|
private saveToDb;
|
|
18
24
|
private deleteFromDb;
|
|
19
|
-
get(key: string, options?: TransactionOptions
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
get(key: string, options?: TransactionOptions & {
|
|
26
|
+
isCancelling?: boolean;
|
|
27
|
+
}): Promise<TransactionCheckpoint | undefined>;
|
|
28
|
+
save(key: string, data: TransactionCheckpoint, ttl?: number, options?: TransactionOptions): Promise<TransactionCheckpoint>;
|
|
22
29
|
scheduleRetry(transaction: DistributedTransactionType, step: TransactionStep, timestamp: number, interval: number): Promise<void>;
|
|
23
30
|
clearRetry(transaction: DistributedTransactionType, step: TransactionStep): Promise<void>;
|
|
24
31
|
scheduleTransactionTimeout(transaction: DistributedTransactionType, timestamp: number, interval: number): Promise<void>;
|
|
@@ -31,5 +38,6 @@ export declare class InMemoryDistributedTransactionStorage implements IDistribut
|
|
|
31
38
|
remove(jobId: string): Promise<void>;
|
|
32
39
|
removeAll(): Promise<void>;
|
|
33
40
|
jobHandler(jobId: string): Promise<void>;
|
|
41
|
+
clearExpiredExecutions(): Promise<void>;
|
|
34
42
|
}
|
|
35
43
|
//# sourceMappingURL=workflow-orchestrator-storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-orchestrator-storage.d.ts","sourceRoot":"","sources":["../../src/utils/workflow-orchestrator-storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow-orchestrator-storage.d.ts","sourceRoot":"","sources":["../../src/utils/workflow-orchestrator-storage.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,8BAA8B,EAC9B,gBAAgB,EAIhB,qBAAqB,EAGrB,kBAAkB,EAClB,eAAe,EAEhB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAEL,MAAM,EACN,eAAe,EAChB,MAAM,2BAA2B,CAAA;AAyElC,qBAAa,qCACX,YAAW,8BAA8B,EAAE,4BAA4B;;IAEvE,OAAO,CAAC,yBAAyB,CAA6C;IAC9E,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,4BAA4B,CAA6B;IAEjE,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,SAAS,CAQJ;IACb,OAAO,CAAC,OAAO,CAAyC;IACxD,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,aAAa,CAAiC;IAEtD,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,QAAQ,CAAkC;gBAEtC,EACV,wBAAwB,EACxB,MAAM,GACP,EAAE;QACD,wBAAwB,EAAE,eAAe,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAA;QACrE,MAAM,EAAE,MAAM,CAAA;KACf;IAKK,kBAAkB;IAQlB,qBAAqB;IAyB3B,8BAA8B,CAAC,2BAA2B,KAAA;IAI1D,OAAO,CAAC,kBAAkB;YAgBZ,QAAQ;YA4ER,YAAY;IAQpB,GAAG,CACP,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,kBAAkB,GAAG;QAC7B,YAAY,CAAC,EAAE,OAAO,CAAA;KACvB,GACA,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IAwDvC,IAAI,CACR,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,qBAAqB,EAC3B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