@navservice/core 1.97.0 → 1.99.0

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.
@@ -182,8 +182,8 @@ var types_t;
182
182
  const external_axios_namespaceObject = require("axios");
183
183
  var external_axios_default = /*#__PURE__*/__webpack_require__.n(external_axios_namespaceObject);
184
184
  ;// CONCATENATED MODULE: ./src/utils/_session_storage.ts
185
- const _session_storage = class _session_storage {
186
- static adicionar_item_session_storage({ chave, novoItem }) {
185
+ const _session_storage = new class _session_storage {
186
+ adicionar_item_session_storage({ chave, novoItem }) {
187
187
  try {
188
188
  const valorAtual = window.sessionStorage.getItem(chave);
189
189
  const listaAtual = valorAtual ? JSON.parse(valorAtual) : [];
@@ -196,14 +196,14 @@ const _session_storage = class _session_storage {
196
196
  console.error(error);
197
197
  }
198
198
  }
199
- static set_session_storage_sem_incremento({ chave, novoItem }) {
199
+ set_session_storage_sem_incremento({ chave, novoItem }) {
200
200
  try {
201
201
  window.sessionStorage.setItem(chave, JSON.stringify(novoItem));
202
202
  } catch (error) {
203
203
  console.error(error);
204
204
  }
205
205
  }
206
- static get_item_session_storage(chave) {
206
+ get_item_session_storage(chave) {
207
207
  try {
208
208
  if (typeof window !== "undefined") {
209
209
  const valorAtual = window.sessionStorage.getItem(chave);
@@ -214,13 +214,17 @@ const _session_storage = class _session_storage {
214
214
  console.error(error);
215
215
  }
216
216
  }
217
- static remover_item_session_storage(chave) {
217
+ remover_item_session_storage(chave) {
218
218
  try {
219
219
  window.sessionStorage.removeItem(chave);
220
220
  } catch (error) {
221
221
  console.error(error);
222
222
  }
223
223
  }
224
+ get usuario_auth() {
225
+ const get_auth_user = this.get_item_session_storage("auth_user");
226
+ return get_auth_user;
227
+ }
224
228
  };
225
229
  /* export default */ const utils_session_storage = (_session_storage);
226
230
 
@@ -325,8 +329,8 @@ const _api_api = class _api {
325
329
  /* export default */ const utils_api = (_api_api);
326
330
 
327
331
  ;// CONCATENATED MODULE: ./src/utils/_data.ts
328
- const _data = class _data {
329
- static YYYY_MM_DD_00_00_00(newData) {
332
+ const _data = new class _data {
333
+ YYYY_MM_DD_00_00_00(newData) {
330
334
  let dataAtual = new Date();
331
335
  if (newData) {
332
336
  dataAtual = new Date(newData);
@@ -343,7 +347,7 @@ const _data = class _data {
343
347
  const [dia, mes, ano] = data.split("/");
344
348
  return `${ano}-${mes}-${dia} ${hora}`;
345
349
  }
346
- static DD_MM_YYYY_00_00_00(newData) {
350
+ DD_MM_YYYY_00_00_00(newData) {
347
351
  let dataAtual = new Date();
348
352
  if (newData) {
349
353
  dataAtual = new Date(newData);
@@ -357,7 +361,7 @@ const _data = class _data {
357
361
  };
358
362
  return dataAtual.toLocaleString("pt-BR", options);
359
363
  }
360
- static DD_MM_YYYY_00_00(newData) {
364
+ DD_MM_YYYY_00_00(newData) {
361
365
  let dataAtual = new Date();
362
366
  if (newData) {
363
367
  dataAtual = new Date(newData);
@@ -372,7 +376,7 @@ const _data = class _data {
372
376
  const dataFormatada = dataAtual.toLocaleString("pt-BR", options).replace(",", "");
373
377
  return dataFormatada;
374
378
  }
375
- static DD_MM_YYYY(newData) {
379
+ DD_MM_YYYY(newData) {
376
380
  let dataAtual = new Date();
377
381
  if (newData) {
378
382
  dataAtual = new Date(newData);
@@ -386,7 +390,7 @@ const _data = class _data {
386
390
  };
387
391
  return dataAtual.toLocaleString("pt-BR", options);
388
392
  }
389
- static YYYY_MM_DD(newData) {
393
+ YYYY_MM_DD(newData) {
390
394
  let dataAtual = new Date();
391
395
  if (newData) {
392
396
  dataAtual = new Date(newData);
@@ -403,21 +407,21 @@ const _data = class _data {
403
407
  const [dia, mes, ano] = data.split("/");
404
408
  return `${ano}-${mes}-${dia}`;
405
409
  }
406
- static DIFERENCA_SEGUNDOS(data) {
410
+ DIFERENCA_SEGUNDOS(data) {
407
411
  var dataInicial = new Date(data);
408
412
  var dataAtual = new Date();
409
413
  var diferenca = Number(dataAtual) - Number(dataInicial);
410
414
  var diferencaEmSegundos = Math.floor(diferenca / 1000);
411
415
  return diferencaEmSegundos;
412
416
  }
413
- static DIFERENCA_DIAS(data) {
417
+ DIFERENCA_DIAS(data) {
414
418
  var dataInicial = new Date(data);
415
419
  var dataAtual = new Date();
416
420
  var diferenca = dataAtual.getTime() - dataInicial.getTime(); // Obtém a diferença em milissegundos
417
421
  var diferencaEmDias = Math.floor(diferenca / (1000 * 60 * 60 * 24)); // Calcula a diferença em dias
418
422
  return diferencaEmDias;
419
423
  }
420
- static SET_SECONDS_TO_DD_MM_YYYY_HH_MM(timestamp) {
424
+ SET_SECONDS_TO_DD_MM_YYYY_HH_MM(timestamp) {
421
425
  const segundos = Number(timestamp);
422
426
  if (!Number.isFinite(segundos)) {
423
427
  return "-";
@@ -440,7 +444,7 @@ const _data = class _data {
440
444
 
441
445
  ;// CONCATENATED MODULE: ./src/utils/_form.ts
442
446
  class _form {
443
- static regex_cpf_cnpj(value) {
447
+ regex_cpf_cnpj(value) {
444
448
  let tempValue = value.replace(/\D/g, "");
445
449
  if (tempValue.length > 14) {
446
450
  tempValue = tempValue.slice(0, 14);
@@ -465,7 +469,7 @@ class _form {
465
469
  }
466
470
  return tempValue;
467
471
  }
468
- static formatar_cpf(value) {
472
+ formatar_cpf(value) {
469
473
  const cpf = value.replace(/\D/g, "");
470
474
  if (cpf.length > 11) {
471
475
  return cpf.slice(0, 11);
@@ -478,7 +482,7 @@ class _form {
478
482
  return result;
479
483
  });
480
484
  }
481
- static formatar_cnpj(value) {
485
+ formatar_cnpj(value) {
482
486
  const cnpj = value.replace(/\D/g, "");
483
487
  if (cnpj.length > 14) {
484
488
  return cnpj.slice(0, 14);
@@ -492,7 +496,7 @@ class _form {
492
496
  return result;
493
497
  });
494
498
  }
495
- static formatar_cep(value) {
499
+ formatar_cep(value) {
496
500
  const cep = value.replace(/\D/g, "");
497
501
  if (cep.length > 8) {
498
502
  return cep.slice(0, 8);
@@ -502,7 +506,7 @@ class _form {
502
506
  return p1;
503
507
  });
504
508
  }
505
- static formatar_telefone_fixo(value) {
509
+ formatar_telefone_fixo(value) {
506
510
  const telefone = value.replace(/\D/g, "");
507
511
  if (telefone.length > 10) {
508
512
  return telefone.slice(0, 10);
@@ -515,7 +519,7 @@ class _form {
515
519
  return result;
516
520
  });
517
521
  }
518
- static formatar_celular(value) {
522
+ formatar_celular(value) {
519
523
  const celular = value.replace(/\D/g, "");
520
524
  if (celular.length > 11) {
521
525
  return celular.slice(0, 11);
@@ -528,7 +532,7 @@ class _form {
528
532
  return result;
529
533
  });
530
534
  }
531
- static formatar_nome(name) {
535
+ formatar_nome(name) {
532
536
  const lowercaseWords = [
533
537
  "de",
534
538
  "da",
@@ -551,7 +555,7 @@ class _form {
551
555
  });
552
556
  return formattedWords.join(" ");
553
557
  }
554
- static formatar_reais_br(value) {
558
+ formatar_reais_br(value) {
555
559
  let num = value.replace(/\D/g, "");
556
560
  return new Intl.NumberFormat("pt-BR", {
557
561
  style: "currency",
@@ -560,11 +564,11 @@ class _form {
560
564
  }).format(Number(num) / 100);
561
565
  }
562
566
  }
563
- /* export default */ const utils_form = (_form);
567
+ /* export default */ const utils_form = (new _form);
564
568
 
565
569
  ;// CONCATENATED MODULE: ./src/utils/_geral.ts
566
- const geral = class geral {
567
- static slice_file_name(filename, maxLength = 30) {
570
+ const geral = new class geral {
571
+ slice_file_name(filename, maxLength = 30) {
568
572
  if (!filename || typeof filename !== "string") return "";
569
573
  // Encontra a última ocorrência do ponto para identificar a extensão
570
574
  const lastDotIndex = filename.lastIndexOf(".");
@@ -586,14 +590,14 @@ const geral = class geral {
586
590
  // Trunca o nome e mantém a extensão
587
591
  return name.substring(0, availableLength) + "..." + extension;
588
592
  }
589
- static extrair_id(array_enviado) {
593
+ extrair_id(array_enviado) {
590
594
  const ids = [];
591
595
  for(let i = 0; i < array_enviado.length; i++){
592
596
  if (array_enviado[i]?._id) ids.push(array_enviado[i]._id);
593
597
  }
594
598
  return ids;
595
599
  }
596
- static gerar_id = (length = 32)=>{
600
+ gerar_id = (length = 32)=>{
597
601
  // Caracteres permitidos (apenas alfanuméricos)
598
602
  const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
599
603
  // Timestamp em formato hexadecimal (sem separadores)
@@ -616,8 +620,8 @@ const geral = class geral {
616
620
  /* export default */ const _geral = (geral);
617
621
 
618
622
  ;// CONCATENATED MODULE: ./src/utils/_local_storage.ts
619
- const _local_storage = class _local_storage {
620
- static adicionar_item_local_storage(chave, novoItem) {
623
+ const _local_storage = new class _local_storage {
624
+ adicionar_item_local_storage(chave, novoItem) {
621
625
  try {
622
626
  const valorAtual = window.localStorage.getItem(chave);
623
627
  const listaAtual = valorAtual ? JSON.parse(valorAtual) : [];
@@ -630,14 +634,14 @@ const _local_storage = class _local_storage {
630
634
  console.log(error);
631
635
  }
632
636
  }
633
- static set_local_storage_sem_incremento(chave, novoItem) {
637
+ set_local_storage_sem_incremento(chave, novoItem) {
634
638
  try {
635
639
  window.localStorage.setItem(chave, JSON.stringify(novoItem));
636
640
  } catch (error) {
637
641
  console.log(error);
638
642
  }
639
643
  }
640
- static get_item_local_storage(chave) {
644
+ get_item_local_storage(chave) {
641
645
  try {
642
646
  if (typeof window !== "undefined") {
643
647
  const valorAtual = window.localStorage.getItem(chave);
@@ -648,7 +652,7 @@ const _local_storage = class _local_storage {
648
652
  console.log(error);
649
653
  }
650
654
  }
651
- static remover_item_local_storage(chave) {
655
+ remover_item_local_storage(chave) {
652
656
  try {
653
657
  window.localStorage.removeItem(chave);
654
658
  } catch (error) {
@@ -656,12 +660,11 @@ const _local_storage = class _local_storage {
656
660
  }
657
661
  }
658
662
  };
659
- // Para usar a classe, você pode fazer:
660
663
  /* export default */ const utils_local_storage = (_local_storage);
661
664
 
662
665
  ;// CONCATENATED MODULE: ./src/utils/_update_context.ts
663
- const _update_context = class _update_context {
664
- static set_new_item_end = ({ oldArray = [], newItem = [], key = "_id" })=>{
666
+ const _update_context = new class _update_context {
667
+ set_new_item_end = ({ oldArray = [], newItem = [], key = "_id" })=>{
665
668
  try {
666
669
  const hasValidIds = Array.isArray(newItem) ? newItem.every((item)=>item?.[key]) : newItem?.[key];
667
670
  const newItemArray = hasValidIds ? Array.isArray(newItem) ? newItem : [
@@ -694,7 +697,7 @@ const _update_context = class _update_context {
694
697
  return oldArray; // Retorna o array original em caso de erro
695
698
  }
696
699
  };
697
- static update_array_itens = ({ oldArray = [], newItem = [], key = "_id" })=>{
700
+ update_array_itens = ({ oldArray = [], newItem = [], key = "_id" })=>{
698
701
  try {
699
702
  const hasValidIds = Array.isArray(newItem) ? newItem.every((item)=>item?.[key]) : newItem?.[key];
700
703
  const newItemArray = hasValidIds ? Array.isArray(newItem) ? newItem : [
@@ -727,7 +730,7 @@ const _update_context = class _update_context {
727
730
  return oldArray; // Retorna o array original em caso de erro
728
731
  }
729
732
  };
730
- static remove_array_items = ({ oldArray = [], itemsToRemove = [], key = "_id" })=>{
733
+ remove_array_items = ({ oldArray = [], itemsToRemove = [], key = "_id" })=>{
731
734
  try {
732
735
  // Verifica se os argumentos são válidos
733
736
  if (!Array.isArray(oldArray) || oldArray.length === 0) return oldArray;
@@ -748,7 +751,7 @@ const _update_context = class _update_context {
748
751
  return oldArray; // Retorna o array original em caso de erro
749
752
  }
750
753
  };
751
- static compare_arrays({ arrayAntigo, arrayNovo }) {
754
+ compare_arrays({ arrayAntigo, arrayNovo }) {
752
755
  // Cria Sets para performance
753
756
  const idsAntigos = new Set(arrayAntigo.map((item)=>item._id));
754
757
  const idsNovos = new Set(arrayNovo.map((item)=>item._id));
@@ -849,15 +852,15 @@ class _hooks {
849
852
  //BANCO DE DADOS
850
853
  //SERVICES
851
854
  const _environment = class _environment {
852
- static set(key, props) {
855
+ set(key, props) {
853
856
  window.sessionStorage.setItem(key, props);
854
857
  return;
855
858
  }
856
- static get(key) {
859
+ get(key) {
857
860
  return window.sessionStorage.getItem(key);
858
861
  }
859
862
  };
860
- /* export default */ const utils_environment = (_environment);
863
+ /* export default */ const utils_environment = (new _environment);
861
864
 
862
865
  ;// CONCATENATED MODULE: ./src/utils/index.ts
863
866
 
@@ -1,5 +1,4 @@
1
1
  declare const _data: {
2
- new (): {};
3
2
  YYYY_MM_DD_00_00_00(newData: string): string;
4
3
  DD_MM_YYYY_00_00_00(newData: string): string;
5
4
  DD_MM_YYYY_00_00(newData: string): string;
@@ -1,7 +1,6 @@
1
1
  import t from "../types";
2
- declare const _environment: {
3
- new (): {};
2
+ declare const _default: {
4
3
  set(key: t.Geral.BaseUrl, props: string): void;
5
4
  get(key: t.Geral.BaseUrl): t.Geral.BaseUrl;
6
5
  };
7
- export default _environment;
6
+ export default _default;
@@ -1,11 +1,12 @@
1
1
  declare class _form {
2
- static regex_cpf_cnpj(value: string): string;
3
- static formatar_cpf(value: string): string;
4
- static formatar_cnpj(value: string): string;
5
- static formatar_cep(value: string): string;
6
- static formatar_telefone_fixo(value: string): string;
7
- static formatar_celular(value: string): string;
8
- static formatar_nome(name: string): string;
9
- static formatar_reais_br(value: string): string;
2
+ regex_cpf_cnpj(value: string): string;
3
+ formatar_cpf(value: string): string;
4
+ formatar_cnpj(value: string): string;
5
+ formatar_cep(value: string): string;
6
+ formatar_telefone_fixo(value: string): string;
7
+ formatar_celular(value: string): string;
8
+ formatar_nome(name: string): string;
9
+ formatar_reais_br(value: string): string;
10
10
  }
11
- export default _form;
11
+ declare const _default: _form;
12
+ export default _default;
@@ -1,5 +1,4 @@
1
1
  declare const geral: {
2
- new (): {};
3
2
  slice_file_name(filename: string, maxLength?: number): string;
4
3
  extrair_id(array_enviado: Array<{
5
4
  _id?: string;
@@ -1,5 +1,4 @@
1
1
  declare const _local_storage: {
2
- new (): {};
3
2
  adicionar_item_local_storage(chave: string, novoItem: any): void;
4
3
  set_local_storage_sem_incremento(chave: string, novoItem: any): void;
5
4
  get_item_local_storage(chave: string): any;
@@ -1,5 +1,4 @@
1
1
  declare const _session_storage: {
2
- new (): {};
3
2
  adicionar_item_session_storage({ chave, novoItem }: {
4
3
  chave: string;
5
4
  novoItem: any;
@@ -10,5 +9,6 @@ declare const _session_storage: {
10
9
  }): void;
11
10
  get_item_session_storage(chave: string): any;
12
11
  remover_item_session_storage(chave: string): void;
12
+ get usuario_auth(): import("../types/_usuario").default.Auth;
13
13
  };
14
14
  export default _session_storage;
@@ -9,7 +9,6 @@ type RemoveArrayItems = {
9
9
  key?: string | "_id" | "id";
10
10
  };
11
11
  declare const _update_context: {
12
- new (): {};
13
12
  set_new_item_end: ({ oldArray, newItem, key }: ParamsPadrao) => any;
14
13
  update_array_itens: ({ oldArray, newItem, key }: ParamsPadrao) => any;
15
14
  remove_array_items: ({ oldArray, itemsToRemove, key }: RemoveArrayItems) => any[];
@@ -1,4 +1,3 @@
1
- import _form from "./_form";
2
1
  declare const utils: {
3
2
  api: {
4
3
  new (): {};
@@ -61,7 +60,6 @@ declare const utils: {
61
60
  };
62
61
  };
63
62
  data: {
64
- new (): {};
65
63
  YYYY_MM_DD_00_00_00(newData: string): string;
66
64
  DD_MM_YYYY_00_00_00(newData: string): string;
67
65
  DD_MM_YYYY_00_00(newData: string): string;
@@ -71,9 +69,17 @@ declare const utils: {
71
69
  DIFERENCA_DIAS(data: string): number;
72
70
  SET_SECONDS_TO_DD_MM_YYYY_HH_MM(timestamp: number | string): string;
73
71
  };
74
- form: typeof _form;
72
+ form: {
73
+ regex_cpf_cnpj(value: string): string;
74
+ formatar_cpf(value: string): string;
75
+ formatar_cnpj(value: string): string;
76
+ formatar_cep(value: string): string;
77
+ formatar_telefone_fixo(value: string): string;
78
+ formatar_celular(value: string): string;
79
+ formatar_nome(name: string): string;
80
+ formatar_reais_br(value: string): string;
81
+ };
75
82
  geral: {
76
- new (): {};
77
83
  slice_file_name(filename: string, maxLength?: number): string;
78
84
  extrair_id(array_enviado: Array<{
79
85
  _id?: string;
@@ -81,14 +87,12 @@ declare const utils: {
81
87
  gerar_id: (length?: number) => string;
82
88
  };
83
89
  local_storage: {
84
- new (): {};
85
90
  adicionar_item_local_storage(chave: string, novoItem: any): void;
86
91
  set_local_storage_sem_incremento(chave: string, novoItem: any): void;
87
92
  get_item_local_storage(chave: string): any;
88
93
  remover_item_local_storage(chave: string): void;
89
94
  };
90
95
  update_context: {
91
- new (): {};
92
96
  set_new_item_end: ({ oldArray, newItem, key }: {
93
97
  oldArray: any[];
94
98
  newItem: any;
@@ -110,7 +114,6 @@ declare const utils: {
110
114
  }): any[];
111
115
  };
112
116
  session_sorage: {
113
- new (): {};
114
117
  adicionar_item_session_storage({ chave, novoItem }: {
115
118
  chave: string;
116
119
  novoItem: any;
@@ -121,6 +124,7 @@ declare const utils: {
121
124
  }): void;
122
125
  get_item_session_storage(chave: string): any;
123
126
  remover_item_session_storage(chave: string): void;
127
+ get usuario_auth(): import("../types/_usuario").default.Auth;
124
128
  };
125
129
  sistema: {
126
130
  empresa: {
@@ -175,7 +179,6 @@ declare const utils: {
175
179
  use_dark_mode(): void;
176
180
  };
177
181
  environment: {
178
- new (): {};
179
182
  set(key: import("..").TypesCore.Geral.BaseUrl, props: string): void;
180
183
  get(key: import("..").TypesCore.Geral.BaseUrl): import("..").TypesCore.Geral.BaseUrl;
181
184
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/core",
3
- "version": "1.97.0",
3
+ "version": "1.99.0",
4
4
  "description": "Service core de todos os micro serviços",
5
5
  "type": "module",
6
6
  "exports": {