@tigrisdata/cli 2.8.0 → 2.10.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/client.js +1 -1
- package/dist/auth/config.js +1 -1
- package/dist/auth/fly.js +1 -0
- package/dist/auth/s3-client.js +1 -1
- package/dist/auth/storage.js +1 -1
- package/dist/chunk-2XAO2OYD.js +1 -0
- package/dist/chunk-4V35SYMM.js +9 -0
- package/dist/chunk-BETAO4PB.js +1 -0
- package/dist/{chunk-UUITLEOI.js → chunk-DOUR5YEY.js} +1 -1
- package/dist/chunk-E4MLGABW.js +1 -0
- package/dist/{chunk-4CKYRXYB.js → chunk-F2VBJEK7.js} +1 -1
- package/dist/chunk-GZ7JBHFT.js +1 -0
- package/dist/chunk-KH63ANUX.js +1 -0
- package/dist/chunk-N7F2D3XT.js +1 -0
- package/dist/chunk-SJCYBKF2.js +8 -0
- package/dist/{chunk-I52LJ637.js → chunk-SYGTCM6P.js} +1 -1
- package/dist/chunk-TNOMT3EP.js +4 -0
- package/dist/{chunk-2BGB3HM3.js → chunk-USCKVLDO.js} +1 -1
- package/dist/cli-core.js +1 -0
- package/dist/cli.js +1 -1
- package/dist/constants.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 +1 -1
- package/dist/lib/iam/policies/delete.js +1 -1
- package/dist/lib/iam/policies/edit.js +1 -1
- package/dist/lib/iam/policies/get.js +1 -1
- package/dist/lib/iam/policies/list.js +1 -1
- package/dist/lib/iam/users/invite.js +5 -0
- package/dist/lib/iam/users/list.js +9 -0
- package/dist/lib/iam/users/remove.js +5 -0
- package/dist/lib/iam/users/revoke-invitation.js +5 -0
- package/dist/lib/iam/users/update-role.js +5 -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 -1
- package/dist/lib/organizations/create.js +5 -2
- package/dist/lib/organizations/list.js +2 -2
- 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 -1
- package/dist/lib/touch.js +1 -1
- package/dist/lib/whoami.js +1 -1
- package/dist/specs.yaml +115 -2
- 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 +26 -23
- package/dist/chunk-2HJMXAYU.js +0 -8
- package/dist/chunk-7F4WI32C.js +0 -1
- package/dist/chunk-BP52O7NB.js +0 -1
- package/dist/chunk-DC3ZKGQV.js +0 -1
- package/dist/chunk-KBDSESA4.js +0 -4
- package/dist/chunk-LY55GPPO.js +0 -1
- package/dist/chunk-TF2BX3PY.js +0 -10
package/dist/auth/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";export{a as TigrisAuthClient,b as getAuthClient};
|
package/dist/auth/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"../chunk-
|
|
1
|
+
import{a,b,c}from"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";export{b as TIGRIS_CLAIMS_NAMESPACE,a as getAuth0Config,c as getTigrisConfig};
|
package/dist/auth/fly.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"../chunk-GZ7JBHFT.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";export{b as fetchOrganizationsFromUserInfo,a as isFlyUser};
|
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-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";export{a as getLoginMethod,c as getS3Client,b as getStorageConfig,d as isAuthenticated};
|
package/dist/auth/storage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t}from"../chunk-DOUR5YEY.js";import"../chunk-2XAO2OYD.js";export{t as clearAllData,q as clearCredentials,p as clearTemporaryCredentials,c as clearTokens,j as getAwsProfileConfig,k as getCredentials,h as getEnvCredentials,s as getLoginMethod,e as getOrganizations,m as getSavedCredentials,g as getSelectedOrganization,l as getStoredCredentials,b as getTokens,i as hasAwsProfile,n as storeCredentials,r as storeLoginMethod,d as storeOrganizations,f as storeSelectedOrganization,o as storeTemporaryCredentials,a as storeTokens};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t="https://t3.storage.dev",s="https://iam.storageapi.dev",o="https://mgmt.storageapi.dev",e="https://registry.npmjs.org/@tigrisdata/cli/latest",T=864e5,_=216e5;export{t as a,s as b,o as c,e as d,T as e,_ as f};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{Command as k}from"commander";function I(){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)})}function v(e){return/^[a-zA-Z0-9_-]+$/.test(e)}function b(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,a=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(r=>r.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(", ")})`),`${a}${n}`}function f(e,t,o){return o(t)?!0:e.commands?e.commands.some(a=>f(a,[...t,a.name],o)):!1}function y(e,t,o,a){let n=o.join(" ");if(console.log(`
|
|
5
|
+
${e.name} ${n} - ${t.description}
|
|
6
|
+
`),t.commands&&t.commands.length>0){let r=t.commands.filter(s=>f(s,[...o,s.name],a));r.length>0&&(console.log("Commands:"),r.forEach(s=>{let i=` ${s.name}`;if(s.alias){let l=Array.isArray(s.alias)?s.alias:[s.alias];i+=` (${l.join(", ")})`}let c=i.padEnd(24);console.log(`${c}${s.description}`)}),console.log())}t.arguments&&t.arguments.length>0&&(console.log("Arguments:"),t.arguments.forEach(r=>{console.log(b(r))}),console.log()),t.examples&&t.examples.length>0&&(console.log("Examples:"),t.examples.forEach(r=>{console.log(` ${r}`)}),console.log()),t.commands&&t.commands.length>0&&console.log(`Use "${e.name} ${n} <command> help" for more information about a command.`)}function x(e,t,o){console.log(`Tigris CLI Version: ${t}
|
|
7
|
+
`),console.log(`Usage: tigris [command] [options]
|
|
8
|
+
`),console.log("Commands:"),e.commands.filter(n=>f(n,[n.name],o)).forEach(n=>{let r=` ${n.name}`;if(n.alias){let i=Array.isArray(n.alias)?n.alias:[n.alias];r+=` (${i.join(", ")})`}let s=r.padEnd(24);console.log(`${s}${n.description}`)}),console.log(`
|
|
9
|
+
Use "${e.name} <command> help" for more information about a command.`)}function g(e,t=[]){t.forEach(o=>{if(o.type==="positional"){let a=o.required?`<${o.name}>`:`[${o.name}]`;e.argument(a,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 q(e){return e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase())}function C(e,t,o){if(o){let n=o.find(r=>r.name===t);if(n&&n.alias&&typeof n.alias=="string"){let r=n.alias.charAt(0).toUpperCase()+n.alias.slice(1);if(e[r]!==void 0)return e[r]}}let a=[t,t.replace(/-/g,""),t.replace(/-/g,"").toLowerCase(),t.charAt(0).toUpperCase(),q(t)];for(let n of a)if(e[n]!==void 0)return e[n]}function w(e,t){for(let o of e){if(o["required-when"]){let[a,n]=o["required-when"].split("="),r=C(t,a,e),s=C(t,o.name,e);if(r===n&&!s)return console.error(`--${o.name} is required when --${a} is ${n}`),!1}if(o.required&&!C(t,o.name,e))return console.error(`--${o.name} is required`),!1}return!0}function d(e,t,o){let a;"optsWithGlobals"in o&&typeof o.optsWithGlobals=="function"?a=o.optsWithGlobals():"opts"in o&&typeof o.opts=="function"?a=o.opts():a=o;let n={...a};return e.filter(s=>s.type==="positional").forEach((s,i)=>{t[i]!==void 0&&(s.multiple?n[s.name]=t[i].split(",").map(c=>c.trim()):n[s.name]=t[i])}),e.forEach(s=>{s.multiple&&s.type!=="positional"&&n[s.name]&&typeof n[s.name]=="string"&&(n[s.name]=n[s.name].split(",").map(i=>i.trim()))}),n}async function A(e,t,o=[],a={}){let{module:n,error:r}=await e(t);(r||!n)&&(console.error(r),process.exit(1));let s=t[t.length-1],i=n.default||n[s];typeof i!="function"&&(console.error(`Command not implemented: ${t.join(" ")}`),process.exit(1)),await i({...a,_positional:o})}function E(e,t,o,a=[]){let{specs:n,loadModule:r,hasImplementation:s}=e;for(let i of o){v(i.name)||(console.error(`Invalid command name "${i.name}": only alphanumeric, hyphens, and underscores allowed`),process.exit(1));let c=[...a,i.name];if(!f(i,c,s))continue;let l=t.command(i.name).description(i.description);if(i.alias&&(Array.isArray(i.alias)?i.alias:[i.alias]).forEach(m=>l.alias(m)),i.commands&&i.commands.length>0)if(E(e,l,i.commands,c),i.default){let p=i.commands.find(m=>m.name===i.default);if(p){g(l,i.arguments),g(l,p.arguments);let m=[...i.arguments||[],...p.arguments||[]];l.action(async(...u)=>{let $=u.pop(),h=u;m.length>0&&!w(m,d(m,h,$))||await A(r,[...c,p.name],h,d(m,h,$))})}}else l.action(()=>{y(n,i,c,s)});else g(l,i.arguments),l.action(async(...p)=>{let m=p.pop(),u=p;i.arguments&&!w(i.arguments,d(i.arguments,u,m))||await A(r,c,u,d(i.arguments||[],u,m))});l.command("help").description("Show help for this command").action(()=>{y(n,i,c,s)})}}function R(e){let{specs:t,version:o,hasImplementation:a}=e,n=new k;return n.name(t.name).description(t.description).version(o),E(e,n,t.commands),n.command("help").description("Show general help").action(()=>{x(t,o,a)}),n.action(()=>{x(t,o,a)}),n}export{I as a,v as b,b as c,f as d,y as e,x as f,g,w as h,d as i,E as j,R as k};
|
|
@@ -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),s=null,g=l(S,"specs.yaml");function x(n){s=n}function A(){if(!s){let n=p(g,"utf8");s=i.parse(n,{schema:"core"})}return s}function y(n,e){let o=A(),t=n.split(" ").filter(Boolean),r,c=o.commands;for(let m of t){if(r=c.find(a=>a.name===m),!r)return null;c=r.commands||[]}return r?e&&r.commands?r.commands.find(m=>m.name===e)||null:r:null}function P(n,e,o){let t=y(n,o);return!t||!t.arguments?null:t.arguments.find(r=>r.name===e)||null}function _(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{x as a,A as b,y as c,P as d,_ as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-2XAO2OYD.js";import{homedir as d,platform as C}from"os";import{join as r}from"path";import{readFileSync as m,writeFileSync as S,existsSync as c,mkdirSync as y,chmodSync as _}from"fs";import{execFileSync as E}from"child_process";import{loadSharedConfigFiles as I}from"@smithy/shared-ini-file-loader";var s=r(d(),".tigris"),a=r(s,"config.json");function u(n,e){if(C()==="win32")try{let i=process.env.USERNAME;i&&E("icacls",[n,"/inheritance:r","/grant:r",`${i}:F`],{stdio:"ignore"})}catch{console.warn(`Warning: Could not set restrictive permissions on ${n}. It may be accessible to other users.`)}else try{_(n,e)}catch{console.warn(`Warning: Could not set restrictive permissions on ${n}. It may be accessible to other users.`)}}function T(){c(s)||(y(s,{recursive:!0,mode:448}),u(s,448))}function o(){if(c(a))try{let n=m(a,"utf8");return JSON.parse(n)}catch{return{}}return{}}async function t(n){T(),S(a,JSON.stringify(n,null,2),{mode:384}),u(a,384)}async function h(n){let e=o();e.tokens=n,await t(e)}async function z(){return o().tokens||null}async function G(){let n=o();delete n.tokens,await t(n)}async function k(n){let e=o();e.organizations=n,await t(e)}function K(){return o().organizations||[]}async function D(n){let e=o();e.selectedOrganization=n,await t(e)}function F(){return o().selectedOrganization||null}function v(){if(process.env.TIGRIS_STORAGE_ACCESS_KEY_ID||process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY){let f=process.env.TIGRIS_STORAGE_ACCESS_KEY_ID,g=process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY;if(!f||!g)return null;let p=process.env.TIGRIS_STORAGE_ENDPOINT||l;return{accessKeyId:f,secretAccessKey:g,endpoint:p}}let n=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY;if(!n||!e)return null;let i=process.env.AWS_ENDPOINT_URL_S3||l;return{accessKeyId:n,secretAccessKey:e,endpoint:i}}function N(){if(!process.env.AWS_PROFILE)return!1;let n=r(d(),".aws");return c(r(n,"credentials"))||c(r(n,"config"))}async function b(n){try{let{configFile:e}=await I(),i=e[n];return i?{endpoint:i.endpoint_url_s3||i.endpoint_url,iamEndpoint:i.endpoint_url_iam,region:i.region}:{}}catch{return{}}}function L(){let n=o();return v()||n.temporaryCredentials||n.credentials||null}function M(){let n=o();return n.temporaryCredentials||n.credentials||null}function W(){return o().credentials||null}async function Y(n){let e=o();e.credentials=n,await t(e)}async function j(n){let e=o();e.temporaryCredentials=n,await t(e)}async function U(){let n=o();delete n.temporaryCredentials,await t(n)}async function $(){let n=o();delete n.credentials,await t(n)}async function J(n){let e=o();e.loginMethod=n,await t(e)}function q(){return o().loginMethod||null}async function B(){let e=o().credentials;await t({credentials:e})}export{h as a,z as b,G as c,k as d,K as e,D as f,F as g,v as h,N as i,b as j,L as k,M as l,W as m,Y as n,j as o,U as p,$ as q,J as r,q as s,B as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c,b as s,c as l,d as h,e as g,r as k}from"./chunk-DOUR5YEY.js";import{a as p,b as u}from"./chunk-KH63ANUX.js";import a from"axios";import w from"open";import{createRemoteJWKSet as T,jwtVerify as y}from"jose";var f=class{config;baseUrl;jwks=null;constructor(){this.config=p(),this.baseUrl=`https://${this.config.domain}`}getJWKS(){return this.jwks||(this.jwks=T(new URL(`${this.baseUrl}/.well-known/jwks.json`))),this.jwks}async verifyIdToken(e){let{payload:i}=await y(e,this.getJWKS(),{issuer:`${this.baseUrl}/`,audience:this.config.clientId});return i}async login(e){let o=(await a.post(`${this.baseUrl}/oauth/device/code`,{client_id:this.config.clientId,audience:this.config.audience,scope:"openid profile email offline_access"},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).data;e?.onDeviceCode?.(o.user_code,o.verification_uri),await this.sleep(2e3);try{await w(o.verification_uri_complete)}catch{}e?.onWaiting?.();let n=await this.pollForToken(o.device_code,o.interval||5);await c(n),k("oauth"),await this.extractAndStoreOrganizations(n.idToken)}async pollForToken(e,i){let n=0;for(;n<60;){n++;try{let r=(await a.post(`${this.baseUrl}/oauth/token`,{client_id:this.config.clientId,device_code:e,grant_type:"urn:ietf:params:oauth:grant-type:device_code"},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).data;if(!r.id_token)throw new Error("No ID token found. Please try again.");if((await this.verifyIdToken(r.id_token)).email_verified===!1)throw console.log("Email not verified. Please verify your email and try again."),new Error("Email not verified. Please verify your email and try again.");let m=Date.now()+(r.expires_in||3600)*1e3;return{accessToken:r.access_token,refreshToken:r.refresh_token,idToken:r.id_token,expiresAt:m}}catch(t){if(a.isAxiosError(t)&&t.response){let r=t.response.data?.error;if(r==="authorization_pending"){await this.sleep(i*1e3);continue}if(r==="slow_down"){i+=5,await this.sleep(i*1e3);continue}throw new Error(t.response.data?.error_description||"Authentication failed",{cause:t})}throw t}}throw new Error("Authentication timed out. Please try again.")}async getAccessToken(){let e=await s();if(!e)throw new Error('Not authenticated. Please run "tigris login" to authenticate.');let i=300*1e3;return Date.now()+i>=e.expiresAt&&(e=await this.refreshAccessToken(e)),e.accessToken}async refreshAccessToken(e){let i;if(e?.refreshToken?i=e:i=await s(),!i)throw new Error('No refresh token available. Please run "tigris login" to re-authenticate.');try{let n=(await a.post(`${this.baseUrl}/oauth/token`,{client_id:this.config.clientId,grant_type:"refresh_token",refresh_token:i.refreshToken,scope:"openid profile email offline_access"},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).data,t={accessToken:n.access_token,refreshToken:n.refresh_token||i.refreshToken,idToken:n.id_token||i.idToken,expiresAt:Date.now()+(n.expires_in||3600)*1e3};return await c(t),t}catch{throw await l(),new Error('Token refresh failed. Please run "tigris login" to re-authenticate.')}}async getIdTokenClaims(){let e=await s();if(!e||!e.idToken)throw new Error('Not authenticated. Please run "tigris login" to authenticate.');try{return await this.verifyIdToken(e.idToken)}catch{throw new Error('ID token verification failed. Please run "tigris login" to re-authenticate.')}}async extractAndStoreOrganizations(e){if(e)try{let o=(await this.verifyIdToken(e))[u];if(!o)return;let n=o?.ns?.map(t=>typeof t=="object"&&t!==null?{id:t.id,name:t.name,displayName:t.name}:{id:t,name:t,displayName:t})||[];if(n.length===0)return;h(n)}catch{}}async getOrganizations(){return await this.getAccessToken(),g()}async logout(){await l()}async isAuthenticated(){return await s()!==null}sleep(e){return new Promise(i=>setTimeout(i,e))}},d=null;function S(){return d||(d=new f),d}export{f as a,S as b};
|
|
@@ -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-SYGTCM6P.js";import{m as i,o as d,r as y}from"./chunk-DOUR5YEY.js";import{a as n}from"./chunk-2XAO2OYD.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 @@
|
|
|
1
|
+
import{a as o,b as e}from"./chunk-KH63ANUX.js";import a from"axios";function p(n){return!!n?.startsWith("flyio_")}async function u(n){try{let{domain:i}=o(),t=(await a.get(`https://${i}/userinfo`,{headers:{Authorization:`Bearer ${n}`}})).data[e]?.ns;return Array.isArray(t)?t.map(r=>({id:r.id,name:r.name,displayName:r.name})):null}catch{return null}}export{p as a,u as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as i,c as t}from"./chunk-2XAO2OYD.js";function T(){let n=process.env.TIGRIS_ENV==="development",s=n?"auth-dev.tigris.dev":process.env.AUTH0_DOMAIN??"auth.tigris.dev",o=n?"JdJVYIyw0O1uHi5L5OJH903qaWBgd3gF":process.env.AUTH0_CLIENT_ID??"DMejqeM3CQ4IqTjEcd3oA9eEiT40hn8D",r=n?"https://tigris-api-dev":process.env.AUTH0_AUDIENCE??"https://tigris-os-api";return{domain:s,clientId:o,audience:r}}var p=process.env.TIGRIS_CLAIMS_NAMESPACE||"https://tigris";function _(){return process.env.TIGRIS_STORAGE_ENDPOINT||process.env.TIGRIS_IAM_ENDPOINT?{endpoint:process.env.TIGRIS_STORAGE_ENDPOINT||e,iamEndpoint:process.env.TIGRIS_IAM_ENDPOINT||i,mgmtEndpoint:process.env.TIGRIS_MGMT_ENDPOINT||t}:{endpoint:process.env.AWS_ENDPOINT_URL_S3||e,iamEndpoint:process.env.AWS_ENDPOINT_URL_IAM||i,mgmtEndpoint:process.env.AWS_ENDPOINT_URL_MGMT||t}}export{T as a,p as b,_ as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s,c as l}from"./chunk-SJCYBKF2.js";import{b as m}from"./chunk-BETAO4PB.js";import{a as t,k as i}from"./chunk-4V35SYMM.js";import{existsSync as c}from"fs";import{join as a,dirname as u}from"path";import{fileURLToPath as f}from"url";t();var j=f(import.meta.url),d=u(j),h=m(),y=o=>{if(o.length===0)return!1;let e=a(d,"lib",...o)+".js";if(c(e))return!0;let r=a(d,"lib",...o,"index.js");return!!c(r)},b=async o=>{let e=[`./lib/${o.join("/")}.js`,`./lib/${o.join("/")}/index.js`];for(let p of e){let n=await import(p).catch(()=>null);if(n)return{module:n,error:null}}return{module:null,error:`Command not found: ${o.join(" ")}`}},x=i({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{d as m,e as d,f}from"./chunk-2XAO2OYD.js";import{readFileSync as T,writeFileSync as I,mkdirSync as N}from"fs";import{join as g}from"path";import{homedir as h}from"os";import k from"https";var u="2.10.0";var b=g(h(),".tigris","update-check.json");function y(){try{let e=T(b,"utf-8"),s=JSON.parse(e);return typeof s.latestVersion=="string"&&typeof s.lastChecked=="number"?s:null}catch{return null}}function v(e){try{N(g(h(),".tigris"),{recursive:!0}),I(b,JSON.stringify(e),"utf-8")}catch{}}function j(e,s){let a=o=>{let r=o.startsWith("v")?o.slice(1):o,c=null,l=r.indexOf("-");l!==-1&&(c=r.slice(l+1),r=r.slice(0,l));let p=r.split(".");if(p.length!==3)return null;let n=p.map(Number);return n.some(isNaN)?null:{major:n[0],minor:n[1],patch:n[2],prerelease:c}},t=a(e),i=a(s);return!t||!i?!1:i.major>t.major?!0:i.major<t.major?!1:i.minor>t.minor?!0:i.minor<t.minor?!1:i.patch>t.patch?!0:i.patch<t.patch?!1:t.prerelease&&!i.prerelease?!0:(!t.prerelease&&i.prerelease,!1)}function x(){try{let e=k.get(m,{timeout:5e3},s=>{let a="";s.on("data",t=>{a+=t}),s.on("end",()=>{try{let t=JSON.parse(a);if(typeof t.version=="string"){let i=y();v({...i,latestVersion:t.version,lastChecked:Date.now()})}}catch{}})});e.on("error",()=>{}),e.on("timeout",()=>{e.destroy()}),e.end(),e.on("socket",s=>{s.unref()})}catch{}}function V(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let e=y(),s=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||216e5;if(e&&j(u,e.latestVersion)&&(!e.lastNotified||Date.now()-e.lastNotified>s)){let t=globalThis.__TIGRIS_BINARY===!0,i=process.platform==="win32",o=`Update available: ${u} \u2192 ${e.latestVersion}`,r;t?i?r="Run `irm https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.ps1 | iex`":r="Run `curl -fsSL https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.sh | sh`":r="Run `npm install -g @tigrisdata/cli` to upgrade.";let c=Math.max(o.length,r.length)+4,l="\u250C"+"\u2500".repeat(c-2)+"\u2510",p="\u2514"+"\u2500".repeat(c-2)+"\u2518",n=_=>"\u2502 "+_.padEnd(c-4)+" \u2502";console.log(`
|
|
2
|
+
${l}
|
|
3
|
+
${n("")}
|
|
4
|
+
${n(o)}
|
|
5
|
+
${n(r)}
|
|
6
|
+
${n("")}
|
|
7
|
+
${p}
|
|
8
|
+
`),v({...e,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||864e5;(!e||Date.now()-e.lastChecked>a)&&x()}export{u as a,j as b,V as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as u}from"./chunk-BETAO4PB.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};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as s,b as e,c,e as g,f as l,g as u}from"./chunk-SYGTCM6P.js";import{b as a}from"./chunk-E4MLGABW.js";import{f as r}from"./chunk-DOUR5YEY.js";var t=u("login","oauth");async function f(){s(t);try{let i=a();if(await i.isAuthenticated()){g(t);return}await i.login({onDeviceCode:(o,p)=>{console.log(`
|
|
2
|
+
Your confirmation code: ${o}
|
|
3
|
+
`),console.log(`If browser doesn't open, visit: ${p}`)},onWaiting:()=>console.log(`
|
|
4
|
+
Waiting for authentication...`)});let n=await i.getOrganizations();if(n.length>0){let o=n[0];await r(o.id),e(t,{org:o.displayName||o.name}),n.length>1&&l(t,{count:n.length})}else e(t,{org:"none"})}catch{c(t),process.exit(1)}}var A=f;export{f as a,A as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as f}from"./chunk-
|
|
1
|
+
import{b as f}from"./chunk-E4MLGABW.js";import{g as u,h as d,i as l,j as p,l as r,s as h}from"./chunk-DOUR5YEY.js";import{a as w,c as A}from"./chunk-KH63ANUX.js";import{a as g}from"./chunk-2XAO2OYD.js";import{S3Client as a}from"@aws-sdk/client-s3";import{fromIni as I}from"@aws-sdk/credential-providers";var c=A(),S=w(),C=!1;async function T(){if(C||!process.stdin.isTTY)return!1;C=!0,console.log(`Not authenticated. Starting login...
|
|
2
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};
|
package/dist/cli-core.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-4V35SYMM.js";export{g as addArgumentsToCommand,d as commandHasAnyImplementation,k as createProgram,i as extractArgumentValues,c as formatArgumentHelp,b as isValidCommandName,j as registerCommands,a as setupErrorHandlers,e as showCommandHelp,f as showMainHelp,h as validateRequiredWhen};
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-N7F2D3XT.js";import"./chunk-SJCYBKF2.js";import"./chunk-BETAO4PB.js";import"./chunk-4V35SYMM.js";import"./chunk-2XAO2OYD.js";
|
package/dist/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunk-2XAO2OYD.js";export{b as DEFAULT_IAM_ENDPOINT,c as DEFAULT_MGMT_ENDPOINT,a as DEFAULT_STORAGE_ENDPOINT,d as NPM_REGISTRY_URL,e as UPDATE_CHECK_INTERVAL_MS,f as UPDATE_NOTIFY_INTERVAL_MS};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-N7F2D3XT.js";import"./chunk-SJCYBKF2.js";import"./chunk-BETAO4PB.js";import"./chunk-4V35SYMM.js";import"./chunk-2XAO2OYD.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as A,b as l,c as t,g as R}from"../../chunk-SYGTCM6P.js";import{a as n}from"../../chunk-JRALYIRA.js";import{a as b}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as k}from"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import{c as p}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{assignBucketRoles as C,revokeAllBucketRoles as N}from"@tigrisdata/iam";var e=R("access-keys","assign"),x=["Editor","ReadOnly","NamespaceAdmin"];function y(o){return o?Array.isArray(o)?o:[o]:[]}async function E(o){A(e);let c=n(o,["id"]),g=n(o,["admin"]),d=n(o,["revokeRoles","revoke-roles"]),r=y(n(o,["bucket","b"])),s=y(n(o,["role","r"]));c||(t(e,"Access key ID is required"),process.exit(1)),g&&d&&(t(e,"Cannot use --admin and --revoke-roles together"),process.exit(1)),await b()!=="oauth"&&(t(e,`Bucket roles can only be managed when logged in via OAuth.
|
|
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
|
|
1
|
+
import{a as g,b as l,c as t,g as m}from"../../chunk-SYGTCM6P.js";import{a as u}from"../../chunk-JRALYIRA.js";import{a as d}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as a}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createAccessKey as y}from"@tigrisdata/iam";var e=m("access-keys","create");async function w(f){g(e);let i=u(f,["name"]);i||(t(e,"Access key name is required"),process.exit(1)),await d()!=="oauth"&&(t(e,`Access keys can only be created when logged in via OAuth.
|
|
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,b as g,c as e,g as d}from"../../chunk-SYGTCM6P.js";import{a as f}from"../../chunk-JRALYIRA.js";import{a as m}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as c}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c as s}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeAccessKey as A}from"@tigrisdata/iam";var t=d("access-keys","delete");async function k(u){a(t);let i=f(u,["id"]);i||(e(t,"Access key ID is required"),process.exit(1)),await m()!=="oauth"&&(e(t,`Access keys can only be deleted when logged in via OAuth.
|
|
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
|
|
1
|
+
import{a as l,b as d,c as t,g as f}from"../../chunk-SYGTCM6P.js";import{a as m}from"../../chunk-JRALYIRA.js";import{a as u}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as g}from"../../chunk-E4MLGABW.js";import{g as a}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getAccessKey as $}from"@tigrisdata/iam";var e=f("access-keys","get");async function w(p){l(e);let i=m(p,["id"]);i||(t(e,"Access key ID is required"),process.exit(1)),await u()!=="oauth"&&(t(e,`Access keys can only be retrieved when logged in via OAuth.
|
|
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-SYGTCM6P.js";import{f}from"../../chunk-CQCBYE3X.js";import{a as p}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import{b as d}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listAccessKeys as w}from"@tigrisdata/iam";var t=l("access-keys","list");async function x(){g(t),await p()!=="oauth"&&(s(t,`Access keys can only be listed when logged in via OAuth.
|
|
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
|
|
1
|
+
import{a as S,b as x,c as b,g as k}from"../../chunk-SYGTCM6P.js";import{a as c}from"../../chunk-JRALYIRA.js";import{b as v}from"../../chunk-USCKVLDO.js";import{d,e as f}from"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import A from"enquirer";import{createBucket as I}from"@tigrisdata/storage";var{prompt:T}=A,h=k("buckets","create");async function C(a){S(h);let t=!c(a,["name"]),u=c(a,["name"]),g=t?void 0:c(a,["access","a","A"]),l=t?void 0:c(a,["enable-snapshots","s","S"]),m=t?void 0:c(a,["default-tier","t","T"]),p=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}),!g||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(!m||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(!p||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,g=g||e.access,l=l!==void 0?l:e.enableSnapshots,m=m||e.defaultTier,p=p||e.consistency,r=r!==void 0?r:e.region}u||(b(h,"Bucket name is required"),process.exit(1));let{error:y}=await I(u,{defaultTier:m??"STANDARD",consistency:p==="strict"?"strict":"default",enableSnapshot:l===!0,access:g,region:r!=="global"&&r!==void 0?r.split(","):void 0,config:await v()});y&&(b(h,y.message),process.exit(1)),x(h,{name:u})}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as i,b as s,c as o,g as c}from"../../chunk-SYGTCM6P.js";import{a as m}from"../../chunk-JRALYIRA.js";import{b as a}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeBucket as g}from"@tigrisdata/storage";var e=c("buckets","delete");async function k(f){i(e);let t=m(f,["name"]);t||(o(e,"Bucket name is required"),process.exit(1));let p=Array.isArray(t)?t:[t],u=await a();for(let r of p){let{error:n}=await g(r,{config:u});n&&(o(e,n.message,{name:r}),process.exit(1)),s(e,{name:r})}}export{k as default};
|
package/dist/lib/buckets/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as s,b as p,c as r,g as n}from"../../chunk-SYGTCM6P.js";import{f as i}from"../../chunk-CQCBYE3X.js";import{a as c}from"../../chunk-JRALYIRA.js";import{b as u}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getBucketInfo as l}from"@tigrisdata/storage";var t=n("buckets","get");async function g(m){s(t);let o=c(m,["name"]);o||(r(t,"Bucket name is required"),process.exit(1));let{data:e,error:a}=await l(o,{config:await u()});a&&(r(t,a.message),process.exit(1));let f=[{property:"Name",value:o},{property:"Snapshots Enabled",value:e.isSnapshotEnabled?"Yes":"No"},{property:"Has Forks",value:e.hasForks?"Yes":"No"},...e.sourceBucketName?[{property:"Source Bucket",value:e.sourceBucketName}]:[],...e.sourceBucketSnapshot?[{property:"Source Snapshot",value:e.sourceBucketSnapshot}]:[]],k=i(f,"table","bucket","property",[{key:"property",header:"Property"},{key:"value",header:"Value"}]);console.log(k),p(t)}export{g as default};
|
package/dist/lib/buckets/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as c,b as i,c as r,d as m,g as u}from"../../chunk-SYGTCM6P.js";import{f as g}from"../../chunk-CQCBYE3X.js";import{a as f}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as d}from"@tigrisdata/storage";var t=u("buckets","list");async function b(k){c(t);try{let e=f(k,["format","F"],"table"),{data:o,error:n}=await d({config:await p()});if(n&&(r(t,n.message),process.exit(1)),!o.buckets||o.buckets.length===0){m(t);return}let s=o.buckets.map(a=>({name:a.name,created:a.creationDate})),l=g(s,e,"buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(l),i(t,{count:s.length})}catch(e){e instanceof Error?r(t,e.message):r(t,"An unknown error occurred"),process.exit(1)}}export{b as default};
|
package/dist/lib/buckets/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as O,b as y,c,g as w}from"../../chunk-SYGTCM6P.js";import{a as e,b as r}from"../../chunk-JRALYIRA.js";import{b as k}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as D}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.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-SYGTCM6P.js";import"../../chunk-BETAO4PB.js";import{n as u,r as y}from"../../chunk-DOUR5YEY.js";import{a as d}from"../../chunk-2XAO2OYD.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,c=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret,r=e.endpoint||e.e||e.E||e.Endpoint;if(!s||!c||!r){let t=[];s||t.push({type:"input",name:"accessKey",message:"Tigris Access Key ID:",required:!0}),c||t.push({type:"password",name:"accessSecret",message:"Tigris Secret Access Key:",required:!0}),r||t.push({type:"input",name:"endpoint",message:"Tigris Endpoint:",required:!0,initial:d});let a=await l(t);s=s||a.accessKey,c=c||a.accessSecret,r=r||a.endpoint}(!s||!c||!r)&&(n(i,"All credentials are required"),process.exit(1));try{await u({accessKeyId:s,secretAccessKey:c,endpoint:r}),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 $}from"../chunk-CQCBYE3X.js";import{a as v}from"../chunk-JRALYIRA.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-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.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
|
|
1
|
+
import{a as f,b as g,c as n,g as u}from"../../chunk-SYGTCM6P.js";import{a as d}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as a}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as m,getBucketInfo as p}from"@tigrisdata/storage";var e=u("credentials","test");async function b(k){f(e);let t=d(k,["bucket","b"]),o=await l();!o.accessKeyId&&!o.sessionToken&&(n(e,'No credentials found. Run "tigris configure" or "tigris login" first.'),process.exit(1));let c=a(),r={...o,...c&&!o.organizationId?{organizationId:c}:{}};if(t){let{data:i,error:s}=await p(t,{config:r});s&&(n(e,`Current credentials don't have access to bucket "${t}"`),process.exit(1)),console.log(` Bucket: ${t}`),console.log(" Access verified."),i.sourceBucketName&&console.log(` Fork of: ${i.sourceBucketName}`)}else{let{data:i,error:s}=await m({config:r});s&&(n(e,"Current credentials don't have sufficient access"),process.exit(1)),console.log(` Access verified. Found ${i.buckets.length} bucket(s).`)}g(e)}export{b as default};
|
package/dist/lib/forks/create.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as c,b as a,c as r,g as m}from"../../chunk-SYGTCM6P.js";import{a as t}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createBucket as p}from"@tigrisdata/storage";var e=m("forks","create");async function g(o){c(e);let s=t(o,["name"]),n=t(o,["fork-name","forkName"]),u=t(o,["snapshot","s","S"]);s||(r(e,"Source bucket name is required"),process.exit(1)),n||(r(e,"Fork name is required"),process.exit(1));let{error:i}=await p(n,{sourceBucketName:s,sourceBucketSnapshot:u,config:await f()});i&&(r(e,i.message),process.exit(1)),a(e,{name:s,forkName:n})}export{g as default};
|
package/dist/lib/forks/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as u,b as p,c as n,d as s,g}from"../../chunk-SYGTCM6P.js";import{f as d}from"../../chunk-CQCBYE3X.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as k}from"../../chunk-USCKVLDO.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as S,getBucketInfo as l}from"@tigrisdata/storage";var t=g("forks","list");async function B(c){u(t);let e=i(c,["name"]),h=i(c,["format","f","F"],"table");e||(n(t,"Source bucket name is required"),process.exit(1));let a=await k(),{data:b,error:f}=await l(e,{config:a});if(f&&(n(t,f.message),process.exit(1)),!b.hasForks){s(t);return}let{data:w,error:m}=await S({config:a});m&&(n(t,m.message),process.exit(1));let r=[];for(let o of w.buckets){if(o.name===e)continue;let{data:y}=await l(o.name,{config:a});y?.sourceBucketName===e&&r.push({name:o.name,created:o.creationDate})}if(r.length===0){s(t);return}let x=d(r,h,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(x),p(t,{count:r.length})}export{B as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as x,b as P}from"../../../chunk-Y7MJZRR4.js";import{a as
|
|
1
|
+
import{a as x,b as P}from"../../../chunk-Y7MJZRR4.js";import{a as p,b as f,c as e,g as h}from"../../../chunk-SYGTCM6P.js";import{a as n}from"../../../chunk-JRALYIRA.js";import{a as y}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as g}from"../../../chunk-E4MLGABW.js";import{g as u}from"../../../chunk-DOUR5YEY.js";import{c as l}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as T,readFileSync as C}from"fs";import{addPolicy as k}from"@tigrisdata/iam";var t=h("iam policies","create");async function N(s){p(t);let r=n(s,["name"]),i=n(s,["document","d"]),w=n(s,["description"])??"";r||(e(t,"Policy name is required"),process.exit(1)),/^[a-zA-Z0-9=,.@_-]+$/.test(r)||(e(t,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed."),process.exit(1)),await y()!=="oauth"&&(e(t,`Policies can only be created when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),process.exit(1));let c=g();await c.isAuthenticated()||(e(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let A=await c.getAccessToken(),v=u(),S=l(),O={sessionToken:A,organizationId:v??void 0,iamEndpoint:S.iamEndpoint},o;i?T(i)?o=C(i,"utf-8"):o=i:process.stdin.isTTY?(e(t,"Policy document is required. Provide via --document or pipe to stdin."),process.exit(1)):o=await x();let a;try{a=P(o)}catch{e(t,"Invalid JSON in policy document"),process.exit(1)}let{data:d,error:m}=await k(r,{document:a,description:w,config:O});m&&(e(t,m.message),process.exit(1)),f(t,{name:d.name}),console.log(`Resource: ${d.resource}`)}export{N as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as p,b as d,c as t,d as f,g as u}from"../../../chunk-SYGTCM6P.js";import{a as w}from"../../../chunk-JRALYIRA.js";import{a as h}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as m}from"../../../chunk-E4MLGABW.js";import{g}from"../../../chunk-DOUR5YEY.js";import{c as l}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import E from"enquirer";import{deletePolicy as S,listPolicies as T}from"@tigrisdata/iam";var{prompt:O}=E,e=u("iam policies","delete");async function M(x){p(e);let i=w(x,["resource"]);await h()!=="oauth"&&(t(e,`Policies can only be deleted when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),process.exit(1));let s=m();await s.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let y=await s.getAccessToken(),A=g(),C=l(),r={sessionToken:y,organizationId:A??void 0,iamEndpoint:C.iamEndpoint};if(!i){let{data:o,error:a}=await T({config:r});if(a&&(t(e,a.message),process.exit(1)),!o.policies||o.policies.length===0){f(e);return}let{selected:k}=await O({type:"select",name:"selected",message:"Select a policy to delete:",choices:o.policies.map(n=>({name:n.resource,message:`${n.name} (${n.resource})`}))});i=k}let{error:c}=await S(i,{config:r});c&&(t(e,c.message),process.exit(1)),d(e,{resource:i})}export{M as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as O,b as p}from"../../../chunk-Y7MJZRR4.js";import{a as
|
|
1
|
+
import{a as O,b as p}from"../../../chunk-Y7MJZRR4.js";import{a as S,b as A,c as t,d as P,g as T}from"../../../chunk-SYGTCM6P.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as E}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as w}from"../../../chunk-E4MLGABW.js";import{g as x}from"../../../chunk-DOUR5YEY.js";import{c as y}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as N,readFileSync as R}from"fs";import q from"enquirer";import{editPolicy as M,getPolicy as z,listPolicies as F}from"@tigrisdata/iam";var{prompt:I}=q,e=T("iam policies","edit");async function Y(c){S(e);let o=r(c,["resource"]),n=r(c,["document","d"]),a=r(c,["description"]);await E()!=="oauth"&&(t(e,`Policies can only be edited when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),process.exit(1));let g=w();await g.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let C=await g.getAccessToken(),D=x(),k=y(),d={sessionToken:C,organizationId:D??void 0,iamEndpoint:k.iamEndpoint};if(!o){process.stdin.isTTY||(t(e,"Policy ARN is required when piping document via stdin."),process.exit(1));let{data:i,error:h}=await F({config:d});if(h&&(t(e,h.message),process.exit(1)),!i.policies||i.policies.length===0){P(e);return}let{selected:J}=await I({type:"select",name:"selected",message:"Select a policy to edit:",choices:i.policies.map(m=>({name:m.resource,message:`${m.name} (${m.resource})`}))});o=J}let s;if(n){let i;N(n)?i=R(n,"utf-8"):i=n;try{s=p(i)}catch{t(e,"Invalid JSON in policy document"),process.exit(1)}}else if(!process.stdin.isTTY&&!a){let i=await O();try{s=p(i)}catch{t(e,"Invalid JSON in policy document"),process.exit(1)}}!s&&!a&&(t(e,"Either --document or --description is required."),process.exit(1));let{data:l,error:u}=await z(o,{config:d});u&&(t(e,u.message),process.exit(1));let{data:v,error:f}=await M(o,{document:s??l.document,description:a??l.description,config:d});f&&(t(e,f.message),process.exit(1)),A(e,{resource:v.resource})}export{Y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as y,b as r,c as i,d as v,g as A}from"../../../chunk-SYGTCM6P.js";import{f as O}from"../../../chunk-CQCBYE3X.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as S}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as h}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{c as m}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import E from"enquirer";import{getPolicy as P,listPolicies as R}from"@tigrisdata/iam";var{prompt:I}=E,o=A("iam policies","get");async function T(a){y(o);let n=c(a,["resource"]),l=c(a,["format","f","F"],"table");await S()!=="oauth"&&(i(o,`Policies can only be retrieved when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),process.exit(1));let u=h();await u.isAuthenticated()||(i(o,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let w=await u.getAccessToken(),C=p(),$=m(),f={sessionToken:w,organizationId:C??void 0,iamEndpoint:$.iamEndpoint};if(!n){let{data:t,error:d}=await R({config:f});if(d&&(i(o,d.message),process.exit(1)),!t.policies||t.policies.length===0){v(o);return}let{selected:D}=await I({type:"select",name:"selected",message:"Select a policy:",choices:t.policies.map(s=>({name:s.resource,message:`${s.name} (${s.resource})`}))});n=D}let{data:e,error:g}=await P(n,{config:f});if(g&&(i(o,g.message),process.exit(1)),l==="json"){console.log(JSON.stringify(e,null,2)),r(o);return}let k=[{field:"Name",value:e.name},{field:"ID",value:e.id},{field:"Resource",value:e.resource},{field:"Description",value:e.description||"-"},{field:"Path",value:e.path},{field:"Version",value:e.defaultVersionId},{field:"Attachments",value:String(e.attachmentCount)},{field:"Created",value:e.createDate.toISOString()},{field:"Updated",value:e.updateDate.toISOString()}],x=O(k,l,"policy","field",[{key:"field",header:"Field"},{key:"value",header:"Value"}]);if(console.log(x),e.users&&e.users.length>0){console.log("Attached Users:");for(let t of e.users)console.log(` - ${t}`);console.log()}console.log("Policy Document:"),console.log(` Version: ${e.document.version}`),console.log(" Statements:");for(let t of e.document.statements)console.log(` - Effect: ${t.effect}`),console.log(` Action: ${Array.isArray(t.action)?t.action.join(", "):t.action}`),console.log(` Resource: ${Array.isArray(t.resource)?t.resource.join(", "):t.resource}`);r(o)}export{T as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as m,b as p,c as i,d as u,g}from"../../../chunk-SYGTCM6P.js";import{f as l}from"../../../chunk-CQCBYE3X.js";import{a as f}from"../../../chunk-JRALYIRA.js";import{a as h}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as d}from"../../../chunk-E4MLGABW.js";import{g as c}from"../../../chunk-DOUR5YEY.js";import{c as s}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{listPolicies as O}from"@tigrisdata/iam";var e=g("iam policies","list");async function D(k){m(e);let A=f(k,["format","f","F"],"table");await h()!=="oauth"&&(i(e,`Policies can only be listed when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),process.exit(1));let n=d();await n.isAuthenticated()||(i(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let w=await n.getAccessToken(),C=c(),x=s(),{data:o,error:r}=await O({config:{sessionToken:w,organizationId:C??void 0,iamEndpoint:x.iamEndpoint}});if(r&&(i(e,r.message),process.exit(1)),!o.policies||o.policies.length===0){u(e);return}let a=o.policies.map(t=>({name:t.name,id:t.id,resource:t.resource,description:t.description||"-",attachments:t.attachmentCount,created:t.createDate,updated:t.updateDate})),y=l(a,A,"policies","policy",[{key:"id",header:"ID"},{key:"resource",header:"Resource"},{key:"name",header:"Name"},{key:"description",header:"Description"},{key:"attachments",header:"Attachments"},{key:"created",header:"Created"},{key:"updated",header:"Updated"}]);console.log(y),p(e,{count:a.length})}export{D as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as h,b as y,c as t,g as v}from"../../../chunk-SYGTCM6P.js";import{a as s}from"../../../chunk-JRALYIRA.js";import{a as R}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as u}from"../../../chunk-DOUR5YEY.js";import{a as p}from"../../../chunk-GZ7JBHFT.js";import{c as d}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{inviteUser as E}from"@tigrisdata/iam";var i=v("iam users","invite");async function O(r){h(i),await R()!=="oauth"&&(t(i,`Users can only be invited when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),process.exit(1));let a=u();if(p(a??void 0)){console.log(`User management is not available for Fly.io organizations.
|
|
3
|
+
Your users are managed through Fly.io.
|
|
4
|
+
|
|
5
|
+
Visit https://fly.io to manage your organization members.`);return}let e=s(r,["email"]),o=s(r,["role","r"])??"member",n=Array.isArray(e)?e:e?[e]:[];n.length===0&&(t(i,"Email address is required"),process.exit(1));let m=["admin","member"];m.includes(o)||(t(i,`Invalid role "${o}". Must be one of: ${m.join(", ")}`),process.exit(1));let A=o,c=f();await c.isAuthenticated()||(t(i,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let b=await c.getAccessToken(),l=d(),x=n.map(w=>({email:w,role:A})),{error:g}=await E(x,{config:{sessionToken:b,organizationId:a??void 0,iamEndpoint:l.iamEndpoint,mgmtEndpoint:l.mgmtEndpoint}});g&&(t(i,g.message),process.exit(1)),y(i,{email:n.join(", ")})}export{O as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{a as y,b as k,c as i,d as b,g as C}from"../../../chunk-SYGTCM6P.js";import{b as T,d as s,e as a}from"../../../chunk-CQCBYE3X.js";import{a as w}from"../../../chunk-JRALYIRA.js";import{a as U}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as h}from"../../../chunk-E4MLGABW.js";import{g as f}from"../../../chunk-DOUR5YEY.js";import{a as p}from"../../../chunk-GZ7JBHFT.js";import{c as u}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{listUsers as A}from"@tigrisdata/iam";var n=C("iam users","list");async function O(v){y(n);let r=w(v,["format","f","F"],"table");await U()!=="oauth"&&(i(n,`Users can only be listed when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),process.exit(1));let l=f();if(p(l??void 0)){console.log(`User management is not available for Fly.io organizations.
|
|
3
|
+
Your users are managed through Fly.io.
|
|
4
|
+
|
|
5
|
+
Visit https://fly.io to manage your organization members.`);return}let m=h();await m.isAuthenticated()||(i(n,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let E=await m.getAccessToken(),g=u(),{data:c,error:d}=await A({config:{sessionToken:E,organizationId:l??void 0,iamEndpoint:g.iamEndpoint,mgmtEndpoint:g.mgmtEndpoint}});d&&(i(n,d.message),process.exit(1));let t=c.users.map(e=>({email:e.email,name:e.userName||"-",role:e.isOrgOwner?"owner":e.role,userId:e.userId})),o=c.invitations.map(e=>({id:e.id,email:e.email,role:e.role,status:e.status,validUntil:e.validUntil.toLocaleDateString()}));if(t.length===0&&o.length===0){b(n);return}let I=[{key:"email",header:"Email"},{key:"name",header:"Name"},{key:"role",header:"Role"},{key:"userId",header:"User ID"}],x=[{key:"id",header:"ID"},{key:"email",header:"Email"},{key:"role",header:"Role"},{key:"status",header:"Status"},{key:"validUntil",header:"Valid Until"}];if(r==="json")console.log(T({users:t,invitations:o}));else if(r==="xml"){let e=["<organization>"];e.push(" "+s(t,"users","user").replace(/\n/g,`
|
|
6
|
+
`)),e.push(" "+s(o,"invitations","invitation").replace(/\n/g,`
|
|
7
|
+
`)),e.push("</organization>"),console.log(e.join(`
|
|
8
|
+
`))}else t.length>0&&(console.log(`
|
|
9
|
+
Members`),console.log(a(t,I))),o.length>0&&(console.log("Pending Invitations"),console.log(a(o,x)));let z=t.length+o.length;k(n,{count:z})}export{O as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as h,b as y,c as t,d as w,g as v}from"../../../chunk-SYGTCM6P.js";import{a as O}from"../../../chunk-JRALYIRA.js";import{a as A}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{a as d}from"../../../chunk-GZ7JBHFT.js";import{c as u}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import C from"enquirer";import{removeUser as k,listUsers as z}from"@tigrisdata/iam";var{prompt:F}=C,e=v("iam users","remove");async function S(U){h(e);let o=O(U,["resource"]);await A()!=="oauth"&&(t(e,`Users can only be removed when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),process.exit(1));let n=p();if(d(n??void 0)){console.log(`User management is not available for Fly.io organizations.
|
|
3
|
+
Your users are managed through Fly.io.
|
|
4
|
+
|
|
5
|
+
Visit https://fly.io to manage your organization members.`);return}let s=f();await s.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let x=await s.getAccessToken(),a=u(),m={sessionToken:x,organizationId:n??void 0,iamEndpoint:a.iamEndpoint,mgmtEndpoint:a.mgmtEndpoint},r=Array.isArray(o)?o:o?[o]:[];if(r.length===0){let{data:g,error:l}=await z({config:m});if(l&&(t(e,l.message),process.exit(1)),g.users.length===0){w(e);return}let{selected:E}=await F({type:"multiselect",name:"selected",message:"Select user(s) to remove (space to select, enter to confirm):",choices:g.users.map(i=>({name:i.userId,message:`${i.email} (${i.isOrgOwner?"owner":i.role})`}))});r=E}let{error:c}=await k(r,{config:m});c&&(t(e,c.message),process.exit(1)),y(e)}export{S as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as h,b as v,c as e,d as y,g as k}from"../../../chunk-SYGTCM6P.js";import{a as A}from"../../../chunk-JRALYIRA.js";import{a as w}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{a as d}from"../../../chunk-GZ7JBHFT.js";import{c as u}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import I from"enquirer";import{revokeInvitation as z,listUsers as F}from"@tigrisdata/iam";var{prompt:O}=I,t=k("iam users","revoke-invitation");async function S(x){h(t);let i=A(x,["resource"]);await w()!=="oauth"&&(e(t,`Invitations can only be revoked when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),process.exit(1));let r=p();if(d(r??void 0)){console.log(`User management is not available for Fly.io organizations.
|
|
3
|
+
Your users are managed through Fly.io.
|
|
4
|
+
|
|
5
|
+
Visit https://fly.io to manage your organization members.`);return}let s=f();await s.isAuthenticated()||(e(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let E=await s.getAccessToken(),a=u(),c={sessionToken:E,organizationId:r??void 0,iamEndpoint:a.iamEndpoint,mgmtEndpoint:a.mgmtEndpoint},n=Array.isArray(i)?i:i?[i]:[];if(n.length===0){let{data:m,error:l}=await F({config:c});if(l&&(e(t,l.message),process.exit(1)),m.invitations.length===0){y(t);return}let{selected:C}=await O({type:"multiselect",name:"selected",message:"Select invitation(s) to revoke (space to select, enter to confirm):",choices:m.invitations.map(o=>({name:o.id,message:`${o.email} (${o.role} - ${o.status})`}))});n=C}let{error:g}=await z(n,{config:c});g&&(e(t,g.message),process.exit(1)),v(t)}export{S as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as b,b as x,c as t,d as O,g as U}from"../../../chunk-SYGTCM6P.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as v}from"../../../chunk-USCKVLDO.js";import"../../../chunk-BETAO4PB.js";import{b as w}from"../../../chunk-E4MLGABW.js";import{g as R}from"../../../chunk-DOUR5YEY.js";import{a as A}from"../../../chunk-GZ7JBHFT.js";import{c as y}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import k from"enquirer";import{updateUserRole as F,listUsers as M}from"@tigrisdata/iam";var{prompt:z}=k,e=U("iam users","update-role");async function S(m){b(e),await v()!=="oauth"&&(t(e,`User roles can only be updated when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),process.exit(1));let g=R();if(A(g??void 0)){console.log(`User management is not available for Fly.io organizations.
|
|
3
|
+
Your users are managed through Fly.io.
|
|
4
|
+
|
|
5
|
+
Visit https://fly.io to manage your organization members.`);return}let u=["admin","member"],s=c(m,["role","r"]);s||(t(e,"Role is required. Use --role admin or --role member"),process.exit(1));let o=Array.isArray(s)?s:[s];for(let r of o)u.includes(r)||(t(e,`Invalid role "${r}". Must be one of: ${u.join(", ")}`),process.exit(1));let n=c(m,["resource"]),i=Array.isArray(n)?n:n?[n]:[],p=w();await p.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let E=await p.getAccessToken(),d=y(),f={sessionToken:E,organizationId:g??void 0,iamEndpoint:d.iamEndpoint,mgmtEndpoint:d.mgmtEndpoint};if(i.length===0){let{data:r,error:a}=await M({config:f});if(a&&(t(e,a.message),process.exit(1)),r.users.length===0){O(e);return}let{selected:C}=await z({type:"multiselect",name:"selected",message:"Select user(s) to update (space to select, enter to confirm):",choices:r.users.map(l=>({name:l.userId,message:`${l.email} (${l.isOrgOwner?"owner":l.role})`}))});i=C}o.length>1&&o.length!==i.length&&(t(e,`Number of roles (${o.length}) must match number of users (${i.length}), or provide a single role for all users`),process.exit(1));let $=i.map((r,a)=>({userId:r,role:o.length===1?o[0]:o[a]})),{error:h}=await F($,{config:f});h&&(t(e,h.message),process.exit(1)),x(e)}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-F2VBJEK7.js";import"../../chunk-SYGTCM6P.js";import"../../chunk-BETAO4PB.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-2XAO2OYD.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-TNOMT3EP.js";import"../../chunk-SYGTCM6P.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.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-F2VBJEK7.js";import{a as s}from"../../chunk-TNOMT3EP.js";import"../../chunk-SYGTCM6P.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.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-SYGTCM6P.js";import"../chunk-BETAO4PB.js";import{t as e}from"../chunk-DOUR5YEY.js";import"../chunk-2XAO2OYD.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 k,f as c}from"../chunk-CQCBYE3X.js";import{a as u}from"../chunk-JRALYIRA.js";import{f as p}from"../chunk-LCWHZUZZ.js";import{b as i}from"../chunk-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{list as w,listBuckets as z}from"@tigrisdata/storage";async function S(g){let d=u(g,["path"]);if(!d){let e=await i(),{data:t,error:o}=await z({config:e});o&&(console.error(o.message),process.exit(1));let s=(t.buckets||[]).map(l=>({name:l.name,created:l.creationDate})),a=c(s,"table","buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(a);return}let{bucket:f,path:r}=p(d);f||(console.error("Invalid path"),process.exit(1));let h=await i(),n=r?r.endsWith("/")?r:`${r}/`:void 0,{data:y,error:m}=await w({prefix:n,config:{...h,bucket:f}});m&&(console.error(m.message),process.exit(1));let b=(y.items||[]).map(e=>{let t=n?e.name.slice(n.length):e.name,o=t.indexOf("/"),s=o===-1?t:t.slice(0,o+1),a=s.endsWith("/");return{key:s,size:a?"-":k(e.size),modified:e.lastModified}}).filter((e,t,o)=>e.key!==""&&o.findIndex(s=>s.key===e.key)===t),x=c(b,"table","objects","object",[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}]);console.log(x)}export{S as default};
|
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-USCKVLDO.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.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};
|