Skip to content

Commit 948655a

Browse files
authored
Merge pull request #493 from Backendless/stage
Stage
2 parents e76bc4b + c28ae28 commit 948655a

File tree

10 files changed

+1507
-3
lines changed

10 files changed

+1507
-3
lines changed

src/automation.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ const routes = prepareRoutes({
2020
flowInstances : '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/find',
2121
countInstances : '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/count',
2222
flowInstance : '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/:executionId',
23+
flowInstanceInitialData : '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/:executionId/initial-and-static-data',
2324
stopInstanceExecution : '/api/app/:appId/automation/flow/:flowId/version/:versionId/instances/:executionId/stop',
25+
runDebugInstance : '/api/app/:appId/automation/flow/:flowId/version/:versionId/debug/test-monitor/instance/run-new',
2426

2527
elementExecutionInfo: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/:executionId/element/:elementId',
2628
flowSlA : '/api/app/:appId/automation/flow/:flowId/version/:versionId/sla/goals',
@@ -148,6 +150,14 @@ export default req => ({
148150
return req.automation.post(routes.flowInstances(appId, flowId, versionId), body)
149151
},
150152

153+
getFlowInstanceInitialData(appId, flowId, versionId, executionId) {
154+
return req.automation.get(routes.flowInstanceInitialData(appId, flowId, versionId, executionId))
155+
},
156+
157+
runDebugInstance(appId, flowId, versionId, body) {
158+
return req.automation.post(routes.runDebugInstance(appId, flowId, versionId), body)
159+
},
160+
151161
countFlowInstances(appId, flowId, versionId, body) {
152162
return req.automation.post(routes.countInstances(appId, flowId, versionId), body)
153163
},

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ import consolePreview from './console-preview'
4747
import quickApps from './quick-apps'
4848
import frExtensions from './fr-extensions'
4949
import mcpServices from './mcp-services'
50+
import mcpHosting from './mcp-hosting'
51+
import mcpApiServices from './mcp-api-services'
5052
import webhooks from './webhooks'
5153
import knowledgeBase from './knowledge-base'
5254

@@ -228,6 +230,8 @@ const createClient = (serverUrl, authKey, options) => {
228230
pdf : pdf(request),
229231
frExtensions : frExtensions(request),
230232
mcpServices : mcpServices(request),
233+
hostingMcpServices : mcpHosting(request),
234+
mcpApiServices : mcpApiServices(request),
231235
knowledgeBase : knowledgeBase(request)
232236
}
233237
}

src/mcp-api-services.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { prepareRoutes } from './utils/routes'
2+
3+
const routes = prepareRoutes({
4+
mcpApiServices : '/:appId/console/localservices/generic/mcp/list',
5+
enableApiService : '/:appId/console/localservices/generic/:serviceVersionId/mcp/enable',
6+
disableApiService: '/:appId/console/localservices/generic/:serviceVersionId/mcp/disable',
7+
})
8+
9+
export default req => ({
10+
getMcpApiServices(appId) {
11+
return req.get(routes.mcpApiServices(appId))
12+
},
13+
14+
enableMcpApiService(appId, serviceVersionId) {
15+
return req.put(routes.enableApiService(appId, serviceVersionId))
16+
},
17+
18+
disableMcpApiService(appId, serviceVersionId) {
19+
return req.put(routes.disableApiService(appId, serviceVersionId))
20+
},
21+
})

src/mcp-hosting.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { prepareRoutes } from './utils/routes'
2+
3+
const routes = prepareRoutes({
4+
hostingMcpServers : '/api/node-server/manage/app/:appId/mcp/hosting',
5+
hostingMcpServerState : '/api/node-server/manage/app/:appId/mcp/hosting/:state',
6+
hostingMcpServerStatus: '/api/node-server/manage/app/:appId/mcp/hosting/:mcpServerName/status',
7+
})
8+
9+
export default req => ({
10+
getHostingMcpServers(appId) {
11+
return req.nodeAPI.get(routes.hostingMcpServers(appId))
12+
},
13+
14+
getHostingMcpServerStatus(appId, mcpServerName) {
15+
return req.nodeAPI.get(routes.hostingMcpServerStatus(appId, mcpServerName))
16+
},
17+
18+
createHostingMcpServer(appId, data) {
19+
return req.nodeAPI.post(routes.hostingMcpServers(appId), data)
20+
},
21+
22+
redeployHostingMcpServer(appId, data) {
23+
return req.nodeAPI.put(routes.hostingMcpServers(appId), data)
24+
},
25+
26+
changeHostingMcpServerState(appId, state, data) {
27+
return req.nodeAPI.put(routes.hostingMcpServerState(appId, state), data)
28+
},
29+
30+
deleteHostingMcpServer(appId, data) {
31+
return req.nodeAPI.delete(routes.hostingMcpServers(appId), data)
32+
},
33+
})

src/pdf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { prepareRoutes } from './utils/routes'
44
import BaseService from './base/base-service'
55

66
const routes = prepareRoutes({
7-
generatePDF: '/api/app/:appId/pdf/generate',
7+
generatePDF: '/api/node-server/manage/app/:appId/pdf/generate',
88
templates : '/:appId/console/pdf',
99
template : '/:appId/console/pdf/:templateId',
1010
})
@@ -16,7 +16,7 @@ class PDF extends BaseService {
1616
}
1717

1818
generatePDF(appId, pdf, inputs) {
19-
return this.req.post(routes.generatePDF(appId), { pdf, inputs })
19+
return this.req.nodeAPI.post(routes.generatePDF(appId), { pdf, inputs })
2020
}
2121

2222
/**

tests/specs/automation.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,27 @@ describe('apiClient.automation', () => {
579579
}
580580
])
581581
})
582+
583+
it('should make POST request to start debug session with fromSubFlowElementId', async () => {
584+
mockSuccessAPIRequest(successResult)
585+
586+
const forceStart = true
587+
const fromSubFlowElementId = 'subflow-element-123'
588+
const result = await automationAPI.startDebugSession(appId, flowId, versionId, forceStart, fromSubFlowElementId)
589+
590+
expect(result).toEqual(successResult)
591+
expect(apiRequestCalls()).toEqual([
592+
{
593+
path: `http://test-host:3000/api/app/${appId}/automation/flow/${flowId}/version/${versionId}/debug/test-monitor/start-session?forceStart=${forceStart}&fromSubFlowElementId=${fromSubFlowElementId}`,
594+
body: undefined,
595+
method: 'POST',
596+
encoding: 'utf8',
597+
headers: {},
598+
timeout: 0,
599+
withCredentials: false
600+
}
601+
])
602+
})
582603
})
583604

584605
describe('stopDebugSession', () => {

0 commit comments

Comments
 (0)