@docbrasil/api-systemmanager 1.2.3 → 1.2.4

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.
@@ -705,6 +705,33 @@ class Process {
705
705
  }
706
706
  }
707
707
 
708
+ /**
709
+ * @description End a running process task from a specific flow step.
710
+ * @param {object} params Params to end the process task
711
+ * @param {string} params.processId Process id (_id database);
712
+ * @param {string} params.orgId Organization id (_id database);
713
+ * @param {string} params.flowName The flow name of the step to end;
714
+ * @param {string} session Session, token JWT
715
+ * @return {Promise<object>} { response: 'OK' } on success
716
+ */
717
+ async end(params, session) {
718
+ const self = this;
719
+
720
+ try {
721
+ Joi.assert(params, Joi.object().required(), 'Params to end the process task');
722
+ Joi.assert(params.processId, Joi.string().required(), 'Process id (_id database)');
723
+ Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
724
+ Joi.assert(params.flowName, Joi.string().required(), 'Flow name of the step');
725
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
726
+
727
+ const {processId, orgId, flowName} = params;
728
+ const apiCall = self._client.post(`/organizations/${orgId}/process/${processId}/task/${flowName}/end`, {}, self._setHeader(session));
729
+ return self._returnData(await apiCall);
730
+ } catch (ex) {
731
+ throw ex;
732
+ }
733
+ }
734
+
708
735
  async getStepHistory(params, session) {
709
736
  const self = this;
710
737
 
package/dist/bundle.cjs CHANGED
@@ -2780,6 +2780,33 @@ class Process {
2780
2780
  }
2781
2781
  }
2782
2782
 
2783
+ /**
2784
+ * @description End a running process task from a specific flow step.
2785
+ * @param {object} params Params to end the process task
2786
+ * @param {string} params.processId Process id (_id database);
2787
+ * @param {string} params.orgId Organization id (_id database);
2788
+ * @param {string} params.flowName The flow name of the step to end;
2789
+ * @param {string} session Session, token JWT
2790
+ * @return {Promise<object>} { response: 'OK' } on success
2791
+ */
2792
+ async end(params, session) {
2793
+ const self = this;
2794
+
2795
+ try {
2796
+ Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Params to end the process task');
2797
+ Joi__default["default"].assert(params.processId, Joi__default["default"].string().required(), 'Process id (_id database)');
2798
+ Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required(), 'Organization id (_id database)');
2799
+ Joi__default["default"].assert(params.flowName, Joi__default["default"].string().required(), 'Flow name of the step');
2800
+ Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'Session token JWT');
2801
+
2802
+ const {processId, orgId, flowName} = params;
2803
+ const apiCall = self._client.post(`/organizations/${orgId}/process/${processId}/task/${flowName}/end`, {}, self._setHeader(session));
2804
+ return self._returnData(await apiCall);
2805
+ } catch (ex) {
2806
+ throw ex;
2807
+ }
2808
+ }
2809
+
2783
2810
  async getStepHistory(params, session) {
2784
2811
  const self = this;
2785
2812