This commit is contained in:
Luiz H. R. Silva 2024-06-19 17:47:48 -03:00
parent a6205f1ab6
commit e580643abc
40 changed files with 329 additions and 507 deletions

View file

@ -12,7 +12,7 @@ export declare const zp_produto_conta: z.ZodObject<{
produto: string;
conta: string;
}>;
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>;
export declare const z_tipo_coluna_base_dados: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
export declare const tiposSeriesAgregacoes: z.ZodEnum<["contagem", "somatoria"]>;
export declare const z_validar_colunna_base_dados: {
texto: z.ZodNullable<z.ZodString>;

View file

@ -24,6 +24,8 @@ exports.z_tipo_coluna_base_dados = zod_1.z.enum([
"confirmacao",
"lista_texto",
"lista_numero",
"data",
"mes",
]);
exports.tiposSeriesAgregacoes = zod_1.z.enum(["contagem", "somatoria"]);
exports.z_validar_colunna_base_dados = {

View file

@ -5,50 +5,50 @@ export declare const zp_registrar_base_dados: z.ZodObject<{
tabela: z.ZodString;
colunas: z.ZodArray<z.ZodObject<{
coluna: z.ZodString;
tipo: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>;
tipo: z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
}, "strip", z.ZodTypeAny, {
coluna: string;
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
}, {
coluna: string;
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
}>, "many">;
}, "strip", z.ZodTypeAny, {
tabela: string;
colunas: {
coluna: string;
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
}[];
}, {
tabela: string;
colunas: {
coluna: string;
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
}[];
}>;
export declare const zp_enviar_registros: z.ZodObject<{
tabela: z.ZodString;
registros: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodObject<{
valor: z.ZodAny;
tipo: z.ZodNullable<z.ZodOptional<z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>>>;
tipo: z.ZodNullable<z.ZodOptional<z.ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>>>;
}, "strip", z.ZodTypeAny, {
valor?: any;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
}, {
valor?: any;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
}>>, "many">;
}, "strip", z.ZodTypeAny, {
tabela: string;
registros: Record<string, {
valor?: any;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
}>[];
}, {
tabela: string;
registros: Record<string, {
valor?: any;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
}>[];
}>;
export declare const enviar_registros: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }: {

View file

@ -5,25 +5,25 @@ export declare const pPilao: {
tabela: import("zod").ZodString;
colunas: import("zod").ZodArray<import("zod").ZodObject<{
coluna: import("zod").ZodString;
tipo: import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>;
tipo: import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>;
}, "strip", import("zod").ZodTypeAny, {
coluna: string;
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
}, {
coluna: string;
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
}>, "many">;
}, "strip", import("zod").ZodTypeAny, {
tabela: string;
colunas: {
coluna: string;
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
}[];
}, {
tabela: string;
colunas: {
coluna: string;
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero";
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
}[];
}>;
enviar_registros: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }: {
@ -36,7 +36,7 @@ export declare const pPilao: {
tabela: string;
registros: Record<string, {
valor?: any;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
}>[];
};
}) => Promise<import("p-respostas").tipoResposta<true>>;
@ -44,28 +44,44 @@ export declare const pPilao: {
tabela: import("zod").ZodString;
registros: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
valor: import("zod").ZodAny;
tipo: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero"]>>>;
tipo: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodEnum<["texto", "numero", "confirmacao", "lista_texto", "lista_numero", "data", "mes"]>>>;
}, "strip", import("zod").ZodTypeAny, {
valor?: any;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
}, {
valor?: any;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
}>>, "many">;
}, "strip", import("zod").ZodTypeAny, {
tabela: string;
registros: Record<string, {
valor?: any;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
}>[];
}, {
tabela: string;
registros: Record<string, {
valor?: any;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | null | undefined;
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
}>[];
}>;
serie_registrar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, identificador, tabela, }, }: {
zp_serie_registrar: import("zod").ZodObject<{
tabela: import("zod").ZodString;
colanuEixoX: import("zod").ZodString;
colunaAgrupamento: import("zod").ZodString;
agregacao: import("zod").ZodEnum<["contagem", "somatoria"]>;
}, "strip", import("zod").ZodTypeAny, {
tabela: string;
colanuEixoX: string;
colunaAgrupamento: string;
agregacao: "contagem" | "somatoria";
}, {
tabela: string;
colanuEixoX: string;
colunaAgrupamento: string;
agregacao: "contagem" | "somatoria";
}>;
serie_consultar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, tabela }, }: {
emDesenvolvimento?: boolean | null | undefined;
cliente: {
produto: string;
@ -73,47 +89,16 @@ export declare const pPilao: {
};
parametros: {
tabela: string;
identificador: string;
colanuEixoX: string;
colunaAgrupamento: string;
agregacao: "contagem" | "somatoria";
};
}) => Promise<import("p-respostas").tipoResposta<true>>;
zp_serie_registrar: import("zod").ZodObject<{
tabela: import("zod").ZodString;
identificador: import("zod").ZodString;
colanuEixoX: import("zod").ZodString;
colunaAgrupamento: import("zod").ZodString;
agregacao: import("zod").ZodEnum<["contagem", "somatoria"]>;
}, "strip", import("zod").ZodTypeAny, {
tabela: string;
identificador: string;
colanuEixoX: string;
colunaAgrupamento: string;
agregacao: "contagem" | "somatoria";
}, {
tabela: string;
identificador: string;
colanuEixoX: string;
colunaAgrupamento: string;
agregacao: "contagem" | "somatoria";
}>;
serie_consultar: ({ emDesenvolvimento, parametros: { identificador }, cliente: { conta, produto }, }: {
emDesenvolvimento?: boolean | null | undefined;
cliente: {
produto: string;
conta: string;
};
parametros: {
identificador: string;
};
}) => {
dados: () => Promise<import("p-respostas").tipoResposta<{
registros: any[];
legenda: string;
serie: {
tabela: string;
identificador: string;
colanuEixoX: string;
colunaAgrupamento: string;
agregacao: "contagem" | "somatoria";
@ -121,13 +106,6 @@ export declare const pPilao: {
}>>;
url: () => string;
};
zp_serie_consultar: import("zod").ZodObject<{
identificador: import("zod").ZodString;
}, "strip", import("zod").ZodTypeAny, {
identificador: string;
}, {
identificador: string;
}>;
zp_produto_conta: import("zod").ZodObject<{
produto: import("zod").ZodString;
conta: import("zod").ZodString;

View file

@ -6,15 +6,12 @@ Object.defineProperty(exports, "tiposSeriesAgregacoes", { enumerable: true, get:
var deletar_registros_1 = require("./deletar_registros");
var enviar_registros_1 = require("./enviar_registros");
var serie_consultar_1 = require("./serie_consultar");
var serie_registrar_1 = require("./serie_registrar");
exports.pPilao = {
zp_registrar_base_dados: enviar_registros_1.zp_registrar_base_dados,
enviar_registros: enviar_registros_1.enviar_registros,
zp_enviar_registros: enviar_registros_1.zp_enviar_registros,
serie_registrar: serie_registrar_1.serie_registrar,
zp_serie_registrar: serie_registrar_1.zp_serie_registrar,
zp_serie_registrar: serie_consultar_1.zp_serie_registrar,
serie_consultar: serie_consultar_1.serie_consultar,
zp_serie_consultar: serie_consultar_1.zp_serie_consultar,
zp_produto_conta: _variaveis_1.zp_produto_conta,
validarZ: _variaveis_1.validarZ,
deletar_registros: deletar_registros_1.deletar_registros,

View file

@ -1,19 +1,27 @@
import type { tipoResposta } from "p-respostas";
import { z } from "zod";
import { type zp_produto_conta } from "./_variaveis";
import type { zp_serie_registrar } from "./serie_registrar";
export declare const zp_serie_consultar: z.ZodObject<{
identificador: z.ZodString;
export declare const zp_serie_registrar: z.ZodObject<{
tabela: z.ZodString;
colanuEixoX: z.ZodString;
colunaAgrupamento: z.ZodString;
agregacao: z.ZodEnum<["contagem", "somatoria"]>;
}, "strip", z.ZodTypeAny, {
identificador: string;
tabela: string;
colanuEixoX: string;
colunaAgrupamento: string;
agregacao: "contagem" | "somatoria";
}, {
identificador: string;
tabela: string;
colanuEixoX: string;
colunaAgrupamento: string;
agregacao: "contagem" | "somatoria";
}>;
export declare const serie_consultar: ({ emDesenvolvimento, parametros: { identificador }, cliente: { conta, produto }, }: {
export declare const serie_consultar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, tabela }, }: {
emDesenvolvimento?: boolean | undefined | null;
/** Identificação do cliente */
cliente: z.infer<typeof zp_produto_conta>;
parametros: z.infer<typeof zp_serie_consultar>;
parametros: z.infer<typeof zp_serie_registrar>;
}) => {
dados: () => Promise<tipoResposta<{
registros: any[];

View file

@ -35,21 +35,50 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.serie_consultar = exports.zp_serie_consultar = void 0;
exports.serie_consultar = exports.zp_serie_registrar = void 0;
var cross_fetch_1 = __importDefault(require("cross-fetch"));
var p_respostas_1 = require("p-respostas");
var zod_1 = require("zod");
var _variaveis_1 = require("./_variaveis");
//consultar compilação
exports.zp_serie_consultar = zod_1.z.object({
identificador: zod_1.z.string(),
exports.zp_serie_registrar = zod_1.z.object({
tabela: zod_1.z.string(),
colanuEixoX: zod_1.z.string(),
colunaAgrupamento: zod_1.z.string(),
agregacao: _variaveis_1.tiposSeriesAgregacoes,
});
var serie_consultar = function (_a) {
var emDesenvolvimento = _a.emDesenvolvimento, identificador = _a.parametros.identificador, _b = _a.cliente, conta = _b.conta, produto = _b.produto;
var emDesenvolvimento = _a.emDesenvolvimento, _b = _a.cliente, conta = _b.conta, produto = _b.produto, _c = _a.parametros, agregacao = _c.agregacao, colanuEixoX = _c.colanuEixoX, colunaAgrupamento = _c.colunaAgrupamento, tabela = _c.tabela;
var dados = function () { return __awaiter(void 0, void 0, void 0, function () {
var url, resp;
return __generator(this, function (_a) {
@ -59,7 +88,10 @@ var serie_consultar = function (_a) {
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
method: "POST",
body: JSON.stringify({
identificador: identificador,
agregacao: agregacao,
colanuEixoX: colanuEixoX,
colunaAgrupamento: colunaAgrupamento,
tabela: tabela,
}),
headers: { "Content-Type": "application/json" },
})
@ -75,12 +107,31 @@ var serie_consultar = function (_a) {
});
}); };
var url = function () {
var e_1, _a;
var pr = {
produto: produto,
conta: conta,
agregacao: agregacao,
colanuEixoX: colanuEixoX,
colunaAgrupamento: colunaAgrupamento,
tabela: tabela,
};
var vUrl = new URL("".concat(emDesenvolvimento
? "http://127.0.0.1:5081"
: "https://carro-de-boi.idz.one").concat(_variaveis_1.PREFIXO, "/").concat(_variaveis_1.tiposSeriesAgregacoes.enum.contagem));
vUrl.searchParams.append("produto", produto);
vUrl.searchParams.append("conta", conta);
vUrl.searchParams.append("identificador", identificador);
try {
for (var _b = __values(Object.entries(pr)), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), k = _d[0], v = _d[1];
vUrl.searchParams.append(k, JSON.stringify(v));
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return vUrl.href;
};
return {

View file

@ -1,29 +0,0 @@
import { type tipoResposta } from "p-respostas";
import { z } from "zod";
import { type zp_produto_conta } from "./_variaveis";
export declare const zp_serie_registrar: z.ZodObject<{
tabela: z.ZodString;
identificador: z.ZodString;
colanuEixoX: z.ZodString;
colunaAgrupamento: z.ZodString;
agregacao: z.ZodEnum<["contagem", "somatoria"]>;
}, "strip", z.ZodTypeAny, {
tabela: string;
identificador: string;
colanuEixoX: string;
colunaAgrupamento: string;
agregacao: "contagem" | "somatoria";
}, {
tabela: string;
identificador: string;
colanuEixoX: string;
colunaAgrupamento: string;
agregacao: "contagem" | "somatoria";
}>;
export declare const serie_registrar: ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, identificador, tabela, }, }: {
emDesenvolvimento?: boolean | undefined | null;
/** Identificação do cliente */
cliente: z.infer<typeof zp_produto_conta>;
/** Parametros da função */
parametros: z.infer<typeof zp_serie_registrar>;
}) => Promise<tipoResposta<true>>;

View file

@ -1,85 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.serie_registrar = exports.zp_serie_registrar = void 0;
var cross_fetch_1 = __importDefault(require("cross-fetch"));
var p_respostas_1 = require("p-respostas");
var zod_1 = require("zod");
var _variaveis_1 = require("./_variaveis");
//registrar serie
exports.zp_serie_registrar = zod_1.z.object({
tabela: zod_1.z.string(),
identificador: zod_1.z.string(),
colanuEixoX: zod_1.z.string(),
colunaAgrupamento: zod_1.z.string(),
agregacao: _variaveis_1.tiposSeriesAgregacoes,
});
var serie_registrar = function (_a) {
var emDesenvolvimento = _a.emDesenvolvimento, _b = _a.cliente, conta = _b.conta, produto = _b.produto, _c = _a.parametros, agregacao = _c.agregacao, colanuEixoX = _c.colanuEixoX, colunaAgrupamento = _c.colunaAgrupamento, identificador = _c.identificador, tabela = _c.tabela;
return __awaiter(void 0, void 0, void 0, function () {
var url, resp;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
url = new URL("".concat((0, _variaveis_1.baseUrlPilao)(emDesenvolvimento)).concat("".concat(_variaveis_1.PREFIXO, "/").concat(Object.keys({ serie_registrar: exports.serie_registrar })[0], "/").concat(produto, "/").concat(conta)));
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
method: "POST",
body: JSON.stringify({
tabela: tabela,
agregacao: agregacao,
emDesenvolvimento: emDesenvolvimento,
colanuEixoX: colanuEixoX,
colunaAgrupamento: colunaAgrupamento,
identificador: identificador,
}),
headers: { "Content-Type": "application/json" },
})
.then(function (r) { return r.json(); })
.catch(function (e) { return p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]); })
.then(function (r) { return r; })];
case 1:
resp = _d.sent();
return [2 /*return*/, resp];
}
});
});
};
exports.serie_registrar = serie_registrar;