@tigrisdata/cli 2.9.0 → 2.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +240 -1
  2. package/dist/auth/client.js +1 -1
  3. package/dist/auth/config.js +1 -1
  4. package/dist/auth/fly.js +1 -0
  5. package/dist/auth/s3-client.js +1 -1
  6. package/dist/auth/storage.js +1 -1
  7. package/dist/chunk-2XAO2OYD.js +1 -0
  8. package/dist/{chunk-CVQCUDQS.js → chunk-3R67NH6M.js} +1 -1
  9. package/dist/{chunk-UUITLEOI.js → chunk-DOUR5YEY.js} +1 -1
  10. package/dist/chunk-E4MLGABW.js +1 -0
  11. package/dist/{chunk-45XYUGOE.js → chunk-F2VBJEK7.js} +1 -1
  12. package/dist/chunk-GZ7JBHFT.js +1 -0
  13. package/dist/chunk-KH63ANUX.js +1 -0
  14. package/dist/chunk-RL37R6IA.js +8 -0
  15. package/dist/chunk-TNOMT3EP.js +4 -0
  16. package/dist/{chunk-N3NPQW3I.js → chunk-USCKVLDO.js} +1 -1
  17. package/dist/cli.js +1 -1
  18. package/dist/constants.js +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/lib/access-keys/assign.js +1 -1
  21. package/dist/lib/access-keys/create.js +1 -1
  22. package/dist/lib/access-keys/delete.js +1 -1
  23. package/dist/lib/access-keys/get.js +1 -1
  24. package/dist/lib/access-keys/list.js +1 -1
  25. package/dist/lib/buckets/create.js +1 -1
  26. package/dist/lib/buckets/delete.js +1 -1
  27. package/dist/lib/buckets/get.js +1 -1
  28. package/dist/lib/buckets/list.js +1 -1
  29. package/dist/lib/buckets/set.js +1 -1
  30. package/dist/lib/configure/index.js +1 -1
  31. package/dist/lib/cp.js +1 -1
  32. package/dist/lib/credentials/test.js +1 -1
  33. package/dist/lib/forks/create.js +1 -1
  34. package/dist/lib/forks/list.js +1 -1
  35. package/dist/lib/iam/policies/create.js +1 -1
  36. package/dist/lib/iam/policies/delete.js +1 -1
  37. package/dist/lib/iam/policies/edit.js +1 -1
  38. package/dist/lib/iam/policies/get.js +1 -1
  39. package/dist/lib/iam/policies/list.js +1 -1
  40. package/dist/lib/iam/users/invite.js +5 -0
  41. package/dist/lib/iam/users/list.js +9 -0
  42. package/dist/lib/iam/users/remove.js +5 -0
  43. package/dist/lib/iam/users/revoke-invitation.js +5 -0
  44. package/dist/lib/iam/users/update-role.js +5 -0
  45. package/dist/lib/login/credentials.js +1 -1
  46. package/dist/lib/login/oauth.js +1 -1
  47. package/dist/lib/login/select.js +1 -1
  48. package/dist/lib/logout.js +1 -1
  49. package/dist/lib/ls.js +1 -1
  50. package/dist/lib/mk.js +1 -1
  51. package/dist/lib/mv.js +1 -1
  52. package/dist/lib/objects/delete.js +1 -1
  53. package/dist/lib/objects/get.js +1 -1
  54. package/dist/lib/objects/list.js +1 -1
  55. package/dist/lib/objects/put.js +1 -1
  56. package/dist/lib/objects/set.js +1 -1
  57. package/dist/lib/organizations/create.js +5 -2
  58. package/dist/lib/organizations/list.js +2 -2
  59. package/dist/lib/organizations/select.js +1 -1
  60. package/dist/lib/rm.js +1 -1
  61. package/dist/lib/snapshots/list.js +1 -1
  62. package/dist/lib/snapshots/take.js +1 -1
  63. package/dist/lib/stat.js +1 -1
  64. package/dist/lib/touch.js +1 -1
  65. package/dist/lib/whoami.js +1 -1
  66. package/dist/specs.yaml +147 -2
  67. package/dist/utils/update-check.js +1 -1
  68. package/package.json +24 -24
  69. package/dist/chunk-7F4WI32C.js +0 -1
  70. package/dist/chunk-BP52O7NB.js +0 -1
  71. package/dist/chunk-NJKXT74Y.js +0 -1
  72. package/dist/chunk-WU7FCMUU.js +0 -4
  73. package/dist/chunk-ZUDPATIH.js +0 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tigrisdata/cli",
3
- "version": "2.9.0",
3
+ "version": "2.10.1",
4
4
  "description": "Command line interface for Tigris object storage",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,8 +24,8 @@
24
24
  "build": "tsup",
25
25
  "dev": "export $(grep -v '^#' .env | xargs) && tsup --watch",
26
26
  "cli": "node dist/cli.js",
27
- "lint": "eslint src --ext .ts",
28
- "lint:fix": "eslint src --ext .ts --fix",
27
+ "lint": "eslint src",
28
+ "lint:fix": "eslint src --fix",
29
29
  "format": "prettier --write \"src/**/*.ts\"",
30
30
  "format:check": "prettier --check \"src/**/*.ts\"",
31
31
  "test": "vitest run",
@@ -37,7 +37,7 @@
37
37
  "postinstall": "node postinstall.cjs",
38
38
  "generate:registry": "tsx scripts/generate-registry.ts",
39
39
  "build:binary": "npm run generate:registry && tsx scripts/build-binaries.ts",
40
- "build:binary:current": "bun build src/cli-binary.ts --compile --outfile=bin/tigris",
40
+ "build:binary:current": "npm run generate:registry && bun build src/cli-binary.ts --compile --outfile=bin/tigris",
41
41
  "prepublishOnly": "npm run build",
42
42
  "clean": "rm -rf dist",
43
43
  "semantic-release": "semantic-release",
@@ -82,35 +82,35 @@
82
82
  ]
83
83
  },
84
84
  "dependencies": {
85
- "@aws-sdk/client-s3": "^3.908.0",
86
- "@aws-sdk/credential-providers": "^3.981.0",
85
+ "@aws-sdk/client-s3": "^3.994.0",
86
+ "@aws-sdk/credential-providers": "^3.994.0",
87
87
  "@smithy/shared-ini-file-loader": "^4.4.3",
88
- "@tigrisdata/iam": "^1.2.0",
88
+ "@tigrisdata/iam": "^1.3.0",
89
89
  "@tigrisdata/storage": "^2.13.0",
90
- "axios": "^1.12.2",
91
- "commander": "^11.0.0",
90
+ "axios": "^1.13.5",
91
+ "commander": "^14.0.3",
92
92
  "enquirer": "^2.4.1",
93
93
  "jose": "^6.1.3",
94
- "open": "^10.2.0",
95
- "yaml": "^2.3.4"
94
+ "open": "^11.0.0",
95
+ "yaml": "^2.8.2"
96
96
  },
97
97
  "devDependencies": {
98
- "@commitlint/cli": "^20.2.0",
99
- "@commitlint/config-conventional": "^20.2.0",
98
+ "@commitlint/cli": "^20.4.2",
99
+ "@commitlint/config-conventional": "^20.4.2",
100
+ "@eslint/js": "^10.0.1",
100
101
  "@semantic-release/changelog": "^6.0.3",
101
102
  "@semantic-release/git": "^10.0.1",
102
- "@types/node": "^20.0.0",
103
- "@typescript-eslint/eslint-plugin": "^6.0.0",
104
- "@typescript-eslint/parser": "^6.0.0",
105
- "dotenv": "^17.2.3",
106
- "eslint": "^8.0.0",
107
- "husky": "^8.0.0",
108
- "prettier": "^3.0.0",
109
- "publint": "^0.2.0",
103
+ "@types/node": "^22.19.11",
104
+ "dotenv": "^17.3.1",
105
+ "eslint": "^10.0.0",
106
+ "husky": "^9.1.7",
107
+ "prettier": "^3.8.1",
108
+ "publint": "^0.3.17",
110
109
  "semantic-release": "^25.0.3",
111
- "tsup": "^8.0.0",
110
+ "tsup": "^8.5.1",
112
111
  "tsx": "^4.21.0",
113
- "typescript": "^5.0.0",
114
- "vitest": "^4.0.15"
112
+ "typescript": "^5.9.3",
113
+ "typescript-eslint": "^8.56.0",
114
+ "vitest": "^4.0.18"
115
115
  }
116
116
  }
@@ -1 +0,0 @@
1
- import{a as n,b as i}from"./chunk-BP52O7NB.js";function I(){let e=process.env.TIGRIS_ENV==="development",t=e?"auth-dev.tigris.dev":process.env.AUTH0_DOMAIN??"auth.tigris.dev",s=e?"JdJVYIyw0O1uHi5L5OJH903qaWBgd3gF":process.env.AUTH0_CLIENT_ID??"DMejqeM3CQ4IqTjEcd3oA9eEiT40hn8D",o=e?"https://tigris-api-dev":process.env.AUTH0_AUDIENCE??"https://tigris-os-api";return{domain:t,clientId:s,audience:o}}var p=process.env.TIGRIS_CLAIMS_NAMESPACE||"https://tigris";function T(){return process.env.TIGRIS_STORAGE_ENDPOINT||process.env.TIGRIS_IAM_ENDPOINT?{endpoint:process.env.TIGRIS_STORAGE_ENDPOINT||n,iamEndpoint:process.env.TIGRIS_IAM_ENDPOINT||i}:{endpoint:process.env.AWS_ENDPOINT_URL_S3||n,iamEndpoint:process.env.AWS_ENDPOINT_URL_IAM||i}}export{I as a,p as b,T as c};
@@ -1 +0,0 @@
1
- var t="https://t3.storage.dev",s="https://iam.storageapi.dev",o="https://registry.npmjs.org/@tigrisdata/cli/latest",_=864e5,e=216e5;export{t as a,s as b,o as c,_ as d,e};
@@ -1 +0,0 @@
1
- import{a as c,b as s,c as l,d as h,e as g,r as k}from"./chunk-UUITLEOI.js";import{a as p,b as u}from"./chunk-7F4WI32C.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:t}=await y(e,this.getJWKS(),{issuer:`${this.baseUrl}/`,audience:this.config.clientId});return t}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,t){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(i){if(a.isAxiosError(i)&&i.response){let r=i.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(i.response.data?.error_description||"Authentication failed")}throw i}}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 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 s(),!t)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:t.refreshToken,scope:"openid profile email offline_access"},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).data,i={accessToken:n.access_token,refreshToken:n.refresh_token||t.refreshToken,idToken:n.id_token||t.idToken,expiresAt:Date.now()+(n.expires_in||3600)*1e3};return await c(i),i}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(i=>typeof i=="object"&&i!==null?{id:i.id,name:i.name,displayName:i.name}:{id:i,name:i,displayName:i})||[];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(t=>setTimeout(t,e))}},d=null;function S(){return d||(d=new f),d}export{f as a,S as b};
@@ -1,4 +0,0 @@
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-NJKXT74Y.js";import{f as r}from"./chunk-UUITLEOI.js";var t=u("login","oauth");async function f(){s(t);try{let n=a();if(await n.isAuthenticated()){g(t);return}await n.login({onDeviceCode:(o,p)=>{console.log(`
2
- Your confirmation code: ${o}
3
- `),console.log(`If browser doesn't open, visit: ${p}`)},onWaiting:()=>console.log(`
4
- Waiting for authentication...`)});let i=await n.getOrganizations();if(i.length>0){let o=i[0];await r(o.id),e(t,{org:o.displayName||o.name}),i.length>1&&l(t,{count:i.length})}else e(t,{org:"none"})}catch{c(t),process.exit(1)}}var A=f;export{f as a,A as b};
@@ -1,8 +0,0 @@
1
- import{c as m,d,e as f}from"./chunk-BP52O7NB.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 x from"https";var u="2.9.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 k(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 j(){try{let e=x.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&&k(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)&&j()}export{u as a,k as b,V as c};