@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/api/user/document.js
CHANGED
|
@@ -238,6 +238,81 @@ class Documents {
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
/**
|
|
242
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
243
|
+
* @description Add multiple documents to a doc area under a doc type
|
|
244
|
+
* @param {object} params Object for adding documents
|
|
245
|
+
* @param {string} params.orgId Organization id (_id database)
|
|
246
|
+
* @param {string} params.userId User id (_id database)
|
|
247
|
+
* @param {string} params.docAreaName The name of the doc area
|
|
248
|
+
* @param {string} params.docTypeName The name of the doc type
|
|
249
|
+
* @param {array<object>} params.docs Array of documents to add
|
|
250
|
+
* @param {string} [params.docs.document=''] The url to the document on S3, an external URL or a base64 representation of the document
|
|
251
|
+
* @param {string} [params.docs.type=''] The mime type of the document
|
|
252
|
+
* @param {string} [params.docs.name=''] The name of the document
|
|
253
|
+
* @param {string} [params.docs.content=''] The content of the document
|
|
254
|
+
* @param {number} [params.docs.bytes=0] The bytes (in kb) of the document
|
|
255
|
+
* @param {string} [params.docs.urlType=''] The urlType of the document
|
|
256
|
+
* @param {string} [params.docs.description=''] The description of the document
|
|
257
|
+
* @param {string} [params.docs.category=''] The category of the document
|
|
258
|
+
* @param {array<string>} [params.docs.tags=[]] The tags of the document
|
|
259
|
+
* @param {object} [params.docs.docTypeFieldsData={}] The data related to this document
|
|
260
|
+
* @param {boolean} [params.docs.hasPhisicalStorage=false] The flag to define if the document has physical storage or not
|
|
261
|
+
* @param {string} [params.docs.boxId=''] The boxId if we define the document has physical storage
|
|
262
|
+
* @param {number} [params.docs.status] The document status
|
|
263
|
+
* @param {string} [params.docs.storageStatus=''] The storageStatus if we define the document has physical storage
|
|
264
|
+
* @param {string} session Session, token JWT
|
|
265
|
+
* @return {Promise<object>} The result of the operation
|
|
266
|
+
* @return {boolean} return.success True if the operation was successful
|
|
267
|
+
* @return {array<object>} return.added Array of added documents
|
|
268
|
+
* @return {array<object>} return.notAdded Array of documents that could not be added
|
|
269
|
+
* @public
|
|
270
|
+
* @async
|
|
271
|
+
* @example
|
|
272
|
+
*
|
|
273
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
274
|
+
* const api = new API();
|
|
275
|
+
* const params = {
|
|
276
|
+
* orgId: '5df7f19618430c89a41a19d2',
|
|
277
|
+
* userId: '5df7f19618430c89a41a19d3',
|
|
278
|
+
* docAreaName: 'My Doc Area',
|
|
279
|
+
* docTypeName: 'My Doc Type',
|
|
280
|
+
* docs: [
|
|
281
|
+
* {
|
|
282
|
+
* document: 'https://s3.amazonaws.com/...',
|
|
283
|
+
* type: 'application/pdf',
|
|
284
|
+
* name: 'Document 1',
|
|
285
|
+
* description: 'First document',
|
|
286
|
+
* category: 'Category 1',
|
|
287
|
+
* tags: ['tag1', 'tag2'],
|
|
288
|
+
* docTypeFieldsData: { extraField: 'value' },
|
|
289
|
+
* bytes: 12345
|
|
290
|
+
* }
|
|
291
|
+
* ]
|
|
292
|
+
* };
|
|
293
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
294
|
+
* const result = await api.user.document.addDocuments(params, session);
|
|
295
|
+
*/
|
|
296
|
+
async addDocuments(params, session) {
|
|
297
|
+
const self = this;
|
|
298
|
+
try {
|
|
299
|
+
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
300
|
+
Joi.assert(params.orgId, Joi.string().required().error(new Error('orgId is required')));
|
|
301
|
+
Joi.assert(params.userId, Joi.string().required().error(new Error('userId is required')));
|
|
302
|
+
Joi.assert(params.docAreaName, Joi.string().required().error(new Error('docAreaName is required')));
|
|
303
|
+
Joi.assert(params.docTypeName, Joi.string().required().error(new Error('docTypeName is required')));
|
|
304
|
+
Joi.assert(params.docs, Joi.array().required().error(new Error('docs is required')));
|
|
305
|
+
Joi.assert(session, Joi.string().required().error(new Error('session is required')));
|
|
306
|
+
|
|
307
|
+
const apiCall = self._client
|
|
308
|
+
.put('/organizations/documents', params, self._setHeader(session));
|
|
309
|
+
|
|
310
|
+
return self._returnData(await apiCall);
|
|
311
|
+
} catch (ex) {
|
|
312
|
+
throw ex;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
241
316
|
/**
|
|
242
317
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
243
318
|
* @description Updates a document
|
package/api/user/process.js
CHANGED
|
@@ -553,6 +553,47 @@ class Process {
|
|
|
553
553
|
throw ex;
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
559
|
+
* @description Get step history of a process flow
|
|
560
|
+
* @param {object} params Params to get step history
|
|
561
|
+
* @param {string} params.orgId Organization id (_id database);
|
|
562
|
+
* @param {string} params.processId Process id (_id database);
|
|
563
|
+
* @param {string} params.flowId Flow id;
|
|
564
|
+
* @param {string} session Session, token JWT
|
|
565
|
+
* @return {Promise<Array>} Array of step history entries
|
|
566
|
+
* @public
|
|
567
|
+
* @async
|
|
568
|
+
* @example
|
|
569
|
+
*
|
|
570
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
571
|
+
* const api = new API();
|
|
572
|
+
* const params = {
|
|
573
|
+
* orgId: '5edd11c46b6ce9729c2c297c',
|
|
574
|
+
* processId: '5dadd01dc4af3941d42f8c5c',
|
|
575
|
+
* flowId: 'Task_18v1xx7'
|
|
576
|
+
* }
|
|
577
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
578
|
+
* const stepHistory = await api.user.process.getStepHistory(params, session);
|
|
579
|
+
*/
|
|
580
|
+
async getStepHistory(params, session) {
|
|
581
|
+
const self = this;
|
|
582
|
+
|
|
583
|
+
try {
|
|
584
|
+
Joi.assert(params, Joi.object().required());
|
|
585
|
+
Joi.assert(params.orgId, Joi.string().required());
|
|
586
|
+
Joi.assert(params.processId, Joi.string().required());
|
|
587
|
+
Joi.assert(params.flowId, Joi.string().required());
|
|
588
|
+
Joi.assert(session, Joi.string().required());
|
|
589
|
+
|
|
590
|
+
const {orgId, processId, flowId} = params;
|
|
591
|
+
const apiCall = self._client.get(`/organizations/${orgId}/process/${processId}/flow/${flowId}/history`, self._setHeader(session));
|
|
592
|
+
return self._returnData(await apiCall, []);
|
|
593
|
+
} catch (ex) {
|
|
594
|
+
throw ex;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
556
597
|
}
|
|
557
598
|
|
|
558
599
|
export default Process;
|
package/dist/bundle.cjs
CHANGED
|
@@ -892,6 +892,81 @@ class Documents {
|
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
894
|
|
|
895
|
+
/**
|
|
896
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
897
|
+
* @description Add multiple documents to a doc area under a doc type
|
|
898
|
+
* @param {object} params Object for adding documents
|
|
899
|
+
* @param {string} params.orgId Organization id (_id database)
|
|
900
|
+
* @param {string} params.userId User id (_id database)
|
|
901
|
+
* @param {string} params.docAreaName The name of the doc area
|
|
902
|
+
* @param {string} params.docTypeName The name of the doc type
|
|
903
|
+
* @param {array<object>} params.docs Array of documents to add
|
|
904
|
+
* @param {string} [params.docs.document=''] The url to the document on S3, an external URL or a base64 representation of the document
|
|
905
|
+
* @param {string} [params.docs.type=''] The mime type of the document
|
|
906
|
+
* @param {string} [params.docs.name=''] The name of the document
|
|
907
|
+
* @param {string} [params.docs.content=''] The content of the document
|
|
908
|
+
* @param {number} [params.docs.bytes=0] The bytes (in kb) of the document
|
|
909
|
+
* @param {string} [params.docs.urlType=''] The urlType of the document
|
|
910
|
+
* @param {string} [params.docs.description=''] The description of the document
|
|
911
|
+
* @param {string} [params.docs.category=''] The category of the document
|
|
912
|
+
* @param {array<string>} [params.docs.tags=[]] The tags of the document
|
|
913
|
+
* @param {object} [params.docs.docTypeFieldsData={}] The data related to this document
|
|
914
|
+
* @param {boolean} [params.docs.hasPhisicalStorage=false] The flag to define if the document has physical storage or not
|
|
915
|
+
* @param {string} [params.docs.boxId=''] The boxId if we define the document has physical storage
|
|
916
|
+
* @param {number} [params.docs.status] The document status
|
|
917
|
+
* @param {string} [params.docs.storageStatus=''] The storageStatus if we define the document has physical storage
|
|
918
|
+
* @param {string} session Session, token JWT
|
|
919
|
+
* @return {Promise<object>} The result of the operation
|
|
920
|
+
* @return {boolean} return.success True if the operation was successful
|
|
921
|
+
* @return {array<object>} return.added Array of added documents
|
|
922
|
+
* @return {array<object>} return.notAdded Array of documents that could not be added
|
|
923
|
+
* @public
|
|
924
|
+
* @async
|
|
925
|
+
* @example
|
|
926
|
+
*
|
|
927
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
928
|
+
* const api = new API();
|
|
929
|
+
* const params = {
|
|
930
|
+
* orgId: '5df7f19618430c89a41a19d2',
|
|
931
|
+
* userId: '5df7f19618430c89a41a19d3',
|
|
932
|
+
* docAreaName: 'My Doc Area',
|
|
933
|
+
* docTypeName: 'My Doc Type',
|
|
934
|
+
* docs: [
|
|
935
|
+
* {
|
|
936
|
+
* document: 'https://s3.amazonaws.com/...',
|
|
937
|
+
* type: 'application/pdf',
|
|
938
|
+
* name: 'Document 1',
|
|
939
|
+
* description: 'First document',
|
|
940
|
+
* category: 'Category 1',
|
|
941
|
+
* tags: ['tag1', 'tag2'],
|
|
942
|
+
* docTypeFieldsData: { extraField: 'value' },
|
|
943
|
+
* bytes: 12345
|
|
944
|
+
* }
|
|
945
|
+
* ]
|
|
946
|
+
* };
|
|
947
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
948
|
+
* const result = await api.user.document.addDocuments(params, session);
|
|
949
|
+
*/
|
|
950
|
+
async addDocuments(params, session) {
|
|
951
|
+
const self = this;
|
|
952
|
+
try {
|
|
953
|
+
Joi__default["default"].assert(params, Joi__default["default"].object().required().error(new Error('params is required')));
|
|
954
|
+
Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required().error(new Error('orgId is required')));
|
|
955
|
+
Joi__default["default"].assert(params.userId, Joi__default["default"].string().required().error(new Error('userId is required')));
|
|
956
|
+
Joi__default["default"].assert(params.docAreaName, Joi__default["default"].string().required().error(new Error('docAreaName is required')));
|
|
957
|
+
Joi__default["default"].assert(params.docTypeName, Joi__default["default"].string().required().error(new Error('docTypeName is required')));
|
|
958
|
+
Joi__default["default"].assert(params.docs, Joi__default["default"].array().required().error(new Error('docs is required')));
|
|
959
|
+
Joi__default["default"].assert(session, Joi__default["default"].string().required().error(new Error('session is required')));
|
|
960
|
+
|
|
961
|
+
const apiCall = self._client
|
|
962
|
+
.put('/organizations/documents', params, self._setHeader(session));
|
|
963
|
+
|
|
964
|
+
return self._returnData(await apiCall);
|
|
965
|
+
} catch (ex) {
|
|
966
|
+
throw ex;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
895
970
|
/**
|
|
896
971
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
897
972
|
* @description Updates a document
|
|
@@ -2504,6 +2579,47 @@ class Process {
|
|
|
2504
2579
|
throw ex;
|
|
2505
2580
|
}
|
|
2506
2581
|
}
|
|
2582
|
+
|
|
2583
|
+
/**
|
|
2584
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
2585
|
+
* @description Get step history of a process flow
|
|
2586
|
+
* @param {object} params Params to get step history
|
|
2587
|
+
* @param {string} params.orgId Organization id (_id database);
|
|
2588
|
+
* @param {string} params.processId Process id (_id database);
|
|
2589
|
+
* @param {string} params.flowId Flow id;
|
|
2590
|
+
* @param {string} session Session, token JWT
|
|
2591
|
+
* @return {Promise<Array>} Array of step history entries
|
|
2592
|
+
* @public
|
|
2593
|
+
* @async
|
|
2594
|
+
* @example
|
|
2595
|
+
*
|
|
2596
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
2597
|
+
* const api = new API();
|
|
2598
|
+
* const params = {
|
|
2599
|
+
* orgId: '5edd11c46b6ce9729c2c297c',
|
|
2600
|
+
* processId: '5dadd01dc4af3941d42f8c5c',
|
|
2601
|
+
* flowId: 'Task_18v1xx7'
|
|
2602
|
+
* }
|
|
2603
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2604
|
+
* const stepHistory = await api.user.process.getStepHistory(params, session);
|
|
2605
|
+
*/
|
|
2606
|
+
async getStepHistory(params, session) {
|
|
2607
|
+
const self = this;
|
|
2608
|
+
|
|
2609
|
+
try {
|
|
2610
|
+
Joi__default["default"].assert(params, Joi__default["default"].object().required());
|
|
2611
|
+
Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required());
|
|
2612
|
+
Joi__default["default"].assert(params.processId, Joi__default["default"].string().required());
|
|
2613
|
+
Joi__default["default"].assert(params.flowId, Joi__default["default"].string().required());
|
|
2614
|
+
Joi__default["default"].assert(session, Joi__default["default"].string().required());
|
|
2615
|
+
|
|
2616
|
+
const {orgId, processId, flowId} = params;
|
|
2617
|
+
const apiCall = self._client.get(`/organizations/${orgId}/process/${processId}/flow/${flowId}/history`, self._setHeader(session));
|
|
2618
|
+
return self._returnData(await apiCall, []);
|
|
2619
|
+
} catch (ex) {
|
|
2620
|
+
throw ex;
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2507
2623
|
}
|
|
2508
2624
|
|
|
2509
2625
|
/**
|