@tigrisdata/cli 3.0.0-beta.2 → 3.0.0
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/README.md +630 -512
- package/dist/{chunk-ABUCZZSA.js → chunk-7EHCU6PH.js} +1 -1
- package/dist/chunk-GNWZ7PX2.js +8 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/cp.js +1 -1
- package/dist/lib/mv.js +1 -1
- package/dist/lib/objects/delete.js +1 -1
- package/dist/lib/objects/get.js +1 -1
- package/dist/lib/objects/info.js +1 -1
- package/dist/lib/objects/list-versions.js +6 -0
- package/dist/lib/objects/put.js +1 -1
- package/dist/lib/objects/set-access.js +1 -0
- package/dist/lib/objects/set.js +1 -1
- package/dist/lib/stat.js +1 -1
- package/dist/lib/update.js +1 -1
- package/dist/specs.yaml +84 -3
- package/dist/utils/update-check.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-K4QARFBT.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,f as l}from"./chunk-
|
|
1
|
+
import{a as s,f as l}from"./chunk-GNWZ7PX2.js";import{a as i,k as m}from"./chunk-QWZ6FK7E.js";import{b as t}from"./chunk-PPNBQWSR.js";import{existsSync as c}from"fs";import{dirname as u,join as a}from"path";import{fileURLToPath as f}from"url";i();var j=f(import.meta.url),d=u(j),h=t(),y=o=>{if(o.length===0)return!1;let e=a(d,"lib",...o)+".js";if(c(e))return!0;let r=a(d,"lib",...o,"index.js");return!!c(r)},b=async o=>{let e=[`./lib/${o.join("/")}.js`,`./lib/${o.join("/")}/index.js`];for(let p of e){let n=await import(p).catch(()=>null);if(n)return{module:n,error:null}}return{module:null,error:`Command not found: ${o.join(" ")}`}},x=m({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{d as m,e as d,f}from"./chunk-ATBINUDP.js";import{mkdirSync as w,readFileSync as _,realpathSync as E,writeFileSync as I}from"fs";import x from"https";import{homedir as g}from"os";import{join as h}from"path";var u="3.0.0";var b=h(g(),".tigris","update-check.json");function y(){try{let e=_(b,"utf-8"),n=JSON.parse(e);return typeof n.latestVersion=="string"&&typeof n.lastChecked=="number"?n:null}catch{return null}}function v(e){try{w(h(g(),".tigris"),{recursive:!0}),I(b,JSON.stringify(e),"utf-8")}catch{}}function T(e,n){let a=i=>{let s=i.startsWith("v")?i.slice(1):i,l=null,o=s.indexOf("-");o!==-1&&(l=s.slice(o+1),s=s.slice(0,o));let c=s.split(".");if(c.length!==3)return null;let p=c.map(Number);return p.some(isNaN)?null:{major:p[0],minor:p[1],patch:p[2],prerelease:l}},r=a(e),t=a(n);return!r||!t?!1:t.major>r.major?!0:t.major<r.major?!1:t.minor>r.minor?!0:t.minor<r.minor?!1:t.patch>r.patch?!0:t.patch<r.patch?!1:r.prerelease&&!t.prerelease?!0:(!r.prerelease&&t.prerelease,!1)}function N(){if(process.platform==="win32")return!1;try{let e=E(process.execPath);return e.includes("/Cellar/")||e.includes("/Caskroom/")}catch{return!1}}function M(){return globalThis.__TIGRIS_BINARY===!0?N()?"brew upgrade tigris":process.platform==="win32"?"irm https://github.com/tigrisdata/cli/releases/latest/download/install.ps1 | iex":"curl -fsSL https://github.com/tigrisdata/cli/releases/latest/download/install.sh | sh":"npm install -g @tigrisdata/cli"}function k(e={}){return new Promise((n,a)=>{let r=x.get(m,{timeout:1e4},t=>{let i="";t.on("data",s=>{i+=s}),t.on("end",()=>{try{let s=JSON.parse(i);typeof s.version=="string"?(v({...y(),latestVersion:s.version,lastChecked:Date.now()}),n(s.version)):a(new Error("Unexpected registry response"))}catch{a(new Error("Failed to parse registry response"))}})});r.on("error",t=>{a(t)}),r.on("timeout",()=>{r.destroy(),a(new Error("Request timed out"))}),e.unref&&r.on("socket",t=>{t.unref()}),r.end()})}function j(){k({unref:!0}).catch(()=>{})}function O(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let e=y(),n=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||36e5;if(e&&T(u,e.latestVersion)&&(!e.lastNotified||Date.now()-e.lastNotified>n)){let r=`Update available: ${u} \u2192 ${e.latestVersion}`,t='Run "tigris update" to upgrade.',i=Math.max(r.length,t.length)+4,s="\u250C"+"\u2500".repeat(i-2)+"\u2510",l="\u2514"+"\u2500".repeat(i-2)+"\u2518",o=c=>"\u2502 "+c.padEnd(i-4)+" \u2502";console.log(`
|
|
2
|
+
${s}
|
|
3
|
+
${o("")}
|
|
4
|
+
${o(r)}
|
|
5
|
+
${o(t)}
|
|
6
|
+
${o("")}
|
|
7
|
+
${l}
|
|
8
|
+
`),v({...e,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||216e5;(!e||Date.now()-e.lastChecked>a)&&j()}export{u as a,y as b,T as c,M as d,k as e,O as f};
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-7EHCU6PH.js";import"./chunk-GNWZ7PX2.js";import"./chunk-QWZ6FK7E.js";import"./chunk-UBANDLB4.js";import"./chunk-DV3LCXRH.js";import"./chunk-7ZUCJBD5.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-7EHCU6PH.js";import"./chunk-GNWZ7PX2.js";import"./chunk-QWZ6FK7E.js";import"./chunk-UBANDLB4.js";import"./chunk-DV3LCXRH.js";import"./chunk-7ZUCJBD5.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
|
package/dist/lib/cp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as G}from"../chunk-EKW6XTGL.js";import{a as D}from"../chunk-SAAGVLRE.js";import{a as q}from"../chunk-HPICBIXL.js";import{a as R}from"../chunk-IRDNZN7R.js";import{a as U,b as v,d as C,f as O,g as J,i as j}from"../chunk-RXNG56FL.js";import{d as K}from"../chunk-YN2TKPPT.js";import{a as x,b as M}from"../chunk-S6KFKBMY.js";import{a as f}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import"../chunk-3EAZ2L6H.js";import"../chunk-OHGCOC5Q.js";import{copy as P,get as tt,head as et,list as ot,put as V}from"@tigrisdata/storage";import{createReadStream as it,createWriteStream as nt,existsSync as X,mkdirSync as rt,readdirSync as A,statSync as z}from"fs";import{homedir as at}from"os";import{basename as E,dirname as L,join as N,relative as _,resolve as H}from"path";import{Readable as Y}from"stream";import{pipeline as lt}from"stream/promises";var h=!1;function ct(i,t){let e=U(i),r=U(t);return!e&&!r&&f("At least one path must be a remote Tigris path (t3:// or tigris://)"),e&&r?"remote-to-remote":e?"remote-to-local":"local-to-remote"}function Z(i){return i==="~"||i.startsWith("~/")?H(at(),i.slice(2)):H(i)}function st(i){return A(i,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>{let r=e.parentPath??e.path;return N(r,e.name)})}function pt(i,t){let e=L(i),r=E(i),c=O(r);return X(e)?t?A(e,{recursive:!0,withFileTypes:!0}).filter(a=>a.isFile()&&c.test(a.name)).map(a=>{let o=a.parentPath??a.path;return N(o,a.name)}):A(e,{withFileTypes:!0}).filter(o=>o.isFile()&&c.test(o.name)).map(o=>N(e,o.name)):[]}async function B(i,t,e,r,c=!1){let p;try{p=z(i).size}catch{return{error:`File not found: ${i}`}}let a=it(i),o=Y.toWeb(a),n=q(i),{error:l}=await V(e,o,{...G(p),...n?{contentType:n}:{},onUploadProgress:c?({loaded:u})=>{if(p!==void 0&&p>0){let s=Math.round(u/p*100);process.stdout.write(`\rUploading: ${R(u)} / ${R(p)} (${s}%)`)}else process.stdout.write(`\rUploading: ${R(u)}`)}:void 0,config:{...r,bucket:t}});return c&&process.stdout.write("\r"+" ".repeat(60)+"\r"),l?{error:l.message}:{}}async function Q(i,t,e,r,c=!1){let p;if(c){let{data:s}=await et(t,{config:{...r,bucket:i}});p=s?.size}let{data:a,error:o}=await tt(t,"stream",{config:{...r,bucket:i}});if(o)return{error:o.message};let n=L(e);X(n)||rt(n,{recursive:!0});let l=nt(e),u=Y.fromWeb(a);if(c&&p!==void 0&&p>0){let s=0;u.on("data",m=>{s+=m.length;let d=Math.round(s/p*100);process.stdout.write(`\rDownloading: ${R(s)} / ${R(p)} (${d}%)`)})}return await lt(u,l),c&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function I(i,t,e,r,c){if(e.endsWith("/")){let{error:a}=await V(c,"",{config:{...i,bucket:r}});return a?{error:a.message}:{}}let{error:p}=await P(e,c,{srcBucket:t,destBucket:r,config:{...i,bucket:r}});return p?{error:p.message}:{}}async function ut(i,t,e,r){let c=Z(i);if(i.includes("*")){let o=pt(c,r);if(o.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files matching pattern");return}let n=L(c),l=o.map(m=>async()=>{let d=_(n,m),w=t.path?`${t.path.replace(/\/$/,"")}/${d}`:d,y=await B(m,t.bucket,w,e);return y.error?(console.error(`Failed to upload ${m}: ${y.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${w}`),!0)}),s=(await D(l,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:s}):`Uploaded ${s} file(s)`);return}let a;try{a=z(c)}catch{f(`Source not found: ${i}`)}if(a.isDirectory()){r||f(`${i} is a directory (not copied). Use -r to copy recursively.`);let o=st(c);if(o.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files to upload");return}let n=i.endsWith("/")?"":E(c),l=o.map(m=>async()=>{let d=_(c,m),y=[t.path?.replace(/\/$/,""),n,d].filter(Boolean).join("/"),F=await B(m,t.bucket,y,e);return F.error?(console.error(`Failed to upload ${m}: ${F.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${y}`),!0)}),s=(await D(l,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:s}):`Uploaded ${s} file(s)`)}else{let o=E(c),n;t.path?i.endsWith("/")||t.path.endsWith("/")?n=`${t.path.replace(/\/$/,"")}/${o}`:await C(t.bucket,t.path,e)?n=`${t.path}/${o}`:n=t.path:n=o;let l=await B(c,t.bucket,n,e,!h);l.error&&f(l.error),console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:1,src:i,dest:`t3://${t.bucket}/${n}`}):`Uploaded ${i} -> t3://${t.bucket}/${n}`)}}async function ft(i,t,e,r,c){let p=i.endsWith("/");!t.path&&!p&&f("Cannot copy a bucket. Provide a path within the bucket.");let a=Z(e),o=t.path.includes("*"),n=t.path.endsWith("/")||!t.path&&p;if(!o&&!n&&(n=await C(t.bucket,t.path,r)),n&&!o&&!c&&f("Source is a remote folder (not copied). Use -r to copy recursively."),o||n){let l=o?J(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",u=!o&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",{items:s,error:m}=await j(t.bucket,l||void 0,r);m&&f(m);let d=s.filter($=>!$.name.endsWith("/"));if(o){let $=t.path.split("/").pop(),b=O($);d=d.filter(k=>{let g=l?k.name.slice(l.length):k.name;return!c&&g.includes("/")?!1:b.test(g.split("/").pop())})}if(d.length===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:0}):"No objects to download");return}let w=d.map($=>async()=>{let b=l?$.name.slice(l.length):$.name,k=u?N(a,u,b):N(a,b),g=await Q(t.bucket,$.name,k,r);return g.error?(console.error(`Failed to download ${$.name}: ${g.error}`),!1):(h||console.log(`Downloaded t3://${t.bucket}/${$.name} -> ${k}`),!0)}),F=(await D(w,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:F}):`Downloaded ${F} file(s)`)}else{let l=t.path.split("/").pop(),u,s=!1;try{s=z(a).isDirectory()}catch{}s||e.endsWith("/")?u=N(a,l):u=a;let m=await Q(t.bucket,t.path,u,r,!h);m.error&&f(m.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:1,src:`t3://${t.bucket}/${t.path}`,dest:u}):`Downloaded t3://${t.bucket}/${t.path} -> ${u}`)}}async function mt(i,t,e,r,c){let p=i.endsWith("/");!t.path&&!p&&f("Cannot copy a bucket. Provide a path within the bucket.");let a=i.includes("*"),o=t.path.endsWith("/")||!t.path&&p;if(!a&&!o&&t.path&&(o=await C(t.bucket,t.path,r)),o&&!a&&!c&&f("Source is a remote folder (not copied). Use -r to copy recursively."),a||o){let n=a?J(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",l=!a&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",s=[e.path?.replace(/\/$/,"")||"",l].filter(Boolean).join("/"),m=s?`${s}/`:"";t.bucket===e.bucket&&n===m&&f("Source and destination are the same");let{items:d,error:w}=await j(t.bucket,n||void 0,r);w&&f(w);let y=d.filter(g=>g.name!==n);if(a){let g=t.path.split("/").pop(),S=O(g);y=y.filter(W=>{let T=n?W.name.slice(n.length):W.name;return!c&&T.includes("/")?!1:S.test(T.split("/").pop())})}let F=y.map(g=>async()=>{let S=n?g.name.slice(n.length):g.name,W=s?`${s}/${S}`:S,T=await I(r,t.bucket,g.name,e.bucket,W);return T.error?(console.error(`Failed to copy ${g.name}: ${T.error}`),!1):(h||console.log(`Copied t3://${t.bucket}/${g.name} -> t3://${e.bucket}/${W}`),!0)}),b=(await D(F,8)).filter(Boolean).length,k=!1;if(s&&n){let{data:g}=await ot({prefix:n,limit:1,config:{...r,bucket:t.bucket}});if(g?.items?.some(S=>S.name===n)){let S=`${s}/`,W=await I(r,t.bucket,n,e.bucket,S);W.error?console.error(`Failed to copy folder marker: ${W.error}`):k=!0}}if(b===0&&k&&(b=1),b===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:0}):"No objects to copy");return}console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:b}):`Copied ${b} object(s)`)}else{let n=t.path.split("/").pop(),l;e.path?e.path.endsWith("/")?l=`${e.path}${n}`:await C(e.bucket,e.path,r)?l=`${e.path}/${n}`:l=e.path:l=n,t.bucket===e.bucket&&t.path===l&&f("Source and destination are the same");let u=await I(r,t.bucket,t.path,e.bucket,l);u.error&&f(u.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:1,src:`t3://${t.bucket}/${t.path}`,dest:`t3://${e.bucket}/${l}`}):`Copied t3://${t.bucket}/${t.path} -> t3://${e.bucket}/${l}`)}}async function ht(i){let t=x(i,["src"]),e=x(i,["dest"]);(!t||!e)&&f("Both src and dest arguments are required");let r=!!x(i,["recursive","r"]);h=M(i)==="json";let p=ct(t,e),a=await K({withCredentialProvider:!0});switch(p){case"local-to-remote":{let o=v(e);o.bucket||f("Invalid destination path"),await ut(t,o,a,r);break}case"remote-to-local":{let o=v(t);o.bucket||f("Invalid source path"),await ft(t,o,e,a,r);break}case"remote-to-remote":{let o=v(t),n=v(e);o.bucket||f("Invalid source path"),n.bucket||f("Invalid destination path"),await mt(t,o,n,a,r);break}}process.exit(0)}export{ht as default};
|
package/dist/lib/mv.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as x,b as M}from"../chunk-S77OAN6Y.js";import{a as E,b as j,d as R,f as T,g as D,i as J}from"../chunk-RXNG56FL.js";import{d as O}from"../chunk-YN2TKPPT.js";import{a as w,b as N}from"../chunk-S6KFKBMY.js";import{a as s}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import"../chunk-3EAZ2L6H.js";import"../chunk-OHGCOC5Q.js";import{copy as G,list as H,move as L,put as Q,remove as C}from"@tigrisdata/storage";var d=!1;async function V(i){let a=w(i,["src"]),c=w(i,["dest"]),m=w(i,["yes","y","force","f"]),p=!!w(i,["recursive","r"]);d=N(i)==="json",(!a||!c)&&s("both src and dest arguments are required"),(!E(a)||!E(c))&&s("Both src and dest must be remote Tigris paths (t3:// or tigris://)");let e=j(a),t=j(c);e.bucket||s("Invalid source path"),t.bucket||s("Invalid destination path");let g=a.endsWith("/");!e.path&&!g&&s("Cannot move a bucket. Provide a path within the bucket.");let l=await O({withCredentialProvider:!0}),h=e.path.includes("*"),y=e.path.endsWith("/")||!e.path&&g;if(!h&&!y&&e.path&&(y=await R(e.bucket,e.path,l)),y&&!h&&!p&&s("Source is a remote folder (not moved). Use -r to move recursively."),h||y){let r=h?D(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",n=!h&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",f=[t.path?.replace(/\/$/,"")||"",n].filter(Boolean).join("/"),U=f?`${f}/`:"";e.bucket===t.bucket&&r===U&&s("Source and destination are the same");let{items:q,error:I}=await J(e.bucket,r||void 0,l);I&&s(I);let b=q.filter(o=>o.name!==r);if(h){let o=e.path.split("/").pop(),u=T(o);b=b.filter(k=>{let $=r?k.name.slice(r.length):k.name;return!p&&$.includes("/")?!1:u.test($.split("/").pop())})}let{data:_}=await H({prefix:r,limit:1,config:{...l,bucket:e.bucket}}),S=r?_?.items?.some(o=>o.name===r):!1;if(b.length===0&&!S){console.log(d?JSON.stringify({action:"moved",count:0}):"No objects to move");return}let z=b.length+(S?1:0);if(!m&&(x("Use --yes to skip confirmation"),!await M(`Are you sure you want to move ${z} object(s)?`))){d||console.log("Aborted");return}let v=0;for(let o of b){let u=r?o.name.slice(r.length):o.name,k=f?`${f}/${u}`:u,$=await A(l,e.bucket,o.name,t.bucket,k);$.error?console.error(`Failed to move ${o.name}: ${$.error}`):(d||console.log(`Moved t3://${e.bucket}/${o.name} -> t3://${t.bucket}/${k}`),v++)}let W=!1;if(S)if(f){let o=`${f}/`,u=await A(l,e.bucket,r,t.bucket,o);u.error?console.error(`Failed to move folder marker: ${u.error}`):W=!0}else{let{error:o}=await C(r,{config:{...l,bucket:e.bucket}});o?console.error(`Failed to remove source folder marker: ${o.message}`):W=!0}v===0&&W&&(v=1),console.log(d?JSON.stringify({action:"moved",count:v}):`Moved ${v} object(s)`)}else{let r=e.path.split("/").pop(),n;if(t.path?t.path.endsWith("/")?n=`${t.path}${r}`:await R(t.bucket,t.path,l)?n=`${t.path}/${r}`:n=t.path:n=r,e.bucket===t.bucket&&e.path===n&&s("Source and destination are the same"),!m&&(x("Use --yes to skip confirmation"),!await M(`Are you sure you want to move 't3://${e.bucket}/${e.path}'?`))){d||console.log("Aborted");return}let F=await A(l,e.bucket,e.path,t.bucket,n);F.error&&s(F.error),console.log(d?JSON.stringify({action:"moved",count:1,src:`t3://${e.bucket}/${e.path}`,dest:`t3://${t.bucket}/${n}`}):`Moved t3://${e.bucket}/${e.path} -> t3://${t.bucket}/${n}`)}process.exit(0)}async function A(i,a,c,m,p){if(c.endsWith("/")){let{error:t}=await Q(p,"",{config:{...i,bucket:m}});if(t)return{error:t.message};let{error:g}=await C(c,{config:{...i,bucket:a}});return g?{error:`Copied but failed to delete source: ${g.message}`}:{}}if(a===m){let{error:t}=await L(c,p,{config:{...i,bucket:a}});return t?{error:t.message}:{}}let{error:P}=await G(c,p,{srcBucket:a,destBucket:m,config:{...i,bucket:m}});if(P)return{error:P.message};let{error:e}=await C(c,{config:{...i,bucket:a}});return e?{error:`Copied but failed to delete source: ${e.message}`}:{}}export{V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as V,b as N}from"../../chunk-S77OAN6Y.js";import{h as C}from"../../chunk-RXNG56FL.js";import{d as q}from"../../chunk-YN2TKPPT.js";import{a as d,b as T}from"../../chunk-S6KFKBMY.js";import{a as w,b as o,c as O,d as S}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as A,c as $,d as j,j as M}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{listVersions as H,remove as R}from"@tigrisdata/storage";var r=M("objects","delete");async function W(c){A(r);let K=T(c),b=d(c,["bucket"]),E=d(c,["key"]),F=d(c,["yes","y","force"]),a=d(c,["version-id","versionId"]),u=!!d(c,["all-versions","allVersions"]);b||o(r,"Bucket name or path is required"),a&&u&&o(r,"Cannot use --version-id with --all-versions");let h=C(b),s=h.bucket,m=E||h.key||void 0;m||o(r,"Object key is required");let I={...await q(),bucket:s},n=Array.isArray(m)?m:[m];a&&n.length>1&&o(r,"--version-id targets a single object; pass exactly one key");let f=[];if(u)for(let e of n){let t=0,g,v,p=!1;for(;;){let{data:l,error:x}=await H({prefix:e,...g?{keyMarker:g}:{},...v?{versionIdMarker:v}:{},config:I});x&&o(r,x);for(let i of l.versions)i.name===e?(f.push({key:e,versionId:i.versionId}),t++):i.name>e&&(p=!0);for(let i of l.deleteMarkers)i.name===e?(f.push({key:e,versionId:i.versionId}),t++):i.name>e&&(p=!0);if(p||!l.hasMore)break;l.nextKeyMarker||o(r,`listVersions reported more pages but no nextKeyMarker for key '${e}'`),g=l.nextKeyMarker,v=l.nextVersionIdMarker}t===0&&o(r,`No versions or delete markers found for key '${e}'`)}else if(a)f.push({key:n[0],versionId:a});else for(let e of n)f.push({key:e});if(!F){V("Use --yes to skip confirmation");let e=u?`Hard-delete ${f.length} version(s) and delete marker(s) for ${n.length} object(s) from '${s}'?`:a?`Hard-delete version '${a}' of '${n[0]}' from '${s}'?`:`Delete ${n.length} object(s) from '${s}'?`;if(!await N(e)){console.log("Aborted");return}}let y=[],k=[];for(let e of f){let{error:t}=await R(e.key,{...e.versionId?{versionId:e.versionId}:{},config:I});t?(j(r,t.message,e),k.push({...e,error:t.message})):(y.push(e),$(r,e))}if(K==="json"){let e=O(r,{bucket:s}),t={action:"deleted",bucket:s,keys:y.map(g=>g.key),deleted:y,errors:k};e.length>0&&(t.nextActions=e),console.log(JSON.stringify(t))}k.length>0&&w(k[0].error,r),S(r,{bucket:s})}export{W as default};
|
package/dist/lib/objects/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as
|
|
1
|
+
import{h as w}from"../../chunk-RXNG56FL.js";import{d as k}from"../../chunk-YN2TKPPT.js";import{a as r,b as j}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as a,j as b}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{get as S}from"@tigrisdata/storage";import{createWriteStream as q,writeFileSync as T}from"fs";import{extname as C}from"path";import{Readable as x}from"stream";import{pipeline as y}from"stream/promises";var e=b("objects","get"),E=new Set([".js",".ts",".jsx",".tsx",".mjs",".cjs",".py",".rb",".php",".java",".go",".rs",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".scala",".clj",".ex",".exs",".erl",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".json",".yaml",".yml",".toml",".ini",".cfg",".conf",".xml",".plist",".env",".properties",".html",".htm",".css",".scss",".sass",".less",".styl",".md",".markdown",".mdx",".rst",".txt",".text",".csv",".tsv",".log",".ejs",".hbs",".pug",".jade",".njk",".twig",".liquid",".svg",".gitignore",".dockerignore",".editorconfig"]);function F(t,m){let d=C(m||t).toLowerCase();return E.has(d)?"string":"stream"}async function N(t){u(e);let m=j(t),p=r(t,["bucket"]),d=r(t,["key"]),s=r(t,["output","o","O"]),v=r(t,["mode","m","M"]),g=r(t,["snapshot-version","snapshotVersion","snapshot"]),f=r(t,["version-id","versionId"]);p||c(e,"Bucket name or path is required");let{bucket:l,key:o}=w(p,d);o||c(e,"Object key is required");let h=await k();if((v||F(o,s))==="stream"){let{data:i,error:n}=await S(o,"stream",{...g?{snapshotVersion:g}:{},...f?{versionId:f}:{},config:{...h,bucket:l}});if(n&&c(e,n),s){let O=q(s);await y(x.fromWeb(i),O),a(e,{key:o,output:s}),m==="json"&&console.log(JSON.stringify({action:"downloaded",bucket:l,key:o,output:s}))}else await y(x.fromWeb(i),process.stdout),a(e)}else{let{data:i,error:n}=await S(o,"string",{...g?{snapshotVersion:g}:{},...f?{versionId:f}:{},config:{...h,bucket:l}});n&&c(e,n),s?(T(s,i),a(e,{key:o,output:s}),m==="json"&&console.log(JSON.stringify({action:"downloaded",bucket:l,key:o,output:s}))):(console.log(i),a(e))}}export{N as default};
|
package/dist/lib/objects/info.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h,f as k}from"../../chunk-IRDNZN7R.js";import{h as
|
|
1
|
+
import{a as h,f as k}from"../../chunk-IRDNZN7R.js";import{h as v}from"../../chunk-RXNG56FL.js";import{d as l}from"../../chunk-YN2TKPPT.js";import{a as i,b as d}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as p,j as g}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{head as A}from"@tigrisdata/storage";var e=g("objects","info");async function I(o){u(e);let b=d(o),s=i(o,["bucket"]),y=i(o,["key"]),c=i(o,["snapshot-version","snapshotVersion","snapshot"]),a=i(o,["version-id","versionId"]);s||r(e,"Bucket name or path is required");let{bucket:f,key:n}=v(s,y);n||r(e,"Object key is required");let S=await l(),{data:t,error:m}=await A(n,{...c?{snapshotVersion:c}:{},...a?{versionId:a}:{},config:{...S,bucket:f}});m&&r(e,m),t||r(e,"Object not found");let j=[{metric:"Path",value:t.path},{metric:"Size",value:h(t.size)},{metric:"Content-Type",value:t.contentType||"N/A"},{metric:"Content-Disposition",value:t.contentDisposition||"N/A"},{metric:"Modified",value:t.modified.toISOString()},{metric:"URL",value:t.url}],O=k(j,b,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(O),p(e,{bucket:f,key:n})}export{I as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as K,b as w,d as l,e as d}from"../../chunk-IRDNZN7R.js";import{e as C}from"../../chunk-RXNG56FL.js";import{d as b}from"../../chunk-YN2TKPPT.js";import{a as o,b as I,c as V}from"../../chunk-S6KFKBMY.js";import{b as a}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as u,e as x,j as v}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{listVersions as D}from"@tigrisdata/storage";var i=v("objects","list-versions");async function O(s){p(i);let k=o(s,["bucket"]),z=o(s,["prefix","p","P"]),m=o(s,["delimiter","d"]),c=o(s,["key-marker","keyMarker"]),f=o(s,["version-id-marker","versionIdMarker"]),g=I(s),{limit:y}=V(s);k||a(i,"Bucket name is required");let M=C(k),P=M.bucket,S=z||M.path||void 0,j=await b(),{data:r,error:h}=await D({prefix:S,...m?{delimiter:m}:{},...y!==void 0?{limit:y}:{},...c?{keyMarker:c}:{},...f?{versionIdMarker:f}:{},config:{...j,bucket:P}});h&&a(i,h);let t=r.versions.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",size:K(e.size),modified:e.lastModified})),n=r.deleteMarkers.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",modified:e.lastModified})),L=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],T=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"modified",header:"Modified"}];if(g==="json")console.log(w({versions:r.versions,deleteMarkers:r.deleteMarkers,commonPrefixes:r.commonPrefixes,nextKeyMarker:r.nextKeyMarker,nextVersionIdMarker:r.nextVersionIdMarker,hasMore:r.hasMore}));else if(g==="xml"){let e=["<listVersions>"];e.push(" "+l(t,"versions","version").replace(/\n/g,`
|
|
2
|
+
`)),e.push(" "+l(n,"deleteMarkers","deleteMarker").replace(/\n/g,`
|
|
3
|
+
`)),e.push("</listVersions>"),console.log(e.join(`
|
|
4
|
+
`))}else{if(t.length===0&&n.length===0){x(i);return}if(t.length>0&&(console.log(`
|
|
5
|
+
Versions`),console.log(d(t,L))),n.length>0&&(console.log("Delete Markers"),console.log(d(n,T))),r.hasMore&&r.nextKeyMarker){let e=`
|
|
6
|
+
Next page: --key-marker "${r.nextKeyMarker}"`;r.nextVersionIdMarker&&(e+=` --version-id-marker "${r.nextVersionIdMarker}"`),console.error(e)}}u(i,{versions:t.length,deleteMarkers:n.length})}export{O as default};
|
package/dist/lib/objects/put.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as R}from"../../chunk-EKW6XTGL.js";import{a as A}from"../../chunk-HPICBIXL.js";import{a as s,f as v}from"../../chunk-IRDNZN7R.js";import{h as j}from"../../chunk-RXNG56FL.js";import{d as w}from"../../chunk-YN2TKPPT.js";import{a as n,b as z}from"../../chunk-S6KFKBMY.js";import{b as i,d as T}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as k,c as S,j as h}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{put as E}from"@tigrisdata/storage";import{createReadStream as M,statSync as N}from"fs";import{Readable as C}from"stream";var t=h("objects","put");async function Y(r){k(t);let u=n(r,["bucket"]),l=n(r,["key"]),y=n(r,["file"]),O=n(r,["access","a","A"],"private"),P=n(r,["content-type","contentType","t","T"]),$=z(r);u||i(t,"Bucket name or path is required");let d=j(u),m=d.bucket,a=d.key||l,e=d.key&&l||y;a||i(t,"Object key is required");let q=!process.stdin.isTTY;!e&&!q&&i(t,"File path is required (or pipe data via stdin)");let f,o;if(e){try{o=N(e).size}catch{i(t,`File not found: ${e}`)}let p=M(e);f=C.toWeb(p)}else f=C.toWeb(process.stdin);let U=await w({withCredentialProvider:!0}),x=e?R(o):{multipart:!0,partSize:5*1024*1024,queueSize:8},F=P??(e?A(e):void 0),{data:c,error:g}=await E(a,f,{access:O==="public"?"public":"private",contentType:F,...x,onUploadProgress:({loaded:p,percentage:b})=>{o!==void 0&&o>0?process.stdout.write(`\rUploading: ${s(p)} / ${s(o)} (${b}%)`):process.stdout.write(`\rUploading: ${s(p)}`)},config:{...U,bucket:m}});process.stdout.write("\r"+" ".repeat(60)+"\r"),g&&i(t,g);let W=[{path:c.path,size:s(c.size??o??0),contentType:c.contentType||"-",modified:c.modified}],B=v(W,$,"objects","object",[{key:"path",header:"Path"},{key:"size",header:"Size"},{key:"contentType",header:"Content-Type"},{key:"modified",header:"Modified"}]);console.log(B),S(t,{key:a,bucket:m}),T(t,{key:a,bucket:m})}export{Y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as l}from"../../chunk-RXNG56FL.js";import{d as k}from"../../chunk-YN2TKPPT.js";import{a as o,b}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as m,c as u,j as p}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{setObjectAccess as v}from"@tigrisdata/storage";var e=p("objects","set-access");async function j(r){m(e);let d=b(r),a=o(r,["bucket"]),f=o(r,["key"]),y=o(r,["access"]);a||c(e,"Bucket name or path is required");let i=l(a),n=i.bucket,s=i.key||f,t=i.key?f:y;s||c(e,"Object key is required"),t||c(e,"Access level is required (public or private)"),t!=="public"&&t!=="private"&&c(e,'Access level must be either "public" or "private"');let A=await k(),{error:g}=await v(s,{access:t,config:{...A,bucket:n}});g&&c(e,g),d==="json"&&console.log(JSON.stringify({action:"updated",bucket:n,key:s,access:t})),u(e,{key:s,bucket:n,access:t})}export{j as default};
|
package/dist/lib/objects/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as
|
|
1
|
+
import{h as d}from"../../chunk-RXNG56FL.js";import{d as b}from"../../chunk-YN2TKPPT.js";import{a as i,b as y}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as k,j as l}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{move as v,setObjectAccess as A}from"@tigrisdata/storage";var e=l("objects","set");async function O(r){p(e);let w=y(r),f=i(r,["bucket"]),j=i(r,["key"]),s=i(r,["access","a","A"]),c=i(r,["new-key","n","newKey"]);f||t(e,"Bucket name or path is required");let{bucket:n,key:a}=d(f,j);a||t(e,"Object key is required"),s||t(e,"Access level is required (--access public|private)");let g={...await b(),bucket:n},o=a;if(c){let{error:u}=await v(a,c,{config:g});u&&t(e,u),o=c}let{error:m}=await A(o,{access:s==="public"?"public":"private",config:g});m&&t(e,m),w==="json"&&console.log(JSON.stringify({action:"updated",bucket:n,key:o,access:s,...c?{newKey:c}:{}})),k(e,{key:o,bucket:n})}export{O as default};
|
package/dist/lib/stat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as w}from"../chunk-HWX63Y3P.js";import{a as d,f as
|
|
1
|
+
import{c as w}from"../chunk-HWX63Y3P.js";import{a as d,f as m}from"../chunk-IRDNZN7R.js";import{e as I}from"../chunk-RXNG56FL.js";import{d as j}from"../chunk-YN2TKPPT.js";import{a as u,b as O}from"../chunk-S6KFKBMY.js";import{b as i}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import{b as y,c,j as b}from"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import"../chunk-3EAZ2L6H.js";import"../chunk-OHGCOC5Q.js";import{getBucketInfo as A,getStats as M,head as z}from"@tigrisdata/storage";var t=b("stat");async function C(s){y(t);let h=u(s,["path"]),f=O(s),v=u(s,["snapshot-version","snapshotVersion","snapshot"]),S=u(s,["version-id","versionId"]),l=await j();if(!h){let{data:o,error:a}=await M({config:l});a&&i(t,a);let p=[{metric:"Active Buckets",value:String(o.stats.activeBuckets)},{metric:"Total Objects",value:String(o.stats.totalObjects)},{metric:"Total Unique Objects",value:String(o.stats.totalUniqueObjects)},{metric:"Total Storage",value:d(o.stats.totalStorageBytes)}],g=m(p,f,"stats","stat",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(g),c(t),process.exit(0)}let{bucket:r,path:n}=I(h);if(r||i(t,"Invalid path"),!n||n==="/"){let{data:o,error:a}=await A(r,{config:l});a&&i(t,a);let p=w(o).map(({label:T,value:V})=>({metric:T,value:V})),g=m(p,f,"bucket-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(g),c(t,{bucket:r}),process.exit(0)}let{data:e,error:k}=await z(n,{...v?{snapshotVersion:v}:{},...S?{versionId:S}:{},config:{...l,bucket:r}});k&&i(t,k),e||i(t,"Object not found");let x=[{metric:"Path",value:e.path},{metric:"Size",value:d(e.size)},{metric:"Content-Type",value:e.contentType||"N/A"},{metric:"Content-Disposition",value:e.contentDisposition||"N/A"},{metric:"Modified",value:e.modified.toISOString()}],B=m(x,f,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(B),c(t,{bucket:r,path:n}),process.exit(0)}export{C as default};
|
package/dist/lib/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as d}from"../chunk-S6KFKBMY.js";import{a as t,c as l,d as p,e as f}from"../chunk-
|
|
1
|
+
import{b as d}from"../chunk-S6KFKBMY.js";import{a as t,c as l,d as p,e as f}from"../chunk-GNWZ7PX2.js";import{b as m}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import{b as s,c as i,f as a,j as c}from"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import{execSync as h}from"child_process";var r=c("update");async function v(u={}){let g=d(u);s(r);try{let o=await f(),e=l(t,o),n=p();if(g==="json"){console.log(JSON.stringify({currentVersion:t,latestVersion:o,updateAvailable:e,updateCommand:n}));return}console.log(`Current version: ${t}`),e?(console.log(`Latest version: ${o}`),console.log("Updating..."),h(n,{stdio:"inherit",...process.platform==="win32"?{shell:"powershell.exe"}:{}}),i(r,{latestVersion:o})):a(r,{currentVersion:t})}catch(o){m(r,o)}}export{v as default};
|
package/dist/specs.yaml
CHANGED
|
@@ -396,6 +396,8 @@ commands:
|
|
|
396
396
|
- name: snapshot-version
|
|
397
397
|
description: Read from a specific bucket snapshot. Accepts a snapshot version string or any UNIX nanosecond-precision timestamp (e.g. 1765889000501544464)
|
|
398
398
|
alias: snapshot
|
|
399
|
+
- name: version-id
|
|
400
|
+
description: Object version id to stat (requires bucket versioning). Omit to stat the latest version
|
|
399
401
|
|
|
400
402
|
# presign
|
|
401
403
|
- name: presign
|
|
@@ -1248,6 +1250,44 @@ commands:
|
|
|
1248
1250
|
- name: source
|
|
1249
1251
|
description: List objects from a specific storage source on buckets with shadow migration enabled
|
|
1250
1252
|
options: [tigris, shadow]
|
|
1253
|
+
# list-versions
|
|
1254
|
+
- name: list-versions
|
|
1255
|
+
description: List object versions and delete markers in a bucket (requires bucket versioning). Returns both arrays separately to match the S3 ListObjectVersions response
|
|
1256
|
+
alias: lv
|
|
1257
|
+
examples:
|
|
1258
|
+
- "tigris objects list-versions my-bucket"
|
|
1259
|
+
- "tigris objects list-versions t3://my-bucket/logs/"
|
|
1260
|
+
- "tigris objects list-versions my-bucket --prefix images/"
|
|
1261
|
+
- "tigris objects list-versions my-bucket --format json"
|
|
1262
|
+
messages:
|
|
1263
|
+
onStart: 'Listing object versions...'
|
|
1264
|
+
onSuccess: 'Found {{versions}} version(s) and {{deleteMarkers}} delete marker(s)'
|
|
1265
|
+
onFailure: 'Failed to list object versions'
|
|
1266
|
+
onEmpty: 'No versions or delete markers found'
|
|
1267
|
+
arguments:
|
|
1268
|
+
- name: bucket
|
|
1269
|
+
description: Name of the bucket, or a path with optional prefix (t3://bucket/prefix/)
|
|
1270
|
+
type: positional
|
|
1271
|
+
required: true
|
|
1272
|
+
examples:
|
|
1273
|
+
- my-bucket
|
|
1274
|
+
- t3://my-bucket/images/
|
|
1275
|
+
- name: prefix
|
|
1276
|
+
description: Filter by key prefix
|
|
1277
|
+
alias: p
|
|
1278
|
+
- name: delimiter
|
|
1279
|
+
description: Group keys sharing a common prefix up to the delimiter (e.g. "/" for folder-style grouping)
|
|
1280
|
+
alias: d
|
|
1281
|
+
- name: format
|
|
1282
|
+
description: Output format
|
|
1283
|
+
options: [json, table, xml]
|
|
1284
|
+
default: table
|
|
1285
|
+
- name: limit
|
|
1286
|
+
description: Maximum number of items to return per page
|
|
1287
|
+
- name: key-marker
|
|
1288
|
+
description: Pagination marker — the key to start listing from (from a prior nextKeyMarker)
|
|
1289
|
+
- name: version-id-marker
|
|
1290
|
+
description: Pagination marker — the version id to start listing from (from a prior nextVersionIdMarker)
|
|
1251
1291
|
# get
|
|
1252
1292
|
- name: get
|
|
1253
1293
|
description: Download an object by key. Prints to stdout by default, or saves to a file with --output
|
|
@@ -1283,6 +1323,8 @@ commands:
|
|
|
1283
1323
|
- name: snapshot-version
|
|
1284
1324
|
description: Read from a specific bucket snapshot. Accepts a snapshot version string or any UNIX nanosecond-precision timestamp (e.g. 1765889000501544464)
|
|
1285
1325
|
alias: snapshot
|
|
1326
|
+
- name: version-id
|
|
1327
|
+
description: Object version id to download (requires bucket versioning). Omit to download the latest version
|
|
1286
1328
|
# put
|
|
1287
1329
|
- name: put
|
|
1288
1330
|
description: Upload a local file as an object. Content-type is auto-detected from extension unless overridden
|
|
@@ -1330,12 +1372,14 @@ commands:
|
|
|
1330
1372
|
default: table
|
|
1331
1373
|
# delete
|
|
1332
1374
|
- name: delete
|
|
1333
|
-
description: Delete one or more objects by key from the given bucket
|
|
1375
|
+
description: Delete one or more objects by key from the given bucket. On a versioned bucket, the default creates a delete marker; use --version-id or --all-versions to hard-delete versions
|
|
1334
1376
|
alias: d
|
|
1335
1377
|
examples:
|
|
1336
1378
|
- "tigris objects delete my-bucket old-file.txt --yes"
|
|
1337
1379
|
- "tigris objects delete t3://my-bucket/old-file.txt --yes"
|
|
1338
1380
|
- "tigris objects delete my-bucket file-a.txt,file-b.txt --yes"
|
|
1381
|
+
- "tigris objects delete my-bucket old-file.txt --version-id abc123 --yes"
|
|
1382
|
+
- "tigris objects delete my-bucket old-file.txt --all-versions --yes"
|
|
1339
1383
|
messages:
|
|
1340
1384
|
onStart: 'Deleting object...'
|
|
1341
1385
|
onSuccess: "Object '{{key}}' deleted successfully"
|
|
@@ -1357,13 +1401,19 @@ commands:
|
|
|
1357
1401
|
multiple: true
|
|
1358
1402
|
examples:
|
|
1359
1403
|
- my-file.txt
|
|
1404
|
+
- name: version-id
|
|
1405
|
+
description: Hard-delete a specific object version (requires bucket versioning). Targets a single key
|
|
1406
|
+
- name: all-versions
|
|
1407
|
+
description: Hard-delete every version and delete marker for the given key(s). Mutually exclusive with --version-id
|
|
1408
|
+
type: flag
|
|
1360
1409
|
- name: force
|
|
1361
1410
|
type: flag
|
|
1362
1411
|
description: Skip confirmation prompts (alias for --yes)
|
|
1363
|
-
# set
|
|
1412
|
+
# set (deprecated)
|
|
1364
1413
|
- name: set
|
|
1365
|
-
description: Update settings on an existing object such as access level
|
|
1414
|
+
description: (Deprecated) Update settings on an existing object such as access level. Use `tigris objects set-access` for ACL changes and `tigris mv` to rename
|
|
1366
1415
|
alias: s
|
|
1416
|
+
deprecated: true
|
|
1367
1417
|
examples:
|
|
1368
1418
|
- "tigris objects set my-bucket my-file.txt --access public"
|
|
1369
1419
|
- "tigris objects set t3://my-bucket/my-file.txt --access public"
|
|
@@ -1372,6 +1422,7 @@ commands:
|
|
|
1372
1422
|
onStart: 'Updating object...'
|
|
1373
1423
|
onSuccess: "Object '{{key}}' updated successfully"
|
|
1374
1424
|
onFailure: 'Failed to update object'
|
|
1425
|
+
onDeprecated: 'tigris objects set is deprecated. Use `tigris objects set-access` for ACL changes and `tigris mv` to rename objects. This command will be removed in a future release.'
|
|
1375
1426
|
arguments:
|
|
1376
1427
|
- name: bucket
|
|
1377
1428
|
description: Name of the bucket, or a full path (t3://bucket/key)
|
|
@@ -1388,6 +1439,33 @@ commands:
|
|
|
1388
1439
|
- name: new-key
|
|
1389
1440
|
description: Rename the object to a new key
|
|
1390
1441
|
alias: n
|
|
1442
|
+
# set-access
|
|
1443
|
+
- name: set-access
|
|
1444
|
+
description: Set the access level (public or private) on an existing object
|
|
1445
|
+
alias: sa
|
|
1446
|
+
examples:
|
|
1447
|
+
- "tigris objects set-access my-bucket my-file.txt public"
|
|
1448
|
+
- "tigris objects set-access t3://my-bucket/my-file.txt private"
|
|
1449
|
+
messages:
|
|
1450
|
+
onStart: 'Updating object access...'
|
|
1451
|
+
onSuccess: "Access for '{{key}}' updated to {{access}}"
|
|
1452
|
+
onFailure: 'Failed to update object access'
|
|
1453
|
+
arguments:
|
|
1454
|
+
- name: bucket
|
|
1455
|
+
description: Name of the bucket, or a full path (t3://bucket/key)
|
|
1456
|
+
type: positional
|
|
1457
|
+
required: true
|
|
1458
|
+
- name: key
|
|
1459
|
+
description: Key of the object (omit if bucket contains the full path)
|
|
1460
|
+
type: positional
|
|
1461
|
+
- name: access
|
|
1462
|
+
description: Access level (public or private)
|
|
1463
|
+
type: positional
|
|
1464
|
+
options: *access_options
|
|
1465
|
+
- name: format
|
|
1466
|
+
description: Output format
|
|
1467
|
+
options: [json, table, xml]
|
|
1468
|
+
default: table
|
|
1391
1469
|
# info
|
|
1392
1470
|
- name: info
|
|
1393
1471
|
description: Show metadata for an object (content type, size, modified date)
|
|
@@ -1396,6 +1474,7 @@ commands:
|
|
|
1396
1474
|
- "tigris objects info my-bucket report.pdf"
|
|
1397
1475
|
- "tigris objects info t3://my-bucket/report.pdf"
|
|
1398
1476
|
- "tigris objects info my-bucket report.pdf --format json"
|
|
1477
|
+
- "tigris objects info my-bucket report.pdf --version-id abc123"
|
|
1399
1478
|
messages:
|
|
1400
1479
|
onStart: ''
|
|
1401
1480
|
onSuccess: ''
|
|
@@ -1415,6 +1494,8 @@ commands:
|
|
|
1415
1494
|
- name: snapshot-version
|
|
1416
1495
|
description: Read from a specific bucket snapshot
|
|
1417
1496
|
alias: snapshot
|
|
1497
|
+
- name: version-id
|
|
1498
|
+
description: Object version id (requires bucket versioning). Omit to read the latest version
|
|
1418
1499
|
|
|
1419
1500
|
#########################
|
|
1420
1501
|
# Manage access keys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c as b,d as c,e as d,f as e}from"../chunk-
|
|
1
|
+
import{b as a,c as b,d as c,e as d,f as e}from"../chunk-GNWZ7PX2.js";import"../chunk-ATBINUDP.js";export{e as checkForUpdates,d as fetchLatestVersion,c as getUpdateCommand,b as isNewerVersion,a as readUpdateCache};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tigrisdata/cli",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Command line interface for Tigris object storage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"@aws-sdk/credential-providers": "^3.1038.0",
|
|
104
104
|
"@smithy/shared-ini-file-loader": "^4.4.9",
|
|
105
105
|
"@tigrisdata/iam": "^2.1.1",
|
|
106
|
-
"@tigrisdata/storage": "^3.
|
|
106
|
+
"@tigrisdata/storage": "^3.6.0",
|
|
107
107
|
"commander": "^14.0.3",
|
|
108
108
|
"enquirer": "^2.4.1",
|
|
109
109
|
"jose": "^6.2.3",
|
package/dist/chunk-K4QARFBT.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{d as m,e as d,f}from"./chunk-ATBINUDP.js";import{mkdirSync as w,readFileSync as _,realpathSync as E,writeFileSync as I}from"fs";import x from"https";import{homedir as g}from"os";import{join as h}from"path";var u="3.0.0-beta.2";var b=h(g(),".tigris","update-check.json");function y(){try{let e=_(b,"utf-8"),n=JSON.parse(e);return typeof n.latestVersion=="string"&&typeof n.lastChecked=="number"?n:null}catch{return null}}function v(e){try{w(h(g(),".tigris"),{recursive:!0}),I(b,JSON.stringify(e),"utf-8")}catch{}}function T(e,n){let a=i=>{let s=i.startsWith("v")?i.slice(1):i,l=null,o=s.indexOf("-");o!==-1&&(l=s.slice(o+1),s=s.slice(0,o));let c=s.split(".");if(c.length!==3)return null;let p=c.map(Number);return p.some(isNaN)?null:{major:p[0],minor:p[1],patch:p[2],prerelease:l}},r=a(e),t=a(n);return!r||!t?!1:t.major>r.major?!0:t.major<r.major?!1:t.minor>r.minor?!0:t.minor<r.minor?!1:t.patch>r.patch?!0:t.patch<r.patch?!1:r.prerelease&&!t.prerelease?!0:(!r.prerelease&&t.prerelease,!1)}function N(){if(process.platform==="win32")return!1;try{let e=E(process.execPath);return e.includes("/Cellar/")||e.includes("/Caskroom/")}catch{return!1}}function M(){return globalThis.__TIGRIS_BINARY===!0?N()?"brew upgrade tigris":process.platform==="win32"?"irm https://github.com/tigrisdata/cli/releases/latest/download/install.ps1 | iex":"curl -fsSL https://github.com/tigrisdata/cli/releases/latest/download/install.sh | sh":"npm install -g @tigrisdata/cli"}function k(e={}){return new Promise((n,a)=>{let r=x.get(m,{timeout:1e4},t=>{let i="";t.on("data",s=>{i+=s}),t.on("end",()=>{try{let s=JSON.parse(i);typeof s.version=="string"?(v({...y(),latestVersion:s.version,lastChecked:Date.now()}),n(s.version)):a(new Error("Unexpected registry response"))}catch{a(new Error("Failed to parse registry response"))}})});r.on("error",t=>{a(t)}),r.on("timeout",()=>{r.destroy(),a(new Error("Request timed out"))}),e.unref&&r.on("socket",t=>{t.unref()}),r.end()})}function j(){k({unref:!0}).catch(()=>{})}function O(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let e=y(),n=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||36e5;if(e&&T(u,e.latestVersion)&&(!e.lastNotified||Date.now()-e.lastNotified>n)){let r=`Update available: ${u} \u2192 ${e.latestVersion}`,t='Run "tigris update" to upgrade.',i=Math.max(r.length,t.length)+4,s="\u250C"+"\u2500".repeat(i-2)+"\u2510",l="\u2514"+"\u2500".repeat(i-2)+"\u2518",o=c=>"\u2502 "+c.padEnd(i-4)+" \u2502";console.log(`
|
|
2
|
-
${s}
|
|
3
|
-
${o("")}
|
|
4
|
-
${o(r)}
|
|
5
|
-
${o(t)}
|
|
6
|
-
${o("")}
|
|
7
|
-
${l}
|
|
8
|
-
`),v({...e,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||216e5;(!e||Date.now()-e.lastChecked>a)&&j()}export{u as a,y as b,T as c,M as d,k as e,O as f};
|