ajuste de libs
This commit is contained in:
parent
caf3f59453
commit
547f693652
22 changed files with 236 additions and 306 deletions
|
|
@ -51,39 +51,37 @@ exports.zp_deletar_registros = zod_1.z.object({
|
|||
});
|
||||
var deletar_registros = function (_a) {
|
||||
var conta = _a.conta, produto = _a.produto, emDesenvolvimento = _a.emDesenvolvimento;
|
||||
return function (_a) {
|
||||
var codigos = _a.codigos, tabela = _a.tabela;
|
||||
return __awaiter(void 0, void 0, void 0, function () {
|
||||
var url, tamanhoBlocos, bloco, resp;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
url = new URL("".concat((0, variaveis_1.baseUrlPilao)(emDesenvolvimento)).concat(variaveis_1.PREFIXO, "/").concat(Object.keys({ deletar_registros: exports.deletar_registros })[0], "/").concat(produto, "/").concat(conta));
|
||||
tamanhoBlocos = 1000;
|
||||
_b.label = 1;
|
||||
case 1:
|
||||
if (!(codigos.length > 0)) return [3 /*break*/, 3];
|
||||
bloco = codigos.splice(0, tamanhoBlocos);
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ tabela: tabela, codigos: bloco }),
|
||||
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 2:
|
||||
resp = _b.sent();
|
||||
if (resp.eErro) {
|
||||
return [2 /*return*/, resp];
|
||||
}
|
||||
return [3 /*break*/, 1];
|
||||
case 3: return [2 /*return*/, p_respostas_1.respostaComuns.valor(true)];
|
||||
}
|
||||
});
|
||||
return function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, tamanhoBlocos, bloco, resp;
|
||||
var codigos = _b.codigos, tabela = _b.tabela;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
url = new URL("".concat((0, variaveis_1.baseUrlPilao)(emDesenvolvimento)).concat(variaveis_1.PREFIXO, "/").concat(Object.keys({ deletar_registros: exports.deletar_registros })[0], "/").concat(produto, "/").concat(conta));
|
||||
tamanhoBlocos = 1000;
|
||||
_c.label = 1;
|
||||
case 1:
|
||||
if (!(codigos.length > 0)) return [3 /*break*/, 3];
|
||||
bloco = codigos.splice(0, tamanhoBlocos);
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ tabela: tabela, codigos: bloco }),
|
||||
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 2:
|
||||
resp = _c.sent();
|
||||
if (resp.eErro) {
|
||||
return [2 /*return*/, resp];
|
||||
}
|
||||
return [3 /*break*/, 1];
|
||||
case 3: return [2 /*return*/, p_respostas_1.respostaComuns.valor(true)];
|
||||
}
|
||||
});
|
||||
};
|
||||
}); };
|
||||
};
|
||||
exports.deletar_registros = deletar_registros;
|
||||
|
|
|
|||
|
|
@ -77,46 +77,44 @@ exports.zp_enviar_registros = zod_1.z.object({
|
|||
});
|
||||
var enviar_registros = function (_a) {
|
||||
var conta = _a.conta, produto = _a.produto, emDesenvolvimento = _a.emDesenvolvimento;
|
||||
return function (_a) {
|
||||
var registros = _a.registros, tabela = _a.tabela;
|
||||
return __awaiter(void 0, void 0, void 0, function () {
|
||||
var url, tamanhoBlocos, bloco, resp;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
url = new URL("".concat((0, variaveis_1.baseUrlPilao)(emDesenvolvimento)).concat(variaveis_1.PREFIXO, "/").concat(Object.keys({ enviar_registros: exports.enviar_registros })[0], "/").concat(produto, "/").concat(conta));
|
||||
tamanhoBlocos = 1000;
|
||||
_b.label = 1;
|
||||
case 1:
|
||||
if (!(registros.length > 0)) return [3 /*break*/, 3];
|
||||
bloco = registros
|
||||
.splice(0, tamanhoBlocos)
|
||||
.map(function (r) {
|
||||
return Object.fromEntries(Object.entries(r).map(function (_a) {
|
||||
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
||||
return [k, v === undefined ? null : v];
|
||||
}));
|
||||
});
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ tabela: tabela, registros: bloco }),
|
||||
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 2:
|
||||
resp = _b.sent();
|
||||
if (resp.eErro) {
|
||||
return [2 /*return*/, resp];
|
||||
}
|
||||
return [3 /*break*/, 1];
|
||||
case 3: return [2 /*return*/, p_respostas_1.respostaComuns.valor(true)];
|
||||
}
|
||||
});
|
||||
return function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
||||
var url, tamanhoBlocos, bloco, resp;
|
||||
var registros = _b.registros, tabela = _b.tabela;
|
||||
return __generator(this, function (_c) {
|
||||
switch (_c.label) {
|
||||
case 0:
|
||||
url = new URL("".concat((0, variaveis_1.baseUrlPilao)(emDesenvolvimento)).concat(variaveis_1.PREFIXO, "/").concat(Object.keys({ enviar_registros: exports.enviar_registros })[0], "/").concat(produto, "/").concat(conta));
|
||||
tamanhoBlocos = 1000;
|
||||
_c.label = 1;
|
||||
case 1:
|
||||
if (!(registros.length > 0)) return [3 /*break*/, 3];
|
||||
bloco = registros
|
||||
.splice(0, tamanhoBlocos)
|
||||
.map(function (r) {
|
||||
return Object.fromEntries(Object.entries(r).map(function (_a) {
|
||||
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
||||
return [k, v === undefined ? null : v];
|
||||
}));
|
||||
});
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url.toString(), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ tabela: tabela, registros: bloco }),
|
||||
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 2:
|
||||
resp = _c.sent();
|
||||
if (resp.eErro) {
|
||||
return [2 /*return*/, resp];
|
||||
}
|
||||
return [3 /*break*/, 1];
|
||||
case 3: return [2 /*return*/, p_respostas_1.respostaComuns.valor(true)];
|
||||
}
|
||||
});
|
||||
};
|
||||
}); };
|
||||
};
|
||||
exports.enviar_registros = enviar_registros;
|
||||
|
|
|
|||
46
dist-require/pilao-de-dados/index.d.ts
vendored
46
dist-require/pilao-de-dados/index.d.ts
vendored
|
|
@ -1,4 +1,7 @@
|
|||
import { tiposSeriesAgregacoes } from "./variaveis";
|
||||
import { zp_deletar_registros } from "./_deletar_registros";
|
||||
import { zp_enviar_registros } from "./_enviar_registros";
|
||||
import { tiposSeriesAgregacoes, zp_produto_conta } from "./variaveis";
|
||||
import { zp_serie_registrar } from "./_serie_consultar";
|
||||
export { tiposSeriesAgregacoes };
|
||||
export declare const pPilao: {
|
||||
zp_registrar_base_dados: import("zod").ZodObject<{
|
||||
|
|
@ -26,17 +29,7 @@ export declare const pPilao: {
|
|||
tipo: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes";
|
||||
}[];
|
||||
}>;
|
||||
enviar_registros: ({ conta, produto, emDesenvolvimento }: {
|
||||
conta: string;
|
||||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}) => ({ registros, tabela, }: {
|
||||
tabela: string;
|
||||
registros: Record<string, {
|
||||
valor?: any;
|
||||
tipo?: "texto" | "numero" | "confirmacao" | "lista_texto" | "lista_numero" | "data" | "mes" | null | undefined;
|
||||
}>[];
|
||||
}) => Promise<import("p-respostas").tipoResposta<true>>;
|
||||
enviar_registros: ({ conta, produto, emDesenvolvimento }: import("zod").TypeOf<typeof zp_produto_conta>) => ({ registros, tabela, }: import("zod").TypeOf<typeof zp_enviar_registros>) => Promise<import("p-respostas").tipoResposta<true>>;
|
||||
zp_enviar_registros: import("zod").ZodObject<{
|
||||
tabela: import("zod").ZodString;
|
||||
registros: import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
||||
|
|
@ -78,25 +71,11 @@ export declare const pPilao: {
|
|||
agregacao: "contagem" | "somatoria";
|
||||
colunaAgrupamento?: string[] | undefined;
|
||||
}>;
|
||||
serie_consultar: (cliente: {
|
||||
conta: string;
|
||||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}) => (parametros: {
|
||||
tabela: string;
|
||||
colanuEixoX: string;
|
||||
agregacao: "contagem" | "somatoria";
|
||||
colunaAgrupamento?: string[] | undefined;
|
||||
}) => {
|
||||
serie_consultar: (cliente: import("zod").TypeOf<typeof zp_produto_conta>) => (parametros: import("zod").TypeOf<typeof zp_serie_registrar>) => {
|
||||
dados: () => Promise<import("p-respostas").tipoResposta<{
|
||||
registros: any[];
|
||||
legenda: string;
|
||||
serie: {
|
||||
tabela: string;
|
||||
colanuEixoX: string;
|
||||
agregacao: "contagem" | "somatoria";
|
||||
colunaAgrupamento?: string[] | undefined;
|
||||
};
|
||||
serie: import("zod").TypeOf<typeof zp_serie_registrar>;
|
||||
}>>;
|
||||
url: () => string;
|
||||
};
|
||||
|
|
@ -113,15 +92,8 @@ export declare const pPilao: {
|
|||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}>;
|
||||
validarZ: <T>(zodType: import("zod").ZodType<T, any, T>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
||||
deletar_registros: ({ conta, produto, emDesenvolvimento }: {
|
||||
conta: string;
|
||||
produto: string;
|
||||
emDesenvolvimento?: boolean | undefined;
|
||||
}) => ({ codigos, tabela, }: {
|
||||
tabela: string;
|
||||
codigos: string[];
|
||||
}) => Promise<import("p-respostas").tipoResposta<true>>;
|
||||
validarZ: <T>(zodType: import("zod").ZodType<T, any>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
||||
deletar_registros: ({ conta, produto, emDesenvolvimento }: import("zod").TypeOf<typeof zp_produto_conta>) => ({ codigos, tabela, }: import("zod").TypeOf<typeof zp_deletar_registros>) => Promise<import("p-respostas").tipoResposta<true>>;
|
||||
zp_deletar_registros: import("zod").ZodObject<{
|
||||
tabela: import("zod").ZodString;
|
||||
codigos: import("zod").ZodArray<import("zod").ZodString, "many">;
|
||||
|
|
|
|||
2
dist-require/pilao-de-dados/variaveis.d.ts
vendored
2
dist-require/pilao-de-dados/variaveis.d.ts
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import { z } from "zod";
|
||||
export declare const zAmbiente: z.ZodEnum<["desenvolvimento", "producao"]>;
|
||||
export declare const PREFIXO = "/pilao-de-dados";
|
||||
export declare const validarZ: <T>(zodType: z.ZodType<T, any, T>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
||||
export declare const validarZ: <T>(zodType: z.ZodType<T, any>, objeto: any, mensagem: string) => import("p-respostas").tipoRespostaErro | import("p-respostas").tipoRespostaSucesso<T>;
|
||||
export declare const zp_produto_conta: z.ZodObject<{
|
||||
produto: z.ZodString;
|
||||
conta: z.ZodString;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue