@docbrasil/api-systemmanager 1.1.68 → 1.1.70
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/api/user/document.js +75 -0
- package/api/user/process.js +41 -0
- package/dist/bundle.cjs +116 -0
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +91 -0
- package/docs/Documents.html +1057 -16
- package/docs/Process.html +296 -0
- package/docs/user_document.js.html +75 -0
- package/docs/user_process.js.html +41 -0
- package/package.json +1 -1
package/docs/Process.html
CHANGED
|
@@ -2795,6 +2795,302 @@ await api.user.process.getProcessProperties(params, session);</code></pre>
|
|
|
2795
2795
|
|
|
2796
2796
|
|
|
2797
2797
|
|
|
2798
|
+
</div>
|
|
2799
|
+
|
|
2800
|
+
<div class="member">
|
|
2801
|
+
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
<h4 class="name" id="getStepHistory">
|
|
2805
|
+
<a class="href-link" href="#getStepHistory">#</a>
|
|
2806
|
+
|
|
2807
|
+
|
|
2808
|
+
<span class='tag'>async</span>
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
<span class="code-name">
|
|
2812
|
+
|
|
2813
|
+
getStepHistory<span class="signature">(params, session)</span><span class="type-signature"> → {Promise.<Array>}</span>
|
|
2814
|
+
|
|
2815
|
+
</span>
|
|
2816
|
+
</h4>
|
|
2817
|
+
|
|
2818
|
+
|
|
2819
|
+
|
|
2820
|
+
|
|
2821
|
+
<div class="description">
|
|
2822
|
+
Get step history of a process flow
|
|
2823
|
+
</div>
|
|
2824
|
+
|
|
2825
|
+
|
|
2826
|
+
|
|
2827
|
+
|
|
2828
|
+
|
|
2829
|
+
|
|
2830
|
+
|
|
2831
|
+
|
|
2832
|
+
|
|
2833
|
+
|
|
2834
|
+
<h5>Parameters:</h5>
|
|
2835
|
+
|
|
2836
|
+
<div class="table-container">
|
|
2837
|
+
<table class="params table">
|
|
2838
|
+
<thead>
|
|
2839
|
+
<tr>
|
|
2840
|
+
|
|
2841
|
+
<th>Name</th>
|
|
2842
|
+
|
|
2843
|
+
|
|
2844
|
+
<th>Type</th>
|
|
2845
|
+
|
|
2846
|
+
|
|
2847
|
+
|
|
2848
|
+
|
|
2849
|
+
|
|
2850
|
+
<th class="last">Description</th>
|
|
2851
|
+
</tr>
|
|
2852
|
+
</thead>
|
|
2853
|
+
|
|
2854
|
+
<tbody>
|
|
2855
|
+
|
|
2856
|
+
|
|
2857
|
+
|
|
2858
|
+
<tr class="deep-level-0">
|
|
2859
|
+
|
|
2860
|
+
<td class="name"><code>params</code></td>
|
|
2861
|
+
|
|
2862
|
+
|
|
2863
|
+
<td class="type">
|
|
2864
|
+
|
|
2865
|
+
|
|
2866
|
+
<code class="param-type">object</code>
|
|
2867
|
+
|
|
2868
|
+
|
|
2869
|
+
|
|
2870
|
+
</td>
|
|
2871
|
+
|
|
2872
|
+
|
|
2873
|
+
|
|
2874
|
+
|
|
2875
|
+
|
|
2876
|
+
<td class="description last">Params to get step history</td>
|
|
2877
|
+
</tr>
|
|
2878
|
+
|
|
2879
|
+
|
|
2880
|
+
|
|
2881
|
+
|
|
2882
|
+
<tr class="deep-level-1">
|
|
2883
|
+
|
|
2884
|
+
<td class="name"><code>orgId</code></td>
|
|
2885
|
+
|
|
2886
|
+
|
|
2887
|
+
<td class="type">
|
|
2888
|
+
|
|
2889
|
+
|
|
2890
|
+
<code class="param-type">string</code>
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
|
|
2894
|
+
</td>
|
|
2895
|
+
|
|
2896
|
+
|
|
2897
|
+
|
|
2898
|
+
|
|
2899
|
+
|
|
2900
|
+
<td class="description last">Organization id (_id database);</td>
|
|
2901
|
+
</tr>
|
|
2902
|
+
|
|
2903
|
+
|
|
2904
|
+
|
|
2905
|
+
<tr class="deep-level-1">
|
|
2906
|
+
|
|
2907
|
+
<td class="name"><code>processId</code></td>
|
|
2908
|
+
|
|
2909
|
+
|
|
2910
|
+
<td class="type">
|
|
2911
|
+
|
|
2912
|
+
|
|
2913
|
+
<code class="param-type">string</code>
|
|
2914
|
+
|
|
2915
|
+
|
|
2916
|
+
|
|
2917
|
+
</td>
|
|
2918
|
+
|
|
2919
|
+
|
|
2920
|
+
|
|
2921
|
+
|
|
2922
|
+
|
|
2923
|
+
<td class="description last">Process id (_id database);</td>
|
|
2924
|
+
</tr>
|
|
2925
|
+
|
|
2926
|
+
|
|
2927
|
+
|
|
2928
|
+
<tr class="deep-level-1">
|
|
2929
|
+
|
|
2930
|
+
<td class="name"><code>flowId</code></td>
|
|
2931
|
+
|
|
2932
|
+
|
|
2933
|
+
<td class="type">
|
|
2934
|
+
|
|
2935
|
+
|
|
2936
|
+
<code class="param-type">string</code>
|
|
2937
|
+
|
|
2938
|
+
|
|
2939
|
+
|
|
2940
|
+
</td>
|
|
2941
|
+
|
|
2942
|
+
|
|
2943
|
+
|
|
2944
|
+
|
|
2945
|
+
|
|
2946
|
+
<td class="description last">Flow id;</td>
|
|
2947
|
+
</tr>
|
|
2948
|
+
|
|
2949
|
+
|
|
2950
|
+
|
|
2951
|
+
|
|
2952
|
+
|
|
2953
|
+
|
|
2954
|
+
|
|
2955
|
+
<tr class="deep-level-0">
|
|
2956
|
+
|
|
2957
|
+
<td class="name"><code>session</code></td>
|
|
2958
|
+
|
|
2959
|
+
|
|
2960
|
+
<td class="type">
|
|
2961
|
+
|
|
2962
|
+
|
|
2963
|
+
<code class="param-type">string</code>
|
|
2964
|
+
|
|
2965
|
+
|
|
2966
|
+
|
|
2967
|
+
</td>
|
|
2968
|
+
|
|
2969
|
+
|
|
2970
|
+
|
|
2971
|
+
|
|
2972
|
+
|
|
2973
|
+
<td class="description last">Session, token JWT</td>
|
|
2974
|
+
</tr>
|
|
2975
|
+
|
|
2976
|
+
|
|
2977
|
+
|
|
2978
|
+
</tbody>
|
|
2979
|
+
</table>
|
|
2980
|
+
</div>
|
|
2981
|
+
|
|
2982
|
+
|
|
2983
|
+
|
|
2984
|
+
|
|
2985
|
+
|
|
2986
|
+
<dl class="details">
|
|
2987
|
+
|
|
2988
|
+
|
|
2989
|
+
|
|
2990
|
+
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
|
+
|
|
2994
|
+
|
|
2995
|
+
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
|
|
3000
|
+
|
|
3001
|
+
|
|
3002
|
+
|
|
3003
|
+
|
|
3004
|
+
|
|
3005
|
+
<dt class="tag-author">Author:</dt>
|
|
3006
|
+
<dd class="tag-author">
|
|
3007
|
+
<ul>
|
|
3008
|
+
<li><a href="mailto:augusto.pissarra@myndware.com">Myndware</a></li>
|
|
3009
|
+
</ul>
|
|
3010
|
+
</dd>
|
|
3011
|
+
|
|
3012
|
+
|
|
3013
|
+
|
|
3014
|
+
|
|
3015
|
+
|
|
3016
|
+
|
|
3017
|
+
|
|
3018
|
+
|
|
3019
|
+
|
|
3020
|
+
|
|
3021
|
+
|
|
3022
|
+
|
|
3023
|
+
|
|
3024
|
+
|
|
3025
|
+
<p class="tag-source">
|
|
3026
|
+
<a href="user_process.js.html" class="button">View Source</a>
|
|
3027
|
+
<span>
|
|
3028
|
+
<a href="user_process.js.html">user/process.js</a>, <a href="user_process.js.html#line580">line 580</a>
|
|
3029
|
+
</span>
|
|
3030
|
+
</p>
|
|
3031
|
+
|
|
3032
|
+
</dl>
|
|
3033
|
+
|
|
3034
|
+
|
|
3035
|
+
|
|
3036
|
+
|
|
3037
|
+
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
|
|
3041
|
+
|
|
3042
|
+
|
|
3043
|
+
|
|
3044
|
+
|
|
3045
|
+
|
|
3046
|
+
|
|
3047
|
+
|
|
3048
|
+
|
|
3049
|
+
|
|
3050
|
+
|
|
3051
|
+
<div class='columns method-parameter'>
|
|
3052
|
+
<div class="column is-2"><label>Returns:</label></div>
|
|
3053
|
+
<div class="column is-10">
|
|
3054
|
+
|
|
3055
|
+
|
|
3056
|
+
|
|
3057
|
+
<div class="columns">
|
|
3058
|
+
|
|
3059
|
+
<div class='param-desc column is-7'>Array of step history entries</div>
|
|
3060
|
+
|
|
3061
|
+
|
|
3062
|
+
<div class='column is-5 has-text-left'>
|
|
3063
|
+
<label>Type: </label>
|
|
3064
|
+
|
|
3065
|
+
<code class="param-type">Promise.<Array></code>
|
|
3066
|
+
|
|
3067
|
+
|
|
3068
|
+
</div>
|
|
3069
|
+
|
|
3070
|
+
</div>
|
|
3071
|
+
|
|
3072
|
+
|
|
3073
|
+
</div>
|
|
3074
|
+
</div>
|
|
3075
|
+
|
|
3076
|
+
|
|
3077
|
+
|
|
3078
|
+
|
|
3079
|
+
<h5>Example</h5>
|
|
3080
|
+
|
|
3081
|
+
|
|
3082
|
+
<pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
|
|
3083
|
+
const api = new API();
|
|
3084
|
+
const params = {
|
|
3085
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
3086
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
3087
|
+
flowId: 'Task_18v1xx7'
|
|
3088
|
+
}
|
|
3089
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3090
|
+
const stepHistory = await api.user.process.getStepHistory(params, session);</code></pre>
|
|
3091
|
+
|
|
3092
|
+
|
|
3093
|
+
|
|
2798
3094
|
</div>
|
|
2799
3095
|
|
|
2800
3096
|
<div class="member">
|
|
@@ -325,6 +325,81 @@ class Documents {
|
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
/**
|
|
329
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
330
|
+
* @description Add multiple documents to a doc area under a doc type
|
|
331
|
+
* @param {object} params Object for adding documents
|
|
332
|
+
* @param {string} params.orgId Organization id (_id database)
|
|
333
|
+
* @param {string} params.userId User id (_id database)
|
|
334
|
+
* @param {string} params.docAreaName The name of the doc area
|
|
335
|
+
* @param {string} params.docTypeName The name of the doc type
|
|
336
|
+
* @param {array<object>} params.docs Array of documents to add
|
|
337
|
+
* @param {string} [params.docs.document=''] The url to the document on S3, an external URL or a base64 representation of the document
|
|
338
|
+
* @param {string} [params.docs.type=''] The mime type of the document
|
|
339
|
+
* @param {string} [params.docs.name=''] The name of the document
|
|
340
|
+
* @param {string} [params.docs.content=''] The content of the document
|
|
341
|
+
* @param {number} [params.docs.bytes=0] The bytes (in kb) of the document
|
|
342
|
+
* @param {string} [params.docs.urlType=''] The urlType of the document
|
|
343
|
+
* @param {string} [params.docs.description=''] The description of the document
|
|
344
|
+
* @param {string} [params.docs.category=''] The category of the document
|
|
345
|
+
* @param {array<string>} [params.docs.tags=[]] The tags of the document
|
|
346
|
+
* @param {object} [params.docs.docTypeFieldsData={}] The data related to this document
|
|
347
|
+
* @param {boolean} [params.docs.hasPhisicalStorage=false] The flag to define if the document has physical storage or not
|
|
348
|
+
* @param {string} [params.docs.boxId=''] The boxId if we define the document has physical storage
|
|
349
|
+
* @param {number} [params.docs.status] The document status
|
|
350
|
+
* @param {string} [params.docs.storageStatus=''] The storageStatus if we define the document has physical storage
|
|
351
|
+
* @param {string} session Session, token JWT
|
|
352
|
+
* @return {Promise<object>} The result of the operation
|
|
353
|
+
* @return {boolean} return.success True if the operation was successful
|
|
354
|
+
* @return {array<object>} return.added Array of added documents
|
|
355
|
+
* @return {array<object>} return.notAdded Array of documents that could not be added
|
|
356
|
+
* @public
|
|
357
|
+
* @async
|
|
358
|
+
* @example
|
|
359
|
+
*
|
|
360
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
361
|
+
* const api = new API();
|
|
362
|
+
* const params = {
|
|
363
|
+
* orgId: '5df7f19618430c89a41a19d2',
|
|
364
|
+
* userId: '5df7f19618430c89a41a19d3',
|
|
365
|
+
* docAreaName: 'My Doc Area',
|
|
366
|
+
* docTypeName: 'My Doc Type',
|
|
367
|
+
* docs: [
|
|
368
|
+
* {
|
|
369
|
+
* document: 'https://s3.amazonaws.com/...',
|
|
370
|
+
* type: 'application/pdf',
|
|
371
|
+
* name: 'Document 1',
|
|
372
|
+
* description: 'First document',
|
|
373
|
+
* category: 'Category 1',
|
|
374
|
+
* tags: ['tag1', 'tag2'],
|
|
375
|
+
* docTypeFieldsData: { extraField: 'value' },
|
|
376
|
+
* bytes: 12345
|
|
377
|
+
* }
|
|
378
|
+
* ]
|
|
379
|
+
* };
|
|
380
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
381
|
+
* const result = await api.user.document.addDocuments(params, session);
|
|
382
|
+
*/
|
|
383
|
+
async addDocuments(params, session) {
|
|
384
|
+
const self = this;
|
|
385
|
+
try {
|
|
386
|
+
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
387
|
+
Joi.assert(params.orgId, Joi.string().required().error(new Error('orgId is required')));
|
|
388
|
+
Joi.assert(params.userId, Joi.string().required().error(new Error('userId is required')));
|
|
389
|
+
Joi.assert(params.docAreaName, Joi.string().required().error(new Error('docAreaName is required')));
|
|
390
|
+
Joi.assert(params.docTypeName, Joi.string().required().error(new Error('docTypeName is required')));
|
|
391
|
+
Joi.assert(params.docs, Joi.array().required().error(new Error('docs is required')));
|
|
392
|
+
Joi.assert(session, Joi.string().required().error(new Error('session is required')));
|
|
393
|
+
|
|
394
|
+
const apiCall = self._client
|
|
395
|
+
.put('/organizations/documents', params, self._setHeader(session));
|
|
396
|
+
|
|
397
|
+
return self._returnData(await apiCall);
|
|
398
|
+
} catch (ex) {
|
|
399
|
+
throw ex;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
328
403
|
/**
|
|
329
404
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
330
405
|
* @description Updates a document
|
|
@@ -640,6 +640,47 @@ class Process {
|
|
|
640
640
|
throw ex;
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
646
|
+
* @description Get step history of a process flow
|
|
647
|
+
* @param {object} params Params to get step history
|
|
648
|
+
* @param {string} params.orgId Organization id (_id database);
|
|
649
|
+
* @param {string} params.processId Process id (_id database);
|
|
650
|
+
* @param {string} params.flowId Flow id;
|
|
651
|
+
* @param {string} session Session, token JWT
|
|
652
|
+
* @return {Promise<Array>} Array of step history entries
|
|
653
|
+
* @public
|
|
654
|
+
* @async
|
|
655
|
+
* @example
|
|
656
|
+
*
|
|
657
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
658
|
+
* const api = new API();
|
|
659
|
+
* const params = {
|
|
660
|
+
* orgId: '5edd11c46b6ce9729c2c297c',
|
|
661
|
+
* processId: '5dadd01dc4af3941d42f8c5c',
|
|
662
|
+
* flowId: 'Task_18v1xx7'
|
|
663
|
+
* }
|
|
664
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
665
|
+
* const stepHistory = await api.user.process.getStepHistory(params, session);
|
|
666
|
+
*/
|
|
667
|
+
async getStepHistory(params, session) {
|
|
668
|
+
const self = this;
|
|
669
|
+
|
|
670
|
+
try {
|
|
671
|
+
Joi.assert(params, Joi.object().required());
|
|
672
|
+
Joi.assert(params.orgId, Joi.string().required());
|
|
673
|
+
Joi.assert(params.processId, Joi.string().required());
|
|
674
|
+
Joi.assert(params.flowId, Joi.string().required());
|
|
675
|
+
Joi.assert(session, Joi.string().required());
|
|
676
|
+
|
|
677
|
+
const {orgId, processId, flowId} = params;
|
|
678
|
+
const apiCall = self._client.get(`/organizations/${orgId}/process/${processId}/flow/${flowId}/history`, self._setHeader(session));
|
|
679
|
+
return self._returnData(await apiCall, []);
|
|
680
|
+
} catch (ex) {
|
|
681
|
+
throw ex;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
643
684
|
}
|
|
644
685
|
|
|
645
686
|
export default Process;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docbrasil/api-systemmanager",
|
|
3
3
|
"description": "Module API System Manager",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.70",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"htmldoc": "rm -rf docs && jsdoc api/** -d docs -t ./node_modules/better-docs",
|
|
7
7
|
"doc": "rm -rf doc && mkdir doc && jsdoc2md api/**/* api/* > doc/api.md",
|