@tigrisdata/cli 2.15.0 → 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.
Files changed (95) hide show
  1. package/dist/auth/client.js +1 -1
  2. package/dist/auth/fly.js +1 -1
  3. package/dist/auth/iam.js +1 -1
  4. package/dist/auth/provider.js +1 -1
  5. package/dist/auth/storage.js +1 -1
  6. package/dist/{chunk-WIOXQDND.js → chunk-4ZHCF5D6.js} +1 -1
  7. package/dist/chunk-7TRUGAFK.js +4 -0
  8. package/dist/chunk-ALJKYIQL.js +5 -0
  9. package/dist/{chunk-CMGXGXVC.js → chunk-AU3RCZHB.js} +1 -1
  10. package/dist/{chunk-4RNEQIK4.js → chunk-EYGRHNNY.js} +1 -1
  11. package/dist/chunk-GAWFFIPC.js +4 -0
  12. package/dist/chunk-IRDNZN7R.js +7 -0
  13. package/dist/chunk-KK7FZ7QM.js +1 -0
  14. package/dist/{chunk-ZHAJEGAB.js → chunk-LVAJB4FR.js} +1 -1
  15. package/dist/chunk-OHGCOC5Q.js +1 -0
  16. package/dist/chunk-PG746YF3.js +3 -0
  17. package/dist/{chunk-S33FT7Z7.js → chunk-TRRXHLUE.js} +1 -1
  18. package/dist/{chunk-3FMWZQ3C.js → chunk-VAVMX5DC.js} +1 -1
  19. package/dist/chunk-YFMOI263.js +1 -0
  20. package/dist/chunk-YYVLDLPP.js +8 -0
  21. package/dist/cli-core.js +1 -1
  22. package/dist/cli.js +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/lib/access-keys/assign.js +1 -1
  25. package/dist/lib/access-keys/create.js +1 -1
  26. package/dist/lib/access-keys/delete.js +1 -1
  27. package/dist/lib/access-keys/get.js +1 -1
  28. package/dist/lib/access-keys/list.js +1 -1
  29. package/dist/lib/buckets/create.js +1 -1
  30. package/dist/lib/buckets/delete.js +1 -1
  31. package/dist/lib/buckets/get.js +1 -1
  32. package/dist/lib/buckets/list.js +1 -1
  33. package/dist/lib/buckets/set-cors.js +1 -1
  34. package/dist/lib/buckets/set-locations.js +1 -1
  35. package/dist/lib/buckets/set-migration.js +1 -1
  36. package/dist/lib/buckets/set-notifications.js +1 -1
  37. package/dist/lib/buckets/set-transition.js +1 -1
  38. package/dist/lib/buckets/set-ttl.js +1 -1
  39. package/dist/lib/buckets/set.js +1 -1
  40. package/dist/lib/configure/index.js +1 -1
  41. package/dist/lib/cp.js +1 -1
  42. package/dist/lib/credentials/test.js +1 -1
  43. package/dist/lib/forks/create.js +1 -1
  44. package/dist/lib/forks/list.js +1 -1
  45. package/dist/lib/iam/policies/create.js +1 -1
  46. package/dist/lib/iam/policies/delete.js +1 -1
  47. package/dist/lib/iam/policies/edit.js +1 -1
  48. package/dist/lib/iam/policies/get.js +1 -1
  49. package/dist/lib/iam/policies/list.js +1 -1
  50. package/dist/lib/iam/users/invite.js +1 -1
  51. package/dist/lib/iam/users/list.js +1 -1
  52. package/dist/lib/iam/users/remove.js +1 -1
  53. package/dist/lib/iam/users/revoke-invitation.js +1 -1
  54. package/dist/lib/iam/users/update-role.js +1 -1
  55. package/dist/lib/login/credentials.js +1 -1
  56. package/dist/lib/login/oauth.js +1 -1
  57. package/dist/lib/login/select.js +1 -1
  58. package/dist/lib/logout.js +1 -1
  59. package/dist/lib/ls.js +1 -1
  60. package/dist/lib/mk.js +1 -1
  61. package/dist/lib/mv.js +1 -1
  62. package/dist/lib/objects/delete.js +1 -1
  63. package/dist/lib/objects/get.js +1 -1
  64. package/dist/lib/objects/info.js +1 -1
  65. package/dist/lib/objects/list.js +1 -1
  66. package/dist/lib/objects/put.js +1 -1
  67. package/dist/lib/objects/set.js +1 -1
  68. package/dist/lib/organizations/create.js +1 -1
  69. package/dist/lib/organizations/list.js +1 -1
  70. package/dist/lib/organizations/select.js +1 -1
  71. package/dist/lib/presign.js +2 -2
  72. package/dist/lib/rm.js +1 -1
  73. package/dist/lib/snapshots/list.js +1 -1
  74. package/dist/lib/snapshots/take.js +1 -1
  75. package/dist/lib/stat.js +1 -1
  76. package/dist/lib/touch.js +1 -1
  77. package/dist/lib/update.js +1 -1
  78. package/dist/lib/whoami.js +2 -2
  79. package/dist/specs.yaml +20 -0
  80. package/dist/utils/bucket-info.js +1 -1
  81. package/dist/utils/exit.js +1 -1
  82. package/dist/utils/format.js +1 -1
  83. package/dist/utils/messages.js +1 -1
  84. package/dist/utils/options.js +1 -1
  85. package/dist/utils/update-check.js +1 -1
  86. package/package.json +6 -9
  87. package/dist/chunk-552FMFE5.js +0 -5
  88. package/dist/chunk-5VDFQRGP.js +0 -2
  89. package/dist/chunk-7RGWTDUP.js +0 -1
  90. package/dist/chunk-AEADROU6.js +0 -4
  91. package/dist/chunk-AHGPPFCQ.js +0 -1
  92. package/dist/chunk-BC2HK4K6.js +0 -1
  93. package/dist/chunk-CQCBYE3X.js +0 -6
  94. package/dist/chunk-JVQ7GLJH.js +0 -4
  95. package/dist/chunk-KCWQ4II7.js +0 -8
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunk-BC2HK4K6.js";import"../chunk-7RGWTDUP.js";export{b as TIGRIS_CLAIMS_NAMESPACE,c as TigrisAuthClient,a as getAuth0Config,d as getAuthClient};
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,b,c}from"../chunk-AEADROU6.js";import"../chunk-BC2HK4K6.js";import"../chunk-7RGWTDUP.js";export{c as fetchOrganizationsFromUserInfo,b as isFlyOrganization,a as isFlyUser};
1
+ import{a}from"../chunk-GAWFFIPC.js";import"../chunk-OHGCOC5Q.js";export{a as isFlyOrganization};
package/dist/auth/iam.js CHANGED
@@ -1 +1 @@
1
- import{a as b,b as c}from"../chunk-ZHAJEGAB.js";import"../chunk-552FMFE5.js";import"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import"../chunk-5VDFQRGP.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import{b as a}from"../chunk-AEADROU6.js";import"../chunk-BC2HK4K6.js";import"../chunk-7RGWTDUP.js";export{c as getIAMConfig,b as getOAuthIAMConfig,a as isFlyOrganization};
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};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h}from"../chunk-552FMFE5.js";import"../chunk-ATBINUDP.js";import"../chunk-BC2HK4K6.js";import"../chunk-7RGWTDUP.js";export{c as getCredentials,b as getEnvCredentials,d as getLoginMethod,f as getStorageConfig,g as getStorageConfigWithOrg,a as getTigrisConfig,h as requireOAuthLogin,e as resolveAuthMethod};
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};
@@ -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-7RGWTDUP.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
+ 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-CQCBYE3X.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};
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
- import{a as s,f as l}from"./chunk-KCWQ4II7.js";import{a as i,k as m}from"./chunk-S33FT7Z7.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();
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();
@@ -1 +1 @@
1
- import{a as K}from"./chunk-S77OAN6Y.js";import{a as w}from"./chunk-552FMFE5.js";import{b as S}from"./chunk-AHGPPFCQ.js";import{b as d,d as m}from"./chunk-3FMWZQ3C.js";import{b as i,c as n,i as o}from"./chunk-5VDFQRGP.js";import{a as g}from"./chunk-ATBINUDP.js";import{l as f,n as y,o as u,q as p,s as l}from"./chunk-7RGWTDUP.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 u("credentials"),await l();try{let t=w(),{data:c}=await k({config:{accessKeyId:s,secretAccessKey:r,iamEndpoint:t.iamEndpoint}});c?.organizationId&&await p(c.organizationId)}catch{}A==="json"&&console.log(JSON.stringify({action:"logged_in"})),n(a),m(a)}export{q as a};
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,4 @@
1
+ import{i as o}from"./chunk-OHGCOC5Q.js";function i(t){return o()?.startsWith("flyio_")?(console.log(`${t} is not available for Fly.io organizations.
2
+ Your resources are managed through Fly.io.
3
+
4
+ Visit https://fly.io to manage your organization.`),!0):!1}export{i 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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}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{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};
@@ -1,2 +1,2 @@
1
- import{a as o,e as a}from"./chunk-552FMFE5.js";import{b as i}from"./chunk-3FMWZQ3C.js";import{d as r}from"./chunk-BC2HK4K6.js";import{i as n,p as s}from"./chunk-7RGWTDUP.js";async function d(e){s()!=="oauth"&&i(e,`This operation requires OAuth login.
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
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,4 +1,4 @@
1
- import{a as A}from"./chunk-3FMWZQ3C.js";import{h as C}from"./chunk-5VDFQRGP.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(`
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
2
  Run "${u}" for usage.`),process.exit(1)}return s}function U(){process.on("unhandledRejection",e=>{(e===""||e===void 0)&&(console.error(`
3
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
4
  ${e.name} ${o} - ${t.description}
@@ -1,4 +1,4 @@
1
- import{b as r}from"./chunk-DV3LCXRH.js";import{a as s,d as c}from"./chunk-5VDFQRGP.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(`
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
2
  Error: ${e.message}`),m()&&e.nextActions.length>0){console.error(`
3
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
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-S33FT7Z7.js";import"./chunk-3FMWZQ3C.js";import"./chunk-DV3LCXRH.js";import"./chunk-5VDFQRGP.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};
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-CMGXGXVC.js";import"./chunk-KCWQ4II7.js";import"./chunk-S33FT7Z7.js";import"./chunk-3FMWZQ3C.js";import"./chunk-DV3LCXRH.js";import"./chunk-5VDFQRGP.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
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/index.js CHANGED
@@ -1 +1 @@
1
- import"./chunk-CMGXGXVC.js";import"./chunk-KCWQ4II7.js";import"./chunk-S33FT7Z7.js";import"./chunk-3FMWZQ3C.js";import"./chunk-DV3LCXRH.js";import"./chunk-5VDFQRGP.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
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 +1 @@
1
- import{b as y}from"../../chunk-ZHAJEGAB.js";import"../../chunk-552FMFE5.js";import{a as s,b as h}from"../../chunk-AHGPPFCQ.js";import{b as n,c as b,d as p}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as A,c as f,i as R}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-AEADROU6.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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 +1 @@
1
- import{b as u}from"../../chunk-ZHAJEGAB.js";import"../../chunk-552FMFE5.js";import{a as d,b as p}from"../../chunk-AHGPPFCQ.js";import{b as o,c as g,d as f}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as m,i as l}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-AEADROU6.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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 +1 @@
1
- import{b as g}from"../../chunk-ZHAJEGAB.js";import{a as m,b as a}from"../../chunk-S77OAN6Y.js";import"../../chunk-552FMFE5.js";import{a as i,b as d}from"../../chunk-AHGPPFCQ.js";import{b as t}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as n,c as s,i as f}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-AEADROU6.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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 +1 @@
1
- import{b as m}from"../../chunk-ZHAJEGAB.js";import"../../chunk-552FMFE5.js";import{a,b as f}from"../../chunk-AHGPPFCQ.js";import{b as t}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,i as g}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-AEADROU6.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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 +1 @@
1
- import{b as d}from"../../chunk-ZHAJEGAB.js";import{f as p}from"../../chunk-CQCBYE3X.js";import"../../chunk-552FMFE5.js";import{b as f}from"../../chunk-AHGPPFCQ.js";import{b as m}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as a,c,e as n,i}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-AEADROU6.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.js";import{listAccessKeys as h}from"@tigrisdata/iam";var t=i("access-keys","list");async function k(u){a(t);let y=f(u),g=await d(t),{data:s,error:r}=await h({config:g});if(r&&m(t,r),!s.accessKeys||s.accessKeys.length===0){n(t);return}let o=s.accessKeys.map(e=>({name:e.name,id:e.id,status:e.status,created:e.createdAt})),l=p(o,y,"keys","key",[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}]);console.log(l),c(t,{count:o.length})}export{k 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 R,b as O}from"../../chunk-TD2HGNDY.js";import{a as q}from"../../chunk-S77OAN6Y.js";import{f as N}from"../../chunk-552FMFE5.js";import{a as t,b as D}from"../../chunk-AHGPPFCQ.js";import{b as r,c as T,d as L}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as x,c as C,i as B}from"../../chunk-5VDFQRGP.js";import{d as p,e as g}from"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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 x,b as y}from"../../chunk-S77OAN6Y.js";import{f as b}from"../../chunk-552FMFE5.js";import{a as s,b as A}from"../../chunk-AHGPPFCQ.js";import{a as p,b as d,c as k,d as h}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as g,d as u,i as l}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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};
@@ -1 +1 @@
1
- import{a as s}from"../../chunk-WIOXQDND.js";import{f as u}from"../../chunk-CQCBYE3X.js";import{f}from"../../chunk-552FMFE5.js";import{a as p,b as c}from"../../chunk-AHGPPFCQ.js";import{b as o}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as i,i as m}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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};
@@ -1 +1 @@
1
- import{f as u}from"../../chunk-CQCBYE3X.js";import{f as w}from"../../chunk-552FMFE5.js";import{a as b,b as y}from"../../chunk-AHGPPFCQ.js";import{b as f}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as i,e as c,i as h}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.js";import{getBucketInfo as O,listBuckets as E}from"@tigrisdata/storage";var t=h("buckets","list");async function N(m){l(t);let k=y(m),e=b(m,["forks-of","forksOf"]),s=await w(),{data:r,error:g}=await E({config:s});if(g&&f(t,g),!r.buckets||r.buckets.length===0){c(t);return}if(e){let{data:o,error:p}=await O(e,{config:s});if(p&&f(t,p),!o.hasForks){c(t);return}let n=[];for(let a of r.buckets){if(a.name===e)continue;let{data:D}=await O(a.name,{config:s});D?.sourceBucketName===e&&n.push({name:a.name,created:a.creationDate})}if(n.length===0){c(t);return}let C=u(n,k,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(C),i(t,{count:n.length});return}let d=r.buckets.map(o=>({name:o.name,created:o.creationDate})),B=u(d,k,"buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(B),i(t,{count:d.length})}export{N as default};
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{g as b}from"../../chunk-552FMFE5.js";import{a as r,b as x}from"../../chunk-AHGPPFCQ.js";import{b as i}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,i as h}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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 l,b as d}from"../../chunk-TD2HGNDY.js";import{a as g}from"../../chunk-S77OAN6Y.js";import{g as u}from"../../chunk-552FMFE5.js";import{a as e,b as p}from"../../chunk-AHGPPFCQ.js";import{b as i}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as s,c as f,i as m}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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{g as p}from"../../chunk-552FMFE5.js";import{a as t,b as w}from"../../chunk-AHGPPFCQ.js";import{b as r}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as h,c as f,i as y}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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{g as p}from"../../chunk-552FMFE5.js";import{a as n,b as w}from"../../chunk-AHGPPFCQ.js";import{b as i}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b,c as h,i as k}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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{g as b}from"../../chunk-552FMFE5.js";import{a as i,b as m}from"../../chunk-AHGPPFCQ.js";import{b as t}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as u,i as g}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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{g as b}from"../../chunk-552FMFE5.js";import{a as d,b as m}from"../../chunk-AHGPPFCQ.js";import{b as n}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as l,i as c}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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};
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};
@@ -1 +1 @@
1
- import{b as y}from"../../chunk-TD2HGNDY.js";import"../../chunk-S77OAN6Y.js";import{g as k}from"../../chunk-552FMFE5.js";import{a as n,b as h,c as o}from"../../chunk-AHGPPFCQ.js";import{b as r}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as w,c as D,i as O}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.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
+ 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 S}from"../../chunk-S77OAN6Y.js";import{a as h}from"../../chunk-552FMFE5.js";import{b as E}from"../../chunk-AHGPPFCQ.js";import{a as m,b as f,d as p}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as n,c as o,d,i as g}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import{a as u}from"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import{m as y,o as l,q as K}from"../../chunk-7RGWTDUP.js";import A from"enquirer";import{whoami as I}from"@tigrisdata/iam";var{prompt:q}=A,a=g("configure");async function T(e){n(a);let w=E(e),t=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,s=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret,i=e.endpoint||e.e||e.E||e.Endpoint;if(!t||!s||!i){let r=[];t||r.push({type:"input",name:"accessKey",message:"Tigris Access Key ID:",required:!0}),s||r.push({type:"password",name:"accessSecret",message:"Tigris Secret Access Key:",required:!0}),i||r.push({type:"input",name:"endpoint",message:"Tigris Endpoint:",required:!0,initial:u}),S("Provide --access-key, --access-secret, and --endpoint");let c=await q(r);t=t||c.accessKey,s=s||c.accessSecret,i=i||c.endpoint}(!t||!s||!i)&&f(a,"All credentials are required");try{await y({accessKeyId:t,secretAccessKey:s,endpoint:i}),await l("credentials");try{let r=h(),{data:c}=await I({config:{accessKeyId:t,secretAccessKey:s,iamEndpoint:r.iamEndpoint}});c?.organizationId&&await K(c.organizationId)}catch{}w==="json"&&console.log(JSON.stringify({action:"configured"})),o(a),p(a)}catch(r){d(a,"Failed to save credentials"),m(r,a)}}export{T as default};
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};
package/dist/lib/cp.js CHANGED
@@ -1 +1 @@
1
- import{a as C}from"../chunk-SAAGVLRE.js";import{a as B}from"../chunk-EKW6XTGL.js";import{a as w}from"../chunk-CQCBYE3X.js";import{a as U,b as T,d as D,g as O,h as J,j}from"../chunk-JQUG732D.js";import{f as G}from"../chunk-552FMFE5.js";import{a as x,b as q}from"../chunk-AHGPPFCQ.js";import{a as f}from"../chunk-3FMWZQ3C.js";import"../chunk-DV3LCXRH.js";import"../chunk-5VDFQRGP.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import"../chunk-BC2HK4K6.js";import"../chunk-7RGWTDUP.js";import{get as V,head as X,list as tt,put as E}from"@tigrisdata/storage";import{createReadStream as et,createWriteStream as ot,existsSync as Y,mkdirSync as it,readdirSync as z,statSync as L}from"fs";import{homedir as nt}from"os";import{basename as M,dirname as K,join as N,relative as _,resolve as H}from"path";import{Readable as Z}from"stream";import{pipeline as rt}from"stream/promises";var h=!1;function at(n,t){let e=U(n),l=U(t);return!e&&!l&&f("At least one path must be a remote Tigris path (t3:// or tigris://)"),e&&l?"remote-to-remote":e?"remote-to-local":"local-to-remote"}function P(n){return n==="~"||n.startsWith("~/")?H(nt(),n.slice(2)):H(n)}function lt(n){return z(n,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>{let l=e.parentPath??e.path;return N(l,e.name)})}function ct(n,t){let e=K(n),l=M(n),s=O(l);return Y(e)?t?z(e,{recursive:!0,withFileTypes:!0}).filter(r=>r.isFile()&&s.test(r.name)).map(r=>{let o=r.parentPath??r.path;return N(o,r.name)}):z(e,{withFileTypes:!0}).filter(o=>o.isFile()&&s.test(o.name)).map(o=>N(e,o.name)):[]}async function I(n,t,e,l,s=!1){let p;try{p=L(n).size}catch{return{error:`File not found: ${n}`}}let r=et(n),o=Z.toWeb(r),{error:i}=await E(e,o,{...B(p),onUploadProgress:s?({loaded:a})=>{if(p!==void 0&&p>0){let c=Math.round(a/p*100);process.stdout.write(`\rUploading: ${w(a)} / ${w(p)} (${c}%)`)}else process.stdout.write(`\rUploading: ${w(a)}`)}:void 0,config:{...l,bucket:t}});return s&&process.stdout.write("\r"+" ".repeat(60)+"\r"),i?{error:i.message}:{}}async function Q(n,t,e,l,s=!1){let p;if(s){let{data:u}=await X(t,{config:{...l,bucket:n}});p=u?.size}let{data:r,error:o}=await V(t,"stream",{config:{...l,bucket:n}});if(o)return{error:o.message};let i=K(e);Y(i)||it(i,{recursive:!0});let a=ot(e),c=Z.fromWeb(r);if(s&&p!==void 0&&p>0){let u=0;c.on("data",m=>{u+=m.length;let g=Math.round(u/p*100);process.stdout.write(`\rDownloading: ${w(u)} / ${w(p)} (${g}%)`)})}return await rt(c,a),s&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function A(n,t,e,l,s,p=!1){if(e.endsWith("/")){let{error:c}=await E(s,"",{config:{...n,bucket:l}});return c?{error:c.message}:{}}let r;if(p){let{data:c}=await X(e,{config:{...n,bucket:t}});r=c?.size}let{data:o,error:i}=await V(e,"stream",{config:{...n,bucket:t}});if(i)return{error:i.message};let{error:a}=await E(s,o,{...B(r),onUploadProgress:p?({loaded:c})=>{if(r!==void 0&&r>0){let u=Math.round(c/r*100);process.stdout.write(`\rCopying: ${w(c)} / ${w(r)} (${u}%)`)}else process.stdout.write(`\rCopying: ${w(c)}`)}:void 0,config:{...n,bucket:l}});return p&&process.stdout.write("\r"+" ".repeat(60)+"\r"),a?{error:a.message}:{}}async function st(n,t,e,l){let s=P(n);if(n.includes("*")){let o=ct(s,l);if(o.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files matching pattern");return}let i=K(s),a=o.map(m=>async()=>{let g=_(i,m),k=t.path?`${t.path.replace(/\/$/,"")}/${g}`:g,$=await I(m,t.bucket,k,e);return $.error?(console.error(`Failed to upload ${m}: ${$.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${k}`),!0)}),u=(await C(a,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:u}):`Uploaded ${u} file(s)`);return}let r;try{r=L(s)}catch{f(`Source not found: ${n}`)}if(r.isDirectory()){l||f(`${n} is a directory (not copied). Use -r to copy recursively.`);let o=lt(s);if(o.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files to upload");return}let i=n.endsWith("/")?"":M(s),a=o.map(m=>async()=>{let g=_(s,m),$=[t.path?.replace(/\/$/,""),i,g].filter(Boolean).join("/"),R=await I(m,t.bucket,$,e);return R.error?(console.error(`Failed to upload ${m}: ${R.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${$}`),!0)}),u=(await C(a,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:u}):`Uploaded ${u} file(s)`)}else{let o=M(s),i;t.path?n.endsWith("/")||t.path.endsWith("/")?i=`${t.path.replace(/\/$/,"")}/${o}`:await D(t.bucket,t.path,e)?i=`${t.path}/${o}`:i=t.path:i=o;let a=await I(s,t.bucket,i,e,!h);a.error&&f(a.error),console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:1,src:n,dest:`t3://${t.bucket}/${i}`}):`Uploaded ${n} -> t3://${t.bucket}/${i}`)}}async function pt(n,t,e,l,s){let p=n.endsWith("/");!t.path&&!p&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=P(e),o=t.path.includes("*"),i=t.path.endsWith("/")||!t.path&&p;if(!o&&!i&&(i=await D(t.bucket,t.path,l)),i&&!o&&!s&&f("Source is a remote folder (not copied). Use -r to copy recursively."),o||i){let a=o?J(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",c=!o&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",{items:u,error:m}=await j(t.bucket,a||void 0,l);m&&f(m);let g=u.filter(y=>!y.name.endsWith("/"));if(o){let y=t.path.split("/").pop(),b=O(y);g=g.filter(S=>{let d=a?S.name.slice(a.length):S.name;return!s&&d.includes("/")?!1:b.test(d.split("/").pop())})}if(g.length===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:0}):"No objects to download");return}let k=g.map(y=>async()=>{let b=a?y.name.slice(a.length):y.name,S=c?N(r,c,b):N(r,b),d=await Q(t.bucket,y.name,S,l);return d.error?(console.error(`Failed to download ${y.name}: ${d.error}`),!1):(h||console.log(`Downloaded t3://${t.bucket}/${y.name} -> ${S}`),!0)}),R=(await C(k,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:R}):`Downloaded ${R} file(s)`)}else{let a=t.path.split("/").pop(),c,u=!1;try{u=L(r).isDirectory()}catch{}u||e.endsWith("/")?c=N(r,a):c=r;let m=await Q(t.bucket,t.path,c,l,!h);m.error&&f(m.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:1,src:`t3://${t.bucket}/${t.path}`,dest:c}):`Downloaded t3://${t.bucket}/${t.path} -> ${c}`)}}async function ut(n,t,e,l,s){let p=n.endsWith("/");!t.path&&!p&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=n.includes("*"),o=t.path.endsWith("/")||!t.path&&p;if(!r&&!o&&t.path&&(o=await D(t.bucket,t.path,l)),o&&!r&&!s&&f("Source is a remote folder (not copied). Use -r to copy recursively."),r||o){let i=r?J(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",a=!r&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",u=[e.path?.replace(/\/$/,"")||"",a].filter(Boolean).join("/"),m=u?`${u}/`:"";t.bucket===e.bucket&&i===m&&f("Source and destination are the same");let{items:g,error:k}=await j(t.bucket,i||void 0,l);k&&f(k);let $=g.filter(d=>d.name!==i);if(r){let d=t.path.split("/").pop(),W=O(d);$=$.filter(F=>{let v=i?F.name.slice(i.length):F.name;return!s&&v.includes("/")?!1:W.test(v.split("/").pop())})}let R=$.map(d=>async()=>{let W=i?d.name.slice(i.length):d.name,F=u?`${u}/${W}`:W,v=await A(l,t.bucket,d.name,e.bucket,F);return v.error?(console.error(`Failed to copy ${d.name}: ${v.error}`),!1):(h||console.log(`Copied t3://${t.bucket}/${d.name} -> t3://${e.bucket}/${F}`),!0)}),b=(await C(R,8)).filter(Boolean).length,S=!1;if(u&&i){let{data:d}=await tt({prefix:i,limit:1,config:{...l,bucket:t.bucket}});if(d?.items?.some(W=>W.name===i)){let W=`${u}/`,F=await A(l,t.bucket,i,e.bucket,W);F.error?console.error(`Failed to copy folder marker: ${F.error}`):S=!0}}if(b===0&&S&&(b=1),b===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:0}):"No objects to copy");return}console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:b}):`Copied ${b} object(s)`)}else{let i=t.path.split("/").pop(),a;e.path?e.path.endsWith("/")?a=`${e.path}${i}`:await D(e.bucket,e.path,l)?a=`${e.path}/${i}`:a=e.path:a=i,t.bucket===e.bucket&&t.path===a&&f("Source and destination are the same");let c=await A(l,t.bucket,t.path,e.bucket,a,!h);c.error&&f(c.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:1,src:`t3://${t.bucket}/${t.path}`,dest:`t3://${e.bucket}/${a}`}):`Copied t3://${t.bucket}/${t.path} -> t3://${e.bucket}/${a}`)}}async function ft(n){let t=x(n,["src"]),e=x(n,["dest"]);(!t||!e)&&f("Both src and dest arguments are required");let l=!!x(n,["recursive","r"]);h=q(n)==="json";let p=at(t,e),r=await G({withCredentialProvider:!0});switch(p){case"local-to-remote":{let o=T(e);o.bucket||f("Invalid destination path"),await st(t,o,r,l);break}case"remote-to-local":{let o=T(t);o.bucket||f("Invalid source path"),await pt(t,o,e,r,l);break}case"remote-to-remote":{let o=T(t),i=T(e);o.bucket||f("Invalid source path"),i.bucket||f("Invalid destination path"),await ut(t,o,i,r,l);break}}process.exit(0)}export{ft as default};
1
+ import{a as C}from"../chunk-SAAGVLRE.js";import{a as B}from"../chunk-EKW6XTGL.js";import{a as w}from"../chunk-IRDNZN7R.js";import{a as U,b as T,d as D,g as O,h as J,j}from"../chunk-JQUG732D.js";import{d as G}from"../chunk-ALJKYIQL.js";import{a as x,b as q}from"../chunk-YFMOI263.js";import{a as f}from"../chunk-VAVMX5DC.js";import"../chunk-DV3LCXRH.js";import"../chunk-PG746YF3.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import"../chunk-KK7FZ7QM.js";import"../chunk-OHGCOC5Q.js";import{get as V,head as X,list as tt,put as E}from"@tigrisdata/storage";import{createReadStream as et,createWriteStream as ot,existsSync as Y,mkdirSync as it,readdirSync as z,statSync as L}from"fs";import{homedir as nt}from"os";import{basename as M,dirname as K,join as N,relative as _,resolve as H}from"path";import{Readable as Z}from"stream";import{pipeline as rt}from"stream/promises";var h=!1;function at(n,t){let e=U(n),l=U(t);return!e&&!l&&f("At least one path must be a remote Tigris path (t3:// or tigris://)"),e&&l?"remote-to-remote":e?"remote-to-local":"local-to-remote"}function P(n){return n==="~"||n.startsWith("~/")?H(nt(),n.slice(2)):H(n)}function lt(n){return z(n,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>{let l=e.parentPath??e.path;return N(l,e.name)})}function ct(n,t){let e=K(n),l=M(n),s=O(l);return Y(e)?t?z(e,{recursive:!0,withFileTypes:!0}).filter(r=>r.isFile()&&s.test(r.name)).map(r=>{let o=r.parentPath??r.path;return N(o,r.name)}):z(e,{withFileTypes:!0}).filter(o=>o.isFile()&&s.test(o.name)).map(o=>N(e,o.name)):[]}async function I(n,t,e,l,s=!1){let p;try{p=L(n).size}catch{return{error:`File not found: ${n}`}}let r=et(n),o=Z.toWeb(r),{error:i}=await E(e,o,{...B(p),onUploadProgress:s?({loaded:a})=>{if(p!==void 0&&p>0){let c=Math.round(a/p*100);process.stdout.write(`\rUploading: ${w(a)} / ${w(p)} (${c}%)`)}else process.stdout.write(`\rUploading: ${w(a)}`)}:void 0,config:{...l,bucket:t}});return s&&process.stdout.write("\r"+" ".repeat(60)+"\r"),i?{error:i.message}:{}}async function Q(n,t,e,l,s=!1){let p;if(s){let{data:u}=await X(t,{config:{...l,bucket:n}});p=u?.size}let{data:r,error:o}=await V(t,"stream",{config:{...l,bucket:n}});if(o)return{error:o.message};let i=K(e);Y(i)||it(i,{recursive:!0});let a=ot(e),c=Z.fromWeb(r);if(s&&p!==void 0&&p>0){let u=0;c.on("data",m=>{u+=m.length;let g=Math.round(u/p*100);process.stdout.write(`\rDownloading: ${w(u)} / ${w(p)} (${g}%)`)})}return await rt(c,a),s&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function A(n,t,e,l,s,p=!1){if(e.endsWith("/")){let{error:c}=await E(s,"",{config:{...n,bucket:l}});return c?{error:c.message}:{}}let r;if(p){let{data:c}=await X(e,{config:{...n,bucket:t}});r=c?.size}let{data:o,error:i}=await V(e,"stream",{config:{...n,bucket:t}});if(i)return{error:i.message};let{error:a}=await E(s,o,{...B(r),onUploadProgress:p?({loaded:c})=>{if(r!==void 0&&r>0){let u=Math.round(c/r*100);process.stdout.write(`\rCopying: ${w(c)} / ${w(r)} (${u}%)`)}else process.stdout.write(`\rCopying: ${w(c)}`)}:void 0,config:{...n,bucket:l}});return p&&process.stdout.write("\r"+" ".repeat(60)+"\r"),a?{error:a.message}:{}}async function st(n,t,e,l){let s=P(n);if(n.includes("*")){let o=ct(s,l);if(o.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files matching pattern");return}let i=K(s),a=o.map(m=>async()=>{let g=_(i,m),k=t.path?`${t.path.replace(/\/$/,"")}/${g}`:g,$=await I(m,t.bucket,k,e);return $.error?(console.error(`Failed to upload ${m}: ${$.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${k}`),!0)}),u=(await C(a,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:u}):`Uploaded ${u} file(s)`);return}let r;try{r=L(s)}catch{f(`Source not found: ${n}`)}if(r.isDirectory()){l||f(`${n} is a directory (not copied). Use -r to copy recursively.`);let o=lt(s);if(o.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files to upload");return}let i=n.endsWith("/")?"":M(s),a=o.map(m=>async()=>{let g=_(s,m),$=[t.path?.replace(/\/$/,""),i,g].filter(Boolean).join("/"),R=await I(m,t.bucket,$,e);return R.error?(console.error(`Failed to upload ${m}: ${R.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${$}`),!0)}),u=(await C(a,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:u}):`Uploaded ${u} file(s)`)}else{let o=M(s),i;t.path?n.endsWith("/")||t.path.endsWith("/")?i=`${t.path.replace(/\/$/,"")}/${o}`:await D(t.bucket,t.path,e)?i=`${t.path}/${o}`:i=t.path:i=o;let a=await I(s,t.bucket,i,e,!h);a.error&&f(a.error),console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:1,src:n,dest:`t3://${t.bucket}/${i}`}):`Uploaded ${n} -> t3://${t.bucket}/${i}`)}}async function pt(n,t,e,l,s){let p=n.endsWith("/");!t.path&&!p&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=P(e),o=t.path.includes("*"),i=t.path.endsWith("/")||!t.path&&p;if(!o&&!i&&(i=await D(t.bucket,t.path,l)),i&&!o&&!s&&f("Source is a remote folder (not copied). Use -r to copy recursively."),o||i){let a=o?J(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",c=!o&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",{items:u,error:m}=await j(t.bucket,a||void 0,l);m&&f(m);let g=u.filter(y=>!y.name.endsWith("/"));if(o){let y=t.path.split("/").pop(),b=O(y);g=g.filter(S=>{let d=a?S.name.slice(a.length):S.name;return!s&&d.includes("/")?!1:b.test(d.split("/").pop())})}if(g.length===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:0}):"No objects to download");return}let k=g.map(y=>async()=>{let b=a?y.name.slice(a.length):y.name,S=c?N(r,c,b):N(r,b),d=await Q(t.bucket,y.name,S,l);return d.error?(console.error(`Failed to download ${y.name}: ${d.error}`),!1):(h||console.log(`Downloaded t3://${t.bucket}/${y.name} -> ${S}`),!0)}),R=(await C(k,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:R}):`Downloaded ${R} file(s)`)}else{let a=t.path.split("/").pop(),c,u=!1;try{u=L(r).isDirectory()}catch{}u||e.endsWith("/")?c=N(r,a):c=r;let m=await Q(t.bucket,t.path,c,l,!h);m.error&&f(m.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:1,src:`t3://${t.bucket}/${t.path}`,dest:c}):`Downloaded t3://${t.bucket}/${t.path} -> ${c}`)}}async function ut(n,t,e,l,s){let p=n.endsWith("/");!t.path&&!p&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=n.includes("*"),o=t.path.endsWith("/")||!t.path&&p;if(!r&&!o&&t.path&&(o=await D(t.bucket,t.path,l)),o&&!r&&!s&&f("Source is a remote folder (not copied). Use -r to copy recursively."),r||o){let i=r?J(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",a=!r&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",u=[e.path?.replace(/\/$/,"")||"",a].filter(Boolean).join("/"),m=u?`${u}/`:"";t.bucket===e.bucket&&i===m&&f("Source and destination are the same");let{items:g,error:k}=await j(t.bucket,i||void 0,l);k&&f(k);let $=g.filter(d=>d.name!==i);if(r){let d=t.path.split("/").pop(),W=O(d);$=$.filter(F=>{let v=i?F.name.slice(i.length):F.name;return!s&&v.includes("/")?!1:W.test(v.split("/").pop())})}let R=$.map(d=>async()=>{let W=i?d.name.slice(i.length):d.name,F=u?`${u}/${W}`:W,v=await A(l,t.bucket,d.name,e.bucket,F);return v.error?(console.error(`Failed to copy ${d.name}: ${v.error}`),!1):(h||console.log(`Copied t3://${t.bucket}/${d.name} -> t3://${e.bucket}/${F}`),!0)}),b=(await C(R,8)).filter(Boolean).length,S=!1;if(u&&i){let{data:d}=await tt({prefix:i,limit:1,config:{...l,bucket:t.bucket}});if(d?.items?.some(W=>W.name===i)){let W=`${u}/`,F=await A(l,t.bucket,i,e.bucket,W);F.error?console.error(`Failed to copy folder marker: ${F.error}`):S=!0}}if(b===0&&S&&(b=1),b===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:0}):"No objects to copy");return}console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:b}):`Copied ${b} object(s)`)}else{let i=t.path.split("/").pop(),a;e.path?e.path.endsWith("/")?a=`${e.path}${i}`:await D(e.bucket,e.path,l)?a=`${e.path}/${i}`:a=e.path:a=i,t.bucket===e.bucket&&t.path===a&&f("Source and destination are the same");let c=await A(l,t.bucket,t.path,e.bucket,a,!h);c.error&&f(c.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:1,src:`t3://${t.bucket}/${t.path}`,dest:`t3://${e.bucket}/${a}`}):`Copied t3://${t.bucket}/${t.path} -> t3://${e.bucket}/${a}`)}}async function ft(n){let t=x(n,["src"]),e=x(n,["dest"]);(!t||!e)&&f("Both src and dest arguments are required");let l=!!x(n,["recursive","r"]);h=q(n)==="json";let p=at(t,e),r=await G({withCredentialProvider:!0});switch(p){case"local-to-remote":{let o=T(e);o.bucket||f("Invalid destination path"),await st(t,o,r,l);break}case"remote-to-local":{let o=T(t);o.bucket||f("Invalid source path"),await pt(t,o,e,r,l);break}case"remote-to-remote":{let o=T(t),i=T(e);o.bucket||f("Invalid source path"),i.bucket||f("Invalid destination path"),await ut(t,o,i,r,l);break}}process.exit(0)}export{ft as default};
@@ -1 +1 @@
1
- import{f as B}from"../../chunk-552FMFE5.js";import{a as p,b}from"../../chunk-AHGPPFCQ.js";import{a as c,b as m}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as g,c as l,d as n,i as d}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import{i as k}from"../../chunk-7RGWTDUP.js";import{getBucketInfo as N,listBuckets as h}from"@tigrisdata/storage";var t=d("credentials","test");async function v(s){g(t);let a=b(s),o=p(s,["bucket","b"]),i=await B();!i.accessKeyId&&!i.sessionToken&&m(t,'No credentials found. Run "tigris configure" or "tigris login" first.');let f=k(),u={...i,...f&&!i.organizationId?{organizationId:f}:{}};if(o){let{data:e,error:r}=await N(o,{config:u});r&&(n(t,`Current credentials don't have access to bucket "${o}"`),c(r,t)),a==="json"?console.log(JSON.stringify({valid:!0,bucket:o,...e.sourceBucketName?{forkOf:e.sourceBucketName}:{}})):(console.log(` Bucket: ${o}`),console.log(" Access verified."),e.sourceBucketName&&console.log(` Fork of: ${e.sourceBucketName}`))}else{let{data:e,error:r}=await h({config:u});r&&(n(t,"Current credentials don't have sufficient access"),c(r,t)),console.log(a==="json"?JSON.stringify({valid:!0,bucketCount:e.buckets.length}):` Access verified. Found ${e.buckets.length} bucket(s).`)}l(t)}export{v as default};
1
+ import{e as k}from"../../chunk-ALJKYIQL.js";import{a as d,b as m}from"../../chunk-YFMOI263.js";import{a as s,b as u}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as f,d as r,j as g}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{list as p,listBuckets as b}from"@tigrisdata/storage";var t=g("credentials","test");async function h(n){a(t);let c=m(n),e=d(n,["bucket","b"]),i=await k();if(!i.accessKeyId&&!i.sessionToken&&u(t,'No credentials found. Run "tigris configure" or "tigris login" first.'),e){let{error:o}=await p({config:{...i,bucket:e},limit:1});o&&(r(t,`Current credentials don't have access to bucket "${e}"`),s(o,t)),c==="json"?console.log(JSON.stringify({valid:!0,bucket:e})):(console.log(` Bucket: ${e}`),console.log(" Access verified."))}else{let{data:o,error:l}=await b({config:i});l&&(r(t,"Current credentials don't have sufficient access"),s(l,t)),console.log(c==="json"?JSON.stringify({valid:!0,bucketCount:o.buckets.length}):` Access verified. Found ${o.buckets.length} bucket(s).`)}f(t)}export{h as default};
@@ -1 +1 @@
1
- import{f as g}from"../../chunk-552FMFE5.js";import{a,b as m}from"../../chunk-AHGPPFCQ.js";import{b as n}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as s,i as f}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.js";import{createBucket as p}from"@tigrisdata/storage";var r=f("forks","create");async function S(t){c(r);let u=m(t),o=a(t,["name"]),e=a(t,["fork-name","forkName"]),k=a(t,["snapshot","s","S"]);o||n(r,"Source bucket name is required"),e||n(r,"Fork name is required");let{error:i}=await p(e,{sourceBucketName:o,sourceBucketSnapshot:k,config:await g()});i&&n(r,i),u==="json"&&console.log(JSON.stringify({action:"created",name:e,forkOf:o})),s(r,{name:o,forkName:e})}export{S as default};
1
+ import{d as g}from"../../chunk-ALJKYIQL.js";import{a,b as m}from"../../chunk-YFMOI263.js";import{b as n}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as s,j as f}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{createBucket as p}from"@tigrisdata/storage";var r=f("forks","create");async function S(t){c(r);let u=m(t),o=a(t,["name"]),e=a(t,["fork-name","forkName"]),k=a(t,["snapshot","s","S"]);o||n(r,"Source bucket name is required"),e||n(r,"Fork name is required");let{error:i}=await p(e,{sourceBucketName:o,sourceBucketSnapshot:k,config:await g()});i&&n(r,i),u==="json"&&console.log(JSON.stringify({action:"created",name:e,forkOf:o})),s(r,{name:o,forkName:e})}export{S as default};
@@ -1 +1 @@
1
- import{f as l}from"../../chunk-CQCBYE3X.js";import{f as d}from"../../chunk-552FMFE5.js";import{a as g,b as p}from"../../chunk-AHGPPFCQ.js";import{b as n}from"../../chunk-3FMWZQ3C.js";import"../../chunk-DV3LCXRH.js";import{b as m,c as u,e as i,i as k}from"../../chunk-5VDFQRGP.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-BC2HK4K6.js";import"../../chunk-7RGWTDUP.js";import{getBucketInfo as h,listBuckets as E}from"@tigrisdata/storage";var t=k("forks","list");async function x(c){m(t);let r=g(c,["name"]),w=p(c);r||n(t,"Source bucket name is required");let a=await d(),{data:y,error:f}=await h(r,{config:a});if(f&&n(t,f),!y.hasForks){i(t);return}let{data:b,error:s}=await E({config:a});s&&n(t,s);let e=[];for(let o of b.buckets){if(o.name===r)continue;let{data:B}=await h(o.name,{config:a});B?.sourceBucketName===r&&e.push({name:o.name,created:o.creationDate})}if(e.length===0){i(t);return}let S=l(e,w,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(S),u(t,{count:e.length})}export{x as default};
1
+ import{f as l}from"../../chunk-IRDNZN7R.js";import{d}from"../../chunk-ALJKYIQL.js";import{a as g,b as p}from"../../chunk-YFMOI263.js";import{b as n}from"../../chunk-VAVMX5DC.js";import"../../chunk-DV3LCXRH.js";import{b as m,c as u,e as i,j as k}from"../../chunk-PG746YF3.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-KK7FZ7QM.js";import"../../chunk-OHGCOC5Q.js";import{getBucketInfo as h,listBuckets as E}from"@tigrisdata/storage";var t=k("forks","list");async function x(c){m(t);let r=g(c,["name"]),w=p(c);r||n(t,"Source bucket name is required");let a=await d(),{data:y,error:f}=await h(r,{config:a});if(f&&n(t,f),!y.hasForks){i(t);return}let{data:b,error:s}=await E({config:a});s&&n(t,s);let e=[];for(let o of b.buckets){if(o.name===r)continue;let{data:B}=await h(o.name,{config:a});B?.sourceBucketName===r&&e.push({name:o.name,created:o.creationDate})}if(e.length===0){i(t);return}let S=l(e,w,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(S),u(t,{count:e.length})}export{x as default};
@@ -1 +1 @@
1
- import{a as g,b as y}from"../../../chunk-Y7MJZRR4.js";import{a as p}from"../../../chunk-ZHAJEGAB.js";import"../../../chunk-552FMFE5.js";import{a as c,b as u}from"../../../chunk-AHGPPFCQ.js";import{b as t}from"../../../chunk-3FMWZQ3C.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as l,i as f}from"../../../chunk-5VDFQRGP.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-AEADROU6.js";import"../../../chunk-BC2HK4K6.js";import"../../../chunk-7RGWTDUP.js";import{existsSync as h,readFileSync as w}from"fs";import{addPolicy as O}from"@tigrisdata/iam";var e=f("iam policies","create");async function A(o){d(e);let P=u(o),a=c(o,["name"]),i=c(o,["document","d"]),S=c(o,["description"])??"";a||t(e,"Policy name is required"),/^[a-zA-Z0-9=,.@_-]+$/.test(a)||t(e,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed.");let v=await p(e),n;i?h(i)?n=w(i,"utf-8"):n=i:process.stdin.isTTY?t(e,"Policy document is required. Provide via --document or pipe to stdin."):n=await g();let m;try{m=y(n)}catch{t(e,"Invalid JSON in policy document")}let{data:r,error:s}=await O(a,{document:m,description:S,config:v});s&&t(e,s),P==="json"&&console.log(JSON.stringify({action:"created",name:r.name,arn:r.resource})),l(e,{name:r.name}),console.log(`Resource: ${r.resource}`)}export{A as default};
1
+ import{a as g,b as y}from"../../../chunk-Y7MJZRR4.js";import{a as p}from"../../../chunk-LVAJB4FR.js";import"../../../chunk-ALJKYIQL.js";import{a as c,b as u}from"../../../chunk-YFMOI263.js";import{b as t}from"../../../chunk-VAVMX5DC.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as l,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{existsSync as h,readFileSync as w}from"fs";import{addPolicy as O}from"@tigrisdata/iam";var e=f("iam policies","create");async function A(o){d(e);let P=u(o),a=c(o,["name"]),i=c(o,["document","d"]),S=c(o,["description"])??"";a||t(e,"Policy name is required"),/^[a-zA-Z0-9=,.@_-]+$/.test(a)||t(e,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed.");let v=await p(e),n;i?h(i)?n=w(i,"utf-8"):n=i:process.stdin.isTTY?t(e,"Policy document is required. Provide via --document or pipe to stdin."):n=await g();let m;try{m=y(n)}catch{t(e,"Invalid JSON in policy document")}let{data:r,error:s}=await O(a,{document:m,description:S,config:v});s&&t(e,s),P==="json"&&console.log(JSON.stringify({action:"created",name:r.name,arn:r.resource})),l(e,{name:r.name}),console.log(`Resource: ${r.resource}`)}export{A as default};
@@ -1 +1 @@
1
- import{a as w}from"../../../chunk-ZHAJEGAB.js";import{a as n,b as u}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-552FMFE5.js";import{a as s,b as y}from"../../../chunk-AHGPPFCQ.js";import{b as c}from"../../../chunk-3FMWZQ3C.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as p,e as g,i as d}from"../../../chunk-5VDFQRGP.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-AEADROU6.js";import"../../../chunk-BC2HK4K6.js";import"../../../chunk-7RGWTDUP.js";import E from"enquirer";import{deletePolicy as P,listPolicies as $}from"@tigrisdata/iam";var{prompt:O}=E,o=d("iam policies","delete");async function b(i){f(o);let h=y(i),e=s(i,["resource"]),A=s(i,["yes","y","force"]),a=await w(o);if(!e){let{data:t,error:m}=await $({config:a});if(m&&c(o,m),!t.policies||t.policies.length===0){g(o);return}n("Provide the policy ARN as a positional argument");let{selected:S}=await O({type:"select",name:"selected",message:"Select a policy to delete:",choices:t.policies.map(r=>({name:r.resource,message:`${r.name} (${r.resource})`}))});e=S}if(!A&&(n("Use --yes to skip confirmation"),!await u(`Delete policy '${e}'?`))){console.log("Aborted");return}let{error:l}=await P(e,{config:a});l&&c(o,l),h==="json"&&console.log(JSON.stringify({action:"deleted",arn:e})),p(o,{resource:e})}export{b as default};
1
+ import{a as w}from"../../../chunk-LVAJB4FR.js";import{a as n,b as u}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-ALJKYIQL.js";import{a as s,b as y}from"../../../chunk-YFMOI263.js";import{b as c}from"../../../chunk-VAVMX5DC.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as p,e as g,j as d}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 E from"enquirer";import{deletePolicy as P,listPolicies as $}from"@tigrisdata/iam";var{prompt:O}=E,o=d("iam policies","delete");async function b(i){f(o);let h=y(i),e=s(i,["resource"]),A=s(i,["yes","y","force"]),a=await w(o);if(!e){let{data:t,error:m}=await $({config:a});if(m&&c(o,m),!t.policies||t.policies.length===0){g(o);return}n("Provide the policy ARN as a positional argument");let{selected:S}=await O({type:"select",name:"selected",message:"Select a policy to delete:",choices:t.policies.map(r=>({name:r.resource,message:`${r.name} (${r.resource})`}))});e=S}if(!A&&(n("Use --yes to skip confirmation"),!await u(`Delete policy '${e}'?`))){console.log("Aborted");return}let{error:l}=await P(e,{config:a});l&&c(o,l),h==="json"&&console.log(JSON.stringify({action:"deleted",arn:e})),p(o,{resource:e})}export{b as default};
@@ -1 +1 @@
1
- import{a as E,b as l}from"../../../chunk-Y7MJZRR4.js";import{a as D}from"../../../chunk-ZHAJEGAB.js";import{a as v}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-552FMFE5.js";import{a as s,b as A}from"../../../chunk-AHGPPFCQ.js";import{b as i}from"../../../chunk-3FMWZQ3C.js";import"../../../chunk-DV3LCXRH.js";import{b as h,c as w,e as S,i as P}from"../../../chunk-5VDFQRGP.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-AEADROU6.js";import"../../../chunk-BC2HK4K6.js";import"../../../chunk-7RGWTDUP.js";import{existsSync as O,readFileSync as q}from"fs";import x from"enquirer";import{editPolicy as T,getPolicy as R,listPolicies as C}from"@tigrisdata/iam";var{prompt:I}=x,e=P("iam policies","edit");async function F(o){h(e);let J=A(o),r=s(o,["resource"]),n=s(o,["document","d"]),a=s(o,["description"]),m=await D(e);if(!r){process.stdin.isTTY||i(e,"Policy ARN is required when piping document via stdin.");let{data:t,error:y}=await C({config:m});if(y&&i(e,y),!t.policies||t.policies.length===0){S(e);return}v("Provide the policy ARN as a positional argument");let{selected:N}=await I({type:"select",name:"selected",message:"Select a policy to edit:",choices:t.policies.map(d=>({name:d.resource,message:`${d.name} (${d.resource})`}))});r=N}let c;if(n){let t;O(n)?t=q(n,"utf-8"):t=n;try{c=l(t)}catch{i(e,"Invalid JSON in policy document")}}else if(!process.stdin.isTTY&&!a){let t=await E();try{c=l(t)}catch{i(e,"Invalid JSON in policy document")}}!c&&!a&&i(e,"Either --document or --description is required.");let{data:p,error:u}=await R(r,{config:m});u&&i(e,u);let{data:f,error:g}=await T(r,{document:c??p.document,description:a??p.description,config:m});g&&i(e,g),J==="json"&&console.log(JSON.stringify({action:"updated",arn:f.resource})),w(e,{resource:f.resource})}export{F as default};
1
+ import{a as E,b as l}from"../../../chunk-Y7MJZRR4.js";import{a as D}from"../../../chunk-LVAJB4FR.js";import{a as v}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-ALJKYIQL.js";import{a as s,b as A}from"../../../chunk-YFMOI263.js";import{b as i}from"../../../chunk-VAVMX5DC.js";import"../../../chunk-DV3LCXRH.js";import{b as h,c as w,e as S,j as P}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{existsSync as O,readFileSync as q}from"fs";import x from"enquirer";import{editPolicy as T,getPolicy as R,listPolicies as C}from"@tigrisdata/iam";var{prompt:I}=x,e=P("iam policies","edit");async function F(o){h(e);let J=A(o),r=s(o,["resource"]),n=s(o,["document","d"]),a=s(o,["description"]),m=await D(e);if(!r){process.stdin.isTTY||i(e,"Policy ARN is required when piping document via stdin.");let{data:t,error:y}=await C({config:m});if(y&&i(e,y),!t.policies||t.policies.length===0){S(e);return}v("Provide the policy ARN as a positional argument");let{selected:N}=await I({type:"select",name:"selected",message:"Select a policy to edit:",choices:t.policies.map(d=>({name:d.resource,message:`${d.name} (${d.resource})`}))});r=N}let c;if(n){let t;O(n)?t=q(n,"utf-8"):t=n;try{c=l(t)}catch{i(e,"Invalid JSON in policy document")}}else if(!process.stdin.isTTY&&!a){let t=await E();try{c=l(t)}catch{i(e,"Invalid JSON in policy document")}}!c&&!a&&i(e,"Either --document or --description is required.");let{data:p,error:u}=await R(r,{config:m});u&&i(e,u);let{data:f,error:g}=await T(r,{document:c??p.document,description:a??p.description,config:m});g&&i(e,g),J==="json"&&console.log(JSON.stringify({action:"updated",arn:f.resource})),w(e,{resource:f.resource})}export{F as default};