@ironflow/node 0.1.0-test.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/README.md +104 -0
- package/dist/function.d.ts +53 -0
- package/dist/function.d.ts.map +1 -0
- package/dist/function.js +56 -0
- package/dist/function.js.map +1 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/context.d.ts +98 -0
- package/dist/internal/context.d.ts.map +1 -0
- package/dist/internal/context.js +211 -0
- package/dist/internal/context.js.map +1 -0
- package/dist/internal/errors.d.ts +47 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +29 -0
- package/dist/internal/errors.js.map +1 -0
- package/dist/serve.d.ts +71 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/serve.js +281 -0
- package/dist/serve.js.map +1 -0
- package/dist/step.d.ts +12 -0
- package/dist/step.d.ts.map +1 -0
- package/dist/step.js +325 -0
- package/dist/step.js.map +1 -0
- package/dist/types.d.ts +73 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/worker-streaming.d.ts +17 -0
- package/dist/worker-streaming.d.ts.map +1 -0
- package/dist/worker-streaming.js +469 -0
- package/dist/worker-streaming.js.map +1 -0
- package/dist/worker.d.ts +29 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +404 -0
- package/dist/worker.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ironflow Streaming Worker
|
|
3
|
+
*
|
|
4
|
+
* ConnectRPC bidirectional streaming worker for low-latency pull mode.
|
|
5
|
+
*/
|
|
6
|
+
import { createClient } from "@connectrpc/connect";
|
|
7
|
+
import { createConnectTransport } from "@connectrpc/connect-node";
|
|
8
|
+
import { create } from "@bufbuild/protobuf";
|
|
9
|
+
import { IronflowError, createLogger, createNoopLogger, DEFAULT_SERVER_URL, DEFAULT_WORKER, WorkerService, } from "@ironflow/core";
|
|
10
|
+
import { WorkerMessageSchema, WorkerRegisterSchema, WorkerHeartbeatSchema, JobCompletedSchema, JobFailedSchema, JobAckSchema, ErrorSchema, } from "@ironflow/core/gen";
|
|
11
|
+
import { ExecutionContext } from "./internal/context.js";
|
|
12
|
+
import { createStepClient } from "./step.js";
|
|
13
|
+
import { isYieldSignal } from "./internal/errors.js";
|
|
14
|
+
import { isRetryable } from "@ironflow/core";
|
|
15
|
+
/**
|
|
16
|
+
* Create a streaming worker for Pull mode execution using ConnectRPC
|
|
17
|
+
*
|
|
18
|
+
* Uses bidirectional gRPC streaming for efficient job dispatch.
|
|
19
|
+
*
|
|
20
|
+
* @param config - Worker configuration
|
|
21
|
+
* @returns Worker instance
|
|
22
|
+
*/
|
|
23
|
+
export function createStreamingWorker(config) {
|
|
24
|
+
return new StreamingWorker(config);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Streaming Worker implementation using ConnectRPC bidirectional streaming
|
|
28
|
+
*/
|
|
29
|
+
class StreamingWorker {
|
|
30
|
+
config;
|
|
31
|
+
functionMap;
|
|
32
|
+
workerId;
|
|
33
|
+
maxConcurrentJobs;
|
|
34
|
+
heartbeatInterval;
|
|
35
|
+
reconnectDelay;
|
|
36
|
+
logger;
|
|
37
|
+
state = "idle";
|
|
38
|
+
activeJobs = new Map();
|
|
39
|
+
heartbeatTimer;
|
|
40
|
+
abortController;
|
|
41
|
+
sendMessage;
|
|
42
|
+
constructor(config) {
|
|
43
|
+
this.config = {
|
|
44
|
+
...config,
|
|
45
|
+
serverUrl: config.serverUrl || DEFAULT_SERVER_URL,
|
|
46
|
+
};
|
|
47
|
+
this.workerId = generateWorkerId();
|
|
48
|
+
this.maxConcurrentJobs =
|
|
49
|
+
config.maxConcurrentJobs ?? DEFAULT_WORKER.MAX_CONCURRENT_JOBS;
|
|
50
|
+
this.heartbeatInterval =
|
|
51
|
+
config.heartbeatInterval ?? DEFAULT_WORKER.HEARTBEAT_INTERVAL_MS;
|
|
52
|
+
this.reconnectDelay =
|
|
53
|
+
config.reconnectDelay ?? DEFAULT_WORKER.RECONNECT_DELAY_MS;
|
|
54
|
+
// Initialize logger
|
|
55
|
+
if (config.logger === false) {
|
|
56
|
+
this.logger = createNoopLogger();
|
|
57
|
+
}
|
|
58
|
+
else if (config.logger) {
|
|
59
|
+
this.logger = config.logger;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.logger = createLogger({ prefix: "[ironflow-streaming]" });
|
|
63
|
+
}
|
|
64
|
+
// Build function map
|
|
65
|
+
this.functionMap = new Map();
|
|
66
|
+
for (const fn of config.functions) {
|
|
67
|
+
this.functionMap.set(fn.config.id, fn);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Start the worker (blocks until stopped)
|
|
72
|
+
*/
|
|
73
|
+
async start() {
|
|
74
|
+
if (this.state !== "idle") {
|
|
75
|
+
throw new IronflowError("Worker is already running", {
|
|
76
|
+
code: "WORKER_ALREADY_RUNNING",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
this.state = "connecting";
|
|
80
|
+
this.abortController = new AbortController();
|
|
81
|
+
this.logger.info(`Starting streaming worker ${this.workerId} with ${this.functionMap.size} functions`);
|
|
82
|
+
// Connect loop with auto-reconnect
|
|
83
|
+
while (this.state !== "stopped") {
|
|
84
|
+
try {
|
|
85
|
+
await this.connect();
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (this.state === "stopped") {
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
this.logger.error("Connection error", { error: String(error) });
|
|
92
|
+
this.logger.info(`Reconnecting in ${this.reconnectDelay}ms...`);
|
|
93
|
+
await this.sleep(this.reconnectDelay);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
this.logger.info("Streaming worker stopped");
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Gracefully drain and stop
|
|
100
|
+
*/
|
|
101
|
+
async drain() {
|
|
102
|
+
if (this.state === "stopped" || this.state === "idle") {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.logger.info("Draining worker...");
|
|
106
|
+
this.state = "draining";
|
|
107
|
+
// Wait for active jobs to complete
|
|
108
|
+
while (this.activeJobs.size > 0) {
|
|
109
|
+
this.logger.info(`Waiting for ${this.activeJobs.size} jobs to complete...`);
|
|
110
|
+
await this.sleep(1000);
|
|
111
|
+
}
|
|
112
|
+
this.stop();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Force stop immediately
|
|
116
|
+
*/
|
|
117
|
+
stop() {
|
|
118
|
+
this.state = "stopped";
|
|
119
|
+
this.abortController?.abort();
|
|
120
|
+
if (this.heartbeatTimer) {
|
|
121
|
+
clearInterval(this.heartbeatTimer);
|
|
122
|
+
this.heartbeatTimer = undefined;
|
|
123
|
+
}
|
|
124
|
+
// Cancel all active jobs
|
|
125
|
+
for (const job of this.activeJobs.values()) {
|
|
126
|
+
job.abortController.abort();
|
|
127
|
+
}
|
|
128
|
+
this.activeJobs.clear();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Connect to the server via ConnectRPC bidirectional streaming
|
|
132
|
+
*/
|
|
133
|
+
async connect() {
|
|
134
|
+
this.state = "connecting";
|
|
135
|
+
// Create Connect transport with HTTP/2 for bidirectional streaming
|
|
136
|
+
const transport = createConnectTransport({
|
|
137
|
+
baseUrl: this.config.serverUrl,
|
|
138
|
+
httpVersion: "2",
|
|
139
|
+
});
|
|
140
|
+
// Create client with type assertion due to connect-es v1/v2 type mismatch
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
142
|
+
const client = createClient(WorkerService, transport);
|
|
143
|
+
// Create message queue for sending
|
|
144
|
+
const messageQueue = [];
|
|
145
|
+
let resolveNext = null;
|
|
146
|
+
// Function to send messages
|
|
147
|
+
this.sendMessage = (msg) => {
|
|
148
|
+
messageQueue.push(msg);
|
|
149
|
+
if (resolveNext) {
|
|
150
|
+
resolveNext();
|
|
151
|
+
resolveNext = null;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
// Async generator for outgoing messages
|
|
155
|
+
async function* outgoingMessages() {
|
|
156
|
+
while (true) {
|
|
157
|
+
if (messageQueue.length > 0) {
|
|
158
|
+
yield messageQueue.shift();
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
await new Promise((resolve) => {
|
|
162
|
+
resolveNext = resolve;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Send registration message first
|
|
168
|
+
const registerMsg = create(WorkerMessageSchema, {
|
|
169
|
+
payload: {
|
|
170
|
+
case: "register",
|
|
171
|
+
value: create(WorkerRegisterSchema, {
|
|
172
|
+
workerId: this.workerId,
|
|
173
|
+
hostname: getHostname(),
|
|
174
|
+
functionIds: Array.from(this.functionMap.keys()),
|
|
175
|
+
maxConcurrentJobs: this.maxConcurrentJobs,
|
|
176
|
+
labels: this.config.labels ?? {},
|
|
177
|
+
version: {
|
|
178
|
+
sdk: "0.1.0",
|
|
179
|
+
runtime: `node-${process.version}`,
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
this.sendMessage(registerMsg);
|
|
185
|
+
this.state = "connected";
|
|
186
|
+
this.logger.info("Connected to server via streaming");
|
|
187
|
+
// Start heartbeat
|
|
188
|
+
this.startHeartbeat();
|
|
189
|
+
// Process incoming messages from the stream
|
|
190
|
+
try {
|
|
191
|
+
const stream = client.connect(outgoingMessages());
|
|
192
|
+
for await (const message of stream) {
|
|
193
|
+
if (this.state === "stopped") {
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
await this.handleEngineMessage(message);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
finally {
|
|
200
|
+
if (this.heartbeatTimer) {
|
|
201
|
+
clearInterval(this.heartbeatTimer);
|
|
202
|
+
this.heartbeatTimer = undefined;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Handle incoming messages from the engine
|
|
208
|
+
*/
|
|
209
|
+
async handleEngineMessage(message) {
|
|
210
|
+
switch (message.payload.case) {
|
|
211
|
+
case "registered":
|
|
212
|
+
this.logger.info("Registration confirmed", {
|
|
213
|
+
heartbeatInterval: message.payload.value.heartbeatIntervalMs,
|
|
214
|
+
});
|
|
215
|
+
break;
|
|
216
|
+
case "job":
|
|
217
|
+
await this.handleJobAssignment(message.payload.value);
|
|
218
|
+
break;
|
|
219
|
+
case "resume":
|
|
220
|
+
this.logger.info("Resume job received", {
|
|
221
|
+
jobId: message.payload.value.jobId,
|
|
222
|
+
stepId: message.payload.value.stepId,
|
|
223
|
+
});
|
|
224
|
+
// TODO: Handle job resume
|
|
225
|
+
break;
|
|
226
|
+
case "cancel":
|
|
227
|
+
this.handleJobCancel(message.payload.value.jobId, message.payload.value.reason);
|
|
228
|
+
break;
|
|
229
|
+
case "shutdown":
|
|
230
|
+
this.logger.info("Shutdown requested", {
|
|
231
|
+
reason: message.payload.value.reason,
|
|
232
|
+
});
|
|
233
|
+
this.drain();
|
|
234
|
+
break;
|
|
235
|
+
default:
|
|
236
|
+
this.logger.warn("Unknown message type", { case: message.payload.case });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Handle a job assignment from the server
|
|
241
|
+
*/
|
|
242
|
+
async handleJobAssignment(job) {
|
|
243
|
+
// Check capacity
|
|
244
|
+
if (this.activeJobs.size >= this.maxConcurrentJobs) {
|
|
245
|
+
this.logger.warn("At capacity, cannot accept job", { jobId: job.jobId });
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
// Send ack
|
|
249
|
+
if (this.sendMessage) {
|
|
250
|
+
const ackMsg = create(WorkerMessageSchema, {
|
|
251
|
+
payload: {
|
|
252
|
+
case: "jobAck",
|
|
253
|
+
value: create(JobAckSchema, {
|
|
254
|
+
jobId: job.jobId,
|
|
255
|
+
}),
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
this.sendMessage(ackMsg);
|
|
259
|
+
}
|
|
260
|
+
// Track active job
|
|
261
|
+
const abortController = new AbortController();
|
|
262
|
+
const activeJob = {
|
|
263
|
+
jobId: job.jobId,
|
|
264
|
+
runId: job.runId,
|
|
265
|
+
functionId: job.functionId,
|
|
266
|
+
startedAt: new Date(),
|
|
267
|
+
abortController,
|
|
268
|
+
};
|
|
269
|
+
this.activeJobs.set(job.jobId, activeJob);
|
|
270
|
+
// Execute in background
|
|
271
|
+
this.executeJob(job, abortController.signal)
|
|
272
|
+
.catch((error) => {
|
|
273
|
+
this.logger.error(`Job ${job.jobId} failed`, { error: String(error) });
|
|
274
|
+
})
|
|
275
|
+
.finally(() => {
|
|
276
|
+
this.activeJobs.delete(job.jobId);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Handle job cancellation
|
|
281
|
+
*/
|
|
282
|
+
handleJobCancel(jobId, reason) {
|
|
283
|
+
const job = this.activeJobs.get(jobId);
|
|
284
|
+
if (job) {
|
|
285
|
+
this.logger.info("Cancelling job", { jobId, reason });
|
|
286
|
+
job.abortController.abort();
|
|
287
|
+
this.activeJobs.delete(jobId);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Execute a job
|
|
292
|
+
*/
|
|
293
|
+
async executeJob(job, signal) {
|
|
294
|
+
const fn = this.functionMap.get(job.functionId);
|
|
295
|
+
if (!fn) {
|
|
296
|
+
await this.sendJobFailed(job.jobId, {
|
|
297
|
+
message: `Function not found: ${job.functionId}`,
|
|
298
|
+
code: "FUNCTION_NOT_FOUND",
|
|
299
|
+
retryable: false,
|
|
300
|
+
});
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
this.logger.info(`Processing job ${job.jobId} for ${job.functionId}`);
|
|
304
|
+
// Convert protobuf event to our format
|
|
305
|
+
const timestampToISO = (ts) => {
|
|
306
|
+
if (!ts)
|
|
307
|
+
return new Date().toISOString();
|
|
308
|
+
const ms = Number(ts.seconds) * 1000 + Math.floor(ts.nanos / 1_000_000);
|
|
309
|
+
return new Date(ms).toISOString();
|
|
310
|
+
};
|
|
311
|
+
const event = job.event
|
|
312
|
+
? {
|
|
313
|
+
id: job.event.id,
|
|
314
|
+
name: job.event.name,
|
|
315
|
+
data: job.event.data ?? {},
|
|
316
|
+
timestamp: timestampToISO(job.event.timestamp),
|
|
317
|
+
}
|
|
318
|
+
: {
|
|
319
|
+
id: "",
|
|
320
|
+
name: "",
|
|
321
|
+
data: {},
|
|
322
|
+
timestamp: new Date().toISOString(),
|
|
323
|
+
};
|
|
324
|
+
// Build execution context
|
|
325
|
+
const ctx = new ExecutionContext({
|
|
326
|
+
run_id: job.runId,
|
|
327
|
+
function_id: job.functionId,
|
|
328
|
+
attempt: job.attempt,
|
|
329
|
+
event,
|
|
330
|
+
steps: job.completedSteps.map((s) => ({
|
|
331
|
+
id: s.stepId,
|
|
332
|
+
name: s.name,
|
|
333
|
+
status: "completed",
|
|
334
|
+
output: s.output,
|
|
335
|
+
})),
|
|
336
|
+
resume: undefined,
|
|
337
|
+
});
|
|
338
|
+
const step = createStepClient(ctx);
|
|
339
|
+
const functionContext = {
|
|
340
|
+
event: ctx.event,
|
|
341
|
+
step,
|
|
342
|
+
run: ctx.runInfo,
|
|
343
|
+
logger: ctx.logger,
|
|
344
|
+
};
|
|
345
|
+
const startTime = Date.now();
|
|
346
|
+
try {
|
|
347
|
+
if (signal.aborted) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const result = await fn.handler(functionContext);
|
|
351
|
+
const durationMs = Date.now() - startTime;
|
|
352
|
+
// Send completion via stream
|
|
353
|
+
await this.sendJobCompleted(job.jobId, result, durationMs);
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
if (signal.aborted) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const durationMs = Date.now() - startTime;
|
|
360
|
+
if (isYieldSignal(error)) {
|
|
361
|
+
// TODO: Send step yielded via stream
|
|
362
|
+
this.logger.info("Job yielded", { jobId: job.jobId });
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
// Send failure via stream
|
|
366
|
+
await this.sendJobFailed(job.jobId, {
|
|
367
|
+
message: error instanceof Error ? error.message : String(error),
|
|
368
|
+
code: error instanceof IronflowError ? error.code : "ERROR",
|
|
369
|
+
retryable: isRetryable(error),
|
|
370
|
+
durationMs,
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Send job completed message via stream
|
|
376
|
+
*/
|
|
377
|
+
async sendJobCompleted(jobId, output, durationMs) {
|
|
378
|
+
if (!this.sendMessage)
|
|
379
|
+
return;
|
|
380
|
+
const msg = create(WorkerMessageSchema, {
|
|
381
|
+
payload: {
|
|
382
|
+
case: "jobCompleted",
|
|
383
|
+
value: create(JobCompletedSchema, {
|
|
384
|
+
jobId,
|
|
385
|
+
output: output,
|
|
386
|
+
durationMs,
|
|
387
|
+
}),
|
|
388
|
+
},
|
|
389
|
+
});
|
|
390
|
+
this.sendMessage(msg);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Send job failed message via stream
|
|
394
|
+
*/
|
|
395
|
+
async sendJobFailed(jobId, error) {
|
|
396
|
+
if (!this.sendMessage)
|
|
397
|
+
return;
|
|
398
|
+
const msg = create(WorkerMessageSchema, {
|
|
399
|
+
payload: {
|
|
400
|
+
case: "jobFailed",
|
|
401
|
+
value: create(JobFailedSchema, {
|
|
402
|
+
jobId,
|
|
403
|
+
error: create(ErrorSchema, {
|
|
404
|
+
message: error.message,
|
|
405
|
+
code: error.code,
|
|
406
|
+
retryable: error.retryable,
|
|
407
|
+
}),
|
|
408
|
+
durationMs: error.durationMs ?? 0,
|
|
409
|
+
}),
|
|
410
|
+
},
|
|
411
|
+
});
|
|
412
|
+
this.sendMessage(msg);
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Start sending heartbeats via stream
|
|
416
|
+
*/
|
|
417
|
+
startHeartbeat() {
|
|
418
|
+
this.heartbeatTimer = setInterval(() => {
|
|
419
|
+
if (this.state !== "connected" || !this.sendMessage) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
const msg = create(WorkerMessageSchema, {
|
|
423
|
+
payload: {
|
|
424
|
+
case: "heartbeat",
|
|
425
|
+
value: create(WorkerHeartbeatSchema, {
|
|
426
|
+
workerId: this.workerId,
|
|
427
|
+
activeJobs: this.activeJobs.size,
|
|
428
|
+
jobs: Array.from(this.activeJobs.values()).map((job) => ({
|
|
429
|
+
jobId: job.jobId,
|
|
430
|
+
startedAt: {
|
|
431
|
+
seconds: BigInt(Math.floor(job.startedAt.getTime() / 1000)),
|
|
432
|
+
nanos: 0,
|
|
433
|
+
},
|
|
434
|
+
})),
|
|
435
|
+
}),
|
|
436
|
+
},
|
|
437
|
+
});
|
|
438
|
+
this.sendMessage(msg);
|
|
439
|
+
}, this.heartbeatInterval);
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Sleep helper
|
|
443
|
+
*/
|
|
444
|
+
sleep(ms) {
|
|
445
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
// ============================================================================
|
|
449
|
+
// Utilities
|
|
450
|
+
// ============================================================================
|
|
451
|
+
/**
|
|
452
|
+
* Generate a unique worker ID
|
|
453
|
+
*/
|
|
454
|
+
function generateWorkerId() {
|
|
455
|
+
const timestamp = Date.now().toString(36);
|
|
456
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
457
|
+
return `worker-stream-${timestamp}-${random}`;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Get the hostname
|
|
461
|
+
*/
|
|
462
|
+
function getHostname() {
|
|
463
|
+
if (typeof process !== "undefined" && process.env["HOSTNAME"]) {
|
|
464
|
+
return process.env["HOSTNAME"];
|
|
465
|
+
}
|
|
466
|
+
return "unknown";
|
|
467
|
+
}
|
|
468
|
+
export default createStreamingWorker;
|
|
469
|
+
//# sourceMappingURL=worker-streaming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-streaming.js","sourceRoot":"","sources":["../src/worker-streaming.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAmB,MAAM,oBAAoB,CAAC;AAM7D,OAAO,EACL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,WAAW,GAIZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA0B7C;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAoB;IACxD,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,eAAe;IACF,MAAM,CAAe;IACrB,WAAW,CAAgC;IAC3C,QAAQ,CAAS;IACjB,iBAAiB,CAAS;IAC1B,iBAAiB,CAAS;IAC1B,cAAc,CAAS;IACvB,MAAM,CA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AE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF;AAED,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;GAEG;AACH,SAAS,gBAAgB;IACvB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,OAAO,iBAAiB,SAAS,IAAI,MAAM,EAAE,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,SAAS,WAAW;IAClB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9D,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,eAAe,qBAAqB,CAAC"}
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ironflow Worker Client
|
|
3
|
+
*
|
|
4
|
+
* Pull mode worker that polls the Ironflow server for jobs.
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkerConfig, Worker } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Create a worker for Pull mode execution
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { createWorker } from "@ironflow/node/worker";
|
|
13
|
+
*
|
|
14
|
+
* const worker = createWorker({
|
|
15
|
+
* serverUrl: "http://localhost:9123",
|
|
16
|
+
* functions: [myFunction],
|
|
17
|
+
* maxConcurrentJobs: 4,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* await worker.start();
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function createWorker(config: WorkerConfig): Worker;
|
|
24
|
+
export { createStreamingWorker } from "./worker-streaming.js";
|
|
25
|
+
/**
|
|
26
|
+
* Default export
|
|
27
|
+
*/
|
|
28
|
+
export default createWorker;
|
|
29
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAqBvD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAEzD;AAscD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,eAAe,YAAY,CAAC"}
|