Skip to content

Commit 1c4e520

Browse files
authored
Merge branch 'main' into main
Signed-off-by: Anna Hileta <[email protected]>
2 parents 5fe9b70 + f8b4183 commit 1c4e520

File tree

5 files changed

+28
-92
lines changed

5 files changed

+28
-92
lines changed

client/src/components/TriggerForm/TriggerForm.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ const TriggerForm = ({ workflowId, templateType }) => {
4949
case "-":
5050
try {
5151
api.workflows.getWorkflowTriggerRequirements(workflowId).then(data => {
52-
const result = Object.values(data.data.trigger_input_schema)
53-
.filter(entry => entry.field_name !== "startDate")
52+
const result = Object.values(data.data.triggerInputSchema)
53+
.filter(entry => entry.fieldName !== "startDate")
5454
.map(entry => ({
55-
field_name: entry.field_name,
55+
fieldName: entry.fieldName,
5656
}));
5757

5858
setRelevantFormFields(generateDynamicForm(result, 'Custom'));
@@ -66,8 +66,8 @@ const TriggerForm = ({ workflowId, templateType }) => {
6666

6767
const generateDynamicForm = (fieldNames) => {
6868
return fieldNames.map((field) => ({
69-
fieldHeader: field.field_name,
70-
fieldName: field.field_name,
69+
fieldHeader: field.fieldName,
70+
fieldName: field.fieldName,
7171
value: '',
7272
}));
7373
};
@@ -103,10 +103,10 @@ const TriggerForm = ({ workflowId, templateType }) => {
103103
}
104104

105105
const { data: triggeredWorkflow } = await api.workflows.triggerWorkflow(workflowId, templateType, body);
106-
setWorkflowInstanceUrl(triggeredWorkflow.instance_url);
106+
setWorkflowInstanceUrl(triggeredWorkflow.instanceUrl);
107107

108-
if (triggeredWorkflow.instance_url !== undefined) {
109-
navigate(`${ROUTE.TRIGGERFORM}/${workflowId}?type=${templateType}&triggerUrl=${encodeURIComponent(triggeredWorkflow.instance_url)}`)
108+
if (triggeredWorkflow.instanceUrl !== undefined) {
109+
navigate(`${ROUTE.TRIGGERFORM}/${workflowId}?type=${templateType}&triggerUrl=${encodeURIComponent(triggeredWorkflow.instanceUrl)}`)
110110
}
111111

112112
if (triggeredWorkflow === WorkflowTriggerResponse.TRIGGER_ISSUE) {

client/src/pages/TriggerWorkflow/TriggerWorkflow.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const TriggerWorkflow = () => {
2424
const getWorkflowDefinitions = async () => {
2525
setWorkflowListLoading(true);
2626
const definitionsResponse = await api.workflows.getWorkflowDefinitions();
27-
const workflowDefinitions = definitionsResponse.data.data.workflows.filter(definition => definition.status !== 'inactive')
27+
const workflowDefinitions = definitionsResponse.data.data.filter(definition => definition.status !== 'inactive')
2828
.map(definition => {
2929
if (workflows.length) {
3030
const foundWorkflow = workflows.find(workflow => workflow.id === definition.id);

server/api/apiFactory.js

Lines changed: 0 additions & 63 deletions
This file was deleted.

server/api/index.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

server/services/workflowsService.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,42 @@
22
* @file
33
* This file handles work with docusign maestro and esign services.
44
* Scenarios implemented:
5-
* - Workflow definition creation.
6-
* - Workflow definition publishing.
75
* - Workflow definition triggering, which create workflow instance.
8-
* - Workflow instance cancellation.
9-
* - Workflow instance fetching.
6+
* - Workflow definitions fetching.
7+
* - Workflow trigger requirements fetching.
108
*/
119

12-
const { initMaestroApi } = require('../api');
10+
const iam = require('@docusign/iam-sdk');
1311

1412
class WorkflowsService {
1513
static getWorkflowDefinitions = async args => {
16-
const api = initMaestroApi(args.accountId, args.basePath, args.accessToken);
17-
const definitions = await api.getWorkflowDefinitions({});
14+
const client = new iam.IamClient({ accessToken: args.accessToken });
15+
const definitions = await client.maestro.workflows.getWorkflowsList({ accountId: args.accountId });
1816

1917
return definitions;
2018
};
2119

2220
static getWorkflowTriggerRequirements = async args => {
23-
const api = initMaestroApi(args.accountId, args.basePath, args.accessToken);
24-
const triggerRequirements = await api.getTriggerRequirements(args.workflowId);
21+
const client = new iam.IamClient({ accessToken: args.accessToken });
22+
const triggerRequirements = await client.maestro.workflows.getWorkflowTriggerRequirements({
23+
accountId: args.accountId,
24+
workflowId: args.workflowId,
25+
});
2526

2627
return triggerRequirements;
2728
};
2829

29-
static triggerWorkflowInstance = async (args, payload, triggerRequirements) => {
30-
const api = initMaestroApi(args.accountId, args.basePath, args.accessToken);
30+
static triggerWorkflowInstance = async (args, payload) => {
31+
const client = new iam.IamClient({ accessToken: args.accessToken });
3132
const triggerPayload = {
32-
instance_name: 'test',
33-
trigger_inputs: payload,
33+
instanceName: 'test',
34+
triggerInputs: payload,
3435
};
35-
const triggerResponse = await api.triggerWorkflow(triggerPayload, triggerRequirements.trigger_http_config.url);
36+
const triggerResponse = await client.maestro.workflows.triggerWorkflow({
37+
accountId: args.accountId,
38+
workflowId: args.workflowId,
39+
triggerWorkflow: triggerPayload,
40+
});
3641

3742
return triggerResponse;
3843
};

0 commit comments

Comments
 (0)