@ironflow/browser 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 +70 -0
- package/dist/client.d.ts +171 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +443 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +87 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +53 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/subscription.d.ts +85 -0
- package/dist/subscription.d.ts.map +1 -0
- package/dist/subscription.js +263 -0
- package/dist/subscription.js.map +1 -0
- package/dist/transport/connectrpc.d.ts +60 -0
- package/dist/transport/connectrpc.d.ts.map +1 -0
- package/dist/transport/connectrpc.js +298 -0
- package/dist/transport/connectrpc.js.map +1 -0
- package/dist/transport/index.d.ts +7 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +6 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/types.d.ts +65 -0
- package/dist/transport/types.d.ts.map +1 -0
- package/dist/transport/types.js +5 -0
- package/dist/transport/types.js.map +1 -0
- package/dist/transport/websocket.d.ts +38 -0
- package/dist/transport/websocket.d.ts.map +1 -0
- package/dist/transport/websocket.js +240 -0
- package/dist/transport/websocket.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket transport implementation
|
|
3
|
+
*/
|
|
4
|
+
import { getWebSocketUrl, WSServerMessageSchema, calculateBackoff, } from "@ironflow/core";
|
|
5
|
+
/**
|
|
6
|
+
* WebSocket-based transport for subscriptions
|
|
7
|
+
*/
|
|
8
|
+
export class WebSocketTransport {
|
|
9
|
+
wsUrl;
|
|
10
|
+
options;
|
|
11
|
+
callbacks;
|
|
12
|
+
ws = null;
|
|
13
|
+
_connectionState = "disconnected";
|
|
14
|
+
reconnectAttempt = 0;
|
|
15
|
+
reconnectTimer = null;
|
|
16
|
+
paused = false;
|
|
17
|
+
pendingSubscriptions = new Map();
|
|
18
|
+
constructor(serverUrl, options) {
|
|
19
|
+
this.wsUrl = getWebSocketUrl(serverUrl);
|
|
20
|
+
this.options = options;
|
|
21
|
+
}
|
|
22
|
+
get connectionState() {
|
|
23
|
+
return this._connectionState;
|
|
24
|
+
}
|
|
25
|
+
setCallbacks(callbacks) {
|
|
26
|
+
this.callbacks = callbacks;
|
|
27
|
+
}
|
|
28
|
+
async connect() {
|
|
29
|
+
if (this._connectionState === "connected") {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (this.paused) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
this._connectionState = "connecting";
|
|
37
|
+
this.callbacks?.onConnectionChange("connecting");
|
|
38
|
+
try {
|
|
39
|
+
this.ws = new WebSocket(this.wsUrl);
|
|
40
|
+
this.ws.onopen = () => {
|
|
41
|
+
this._connectionState = "connected";
|
|
42
|
+
this.reconnectAttempt = 0;
|
|
43
|
+
this.callbacks?.onConnectionChange("connected");
|
|
44
|
+
// Re-subscribe all pending subscriptions
|
|
45
|
+
for (const [pattern, options] of this.pendingSubscriptions) {
|
|
46
|
+
this.sendSubscribe(pattern, options);
|
|
47
|
+
}
|
|
48
|
+
resolve();
|
|
49
|
+
};
|
|
50
|
+
this.ws.onclose = (event) => {
|
|
51
|
+
const wasConnected = this._connectionState === "connected";
|
|
52
|
+
this._connectionState = "disconnected";
|
|
53
|
+
this.callbacks?.onConnectionChange("disconnected");
|
|
54
|
+
// Attempt reconnection if enabled and not a clean close
|
|
55
|
+
if (this.options.autoReconnect &&
|
|
56
|
+
!this.paused &&
|
|
57
|
+
event.code !== 1000) {
|
|
58
|
+
this.scheduleReconnect();
|
|
59
|
+
}
|
|
60
|
+
if (!wasConnected && this._connectionState === "disconnected") {
|
|
61
|
+
reject(new Error("WebSocket connection failed"));
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
this.ws.onerror = () => {
|
|
65
|
+
if (this._connectionState === "connecting") {
|
|
66
|
+
reject(new Error("WebSocket connection error"));
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
this.ws.onmessage = (event) => {
|
|
70
|
+
this.handleMessage(event.data);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
this._connectionState = "disconnected";
|
|
75
|
+
reject(error);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
disconnect() {
|
|
80
|
+
this.clearReconnectTimer();
|
|
81
|
+
this.paused = false;
|
|
82
|
+
if (this.ws) {
|
|
83
|
+
const ws = this.ws;
|
|
84
|
+
this.ws = null;
|
|
85
|
+
ws.close(1000, "Client disconnect");
|
|
86
|
+
}
|
|
87
|
+
this._connectionState = "disconnected";
|
|
88
|
+
this.pendingSubscriptions.clear();
|
|
89
|
+
}
|
|
90
|
+
subscribe(pattern, options) {
|
|
91
|
+
this.pendingSubscriptions.set(pattern, options);
|
|
92
|
+
if (this._connectionState === "connected") {
|
|
93
|
+
this.sendSubscribe(pattern, options);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
unsubscribe(subscriptionId) {
|
|
97
|
+
// Remove from pending if pattern matches
|
|
98
|
+
// Note: We don't have pattern->id mapping here, so we just send unsubscribe
|
|
99
|
+
if (this._connectionState === "connected" && this.ws) {
|
|
100
|
+
const request = {
|
|
101
|
+
type: "unsubscribe",
|
|
102
|
+
subscriptionId,
|
|
103
|
+
};
|
|
104
|
+
this.ws.send(JSON.stringify(request));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async ack(eventId, type, delay) {
|
|
108
|
+
if (this._connectionState !== "connected" || !this.ws) {
|
|
109
|
+
throw new Error("Not connected");
|
|
110
|
+
}
|
|
111
|
+
const request = {
|
|
112
|
+
type: "ack",
|
|
113
|
+
eventId,
|
|
114
|
+
ackType: type,
|
|
115
|
+
};
|
|
116
|
+
if (delay !== undefined && type === "nak") {
|
|
117
|
+
request.redeliverDelay = delay;
|
|
118
|
+
}
|
|
119
|
+
this.ws.send(JSON.stringify(request));
|
|
120
|
+
}
|
|
121
|
+
pause() {
|
|
122
|
+
this.paused = true;
|
|
123
|
+
this.clearReconnectTimer();
|
|
124
|
+
if (this.ws) {
|
|
125
|
+
this.ws.close(1000, "Paused");
|
|
126
|
+
this.ws = null;
|
|
127
|
+
}
|
|
128
|
+
this._connectionState = "disconnected";
|
|
129
|
+
this.callbacks?.onConnectionChange("disconnected");
|
|
130
|
+
}
|
|
131
|
+
resume() {
|
|
132
|
+
this.paused = false;
|
|
133
|
+
this.connect().catch(() => {
|
|
134
|
+
// Will retry via reconnect logic
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
sendSubscribe(pattern, options) {
|
|
138
|
+
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const request = {
|
|
142
|
+
type: "subscribe",
|
|
143
|
+
subscription: {
|
|
144
|
+
pattern,
|
|
145
|
+
options: options
|
|
146
|
+
? {
|
|
147
|
+
replay: options.replay,
|
|
148
|
+
includeMetadata: options.includeMetadata,
|
|
149
|
+
filter: options.filter,
|
|
150
|
+
consumerGroup: options.consumerGroup,
|
|
151
|
+
ackMode: options.ackMode,
|
|
152
|
+
backpressure: options.backpressure,
|
|
153
|
+
namespace: options.namespace,
|
|
154
|
+
}
|
|
155
|
+
: undefined,
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
this.ws.send(JSON.stringify(request));
|
|
159
|
+
}
|
|
160
|
+
handleMessage(data) {
|
|
161
|
+
let parsed;
|
|
162
|
+
try {
|
|
163
|
+
parsed = JSON.parse(data);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const result = WSServerMessageSchema.safeParse(parsed);
|
|
169
|
+
if (!result.success) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const message = result.data;
|
|
173
|
+
switch (message.type) {
|
|
174
|
+
case "subscription_result":
|
|
175
|
+
for (const sub of message.results) {
|
|
176
|
+
if (sub.status === "ok" && sub.subscriptionId) {
|
|
177
|
+
this.callbacks?.onSubscribed(sub.pattern, sub.subscriptionId);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
this.callbacks?.onSubscribeFailed(sub.pattern, new Error(sub.message ?? `Subscription failed: ${sub.code}`));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case "event":
|
|
185
|
+
{
|
|
186
|
+
const event = {
|
|
187
|
+
topic: message.topic,
|
|
188
|
+
data: message.data,
|
|
189
|
+
meta: message.meta,
|
|
190
|
+
eventId: message.eventId,
|
|
191
|
+
};
|
|
192
|
+
this.callbacks?.onEvent(message.subscriptionId, event);
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
case "subscription_error":
|
|
196
|
+
this.callbacks?.onError(message.subscriptionId, {
|
|
197
|
+
subscriptionId: message.subscriptionId,
|
|
198
|
+
code: message.code,
|
|
199
|
+
message: message.message,
|
|
200
|
+
retrying: message.retrying,
|
|
201
|
+
});
|
|
202
|
+
break;
|
|
203
|
+
case "error":
|
|
204
|
+
// Broadcast to all subscriptions
|
|
205
|
+
this.callbacks?.onError("", {
|
|
206
|
+
code: message.code,
|
|
207
|
+
message: message.message,
|
|
208
|
+
});
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
scheduleReconnect() {
|
|
213
|
+
if (this.reconnectTimer || this.paused) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
this._connectionState = "reconnecting";
|
|
217
|
+
this.callbacks?.onConnectionChange("reconnecting");
|
|
218
|
+
this.reconnectAttempt++;
|
|
219
|
+
const delay = calculateBackoff(this.reconnectAttempt, this.options.reconnectDelay, this.options.maxReconnectDelay, this.options.reconnectBackoff);
|
|
220
|
+
this.reconnectTimer = setTimeout(() => {
|
|
221
|
+
this.reconnectTimer = null;
|
|
222
|
+
this.connect().catch(() => {
|
|
223
|
+
// Will trigger another reconnect via onclose
|
|
224
|
+
});
|
|
225
|
+
}, delay);
|
|
226
|
+
}
|
|
227
|
+
clearReconnectTimer() {
|
|
228
|
+
if (this.reconnectTimer) {
|
|
229
|
+
clearTimeout(this.reconnectTimer);
|
|
230
|
+
this.reconnectTimer = null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Create a WebSocket transport
|
|
236
|
+
*/
|
|
237
|
+
export function createWebSocketTransport(serverUrl, options) {
|
|
238
|
+
return new WebSocketTransport(serverUrl, options);
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=websocket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../src/transport/websocket.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,gBAAgB,GAIjB,MAAM,gBAAgB,CAAC;AAGxB;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACZ,KAAK,CAAS;IACd,OAAO,CAAmB;IACnC,SAAS,CAAsB;IAC/B,EAAE,GAAqB,IAAI,CAAC;IAC5B,gBAAgB,GAAoB,cAAc,CAAC;IACnD,gBAAgB,GAAG,CAAC,CAAC;IACrB,cAAc,GAAyC,IAAI,CAAC;IAC5D,MAAM,GAAG,KAAK,CAAC;IACf,oBAAoB,GAA8C,IAAI,GAAG,EAAE,CAAC;IAEpF,YAAY,SAAiB,EAAE,OAAyB;QACtD,IAAI,CAAC,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAI,eAAe;QACjB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cAAc,GAAG,IAAI,CAAC;QAC7B,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,SAAiB,EACjB,OAAyB;IAEzB,OAAO,IAAI,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ironflow/browser",
|
|
3
|
+
"version": "0.1.0-test.2",
|
|
4
|
+
"description": "Browser client for Ironflow workflow engine - real-time subscriptions, workflow triggers, and event emission",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@bufbuild/protobuf": "^2.5.1",
|
|
21
|
+
"@connectrpc/connect": "^2.1.1",
|
|
22
|
+
"@connectrpc/connect-web": "^2.1.1",
|
|
23
|
+
"zod": "^4.3.5",
|
|
24
|
+
"@ironflow/core": "0.1.0-test.2"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^22.14.0",
|
|
28
|
+
"jsdom": "^26.0.0",
|
|
29
|
+
"typescript": "^5.9.3",
|
|
30
|
+
"vitest": "^2.1.9"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"typescript": ">=5.0.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"typescript": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=20.0.0"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"ironflow",
|
|
45
|
+
"workflow",
|
|
46
|
+
"browser",
|
|
47
|
+
"client",
|
|
48
|
+
"real-time",
|
|
49
|
+
"subscriptions"
|
|
50
|
+
],
|
|
51
|
+
"author": "Ironflow",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "https://github.com/ironflowapp/ironflow.git",
|
|
56
|
+
"directory": "sdk/js/browser"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "restricted"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsc",
|
|
63
|
+
"dev": "tsc --watch",
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:watch": "vitest",
|
|
66
|
+
"lint": "eslint src/",
|
|
67
|
+
"clean": "rm -rf dist",
|
|
68
|
+
"typecheck": "tsc --noEmit"
|
|
69
|
+
}
|
|
70
|
+
}
|