feat: operadores de consulta zod

This commit is contained in:
marcio 2025-09-18 08:32:06 -03:00
parent d72455e06b
commit cd90eeaa3e
5 changed files with 82 additions and 5 deletions

View file

@ -1,7 +1,9 @@
"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)
@ -15,12 +17,23 @@ var __copyProps = (to, from, except, desc) => {
}
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
operadores: () => operadores,
zFiltro: () => zFiltro,
zOperadores: () => zOperadores
});
module.exports = __toCommonJS(consulta_exports);
var import_zod = __toESM(require("zod"));
var operadores = /* @__PURE__ */ ((operadores2) => {
operadores2["="] = "=";
operadores2["!="] = "!=";
@ -32,7 +45,25 @@ var operadores = /* @__PURE__ */ ((operadores2) => {
operadores2["in"] = "in";
return operadores2;
})(operadores || {});
const zOperadores = import_zod.default.enum([
"=",
"!=",
">",
">=",
"<",
"<=",
"like",
"in"
]);
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
operadores,
zFiltro,
zOperadores
});

View file

@ -1,3 +1,4 @@
import z from 'zod';
export { ManipulateType, default as dayjsbr } from 'dayjs';
import { v4 } from 'uuid';
@ -62,6 +63,31 @@ type interfaceConsulta = {
apenasConsulta?: boolean;
apenasContagem?: boolean;
};
declare const zOperadores: z.ZodEnum<{
"=": "=";
"!=": "!=";
">": ">";
">=": ">=";
"<": "<";
"<=": "<=";
like: "like";
in: "in";
}>;
declare const zFiltro: z.ZodObject<{
coluna: z.ZodString;
valor: z.ZodAny;
operador: z.ZodEnum<{
"=": "=";
"!=": "!=";
">": ">";
">=": ">=";
"<": "<";
"<=": "<=";
like: "like";
in: "in";
}>;
ou: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
declare const cdn_carro_de_boi = "https://carro-de-boi-idz-one.b-cdn.net";
@ -269,4 +295,4 @@ declare const nomeVariavel: (v: {
[key: string]: any;
}) => string;
export { TipagemRotas, type TipoLoggerSessao, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, cdn_carro_de_boi, defineCwd, erUuid, esperar, extensoes, type interfaceConsulta, 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 };
export { TipagemRotas, type TipoLoggerSessao, aleatorio, cacheM, cacheMFixo, cacheMemoria, camposComuns, cdn_carro_de_boi, defineCwd, erUuid, esperar, extensoes, type interfaceConsulta, 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 };

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "p-comuns",
"version": "0.229.0",
"version": "0.230.0",
"description": "",
"main": "./dist-back/index.js",
"module": "./dist-front/index.mjs",

View file

@ -1,3 +1,5 @@
import z from "zod"
export enum operadores {
"=" = "=",
"!=" = "!=",
@ -26,3 +28,21 @@ export type interfaceConsulta = {
apenasConsulta?: boolean
apenasContagem?: boolean
}
export const zOperadores = z.enum([
"=",
"!=",
">",
">=",
"<",
"<=",
"like",
"in",
])
export const zFiltro = z.object({
coluna: z.string(),
valor: z.any(),
operador: zOperadores,
ou: z.boolean().optional(),
})