argous 1.2.165 → 1.2.166

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.
@@ -37,7 +37,7 @@ export function endFileUpload(data: any): Promise<any>;
37
37
  export function cancelFileUpload(data: any): Promise<any>;
38
38
  export function getFileInfo(data: any): Promise<any>;
39
39
  export function searchUsers(data: any): Promise<any>;
40
- export function prepareFile(file: any, url: any): Promise<any>;
40
+ export function prepareFile(file: any): Promise<any>;
41
41
  export function createDocument({ idUnidade, cdUnidade, idDocPai, path, dsKeyWords, dtValidade, idTipoDocumento, FileName, title, idRecebimento, tpPrivacidade, description, dsClassificacao, dsCategoria, dsSubCategoria, snSensivel }: {
42
42
  idUnidade: any;
43
43
  cdUnidade: any;
package/dist/api/index.js CHANGED
@@ -656,28 +656,33 @@ var searchUsers = function (data) { return __awaiter(void 0, void 0, void 0, fun
656
656
  });
657
657
  }); };
658
658
  exports.searchUsers = searchUsers;
659
- var prepareFile = function (file, url) { return __awaiter(void 0, void 0, void 0, function () {
660
- var formData, res, _a, _b;
661
- var _c;
662
- return __generator(this, function (_d) {
663
- switch (_d.label) {
659
+ var prepareFile = function (file) { return __awaiter(void 0, void 0, void 0, function () {
660
+ var formData, _a, status, docsUrl, res, _b, _c;
661
+ var _d;
662
+ return __generator(this, function (_e) {
663
+ switch (_e.label) {
664
664
  case 0:
665
665
  formData = new FormData();
666
+ return [4 /*yield*/, exports.fetchToArgous('agdocsurl', {})];
667
+ case 1:
668
+ _a = _e.sent(), status = _a.status, docsUrl = _a.docsUrl;
669
+ if (!status)
670
+ return [2 /*return*/];
666
671
  formData.append('blob', file);
667
- return [4 /*yield*/, fetch(url + "/argous/docs/upload.agdoc", {
672
+ return [4 /*yield*/, fetch(docsUrl + "/argous/docs/upload.agdoc", {
668
673
  method: 'POST',
669
674
  headers: exports.headers(),
670
675
  body: formData
671
676
  })];
672
- case 1:
673
- res = _d.sent();
674
- _a = [{}];
675
- return [4 /*yield*/, res.json()];
676
677
  case 2:
677
- _b = [__assign.apply(void 0, _a.concat([_d.sent()]))];
678
- _c = { lastModified: file.lastModified, lastModifiedDate: file.lastModifiedDate, name: file.name, size: file.size, type: file.type, webkitRelativePath: file.webkitRelativePath };
678
+ res = _e.sent();
679
+ _b = [{}];
680
+ return [4 /*yield*/, res.json()];
681
+ case 3:
682
+ _c = [__assign.apply(void 0, _b.concat([_e.sent()]))];
683
+ _d = { lastModified: file.lastModified, lastModifiedDate: file.lastModifiedDate, name: file.name, size: file.size, type: file.type, webkitRelativePath: file.webkitRelativePath };
679
684
  return [4 /*yield*/, file.arrayBuffer()];
680
- case 3: return [2 /*return*/, __assign.apply(void 0, _b.concat([(_c.arrayBuffer = _d.sent(), _c)]))];
685
+ case 4: return [2 /*return*/, __assign.apply(void 0, _c.concat([(_d.arrayBuffer = _e.sent(), _d)]))];
681
686
  }
682
687
  });
683
688
  }); };
package/lib/api/index.js CHANGED
@@ -335,10 +335,12 @@ export const searchUsers = async (data) => {
335
335
  return await res.json();
336
336
  };
337
337
 
338
- export const prepareFile = async (file, url) => {
338
+ export const prepareFile = async (file) => {
339
339
  const formData = new FormData();
340
+ const { status, docsUrl } = await fetchToArgous('agdocsurl', { });
341
+ if (!status) return;
340
342
  formData.append('blob', file);
341
- const res = await fetch(`${url}/argous/docs/upload.agdoc`, {
343
+ const res = await fetch(`${docsUrl}/argous/docs/upload.agdoc`, {
342
344
  method: 'POST',
343
345
  headers: headers(),
344
346
  body: formData
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.165",
3
+ "version": "1.2.166",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",