UNPKG

prg-class

Version:

Clases genéricas utilizadas por microservicios Programamos SPA.

60 lines (59 loc) 2.39 kB
"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()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.QuerySPOne = void 0; const F = require("prg-function"); const exec_sp_1 = require("./exec-sp"); class QuerySPOne extends exec_sp_1.ExecSP { constructor() { super(); this.msCustomErrMsg = ''; this.mbCustomRet = false; this.mbNonZeroPositiveIsOk = false; this.mbAudit = false; this.msSPName = ''; // Asignación de nombre de nombre de procedimiento almacenado. } fnQueryOne(aoParams, aoUPRM) { return __awaiter(this, void 0, void 0, function* () { const loRet = yield this.fnSpExecute(aoParams, aoUPRM, this.mbAudit); this.auditMe(this.mbAudit, 'fnQueryOne...loRet', loRet); if (loRet.error) { return loRet; } return this.customReturn(loRet.json); }); } customReturn(aoData) { return __awaiter(this, void 0, void 0, function* () { if (!aoData || aoData.length <= 0 || aoData[0].length <= 0) { return F.fnRetOk(aoData); } const loData = { D000: aoData[0] }; // , for (let i = 1; i < 30; i++) { if (aoData.length >= i + 1) { const lsCero = i < 10 ? '00' : '0'; const lsFld = 'D' + lsCero + i; loData[lsFld] = aoData[i]; } } return F.fnRetOk(loData); }); } getSPParams(aoParam) { const lsKey = F.trim(aoParam.Key); const loPrm = []; loPrm.push(lsKey); return loPrm; } } exports.QuerySPOne = QuerySPOne;