@tigrisdata/cli 3.11.0 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/client.js +1 -1
- package/dist/auth/iam.js +1 -1
- package/dist/auth/provider.js +1 -1
- package/dist/browser/index.d.ts +307 -0
- package/dist/browser/index.js +2845 -0
- package/dist/{chunk-7BUC7A7V.js → chunk-4GODDZ6W.js} +1 -1
- package/dist/{chunk-6TTEDYLD.js → chunk-6RSONDY2.js} +1 -1
- package/dist/{chunk-KJXUEGXY.js → chunk-ARZLX6CN.js} +1 -1
- package/dist/{chunk-5QNWWNPL.js → chunk-C4WTV2YM.js} +1 -1
- package/dist/chunk-HBEO4D3T.js +1 -0
- package/dist/{chunk-GZMEHP36.js → chunk-HEQX2NUJ.js} +1 -1
- package/dist/{chunk-VPELL4UB.js → chunk-JKIAWSHG.js} +1 -1
- package/dist/chunk-KWYDYEDO.js +5 -0
- package/dist/{chunk-IEFUKJDE.js → chunk-NOYGN74P.js} +1 -1
- package/dist/{chunk-GMZ3URGL.js → chunk-OIOEFM6D.js} +1 -1
- package/dist/{chunk-TVH7NCXE.js → chunk-VXGFGLXP.js} +7 -5
- package/dist/{chunk-7Q44GQ2Y.js → chunk-X2SUXPXB.js} +1 -1
- package/dist/{chunk-PUHRE62R.js → chunk-XBMAJWHH.js} +1 -1
- package/dist/{chunk-Z5DYQHN2.js → chunk-YXNJDI2L.js} +1 -1
- package/dist/chunk-ZJWJRAFY.js +1 -0
- package/dist/cli-core.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/access-keys/assign.js +1 -1
- package/dist/lib/access-keys/attach-policy.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/detach-policy.js +1 -1
- package/dist/lib/access-keys/get.js +1 -1
- package/dist/lib/access-keys/list-policies.js +1 -1
- package/dist/lib/access-keys/list.js +1 -1
- package/dist/lib/access-keys/rotate.js +1 -1
- package/dist/lib/buckets/create.js +1 -1
- package/dist/lib/buckets/delete.js +1 -1
- package/dist/lib/buckets/disable-snapshots.js +1 -1
- package/dist/lib/buckets/enable-snapshots.js +1 -1
- package/dist/lib/buckets/get.js +1 -1
- package/dist/lib/buckets/lifecycle/create.js +1 -1
- package/dist/lib/buckets/lifecycle/edit.js +1 -1
- package/dist/lib/buckets/lifecycle/list.js +1 -1
- package/dist/lib/buckets/lifecycle/shared.js +1 -1
- package/dist/lib/buckets/list.js +1 -1
- package/dist/lib/buckets/merge.js +1 -1
- package/dist/lib/buckets/migrate.js +1 -1
- package/dist/lib/buckets/rebase.js +1 -1
- package/dist/lib/buckets/restore.js +1 -1
- package/dist/lib/buckets/set-cors.js +1 -1
- package/dist/lib/buckets/set-locations.js +1 -1
- package/dist/lib/buckets/set-migration.js +1 -1
- package/dist/lib/buckets/set-notifications.js +1 -1
- package/dist/lib/buckets/set.js +1 -1
- package/dist/lib/buckets/share.js +1 -1
- package/dist/lib/bundle.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/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/link-key.js +1 -1
- package/dist/lib/iam/policies/list-keys.js +1 -1
- package/dist/lib/iam/policies/list.js +1 -1
- package/dist/lib/iam/policies/select-policy.js +1 -1
- package/dist/lib/iam/policies/unlink-key.js +1 -1
- package/dist/lib/iam/teams/create.js +1 -1
- package/dist/lib/iam/teams/edit.js +1 -1
- package/dist/lib/iam/teams/list.js +1 -1
- package/dist/lib/iam/teams/shared.js +1 -1
- package/dist/lib/iam/users/invite.js +1 -1
- package/dist/lib/iam/users/list.js +1 -1
- package/dist/lib/iam/users/remove.js +1 -1
- package/dist/lib/iam/users/revoke-invitation.js +1 -1
- package/dist/lib/iam/users/update-role.js +1 -1
- 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/info.js +1 -1
- package/dist/lib/objects/list-versions.js +1 -1
- package/dist/lib/objects/list.js +1 -1
- package/dist/lib/objects/purge.js +1 -1
- package/dist/lib/objects/put.js +1 -1
- package/dist/lib/objects/restore-deleted.js +1 -1
- package/dist/lib/objects/restore-info.js +1 -1
- package/dist/lib/objects/restore.js +1 -1
- package/dist/lib/objects/set-access.js +1 -1
- package/dist/lib/objects/set.js +1 -1
- package/dist/lib/organizations/create.js +1 -1
- package/dist/lib/organizations/list.js +1 -1
- package/dist/lib/organizations/select.js +1 -1
- package/dist/lib/presign.js +1 -1
- package/dist/lib/rm.js +1 -1
- package/dist/lib/snapshots/delete.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/telemetry/disable.js +1 -1
- package/dist/lib/telemetry/enable.js +1 -1
- package/dist/lib/telemetry/status.js +1 -1
- package/dist/lib/touch.js +1 -1
- package/dist/lib/update.js +1 -1
- package/dist/lib/whoami.js +1 -1
- package/dist/utils/analytics.js +1 -1
- package/dist/utils/exit.js +1 -1
- package/dist/utils/telemetry.js +1 -1
- package/dist/utils/update-check.js +1 -1
- package/package.json +21 -5
- package/dist/chunk-5AGM4LUA.js +0 -5
- package/dist/chunk-J3MAV7JB.js +0 -1
- package/dist/chunk-Z54TMLIH.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as p,b as a}from"./chunk-G4OJTPSI.js";import{a as r}from"./chunk-
|
|
1
|
+
import{a as p,b as a}from"./chunk-G4OJTPSI.js";import{a as r}from"./chunk-ZJWJRAFY.js";import{b as f}from"./chunk-BMWWPXMU.js";import{e as c,f as I,h as _,i as g}from"./chunk-APJUJ6TW.js";import{j as l,k as m}from"./chunk-QPUL2AAI.js";import{request as O}from"http";import{request as v}from"https";var E="/i/v0/e/",N=1e3;function y(){return process.env.TIGRIS_POSTHOG_KEY?.trim()||l}function R(){return process.env.TIGRIS_POSTHOG_HOST?.trim()||m}var C=["CI","CONTINUOUS_INTEGRATION","BUILD_NUMBER","GITHUB_ACTIONS","GITLAB_CI","CIRCLECI","TRAVIS","JENKINS_URL","BUILDKITE","TEAMCITY_VERSION","TF_BUILD"];function w(){return C.some(e=>{let t=process.env[e];return t!==void 0&&t!==""&&t!=="0"&&t.toLowerCase()!=="false"})}var k=/^[a-z0-9][a-z0-9-]*$/i;function M(e){let t=new Set;for(let o of e){if(o==="--")break;if(!o.startsWith("-")||o==="-")continue;let n=o.split("=")[0].replace(/^--?/,"");k.test(n)&&t.add(n)}return[...t].sort()}function b(e){try{let t=e.split(".")[1];if(!t)return;let n=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))?.email;return typeof n=="string"&&n.length>0?n:void 0}catch{return}}async function h(){let e=I(),t={distinctId:e,anonymousId:e,isIdentified:!1,authMethod:"none"};try{let o=await import("./auth/storage.js"),n=await o.getTokens(),i=n?.idToken?b(n.idToken):void 0;return{distinctId:i??e,anonymousId:e,isIdentified:i!==void 0,authMethod:o.getLoginMethod()??"none",organizationId:o.getSelectedOrganization()??void 0}}catch{return t}}function T(){return{$lib:"tigris-cli",$lib_version:r,interface:"cli",cli_version:r,runtime:p()?"binary":"node",install_method:a(),node_version:process.version,os:process.platform,arch:process.arch,is_ci:w(),is_tty:process.stdout.isTTY===!0}}function S(e){return new Promise(t=>{let o=!1,n=()=>{o||(o=!0,t())};try{let i=new URL(E,R()),u=JSON.stringify(e),s=(i.protocol==="http:"?O:v)({protocol:i.protocol,hostname:i.hostname,port:i.port||void 0,path:i.pathname,method:"POST",timeout:N,headers:{"content-type":"application/json","content-length":Buffer.byteLength(u),"user-agent":`tigris-cli/${r}`}},d=>{d.resume(),d.on("end",n),d.on("error",n)});s.on("error",n),s.on("timeout",()=>{s.destroy(),n()}),s.end(u)}catch{n()}})}var L=`
|
|
2
2
|
Tigris CLI collects usage analytics (which commands you run and their
|
|
3
3
|
arguments, CLI version, OS) and error reports, to help us decide what to
|
|
4
4
|
improve. Credentials \u2014 access keys, secrets, tokens \u2014 are never collected.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as r,d as a}from"./chunk-D7WXNA2O.js";import{c}from"./chunk-NI4EYBQH.js";import{d as m}from"./chunk-
|
|
1
|
+
import{a as r,d as a}from"./chunk-D7WXNA2O.js";import{c}from"./chunk-NI4EYBQH.js";import{d as m}from"./chunk-X2SUXPXB.js";import{b as i}from"./chunk-DV3LCXRH.js";function p(){return globalThis.__TIGRIS_JSON_MODE===!0}function g(){return process.stderr.isTTY===!0}function f(){return process.stdout.isTTY===!0}function u(t,o,n){let e=i(t);if(p()){let s={error:{message:e.message,code:e.exitCode,category:e.category}};e.nextActions.length>0&&(s.nextActions=e.nextActions),console.error(JSON.stringify(s))}else if(o||console.error(`
|
|
2
2
|
Error: ${e.message}`),g()&&e.nextActions.length>0){console.error(`
|
|
3
3
|
Next steps:`);for(let s of e.nextActions)console.error(` \u2192 ${s.command} ${s.description}`)}n?.skipCapture||m(t,{category:e.category,command:o?.command,exitCode:e.exitCode}),process.exit(e.exitCode)}function M(t,o){let n=o instanceof Error?o.message:String(o);a(t,n),u(o,t)}function x(t,o){let n=c(t.command,t.operation);return n?.messages?.nextActions?n.messages.nextActions.map(e=>({command:r(e.command,o),description:r(e.description,o)})):[]}function T(t,o){if(!f()||p())return;let n=x(t,o);if(n.length!==0){console.log(`
|
|
4
4
|
Next steps:`);for(let e of n)console.log(` \u2192 ${e.command} ${e.description}`)}}export{u as a,M as b,x as c,T as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as g}from"./chunk-G4OJTPSI.js";import{a as p}from"./chunk-
|
|
1
|
+
import{b as g}from"./chunk-G4OJTPSI.js";import{a as p}from"./chunk-ZJWJRAFY.js";import{d as m,e as f,f as d,g as h}from"./chunk-QPUL2AAI.js";import{mkdirSync as I,readFileSync as S,writeFileSync as U}from"fs";import b from"https";import{homedir as C}from"os";import{join as N}from"path";var _=N(C(),".tigris","update-check.json");function E(){try{let r=S(_,"utf-8"),o=JSON.parse(r);return typeof o.latestVersion=="string"&&typeof o.lastChecked=="number"?o:null}catch{return null}}function T(r){try{I(N(C(),".tigris"),{recursive:!0}),U(_,JSON.stringify(r),"utf-8")}catch{}}function w(r,o){let i=s=>{let n=s.startsWith("v")?s.slice(1):s,c=null,a=n.indexOf("-");a!==-1&&(c=n.slice(a+1),n=n.slice(0,a));let l=n.split(".");if(l.length!==3)return null;let u=l.map(Number);return u.some(Number.isNaN)?null:{major:u[0],minor:u[1],patch:u[2],prerelease:c}},t=i(r),e=i(o);return!t||!e?!1:e.major>t.major?!0:e.major<t.major?!1:e.minor>t.minor?!0:e.minor<t.minor?!1:e.patch>t.patch?!0:e.patch<t.patch?!1:t.prerelease&&!e.prerelease?!0:(!t.prerelease&&e.prerelease,!1)}function D(){switch(g()){case"npm":return"npm install -g @tigrisdata/cli";case"homebrew":return"brew upgrade tigris";default:return process.platform==="win32"?`irm ${f}/install.ps1 | iex`:`curl -fsSL ${f}/install.sh | sh`}}function y(r={}){return new Promise((o,i)=>{let t=b.get(m,{timeout:1e4},e=>{let s="";e.on("data",n=>{s+=n}),e.on("end",()=>{try{let n=JSON.parse(s);typeof n.version=="string"?(T({...E(),latestVersion:n.version,lastChecked:Date.now()}),o(n.version)):i(new Error("Unexpected registry response"))}catch{i(new Error("Failed to parse registry response"))}})});t.on("error",e=>{i(e)}),t.on("timeout",()=>{t.destroy(),i(new Error("Request timed out"))}),r.unref&&t.on("socket",e=>{e.unref()}),t.end()})}function k(){y({unref:!0}).catch(()=>{})}function M(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let r=E(),o=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||36e5;if(r&&w(p,r.latestVersion)&&(!r.lastNotified||Date.now()-r.lastNotified>o)){let t=`Update available: ${p} \u2192 ${r.latestVersion}`,e='Run "tigris update" to upgrade.',s=Math.max(t.length,e.length)+4,n=`\u250C${"\u2500".repeat(s-2)}\u2510`,c=`\u2514${"\u2500".repeat(s-2)}\u2518`,a=l=>`\u2502 ${l.padEnd(s-4)} \u2502`;console.log(`
|
|
2
2
|
${n}
|
|
3
3
|
${a("")}
|
|
4
4
|
${a(t)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as o}from"./chunk-IUIKP2LU.js";import{a}from"./chunk-S6KFKBMY.js";import{b as i}from"./chunk-
|
|
1
|
+
import{a as d,b as o}from"./chunk-IUIKP2LU.js";import{a}from"./chunk-S6KFKBMY.js";import{b as i}from"./chunk-6RSONDY2.js";import{getBucketInfo as l,setBucketLifecycle as g}from"@tigrisdata/storage";var f=["STANDARD_IA","GLACIER","GLACIER_IR"];function c(e){return f.includes(e)}function u(e){return/^\d{4}-\d{2}-\d{2}/.test(e)&&!Number.isNaN(new Date(e).getTime())}function C(e){return{prefix:a(e,["prefix"]),storageClass:a(e,["storage-class","storageClass"]),days:a(e,["days"]),date:a(e,["date"]),expireDays:a(e,["expire-days","expireDays"]),expireDate:a(e,["expire-date","expireDate"]),enable:a(e,["enable"]),disable:a(e,["disable"])}}function p(e,{requireStorageClassForTiming:r=!0}={}){if(e.enable&&e.disable)return"Cannot use both --enable and --disable";if(r&&(e.days!==void 0||e.date!==void 0)&&!e.storageClass)return"--storage-class is required when setting --days or --date";if(e.storageClass&&!c(e.storageClass))return`--storage-class must be one of: ${f.join(", ")} (STANDARD is not a valid transition target)`;if(e.days!==void 0&&e.date!==void 0)return"Cannot specify both --days and --date";if(e.days!==void 0&&(Number.isNaN(Number(e.days))||Number(e.days)<=0))return"--days must be a positive number";if(e.date!==void 0&&!u(e.date))return"--date must be a valid ISO-8601 date (e.g. 2026-06-01)";if(e.expireDays!==void 0&&e.expireDate!==void 0)return"Cannot specify both --expire-days and --expire-date";if(e.expireDays!==void 0&&(Number.isNaN(Number(e.expireDays))||Number(e.expireDays)<=0))return"--expire-days must be a positive number";if(e.expireDate!==void 0&&!u(e.expireDate))return"--expire-date must be a valid ISO-8601 date (e.g. 2026-06-01)";if(e.prefix!==void 0&&e.prefix==="")return"--prefix cannot be empty"}function D(e){let r={};return e.storageClass&&(r.storageClass=e.storageClass),e.days!==void 0?(r.days=Number(e.days),r.date=void 0):e.date!==void 0&&(r.date=e.date,r.days=void 0),r}function R(e){if(e.expireDays!==void 0)return{days:Number(e.expireDays),date:void 0};if(e.expireDate!==void 0)return{date:e.expireDate,days:void 0}}function I(e){if(e.enable)return!0;if(e.disable)return!1}async function N(e,r,n){let{data:t,error:s}=await l(r,{config:n});return s&&i(e,s),t?.settings.lifecycleRules??[]}async function T(e,r,n,t){let{error:s}=await g(r,{lifecycleRules:n,config:t});s&&i(e,s)}function S(e){return d(e)??"-"}function A(e){return o(e)??"-"}export{C as a,p as b,D as c,R as d,I as e,N as f,T as g,S as h,A as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as d,d as a,e as g,f as p,g as k,o as w}from"./chunk-F4AGJWCK.js";import{createRemoteJWKSet as m,jwtVerify as _}from"jose";import y from"open";function v(){let s=process.env.TIGRIS_ENV==="development",e=s?process.env.TIGRIS_AUTH0_DOMAIN??"auth-storage.tigris.dev":process.env.TIGRIS_AUTH0_DOMAIN??"auth.storage.tigrisdata.io",t=s?process.env.TIGRIS_AUTH0_CLIENT_ID??"JdJVYIyw0O1uHi5L5OJH903qaWBgd3gF":process.env.TIGRIS_AUTH0_CLIENT_ID??"DMejqeM3CQ4IqTjEcd3oA9eEiT40hn8D",n=s?process.env.TIGRIS_AUTH0_AUDIENCE??"https://tigris-api-dev":process.env.TIGRIS_AUTH0_AUDIENCE??"https://tigris-os-api",i=process.env.TIGRIS_CLAIMS_NAMESPACE??"https://tigris";return{domain:e,clientId:t,audience:n,claimsNamespace:i}}var u=null;function x(s){u=s}var f=class{config;baseUrl;jwks=null;constructor(){this.config=v(),this.baseUrl=`https://${this.config.domain}`}getJWKS(){return this.jwks||(this.jwks=m(new URL(`${this.baseUrl}/.well-known/jwks.json`))),this.jwks}async verifyIdToken(e){let{payload:t}=await _(e,this.getJWKS(),{issuer:`${this.baseUrl}/`,audience:this.config.clientId});return t}async login(e){let t=await fetch(`${this.baseUrl}/oauth/device/code`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:this.config.clientId,audience:this.config.audience,scope:"openid profile email offline_access"})});if(!t.ok)throw new Error(`Device authorization failed: ${t.statusText}`);let n=JSON.parse(await t.text());e?.onDeviceCode?.(n.user_code,n.verification_uri),await this.sleep(2e3);try{await y(n.verification_uri_complete)}catch{}e?.onWaiting?.();let i=await this.pollForToken(n.device_code,n.interval||5);await d(i),w("oauth"),await this.extractAndStoreOrganizations()}async pollForToken(e,t){let i=0;for(;i<60;){i++;let o=await fetch(`${this.baseUrl}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:this.config.clientId,device_code:e,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(!o.ok){let l=await o.text().then(JSON.parse).catch(()=>({}));if(l.error==="authorization_pending"){await this.sleep(t*1e3);continue}if(l.error==="slow_down"){t+=5,await this.sleep(t*1e3);continue}throw new Error(l.error_description||"Authentication failed")}let r=JSON.parse(await o.text());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 T=Date.now()+(r.expires_in||3600)*1e3;return{accessToken:r.access_token,refreshToken:r.refresh_token,idToken:r.id_token,expiresAt:T}}throw new Error("Authentication timed out. Please try again.")}async getAccessToken(){let e=await a();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;if(e?.refreshToken?t=e:t=await a(),!t?.refreshToken){let n=u?await u():null;if(n)return n;throw new Error('No refresh token available. Please run "tigris login" to re-authenticate.')}try{let n=await fetch(`${this.baseUrl}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:this.config.clientId,grant_type:"refresh_token",refresh_token:t.refreshToken,scope:"openid profile email offline_access"})});if(!n.ok)throw new Error("Token refresh failed");let i=JSON.parse(await n.text()),o={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 d(o),o}catch{throw await g(),new Error('Token refresh failed. Please run "tigris login" to re-authenticate.')}}async getIdTokenClaims(){let e=await a();if(!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(){try{let e=await this.fetchOrganizationsFromUserInfo();e&&p(e)}catch{}}async fetchOrganizationsFromUserInfo(){try{let{domain:e,claimsNamespace:t}=this.config,n=await this.getAccessToken(),i=await fetch(`https://${e}/userinfo`,{headers:{Authorization:`Bearer ${n}`}});if(!i.ok)return null;let r=JSON.parse(await i.text())[t]?.ns;return Array.isArray(r)?r.map(c=>({id:c.id,name:c.name,slug:c.name})):null}catch{return null}}async getOrganizations(){return await this.getAccessToken(),k()}async isFlyUser(){return(await this.getIdTokenClaims()).sub.includes("fly-sso")}async logout(){await g()}async isAuthenticated(){return await a()!==null}sleep(e){return new Promise(t=>setTimeout(t,e))}},h=null;function C(){return h||(h=new f),h}export{v as a,x as b,f as c,C as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,
|
|
1
|
+
import{a as o,e as a}from"./chunk-KWYDYEDO.js";import{b as i}from"./chunk-6RSONDY2.js";import{d as r}from"./chunk-HBEO4D3T.js";import{i as n,p as s}from"./chunk-F4AGJWCK.js";async function d(e){s()!=="oauth"&&i(e,`This operation requires OAuth login.
|
|
2
2
|
Run "tigris login oauth" first.`);let t=r();await t.isAuthenticated()||i(e,'Not authenticated. Run "tigris login oauth" first.');let c=n(),{iamEndpoint:g,mgmtEndpoint:u}=o();return{sessionToken:await t.getAccessToken(),organizationId:c??void 0,iamEndpoint:g,mgmtEndpoint:u}}async function A(e){let t=await a();switch(t.type){case"oauth":return d(e);case"aws-profile":case"credentials":case"environment":case"configured":return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,organizationId:n()??void 0,iamEndpoint:o().iamEndpoint};case"none":i(e,'Not authenticated. Run "tigris login" or "tigris configure" first.')}}export{d as a,A as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as K}from"./chunk-S77OAN6Y.js";import{a as w}from"./chunk-
|
|
1
|
+
import{a as K}from"./chunk-S77OAN6Y.js";import{a as w}from"./chunk-KWYDYEDO.js";import{b as S}from"./chunk-S6KFKBMY.js";import{b as u,d as l}from"./chunk-6RSONDY2.js";import{b as f,c as y,j as p}from"./chunk-D7WXNA2O.js";import{a as i}from"./chunk-QPUL2AAI.js";import{l as n,n as o,o as d,q as m,s as g}from"./chunk-F4AGJWCK.js";import C from"enquirer";import{whoami as k}from"@tigrisdata/iam";var{prompt:I}=C,a=p("login","credentials");async function q(e){f(a);let A=S(e),s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,r=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(!s||!r){let t=[];s||t.push({type:"input",name:"accessKey",message:"Access Key ID:",required:!0}),r||t.push({type:"password",name:"accessSecret",message:"Secret Access Key:",required:!0}),K("Provide --access-key and --access-secret");let c=await I(t);s=s||c.accessKey,r=r||c.accessSecret}(!s||!r)&&u(a,"Access key and secret are required");let h=n()?.endpoint||i;await o({accessKeyId:s,secretAccessKey:r,endpoint:h}),await d("credentials"),await g();try{let t=w(),{data:c}=await k({config:{accessKeyId:s,secretAccessKey:r,iamEndpoint:t.iamEndpoint}});c?.organizationId&&await m(c.organizationId,"temporary")}catch{}A==="json"&&console.log(JSON.stringify({action:"logged_in"})),y(a),l(a)}export{q as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as o,b as a,c as g}from"./chunk-QPUL2AAI.js";import{a as I,d as f}from"./chunk-HBEO4D3T.js";import{i as c,j as y,k as A,l as i,p as d}from"./chunk-F4AGJWCK.js";import{fromIni as S}from"@aws-sdk/credential-providers";function r(){return process.env.AWS_ENDPOINT_URL_S3||process.env.AWS_ENDPOINT_URL_IAM?{endpoint:process.env.AWS_ENDPOINT_URL_S3||o,iamEndpoint:process.env.AWS_ENDPOINT_URL_IAM||a,mgmtEndpoint:process.env.AWS_ENDPOINT_URL_MGMT||g}:{endpoint:process.env.TIGRIS_STORAGE_ENDPOINT||o,iamEndpoint:process.env.TIGRIS_IAM_ENDPOINT||a,mgmtEndpoint:process.env.TIGRIS_MGMT_ENDPOINT||g}}function _(){let e=process.env.TIGRIS_FORCE_PATH_STYLE?.trim().toLowerCase();return e==="1"||e==="true"||e==="yes"||e==="on"}function u(){if(process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY){let e=process.env.AWS_ENDPOINT_URL_S3||o;return{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,endpoint:e,source:"aws"}}if(process.env.TIGRIS_STORAGE_ACCESS_KEY_ID&&process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY){let e=process.env.TIGRIS_STORAGE_ENDPOINT||o;return{accessKeyId:process.env.TIGRIS_STORAGE_ACCESS_KEY_ID,secretAccessKey:process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY,endpoint:e,source:"tigris"}}return null}var p=!1;function P(){p=!1}async function K(){if(p||!process.stdin.isTTY)return!1;p=!0,console.log(`Not authenticated. Starting login...
|
|
2
|
+
`);let{default:e}=await import("./lib/login/select.js");return await e({}),console.log(),!0}async function T(){if(y()){let s=process.env.AWS_PROFILE||"default",l=await S({profile:s})();return{type:"aws-profile",profile:s,accessKeyId:l.accessKeyId,secretAccessKey:l.secretAccessKey}}let e=u();if(e)return{type:"environment",accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,source:e.source};let t=d();if(t==="oauth")return{type:"oauth"};if(t==="credentials"){let s=i();if(s)return{type:"credentials",accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey}}let n=i();return n?{type:"configured",accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey}:{type:"none"}}async function C(e){let t=await E(e);return _()?{...t,forcePathStyle:!0}:t}async function E(e){let t=await T();switch(t.type){case"aws-profile":{let n=await A(t.profile);return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:n.endpoint||r().endpoint||o,iamEndpoint:n.iamEndpoint||r().iamEndpoint}}case"oauth":{let n=f(),s=c();if(!s)throw new Error('No organization selected. Please run "tigris orgs select" first.');return{sessionToken:await n.getAccessToken(),accessKeyId:"",secretAccessKey:"",...e?.withCredentialProvider&&{credentialProvider:async()=>({accessKeyId:"",secretAccessKey:"",sessionToken:await n.getAccessToken(),expiration:new Date(Date.now()+600*1e3)})},endpoint:r().endpoint,organizationId:s,iamEndpoint:r().iamEndpoint,authDomain:I().domain}}case"credentials":{let n=c();return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:i()?.endpoint||o,organizationId:n??void 0,iamEndpoint:r().iamEndpoint}}case"environment":return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:u()?.endpoint||o};case"configured":{let n=c();return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:i()?.endpoint||o,organizationId:n??void 0,iamEndpoint:r().iamEndpoint}}case"none":{if(await K())return E(e);throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}}}async function N(){let e=await C(),t=c();return{...e,...t&&!e.organizationId?{organizationId:t}:{}}}function O(e){return d()==="oauth"?!1:(u()||i()?console.log(`You are using access key credentials, which belong to a single organization.
|
|
3
|
+
${e} is only available with OAuth login.
|
|
4
|
+
|
|
5
|
+
Run "tigris login" to login with your Tigris account.`):console.log('Not authenticated. Please run "tigris login" to login with your Tigris account.'),!0)}export{r as a,_ as b,u as c,P as d,T as e,C as f,N as g,O as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-S77OAN6Y.js";import{b as s}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-S77OAN6Y.js";import{b as s}from"./chunk-6RSONDY2.js";import{e as o}from"./chunk-D7WXNA2O.js";import m from"enquirer";import{listPolicies as f}from"@tigrisdata/iam";var{prompt:p}=m;async function h(a,t,c="Select a policy:"){let{data:e,error:r}=await f({config:a});if(r&&s(t,r),!e.policies||e.policies.length===0){o(t);return}n("Provide the policy ARN as a positional argument");let{selected:l}=await p({type:"select",name:"selected",message:c,choices:e.policies.map(i=>({name:i.resource,message:`${i.name} (${i.resource})`}))});return l}export{h as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as h}from"./chunk-S6KFKBMY.js";import{f as c}from"./chunk-
|
|
1
|
+
import{b as h}from"./chunk-S6KFKBMY.js";import{f as c}from"./chunk-4GODDZ6W.js";import{a as d,d as e}from"./chunk-6RSONDY2.js";import{b as l,c as r,d as f,g as m,j as p}from"./chunk-D7WXNA2O.js";import{d as u}from"./chunk-HBEO4D3T.js";import{h as g,r as s}from"./chunk-F4AGJWCK.js";var o=p("login","oauth");async function O(w={}){l(o);let a=h(w);try{let t=u();await t.login({onDeviceCode:(i,y)=>{console.log(`
|
|
2
2
|
Your confirmation code: ${i}
|
|
3
3
|
`),console.log(`If browser doesn't open, visit: ${y}`)},onWaiting:()=>console.log(`
|
|
4
4
|
Waiting for authentication...`)}),await s();let n=await t.getOrganizations();if(n.length>0){let i=n[0];await g(i.id),a==="json"&&console.log(JSON.stringify({action:"logged_in"})),r(o,{org:i.name}),e(o),n.length>1&&m(o,{count:n.length})}else a==="json"&&console.log(JSON.stringify({action:"logged_in"})),r(o,{org:"none"}),e(o);c()}catch(t){f(o),d(t,o)}}var j=O;export{O as a,j as b};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import{e as x}from"./chunk-
|
|
2
|
-
Run "${f}" for usage.`),process.exit(1)}return i}function
|
|
3
|
-
Operation cancelled`),process.exit(1)),o(e)}),process.on("uncaughtException",e=>{o(e)})}function
|
|
1
|
+
import{e as x}from"./chunk-4GODDZ6W.js";import{a as k}from"./chunk-6RSONDY2.js";import{h as C}from"./chunk-D7WXNA2O.js";import{c as I,d as b,e as E}from"./chunk-X2SUXPXB.js";import{b as v}from"./chunk-DV3LCXRH.js";import{Command as M,Help as U,Option as P}from"commander";function y(n,o,e,a,t){let r=n[n.length-1],i=typeof r=="object"&&r!==null&&"args"in r?r.args:n.filter(m=>typeof m=="string");if(i.length===0)return i;let l=i[0],c=(o.commands??[]).filter(m=>g(m,[...e,m.name],t));if(!new Set(c.flatMap(m=>[m.name,...Array.isArray(m.alias)?m.alias:m.alias?[m.alias]:[]])).has(l)){let m=c.map(u=>u.name),p=e.length>0?`'${l}' for '${e.join(" ")}'`:`'${l}'`;console.error(`Unknown command ${p}.`),m.length>0&&console.error(`Available commands: ${m.join(", ")}`);let f=e.length>0?`${a.name} ${e.join(" ")} help`:`${a.name} help`;console.error(`
|
|
2
|
+
Run "${f}" for usage.`),process.exit(1)}return i}function B(){I();let n=!1,o=async e=>{n&&process.exit(1),n=!0,b(e,{crash:!0,exitCode:v(e).exitCode}),await E(),k(e,void 0,{skipCapture:!0})};process.on("unhandledRejection",e=>{(e===""||e===void 0)&&(console.error(`
|
|
3
|
+
Operation cancelled`),process.exit(1)),o(e)}),process.on("uncaughtException",e=>{o(e)})}function V(n){return/^[a-zA-Z0-9_-]+$/.test(n)}function G(n){let o;n.type==="positional"?o=` ${n.name}`:(o=` --${n.name}`,n.alias&&typeof n.alias=="string"&&(o+=n.alias.length===1?`, -${n.alias}`:`, --${n.alias}`));let e=26,a=o.length>=e?`${o} `:o.padEnd(e),t=n.description;return n.options&&(Array.isArray(n.options)&&typeof n.options[0]=="string"?t+=` (options: ${n.options.join(", ")})`:t+=` (options: ${n.options.map(r=>r.value).join(", ")})`),n.default&&(t+=` [default: ${n.default}]`),n.required&&(t+=" [required]"),n.deprecated&&(t+=n.replaced_by?` [deprecated: use ${n.replaced_by}]`:" [deprecated]"),n["required-when"]&&(t+=` [required when: ${n["required-when"]}]`),n.multiple&&(t+=" [multiple values: comma-separated]"),n.type==="positional"&&(t+=" [positional argument]"),n.examples&&n.examples.length>0&&(t+=` (examples: ${n.examples.join(", ")})`),`${a}${t}`}function g(n,o,e){return n.removed||e(o)?!0:n.commands?n.commands.some(a=>g(a,[...o,a.name],e)):!1}function L(n,o){let e=o?` Use ${o} instead.`:" See the changelog for migration guidance.";console.error(`${n} was removed in this version.${e}`),process.exit(1)}function S(n,o){if(n)for(let e of n){if(!e.removed)continue;h(o,e.name,n)!==void 0&&L(`--${e.name}`,e.replaced_by)}}function _(n,o,e,a){let t=e.join(" ");if(console.log(`
|
|
4
4
|
${n.name} ${t} - ${o.description??""}
|
|
5
|
-
`),o.commands&&o.commands.length>0){let l=o.commands.filter(s=>!s.removed&&g(s,[...e,s.name],a));l.length>0&&(console.log("Commands:"),l.forEach(s=>{let
|
|
5
|
+
`),o.commands&&o.commands.length>0){let l=o.commands.filter(s=>!s.removed&&g(s,[...e,s.name],a));l.length>0&&(console.log("Commands:"),l.forEach(s=>{let c=` ${s.name}`;if(s.alias){let m=Array.isArray(s.alias)?s.alias:[s.alias];c+=` (${m.join(", ")})`}let d=c.padEnd(24);console.log(`${d}${s.description??""}`)}),console.log())}let r=n.definitions?.global_arguments??[],i=w(r,o.arguments).filter(l=>!l.removed);i.length>0&&(console.log("Arguments:"),i.forEach(l=>{console.log(G(l))}),console.log()),o.examples&&o.examples.length>0&&(console.log("Examples:"),o.examples.forEach(l=>{console.log(` ${l}`)}),console.log()),o.commands&&o.commands.length>0&&console.log(`Use "${n.name} ${t} <command> help" for more information about a command.`)}function R(n,o,e){console.log(`Tigris CLI Version: ${o}
|
|
6
6
|
`),console.log(`Usage: tigris [command] [options]
|
|
7
7
|
`),console.log("Commands:"),n.commands.filter(t=>!t.removed&&g(t,[t.name],e)).forEach(t=>{let r=` ${t.name}`;if(t.alias){let l=Array.isArray(t.alias)?t.alias:[t.alias];r+=` (${l.join(", ")})`}let i=r.padEnd(24);console.log(`${i}${t.description??""}`)}),console.log(`
|
|
8
|
-
Use "${n.name} <command> help" for more information about a command.`)}function w(n,o){let e=o??[],a=new Set(e.map(i=>i.name)),t=new Set(e.filter(i=>i.alias).map(i=>i.alias)),r=n.filter(i=>!a.has(i.name)&&!(i.alias&&t.has(i.alias)));return[...e,...r]}function
|
|
8
|
+
Use "${n.name} <command> help" for more information about a command.`)}function w(n,o){let e=o??[],a=new Set(e.map(i=>i.name)),t=new Set(e.filter(i=>i.alias).map(i=>i.alias)),r=n.filter(i=>!a.has(i.name)&&!(i.alias&&t.has(i.alias)));return[...e,...r]}function j(n,o=[]){o.forEach(e=>{if(e.type==="positional"){let a=e.required?`<${e.name}>`:`[${e.name}]`;n.argument(a,e.description)}else{let a=e.alias&&typeof e.alias=="string"&&e.alias.length===1,t=e.alias&&typeof e.alias=="string"&&e.alias.length>1,r=a?`-${e.alias}, --${e.name}`:t?`--${e.alias}, --${e.name}`:`--${e.name}`;if(e.type==="flag"||(e.type==="boolean"?r+=" [value]":e.options?r+=" <value>":r+=e.required||e["required-when"]?" <value>":" [value]"),e.removed)n.addOption(new P(r,e.description??"").hideHelp());else{let i=e.description??"";if(e.deprecated){let l=e.replaced_by?` Use ${e.replaced_by} instead.`:"";i=`(deprecated) ${i}${l}`}n.option(r,i,e.default)}}})}function K(n){return n.replace(/-([a-z])/g,(o,e)=>e.toUpperCase())}function h(n,o,e){if(e){let t=e.find(r=>r.name===o);if(t?.alias&&typeof t.alias=="string"){let r=t.alias.charAt(0).toUpperCase()+t.alias.slice(1);if(n[r]!==void 0)return n[r]}}let a=[o,o.replace(/-/g,""),o.replace(/-/g,"").toLowerCase(),o.charAt(0).toUpperCase(),K(o)];for(let t of a)if(n[t]!==void 0)return n[t]}function D(n,o){for(let e of n){if(e["required-when"]){let[a,t]=e["required-when"].split("="),r=h(o,a,n),i=h(o,e.name,n);if(r===t&&!i)return console.error(`--${e.name} is required when --${a} is ${t}`),!1}if(e.required&&!h(o,e.name,n))return console.error(`--${e.name} is required`),e.description&&console.error(` ${e.description}`),!1}return!0}function W(n,o,e){let a;"optsWithGlobals"in e&&typeof e.optsWithGlobals=="function"?a=e.optsWithGlobals():"opts"in e&&typeof e.opts=="function"?a=e.opts():a=e;let t={...a};return n.filter(i=>i.type==="positional").forEach((i,l)=>{o[l]!==void 0&&(i.multiple?t[i.name]=o[l].split(",").map(s=>s.trim()):t[i.name]=o[l])}),n.forEach(i=>{i.multiple&&i.type!=="positional"&&t[i.name]&&typeof t[i.name]=="string"&&(t[i.name]=t[i.name].split(",").map(l=>l.trim()))}),t}async function q(n,o,e=[],a={}){(a.json||a.format==="json")&&(globalThis.__TIGRIS_JSON_MODE=!0);let{module:t,error:r}=await n(o);(r||!t)&&(console.error(r),process.exit(1));let i=o[o.length-1],l=t.default||t[i];typeof l!="function"&&(console.error(`Command not implemented: ${o.join(" ")}`),process.exit(1)),x(o),await l({...a,_positional:e})}function N(n,o,e,a=[]){let{specs:t,loadModule:r,hasImplementation:i}=n,l=t.definitions?.global_arguments??[];for(let s of e){V(s.name)||(console.error(`Invalid command name "${s.name}": only alphanumeric, hyphens, and underscores allowed`),process.exit(1));let c=[...a,s.name];if(!g(s,c,i))continue;let d=o.command(s.name,s.removed?{hidden:!0}:void 0).description(s.description??"");if(s.alias&&(Array.isArray(s.alias)?s.alias:[s.alias]).forEach(p=>{d.alias(p)}),s.removed){d.allowUnknownOption(!0),d.allowExcessArguments(!0),d.action(()=>{L(`${t.name} ${c.join(" ")}`,s.replaced_by)});continue}if(s.commands&&s.commands.length>0)if(N(n,d,s.commands,c),s.default){let m=s.commands.find(p=>p.name===s.default);if(m){let p=w(l,[...s.arguments||[],...m.arguments||[]]);j(d,p),d.allowExcessArguments(!0),d.action(async(...f)=>{let u=f.pop(),A=y([u],s,c,t,i),$=W(p,A,u);p.length>0&&!D(p,$)&&process.exit(1),S(p,$),m.deprecated&&m.messages?.onDeprecated&&C(m.messages.onDeprecated),await q(r,[...c,m.name],A,$)})}}else d.allowExcessArguments(!0),d.action((...m)=>{y(m,s,c,t,i),_(t,s,c,i)});else j(d,w(l,s.arguments)),d.action(async(...m)=>{let p=m.pop(),f=m,u=W(s.arguments||[],f,p);s.arguments&&!D(s.arguments,u)&&process.exit(1),S(s.arguments,u),s.deprecated&&s.messages?.onDeprecated&&C(s.messages.onDeprecated),await q(r,c,f,u)});d.command("help").description("Show help for this command").action(()=>{_(t,s,c,i)})}}var H=6,z=34,T=20,F={minWidthToWrap:T,formatItem(n,o,e,a){let i=a.helpWidth??80,l=i-o-2-2;if(!e||l>=z)return U.prototype.formatItem.call(this,n,o,e,a);let s=" ".repeat(H),c=a.boxWrap(e,Math.max(i-H,T));return`${" ".repeat(2)}${n}
|
|
9
|
+
${s}${c.replace(/\n/g,`
|
|
10
|
+
${s}`)}`}};function ee(n){let{specs:o,version:e,hasImplementation:a}=n,t=new M;return t.name(o.name).description(o.description).version(e),t.configureHelp(F),N(n,t,o.commands),t.command("help").description("Show general help").action(()=>{R(o,e,a)}),t.command("version").description("Show the CLI version").action(()=>{console.log(e)}),t.allowExcessArguments(!0),t.action((...r)=>{y(r,{commands:o.commands},[],o,a),R(o,e,a)}),t}export{B as a,V as b,G as c,g as d,_ as e,R as f,j as g,D as h,W as i,N as j,F as k,ee as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-ZJWJRAFY.js";import{a as u,b as y}from"./chunk-BMWWPXMU.js";import{e as l}from"./chunk-APJUJ6TW.js";import{i as m}from"./chunk-QPUL2AAI.js";import*as t from"@sentry/node";var g=new Set(["general","network"]),p=!1,a=!1;function S(){return process.env.TIGRIS_SENTRY_DSN?.trim()||m}var E=process.env.TIGRIS_ENV==="development"?"development":"production";function h(r){let e=r[0];return e&&!e.startsWith("-")?e:void 0}var T=new Set(["OnUncaughtException","OnUnhandledRejection","LocalVariables","LocalVariablesAsync","Console","ChildProcess"]);function f(r){if(typeof r=="string")return u(r);if(Array.isArray(r))return r.map(f);if(r!==null&&typeof r=="object"){let e=r;for(let n of Object.keys(e))e[n]=f(e[n]);return e}return r}function R(r){return r.server_name=void 0,f(r)}function w(){if(p)return;p=!0;let r=S();if(!(!r||l()))try{t.init({dsn:r,release:`@tigrisdata/cli@${c}`,environment:E,tracesSampleRate:0,sendDefaultPii:!1,integrations:i=>i.filter(s=>!T.has(s.name)),beforeSend:R}),t.setContext("cli",{version:c,node:process.version,platform:process.platform,arch:process.arch});let e=process.argv.slice(2);t.setContext("invocation",{command:y(e).join(" ")});let n=h(e);n&&t.setTag("command",n),a=!0}catch{a=!1}}function A(r,e={}){if(!a)return;let{category:n,command:i,crash:s,exitCode:d}=e;if(!(!s&&n&&!g.has(n)))try{t.captureException(r,o=>(o.setTag("crash",s===!0),n&&o.setTag("error.category",n),i&&o.setTag("command",i),d!==void 0&&o.setTag("exit_code",d),o))}catch{}}async function I(r=2e3){if(a)try{await t.flush(r)}catch{}}export{h as a,R as b,w as c,A as d,I as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n}from"./chunk-
|
|
1
|
+
import{b as n}from"./chunk-6RSONDY2.js";function o(s,e){if(e===void 0)return;let t=(Array.isArray(e)?e:[e]).map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0);return t.length===0&&n(s,"--members requires at least one email address"),t}export{o as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as l}from"./chunk-
|
|
1
|
+
import{e as l}from"./chunk-ARZLX6CN.js";import{a as m,l as s}from"./chunk-VXGFGLXP.js";import{b as i}from"./chunk-NI4EYBQH.js";import{a as t}from"./chunk-ZJWJRAFY.js";import{existsSync as c}from"fs";import{dirname as u,join as a}from"path";import{fileURLToPath as f}from"url";m();var j=f(import.meta.url),d=u(j),h=i(),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=s({specs:h,version:t,loadModule:b,hasImplementation:y});x.parse();l();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="3.12.1";export{s as a};
|
package/dist/cli-core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-VXGFGLXP.js";import"./chunk-4GODDZ6W.js";import"./chunk-G4OJTPSI.js";import"./chunk-6RSONDY2.js";import"./chunk-D7WXNA2O.js";import"./chunk-NI4EYBQH.js";import"./chunk-X2SUXPXB.js";import"./chunk-DV3LCXRH.js";import"./chunk-ZJWJRAFY.js";import"./chunk-BMWWPXMU.js";import"./chunk-APJUJ6TW.js";import"./chunk-QPUL2AAI.js";export{g as addArgumentsToCommand,d as commandHasAnyImplementation,l as createProgram,i as extractArgumentValues,c as formatArgumentHelp,b as isValidCommandName,k as narrowHelpConfiguration,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-YXNJDI2L.js";import"./chunk-ARZLX6CN.js";import"./chunk-VXGFGLXP.js";import"./chunk-4GODDZ6W.js";import"./chunk-G4OJTPSI.js";import"./chunk-6RSONDY2.js";import"./chunk-D7WXNA2O.js";import"./chunk-NI4EYBQH.js";import"./chunk-X2SUXPXB.js";import"./chunk-DV3LCXRH.js";import"./chunk-ZJWJRAFY.js";import"./chunk-BMWWPXMU.js";import"./chunk-APJUJ6TW.js";import"./chunk-QPUL2AAI.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-YXNJDI2L.js";import"./chunk-ARZLX6CN.js";import"./chunk-VXGFGLXP.js";import"./chunk-4GODDZ6W.js";import"./chunk-G4OJTPSI.js";import"./chunk-6RSONDY2.js";import"./chunk-D7WXNA2O.js";import"./chunk-NI4EYBQH.js";import"./chunk-X2SUXPXB.js";import"./chunk-DV3LCXRH.js";import"./chunk-ZJWJRAFY.js";import"./chunk-BMWWPXMU.js";import"./chunk-APJUJ6TW.js";import"./chunk-QPUL2AAI.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as p}from"../../chunk-
|
|
1
|
+
import{b as p}from"../../chunk-HEQX2NUJ.js";import"../../chunk-KWYDYEDO.js";import{a as r,b as h}from"../../chunk-S6KFKBMY.js";import{b as s,c as R,d as b}from"../../chunk-6RSONDY2.js";import{b as A,c as f,j as y}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{ACCESS_KEY_ROLES as S,assignBucketRoles as x,revokeAllBucketRoles as N}from"@tigrisdata/iam";var e=y("access-keys","assign");function v(t){return t?Array.isArray(t)?t:[t]:[]}async function w(t){A(e);let g=h(t),i=r(t,["id"]),m=r(t,["admin"]),u=r(t,["revokeRoles","revoke-roles"]),c=v(r(t,["bucket","b"])),n=v(r(t,["role","r"]));i||s(e,"Access key ID is required"),m&&u&&s(e,"Cannot use --admin and --revoke-roles together");let d=await p(e);if(u){let{error:o}=await N(i,{config:d});o&&s(e,o),g==="json"&&console.log(JSON.stringify({action:"revoked",id:i})),f(e);return}let l;if(m)l=[{bucket:"*",role:"NamespaceAdmin"}];else{c.length===0&&s(e,"At least one bucket name is required (or use --admin or --revoke-roles)"),n.length===0&&s(e,"At least one role is required (or use --admin or --revoke-roles)");for(let o of n)S.includes(o)||s(e,`Invalid role "${o}". Valid roles are: ${S.join(", ")}`);n.length===1?l=c.map(o=>({bucket:o,role:n[0]})):n.length===c.length?l=c.map((o,a)=>({bucket:o,role:n[a]})):s(e,`Number of roles (${n.length}) must be 1 or match number of buckets (${c.length})`)}let{error:k}=await x(i,l,{config:d});if(k&&s(e,k),g==="json"){let o=R(e),a={action:"assigned",id:i,assignments:l};o.length>0&&(a.nextActions=o),console.log(JSON.stringify(a))}f(e),b(e)}export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u}from"../../chunk-
|
|
1
|
+
import{b as u}from"../../chunk-HEQX2NUJ.js";import{a as d}from"../../chunk-S77OAN6Y.js";import"../../chunk-KWYDYEDO.js";import{a as l,b as h}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-6RSONDY2.js";import{b as p,c as y,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import S from"enquirer";import{attachPolicyToAccessKey as N,listPolicies as R,listPoliciesForAccessKey as q}from"@tigrisdata/iam";var{prompt:k}=S,e=g("access-keys","attach-policy");async function v(s){p(e);let A=h(s),o=l(s,["id"]),r=l(s,["policyArn","policy-arn"]);o||t(e,"Access key ID is required");let c=await u(e);if(!r){d("Use --policy-arn to specify the policy ARN");let[a,n]=await Promise.all([R({config:c}),q(o,{config:c})]);a.error&&t(e,a.error),n.error&&t(e,n.error);let w=new Set(n.data.policies),f=a.data.policies.filter(i=>!w.has(i.name));f.length===0&&t(e,"No unassigned policies available. All policies are already attached to this access key.");let{selected:P}=await k({type:"select",name:"selected",message:"Select a policy to attach:",choices:f.map(i=>({name:i.resource,message:`${i.name} (${i.resource})`}))});r=P}let{error:m}=await N(o,r,{config:c});m&&t(e,m),A==="json"&&console.log(JSON.stringify({action:"attached",id:o,policyArn:r})),y(e)}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u}from"../../chunk-
|
|
1
|
+
import{b as u}from"../../chunk-HEQX2NUJ.js";import"../../chunk-KWYDYEDO.js";import{a as d,b as p}from"../../chunk-S6KFKBMY.js";import{b as o,c as g,d as f}from"../../chunk-6RSONDY2.js";import{b as a,c as m,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{createAccessKey as w}from"@tigrisdata/iam";var t=l("access-keys","create");async function x(n){a(t);let A=p(n),c=d(n,["name"]);c||o(t,"Access key name is required");let y=await u(t),{data:e,error:s}=await w(c,{config:y});if(s&&o(t,s),A==="json"){let r=g(t,{name:e.name,id:e.id}),i={action:"created",name:e.name,id:e.id,secret:e.secret};r.length>0&&(i.nextActions=r),console.log(JSON.stringify(i))}else console.log(` Name: ${e.name}`),console.log(` Access Key ID: ${e.id}`),console.log(` Secret Access Key: ${e.secret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again.");m(t),f(t,{name:e.name,id:e.id})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as g}from"../../chunk-
|
|
1
|
+
import{b as g}from"../../chunk-HEQX2NUJ.js";import{a as m,b as a}from"../../chunk-S77OAN6Y.js";import"../../chunk-KWYDYEDO.js";import{a as i,b as d}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-6RSONDY2.js";import{b as n,c as s,j as f}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{removeAccessKey as u}from"@tigrisdata/iam";var e=f("access-keys","delete");async function k(r){n(e);let l=d(r),o=i(r,["id"]),p=i(r,["yes","y","force"]);if(o||t(e,"Access key ID is required"),!p&&(m("Use --yes to skip confirmation"),!await a(`Delete access key '${o}'?`))){console.log("Aborted");return}let y=await g(e),{error:c}=await u(o,{config:y});c&&t(e,c),l==="json"&&console.log(JSON.stringify({action:"deleted",id:o})),s(e)}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as A}from"../../chunk-
|
|
1
|
+
import{b as A}from"../../chunk-HEQX2NUJ.js";import{a as m,b as h}from"../../chunk-S77OAN6Y.js";import"../../chunk-KWYDYEDO.js";import{a,b as u}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-6RSONDY2.js";import{b as p,c as y,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import N from"enquirer";import{detachPolicyFromAccessKey as $,listPolicies as q,listPoliciesForAccessKey as F}from"@tigrisdata/iam";var{prompt:R}=N,e=g("access-keys","detach-policy");async function I(c){p(e);let w=u(c),t=a(c,["id"]),i=a(c,["policyArn","policy-arn"]),k=a(c,["yes","y","force"]);t||o(e,"Access key ID is required");let n=await A(e);if(!i){m("Use --policy-arn to specify the policy ARN");let[s,l]=await Promise.all([F(t,{config:n}),q({config:n})]);s.error&&o(e,s.error),l.error&&o(e,l.error);let P=new Set(s.data.policies),d=l.data.policies.filter(r=>P.has(r.name));d.length===0&&o(e,"No policies are attached to this access key.");let{selected:S}=await R({type:"select",name:"selected",message:"Select a policy to detach:",choices:d.map(r=>({name:r.resource,message:`${r.name} (${r.resource})`}))});i=S}if(!k&&(m("Use --yes to skip confirmation"),!await h(`Detach policy '${i}' from access key '${t}'?`))){console.log("Aborted");return}let{error:f}=await $(t,i,{config:n});f&&o(e,f),w==="json"&&console.log(JSON.stringify({action:"detached",id:t,policyArn:i})),y(e)}export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as m}from"../../chunk-
|
|
1
|
+
import{b as m}from"../../chunk-HEQX2NUJ.js";import"../../chunk-KWYDYEDO.js";import{a,b as f}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-6RSONDY2.js";import{b as c,c as l,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{getAccessKey as u}from"@tigrisdata/iam";var e=g("access-keys","get");async function $(s){c(e);let d=f(s),r=a(s,["id"]);r||t(e,"Access key ID is required");let p=await m(e),{data:o,error:n}=await u(r,{config:p});if(n&&t(e,n),d==="json")console.log(JSON.stringify(o));else if(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 i of o.roles)console.log(` - ${i.bucket}: ${i.role}`)}else console.log(" Roles: None");l(e)}export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as P}from"../../chunk-
|
|
1
|
+
import{b as P}from"../../chunk-HEQX2NUJ.js";import{g as A}from"../../chunk-AFM3TY2D.js";import"../../chunk-KWYDYEDO.js";import{a as y,b as k,c as h}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-6RSONDY2.js";import{b as m,c as g,e as f,i as d,j as u}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{listPoliciesForAccessKey as E}from"@tigrisdata/iam";var i=u("access-keys","list-policies");async function F(o){m(i);let n=k(o),{limit:s,pageToken:r}=h(o),a=y(o,["id"]);a||c(i,"Access key ID is required");let T=await P(i),{data:t,error:p}=await E(a,{...s!==void 0?{limit:s}:{},...r?{paginationToken:r}:{},config:T});if(p&&c(i,p),!t.policies||t.policies.length===0){f(i);return}let e=t.policies.map(O=>({policy:O})),x=[{key:"policy",header:e.length>1?"Attached Policies":"Attached Policy"}],l=t.paginationToken||void 0,w=A(e,n,"policies","policy",x,{paginationToken:l});console.log(w),n!=="json"&&n!=="xml"&&d(l),g(i,{count:e.length})}export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as h}from"../../chunk-
|
|
1
|
+
import{b as h}from"../../chunk-HEQX2NUJ.js";import{g as T}from"../../chunk-AFM3TY2D.js";import"../../chunk-KWYDYEDO.js";import{b as k,c as y}from"../../chunk-S6KFKBMY.js";import{b as l}from"../../chunk-6RSONDY2.js";import{b as d,c as p,e as f,i as g,j as u}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{listAccessKeys as A}from"@tigrisdata/iam";var t=u("access-keys","list");async function P(a){d(t);let o=k(a),{limit:s,pageToken:i}=y(a),x=await h(t),{data:e,error:r}=await A({...s!==void 0?{limit:s}:{},...i?{paginationToken:i}:{},config:x});if(r&&l(t,r),!e.accessKeys||e.accessKeys.length===0){f(t);return}let c=e.accessKeys.map(n=>({name:n.name,id:n.id,status:n.status,created:n.createdAt})),K=[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}],m=e.paginationToken||void 0,w=T(c,o,"keys","key",K,{paginationToken:m});console.log(w),o!=="json"&&o!=="xml"&&g(m),p(t,{count:c.length})}export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as w}from"../../chunk-
|
|
1
|
+
import{b as w}from"../../chunk-HEQX2NUJ.js";import{a as u,b as y}from"../../chunk-S77OAN6Y.js";import"../../chunk-KWYDYEDO.js";import{a as i,b as p}from"../../chunk-S6KFKBMY.js";import{b as n,c as g,d as m}from"../../chunk-6RSONDY2.js";import{b as f,c as l,j as d}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{rotateAccessKey as k}from"@tigrisdata/iam";var e=d("access-keys","rotate");async function x(o){f(e);let A=p(o),r=i(o,["id"]),S=i(o,["yes","y","force"]);if(r||n(e,"Access key ID is required"),!S&&(u("Use --yes to skip confirmation"),!await y(`Rotate access key '${r}'? The current secret will be invalidated.`))){console.log("Aborted");return}let h=await w(e),{data:t,error:s}=await k(r,{config:h});if(s&&n(e,s),A==="json"){let c=g(e,{id:t.id}),a={action:"rotated",id:t.id,secret:t.newSecret};c.length>0&&(a.nextActions=c),console.log(JSON.stringify(a))}else console.log(` Access Key ID: ${t.id}`),console.log(` New Secret Access Key: ${t.newSecret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again.");l(e),m(e,{id:t.id})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,c as j}from"../../chunk-N3Y6RFSK.js";import{a as B}from"../../chunk-S77OAN6Y.js";import{
|
|
1
|
+
import{a as C,c as j}from"../../chunk-N3Y6RFSK.js";import{a as B}from"../../chunk-S77OAN6Y.js";import{f as T}from"../../chunk-KWYDYEDO.js";import{a as t,b as O}from"../../chunk-S6KFKBMY.js";import{b as i,c as x,d as D}from"../../chunk-6RSONDY2.js";import{b as w,c as v,j as L}from"../../chunk-D7WXNA2O.js";import{d as p,e as g}from"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-F4AGJWCK.js";import{createBucket as E}from"@tigrisdata/storage";import F from"enquirer";var{prompt:J}=F,a=L("buckets","create");async function W(e){w(a);let q=O(e),s=t(e,["name"]),b=t(e,["public"])?"public":t(e,["access","a","A"]),d=t(e,["enable-snapshots","enableSnapshots","s","S"]),N=t(e,["allow-object-acl","allowObjectAcl"]),P=t(e,["enable-directory-listing","enableDirectoryListing"]),h=t(e,["default-tier","t","T"]),I=t(e,["locations","l","L"]),o=t(e,["fork-of","forkOf","fork"]),u=t(e,["source-snapshot","sourceSnapshot","source-snap"]),R=!s,S;if(R){B("Provide --name to skip interactive mode");let c=p("buckets","access","create"),n=g(c),f=n?.findIndex(r=>r.value===c?.default),y=p("buckets","default-tier","create"),A=g(y),m=A?.findIndex(r=>r.value===y?.default),l=await J([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:n||[],initial:f!==void 0&&f>=0?f:0},{type:"select",name:"defaultTier",message:"Default storage tier:",choices:A||[],initial:m!==void 0&&m>=0?m:0},{type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}]);s=l.name,b=l.access,h=l.defaultTier,d=l.enableSnapshots;try{S=await C()}catch(r){i(a,r)}}s||i(a,"Bucket name is required"),u&&!o&&i(a,"--source-snapshot requires --fork-of");let{error:k}=await E(s,{defaultTier:h??"STANDARD",enableSnapshot:d===!0,allowObjectAcl:N===!0,enableDirectoryListing:P===!0,access:b??"private",locations:S??j(I??"global"),...o?{sourceBucketName:o}:{},...u?{sourceBucketSnapshot:u}:{},config:await T()});if(k&&i(a,k),q==="json"){let c=x(a,{name:s}),n={action:"created",name:s,...o?{forkOf:o}:{}};c.length>0&&(n.nextActions=c),console.log(JSON.stringify(n))}v(a,{name:s}),D(a,{name:s})}export{W as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x,b as y}from"../../chunk-S77OAN6Y.js";import{
|
|
1
|
+
import{a as x,b as y}from"../../chunk-S77OAN6Y.js";import{f as b}from"../../chunk-KWYDYEDO.js";import{a as s,b as A}from"../../chunk-S6KFKBMY.js";import{a as p,b as d,c as k,d as h}from"../../chunk-6RSONDY2.js";import{b as f,c as g,d as u,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-F4AGJWCK.js";import{removeBucket as N}from"@tigrisdata/storage";var e=l("buckets","delete");async function B(i){f(e);let w=A(i),o=s(i,["name"]),c=s(i,["yes","y","force"]);o||d(e,"Bucket name is required");let a=Array.isArray(o)?o:[o],S=await b();if(!c&&(x("Use --yes to skip confirmation"),!await y(`Delete ${a.length} bucket(s)?`))){console.log("Aborted");return}let m=[],n=[];for(let t of a){let{error:r}=await N(t,{config:S,force:c});r?(u(e,r.message,{name:t}),n.push({name:t,error:r.message})):(m.push(t),g(e,{name:t}))}if(w==="json"){let t=k(e),r={action:"deleted",names:m,errors:n};t.length>0&&(r.nextActions=t),console.log(JSON.stringify(r))}n.length>0&&p(n[0].error,e),h(e)}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{g as m}from"../../chunk-KWYDYEDO.js";import{a as f,b as c}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-6RSONDY2.js";import{b as s,c as a,j as e}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-F4AGJWCK.js";import{disableSnapshot as l}from"@tigrisdata/storage";var o=e("buckets","disable-snapshots");async function d(n){s(o);let g=c(n),t=f(n,["name"]);t||i(o,"Bucket name is required");let p=await m(),{error:r}=await l(t,{config:p});r&&i(o,r),g==="json"&&console.log(JSON.stringify({action:"snapshots-disabled",name:t})),a(o,{name:t})}export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{g as m}from"../../chunk-KWYDYEDO.js";import{a as f,b as c}from"../../chunk-S6KFKBMY.js";import{b as n}from"../../chunk-6RSONDY2.js";import{b as e,c as a,j as s}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-F4AGJWCK.js";import{enableSnapshot as l}from"@tigrisdata/storage";var o=s("buckets","enable-snapshots");async function u(r){e(o);let g=c(r),t=f(r,["name"]);t||n(o,"Bucket name is required");let p=await m(),{error:i}=await l(t,{config:p});i&&n(o,i),g==="json"&&console.log(JSON.stringify({action:"snapshots-enabled",name:t})),a(o,{name:t})}export{u as default};
|
package/dist/lib/buckets/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as s}from"../../chunk-IUIKP2LU.js";import{f as u}from"../../chunk-AFM3TY2D.js";import"../../chunk-N3Y6RFSK.js";import"../../chunk-S77OAN6Y.js";import{
|
|
1
|
+
import{c as s}from"../../chunk-IUIKP2LU.js";import{f as u}from"../../chunk-AFM3TY2D.js";import"../../chunk-N3Y6RFSK.js";import"../../chunk-S77OAN6Y.js";import{f}from"../../chunk-KWYDYEDO.js";import{a as p,b as c}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-6RSONDY2.js";import{b as a,c as i,j as m}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-F4AGJWCK.js";import{getBucketInfo as h}from"@tigrisdata/storage";var t=m("buckets","get");async function w(e){a(t);let r=p(e,["name"]),g=c(e);r||o(t,"Bucket name is required");let{data:k,error:n}=await h(r,{config:await f()});n&&o(t,n);let l=[{property:"Name",value:r},...s(k).map(({label:d,value:b})=>({property:d,value:b}))],y=u(l,g,"bucket","property",[{key:"property",header:"Property"},{key:"value",header:"Value"}]);console.log(y),i(t)}export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R,b as k,c as b,d as F,e as I,f as c,g as h}from"../../../chunk-
|
|
1
|
+
import{a as R,b as k,c as b,d as F,e as I,f as c,g as h}from"../../../chunk-C4WTV2YM.js";import"../../../chunk-IUIKP2LU.js";import"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{g as y}from"../../../chunk-KWYDYEDO.js";import{a as x,b as w}from"../../../chunk-S6KFKBMY.js";import{b as n}from"../../../chunk-6RSONDY2.js";import{b as m,c as p,j as g}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-X2SUXPXB.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-ZJWJRAFY.js";import"../../../chunk-BMWWPXMU.js";import"../../../chunk-APJUJ6TW.js";import"../../../chunk-QPUL2AAI.js";import"../../../chunk-HBEO4D3T.js";import"../../../chunk-F4AGJWCK.js";var t=g("buckets lifecycle","create");async function O(r){m(t);let C=w(r),i=x(r,["name"]);i||n(t,"Bucket name is required");let e=R(r),d=k(e);d&&n(t,d);let a=b(e),o=F(e);!a.storageClass&&!o&&n(t,"A new rule must include a transition (--storage-class with --days or --date) and/or an expiration (--expire-days or --expire-date)"),a.storageClass&&e.days===void 0&&e.date===void 0&&n(t,"--storage-class requires --days or --date for a new transition rule");let f=I(e),s=await y(),u=await c(t,i,s),S={...a,...o?{expiration:o}:{},...e.prefix!==void 0?{filter:{prefix:e.prefix}}:{},...f!==void 0?{enabled:f}:{}};await h(t,i,[...u,S],s);let l=(await c(t,i,s)).find(B=>!u.some(E=>E.id===B.id))?.id??"(unknown)";C==="json"&&console.log(JSON.stringify({action:"created",bucket:i,id:l})),p(t,{name:i,id:l})}export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,b as R,c as k,d as F,e as S,f as q,g as w}from"../../../chunk-
|
|
1
|
+
import{a as C,b as R,c as k,d as F,e as S,f as q,g as w}from"../../../chunk-C4WTV2YM.js";import"../../../chunk-IUIKP2LU.js";import"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{g as b}from"../../../chunk-KWYDYEDO.js";import{a as c,b as x}from"../../../chunk-S6KFKBMY.js";import{b as t}from"../../../chunk-6RSONDY2.js";import{b as p,c as y,j as h}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-X2SUXPXB.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-ZJWJRAFY.js";import"../../../chunk-BMWWPXMU.js";import"../../../chunk-APJUJ6TW.js";import"../../../chunk-QPUL2AAI.js";import"../../../chunk-HBEO4D3T.js";import"../../../chunk-F4AGJWCK.js";var i=h("buckets lifecycle","edit");async function E(o){p(i);let T=x(o),n=c(o,["name"]),s=c(o,["id"]);n||t(i,"Bucket name is required"),s||t(i,"Rule id is required");let e=C(o),l=R(e,{requireStorageClassForTiming:!1});l&&t(i,l);let d=k(e),f=F(e),u=S(e);d.storageClass!==void 0||d.days!==void 0||d.date!==void 0||f!==void 0||u!==void 0||e.prefix!==void 0||t(i,"Provide at least one field to change (--storage-class, --days, --date, --expire-days, --expire-date, --prefix, --enable, --disable)");let g=await b(),m=await q(i,n,g),r=m.find(a=>a.id===s);if(r||t(i,`No lifecycle rule with id "${s}" found. Run \`tigris buckets lifecycle list ${n}\` to see ids.`),e.storageClass!==void 0||e.days!==void 0||e.date!==void 0){let a=d.storageClass??r.storageClass,B=e.days!==void 0?Number(e.days):e.date!==void 0?void 0:r.days,D=e.date!==void 0?e.date:e.days!==void 0?void 0:r.date;a||t(i,"--storage-class is required (this rule has no existing transition target)"),B===void 0&&D===void 0&&t(i,"--days or --date is required (this rule has no existing transition timing)")}let I={...r,...d,...f?{expiration:f}:{},...e.prefix!==void 0?{filter:{prefix:e.prefix}}:{},...u!==void 0?{enabled:u}:{}},v=m.map(a=>a.id===s?I:a);await w(i,n,v,g),T==="json"&&console.log(JSON.stringify({action:"updated",bucket:n,id:s})),y(i,{name:n,id:s})}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h,i as b}from"../../../chunk-
|
|
1
|
+
import{h,i as b}from"../../../chunk-C4WTV2YM.js";import"../../../chunk-IUIKP2LU.js";import{b as x,d as y,e as k}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{f as g}from"../../../chunk-KWYDYEDO.js";import{a as u,b as d}from"../../../chunk-S6KFKBMY.js";import{b as r}from"../../../chunk-6RSONDY2.js";import{b as f,c as m,e as c,j as p}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-X2SUXPXB.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-ZJWJRAFY.js";import"../../../chunk-BMWWPXMU.js";import"../../../chunk-APJUJ6TW.js";import"../../../chunk-QPUL2AAI.js";import"../../../chunk-HBEO4D3T.js";import"../../../chunk-F4AGJWCK.js";import{getBucketInfo as T}from"@tigrisdata/storage";var e=p("buckets lifecycle","list");async function w(n){f(e);let a=u(n,["name"]),s=d(n);a||r(e,"Bucket name is required");let{data:C,error:l}=await T(a,{config:await g()});l&&r(e,l);let o=C?.settings.lifecycleRules??[];if(o.length===0){c(e);return}let i=o.map(t=>({id:t.id??"-",prefix:t.filter?.prefix??"-",transition:h(t),expiration:b(t),status:t.enabled===!1?"disabled":"enabled"}));console.log(s==="json"?x(i):s==="xml"?y(i,"lifecycleRules","rule"):k(i,[{key:"id",header:"ID"},{key:"prefix",header:"Prefix"},{key:"transition",header:"Transition"},{key:"expiration",header:"Expiration"},{key:"status",header:"Status"}])),m(e,{count:o.length})}export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"../../../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i}from"../../../chunk-C4WTV2YM.js";import"../../../chunk-IUIKP2LU.js";import"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-S6KFKBMY.js";import"../../../chunk-6RSONDY2.js";import"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-X2SUXPXB.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-ZJWJRAFY.js";import"../../../chunk-BMWWPXMU.js";import"../../../chunk-APJUJ6TW.js";import"../../../chunk-QPUL2AAI.js";export{e as enabledFromInput,d as expirationFromInput,f as fetchExistingRules,i as formatExpirationCell,h as formatTransitionCell,a as readRuleInput,g as submitRules,c as transitionDeltaFromInput,b as validateRuleFieldCombinations};
|
package/dist/lib/buckets/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as l}from"../../chunk-AFM3TY2D.js";import{
|
|
1
|
+
import{g as l}from"../../chunk-AFM3TY2D.js";import{f as j}from"../../chunk-KWYDYEDO.js";import{a as g,b as P,c as S}from"../../chunk-S6KFKBMY.js";import{b as m}from"../../chunk-6RSONDY2.js";import{b as D,c as d,e as k,i as u,j as E}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-F4AGJWCK.js";import{listBuckets as A,listForks as B}from"@tigrisdata/storage";var e=E("buckets","list");async function H(o){D(e);let n=P(o),s=g(o,["forks-of","forksOf"]),c=g(o,["deleted"]),{limit:r,pageToken:i}=S(o),p=await j();s&&c&&console.warn("\u26A0 --deleted is ignored when --forks-of is used; use --deleted on its own to list soft-deleted buckets");let b=[{key:"name",header:"Name"},{key:"created",header:"Created"}];if(s){let{data:t,error:x}=await B(s,{...r!==void 0?{limit:r}:{},...i?{paginationToken:i}:{},config:p});if(x&&m(e,x),!t.forks||t.forks.length===0){k(e);return}let f=[];for(let O of t.forks)f.push({name:O.name,created:O.creationDate});let y=t.paginationToken||void 0,F=l(f,n,"forks","fork",b,{paginationToken:y});console.log(F),n!=="json"&&n!=="xml"&&u(y),d(e,{count:f.length});return}let{data:a,error:h}=await A({...r!==void 0?{limit:r}:{},...i?{paginationToken:i}:{},...c?{deleted:c}:{},config:p});if(h&&m(e,h),!a.buckets||a.buckets.length===0){k(e);return}let T=a.buckets.map(t=>({name:t.name,created:t.creationDate})),w=a.paginationToken||void 0,C=l(T,n,"buckets","bucket",b,{paginationToken:w});console.log(C),n!=="json"&&n!=="xml"&&u(w),d(e,{count:T.length})}export{H as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,b as S}from"../../chunk-S77OAN6Y.js";import{
|
|
1
|
+
import{a as b,b as S}from"../../chunk-S77OAN6Y.js";import{f as x}from"../../chunk-KWYDYEDO.js";import{a as c,b as w}from"../../chunk-S6KFKBMY.js";import{b as s,c as h,d as l}from"../../chunk-6RSONDY2.js";import{b as k,c as p,j as d}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-F4AGJWCK.js";import{getBucketInfo as $,mergeFork as F}from"@tigrisdata/storage";var r=d("buckets","merge");async function I(n){k(r);let y=w(n),o=c(n,["fork"]),t=c(n,["into","source"]),f=c(n,["from-snapshot","fromSnapshot","from-snap"]),A=c(n,["yes","y"]);o||s(r,"Fork bucket name is required");let a=await x();if(!t){let{data:e,error:i}=await $(o,{config:a});i&&s(r,i);let u=e?.forkInfo?.parents?.[0]?.bucketName;u||s(r,`'${o}' is not a fork or its source bucket could not be determined. Pass --into <source-bucket>.`),t=u}if(!A&&(b("Use --yes to skip confirmation"),!await S(`Merge fork '${o}' into source '${t}'? This writes the fork's changes into '${t}'.`))){console.log("Aborted");return}let{data:N,error:m}=await F(o,t,{...f?{forkSnapshot:f}:{},config:a});m&&s(r,m);let g=N?.snapshotVersion??"";if(y==="json"){let e=h(r,{fork:o,into:t}),i={action:"merged",fork:o,into:t,snapshotVersion:g};e.length>0&&(i.nextActions=e),console.log(JSON.stringify(i))}p(r,{fork:o,into:t,snapshotVersion:g}),l(r,{fork:o,into:t})}export{I as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as k}from"../../chunk-SAAGVLRE.js";import{a as m}from"../../chunk-AFM3TY2D.js";import{e as L}from"../../chunk-KIT6R3V2.js";import{
|
|
1
|
+
import{a as k}from"../../chunk-SAAGVLRE.js";import{a as m}from"../../chunk-AFM3TY2D.js";import{e as L}from"../../chunk-KIT6R3V2.js";import{f as N}from"../../chunk-KWYDYEDO.js";import{a as x}from"../../chunk-S6KFKBMY.js";import{b as I}from"../../chunk-6RSONDY2.js";import{d as E,j as v}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-F4AGJWCK.js";import{isMigrated as X,list as j,migrate as U}from"@tigrisdata/storage";var _=v("buckets","migrate"),A=1024*1024*1024,q=50,O=1,R=100,P=1e3,$=50,H=5e3,K=3e4,V=50,z=3,W=10,C=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Z=250;function Q(e){return e.sort((t,n)=>t.size-n.size),e}function ee(e){if(e==null||e==="")return{ok:!0,bytes:q*A};let t=typeof e=="number"?e:typeof e=="string"?Number(e.trim()):Number.NaN;return Number.isFinite(t)?t<O||t>R?{ok:!1,error:`--max-in-flight-gb must be between ${O} and ${R} (got ${t})`}:{ok:!0,bytes:Math.round(t*A)}:{ok:!1,error:"--max-in-flight-gb must be a number of gigabytes"}}function te(e,t){return e.inFlight.length>=P?!0:e.inFlightBytes+t>e.maxInFlightBytes&&e.inFlight.length>0}function ne(e,t,n,a){return t===0?!1:t>=V||e.inFlight.length+t>=P||e.inFlightBytes+n+a>e.maxInFlightBytes}function re(e){return[...e].sort((t,n)=>t.scheduledAt-n.scheduledAt||(t.name<n.name?-1:t.name>n.name?1:0))}function ie(e,t){let n=re(e),a=Math.min(W,Math.max(1,t));if(n.length<=a)return{shown:n,hidden:[]};let r=Math.max(0,a-1);return{shown:n.slice(0,r),hidden:n.slice(r)}}var G=9,oe=15;function se(e,t,n){let a=Math.max(8,n-4-2-G-2-oe),r=e.name.length>a?`\u2026${e.name.slice(-Math.max(1,a-1))}`:e.name.padEnd(a),o=m(e.size).padStart(G),i=`queued ${B(t-e.scheduledAt)}`;return` ${r} ${o} ${i}`}var F=class{constructor(t,n,a,r){this.bucket=t;this.source=n;this.prefix=a;this.config=r}bucket;source;prefix;config;buffer=[];index=0;token;_done=!1;get done(){return this._done&&this.index>=this.buffer.length}async current(){return this.index<this.buffer.length?this.buffer[this.index]:this._done?null:(await this.fetchPage(),this.index<this.buffer.length?this.buffer[this.index]:null)}advance(){this.index++}async fetchPage(){if(this._done)return;let{data:t,error:n}=await j({prefix:this.prefix,source:this.source,...this.token?{paginationToken:this.token}:{},config:{...this.config,bucket:this.bucket}});if(n)throw n;this.buffer=t.items??[],this.index=0,this.token=t.paginationToken,!t.paginationToken&&!t.hasMore&&(this._done=!0)}};async function ae(e,t,n,a){let r=new F(e,"shadow",t,n),o=new F(e,"tigris",t,n),i=[],c=await r.current(),l=await o.current();for(;c!==null&&!a?.aborted;){if(l===null){i.push({name:c.name,size:c.size}),r.advance(),c=await r.current();continue}c.name<l.name?(i.push({name:c.name,size:c.size}),r.advance(),c=await r.current()):c.name>l.name?(o.advance(),l=await o.current()):(r.advance(),o.advance(),c=await r.current(),l=await o.current())}return i}function ce(e,t){return new Promise(n=>{if(t?.aborted){n();return}let a=setTimeout(()=>{t?.removeEventListener("abort",r),n()},e);function r(){clearTimeout(a),n()}t?.addEventListener("abort",r,{once:!0})})}function B(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),a=t%60;return n===0?`${a}s`:`${n}m ${a}s`}function le(e,t){let n=Date.now();e.spinnerFrame=(e.spinnerFrame+1)%C.length;let a=C[e.spinnerFrame],r=B(n-e.startTime),o=process.stderr.columns??80,i=[`${a} Migrating ${t} \xB7 ${r} elapsed`,` ${e.confirmed.toLocaleString()} / ${e.total.toLocaleString()} files done \xB7 ${e.failed.toLocaleString()} failed \xB7 ${m(e.confirmedBytes)} confirmed, ${m(e.inFlightBytes)} in flight`],c=e.inFlight.length;if(c===0)return i.push(" 0 in flight"),i;let l=Math.max(1,(process.stderr.rows??24)-1-3),{shown:f,hidden:d}=ie(e.inFlight,l);i.push(d.length===0?` ${c.toLocaleString()} in flight:`:` ${c.toLocaleString()} in flight (showing ${f.length} longest-queued):`);for(let g of f)i.push(se(g,n,o));if(d.length>0){let g=d.reduce((h,S)=>h+S.size,0);i.push(` + ${d.length.toLocaleString()} more in flight (${m(g)})`)}return i}var b=0;function fe(e,t){if(!process.stderr.isTTY||globalThis.__TIGRIS_JSON_MODE)return;let n=process.stderr.columns??80,a=le(e,t).map(o=>o.length>n?`${o.slice(0,Math.max(1,n-1))}\u2026`:o),r="";b>0&&(r+=`\x1B[${b}A`),r+="\x1B[0J",r+=`${a.join(`
|
|
2
2
|
`)}
|
|
3
3
|
`,b=a.length,process.stderr.write(r)}function M(){if(!(!process.stderr.isTTY||globalThis.__TIGRIS_JSON_MODE)){if(b>0){process.stderr.write(`\x1B[${b}A\x1B[0J`),b=0;return}process.stderr.write("\r\x1B[K")}}async function D(e,t,n,a){let r=await k(e.map(o=>async()=>({result:await U(o.name,{config:{...n,bucket:a}}),scheduledAt:Date.now()})),$);for(let o=0;o<r.length;o++){let{result:i,scheduledAt:c}=r[o],l=e[o];i.error?(t.failed++,t.errors.push({name:l.name,error:i.error.message})):(t.inFlight.push({...l,checkFailures:0,scheduledAt:c}),t.inFlightBytes+=l.size,t.scheduled++)}}async function J(e,t,n,a){let r=e.inFlight.length;if(r===0)return;let o=e.drainOffset%r,i=[];for(let f=0;f<Math.min($,r);f++)i.push(e.inFlight[(o+f)%r]);e.drainOffset=o+i.length;let c=await k(i.map(f=>()=>X(f.name,{config:{...t,bucket:n}})),$),l=new Set;for(let f=0;f<c.length;f++){let d=c[f],g=i[f];d.error?(g.checkFailures++,g.checkFailures>=z&&(l.add(g.name),e.failed++,e.inFlightBytes-=g.size,e.errors.push({name:g.name,error:`Failed to verify migration status after ${z} attempts`}))):d.data&&(l.add(g.name),e.confirmed++,e.confirmedBytes+=g.size,e.inFlightBytes-=g.size)}if(l.size>0){e.inFlight=e.inFlight.filter(f=>!l.has(f.name)),e.drainSweepMisses=0,e.checkBackoffMs=H;return}e.drainSweepMisses+=i.length,e.drainSweepMisses>=r&&(e.drainSweepMisses=0,await ce(e.checkBackoffMs,a),e.checkBackoffMs=Math.min(e.checkBackoffMs*2,K))}async function ge(e){let t=x(e,["path"]);t||I(_,"Bucket name or path is required");let{bucket:n,path:a}=L(t);n||I(_,"Invalid path");let r=ee(x(e,["max-in-flight-gb","maxInFlightGb"]));r.ok||I(_,r.error);let o=await N(),i=!1,c,l=new AbortController,f=()=>{c&&(clearInterval(c),c=void 0)},d=()=>{i&&process.exit(130),i=!0,l.abort(),f(),M()};process.on("SIGINT",d);let g=()=>{M()};process.stderr.on("resize",g);try{process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&process.stderr.write("Discovering objects to migrate...");let h;try{h=await ae(n,a,o,l.signal)}catch(u){M(),I(_,u)}if(M(),i&&(console.error(`
|
|
4
4
|
Cancelled.`),process.exit(1)),h.length===0){process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&console.error("All objects are already migrated."),globalThis.__TIGRIS_JSON_MODE&&console.log(JSON.stringify({action:"migrate",bucket:n,toMigrate:0,confirmed:0,failed:0}));return}let S=h.reduce((u,w)=>u+w.size,0);process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&console.error(`Found ${h.length.toLocaleString()} objects to migrate (${m(S)})`),Q(h);let Y=Date.now(),s={total:h.length,totalBytes:S,scheduled:0,confirmed:0,confirmedBytes:0,failed:0,inFlight:[],inFlightBytes:0,maxInFlightBytes:r.bytes,drainOffset:0,drainSweepMisses:0,checkBackoffMs:H,spinnerFrame:0,errors:[],startTime:Y};process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&(c=setInterval(()=>fe(s,n),Z),c.unref?.());let p=[],T=0;for(let u of h){if(i)break;for(ne(s,p.length,T,u.size)&&(await D(p,s,o,n),p=[],T=0);te(s,u.size)&&!i;)await J(s,o,n,l.signal);if(i)break;p.push(u),T+=u.size}for(p.length>0&&!i&&await D(p,s,o,n);s.inFlight.length>0&&!i;)await J(s,o,n,l.signal);f(),M();let y=B(Date.now()-s.startTime);if(globalThis.__TIGRIS_JSON_MODE&&console.log(JSON.stringify({action:"migrate",bucket:n,toMigrate:s.total,scheduled:s.scheduled,confirmed:s.confirmed,failed:s.failed,elapsed:y,...s.errors.length>0?{errors:s.errors.slice(0,20)}:{}})),i&&(console.error(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k,b}from"../../chunk-S77OAN6Y.js";import{
|
|
1
|
+
import{a as k,b}from"../../chunk-S77OAN6Y.js";import{f as l}from"../../chunk-KWYDYEDO.js";import{a as s,b as d}from"../../chunk-S6KFKBMY.js";import{b as n,c as g,d as p}from"../../chunk-6RSONDY2.js";import{b as f,c as m,j as u}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-F4AGJWCK.js";import{rebaseFork as A}from"@tigrisdata/storage";var o=u("buckets","rebase");async function S(r){f(o);let h=d(r),t=s(r,["fork"]),x=s(r,["yes","y"]);t||n(o,"Fork bucket name is required");let w=await l();if(!x&&(k("Use --yes to skip confirmation"),!await b(`Rebase fork '${t}' onto the latest state of its source bucket? This updates '${t}'.`))){console.log("Aborted");return}let{data:y,error:i}=await A(t,{config:w});i&&n(o,i);let c=y?.snapshotVersion??"";if(h==="json"){let e=g(o,{fork:t}),a={action:"rebased",fork:t,snapshotVersion:c};e.length>0&&(a.nextActions=e),console.log(JSON.stringify(a))}m(o,{fork:t,snapshotVersion:c}),p(o,{fork:t})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f as x}from"../../chunk-KWYDYEDO.js";import{a as d,b as l}from"../../chunk-S6KFKBMY.js";import{a as i,b as g,c as u,d as p}from"../../chunk-6RSONDY2.js";import{b as a,c as m,d as n,j as f}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-X2SUXPXB.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-ZJWJRAFY.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-HBEO4D3T.js";import"../../chunk-F4AGJWCK.js";import{restoreBucket as w}from"@tigrisdata/storage";var t=f("buckets","restore");async function A(s){a(t);let k=l(s),o=d(s,["name"]);o||g(t,"Bucket name is required");let{data:S,error:e}=await w(o,{config:await x()});if(e&&(n(t,e.message,{name:o}),i(e,t)),!S.restored){let r="Bucket could not be restored";n(t,r,{name:o}),i(r,t)}if(k==="json"){let r=u(t,{name:o}),c={action:"restored",name:o};r.length>0&&(c.nextActions=r),console.log(JSON.stringify(c))}m(t,{name:o}),p(t,{name:o})}export{A as default};
|