trajectories-sh 1.10.1 → 1.10.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/cli.js CHANGED
@@ -81,7 +81,7 @@ async function uploadTrajectoryAction(directory, opts) {
81
81
  Uploading trajectory ${directory} \u2192 ${chalk.cyan(slug)}
82
82
  `));
83
83
  try {
84
- const { uploadJob } = await import("./upload-IBWVHRL2.js");
84
+ const { uploadJob } = await import("./upload-K2GBG3J3.js");
85
85
  const result = await uploadJob(directory, {
86
86
  slug,
87
87
  name: opts.name,
@@ -399,7 +399,6 @@ async function uploadArchive(jobId, dir) {
399
399
  }
400
400
  }
401
401
  async function uploadArchiveOnce(jobId, archivePath, archiveSize, entryCount) {
402
- const { createReadStream } = await import("fs");
403
402
  const { ProgressBar } = await import("./progress-H7WNKHDR.js");
404
403
  const urlResp = await apiPost(`/api/cli/push/${jobId}/upload-url`, {});
405
404
  if (!urlResp.ok) {
@@ -409,25 +408,16 @@ async function uploadArchiveOnce(jobId, archivePath, archiveSize, entryCount) {
409
408
  if (!signedUrl) {
410
409
  throw new Error("Server returned no signed URL for archive upload");
411
410
  }
411
+ const archiveData = readFileSync(archivePath);
412
412
  let putError = null;
413
413
  for (let attempt = 0; attempt < 3; attempt++) {
414
414
  const bar = new ProgressBar({ total: 1, totalBytes: archiveSize, label: "\u2191 archive" });
415
- const stream = createReadStream(archivePath);
416
- let bytesSent = 0;
417
- stream.on("data", (chunk) => {
418
- bytesSent += chunk.length;
419
- bar.setBytes(bytesSent);
420
- });
415
+ bar.setBytes(archiveSize);
421
416
  try {
422
417
  const resp = await fetch(signedUrl, {
423
418
  method: "PUT",
424
- headers: {
425
- "Content-Type": "application/gzip",
426
- "Content-Length": String(archiveSize)
427
- },
428
- // undici accepts Node streams here
429
- body: stream,
430
- duplex: "half",
419
+ headers: { "Content-Type": "application/gzip" },
420
+ body: archiveData,
431
421
  signal: AbortSignal.timeout(30 * 60 * 1e3)
432
422
  });
433
423
  bar.setCount(1);
@@ -446,10 +436,6 @@ async function uploadArchiveOnce(jobId, archivePath, archiveSize, entryCount) {
446
436
  bar.done();
447
437
  putError = `fetch error: ${e?.name ?? "Error"} ${e?.message ?? e}`;
448
438
  }
449
- try {
450
- stream.destroy?.();
451
- } catch {
452
- }
453
439
  if (attempt < 2) await sleep(2e3 * (attempt + 1));
454
440
  }
455
441
  if (putError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trajectories-sh",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "CLI for uploading trajectory jobs to trajectories.sh",
5
5
  "type": "module",
6
6
  "bin": {