@docbrasil/api-systemmanager 1.1.7 → 1.1.8

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.
@@ -3,6 +3,19 @@ import Boom from '@hapi/boom';
3
3
  import Joi from 'joi';
4
4
  import Moment from 'moment';
5
5
 
6
+ const Random = {
7
+ S4: function () {
8
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
9
+ },
10
+ guid: function (separator) {
11
+ var separator = (_.isUndefined(separator) ? "" : separator);
12
+ return (this.S4() + this.S4() + separator + this.S4() + separator + this.S4() + separator + this.S4() + separator + this.S4() + this.S4() + this.S4());
13
+ },
14
+ code: function () {
15
+ return this.S4().toUpperCase() + '-' + this.S4().toUpperCase() + '-' + this.S4().toUpperCase();
16
+ }
17
+ };
18
+
6
19
  /**
7
20
  * Class for documents, permission user
8
21
  * @class
@@ -79,13 +92,13 @@ class Documents {
79
92
  */
80
93
  _formatDocument(params) {
81
94
  try {
82
- const document = _.get(params, 'document');
95
+ const document = _.get(params, 'document', '');
83
96
  const urlType = _.isEmpty(document) ? '' : _.get(params, 'urlType', 'S3');
84
97
  const addType = _.isEmpty(document) ? '' : _.get(params, 'addType', 'S3_SIGNED');
85
98
  return {
86
99
  orgname: _.get(params, 'orgname'),
87
100
  areaId: _.get(params, 'areaId'),
88
- docId: _.get(params, 'docId'),
101
+ docId: _.get(params, 'docId', Random.code()),
89
102
  documentDate: _.get(params, 'documentDate', Moment().format()),
90
103
  document,
91
104
  type: _.get(params, 'type'),
package/dist/bundle.cjs CHANGED
@@ -555,6 +555,19 @@ class Users$1 {
555
555
  }
556
556
  }
557
557
 
558
+ const Random = {
559
+ S4: function () {
560
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
561
+ },
562
+ guid: function (separator) {
563
+ var separator = (___default["default"].isUndefined(separator) ? "" : separator);
564
+ return (this.S4() + this.S4() + separator + this.S4() + separator + this.S4() + separator + this.S4() + separator + this.S4() + this.S4() + this.S4());
565
+ },
566
+ code: function () {
567
+ return this.S4().toUpperCase() + '-' + this.S4().toUpperCase() + '-' + this.S4().toUpperCase();
568
+ }
569
+ };
570
+
558
571
  /**
559
572
  * Class for documents, permission user
560
573
  * @class
@@ -631,13 +644,13 @@ class Documents {
631
644
  */
632
645
  _formatDocument(params) {
633
646
  try {
634
- const document = ___default["default"].get(params, 'document');
647
+ const document = ___default["default"].get(params, 'document', '');
635
648
  const urlType = ___default["default"].isEmpty(document) ? '' : ___default["default"].get(params, 'urlType', 'S3');
636
649
  const addType = ___default["default"].isEmpty(document) ? '' : ___default["default"].get(params, 'addType', 'S3_SIGNED');
637
650
  return {
638
651
  orgname: ___default["default"].get(params, 'orgname'),
639
652
  areaId: ___default["default"].get(params, 'areaId'),
640
- docId: ___default["default"].get(params, 'docId'),
653
+ docId: ___default["default"].get(params, 'docId', Random.code()),
641
654
  documentDate: ___default["default"].get(params, 'documentDate', Moment__default["default"]().format()),
642
655
  document,
643
656
  type: ___default["default"].get(params, 'type'),