@tigrisdata/cli 2.12.0 → 2.12.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.
Files changed (58) hide show
  1. package/dist/auth/s3-client.js +1 -1
  2. package/dist/{chunk-UI5P73BB.js → chunk-2BLMIQ2B.js} +1 -1
  3. package/dist/{chunk-LEBJAWX7.js → chunk-6M7WK6ZZ.js} +1 -1
  4. package/dist/chunk-EKW6XTGL.js +1 -0
  5. package/dist/chunk-VOQSWXBS.js +2 -0
  6. package/dist/cli.js +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/lib/access-keys/assign.js +1 -1
  9. package/dist/lib/access-keys/create.js +1 -1
  10. package/dist/lib/access-keys/delete.js +1 -1
  11. package/dist/lib/access-keys/get.js +1 -1
  12. package/dist/lib/access-keys/list.js +1 -1
  13. package/dist/lib/buckets/create.js +1 -1
  14. package/dist/lib/buckets/delete.js +1 -1
  15. package/dist/lib/buckets/get.js +1 -1
  16. package/dist/lib/buckets/list.js +1 -1
  17. package/dist/lib/buckets/set-cors.js +1 -1
  18. package/dist/lib/buckets/set-migration.js +1 -1
  19. package/dist/lib/buckets/set-notifications.js +1 -1
  20. package/dist/lib/buckets/set-transition.js +1 -1
  21. package/dist/lib/buckets/set-ttl.js +1 -1
  22. package/dist/lib/buckets/set.js +1 -1
  23. package/dist/lib/cp.js +1 -1
  24. package/dist/lib/credentials/test.js +1 -1
  25. package/dist/lib/forks/create.js +1 -1
  26. package/dist/lib/forks/list.js +1 -1
  27. package/dist/lib/iam/policies/create.js +1 -1
  28. package/dist/lib/iam/policies/delete.js +1 -1
  29. package/dist/lib/iam/policies/edit.js +1 -1
  30. package/dist/lib/iam/policies/get.js +1 -1
  31. package/dist/lib/iam/policies/list.js +1 -1
  32. package/dist/lib/iam/users/invite.js +1 -1
  33. package/dist/lib/iam/users/list.js +1 -1
  34. package/dist/lib/iam/users/remove.js +1 -1
  35. package/dist/lib/iam/users/revoke-invitation.js +1 -1
  36. package/dist/lib/iam/users/update-role.js +1 -1
  37. package/dist/lib/ls.js +1 -1
  38. package/dist/lib/mk.js +1 -1
  39. package/dist/lib/mv.js +1 -1
  40. package/dist/lib/objects/delete.js +1 -1
  41. package/dist/lib/objects/get.js +1 -1
  42. package/dist/lib/objects/list.js +1 -1
  43. package/dist/lib/objects/put.js +1 -1
  44. package/dist/lib/objects/set.js +1 -1
  45. package/dist/lib/organizations/create.js +1 -1
  46. package/dist/lib/organizations/list.js +1 -1
  47. package/dist/lib/organizations/select.js +1 -1
  48. package/dist/lib/presign.js +1 -1
  49. package/dist/lib/rm.js +1 -1
  50. package/dist/lib/snapshots/list.js +1 -1
  51. package/dist/lib/snapshots/take.js +1 -1
  52. package/dist/lib/stat.js +1 -1
  53. package/dist/lib/touch.js +1 -1
  54. package/dist/lib/whoami.js +1 -1
  55. package/dist/utils/update-check.js +1 -1
  56. package/dist/utils/upload.js +1 -0
  57. package/package.json +2 -2
  58. package/dist/chunk-USCKVLDO.js +0 -2
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunk-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";export{a as getLoginMethod,c as getS3Client,b as getStorageConfig,d as isAuthenticated};
1
+ import{a,b,c,d}from"../chunk-VOQSWXBS.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";export{a as getLoginMethod,c as getS3Client,b as getStorageConfig,d as isAuthenticated};
@@ -1,4 +1,4 @@
1
- import{d as m,e as d,f}from"./chunk-2XAO2OYD.js";import{readFileSync as T,writeFileSync as I,mkdirSync as N}from"fs";import{join as g}from"path";import{homedir as h}from"os";import k from"https";var u="2.12.0";var b=g(h(),".tigris","update-check.json");function y(){try{let e=T(b,"utf-8"),i=JSON.parse(e);return typeof i.latestVersion=="string"&&typeof i.lastChecked=="number"?i:null}catch{return null}}function v(e){try{N(g(h(),".tigris"),{recursive:!0}),I(b,JSON.stringify(e),"utf-8")}catch{}}function j(e,i){let a=o=>{let r=o.startsWith("v")?o.slice(1):o,c=null,l=r.indexOf("-");l!==-1&&(c=r.slice(l+1),r=r.slice(0,l));let p=r.split(".");if(p.length!==3)return null;let n=p.map(Number);return n.some(isNaN)?null:{major:n[0],minor:n[1],patch:n[2],prerelease:c}},t=a(e),s=a(i);return!t||!s?!1:s.major>t.major?!0:s.major<t.major?!1:s.minor>t.minor?!0:s.minor<t.minor?!1:s.patch>t.patch?!0:s.patch<t.patch?!1:t.prerelease&&!s.prerelease?!0:(!t.prerelease&&s.prerelease,!1)}function x(){try{let e=k.get(m,{timeout:5e3},i=>{let a="";i.on("data",t=>{a+=t}),i.on("end",()=>{try{let t=JSON.parse(a);if(typeof t.version=="string"){let s=y();v({...s,latestVersion:t.version,lastChecked:Date.now()})}}catch{}})});e.on("error",()=>{}),e.on("timeout",()=>{e.destroy()}),e.end(),e.on("socket",i=>{i.unref()})}catch{}}function V(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let e=y(),i=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||216e5;if(e&&j(u,e.latestVersion)&&(!e.lastNotified||Date.now()-e.lastNotified>i)){let t=globalThis.__TIGRIS_BINARY===!0,s=process.platform==="win32",o=`Update available: ${u} \u2192 ${e.latestVersion}`,r;t?s?r="Run `irm https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.ps1 | iex`":r="Run `curl -fsSL https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.sh | sh`":r="Run `npm install -g @tigrisdata/cli` to upgrade.";let c=Math.max(o.length,r.length)+4,l="\u250C"+"\u2500".repeat(c-2)+"\u2510",p="\u2514"+"\u2500".repeat(c-2)+"\u2518",n=_=>"\u2502 "+_.padEnd(c-4)+" \u2502";console.log(`
1
+ import{d as m,e as d,f}from"./chunk-2XAO2OYD.js";import{readFileSync as T,writeFileSync as I,mkdirSync as N}from"fs";import{join as g}from"path";import{homedir as h}from"os";import k from"https";var u="2.12.1";var b=g(h(),".tigris","update-check.json");function y(){try{let e=T(b,"utf-8"),i=JSON.parse(e);return typeof i.latestVersion=="string"&&typeof i.lastChecked=="number"?i:null}catch{return null}}function v(e){try{N(g(h(),".tigris"),{recursive:!0}),I(b,JSON.stringify(e),"utf-8")}catch{}}function j(e,i){let a=o=>{let r=o.startsWith("v")?o.slice(1):o,c=null,l=r.indexOf("-");l!==-1&&(c=r.slice(l+1),r=r.slice(0,l));let p=r.split(".");if(p.length!==3)return null;let n=p.map(Number);return n.some(isNaN)?null:{major:n[0],minor:n[1],patch:n[2],prerelease:c}},t=a(e),s=a(i);return!t||!s?!1:s.major>t.major?!0:s.major<t.major?!1:s.minor>t.minor?!0:s.minor<t.minor?!1:s.patch>t.patch?!0:s.patch<t.patch?!1:t.prerelease&&!s.prerelease?!0:(!t.prerelease&&s.prerelease,!1)}function x(){try{let e=k.get(m,{timeout:5e3},i=>{let a="";i.on("data",t=>{a+=t}),i.on("end",()=>{try{let t=JSON.parse(a);if(typeof t.version=="string"){let s=y();v({...s,latestVersion:t.version,lastChecked:Date.now()})}}catch{}})});e.on("error",()=>{}),e.on("timeout",()=>{e.destroy()}),e.end(),e.on("socket",i=>{i.unref()})}catch{}}function V(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let e=y(),i=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||216e5;if(e&&j(u,e.latestVersion)&&(!e.lastNotified||Date.now()-e.lastNotified>i)){let t=globalThis.__TIGRIS_BINARY===!0,s=process.platform==="win32",o=`Update available: ${u} \u2192 ${e.latestVersion}`,r;t?s?r="Run `irm https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.ps1 | iex`":r="Run `curl -fsSL https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.sh | sh`":r="Run `npm install -g @tigrisdata/cli` to upgrade.";let c=Math.max(o.length,r.length)+4,l="\u250C"+"\u2500".repeat(c-2)+"\u2510",p="\u2514"+"\u2500".repeat(c-2)+"\u2518",n=_=>"\u2502 "+_.padEnd(c-4)+" \u2502";console.log(`
2
2
  ${l}
3
3
  ${n("")}
4
4
  ${n(o)}
@@ -1 +1 @@
1
- import{a as s,c as l}from"./chunk-UI5P73BB.js";import{b as m}from"./chunk-BETAO4PB.js";import{a as t,k as i}from"./chunk-4V35SYMM.js";import{existsSync as c}from"fs";import{join as a,dirname as u}from"path";import{fileURLToPath as f}from"url";t();var j=f(import.meta.url),d=u(j),h=m(),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=i({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
1
+ import{a as s,c as l}from"./chunk-2BLMIQ2B.js";import{b as m}from"./chunk-BETAO4PB.js";import{a as t,k as i}from"./chunk-4V35SYMM.js";import{existsSync as c}from"fs";import{join as a,dirname as u}from"path";import{fileURLToPath as f}from"url";t();var j=f(import.meta.url),d=u(j),h=m(),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=i({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
@@ -0,0 +1 @@
1
+ function E(t){if(!t||t<=5242880)return{multipart:!1};let A=5242880;return t/A>1e4&&(A=Math.ceil(t/1e4)),{multipart:!0,partSize:A,queueSize:10}}export{E as a};
@@ -0,0 +1,2 @@
1
+ import{b as y}from"./chunk-E4MLGABW.js";import{g as p,h as l,i as g,j as f,l as r,s as h}from"./chunk-DOUR5YEY.js";import{a as m,c as A}from"./chunk-KH63ANUX.js";import{a as u}from"./chunk-2XAO2OYD.js";import{S3Client as d}from"@aws-sdk/client-s3";import{fromIni as C}from"@aws-sdk/credential-providers";var c=A(),S=m(),I=!1;async function P(){if(I||!process.stdin.isTTY)return!1;I=!0,console.log(`Not authenticated. Starting login...
2
+ `);let{default:s}=await import("./lib/login/select.js");return await s({}),console.log(),!0}async function w(){return h()}async function v(s){if(g()){let t=process.env.AWS_PROFILE||"default",i=await f(t),a=await C({profile:t})();return{accessKeyId:a.accessKeyId,secretAccessKey:a.secretAccessKey,endpoint:i.endpoint||c.endpoint||u,iamEndpoint:i.iamEndpoint||c.iamEndpoint}}let o=await w();if(o==="oauth"){let t=y(),i=p();if(!i)throw new Error('No organization selected. Please run "tigris orgs select" first.');return{sessionToken:await t.getAccessToken(),accessKeyId:"",secretAccessKey:"",...s?.withCredentialProvider&&{credentialProvider:async()=>({accessKeyId:"",secretAccessKey:"",sessionToken:await t.getAccessToken(),expiration:new Date(Date.now()+600*1e3)})},endpoint:c.endpoint,organizationId:i,iamEndpoint:c.iamEndpoint,authDomain:S.domain}}if(o==="credentials"){let t=r();if(t)return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:t.endpoint}}let n=l();if(n)return{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey,endpoint:n.endpoint};let e=r();if(e)return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,endpoint:e.endpoint};if(await P())return v(s);throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}async function k(){if(g()){let e=process.env.AWS_PROFILE||"default",t=await f(e);return new d({region:"auto",endpoint:t.endpoint||c.endpoint||u,credentials:C({profile:e})})}let s=await w();if(s==="oauth"){let e=y(),t=p();if(!t)throw new Error('No organization selected. Please run "tigris orgs select" first.');let i=async()=>({accessKeyId:"",secretAccessKey:"",sessionToken:await e.getAccessToken(),expiration:new Date(Date.now()+600*1e3)}),a=new d({region:"auto",endpoint:c.endpoint,credentials:i});return a.middlewareStack.add(T=>async K=>{let E=K.request;return E.headers["x-Tigris-Namespace"]=t,await T(K)},{name:"x-Tigris-Namespace-Middleware",step:"build",override:!0}),a}if(s==="credentials"){let e=r();if(e)return new d({region:"auto",endpoint:e.endpoint,credentials:{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey}})}let o=l();if(o)return new d({region:"auto",endpoint:o.endpoint,credentials:{accessKeyId:o.accessKeyId,secretAccessKey:o.secretAccessKey}});let n=r();if(n)return new d({region:"auto",endpoint:n.endpoint,credentials:{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey}});if(await P())return k();throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}async function z(){return g()||await w()!==null||l()!==null||r()!==null}export{w as a,v as b,k as c,z as d};
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import"./chunk-LEBJAWX7.js";import"./chunk-UI5P73BB.js";import"./chunk-BETAO4PB.js";import"./chunk-4V35SYMM.js";import"./chunk-2XAO2OYD.js";
2
+ import"./chunk-6M7WK6ZZ.js";import"./chunk-2BLMIQ2B.js";import"./chunk-BETAO4PB.js";import"./chunk-4V35SYMM.js";import"./chunk-2XAO2OYD.js";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import"./chunk-LEBJAWX7.js";import"./chunk-UI5P73BB.js";import"./chunk-BETAO4PB.js";import"./chunk-4V35SYMM.js";import"./chunk-2XAO2OYD.js";
1
+ import"./chunk-6M7WK6ZZ.js";import"./chunk-2BLMIQ2B.js";import"./chunk-BETAO4PB.js";import"./chunk-4V35SYMM.js";import"./chunk-2XAO2OYD.js";
@@ -1,2 +1,2 @@
1
- import{a as A,b as l,c as t,g as R}from"../../chunk-SYGTCM6P.js";import{a as n}from"../../chunk-JRALYIRA.js";import{a as b}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as k}from"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import{c as p}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{assignBucketRoles as C,revokeAllBucketRoles as N}from"@tigrisdata/iam";var e=R("access-keys","assign"),x=["Editor","ReadOnly","NamespaceAdmin"];function y(o){return o?Array.isArray(o)?o:[o]:[]}async function E(o){A(e);let c=n(o,["id"]),g=n(o,["admin"]),d=n(o,["revokeRoles","revoke-roles"]),r=y(n(o,["bucket","b"])),s=y(n(o,["role","r"]));c||(t(e,"Access key ID is required"),process.exit(1)),g&&d&&(t(e,"Cannot use --admin and --revoke-roles together"),process.exit(1)),await b()!=="oauth"&&(t(e,`Bucket roles can only be managed when logged in via OAuth.
1
+ import{a as A,b as l,c as t,g as R}from"../../chunk-SYGTCM6P.js";import{a as n}from"../../chunk-JRALYIRA.js";import{a as b}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as k}from"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import{c as p}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{assignBucketRoles as C,revokeAllBucketRoles as N}from"@tigrisdata/iam";var e=R("access-keys","assign"),x=["Editor","ReadOnly","NamespaceAdmin"];function y(o){return o?Array.isArray(o)?o:[o]:[]}async function E(o){A(e);let c=n(o,["id"]),g=n(o,["admin"]),d=n(o,["revokeRoles","revoke-roles"]),r=y(n(o,["bucket","b"])),s=y(n(o,["role","r"]));c||(t(e,"Access key ID is required"),process.exit(1)),g&&d&&(t(e,"Cannot use --admin and --revoke-roles together"),process.exit(1)),await b()!=="oauth"&&(t(e,`Bucket roles can only be managed when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let m=k();await m.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let T=await m.getAccessToken(),v=h(),w=p(),u={sessionToken:T,organizationId:v??void 0,iamEndpoint:w.iamEndpoint};if(d){let{error:i}=await N(c,{config:u});i&&(t(e,i.message),process.exit(1)),l(e);return}let a;if(g)a=[{bucket:"*",role:"NamespaceAdmin"}];else{r.length===0&&(t(e,"At least one bucket name is required (or use --admin or --revoke-roles)"),process.exit(1)),s.length===0&&(t(e,"At least one role is required (or use --admin or --revoke-roles)"),process.exit(1));for(let i of s)x.includes(i)||(t(e,`Invalid role "${i}". Valid roles are: ${x.join(", ")}`),process.exit(1));s.length===1?a=r.map(i=>({bucket:i,role:s[0]})):s.length===r.length?a=r.map((i,O)=>({bucket:i,role:s[O]})):(t(e,`Number of roles (${s.length}) must be 1 or match number of buckets (${r.length})`),process.exit(1))}let{error:f}=await C(c,a,{config:u});f&&(t(e,f.message),process.exit(1)),l(e)}export{E as default};
@@ -1,2 +1,2 @@
1
- import{a as g,b as l,c as t,g as m}from"../../chunk-SYGTCM6P.js";import{a as u}from"../../chunk-JRALYIRA.js";import{a as d}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as a}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createAccessKey as y}from"@tigrisdata/iam";var e=m("access-keys","create");async function w(f){g(e);let i=u(f,["name"]);i||(t(e,"Access key name is required"),process.exit(1)),await d()!=="oauth"&&(t(e,`Access keys can only be created when logged in via OAuth.
1
+ import{a as g,b as l,c as t,g as m}from"../../chunk-SYGTCM6P.js";import{a as u}from"../../chunk-JRALYIRA.js";import{a as d}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as a}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createAccessKey as y}from"@tigrisdata/iam";var e=m("access-keys","create");async function w(f){g(e);let i=u(f,["name"]);i||(t(e,"Access key name is required"),process.exit(1)),await d()!=="oauth"&&(t(e,`Access keys can only be created when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let n=a();await n.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let p=await n.getAccessToken(),h=r(),A=c(),{data:o,error:s}=await y(i,{config:{sessionToken:p,organizationId:h??void 0,iamEndpoint:A.iamEndpoint}});s&&(t(e,s.message),process.exit(1)),console.log(` Name: ${o.name}`),console.log(` Access Key ID: ${o.id}`),console.log(` Secret Access Key: ${o.secret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again."),l(e)}export{w as default};
@@ -1,2 +1,2 @@
1
- import{a,b as g,c as e,g as d}from"../../chunk-SYGTCM6P.js";import{a as f}from"../../chunk-JRALYIRA.js";import{a as m}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as c}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c as s}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeAccessKey as A}from"@tigrisdata/iam";var t=d("access-keys","delete");async function k(u){a(t);let i=f(u,["id"]);i||(e(t,"Access key ID is required"),process.exit(1)),await m()!=="oauth"&&(e(t,`Access keys can only be deleted when logged in via OAuth.
1
+ import{a,b as g,c as e,g as d}from"../../chunk-SYGTCM6P.js";import{a as f}from"../../chunk-JRALYIRA.js";import{a as m}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as c}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c as s}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeAccessKey as A}from"@tigrisdata/iam";var t=d("access-keys","delete");async function k(u){a(t);let i=f(u,["id"]);i||(e(t,"Access key ID is required"),process.exit(1)),await m()!=="oauth"&&(e(t,`Access keys can only be deleted when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let o=c();await o.isAuthenticated()||(e(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let p=await o.getAccessToken(),h=r(),l=s(),{error:n}=await A(i,{config:{sessionToken:p,organizationId:h??void 0,iamEndpoint:l.iamEndpoint}});n&&(e(t,n.message),process.exit(1)),g(t)}export{k as default};
@@ -1,2 +1,2 @@
1
- import{a as l,b as d,c as t,g as f}from"../../chunk-SYGTCM6P.js";import{a as m}from"../../chunk-JRALYIRA.js";import{a as u}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as g}from"../../chunk-E4MLGABW.js";import{g as a}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getAccessKey as $}from"@tigrisdata/iam";var e=f("access-keys","get");async function w(p){l(e);let i=m(p,["id"]);i||(t(e,"Access key ID is required"),process.exit(1)),await u()!=="oauth"&&(t(e,`Access keys can only be retrieved when logged in via OAuth.
1
+ import{a as l,b as d,c as t,g as f}from"../../chunk-SYGTCM6P.js";import{a as m}from"../../chunk-JRALYIRA.js";import{a as u}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as g}from"../../chunk-E4MLGABW.js";import{g as a}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getAccessKey as $}from"@tigrisdata/iam";var e=f("access-keys","get");async function w(p){l(e);let i=m(p,["id"]);i||(t(e,"Access key ID is required"),process.exit(1)),await u()!=="oauth"&&(t(e,`Access keys can only be retrieved when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let n=g();await n.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let h=await n.getAccessToken(),A=a(),k=c(),{data:o,error:s}=await $(i,{config:{sessionToken:h,organizationId:A??void 0,iamEndpoint:k.iamEndpoint}});if(s&&(t(e,s.message),process.exit(1)),console.log(` Name: ${o.name}`),console.log(` ID: ${o.id}`),console.log(` Status: ${o.status}`),console.log(` Created: ${o.createdAt}`),console.log(` Organization: ${o.organizationId}`),o.roles&&o.roles.length>0){console.log(" Roles:");for(let r of o.roles)console.log(` - ${r.bucket}: ${r.role}`)}else console.log(" Roles: None");d(e)}export{w as default};
@@ -1,2 +1,2 @@
1
- import{a as g,b as u,c as s,d as m,g as l}from"../../chunk-SYGTCM6P.js";import{f}from"../../chunk-CQCBYE3X.js";import{a as p}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as d}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listAccessKeys as w}from"@tigrisdata/iam";var t=l("access-keys","list");async function x(){g(t),await p()!=="oauth"&&(s(t,`Access keys can only be listed when logged in via OAuth.
1
+ import{a as g,b as u,c as s,d as m,g as l}from"../../chunk-SYGTCM6P.js";import{f}from"../../chunk-CQCBYE3X.js";import{a as p}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as d}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listAccessKeys as w}from"@tigrisdata/iam";var t=l("access-keys","list");async function x(){g(t),await p()!=="oauth"&&(s(t,`Access keys can only be listed when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let o=d();await o.isAuthenticated()||(s(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let h=await o.getAccessToken(),y=r(),k=c(),{data:i,error:n}=await w({config:{sessionToken:h,organizationId:y??void 0,iamEndpoint:k.iamEndpoint}});if(n&&(s(t,n.message),process.exit(1)),!i.accessKeys||i.accessKeys.length===0){m(t);return}let a=i.accessKeys.map(e=>({name:e.name,id:e.id,status:e.status,created:e.createdAt})),A=f(a,"table","keys","key",[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}]);console.log(A),u(t,{count:a.length})}export{x as default};
@@ -1 +1 @@
1
- import{a as R,b as A,c as g,g as L}from"../../chunk-SYGTCM6P.js";import{a as P,b as h,c as o}from"../../chunk-Q4KOY3VK.js";import{a as s}from"../../chunk-JRALYIRA.js";import{b as B}from"../../chunk-USCKVLDO.js";import{d as f,e as b}from"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import I from"enquirer";import{createBucket as M}from"@tigrisdata/storage";var{prompt:c}=I,r=L("buckets","create");async function W(t){R(r);let n=s(t,["name"]),y=s(t,["public"])?"public":s(t,["access","a","A"]),S=s(t,["enable-snapshots","s","S"]),w=s(t,["default-tier","t","T"]),m=s(t,["locations","l","L"]),k=s(t,["region","r","R"]),q=s(t,["consistency","c","C"]);k!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),m===void 0&&(m=k)),q!==void 0&&console.warn("Warning: --consistency is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/");let E=!n,i;if(E){let T=f("buckets","access","create"),v=b(T),u=v?.findIndex(e=>e.value===T?.default),x=f("buckets","default-tier","create"),D=b(x),p=D?.findIndex(e=>e.value===x?.default),l=await c([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:v||[],initial:u!==void 0&&u>=0?u:0},{type:"select",name:"defaultTier",message:"Default storage tier:",choices:D||[],initial:p!==void 0&&p>=0?p:0},{type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}]);n=l.name,y=l.access,w=l.defaultTier,S=l.enableSnapshots;let{locationType:d}=await c({type:"select",name:"locationType",message:"Location type:",choices:[{name:"global",message:"Global"},{name:"multi",message:"Multi-region (USA or Europe)"},{name:"dual",message:"Dual region"},{name:"single",message:"Single region"}]});if(d==="global")i={type:"global"};else if(d==="multi"){let{region:e}=await c({type:"select",name:"region",message:"Multi-region:",choices:P.map(a=>({name:a.value,message:a.name}))});i=o(e)}else if(d==="single"){let{region:e}=await c({type:"select",name:"region",message:"Region:",choices:h.map(a=>({name:a.value,message:a.name}))});i=o(e)}else{let{regions:e}=await c({type:"multiselect",name:"regions",message:"Press space key to select regions (multiple supported) and enter to confirm:",choices:h.map(a=>({name:a.value,message:a.name}))});e.length<2&&(g(r,"Dual region requires at least two regions"),process.exit(1)),i=o(e)}}n||(g(r,"Bucket name is required"),process.exit(1));let{error:C}=await M(n,{defaultTier:w??"STANDARD",enableSnapshot:S===!0,access:y??"private",locations:i??o(m??"global"),config:await B()});C&&(g(r,C.message),process.exit(1)),A(r,{name:n})}export{W as default};
1
+ import{a as R,b as A,c as g,g as L}from"../../chunk-SYGTCM6P.js";import{a as P,b as h,c as o}from"../../chunk-Q4KOY3VK.js";import{a as s}from"../../chunk-JRALYIRA.js";import{b as B}from"../../chunk-VOQSWXBS.js";import{d as f,e as b}from"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import I from"enquirer";import{createBucket as M}from"@tigrisdata/storage";var{prompt:c}=I,r=L("buckets","create");async function W(t){R(r);let n=s(t,["name"]),y=s(t,["public"])?"public":s(t,["access","a","A"]),S=s(t,["enable-snapshots","s","S"]),w=s(t,["default-tier","t","T"]),m=s(t,["locations","l","L"]),k=s(t,["region","r","R"]),q=s(t,["consistency","c","C"]);k!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),m===void 0&&(m=k)),q!==void 0&&console.warn("Warning: --consistency is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/");let E=!n,i;if(E){let T=f("buckets","access","create"),v=b(T),u=v?.findIndex(e=>e.value===T?.default),x=f("buckets","default-tier","create"),D=b(x),p=D?.findIndex(e=>e.value===x?.default),l=await c([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:v||[],initial:u!==void 0&&u>=0?u:0},{type:"select",name:"defaultTier",message:"Default storage tier:",choices:D||[],initial:p!==void 0&&p>=0?p:0},{type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}]);n=l.name,y=l.access,w=l.defaultTier,S=l.enableSnapshots;let{locationType:d}=await c({type:"select",name:"locationType",message:"Location type:",choices:[{name:"global",message:"Global"},{name:"multi",message:"Multi-region (USA or Europe)"},{name:"dual",message:"Dual region"},{name:"single",message:"Single region"}]});if(d==="global")i={type:"global"};else if(d==="multi"){let{region:e}=await c({type:"select",name:"region",message:"Multi-region:",choices:P.map(a=>({name:a.value,message:a.name}))});i=o(e)}else if(d==="single"){let{region:e}=await c({type:"select",name:"region",message:"Region:",choices:h.map(a=>({name:a.value,message:a.name}))});i=o(e)}else{let{regions:e}=await c({type:"multiselect",name:"regions",message:"Press space key to select regions (multiple supported) and enter to confirm:",choices:h.map(a=>({name:a.value,message:a.name}))});e.length<2&&(g(r,"Dual region requires at least two regions"),process.exit(1)),i=o(e)}}n||(g(r,"Bucket name is required"),process.exit(1));let{error:C}=await M(n,{defaultTier:w??"STANDARD",enableSnapshot:S===!0,access:y??"private",locations:i??o(m??"global"),config:await B()});C&&(g(r,C.message),process.exit(1)),A(r,{name:n})}export{W as default};
@@ -1 +1 @@
1
- import{a as i,b as s,c as o,g as c}from"../../chunk-SYGTCM6P.js";import{a as m}from"../../chunk-JRALYIRA.js";import{b as a}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeBucket as g}from"@tigrisdata/storage";var e=c("buckets","delete");async function k(f){i(e);let t=m(f,["name"]);t||(o(e,"Bucket name is required"),process.exit(1));let p=Array.isArray(t)?t:[t],u=await a();for(let r of p){let{error:n}=await g(r,{config:u});n&&(o(e,n.message,{name:r}),process.exit(1)),s(e,{name:r})}}export{k as default};
1
+ import{a as i,b as s,c as o,g as c}from"../../chunk-SYGTCM6P.js";import{a as m}from"../../chunk-JRALYIRA.js";import{b as a}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeBucket as g}from"@tigrisdata/storage";var e=c("buckets","delete");async function k(f){i(e);let t=m(f,["name"]);t||(o(e,"Bucket name is required"),process.exit(1));let p=Array.isArray(t)?t:[t],u=await a();for(let r of p){let{error:n}=await g(r,{config:u});n&&(o(e,n.message,{name:r}),process.exit(1)),s(e,{name:r})}}export{k as default};
@@ -1 +1 @@
1
- import{a as s,b as p,c as r,g as n}from"../../chunk-SYGTCM6P.js";import{f as i}from"../../chunk-CQCBYE3X.js";import{a as c}from"../../chunk-JRALYIRA.js";import{b as u}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getBucketInfo as l}from"@tigrisdata/storage";var t=n("buckets","get");async function g(m){s(t);let o=c(m,["name"]);o||(r(t,"Bucket name is required"),process.exit(1));let{data:e,error:a}=await l(o,{config:await u()});a&&(r(t,a.message),process.exit(1));let f=[{property:"Name",value:o},{property:"Snapshots Enabled",value:e.isSnapshotEnabled?"Yes":"No"},{property:"Has Forks",value:e.hasForks?"Yes":"No"},...e.sourceBucketName?[{property:"Source Bucket",value:e.sourceBucketName}]:[],...e.sourceBucketSnapshot?[{property:"Source Snapshot",value:e.sourceBucketSnapshot}]:[]],k=i(f,"table","bucket","property",[{key:"property",header:"Property"},{key:"value",header:"Value"}]);console.log(k),p(t)}export{g as default};
1
+ import{a as s,b as p,c as r,g as n}from"../../chunk-SYGTCM6P.js";import{f as i}from"../../chunk-CQCBYE3X.js";import{a as c}from"../../chunk-JRALYIRA.js";import{b as u}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getBucketInfo as l}from"@tigrisdata/storage";var t=n("buckets","get");async function g(m){s(t);let o=c(m,["name"]);o||(r(t,"Bucket name is required"),process.exit(1));let{data:e,error:a}=await l(o,{config:await u()});a&&(r(t,a.message),process.exit(1));let f=[{property:"Name",value:o},{property:"Snapshots Enabled",value:e.isSnapshotEnabled?"Yes":"No"},{property:"Has Forks",value:e.hasForks?"Yes":"No"},...e.sourceBucketName?[{property:"Source Bucket",value:e.sourceBucketName}]:[],...e.sourceBucketSnapshot?[{property:"Source Snapshot",value:e.sourceBucketSnapshot}]:[]],k=i(f,"table","bucket","property",[{key:"property",header:"Property"},{key:"value",header:"Value"}]);console.log(k),p(t)}export{g as default};
@@ -1 +1 @@
1
- import{a as c,b as i,c as r,d as m,g as u}from"../../chunk-SYGTCM6P.js";import{f as g}from"../../chunk-CQCBYE3X.js";import{a as f}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as d}from"@tigrisdata/storage";var t=u("buckets","list");async function b(k){c(t);try{let e=f(k,["format","F"],"table"),{data:o,error:n}=await d({config:await p()});if(n&&(r(t,n.message),process.exit(1)),!o.buckets||o.buckets.length===0){m(t);return}let s=o.buckets.map(a=>({name:a.name,created:a.creationDate})),l=g(s,e,"buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(l),i(t,{count:s.length})}catch(e){e instanceof Error?r(t,e.message):r(t,"An unknown error occurred"),process.exit(1)}}export{b as default};
1
+ import{a as c,b as i,c as r,d as m,g as u}from"../../chunk-SYGTCM6P.js";import{f as g}from"../../chunk-CQCBYE3X.js";import{a as f}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as d}from"@tigrisdata/storage";var t=u("buckets","list");async function b(k){c(t);try{let e=f(k,["format","F"],"table"),{data:o,error:n}=await d({config:await p()});if(n&&(r(t,n.message),process.exit(1)),!o.buckets||o.buckets.length===0){m(t);return}let s=o.buckets.map(a=>({name:a.name,created:a.creationDate})),l=g(s,e,"buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(l),i(t,{count:s.length})}catch(e){e instanceof Error?r(t,e.message):r(t,"An unknown error occurred"),process.exit(1)}}export{b as default};
@@ -1 +1 @@
1
- import{a as p,b,c as t,g as h}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as w}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as x}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketCors as C}from"@tigrisdata/storage";var n=h("buckets","set-cors");async function N(r){p(n);let i=e(r,["name"]),o=e(r,["origins"]),d=e(r,["methods"]),a=e(r,["headers"]),c=e(r,["expose-headers","exposeHeaders"]),s=e(r,["max-age","maxAge"]),f=e(r,["override"]),g=e(r,["reset"]);i||(t(n,"Bucket name is required"),process.exit(1)),g&&(o!==void 0||d!==void 0||a!==void 0||c!==void 0||s!==void 0||f)&&(t(n,"Cannot use --reset with other options"),process.exit(1)),!g&&!o&&(t(n,"Provide --origins or --reset"),process.exit(1)),s!==void 0&&(isNaN(Number(s))||Number(s)<=0)&&(t(n,"--max-age must be a positive number"),process.exit(1));let m=await w(),u=x(),v={...m,...u&&!m.organizationId?{organizationId:u}:{}},{error:l}=await C(i,{rules:g?[]:[{allowedOrigins:o,...d!==void 0?{allowedMethods:d}:{},...a!==void 0?{allowedHeaders:a}:{},...c!==void 0?{exposeHeaders:c}:{},maxAge:s!==void 0?Number(s):3600}],override:f??!1,config:v});l&&(t(n,l.message),process.exit(1)),b(n,{name:i})}export{N as default};
1
+ import{a as p,b,c as t,g as h}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as w}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as x}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketCors as C}from"@tigrisdata/storage";var n=h("buckets","set-cors");async function N(r){p(n);let i=e(r,["name"]),o=e(r,["origins"]),d=e(r,["methods"]),a=e(r,["headers"]),c=e(r,["expose-headers","exposeHeaders"]),s=e(r,["max-age","maxAge"]),f=e(r,["override"]),g=e(r,["reset"]);i||(t(n,"Bucket name is required"),process.exit(1)),g&&(o!==void 0||d!==void 0||a!==void 0||c!==void 0||s!==void 0||f)&&(t(n,"Cannot use --reset with other options"),process.exit(1)),!g&&!o&&(t(n,"Provide --origins or --reset"),process.exit(1)),s!==void 0&&(isNaN(Number(s))||Number(s)<=0)&&(t(n,"--max-age must be a positive number"),process.exit(1));let m=await w(),u=x(),v={...m,...u&&!m.organizationId?{organizationId:u}:{}},{error:l}=await C(i,{rules:g?[]:[{allowedOrigins:o,...d!==void 0?{allowedMethods:d}:{},...a!==void 0?{allowedHeaders:a}:{},...c!==void 0?{exposeHeaders:c}:{},maxAge:s!==void 0?Number(s):3600}],override:f??!1,config:v});l&&(t(n,l.message),process.exit(1)),b(n,{name:i})}export{N as default};
@@ -1 +1 @@
1
- import{a as w,b as d,c as i,g as y}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as x}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketMigration as K}from"@tigrisdata/storage";var n=y("buckets","set-migration");async function M(t){w(n);let r=e(t,["name"]),o=e(t,["bucket"]),s=e(t,["endpoint"]),a=e(t,["region"]),c=e(t,["access-key","accessKey"]),g=e(t,["secret-key","secretKey"]),f=e(t,["write-through","writeThrough"]),u=e(t,["disable"]);r||(i(n,"Bucket name is required"),process.exit(1)),u&&(o!==void 0||s!==void 0||a!==void 0||c!==void 0||g!==void 0||f!==void 0)&&(i(n,"Cannot use --disable with other migration options"),process.exit(1));let m=await x(),l=h(),p={...m,...l&&!m.organizationId?{organizationId:l}:{}};if(u){let{error:k}=await K(r,{dataMigration:{enabled:!1},config:p});k&&(i(n,k.message),process.exit(1)),d(n,{name:r});return}(!o||!s||!a||!c||!g)&&(i(n,"Required: --bucket, --endpoint, --region, --access-key, --secret-key"),process.exit(1));let{error:b}=await K(r,{dataMigration:{enabled:!0,accessKey:c,secretKey:g,region:a,name:o,endpoint:s,writeThrough:f??!1},config:p});b&&(i(n,b.message),process.exit(1)),d(n,{name:r})}export{M as default};
1
+ import{a as w,b as d,c as i,g as y}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as x}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketMigration as K}from"@tigrisdata/storage";var n=y("buckets","set-migration");async function M(t){w(n);let r=e(t,["name"]),o=e(t,["bucket"]),s=e(t,["endpoint"]),a=e(t,["region"]),c=e(t,["access-key","accessKey"]),g=e(t,["secret-key","secretKey"]),f=e(t,["write-through","writeThrough"]),u=e(t,["disable"]);r||(i(n,"Bucket name is required"),process.exit(1)),u&&(o!==void 0||s!==void 0||a!==void 0||c!==void 0||g!==void 0||f!==void 0)&&(i(n,"Cannot use --disable with other migration options"),process.exit(1));let m=await x(),l=h(),p={...m,...l&&!m.organizationId?{organizationId:l}:{}};if(u){let{error:k}=await K(r,{dataMigration:{enabled:!1},config:p});k&&(i(n,k.message),process.exit(1)),d(n,{name:r});return}(!o||!s||!a||!c||!g)&&(i(n,"Required: --bucket, --endpoint, --region, --access-key, --secret-key"),process.exit(1));let{error:b}=await K(r,{dataMigration:{enabled:!0,accessKey:c,secretKey:g,region:a,name:o,endpoint:s,writeThrough:f??!1},config:p});b&&(i(n,b.message),process.exit(1)),d(n,{name:r})}export{M as default};
@@ -1 +1 @@
1
- import{a as k,b as w,c as i,g as x}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as C}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketNotifications as N}from"@tigrisdata/storage";var t=x("buckets","set-notifications");async function O(n){k(t);let c=e(n,["name"]),d=e(n,["url"]),f=e(n,["filter"]),a=e(n,["token"]),o=e(n,["username"]),s=e(n,["password"]),l=e(n,["enable"]),g=e(n,["disable"]),u=e(n,["reset"]);c||(i(t,"Bucket name is required"),process.exit(1)),[l,g,u].filter(Boolean).length>1&&(i(t,"Only one of --enable, --disable, or --reset can be used"),process.exit(1)),u&&(d!==void 0||f!==void 0||a!==void 0||o!==void 0||s!==void 0)&&(i(t,"Cannot use --reset with other options"),process.exit(1)),!l&&!g&&!u&&d===void 0&&f===void 0&&a===void 0&&o===void 0&&s===void 0&&(i(t,"Provide at least one option"),process.exit(1)),a&&(o!==void 0||s!==void 0)&&(i(t,"Cannot use --token with --username/--password. Choose one auth method"),process.exit(1)),(o!==void 0&&s===void 0||o===void 0&&s!==void 0)&&(i(t,"Both --username and --password are required"),process.exit(1));let m=await C(),p=h(),B={...m,...p&&!m.organizationId?{organizationId:p}:{}},r;u?r={}:(r={...l?{enabled:!0}:{},...g?{enabled:!1}:{},...d!==void 0?{url:d}:{},...f!==void 0?{filter:f}:{}},a?r={...r,auth:{token:a}}:o&&s&&(r={...r,auth:{username:o,password:s}}));let{error:b}=await N(c,{notificationConfig:r,config:B});b&&(i(t,b.message),process.exit(1)),w(t,{name:c})}export{O as default};
1
+ import{a as k,b as w,c as i,g as x}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as C}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketNotifications as N}from"@tigrisdata/storage";var t=x("buckets","set-notifications");async function O(n){k(t);let c=e(n,["name"]),d=e(n,["url"]),f=e(n,["filter"]),a=e(n,["token"]),o=e(n,["username"]),s=e(n,["password"]),l=e(n,["enable"]),g=e(n,["disable"]),u=e(n,["reset"]);c||(i(t,"Bucket name is required"),process.exit(1)),[l,g,u].filter(Boolean).length>1&&(i(t,"Only one of --enable, --disable, or --reset can be used"),process.exit(1)),u&&(d!==void 0||f!==void 0||a!==void 0||o!==void 0||s!==void 0)&&(i(t,"Cannot use --reset with other options"),process.exit(1)),!l&&!g&&!u&&d===void 0&&f===void 0&&a===void 0&&o===void 0&&s===void 0&&(i(t,"Provide at least one option"),process.exit(1)),a&&(o!==void 0||s!==void 0)&&(i(t,"Cannot use --token with --username/--password. Choose one auth method"),process.exit(1)),(o!==void 0&&s===void 0||o===void 0&&s!==void 0)&&(i(t,"Both --username and --password are required"),process.exit(1));let m=await C(),p=h(),B={...m,...p&&!m.organizationId?{organizationId:p}:{}},r;u?r={}:(r={...l?{enabled:!0}:{},...g?{enabled:!1}:{},...d!==void 0?{url:d}:{},...f!==void 0?{filter:f}:{}},a?r={...r,auth:{token:a}}:o&&s&&(r={...r,auth:{username:o,password:s}}));let{error:b}=await N(c,{notificationConfig:r,config:B});b&&(i(t,b.message),process.exit(1)),w(t,{name:c})}export{O as default};
@@ -1 +1 @@
1
- import{a as m,b,c as s,g as p}from"../../chunk-SYGTCM6P.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as x}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketLifecycle as A}from"@tigrisdata/storage";var e=p("buckets","set-transition"),y=["STANDARD_IA","GLACIER","GLACIER_IR"];async function I(a){m(e);let d=i(a,["name"]),o=i(a,["storage-class","storageClass"]),n=i(a,["days"]),t=i(a,["date"]),c=i(a,["enable"]),r=i(a,["disable"]);d||(s(e,"Bucket name is required"),process.exit(1)),c&&r&&(s(e,"Cannot use both --enable and --disable"),process.exit(1)),r&&(n!==void 0||t!==void 0||o!==void 0)&&(s(e,"Cannot use --disable with --days, --date, or --storage-class"),process.exit(1)),!c&&!r&&n===void 0&&t===void 0&&(s(e,"Provide --days, --date, --enable, or --disable"),process.exit(1)),(n!==void 0||t!==void 0)&&!o&&(s(e,"--storage-class is required when setting --days or --date"),process.exit(1)),o&&!y.includes(o)&&(s(e,`--storage-class must be one of: ${y.join(", ")} (STANDARD is not a valid transition target)`),process.exit(1)),n!==void 0&&(isNaN(Number(n))||Number(n)<=0)&&(s(e,"--days must be a positive number"),process.exit(1)),t!==void 0&&(typeof t!="string"||!/^\d{4}-\d{2}-\d{2}/.test(t)||isNaN(new Date(t).getTime()))&&(s(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)"),process.exit(1));let f=await x(),u=g(),N={...f,...u&&!f.organizationId?{organizationId:u}:{}},S={...c?{enabled:!0}:{},...r?{enabled:!1}:{},...o?{storageClass:o}:{},...n!==void 0?{days:Number(n)}:{},...t!==void 0?{date:t}:{}},{error:l}=await A(d,{lifecycleRules:[S],config:N});l&&(s(e,l.message),process.exit(1)),b(e,{name:d})}export{I as default};
1
+ import{a as m,b,c as s,g as p}from"../../chunk-SYGTCM6P.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as x}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketLifecycle as A}from"@tigrisdata/storage";var e=p("buckets","set-transition"),y=["STANDARD_IA","GLACIER","GLACIER_IR"];async function I(a){m(e);let d=i(a,["name"]),o=i(a,["storage-class","storageClass"]),n=i(a,["days"]),t=i(a,["date"]),c=i(a,["enable"]),r=i(a,["disable"]);d||(s(e,"Bucket name is required"),process.exit(1)),c&&r&&(s(e,"Cannot use both --enable and --disable"),process.exit(1)),r&&(n!==void 0||t!==void 0||o!==void 0)&&(s(e,"Cannot use --disable with --days, --date, or --storage-class"),process.exit(1)),!c&&!r&&n===void 0&&t===void 0&&(s(e,"Provide --days, --date, --enable, or --disable"),process.exit(1)),(n!==void 0||t!==void 0)&&!o&&(s(e,"--storage-class is required when setting --days or --date"),process.exit(1)),o&&!y.includes(o)&&(s(e,`--storage-class must be one of: ${y.join(", ")} (STANDARD is not a valid transition target)`),process.exit(1)),n!==void 0&&(isNaN(Number(n))||Number(n)<=0)&&(s(e,"--days must be a positive number"),process.exit(1)),t!==void 0&&(typeof t!="string"||!/^\d{4}-\d{2}-\d{2}/.test(t)||isNaN(new Date(t).getTime()))&&(s(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)"),process.exit(1));let f=await x(),u=g(),N={...f,...u&&!f.organizationId?{organizationId:u}:{}},S={...c?{enabled:!0}:{},...r?{enabled:!1}:{},...o?{storageClass:o}:{},...n!==void 0?{days:Number(n)}:{},...t!==void 0?{date:t}:{}},{error:l}=await A(d,{lifecycleRules:[S],config:N});l&&(s(e,l.message),process.exit(1)),b(e,{name:d})}export{I as default};
@@ -1 +1 @@
1
- import{a as g,b as m,c as n,g as b}from"../../chunk-SYGTCM6P.js";import{a as s}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as l}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketTtl as N}from"@tigrisdata/storage";var e=b("buckets","set-ttl");async function w(a){g(e);let d=s(a,["name"]),i=s(a,["days"]),t=s(a,["date"]),r=s(a,["enable"]),o=s(a,["disable"]);d||(n(e,"Bucket name is required"),process.exit(1)),r&&o&&(n(e,"Cannot use both --enable and --disable"),process.exit(1)),o&&(i!==void 0||t!==void 0)&&(n(e,"Cannot use --disable with --days or --date"),process.exit(1)),!r&&!o&&i===void 0&&t===void 0&&(n(e,"Provide --days, --date, --enable, or --disable"),process.exit(1)),i!==void 0&&(isNaN(Number(i))||Number(i)<=0)&&(n(e,"--days must be a positive number"),process.exit(1)),t!==void 0&&(typeof t!="string"||!/^\d{4}-\d{2}-\d{2}/.test(t)||isNaN(new Date(t).getTime()))&&(n(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)"),process.exit(1));let c=await p(),f=l(),x={...c,...f&&!c.organizationId?{organizationId:f}:{}},y={...r?{enabled:!0}:{},...o?{enabled:!1}:{},...i!==void 0?{days:Number(i)}:{},...t!==void 0?{date:t}:{}},{error:u}=await N(d,{ttlConfig:y,config:x});u&&(n(e,u.message),process.exit(1)),m(e,{name:d})}export{w as default};
1
+ import{a as g,b as m,c as n,g as b}from"../../chunk-SYGTCM6P.js";import{a as s}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as l}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketTtl as N}from"@tigrisdata/storage";var e=b("buckets","set-ttl");async function w(a){g(e);let d=s(a,["name"]),i=s(a,["days"]),t=s(a,["date"]),r=s(a,["enable"]),o=s(a,["disable"]);d||(n(e,"Bucket name is required"),process.exit(1)),r&&o&&(n(e,"Cannot use both --enable and --disable"),process.exit(1)),o&&(i!==void 0||t!==void 0)&&(n(e,"Cannot use --disable with --days or --date"),process.exit(1)),!r&&!o&&i===void 0&&t===void 0&&(n(e,"Provide --days, --date, --enable, or --disable"),process.exit(1)),i!==void 0&&(isNaN(Number(i))||Number(i)<=0)&&(n(e,"--days must be a positive number"),process.exit(1)),t!==void 0&&(typeof t!="string"||!/^\d{4}-\d{2}-\d{2}/.test(t)||isNaN(new Date(t).getTime()))&&(n(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)"),process.exit(1));let c=await p(),f=l(),x={...c,...f&&!c.organizationId?{organizationId:f}:{}},y={...r?{enabled:!0}:{},...o?{enabled:!1}:{},...i!==void 0?{days:Number(i)}:{},...t!==void 0?{date:t}:{}},{error:u}=await N(d,{ttlConfig:y,config:x});u&&(n(e,u.message),process.exit(1)),m(e,{name:d})}export{w as default};
@@ -1 +1 @@
1
- import{a as k,b as A,c,g as h}from"../../chunk-SYGTCM6P.js";import{c as x}from"../../chunk-Q4KOY3VK.js";import{a as e,b as o}from"../../chunk-JRALYIRA.js";import{b as y}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as O}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{updateBucket as C}from"@tigrisdata/storage";var a=h("buckets","set");async function S(n){k(a);let s=e(n,["name"]),r=e(n,["access"]),i=e(n,["locations"]),b=e(n,["region"]);b!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),i===void 0&&(i=b));let d=e(n,["allow-object-acl","allowObjectAcl"]),l=e(n,["disable-directory-listing","disableDirectoryListing"]),f=e(n,["cache-control","cacheControl"]),u=e(n,["custom-domain","customDomain"]),g=e(n,["enable-delete-protection","enableDeleteProtection"]),m=e(n,["enable-additional-headers","enableAdditionalHeaders"]);s||(c(a,"Bucket name is required"),process.exit(1)),r===void 0&&i===void 0&&d===void 0&&l===void 0&&f===void 0&&u===void 0&&g===void 0&&m===void 0&&(c(a,"At least one setting is required"),process.exit(1));let p=await y(),t={};r!==void 0&&(t.access=r),i!==void 0&&(t.locations=x(i)),d!==void 0&&(t.allowObjectAcl=o(d)),l!==void 0&&(t.disableDirectoryListing=o(l)),f!==void 0&&(t.cacheControl=f),u!==void 0&&(t.customDomain=u),g!==void 0&&(t.enableDeleteProtection=o(g)),m!==void 0&&(t.enableAdditionalHeaders=o(m));let w=O(),B={...p,...w&&!p.organizationId?{organizationId:w}:{}},{error:D}=await C(s,{...t,config:B});D&&(c(a,D.message),process.exit(1)),A(a,{name:s})}export{S as default};
1
+ import{a as k,b as A,c,g as h}from"../../chunk-SYGTCM6P.js";import{c as x}from"../../chunk-Q4KOY3VK.js";import{a as e,b as o}from"../../chunk-JRALYIRA.js";import{b as y}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as O}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{updateBucket as C}from"@tigrisdata/storage";var a=h("buckets","set");async function S(n){k(a);let s=e(n,["name"]),r=e(n,["access"]),i=e(n,["locations"]),b=e(n,["region"]);b!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),i===void 0&&(i=b));let d=e(n,["allow-object-acl","allowObjectAcl"]),l=e(n,["disable-directory-listing","disableDirectoryListing"]),f=e(n,["cache-control","cacheControl"]),u=e(n,["custom-domain","customDomain"]),g=e(n,["enable-delete-protection","enableDeleteProtection"]),m=e(n,["enable-additional-headers","enableAdditionalHeaders"]);s||(c(a,"Bucket name is required"),process.exit(1)),r===void 0&&i===void 0&&d===void 0&&l===void 0&&f===void 0&&u===void 0&&g===void 0&&m===void 0&&(c(a,"At least one setting is required"),process.exit(1));let p=await y(),t={};r!==void 0&&(t.access=r),i!==void 0&&(t.locations=x(i)),d!==void 0&&(t.allowObjectAcl=o(d)),l!==void 0&&(t.disableDirectoryListing=o(l)),f!==void 0&&(t.cacheControl=f),u!==void 0&&(t.customDomain=u),g!==void 0&&(t.enableDeleteProtection=o(g)),m!==void 0&&(t.enableAdditionalHeaders=o(m));let w=O(),B={...p,...w&&!p.organizationId?{organizationId:w}:{}},{error:D}=await C(s,{...t,config:B});D&&(c(a,D.message),process.exit(1)),A(a,{name:s})}export{S as default};
package/dist/lib/cp.js CHANGED
@@ -1 +1 @@
1
- import{a as T}from"../chunk-SAAGVLRE.js";import{a as b}from"../chunk-CQCBYE3X.js";import{a as D}from"../chunk-JRALYIRA.js";import{a as U,b as R,d as v,g as C,h as z,i as B}from"../chunk-LCWHZUZZ.js";import{b as q}from"../chunk-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{createReadStream as Y,createWriteStream as Z,statSync as M,readdirSync as j,mkdirSync as _,existsSync as H}from"fs";import{resolve as K,dirname as L,basename as A,join as W,relative as O}from"path";import{homedir as P}from"os";import{Readable as J}from"stream";import{pipeline as ee}from"stream/promises";import{get as Q,put as E,list as te,head as V}from"@tigrisdata/storage";function oe(n,e){let t=U(n),a=U(e);return!t&&!a&&(console.error("At least one path must be a remote Tigris path (t3:// or tigris://)"),process.exit(1)),t&&a?"remote-to-remote":t?"remote-to-local":"local-to-remote"}function X(n){return n==="~"||n.startsWith("~/")?K(P(),n.slice(2)):K(n)}function re(n){return j(n,{recursive:!0,withFileTypes:!0}).filter(t=>t.isFile()).map(t=>{let a=t.parentPath??t.path;return W(a,t.name)})}function ne(n,e){let t=L(n),a=A(n),c=C(a);return H(t)?e?j(t,{recursive:!0,withFileTypes:!0}).filter(o=>o.isFile()&&c.test(o.name)).map(o=>{let i=o.parentPath??o.path;return W(i,o.name)}):j(t,{withFileTypes:!0}).filter(i=>i.isFile()&&c.test(i.name)).map(i=>W(t,i.name)):[]}async function I(n,e,t,a,c=!1){let p;try{p=M(n).size}catch{return{error:`File not found: ${n}`}}let o=Y(n),i=J.toWeb(o),r=p!==void 0&&p>16*1024*1024,{error:s}=await E(t,i,{multipart:r,partSize:r?16*1024*1024:void 0,queueSize:r?8:void 0,onUploadProgress:c?({loaded:u})=>{if(p!==void 0&&p>0){let l=Math.round(u/p*100);process.stdout.write(`\rUploading: ${b(u)} / ${b(p)} (${l}%)`)}else process.stdout.write(`\rUploading: ${b(u)}`)}:void 0,config:{...a,bucket:e}});return c&&process.stdout.write("\r"+" ".repeat(60)+"\r"),s?{error:s.message}:{}}async function G(n,e,t,a,c=!1){let p;if(c){let{data:l}=await V(e,{config:{...a,bucket:n}});p=l?.size}let{data:o,error:i}=await Q(e,"stream",{config:{...a,bucket:n}});if(i)return{error:i.message};let r=L(t);H(r)||_(r,{recursive:!0});let s=Z(t),u=J.fromWeb(o);if(c&&p!==void 0&&p>0){let l=0;u.on("data",f=>{l+=f.length;let m=Math.round(l/p*100);process.stdout.write(`\rDownloading: ${b(l)} / ${b(p)} (${m}%)`)})}return await ee(u,s),c&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function N(n,e,t,a,c,p=!1){if(t.endsWith("/")){let{error:l}=await E(c,"",{config:{...n,bucket:a}});return l?{error:l.message}:{}}let o;if(p){let{data:l}=await V(t,{config:{...n,bucket:e}});o=l?.size}let{data:i,error:r}=await Q(t,"stream",{config:{...n,bucket:e}});if(r)return{error:r.message};let s=o!==void 0&&o>16*1024*1024,{error:u}=await E(c,i,{multipart:s,partSize:s?16*1024*1024:void 0,queueSize:s?8:void 0,onUploadProgress:p?({loaded:l})=>{if(o!==void 0&&o>0){let f=Math.round(l/o*100);process.stdout.write(`\rCopying: ${b(l)} / ${b(o)} (${f}%)`)}else process.stdout.write(`\rCopying: ${b(l)}`)}:void 0,config:{...n,bucket:a}});return p&&process.stdout.write("\r"+" ".repeat(60)+"\r"),u?{error:u.message}:{}}async function ie(n,e,t,a){let c=X(n);if(n.includes("*")){let i=ne(c,a);if(i.length===0){console.log("No files matching pattern");return}let r=L(c),s=i.map(f=>async()=>{let m=O(r,f),w=e.path?`${e.path.replace(/\/$/,"")}/${m}`:m,d=await I(f,e.bucket,w,t);return d.error?(console.error(`Failed to upload ${f}: ${d.error}`),!1):(console.log(`Uploaded ${f} -> t3://${e.bucket}/${w}`),!0)}),l=(await T(s,8)).filter(Boolean).length;console.log(`Uploaded ${l} file(s)`);return}let o;try{o=M(c)}catch{console.error(`Source not found: ${n}`),process.exit(1)}if(o.isDirectory()){a||(console.error(`${n} is a directory (not copied). Use -r to copy recursively.`),process.exit(1));let i=re(c);if(i.length===0){console.log("No files to upload");return}let r=n.endsWith("/")?"":A(c),s=i.map(f=>async()=>{let m=O(c,f),d=[e.path?.replace(/\/$/,""),r,m].filter(Boolean).join("/"),S=await I(f,e.bucket,d,t);return S.error?(console.error(`Failed to upload ${f}: ${S.error}`),!1):(console.log(`Uploaded ${f} -> t3://${e.bucket}/${d}`),!0)}),l=(await T(s,8)).filter(Boolean).length;console.log(`Uploaded ${l} file(s)`)}else{let i=A(c),r;e.path?n.endsWith("/")||e.path.endsWith("/")?r=`${e.path.replace(/\/$/,"")}/${i}`:await v(e.bucket,e.path,t)?r=`${e.path}/${i}`:r=e.path:r=i;let s=await I(c,e.bucket,r,t,!0);s.error&&(console.error(s.error),process.exit(1)),console.log(`Uploaded ${n} -> t3://${e.bucket}/${r}`)}}async function ae(n,e,t,a,c){let p=n.endsWith("/");!e.path&&!p&&(console.error("Cannot copy a bucket. Provide a path within the bucket."),process.exit(1));let o=X(t),i=e.path.includes("*"),r=e.path.endsWith("/")||!e.path&&p;if(!i&&!r&&(r=await v(e.bucket,e.path,a)),r&&!i&&!c&&(console.error("Source is a remote folder (not copied). Use -r to copy recursively."),process.exit(1)),i||r){let s=i?z(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",u=!i&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",{items:l,error:f}=await B(e.bucket,s||void 0,a);f&&(console.error(f.message),process.exit(1));let m=l.filter(g=>!g.name.endsWith("/"));if(i){let g=e.path.split("/").pop(),$=C(g);m=m.filter(y=>{let h=s?y.name.slice(s.length):y.name;return!c&&h.includes("/")?!1:$.test(h.split("/").pop())})}if(m.length===0){console.log("No objects to download");return}let w=m.map(g=>async()=>{let $=s?g.name.slice(s.length):g.name,y=u?W(o,u,$):W(o,$),h=await G(e.bucket,g.name,y,a);return h.error?(console.error(`Failed to download ${g.name}: ${h.error}`),!1):(console.log(`Downloaded t3://${e.bucket}/${g.name} -> ${y}`),!0)}),S=(await T(w,8)).filter(Boolean).length;console.log(`Downloaded ${S} file(s)`)}else{let s=e.path.split("/").pop(),u,l=!1;try{l=M(o).isDirectory()}catch{}l||t.endsWith("/")?u=W(o,s):u=o;let f=await G(e.bucket,e.path,u,a,!0);f.error&&(console.error(f.error),process.exit(1)),console.log(`Downloaded t3://${e.bucket}/${e.path} -> ${u}`)}}async function se(n,e,t,a,c){let p=n.endsWith("/");!e.path&&!p&&(console.error("Cannot copy a bucket. Provide a path within the bucket."),process.exit(1));let o=n.includes("*"),i=e.path.endsWith("/")||!e.path&&p;if(!o&&!i&&e.path&&(i=await v(e.bucket,e.path,a)),i&&!o&&!c&&(console.error("Source is a remote folder (not copied). Use -r to copy recursively."),process.exit(1)),o||i){let r=o?z(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",s=!o&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",l=[t.path?.replace(/\/$/,"")||"",s].filter(Boolean).join("/"),f=l?`${l}/`:"";e.bucket===t.bucket&&r===f&&(console.error("Source and destination are the same"),process.exit(1));let{items:m,error:w}=await B(e.bucket,r||void 0,a);w&&(console.error(w.message),process.exit(1));let d=m.filter(h=>h.name!==r);if(o){let h=e.path.split("/").pop(),k=C(h);d=d.filter(x=>{let F=r?x.name.slice(r.length):x.name;return!c&&F.includes("/")?!1:k.test(F.split("/").pop())})}let S=d.map(h=>async()=>{let k=r?h.name.slice(r.length):h.name,x=l?`${l}/${k}`:k,F=await N(a,e.bucket,h.name,t.bucket,x);return F.error?(console.error(`Failed to copy ${h.name}: ${F.error}`),!1):(console.log(`Copied t3://${e.bucket}/${h.name} -> t3://${t.bucket}/${x}`),!0)}),$=(await T(S,8)).filter(Boolean).length,y=!1;if(l&&r){let{data:h}=await te({prefix:r,limit:1,config:{...a,bucket:e.bucket}});if(h?.items?.some(k=>k.name===r)){let k=`${l}/`,x=await N(a,e.bucket,r,t.bucket,k);x.error?console.error(`Failed to copy folder marker: ${x.error}`):y=!0}}if($===0&&y&&($=1),$===0){console.log("No objects to copy");return}console.log(`Copied ${$} object(s)`)}else{let r=e.path.split("/").pop(),s;t.path?t.path.endsWith("/")?s=`${t.path}${r}`:await v(t.bucket,t.path,a)?s=`${t.path}/${r}`:s=t.path:s=r,e.bucket===t.bucket&&e.path===s&&(console.error("Source and destination are the same"),process.exit(1));let u=await N(a,e.bucket,e.path,t.bucket,s,!0);u.error&&(console.error(u.error),process.exit(1)),console.log(`Copied t3://${e.bucket}/${e.path} -> t3://${t.bucket}/${s}`)}}async function le(n){let e=D(n,["src"]),t=D(n,["dest"]);(!e||!t)&&(console.error("Both src and dest arguments are required"),process.exit(1));let a=!!D(n,["recursive","r"]),c=oe(e,t),p=await q();switch(c){case"local-to-remote":{let o=R(t);o.bucket||(console.error("Invalid destination path"),process.exit(1)),await ie(e,o,p,a);break}case"remote-to-local":{let o=R(e);o.bucket||(console.error("Invalid source path"),process.exit(1)),await ae(e,o,t,p,a);break}case"remote-to-remote":{let o=R(e),i=R(t);o.bucket||(console.error("Invalid source path"),process.exit(1)),i.bucket||(console.error("Invalid destination path"),process.exit(1)),await se(e,o,i,p,a);break}}process.exit(0)}export{le as default};
1
+ import{a as C}from"../chunk-SAAGVLRE.js";import{a as N}from"../chunk-EKW6XTGL.js";import{a as b}from"../chunk-CQCBYE3X.js";import{a as D}from"../chunk-JRALYIRA.js";import{a as U,b as S,d as v,g as T,h as B,i as I}from"../chunk-LCWHZUZZ.js";import{b as O}from"../chunk-VOQSWXBS.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{createReadStream as Z,createWriteStream as _,statSync as M,readdirSync as z,mkdirSync as P,existsSync as J}from"fs";import{resolve as q,dirname as K,basename as E,join as F,relative as G}from"path";import{homedir as ee}from"os";import{Readable as Q}from"stream";import{pipeline as te}from"stream/promises";import{get as V,put as L,list as oe,head as X}from"@tigrisdata/storage";function re(r,e){let t=U(r),a=U(e);return!t&&!a&&(console.error("At least one path must be a remote Tigris path (t3:// or tigris://)"),process.exit(1)),t&&a?"remote-to-remote":t?"remote-to-local":"local-to-remote"}function Y(r){return r==="~"||r.startsWith("~/")?q(ee(),r.slice(2)):q(r)}function ne(r){return z(r,{recursive:!0,withFileTypes:!0}).filter(t=>t.isFile()).map(t=>{let a=t.parentPath??t.path;return F(a,t.name)})}function ie(r,e){let t=K(r),a=E(r),l=T(a);return J(t)?e?z(t,{recursive:!0,withFileTypes:!0}).filter(o=>o.isFile()&&l.test(o.name)).map(o=>{let i=o.parentPath??o.path;return F(i,o.name)}):z(t,{withFileTypes:!0}).filter(i=>i.isFile()&&l.test(i.name)).map(i=>F(t,i.name)):[]}async function j(r,e,t,a,l=!1){let c;try{c=M(r).size}catch{return{error:`File not found: ${r}`}}let o=Z(r),i=Q.toWeb(o),{error:n}=await L(t,i,{...N(c),onUploadProgress:l?({loaded:s})=>{if(c!==void 0&&c>0){let p=Math.round(s/c*100);process.stdout.write(`\rUploading: ${b(s)} / ${b(c)} (${p}%)`)}else process.stdout.write(`\rUploading: ${b(s)}`)}:void 0,config:{...a,bucket:e}});return l&&process.stdout.write("\r"+" ".repeat(60)+"\r"),n?{error:n.message}:{}}async function H(r,e,t,a,l=!1){let c;if(l){let{data:u}=await X(e,{config:{...a,bucket:r}});c=u?.size}let{data:o,error:i}=await V(e,"stream",{config:{...a,bucket:r}});if(i)return{error:i.message};let n=K(t);J(n)||P(n,{recursive:!0});let s=_(t),p=Q.fromWeb(o);if(l&&c!==void 0&&c>0){let u=0;p.on("data",f=>{u+=f.length;let m=Math.round(u/c*100);process.stdout.write(`\rDownloading: ${b(u)} / ${b(c)} (${m}%)`)})}return await te(p,s),l&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function A(r,e,t,a,l,c=!1){if(t.endsWith("/")){let{error:p}=await L(l,"",{config:{...r,bucket:a}});return p?{error:p.message}:{}}let o;if(c){let{data:p}=await X(t,{config:{...r,bucket:e}});o=p?.size}let{data:i,error:n}=await V(t,"stream",{config:{...r,bucket:e}});if(n)return{error:n.message};let{error:s}=await L(l,i,{...N(o),onUploadProgress:c?({loaded:p})=>{if(o!==void 0&&o>0){let u=Math.round(p/o*100);process.stdout.write(`\rCopying: ${b(p)} / ${b(o)} (${u}%)`)}else process.stdout.write(`\rCopying: ${b(p)}`)}:void 0,config:{...r,bucket:a}});return c&&process.stdout.write("\r"+" ".repeat(60)+"\r"),s?{error:s.message}:{}}async function ae(r,e,t,a){let l=Y(r);if(r.includes("*")){let i=ie(l,a);if(i.length===0){console.log("No files matching pattern");return}let n=K(l),s=i.map(f=>async()=>{let m=G(n,f),w=e.path?`${e.path.replace(/\/$/,"")}/${m}`:m,d=await j(f,e.bucket,w,t);return d.error?(console.error(`Failed to upload ${f}: ${d.error}`),!1):(console.log(`Uploaded ${f} -> t3://${e.bucket}/${w}`),!0)}),u=(await C(s,8)).filter(Boolean).length;console.log(`Uploaded ${u} file(s)`);return}let o;try{o=M(l)}catch{console.error(`Source not found: ${r}`),process.exit(1)}if(o.isDirectory()){a||(console.error(`${r} is a directory (not copied). Use -r to copy recursively.`),process.exit(1));let i=ne(l);if(i.length===0){console.log("No files to upload");return}let n=r.endsWith("/")?"":E(l),s=i.map(f=>async()=>{let m=G(l,f),d=[e.path?.replace(/\/$/,""),n,m].filter(Boolean).join("/"),W=await j(f,e.bucket,d,t);return W.error?(console.error(`Failed to upload ${f}: ${W.error}`),!1):(console.log(`Uploaded ${f} -> t3://${e.bucket}/${d}`),!0)}),u=(await C(s,8)).filter(Boolean).length;console.log(`Uploaded ${u} file(s)`)}else{let i=E(l),n;e.path?r.endsWith("/")||e.path.endsWith("/")?n=`${e.path.replace(/\/$/,"")}/${i}`:await v(e.bucket,e.path,t)?n=`${e.path}/${i}`:n=e.path:n=i;let s=await j(l,e.bucket,n,t,!0);s.error&&(console.error(s.error),process.exit(1)),console.log(`Uploaded ${r} -> t3://${e.bucket}/${n}`)}}async function se(r,e,t,a,l){let c=r.endsWith("/");!e.path&&!c&&(console.error("Cannot copy a bucket. Provide a path within the bucket."),process.exit(1));let o=Y(t),i=e.path.includes("*"),n=e.path.endsWith("/")||!e.path&&c;if(!i&&!n&&(n=await v(e.bucket,e.path,a)),n&&!i&&!l&&(console.error("Source is a remote folder (not copied). Use -r to copy recursively."),process.exit(1)),i||n){let s=i?B(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",p=!i&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",{items:u,error:f}=await I(e.bucket,s||void 0,a);f&&(console.error(f.message),process.exit(1));let m=u.filter(g=>!g.name.endsWith("/"));if(i){let g=e.path.split("/").pop(),$=T(g);m=m.filter(y=>{let h=s?y.name.slice(s.length):y.name;return!l&&h.includes("/")?!1:$.test(h.split("/").pop())})}if(m.length===0){console.log("No objects to download");return}let w=m.map(g=>async()=>{let $=s?g.name.slice(s.length):g.name,y=p?F(o,p,$):F(o,$),h=await H(e.bucket,g.name,y,a);return h.error?(console.error(`Failed to download ${g.name}: ${h.error}`),!1):(console.log(`Downloaded t3://${e.bucket}/${g.name} -> ${y}`),!0)}),W=(await C(w,8)).filter(Boolean).length;console.log(`Downloaded ${W} file(s)`)}else{let s=e.path.split("/").pop(),p,u=!1;try{u=M(o).isDirectory()}catch{}u||t.endsWith("/")?p=F(o,s):p=o;let f=await H(e.bucket,e.path,p,a,!0);f.error&&(console.error(f.error),process.exit(1)),console.log(`Downloaded t3://${e.bucket}/${e.path} -> ${p}`)}}async function le(r,e,t,a,l){let c=r.endsWith("/");!e.path&&!c&&(console.error("Cannot copy a bucket. Provide a path within the bucket."),process.exit(1));let o=r.includes("*"),i=e.path.endsWith("/")||!e.path&&c;if(!o&&!i&&e.path&&(i=await v(e.bucket,e.path,a)),i&&!o&&!l&&(console.error("Source is a remote folder (not copied). Use -r to copy recursively."),process.exit(1)),o||i){let n=o?B(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",s=!o&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",u=[t.path?.replace(/\/$/,"")||"",s].filter(Boolean).join("/"),f=u?`${u}/`:"";e.bucket===t.bucket&&n===f&&(console.error("Source and destination are the same"),process.exit(1));let{items:m,error:w}=await I(e.bucket,n||void 0,a);w&&(console.error(w.message),process.exit(1));let d=m.filter(h=>h.name!==n);if(o){let h=e.path.split("/").pop(),k=T(h);d=d.filter(x=>{let R=n?x.name.slice(n.length):x.name;return!l&&R.includes("/")?!1:k.test(R.split("/").pop())})}let W=d.map(h=>async()=>{let k=n?h.name.slice(n.length):h.name,x=u?`${u}/${k}`:k,R=await A(a,e.bucket,h.name,t.bucket,x);return R.error?(console.error(`Failed to copy ${h.name}: ${R.error}`),!1):(console.log(`Copied t3://${e.bucket}/${h.name} -> t3://${t.bucket}/${x}`),!0)}),$=(await C(W,8)).filter(Boolean).length,y=!1;if(u&&n){let{data:h}=await oe({prefix:n,limit:1,config:{...a,bucket:e.bucket}});if(h?.items?.some(k=>k.name===n)){let k=`${u}/`,x=await A(a,e.bucket,n,t.bucket,k);x.error?console.error(`Failed to copy folder marker: ${x.error}`):y=!0}}if($===0&&y&&($=1),$===0){console.log("No objects to copy");return}console.log(`Copied ${$} object(s)`)}else{let n=e.path.split("/").pop(),s;t.path?t.path.endsWith("/")?s=`${t.path}${n}`:await v(t.bucket,t.path,a)?s=`${t.path}/${n}`:s=t.path:s=n,e.bucket===t.bucket&&e.path===s&&(console.error("Source and destination are the same"),process.exit(1));let p=await A(a,e.bucket,e.path,t.bucket,s,!0);p.error&&(console.error(p.error),process.exit(1)),console.log(`Copied t3://${e.bucket}/${e.path} -> t3://${t.bucket}/${s}`)}}async function ce(r){let e=D(r,["src"]),t=D(r,["dest"]);(!e||!t)&&(console.error("Both src and dest arguments are required"),process.exit(1));let a=!!D(r,["recursive","r"]),l=re(e,t),c=await O({withCredentialProvider:!0});switch(l){case"local-to-remote":{let o=S(t);o.bucket||(console.error("Invalid destination path"),process.exit(1)),await ae(e,o,c,a);break}case"remote-to-local":{let o=S(e);o.bucket||(console.error("Invalid source path"),process.exit(1)),await se(e,o,t,c,a);break}case"remote-to-remote":{let o=S(e),i=S(t);o.bucket||(console.error("Invalid source path"),process.exit(1)),i.bucket||(console.error("Invalid destination path"),process.exit(1)),await le(e,o,i,c,a);break}}process.exit(0)}export{ce as default};
@@ -1 +1 @@
1
- import{a as f,b as g,c as n,g as u}from"../../chunk-SYGTCM6P.js";import{a as d}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as a}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as m,getBucketInfo as p}from"@tigrisdata/storage";var e=u("credentials","test");async function b(k){f(e);let t=d(k,["bucket","b"]),o=await l();!o.accessKeyId&&!o.sessionToken&&(n(e,'No credentials found. Run "tigris configure" or "tigris login" first.'),process.exit(1));let c=a(),r={...o,...c&&!o.organizationId?{organizationId:c}:{}};if(t){let{data:i,error:s}=await p(t,{config:r});s&&(n(e,`Current credentials don't have access to bucket "${t}"`),process.exit(1)),console.log(` Bucket: ${t}`),console.log(" Access verified."),i.sourceBucketName&&console.log(` Fork of: ${i.sourceBucketName}`)}else{let{data:i,error:s}=await m({config:r});s&&(n(e,"Current credentials don't have sufficient access"),process.exit(1)),console.log(` Access verified. Found ${i.buckets.length} bucket(s).`)}g(e)}export{b as default};
1
+ import{a as f,b as g,c as n,g as u}from"../../chunk-SYGTCM6P.js";import{a as d}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as a}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as m,getBucketInfo as p}from"@tigrisdata/storage";var e=u("credentials","test");async function b(k){f(e);let t=d(k,["bucket","b"]),o=await l();!o.accessKeyId&&!o.sessionToken&&(n(e,'No credentials found. Run "tigris configure" or "tigris login" first.'),process.exit(1));let c=a(),r={...o,...c&&!o.organizationId?{organizationId:c}:{}};if(t){let{data:i,error:s}=await p(t,{config:r});s&&(n(e,`Current credentials don't have access to bucket "${t}"`),process.exit(1)),console.log(` Bucket: ${t}`),console.log(" Access verified."),i.sourceBucketName&&console.log(` Fork of: ${i.sourceBucketName}`)}else{let{data:i,error:s}=await m({config:r});s&&(n(e,"Current credentials don't have sufficient access"),process.exit(1)),console.log(` Access verified. Found ${i.buckets.length} bucket(s).`)}g(e)}export{b as default};
@@ -1 +1 @@
1
- import{a as c,b as a,c as r,g as m}from"../../chunk-SYGTCM6P.js";import{a as t}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createBucket as p}from"@tigrisdata/storage";var e=m("forks","create");async function g(o){c(e);let s=t(o,["name"]),n=t(o,["fork-name","forkName"]),u=t(o,["snapshot","s","S"]);s||(r(e,"Source bucket name is required"),process.exit(1)),n||(r(e,"Fork name is required"),process.exit(1));let{error:i}=await p(n,{sourceBucketName:s,sourceBucketSnapshot:u,config:await f()});i&&(r(e,i.message),process.exit(1)),a(e,{name:s,forkName:n})}export{g as default};
1
+ import{a as c,b as a,c as r,g as m}from"../../chunk-SYGTCM6P.js";import{a as t}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createBucket as p}from"@tigrisdata/storage";var e=m("forks","create");async function g(o){c(e);let s=t(o,["name"]),n=t(o,["fork-name","forkName"]),u=t(o,["snapshot","s","S"]);s||(r(e,"Source bucket name is required"),process.exit(1)),n||(r(e,"Fork name is required"),process.exit(1));let{error:i}=await p(n,{sourceBucketName:s,sourceBucketSnapshot:u,config:await f()});i&&(r(e,i.message),process.exit(1)),a(e,{name:s,forkName:n})}export{g as default};
@@ -1 +1 @@
1
- import{a as u,b as p,c as n,d as s,g}from"../../chunk-SYGTCM6P.js";import{f as d}from"../../chunk-CQCBYE3X.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as k}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as S,getBucketInfo as l}from"@tigrisdata/storage";var t=g("forks","list");async function B(c){u(t);let e=i(c,["name"]),h=i(c,["format","f","F"],"table");e||(n(t,"Source bucket name is required"),process.exit(1));let a=await k(),{data:b,error:f}=await l(e,{config:a});if(f&&(n(t,f.message),process.exit(1)),!b.hasForks){s(t);return}let{data:w,error:m}=await S({config:a});m&&(n(t,m.message),process.exit(1));let r=[];for(let o of w.buckets){if(o.name===e)continue;let{data:y}=await l(o.name,{config:a});y?.sourceBucketName===e&&r.push({name:o.name,created:o.creationDate})}if(r.length===0){s(t);return}let x=d(r,h,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(x),p(t,{count:r.length})}export{B as default};
1
+ import{a as u,b as p,c as n,d as s,g}from"../../chunk-SYGTCM6P.js";import{f as d}from"../../chunk-CQCBYE3X.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as k}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as S,getBucketInfo as l}from"@tigrisdata/storage";var t=g("forks","list");async function B(c){u(t);let e=i(c,["name"]),h=i(c,["format","f","F"],"table");e||(n(t,"Source bucket name is required"),process.exit(1));let a=await k(),{data:b,error:f}=await l(e,{config:a});if(f&&(n(t,f.message),process.exit(1)),!b.hasForks){s(t);return}let{data:w,error:m}=await S({config:a});m&&(n(t,m.message),process.exit(1));let r=[];for(let o of w.buckets){if(o.name===e)continue;let{data:y}=await l(o.name,{config:a});y?.sourceBucketName===e&&r.push({name:o.name,created:o.creationDate})}if(r.length===0){s(t);return}let x=d(r,h,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(x),p(t,{count:r.length})}export{B as default};
@@ -1,2 +1,2 @@
1
- import{a as x,b as P}from"../../../chunk-Y7MJZRR4.js";import{a as p,b as f,c as e,g as h}from"../../../chunk-SYGTCM6P.js";import{a as n}from"../../../chunk-JRALYIRA.js";import{a as y}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as g}from"../../../chunk-E4MLGABW.js";import{g as u}from"../../../chunk-DOUR5YEY.js";import{c as l}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as T,readFileSync as C}from"fs";import{addPolicy as k}from"@tigrisdata/iam";var t=h("iam policies","create");async function N(s){p(t);let r=n(s,["name"]),i=n(s,["document","d"]),w=n(s,["description"])??"";r||(e(t,"Policy name is required"),process.exit(1)),/^[a-zA-Z0-9=,.@_-]+$/.test(r)||(e(t,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed."),process.exit(1)),await y()!=="oauth"&&(e(t,`Policies can only be created when logged in via OAuth.
1
+ import{a as x,b as P}from"../../../chunk-Y7MJZRR4.js";import{a as p,b as f,c as e,g as h}from"../../../chunk-SYGTCM6P.js";import{a as n}from"../../../chunk-JRALYIRA.js";import{a as y}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as g}from"../../../chunk-E4MLGABW.js";import{g as u}from"../../../chunk-DOUR5YEY.js";import{c as l}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as T,readFileSync as C}from"fs";import{addPolicy as k}from"@tigrisdata/iam";var t=h("iam policies","create");async function N(s){p(t);let r=n(s,["name"]),i=n(s,["document","d"]),w=n(s,["description"])??"";r||(e(t,"Policy name is required"),process.exit(1)),/^[a-zA-Z0-9=,.@_-]+$/.test(r)||(e(t,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed."),process.exit(1)),await y()!=="oauth"&&(e(t,`Policies can only be created when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let c=g();await c.isAuthenticated()||(e(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let A=await c.getAccessToken(),v=u(),S=l(),O={sessionToken:A,organizationId:v??void 0,iamEndpoint:S.iamEndpoint},o;i?T(i)?o=C(i,"utf-8"):o=i:process.stdin.isTTY?(e(t,"Policy document is required. Provide via --document or pipe to stdin."),process.exit(1)):o=await x();let a;try{a=P(o)}catch{e(t,"Invalid JSON in policy document"),process.exit(1)}let{data:d,error:m}=await k(r,{document:a,description:w,config:O});m&&(e(t,m.message),process.exit(1)),f(t,{name:d.name}),console.log(`Resource: ${d.resource}`)}export{N as default};
@@ -1,2 +1,2 @@
1
- import{a as p,b as d,c as t,d as f,g as u}from"../../../chunk-SYGTCM6P.js";import{a as w}from"../../../chunk-JRALYIRA.js";import{a as h}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as m}from"../../../chunk-E4MLGABW.js";import{g}from"../../../chunk-DOUR5YEY.js";import{c as l}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import E from"enquirer";import{deletePolicy as S,listPolicies as T}from"@tigrisdata/iam";var{prompt:O}=E,e=u("iam policies","delete");async function M(x){p(e);let i=w(x,["resource"]);await h()!=="oauth"&&(t(e,`Policies can only be deleted when logged in via OAuth.
1
+ import{a as p,b as d,c as t,d as f,g as u}from"../../../chunk-SYGTCM6P.js";import{a as w}from"../../../chunk-JRALYIRA.js";import{a as h}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as m}from"../../../chunk-E4MLGABW.js";import{g}from"../../../chunk-DOUR5YEY.js";import{c as l}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import E from"enquirer";import{deletePolicy as S,listPolicies as T}from"@tigrisdata/iam";var{prompt:O}=E,e=u("iam policies","delete");async function M(x){p(e);let i=w(x,["resource"]);await h()!=="oauth"&&(t(e,`Policies can only be deleted when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let s=m();await s.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let y=await s.getAccessToken(),A=g(),C=l(),r={sessionToken:y,organizationId:A??void 0,iamEndpoint:C.iamEndpoint};if(!i){let{data:o,error:a}=await T({config:r});if(a&&(t(e,a.message),process.exit(1)),!o.policies||o.policies.length===0){f(e);return}let{selected:k}=await O({type:"select",name:"selected",message:"Select a policy to delete:",choices:o.policies.map(n=>({name:n.resource,message:`${n.name} (${n.resource})`}))});i=k}let{error:c}=await S(i,{config:r});c&&(t(e,c.message),process.exit(1)),d(e,{resource:i})}export{M as default};
@@ -1,2 +1,2 @@
1
- import{a as O,b as p}from"../../../chunk-Y7MJZRR4.js";import{a as S,b as A,c as t,d as P,g as T}from"../../../chunk-SYGTCM6P.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as E}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as w}from"../../../chunk-E4MLGABW.js";import{g as x}from"../../../chunk-DOUR5YEY.js";import{c as y}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as N,readFileSync as R}from"fs";import q from"enquirer";import{editPolicy as M,getPolicy as z,listPolicies as F}from"@tigrisdata/iam";var{prompt:I}=q,e=T("iam policies","edit");async function Y(c){S(e);let o=r(c,["resource"]),n=r(c,["document","d"]),a=r(c,["description"]);await E()!=="oauth"&&(t(e,`Policies can only be edited when logged in via OAuth.
1
+ import{a as O,b as p}from"../../../chunk-Y7MJZRR4.js";import{a as S,b as A,c as t,d as P,g as T}from"../../../chunk-SYGTCM6P.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as E}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as w}from"../../../chunk-E4MLGABW.js";import{g as x}from"../../../chunk-DOUR5YEY.js";import{c as y}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as N,readFileSync as R}from"fs";import q from"enquirer";import{editPolicy as M,getPolicy as z,listPolicies as F}from"@tigrisdata/iam";var{prompt:I}=q,e=T("iam policies","edit");async function Y(c){S(e);let o=r(c,["resource"]),n=r(c,["document","d"]),a=r(c,["description"]);await E()!=="oauth"&&(t(e,`Policies can only be edited when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let g=w();await g.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let C=await g.getAccessToken(),D=x(),k=y(),d={sessionToken:C,organizationId:D??void 0,iamEndpoint:k.iamEndpoint};if(!o){process.stdin.isTTY||(t(e,"Policy ARN is required when piping document via stdin."),process.exit(1));let{data:i,error:h}=await F({config:d});if(h&&(t(e,h.message),process.exit(1)),!i.policies||i.policies.length===0){P(e);return}let{selected:J}=await I({type:"select",name:"selected",message:"Select a policy to edit:",choices:i.policies.map(m=>({name:m.resource,message:`${m.name} (${m.resource})`}))});o=J}let s;if(n){let i;N(n)?i=R(n,"utf-8"):i=n;try{s=p(i)}catch{t(e,"Invalid JSON in policy document"),process.exit(1)}}else if(!process.stdin.isTTY&&!a){let i=await O();try{s=p(i)}catch{t(e,"Invalid JSON in policy document"),process.exit(1)}}!s&&!a&&(t(e,"Either --document or --description is required."),process.exit(1));let{data:l,error:u}=await z(o,{config:d});u&&(t(e,u.message),process.exit(1));let{data:v,error:f}=await M(o,{document:s??l.document,description:a??l.description,config:d});f&&(t(e,f.message),process.exit(1)),A(e,{resource:v.resource})}export{Y as default};
@@ -1,2 +1,2 @@
1
- import{a as y,b as r,c as i,d as v,g as A}from"../../../chunk-SYGTCM6P.js";import{f as O}from"../../../chunk-CQCBYE3X.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as S}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as h}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{c as m}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import E from"enquirer";import{getPolicy as P,listPolicies as R}from"@tigrisdata/iam";var{prompt:I}=E,o=A("iam policies","get");async function T(a){y(o);let n=c(a,["resource"]),l=c(a,["format","f","F"],"table");await S()!=="oauth"&&(i(o,`Policies can only be retrieved when logged in via OAuth.
1
+ import{a as y,b as r,c as i,d as v,g as A}from"../../../chunk-SYGTCM6P.js";import{f as O}from"../../../chunk-CQCBYE3X.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as S}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as h}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{c as m}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import E from"enquirer";import{getPolicy as P,listPolicies as R}from"@tigrisdata/iam";var{prompt:I}=E,o=A("iam policies","get");async function T(a){y(o);let n=c(a,["resource"]),l=c(a,["format","f","F"],"table");await S()!=="oauth"&&(i(o,`Policies can only be retrieved when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let u=h();await u.isAuthenticated()||(i(o,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let w=await u.getAccessToken(),C=p(),$=m(),f={sessionToken:w,organizationId:C??void 0,iamEndpoint:$.iamEndpoint};if(!n){let{data:t,error:d}=await R({config:f});if(d&&(i(o,d.message),process.exit(1)),!t.policies||t.policies.length===0){v(o);return}let{selected:D}=await I({type:"select",name:"selected",message:"Select a policy:",choices:t.policies.map(s=>({name:s.resource,message:`${s.name} (${s.resource})`}))});n=D}let{data:e,error:g}=await P(n,{config:f});if(g&&(i(o,g.message),process.exit(1)),l==="json"){console.log(JSON.stringify(e,null,2)),r(o);return}let k=[{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()}],x=O(k,l,"policy","field",[{key:"field",header:"Field"},{key:"value",header:"Value"}]);if(console.log(x),e.users&&e.users.length>0){console.log("Attached Users:");for(let t of e.users)console.log(` - ${t}`);console.log()}console.log("Policy Document:"),console.log(` Version: ${e.document.version}`),console.log(" Statements:");for(let t of e.document.statements)console.log(` - Effect: ${t.effect}`),console.log(` Action: ${Array.isArray(t.action)?t.action.join(", "):t.action}`),console.log(` Resource: ${Array.isArray(t.resource)?t.resource.join(", "):t.resource}`);r(o)}export{T as default};
@@ -1,2 +1,2 @@
1
- import{a as m,b as p,c as i,d as u,g}from"../../../chunk-SYGTCM6P.js";import{f as l}from"../../../chunk-CQCBYE3X.js";import{a as f}from"../../../chunk-JRALYIRA.js";import{a as h}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as d}from"../../../chunk-E4MLGABW.js";import{g as c}from"../../../chunk-DOUR5YEY.js";import{c as s}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{listPolicies as O}from"@tigrisdata/iam";var e=g("iam policies","list");async function D(k){m(e);let A=f(k,["format","f","F"],"table");await h()!=="oauth"&&(i(e,`Policies can only be listed when logged in via OAuth.
1
+ import{a as m,b as p,c as i,d as u,g}from"../../../chunk-SYGTCM6P.js";import{f as l}from"../../../chunk-CQCBYE3X.js";import{a as f}from"../../../chunk-JRALYIRA.js";import{a as h}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as d}from"../../../chunk-E4MLGABW.js";import{g as c}from"../../../chunk-DOUR5YEY.js";import{c as s}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{listPolicies as O}from"@tigrisdata/iam";var e=g("iam policies","list");async function D(k){m(e);let A=f(k,["format","f","F"],"table");await h()!=="oauth"&&(i(e,`Policies can only be listed when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let n=d();await n.isAuthenticated()||(i(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let w=await n.getAccessToken(),C=c(),x=s(),{data:o,error:r}=await O({config:{sessionToken:w,organizationId:C??void 0,iamEndpoint:x.iamEndpoint}});if(r&&(i(e,r.message),process.exit(1)),!o.policies||o.policies.length===0){u(e);return}let a=o.policies.map(t=>({name:t.name,id:t.id,resource:t.resource,description:t.description||"-",attachments:t.attachmentCount,created:t.createDate,updated:t.updateDate})),y=l(a,A,"policies","policy",[{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"}]);console.log(y),p(e,{count:a.length})}export{D as default};
@@ -1,4 +1,4 @@
1
- import{a as h,b as y,c as t,g as v}from"../../../chunk-SYGTCM6P.js";import{a as s}from"../../../chunk-JRALYIRA.js";import{a as R}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as u}from"../../../chunk-DOUR5YEY.js";import{a as p}from"../../../chunk-GZ7JBHFT.js";import{c as d}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{inviteUser as E}from"@tigrisdata/iam";var i=v("iam users","invite");async function O(r){h(i),await R()!=="oauth"&&(t(i,`Users can only be invited when logged in via OAuth.
1
+ import{a as h,b as y,c as t,g as v}from"../../../chunk-SYGTCM6P.js";import{a as s}from"../../../chunk-JRALYIRA.js";import{a as R}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as u}from"../../../chunk-DOUR5YEY.js";import{a as p}from"../../../chunk-GZ7JBHFT.js";import{c as d}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{inviteUser as E}from"@tigrisdata/iam";var i=v("iam users","invite");async function O(r){h(i),await R()!=="oauth"&&(t(i,`Users can only be invited when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let a=u();if(p(a??void 0)){console.log(`User management is not available for Fly.io organizations.
3
3
  Your users are managed through Fly.io.
4
4
 
@@ -1,4 +1,4 @@
1
- import{a as y,b as k,c as i,d as b,g as C}from"../../../chunk-SYGTCM6P.js";import{b as T,d as s,e as a}from"../../../chunk-CQCBYE3X.js";import{a as w}from"../../../chunk-JRALYIRA.js";import{a as U}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as h}from"../../../chunk-E4MLGABW.js";import{g as f}from"../../../chunk-DOUR5YEY.js";import{a as p}from"../../../chunk-GZ7JBHFT.js";import{c as u}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{listUsers as A}from"@tigrisdata/iam";var n=C("iam users","list");async function O(v){y(n);let r=w(v,["format","f","F"],"table");await U()!=="oauth"&&(i(n,`Users can only be listed when logged in via OAuth.
1
+ import{a as y,b as k,c as i,d as b,g as C}from"../../../chunk-SYGTCM6P.js";import{b as T,d as s,e as a}from"../../../chunk-CQCBYE3X.js";import{a as w}from"../../../chunk-JRALYIRA.js";import{a as U}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as h}from"../../../chunk-E4MLGABW.js";import{g as f}from"../../../chunk-DOUR5YEY.js";import{a as p}from"../../../chunk-GZ7JBHFT.js";import{c as u}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{listUsers as A}from"@tigrisdata/iam";var n=C("iam users","list");async function O(v){y(n);let r=w(v,["format","f","F"],"table");await U()!=="oauth"&&(i(n,`Users can only be listed when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let l=f();if(p(l??void 0)){console.log(`User management is not available for Fly.io organizations.
3
3
  Your users are managed through Fly.io.
4
4
 
@@ -1,4 +1,4 @@
1
- import{a as h,b as y,c as t,d as w,g as v}from"../../../chunk-SYGTCM6P.js";import{a as O}from"../../../chunk-JRALYIRA.js";import{a as A}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{a as d}from"../../../chunk-GZ7JBHFT.js";import{c as u}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import C from"enquirer";import{removeUser as k,listUsers as z}from"@tigrisdata/iam";var{prompt:F}=C,e=v("iam users","remove");async function S(U){h(e);let o=O(U,["resource"]);await A()!=="oauth"&&(t(e,`Users can only be removed when logged in via OAuth.
1
+ import{a as h,b as y,c as t,d as w,g as v}from"../../../chunk-SYGTCM6P.js";import{a as O}from"../../../chunk-JRALYIRA.js";import{a as A}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{a as d}from"../../../chunk-GZ7JBHFT.js";import{c as u}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import C from"enquirer";import{removeUser as k,listUsers as z}from"@tigrisdata/iam";var{prompt:F}=C,e=v("iam users","remove");async function S(U){h(e);let o=O(U,["resource"]);await A()!=="oauth"&&(t(e,`Users can only be removed when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let n=p();if(d(n??void 0)){console.log(`User management is not available for Fly.io organizations.
3
3
  Your users are managed through Fly.io.
4
4
 
@@ -1,4 +1,4 @@
1
- import{a as h,b as v,c as e,d as y,g as k}from"../../../chunk-SYGTCM6P.js";import{a as A}from"../../../chunk-JRALYIRA.js";import{a as w}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{a as d}from"../../../chunk-GZ7JBHFT.js";import{c as u}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import I from"enquirer";import{revokeInvitation as z,listUsers as F}from"@tigrisdata/iam";var{prompt:O}=I,t=k("iam users","revoke-invitation");async function S(x){h(t);let i=A(x,["resource"]);await w()!=="oauth"&&(e(t,`Invitations can only be revoked when logged in via OAuth.
1
+ import{a as h,b as v,c as e,d as y,g as k}from"../../../chunk-SYGTCM6P.js";import{a as A}from"../../../chunk-JRALYIRA.js";import{a as w}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{a as d}from"../../../chunk-GZ7JBHFT.js";import{c as u}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import I from"enquirer";import{revokeInvitation as z,listUsers as F}from"@tigrisdata/iam";var{prompt:O}=I,t=k("iam users","revoke-invitation");async function S(x){h(t);let i=A(x,["resource"]);await w()!=="oauth"&&(e(t,`Invitations can only be revoked when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let r=p();if(d(r??void 0)){console.log(`User management is not available for Fly.io organizations.
3
3
  Your users are managed through Fly.io.
4
4
 
@@ -1,4 +1,4 @@
1
- import{a as b,b as x,c as t,d as O,g as U}from"../../../chunk-SYGTCM6P.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as v}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as w}from"../../../chunk-E4MLGABW.js";import{g as R}from"../../../chunk-DOUR5YEY.js";import{a as A}from"../../../chunk-GZ7JBHFT.js";import{c as y}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import k from"enquirer";import{updateUserRole as F,listUsers as M}from"@tigrisdata/iam";var{prompt:z}=k,e=U("iam users","update-role");async function S(m){b(e),await v()!=="oauth"&&(t(e,`User roles can only be updated when logged in via OAuth.
1
+ import{a as b,b as x,c as t,d as O,g as U}from"../../../chunk-SYGTCM6P.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as v}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as w}from"../../../chunk-E4MLGABW.js";import{g as R}from"../../../chunk-DOUR5YEY.js";import{a as A}from"../../../chunk-GZ7JBHFT.js";import{c as y}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import k from"enquirer";import{updateUserRole as F,listUsers as M}from"@tigrisdata/iam";var{prompt:z}=k,e=U("iam users","update-role");async function S(m){b(e),await v()!=="oauth"&&(t(e,`User roles can only be updated when logged in via OAuth.
2
2
  Run "tigris login oauth" first.`),process.exit(1));let g=R();if(A(g??void 0)){console.log(`User management is not available for Fly.io organizations.
3
3
  Your users are managed through Fly.io.
4
4
 
package/dist/lib/ls.js CHANGED
@@ -1 +1 @@
1
- import{a as k,f as c}from"../chunk-CQCBYE3X.js";import{a as u}from"../chunk-JRALYIRA.js";import{f as p}from"../chunk-LCWHZUZZ.js";import{b as i}from"../chunk-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{list as w,listBuckets as z}from"@tigrisdata/storage";async function S(g){let d=u(g,["path"]);if(!d){let e=await i(),{data:t,error:o}=await z({config:e});o&&(console.error(o.message),process.exit(1));let s=(t.buckets||[]).map(l=>({name:l.name,created:l.creationDate})),a=c(s,"table","buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(a);return}let{bucket:f,path:r}=p(d);f||(console.error("Invalid path"),process.exit(1));let h=await i(),n=r?r.endsWith("/")?r:`${r}/`:void 0,{data:y,error:m}=await w({prefix:n,config:{...h,bucket:f}});m&&(console.error(m.message),process.exit(1));let b=(y.items||[]).map(e=>{let t=n?e.name.slice(n.length):e.name,o=t.indexOf("/"),s=o===-1?t:t.slice(0,o+1),a=s.endsWith("/");return{key:s,size:a?"-":k(e.size),modified:e.lastModified}}).filter((e,t,o)=>e.key!==""&&o.findIndex(s=>s.key===e.key)===t),x=c(b,"table","objects","object",[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}]);console.log(x)}export{S as default};
1
+ import{a as k,f as c}from"../chunk-CQCBYE3X.js";import{a as u}from"../chunk-JRALYIRA.js";import{f as p}from"../chunk-LCWHZUZZ.js";import{b as i}from"../chunk-VOQSWXBS.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{list as w,listBuckets as z}from"@tigrisdata/storage";async function S(g){let d=u(g,["path"]);if(!d){let e=await i(),{data:t,error:o}=await z({config:e});o&&(console.error(o.message),process.exit(1));let s=(t.buckets||[]).map(l=>({name:l.name,created:l.creationDate})),a=c(s,"table","buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(a);return}let{bucket:f,path:r}=p(d);f||(console.error("Invalid path"),process.exit(1));let h=await i(),n=r?r.endsWith("/")?r:`${r}/`:void 0,{data:y,error:m}=await w({prefix:n,config:{...h,bucket:f}});m&&(console.error(m.message),process.exit(1));let b=(y.items||[]).map(e=>{let t=n?e.name.slice(n.length):e.name,o=t.indexOf("/"),s=o===-1?t:t.slice(0,o+1),a=s.endsWith("/");return{key:s,size:a?"-":k(e.size),modified:e.lastModified}}).filter((e,t,o)=>e.key!==""&&o.findIndex(s=>s.key===e.key)===t),x=c(b,"table","objects","object",[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}]);console.log(x)}export{S as default};
package/dist/lib/mk.js CHANGED
@@ -1 +1 @@
1
- import{c as f}from"../chunk-Q4KOY3VK.js";import{a as e}from"../chunk-JRALYIRA.js";import{f as g}from"../chunk-LCWHZUZZ.js";import{b as p}from"../chunk-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{createBucket as h,put as w}from"@tigrisdata/storage";async function S(t){let c=e(t,["path"]);c||(console.error("path argument is required"),process.exit(1));let{bucket:s,path:o}=g(c);s||(console.error("Invalid path"),process.exit(1));let i=await p();if(o){let n=o.endsWith("/")?o:`${o}/`,{error:r}=await w(n,"",{config:{...i,bucket:s}});r&&(console.error(r.message),process.exit(1)),console.log(`Folder '${s}/${n}' created`),process.exit(0)}else{let r=e(t,["public"])?"public":e(t,["access","a","A"]),u=e(t,["enableSnapshots","enable-snapshots","s","S"]),m=e(t,["defaultTier","default-tier","t","T"]),a=e(t,["locations","l","L"]),l=e(t,["region","r","R"]),b=e(t,["consistency","c","C"]);l!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),a===void 0&&(a=l)),b!==void 0&&console.warn("Warning: --consistency is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/");let{error:d}=await h(s,{defaultTier:m??"STANDARD",enableSnapshot:u===!0,access:r??"private",locations:f(a??"global"),config:i});d&&(console.error(d.message),process.exit(1)),console.log(`Bucket '${s}' created`),process.exit(0)}}export{S as default};
1
+ import{c as f}from"../chunk-Q4KOY3VK.js";import{a as e}from"../chunk-JRALYIRA.js";import{f as g}from"../chunk-LCWHZUZZ.js";import{b as p}from"../chunk-VOQSWXBS.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{createBucket as h,put as w}from"@tigrisdata/storage";async function S(t){let c=e(t,["path"]);c||(console.error("path argument is required"),process.exit(1));let{bucket:s,path:o}=g(c);s||(console.error("Invalid path"),process.exit(1));let i=await p();if(o){let n=o.endsWith("/")?o:`${o}/`,{error:r}=await w(n,"",{config:{...i,bucket:s}});r&&(console.error(r.message),process.exit(1)),console.log(`Folder '${s}/${n}' created`),process.exit(0)}else{let r=e(t,["public"])?"public":e(t,["access","a","A"]),u=e(t,["enableSnapshots","enable-snapshots","s","S"]),m=e(t,["defaultTier","default-tier","t","T"]),a=e(t,["locations","l","L"]),l=e(t,["region","r","R"]),b=e(t,["consistency","c","C"]);l!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),a===void 0&&(a=l)),b!==void 0&&console.warn("Warning: --consistency is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/");let{error:d}=await h(s,{defaultTier:m??"STANDARD",enableSnapshot:u===!0,access:r??"private",locations:f(a??"global"),config:i});d&&(console.error(d.message),process.exit(1)),console.log(`Bucket '${s}' created`),process.exit(0)}}export{S as default};
package/dist/lib/mv.js CHANGED
@@ -1 +1 @@
1
- import{a as x}from"../chunk-CQCBYE3X.js";import{a as v}from"../chunk-JRALYIRA.js";import{a as F,b as y,d as S,g as C,h as I,i as j}from"../chunk-LCWHZUZZ.js";import{b as A}from"../chunk-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import*as N from"readline";import{get as B,put as T,remove as E,list as L,head as G}from"@tigrisdata/storage";async function D(i){let n=N.createInterface({input:process.stdin,output:process.stdout});return new Promise(a=>{n.question(`${i} (y/N): `,d=>{n.close(),a(d.toLowerCase()==="y")})})}async function H(i){let n=v(i,["src"]),a=v(i,["dest"]),d=v(i,["force","f","F"]),h=!!v(i,["recursive","r"]);(!n||!a)&&(console.error("both src and dest arguments are required"),process.exit(1)),(!F(n)||!F(a))&&(console.error("Both src and dest must be remote Tigris paths (t3:// or tigris://)"),process.exit(1));let e=y(n),t=y(a);e.bucket||(console.error("Invalid source path"),process.exit(1)),t.bucket||(console.error("Invalid destination path"),process.exit(1));let $=n.endsWith("/");!e.path&&!$&&(console.error("Cannot move a bucket. Provide a path within the bucket."),process.exit(1));let c=await A(),l=e.path.includes("*"),p=e.path.endsWith("/")||!e.path&&$;if(!l&&!p&&e.path&&(p=await S(e.bucket,e.path,c)),p&&!l&&!h&&(console.error("Source is a remote folder (not moved). Use -r to move recursively."),process.exit(1)),l||p){let r=l?I(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",o=!l&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",f=[t.path?.replace(/\/$/,"")||"",o].filter(Boolean).join("/"),z=f?`${f}/`:"";e.bucket===t.bucket&&r===z&&(console.error("Source and destination are the same"),process.exit(1));let{items:q,error:R}=await j(e.bucket,r||void 0,c);R&&(console.error(R.message),process.exit(1));let b=q.filter(s=>s.name!==r);if(l){let s=e.path.split("/").pop(),m=C(s);b=b.filter(g=>{let k=r?g.name.slice(r.length):g.name;return!h&&k.includes("/")?!1:m.test(k.split("/").pop())})}let{data:O}=await L({prefix:r,limit:1,config:{...c,bucket:e.bucket}}),P=r?O?.items?.some(s=>s.name===r):!1;if(b.length===0&&!P){console.log("No objects to move");return}let U=b.length+(P?1:0);if(!d&&!await D(`Are you sure you want to move ${U} object(s)?`)){console.log("Aborted");return}let w=0;for(let s of b){let m=r?s.name.slice(r.length):s.name,g=f?`${f}/${m}`:m,k=await W(c,e.bucket,s.name,t.bucket,g);k.error?console.error(`Failed to move ${s.name}: ${k.error}`):(console.log(`Moved t3://${e.bucket}/${s.name} -> t3://${t.bucket}/${g}`),w++)}let M=!1;if(P)if(f){let s=`${f}/`,m=await W(c,e.bucket,r,t.bucket,s);m.error?console.error(`Failed to move folder marker: ${m.error}`):M=!0}else{let{error:s}=await E(r,{config:{...c,bucket:e.bucket}});s?console.error(`Failed to remove source folder marker: ${s.message}`):M=!0}w===0&&M&&(w=1),console.log(`Moved ${w} object(s)`)}else{let r=e.path.split("/").pop(),o;if(t.path?t.path.endsWith("/")?o=`${t.path}${r}`:await S(t.bucket,t.path,c)?o=`${t.path}/${r}`:o=t.path:o=r,e.bucket===t.bucket&&e.path===o&&(console.error("Source and destination are the same"),process.exit(1)),!d&&!await D(`Are you sure you want to move 't3://${e.bucket}/${e.path}'?`)){console.log("Aborted");return}let u=await W(c,e.bucket,e.path,t.bucket,o,!0);u.error&&(console.error(u.error),process.exit(1)),console.log(`Moved t3://${e.bucket}/${e.path} -> t3://${t.bucket}/${o}`)}process.exit(0)}async function W(i,n,a,d,h,e=!1){if(a.endsWith("/")){let{error:o}=await T(h,"",{config:{...i,bucket:d}});if(o)return{error:o.message};let{error:u}=await E(a,{config:{...i,bucket:n}});return u?{error:`Copied but failed to delete source: ${u.message}`}:{}}let t;if(e){let{data:o}=await G(a,{config:{...i,bucket:n}});t=o?.size}let{data:$,error:c}=await B(a,"stream",{config:{...i,bucket:n}});if(c)return{error:c.message};let l=t!==void 0&&t>100*1024*1024,{error:p}=await T(h,$,{multipart:l,onUploadProgress:e?({loaded:o})=>{if(t!==void 0&&t>0){let u=Math.round(o/t*100);process.stdout.write(`\rMoving: ${x(o)} / ${x(t)} (${u}%)`)}else process.stdout.write(`\rMoving: ${x(o)}`)}:void 0,config:{...i,bucket:d}});if(e&&process.stdout.write("\r"+" ".repeat(60)+"\r"),p)return{error:p.message};let{error:r}=await E(a,{config:{...i,bucket:n}});return r?{error:`Copied but failed to delete source: ${r.message}`}:{}}export{H as default};
1
+ import{a as T}from"../chunk-EKW6XTGL.js";import{a as x}from"../chunk-CQCBYE3X.js";import{a as $}from"../chunk-JRALYIRA.js";import{a as M,b as y,d as S,g as A,h as I,i as j}from"../chunk-LCWHZUZZ.js";import{b as R}from"../chunk-VOQSWXBS.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import*as z from"readline";import{get as L,put as D,remove as C,list as G,head as H}from"@tigrisdata/storage";async function N(i){let a=z.createInterface({input:process.stdin,output:process.stdout});return new Promise(n=>{a.question(`${i} (y/N): `,p=>{a.close(),n(p.toLowerCase()==="y")})})}async function J(i){let a=$(i,["src"]),n=$(i,["dest"]),p=$(i,["force","f","F"]),g=!!$(i,["recursive","r"]);(!a||!n)&&(console.error("both src and dest arguments are required"),process.exit(1)),(!M(a)||!M(n))&&(console.error("Both src and dest must be remote Tigris paths (t3:// or tigris://)"),process.exit(1));let e=y(a),r=y(n);e.bucket||(console.error("Invalid source path"),process.exit(1)),r.bucket||(console.error("Invalid destination path"),process.exit(1));let f=a.endsWith("/");!e.path&&!f&&(console.error("Cannot move a bucket. Provide a path within the bucket."),process.exit(1));let c=await R({withCredentialProvider:!0}),l=e.path.includes("*"),m=e.path.endsWith("/")||!e.path&&f;if(!l&&!m&&e.path&&(m=await S(e.bucket,e.path,c)),m&&!l&&!g&&(console.error("Source is a remote folder (not moved). Use -r to move recursively."),process.exit(1)),l||m){let t=l?I(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",s=!l&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",d=[r.path?.replace(/\/$/,"")||"",s].filter(Boolean).join("/"),U=d?`${d}/`:"";e.bucket===r.bucket&&t===U&&(console.error("Source and destination are the same"),process.exit(1));let{items:q,error:E}=await j(e.bucket,t||void 0,c);E&&(console.error(E.message),process.exit(1));let b=q.filter(o=>o.name!==t);if(l){let o=e.path.split("/").pop(),h=A(o);b=b.filter(k=>{let v=t?k.name.slice(t.length):k.name;return!g&&v.includes("/")?!1:h.test(v.split("/").pop())})}let{data:O}=await G({prefix:t,limit:1,config:{...c,bucket:e.bucket}}),P=t?O?.items?.some(o=>o.name===t):!1;if(b.length===0&&!P){console.log("No objects to move");return}let B=b.length+(P?1:0);if(!p&&!await N(`Are you sure you want to move ${B} object(s)?`)){console.log("Aborted");return}let w=0;for(let o of b){let h=t?o.name.slice(t.length):o.name,k=d?`${d}/${h}`:h,v=await W(c,e.bucket,o.name,r.bucket,k);v.error?console.error(`Failed to move ${o.name}: ${v.error}`):(console.log(`Moved t3://${e.bucket}/${o.name} -> t3://${r.bucket}/${k}`),w++)}let F=!1;if(P)if(d){let o=`${d}/`,h=await W(c,e.bucket,t,r.bucket,o);h.error?console.error(`Failed to move folder marker: ${h.error}`):F=!0}else{let{error:o}=await C(t,{config:{...c,bucket:e.bucket}});o?console.error(`Failed to remove source folder marker: ${o.message}`):F=!0}w===0&&F&&(w=1),console.log(`Moved ${w} object(s)`)}else{let t=e.path.split("/").pop(),s;if(r.path?r.path.endsWith("/")?s=`${r.path}${t}`:await S(r.bucket,r.path,c)?s=`${r.path}/${t}`:s=r.path:s=t,e.bucket===r.bucket&&e.path===s&&(console.error("Source and destination are the same"),process.exit(1)),!p&&!await N(`Are you sure you want to move 't3://${e.bucket}/${e.path}'?`)){console.log("Aborted");return}let u=await W(c,e.bucket,e.path,r.bucket,s,!0);u.error&&(console.error(u.error),process.exit(1)),console.log(`Moved t3://${e.bucket}/${e.path} -> t3://${r.bucket}/${s}`)}process.exit(0)}async function W(i,a,n,p,g,e=!1){if(n.endsWith("/")){let{error:s}=await D(g,"",{config:{...i,bucket:p}});if(s)return{error:s.message};let{error:u}=await C(n,{config:{...i,bucket:a}});return u?{error:`Copied but failed to delete source: ${u.message}`}:{}}let{data:r}=await H(n,{config:{...i,bucket:a}}),f=r?.size,{data:c,error:l}=await L(n,"stream",{config:{...i,bucket:a}});if(l)return{error:l.message};let{error:m}=await D(g,c,{...T(f),onUploadProgress:e?({loaded:s})=>{if(f!==void 0&&f>0){let u=Math.round(s/f*100);process.stdout.write(`\rMoving: ${x(s)} / ${x(f)} (${u}%)`)}else process.stdout.write(`\rMoving: ${x(s)}`)}:void 0,config:{...i,bucket:p}});if(e&&process.stdout.write("\r"+" ".repeat(60)+"\r"),m)return{error:m.message};let{error:t}=await C(n,{config:{...i,bucket:a}});return t?{error:`Copied but failed to delete source: ${t.message}`}:{}}export{J as default};
@@ -1 +1 @@
1
- import{a as f,b as a,c as r,g}from"../../chunk-SYGTCM6P.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as m}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{remove as k}from"@tigrisdata/storage";var e=g("objects","delete");async function y(s){f(e);let n=i(s,["bucket"]),t=i(s,["key"]);n||(r(e,"Bucket name is required"),process.exit(1)),t||(r(e,"Object key is required"),process.exit(1));let p=await m(),u=Array.isArray(t)?t:[t];for(let o of u){let{error:c}=await k(o,{config:{...p,bucket:n}});c&&(r(e,c.message,{key:o}),process.exit(1)),a(e,{key:o})}}export{y as default};
1
+ import{a as f,b as a,c as r,g}from"../../chunk-SYGTCM6P.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as m}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{remove as k}from"@tigrisdata/storage";var e=g("objects","delete");async function y(s){f(e);let n=i(s,["bucket"]),t=i(s,["key"]);n||(r(e,"Bucket name is required"),process.exit(1)),t||(r(e,"Object key is required"),process.exit(1));let p=await m(),u=Array.isArray(t)?t:[t];for(let o of u){let{error:c}=await k(o,{config:{...p,bucket:n}});c&&(r(e,c.message,{key:o}),process.exit(1)),a(e,{key:o})}}export{y as default};
@@ -1 +1 @@
1
- import{a as p,b as n,c,g as f}from"../../chunk-SYGTCM6P.js";import{a as m}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createWriteStream as j,writeFileSync as k}from"fs";import{Readable as d}from"stream";import{pipeline as u}from"stream/promises";import{extname as w}from"path";import{get as h}from"@tigrisdata/storage";var e=f("objects","get"),S=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 y(r,o){let t=w(o||r).toLowerCase();return S.has(t)?"string":"stream"}async function q(r){p(e);let o=m(r,["bucket"]),s=m(r,["key"]),t=m(r,["output","o","O"]),x=m(r,["mode","m","M"]);o||(c(e,"Bucket name is required"),process.exit(1)),s||(c(e,"Object key is required"),process.exit(1));let g=await l();if((x||y(s,t))==="stream"){let{data:i,error:a}=await h(s,"stream",{config:{...g,bucket:o}});if(a&&(c(e,a.message),process.exit(1)),t){let b=j(t);await u(d.fromWeb(i),b),n(e,{key:s,output:t})}else await u(d.fromWeb(i),process.stdout),n(e)}else{let{data:i,error:a}=await h(s,"string",{config:{...g,bucket:o}});a&&(c(e,a.message),process.exit(1)),t?(k(t,i),n(e,{key:s,output:t})):(console.log(i),n(e))}}export{q as default};
1
+ import{a as p,b as n,c,g as f}from"../../chunk-SYGTCM6P.js";import{a as m}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createWriteStream as j,writeFileSync as k}from"fs";import{Readable as d}from"stream";import{pipeline as u}from"stream/promises";import{extname as w}from"path";import{get as h}from"@tigrisdata/storage";var e=f("objects","get"),S=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 y(r,o){let t=w(o||r).toLowerCase();return S.has(t)?"string":"stream"}async function q(r){p(e);let o=m(r,["bucket"]),s=m(r,["key"]),t=m(r,["output","o","O"]),x=m(r,["mode","m","M"]);o||(c(e,"Bucket name is required"),process.exit(1)),s||(c(e,"Object key is required"),process.exit(1));let g=await l();if((x||y(s,t))==="stream"){let{data:i,error:a}=await h(s,"stream",{config:{...g,bucket:o}});if(a&&(c(e,a.message),process.exit(1)),t){let b=j(t);await u(d.fromWeb(i),b),n(e,{key:s,output:t})}else await u(d.fromWeb(i),process.stdout),n(e)}else{let{data:i,error:a}=await h(s,"string",{config:{...g,bucket:o}});a&&(c(e,a.message),process.exit(1)),t?(k(t,i),n(e,{key:s,output:t})):(console.log(i),n(e))}}export{q as default};
@@ -1 +1 @@
1
- import{a,b as m,c as s,d as p,g as d}from"../../chunk-SYGTCM6P.js";import{a as g,f as l}from"../../chunk-CQCBYE3X.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as u}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{list as h}from"@tigrisdata/storage";var t=d("objects","list");async function j(i){a(t);let n=e(i,["bucket"]),k=e(i,["prefix","p","P"]),b=e(i,["format","f","F"],"table");n||(s(t,"Bucket name is required"),process.exit(1));let y=await u(),{data:o,error:c}=await h({prefix:k||void 0,config:{...y,bucket:n}});if(c&&(s(t,c.message),process.exit(1)),!o.items||o.items.length===0){p(t);return}let f=o.items.map(r=>({key:r.name,size:g(r.size),modified:r.lastModified})),x=l(f,b,"objects","object",[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}]);console.log(x),m(t,{count:f.length})}export{j as default};
1
+ import{a,b as m,c as s,d as p,g as d}from"../../chunk-SYGTCM6P.js";import{a as g,f as l}from"../../chunk-CQCBYE3X.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as u}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{list as h}from"@tigrisdata/storage";var t=d("objects","list");async function j(i){a(t);let n=e(i,["bucket"]),k=e(i,["prefix","p","P"]),b=e(i,["format","f","F"],"table");n||(s(t,"Bucket name is required"),process.exit(1));let y=await u(),{data:o,error:c}=await h({prefix:k||void 0,config:{...y,bucket:n}});if(c&&(s(t,c.message),process.exit(1)),!o.items||o.items.length===0){p(t);return}let f=o.items.map(r=>({key:r.name,size:g(r.size),modified:r.lastModified})),x=l(f,b,"objects","object",[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}]);console.log(x),m(t,{count:f.length})}export{j as default};
@@ -1 +1 @@
1
- import{a as g,b,c as o,g as y}from"../../chunk-SYGTCM6P.js";import{a as n,f as h}from"../../chunk-CQCBYE3X.js";import{a as t}from"../../chunk-JRALYIRA.js";import{b as S}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createReadStream as q,statSync as F}from"fs";import{Readable as k}from"stream";import{put as O}from"@tigrisdata/storage";var i=y("objects","put");async function v(r){g(i);let p=t(r,["bucket"]),d=t(r,["key"]),s=t(r,["file"]),z=t(r,["access","a","A"],"private"),T=t(r,["content-type","contentType","t","T"]),x=t(r,["format","f","F"],"table");p||(o(i,"Bucket name is required"),process.exit(1)),d||(o(i,"Object key is required"),process.exit(1));let w=!process.stdin.isTTY;!s&&!w&&(o(i,"File path is required (or pipe data via stdin)"),process.exit(1));let f,e;if(s){try{e=F(s).size}catch{o(i,`File not found: ${s}`),process.exit(1)}let c=q(s);f=k.toWeb(c)}else f=k.toWeb(process.stdin);let R=await S(),u=!s||e!==void 0&&e>16*1024*1024,{data:a,error:m}=await O(d,f,{access:z==="public"?"public":"private",contentType:T,multipart:u,partSize:u?16*1024*1024:void 0,queueSize:u?8:void 0,onUploadProgress:({loaded:c,percentage:l})=>{e!==void 0&&e>0?process.stdout.write(`\rUploading: ${n(c)} / ${n(e)} (${l}%)`):process.stdout.write(`\rUploading: ${n(c)}`)},config:{...R,bucket:p}});process.stdout.write("\r"+" ".repeat(60)+"\r"),m&&(o(i,m.message),process.exit(1));let j=[{path:a.path,size:n(a.size??e??0),contentType:a.contentType||"-",modified:a.modified}],$=h(j,x,"objects","object",[{key:"path",header:"Path"},{key:"size",header:"Size"},{key:"contentType",header:"Content-Type"},{key:"modified",header:"Modified"}]);console.log($),b(i,{key:d,bucket:p})}export{v as default};
1
+ import{a as l,b as g,c as o,g as b}from"../../chunk-SYGTCM6P.js";import{a as h}from"../../chunk-EKW6XTGL.js";import{a,f as S}from"../../chunk-CQCBYE3X.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as y}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createReadStream as q,statSync as v}from"fs";import{Readable as k}from"stream";import{put as F}from"@tigrisdata/storage";var t=b("objects","put");async function O(r){l(t);let p=e(r,["bucket"]),d=e(r,["key"]),i=e(r,["file"]),z=e(r,["access","a","A"],"private"),T=e(r,["content-type","contentType","t","T"]),w=e(r,["format","f","F"],"table");p||(o(t,"Bucket name is required"),process.exit(1)),d||(o(t,"Object key is required"),process.exit(1));let x=!process.stdin.isTTY;!i&&!x&&(o(t,"File path is required (or pipe data via stdin)"),process.exit(1));let f,s;if(i){try{s=v(i).size}catch{o(t,`File not found: ${i}`),process.exit(1)}let c=q(i);f=k.toWeb(c)}else f=k.toWeb(process.stdin);let R=await y({withCredentialProvider:!0}),j=i?h(s):{multipart:!0,partSize:5*1024*1024,queueSize:8},{data:n,error:m}=await F(d,f,{access:z==="public"?"public":"private",contentType:T,...j,onUploadProgress:({loaded:c,percentage:u})=>{s!==void 0&&s>0?process.stdout.write(`\rUploading: ${a(c)} / ${a(s)} (${u}%)`):process.stdout.write(`\rUploading: ${a(c)}`)},config:{...R,bucket:p}});process.stdout.write("\r"+" ".repeat(60)+"\r"),m&&(o(t,m.message),process.exit(1));let P=[{path:n.path,size:a(n.size??s??0),contentType:n.contentType||"-",modified:n.modified}],$=S(P,w,"objects","object",[{key:"path",header:"Path"},{key:"size",header:"Size"},{key:"contentType",header:"Content-Type"},{key:"modified",header:"Modified"}]);console.log($),g(t,{key:d,bucket:p})}export{O as default};
@@ -1 +1 @@
1
- import{a as p,b as u,c as t,g as f}from"../../chunk-SYGTCM6P.js";import{a as c}from"../../chunk-JRALYIRA.js";import{b as g}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{updateObject as b}from"@tigrisdata/storage";var e=f("objects","set");async function k(s){p(e);let i=c(s,["bucket"]),r=c(s,["key"]),n=c(s,["access","a","A"]),o=c(s,["new-key","n","newKey"]);i||(t(e,"Bucket name is required"),process.exit(1)),r||(t(e,"Object key is required"),process.exit(1)),n||(t(e,"Access level is required (--access public|private)"),process.exit(1));let m=await g(),{error:a}=await b(r,{access:n==="public"?"public":"private",...o&&{key:o},config:{...m,bucket:i}});a&&(t(e,a.message),process.exit(1)),u(e,{key:r,bucket:i})}export{k as default};
1
+ import{a as p,b as u,c as t,g as f}from"../../chunk-SYGTCM6P.js";import{a as c}from"../../chunk-JRALYIRA.js";import{b as g}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{updateObject as b}from"@tigrisdata/storage";var e=f("objects","set");async function k(s){p(e);let i=c(s,["bucket"]),r=c(s,["key"]),n=c(s,["access","a","A"]),o=c(s,["new-key","n","newKey"]);i||(t(e,"Bucket name is required"),process.exit(1)),r||(t(e,"Object key is required"),process.exit(1)),n||(t(e,"Access level is required (--access public|private)"),process.exit(1));let m=await g(),{error:a}=await b(r,{access:n==="public"?"public":"private",...o&&{key:o},config:{...m,bucket:i}});a&&(t(e,a.message),process.exit(1)),u(e,{key:r,bucket:i})}export{k as default};
@@ -1,4 +1,4 @@
1
- import{a as g,b as c,c as t,f as l,g as u}from"../../chunk-SYGTCM6P.js";import{a as f}from"../../chunk-JRALYIRA.js";import{b as m}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as e,k as r,s as a}from"../../chunk-DOUR5YEY.js";import{a as s}from"../../chunk-GZ7JBHFT.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createOrganization as O}from"@tigrisdata/iam";var i=u("organizations","create");async function w(d){if(g(i),a()!=="oauth"){r()?console.log(`You are using access key credentials, which belong to a single organization.
1
+ import{a as g,b as c,c as t,f as l,g as u}from"../../chunk-SYGTCM6P.js";import{a as f}from"../../chunk-JRALYIRA.js";import{b as m}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as e,k as r,s as a}from"../../chunk-DOUR5YEY.js";import{a as s}from"../../chunk-GZ7JBHFT.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createOrganization as O}from"@tigrisdata/iam";var i=u("organizations","create");async function w(d){if(g(i),a()!=="oauth"){r()?console.log(`You are using access key credentials, which belong to a single organization.
2
2
  Organization creation is only available with OAuth login.
3
3
 
4
4
  Run "tigris login" to login with your Tigris account.`):console.log('Not authenticated. Please run "tigris login" to login with your Tigris account.');return}let p=e();if(s(p??void 0)){console.log(`Organization creation is not available for Fly.io users.
@@ -1,4 +1,4 @@
1
- import{a as O,b as r,c as k,d as S,g as C}from"../../chunk-SYGTCM6P.js";import{f as I}from"../../chunk-CQCBYE3X.js";import{a as F}from"../../chunk-JRALYIRA.js";import{b as x}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as z}from"../../chunk-E4MLGABW.js";import{f as u,g as f,k as p,s as h}from"../../chunk-DOUR5YEY.js";import{a as w,b as y}from"../../chunk-GZ7JBHFT.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listOrganizations as b}from"@tigrisdata/iam";import E from"enquirer";var i=C("organizations","list");async function N(T){if(O(i),h()!=="oauth"){p()?console.log(`You are using access key credentials, which belong to a single organization.
1
+ import{a as O,b as r,c as k,d as S,g as C}from"../../chunk-SYGTCM6P.js";import{f as I}from"../../chunk-CQCBYE3X.js";import{a as F}from"../../chunk-JRALYIRA.js";import{b as x}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as z}from"../../chunk-E4MLGABW.js";import{f as u,g as f,k as p,s as h}from"../../chunk-DOUR5YEY.js";import{a as w,b as y}from"../../chunk-GZ7JBHFT.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listOrganizations as b}from"@tigrisdata/iam";import E from"enquirer";var i=C("organizations","list");async function N(T){if(O(i),h()!=="oauth"){p()?console.log(`You are using access key credentials, which belong to a single organization.
2
2
  Organization listing and selection is only available with OAuth login.
3
3
 
4
4
  Run "tigris login" to login with your Tigris account.`):console.log('Not authenticated. Please run "tigris login" to login with your Tigris account.');return}let c=F(T,["format","f","F"],"select"),A=await z().getAccessToken(),a=await y(A),M=a?.some(t=>w(t.id))??!1,n;if(M&&a)n=a.map(t=>({id:t.id,name:t.name,slug:t.name}));else{let t=await x(),{data:l,error:s}=await b({config:t});s&&(k(i,s.message),process.exit(1)),n=l?.organizations??[]}if(n.length===0){S(i);return}let o=f();if(c==="select"){let t=n.map(e=>({name:e.id,message:`${e.name} (${e.id})`,hint:e.id===o?"currently selected":void 0})),m=(await E.prompt({type:"select",name:"organization",message:"Select an organization:",choices:t.map(e=>e.message),initial:o?n.findIndex(e=>e.id===o):0})).organization.match(/\(([^)]+)\)$/),d=m?m[1]:n[0].id;await u(d);let $=n.find(e=>e.id===d);r(i,{name:$?.name});return}let g=n.map(t=>({id:t.id,name:t.name,slug:t.slug,selected:t.id===o?"*":""})),U=I(g,c,"organizations","organization",[{key:"selected",header:" ",width:1},{key:"id",header:"ID"},{key:"name",header:"Name"},{key:"slug",header:"Slug"}]);console.log(U),r(i,{count:g.length})}export{N as default};
@@ -1,4 +1,4 @@
1
- import{a as m,b as u,c as t,g as d}from"../../chunk-SYGTCM6P.js";import{a as p}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{f as g,k as c,s as l}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listOrganizations as O}from"@tigrisdata/iam";var i=d("organizations","select");async function x(h){if(m(i),l()!=="oauth"){c()?console.log(`You are using access key credentials, which belong to a single organization.
1
+ import{a as m,b as u,c as t,g as d}from"../../chunk-SYGTCM6P.js";import{a as p}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{f as g,k as c,s as l}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listOrganizations as O}from"@tigrisdata/iam";var i=d("organizations","select");async function x(h){if(m(i),l()!=="oauth"){c()?console.log(`You are using access key credentials, which belong to a single organization.
2
2
  Organization selection is only available with OAuth login.
3
3
 
4
4
  Run "tigris login" to login with your Tigris account.`):console.log('Not authenticated. Please run "tigris login" to login with your Tigris account.');return}let n=p(h,["name","N"]);n||(t(i,"Organization name or ID is required"),process.exit(1));let z=await f(),{data:w,error:a}=await O({config:z});a&&(t(i,a.message),process.exit(1));let r=w?.organizations??[],e=r.find(o=>o.id===n||o.name===n);if(!e){let o=r.map(s=>` - ${s.name} (${s.id})`).join(`
@@ -1 +1 @@
1
- import{b as K}from"../chunk-CQCBYE3X.js";import{a as n}from"../chunk-JRALYIRA.js";import{f as k}from"../chunk-LCWHZUZZ.js";import{a as u,b as h}from"../chunk-USCKVLDO.js";import{b as y}from"../chunk-E4MLGABW.js";import{g as p}from"../chunk-DOUR5YEY.js";import{c as d}from"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{getPresignedUrl as x}from"@tigrisdata/storage";import{listAccessKeys as w}from"@tigrisdata/iam";import I from"enquirer";var{prompt:A}=I;async function P(t){let m=n(t,["path"]);m||(console.error("path argument is required"),process.exit(1));let{bucket:o,path:a}=k(m);o||(console.error("Invalid path"),process.exit(1)),a||(console.error("Object key is required"),process.exit(1));let l=n(t,["method","m"])??"get",i=parseInt(n(t,["expires-in","expiresIn","e"])??"3600",10),f=n(t,["format","f"])??"url",g=n(t,["access-key","accessKey"]),s=await h(),r;g?r=g:s.accessKeyId?r=s.accessKeyId:(await u()!=="oauth"&&(console.error("Presigning requires an access key. Pass --access-key or configure credentials."),process.exit(1)),r=await v(o)),r||(console.error("Presigning requires an access key. Pass --access-key or configure credentials."),process.exit(1));let{data:e,error:c}=await x(a,{method:l,expiresIn:i,accessKeyId:r,config:{...s,bucket:o}});c&&(console.error(c.message),process.exit(1)),console.log(f==="json"?K({url:e.url,expiresIn:e.expiresIn,method:l,bucket:o,key:a}):e.url),process.exit(0)}async function v(t){process.stdin.isTTY||(console.error("Presigning requires an access key. Pass --access-key tid_..."),process.exit(1));let o=await y().getAccessToken(),a=p(),l=d(),{data:i,error:f}=await w({config:{sessionToken:o,organizationId:a??void 0,iamEndpoint:l.iamEndpoint}});f&&(console.error(`Failed to list access keys: ${f.message}`),process.exit(1)),(!i.accessKeys||i.accessKeys.length===0)&&(console.error('No access keys found. Create one with "tigris access-keys create <name>"'),process.exit(1));let g=i.accessKeys.filter(e=>e.status==="active"&&e.roles?.some(c=>c.bucket===t||c.bucket==="*")),s;if(g.length>0)s=g;else{let e=i.accessKeys.filter(c=>c.status==="active");e.length===0&&(console.error('No active access keys found. Create one with "tigris access-keys create <name>"'),process.exit(1)),console.error(`No access keys with explicit access to bucket "${t}" found. Showing all active keys.`),s=e}if(s.length===1)return console.error(`Using access key: ${s[0].name} (${s[0].id})`),s[0].id;let{selectedKey:r}=await A({type:"select",name:"selectedKey",message:"Select an access key for presigning:",choices:s.map(e=>({name:e.id,message:`${e.name} (${e.id})`}))});return r}export{P as default};
1
+ import{b as K}from"../chunk-CQCBYE3X.js";import{a as n}from"../chunk-JRALYIRA.js";import{f as k}from"../chunk-LCWHZUZZ.js";import{a as u,b as h}from"../chunk-VOQSWXBS.js";import{b as y}from"../chunk-E4MLGABW.js";import{g as p}from"../chunk-DOUR5YEY.js";import{c as d}from"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{getPresignedUrl as x}from"@tigrisdata/storage";import{listAccessKeys as w}from"@tigrisdata/iam";import I from"enquirer";var{prompt:A}=I;async function P(t){let m=n(t,["path"]);m||(console.error("path argument is required"),process.exit(1));let{bucket:o,path:a}=k(m);o||(console.error("Invalid path"),process.exit(1)),a||(console.error("Object key is required"),process.exit(1));let l=n(t,["method","m"])??"get",i=parseInt(n(t,["expires-in","expiresIn","e"])??"3600",10),f=n(t,["format","f"])??"url",g=n(t,["access-key","accessKey"]),s=await h(),r;g?r=g:s.accessKeyId?r=s.accessKeyId:(await u()!=="oauth"&&(console.error("Presigning requires an access key. Pass --access-key or configure credentials."),process.exit(1)),r=await v(o)),r||(console.error("Presigning requires an access key. Pass --access-key or configure credentials."),process.exit(1));let{data:e,error:c}=await x(a,{method:l,expiresIn:i,accessKeyId:r,config:{...s,bucket:o}});c&&(console.error(c.message),process.exit(1)),console.log(f==="json"?K({url:e.url,expiresIn:e.expiresIn,method:l,bucket:o,key:a}):e.url),process.exit(0)}async function v(t){process.stdin.isTTY||(console.error("Presigning requires an access key. Pass --access-key tid_..."),process.exit(1));let o=await y().getAccessToken(),a=p(),l=d(),{data:i,error:f}=await w({config:{sessionToken:o,organizationId:a??void 0,iamEndpoint:l.iamEndpoint}});f&&(console.error(`Failed to list access keys: ${f.message}`),process.exit(1)),(!i.accessKeys||i.accessKeys.length===0)&&(console.error('No access keys found. Create one with "tigris access-keys create <name>"'),process.exit(1));let g=i.accessKeys.filter(e=>e.status==="active"&&e.roles?.some(c=>c.bucket===t||c.bucket==="*")),s;if(g.length>0)s=g;else{let e=i.accessKeys.filter(c=>c.status==="active");e.length===0&&(console.error('No active access keys found. Create one with "tigris access-keys create <name>"'),process.exit(1)),console.error(`No access keys with explicit access to bucket "${t}" found. Showing all active keys.`),s=e}if(s.length===1)return console.error(`Using access key: ${s[0].name} (${s[0].id})`),s[0].id;let{selectedKey:r}=await A({type:"select",name:"selectedKey",message:"Select an access key for presigning:",choices:s.map(e=>({name:e.id,message:`${e.name} (${e.id})`}))});return r}export{P as default};
package/dist/lib/rm.js CHANGED
@@ -1 +1 @@
1
- import{a as g}from"../chunk-JRALYIRA.js";import{a as A,b as F,d as I,g as S,h as W,i as j}from"../chunk-LCWHZUZZ.js";import{b as P}from"../chunk-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import*as E from"readline";import{remove as w,removeBucket as T,list as q}from"@tigrisdata/storage";async function $(l){let s=E.createInterface({input:process.stdin,output:process.stdout});return new Promise(m=>{s.question(`${l} (y/N): `,d=>{s.close(),m(d.toLowerCase()==="y")})})}async function C(l){let s=g(l,["path"]),m=g(l,["force","f","F"]),d=!!g(l,["recursive","r"]);s||(console.error("path argument is required"),process.exit(1)),A(s)||(console.error("Path must be a remote Tigris path (t3:// or tigris://)"),process.exit(1));let{bucket:e,path:o}=F(s);e||(console.error("Invalid path"),process.exit(1));let i=await P(),b=s.endsWith("/");if(!o&&!b){if(!m&&!await $(`Are you sure you want to delete bucket '${e}'?`)){console.log("Aborted");return}let{error:t}=await T(e,{config:i});t&&(console.error(t.message),process.exit(1)),console.log(`Removed bucket '${e}'`);return}let n=o.includes("*"),u=o.endsWith("/")||!o&&b;if(!n&&!u&&(u=await I(e,o,i)),u&&!n&&!d&&(console.error("Source is a remote folder (not removed). Use -r to remove recursively."),process.exit(1)),n||u){let t=n?W(o):o?o.endsWith("/")?o:`${o}/`:"",{items:p,error:x}=await j(e,t||void 0,i);x&&(console.error(x.message),process.exit(1));let f=p;if(n){let r=o.split("/").pop(),a=S(r);f=f.filter(R=>{let k=t?R.name.slice(t.length):R.name;return!d&&k.includes("/")?!1:a.test(k.split("/").pop())})}let c=t,M=f.some(r=>r.name===c),v=!1;if(!M&&!n){let{data:r}=await q({prefix:c,limit:1,config:{...i,bucket:e}});v=r?.items?.some(a=>a.name===c)||!1}let y=f.length+(v?1:0);if(y===0){console.log("No objects to remove");return}if(!m&&!await $(`Are you sure you want to delete ${y} object(s)?`)){console.log("Aborted");return}let h=0;for(let r of f){let{error:a}=await w(r.name,{config:{...i,bucket:e}});a?console.error(`Failed to remove ${r.name}: ${a.message}`):(console.log(`Removed t3://${e}/${r.name}`),h++)}if(v){let{error:r}=await w(c,{config:{...i,bucket:e}});r?console.error(`Failed to remove ${c}: ${r.message}`):(console.log(`Removed t3://${e}/${c}`),h++)}console.log(`Removed ${h} object(s)`)}else{if(!m&&!await $(`Are you sure you want to delete 't3://${e}/${o}'?`)){console.log("Aborted");return}let{error:t}=await w(o,{config:{...i,bucket:e}});t&&(console.error(t.message),process.exit(1)),console.log(`Removed t3://${e}/${o}`)}process.exit(0)}export{C as default};
1
+ import{a as g}from"../chunk-JRALYIRA.js";import{a as A,b as F,d as I,g as S,h as W,i as j}from"../chunk-LCWHZUZZ.js";import{b as P}from"../chunk-VOQSWXBS.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import*as E from"readline";import{remove as w,removeBucket as T,list as q}from"@tigrisdata/storage";async function $(l){let s=E.createInterface({input:process.stdin,output:process.stdout});return new Promise(m=>{s.question(`${l} (y/N): `,d=>{s.close(),m(d.toLowerCase()==="y")})})}async function C(l){let s=g(l,["path"]),m=g(l,["force","f","F"]),d=!!g(l,["recursive","r"]);s||(console.error("path argument is required"),process.exit(1)),A(s)||(console.error("Path must be a remote Tigris path (t3:// or tigris://)"),process.exit(1));let{bucket:e,path:o}=F(s);e||(console.error("Invalid path"),process.exit(1));let i=await P(),b=s.endsWith("/");if(!o&&!b){if(!m&&!await $(`Are you sure you want to delete bucket '${e}'?`)){console.log("Aborted");return}let{error:t}=await T(e,{config:i});t&&(console.error(t.message),process.exit(1)),console.log(`Removed bucket '${e}'`);return}let n=o.includes("*"),u=o.endsWith("/")||!o&&b;if(!n&&!u&&(u=await I(e,o,i)),u&&!n&&!d&&(console.error("Source is a remote folder (not removed). Use -r to remove recursively."),process.exit(1)),n||u){let t=n?W(o):o?o.endsWith("/")?o:`${o}/`:"",{items:p,error:x}=await j(e,t||void 0,i);x&&(console.error(x.message),process.exit(1));let f=p;if(n){let r=o.split("/").pop(),a=S(r);f=f.filter(R=>{let k=t?R.name.slice(t.length):R.name;return!d&&k.includes("/")?!1:a.test(k.split("/").pop())})}let c=t,M=f.some(r=>r.name===c),v=!1;if(!M&&!n){let{data:r}=await q({prefix:c,limit:1,config:{...i,bucket:e}});v=r?.items?.some(a=>a.name===c)||!1}let y=f.length+(v?1:0);if(y===0){console.log("No objects to remove");return}if(!m&&!await $(`Are you sure you want to delete ${y} object(s)?`)){console.log("Aborted");return}let h=0;for(let r of f){let{error:a}=await w(r.name,{config:{...i,bucket:e}});a?console.error(`Failed to remove ${r.name}: ${a.message}`):(console.log(`Removed t3://${e}/${r.name}`),h++)}if(v){let{error:r}=await w(c,{config:{...i,bucket:e}});r?console.error(`Failed to remove ${c}: ${r.message}`):(console.log(`Removed t3://${e}/${c}`),h++)}console.log(`Removed ${h} object(s)`)}else{if(!m&&!await $(`Are you sure you want to delete 't3://${e}/${o}'?`)){console.log("Aborted");return}let{error:t}=await w(o,{config:{...i,bucket:e}});t&&(console.error(t.message),process.exit(1)),console.log(`Removed t3://${e}/${o}`)}process.exit(0)}export{C as default};
@@ -1 +1 @@
1
- import{a as c,b as p,c as o,d as f,g as u}from"../../chunk-SYGTCM6P.js";import{f as d}from"../../chunk-CQCBYE3X.js";import{a as n}from"../../chunk-JRALYIRA.js";import{b as g}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBucketSnapshots as y}from"@tigrisdata/storage";var t=u("snapshots","list");async function x(s){c(t);let a=n(s,["name"]),l=n(s,["format","f","F"],"table");a||(o(t,"Bucket name is required"),process.exit(1));let h=await g(),{data:e,error:i}=await y(a,{config:h});if(i&&(o(t,i.message),process.exit(1)),!e||e.length===0){f(t);return}let m=e.map(r=>({name:r.name||"",version:r.version||"",created:r.creationDate})),k=d(m,l,"snapshots","snapshot",[{key:"name",header:"Name"},{key:"version",header:"Version"},{key:"created",header:"Created"}]);console.log(k),p(t,{count:m.length})}export{x as default};
1
+ import{a as c,b as p,c as o,d as f,g as u}from"../../chunk-SYGTCM6P.js";import{f as d}from"../../chunk-CQCBYE3X.js";import{a as n}from"../../chunk-JRALYIRA.js";import{b as g}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBucketSnapshots as y}from"@tigrisdata/storage";var t=u("snapshots","list");async function x(s){c(t);let a=n(s,["name"]),l=n(s,["format","f","F"],"table");a||(o(t,"Bucket name is required"),process.exit(1));let h=await g(),{data:e,error:i}=await y(a,{config:h});if(i&&(o(t,i.message),process.exit(1)),!e||e.length===0){f(t);return}let m=e.map(r=>({name:r.name||"",version:r.version||"",created:r.creationDate})),k=d(m,l,"snapshots","snapshot",[{key:"name",header:"Name"},{key:"version",header:"Version"},{key:"created",header:"Created"}]);console.log(k),p(t,{count:m.length})}export{x as default};
@@ -1 +1 @@
1
- import{a as m,b as p,c as n,g as c}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createBucketSnapshot as h}from"@tigrisdata/storage";var t=c("snapshots","take");async function u(o){m(t);let s=e(o,["name"]),a=e(o,["snapshot-name","snapshotName"]);s||(n(t,"Bucket name is required"),process.exit(1));let g=await f(),{data:r,error:i}=await h(s,{name:a,config:g});i&&(n(t,i.message),process.exit(1)),p(t,{name:s,snapshotName:a||r?.snapshotVersion,version:r?.snapshotVersion})}export{u as default};
1
+ import{a as m,b as p,c as n,g as c}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createBucketSnapshot as h}from"@tigrisdata/storage";var t=c("snapshots","take");async function u(o){m(t);let s=e(o,["name"]),a=e(o,["snapshot-name","snapshotName"]);s||(n(t,"Bucket name is required"),process.exit(1));let g=await f(),{data:r,error:i}=await h(s,{name:a,config:g});i&&(n(t,i.message),process.exit(1)),p(t,{name:s,snapshotName:a||r?.snapshotVersion,version:r?.snapshotVersion})}export{u as default};
package/dist/lib/stat.js CHANGED
@@ -1 +1 @@
1
- import{a as v,b as c,c as s,g as b}from"../chunk-SYGTCM6P.js";import{a as l,f as u}from"../chunk-CQCBYE3X.js";import{f as k}from"../chunk-LCWHZUZZ.js";import{b as S}from"../chunk-USCKVLDO.js";import"../chunk-BETAO4PB.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{getStats as j,getBucketInfo as y,head as I}from"@tigrisdata/storage";var e=b("stat");async function x(f){v(e);let d=f.path||f._positional?.[0],m=f.format||"table",p=await S();if(!d){let{data:t,error:a}=await j({config:p});a&&(s(e,a.message),process.exit(1));let r=[{metric:"Active Buckets",value:String(t.stats.activeBuckets)},{metric:"Total Objects",value:String(t.stats.totalObjects)},{metric:"Total Unique Objects",value:String(t.stats.totalUniqueObjects)},{metric:"Total Storage",value:l(t.stats.totalStorageBytes)}],g=u(r,m,"stats","stat",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(g),c(e),process.exit(0)}let{bucket:i,path:n}=k(d);if(i||(s(e,"Invalid path"),process.exit(1)),!n||n==="/"){let{data:t,error:a}=await y(i,{config:p});a&&(s(e,a.message),process.exit(1));let r=[{metric:"Number of Objects",value:t.sizeInfo.numberOfObjects?.toString()??"N/A"},{metric:"Total Size",value:t.sizeInfo.size!==void 0?l(t.sizeInfo.size):"N/A"},{metric:"All Versions Count",value:t.sizeInfo.numberOfObjectsAllVersions?.toString()??"N/A"},{metric:"Snapshots Enabled",value:t.isSnapshotEnabled?"Yes":"No"},{metric:"Default Tier",value:t.settings.defaultTier},{metric:"Allow Object ACL",value:t.settings.allowObjectAcl?"Yes":"No"},{metric:"Has Forks",value:t.forkInfo?.hasChildren?"Yes":"No"}];t.forkInfo?.parents?.length&&(r.push({metric:"Forked From",value:t.forkInfo.parents[0].bucketName}),r.push({metric:"Fork Snapshot",value:t.forkInfo.parents[0].snapshot}));let g=u(r,m,"bucket-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(g),c(e,{bucket:i}),process.exit(0)}let{data:o,error:h}=await I(n,{config:{...p,bucket:i}});h&&(s(e,h.message),process.exit(1)),o||(s(e,"Object not found"),process.exit(1));let O=[{metric:"Path",value:o.path},{metric:"Size",value:l(o.size)},{metric:"Content-Type",value:o.contentType||"N/A"},{metric:"Content-Disposition",value:o.contentDisposition||"N/A"},{metric:"Modified",value:o.modified.toISOString()}],A=u(O,m,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(A),c(e,{bucket:i,path:n}),process.exit(0)}export{x as default};
1
+ import{a as v,b as c,c as s,g as b}from"../chunk-SYGTCM6P.js";import{a as l,f as u}from"../chunk-CQCBYE3X.js";import{f as k}from"../chunk-LCWHZUZZ.js";import{b as S}from"../chunk-VOQSWXBS.js";import"../chunk-BETAO4PB.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{getStats as j,getBucketInfo as y,head as I}from"@tigrisdata/storage";var e=b("stat");async function x(f){v(e);let d=f.path||f._positional?.[0],m=f.format||"table",p=await S();if(!d){let{data:t,error:a}=await j({config:p});a&&(s(e,a.message),process.exit(1));let r=[{metric:"Active Buckets",value:String(t.stats.activeBuckets)},{metric:"Total Objects",value:String(t.stats.totalObjects)},{metric:"Total Unique Objects",value:String(t.stats.totalUniqueObjects)},{metric:"Total Storage",value:l(t.stats.totalStorageBytes)}],g=u(r,m,"stats","stat",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(g),c(e),process.exit(0)}let{bucket:i,path:n}=k(d);if(i||(s(e,"Invalid path"),process.exit(1)),!n||n==="/"){let{data:t,error:a}=await y(i,{config:p});a&&(s(e,a.message),process.exit(1));let r=[{metric:"Number of Objects",value:t.sizeInfo.numberOfObjects?.toString()??"N/A"},{metric:"Total Size",value:t.sizeInfo.size!==void 0?l(t.sizeInfo.size):"N/A"},{metric:"All Versions Count",value:t.sizeInfo.numberOfObjectsAllVersions?.toString()??"N/A"},{metric:"Snapshots Enabled",value:t.isSnapshotEnabled?"Yes":"No"},{metric:"Default Tier",value:t.settings.defaultTier},{metric:"Allow Object ACL",value:t.settings.allowObjectAcl?"Yes":"No"},{metric:"Has Forks",value:t.forkInfo?.hasChildren?"Yes":"No"}];t.forkInfo?.parents?.length&&(r.push({metric:"Forked From",value:t.forkInfo.parents[0].bucketName}),r.push({metric:"Fork Snapshot",value:t.forkInfo.parents[0].snapshot}));let g=u(r,m,"bucket-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(g),c(e,{bucket:i}),process.exit(0)}let{data:o,error:h}=await I(n,{config:{...p,bucket:i}});h&&(s(e,h.message),process.exit(1)),o||(s(e,"Object not found"),process.exit(1));let O=[{metric:"Path",value:o.path},{metric:"Size",value:l(o.size)},{metric:"Content-Type",value:o.contentType||"N/A"},{metric:"Content-Disposition",value:o.contentDisposition||"N/A"},{metric:"Modified",value:o.modified.toISOString()}],A=u(O,m,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(A),c(e,{bucket:i,path:n}),process.exit(0)}export{x as default};
package/dist/lib/touch.js CHANGED
@@ -1 +1 @@
1
- import{a as n}from"../chunk-JRALYIRA.js";import{f as i}from"../chunk-LCWHZUZZ.js";import{b as s}from"../chunk-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{put as p}from"@tigrisdata/storage";async function f(c){let r=n(c,["path"]);r||(console.error("path argument is required"),process.exit(1));let{bucket:o,path:e}=i(r);o||(console.error("Invalid path"),process.exit(1)),e||(console.error("Object key is required (use mk to create buckets)"),process.exit(1));let a=await s(),{error:t}=await p(e,"",{config:{...a,bucket:o}});t&&(console.error(t.message),process.exit(1)),console.log(`Created '${o}/${e}'`),process.exit(0)}export{f as default};
1
+ import{a as n}from"../chunk-JRALYIRA.js";import{f as i}from"../chunk-LCWHZUZZ.js";import{b as s}from"../chunk-VOQSWXBS.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{put as p}from"@tigrisdata/storage";async function f(c){let r=n(c,["path"]);r||(console.error("path argument is required"),process.exit(1));let{bucket:o,path:e}=i(r);o||(console.error("Invalid path"),process.exit(1)),e||(console.error("Object key is required (use mk to create buckets)"),process.exit(1));let a=await s(),{error:t}=await p(e,"",{config:{...a,bucket:o}});t&&(console.error(t.message),process.exit(1)),console.log(`Created '${o}/${e}'`),process.exit(0)}export{f as default};
@@ -1,2 +1,2 @@
1
- import{c,e as h,g as O}from"../chunk-SYGTCM6P.js";import{b as $}from"../chunk-USCKVLDO.js";import"../chunk-BETAO4PB.js";import{b as z}from"../chunk-E4MLGABW.js";import{g as f,k as p,s as A}from"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{listOrganizations as C}from"@tigrisdata/iam";var s=O("whoami");async function y(){try{let i=A(),d=p(),l,u;if(i==="oauth"){let n=z();if(!await n.isAuthenticated()){h(s);return}let a=await n.getIdTokenClaims();l=a.email,u=a.sub}else if(d)l=void 0,u=d.accessKeyId;else{h(s);return}let e=[];if(e.push(""),e.push("User Information:"),e.push(` Email: ${l||"N/A"}`),e.push(` User ID: ${u||"N/A"}`),i==="oauth"){let n=await $(),o=f(),{data:a,error:g}=await C({config:n});g&&(c(s,g.message),process.exit(1));let r=a?.organizations??[];if(r.length>0){if(e.push(""),e.push(`Organizations (${r.length}):`),r.forEach(t=>{let w=t.id===o?">":" ";e.push(` ${w} ${t.name} (${t.id})`)}),o){let t=r.find(m=>m.id===o);t&&(e.push(""),e.push(`Active: ${t.name}`))}}else e.push(""),e.push("Organizations: None")}else e.push(""),e.push("Login method: Access Key Credentials"),e.push(" (Organization listing requires OAuth login: tigris login)");e.push(""),console.log(e.join(`
1
+ import{c,e as h,g as O}from"../chunk-SYGTCM6P.js";import{b as $}from"../chunk-VOQSWXBS.js";import"../chunk-BETAO4PB.js";import{b as z}from"../chunk-E4MLGABW.js";import{g as f,k as p,s as A}from"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{listOrganizations as C}from"@tigrisdata/iam";var s=O("whoami");async function y(){try{let i=A(),d=p(),l,u;if(i==="oauth"){let n=z();if(!await n.isAuthenticated()){h(s);return}let a=await n.getIdTokenClaims();l=a.email,u=a.sub}else if(d)l=void 0,u=d.accessKeyId;else{h(s);return}let e=[];if(e.push(""),e.push("User Information:"),e.push(` Email: ${l||"N/A"}`),e.push(` User ID: ${u||"N/A"}`),i==="oauth"){let n=await $(),o=f(),{data:a,error:g}=await C({config:n});g&&(c(s,g.message),process.exit(1));let r=a?.organizations??[];if(r.length>0){if(e.push(""),e.push(`Organizations (${r.length}):`),r.forEach(t=>{let w=t.id===o?">":" ";e.push(` ${w} ${t.name} (${t.id})`)}),o){let t=r.find(m=>m.id===o);t&&(e.push(""),e.push(`Active: ${t.name}`))}}else e.push(""),e.push("Organizations: None")}else e.push(""),e.push("Login method: Access Key Credentials"),e.push(" (Organization listing requires OAuth login: tigris login)");e.push(""),console.log(e.join(`
2
2
  `))}catch(i){i instanceof Error?c(s,i.message):c(s),process.exit(1)}}export{y as default};
@@ -1 +1 @@
1
- import{b as a,c as b}from"../chunk-UI5P73BB.js";import"../chunk-2XAO2OYD.js";export{b as checkForUpdates,a as isNewerVersion};
1
+ import{b as a,c as b}from"../chunk-2BLMIQ2B.js";import"../chunk-2XAO2OYD.js";export{b as checkForUpdates,a as isNewerVersion};
@@ -0,0 +1 @@
1
+ import{a}from"../chunk-EKW6XTGL.js";export{a as calculateUploadParams};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tigrisdata/cli",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "description": "Command line interface for Tigris object storage",
5
5
  "type": "module",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  "@aws-sdk/credential-providers": "^3.1000.0",
82
82
  "@smithy/shared-ini-file-loader": "^4.4.5",
83
83
  "@tigrisdata/iam": "^1.3.0",
84
- "@tigrisdata/storage": "^2.15.1",
84
+ "@tigrisdata/storage": "^2.15.2",
85
85
  "axios": "^1.13.6",
86
86
  "commander": "^14.0.3",
87
87
  "enquirer": "^2.4.1",
@@ -1,2 +0,0 @@
1
- import{b as f}from"./chunk-E4MLGABW.js";import{g as u,h as d,i as l,j as p,l as r,s as h}from"./chunk-DOUR5YEY.js";import{a as w,c as A}from"./chunk-KH63ANUX.js";import{a as g}from"./chunk-2XAO2OYD.js";import{S3Client as a}from"@aws-sdk/client-s3";import{fromIni as I}from"@aws-sdk/credential-providers";var c=A(),S=w(),C=!1;async function T(){if(C||!process.stdin.isTTY)return!1;C=!0,console.log(`Not authenticated. Starting login...
2
- `);let{default:o}=await import("./lib/login/select.js");return await o({}),console.log(),!0}async function y(){return h()}async function k(){if(l()){let e=process.env.AWS_PROFILE||"default",s=await p(e),i=await I({profile:e})();return{accessKeyId:i.accessKeyId,secretAccessKey:i.secretAccessKey,endpoint:s.endpoint||c.endpoint||g,iamEndpoint:s.iamEndpoint||c.iamEndpoint}}let o=await y();if(o==="oauth"){let s=await f().getAccessToken(),i=u();if(!i)throw new Error('No organization selected. Please run "tigris orgs select" first.');return{sessionToken:s,accessKeyId:"",secretAccessKey:"",endpoint:c.endpoint,organizationId:i,iamEndpoint:c.iamEndpoint,authDomain:S.domain}}if(o==="credentials"){let e=r();if(e)return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,endpoint:e.endpoint}}let t=d();if(t)return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:t.endpoint};let n=r();if(n)return{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey,endpoint:n.endpoint};if(await T())return k();throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}async function L(){if(l()){let e=process.env.AWS_PROFILE||"default",s=await p(e);return new a({region:"auto",endpoint:s.endpoint||c.endpoint||g,credentials:I({profile:e})})}let o=await y();if(o==="oauth"){let s=await f().getAccessToken(),i=u();if(!i)throw new Error('No organization selected. Please run "tigris orgs select" first.');let m=new a({region:"auto",endpoint:c.endpoint,credentials:{sessionToken:s,accessKeyId:"",secretAccessKey:""}});return m.middlewareStack.add(E=>async K=>{let P=K.request;return P.headers["x-Tigris-Namespace"]=i,await E(K)},{name:"x-Tigris-Namespace-Middleware",step:"build",override:!0}),m}if(o==="credentials"){let e=r();if(e)return new a({region:"auto",endpoint:e.endpoint,credentials:{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey}})}let t=d();if(t)return new a({region:"auto",endpoint:t.endpoint,credentials:{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey}});let n=r();if(n)return new a({region:"auto",endpoint:n.endpoint,credentials:{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey}});if(await T())return L();throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}async function b(){return l()||await y()!==null||d()!==null||r()!==null}export{y as a,k as b,L as c,b as d};