@sunasteriskrnd/takumi 1.0.0-dev.66 → 1.0.0-dev.68

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.
Files changed (2) hide show
  1. package/dist/index.js +20 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19815,7 +19815,7 @@ var package_default;
19815
19815
  var init_package = __esm(() => {
19816
19816
  package_default = {
19817
19817
  name: "@sunasteriskrnd/takumi",
19818
- version: "1.0.0-dev.66",
19818
+ version: "1.0.0-dev.68",
19819
19819
  description: "CLI tool for bootstrapping and managing Takumi projects",
19820
19820
  type: "module",
19821
19821
  repository: {
@@ -20012,7 +20012,7 @@ function getLegacyManifestPath(providerRoot) {
20012
20012
  return join4(providerRoot, LEGACY_MANIFEST_FILENAME);
20013
20013
  }
20014
20014
  function getCliVersion() {
20015
- return "1.0.0-dev.66"?.trim() || process.env.npm_package_version?.trim() || "unknown";
20015
+ return "1.0.0-dev.68"?.trim() || process.env.npm_package_version?.trim() || "unknown";
20016
20016
  }
20017
20017
  function getCliUserAgent() {
20018
20018
  return `${TAKUMI_CLI_NPM_PACKAGE_NAME}/${getCliVersion()}`;
@@ -54130,9 +54130,11 @@ import { promises as fs8 } from "node:fs";
54130
54130
 
54131
54131
  class ArtifactApiError extends Error {
54132
54132
  status;
54133
- constructor(status, message) {
54133
+ code;
54134
+ constructor(status, message, code) {
54134
54135
  super(message);
54135
54136
  this.status = status;
54137
+ this.code = code;
54136
54138
  this.name = "ArtifactApiError";
54137
54139
  }
54138
54140
  }
@@ -54254,7 +54256,7 @@ async function presignDownload(token, uuid, version3, paths) {
54254
54256
  });
54255
54257
  if (!res.ok) {
54256
54258
  const msg = await parseErrorMessage(res);
54257
- throw new ArtifactApiError(res.status, `Presign-download failed (HTTP ${res.status}): ${msg}`);
54259
+ throw new ArtifactApiError(res.status, `Presign-download failed (HTTP ${res.status}): ${msg}`, msg);
54258
54260
  }
54259
54261
  return await res.json();
54260
54262
  }
@@ -55036,6 +55038,10 @@ function printUploadSummary(entries) {
55036
55038
  }
55037
55039
 
55038
55040
  // src/commands/artifact/download-command.ts
55041
+ var DOWNLOAD_NOT_ALLOWED = "download_not_allowed";
55042
+ function printDownloadNotAllowed() {
55043
+ console.error("The artifact owner has not allowed you to download this artifact.");
55044
+ }
55039
55045
  function deriveSlug(title, uuid) {
55040
55046
  const slug = (title ?? "").trim().replace(/[/\\:*?"<>|.]/g, " ").split("").map((c2) => c2.charCodeAt(0) < 32 ? " " : c2).join("").replace(/\s+/g, "-").replace(/^[.\-]+|[.\-]+$/g, "").slice(0, 80);
55041
55047
  return slug || uuid;
@@ -55060,6 +55066,11 @@ async function artifactDownload(ref, opts) {
55060
55066
  process.exitCode = 1;
55061
55067
  return;
55062
55068
  }
55069
+ if (manifestRes.can_download === false) {
55070
+ printDownloadNotAllowed();
55071
+ process.exitCode = 1;
55072
+ return;
55073
+ }
55063
55074
  const destDir = opts.output ? resolve18(opts.output) : resolve18(deriveSlug(manifestRes.title, uuid));
55064
55075
  try {
55065
55076
  const stat7 = await fs12.stat(destDir);
@@ -55087,7 +55098,11 @@ async function artifactDownload(ref, opts) {
55087
55098
  try {
55088
55099
  presignRes = await presignDownload(token, uuid, manifestRes.version);
55089
55100
  } catch (err) {
55090
- printApiError(err);
55101
+ if (err instanceof ArtifactApiError && err.status === 403 && err.code === DOWNLOAD_NOT_ALLOWED) {
55102
+ printDownloadNotAllowed();
55103
+ } else {
55104
+ printApiError(err);
55105
+ }
55091
55106
  process.exitCode = 1;
55092
55107
  return;
55093
55108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunasteriskrnd/takumi",
3
- "version": "1.0.0-dev.66",
3
+ "version": "1.0.0-dev.68",
4
4
  "description": "CLI tool for bootstrapping and managing Takumi projects",
5
5
  "type": "module",
6
6
  "repository": {