@tigrisdata/cli 2.14.3 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/client.js +1 -1
- package/dist/auth/fly.js +1 -1
- package/dist/auth/iam.js +1 -0
- package/dist/auth/provider.js +1 -0
- package/dist/auth/storage.js +1 -1
- package/dist/{chunk-WIOXQDND.js → chunk-4ZHCF5D6.js} +1 -1
- package/dist/chunk-7TRUGAFK.js +4 -0
- package/dist/chunk-ALJKYIQL.js +5 -0
- package/dist/{chunk-2XAO2OYD.js → chunk-ATBINUDP.js} +1 -1
- package/dist/{chunk-5J2RG53O.js → chunk-AU3RCZHB.js} +1 -1
- package/dist/chunk-EYGRHNNY.js +1 -0
- package/dist/chunk-GAWFFIPC.js +4 -0
- package/dist/chunk-IRDNZN7R.js +7 -0
- package/dist/chunk-JQUG732D.js +1 -0
- package/dist/chunk-KK7FZ7QM.js +1 -0
- package/dist/chunk-LVAJB4FR.js +2 -0
- package/dist/chunk-OHGCOC5Q.js +1 -0
- package/dist/chunk-PG746YF3.js +3 -0
- package/dist/{chunk-BETAO4PB.js → chunk-PPNBQWSR.js} +1 -1
- package/dist/chunk-TRRXHLUE.js +8 -0
- package/dist/chunk-VAVMX5DC.js +4 -0
- package/dist/chunk-YFMOI263.js +1 -0
- package/dist/chunk-YYVLDLPP.js +8 -0
- package/dist/cli-core.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/access-keys/assign.js +1 -3
- package/dist/lib/access-keys/create.js +1 -3
- package/dist/lib/access-keys/delete.js +1 -3
- package/dist/lib/access-keys/get.js +1 -3
- package/dist/lib/access-keys/list.js +1 -3
- package/dist/lib/buckets/create.js +1 -1
- package/dist/lib/buckets/delete.js +1 -1
- package/dist/lib/buckets/get.js +1 -1
- package/dist/lib/buckets/list.js +1 -1
- package/dist/lib/buckets/set-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-transition.js +1 -1
- package/dist/lib/buckets/set-ttl.js +1 -1
- package/dist/lib/buckets/set.js +1 -1
- package/dist/lib/configure/index.js +1 -1
- package/dist/lib/cp.js +1 -1
- package/dist/lib/credentials/test.js +1 -1
- package/dist/lib/forks/create.js +1 -1
- package/dist/lib/forks/list.js +1 -1
- package/dist/lib/iam/policies/create.js +1 -3
- package/dist/lib/iam/policies/delete.js +1 -3
- package/dist/lib/iam/policies/edit.js +1 -3
- package/dist/lib/iam/policies/get.js +1 -3
- package/dist/lib/iam/policies/list.js +1 -3
- package/dist/lib/iam/users/invite.js +1 -6
- package/dist/lib/iam/users/list.js +4 -9
- package/dist/lib/iam/users/remove.js +1 -6
- package/dist/lib/iam/users/revoke-invitation.js +1 -6
- package/dist/lib/iam/users/update-role.js +1 -6
- 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 -0
- package/dist/lib/objects/list.js +1 -1
- package/dist/lib/objects/put.js +1 -1
- package/dist/lib/objects/set.js +1 -1
- package/dist/lib/organizations/create.js +1 -7
- package/dist/lib/organizations/list.js +1 -4
- package/dist/lib/organizations/select.js +3 -6
- package/dist/lib/presign.js +3 -1
- package/dist/lib/rm.js +1 -1
- package/dist/lib/snapshots/list.js +1 -1
- package/dist/lib/snapshots/take.js +1 -1
- package/dist/lib/stat.js +1 -1
- package/dist/lib/touch.js +1 -1
- package/dist/lib/update.js +1 -0
- package/dist/lib/whoami.js +2 -2
- package/dist/specs.yaml +110 -219
- package/dist/utils/bucket-info.js +1 -1
- package/dist/utils/exit.js +1 -1
- package/dist/utils/format.js +1 -1
- package/dist/utils/messages.js +1 -1
- package/dist/utils/options.js +1 -1
- package/dist/utils/path.js +1 -1
- package/dist/utils/specs.js +1 -1
- package/dist/utils/update-check.js +1 -1
- package/package.json +30 -23
- package/dist/auth/config.js +0 -1
- package/dist/auth/s3-client.js +0 -1
- package/dist/auth/types.js +0 -0
- package/dist/chunk-2ALXOKBR.js +0 -1
- package/dist/chunk-2JHVFROL.js +0 -2
- package/dist/chunk-6JFWKF3Y.js +0 -8
- package/dist/chunk-CFMM35UQ.js +0 -2
- package/dist/chunk-CLT45ZCW.js +0 -1
- package/dist/chunk-CQCBYE3X.js +0 -6
- package/dist/chunk-DOUR5YEY.js +0 -1
- package/dist/chunk-IFEXFA2T.js +0 -1
- package/dist/chunk-JRALYIRA.js +0 -1
- package/dist/chunk-LCWHZUZZ.js +0 -1
- package/dist/chunk-LQ4BU234.js +0 -4
- package/dist/chunk-RJGUZ3B2.js +0 -7
- package/dist/chunk-XBGYA42R.js +0 -4
- package/dist/chunk-Y3JRLJCC.js +0 -1
package/dist/auth/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b,c}from"../chunk-KK7FZ7QM.js";import"../chunk-OHGCOC5Q.js";export{b as TigrisAuthClient,a as getAuth0Config,c as getAuthClient};
|
package/dist/auth/fly.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a}from"../chunk-GAWFFIPC.js";import"../chunk-OHGCOC5Q.js";export{a as isFlyOrganization};
|
package/dist/auth/iam.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b,b as c}from"../chunk-LVAJB4FR.js";import"../chunk-ALJKYIQL.js";import"../chunk-VAVMX5DC.js";import"../chunk-DV3LCXRH.js";import"../chunk-PG746YF3.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import"../chunk-KK7FZ7QM.js";import{a}from"../chunk-GAWFFIPC.js";import"../chunk-OHGCOC5Q.js";export{c as getIAMConfig,b as getOAuthIAMConfig,a as isFlyOrganization};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f}from"../chunk-ALJKYIQL.js";import"../chunk-ATBINUDP.js";import"../chunk-KK7FZ7QM.js";import"../chunk-OHGCOC5Q.js";export{b as getEnvCredentials,d as getStorageConfig,e as getStorageConfigWithOrg,a as getTigrisConfig,f as requireOAuthLogin,c as resolveAuthMethod};
|
package/dist/auth/storage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t}from"../chunk-OHGCOC5Q.js";export{a as CONFIG_DIR,b as CONFIG_FILE,t as clearAllData,s as clearOAuthData,r as clearTemporaryCredentials,e as clearTokens,k as getAwsProfileConfig,p as getLoginMethod,g as getOrganizations,i as getSelectedOrganization,l as getStoredCredentials,d as getTokens,j as hasAwsProfile,q as storeCredentialOrganization,m as storeCredentials,o as storeLoginMethod,f as storeOrganizations,h as storeSelectedOrganization,n as storeTemporaryCredentials,c as storeTokens};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-IRDNZN7R.js";function i(e){let s=[{label:"Number of Objects",value:e.sizeInfo.numberOfObjects?.toString()??"N/A"},{label:"Total Size",value:e.sizeInfo.size!==void 0?n(e.sizeInfo.size):"N/A"},{label:"All Versions Count",value:e.sizeInfo.numberOfObjectsAllVersions?.toString()??"N/A"},{label:"Default Tier",value:e.settings.defaultTier},{label:"Snapshots Enabled",value:e.isSnapshotEnabled?"Yes":"No"},{label:"Delete Protection",value:e.settings.deleteProtection?"Yes":"No"},{label:"Allow Object ACL",value:e.settings.allowObjectAcl?"Yes":"No"},{label:"Custom Domain",value:e.settings.customDomain??"None"},{label:"Has Forks",value:e.forkInfo?.hasChildren?"Yes":"No"}];return e.forkInfo?.parents?.length&&(s.push({label:"Forked From",value:e.forkInfo.parents[0].bucketName}),s.push({label:"Fork Snapshot",value:e.forkInfo.parents[0].snapshot})),e.settings.ttlConfig&&s.push({label:"TTL",value:e.settings.ttlConfig.enabled?e.settings.ttlConfig.days?`${e.settings.ttlConfig.days} days`:e.settings.ttlConfig.date??"Enabled":"Disabled"}),e.settings.lifecycleRules?.length&&s.push({label:"Lifecycle Rules",value:e.settings.lifecycleRules.map(l=>`${l.storageClass}${l.days?` after ${l.days}d`:""}${l.enabled?"":" (disabled)"}`).join(", ")}),e.settings.corsRules.length&&s.push({label:"CORS Rules",value:`${e.settings.corsRules.length} rule(s)`}),e.settings.notifications&&s.push({label:"Notifications",value:e.settings.notifications.enabled!==!1?"Enabled":"Disabled"}),e.settings.dataMigration&&s.push({label:"Data Migration",value:e.settings.dataMigration.endpoint?`${e.settings.dataMigration.name??"N/A"} (${e.settings.dataMigration.endpoint})`:e.settings.dataMigration.name??"Configured"}),s}export{i as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{b as d}from"./chunk-YFMOI263.js";import{a as f,d as e}from"./chunk-VAVMX5DC.js";import{b as s,c as r,d as g,g as c,j as l}from"./chunk-PG746YF3.js";import{c as u}from"./chunk-KK7FZ7QM.js";import{h as m,r as p}from"./chunk-OHGCOC5Q.js";var o=l("login","oauth");async function x(h={}){s(o);let a=d(h);try{let t=u();await t.login({onDeviceCode:(i,w)=>{console.log(`
|
|
2
|
+
Your confirmation code: ${i}
|
|
3
|
+
`),console.log(`If browser doesn't open, visit: ${w}`)},onWaiting:()=>console.log(`
|
|
4
|
+
Waiting for authentication...`)}),await p();let n=await t.getOrganizations();if(n.length>0){let i=n[0];await m(i.id),a==="json"&&console.log(JSON.stringify({action:"logged_in"})),r(o,{org:i.name}),e(o),n.length>1&&c(o,{count:n.length})}else a==="json"&&console.log(JSON.stringify({action:"logged_in"})),r(o,{org:"none"}),e(o)}catch(t){g(o),f(t,o)}}var N=x;export{x as a,N as b};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as i,b as a,c as g}from"./chunk-ATBINUDP.js";import{a as A,c as I}from"./chunk-KK7FZ7QM.js";import{i as c,j as y,k as l,l as o,p as d}from"./chunk-OHGCOC5Q.js";import{fromIni as _}from"@aws-sdk/credential-providers";function K(){return process.env.AWS_ENDPOINT_URL_S3||process.env.AWS_ENDPOINT_URL_IAM?{endpoint:process.env.AWS_ENDPOINT_URL_S3||i,iamEndpoint:process.env.AWS_ENDPOINT_URL_IAM||a,mgmtEndpoint:process.env.AWS_ENDPOINT_URL_MGMT||g}:{endpoint:process.env.TIGRIS_STORAGE_ENDPOINT||i,iamEndpoint:process.env.TIGRIS_IAM_ENDPOINT||a,mgmtEndpoint:process.env.TIGRIS_MGMT_ENDPOINT||g}}var r=K(),S=A();function p(){if(process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY){let e=process.env.AWS_ENDPOINT_URL_S3||i;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||i;return{accessKeyId:process.env.TIGRIS_STORAGE_ACCESS_KEY_ID,secretAccessKey:process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY,endpoint:e,source:"tigris"}}return null}var E=!1;async function T(){if(E||!process.stdin.isTTY)return!1;E=!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 C(){if(y()){let n=process.env.AWS_PROFILE||"default",u=await _({profile:n})();return{type:"aws-profile",profile:n,accessKeyId:u.accessKeyId,secretAccessKey:u.secretAccessKey}}let e=p();if(e)return{type:"environment",accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,source:e.source};let s=d();if(s==="oauth")return{type:"oauth"};if(s==="credentials"){let n=o();if(n)return{type:"credentials",accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey}}let t=o();return t?{type:"configured",accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey}:{type:"none"}}async function f(e){let s=await C();switch(s.type){case"aws-profile":{let t=await l(s.profile);return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,endpoint:t.endpoint||r.endpoint||i,iamEndpoint:t.iamEndpoint||r.iamEndpoint}}case"oauth":{let t=I(),n=c();if(!n)throw new Error('No organization selected. Please run "tigris orgs select" first.');return{sessionToken:await t.getAccessToken(),accessKeyId:"",secretAccessKey:"",...e?.withCredentialProvider&&{credentialProvider:async()=>({accessKeyId:"",secretAccessKey:"",sessionToken:await t.getAccessToken(),expiration:new Date(Date.now()+600*1e3)})},endpoint:r.endpoint,organizationId:n,iamEndpoint:r.iamEndpoint,authDomain:S.domain}}case"credentials":{let t=c();return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,endpoint:o()?.endpoint||i,organizationId:t??void 0,iamEndpoint:r.iamEndpoint}}case"environment":return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,endpoint:p()?.endpoint||i};case"configured":{let t=c();return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,endpoint:o()?.endpoint||i,organizationId:t??void 0,iamEndpoint:r.iamEndpoint}}case"none":{if(await T())return f(e);throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}}}async function N(){let e=await f(),s=c();return{...e,...s&&!e.organizationId?{organizationId:s}:{}}}function O(e){return d()==="oauth"?!1:(p()||o()?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{K as a,p as b,C as c,f as d,N as e,O as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t="https://t3.storage.dev",s="https://iam.storageapi.dev",o="https://mgmt.storageapi.dev",e="https://registry.npmjs.org/@tigrisdata/cli/latest",T=
|
|
1
|
+
var t="https://t3.storage.dev",s="https://iam.storageapi.dev",o="https://mgmt.storageapi.dev",e="https://registry.npmjs.org/@tigrisdata/cli/latest",T=216e5,_=36e5;export{t as a,s as b,o as c,e as d,T as e,_ as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,
|
|
1
|
+
import{a as s,f as l}from"./chunk-YYVLDLPP.js";import{a as i,k as m}from"./chunk-TRRXHLUE.js";import{b as t}from"./chunk-PPNBQWSR.js";import{existsSync as c}from"fs";import{dirname as u,join as a}from"path";import{fileURLToPath as f}from"url";i();var j=f(import.meta.url),d=u(j),h=t(),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=m({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as K}from"./chunk-S77OAN6Y.js";import{a as w}from"./chunk-ALJKYIQL.js";import{b as S}from"./chunk-YFMOI263.js";import{b as d,d as m}from"./chunk-VAVMX5DC.js";import{b as i,c as n,j as o}from"./chunk-PG746YF3.js";import{a as g}from"./chunk-ATBINUDP.js";import{l as f,n as y,o as p,q as u,s as l}from"./chunk-OHGCOC5Q.js";import C from"enquirer";import{whoami as k}from"@tigrisdata/iam";var{prompt:I}=C,a=o("login","credentials");async function q(e){i(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)&&d(a,"Access key and secret are required");let h=f()?.endpoint||g;await y({accessKeyId:s,secretAccessKey:r,endpoint:h}),await p("credentials"),await l();try{let t=w(),{data:c}=await k({config:{accessKeyId:s,secretAccessKey:r,iamEndpoint:t.iamEndpoint}});c?.organizationId&&await u(c.organizationId,"temporary")}catch{}A==="json"&&console.log(JSON.stringify({action:"logged_in"})),n(a),m(a)}export{q as a};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
function B(n){if(n===0)return"0 B";let t=["B","KB","MB","GB","TB"],r=Math.floor(Math.log(n)/Math.log(1024));return`${(n/Math.pow(1024,r)).toFixed(r>0?1:0)} ${t[r]}`}function l(n){return JSON.stringify(n,null,2)}function m(n){return String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function T(n,t=" "){return Object.entries(n).map(([r,e])=>`${t}<${r}>${m(e)}</${r}>`).join(`
|
|
2
|
+
`)}function W(n,t,r){let e=[`<${t}>`];return n.forEach(o=>{e.push(` <${r}>`),e.push(T(o," ")),e.push(` </${r}>`)}),e.push(`</${t}>`),e.join(`
|
|
3
|
+
`)}function p(n,t){return n.length<=t?n:n.slice(0,t-1)+"\u2026"}function x(n){if(n==null)return"";if(n instanceof Date)return f(n);if(typeof n=="string"){let t=new Date(n);if(!isNaN(t.getTime())&&n.includes("T"))return f(t)}return String(n)}function f(n){return new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)}function j(n,t){let r=process.stdout.columns||120,e=t.length*3+1,o=r-e,s=t.map(i=>{if(i.width)return i.width;let g=i.header.length,a=n.reduce((k,b)=>{let $=x(b[i.key]);return Math.max(k,$.length)},0),h=Math.max(g,a);return i.maxWidth&&h>i.maxWidth&&(h=i.maxWidth),h}),d=s.reduce((i,g)=>i+g,0);if(d<=o)return s;let c=[...s],u=t.map(i=>Math.max(i.header.length,8));for(;d>o;){let i=-1,g=0;for(let a=0;a<c.length;a++)c[a]>u[a]&&c[a]>g&&(g=c[a],i=a);if(i===-1)break;c[i]--,d--}return c}function w(n,t){let r=[],e=j(n,t),o="\u250C"+e.map(u=>"\u2500".repeat(u+2)).join("\u252C")+"\u2510",s="\u251C"+e.map(u=>"\u2500".repeat(u+2)).join("\u253C")+"\u2524",d="\u2514"+e.map(u=>"\u2500".repeat(u+2)).join("\u2534")+"\u2518";r.push(`
|
|
4
|
+
`+o);let c="\u2502 "+t.map((u,i)=>p(u.header,e[i]).padEnd(e[i])).join(" \u2502 ")+" \u2502";return r.push(c),r.push(s),n.forEach(u=>{let i=t.map((g,a)=>{let h=p(x(u[g.key]),e[a]);return g.align==="right"?h.padStart(e[a]):h.padEnd(e[a])});r.push("\u2502 "+i.join(" \u2502 ")+" \u2502")}),r.push(d+`
|
|
5
|
+
`),r.join(`
|
|
6
|
+
`)}function R(n,t,r,e,o){switch(t){case"json":return l(n);case"xml":return W(n,r,e);default:return w(n,o)}}function C(n,t,r,e,o,s){switch(t){case"json":{let d={items:n};return s.paginationToken&&(d.paginationToken=s.paginationToken),l(d)}case"xml":return M(n,r,e,s);default:return w(n,o)}}function M(n,t,r,e){let o=[`<${t}>`];return n.forEach(s=>{o.push(` <${r}>`),o.push(T(s," ")),o.push(` </${r}>`)}),e.paginationToken&&o.push(` <paginationToken>${m(e.paginationToken)}</paginationToken>`),o.push(`</${t}>`),o.join(`
|
|
7
|
+
`)}export{B as a,l as b,T as c,W as d,w as e,R as f,C as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{list as g}from"@tigrisdata/storage";var c=["t3://","tigris://"];function u(t){return c.some(e=>t.startsWith(e))}function p(t){let e=c.find(r=>t.startsWith(r));return s(t.slice(e.length))}function s(t){let e=t.split("/");return{bucket:e[0],path:e.slice(1).join("/")}}async function d(t,e,r){let{data:n}=await g({prefix:`${e}/`,limit:1,config:{...r,bucket:t}});return!!(n?.items&&n.items.length>0)}function l(t,e){return{source:s(t),destination:s(e)}}function f(t){return u(t)?p(t):s(t)}function x(t){let e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*");return new RegExp("^"+e+"$")}function P(t){let e=t.indexOf("*"),r=t.lastIndexOf("/",e);return r>=0?t.slice(0,r+1):""}function h(t,e){let r=f(t);return e?{bucket:r.bucket,key:e}:{bucket:r.bucket,key:r.path}}async function b(t,e,r){let n=[],o;do{let{data:i,error:a}=await g({prefix:e,paginationToken:o,config:{...r,bucket:t}});if(a)return{items:n,error:a};i?.items&&n.push(...i.items),o=i?.hasMore?i.paginationToken:void 0}while(o);return{items:n}}export{u as a,p as b,s as c,d,l as e,f,x as g,P as h,h as i,b as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as l,d as s,e as g,f,g as p,o as k}from"./chunk-OHGCOC5Q.js";import{createRemoteJWKSet as w,jwtVerify as T}from"jose";import y from"open";function _(){let a=process.env.TIGRIS_ENV==="development",e=a?"auth-dev.tigris.dev":process.env.AUTH0_DOMAIN??"auth.storage.tigrisdata.io",t=a?"JdJVYIyw0O1uHi5L5OJH903qaWBgd3gF":process.env.AUTH0_CLIENT_ID??"DMejqeM3CQ4IqTjEcd3oA9eEiT40hn8D",n=a?"https://tigris-api-dev":process.env.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=class{config;baseUrl;jwks=null;constructor(){this.config=_(),this.baseUrl=`https://${this.config.domain}`}getJWKS(){return this.jwks||(this.jwks=w(new URL(`${this.baseUrl}/.well-known/jwks.json`))),this.jwks}async verifyIdToken(e){let{payload:t}=await T(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 l(i),k("oauth"),await this.extractAndStoreOrganizations()}async pollForToken(e,t){let i=0;for(;i<60;){i++;let r=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(!r.ok){let d=await r.text().then(JSON.parse).catch(()=>({}));if(d.error==="authorization_pending"){await this.sleep(t*1e3);continue}if(d.error==="slow_down"){t+=5,await this.sleep(t*1e3);continue}throw new Error(d.error_description||"Authentication failed")}let o=JSON.parse(await r.text());if(!o.id_token)throw new Error("No ID token found. Please try again.");if((await this.verifyIdToken(o.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()+(o.expires_in||3600)*1e3;return{accessToken:o.access_token,refreshToken:o.refresh_token,idToken:o.id_token,expiresAt:m}}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;if(e?.refreshToken?t=e:t=await s(),!t?.refreshToken)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()),r={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 l(r),r}catch{throw await g(),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(){try{let e=await this.fetchOrganizationsFromUserInfo();e&&f(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 o=JSON.parse(await i.text())[t]?.ns;return Array.isArray(o)?o.map(c=>({id:c.id,name:c.name,slug:c.name})):null}catch{return null}}async getOrganizations(){return await this.getAccessToken(),p()}async isFlyUser(){return(await this.getIdTokenClaims()).sub.includes("fly-sso")}async logout(){await g()}async isAuthenticated(){return await s()!==null}sleep(e){return new Promise(t=>setTimeout(t,e))}},h=null;function I(){return h||(h=new u),h}export{_ as a,u as b,I as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as o,c as a}from"./chunk-ALJKYIQL.js";import{b as i}from"./chunk-VAVMX5DC.js";import{c as r}from"./chunk-KK7FZ7QM.js";import{i as n,p as s}from"./chunk-OHGCOC5Q.js";async function d(e){s()!=="oauth"&&i(e,`This operation requires OAuth login.
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{loadSharedConfigFiles as y}from"@smithy/shared-ini-file-loader";import{execFileSync as m}from"child_process";import{chmodSync as v,existsSync as c,mkdirSync as C,readFileSync as h,writeFileSync as w}from"fs";import{homedir as g,platform as x}from"os";import{join as r}from"path";var s=r(g(),".tigris"),a=r(s,"config.json");function l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function u(e,n){if(x()==="win32")try{let i=process.env.USERNAME;i&&m("icacls",[e,"/inheritance:r","/grant:r",`${i}:F`],{stdio:"ignore"})}catch{console.warn(`Warning: Could not set restrictive permissions on ${e}. It may be accessible to other users.`)}else try{v(e,n)}catch{console.warn(`Warning: Could not set restrictive permissions on ${e}. It may be accessible to other users.`)}}function S(){c(s)||(C(s,{recursive:!0,mode:448}),u(s,448))}function A(e){let n={version:2},i=e.credentials;return l(i)&&typeof i.accessKeyId=="string"&&typeof i.secretAccessKey=="string"&&typeof i.endpoint=="string"&&(n.credentials={saved:{accessKeyId:i.accessKeyId,secretAccessKey:i.secretAccessKey,endpoint:i.endpoint}}),n}function t(){if(!c(a))return{version:2};try{let e=h(a,"utf8"),n=JSON.parse(e);if(!l(n))return{version:2};if(n.version===2)return n;let i=A(n);return p(i),i}catch{return{version:2}}}function p(e){S(),w(a,JSON.stringify(e,null,2),{mode:384}),u(a,384)}async function o(e){p(e)}async function O(e){let n=t();n.oauth?n.oauth.tokens=e:n.oauth={tokens:e,organizations:[]},await o(n)}async function P(){return t().oauth?.tokens??null}async function F(){let e=t();e.oauth&&delete e.oauth.tokens,await o(e)}async function M(e){let n=t();n.oauth?n.oauth.organizations=e:n.oauth={organizations:e},await o(n)}function b(){return t().oauth?.organizations??[]}async function V(e){let n=t();if(n.activeMethod==="credentials"){let i=n.credentials?.temporary??n.credentials?.saved;i&&(i.organizationId=e)}else n.oauth||(n.oauth={organizations:[]}),n.oauth.selectedOrganization=e;await o(n)}function _(){let e=t();return e.activeMethod==="credentials"?(e.credentials?.temporary??e.credentials?.saved)?.organizationId??null:e.oauth?.selectedOrganization??null}function E(){if(!process.env.AWS_PROFILE)return!1;let e=r(g(),".aws");return c(r(e,"credentials"))||c(r(e,"config"))}async function R(e){try{let{configFile:n}=await y(),i=n[e];return i?{endpoint:i.endpoint_url_s3||i.endpoint_url,iamEndpoint:i.endpoint_url_iam,region:i.region}:{}}catch{return{}}}function D(){let e=t();return f(e.credentials?.temporary)||f(e.credentials?.saved)||null}async function N(e){let n=t();n.credentials||(n.credentials={}),n.credentials.saved={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,endpoint:e.endpoint},await o(n)}async function L(e){let n=t();n.credentials||(n.credentials={}),n.credentials.temporary={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,endpoint:e.endpoint},await o(n)}async function j(e){let n=t();n.activeMethod=e,await o(n)}function W(){return t().activeMethod??null}async function $(e,n){let i=t(),d=i.credentials?.[n];d&&(d.organizationId=e,await o(i))}async function G(){let e=t();e.credentials&&delete e.credentials.temporary,await o(e)}async function J(){let e=t();delete e.oauth,e.activeMethod==="oauth"&&delete e.activeMethod,await o(e)}async function U(){let n=t().credentials?.saved;await o({version:2,credentials:n?{saved:n}:void 0})}function f(e){return e?{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,endpoint:e.endpoint}:null}export{s as a,a as b,O as c,P as d,F as e,M as f,b as g,V as h,_ as i,E as j,R as k,D as l,N as m,L as n,j as o,W as p,$ as q,G as r,J as s,U as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{c as p}from"./chunk-PPNBQWSR.js";var c={success:"\u2714",failure:"\u2716",hint:"\u2192"};function t(){return process.stdout.isTTY===!0}function i(){return globalThis.__TIGRIS_JSON_MODE===!0}function o(e){let s=p(e.command,e.operation);if(s)return s.messages}function r(e,s){let n=e;return n=n.replace(/\\n/g,`
|
|
2
|
+
`),s&&(n=n.replace(/\{\{(\w+)\}\}/g,(a,g)=>{let u=s[g];return u!==void 0?String(u):`{{${g}}}`})),n}function f(e,s){if(!t()||i())return;let n=o(e);n?.onStart&&console.log(r(n.onStart,s))}function d(e,s){if(!t()||i())return;let n=o(e);n?.onSuccess&&console.log(`${c.success} ${r(n.onSuccess,s)}`)}function m(e,s,n){if(globalThis.__TIGRIS_JSON_MODE===!0)return;let a=o(e);a?.onFailure&&console.error(`${c.failure} ${r(a.onFailure,n)}`),s&&console.error(` ${s}`)}function M(e,s){if(!t()||i())return;let n=o(e);n?.onEmpty&&console.log(r(n.onEmpty,s))}function x(e,s){if(!t()||i())return;let n=o(e);n?.onAlreadyDone&&console.log(r(n.onAlreadyDone,s))}function S(e,s){if(!t()||i())return;let n=o(e);n?.hint&&console.log(`${c.hint} ${r(n.hint,s)}`)}function b(e){t()&&console.warn(`\u26A0 Deprecated: ${e}`)}function C(e){e&&console.error(`
|
|
3
|
+
Next page: --page-token ${e}`)}function $(e,s){return{command:e,operation:s}}export{r as a,f as b,d as c,m as d,M as e,x as f,S as g,b as h,C as i,$ as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync as p}from"fs";import{
|
|
1
|
+
import{readFileSync as p}from"fs";import{dirname as l,join as u}from"path";import{fileURLToPath as f}from"url";import*as i from"yaml";var d=f(import.meta.url),S=l(d),s=null,g=u(S,"specs.yaml");function x(n){s=n}function A(){if(!s){let n=p(g,"utf8");s=i.parse(n,{schema:"core"})}return s}function y(n,e){let o=A(),t=n.split(" ").filter(Boolean),r,c=o.commands;for(let m of t){if(r=c.find(a=>a.name===m),!r)return null;c=r.commands||[]}return r?e&&r.commands?r.commands.find(m=>m.name===e)||null:r:null}function P(n,e,o){let t=y(n,o);return!t||!t.arguments?null:t.arguments.find(r=>r.name===e)||null}function _(n){return n.options?Array.isArray(n.options)&&typeof n.options[0]=="string"?n.options.map(e=>({name:e,message:e.charAt(0).toUpperCase()+e.slice(1),value:e})):Array.isArray(n.options)&&typeof n.options[0]=="object"?n.options.map(e=>({name:e.value,message:e.description?`${e.name} - ${e.description}`:e.name,value:e.value})):null:null}export{x as a,A as b,y as c,P as d,_ as e};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{a as A}from"./chunk-VAVMX5DC.js";import{h as C}from"./chunk-PG746YF3.js";import{Command as j}from"commander";function y(e,t,n,a,o){let r=e[e.length-1],s=typeof r=="object"&&r!==null&&"args"in r?r.args:e.filter(l=>typeof l=="string");if(s.length===0)return s;let m=s[0],c=(t.commands??[]).filter(l=>g(l,[...n,l.name],o));if(!new Set(c.flatMap(l=>[l.name,...Array.isArray(l.alias)?l.alias:l.alias?[l.alias]:[]])).has(m)){let l=c.map(f=>f.name),p=n.length>0?`'${m}' for '${n.join(" ")}'`:`'${m}'`;console.error(`Unknown command ${p}.`),l.length>0&&console.error(`Available commands: ${l.join(", ")}`);let u=n.length>0?`${a.name} ${n.join(" ")} help`:`${a.name} help`;console.error(`
|
|
2
|
+
Run "${u}" for usage.`),process.exit(1)}return s}function U(){process.on("unhandledRejection",e=>{(e===""||e===void 0)&&(console.error(`
|
|
3
|
+
Operation cancelled`),process.exit(1)),A(e)}),process.on("uncaughtException",e=>{A(e)})}function q(e){return/^[a-zA-Z0-9_-]+$/.test(e)}function R(e){let t;e.type==="positional"?t=` ${e.name}`:(t=` --${e.name}`,e.alias&&typeof e.alias=="string"&&(t+=e.alias.length===1?`, -${e.alias}`:`, --${e.alias}`));let n=26,a=t.length>=n?t+" ":t.padEnd(n),o=e.description;return e.options&&(Array.isArray(e.options)&&typeof e.options[0]=="string"?o+=` (options: ${e.options.join(", ")})`:o+=` (options: ${e.options.map(r=>r.value).join(", ")})`),e.default&&(o+=` [default: ${e.default}]`),e.required&&(o+=" [required]"),e["required-when"]&&(o+=` [required when: ${e["required-when"]}]`),e.multiple&&(o+=" [multiple values: comma-separated]"),e.type==="positional"&&(o+=" [positional argument]"),e.examples&&e.examples.length>0&&(o+=` (examples: ${e.examples.join(", ")})`),`${a}${o}`}function g(e,t,n){return n(t)?!0:e.commands?e.commands.some(a=>g(a,[...t,a.name],n)):!1}function b(e,t,n,a){let o=n.join(" ");if(console.log(`
|
|
4
|
+
${e.name} ${o} - ${t.description}
|
|
5
|
+
`),t.commands&&t.commands.length>0){let m=t.commands.filter(i=>g(i,[...n,i.name],a));m.length>0&&(console.log("Commands:"),m.forEach(i=>{let c=` ${i.name}`;if(i.alias){let l=Array.isArray(i.alias)?i.alias:[i.alias];c+=` (${l.join(", ")})`}let d=c.padEnd(24);console.log(`${d}${i.description}`)}),console.log())}let r=e.definitions?.global_arguments??[],s=x(r,t.arguments);s.length>0&&(console.log("Arguments:"),s.forEach(m=>{console.log(R(m))}),console.log()),t.examples&&t.examples.length>0&&(console.log("Examples:"),t.examples.forEach(m=>{console.log(` ${m}`)}),console.log()),t.commands&&t.commands.length>0&&console.log(`Use "${e.name} ${o} <command> help" for more information about a command.`)}function k(e,t,n){console.log(`Tigris CLI Version: ${t}
|
|
6
|
+
`),console.log(`Usage: tigris [command] [options]
|
|
7
|
+
`),console.log("Commands:"),e.commands.filter(o=>g(o,[o.name],n)).forEach(o=>{let r=` ${o.name}`;if(o.alias){let m=Array.isArray(o.alias)?o.alias:[o.alias];r+=` (${m.join(", ")})`}let s=r.padEnd(24);console.log(`${s}${o.description}`)}),console.log(`
|
|
8
|
+
Use "${e.name} <command> help" for more information about a command.`)}function x(e,t){let n=t??[],a=new Set(n.map(s=>s.name)),o=new Set(n.filter(s=>s.alias).map(s=>s.alias)),r=e.filter(s=>!a.has(s.name)&&!(s.alias&&o.has(s.alias)));return[...n,...r]}function E(e,t=[]){t.forEach(n=>{if(n.type==="positional"){let a=n.required?`<${n.name}>`:`[${n.name}]`;e.argument(a,n.description)}else{let a=n.alias&&typeof n.alias=="string"&&n.alias.length===1,o=n.alias&&typeof n.alias=="string"&&n.alias.length>1,r=a?`-${n.alias}, --${n.name}`:o?`--${n.alias}, --${n.name}`:`--${n.name}`;n.type==="flag"||(n.type==="boolean"?r+=" [value]":n.options?r+=" <value>":r+=n.required||n["required-when"]?" <value>":" [value]"),e.option(r,n.description,n.default)}})}function L(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function w(e,t,n){if(n){let o=n.find(r=>r.name===t);if(o&&o.alias&&typeof o.alias=="string"){let r=o.alias.charAt(0).toUpperCase()+o.alias.slice(1);if(e[r]!==void 0)return e[r]}}let a=[t,t.replace(/-/g,""),t.replace(/-/g,"").toLowerCase(),t.charAt(0).toUpperCase(),L(t)];for(let o of a)if(e[o]!==void 0)return e[o]}function S(e,t){for(let n of e){if(n["required-when"]){let[a,o]=n["required-when"].split("="),r=w(t,a,e),s=w(t,n.name,e);if(r===o&&!s)return console.error(`--${n.name} is required when --${a} is ${o}`),!1}if(n.required&&!w(t,n.name,e))return console.error(`--${n.name} is required`),!1}return!0}function h(e,t,n){let a;"optsWithGlobals"in n&&typeof n.optsWithGlobals=="function"?a=n.optsWithGlobals():"opts"in n&&typeof n.opts=="function"?a=n.opts():a=n;let o={...a};return e.filter(s=>s.type==="positional").forEach((s,m)=>{t[m]!==void 0&&(s.multiple?o[s.name]=t[m].split(",").map(i=>i.trim()):o[s.name]=t[m])}),e.forEach(s=>{s.multiple&&s.type!=="positional"&&o[s.name]&&typeof o[s.name]=="string"&&(o[s.name]=o[s.name].split(",").map(m=>m.trim()))}),o}async function v(e,t,n=[],a={}){(a.json||a.format==="json")&&(globalThis.__TIGRIS_JSON_MODE=!0);let{module:o,error:r}=await e(t);(r||!o)&&(console.error(r),process.exit(1));let s=t[t.length-1],m=o.default||o[s];typeof m!="function"&&(console.error(`Command not implemented: ${t.join(" ")}`),process.exit(1)),await m({...a,_positional:n})}function I(e,t,n,a=[]){let{specs:o,loadModule:r,hasImplementation:s}=e,m=o.definitions?.global_arguments??[];for(let i of n){q(i.name)||(console.error(`Invalid command name "${i.name}": only alphanumeric, hyphens, and underscores allowed`),process.exit(1));let c=[...a,i.name];if(!g(i,c,s))continue;let d=t.command(i.name).description(i.description);if(i.alias&&(Array.isArray(i.alias)?i.alias:[i.alias]).forEach(p=>d.alias(p)),i.commands&&i.commands.length>0)if(I(e,d,i.commands,c),i.default){let l=i.commands.find(p=>p.name===i.default);if(l){let p=x(m,[...i.arguments||[],...l.arguments||[]]);E(d,p),d.allowExcessArguments(!0),d.action(async(...u)=>{let f=u.pop(),$=y([f],i,c,o,s);p.length>0&&!S(p,h(p,$,f))||(l.deprecated&&l.messages?.onDeprecated&&C(l.messages.onDeprecated),await v(r,[...c,l.name],$,h(p,$,f)))})}}else d.allowExcessArguments(!0),d.action((...l)=>{y(l,i,c,o,s),b(o,i,c,s)});else E(d,x(m,i.arguments)),d.action(async(...l)=>{let p=l.pop(),u=l;i.arguments&&!S(i.arguments,h(i.arguments,u,p))||(i.deprecated&&i.messages?.onDeprecated&&C(i.messages.onDeprecated),await v(r,c,u,h(i.arguments||[],u,p)))});d.command("help").description("Show help for this command").action(()=>{b(o,i,c,s)})}}function V(e){let{specs:t,version:n,hasImplementation:a}=e,o=new j;return o.name(t.name).description(t.description).version(n),I(e,o,t.commands),o.command("help").description("Show general help").action(()=>{k(t,n,a)}),o.command("version").description("Show the CLI version").action(()=>{console.log(n)}),o.allowExcessArguments(!0),o.action((...r)=>{y(r,{commands:t.commands},[],t,a),k(t,n,a)}),o}export{U as a,q as b,R as c,g as d,b as e,k as f,E as g,S as h,h as i,I as j,V as k};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{b as r}from"./chunk-DV3LCXRH.js";import{a as s,d as c}from"./chunk-PG746YF3.js";import{c as i}from"./chunk-PPNBQWSR.js";function a(){return globalThis.__TIGRIS_JSON_MODE===!0}function m(){return process.stderr.isTTY===!0}function g(){return process.stdout.isTTY===!0}function p(n,o){let e=r(n);if(a()){let t={error:{message:e.message,code:e.exitCode,category:e.category}};e.nextActions.length>0&&(t.nextActions=e.nextActions),console.error(JSON.stringify(t))}else if(o||console.error(`
|
|
2
|
+
Error: ${e.message}`),m()&&e.nextActions.length>0){console.error(`
|
|
3
|
+
Next steps:`);for(let t of e.nextActions)console.error(` \u2192 ${t.command} ${t.description}`)}process.exit(e.exitCode)}function d(n,o){let e=o instanceof Error?o.message:String(o);c(n,e),p(o,n)}function f(n,o){let e=i(n.command,n.operation);return e?.messages?.nextActions?e.messages.nextActions.map(t=>({command:s(t.command,o),description:s(t.description,o)})):[]}function A(n,o){if(!g()||a())return;let e=f(n,o);if(e.length!==0){console.log(`
|
|
4
|
+
Next steps:`);for(let t of e)console.log(` \u2192 ${t.command} ${t.description}`)}}export{p as a,d as b,f as c,A as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(n,e,t){for(let i of e)if(n[i]!==void 0)return n[i];return t}function r(n,e="table"){return o(n,["json"])?"json":o(n,["format"],e)??e}function u(n){let e=o(n,["limit"]),t=e!==void 0?Number(e):void 0,i=o(n,["page-token","pageToken","pt"]);return{limit:t,pageToken:i,isPaginated:t!==void 0||i!==void 0}}function d(n){if(n!==void 0)return typeof n=="boolean"?n:n==="true"}export{o as a,r as b,u as c,d};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{d as m,e as d,f}from"./chunk-ATBINUDP.js";import{execSync as _}from"child_process";import{mkdirSync as C,readFileSync as E,writeFileSync as I}from"fs";import T from"https";import{homedir as g}from"os";import{join as h}from"path";var u="2.16.0";var b=h(g(),".tigris","update-check.json");function y(){try{let t=E(b,"utf-8"),i=JSON.parse(t);return typeof i.latestVersion=="string"&&typeof i.lastChecked=="number"?i:null}catch{return null}}function v(t){try{C(h(g(),".tigris"),{recursive:!0}),I(b,JSON.stringify(t),"utf-8")}catch{}}function N(t,i){let a=n=>{let s=n.startsWith("v")?n.slice(1):n,l=null,o=s.indexOf("-");o!==-1&&(l=s.slice(o+1),s=s.slice(0,o));let c=s.split(".");if(c.length!==3)return null;let p=c.map(Number);return p.some(isNaN)?null:{major:p[0],minor:p[1],patch:p[2],prerelease:l}},r=a(t),e=a(i);return!r||!e?!1:e.major>r.major?!0:e.major<r.major?!1:e.minor>r.minor?!0:e.minor<r.minor?!1:e.patch>r.patch?!0:e.patch<r.patch?!1:r.prerelease&&!e.prerelease?!0:(!r.prerelease&&e.prerelease,!1)}function x(){if(process.platform==="win32")return!1;try{return _("brew list tigris",{stdio:"ignore"}),!0}catch{return!1}}function O(){let t=globalThis.__TIGRIS_BINARY===!0,i=process.platform==="win32";return t?x()?"brew upgrade tigris":i?"irm https://github.com/tigrisdata/cli/releases/latest/download/install.ps1 | iex":"curl -fsSL https://github.com/tigrisdata/cli/releases/latest/download/install.sh | sh":"npm install -g @tigrisdata/cli"}function j(t={}){return new Promise((i,a)=>{let r=T.get(m,{timeout:1e4},e=>{let n="";e.on("data",s=>{n+=s}),e.on("end",()=>{try{let s=JSON.parse(n);typeof s.version=="string"?(v({...y(),latestVersion:s.version,lastChecked:Date.now()}),i(s.version)):a(new Error("Unexpected registry response"))}catch{a(new Error("Failed to parse registry response"))}})});r.on("error",e=>{a(e)}),r.on("timeout",()=>{r.destroy(),a(new Error("Request timed out"))}),t.unref&&r.on("socket",e=>{e.unref()}),r.end()})}function k(){j({unref:!0}).catch(()=>{})}function P(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let t=y(),i=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||36e5;if(t&&N(u,t.latestVersion)&&(!t.lastNotified||Date.now()-t.lastNotified>i)){let r=`Update available: ${u} \u2192 ${t.latestVersion}`,e='Run "tigris update" to upgrade.',n=Math.max(r.length,e.length)+4,s="\u250C"+"\u2500".repeat(n-2)+"\u2510",l="\u2514"+"\u2500".repeat(n-2)+"\u2518",o=c=>"\u2502 "+c.padEnd(n-4)+" \u2502";console.log(`
|
|
2
|
+
${s}
|
|
3
|
+
${o("")}
|
|
4
|
+
${o(r)}
|
|
5
|
+
${o(e)}
|
|
6
|
+
${o("")}
|
|
7
|
+
${l}
|
|
8
|
+
`),v({...t,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||216e5;(!t||Date.now()-t.lastChecked>a)&&k()}export{u as a,y as b,N as c,O as d,j as e,P as f};
|
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}from"./chunk-TRRXHLUE.js";import"./chunk-VAVMX5DC.js";import"./chunk-DV3LCXRH.js";import"./chunk-PG746YF3.js";import"./chunk-PPNBQWSR.js";export{g as addArgumentsToCommand,d as commandHasAnyImplementation,k as createProgram,i as extractArgumentValues,c as formatArgumentHelp,b as isValidCommandName,j as registerCommands,a as setupErrorHandlers,e as showCommandHelp,f as showMainHelp,h as validateRequiredWhen};
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-AU3RCZHB.js";import"./chunk-YYVLDLPP.js";import"./chunk-TRRXHLUE.js";import"./chunk-VAVMX5DC.js";import"./chunk-DV3LCXRH.js";import"./chunk-PG746YF3.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
|
package/dist/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunk-ATBINUDP.js";export{b as DEFAULT_IAM_ENDPOINT,c as DEFAULT_MGMT_ENDPOINT,a as DEFAULT_STORAGE_ENDPOINT,d as NPM_REGISTRY_URL,e as UPDATE_CHECK_INTERVAL_MS,f as UPDATE_NOTIFY_INTERVAL_MS};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-AU3RCZHB.js";import"./chunk-YYVLDLPP.js";import"./chunk-TRRXHLUE.js";import"./chunk-VAVMX5DC.js";import"./chunk-DV3LCXRH.js";import"./chunk-PG746YF3.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
Run "tigris login oauth" first.`),i(`Bucket roles can only be managed when logged in via OAuth.
|
|
3
|
-
Run "tigris login oauth" first.`,e));let A=O();await A.isAuthenticated()||(n(e,'Not authenticated. Run "tigris login oauth" first.'),i('Not authenticated. Run "tigris login oauth" first.',e));let $=await A.getAccessToken(),x=w(),q=N(),b={sessionToken:$,organizationId:x??void 0,iamEndpoint:q.iamEndpoint};if(k){let{error:o}=await S(l,{config:b});o&&(n(e,o.message),i(o,e)),f==="json"&&console.log(JSON.stringify({action:"revoked",id:l})),d(e);return}let c;if(h)c=[{bucket:"*",role:"NamespaceAdmin"}];else{a.length===0&&(n(e,"At least one bucket name is required (or use --admin or --revoke-roles)"),i("At least one bucket name is required (or use --admin or --revoke-roles)",e)),r.length===0&&(n(e,"At least one role is required (or use --admin or --revoke-roles)"),i("At least one role is required (or use --admin or --revoke-roles)",e));for(let o of r)m.includes(o)||(n(e,`Invalid role "${o}". Valid roles are: ${m.join(", ")}`),i(`Invalid role "${o}". Valid roles are: ${m.join(", ")}`,e));r.length===1?c=a.map(o=>({bucket:o,role:r[0]})):r.length===a.length?c=a.map((o,g)=>({bucket:o,role:r[g]})):(n(e,`Number of roles (${r.length}) must be 1 or match number of buckets (${a.length})`),i(`Number of roles (${r.length}) must be 1 or match number of buckets (${a.length})`,e))}let{error:u}=await C(l,c,{config:b});if(u&&(n(e,u.message),i(u,e)),f==="json"){let o=y(e),g={action:"assigned",id:l,assignments:c};o.length>0&&(g.nextActions=o),console.log(JSON.stringify(g))}d(e),v(e)}export{E as default};
|
|
1
|
+
import{b as y}from"../../chunk-LVAJB4FR.js";import"../../chunk-ALJKYIQL.js";import{a as s,b as h}from"../../chunk-YFMOI263.js";import{b as n,c as b,d as p}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as A,c as f,j as R}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-GAWFFIPC.js";import"../../chunk-OHGCOC5Q.js";import{assignBucketRoles as x,revokeAllBucketRoles as w}from"@tigrisdata/iam";var e=R("access-keys","assign"),N=["Editor","ReadOnly","NamespaceAdmin"];function v(r){return r?Array.isArray(r)?r:[r]:[]}async function O(r){A(e);let g=h(r),i=s(r,["id"]),m=s(r,["admin"]),d=s(r,["revokeRoles","revoke-roles"]),l=v(s(r,["bucket","b"])),t=v(s(r,["role","r"]));i||n(e,"Access key ID is required"),m&&d&&n(e,"Cannot use --admin and --revoke-roles together");let u=await y(e);if(d){let{error:o}=await w(i,{config:u});o&&n(e,o),g==="json"&&console.log(JSON.stringify({action:"revoked",id:i})),f(e);return}let a;if(m)a=[{bucket:"*",role:"NamespaceAdmin"}];else{l.length===0&&n(e,"At least one bucket name is required (or use --admin or --revoke-roles)"),t.length===0&&n(e,"At least one role is required (or use --admin or --revoke-roles)");for(let o of t)N.includes(o)||n(e,`Invalid role "${o}". Valid roles are: ${N.join(", ")}`);t.length===1?a=l.map(o=>({bucket:o,role:t[0]})):t.length===l.length?a=l.map((o,c)=>({bucket:o,role:t[c]})):n(e,`Number of roles (${t.length}) must be 1 or match number of buckets (${l.length})`)}let{error:k}=await x(i,a,{config:u});if(k&&n(e,k),g==="json"){let o=b(e),c={action:"assigned",id:i,assignments:a};o.length>0&&(c.nextActions=o),console.log(JSON.stringify(c))}f(e),p(e)}export{O as default};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
Run "tigris login oauth" first.`),o(`Access keys can only be created when logged in via OAuth.
|
|
3
|
-
Run "tigris login oauth" first.`,e));let a=y();await a.isAuthenticated()||(n(e,'Not authenticated. Run "tigris login oauth" first.'),o('Not authenticated. Run "tigris login oauth" first.',e));let x=await a.getAccessToken(),S=p(),N=A(),{data:t,error:c}=await O(r,{config:{sessionToken:x,organizationId:S??void 0,iamEndpoint:N.iamEndpoint}});if(c&&(n(e,c.message),o(c,e)),w==="json"){let g=f(e,{name:t.name,id:t.id}),l={action:"created",name:t.name,id:t.id,secret:t.secret};g.length>0&&(l.nextActions=g),console.log(JSON.stringify(l))}else console.log(` Name: ${t.name}`),console.log(` Access Key ID: ${t.id}`),console.log(` Secret Access Key: ${t.secret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again.");m(e),h(e,{name:t.name,id:t.id})}export{R as default};
|
|
1
|
+
import{b as u}from"../../chunk-LVAJB4FR.js";import"../../chunk-ALJKYIQL.js";import{a as d,b as p}from"../../chunk-YFMOI263.js";import{b as o,c as g,d as f}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as m,j as l}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-GAWFFIPC.js";import"../../chunk-OHGCOC5Q.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,3 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
Run "tigris login oauth" first.`),i(`Access keys can only be deleted when logged in via OAuth.
|
|
3
|
-
Run "tigris login oauth" first.`,t));let c=l();if(await c.isAuthenticated()||(e(t,'Not authenticated. Run "tigris login oauth" first.'),i('Not authenticated. Run "tigris login oauth" first.',t)),!A&&(u("Use --yes to skip confirmation"),!await h(`Delete access key '${s}'?`))){console.log("Aborted");return}let k=await c.getAccessToken(),w=m(),b=d(),{error:r}=await O(s,{config:{sessionToken:k,organizationId:w??void 0,iamEndpoint:b.iamEndpoint}});r&&(e(t,r.message),i(r,t)),y==="json"&&console.log(JSON.stringify({action:"deleted",id:s})),g(t)}export{j as default};
|
|
1
|
+
import{b as g}from"../../chunk-LVAJB4FR.js";import{a as m,b as a}from"../../chunk-S77OAN6Y.js";import"../../chunk-ALJKYIQL.js";import{a as i,b as d}from"../../chunk-YFMOI263.js";import{b as t}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as n,c as s,j as f}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-GAWFFIPC.js";import"../../chunk-OHGCOC5Q.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,3 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
Run "tigris login oauth" first.`),i(`Access keys can only be retrieved when logged in via OAuth.
|
|
3
|
-
Run "tigris login oauth" first.`,o));let a=h();await a.isAuthenticated()||(e(o,'Not authenticated. Run "tigris login oauth" first.'),i('Not authenticated. Run "tigris login oauth" first.',o));let k=await a.getAccessToken(),y=m(),w=u(),{data:t,error:r}=await O(c,{config:{sessionToken:k,organizationId:y??void 0,iamEndpoint:w.iamEndpoint}});if(r&&(e(o,r.message),i(r,o)),A==="json")console.log(JSON.stringify(t));else if(console.log(` Name: ${t.name}`),console.log(` ID: ${t.id}`),console.log(` Status: ${t.status}`),console.log(` Created: ${t.createdAt}`),console.log(` Organization: ${t.organizationId}`),t.roles&&t.roles.length>0){console.log(" Roles:");for(let g of t.roles)console.log(` - ${g.bucket}: ${g.role}`)}else console.log(" Roles: None");d(o)}export{R as default};
|
|
1
|
+
import{b as m}from"../../chunk-LVAJB4FR.js";import"../../chunk-ALJKYIQL.js";import{a,b as f}from"../../chunk-YFMOI263.js";import{b as t}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,j as g}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-GAWFFIPC.js";import"../../chunk-OHGCOC5Q.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,3 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
Run "tigris login oauth" first.`),n(`Access keys can only be listed when logged in via OAuth.
|
|
3
|
-
Run "tigris login oauth" first.`,t));let c=p();await c.isAuthenticated()||(i(t,'Not authenticated. Run "tigris login oauth" first.'),n('Not authenticated. Run "tigris login oauth" first.',t));let w=await c.getAccessToken(),O=h(),C=l(),{data:o,error:s}=await b({config:{sessionToken:w,organizationId:O??void 0,iamEndpoint:C.iamEndpoint}});if(s&&(i(t,s.message),n(s,t)),!o.accessKeys||o.accessKeys.length===0){m(t);return}let g=o.accessKeys.map(e=>({name:e.name,id:e.id,status:e.status,created:e.createdAt})),R=k(g,A,"keys","key",[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}]);console.log(R),d(t,{count:g.length})}export{j as default};
|
|
1
|
+
import{b as x}from"../../chunk-LVAJB4FR.js";import{f as K,g as P}from"../../chunk-IRDNZN7R.js";import"../../chunk-ALJKYIQL.js";import{b as h,c as T}from"../../chunk-YFMOI263.js";import{b as l}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as u,e as g,i as k,j as y}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-GAWFFIPC.js";import"../../chunk-OHGCOC5Q.js";import{listAccessKeys as O}from"@tigrisdata/iam";var t=y("access-keys","list");async function S(s){f(t);let e=h(s),{limit:i,pageToken:r,isPaginated:c}=T(s),w=await x(t),{data:n,error:m}=await O({...i!==void 0?{limit:i}:{},...r?{paginationToken:r}:{},config:w});if(m&&l(t,m),!n.accessKeys||n.accessKeys.length===0){g(t);return}let o=n.accessKeys.map(a=>({name:a.name,id:a.id,status:a.status,created:a.createdAt})),d=[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}],p=n.paginationToken||void 0,A=c?P(o,e,"keys","key",d,{paginationToken:p}):K(o,e,"keys","key",d);console.log(A),c&&e!=="json"&&e!=="xml"&&k(p),u(t,{count:o.length})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as R,b as O}from"../../chunk-TD2HGNDY.js";import{a as q}from"../../chunk-S77OAN6Y.js";import{d as N}from"../../chunk-ALJKYIQL.js";import{a as t,b as D}from"../../chunk-YFMOI263.js";import{b as r,c as T,d as L}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as x,c as C,j as B}from"../../chunk-PG746YF3.js";import{d as p,e as g}from"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{createBucket as E}from"@tigrisdata/storage";import j from"enquirer";var{prompt:F}=j,n=B("buckets","create");async function J(e){x(n);let P=D(e),s=t(e,["name"]),b=t(e,["public"])?"public":t(e,["access","a","A"]),h=t(e,["enable-snapshots","s","S"]),S=t(e,["default-tier","t","T"]),l=t(e,["locations","l","L"]),a=t(e,["fork-of","forkOf","fork"]),f=t(e,["source-snapshot","sourceSnapshot","source-snap"]),k=t(e,["region","r","R"]),I=t(e,["consistency","c","C"]);k!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),l===void 0&&(l=k)),I!==void 0&&console.warn("Warning: --consistency is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/");let W=!s,w;if(W){q("Provide --name to skip interactive mode");let c=p("buckets","access","create"),o=g(c),d=o?.findIndex(i=>i.value===c?.default),v=p("buckets","default-tier","create"),A=g(v),m=A?.findIndex(i=>i.value===v?.default),u=await F([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:o||[],initial:d!==void 0&&d>=0?d: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=u.name,b=u.access,S=u.defaultTier,h=u.enableSnapshots;try{w=await R()}catch(i){r(n,i)}}s||r(n,"Bucket name is required"),f&&!a&&r(n,"--source-snapshot requires --fork-of");let{error:y}=await E(s,{defaultTier:S??"STANDARD",enableSnapshot:h===!0,access:b??"private",locations:w??O(l??"global"),...a?{sourceBucketName:a}:{},...f?{sourceBucketSnapshot:f}:{},config:await N()});if(y&&r(n,y),P==="json"){let c=T(n,{name:s}),o={action:"created",name:s,...a?{forkOf:a}:{}};c.length>0&&(o.nextActions=c),console.log(JSON.stringify(o))}C(n,{name:s}),L(n,{name:s})}export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as x,b as y}from"../../chunk-S77OAN6Y.js";import{d as b}from"../../chunk-ALJKYIQL.js";import{a as s,b as A}from"../../chunk-YFMOI263.js";import{a as p,b as d,c as k,d as h}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as g,d as u,j as l}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.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};
|
package/dist/lib/buckets/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as s}from"../../chunk-4ZHCF5D6.js";import{f as u}from"../../chunk-IRDNZN7R.js";import{d as f}from"../../chunk-ALJKYIQL.js";import{a as p,b as c}from"../../chunk-YFMOI263.js";import{b as o}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as i,j as m}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.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};
|
package/dist/lib/buckets/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as d,g as E}from"../../chunk-IRDNZN7R.js";import{d as D}from"../../chunk-ALJKYIQL.js";import{a as x,b as B,c as C}from"../../chunk-YFMOI263.js";import{b as g}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as O,c as k,e as s,i as P,j as T}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{getBucketInfo as N,listBuckets as j}from"@tigrisdata/storage";var t=T("buckets","list");async function A(f){O(t);let n=B(f),e=x(f,["forks-of","forksOf"]),{limit:p,pageToken:l,isPaginated:r}=C(f),u=await D();e&&r&&console.warn("\u26A0 Pagination flags are ignored when --forks-of is used (all buckets are fetched for filtering)");let{data:o,error:h}=await j({...e||!r?{}:{...p!==void 0?{limit:p}:{},...l?{paginationToken:l}:{}},config:u});if(h&&g(t,h),!o.buckets||o.buckets.length===0){s(t);return}if(e){let{data:a,error:y}=await N(e,{config:u});if(y&&g(t,y),!a.hasForks){s(t);return}let i=[];for(let c of o.buckets){if(c.name===e)continue;let{data:I}=await N(c.name,{config:u});I?.sourceBucketName===e&&i.push({name:c.name,created:c.creationDate})}if(i.length===0){s(t);return}let F=d(i,n,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(F),k(t,{count:i.length});return}let m=o.buckets.map(a=>({name:a.name,created:a.creationDate})),b=[{key:"name",header:"Name"},{key:"created",header:"Created"}],w=o.paginationToken||void 0,S=r?E(m,n,"buckets","bucket",b,{paginationToken:w}):d(m,n,"buckets","bucket",b);console.log(S),r&&n!=="json"&&n!=="xml"&&P(w),k(t,{count:m.length})}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as b}from"../../chunk-ALJKYIQL.js";import{a as r,b as x}from"../../chunk-YFMOI263.js";import{b as i}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,j as h}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{setBucketCors as N}from"@tigrisdata/storage";var n=h("buckets","set-cors");async function k(e){c(n);let p=x(e),o=r(e,["name"]),s=r(e,["origins"]),d=r(e,["methods"]),a=r(e,["headers"]),f=r(e,["expose-headers","exposeHeaders"]),t=r(e,["max-age","maxAge"]),g=r(e,["override"]),m=r(e,["reset"]);o||i(n,"Bucket name is required"),m&&(s!==void 0||d!==void 0||a!==void 0||f!==void 0||t!==void 0||g)&&i(n,"Cannot use --reset with other options"),!m&&!s&&i(n,"Provide --origins or --reset"),t!==void 0&&(isNaN(Number(t))||Number(t)<=0)&&i(n,"--max-age must be a positive number");let w=await b(),{error:u}=await N(o,{rules:m?[]:[{allowedOrigins:s,...d!==void 0?{allowedMethods:d}:{},...a!==void 0?{allowedHeaders:a}:{},...f!==void 0?{exposeHeaders:f}:{},maxAge:t!==void 0?Number(t):3600}],override:g??!1,config:w});u&&i(n,u),p==="json"&&console.log(JSON.stringify({action:"updated",bucket:o})),l(n,{name:o})}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as l,b as d}from"../../chunk-TD2HGNDY.js";import{a as g}from"../../chunk-S77OAN6Y.js";import{e as u}from"../../chunk-ALJKYIQL.js";import{a as e,b as p}from"../../chunk-YFMOI263.js";import{b as i}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as s,c as f,j as m}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{updateBucket as y}from"@tigrisdata/storage";var t=m("buckets","set-locations");async function B(r){s(t);let k=p(r),o=e(r,["name"]),a=e(r,["locations"]);o||i(t,"Bucket name is required");let n;if(a!==void 0)n=d(a);else{g("Provide --locations flag");try{n=await l()}catch(w){i(t,w)}}let L=await u(),{error:c}=await y(o,{locations:n,config:L});c&&i(t,c),k==="json"&&console.log(JSON.stringify({action:"updated",bucket:o})),f(t,{name:o})}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as p}from"../../chunk-ALJKYIQL.js";import{a as t,b as w}from"../../chunk-YFMOI263.js";import{b as r}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as h,c as f,j as y}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{setBucketMigration as S}from"@tigrisdata/storage";var n=y("buckets","set-migration");async function K(e){h(n);let d=w(e),i=t(e,["name"]),o=t(e,["bucket"]),a=t(e,["endpoint"]),s=t(e,["region"]),c=t(e,["access-key","accessKey"]),g=t(e,["secret-key","secretKey"]),u=t(e,["write-through","writeThrough"]),m=t(e,["disable"]);i||r(n,"Bucket name is required"),m&&(o!==void 0||a!==void 0||s!==void 0||c!==void 0||g!==void 0||u!==void 0)&&r(n,"Cannot use --disable with other migration options");let l=await p();if(m){let{error:k}=await S(i,{dataMigration:{enabled:!1},config:l});k&&r(n,k),d==="json"&&console.log(JSON.stringify({action:"updated",bucket:i})),f(n,{name:i});return}(!o||!a||!s||!c||!g)&&r(n,"Required: --bucket, --endpoint, --region, --access-key, --secret-key");let{error:b}=await S(i,{dataMigration:{enabled:!0,accessKey:c,secretKey:g,region:s,name:o,endpoint:a,writeThrough:u??!1},config:l});b&&r(n,b),d==="json"&&console.log(JSON.stringify({action:"updated",bucket:i})),f(n,{name:i})}export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as p}from"../../chunk-ALJKYIQL.js";import{a as n,b as w}from"../../chunk-YFMOI263.js";import{b as i}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b,c as h,j as k}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{setBucketNotifications as N}from"@tigrisdata/storage";var t=k("buckets","set-notifications");async function y(e){b(t);let C=w(e),d=n(e,["name"]),s=n(e,["url"]),u=n(e,["filter"]),a=n(e,["token"]),o=n(e,["username"]),r=n(e,["password"]),l=n(e,["enable"]),g=n(e,["disable"]),c=n(e,["reset"]);d||i(t,"Bucket name is required"),[l,g,c].filter(Boolean).length>1&&i(t,"Only one of --enable, --disable, or --reset can be used"),c&&(s!==void 0||u!==void 0||a!==void 0||o!==void 0||r!==void 0)&&i(t,"Cannot use --reset with other options"),!l&&!g&&!c&&s===void 0&&u===void 0&&a===void 0&&o===void 0&&r===void 0&&i(t,"Provide at least one option"),a&&(o!==void 0||r!==void 0)&&i(t,"Cannot use --token with --username/--password. Choose one auth method"),(o!==void 0&&r===void 0||o===void 0&&r!==void 0)&&i(t,"Both --username and --password are required");let B=await p(),f;c?f={}:(f={...l?{enabled:!0}:{},...g?{enabled:!1}:{},...s!==void 0?{url:s}:{},...u!==void 0?{filter:u}:{}},a?f={...f,auth:{token:a}}:o&&r&&(f={...f,auth:{username:o,password:r}}));let{error:m}=await N(d,{notificationConfig:f,config:B});m&&i(t,m),C==="json"&&console.log(JSON.stringify({action:"updated",bucket:d})),h(t,{name:d})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as b}from"../../chunk-ALJKYIQL.js";import{a as i,b as m}from"../../chunk-YFMOI263.js";import{b as t}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as u,j as g}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{setBucketLifecycle as S}from"@tigrisdata/storage";var e=g("buckets","set-transition"),y=["STANDARD_IA","GLACIER","GLACIER_IR"];async function A(a){l(e);let N=m(a),d=i(a,["name"]),r=i(a,["storage-class","storageClass"]),s=i(a,["days"]),n=i(a,["date"]),f=i(a,["enable"]),o=i(a,["disable"]);d||t(e,"Bucket name is required"),f&&o&&t(e,"Cannot use both --enable and --disable"),o&&(s!==void 0||n!==void 0||r!==void 0)&&t(e,"Cannot use --disable with --days, --date, or --storage-class"),!f&&!o&&s===void 0&&n===void 0&&t(e,"Provide --days, --date, --enable, or --disable"),(s!==void 0||n!==void 0)&&!r&&t(e,"--storage-class is required when setting --days or --date"),r&&!y.includes(r)&&t(e,`--storage-class must be one of: ${y.join(", ")} (STANDARD is not a valid transition target)`),s!==void 0&&(isNaN(Number(s))||Number(s)<=0)&&t(e,"--days must be a positive number"),n!==void 0&&(typeof n!="string"||!/^\d{4}-\d{2}-\d{2}/.test(n)||isNaN(new Date(n).getTime()))&&t(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)");let C=await b(),R={...f?{enabled:!0}:{},...o?{enabled:!1}:{},...r?{storageClass:r}:{},...s!==void 0?{days:Number(s)}:{},...n!==void 0?{date:n}:{}},{error:c}=await S(d,{lifecycleRules:[R],config:C});c&&t(e,c),N==="json"&&console.log(JSON.stringify({action:"updated",bucket:d})),u(e,{name:d})}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as b}from"../../chunk-ALJKYIQL.js";import{a as d,b as m}from"../../chunk-YFMOI263.js";import{b as n}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as l,j as c}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{setBucketTtl as p}from"@tigrisdata/storage";var e=c("buckets","set-ttl");async function k(a){u(e);let g=m(a),o=d(a,["name"]),i=d(a,["days"]),t=d(a,["date"]),r=d(a,["enable"]),s=d(a,["disable"]);o||n(e,"Bucket name is required"),r&&s&&n(e,"Cannot use both --enable and --disable"),s&&(i!==void 0||t!==void 0)&&n(e,"Cannot use --disable with --days or --date"),!r&&!s&&i===void 0&&t===void 0&&n(e,"Provide --days, --date, --enable, or --disable"),i!==void 0&&(isNaN(Number(i))||Number(i)<=0)&&n(e,"--days must be a positive number"),t!==void 0&&(typeof t!="string"||!/^\d{4}-\d{2}-\d{2}/.test(t)||isNaN(new Date(t).getTime()))&&n(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)");let y=await b(),N={...r?{enabled:!0}:{},...s?{enabled:!1}:{},...i!==void 0?{days:Number(i)}:{},...t!==void 0?{date:t}:{}},{error:f}=await p(o,{ttlConfig:N,config:y});f&&n(e,f),g==="json"&&console.log(JSON.stringify({action:"updated",bucket:o})),l(e,{name:o})}export{k as default};
|
package/dist/lib/buckets/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as y}from"../../chunk-TD2HGNDY.js";import"../../chunk-S77OAN6Y.js";import{e as k}from"../../chunk-ALJKYIQL.js";import{a as n,b as h,d as o}from"../../chunk-YFMOI263.js";import{b as r}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as w,c as D,j as O}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{updateBucket as B}from"@tigrisdata/storage";var a=O("buckets","set");async function C(e){w(a);let A=h(e),c=n(e,["name"]),s=n(e,["access"]),i=n(e,["locations"]),b=n(e,["region"]);b!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),i===void 0&&(i=b));let d=n(e,["allow-object-acl","allowObjectAcl"]),l=n(e,["disable-directory-listing","disableDirectoryListing"]),f=n(e,["cache-control","cacheControl"]),u=n(e,["custom-domain","customDomain"]),g=n(e,["enable-delete-protection","enableDeleteProtection"]),m=n(e,["enable-additional-headers","enableAdditionalHeaders"]);c||r(a,"Bucket name is required"),s===void 0&&i===void 0&&d===void 0&&l===void 0&&f===void 0&&u===void 0&&g===void 0&&m===void 0&&r(a,"At least one setting is required");let t={};s!==void 0&&(t.access=s),i!==void 0&&(t.locations=y(i)),d!==void 0&&(t.allowObjectAcl=o(d)),l!==void 0&&(t.disableDirectoryListing=o(l)),f!==void 0&&(t.cacheControl=f),u!==void 0&&(t.customDomain=u),g!==void 0&&(t.enableDeleteProtection=o(g)),m!==void 0&&(t.enableAdditionalHeaders=o(m));let j=await k(),{error:p}=await B(c,{...t,config:j});p&&r(a,p),A==="json"&&console.log(JSON.stringify({action:"updated",name:c})),D(a,{name:c})}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as K}from"../../chunk-S77OAN6Y.js";import{a as E}from"../../chunk-ALJKYIQL.js";import{b as S}from"../../chunk-YFMOI263.js";import{a as m,b as f,d as p}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as n,c as o,d,j as g}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import{a as u}from"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import{m as y,q as l}from"../../chunk-OHGCOC5Q.js";import A from"enquirer";import{whoami as w}from"@tigrisdata/iam";var{prompt:q}=A,a=g("configure");async function I(e){n(a);let h=S(e),s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,t=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret,c=e.endpoint||e.e||e.E||e.Endpoint;if(!s||!t||!c){let r=[];s||r.push({type:"input",name:"accessKey",message:"Tigris Access Key ID:",required:!0}),t||r.push({type:"password",name:"accessSecret",message:"Tigris Secret Access Key:",required:!0}),c||r.push({type:"input",name:"endpoint",message:"Tigris Endpoint:",required:!0,initial:u}),K("Provide --access-key, --access-secret, and --endpoint");let i=await q(r);s=s||i.accessKey,t=t||i.accessSecret,c=c||i.endpoint}(!s||!t||!c)&&f(a,"All credentials are required");try{await y({accessKeyId:s,secretAccessKey:t,endpoint:c});try{let r=E(),{data:i}=await w({config:{accessKeyId:s,secretAccessKey:t,iamEndpoint:r.iamEndpoint}});i?.organizationId&&await l(i.organizationId,"saved")}catch{}h==="json"&&console.log(JSON.stringify({action:"configured"})),o(a),p(a)}catch(r){d(a,"Failed to save credentials"),m(r,a)}}export{I as default};
|