@ironflow/node 0.1.0-test.2 → 0.2.0

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/client.js ADDED
@@ -0,0 +1,449 @@
1
+ /**
2
+ * Ironflow Node.js Client
3
+ *
4
+ * HTTP client for interacting with the Ironflow server.
5
+ * Provides methods for registering functions, triggering events, and managing runs.
6
+ */
7
+ import { API_ENDPOINTS, DEFAULT_SERVER_URL, getServerUrl, } from "@ironflow/core";
8
+ import { KVClient } from "./kv.js";
9
+ import { ConfigClient } from "./config-client.js";
10
+ // ============================================================================
11
+ // Client Implementation
12
+ // ============================================================================
13
+ /**
14
+ * Ironflow client for server-side operations
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import { createClient } from "@ironflow/node";
19
+ *
20
+ * const client = createClient({
21
+ * serverUrl: "http://localhost:9123",
22
+ * });
23
+ *
24
+ * // Register a function
25
+ * await client.registerFunction({
26
+ * id: "my-function",
27
+ * name: "My Function",
28
+ * triggers: [{ event: "my.event" }],
29
+ * endpointUrl: "http://localhost:3000/api/ironflow",
30
+ * preferredMode: "push",
31
+ * });
32
+ *
33
+ * // Emit an event
34
+ * const result = await client.emit("my.event", { data: "value" });
35
+ * console.log("Created runs:", result.runIds);
36
+ * ```
37
+ */
38
+ export class IronflowClient {
39
+ serverUrl;
40
+ apiKey;
41
+ timeout;
42
+ constructor(config = {}) {
43
+ this.serverUrl = config.serverUrl || getServerUrl() || DEFAULT_SERVER_URL;
44
+ this.apiKey = config.apiKey;
45
+ this.timeout = config.timeout ?? 30000;
46
+ }
47
+ /**
48
+ * Register a function with the Ironflow server
49
+ */
50
+ async registerFunction(request) {
51
+ const body = {
52
+ id: request.id,
53
+ };
54
+ if (request.name)
55
+ body.name = request.name;
56
+ if (request.description)
57
+ body.description = request.description;
58
+ if (request.triggers)
59
+ body.triggers = request.triggers;
60
+ if (request.retry)
61
+ body.retry = request.retry;
62
+ if (request.timeoutMs)
63
+ body.timeoutMs = request.timeoutMs;
64
+ if (request.concurrency)
65
+ body.concurrency = request.concurrency;
66
+ if (request.preferredMode)
67
+ body.preferredMode = request.preferredMode;
68
+ if (request.endpointUrl)
69
+ body.endpointUrl = request.endpointUrl;
70
+ if (request.actorKey)
71
+ body.actorKey = request.actorKey;
72
+ const response = await this.request(API_ENDPOINTS.REGISTER_FUNCTION, body);
73
+ return { created: response.created };
74
+ }
75
+ /**
76
+ * Emit an event to trigger workflows
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * const result = await client.emit("order.placed", {
81
+ * orderId: "123",
82
+ * total: 99.99,
83
+ * });
84
+ * console.log("Created runs:", result.runIds);
85
+ * ```
86
+ */
87
+ async emit(eventName, data, options) {
88
+ const body = {
89
+ event: eventName,
90
+ data,
91
+ };
92
+ if (options?.version)
93
+ body.version = options.version;
94
+ if (options?.idempotencyKey)
95
+ body.idempotencyKey = options.idempotencyKey;
96
+ if (options?.metadata)
97
+ body.metadata = options.metadata;
98
+ const response = await this.request(API_ENDPOINTS.TRIGGER, body);
99
+ return {
100
+ runIds: response.runIds || [],
101
+ eventId: response.eventId,
102
+ };
103
+ }
104
+ /**
105
+ * Trigger an event (alias for emit)
106
+ * @deprecated Use emit() instead
107
+ */
108
+ async trigger(eventName, data, options) {
109
+ return this.emit(eventName, data, options);
110
+ }
111
+ /**
112
+ * Get a run by ID
113
+ */
114
+ async getRun(runId) {
115
+ return this.request(API_ENDPOINTS.GET_RUN, { id: runId });
116
+ }
117
+ /**
118
+ * List runs with optional filtering
119
+ */
120
+ async listRuns(options) {
121
+ const body = {};
122
+ if (options?.functionId)
123
+ body.functionId = options.functionId;
124
+ if (options?.status)
125
+ body.status = options.status;
126
+ if (options?.limit)
127
+ body.limit = options.limit;
128
+ if (options?.cursor)
129
+ body.cursor = options.cursor;
130
+ return this.request(API_ENDPOINTS.LIST_RUNS, body);
131
+ }
132
+ /**
133
+ * Cancel a running workflow
134
+ */
135
+ async cancelRun(runId, reason) {
136
+ return this.request(API_ENDPOINTS.CANCEL_RUN, {
137
+ id: runId,
138
+ reason: reason || "",
139
+ });
140
+ }
141
+ /**
142
+ * Retry a failed run
143
+ */
144
+ async retryRun(runId, fromStep) {
145
+ const body = { id: runId };
146
+ if (fromStep)
147
+ body.fromStep = fromStep;
148
+ return this.request(API_ENDPOINTS.RETRY_RUN, body);
149
+ }
150
+ /**
151
+ * Health check
152
+ */
153
+ async health() {
154
+ const response = await this.request(API_ENDPOINTS.HEALTH, {});
155
+ return response.status;
156
+ }
157
+ /**
158
+ * Entity stream operations
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * // Append an event to a stream
163
+ * const result = await client.streams.append("order-123", {
164
+ * name: "order.created",
165
+ * data: { total: 100 },
166
+ * entityType: "order",
167
+ * });
168
+ *
169
+ * // Read events from a stream
170
+ * const { events } = await client.streams.read("order-123", { limit: 10 });
171
+ *
172
+ * // Get stream info
173
+ * const info = await client.streams.getInfo("order-123");
174
+ * ```
175
+ */
176
+ streams = {
177
+ /**
178
+ * Append an event to an entity stream
179
+ */
180
+ append: async (entityId, input, options) => {
181
+ const response = await this.request("/ironflow.v1.EntityStreamService/AppendEvent", {
182
+ entity_id: entityId,
183
+ entity_type: input.entityType,
184
+ event_name: input.name,
185
+ data: input.data,
186
+ expected_version: options?.expectedVersion ?? -1,
187
+ idempotency_key: options?.idempotencyKey ?? "",
188
+ version: options?.version ?? 1,
189
+ });
190
+ return {
191
+ entityVersion: response.entity_version,
192
+ eventId: response.event_id,
193
+ };
194
+ },
195
+ /**
196
+ * Read events from an entity stream
197
+ */
198
+ read: async (entityId, options) => {
199
+ const response = await this.request("/ironflow.v1.EntityStreamService/ReadStream", {
200
+ entity_id: entityId,
201
+ from_version: options?.fromVersion ?? 0,
202
+ limit: options?.limit ?? 0,
203
+ direction: options?.direction ?? "forward",
204
+ });
205
+ return {
206
+ events: (response.events ?? []).map((e) => ({
207
+ id: e.id,
208
+ name: e.name,
209
+ data: e.data ?? {},
210
+ entityVersion: e.entity_version,
211
+ version: e.version,
212
+ timestamp: e.timestamp,
213
+ source: e.source,
214
+ metadata: e.metadata,
215
+ })),
216
+ totalCount: response.total_count ?? 0,
217
+ };
218
+ },
219
+ /**
220
+ * Get information about an entity stream
221
+ */
222
+ getInfo: async (entityId) => {
223
+ const response = await this.request("/ironflow.v1.EntityStreamService/GetStreamInfo", {
224
+ entity_id: entityId,
225
+ });
226
+ return {
227
+ entityId: response.entity_id,
228
+ entityType: response.entity_type,
229
+ version: response.version,
230
+ eventCount: response.event_count,
231
+ createdAt: response.created_at,
232
+ updatedAt: response.updated_at,
233
+ };
234
+ },
235
+ };
236
+ /**
237
+ * KV store operations
238
+ *
239
+ * @example
240
+ * ```typescript
241
+ * const kv = client.kv();
242
+ * const bucket = await kv.createBucket({ name: "sessions", ttlSeconds: 3600 });
243
+ * const handle = kv.bucket("sessions");
244
+ * const { revision } = await handle.put("user.123", { token: "abc" });
245
+ * const entry = await handle.get("user.123");
246
+ * ```
247
+ */
248
+ kv() {
249
+ return new KVClient({
250
+ serverUrl: this.serverUrl,
251
+ apiKey: this.apiKey,
252
+ timeout: this.timeout,
253
+ });
254
+ }
255
+ /**
256
+ * Config management operations
257
+ *
258
+ * @example
259
+ * ```typescript
260
+ * const config = client.config();
261
+ * await config.set("app", { featureX: true });
262
+ * const { data } = await config.get("app");
263
+ * await config.patch("app", { maxRetries: 5 });
264
+ * const configs = await config.list();
265
+ * await config.delete("app");
266
+ * ```
267
+ */
268
+ config() {
269
+ return new ConfigClient({
270
+ serverUrl: this.serverUrl,
271
+ apiKey: this.apiKey,
272
+ timeout: this.timeout,
273
+ });
274
+ }
275
+ /**
276
+ * Patch a step's output (hot patching)
277
+ */
278
+ async patchStep(stepId, output, reason) {
279
+ const url = `${this.serverUrl}/api/v1/steps/patch`;
280
+ const headers = {
281
+ "Content-Type": "application/json",
282
+ };
283
+ if (this.apiKey) {
284
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
285
+ }
286
+ const controller = new AbortController();
287
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
288
+ try {
289
+ const response = await fetch(url, {
290
+ method: "POST",
291
+ headers,
292
+ body: JSON.stringify({ step_id: stepId, output, reason: reason || "" }),
293
+ signal: controller.signal,
294
+ });
295
+ if (!response.ok) {
296
+ const errorBody = await response.text();
297
+ throw new Error(errorBody || `Patch step failed: ${response.status}`);
298
+ }
299
+ }
300
+ finally {
301
+ clearTimeout(timeoutId);
302
+ }
303
+ }
304
+ /**
305
+ * Resume a paused or failed run
306
+ */
307
+ async resumeRun(runId, fromStep) {
308
+ const url = `${this.serverUrl}/api/v1/runs/resume`;
309
+ const headers = {
310
+ "Content-Type": "application/json",
311
+ };
312
+ if (this.apiKey) {
313
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
314
+ }
315
+ const controller = new AbortController();
316
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
317
+ try {
318
+ const response = await fetch(url, {
319
+ method: "POST",
320
+ headers,
321
+ body: JSON.stringify({ run_id: runId, from_step: fromStep || "" }),
322
+ signal: controller.signal,
323
+ });
324
+ if (!response.ok) {
325
+ const errorBody = await response.text();
326
+ throw new Error(errorBody || `Resume run failed: ${response.status}`);
327
+ }
328
+ return response.json();
329
+ }
330
+ finally {
331
+ clearTimeout(timeoutId);
332
+ }
333
+ }
334
+ /**
335
+ * List registered functions
336
+ */
337
+ async listFunctions() {
338
+ const url = `${this.serverUrl}/api/v1/functions`;
339
+ const headers = {};
340
+ if (this.apiKey) {
341
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
342
+ }
343
+ const controller = new AbortController();
344
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
345
+ try {
346
+ const response = await fetch(url, {
347
+ method: "GET",
348
+ headers,
349
+ signal: controller.signal,
350
+ });
351
+ if (!response.ok) {
352
+ throw new Error(`List functions failed: ${response.status}`);
353
+ }
354
+ const data = (await response.json());
355
+ return data.functions || [];
356
+ }
357
+ finally {
358
+ clearTimeout(timeoutId);
359
+ }
360
+ }
361
+ /**
362
+ * List connected workers
363
+ */
364
+ async listWorkers() {
365
+ const url = `${this.serverUrl}/api/v1/workers`;
366
+ const headers = {};
367
+ if (this.apiKey) {
368
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
369
+ }
370
+ const controller = new AbortController();
371
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
372
+ try {
373
+ const response = await fetch(url, {
374
+ method: "GET",
375
+ headers,
376
+ signal: controller.signal,
377
+ });
378
+ if (!response.ok) {
379
+ throw new Error(`List workers failed: ${response.status}`);
380
+ }
381
+ const data = (await response.json());
382
+ return data.workers || [];
383
+ }
384
+ finally {
385
+ clearTimeout(timeoutId);
386
+ }
387
+ }
388
+ /**
389
+ * Make an HTTP request to the server
390
+ */
391
+ async request(endpoint, body) {
392
+ const url = `${this.serverUrl}${endpoint}`;
393
+ const headers = {
394
+ "Content-Type": "application/json",
395
+ };
396
+ if (this.apiKey) {
397
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
398
+ }
399
+ const controller = new AbortController();
400
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
401
+ try {
402
+ const response = await fetch(url, {
403
+ method: "POST",
404
+ headers,
405
+ body: JSON.stringify(body),
406
+ signal: controller.signal,
407
+ });
408
+ if (!response.ok) {
409
+ const errorBody = await response.text();
410
+ let errorMessage = `Request failed with status ${response.status}`;
411
+ if (errorBody) {
412
+ try {
413
+ const errorJson = JSON.parse(errorBody);
414
+ if (errorJson.message) {
415
+ errorMessage = errorJson.message;
416
+ }
417
+ else if (errorJson.code) {
418
+ errorMessage = `Error code: ${errorJson.code}`;
419
+ }
420
+ else {
421
+ errorMessage = errorBody;
422
+ }
423
+ }
424
+ catch {
425
+ // Not a JSON response, use raw text.
426
+ errorMessage = errorBody;
427
+ }
428
+ }
429
+ throw new Error(errorMessage);
430
+ }
431
+ return response.json();
432
+ }
433
+ finally {
434
+ clearTimeout(timeoutId);
435
+ }
436
+ }
437
+ }
438
+ /**
439
+ * Create a new Ironflow client
440
+ *
441
+ * @example
442
+ * ```typescript
443
+ * const client = createClient({ serverUrl: "http://localhost:9123" });
444
+ * ```
445
+ */
446
+ export function createClient(config) {
447
+ return new IronflowClient(config);
448
+ }
449
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,YAAY,GAYb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAwIlD,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,cAAc;IACR,SAAS,CAAS;IAClB,MAAM,CAAU;IAChB,OAAO,CAAS;IAEjC,YAAY,SAA+B,EAAE;QAC3C,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,YAAY,EAAE,IAAI,kBAAkB,CAAC;QAC1E,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CACpB,OAAgC;QAEhC,MAAM,IAAI,GAA4B;YACpC,EAAE,EAAE,OAAO,CAAC,EAAE;SACf,CAAC;QAEF,IAAI,OAAO,CAAC,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC3C,IAAI,OAAO,CAAC,WAAW;YAAE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QAChE,IAAI,OAAO,CAAC,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACvD,IAAI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AAS,CAAC,IAAI,CAAC;gBAC1B,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACxC,IAAI,YAAY,GAAG,8BAA8B,QAAQ,CAAC,MAAM,EAAE,CAAC;gBACnE,IAAI,SAAS,EAAE,CAAC;oBACd,IAAI,CAAC;wBACH,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;wBACxC,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;4BACtB,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC;wBACnC,CAAC;6BAAM,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;4BAC1B,YAAY,GAAG,eAAe,SAAS,CAAC,IAAI,EAAE,CAAC;wBACjD,CAAC;6BAAM,CAAC;4BACN,YAAY,GAAG,SAAS,CAAC;wBAC3B,CAAC;oBACH,CAAC;oBAAC,MAAM,CAAC;wBACP,qCAAqC;wBACrC,YAAY,GAAG,SAAS,CAAC;oBAC3B,CAAC;gBACH,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;YAChC,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAC;QACvC,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,MAA6B;IACxD,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Ironflow Node.js Config Client
3
+ *
4
+ * Config management operations for the Ironflow server.
5
+ */
6
+ import type { ConfigResponse, ConfigEntry, ConfigSetResult } from "@ironflow/core";
7
+ /**
8
+ * Configuration for the config client (inherited from parent client).
9
+ */
10
+ export interface ConfigClientConfig {
11
+ serverUrl: string;
12
+ apiKey?: string;
13
+ timeout: number;
14
+ }
15
+ /**
16
+ * Node.js config client for config management operations.
17
+ */
18
+ export declare class ConfigClient {
19
+ private readonly config;
20
+ constructor(config: ConfigClientConfig);
21
+ /**
22
+ * Set a config (full document replacement).
23
+ */
24
+ set(name: string, data: Record<string, unknown>): Promise<ConfigSetResult>;
25
+ /**
26
+ * Get a config by name.
27
+ */
28
+ get(name: string): Promise<ConfigResponse>;
29
+ /**
30
+ * Patch a config (shallow merge).
31
+ */
32
+ patch(name: string, data: Record<string, unknown>): Promise<ConfigSetResult>;
33
+ /**
34
+ * List all configs.
35
+ */
36
+ list(): Promise<ConfigEntry[]>;
37
+ /**
38
+ * Delete a config. Idempotent — succeeds silently if the config does not exist.
39
+ */
40
+ delete(name: string): Promise<void>;
41
+ private restRequest;
42
+ }
43
+ //# sourceMappingURL=config-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-client.d.ts","sourceRoot":"","sources":["../src/config-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,kBAAkB;IAEvD;;OAEG;IACG,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAIhF;;OAEG;IACG,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAIhD;;OAEG;IACG,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAIlF;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAKpC;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAI3B,WAAW;CAgD1B"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Ironflow Node.js Config Client
3
+ *
4
+ * Config management operations for the Ironflow server.
5
+ */
6
+ /**
7
+ * Node.js config client for config management operations.
8
+ */
9
+ export class ConfigClient {
10
+ config;
11
+ constructor(config) {
12
+ this.config = config;
13
+ }
14
+ /**
15
+ * Set a config (full document replacement).
16
+ */
17
+ async set(name, data) {
18
+ return this.restRequest("POST", `/api/v1/config/${enc(name)}`, data);
19
+ }
20
+ /**
21
+ * Get a config by name.
22
+ */
23
+ async get(name) {
24
+ return this.restRequest("GET", `/api/v1/config/${enc(name)}`);
25
+ }
26
+ /**
27
+ * Patch a config (shallow merge).
28
+ */
29
+ async patch(name, data) {
30
+ return this.restRequest("PATCH", `/api/v1/config/${enc(name)}`, data);
31
+ }
32
+ /**
33
+ * List all configs.
34
+ */
35
+ async list() {
36
+ const result = await this.restRequest("GET", "/api/v1/config");
37
+ return result.configs;
38
+ }
39
+ /**
40
+ * Delete a config. Idempotent — succeeds silently if the config does not exist.
41
+ */
42
+ async delete(name) {
43
+ await this.restRequest("DELETE", `/api/v1/config/${enc(name)}`);
44
+ }
45
+ async restRequest(method, path, body) {
46
+ const url = `${this.config.serverUrl}${path}`;
47
+ const headers = {};
48
+ if (body !== undefined) {
49
+ headers["Content-Type"] = "application/json";
50
+ }
51
+ if (this.config.apiKey) {
52
+ headers["Authorization"] = `Bearer ${this.config.apiKey}`;
53
+ }
54
+ const controller = new AbortController();
55
+ const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
56
+ try {
57
+ const response = await fetch(url, {
58
+ method,
59
+ headers,
60
+ body: body !== undefined ? JSON.stringify(body) : undefined,
61
+ signal: controller.signal,
62
+ });
63
+ if (!response.ok) {
64
+ const errorBody = await response.text();
65
+ let errorMessage = `Config request failed with status ${response.status}`;
66
+ try {
67
+ const errorJson = JSON.parse(errorBody);
68
+ if (errorJson.error)
69
+ errorMessage = errorJson.error;
70
+ }
71
+ catch {
72
+ if (errorBody)
73
+ errorMessage = errorBody;
74
+ }
75
+ throw new Error(errorMessage);
76
+ }
77
+ if (response.status === 204) {
78
+ return undefined;
79
+ }
80
+ return response.json();
81
+ }
82
+ finally {
83
+ clearTimeout(timeoutId);
84
+ }
85
+ }
86
+ }
87
+ function enc(s) {
88
+ return encodeURIComponent(s);
89
+ }
90
+ //# sourceMappingURL=config-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-client.js","sourceRoot":"","sources":["../src/config-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH;;GAEG;AACH,MAAM,OAAO,YAAY;IACM;IAA7B,YAA6B,MAA0B;QAA1B,WAAM,GAAN,MAAM,CAAoB;IAAG,CAAC;IAE3D;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,IAA6B;QACnD,OAAO,IAAI,CAAC,WAAW,CAAkB,MAAM,EAAE,kBAAkB,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACxF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,IAAY;QACpB,OAAO,IAAI,CAAC,WAAW,CAAiB,KAAK,EAAE,kBAAkB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,IAA6B;QACrD,OAAO,IAAI,CAAC,WAAW,CAAkB,OAAO,EAAE,kBAAkB,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;I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AI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACxC,IAAI,YAAY,GAAG,qCAAqC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAC1E,IAAI,CAAC;oBACH,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;oBACxC,IAAI,SAAS,CAAC,KAAK;wBAAE,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC;gBACtD,CAAC;gBAAC,MAAM,CAAC;oBACP,IAAI,SAAS;wBAAE,YAAY,GAAG,SAAS,CAAC;gBAC1C,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;YAChC,CAAC;YAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,OAAO,SAAc,CAAC;YACxB,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAC;QACvC,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CACF;AAED,SAAS,GAAG,CAAC,CAAS;IACpB,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @ironflow/node
3
3
  *
4
- * Node.js SDK for Ironflow workflow engine.
4
+ * Node.js SDK for Ironflow, an event-driven backend platform.
5
5
  * Provides workers, serve handlers, and step execution for serverless and long-running functions.
6
6
  *
7
7
  * @example
@@ -39,9 +39,17 @@
39
39
  */
40
40
  export { ironflow, createFunction } from "./function.js";
41
41
  export { serve, createHandler } from "./serve.js";
42
- export { createWorker, createStreamingWorker } from "./worker.js";
42
+ export { createWorker } from "./worker.js";
43
+ export { createProjection } from "./projection.js";
44
+ export { createProjectionRunner, type ProjectionRunnerConfig } from "./projection-runner.js";
45
+ export { createClient } from "./client.js";
46
+ export type { IronflowClientConfig, RegisterFunctionRequest, RegisterFunctionResult, } from "./client.js";
47
+ export { KVClient, KVBucketHandle } from "./kv.js";
48
+ export type { KVClientConfig } from "./kv.js";
49
+ export { ConfigClient } from "./config-client.js";
50
+ export type { ConfigClientConfig } from "./config-client.js";
43
51
  export type { ServeConfig, HandlerOptions, HandlerContext, WorkerConfig, Worker, CreateFunctionConfig, } from "./types.js";
44
- export type { Branded, RunId, FunctionId, StepId, EventId, JobId, WorkerId, SubscriptionId, FunctionConfig, FunctionContext, FunctionHandler, IronflowFunction, Trigger, RetryConfig, ConcurrencyConfig, ExecutionMode, IronflowEvent, EventFilter, StepClient, Duration, ParallelOptions, RunInfo, Run, RunStatus, ListRunsOptions, ListRunsResult, TriggerResult, TriggerSyncOptions, TriggerSyncResult, EmitOptions, EmitResult, Logger, PushRequest, PushResponse, CompletedStep, ResumeContext, StepResult, YieldInfo, SleepYield, WaitEventYield, } from "@ironflow/core";
52
+ export type { Branded, RunId, FunctionId, StepId, EventId, JobId, WorkerId, SubscriptionId, FunctionConfig, FunctionContext, FunctionHandler, IronflowFunction, Trigger, RetryConfig, ConcurrencyConfig, ExecutionMode, IronflowEvent, EventFilter, StepClient, Duration, ParallelOptions, RunInfo, Run, RunStatus, ListRunsOptions, ListRunsResult, TriggerResult, TriggerSyncOptions, TriggerSyncResult, EmitOptions, EmitResult, AppendEventInput, AppendOptions, AppendResult, ReadStreamOptions, StreamEvent, StreamInfo, Logger, PushRequest, PushResponse, CompletedStep, ResumeContext, StepResult, YieldInfo, SleepYield, WaitEventYield, KVBucketConfig, KVBucketInfo, KVEntry, KVPutResult, KVListKeysResult, KVListBucketsResult, KVWatchEvent, KVWatchCallbacks, KVWatchOptions, KVWatcher, ConfigResponse, ConfigEntry, ConfigSetResult, ConfigWatchCallbacks, ProjectionMode, ProjectionStatus, ProjectionContext, ManagedProjectionHandler, ExternalProjectionHandler, ProjectionConfig, IronflowProjection, ProjectionStatusInfo, ProjectionStateResult, GetProjectionOptions, RebuildProjectionOptions, ProjectionSubscriptionCallbacks, } from "@ironflow/core";
45
53
  export { createRunId, createFunctionId, createStepId, createEventId, createJobId, createWorkerId, createSubscriptionId, } from "@ironflow/core";
46
54
  export { IronflowError, StepError, TimeoutError, ValidationError, SchemaValidationError, SignatureError, FunctionNotFoundError, RunNotFoundError, NonRetryableError, isRetryable, isIronflowError, } from "@ironflow/core";
47
55
  export { parseDuration, calculateBackoff, sleep, generateId, createLogger, createNoopLogger, type LogLevel, type LoggerConfig, } from "@ironflow/core";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGlE,YAAY,EACV,WAAW,EACX,cAAc,EACd,cAAc,EACd,YAAY,EACZ,MAAM,EACN,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,YAAY,EAEV,OAAO,EACP,KAAK,EACL,UAAU,EACV,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,cAAc,EAGd,cAAc,EACd,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,aAAa,EAGb,aAAa,EACb,WAAW,EAGX,UAAU,EACV,QAAQ,EACR,eAAe,EAGf,OAAO,EACP,GAAG,EACH,SAAS,EACT,eAAe,EACf,cAAc,EAGd,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EAGjB,WAAW,EACX,UAAU,EAGV,MAAM,EAGN,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,SAAS,EACT,UAAU,E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B,wBAAwB,EACxB,+BAA+B,GAChC,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,EACd,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,QAAQ,EACR,YAAY,GACb,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACT,MAAM,gBAAgB,CAAC;;;;;;AAGxB,wBAA4B"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @ironflow/node
3
3
  *
4
- * Node.js SDK for Ironflow workflow engine.
4
+ * Node.js SDK for Ironflow, an event-driven backend platform.
5
5
  * Provides workers, serve handlers, and step execution for serverless and long-running functions.
6
6
  *
7
7
  * @example
@@ -41,7 +41,14 @@
41
41
  import { ironflow } from "./function.js";
42
42
  export { ironflow, createFunction } from "./function.js";
43
43
  export { serve, createHandler } from "./serve.js";
44
- export { createWorker, createStreamingWorker } from "./worker.js";
44
+ export { createWorker } from "./worker.js";
45
+ export { createProjection } from "./projection.js";
46
+ export { createProjectionRunner } from "./projection-runner.js";
47
+ // NOTE: createStreamingWorker is NOT exported here to avoid loading protobuf
48
+ // dependencies. Import from "@ironflow/node/worker-streaming" if you need it.
49
+ export { createClient } from "./client.js";
50
+ export { KVClient, KVBucketHandle } from "./kv.js";
51
+ export { ConfigClient } from "./config-client.js";
45
52
  // Re-export branded ID creators
46
53
  export { createRunId, createFunctionId, createStepId, createEventId, createJobId, createWorkerId, createSubscriptionId, } from "@ironflow/core";
47
54
  // Re-export errors