catalyst-relay 0.5.11 → 0.5.13
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/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1579,7 +1579,9 @@ async function updateObject(client, object, lockHandle, transport) {
|
|
|
1579
1579
|
|
|
1580
1580
|
// src/core/adt/craud/activation.ts
|
|
1581
1581
|
var MAX_POLL_ATTEMPTS = 30;
|
|
1582
|
+
var POLL_RETRY_DELAY_MS = 1e3;
|
|
1582
1583
|
var RUN_ID_REGEX = /\/activation\/runs\/([^?/]+)/;
|
|
1584
|
+
var BACKGROUND_RUN_MEDIA_TYPE = "application/vnd.sap.adt.backgroundrun.v1+xml";
|
|
1583
1585
|
async function activateObjects(client, objects) {
|
|
1584
1586
|
if (objects.length === 0) {
|
|
1585
1587
|
return ok([]);
|
|
@@ -1605,7 +1607,7 @@ async function activateObjects(client, objects) {
|
|
|
1605
1607
|
},
|
|
1606
1608
|
headers: {
|
|
1607
1609
|
"Content-Type": "application/xml",
|
|
1608
|
-
"Accept":
|
|
1610
|
+
"Accept": BACKGROUND_RUN_MEDIA_TYPE
|
|
1609
1611
|
},
|
|
1610
1612
|
body
|
|
1611
1613
|
});
|
|
@@ -1623,22 +1625,25 @@ async function activateObjects(client, objects) {
|
|
|
1623
1625
|
}
|
|
1624
1626
|
const runId = runIdMatch[1];
|
|
1625
1627
|
debug(`Activation run ID: ${runId}`);
|
|
1626
|
-
let pollAttempt =
|
|
1627
|
-
while (pollAttempt < MAX_POLL_ATTEMPTS) {
|
|
1628
|
+
for (let pollAttempt = 1; pollAttempt <= MAX_POLL_ATTEMPTS; pollAttempt++) {
|
|
1628
1629
|
const [pollRes, pollErr] = await client.request({
|
|
1629
1630
|
method: "GET",
|
|
1630
1631
|
path: `/sap/bc/adt/activation/runs/${runId}`,
|
|
1631
1632
|
params: { "withLongPolling": "true" },
|
|
1632
|
-
headers: { "Accept":
|
|
1633
|
+
headers: { "Accept": BACKGROUND_RUN_MEDIA_TYPE }
|
|
1633
1634
|
});
|
|
1634
1635
|
if (pollErr) return err(pollErr);
|
|
1635
|
-
debug(`Activation poll attempt ${pollAttempt
|
|
1636
|
+
debug(`Activation poll attempt ${pollAttempt} status: ${pollRes.status}`);
|
|
1636
1637
|
if (pollRes.ok) break;
|
|
1637
|
-
|
|
1638
|
+
if (pollRes.status >= 400 && pollRes.status < 500) {
|
|
1639
|
+
const errText = await pollRes.text();
|
|
1640
|
+
return err(new Error(`Activation run ${runId} polling rejected (${pollRes.status}): ${extractError(errText)}`));
|
|
1641
|
+
}
|
|
1638
1642
|
if (pollAttempt >= MAX_POLL_ATTEMPTS) {
|
|
1639
1643
|
const errText = await pollRes.text();
|
|
1640
|
-
return err(new Error(`Activation run ${runId} did not complete: ${extractError(errText)}`));
|
|
1644
|
+
return err(new Error(`Activation run ${runId} did not complete after ${MAX_POLL_ATTEMPTS} attempts: ${extractError(errText)}`));
|
|
1641
1645
|
}
|
|
1646
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_RETRY_DELAY_MS));
|
|
1642
1647
|
}
|
|
1643
1648
|
const [resultsRes, resultsErr] = await client.request({
|
|
1644
1649
|
method: "GET",
|
|
@@ -3551,6 +3556,7 @@ function createClient(config) {
|
|
|
3551
3556
|
return ok(new ADTClientImpl(config));
|
|
3552
3557
|
}
|
|
3553
3558
|
export {
|
|
3559
|
+
ExternalReferencesError,
|
|
3554
3560
|
activateLogging,
|
|
3555
3561
|
buildSQLQuery,
|
|
3556
3562
|
createClient,
|