@mytegroupinc/myte-core 0.0.10 → 0.0.12
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 +31 -5
- 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 || {};
|
|
@@ -2610,15 +2616,26 @@ async function runCreatePrd(args) {
|
|
|
2610
2616
|
return;
|
|
2611
2617
|
}
|
|
2612
2618
|
|
|
2619
|
+
const clientSessionId = firstNonEmptyString(args["client-session-id"], args.clientSessionId, args.client_session_id);
|
|
2620
|
+
|
|
2613
2621
|
if (payloads.length === 1) {
|
|
2614
2622
|
let data;
|
|
2623
|
+
const payload = payloads[0];
|
|
2624
|
+
if (clientSessionId) payload.client_session_id = clientSessionId;
|
|
2625
|
+
const idempotencyKey = resolveProjectMutationIdempotencyKey({
|
|
2626
|
+
args,
|
|
2627
|
+
operation: "create_prd",
|
|
2628
|
+
payload,
|
|
2629
|
+
});
|
|
2615
2630
|
try {
|
|
2616
|
-
data = await
|
|
2631
|
+
data = await postSuggestionsMutation({
|
|
2617
2632
|
apiBase,
|
|
2618
2633
|
key,
|
|
2619
|
-
payload
|
|
2634
|
+
payload,
|
|
2620
2635
|
timeoutMs,
|
|
2621
2636
|
endpoint: "/project-assistant/create-prd",
|
|
2637
|
+
idempotencyKey,
|
|
2638
|
+
clientSessionId,
|
|
2622
2639
|
});
|
|
2623
2640
|
} catch (err) {
|
|
2624
2641
|
if (err?.name === "AbortError") {
|
|
@@ -2662,12 +2679,21 @@ async function runCreatePrd(args) {
|
|
|
2662
2679
|
};
|
|
2663
2680
|
|
|
2664
2681
|
try {
|
|
2665
|
-
const
|
|
2682
|
+
const payload = { items: payloads };
|
|
2683
|
+
if (clientSessionId) payload.client_session_id = clientSessionId;
|
|
2684
|
+
const idempotencyKey = resolveProjectMutationIdempotencyKey({
|
|
2685
|
+
args,
|
|
2686
|
+
operation: "create_prds",
|
|
2687
|
+
payload,
|
|
2688
|
+
});
|
|
2689
|
+
const data = await postSuggestionsMutation({
|
|
2666
2690
|
apiBase,
|
|
2667
2691
|
key,
|
|
2668
|
-
payload
|
|
2692
|
+
payload,
|
|
2669
2693
|
timeoutMs,
|
|
2670
2694
|
endpoint: "/project-assistant/create-prds",
|
|
2695
|
+
idempotencyKey,
|
|
2696
|
+
clientSessionId,
|
|
2671
2697
|
});
|
|
2672
2698
|
aggregated.project_id = data.project_id || null;
|
|
2673
2699
|
aggregated.created_count = Number(data.created_count || 0);
|