removido registros undefined

This commit is contained in:
Luiz H. R. Silva 2024-06-21 13:47:59 -03:00
parent 4860b2c036
commit ceab73c21c
4 changed files with 29 additions and 4 deletions

View file

@ -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 }),