diff --git a/Documentos/biome.json b/Documentos/biome.json index 09514fe..d32df32 100755 --- a/Documentos/biome.json +++ b/Documentos/biome.json @@ -98,7 +98,7 @@ "enabled": true, "indentStyle": "space", "indentWidth": 2, - "lineWidth": 100, + "lineWidth": 80, "lineEnding": "lf" }, @@ -146,7 +146,7 @@ "enabled": true, "indentStyle": "space", "indentWidth": 2, - "lineWidth": 100 + "lineWidth": 80 } } } diff --git a/dist-back/consulta.js b/dist-back/consulta.js index 5f4c424..e3b422c 100644 --- a/dist-back/consulta.js +++ b/dist-back/consulta.js @@ -46,7 +46,17 @@ var operadores = /* @__PURE__ */ ((operadores2) => { operadores2["isNull"] = "isNull"; return operadores2; })(operadores || {}); -const zOperadores = import_zod.default.enum(["=", "!=", ">", ">=", "<", "<=", "like", "in", "isNull"]); +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(), diff --git a/dist-back/tipagemRotas.js b/dist-back/tipagemRotas.js index e68b6ce..ce1d130 100644 --- a/dist-back/tipagemRotas.js +++ b/dist-back/tipagemRotas.js @@ -97,7 +97,9 @@ class TipagemRotas { let queryObj = Object.fromEntries(query.entries()); const hash = url.hash; if (hash) { - const hashObj = Object.fromEntries(new URLSearchParams(hash.slice(1)).entries()); + const hashObj = Object.fromEntries( + new URLSearchParams(hash.slice(1)).entries() + ); queryObj = { ...queryObj, ...hashObj }; } for (const chave in queryObj) { diff --git a/dist-back/variaveisComuns.js b/dist-back/variaveisComuns.js index e90c5ef..8f40e1d 100644 --- a/dist-back/variaveisComuns.js +++ b/dist-back/variaveisComuns.js @@ -22,7 +22,9 @@ __export(variaveisComuns_exports, { nomeVariavel: () => nomeVariavel }); module.exports = __toCommonJS(variaveisComuns_exports); -const esperar = (ms) => new Promise((resolve) => setTimeout(() => resolve(true), ms)); +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 = { diff --git a/package.json b/package.json index eeeab04..1b3b77c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p-comuns", - "version": "0.333.0", + "version": "0.334.0", "description": "", "main": "./dist-front/index.mjs", "module": "./dist-front/index.mjs", diff --git a/pacote.tgz b/pacote.tgz index 8c13179..792cfbc 100644 Binary files a/pacote.tgz and b/pacote.tgz differ diff --git a/scripts/atualizar-biome.js b/scripts/atualizar-biome.js index e092a91..73659f1 100644 --- a/scripts/atualizar-biome.js +++ b/scripts/atualizar-biome.js @@ -64,7 +64,7 @@ for (const file of files) { const content = fs.readFileSync(file, 'utf8'); // Detecta se usa tab ou espaço const indent = content.match(/^[ \t]+/m) ? content.match(/^[ \t]+/m)[0] : '\t'; - + const json = JSON.parse(content); let changed = false; diff --git a/src/cacheMemoria.ts b/src/cacheMemoria.ts index a82d057..1d2c372 100755 --- a/src/cacheMemoria.ts +++ b/src/cacheMemoria.ts @@ -12,7 +12,11 @@ const _cache: { ;(globalThis as any).cacheMemoria_cache = _cache -export const cacheM = (chave: any, valor?: T, validadeSeg?: number): T | undefined => { +export const cacheM = ( + chave: any, + valor?: T, + validadeSeg?: number, +): T | undefined => { // converte a chave e string const txChave: string = typeof chave == "string" diff --git a/src/consulta.ts b/src/consulta.ts index 5faf5f8..5e1d331 100755 --- a/src/consulta.ts +++ b/src/consulta.ts @@ -30,7 +30,17 @@ export type interfaceConsulta = { apenasContagem?: boolean } -export const zOperadores = z.enum(["=", "!=", ">", ">=", "<", "<=", "like", "in", "isNull"]) +export const zOperadores = z.enum([ + "=", + "!=", + ">", + ">=", + "<", + "<=", + "like", + "in", + "isNull", +]) export const zFiltro = z.object({ coluna: z.string(), diff --git a/src/extensoes.ts b/src/extensoes.ts index 274d4d6..b321977 100755 --- a/src/extensoes.ts +++ b/src/extensoes.ts @@ -162,7 +162,9 @@ export const extensoes: { * @param nomeArquivo * @returns */ -export const tipoArquivo = (nomeArquivo: string | null | undefined): tiposArquivo => { +export const tipoArquivo = ( + nomeArquivo: string | null | undefined, +): tiposArquivo => { // extenssão do arquivo const extArquivo = String(nomeArquivo || "") .toLocaleLowerCase() diff --git a/src/local/index.ts b/src/local/index.ts index 8863ee0..210f40e 100755 --- a/src/local/index.ts +++ b/src/local/index.ts @@ -2,11 +2,18 @@ * LocalStorage Tipado * Lê ou grava um valor no localStorage, mantendo o tipo genérico . */ -export const localValor = (chave_: string | any, valor?: T | null): T | null => { - const localStorage = "localStorage" in globalThis ? (globalThis as any).localStorage : undefined +export const localValor = ( + chave_: string | any, + valor?: T | null, +): T | null => { + const localStorage = + "localStorage" in globalThis ? (globalThis as any).localStorage : undefined if (typeof localStorage == "undefined") return null - const chave = typeof chave_ === "string" ? chave_ : encodeURIComponent(JSON.stringify(chave_)) + const chave = + typeof chave_ === "string" + ? chave_ + : encodeURIComponent(JSON.stringify(chave_)) try { // Grava valor se fornecido diff --git a/src/postgres.ts b/src/postgres.ts index 40dd85b..e3e1787 100755 --- a/src/postgres.ts +++ b/src/postgres.ts @@ -14,7 +14,9 @@ export const paraObjetoRegistroPg = (entrada: { k, v === undefined || v == null ? v - : typeof v == "string" || typeof v == "number" || typeof v == "boolean" + : typeof v == "string" || + typeof v == "number" || + typeof v == "boolean" ? v : JSON.stringify(v, null, 2), ]), diff --git a/src/tipagemRotas.ts b/src/tipagemRotas.ts index d8d76e9..92ce985 100755 --- a/src/tipagemRotas.ts +++ b/src/tipagemRotas.ts @@ -63,7 +63,9 @@ export class TipagemRotas { */ endereco(query: T, usarComoHash?: boolean) { - const win = (typeof globalThis !== "undefined" && (globalThis as any).window) || undefined + const win = + (typeof globalThis !== "undefined" && (globalThis as any).window) || + undefined const url = new URL(win ? win.location.href : "http://localhost") url.pathname = this.caminho @@ -94,7 +96,9 @@ export class TipagemRotas { if (this._acaoIr) { this._acaoIr(this.endereco({ ...query })) } else { - const win = (typeof globalThis !== "undefined" && (globalThis as any).window) || undefined + const win = + (typeof globalThis !== "undefined" && (globalThis as any).window) || + undefined if (win) { win.location.href = this.endereco({ ...query }) } @@ -120,7 +124,9 @@ export class TipagemRotas { // pegar hash const hash = url.hash if (hash) { - const hashObj = Object.fromEntries(new URLSearchParams(hash.slice(1)).entries()) + const hashObj = Object.fromEntries( + new URLSearchParams(hash.slice(1)).entries(), + ) queryObj = { ...queryObj, ...hashObj } as T } diff --git a/src/tipoFiltro.26.ts b/src/tipoFiltro.26.ts index 839f59a..f3086da 100644 --- a/src/tipoFiltro.26.ts +++ b/src/tipoFiltro.26.ts @@ -164,7 +164,9 @@ type IsPlainObject = T extends object ============================================================================= */ type FiltroCampos = { - [K in keyof T]?: IsPlainObject extends true ? tipoFiltro26 : PgOpsFor + [K in keyof T]?: IsPlainObject extends true + ? tipoFiltro26 + : PgOpsFor } /* ============================================================================= diff --git a/src/uuid.ts b/src/uuid.ts index 18c47d4..1b88c91 100755 --- a/src/uuid.ts +++ b/src/uuid.ts @@ -6,7 +6,8 @@ import { NIL, v3, v4 } from "uuid" * @param valor - A string que será validada. * @returns booleano indicando se é um UUID válido. */ -export const erUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i +export const erUuid = + /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i export const validarUuid = (uuid: string | number | undefined | null) => { const retorno = erUuid.test(String(uuid || "")) diff --git a/src/variaveisComuns.ts b/src/variaveisComuns.ts index 137f6e9..9128332 100755 --- a/src/variaveisComuns.ts +++ b/src/variaveisComuns.ts @@ -1,5 +1,7 @@ export const esperar = (ms: number): Promise => - new Promise((resolve: (r: true) => void) => setTimeout(() => resolve(true), ms)) + new Promise((resolve: (r: true) => void) => + 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} @@ -7,4 +9,5 @@ export const esperar = (ms: number): Promise => * @param v * @returns */ -export const nomeVariavel = (v: { [key: string]: any }) => Object.keys(v).join("/") +export const nomeVariavel = (v: { [key: string]: any }) => + Object.keys(v).join("/")