diff --git a/dist-import/pilao-de-dados/_enviar_registros.js b/dist-import/pilao-de-dados/_enviar_registros.js index 8b20029..e86d002 100644 --- a/dist-import/pilao-de-dados/_enviar_registros.js +++ b/dist-import/pilao-de-dados/_enviar_registros.js @@ -30,7 +30,9 @@ export const enviar_registros = ({ conta, produto, emDesenvolvimento }) => ({ re const url = new URL(`${baseUrlPilao(emDesenvolvimento)}${PREFIXO}/${Object.keys({ enviar_registros })[0]}/${produto}/${conta}`); const tamanhoBlocos = 1000; while (registros.length > 0) { - const bloco = registros.splice(0, tamanhoBlocos); + const bloco = registros + .splice(0, tamanhoBlocos) + .map((r) => Object.fromEntries(Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v]))); const resp = yield node_fetch(url.toString(), { method: "POST", body: JSON.stringify({ tabela, registros: bloco }), diff --git a/dist-require/pilao-de-dados/_enviar_registros.js b/dist-require/pilao-de-dados/_enviar_registros.js index 3d598e2..d95660c 100644 --- a/dist-require/pilao-de-dados/_enviar_registros.js +++ b/dist-require/pilao-de-dados/_enviar_registros.js @@ -35,6 +35,22 @@ 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 __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 }; }; @@ -73,7 +89,14 @@ var enviar_registros = function (_a) { _b.label = 1; case 1: if (!(registros.length > 0)) return [3 /*break*/, 3]; - bloco = registros.splice(0, tamanhoBlocos); + 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 }), diff --git a/package.json b/package.json index 8c4a9ec..f37b4a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p-drives", - "version": "0.84.0", + "version": "0.86.0", "description": "", "main": "src/index.ts", "exports": { diff --git a/src/pilao-de-dados/_enviar_registros.ts b/src/pilao-de-dados/_enviar_registros.ts index f02e6f6..0861434 100644 --- a/src/pilao-de-dados/_enviar_registros.ts +++ b/src/pilao-de-dados/_enviar_registros.ts @@ -1,7 +1,7 @@ import node_fetch from "cross-fetch" import type { tipoResposta } from "p-respostas" import { respostaComuns } from "p-respostas" -import { map, z } from "zod" +import { z } from "zod" import { PREFIXO, baseUrlPilao,