Merge branch 'producao'
This commit is contained in:
commit
aa7953e452
53 changed files with 1209 additions and 335 deletions
1
.npmrc
Normal file
1
.npmrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
enable-pre-post-scripts=true
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
"root": false,
|
||||||
"organizeImports": {
|
"$schema": "../node_modules/@biomejs/biome/configuration_schema.json",
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
|
|
@ -11,21 +9,43 @@
|
||||||
"noDoubleEquals": "off",
|
"noDoubleEquals": "off",
|
||||||
"noExplicitAny": "off",
|
"noExplicitAny": "off",
|
||||||
"noDebugger": "off",
|
"noDebugger": "off",
|
||||||
"noApproximativeNumericConstant": "off"
|
"noApproximativeNumericConstant": "off",
|
||||||
|
"noAsyncPromiseExecutor": "off"
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
"noUselessElse": "off"
|
"noUselessElse": "off",
|
||||||
|
"noParameterAssign": "error",
|
||||||
|
"useAsConstAssertion": "error",
|
||||||
|
"useDefaultParameterLast": "error",
|
||||||
|
"useEnumInitializers": "error",
|
||||||
|
"useSelfClosingElements": "error",
|
||||||
|
"useSingleVarDeclarator": "error",
|
||||||
|
"noUnusedTemplateLiteral": "error",
|
||||||
|
"useNumberNamespace": "error",
|
||||||
|
"noInferrableTypes": "error"
|
||||||
},
|
},
|
||||||
"complexity": {
|
"complexity": {
|
||||||
"noBannedTypes": "off",
|
"noBannedTypes": "off",
|
||||||
"noForEach": "off",
|
"noForEach": "off",
|
||||||
"useLiteralKeys": "off"
|
"useLiteralKeys": "off",
|
||||||
|
"noUselessConstructor": "off",
|
||||||
|
"useArrowFunction": "off",
|
||||||
|
"useDateNow":"off",
|
||||||
|
"noUselessFragments":"off"
|
||||||
},
|
},
|
||||||
"correctness": {
|
"correctness": {
|
||||||
"noEmptyPattern": "off"
|
"noEmptyPattern": "off",
|
||||||
|
"noUnusedVariables": "error",
|
||||||
|
"noUnusedImports": "off",
|
||||||
|
"useExhaustiveDependencies":"off"
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
"performance": {
|
"performance": {
|
||||||
"noAccumulatingSpread": "off"
|
"noAccumulatingSpread": "off"
|
||||||
|
},
|
||||||
|
"a11y": {
|
||||||
|
"useSemanticElements": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -40,7 +60,7 @@
|
||||||
"arrowParentheses": "always",
|
"arrowParentheses": "always",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"bracketSameLine": false,
|
"bracketSameLine": false,
|
||||||
"trailingComma": "all",
|
"trailingCommas": "all",
|
||||||
"attributePosition": "multiline"
|
"attributePosition": "multiline"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
biome.json
20
biome.json
|
|
@ -1,7 +1,21 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
|
||||||
"extends": ["Documentos/biome.json"],
|
"extends": ["Documentos/biome.json"],
|
||||||
"files": {
|
"files": {},
|
||||||
"ignore": []
|
"linter": {
|
||||||
|
"rules": {
|
||||||
|
"style": {
|
||||||
|
"noParameterAssign": "error",
|
||||||
|
"useAsConstAssertion": "error",
|
||||||
|
"useDefaultParameterLast": "error",
|
||||||
|
"useEnumInitializers": "error",
|
||||||
|
"useSelfClosingElements": "error",
|
||||||
|
"useSingleVarDeclarator": "error",
|
||||||
|
"noUnusedTemplateLiteral": "error",
|
||||||
|
"useNumberNamespace": "error",
|
||||||
|
"noInferrableTypes": "error",
|
||||||
|
"noUselessElse": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
48
dist/autorizacoes/auntenticacaoResiduos.d.ts
vendored
48
dist/autorizacoes/auntenticacaoResiduos.d.ts
vendored
|
|
@ -1,48 +0,0 @@
|
||||||
import { z } from "zod";
|
|
||||||
export declare const InterfaceAuntenticacao: z.ZodObject<{
|
|
||||||
codigo_usuario: z.ZodString;
|
|
||||||
nome_usuario: z.ZodString;
|
|
||||||
email_usuario: z.ZodString;
|
|
||||||
documento_usuario: z.ZodString;
|
|
||||||
organizacao: z.ZodString;
|
|
||||||
rotas: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
||||||
sistema: z.ZodString;
|
|
||||||
sistema_cor: z.ZodString;
|
|
||||||
sistema_nome: z.ZodString;
|
|
||||||
sistema_logo: z.ZodString;
|
|
||||||
/** as url de integração serão armazenadas pelo sistema resíduos e identificado pelo código do token */
|
|
||||||
codigo_token: z.ZodString;
|
|
||||||
url_usuarios: z.ZodString;
|
|
||||||
url_empreendedores: z.ZodString;
|
|
||||||
url_empreendimentos: z.ZodString;
|
|
||||||
}, "strip", z.ZodTypeAny, {
|
|
||||||
codigo_usuario?: string;
|
|
||||||
nome_usuario?: string;
|
|
||||||
email_usuario?: string;
|
|
||||||
documento_usuario?: string;
|
|
||||||
organizacao?: string;
|
|
||||||
rotas?: {};
|
|
||||||
sistema?: string;
|
|
||||||
sistema_cor?: string;
|
|
||||||
sistema_nome?: string;
|
|
||||||
sistema_logo?: string;
|
|
||||||
codigo_token?: string;
|
|
||||||
url_usuarios?: string;
|
|
||||||
url_empreendedores?: string;
|
|
||||||
url_empreendimentos?: string;
|
|
||||||
}, {
|
|
||||||
codigo_usuario?: string;
|
|
||||||
nome_usuario?: string;
|
|
||||||
email_usuario?: string;
|
|
||||||
documento_usuario?: string;
|
|
||||||
organizacao?: string;
|
|
||||||
rotas?: {};
|
|
||||||
sistema?: string;
|
|
||||||
sistema_cor?: string;
|
|
||||||
sistema_nome?: string;
|
|
||||||
sistema_logo?: string;
|
|
||||||
codigo_token?: string;
|
|
||||||
url_usuarios?: string;
|
|
||||||
url_empreendedores?: string;
|
|
||||||
url_empreendimentos?: string;
|
|
||||||
}>;
|
|
||||||
25
dist/autorizacoes/auntenticacaoResiduos.js
vendored
25
dist/autorizacoes/auntenticacaoResiduos.js
vendored
|
|
@ -1,25 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.InterfaceAuntenticacao = void 0;
|
|
||||||
const zod_1 = require("zod");
|
|
||||||
exports.InterfaceAuntenticacao = zod_1.z.object({
|
|
||||||
// usuários
|
|
||||||
codigo_usuario: zod_1.z.string().uuid(),
|
|
||||||
nome_usuario: zod_1.z.string(),
|
|
||||||
email_usuario: zod_1.z.string(),
|
|
||||||
documento_usuario: zod_1.z.string(),
|
|
||||||
organizacao: zod_1.z.string(),
|
|
||||||
rotas: zod_1.z.object({}),
|
|
||||||
// Dados do sistema
|
|
||||||
sistema: zod_1.z.string(),
|
|
||||||
sistema_cor: zod_1.z.string(),
|
|
||||||
sistema_nome: zod_1.z.string(),
|
|
||||||
sistema_logo: zod_1.z.string(),
|
|
||||||
// integrações
|
|
||||||
/** as url de integração serão armazenadas pelo sistema resíduos e identificado pelo código do token */
|
|
||||||
codigo_token: zod_1.z.string(),
|
|
||||||
url_usuarios: zod_1.z.string().url(),
|
|
||||||
url_empreendedores: zod_1.z.string().url(),
|
|
||||||
url_empreendimentos: zod_1.z.string().url(),
|
|
||||||
});
|
|
||||||
//# sourceMappingURL=auntenticacaoResiduos.js.map
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"auntenticacaoResiduos.js","sourceRoot":"","sources":["../../src/autorizacoes/auntenticacaoResiduos.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,WAAW;IAEX,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACjC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE;IAC7B,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IAEnB,mBAAmB;IACnB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IAExB,cAAc;IAEd,uGAAuG;IACvG,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC9B,kBAAkB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACpC,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;CACtC,CAAC,CAAA"}
|
|
||||||
2
dist/autorizacoes/index.d.ts
vendored
2
dist/autorizacoes/index.d.ts
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
/** Sistemas vão conversar por meio de autorizações tipar eles aqui */
|
|
||||||
export * from "./auntenticacaoResiduos";
|
|
||||||
19
dist/autorizacoes/index.js
vendored
19
dist/autorizacoes/index.js
vendored
|
|
@ -1,19 +0,0 @@
|
||||||
"use strict";
|
|
||||||
/** Sistemas vão conversar por meio de autorizações tipar eles aqui */
|
|
||||||
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("./auntenticacaoResiduos"), exports);
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
||||||
1
dist/autorizacoes/index.js.map
vendored
1
dist/autorizacoes/index.js.map
vendored
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/autorizacoes/index.ts"],"names":[],"mappings":";AAAA,sEAAsE;;;;;;;;;;;;;;;;AAEtE,0DAAuC"}
|
|
||||||
7
dist/constantes.d.ts
vendored
7
dist/constantes.d.ts
vendored
|
|
@ -6,9 +6,14 @@ export declare enum camposComuns {
|
||||||
data_hora_criacao = "data_hora_criacao",
|
data_hora_criacao = "data_hora_criacao",
|
||||||
data_hora_atualizacao = "data_hora_atualizacao",
|
data_hora_atualizacao = "data_hora_atualizacao",
|
||||||
codigo_usuario_criacao = "codigo_usuario_criacao",
|
codigo_usuario_criacao = "codigo_usuario_criacao",
|
||||||
codigo_usuario_atualizacao = "codigo_usuario_atualizacao"
|
codigo_usuario_atualizacao = "codigo_usuario_atualizacao",
|
||||||
|
versao = "versao"
|
||||||
}
|
}
|
||||||
/** Palavras comumente usadas */
|
/** Palavras comumente usadas */
|
||||||
export declare enum tx {
|
export declare enum tx {
|
||||||
token = "token"
|
token = "token"
|
||||||
}
|
}
|
||||||
|
export declare enum tipoUsuarioResiduos {
|
||||||
|
Usuario = "usuario",
|
||||||
|
Fornecedor = "fornecedor"
|
||||||
|
}
|
||||||
|
|
|
||||||
8
dist/constantes.js
vendored
8
dist/constantes.js
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.tx = exports.camposComuns = exports.uuid_null = void 0;
|
exports.tipoUsuarioResiduos = exports.tx = exports.camposComuns = exports.uuid_null = void 0;
|
||||||
exports.uuid_null = "00000000-0000-0000-0000-000000000000";
|
exports.uuid_null = "00000000-0000-0000-0000-000000000000";
|
||||||
/** Colunas Presentes n maioria das tabelas */
|
/** Colunas Presentes n maioria das tabelas */
|
||||||
var camposComuns;
|
var camposComuns;
|
||||||
|
|
@ -11,10 +11,16 @@ var camposComuns;
|
||||||
camposComuns["data_hora_atualizacao"] = "data_hora_atualizacao";
|
camposComuns["data_hora_atualizacao"] = "data_hora_atualizacao";
|
||||||
camposComuns["codigo_usuario_criacao"] = "codigo_usuario_criacao";
|
camposComuns["codigo_usuario_criacao"] = "codigo_usuario_criacao";
|
||||||
camposComuns["codigo_usuario_atualizacao"] = "codigo_usuario_atualizacao";
|
camposComuns["codigo_usuario_atualizacao"] = "codigo_usuario_atualizacao";
|
||||||
|
camposComuns["versao"] = "versao";
|
||||||
})(camposComuns || (exports.camposComuns = camposComuns = {}));
|
})(camposComuns || (exports.camposComuns = camposComuns = {}));
|
||||||
/** Palavras comumente usadas */
|
/** Palavras comumente usadas */
|
||||||
var tx;
|
var tx;
|
||||||
(function (tx) {
|
(function (tx) {
|
||||||
tx["token"] = "token";
|
tx["token"] = "token";
|
||||||
})(tx || (exports.tx = tx = {}));
|
})(tx || (exports.tx = tx = {}));
|
||||||
|
var tipoUsuarioResiduos;
|
||||||
|
(function (tipoUsuarioResiduos) {
|
||||||
|
tipoUsuarioResiduos["Usuario"] = "usuario";
|
||||||
|
tipoUsuarioResiduos["Fornecedor"] = "fornecedor";
|
||||||
|
})(tipoUsuarioResiduos || (exports.tipoUsuarioResiduos = tipoUsuarioResiduos = {}));
|
||||||
//# sourceMappingURL=constantes.js.map
|
//# sourceMappingURL=constantes.js.map
|
||||||
2
dist/constantes.js.map
vendored
2
dist/constantes.js.map
vendored
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"constantes.js","sourceRoot":"","sources":["../src/constantes.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,sCAAsC,CAAA;AAE/D,8CAA8C;AAC9C,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,uDAAuC,CAAA;IACvC,+DAA+C,CAAA;IAC/C,iEAAiD,CAAA;IACjD,yEAAyD,CAAA;AAC3D,CAAC,EAPW,YAAY,4BAAZ,YAAY,QAOvB;AAED,gCAAgC;AAChC,IAAY,EAEX;AAFD,WAAY,EAAE;IACZ,qBAAe,CAAA;AACjB,CAAC,EAFW,EAAE,kBAAF,EAAE,QAEb"}
|
{"version":3,"file":"constantes.js","sourceRoot":"","sources":["../src/constantes.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,sCAAsC,CAAA;AAE/D,8CAA8C;AAC9C,IAAY,YAQX;AARD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,uDAAuC,CAAA;IACvC,+DAA+C,CAAA;IAC/C,iEAAiD,CAAA;IACjD,yEAAyD,CAAA;IACzD,iCAAiB,CAAA;AACnB,CAAC,EARW,YAAY,4BAAZ,YAAY,QAQvB;AAED,gCAAgC;AAChC,IAAY,EAEX;AAFD,WAAY,EAAE;IACZ,qBAAe,CAAA;AACjB,CAAC,EAFW,EAAE,kBAAF,EAAE,QAEb;AAED,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,gDAAyB,CAAA;AAC3B,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B"}
|
||||||
13
dist/extensoes.d.ts
vendored
Normal file
13
dist/extensoes.d.ts
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
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 {};
|
||||||
173
dist/extensoes.js
vendored
Normal file
173
dist/extensoes.js
vendored
Normal file
|
|
@ -0,0 +1,173 @@
|
||||||
|
"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;
|
||||||
|
//# sourceMappingURL=extensoes.js.map
|
||||||
1
dist/extensoes.js.map
vendored
Normal file
1
dist/extensoes.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"extensoes.js","sourceRoot":"","sources":["../src/extensoes.ts"],"names":[],"mappings":"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"}
|
||||||
10
dist/index.d.ts
vendored
10
dist/index.d.ts
vendored
|
|
@ -1,9 +1,11 @@
|
||||||
export * from "./autorizacoes";
|
export * from "./aleatorio";
|
||||||
export * from "./constantes";
|
export * from "./constantes";
|
||||||
export * from "./consulta";
|
export * from "./consulta";
|
||||||
export * from "./aleatorio";
|
export * from "./ecosistema";
|
||||||
|
export * from "./extensoes";
|
||||||
|
export * from "./logger";
|
||||||
export * from "./texto_busca";
|
export * from "./texto_busca";
|
||||||
|
export * from "./tipagemRotas";
|
||||||
export * from "./unidades_medida";
|
export * from "./unidades_medida";
|
||||||
export * from "./uuid";
|
export * from "./uuid";
|
||||||
export * from "./provedores";
|
export * from "./variaveisComuns";
|
||||||
export * from "./ecosistema";
|
|
||||||
|
|
|
||||||
10
dist/index.js
vendored
10
dist/index.js
vendored
|
|
@ -14,13 +14,15 @@ 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);
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
__exportStar(require("./autorizacoes"), exports);
|
__exportStar(require("./aleatorio"), exports);
|
||||||
__exportStar(require("./constantes"), exports);
|
__exportStar(require("./constantes"), exports);
|
||||||
__exportStar(require("./consulta"), exports);
|
__exportStar(require("./consulta"), exports);
|
||||||
__exportStar(require("./aleatorio"), exports);
|
__exportStar(require("./ecosistema"), exports);
|
||||||
|
__exportStar(require("./extensoes"), exports);
|
||||||
|
__exportStar(require("./logger"), exports);
|
||||||
__exportStar(require("./texto_busca"), exports);
|
__exportStar(require("./texto_busca"), exports);
|
||||||
|
__exportStar(require("./tipagemRotas"), exports);
|
||||||
__exportStar(require("./unidades_medida"), exports);
|
__exportStar(require("./unidades_medida"), exports);
|
||||||
__exportStar(require("./uuid"), exports);
|
__exportStar(require("./uuid"), exports);
|
||||||
__exportStar(require("./provedores"), exports);
|
__exportStar(require("./variaveisComuns"), exports);
|
||||||
__exportStar(require("./ecosistema"), exports);
|
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,+CAA4B;AAC5B,6CAA0B;AAC1B,8CAA2B;AAC3B,gDAA6B;AAC7B,oDAAiC;AACjC,yCAAsB;AACtB,+CAA4B;AAC5B,+CAA4B"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,+CAA4B;AAC5B,6CAA0B;AAC1B,+CAA4B;AAC5B,8CAA2B;AAC3B,2CAAwB;AACxB,gDAA6B;AAC7B,iDAA8B;AAC9B,oDAAiC;AACjC,yCAAsB;AACtB,oDAAiC"}
|
||||||
40
dist/logger.d.ts
vendored
Normal file
40
dist/logger.d.ts
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
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 {};
|
||||||
70
dist/logger.js
vendored
Normal file
70
dist/logger.js
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
"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;
|
||||||
|
//# sourceMappingURL=logger.js.map
|
||||||
1
dist/logger.js.map
vendored
Normal file
1
dist/logger.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"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"}
|
||||||
4
dist/provedores.d.ts
vendored
4
dist/provedores.d.ts
vendored
|
|
@ -1,4 +0,0 @@
|
||||||
export declare enum provedores {
|
|
||||||
"betha-sistemas" = "Betha Sistemas",
|
|
||||||
"e-licencie" = "e-licencie"
|
|
||||||
}
|
|
||||||
9
dist/provedores.js
vendored
9
dist/provedores.js
vendored
|
|
@ -1,9 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.provedores = void 0;
|
|
||||||
var provedores;
|
|
||||||
(function (provedores) {
|
|
||||||
provedores["betha-sistemas"] = "Betha Sistemas";
|
|
||||||
provedores["e-licencie"] = "e-licencie";
|
|
||||||
})(provedores || (exports.provedores = provedores = {}));
|
|
||||||
//# sourceMappingURL=provedores.js.map
|
|
||||||
1
dist/provedores.js.map
vendored
1
dist/provedores.js.map
vendored
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"provedores.js","sourceRoot":"","sources":["../src/provedores.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,+CAAmC,CAAA;IACnC,uCAA2B,CAAA;AAC7B,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB"}
|
|
||||||
1
dist/teste.d.ts
vendored
Normal file
1
dist/teste.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
||||||
11
dist/teste.js
vendored
Normal file
11
dist/teste.js
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
"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)));
|
||||||
|
//# sourceMappingURL=teste.js.map
|
||||||
1
dist/teste.js.map
vendored
Normal file
1
dist/teste.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"teste.js","sourceRoot":"","sources":["../src/teste.ts"],"names":[],"mappings":";;AAAA,qCAAiC;AAEjC,MAAM,CAAC,GAAG,IAAA,eAAM,EAAC,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;AAEnD,MAAM,EAAE,GAAG,CAAC,CAAC;IACX,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,UAAU;CACpB,CAAC,CAAA;AAEF,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACnE,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAC/C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAC/B,CAAA"}
|
||||||
1
dist/texto_busca.js
vendored
1
dist/texto_busca.js
vendored
|
|
@ -7,7 +7,6 @@ const texto_busca = (...texto) => texto
|
||||||
? ""
|
? ""
|
||||||
: String(txt)
|
: String(txt)
|
||||||
.normalize("NFD")
|
.normalize("NFD")
|
||||||
// biome-ignore lint/suspicious/noMisleadingCharacterClass: <explanation>
|
|
||||||
.replace(/[\u0300-\u036f]/g, "")
|
.replace(/[\u0300-\u036f]/g, "")
|
||||||
.replace(/\s+/g, " ")
|
.replace(/\s+/g, " ")
|
||||||
.toLowerCase())
|
.toLowerCase())
|
||||||
|
|
|
||||||
2
dist/texto_busca.js.map
vendored
2
dist/texto_busca.js.map
vendored
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"texto_busca.js","sourceRoot":"","sources":["../src/texto_busca.ts"],"names":[],"mappings":";AAAA,wEAAwE;;;AAEjE,MAAM,WAAW,GAAG,CAAC,GAAG,KAAY,EAAU,EAAE,CACrD,KAAK;KACF,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACX,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS;IAC/B,CAAC,CAAC,EAAE;IACJ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACR,SAAS,CAAC,KAAK,CAAC;QACjB,yEAAyE;SACxE,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;SAC/B,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,WAAW,EAAE,CACrB;KACA,IAAI,CAAC,GAAG,CAAC,CAAA;AAZD,QAAA,WAAW,eAYV"}
|
{"version":3,"file":"texto_busca.js","sourceRoot":"","sources":["../src/texto_busca.ts"],"names":[],"mappings":";AAAA,wEAAwE;;;AAEjE,MAAM,WAAW,GAAG,CAAC,GAAG,KAAY,EAAU,EAAE,CACrD,KAAK;KACF,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACX,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS;IAC/B,CAAC,CAAC,EAAE;IACJ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACR,SAAS,CAAC,KAAK,CAAC;SAChB,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;SAC/B,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,WAAW,EAAE,CACrB;KACA,IAAI,CAAC,GAAG,CAAC,CAAA;AAXD,QAAA,WAAW,eAWV"}
|
||||||
49
dist/tipagemRotas.d.ts
vendored
Normal file
49
dist/tipagemRotas.d.ts
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
/** 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>;
|
||||||
|
}
|
||||||
92
dist/tipagemRotas.js
vendored
Normal file
92
dist/tipagemRotas.js
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
"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;
|
||||||
|
//# sourceMappingURL=tipagemRotas.js.map
|
||||||
1
dist/tipagemRotas.js.map
vendored
Normal file
1
dist/tipagemRotas.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"tipagemRotas.js","sourceRoot":"","sources":["../src/tipagemRotas.ts"],"names":[],"mappings":"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"}
|
||||||
22
dist/unidades_medida.d.ts
vendored
22
dist/unidades_medida.d.ts
vendored
|
|
@ -1,7 +1,23 @@
|
||||||
|
/**
|
||||||
|
* 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: {
|
export declare const unidades_medida: {
|
||||||
unidade: string;
|
sigla_unidade: keyof typeof siglas_unidades_medida;
|
||||||
nome: string;
|
nome: string;
|
||||||
unidade_normalizada: string;
|
sigla_normalizada: keyof typeof siglas_unidades_medida;
|
||||||
normalizar: (valor: number) => number;
|
normalizar: (valor: number) => number;
|
||||||
tipo: "massa" | "volume" | "comprimento";
|
tipo: "massa" | "volume" | "comprimento" | "unidade";
|
||||||
}[];
|
}[];
|
||||||
|
|
|
||||||
75
dist/unidades_medida.js
vendored
75
dist/unidades_medida.js
vendored
|
|
@ -1,76 +1,65 @@
|
||||||
"use strict";
|
"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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.unidades_medida = void 0;
|
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 = [
|
exports.unidades_medida = [
|
||||||
{
|
{
|
||||||
unidade: "kg",
|
sigla_unidade: "KG",
|
||||||
nome: "Quilograma",
|
nome: "Quilograma",
|
||||||
unidade_normalizada: "kg",
|
sigla_normalizada: "KG",
|
||||||
normalizar: (valor) => valor,
|
normalizar: (valor) => valor,
|
||||||
tipo: "massa",
|
tipo: "massa",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "g",
|
sigla_unidade: "g",
|
||||||
nome: "Grama",
|
nome: "Grama",
|
||||||
unidade_normalizada: "kg",
|
sigla_normalizada: "KG",
|
||||||
normalizar: (valor) => valor / 1000,
|
normalizar: (valor) => valor / 1000,
|
||||||
tipo: "massa",
|
tipo: "massa",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "ton",
|
sigla_unidade: "TON",
|
||||||
nome: "Tonelada",
|
nome: "Tonelada",
|
||||||
unidade_normalizada: "kg",
|
sigla_normalizada: "KG",
|
||||||
normalizar: (valor) => valor * 1000,
|
normalizar: (valor) => valor * 1000,
|
||||||
tipo: "massa",
|
tipo: "massa",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "L",
|
sigla_unidade: "Lt",
|
||||||
nome: "Litro",
|
nome: "Litro",
|
||||||
unidade_normalizada: "L",
|
sigla_normalizada: "Lt",
|
||||||
normalizar: (valor) => valor,
|
normalizar: (valor) => valor,
|
||||||
tipo: "volume",
|
tipo: "volume",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "m3",
|
sigla_unidade: "M³",
|
||||||
nome: "Metro Cúbico",
|
nome: "Metro Cúbico",
|
||||||
unidade_normalizada: "L",
|
sigla_normalizada: "Lt",
|
||||||
normalizar: (valor) => valor * 1000,
|
normalizar: (valor) => valor * 1000,
|
||||||
tipo: "volume",
|
tipo: "volume",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "mL",
|
sigla_unidade: "UN",
|
||||||
nome: "Mililitro",
|
nome: "Unidade",
|
||||||
unidade_normalizada: "L",
|
sigla_normalizada: "UN",
|
||||||
normalizar: (valor) => valor / 1000,
|
|
||||||
tipo: "volume",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
unidade: "cm",
|
|
||||||
nome: "Centímetro",
|
|
||||||
unidade_normalizada: "m",
|
|
||||||
normalizar: (valor) => valor / 100,
|
|
||||||
tipo: "comprimento",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
unidade: "mm",
|
|
||||||
nome: "Milímetro",
|
|
||||||
unidade_normalizada: "m",
|
|
||||||
normalizar: (valor) => valor / 1000,
|
|
||||||
tipo: "comprimento",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
unidade: "m",
|
|
||||||
nome: "Metro",
|
|
||||||
unidade_normalizada: "m",
|
|
||||||
normalizar: (valor) => valor,
|
normalizar: (valor) => valor,
|
||||||
tipo: "comprimento",
|
tipo: "unidade",
|
||||||
},
|
|
||||||
{
|
|
||||||
unidade: "km",
|
|
||||||
nome: "Quilômetro",
|
|
||||||
unidade_normalizada: "m",
|
|
||||||
normalizar: (valor) => valor * 1000,
|
|
||||||
tipo: "comprimento",
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
//# sourceMappingURL=unidades_medida.js.map
|
//# sourceMappingURL=unidades_medida.js.map
|
||||||
2
dist/unidades_medida.js.map
vendored
2
dist/unidades_medida.js.map
vendored
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"unidades_medida.js","sourceRoot":"","sources":["../src/unidades_medida.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAMtB;IACJ;QACE,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,YAAY;QAClB,mBAAmB,EAAE,IAAI;QACzB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK;QACpC,IAAI,EAAE,OAAO;KACd;IACD;QACE,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,OAAO;QACb,mBAAmB,EAAE,IAAI;QACzB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;QAC3C,IAAI,EAAE,OAAO;KACd;IACD;QACE,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,UAAU;QAChB,mBAAmB,EAAE,IAAI;QACzB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;QAC3C,IAAI,EAAE,OAAO;KACd;IACD;QACE,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,OAAO;QACb,mBAAmB,EAAE,GAAG;QACxB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK;QACpC,IAAI,EAAE,QAAQ;KACf;IACD;QACE,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,cAAc;QACpB,mBAAmB,EAAE,GAAG;QACxB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;QAC3C,IAAI,EAAE,QAAQ;KACf;IACD;QACE,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,WAAW;QACjB,mBAAmB,EAAE,GAAG;QACxB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;QAC3C,IAAI,EAAE,QAAQ;KACf;IACD;QACE,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,YAAY;QAClB,mBAAmB,EAAE,GAAG;QACxB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,GAAG;QAC1C,IAAI,EAAE,aAAa;KACpB;IACD;QACE,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,WAAW;QACjB,mBAAmB,EAAE,GAAG;QACxB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;QAC3C,IAAI,EAAE,aAAa;KACpB;IACD;QACE,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,OAAO;QACb,mBAAmB,EAAE,GAAG;QACxB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK;QACpC,IAAI,EAAE,aAAa;KACpB;IACD;QACE,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,YAAY;QAClB,mBAAmB,EAAE,GAAG;QACxB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;QAC3C,IAAI,EAAE,aAAa;KACpB;CACF,CAAA"}
|
{"version":3,"file":"unidades_medida.js","sourceRoot":"","sources":["../src/unidades_medida.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,IAAY,sBASX;AATD,WAAY,sBAAsB;IAChC,mCAAS,CAAA;IAET,mCAAS,CAAA;IACT,qCAAW,CAAA;IACX,iCAAO,CAAA;IAEP,6CAAW,CAAA;IACX,mCAAS,CAAA;AACX,CAAC,EATW,sBAAsB,sCAAtB,sBAAsB,QASjC;AAEY,QAAA,eAAe,GAMtB;IACJ;QACE,aAAa,EAAE,IAAI;QACnB,IAAI,EAAE,YAAY;QAClB,iBAAiB,EAAE,IAAI;QACvB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK;QACpC,IAAI,EAAE,OAAO;KACd;IACD;QACE,aAAa,EAAE,GAAG;QAClB,IAAI,EAAE,OAAO;QACb,iBAAiB,EAAE,IAAI;QACvB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;QAC3C,IAAI,EAAE,OAAO;KACd;IACD;QACE,aAAa,EAAE,KAAK;QACpB,IAAI,EAAE,UAAU;QAChB,iBAAiB,EAAE,IAAI;QACvB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;QAC3C,IAAI,EAAE,OAAO;KACd;IACD;QACE,aAAa,EAAE,IAAI;QACnB,IAAI,EAAE,OAAO;QACb,iBAAiB,EAAE,IAAI;QACvB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK;QACpC,IAAI,EAAE,QAAQ;KACf;IACD;QACE,aAAa,EAAE,IAAI;QACnB,IAAI,EAAE,cAAc;QACpB,iBAAiB,EAAE,IAAI;QACvB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;QAC3C,IAAI,EAAE,QAAQ;KACf;IACD;QACE,aAAa,EAAE,IAAI;QACnB,IAAI,EAAE,SAAS;QACf,iBAAiB,EAAE,IAAI;QACvB,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK;QACpC,IAAI,EAAE,SAAS;KAChB;CACF,CAAA"}
|
||||||
10
dist/variaveisComuns.d.ts
vendored
10
dist/variaveisComuns.d.ts
vendored
|
|
@ -1 +1,11 @@
|
||||||
export declare const esperar: (ms: number) => Promise<true>;
|
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;
|
||||||
|
|
|
||||||
11
dist/variaveisComuns.js
vendored
11
dist/variaveisComuns.js
vendored
|
|
@ -1,6 +1,15 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.esperar = void 0;
|
exports.nomeVariavel = exports.esperar = void 0;
|
||||||
const esperar = (ms) => new Promise((resolve) => setTimeout(() => resolve(true), ms));
|
const esperar = (ms) => new Promise((resolve) => setTimeout(() => resolve(true), ms));
|
||||||
exports.esperar = esperar;
|
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;
|
||||||
//# sourceMappingURL=variaveisComuns.js.map
|
//# sourceMappingURL=variaveisComuns.js.map
|
||||||
2
dist/variaveisComuns.js.map
vendored
2
dist/variaveisComuns.js.map
vendored
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"variaveisComuns.js","sourceRoot":"","sources":["../src/variaveisComuns.ts"],"names":[],"mappings":";;;AAAO,MAAM,OAAO,GAAG,CAAC,EAAU,EAAiB,EAAE,CACnD,IAAI,OAAO,CAAC,CAAC,OAA0B,EAAE,EAAE,CACzC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CACpC,CAAA;AAHU,QAAA,OAAO,WAGjB"}
|
{"version":3,"file":"variaveisComuns.js","sourceRoot":"","sources":["../src/variaveisComuns.ts"],"names":[],"mappings":";;;AAAO,MAAM,OAAO,GAAG,CAAC,EAAU,EAAiB,EAAE,CACnD,IAAI,OAAO,CAAC,CAAC,OAA0B,EAAE,EAAE,CACzC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CACpC,CAAA;AAHU,QAAA,OAAO,WAGjB;AACH;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAAC,CAAyB,EAAE,EAAE,CACxD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AADb,QAAA,YAAY,gBACC"}
|
||||||
22
package.json
22
package.json
|
|
@ -1,22 +1,26 @@
|
||||||
{
|
{
|
||||||
"name": "p-comuns",
|
"name": "p-comuns",
|
||||||
"version": "0.26.0",
|
"version": "0.115.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rm -rf ./dist && pnpm run biome && npm --no-git-tag-version version minor && tsc",
|
"build": "rm -rf ./dist && pnpm run biome && npm --no-git-tag-version version minor && tsc",
|
||||||
"biome": "npx @biomejs/biome check --apply ./src"
|
"biome": "npx @biomejs/biome check --write ./src",
|
||||||
|
"at": "pnpm up @biomejs/biome typescript"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "AZTECA SOFTWARE LTDA",
|
||||||
|
"email": "ti@e-licencie.com.br",
|
||||||
|
"url": "https://e-licencie.com.br"
|
||||||
},
|
},
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"zod": "3.23.8"
|
"cross-fetch": "^4.1.0",
|
||||||
|
"zod": "3.24.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.7.3",
|
"@biomejs/biome": "^2.0.6",
|
||||||
"@types/node": "^20.12.5"
|
"@types/node": "^20.16.10",
|
||||||
},
|
"typescript": "^5.7.2"
|
||||||
"peerDependencies": {
|
|
||||||
"typescript": "^5.0.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
157
pnpm-lock.yaml
generated
157
pnpm-lock.yaml
generated
|
|
@ -8,132 +8,175 @@ importers:
|
||||||
|
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
typescript:
|
cross-fetch:
|
||||||
specifier: ^5.0.0
|
specifier: ^4.1.0
|
||||||
version: 5.4.4
|
version: 4.1.0
|
||||||
zod:
|
zod:
|
||||||
specifier: 3.23.8
|
specifier: 3.24.1
|
||||||
version: 3.23.8
|
version: 3.24.1
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@biomejs/biome':
|
'@biomejs/biome':
|
||||||
specifier: 1.7.3
|
specifier: ^2.0.6
|
||||||
version: 1.7.3
|
version: 2.0.6
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^20.12.5
|
specifier: ^20.16.10
|
||||||
version: 20.12.5
|
version: 20.19.4
|
||||||
|
typescript:
|
||||||
|
specifier: ^5.7.2
|
||||||
|
version: 5.8.3
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
'@biomejs/biome@1.7.3':
|
'@biomejs/biome@2.0.6':
|
||||||
resolution: {integrity: sha512-ogFQI+fpXftr+tiahA6bIXwZ7CSikygASdqMtH07J2cUzrpjyTMVc9Y97v23c7/tL1xCZhM+W9k4hYIBm7Q6cQ==}
|
resolution: {integrity: sha512-RRP+9cdh5qwe2t0gORwXaa27oTOiQRQvrFf49x2PA1tnpsyU7FIHX4ZOFMtBC4QNtyWsN7Dqkf5EDbg4X+9iqA==}
|
||||||
engines: {node: '>=14.21.3'}
|
engines: {node: '>=14.21.3'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
'@biomejs/cli-darwin-arm64@1.7.3':
|
'@biomejs/cli-darwin-arm64@2.0.6':
|
||||||
resolution: {integrity: sha512-eDvLQWmGRqrPIRY7AIrkPHkQ3visEItJKkPYSHCscSDdGvKzYjmBJwG1Gu8+QC5ed6R7eiU63LEC0APFBobmfQ==}
|
resolution: {integrity: sha512-AzdiNNjNzsE6LfqWyBvcL29uWoIuZUkndu+wwlXW13EKcBHbbKjNQEZIJKYDc6IL+p7bmWGx3v9ZtcRyIoIz5A==}
|
||||||
engines: {node: '>=14.21.3'}
|
engines: {node: '>=14.21.3'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@biomejs/cli-darwin-x64@1.7.3':
|
'@biomejs/cli-darwin-x64@2.0.6':
|
||||||
resolution: {integrity: sha512-JXCaIseKRER7dIURsVlAJacnm8SG5I0RpxZ4ya3dudASYUc68WGl4+FEN03ABY3KMIq7hcK1tzsJiWlmXyosZg==}
|
resolution: {integrity: sha512-wJjjP4E7bO4WJmiQaLnsdXMa516dbtC6542qeRkyJg0MqMXP0fvs4gdsHhZ7p9XWTAmGIjZHFKXdsjBvKGIJJQ==}
|
||||||
engines: {node: '>=14.21.3'}
|
engines: {node: '>=14.21.3'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@biomejs/cli-linux-arm64-musl@1.7.3':
|
'@biomejs/cli-linux-arm64-musl@2.0.6':
|
||||||
resolution: {integrity: sha512-c8AlO45PNFZ1BYcwaKzdt46kYbuP6xPGuGQ6h4j3XiEDpyseRRUy/h+6gxj07XovmyxKnSX9GSZ6nVbZvcVUAw==}
|
resolution: {integrity: sha512-CVPEMlin3bW49sBqLBg2x016Pws7eUXA27XYDFlEtponD0luYjg2zQaMJ2nOqlkKG9fqzzkamdYxHdMDc2gZFw==}
|
||||||
engines: {node: '>=14.21.3'}
|
engines: {node: '>=14.21.3'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@biomejs/cli-linux-arm64@1.7.3':
|
'@biomejs/cli-linux-arm64@2.0.6':
|
||||||
resolution: {integrity: sha512-phNTBpo7joDFastnmZsFjYcDYobLTx4qR4oPvc9tJ486Bd1SfEVPHEvJdNJrMwUQK56T+TRClOQd/8X1nnjA9w==}
|
resolution: {integrity: sha512-ZSVf6TYo5rNMUHIW1tww+rs/krol7U5A1Is/yzWyHVZguuB0lBnIodqyFuwCNqG9aJGyk7xIMS8HG0qGUPz0SA==}
|
||||||
engines: {node: '>=14.21.3'}
|
engines: {node: '>=14.21.3'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@biomejs/cli-linux-x64-musl@1.7.3':
|
'@biomejs/cli-linux-x64-musl@2.0.6':
|
||||||
resolution: {integrity: sha512-UdEHKtYGWEX3eDmVWvQeT+z05T9/Sdt2+F/7zmMOFQ7boANeX8pcO6EkJPK3wxMudrApsNEKT26rzqK6sZRTRA==}
|
resolution: {integrity: sha512-mKHE/e954hR/hSnAcJSjkf4xGqZc/53Kh39HVW1EgO5iFi0JutTN07TSjEMg616julRtfSNJi0KNyxvc30Y4rQ==}
|
||||||
engines: {node: '>=14.21.3'}
|
engines: {node: '>=14.21.3'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@biomejs/cli-linux-x64@1.7.3':
|
'@biomejs/cli-linux-x64@2.0.6':
|
||||||
resolution: {integrity: sha512-vnedYcd5p4keT3iD48oSKjOIRPYcjSNNbd8MO1bKo9ajg3GwQXZLAH+0Cvlr+eMsO67/HddWmscSQwTFrC/uPA==}
|
resolution: {integrity: sha512-geM1MkHTV1Kh2Cs/Xzot9BOF3WBacihw6bkEmxkz4nSga8B9/hWy5BDiOG3gHDGIBa8WxT0nzsJs2f/hPqQIQw==}
|
||||||
engines: {node: '>=14.21.3'}
|
engines: {node: '>=14.21.3'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@biomejs/cli-win32-arm64@1.7.3':
|
'@biomejs/cli-win32-arm64@2.0.6':
|
||||||
resolution: {integrity: sha512-unNCDqUKjujYkkSxs7gFIfdasttbDC4+z0kYmcqzRk6yWVoQBL4dNLcCbdnJS+qvVDNdI9rHp2NwpQ0WAdla4Q==}
|
resolution: {integrity: sha512-290V4oSFoKaprKE1zkYVsDfAdn0An5DowZ+GIABgjoq1ndhvNxkJcpxPsiYtT7slbVe3xmlT0ncdfOsN7KruzA==}
|
||||||
engines: {node: '>=14.21.3'}
|
engines: {node: '>=14.21.3'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@biomejs/cli-win32-x64@1.7.3':
|
'@biomejs/cli-win32-x64@2.0.6':
|
||||||
resolution: {integrity: sha512-ZmByhbrnmz/UUFYB622CECwhKIPjJLLPr5zr3edhu04LzbfcOrz16VYeNq5dpO1ADG70FORhAJkaIGdaVBG00w==}
|
resolution: {integrity: sha512-bfM1Bce0d69Ao7pjTjUS+AWSZ02+5UHdiAP85Th8e9yV5xzw6JrHXbL5YWlcEKQ84FIZMdDc7ncuti1wd2sdbw==}
|
||||||
engines: {node: '>=14.21.3'}
|
engines: {node: '>=14.21.3'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@types/node@20.12.5':
|
'@types/node@20.19.4':
|
||||||
resolution: {integrity: sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==}
|
resolution: {integrity: sha512-OP+We5WV8Xnbuvw0zC2m4qfB/BJvjyCwtNjhHdJxV1639SGSKrLmJkc3fMnp2Qy8nJyHp8RO6umxELN/dS1/EA==}
|
||||||
|
|
||||||
typescript@5.4.4:
|
cross-fetch@4.1.0:
|
||||||
resolution: {integrity: sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==}
|
resolution: {integrity: sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw==}
|
||||||
|
|
||||||
|
node-fetch@2.7.0:
|
||||||
|
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
|
||||||
|
engines: {node: 4.x || >=6.0.0}
|
||||||
|
peerDependencies:
|
||||||
|
encoding: ^0.1.0
|
||||||
|
peerDependenciesMeta:
|
||||||
|
encoding:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
tr46@0.0.3:
|
||||||
|
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
||||||
|
|
||||||
|
typescript@5.8.3:
|
||||||
|
resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==}
|
||||||
engines: {node: '>=14.17'}
|
engines: {node: '>=14.17'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
undici-types@5.26.5:
|
undici-types@6.21.0:
|
||||||
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
|
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
||||||
|
|
||||||
zod@3.23.8:
|
webidl-conversions@3.0.1:
|
||||||
resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==}
|
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
|
||||||
|
|
||||||
|
whatwg-url@5.0.0:
|
||||||
|
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
|
||||||
|
|
||||||
|
zod@3.24.1:
|
||||||
|
resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==}
|
||||||
|
|
||||||
snapshots:
|
snapshots:
|
||||||
|
|
||||||
'@biomejs/biome@1.7.3':
|
'@biomejs/biome@2.0.6':
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@biomejs/cli-darwin-arm64': 1.7.3
|
'@biomejs/cli-darwin-arm64': 2.0.6
|
||||||
'@biomejs/cli-darwin-x64': 1.7.3
|
'@biomejs/cli-darwin-x64': 2.0.6
|
||||||
'@biomejs/cli-linux-arm64': 1.7.3
|
'@biomejs/cli-linux-arm64': 2.0.6
|
||||||
'@biomejs/cli-linux-arm64-musl': 1.7.3
|
'@biomejs/cli-linux-arm64-musl': 2.0.6
|
||||||
'@biomejs/cli-linux-x64': 1.7.3
|
'@biomejs/cli-linux-x64': 2.0.6
|
||||||
'@biomejs/cli-linux-x64-musl': 1.7.3
|
'@biomejs/cli-linux-x64-musl': 2.0.6
|
||||||
'@biomejs/cli-win32-arm64': 1.7.3
|
'@biomejs/cli-win32-arm64': 2.0.6
|
||||||
'@biomejs/cli-win32-x64': 1.7.3
|
'@biomejs/cli-win32-x64': 2.0.6
|
||||||
|
|
||||||
'@biomejs/cli-darwin-arm64@1.7.3':
|
'@biomejs/cli-darwin-arm64@2.0.6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@biomejs/cli-darwin-x64@1.7.3':
|
'@biomejs/cli-darwin-x64@2.0.6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@biomejs/cli-linux-arm64-musl@1.7.3':
|
'@biomejs/cli-linux-arm64-musl@2.0.6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@biomejs/cli-linux-arm64@1.7.3':
|
'@biomejs/cli-linux-arm64@2.0.6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@biomejs/cli-linux-x64-musl@1.7.3':
|
'@biomejs/cli-linux-x64-musl@2.0.6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@biomejs/cli-linux-x64@1.7.3':
|
'@biomejs/cli-linux-x64@2.0.6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@biomejs/cli-win32-arm64@1.7.3':
|
'@biomejs/cli-win32-arm64@2.0.6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@biomejs/cli-win32-x64@1.7.3':
|
'@biomejs/cli-win32-x64@2.0.6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@types/node@20.12.5':
|
'@types/node@20.19.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: 5.26.5
|
undici-types: 6.21.0
|
||||||
|
|
||||||
typescript@5.4.4: {}
|
cross-fetch@4.1.0:
|
||||||
|
dependencies:
|
||||||
|
node-fetch: 2.7.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- encoding
|
||||||
|
|
||||||
undici-types@5.26.5: {}
|
node-fetch@2.7.0:
|
||||||
|
dependencies:
|
||||||
|
whatwg-url: 5.0.0
|
||||||
|
|
||||||
zod@3.23.8: {}
|
tr46@0.0.3: {}
|
||||||
|
|
||||||
|
typescript@5.8.3: {}
|
||||||
|
|
||||||
|
undici-types@6.21.0: {}
|
||||||
|
|
||||||
|
webidl-conversions@3.0.1: {}
|
||||||
|
|
||||||
|
whatwg-url@5.0.0:
|
||||||
|
dependencies:
|
||||||
|
tr46: 0.0.3
|
||||||
|
webidl-conversions: 3.0.1
|
||||||
|
|
||||||
|
zod@3.24.1: {}
|
||||||
|
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
import { z } from "zod"
|
|
||||||
|
|
||||||
export const InterfaceAuntenticacao = z.object({
|
|
||||||
// usuários
|
|
||||||
|
|
||||||
codigo_usuario: z.string().uuid(),
|
|
||||||
nome_usuario: z.string(),
|
|
||||||
email_usuario: z.string(),
|
|
||||||
documento_usuario: z.string(),
|
|
||||||
organizacao: z.string(),
|
|
||||||
rotas: z.object({}),
|
|
||||||
|
|
||||||
// Dados do sistema
|
|
||||||
sistema: z.string(),
|
|
||||||
sistema_cor: z.string(),
|
|
||||||
sistema_nome: z.string(),
|
|
||||||
sistema_logo: z.string(),
|
|
||||||
|
|
||||||
// integrações
|
|
||||||
|
|
||||||
/** as url de integração serão armazenadas pelo sistema resíduos e identificado pelo código do token */
|
|
||||||
codigo_token: z.string(),
|
|
||||||
url_usuarios: z.string().url(),
|
|
||||||
url_empreendedores: z.string().url(),
|
|
||||||
url_empreendimentos: z.string().url(),
|
|
||||||
})
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
/** Sistemas vão conversar por meio de autorizações tipar eles aqui */
|
|
||||||
|
|
||||||
export * from "./auntenticacaoResiduos"
|
|
||||||
|
|
@ -8,9 +8,15 @@ export enum camposComuns {
|
||||||
data_hora_atualizacao = "data_hora_atualizacao",
|
data_hora_atualizacao = "data_hora_atualizacao",
|
||||||
codigo_usuario_criacao = "codigo_usuario_criacao",
|
codigo_usuario_criacao = "codigo_usuario_criacao",
|
||||||
codigo_usuario_atualizacao = "codigo_usuario_atualizacao",
|
codigo_usuario_atualizacao = "codigo_usuario_atualizacao",
|
||||||
|
versao = "versao",
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Palavras comumente usadas */
|
/** Palavras comumente usadas */
|
||||||
export enum tx {
|
export enum tx {
|
||||||
token = "token",
|
token = "token",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum tipoUsuarioResiduos {
|
||||||
|
Usuario = "usuario",
|
||||||
|
Fornecedor = "fornecedor",
|
||||||
|
}
|
||||||
|
|
|
||||||
177
src/extensoes.ts
Normal file
177
src/extensoes.ts
Normal file
|
|
@ -0,0 +1,177 @@
|
||||||
|
type tiposArquivo = "imagem" | "documento" | "vídeo" | "outros"
|
||||||
|
|
||||||
|
export const extensoes: {
|
||||||
|
ext: string
|
||||||
|
tipo: tiposArquivo
|
||||||
|
mime: string
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
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: string | null | undefined,
|
||||||
|
): tiposArquivo => {
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
10
src/index.ts
10
src/index.ts
|
|
@ -1,9 +1,11 @@
|
||||||
export * from "./autorizacoes"
|
export * from "./aleatorio"
|
||||||
export * from "./constantes"
|
export * from "./constantes"
|
||||||
export * from "./consulta"
|
export * from "./consulta"
|
||||||
export * from "./aleatorio"
|
export * from "./ecosistema"
|
||||||
|
export * from "./extensoes"
|
||||||
|
export * from "./logger"
|
||||||
export * from "./texto_busca"
|
export * from "./texto_busca"
|
||||||
|
export * from "./tipagemRotas"
|
||||||
export * from "./unidades_medida"
|
export * from "./unidades_medida"
|
||||||
export * from "./uuid"
|
export * from "./uuid"
|
||||||
export * from "./provedores"
|
export * from "./variaveisComuns"
|
||||||
export * from "./ecosistema"
|
|
||||||
|
|
|
||||||
126
src/logger.ts
Normal file
126
src/logger.ts
Normal file
|
|
@ -0,0 +1,126 @@
|
||||||
|
import crossFetch from "cross-fetch"
|
||||||
|
import { nomeVariavel } from "./variaveisComuns"
|
||||||
|
|
||||||
|
const LOKI_BASE_URL = "https://log.idz.one"
|
||||||
|
const LOKI_ENDPOINT = "/loki/api/v1/push"
|
||||||
|
export type tipoLokiObjeto = {
|
||||||
|
streams: {
|
||||||
|
stream: {
|
||||||
|
[k: string]: string
|
||||||
|
}
|
||||||
|
values: [string, string][]
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export const postLogger = async ({
|
||||||
|
objeto,
|
||||||
|
}: {
|
||||||
|
objeto: tipoLokiObjeto
|
||||||
|
}): Promise<[objeto: tipoLokiObjeto, erro?: string]> => {
|
||||||
|
const response = await crossFetch(`${LOKI_BASE_URL}${LOKI_ENDPOINT}`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify(objeto),
|
||||||
|
}).catch((a) => a)
|
||||||
|
if (!response.ok) {
|
||||||
|
return [objeto, `Erro ${response.status}: ${await response?.text?.()}`]
|
||||||
|
}
|
||||||
|
return [objeto]
|
||||||
|
}
|
||||||
|
|
||||||
|
let cwd = ""
|
||||||
|
|
||||||
|
/** define a localização da pasta do projeto */
|
||||||
|
export const defineCwd = (novoCwd: string) => {
|
||||||
|
cwd = novoCwd
|
||||||
|
}
|
||||||
|
|
||||||
|
type tipoLevel = "info" | "warn" | "error"
|
||||||
|
|
||||||
|
type tipoOpSessao = {
|
||||||
|
inquilino: string
|
||||||
|
usuario: string
|
||||||
|
parametros?: { [k: string]: string }
|
||||||
|
}
|
||||||
|
|
||||||
|
type tipoLog = {
|
||||||
|
detalhes?: unknown[]
|
||||||
|
__filename?: string
|
||||||
|
local?: string
|
||||||
|
parametros?: { [k: string]: string }
|
||||||
|
}
|
||||||
|
|
||||||
|
export type tipoLoggerLog = (
|
||||||
|
level: tipoLevel,
|
||||||
|
mensagem: string,
|
||||||
|
op_tipoLog?: tipoLog,
|
||||||
|
) => Promise<[objeto: tipoLokiObjeto, erro?: string]>
|
||||||
|
|
||||||
|
export type TipoLoggerSessao = (sess: tipoOpSessao) => tipoLoggerLog
|
||||||
|
|
||||||
|
export type tipoLogger = (amb: {
|
||||||
|
app: string
|
||||||
|
eProducao: boolean
|
||||||
|
parametros?: {
|
||||||
|
[k: string]: string
|
||||||
|
}
|
||||||
|
}) => TipoLoggerSessao
|
||||||
|
|
||||||
|
export const logger: tipoLogger =
|
||||||
|
({ app: app_e, eProducao, parametros: parametrosAmbiente }) =>
|
||||||
|
({ inquilino, usuario, parametros: parametrosSessao }) =>
|
||||||
|
async (level, mensagem, op_tipoLog) => {
|
||||||
|
let {
|
||||||
|
__filename,
|
||||||
|
detalhes,
|
||||||
|
local,
|
||||||
|
parametros: parametrosLog,
|
||||||
|
} = op_tipoLog || {}
|
||||||
|
|
||||||
|
const app = `${eProducao ? "" : "DEV-"}${app_e}`
|
||||||
|
|
||||||
|
if (cwd && __filename) {
|
||||||
|
__filename = __filename.replace(cwd, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (local) {
|
||||||
|
detalhes = [`${nomeVariavel({ local })}="${local}"`, ...(detalhes || [])]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__filename) {
|
||||||
|
detalhes = [
|
||||||
|
`${nomeVariavel({ __filename })}="${__filename}"`,
|
||||||
|
...(detalhes || []),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const timestamp = `${Date.now()}000000`
|
||||||
|
|
||||||
|
const mainLog = detalhes?.length
|
||||||
|
? `${mensagem} | ${detalhes.map((d) => JSON.stringify(d)).join(" | ")}`
|
||||||
|
: mensagem
|
||||||
|
|
||||||
|
const payload: tipoLokiObjeto["streams"][number] = {
|
||||||
|
stream: {
|
||||||
|
app,
|
||||||
|
inquilino,
|
||||||
|
usuario,
|
||||||
|
level,
|
||||||
|
...(parametrosAmbiente || {}),
|
||||||
|
...(parametrosSessao || {}),
|
||||||
|
...(parametrosLog || {}),
|
||||||
|
},
|
||||||
|
values: [
|
||||||
|
[
|
||||||
|
timestamp,
|
||||||
|
mainLog, // Linha de log direta
|
||||||
|
],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
const objeto: tipoLokiObjeto = { streams: [payload] }
|
||||||
|
|
||||||
|
const response = await postLogger({ objeto })
|
||||||
|
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
export enum provedores {
|
|
||||||
"betha-sistemas" = "Betha Sistemas",
|
|
||||||
"e-licencie" = "e-licencie",
|
|
||||||
}
|
|
||||||
13
src/teste.ts
Normal file
13
src/teste.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
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)),
|
||||||
|
)
|
||||||
|
|
@ -7,7 +7,6 @@ export const texto_busca = (...texto: any[]): string =>
|
||||||
? ""
|
? ""
|
||||||
: String(txt)
|
: String(txt)
|
||||||
.normalize("NFD")
|
.normalize("NFD")
|
||||||
// biome-ignore lint/suspicious/noMisleadingCharacterClass: <explanation>
|
|
||||||
.replace(/[\u0300-\u036f]/g, "")
|
.replace(/[\u0300-\u036f]/g, "")
|
||||||
.replace(/\s+/g, " ")
|
.replace(/\s+/g, " ")
|
||||||
.toLowerCase(),
|
.toLowerCase(),
|
||||||
|
|
|
||||||
120
src/tipagemRotas.ts
Normal file
120
src/tipagemRotas.ts
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
/** 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<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)
|
||||||
|
}) {
|
||||||
|
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: string) {
|
||||||
|
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: T, usarComoHash?: boolean) {
|
||||||
|
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: T) {
|
||||||
|
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 } as T
|
||||||
|
}
|
||||||
|
|
||||||
|
return queryObj as Partial<T>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,79 +1,71 @@
|
||||||
|
/**
|
||||||
|
* 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 enum siglas_unidades_medida {
|
||||||
|
UN = "UN",
|
||||||
|
|
||||||
|
KG = "KG",
|
||||||
|
TON = "TON",
|
||||||
|
g = "g",
|
||||||
|
|
||||||
|
"M³" = "M³",
|
||||||
|
Lt = "Lt",
|
||||||
|
}
|
||||||
|
|
||||||
export const unidades_medida: {
|
export const unidades_medida: {
|
||||||
unidade: string
|
sigla_unidade: keyof typeof siglas_unidades_medida
|
||||||
nome: string
|
nome: string
|
||||||
unidade_normalizada: string
|
sigla_normalizada: keyof typeof siglas_unidades_medida
|
||||||
normalizar: (valor: number) => number
|
normalizar: (valor: number) => number
|
||||||
tipo: "massa" | "volume" | "comprimento"
|
tipo: "massa" | "volume" | "comprimento" | "unidade"
|
||||||
}[] = [
|
}[] = [
|
||||||
{
|
{
|
||||||
unidade: "kg",
|
sigla_unidade: "KG",
|
||||||
nome: "Quilograma",
|
nome: "Quilograma",
|
||||||
unidade_normalizada: "kg",
|
sigla_normalizada: "KG",
|
||||||
normalizar: (valor: number) => valor,
|
normalizar: (valor: number) => valor,
|
||||||
tipo: "massa",
|
tipo: "massa",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "g",
|
sigla_unidade: "g",
|
||||||
nome: "Grama",
|
nome: "Grama",
|
||||||
unidade_normalizada: "kg",
|
sigla_normalizada: "KG",
|
||||||
normalizar: (valor: number) => valor / 1000,
|
normalizar: (valor: number) => valor / 1000,
|
||||||
tipo: "massa",
|
tipo: "massa",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "ton",
|
sigla_unidade: "TON",
|
||||||
nome: "Tonelada",
|
nome: "Tonelada",
|
||||||
unidade_normalizada: "kg",
|
sigla_normalizada: "KG",
|
||||||
normalizar: (valor: number) => valor * 1000,
|
normalizar: (valor: number) => valor * 1000,
|
||||||
tipo: "massa",
|
tipo: "massa",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "L",
|
sigla_unidade: "Lt",
|
||||||
nome: "Litro",
|
nome: "Litro",
|
||||||
unidade_normalizada: "L",
|
sigla_normalizada: "Lt",
|
||||||
normalizar: (valor: number) => valor,
|
normalizar: (valor: number) => valor,
|
||||||
tipo: "volume",
|
tipo: "volume",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "m3",
|
sigla_unidade: "M³",
|
||||||
nome: "Metro Cúbico",
|
nome: "Metro Cúbico",
|
||||||
unidade_normalizada: "L",
|
sigla_normalizada: "Lt",
|
||||||
normalizar: (valor: number) => valor * 1000,
|
normalizar: (valor: number) => valor * 1000,
|
||||||
tipo: "volume",
|
tipo: "volume",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "mL",
|
sigla_unidade: "UN",
|
||||||
nome: "Mililitro",
|
nome: "Unidade",
|
||||||
unidade_normalizada: "L",
|
sigla_normalizada: "UN",
|
||||||
normalizar: (valor: number) => valor / 1000,
|
|
||||||
tipo: "volume",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
unidade: "cm",
|
|
||||||
nome: "Centímetro",
|
|
||||||
unidade_normalizada: "m",
|
|
||||||
normalizar: (valor: number) => valor / 100,
|
|
||||||
tipo: "comprimento",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
unidade: "mm",
|
|
||||||
nome: "Milímetro",
|
|
||||||
unidade_normalizada: "m",
|
|
||||||
normalizar: (valor: number) => valor / 1000,
|
|
||||||
tipo: "comprimento",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
unidade: "m",
|
|
||||||
nome: "Metro",
|
|
||||||
unidade_normalizada: "m",
|
|
||||||
normalizar: (valor: number) => valor,
|
normalizar: (valor: number) => valor,
|
||||||
tipo: "comprimento",
|
tipo: "unidade",
|
||||||
},
|
|
||||||
{
|
|
||||||
unidade: "km",
|
|
||||||
nome: "Quilômetro",
|
|
||||||
unidade_normalizada: "m",
|
|
||||||
normalizar: (valor: number) => valor * 1000,
|
|
||||||
tipo: "comprimento",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unidade: "UN",
|
unidade: "UN",
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,12 @@ export const esperar = (ms: number): Promise<true> =>
|
||||||
new Promise((resolve: (r: true) => void) =>
|
new Promise((resolve: (r: true) => void) =>
|
||||||
setTimeout(() => resolve(true), ms),
|
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: { [key: string]: any }) =>
|
||||||
|
Object.keys(v).join("/")
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"target": "ESNext",
|
"target": "ES2020",
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "dist",
|
"declarationDir": "dist",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue