@mytegroupinc/myte-core 0.0.11 → 0.0.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/cli.js +23 -3
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -1090,9 +1090,15 @@ async function fetchSuggestionsSyncSnapshot({ apiBase, key, timeoutMs, actorScop
|
|
|
1090
1090
|
);
|
|
1091
1091
|
|
|
1092
1092
|
if (!resp.ok || body.status !== "success") {
|
|
1093
|
+
const retryAfter = resp.headers?.get?.("retry-after");
|
|
1093
1094
|
const msg = body?.message || `Mission suggestions sync request failed (${resp.status})`;
|
|
1094
|
-
const err = new Error(
|
|
1095
|
+
const err = new Error(
|
|
1096
|
+
retryAfter
|
|
1097
|
+
? `${msg} Retry after ${retryAfter}s.`
|
|
1098
|
+
: msg
|
|
1099
|
+
);
|
|
1095
1100
|
err.status = resp.status;
|
|
1101
|
+
if (retryAfter) err.retryAfter = retryAfter;
|
|
1096
1102
|
throw err;
|
|
1097
1103
|
}
|
|
1098
1104
|
return body.data || {};
|
|
@@ -1147,7 +1153,7 @@ async function postSuggestionsMutation({ apiBase, key, timeoutMs, endpoint, payl
|
|
|
1147
1153
|
return body.data || {};
|
|
1148
1154
|
}
|
|
1149
1155
|
|
|
1150
|
-
async function createRunQaqcBatch({ apiBase, key, timeoutMs, payload }) {
|
|
1156
|
+
async function createRunQaqcBatch({ apiBase, key, timeoutMs, payload, idempotencyKey, clientSessionId }) {
|
|
1151
1157
|
const fetchFn = await getFetch();
|
|
1152
1158
|
const url = `${apiBase}/project-assistant/run-qaqc`;
|
|
1153
1159
|
const { resp, body } = await fetchJsonWithTimeout(
|
|
@@ -1158,6 +1164,8 @@ async function createRunQaqcBatch({ apiBase, key, timeoutMs, payload }) {
|
|
|
1158
1164
|
headers: {
|
|
1159
1165
|
"Content-Type": "application/json",
|
|
1160
1166
|
Authorization: `Bearer ${key}`,
|
|
1167
|
+
"X-Idempotency-Key": String(idempotencyKey || "").trim(),
|
|
1168
|
+
...(String(clientSessionId || "").trim() ? { "X-Client-Session-Id": String(clientSessionId).trim() } : {}),
|
|
1161
1169
|
},
|
|
1162
1170
|
body: JSON.stringify(payload),
|
|
1163
1171
|
},
|
|
@@ -1241,6 +1249,11 @@ async function runRunQaqc(args) {
|
|
|
1241
1249
|
};
|
|
1242
1250
|
const clientSessionId = firstNonEmptyString(args["client-session-id"], args.clientSessionId, args.client_session_id);
|
|
1243
1251
|
if (clientSessionId) payload.client_session_id = clientSessionId;
|
|
1252
|
+
const idempotencyKey = resolveProjectMutationIdempotencyKey({
|
|
1253
|
+
args,
|
|
1254
|
+
operation: "run-qaqc",
|
|
1255
|
+
payload,
|
|
1256
|
+
});
|
|
1244
1257
|
|
|
1245
1258
|
if (args["print-context"] || args.printContext || args["dry-run"] || args.dryRun) {
|
|
1246
1259
|
console.log(JSON.stringify(payload, null, 2));
|
|
@@ -1254,7 +1267,14 @@ async function runRunQaqc(args) {
|
|
|
1254
1267
|
|
|
1255
1268
|
let data;
|
|
1256
1269
|
try {
|
|
1257
|
-
data = await createRunQaqcBatch({
|
|
1270
|
+
data = await createRunQaqcBatch({
|
|
1271
|
+
apiBase,
|
|
1272
|
+
key,
|
|
1273
|
+
timeoutMs,
|
|
1274
|
+
payload,
|
|
1275
|
+
idempotencyKey,
|
|
1276
|
+
clientSessionId,
|
|
1277
|
+
});
|
|
1258
1278
|
} catch (err) {
|
|
1259
1279
|
if (err?.name === "AbortError") {
|
|
1260
1280
|
console.error(`Request timed out after ${timeoutMs}ms`);
|