@tthr/client 0.0.1
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/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +231 -0
- package/dist/index.js.map +1 -0
- package/package.json +25 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tthr/client - Tether core client
|
|
3
|
+
*
|
|
4
|
+
* Framework-agnostic client for connecting to Tether servers.
|
|
5
|
+
*/
|
|
6
|
+
export interface TetherClientOptions {
|
|
7
|
+
/** WebSocket URL (e.g., wss://tthr.io/project-id) */
|
|
8
|
+
url: string;
|
|
9
|
+
/** Function to get auth token */
|
|
10
|
+
authToken?: () => string | Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
type SubscriptionCallback<T = unknown> = (data: T) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Tether client for connecting to the server
|
|
15
|
+
*/
|
|
16
|
+
export declare class TetherClient {
|
|
17
|
+
private options;
|
|
18
|
+
private ws;
|
|
19
|
+
private subscriptions;
|
|
20
|
+
private pendingRequests;
|
|
21
|
+
private connectionId;
|
|
22
|
+
private reconnectAttempts;
|
|
23
|
+
private maxReconnectAttempts;
|
|
24
|
+
private reconnectDelay;
|
|
25
|
+
constructor(options: TetherClientOptions);
|
|
26
|
+
/**
|
|
27
|
+
* Connect to the Tether server
|
|
28
|
+
*/
|
|
29
|
+
connect(): Promise<void>;
|
|
30
|
+
private createWebSocket;
|
|
31
|
+
private handleMessage;
|
|
32
|
+
private handleReconnect;
|
|
33
|
+
/**
|
|
34
|
+
* Execute a query
|
|
35
|
+
*/
|
|
36
|
+
query<T = unknown>(name: string, args?: unknown): Promise<T>;
|
|
37
|
+
/**
|
|
38
|
+
* Execute a mutation
|
|
39
|
+
*/
|
|
40
|
+
mutation<T = unknown>(name: string, args?: unknown): Promise<T>;
|
|
41
|
+
/**
|
|
42
|
+
* Subscribe to a query
|
|
43
|
+
*/
|
|
44
|
+
subscribe<T = unknown>(query: string, args: unknown, callback: SubscriptionCallback<T>): () => void;
|
|
45
|
+
private sendSubscribe;
|
|
46
|
+
private send;
|
|
47
|
+
private generateId;
|
|
48
|
+
/**
|
|
49
|
+
* Disconnect from the server
|
|
50
|
+
*/
|
|
51
|
+
disconnect(): void;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5C;AAED,KAAK,oBAAoB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;AAoB3D;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,aAAa,CAAwC;IAC7D,OAAO,CAAC,eAAe,CAAgG;IACvH,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,cAAc,CAAQ;gBAElB,OAAO,EAAE,mBAAmB;IAIxC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA6B9B,OAAO,CAAC,eAAe;IAoCvB,OAAO,CAAC,aAAa;IAgDrB,OAAO,CAAC,eAAe;IAsBvB;;OAEG;IACG,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAwBlE;;OAEG;IACG,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAyBrE;;OAEG;IACH,SAAS,CAAC,CAAC,GAAG,OAAO,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAChC,MAAM,IAAI;IAuBb,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,UAAU;IAIlB;;OAEG;IACH,UAAU,IAAI,IAAI;CASnB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tthr/client - Tether core client
|
|
3
|
+
*
|
|
4
|
+
* Framework-agnostic client for connecting to Tether servers.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Tether client for connecting to the server
|
|
8
|
+
*/
|
|
9
|
+
export class TetherClient {
|
|
10
|
+
options;
|
|
11
|
+
ws = null;
|
|
12
|
+
subscriptions = new Map();
|
|
13
|
+
pendingRequests = new Map();
|
|
14
|
+
connectionId = null;
|
|
15
|
+
reconnectAttempts = 0;
|
|
16
|
+
maxReconnectAttempts = 5;
|
|
17
|
+
reconnectDelay = 1000;
|
|
18
|
+
constructor(options) {
|
|
19
|
+
this.options = options;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Connect to the Tether server
|
|
23
|
+
*/
|
|
24
|
+
async connect() {
|
|
25
|
+
if (this.ws?.readyState === WebSocket.OPEN) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
let url = this.options.url;
|
|
30
|
+
// Add auth token if available
|
|
31
|
+
if (this.options.authToken) {
|
|
32
|
+
const token = typeof this.options.authToken === 'function'
|
|
33
|
+
? this.options.authToken()
|
|
34
|
+
: this.options.authToken;
|
|
35
|
+
if (token instanceof Promise) {
|
|
36
|
+
token.then((t) => {
|
|
37
|
+
url = `${url}?token=${t}`;
|
|
38
|
+
this.createWebSocket(url, resolve, reject);
|
|
39
|
+
});
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
url = `${url}?token=${token}`;
|
|
43
|
+
}
|
|
44
|
+
this.createWebSocket(url, resolve, reject);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
createWebSocket(url, resolve, reject) {
|
|
48
|
+
this.ws = new WebSocket(url);
|
|
49
|
+
this.ws.onopen = () => {
|
|
50
|
+
this.reconnectAttempts = 0;
|
|
51
|
+
// Wait for 'connected' message before resolving
|
|
52
|
+
};
|
|
53
|
+
this.ws.onmessage = (event) => {
|
|
54
|
+
this.handleMessage(event.data);
|
|
55
|
+
// Resolve connect promise when we get the connected message
|
|
56
|
+
if (!this.connectionId) {
|
|
57
|
+
const msg = JSON.parse(event.data);
|
|
58
|
+
if (msg.type === 'connected') {
|
|
59
|
+
this.connectionId = msg.connection_id ?? null;
|
|
60
|
+
resolve();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
this.ws.onerror = (error) => {
|
|
65
|
+
console.error('Tether WebSocket error:', error);
|
|
66
|
+
reject(new Error('WebSocket connection failed'));
|
|
67
|
+
};
|
|
68
|
+
this.ws.onclose = () => {
|
|
69
|
+
this.connectionId = null;
|
|
70
|
+
this.handleReconnect();
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
handleMessage(data) {
|
|
74
|
+
try {
|
|
75
|
+
const message = JSON.parse(data);
|
|
76
|
+
switch (message.type) {
|
|
77
|
+
case 'connected':
|
|
78
|
+
this.connectionId = message.connection_id ?? null;
|
|
79
|
+
break;
|
|
80
|
+
case 'data':
|
|
81
|
+
if (message.id) {
|
|
82
|
+
const sub = this.subscriptions.get(message.id);
|
|
83
|
+
if (sub) {
|
|
84
|
+
sub.callback(message.data);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case 'mutation_result':
|
|
89
|
+
case 'action_result':
|
|
90
|
+
if (message.id) {
|
|
91
|
+
const pending = this.pendingRequests.get(message.id);
|
|
92
|
+
if (pending) {
|
|
93
|
+
pending.resolve(message.data);
|
|
94
|
+
this.pendingRequests.delete(message.id);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
case 'error':
|
|
99
|
+
if (message.id) {
|
|
100
|
+
const pending = this.pendingRequests.get(message.id);
|
|
101
|
+
if (pending) {
|
|
102
|
+
pending.reject(new Error(message.error?.message ?? 'Unknown error'));
|
|
103
|
+
this.pendingRequests.delete(message.id);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
case 'pong':
|
|
108
|
+
// Heartbeat acknowledged
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
console.error('Failed to parse Tether message:', e);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
handleReconnect() {
|
|
117
|
+
if (this.reconnectAttempts >= this.maxReconnectAttempts) {
|
|
118
|
+
console.error('Tether: Max reconnection attempts reached');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this.reconnectAttempts++;
|
|
122
|
+
const delay = this.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1);
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
console.log(`Tether: Attempting reconnection (${this.reconnectAttempts}/${this.maxReconnectAttempts})`);
|
|
125
|
+
this.connect().then(() => {
|
|
126
|
+
// Re-subscribe to all active subscriptions
|
|
127
|
+
for (const [id, sub] of this.subscriptions) {
|
|
128
|
+
this.sendSubscribe(id, sub.query, sub.args);
|
|
129
|
+
}
|
|
130
|
+
}).catch(() => {
|
|
131
|
+
// Will retry via onclose handler
|
|
132
|
+
});
|
|
133
|
+
}, delay);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Execute a query
|
|
137
|
+
*/
|
|
138
|
+
async query(name, args) {
|
|
139
|
+
await this.connect();
|
|
140
|
+
// For queries, we use HTTP for simplicity
|
|
141
|
+
// (subscriptions use WebSocket)
|
|
142
|
+
const httpUrl = this.options.url.replace('wss://', 'https://').replace('ws://', 'http://').replace('/ws/', '/api/v1/') + '/query';
|
|
143
|
+
const response = await fetch(httpUrl, {
|
|
144
|
+
method: 'POST',
|
|
145
|
+
headers: {
|
|
146
|
+
'Content-Type': 'application/json',
|
|
147
|
+
// TODO: Add auth header
|
|
148
|
+
},
|
|
149
|
+
body: JSON.stringify({ function: name, args }),
|
|
150
|
+
});
|
|
151
|
+
if (!response.ok) {
|
|
152
|
+
throw new Error(`Query failed: ${response.statusText}`);
|
|
153
|
+
}
|
|
154
|
+
const result = await response.json();
|
|
155
|
+
return result.data;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Execute a mutation
|
|
159
|
+
*/
|
|
160
|
+
async mutation(name, args) {
|
|
161
|
+
await this.connect();
|
|
162
|
+
const id = this.generateId();
|
|
163
|
+
return new Promise((resolve, reject) => {
|
|
164
|
+
this.pendingRequests.set(id, { resolve: resolve, reject });
|
|
165
|
+
this.send({
|
|
166
|
+
type: 'mutation',
|
|
167
|
+
id,
|
|
168
|
+
function: name,
|
|
169
|
+
args,
|
|
170
|
+
});
|
|
171
|
+
// Timeout after 30 seconds
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
if (this.pendingRequests.has(id)) {
|
|
174
|
+
this.pendingRequests.delete(id);
|
|
175
|
+
reject(new Error('Mutation timeout'));
|
|
176
|
+
}
|
|
177
|
+
}, 30000);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Subscribe to a query
|
|
182
|
+
*/
|
|
183
|
+
subscribe(query, args, callback) {
|
|
184
|
+
const id = this.generateId();
|
|
185
|
+
this.subscriptions.set(id, {
|
|
186
|
+
query,
|
|
187
|
+
args,
|
|
188
|
+
callback: callback,
|
|
189
|
+
});
|
|
190
|
+
// Send subscribe message if connected
|
|
191
|
+
if (this.ws?.readyState === WebSocket.OPEN) {
|
|
192
|
+
this.sendSubscribe(id, query, args);
|
|
193
|
+
}
|
|
194
|
+
// Return unsubscribe function
|
|
195
|
+
return () => {
|
|
196
|
+
this.subscriptions.delete(id);
|
|
197
|
+
if (this.ws?.readyState === WebSocket.OPEN) {
|
|
198
|
+
this.send({ type: 'unsubscribe', id });
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
sendSubscribe(id, query, args) {
|
|
203
|
+
this.send({
|
|
204
|
+
type: 'subscribe',
|
|
205
|
+
id,
|
|
206
|
+
query,
|
|
207
|
+
args,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
send(message) {
|
|
211
|
+
if (this.ws?.readyState === WebSocket.OPEN) {
|
|
212
|
+
this.ws.send(JSON.stringify(message));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
generateId() {
|
|
216
|
+
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Disconnect from the server
|
|
220
|
+
*/
|
|
221
|
+
disconnect() {
|
|
222
|
+
if (this.ws) {
|
|
223
|
+
this.ws.close();
|
|
224
|
+
this.ws = null;
|
|
225
|
+
}
|
|
226
|
+
this.subscriptions.clear();
|
|
227
|
+
this.pendingRequests.clear();
|
|
228
|
+
this.connectionId = null;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6BH;;GAEG;AACH,MAAM,OAAO,YAAY;IACf,OAAO,CAAsB;IAC7B,EAAE,GAAqB,IAAI,CAAC;IAC5B,aAAa,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CAAC;QACxC,CAAC;IACH,CAAC;IAEO,UAAU;QAChB,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACnE,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACZ,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tthr/client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Tether core client - vanilla JavaScript SDK",
|
|
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
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"typecheck": "tsc --noEmit"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.7.2"
|
|
24
|
+
}
|
|
25
|
+
}
|