import { IStepConnectorForm } from '../catalogo-protocol'; import { icon } from './mock-connectors'; const steps: IStepConnectorForm[] = [ { title: 'REST CONNECTOR OVERVIEW', description: 'Complete Rest Connector Service', version: '1.0.0', type: "overview", url: 'https://sysmapsolutions.atlassian.net/wiki/spaces/QKSDOC/pages/690028581/Catalogo', image: icon }, { title: 'REST CONNECTOR DEFINITION', description: 'Define which API will be target', version: '1.0.0', type: "step", content: { metadata: { init: [], data: { "title": "", "type": "object", "properties": { "apiURL": { "title": "Enter a valid URL for contract", "type": "string" }, "contentBase64": { "title": "Or Upload a file", "type": "string" }, "hasAuthentication": { "title": " ", "type": "boolean" }, "username": { "title": "If authentication set username", "type": "string" }, "password": { "title": "So set password", "type": "string" } }, "dependencies": { } } }, ui: { "apiURL": { "ui:widget": "AntdInput", }, "contentBase64": { "ui:widget": "AntdUpload", "ui:options": { title: 'Click or drag file to this area to upload', hint: 'Suport .json, .yaml or .yml files', accept: '.json,.yaml,.yml' } }, "hasAuthentication": { "ui:widget": "AntdCheckBox", "ui:options": { checkBoxText: 'Has Autentication?', } }, "username": { "ui:widget": "AntdInput" }, "password": { "ui:widget": "AntdPassword" } }, relationships: [ ], submit: { request: { base: "http://openapi-parser.studio.quarks-ecosystem.io", endpoint: { source: '/openapi/details', params: [] }, data: {}, header: { "Content-Type": "application/json" }, headerParser: { formatter: { format: { 'Authorization': 'Basic <%= username %> : <%= password %>' }, params: [ { param: 'username', source: 'formData(username)' }, { param: 'password', source: 'encode(formData(password))' } ] } }, method: "post", bodyParser: { formatter: { format: { apiURL: '<%= apiURL %>', contentBase64: '<%= contentBase64 %>' }, params: [ { param: 'apiURL', source: 'formData(apiURL)' }, { param: 'contentBase64', source: 'fileContent(formData(contentBase64))' } ] } } }, styles: { text: 'Send', position: 'right' } } } }, { title: 'REST CONNECTOR CONFIGURATION', description: 'Finish Configuration Connector', version: '1.0.0', type: "submit", content: { metadata: { init: [ { resolve: 'context.step_1.paths', populate: { target: 'connectorEndpoint', enum: { source: '<%= path %>', params: [ { param: 'path', source: 'key(0)' } ] }, enumNames: { source: '<%= path %>', params: [ { param: 'path', source: 'key(0)' } ] } } } ], data: { "title": "", "type": "object", "properties": { "taskRetryConfiguration": { "title": "Retry Configuration(only for Long Running)", "type": "string" }, "replyConnectorErrors": { "title": " ", "type": "boolean" }, "mappingResponseHeaders": { "title": " ", "type": "boolean" }, "connectorEndpoint": { "title": "Select Endpoint", "type": "string", "enum": [ ], "enumNames": [ ] }, "connectorMethod": { "title": "Select Method", "type": "string", "enum": [ ], "enumNames": [ ] } }, "dependencies": { } } }, ui: { "taskRetryConfiguration": { "ui:widget": "AntdInput", "ui:options": { hint: `
Configuração de retry para task (Referência)
ex: R3/PT1M - 3 repetições com intervalo de 1 min
` } }, "replyConnectorErrors": { "ui:widget": "AntdCheckBox", "ui:options": { checkBoxText: 'Reply Connector Errors', hint: 'Defines whether connector error (statusCode and response body) will be propagated to the stream' } }, "mappingResponseHeaders": { "ui:widget": "AntdCheckBox", "ui:options": { checkBoxText: 'Mapping Response Headers', hint: 'Defines whether response headers will be added to the task output data context (json response only)' } }, "connectorEndpoint": { "ui:widget": "AntdSelect", "ui:options": { disabled: false, hidden: false, hint: 'REST operation endpoint (protocol + host + port)' } }, "connectorMethod": { "ui:widget": "AntdSelect", "ui:options": { disabled: false, hidden: false, hint: 'REST operation HTTP Method' } } }, relationships: [ { properties: ['connectorEndpoint'], source: 'connectorMethod', stateInvalid: { disabled: true }, stateValid: { disabled: false }, type: 'notEmpty', emitters: [ { type: 'DataSource', emit: 'onChange', response: { resolve: 'context.step_1.paths', populate: { target: 'connectorMethod', enum: { source: '<%= method %>', params: [ { source: 'keys(0, containsKey(formData(connectorEndpoint)))', param: 'method' } ] }, enumNames: { source: '<%= method %>', params: [ { source: 'keys(0, containsKey(formData(connectorEndpoint)))', param: 'method' } ] } } } } ], } ], submit: { request: { base: "HOST_GAD_FS", endpoint: { source: '/feature/enrichTask', params: [] }, data: {}, header: {}, method: "post", bodyParser: { formatter: { format: { featureName: "<%= featureName %>", email: "<%= email %>", taskId: "<%= taskId %>", connectorParameters: { connectorType: 'rest', connectorMethod: "<%= method %>", connectorUri: "<%= uri %>", connectorEndpoint: "<%= path %>", replyConnectorErrors: "<%= replyConnectorErrors %>", mappingResponseHeaders: "<%= mappingResponseHeaders %>", taskRetryConfiguration: "<%= retry %>" }, connectorContracts: [ { ext: "contract", content: "<%= connectorContract %>" } ] }, params: [ { param: "featureName", source: "context(parentId)" }, { param: "email", source: "context(user.email)" }, { param: "taskId", source: "context(shortId)" }, { param: "retry", source: "formData(taskRetryConfiguration)" }, { param: "replyConnectorErrors", source: "formData(replyConnectorErrors)" }, { param: "mappingResponseHeaders", source: "formData(mappingResponseHeaders)" }, { param: "uri", source: "context(step_1.uri)" }, { param: "path", source: "formData(connectorEndpoint)" }, { param: "method", source: "formData(connectorMethod)" }, { param: "connectorContract", source: "encode(context(step_1.contract))" } ] } } }, styles: { text: 'Install', position: 'right' } } } } ] export default steps;