Compare commits
116 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0d99faa50 | |||
| e1694195cc | |||
| 59576cef8b | |||
| 2ead837b0a | |||
| 6b8d30fb30 | |||
| c8bc47d515 | |||
| 0cbe901499 | |||
| 84880fff0c | |||
| 5b1b6e3c25 | |||
| 3f8faa35a2 | |||
| dff25ab347 | |||
| 83f5d5353c | |||
| 55be0a0712 | |||
| 326aea91a6 | |||
| 484f2f4593 | |||
| ef34df1657 | |||
| 01bc1d0eec | |||
| ac08b31b3d | |||
| 30a28b7ecc | |||
| db39ae48f0 | |||
| 24407479cf | |||
| e6fa9640bc | |||
| 8674c1b8da | |||
| 61fcd8be82 | |||
| a88b53e460 | |||
| 10a3312418 | |||
| 14396d5ec5 | |||
| 2157b5d8b5 | |||
| 5dfc211852 | |||
| 4daa78f698 | |||
| da38648a35 | |||
| 68a4d2a496 | |||
| 8eafd7c943 | |||
| f02f1029b3 | |||
| bdab1f75b1 | |||
| a75b70dddd | |||
| 3b37c764bd | |||
| d9dec53a66 | |||
| b3057a7638 | |||
| 7ca0c11f6c | |||
| 4b7fe02ead | |||
| e24312ce83 | |||
| 2df6b6a418 | |||
| 42d5e978c9 | |||
| 2cac8492fa | |||
| 1d969c9b0d | |||
| 7e40a6e6c3 | |||
| 16706f7438 | |||
| d9c2b3580e | |||
| fa4b956698 | |||
| cb63a087fe | |||
| 428e82e14d | |||
| 9f17c1adba | |||
| d19d61dfc3 | |||
| 7f3c28ca1b | |||
| 8c8802d6f7 | |||
| 9dd2c4025b | |||
| 889148eb42 | |||
| 9a332853b6 | |||
| d5237fbf6e | |||
| 988466ef96 | |||
| 8952d472c4 | |||
| 5f32d43559 | |||
| 743539b7b6 | |||
| 064523b2bd | |||
| 4c2fc54be1 | |||
| 4a319bef73 | |||
| 4637042883 | |||
| 556ea198e8 | |||
| 7dd417a9fb | |||
| 6df27ff3b0 | |||
| 3e9aa7eeb4 | |||
| 351a0e33fb | |||
| 16df9ec8aa | |||
| b0bb8520c4 | |||
| aa2315dbb4 | |||
| e346282d3a | |||
| 44a5ce9878 | |||
| cd90eeaa3e | |||
| d72455e06b | |||
| f2eea9962b | |||
| 7e7cf8e7df | |||
| 3b45b82654 | |||
| cb86027ff9 | |||
| 5ed3207ecf | |||
| 6dd0569f9e | |||
| ccba36f828 | |||
| 11b24c3b98 | |||
| f6dcff3693 | |||
| e36137e33e | |||
| fe15145de0 | |||
| b609c43dae | |||
| 1143b010e6 | |||
| 4bec786f47 | |||
| 5810127591 | |||
| 24561a6199 | |||
| 0dc2d7a0df | |||
| a4be29ad2a | |||
| 50887b522c | |||
| 4f676c5193 | |||
| 644eba14d0 | |||
| 911cd6e0c8 | |||
| 4ef243bcad | |||
| 2d15095bd6 | |||
| c19d8bc40f | |||
| e3c5642027 | |||
| 2dafba786d | |||
| 722c065be0 | |||
| bb1dbd3b0b | |||
| 40dca15bff | |||
| 17aee620b3 | |||
| 3c7926df4d | |||
| 326112a16a | |||
| 40570d1b00 | |||
| 8efeb59716 | |||
| 7bddbd5c72 |
115 changed files with 4886 additions and 1624 deletions
2
.env
2
.env
|
|
@ -1,2 +0,0 @@
|
||||||
PORTA = '5020'
|
|
||||||
PREFIXO = '/estaticos'
|
|
||||||
1
.npmignore
Normal file
1
.npmignore
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
*.tgz
|
||||||
28
.vscode/settings.json
vendored
Normal file
28
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.organizeImports.biome": "always",
|
||||||
|
"source.fixAll.biome": "always"
|
||||||
|
},
|
||||||
|
"editor.defaultFormatter": "biomejs.biome",
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||||
|
},
|
||||||
|
"[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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,19 +1,18 @@
|
||||||
{
|
{
|
||||||
"root": false,
|
|
||||||
"$schema": "../node_modules/@biomejs/biome/configuration_schema.json",
|
"$schema": "../node_modules/@biomejs/biome/configuration_schema.json",
|
||||||
|
"root": false,
|
||||||
|
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
"recommended": true,
|
"recommended": true,
|
||||||
"suspicious": {
|
"correctness": {
|
||||||
"noDoubleEquals": "off",
|
"noUnusedVariables": "error",
|
||||||
"noExplicitAny": "off",
|
"noUnusedImports": "error",
|
||||||
"noDebugger": "off",
|
"noEmptyPattern": "off",
|
||||||
"noApproximativeNumericConstant": "off",
|
"useExhaustiveDependencies": "off"
|
||||||
"noAsyncPromiseExecutor": "off"
|
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
"noUselessElse": "off",
|
|
||||||
"noParameterAssign": "error",
|
"noParameterAssign": "error",
|
||||||
"useAsConstAssertion": "error",
|
"useAsConstAssertion": "error",
|
||||||
"useDefaultParameterLast": "error",
|
"useDefaultParameterLast": "error",
|
||||||
|
|
@ -24,22 +23,20 @@
|
||||||
"useNumberNamespace": "error",
|
"useNumberNamespace": "error",
|
||||||
"noInferrableTypes": "error"
|
"noInferrableTypes": "error"
|
||||||
},
|
},
|
||||||
"complexity": {
|
"suspicious": {
|
||||||
"noBannedTypes": "off",
|
"noDebugger": "off",
|
||||||
"noForEach": "off",
|
"noDoubleEquals": "off",
|
||||||
"useLiteralKeys": "off",
|
"noExplicitAny": "off",
|
||||||
"noUselessConstructor": "off",
|
"noApproximativeNumericConstant": "off",
|
||||||
"useArrowFunction": "off",
|
"noAsyncPromiseExecutor": "off"
|
||||||
"useDateNow":"off",
|
|
||||||
"noUselessFragments":"off"
|
|
||||||
},
|
},
|
||||||
"correctness": {
|
"complexity": {
|
||||||
"noEmptyPattern": "off",
|
"noUselessConstructor": "off",
|
||||||
"noUnusedVariables": "error",
|
"noBannedTypes": "off",
|
||||||
"noUnusedImports": "off",
|
"useLiteralKeys": "off",
|
||||||
"useExhaustiveDependencies":"off"
|
"useArrowFunction": "warn",
|
||||||
|
"useDateNow": "off",
|
||||||
|
"noUselessFragments":"off"
|
||||||
},
|
},
|
||||||
"performance": {
|
"performance": {
|
||||||
"noAccumulatingSpread": "off"
|
"noAccumulatingSpread": "off"
|
||||||
|
|
@ -50,15 +47,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"indentWidth": 2,
|
"enabled": true,
|
||||||
"indentStyle": "space",
|
"indentStyle": "space",
|
||||||
"enabled": true
|
"indentWidth": 2
|
||||||
},
|
},
|
||||||
"javascript": {
|
"javascript": {
|
||||||
"formatter": {
|
"formatter": {
|
||||||
|
"enabled": true,
|
||||||
"semicolons": "asNeeded",
|
"semicolons": "asNeeded",
|
||||||
"arrowParentheses": "always",
|
"arrowParentheses": "always",
|
||||||
"enabled": true,
|
|
||||||
"bracketSameLine": false,
|
"bracketSameLine": false,
|
||||||
"trailingCommas": "all",
|
"trailingCommas": "all",
|
||||||
"attributePosition": "multiline"
|
"attributePosition": "multiline"
|
||||||
|
|
|
||||||
91
README.md
91
README.md
|
|
@ -1 +1,90 @@
|
||||||
# comuns
|
## ✅ Uso do BiomeJS para Autoformatação
|
||||||
|
|
||||||
|
Este guia mostra como configurar o [BiomeJS](https://biomejs.dev) para formatar e analisar código JavaScript/TypeScript no seu projeto.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 1. Incluir o pacote de configuração comum
|
||||||
|
|
||||||
|
Certifique-se de que o pacote `p-comuns` (ou outro com a configuração compartilhada) esteja disponível no seu projeto. Ele deve conter o arquivo `Documentos/biome.json`.
|
||||||
|
|
||||||
|
pnpm up p-comuns
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. Instalar o Biome com `pnpm`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm add --save-dev --save-exact @biomejs/biome@2.1.4
|
||||||
|
```
|
||||||
|
|
||||||
|
> 🎯 Use `--save-exact` para garantir consistência de versões entre ambientes.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. Criar o arquivo de configuração na raiz do projeto
|
||||||
|
|
||||||
|
Crie um arquivo chamado `biome.json` com o seguinte conteúdo:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
||||||
|
"extends": ["./node_modules/p-comuns/Documentos/biome.json"],
|
||||||
|
"files": {
|
||||||
|
"includes": ["src/**/*.{js,ts,jsx,tsx}"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ Verifique o caminho correto do `extends` relativo à raiz do seu projeto. Use `./` sempre que possível para evitar erros de resolução.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4. Adicionar script no `package.json`
|
||||||
|
|
||||||
|
Inclua o comando abaixo em `"scripts"`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"biome": "pnpm exec biome check --write",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Isso permite executar:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm biome
|
||||||
|
```
|
||||||
|
|
||||||
|
> O comando irá **formatar e aplicar as regras de lint** nos arquivos do diretório `src/`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ Dica extra: formatar todos os arquivos
|
||||||
|
|
||||||
|
Se quiser aplicar o Biome a todo o projeto (não só `src/`), altere o include:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"includes": ["**/*.{js,ts,jsx,tsx}"]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
adicionar em .vscode/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": "octref.vetur"},
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.organizeImports.biome": "always",
|
||||||
|
"source.fixAll.biome": "always"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
18
biome.json
18
biome.json
|
|
@ -1,21 +1,7 @@
|
||||||
{
|
{
|
||||||
"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
|
"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
|
||||||
"extends": ["Documentos/biome.json"],
|
"extends": ["Documentos/biome.json"],
|
||||||
"files": {},
|
"files": {
|
||||||
"linter": {
|
"includes": ["src/**/*.{js,ts,jsx,tsx}"]
|
||||||
"rules": {
|
|
||||||
"style": {
|
|
||||||
"noParameterAssign": "error",
|
|
||||||
"useAsConstAssertion": "error",
|
|
||||||
"useDefaultParameterLast": "error",
|
|
||||||
"useEnumInitializers": "error",
|
|
||||||
"useSelfClosingElements": "error",
|
|
||||||
"useSingleVarDeclarator": "error",
|
|
||||||
"noUnusedTemplateLiteral": "error",
|
|
||||||
"useNumberNamespace": "error",
|
|
||||||
"noInferrableTypes": "error",
|
|
||||||
"noUselessElse": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
build.config.ts
Normal file
12
build.config.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { defineBuildConfig } from 'unbuild'
|
||||||
|
|
||||||
|
// pnpm exec unbuild
|
||||||
|
|
||||||
|
export default defineBuildConfig({
|
||||||
|
entries: ['src/index'],
|
||||||
|
clean: true,
|
||||||
|
declaration: true,
|
||||||
|
rollup: {
|
||||||
|
emitCJS: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
54
bun.lock
54
bun.lock
|
|
@ -1,54 +0,0 @@
|
||||||
{
|
|
||||||
"lockfileVersion": 1,
|
|
||||||
"workspaces": {
|
|
||||||
"": {
|
|
||||||
"name": "p-comuns",
|
|
||||||
"dependencies": {
|
|
||||||
"cross-fetch": "4.1.0",
|
|
||||||
"zod": "3.24.1",
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@biomejs/biome": "2.0.6",
|
|
||||||
"@types/node": "^20.19.8",
|
|
||||||
"typescript": "^5.8.3",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"packages": {
|
|
||||||
"@biomejs/biome": ["@biomejs/biome@2.0.6", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.0.6", "@biomejs/cli-darwin-x64": "2.0.6", "@biomejs/cli-linux-arm64": "2.0.6", "@biomejs/cli-linux-arm64-musl": "2.0.6", "@biomejs/cli-linux-x64": "2.0.6", "@biomejs/cli-linux-x64-musl": "2.0.6", "@biomejs/cli-win32-arm64": "2.0.6", "@biomejs/cli-win32-x64": "2.0.6" }, "bin": { "biome": "bin/biome" } }, "sha512-RRP+9cdh5qwe2t0gORwXaa27oTOiQRQvrFf49x2PA1tnpsyU7FIHX4ZOFMtBC4QNtyWsN7Dqkf5EDbg4X+9iqA=="],
|
|
||||||
|
|
||||||
"@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.0.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-AzdiNNjNzsE6LfqWyBvcL29uWoIuZUkndu+wwlXW13EKcBHbbKjNQEZIJKYDc6IL+p7bmWGx3v9ZtcRyIoIz5A=="],
|
|
||||||
|
|
||||||
"@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.0.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-wJjjP4E7bO4WJmiQaLnsdXMa516dbtC6542qeRkyJg0MqMXP0fvs4gdsHhZ7p9XWTAmGIjZHFKXdsjBvKGIJJQ=="],
|
|
||||||
|
|
||||||
"@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.0.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-ZSVf6TYo5rNMUHIW1tww+rs/krol7U5A1Is/yzWyHVZguuB0lBnIodqyFuwCNqG9aJGyk7xIMS8HG0qGUPz0SA=="],
|
|
||||||
|
|
||||||
"@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.0.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-CVPEMlin3bW49sBqLBg2x016Pws7eUXA27XYDFlEtponD0luYjg2zQaMJ2nOqlkKG9fqzzkamdYxHdMDc2gZFw=="],
|
|
||||||
|
|
||||||
"@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.0.6", "", { "os": "linux", "cpu": "x64" }, "sha512-geM1MkHTV1Kh2Cs/Xzot9BOF3WBacihw6bkEmxkz4nSga8B9/hWy5BDiOG3gHDGIBa8WxT0nzsJs2f/hPqQIQw=="],
|
|
||||||
|
|
||||||
"@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.0.6", "", { "os": "linux", "cpu": "x64" }, "sha512-mKHE/e954hR/hSnAcJSjkf4xGqZc/53Kh39HVW1EgO5iFi0JutTN07TSjEMg616julRtfSNJi0KNyxvc30Y4rQ=="],
|
|
||||||
|
|
||||||
"@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.0.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-290V4oSFoKaprKE1zkYVsDfAdn0An5DowZ+GIABgjoq1ndhvNxkJcpxPsiYtT7slbVe3xmlT0ncdfOsN7KruzA=="],
|
|
||||||
|
|
||||||
"@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.0.6", "", { "os": "win32", "cpu": "x64" }, "sha512-bfM1Bce0d69Ao7pjTjUS+AWSZ02+5UHdiAP85Th8e9yV5xzw6JrHXbL5YWlcEKQ84FIZMdDc7ncuti1wd2sdbw=="],
|
|
||||||
|
|
||||||
"@types/node": ["@types/node@20.19.8", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-HzbgCY53T6bfu4tT7Aq3TvViJyHjLjPNaAS3HOuMc9pw97KHsUtXNX4L+wu59g1WnjsZSko35MbEqnO58rihhw=="],
|
|
||||||
|
|
||||||
"cross-fetch": ["cross-fetch@4.1.0", "", { "dependencies": { "node-fetch": "^2.7.0" } }, "sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw=="],
|
|
||||||
|
|
||||||
"node-fetch": ["node-fetch@2.7.0", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="],
|
|
||||||
|
|
||||||
"tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="],
|
|
||||||
|
|
||||||
"typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
|
|
||||||
|
|
||||||
"undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
|
||||||
|
|
||||||
"webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="],
|
|
||||||
|
|
||||||
"whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="],
|
|
||||||
|
|
||||||
"zod": ["zod@3.24.1", "", {}, "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A=="],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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
|
||||||
|
});
|
||||||
57
dist-back/dayjs.js
Normal file
57
dist-back/dayjs.js
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
"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 dayjs_exports = {};
|
||||||
|
__export(dayjs_exports, {
|
||||||
|
dayjsbr: () => dayjsbr
|
||||||
|
});
|
||||||
|
module.exports = __toCommonJS(dayjs_exports);
|
||||||
|
var import_dayjs = __toESM(require("dayjs"));
|
||||||
|
var import_duration = __toESM(require("dayjs/plugin/duration.js"));
|
||||||
|
var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter.js"));
|
||||||
|
var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore.js"));
|
||||||
|
var import_minMax = __toESM(require("dayjs/plugin/minMax.js"));
|
||||||
|
var import_relativeTime = __toESM(require("dayjs/plugin/relativeTime.js"));
|
||||||
|
var import_timezone = __toESM(require("dayjs/plugin/timezone.js"));
|
||||||
|
var import_utc = __toESM(require("dayjs/plugin/utc.js"));
|
||||||
|
var import_weekOfYear = __toESM(require("dayjs/plugin/weekOfYear.js"));
|
||||||
|
var import_pt_br = require("dayjs/locale/pt-br.js");
|
||||||
|
import_dayjs.default.locale("pt-br");
|
||||||
|
import_dayjs.default.extend(import_utc.default);
|
||||||
|
import_dayjs.default.extend(import_timezone.default);
|
||||||
|
import_dayjs.default.extend(import_weekOfYear.default);
|
||||||
|
import_dayjs.default.extend(import_isSameOrBefore.default);
|
||||||
|
import_dayjs.default.extend(import_isSameOrAfter.default);
|
||||||
|
import_dayjs.default.extend(import_minMax.default);
|
||||||
|
import_dayjs.default.extend(import_relativeTime.default);
|
||||||
|
import_dayjs.default.extend(import_duration.default);
|
||||||
|
const dayjsbr = import_dayjs.default;
|
||||||
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
|
0 && (module.exports = {
|
||||||
|
dayjsbr
|
||||||
|
});
|
||||||
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, {
|
||||||
|
cdn_carro_de_boi: () => cdn_carro_de_boi
|
||||||
|
});
|
||||||
|
module.exports = __toCommonJS(urls_exports);
|
||||||
|
const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
|
||||||
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
|
0 && (module.exports = {
|
||||||
|
cdn_carro_de_boi
|
||||||
|
});
|
||||||
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
|
||||||
|
});
|
||||||
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("./dayjs"), 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("./logger"), module.exports);
|
||||||
|
__reExport(index_exports, require("./logger"), module.exports);
|
||||||
|
__reExport(index_exports, require("./postgres"), module.exports);
|
||||||
|
__reExport(index_exports, require("./produtos"), 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("./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("./dayjs"),
|
||||||
|
...require("./ecosistema"),
|
||||||
|
...require("./extensoes"),
|
||||||
|
...require("./extensoes"),
|
||||||
|
...require("./local"),
|
||||||
|
...require("./logger"),
|
||||||
|
...require("./logger"),
|
||||||
|
...require("./postgres"),
|
||||||
|
...require("./produtos"),
|
||||||
|
...require("./testes-de-variaveis"),
|
||||||
|
...require("./texto_busca"),
|
||||||
|
...require("./tipagemRotas"),
|
||||||
|
...require("./tipagemRotas"),
|
||||||
|
...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 = 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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
|
0 && (module.exports = {
|
||||||
|
localValor
|
||||||
|
});
|
||||||
106
dist-back/logger.js
Normal file
106
dist-back/logger.js
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
"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 logger_exports = {};
|
||||||
|
__export(logger_exports, {
|
||||||
|
defineCwd: () => defineCwd,
|
||||||
|
logger: () => logger,
|
||||||
|
postLogger: () => postLogger
|
||||||
|
});
|
||||||
|
module.exports = __toCommonJS(logger_exports);
|
||||||
|
var import_cross_fetch = __toESM(require("cross-fetch"));
|
||||||
|
var import_variaveisComuns = require("./variaveisComuns");
|
||||||
|
const LOKI_BASE_URL = "https://log.idz.one";
|
||||||
|
const LOKI_ENDPOINT = "/loki/api/v1/push";
|
||||||
|
const postLogger = async ({
|
||||||
|
objeto
|
||||||
|
}) => {
|
||||||
|
const response = await (0, import_cross_fetch.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 = [`${(0, import_variaveisComuns.nomeVariavel)({ local })}="${local}"`, ...detalhes || []];
|
||||||
|
}
|
||||||
|
if (__filename) {
|
||||||
|
detalhes = [
|
||||||
|
`${(0, import_variaveisComuns.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;
|
||||||
|
};
|
||||||
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
|
0 && (module.exports = {
|
||||||
|
defineCwd,
|
||||||
|
logger,
|
||||||
|
postLogger
|
||||||
|
});
|
||||||
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
|
||||||
|
});
|
||||||
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 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
|
0 && (module.exports = {
|
||||||
|
TipagemRotas
|
||||||
|
});
|
||||||
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
|
||||||
|
});
|
||||||
315
dist-front/index.d.mts
Normal file
315
dist-front/index.d.mts
Normal file
|
|
@ -0,0 +1,315 @@
|
||||||
|
import z from 'zod';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
export { Dayjs, 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",
|
||||||
|
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>;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 enum Produtos {
|
||||||
|
"e-licencie" = "e-licencie",
|
||||||
|
"gov.e-licencie" = "gov.e-licencie"
|
||||||
|
}
|
||||||
|
|
||||||
|
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 { Produtos, TipagemRotas, type TipoLoggerSessao, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, cdn_carro_de_boi, dayjsbr, defineCwd, erUuid, esperar, extensoes, type interfaceConsulta, localValor, logger, nomeVariavel, objetoPg, operadores, paraObjetoRegistroPg, pgObjeto, postLogger, siglas_unidades_medida, texto_busca, tipoArquivo, type tipoFiltro, type tipoLogger, type tipoLoggerLog, type tipoLokiObjeto, tipoUsuarioResiduos, tx, umaFuncao, umaVariavel, unidades_medida, uuid, uuidV3, uuidV4, uuid_null, validarUuid, verCacheM, zFiltro, 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
1
dist-import/aleatorio.d.ts
vendored
1
dist-import/aleatorio.d.ts
vendored
|
|
@ -1 +0,0 @@
|
||||||
export declare const aleatorio: (tamanho?: number) => string;
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
const alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
||||||
export const aleatorio = (tamanho) => `eli-${Array.from({ length: tamanho || 8 })
|
|
||||||
.map(() => alfabeto[((999 * Math.random()) | 0) % alfabeto.length])
|
|
||||||
.join("")}`;
|
|
||||||
19
dist-import/constantes.d.ts
vendored
19
dist-import/constantes.d.ts
vendored
|
|
@ -1,19 +0,0 @@
|
||||||
export declare const uuid_null = "00000000-0000-0000-0000-000000000000";
|
|
||||||
/** Colunas Presentes n maioria das tabelas */
|
|
||||||
export 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 */
|
|
||||||
export declare enum tx {
|
|
||||||
token = "token"
|
|
||||||
}
|
|
||||||
export declare enum tipoUsuarioResiduos {
|
|
||||||
Usuario = "usuario",
|
|
||||||
Fornecedor = "fornecedor"
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
export const uuid_null = "00000000-0000-0000-0000-000000000000";
|
|
||||||
/** Colunas Presentes n maioria das tabelas */
|
|
||||||
export var camposComuns;
|
|
||||||
(function (camposComuns) {
|
|
||||||
camposComuns["codigo"] = "codigo";
|
|
||||||
camposComuns["excluido"] = "excluido";
|
|
||||||
camposComuns["data_hora_criacao"] = "data_hora_criacao";
|
|
||||||
camposComuns["data_hora_atualizacao"] = "data_hora_atualizacao";
|
|
||||||
camposComuns["codigo_usuario_criacao"] = "codigo_usuario_criacao";
|
|
||||||
camposComuns["codigo_usuario_atualizacao"] = "codigo_usuario_atualizacao";
|
|
||||||
camposComuns["versao"] = "versao";
|
|
||||||
})(camposComuns || (camposComuns = {}));
|
|
||||||
/** Palavras comumente usadas */
|
|
||||||
export var tx;
|
|
||||||
(function (tx) {
|
|
||||||
tx["token"] = "token";
|
|
||||||
})(tx || (tx = {}));
|
|
||||||
export var tipoUsuarioResiduos;
|
|
||||||
(function (tipoUsuarioResiduos) {
|
|
||||||
tipoUsuarioResiduos["Usuario"] = "usuario";
|
|
||||||
tipoUsuarioResiduos["Fornecedor"] = "fornecedor";
|
|
||||||
})(tipoUsuarioResiduos || (tipoUsuarioResiduos = {}));
|
|
||||||
26
dist-import/consulta.d.ts
vendored
26
dist-import/consulta.d.ts
vendored
|
|
@ -1,26 +0,0 @@
|
||||||
export declare enum operadores {
|
|
||||||
"=" = "=",
|
|
||||||
"!=" = "!=",
|
|
||||||
">" = ">",
|
|
||||||
">=" = ">=",
|
|
||||||
"<" = "<",
|
|
||||||
"<=" = "<=",
|
|
||||||
like = "like",
|
|
||||||
in = "in"
|
|
||||||
}
|
|
||||||
export type tipoFiltro = {
|
|
||||||
coluna: string;
|
|
||||||
valor: any;
|
|
||||||
operador: keyof typeof operadores | operadores;
|
|
||||||
ou?: boolean;
|
|
||||||
};
|
|
||||||
export type interfaceConsulta = {
|
|
||||||
offset?: number;
|
|
||||||
limit?: number;
|
|
||||||
filtros?: tipoFiltro[];
|
|
||||||
ordem?: string;
|
|
||||||
ordemTipo?: "asc" | "desc";
|
|
||||||
colunas?: string[];
|
|
||||||
apenasConsulta?: boolean;
|
|
||||||
apenasContagem?: boolean;
|
|
||||||
};
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
export var operadores;
|
|
||||||
(function (operadores) {
|
|
||||||
operadores["="] = "=";
|
|
||||||
operadores["!="] = "!=";
|
|
||||||
operadores[">"] = ">";
|
|
||||||
operadores[">="] = ">=";
|
|
||||||
operadores["<"] = "<";
|
|
||||||
operadores["<="] = "<=";
|
|
||||||
operadores["like"] = "like";
|
|
||||||
operadores["in"] = "in";
|
|
||||||
})(operadores || (operadores = {}));
|
|
||||||
1
dist-import/ecosistema/index.d.ts
vendored
1
dist-import/ecosistema/index.d.ts
vendored
|
|
@ -1 +0,0 @@
|
||||||
export * from "./urls";
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export * from "./urls";
|
|
||||||
1
dist-import/ecosistema/urls.d.ts
vendored
1
dist-import/ecosistema/urls.d.ts
vendored
|
|
@ -1 +0,0 @@
|
||||||
export declare const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
|
|
||||||
13
dist-import/extensoes.d.ts
vendored
13
dist-import/extensoes.d.ts
vendored
|
|
@ -1,13 +0,0 @@
|
||||||
type tiposArquivo = "imagem" | "documento" | "vídeo" | "outros";
|
|
||||||
export declare const extensoes: {
|
|
||||||
ext: string;
|
|
||||||
tipo: tiposArquivo;
|
|
||||||
mime: string;
|
|
||||||
}[];
|
|
||||||
/**
|
|
||||||
* Função que retorna o tipo do arquivo
|
|
||||||
* @param nomeArquivo
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export declare const tipoArquivo: (nomeArquivo: string | null | undefined) => tiposArquivo;
|
|
||||||
export {};
|
|
||||||
|
|
@ -1,168 +0,0 @@
|
||||||
export 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ídeo",
|
|
||||||
mime: "video/mp4",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "avi",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/x-msvideo",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "mkv",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/x-matroska",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "mov",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/quicktime",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "wmv",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/x-ms-wmv",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "flv",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/x-flv",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "webm",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/webm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "3gp",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/3gpp",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "mpeg",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/mpeg",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
/**
|
|
||||||
* Função que retorna o tipo do arquivo
|
|
||||||
* @param nomeArquivo
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export const tipoArquivo = (nomeArquivo) => {
|
|
||||||
// extenssão do arquivo
|
|
||||||
const extArquivo = String(nomeArquivo || "")
|
|
||||||
.toLocaleLowerCase()
|
|
||||||
.split(".")
|
|
||||||
.pop();
|
|
||||||
// procura a extensão do arquivo na lista de extensões
|
|
||||||
const extensao = extensoes.find((extensao) => extensao.ext === extArquivo);
|
|
||||||
// retorna o tipo do arquivo
|
|
||||||
return extensao?.tipo || "outros";
|
|
||||||
};
|
|
||||||
11
dist-import/index.d.ts
vendored
11
dist-import/index.d.ts
vendored
|
|
@ -1,11 +0,0 @@
|
||||||
export * from "./aleatorio";
|
|
||||||
export * from "./constantes";
|
|
||||||
export * from "./consulta";
|
|
||||||
export * from "./ecosistema";
|
|
||||||
export * from "./extensoes";
|
|
||||||
export * from "./logger";
|
|
||||||
export * from "./texto_busca";
|
|
||||||
export * from "./tipagemRotas";
|
|
||||||
export * from "./unidades_medida";
|
|
||||||
export * from "./uuid";
|
|
||||||
export * from "./variaveisComuns";
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
export * from "./aleatorio";
|
|
||||||
export * from "./constantes";
|
|
||||||
export * from "./consulta";
|
|
||||||
export * from "./ecosistema";
|
|
||||||
export * from "./extensoes";
|
|
||||||
export * from "./logger";
|
|
||||||
export * from "./texto_busca";
|
|
||||||
export * from "./tipagemRotas";
|
|
||||||
export * from "./unidades_medida";
|
|
||||||
export * from "./uuid";
|
|
||||||
export * from "./variaveisComuns";
|
|
||||||
40
dist-import/logger.d.ts
vendored
40
dist-import/logger.d.ts
vendored
|
|
@ -1,40 +0,0 @@
|
||||||
export type tipoLokiObjeto = {
|
|
||||||
streams: {
|
|
||||||
stream: {
|
|
||||||
[k: string]: string;
|
|
||||||
};
|
|
||||||
values: [string, string][];
|
|
||||||
}[];
|
|
||||||
};
|
|
||||||
export declare const postLogger: ({ objeto, }: {
|
|
||||||
objeto: tipoLokiObjeto;
|
|
||||||
}) => Promise<[objeto: tipoLokiObjeto, erro?: string]>;
|
|
||||||
/** define a localização da pasta do projeto */
|
|
||||||
export 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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
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 declare const logger: tipoLogger;
|
|
||||||
export {};
|
|
||||||
|
|
@ -1,60 +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 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 = "";
|
|
||||||
/** define a localização da pasta do projeto */
|
|
||||||
export const defineCwd = (novoCwd) => {
|
|
||||||
cwd = novoCwd;
|
|
||||||
};
|
|
||||||
export 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;
|
|
||||||
};
|
|
||||||
1
dist-import/teste.d.ts
vendored
1
dist-import/teste.d.ts
vendored
|
|
@ -1 +0,0 @@
|
||||||
export {};
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import { logger } from "./logger";
|
|
||||||
const l = logger({ app: "teste", eProducao: true });
|
|
||||||
const lg = l({
|
|
||||||
inquilino: "conta_1",
|
|
||||||
usuario: "pedrinho",
|
|
||||||
});
|
|
||||||
lg("error", "Deu Ruim").then((a) => console.log(JSON.stringify(a)));
|
|
||||||
lg("info", "Deu Bom", { __filename }).then((a) => console.log(JSON.stringify(a)));
|
|
||||||
2
dist-import/texto_busca.d.ts
vendored
2
dist-import/texto_busca.d.ts
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
/** gerar o texto de busca removendo caracteres especies e caixa alta */
|
|
||||||
export declare const texto_busca: (...texto: any[]) => string;
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
/** gerar o texto de busca removendo caracteres especies e caixa alta */
|
|
||||||
export const texto_busca = (...texto) => texto
|
|
||||||
.map((txt) => txt === null || txt === undefined
|
|
||||||
? ""
|
|
||||||
: String(txt)
|
|
||||||
.normalize("NFD")
|
|
||||||
.replace(/[\u0300-\u036f]/g, "")
|
|
||||||
.replace(/\s+/g, " ")
|
|
||||||
.toLowerCase())
|
|
||||||
.join(" ");
|
|
||||||
49
dist-import/tipagemRotas.d.ts
vendored
49
dist-import/tipagemRotas.d.ts
vendored
|
|
@ -1,49 +0,0 @@
|
||||||
/** 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é"}
|
|
||||||
*/
|
|
||||||
export declare class TipagemRotas<T extends {
|
|
||||||
[q: string]: string | undefined;
|
|
||||||
}> {
|
|
||||||
_partesCaminho: string[];
|
|
||||||
_acaoIr?: (endereco: 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, }: {
|
|
||||||
caminho: string[] | string;
|
|
||||||
acaoIr?: undefined | ((endereco: string) => undefined);
|
|
||||||
});
|
|
||||||
/** 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"}
|
|
||||||
*/
|
|
||||||
get parametros(): Partial<T>;
|
|
||||||
}
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
/** 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é"}
|
|
||||||
*/
|
|
||||||
export 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, }) {
|
|
||||||
this._partesCaminho = [];
|
|
||||||
this._acaoIr = acaoIr;
|
|
||||||
this._partesCaminho = (Array.isArray(caminho) ? caminho : [caminho])
|
|
||||||
.flatMap((a) => a.split("/"))
|
|
||||||
.filter(Boolean);
|
|
||||||
}
|
|
||||||
/** 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), value === undefined || value === null ? "" : 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"}
|
|
||||||
*/
|
|
||||||
get parametros() {
|
|
||||||
const url = new URL(typeof window !== "undefined" ? window.location.href : "http://localhost");
|
|
||||||
const query = url.searchParams;
|
|
||||||
const queryObj = Object.fromEntries(query.entries());
|
|
||||||
// pegar hash
|
|
||||||
const hash = url.hash;
|
|
||||||
if (hash) {
|
|
||||||
const hashObj = Object.fromEntries(new URLSearchParams(hash.slice(1)).entries());
|
|
||||||
return { ...queryObj, ...hashObj };
|
|
||||||
}
|
|
||||||
return queryObj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
23
dist-import/unidades_medida.d.ts
vendored
23
dist-import/unidades_medida.d.ts
vendored
|
|
@ -1,23 +0,0 @@
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
export declare enum siglas_unidades_medida {
|
|
||||||
UN = "UN",
|
|
||||||
KG = "KG",
|
|
||||||
TON = "TON",
|
|
||||||
g = "g",
|
|
||||||
"M³" = "M\u00B3",
|
|
||||||
Lt = "Lt"
|
|
||||||
}
|
|
||||||
export 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";
|
|
||||||
}[];
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
export var siglas_unidades_medida;
|
|
||||||
(function (siglas_unidades_medida) {
|
|
||||||
siglas_unidades_medida["UN"] = "UN";
|
|
||||||
siglas_unidades_medida["KG"] = "KG";
|
|
||||||
siglas_unidades_medida["TON"] = "TON";
|
|
||||||
siglas_unidades_medida["g"] = "g";
|
|
||||||
siglas_unidades_medida["M\u00B3"] = "M\u00B3";
|
|
||||||
siglas_unidades_medida["Lt"] = "Lt";
|
|
||||||
})(siglas_unidades_medida || (siglas_unidades_medida = {}));
|
|
||||||
export 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 / 1000,
|
|
||||||
tipo: "massa",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
sigla_unidade: "TON",
|
|
||||||
nome: "Tonelada",
|
|
||||||
sigla_normalizada: "KG",
|
|
||||||
normalizar: (valor) => valor * 1000,
|
|
||||||
tipo: "massa",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
sigla_unidade: "Lt",
|
|
||||||
nome: "Litro",
|
|
||||||
sigla_normalizada: "Lt",
|
|
||||||
normalizar: (valor) => valor,
|
|
||||||
tipo: "volume",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
sigla_unidade: "M³",
|
|
||||||
nome: "Metro Cúbico",
|
|
||||||
sigla_normalizada: "Lt",
|
|
||||||
normalizar: (valor) => valor * 1000,
|
|
||||||
tipo: "volume",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
sigla_unidade: "UN",
|
|
||||||
nome: "Unidade",
|
|
||||||
sigla_normalizada: "UN",
|
|
||||||
normalizar: (valor) => valor,
|
|
||||||
tipo: "unidade",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
1
dist-import/uuid.d.ts
vendored
1
dist-import/uuid.d.ts
vendored
|
|
@ -1 +0,0 @@
|
||||||
export declare const uuid: () => string;
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
//Gerar uma uuid V4
|
|
||||||
const letras = "0123456789abcdef".split("");
|
|
||||||
export const uuid = () => {
|
|
||||||
letras.sort(() => Math.random() - 0.5);
|
|
||||||
const modelo = "xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx".split("");
|
|
||||||
const retorno = modelo
|
|
||||||
.map((letra) => letra === "x"
|
|
||||||
? letras[((1000 * Math.random()) | 0) % letras.length]
|
|
||||||
: letra)
|
|
||||||
.join("");
|
|
||||||
return retorno;
|
|
||||||
};
|
|
||||||
11
dist-import/variaveisComuns.d.ts
vendored
11
dist-import/variaveisComuns.d.ts
vendored
|
|
@ -1,11 +0,0 @@
|
||||||
export 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
|
|
||||||
*/
|
|
||||||
export declare const nomeVariavel: (v: {
|
|
||||||
[key: string]: any;
|
|
||||||
}) => string;
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
export const esperar = (ms) => new Promise((resolve) => setTimeout(() => resolve(true), ms));
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
export const nomeVariavel = (v) => Object.keys(v).join("/");
|
|
||||||
1
dist-require/aleatorio.d.ts
vendored
1
dist-require/aleatorio.d.ts
vendored
|
|
@ -1 +0,0 @@
|
||||||
export declare const aleatorio: (tamanho?: number) => string;
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.aleatorio = void 0;
|
|
||||||
const alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
||||||
const aleatorio = (tamanho) => `eli-${Array.from({ length: tamanho || 8 })
|
|
||||||
.map(() => alfabeto[((999 * Math.random()) | 0) % alfabeto.length])
|
|
||||||
.join("")}`;
|
|
||||||
exports.aleatorio = aleatorio;
|
|
||||||
19
dist-require/constantes.d.ts
vendored
19
dist-require/constantes.d.ts
vendored
|
|
@ -1,19 +0,0 @@
|
||||||
export declare const uuid_null = "00000000-0000-0000-0000-000000000000";
|
|
||||||
/** Colunas Presentes n maioria das tabelas */
|
|
||||||
export 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 */
|
|
||||||
export declare enum tx {
|
|
||||||
token = "token"
|
|
||||||
}
|
|
||||||
export declare enum tipoUsuarioResiduos {
|
|
||||||
Usuario = "usuario",
|
|
||||||
Fornecedor = "fornecedor"
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.tipoUsuarioResiduos = exports.tx = exports.camposComuns = exports.uuid_null = void 0;
|
|
||||||
exports.uuid_null = "00000000-0000-0000-0000-000000000000";
|
|
||||||
/** Colunas Presentes n maioria das tabelas */
|
|
||||||
var camposComuns;
|
|
||||||
(function (camposComuns) {
|
|
||||||
camposComuns["codigo"] = "codigo";
|
|
||||||
camposComuns["excluido"] = "excluido";
|
|
||||||
camposComuns["data_hora_criacao"] = "data_hora_criacao";
|
|
||||||
camposComuns["data_hora_atualizacao"] = "data_hora_atualizacao";
|
|
||||||
camposComuns["codigo_usuario_criacao"] = "codigo_usuario_criacao";
|
|
||||||
camposComuns["codigo_usuario_atualizacao"] = "codigo_usuario_atualizacao";
|
|
||||||
camposComuns["versao"] = "versao";
|
|
||||||
})(camposComuns || (exports.camposComuns = camposComuns = {}));
|
|
||||||
/** Palavras comumente usadas */
|
|
||||||
var tx;
|
|
||||||
(function (tx) {
|
|
||||||
tx["token"] = "token";
|
|
||||||
})(tx || (exports.tx = tx = {}));
|
|
||||||
var tipoUsuarioResiduos;
|
|
||||||
(function (tipoUsuarioResiduos) {
|
|
||||||
tipoUsuarioResiduos["Usuario"] = "usuario";
|
|
||||||
tipoUsuarioResiduos["Fornecedor"] = "fornecedor";
|
|
||||||
})(tipoUsuarioResiduos || (exports.tipoUsuarioResiduos = tipoUsuarioResiduos = {}));
|
|
||||||
26
dist-require/consulta.d.ts
vendored
26
dist-require/consulta.d.ts
vendored
|
|
@ -1,26 +0,0 @@
|
||||||
export declare enum operadores {
|
|
||||||
"=" = "=",
|
|
||||||
"!=" = "!=",
|
|
||||||
">" = ">",
|
|
||||||
">=" = ">=",
|
|
||||||
"<" = "<",
|
|
||||||
"<=" = "<=",
|
|
||||||
like = "like",
|
|
||||||
in = "in"
|
|
||||||
}
|
|
||||||
export type tipoFiltro = {
|
|
||||||
coluna: string;
|
|
||||||
valor: any;
|
|
||||||
operador: keyof typeof operadores | operadores;
|
|
||||||
ou?: boolean;
|
|
||||||
};
|
|
||||||
export type interfaceConsulta = {
|
|
||||||
offset?: number;
|
|
||||||
limit?: number;
|
|
||||||
filtros?: tipoFiltro[];
|
|
||||||
ordem?: string;
|
|
||||||
ordemTipo?: "asc" | "desc";
|
|
||||||
colunas?: string[];
|
|
||||||
apenasConsulta?: boolean;
|
|
||||||
apenasContagem?: boolean;
|
|
||||||
};
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.operadores = void 0;
|
|
||||||
var operadores;
|
|
||||||
(function (operadores) {
|
|
||||||
operadores["="] = "=";
|
|
||||||
operadores["!="] = "!=";
|
|
||||||
operadores[">"] = ">";
|
|
||||||
operadores[">="] = ">=";
|
|
||||||
operadores["<"] = "<";
|
|
||||||
operadores["<="] = "<=";
|
|
||||||
operadores["like"] = "like";
|
|
||||||
operadores["in"] = "in";
|
|
||||||
})(operadores || (exports.operadores = operadores = {}));
|
|
||||||
1
dist-require/ecosistema/index.d.ts
vendored
1
dist-require/ecosistema/index.d.ts
vendored
|
|
@ -1 +0,0 @@
|
||||||
export * from "./urls";
|
|
||||||
|
|
@ -1,17 +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("./urls"), exports);
|
|
||||||
1
dist-require/ecosistema/urls.d.ts
vendored
1
dist-require/ecosistema/urls.d.ts
vendored
|
|
@ -1 +0,0 @@
|
||||||
export declare const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.cdn_carro_de_boi = void 0;
|
|
||||||
exports.cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
|
|
||||||
13
dist-require/extensoes.d.ts
vendored
13
dist-require/extensoes.d.ts
vendored
|
|
@ -1,13 +0,0 @@
|
||||||
type tiposArquivo = "imagem" | "documento" | "vídeo" | "outros";
|
|
||||||
export declare const extensoes: {
|
|
||||||
ext: string;
|
|
||||||
tipo: tiposArquivo;
|
|
||||||
mime: string;
|
|
||||||
}[];
|
|
||||||
/**
|
|
||||||
* Função que retorna o tipo do arquivo
|
|
||||||
* @param nomeArquivo
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export declare const tipoArquivo: (nomeArquivo: string | null | undefined) => tiposArquivo;
|
|
||||||
export {};
|
|
||||||
|
|
@ -1,172 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.tipoArquivo = exports.extensoes = void 0;
|
|
||||||
exports.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ídeo",
|
|
||||||
mime: "video/mp4",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "avi",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/x-msvideo",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "mkv",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/x-matroska",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "mov",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/quicktime",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "wmv",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/x-ms-wmv",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "flv",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/x-flv",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "webm",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/webm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "3gp",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/3gpp",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ext: "mpeg",
|
|
||||||
tipo: "vídeo",
|
|
||||||
mime: "video/mpeg",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
/**
|
|
||||||
* Função que retorna o tipo do arquivo
|
|
||||||
* @param nomeArquivo
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const tipoArquivo = (nomeArquivo) => {
|
|
||||||
// extenssão do arquivo
|
|
||||||
const extArquivo = String(nomeArquivo || "")
|
|
||||||
.toLocaleLowerCase()
|
|
||||||
.split(".")
|
|
||||||
.pop();
|
|
||||||
// procura a extensão do arquivo na lista de extensões
|
|
||||||
const extensao = exports.extensoes.find((extensao) => extensao.ext === extArquivo);
|
|
||||||
// retorna o tipo do arquivo
|
|
||||||
return extensao?.tipo || "outros";
|
|
||||||
};
|
|
||||||
exports.tipoArquivo = tipoArquivo;
|
|
||||||
11
dist-require/index.d.ts
vendored
11
dist-require/index.d.ts
vendored
|
|
@ -1,11 +0,0 @@
|
||||||
export * from "./aleatorio";
|
|
||||||
export * from "./constantes";
|
|
||||||
export * from "./consulta";
|
|
||||||
export * from "./ecosistema";
|
|
||||||
export * from "./extensoes";
|
|
||||||
export * from "./logger";
|
|
||||||
export * from "./texto_busca";
|
|
||||||
export * from "./tipagemRotas";
|
|
||||||
export * from "./unidades_medida";
|
|
||||||
export * from "./uuid";
|
|
||||||
export * from "./variaveisComuns";
|
|
||||||
|
|
@ -1,27 +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("./aleatorio"), exports);
|
|
||||||
__exportStar(require("./constantes"), exports);
|
|
||||||
__exportStar(require("./consulta"), exports);
|
|
||||||
__exportStar(require("./ecosistema"), exports);
|
|
||||||
__exportStar(require("./extensoes"), exports);
|
|
||||||
__exportStar(require("./logger"), exports);
|
|
||||||
__exportStar(require("./texto_busca"), exports);
|
|
||||||
__exportStar(require("./tipagemRotas"), exports);
|
|
||||||
__exportStar(require("./unidades_medida"), exports);
|
|
||||||
__exportStar(require("./uuid"), exports);
|
|
||||||
__exportStar(require("./variaveisComuns"), exports);
|
|
||||||
40
dist-require/logger.d.ts
vendored
40
dist-require/logger.d.ts
vendored
|
|
@ -1,40 +0,0 @@
|
||||||
export type tipoLokiObjeto = {
|
|
||||||
streams: {
|
|
||||||
stream: {
|
|
||||||
[k: string]: string;
|
|
||||||
};
|
|
||||||
values: [string, string][];
|
|
||||||
}[];
|
|
||||||
};
|
|
||||||
export declare const postLogger: ({ objeto, }: {
|
|
||||||
objeto: tipoLokiObjeto;
|
|
||||||
}) => Promise<[objeto: tipoLokiObjeto, erro?: string]>;
|
|
||||||
/** define a localização da pasta do projeto */
|
|
||||||
export 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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
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 declare const logger: tipoLogger;
|
|
||||||
export {};
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
"use strict";
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.logger = exports.defineCwd = exports.postLogger = void 0;
|
|
||||||
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
||||||
const variaveisComuns_1 = require("./variaveisComuns");
|
|
||||||
const LOKI_BASE_URL = "https://log.idz.one";
|
|
||||||
const LOKI_ENDPOINT = "/loki/api/v1/push";
|
|
||||||
const postLogger = async ({ objeto, }) => {
|
|
||||||
const response = await (0, cross_fetch_1.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];
|
|
||||||
};
|
|
||||||
exports.postLogger = postLogger;
|
|
||||||
let cwd = "";
|
|
||||||
/** define a localização da pasta do projeto */
|
|
||||||
const defineCwd = (novoCwd) => {
|
|
||||||
cwd = novoCwd;
|
|
||||||
};
|
|
||||||
exports.defineCwd = defineCwd;
|
|
||||||
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 = [`${(0, variaveisComuns_1.nomeVariavel)({ local })}="${local}"`, ...(detalhes || [])];
|
|
||||||
}
|
|
||||||
if (__filename) {
|
|
||||||
detalhes = [
|
|
||||||
`${(0, variaveisComuns_1.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 (0, exports.postLogger)({ objeto });
|
|
||||||
return response;
|
|
||||||
};
|
|
||||||
exports.logger = logger;
|
|
||||||
1
dist-require/teste.d.ts
vendored
1
dist-require/teste.d.ts
vendored
|
|
@ -1 +0,0 @@
|
||||||
export {};
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const logger_1 = require("./logger");
|
|
||||||
const l = (0, logger_1.logger)({ app: "teste", eProducao: true });
|
|
||||||
const lg = l({
|
|
||||||
inquilino: "conta_1",
|
|
||||||
usuario: "pedrinho",
|
|
||||||
});
|
|
||||||
lg("error", "Deu Ruim").then((a) => console.log(JSON.stringify(a)));
|
|
||||||
lg("info", "Deu Bom", { __filename }).then((a) => console.log(JSON.stringify(a)));
|
|
||||||
2
dist-require/texto_busca.d.ts
vendored
2
dist-require/texto_busca.d.ts
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
/** gerar o texto de busca removendo caracteres especies e caixa alta */
|
|
||||||
export declare const texto_busca: (...texto: any[]) => string;
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
"use strict";
|
|
||||||
/** gerar o texto de busca removendo caracteres especies e caixa alta */
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.texto_busca = void 0;
|
|
||||||
const texto_busca = (...texto) => texto
|
|
||||||
.map((txt) => txt === null || txt === undefined
|
|
||||||
? ""
|
|
||||||
: String(txt)
|
|
||||||
.normalize("NFD")
|
|
||||||
.replace(/[\u0300-\u036f]/g, "")
|
|
||||||
.replace(/\s+/g, " ")
|
|
||||||
.toLowerCase())
|
|
||||||
.join(" ");
|
|
||||||
exports.texto_busca = texto_busca;
|
|
||||||
49
dist-require/tipagemRotas.d.ts
vendored
49
dist-require/tipagemRotas.d.ts
vendored
|
|
@ -1,49 +0,0 @@
|
||||||
/** 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é"}
|
|
||||||
*/
|
|
||||||
export declare class TipagemRotas<T extends {
|
|
||||||
[q: string]: string | undefined;
|
|
||||||
}> {
|
|
||||||
_partesCaminho: string[];
|
|
||||||
_acaoIr?: (endereco: 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, }: {
|
|
||||||
caminho: string[] | string;
|
|
||||||
acaoIr?: undefined | ((endereco: string) => undefined);
|
|
||||||
});
|
|
||||||
/** 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"}
|
|
||||||
*/
|
|
||||||
get parametros(): Partial<T>;
|
|
||||||
}
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
"use strict";
|
|
||||||
/** 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é"}
|
|
||||||
*/
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.TipagemRotas = void 0;
|
|
||||||
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, }) {
|
|
||||||
this._partesCaminho = [];
|
|
||||||
this._acaoIr = acaoIr;
|
|
||||||
this._partesCaminho = (Array.isArray(caminho) ? caminho : [caminho])
|
|
||||||
.flatMap((a) => a.split("/"))
|
|
||||||
.filter(Boolean);
|
|
||||||
}
|
|
||||||
/** 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), value === undefined || value === null ? "" : 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"}
|
|
||||||
*/
|
|
||||||
get parametros() {
|
|
||||||
const url = new URL(typeof window !== "undefined" ? window.location.href : "http://localhost");
|
|
||||||
const query = url.searchParams;
|
|
||||||
const queryObj = Object.fromEntries(query.entries());
|
|
||||||
// pegar hash
|
|
||||||
const hash = url.hash;
|
|
||||||
if (hash) {
|
|
||||||
const hashObj = Object.fromEntries(new URLSearchParams(hash.slice(1)).entries());
|
|
||||||
return { ...queryObj, ...hashObj };
|
|
||||||
}
|
|
||||||
return queryObj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.TipagemRotas = TipagemRotas;
|
|
||||||
23
dist-require/unidades_medida.d.ts
vendored
23
dist-require/unidades_medida.d.ts
vendored
|
|
@ -1,23 +0,0 @@
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
export declare enum siglas_unidades_medida {
|
|
||||||
UN = "UN",
|
|
||||||
KG = "KG",
|
|
||||||
TON = "TON",
|
|
||||||
g = "g",
|
|
||||||
"M³" = "M\u00B3",
|
|
||||||
Lt = "Lt"
|
|
||||||
}
|
|
||||||
export 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";
|
|
||||||
}[];
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
"use strict";
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.unidades_medida = exports.siglas_unidades_medida = void 0;
|
|
||||||
var siglas_unidades_medida;
|
|
||||||
(function (siglas_unidades_medida) {
|
|
||||||
siglas_unidades_medida["UN"] = "UN";
|
|
||||||
siglas_unidades_medida["KG"] = "KG";
|
|
||||||
siglas_unidades_medida["TON"] = "TON";
|
|
||||||
siglas_unidades_medida["g"] = "g";
|
|
||||||
siglas_unidades_medida["M\u00B3"] = "M\u00B3";
|
|
||||||
siglas_unidades_medida["Lt"] = "Lt";
|
|
||||||
})(siglas_unidades_medida || (exports.siglas_unidades_medida = siglas_unidades_medida = {}));
|
|
||||||
exports.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 / 1000,
|
|
||||||
tipo: "massa",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
sigla_unidade: "TON",
|
|
||||||
nome: "Tonelada",
|
|
||||||
sigla_normalizada: "KG",
|
|
||||||
normalizar: (valor) => valor * 1000,
|
|
||||||
tipo: "massa",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
sigla_unidade: "Lt",
|
|
||||||
nome: "Litro",
|
|
||||||
sigla_normalizada: "Lt",
|
|
||||||
normalizar: (valor) => valor,
|
|
||||||
tipo: "volume",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
sigla_unidade: "M³",
|
|
||||||
nome: "Metro Cúbico",
|
|
||||||
sigla_normalizada: "Lt",
|
|
||||||
normalizar: (valor) => valor * 1000,
|
|
||||||
tipo: "volume",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
sigla_unidade: "UN",
|
|
||||||
nome: "Unidade",
|
|
||||||
sigla_normalizada: "UN",
|
|
||||||
normalizar: (valor) => valor,
|
|
||||||
tipo: "unidade",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
1
dist-require/uuid.d.ts
vendored
1
dist-require/uuid.d.ts
vendored
|
|
@ -1 +0,0 @@
|
||||||
export declare const uuid: () => string;
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.uuid = void 0;
|
|
||||||
//Gerar uma uuid V4
|
|
||||||
const letras = "0123456789abcdef".split("");
|
|
||||||
const uuid = () => {
|
|
||||||
letras.sort(() => Math.random() - 0.5);
|
|
||||||
const modelo = "xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx".split("");
|
|
||||||
const retorno = modelo
|
|
||||||
.map((letra) => letra === "x"
|
|
||||||
? letras[((1000 * Math.random()) | 0) % letras.length]
|
|
||||||
: letra)
|
|
||||||
.join("");
|
|
||||||
return retorno;
|
|
||||||
};
|
|
||||||
exports.uuid = uuid;
|
|
||||||
11
dist-require/variaveisComuns.d.ts
vendored
11
dist-require/variaveisComuns.d.ts
vendored
|
|
@ -1,11 +0,0 @@
|
||||||
export 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
|
|
||||||
*/
|
|
||||||
export declare const nomeVariavel: (v: {
|
|
||||||
[key: string]: any;
|
|
||||||
}) => string;
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.nomeVariavel = exports.esperar = void 0;
|
|
||||||
const esperar = (ms) => new Promise((resolve) => setTimeout(() => resolve(true), ms));
|
|
||||||
exports.esperar = esperar;
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
const nomeVariavel = (v) => Object.keys(v).join("/");
|
|
||||||
exports.nomeVariavel = nomeVariavel;
|
|
||||||
41
package.json
41
package.json
|
|
@ -1,21 +1,23 @@
|
||||||
{
|
{
|
||||||
"name": "p-comuns",
|
"name": "p-comuns",
|
||||||
"version": "0.127.0",
|
"version": "0.296.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./src/index.ts",
|
"main": "./dist-front/index.mjs",
|
||||||
|
"module": "./dist-front/index.mjs",
|
||||||
|
"types": "./dist-front/index.d.mts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./src/index.ts",
|
"types": "./dist-front/index.d.mts",
|
||||||
"import": "./dist-import/index.js",
|
"import": "./dist-front/index.mjs",
|
||||||
"require": "./dist-require/index.js"
|
"require": "./dist-back/index.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"types": "./src/index.ts",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"biome": "npx @biomejs/biome check --write ./src",
|
"biome": "pnpm exec biome check --write",
|
||||||
"build-back": "rm -fr dist-require && tsc --project ./tsconfig-back.json",
|
"check": "pnpm run biome && npx tsc --noEmit",
|
||||||
"build-front": "rm -fr dist-import && tsc --project ./tsconfig-front.json",
|
"build": "npm --no-git-tag-version version minor && pnpm run biome && tsup --config ./tsup/tsup.config.ts && pnpm run pacote",
|
||||||
"build": "npm --no-git-tag-version version minor && pnpm run biome && pnpm run build-back && pnpm run build-front"
|
"teste": "npx vitest run src/testes/TipagemRotas.test.ts",
|
||||||
|
"pacote": "npm pack && npm pack && mv $(npm pack --silent) pacote.tgz"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "AZTECA SOFTWARE LTDA",
|
"name": "AZTECA SOFTWARE LTDA",
|
||||||
|
|
@ -25,11 +27,22 @@
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cross-fetch": "4.1.0",
|
"cross-fetch": "4.1.0",
|
||||||
"zod": "3.24.1"
|
"dayjs": "^1.11.18",
|
||||||
|
"uuid": "^11.1.0",
|
||||||
|
"zod": "4.1.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "2.0.6",
|
"@biomejs/biome": "2.1.4",
|
||||||
"@types/node": "^20.19.8",
|
"@types/node": "^20.19.22",
|
||||||
"typescript": "^5.8.3"
|
"tsup": "8.5.0",
|
||||||
|
"typescript": "~5.9.3",
|
||||||
|
"unbuild": "^3.6.1",
|
||||||
|
"vitest": "^3.2.4"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"cross-fetch": "4.1.0",
|
||||||
|
"dayjs": "^1.11.18",
|
||||||
|
"uuid": "^11.1.0",
|
||||||
|
"zod": "4.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
pacote.tgz
Normal file
BIN
pacote.tgz
Normal file
Binary file not shown.
2695
pnpm-lock.yaml
generated
2695
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
53
src/cacheMemoria.ts
Normal file
53
src/cacheMemoria.ts
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
/** gerar uma função de cache para uso em memoria */
|
||||||
|
|
||||||
|
const _cache: {
|
||||||
|
[k: string]:
|
||||||
|
| {
|
||||||
|
/** new Date().getTime() */
|
||||||
|
validade?: number | undefined
|
||||||
|
valor: any
|
||||||
|
}
|
||||||
|
| undefined
|
||||||
|
} = {}
|
||||||
|
|
||||||
|
;(globalThis as any).cacheMemoria_cache = _cache
|
||||||
|
|
||||||
|
export const cacheM = <T>(
|
||||||
|
chave: any,
|
||||||
|
valor?: T,
|
||||||
|
validadeSeg?: number,
|
||||||
|
): T | undefined => {
|
||||||
|
// converte a chave e string
|
||||||
|
const txChave: string =
|
||||||
|
typeof chave == "string"
|
||||||
|
? chave
|
||||||
|
: typeof chave == "number"
|
||||||
|
? String(chave)
|
||||||
|
: encodeURIComponent(JSON.stringify(chave))
|
||||||
|
|
||||||
|
const validade = validadeSeg && new Date().getTime() + validadeSeg * 1000
|
||||||
|
|
||||||
|
if (valor !== undefined) {
|
||||||
|
_cache[txChave] = {
|
||||||
|
valor,
|
||||||
|
validade,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const busca = _cache[txChave]
|
||||||
|
|
||||||
|
if (busca?.validade && busca.validade < new Date().getTime()) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
return busca?.valor
|
||||||
|
}
|
||||||
|
|
||||||
|
export const verCacheM = () => _cache
|
||||||
|
|
||||||
|
export const cacheMemoria = cacheM
|
||||||
|
|
||||||
|
/** para uso fixo dentro de uma função, trava a chave */
|
||||||
|
export const cacheMFixo =
|
||||||
|
(chave: any) =>
|
||||||
|
<T>(valor?: T) =>
|
||||||
|
cacheM(chave, valor)
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import z from "zod"
|
||||||
|
|
||||||
export enum operadores {
|
export enum operadores {
|
||||||
"=" = "=",
|
"=" = "=",
|
||||||
"!=" = "!=",
|
"!=" = "!=",
|
||||||
|
|
@ -7,6 +9,7 @@ export enum operadores {
|
||||||
"<=" = "<=",
|
"<=" = "<=",
|
||||||
like = "like",
|
like = "like",
|
||||||
in = "in",
|
in = "in",
|
||||||
|
isNull = "isNull",
|
||||||
}
|
}
|
||||||
|
|
||||||
export type tipoFiltro = {
|
export type tipoFiltro = {
|
||||||
|
|
@ -26,3 +29,22 @@ export type interfaceConsulta = {
|
||||||
apenasConsulta?: boolean
|
apenasConsulta?: boolean
|
||||||
apenasContagem?: boolean
|
apenasContagem?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const zOperadores = z.enum([
|
||||||
|
"=",
|
||||||
|
"!=",
|
||||||
|
">",
|
||||||
|
">=",
|
||||||
|
"<",
|
||||||
|
"<=",
|
||||||
|
"like",
|
||||||
|
"in",
|
||||||
|
"isNull",
|
||||||
|
])
|
||||||
|
|
||||||
|
export const zFiltro = z.object({
|
||||||
|
coluna: z.string(),
|
||||||
|
valor: z.any(),
|
||||||
|
operador: zOperadores,
|
||||||
|
ou: z.boolean().optional(),
|
||||||
|
})
|
||||||
|
|
|
||||||
27
src/dayjs.ts
Normal file
27
src/dayjs.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
import dayjs, { type 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
|
||||||
|
|
||||||
|
export type { Dayjs }
|
||||||
|
|
@ -1,11 +1,20 @@
|
||||||
export * from "./aleatorio"
|
export * from "./aleatorio"
|
||||||
|
export * from "./cacheMemoria"
|
||||||
export * from "./constantes"
|
export * from "./constantes"
|
||||||
export * from "./consulta"
|
export * from "./consulta"
|
||||||
|
export * from "./dayjs"
|
||||||
export * from "./ecosistema"
|
export * from "./ecosistema"
|
||||||
export * from "./extensoes"
|
export * from "./extensoes"
|
||||||
|
export * from "./extensoes"
|
||||||
|
export * from "./local"
|
||||||
export * from "./logger"
|
export * from "./logger"
|
||||||
|
export * from "./logger"
|
||||||
|
export * from "./postgres"
|
||||||
|
export * from "./produtos"
|
||||||
|
export * from "./testes-de-variaveis"
|
||||||
export * from "./texto_busca"
|
export * from "./texto_busca"
|
||||||
export * from "./tipagemRotas"
|
export * from "./tipagemRotas"
|
||||||
|
export * from "./tipagemRotas"
|
||||||
export * from "./unidades_medida"
|
export * from "./unidades_medida"
|
||||||
export * from "./uuid"
|
export * from "./uuid"
|
||||||
export * from "./variaveisComuns"
|
export * from "./variaveisComuns"
|
||||||
|
|
|
||||||
57
src/instalarAmbiente.ts
Normal file
57
src/instalarAmbiente.ts
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
import fs from "node:fs"
|
||||||
|
import path from "node:path"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mescla objetos recursivamente.
|
||||||
|
* - Adiciona chaves novas
|
||||||
|
* - Sobrescreve valores primitivos
|
||||||
|
* - Mescla objetos aninhados
|
||||||
|
*/
|
||||||
|
const mesclar = (entrada: any, novo: any): any => {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Lê JSON ou retorna objeto vazio */
|
||||||
|
const abrirJson = (caminho: string) => {
|
||||||
|
try {
|
||||||
|
return JSON.parse(fs.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 = path.join(process.cwd(), ".vscode/settings.json")
|
||||||
|
|
||||||
|
// Garante a pasta .vscode
|
||||||
|
fs.mkdirSync(path.dirname(caminhoSeting), { recursive: true })
|
||||||
|
|
||||||
|
// Mescla e grava
|
||||||
|
const atual = abrirJson(caminhoSeting)
|
||||||
|
const final = mesclar(atual, settings_json)
|
||||||
|
|
||||||
|
fs.writeFileSync(caminhoSeting, JSON.stringify(final, null, 2), "utf8")
|
||||||
|
|
||||||
|
console.log(`✅ Configurações salvas em ${caminhoSeting}`)
|
||||||
38
src/local/index.ts
Normal file
38
src/local/index.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
/**
|
||||||
|
* LocalStorage Tipado
|
||||||
|
* Lê ou grava um valor no localStorage, mantendo o tipo genérico <T>.
|
||||||
|
*/
|
||||||
|
export const localValor = <T>(
|
||||||
|
chave_: string | any,
|
||||||
|
valor?: T | null,
|
||||||
|
): T | null => {
|
||||||
|
const localStorage = globalThis.localStorage
|
||||||
|
|
||||||
|
if (typeof localStorage == "undefined") return null
|
||||||
|
|
||||||
|
const chave =
|
||||||
|
typeof chave_ === "string"
|
||||||
|
? chave_
|
||||||
|
: encodeURIComponent(JSON.stringify(chave_))
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Grava valor se fornecido
|
||||||
|
if (valor !== undefined) {
|
||||||
|
localStorage.setItem(chave, JSON.stringify(valor))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lê valor
|
||||||
|
const v2 = localStorage.getItem(chave)
|
||||||
|
if (v2 === null) return null
|
||||||
|
|
||||||
|
try {
|
||||||
|
return JSON.parse(v2) as T
|
||||||
|
} catch {
|
||||||
|
// Caso o valor não seja JSON válido
|
||||||
|
return v2 as unknown as T
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Em caso de erro de acesso ao localStorage
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
32
src/postgres.ts
Normal file
32
src/postgres.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
/**
|
||||||
|
* Trata um objeto para ser imput para postgres
|
||||||
|
* @param entrada
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const paraObjetoRegistroPg = (entrada: {
|
||||||
|
[k: string]: any
|
||||||
|
}): {
|
||||||
|
[k: string]: string | boolean | null | undefined | number
|
||||||
|
} => {
|
||||||
|
try {
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(entrada).map(([k, v]) => [
|
||||||
|
k,
|
||||||
|
v === undefined || 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ção paraObjetoRegistroPg: ${(error as Error).message} ${(error as Error).stack}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const pgObjeto = paraObjetoRegistroPg
|
||||||
|
export const objetoPg = paraObjetoRegistroPg
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue