@tigrisdata/cli 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/s3-client.js +1 -1
- package/dist/chunk-2BGB3HM3.js +2 -0
- package/dist/{chunk-NYQG3EX3.js → chunk-2HJMXAYU.js} +1 -1
- package/dist/{chunk-VT3KZHZZ.js → chunk-4CKYRXYB.js} +1 -1
- package/dist/chunk-CQCBYE3X.js +6 -0
- package/dist/{chunk-A3TXP5Y2.js → chunk-I52LJ637.js} +1 -1
- package/dist/{chunk-HCOG24E2.js → chunk-KBDSESA4.js} +1 -1
- package/dist/chunk-LY55GPPO.js +1 -0
- package/dist/chunk-TF2BX3PY.js +10 -0
- package/dist/chunk-Y7MJZRR4.js +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/access-keys/assign.js +1 -1
- package/dist/lib/access-keys/create.js +1 -1
- package/dist/lib/access-keys/delete.js +1 -1
- package/dist/lib/access-keys/get.js +1 -1
- package/dist/lib/access-keys/list.js +1 -1
- package/dist/lib/buckets/create.js +1 -1
- package/dist/lib/buckets/delete.js +1 -1
- package/dist/lib/buckets/get.js +1 -1
- package/dist/lib/buckets/list.js +1 -1
- package/dist/lib/buckets/set.js +1 -1
- package/dist/lib/configure/index.js +1 -1
- package/dist/lib/cp.js +1 -1
- package/dist/lib/credentials/test.js +1 -1
- package/dist/lib/forks/create.js +1 -1
- package/dist/lib/forks/list.js +1 -1
- package/dist/lib/iam/policies/create.js +2 -0
- package/dist/lib/iam/policies/delete.js +2 -0
- package/dist/lib/iam/policies/edit.js +2 -0
- package/dist/lib/iam/policies/get.js +2 -0
- package/dist/lib/iam/policies/list.js +2 -0
- package/dist/lib/iam/policies/utils.js +1 -0
- package/dist/lib/login/credentials.js +1 -1
- package/dist/lib/login/oauth.js +1 -1
- package/dist/lib/login/select.js +1 -1
- package/dist/lib/logout.js +1 -1
- package/dist/lib/ls.js +1 -1
- package/dist/lib/mk.js +1 -1
- package/dist/lib/mv.js +1 -1
- package/dist/lib/objects/delete.js +1 -1
- package/dist/lib/objects/get.js +1 -1
- package/dist/lib/objects/list.js +1 -1
- package/dist/lib/objects/put.js +1 -1
- package/dist/lib/objects/set.js +1 -0
- package/dist/lib/organizations/create.js +1 -1
- package/dist/lib/organizations/list.js +1 -1
- package/dist/lib/organizations/select.js +1 -1
- package/dist/lib/rm.js +1 -1
- package/dist/lib/snapshots/list.js +1 -1
- package/dist/lib/snapshots/take.js +1 -1
- package/dist/lib/stat.js +1 -0
- package/dist/lib/touch.js +1 -1
- package/dist/lib/whoami.js +1 -1
- package/dist/specs.yaml +178 -14
- package/dist/utils/format.js +1 -1
- package/dist/utils/messages.js +1 -1
- package/dist/utils/specs.js +1 -1
- package/dist/utils/update-check.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-4LGKN5DA.js +0 -1
- package/dist/chunk-EXTBL5CE.js +0 -12
- package/dist/chunk-HGIJOGCZ.js +0 -6
- package/dist/chunk-PRJKBTQP.js +0 -2
- package/dist/lib/_stat.js +0 -1
package/dist/auth/s3-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-2BGB3HM3.js";import"../chunk-DC3ZKGQV.js";import"../chunk-7F4WI32C.js";import"../chunk-UUITLEOI.js";import"../chunk-BP52O7NB.js";export{a as getLoginMethod,c as getS3Client,b as getStorageConfig,d as isAuthenticated};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as f}from"./chunk-DC3ZKGQV.js";import{a as w,c as A}from"./chunk-7F4WI32C.js";import{g as u,h as d,i as l,j as p,l as r,s as h}from"./chunk-UUITLEOI.js";import{a as g}from"./chunk-BP52O7NB.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as p,d,e as u}from"./chunk-BP52O7NB.js";import{readFileSync as C,writeFileSync as N,mkdirSync as T}from"fs";import{join as m}from"path";import{homedir as f}from"os";import k from"https";var c="2.
|
|
1
|
+
import{c as p,d,e as u}from"./chunk-BP52O7NB.js";import{readFileSync as C,writeFileSync as N,mkdirSync as T}from"fs";import{join as m}from"path";import{homedir as f}from"os";import k from"https";var c="2.8.0";var g=m(f(),".tigris","update-check.json");function h(){try{let t=C(g,"utf-8"),s=JSON.parse(t);return typeof s.latestVersion=="string"&&typeof s.lastChecked=="number"?s:null}catch{return null}}function v(t){try{T(m(f(),".tigris"),{recursive:!0}),N(g,JSON.stringify(t),"utf-8")}catch{}}function _(t,s){let r=e=>{let o=(e.startsWith("v")?e.slice(1):e).split(".");if(o.length!==3)return null;let a=o.map(Number);return a.some(isNaN)?null:a},i=r(t),n=r(s);if(!i||!n)return!1;for(let e=0;e<3;e++){if(n[e]>i[e])return!0;if(n[e]<i[e])return!1}return!1}function E(){try{let t=k.get(p,{timeout:5e3},s=>{let r="";s.on("data",i=>{r+=i}),s.on("end",()=>{try{let i=JSON.parse(r);if(typeof i.version=="string"){let n=h();v({...n,latestVersion:i.version,lastChecked:Date.now()})}}catch{}})});t.on("error",()=>{}),t.on("timeout",()=>{t.destroy()}),t.end(),t.on("socket",s=>{s.unref()})}catch{}}function D(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let t=h(),s=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||216e5;if(t&&_(c,t.latestVersion)&&(!t.lastNotified||Date.now()-t.lastNotified>s)){let i=`Update available: ${c} \u2192 ${t.latestVersion}`,n="Run `npm install -g @tigrisdata/cli` to upgrade.",e=Math.max(i.length,n.length)+4,l="\u250C"+"\u2500".repeat(e-2)+"\u2510",o="\u2514"+"\u2500".repeat(e-2)+"\u2518",a=y=>"\u2502 "+y.padEnd(e-4)+" \u2502";console.log(`
|
|
2
2
|
${l}
|
|
3
3
|
${a("")}
|
|
4
4
|
${a(i)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u,b as o,c as m,g}from"./chunk-
|
|
1
|
+
import{a as u,b as o,c as m,g}from"./chunk-I52LJ637.js";import{m as i,o as d,r as y}from"./chunk-UUITLEOI.js";import{a as n}from"./chunk-BP52O7NB.js";import p from"enquirer";var{prompt:S}=p,t=g("login","credentials");async function l(e){u(t);let s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,c=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(!s||!c){let r=[];s||r.push({type:"input",name:"accessKey",message:"Access Key ID:",required:!0}),c||r.push({type:"password",name:"accessSecret",message:"Secret Access Key:",required:!0});let a=await S(r);s=s||a.accessKey,c=c||a.accessSecret}(!s||!c)&&(m(t,"Access key and secret are required"),process.exit(1));let f=i()?.endpoint||n;await d({accessKeyId:s,secretAccessKey:c,endpoint:f}),await y("credentials"),o(t)}export{l as a};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function B(n){if(n===0)return"0 B";let t=["B","KB","MB","GB","TB"],r=Math.floor(Math.log(n)/Math.log(1024));return`${(n/Math.pow(1024,r)).toFixed(r>0?1:0)} ${t[r]}`}function T(n){return JSON.stringify(n,null,2)}function b(n){return String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function W(n,t=" "){return Object.entries(n).map(([r,e])=>`${t}<${r}>${b(e)}</${r}>`).join(`
|
|
2
|
+
`)}function j(n,t,r){let e=[`<${t}>`];return n.forEach(u=>{e.push(` <${r}>`),e.push(W(u," ")),e.push(` </${r}>`)}),e.push(`</${t}>`),e.join(`
|
|
3
|
+
`)}function l(n,t){return n.length<=t?n:n.slice(0,t-1)+"\u2026"}function m(n){if(n==null)return"";if(n instanceof Date)return f(n);if(typeof n=="string"){let t=new Date(n);if(!isNaN(t.getTime())&&n.includes("T"))return f(t)}return String(n)}function f(n){return new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)}function k(n,t){let r=process.stdout.columns||120,e=t.length*3+1,u=r-e,c=t.map(i=>{if(i.width)return i.width;let s=i.header.length,o=n.reduce((p,x)=>{let w=m(x[i.key]);return Math.max(p,w.length)},0),h=Math.max(s,o);return i.maxWidth&&h>i.maxWidth&&(h=i.maxWidth),h}),g=c.reduce((i,s)=>i+s,0);if(g<=u)return c;let d=[...c],a=t.map(i=>Math.max(i.header.length,8));for(;g>u;){let i=-1,s=0;for(let o=0;o<d.length;o++)d[o]>a[o]&&d[o]>s&&(s=d[o],i=o);if(i===-1)break;d[i]--,g--}return d}function $(n,t){let r=[],e=k(n,t),u="\u250C"+e.map(a=>"\u2500".repeat(a+2)).join("\u252C")+"\u2510",c="\u251C"+e.map(a=>"\u2500".repeat(a+2)).join("\u253C")+"\u2524",g="\u2514"+e.map(a=>"\u2500".repeat(a+2)).join("\u2534")+"\u2518";r.push(`
|
|
4
|
+
`+u);let d="\u2502 "+t.map((a,i)=>l(a.header,e[i]).padEnd(e[i])).join(" \u2502 ")+" \u2502";return r.push(d),r.push(c),n.forEach(a=>{let i=t.map((s,o)=>{let h=l(m(a[s.key]),e[o]);return s.align==="right"?h.padStart(e[o]):h.padEnd(e[o])});r.push("\u2502 "+i.join(" \u2502 ")+" \u2502")}),r.push(g+`
|
|
5
|
+
`),r.join(`
|
|
6
|
+
`)}function M(n,t,r,e,u){switch(t){case"json":return T(n);case"xml":return j(n,r,e);default:return $(n,u)}}export{B as a,T as b,W as c,j as d,$ as e,M as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as u}from"./chunk-
|
|
1
|
+
import{b as u}from"./chunk-LY55GPPO.js";var a={success:"\u2714",failure:"\u2716",hint:"\u2192"};function r(){return process.stdout.isTTY===!0}function t(n){let s=u(n.command,n.operation);if(s)return s.messages}function o(n,s){let e=n;return e=e.replace(/\\n/g,`
|
|
2
2
|
`),s&&(e=e.replace(/\{\{(\w+)\}\}/g,(i,c)=>{let g=s[c];return g!==void 0?String(g):`{{${c}}}`})),e}function l(n,s){if(!r())return;let e=t(n);e?.onStart&&console.log(o(e.onStart,s))}function f(n,s){if(!r())return;let e=t(n);e?.onSuccess&&console.log(`${a.success} ${o(e.onSuccess,s)}`)}function m(n,s,e){let i=t(n);i?.onFailure&&console.error(`${a.failure} ${o(i.onFailure,e)}`),s&&console.error(` ${s}`)}function d(n,s){if(!r())return;let e=t(n);e?.onEmpty&&console.log(o(e.onEmpty,s))}function M(n,s){if(!r())return;let e=t(n);e?.onAlreadyDone&&console.log(o(e.onAlreadyDone,s))}function x(n,s){if(!r())return;let e=t(n);e?.hint&&console.log(`${a.hint} ${o(e.hint,s)}`)}function C(n,s){return{command:n,operation:s}}export{l as a,f as b,m as c,d,M as e,x as f,C as g};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as s,b as e,c,e as g,f as l,g as u}from"./chunk-
|
|
1
|
+
import{a as s,b as e,c,e as g,f as l,g as u}from"./chunk-I52LJ637.js";import{b as a}from"./chunk-DC3ZKGQV.js";import{f as r}from"./chunk-UUITLEOI.js";var t=u("login","oauth");async function f(){s(t);try{let n=a();if(await n.isAuthenticated()){g(t);return}await n.login({onDeviceCode:(o,p)=>{console.log(`
|
|
2
2
|
Your confirmation code: ${o}
|
|
3
3
|
`),console.log(`If browser doesn't open, visit: ${p}`)},onWaiting:()=>console.log(`
|
|
4
4
|
Waiting for authentication...`)});let i=await n.getOrganizations();if(i.length>0){let o=i[0];await r(o.id),e(t,{org:o.displayName||o.name}),i.length>1&&l(t,{count:i.length})}else e(t,{org:"none"})}catch{c(t),process.exit(1)}}var A=f;export{f as a,A as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as p}from"fs";import{join as l,dirname as u}from"path";import{fileURLToPath as f}from"url";import*as i from"yaml";var d=f(import.meta.url),S=u(d),m=null,g=l(S,"specs.yaml");function A(){if(!m){let n=p(g,"utf8");m=i.parse(n,{schema:"core"})}return m}function y(n,e){let s=A(),t=n.split(" ").filter(Boolean),r,a=s.commands;for(let o of t){if(r=a.find(c=>c.name===o),!r)return null;a=r.commands||[]}return r?e&&r.commands?r.commands.find(o=>o.name===e)||null:r:null}function x(n,e,s){let t=y(n,s);return!t||!t.arguments?null:t.arguments.find(r=>r.name===e)||null}function P(n){return n.options?Array.isArray(n.options)&&typeof n.options[0]=="string"?n.options.map(e=>({name:e,message:e.charAt(0).toUpperCase()+e.slice(1),value:e})):Array.isArray(n.options)&&typeof n.options[0]=="object"?n.options.map(e=>({name:e.value,message:e.description?`${e.name} - ${e.description}`:e.name,value:e.value})):null:null}export{A as a,y as b,x as c,P as d};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{a as C,c as w}from"./chunk-2HJMXAYU.js";import{a as y}from"./chunk-LY55GPPO.js";import{Command as S}from"commander";import{existsSync as A}from"fs";import{join as x,dirname as k}from"path";import{fileURLToPath as R}from"url";process.on("unhandledRejection",e=>{(e===""||e===void 0)&&(console.error(`
|
|
2
|
+
Operation cancelled`),process.exit(1)),console.error(`
|
|
3
|
+
Error:`,e instanceof Error?e.message:e),process.exit(1)});process.on("uncaughtException",e=>{console.error(`
|
|
4
|
+
Error:`,e.message),process.exit(1)});var V=R(import.meta.url),b=k(V),m=y();function U(e){return/^[a-zA-Z0-9_-]+$/.test(e)}function _(e){if(e.length===0)return!1;let t=x(b,"lib",...e)+".js";if(A(t))return!0;let o=x(b,"lib",...e,"index.js");return!!A(o)}function D(e){let t;e.type==="positional"?t=` ${e.name}`:(t=` --${e.name}`,e.alias&&typeof e.alias=="string"&&e.alias.length===1&&(t+=`, -${e.alias}`));let o=26,i=t.length>=o?t+" ":t.padEnd(o),n=e.description;return e.options&&(Array.isArray(e.options)&&typeof e.options[0]=="string"?n+=` (options: ${e.options.join(", ")})`:n+=` (options: ${e.options.map(a=>a.value).join(", ")})`),e.default&&(n+=` [default: ${e.default}]`),e.required&&(n+=" [required]"),e["required-when"]&&(n+=` [required when: ${e["required-when"]}]`),e.multiple&&(n+=" [multiple values: comma-separated]"),e.type==="positional"&&(n+=" [positional argument]"),e.examples&&e.examples.length>0&&(n+=` (examples: ${e.examples.join(", ")})`),`${i}${n}`}function d(e,t){let o=t.join(" ");if(console.log(`
|
|
5
|
+
${m.name} ${o} - ${e.description}
|
|
6
|
+
`),e.commands&&e.commands.length>0){let i=e.commands.filter(n=>g(n,[...t,n.name]));i.length>0&&(console.log("Commands:"),i.forEach(n=>{let a=` ${n.name}`;if(n.alias){let r=Array.isArray(n.alias)?n.alias:[n.alias];a+=` (${r.join(", ")})`}let s=a.padEnd(24);console.log(`${s}${n.description}`)}),console.log())}e.arguments&&e.arguments.length>0&&(console.log("Arguments:"),e.arguments.forEach(i=>{console.log(D(i))}),console.log()),e.examples&&e.examples.length>0&&(console.log("Examples:"),e.examples.forEach(i=>{console.log(` ${i}`)}),console.log()),e.commands&&e.commands.length>0&&console.log(`Use "${m.name} ${o} <command> help" for more information about a command.`)}function g(e,t){return _(t)?!0:e.commands?e.commands.some(o=>g(o,[...t,o.name])):!1}function v(){console.log(`Tigris CLI Version: ${C}
|
|
7
|
+
`),console.log(`Usage: tigris [command] [options]
|
|
8
|
+
`),console.log("Commands:"),m.commands.filter(t=>g(t,[t.name])).forEach(t=>{let o=` ${t.name}`;if(t.alias){let n=Array.isArray(t.alias)?t.alias:[t.alias];o+=` (${n.join(", ")})`}let i=o.padEnd(24);console.log(`${i}${t.description}`)}),console.log(`
|
|
9
|
+
Use "${m.name} <command> help" for more information about a command.`)}function p(e,t=[]){t.forEach(o=>{if(o.type==="positional"){let i=o.required?`<${o.name}>`:`[${o.name}]`;e.argument(i,o.description)}else{let n=o.alias&&typeof o.alias=="string"&&o.alias.length===1?`-${o.alias}, --${o.name}`:`--${o.name}`;o.type==="flag"||(o.type==="boolean"?n+=" [value]":o.options?n+=" <value>":n+=o.required||o["required-when"]?" <value>":" [value]"),e.option(n,o.description,o.default)}})}function E(e,t){for(let o of e){if(o["required-when"]){let[i,n]=o["required-when"].split("="),a=h(t,i,e),s=h(t,o.name,e);if(a===n&&!s)return console.error(`--${o.name} is required when --${i} is ${n}`),!1}if(o.required&&!h(t,o.name,e))return console.error(`--${o.name} is required`),!1}return!0}function h(e,t,o){if(o){let n=o.find(a=>a.name===t);if(n&&n.alias&&typeof n.alias=="string"){let a=n.alias.charAt(0).toUpperCase()+n.alias.slice(1);if(e[a]!==void 0)return e[a]}}let i=[t,t.replace(/-/g,""),t.replace(/-/g,"").toLowerCase(),t.charAt(0).toUpperCase(),H(t)];for(let n of i)if(e[n]!==void 0)return e[n]}function H(e){return e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase())}async function I(e){let t=[`./lib/${e.join("/")}.js`,`./lib/${e.join("/")}/index.js`];for(let i of t){let n=await import(i).catch(()=>null);if(n)return{module:n,error:null}}return{module:null,error:`Command not found: ${e.join(" ")}`}}async function j(e,t=[],o={},i){if(i){let l=i.replace(/\\n/g,`
|
|
10
|
+
`);console.log(l)}let{module:n,error:a}=await I(e);(a||!n)&&(console.error(a),process.exit(1));let s=e[e.length-1],r=n.default||n[s];typeof r!="function"&&(console.error(`Command not implemented: ${e.join(" ")}`),process.exit(1)),await r({...o,_positional:t})}function u(e,t,o){let i;"optsWithGlobals"in o&&typeof o.optsWithGlobals=="function"?i=o.optsWithGlobals():"opts"in o&&typeof o.opts=="function"?i=o.opts():i=o;let n={...i};return e.filter(s=>s.type==="positional").forEach((s,r)=>{t[r]!==void 0&&(s.multiple?n[s.name]=t[r].split(",").map(l=>l.trim()):n[s.name]=t[r])}),e.forEach(s=>{s.multiple&&s.type!=="positional"&&n[s.name]&&typeof n[s.name]=="string"&&(n[s.name]=n[s.name].split(",").map(r=>r.trim()))}),n}function q(e,t,o=[]){for(let i of t){U(i.name)||(console.error(`Invalid command name "${i.name}": only alphanumeric, hyphens, and underscores allowed`),process.exit(1));let n=[...o,i.name],a=e.command(i.name).description(i.description);if(i.alias&&(Array.isArray(i.alias)?i.alias:[i.alias]).forEach(r=>a.alias(r)),i.commands&&i.commands.length>0){if(q(a,i.commands,n),i.default){let s=i.commands.find(r=>r.name===i.default);if(s){p(a,i.arguments),p(a,s.arguments);let r=[...i.arguments||[],...s.arguments||[]];a.action(async(...l)=>{let $=l.pop(),f=l;r.length>0&&!E(r,u(r,f,$))||await j([...n,s.name],f,u(r,f,$),i.message||s.message)})}}else a.action(()=>{d(i,n)});a.command("help").description("Show help for this command").action(()=>{d(i,n)})}else p(a,i.arguments),a.action(async(...s)=>{let r=s.pop(),l=s;i.arguments&&!E(i.arguments,u(i.arguments,l,r))||await j(n,l,u(i.arguments||[],l,r),i.message)}),a.command("help").description("Show help for this command").action(()=>{d(i,n)})}}var c=new S;c.name(m.name).description(m.description).version(m.version);q(c,m.commands);c.command("help").description("Show general help").action(()=>{v()});c.action(()=>{v()});c.parse();w();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function n(){let r=[];for await(let t of process.stdin)r.push(t);return Buffer.concat(r).toString("utf-8")}function o(r){let t=JSON.parse(r);return{version:t.Version,statements:(Array.isArray(t.Statement)?t.Statement:[t.Statement]).map(e=>({effect:e.Effect,action:e.Action,resource:e.Resource}))}}export{n as a,o as b};
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-TF2BX3PY.js";import"./chunk-2HJMXAYU.js";import"./chunk-LY55GPPO.js";import"./chunk-BP52O7NB.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-TF2BX3PY.js";import"./chunk-2HJMXAYU.js";import"./chunk-LY55GPPO.js";import"./chunk-BP52O7NB.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as A,b as l,c as t,g as R}from"../../chunk-
|
|
1
|
+
import{a as n}from"../../chunk-JRALYIRA.js";import{a as A,b as l,c as t,g as R}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{a as b}from"../../chunk-2BGB3HM3.js";import{b as k}from"../../chunk-DC3ZKGQV.js";import{c as p}from"../../chunk-7F4WI32C.js";import{g as h}from"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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-
|
|
1
|
+
import{a as u}from"../../chunk-JRALYIRA.js";import{a as g,b as l,c as t,g as m}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{a as d}from"../../chunk-2BGB3HM3.js";import{b as a}from"../../chunk-DC3ZKGQV.js";import{c}from"../../chunk-7F4WI32C.js";import{g as r}from"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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
|
|
1
|
+
import{a as f}from"../../chunk-JRALYIRA.js";import{a,b as g,c as e,g as d}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{a as m}from"../../chunk-2BGB3HM3.js";import{b as c}from"../../chunk-DC3ZKGQV.js";import{c as s}from"../../chunk-7F4WI32C.js";import{g as r}from"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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-
|
|
1
|
+
import{a as m}from"../../chunk-JRALYIRA.js";import{a as l,b as d,c as t,g as f}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{a as u}from"../../chunk-2BGB3HM3.js";import{b as g}from"../../chunk-DC3ZKGQV.js";import{c}from"../../chunk-7F4WI32C.js";import{g as a}from"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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-
|
|
1
|
+
import{a as g,b as u,c as s,d as m,g as l}from"../../chunk-I52LJ637.js";import{f}from"../../chunk-CQCBYE3X.js";import"../../chunk-LY55GPPO.js";import{a as p}from"../../chunk-2BGB3HM3.js";import{b as d}from"../../chunk-DC3ZKGQV.js";import{c}from"../../chunk-7F4WI32C.js";import{g as r}from"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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 S,b as x,c as b,g as k}from"../../chunk-
|
|
1
|
+
import{a as c}from"../../chunk-JRALYIRA.js";import{a as S,b as x,c as b,g as k}from"../../chunk-I52LJ637.js";import{c as d,d as f}from"../../chunk-LY55GPPO.js";import{b as A}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.js";import I from"enquirer";import{createBucket as v}from"@tigrisdata/storage";var{prompt:T}=I,p=k("buckets","create");async function C(a){S(p);let t=!c(a,["name"]),u=c(a,["name"]),h=t?void 0:c(a,["access","a","A"]),l=t?void 0:c(a,["enable-snapshots","s","S"]),g=t?void 0:c(a,["default-tier","t","T"]),m=t?void 0:c(a,["consistency","c","C"]),r=t?void 0:c(a,["region","r","R"]),i=[];if((!u||t)&&i.push({type:"input",name:"name",message:"Bucket name:",required:!0}),!h||t){let e=d("buckets","access","create"),s=f(e),n=s?.findIndex(o=>o.value===e?.default);i.push({type:"select",name:"access",message:"Access level:",choices:s||[],initial:n!==void 0&&n>=0?n:0})}if(!g||t){let e=d("buckets","default-tier","create"),s=f(e),n=s?.findIndex(o=>o.value===e?.default);i.push({type:"select",name:"defaultTier",message:"Default storage tier:",choices:s||[],initial:n!==void 0&&n>=0?n:0})}if(!m||t){let e=d("buckets","consistency","create"),s=f(e),n=s?.findIndex(o=>o.value===e?.default);i.push({type:"select",name:"consistency",message:"Consistency level:",choices:s||[],initial:n!==void 0&&n>=0?n:0})}if(!r||t){let e=d("buckets","region","create"),s=f(e),n=s?.findIndex(o=>o.value===e?.default);i.push({type:"select",name:"region",message:"Region:",choices:s||[],initial:n!==void 0&&n>=0?n:0})}if((l===void 0||t)&&i.push({type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}),i.length>0){let e=await T(i);u=u||e.name,h=h||e.access,l=l!==void 0?l:e.enableSnapshots,g=g||e.defaultTier,m=m||e.consistency,r=r!==void 0?r:e.region}u||(b(p,"Bucket name is required"),process.exit(1));let{error:y}=await v(u,{defaultTier:g??"STANDARD",consistency:m==="strict"?"strict":"default",enableSnapshot:l===!0,region:r!=="global"&&r!==void 0?r.split(","):void 0,config:await A()});y&&(b(p,y.message),process.exit(1)),x(p,{name:u})}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i,b as s,c as o,g as c}from"../../chunk-
|
|
1
|
+
import{a as m}from"../../chunk-JRALYIRA.js";import{a as i,b as s,c as o,g as c}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{b as a}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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};
|
package/dist/lib/buckets/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,b as p,c as r,g as n}from"../../chunk-
|
|
1
|
+
import{a as c}from"../../chunk-JRALYIRA.js";import{a as s,b as p,c as r,g as n}from"../../chunk-I52LJ637.js";import{f as i}from"../../chunk-CQCBYE3X.js";import"../../chunk-LY55GPPO.js";import{b as u}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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};
|
package/dist/lib/buckets/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as i,c as r,d as m,g as u}from"../../chunk-
|
|
1
|
+
import{a as f}from"../../chunk-JRALYIRA.js";import{a as c,b as i,c as r,d as m,g as u}from"../../chunk-I52LJ637.js";import{f as g}from"../../chunk-CQCBYE3X.js";import"../../chunk-LY55GPPO.js";import{b as p}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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};
|
package/dist/lib/buckets/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as e,b as r}from"../../chunk-JRALYIRA.js";import{a as O,b as y,c,g as w}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{b as k}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import{g as D}from"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.js";import{updateBucket as x}from"@tigrisdata/storage";var o=w("buckets","set");async function B(n){O(o);let s=e(n,["name"]),a=e(n,["access"]),i=e(n,["region"]),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"]);s||(c(o,"Bucket name is required"),process.exit(1)),a===void 0&&i===void 0&&d===void 0&&l===void 0&&f===void 0&&u===void 0&&g===void 0&&(c(o,"At least one setting is required"),process.exit(1));let m=await k(),t={};a!==void 0&&(t.access=a),i!==void 0&&(t.regions=Array.isArray(i)?i:[i]),d!==void 0&&(t.allowObjectAcl=r(d)),l!==void 0&&(t.disableDirectoryListing=r(l)),f!==void 0&&(t.cacheControl=f),u!==void 0&&(t.customDomain=u),g!==void 0&&(t.enableDeleteProtection=r(g));let p=D(),A={...m,...p&&!m.organizationId?{organizationId:p}:{}},{error:b}=await x(s,{...t,config:A});b&&(c(o,b.message),process.exit(1)),y(o,{name:s})}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g,b as p,c as n,g as m}from"../../chunk-
|
|
1
|
+
import{a as g,b as p,c as n,g as m}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{n as u,r as y}from"../../chunk-UUITLEOI.js";import{a as d}from"../../chunk-BP52O7NB.js";import f from"enquirer";var{prompt:l}=f,i=m("configure");async function o(e){g(i);let s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,r=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret,c=e.endpoint||e.e||e.E||e.Endpoint;if(!s||!r||!c){let t=[];s||t.push({type:"input",name:"accessKey",message:"Tigris Access Key ID:",required:!0}),r||t.push({type:"password",name:"accessSecret",message:"Tigris Secret Access Key:",required:!0}),c||t.push({type:"input",name:"endpoint",message:"Tigris Endpoint:",required:!0,initial:d});let a=await l(t);s=s||a.accessKey,r=r||a.accessSecret,c=c||a.endpoint}(!s||!r||!c)&&(n(i,"All credentials are required"),process.exit(1));try{await u({accessKeyId:s,secretAccessKey:r,endpoint:c}),await y("credentials"),p(i)}catch{n(i,"Failed to save credentials"),process.exit(1)}}export{o as default};
|
package/dist/lib/cp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as v}from"../chunk-JRALYIRA.js";import{a as $}from"../chunk-CQCBYE3X.js";import{a as D,b as W,d as S,g as R,h as C,i as T}from"../chunk-LCWHZUZZ.js";import{b as M}from"../chunk-2BGB3HM3.js";import"../chunk-DC3ZKGQV.js";import"../chunk-7F4WI32C.js";import"../chunk-UUITLEOI.js";import"../chunk-BP52O7NB.js";import{createReadStream as Q,createWriteStream as V,statSync as z,readdirSync as N,mkdirSync as X,existsSync as O}from"fs";import{resolve as B,dirname as E,basename as j,join as x,relative as L}from"path";import{homedir as Y}from"os";import{Readable as q}from"stream";import{pipeline as Z}from"stream/promises";import{get as G,put as A,list as _,head as H}from"@tigrisdata/storage";function P(r,e){let t=D(r),a=D(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 J(r){return r==="~"||r.startsWith("~/")?B(Y(),r.slice(2)):B(r)}function ee(r){return N(r,{recursive:!0,withFileTypes:!0}).filter(t=>t.isFile()).map(t=>{let a=t.parentPath??t.path;return x(a,t.name)})}function te(r,e){let t=E(r),a=j(r),p=R(a);return O(t)?e?N(t,{recursive:!0,withFileTypes:!0}).filter(o=>o.isFile()&&p.test(o.name)).map(o=>{let n=o.parentPath??o.path;return x(n,o.name)}):N(t,{withFileTypes:!0}).filter(n=>n.isFile()&&p.test(n.name)).map(n=>x(t,n.name)):[]}async function U(r,e,t,a,p=!1){let u;try{u=z(r).size}catch{return{error:`File not found: ${r}`}}let o=Q(r),n=q.toWeb(o),i=u!==void 0&&u>100*1024*1024,{error:l}=await A(t,n,{multipart:i,onUploadProgress:p?({loaded:c})=>{if(u!==void 0&&u>0){let s=Math.round(c/u*100);process.stdout.write(`\rUploading: ${$(c)} / ${$(u)} (${s}%)`)}else process.stdout.write(`\rUploading: ${$(c)}`)}:void 0,config:{...a,bucket:e}});return p&&process.stdout.write("\r"+" ".repeat(60)+"\r"),l?{error:l.message}:{}}async function K(r,e,t,a,p=!1){let u;if(p){let{data:s}=await H(e,{config:{...a,bucket:r}});u=s?.size}let{data:o,error:n}=await G(e,"stream",{config:{...a,bucket:r}});if(n)return{error:n.message};let i=E(t);O(i)||X(i,{recursive:!0});let l=V(t),c=q.fromWeb(o);if(p&&u!==void 0&&u>0){let s=0;c.on("data",h=>{s+=h.length;let m=Math.round(s/u*100);process.stdout.write(`\rDownloading: ${$(s)} / ${$(u)} (${m}%)`)})}return await Z(c,l),p&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function I(r,e,t,a,p,u=!1){if(t.endsWith("/")){let{error:s}=await A(p,"",{config:{...r,bucket:a}});return s?{error:s.message}:{}}let o;if(u){let{data:s}=await H(t,{config:{...r,bucket:e}});o=s?.size}let{data:n,error:i}=await G(t,"stream",{config:{...r,bucket:e}});if(i)return{error:i.message};let l=o!==void 0&&o>100*1024*1024,{error:c}=await A(p,n,{multipart:l,onUploadProgress:u?({loaded:s})=>{if(o!==void 0&&o>0){let h=Math.round(s/o*100);process.stdout.write(`\rCopying: ${$(s)} / ${$(o)} (${h}%)`)}else process.stdout.write(`\rCopying: ${$(s)}`)}:void 0,config:{...r,bucket:a}});return u&&process.stdout.write("\r"+" ".repeat(60)+"\r"),c?{error:c.message}:{}}async function oe(r,e,t,a){let p=J(r);if(r.includes("*")){let n=te(p,a);if(n.length===0){console.log("No files matching pattern");return}let i=E(p),l=0;for(let c of n){let s=L(i,c),h=e.path?`${e.path.replace(/\/$/,"")}/${s}`:s,m=await U(c,e.bucket,h,t);m.error?console.error(`Failed to upload ${c}: ${m.error}`):(console.log(`Uploaded ${c} -> t3://${e.bucket}/${h}`),l++)}console.log(`Uploaded ${l} file(s)`);return}let o;try{o=z(p)}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 n=ee(p);if(n.length===0){console.log("No files to upload");return}let i=r.endsWith("/")?"":j(p),l=0;for(let c of n){let s=L(p,c),m=[e.path?.replace(/\/$/,""),i,s].filter(Boolean).join("/"),b=await U(c,e.bucket,m,t);b.error?console.error(`Failed to upload ${c}: ${b.error}`):(console.log(`Uploaded ${c} -> t3://${e.bucket}/${m}`),l++)}console.log(`Uploaded ${l} file(s)`)}else{let n=j(p),i;e.path?r.endsWith("/")||e.path.endsWith("/")?i=`${e.path.replace(/\/$/,"")}/${n}`:await S(e.bucket,e.path,t)?i=`${e.path}/${n}`:i=e.path:i=n;let l=await U(p,e.bucket,i,t,!0);l.error&&(console.error(l.error),process.exit(1)),console.log(`Uploaded ${r} -> t3://${e.bucket}/${i}`)}}async function re(r,e,t,a,p){let u=r.endsWith("/");!e.path&&!u&&(console.error("Cannot copy a bucket. Provide a path within the bucket."),process.exit(1));let o=J(t),n=e.path.includes("*"),i=e.path.endsWith("/")||!e.path&&u;if(!n&&!i&&(i=await S(e.bucket,e.path,a)),i&&!n&&!p&&(console.error("Source is a remote folder (not copied). Use -r to copy recursively."),process.exit(1)),n||i){let l=n?C(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",c=!n&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",{items:s,error:h}=await T(e.bucket,l||void 0,a);h&&(console.error(h.message),process.exit(1));let m=s.filter(d=>!d.name.endsWith("/"));if(n){let d=e.path.split("/").pop(),g=R(d);m=m.filter(w=>{let f=l?w.name.slice(l.length):w.name;return!p&&f.includes("/")?!1:g.test(f.split("/").pop())})}if(m.length===0){console.log("No objects to download");return}let b=0;for(let d of m){let g=l?d.name.slice(l.length):d.name,w=c?x(o,c,g):x(o,g),f=await K(e.bucket,d.name,w,a);f.error?console.error(`Failed to download ${d.name}: ${f.error}`):(console.log(`Downloaded t3://${e.bucket}/${d.name} -> ${w}`),b++)}console.log(`Downloaded ${b} file(s)`)}else{let l=e.path.split("/").pop(),c,s=!1;try{s=z(o).isDirectory()}catch{}s||t.endsWith("/")?c=x(o,l):c=o;let h=await K(e.bucket,e.path,c,a,!0);h.error&&(console.error(h.error),process.exit(1)),console.log(`Downloaded t3://${e.bucket}/${e.path} -> ${c}`)}}async function ie(r,e,t,a,p){let u=r.endsWith("/");!e.path&&!u&&(console.error("Cannot copy a bucket. Provide a path within the bucket."),process.exit(1));let o=r.includes("*"),n=e.path.endsWith("/")||!e.path&&u;if(!o&&!n&&e.path&&(n=await S(e.bucket,e.path,a)),n&&!o&&!p&&(console.error("Source is a remote folder (not copied). Use -r to copy recursively."),process.exit(1)),o||n){let i=o?C(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",l=!o&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",s=[t.path?.replace(/\/$/,"")||"",l].filter(Boolean).join("/"),h=s?`${s}/`:"";e.bucket===t.bucket&&i===h&&(console.error("Source and destination are the same"),process.exit(1));let{items:m,error:b}=await T(e.bucket,i||void 0,a);b&&(console.error(b.message),process.exit(1));let d=m.filter(f=>f.name!==i);if(o){let f=e.path.split("/").pop(),y=R(f);d=d.filter(k=>{let F=i?k.name.slice(i.length):k.name;return!p&&F.includes("/")?!1:y.test(F.split("/").pop())})}let g=0;for(let f of d){let y=i?f.name.slice(i.length):f.name,k=s?`${s}/${y}`:y,F=await I(a,e.bucket,f.name,t.bucket,k);F.error?console.error(`Failed to copy ${f.name}: ${F.error}`):(console.log(`Copied t3://${e.bucket}/${f.name} -> t3://${t.bucket}/${k}`),g++)}let w=!1;if(s&&i){let{data:f}=await _({prefix:i,limit:1,config:{...a,bucket:e.bucket}});if(f?.items?.some(y=>y.name===i)){let y=`${s}/`,k=await I(a,e.bucket,i,t.bucket,y);k.error?console.error(`Failed to copy folder marker: ${k.error}`):w=!0}}if(g===0&&w&&(g=1),g===0){console.log("No objects to copy");return}console.log(`Copied ${g} object(s)`)}else{let i=e.path.split("/").pop(),l;t.path?t.path.endsWith("/")?l=`${t.path}${i}`:await S(t.bucket,t.path,a)?l=`${t.path}/${i}`:l=t.path:l=i,e.bucket===t.bucket&&e.path===l&&(console.error("Source and destination are the same"),process.exit(1));let c=await I(a,e.bucket,e.path,t.bucket,l,!0);c.error&&(console.error(c.error),process.exit(1)),console.log(`Copied t3://${e.bucket}/${e.path} -> t3://${t.bucket}/${l}`)}}async function ne(r){let e=v(r,["src"]),t=v(r,["dest"]);(!e||!t)&&(console.error("Both src and dest arguments are required"),process.exit(1));let a=!!v(r,["recursive","r"]),p=P(e,t),u=await M();switch(p){case"local-to-remote":{let o=W(t);o.bucket||(console.error("Invalid destination path"),process.exit(1)),await oe(e,o,u,a);break}case"remote-to-local":{let o=W(e);o.bucket||(console.error("Invalid source path"),process.exit(1)),await re(e,o,t,u,a);break}case"remote-to-remote":{let o=W(e),n=W(t);o.bucket||(console.error("Invalid source path"),process.exit(1)),n.bucket||(console.error("Invalid destination path"),process.exit(1)),await ie(e,o,n,u,a);break}}process.exit(0)}export{ne as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f,b as g,c as n,g as u}from"../../chunk-
|
|
1
|
+
import{a as d}from"../../chunk-JRALYIRA.js";import{a as f,b as g,c as n,g as u}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{b as l}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import{g as a}from"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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};
|
package/dist/lib/forks/create.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as a,c as r,g as m}from"../../chunk-
|
|
1
|
+
import{a as t}from"../../chunk-JRALYIRA.js";import{a as c,b as a,c as r,g as m}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{b as f}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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};
|
package/dist/lib/forks/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u,b as p,c as n,d as s,g}from"../../chunk-
|
|
1
|
+
import{a as i}from"../../chunk-JRALYIRA.js";import{a as u,b as p,c as n,d as s,g}from"../../chunk-I52LJ637.js";import{f as d}from"../../chunk-CQCBYE3X.js";import"../../chunk-LY55GPPO.js";import{b as k}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as x,b as P}from"../../../chunk-Y7MJZRR4.js";import{a as n}from"../../../chunk-JRALYIRA.js";import{a as p,b as f,c as e,g as h}from"../../../chunk-I52LJ637.js";import"../../../chunk-LY55GPPO.js";import{a as y}from"../../../chunk-2BGB3HM3.js";import{b as g}from"../../../chunk-DC3ZKGQV.js";import{c as l}from"../../../chunk-7F4WI32C.js";import{g as u}from"../../../chunk-UUITLEOI.js";import"../../../chunk-BP52O7NB.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
|
+
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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as w}from"../../../chunk-JRALYIRA.js";import{a as p,b as d,c as t,d as f,g as u}from"../../../chunk-I52LJ637.js";import"../../../chunk-LY55GPPO.js";import{a as h}from"../../../chunk-2BGB3HM3.js";import{b as m}from"../../../chunk-DC3ZKGQV.js";import{c as l}from"../../../chunk-7F4WI32C.js";import{g}from"../../../chunk-UUITLEOI.js";import"../../../chunk-BP52O7NB.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
|
+
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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as O,b as p}from"../../../chunk-Y7MJZRR4.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as S,b as A,c as t,d as P,g as T}from"../../../chunk-I52LJ637.js";import"../../../chunk-LY55GPPO.js";import{a as E}from"../../../chunk-2BGB3HM3.js";import{b as w}from"../../../chunk-DC3ZKGQV.js";import{c as y}from"../../../chunk-7F4WI32C.js";import{g as x}from"../../../chunk-UUITLEOI.js";import"../../../chunk-BP52O7NB.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
|
+
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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as c}from"../../../chunk-JRALYIRA.js";import{a as y,b as r,c as i,d as v,g as A}from"../../../chunk-I52LJ637.js";import{f as O}from"../../../chunk-CQCBYE3X.js";import"../../../chunk-LY55GPPO.js";import{a as S}from"../../../chunk-2BGB3HM3.js";import{b as h}from"../../../chunk-DC3ZKGQV.js";import{c as m}from"../../../chunk-7F4WI32C.js";import{g as p}from"../../../chunk-UUITLEOI.js";import"../../../chunk-BP52O7NB.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
|
+
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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as f}from"../../../chunk-JRALYIRA.js";import{a as m,b as p,c as i,d as u,g}from"../../../chunk-I52LJ637.js";import{f as l}from"../../../chunk-CQCBYE3X.js";import"../../../chunk-LY55GPPO.js";import{a as h}from"../../../chunk-2BGB3HM3.js";import{b as d}from"../../../chunk-DC3ZKGQV.js";import{c as s}from"../../../chunk-7F4WI32C.js";import{g as c}from"../../../chunk-UUITLEOI.js";import"../../../chunk-BP52O7NB.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
|
+
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"../../../chunk-Y7MJZRR4.js";export{b as parseDocument,a as readStdin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-4CKYRXYB.js";import"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.js";export{a as default};
|
package/dist/lib/login/oauth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../../chunk-
|
|
1
|
+
import{a,b}from"../../chunk-KBDSESA4.js";import"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.js";export{b as default,a as oauth};
|
package/dist/lib/login/select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-
|
|
1
|
+
import{a as c}from"../../chunk-4CKYRXYB.js";import{a as s}from"../../chunk-KBDSESA4.js";import"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.js";import m from"enquirer";var{prompt:h}=m;async function n(e){let a=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,r=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(a||r){await c(e);return}let{method:t}=await h({type:"select",name:"method",message:"Choose login method:",choices:[{name:"user",message:"As a user (OAuth2 flow)"},{name:"machine",message:"As a machine (Access Key & Secret)"}]});t==="user"?await s():await c(e)}export{n as default};
|
package/dist/lib/logout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i,b as a,c as r,g as s}from"../chunk-
|
|
1
|
+
import{a as i,b as a,c as r,g as s}from"../chunk-I52LJ637.js";import"../chunk-LY55GPPO.js";import{t as e}from"../chunk-UUITLEOI.js";import"../chunk-BP52O7NB.js";var t=s("logout");async function c(){i(t);try{await e(),a(t)}catch(o){o instanceof Error?r(t,o.message):r(t),process.exit(1)}}export{c as default};
|
package/dist/lib/ls.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as u}from"../chunk-JRALYIRA.js";import{a as k,f as c}from"../chunk-CQCBYE3X.js";import{f as p}from"../chunk-LCWHZUZZ.js";import{b as i}from"../chunk-2BGB3HM3.js";import"../chunk-DC3ZKGQV.js";import"../chunk-7F4WI32C.js";import"../chunk-UUITLEOI.js";import"../chunk-BP52O7NB.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{a}from"../chunk-JRALYIRA.js";import{f as n}from"../chunk-LCWHZUZZ.js";import{b as c}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-JRALYIRA.js";import{f as n}from"../chunk-LCWHZUZZ.js";import{b as c}from"../chunk-2BGB3HM3.js";import"../chunk-DC3ZKGQV.js";import"../chunk-7F4WI32C.js";import"../chunk-UUITLEOI.js";import"../chunk-BP52O7NB.js";import{createBucket as f,put as g}from"@tigrisdata/storage";async function l(p){let t=a(p,["path"]);t||(console.error("path argument is required"),process.exit(1));let{bucket:e,path:r}=n(t);e||(console.error("Invalid path"),process.exit(1));let s=await c();if(r){let o=r.endsWith("/")?r:`${r}/`,{error:i}=await g(o,"",{config:{...s,bucket:e}});i&&(console.error(i.message),process.exit(1)),console.log(`Folder '${e}/${o}' created`),process.exit(0)}else{let{error:o}=await f(e,{config:s});o&&(console.error(o.message),process.exit(1)),console.log(`Bucket '${e}' created`),process.exit(0)}}export{l as default};
|
package/dist/lib/mv.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as v}from"../chunk-JRALYIRA.js";import{a as x}from"../chunk-CQCBYE3X.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-2BGB3HM3.js";import"../chunk-DC3ZKGQV.js";import"../chunk-7F4WI32C.js";import"../chunk-UUITLEOI.js";import"../chunk-BP52O7NB.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 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as i}from"../../chunk-JRALYIRA.js";import{a as f,b as a,c as r,g}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{b as m}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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};
|
package/dist/lib/objects/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as m}from"../../chunk-JRALYIRA.js";import{a as p,b as n,c,g as f}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{b as l}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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};
|
package/dist/lib/objects/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as m,c as s,d as p,g as d}from"../../chunk-
|
|
1
|
+
import{a as e}from"../../chunk-JRALYIRA.js";import{a,b as m,c as s,d as p,g as d}from"../../chunk-I52LJ637.js";import{a as g,f as l}from"../../chunk-CQCBYE3X.js";import"../../chunk-LY55GPPO.js";import{b as u}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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};
|
package/dist/lib/objects/put.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,b as g,c as o,g as b}from"../../chunk-
|
|
1
|
+
import{a as t}from"../../chunk-JRALYIRA.js";import{a as l,b as g,c as o,g as b}from"../../chunk-I52LJ637.js";import{a as n,f as S}from"../../chunk-CQCBYE3X.js";import"../../chunk-LY55GPPO.js";import{b as y}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.js";import{createReadStream as F,statSync as O}from"fs";import{Readable as h}from"stream";import{put as q}from"@tigrisdata/storage";var r=b("objects","put");async function v(s){l(r);let p=t(s,["bucket"]),d=t(s,["key"]),i=t(s,["file"]),k=t(s,["access","a","A"],"private"),T=t(s,["content-type","contentType","t","T"]),x=t(s,["format","f","F"],"table");p||(o(r,"Bucket name is required"),process.exit(1)),d||(o(r,"Object key is required"),process.exit(1));let z=!process.stdin.isTTY;!i&&!z&&(o(r,"File path is required (or pipe data via stdin)"),process.exit(1));let f,e;if(i){try{e=O(i).size}catch{o(r,`File not found: ${i}`),process.exit(1)}let c=F(i);f=h.toWeb(c)}else f=h.toWeb(process.stdin);let w=await y(),R=!i||e!==void 0&&e>100*1024*1024,{data:a,error:u}=await q(d,f,{access:k==="public"?"public":"private",contentType:T,multipart:R,onUploadProgress:({loaded:c,percentage:m})=>{e!==void 0&&e>0?process.stdout.write(`\rUploading: ${n(c)} / ${n(e)} (${m}%)`):process.stdout.write(`\rUploading: ${n(c)}`)},config:{...w,bucket:p}});process.stdout.write("\r"+" ".repeat(60)+"\r"),u&&(o(r,u.message),process.exit(1));let j=[{path:a.path,size:n(a.size??e??0),contentType:a.contentType||"-",modified:a.modified}],$=S(j,x,"objects","object",[{key:"path",header:"Path"},{key:"size",header:"Size"},{key:"contentType",header:"Content-Type"},{key:"modified",header:"Modified"}]);console.log($),g(r,{key:d,bucket:p})}export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c}from"../../chunk-JRALYIRA.js";import{a as p,b as u,c as t,g as f}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{b as g}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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,b as s,c as o,f as g,g as c}from"../../chunk-
|
|
1
|
+
import{a as u}from"../../chunk-JRALYIRA.js";import{a,b as s,c as o,f as g,g as c}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{b as l}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import{k as e,s as r}from"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.js";import{createOrganization as h}from"@tigrisdata/iam";var i=c("organizations","create");async function w(m){if(a(i),r()!=="oauth"){e()?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 t=u(m,["name","N"]);t||(o(i,"Organization name is required"),process.exit(1));let f=await l(),{data:p,error:n}=await h(t,{config:f});n&&(o(i,n.message),process.exit(1));let d=p.id;s(i,{name:t,id:d}),g(i,{name:t})}export{w as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f,b as a,c as h,d as z,g as w}from"../../chunk-
|
|
1
|
+
import{a as O}from"../../chunk-JRALYIRA.js";import{a as f,b as a,c as h,d as z,g as w}from"../../chunk-I52LJ637.js";import{f as S}from"../../chunk-CQCBYE3X.js";import"../../chunk-LY55GPPO.js";import{b as y}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import{f as d,g as m,k as u,s as p}from"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.js";import{listOrganizations as b}from"@tigrisdata/iam";import C from"enquirer";var i=w("organizations","list");async function E(k){if(f(i),p()!=="oauth"){u()?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 s=O(k,["format","f","F"],"select"),x=await y(),{data:I,error:r}=await b({config:x});r&&(h(i,r.message),process.exit(1));let e=I?.organizations??[];if(e.length===0){z(i);return}let o=m();if(s==="select"){let n=e.map(t=>({name:t.id,message:`${t.name} (${t.id})`,hint:t.id===o?"currently selected":void 0})),g=(await C.prompt({type:"select",name:"organization",message:"Select an organization:",choices:n.map(t=>t.message),initial:o?e.findIndex(t=>t.id===o):0})).organization.match(/\(([^)]+)\)$/),l=g?g[1]:e[0].id;await d(l);let $=e.find(t=>t.id===l);a(i,{name:$?.name});return}let c=e.map(n=>({id:n.id,name:n.name,slug:n.slug,selected:n.id===o?"*":""})),M=S(c,s,"organizations","organization",[{key:"selected",header:" ",width:1},{key:"id",header:"ID"},{key:"name",header:"Name"},{key:"slug",header:"Slug"}]);console.log(M),a(i,{count:c.length})}export{E as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as m,b as u,c as t,g as d}from"../../chunk-
|
|
1
|
+
import{a as p}from"../../chunk-JRALYIRA.js";import{a as m,b as u,c as t,g as d}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{b as f}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import{f as g,k as c,s as l}from"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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(`
|
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-
|
|
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-2BGB3HM3.js";import"../chunk-DC3ZKGQV.js";import"../chunk-7F4WI32C.js";import"../chunk-UUITLEOI.js";import"../chunk-BP52O7NB.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-
|
|
1
|
+
import{a as n}from"../../chunk-JRALYIRA.js";import{a as c,b as p,c as o,d as f,g as u}from"../../chunk-I52LJ637.js";import{f as d}from"../../chunk-CQCBYE3X.js";import"../../chunk-LY55GPPO.js";import{b as g}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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-
|
|
1
|
+
import{a as e}from"../../chunk-JRALYIRA.js";import{a as m,b as p,c as n,g as c}from"../../chunk-I52LJ637.js";import"../../chunk-LY55GPPO.js";import{b as f}from"../../chunk-2BGB3HM3.js";import"../../chunk-DC3ZKGQV.js";import"../../chunk-7F4WI32C.js";import"../../chunk-UUITLEOI.js";import"../../chunk-BP52O7NB.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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as v,b as c,c as s,g as b}from"../chunk-I52LJ637.js";import{a as l,f as u}from"../chunk-CQCBYE3X.js";import{f as k}from"../chunk-LCWHZUZZ.js";import"../chunk-LY55GPPO.js";import{b as S}from"../chunk-2BGB3HM3.js";import"../chunk-DC3ZKGQV.js";import"../chunk-7F4WI32C.js";import"../chunk-UUITLEOI.js";import"../chunk-BP52O7NB.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-
|
|
1
|
+
import{a as n}from"../chunk-JRALYIRA.js";import{f as i}from"../chunk-LCWHZUZZ.js";import{b as s}from"../chunk-2BGB3HM3.js";import"../chunk-DC3ZKGQV.js";import"../chunk-7F4WI32C.js";import"../chunk-UUITLEOI.js";import"../chunk-BP52O7NB.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};
|
package/dist/lib/whoami.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c,e as h,g as O}from"../chunk-
|
|
1
|
+
import{c,e as h,g as O}from"../chunk-I52LJ637.js";import"../chunk-LY55GPPO.js";import{b as $}from"../chunk-2BGB3HM3.js";import{b as z}from"../chunk-DC3ZKGQV.js";import"../chunk-7F4WI32C.js";import{g as f,k as p,s as A}from"../chunk-UUITLEOI.js";import"../chunk-BP52O7NB.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};
|
package/dist/specs.yaml
CHANGED
|
@@ -123,7 +123,7 @@ commands:
|
|
|
123
123
|
description: Secret for temporary credentials
|
|
124
124
|
alias: secret
|
|
125
125
|
required: false
|
|
126
|
-
|
|
126
|
+
commands:
|
|
127
127
|
# login (main interactive operation)
|
|
128
128
|
- name: select
|
|
129
129
|
description: Choose how to login - OAuth (browser) or credentials (access key)
|
|
@@ -194,7 +194,7 @@ commands:
|
|
|
194
194
|
examples:
|
|
195
195
|
- "tigris credentials test"
|
|
196
196
|
- "tigris credentials test --bucket my-bucket"
|
|
197
|
-
|
|
197
|
+
commands:
|
|
198
198
|
- name: test
|
|
199
199
|
description: Verify that current credentials are valid. Optionally checks access to a specific bucket
|
|
200
200
|
alias: t
|
|
@@ -277,18 +277,29 @@ commands:
|
|
|
277
277
|
|
|
278
278
|
# stat
|
|
279
279
|
- name: stat
|
|
280
|
-
description: Show
|
|
280
|
+
description: Show storage stats (no args), bucket info, or object metadata
|
|
281
|
+
examples:
|
|
282
|
+
- "tigris stat"
|
|
283
|
+
- "tigris stat t3://my-bucket"
|
|
284
|
+
- "tigris stat t3://my-bucket/my-object.json"
|
|
285
|
+
messages:
|
|
286
|
+
onStart: ''
|
|
287
|
+
onSuccess: ''
|
|
288
|
+
onFailure: 'Failed to get stats'
|
|
281
289
|
arguments:
|
|
282
290
|
- name: path
|
|
283
|
-
required:
|
|
291
|
+
required: false
|
|
284
292
|
type: positional
|
|
285
|
-
description:
|
|
293
|
+
description: Optional bucket or object path. Without it, shows overall storage stats
|
|
286
294
|
examples:
|
|
287
|
-
- my-bucket
|
|
288
|
-
- my-bucket/my-path
|
|
289
295
|
- t3://my-bucket
|
|
290
296
|
- t3://my-bucket/my-path
|
|
291
|
-
- my-bucket/my-
|
|
297
|
+
- t3://my-bucket/my-object.json
|
|
298
|
+
- name: format
|
|
299
|
+
description: Output format
|
|
300
|
+
alias: f
|
|
301
|
+
options: [json, table, xml]
|
|
302
|
+
default: table
|
|
292
303
|
|
|
293
304
|
# cp
|
|
294
305
|
- name: cp
|
|
@@ -401,7 +412,7 @@ commands:
|
|
|
401
412
|
- "tigris orgs list"
|
|
402
413
|
- "tigris orgs create my-org"
|
|
403
414
|
- "tigris orgs select my-org"
|
|
404
|
-
|
|
415
|
+
commands:
|
|
405
416
|
# list
|
|
406
417
|
- name: list
|
|
407
418
|
description: List all organizations you belong to and interactively select one as active
|
|
@@ -469,7 +480,7 @@ commands:
|
|
|
469
480
|
- "tigris buckets create my-bucket"
|
|
470
481
|
- "tigris buckets get my-bucket"
|
|
471
482
|
- "tigris buckets delete my-bucket"
|
|
472
|
-
|
|
483
|
+
commands:
|
|
473
484
|
# list
|
|
474
485
|
- name: list
|
|
475
486
|
description: List all buckets in the current organization
|
|
@@ -617,7 +628,7 @@ commands:
|
|
|
617
628
|
examples:
|
|
618
629
|
- "tigris forks list my-bucket"
|
|
619
630
|
- "tigris forks create my-bucket my-fork"
|
|
620
|
-
|
|
631
|
+
commands:
|
|
621
632
|
# list
|
|
622
633
|
- name: list
|
|
623
634
|
description: List all forks created from the given source bucket
|
|
@@ -679,7 +690,7 @@ commands:
|
|
|
679
690
|
examples:
|
|
680
691
|
- "tigris snapshots list my-bucket"
|
|
681
692
|
- "tigris snapshots take my-bucket"
|
|
682
|
-
|
|
693
|
+
commands:
|
|
683
694
|
# list
|
|
684
695
|
- name: list
|
|
685
696
|
description: List all snapshots for the given bucket, ordered by creation time
|
|
@@ -740,7 +751,7 @@ commands:
|
|
|
740
751
|
- "tigris objects get my-bucket report.pdf --output ./report.pdf"
|
|
741
752
|
- "tigris objects put my-bucket report.pdf ./report.pdf"
|
|
742
753
|
- "tigris objects delete my-bucket report.pdf"
|
|
743
|
-
|
|
754
|
+
commands:
|
|
744
755
|
# list
|
|
745
756
|
- name: list
|
|
746
757
|
description: List objects in a bucket, optionally filtered by a key prefix
|
|
@@ -867,6 +878,34 @@ commands:
|
|
|
867
878
|
multiple: true
|
|
868
879
|
examples:
|
|
869
880
|
- my-file.txt
|
|
881
|
+
# set
|
|
882
|
+
- name: set
|
|
883
|
+
description: Update settings on an existing object such as access level
|
|
884
|
+
alias: s
|
|
885
|
+
examples:
|
|
886
|
+
- "tigris objects set my-bucket my-file.txt --access public"
|
|
887
|
+
- "tigris objects set my-bucket my-file.txt --access private"
|
|
888
|
+
messages:
|
|
889
|
+
onStart: 'Updating object...'
|
|
890
|
+
onSuccess: "Object '{{key}}' updated successfully"
|
|
891
|
+
onFailure: 'Failed to update object'
|
|
892
|
+
arguments:
|
|
893
|
+
- name: bucket
|
|
894
|
+
description: Name of the bucket
|
|
895
|
+
type: positional
|
|
896
|
+
required: true
|
|
897
|
+
- name: key
|
|
898
|
+
description: Key of the object
|
|
899
|
+
type: positional
|
|
900
|
+
required: true
|
|
901
|
+
- name: access
|
|
902
|
+
description: Access level
|
|
903
|
+
alias: a
|
|
904
|
+
options: *access_options
|
|
905
|
+
required: true
|
|
906
|
+
- name: new-key
|
|
907
|
+
description: Rename the object to a new key
|
|
908
|
+
alias: n
|
|
870
909
|
|
|
871
910
|
#########################
|
|
872
911
|
# Manage access keys
|
|
@@ -878,7 +917,7 @@ commands:
|
|
|
878
917
|
- "tigris access-keys list"
|
|
879
918
|
- "tigris access-keys create my-ci-key"
|
|
880
919
|
- "tigris access-keys assign tid_AaBb --bucket my-bucket --role Editor"
|
|
881
|
-
|
|
920
|
+
commands:
|
|
882
921
|
- name: list
|
|
883
922
|
description: List all access keys in the current organization
|
|
884
923
|
alias: l
|
|
@@ -973,3 +1012,128 @@ commands:
|
|
|
973
1012
|
- name: revoke-roles
|
|
974
1013
|
description: Revoke all bucket roles from the access key
|
|
975
1014
|
type: flag
|
|
1015
|
+
|
|
1016
|
+
#########################
|
|
1017
|
+
# IAM - Identity and Access Management
|
|
1018
|
+
#########################
|
|
1019
|
+
- name: iam
|
|
1020
|
+
description: Identity and Access Management - manage policies, roles, and permissions
|
|
1021
|
+
examples:
|
|
1022
|
+
- "tigris iam policies list"
|
|
1023
|
+
- "tigris iam policies get arn:aws:iam::org_id:policy/my-policy"
|
|
1024
|
+
- "tigris iam policies create my-policy --document policy.json"
|
|
1025
|
+
commands:
|
|
1026
|
+
- name: policies
|
|
1027
|
+
description: Manage IAM policies. Policies define permissions for access keys
|
|
1028
|
+
alias: p
|
|
1029
|
+
examples:
|
|
1030
|
+
- "tigris iam policies list"
|
|
1031
|
+
- "tigris iam policies get"
|
|
1032
|
+
commands:
|
|
1033
|
+
- name: list
|
|
1034
|
+
description: List all policies in the current organization
|
|
1035
|
+
alias: l
|
|
1036
|
+
examples:
|
|
1037
|
+
- "tigris iam policies list"
|
|
1038
|
+
messages:
|
|
1039
|
+
onStart: ''
|
|
1040
|
+
onSuccess: ''
|
|
1041
|
+
onFailure: 'Failed to list policies'
|
|
1042
|
+
onEmpty: 'No policies found'
|
|
1043
|
+
arguments:
|
|
1044
|
+
- name: format
|
|
1045
|
+
description: Output format
|
|
1046
|
+
alias: f
|
|
1047
|
+
options: [json, table, xml]
|
|
1048
|
+
default: table
|
|
1049
|
+
- name: get
|
|
1050
|
+
description: Show details for a policy including its document and attached users. If no ARN provided, shows interactive selection
|
|
1051
|
+
alias: g
|
|
1052
|
+
examples:
|
|
1053
|
+
- "tigris iam policies get"
|
|
1054
|
+
- "tigris iam policies get arn:aws:iam::org_id:policy/my-policy"
|
|
1055
|
+
messages:
|
|
1056
|
+
onStart: ''
|
|
1057
|
+
onSuccess: ''
|
|
1058
|
+
onFailure: 'Failed to get policy'
|
|
1059
|
+
onEmpty: 'No policies found'
|
|
1060
|
+
arguments:
|
|
1061
|
+
- name: resource
|
|
1062
|
+
description: Policy ARN. If omitted, shows interactive selection
|
|
1063
|
+
type: positional
|
|
1064
|
+
required: false
|
|
1065
|
+
examples:
|
|
1066
|
+
- arn:aws:iam::org_id:policy/my-policy
|
|
1067
|
+
- name: format
|
|
1068
|
+
description: Output format
|
|
1069
|
+
alias: f
|
|
1070
|
+
options: [json, table, xml]
|
|
1071
|
+
default: table
|
|
1072
|
+
- name: create
|
|
1073
|
+
description: Create a new policy with the given name and policy document. Document can be provided via file, inline JSON, or stdin
|
|
1074
|
+
alias: c
|
|
1075
|
+
examples:
|
|
1076
|
+
- "tigris iam policies create my-policy --document policy.json"
|
|
1077
|
+
- "tigris iam policies create my-policy --document '{\"Version\":\"2012-10-17\",\"Statement\":[...]}'"
|
|
1078
|
+
- "cat policy.json | tigris iam policies create my-policy"
|
|
1079
|
+
messages:
|
|
1080
|
+
onStart: 'Creating policy...'
|
|
1081
|
+
onSuccess: "Policy '{{name}}' created"
|
|
1082
|
+
onFailure: 'Failed to create policy'
|
|
1083
|
+
arguments:
|
|
1084
|
+
- name: name
|
|
1085
|
+
description: Policy name
|
|
1086
|
+
type: positional
|
|
1087
|
+
required: true
|
|
1088
|
+
examples:
|
|
1089
|
+
- my-policy
|
|
1090
|
+
- name: document
|
|
1091
|
+
description: Policy document (JSON file path or inline JSON). If omitted, reads from stdin
|
|
1092
|
+
alias: d
|
|
1093
|
+
required: false
|
|
1094
|
+
- name: description
|
|
1095
|
+
description: Policy description
|
|
1096
|
+
- name: edit
|
|
1097
|
+
description: Update an existing policy's document. Document can be provided via file, inline JSON, or stdin. If no ARN provided, shows interactive selection
|
|
1098
|
+
alias: e
|
|
1099
|
+
examples:
|
|
1100
|
+
- "tigris iam policies edit --document policy.json"
|
|
1101
|
+
- "tigris iam policies edit arn:aws:iam::org_id:policy/my-policy --document policy.json"
|
|
1102
|
+
- "cat policy.json | tigris iam policies edit arn:aws:iam::org_id:policy/my-policy"
|
|
1103
|
+
messages:
|
|
1104
|
+
onStart: 'Updating policy...'
|
|
1105
|
+
onSuccess: "Policy '{{resource}}' updated"
|
|
1106
|
+
onFailure: 'Failed to update policy'
|
|
1107
|
+
onEmpty: 'No policies found'
|
|
1108
|
+
arguments:
|
|
1109
|
+
- name: resource
|
|
1110
|
+
description: Policy ARN. If omitted, shows interactive selection
|
|
1111
|
+
type: positional
|
|
1112
|
+
required: false
|
|
1113
|
+
examples:
|
|
1114
|
+
- arn:aws:iam::org_id:policy/my-policy
|
|
1115
|
+
- name: document
|
|
1116
|
+
description: New policy document (JSON file path or inline JSON). If omitted, reads from stdin
|
|
1117
|
+
alias: d
|
|
1118
|
+
required: false
|
|
1119
|
+
- name: description
|
|
1120
|
+
description: Update policy description
|
|
1121
|
+
required: false
|
|
1122
|
+
- name: delete
|
|
1123
|
+
description: Delete a policy. If no ARN provided, shows interactive selection
|
|
1124
|
+
alias: d
|
|
1125
|
+
examples:
|
|
1126
|
+
- "tigris iam policies delete"
|
|
1127
|
+
- "tigris iam policies delete arn:aws:iam::org_id:policy/my-policy"
|
|
1128
|
+
messages:
|
|
1129
|
+
onStart: 'Deleting policy...'
|
|
1130
|
+
onSuccess: "Policy '{{resource}}' deleted"
|
|
1131
|
+
onFailure: 'Failed to delete policy'
|
|
1132
|
+
onEmpty: 'No policies found'
|
|
1133
|
+
arguments:
|
|
1134
|
+
- name: resource
|
|
1135
|
+
description: Policy ARN. If omitted, shows interactive selection
|
|
1136
|
+
type: positional
|
|
1137
|
+
required: false
|
|
1138
|
+
examples:
|
|
1139
|
+
- arn:aws:iam::org_id:policy/my-policy
|
package/dist/utils/format.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f}from"../chunk-CQCBYE3X.js";export{b as formatJson,f as formatOutput,a as formatSize,e as formatTable,d as formatXml,c as formatXmlObject};
|
package/dist/utils/messages.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g}from"../chunk-I52LJ637.js";import"../chunk-LY55GPPO.js";export{g as msg,e as printAlreadyDone,d as printEmpty,c as printFailure,f as printHint,a as printStart,b as printSuccess};
|
package/dist/utils/specs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-LY55GPPO.js";export{d as buildPromptChoices,c as getArgumentSpec,b as getCommandSpec,a as loadSpecs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c as b}from"../chunk-
|
|
1
|
+
import{b as a,c as b}from"../chunk-2HJMXAYU.js";import"../chunk-BP52O7NB.js";export{b as checkForUpdates,a as isNewerVersion};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tigrisdata/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Command line interface for Tigris object storage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"@aws-sdk/client-s3": "^3.908.0",
|
|
83
83
|
"@aws-sdk/credential-providers": "^3.981.0",
|
|
84
84
|
"@smithy/shared-ini-file-loader": "^4.4.3",
|
|
85
|
-
"@tigrisdata/iam": "^1.
|
|
86
|
-
"@tigrisdata/storage": "^2.
|
|
85
|
+
"@tigrisdata/iam": "^1.2.0",
|
|
86
|
+
"@tigrisdata/storage": "^2.13.0",
|
|
87
87
|
"axios": "^1.12.2",
|
|
88
88
|
"commander": "^11.0.0",
|
|
89
89
|
"enquirer": "^2.4.1",
|
package/dist/chunk-4LGKN5DA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{readFileSync as p}from"fs";import{join as a,dirname as c}from"path";import{fileURLToPath as m}from"url";import*as o from"yaml";var l=m(import.meta.url),u=c(l),s=null,f=a(u,"specs.yaml");function d(){if(!s){let n=p(f,"utf8");s=o.parse(n,{schema:"core"})}return s}function g(n,e){let r=d().commands.find(t=>t.name===n);return r?e&&r.operations?r.operations.find(t=>t.name===e)||null:r:null}function C(n,e,i){let r=g(n,i);return!r||!r.arguments?null:r.arguments.find(t=>t.name===e)||null}function h(n){return n.options?Array.isArray(n.options)&&typeof n.options[0]=="string"?n.options.map(e=>({name:e,message:e.charAt(0).toUpperCase()+e.slice(1),value:e})):Array.isArray(n.options)&&typeof n.options[0]=="object"?n.options.map(e=>({name:e.value,message:e.description?`${e.name} - ${e.description}`:e.name,value:e.value})):null:null}export{d as a,g as b,C as c,h as d};
|
package/dist/chunk-EXTBL5CE.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{a as C,c as A}from"./chunk-NYQG3EX3.js";import{a as w}from"./chunk-4LGKN5DA.js";import{Command as v}from"commander";import{existsSync as q}from"fs";import{join as c,dirname as k}from"path";import{fileURLToPath as R}from"url";process.on("unhandledRejection",e=>{(e===""||e===void 0)&&(console.error(`
|
|
2
|
-
Operation cancelled`),process.exit(1)),console.error(`
|
|
3
|
-
Error:`,e instanceof Error?e.message:e),process.exit(1)});process.on("uncaughtException",e=>{console.error(`
|
|
4
|
-
Error:`,e.message),process.exit(1)});var P=R(import.meta.url),d=k(P),r=w();function y(e,s){return(s?[c(d,"lib",e,`${s}.js`),c(d,"lib",e,s,"index.js")]:[c(d,"lib",`${e}.js`),c(d,"lib",e,"index.js")]).some(t=>q(t))}function b(e){let s;e.type==="positional"?s=` ${e.name}`:(s=` --${e.name}`,e.alias&&e.alias.length===1&&(s+=`, -${e.alias}`));let n=26,t=s.length>=n?s+" ":s.padEnd(n),o=e.description;return e.options&&(Array.isArray(e.options)&&typeof e.options[0]=="string"?o+=` (options: ${e.options.join(", ")})`:o+=` (options: ${e.options.map(i=>i.value).join(", ")})`),e.default&&(o+=` [default: ${e.default}]`),e.required&&(o+=" [required]"),e["required-when"]&&(o+=` [required when: ${e["required-when"]}]`),e.multiple&&(o+=" [multiple values: comma-separated]"),e.type==="positional"&&(o+=" [positional argument]"),e.examples&&e.examples.length>0&&(o+=` (examples: ${e.examples.join(", ")})`),`${t}${o}`}function x(e){if(console.log(`
|
|
5
|
-
${r.name} ${e.name} - ${e.description}
|
|
6
|
-
`),e.operations&&e.operations.length>0){let s=e.operations.filter(n=>y(e.name,n.name));s.length>0&&(console.log("Operations:"),s.forEach(n=>{let t=` ${n.name}`;if(n.alias){let i=Array.isArray(n.alias)?n.alias:[n.alias];t+=` (${i.join(", ")})`}let o=t.padEnd(24);console.log(`${o}${n.description}`)}),console.log())}e.arguments&&e.arguments.length>0&&(console.log("Arguments:"),e.arguments.forEach(s=>{console.log(b(s))}),console.log()),e.examples&&e.examples.length>0&&(console.log("Examples:"),e.examples.forEach(s=>{console.log(` ${s}`)}),console.log()),console.log(`Use "${r.name} ${e.name} <operation> help" for more information about an operation.`)}function U(e,s){console.log(`
|
|
7
|
-
${r.name} ${e.name} ${s.name} - ${s.description}
|
|
8
|
-
`),s.arguments&&s.arguments.length>0&&(console.log("Arguments:"),s.arguments.forEach(n=>{console.log(b(n))}),console.log()),s.examples&&s.examples.length>0&&(console.log("Examples:"),s.examples.forEach(n=>{console.log(` ${n}`)}),console.log())}function V(e){return y(e.name)?!0:e.operations?e.operations.some(s=>y(e.name,s.name)):!1}function E(){console.log(`Tigris CLI Version: ${C}
|
|
9
|
-
`),console.log(`Usage: tigris [command] [options]
|
|
10
|
-
`),console.log("Commands:"),r.commands.filter(V).forEach(s=>{let n=` ${s.name}`;s.alias&&(n+=` (${s.alias})`);let t=n.padEnd(24);console.log(`${t}${s.description}`)}),console.log(`
|
|
11
|
-
Use "${r.name} <command> help" for more information about a command.`)}function m(e,s=[]){s.forEach(n=>{if(n.type==="positional"){let t=n.required?`<${n.name}>`:`[${n.name}]`;e.argument(t,n.description)}else{let o=n.alias&&n.alias.length===1?`-${n.alias}, --${n.name}`:`--${n.name}`;n.type==="flag"||(n.type==="boolean"?o+=" [value]":n.options?o+=" <value>":o+=n.required||n["required-when"]?" <value>":" [value]"),e.option(o,n.description,n.default)}})}function g(e,s){for(let n of e){if(n["required-when"]){let[t,o]=n["required-when"].split("="),i=h(s,t,e),l=h(s,n.name,e);if(i===o&&!l)return console.error(`--${n.name} is required when --${t} is ${o}`),!1}if(n.required&&!h(s,n.name,e))return console.error(`--${n.name} is required`),!1}return!0}function h(e,s,n){if(n){let o=n.find(i=>i.name===s);if(o&&o.alias){let i=o.alias.charAt(0).toUpperCase()+o.alias.slice(1);if(e[i]!==void 0)return e[i]}}let t=[s,s.replace(/-/g,""),s.replace(/-/g,"").toLowerCase(),s.charAt(0).toUpperCase(),_(s)];for(let o of t)if(e[o]!==void 0)return e[o]}function _(e){return e.replace(/-([a-z])/g,(s,n)=>n.toUpperCase())}async function D(e,s){let n=s?[`./lib/${e}/${s}.js`,`./lib/${e}/${s}/index.js`]:[`./lib/${e}.js`,`./lib/${e}/index.js`];for(let o of n){let i=await import(o).catch(()=>null);if(i)return{module:i,error:null}}return{module:null,error:`Command not found: ${s?`${e} ${s}`:e}`}}async function $(e,s,n=[],t={},o){if(o){let j=o.replace(/\\n/g,`
|
|
12
|
-
`);console.log(j)}let{module:i,error:l}=await D(e,s);(l||!i)&&(console.error(l),process.exit(1));let a=s||e,f=i.default||i[a];typeof f!="function"&&(console.error(`Command not implemented: ${a}`),process.exit(1)),await f({...t,_positional:n})}var p=new v;p.name(r.name).description(r.description).version(r.version);function u(e,s,n){let t;"optsWithGlobals"in n&&typeof n.optsWithGlobals=="function"?t=n.optsWithGlobals():"opts"in n&&typeof n.opts=="function"?t=n.opts():t=n;let o={...t};return e.filter(l=>l.type==="positional").forEach((l,a)=>{s[a]!==void 0&&(l.multiple?o[l.name]=s[a].split(",").map(f=>f.trim()):o[l.name]=s[a])}),e.forEach(l=>{l.multiple&&l.type!=="positional"&&o[l.name]&&typeof o[l.name]=="string"&&(o[l.name]=o[l.name].split(",").map(a=>a.trim()))}),o}r.commands.forEach(e=>{let s=p.command(e.name).description(e.description);if(e.alias&&s.alias(e.alias),e.operations&&e.operations.length>0)if(e.operations.forEach(n=>{let t=s.command(n.name).description(n.description);n.alias&&(Array.isArray(n.alias)?n.alias:[n.alias]).forEach(i=>t.alias(i)),m(t,n.arguments),t.action(async(...o)=>{let i=o.pop(),l=o;n.arguments&&!g(n.arguments,u(n.arguments,l,i))||await $(e.name,n.name,l,u(n.arguments||[],l,i),n.message)}),t.command("help").description("Show help for this operation").action(()=>{U(e,n)})}),e.default){let n=e.operations?.find(t=>t.name===e.default);if(n){m(s,e.arguments),m(s,n.arguments);let t=[...e.arguments||[],...n.arguments||[]];s.action(async(...o)=>{let i=o.pop(),l=o;t.length>0&&!g(t,u(t,l,i))||await $(e.name,n.name,l,u(t,l,i),e.message||n.message)})}}else s.action(()=>{x(e)});else m(s,e.arguments),s.action(async(...n)=>{let t=n.pop(),o=n;e.arguments&&!g(e.arguments,u(e.arguments,o,t))||await $(e.name,void 0,o,u(e.arguments||[],o,t),e.message)});s.command("help").description("Show help for this command").action(()=>{x(e)})});p.command("help").description("Show general help").action(()=>{E()});p.action(()=>{E()});p.parse();A();
|
package/dist/chunk-HGIJOGCZ.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
function k(n){if(n===0)return"0 B";let e=["B","KB","MB","GB","TB"],t=Math.floor(Math.log(n)/Math.log(1024));return`${(n/Math.pow(1024,t)).toFixed(t>0?1:0)} ${e[t]}`}function l(n){return JSON.stringify(n,null,2)}function m(n){return String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function w(n,e=" "){return Object.entries(n).map(([t,r])=>`${e}<${t}>${m(r)}</${t}>`).join(`
|
|
2
|
-
`)}function T(n,e,t){let r=[`<${e}>`];return n.forEach(i=>{r.push(` <${t}>`),r.push(w(i," ")),r.push(` </${t}>`)}),r.push(`</${e}>`),r.join(`
|
|
3
|
-
`)}function f(n){if(n==null)return"";if(n instanceof Date)return h(n);if(typeof n=="string"){let e=new Date(n);if(!isNaN(e.getTime())&&n.includes("T"))return h(e)}return String(n)}function h(n){return new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)}function x(n,e){return e.map(t=>{if(t.width)return t.width;let r=t.header.length,i=n.reduce((a,u)=>{let s=f(u[t.key]);return Math.max(a,s.length)},0);return Math.max(r,i)})}function j(n,e){let t=[],r=x(n,e),i="\u250C"+r.map(o=>"\u2500".repeat(o+2)).join("\u252C")+"\u2510",a="\u251C"+r.map(o=>"\u2500".repeat(o+2)).join("\u253C")+"\u2524",u="\u2514"+r.map(o=>"\u2500".repeat(o+2)).join("\u2534")+"\u2518";t.push(`
|
|
4
|
-
`+i);let s="\u2502 "+e.map((o,c)=>o.header.padEnd(r[c])).join(" \u2502 ")+" \u2502";return t.push(s),t.push(a),n.forEach(o=>{let c=e.map((g,d)=>{let p=f(o[g.key]);return g.align==="right"?p.padStart(r[d]):p.padEnd(r[d])});t.push("\u2502 "+c.join(" \u2502 ")+" \u2502")}),t.push(u+`
|
|
5
|
-
`),t.join(`
|
|
6
|
-
`)}function $(n,e,t,r,i){switch(e){case"json":return l(n);case"xml":return T(n,t,r);default:return j(n,i)}}export{k as a,l as b,w as c,T as d,j as e,$ as f};
|
package/dist/chunk-PRJKBTQP.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as f}from"./chunk-DC3ZKGQV.js";import{a as w,c as A}from"./chunk-7F4WI32C.js";import{g as d,h as l,i as g,j as p,l as r,s as h}from"./chunk-UUITLEOI.js";import{a as u}from"./chunk-BP52O7NB.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:i}=await import("./lib/login/select.js");return await i({}),console.log(),!0}async function y(){return h()}async function k(){if(g()){let e=process.env.AWS_PROFILE||"default",s=await p(e),o=await I({profile:e})();return{accessKeyId:o.accessKeyId,secretAccessKey:o.secretAccessKey,endpoint:s.endpoint||c.endpoint||u,iamEndpoint:s.iamEndpoint||c.iamEndpoint}}let i=await y();if(i==="oauth"){let s=await f().getAccessToken();if(!d())throw new Error('No organization selected. Please run "tigris orgs select" first.');return{sessionToken:s,accessKeyId:"",secretAccessKey:"",endpoint:c.endpoint,organizationId:d()??void 0,iamEndpoint:c.iamEndpoint,authDomain:S.domain}}if(i==="credentials"){let e=r();if(e)return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,endpoint:e.endpoint}}let t=l();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(g()){let e=process.env.AWS_PROFILE||"default",s=await p(e);return new a({region:"auto",endpoint:s.endpoint||c.endpoint||u,credentials:I({profile:e})})}let i=await y();if(i==="oauth"){let s=await f().getAccessToken(),o=d();if(!o)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"]=o,await E(K)},{name:"x-Tigris-Namespace-Middleware",step:"build",override:!0}),m}if(i==="credentials"){let e=r();if(e)return new a({region:"auto",endpoint:e.endpoint,credentials:{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey}})}let t=l();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 g()||await y()!==null||l()!==null||r()!==null}export{y as a,k as b,L as c,b as d};
|
package/dist/lib/_stat.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as o}from"../chunk-LCWHZUZZ.js";async function s(t){let e=t.path||t._positional?.[0];e||(console.error("path argument is required"),process.exit(1));let{bucket:r}=o(e);r||(console.error("Invalid path"),process.exit(1)),console.error("stat command not yet implemented"),process.exit(1)}export{s as default};
|