streamby-core 0.26.1 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -68,9 +68,9 @@ function apiConnectionRouter(config) {
|
|
|
68
68
|
return res.status(403).json({ message: 'Permission denied' });
|
|
69
69
|
}
|
|
70
70
|
const projectId = req.params.id;
|
|
71
|
-
const { name,
|
|
72
|
-
if (!name || !
|
|
73
|
-
return res.status(400).json({ message: 'name and
|
|
71
|
+
const { name, apiUrl, method, description, credentialId, prefix } = req.body;
|
|
72
|
+
if (!name || !apiUrl) {
|
|
73
|
+
return res.status(400).json({ message: 'name and apiUrl are required' });
|
|
74
74
|
}
|
|
75
75
|
if (!VALID_METHODS.includes(method)) {
|
|
76
76
|
return res.status(400).json({ message: `method must be one of: ${VALID_METHODS.join(', ')}` });
|
|
@@ -90,7 +90,7 @@ function apiConnectionRouter(config) {
|
|
|
90
90
|
}
|
|
91
91
|
const connection = await (0, apiConnection_1.addApiConnection)(config, projectId, {
|
|
92
92
|
name,
|
|
93
|
-
|
|
93
|
+
apiUrl,
|
|
94
94
|
method,
|
|
95
95
|
prefix,
|
|
96
96
|
...(description !== undefined && { description }),
|
|
@@ -132,7 +132,7 @@ function apiConnectionRouter(config) {
|
|
|
132
132
|
const prefix = apiConnection.prefix ? `${apiConnection.prefix} ` : '';
|
|
133
133
|
headers['Authorization'] = `${prefix}${decrypted}`;
|
|
134
134
|
}
|
|
135
|
-
const response = await fetch(apiConnection.
|
|
135
|
+
const response = await fetch(apiConnection.apiUrl, { method: apiConnection.method || 'GET', headers });
|
|
136
136
|
if (!response.ok) {
|
|
137
137
|
return res.status(response.status).json({ message: `External API error: ${response.statusText}` });
|
|
138
138
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StreamByConfig, ApiConnection, ApiConnectionMethod } from '../types';
|
|
2
2
|
export declare function addApiConnection(config: StreamByConfig, projectId: string, data: {
|
|
3
3
|
name: string;
|
|
4
|
-
|
|
4
|
+
apiUrl: string;
|
|
5
5
|
method: ApiConnectionMethod;
|
|
6
6
|
prefix?: string;
|
|
7
7
|
description?: string;
|
|
@@ -14,7 +14,7 @@ async function addApiConnection(config, projectId, data) {
|
|
|
14
14
|
id: new mongodb_1.ObjectId().toHexString(),
|
|
15
15
|
name: data.name,
|
|
16
16
|
prefix: data.prefix,
|
|
17
|
-
|
|
17
|
+
apiUrl: data.apiUrl,
|
|
18
18
|
method: data.method,
|
|
19
19
|
projectId,
|
|
20
20
|
createdAt: new Date(),
|
|
@@ -53,7 +53,7 @@ async function executePipeline(nodeSchema, project, config) {
|
|
|
53
53
|
headers['Authorization'] = `${prefix}${decrypted}`;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
const response = await fetch(apiConnection.
|
|
56
|
+
const response = await fetch(apiConnection.apiUrl, { method: apiConnection.method || 'GET', headers });
|
|
57
57
|
if (!response.ok)
|
|
58
58
|
throw new Error(`API connection fetch failed: ${response.statusText}`);
|
|
59
59
|
dataResults.push(await response.json());
|
package/dist/types/index.d.ts
CHANGED