docs: cut version 1.9.0 (#12681)

* version-1.9.0-docs

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Mendon Kissling
2026-04-13 22:07:01 -04:00
committed by GitHub
parent 2fa3d1c759
commit 71fbf5ff00
506 changed files with 33466 additions and 10 deletions

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events?stream=false`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,25 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/build/${process.env.FLOW_ID ?? ""}/flow`;
const options = {
method: 'POST',
headers: {
"accept": `application/json`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"inputs": {
"input_value": "Tell me a story"
}
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,30 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/build/${process.env.FLOW_ID ?? ""}/flow`;
const options = {
method: 'POST',
headers: {
"accept": `application/json`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"data": {
"nodes": [],
"edges": []
},
"inputs": {
"input_value": "Your custom input here",
"session": "session_id"
}
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,23 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/build/${process.env.FLOW_ID ?? ""}/flow`;
const options = {
method: 'POST',
headers: {
"accept": `application/json`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"stop_component_id": "OpenAIModel-Uksag"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v2/files`;
const options = {
method: 'DELETE',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/files/delete/${process.env.FLOW_ID ?? ""}/2024-12-30_15-19-43_your_file.txt`;
const options = {
method: 'DELETE',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v2/files/${process.env.FILE_ID ?? ""}`;
const options = {
method: 'DELETE',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/files/download/${process.env.FLOW_ID ?? ""}/2024-12-30_15-19-43_your_file.txt`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.arrayBuffer();
console.log("Received binary response for downloaded_file.txt", data.byteLength);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v2/files/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.arrayBuffer();
console.log("Received binary response for downloaded_file.txt", data.byteLength);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v2/files/${process.env.FILE_ID ?? ""}?name=new_file_name`;
const options = {
method: 'PUT',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/files/list/${process.env.FLOW_ID ?? ""}`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v2/files`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,31 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/run/${process.env.FLOW_ID ?? ""}`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"input_value": "what do you see?",
"output_type": "chat",
"input_type": "text",
"tweaks": {
"Read-File-1olS3": {
"path": [
"07e5b864-e367-4f52-b647-a48035ae7e5e/3a290013-fe1e-4d3d-a454-cacae81288f3.pdf"
]
}
}
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,32 @@
const fs = require("fs");
const path = require("path");
const fixturesDir = path.join(__dirname, "../../fixtures");
const defaultUpload = path.join(fixturesDir, "sample-upload.txt");
const uploadPath = process.env.SAMPLE_UPLOAD_FILE || defaultUpload;
const uploadBuf = fs.readFileSync(uploadPath);
const uploadName = path.basename(uploadPath);
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v2/files`;
const formData = new FormData();
formData.append("file", new Blob([uploadBuf]), uploadName);
const options = {
method: "POST",
headers: {
accept: "application/json",
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: formData,
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,32 @@
const fs = require("fs");
const path = require("path");
const fixturesDir = path.join(__dirname, "../../fixtures");
const defaultUpload = path.join(fixturesDir, "sample-upload.txt");
const uploadPath = process.env.SAMPLE_UPLOAD_FILE || defaultUpload;
const uploadBuf = fs.readFileSync(uploadPath);
const uploadName = path.basename(uploadPath);
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/files/upload/${process.env.FLOW_ID ?? ""}`;
const formData = new FormData();
formData.append("file", new Blob([uploadBuf]), uploadName);
const options = {
method: "POST",
headers: {
accept: "application/json",
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: formData,
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,32 @@
const fs = require("fs");
const path = require("path");
const fixturesDir = path.join(__dirname, "../../fixtures");
const defaultUpload = path.join(fixturesDir, "sample-upload.txt");
const uploadPath = process.env.SAMPLE_UPLOAD_FILE || defaultUpload;
const uploadBuf = fs.readFileSync(uploadPath);
const uploadName = path.basename(uploadPath);
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v2/files`;
const formData = new FormData();
formData.append("file", new Blob([uploadBuf]), uploadName);
const options = {
method: "POST",
headers: {
accept: "application/json",
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: formData,
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/whoami`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,29 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/run/a430cc57-06bb-4c11-be39-d3d4de68d2c4?stream=false`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"output_type": "chat",
"input_type": "chat",
"tweaks": {
"ChatInput-b67sL": {
"files": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png",
"input_value": "describe this image"
}
}
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,31 @@
const fs = require("fs");
const path = require("path");
const fixturesDir = path.join(__dirname, "../../fixtures");
const defaultImage = path.join(fixturesDir, "sample-upload.png");
const imagePath = process.env.SAMPLE_IMAGE_FILE || defaultImage;
const imageBuf = fs.readFileSync(imagePath);
const imageName = path.basename(imagePath);
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/files/upload/${process.env.FLOW_ID ?? ""}`;
const formData = new FormData();
formData.append("file", new Blob([imageBuf]), imageName);
const options = {
method: "POST",
headers: {
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: formData,
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,27 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/run/${process.env.FLOW_ID ?? ""}`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
"X-LANGFLOW-GLOBAL-VAR-OPENAI_API_KEY": `sk-...`,
"X-LANGFLOW-GLOBAL-VAR-USER_ID": `user123`,
"X-LANGFLOW-GLOBAL-VAR-ENVIRONMENT": `production`,
},
body: JSON.stringify({
"input_value": "Tell me about something interesting!",
"input_type": "chat",
"output_type": "chat"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,32 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/run/${process.env.FLOW_ID ?? ""}?stream=true`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"input_value": "Tell me a story",
"input_type": "chat",
"output_type": "chat",
"output_component": "chat_output",
"session_id": "chat-123",
"tweaks": {
"component_id": {
"parameter_name": "value"
}
}
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,26 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/run/${process.env.FLOW_ID ?? ""}`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"input_value": "Tell me about something interesting!",
"session_id": "chat-123",
"input_type": "chat",
"output_type": "chat",
"output_component": ""
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,24 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/run/${process.env.FLOW_ID ?? ""}?stream=true`;
const options = {
method: 'POST',
headers: {
"accept": `application/json`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"message": "Tell me something interesting!",
"session_id": "chat-123"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,22 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/webhook/${process.env.FLOW_ID ?? ""}`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"data": "example-data"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,35 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/`;
const options = {
method: 'POST',
headers: {
"accept": `application/json`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"name": "string2",
"description": "string",
"icon": "string",
"icon_bg_color": "#FF0000",
"gradient": "string",
"data": {},
"is_component": false,
"updated_at": "2024-12-30T15:48:01.519Z",
"webhook": false,
"endpoint_name": "string",
"tags": [
"string"
]
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,60 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/batch/`;
const options = {
method: 'POST',
headers: {
"accept": `application/json`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"flows": [
{
"name": "string",
"description": "string",
"icon": "string",
"icon_bg_color": "string",
"gradient": "string",
"data": {},
"is_component": false,
"updated_at": "2024-12-30T18:36:02.737Z",
"webhook": false,
"endpoint_name": "string",
"tags": [
"string"
],
"locked": false,
"user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
},
{
"name": "string",
"description": "string",
"icon": "string",
"icon_bg_color": "string",
"gradient": "string",
"data": {},
"is_component": false,
"updated_at": "2024-12-30T18:36:02.737Z",
"webhook": false,
"endpoint_name": "string",
"tags": [
"string"
],
"locked": false,
"user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/${process.env.FLOW_ID ?? ""}`;
const options = {
method: 'DELETE',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,24 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/download/`;
const options = {
method: 'POST',
headers: {
"accept": `application/json`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify([
"e1e40c77-0541-41a9-88ab-ddb3419398b5",
"92f9a4c5-cfc8-4656-ae63-1f0881163c28"
]),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.arrayBuffer();
console.log("Received binary response for langflow-flows.zip", data.byteLength);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,32 @@
const fs = require("fs");
const path = require("path");
const fixturesDir = path.join(__dirname, "../../fixtures");
const defaultFlowImport = path.join(fixturesDir, "flow-import.json");
const flowImportPath = process.env.FLOW_IMPORT_FILE || defaultFlowImport;
const flowBuf = fs.readFileSync(flowImportPath);
const flowName = path.basename(flowImportPath);
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/upload/?folder_id=${process.env.FOLDER_ID ?? ""}`;
const formData = new FormData();
formData.append("file", new Blob([flowBuf], { type: "application/json" }), flowName);
const options = {
method: "POST",
headers: {
accept: "application/json",
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: formData,
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/${process.env.FLOW_ID ?? ""}`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/?remove_example_flows=true&components_only=false&get_all=false&project_id=${process.env.PROJECT_ID ?? ""}&header_flows=false&page=1&size=1`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/?remove_example_flows=false&components_only=false&get_all=true&header_flows=false&page=1&size=50`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/basic_examples/`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,28 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/${process.env.FLOW_ID ?? ""}`;
const options = {
method: 'PATCH',
headers: {
"accept": `application/json`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"name": "string",
"description": "string",
"data": {},
"project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"endpoint_name": "my_new_endpoint_name",
"locked": true
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/logs?lines_before=0&lines_after=0&timestamp=0`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/logs-stream`;
const options = {
method: 'GET',
headers: {
"accept": `text/event-stream`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/monitor/messages/session/different_session_id_2`;
const options = {
method: 'DELETE',
headers: {
"accept": `*/*`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,24 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/monitor/messages`;
const options = {
method: 'DELETE',
headers: {
"accept": `*/*`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify([
"MESSAGE_ID_1",
"MESSAGE_ID_2"
]),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/monitor/builds?flow_id=${process.env.FLOW_ID ?? ""}`;
const options = {
method: 'DELETE',
headers: {
"accept": `*/*`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/monitor/messages?flow_id=${process.env.FLOW_ID ?? ""}&session_id=01ce083d-748b-4b8d-97b6-33adbb6a528a&sender=Machine&sender_name=AI&order_by=timestamp`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/monitor/messages`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/monitor/transactions?flow_id=${process.env.FLOW_ID ?? ""}&page=1&size=50`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/monitor/builds?flow_id=${process.env.FLOW_ID ?? ""}`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,23 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/monitor/messages/3ab66cc6-c048-48f8-ab07-570f5af7b160`;
const options = {
method: 'PUT',
headers: {
"accept": `application/json`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"text": "testing 1234"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/monitor/messages/session/01ce083d-748b-4b8d-97b6-33adbb6a528a?new_session_id=different_session_id`;
const options = {
method: 'PATCH',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,16 @@
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "LANGFLOW_SERVER_URL/api/v1/",
defaultHeaders: {
"x-api-key": "LANGFLOW_API_KEY"
},
apiKey: "dummy-api-key" // Required by OpenAI SDK but not used by Langflow
});
const response = await client.responses.create({
model: "FLOW_ID",
input: "There is an event that happens on the second wednesday of every month. What are the event dates in 2026?"
});
console.log(response.output_text);

View File

@ -0,0 +1,24 @@
const url = `http://${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
const options = {
method: 'POST',
headers: {
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
"Content-Type": `application/json`,
},
body: JSON.stringify({
"model": "ced2ec91-f325-4bf0-8754-f3198c2b1563",
"input": "What's my name?",
"previous_response_id": "c45f4ac8-772b-4675-8551-c560b1afd590"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,24 @@
const url = `http://${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
const options = {
method: 'POST',
headers: {
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
"Content-Type": `application/json`,
},
body: JSON.stringify({
"model": "ced2ec91-f325-4bf0-8754-f3198c2b1563",
"input": "What's my name?",
"previous_response_id": "session-alice-1756839048"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,23 @@
const url = `http://${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
const options = {
method: 'POST',
headers: {
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
"Content-Type": `application/json`,
},
body: JSON.stringify({
"model": "$FLOW_ID",
"input": "Hello, my name is Alice"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,24 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
const options = {
method: 'POST',
headers: {
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
"Content-Type": `application/json`,
},
body: JSON.stringify({
"model": "$YOUR_FLOW_ID",
"input": "Hello, how are you?",
"stream": false
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,24 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
const options = {
method: 'POST',
headers: {
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
"Content-Type": `application/json`,
},
body: JSON.stringify({
"model": "$FLOW_ID",
"input": "Tell me a story about a robot",
"stream": true
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,26 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
const options = {
method: 'POST',
headers: {
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
"Content-Type": `application/json`,
"X-LANGFLOW-GLOBAL-VAR-OPENAI_API_KEY": `sk-...`,
"X-LANGFLOW-GLOBAL-VAR-USER_ID": `user123`,
"X-LANGFLOW-GLOBAL-VAR-ENVIRONMENT": `production`,
},
body: JSON.stringify({
"model": "your-flow-id",
"input": "Hello"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,27 @@
const url = `http://${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"model": "FLOW_ID",
"input": "Calculate 23 * 15 and show me the result",
"stream": false,
"include": [
"tool_call.results"
]
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,24 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/responses`;
const options = {
method: 'POST',
headers: {
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
"Content-Type": `application/json`,
},
body: JSON.stringify({
"model": "FLOW_ID",
"input": "Explain quantum computing in simple terms",
"stream": false
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,30 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/`;
const options = {
method: 'POST',
headers: {
"accept": `application/json`,
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"name": "new_project_name",
"description": "string",
"components_list": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"flows_list": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
]
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,25 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"name": "new_project_name",
"description": "string",
"components_list": [],
"flows_list": []
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/${process.env.PROJECT_ID ?? ""}`;
const options = {
method: 'DELETE',
headers: {
"accept": `*/*`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/download/${process.env.PROJECT_ID ?? ""}`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.arrayBuffer();
console.log("Received binary response for langflow-project.zip", data.byteLength);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,32 @@
const fs = require("fs");
const path = require("path");
const fixturesDir = path.join(__dirname, "../../fixtures");
const defaultProjectZip = path.join(fixturesDir, "project-import.zip");
const projectPath = process.env.PROJECT_IMPORT_FILE || defaultProjectZip;
const projectBuf = fs.readFileSync(projectPath);
const projectName = path.basename(projectPath);
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/upload/`;
const formData = new FormData();
formData.append("file", new Blob([projectBuf], { type: "application/zip" }), projectName);
const options = {
method: "POST",
headers: {
accept: "application/json",
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: formData,
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/${process.env.PROJECT_ID ?? ""}`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,30 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/b408ddb9-6266-4431-9be8-e04a62758331`;
const options = {
method: 'PATCH',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"name": "string",
"description": "string",
"parent_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"components": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"flows": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
]
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,29 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/run/${process.env.FLOW_ID ?? ""}?stream=false`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"input_value": "hello world!",
"output_type": "chat",
"input_type": "chat",
"tweaks": {
"ChatOutput-6zcZt": {
"should_store_message": true
}
}
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/all`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/config`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,18 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v1/version`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,18 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/health_check`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,23 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"username": "newuser2",
"password": "securepassword123"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8`;
const options = {
method: 'DELETE',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/whoami`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/?skip=0&limit=10`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,22 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8/reset-password`;
const options = {
method: 'PATCH',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"password": "newsecurepassword123"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,23 @@
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8`;
const options = {
method: 'PATCH',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"is_active": true,
"is_superuser": true
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,186 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
EXAMPLES_DIR="$SCRIPT_DIR"
TEST_SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
MODE="syntax"
load_repo_env() {
local env_file="$ROOT_DIR/.env"
if [[ -f "$env_file" ]]; then
set -a
# shellcheck source=/dev/null
source "$env_file"
set +a
fi
}
print_help() {
cat <<'EOF'
Usage:
test-javascript-examples.sh [--execute]
Modes:
(default) Syntax check only (`node --check`)
--execute Execute examples after syntax checks
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--execute)
MODE="execute"
shift
;;
--help|-h)
print_help
exit 0
;;
*)
echo "Unknown argument: $1"
print_help
exit 1
;;
esac
done
if ! command -v node >/dev/null 2>&1; then
echo "Node.js is required to test JavaScript examples."
exit 1
fi
JS_FILES=()
while IFS= read -r line; do
if [[ "$(basename "$line")" == "$TEST_SCRIPT_NAME" ]]; then
continue
fi
JS_FILES+=("$line")
done < <(python3 - "$EXAMPLES_DIR" <<'PY'
import sys
from pathlib import Path
root = Path(sys.argv[1])
for p in sorted(root.rglob("*.js")):
print(p)
PY
)
if [[ ${#JS_FILES[@]} -eq 0 ]]; then
echo "No .js examples found in $EXAMPLES_DIR"
exit 1
fi
PASS=0
FAIL=0
SKIP=0
echo "Testing ${#JS_FILES[@]} JavaScript examples in '$MODE' mode..."
if [[ "$MODE" == "execute" ]]; then
load_repo_env
fi
has_placeholder_file_inputs() {
python3 - "$1" <<'PY'
import sys
text = open(sys.argv[1], encoding="utf-8").read()
needles = ("FILE_NAME", "PATH/TO/FILE", "<file contents>")
print("yes" if any(n in text for n in needles) else "no")
PY
}
has_missing_required_env() {
python3 - "$1" <<'PY'
import os
import re
import sys
text = open(sys.argv[1], encoding="utf-8").read()
vars_to_check = ["FLOW_ID", "PROJECT_ID", "FOLDER_ID", "SESSION_ID", "JOB_ID", "USER_ID"]
for name in vars_to_check:
if re.search(rf"process\.env\.{name}\b", text) and not os.getenv(name):
print(name)
raise SystemExit(0)
print("")
PY
}
print_failure_logs() {
local out_file="$1"
local err_file="$2"
if [[ -s "$err_file" ]]; then
echo " stderr (last 12 lines):"
python3 - "$err_file" <<'PY'
import sys
from pathlib import Path
lines = Path(sys.argv[1]).read_text(encoding="utf-8", errors="replace").splitlines()
for line in lines[-12:]:
print(line)
PY
fi
if [[ -s "$out_file" ]]; then
echo " stdout (last 12 lines):"
python3 - "$out_file" <<'PY'
import sys
from pathlib import Path
lines = Path(sys.argv[1]).read_text(encoding="utf-8", errors="replace").splitlines()
for line in lines[-12:]:
print(line)
PY
fi
}
for file in "${JS_FILES[@]}"; do
rel="${file#"$ROOT_DIR"/}"
if ! node --check "$file" >/tmp/langflow-js-check.out 2>/tmp/langflow-js-check.err; then
echo "FAIL $rel (node --check)"
((FAIL+=1))
continue
fi
if [[ "$MODE" == "execute" ]]; then
if [[ -z "${LANGFLOW_API_KEY:-}" || ( -z "${LANGFLOW_URL:-}" && -z "${LANGFLOW_SERVER_URL:-}" ) ]]; then
echo "SKIP $rel (set LANGFLOW_API_KEY and LANGFLOW_URL or LANGFLOW_SERVER_URL to execute)"
((SKIP+=1))
continue
fi
if [[ "$(has_placeholder_file_inputs "$file")" == "yes" ]]; then
echo "SKIP $rel (placeholder file input values)"
((SKIP+=1))
continue
fi
missing_env="$(has_missing_required_env "$file")"
if [[ -n "$missing_env" ]]; then
echo "SKIP $rel (missing required env: $missing_env)"
((SKIP+=1))
continue
fi
if ! node "$file" >/tmp/langflow-js-example.out 2>/tmp/langflow-js-example.err; then
echo "FAIL $rel (execution)"
print_failure_logs "/tmp/langflow-js-example.out" "/tmp/langflow-js-example.err"
((FAIL+=1))
continue
fi
fi
echo "PASS $rel"
((PASS+=1))
done
echo
echo "Summary: PASS=$PASS FAIL=$FAIL SKIP=$SKIP TOTAL=${#JS_FILES[@]}"
if [[ $FAIL -gt 0 ]]; then
exit 1
fi

View File

@ -0,0 +1,29 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v2/workflows`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
"background": true,
"stream": false,
"inputs": {
"ChatInput-abc.input_type": "chat",
"ChatInput-abc.input_value": "Process this in the background",
"ChatInput-abc.session_id": "session-456"
}
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,22 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v2/workflows/stop`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"job_id": "job_id_1234567890"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,19 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v2/workflows?job_id=job_id_1234567890`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));

View File

@ -0,0 +1,28 @@
const url = `${process.env.LANGFLOW_SERVER_URL ?? ""}/api/v2/workflows`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
"background": false,
"inputs": {
"ChatInput-abc.input_type": "chat",
"ChatInput-abc.input_value": "what is 2+2",
"ChatInput-abc.session_id": "session-123"
}
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));