add import node_fetch from "node-fetch";

This commit is contained in:
Luiz H. R. Silva 2024-06-19 10:33:55 -03:00
parent d614ba0d27
commit 5e04f26bbb
14 changed files with 87 additions and 17 deletions

View file

@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import node_fetch from "node-fetch";
import { respostaComuns } from "p-respostas";
import { z } from "zod";
import { PREFIXO, baseUrlPilao, z_tipo_coluna_base_dados, } from "./_variaveis";
@ -30,7 +31,7 @@ export const enviar_registros = ({ emDesenvolvimento, cliente: { conta, produto
const tamanhoBlocos = 1000;
while (registros.length > 0) {
const bloco = registros.splice(0, tamanhoBlocos);
const resp = yield fetch(url.toString(), {
const resp = yield node_fetch(url.toString(), {
method: "POST",
body: JSON.stringify({ tabela, registros: bloco }),
headers: { "Content-Type": "application/json" },