Skip to content
Merged

Stage #493

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/automation.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const routes = prepareRoutes({
flowInstances : '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/find',
countInstances : '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/count',
flowInstance : '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/:executionId',
flowInstanceInitialData : '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/:executionId/initial-and-static-data',
stopInstanceExecution : '/api/app/:appId/automation/flow/:flowId/version/:versionId/instances/:executionId/stop',
runDebugInstance : '/api/app/:appId/automation/flow/:flowId/version/:versionId/debug/test-monitor/instance/run-new',

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

getFlowInstanceInitialData(appId, flowId, versionId, executionId) {
return req.automation.get(routes.flowInstanceInitialData(appId, flowId, versionId, executionId))
},

runDebugInstance(appId, flowId, versionId, body) {
return req.automation.post(routes.runDebugInstance(appId, flowId, versionId), body)
},

countFlowInstances(appId, flowId, versionId, body) {
return req.automation.post(routes.countInstances(appId, flowId, versionId), body)
},
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ import consolePreview from './console-preview'
import quickApps from './quick-apps'
import frExtensions from './fr-extensions'
import mcpServices from './mcp-services'
import mcpHosting from './mcp-hosting'
import mcpApiServices from './mcp-api-services'
import webhooks from './webhooks'
import knowledgeBase from './knowledge-base'

Expand Down Expand Up @@ -228,6 +230,8 @@ const createClient = (serverUrl, authKey, options) => {
pdf : pdf(request),
frExtensions : frExtensions(request),
mcpServices : mcpServices(request),
hostingMcpServices : mcpHosting(request),
mcpApiServices : mcpApiServices(request),
knowledgeBase : knowledgeBase(request)
}
}
Expand Down
21 changes: 21 additions & 0 deletions src/mcp-api-services.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { prepareRoutes } from './utils/routes'

const routes = prepareRoutes({
mcpApiServices : '/:appId/console/localservices/generic/mcp/list',
enableApiService : '/:appId/console/localservices/generic/:serviceVersionId/mcp/enable',
disableApiService: '/:appId/console/localservices/generic/:serviceVersionId/mcp/disable',
})

export default req => ({
getMcpApiServices(appId) {
return req.get(routes.mcpApiServices(appId))
},

enableMcpApiService(appId, serviceVersionId) {
return req.put(routes.enableApiService(appId, serviceVersionId))
},

disableMcpApiService(appId, serviceVersionId) {
return req.put(routes.disableApiService(appId, serviceVersionId))
},
})
33 changes: 33 additions & 0 deletions src/mcp-hosting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { prepareRoutes } from './utils/routes'

const routes = prepareRoutes({
hostingMcpServers : '/api/node-server/manage/app/:appId/mcp/hosting',
hostingMcpServerState : '/api/node-server/manage/app/:appId/mcp/hosting/:state',
hostingMcpServerStatus: '/api/node-server/manage/app/:appId/mcp/hosting/:mcpServerName/status',
})

export default req => ({
getHostingMcpServers(appId) {
return req.nodeAPI.get(routes.hostingMcpServers(appId))
},

getHostingMcpServerStatus(appId, mcpServerName) {
return req.nodeAPI.get(routes.hostingMcpServerStatus(appId, mcpServerName))
},

createHostingMcpServer(appId, data) {
return req.nodeAPI.post(routes.hostingMcpServers(appId), data)
},

redeployHostingMcpServer(appId, data) {
return req.nodeAPI.put(routes.hostingMcpServers(appId), data)
},

changeHostingMcpServerState(appId, state, data) {
return req.nodeAPI.put(routes.hostingMcpServerState(appId, state), data)
},

deleteHostingMcpServer(appId, data) {
return req.nodeAPI.delete(routes.hostingMcpServers(appId), data)
},
})
4 changes: 2 additions & 2 deletions src/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { prepareRoutes } from './utils/routes'
import BaseService from './base/base-service'

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

generatePDF(appId, pdf, inputs) {
return this.req.post(routes.generatePDF(appId), { pdf, inputs })
return this.req.nodeAPI.post(routes.generatePDF(appId), { pdf, inputs })
}

/**
Expand Down
21 changes: 21 additions & 0 deletions tests/specs/automation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,27 @@ describe('apiClient.automation', () => {
}
])
})

it('should make POST request to start debug session with fromSubFlowElementId', async () => {
mockSuccessAPIRequest(successResult)

const forceStart = true
const fromSubFlowElementId = 'subflow-element-123'
const result = await automationAPI.startDebugSession(appId, flowId, versionId, forceStart, fromSubFlowElementId)

expect(result).toEqual(successResult)
expect(apiRequestCalls()).toEqual([
{
path: `http://test-host:3000/api/app/${appId}/automation/flow/${flowId}/version/${versionId}/debug/test-monitor/start-session?forceStart=${forceStart}&fromSubFlowElementId=${fromSubFlowElementId}`,
body: undefined,
method: 'POST',
encoding: 'utf8',
headers: {},
timeout: 0,
withCredentials: false
}
])
})
})

describe('stopDebugSession', () => {
Expand Down
Loading