@aifabrix/builder 2.11.0 → 2.21.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/.cursor/rules/project-rules.mdc +194 -0
- package/README.md +12 -0
- package/lib/api/applications.api.js +164 -0
- package/lib/api/auth.api.js +303 -0
- package/lib/api/datasources-core.api.js +87 -0
- package/lib/api/datasources-extended.api.js +117 -0
- package/lib/api/datasources.api.js +13 -0
- package/lib/api/deployments.api.js +126 -0
- package/lib/api/environments.api.js +245 -0
- package/lib/api/external-systems.api.js +251 -0
- package/lib/api/index.js +236 -0
- package/lib/api/pipeline.api.js +234 -0
- package/lib/api/types/applications.types.js +136 -0
- package/lib/api/types/auth.types.js +218 -0
- package/lib/api/types/datasources.types.js +272 -0
- package/lib/api/types/deployments.types.js +184 -0
- package/lib/api/types/environments.types.js +197 -0
- package/lib/api/types/external-systems.types.js +244 -0
- package/lib/api/types/pipeline.types.js +125 -0
- package/lib/app-list.js +5 -7
- package/lib/app-rotate-secret.js +4 -10
- package/lib/cli.js +30 -0
- package/lib/commands/login.js +41 -12
- package/lib/datasource-deploy.js +7 -30
- package/lib/datasource-list.js +9 -6
- package/lib/deployer.js +103 -135
- package/lib/environment-deploy.js +15 -26
- package/lib/external-system-deploy.js +12 -39
- package/lib/external-system-download.js +5 -13
- package/lib/external-system-test.js +9 -12
- package/lib/generator-split.js +342 -0
- package/lib/generator.js +94 -5
- package/lib/utils/app-register-api.js +5 -10
- package/lib/utils/deployment-errors.js +88 -6
- package/package.json +1 -1
- package/tatus +0 -181
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Environments API functions
|
|
3
|
+
* @author AI Fabrix Team
|
|
4
|
+
* @version 2.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { ApiClient } = require('./index');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* List all environments
|
|
11
|
+
* GET /api/v1/environments
|
|
12
|
+
* @async
|
|
13
|
+
* @function listEnvironments
|
|
14
|
+
* @param {string} controllerUrl - Controller base URL
|
|
15
|
+
* @param {Object} authConfig - Authentication configuration
|
|
16
|
+
* @param {Object} [options] - List options
|
|
17
|
+
* @param {number} [options.page] - Page number
|
|
18
|
+
* @param {number} [options.pageSize] - Items per page
|
|
19
|
+
* @param {string} [options.sort] - Sort parameter
|
|
20
|
+
* @param {string} [options.filter] - Filter parameter
|
|
21
|
+
* @param {string} [options.search] - Search term
|
|
22
|
+
* @param {string} [options.environment] - Filter by environment type (legacy)
|
|
23
|
+
* @param {string} [options.status] - Filter by status (legacy)
|
|
24
|
+
* @returns {Promise<Object>} Paginated list of environments
|
|
25
|
+
* @throws {Error} If request fails
|
|
26
|
+
*/
|
|
27
|
+
async function listEnvironments(controllerUrl, authConfig, options = {}) {
|
|
28
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
29
|
+
return await client.get('/api/v1/environments', {
|
|
30
|
+
params: options
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create new environment
|
|
36
|
+
* POST /api/v1/environments
|
|
37
|
+
* @async
|
|
38
|
+
* @function createEnvironment
|
|
39
|
+
* @param {string} controllerUrl - Controller base URL
|
|
40
|
+
* @param {Object} authConfig - Authentication configuration
|
|
41
|
+
* @param {Object} environmentData - Environment data
|
|
42
|
+
* @param {string} environmentData.key - Environment key
|
|
43
|
+
* @param {string} environmentData.environment - Environment type
|
|
44
|
+
* @param {Object} environmentData.configuration - Environment configuration
|
|
45
|
+
* @returns {Promise<Object>} Created environment response
|
|
46
|
+
* @throws {Error} If creation fails
|
|
47
|
+
*/
|
|
48
|
+
async function createEnvironment(controllerUrl, authConfig, environmentData) {
|
|
49
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
50
|
+
return await client.post('/api/v1/environments', {
|
|
51
|
+
body: environmentData
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get environment by key
|
|
57
|
+
* GET /api/v1/environments/{envKey}
|
|
58
|
+
* @async
|
|
59
|
+
* @function getEnvironment
|
|
60
|
+
* @param {string} controllerUrl - Controller base URL
|
|
61
|
+
* @param {string} envKey - Environment key
|
|
62
|
+
* @param {Object} authConfig - Authentication configuration
|
|
63
|
+
* @returns {Promise<Object>} Environment details response
|
|
64
|
+
* @throws {Error} If request fails
|
|
65
|
+
*/
|
|
66
|
+
async function getEnvironment(controllerUrl, envKey, authConfig) {
|
|
67
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
68
|
+
return await client.get(`/api/v1/environments/${envKey}`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Update environment by key
|
|
73
|
+
* PATCH /api/v1/environments/{envKey}
|
|
74
|
+
* @async
|
|
75
|
+
* @function updateEnvironment
|
|
76
|
+
* @param {string} controllerUrl - Controller base URL
|
|
77
|
+
* @param {string} envKey - Environment key
|
|
78
|
+
* @param {Object} authConfig - Authentication configuration
|
|
79
|
+
* @param {Object} updateData - Update data
|
|
80
|
+
* @param {Object} [updateData.configuration] - Environment configuration
|
|
81
|
+
* @returns {Promise<Object>} Updated environment response
|
|
82
|
+
* @throws {Error} If update fails
|
|
83
|
+
*/
|
|
84
|
+
async function updateEnvironment(controllerUrl, envKey, authConfig, updateData) {
|
|
85
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
86
|
+
return await client.patch(`/api/v1/environments/${envKey}`, {
|
|
87
|
+
body: updateData
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get environment status
|
|
93
|
+
* GET /api/v1/environments/{envKey}/status
|
|
94
|
+
* @async
|
|
95
|
+
* @function getEnvironmentStatus
|
|
96
|
+
* @param {string} controllerUrl - Controller base URL
|
|
97
|
+
* @param {string} envKey - Environment key
|
|
98
|
+
* @param {Object} authConfig - Authentication configuration
|
|
99
|
+
* @returns {Promise<Object>} Environment status response
|
|
100
|
+
* @throws {Error} If request fails
|
|
101
|
+
*/
|
|
102
|
+
async function getEnvironmentStatus(controllerUrl, envKey, authConfig) {
|
|
103
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
104
|
+
return await client.get(`/api/v1/environments/${envKey}/status`);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* List applications in an environment
|
|
109
|
+
* GET /api/v1/environments/{envKey}/applications
|
|
110
|
+
* @async
|
|
111
|
+
* @function listEnvironmentApplications
|
|
112
|
+
* @param {string} controllerUrl - Controller base URL
|
|
113
|
+
* @param {string} envKey - Environment key
|
|
114
|
+
* @param {Object} authConfig - Authentication configuration
|
|
115
|
+
* @param {Object} [options] - List options
|
|
116
|
+
* @param {number} [options.page] - Page number
|
|
117
|
+
* @param {number} [options.pageSize] - Items per page
|
|
118
|
+
* @param {string} [options.sort] - Sort parameter
|
|
119
|
+
* @param {string} [options.filter] - Filter parameter
|
|
120
|
+
* @param {string} [options.status] - Filter by status
|
|
121
|
+
* @returns {Promise<Object>} List of applications in the environment
|
|
122
|
+
* @throws {Error} If request fails
|
|
123
|
+
*/
|
|
124
|
+
async function listEnvironmentApplications(controllerUrl, envKey, authConfig, options = {}) {
|
|
125
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
126
|
+
return await client.get(`/api/v1/environments/${envKey}/applications`, {
|
|
127
|
+
params: options
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* List deployments for environment
|
|
133
|
+
* GET /api/v1/environments/{envKey}/deployments
|
|
134
|
+
* @async
|
|
135
|
+
* @function listEnvironmentDeployments
|
|
136
|
+
* @param {string} controllerUrl - Controller base URL
|
|
137
|
+
* @param {string} envKey - Environment key
|
|
138
|
+
* @param {Object} authConfig - Authentication configuration
|
|
139
|
+
* @param {Object} [options] - List options
|
|
140
|
+
* @param {number} [options.page] - Page number
|
|
141
|
+
* @param {number} [options.pageSize] - Items per page
|
|
142
|
+
* @param {string} [options.sort] - Sort parameter
|
|
143
|
+
* @param {string} [options.filter] - Filter parameter
|
|
144
|
+
* @param {string} [options.status] - Filter by status (legacy)
|
|
145
|
+
* @param {string} [options.deploymentType] - Filter by deployment type (legacy)
|
|
146
|
+
* @returns {Promise<Object>} Paginated list of deployments
|
|
147
|
+
* @throws {Error} If request fails
|
|
148
|
+
*/
|
|
149
|
+
async function listEnvironmentDeployments(controllerUrl, envKey, authConfig, options = {}) {
|
|
150
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
151
|
+
return await client.get(`/api/v1/environments/${envKey}/deployments`, {
|
|
152
|
+
params: options
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* List roles for environment
|
|
158
|
+
* GET /api/v1/environments/{envKey}/roles
|
|
159
|
+
* @async
|
|
160
|
+
* @function listEnvironmentRoles
|
|
161
|
+
* @param {string} controllerUrl - Controller base URL
|
|
162
|
+
* @param {string} envKey - Environment key
|
|
163
|
+
* @param {Object} authConfig - Authentication configuration
|
|
164
|
+
* @returns {Promise<Object>} List of roles with mappings
|
|
165
|
+
* @throws {Error} If request fails
|
|
166
|
+
*/
|
|
167
|
+
async function listEnvironmentRoles(controllerUrl, envKey, authConfig) {
|
|
168
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
169
|
+
return await client.get(`/api/v1/environments/${envKey}/roles`);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Map role to groups for environment
|
|
174
|
+
* PATCH /api/v1/environments/{envKey}/roles/{value}/groups
|
|
175
|
+
* @async
|
|
176
|
+
* @function updateRoleGroups
|
|
177
|
+
* @param {string} controllerUrl - Controller base URL
|
|
178
|
+
* @param {string} envKey - Environment key
|
|
179
|
+
* @param {string} roleValue - Role value
|
|
180
|
+
* @param {Object} authConfig - Authentication configuration
|
|
181
|
+
* @param {string[]} groups - Array of group names
|
|
182
|
+
* @returns {Promise<Object>} Role group mappings response
|
|
183
|
+
* @throws {Error} If update fails
|
|
184
|
+
*/
|
|
185
|
+
async function updateRoleGroups(controllerUrl, envKey, roleValue, authConfig, groups) {
|
|
186
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
187
|
+
return await client.patch(`/api/v1/environments/${envKey}/roles/${roleValue}/groups`, {
|
|
188
|
+
body: { groups }
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Get application details in an environment
|
|
194
|
+
* GET /api/v1/environments/{envKey}/applications/{appKey}
|
|
195
|
+
* @async
|
|
196
|
+
* @function getEnvironmentApplication
|
|
197
|
+
* @param {string} controllerUrl - Controller base URL
|
|
198
|
+
* @param {string} envKey - Environment key
|
|
199
|
+
* @param {string} appKey - Application key
|
|
200
|
+
* @param {Object} authConfig - Authentication configuration
|
|
201
|
+
* @returns {Promise<Object>} Application details response
|
|
202
|
+
* @throws {Error} If request fails
|
|
203
|
+
*/
|
|
204
|
+
async function getEnvironmentApplication(controllerUrl, envKey, appKey, authConfig) {
|
|
205
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
206
|
+
return await client.get(`/api/v1/environments/${envKey}/applications/${appKey}`);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* List datasources in an environment
|
|
211
|
+
* GET /api/v1/environments/{envKey}/datasources
|
|
212
|
+
* @async
|
|
213
|
+
* @function listEnvironmentDatasources
|
|
214
|
+
* @param {string} controllerUrl - Controller base URL
|
|
215
|
+
* @param {string} envKey - Environment key
|
|
216
|
+
* @param {Object} authConfig - Authentication configuration
|
|
217
|
+
* @param {Object} [options] - List options
|
|
218
|
+
* @param {number} [options.page] - Page number
|
|
219
|
+
* @param {number} [options.pageSize] - Items per page
|
|
220
|
+
* @param {string} [options.sort] - Sort parameter
|
|
221
|
+
* @param {string} [options.filter] - Filter parameter
|
|
222
|
+
* @returns {Promise<Object>} List of datasources in the environment
|
|
223
|
+
* @throws {Error} If request fails
|
|
224
|
+
*/
|
|
225
|
+
async function listEnvironmentDatasources(controllerUrl, envKey, authConfig, options = {}) {
|
|
226
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
227
|
+
return await client.get(`/api/v1/environments/${envKey}/datasources`, {
|
|
228
|
+
params: options
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
module.exports = {
|
|
233
|
+
listEnvironments,
|
|
234
|
+
createEnvironment,
|
|
235
|
+
getEnvironment,
|
|
236
|
+
updateEnvironment,
|
|
237
|
+
getEnvironmentStatus,
|
|
238
|
+
listEnvironmentApplications,
|
|
239
|
+
getEnvironmentApplication,
|
|
240
|
+
listEnvironmentDatasources,
|
|
241
|
+
listEnvironmentDeployments,
|
|
242
|
+
listEnvironmentRoles,
|
|
243
|
+
updateRoleGroups
|
|
244
|
+
};
|
|
245
|
+
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview External Systems API functions
|
|
3
|
+
* @author AI Fabrix Team
|
|
4
|
+
* @version 2.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { ApiClient } = require('./index');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* List external systems
|
|
11
|
+
* GET /api/v1/external/systems
|
|
12
|
+
* @async
|
|
13
|
+
* @function listExternalSystems
|
|
14
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
15
|
+
* @param {Object} authConfig - Authentication configuration
|
|
16
|
+
* @param {Object} [options] - List options
|
|
17
|
+
* @param {number} [options.page] - Page number
|
|
18
|
+
* @param {number} [options.pageSize] - Items per page
|
|
19
|
+
* @param {string} [options.sort] - Sort parameter
|
|
20
|
+
* @param {string} [options.filter] - Filter parameter
|
|
21
|
+
* @param {string} [options.search] - Search term
|
|
22
|
+
* @returns {Promise<Object>} Paginated list of external systems
|
|
23
|
+
* @throws {Error} If request fails
|
|
24
|
+
*/
|
|
25
|
+
async function listExternalSystems(dataplaneUrl, authConfig, options = {}) {
|
|
26
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
27
|
+
return await client.get('/api/v1/external/systems', {
|
|
28
|
+
params: options
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Create external system
|
|
34
|
+
* POST /api/v1/external/systems
|
|
35
|
+
* @async
|
|
36
|
+
* @function createExternalSystem
|
|
37
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
38
|
+
* @param {Object} authConfig - Authentication configuration
|
|
39
|
+
* @param {Object} systemData - External system data
|
|
40
|
+
* @returns {Promise<Object>} Created external system response
|
|
41
|
+
* @throws {Error} If creation fails
|
|
42
|
+
*/
|
|
43
|
+
async function createExternalSystem(dataplaneUrl, authConfig, systemData) {
|
|
44
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
45
|
+
return await client.post('/api/v1/external/systems', {
|
|
46
|
+
body: systemData
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Get external system details
|
|
52
|
+
* GET /api/v1/external/systems/{systemIdOrKey}
|
|
53
|
+
* @async
|
|
54
|
+
* @function getExternalSystem
|
|
55
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
56
|
+
* @param {string} systemIdOrKey - System ID or key
|
|
57
|
+
* @param {Object} authConfig - Authentication configuration
|
|
58
|
+
* @returns {Promise<Object>} External system details response
|
|
59
|
+
* @throws {Error} If request fails
|
|
60
|
+
*/
|
|
61
|
+
async function getExternalSystem(dataplaneUrl, systemIdOrKey, authConfig) {
|
|
62
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
63
|
+
return await client.get(`/api/v1/external/systems/${systemIdOrKey}`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Update external system
|
|
68
|
+
* PUT /api/v1/external/systems/{systemIdOrKey}
|
|
69
|
+
* @async
|
|
70
|
+
* @function updateExternalSystem
|
|
71
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
72
|
+
* @param {string} systemIdOrKey - System ID or key
|
|
73
|
+
* @param {Object} authConfig - Authentication configuration
|
|
74
|
+
* @param {Object} updateData - Update data
|
|
75
|
+
* @returns {Promise<Object>} Updated external system response
|
|
76
|
+
* @throws {Error} If update fails
|
|
77
|
+
*/
|
|
78
|
+
async function updateExternalSystem(dataplaneUrl, systemIdOrKey, authConfig, updateData) {
|
|
79
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
80
|
+
return await client.put(`/api/v1/external/systems/${systemIdOrKey}`, {
|
|
81
|
+
body: updateData
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Delete external system (soft delete)
|
|
87
|
+
* DELETE /api/v1/external/systems/{systemIdOrKey}
|
|
88
|
+
* @async
|
|
89
|
+
* @function deleteExternalSystem
|
|
90
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
91
|
+
* @param {string} systemIdOrKey - System ID or key
|
|
92
|
+
* @param {Object} authConfig - Authentication configuration
|
|
93
|
+
* @returns {Promise<Object>} Delete response
|
|
94
|
+
* @throws {Error} If deletion fails
|
|
95
|
+
*/
|
|
96
|
+
async function deleteExternalSystem(dataplaneUrl, systemIdOrKey, authConfig) {
|
|
97
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
98
|
+
return await client.delete(`/api/v1/external/systems/${systemIdOrKey}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get full config with application schema and dataSources
|
|
103
|
+
* GET /api/v1/external/systems/{systemIdOrKey}/config
|
|
104
|
+
* @async
|
|
105
|
+
* @function getExternalSystemConfig
|
|
106
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
107
|
+
* @param {string} systemIdOrKey - System ID or key
|
|
108
|
+
* @param {Object} authConfig - Authentication configuration
|
|
109
|
+
* @returns {Promise<Object>} Config response with application schema and dataSources
|
|
110
|
+
* @throws {Error} If request fails
|
|
111
|
+
*/
|
|
112
|
+
async function getExternalSystemConfig(dataplaneUrl, systemIdOrKey, authConfig) {
|
|
113
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
114
|
+
return await client.get(`/api/v1/external/systems/${systemIdOrKey}/config`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Create external system from integration template
|
|
119
|
+
* POST /api/v1/external/systems/from-template
|
|
120
|
+
* @async
|
|
121
|
+
* @function createFromTemplate
|
|
122
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
123
|
+
* @param {Object} authConfig - Authentication configuration
|
|
124
|
+
* @param {Object} templateData - Template data
|
|
125
|
+
* @param {string} templateData.templateIdOrKey - Template ID or key
|
|
126
|
+
* @param {string} templateData.key - System key
|
|
127
|
+
* @param {string} templateData.displayName - Display name
|
|
128
|
+
* @returns {Promise<Object>} Created external system response (status='draft')
|
|
129
|
+
* @throws {Error} If creation fails
|
|
130
|
+
*/
|
|
131
|
+
async function createFromTemplate(dataplaneUrl, authConfig, templateData) {
|
|
132
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
133
|
+
return await client.post('/api/v1/external/systems/from-template', {
|
|
134
|
+
body: templateData
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* List OpenAPI files for system
|
|
140
|
+
* GET /api/v1/external/systems/{systemIdOrKey}/openapi-files
|
|
141
|
+
* @async
|
|
142
|
+
* @function listOpenAPIFiles
|
|
143
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
144
|
+
* @param {string} systemIdOrKey - System ID or key
|
|
145
|
+
* @param {Object} authConfig - Authentication configuration
|
|
146
|
+
* @param {Object} [options] - List options
|
|
147
|
+
* @returns {Promise<Object>} Paginated list of OpenAPI files
|
|
148
|
+
* @throws {Error} If request fails
|
|
149
|
+
*/
|
|
150
|
+
async function listOpenAPIFiles(dataplaneUrl, systemIdOrKey, authConfig, options = {}) {
|
|
151
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
152
|
+
return await client.get(`/api/v1/external/systems/${systemIdOrKey}/openapi-files`, {
|
|
153
|
+
params: options
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* List OpenAPI endpoints for system
|
|
159
|
+
* GET /api/v1/external/systems/{systemIdOrKey}/openapi-endpoints
|
|
160
|
+
* @async
|
|
161
|
+
* @function listOpenAPIEndpoints
|
|
162
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
163
|
+
* @param {string} systemIdOrKey - System ID or key
|
|
164
|
+
* @param {Object} authConfig - Authentication configuration
|
|
165
|
+
* @param {Object} [options] - List options
|
|
166
|
+
* @returns {Promise<Object>} Paginated list of OpenAPI endpoints
|
|
167
|
+
* @throws {Error} If request fails
|
|
168
|
+
*/
|
|
169
|
+
async function listOpenAPIEndpoints(dataplaneUrl, systemIdOrKey, authConfig, options = {}) {
|
|
170
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
171
|
+
return await client.get(`/api/v1/external/systems/${systemIdOrKey}/openapi-endpoints`, {
|
|
172
|
+
params: options
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Publish external system
|
|
178
|
+
* POST /api/v1/external/systems/{systemIdOrKey}/publish
|
|
179
|
+
* @async
|
|
180
|
+
* @function publishExternalSystem
|
|
181
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
182
|
+
* @param {string} systemIdOrKey - System ID or key
|
|
183
|
+
* @param {Object} authConfig - Authentication configuration
|
|
184
|
+
* @param {Object} [publishData] - Publish options
|
|
185
|
+
* @param {boolean} [publishData.generateMcpContract] - Generate MCP contract
|
|
186
|
+
* @returns {Promise<Object>} Published external system response
|
|
187
|
+
* @throws {Error} If publish fails
|
|
188
|
+
*/
|
|
189
|
+
async function publishExternalSystem(dataplaneUrl, systemIdOrKey, authConfig, publishData = {}) {
|
|
190
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
191
|
+
return await client.post(`/api/v1/external/systems/${systemIdOrKey}/publish`, {
|
|
192
|
+
body: publishData
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Rollback external system to version
|
|
198
|
+
* POST /api/v1/external/systems/{systemIdOrKey}/rollback
|
|
199
|
+
* @async
|
|
200
|
+
* @function rollbackExternalSystem
|
|
201
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
202
|
+
* @param {string} systemIdOrKey - System ID or key
|
|
203
|
+
* @param {Object} authConfig - Authentication configuration
|
|
204
|
+
* @param {Object} rollbackData - Rollback data
|
|
205
|
+
* @param {number} rollbackData.version - Version to rollback to
|
|
206
|
+
* @returns {Promise<Object>} Rolled back external system response
|
|
207
|
+
* @throws {Error} If rollback fails
|
|
208
|
+
*/
|
|
209
|
+
async function rollbackExternalSystem(dataplaneUrl, systemIdOrKey, authConfig, rollbackData) {
|
|
210
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
211
|
+
return await client.post(`/api/v1/external/systems/${systemIdOrKey}/rollback`, {
|
|
212
|
+
body: rollbackData
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Save external system as integration template
|
|
218
|
+
* POST /api/v1/external/systems/{systemIdOrKey}/save-template
|
|
219
|
+
* @async
|
|
220
|
+
* @function saveAsTemplate
|
|
221
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
222
|
+
* @param {string} systemIdOrKey - System ID or key
|
|
223
|
+
* @param {Object} authConfig - Authentication configuration
|
|
224
|
+
* @param {Object} templateData - Template data
|
|
225
|
+
* @param {string} templateData.templateKey - Template key
|
|
226
|
+
* @param {string} templateData.templateName - Template name
|
|
227
|
+
* @returns {Promise<Object>} Saved template response
|
|
228
|
+
* @throws {Error} If save fails
|
|
229
|
+
*/
|
|
230
|
+
async function saveAsTemplate(dataplaneUrl, systemIdOrKey, authConfig, templateData) {
|
|
231
|
+
const client = new ApiClient(dataplaneUrl, authConfig);
|
|
232
|
+
return await client.post(`/api/v1/external/systems/${systemIdOrKey}/save-template`, {
|
|
233
|
+
body: templateData
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
module.exports = {
|
|
238
|
+
listExternalSystems,
|
|
239
|
+
createExternalSystem,
|
|
240
|
+
getExternalSystem,
|
|
241
|
+
updateExternalSystem,
|
|
242
|
+
deleteExternalSystem,
|
|
243
|
+
getExternalSystemConfig,
|
|
244
|
+
createFromTemplate,
|
|
245
|
+
listOpenAPIFiles,
|
|
246
|
+
listOpenAPIEndpoints,
|
|
247
|
+
publishExternalSystem,
|
|
248
|
+
rollbackExternalSystem,
|
|
249
|
+
saveAsTemplate
|
|
250
|
+
};
|
|
251
|
+
|