trajectories-sh 1.18.2 → 1.18.3
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/cli.js
CHANGED
|
@@ -98,7 +98,7 @@ async function uploadTrajectoryAction(pathArg, opts) {
|
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
if (isZip) {
|
|
101
|
-
const { uploadZip } = await import("./upload-
|
|
101
|
+
const { uploadZip } = await import("./upload-YDTMBIW2.js");
|
|
102
102
|
const slug2 = opts.slug ?? pathArg.replace(/\.zip$/i, "").replace(/\/+$/, "").split("/").pop();
|
|
103
103
|
console.log(chalk.bold(`
|
|
104
104
|
Uploading ZIP ${pathArg} \u2192 ${chalk.cyan(slug2)}
|
|
@@ -127,7 +127,7 @@ async function uploadTrajectoryAction(pathArg, opts) {
|
|
|
127
127
|
Uploading trajectory ${pathArg} \u2192 ${chalk.cyan(slug)}
|
|
128
128
|
`));
|
|
129
129
|
try {
|
|
130
|
-
const { uploadJob } = await import("./upload-
|
|
130
|
+
const { uploadJob } = await import("./upload-YDTMBIW2.js");
|
|
131
131
|
const result = await uploadJob(pathArg, {
|
|
132
132
|
slug,
|
|
133
133
|
name: opts.name
|
|
@@ -70,7 +70,7 @@ async function uploadZip(zipPath, opts) {
|
|
|
70
70
|
method: "POST",
|
|
71
71
|
headers: { Authorization: auth },
|
|
72
72
|
body: formData,
|
|
73
|
-
signal: AbortSignal.timeout(
|
|
73
|
+
signal: AbortSignal.timeout(6e5)
|
|
74
74
|
});
|
|
75
75
|
if (!resp.ok) {
|
|
76
76
|
let detail;
|
|
@@ -82,7 +82,33 @@ async function uploadZip(zipPath, opts) {
|
|
|
82
82
|
}
|
|
83
83
|
throw new Error(`ZIP upload failed (${resp.status}): ${detail}`);
|
|
84
84
|
}
|
|
85
|
-
const
|
|
85
|
+
const initResult = await resp.json();
|
|
86
|
+
console.log(` Server received ZIP. Extracting ${initResult.total_jobs} job(s)...`);
|
|
87
|
+
let lastStatus = "";
|
|
88
|
+
while (true) {
|
|
89
|
+
await new Promise((r) => setTimeout(r, 3e3));
|
|
90
|
+
const statusResp = await fetch(`${apiUrl}/api/cli/push/zip/${initResult.task_id}/status`, {
|
|
91
|
+
headers: { Authorization: auth },
|
|
92
|
+
signal: AbortSignal.timeout(3e4)
|
|
93
|
+
});
|
|
94
|
+
if (!statusResp.ok) {
|
|
95
|
+
throw new Error(`Failed to check ZIP status: ${statusResp.status}`);
|
|
96
|
+
}
|
|
97
|
+
const status = await statusResp.json();
|
|
98
|
+
if (status.status !== lastStatus) {
|
|
99
|
+
console.log(` ${status.status}${status.current_job ? ` (${status.current_job})` : ""} [${status.completed_jobs}/${status.total_jobs}]`);
|
|
100
|
+
lastStatus = status.status;
|
|
101
|
+
}
|
|
102
|
+
if (status.status === "done") {
|
|
103
|
+
const result2 = { jobs: status.jobs };
|
|
104
|
+
var finalResult = result2;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
if (status.status === "error") {
|
|
108
|
+
throw new Error(`Server-side extraction failed: ${status.error}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const result = finalResult;
|
|
86
112
|
const siteUrl = apiUrl.includes("localhost") ? "http://localhost:3000" : apiUrl.replace("api.", "").replace(/\/$/, "");
|
|
87
113
|
return result.jobs.map((j) => ({
|
|
88
114
|
jobId: j.job_id,
|