simplex-ts 3.6.18 → 3.6.20
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 +262 -193
- package/dist/SimplexClient.d.ts +33 -18
- package/dist/SimplexClient.d.ts.map +1 -1
- package/dist/SimplexClient.js +48 -65
- package/dist/SimplexClient.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/Workflow.d.ts +22 -39
- package/dist/resources/Workflow.d.ts.map +1 -1
- package/dist/resources/Workflow.js +21 -371
- package/dist/resources/Workflow.js.map +1 -1
- package/dist/types/index.d.ts +21 -211
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/resources/WorkflowSession.d.ts +0 -39
- package/dist/resources/WorkflowSession.d.ts.map +0 -1
- package/dist/resources/WorkflowSession.js +0 -114
- package/dist/resources/WorkflowSession.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,241 +2,288 @@
|
|
|
2
2
|
|
|
3
3
|
Official TypeScript SDK for the Simplex API.
|
|
4
4
|
|
|
5
|
+
This guide provides practical examples for integrating Simplex into your TypeScript applications.
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
npm install simplex-ts
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Initializing the client
|
|
12
14
|
|
|
13
15
|
```typescript
|
|
14
16
|
import { SimplexClient } from 'simplex-ts';
|
|
15
17
|
|
|
16
18
|
const client = new SimplexClient({
|
|
17
|
-
apiKey:
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// Run a workflow without variables
|
|
21
|
-
const result = await client.workflows.run('workflow-id');
|
|
22
|
-
|
|
23
|
-
// Run a workflow with variables
|
|
24
|
-
const resultWithVars = await client.workflows.run('workflow-id', {
|
|
25
|
-
variables: {
|
|
26
|
-
username: 'john_doe',
|
|
27
|
-
product_id: '12345'
|
|
28
|
-
}
|
|
19
|
+
apiKey: process.env.SIMPLEX_API_KEY
|
|
29
20
|
});
|
|
30
|
-
|
|
31
|
-
console.log('Session ID:', result.session_id);
|
|
32
21
|
```
|
|
33
22
|
|
|
34
|
-
|
|
23
|
+
### Configuration options
|
|
35
24
|
|
|
36
25
|
```typescript
|
|
37
26
|
const client = new SimplexClient({
|
|
38
|
-
apiKey:
|
|
39
|
-
timeout: 30000, //
|
|
40
|
-
maxRetries: 3, //
|
|
41
|
-
retryDelay: 1000 //
|
|
27
|
+
apiKey: process.env.SIMPLEX_API_KEY,
|
|
28
|
+
timeout: 30000, // Request timeout in ms (default: 30000)
|
|
29
|
+
maxRetries: 3, // Number of retry attempts (default: 3)
|
|
30
|
+
retryDelay: 1000 // Delay between retries in ms (default: 1000)
|
|
42
31
|
});
|
|
43
32
|
```
|
|
44
33
|
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
### Workflows
|
|
34
|
+
## Running workflows
|
|
48
35
|
|
|
49
|
-
|
|
36
|
+
### Basic workflow execution
|
|
50
37
|
|
|
51
38
|
```typescript
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
variables: { key: 'value' }
|
|
39
|
+
const result = await client.workflows.run('workflow_id', {
|
|
40
|
+
variables: {
|
|
41
|
+
username: 'user@example.com',
|
|
42
|
+
search_query: 'order #12345'
|
|
43
|
+
}
|
|
58
44
|
});
|
|
59
45
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
console.log('Session ID:', result.session_id);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### With debug webhook callback (useful for local testing)
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
const result = await client.workflows.run('workflow_id', {
|
|
53
|
+
variables: {
|
|
54
|
+
patient_id: 'P-12345'
|
|
55
|
+
},
|
|
56
|
+
webhookUrl: 'https://59d9f4dbc.ngrok-free.app/api/webhook',
|
|
57
|
+
metadata: 'req-789'
|
|
65
58
|
});
|
|
66
59
|
```
|
|
67
60
|
|
|
68
|
-
|
|
61
|
+
## Handling webhook responses
|
|
69
62
|
|
|
70
|
-
|
|
63
|
+
### Next.js App Router
|
|
71
64
|
|
|
72
65
|
```typescript
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
// app/api/simplex-webhook/route.ts
|
|
67
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
68
|
+
import { verifySimplexWebhook, WebhookPayload } from 'simplex-ts';
|
|
69
|
+
|
|
70
|
+
export async function POST(request: NextRequest) {
|
|
71
|
+
const body = await request.text();
|
|
72
|
+
const headers: Record<string, string> = {};
|
|
73
|
+
request.headers.forEach((value, key) => {
|
|
74
|
+
headers[key] = value;
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
verifySimplexWebhook(body, headers, process.env.SIMPLEX_WEBHOOK_SECRET!);
|
|
79
|
+
const payload: WebhookPayload = JSON.parse(body);
|
|
80
|
+
|
|
81
|
+
if (payload.success) {
|
|
82
|
+
// Process successful workflow
|
|
83
|
+
await processResult(payload);
|
|
84
|
+
} else {
|
|
85
|
+
// Handle failed workflow
|
|
86
|
+
await handleFailure(payload);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return NextResponse.json({ received: true });
|
|
90
|
+
} catch (error) {
|
|
91
|
+
return NextResponse.json({ error: 'Invalid signature' }, { status: 401 });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
77
94
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
console.log(`- ${workflow.workflow_name} (${workflow.workflow_id})`);
|
|
81
|
-
console.log(` Metadata: ${workflow.metadata || 'None'}`);
|
|
82
|
-
});
|
|
95
|
+
async function processResult(payload: WebhookPayload) {
|
|
96
|
+
const { session_id, structured_output, metadata } = payload;
|
|
83
97
|
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
metadata: 'prod'
|
|
87
|
-
});
|
|
98
|
+
// Your business logic here
|
|
99
|
+
console.log('Processing session:', session_id);
|
|
88
100
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
101
|
+
if (structured_output) {
|
|
102
|
+
// Handle extracted data
|
|
103
|
+
await saveToDatabase(structured_output);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
94
106
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} catch (error) {
|
|
99
|
-
console.error('Error: At least one search parameter required');
|
|
107
|
+
async function handleFailure(payload: WebhookPayload) {
|
|
108
|
+
console.error('Workflow failed:', payload.session_id);
|
|
109
|
+
// Alert, retry, or log the failure
|
|
100
110
|
}
|
|
101
111
|
```
|
|
102
112
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
Update the metadata string for a specific workflow.
|
|
113
|
+
### Express
|
|
106
114
|
|
|
107
115
|
```typescript
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
'workflow-id-here',
|
|
111
|
-
'production'
|
|
112
|
-
);
|
|
116
|
+
import express from 'express';
|
|
117
|
+
import { verifySimplexWebhook, WebhookPayload } from 'simplex-ts';
|
|
113
118
|
|
|
114
|
-
|
|
115
|
-
console.log('New metadata:', result.metadata);
|
|
119
|
+
const app = express();
|
|
116
120
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
await client.workflows.updateMetadata('workflow-3', 'development');
|
|
121
|
+
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
|
|
122
|
+
const body = req.body.toString('utf8');
|
|
123
|
+
const signature = req.headers['x-simplex-signature'] as string;
|
|
121
124
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
```
|
|
125
|
+
try {
|
|
126
|
+
verifySimplexWebhook(body, req.headers, process.env.SIMPLEX_WEBHOOK_SECRET!);
|
|
127
|
+
const payload: WebhookPayload = JSON.parse(body);
|
|
127
128
|
|
|
128
|
-
|
|
129
|
+
// Process asynchronously
|
|
130
|
+
processWebhook(payload).catch(console.error);
|
|
129
131
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
'https://example.com',
|
|
134
|
-
{
|
|
135
|
-
sessionData: { key: 'value' },
|
|
136
|
-
proxies: false
|
|
132
|
+
res.json({ received: true });
|
|
133
|
+
} catch (error) {
|
|
134
|
+
res.status(401).json({ error: 'Invalid signature' });
|
|
137
135
|
}
|
|
138
|
-
);
|
|
136
|
+
});
|
|
139
137
|
|
|
140
|
-
|
|
138
|
+
app.listen(3000);
|
|
141
139
|
```
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
## Polling session status
|
|
144
142
|
|
|
145
|
-
|
|
143
|
+
Use polling when you can't receive webhooks or need to check status synchronously:
|
|
146
144
|
|
|
147
145
|
```typescript
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
console.log('Result:', result.result);
|
|
146
|
+
const status = await client.getSessionStatus('session_id');
|
|
147
|
+
|
|
148
|
+
if (status.in_progress) {
|
|
149
|
+
console.log('Session still running...');
|
|
150
|
+
} else if (status.success) {
|
|
151
|
+
console.log('Session completed successfully');
|
|
152
|
+
console.log('Files:', status.file_metadata);
|
|
153
|
+
console.log('Scraper outputs:', status.scraper_outputs);
|
|
154
|
+
} else {
|
|
155
|
+
console.log('Session failed');
|
|
156
|
+
}
|
|
160
157
|
```
|
|
161
158
|
|
|
162
|
-
|
|
159
|
+
## Resuming paused flows
|
|
163
160
|
|
|
164
|
-
|
|
161
|
+
When a flow script calls `pause()`, you can resume it programmatically:
|
|
165
162
|
|
|
166
163
|
```typescript
|
|
167
|
-
const result = await client.
|
|
168
|
-
'my-agent-name',
|
|
169
|
-
'session-id',
|
|
170
|
-
{
|
|
171
|
-
key1: 'value1',
|
|
172
|
-
key2: 'value2'
|
|
173
|
-
}
|
|
174
|
-
);
|
|
164
|
+
const result = await client.resume('session_id');
|
|
175
165
|
|
|
176
|
-
|
|
177
|
-
console.log('
|
|
178
|
-
|
|
166
|
+
if (result.succeeded) {
|
|
167
|
+
console.log('Flow resumed successfully');
|
|
168
|
+
} else {
|
|
169
|
+
console.log('Failed to resume:', result.error);
|
|
170
|
+
}
|
|
179
171
|
```
|
|
180
172
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
#### Retrieve session replay video
|
|
173
|
+
## Retrieving session data
|
|
184
174
|
|
|
185
|
-
|
|
175
|
+
### Get session replay
|
|
186
176
|
|
|
187
177
|
```typescript
|
|
188
|
-
|
|
178
|
+
import fs from 'fs';
|
|
189
179
|
|
|
190
|
-
|
|
191
|
-
import * as fs from 'fs';
|
|
192
|
-
fs.writeFileSync('session-replay.mp4', videoBuffer);
|
|
193
|
-
```
|
|
180
|
+
const replay = await client.retrieveSessionReplay('session_id');
|
|
194
181
|
|
|
195
|
-
|
|
182
|
+
// Returns a Buffer containing the MP4 video recording
|
|
183
|
+
fs.writeFileSync('session-replay.mp4', Buffer.from(replay));
|
|
184
|
+
```
|
|
196
185
|
|
|
197
|
-
Get
|
|
186
|
+
### Get session logs
|
|
198
187
|
|
|
199
188
|
```typescript
|
|
200
|
-
const logs = await client.retrieveSessionLogs('
|
|
189
|
+
const logs = await client.retrieveSessionLogs('session_id');
|
|
201
190
|
|
|
202
|
-
|
|
191
|
+
// Returns JSON session logs
|
|
192
|
+
console.log('Session logs:', JSON.stringify(logs, null, 2));
|
|
193
|
+
```
|
|
203
194
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
195
|
+
### Download session files
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
// Download all files as a zip
|
|
199
|
+
const allFiles = await client.downloadSessionFiles('session_id');
|
|
207
200
|
```
|
|
208
201
|
|
|
209
|
-
|
|
202
|
+
## Batch processing
|
|
210
203
|
|
|
211
|
-
|
|
204
|
+
### Running multiple workflows
|
|
212
205
|
|
|
213
206
|
```typescript
|
|
214
|
-
const
|
|
207
|
+
const patients = ['P-001', 'P-002', 'P-003', 'P-004', 'P-005'];
|
|
208
|
+
|
|
209
|
+
// Run workflows in parallel with concurrency limit
|
|
210
|
+
const results = await Promise.all(
|
|
211
|
+
patients.map(async (patientId) => {
|
|
212
|
+
try {
|
|
213
|
+
return await client.workflows.run('verification_workflow', {
|
|
214
|
+
variables: { patient_id: patientId },
|
|
215
|
+
webhookUrl: 'https://your-domain.com/webhook',
|
|
216
|
+
metadata: patientId
|
|
217
|
+
});
|
|
218
|
+
} catch (error) {
|
|
219
|
+
console.error(`Failed to start workflow for ${patientId}:`, error);
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
);
|
|
215
224
|
|
|
216
|
-
|
|
225
|
+
const successful = results.filter(Boolean);
|
|
226
|
+
console.log(`Started ${successful.length}/${patients.length} workflows`);
|
|
217
227
|
```
|
|
218
228
|
|
|
219
|
-
|
|
229
|
+
### With rate limiting
|
|
220
230
|
|
|
221
|
-
|
|
231
|
+
```typescript
|
|
232
|
+
async function runWithRateLimit<T>(
|
|
233
|
+
items: T[],
|
|
234
|
+
fn: (item: T) => Promise<unknown>,
|
|
235
|
+
concurrency: number = 5,
|
|
236
|
+
delayMs: number = 1000
|
|
237
|
+
) {
|
|
238
|
+
const results = [];
|
|
239
|
+
|
|
240
|
+
for (let i = 0; i < items.length; i += concurrency) {
|
|
241
|
+
const batch = items.slice(i, i + concurrency);
|
|
242
|
+
const batchResults = await Promise.all(batch.map(fn));
|
|
243
|
+
results.push(...batchResults);
|
|
244
|
+
|
|
245
|
+
if (i + concurrency < items.length) {
|
|
246
|
+
await new Promise(resolve => setTimeout(resolve, delayMs));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return results;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Usage
|
|
254
|
+
await runWithRateLimit(
|
|
255
|
+
patients,
|
|
256
|
+
(patientId) => client.workflows.run('workflow_id', {
|
|
257
|
+
variables: { patient_id: patientId }
|
|
258
|
+
}),
|
|
259
|
+
5, // 5 concurrent
|
|
260
|
+
1000 // 1 second between batches
|
|
261
|
+
);
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Searching workflows
|
|
222
265
|
|
|
223
266
|
```typescript
|
|
224
|
-
//
|
|
225
|
-
const
|
|
226
|
-
|
|
267
|
+
// Search for workflows by name or metadata
|
|
268
|
+
const results = await client.workflows.search({
|
|
269
|
+
workflowName: 'insurance' // Partial matching supported
|
|
270
|
+
});
|
|
227
271
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
272
|
+
for (const workflow of results.workflows) {
|
|
273
|
+
console.log(`${workflow.workflow_name}: ${workflow.workflow_id}`);
|
|
274
|
+
}
|
|
231
275
|
```
|
|
232
276
|
|
|
233
|
-
##
|
|
277
|
+
## Updating workflow metadata
|
|
234
278
|
|
|
235
|
-
|
|
279
|
+
```typescript
|
|
280
|
+
await client.workflows.updateMetadata('workflow_id', 'verification-high');
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Error handling
|
|
236
284
|
|
|
237
285
|
```typescript
|
|
238
|
-
import {
|
|
239
|
-
SimplexClient,
|
|
286
|
+
import { SimplexClient,
|
|
240
287
|
WorkflowError,
|
|
241
288
|
ValidationError,
|
|
242
289
|
AuthenticationError,
|
|
@@ -244,62 +291,84 @@ import {
|
|
|
244
291
|
NetworkError
|
|
245
292
|
} from 'simplex-ts';
|
|
246
293
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
294
|
+
async function runWorkflowSafely(workflowId: string, variables: Record<string, string>) {
|
|
295
|
+
try {
|
|
296
|
+
return await client.workflows.run(workflowId, { variables });
|
|
297
|
+
} catch (error) {
|
|
298
|
+
if (error instanceof AuthenticationError) {
|
|
299
|
+
console.error('Invalid API key');
|
|
300
|
+
throw error;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (error instanceof RateLimitError) {
|
|
304
|
+
console.log('Rate limited, retrying after delay...');
|
|
305
|
+
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
306
|
+
return client.workflows.run(workflowId, { variables });
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (error instanceof ValidationError) {
|
|
310
|
+
console.error('Invalid parameters:', error.message);
|
|
311
|
+
throw error;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (error instanceof WorkflowError) {
|
|
315
|
+
console.error('Workflow execution failed:', error.message);
|
|
316
|
+
throw error;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (error instanceof NetworkError) {
|
|
320
|
+
console.error('Network issue:', error.message);
|
|
321
|
+
throw error;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
throw error;
|
|
260
325
|
}
|
|
261
326
|
}
|
|
262
327
|
```
|
|
263
328
|
|
|
264
|
-
##
|
|
265
|
-
|
|
266
|
-
The SDK includes several example files to demonstrate different use cases:
|
|
267
|
-
|
|
268
|
-
- **`examples/run-workflow.ts`** - Basic workflow execution
|
|
269
|
-
- **`examples/create-workflow.ts`** - Creating workflow sessions with agentic tasks
|
|
270
|
-
- **`examples/download-file.ts`** - Download files from workflow sessions
|
|
271
|
-
- **`examples/session-replay-and-logs.ts`** - Retrieve session replays and logs
|
|
272
|
-
- **`examples/search-and-metadata.ts`** - Search workflows and manage metadata
|
|
273
|
-
- **`examples/webhook-express.ts`** - Webhook verification with Express
|
|
274
|
-
- **`examples/webhook-nextjs.ts`** - Webhook verification with Next.js
|
|
275
|
-
|
|
276
|
-
Run examples with:
|
|
277
|
-
```bash
|
|
278
|
-
npx tsx examples/run-workflow.ts
|
|
279
|
-
npx tsx examples/session-replay-and-logs.ts
|
|
280
|
-
npx tsx examples/download-file.ts
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
## Development
|
|
329
|
+
## TypeScript types
|
|
284
330
|
|
|
285
|
-
|
|
331
|
+
The SDK exports types for all API responses:
|
|
286
332
|
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
333
|
+
```typescript
|
|
334
|
+
import type {
|
|
335
|
+
WebhookPayload,
|
|
336
|
+
RunWorkflowResponse,
|
|
337
|
+
FileMetadata
|
|
338
|
+
} from 'simplex-ts';
|
|
292
339
|
|
|
293
|
-
|
|
294
|
-
|
|
340
|
+
function handleWebhook(payload: WebhookPayload) {
|
|
341
|
+
const {
|
|
342
|
+
success,
|
|
343
|
+
session_id,
|
|
344
|
+
agent_response,
|
|
345
|
+
structured_output,
|
|
346
|
+
session_metadata,
|
|
347
|
+
file_metadata
|
|
348
|
+
} = payload;
|
|
349
|
+
|
|
350
|
+
// TypeScript knows all the types
|
|
351
|
+
}
|
|
295
352
|
```
|
|
296
353
|
|
|
297
|
-
|
|
354
|
+
## Environment configuration
|
|
298
355
|
|
|
299
|
-
```
|
|
300
|
-
|
|
356
|
+
```typescript
|
|
357
|
+
// config.ts
|
|
358
|
+
export const simplexConfig = {
|
|
359
|
+
apiKey: process.env.SIMPLEX_API_KEY!,
|
|
360
|
+
webhookSecret: process.env.SIMPLEX_WEBHOOK_SECRET!,
|
|
361
|
+
webhookUrl: process.env.NODE_ENV === 'production'
|
|
362
|
+
? 'https://your-domain.com/api/webhook'
|
|
363
|
+
: process.env.NGROK_URL + '/api/webhook'
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// Validate config on startup
|
|
367
|
+
if (!simplexConfig.apiKey) {
|
|
368
|
+
throw new Error('SIMPLEX_API_KEY is required');
|
|
369
|
+
}
|
|
301
370
|
```
|
|
302
371
|
|
|
303
372
|
## License
|
|
304
373
|
|
|
305
|
-
MIT
|
|
374
|
+
MIT
|
package/dist/SimplexClient.d.ts
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import { Workflow } from './resources/Workflow';
|
|
2
|
-
import {
|
|
3
|
-
import { SimplexClientOptions, GetSessionStoreResponse, Add2FAConfigResponse, SessionStatusResponse } from './types';
|
|
2
|
+
import { SimplexClientOptions, SessionStatusResponse, ResumeSessionResponse } from './types';
|
|
4
3
|
export declare class SimplexClient {
|
|
5
4
|
private httpClient;
|
|
6
5
|
workflows: Workflow;
|
|
7
6
|
constructor(options: SimplexClientOptions);
|
|
8
|
-
createWorkflowSession(options: {
|
|
9
|
-
name: string;
|
|
10
|
-
url: string;
|
|
11
|
-
proxies?: boolean;
|
|
12
|
-
sessionData?: any;
|
|
13
|
-
metadata?: string;
|
|
14
|
-
}): Promise<WorkflowSession>;
|
|
15
|
-
getSessionStore(sessionId: string): Promise<GetSessionStoreResponse>;
|
|
16
7
|
/**
|
|
17
8
|
* Poll session status to check progress and get results.
|
|
18
9
|
* Use this to monitor long-running sessions without webhooks.
|
|
@@ -21,16 +12,40 @@ export declare class SimplexClient {
|
|
|
21
12
|
* @returns Session status including in_progress flag and available data
|
|
22
13
|
*/
|
|
23
14
|
getSessionStatus(sessionId: string): Promise<SessionStatusResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Download all files from a session as a zip archive.
|
|
17
|
+
*
|
|
18
|
+
* @param sessionId - The session ID to download files from
|
|
19
|
+
* @returns Buffer containing the zip file
|
|
20
|
+
*/
|
|
24
21
|
downloadSessionFiles(sessionId: string): Promise<Buffer>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
setCustomHeader(key: string, value: string): void;
|
|
32
|
-
removeCustomHeader(key: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Retrieve the session replay video (MP4).
|
|
24
|
+
*
|
|
25
|
+
* @param sessionId - The session ID to get replay for
|
|
26
|
+
* @returns Buffer containing the MP4 video
|
|
27
|
+
*/
|
|
33
28
|
retrieveSessionReplay(sessionId: string): Promise<Buffer>;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieve the session logs as JSON.
|
|
31
|
+
*
|
|
32
|
+
* @param sessionId - The session ID to get logs for
|
|
33
|
+
* @returns Parsed JSON logs
|
|
34
|
+
*/
|
|
34
35
|
retrieveSessionLogs(sessionId: string): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* Resume a paused flow in a session.
|
|
38
|
+
* Call this when a flow script has called pause() and is waiting to be resumed.
|
|
39
|
+
*
|
|
40
|
+
* @param sessionId - The session ID to resume
|
|
41
|
+
* @returns Resume response with succeeded flag and optional pause key
|
|
42
|
+
*/
|
|
43
|
+
resume(sessionId: string): Promise<ResumeSessionResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Update the API key used for requests.
|
|
46
|
+
*
|
|
47
|
+
* @param apiKey - The new API key
|
|
48
|
+
*/
|
|
49
|
+
updateApiKey(apiKey: string): void;
|
|
35
50
|
}
|
|
36
51
|
//# sourceMappingURL=SimplexClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimplexClient.d.ts","sourceRoot":"","sources":["../src/SimplexClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"SimplexClient.d.ts","sourceRoot":"","sources":["../src/SimplexClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EAEtB,MAAM,SAAS,CAAC;AAGjB,qBAAa,aAAa;IACxB,OAAO,CAAC,UAAU,CAAa;IACxB,SAAS,EAAE,QAAQ,CAAC;gBAEf,OAAO,EAAE,oBAAoB;IAYzC;;;;;;OAMG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAezE;;;;;OAKG;IACG,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuC9D;;;;;OAKG;IACG,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgB/D;;;;;OAKG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAkB1D;;;;;;OAMG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA4B/D;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAGnC"}
|