@alineo-labs/workflow 0.1.0 → 0.1.2
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/index.d.mts +5 -5
- package/dist/index.mjs +7 -5
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExecCodeOptions, ExecOptions, Sandbox, SandboxOptions } from "@alineo-labs/sandbox";
|
|
2
2
|
|
|
3
3
|
//#region src/sandbox-builder.d.ts
|
|
4
4
|
/** An operation queued on a SandboxBuilder and executed later. */
|
|
@@ -145,7 +145,7 @@ interface SequenceStep {
|
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
147
|
* Lazy workflow builder. Collects stages and executes them all when `.pipe()` or
|
|
148
|
-
* `.result()` is awaited. Sandboxes are created via the `
|
|
148
|
+
* `.result()` is awaited. Sandboxes are created via the `Sandbox` client internally
|
|
149
149
|
* — the user never manages sandbox lifecycle when using this layer.
|
|
150
150
|
*
|
|
151
151
|
* @example
|
|
@@ -164,7 +164,7 @@ interface SequenceStep {
|
|
|
164
164
|
declare class WorkflowBuilder {
|
|
165
165
|
private readonly _client;
|
|
166
166
|
private readonly _stages;
|
|
167
|
-
constructor(client:
|
|
167
|
+
constructor(client: Sandbox);
|
|
168
168
|
/**
|
|
169
169
|
* Add a sandbox stage. The `fn` callback receives a `SandboxBuilder` to
|
|
170
170
|
* queue operations synchronously. Sandboxes across multiple `.sandbox()` calls
|
|
@@ -212,7 +212,7 @@ declare class WorkflowBuilder {
|
|
|
212
212
|
private _runSequence;
|
|
213
213
|
}
|
|
214
214
|
/**
|
|
215
|
-
* Create a workflow builder attached to a `
|
|
215
|
+
* Create a workflow builder attached to a `Sandbox` client.
|
|
216
216
|
*
|
|
217
217
|
* @example
|
|
218
218
|
* ```ts
|
|
@@ -226,6 +226,6 @@ declare class WorkflowBuilder {
|
|
|
226
226
|
* .pipe(process.stdout);
|
|
227
227
|
* ```
|
|
228
228
|
*/
|
|
229
|
-
declare function workflow(client:
|
|
229
|
+
declare function workflow(client: Sandbox): WorkflowBuilder;
|
|
230
230
|
//#endregion
|
|
231
231
|
export { type ForEachOptions, type RetryOptions, SandboxBuilder, type SandboxOp, type SequenceStep, type WhenPredicate, WorkflowBuilder, type WorkflowResult, workflow };
|
package/dist/index.mjs
CHANGED
|
@@ -140,7 +140,7 @@ var SandboxBuilder = class {
|
|
|
140
140
|
return this;
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
|
-
/** Flush a SandboxBuilder's op queue against a live
|
|
143
|
+
/** Flush a SandboxBuilder's op queue against a live SandboxHandle. */
|
|
144
144
|
async function flushOps(sandbox, ops, ctx) {
|
|
145
145
|
for (const op of ops) switch (op.kind) {
|
|
146
146
|
case "exec": {
|
|
@@ -251,7 +251,7 @@ async function flushForEach(sandbox, items, fn, opts, ctx) {
|
|
|
251
251
|
//#region src/workflow-builder.ts
|
|
252
252
|
/**
|
|
253
253
|
* Lazy workflow builder. Collects stages and executes them all when `.pipe()` or
|
|
254
|
-
* `.result()` is awaited. Sandboxes are created via the `
|
|
254
|
+
* `.result()` is awaited. Sandboxes are created via the `Sandbox` client internally
|
|
255
255
|
* — the user never manages sandbox lifecycle when using this layer.
|
|
256
256
|
*
|
|
257
257
|
* @example
|
|
@@ -351,7 +351,7 @@ var WorkflowBuilder = class {
|
|
|
351
351
|
combined.stdout += r.stdout;
|
|
352
352
|
Object.assign(combined.vars, r.vars);
|
|
353
353
|
}
|
|
354
|
-
} else
|
|
354
|
+
} else {
|
|
355
355
|
const result = await this._runSequence(stage.steps, sink);
|
|
356
356
|
combined.stdout += result.stdout;
|
|
357
357
|
Object.assign(combined.vars, result.vars);
|
|
@@ -395,7 +395,9 @@ var WorkflowBuilder = class {
|
|
|
395
395
|
timeout: step.timeout,
|
|
396
396
|
name: step.name
|
|
397
397
|
};
|
|
398
|
-
const result = await this._runSandbox(opts, (sb) =>
|
|
398
|
+
const result = await this._runSandbox(opts, (sb) => {
|
|
399
|
+
step.run(sb, prev);
|
|
400
|
+
}, sink);
|
|
399
401
|
combined.stdout += result.stdout;
|
|
400
402
|
Object.assign(combined.vars, result.vars);
|
|
401
403
|
prev = result;
|
|
@@ -404,7 +406,7 @@ var WorkflowBuilder = class {
|
|
|
404
406
|
}
|
|
405
407
|
};
|
|
406
408
|
/**
|
|
407
|
-
* Create a workflow builder attached to a `
|
|
409
|
+
* Create a workflow builder attached to a `Sandbox` client.
|
|
408
410
|
*
|
|
409
411
|
* @example
|
|
410
412
|
* ```ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alineo-labs/workflow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test:watch": "vitest"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"alineo": "0.
|
|
32
|
+
"@alineo-labs/sandbox": "0.3.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"bun-types": "1.3.14",
|