Compare commits
43 commits
feat--ajus
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a6ce2e323 | |||
| 4ed3d82bb2 | |||
| 21a1b27d35 | |||
| 8ad68103bc | |||
| 0ca2e7dc5a | |||
| b964e826d5 | |||
| 64ddd6ad8a | |||
| f2a223b015 | |||
| edcc14d0ad | |||
| fa8b8d6424 | |||
| 92300c8e3b | |||
| 303832ba8c | |||
| dfec5a4527 | |||
| 0bb66d830f | |||
| 850a683ae0 | |||
| 287f308c3f | |||
| 336e3ffc48 | |||
| dbe0f66daf | |||
| d783fa1294 | |||
| ab298253d8 | |||
| f0985bf52f | |||
| bf5be3fc5c | |||
| d0d99faa50 | |||
| e1694195cc | |||
| 59576cef8b | |||
| 2ead837b0a | |||
| 6b8d30fb30 | |||
| c8bc47d515 | |||
| 0cbe901499 | |||
| 84880fff0c | |||
| 5b1b6e3c25 | |||
| 3f8faa35a2 | |||
| dff25ab347 | |||
| 83f5d5353c | |||
| 55be0a0712 | |||
| 326aea91a6 | |||
| 484f2f4593 | |||
| ef34df1657 | |||
| 01bc1d0eec | |||
| ac08b31b3d | |||
| 30a28b7ecc | |||
| db39ae48f0 | |||
| 24407479cf |
89 changed files with 2428 additions and 2483 deletions
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
.npmignore
Normal file → Executable file
0
.npmignore
Normal file → Executable file
0
.npmrc
Normal file → Executable file
0
.npmrc
Normal file → Executable file
0
.vscode/settings.json
vendored
Normal file → Executable file
0
.vscode/settings.json
vendored
Normal file → Executable file
6
Documentos/biome.json
Normal file → Executable file
6
Documentos/biome.json
Normal file → Executable file
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "../node_modules/@biomejs/biome/configuration_schema.json",
|
||||
"root": false,
|
||||
|
||||
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
"useLiteralKeys": "off",
|
||||
"useArrowFunction": "warn",
|
||||
"useDateNow": "off",
|
||||
"noUselessFragments":"off"
|
||||
"noUselessFragments": "off"
|
||||
},
|
||||
"performance": {
|
||||
"noAccumulatingSpread": "off"
|
||||
|
|
@ -61,4 +61,4 @@
|
|||
"attributePosition": "multiline"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
91
README.md
Normal file → Executable file
91
README.md
Normal file → Executable file
|
|
@ -88,3 +88,94 @@ adicionar em .vscode/settings.json
|
|||
"source.fixAll.biome": "always"
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
## ✅ Sistema de Filtros (tipoFiltro26)
|
||||
|
||||
O sistema `tipoFiltro26` foi projetado para gerar automaticamente a tipagem de filtros compatíveis com operadores padrão do PostgreSQL, a partir de um tipo base `T`.
|
||||
|
||||
**Principais características:**
|
||||
- Tipagem forte e segura (Typescript)
|
||||
- Suporte a aninhamento de objetos
|
||||
- Operadores lógicos `E` (AND) e `OU` (OR)
|
||||
- Validação de operadores permitidos por tipo de dado (string, number, boolean)
|
||||
|
||||
### Estrutura do Filtro
|
||||
|
||||
O filtro segue uma estrutura onde chaves representam campos (simples ou aninhados) e valores representam condições com operadores específicos.
|
||||
|
||||
#### 1. Campos Simples
|
||||
```typescript
|
||||
{
|
||||
idade: { ">=": 18 }
|
||||
}
|
||||
```
|
||||
|
||||
#### 2. Campos Aninhados
|
||||
```typescript
|
||||
{
|
||||
carro: {
|
||||
ano: { "=": 2020 }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 3. Operadores Lógicos
|
||||
|
||||
**Operador E (AND):** Todos devem ser verdadeiros.
|
||||
```typescript
|
||||
{
|
||||
E: [
|
||||
{ idade: { ">=": 18 } },
|
||||
{ nome: { like: "%pa%" } }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Operador OU (OR):** Pelo menos um deve ser verdadeiro.
|
||||
```typescript
|
||||
{
|
||||
OU: [
|
||||
{ idade: { "<": 18 } },
|
||||
{ idade: { ">=": 60 } }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### 4. Exemplo Complexo Complet
|
||||
```typescript
|
||||
{
|
||||
idade: { ">=": 18 },
|
||||
OU: [
|
||||
{ nome: { like: "%pa%" } },
|
||||
{
|
||||
E: [
|
||||
{ carro: { ano: { "=": 2020 } } },
|
||||
{ carro: { modelo: { in: ["Civic"] } } }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Operadores Suportados (`operadores26`)
|
||||
|
||||
Os operadores são fornecidos pelo enum `operadores26` e são restritos pelo tipo do campo:
|
||||
|
||||
* **Number**: `=`, `!=`, `>`, `>=`, `<`, `<=`, `in`
|
||||
* **String**: `=`, `!=`, `like`, `in`
|
||||
* **Boolean**: `=`, `!=`, `in`
|
||||
|
||||
> **Nota:** Atualmente não há suporte automático para `null`, `date`, `jsonb` ou `arrays` como tipos de campo raiz (exceto arrays dentro do operador `in`).
|
||||
|
||||
### Validação em Tempo de Execução (Zod)
|
||||
|
||||
O sistema inclui um validador Zod `zFiltro26` para validação estrutural dos objetos de filtro recebidos (ex: via API).
|
||||
|
||||
```typescript
|
||||
import { zFiltro26 } from './tipoFiltro.26';
|
||||
|
||||
// Valida a estrutura (não checa existência de colunas no DB)
|
||||
zFiltro26.parse(objetoFiltro);
|
||||
```
|
||||
|
|
|
|||
0
biome.json
Normal file → Executable file
0
biome.json
Normal file → Executable file
0
build.config.ts
Normal file → Executable file
0
build.config.ts
Normal file → Executable file
29
dist-back/aleatorio.js
Normal file
29
dist-back/aleatorio.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var aleatorio_exports = {};
|
||||
__export(aleatorio_exports, {
|
||||
aleatorio: () => aleatorio
|
||||
});
|
||||
module.exports = __toCommonJS(aleatorio_exports);
|
||||
const alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
||||
const aleatorio = (tamanho) => `eli-${Array.from({ length: tamanho || 8 }).map(() => alfabeto[(999 * Math.random() | 0) % alfabeto.length]).join("")}`;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
aleatorio
|
||||
});
|
||||
53
dist-back/cacheMemoria.js
Normal file
53
dist-back/cacheMemoria.js
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var cacheMemoria_exports = {};
|
||||
__export(cacheMemoria_exports, {
|
||||
cacheM: () => cacheM,
|
||||
cacheMFixo: () => cacheMFixo,
|
||||
cacheMemoria: () => cacheMemoria,
|
||||
verCacheM: () => verCacheM
|
||||
});
|
||||
module.exports = __toCommonJS(cacheMemoria_exports);
|
||||
const _cache = {};
|
||||
globalThis.cacheMemoria_cache = _cache;
|
||||
const cacheM = (chave, valor, validadeSeg) => {
|
||||
const txChave = typeof chave == "string" ? chave : typeof chave == "number" ? String(chave) : encodeURIComponent(JSON.stringify(chave));
|
||||
const validade = validadeSeg && (/* @__PURE__ */ new Date()).getTime() + validadeSeg * 1e3;
|
||||
if (valor !== void 0) {
|
||||
_cache[txChave] = {
|
||||
valor,
|
||||
validade
|
||||
};
|
||||
}
|
||||
const busca = _cache[txChave];
|
||||
if (busca?.validade && busca.validade < (/* @__PURE__ */ new Date()).getTime()) {
|
||||
return void 0;
|
||||
}
|
||||
return busca?.valor;
|
||||
};
|
||||
const verCacheM = () => _cache;
|
||||
const cacheMemoria = cacheM;
|
||||
const cacheMFixo = (chave) => (valor) => cacheM(chave, valor);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
cacheM,
|
||||
cacheMFixo,
|
||||
cacheMemoria,
|
||||
verCacheM
|
||||
});
|
||||
53
dist-back/constantes.js
Normal file
53
dist-back/constantes.js
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var constantes_exports = {};
|
||||
__export(constantes_exports, {
|
||||
camposComuns: () => camposComuns,
|
||||
tipoUsuarioResiduos: () => tipoUsuarioResiduos,
|
||||
tx: () => tx,
|
||||
uuid_null: () => uuid_null
|
||||
});
|
||||
module.exports = __toCommonJS(constantes_exports);
|
||||
const uuid_null = "00000000-0000-0000-0000-000000000000";
|
||||
var camposComuns = /* @__PURE__ */ ((camposComuns2) => {
|
||||
camposComuns2["codigo"] = "codigo";
|
||||
camposComuns2["excluido"] = "excluido";
|
||||
camposComuns2["data_hora_criacao"] = "data_hora_criacao";
|
||||
camposComuns2["data_hora_atualizacao"] = "data_hora_atualizacao";
|
||||
camposComuns2["codigo_usuario_criacao"] = "codigo_usuario_criacao";
|
||||
camposComuns2["codigo_usuario_atualizacao"] = "codigo_usuario_atualizacao";
|
||||
camposComuns2["versao"] = "versao";
|
||||
return camposComuns2;
|
||||
})(camposComuns || {});
|
||||
var tx = /* @__PURE__ */ ((tx2) => {
|
||||
tx2["token"] = "token";
|
||||
return tx2;
|
||||
})(tx || {});
|
||||
var tipoUsuarioResiduos = /* @__PURE__ */ ((tipoUsuarioResiduos2) => {
|
||||
tipoUsuarioResiduos2["Usuario"] = "usuario";
|
||||
tipoUsuarioResiduos2["Fornecedor"] = "fornecedor";
|
||||
return tipoUsuarioResiduos2;
|
||||
})(tipoUsuarioResiduos || {});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
camposComuns,
|
||||
tipoUsuarioResiduos,
|
||||
tx,
|
||||
uuid_null
|
||||
});
|
||||
71
dist-back/consulta.js
Normal file
71
dist-back/consulta.js
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var consulta_exports = {};
|
||||
__export(consulta_exports, {
|
||||
operadores: () => operadores,
|
||||
zFiltro: () => zFiltro,
|
||||
zOperadores: () => zOperadores
|
||||
});
|
||||
module.exports = __toCommonJS(consulta_exports);
|
||||
var import_zod = __toESM(require("zod"));
|
||||
var operadores = /* @__PURE__ */ ((operadores2) => {
|
||||
operadores2["="] = "=";
|
||||
operadores2["!="] = "!=";
|
||||
operadores2[">"] = ">";
|
||||
operadores2[">="] = ">=";
|
||||
operadores2["<"] = "<";
|
||||
operadores2["<="] = "<=";
|
||||
operadores2["like"] = "like";
|
||||
operadores2["in"] = "in";
|
||||
operadores2["isNull"] = "isNull";
|
||||
return operadores2;
|
||||
})(operadores || {});
|
||||
const zOperadores = import_zod.default.enum([
|
||||
"=",
|
||||
"!=",
|
||||
">",
|
||||
">=",
|
||||
"<",
|
||||
"<=",
|
||||
"like",
|
||||
"in",
|
||||
"isNull"
|
||||
]);
|
||||
const zFiltro = import_zod.default.object({
|
||||
coluna: import_zod.default.string(),
|
||||
valor: import_zod.default.any(),
|
||||
operador: zOperadores,
|
||||
ou: import_zod.default.boolean().optional()
|
||||
});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
operadores,
|
||||
zFiltro,
|
||||
zOperadores
|
||||
});
|
||||
49
dist-back/dayjs26.js
Normal file
49
dist-back/dayjs26.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var dayjs26_exports = {};
|
||||
__export(dayjs26_exports, {
|
||||
defineDayjsBr: () => defineDayjsBr
|
||||
});
|
||||
module.exports = __toCommonJS(dayjs26_exports);
|
||||
const defineDayjsBr = ({
|
||||
dayjs,
|
||||
duration,
|
||||
isSameOrAfter,
|
||||
isSameOrBefore,
|
||||
minMax,
|
||||
relativeTime,
|
||||
timezone,
|
||||
utc,
|
||||
weekOfYear
|
||||
}) => {
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
dayjs.extend(weekOfYear);
|
||||
dayjs.extend(isSameOrBefore);
|
||||
dayjs.extend(isSameOrAfter);
|
||||
dayjs.extend(minMax);
|
||||
dayjs.extend(relativeTime);
|
||||
dayjs.extend(duration);
|
||||
dayjs.locale("pt-br");
|
||||
return dayjs;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
defineDayjsBr
|
||||
});
|
||||
22
dist-back/ecosistema/index.js
Normal file
22
dist-back/ecosistema/index.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var ecosistema_exports = {};
|
||||
module.exports = __toCommonJS(ecosistema_exports);
|
||||
__reExport(ecosistema_exports, require("./urls"), module.exports);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
...require("./urls")
|
||||
});
|
||||
28
dist-back/ecosistema/urls.js
Normal file
28
dist-back/ecosistema/urls.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var urls_exports = {};
|
||||
__export(urls_exports, {
|
||||
link_paiol: () => link_paiol
|
||||
});
|
||||
module.exports = __toCommonJS(urls_exports);
|
||||
const link_paiol = "https://paiol.idz.one";
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
link_paiol
|
||||
});
|
||||
186
dist-back/extensoes.js
Normal file
186
dist-back/extensoes.js
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var extensoes_exports = {};
|
||||
__export(extensoes_exports, {
|
||||
extensoes: () => extensoes,
|
||||
tipoArquivo: () => tipoArquivo
|
||||
});
|
||||
module.exports = __toCommonJS(extensoes_exports);
|
||||
const extensoes = [
|
||||
{
|
||||
ext: "gif",
|
||||
tipo: "imagem",
|
||||
mime: "image/gif"
|
||||
},
|
||||
{
|
||||
ext: "jpg",
|
||||
tipo: "imagem",
|
||||
mime: "image/jpeg"
|
||||
},
|
||||
{
|
||||
ext: "jpeg",
|
||||
tipo: "imagem",
|
||||
mime: "image/jpeg"
|
||||
},
|
||||
{
|
||||
ext: "png",
|
||||
tipo: "imagem",
|
||||
mime: "image/png"
|
||||
},
|
||||
{
|
||||
ext: "bmp",
|
||||
tipo: "imagem",
|
||||
mime: "image/bmp"
|
||||
},
|
||||
{
|
||||
ext: "webp",
|
||||
tipo: "imagem",
|
||||
mime: "image/webp"
|
||||
},
|
||||
{
|
||||
ext: "tiff",
|
||||
tipo: "imagem",
|
||||
mime: "image/tiff"
|
||||
},
|
||||
{
|
||||
ext: "svg",
|
||||
tipo: "imagem",
|
||||
mime: "image/svg+xml"
|
||||
},
|
||||
{
|
||||
ext: "ico",
|
||||
tipo: "imagem",
|
||||
mime: "image/x-icon"
|
||||
},
|
||||
{
|
||||
ext: "pdf",
|
||||
tipo: "documento",
|
||||
mime: "application/pdf"
|
||||
},
|
||||
{
|
||||
ext: "doc",
|
||||
tipo: "documento",
|
||||
mime: "application/msword"
|
||||
},
|
||||
{
|
||||
ext: "docx",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
},
|
||||
{
|
||||
ext: "xls",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.ms-excel"
|
||||
},
|
||||
{
|
||||
ext: "xlsx",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
},
|
||||
{
|
||||
ext: "ppt",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.ms-powerpoint"
|
||||
},
|
||||
{
|
||||
ext: "pptx",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
||||
},
|
||||
{
|
||||
ext: "txt",
|
||||
tipo: "documento",
|
||||
mime: "text/plain"
|
||||
},
|
||||
{
|
||||
ext: "odt",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.oasis.opendocument.text"
|
||||
},
|
||||
{
|
||||
ext: "ods",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.oasis.opendocument.spreadsheet"
|
||||
},
|
||||
{
|
||||
ext: "rtf",
|
||||
tipo: "documento",
|
||||
mime: "application/rtf"
|
||||
},
|
||||
{
|
||||
ext: "csv",
|
||||
tipo: "documento",
|
||||
mime: "text/csv"
|
||||
},
|
||||
{
|
||||
ext: "mp4",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/mp4"
|
||||
},
|
||||
{
|
||||
ext: "avi",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-msvideo"
|
||||
},
|
||||
{
|
||||
ext: "mkv",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-matroska"
|
||||
},
|
||||
{
|
||||
ext: "mov",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/quicktime"
|
||||
},
|
||||
{
|
||||
ext: "wmv",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-ms-wmv"
|
||||
},
|
||||
{
|
||||
ext: "flv",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-flv"
|
||||
},
|
||||
{
|
||||
ext: "webm",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/webm"
|
||||
},
|
||||
{
|
||||
ext: "3gp",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/3gpp"
|
||||
},
|
||||
{
|
||||
ext: "mpeg",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/mpeg"
|
||||
}
|
||||
];
|
||||
const tipoArquivo = (nomeArquivo) => {
|
||||
const extArquivo = String(nomeArquivo || "").toLocaleLowerCase().split(".").pop();
|
||||
const extensao = extensoes.find((extensao2) => extensao2.ext === extArquivo);
|
||||
return extensao?.tipo || "outros";
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
extensoes,
|
||||
tipoArquivo
|
||||
});
|
||||
37
dist-back/graficosPilao.js
Normal file
37
dist-back/graficosPilao.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var graficosPilao_exports = {};
|
||||
__export(graficosPilao_exports, {
|
||||
graficos_pilao: () => graficos_pilao
|
||||
});
|
||||
module.exports = __toCommonJS(graficosPilao_exports);
|
||||
const graficos_pilao = {
|
||||
Condicionantes: {
|
||||
grafico: "condicionantes-criadas",
|
||||
titulo: "Condicionantes Criadas"
|
||||
},
|
||||
Licen\u00E7as: {
|
||||
grafico: "licencas-criadas",
|
||||
titulo: "Licen\xE7as Criadas"
|
||||
}
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
graficos_pilao
|
||||
});
|
||||
60
dist-back/index.js
Normal file
60
dist-back/index.js
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var index_exports = {};
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
__reExport(index_exports, require("./aleatorio"), module.exports);
|
||||
__reExport(index_exports, require("./cacheMemoria"), module.exports);
|
||||
__reExport(index_exports, require("./constantes"), module.exports);
|
||||
__reExport(index_exports, require("./consulta"), module.exports);
|
||||
__reExport(index_exports, require("./dayjs26"), module.exports);
|
||||
__reExport(index_exports, require("./ecosistema"), module.exports);
|
||||
__reExport(index_exports, require("./extensoes"), module.exports);
|
||||
__reExport(index_exports, require("./extensoes"), module.exports);
|
||||
__reExport(index_exports, require("./local"), module.exports);
|
||||
__reExport(index_exports, require("./postgres"), module.exports);
|
||||
__reExport(index_exports, require("./produtos"), module.exports);
|
||||
__reExport(index_exports, require("./situacoes"), module.exports);
|
||||
__reExport(index_exports, require("./testes-de-variaveis"), module.exports);
|
||||
__reExport(index_exports, require("./texto_busca"), module.exports);
|
||||
__reExport(index_exports, require("./tipagemRotas"), module.exports);
|
||||
__reExport(index_exports, require("./tipagemRotas"), module.exports);
|
||||
__reExport(index_exports, require("./tipoFiltro.26"), module.exports);
|
||||
__reExport(index_exports, require("./unidades_medida"), module.exports);
|
||||
__reExport(index_exports, require("./uuid"), module.exports);
|
||||
__reExport(index_exports, require("./variaveisComuns"), module.exports);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
...require("./aleatorio"),
|
||||
...require("./cacheMemoria"),
|
||||
...require("./constantes"),
|
||||
...require("./consulta"),
|
||||
...require("./dayjs26"),
|
||||
...require("./ecosistema"),
|
||||
...require("./extensoes"),
|
||||
...require("./extensoes"),
|
||||
...require("./local"),
|
||||
...require("./postgres"),
|
||||
...require("./produtos"),
|
||||
...require("./situacoes"),
|
||||
...require("./testes-de-variaveis"),
|
||||
...require("./texto_busca"),
|
||||
...require("./tipagemRotas"),
|
||||
...require("./tipagemRotas"),
|
||||
...require("./tipoFiltro.26"),
|
||||
...require("./unidades_medida"),
|
||||
...require("./uuid"),
|
||||
...require("./variaveisComuns")
|
||||
});
|
||||
63
dist-back/instalarAmbiente.js
Normal file
63
dist-back/instalarAmbiente.js
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var import_node_fs = __toESM(require("node:fs"));
|
||||
var import_node_path = __toESM(require("node:path"));
|
||||
const mesclar = (entrada, novo) => {
|
||||
const saida = { ...entrada || {} };
|
||||
for (const [k, v] of Object.entries(novo)) {
|
||||
if (v && typeof v === "object" && !Array.isArray(v)) {
|
||||
saida[k] = mesclar(saida[k], v);
|
||||
} else {
|
||||
saida[k] = v;
|
||||
}
|
||||
}
|
||||
return saida;
|
||||
};
|
||||
const abrirJson = (caminho) => {
|
||||
try {
|
||||
return JSON.parse(import_node_fs.default.readFileSync(caminho, "utf-8"));
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
const settings_json = {
|
||||
"editor.defaultFormatter": "biomejs.biome",
|
||||
"[javascript]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[javascriptreact]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[typescript]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[typescriptreact]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[json]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[jsonc]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[vue]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports.biome": "always",
|
||||
"source.fixAll.biome": "always"
|
||||
}
|
||||
};
|
||||
const caminhoSeting = import_node_path.default.join(process.cwd(), ".vscode/settings.json");
|
||||
import_node_fs.default.mkdirSync(import_node_path.default.dirname(caminhoSeting), { recursive: true });
|
||||
const atual = abrirJson(caminhoSeting);
|
||||
const final = mesclar(atual, settings_json);
|
||||
import_node_fs.default.writeFileSync(caminhoSeting, JSON.stringify(final, null, 2), "utf8");
|
||||
console.log(`\u2705 Configura\xE7\xF5es salvas em ${caminhoSeting}`);
|
||||
46
dist-back/local/index.js
Normal file
46
dist-back/local/index.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var local_exports = {};
|
||||
__export(local_exports, {
|
||||
localValor: () => localValor
|
||||
});
|
||||
module.exports = __toCommonJS(local_exports);
|
||||
const localValor = (chave_, valor) => {
|
||||
const localStorage = "localStorage" in globalThis ? globalThis.localStorage : void 0;
|
||||
if (typeof localStorage == "undefined") return null;
|
||||
const chave = typeof chave_ === "string" ? chave_ : encodeURIComponent(JSON.stringify(chave_));
|
||||
try {
|
||||
if (valor !== void 0) {
|
||||
localStorage.setItem(chave, JSON.stringify(valor));
|
||||
}
|
||||
const v2 = localStorage.getItem(chave);
|
||||
if (v2 === null) return null;
|
||||
try {
|
||||
return JSON.parse(v2);
|
||||
} catch {
|
||||
return v2;
|
||||
}
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
localValor
|
||||
});
|
||||
47
dist-back/postgres.js
Normal file
47
dist-back/postgres.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var postgres_exports = {};
|
||||
__export(postgres_exports, {
|
||||
objetoPg: () => objetoPg,
|
||||
paraObjetoRegistroPg: () => paraObjetoRegistroPg,
|
||||
pgObjeto: () => pgObjeto
|
||||
});
|
||||
module.exports = __toCommonJS(postgres_exports);
|
||||
const paraObjetoRegistroPg = (entrada) => {
|
||||
try {
|
||||
return Object.fromEntries(
|
||||
Object.entries(entrada).map(([k, v]) => [
|
||||
k,
|
||||
v === void 0 || v == null ? v : typeof v == "string" || typeof v == "number" || typeof v == "boolean" ? v : JSON.stringify(v, null, 2)
|
||||
])
|
||||
);
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Erro na fun\xE7\xE3o paraObjetoRegistroPg: ${error.message} ${error.stack}`
|
||||
);
|
||||
}
|
||||
};
|
||||
const pgObjeto = paraObjetoRegistroPg;
|
||||
const objetoPg = paraObjetoRegistroPg;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
objetoPg,
|
||||
paraObjetoRegistroPg,
|
||||
pgObjeto
|
||||
});
|
||||
32
dist-back/produtos.js
Normal file
32
dist-back/produtos.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var produtos_exports = {};
|
||||
__export(produtos_exports, {
|
||||
Produtos: () => Produtos
|
||||
});
|
||||
module.exports = __toCommonJS(produtos_exports);
|
||||
var Produtos = /* @__PURE__ */ ((Produtos2) => {
|
||||
Produtos2["e-licencie"] = "e-licencie";
|
||||
Produtos2["gov.e-licencie"] = "gov.e-licencie";
|
||||
return Produtos2;
|
||||
})(Produtos || {});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Produtos
|
||||
});
|
||||
77
dist-back/situacoes.js
Normal file
77
dist-back/situacoes.js
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var situacoes_exports = {};
|
||||
__export(situacoes_exports, {
|
||||
tiposSituacoesElicencie: () => tiposSituacoesElicencie
|
||||
});
|
||||
module.exports = __toCommonJS(situacoes_exports);
|
||||
var tiposSituacoesElicencie = /* @__PURE__ */ ((tiposSituacoesElicencie2) => {
|
||||
tiposSituacoesElicencie2["modelo"] = "000_modelo";
|
||||
tiposSituacoesElicencie2["vencida"] = "100_vencida";
|
||||
tiposSituacoesElicencie2["expirado"] = "200_expirado";
|
||||
tiposSituacoesElicencie2["alerta"] = "300_alerta";
|
||||
tiposSituacoesElicencie2["protocoladafora"] = "350_protocoladafora";
|
||||
tiposSituacoesElicencie2["protocolada"] = "400_protocolada";
|
||||
tiposSituacoesElicencie2["protocoladaApenas"] = "430_protocolada";
|
||||
tiposSituacoesElicencie2["protocolada_alteracao"] = "450_protocolada";
|
||||
tiposSituacoesElicencie2["prazo"] = "500_prazo";
|
||||
tiposSituacoesElicencie2["emitida"] = "515_emitida";
|
||||
tiposSituacoesElicencie2["valida"] = "518_valida";
|
||||
tiposSituacoesElicencie2["novo"] = "520_novo";
|
||||
tiposSituacoesElicencie2["recebido"] = "521_recebido";
|
||||
tiposSituacoesElicencie2["em_andamento"] = "530_em_andamento";
|
||||
tiposSituacoesElicencie2["aguardando"] = "530_aguardando";
|
||||
tiposSituacoesElicencie2["aguardandoresposta"] = "540_aguardandoresposta";
|
||||
tiposSituacoesElicencie2["suspensaotemporaria"] = "540_suspensaotemporaria";
|
||||
tiposSituacoesElicencie2["cancelada"] = "550_cancelada";
|
||||
tiposSituacoesElicencie2["execucao"] = "560_execucao";
|
||||
tiposSituacoesElicencie2["pendente"] = "570_pendente";
|
||||
tiposSituacoesElicencie2["executadafora"] = "600_executadafora";
|
||||
tiposSituacoesElicencie2["executada"] = "700_executada";
|
||||
tiposSituacoesElicencie2["naoexecutada"] = "701_naoexecutada";
|
||||
tiposSituacoesElicencie2["concluida"] = "730_concluida";
|
||||
tiposSituacoesElicencie2["respondido_negado"] = "740_respondido_negado";
|
||||
tiposSituacoesElicencie2["respondido_aceito"] = "741_respondido_aceito";
|
||||
tiposSituacoesElicencie2["atendidoparcial"] = "742_atendidoparcial";
|
||||
tiposSituacoesElicencie2["naoatendido"] = "743_naoatendido";
|
||||
tiposSituacoesElicencie2["atendido"] = "744_atendido";
|
||||
tiposSituacoesElicencie2["renovada"] = "760_renovada";
|
||||
tiposSituacoesElicencie2["finalizada"] = "800_finalizada";
|
||||
tiposSituacoesElicencie2["emitirnota"] = "101_emitirnota";
|
||||
tiposSituacoesElicencie2["faturaatrasada"] = "301_faturaatrasada";
|
||||
tiposSituacoesElicencie2["pagarfatura"] = "302_pagarfatura";
|
||||
tiposSituacoesElicencie2["aguardandoconfirmacao"] = "531_aguardandoconfirmacao";
|
||||
tiposSituacoesElicencie2["agendado"] = "701_agendado";
|
||||
tiposSituacoesElicencie2["faturapaga"] = "801_faturapaga";
|
||||
tiposSituacoesElicencie2["excluida"] = "999_excluida";
|
||||
tiposSituacoesElicencie2["requerida"] = "401_requerida";
|
||||
tiposSituacoesElicencie2["vigente"] = "516_vigente";
|
||||
tiposSituacoesElicencie2["emrenovacao"] = "402_emrenovacao";
|
||||
tiposSituacoesElicencie2["arquivada"] = "801_arquivada";
|
||||
tiposSituacoesElicencie2["aguardando_sincronizacao"] = "999_aguardando_sincronizacao";
|
||||
tiposSituacoesElicencie2["nao_conforme"] = "710_nao_conforme";
|
||||
tiposSituacoesElicencie2["conforme"] = "720_conforme";
|
||||
tiposSituacoesElicencie2["nao_aplicavel"] = "730_nao_aplicavel";
|
||||
tiposSituacoesElicencie2["parcial"] = "715_parcial";
|
||||
return tiposSituacoesElicencie2;
|
||||
})(tiposSituacoesElicencie || {});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
tiposSituacoesElicencie
|
||||
});
|
||||
6
dist-back/teste.js
Normal file
6
dist-back/teste.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
var import_cacheMemoria = require("./cacheMemoria");
|
||||
var import_texto_busca = require("./texto_busca");
|
||||
console.log("Vari\xE1veis funcionando", import_texto_busca.texto_busca);
|
||||
(0, import_cacheMemoria.cacheM)(1, { Jaca: Promise.resolve() });
|
||||
console.log("cache:", (0, import_cacheMemoria.cacheM)(1));
|
||||
24
dist-back/testes-de-variaveis/index.js
Normal file
24
dist-back/testes-de-variaveis/index.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var testes_de_variaveis_exports = {};
|
||||
module.exports = __toCommonJS(testes_de_variaveis_exports);
|
||||
__reExport(testes_de_variaveis_exports, require("./umaFuncao"), module.exports);
|
||||
__reExport(testes_de_variaveis_exports, require("./umaVariavel"), module.exports);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
...require("./umaFuncao"),
|
||||
...require("./umaVariavel")
|
||||
});
|
||||
28
dist-back/testes-de-variaveis/umaFuncao.js
Normal file
28
dist-back/testes-de-variaveis/umaFuncao.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var umaFuncao_exports = {};
|
||||
__export(umaFuncao_exports, {
|
||||
umaFuncao: () => umaFuncao
|
||||
});
|
||||
module.exports = __toCommonJS(umaFuncao_exports);
|
||||
const umaFuncao = () => "Ol\xE1 Mundo! (fun\xE7\xE3o)";
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
umaFuncao
|
||||
});
|
||||
28
dist-back/testes-de-variaveis/umaVariavel.js
Normal file
28
dist-back/testes-de-variaveis/umaVariavel.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var umaVariavel_exports = {};
|
||||
__export(umaVariavel_exports, {
|
||||
umaVariavel: () => umaVariavel
|
||||
});
|
||||
module.exports = __toCommonJS(umaVariavel_exports);
|
||||
const umaVariavel = "Ol\xE1 Mundo! (vari\xE1vel)";
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
umaVariavel
|
||||
});
|
||||
22
dist-back/testes/TipagemRotas.test.js
Normal file
22
dist-back/testes/TipagemRotas.test.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
var import_vitest = require("vitest");
|
||||
var import_tipagemRotas = require("../tipagemRotas");
|
||||
(0, import_vitest.describe)("TipagemRotas", () => {
|
||||
(0, import_vitest.it)("deve montar _partesCaminho a partir de string ou array, normalizando barras", () => {
|
||||
const r1 = new import_tipagemRotas.TipagemRotas({ caminho: "aplicacao/func" });
|
||||
(0, import_vitest.expect)(r1.caminho).toBe("/aplicacao/func");
|
||||
const r2 = new import_tipagemRotas.TipagemRotas({
|
||||
caminho: ["aplicacao", "func"]
|
||||
});
|
||||
(0, import_vitest.expect)(r2.caminho).toBe("/aplicacao/func");
|
||||
const r3 = new import_tipagemRotas.TipagemRotas({ caminho: "/a//b///c/" });
|
||||
(0, import_vitest.expect)(r3.caminho).toBe("/a/b/c");
|
||||
});
|
||||
(0, import_vitest.it)("Valores de entrada com mesmo valor dos valores de sa\xEDda", () => {
|
||||
const r1 = new import_tipagemRotas.TipagemRotas({ caminho: "aplicacao/func" });
|
||||
const objetoEntrada = { idade: 21, nome: "Jo\xE3o" };
|
||||
const rota = r1.endereco(objetoEntrada);
|
||||
const parametros = r1.parametros(rota);
|
||||
(0, import_vitest.expect)(parametros.nome).toBe(objetoEntrada.nome);
|
||||
});
|
||||
});
|
||||
30
dist-back/texto_busca.js
Normal file
30
dist-back/texto_busca.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var texto_busca_exports = {};
|
||||
__export(texto_busca_exports, {
|
||||
texto_busca: () => texto_busca
|
||||
});
|
||||
module.exports = __toCommonJS(texto_busca_exports);
|
||||
const texto_busca = (...texto) => texto.map(
|
||||
(txt) => txt === null || txt === void 0 ? "" : String(txt).normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, " ").toLowerCase()
|
||||
).join(" ");
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
texto_busca
|
||||
});
|
||||
118
dist-back/tipagemRotas.js
Normal file
118
dist-back/tipagemRotas.js
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var tipagemRotas_exports = {};
|
||||
__export(tipagemRotas_exports, {
|
||||
TipagemRotas: () => TipagemRotas
|
||||
});
|
||||
module.exports = __toCommonJS(tipagemRotas_exports);
|
||||
class TipagemRotas {
|
||||
/** Ao criar novo obijeto de tipagem de rota é necessário passar o caminho parcial
|
||||
** export const mCaminho = new TipagemRotas<{q:string}>("aplicacao","funcionalidade")
|
||||
*/
|
||||
constructor({
|
||||
caminho,
|
||||
acaoIr,
|
||||
rotulo
|
||||
}) {
|
||||
this._partesCaminho = [];
|
||||
this._acaoIr = acaoIr;
|
||||
this._partesCaminho = (Array.isArray(caminho) ? caminho : [caminho]).filter(Boolean).map((a) => String(a)).flatMap((a) => a.split("/")).filter(Boolean);
|
||||
this.rotulo = rotulo;
|
||||
}
|
||||
/** Retorna o caminho completo da rota
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/caminho"
|
||||
*/
|
||||
get caminho() {
|
||||
const ret = `/${this._partesCaminho.join("/")}`;
|
||||
return ret;
|
||||
}
|
||||
/** Define o caminho completo da rota
|
||||
** mCaminho.caminho = "/novoCaminho"
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/novoCaminho"
|
||||
** */
|
||||
set caminho(caminhoParcial) {
|
||||
this._partesCaminho = caminhoParcial.split("/").filter((parte) => parte);
|
||||
}
|
||||
/** Retorna o caminho completo da rota com a query
|
||||
** console.log(mCaminho.resolve({q:"query"}))
|
||||
** "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
endereco(query, usarComoHash) {
|
||||
const win = typeof globalThis !== "undefined" && globalThis.window || void 0;
|
||||
const url = new URL(win ? win.location.href : "http://localhost");
|
||||
url.pathname = this.caminho;
|
||||
url.search = "";
|
||||
const queryKeys = Object.entries(query);
|
||||
for (const [key, value] of queryKeys) {
|
||||
url.searchParams.set(String(key), JSON.stringify(value));
|
||||
}
|
||||
url.hash = "";
|
||||
if (usarComoHash) {
|
||||
url.hash = `#${url.search}`;
|
||||
url.search = "";
|
||||
}
|
||||
return url.href;
|
||||
}
|
||||
/** Vai para a url
|
||||
** mCaminho.ir({q:"query"})
|
||||
** window.location.href = "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
ir(query) {
|
||||
if (this._acaoIr) {
|
||||
this._acaoIr(this.endereco({ ...query }));
|
||||
} else {
|
||||
const win = typeof globalThis !== "undefined" && globalThis.window || void 0;
|
||||
if (win) {
|
||||
win.location.href = this.endereco({ ...query });
|
||||
}
|
||||
}
|
||||
}
|
||||
/** Retorna os parametros da url
|
||||
** console.log(mCaminho.parametros())
|
||||
** {q:"query"}
|
||||
*/
|
||||
parametros(urlEntrada) {
|
||||
const url = urlEntrada ? new URL(urlEntrada) : new URL(
|
||||
typeof globalThis !== "undefined" && globalThis.window ? globalThis.window.location.href : "http://localhost"
|
||||
);
|
||||
const query = url.searchParams;
|
||||
let queryObj = Object.fromEntries(query.entries());
|
||||
const hash = url.hash;
|
||||
if (hash) {
|
||||
const hashObj = Object.fromEntries(
|
||||
new URLSearchParams(hash.slice(1)).entries()
|
||||
);
|
||||
queryObj = { ...queryObj, ...hashObj };
|
||||
}
|
||||
for (const chave in queryObj) {
|
||||
try {
|
||||
queryObj[chave] = JSON.parse(queryObj[chave]);
|
||||
} catch {
|
||||
console.log(`[${chave}|${queryObj[chave]}] n\xE3o \xE9 um json v\xE1lido.`);
|
||||
}
|
||||
}
|
||||
return queryObj;
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TipagemRotas
|
||||
});
|
||||
72
dist-back/tipoFiltro.26.js
Normal file
72
dist-back/tipoFiltro.26.js
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var tipoFiltro_26_exports = {};
|
||||
__export(tipoFiltro_26_exports, {
|
||||
agrupadores26: () => agrupadores26,
|
||||
criarFiltro26: () => criarFiltro26,
|
||||
operadores26: () => operadores26,
|
||||
zFiltro26: () => zFiltro26
|
||||
});
|
||||
module.exports = __toCommonJS(tipoFiltro_26_exports);
|
||||
var import_zod = require("zod");
|
||||
var operadores26 = /* @__PURE__ */ ((operadores262) => {
|
||||
operadores262["="] = "=";
|
||||
operadores262["!="] = "!=";
|
||||
operadores262[">"] = ">";
|
||||
operadores262[">="] = ">=";
|
||||
operadores262["<"] = "<";
|
||||
operadores262["<="] = "<=";
|
||||
operadores262["like"] = "like";
|
||||
operadores262["in"] = "in";
|
||||
return operadores262;
|
||||
})(operadores26 || {});
|
||||
var agrupadores26 = /* @__PURE__ */ ((agrupadores262) => {
|
||||
agrupadores262["E"] = "E";
|
||||
agrupadores262["OU"] = "OU";
|
||||
return agrupadores262;
|
||||
})(agrupadores26 || {});
|
||||
const zOperadores = import_zod.z.nativeEnum(operadores26);
|
||||
const zValor = import_zod.z.any();
|
||||
const zCondicao = import_zod.z.record(zOperadores, zValor);
|
||||
const zFiltro26 = import_zod.z.lazy(
|
||||
() => import_zod.z.object({
|
||||
E: import_zod.z.array(zFiltro26).optional(),
|
||||
OU: import_zod.z.array(zFiltro26).optional()
|
||||
}).catchall(import_zod.z.union([zCondicao, zFiltro26]))
|
||||
);
|
||||
const criarFiltro26 = (filtro) => filtro;
|
||||
const _filtro = criarFiltro26({
|
||||
idade: { [">=" /* >= */]: 18 },
|
||||
["OU" /* OU */]: [
|
||||
{ nome: { ["like" /* like */]: "%pa%" } },
|
||||
{
|
||||
["E" /* E */]: [
|
||||
{ carro: { ano: { ["=" /* = */]: 2020 } } },
|
||||
{ carro: { modelo: { ["in" /* in */]: ["Civic", "Corolla"] } } }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
agrupadores26,
|
||||
criarFiltro26,
|
||||
operadores26,
|
||||
zFiltro26
|
||||
});
|
||||
82
dist-back/unidades_medida.js
Normal file
82
dist-back/unidades_medida.js
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var unidades_medida_exports = {};
|
||||
__export(unidades_medida_exports, {
|
||||
siglas_unidades_medida: () => siglas_unidades_medida,
|
||||
unidades_medida: () => unidades_medida
|
||||
});
|
||||
module.exports = __toCommonJS(unidades_medida_exports);
|
||||
var siglas_unidades_medida = /* @__PURE__ */ ((siglas_unidades_medida2) => {
|
||||
siglas_unidades_medida2["UN"] = "UN";
|
||||
siglas_unidades_medida2["KG"] = "KG";
|
||||
siglas_unidades_medida2["TON"] = "TON";
|
||||
siglas_unidades_medida2["g"] = "g";
|
||||
siglas_unidades_medida2["M\xB3"] = "M\xB3";
|
||||
siglas_unidades_medida2["Lt"] = "Lt";
|
||||
return siglas_unidades_medida2;
|
||||
})(siglas_unidades_medida || {});
|
||||
const unidades_medida = [
|
||||
{
|
||||
sigla_unidade: "KG",
|
||||
nome: "Quilograma",
|
||||
sigla_normalizada: "KG",
|
||||
normalizar: (valor) => valor,
|
||||
tipo: "massa"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "g",
|
||||
nome: "Grama",
|
||||
sigla_normalizada: "KG",
|
||||
normalizar: (valor) => valor / 1e3,
|
||||
tipo: "massa"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "TON",
|
||||
nome: "Tonelada",
|
||||
sigla_normalizada: "KG",
|
||||
normalizar: (valor) => valor * 1e3,
|
||||
tipo: "massa"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "Lt",
|
||||
nome: "Litro",
|
||||
sigla_normalizada: "Lt",
|
||||
normalizar: (valor) => valor,
|
||||
tipo: "volume"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "M\xB3",
|
||||
nome: "Metro C\xFAbico",
|
||||
sigla_normalizada: "Lt",
|
||||
normalizar: (valor) => valor * 1e3,
|
||||
tipo: "volume"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "UN",
|
||||
nome: "Unidade",
|
||||
sigla_normalizada: "UN",
|
||||
normalizar: (valor) => valor,
|
||||
tipo: "unidade"
|
||||
}
|
||||
];
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
siglas_unidades_medida,
|
||||
unidades_medida
|
||||
});
|
||||
51
dist-back/uuid.js
Normal file
51
dist-back/uuid.js
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var uuid_exports = {};
|
||||
__export(uuid_exports, {
|
||||
erUuid: () => erUuid,
|
||||
uuid: () => uuid,
|
||||
uuidV3: () => uuidV3,
|
||||
uuidV4: () => uuidV4,
|
||||
validarUuid: () => validarUuid
|
||||
});
|
||||
module.exports = __toCommonJS(uuid_exports);
|
||||
var import_uuid = require("uuid");
|
||||
const erUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
const validarUuid = (uuid2) => {
|
||||
const retorno = erUuid.test(String(uuid2 || ""));
|
||||
return retorno;
|
||||
};
|
||||
const uuidV3 = (chave, grupo) => {
|
||||
return (0, import_uuid.v3)(
|
||||
// Converte a chave para string (de forma segura)
|
||||
typeof chave === "string" ? chave : typeof chave === "number" ? String(chave) : JSON.stringify(chave),
|
||||
// Se um grupo foi fornecido, gera um UUID v3 recursivamente com base nele, senão usa NIL
|
||||
grupo ? uuidV3(grupo) : import_uuid.NIL
|
||||
);
|
||||
};
|
||||
const uuidV4 = import_uuid.v4;
|
||||
const uuid = uuidV4;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
erUuid,
|
||||
uuid,
|
||||
uuidV3,
|
||||
uuidV4,
|
||||
validarUuid
|
||||
});
|
||||
33
dist-back/variaveisComuns.js
Normal file
33
dist-back/variaveisComuns.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var variaveisComuns_exports = {};
|
||||
__export(variaveisComuns_exports, {
|
||||
esperar: () => esperar,
|
||||
nomeVariavel: () => nomeVariavel
|
||||
});
|
||||
module.exports = __toCommonJS(variaveisComuns_exports);
|
||||
const esperar = (ms) => new Promise(
|
||||
(resolve) => setTimeout(() => resolve(true), ms)
|
||||
);
|
||||
const nomeVariavel = (v) => Object.keys(v).join("/");
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
esperar,
|
||||
nomeVariavel
|
||||
});
|
||||
540
dist-front/index.d.mts
Normal file
540
dist-front/index.d.mts
Normal file
|
|
@ -0,0 +1,540 @@
|
|||
import z, { z as z$1 } from 'zod';
|
||||
import _dayjs from 'dayjs';
|
||||
export { Dayjs, ManipulateType } from 'dayjs';
|
||||
import _duration from 'dayjs/plugin/duration';
|
||||
import _isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
||||
import _isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
||||
import _minMax from 'dayjs/plugin/minMax';
|
||||
import _relativeTime from 'dayjs/plugin/relativeTime';
|
||||
import _timezone from 'dayjs/plugin/timezone';
|
||||
import _utc from 'dayjs/plugin/utc';
|
||||
import _weekOfYear from 'dayjs/plugin/weekOfYear';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
declare const aleatorio: (tamanho?: number) => string;
|
||||
|
||||
/** gerar uma função de cache para uso em memoria */
|
||||
declare const cacheM: <T>(chave: any, valor?: T, validadeSeg?: number) => T | undefined;
|
||||
declare const verCacheM: () => {
|
||||
[k: string]: {
|
||||
/** new Date().getTime() */
|
||||
validade?: number | undefined;
|
||||
valor: any;
|
||||
} | undefined;
|
||||
};
|
||||
declare const cacheMemoria: <T>(chave: any, valor?: T, validadeSeg?: number) => T | undefined;
|
||||
/** para uso fixo dentro de uma função, trava a chave */
|
||||
declare const cacheMFixo: (chave: any) => <T>(valor?: T) => T | undefined;
|
||||
|
||||
declare const uuid_null = "00000000-0000-0000-0000-000000000000";
|
||||
/** Colunas Presentes n maioria das tabelas */
|
||||
declare enum camposComuns {
|
||||
codigo = "codigo",
|
||||
excluido = "excluido",
|
||||
data_hora_criacao = "data_hora_criacao",
|
||||
data_hora_atualizacao = "data_hora_atualizacao",
|
||||
codigo_usuario_criacao = "codigo_usuario_criacao",
|
||||
codigo_usuario_atualizacao = "codigo_usuario_atualizacao",
|
||||
versao = "versao"
|
||||
}
|
||||
/** Palavras comumente usadas */
|
||||
declare enum tx {
|
||||
token = "token"
|
||||
}
|
||||
declare enum tipoUsuarioResiduos {
|
||||
Usuario = "usuario",
|
||||
Fornecedor = "fornecedor"
|
||||
}
|
||||
|
||||
declare enum operadores {
|
||||
"=" = "=",
|
||||
"!=" = "!=",
|
||||
">" = ">",
|
||||
">=" = ">=",
|
||||
"<" = "<",
|
||||
"<=" = "<=",
|
||||
like = "like",
|
||||
in = "in",
|
||||
isNull = "isNull"
|
||||
}
|
||||
type tipoFiltro = {
|
||||
coluna: string;
|
||||
valor: any;
|
||||
operador: keyof typeof operadores | operadores;
|
||||
ou?: boolean;
|
||||
};
|
||||
type interfaceConsulta = {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
filtros?: tipoFiltro[];
|
||||
ordem?: string;
|
||||
ordemTipo?: "asc" | "desc";
|
||||
colunas?: string[];
|
||||
apenasConsulta?: boolean;
|
||||
apenasContagem?: boolean;
|
||||
};
|
||||
declare const zOperadores: z.ZodEnum<{
|
||||
"=": "=";
|
||||
"!=": "!=";
|
||||
">": ">";
|
||||
">=": ">=";
|
||||
"<": "<";
|
||||
"<=": "<=";
|
||||
like: "like";
|
||||
in: "in";
|
||||
isNull: "isNull";
|
||||
}>;
|
||||
declare const zFiltro: z.ZodObject<{
|
||||
coluna: z.ZodString;
|
||||
valor: z.ZodAny;
|
||||
operador: z.ZodEnum<{
|
||||
"=": "=";
|
||||
"!=": "!=";
|
||||
">": ">";
|
||||
">=": ">=";
|
||||
"<": "<";
|
||||
"<=": "<=";
|
||||
like: "like";
|
||||
in: "in";
|
||||
isNull: "isNull";
|
||||
}>;
|
||||
ou: z.ZodOptional<z.ZodBoolean>;
|
||||
}, z.core.$strip>;
|
||||
|
||||
/**
|
||||
* Utilitário de configuração do Dayjs focado em compatibilidade com SSR.
|
||||
*
|
||||
* PROBLEMA:
|
||||
* A importação direta do `dayjs` e seus plugins frequentemente causa conflitos em ambientes
|
||||
* de Renderização do Lado do Servidor (SSR), como Nuxt ou Next.js, devido a discrepâncias
|
||||
* na resolução de módulos (ESM vs CJS) e instabilidades de importação.
|
||||
*
|
||||
* SOLUÇÃO:
|
||||
* Este módulo utiliza o padrão de Injeção de Dependência. Ele expõe apenas tipagens e
|
||||
* uma função de configuração (`defineDayjsBr`). A responsabilidade de importar as
|
||||
* bibliotecas "vivas" é delegada à aplicação consumidora (o cliente da função).
|
||||
*
|
||||
* Isso permite que o bundler da aplicação principal (Vite, Webpack, etc.) gerencie as
|
||||
* instâncias, garantindo consistência e evitando erros de "module not found" ou
|
||||
* instâncias duplicadas/não inicializadas adequadamente.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Inicializa e configura o Dayjs com o locale 'pt-br' e plugins essenciais.
|
||||
*
|
||||
* MODO DE USO:
|
||||
* Importe os pacotes reais na sua aplicação e passe-os para esta função.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // Em seu arquivo de configuração (ex: plugins/dayjs.ts):
|
||||
* import dayjs from "dayjs"
|
||||
* import duration from "dayjs/plugin/duration"
|
||||
* import isSameOrAfter from "dayjs/plugin/isSameOrAfter"
|
||||
* import isSameOrBefore from "dayjs/plugin/isSameOrBefore"
|
||||
* import minMax from "dayjs/plugin/minMax"
|
||||
* import relativeTime from "dayjs/plugin/relativeTime"
|
||||
* import timezone from "dayjs/plugin/timezone"
|
||||
* import utc from "dayjs/plugin/utc"
|
||||
* import weekOfYear from "dayjs/plugin/weekOfYear"
|
||||
* import { defineDayjsBr } from "p-comuns"
|
||||
* import "dayjs/locale/pt-br" // Importante: importar o locale!
|
||||
|
||||
* export const dayjsbr = defineDayjsBr({
|
||||
* dayjs,
|
||||
* duration,
|
||||
* isSameOrAfter,
|
||||
* isSameOrBefore,
|
||||
* minMax,
|
||||
* relativeTime,
|
||||
* timezone,
|
||||
* utc,
|
||||
* weekOfYear,
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
declare const defineDayjsBr: ({ dayjs, duration, isSameOrAfter, isSameOrBefore, minMax, relativeTime, timezone, utc, weekOfYear, }: {
|
||||
dayjs: typeof _dayjs;
|
||||
duration: typeof _duration;
|
||||
isSameOrAfter: typeof _isSameOrAfter;
|
||||
isSameOrBefore: typeof _isSameOrBefore;
|
||||
minMax: typeof _minMax;
|
||||
relativeTime: typeof _relativeTime;
|
||||
timezone: typeof _timezone;
|
||||
utc: typeof _utc;
|
||||
weekOfYear: typeof _weekOfYear;
|
||||
}) => typeof _dayjs;
|
||||
|
||||
declare const link_paiol = "https://paiol.idz.one";
|
||||
|
||||
type tiposArquivo = "imagem" | "documento" | "vídeo" | "outros";
|
||||
declare const extensoes: {
|
||||
ext: string;
|
||||
tipo: tiposArquivo;
|
||||
mime: string;
|
||||
}[];
|
||||
/**
|
||||
* Função que retorna o tipo do arquivo
|
||||
* @param nomeArquivo
|
||||
* @returns
|
||||
*/
|
||||
declare const tipoArquivo: (nomeArquivo: string | null | undefined) => tiposArquivo;
|
||||
|
||||
/**
|
||||
* LocalStorage Tipado
|
||||
* Lê ou grava um valor no localStorage, mantendo o tipo genérico <T>.
|
||||
*/
|
||||
declare const localValor: <T>(chave_: string | any, valor?: T | null) => T | null;
|
||||
|
||||
/**
|
||||
* Trata um objeto para ser imput para postgres
|
||||
* @param entrada
|
||||
* @returns
|
||||
*/
|
||||
declare const paraObjetoRegistroPg: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
declare const pgObjeto: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
declare const objetoPg: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
|
||||
declare enum Produtos {
|
||||
"e-licencie" = "e-licencie",
|
||||
"gov.e-licencie" = "gov.e-licencie"
|
||||
}
|
||||
|
||||
declare enum tiposSituacoesElicencie {
|
||||
modelo = "000_modelo",
|
||||
vencida = "100_vencida",
|
||||
expirado = "200_expirado",
|
||||
alerta = "300_alerta",
|
||||
protocoladafora = "350_protocoladafora",
|
||||
protocolada = "400_protocolada",
|
||||
protocoladaApenas = "430_protocolada",
|
||||
protocolada_alteracao = "450_protocolada",
|
||||
prazo = "500_prazo",
|
||||
emitida = "515_emitida",
|
||||
valida = "518_valida",
|
||||
novo = "520_novo",
|
||||
recebido = "521_recebido",
|
||||
em_andamento = "530_em_andamento",
|
||||
aguardando = "530_aguardando",
|
||||
aguardandoresposta = "540_aguardandoresposta",
|
||||
suspensaotemporaria = "540_suspensaotemporaria",
|
||||
cancelada = "550_cancelada",
|
||||
execucao = "560_execucao",
|
||||
pendente = "570_pendente",
|
||||
executadafora = "600_executadafora",
|
||||
executada = "700_executada",
|
||||
naoexecutada = "701_naoexecutada",
|
||||
concluida = "730_concluida",
|
||||
respondido_negado = "740_respondido_negado",
|
||||
respondido_aceito = "741_respondido_aceito",
|
||||
atendidoparcial = "742_atendidoparcial",
|
||||
naoatendido = "743_naoatendido",
|
||||
atendido = "744_atendido",
|
||||
renovada = "760_renovada",
|
||||
finalizada = "800_finalizada",
|
||||
emitirnota = "101_emitirnota",
|
||||
faturaatrasada = "301_faturaatrasada",
|
||||
pagarfatura = "302_pagarfatura",
|
||||
aguardandoconfirmacao = "531_aguardandoconfirmacao",
|
||||
agendado = "701_agendado",
|
||||
faturapaga = "801_faturapaga",
|
||||
excluida = "999_excluida",
|
||||
requerida = "401_requerida",
|
||||
vigente = "516_vigente",
|
||||
emrenovacao = "402_emrenovacao",
|
||||
arquivada = "801_arquivada",
|
||||
aguardando_sincronizacao = "999_aguardando_sincronizacao",
|
||||
nao_conforme = "710_nao_conforme",
|
||||
conforme = "720_conforme",
|
||||
nao_aplicavel = "730_nao_aplicavel",
|
||||
parcial = "715_parcial"
|
||||
}
|
||||
|
||||
declare const umaFuncao: () => string;
|
||||
|
||||
declare const umaVariavel = "Ol\u00E1 Mundo! (vari\u00E1vel)";
|
||||
|
||||
/** gerar o texto de busca removendo caracteres especies e caixa alta */
|
||||
declare const texto_busca: (...texto: any[]) => string;
|
||||
|
||||
/** Gerar uma classe que facilita a gestão de rotas com a tipagem das querys
|
||||
*
|
||||
* Definições:
|
||||
*
|
||||
* caminho = "/aplicacao/funcionalidade"
|
||||
*
|
||||
* endereco = "http://localhost:3000/aplicacao/funcionalidade"
|
||||
*
|
||||
* parametros = {nome:"José"}
|
||||
*/
|
||||
declare class TipagemRotas<T extends {
|
||||
[q: string]: any;
|
||||
}> {
|
||||
_partesCaminho: string[];
|
||||
_acaoIr?: (endereco: string) => undefined;
|
||||
rotulo: string | undefined;
|
||||
/** Ao criar novo obijeto de tipagem de rota é necessário passar o caminho parcial
|
||||
** export const mCaminho = new TipagemRotas<{q:string}>("aplicacao","funcionalidade")
|
||||
*/
|
||||
constructor({ caminho, acaoIr, rotulo, }: {
|
||||
caminho: (string | null | undefined)[] | string;
|
||||
acaoIr?: undefined | ((endereco: string) => undefined);
|
||||
/** Rotulo da página
|
||||
* Inicio | Controle
|
||||
*/
|
||||
rotulo?: string;
|
||||
});
|
||||
/** Retorna o caminho completo da rota
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/caminho"
|
||||
*/
|
||||
get caminho(): string;
|
||||
/** Define o caminho completo da rota
|
||||
** mCaminho.caminho = "/novoCaminho"
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/novoCaminho"
|
||||
** */
|
||||
set caminho(caminhoParcial: string);
|
||||
/** Retorna o caminho completo da rota com a query
|
||||
** console.log(mCaminho.resolve({q:"query"}))
|
||||
** "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
endereco(query: T, usarComoHash?: boolean): string;
|
||||
/** Vai para a url
|
||||
** mCaminho.ir({q:"query"})
|
||||
** window.location.href = "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
ir(query: T): void;
|
||||
/** Retorna os parametros da url
|
||||
** console.log(mCaminho.parametros())
|
||||
** {q:"query"}
|
||||
*/
|
||||
parametros(urlEntrada?: string): Partial<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* =============================================================================
|
||||
* tipoFiltro26<T>
|
||||
* =============================================================================
|
||||
*
|
||||
* OBJETIVO
|
||||
* -----------------------------------------------------------------------------
|
||||
* Gerar automaticamente a tipagem de filtros compatíveis com operadores
|
||||
* padrão do PostgreSQL, a partir de um tipo base T.
|
||||
*
|
||||
* Este tipo foi projetado para:
|
||||
* - Construção de filtros dinâmicos
|
||||
* - Geração posterior de WHERE (Knex / SQL)
|
||||
* - Uso seguro por IA (evita filtros inválidos em nível de tipo)
|
||||
*
|
||||
*
|
||||
* FORMATO DO FILTRO
|
||||
* -----------------------------------------------------------------------------
|
||||
* 1) Campos simples:
|
||||
*
|
||||
* {
|
||||
* idade: { ">=": 18 }
|
||||
* }
|
||||
*
|
||||
* 2) Campos aninhados:
|
||||
*
|
||||
* {
|
||||
* carro: {
|
||||
* ano: { "=": 2020 }
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* 3) Operador E (AND):
|
||||
*
|
||||
* {
|
||||
* E: [
|
||||
* { idade: { ">=": 18 } },
|
||||
* { nome: { like: "%pa%" } }
|
||||
* ]
|
||||
* }
|
||||
*
|
||||
* 4) Operador OU (OR):
|
||||
*
|
||||
* {
|
||||
* OU: [
|
||||
* { idade: { "<": 18 } },
|
||||
* { idade: { ">=": 60 } }
|
||||
* ]
|
||||
* }
|
||||
*
|
||||
* 5) Combinação complexa:
|
||||
*
|
||||
* {
|
||||
* idade: { ">=": 18 },
|
||||
* OU: [
|
||||
* { nome: { like: "%pa%" } },
|
||||
* {
|
||||
* E: [
|
||||
* { carro: { ano: { "=": 2020 } } },
|
||||
* { carro: { modelo: { in: ["Civic"] } } }
|
||||
* ]
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*
|
||||
*
|
||||
* REGRAS IMPORTANTES (PARA IA)
|
||||
* -----------------------------------------------------------------------------
|
||||
* - Apenas campos existentes em T podem ser usados.
|
||||
* - Operadores são restritos por tipo do campo.
|
||||
* - Objetos são tratados recursivamente.
|
||||
* - Arrays NÃO são tratados como objeto recursivo.
|
||||
* - Funções NÃO são consideradas campos filtráveis.
|
||||
*
|
||||
*
|
||||
* OPERADORES SUPORTADOS
|
||||
* -----------------------------------------------------------------------------
|
||||
* number:
|
||||
* =, !=, >, >=, <, <=, in
|
||||
*
|
||||
* string:
|
||||
* =, !=, like, in
|
||||
*
|
||||
* boolean:
|
||||
* =, !=, in
|
||||
*
|
||||
* Não há suporte automático a:
|
||||
* - null
|
||||
* - date
|
||||
* - jsonb
|
||||
* - arrays
|
||||
*
|
||||
* Essas extensões devem ser adicionadas explicitamente.
|
||||
*
|
||||
* =============================================================================
|
||||
*/
|
||||
declare enum operadores26 {
|
||||
"=" = "=",
|
||||
"!=" = "!=",
|
||||
">" = ">",
|
||||
">=" = ">=",
|
||||
"<" = "<",
|
||||
"<=" = "<=",
|
||||
like = "like",
|
||||
in = "in"
|
||||
}
|
||||
declare enum agrupadores26 {
|
||||
E = "E",
|
||||
OU = "OU"
|
||||
}
|
||||
type PgOpsNumber = {
|
||||
[K in Extract<operadores26, "=" | "!=" | ">" | ">=" | "<" | "<=">]?: number;
|
||||
} & {
|
||||
[K in Extract<operadores26, "in">]?: number[];
|
||||
};
|
||||
type PgOpsString = {
|
||||
[K in Extract<operadores26, "=" | "!=" | "like">]?: string;
|
||||
} & {
|
||||
[K in Extract<operadores26, "in">]?: string[];
|
||||
};
|
||||
type PgOpsBoolean = {
|
||||
[K in Extract<operadores26, "=" | "!=">]?: boolean;
|
||||
} & {
|
||||
[K in Extract<operadores26, "in">]?: boolean[];
|
||||
};
|
||||
type PgOpsFor<V> = V extends number ? PgOpsNumber : V extends string ? PgOpsString : V extends boolean ? PgOpsBoolean : never;
|
||||
type IsPlainObject<T> = T extends object ? T extends Function ? false : T extends readonly any[] ? false : true : false;
|
||||
type FiltroCampos<T> = {
|
||||
[K in keyof T]?: IsPlainObject<T[K]> extends true ? tipoFiltro26<T[K]> : PgOpsFor<T[K]>;
|
||||
};
|
||||
type tipoFiltro26<T> = FiltroCampos<T> & {
|
||||
/**
|
||||
* E => AND lógico
|
||||
* Todos os filtros dentro do array devem ser verdadeiros.
|
||||
*/
|
||||
E?: tipoFiltro26<T>[];
|
||||
/**
|
||||
* OU => OR lógico
|
||||
* Pelo menos um filtro dentro do array deve ser verdadeiro.
|
||||
*/
|
||||
OU?: tipoFiltro26<T>[];
|
||||
};
|
||||
declare const zFiltro26: z$1.ZodType<any>;
|
||||
declare const criarFiltro26: <T>(filtro: tipoFiltro26<T>) => tipoFiltro26<T>;
|
||||
|
||||
/**
|
||||
* Essa variável se conecta a tabela_lidades
|
||||
*
|
||||
* onde sigla se conecta com sigla
|
||||
*
|
||||
* Usuário terá mais opções de unidades, quando fazer o envio para o mtr, usar a opção fornecida pelo usuarios, caso não tenha
|
||||
* usar a normalizada
|
||||
*/
|
||||
declare enum siglas_unidades_medida {
|
||||
UN = "UN",
|
||||
KG = "KG",
|
||||
TON = "TON",
|
||||
g = "g",
|
||||
"M³" = "M\u00B3",
|
||||
Lt = "Lt"
|
||||
}
|
||||
declare const unidades_medida: {
|
||||
sigla_unidade: keyof typeof siglas_unidades_medida;
|
||||
nome: string;
|
||||
sigla_normalizada: keyof typeof siglas_unidades_medida;
|
||||
normalizar: (valor: number) => number;
|
||||
tipo: "massa" | "volume" | "comprimento" | "unidade";
|
||||
}[];
|
||||
|
||||
/**
|
||||
* Valida se uma string é um UUID válido (qualquer versão).
|
||||
*
|
||||
* @param valor - A string que será validada.
|
||||
* @returns booleano indicando se é um UUID válido.
|
||||
*/
|
||||
declare const erUuid: RegExp;
|
||||
declare const validarUuid: (uuid: string | number | undefined | null) => boolean;
|
||||
/**
|
||||
* Gera um UUID determinístico (versão 3) com base em uma chave e um grupo (namespace).
|
||||
*
|
||||
* - Usa o algoritmo MD5 (RFC 4122).
|
||||
* - Sempre retorna o mesmo UUID para a mesma combinação chave + grupo.
|
||||
* - Caso o grupo não seja informado, usa o UUID "nil" como namespace.
|
||||
*
|
||||
* @param chave - Qualquer valor que será convertido em string para gerar o UUID (ex: número, string ou objeto).
|
||||
* @param grupo - Opcional. Namespace para separar domínios diferentes de UUIDs.
|
||||
* @returns UUID v3 (determinístico)
|
||||
*/
|
||||
declare const uuidV3: (chave: any, grupo?: any) => string;
|
||||
/**
|
||||
* Gera um UUID v4 (aleatório, não determinístico).
|
||||
*
|
||||
* - Usado quando unicidade é necessária, mas não se exige que seja previsível.
|
||||
*/
|
||||
declare const uuidV4: typeof v4;
|
||||
/**
|
||||
* @deprecated Esta variável será descontinuada em versões futuras.
|
||||
* Use a função `uuidV4()` diretamente.
|
||||
*/
|
||||
declare const uuid: typeof v4;
|
||||
|
||||
declare const esperar: (ms: number) => Promise<true>;
|
||||
/**
|
||||
* Usado para retronat o no de uma variável, deve ser usado dentro de um objeto
|
||||
* const nomex = {a: 1, b: 2}
|
||||
* nomeVariavel({nomex}) // retorna "nomex"
|
||||
* @param v
|
||||
* @returns
|
||||
*/
|
||||
declare const nomeVariavel: (v: {
|
||||
[key: string]: any;
|
||||
}) => string;
|
||||
|
||||
export { Produtos, TipagemRotas, agrupadores26, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, criarFiltro26, defineDayjsBr, erUuid, esperar, extensoes, type interfaceConsulta, link_paiol, localValor, nomeVariavel, objetoPg, operadores, operadores26, paraObjetoRegistroPg, pgObjeto, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoFiltro, type tipoFiltro26, tipoUsuarioResiduos, tiposSituacoesElicencie, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zFiltro26, zOperadores };
|
||||
1
dist-front/index.mjs
Normal file
1
dist-front/index.mjs
Normal file
File diff suppressed because one or more lines are too long
600
dist/index.cjs
vendored
600
dist/index.cjs
vendored
|
|
@ -1,600 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const z = require('zod');
|
||||
const dayjs = require('dayjs');
|
||||
const duration = require('dayjs/plugin/duration.js');
|
||||
const isSameOrAfter = require('dayjs/plugin/isSameOrAfter.js');
|
||||
const isSameOrBefore = require('dayjs/plugin/isSameOrBefore.js');
|
||||
const minMax = require('dayjs/plugin/minMax.js');
|
||||
const relativeTime = require('dayjs/plugin/relativeTime.js');
|
||||
const timezone = require('dayjs/plugin/timezone.js');
|
||||
const utc = require('dayjs/plugin/utc.js');
|
||||
const weekOfYear = require('dayjs/plugin/weekOfYear.js');
|
||||
require('dayjs/locale/pt-br.js');
|
||||
const crossFetch = require('cross-fetch');
|
||||
const uuid$1 = require('uuid');
|
||||
|
||||
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
||||
|
||||
const z__default = /*#__PURE__*/_interopDefaultCompat(z);
|
||||
const dayjs__default = /*#__PURE__*/_interopDefaultCompat(dayjs);
|
||||
const duration__default = /*#__PURE__*/_interopDefaultCompat(duration);
|
||||
const isSameOrAfter__default = /*#__PURE__*/_interopDefaultCompat(isSameOrAfter);
|
||||
const isSameOrBefore__default = /*#__PURE__*/_interopDefaultCompat(isSameOrBefore);
|
||||
const minMax__default = /*#__PURE__*/_interopDefaultCompat(minMax);
|
||||
const relativeTime__default = /*#__PURE__*/_interopDefaultCompat(relativeTime);
|
||||
const timezone__default = /*#__PURE__*/_interopDefaultCompat(timezone);
|
||||
const utc__default = /*#__PURE__*/_interopDefaultCompat(utc);
|
||||
const weekOfYear__default = /*#__PURE__*/_interopDefaultCompat(weekOfYear);
|
||||
const crossFetch__default = /*#__PURE__*/_interopDefaultCompat(crossFetch);
|
||||
|
||||
const alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
||||
const aleatorio = (tamanho) => `eli-${Array.from({ length: tamanho || 8 }).map(() => alfabeto[(999 * Math.random() | 0) % alfabeto.length]).join("")}`;
|
||||
|
||||
const _cache = {};
|
||||
globalThis.cacheMemoria_cache = _cache;
|
||||
const cacheM = (chave, valor, validadeSeg) => {
|
||||
const txChave = typeof chave == "string" ? chave : typeof chave == "number" ? String(chave) : encodeURIComponent(JSON.stringify(chave));
|
||||
const validade = validadeSeg && (/* @__PURE__ */ new Date()).getTime() + validadeSeg * 1e3;
|
||||
if (valor !== void 0) {
|
||||
_cache[txChave] = {
|
||||
valor,
|
||||
validade
|
||||
};
|
||||
}
|
||||
const busca = _cache[txChave];
|
||||
if (busca?.validade && busca.validade < (/* @__PURE__ */ new Date()).getTime()) {
|
||||
return void 0;
|
||||
}
|
||||
return busca?.valor;
|
||||
};
|
||||
const verCacheM = () => _cache;
|
||||
const cacheMemoria = cacheM;
|
||||
const cacheMFixo = (chave) => (valor) => cacheM(chave, valor);
|
||||
|
||||
const uuid_null = "00000000-0000-0000-0000-000000000000";
|
||||
var camposComuns = /* @__PURE__ */ ((camposComuns2) => {
|
||||
camposComuns2["codigo"] = "codigo";
|
||||
camposComuns2["excluido"] = "excluido";
|
||||
camposComuns2["data_hora_criacao"] = "data_hora_criacao";
|
||||
camposComuns2["data_hora_atualizacao"] = "data_hora_atualizacao";
|
||||
camposComuns2["codigo_usuario_criacao"] = "codigo_usuario_criacao";
|
||||
camposComuns2["codigo_usuario_atualizacao"] = "codigo_usuario_atualizacao";
|
||||
camposComuns2["versao"] = "versao";
|
||||
return camposComuns2;
|
||||
})(camposComuns || {});
|
||||
var tx = /* @__PURE__ */ ((tx2) => {
|
||||
tx2["token"] = "token";
|
||||
return tx2;
|
||||
})(tx || {});
|
||||
var tipoUsuarioResiduos = /* @__PURE__ */ ((tipoUsuarioResiduos2) => {
|
||||
tipoUsuarioResiduos2["Usuario"] = "usuario";
|
||||
tipoUsuarioResiduos2["Fornecedor"] = "fornecedor";
|
||||
return tipoUsuarioResiduos2;
|
||||
})(tipoUsuarioResiduos || {});
|
||||
|
||||
var operadores = /* @__PURE__ */ ((operadores2) => {
|
||||
operadores2["="] = "=";
|
||||
operadores2["!="] = "!=";
|
||||
operadores2[">"] = ">";
|
||||
operadores2[">="] = ">=";
|
||||
operadores2["<"] = "<";
|
||||
operadores2["<="] = "<=";
|
||||
operadores2["like"] = "like";
|
||||
operadores2["in"] = "in";
|
||||
return operadores2;
|
||||
})(operadores || {});
|
||||
const zOperadores = z__default.enum([
|
||||
"=",
|
||||
"!=",
|
||||
">",
|
||||
">=",
|
||||
"<",
|
||||
"<=",
|
||||
"like",
|
||||
"in"
|
||||
]);
|
||||
const zFiltro = z__default.object({
|
||||
coluna: z__default.string(),
|
||||
valor: z__default.any(),
|
||||
operador: zOperadores,
|
||||
ou: z__default.boolean().optional()
|
||||
});
|
||||
|
||||
dayjs__default.locale("pt-br");
|
||||
dayjs__default.extend(utc__default);
|
||||
dayjs__default.extend(timezone__default);
|
||||
dayjs__default.extend(weekOfYear__default);
|
||||
dayjs__default.extend(isSameOrBefore__default);
|
||||
dayjs__default.extend(isSameOrAfter__default);
|
||||
dayjs__default.extend(minMax__default);
|
||||
dayjs__default.extend(relativeTime__default);
|
||||
dayjs__default.extend(duration__default);
|
||||
const dayjsbr = dayjs__default;
|
||||
|
||||
const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
|
||||
|
||||
const extensoes = [
|
||||
{
|
||||
ext: "gif",
|
||||
tipo: "imagem",
|
||||
mime: "image/gif"
|
||||
},
|
||||
{
|
||||
ext: "jpg",
|
||||
tipo: "imagem",
|
||||
mime: "image/jpeg"
|
||||
},
|
||||
{
|
||||
ext: "jpeg",
|
||||
tipo: "imagem",
|
||||
mime: "image/jpeg"
|
||||
},
|
||||
{
|
||||
ext: "png",
|
||||
tipo: "imagem",
|
||||
mime: "image/png"
|
||||
},
|
||||
{
|
||||
ext: "bmp",
|
||||
tipo: "imagem",
|
||||
mime: "image/bmp"
|
||||
},
|
||||
{
|
||||
ext: "webp",
|
||||
tipo: "imagem",
|
||||
mime: "image/webp"
|
||||
},
|
||||
{
|
||||
ext: "tiff",
|
||||
tipo: "imagem",
|
||||
mime: "image/tiff"
|
||||
},
|
||||
{
|
||||
ext: "svg",
|
||||
tipo: "imagem",
|
||||
mime: "image/svg+xml"
|
||||
},
|
||||
{
|
||||
ext: "ico",
|
||||
tipo: "imagem",
|
||||
mime: "image/x-icon"
|
||||
},
|
||||
{
|
||||
ext: "pdf",
|
||||
tipo: "documento",
|
||||
mime: "application/pdf"
|
||||
},
|
||||
{
|
||||
ext: "doc",
|
||||
tipo: "documento",
|
||||
mime: "application/msword"
|
||||
},
|
||||
{
|
||||
ext: "docx",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
},
|
||||
{
|
||||
ext: "xls",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.ms-excel"
|
||||
},
|
||||
{
|
||||
ext: "xlsx",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
},
|
||||
{
|
||||
ext: "ppt",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.ms-powerpoint"
|
||||
},
|
||||
{
|
||||
ext: "pptx",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
||||
},
|
||||
{
|
||||
ext: "txt",
|
||||
tipo: "documento",
|
||||
mime: "text/plain"
|
||||
},
|
||||
{
|
||||
ext: "odt",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.oasis.opendocument.text"
|
||||
},
|
||||
{
|
||||
ext: "ods",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.oasis.opendocument.spreadsheet"
|
||||
},
|
||||
{
|
||||
ext: "rtf",
|
||||
tipo: "documento",
|
||||
mime: "application/rtf"
|
||||
},
|
||||
{
|
||||
ext: "csv",
|
||||
tipo: "documento",
|
||||
mime: "text/csv"
|
||||
},
|
||||
{
|
||||
ext: "mp4",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/mp4"
|
||||
},
|
||||
{
|
||||
ext: "avi",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-msvideo"
|
||||
},
|
||||
{
|
||||
ext: "mkv",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-matroska"
|
||||
},
|
||||
{
|
||||
ext: "mov",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/quicktime"
|
||||
},
|
||||
{
|
||||
ext: "wmv",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-ms-wmv"
|
||||
},
|
||||
{
|
||||
ext: "flv",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-flv"
|
||||
},
|
||||
{
|
||||
ext: "webm",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/webm"
|
||||
},
|
||||
{
|
||||
ext: "3gp",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/3gpp"
|
||||
},
|
||||
{
|
||||
ext: "mpeg",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/mpeg"
|
||||
}
|
||||
];
|
||||
const tipoArquivo = (nomeArquivo) => {
|
||||
const extArquivo = String(nomeArquivo || "").toLocaleLowerCase().split(".").pop();
|
||||
const extensao = extensoes.find((extensao2) => extensao2.ext === extArquivo);
|
||||
return extensao?.tipo || "outros";
|
||||
};
|
||||
|
||||
const graficos_pilao = {
|
||||
Condicionantes: {
|
||||
grafico: "condicionantes-criadas",
|
||||
titulo: "Condicionantes Criadas"
|
||||
},
|
||||
Licen\u00E7as: {
|
||||
grafico: "licencas-criadas",
|
||||
titulo: "Licen\xE7as Criadas"
|
||||
}
|
||||
};
|
||||
|
||||
const localValor = (chave_, valor) => {
|
||||
const localStorage = globalThis.localStorage;
|
||||
if (typeof localStorage == "undefined") return null;
|
||||
const chave = typeof chave_ === "string" ? chave_ : encodeURIComponent(JSON.stringify(chave_));
|
||||
try {
|
||||
if (valor !== void 0) {
|
||||
localStorage.setItem(chave, JSON.stringify(valor));
|
||||
}
|
||||
const v2 = localStorage.getItem(chave);
|
||||
if (v2 === null) return null;
|
||||
try {
|
||||
return JSON.parse(v2);
|
||||
} catch {
|
||||
return v2;
|
||||
}
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const esperar = (ms) => new Promise(
|
||||
(resolve) => setTimeout(() => resolve(true), ms)
|
||||
);
|
||||
const nomeVariavel = (v) => Object.keys(v).join("/");
|
||||
|
||||
const LOKI_BASE_URL = "https://log.idz.one";
|
||||
const LOKI_ENDPOINT = "/loki/api/v1/push";
|
||||
const postLogger = async ({
|
||||
objeto
|
||||
}) => {
|
||||
const response = await crossFetch__default(`${LOKI_BASE_URL}${LOKI_ENDPOINT}`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(objeto)
|
||||
}).catch((a) => a);
|
||||
if (!response.ok) {
|
||||
return [objeto, `Erro ${response.status}: ${await response?.text?.()}`];
|
||||
}
|
||||
return [objeto];
|
||||
};
|
||||
let cwd = "";
|
||||
const defineCwd = (novoCwd) => {
|
||||
cwd = novoCwd;
|
||||
};
|
||||
const logger = ({ app: app_e, eProducao, parametros: parametrosAmbiente }) => ({ inquilino, usuario, parametros: parametrosSessao }) => async (level, mensagem, op_tipoLog) => {
|
||||
let {
|
||||
__filename,
|
||||
detalhes,
|
||||
local,
|
||||
parametros: parametrosLog
|
||||
} = op_tipoLog || {};
|
||||
const app = `${eProducao ? "" : "DEV-"}${app_e}`;
|
||||
if (cwd && __filename) {
|
||||
__filename = __filename.replace(cwd, "");
|
||||
}
|
||||
if (local) {
|
||||
detalhes = [`${nomeVariavel({ local })}="${local}"`, ...detalhes || []];
|
||||
}
|
||||
if (__filename) {
|
||||
detalhes = [
|
||||
`${nomeVariavel({ __filename })}="${__filename}"`,
|
||||
...detalhes || []
|
||||
];
|
||||
}
|
||||
const timestamp = `${Date.now()}000000`;
|
||||
const mainLog = detalhes?.length ? `${mensagem} | ${detalhes.map((d) => JSON.stringify(d)).join(" | ")}` : mensagem;
|
||||
const payload = {
|
||||
stream: {
|
||||
app,
|
||||
inquilino,
|
||||
usuario,
|
||||
level,
|
||||
...parametrosAmbiente || {},
|
||||
...parametrosSessao || {},
|
||||
...parametrosLog || {}
|
||||
},
|
||||
values: [
|
||||
[
|
||||
timestamp,
|
||||
mainLog
|
||||
// Linha de log direta
|
||||
]
|
||||
]
|
||||
};
|
||||
const objeto = { streams: [payload] };
|
||||
const response = await postLogger({ objeto });
|
||||
return response;
|
||||
};
|
||||
|
||||
const paraObjetoRegistroPg = (entrada) => {
|
||||
try {
|
||||
return Object.fromEntries(
|
||||
Object.entries(entrada).map(([k, v]) => [
|
||||
k,
|
||||
v === void 0 || v == null ? v : typeof v == "string" || typeof v == "number" || typeof v == "boolean" ? v : JSON.stringify(v, null, 2)
|
||||
])
|
||||
);
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Erro na fun\xE7\xE3o paraObjetoRegistroPg: ${error.message} ${error.stack}`
|
||||
);
|
||||
}
|
||||
};
|
||||
const pgObjeto = paraObjetoRegistroPg;
|
||||
const objetoPg = paraObjetoRegistroPg;
|
||||
|
||||
const umaFuncao = () => "Ol\xE1 Mundo! (fun\xE7\xE3o)";
|
||||
|
||||
const umaVariavel = "Ol\xE1 Mundo! (vari\xE1vel)";
|
||||
|
||||
const texto_busca = (...texto) => texto.map(
|
||||
(txt) => txt === null || txt === void 0 ? "" : String(txt).normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, " ").toLowerCase()
|
||||
).join(" ");
|
||||
|
||||
class TipagemRotas {
|
||||
_partesCaminho = [];
|
||||
_acaoIr;
|
||||
rotulo;
|
||||
/** Ao criar novo obijeto de tipagem de rota é necessário passar o caminho parcial
|
||||
** export const mCaminho = new TipagemRotas<{q:string}>("aplicacao","funcionalidade")
|
||||
*/
|
||||
constructor({
|
||||
caminho,
|
||||
acaoIr,
|
||||
rotulo
|
||||
}) {
|
||||
this._acaoIr = acaoIr;
|
||||
this._partesCaminho = (Array.isArray(caminho) ? caminho : [caminho]).filter(Boolean).map((a) => String(a)).flatMap((a) => a.split("/")).filter(Boolean);
|
||||
this.rotulo = rotulo;
|
||||
}
|
||||
/** Retorna o caminho completo da rota
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/caminho"
|
||||
*/
|
||||
get caminho() {
|
||||
const ret = `/${this._partesCaminho.join("/")}`;
|
||||
return ret;
|
||||
}
|
||||
/** Define o caminho completo da rota
|
||||
** mCaminho.caminho = "/novoCaminho"
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/novoCaminho"
|
||||
** */
|
||||
set caminho(caminhoParcial) {
|
||||
this._partesCaminho = caminhoParcial.split("/").filter((parte) => parte);
|
||||
}
|
||||
/** Retorna o caminho completo da rota com a query
|
||||
** console.log(mCaminho.resolve({q:"query"}))
|
||||
** "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
endereco(query, usarComoHash) {
|
||||
const url = new URL(
|
||||
typeof window !== "undefined" ? window.location.href : "http://localhost"
|
||||
);
|
||||
url.pathname = this.caminho;
|
||||
url.search = "";
|
||||
const queryKeys = Object.entries(query);
|
||||
for (const [key, value] of queryKeys) {
|
||||
url.searchParams.set(String(key), JSON.stringify(value));
|
||||
}
|
||||
url.hash = "";
|
||||
if (usarComoHash) {
|
||||
url.hash = `#${url.search}`;
|
||||
url.search = "";
|
||||
}
|
||||
return url.href;
|
||||
}
|
||||
/** Vai para a url
|
||||
** mCaminho.ir({q:"query"})
|
||||
** window.location.href = "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
ir(query) {
|
||||
if (this._acaoIr) {
|
||||
this._acaoIr(this.endereco({ ...query }));
|
||||
} else {
|
||||
if (typeof window != "undefined") {
|
||||
window.location.href = this.endereco({ ...query });
|
||||
}
|
||||
}
|
||||
}
|
||||
/** Retorna os parametros da url
|
||||
** console.log(mCaminho.parametros())
|
||||
** {q:"query"}
|
||||
*/
|
||||
parametros(urlEntrada) {
|
||||
const url = urlEntrada ? new URL(urlEntrada) : new URL(
|
||||
typeof window !== "undefined" ? window.location.href : "http://localhost"
|
||||
);
|
||||
const query = url.searchParams;
|
||||
let queryObj = Object.fromEntries(query.entries());
|
||||
const hash = url.hash;
|
||||
if (hash) {
|
||||
const hashObj = Object.fromEntries(
|
||||
new URLSearchParams(hash.slice(1)).entries()
|
||||
);
|
||||
queryObj = { ...queryObj, ...hashObj };
|
||||
}
|
||||
for (const chave in queryObj) {
|
||||
try {
|
||||
queryObj[chave] = JSON.parse(queryObj[chave]);
|
||||
} catch {
|
||||
console.log(`[${chave}|${queryObj[chave]}] n\xE3o \xE9 um json v\xE1lido.`);
|
||||
}
|
||||
}
|
||||
return queryObj;
|
||||
}
|
||||
}
|
||||
|
||||
var siglas_unidades_medida = /* @__PURE__ */ ((siglas_unidades_medida2) => {
|
||||
siglas_unidades_medida2["UN"] = "UN";
|
||||
siglas_unidades_medida2["KG"] = "KG";
|
||||
siglas_unidades_medida2["TON"] = "TON";
|
||||
siglas_unidades_medida2["g"] = "g";
|
||||
siglas_unidades_medida2["M\xB3"] = "M\xB3";
|
||||
siglas_unidades_medida2["Lt"] = "Lt";
|
||||
return siglas_unidades_medida2;
|
||||
})(siglas_unidades_medida || {});
|
||||
const unidades_medida = [
|
||||
{
|
||||
sigla_unidade: "KG",
|
||||
nome: "Quilograma",
|
||||
sigla_normalizada: "KG",
|
||||
normalizar: (valor) => valor,
|
||||
tipo: "massa"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "g",
|
||||
nome: "Grama",
|
||||
sigla_normalizada: "KG",
|
||||
normalizar: (valor) => valor / 1e3,
|
||||
tipo: "massa"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "TON",
|
||||
nome: "Tonelada",
|
||||
sigla_normalizada: "KG",
|
||||
normalizar: (valor) => valor * 1e3,
|
||||
tipo: "massa"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "Lt",
|
||||
nome: "Litro",
|
||||
sigla_normalizada: "Lt",
|
||||
normalizar: (valor) => valor,
|
||||
tipo: "volume"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "M\xB3",
|
||||
nome: "Metro C\xFAbico",
|
||||
sigla_normalizada: "Lt",
|
||||
normalizar: (valor) => valor * 1e3,
|
||||
tipo: "volume"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "UN",
|
||||
nome: "Unidade",
|
||||
sigla_normalizada: "UN",
|
||||
normalizar: (valor) => valor,
|
||||
tipo: "unidade"
|
||||
}
|
||||
];
|
||||
|
||||
const erUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
const validarUuid = (uuid2) => {
|
||||
const retorno = erUuid.test(String(uuid2 || ""));
|
||||
return retorno;
|
||||
};
|
||||
const uuidV3 = (chave, grupo) => {
|
||||
return uuid$1.v3(
|
||||
// Converte a chave para string (de forma segura)
|
||||
typeof chave === "string" ? chave : typeof chave === "number" ? String(chave) : JSON.stringify(chave),
|
||||
// Se um grupo foi fornecido, gera um UUID v3 recursivamente com base nele, senão usa NIL
|
||||
grupo ? uuidV3(grupo) : uuid$1.NIL
|
||||
);
|
||||
};
|
||||
const uuidV4 = uuid$1.v4;
|
||||
const uuid = uuidV4;
|
||||
|
||||
exports.TipagemRotas = TipagemRotas;
|
||||
exports.aleatorio = aleatorio;
|
||||
exports.cacheM = cacheM;
|
||||
exports.cacheMFixo = cacheMFixo;
|
||||
exports.cacheMemoria = cacheMemoria;
|
||||
exports.camposComuns = camposComuns;
|
||||
exports.cdn_carro_de_boi = cdn_carro_de_boi;
|
||||
exports.dayjsbr = dayjsbr;
|
||||
exports.defineCwd = defineCwd;
|
||||
exports.erUuid = erUuid;
|
||||
exports.esperar = esperar;
|
||||
exports.extensoes = extensoes;
|
||||
exports.graficos_pilao = graficos_pilao;
|
||||
exports.localValor = localValor;
|
||||
exports.logger = logger;
|
||||
exports.nomeVariavel = nomeVariavel;
|
||||
exports.objetoPg = objetoPg;
|
||||
exports.operadores = operadores;
|
||||
exports.paraObjetoRegistroPg = paraObjetoRegistroPg;
|
||||
exports.pgObjeto = pgObjeto;
|
||||
exports.postLogger = postLogger;
|
||||
exports.siglas_unidades_medida = siglas_unidades_medida;
|
||||
exports.texto_busca = texto_busca;
|
||||
exports.tipoArquivo = tipoArquivo;
|
||||
exports.tipoUsuarioResiduos = tipoUsuarioResiduos;
|
||||
exports.tx = tx;
|
||||
exports.umaFuncao = umaFuncao;
|
||||
exports.umaVariavel = umaVariavel;
|
||||
exports.unidades_medida = unidades_medida;
|
||||
exports.uuid = uuid;
|
||||
exports.uuidV3 = uuidV3;
|
||||
exports.uuidV4 = uuidV4;
|
||||
exports.uuid_null = uuid_null;
|
||||
exports.validarUuid = validarUuid;
|
||||
exports.verCacheM = verCacheM;
|
||||
exports.zFiltro = zFiltro;
|
||||
exports.zOperadores = zOperadores;
|
||||
315
dist/index.d.cts
vendored
315
dist/index.d.cts
vendored
|
|
@ -1,315 +0,0 @@
|
|||
import z from 'zod';
|
||||
import dayjs from 'dayjs';
|
||||
export { ManipulateType } from 'dayjs';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
declare const aleatorio: (tamanho?: number) => string;
|
||||
|
||||
/** gerar uma função de cache para uso em memoria */
|
||||
declare const cacheM: <T>(chave: any, valor?: T, validadeSeg?: number) => T | undefined;
|
||||
declare const verCacheM: () => {
|
||||
[k: string]: {
|
||||
/** new Date().getTime() */
|
||||
validade?: number | undefined;
|
||||
valor: any;
|
||||
} | undefined;
|
||||
};
|
||||
declare const cacheMemoria: <T>(chave: any, valor?: T, validadeSeg?: number) => T | undefined;
|
||||
/** para uso fixo dentro de uma função, trava a chave */
|
||||
declare const cacheMFixo: (chave: any) => <T>(valor?: T) => T | undefined;
|
||||
|
||||
declare const uuid_null = "00000000-0000-0000-0000-000000000000";
|
||||
/** Colunas Presentes n maioria das tabelas */
|
||||
declare enum camposComuns {
|
||||
codigo = "codigo",
|
||||
excluido = "excluido",
|
||||
data_hora_criacao = "data_hora_criacao",
|
||||
data_hora_atualizacao = "data_hora_atualizacao",
|
||||
codigo_usuario_criacao = "codigo_usuario_criacao",
|
||||
codigo_usuario_atualizacao = "codigo_usuario_atualizacao",
|
||||
versao = "versao"
|
||||
}
|
||||
/** Palavras comumente usadas */
|
||||
declare enum tx {
|
||||
token = "token"
|
||||
}
|
||||
declare enum tipoUsuarioResiduos {
|
||||
Usuario = "usuario",
|
||||
Fornecedor = "fornecedor"
|
||||
}
|
||||
|
||||
declare enum operadores {
|
||||
"=" = "=",
|
||||
"!=" = "!=",
|
||||
">" = ">",
|
||||
">=" = ">=",
|
||||
"<" = "<",
|
||||
"<=" = "<=",
|
||||
like = "like",
|
||||
in = "in"
|
||||
}
|
||||
type tipoFiltro = {
|
||||
coluna: string;
|
||||
valor: any;
|
||||
operador: keyof typeof operadores | operadores;
|
||||
ou?: boolean;
|
||||
};
|
||||
type interfaceConsulta = {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
filtros?: tipoFiltro[];
|
||||
ordem?: string;
|
||||
ordemTipo?: "asc" | "desc";
|
||||
colunas?: string[];
|
||||
apenasConsulta?: boolean;
|
||||
apenasContagem?: boolean;
|
||||
};
|
||||
declare const zOperadores: z.ZodEnum<{
|
||||
"=": "=";
|
||||
"!=": "!=";
|
||||
">": ">";
|
||||
">=": ">=";
|
||||
"<": "<";
|
||||
"<=": "<=";
|
||||
like: "like";
|
||||
in: "in";
|
||||
}>;
|
||||
declare const zFiltro: z.ZodObject<{
|
||||
coluna: z.ZodString;
|
||||
valor: z.ZodAny;
|
||||
operador: z.ZodEnum<{
|
||||
"=": "=";
|
||||
"!=": "!=";
|
||||
">": ">";
|
||||
">=": ">=";
|
||||
"<": "<";
|
||||
"<=": "<=";
|
||||
like: "like";
|
||||
in: "in";
|
||||
}>;
|
||||
ou: z.ZodOptional<z.ZodBoolean>;
|
||||
}, z.core.$strip>;
|
||||
|
||||
declare const dayjsbr: typeof dayjs;
|
||||
|
||||
declare const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
|
||||
|
||||
type tiposArquivo = "imagem" | "documento" | "vídeo" | "outros";
|
||||
declare const extensoes: {
|
||||
ext: string;
|
||||
tipo: tiposArquivo;
|
||||
mime: string;
|
||||
}[];
|
||||
/**
|
||||
* Função que retorna o tipo do arquivo
|
||||
* @param nomeArquivo
|
||||
* @returns
|
||||
*/
|
||||
declare const tipoArquivo: (nomeArquivo: string | null | undefined) => tiposArquivo;
|
||||
|
||||
declare const graficos_pilao: {
|
||||
[k: string]: {
|
||||
grafico: string;
|
||||
titulo: string;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* LocalStorage Tipado
|
||||
* Lê ou grava um valor no localStorage, mantendo o tipo genérico <T>.
|
||||
*/
|
||||
declare const localValor: <T>(chave_: string | any, valor?: T | null) => T | null;
|
||||
|
||||
type tipoLokiObjeto = {
|
||||
streams: {
|
||||
stream: {
|
||||
[k: string]: string;
|
||||
};
|
||||
values: [string, string][];
|
||||
}[];
|
||||
};
|
||||
declare const postLogger: ({ objeto, }: {
|
||||
objeto: tipoLokiObjeto;
|
||||
}) => Promise<[objeto: tipoLokiObjeto, erro?: string]>;
|
||||
/** define a localização da pasta do projeto */
|
||||
declare const defineCwd: (novoCwd: string) => void;
|
||||
type tipoLevel = "info" | "warn" | "error";
|
||||
type tipoOpSessao = {
|
||||
inquilino: string;
|
||||
usuario: string;
|
||||
parametros?: {
|
||||
[k: string]: string;
|
||||
};
|
||||
};
|
||||
type tipoLog = {
|
||||
detalhes?: unknown[];
|
||||
__filename?: string;
|
||||
local?: string;
|
||||
parametros?: {
|
||||
[k: string]: string;
|
||||
};
|
||||
};
|
||||
type tipoLoggerLog = (level: tipoLevel, mensagem: string, op_tipoLog?: tipoLog) => Promise<[objeto: tipoLokiObjeto, erro?: string]>;
|
||||
type TipoLoggerSessao = (sess: tipoOpSessao) => tipoLoggerLog;
|
||||
type tipoLogger = (amb: {
|
||||
app: string;
|
||||
eProducao: boolean;
|
||||
parametros?: {
|
||||
[k: string]: string;
|
||||
};
|
||||
}) => TipoLoggerSessao;
|
||||
declare const logger: tipoLogger;
|
||||
|
||||
/**
|
||||
* Trata um objeto para ser imput para postgres
|
||||
* @param entrada
|
||||
* @returns
|
||||
*/
|
||||
declare const paraObjetoRegistroPg: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
declare const pgObjeto: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
declare const objetoPg: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
|
||||
declare const umaFuncao: () => string;
|
||||
|
||||
declare const umaVariavel = "Ol\u00E1 Mundo! (vari\u00E1vel)";
|
||||
|
||||
/** gerar o texto de busca removendo caracteres especies e caixa alta */
|
||||
declare const texto_busca: (...texto: any[]) => string;
|
||||
|
||||
/** Gerar uma classe que facilita a gestão de rotas com a tipagem das querys
|
||||
*
|
||||
* Definições:
|
||||
*
|
||||
* caminho = "/aplicacao/funcionalidade"
|
||||
*
|
||||
* endereco = "http://localhost:3000/aplicacao/funcionalidade"
|
||||
*
|
||||
* parametros = {nome:"José"}
|
||||
*/
|
||||
declare class TipagemRotas<T extends {
|
||||
[q: string]: any;
|
||||
}> {
|
||||
_partesCaminho: string[];
|
||||
_acaoIr?: (endereco: string) => undefined;
|
||||
rotulo: string | undefined;
|
||||
/** Ao criar novo obijeto de tipagem de rota é necessário passar o caminho parcial
|
||||
** export const mCaminho = new TipagemRotas<{q:string}>("aplicacao","funcionalidade")
|
||||
*/
|
||||
constructor({ caminho, acaoIr, rotulo, }: {
|
||||
caminho: (string | null | undefined)[] | string;
|
||||
acaoIr?: undefined | ((endereco: string) => undefined);
|
||||
/** Rotulo da página
|
||||
* Inicio | Controle
|
||||
*/
|
||||
rotulo?: string;
|
||||
});
|
||||
/** Retorna o caminho completo da rota
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/caminho"
|
||||
*/
|
||||
get caminho(): string;
|
||||
/** Define o caminho completo da rota
|
||||
** mCaminho.caminho = "/novoCaminho"
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/novoCaminho"
|
||||
** */
|
||||
set caminho(caminhoParcial: string);
|
||||
/** Retorna o caminho completo da rota com a query
|
||||
** console.log(mCaminho.resolve({q:"query"}))
|
||||
** "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
endereco(query: T, usarComoHash?: boolean): string;
|
||||
/** Vai para a url
|
||||
** mCaminho.ir({q:"query"})
|
||||
** window.location.href = "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
ir(query: T): void;
|
||||
/** Retorna os parametros da url
|
||||
** console.log(mCaminho.parametros())
|
||||
** {q:"query"}
|
||||
*/
|
||||
parametros(urlEntrada?: string): Partial<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Essa variável se conecta a tabela_lidades
|
||||
*
|
||||
* onde sigla se conecta com sigla
|
||||
*
|
||||
* Usuário terá mais opções de unidades, quando fazer o envio para o mtr, usar a opção fornecida pelo usuarios, caso não tenha
|
||||
* usar a normalizada
|
||||
*/
|
||||
declare enum siglas_unidades_medida {
|
||||
UN = "UN",
|
||||
KG = "KG",
|
||||
TON = "TON",
|
||||
g = "g",
|
||||
"M³" = "M\u00B3",
|
||||
Lt = "Lt"
|
||||
}
|
||||
declare const unidades_medida: {
|
||||
sigla_unidade: keyof typeof siglas_unidades_medida;
|
||||
nome: string;
|
||||
sigla_normalizada: keyof typeof siglas_unidades_medida;
|
||||
normalizar: (valor: number) => number;
|
||||
tipo: "massa" | "volume" | "comprimento" | "unidade";
|
||||
}[];
|
||||
|
||||
/**
|
||||
* Valida se uma string é um UUID válido (qualquer versão).
|
||||
*
|
||||
* @param valor - A string que será validada.
|
||||
* @returns booleano indicando se é um UUID válido.
|
||||
*/
|
||||
declare const erUuid: RegExp;
|
||||
declare const validarUuid: (uuid: string | number | undefined | null) => boolean;
|
||||
/**
|
||||
* Gera um UUID determinístico (versão 3) com base em uma chave e um grupo (namespace).
|
||||
*
|
||||
* - Usa o algoritmo MD5 (RFC 4122).
|
||||
* - Sempre retorna o mesmo UUID para a mesma combinação chave + grupo.
|
||||
* - Caso o grupo não seja informado, usa o UUID "nil" como namespace.
|
||||
*
|
||||
* @param chave - Qualquer valor que será convertido em string para gerar o UUID (ex: número, string ou objeto).
|
||||
* @param grupo - Opcional. Namespace para separar domínios diferentes de UUIDs.
|
||||
* @returns UUID v3 (determinístico)
|
||||
*/
|
||||
declare const uuidV3: (chave: any, grupo?: any) => string;
|
||||
/**
|
||||
* Gera um UUID v4 (aleatório, não determinístico).
|
||||
*
|
||||
* - Usado quando unicidade é necessária, mas não se exige que seja previsível.
|
||||
*/
|
||||
declare const uuidV4: typeof v4;
|
||||
/**
|
||||
* @deprecated Esta variável será descontinuada em versões futuras.
|
||||
* Use a função `uuidV4()` diretamente.
|
||||
*/
|
||||
declare const uuid: typeof v4;
|
||||
|
||||
declare const esperar: (ms: number) => Promise<true>;
|
||||
/**
|
||||
* Usado para retronat o no de uma variável, deve ser usado dentro de um objeto
|
||||
* const nomex = {a: 1, b: 2}
|
||||
* nomeVariavel({nomex}) // retorna "nomex"
|
||||
* @param v
|
||||
* @returns
|
||||
*/
|
||||
declare const nomeVariavel: (v: {
|
||||
[key: string]: any;
|
||||
}) => string;
|
||||
|
||||
export { TipagemRotas, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, cdn_carro_de_boi, dayjsbr, defineCwd, erUuid, esperar, extensoes, graficos_pilao, localValor, logger, nomeVariavel, objetoPg, operadores, paraObjetoRegistroPg, pgObjeto, postLogger, siglas_unidades_medida, texto_busca, tipoArquivo, tipoUsuarioResiduos, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zOperadores };
|
||||
export type { TipoLoggerSessao, interfaceConsulta, tipoFiltro, tipoLogger, tipoLoggerLog, tipoLokiObjeto };
|
||||
315
dist/index.d.mts
vendored
315
dist/index.d.mts
vendored
|
|
@ -1,315 +0,0 @@
|
|||
import z from 'zod';
|
||||
import dayjs from 'dayjs';
|
||||
export { ManipulateType } from 'dayjs';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
declare const aleatorio: (tamanho?: number) => string;
|
||||
|
||||
/** gerar uma função de cache para uso em memoria */
|
||||
declare const cacheM: <T>(chave: any, valor?: T, validadeSeg?: number) => T | undefined;
|
||||
declare const verCacheM: () => {
|
||||
[k: string]: {
|
||||
/** new Date().getTime() */
|
||||
validade?: number | undefined;
|
||||
valor: any;
|
||||
} | undefined;
|
||||
};
|
||||
declare const cacheMemoria: <T>(chave: any, valor?: T, validadeSeg?: number) => T | undefined;
|
||||
/** para uso fixo dentro de uma função, trava a chave */
|
||||
declare const cacheMFixo: (chave: any) => <T>(valor?: T) => T | undefined;
|
||||
|
||||
declare const uuid_null = "00000000-0000-0000-0000-000000000000";
|
||||
/** Colunas Presentes n maioria das tabelas */
|
||||
declare enum camposComuns {
|
||||
codigo = "codigo",
|
||||
excluido = "excluido",
|
||||
data_hora_criacao = "data_hora_criacao",
|
||||
data_hora_atualizacao = "data_hora_atualizacao",
|
||||
codigo_usuario_criacao = "codigo_usuario_criacao",
|
||||
codigo_usuario_atualizacao = "codigo_usuario_atualizacao",
|
||||
versao = "versao"
|
||||
}
|
||||
/** Palavras comumente usadas */
|
||||
declare enum tx {
|
||||
token = "token"
|
||||
}
|
||||
declare enum tipoUsuarioResiduos {
|
||||
Usuario = "usuario",
|
||||
Fornecedor = "fornecedor"
|
||||
}
|
||||
|
||||
declare enum operadores {
|
||||
"=" = "=",
|
||||
"!=" = "!=",
|
||||
">" = ">",
|
||||
">=" = ">=",
|
||||
"<" = "<",
|
||||
"<=" = "<=",
|
||||
like = "like",
|
||||
in = "in"
|
||||
}
|
||||
type tipoFiltro = {
|
||||
coluna: string;
|
||||
valor: any;
|
||||
operador: keyof typeof operadores | operadores;
|
||||
ou?: boolean;
|
||||
};
|
||||
type interfaceConsulta = {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
filtros?: tipoFiltro[];
|
||||
ordem?: string;
|
||||
ordemTipo?: "asc" | "desc";
|
||||
colunas?: string[];
|
||||
apenasConsulta?: boolean;
|
||||
apenasContagem?: boolean;
|
||||
};
|
||||
declare const zOperadores: z.ZodEnum<{
|
||||
"=": "=";
|
||||
"!=": "!=";
|
||||
">": ">";
|
||||
">=": ">=";
|
||||
"<": "<";
|
||||
"<=": "<=";
|
||||
like: "like";
|
||||
in: "in";
|
||||
}>;
|
||||
declare const zFiltro: z.ZodObject<{
|
||||
coluna: z.ZodString;
|
||||
valor: z.ZodAny;
|
||||
operador: z.ZodEnum<{
|
||||
"=": "=";
|
||||
"!=": "!=";
|
||||
">": ">";
|
||||
">=": ">=";
|
||||
"<": "<";
|
||||
"<=": "<=";
|
||||
like: "like";
|
||||
in: "in";
|
||||
}>;
|
||||
ou: z.ZodOptional<z.ZodBoolean>;
|
||||
}, z.core.$strip>;
|
||||
|
||||
declare const dayjsbr: typeof dayjs;
|
||||
|
||||
declare const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
|
||||
|
||||
type tiposArquivo = "imagem" | "documento" | "vídeo" | "outros";
|
||||
declare const extensoes: {
|
||||
ext: string;
|
||||
tipo: tiposArquivo;
|
||||
mime: string;
|
||||
}[];
|
||||
/**
|
||||
* Função que retorna o tipo do arquivo
|
||||
* @param nomeArquivo
|
||||
* @returns
|
||||
*/
|
||||
declare const tipoArquivo: (nomeArquivo: string | null | undefined) => tiposArquivo;
|
||||
|
||||
declare const graficos_pilao: {
|
||||
[k: string]: {
|
||||
grafico: string;
|
||||
titulo: string;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* LocalStorage Tipado
|
||||
* Lê ou grava um valor no localStorage, mantendo o tipo genérico <T>.
|
||||
*/
|
||||
declare const localValor: <T>(chave_: string | any, valor?: T | null) => T | null;
|
||||
|
||||
type tipoLokiObjeto = {
|
||||
streams: {
|
||||
stream: {
|
||||
[k: string]: string;
|
||||
};
|
||||
values: [string, string][];
|
||||
}[];
|
||||
};
|
||||
declare const postLogger: ({ objeto, }: {
|
||||
objeto: tipoLokiObjeto;
|
||||
}) => Promise<[objeto: tipoLokiObjeto, erro?: string]>;
|
||||
/** define a localização da pasta do projeto */
|
||||
declare const defineCwd: (novoCwd: string) => void;
|
||||
type tipoLevel = "info" | "warn" | "error";
|
||||
type tipoOpSessao = {
|
||||
inquilino: string;
|
||||
usuario: string;
|
||||
parametros?: {
|
||||
[k: string]: string;
|
||||
};
|
||||
};
|
||||
type tipoLog = {
|
||||
detalhes?: unknown[];
|
||||
__filename?: string;
|
||||
local?: string;
|
||||
parametros?: {
|
||||
[k: string]: string;
|
||||
};
|
||||
};
|
||||
type tipoLoggerLog = (level: tipoLevel, mensagem: string, op_tipoLog?: tipoLog) => Promise<[objeto: tipoLokiObjeto, erro?: string]>;
|
||||
type TipoLoggerSessao = (sess: tipoOpSessao) => tipoLoggerLog;
|
||||
type tipoLogger = (amb: {
|
||||
app: string;
|
||||
eProducao: boolean;
|
||||
parametros?: {
|
||||
[k: string]: string;
|
||||
};
|
||||
}) => TipoLoggerSessao;
|
||||
declare const logger: tipoLogger;
|
||||
|
||||
/**
|
||||
* Trata um objeto para ser imput para postgres
|
||||
* @param entrada
|
||||
* @returns
|
||||
*/
|
||||
declare const paraObjetoRegistroPg: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
declare const pgObjeto: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
declare const objetoPg: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
|
||||
declare const umaFuncao: () => string;
|
||||
|
||||
declare const umaVariavel = "Ol\u00E1 Mundo! (vari\u00E1vel)";
|
||||
|
||||
/** gerar o texto de busca removendo caracteres especies e caixa alta */
|
||||
declare const texto_busca: (...texto: any[]) => string;
|
||||
|
||||
/** Gerar uma classe que facilita a gestão de rotas com a tipagem das querys
|
||||
*
|
||||
* Definições:
|
||||
*
|
||||
* caminho = "/aplicacao/funcionalidade"
|
||||
*
|
||||
* endereco = "http://localhost:3000/aplicacao/funcionalidade"
|
||||
*
|
||||
* parametros = {nome:"José"}
|
||||
*/
|
||||
declare class TipagemRotas<T extends {
|
||||
[q: string]: any;
|
||||
}> {
|
||||
_partesCaminho: string[];
|
||||
_acaoIr?: (endereco: string) => undefined;
|
||||
rotulo: string | undefined;
|
||||
/** Ao criar novo obijeto de tipagem de rota é necessário passar o caminho parcial
|
||||
** export const mCaminho = new TipagemRotas<{q:string}>("aplicacao","funcionalidade")
|
||||
*/
|
||||
constructor({ caminho, acaoIr, rotulo, }: {
|
||||
caminho: (string | null | undefined)[] | string;
|
||||
acaoIr?: undefined | ((endereco: string) => undefined);
|
||||
/** Rotulo da página
|
||||
* Inicio | Controle
|
||||
*/
|
||||
rotulo?: string;
|
||||
});
|
||||
/** Retorna o caminho completo da rota
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/caminho"
|
||||
*/
|
||||
get caminho(): string;
|
||||
/** Define o caminho completo da rota
|
||||
** mCaminho.caminho = "/novoCaminho"
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/novoCaminho"
|
||||
** */
|
||||
set caminho(caminhoParcial: string);
|
||||
/** Retorna o caminho completo da rota com a query
|
||||
** console.log(mCaminho.resolve({q:"query"}))
|
||||
** "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
endereco(query: T, usarComoHash?: boolean): string;
|
||||
/** Vai para a url
|
||||
** mCaminho.ir({q:"query"})
|
||||
** window.location.href = "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
ir(query: T): void;
|
||||
/** Retorna os parametros da url
|
||||
** console.log(mCaminho.parametros())
|
||||
** {q:"query"}
|
||||
*/
|
||||
parametros(urlEntrada?: string): Partial<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Essa variável se conecta a tabela_lidades
|
||||
*
|
||||
* onde sigla se conecta com sigla
|
||||
*
|
||||
* Usuário terá mais opções de unidades, quando fazer o envio para o mtr, usar a opção fornecida pelo usuarios, caso não tenha
|
||||
* usar a normalizada
|
||||
*/
|
||||
declare enum siglas_unidades_medida {
|
||||
UN = "UN",
|
||||
KG = "KG",
|
||||
TON = "TON",
|
||||
g = "g",
|
||||
"M³" = "M\u00B3",
|
||||
Lt = "Lt"
|
||||
}
|
||||
declare const unidades_medida: {
|
||||
sigla_unidade: keyof typeof siglas_unidades_medida;
|
||||
nome: string;
|
||||
sigla_normalizada: keyof typeof siglas_unidades_medida;
|
||||
normalizar: (valor: number) => number;
|
||||
tipo: "massa" | "volume" | "comprimento" | "unidade";
|
||||
}[];
|
||||
|
||||
/**
|
||||
* Valida se uma string é um UUID válido (qualquer versão).
|
||||
*
|
||||
* @param valor - A string que será validada.
|
||||
* @returns booleano indicando se é um UUID válido.
|
||||
*/
|
||||
declare const erUuid: RegExp;
|
||||
declare const validarUuid: (uuid: string | number | undefined | null) => boolean;
|
||||
/**
|
||||
* Gera um UUID determinístico (versão 3) com base em uma chave e um grupo (namespace).
|
||||
*
|
||||
* - Usa o algoritmo MD5 (RFC 4122).
|
||||
* - Sempre retorna o mesmo UUID para a mesma combinação chave + grupo.
|
||||
* - Caso o grupo não seja informado, usa o UUID "nil" como namespace.
|
||||
*
|
||||
* @param chave - Qualquer valor que será convertido em string para gerar o UUID (ex: número, string ou objeto).
|
||||
* @param grupo - Opcional. Namespace para separar domínios diferentes de UUIDs.
|
||||
* @returns UUID v3 (determinístico)
|
||||
*/
|
||||
declare const uuidV3: (chave: any, grupo?: any) => string;
|
||||
/**
|
||||
* Gera um UUID v4 (aleatório, não determinístico).
|
||||
*
|
||||
* - Usado quando unicidade é necessária, mas não se exige que seja previsível.
|
||||
*/
|
||||
declare const uuidV4: typeof v4;
|
||||
/**
|
||||
* @deprecated Esta variável será descontinuada em versões futuras.
|
||||
* Use a função `uuidV4()` diretamente.
|
||||
*/
|
||||
declare const uuid: typeof v4;
|
||||
|
||||
declare const esperar: (ms: number) => Promise<true>;
|
||||
/**
|
||||
* Usado para retronat o no de uma variável, deve ser usado dentro de um objeto
|
||||
* const nomex = {a: 1, b: 2}
|
||||
* nomeVariavel({nomex}) // retorna "nomex"
|
||||
* @param v
|
||||
* @returns
|
||||
*/
|
||||
declare const nomeVariavel: (v: {
|
||||
[key: string]: any;
|
||||
}) => string;
|
||||
|
||||
export { TipagemRotas, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, cdn_carro_de_boi, dayjsbr, defineCwd, erUuid, esperar, extensoes, graficos_pilao, localValor, logger, nomeVariavel, objetoPg, operadores, paraObjetoRegistroPg, pgObjeto, postLogger, siglas_unidades_medida, texto_busca, tipoArquivo, tipoUsuarioResiduos, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zOperadores };
|
||||
export type { TipoLoggerSessao, interfaceConsulta, tipoFiltro, tipoLogger, tipoLoggerLog, tipoLokiObjeto };
|
||||
315
dist/index.d.ts
vendored
315
dist/index.d.ts
vendored
|
|
@ -1,315 +0,0 @@
|
|||
import z from 'zod';
|
||||
import dayjs from 'dayjs';
|
||||
export { ManipulateType } from 'dayjs';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
declare const aleatorio: (tamanho?: number) => string;
|
||||
|
||||
/** gerar uma função de cache para uso em memoria */
|
||||
declare const cacheM: <T>(chave: any, valor?: T, validadeSeg?: number) => T | undefined;
|
||||
declare const verCacheM: () => {
|
||||
[k: string]: {
|
||||
/** new Date().getTime() */
|
||||
validade?: number | undefined;
|
||||
valor: any;
|
||||
} | undefined;
|
||||
};
|
||||
declare const cacheMemoria: <T>(chave: any, valor?: T, validadeSeg?: number) => T | undefined;
|
||||
/** para uso fixo dentro de uma função, trava a chave */
|
||||
declare const cacheMFixo: (chave: any) => <T>(valor?: T) => T | undefined;
|
||||
|
||||
declare const uuid_null = "00000000-0000-0000-0000-000000000000";
|
||||
/** Colunas Presentes n maioria das tabelas */
|
||||
declare enum camposComuns {
|
||||
codigo = "codigo",
|
||||
excluido = "excluido",
|
||||
data_hora_criacao = "data_hora_criacao",
|
||||
data_hora_atualizacao = "data_hora_atualizacao",
|
||||
codigo_usuario_criacao = "codigo_usuario_criacao",
|
||||
codigo_usuario_atualizacao = "codigo_usuario_atualizacao",
|
||||
versao = "versao"
|
||||
}
|
||||
/** Palavras comumente usadas */
|
||||
declare enum tx {
|
||||
token = "token"
|
||||
}
|
||||
declare enum tipoUsuarioResiduos {
|
||||
Usuario = "usuario",
|
||||
Fornecedor = "fornecedor"
|
||||
}
|
||||
|
||||
declare enum operadores {
|
||||
"=" = "=",
|
||||
"!=" = "!=",
|
||||
">" = ">",
|
||||
">=" = ">=",
|
||||
"<" = "<",
|
||||
"<=" = "<=",
|
||||
like = "like",
|
||||
in = "in"
|
||||
}
|
||||
type tipoFiltro = {
|
||||
coluna: string;
|
||||
valor: any;
|
||||
operador: keyof typeof operadores | operadores;
|
||||
ou?: boolean;
|
||||
};
|
||||
type interfaceConsulta = {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
filtros?: tipoFiltro[];
|
||||
ordem?: string;
|
||||
ordemTipo?: "asc" | "desc";
|
||||
colunas?: string[];
|
||||
apenasConsulta?: boolean;
|
||||
apenasContagem?: boolean;
|
||||
};
|
||||
declare const zOperadores: z.ZodEnum<{
|
||||
"=": "=";
|
||||
"!=": "!=";
|
||||
">": ">";
|
||||
">=": ">=";
|
||||
"<": "<";
|
||||
"<=": "<=";
|
||||
like: "like";
|
||||
in: "in";
|
||||
}>;
|
||||
declare const zFiltro: z.ZodObject<{
|
||||
coluna: z.ZodString;
|
||||
valor: z.ZodAny;
|
||||
operador: z.ZodEnum<{
|
||||
"=": "=";
|
||||
"!=": "!=";
|
||||
">": ">";
|
||||
">=": ">=";
|
||||
"<": "<";
|
||||
"<=": "<=";
|
||||
like: "like";
|
||||
in: "in";
|
||||
}>;
|
||||
ou: z.ZodOptional<z.ZodBoolean>;
|
||||
}, z.core.$strip>;
|
||||
|
||||
declare const dayjsbr: typeof dayjs;
|
||||
|
||||
declare const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
|
||||
|
||||
type tiposArquivo = "imagem" | "documento" | "vídeo" | "outros";
|
||||
declare const extensoes: {
|
||||
ext: string;
|
||||
tipo: tiposArquivo;
|
||||
mime: string;
|
||||
}[];
|
||||
/**
|
||||
* Função que retorna o tipo do arquivo
|
||||
* @param nomeArquivo
|
||||
* @returns
|
||||
*/
|
||||
declare const tipoArquivo: (nomeArquivo: string | null | undefined) => tiposArquivo;
|
||||
|
||||
declare const graficos_pilao: {
|
||||
[k: string]: {
|
||||
grafico: string;
|
||||
titulo: string;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* LocalStorage Tipado
|
||||
* Lê ou grava um valor no localStorage, mantendo o tipo genérico <T>.
|
||||
*/
|
||||
declare const localValor: <T>(chave_: string | any, valor?: T | null) => T | null;
|
||||
|
||||
type tipoLokiObjeto = {
|
||||
streams: {
|
||||
stream: {
|
||||
[k: string]: string;
|
||||
};
|
||||
values: [string, string][];
|
||||
}[];
|
||||
};
|
||||
declare const postLogger: ({ objeto, }: {
|
||||
objeto: tipoLokiObjeto;
|
||||
}) => Promise<[objeto: tipoLokiObjeto, erro?: string]>;
|
||||
/** define a localização da pasta do projeto */
|
||||
declare const defineCwd: (novoCwd: string) => void;
|
||||
type tipoLevel = "info" | "warn" | "error";
|
||||
type tipoOpSessao = {
|
||||
inquilino: string;
|
||||
usuario: string;
|
||||
parametros?: {
|
||||
[k: string]: string;
|
||||
};
|
||||
};
|
||||
type tipoLog = {
|
||||
detalhes?: unknown[];
|
||||
__filename?: string;
|
||||
local?: string;
|
||||
parametros?: {
|
||||
[k: string]: string;
|
||||
};
|
||||
};
|
||||
type tipoLoggerLog = (level: tipoLevel, mensagem: string, op_tipoLog?: tipoLog) => Promise<[objeto: tipoLokiObjeto, erro?: string]>;
|
||||
type TipoLoggerSessao = (sess: tipoOpSessao) => tipoLoggerLog;
|
||||
type tipoLogger = (amb: {
|
||||
app: string;
|
||||
eProducao: boolean;
|
||||
parametros?: {
|
||||
[k: string]: string;
|
||||
};
|
||||
}) => TipoLoggerSessao;
|
||||
declare const logger: tipoLogger;
|
||||
|
||||
/**
|
||||
* Trata um objeto para ser imput para postgres
|
||||
* @param entrada
|
||||
* @returns
|
||||
*/
|
||||
declare const paraObjetoRegistroPg: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
declare const pgObjeto: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
declare const objetoPg: (entrada: {
|
||||
[k: string]: any;
|
||||
}) => {
|
||||
[k: string]: string | boolean | null | undefined | number;
|
||||
};
|
||||
|
||||
declare const umaFuncao: () => string;
|
||||
|
||||
declare const umaVariavel = "Ol\u00E1 Mundo! (vari\u00E1vel)";
|
||||
|
||||
/** gerar o texto de busca removendo caracteres especies e caixa alta */
|
||||
declare const texto_busca: (...texto: any[]) => string;
|
||||
|
||||
/** Gerar uma classe que facilita a gestão de rotas com a tipagem das querys
|
||||
*
|
||||
* Definições:
|
||||
*
|
||||
* caminho = "/aplicacao/funcionalidade"
|
||||
*
|
||||
* endereco = "http://localhost:3000/aplicacao/funcionalidade"
|
||||
*
|
||||
* parametros = {nome:"José"}
|
||||
*/
|
||||
declare class TipagemRotas<T extends {
|
||||
[q: string]: any;
|
||||
}> {
|
||||
_partesCaminho: string[];
|
||||
_acaoIr?: (endereco: string) => undefined;
|
||||
rotulo: string | undefined;
|
||||
/** Ao criar novo obijeto de tipagem de rota é necessário passar o caminho parcial
|
||||
** export const mCaminho = new TipagemRotas<{q:string}>("aplicacao","funcionalidade")
|
||||
*/
|
||||
constructor({ caminho, acaoIr, rotulo, }: {
|
||||
caminho: (string | null | undefined)[] | string;
|
||||
acaoIr?: undefined | ((endereco: string) => undefined);
|
||||
/** Rotulo da página
|
||||
* Inicio | Controle
|
||||
*/
|
||||
rotulo?: string;
|
||||
});
|
||||
/** Retorna o caminho completo da rota
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/caminho"
|
||||
*/
|
||||
get caminho(): string;
|
||||
/** Define o caminho completo da rota
|
||||
** mCaminho.caminho = "/novoCaminho"
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/novoCaminho"
|
||||
** */
|
||||
set caminho(caminhoParcial: string);
|
||||
/** Retorna o caminho completo da rota com a query
|
||||
** console.log(mCaminho.resolve({q:"query"}))
|
||||
** "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
endereco(query: T, usarComoHash?: boolean): string;
|
||||
/** Vai para a url
|
||||
** mCaminho.ir({q:"query"})
|
||||
** window.location.href = "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
ir(query: T): void;
|
||||
/** Retorna os parametros da url
|
||||
** console.log(mCaminho.parametros())
|
||||
** {q:"query"}
|
||||
*/
|
||||
parametros(urlEntrada?: string): Partial<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Essa variável se conecta a tabela_lidades
|
||||
*
|
||||
* onde sigla se conecta com sigla
|
||||
*
|
||||
* Usuário terá mais opções de unidades, quando fazer o envio para o mtr, usar a opção fornecida pelo usuarios, caso não tenha
|
||||
* usar a normalizada
|
||||
*/
|
||||
declare enum siglas_unidades_medida {
|
||||
UN = "UN",
|
||||
KG = "KG",
|
||||
TON = "TON",
|
||||
g = "g",
|
||||
"M³" = "M\u00B3",
|
||||
Lt = "Lt"
|
||||
}
|
||||
declare const unidades_medida: {
|
||||
sigla_unidade: keyof typeof siglas_unidades_medida;
|
||||
nome: string;
|
||||
sigla_normalizada: keyof typeof siglas_unidades_medida;
|
||||
normalizar: (valor: number) => number;
|
||||
tipo: "massa" | "volume" | "comprimento" | "unidade";
|
||||
}[];
|
||||
|
||||
/**
|
||||
* Valida se uma string é um UUID válido (qualquer versão).
|
||||
*
|
||||
* @param valor - A string que será validada.
|
||||
* @returns booleano indicando se é um UUID válido.
|
||||
*/
|
||||
declare const erUuid: RegExp;
|
||||
declare const validarUuid: (uuid: string | number | undefined | null) => boolean;
|
||||
/**
|
||||
* Gera um UUID determinístico (versão 3) com base em uma chave e um grupo (namespace).
|
||||
*
|
||||
* - Usa o algoritmo MD5 (RFC 4122).
|
||||
* - Sempre retorna o mesmo UUID para a mesma combinação chave + grupo.
|
||||
* - Caso o grupo não seja informado, usa o UUID "nil" como namespace.
|
||||
*
|
||||
* @param chave - Qualquer valor que será convertido em string para gerar o UUID (ex: número, string ou objeto).
|
||||
* @param grupo - Opcional. Namespace para separar domínios diferentes de UUIDs.
|
||||
* @returns UUID v3 (determinístico)
|
||||
*/
|
||||
declare const uuidV3: (chave: any, grupo?: any) => string;
|
||||
/**
|
||||
* Gera um UUID v4 (aleatório, não determinístico).
|
||||
*
|
||||
* - Usado quando unicidade é necessária, mas não se exige que seja previsível.
|
||||
*/
|
||||
declare const uuidV4: typeof v4;
|
||||
/**
|
||||
* @deprecated Esta variável será descontinuada em versões futuras.
|
||||
* Use a função `uuidV4()` diretamente.
|
||||
*/
|
||||
declare const uuid: typeof v4;
|
||||
|
||||
declare const esperar: (ms: number) => Promise<true>;
|
||||
/**
|
||||
* Usado para retronat o no de uma variável, deve ser usado dentro de um objeto
|
||||
* const nomex = {a: 1, b: 2}
|
||||
* nomeVariavel({nomex}) // retorna "nomex"
|
||||
* @param v
|
||||
* @returns
|
||||
*/
|
||||
declare const nomeVariavel: (v: {
|
||||
[key: string]: any;
|
||||
}) => string;
|
||||
|
||||
export { TipagemRotas, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, cdn_carro_de_boi, dayjsbr, defineCwd, erUuid, esperar, extensoes, graficos_pilao, localValor, logger, nomeVariavel, objetoPg, operadores, paraObjetoRegistroPg, pgObjeto, postLogger, siglas_unidades_medida, texto_busca, tipoArquivo, tipoUsuarioResiduos, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zOperadores };
|
||||
export type { TipoLoggerSessao, interfaceConsulta, tipoFiltro, tipoLogger, tipoLoggerLog, tipoLokiObjeto };
|
||||
548
dist/index.mjs
vendored
548
dist/index.mjs
vendored
|
|
@ -1,548 +0,0 @@
|
|||
import z from 'zod';
|
||||
import dayjs from 'dayjs';
|
||||
import duration from 'dayjs/plugin/duration.js';
|
||||
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter.js';
|
||||
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore.js';
|
||||
import minMax from 'dayjs/plugin/minMax.js';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime.js';
|
||||
import timezone from 'dayjs/plugin/timezone.js';
|
||||
import utc from 'dayjs/plugin/utc.js';
|
||||
import weekOfYear from 'dayjs/plugin/weekOfYear.js';
|
||||
import 'dayjs/locale/pt-br.js';
|
||||
import crossFetch from 'cross-fetch';
|
||||
import { v4, v3, NIL } from 'uuid';
|
||||
|
||||
const alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
||||
const aleatorio = (tamanho) => `eli-${Array.from({ length: tamanho || 8 }).map(() => alfabeto[(999 * Math.random() | 0) % alfabeto.length]).join("")}`;
|
||||
|
||||
const _cache = {};
|
||||
globalThis.cacheMemoria_cache = _cache;
|
||||
const cacheM = (chave, valor, validadeSeg) => {
|
||||
const txChave = typeof chave == "string" ? chave : typeof chave == "number" ? String(chave) : encodeURIComponent(JSON.stringify(chave));
|
||||
const validade = validadeSeg && (/* @__PURE__ */ new Date()).getTime() + validadeSeg * 1e3;
|
||||
if (valor !== void 0) {
|
||||
_cache[txChave] = {
|
||||
valor,
|
||||
validade
|
||||
};
|
||||
}
|
||||
const busca = _cache[txChave];
|
||||
if (busca?.validade && busca.validade < (/* @__PURE__ */ new Date()).getTime()) {
|
||||
return void 0;
|
||||
}
|
||||
return busca?.valor;
|
||||
};
|
||||
const verCacheM = () => _cache;
|
||||
const cacheMemoria = cacheM;
|
||||
const cacheMFixo = (chave) => (valor) => cacheM(chave, valor);
|
||||
|
||||
const uuid_null = "00000000-0000-0000-0000-000000000000";
|
||||
var camposComuns = /* @__PURE__ */ ((camposComuns2) => {
|
||||
camposComuns2["codigo"] = "codigo";
|
||||
camposComuns2["excluido"] = "excluido";
|
||||
camposComuns2["data_hora_criacao"] = "data_hora_criacao";
|
||||
camposComuns2["data_hora_atualizacao"] = "data_hora_atualizacao";
|
||||
camposComuns2["codigo_usuario_criacao"] = "codigo_usuario_criacao";
|
||||
camposComuns2["codigo_usuario_atualizacao"] = "codigo_usuario_atualizacao";
|
||||
camposComuns2["versao"] = "versao";
|
||||
return camposComuns2;
|
||||
})(camposComuns || {});
|
||||
var tx = /* @__PURE__ */ ((tx2) => {
|
||||
tx2["token"] = "token";
|
||||
return tx2;
|
||||
})(tx || {});
|
||||
var tipoUsuarioResiduos = /* @__PURE__ */ ((tipoUsuarioResiduos2) => {
|
||||
tipoUsuarioResiduos2["Usuario"] = "usuario";
|
||||
tipoUsuarioResiduos2["Fornecedor"] = "fornecedor";
|
||||
return tipoUsuarioResiduos2;
|
||||
})(tipoUsuarioResiduos || {});
|
||||
|
||||
var operadores = /* @__PURE__ */ ((operadores2) => {
|
||||
operadores2["="] = "=";
|
||||
operadores2["!="] = "!=";
|
||||
operadores2[">"] = ">";
|
||||
operadores2[">="] = ">=";
|
||||
operadores2["<"] = "<";
|
||||
operadores2["<="] = "<=";
|
||||
operadores2["like"] = "like";
|
||||
operadores2["in"] = "in";
|
||||
return operadores2;
|
||||
})(operadores || {});
|
||||
const zOperadores = z.enum([
|
||||
"=",
|
||||
"!=",
|
||||
">",
|
||||
">=",
|
||||
"<",
|
||||
"<=",
|
||||
"like",
|
||||
"in"
|
||||
]);
|
||||
const zFiltro = z.object({
|
||||
coluna: z.string(),
|
||||
valor: z.any(),
|
||||
operador: zOperadores,
|
||||
ou: z.boolean().optional()
|
||||
});
|
||||
|
||||
dayjs.locale("pt-br");
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
dayjs.extend(weekOfYear);
|
||||
dayjs.extend(isSameOrBefore);
|
||||
dayjs.extend(isSameOrAfter);
|
||||
dayjs.extend(minMax);
|
||||
dayjs.extend(relativeTime);
|
||||
dayjs.extend(duration);
|
||||
const dayjsbr = dayjs;
|
||||
|
||||
const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
|
||||
|
||||
const extensoes = [
|
||||
{
|
||||
ext: "gif",
|
||||
tipo: "imagem",
|
||||
mime: "image/gif"
|
||||
},
|
||||
{
|
||||
ext: "jpg",
|
||||
tipo: "imagem",
|
||||
mime: "image/jpeg"
|
||||
},
|
||||
{
|
||||
ext: "jpeg",
|
||||
tipo: "imagem",
|
||||
mime: "image/jpeg"
|
||||
},
|
||||
{
|
||||
ext: "png",
|
||||
tipo: "imagem",
|
||||
mime: "image/png"
|
||||
},
|
||||
{
|
||||
ext: "bmp",
|
||||
tipo: "imagem",
|
||||
mime: "image/bmp"
|
||||
},
|
||||
{
|
||||
ext: "webp",
|
||||
tipo: "imagem",
|
||||
mime: "image/webp"
|
||||
},
|
||||
{
|
||||
ext: "tiff",
|
||||
tipo: "imagem",
|
||||
mime: "image/tiff"
|
||||
},
|
||||
{
|
||||
ext: "svg",
|
||||
tipo: "imagem",
|
||||
mime: "image/svg+xml"
|
||||
},
|
||||
{
|
||||
ext: "ico",
|
||||
tipo: "imagem",
|
||||
mime: "image/x-icon"
|
||||
},
|
||||
{
|
||||
ext: "pdf",
|
||||
tipo: "documento",
|
||||
mime: "application/pdf"
|
||||
},
|
||||
{
|
||||
ext: "doc",
|
||||
tipo: "documento",
|
||||
mime: "application/msword"
|
||||
},
|
||||
{
|
||||
ext: "docx",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
},
|
||||
{
|
||||
ext: "xls",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.ms-excel"
|
||||
},
|
||||
{
|
||||
ext: "xlsx",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
},
|
||||
{
|
||||
ext: "ppt",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.ms-powerpoint"
|
||||
},
|
||||
{
|
||||
ext: "pptx",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
||||
},
|
||||
{
|
||||
ext: "txt",
|
||||
tipo: "documento",
|
||||
mime: "text/plain"
|
||||
},
|
||||
{
|
||||
ext: "odt",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.oasis.opendocument.text"
|
||||
},
|
||||
{
|
||||
ext: "ods",
|
||||
tipo: "documento",
|
||||
mime: "application/vnd.oasis.opendocument.spreadsheet"
|
||||
},
|
||||
{
|
||||
ext: "rtf",
|
||||
tipo: "documento",
|
||||
mime: "application/rtf"
|
||||
},
|
||||
{
|
||||
ext: "csv",
|
||||
tipo: "documento",
|
||||
mime: "text/csv"
|
||||
},
|
||||
{
|
||||
ext: "mp4",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/mp4"
|
||||
},
|
||||
{
|
||||
ext: "avi",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-msvideo"
|
||||
},
|
||||
{
|
||||
ext: "mkv",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-matroska"
|
||||
},
|
||||
{
|
||||
ext: "mov",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/quicktime"
|
||||
},
|
||||
{
|
||||
ext: "wmv",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-ms-wmv"
|
||||
},
|
||||
{
|
||||
ext: "flv",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/x-flv"
|
||||
},
|
||||
{
|
||||
ext: "webm",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/webm"
|
||||
},
|
||||
{
|
||||
ext: "3gp",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/3gpp"
|
||||
},
|
||||
{
|
||||
ext: "mpeg",
|
||||
tipo: "v\xEDdeo",
|
||||
mime: "video/mpeg"
|
||||
}
|
||||
];
|
||||
const tipoArquivo = (nomeArquivo) => {
|
||||
const extArquivo = String(nomeArquivo || "").toLocaleLowerCase().split(".").pop();
|
||||
const extensao = extensoes.find((extensao2) => extensao2.ext === extArquivo);
|
||||
return extensao?.tipo || "outros";
|
||||
};
|
||||
|
||||
const graficos_pilao = {
|
||||
Condicionantes: {
|
||||
grafico: "condicionantes-criadas",
|
||||
titulo: "Condicionantes Criadas"
|
||||
},
|
||||
Licen\u00E7as: {
|
||||
grafico: "licencas-criadas",
|
||||
titulo: "Licen\xE7as Criadas"
|
||||
}
|
||||
};
|
||||
|
||||
const localValor = (chave_, valor) => {
|
||||
const localStorage = globalThis.localStorage;
|
||||
if (typeof localStorage == "undefined") return null;
|
||||
const chave = typeof chave_ === "string" ? chave_ : encodeURIComponent(JSON.stringify(chave_));
|
||||
try {
|
||||
if (valor !== void 0) {
|
||||
localStorage.setItem(chave, JSON.stringify(valor));
|
||||
}
|
||||
const v2 = localStorage.getItem(chave);
|
||||
if (v2 === null) return null;
|
||||
try {
|
||||
return JSON.parse(v2);
|
||||
} catch {
|
||||
return v2;
|
||||
}
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const esperar = (ms) => new Promise(
|
||||
(resolve) => setTimeout(() => resolve(true), ms)
|
||||
);
|
||||
const nomeVariavel = (v) => Object.keys(v).join("/");
|
||||
|
||||
const LOKI_BASE_URL = "https://log.idz.one";
|
||||
const LOKI_ENDPOINT = "/loki/api/v1/push";
|
||||
const postLogger = async ({
|
||||
objeto
|
||||
}) => {
|
||||
const response = await crossFetch(`${LOKI_BASE_URL}${LOKI_ENDPOINT}`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(objeto)
|
||||
}).catch((a) => a);
|
||||
if (!response.ok) {
|
||||
return [objeto, `Erro ${response.status}: ${await response?.text?.()}`];
|
||||
}
|
||||
return [objeto];
|
||||
};
|
||||
let cwd = "";
|
||||
const defineCwd = (novoCwd) => {
|
||||
cwd = novoCwd;
|
||||
};
|
||||
const logger = ({ app: app_e, eProducao, parametros: parametrosAmbiente }) => ({ inquilino, usuario, parametros: parametrosSessao }) => async (level, mensagem, op_tipoLog) => {
|
||||
let {
|
||||
__filename,
|
||||
detalhes,
|
||||
local,
|
||||
parametros: parametrosLog
|
||||
} = op_tipoLog || {};
|
||||
const app = `${eProducao ? "" : "DEV-"}${app_e}`;
|
||||
if (cwd && __filename) {
|
||||
__filename = __filename.replace(cwd, "");
|
||||
}
|
||||
if (local) {
|
||||
detalhes = [`${nomeVariavel({ local })}="${local}"`, ...detalhes || []];
|
||||
}
|
||||
if (__filename) {
|
||||
detalhes = [
|
||||
`${nomeVariavel({ __filename })}="${__filename}"`,
|
||||
...detalhes || []
|
||||
];
|
||||
}
|
||||
const timestamp = `${Date.now()}000000`;
|
||||
const mainLog = detalhes?.length ? `${mensagem} | ${detalhes.map((d) => JSON.stringify(d)).join(" | ")}` : mensagem;
|
||||
const payload = {
|
||||
stream: {
|
||||
app,
|
||||
inquilino,
|
||||
usuario,
|
||||
level,
|
||||
...parametrosAmbiente || {},
|
||||
...parametrosSessao || {},
|
||||
...parametrosLog || {}
|
||||
},
|
||||
values: [
|
||||
[
|
||||
timestamp,
|
||||
mainLog
|
||||
// Linha de log direta
|
||||
]
|
||||
]
|
||||
};
|
||||
const objeto = { streams: [payload] };
|
||||
const response = await postLogger({ objeto });
|
||||
return response;
|
||||
};
|
||||
|
||||
const paraObjetoRegistroPg = (entrada) => {
|
||||
try {
|
||||
return Object.fromEntries(
|
||||
Object.entries(entrada).map(([k, v]) => [
|
||||
k,
|
||||
v === void 0 || v == null ? v : typeof v == "string" || typeof v == "number" || typeof v == "boolean" ? v : JSON.stringify(v, null, 2)
|
||||
])
|
||||
);
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Erro na fun\xE7\xE3o paraObjetoRegistroPg: ${error.message} ${error.stack}`
|
||||
);
|
||||
}
|
||||
};
|
||||
const pgObjeto = paraObjetoRegistroPg;
|
||||
const objetoPg = paraObjetoRegistroPg;
|
||||
|
||||
const umaFuncao = () => "Ol\xE1 Mundo! (fun\xE7\xE3o)";
|
||||
|
||||
const umaVariavel = "Ol\xE1 Mundo! (vari\xE1vel)";
|
||||
|
||||
const texto_busca = (...texto) => texto.map(
|
||||
(txt) => txt === null || txt === void 0 ? "" : String(txt).normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, " ").toLowerCase()
|
||||
).join(" ");
|
||||
|
||||
class TipagemRotas {
|
||||
_partesCaminho = [];
|
||||
_acaoIr;
|
||||
rotulo;
|
||||
/** Ao criar novo obijeto de tipagem de rota é necessário passar o caminho parcial
|
||||
** export const mCaminho = new TipagemRotas<{q:string}>("aplicacao","funcionalidade")
|
||||
*/
|
||||
constructor({
|
||||
caminho,
|
||||
acaoIr,
|
||||
rotulo
|
||||
}) {
|
||||
this._acaoIr = acaoIr;
|
||||
this._partesCaminho = (Array.isArray(caminho) ? caminho : [caminho]).filter(Boolean).map((a) => String(a)).flatMap((a) => a.split("/")).filter(Boolean);
|
||||
this.rotulo = rotulo;
|
||||
}
|
||||
/** Retorna o caminho completo da rota
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/caminho"
|
||||
*/
|
||||
get caminho() {
|
||||
const ret = `/${this._partesCaminho.join("/")}`;
|
||||
return ret;
|
||||
}
|
||||
/** Define o caminho completo da rota
|
||||
** mCaminho.caminho = "/novoCaminho"
|
||||
** console.log(mCaminho.caminho)
|
||||
** "/novoCaminho"
|
||||
** */
|
||||
set caminho(caminhoParcial) {
|
||||
this._partesCaminho = caminhoParcial.split("/").filter((parte) => parte);
|
||||
}
|
||||
/** Retorna o caminho completo da rota com a query
|
||||
** console.log(mCaminho.resolve({q:"query"}))
|
||||
** "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
endereco(query, usarComoHash) {
|
||||
const url = new URL(
|
||||
typeof window !== "undefined" ? window.location.href : "http://localhost"
|
||||
);
|
||||
url.pathname = this.caminho;
|
||||
url.search = "";
|
||||
const queryKeys = Object.entries(query);
|
||||
for (const [key, value] of queryKeys) {
|
||||
url.searchParams.set(String(key), JSON.stringify(value));
|
||||
}
|
||||
url.hash = "";
|
||||
if (usarComoHash) {
|
||||
url.hash = `#${url.search}`;
|
||||
url.search = "";
|
||||
}
|
||||
return url.href;
|
||||
}
|
||||
/** Vai para a url
|
||||
** mCaminho.ir({q:"query"})
|
||||
** window.location.href = "http://localhost:3000/caminho?q=query"
|
||||
*/
|
||||
ir(query) {
|
||||
if (this._acaoIr) {
|
||||
this._acaoIr(this.endereco({ ...query }));
|
||||
} else {
|
||||
if (typeof window != "undefined") {
|
||||
window.location.href = this.endereco({ ...query });
|
||||
}
|
||||
}
|
||||
}
|
||||
/** Retorna os parametros da url
|
||||
** console.log(mCaminho.parametros())
|
||||
** {q:"query"}
|
||||
*/
|
||||
parametros(urlEntrada) {
|
||||
const url = urlEntrada ? new URL(urlEntrada) : new URL(
|
||||
typeof window !== "undefined" ? window.location.href : "http://localhost"
|
||||
);
|
||||
const query = url.searchParams;
|
||||
let queryObj = Object.fromEntries(query.entries());
|
||||
const hash = url.hash;
|
||||
if (hash) {
|
||||
const hashObj = Object.fromEntries(
|
||||
new URLSearchParams(hash.slice(1)).entries()
|
||||
);
|
||||
queryObj = { ...queryObj, ...hashObj };
|
||||
}
|
||||
for (const chave in queryObj) {
|
||||
try {
|
||||
queryObj[chave] = JSON.parse(queryObj[chave]);
|
||||
} catch {
|
||||
console.log(`[${chave}|${queryObj[chave]}] n\xE3o \xE9 um json v\xE1lido.`);
|
||||
}
|
||||
}
|
||||
return queryObj;
|
||||
}
|
||||
}
|
||||
|
||||
var siglas_unidades_medida = /* @__PURE__ */ ((siglas_unidades_medida2) => {
|
||||
siglas_unidades_medida2["UN"] = "UN";
|
||||
siglas_unidades_medida2["KG"] = "KG";
|
||||
siglas_unidades_medida2["TON"] = "TON";
|
||||
siglas_unidades_medida2["g"] = "g";
|
||||
siglas_unidades_medida2["M\xB3"] = "M\xB3";
|
||||
siglas_unidades_medida2["Lt"] = "Lt";
|
||||
return siglas_unidades_medida2;
|
||||
})(siglas_unidades_medida || {});
|
||||
const unidades_medida = [
|
||||
{
|
||||
sigla_unidade: "KG",
|
||||
nome: "Quilograma",
|
||||
sigla_normalizada: "KG",
|
||||
normalizar: (valor) => valor,
|
||||
tipo: "massa"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "g",
|
||||
nome: "Grama",
|
||||
sigla_normalizada: "KG",
|
||||
normalizar: (valor) => valor / 1e3,
|
||||
tipo: "massa"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "TON",
|
||||
nome: "Tonelada",
|
||||
sigla_normalizada: "KG",
|
||||
normalizar: (valor) => valor * 1e3,
|
||||
tipo: "massa"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "Lt",
|
||||
nome: "Litro",
|
||||
sigla_normalizada: "Lt",
|
||||
normalizar: (valor) => valor,
|
||||
tipo: "volume"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "M\xB3",
|
||||
nome: "Metro C\xFAbico",
|
||||
sigla_normalizada: "Lt",
|
||||
normalizar: (valor) => valor * 1e3,
|
||||
tipo: "volume"
|
||||
},
|
||||
{
|
||||
sigla_unidade: "UN",
|
||||
nome: "Unidade",
|
||||
sigla_normalizada: "UN",
|
||||
normalizar: (valor) => valor,
|
||||
tipo: "unidade"
|
||||
}
|
||||
];
|
||||
|
||||
const erUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
const validarUuid = (uuid2) => {
|
||||
const retorno = erUuid.test(String(uuid2 || ""));
|
||||
return retorno;
|
||||
};
|
||||
const uuidV3 = (chave, grupo) => {
|
||||
return v3(
|
||||
// Converte a chave para string (de forma segura)
|
||||
typeof chave === "string" ? chave : typeof chave === "number" ? String(chave) : JSON.stringify(chave),
|
||||
// Se um grupo foi fornecido, gera um UUID v3 recursivamente com base nele, senão usa NIL
|
||||
grupo ? uuidV3(grupo) : NIL
|
||||
);
|
||||
};
|
||||
const uuidV4 = v4;
|
||||
const uuid = uuidV4;
|
||||
|
||||
export { TipagemRotas, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, cdn_carro_de_boi, dayjsbr, defineCwd, erUuid, esperar, extensoes, graficos_pilao, localValor, logger, nomeVariavel, objetoPg, operadores, paraObjetoRegistroPg, pgObjeto, postLogger, siglas_unidades_medida, texto_busca, tipoArquivo, tipoUsuarioResiduos, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, zOperadores };
|
||||
1
dist/situacoes/index.d.ts
vendored
1
dist/situacoes/index.d.ts
vendored
|
|
@ -1 +0,0 @@
|
|||
export * from "./situacoes";
|
||||
18
dist/situacoes/index.js
vendored
18
dist/situacoes/index.js
vendored
|
|
@ -1,18 +0,0 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./situacoes"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/situacoes/index.js.map
vendored
1
dist/situacoes/index.js.map
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/situacoes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B"}
|
||||
51
dist/situacoes/situacoes.d.ts
vendored
51
dist/situacoes/situacoes.d.ts
vendored
|
|
@ -1,51 +0,0 @@
|
|||
export declare enum tiposSituacoes {
|
||||
vencida = "100_vencida",
|
||||
expirado = "200_expirado",
|
||||
alerta = "300_alerta",
|
||||
protocoladafora = "350_protocoladafora",
|
||||
protocolada = "400_protocolada",
|
||||
protocoladaApenas = "430_protocolada",
|
||||
protocolada_alteracao = "450_protocolada",
|
||||
prazo = "500_prazo",
|
||||
emitida = "515_emitida",
|
||||
valida = "518_valida",
|
||||
novo = "520_novo",
|
||||
recebido = "521_recebido",
|
||||
em_andamento = "530_em_andamento",
|
||||
aguardando = "530_aguardando",
|
||||
aguardandoresposta = "540_aguardandoresposta",
|
||||
suspensaotemporaria = "540_suspensaotemporaria",
|
||||
cancelada = "550_cancelada",
|
||||
execucao = "560_execucao",
|
||||
pendente = "570_pendente",
|
||||
executadafora = "600_executadafora",
|
||||
executada = "700_executada",
|
||||
naoexecutada = "701_naoexecutada",
|
||||
concluida = "730_concluida",
|
||||
respondido_negado = "740_respondido_negado",
|
||||
respondido_aceito = "741_respondido_aceito",
|
||||
atendidoparcial = "742_atendidoparcial",
|
||||
naoatendido = "743_naoatendido",
|
||||
atendido = "744_atendido",
|
||||
renovada = "760_renovada",
|
||||
finalizada = "800_finalizada",
|
||||
emitirnota = "101_emitirnota",
|
||||
faturaatrasada = "301_faturaatrasada",
|
||||
pagarfatura = "302_pagarfatura",
|
||||
aguardandoconfirmacao = "531_aguardandoconfirmacao",
|
||||
agendado = "701_agendado",
|
||||
faturapaga = "801_faturapaga",
|
||||
excluida = "999_excluida",
|
||||
requerida = "401_requerida",
|
||||
vigente = "516_vigente",
|
||||
emrenovacao = "402_emrenovacao",
|
||||
arquivada = "801_arquivada",
|
||||
aguardando_sincronizacao = "999_aguardando_sincronizacao",
|
||||
nao_conforme = "710_nao_conforme",
|
||||
conforme = "720_conforme",
|
||||
nao_aplicavel = "730_nao_aplicavel",
|
||||
parcial = "715_parcial"
|
||||
}
|
||||
export declare const corSituacoes: {
|
||||
[K in keyof typeof tiposSituacoes]?: string;
|
||||
};
|
||||
64
dist/situacoes/situacoes.js
vendored
64
dist/situacoes/situacoes.js
vendored
|
|
@ -1,64 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.corSituacoes = exports.tiposSituacoes = void 0;
|
||||
var tiposSituacoes;
|
||||
(function (tiposSituacoes) {
|
||||
tiposSituacoes["vencida"] = "100_vencida";
|
||||
tiposSituacoes["expirado"] = "200_expirado";
|
||||
tiposSituacoes["alerta"] = "300_alerta";
|
||||
tiposSituacoes["protocoladafora"] = "350_protocoladafora";
|
||||
tiposSituacoes["protocolada"] = "400_protocolada";
|
||||
tiposSituacoes["protocoladaApenas"] = "430_protocolada";
|
||||
tiposSituacoes["protocolada_alteracao"] = "450_protocolada";
|
||||
tiposSituacoes["prazo"] = "500_prazo";
|
||||
tiposSituacoes["emitida"] = "515_emitida";
|
||||
tiposSituacoes["valida"] = "518_valida";
|
||||
tiposSituacoes["novo"] = "520_novo";
|
||||
tiposSituacoes["recebido"] = "521_recebido";
|
||||
tiposSituacoes["em_andamento"] = "530_em_andamento";
|
||||
tiposSituacoes["aguardando"] = "530_aguardando";
|
||||
tiposSituacoes["aguardandoresposta"] = "540_aguardandoresposta";
|
||||
tiposSituacoes["suspensaotemporaria"] = "540_suspensaotemporaria";
|
||||
tiposSituacoes["cancelada"] = "550_cancelada";
|
||||
tiposSituacoes["execucao"] = "560_execucao";
|
||||
tiposSituacoes["pendente"] = "570_pendente";
|
||||
tiposSituacoes["executadafora"] = "600_executadafora";
|
||||
tiposSituacoes["executada"] = "700_executada";
|
||||
tiposSituacoes["naoexecutada"] = "701_naoexecutada";
|
||||
tiposSituacoes["concluida"] = "730_concluida";
|
||||
tiposSituacoes["respondido_negado"] = "740_respondido_negado";
|
||||
tiposSituacoes["respondido_aceito"] = "741_respondido_aceito";
|
||||
tiposSituacoes["atendidoparcial"] = "742_atendidoparcial";
|
||||
tiposSituacoes["naoatendido"] = "743_naoatendido";
|
||||
tiposSituacoes["atendido"] = "744_atendido";
|
||||
tiposSituacoes["renovada"] = "760_renovada";
|
||||
tiposSituacoes["finalizada"] = "800_finalizada";
|
||||
tiposSituacoes["emitirnota"] = "101_emitirnota";
|
||||
tiposSituacoes["faturaatrasada"] = "301_faturaatrasada";
|
||||
tiposSituacoes["pagarfatura"] = "302_pagarfatura";
|
||||
tiposSituacoes["aguardandoconfirmacao"] = "531_aguardandoconfirmacao";
|
||||
tiposSituacoes["agendado"] = "701_agendado";
|
||||
tiposSituacoes["faturapaga"] = "801_faturapaga";
|
||||
tiposSituacoes["excluida"] = "999_excluida";
|
||||
// situacoes outorgas
|
||||
// Requerido
|
||||
// Vigente
|
||||
// Em renovação
|
||||
// Arquivado
|
||||
tiposSituacoes["requerida"] = "401_requerida";
|
||||
tiposSituacoes["vigente"] = "516_vigente";
|
||||
tiposSituacoes["emrenovacao"] = "402_emrenovacao";
|
||||
tiposSituacoes["arquivada"] = "801_arquivada";
|
||||
tiposSituacoes["aguardando_sincronizacao"] = "999_aguardando_sincronizacao";
|
||||
tiposSituacoes["nao_conforme"] = "710_nao_conforme";
|
||||
tiposSituacoes["conforme"] = "720_conforme";
|
||||
tiposSituacoes["nao_aplicavel"] = "730_nao_aplicavel";
|
||||
tiposSituacoes["parcial"] = "715_parcial";
|
||||
})(tiposSituacoes || (exports.tiposSituacoes = tiposSituacoes = {}));
|
||||
exports.corSituacoes = {
|
||||
pendente: "#CCC353",
|
||||
nao_conforme: "#dc3545",
|
||||
conforme: "#28a745",
|
||||
alerta: "#FFDE59",
|
||||
};
|
||||
//# sourceMappingURL=situacoes.js.map
|
||||
1
dist/situacoes/situacoes.js.map
vendored
1
dist/situacoes/situacoes.js.map
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"situacoes.js","sourceRoot":"","sources":["../../src/situacoes/situacoes.ts"],"names":[],"mappings":";;;AAAA,IAAY,cA4DX;AA5DD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,2CAAyB,CAAA;IACzB,uCAAqB,CAAA;IAErB,yDAAuC,CAAA;IACvC,iDAA+B,CAAA;IAC/B,uDAAqC,CAAA;IACrC,2DAAyC,CAAA;IAEzC,qCAAmB,CAAA;IACnB,yCAAuB,CAAA;IACvB,uCAAqB,CAAA;IACrB,mCAAiB,CAAA;IACjB,2CAAyB,CAAA;IACzB,mDAAiC,CAAA;IAEjC,+CAA6B,CAAA;IAC7B,+DAA6C,CAAA;IAC7C,iEAA+C,CAAA;IAC/C,6CAA2B,CAAA;IAC3B,2CAAyB,CAAA;IACzB,2CAAyB,CAAA;IACzB,qDAAmC,CAAA;IACnC,6CAA2B,CAAA;IAC3B,mDAAiC,CAAA;IACjC,6CAA2B,CAAA;IAC3B,6DAA2C,CAAA;IAC3C,6DAA2C,CAAA;IAE3C,yDAAuC,CAAA;IACvC,iDAA+B,CAAA;IAC/B,2CAAyB,CAAA;IAEzB,2CAAyB,CAAA;IACzB,+CAA6B,CAAA;IAC7B,+CAA6B,CAAA;IAC7B,uDAAqC,CAAA;IACrC,iDAA+B,CAAA;IAC/B,qEAAmD,CAAA;IACnD,2CAAyB,CAAA;IACzB,+CAA6B,CAAA;IAC7B,2CAAyB,CAAA;IAEzB,qBAAqB;IACrB,YAAY;IACZ,UAAU;IACV,eAAe;IACf,YAAY;IAEZ,6CAA2B,CAAA;IAC3B,yCAAuB,CAAA;IACvB,iDAA+B,CAAA;IAC/B,6CAA2B,CAAA;IAC3B,2EAAyD,CAAA;IAEzD,mDAAiC,CAAA;IACjC,2CAAyB,CAAA;IACzB,qDAAmC,CAAA;IACnC,yCAAuB,CAAA;AACzB,CAAC,EA5DW,cAAc,8BAAd,cAAc,QA4DzB;AAEY,QAAA,YAAY,GAAoD;IAC3E,QAAQ,EAAE,SAAS;IACnB,YAAY,EAAE,SAAS;IACvB,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,SAAS;CAClB,CAAA"}
|
||||
34
package.json
34
package.json
|
|
@ -1,22 +1,17 @@
|
|||
{
|
||||
"name": "p-comuns",
|
||||
"version": "0.276.0",
|
||||
"version": "0.317.0",
|
||||
"description": "",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"main": "./dist-front/index.mjs",
|
||||
"module": "./dist-front/index.mjs",
|
||||
"types": "./dist-front/index.d.mts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
"types": "./dist-front/index.d.mts",
|
||||
"import": "./dist-front/index.mjs",
|
||||
"require": "./dist-back/index.js"
|
||||
}
|
||||
},
|
||||
"type": "module",
|
||||
|
||||
|
||||
|
||||
|
||||
"scripts": {
|
||||
"biome": "pnpm exec biome check --write",
|
||||
"check": "pnpm run biome && npx tsc --noEmit",
|
||||
|
|
@ -30,14 +25,13 @@
|
|||
"url": "https://e-licencie.com.br"
|
||||
},
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"cross-fetch": "4.1.0",
|
||||
"dayjs": "^1.11.18",
|
||||
"uuid": "^11.1.0",
|
||||
"zod": "4.1.4"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.1.4",
|
||||
"cross-fetch": "4.1.0",
|
||||
"uuid": "^11.1.0",
|
||||
"zod": "4.1.4",
|
||||
"dayjs": "^1.11.18",
|
||||
"@biomejs/biome": "2.4.0",
|
||||
"@types/node": "^20.19.22",
|
||||
"tsup": "8.5.0",
|
||||
"typescript": "~5.9.3",
|
||||
|
|
@ -50,4 +44,4 @@
|
|||
"uuid": "^11.1.0",
|
||||
"zod": "4.1.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
BIN
pacote.tgz
BIN
pacote.tgz
Binary file not shown.
105
pnpm-lock.yaml
generated
Normal file → Executable file
105
pnpm-lock.yaml
generated
Normal file → Executable file
|
|
@ -7,26 +7,19 @@ settings:
|
|||
importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
devDependencies:
|
||||
'@biomejs/biome':
|
||||
specifier: 2.4.0
|
||||
version: 2.4.0
|
||||
'@types/node':
|
||||
specifier: ^20.19.22
|
||||
version: 20.19.22
|
||||
cross-fetch:
|
||||
specifier: 4.1.0
|
||||
version: 4.1.0
|
||||
dayjs:
|
||||
specifier: ^1.11.18
|
||||
version: 1.11.18
|
||||
uuid:
|
||||
specifier: ^11.1.0
|
||||
version: 11.1.0
|
||||
zod:
|
||||
specifier: 4.1.4
|
||||
version: 4.1.4
|
||||
devDependencies:
|
||||
'@biomejs/biome':
|
||||
specifier: 2.1.4
|
||||
version: 2.1.4
|
||||
'@types/node':
|
||||
specifier: ^20.19.22
|
||||
version: 20.19.22
|
||||
version: 1.11.19
|
||||
tsup:
|
||||
specifier: 8.5.0
|
||||
version: 8.5.0(jiti@2.6.1)(postcss@8.5.6)(typescript@5.9.3)
|
||||
|
|
@ -36,9 +29,15 @@ importers:
|
|||
unbuild:
|
||||
specifier: ^3.6.1
|
||||
version: 3.6.1(typescript@5.9.3)
|
||||
uuid:
|
||||
specifier: ^11.1.0
|
||||
version: 11.1.0
|
||||
vitest:
|
||||
specifier: ^3.2.4
|
||||
version: 3.2.4(@types/node@20.19.22)(jiti@2.6.1)
|
||||
zod:
|
||||
specifier: 4.1.4
|
||||
version: 4.1.4
|
||||
|
||||
packages:
|
||||
|
||||
|
|
@ -50,55 +49,55 @@ packages:
|
|||
resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@biomejs/biome@2.1.4':
|
||||
resolution: {integrity: sha512-QWlrqyxsU0FCebuMnkvBIkxvPqH89afiJzjMl+z67ybutse590jgeaFdDurE9XYtzpjRGTI1tlUZPGWmbKsElA==}
|
||||
'@biomejs/biome@2.4.0':
|
||||
resolution: {integrity: sha512-iluT61cORUDIC5i/y42ljyQraCemmmcgbMLLCnYO+yh+2hjTmcMFcwY8G0zTzWCsPb3t3AyKc+0t/VuhPZULUg==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
hasBin: true
|
||||
|
||||
'@biomejs/cli-darwin-arm64@2.1.4':
|
||||
resolution: {integrity: sha512-sCrNENE74I9MV090Wq/9Dg7EhPudx3+5OiSoQOkIe3DLPzFARuL1dOwCWhKCpA3I5RHmbrsbNSRfZwCabwd8Qg==}
|
||||
'@biomejs/cli-darwin-arm64@2.4.0':
|
||||
resolution: {integrity: sha512-L+YpOtPSuU0etomfvFTPWRsa7+8ejaJL3yaROEoT/96HDJbR6OsvZQk0C8JUYou+XFdP+JcGxqZknkp4n934RA==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@biomejs/cli-darwin-x64@2.1.4':
|
||||
resolution: {integrity: sha512-gOEICJbTCy6iruBywBDcG4X5rHMbqCPs3clh3UQ+hRKlgvJTk4NHWQAyHOXvaLe+AxD1/TNX1jbZeffBJzcrOw==}
|
||||
'@biomejs/cli-darwin-x64@2.4.0':
|
||||
resolution: {integrity: sha512-Aq+S7ffpb5ynTyLgtnEjG+W6xuTd2F7FdC7J6ShpvRhZwJhjzwITGF9vrqoOnw0sv1XWkt2Q1Rpg+hleg/Xg7Q==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@biomejs/cli-linux-arm64-musl@2.1.4':
|
||||
resolution: {integrity: sha512-nYr7H0CyAJPaLupFE2cH16KZmRC5Z9PEftiA2vWxk+CsFkPZQ6dBRdcC6RuS+zJlPc/JOd8xw3uCCt9Pv41WvQ==}
|
||||
'@biomejs/cli-linux-arm64-musl@2.4.0':
|
||||
resolution: {integrity: sha512-1rhDUq8sf7xX3tg7vbnU3WVfanKCKi40OXc4VleBMzRStmQHdeBY46aFP6VdwEomcVjyNiu+Zcr3LZtAdrZrjQ==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-linux-arm64@2.1.4':
|
||||
resolution: {integrity: sha512-juhEkdkKR4nbUi5k/KRp1ocGPNWLgFRD4NrHZSveYrD6i98pyvuzmS9yFYgOZa5JhaVqo0HPnci0+YuzSwT2fw==}
|
||||
'@biomejs/cli-linux-arm64@2.4.0':
|
||||
resolution: {integrity: sha512-u2p54IhvNAWB+h7+rxCZe3reNfQYFK+ppDw+q0yegrGclFYnDPZAntv/PqgUacpC3uxTeuWFgWW7RFe3lHuxOA==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-linux-x64-musl@2.1.4':
|
||||
resolution: {integrity: sha512-lvwvb2SQQHctHUKvBKptR6PLFCM7JfRjpCCrDaTmvB7EeZ5/dQJPhTYBf36BE/B4CRWR2ZiBLRYhK7hhXBCZAg==}
|
||||
'@biomejs/cli-linux-x64-musl@2.4.0':
|
||||
resolution: {integrity: sha512-Omo0xhl63z47X+CrE5viEWKJhejJyndl577VoXg763U/aoATrK3r5+8DPh02GokWPeODX1Hek00OtjjooGan9w==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-linux-x64@2.1.4':
|
||||
resolution: {integrity: sha512-Eoy9ycbhpJVYuR+LskV9s3uyaIkp89+qqgqhGQsWnp/I02Uqg2fXFblHJOpGZR8AxdB9ADy87oFVxn9MpFKUrw==}
|
||||
'@biomejs/cli-linux-x64@2.4.0':
|
||||
resolution: {integrity: sha512-WVFOhsnzhrbMGOSIcB9yFdRV2oG2KkRRhIZiunI9gJqSU3ax9ErdnTxRfJUxZUI9NbzVxC60OCXNcu+mXfF/Tw==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-win32-arm64@2.1.4':
|
||||
resolution: {integrity: sha512-3WRYte7orvyi6TRfIZkDN9Jzoogbv+gSvR+b9VOXUg1We1XrjBg6WljADeVEaKTvOcpVdH0a90TwyOQ6ue4fGw==}
|
||||
'@biomejs/cli-win32-arm64@2.4.0':
|
||||
resolution: {integrity: sha512-aqRwW0LJLV1v1NzyLvLWQhdLmDSAV1vUh+OBdYJaa8f28XBn5BZavo+WTfqgEzALZxlNfBmu6NGO6Al3MbCULw==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@biomejs/cli-win32-x64@2.1.4':
|
||||
resolution: {integrity: sha512-tBc+W7anBPSFXGAoQW+f/+svkpt8/uXfRwDzN1DvnatkRMt16KIYpEi/iw8u9GahJlFv98kgHcIrSsZHZTR0sw==}
|
||||
'@biomejs/cli-win32-x64@2.4.0':
|
||||
resolution: {integrity: sha512-g47s+V+OqsGxbSZN3lpav6WYOk0PIc3aCBAq+p6dwSynL3K5MA6Cg6nkzDOlu28GEHwbakW+BllzHCJCxnfK5Q==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
|
@ -658,8 +657,8 @@ packages:
|
|||
resolution: {integrity: sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==}
|
||||
engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'}
|
||||
|
||||
dayjs@1.11.18:
|
||||
resolution: {integrity: sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA==}
|
||||
dayjs@1.11.19:
|
||||
resolution: {integrity: sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==}
|
||||
|
||||
debug@4.4.3:
|
||||
resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
|
||||
|
|
@ -1479,39 +1478,39 @@ snapshots:
|
|||
'@babel/helper-validator-identifier@7.28.5':
|
||||
optional: true
|
||||
|
||||
'@biomejs/biome@2.1.4':
|
||||
'@biomejs/biome@2.4.0':
|
||||
optionalDependencies:
|
||||
'@biomejs/cli-darwin-arm64': 2.1.4
|
||||
'@biomejs/cli-darwin-x64': 2.1.4
|
||||
'@biomejs/cli-linux-arm64': 2.1.4
|
||||
'@biomejs/cli-linux-arm64-musl': 2.1.4
|
||||
'@biomejs/cli-linux-x64': 2.1.4
|
||||
'@biomejs/cli-linux-x64-musl': 2.1.4
|
||||
'@biomejs/cli-win32-arm64': 2.1.4
|
||||
'@biomejs/cli-win32-x64': 2.1.4
|
||||
'@biomejs/cli-darwin-arm64': 2.4.0
|
||||
'@biomejs/cli-darwin-x64': 2.4.0
|
||||
'@biomejs/cli-linux-arm64': 2.4.0
|
||||
'@biomejs/cli-linux-arm64-musl': 2.4.0
|
||||
'@biomejs/cli-linux-x64': 2.4.0
|
||||
'@biomejs/cli-linux-x64-musl': 2.4.0
|
||||
'@biomejs/cli-win32-arm64': 2.4.0
|
||||
'@biomejs/cli-win32-x64': 2.4.0
|
||||
|
||||
'@biomejs/cli-darwin-arm64@2.1.4':
|
||||
'@biomejs/cli-darwin-arm64@2.4.0':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-darwin-x64@2.1.4':
|
||||
'@biomejs/cli-darwin-x64@2.4.0':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-arm64-musl@2.1.4':
|
||||
'@biomejs/cli-linux-arm64-musl@2.4.0':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-arm64@2.1.4':
|
||||
'@biomejs/cli-linux-arm64@2.4.0':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-x64-musl@2.1.4':
|
||||
'@biomejs/cli-linux-x64-musl@2.4.0':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-x64@2.1.4':
|
||||
'@biomejs/cli-linux-x64@2.4.0':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-win32-arm64@2.1.4':
|
||||
'@biomejs/cli-win32-arm64@2.4.0':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-win32-x64@2.1.4':
|
||||
'@biomejs/cli-win32-x64@2.4.0':
|
||||
optional: true
|
||||
|
||||
'@esbuild/aix-ppc64@0.25.11':
|
||||
|
|
@ -1971,7 +1970,7 @@ snapshots:
|
|||
dependencies:
|
||||
css-tree: 2.2.1
|
||||
|
||||
dayjs@1.11.18: {}
|
||||
dayjs@1.11.19: {}
|
||||
|
||||
debug@4.4.3:
|
||||
dependencies:
|
||||
|
|
|
|||
0
requisicoes.rest
Normal file → Executable file
0
requisicoes.rest
Normal file → Executable file
0
src/aleatorio.ts
Normal file → Executable file
0
src/aleatorio.ts
Normal file → Executable file
0
src/cacheMemoria.ts
Normal file → Executable file
0
src/cacheMemoria.ts
Normal file → Executable file
0
src/constantes.ts
Normal file → Executable file
0
src/constantes.ts
Normal file → Executable file
2
src/consulta.ts
Normal file → Executable file
2
src/consulta.ts
Normal file → Executable file
|
|
@ -9,6 +9,7 @@ export enum operadores {
|
|||
"<=" = "<=",
|
||||
like = "like",
|
||||
in = "in",
|
||||
isNull = "isNull",
|
||||
}
|
||||
|
||||
export type tipoFiltro = {
|
||||
|
|
@ -38,6 +39,7 @@ export const zOperadores = z.enum([
|
|||
"<=",
|
||||
"like",
|
||||
"in",
|
||||
"isNull",
|
||||
])
|
||||
|
||||
export const zFiltro = z.object({
|
||||
|
|
|
|||
25
src/dayjs.ts
25
src/dayjs.ts
|
|
@ -1,25 +0,0 @@
|
|||
import dayjs from "dayjs"
|
||||
|
||||
export type { ManipulateType } from "dayjs"
|
||||
|
||||
import duration from "dayjs/plugin/duration.js"
|
||||
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js"
|
||||
import isSameOrBefore from "dayjs/plugin/isSameOrBefore.js"
|
||||
import minMax from "dayjs/plugin/minMax.js"
|
||||
import relativeTime from "dayjs/plugin/relativeTime.js"
|
||||
import timezone from "dayjs/plugin/timezone.js"
|
||||
import utc from "dayjs/plugin/utc.js"
|
||||
import weekOfYear from "dayjs/plugin/weekOfYear.js"
|
||||
import "dayjs/locale/pt-br.js"
|
||||
dayjs.locale("pt-br")
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
dayjs.extend(weekOfYear)
|
||||
dayjs.extend(isSameOrBefore)
|
||||
dayjs.extend(isSameOrAfter)
|
||||
dayjs.extend(minMax)
|
||||
dayjs.extend(relativeTime)
|
||||
dayjs.extend(duration)
|
||||
|
||||
export const dayjsbr = dayjs
|
||||
107
src/dayjs26.ts
Executable file
107
src/dayjs26.ts
Executable file
|
|
@ -0,0 +1,107 @@
|
|||
/**
|
||||
* Utilitário de configuração do Dayjs focado em compatibilidade com SSR.
|
||||
*
|
||||
* PROBLEMA:
|
||||
* A importação direta do `dayjs` e seus plugins frequentemente causa conflitos em ambientes
|
||||
* de Renderização do Lado do Servidor (SSR), como Nuxt ou Next.js, devido a discrepâncias
|
||||
* na resolução de módulos (ESM vs CJS) e instabilidades de importação.
|
||||
*
|
||||
* SOLUÇÃO:
|
||||
* Este módulo utiliza o padrão de Injeção de Dependência. Ele expõe apenas tipagens e
|
||||
* uma função de configuração (`defineDayjsBr`). A responsabilidade de importar as
|
||||
* bibliotecas "vivas" é delegada à aplicação consumidora (o cliente da função).
|
||||
*
|
||||
* Isso permite que o bundler da aplicação principal (Vite, Webpack, etc.) gerencie as
|
||||
* instâncias, garantindo consistência e evitando erros de "module not found" ou
|
||||
* instâncias duplicadas/não inicializadas adequadamente.
|
||||
*/
|
||||
|
||||
import type _dayjs from "dayjs"
|
||||
import type { Dayjs } from "dayjs"
|
||||
|
||||
export type { ManipulateType } from "dayjs"
|
||||
|
||||
// Importação apenas de TIPOS para evitar bundling indesejado neste arquivo
|
||||
import type _duration from "dayjs/plugin/duration"
|
||||
import type _isSameOrAfter from "dayjs/plugin/isSameOrAfter"
|
||||
import type _isSameOrBefore from "dayjs/plugin/isSameOrBefore"
|
||||
import type _minMax from "dayjs/plugin/minMax"
|
||||
import type _relativeTime from "dayjs/plugin/relativeTime"
|
||||
import type _timezone from "dayjs/plugin/timezone"
|
||||
import type _utc from "dayjs/plugin/utc"
|
||||
import type _weekOfYear from "dayjs/plugin/weekOfYear"
|
||||
|
||||
/**
|
||||
* Inicializa e configura o Dayjs com o locale 'pt-br' e plugins essenciais.
|
||||
*
|
||||
* MODO DE USO:
|
||||
* Importe os pacotes reais na sua aplicação e passe-os para esta função.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // Em seu arquivo de configuração (ex: plugins/dayjs.ts):
|
||||
* import dayjs from "dayjs"
|
||||
* import duration from "dayjs/plugin/duration"
|
||||
* import isSameOrAfter from "dayjs/plugin/isSameOrAfter"
|
||||
* import isSameOrBefore from "dayjs/plugin/isSameOrBefore"
|
||||
* import minMax from "dayjs/plugin/minMax"
|
||||
* import relativeTime from "dayjs/plugin/relativeTime"
|
||||
* import timezone from "dayjs/plugin/timezone"
|
||||
* import utc from "dayjs/plugin/utc"
|
||||
* import weekOfYear from "dayjs/plugin/weekOfYear"
|
||||
* import { defineDayjsBr } from "p-comuns"
|
||||
* import "dayjs/locale/pt-br" // Importante: importar o locale!
|
||||
|
||||
* export const dayjsbr = defineDayjsBr({
|
||||
* dayjs,
|
||||
* duration,
|
||||
* isSameOrAfter,
|
||||
* isSameOrBefore,
|
||||
* minMax,
|
||||
* relativeTime,
|
||||
* timezone,
|
||||
* utc,
|
||||
* weekOfYear,
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
const defineDayjsBr = ({
|
||||
dayjs,
|
||||
duration,
|
||||
isSameOrAfter,
|
||||
isSameOrBefore,
|
||||
minMax,
|
||||
relativeTime,
|
||||
timezone,
|
||||
utc,
|
||||
weekOfYear,
|
||||
}: {
|
||||
dayjs: typeof _dayjs
|
||||
duration: typeof _duration
|
||||
isSameOrAfter: typeof _isSameOrAfter
|
||||
isSameOrBefore: typeof _isSameOrBefore
|
||||
minMax: typeof _minMax
|
||||
relativeTime: typeof _relativeTime
|
||||
timezone: typeof _timezone
|
||||
utc: typeof _utc
|
||||
weekOfYear: typeof _weekOfYear
|
||||
}) => {
|
||||
// Extensão da biblioteca com os plugins fornecidos
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
dayjs.extend(weekOfYear)
|
||||
dayjs.extend(isSameOrBefore)
|
||||
dayjs.extend(isSameOrAfter)
|
||||
dayjs.extend(minMax)
|
||||
dayjs.extend(relativeTime)
|
||||
dayjs.extend(duration)
|
||||
|
||||
// Definição do locale global
|
||||
dayjs.locale("pt-br")
|
||||
|
||||
return dayjs
|
||||
}
|
||||
|
||||
export { defineDayjsBr }
|
||||
|
||||
export type { Dayjs }
|
||||
0
src/ecosistema/index.ts
Normal file → Executable file
0
src/ecosistema/index.ts
Normal file → Executable file
2
src/ecosistema/urls.ts
Normal file → Executable file
2
src/ecosistema/urls.ts
Normal file → Executable file
|
|
@ -1 +1 @@
|
|||
export const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net"
|
||||
export const link_paiol = "https://paiol.idz.one"
|
||||
|
|
|
|||
0
src/extensoes.ts
Normal file → Executable file
0
src/extensoes.ts
Normal file → Executable file
0
src/graficosPilao.ts
Normal file → Executable file
0
src/graficosPilao.ts
Normal file → Executable file
13
src/index.ts
Normal file → Executable file
13
src/index.ts
Normal file → Executable file
|
|
@ -2,20 +2,19 @@ export * from "./aleatorio"
|
|||
export * from "./cacheMemoria"
|
||||
export * from "./constantes"
|
||||
export * from "./consulta"
|
||||
export * from "./dayjs"
|
||||
export * from "./dayjs26"
|
||||
export * from "./ecosistema"
|
||||
export * from "./extensoes"
|
||||
export * from "./graficosPilao"
|
||||
export * from "./extensoes"
|
||||
export * from "./local"
|
||||
export * from "./logger"
|
||||
export * from "./postgres"
|
||||
export * from "./produtos"
|
||||
export * from "./situacoes"
|
||||
export * from "./testes-de-variaveis"
|
||||
export * from "./texto_busca"
|
||||
export * from "./tipagemRotas"
|
||||
export * from "./tipagemRotas"
|
||||
export * from "./tipoFiltro.26"
|
||||
export * from "./unidades_medida"
|
||||
export * from "./uuid"
|
||||
export * from "./variaveisComuns"
|
||||
export * from "./tipagemRotas"
|
||||
export * from "./extensoes"
|
||||
export * from "./logger"
|
||||
export * from "./situacoes"
|
||||
0
src/instalarAmbiente.ts
Normal file → Executable file
0
src/instalarAmbiente.ts
Normal file → Executable file
4
src/local/index.ts
Normal file → Executable file
4
src/local/index.ts
Normal file → Executable file
|
|
@ -6,8 +6,8 @@ export const localValor = <T>(
|
|||
chave_: string | any,
|
||||
valor?: T | null,
|
||||
): T | null => {
|
||||
const localStorage = globalThis.localStorage
|
||||
|
||||
const localStorage =
|
||||
"localStorage" in globalThis ? (globalThis as any).localStorage : undefined
|
||||
if (typeof localStorage == "undefined") return null
|
||||
|
||||
const chave =
|
||||
|
|
|
|||
126
src/logger.ts
126
src/logger.ts
|
|
@ -1,126 +0,0 @@
|
|||
import crossFetch from "cross-fetch"
|
||||
import { nomeVariavel } from "./variaveisComuns"
|
||||
|
||||
const LOKI_BASE_URL = "https://log.idz.one"
|
||||
const LOKI_ENDPOINT = "/loki/api/v1/push"
|
||||
export type tipoLokiObjeto = {
|
||||
streams: {
|
||||
stream: {
|
||||
[k: string]: string
|
||||
}
|
||||
values: [string, string][]
|
||||
}[]
|
||||
}
|
||||
|
||||
export const postLogger = async ({
|
||||
objeto,
|
||||
}: {
|
||||
objeto: tipoLokiObjeto
|
||||
}): Promise<[objeto: tipoLokiObjeto, erro?: string]> => {
|
||||
const response = await crossFetch(`${LOKI_BASE_URL}${LOKI_ENDPOINT}`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(objeto),
|
||||
}).catch((a) => a)
|
||||
if (!response.ok) {
|
||||
return [objeto, `Erro ${response.status}: ${await response?.text?.()}`]
|
||||
}
|
||||
return [objeto]
|
||||
}
|
||||
|
||||
let cwd = ""
|
||||
|
||||
/** define a localização da pasta do projeto */
|
||||
export const defineCwd = (novoCwd: string) => {
|
||||
cwd = novoCwd
|
||||
}
|
||||
|
||||
type tipoLevel = "info" | "warn" | "error"
|
||||
|
||||
type tipoOpSessao = {
|
||||
inquilino: string
|
||||
usuario: string
|
||||
parametros?: { [k: string]: string }
|
||||
}
|
||||
|
||||
type tipoLog = {
|
||||
detalhes?: unknown[]
|
||||
__filename?: string
|
||||
local?: string
|
||||
parametros?: { [k: string]: string }
|
||||
}
|
||||
|
||||
export type tipoLoggerLog = (
|
||||
level: tipoLevel,
|
||||
mensagem: string,
|
||||
op_tipoLog?: tipoLog,
|
||||
) => Promise<[objeto: tipoLokiObjeto, erro?: string]>
|
||||
|
||||
export type TipoLoggerSessao = (sess: tipoOpSessao) => tipoLoggerLog
|
||||
|
||||
export type tipoLogger = (amb: {
|
||||
app: string
|
||||
eProducao: boolean
|
||||
parametros?: {
|
||||
[k: string]: string
|
||||
}
|
||||
}) => TipoLoggerSessao
|
||||
|
||||
export const logger: tipoLogger =
|
||||
({ app: app_e, eProducao, parametros: parametrosAmbiente }) =>
|
||||
({ inquilino, usuario, parametros: parametrosSessao }) =>
|
||||
async (level, mensagem, op_tipoLog) => {
|
||||
let {
|
||||
__filename,
|
||||
detalhes,
|
||||
local,
|
||||
parametros: parametrosLog,
|
||||
} = op_tipoLog || {}
|
||||
|
||||
const app = `${eProducao ? "" : "DEV-"}${app_e}`
|
||||
|
||||
if (cwd && __filename) {
|
||||
__filename = __filename.replace(cwd, "")
|
||||
}
|
||||
|
||||
if (local) {
|
||||
detalhes = [`${nomeVariavel({ local })}="${local}"`, ...(detalhes || [])]
|
||||
}
|
||||
|
||||
if (__filename) {
|
||||
detalhes = [
|
||||
`${nomeVariavel({ __filename })}="${__filename}"`,
|
||||
...(detalhes || []),
|
||||
]
|
||||
}
|
||||
|
||||
const timestamp = `${Date.now()}000000`
|
||||
|
||||
const mainLog = detalhes?.length
|
||||
? `${mensagem} | ${detalhes.map((d) => JSON.stringify(d)).join(" | ")}`
|
||||
: mensagem
|
||||
|
||||
const payload: tipoLokiObjeto["streams"][number] = {
|
||||
stream: {
|
||||
app,
|
||||
inquilino,
|
||||
usuario,
|
||||
level,
|
||||
...(parametrosAmbiente || {}),
|
||||
...(parametrosSessao || {}),
|
||||
...(parametrosLog || {}),
|
||||
},
|
||||
values: [
|
||||
[
|
||||
timestamp,
|
||||
mainLog, // Linha de log direta
|
||||
],
|
||||
],
|
||||
}
|
||||
|
||||
const objeto: tipoLokiObjeto = { streams: [payload] }
|
||||
|
||||
const response = await postLogger({ objeto })
|
||||
|
||||
return response
|
||||
}
|
||||
0
src/postgres.ts
Normal file → Executable file
0
src/postgres.ts
Normal file → Executable file
4
src/produtos.ts
Normal file
4
src/produtos.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export enum Produtos {
|
||||
"e-licencie" = "e-licencie",
|
||||
"gov.e-licencie" = "gov.e-licencie",
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
export enum tiposSituacoes {
|
||||
export enum tiposSituacoesElicencie {
|
||||
modelo = "000_modelo",
|
||||
|
||||
vencida = "100_vencida",
|
||||
expirado = "200_expirado",
|
||||
alerta = "300_alerta",
|
||||
|
|
@ -59,10 +61,3 @@ export enum tiposSituacoes {
|
|||
nao_aplicavel = "730_nao_aplicavel",
|
||||
parcial = "715_parcial",
|
||||
}
|
||||
|
||||
export const corSituacoes: { [K in keyof typeof tiposSituacoes]?: string } = {
|
||||
pendente: "#CCC353",
|
||||
nao_conforme: "#dc3545",
|
||||
conforme: "#28a745",
|
||||
alerta: "#FFDE59",
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
export * from "./situacoes"
|
||||
0
src/teste.ts
Normal file → Executable file
0
src/teste.ts
Normal file → Executable file
0
src/testes-de-variaveis/index.ts
Normal file → Executable file
0
src/testes-de-variaveis/index.ts
Normal file → Executable file
0
src/testes-de-variaveis/umaFuncao.ts
Normal file → Executable file
0
src/testes-de-variaveis/umaFuncao.ts
Normal file → Executable file
0
src/testes-de-variaveis/umaVariavel.ts
Normal file → Executable file
0
src/testes-de-variaveis/umaVariavel.ts
Normal file → Executable file
0
src/testes/TipagemRotas.test.ts
Normal file → Executable file
0
src/testes/TipagemRotas.test.ts
Normal file → Executable file
0
src/texto_busca.ts
Normal file → Executable file
0
src/texto_busca.ts
Normal file → Executable file
18
src/tipagemRotas.ts
Normal file → Executable file
18
src/tipagemRotas.ts
Normal file → Executable file
|
|
@ -63,9 +63,10 @@ export class TipagemRotas<T extends { [q: string]: any }> {
|
|||
*/
|
||||
|
||||
endereco(query: T, usarComoHash?: boolean) {
|
||||
const url = new URL(
|
||||
typeof window !== "undefined" ? window.location.href : "http://localhost",
|
||||
)
|
||||
const win =
|
||||
(typeof globalThis !== "undefined" && (globalThis as any).window) ||
|
||||
undefined
|
||||
const url = new URL(win ? win.location.href : "http://localhost")
|
||||
|
||||
url.pathname = this.caminho
|
||||
|
||||
|
|
@ -95,8 +96,11 @@ export class TipagemRotas<T extends { [q: string]: any }> {
|
|||
if (this._acaoIr) {
|
||||
this._acaoIr(this.endereco({ ...query }))
|
||||
} else {
|
||||
if (typeof window != "undefined") {
|
||||
window.location.href = this.endereco({ ...query })
|
||||
const win =
|
||||
(typeof globalThis !== "undefined" && (globalThis as any).window) ||
|
||||
undefined
|
||||
if (win) {
|
||||
win.location.href = this.endereco({ ...query })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -110,8 +114,8 @@ export class TipagemRotas<T extends { [q: string]: any }> {
|
|||
const url = urlEntrada
|
||||
? new URL(urlEntrada)
|
||||
: new URL(
|
||||
typeof window !== "undefined"
|
||||
? window.location.href
|
||||
typeof globalThis !== "undefined" && (globalThis as any).window
|
||||
? (globalThis as any).window.location.href
|
||||
: "http://localhost",
|
||||
)
|
||||
const query = url.searchParams
|
||||
|
|
|
|||
235
src/tipoFiltro.26.ts
Normal file
235
src/tipoFiltro.26.ts
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
import { z } from "zod"
|
||||
|
||||
/**
|
||||
* =============================================================================
|
||||
* tipoFiltro26<T>
|
||||
* =============================================================================
|
||||
*
|
||||
* OBJETIVO
|
||||
* -----------------------------------------------------------------------------
|
||||
* Gerar automaticamente a tipagem de filtros compatíveis com operadores
|
||||
* padrão do PostgreSQL, a partir de um tipo base T.
|
||||
*
|
||||
* Este tipo foi projetado para:
|
||||
* - Construção de filtros dinâmicos
|
||||
* - Geração posterior de WHERE (Knex / SQL)
|
||||
* - Uso seguro por IA (evita filtros inválidos em nível de tipo)
|
||||
*
|
||||
*
|
||||
* FORMATO DO FILTRO
|
||||
* -----------------------------------------------------------------------------
|
||||
* 1) Campos simples:
|
||||
*
|
||||
* {
|
||||
* idade: { ">=": 18 }
|
||||
* }
|
||||
*
|
||||
* 2) Campos aninhados:
|
||||
*
|
||||
* {
|
||||
* carro: {
|
||||
* ano: { "=": 2020 }
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* 3) Operador E (AND):
|
||||
*
|
||||
* {
|
||||
* E: [
|
||||
* { idade: { ">=": 18 } },
|
||||
* { nome: { like: "%pa%" } }
|
||||
* ]
|
||||
* }
|
||||
*
|
||||
* 4) Operador OU (OR):
|
||||
*
|
||||
* {
|
||||
* OU: [
|
||||
* { idade: { "<": 18 } },
|
||||
* { idade: { ">=": 60 } }
|
||||
* ]
|
||||
* }
|
||||
*
|
||||
* 5) Combinação complexa:
|
||||
*
|
||||
* {
|
||||
* idade: { ">=": 18 },
|
||||
* OU: [
|
||||
* { nome: { like: "%pa%" } },
|
||||
* {
|
||||
* E: [
|
||||
* { carro: { ano: { "=": 2020 } } },
|
||||
* { carro: { modelo: { in: ["Civic"] } } }
|
||||
* ]
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*
|
||||
*
|
||||
* REGRAS IMPORTANTES (PARA IA)
|
||||
* -----------------------------------------------------------------------------
|
||||
* - Apenas campos existentes em T podem ser usados.
|
||||
* - Operadores são restritos por tipo do campo.
|
||||
* - Objetos são tratados recursivamente.
|
||||
* - Arrays NÃO são tratados como objeto recursivo.
|
||||
* - Funções NÃO são consideradas campos filtráveis.
|
||||
*
|
||||
*
|
||||
* OPERADORES SUPORTADOS
|
||||
* -----------------------------------------------------------------------------
|
||||
* number:
|
||||
* =, !=, >, >=, <, <=, in
|
||||
*
|
||||
* string:
|
||||
* =, !=, like, in
|
||||
*
|
||||
* boolean:
|
||||
* =, !=, in
|
||||
*
|
||||
* Não há suporte automático a:
|
||||
* - null
|
||||
* - date
|
||||
* - jsonb
|
||||
* - arrays
|
||||
*
|
||||
* Essas extensões devem ser adicionadas explicitamente.
|
||||
*
|
||||
* =============================================================================
|
||||
*/
|
||||
|
||||
/* =============================================================================
|
||||
OPERADORES POSTGRESQL POR TIPO
|
||||
============================================================================= */
|
||||
|
||||
export enum operadores26 {
|
||||
"=" = "=",
|
||||
"!=" = "!=",
|
||||
">" = ">",
|
||||
">=" = ">=",
|
||||
"<" = "<",
|
||||
"<=" = "<=",
|
||||
like = "like",
|
||||
in = "in",
|
||||
}
|
||||
|
||||
export enum agrupadores26 {
|
||||
E = "E",
|
||||
OU = "OU",
|
||||
}
|
||||
|
||||
type PgOpsNumber = {
|
||||
[K in Extract<operadores26, "=" | "!=" | ">" | ">=" | "<" | "<=">]?: number
|
||||
} & {
|
||||
[K in Extract<operadores26, "in">]?: number[]
|
||||
}
|
||||
|
||||
type PgOpsString = {
|
||||
[K in Extract<operadores26, "=" | "!=" | "like">]?: string
|
||||
} & {
|
||||
[K in Extract<operadores26, "in">]?: string[]
|
||||
}
|
||||
|
||||
type PgOpsBoolean = {
|
||||
[K in Extract<operadores26, "=" | "!=">]?: boolean
|
||||
} & {
|
||||
[K in Extract<operadores26, "in">]?: boolean[]
|
||||
}
|
||||
|
||||
/* =============================================================================
|
||||
SELEÇÃO AUTOMÁTICA DE OPERADORES BASEADA NO TIPO DO CAMPO
|
||||
============================================================================= */
|
||||
|
||||
type PgOpsFor<V> = V extends number
|
||||
? PgOpsNumber
|
||||
: V extends string
|
||||
? PgOpsString
|
||||
: V extends boolean
|
||||
? PgOpsBoolean
|
||||
: never
|
||||
|
||||
/* =============================================================================
|
||||
UTILITÁRIO: DETECTAR OBJETO PLANO
|
||||
============================================================================= */
|
||||
|
||||
type IsPlainObject<T> = T extends object
|
||||
? T extends Function
|
||||
? false
|
||||
: T extends readonly any[]
|
||||
? false
|
||||
: true
|
||||
: false
|
||||
|
||||
/* =============================================================================
|
||||
FILTRO RECURSIVO POR CAMPOS
|
||||
============================================================================= */
|
||||
|
||||
type FiltroCampos<T> = {
|
||||
[K in keyof T]?: IsPlainObject<T[K]> extends true
|
||||
? tipoFiltro26<T[K]>
|
||||
: PgOpsFor<T[K]>
|
||||
}
|
||||
|
||||
/* =============================================================================
|
||||
TIPO PRINCIPAL EXPORTADO
|
||||
============================================================================= */
|
||||
|
||||
export type tipoFiltro26<T> = FiltroCampos<T> & {
|
||||
/**
|
||||
* E => AND lógico
|
||||
* Todos os filtros dentro do array devem ser verdadeiros.
|
||||
*/
|
||||
E?: tipoFiltro26<T>[]
|
||||
|
||||
/**
|
||||
* OU => OR lógico
|
||||
* Pelo menos um filtro dentro do array deve ser verdadeiro.
|
||||
*/
|
||||
OU?: tipoFiltro26<T>[]
|
||||
}
|
||||
|
||||
/* =============================================================================
|
||||
VALIDAÇÃO ESTRUTURAL (ZOD)
|
||||
============================================================================= */
|
||||
|
||||
const zOperadores = z.nativeEnum(operadores26)
|
||||
const zValor = z.any()
|
||||
const zCondicao = z.record(zOperadores, zValor)
|
||||
|
||||
export const zFiltro26: z.ZodType<any> = z.lazy(() =>
|
||||
z
|
||||
.object({
|
||||
E: z.array(zFiltro26).optional(),
|
||||
OU: z.array(zFiltro26).optional(),
|
||||
})
|
||||
.catchall(z.union([zCondicao, zFiltro26])),
|
||||
)
|
||||
|
||||
/* =============================================================================
|
||||
EXEMPLO DE USO
|
||||
============================================================================= */
|
||||
|
||||
type Pessoa = {
|
||||
codigo: string
|
||||
nome: string
|
||||
idade: number
|
||||
carro: {
|
||||
modelo: string
|
||||
ano: number
|
||||
}
|
||||
}
|
||||
|
||||
export const criarFiltro26 = <T>(filtro: tipoFiltro26<T>) => filtro
|
||||
|
||||
const _filtro = criarFiltro26<Pessoa>({
|
||||
idade: { [operadores26[">="]]: 18 },
|
||||
|
||||
[agrupadores26.OU]: [
|
||||
{ nome: { [operadores26.like]: "%pa%" } },
|
||||
{
|
||||
[agrupadores26.E]: [
|
||||
{ carro: { ano: { [operadores26["="]]: 2020 } } },
|
||||
{ carro: { modelo: { [operadores26.in]: ["Civic", "Corolla"] } } },
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
0
src/unidades_medida.ts
Normal file → Executable file
0
src/unidades_medida.ts
Normal file → Executable file
0
src/uuid.ts
Normal file → Executable file
0
src/uuid.ts
Normal file → Executable file
0
src/variaveisComuns.ts
Normal file → Executable file
0
src/variaveisComuns.ts
Normal file → Executable file
0
tsconfig-back.json
Normal file → Executable file
0
tsconfig-back.json
Normal file → Executable file
0
tsconfig-front.json
Normal file → Executable file
0
tsconfig-front.json
Normal file → Executable file
0
tsconfig.json
Normal file → Executable file
0
tsconfig.json
Normal file → Executable file
0
tsup/como usar.md
Normal file → Executable file
0
tsup/como usar.md
Normal file → Executable file
4
tsup/tsup.config.back.ts
Normal file → Executable file
4
tsup/tsup.config.back.ts
Normal file → Executable file
|
|
@ -18,6 +18,10 @@ export const tsup_config_back: Options = {
|
|||
minify: false, // Geralmente não minificamos o código do backend em produção, mas você pode mudar
|
||||
platform: "node",
|
||||
outExtension: () => ({ js: ".js" }),
|
||||
loader: {
|
||||
".svg": "text",
|
||||
".md": "text",
|
||||
},
|
||||
}
|
||||
|
||||
// Exporta a configuração padrão usando defineConfig
|
||||
|
|
|
|||
0
tsup/tsup.config.front.interno.ts
Normal file → Executable file
0
tsup/tsup.config.front.interno.ts
Normal file → Executable file
6
tsup/tsup.config.front.ts
Normal file → Executable file
6
tsup/tsup.config.front.ts
Normal file → Executable file
|
|
@ -16,9 +16,13 @@ export const tsup_config_front: Options = {
|
|||
sourcemap: false,
|
||||
minify: true, // Recomendado para builds de produção
|
||||
platform: "browser",
|
||||
external: ['dayjs'],
|
||||
external: ['dayjs', 'cross-fetch', 'uuid', 'zod'],
|
||||
outExtension: () => ({ js: ".mjs" }),
|
||||
shims: false,
|
||||
loader: {
|
||||
".svg": "text",
|
||||
".md": "text",
|
||||
},
|
||||
}
|
||||
|
||||
// Exporta a configuração padrão usando defineConfig
|
||||
|
|
|
|||
0
tsup/tsup.config.interno.ts
Normal file → Executable file
0
tsup/tsup.config.interno.ts
Normal file → Executable file
0
tsup/tsup.config.ts
Normal file → Executable file
0
tsup/tsup.config.ts
Normal file → Executable file
Loading…
Add table
Add a link
Reference in a new issue