langflow-mcp-server 2.0.0 → 3.0.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/.env.example +5 -0
- package/LICENSE +1 -1
- package/README.md +91 -8
- package/dist/__tests__/fixtures/advanced-execution.d.ts +5 -1
- package/dist/__tests__/fixtures/advanced-execution.d.ts.map +1 -1
- package/dist/__tests__/fixtures/advanced-execution.js +43 -1
- package/dist/__tests__/fixtures/advanced-execution.js.map +1 -1
- package/dist/mcp/index.js +8 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/server-consolidated.d.ts +28 -0
- package/dist/mcp/server-consolidated.d.ts.map +1 -0
- package/dist/mcp/server-consolidated.js +740 -0
- package/dist/mcp/server-consolidated.js.map +1 -0
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +105 -21
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools-consolidated.d.ts +3 -0
- package/dist/mcp/tools-consolidated.d.ts.map +1 -0
- package/dist/mcp/tools-consolidated.js +600 -0
- package/dist/mcp/tools-consolidated.js.map +1 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +95 -8
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/validation-consolidated.d.ts +404 -0
- package/dist/mcp/validation-consolidated.d.ts.map +1 -0
- package/dist/mcp/validation-consolidated.js +374 -0
- package/dist/mcp/validation-consolidated.js.map +1 -0
- package/dist/mcp/validation.d.ts +20 -1
- package/dist/mcp/validation.d.ts.map +1 -1
- package/dist/mcp/validation.js +21 -5
- package/dist/mcp/validation.js.map +1 -1
- package/dist/services/langflow-client.d.ts +5 -2
- package/dist/services/langflow-client.d.ts.map +1 -1
- package/dist/services/langflow-client.js +93 -62
- package/dist/services/langflow-client.js.map +1 -1
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -1
- package/healthcheck.js +41 -0
- package/package.json +7 -6
|
@@ -38,7 +38,7 @@ class LangflowClient {
|
|
|
38
38
|
}
|
|
39
39
|
async getFlow(flowId) {
|
|
40
40
|
try {
|
|
41
|
-
const response = await this.client.get(`/flows/${flowId}`);
|
|
41
|
+
const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}`);
|
|
42
42
|
return response.data;
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
@@ -47,7 +47,7 @@ class LangflowClient {
|
|
|
47
47
|
}
|
|
48
48
|
async updateFlow(flowId, updates) {
|
|
49
49
|
try {
|
|
50
|
-
const response = await this.client.patch(`/flows/${flowId}`, updates);
|
|
50
|
+
const response = await this.client.patch(`/flows/${encodeURIComponent(flowId)}`, updates);
|
|
51
51
|
return response.data;
|
|
52
52
|
}
|
|
53
53
|
catch (error) {
|
|
@@ -56,7 +56,7 @@ class LangflowClient {
|
|
|
56
56
|
}
|
|
57
57
|
async deleteFlow(flowId) {
|
|
58
58
|
try {
|
|
59
|
-
await this.client.delete(`/flows/${flowId}`);
|
|
59
|
+
await this.client.delete(`/flows/${encodeURIComponent(flowId)}`);
|
|
60
60
|
}
|
|
61
61
|
catch (error) {
|
|
62
62
|
throw this.handleError(error, `Failed to delete flow ${flowId}`);
|
|
@@ -81,6 +81,9 @@ class LangflowClient {
|
|
|
81
81
|
Object.entries(response.data).forEach(([category, items]) => {
|
|
82
82
|
if (items && typeof items === 'object') {
|
|
83
83
|
Object.entries(items).forEach(([name, info]) => {
|
|
84
|
+
if (!info || typeof info !== 'object') {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
84
87
|
components.push({
|
|
85
88
|
name,
|
|
86
89
|
display_name: info.display_name || name,
|
|
@@ -99,7 +102,7 @@ class LangflowClient {
|
|
|
99
102
|
}
|
|
100
103
|
async runFlow(flowIdOrName, inputRequest, stream = false) {
|
|
101
104
|
try {
|
|
102
|
-
const response = await this.client.post(`/run/${flowIdOrName}`, {
|
|
105
|
+
const response = await this.client.post(`/run/${encodeURIComponent(flowIdOrName)}`, {
|
|
103
106
|
...inputRequest,
|
|
104
107
|
stream
|
|
105
108
|
});
|
|
@@ -111,7 +114,7 @@ class LangflowClient {
|
|
|
111
114
|
}
|
|
112
115
|
async triggerWebhook(flowIdOrName, inputRequest) {
|
|
113
116
|
try {
|
|
114
|
-
const response = await this.client.post(`/webhook/${flowIdOrName}`, inputRequest);
|
|
117
|
+
const response = await this.client.post(`/webhook/${encodeURIComponent(flowIdOrName)}`, inputRequest);
|
|
115
118
|
return response.data;
|
|
116
119
|
}
|
|
117
120
|
catch (error) {
|
|
@@ -165,7 +168,7 @@ class LangflowClient {
|
|
|
165
168
|
}
|
|
166
169
|
async getFolder(folderId) {
|
|
167
170
|
try {
|
|
168
|
-
const response = await this.client.get(`/folders/${folderId}`);
|
|
171
|
+
const response = await this.client.get(`/folders/${encodeURIComponent(folderId)}`);
|
|
169
172
|
return response.data;
|
|
170
173
|
}
|
|
171
174
|
catch (error) {
|
|
@@ -174,7 +177,7 @@ class LangflowClient {
|
|
|
174
177
|
}
|
|
175
178
|
async updateFolder(folderId, updates) {
|
|
176
179
|
try {
|
|
177
|
-
const response = await this.client.patch(`/folders/${folderId}`, updates);
|
|
180
|
+
const response = await this.client.patch(`/folders/${encodeURIComponent(folderId)}`, updates);
|
|
178
181
|
return response.data;
|
|
179
182
|
}
|
|
180
183
|
catch (error) {
|
|
@@ -183,7 +186,7 @@ class LangflowClient {
|
|
|
183
186
|
}
|
|
184
187
|
async deleteFolder(folderId) {
|
|
185
188
|
try {
|
|
186
|
-
await this.client.delete(`/folders/${folderId}`);
|
|
189
|
+
await this.client.delete(`/folders/${encodeURIComponent(folderId)}`);
|
|
187
190
|
}
|
|
188
191
|
catch (error) {
|
|
189
192
|
throw this.handleError(error, `Failed to delete folder ${folderId}`);
|
|
@@ -209,7 +212,7 @@ class LangflowClient {
|
|
|
209
212
|
}
|
|
210
213
|
async getProject(projectId) {
|
|
211
214
|
try {
|
|
212
|
-
const response = await this.client.get(`/projects/${projectId}`);
|
|
215
|
+
const response = await this.client.get(`/projects/${encodeURIComponent(projectId)}`);
|
|
213
216
|
return response.data;
|
|
214
217
|
}
|
|
215
218
|
catch (error) {
|
|
@@ -218,7 +221,7 @@ class LangflowClient {
|
|
|
218
221
|
}
|
|
219
222
|
async updateProject(projectId, updates) {
|
|
220
223
|
try {
|
|
221
|
-
const response = await this.client.patch(`/projects/${projectId}`, updates);
|
|
224
|
+
const response = await this.client.patch(`/projects/${encodeURIComponent(projectId)}`, updates);
|
|
222
225
|
return response.data;
|
|
223
226
|
}
|
|
224
227
|
catch (error) {
|
|
@@ -227,7 +230,7 @@ class LangflowClient {
|
|
|
227
230
|
}
|
|
228
231
|
async deleteProject(projectId) {
|
|
229
232
|
try {
|
|
230
|
-
await this.client.delete(`/projects/${projectId}`);
|
|
233
|
+
await this.client.delete(`/projects/${encodeURIComponent(projectId)}`);
|
|
231
234
|
}
|
|
232
235
|
catch (error) {
|
|
233
236
|
throw this.handleError(error, `Failed to delete project ${projectId}`);
|
|
@@ -244,7 +247,7 @@ class LangflowClient {
|
|
|
244
247
|
}
|
|
245
248
|
async downloadProject(projectId) {
|
|
246
249
|
try {
|
|
247
|
-
const response = await this.client.get(`/projects/download/${projectId}`);
|
|
250
|
+
const response = await this.client.get(`/projects/download/${encodeURIComponent(projectId)}`);
|
|
248
251
|
return response.data;
|
|
249
252
|
}
|
|
250
253
|
catch (error) {
|
|
@@ -271,7 +274,7 @@ class LangflowClient {
|
|
|
271
274
|
}
|
|
272
275
|
async updateVariable(variableId, updates) {
|
|
273
276
|
try {
|
|
274
|
-
const response = await this.client.patch(`/variables/${variableId}`, updates);
|
|
277
|
+
const response = await this.client.patch(`/variables/${encodeURIComponent(variableId)}`, updates);
|
|
275
278
|
return response.data;
|
|
276
279
|
}
|
|
277
280
|
catch (error) {
|
|
@@ -280,7 +283,7 @@ class LangflowClient {
|
|
|
280
283
|
}
|
|
281
284
|
async deleteVariable(variableId) {
|
|
282
285
|
try {
|
|
283
|
-
await this.client.delete(`/variables/${variableId}`);
|
|
286
|
+
await this.client.delete(`/variables/${encodeURIComponent(variableId)}`);
|
|
284
287
|
}
|
|
285
288
|
catch (error) {
|
|
286
289
|
throw this.handleError(error, `Failed to delete variable ${variableId}`);
|
|
@@ -288,7 +291,7 @@ class LangflowClient {
|
|
|
288
291
|
}
|
|
289
292
|
async buildFlow(flowId, request, params) {
|
|
290
293
|
try {
|
|
291
|
-
const response = await this.client.post(`/build/${flowId}/flow`, request, { params });
|
|
294
|
+
const response = await this.client.post(`/build/${encodeURIComponent(flowId)}/flow`, request, { params });
|
|
292
295
|
return response.data;
|
|
293
296
|
}
|
|
294
297
|
catch (error) {
|
|
@@ -297,7 +300,7 @@ class LangflowClient {
|
|
|
297
300
|
}
|
|
298
301
|
async getBuildStatus(jobId, eventDelivery = 'polling') {
|
|
299
302
|
try {
|
|
300
|
-
const response = await this.client.get(`/build/${jobId}/events`, { params: { event_delivery: eventDelivery } });
|
|
303
|
+
const response = await this.client.get(`/build/${encodeURIComponent(jobId)}/events`, { params: { event_delivery: eventDelivery } });
|
|
301
304
|
return response.data;
|
|
302
305
|
}
|
|
303
306
|
catch (error) {
|
|
@@ -306,7 +309,7 @@ class LangflowClient {
|
|
|
306
309
|
}
|
|
307
310
|
async cancelBuild(jobId) {
|
|
308
311
|
try {
|
|
309
|
-
const response = await this.client.post(`/build/${jobId}/cancel`);
|
|
312
|
+
const response = await this.client.post(`/build/${encodeURIComponent(jobId)}/cancel`);
|
|
310
313
|
return response.data;
|
|
311
314
|
}
|
|
312
315
|
catch (error) {
|
|
@@ -354,7 +357,7 @@ class LangflowClient {
|
|
|
354
357
|
try {
|
|
355
358
|
const formData = new form_data_1.default();
|
|
356
359
|
formData.append('file', params.file, params.file_name);
|
|
357
|
-
const response = await this.client.post(`/files/upload/${params.flow_id}`, formData, {
|
|
360
|
+
const response = await this.client.post(`/files/upload/${encodeURIComponent(params.flow_id)}`, formData, {
|
|
358
361
|
headers: {
|
|
359
362
|
...formData.getHeaders()
|
|
360
363
|
}
|
|
@@ -367,7 +370,7 @@ class LangflowClient {
|
|
|
367
370
|
}
|
|
368
371
|
async downloadFile(params) {
|
|
369
372
|
try {
|
|
370
|
-
const response = await this.client.get(`/files/download/${params.flow_id}/${params.file_name}`, {
|
|
373
|
+
const response = await this.client.get(`/files/download/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.file_name)}`, {
|
|
371
374
|
responseType: 'arraybuffer'
|
|
372
375
|
});
|
|
373
376
|
return response.data;
|
|
@@ -378,7 +381,7 @@ class LangflowClient {
|
|
|
378
381
|
}
|
|
379
382
|
async listFiles(params) {
|
|
380
383
|
try {
|
|
381
|
-
const response = await this.client.get(`/files/list/${params.flow_id}`);
|
|
384
|
+
const response = await this.client.get(`/files/list/${encodeURIComponent(params.flow_id)}`);
|
|
382
385
|
return response.data;
|
|
383
386
|
}
|
|
384
387
|
catch (error) {
|
|
@@ -387,7 +390,7 @@ class LangflowClient {
|
|
|
387
390
|
}
|
|
388
391
|
async deleteFile(params) {
|
|
389
392
|
try {
|
|
390
|
-
const response = await this.client.delete(`/files/delete/${params.flow_id}/${params.file_name}`);
|
|
393
|
+
const response = await this.client.delete(`/files/delete/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.file_name)}`);
|
|
391
394
|
return response.data;
|
|
392
395
|
}
|
|
393
396
|
catch (error) {
|
|
@@ -396,7 +399,7 @@ class LangflowClient {
|
|
|
396
399
|
}
|
|
397
400
|
async getFileImage(params) {
|
|
398
401
|
try {
|
|
399
|
-
const response = await this.client.get(`/files/images/${params.flow_id}/${params.file_name}`, {
|
|
402
|
+
const response = await this.client.get(`/files/images/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.file_name)}`, {
|
|
400
403
|
responseType: 'arraybuffer'
|
|
401
404
|
});
|
|
402
405
|
return response.data;
|
|
@@ -476,7 +479,7 @@ class LangflowClient {
|
|
|
476
479
|
}
|
|
477
480
|
async getStoreComponent(componentId) {
|
|
478
481
|
try {
|
|
479
|
-
const response = await this.client.get(`/store/components/${componentId}`);
|
|
482
|
+
const response = await this.client.get(`/store/components/${encodeURIComponent(componentId)}`);
|
|
480
483
|
return response.data;
|
|
481
484
|
}
|
|
482
485
|
catch (error) {
|
|
@@ -501,21 +504,18 @@ class LangflowClient {
|
|
|
501
504
|
throw this.handleError(error, 'Failed to get user likes');
|
|
502
505
|
}
|
|
503
506
|
}
|
|
504
|
-
async runFlowAdvanced(
|
|
507
|
+
async runFlowAdvanced(flowIdOrName, request, stream = false, userId) {
|
|
505
508
|
try {
|
|
506
|
-
const response = await this.client.post(`/run/advanced/${
|
|
507
|
-
...request,
|
|
508
|
-
stream
|
|
509
|
-
});
|
|
509
|
+
const response = await this.client.post(`/run/advanced/${encodeURIComponent(flowIdOrName)}`, { ...request, stream }, userId ? { params: { user_id: userId } } : undefined);
|
|
510
510
|
return response.data;
|
|
511
511
|
}
|
|
512
512
|
catch (error) {
|
|
513
|
-
throw this.handleError(error, `Failed to run flow ${
|
|
513
|
+
throw this.handleError(error, `Failed to run flow ${flowIdOrName} (advanced)`);
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
async processFlow(flowId, request) {
|
|
517
517
|
try {
|
|
518
|
-
const response = await this.client.post(`/process/${flowId}`, request);
|
|
518
|
+
const response = await this.client.post(`/process/${encodeURIComponent(flowId)}`, request);
|
|
519
519
|
return response.data;
|
|
520
520
|
}
|
|
521
521
|
catch (error) {
|
|
@@ -524,7 +524,7 @@ class LangflowClient {
|
|
|
524
524
|
}
|
|
525
525
|
async predictFlow(flowId, request) {
|
|
526
526
|
try {
|
|
527
|
-
const response = await this.client.post(`/predict/${flowId}`, request);
|
|
527
|
+
const response = await this.client.post(`/predict/${encodeURIComponent(flowId)}`, request);
|
|
528
528
|
return response.data;
|
|
529
529
|
}
|
|
530
530
|
catch (error) {
|
|
@@ -551,7 +551,7 @@ class LangflowClient {
|
|
|
551
551
|
}
|
|
552
552
|
async getMonitorMessage(messageId) {
|
|
553
553
|
try {
|
|
554
|
-
const response = await this.client.get(`/monitor/messages/${messageId}`);
|
|
554
|
+
const response = await this.client.get(`/monitor/messages/${encodeURIComponent(messageId)}`);
|
|
555
555
|
return response.data;
|
|
556
556
|
}
|
|
557
557
|
catch (error) {
|
|
@@ -569,7 +569,7 @@ class LangflowClient {
|
|
|
569
569
|
}
|
|
570
570
|
async getMonitorSessionMessages(sessionId) {
|
|
571
571
|
try {
|
|
572
|
-
const response = await this.client.get(`/monitor/messages/session/${sessionId}`);
|
|
572
|
+
const response = await this.client.get(`/monitor/messages/session/${encodeURIComponent(sessionId)}`);
|
|
573
573
|
return response.data;
|
|
574
574
|
}
|
|
575
575
|
catch (error) {
|
|
@@ -578,7 +578,7 @@ class LangflowClient {
|
|
|
578
578
|
}
|
|
579
579
|
async migrateMonitorSession(params) {
|
|
580
580
|
try {
|
|
581
|
-
const response = await this.client.patch(`/monitor/messages/session/${params.old_session_id}`, null, { params: { new_session_id: params.new_session_id } });
|
|
581
|
+
const response = await this.client.patch(`/monitor/messages/session/${encodeURIComponent(params.old_session_id)}`, null, { params: { new_session_id: params.new_session_id } });
|
|
582
582
|
return response.data;
|
|
583
583
|
}
|
|
584
584
|
catch (error) {
|
|
@@ -615,7 +615,8 @@ class LangflowClient {
|
|
|
615
615
|
}
|
|
616
616
|
async buildVertices(flowId, request) {
|
|
617
617
|
try {
|
|
618
|
-
const
|
|
618
|
+
const { data, ...queryParams } = request || {};
|
|
619
|
+
const response = await this.client.post(`/build/${encodeURIComponent(flowId)}/vertices`, data ? { data } : {}, { params: queryParams });
|
|
619
620
|
return response.data;
|
|
620
621
|
}
|
|
621
622
|
catch (error) {
|
|
@@ -624,7 +625,7 @@ class LangflowClient {
|
|
|
624
625
|
}
|
|
625
626
|
async getVertex(params) {
|
|
626
627
|
try {
|
|
627
|
-
const response = await this.client.get(`/build/${params.flow_id}/vertices/${params.vertex_id}`);
|
|
628
|
+
const response = await this.client.get(`/build/${encodeURIComponent(params.flow_id)}/vertices/${encodeURIComponent(params.vertex_id)}`);
|
|
628
629
|
return response.data;
|
|
629
630
|
}
|
|
630
631
|
catch (error) {
|
|
@@ -633,7 +634,7 @@ class LangflowClient {
|
|
|
633
634
|
}
|
|
634
635
|
async streamVertexBuild(params) {
|
|
635
636
|
try {
|
|
636
|
-
const response = await this.client.get(`/build/${params.flow_id}/${params.vertex_id}/stream`);
|
|
637
|
+
const response = await this.client.get(`/build/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.vertex_id)}/stream`);
|
|
637
638
|
return response.data;
|
|
638
639
|
}
|
|
639
640
|
catch (error) {
|
|
@@ -669,7 +670,7 @@ class LangflowClient {
|
|
|
669
670
|
}
|
|
670
671
|
async getUser(userId) {
|
|
671
672
|
try {
|
|
672
|
-
const response = await this.client.get(`/users/${userId}`);
|
|
673
|
+
const response = await this.client.get(`/users/${encodeURIComponent(userId)}`);
|
|
673
674
|
return response.data;
|
|
674
675
|
}
|
|
675
676
|
catch (error) {
|
|
@@ -678,7 +679,7 @@ class LangflowClient {
|
|
|
678
679
|
}
|
|
679
680
|
async updateUser(userId, updates) {
|
|
680
681
|
try {
|
|
681
|
-
const response = await this.client.patch(`/users/${userId}`, updates);
|
|
682
|
+
const response = await this.client.patch(`/users/${encodeURIComponent(userId)}`, updates);
|
|
682
683
|
return response.data;
|
|
683
684
|
}
|
|
684
685
|
catch (error) {
|
|
@@ -716,7 +717,7 @@ class LangflowClient {
|
|
|
716
717
|
}
|
|
717
718
|
async deleteApiKey(apiKeyId) {
|
|
718
719
|
try {
|
|
719
|
-
await this.client.delete(`/api_key/${apiKeyId}`);
|
|
720
|
+
await this.client.delete(`/api_key/${encodeURIComponent(apiKeyId)}`);
|
|
720
721
|
}
|
|
721
722
|
catch (error) {
|
|
722
723
|
throw this.handleError(error, `Failed to delete API key ${apiKeyId}`);
|
|
@@ -785,7 +786,7 @@ class LangflowClient {
|
|
|
785
786
|
}
|
|
786
787
|
async getPublicFlow(flowId) {
|
|
787
788
|
try {
|
|
788
|
-
const response = await this.client.get(`/flows/public_flow/${flowId}`);
|
|
789
|
+
const response = await this.client.get(`/flows/public_flow/${encodeURIComponent(flowId)}`);
|
|
789
790
|
return response.data;
|
|
790
791
|
}
|
|
791
792
|
catch (error) {
|
|
@@ -803,7 +804,7 @@ class LangflowClient {
|
|
|
803
804
|
}
|
|
804
805
|
async getTaskStatus(taskId) {
|
|
805
806
|
try {
|
|
806
|
-
const response = await this.client.get(`/task/${taskId}`);
|
|
807
|
+
const response = await this.client.get(`/task/${encodeURIComponent(taskId)}`);
|
|
807
808
|
return response.data;
|
|
808
809
|
}
|
|
809
810
|
catch (error) {
|
|
@@ -893,7 +894,7 @@ class LangflowClient {
|
|
|
893
894
|
}
|
|
894
895
|
async getMonitorMessageById(messageId) {
|
|
895
896
|
try {
|
|
896
|
-
const response = await this.client.get(`/monitor/messages/${messageId}`);
|
|
897
|
+
const response = await this.client.get(`/monitor/messages/${encodeURIComponent(messageId)}`);
|
|
897
898
|
return response.data;
|
|
898
899
|
}
|
|
899
900
|
catch (error) {
|
|
@@ -902,7 +903,7 @@ class LangflowClient {
|
|
|
902
903
|
}
|
|
903
904
|
async getMonitorTransactionById(transactionId) {
|
|
904
905
|
try {
|
|
905
|
-
const response = await this.client.get(`/monitor/transactions/${transactionId}`);
|
|
906
|
+
const response = await this.client.get(`/monitor/transactions/${encodeURIComponent(transactionId)}`);
|
|
906
907
|
return response.data;
|
|
907
908
|
}
|
|
908
909
|
catch (error) {
|
|
@@ -920,7 +921,7 @@ class LangflowClient {
|
|
|
920
921
|
}
|
|
921
922
|
async getMonitorVertexBuildById(vertexBuildId) {
|
|
922
923
|
try {
|
|
923
|
-
const response = await this.client.get(`/monitor/vertices/builds/${vertexBuildId}`);
|
|
924
|
+
const response = await this.client.get(`/monitor/vertices/builds/${encodeURIComponent(vertexBuildId)}`);
|
|
924
925
|
return response.data;
|
|
925
926
|
}
|
|
926
927
|
catch (error) {
|
|
@@ -929,7 +930,7 @@ class LangflowClient {
|
|
|
929
930
|
}
|
|
930
931
|
async uploadTextData(params) {
|
|
931
932
|
try {
|
|
932
|
-
const response = await this.client.post(`/files/upload/${params.flow_id}/text`, {
|
|
933
|
+
const response = await this.client.post(`/files/upload/${encodeURIComponent(params.flow_id)}/text`, {
|
|
933
934
|
text: params.text_data,
|
|
934
935
|
file_name: params.file_name
|
|
935
936
|
});
|
|
@@ -950,7 +951,7 @@ class LangflowClient {
|
|
|
950
951
|
}
|
|
951
952
|
async updateCustomComponent(componentId, updates) {
|
|
952
953
|
try {
|
|
953
|
-
const response = await this.client.patch(`/custom_component/${componentId}`, updates);
|
|
954
|
+
const response = await this.client.patch(`/custom_component/${encodeURIComponent(componentId)}`, updates);
|
|
954
955
|
return response.data;
|
|
955
956
|
}
|
|
956
957
|
catch (error) {
|
|
@@ -959,7 +960,7 @@ class LangflowClient {
|
|
|
959
960
|
}
|
|
960
961
|
async deleteCustomComponent(componentId) {
|
|
961
962
|
try {
|
|
962
|
-
await this.client.delete(`/custom_component/${componentId}`);
|
|
963
|
+
await this.client.delete(`/custom_component/${encodeURIComponent(componentId)}`);
|
|
963
964
|
}
|
|
964
965
|
catch (error) {
|
|
965
966
|
throw this.handleError(error, `Failed to delete custom component ${componentId}`);
|
|
@@ -967,7 +968,7 @@ class LangflowClient {
|
|
|
967
968
|
}
|
|
968
969
|
async deleteUser(userId) {
|
|
969
970
|
try {
|
|
970
|
-
await this.client.delete(`/users/${userId}`);
|
|
971
|
+
await this.client.delete(`/users/${encodeURIComponent(userId)}`);
|
|
971
972
|
}
|
|
972
973
|
catch (error) {
|
|
973
974
|
throw this.handleError(error, `Failed to delete user ${userId}`);
|
|
@@ -1002,7 +1003,7 @@ class LangflowClient {
|
|
|
1002
1003
|
}
|
|
1003
1004
|
async exportFlow(flowId) {
|
|
1004
1005
|
try {
|
|
1005
|
-
const response = await this.client.get(`/flows/${flowId}/export`);
|
|
1006
|
+
const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/export`);
|
|
1006
1007
|
return response.data;
|
|
1007
1008
|
}
|
|
1008
1009
|
catch (error) {
|
|
@@ -1020,7 +1021,7 @@ class LangflowClient {
|
|
|
1020
1021
|
}
|
|
1021
1022
|
async cloneFlow(flowId, name) {
|
|
1022
1023
|
try {
|
|
1023
|
-
const response = await this.client.post(`/flows/${flowId}/clone`, { name });
|
|
1024
|
+
const response = await this.client.post(`/flows/${encodeURIComponent(flowId)}/clone`, { name });
|
|
1024
1025
|
return response.data;
|
|
1025
1026
|
}
|
|
1026
1027
|
catch (error) {
|
|
@@ -1029,7 +1030,7 @@ class LangflowClient {
|
|
|
1029
1030
|
}
|
|
1030
1031
|
async getFlowDependencies(flowId) {
|
|
1031
1032
|
try {
|
|
1032
|
-
const response = await this.client.get(`/flows/${flowId}/dependencies`);
|
|
1033
|
+
const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/dependencies`);
|
|
1033
1034
|
return response.data;
|
|
1034
1035
|
}
|
|
1035
1036
|
catch (error) {
|
|
@@ -1047,7 +1048,7 @@ class LangflowClient {
|
|
|
1047
1048
|
}
|
|
1048
1049
|
async buildVertex(params) {
|
|
1049
1050
|
try {
|
|
1050
|
-
const response = await this.client.post(`/build/${params.flow_id}/vertices/${params.vertex_id}`, params.inputs || {});
|
|
1051
|
+
const response = await this.client.post(`/build/${encodeURIComponent(params.flow_id)}/vertices/${encodeURIComponent(params.vertex_id)}`, params.inputs || {});
|
|
1051
1052
|
return response.data;
|
|
1052
1053
|
}
|
|
1053
1054
|
catch (error) {
|
|
@@ -1056,7 +1057,7 @@ class LangflowClient {
|
|
|
1056
1057
|
}
|
|
1057
1058
|
async cancelExecution(params) {
|
|
1058
1059
|
try {
|
|
1059
|
-
const response = await this.client.post(`/executions/${params.execution_id}/cancel`);
|
|
1060
|
+
const response = await this.client.post(`/executions/${encodeURIComponent(params.execution_id)}/cancel`);
|
|
1060
1061
|
return response.data;
|
|
1061
1062
|
}
|
|
1062
1063
|
catch (error) {
|
|
@@ -1065,7 +1066,7 @@ class LangflowClient {
|
|
|
1065
1066
|
}
|
|
1066
1067
|
async getExecutionResult(params) {
|
|
1067
1068
|
try {
|
|
1068
|
-
const response = await this.client.get(`/executions/${params.execution_id}/result`);
|
|
1069
|
+
const response = await this.client.get(`/executions/${encodeURIComponent(params.execution_id)}/result`);
|
|
1069
1070
|
return response.data;
|
|
1070
1071
|
}
|
|
1071
1072
|
catch (error) {
|
|
@@ -1074,7 +1075,7 @@ class LangflowClient {
|
|
|
1074
1075
|
}
|
|
1075
1076
|
async getFileMetadata(params) {
|
|
1076
1077
|
try {
|
|
1077
|
-
const response = await this.client.get(`/files/${params.flow_id}/${params.file_name}/metadata`);
|
|
1078
|
+
const response = await this.client.get(`/files/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.file_name)}/metadata`);
|
|
1078
1079
|
return response.data;
|
|
1079
1080
|
}
|
|
1080
1081
|
catch (error) {
|
|
@@ -1092,7 +1093,7 @@ class LangflowClient {
|
|
|
1092
1093
|
}
|
|
1093
1094
|
async getUserById(userId) {
|
|
1094
1095
|
try {
|
|
1095
|
-
const response = await this.client.get(`/users/${userId}`);
|
|
1096
|
+
const response = await this.client.get(`/users/${encodeURIComponent(userId)}`);
|
|
1096
1097
|
return response.data;
|
|
1097
1098
|
}
|
|
1098
1099
|
catch (error) {
|
|
@@ -1101,7 +1102,7 @@ class LangflowClient {
|
|
|
1101
1102
|
}
|
|
1102
1103
|
async listFilesDetailed(params) {
|
|
1103
1104
|
try {
|
|
1104
|
-
const response = await this.client.get(`/files/${params.flow_id}/detailed`);
|
|
1105
|
+
const response = await this.client.get(`/files/${encodeURIComponent(params.flow_id)}/detailed`);
|
|
1105
1106
|
return response.data;
|
|
1106
1107
|
}
|
|
1107
1108
|
catch (error) {
|
|
@@ -1124,7 +1125,7 @@ class LangflowClient {
|
|
|
1124
1125
|
async runAdvancedExecution(params) {
|
|
1125
1126
|
try {
|
|
1126
1127
|
const { flow_id, ...request } = params;
|
|
1127
|
-
const response = await this.client.post(`/executions/${flow_id}/advanced`, request);
|
|
1128
|
+
const response = await this.client.post(`/executions/${encodeURIComponent(flow_id)}/advanced`, request);
|
|
1128
1129
|
return response.data;
|
|
1129
1130
|
}
|
|
1130
1131
|
catch (error) {
|
|
@@ -1153,13 +1154,42 @@ class LangflowClient {
|
|
|
1153
1154
|
}
|
|
1154
1155
|
async updateStoreComponent(componentId, updates) {
|
|
1155
1156
|
try {
|
|
1156
|
-
const response = await this.client.patch(`/store/components/${componentId}`, updates);
|
|
1157
|
+
const response = await this.client.patch(`/store/components/${encodeURIComponent(componentId)}`, updates);
|
|
1157
1158
|
return response.data;
|
|
1158
1159
|
}
|
|
1159
1160
|
catch (error) {
|
|
1160
1161
|
throw this.handleError(error, `Failed to update store component ${componentId}`);
|
|
1161
1162
|
}
|
|
1162
1163
|
}
|
|
1164
|
+
async runFlowSession(flowIdOrName, request, stream = false) {
|
|
1165
|
+
try {
|
|
1166
|
+
const response = await this.client.post(`/run/session/${encodeURIComponent(flowIdOrName)}`, { ...request, stream });
|
|
1167
|
+
return response.data;
|
|
1168
|
+
}
|
|
1169
|
+
catch (error) {
|
|
1170
|
+
throw this.handleError(error, `Failed to run flow session ${flowIdOrName}`);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
async getRegistration() {
|
|
1174
|
+
try {
|
|
1175
|
+
const response = await this.client.get('/api/v2/registration/', {
|
|
1176
|
+
baseURL: this.config.baseUrl
|
|
1177
|
+
});
|
|
1178
|
+
return response.data;
|
|
1179
|
+
}
|
|
1180
|
+
catch (error) {
|
|
1181
|
+
throw this.handleError(error, 'Failed to get registration status');
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
async registerUser(email) {
|
|
1185
|
+
try {
|
|
1186
|
+
const response = await this.client.post('/api/v2/registration/', { email }, { baseURL: this.config.baseUrl });
|
|
1187
|
+
return response.data;
|
|
1188
|
+
}
|
|
1189
|
+
catch (error) {
|
|
1190
|
+
throw this.handleError(error, 'Failed to register user');
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1163
1193
|
async validateConnection(connectionData) {
|
|
1164
1194
|
try {
|
|
1165
1195
|
const response = await this.client.post('/validate/connection', connectionData);
|
|
@@ -1171,7 +1201,7 @@ class LangflowClient {
|
|
|
1171
1201
|
}
|
|
1172
1202
|
async validateFlow(params) {
|
|
1173
1203
|
try {
|
|
1174
|
-
const response = await this.client.post(`/flows/${params.flow_id}/validate`);
|
|
1204
|
+
const response = await this.client.post(`/flows/${encodeURIComponent(params.flow_id)}/validate`);
|
|
1175
1205
|
return response.data;
|
|
1176
1206
|
}
|
|
1177
1207
|
catch (error) {
|
|
@@ -1195,8 +1225,9 @@ class LangflowClient {
|
|
|
1195
1225
|
return val;
|
|
1196
1226
|
if (depth > MAX_DEPTH)
|
|
1197
1227
|
return '[max depth exceeded]';
|
|
1198
|
-
if (Buffer.isBuffer(val) || val instanceof ArrayBuffer)
|
|
1228
|
+
if (Buffer.isBuffer(val) || val instanceof ArrayBuffer || ArrayBuffer.isView(val)) {
|
|
1199
1229
|
return '[binary data]';
|
|
1230
|
+
}
|
|
1200
1231
|
if (seen.has(val))
|
|
1201
1232
|
return '[circular reference]';
|
|
1202
1233
|
seen.add(val);
|