blazen 0.1.96 → 0.1.97
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/README.md +280 -117
- package/index.js +52 -52
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://nodejs.org/)
|
|
5
5
|
[](https://opensource.org/licenses/AGPL-3.0)
|
|
6
6
|
|
|
7
|
-
Event-driven AI workflow engine for Node.js, powered by a Rust core via napi-rs.
|
|
7
|
+
Event-driven AI workflow engine for Node.js and TypeScript, powered by a Rust core via napi-rs. Define workflows as a graph of async steps connected by typed events. Built-in LLM integration, streaming, pause/resume, and fan-out.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -16,248 +16,411 @@ pnpm add blazen
|
|
|
16
16
|
npm install blazen
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
No native compilation required -- prebuilt binaries are provided for Linux (x86_64, aarch64) and macOS (x86_64, Apple Silicon).
|
|
20
|
+
|
|
19
21
|
---
|
|
20
22
|
|
|
21
23
|
## Quick Start
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
A workflow is a directed graph of **steps**. Each step listens for one or more event types and returns the next event. The reserved types `"blazen::StartEvent"` and `"blazen::StopEvent"` mark the entry and exit points.
|
|
26
|
+
|
|
27
|
+
Events are plain objects with a `type` field. All other fields are your data.
|
|
24
28
|
|
|
25
29
|
```typescript
|
|
26
|
-
import { Workflow } from "blazen";
|
|
30
|
+
import { Workflow, Context } from "blazen";
|
|
31
|
+
import type { JsWorkflowResult } from "blazen";
|
|
32
|
+
|
|
33
|
+
const wf = new Workflow("hello");
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
wf.addStep("parse", ["blazen::StartEvent"], async (event: Record<string, any>, ctx: Context) => {
|
|
36
|
+
return { type: "GreetEvent", name: event.name || "World" };
|
|
37
|
+
});
|
|
29
38
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
await ctx.set("greeted", name);
|
|
33
|
-
return { type: "blazen::StopEvent", result: `Hello, ${name}!` };
|
|
39
|
+
wf.addStep("greet", ["GreetEvent"], async (event: Record<string, any>, ctx: Context) => {
|
|
40
|
+
return { type: "blazen::StopEvent", result: { greeting: `Hello, ${event.name}!` } };
|
|
34
41
|
});
|
|
35
42
|
|
|
36
|
-
const result = await
|
|
37
|
-
console.log(result.
|
|
43
|
+
const result: JsWorkflowResult = await wf.run({ name: "Blazen" });
|
|
44
|
+
console.log(result.type); // "blazen::StopEvent"
|
|
45
|
+
console.log(result.data); // { greeting: "Hello, Blazen!" }
|
|
38
46
|
```
|
|
39
47
|
|
|
48
|
+
**Key concepts:**
|
|
49
|
+
|
|
50
|
+
- `addStep(name, eventTypes, handler)` -- `eventTypes` is a `string[]` of event types this step handles.
|
|
51
|
+
- The handler receives `(event, ctx)` and returns the next event object, an array of events, or `null`.
|
|
52
|
+
- `result.type` is the final event type (typically `"blazen::StopEvent"`).
|
|
53
|
+
- `result.data` is the payload you passed as `result` inside the `StopEvent`.
|
|
54
|
+
|
|
40
55
|
---
|
|
41
56
|
|
|
42
57
|
## Multi-Step Workflows
|
|
43
58
|
|
|
44
|
-
Steps communicate by emitting events. Any step whose `eventTypes` list includes a given event type will be invoked when that event
|
|
59
|
+
Steps communicate by emitting custom events. Any step whose `eventTypes` list includes a given event type will be invoked when that event fires.
|
|
45
60
|
|
|
46
61
|
```typescript
|
|
47
62
|
import { Workflow } from "blazen";
|
|
48
63
|
|
|
49
|
-
const
|
|
64
|
+
const wf = new Workflow("pipeline");
|
|
50
65
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
wf.addStep("extract", ["blazen::StartEvent"], async (event, ctx) => {
|
|
67
|
+
const raw = event.text;
|
|
68
|
+
await ctx.set("raw", raw);
|
|
69
|
+
return { type: "CleanEvent", text: raw.trim().toLowerCase() };
|
|
54
70
|
});
|
|
55
71
|
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
return { type: "blazen::StopEvent", result: summary };
|
|
72
|
+
wf.addStep("analyze", ["CleanEvent"], async (event, ctx) => {
|
|
73
|
+
const wordCount = event.text.split(/\s+/).length;
|
|
74
|
+
return { type: "SummarizeEvent", text: event.text, wordCount };
|
|
60
75
|
});
|
|
61
76
|
|
|
62
|
-
|
|
77
|
+
wf.addStep("summarize", ["SummarizeEvent"], async (event, ctx) => {
|
|
78
|
+
const raw = await ctx.get("raw");
|
|
79
|
+
return {
|
|
80
|
+
type: "blazen::StopEvent",
|
|
81
|
+
result: {
|
|
82
|
+
original: raw,
|
|
83
|
+
cleaned: event.text,
|
|
84
|
+
wordCount: event.wordCount,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const result = await wf.run({ text: " Hello World " });
|
|
63
90
|
console.log(result.data);
|
|
91
|
+
// { original: " Hello World ", cleaned: "hello world", wordCount: 2 }
|
|
64
92
|
```
|
|
65
93
|
|
|
66
94
|
---
|
|
67
95
|
|
|
96
|
+
## Event Streaming
|
|
97
|
+
|
|
98
|
+
Steps can push intermediate events to external consumers via `ctx.writeEventToStream()`. Use `runStreaming(input, callback)` to receive them as they arrive.
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { Workflow } from "blazen";
|
|
102
|
+
|
|
103
|
+
const wf = new Workflow("streaming");
|
|
104
|
+
|
|
105
|
+
wf.addStep("process", ["blazen::StartEvent"], async (event, ctx) => {
|
|
106
|
+
await ctx.writeEventToStream({ type: "Progress", message: "Starting..." });
|
|
107
|
+
|
|
108
|
+
// ... do work ...
|
|
109
|
+
|
|
110
|
+
await ctx.writeEventToStream({ type: "Progress", message: "Halfway done." });
|
|
111
|
+
|
|
112
|
+
// ... more work ...
|
|
113
|
+
|
|
114
|
+
await ctx.writeEventToStream({ type: "Progress", message: "Complete." });
|
|
115
|
+
|
|
116
|
+
return { type: "blazen::StopEvent", result: { status: "done" } };
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const result = await wf.runStreaming({}, (event) => {
|
|
120
|
+
// Called for every event published via ctx.writeEventToStream()
|
|
121
|
+
console.log(`[stream] ${event.type}: ${event.message}`);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
console.log(result.data); // { status: "done" }
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`writeEventToStream` publishes to external consumers only. It does **not** route events through the internal step registry. Use `ctx.sendEvent()` for internal routing.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
68
131
|
## LLM Integration
|
|
69
132
|
|
|
70
|
-
`CompletionModel` provides a unified interface to
|
|
133
|
+
`CompletionModel` provides a unified interface to 15 LLM providers. Create a model instance with a static factory method and call `complete()` or `completeWithOptions()`.
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { CompletionModel } from "blazen";
|
|
137
|
+
|
|
138
|
+
const model = CompletionModel.openrouter(process.env.OPENROUTER_API_KEY!);
|
|
139
|
+
|
|
140
|
+
const response = await model.complete([
|
|
141
|
+
{ role: "system", content: "You are helpful." },
|
|
142
|
+
{ role: "user", content: "What is 2+2?" },
|
|
143
|
+
]);
|
|
144
|
+
|
|
145
|
+
console.log(response.content); // "4"
|
|
146
|
+
console.log(response.model); // model name used
|
|
147
|
+
console.log(response.usage); // { promptTokens, completionTokens, totalTokens }
|
|
148
|
+
console.log(response.finishReason);
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Advanced Options
|
|
152
|
+
|
|
153
|
+
Use `completeWithOptions` to control temperature, token limits, model selection, and tool definitions:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
const response = await model.completeWithOptions(
|
|
157
|
+
[
|
|
158
|
+
{ role: "system", content: "You are a creative writer." },
|
|
159
|
+
{ role: "user", content: "Write a haiku about Rust." },
|
|
160
|
+
],
|
|
161
|
+
{
|
|
162
|
+
temperature: 0.9,
|
|
163
|
+
maxTokens: 256,
|
|
164
|
+
topP: 0.95,
|
|
165
|
+
model: "anthropic/claude-sonnet-4-20250514",
|
|
166
|
+
tools: [/* tool definitions */],
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### All 15 Providers
|
|
172
|
+
|
|
173
|
+
| Factory Method | Provider |
|
|
174
|
+
|---|---|
|
|
175
|
+
| `CompletionModel.openai(apiKey)` | OpenAI |
|
|
176
|
+
| `CompletionModel.anthropic(apiKey)` | Anthropic |
|
|
177
|
+
| `CompletionModel.gemini(apiKey)` | Google Gemini |
|
|
178
|
+
| `CompletionModel.azure(apiKey, resourceName, deploymentName)` | Azure OpenAI |
|
|
179
|
+
| `CompletionModel.openrouter(apiKey)` | OpenRouter |
|
|
180
|
+
| `CompletionModel.groq(apiKey)` | Groq |
|
|
181
|
+
| `CompletionModel.together(apiKey)` | Together AI |
|
|
182
|
+
| `CompletionModel.mistral(apiKey)` | Mistral AI |
|
|
183
|
+
| `CompletionModel.deepseek(apiKey)` | DeepSeek |
|
|
184
|
+
| `CompletionModel.fireworks(apiKey)` | Fireworks AI |
|
|
185
|
+
| `CompletionModel.perplexity(apiKey)` | Perplexity |
|
|
186
|
+
| `CompletionModel.xai(apiKey)` | xAI / Grok |
|
|
187
|
+
| `CompletionModel.cohere(apiKey)` | Cohere |
|
|
188
|
+
| `CompletionModel.bedrock(apiKey, region)` | AWS Bedrock |
|
|
189
|
+
| `CompletionModel.fal(apiKey)` | fal.ai |
|
|
190
|
+
|
|
191
|
+
### Using LLMs Inside Workflows
|
|
71
192
|
|
|
72
193
|
```typescript
|
|
73
194
|
import { Workflow, CompletionModel } from "blazen";
|
|
74
195
|
|
|
75
196
|
const model = CompletionModel.openai(process.env.OPENAI_API_KEY!);
|
|
76
197
|
|
|
77
|
-
const
|
|
198
|
+
const wf = new Workflow("llm-workflow");
|
|
78
199
|
|
|
79
|
-
|
|
200
|
+
wf.addStep("ask", ["blazen::StartEvent"], async (event, ctx) => {
|
|
80
201
|
const response = await model.complete([
|
|
81
202
|
{ role: "system", content: "You are a helpful assistant." },
|
|
82
203
|
{ role: "user", content: event.question },
|
|
83
204
|
]);
|
|
84
|
-
|
|
85
|
-
return { type: "blazen::StopEvent", result: response.content };
|
|
205
|
+
return { type: "blazen::StopEvent", result: { answer: response.content } };
|
|
86
206
|
});
|
|
87
207
|
|
|
88
|
-
const result = await
|
|
89
|
-
console.log(result.data);
|
|
208
|
+
const result = await wf.run({ question: "What is the capital of France?" });
|
|
209
|
+
console.log(result.data.answer);
|
|
90
210
|
```
|
|
91
211
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
| `CompletionModel.anthropic(apiKey)` | Anthropic |
|
|
98
|
-
| `CompletionModel.gemini(apiKey)` | Google Gemini |
|
|
99
|
-
| `CompletionModel.azure(apiKey, resource, deploy)` | Azure OpenAI |
|
|
100
|
-
| `CompletionModel.openrouter(apiKey)` | OpenRouter |
|
|
101
|
-
| `CompletionModel.groq(apiKey)` | Groq |
|
|
102
|
-
| `CompletionModel.together(apiKey)` | Together AI |
|
|
103
|
-
| `CompletionModel.mistral(apiKey)` | Mistral AI |
|
|
104
|
-
| `CompletionModel.deepseek(apiKey)` | DeepSeek |
|
|
105
|
-
| `CompletionModel.fireworks(apiKey)` | Fireworks AI |
|
|
106
|
-
| `CompletionModel.perplexity(apiKey)` | Perplexity |
|
|
107
|
-
| `CompletionModel.xai(apiKey)` | xAI / Grok |
|
|
108
|
-
| `CompletionModel.cohere(apiKey)` | Cohere |
|
|
109
|
-
| `CompletionModel.bedrock(apiKey, region)` | AWS Bedrock |
|
|
110
|
-
| `CompletionModel.fal(apiKey)` | fal.ai |
|
|
111
|
-
|
|
112
|
-
You can also pass additional options such as `temperature`, `maxTokens`, `topP`, a model override, or tool definitions:
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Branching / Fan-Out
|
|
215
|
+
|
|
216
|
+
Return an array of events from a step handler to dispatch multiple events simultaneously. Each event routes to the step that handles its type.
|
|
113
217
|
|
|
114
218
|
```typescript
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
219
|
+
import { Workflow } from "blazen";
|
|
220
|
+
|
|
221
|
+
const wf = new Workflow("fan-out");
|
|
222
|
+
|
|
223
|
+
wf.addStep("split", ["blazen::StartEvent"], async (event, ctx) => {
|
|
224
|
+
// Return an array to fan out into parallel branches
|
|
225
|
+
return [
|
|
226
|
+
{ type: "BranchA", value: event.input },
|
|
227
|
+
{ type: "BranchB", value: event.input },
|
|
228
|
+
];
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
wf.addStep("handle_a", ["BranchA"], async (event, ctx) => {
|
|
232
|
+
return { type: "blazen::StopEvent", result: { branch: "a", value: event.value } };
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
wf.addStep("handle_b", ["BranchB"], async (event, ctx) => {
|
|
236
|
+
return { type: "blazen::StopEvent", result: { branch: "b", value: event.value } };
|
|
119
237
|
});
|
|
238
|
+
|
|
239
|
+
const result = await wf.run({ input: "data" });
|
|
240
|
+
// The first branch to produce a StopEvent wins
|
|
241
|
+
console.log(result.data);
|
|
120
242
|
```
|
|
121
243
|
|
|
122
244
|
---
|
|
123
245
|
|
|
124
|
-
##
|
|
246
|
+
## Side-Effect Steps
|
|
125
247
|
|
|
126
|
-
|
|
248
|
+
Return `null` from a step to perform side effects without emitting a return event. Use `ctx.sendEvent()` to manually route the next event through the internal step registry.
|
|
127
249
|
|
|
128
250
|
```typescript
|
|
129
|
-
import { Workflow
|
|
251
|
+
import { Workflow } from "blazen";
|
|
130
252
|
|
|
131
|
-
const
|
|
253
|
+
const wf = new Workflow("side-effect");
|
|
132
254
|
|
|
133
|
-
|
|
255
|
+
wf.addStep("log_and_continue", ["blazen::StartEvent"], async (event, ctx) => {
|
|
256
|
+
// Perform side effects
|
|
257
|
+
await ctx.set("processed", true);
|
|
134
258
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
await ctx.writeEventToStream({ type: "progress", message: "Starting..." });
|
|
259
|
+
// Manually send the next event
|
|
260
|
+
await ctx.sendEvent({ type: "NextStep", data: event.input });
|
|
138
261
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
]);
|
|
142
|
-
|
|
143
|
-
await ctx.writeEventToStream({ type: "progress", message: "Done." });
|
|
144
|
-
|
|
145
|
-
return { type: "blazen::StopEvent", result: response.content };
|
|
262
|
+
// Return null -- no event emitted from the return value
|
|
263
|
+
return null;
|
|
146
264
|
});
|
|
147
265
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
console.log("[stream]", event);
|
|
153
|
-
}
|
|
154
|
-
);
|
|
266
|
+
wf.addStep("finish", ["NextStep"], async (event, ctx) => {
|
|
267
|
+
const processed = await ctx.get("processed");
|
|
268
|
+
return { type: "blazen::StopEvent", result: { processed, data: event.data } };
|
|
269
|
+
});
|
|
155
270
|
|
|
156
|
-
|
|
271
|
+
const result = await wf.run({ input: "hello" });
|
|
272
|
+
console.log(result.data); // { processed: true, data: "hello" }
|
|
157
273
|
```
|
|
158
274
|
|
|
159
275
|
---
|
|
160
276
|
|
|
161
277
|
## Pause and Resume
|
|
162
278
|
|
|
163
|
-
`runWithHandler`
|
|
279
|
+
`runWithHandler` returns a `WorkflowHandler` that gives you control over execution. Pause a workflow to serialize its full state as a JSON string, then resume it later -- even on a different machine.
|
|
164
280
|
|
|
165
281
|
```typescript
|
|
166
282
|
import { Workflow } from "blazen";
|
|
167
283
|
import { writeFileSync, readFileSync } from "fs";
|
|
168
284
|
|
|
169
|
-
const
|
|
285
|
+
const wf = new Workflow("pausable");
|
|
170
286
|
|
|
171
|
-
|
|
172
|
-
// ... expensive
|
|
173
|
-
return { type: "blazen::StopEvent", result:
|
|
287
|
+
wf.addStep("work", ["blazen::StartEvent"], async (event, ctx) => {
|
|
288
|
+
// ... expensive computation ...
|
|
289
|
+
return { type: "blazen::StopEvent", result: { answer: 42 } };
|
|
174
290
|
});
|
|
175
291
|
|
|
176
|
-
// Start the workflow and
|
|
177
|
-
const handler = await
|
|
292
|
+
// Start the workflow and get a handler
|
|
293
|
+
const handler = await wf.runWithHandler({ input: "data" });
|
|
294
|
+
|
|
295
|
+
// Pause and serialize the snapshot
|
|
178
296
|
const snapshot = await handler.pause();
|
|
179
297
|
writeFileSync("snapshot.json", snapshot);
|
|
180
298
|
|
|
181
|
-
// Later:
|
|
182
|
-
const
|
|
183
|
-
const resumedHandler = await
|
|
299
|
+
// Later: resume from the snapshot
|
|
300
|
+
const saved = readFileSync("snapshot.json", "utf-8");
|
|
301
|
+
const resumedHandler = await wf.resume(saved);
|
|
184
302
|
const result = await resumedHandler.result();
|
|
185
|
-
console.log(result.data);
|
|
303
|
+
console.log(result.data); // { answer: 42 }
|
|
186
304
|
```
|
|
187
305
|
|
|
188
|
-
|
|
306
|
+
**Important:** `handler.result()` and `handler.pause()` each consume the handler. You can only call one of them, and only once.
|
|
189
307
|
|
|
190
|
-
|
|
308
|
+
### Human-in-the-Loop
|
|
191
309
|
|
|
192
|
-
Pause/resume is the foundation for human-in-the-loop workflows. Pause after a step
|
|
310
|
+
Pause/resume is the foundation for human-in-the-loop workflows. Pause after a step to wait for human review, then resume when approved:
|
|
193
311
|
|
|
194
312
|
```typescript
|
|
195
|
-
const handler = await
|
|
313
|
+
const handler = await wf.runWithHandler({ document: rawText });
|
|
196
314
|
|
|
197
|
-
// Pause and persist
|
|
315
|
+
// Pause and persist until a human reviews
|
|
198
316
|
const snapshot = await handler.pause();
|
|
199
317
|
await db.saveSnapshot(jobId, snapshot);
|
|
200
318
|
|
|
201
|
-
// ... human reviews
|
|
319
|
+
// ... human reviews via UI ...
|
|
202
320
|
|
|
203
|
-
// Resume
|
|
204
|
-
const
|
|
205
|
-
const resumedHandler = await
|
|
321
|
+
// Resume
|
|
322
|
+
const saved = await db.loadSnapshot(jobId);
|
|
323
|
+
const resumedHandler = await wf.resume(saved);
|
|
206
324
|
const result = await resumedHandler.result();
|
|
207
325
|
```
|
|
208
326
|
|
|
327
|
+
### Streaming with Handler
|
|
328
|
+
|
|
329
|
+
Use `handler.streamEvents()` to subscribe to intermediate events before calling `result()`:
|
|
330
|
+
|
|
331
|
+
```typescript
|
|
332
|
+
const handler = await wf.runWithHandler({ prompt: "Tell me a story." });
|
|
333
|
+
|
|
334
|
+
// Subscribe to stream events (must be called before result() or pause())
|
|
335
|
+
await handler.streamEvents((event) => {
|
|
336
|
+
console.log("[stream]", event);
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
// Then await the final result
|
|
340
|
+
const result = await handler.result();
|
|
341
|
+
```
|
|
342
|
+
|
|
209
343
|
---
|
|
210
344
|
|
|
211
345
|
## Context API
|
|
212
346
|
|
|
213
|
-
Every step receives a `ctx` object
|
|
347
|
+
Every step handler receives a `ctx` (Context) object. All methods are **async** and must be `await`ed.
|
|
214
348
|
|
|
215
349
|
```typescript
|
|
216
|
-
// Store
|
|
217
|
-
await ctx.set("key", { any: "
|
|
350
|
+
// Store a JSON-serializable value
|
|
351
|
+
await ctx.set("key", { any: "value" });
|
|
352
|
+
|
|
353
|
+
// Retrieve a stored value (returns null if not found)
|
|
218
354
|
const value = await ctx.get("key");
|
|
219
355
|
|
|
220
|
-
//
|
|
221
|
-
await ctx.sendEvent({ type: "
|
|
356
|
+
// Send an event through the internal step registry
|
|
357
|
+
await ctx.sendEvent({ type: "MyEvent", data: "..." });
|
|
222
358
|
|
|
223
|
-
// Publish an event to external streaming consumers
|
|
224
|
-
await ctx.writeEventToStream({ type: "
|
|
359
|
+
// Publish an event to external streaming consumers (does NOT route internally)
|
|
360
|
+
await ctx.writeEventToStream({ type: "Progress", percent: 50 });
|
|
225
361
|
|
|
226
|
-
// Get the
|
|
362
|
+
// Get the unique run ID for this workflow execution
|
|
227
363
|
const runId = await ctx.runId();
|
|
228
364
|
```
|
|
229
365
|
|
|
230
366
|
---
|
|
231
367
|
|
|
368
|
+
## Timeout
|
|
369
|
+
|
|
370
|
+
Set a workflow timeout in seconds. The default is 300 seconds (5 minutes). Set to 0 or negative to disable.
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
const wf = new Workflow("my-workflow");
|
|
374
|
+
wf.setTimeout(60); // 60 second timeout
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
232
379
|
## TypeScript Support
|
|
233
380
|
|
|
234
|
-
Full TypeScript type definitions
|
|
381
|
+
Full TypeScript type definitions ship with the package -- no `@types` needed. All classes and interfaces are exported.
|
|
235
382
|
|
|
236
383
|
```typescript
|
|
384
|
+
import { Workflow, WorkflowHandler, Context, CompletionModel, version } from "blazen";
|
|
237
385
|
import type { JsWorkflowResult } from "blazen";
|
|
238
|
-
|
|
239
|
-
const result: JsWorkflowResult = await workflow.run({ text: "hello" });
|
|
240
|
-
console.log(result.type); // "blazen::StopEvent"
|
|
241
|
-
console.log(result.data); // your result payload
|
|
242
386
|
```
|
|
243
387
|
|
|
244
388
|
---
|
|
245
389
|
|
|
246
390
|
## API Summary
|
|
247
391
|
|
|
248
|
-
| Export
|
|
249
|
-
|
|
250
|
-
| `Workflow`
|
|
251
|
-
| `
|
|
252
|
-
| `
|
|
253
|
-
| `
|
|
254
|
-
| `
|
|
392
|
+
| Export | Description |
|
|
393
|
+
|---|---|
|
|
394
|
+
| `Workflow` | Build and run event-driven workflows |
|
|
395
|
+
| `Workflow.addStep(name, eventTypes, handler)` | Register a step that handles specific event types |
|
|
396
|
+
| `Workflow.run(input)` | Run the workflow, returns `Promise<JsWorkflowResult>` |
|
|
397
|
+
| `Workflow.runStreaming(input, callback)` | Run with streaming, callback receives intermediate events |
|
|
398
|
+
| `Workflow.runWithHandler(input)` | Run and return a `WorkflowHandler` for pause/resume control |
|
|
399
|
+
| `Workflow.resume(snapshotJson)` | Resume a paused workflow from a JSON snapshot |
|
|
400
|
+
| `Workflow.setTimeout(seconds)` | Set workflow timeout in seconds |
|
|
401
|
+
| `WorkflowHandler` | Control handle for a running workflow |
|
|
402
|
+
| `WorkflowHandler.result()` | Await the final workflow result |
|
|
403
|
+
| `WorkflowHandler.pause()` | Pause and get a serialized snapshot string |
|
|
404
|
+
| `WorkflowHandler.streamEvents(callback)` | Subscribe to intermediate stream events |
|
|
405
|
+
| `Context` | Per-run shared state, event routing, and stream output |
|
|
406
|
+
| `Context.set(key, value)` | Store a value (async) |
|
|
407
|
+
| `Context.get(key)` | Retrieve a value (async, returns null if missing) |
|
|
408
|
+
| `Context.sendEvent(event)` | Route an event to matching steps (async) |
|
|
409
|
+
| `Context.writeEventToStream(event)` | Publish to external stream consumers (async) |
|
|
410
|
+
| `Context.runId()` | Get the workflow run ID (async) |
|
|
411
|
+
| `CompletionModel` | Unified LLM client with 15 provider factory methods |
|
|
412
|
+
| `CompletionModel.complete(messages)` | Chat completion (async) |
|
|
413
|
+
| `CompletionModel.completeWithOptions(messages, opts)` | Chat completion with temperature, maxTokens, model, tools (async) |
|
|
414
|
+
| `CompletionModel.modelId` | Getter for the current model ID |
|
|
415
|
+
| `JsWorkflowResult` | Interface: `{ type: string, data: any }` |
|
|
416
|
+
| `version()` | Returns the blazen library version string |
|
|
255
417
|
|
|
256
418
|
---
|
|
257
419
|
|
|
258
|
-
##
|
|
420
|
+
## Links
|
|
259
421
|
|
|
260
|
-
|
|
422
|
+
- [GitHub](https://github.com/ZachHandley/Blazen) -- source, issues, and advanced examples
|
|
423
|
+
- [blazen.dev](https://blazen.dev) -- documentation and guides
|
|
261
424
|
|
|
262
425
|
---
|
|
263
426
|
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('blazen-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('blazen-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
80
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('blazen-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('blazen-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
96
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('blazen-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('blazen-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
117
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('blazen-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('blazen-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
133
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('blazen-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('blazen-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('blazen-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('blazen-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
166
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('blazen-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('blazen-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
185
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('blazen-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('blazen-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
201
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('blazen-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('blazen-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
217
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('blazen-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('blazen-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
237
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('blazen-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('blazen-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
253
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('blazen-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('blazen-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
274
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('blazen-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('blazen-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
290
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('blazen-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('blazen-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
308
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('blazen-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('blazen-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
324
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('blazen-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('blazen-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
342
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('blazen-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('blazen-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
358
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('blazen-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('blazen-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
376
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('blazen-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('blazen-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
392
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('blazen-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('blazen-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
410
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('blazen-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('blazen-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
426
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('blazen-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('blazen-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('blazen-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('blazen-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('blazen-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('blazen-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
479
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('blazen-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('blazen-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
495
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('blazen-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('blazen-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
511
|
+
if (bindingPackageVersion !== '0.1.97' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.97 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|