herramientaenvioestupendo 1.1.21 → 1.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/db2_connector.js +15 -8
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Para instalar el aplicativo CLI, deben realizar el siguiente procedimiento :
|
|
|
17
17
|
```npm update herramientaenvioestupendo -g```
|
|
18
18
|
|
|
19
19
|
- Luego de esto deben validar la version de la herramienta :
|
|
20
|
-
```estupendo --version```, si esta indica que es la 1.1.
|
|
20
|
+
```estupendo --version```, si esta indica que es la 1.1.22 es la correcta.
|
|
21
21
|
|
|
22
22
|
- Para conocer que opciones tienen de comandos solo deben ingresar en su CMD :
|
|
23
23
|
```estupendo --help```
|
package/package.json
CHANGED
package/src/db2_connector.js
CHANGED
|
@@ -130,21 +130,24 @@ const assertSafeDbIdentifier = (identifier, label) => {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (
|
|
136
|
-
return
|
|
133
|
+
// IBM i ODBC driver no soporta SQLPrepare para CALL — se ejecuta directo con valores embebidos
|
|
134
|
+
const sqlLiteral = (value) => {
|
|
135
|
+
if (value === null || value === undefined) return "NULL"
|
|
136
|
+
if (typeof value === "number") return String(value)
|
|
137
|
+
return `'${String(value).replace(/'/g, "''")}'`
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
const callListPending = async (connection, spName, nit, limit) => {
|
|
140
141
|
assertSafeDbIdentifier(spName, "SP de pendientes")
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
if (connection._type === "odbc") {
|
|
143
|
+
const sql = `{CALL ${spName}(${sqlLiteral(nit)}, ${sqlLiteral(Number(limit))})}`
|
|
144
|
+
return query(connection, sql)
|
|
145
|
+
}
|
|
146
|
+
return query(connection, `CALL ${spName}(?, ?)`, [nit, Number(limit)])
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
const callUpdateStatus = async (connection, spName, nit, result) => {
|
|
146
150
|
assertSafeDbIdentifier(spName, "SP de actualizacion")
|
|
147
|
-
const sql = buildCallSql(connection, spName, 16)
|
|
148
151
|
const params = [
|
|
149
152
|
nit,
|
|
150
153
|
result.documentType || result.tipoDocumento || "",
|
|
@@ -164,7 +167,11 @@ const callUpdateStatus = async (connection, spName, nit, result) => {
|
|
|
164
167
|
result.extraValue2 || "",
|
|
165
168
|
]
|
|
166
169
|
|
|
167
|
-
|
|
170
|
+
if (connection._type === "odbc") {
|
|
171
|
+
const sql = `{CALL ${spName}(${params.map(sqlLiteral).join(", ")})}`
|
|
172
|
+
return query(connection, sql)
|
|
173
|
+
}
|
|
174
|
+
return query(connection, `CALL ${spName}(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, params)
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
const normalizeValue = (value) => {
|
package/src/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { sendTxt, sendXml, sendAttached, sendJson, requestDocumentRace, sendTxtC
|
|
|
4
4
|
import { sendDb2Sp } from "./db2_connector.js"
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
program.name("estupendo").version("1.1.
|
|
7
|
+
program.name("estupendo").version("1.1.22")
|
|
8
8
|
|
|
9
9
|
program.command("send_xml")
|
|
10
10
|
.requiredOption("-d, --directory <char>", "Directorio donde se encuentran los documentos XML")
|