@opengeni/ogtool 1.4.0 → 1.4.2
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/bin/ogtool.cjs +38 -17
- package/package.json +3 -3
package/dist/bin/ogtool.cjs
CHANGED
|
@@ -15331,19 +15331,21 @@ class CodemodeClient {
|
|
|
15331
15331
|
};
|
|
15332
15332
|
}
|
|
15333
15333
|
async submit(operationId, catalogDigest, identity, argumentsValue, signal) {
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15334
|
+
return await retryTransientCodemodeRequest(signal, async () => {
|
|
15335
|
+
const response = await this.request("/calls", {
|
|
15336
|
+
method: "POST",
|
|
15337
|
+
...signal ? { signal } : {},
|
|
15338
|
+
headers: { "content-type": "application/json" },
|
|
15339
|
+
body: JSON.stringify({
|
|
15340
|
+
operationId,
|
|
15341
|
+
catalogDigest,
|
|
15342
|
+
identity,
|
|
15343
|
+
arguments: argumentsValue,
|
|
15344
|
+
durableApproval: true
|
|
15345
|
+
})
|
|
15346
|
+
});
|
|
15347
|
+
return CodemodeCallSubmission.parse(await response.json()).operation;
|
|
15345
15348
|
});
|
|
15346
|
-
return CodemodeCallSubmission.parse(await response.json()).operation;
|
|
15347
15349
|
}
|
|
15348
15350
|
async status(operationId, signal) {
|
|
15349
15351
|
const operation = await this.read(operationId, signal);
|
|
@@ -15373,11 +15375,13 @@ class CodemodeClient {
|
|
|
15373
15375
|
}
|
|
15374
15376
|
}
|
|
15375
15377
|
async read(operationId, signal) {
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15378
|
+
return await retryTransientCodemodeRequest(signal, async () => {
|
|
15379
|
+
const response = await this.request(`/calls/${operationId}`, {
|
|
15380
|
+
method: "GET",
|
|
15381
|
+
...signal ? { signal } : {}
|
|
15382
|
+
});
|
|
15383
|
+
return CodemodeOperation.parse(await response.json());
|
|
15379
15384
|
});
|
|
15380
|
-
return CodemodeOperation.parse(await response.json());
|
|
15381
15385
|
}
|
|
15382
15386
|
async sessionRequest(path, init) {
|
|
15383
15387
|
siteSessionPath(path, "site-host", init.method ?? "GET");
|
|
@@ -15508,6 +15512,23 @@ function parseCodemodeApiError(input) {
|
|
|
15508
15512
|
...details ? { details } : {}
|
|
15509
15513
|
} : null;
|
|
15510
15514
|
}
|
|
15515
|
+
var CODEMODE_TRANSIENT_RETRY_DELAYS_MS = [100, 250, 500, 1000, 2000];
|
|
15516
|
+
function isTransientCodemodeTransportError(error51) {
|
|
15517
|
+
return error51 instanceof CodemodeTransportError && error51.status !== null && error51.status >= 500 && error51.retryable === true && error51.outcomeUnknown !== true;
|
|
15518
|
+
}
|
|
15519
|
+
async function retryTransientCodemodeRequest(signal, request) {
|
|
15520
|
+
for (let attempt = 0;; attempt += 1) {
|
|
15521
|
+
try {
|
|
15522
|
+
return await request();
|
|
15523
|
+
} catch (error51) {
|
|
15524
|
+
const delayMs = CODEMODE_TRANSIENT_RETRY_DELAYS_MS[attempt];
|
|
15525
|
+
if (delayMs === undefined || signal?.aborted || !isTransientCodemodeTransportError(error51)) {
|
|
15526
|
+
throw error51;
|
|
15527
|
+
}
|
|
15528
|
+
await abortableDelay(delayMs + Math.floor(Math.random() * delayMs), signal);
|
|
15529
|
+
}
|
|
15530
|
+
}
|
|
15531
|
+
}
|
|
15511
15532
|
async function abortableDelay(delayMs, signal) {
|
|
15512
15533
|
if (!signal) {
|
|
15513
15534
|
await new Promise((resolve2) => setTimeout(resolve2, delayMs));
|
|
@@ -15529,7 +15550,7 @@ async function abortableDelay(delayMs, signal) {
|
|
|
15529
15550
|
// package.json
|
|
15530
15551
|
var package_default = {
|
|
15531
15552
|
name: "@opengeni/ogtool",
|
|
15532
|
-
version: "1.4.
|
|
15553
|
+
version: "1.4.2",
|
|
15533
15554
|
description: "Codemode CLI and typed client entrypoint for an OpenGeni execution attempt.",
|
|
15534
15555
|
license: "Apache-2.0",
|
|
15535
15556
|
repository: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/ogtool",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "Codemode CLI and typed client entrypoint for an OpenGeni execution attempt.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@opengeni/codemode": "1.4.
|
|
41
|
-
"@opengeni/contracts": "1.4.
|
|
40
|
+
"@opengeni/codemode": "1.4.2",
|
|
41
|
+
"@opengeni/contracts": "1.4.2"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=18"
|