@tigrisdata/cli 2.18.0-beta.2 → 2.18.1-beta.1
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 +296 -342
- package/SKILL.md +0 -3
- package/dist/auth/client.js +1 -1
- package/dist/auth/iam.js +1 -1
- package/dist/auth/provider.js +1 -1
- package/dist/chunk-3EAZ2L6H.js +1 -0
- package/dist/{chunk-JP3PXFIQ.js → chunk-7ZUCJBD5.js} +1 -1
- package/dist/{chunk-7ZHRXMPK.js → chunk-D3UQD6W2.js} +1 -1
- package/dist/chunk-EBWDZEHM.js +1 -0
- package/dist/{chunk-27KYKU5U.js → chunk-EFPPY2JQ.js} +1 -1
- package/dist/chunk-HWX63Y3P.js +1 -0
- package/dist/{chunk-T2QR4QOR.js → chunk-KQTMMFPE.js} +1 -1
- package/dist/{chunk-ZUJOS5T2.js → chunk-MX5N556B.js} +1 -1
- package/dist/chunk-QWZ6FK7E.js +8 -0
- package/dist/chunk-RXNG56FL.js +1 -0
- package/dist/{chunk-XCZPPS7H.js → chunk-S7EO4QWK.js} +1 -1
- package/dist/{chunk-SMBIT5FI.js → chunk-UBANDLB4.js} +1 -1
- package/dist/{chunk-BBX3M4S2.js → chunk-UJFCUY34.js} +2 -2
- package/dist/{chunk-EKLR55EQ.js → chunk-YN2TKPPT.js} +1 -1
- package/dist/cli-core.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/access-keys/assign.js +1 -1
- package/dist/lib/access-keys/attach-policy.js +1 -1
- package/dist/lib/access-keys/create.js +1 -1
- package/dist/lib/access-keys/delete.js +1 -1
- package/dist/lib/access-keys/detach-policy.js +1 -1
- package/dist/lib/access-keys/get.js +1 -1
- package/dist/lib/access-keys/list-policies.js +1 -1
- package/dist/lib/access-keys/list.js +1 -1
- package/dist/lib/access-keys/rotate.js +1 -1
- package/dist/lib/buckets/create.js +1 -1
- package/dist/lib/buckets/delete.js +1 -1
- package/dist/lib/buckets/get.js +1 -1
- package/dist/lib/buckets/lifecycle/create.js +1 -0
- package/dist/lib/buckets/lifecycle/edit.js +1 -0
- package/dist/lib/buckets/lifecycle/list.js +1 -0
- package/dist/lib/buckets/lifecycle/shared.js +1 -0
- package/dist/lib/buckets/list.js +1 -1
- package/dist/lib/buckets/migrate.js +3 -3
- package/dist/lib/buckets/set-cors.js +1 -1
- package/dist/lib/buckets/set-locations.js +1 -1
- package/dist/lib/buckets/set-migration.js +1 -1
- package/dist/lib/buckets/set-notifications.js +1 -1
- package/dist/lib/buckets/set.js +1 -1
- package/dist/lib/bundle.js +1 -1
- package/dist/lib/configure/index.js +1 -1
- package/dist/lib/cp.js +1 -1
- package/dist/lib/credentials/test.js +1 -1
- package/dist/lib/iam/policies/create.js +1 -1
- package/dist/lib/iam/policies/delete.js +1 -1
- package/dist/lib/iam/policies/edit.js +1 -1
- package/dist/lib/iam/policies/get.js +1 -1
- package/dist/lib/iam/policies/link-key.js +1 -1
- package/dist/lib/iam/policies/list-keys.js +1 -1
- package/dist/lib/iam/policies/list.js +1 -1
- package/dist/lib/iam/policies/select-policy.js +1 -1
- package/dist/lib/iam/policies/unlink-key.js +1 -1
- package/dist/lib/iam/users/invite.js +1 -1
- package/dist/lib/iam/users/list.js +1 -1
- package/dist/lib/iam/users/remove.js +1 -1
- package/dist/lib/iam/users/revoke-invitation.js +1 -1
- package/dist/lib/iam/users/update-role.js +1 -1
- package/dist/lib/login/credentials.js +1 -1
- package/dist/lib/login/oauth.js +1 -1
- package/dist/lib/login/select.js +1 -1
- package/dist/lib/logout.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 -1
- 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/organizations/create.js +1 -1
- package/dist/lib/organizations/list.js +1 -1
- package/dist/lib/organizations/select.js +1 -1
- package/dist/lib/presign.js +1 -1
- package/dist/lib/rm.js +1 -1
- package/dist/lib/snapshots/list.js +1 -1
- package/dist/lib/snapshots/take.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/lib/whoami.js +1 -1
- package/dist/specs.yaml +129 -143
- package/dist/utils/bucket-info.js +1 -1
- package/dist/utils/exit.js +1 -1
- package/dist/utils/messages.js +1 -1
- package/dist/utils/path.js +1 -1
- package/dist/utils/update-check.js +1 -1
- package/package.json +14 -14
- package/dist/chunk-4ZHCF5D6.js +0 -1
- package/dist/chunk-JQUG732D.js +0 -1
- package/dist/chunk-KK7FZ7QM.js +0 -1
- package/dist/chunk-QWBEROER.js +0 -8
- package/dist/lib/buckets/set-transition.js +0 -1
- package/dist/lib/buckets/set-ttl.js +0 -1
- package/dist/lib/forks/create.js +0 -1
- package/dist/lib/forks/list.js +0 -1
package/dist/lib/cp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D}from"../chunk-SAAGVLRE.js";import{a as B}from"../chunk-EKW6XTGL.js";import{a as w}from"../chunk-IRDNZN7R.js";import{a as U,b as C,d as T,
|
|
1
|
+
import{a as D}from"../chunk-SAAGVLRE.js";import{a as B}from"../chunk-EKW6XTGL.js";import{a as w}from"../chunk-IRDNZN7R.js";import{a as U,b as C,d as T,f as O,g as J,i as j}from"../chunk-RXNG56FL.js";import{d as G}from"../chunk-YN2TKPPT.js";import{a as x,b as q}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{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 D(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 D(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 T(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 T(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 D(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 T(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 D(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 T(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=C(e);o.bucket||f("Invalid destination path"),await st(t,o,r,l);break}case"remote-to-local":{let o=C(t);o.bucket||f("Invalid source path"),await pt(t,o,e,r,l);break}case"remote-to-remote":{let o=C(t),i=C(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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as k}from"../../chunk-
|
|
1
|
+
import{e as k}from"../../chunk-YN2TKPPT.js";import{a as d,b as m}from"../../chunk-S6KFKBMY.js";import{a as s,b as u}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as f,d as r,j as g}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{list as p,listBuckets as b}from"@tigrisdata/storage";var t=g("credentials","test");async function h(n){a(t);let c=m(n),e=d(n,["bucket","b"]),i=await k();if(!i.accessKeyId&&!i.sessionToken&&u(t,'No credentials found. Run "tigris configure" or "tigris login" first.'),e){let{error:o}=await p({config:{...i,bucket:e},limit:1});o&&(r(t,`Current credentials don't have access to bucket "${e}"`),s(o,t)),c==="json"?console.log(JSON.stringify({valid:!0,bucket:e})):(console.log(` Bucket: ${e}`),console.log(" Access verified."))}else{let{data:o,error:l}=await b({config:i});l&&(r(t,"Current credentials don't have sufficient access"),s(l,t)),console.log(c==="json"?JSON.stringify({valid:!0,bucketCount:o.buckets.length}):` Access verified. Found ${o.buckets.length} bucket(s).`)}f(t)}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y}from"../../../chunk-TUDALPGD.js";import{a as g}from"../../../chunk-
|
|
1
|
+
import{a as y}from"../../../chunk-TUDALPGD.js";import{a as g}from"../../../chunk-EFPPY2JQ.js";import"../../../chunk-YN2TKPPT.js";import{a as c,b as u,e as p}from"../../../chunk-S6KFKBMY.js";import{b as t}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as l,j as f}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{existsSync as h,readFileSync as w}from"fs";import{addPolicy as O}from"@tigrisdata/iam";var e=f("iam policies","create");async function A(o){d(e);let P=u(o),a=c(o,["name"]),i=c(o,["document","d"]),S=c(o,["description"])??"";a||t(e,"Policy name is required"),/^[a-zA-Z0-9=,.@_-]+$/.test(a)||t(e,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed.");let v=await g(e),n;i?h(i)?n=w(i,"utf-8"):n=i:process.stdin.isTTY?t(e,"Policy document is required. Provide via --document or pipe to stdin."):n=await p();let m;try{m=y(n)}catch{t(e,"Invalid JSON in policy document")}let{data:r,error:s}=await O(a,{document:m,description:S,config:v});s&&t(e,s),P==="json"&&console.log(JSON.stringify({action:"created",name:r.name,arn:r.resource})),l(e,{name:r.name}),console.log(`Resource: ${r.resource}`)}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u}from"../../../chunk-
|
|
1
|
+
import{a as u}from"../../../chunk-S7EO4QWK.js";import{a as g}from"../../../chunk-EFPPY2JQ.js";import{a as l,b as p}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-YN2TKPPT.js";import{a as i,b as d}from"../../../chunk-S6KFKBMY.js";import{b as a}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as s,j as m}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{deletePolicy as S}from"@tigrisdata/iam";var e=m("iam policies","delete");async function A(t){f(e);let y=d(t),o=i(t,["resource"]),w=i(t,["yes","y","force"]),n=await g(e);if(!o){let r=await u(n,e,"Select a policy to delete:");if(!r)return;o=r}if(!w&&(l("Use --yes to skip confirmation"),!await p(`Delete policy '${o}'?`))){console.log("Aborted");return}let{error:c}=await S(o,{config:n});c&&a(e,c),y==="json"&&console.log(JSON.stringify({action:"deleted",arn:o})),s(e,{resource:o})}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../../chunk-TUDALPGD.js";import{a as J}from"../../../chunk-
|
|
1
|
+
import{a}from"../../../chunk-TUDALPGD.js";import{a as J}from"../../../chunk-S7EO4QWK.js";import{a as h}from"../../../chunk-EFPPY2JQ.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-YN2TKPPT.js";import{a as s,b as w,e as P}from"../../../chunk-S6KFKBMY.js";import{b as e}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as g,c as y,j as S}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{existsSync as x,readFileSync as A}from"fs";import{editPolicy as D,getPolicy as N}from"@tigrisdata/iam";var t=S("iam policies","edit");async function T(o){g(t);let O=w(o),r=s(o,["resource"]),n=s(o,["document","d"]),d=s(o,["description"]),m=await h(t);if(!r){process.stdin.isTTY||e(t,"Policy ARN is required when piping document via stdin.");let i=await J(m,t,"Select a policy to edit:");if(!i)return;r=i}let c;if(n){let i;x(n)?i=A(n,"utf-8"):i=n;try{c=a(i)}catch{e(t,"Invalid JSON in policy document")}}else if(!process.stdin.isTTY&&!d){let i=await P();try{c=a(i)}catch{e(t,"Invalid JSON in policy document")}}!c&&!d&&e(t,"Either --document or --description is required.");let{data:u,error:f}=await N(r,{config:m});f&&e(t,f);let{data:l,error:p}=await D(r,{document:c??u.document,description:d??u.description,config:m});p&&e(t,p),O==="json"&&console.log(JSON.stringify({action:"updated",arn:l.resource})),y(t,{resource:l.resource})}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y}from"../../../chunk-
|
|
1
|
+
import{a as y}from"../../../chunk-S7EO4QWK.js";import{a as g}from"../../../chunk-EFPPY2JQ.js";import{f as p}from"../../../chunk-IRDNZN7R.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-YN2TKPPT.js";import{a as m,b as d}from"../../../chunk-S6KFKBMY.js";import{b as u}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as a,c as i,j as f}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{getPolicy as A}from"@tigrisdata/iam";var t=f("iam policies","get");async function S(n){a(t);let r=m(n,["resource"]),s=d(n),l=await g(t);if(!r){let o=await y(l,t);if(!o)return;r=o}let{data:e,error:c}=await A(r,{config:l});if(c&&u(t,c),s==="json"){console.log(JSON.stringify(e,null,2)),i(t);return}let v=[{field:"Name",value:e.name},{field:"ID",value:e.id},{field:"Resource",value:e.resource},{field:"Description",value:e.description||"-"},{field:"Path",value:e.path},{field:"Version",value:e.defaultVersionId},{field:"Attachments",value:String(e.attachmentCount)},{field:"Created",value:e.createDate.toISOString()},{field:"Updated",value:e.updateDate.toISOString()}],h=p(v,s,"policy","field",[{key:"field",header:"Field"},{key:"value",header:"Value"}]);if(console.log(h),e.users&&e.users.length>0){console.log("Attached Users:");for(let o of e.users)console.log(` - ${o.name} (${o.id})`);console.log()}console.log("Policy Document:"),console.log(` Version: ${e.document.version}`),console.log(" Statements:");for(let o of e.document.statements)console.log(` - Effect: ${o.effect}`),console.log(` Action: ${Array.isArray(o.action)?o.action.join(", "):o.action}`),console.log(` Resource: ${Array.isArray(o.resource)?o.resource.join(", "):o.resource}`);i(t)}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"../../../chunk-
|
|
1
|
+
import{a as h}from"../../../chunk-S7EO4QWK.js";import{a as k}from"../../../chunk-EFPPY2JQ.js";import{a as g}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-YN2TKPPT.js";import{a as l,b as u}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as y,j as p}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import I from"enquirer";import{attachPolicyToAccessKey as P,getPolicy as v,listAccessKeys as O}from"@tigrisdata/iam";var{prompt:K}=I,e=p("iam policies","link-key");async function R(a){d(e);let w=u(a),r=l(a,["resource"]),s=l(a,["id"]),c=await k(e);if(!r){let i=await h(c,e);if(!i)return;r=i}if(!s){g("Use --id to specify the access key ID");let[i,n]=await Promise.all([O({config:c}),v(r,{config:c})]);i.error&&o(e,i.error),n.error&&o(e,n.error);let A=new Set((n.data.users??[]).map(t=>t.id)),f=i.data.accessKeys.filter(t=>!A.has(t.id));f.length===0&&o(e,"No unlinked access keys available. All access keys are already linked to this policy.");let{selected:S}=await K({type:"select",name:"selected",message:"Select an access key to link:",choices:f.map(t=>({name:t.id,message:`${t.name} (${t.id})`}))});s=S}let{error:m}=await P(s,r,{config:c});m&&o(e,m),w==="json"&&console.log(JSON.stringify({action:"linked",policyArn:r,id:s})),y(e)}export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"../../../chunk-
|
|
1
|
+
import{a as k}from"../../../chunk-S7EO4QWK.js";import{a as y}from"../../../chunk-EFPPY2JQ.js";import{f as d}from"../../../chunk-IRDNZN7R.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-YN2TKPPT.js";import{a as p,b as g}from"../../../chunk-S6KFKBMY.js";import{b as l}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as c,c as a,e as f,j as u}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{getPolicy as O}from"@tigrisdata/iam";var t=u("iam policies","list-keys");async function x(i){c(t);let h=g(i),e=p(i,["resource"]),n=await y(t);if(!e){let o=await k(n,t);if(!o)return;e=o}let{data:r,error:s}=await O(e,{config:n});if(s&&l(t,s),!r.users||r.users.length===0){f(t);return}let m=r.users.map(o=>({name:o.name,id:o.id})),w=d(m,h,"keys","key",[{key:"name",header:"Name"},{key:"id",header:"ID"}]);console.log(w),a(t,{count:m.length})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x}from"../../../chunk-
|
|
1
|
+
import{a as x}from"../../../chunk-EFPPY2JQ.js";import{g as y}from"../../../chunk-IRDNZN7R.js";import"../../../chunk-YN2TKPPT.js";import{b as l,c as T}from"../../../chunk-S6KFKBMY.js";import{b as k}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as p,c as u,e as g,i as f,j as h}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{listPolicies as E}from"@tigrisdata/iam";var t=h("iam policies","list");async function I(a){p(t);let i=l(a),{limit:r,pageToken:s}=T(a),o=await x(t),{data:n,error:c}=await E({...r!==void 0?{limit:r}:{},...s?{paginationToken:s}:{},config:{sessionToken:o.sessionToken,organizationId:o.organizationId,iamEndpoint:o.iamEndpoint}});if(c&&k(t,c),!n.policies||n.policies.length===0){g(t);return}let d=n.policies.map(e=>({name:e.name,id:e.id,resource:e.resource,description:e.description||"-",attachments:e.attachmentCount,created:e.createDate,updated:e.updateDate})),C=[{key:"id",header:"ID"},{key:"resource",header:"Resource"},{key:"name",header:"Name"},{key:"description",header:"Description"},{key:"attachments",header:"Attachments"},{key:"created",header:"Created"},{key:"updated",header:"Updated"}],m=n.paginationToken||void 0,D=y(d,i,"policies","policy",C,{paginationToken:m});console.log(D),i!=="json"&&i!=="xml"&&f(m),u(t,{count:d.length})}export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../../chunk-
|
|
1
|
+
import{a}from"../../../chunk-S7EO4QWK.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";export{a as selectPolicy};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"../../../chunk-
|
|
1
|
+
import{a as h}from"../../../chunk-S7EO4QWK.js";import{a as k}from"../../../chunk-EFPPY2JQ.js";import{a as f,b as d}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-YN2TKPPT.js";import{a as n,b as u}from"../../../chunk-S6KFKBMY.js";import{b as c}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as y,c as p,j as g}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import $ from"enquirer";import{detachPolicyFromAccessKey as O,getPolicy as P}from"@tigrisdata/iam";var{prompt:I}=$,o=g("iam policies","unlink-key");async function U(r){y(o);let w=u(r),i=n(r,["resource"]),t=n(r,["id"]),A=n(r,["yes","y","force"]),s=await k(o);if(!i){let e=await h(s,o);if(!e)return;i=e}if(!t){f("Use --id to specify the access key ID");let{data:e,error:l}=await P(i,{config:s});l&&c(o,l),(!e.users||e.users.length===0)&&c(o,"No access keys are linked to this policy.");let{selected:S}=await I({type:"select",name:"selected",message:"Select an access key to unlink:",choices:e.users.map(a=>({name:a.id,message:`${a.name} (${a.id})`}))});t=S}if(!A&&(f("Use --yes to skip confirmation"),!await d(`Unlink access key '${t}' from policy '${i}'?`))){console.log("Aborted");return}let{error:m}=await O(t,i,{config:s});m&&c(o,m),w==="json"&&console.log(JSON.stringify({action:"unlinked",policyArn:i,id:t})),p(o)}export{U as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u}from"../../../chunk-
|
|
1
|
+
import{a as u}from"../../../chunk-EFPPY2JQ.js";import"../../../chunk-YN2TKPPT.js";import{a as s,b as p}from"../../../chunk-S6KFKBMY.js";import{b as n}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as l,c,j as f}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import{a as g}from"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{inviteUser as b}from"@tigrisdata/iam";var i=f("iam users","invite");async function j(e){l(i);let d=p(e);if(g("User management"))return;let o=s(e,["email"]),r=s(e,["role","r"])??"member",t=Array.isArray(o)?o:o?[o]:[];t.length===0&&n(i,"Email address is required");let a=["admin","member"];a.includes(r)||n(i,`Invalid role "${r}". Must be one of: ${a.join(", ")}`);let v=r,y=await u(i),R=t.map(O=>({email:O,role:v})),{error:m}=await b(R,{config:y});m&&n(i,m),d==="json"&&console.log(JSON.stringify({action:"invited",email:t.join(", ")})),c(i,{email:t.join(", ")})}export{j as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as p}from"../../../chunk-
|
|
1
|
+
import{a as p}from"../../../chunk-EFPPY2JQ.js";import{b as y,d as i,e as a}from"../../../chunk-IRDNZN7R.js";import"../../../chunk-YN2TKPPT.js";import{b as h}from"../../../chunk-S6KFKBMY.js";import{b as d}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as m,c as g,e as c,j as u}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import{a as f}from"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{listUsers as v}from"@tigrisdata/iam";var n=u("iam users","list");async function w(k){m(n);let r=h(k);if(f("User management"))return;let C=await p(n),{data:l,error:s}=await v({config:C});s&&d(n,s);let o=l.users.map(e=>({email:e.email,name:e.userName||"-",role:e.isOrgOwner?"owner":e.role,userId:e.userId})),t=l.invitations.map(e=>({id:e.id,email:e.email,role:e.role,status:e.status,validUntil:e.validUntil.toLocaleDateString()}));if(o.length===0&&t.length===0){c(n);return}let I=[{key:"email",header:"Email"},{key:"name",header:"Name"},{key:"role",header:"Role"},{key:"userId",header:"User ID"}],U=[{key:"id",header:"ID"},{key:"email",header:"Email"},{key:"role",header:"Role"},{key:"status",header:"Status"},{key:"validUntil",header:"Valid Until"}];if(r==="json")console.log(y({users:o,invitations:t}));else if(r==="xml"){let e=["<organization>"];e.push(" "+i(o,"users","user").replace(/\n/g,`
|
|
2
2
|
`)),e.push(" "+i(t,"invitations","invitation").replace(/\n/g,`
|
|
3
3
|
`)),e.push("</organization>"),console.log(e.join(`
|
|
4
4
|
`))}else o.length>0&&(console.log(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O}from"../../../chunk-
|
|
1
|
+
import{a as O}from"../../../chunk-EFPPY2JQ.js";import{a,b as v}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-YN2TKPPT.js";import{a as m,b as w}from"../../../chunk-S6KFKBMY.js";import{b as n}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as l,c as u,e as p,j as d}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import{a as y}from"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import I from"enquirer";import{listUsers as E,removeUser as F}from"@tigrisdata/iam";var{prompt:S}=I,e=d("iam users","remove");async function $(s){l(e);let h=w(s),t=m(s,["resource"]),U=m(s,["yes","y","force"]);if(y("User management"))return;let c=await O(e),r=Array.isArray(t)?t:t?[t]:[];if(r.length===0){let{data:i,error:g}=await E({config:c});if(g&&n(e,g),i.users.length===0){p(e);return}a("Provide user ID(s) as a positional argument");let{selected:A}=await S({type:"multiselect",name:"selected",message:"Select user(s) to remove (space to select, enter to confirm):",choices:i.users.map(o=>({name:o.userId,message:`${o.email} (${o.isOrgOwner?"owner":o.role})`}))});r=A}if(!U&&(a("Use --yes to skip confirmation"),!await v(`Remove ${r.length} user(s)?`))){console.log("Aborted");return}let{error:f}=await F(r,{config:c});f&&n(e,f),h==="json"&&console.log(JSON.stringify({action:"removed",users:r})),u(e)}export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"../../../chunk-
|
|
1
|
+
import{a as h}from"../../../chunk-EFPPY2JQ.js";import{a,b as y}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-YN2TKPPT.js";import{a as c,b as k}from"../../../chunk-S6KFKBMY.js";import{b as s}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as g,c as p,e as u,j as v}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import{a as d}from"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import O from"enquirer";import{listUsers as $,revokeInvitation as E}from"@tigrisdata/iam";var{prompt:S}=O,t=v("iam users","revoke-invitation");async function U(r){g(t);let w=k(r),o=c(r,["resource"]),I=c(r,["yes","y","force"]);if(d("User management"))return;let m=await h(t),e=Array.isArray(o)?o:o?[o]:[];if(e.length===0){let{data:n,error:l}=await $({config:m});if(l&&s(t,l),n.invitations.length===0){u(t);return}a("Provide invitation ID(s) as a positional argument");let{selected:A}=await S({type:"multiselect",name:"selected",message:"Select invitation(s) to revoke (space to select, enter to confirm):",choices:n.invitations.map(i=>({name:i.id,message:`${i.email} (${i.role} - ${i.status})`}))});e=A}if(!I&&(a("Use --yes to skip confirmation"),!await y(`Revoke ${e.length} invitation(s)?`))){console.log("Aborted");return}let{error:f}=await E(e,{config:m});f&&s(t,f),w==="json"&&console.log(JSON.stringify({action:"revoked",invitations:e})),p(t)}export{U as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v}from"../../../chunk-
|
|
1
|
+
import{a as v}from"../../../chunk-EFPPY2JQ.js";import{a as w}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-YN2TKPPT.js";import{a as c,b}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as h,e as y,j as R}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import{a as O}from"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import I from"enquirer";import{listUsers as S,updateUserRole as q}from"@tigrisdata/iam";var{prompt:U}=I,e=R("iam users","update-role");async function E(m){d(e);let A=b(m);if(O("User management"))return;let f=["admin","member"],i=c(m,["role","r"]);i||o(e,"Role is required. Use --role admin or --role member");let r=Array.isArray(i)?i:[i];for(let t of r)f.includes(t)||o(e,`Invalid role "${t}". Must be one of: ${f.join(", ")}`);let n=c(m,["resource"]),s=Array.isArray(n)?n:n?[n]:[],u=await v(e);if(s.length===0){let{data:t,error:a}=await S({config:u});if(a&&o(e,a),t.users.length===0){y(e);return}w("Provide user ID(s) as a positional argument");let{selected:$}=await U({type:"multiselect",name:"selected",message:"Select user(s) to update (space to select, enter to confirm):",choices:t.users.map(l=>({name:l.userId,message:`${l.email} (${l.isOrgOwner?"owner":l.role})`}))});s=$}r.length>1&&r.length!==s.length&&o(e,`Number of roles (${r.length}) must match number of users (${s.length}), or provide a single role for all users`);let g=s.map((t,a)=>({userId:t,role:r.length===1?r[0]:r[a]})),{error:p}=await q(g,{config:u});p&&o(e,p),A==="json"&&console.log(JSON.stringify({action:"updated",users:g})),h(e)}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-D3UQD6W2.js";import"../../chunk-S77OAN6Y.js";import"../../chunk-YN2TKPPT.js";import"../../chunk-S6KFKBMY.js";import"../../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";export{a as default};
|
package/dist/lib/login/oauth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../../chunk-
|
|
1
|
+
import{a,b}from"../../chunk-KQTMMFPE.js";import"../../chunk-S6KFKBMY.js";import"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";export{b as default,a as oauth};
|
package/dist/lib/login/select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-
|
|
1
|
+
import{a as c}from"../../chunk-D3UQD6W2.js";import{a as r}from"../../chunk-KQTMMFPE.js";import{a as s}from"../../chunk-S77OAN6Y.js";import"../../chunk-YN2TKPPT.js";import"../../chunk-S6KFKBMY.js";import"../../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 i from"enquirer";var{prompt:n}=i;async function u(e){let a=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,t=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(a||t){await c(e);return}s('Use "tigris login oauth" or "tigris login credentials --access-key ... --access-secret ..."');let{method:m}=await n({type:"select",name:"method",message:"Choose login method:",choices:[{name:"user",message:"As a user (OAuth2 flow)"},{name:"machine",message:"As a machine (Access Key & Secret)"}]});m==="user"?await r():await c(e)}export{u as default};
|
package/dist/lib/logout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as c}from"../chunk-S6KFKBMY.js";import{b as n}from"../chunk-
|
|
1
|
+
import{b as c}from"../chunk-S6KFKBMY.js";import{b as n}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import{b as t,c as r,j as i}from"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import{t as a}from"../chunk-OHGCOC5Q.js";var o=i("logout");async function f(m={}){t(o);let e=c(m);try{await a(),e==="json"&&console.log(JSON.stringify({action:"logged_out"})),r(o)}catch(s){n(o,s)}}export{f as default};
|
package/dist/lib/ls.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as P,g}from"../chunk-IRDNZN7R.js";import{
|
|
1
|
+
import{a as P,g}from"../chunk-IRDNZN7R.js";import{e as N}from"../chunk-RXNG56FL.js";import{d as p}from"../chunk-YN2TKPPT.js";import{a as d,b as z,c as j}from"../chunk-S6KFKBMY.js";import{a as c}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import{i as f}from"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import"../chunk-3EAZ2L6H.js";import"../chunk-OHGCOC5Q.js";import{list as D,listBuckets as E}from"@tigrisdata/storage";async function F(n){let l=d(n,["path"]),u=d(n,["snapshot-version","snapshotVersion","snapshot"]),t=z(n),k=d(n,["source"]),{limit:i,pageToken:a}=j(n);if(!l){let e=await p(),{data:r,error:x}=await E({...i!==void 0?{limit:i}:{},...a?{paginationToken:a}:{},config:e});x&&c(x);let W=(r.buckets||[]).map(w=>({name:w.name,created:w.creationDate})),A=[{key:"name",header:"Name"},{key:"created",header:"Created"}],b=r.paginationToken||void 0,B=g(W,t,"buckets","bucket",A,{paginationToken:b});console.log(B),t!=="json"&&t!=="xml"&&f(b);return}let{bucket:h,path:s}=N(l);h||c("Invalid path");let S=await p(),o=s?s.endsWith("/")?s:`${s}/`:void 0,{data:m,error:y}=await D({prefix:o,delimiter:"/",...u?{snapshotVersion:u}:{},...k?{source:k}:{},...i!==void 0?{limit:i}:{},...a?{paginationToken:a}:{},config:{...S,bucket:h}});y&&c(y);let O=(m.commonPrefixes||[]).map(e=>({key:o?e.slice(o.length):e,size:"-",modified:""})),v=(m.items||[]).map(e=>({key:o?e.name.slice(o.length):e.name,size:P(e.size),modified:e.lastModified})).filter(e=>e.key!==""),C=[...O,...v],M=[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],T=m.paginationToken||void 0,V=g(C,t,"objects","object",M,{paginationToken:T});console.log(V),t!=="json"&&t!=="xml"&&f(T)}export{F as default};
|
package/dist/lib/mk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as d}from"../chunk-TD2HGNDY.js";import"../chunk-S77OAN6Y.js";import{e as m}from"../chunk-RXNG56FL.js";import{d as h}from"../chunk-YN2TKPPT.js";import{a as e,b as g}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{createBucket as y,put as O}from"@tigrisdata/storage";async function T(t){let l=e(t,["path"]);l||s("path argument is required");let{bucket:o,path:r}=m(l);o||s("Invalid path");let f=await h(),u=g(t);if(r){let a=r.endsWith("/")?r:`${r}/`,{error:c}=await O(a,"",{config:{...f,bucket:o}});c&&s(c),console.log(u==="json"?JSON.stringify({action:"created",type:"folder",bucket:o,path:a}):`Folder '${o}/${a}' created`),process.exit(0)}else{let c=e(t,["public"])?"public":e(t,["access","a","A"]),b=e(t,["enableSnapshots","enable-snapshots","s","S"]),S=e(t,["defaultTier","default-tier","t","T"]),k=e(t,["locations","l","L"]),n=e(t,["fork-of","forkOf","fork"]),i=e(t,["source-snapshot","sourceSnapshot","source-snap"]);i&&!n&&s("--source-snapshot requires --fork-of");let{error:p}=await y(o,{defaultTier:S??"STANDARD",enableSnapshot:b===!0,access:c??"private",locations:d(k??"global"),...n?{sourceBucketName:n}:{},...i?{sourceBucketSnapshot:i}:{},config:f});p&&s(p),console.log(u==="json"?JSON.stringify({action:"created",type:"bucket",name:o}):`Bucket '${o}' 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-IRDNZN7R.js";import{a as x,b as E}from"../chunk-S77OAN6Y.js";import{a as j,b as R,d as A,
|
|
1
|
+
import{a as J}from"../chunk-EKW6XTGL.js";import{a as y}from"../chunk-IRDNZN7R.js";import{a as x,b as E}from"../chunk-S77OAN6Y.js";import{a as j,b as R,d as A,f as U,g as D,i as z}from"../chunk-RXNG56FL.js";import{d as T}from"../chunk-YN2TKPPT.js";import{a as w,b as O}from"../chunk-S6KFKBMY.js";import{a as n}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{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 h,b as j}from"../../chunk-S77OAN6Y.js";import{
|
|
1
|
+
import{a as h,b as j}from"../../chunk-S77OAN6Y.js";import{h as w}from"../../chunk-RXNG56FL.js";import{d as O}from"../../chunk-YN2TKPPT.js";import{a as c,b as x}from"../../chunk-S6KFKBMY.js";import{a as p,b as f,c as b,d as A}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as d,d as k,j as y}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.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{
|
|
1
|
+
import{h as k}from"../../chunk-RXNG56FL.js";import{d as j}from"../../chunk-YN2TKPPT.js";import{a as r,b}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as h,c as a,j as u}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.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};
|
package/dist/lib/objects/info.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h,f as k}from"../../chunk-IRDNZN7R.js";import{
|
|
1
|
+
import{a as h,f as k}from"../../chunk-IRDNZN7R.js";import{h as d}from"../../chunk-RXNG56FL.js";import{d as l}from"../../chunk-YN2TKPPT.js";import{a as i,b as g}from"../../chunk-S6KFKBMY.js";import{b as o}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{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}=d(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: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}],j=k(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 T,g as w}from"../../chunk-IRDNZN7R.js";import{
|
|
1
|
+
import{a as T,g as w}from"../../chunk-IRDNZN7R.js";import{e as S}from"../../chunk-RXNG56FL.js";import{d as P}from"../../chunk-YN2TKPPT.js";import{a as e,b as j,c as z}from"../../chunk-S6KFKBMY.js";import{b as s}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as h,e as b,i as y,j as x}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{list as q}from"@tigrisdata/storage";var n=x("objects","list");async function v(t){l(n);let a=e(t,["bucket"]),O=e(t,["prefix","p","P"]),i=j(t),c=e(t,["snapshot-version","snapshotVersion","snapshot"]),f=e(t,["source"]),{limit:m,pageToken:p}=z(t);a||s(n,"Bucket name is required");let g=S(a),A=g.bucket,E=O||g.path||void 0,F=await P(),{data:o,error:d}=await q({prefix:E,...c?{snapshotVersion:c}:{},...f?{source:f}:{},...m!==void 0?{limit:m}:{},...p?{paginationToken:p}:{},config:{...F,bucket:A}});if(d&&s(n,d),!o.items||o.items.length===0){b(n);return}let u=o.items.map(r=>({key:r.name,size:T(r.size),modified:r.lastModified})),M=[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],k=o.paginationToken||void 0,V=w(u,i,"objects","object",M,{paginationToken:k});console.log(V),i!=="json"&&i!=="xml"&&y(k),h(n,{count:u.length})}export{v as default};
|
package/dist/lib/objects/put.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R}from"../../chunk-EKW6XTGL.js";import{a,f as A}from"../../chunk-IRDNZN7R.js";import{
|
|
1
|
+
import{a as R}from"../../chunk-EKW6XTGL.js";import{a,f as A}from"../../chunk-IRDNZN7R.js";import{h as j}from"../../chunk-RXNG56FL.js";import{d as w}from"../../chunk-YN2TKPPT.js";import{a as s,b as T}from"../../chunk-S6KFKBMY.js";import{b as i,d as z}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 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=j(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=A(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{
|
|
1
|
+
import{h as k}from"../../chunk-RXNG56FL.js";import{d as b}from"../../chunk-YN2TKPPT.js";import{a as c,b as p}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as g,c as m,j as u}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as O,f as d}from"../../chunk-
|
|
1
|
+
import{d as O,f as d}from"../../chunk-YN2TKPPT.js";import{a as p,b as u}from"../../chunk-S6KFKBMY.js";import{b as i,d as m}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as e,c,g as f,j as g}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import{a as s}from"../../chunk-GAWFFIPC.js";import"../../chunk-OHGCOC5Q.js";import{createOrganization as w}from"@tigrisdata/iam";var r=g("organizations","create");async function x(n){if(e(r),d("Organization creation")||s("Organization creation"))return;let t=p(n,["name","N"]);t||i(r,"Organization name is required");let z=await O(),l=u(n),{data:S,error:o}=await w(t,{config:z});o&&i(r,o);let a=S.id;l==="json"&&console.log(JSON.stringify({action:"created",name:t,id:a})),c(r,{name:t,id:a}),f(r,{name:t}),m(r,{name:t})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as q}from"../../chunk-IRDNZN7R.js";import{a as y}from"../../chunk-S77OAN6Y.js";import{d as k,f as I}from"../../chunk-
|
|
1
|
+
import{f as q}from"../../chunk-IRDNZN7R.js";import{a as y}from"../../chunk-S77OAN6Y.js";import{d as k,f as I}from"../../chunk-YN2TKPPT.js";import{b as S}from"../../chunk-S6KFKBMY.js";import{b as h}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as r,e as p,j as u}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import{c as w}from"../../chunk-3EAZ2L6H.js";import{h as z,i as O}from"../../chunk-OHGCOC5Q.js";import{listOrganizations as F}from"@tigrisdata/iam";import U from"enquirer";var i=u("organizations","list");async function $(x){if(f(i),I("Organization listing and selection"))return;let s=S(x,"select"),c=w(),e;if(await c.isFlyUser())e=await c.fetchOrganizationsFromUserInfo()??[];else{let n=await k(),{data:g,error:a}=await F({config:n});a&&h(i,a),e=g?.organizations??[]}if(e.length===0){p(i);return}let o=O();if(s==="select"){let n=e.map(t=>({name:t.id,message:`${t.name} (${t.id})`,hint:t.id===o?"currently selected":void 0}));y("Use --format table or --format json");let l=(await U.prompt({type:"select",name:"organization",message:"Select an organization:",choices:n.map(t=>t.message),initial:o?e.findIndex(t=>t.id===o):0})).organization.match(/\(([^)]+)\)$/),d=l?l[1]:e[0].id;await z(d);let E=e.find(t=>t.id===d);r(i,{name:E?.name});return}let m=e.map(n=>({id:n.id,name:n.name,slug:n.slug,selected:n.id===o?"*":""})),C=q(m,s,"organizations","organization",[{key:"selected",header:" ",width:1},{key:"id",header:"ID"},{key:"name",header:"Name"},{key:"slug",header:"Slug"}]);console.log(C),r(i,{count:m.length})}export{$ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as S,f as $}from"../../chunk-
|
|
1
|
+
import{d as S,f as $}from"../../chunk-YN2TKPPT.js";import{a as z,b as O}from"../../chunk-S6KFKBMY.js";import{a as d,b as r,d as p}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as g,c,d as f,j as l}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import{h as u}from"../../chunk-OHGCOC5Q.js";import{listOrganizations as A}from"@tigrisdata/iam";var n=l("organizations","select");async function N(a){if(g(n),$("Organization selection"))return;let w=O(a),i=z(a,["name","N"]);i||r(n,"Organization name or ID is required");let x=await S(),{data:h,error:e}=await A({config:x});e&&r(n,e);let s=h?.organizations??[],t=s.find(o=>o.id===i||o.name===i);if(!t){let o=s.map(m=>` - ${m.name} (${m.id})`).join(`
|
|
2
2
|
`);f(n,`Organization "${i}" not found
|
|
3
3
|
|
|
4
4
|
Available organizations:
|
package/dist/lib/presign.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as A}from"../chunk-IRDNZN7R.js";import{
|
|
1
|
+
import{b as A}from"../chunk-IRDNZN7R.js";import{e as w}from"../chunk-RXNG56FL.js";import{a as k,d as K}from"../chunk-YN2TKPPT.js";import{a as g,b as h}from"../chunk-S6KFKBMY.js";import{a as n}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import{c as p}from"../chunk-3EAZ2L6H.js";import{i as y,p as u}from"../chunk-OHGCOC5Q.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 r=g(s,["path"]);r||n("path argument is required");let{bucket:c,path:e}=w(r);c||n("Invalid path"),e||n("Object key is required");let i=g(s,["method","m"])??"get",t=parseInt(g(s,["expires-in","expiresIn","e"])??"3600",10),l=h(s,"url"),o=g(s,["access-key","accessKey"]),x=g(s,["select"]),f=await K(),a;o?a=o:f.accessKeyId?a=f.accessKeyId:(u()!=="oauth"&&n("Presigning requires an access key. Pass --access-key or configure credentials."),x?a=await E(c,i):a=await q(c,i)),a||n("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&&n(m),console.log(l==="json"?A({url:d.url,expiresIn:d.expiresIn,method:i,bucket:c,key:e}):d.url),process.exit(0)}async function v(){let r=await p().getAccessToken(),c=y(),e=k(),{data:i,error:t}=await C({config:{sessionToken:r,organizationId:c??void 0,iamEndpoint:e.iamEndpoint}});return t&&n(t),(!i.accessKeys||i.accessKeys.length===0)&&n('No access keys found. Create one with "tigris access-keys create <name>"'),i.accessKeys}function I(s,r,c){return s.roles?s.roles.some(e=>e.role==="NamespaceAdmin"?!0:e.bucket!==r&&e.bucket!=="*"?!1:c==="put"?e.role==="Editor":e.role==="Editor"||e.role==="ReadOnly"):!1}async function q(s,r){let e=(await v()).filter(t=>t.status==="active");e.length===0&&n('No active access keys found. Create one with "tigris access-keys create <name>"');let i=e.find(t=>I(t,s,r));return i||n(`No access key with ${r==="put"?"Editor":"Editor or ReadOnly"} access to bucket "${s}" found.
|
|
2
2
|
Create one: tigris access-keys create <name>
|
|
3
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,r){process.stdin.isTTY||n("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&&n('No active access keys found. Create one with "tigris access-keys create <name>"');let i=e.filter(o=>I(o,s,r)),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 v,b as h}from"../chunk-S77OAN6Y.js";import{a as j,b as I,d as N,
|
|
1
|
+
import{a as v,b as h}from"../chunk-S77OAN6Y.js";import{a as j,b as I,d as N,f as O,g as E,i as J}from"../chunk-RXNG56FL.js";import{d as W}from"../chunk-YN2TKPPT.js";import{a as $,b as P}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{list as U,remove as b,removeBucket as T}from"@tigrisdata/storage";var i=!1;async function q(m){let d=$(m,["path"]),g=$(m,["yes","y","force","f"]),k=!!$(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(!g&&(v("Use --yes to skip confirmation"),!await h(`Are you sure you want to delete bucket '${e}'?`))){i||console.log("Aborted");return}let{error:r}=await T(e,{config:n,force:g});r&&s(r),console.log(i?JSON.stringify({action:"removed",bucket:e}):`Removed bucket '${e}'`);return}let a=o.includes("*"),u=o.endsWith("/")||!o&&R;if(!a&&!u&&(u=await N(e,o,n)),u&&!a&&!k&&s("Source is a remote folder (not removed). Use -r to remove recursively."),a||u){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(!g&&(v("Use --yes to skip confirmation"),!await h(`Are you sure you want to delete ${x} object(s)?`))){i||console.log("Aborted");return}let p=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}`),p++)}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}`),p++)}console.log(i?JSON.stringify({action:"removed",count:p}):`Removed ${p} object(s)`)}else{if(!g&&(v("Use --yes to skip confirmation"),!await h(`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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as S}from"../../chunk-IRDNZN7R.js";import{d as x}from"../../chunk-
|
|
1
|
+
import{g as S}from"../../chunk-IRDNZN7R.js";import{d as x}from"../../chunk-YN2TKPPT.js";import{a as k,b as y,c as T}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as u,e as d,i as h,j as l}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{listBucketSnapshots as P}from"@tigrisdata/storage";var t=l("snapshots","list");async function B(o){f(t);let r=k(o,["name"]),e=y(o),{limit:s,pageToken:m}=T(o);r||i(t,"Bucket name is required");let v=await x(),{data:n,error:c}=await P(r,{...s!==void 0?{limit:s}:{},...m?{paginationToken:m}:{},config:v});if(c&&i(t,c),!n.snapshots||n.snapshots.length===0){d(t);return}let p=n.snapshots.map(a=>({name:a.name||"",version:a.version||"",created:a.creationDate})),w=[{key:"name",header:"Name"},{key:"version",header:"Version"},{key:"created",header:"Created"}],g=n.paginationToken||void 0,O=S(p,e,"snapshots","snapshot",w,{paginationToken:g});console.log(O),e!=="json"&&e!=="xml"&&h(g),u(t,{count:p.length})}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as g}from"../../chunk-
|
|
1
|
+
import{d as g}from"../../chunk-YN2TKPPT.js";import{a,b as f}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as m,c,j as p}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{createBucketSnapshot as k}from"@tigrisdata/storage";var o=p("snapshots","take");async function S(n){m(o);let h=f(n),t=a(n,["name"]),e=a(n,["snapshot-name","snapshotName"]);t||r(o,"Bucket name is required");let u=await g(),{data:s,error:i}=await k(t,{name:e,config:u});i&&r(o,i),h==="json"&&console.log(JSON.stringify({action:"taken",bucket:t,version:s?.snapshotVersion})),c(o,{name:t,snapshotName:e||s?.snapshotVersion,version:s?.snapshotVersion})}export{S as default};
|
package/dist/lib/stat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as w}from"../chunk-HWX63Y3P.js";import{a as d,f as c}from"../chunk-IRDNZN7R.js";import{e as j}from"../chunk-RXNG56FL.js";import{d as O}from"../chunk-YN2TKPPT.js";import{a as g,b}from"../chunk-S6KFKBMY.js";import{b as i}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import{b as k,c as n,j as y}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 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{e as f}from"../chunk-RXNG56FL.js";import{d as s}from"../chunk-YN2TKPPT.js";import{a,b as c}from"../chunk-S6KFKBMY.js";import{a as t}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{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-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-UJFCUY34.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/lib/whoami.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as $,c as b}from"../chunk-
|
|
1
|
+
import{a as $,c as b}from"../chunk-YN2TKPPT.js";import{b as w}from"../chunk-S6KFKBMY.js";import{b as A}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import{f as g,j as I}from"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import{c as z}from"../chunk-3EAZ2L6H.js";import{i as y}from"../chunk-OHGCOC5Q.js";import{whoami as k}from"@tigrisdata/iam";var f=I("whoami"),v={"aws-profile":"AWS Profile",oauth:"OAuth",credentials:"Access Key Credentials",environment:"Environment Variables",configured:"Configured Credentials"};async function l(h,u){try{let t=$(),{data:c}=await k({config:{accessKeyId:h,secretAccessKey:u,iamEndpoint:t.iamEndpoint}});return{userId:c?.userId,organizationId:c?.organizationId}}catch{return{userId:void 0,organizationId:void 0}}}async function K(h={}){try{let u=w(h),t=await b();if(t.type==="none"){g(f);return}let c,r,o,n,d,e=[""],m=v[t.type]??t.type;switch(t.type){case"aws-profile":{e.push(`Auth method: ${m} (${t.profile})`);let i=await l(t.accessKeyId,t.secretAccessKey);r=i.userId,o=i.organizationId;break}case"oauth":{e.push(`Auth method: ${m}`);let i=z();if(!await i.isAuthenticated()){g(f);return}let a=await i.getIdTokenClaims();c=a.email,r=a.sub,d=y(),n=await i.getOrganizations();break}case"credentials":{e.push(`Auth method: ${m}`);let i=await l(t.accessKeyId,t.secretAccessKey);r=i.userId,o=i.organizationId;break}case"environment":{let i=t.source==="tigris"?"TIGRIS_STORAGE_*":"AWS_*";e.push(`Auth method: ${m} (${i})`);let s=await l(t.accessKeyId,t.secretAccessKey);r=s.userId,o=s.organizationId;break}case"configured":{e.push(`Auth method: ${m}`);let i=await l(t.accessKeyId,t.secretAccessKey);r=i.userId,o=i.organizationId;break}}if(e.push(""),e.push("User Information:"),e.push(` Email: ${c||"N/A"}`),e.push(` User ID: ${r||"N/A"}`),n)if(n.length>0){let s=n.slice(0,5);if(e.push(""),e.push(`Organizations (${n.length}):`),s.forEach(a=>{let O=a.id===d?">":" ";e.push(` ${O} ${a.name} (${a.id})`)}),n.length>5&&e.push(` ... and ${n.length-5} more. Run "tigris organizations list" to see all.`),d){let a=n.find(p=>p.id===d);a&&(e.push(""),e.push(`Active: ${a.name}`))}}else e.push(""),e.push("Organizations: None");else o&&e.push(` Organization: ${o}`);if(u==="json"){let i={authMethod:t.type,email:c,userId:r};if(n&&(i.organizations=n.map(s=>({id:s.id,name:s.name})),d)){let s=n.find(a=>a.id===d);s&&(i.activeOrganization=s.name)}o&&(i.organizationId=o),console.log(JSON.stringify(i));return}e.push(""),console.log(e.join(`
|
|
2
2
|
`))}catch(u){A(f,u)}}export{K as default};
|