@ironflow/core 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 +60 -0
- package/dist/constants.d.ts +219 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +233 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.d.ts +140 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +205 -0
- package/dist/errors.js.map +1 -0
- package/dist/gen/index.d.ts +7 -0
- package/dist/gen/index.d.ts.map +1 -0
- package/dist/gen/index.js +7 -0
- package/dist/gen/index.js.map +1 -0
- package/dist/gen/ironflow/v1/index.d.ts +13 -0
- package/dist/gen/ironflow/v1/index.d.ts.map +1 -0
- package/dist/gen/ironflow/v1/index.js +15 -0
- package/dist/gen/ironflow/v1/index.js.map +1 -0
- package/dist/gen/ironflow/v1/ironflow_connect.d.ts +209 -0
- package/dist/gen/ironflow/v1/ironflow_connect.d.ts.map +1 -0
- package/dist/gen/ironflow/v1/ironflow_connect.js +216 -0
- package/dist/gen/ironflow/v1/ironflow_connect.js.map +1 -0
- package/dist/gen/ironflow/v1/ironflow_pb.d.ts +814 -0
- package/dist/gen/ironflow/v1/ironflow_pb.d.ts.map +1 -0
- package/dist/gen/ironflow/v1/ironflow_pb.js +157 -0
- package/dist/gen/ironflow/v1/ironflow_pb.js.map +1 -0
- package/dist/gen/ironflow/v1/pubsub_connect.d.ts +104 -0
- package/dist/gen/ironflow/v1/pubsub_connect.d.ts.map +1 -0
- package/dist/gen/ironflow/v1/pubsub_connect.js +110 -0
- package/dist/gen/ironflow/v1/pubsub_connect.js.map +1 -0
- package/dist/gen/ironflow/v1/pubsub_pb.d.ts +814 -0
- package/dist/gen/ironflow/v1/pubsub_pb.d.ts.map +1 -0
- package/dist/gen/ironflow/v1/pubsub_pb.js +202 -0
- package/dist/gen/ironflow/v1/pubsub_pb.js.map +1 -0
- package/dist/gen/ironflow/v1/types_pb.d.ts +698 -0
- package/dist/gen/ironflow/v1/types_pb.d.ts.map +1 -0
- package/dist/gen/ironflow/v1/types_pb.js +217 -0
- package/dist/gen/ironflow/v1/types_pb.js.map +1 -0
- package/dist/gen/ironflow/v1/worker_connect.d.ts +20 -0
- package/dist/gen/ironflow/v1/worker_connect.d.ts.map +1 -0
- package/dist/gen/ironflow/v1/worker_connect.js +26 -0
- package/dist/gen/ironflow/v1/worker_connect.js.map +1 -0
- package/dist/gen/ironflow/v1/worker_pb.d.ts +685 -0
- package/dist/gen/ironflow/v1/worker_pb.d.ts.map +1 -0
- package/dist/gen/ironflow/v1/worker_pb.js +135 -0
- package/dist/gen/ironflow/v1/worker_pb.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +26 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +78 -0
- package/dist/logger.js.map +1 -0
- package/dist/protocol.d.ts +250 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +34 -0
- package/dist/protocol.js.map +1 -0
- package/dist/schemas.d.ts +394 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +268 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types.d.ts +577 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +49 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +60 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +109 -0
- package/dist/utils.js.map +1 -0
- package/package.json +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @ironflow/core
|
|
2
|
+
|
|
3
|
+
Shared types, schemas, constants, and utilities for the Ironflow JavaScript SDK.
|
|
4
|
+
|
|
5
|
+
> **Note:** You typically don't need to install this package directly. It's automatically included as a dependency of `@ironflow/browser` and `@ironflow/node`.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @ironflow/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Types
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { IronflowEvent, Run, Step, FunctionConfig, Logger } from '@ironflow/core';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Schemas (Zod)
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { EventSchema, RunSchema } from '@ironflow/core';
|
|
25
|
+
|
|
26
|
+
const event = EventSchema.parse(rawData);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Constants
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { DEFAULT_SERVER_URL, STEP_STATUS, RUN_STATUS } from '@ironflow/core';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Error Classes
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { IronflowError, ConnectionError, isRetryable } from '@ironflow/core';
|
|
39
|
+
|
|
40
|
+
if (isRetryable(error)) {
|
|
41
|
+
// Safe to retry
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Utilities
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { generateId, createLogger } from '@ironflow/core';
|
|
49
|
+
|
|
50
|
+
const runId = generateId('run'); // 'run_abc123...'
|
|
51
|
+
const logger = createLogger({ prefix: '[myapp]' });
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Documentation
|
|
55
|
+
|
|
56
|
+
For the full API reference, see the [Core Package Documentation](https://ironflow.dev/docs/api-reference/js-sdk/core).
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default configuration constants for Ironflow SDK.
|
|
3
|
+
*/
|
|
4
|
+
/** Default HTTP server port for Ironflow. */
|
|
5
|
+
export declare const DEFAULT_PORT = 9123;
|
|
6
|
+
/** Default host for Ironflow. */
|
|
7
|
+
export declare const DEFAULT_HOST = "localhost";
|
|
8
|
+
/** Default server URL for Ironflow. */
|
|
9
|
+
export declare const DEFAULT_SERVER_URL = "http://localhost:9123";
|
|
10
|
+
/** Default WebSocket URL for Ironflow. */
|
|
11
|
+
export declare const DEFAULT_WS_URL = "ws://localhost:9123/ws";
|
|
12
|
+
/** Environment variable names */
|
|
13
|
+
export declare const ENV_VARS: {
|
|
14
|
+
/** Environment variable for server URL. */
|
|
15
|
+
readonly SERVER_URL: "IRONFLOW_SERVER_URL";
|
|
16
|
+
/** Environment variable for signing key. */
|
|
17
|
+
readonly SIGNING_KEY: "IRONFLOW_SIGNING_KEY";
|
|
18
|
+
/** Environment variable for API key. */
|
|
19
|
+
readonly API_KEY: "IRONFLOW_API_KEY";
|
|
20
|
+
/** Environment variable for log level (debug, info, warn, error, silent). */
|
|
21
|
+
readonly LOG_LEVEL: "IRONFLOW_LOG_LEVEL";
|
|
22
|
+
};
|
|
23
|
+
/** Default timeout values in milliseconds */
|
|
24
|
+
export declare const DEFAULT_TIMEOUTS: {
|
|
25
|
+
/** Default client timeout (30 seconds). */
|
|
26
|
+
readonly CLIENT: 30000;
|
|
27
|
+
/** Default function timeout (10 minutes). */
|
|
28
|
+
readonly FUNCTION: 600000;
|
|
29
|
+
/** Default trigger sync timeout (30 seconds). */
|
|
30
|
+
readonly TRIGGER_SYNC: 30000;
|
|
31
|
+
};
|
|
32
|
+
/** Default retry configuration for function steps */
|
|
33
|
+
export declare const DEFAULT_RETRY: {
|
|
34
|
+
/** Default maximum retry attempts. */
|
|
35
|
+
readonly MAX_ATTEMPTS: 3;
|
|
36
|
+
/** Default initial delay in milliseconds. */
|
|
37
|
+
readonly INITIAL_DELAY_MS: 1000;
|
|
38
|
+
/** Default backoff factor. */
|
|
39
|
+
readonly BACKOFF_FACTOR: 2;
|
|
40
|
+
/** Default maximum delay in milliseconds (5 minutes). */
|
|
41
|
+
readonly MAX_DELAY_MS: 300000;
|
|
42
|
+
};
|
|
43
|
+
/** Default client retry configuration for HTTP requests */
|
|
44
|
+
export declare const DEFAULT_CLIENT_RETRY: {
|
|
45
|
+
/** Default maximum retry attempts. */
|
|
46
|
+
readonly MAX_ATTEMPTS: 3;
|
|
47
|
+
/** Default initial delay in milliseconds for server errors. */
|
|
48
|
+
readonly INITIAL_DELAY_MS: 100;
|
|
49
|
+
/** Default backoff factor for server errors. */
|
|
50
|
+
readonly BACKOFF_MULTIPLIER: 2;
|
|
51
|
+
/** Default maximum delay in milliseconds (10 seconds). */
|
|
52
|
+
readonly MAX_DELAY_MS: 10000;
|
|
53
|
+
/** Default fixed delay for connection errors in milliseconds (2 seconds). */
|
|
54
|
+
readonly CONNECTION_RETRY_DELAY_MS: 2000;
|
|
55
|
+
};
|
|
56
|
+
/** Default worker configuration */
|
|
57
|
+
export declare const DEFAULT_WORKER: {
|
|
58
|
+
/** Default maximum concurrent jobs. */
|
|
59
|
+
readonly MAX_CONCURRENT_JOBS: 10;
|
|
60
|
+
/** Default heartbeat interval in milliseconds (30 seconds). */
|
|
61
|
+
readonly HEARTBEAT_INTERVAL_MS: 30000;
|
|
62
|
+
/** Default reconnect delay in milliseconds (5 seconds). */
|
|
63
|
+
readonly RECONNECT_DELAY_MS: 5000;
|
|
64
|
+
};
|
|
65
|
+
/** Default reconnection configuration */
|
|
66
|
+
export declare const DEFAULT_RECONNECT: {
|
|
67
|
+
/** Whether auto-reconnect is enabled by default. */
|
|
68
|
+
readonly ENABLED: true;
|
|
69
|
+
/** Maximum reconnection attempts (-1 for infinite). */
|
|
70
|
+
readonly MAX_ATTEMPTS: 10;
|
|
71
|
+
/** Initial backoff delay in milliseconds. */
|
|
72
|
+
readonly INITIAL_DELAY_MS: 1000;
|
|
73
|
+
/** Maximum backoff delay in milliseconds. */
|
|
74
|
+
readonly MAX_DELAY_MS: 30000;
|
|
75
|
+
/** Backoff multiplier. */
|
|
76
|
+
readonly MULTIPLIER: 2;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Get the server URL from environment variable or return the default.
|
|
80
|
+
* Works in both Node.js and browser environments.
|
|
81
|
+
*/
|
|
82
|
+
export declare function getServerUrl(): string;
|
|
83
|
+
/**
|
|
84
|
+
* Get the WebSocket URL from environment variable or return the default.
|
|
85
|
+
* Converts HTTP URLs to WebSocket URLs.
|
|
86
|
+
*/
|
|
87
|
+
export declare function getWebSocketUrl(serverUrl?: string): string;
|
|
88
|
+
/** Step types for workflow execution */
|
|
89
|
+
export declare const STEP_TYPES: {
|
|
90
|
+
/** Invoke a sub-function or external call */
|
|
91
|
+
readonly INVOKE: "invoke";
|
|
92
|
+
/** Sleep/pause execution for a duration */
|
|
93
|
+
readonly SLEEP: "sleep";
|
|
94
|
+
/** Wait for an external event */
|
|
95
|
+
readonly WAIT_FOR_EVENT: "wait_for_event";
|
|
96
|
+
};
|
|
97
|
+
/** Step status values */
|
|
98
|
+
export declare const STEP_STATUS: {
|
|
99
|
+
/** Step completed successfully */
|
|
100
|
+
readonly COMPLETED: "completed";
|
|
101
|
+
/** Step failed with an error */
|
|
102
|
+
readonly FAILED: "failed";
|
|
103
|
+
/** Step is waiting (for sleep or event) */
|
|
104
|
+
readonly WAITING: "waiting";
|
|
105
|
+
};
|
|
106
|
+
/** Run status values */
|
|
107
|
+
export declare const RUN_STATUS: {
|
|
108
|
+
/** Run is pending execution */
|
|
109
|
+
readonly PENDING: "pending";
|
|
110
|
+
/** Run is currently executing */
|
|
111
|
+
readonly RUNNING: "running";
|
|
112
|
+
/** Run completed successfully */
|
|
113
|
+
readonly COMPLETED: "completed";
|
|
114
|
+
/** Run failed with an error */
|
|
115
|
+
readonly FAILED: "failed";
|
|
116
|
+
/** Run was cancelled */
|
|
117
|
+
readonly CANCELLED: "cancelled";
|
|
118
|
+
/** Run is paused (waiting for event or sleep) */
|
|
119
|
+
readonly PAUSED: "paused";
|
|
120
|
+
};
|
|
121
|
+
/** WebSocket message types for pub/sub */
|
|
122
|
+
export declare const WS_MESSAGE_TYPES: {
|
|
123
|
+
/** Subscribe to a pattern */
|
|
124
|
+
readonly SUBSCRIBE: "subscribe";
|
|
125
|
+
/** Unsubscribe from a pattern */
|
|
126
|
+
readonly UNSUBSCRIBE: "unsubscribe";
|
|
127
|
+
/** Acknowledge message receipt */
|
|
128
|
+
readonly ACK: "ack";
|
|
129
|
+
/** Event message from server */
|
|
130
|
+
readonly EVENT: "event";
|
|
131
|
+
/** Subscription result/confirmation */
|
|
132
|
+
readonly SUBSCRIPTION_RESULT: "subscription_result";
|
|
133
|
+
/** Subscription error */
|
|
134
|
+
readonly SUBSCRIPTION_ERROR: "subscription_error";
|
|
135
|
+
/** General error */
|
|
136
|
+
readonly ERROR: "error";
|
|
137
|
+
};
|
|
138
|
+
/** HTTP headers */
|
|
139
|
+
export declare const HTTP_HEADERS: {
|
|
140
|
+
/** Content-Type for JSON */
|
|
141
|
+
readonly CONTENT_TYPE_JSON: "application/json";
|
|
142
|
+
};
|
|
143
|
+
/** JSON headers for fetch requests */
|
|
144
|
+
export declare const JSON_HEADERS: {
|
|
145
|
+
readonly "Content-Type": "application/json";
|
|
146
|
+
};
|
|
147
|
+
/** Error codes returned by the SDK */
|
|
148
|
+
export declare const ERROR_CODES: {
|
|
149
|
+
/** Function not found in registry */
|
|
150
|
+
readonly FUNCTION_NOT_FOUND: "FUNCTION_NOT_FOUND";
|
|
151
|
+
/** Validation error in request */
|
|
152
|
+
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
153
|
+
/** Invalid webhook signature */
|
|
154
|
+
readonly SIGNATURE_INVALID: "SIGNATURE_INVALID";
|
|
155
|
+
/** Network/connection error */
|
|
156
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
157
|
+
/** Server error (5xx) */
|
|
158
|
+
readonly SERVER_ERROR: "SERVER_ERROR";
|
|
159
|
+
/** Timeout error */
|
|
160
|
+
readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
|
|
161
|
+
/** Connection lost */
|
|
162
|
+
readonly CONNECTION_LOST: "CONNECTION_LOST";
|
|
163
|
+
/** Connection refused */
|
|
164
|
+
readonly CONNECTION_REFUSED: "CONNECTION_REFUSED";
|
|
165
|
+
/** Subscription error */
|
|
166
|
+
readonly SUBSCRIPTION_ERROR: "SUBSCRIPTION_ERROR";
|
|
167
|
+
/** Not configured */
|
|
168
|
+
readonly NOT_CONFIGURED: "NOT_CONFIGURED";
|
|
169
|
+
};
|
|
170
|
+
/** ConnectRPC API endpoints */
|
|
171
|
+
export declare const API_ENDPOINTS: {
|
|
172
|
+
/** Trigger a function */
|
|
173
|
+
readonly TRIGGER: "/ironflow.v1.IronflowService/Trigger";
|
|
174
|
+
/** Trigger a function synchronously */
|
|
175
|
+
readonly TRIGGER_SYNC: "/ironflow.v1.IronflowService/TriggerSync";
|
|
176
|
+
/** Get a specific run */
|
|
177
|
+
readonly GET_RUN: "/ironflow.v1.IronflowService/GetRun";
|
|
178
|
+
/** List runs */
|
|
179
|
+
readonly LIST_RUNS: "/ironflow.v1.IronflowService/ListRuns";
|
|
180
|
+
/** Cancel a run */
|
|
181
|
+
readonly CANCEL_RUN: "/ironflow.v1.IronflowService/CancelRun";
|
|
182
|
+
/** Retry a run */
|
|
183
|
+
readonly RETRY_RUN: "/ironflow.v1.IronflowService/RetryRun";
|
|
184
|
+
/** Register a function */
|
|
185
|
+
readonly REGISTER_FUNCTION: "/ironflow.v1.IronflowService/RegisterFunction";
|
|
186
|
+
/** Health check */
|
|
187
|
+
readonly HEALTH: "/ironflow.v1.IronflowService/Health";
|
|
188
|
+
/** Emit an event */
|
|
189
|
+
readonly EMIT: "/ironflow.v1.PubSubService/Emit";
|
|
190
|
+
/** Create a consumer group */
|
|
191
|
+
readonly CREATE_CONSUMER_GROUP: "/ironflow.v1.PubSubService/CreateConsumerGroup";
|
|
192
|
+
/** Get a consumer group */
|
|
193
|
+
readonly GET_CONSUMER_GROUP: "/ironflow.v1.PubSubService/GetConsumerGroup";
|
|
194
|
+
/** List consumer groups */
|
|
195
|
+
readonly LIST_CONSUMER_GROUPS: "/ironflow.v1.PubSubService/ListConsumerGroups";
|
|
196
|
+
/** Delete a consumer group */
|
|
197
|
+
readonly DELETE_CONSUMER_GROUP: "/ironflow.v1.PubSubService/DeleteConsumerGroup";
|
|
198
|
+
};
|
|
199
|
+
/** Timing constants */
|
|
200
|
+
export declare const TIMING: {
|
|
201
|
+
/** Default poll interval in milliseconds */
|
|
202
|
+
readonly POLL_INTERVAL_MS: 1000;
|
|
203
|
+
/** Error retry delay in milliseconds */
|
|
204
|
+
readonly ERROR_RETRY_DELAY_MS: 5000;
|
|
205
|
+
/** Default reconnect delay in milliseconds */
|
|
206
|
+
readonly RECONNECT_DELAY_MS: 1000;
|
|
207
|
+
/** WebSocket normal close code */
|
|
208
|
+
readonly WS_CLOSE_NORMAL: 1000;
|
|
209
|
+
};
|
|
210
|
+
/** Ack types for message acknowledgment */
|
|
211
|
+
export declare const ACK_TYPES: {
|
|
212
|
+
/** Positive acknowledgment */
|
|
213
|
+
readonly ACK: "ack";
|
|
214
|
+
/** Negative acknowledgment (retry) */
|
|
215
|
+
readonly NAK: "nak";
|
|
216
|
+
/** Terminal acknowledgment (no retry) */
|
|
217
|
+
readonly TERM: "term";
|
|
218
|
+
};
|
|
219
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6CAA6C;AAC7C,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,iCAAiC;AACjC,eAAO,MAAM,YAAY,cAAc,CAAC;AAExC,uCAAuC;AACvC,eAAO,MAAM,kBAAkB,0BAA2C,CAAC;AAE3E,0CAA0C;AAC1C,eAAO,MAAM,cAAc,2BAA4C,CAAC;AAExE,iCAAiC;AACjC,eAAO,MAAM,QAAQ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CAAiC;;IAEjC,kCAAkC;;IAElC,gCAAgC;;IAEhC,uCAAuC;;IAEvC,yBAAyB;;IAEzB,oBAAoB;;CAEZ,CAAC;AAEX,mBAAmB;AACnB,eAAO,MAAM,YAAY;IACvB,4BAA4B;;CAEpB,CAAC;AAEX,sCAAsC;AACtC,eAAO,MAAM,YAAY;;CAEf,CAAC;AAEX,sCAAsC;AACtC,eAAO,MAAM,WAAW;IACtB,qCAAqC;;IAErC,kCAAkC;;IAElC,gCAAgC;;IAEhC,+BAA+B;;IAE/B,yBAAyB;;IAEzB,oBAAoB;;IAEpB,sBAAsB;;IAEtB,yBAAyB;;IAEzB,yBAAyB;;IAEzB,qBAAqB;;CAEb,CAAC;AAEX,+BAA+B;AAC/B,eAAO,MAAM,aAAa;IACxB,yBAAyB;;IAEzB,uCAAuC;;IAEvC,yBAAyB;;IAEzB,gBAAgB;;IAEhB,mBAAmB;;IAEnB,kBAAkB;;IAElB,0BAA0B;;IAE1B,mBAAmB;;IAEnB,oBAAoB;;IAEpB,8BAA8B;;IAE9B,2BAA2B;;IAE3B,2BAA2B;;IAE3B,8BAA8B;;CAEtB,CAAC;AAEX,uBAAuB;AACvB,eAAO,MAAM,MAAM;IACjB,4CAA4C;;IAE5C,wCAAwC;;IAExC,8CAA8C;;IAE9C,kCAAkC;;CAE1B,CAAC;AAEX,2CAA2C;AAC3C,eAAO,MAAM,SAAS;IACpB,8BAA8B;;IAE9B,sCAAsC;;IAEtC,yCAAyC;;CAEjC,CAAC"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default configuration constants for Ironflow SDK.
|
|
3
|
+
*/
|
|
4
|
+
/** Default HTTP server port for Ironflow. */
|
|
5
|
+
export const DEFAULT_PORT = 9123;
|
|
6
|
+
/** Default host for Ironflow. */
|
|
7
|
+
export const DEFAULT_HOST = "localhost";
|
|
8
|
+
/** Default server URL for Ironflow. */
|
|
9
|
+
export const DEFAULT_SERVER_URL = `http://${DEFAULT_HOST}:${DEFAULT_PORT}`;
|
|
10
|
+
/** Default WebSocket URL for Ironflow. */
|
|
11
|
+
export const DEFAULT_WS_URL = `ws://${DEFAULT_HOST}:${DEFAULT_PORT}/ws`;
|
|
12
|
+
/** Environment variable names */
|
|
13
|
+
export const ENV_VARS = {
|
|
14
|
+
/** Environment variable for server URL. */
|
|
15
|
+
SERVER_URL: "IRONFLOW_SERVER_URL",
|
|
16
|
+
/** Environment variable for signing key. */
|
|
17
|
+
SIGNING_KEY: "IRONFLOW_SIGNING_KEY",
|
|
18
|
+
/** Environment variable for API key. */
|
|
19
|
+
API_KEY: "IRONFLOW_API_KEY",
|
|
20
|
+
/** Environment variable for log level (debug, info, warn, error, silent). */
|
|
21
|
+
LOG_LEVEL: "IRONFLOW_LOG_LEVEL",
|
|
22
|
+
};
|
|
23
|
+
/** Default timeout values in milliseconds */
|
|
24
|
+
export const DEFAULT_TIMEOUTS = {
|
|
25
|
+
/** Default client timeout (30 seconds). */
|
|
26
|
+
CLIENT: 30_000,
|
|
27
|
+
/** Default function timeout (10 minutes). */
|
|
28
|
+
FUNCTION: 600_000,
|
|
29
|
+
/** Default trigger sync timeout (30 seconds). */
|
|
30
|
+
TRIGGER_SYNC: 30_000,
|
|
31
|
+
};
|
|
32
|
+
/** Default retry configuration for function steps */
|
|
33
|
+
export const DEFAULT_RETRY = {
|
|
34
|
+
/** Default maximum retry attempts. */
|
|
35
|
+
MAX_ATTEMPTS: 3,
|
|
36
|
+
/** Default initial delay in milliseconds. */
|
|
37
|
+
INITIAL_DELAY_MS: 1000,
|
|
38
|
+
/** Default backoff factor. */
|
|
39
|
+
BACKOFF_FACTOR: 2.0,
|
|
40
|
+
/** Default maximum delay in milliseconds (5 minutes). */
|
|
41
|
+
MAX_DELAY_MS: 300_000,
|
|
42
|
+
};
|
|
43
|
+
/** Default client retry configuration for HTTP requests */
|
|
44
|
+
export const DEFAULT_CLIENT_RETRY = {
|
|
45
|
+
/** Default maximum retry attempts. */
|
|
46
|
+
MAX_ATTEMPTS: 3,
|
|
47
|
+
/** Default initial delay in milliseconds for server errors. */
|
|
48
|
+
INITIAL_DELAY_MS: 100,
|
|
49
|
+
/** Default backoff factor for server errors. */
|
|
50
|
+
BACKOFF_MULTIPLIER: 2.0,
|
|
51
|
+
/** Default maximum delay in milliseconds (10 seconds). */
|
|
52
|
+
MAX_DELAY_MS: 10_000,
|
|
53
|
+
/** Default fixed delay for connection errors in milliseconds (2 seconds). */
|
|
54
|
+
CONNECTION_RETRY_DELAY_MS: 2_000,
|
|
55
|
+
};
|
|
56
|
+
/** Default worker configuration */
|
|
57
|
+
export const DEFAULT_WORKER = {
|
|
58
|
+
/** Default maximum concurrent jobs. */
|
|
59
|
+
MAX_CONCURRENT_JOBS: 10,
|
|
60
|
+
/** Default heartbeat interval in milliseconds (30 seconds). */
|
|
61
|
+
HEARTBEAT_INTERVAL_MS: 30_000,
|
|
62
|
+
/** Default reconnect delay in milliseconds (5 seconds). */
|
|
63
|
+
RECONNECT_DELAY_MS: 5_000,
|
|
64
|
+
};
|
|
65
|
+
/** Default reconnection configuration */
|
|
66
|
+
export const DEFAULT_RECONNECT = {
|
|
67
|
+
/** Whether auto-reconnect is enabled by default. */
|
|
68
|
+
ENABLED: true,
|
|
69
|
+
/** Maximum reconnection attempts (-1 for infinite). */
|
|
70
|
+
MAX_ATTEMPTS: 10,
|
|
71
|
+
/** Initial backoff delay in milliseconds. */
|
|
72
|
+
INITIAL_DELAY_MS: 1_000,
|
|
73
|
+
/** Maximum backoff delay in milliseconds. */
|
|
74
|
+
MAX_DELAY_MS: 30_000,
|
|
75
|
+
/** Backoff multiplier. */
|
|
76
|
+
MULTIPLIER: 2,
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Get the server URL from environment variable or return the default.
|
|
80
|
+
* Works in both Node.js and browser environments.
|
|
81
|
+
*/
|
|
82
|
+
export function getServerUrl() {
|
|
83
|
+
if (typeof process !== "undefined" && process.env?.[ENV_VARS.SERVER_URL]) {
|
|
84
|
+
return process.env[ENV_VARS.SERVER_URL];
|
|
85
|
+
}
|
|
86
|
+
return DEFAULT_SERVER_URL;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get the WebSocket URL from environment variable or return the default.
|
|
90
|
+
* Converts HTTP URLs to WebSocket URLs.
|
|
91
|
+
*/
|
|
92
|
+
export function getWebSocketUrl(serverUrl) {
|
|
93
|
+
const url = serverUrl || getServerUrl();
|
|
94
|
+
if (url.startsWith("https://")) {
|
|
95
|
+
return url.replace("https://", "wss://") + "/ws";
|
|
96
|
+
}
|
|
97
|
+
if (url.startsWith("http://")) {
|
|
98
|
+
return url.replace("http://", "ws://") + "/ws";
|
|
99
|
+
}
|
|
100
|
+
return url + "/ws";
|
|
101
|
+
}
|
|
102
|
+
/** Step types for workflow execution */
|
|
103
|
+
export const STEP_TYPES = {
|
|
104
|
+
/** Invoke a sub-function or external call */
|
|
105
|
+
INVOKE: "invoke",
|
|
106
|
+
/** Sleep/pause execution for a duration */
|
|
107
|
+
SLEEP: "sleep",
|
|
108
|
+
/** Wait for an external event */
|
|
109
|
+
WAIT_FOR_EVENT: "wait_for_event",
|
|
110
|
+
};
|
|
111
|
+
/** Step status values */
|
|
112
|
+
export const STEP_STATUS = {
|
|
113
|
+
/** Step completed successfully */
|
|
114
|
+
COMPLETED: "completed",
|
|
115
|
+
/** Step failed with an error */
|
|
116
|
+
FAILED: "failed",
|
|
117
|
+
/** Step is waiting (for sleep or event) */
|
|
118
|
+
WAITING: "waiting",
|
|
119
|
+
};
|
|
120
|
+
/** Run status values */
|
|
121
|
+
export const RUN_STATUS = {
|
|
122
|
+
/** Run is pending execution */
|
|
123
|
+
PENDING: "pending",
|
|
124
|
+
/** Run is currently executing */
|
|
125
|
+
RUNNING: "running",
|
|
126
|
+
/** Run completed successfully */
|
|
127
|
+
COMPLETED: "completed",
|
|
128
|
+
/** Run failed with an error */
|
|
129
|
+
FAILED: "failed",
|
|
130
|
+
/** Run was cancelled */
|
|
131
|
+
CANCELLED: "cancelled",
|
|
132
|
+
/** Run is paused (waiting for event or sleep) */
|
|
133
|
+
PAUSED: "paused",
|
|
134
|
+
};
|
|
135
|
+
/** WebSocket message types for pub/sub */
|
|
136
|
+
export const WS_MESSAGE_TYPES = {
|
|
137
|
+
/** Subscribe to a pattern */
|
|
138
|
+
SUBSCRIBE: "subscribe",
|
|
139
|
+
/** Unsubscribe from a pattern */
|
|
140
|
+
UNSUBSCRIBE: "unsubscribe",
|
|
141
|
+
/** Acknowledge message receipt */
|
|
142
|
+
ACK: "ack",
|
|
143
|
+
/** Event message from server */
|
|
144
|
+
EVENT: "event",
|
|
145
|
+
/** Subscription result/confirmation */
|
|
146
|
+
SUBSCRIPTION_RESULT: "subscription_result",
|
|
147
|
+
/** Subscription error */
|
|
148
|
+
SUBSCRIPTION_ERROR: "subscription_error",
|
|
149
|
+
/** General error */
|
|
150
|
+
ERROR: "error",
|
|
151
|
+
};
|
|
152
|
+
/** HTTP headers */
|
|
153
|
+
export const HTTP_HEADERS = {
|
|
154
|
+
/** Content-Type for JSON */
|
|
155
|
+
CONTENT_TYPE_JSON: "application/json",
|
|
156
|
+
};
|
|
157
|
+
/** JSON headers for fetch requests */
|
|
158
|
+
export const JSON_HEADERS = {
|
|
159
|
+
"Content-Type": HTTP_HEADERS.CONTENT_TYPE_JSON,
|
|
160
|
+
};
|
|
161
|
+
/** Error codes returned by the SDK */
|
|
162
|
+
export const ERROR_CODES = {
|
|
163
|
+
/** Function not found in registry */
|
|
164
|
+
FUNCTION_NOT_FOUND: "FUNCTION_NOT_FOUND",
|
|
165
|
+
/** Validation error in request */
|
|
166
|
+
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
167
|
+
/** Invalid webhook signature */
|
|
168
|
+
SIGNATURE_INVALID: "SIGNATURE_INVALID",
|
|
169
|
+
/** Network/connection error */
|
|
170
|
+
NETWORK_ERROR: "NETWORK_ERROR",
|
|
171
|
+
/** Server error (5xx) */
|
|
172
|
+
SERVER_ERROR: "SERVER_ERROR",
|
|
173
|
+
/** Timeout error */
|
|
174
|
+
TIMEOUT_ERROR: "TIMEOUT_ERROR",
|
|
175
|
+
/** Connection lost */
|
|
176
|
+
CONNECTION_LOST: "CONNECTION_LOST",
|
|
177
|
+
/** Connection refused */
|
|
178
|
+
CONNECTION_REFUSED: "CONNECTION_REFUSED",
|
|
179
|
+
/** Subscription error */
|
|
180
|
+
SUBSCRIPTION_ERROR: "SUBSCRIPTION_ERROR",
|
|
181
|
+
/** Not configured */
|
|
182
|
+
NOT_CONFIGURED: "NOT_CONFIGURED",
|
|
183
|
+
};
|
|
184
|
+
/** ConnectRPC API endpoints */
|
|
185
|
+
export const API_ENDPOINTS = {
|
|
186
|
+
/** Trigger a function */
|
|
187
|
+
TRIGGER: "/ironflow.v1.IronflowService/Trigger",
|
|
188
|
+
/** Trigger a function synchronously */
|
|
189
|
+
TRIGGER_SYNC: "/ironflow.v1.IronflowService/TriggerSync",
|
|
190
|
+
/** Get a specific run */
|
|
191
|
+
GET_RUN: "/ironflow.v1.IronflowService/GetRun",
|
|
192
|
+
/** List runs */
|
|
193
|
+
LIST_RUNS: "/ironflow.v1.IronflowService/ListRuns",
|
|
194
|
+
/** Cancel a run */
|
|
195
|
+
CANCEL_RUN: "/ironflow.v1.IronflowService/CancelRun",
|
|
196
|
+
/** Retry a run */
|
|
197
|
+
RETRY_RUN: "/ironflow.v1.IronflowService/RetryRun",
|
|
198
|
+
/** Register a function */
|
|
199
|
+
REGISTER_FUNCTION: "/ironflow.v1.IronflowService/RegisterFunction",
|
|
200
|
+
/** Health check */
|
|
201
|
+
HEALTH: "/ironflow.v1.IronflowService/Health",
|
|
202
|
+
/** Emit an event */
|
|
203
|
+
EMIT: "/ironflow.v1.PubSubService/Emit",
|
|
204
|
+
/** Create a consumer group */
|
|
205
|
+
CREATE_CONSUMER_GROUP: "/ironflow.v1.PubSubService/CreateConsumerGroup",
|
|
206
|
+
/** Get a consumer group */
|
|
207
|
+
GET_CONSUMER_GROUP: "/ironflow.v1.PubSubService/GetConsumerGroup",
|
|
208
|
+
/** List consumer groups */
|
|
209
|
+
LIST_CONSUMER_GROUPS: "/ironflow.v1.PubSubService/ListConsumerGroups",
|
|
210
|
+
/** Delete a consumer group */
|
|
211
|
+
DELETE_CONSUMER_GROUP: "/ironflow.v1.PubSubService/DeleteConsumerGroup",
|
|
212
|
+
};
|
|
213
|
+
/** Timing constants */
|
|
214
|
+
export const TIMING = {
|
|
215
|
+
/** Default poll interval in milliseconds */
|
|
216
|
+
POLL_INTERVAL_MS: 1000,
|
|
217
|
+
/** Error retry delay in milliseconds */
|
|
218
|
+
ERROR_RETRY_DELAY_MS: 5000,
|
|
219
|
+
/** Default reconnect delay in milliseconds */
|
|
220
|
+
RECONNECT_DELAY_MS: 1000,
|
|
221
|
+
/** WebSocket normal close code */
|
|
222
|
+
WS_CLOSE_NORMAL: 1000,
|
|
223
|
+
};
|
|
224
|
+
/** Ack types for message acknowledgment */
|
|
225
|
+
export const ACK_TYPES = {
|
|
226
|
+
/** Positive acknowledgment */
|
|
227
|
+
ACK: "ack",
|
|
228
|
+
/** Negative acknowledgment (retry) */
|
|
229
|
+
NAK: "nak",
|
|
230
|
+
/** Terminal acknowledgment (no retry) */
|
|
231
|
+
TERM: "term",
|
|
232
|
+
};
|
|
233
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6CAA6C;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AAEjC,iCAAiC;AACjC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;AAExC,uCAAuC;AACvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,YAAY,IAAI,YAAY,EAAE,CAAC;AAE3E,0CAA0C;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,YAAY,IA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+
*
|
|
4
|
+
* Provides a hierarchy of error types for different failure scenarios.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base error class for all Ironflow errors
|
|
8
|
+
*/
|
|
9
|
+
export declare class IronflowError extends Error {
|
|
10
|
+
/** Error code for programmatic handling */
|
|
11
|
+
readonly code: string;
|
|
12
|
+
/** Whether this error is retryable */
|
|
13
|
+
readonly retryable: boolean;
|
|
14
|
+
/** Additional error details */
|
|
15
|
+
readonly details?: Record<string, unknown>;
|
|
16
|
+
constructor(message: string, options?: {
|
|
17
|
+
code?: string;
|
|
18
|
+
retryable?: boolean;
|
|
19
|
+
details?: Record<string, unknown>;
|
|
20
|
+
cause?: Error;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error thrown when a connection is lost
|
|
25
|
+
*/
|
|
26
|
+
export declare class ConnectionError extends IronflowError {
|
|
27
|
+
constructor(message: string, options?: {
|
|
28
|
+
cause?: Error;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Error thrown when a subscription fails
|
|
33
|
+
*/
|
|
34
|
+
export declare class SubscriptionError extends IronflowError {
|
|
35
|
+
/** The subscription ID that failed */
|
|
36
|
+
readonly subscriptionId?: string;
|
|
37
|
+
constructor(message: string, options?: {
|
|
38
|
+
subscriptionId?: string;
|
|
39
|
+
code?: string;
|
|
40
|
+
retryable?: boolean;
|
|
41
|
+
cause?: Error;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Error thrown when a request times out
|
|
46
|
+
*/
|
|
47
|
+
export declare class TimeoutError extends IronflowError {
|
|
48
|
+
/** The timeout duration in milliseconds */
|
|
49
|
+
readonly timeoutMs: number;
|
|
50
|
+
constructor(message: string, timeoutMs: number, options?: {
|
|
51
|
+
cause?: Error;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Error thrown when validation fails
|
|
56
|
+
*/
|
|
57
|
+
export declare class ValidationError extends IronflowError {
|
|
58
|
+
/** The validation errors */
|
|
59
|
+
readonly validationErrors?: string[];
|
|
60
|
+
constructor(message: string, options?: {
|
|
61
|
+
validationErrors?: string[];
|
|
62
|
+
cause?: Error;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Error thrown when schema validation fails
|
|
67
|
+
*/
|
|
68
|
+
export declare class SchemaValidationError extends ValidationError {
|
|
69
|
+
constructor(message: string, options?: {
|
|
70
|
+
validationErrors?: string[];
|
|
71
|
+
cause?: Error;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Error thrown when a signature is invalid
|
|
76
|
+
*/
|
|
77
|
+
export declare class SignatureError extends IronflowError {
|
|
78
|
+
constructor(message: string, options?: {
|
|
79
|
+
cause?: Error;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Error thrown when a function is not found
|
|
84
|
+
*/
|
|
85
|
+
export declare class FunctionNotFoundError extends IronflowError {
|
|
86
|
+
/** The function ID that was not found */
|
|
87
|
+
readonly functionId: string;
|
|
88
|
+
constructor(functionId: string, options?: {
|
|
89
|
+
cause?: Error;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Error thrown when a run is not found
|
|
94
|
+
*/
|
|
95
|
+
export declare class RunNotFoundError extends IronflowError {
|
|
96
|
+
/** The run ID that was not found */
|
|
97
|
+
readonly runId: string;
|
|
98
|
+
constructor(runId: string, options?: {
|
|
99
|
+
cause?: Error;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Error thrown when a step fails
|
|
104
|
+
*/
|
|
105
|
+
export declare class StepError extends IronflowError {
|
|
106
|
+
/** The step ID that failed */
|
|
107
|
+
readonly stepId: string;
|
|
108
|
+
/** The step name that failed */
|
|
109
|
+
readonly stepName: string;
|
|
110
|
+
constructor(message: string, options: {
|
|
111
|
+
stepId: string;
|
|
112
|
+
stepName: string;
|
|
113
|
+
retryable?: boolean;
|
|
114
|
+
cause?: Error;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Error thrown for non-retryable failures
|
|
119
|
+
*/
|
|
120
|
+
export declare class NonRetryableError extends IronflowError {
|
|
121
|
+
constructor(message: string, options?: {
|
|
122
|
+
code?: string;
|
|
123
|
+
cause?: Error;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Error thrown when the client is not configured
|
|
128
|
+
*/
|
|
129
|
+
export declare class NotConfiguredError extends IronflowError {
|
|
130
|
+
constructor(message?: string);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Check if an error is retryable
|
|
134
|
+
*/
|
|
135
|
+
export declare function isRetryable(error: unknown): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Type guard to check if an error is an IronflowError
|
|
138
|
+
*/
|
|
139
|
+
export declare function isIronflowError(error: unknown): error is IronflowError;
|
|
140
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAGzC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,C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