@docbrasil/api-systemmanager 1.1.89 → 1.1.91

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.
package/doc/api.md CHANGED
@@ -4305,7 +4305,9 @@ Class for process, permission user
4305
4305
  * [.getOrgDocTypes(params, session)](#Process+getOrgDocTypes) ⇒ <code>Promise</code>
4306
4306
  * [.getOrgGroups(params, session)](#Process+getOrgGroups) ⇒ <code>Promise</code>
4307
4307
  * [.getOrgUsers(params, session)](#Process+getOrgUsers) ⇒ <code>Promise</code>
4308
- * [.getStepHistory(params, session)](#Process+getStepHistory) ⇒ <code>Promise.&lt;Array&gt;</code>
4308
+ * [.restart(params, session)](#Process+restart) ⇒ <code>Promise.&lt;object&gt;</code>
4309
+ * [.reexecute(params, session)](#Process+reexecute) ⇒ <code>Promise.&lt;object&gt;</code>
4310
+ * [.reexecuteTask(params, session)](#Process+reexecuteTask) ⇒ <code>Promise.&lt;object&gt;</code>
4309
4311
 
4310
4312
  <a name="Process+start"></a>
4311
4313
 
@@ -4642,22 +4644,54 @@ const params = {
4642
4644
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
4643
4645
  await api.user.process.getOrgUsers(params, session);
4644
4646
  ```
4645
- <a name="Process+getStepHistory"></a>
4647
+ <a name="Process+restart"></a>
4646
4648
 
4647
- ### process.getStepHistory(params, session) ⇒ <code>Promise.&lt;Array&gt;</code>
4648
- Get step history of a process flow
4649
+ ### process.restart(params, session) ⇒ <code>Promise.&lt;object&gt;</code>
4650
+ Restart a finished process from a specific flow step. Resets the process completion state
4651
+ and triggers re-execution from the specified flow name.
4649
4652
 
4650
4653
  **Kind**: instance method of [<code>Process</code>](#Process)
4651
- **Returns**: <code>Promise.&lt;Array&gt;</code> - Array of step history entries
4654
+ **Returns**: <code>Promise.&lt;object&gt;</code> - { response: 'OK' } on success
4652
4655
  **Access**: public
4653
4656
  **Author**: Myndware <augusto.pissarra@myndware.com>
4654
4657
 
4655
4658
  | Param | Type | Description |
4656
4659
  | --- | --- | --- |
4657
- | params | <code>object</code> | Params to get step history |
4660
+ | params | <code>object</code> | Params to restart the process |
4661
+ | params.processId | <code>string</code> | Process id (_id database); |
4658
4662
  | params.orgId | <code>string</code> | Organization id (_id database); |
4663
+ | params.flowName | <code>string</code> | The flow name of the step to restart from; |
4664
+ | session | <code>string</code> | Session, token JWT |
4665
+
4666
+ **Example**
4667
+ ```js
4668
+ const API = require('@docbrasil/api-systemmanager');
4669
+ const api = new API();
4670
+ const params = {
4671
+ processId: '5dadd01dc4af3941d42f8c5c',
4672
+ orgId: '5edd11c46b6ce9729c2c297c',
4673
+ flowName: 'Task_1'
4674
+ };
4675
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
4676
+ await api.user.process.restart(params, session);
4677
+ ```
4678
+ <a name="Process+reexecute"></a>
4679
+
4680
+ ### process.reexecute(params, session) ⇒ <code>Promise.&lt;object&gt;</code>
4681
+ Re-execute a specific flow step in a running process. Unlike restart, this does not
4682
+ reset the process completion state. Task creation is deferred to the BPMN engine via RabbitMQ.
4683
+
4684
+ **Kind**: instance method of [<code>Process</code>](#Process)
4685
+ **Returns**: <code>Promise.&lt;object&gt;</code> - { response: 'OK' } on success
4686
+ **Access**: public
4687
+ **Author**: Myndware <augusto.pissarra@myndware.com>
4688
+
4689
+ | Param | Type | Description |
4690
+ | --- | --- | --- |
4691
+ | params | <code>object</code> | Params to re-execute the process step |
4659
4692
  | params.processId | <code>string</code> | Process id (_id database); |
4660
- | params.flowId | <code>string</code> | Flow id; |
4693
+ | params.orgId | <code>string</code> | Organization id (_id database); |
4694
+ | params.flowName | <code>string</code> | The flow name of the step to re-execute; |
4661
4695
  | session | <code>string</code> | Session, token JWT |
4662
4696
 
4663
4697
  **Example**
@@ -4665,12 +4699,45 @@ Get step history of a process flow
4665
4699
  const API = require('@docbrasil/api-systemmanager');
4666
4700
  const api = new API();
4667
4701
  const params = {
4702
+ processId: '5dadd01dc4af3941d42f8c5c',
4668
4703
  orgId: '5edd11c46b6ce9729c2c297c',
4704
+ flowName: 'Task_1'
4705
+ };
4706
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
4707
+ await api.user.process.reexecute(params, session);
4708
+ ```
4709
+ <a name="Process+reexecuteTask"></a>
4710
+
4711
+ ### process.reexecuteTask(params, session) ⇒ <code>Promise.&lt;object&gt;</code>
4712
+ Re-execute a specific user task step in a running process, creating a new task
4713
+ synchronously with optional userId reassignment. For non-group tasks, the task is reassigned
4714
+ to the current logged-in user. For group tasks, the original assignment is preserved.
4715
+
4716
+ **Kind**: instance method of [<code>Process</code>](#Process)
4717
+ **Returns**: <code>Promise.&lt;object&gt;</code> - { response: 'OK', taskId } on success
4718
+ **Access**: public
4719
+ **Author**: Myndware <augusto.pissarra@myndware.com>
4720
+
4721
+ | Param | Type | Description |
4722
+ | --- | --- | --- |
4723
+ | params | <code>object</code> | Params to re-execute the task |
4724
+ | params.processId | <code>string</code> | Process id (_id database); |
4725
+ | params.orgId | <code>string</code> | Organization id (_id database); |
4726
+ | params.flowName | <code>string</code> | The flow name of the user task step to re-execute; |
4727
+ | session | <code>string</code> | Session, token JWT |
4728
+
4729
+ **Example**
4730
+ ```js
4731
+ const API = require('@docbrasil/api-systemmanager');
4732
+ const api = new API();
4733
+ const params = {
4669
4734
  processId: '5dadd01dc4af3941d42f8c5c',
4670
- flowId: 'Task_18v1xx7'
4671
- }
4735
+ orgId: '5edd11c46b6ce9729c2c297c',
4736
+ flowName: 'Task_1'
4737
+ };
4672
4738
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
4673
- const stepHistory = await api.user.process.getStepHistory(params, session);
4739
+ const result = await api.user.process.reexecuteTask(params, session);
4740
+ console.log(result.taskId);
4674
4741
  ```
4675
4742
  <a name="Register"></a>
4676
4743