@tigrisdata/cli 2.14.0-beta.3 → 2.14.0-beta.4
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/chunk-JQUG732D.js +1 -0
- package/dist/{chunk-RG5EZWTN.js → chunk-JRKQ5KH6.js} +1 -1
- package/dist/{chunk-DZUJWPQ3.js → chunk-O74FG4KS.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/cp.js +1 -1
- package/dist/lib/ls.js +1 -1
- package/dist/lib/mk.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 -0
- package/dist/lib/objects/list.js +1 -1
- package/dist/lib/objects/put.js +1 -1
- package/dist/lib/objects/set.js +1 -1
- package/dist/lib/presign.js +3 -1
- package/dist/lib/rm.js +1 -1
- package/dist/lib/stat.js +1 -1
- package/dist/lib/touch.js +1 -1
- package/dist/lib/update.js +1 -1
- package/dist/specs.yaml +52 -14
- package/dist/utils/path.js +1 -1
- package/dist/utils/update-check.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-NDNMIXDC.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{list as g}from"@tigrisdata/storage";var c=["t3://","tigris://"];function u(t){return c.some(e=>t.startsWith(e))}function p(t){let e=c.find(r=>t.startsWith(r));return s(t.slice(e.length))}function s(t){let e=t.split("/");return{bucket:e[0],path:e.slice(1).join("/")}}async function d(t,e,r){let{data:n}=await g({prefix:`${e}/`,limit:1,config:{...r,bucket:t}});return!!(n?.items&&n.items.length>0)}function l(t,e){return{source:s(t),destination:s(e)}}function f(t){return u(t)?p(t):s(t)}function x(t){let e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*");return new RegExp("^"+e+"$")}function P(t){let e=t.indexOf("*"),r=t.lastIndexOf("/",e);return r>=0?t.slice(0,r+1):""}function h(t,e){let r=f(t);return e?{bucket:r.bucket,key:e}:{bucket:r.bucket,key:r.path}}async function b(t,e,r){let n=[],o;do{let{data:i,error:a}=await g({prefix:e,paginationToken:o,config:{...r,bucket:t}});if(a)return{items:n,error:a};i?.items&&n.push(...i.items),o=i?.hasMore?i.paginationToken:void 0}while(o);return{items:n}}export{u as a,p as b,s as c,d,l as e,f,x as g,P as h,h as i,b as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,f as l}from"./chunk-
|
|
1
|
+
import{a as s,f as l}from"./chunk-O74FG4KS.js";import{a as i,k as m}from"./chunk-4R4YLHT7.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();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as m,e as d,f}from"./chunk-ATBINUDP.js";import{mkdirSync as C,readFileSync as E,writeFileSync as w}from"fs";import I from"https";import{homedir as g}from"os";import{join as h}from"path";var u="2.14.0-beta.
|
|
1
|
+
import{d as m,e as d,f}from"./chunk-ATBINUDP.js";import{mkdirSync as C,readFileSync as E,writeFileSync as w}from"fs";import I from"https";import{homedir as g}from"os";import{join as h}from"path";var u="2.14.0-beta.4";var b=h(g(),".tigris","update-check.json");function y(){try{let t=E(b,"utf-8"),i=JSON.parse(t);return typeof i.latestVersion=="string"&&typeof i.lastChecked=="number"?i:null}catch{return null}}function v(t){try{C(h(g(),".tigris"),{recursive:!0}),w(b,JSON.stringify(t),"utf-8")}catch{}}function T(t,i){let a=n=>{let s=n.startsWith("v")?n.slice(1):n,c=null,o=s.indexOf("-");o!==-1&&(c=s.slice(o+1),s=s.slice(0,o));let l=s.split(".");if(l.length!==3)return null;let p=l.map(Number);return p.some(isNaN)?null:{major:p[0],minor:p[1],patch:p[2],prerelease:c}},r=a(t),e=a(i);return!r||!e?!1:e.major>r.major?!0:e.major<r.major?!1:e.minor>r.minor?!0:e.minor<r.minor?!1:e.patch>r.patch?!0:e.patch<r.patch?!1:r.prerelease&&!e.prerelease?!0:(!r.prerelease&&e.prerelease,!1)}function D(){let t=globalThis.__TIGRIS_BINARY===!0,i=process.platform==="win32";return t?i?"irm https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.ps1 | iex":"curl -fsSL https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.sh | sh":"npm install -g @tigrisdata/cli"}function N(t={}){return new Promise((i,a)=>{let r=I.get(m,{timeout:1e4},e=>{let n="";e.on("data",s=>{n+=s}),e.on("end",()=>{try{let s=JSON.parse(n);typeof s.version=="string"?(v({...y(),latestVersion:s.version,lastChecked:Date.now()}),i(s.version)):a(new Error("Unexpected registry response"))}catch{a(new Error("Failed to parse registry response"))}})});r.on("error",e=>{a(e)}),r.on("timeout",()=>{r.destroy(),a(new Error("Request timed out"))}),t.unref&&r.on("socket",e=>{e.unref()}),r.end()})}function x(){N({unref:!0}).catch(()=>{})}function L(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let t=y(),i=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||36e5;if(t&&T(u,t.latestVersion)&&(!t.lastNotified||Date.now()-t.lastNotified>i)){let r=`Update available: ${u} \u2192 ${t.latestVersion}`,e='Run "tigris update" to upgrade.',n=Math.max(r.length,e.length)+4,s="\u250C"+"\u2500".repeat(n-2)+"\u2510",c="\u2514"+"\u2500".repeat(n-2)+"\u2518",o=l=>"\u2502 "+l.padEnd(n-4)+" \u2502";console.log(`
|
|
2
2
|
${s}
|
|
3
3
|
${o("")}
|
|
4
4
|
${o(r)}
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-JRKQ5KH6.js";import"./chunk-O74FG4KS.js";import"./chunk-4R4YLHT7.js";import"./chunk-3FMWZQ3C.js";import"./chunk-DV3LCXRH.js";import"./chunk-5VDFQRGP.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-JRKQ5KH6.js";import"./chunk-O74FG4KS.js";import"./chunk-4R4YLHT7.js";import"./chunk-3FMWZQ3C.js";import"./chunk-DV3LCXRH.js";import"./chunk-5VDFQRGP.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
|
package/dist/lib/cp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C}from"../chunk-SAAGVLRE.js";import{a as B}from"../chunk-EKW6XTGL.js";import{a as w}from"../chunk-CQCBYE3X.js";import{a as U,b as T,d as D,g as O,h as J,
|
|
1
|
+
import{a as C}from"../chunk-SAAGVLRE.js";import{a as B}from"../chunk-EKW6XTGL.js";import{a as w}from"../chunk-CQCBYE3X.js";import{a as U,b as T,d as D,g as O,h as J,j}from"../chunk-JQUG732D.js";import{c as G}from"../chunk-EULV7RV7.js";import{a as x,b as q}from"../chunk-AHGPPFCQ.js";import{a as f}from"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import"../chunk-5VDFQRGP.js";import"../chunk-PPNBQWSR.js";import"../chunk-7J6WK54T.js";import"../chunk-CLO5HM7B.js";import"../chunk-ATBINUDP.js";import{get as V,head as X,list as tt,put as E}from"@tigrisdata/storage";import{createReadStream as et,createWriteStream as ot,existsSync as Y,mkdirSync as it,readdirSync as z,statSync as L}from"fs";import{homedir as nt}from"os";import{basename as M,dirname as K,join as N,relative as _,resolve as H}from"path";import{Readable as Z}from"stream";import{pipeline as rt}from"stream/promises";var h=!1;function at(n,t){let e=U(n),l=U(t);return!e&&!l&&f("At least one path must be a remote Tigris path (t3:// or tigris://)"),e&&l?"remote-to-remote":e?"remote-to-local":"local-to-remote"}function P(n){return n==="~"||n.startsWith("~/")?H(nt(),n.slice(2)):H(n)}function lt(n){return z(n,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>{let l=e.parentPath??e.path;return N(l,e.name)})}function ct(n,t){let e=K(n),l=M(n),s=O(l);return Y(e)?t?z(e,{recursive:!0,withFileTypes:!0}).filter(r=>r.isFile()&&s.test(r.name)).map(r=>{let o=r.parentPath??r.path;return N(o,r.name)}):z(e,{withFileTypes:!0}).filter(o=>o.isFile()&&s.test(o.name)).map(o=>N(e,o.name)):[]}async function I(n,t,e,l,s=!1){let p;try{p=L(n).size}catch{return{error:`File not found: ${n}`}}let r=et(n),o=Z.toWeb(r),{error:i}=await E(e,o,{...B(p),onUploadProgress:s?({loaded:a})=>{if(p!==void 0&&p>0){let c=Math.round(a/p*100);process.stdout.write(`\rUploading: ${w(a)} / ${w(p)} (${c}%)`)}else process.stdout.write(`\rUploading: ${w(a)}`)}:void 0,config:{...l,bucket:t}});return s&&process.stdout.write("\r"+" ".repeat(60)+"\r"),i?{error:i.message}:{}}async function Q(n,t,e,l,s=!1){let p;if(s){let{data:u}=await X(t,{config:{...l,bucket:n}});p=u?.size}let{data:r,error:o}=await V(t,"stream",{config:{...l,bucket:n}});if(o)return{error:o.message};let i=K(e);Y(i)||it(i,{recursive:!0});let a=ot(e),c=Z.fromWeb(r);if(s&&p!==void 0&&p>0){let u=0;c.on("data",m=>{u+=m.length;let g=Math.round(u/p*100);process.stdout.write(`\rDownloading: ${w(u)} / ${w(p)} (${g}%)`)})}return await rt(c,a),s&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function A(n,t,e,l,s,p=!1){if(e.endsWith("/")){let{error:c}=await E(s,"",{config:{...n,bucket:l}});return c?{error:c.message}:{}}let r;if(p){let{data:c}=await X(e,{config:{...n,bucket:t}});r=c?.size}let{data:o,error:i}=await V(e,"stream",{config:{...n,bucket:t}});if(i)return{error:i.message};let{error:a}=await E(s,o,{...B(r),onUploadProgress:p?({loaded:c})=>{if(r!==void 0&&r>0){let u=Math.round(c/r*100);process.stdout.write(`\rCopying: ${w(c)} / ${w(r)} (${u}%)`)}else process.stdout.write(`\rCopying: ${w(c)}`)}:void 0,config:{...n,bucket:l}});return p&&process.stdout.write("\r"+" ".repeat(60)+"\r"),a?{error:a.message}:{}}async function st(n,t,e,l){let s=P(n);if(n.includes("*")){let o=ct(s,l);if(o.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files matching pattern");return}let i=K(s),a=o.map(m=>async()=>{let g=_(i,m),k=t.path?`${t.path.replace(/\/$/,"")}/${g}`:g,$=await I(m,t.bucket,k,e);return $.error?(console.error(`Failed to upload ${m}: ${$.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${k}`),!0)}),u=(await C(a,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:u}):`Uploaded ${u} file(s)`);return}let r;try{r=L(s)}catch{f(`Source not found: ${n}`)}if(r.isDirectory()){l||f(`${n} is a directory (not copied). Use -r to copy recursively.`);let o=lt(s);if(o.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files to upload");return}let i=n.endsWith("/")?"":M(s),a=o.map(m=>async()=>{let g=_(s,m),$=[t.path?.replace(/\/$/,""),i,g].filter(Boolean).join("/"),R=await I(m,t.bucket,$,e);return R.error?(console.error(`Failed to upload ${m}: ${R.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${$}`),!0)}),u=(await C(a,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:u}):`Uploaded ${u} file(s)`)}else{let o=M(s),i;t.path?n.endsWith("/")||t.path.endsWith("/")?i=`${t.path.replace(/\/$/,"")}/${o}`:await D(t.bucket,t.path,e)?i=`${t.path}/${o}`:i=t.path:i=o;let a=await I(s,t.bucket,i,e,!h);a.error&&f(a.error),console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:1,src:n,dest:`t3://${t.bucket}/${i}`}):`Uploaded ${n} -> t3://${t.bucket}/${i}`)}}async function pt(n,t,e,l,s){let p=n.endsWith("/");!t.path&&!p&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=P(e),o=t.path.includes("*"),i=t.path.endsWith("/")||!t.path&&p;if(!o&&!i&&(i=await D(t.bucket,t.path,l)),i&&!o&&!s&&f("Source is a remote folder (not copied). Use -r to copy recursively."),o||i){let a=o?J(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",c=!o&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",{items:u,error:m}=await j(t.bucket,a||void 0,l);m&&f(m);let g=u.filter(y=>!y.name.endsWith("/"));if(o){let y=t.path.split("/").pop(),b=O(y);g=g.filter(S=>{let d=a?S.name.slice(a.length):S.name;return!s&&d.includes("/")?!1:b.test(d.split("/").pop())})}if(g.length===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:0}):"No objects to download");return}let k=g.map(y=>async()=>{let b=a?y.name.slice(a.length):y.name,S=c?N(r,c,b):N(r,b),d=await Q(t.bucket,y.name,S,l);return d.error?(console.error(`Failed to download ${y.name}: ${d.error}`),!1):(h||console.log(`Downloaded t3://${t.bucket}/${y.name} -> ${S}`),!0)}),R=(await C(k,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:R}):`Downloaded ${R} file(s)`)}else{let a=t.path.split("/").pop(),c,u=!1;try{u=L(r).isDirectory()}catch{}u||e.endsWith("/")?c=N(r,a):c=r;let m=await Q(t.bucket,t.path,c,l,!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:c}):`Downloaded t3://${t.bucket}/${t.path} -> ${c}`)}}async function ut(n,t,e,l,s){let p=n.endsWith("/");!t.path&&!p&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=n.includes("*"),o=t.path.endsWith("/")||!t.path&&p;if(!r&&!o&&t.path&&(o=await D(t.bucket,t.path,l)),o&&!r&&!s&&f("Source is a remote folder (not copied). Use -r to copy recursively."),r||o){let i=r?J(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",a=!r&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",u=[e.path?.replace(/\/$/,"")||"",a].filter(Boolean).join("/"),m=u?`${u}/`:"";t.bucket===e.bucket&&i===m&&f("Source and destination are the same");let{items:g,error:k}=await j(t.bucket,i||void 0,l);k&&f(k);let $=g.filter(d=>d.name!==i);if(r){let d=t.path.split("/").pop(),W=O(d);$=$.filter(F=>{let v=i?F.name.slice(i.length):F.name;return!s&&v.includes("/")?!1:W.test(v.split("/").pop())})}let R=$.map(d=>async()=>{let W=i?d.name.slice(i.length):d.name,F=u?`${u}/${W}`:W,v=await A(l,t.bucket,d.name,e.bucket,F);return v.error?(console.error(`Failed to copy ${d.name}: ${v.error}`),!1):(h||console.log(`Copied t3://${t.bucket}/${d.name} -> t3://${e.bucket}/${F}`),!0)}),b=(await C(R,8)).filter(Boolean).length,S=!1;if(u&&i){let{data:d}=await tt({prefix:i,limit:1,config:{...l,bucket:t.bucket}});if(d?.items?.some(W=>W.name===i)){let W=`${u}/`,F=await A(l,t.bucket,i,e.bucket,W);F.error?console.error(`Failed to copy folder marker: ${F.error}`):S=!0}}if(b===0&&S&&(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 i=t.path.split("/").pop(),a;e.path?e.path.endsWith("/")?a=`${e.path}${i}`:await D(e.bucket,e.path,l)?a=`${e.path}/${i}`:a=e.path:a=i,t.bucket===e.bucket&&t.path===a&&f("Source and destination are the same");let c=await A(l,t.bucket,t.path,e.bucket,a,!h);c.error&&f(c.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:1,src:`t3://${t.bucket}/${t.path}`,dest:`t3://${e.bucket}/${a}`}):`Copied t3://${t.bucket}/${t.path} -> t3://${e.bucket}/${a}`)}}async function ft(n){let t=x(n,["src"]),e=x(n,["dest"]);(!t||!e)&&f("Both src and dest arguments are required");let l=!!x(n,["recursive","r"]);h=q(n)==="json";let p=at(t,e),r=await G({withCredentialProvider:!0});switch(p){case"local-to-remote":{let o=T(e);o.bucket||f("Invalid destination path"),await st(t,o,r,l);break}case"remote-to-local":{let o=T(t);o.bucket||f("Invalid source path"),await pt(t,o,e,r,l);break}case"remote-to-remote":{let o=T(t),i=T(e);o.bucket||f("Invalid source path"),i.bucket||f("Invalid destination path"),await ut(t,o,i,r,l);break}}process.exit(0)}export{ft as default};
|
package/dist/lib/ls.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,f as m}from"../chunk-CQCBYE3X.js";import{f as w}from"../chunk-
|
|
1
|
+
import{a as b,f as m}from"../chunk-CQCBYE3X.js";import{f as w}from"../chunk-JQUG732D.js";import{c as f}from"../chunk-EULV7RV7.js";import{a as d,b as y}from"../chunk-AHGPPFCQ.js";import{a}from"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import"../chunk-5VDFQRGP.js";import"../chunk-PPNBQWSR.js";import"../chunk-7J6WK54T.js";import"../chunk-CLO5HM7B.js";import"../chunk-ATBINUDP.js";import{list as O,listBuckets as W}from"@tigrisdata/storage";async function v(i){let p=d(i,["path"]),h=d(i,["snapshot-version","snapshotVersion","snapshot"]),l=y(i);if(!p){let e=await f(),{data:t,error:o}=await W({config:e});o&&a(o);let n=(t.buckets||[]).map(g=>({name:g.name,created:g.creationDate})),c=m(n,l,"buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(c);return}let{bucket:u,path:s}=w(p);u||a("Invalid path");let x=await f(),r=s?s.endsWith("/")?s:`${s}/`:void 0,{data:z,error:k}=await O({prefix:r,...h?{snapshotVersion:h}:{},config:{...x,bucket:u}});k&&a(k);let S=(z.items||[]).map(e=>{let t=r?e.name.slice(r.length):e.name,o=t.indexOf("/"),n=o===-1?t:t.slice(0,o+1),c=n.endsWith("/");return{key:n,size:c?"-":b(e.size),modified:e.lastModified}}).filter((e,t,o)=>e.key!==""&&o.findIndex(n=>n.key===e.key)===t),j=m(S,l,"objects","object",[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}]);console.log(j)}export{v as default};
|
package/dist/lib/mk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as S}from"../chunk-TD2HGNDY.js";import"../chunk-S77OAN6Y.js";import{f as b}from"../chunk-
|
|
1
|
+
import{b as S}from"../chunk-TD2HGNDY.js";import"../chunk-S77OAN6Y.js";import{f as b}from"../chunk-JQUG732D.js";import{c as m}from"../chunk-EULV7RV7.js";import{a as t,b as h}from"../chunk-AHGPPFCQ.js";import{a as o}from"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import"../chunk-5VDFQRGP.js";import"../chunk-PPNBQWSR.js";import"../chunk-7J6WK54T.js";import"../chunk-CLO5HM7B.js";import"../chunk-ATBINUDP.js";import{createBucket as C,put as O}from"@tigrisdata/storage";async function T(e){let f=t(e,["path"]);f||o("path argument is required");let{bucket:s,path:n}=b(f);s||o("Invalid path");let u=await m(),d=h(e);if(n){let r=n.endsWith("/")?n:`${n}/`,{error:a}=await O(r,"",{config:{...u,bucket:s}});a&&o(a),console.log(d==="json"?JSON.stringify({action:"created",type:"folder",bucket:s,path:r}):`Folder '${s}/${r}' created`),process.exit(0)}else{let a=t(e,["public"])?"public":t(e,["access","a","A"]),k=t(e,["enableSnapshots","enable-snapshots","s","S"]),w=t(e,["defaultTier","default-tier","t","T"]),c=t(e,["locations","l","L"]),i=t(e,["fork-of","forkOf","fork"]),l=t(e,["source-snapshot","sourceSnapshot","source-snap"]),g=t(e,["region","r","R"]),y=t(e,["consistency","c","C"]);g!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),c===void 0&&(c=g)),y!==void 0&&console.warn("Warning: --consistency is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),l&&!i&&o("--source-snapshot requires --fork-of");let{error:p}=await C(s,{defaultTier:w??"STANDARD",enableSnapshot:k===!0,access:a??"private",locations:S(c??"global"),...i?{sourceBucketName:i}:{},...l?{sourceBucketSnapshot:l}:{},config:u});p&&o(p),console.log(d==="json"?JSON.stringify({action:"created",type:"bucket",name:s}):`Bucket '${s}' created`),process.exit(0)}}export{T as default};
|
package/dist/lib/mv.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as J}from"../chunk-EKW6XTGL.js";import{a as y}from"../chunk-CQCBYE3X.js";import{a as x,b as E}from"../chunk-S77OAN6Y.js";import{a as j,b as R,d as A,g as U,h as D,
|
|
1
|
+
import{a as J}from"../chunk-EKW6XTGL.js";import{a as y}from"../chunk-CQCBYE3X.js";import{a as x,b as E}from"../chunk-S77OAN6Y.js";import{a as j,b as R,d as A,g as U,h as D,j as z}from"../chunk-JQUG732D.js";import{c as T}from"../chunk-EULV7RV7.js";import{a as w,b as O}from"../chunk-AHGPPFCQ.js";import{a as n}from"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import"../chunk-5VDFQRGP.js";import"../chunk-PPNBQWSR.js";import"../chunk-7J6WK54T.js";import"../chunk-CLO5HM7B.js";import"../chunk-ATBINUDP.js";import{get as L,head as Q,list as V,put as q,remove as I}from"@tigrisdata/storage";var d=!1;async function X(s){let c=w(s,["src"]),l=w(s,["dest"]),h=w(s,["yes","y","force","f"]),g=!!w(s,["recursive","r"]);d=O(s)==="json",(!c||!l)&&n("both src and dest arguments are required"),(!j(c)||!j(l))&&n("Both src and dest must be remote Tigris paths (t3:// or tigris://)");let e=R(c),t=R(l);e.bucket||n("Invalid source path"),t.bucket||n("Invalid destination path");let P=c.endsWith("/");!e.path&&!P&&n("Cannot move a bucket. Provide a path within the bucket.");let a=await T({withCredentialProvider:!0}),f=e.path.includes("*"),m=e.path.endsWith("/")||!e.path&&P;if(!f&&!m&&e.path&&(m=await A(e.bucket,e.path,a)),m&&!f&&!g&&n("Source is a remote folder (not moved). Use -r to move recursively."),f||m){let r=f?D(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",i=!f&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",u=[t.path?.replace(/\/$/,"")||"",i].filter(Boolean).join("/"),B=u?`${u}/`:"";e.bucket===t.bucket&&r===B&&n("Source and destination are the same");let{items:_,error:N}=await z(e.bucket,r||void 0,a);N&&n(N);let b=_.filter(o=>o.name!==r);if(f){let o=e.path.split("/").pop(),p=U(o);b=b.filter(v=>{let $=r?v.name.slice(r.length):v.name;return!g&&$.includes("/")?!1:p.test($.split("/").pop())})}let{data:G}=await V({prefix:r,limit:1,config:{...a,bucket:e.bucket}}),F=r?G?.items?.some(o=>o.name===r):!1;if(b.length===0&&!F){console.log(d?JSON.stringify({action:"moved",count:0}):"No objects to move");return}let H=b.length+(F?1:0);if(!h&&(x("Use --yes to skip confirmation"),!await E(`Are you sure you want to move ${H} object(s)?`))){d||console.log("Aborted");return}let k=0;for(let o of b){let p=r?o.name.slice(r.length):o.name,v=u?`${u}/${p}`:p,$=await C(a,e.bucket,o.name,t.bucket,v);$.error?console.error(`Failed to move ${o.name}: ${$.error}`):(d||console.log(`Moved t3://${e.bucket}/${o.name} -> t3://${t.bucket}/${v}`),k++)}let W=!1;if(F)if(u){let o=`${u}/`,p=await C(a,e.bucket,r,t.bucket,o);p.error?console.error(`Failed to move folder marker: ${p.error}`):W=!0}else{let{error:o}=await I(r,{config:{...a,bucket:e.bucket}});o?console.error(`Failed to remove source folder marker: ${o.message}`):W=!0}k===0&&W&&(k=1),console.log(d?JSON.stringify({action:"moved",count:k}):`Moved ${k} object(s)`)}else{let r=e.path.split("/").pop(),i;if(t.path?t.path.endsWith("/")?i=`${t.path}${r}`:await A(t.bucket,t.path,a)?i=`${t.path}/${r}`:i=t.path:i=r,e.bucket===t.bucket&&e.path===i&&n("Source and destination are the same"),!h&&(x("Use --yes to skip confirmation"),!await E(`Are you sure you want to move 't3://${e.bucket}/${e.path}'?`))){d||console.log("Aborted");return}let S=await C(a,e.bucket,e.path,t.bucket,i,!d);S.error&&n(S.error),console.log(d?JSON.stringify({action:"moved",count:1,src:`t3://${e.bucket}/${e.path}`,dest:`t3://${t.bucket}/${i}`}):`Moved t3://${e.bucket}/${e.path} -> t3://${t.bucket}/${i}`)}process.exit(0)}async function C(s,c,l,h,g,M=!1){if(l.endsWith("/")){let{error:r}=await q(g,"",{config:{...s,bucket:h}});if(r)return{error:r.message};let{error:i}=await I(l,{config:{...s,bucket:c}});return i?{error:`Copied but failed to delete source: ${i.message}`}:{}}let{data:e}=await Q(l,{config:{...s,bucket:c}}),t=e?.size,{data:P,error:a}=await L(l,"stream",{config:{...s,bucket:c}});if(a)return{error:a.message};let{error:f}=await q(g,P,{...J(t),onUploadProgress:M?({loaded:r})=>{if(t!==void 0&&t>0){let i=Math.round(r/t*100);process.stdout.write(`\rMoving: ${y(r)} / ${y(t)} (${i}%)`)}else process.stdout.write(`\rMoving: ${y(r)}`)}:void 0,config:{...s,bucket:h}});if(M&&process.stdout.write("\r"+" ".repeat(60)+"\r"),f)return{error:f.message};let{error:m}=await I(l,{config:{...s,bucket:c}});return m?{error:`Copied but failed to delete source: ${m.message}`}:{}}export{X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as h,b as j}from"../../chunk-S77OAN6Y.js";import{i as w}from"../../chunk-JQUG732D.js";import{c as O}from"../../chunk-EULV7RV7.js";import{a as c,b as x}from"../../chunk-AHGPPFCQ.js";import{a as p,b as f,c as b,d as A}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as d,d as k,i as y}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-7J6WK54T.js";import"../../chunk-CLO5HM7B.js";import"../../chunk-ATBINUDP.js";import{remove as E}from"@tigrisdata/storage";var t=y("objects","delete");async function F(n){l(t);let S=x(n),g=c(n,["bucket"]),v=c(n,["key"]),q=c(n,["yes","y","force"]);g||f(t,"Bucket name or path is required");let m=w(g),o=m.bucket,s=v||m.key||void 0;s||f(t,"Object key is required");let N=await O(),a=Array.isArray(s)?s:[s];if(!q&&(h("Use --yes to skip confirmation"),!await j(`Delete ${a.length} object(s) from '${o}'?`))){console.log("Aborted");return}let u=[],i=[];for(let e of a){let{error:r}=await E(e,{config:{...N,bucket:o}});r?(k(t,r.message,{key:e}),i.push({key:e,error:r.message})):(u.push(e),d(t,{key:e}))}if(S==="json"){let e=b(t,{bucket:o}),r={action:"deleted",bucket:o,keys:u,errors:i};e.length>0&&(r.nextActions=e),console.log(JSON.stringify(r))}i.length>0&&p(i[0].error,t),A(t,{bucket:o})}export{F as default};
|
package/dist/lib/objects/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{i as k}from"../../chunk-JQUG732D.js";import{c as j}from"../../chunk-EULV7RV7.js";import{a as r,b}from"../../chunk-AHGPPFCQ.js";import{b as c}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as h,c as a,i as u}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-7J6WK54T.js";import"../../chunk-CLO5HM7B.js";import"../../chunk-ATBINUDP.js";import{get as w}from"@tigrisdata/storage";import{createWriteStream as v,writeFileSync as q}from"fs";import{extname as T}from"path";import{Readable as S}from"stream";import{pipeline as x}from"stream/promises";var e=u("objects","get"),C=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 E(s,m){let l=T(m||s).toLowerCase();return C.has(l)?"string":"stream"}async function F(s){h(e);let m=b(s),p=r(s,["bucket"]),l=r(s,["key"]),t=r(s,["output","o","O"]),y=r(s,["mode","m","M"]),g=r(s,["snapshot-version","snapshotVersion","snapshot"]);p||c(e,"Bucket name or path is required");let{bucket:f,key:o}=k(p,l);o||c(e,"Object key is required");let d=await j();if((y||E(o,t))==="stream"){let{data:i,error:n}=await w(o,"stream",{...g?{snapshotVersion:g}:{},config:{...d,bucket:f}});if(n&&c(e,n),t){let O=v(t);await x(S.fromWeb(i),O),a(e,{key:o,output:t}),m==="json"&&console.log(JSON.stringify({action:"downloaded",bucket:f,key:o,output:t}))}else await x(S.fromWeb(i),process.stdout),a(e)}else{let{data:i,error:n}=await w(o,"string",{...g?{snapshotVersion:g}:{},config:{...d,bucket:f}});n&&c(e,n),t?(q(t,i),a(e,{key:o,output:t}),m==="json"&&console.log(JSON.stringify({action:"downloaded",bucket:f,key:o,output:t}))):(console.log(i),a(e))}}export{F as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d,f as h}from"../../chunk-CQCBYE3X.js";import{i as k}from"../../chunk-JQUG732D.js";import{c as l}from"../../chunk-EULV7RV7.js";import{a as i,b as g}from"../../chunk-AHGPPFCQ.js";import{b as o}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as m,c as u,i as p}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-7J6WK54T.js";import"../../chunk-CLO5HM7B.js";import"../../chunk-ATBINUDP.js";import{head as O}from"@tigrisdata/storage";var e=p("objects","info");async function A(r){m(e);let b=g(r),c=i(r,["bucket"]),v=i(r,["key"]),s=i(r,["snapshot-version","snapshotVersion","snapshot"]);c||o(e,"Bucket name or path is required");let{bucket:a,key:n}=k(c,v);n||o(e,"Object key is required");let y=await l(),{data:t,error:f}=await O(n,{...s?{snapshotVersion:s}:{},config:{...y,bucket:a}});f&&o(e,f),t||o(e,"Object not found");let S=[{metric:"Path",value:t.path},{metric:"Size",value:d(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}],j=h(S,b,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(j),u(e,{bucket:a,key:n})}export{A as default};
|
package/dist/lib/objects/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,f as
|
|
1
|
+
import{a as l,f as b}from"../../chunk-CQCBYE3X.js";import{f as y}from"../../chunk-JQUG732D.js";import{c as k}from"../../chunk-EULV7RV7.js";import{a as o,b as h}from"../../chunk-AHGPPFCQ.js";import{b as s}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as d,e as g,i as u}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-7J6WK54T.js";import"../../chunk-CLO5HM7B.js";import"../../chunk-ATBINUDP.js";import{list as A}from"@tigrisdata/storage";var t=u("objects","list");async function E(e){p(t);let n=o(e,["bucket"]),j=o(e,["prefix","p","P"]),x=h(e),c=o(e,["snapshot-version","snapshotVersion","snapshot"]);n||s(t,"Bucket name is required");let a=y(n),z=a.bucket,S=j||a.path||void 0,w=await k(),{data:r,error:f}=await A({prefix:S,...c?{snapshotVersion:c}:{},config:{...w,bucket:z}});if(f&&s(t,f),!r.items||r.items.length===0){g(t);return}let m=r.items.map(i=>({key:i.name,size:l(i.size),modified:i.lastModified})),O=b(m,x,"objects","object",[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}]);console.log(O),d(t,{count:m.length})}export{E 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,f as j}from"../../chunk-CQCBYE3X.js";import{i as A}from"../../chunk-JQUG732D.js";import{c as w}from"../../chunk-EULV7RV7.js";import{a as s,b as T}from"../../chunk-AHGPPFCQ.js";import{b as i,d as z}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as k,c as S,i as h}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-7J6WK54T.js";import"../../chunk-CLO5HM7B.js";import"../../chunk-ATBINUDP.js";import{put as W}from"@tigrisdata/storage";import{createReadStream as B,statSync as E}from"fs";import{Readable as v}from"stream";var t=h("objects","put");async function M(e){k(t);let u=s(e,["bucket"]),l=s(e,["key"]),g=s(e,["file"]),O=s(e,["access","a","A"],"private"),P=s(e,["content-type","contentType","t","T"]),$=T(e);u||i(t,"Bucket name or path is required");let d=A(u),m=d.bucket,n=d.key||l,r=d.key&&l||g;n||i(t,"Object key is required");let q=!process.stdin.isTTY;!r&&!q&&i(t,"File path is required (or pipe data via stdin)");let f,o;if(r){try{o=E(r).size}catch{i(t,`File not found: ${r}`)}let p=B(r);f=v.toWeb(p)}else f=v.toWeb(process.stdin);let U=await w({withCredentialProvider:!0}),x=r?R(o):{multipart:!0,partSize:5*1024*1024,queueSize:8},{data:c,error:b}=await W(n,f,{access:O==="public"?"public":"private",contentType:P,...x,onUploadProgress:({loaded:p,percentage:y})=>{o!==void 0&&o>0?process.stdout.write(`\rUploading: ${a(p)} / ${a(o)} (${y}%)`):process.stdout.write(`\rUploading: ${a(p)}`)},config:{...U,bucket:m}});process.stdout.write("\r"+" ".repeat(60)+"\r"),b&&i(t,b);let C=[{path:c.path,size:a(c.size??o??0),contentType:c.contentType||"-",modified:c.modified}],F=j(C,$,"objects","object",[{key:"path",header:"Path"},{key:"size",header:"Size"},{key:"contentType",header:"Content-Type"},{key:"modified",header:"Modified"}]);console.log(F),S(t,{key:n,bucket:m}),z(t,{key:n,bucket:m})}export{M as default};
|
package/dist/lib/objects/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{i as k}from"../../chunk-JQUG732D.js";import{c as b}from"../../chunk-EULV7RV7.js";import{a as c,b as p}from"../../chunk-AHGPPFCQ.js";import{b as r}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as g,c as m,i as u}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-7J6WK54T.js";import"../../chunk-CLO5HM7B.js";import"../../chunk-ATBINUDP.js";import{updateObject as j}from"@tigrisdata/storage";var e=u("objects","set");async function w(t){g(e);let l=p(t),a=c(t,["bucket"]),y=c(t,["key"]),s=c(t,["access","a","A"]),i=c(t,["new-key","n","newKey"]);a||r(e,"Bucket name or path is required");let{bucket:n,key:o}=k(a,y);o||r(e,"Object key is required"),s||r(e,"Access level is required (--access public|private)");let d=await b(),{error:f}=await j(o,{access:s==="public"?"public":"private",...i&&{key:i},config:{...d,bucket:n}});f&&r(e,f),l==="json"&&console.log(JSON.stringify({action:"updated",bucket:n,key:o,access:s,...i?{newKey:i}:{}})),m(e,{key:o,bucket:n})}export{w as default};
|
package/dist/lib/presign.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import{b as w}from"../chunk-CQCBYE3X.js";import{f as
|
|
1
|
+
import{b as w}from"../chunk-CQCBYE3X.js";import{f as A}from"../chunk-JQUG732D.js";import{a as h,b as k,c as K}from"../chunk-EULV7RV7.js";import{a as g,b as p}from"../chunk-AHGPPFCQ.js";import{a as r}from"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import"../chunk-5VDFQRGP.js";import"../chunk-PPNBQWSR.js";import{d as u}from"../chunk-7J6WK54T.js";import{i as y}from"../chunk-CLO5HM7B.js";import"../chunk-ATBINUDP.js";import{listAccessKeys as C}from"@tigrisdata/iam";import{getPresignedUrl as P}from"@tigrisdata/storage";import $ from"enquirer";var{prompt:b}=$;async function T(s){let n=g(s,["path"]);n||r("path argument is required");let{bucket:c,path:e}=A(n);c||r("Invalid path"),e||r("Object key is required");let i=g(s,["method","m"])??"get",t=parseInt(g(s,["expires-in","expiresIn","e"])??"3600",10),l=p(s,"url"),o=g(s,["access-key","accessKey"]),x=g(s,["select"]),f=await K(),a;o?a=o:f.accessKeyId?a=f.accessKeyId:(await k()!=="oauth"&&r("Presigning requires an access key. Pass --access-key or configure credentials."),x?a=await E(c,i):a=await q(c,i)),a||r("Presigning requires an access key. Pass --access-key or configure credentials.");let{data:d,error:m}=await P(e,{method:i,expiresIn:t,accessKeyId:a,config:{...f,bucket:c}});m&&r(m),console.log(l==="json"?w({url:d.url,expiresIn:d.expiresIn,method:i,bucket:c,key:e}):d.url),process.exit(0)}async function v(){let n=await u().getAccessToken(),c=y(),e=h(),{data:i,error:t}=await C({config:{sessionToken:n,organizationId:c??void 0,iamEndpoint:e.iamEndpoint}});return t&&r(t),(!i.accessKeys||i.accessKeys.length===0)&&r('No access keys found. Create one with "tigris access-keys create <name>"'),i.accessKeys}function I(s,n,c){return s.roles?s.roles.some(e=>e.role==="NamespaceAdmin"?!0:e.bucket!==n&&e.bucket!=="*"?!1:c==="put"?e.role==="Editor":e.role==="Editor"||e.role==="ReadOnly"):!1}async function q(s,n){let e=(await v()).filter(t=>t.status==="active");e.length===0&&r('No active access keys found. Create one with "tigris access-keys create <name>"');let i=e.find(t=>I(t,s,n));return i||r(`No access key with ${n==="put"?"Editor":"Editor or ReadOnly"} access to bucket "${s}" found.
|
|
2
|
+
Create one: tigris access-keys create <name>
|
|
3
|
+
Then assign: tigris access-keys assign <id> --bucket ${s} --role Editor`),console.error(`Using access key: ${i.name} (${i.id})`),i.id}async function E(s,n){process.stdin.isTTY||r("Interactive selection requires a TTY. Omit --select to auto-resolve, or pass --access-key tid_...");let e=(await v()).filter(o=>o.status==="active");e.length===0&&r('No active access keys found. Create one with "tigris access-keys create <name>"');let i=e.filter(o=>I(o,s,n)),t;if(i.length>0?t=i:(console.error(`No access keys with explicit access to bucket "${s}" found. Showing all active keys.`),t=e),t.length===1)return console.error(`Using access key: ${t[0].name} (${t[0].id})`),t[0].id;let{selectedKey:l}=await b({type:"select",name:"selectedKey",message:"Select an access key for presigning:",choices:t.map(o=>({name:o.id,message:`${o.name} (${o.id})`}))});return l}export{T as default,I as keyMatchesOperation};
|
package/dist/lib/rm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p,b as v}from"../chunk-S77OAN6Y.js";import{a as j,b as I,d as N,g as O,h as E,
|
|
1
|
+
import{a as p,b as v}from"../chunk-S77OAN6Y.js";import{a as j,b as I,d as N,g as O,h as E,j as J}from"../chunk-JQUG732D.js";import{c as W}from"../chunk-EULV7RV7.js";import{a as h,b as P}from"../chunk-AHGPPFCQ.js";import{a as s}from"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import"../chunk-5VDFQRGP.js";import"../chunk-PPNBQWSR.js";import"../chunk-7J6WK54T.js";import"../chunk-CLO5HM7B.js";import"../chunk-ATBINUDP.js";import{list as U,remove as b,removeBucket as T}from"@tigrisdata/storage";var i=!1;async function q(m){let d=h(m,["path"]),$=h(m,["yes","y","force","f"]),k=!!h(m,["recursive","r"]);i=P(m)==="json",d||s("path argument is required"),j(d)||s("Path must be a remote Tigris path (t3:// or tigris://)");let{bucket:e,path:o}=I(d);e||s("Invalid path");let n=await W(),R=d.endsWith("/");if(!o&&!R){if(!$&&(p("Use --yes to skip confirmation"),!await v(`Are you sure you want to delete bucket '${e}'?`))){i||console.log("Aborted");return}let{error:r}=await T(e,{config:n});r&&s(r),console.log(i?JSON.stringify({action:"removed",bucket:e}):`Removed bucket '${e}'`);return}let a=o.includes("*"),g=o.endsWith("/")||!o&&R;if(!a&&!g&&(g=await N(e,o,n)),g&&!a&&!k&&s("Source is a remote folder (not removed). Use -r to remove recursively."),a||g){let r=a?E(o):o?o.endsWith("/")?o:`${o}/`:"",{items:w,error:S}=await J(e,r||void 0,n);S&&s(S);let f=w;if(a){let t=o.split("/").pop(),l=O(t);f=f.filter(A=>{let F=r?A.name.slice(r.length):A.name;return!k&&F.includes("/")?!1:l.test(F.split("/").pop())})}let c=r,M=f.some(t=>t.name===c),y=!1;if(!M&&!a){let{data:t}=await U({prefix:c,limit:1,config:{...n,bucket:e}});y=t?.items?.some(l=>l.name===c)||!1}let x=f.length+(y?1:0);if(x===0){console.log(i?JSON.stringify({action:"removed",count:0}):"No objects to remove");return}if(!$&&(p("Use --yes to skip confirmation"),!await v(`Are you sure you want to delete ${x} object(s)?`))){i||console.log("Aborted");return}let u=0;for(let t of f){let{error:l}=await b(t.name,{config:{...n,bucket:e}});l?console.error(`Failed to remove ${t.name}: ${l.message}`):(i||console.log(`Removed t3://${e}/${t.name}`),u++)}if(y){let{error:t}=await b(c,{config:{...n,bucket:e}});t?console.error(`Failed to remove ${c}: ${t.message}`):(i||console.log(`Removed t3://${e}/${c}`),u++)}console.log(i?JSON.stringify({action:"removed",count:u}):`Removed ${u} object(s)`)}else{if(!$&&(p("Use --yes to skip confirmation"),!await v(`Are you sure you want to delete 't3://${e}/${o}'?`))){i||console.log("Aborted");return}let{error:r}=await b(o,{config:{...n,bucket:e}});r&&s(r),console.log(i?JSON.stringify({action:"removed",count:1,path:`t3://${e}/${o}`}):`Removed t3://${e}/${o}`)}process.exit(0)}export{q as default};
|
package/dist/lib/stat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as w}from"../chunk-WIOXQDND.js";import{a as d,f as c}from"../chunk-CQCBYE3X.js";import{f as j}from"../chunk-
|
|
1
|
+
import{a as w}from"../chunk-WIOXQDND.js";import{a as d,f as c}from"../chunk-CQCBYE3X.js";import{f as j}from"../chunk-JQUG732D.js";import{c as O}from"../chunk-EULV7RV7.js";import{a as g,b}from"../chunk-AHGPPFCQ.js";import{b as i}from"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import{b as k,c as n,i as y}from"../chunk-5VDFQRGP.js";import"../chunk-PPNBQWSR.js";import"../chunk-7J6WK54T.js";import"../chunk-CLO5HM7B.js";import"../chunk-ATBINUDP.js";import{getBucketInfo as A,getStats as I,head as M}from"@tigrisdata/storage";var t=y("stat");async function z(u){k(t);let h=g(u,["path"]),m=b(u),v=g(u,["snapshot-version","snapshotVersion","snapshot"]),f=await O();if(!h){let{data:o,error:r}=await I({config:f});r&&i(t,r);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)}],l=c(p,m,"stats","stat",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(l),n(t),process.exit(0)}let{bucket:a,path:s}=j(h);if(a||i(t,"Invalid path"),!s||s==="/"){let{data:o,error:r}=await A(a,{config:f});r&&i(t,r);let p=w(o).map(({label:T,value:V})=>({metric:T,value:V})),l=c(p,m,"bucket-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(l),n(t,{bucket:a}),process.exit(0)}let{data:e,error:S}=await M(s,{...v?{snapshotVersion:v}:{},config:{...f,bucket:a}});S&&i(t,S),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=c(x,m,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(B),n(t,{bucket:a,path:s}),process.exit(0)}export{z as default};
|
package/dist/lib/touch.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f}from"../chunk-
|
|
1
|
+
import{f}from"../chunk-JQUG732D.js";import{c as s}from"../chunk-EULV7RV7.js";import{a,b as c}from"../chunk-AHGPPFCQ.js";import{a as t}from"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import"../chunk-5VDFQRGP.js";import"../chunk-PPNBQWSR.js";import"../chunk-7J6WK54T.js";import"../chunk-CLO5HM7B.js";import"../chunk-ATBINUDP.js";import{put as p}from"@tigrisdata/storage";async function u(e){let i=a(e,["path"]);i||t("path argument is required");let{bucket:o,path:r}=f(i);o||t("Invalid path"),r||t("Object key is required (use mk to create buckets)");let g=c(e),m=await s(),{error:n}=await p(r,"",{config:{...m,bucket:o}});n&&t(n),console.log(g==="json"?JSON.stringify({action:"created",bucket:o,path:r}):`Created '${o}/${r}'`),process.exit(0)}export{u as default};
|
package/dist/lib/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as d}from"../chunk-AHGPPFCQ.js";import{a as t,c as l,d as p,e as f}from"../chunk-
|
|
1
|
+
import{b as d}from"../chunk-AHGPPFCQ.js";import{a as t,c as l,d as p,e as f}from"../chunk-O74FG4KS.js";import{b as m}from"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import{b as s,c as i,f as a,i as c}from"../chunk-5VDFQRGP.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
|
@@ -431,7 +431,10 @@ commands:
|
|
|
431
431
|
alias: e
|
|
432
432
|
default: '3600'
|
|
433
433
|
- name: access-key
|
|
434
|
-
description: Access key ID to use for signing. If not provided, resolved from credentials or
|
|
434
|
+
description: Access key ID to use for signing. If not provided, resolved from credentials or auto-selected
|
|
435
|
+
- name: select
|
|
436
|
+
description: Interactively select an access key (OAuth only)
|
|
437
|
+
type: flag
|
|
435
438
|
- name: format
|
|
436
439
|
description: Output format
|
|
437
440
|
options: [url, json]
|
|
@@ -1143,6 +1146,7 @@ commands:
|
|
|
1143
1146
|
- "tigris objects get my-bucket report.pdf --output ./report.pdf"
|
|
1144
1147
|
- "tigris objects put my-bucket report.pdf ./report.pdf"
|
|
1145
1148
|
- "tigris objects delete my-bucket report.pdf"
|
|
1149
|
+
- "tigris objects info my-bucket report.pdf"
|
|
1146
1150
|
commands:
|
|
1147
1151
|
# list
|
|
1148
1152
|
- name: list
|
|
@@ -1150,6 +1154,8 @@ commands:
|
|
|
1150
1154
|
alias: l
|
|
1151
1155
|
examples:
|
|
1152
1156
|
- "tigris objects list my-bucket"
|
|
1157
|
+
- "tigris objects list t3://my-bucket"
|
|
1158
|
+
- "tigris objects list t3://my-bucket/images/"
|
|
1153
1159
|
- "tigris objects list my-bucket --prefix images/"
|
|
1154
1160
|
- "tigris objects list my-bucket --format json"
|
|
1155
1161
|
messages:
|
|
@@ -1159,11 +1165,13 @@ commands:
|
|
|
1159
1165
|
onEmpty: 'No objects found'
|
|
1160
1166
|
arguments:
|
|
1161
1167
|
- name: bucket
|
|
1162
|
-
description: Name of the bucket
|
|
1168
|
+
description: Name of the bucket, or a path with optional prefix (t3://bucket/prefix/)
|
|
1163
1169
|
type: positional
|
|
1164
1170
|
required: true
|
|
1165
1171
|
examples:
|
|
1166
1172
|
- my-bucket
|
|
1173
|
+
- t3://my-bucket
|
|
1174
|
+
- t3://my-bucket/images/
|
|
1167
1175
|
- name: prefix
|
|
1168
1176
|
description: Filter objects by key prefix (e.g. "images/" to list only images)
|
|
1169
1177
|
alias: p
|
|
@@ -1180,6 +1188,7 @@ commands:
|
|
|
1180
1188
|
alias: g
|
|
1181
1189
|
examples:
|
|
1182
1190
|
- "tigris objects get my-bucket config.json"
|
|
1191
|
+
- "tigris objects get t3://my-bucket/config.json"
|
|
1183
1192
|
- "tigris objects get my-bucket archive.zip --output ./archive.zip --mode stream"
|
|
1184
1193
|
messages:
|
|
1185
1194
|
onStart: 'Getting object...'
|
|
@@ -1187,15 +1196,15 @@ commands:
|
|
|
1187
1196
|
onFailure: 'Failed to get object'
|
|
1188
1197
|
arguments:
|
|
1189
1198
|
- name: bucket
|
|
1190
|
-
description: Name of the bucket
|
|
1199
|
+
description: Name of the bucket, or a full path (t3://bucket/key)
|
|
1191
1200
|
type: positional
|
|
1192
1201
|
required: true
|
|
1193
1202
|
examples:
|
|
1194
1203
|
- my-bucket
|
|
1204
|
+
- t3://my-bucket/config.json
|
|
1195
1205
|
- name: key
|
|
1196
|
-
description: Key of the object
|
|
1206
|
+
description: Key of the object (omit if bucket contains the full path)
|
|
1197
1207
|
type: positional
|
|
1198
|
-
required: true
|
|
1199
1208
|
examples:
|
|
1200
1209
|
- my-file.txt
|
|
1201
1210
|
- name: output
|
|
@@ -1214,6 +1223,7 @@ commands:
|
|
|
1214
1223
|
alias: p
|
|
1215
1224
|
examples:
|
|
1216
1225
|
- "tigris objects put my-bucket report.pdf ./report.pdf"
|
|
1226
|
+
- "tigris objects put t3://my-bucket/report.pdf ./report.pdf"
|
|
1217
1227
|
- "tigris objects put my-bucket logo.png ./logo.png --access public --content-type image/png"
|
|
1218
1228
|
messages:
|
|
1219
1229
|
onStart: 'Uploading object...'
|
|
@@ -1224,15 +1234,15 @@ commands:
|
|
|
1224
1234
|
description: 'Generate a presigned URL for the uploaded object'
|
|
1225
1235
|
arguments:
|
|
1226
1236
|
- name: bucket
|
|
1227
|
-
description: Name of the bucket
|
|
1237
|
+
description: Name of the bucket, or a full path (t3://bucket/key)
|
|
1228
1238
|
type: positional
|
|
1229
1239
|
required: true
|
|
1230
1240
|
examples:
|
|
1231
1241
|
- my-bucket
|
|
1242
|
+
- t3://my-bucket/report.pdf
|
|
1232
1243
|
- name: key
|
|
1233
|
-
description: Key for the object
|
|
1244
|
+
description: Key for the object (omit if bucket contains the full path)
|
|
1234
1245
|
type: positional
|
|
1235
|
-
required: true
|
|
1236
1246
|
examples:
|
|
1237
1247
|
- my-file.txt
|
|
1238
1248
|
- name: file
|
|
@@ -1258,6 +1268,7 @@ commands:
|
|
|
1258
1268
|
alias: d
|
|
1259
1269
|
examples:
|
|
1260
1270
|
- "tigris objects delete my-bucket old-file.txt --yes"
|
|
1271
|
+
- "tigris objects delete t3://my-bucket/old-file.txt --yes"
|
|
1261
1272
|
- "tigris objects delete my-bucket file-a.txt,file-b.txt --yes"
|
|
1262
1273
|
messages:
|
|
1263
1274
|
onStart: 'Deleting object...'
|
|
@@ -1268,15 +1279,15 @@ commands:
|
|
|
1268
1279
|
description: 'List remaining objects in the bucket'
|
|
1269
1280
|
arguments:
|
|
1270
1281
|
- name: bucket
|
|
1271
|
-
description: Name of the bucket
|
|
1282
|
+
description: Name of the bucket, or a full path (t3://bucket/key)
|
|
1272
1283
|
type: positional
|
|
1273
1284
|
required: true
|
|
1274
1285
|
examples:
|
|
1275
1286
|
- my-bucket
|
|
1287
|
+
- t3://my-bucket/old-file.txt
|
|
1276
1288
|
- name: key
|
|
1277
|
-
description: Key of the object (comma separated for multiple)
|
|
1289
|
+
description: Key of the object (comma separated for multiple, omit if bucket contains the full path)
|
|
1278
1290
|
type: positional
|
|
1279
|
-
required: true
|
|
1280
1291
|
multiple: true
|
|
1281
1292
|
examples:
|
|
1282
1293
|
- my-file.txt
|
|
@@ -1289,6 +1300,7 @@ commands:
|
|
|
1289
1300
|
alias: s
|
|
1290
1301
|
examples:
|
|
1291
1302
|
- "tigris objects set my-bucket my-file.txt --access public"
|
|
1303
|
+
- "tigris objects set t3://my-bucket/my-file.txt --access public"
|
|
1292
1304
|
- "tigris objects set my-bucket my-file.txt --access private"
|
|
1293
1305
|
messages:
|
|
1294
1306
|
onStart: 'Updating object...'
|
|
@@ -1296,13 +1308,12 @@ commands:
|
|
|
1296
1308
|
onFailure: 'Failed to update object'
|
|
1297
1309
|
arguments:
|
|
1298
1310
|
- name: bucket
|
|
1299
|
-
description: Name of the bucket
|
|
1311
|
+
description: Name of the bucket, or a full path (t3://bucket/key)
|
|
1300
1312
|
type: positional
|
|
1301
1313
|
required: true
|
|
1302
1314
|
- name: key
|
|
1303
|
-
description: Key of the object
|
|
1315
|
+
description: Key of the object (omit if bucket contains the full path)
|
|
1304
1316
|
type: positional
|
|
1305
|
-
required: true
|
|
1306
1317
|
- name: access
|
|
1307
1318
|
description: Access level
|
|
1308
1319
|
alias: a
|
|
@@ -1311,6 +1322,33 @@ commands:
|
|
|
1311
1322
|
- name: new-key
|
|
1312
1323
|
description: Rename the object to a new key
|
|
1313
1324
|
alias: n
|
|
1325
|
+
# info
|
|
1326
|
+
- name: info
|
|
1327
|
+
description: Show metadata for an object (content type, size, modified date)
|
|
1328
|
+
alias: i
|
|
1329
|
+
examples:
|
|
1330
|
+
- "tigris objects info my-bucket report.pdf"
|
|
1331
|
+
- "tigris objects info t3://my-bucket/report.pdf"
|
|
1332
|
+
- "tigris objects info my-bucket report.pdf --format json"
|
|
1333
|
+
messages:
|
|
1334
|
+
onStart: ''
|
|
1335
|
+
onSuccess: ''
|
|
1336
|
+
onFailure: 'Failed to get object info'
|
|
1337
|
+
arguments:
|
|
1338
|
+
- name: bucket
|
|
1339
|
+
type: positional
|
|
1340
|
+
required: true
|
|
1341
|
+
description: Name of the bucket, or a full path (t3://bucket/key)
|
|
1342
|
+
- name: key
|
|
1343
|
+
type: positional
|
|
1344
|
+
description: Key of the object (omit if bucket contains the full path)
|
|
1345
|
+
- name: format
|
|
1346
|
+
description: Output format
|
|
1347
|
+
options: [json, table, xml]
|
|
1348
|
+
default: table
|
|
1349
|
+
- name: snapshot-version
|
|
1350
|
+
description: Read from a specific bucket snapshot
|
|
1351
|
+
alias: snapshot
|
|
1314
1352
|
|
|
1315
1353
|
#########################
|
|
1316
1354
|
# Manage access keys
|
package/dist/utils/path.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j}from"../chunk-JQUG732D.js";export{g as globToRegex,d as isPathFolder,a as isRemotePath,j as listAllItems,f as parseAnyPath,c as parsePath,e as parsePaths,b as parseRemotePath,i as resolveObjectArgs,h as wildcardPrefix};
|
|
@@ -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-O74FG4KS.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": "2.14.0-beta.
|
|
3
|
+
"version": "2.14.0-beta.4",
|
|
4
4
|
"description": "Command line interface for Tigris object storage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"lint:fix": "eslint src --fix",
|
|
30
30
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
31
31
|
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
32
|
-
"test": "vitest run
|
|
32
|
+
"test": "vitest run --exclude test/cli.test.ts",
|
|
33
33
|
"test:watch": "vitest",
|
|
34
34
|
"test:all": "vitest run",
|
|
35
35
|
"test:integration": "vitest run test/cli.test.ts",
|
package/dist/chunk-NDNMIXDC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{list as g}from"@tigrisdata/storage";var p=["t3://","tigris://"];function f(t){return p.some(e=>t.startsWith(e))}function c(t){let e=p.find(r=>t.startsWith(r));return s(t.slice(e.length))}function s(t){let e=t.split("/");return{bucket:e[0],path:e.slice(1).join("/")}}async function m(t,e,r){let{data:i}=await g({prefix:`${e}/`,limit:1,config:{...r,bucket:t}});return!!(i?.items&&i.items.length>0)}function d(t,e){return{source:s(t),destination:s(e)}}function l(t){return f(t)?c(t):s(t)}function P(t){let e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*");return new RegExp("^"+e+"$")}function x(t){let e=t.indexOf("*"),r=t.lastIndexOf("/",e);return r>=0?t.slice(0,r+1):""}async function h(t,e,r){let i=[],o;do{let{data:n,error:a}=await g({prefix:e,paginationToken:o,config:{...r,bucket:t}});if(a)return{items:i,error:a};n?.items&&i.push(...n.items),o=n?.hasMore?n.paginationToken:void 0}while(o);return{items:i}}export{f as a,c as b,s as c,m as d,d as e,l as f,P as g,x as h,h as i};
|