@mastra/temporal 0.0.0 → 0.1.0-alpha.1
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/CHANGELOG.md +41 -0
- package/LICENSE.md +30 -0
- package/README.md +104 -2
- package/dist/chunk-BF6TR7JX.js +9 -0
- package/dist/chunk-BF6TR7JX.js.map +1 -0
- package/dist/chunk-DYBSPLCJ.cjs +11 -0
- package/dist/chunk-DYBSPLCJ.cjs.map +1 -0
- package/dist/index.cjs +3 -946
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -920
- package/dist/index.js.map +1 -1
- package/dist/mastra-deployer-UCBGECM5.js +39 -0
- package/dist/mastra-deployer-UCBGECM5.js.map +1 -0
- package/dist/mastra-deployer-YVT5GB5G.cjs +41 -0
- package/dist/mastra-deployer-YVT5GB5G.cjs.map +1 -0
- package/dist/mastra-deployer.d.ts +16 -0
- package/dist/mastra-deployer.d.ts.map +1 -0
- package/dist/plugin.d.ts +13 -15
- package/dist/plugin.d.ts.map +1 -1
- package/dist/temporal-workflow-runtime.mjs +295 -0
- package/dist/transforms/activities.d.ts +4 -3
- package/dist/transforms/activities.d.ts.map +1 -1
- package/dist/transforms/shared.d.ts +2 -7
- package/dist/transforms/shared.d.ts.map +1 -1
- package/dist/transforms/temporal-workflow-runtime.d.mts +7 -0
- package/dist/transforms/temporal-workflow-runtime.d.mts.map +1 -1
- package/dist/transforms/workflows.d.ts +3 -11
- package/dist/transforms/workflows.d.ts.map +1 -1
- package/dist/worker.cjs +1336 -0
- package/dist/worker.cjs.map +1 -0
- package/dist/worker.d.ts +2 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +1310 -0
- package/dist/worker.js.map +1 -0
- package/package.json +30 -24
- package/dist/__tests__/__fixtures__/before/index.d.ts +0 -11
- package/dist/__tests__/__fixtures__/before/index.d.ts.map +0 -1
- package/dist/__tests__/__fixtures__/before/weather-workflow.d.ts +0 -8
- package/dist/__tests__/__fixtures__/before/weather-workflow.d.ts.map +0 -1
- package/dist/transforms/__fixtures__/activities/weather-workflow/input.d.ts +0 -8
- package/dist/transforms/__fixtures__/activities/weather-workflow/input.d.ts.map +0 -1
- package/dist/transforms/__fixtures__/activities/weather-workflow/output.d.ts +0 -3
- package/dist/transforms/__fixtures__/activities/weather-workflow/output.d.ts.map +0 -1
- package/dist/transforms/__fixtures__/workflow/weather-workflow/input.d.ts +0 -8
- package/dist/transforms/__fixtures__/workflow/weather-workflow/input.d.ts.map +0 -1
- package/dist/transforms/__fixtures__/workflow/weather-workflow/output.d.ts +0 -2
- package/dist/transforms/__fixtures__/workflow/weather-workflow/output.d.ts.map +0 -1
- package/dist/webpack-loader.cjs +0 -856
- package/dist/webpack-loader.cjs.map +0 -1
- package/dist/webpack-loader.d.ts +0 -8
- package/dist/webpack-loader.d.ts.map +0 -1
- package/dist/webpack-plugin.d.ts +0 -18
- package/dist/webpack-plugin.d.ts.map +0 -1
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { executeChild, proxyActivities, log, sleep } from '@temporalio/workflow';
|
|
2
|
+
|
|
3
|
+
export class TemporalExecutionEngine {
|
|
4
|
+
startToCloseTimeout;
|
|
5
|
+
activityHandle;
|
|
6
|
+
|
|
7
|
+
constructor(params) {
|
|
8
|
+
this.startToCloseTimeout = params?.options?.startToCloseTimeout ?? '1 minute';
|
|
9
|
+
this.activityHandle = proxyActivities({ startToCloseTimeout: this.startToCloseTimeout });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async execute(params) {
|
|
13
|
+
let result = params.input;
|
|
14
|
+
const stepResults = {};
|
|
15
|
+
|
|
16
|
+
for (const entry of params.graph.steps) {
|
|
17
|
+
result = await this.executeEntry(entry, result, stepResults);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
status: 'success',
|
|
22
|
+
input: params.input,
|
|
23
|
+
result,
|
|
24
|
+
state: params.initialState,
|
|
25
|
+
steps: stepResults,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async executeEntry(entry, inputData, stepResults) {
|
|
30
|
+
switch (entry.type) {
|
|
31
|
+
case 'step': {
|
|
32
|
+
log.info('step', { stepId: entry.step.id });
|
|
33
|
+
const out = await this.activityHandle[entry.step.id]({ inputData });
|
|
34
|
+
stepResults[entry.step.id] = out;
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
case 'childWorkflow': {
|
|
39
|
+
log.info('childWorkflow', { workflowType: entry.workflowType });
|
|
40
|
+
const childResult = await executeChild(entry.workflowType, { args: [{ inputData }] });
|
|
41
|
+
const out = childResult?.result ?? childResult;
|
|
42
|
+
stepResults[entry.workflowType] = out;
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
case 'sleep': {
|
|
47
|
+
const duration = entry.duration ?? (entry.fn ? await this.activityHandle[entry.fn]({ inputData }) : 0);
|
|
48
|
+
log.info('sleep', { id: entry.id, duration });
|
|
49
|
+
await sleep(duration);
|
|
50
|
+
return inputData;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
case 'sleepUntil': {
|
|
54
|
+
const date =
|
|
55
|
+
entry.date != null
|
|
56
|
+
? new Date(entry.date)
|
|
57
|
+
: entry.fn
|
|
58
|
+
? new Date(await this.activityHandle[entry.fn]({ inputData }))
|
|
59
|
+
: new Date();
|
|
60
|
+
log.info('sleepUntil', { id: entry.id, date: date.toISOString() });
|
|
61
|
+
const duration = Math.max(0, date.getTime() - Date.now());
|
|
62
|
+
await sleep(duration);
|
|
63
|
+
return inputData;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
case 'parallel': {
|
|
67
|
+
log.info('parallel', { steps: entry.steps.map(s => s.step.id) });
|
|
68
|
+
const results = await Promise.all(entry.steps.map(s => this.activityHandle[s.step.id]({ inputData })));
|
|
69
|
+
const out = {};
|
|
70
|
+
|
|
71
|
+
entry.steps.forEach((s, i) => {
|
|
72
|
+
out[s.step.id] = results[i];
|
|
73
|
+
stepResults[s.step.id] = results[i];
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
case 'conditional': {
|
|
80
|
+
log.info('conditional', {
|
|
81
|
+
conditions: entry.serializedConditions.map(condition => condition.id),
|
|
82
|
+
});
|
|
83
|
+
const condResults = await Promise.all(
|
|
84
|
+
entry.serializedConditions.map(condition => this.activityHandle[condition.id]({ inputData })),
|
|
85
|
+
);
|
|
86
|
+
const out = {};
|
|
87
|
+
|
|
88
|
+
for (let i = 0; i < entry.steps.length; i++) {
|
|
89
|
+
if (condResults[i]) {
|
|
90
|
+
const stepId = entry.steps[i].step.id;
|
|
91
|
+
const res = await this.activityHandle[stepId]({ inputData });
|
|
92
|
+
out[stepId] = res;
|
|
93
|
+
stepResults[stepId] = res;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
case 'loop': {
|
|
101
|
+
log.info('loop', { step: entry.step.id, loopType: entry.loopType });
|
|
102
|
+
let current = inputData;
|
|
103
|
+
|
|
104
|
+
while (true) {
|
|
105
|
+
current = await this.activityHandle[entry.step.id]({ inputData: current });
|
|
106
|
+
stepResults[entry.step.id] = current;
|
|
107
|
+
const shouldContinue = Boolean(
|
|
108
|
+
await this.activityHandle[entry.serializedCondition.id]({ inputData: current }),
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
if (entry.loopType === 'dowhile' ? !shouldContinue : shouldContinue) {
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return current;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
case 'foreach': {
|
|
120
|
+
log.info('foreach', { step: entry.step.id, concurrency: entry.opts.concurrency });
|
|
121
|
+
const items = Array.isArray(inputData) ? inputData : [];
|
|
122
|
+
const concurrency = Math.max(1, entry.opts.concurrency ?? 1);
|
|
123
|
+
const results = new Array(items.length);
|
|
124
|
+
let index = 0;
|
|
125
|
+
const workers = Array.from({ length: Math.min(concurrency, items.length) }, async () => {
|
|
126
|
+
while (true) {
|
|
127
|
+
const i = index++;
|
|
128
|
+
if (i >= items.length) {
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
results[i] = await this.activityHandle[entry.step.id]({ inputData: items[i] });
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
await Promise.all(workers);
|
|
136
|
+
stepResults[entry.step.id] = results;
|
|
137
|
+
return results;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
default:
|
|
141
|
+
return inputData;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function createWorkflow(workflowId) {
|
|
147
|
+
const stepFlow = [];
|
|
148
|
+
let autoId = 0;
|
|
149
|
+
const nextId = prefix => `${prefix}_${autoId++}`;
|
|
150
|
+
|
|
151
|
+
const workflow = async startArgs => {
|
|
152
|
+
const engine = new TemporalExecutionEngine({
|
|
153
|
+
options: {
|
|
154
|
+
startToCloseTimeout: '1 minute',
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
return engine.execute({
|
|
159
|
+
workflowId,
|
|
160
|
+
runId: startArgs?.runId,
|
|
161
|
+
resourceId: startArgs?.resourceId,
|
|
162
|
+
graph: {
|
|
163
|
+
id: workflowId,
|
|
164
|
+
steps: stepFlow,
|
|
165
|
+
},
|
|
166
|
+
input: startArgs?.inputData,
|
|
167
|
+
initialState: startArgs?.initialState,
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
return Object.assign(workflow, {
|
|
172
|
+
then(stepId) {
|
|
173
|
+
stepFlow.push({
|
|
174
|
+
type: 'step',
|
|
175
|
+
step: {
|
|
176
|
+
id: stepId,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
return workflow;
|
|
180
|
+
},
|
|
181
|
+
thenWorkflow(workflowType) {
|
|
182
|
+
stepFlow.push({
|
|
183
|
+
type: 'childWorkflow',
|
|
184
|
+
workflowType,
|
|
185
|
+
});
|
|
186
|
+
return workflow;
|
|
187
|
+
},
|
|
188
|
+
sleep(durationOrFnId) {
|
|
189
|
+
if (typeof durationOrFnId === 'number') {
|
|
190
|
+
stepFlow.push({
|
|
191
|
+
type: 'sleep',
|
|
192
|
+
id: nextId('sleep'),
|
|
193
|
+
duration: durationOrFnId,
|
|
194
|
+
});
|
|
195
|
+
} else {
|
|
196
|
+
stepFlow.push({
|
|
197
|
+
type: 'sleep',
|
|
198
|
+
id: nextId('sleep'),
|
|
199
|
+
fn: durationOrFnId,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return workflow;
|
|
203
|
+
},
|
|
204
|
+
sleepUntil(dateOrFnId) {
|
|
205
|
+
if (dateOrFnId instanceof Date) {
|
|
206
|
+
stepFlow.push({
|
|
207
|
+
type: 'sleepUntil',
|
|
208
|
+
id: nextId('sleepUntil'),
|
|
209
|
+
date: dateOrFnId.toISOString(),
|
|
210
|
+
});
|
|
211
|
+
} else if (typeof dateOrFnId === 'number' || (typeof dateOrFnId === 'string' && !isNaN(Date.parse(dateOrFnId)))) {
|
|
212
|
+
stepFlow.push({
|
|
213
|
+
type: 'sleepUntil',
|
|
214
|
+
id: nextId('sleepUntil'),
|
|
215
|
+
date: new Date(dateOrFnId).toISOString(),
|
|
216
|
+
});
|
|
217
|
+
} else {
|
|
218
|
+
stepFlow.push({
|
|
219
|
+
type: 'sleepUntil',
|
|
220
|
+
id: nextId('sleepUntil'),
|
|
221
|
+
fn: dateOrFnId,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return workflow;
|
|
225
|
+
},
|
|
226
|
+
parallel(stepIds) {
|
|
227
|
+
stepFlow.push({
|
|
228
|
+
type: 'parallel',
|
|
229
|
+
steps: stepIds.map(id => ({
|
|
230
|
+
type: 'step',
|
|
231
|
+
step: {
|
|
232
|
+
id,
|
|
233
|
+
},
|
|
234
|
+
})),
|
|
235
|
+
});
|
|
236
|
+
return workflow;
|
|
237
|
+
},
|
|
238
|
+
branch(pairs) {
|
|
239
|
+
stepFlow.push({
|
|
240
|
+
type: 'conditional',
|
|
241
|
+
serializedConditions: pairs.map(pair => ({
|
|
242
|
+
id: pair[0],
|
|
243
|
+
})),
|
|
244
|
+
steps: pairs.map(pair => ({
|
|
245
|
+
type: 'step',
|
|
246
|
+
step: {
|
|
247
|
+
id: pair[1],
|
|
248
|
+
},
|
|
249
|
+
})),
|
|
250
|
+
});
|
|
251
|
+
return workflow;
|
|
252
|
+
},
|
|
253
|
+
dowhile(stepId, condId) {
|
|
254
|
+
stepFlow.push({
|
|
255
|
+
type: 'loop',
|
|
256
|
+
step: {
|
|
257
|
+
id: stepId,
|
|
258
|
+
},
|
|
259
|
+
serializedCondition: {
|
|
260
|
+
id: condId,
|
|
261
|
+
},
|
|
262
|
+
loopType: 'dowhile',
|
|
263
|
+
});
|
|
264
|
+
return workflow;
|
|
265
|
+
},
|
|
266
|
+
dountil(stepId, condId) {
|
|
267
|
+
stepFlow.push({
|
|
268
|
+
type: 'loop',
|
|
269
|
+
step: {
|
|
270
|
+
id: stepId,
|
|
271
|
+
},
|
|
272
|
+
serializedCondition: {
|
|
273
|
+
id: condId,
|
|
274
|
+
},
|
|
275
|
+
loopType: 'dountil',
|
|
276
|
+
});
|
|
277
|
+
return workflow;
|
|
278
|
+
},
|
|
279
|
+
foreach(stepId, opts) {
|
|
280
|
+
stepFlow.push({
|
|
281
|
+
type: 'foreach',
|
|
282
|
+
step: {
|
|
283
|
+
id: stepId,
|
|
284
|
+
},
|
|
285
|
+
opts: {
|
|
286
|
+
concurrency: opts?.concurrency ?? 1,
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
return workflow;
|
|
290
|
+
},
|
|
291
|
+
commit() {
|
|
292
|
+
return workflow;
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
}
|
|
@@ -2,9 +2,10 @@ export interface TemporalActivityBinding {
|
|
|
2
2
|
exportName: string;
|
|
3
3
|
stepId: string;
|
|
4
4
|
}
|
|
5
|
-
export interface
|
|
6
|
-
|
|
5
|
+
export interface BuildTemporalActivitiesModuleResult {
|
|
6
|
+
outputPath: string;
|
|
7
|
+
activityBindings: TemporalActivityBinding[];
|
|
7
8
|
}
|
|
8
9
|
export declare function collectTemporalActivityBindings(sourceText: string, filePath: string): TemporalActivityBinding[];
|
|
9
|
-
export declare function buildTemporalActivitiesModule(
|
|
10
|
+
export declare function buildTemporalActivitiesModule(entryFile: string, outputDirectory: string, outputFileName: string): Promise<BuildTemporalActivitiesModuleResult>;
|
|
10
11
|
//# sourceMappingURL=activities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activities.d.ts","sourceRoot":"","sources":["../../src/transforms/activities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"activities.d.ts","sourceRoot":"","sources":["../../src/transforms/activities.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mCAAmC;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,uBAAuB,EAAE,CAAC;CAC7C;AAED,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAkE/G;AA6HD,wBAAsB,6BAA6B,CACjD,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,mCAAmC,CAAC,CA0T9C"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as t from '@babel/types';
|
|
2
2
|
export declare const parserPlugins: readonly ["typescript", "jsx", "classProperties", "classPrivateProperties", "classPrivateMethods", "topLevelAwait", "importAttributes", "decorators-legacy"];
|
|
3
|
-
export
|
|
4
|
-
exportName: string;
|
|
5
|
-
importedName: string | 'default';
|
|
6
|
-
source: string;
|
|
7
|
-
}
|
|
3
|
+
export declare function parseModule(filePath: string, sourceText?: string): t.File;
|
|
8
4
|
export declare function isIdentifierNamed(node: t.Node, name: string): boolean;
|
|
9
5
|
export declare function isTemporalHelperModule(source: string): boolean;
|
|
10
6
|
export declare const strippedExternalModules: Set<string>;
|
|
@@ -19,8 +15,7 @@ export declare function walk(node: t.Node | null | undefined, visitor: (node: t.
|
|
|
19
15
|
export declare function hasCreateWorkflowCall(node: t.Node): boolean;
|
|
20
16
|
export declare function getStepNameFromCall(node: t.CallExpression): string | null;
|
|
21
17
|
export declare function createExportedStepStatement(name: string, initializer: t.Expression): t.ExportNamedDeclaration;
|
|
22
|
-
export declare function collectInlineCreateSteps(node: t.Node, seenNames: Set<string>, statements: t.Statement[]): void;
|
|
23
|
-
export declare function transpileModule(sourceText: string, filePath: string): Promise<string>;
|
|
18
|
+
export declare function collectInlineCreateSteps(node: t.Node, seenNames: Set<string>, statements: t.Statement[], onStep?: (exportName: string, call: t.CallExpression) => void): void;
|
|
24
19
|
export declare function getCreateStepId(node: t.Node | null | undefined): string | null;
|
|
25
20
|
export declare function shouldCountIdentifierAsReference(parent: t.Node | null, key: string | null): boolean;
|
|
26
21
|
export declare function collectRuntimeReferencedIdentifiers(node: t.Node): Set<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/transforms/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/transforms/shared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,eAAO,MAAM,aAAa,8JAShB,CAAC;AACX,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,CAUzE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAErE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,eAAO,MAAM,uBAAuB,aAA2D,CAAC;AAEhG,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,CAAC,CAAC,iBAAiB,GAAG,GAAG,CAAC,MAAM,CAAC,CAgBhF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAW5E;AAED,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,CAAC,CAAC,kBAAkB,GAAG,OAAO,CAYtF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,cAAc,CAE3E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,cAAc,CAEvE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC,YAAY,GAAG,MAAM,GAAG,IAAI,CAchG;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,KAAK,GAAG,IAAI,GAAG,IAAI,CA2BnG;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,OAAO,CAW3D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,CAAC,CAAC,cAAc,GAAG,MAAM,GAAG,IAAI,CAUzE;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,sBAAsB,CAI7G;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,CAAC,CAAC,IAAI,EACZ,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,EACtB,UAAU,EAAE,CAAC,CAAC,SAAS,EAAE,EACzB,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,cAAc,KAAK,IAAI,GAC5D,IAAI,CAgBN;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAwB9E;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CA+DnG;AAED,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,CAsC7E;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,CA4IpF"}
|
|
@@ -12,6 +12,13 @@ export function createWorkflow(workflowId: any): ((startArgs: any) => Promise<{
|
|
|
12
12
|
state: any;
|
|
13
13
|
steps: {};
|
|
14
14
|
}>;
|
|
15
|
+
thenWorkflow(workflowType: any): (startArgs: any) => Promise<{
|
|
16
|
+
status: string;
|
|
17
|
+
input: any;
|
|
18
|
+
result: any;
|
|
19
|
+
state: any;
|
|
20
|
+
steps: {};
|
|
21
|
+
}>;
|
|
15
22
|
sleep(durationOrFnId: any): (startArgs: any) => Promise<{
|
|
16
23
|
status: string;
|
|
17
24
|
input: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temporal-workflow-runtime.d.mts","sourceRoot":"","sources":["../../src/transforms/temporal-workflow-runtime.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"temporal-workflow-runtime.d.mts","sourceRoot":"","sources":["../../src/transforms/temporal-workflow-runtime.mjs"],"names":[],"mappings":"AAiJA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqJC;AApSD;IAIE,yBAGC;IAND,yBAAoB;IACpB,sHAAe;IAOf;;;;;;OAeC;IAED,yEAkHC;CACF"}
|
|
@@ -8,21 +8,13 @@ export interface BuildTemporalWorkflowModuleResult {
|
|
|
8
8
|
code: string;
|
|
9
9
|
workflows: TemporalWorkflowExport[];
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Rewrites the Mastra entry file into pure re-exports after every workflow module has
|
|
13
|
-
* been transformed and registered. This is why the entry rewrite lives outside the
|
|
14
|
-
* loader's per-file transform path.
|
|
15
|
-
*/
|
|
16
|
-
export declare function buildWorkflowEntryModuleFromRegistry(sourceText: string, filePath: string, registry: Map<string, string[]>): Promise<string>;
|
|
17
11
|
/**
|
|
18
12
|
* Transforms a user-authored workflow module into a Temporal-friendly module:
|
|
19
13
|
* - strips Mastra/Temporal setup that cannot run in the workflow sandbox
|
|
20
14
|
* - rewrites fluent workflow chains into deterministic exported functions
|
|
21
15
|
* - returns registry metadata so the entry module can re-export the right names
|
|
22
16
|
*/
|
|
23
|
-
export declare function buildTemporalWorkflowModule(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export declare function resolveWorkflowEntriesSync(sourceText: string, filePath: string): string[];
|
|
27
|
-
export declare function resolveWorkflowEntries(sourceText: string, filePath: string): Promise<string[]>;
|
|
17
|
+
export declare function buildTemporalWorkflowModule(entryFile: string, outputDirectory: string, outputFileName: string): Promise<{
|
|
18
|
+
outputPath: string;
|
|
19
|
+
}>;
|
|
28
20
|
//# sourceMappingURL=workflows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/transforms/workflows.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/transforms/workflows.ts"],"names":[],"mappings":"AAsYA,MAAM,WAAW,4BAA4B;CAE5C;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,sBAAsB,EAAE,CAAC;CACrC;AAiUD;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAwCjC"}
|