argous 1.2.165 → 1.2.168

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,8 @@ 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 getDocsUrl(data: any): Promise<any>;
41
+ export function prepareFile(file: any): Promise<any>;
41
42
  export function createDocument({ idUnidade, cdUnidade, idDocPai, path, dsKeyWords, dtValidade, idTipoDocumento, FileName, title, idRecebimento, tpPrivacidade, description, dsClassificacao, dsCategoria, dsSubCategoria, snSensivel }: {
42
43
  idUnidade: any;
43
44
  cdUnidade: any;
package/dist/api/index.js CHANGED
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  }
48
48
  };
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.scanDocument = exports.getLink = exports.getFileFromLink = exports.createDocument = exports.prepareFile = exports.searchUsers = exports.getFileInfo = exports.cancelFileUpload = exports.endFileUpload = exports.sendFilePart = exports.inicFileUpload = exports.enviaCompartilhamentoDePrograma = exports.removePostTimeLine = exports.publicaTimeline = exports.toggleLikePost = exports.recebeInfoEstatisticas = exports.recebeInfoLoginsAtivos = exports.recebeThreadsUsuario = exports.recebeInfoThread = exports.recebeThread = exports.readNotificacao = exports.readNotificacoes = exports.getNotificacoes = exports.callProgram = exports.toggleFavorite = exports.getFavorites = exports.method = exports.action = exports.agSet = exports.agGet = exports.getProgram = exports.getPostPublicacao = exports.addCommentPost = exports.getPostsTimeline = exports.getMenu = exports.validaToken = exports.logout = exports.login = exports.fetchToArgous = exports.headers = exports.api = exports.server = void 0;
50
+ exports.scanDocument = exports.getLink = exports.getFileFromLink = exports.createDocument = exports.prepareFile = exports.getDocsUrl = exports.searchUsers = exports.getFileInfo = exports.cancelFileUpload = exports.endFileUpload = exports.sendFilePart = exports.inicFileUpload = exports.enviaCompartilhamentoDePrograma = exports.removePostTimeLine = exports.publicaTimeline = exports.toggleLikePost = exports.recebeInfoEstatisticas = exports.recebeInfoLoginsAtivos = exports.recebeThreadsUsuario = exports.recebeInfoThread = exports.recebeThread = exports.readNotificacao = exports.readNotificacoes = exports.getNotificacoes = exports.callProgram = exports.toggleFavorite = exports.getFavorites = exports.method = exports.action = exports.agSet = exports.agGet = exports.getProgram = exports.getPostPublicacao = exports.addCommentPost = exports.getPostsTimeline = exports.getMenu = exports.validaToken = exports.logout = exports.login = exports.fetchToArgous = exports.headers = exports.api = exports.server = void 0;
51
51
  var utils_1 = require("../utils");
52
52
  var config_1 = require("../utils/config");
53
53
  var server = function () { return "://" + config_1.getConfig()[/^[a-z]+.+\.com\.br$/.test(window.location.host) ? 'ip' : 'ip'] + "/" + (config_1.getConfig().path ? config_1.getConfig().path : 'jUniIII') + "/"; };
@@ -656,28 +656,49 @@ 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) {
664
- case 0:
659
+ var getDocsUrl = function (data) { return __awaiter(void 0, void 0, void 0, function () {
660
+ var res;
661
+ return __generator(this, function (_a) {
662
+ switch (_a.label) {
663
+ case 0: return [4 /*yield*/, fetch(exports.api() + "agdocsurl.rslvr", {
664
+ method: 'POST',
665
+ body: JSON.stringify(data),
666
+ headers: exports.headers()
667
+ })];
668
+ case 1:
669
+ res = _a.sent();
670
+ return [4 /*yield*/, res.json()];
671
+ case 2: return [2 /*return*/, _a.sent()];
672
+ }
673
+ });
674
+ }); };
675
+ exports.getDocsUrl = getDocsUrl;
676
+ var prepareFile = function (file) { return __awaiter(void 0, void 0, void 0, function () {
677
+ var _a, status, docsUrl, formData, res, _b, _c;
678
+ var _d;
679
+ return __generator(this, function (_e) {
680
+ switch (_e.label) {
681
+ case 0: return [4 /*yield*/, exports.getDocsUrl()];
682
+ case 1:
683
+ _a = _e.sent(), status = _a.status, docsUrl = _a.docsUrl;
684
+ if (!status)
685
+ return [2 /*return*/];
665
686
  formData = new FormData();
666
687
  formData.append('blob', file);
667
- return [4 /*yield*/, fetch(url + "/argous/docs/upload.agdoc", {
688
+ return [4 /*yield*/, fetch(docsUrl + "/argous/docs/upload.agdoc", {
668
689
  method: 'POST',
669
690
  headers: exports.headers(),
670
691
  body: formData
671
692
  })];
672
- case 1:
673
- res = _d.sent();
674
- _a = [{}];
675
- return [4 /*yield*/, res.json()];
676
693
  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 };
694
+ res = _e.sent();
695
+ _b = [{}];
696
+ return [4 /*yield*/, res.json()];
697
+ case 3:
698
+ _c = [__assign.apply(void 0, _b.concat([_e.sent()]))];
699
+ _d = { lastModified: file.lastModified, lastModifiedDate: file.lastModifiedDate, name: file.name, size: file.size, type: file.type, webkitRelativePath: file.webkitRelativePath };
679
700
  return [4 /*yield*/, file.arrayBuffer()];
680
- case 3: return [2 /*return*/, __assign.apply(void 0, _b.concat([(_c.arrayBuffer = _d.sent(), _c)]))];
701
+ case 4: return [2 /*return*/, __assign.apply(void 0, _c.concat([(_d.arrayBuffer = _e.sent(), _d)]))];
681
702
  }
682
703
  });
683
704
  }); };
@@ -685,20 +706,26 @@ exports.prepareFile = prepareFile;
685
706
  var createDocument = function (_a) {
686
707
  var idUnidade = _a.idUnidade, cdUnidade = _a.cdUnidade, idDocPai = _a.idDocPai, path = _a.path, dsKeyWords = _a.dsKeyWords, dtValidade = _a.dtValidade, idTipoDocumento = _a.idTipoDocumento, FileName = _a.FileName, title = _a.title, idRecebimento = _a.idRecebimento, tpPrivacidade = _a.tpPrivacidade, description = _a.description, dsClassificacao = _a.dsClassificacao, dsCategoria = _a.dsCategoria, dsSubCategoria = _a.dsSubCategoria, snSensivel = _a.snSensivel;
687
708
  return __awaiter(void 0, void 0, void 0, function () {
688
- return __generator(this, function (_b) {
689
- switch (_b.label) {
690
- case 0: return [4 /*yield*/, fetch(exports.api() + "docs/upload.agdoc", {
691
- method: 'POST',
692
- headers: exports.headers(),
693
- body: JSON.stringify({
694
- idUnidade: idUnidade, cdUnidade: cdUnidade, idDocPai: idDocPai, path: path,
695
- dsKeyWords: dsKeyWords, dtValidade: dtValidade, idTipoDocumento: idTipoDocumento,
696
- FileName: FileName, title: title, idRecebimento: idRecebimento,
697
- tpPrivacidade: tpPrivacidade, description: description, dsClassificacao: dsClassificacao,
698
- dsCategoria: dsCategoria, dsSubCategoria: dsSubCategoria, snSensivel: snSensivel
699
- })
700
- })];
701
- case 1: return [2 /*return*/, (_b.sent()).json()];
709
+ var _b, status, docsUrl;
710
+ return __generator(this, function (_c) {
711
+ switch (_c.label) {
712
+ case 0: return [4 /*yield*/, exports.getDocsUrl()];
713
+ case 1:
714
+ _b = _c.sent(), status = _b.status, docsUrl = _b.docsUrl;
715
+ if (!status)
716
+ return [2 /*return*/];
717
+ return [4 /*yield*/, fetch(docsUrl + "docs/upload.agdoc", {
718
+ method: 'POST',
719
+ headers: exports.headers(),
720
+ body: JSON.stringify({
721
+ idUnidade: idUnidade, cdUnidade: cdUnidade, idDocPai: idDocPai, path: path,
722
+ dsKeyWords: dsKeyWords, dtValidade: dtValidade, idTipoDocumento: idTipoDocumento,
723
+ FileName: FileName, title: title, idRecebimento: idRecebimento,
724
+ tpPrivacidade: tpPrivacidade, description: description, dsClassificacao: dsClassificacao,
725
+ dsCategoria: dsCategoria, dsSubCategoria: dsSubCategoria, snSensivel: snSensivel
726
+ })
727
+ })];
728
+ case 2: return [2 /*return*/, (_c.sent()).json()];
702
729
  }
703
730
  });
704
731
  });
@@ -121,7 +121,7 @@ export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, Ar
121
121
  */
122
122
  tableProps?: TableProps,
123
123
  /**
124
- * Props repassados ao toolbar
124
+ * Props repassados ao componente toolbar
125
125
  */
126
126
  toolbarProps?: any
127
127
  }
@@ -165,13 +165,13 @@ var initialState = function (defaultRowsPerPage) { return ({
165
165
  loading: false
166
166
  }); };
167
167
  var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
168
- var _b = _a.ToolbarComponent, ToolbarComponent = _b === void 0 ? __1.ArgousComplexTableToolbar : _b, _c = _a.HeadComponent, HeadComponent = _c === void 0 ? __1.ArgousComplexTableHead : _c, _d = _a.BodyComponent, BodyComponent = _d === void 0 ? __1.ArgousComplexTableBody : _d, _e = _a.PaginationComponent, PaginationComponent = _e === void 0 ? __1.ArgousComplexPagination : _e, _f = _a.paginationControl, paginationControl = _f === void 0 ? {} : _f, _g = _a.FooterComponent, FooterComponent = _g === void 0 ? undefined : _g, footerProps = _a.footerProps, dados = _a.dados, _h = _a.head, head = _h === void 0 ? [] : _h, _j = _a.line, line = _j === void 0 ? function (i) { return i; } : _j, actions = _a.actions, title = _a.title, _k = _a.defaultRowsPerPage, defaultRowsPerPage = _k === void 0 ? 10 : _k, _l = _a.rowsPerPageOptions, rowsPerPageOptions = _l === void 0 ? [10, 25, 50] : _l, checkEnabled = _a.enableCheck, disableCheckIf = _a.disableCheckIf, showCount = _a.showCount, lineStyle = _a.lineStyle, _m = _a.lineClass, lineClass = _m === void 0 ? function () { return undefined; } : _m, onClick = _a.onClick, onDoubleClick = _a.onDoubleClick, _o = _a.children, children = _o === void 0 ? undefined : _o, style = _a.style, className = _a.className, columnStyles = _a.columnStyles, headerColumnStyles = _a.headerColumnStyles, columnOptions = _a.columnOptions, disableFilter = _a.disableFilter, _p = _a.filterLabel, filterLabel = _p === void 0 ? 'Filtro' : _p, _q = _a.indexToSelect, indexToSelect = _q === void 0 ? 0 : _q, _r = _a.disableSorting, disableSorting = _r === void 0 ? [] : _r, _s = _a.size, size = _s === void 0 ? 'small' : _s, onOpen = _a.onOpen, lineTitle = _a.lineTitle, onClose = _a.onClose, method = _a.method, methodPrms = _a.methodPrms, _t = _a.methodResultList, methodResultList = _t === void 0 ? 'lista' : _t, onMethodResponse = _a.onMethodResponse, field = _a.field, fixedToolbar = _a.fixedToolbar, onSelect = _a.onSelect, customKey = _a.customKey, _u = _a.columnProps, columnProps = _u === void 0 ? function () { return ''; } : _u, _v = _a.rowProps, rowProps = _v === void 0 ? function () { return ''; } : _v, _w = _a.savedState, savedState = _w === void 0 ? {} : _w, containerProps = _a.containerProps, _x = _a.onClickAway, onClickAway = _x === void 0 ? function () { return undefined; } : _x, enableCheckIfSelected = _a.enableCheckIfSelected, enableDrag = _a.enableDrag, onDrop = _a.onDrop, tableProps = _a.tableProps, toolbarProps = _a.toolbarProps;
168
+ var _b = _a.ToolbarComponent, ToolbarComponent = _b === void 0 ? __1.ArgousComplexTableToolbar : _b, _c = _a.HeadComponent, HeadComponent = _c === void 0 ? __1.ArgousComplexTableHead : _c, _d = _a.BodyComponent, BodyComponent = _d === void 0 ? __1.ArgousComplexTableBody : _d, _e = _a.PaginationComponent, PaginationComponent = _e === void 0 ? __1.ArgousComplexPagination : _e, _f = _a.FooterComponent, FooterComponent = _f === void 0 ? undefined : _f, footerProps = _a.footerProps, dados = _a.dados, _g = _a.head, head = _g === void 0 ? [] : _g, _h = _a.line, line = _h === void 0 ? function (i) { return i; } : _h, actions = _a.actions, title = _a.title, _j = _a.defaultRowsPerPage, defaultRowsPerPage = _j === void 0 ? 10 : _j, _k = _a.rowsPerPageOptions, rowsPerPageOptions = _k === void 0 ? [10, 25, 50] : _k, checkEnabled = _a.enableCheck, disableCheckIf = _a.disableCheckIf, showCount = _a.showCount, lineStyle = _a.lineStyle, _l = _a.lineClass, lineClass = _l === void 0 ? function () { return undefined; } : _l, onClick = _a.onClick, onDoubleClick = _a.onDoubleClick, _m = _a.children, children = _m === void 0 ? undefined : _m, style = _a.style, className = _a.className, columnStyles = _a.columnStyles, headerColumnStyles = _a.headerColumnStyles, columnOptions = _a.columnOptions, disableFilter = _a.disableFilter, _o = _a.filterLabel, filterLabel = _o === void 0 ? 'Filtro' : _o, _p = _a.indexToSelect, indexToSelect = _p === void 0 ? 0 : _p, _q = _a.disableSorting, disableSorting = _q === void 0 ? [] : _q, _r = _a.size, size = _r === void 0 ? 'small' : _r, onOpen = _a.onOpen, lineTitle = _a.lineTitle, onClose = _a.onClose, method = _a.method, methodPrms = _a.methodPrms, _s = _a.methodResultList, methodResultList = _s === void 0 ? 'lista' : _s, onMethodResponse = _a.onMethodResponse, field = _a.field, fixedToolbar = _a.fixedToolbar, onSelect = _a.onSelect, customKey = _a.customKey, _t = _a.columnProps, columnProps = _t === void 0 ? function () { return ''; } : _t, _u = _a.rowProps, rowProps = _u === void 0 ? function () { return ''; } : _u, _v = _a.savedState, savedState = _v === void 0 ? {} : _v, containerProps = _a.containerProps, _w = _a.onClickAway, onClickAway = _w === void 0 ? function () { return undefined; } : _w, enableCheckIfSelected = _a.enableCheckIfSelected, enableDrag = _a.enableDrag, onDrop = _a.onDrop, tableProps = _a.tableProps, toolbarProps = _a.toolbarProps;
169
169
  var classes = useStyles();
170
- var _y = react_1.useReducer(reducer, initialState(defaultRowsPerPage)), state = _y[0], dispatch = _y[1];
170
+ var _x = react_1.useReducer(reducer, initialState(defaultRowsPerPage)), state = _x[0], dispatch = _x[1];
171
171
  var memoState = react_1.useMemo(function () { return (__assign(__assign({}, state), { dispatch: dispatch })); }, [state, dispatch]);
172
172
  var selected = memoState.selected, page = memoState.page, rowsPerPage = memoState.rowsPerPage, order = memoState.order, orderBy = memoState.orderBy, filter = memoState.filter, open = memoState.open;
173
- var _z = react_1.useState(dados /*.map(linha => isArray(linha) ? linha : Object.values(linha))*/ || []), lista = _z[0], setLista = _z[1];
174
- var _0 = react_1.useState(__assign(__assign({}, paginationControl), { qtRegs: defaultRowsPerPage, pgAtl: 1 })), ctrlPgn = _0[0], setCtrlPgn = _0[1];
173
+ var _y = react_1.useState(dados /*.map(linha => isArray(linha) ? linha : Object.values(linha))*/ || []), lista = _y[0], setLista = _y[1];
174
+ var _z = react_1.useState({ qtRegs: defaultRowsPerPage, pgAtl: 1 }), ctrlPgn = _z[0], setCtrlPgn = _z[1];
175
175
  var qtRegs = ctrlPgn.qtRegs, pgAtl = ctrlPgn.pgAtl, ordCols = ctrlPgn.ordCols;
176
176
  var enableCheck = checkEnabled || (enableCheckIfSelected && !!selected.length);
177
177
  react_1.useEffect(function () {
@@ -201,26 +201,21 @@ var FilePreparer = function (_a, ref) {
201
201
  onChange && onChange(multiple ? v || [] : (v || [])[0], motivo);
202
202
  };
203
203
  var preparaArquivo = react_1.useCallback(function (file) { return __awaiter(void 0, void 0, void 0, function () {
204
- var resultUrl, reqs, i, res, resps;
204
+ var reqs, i, res, resps;
205
205
  return __generator(this, function (_a) {
206
206
  switch (_a.label) {
207
207
  case 0:
208
208
  if (!file)
209
209
  return [2 /*return*/];
210
210
  setLoading(true);
211
- return [4 /*yield*/, api_1.fetchToArgous('agdocsurl', {})];
212
- case 1:
213
- resultUrl = _a.sent();
214
- if (!resultUrl.status)
215
- return [2 /*return*/];
216
211
  reqs = [];
217
212
  if (file.map)
218
213
  reqs = file;
219
214
  else
220
215
  for (i = 0; i < file.length; i++)
221
216
  reqs.push(file[i]);
222
- return [4 /*yield*/, Promise.all(reqs.map(function (item) { return api_1.prepareFile(item.fileObject || item, resultUrl.docsUrl); }))];
223
- case 2:
217
+ return [4 /*yield*/, Promise.all(reqs.map(function (item) { return api_1.prepareFile(item.fileObject || item); }))];
218
+ case 1:
224
219
  res = _a.sent();
225
220
  resps = [];
226
221
  res.forEach(function (item, i) {
package/lib/api/index.js CHANGED
@@ -335,10 +335,21 @@ 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 getDocsUrl = async (data) => {
339
+ const res = await fetch(`${api()}agdocsurl.rslvr`, {
340
+ method: 'POST',
341
+ body: JSON.stringify(data),
342
+ headers: headers()
343
+ });
344
+ return await res.json();
345
+ };
346
+
347
+ export const prepareFile = async (file) => {
348
+ const { status, docsUrl } = await getDocsUrl();
349
+ if (!status) return;
339
350
  const formData = new FormData();
340
351
  formData.append('blob', file);
341
- const res = await fetch(`${url}/argous/docs/upload.agdoc`, {
352
+ const res = await fetch(`${docsUrl}/argous/docs/upload.agdoc`, {
342
353
  method: 'POST',
343
354
  headers: headers(),
344
355
  body: formData
@@ -361,7 +372,9 @@ export const createDocument = async ({
361
372
  tpPrivacidade, description, dsClassificacao,
362
373
  dsCategoria, dsSubCategoria, snSensivel
363
374
  }) => {
364
- return (await fetch(`${api()}docs/upload.agdoc`, {
375
+ const { status, docsUrl } = await getDocsUrl();
376
+ if (!status) return;
377
+ return (await fetch(`${docsUrl}docs/upload.agdoc`, {
365
378
  method: 'POST',
366
379
  headers: headers(),
367
380
  body: JSON.stringify({
@@ -121,7 +121,7 @@ export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, Ar
121
121
  */
122
122
  tableProps?: TableProps,
123
123
  /**
124
- * Props repassados ao toolbar
124
+ * Props repassados ao componente toolbar
125
125
  */
126
126
  toolbarProps?: any
127
127
  }
@@ -125,7 +125,6 @@ const ArgousComplexTable = forwardRef(({
125
125
  HeadComponent = ArgousComplexTableHead,
126
126
  BodyComponent = ArgousComplexTableBody,
127
127
  PaginationComponent = ArgousComplexPagination,
128
- paginationControl = {},
129
128
  FooterComponent = undefined,
130
129
  footerProps,
131
130
  dados,
@@ -181,7 +180,7 @@ const ArgousComplexTable = forwardRef(({
181
180
  const { selected, page, rowsPerPage, order, orderBy, filter, open } = memoState;
182
181
 
183
182
  const [lista, setLista] = useState(dados/*.map(linha => isArray(linha) ? linha : Object.values(linha))*/ || []);
184
- const [ctrlPgn, setCtrlPgn] = useState({ ...paginationControl, qtRegs: defaultRowsPerPage, pgAtl: 1 });
183
+ const [ctrlPgn, setCtrlPgn] = useState({ qtRegs: defaultRowsPerPage, pgAtl: 1 });
185
184
  const { qtRegs, pgAtl, ordCols } = ctrlPgn;
186
185
 
187
186
  const enableCheck = checkEnabled || (enableCheckIfSelected && !!selected.length);
@@ -1,4 +1,4 @@
1
- import { fetchToArgous, prepareFile } from '../../api';
1
+ import { prepareFile } from '../../api';
2
2
  import { setError } from '../../utils/api';
3
3
  import { Chip, CircularProgress, FilledInput, IconButton, makeStyles, TextField } from '@material-ui/core';
4
4
  import { useAutocomplete } from '@material-ui/lab';
@@ -132,12 +132,10 @@ const FilePreparer = ({
132
132
  const preparaArquivo = useCallback(async file => {
133
133
  if (!file) return;
134
134
  setLoading(true);
135
- const resultUrl = await fetchToArgous('agdocsurl', { });
136
- if (!resultUrl.status) return;
137
135
  let reqs = [];
138
136
  if (file.map) reqs = file;
139
137
  else for (let i = 0; i < file.length; i++) reqs.push(file[i]);
140
- const res = await Promise.all(reqs.map(item => prepareFile(item.fileObject || item, resultUrl.docsUrl)));
138
+ const res = await Promise.all(reqs.map(item => prepareFile(item.fileObject || item)));
141
139
  let resps = [];
142
140
  res.forEach((item, i) => {
143
141
  if (item.idRecebimento) resps.push({ ...item, path: file[i].fullPath });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.165",
3
+ "version": "1.2.168",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",