@tigrisdata/cli 2.4.0 → 2.5.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.
Files changed (43) hide show
  1. package/dist/auth/client.js +1 -1
  2. package/dist/auth/config.js +1 -1
  3. package/dist/auth/s3-client.js +1 -1
  4. package/dist/auth/storage.js +1 -1
  5. package/dist/cli.js +5 -5
  6. package/dist/constants.js +1 -0
  7. package/dist/index.js +5 -5
  8. package/dist/lib/access-keys/assign.js +3 -3
  9. package/dist/lib/access-keys/create.js +3 -3
  10. package/dist/lib/access-keys/delete.js +3 -3
  11. package/dist/lib/access-keys/get.js +3 -3
  12. package/dist/lib/access-keys/list.js +8 -8
  13. package/dist/lib/buckets/create.js +2 -2
  14. package/dist/lib/buckets/delete.js +2 -2
  15. package/dist/lib/buckets/get.js +7 -7
  16. package/dist/lib/buckets/list.js +7 -7
  17. package/dist/lib/buckets/set.js +2 -2
  18. package/dist/lib/configure/index.js +2 -2
  19. package/dist/lib/cp.js +1 -1
  20. package/dist/lib/credentials/test.js +2 -2
  21. package/dist/lib/forks/create.js +2 -2
  22. package/dist/lib/forks/list.js +7 -7
  23. package/dist/lib/login/credentials.js +2 -2
  24. package/dist/lib/login/oauth.js +3 -3
  25. package/dist/lib/login/select.js +4 -4
  26. package/dist/lib/logout.js +2 -2
  27. package/dist/lib/ls.js +5 -5
  28. package/dist/lib/mk.js +1 -1
  29. package/dist/lib/mv.js +1 -1
  30. package/dist/lib/objects/delete.js +2 -2
  31. package/dist/lib/objects/get.js +2 -2
  32. package/dist/lib/objects/list.js +7 -7
  33. package/dist/lib/objects/put.js +7 -7
  34. package/dist/lib/organizations/create.js +3 -3
  35. package/dist/lib/organizations/list.js +7 -7
  36. package/dist/lib/organizations/select.js +5 -5
  37. package/dist/lib/rm.js +1 -1
  38. package/dist/lib/snapshots/list.js +6 -6
  39. package/dist/lib/snapshots/take.js +2 -2
  40. package/dist/lib/touch.js +1 -1
  41. package/dist/lib/whoami.js +3 -3
  42. package/dist/specs.yaml +131 -80
  43. package/package.json +3 -1
@@ -1,3 +1,3 @@
1
- import{listOrganizations as ue}from"@tigrisdata/iam";import w from"axios";import Z from"open";function f(){return{domain:process.env.AUTH0_DOMAIN||"auth.tigris.dev",clientId:process.env.AUTH0_CLIENT_ID||"DMejqeM3CQ4IqTjEcd3oA9eEiT40hn8D",audience:process.env.AUTH0_AUDIENCE||"https://tigris-os-api"}}var E=process.env.TIGRIS_CLAIMS_NAMESPACE||"https://tigris";function z(){return{endpoint:process.env.TIGRIS_STORAGE_ENDPOINT||"https://t3.storage.dev",iamEndpoint:process.env.TIGRIS_IAM_ENDPOINT||"https://iam.storageapi.dev"}}import{homedir as J}from"os";import{join as N}from"path";import{readFileSync as Y,writeFileSync as B,existsSync as b,mkdirSync as W}from"fs";import{chmod as Q}from"fs/promises";var A=N(J(),".tigris"),m=N(A,"config.json");function X(){b(A)||W(A,{recursive:!0,mode:448})}function c(){if(b(m))try{let t=Y(m,"utf8");return JSON.parse(t)}catch{return{}}return{}}async function h(t){X(),B(m,JSON.stringify(t,null,2),{mode:384});try{await Q(m,384)}catch{}}async function S(t){let e=c();e.tokens=t,await h(e)}async function d(){return c().tokens||null}async function x(){let t=c();delete t.tokens,await h(t)}async function D(t){let e=c();e.organizations=t,await h(e)}function $(){return c().organizations||[]}function l(){return c().selectedOrganization||null}function C(){let t=c();return t.temporaryCredentials||t.credentials||null}async function K(t){let e=c();e.loginMethod=t,await h(e)}function y(){return c().loginMethod||null}var _=class{config;baseUrl;constructor(){this.config=f(),this.baseUrl=`https://${this.config.domain}`}async login(e){let o=(await w.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 Z(o.verification_uri_complete)}catch{}e?.onWaiting?.();let i=await this.pollForToken(o.device_code,o.interval||5);await S(i),K("oauth"),await this.extractAndStoreOrganizations(i.idToken)}async pollForToken(e,n){let i=0;for(;i<60;){i++;try{let r=(await w.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,a=Date.now()+(r.expires_in||3600)*1e3;return{accessToken:r.access_token,refreshToken:r.refresh_token,idToken:r.id_token,expiresAt:a}}catch(s){if(w.isAxiosError(s)&&s.response){let r=s.response.data?.error;if(r==="authorization_pending"){await this.sleep(n*1e3);continue}if(r==="slow_down"){n+=5,await this.sleep(n*1e3);continue}throw new Error(s.response.data?.error_description||"Authentication failed")}throw s}}throw new Error("Authentication timed out. Please try again.")}async getAccessToken(){let e=await d();if(!e)throw new Error('Not authenticated. Please run "tigris login" to authenticate.');let n=300*1e3;return Date.now()+n>=e.expiresAt&&(e=await this.refreshAccessToken(e)),e.accessToken}async refreshAccessToken(e){let n=null;if(e?.refreshToken?n=e:n=await d(),!n)throw new Error('No refresh token available. Please run "tigris login" to re-authenticate.');try{let i=(await w.post(`${this.baseUrl}/oauth/token`,{client_id:this.config.clientId,grant_type:"refresh_token",refresh_token:n.refreshToken,scope:"openid profile email offline_access"},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).data,s={accessToken:i.access_token,refreshToken:i.refresh_token||n.refreshToken,idToken:i.id_token||n.idToken,expiresAt:Date.now()+(i.expires_in||3600)*1e3};return await S(s),s}catch{throw await x(),new Error('Token refresh failed. Please run "tigris login" to re-authenticate.')}}async getIdTokenClaims(){let e=await d();if(!e||!e.idToken)throw new Error('Not authenticated. Please run "tigris login" to authenticate.');try{let n=e.idToken.split(".")[1],o=Buffer.from(n,"base64").toString("utf8");return JSON.parse(o)}catch{throw new Error("Failed to decode ID token")}}async extractAndStoreOrganizations(e){if(e)try{let n=e.split(".")[1],o=Buffer.from(n,"base64").toString("utf8"),s=JSON.parse(o)[E];if(!s)return;let r=s?.ns?.map(a=>typeof a=="object"&&a!==null?{id:a.id,name:a.name,displayName:a.name}:{id:a,name:a,displayName:a})||[];if(r.length===0)return;D(r)}catch{}}async getOrganizations(){return await this.getAccessToken(),$()}async logout(){await x()}async isAuthenticated(){return await d()!==null}sleep(e){return new Promise(n=>setTimeout(n,e))}},v=null;function T(){return v||(v=new _),v}import{S3Client as _e}from"@aws-sdk/client-s3";var L=z(),ee=f();async function te(){return y()}async function R(){if(await te()==="oauth"){let o=await T().getAccessToken();if(!l())throw new Error('No organization selected. Please run "tigris orgs select" first.');let s=L.endpoint,r=L.iamEndpoint,a=ee.domain;return{sessionToken:o,accessKeyId:"",secretAccessKey:"",endpoint:s,organizationId:l()??void 0,iamEndpoint:r,authDomain:a}}let e=C();if(e)return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,endpoint:e.endpoint};throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}import{readFileSync as ne,existsSync as ie}from"fs";import{join as F,dirname as oe}from"path";import{fileURLToPath as se}from"url";import*as U from"yaml";var re=se(import.meta.url),ae=oe(re),I=null;function ce(){let t=ae;for(let e=0;e<5;e++){let n=F(t,"specs.yaml");if(ie(n))return n;t=F(t,"..")}throw new Error("Could not find specs.yaml")}function ge(){if(!I){let t=ce(),e=ne(t,"utf8");I=U.parse(e)}return I}function j(t,e){let o=ge().commands.find(i=>i.name===t);return o?e&&o.operations?o.operations.find(i=>i.name===e)||null:o:null}var de={success:"\u2714",failure:"\u2716",hint:"\u2192"};function le(){return process.stdout.isTTY===!0}function G(t){let e=j(t.command,t.operation);if(e)return e.messages}function V(t,e){let n=t;return n=n.replace(/\\n/g,`
2
- `),e&&(n=n.replace(/\{\{(\w+)\}\}/g,(o,i)=>{let s=e[i];return s!==void 0?String(s):`{{${i}}}`})),n}function k(t,e,n){let o=G(t);o?.onFailure&&console.error(`${de.failure} ${V(o.onFailure,n)}`),e&&console.error(` ${e}`)}function M(t,e){if(!le())return;let n=G(t);n?.onAlreadyDone&&console.log(V(n.onAlreadyDone,e))}function q(t,e){return{command:t,operation:e}}var u=q("whoami");async function pe(){try{let t=y(),e=C(),n,o;if(t==="oauth"){let s=T();if(!await s.isAuthenticated()){M(u);return}let a=await s.getIdTokenClaims();n=a.email,o=a.sub}else if(e)n=void 0,o=e.accessKeyId;else{M(u);return}let i=[];if(i.push(""),i.push("User Information:"),i.push(` Email: ${n||"N/A"}`),i.push(` User ID: ${o||"N/A"}`),t==="oauth"){let s=await R(),r=l(),{data:a,error:O}=await ue({config:s});O&&(k(u,O.message),process.exit(1));let p=a?.organizations??[];if(p.length>0){if(i.push(""),i.push(`Organizations (${p.length}):`),p.forEach(g=>{let H=g.id===r?">":" ";i.push(` ${H} ${g.name} (${g.id})`)}),r){let g=p.find(P=>P.id===r);g&&(i.push(""),i.push(`Active: ${g.name}`))}}else i.push(""),i.push("Organizations: None")}else i.push(""),i.push("Login method: Access Key Credentials"),i.push(" (Organization listing requires OAuth login: tigris login)");i.push(""),console.log(i.join(`
3
- `))}catch(t){t instanceof Error?k(u,t.message):k(u),process.exit(1)}}export{pe as default};
1
+ import{listOrganizations as Ae}from"@tigrisdata/iam";import S from"axios";import re from"open";var d="https://t3.storage.dev",E="https://iam.storageapi.dev";function h(){let n=process.env.TIGRIS_ENV==="development",e=process.env.AUTH0_DOMAIN||n?"auth-dev.tigris.dev":"auth.tigris.dev",t=process.env.AUTH0_CLIENT_ID||n?"JdJVYIyw0O1uHi5L5OJH903qaWBgd3gF":"DMejqeM3CQ4IqTjEcd3oA9eEiT40hn8D",o=process.env.AUTH0_AUDIENCE||n?"https://tigris-api-dev":"https://tigris-os-api";return{domain:e,clientId:t,audience:o}}var b=process.env.TIGRIS_CLAIMS_NAMESPACE||"https://tigris";function L(){return process.env.TIGRIS_STORAGE_ENDPOINT||process.env.TIGRIS_IAM_ENDPOINT?{endpoint:process.env.TIGRIS_STORAGE_ENDPOINT||d,iamEndpoint:process.env.TIGRIS_IAM_ENDPOINT||E}:{endpoint:process.env.AWS_ENDPOINT_URL_S3||d,iamEndpoint:process.env.AWS_ENDPOINT_URL_IAM||E}}import{homedir as G}from"os";import{join as g}from"path";import{readFileSync as ee,writeFileSync as ne,existsSync as C,mkdirSync as te}from"fs";import{loadSharedConfigFiles as ie}from"@smithy/shared-ini-file-loader";import{chmod as oe}from"fs/promises";var v=g(G(),".tigris"),y=g(v,"config.json");function se(){C(v)||te(v,{recursive:!0,mode:448})}function c(){if(C(y))try{let n=ee(y,"utf8");return JSON.parse(n)}catch{return{}}return{}}async function T(n){se(),ne(y,JSON.stringify(n,null,2),{mode:384});try{await oe(y,384)}catch{}}async function x(n){let e=c();e.tokens=n,await T(e)}async function p(){return c().tokens||null}async function k(){let n=c();delete n.tokens,await T(n)}async function F(n){let e=c();e.organizations=n,await T(e)}function U(){return c().organizations||[]}function u(){return c().selectedOrganization||null}function O(){if(process.env.TIGRIS_STORAGE_ACCESS_KEY_ID||process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY){let o=process.env.TIGRIS_STORAGE_ACCESS_KEY_ID,i=process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY;if(!o||!i)return null;let s=process.env.TIGRIS_STORAGE_ENDPOINT||d;return{accessKeyId:o,secretAccessKey:i,endpoint:s}}let n=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY;if(!n||!e)return null;let t=process.env.AWS_ENDPOINT_URL_S3||d;return{accessKeyId:n,secretAccessKey:e,endpoint:t}}function $(){if(!process.env.AWS_PROFILE)return!1;let n=g(G(),".aws");return C(g(n,"credentials"))||C(g(n,"config"))}async function j(n){try{let{configFile:e}=await ie(),t=e[n];return t?{endpoint:t.endpoint_url_s3||t.endpoint_url,iamEndpoint:t.endpoint_url_iam,region:t.region}:{}}catch{return{}}}function W(){let n=c();return O()||n.temporaryCredentials||n.credentials||null}function P(){let n=c();return n.temporaryCredentials||n.credentials||null}async function Y(n){let e=c();e.loginMethod=n,await T(e)}function A(){return c().loginMethod||null}var M=class{config;baseUrl;constructor(){this.config=h(),this.baseUrl=`https://${this.config.domain}`}async login(e){let o=(await S.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 re(o.verification_uri_complete)}catch{}e?.onWaiting?.();let i=await this.pollForToken(o.device_code,o.interval||5);await x(i),Y("oauth"),await this.extractAndStoreOrganizations(i.idToken)}async pollForToken(e,t){let i=0;for(;i<60;){i++;try{let r=(await S.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,a=Date.now()+(r.expires_in||3600)*1e3;return{accessToken:r.access_token,refreshToken:r.refresh_token,idToken:r.id_token,expiresAt:a}}catch(s){if(S.isAxiosError(s)&&s.response){let r=s.response.data?.error;if(r==="authorization_pending"){await this.sleep(t*1e3);continue}if(r==="slow_down"){t+=5,await this.sleep(t*1e3);continue}throw new Error(s.response.data?.error_description||"Authentication failed")}throw s}}throw new Error("Authentication timed out. Please try again.")}async getAccessToken(){let e=await p();if(!e)throw new Error('Not authenticated. Please run "tigris login" to authenticate.');let t=300*1e3;return Date.now()+t>=e.expiresAt&&(e=await this.refreshAccessToken(e)),e.accessToken}async refreshAccessToken(e){let t=null;if(e?.refreshToken?t=e:t=await p(),!t)throw new Error('No refresh token available. Please run "tigris login" to re-authenticate.');try{let i=(await S.post(`${this.baseUrl}/oauth/token`,{client_id:this.config.clientId,grant_type:"refresh_token",refresh_token:t.refreshToken,scope:"openid profile email offline_access"},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).data,s={accessToken:i.access_token,refreshToken:i.refresh_token||t.refreshToken,idToken:i.id_token||t.idToken,expiresAt:Date.now()+(i.expires_in||3600)*1e3};return await x(s),s}catch{throw await k(),new Error('Token refresh failed. Please run "tigris login" to re-authenticate.')}}async getIdTokenClaims(){let e=await p();if(!e||!e.idToken)throw new Error('Not authenticated. Please run "tigris login" to authenticate.');try{let t=e.idToken.split(".")[1],o=Buffer.from(t,"base64").toString("utf8");return JSON.parse(o)}catch{throw new Error("Failed to decode ID token")}}async extractAndStoreOrganizations(e){if(e)try{let t=e.split(".")[1],o=Buffer.from(t,"base64").toString("utf8"),s=JSON.parse(o)[b];if(!s)return;let r=s?.ns?.map(a=>typeof a=="object"&&a!==null?{id:a.id,name:a.name,displayName:a.name}:{id:a,name:a,displayName:a})||[];if(r.length===0)return;F(r)}catch{}}async getOrganizations(){return await this.getAccessToken(),U()}async logout(){await k()}async isAuthenticated(){return await p()!==null}sleep(e){return new Promise(t=>setTimeout(t,e))}},N=null;function _(){return N||(N=new M),N}import{S3Client as Le}from"@aws-sdk/client-s3";import{fromIni as ae}from"@aws-sdk/credential-providers";var w=L(),ce=h();async function de(){return A()}async function V(){if($()){let o=process.env.AWS_PROFILE||"default",i=await j(o),s=await ae({profile:o})();return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,endpoint:i.endpoint||w.endpoint||d,iamEndpoint:i.iamEndpoint||w.iamEndpoint}}let n=await de();if(n==="oauth"){let i=await _().getAccessToken();if(!u())throw new Error('No organization selected. Please run "tigris orgs select" first.');return{sessionToken:i,accessKeyId:"",secretAccessKey:"",endpoint:w.endpoint,organizationId:u()??void 0,iamEndpoint:w.iamEndpoint,authDomain:ce.domain}}if(n==="credentials"){let o=P();if(o)return{accessKeyId:o.accessKeyId,secretAccessKey:o.secretAccessKey,endpoint:o.endpoint}}let e=O();if(e)return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,endpoint:e.endpoint};let t=P();if(t)return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:t.endpoint};throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}import{readFileSync as le,existsSync as ge}from"fs";import{join as q,dirname as pe}from"path";import{fileURLToPath as ue}from"url";import*as H from"yaml";var fe=ue(import.meta.url),me=pe(fe),D=null;function he(){let n=me;for(let e=0;e<5;e++){let t=q(n,"specs.yaml");if(ge(t))return t;n=q(n,"..")}throw new Error("Could not find specs.yaml")}function Ce(){if(!D){let n=he(),e=le(n,"utf8");D=H.parse(e)}return D}function J(n,e){let o=Ce().commands.find(i=>i.name===n);return o?e&&o.operations?o.operations.find(i=>i.name===e)||null:o:null}var ye={success:"\u2714",failure:"\u2716",hint:"\u2192"};function Te(){return process.stdout.isTTY===!0}function B(n){let e=J(n.command,n.operation);if(e)return e.messages}function Q(n,e){let t=n;return t=t.replace(/\\n/g,`
2
+ `),e&&(t=t.replace(/\{\{(\w+)\}\}/g,(o,i)=>{let s=e[i];return s!==void 0?String(s):`{{${i}}}`})),t}function I(n,e,t){let o=B(n);o?.onFailure&&console.error(`${ye.failure} ${Q(o.onFailure,t)}`),e&&console.error(` ${e}`)}function K(n,e){if(!Te())return;let t=B(n);t?.onAlreadyDone&&console.log(Q(t.onAlreadyDone,e))}function X(n,e){return{command:n,operation:e}}var f=X("whoami");async function Se(){try{let n=A(),e=W(),t,o;if(n==="oauth"){let s=_();if(!await s.isAuthenticated()){K(f);return}let a=await s.getIdTokenClaims();t=a.email,o=a.sub}else if(e)t=void 0,o=e.accessKeyId;else{K(f);return}let i=[];if(i.push(""),i.push("User Information:"),i.push(` Email: ${t||"N/A"}`),i.push(` User ID: ${o||"N/A"}`),n==="oauth"){let s=await V(),r=u(),{data:a,error:R}=await Ae({config:s});R&&(I(f,R.message),process.exit(1));let m=a?.organizations??[];if(m.length>0){if(i.push(""),i.push(`Organizations (${m.length}):`),m.forEach(l=>{let Z=l.id===r?">":" ";i.push(` ${Z} ${l.name} (${l.id})`)}),r){let l=m.find(z=>z.id===r);l&&(i.push(""),i.push(`Active: ${l.name}`))}}else i.push(""),i.push("Organizations: None")}else i.push(""),i.push("Login method: Access Key Credentials"),i.push(" (Organization listing requires OAuth login: tigris login)");i.push(""),console.log(i.join(`
3
+ `))}catch(n){n instanceof Error?I(f,n.message):I(f),process.exit(1)}}export{Se as default};
package/dist/specs.yaml CHANGED
@@ -79,7 +79,7 @@ commands:
79
79
  #########################
80
80
  # configure
81
81
  - name: configure
82
- description: Save credentials permanently. After running this, all commands work automatically
82
+ description: Save credentials permanently. After running this, all commands uses these credentials.
83
83
  alias: c
84
84
  messages:
85
85
  onStart: 'Saving credentials...'
@@ -189,84 +189,6 @@ commands:
189
189
  alias: b
190
190
  required: false
191
191
 
192
- # access-keys
193
- - name: access-keys
194
- description: Manage access keys
195
- alias: keys
196
- operations:
197
- - name: list
198
- description: List all access keys
199
- alias: l
200
- messages:
201
- onStart: ''
202
- onSuccess: ''
203
- onFailure: 'Failed to list access keys'
204
- onEmpty: 'No access keys found'
205
- - name: create
206
- description: Create a new access key
207
- alias: c
208
- messages:
209
- onStart: 'Creating access key...'
210
- onSuccess: 'Access key created'
211
- onFailure: 'Failed to create access key'
212
- arguments:
213
- - name: name
214
- description: Name for the access key
215
- type: positional
216
- required: true
217
- - name: delete
218
- description: Delete an access key
219
- alias: d
220
- messages:
221
- onStart: 'Deleting access key...'
222
- onSuccess: 'Access key deleted'
223
- onFailure: 'Failed to delete access key'
224
- arguments:
225
- - name: id
226
- description: Access key ID
227
- type: positional
228
- required: true
229
- - name: get
230
- description: Get details of an access key
231
- alias: g
232
- messages:
233
- onStart: ''
234
- onSuccess: ''
235
- onFailure: 'Failed to get access key'
236
- arguments:
237
- - name: id
238
- description: Access key ID
239
- type: positional
240
- required: true
241
- - name: assign
242
- description: Assign bucket roles to an access key
243
- alias: a
244
- messages:
245
- onStart: 'Assigning bucket roles...'
246
- onSuccess: 'Bucket roles assigned'
247
- onFailure: 'Failed to assign bucket roles'
248
- arguments:
249
- - name: id
250
- description: Access key ID
251
- type: positional
252
- required: true
253
- - name: bucket
254
- alias: b
255
- description: Bucket name (can specify multiple)
256
- multiple: true
257
- - name: role
258
- alias: r
259
- description: Role to assign (can specify multiple to pair with buckets)
260
- multiple: true
261
- options:
262
- - Editor
263
- - ReadOnly
264
- - name: admin
265
- description: Grant admin access to all buckets in the organization
266
- type: flag
267
- - name: revoke-roles
268
- description: Revoke all bucket roles from the access key
269
- type: flag
270
192
 
271
193
  #########################
272
194
  # Unix style commands
@@ -426,6 +348,8 @@ commands:
426
348
  type: positional
427
349
  required: true
428
350
  description: Name of the organization
351
+ examples:
352
+ - my-organization
429
353
  - name: select
430
354
  description: Select the organization to use
431
355
  alias: s
@@ -438,6 +362,8 @@ commands:
438
362
  type: positional
439
363
  required: true
440
364
  description: Name of the organization
365
+ examples:
366
+ - my-organization
441
367
 
442
368
  #########################
443
369
  # Manage buckets
@@ -464,7 +390,7 @@ commands:
464
390
  # create
465
391
  - name: create
466
392
  description: Create bucket
467
- alias: [c]
393
+ alias: c
468
394
  messages:
469
395
  onStart: 'Creating bucket...'
470
396
  onSuccess: "Bucket '{{name}}' created successfully"
@@ -474,6 +400,8 @@ commands:
474
400
  description: Name of the bucket
475
401
  type: positional
476
402
  required: false
403
+ examples:
404
+ - my-bucket
477
405
  - name: access
478
406
  description: Access level
479
407
  alias: a
@@ -512,6 +440,8 @@ commands:
512
440
  description: Name of the bucket
513
441
  type: positional
514
442
  required: true
443
+ examples:
444
+ - my-bucket
515
445
  # delete
516
446
  - name: delete
517
447
  description: Delete bucket
@@ -526,6 +456,8 @@ commands:
526
456
  type: positional
527
457
  required: true
528
458
  multiple: true
459
+ examples:
460
+ - my-bucket
529
461
  # set
530
462
  - name: set
531
463
  description: Update bucket settings
@@ -539,6 +471,8 @@ commands:
539
471
  description: Name of the bucket
540
472
  type: positional
541
473
  required: true
474
+ examples:
475
+ - my-bucket
542
476
  - name: access
543
477
  description: Bucket access level
544
478
  options: *access_options
@@ -581,6 +515,8 @@ commands:
581
515
  description: Name of the source bucket
582
516
  type: positional
583
517
  required: true
518
+ examples:
519
+ - my-bucket
584
520
  - name: format
585
521
  description: Output format
586
522
  alias: f
@@ -599,10 +535,14 @@ commands:
599
535
  description: Name of the source bucket
600
536
  type: positional
601
537
  required: true
538
+ examples:
539
+ - my-bucket
602
540
  - name: fork-name
603
541
  description: Name for the new fork
604
542
  type: positional
605
543
  required: true
544
+ examples:
545
+ - my-fork
606
546
  - name: snapshot
607
547
  description: Create fork from a specific snapshot
608
548
  alias: s
@@ -628,6 +568,8 @@ commands:
628
568
  description: Name of the bucket
629
569
  type: positional
630
570
  required: true
571
+ examples:
572
+ - my-bucket
631
573
  - name: format
632
574
  description: Output format
633
575
  alias: f
@@ -646,10 +588,14 @@ commands:
646
588
  description: Name of the bucket
647
589
  type: positional
648
590
  required: true
591
+ examples:
592
+ - my-bucket
649
593
  - name: snapshot-name
650
594
  description: Name of the snapshot (optional)
651
595
  type: positional
652
596
  required: false
597
+ examples:
598
+ - my-snapshot
653
599
 
654
600
  #########################
655
601
  # Manage objects
@@ -672,6 +618,8 @@ commands:
672
618
  description: Name of the bucket
673
619
  type: positional
674
620
  required: true
621
+ examples:
622
+ - my-bucket
675
623
  - name: prefix
676
624
  description: Filter objects by prefix
677
625
  alias: p
@@ -693,10 +641,14 @@ commands:
693
641
  description: Name of the bucket
694
642
  type: positional
695
643
  required: true
644
+ examples:
645
+ - my-bucket
696
646
  - name: key
697
647
  description: Key of the object
698
648
  type: positional
699
649
  required: true
650
+ examples:
651
+ - my-file.txt
700
652
  - name: output
701
653
  description: Output file path (if not specified, prints to stdout)
702
654
  alias: o
@@ -717,14 +669,20 @@ commands:
717
669
  description: Name of the bucket
718
670
  type: positional
719
671
  required: true
672
+ examples:
673
+ - my-bucket
720
674
  - name: key
721
675
  description: Key for the object
722
676
  type: positional
723
677
  required: true
678
+ examples:
679
+ - my-file.txt
724
680
  - name: file
725
681
  description: Path to the file to upload
726
682
  type: positional
727
683
  required: true
684
+ examples:
685
+ - ./my-file.txt
728
686
  - name: access
729
687
  description: Access level
730
688
  alias: a
@@ -751,8 +709,101 @@ commands:
751
709
  description: Name of the bucket
752
710
  type: positional
753
711
  required: true
712
+ examples:
713
+ - my-bucket
754
714
  - name: key
755
715
  description: Key of the object (comma separated for multiple)
756
716
  type: positional
757
717
  required: true
758
718
  multiple: true
719
+ examples:
720
+ - my-file.txt
721
+
722
+ #########################
723
+ # Manage access keys
724
+ #########################
725
+ - name: access-keys
726
+ description: Manage access keys
727
+ alias: keys
728
+ operations:
729
+ - name: list
730
+ description: List all access keys
731
+ alias: l
732
+ messages:
733
+ onStart: ''
734
+ onSuccess: ''
735
+ onFailure: 'Failed to list access keys'
736
+ onEmpty: 'No access keys found'
737
+ - name: create
738
+ description: Create a new access key
739
+ alias: c
740
+ messages:
741
+ onStart: 'Creating access key...'
742
+ onSuccess: 'Access key created'
743
+ onFailure: 'Failed to create access key'
744
+ arguments:
745
+ - name: name
746
+ description: Name for the access key
747
+ type: positional
748
+ required: true
749
+ examples:
750
+ - my-key
751
+ - name: delete
752
+ description: Delete an access key
753
+ alias: d
754
+ messages:
755
+ onStart: 'Deleting access key...'
756
+ onSuccess: 'Access key deleted'
757
+ onFailure: 'Failed to delete access key'
758
+ arguments:
759
+ - name: id
760
+ description: Access key ID
761
+ type: positional
762
+ required: true
763
+ examples:
764
+ - tid_AaBbCcDdEeFf
765
+ - name: get
766
+ description: Get details of an access key
767
+ alias: g
768
+ messages:
769
+ onStart: ''
770
+ onSuccess: ''
771
+ onFailure: 'Failed to get access key'
772
+ arguments:
773
+ - name: id
774
+ description: Access key ID
775
+ type: positional
776
+ required: true
777
+ examples:
778
+ - tid_AaBbCcDdEeFf
779
+ - name: assign
780
+ description: Assign bucket roles to an access key
781
+ alias: a
782
+ messages:
783
+ onStart: 'Assigning bucket roles...'
784
+ onSuccess: 'Bucket roles assigned'
785
+ onFailure: 'Failed to assign bucket roles'
786
+ arguments:
787
+ - name: id
788
+ description: Access key ID
789
+ type: positional
790
+ required: true
791
+ examples:
792
+ - tid_AaBbCcDdEeFf
793
+ - name: bucket
794
+ alias: b
795
+ description: Bucket name (can specify multiple)
796
+ multiple: true
797
+ - name: role
798
+ alias: r
799
+ description: Role to assign (can specify multiple to pair with buckets)
800
+ multiple: true
801
+ options:
802
+ - Editor
803
+ - ReadOnly
804
+ - name: admin
805
+ description: Grant admin access to all buckets in the organization
806
+ type: flag
807
+ - name: revoke-roles
808
+ description: Revoke all bucket roles from the access key
809
+ type: flag
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tigrisdata/cli",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Command line interface for Tigris object storage",
5
5
  "type": "module",
6
6
  "exports": {
@@ -78,6 +78,8 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "@aws-sdk/client-s3": "^3.908.0",
81
+ "@aws-sdk/credential-providers": "^3.981.0",
82
+ "@smithy/shared-ini-file-loader": "^4.4.3",
81
83
  "@tigrisdata/iam": "^1.1.0",
82
84
  "@tigrisdata/storage": "^2.12.0",
83
85
  "axios": "^1.12.2",