@tigrisdata/cli 3.5.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/auth/client.js +1 -1
  2. package/dist/auth/iam.js +1 -1
  3. package/dist/auth/provider.js +1 -1
  4. package/dist/{chunk-BLWMGKCV.js → chunk-2FH2T67P.js} +1 -1
  5. package/dist/{chunk-I4WIVMFA.js → chunk-4J4ZJAMQ.js} +1 -1
  6. package/dist/{chunk-GWPU2O5X.js → chunk-4W44TSLI.js} +1 -1
  7. package/dist/{chunk-R4FFJVZL.js → chunk-5OPGTV33.js} +1 -1
  8. package/dist/{chunk-DWOWKOKO.js → chunk-5YAC4LCL.js} +1 -1
  9. package/dist/{chunk-75CEDNCH.js → chunk-7Z6ZHS7Y.js} +1 -1
  10. package/dist/chunk-AWTU3DRX.js +5 -0
  11. package/dist/{chunk-AWVF3WSN.js → chunk-AWUW4BD3.js} +1 -1
  12. package/dist/chunk-IHMIXWMY.js +1 -0
  13. package/dist/chunk-J3MAV7JB.js +1 -0
  14. package/dist/{chunk-BK5P4FHM.js → chunk-KPEAQ6DK.js} +1 -1
  15. package/dist/{chunk-V2CQF2CL.js → chunk-MW4NG7JY.js} +1 -1
  16. package/dist/{chunk-VTZW32DG.js → chunk-SDZJD5IE.js} +1 -1
  17. package/dist/{chunk-3LZL7JNZ.js → chunk-TOKNV45Q.js} +1 -1
  18. package/dist/{chunk-WEKHQFXD.js → chunk-YGFC3GME.js} +1 -1
  19. package/dist/cli-core.js +1 -1
  20. package/dist/cli.js +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/lib/access-keys/assign.js +1 -1
  23. package/dist/lib/access-keys/attach-policy.js +1 -1
  24. package/dist/lib/access-keys/create.js +1 -1
  25. package/dist/lib/access-keys/delete.js +1 -1
  26. package/dist/lib/access-keys/detach-policy.js +1 -1
  27. package/dist/lib/access-keys/get.js +1 -1
  28. package/dist/lib/access-keys/list-policies.js +1 -1
  29. package/dist/lib/access-keys/list.js +1 -1
  30. package/dist/lib/access-keys/rotate.js +1 -1
  31. package/dist/lib/buckets/create.js +1 -1
  32. package/dist/lib/buckets/delete.js +1 -1
  33. package/dist/lib/buckets/disable-snapshots.js +1 -1
  34. package/dist/lib/buckets/enable-snapshots.js +1 -1
  35. package/dist/lib/buckets/get.js +1 -1
  36. package/dist/lib/buckets/lifecycle/create.js +1 -1
  37. package/dist/lib/buckets/lifecycle/edit.js +1 -1
  38. package/dist/lib/buckets/lifecycle/list.js +1 -1
  39. package/dist/lib/buckets/lifecycle/shared.js +1 -1
  40. package/dist/lib/buckets/list.js +1 -1
  41. package/dist/lib/buckets/merge.js +1 -1
  42. package/dist/lib/buckets/migrate.js +5 -5
  43. package/dist/lib/buckets/rebase.js +1 -1
  44. package/dist/lib/buckets/restore.js +1 -1
  45. package/dist/lib/buckets/set-cors.js +1 -1
  46. package/dist/lib/buckets/set-locations.js +1 -1
  47. package/dist/lib/buckets/set-migration.js +1 -1
  48. package/dist/lib/buckets/set-notifications.js +1 -1
  49. package/dist/lib/buckets/set.js +1 -1
  50. package/dist/lib/bundle.js +1 -1
  51. package/dist/lib/configure/index.js +1 -1
  52. package/dist/lib/cp.js +1 -1
  53. package/dist/lib/credentials/test.js +1 -1
  54. package/dist/lib/iam/policies/create.js +1 -1
  55. package/dist/lib/iam/policies/delete.js +1 -1
  56. package/dist/lib/iam/policies/edit.js +1 -1
  57. package/dist/lib/iam/policies/get.js +1 -1
  58. package/dist/lib/iam/policies/link-key.js +1 -1
  59. package/dist/lib/iam/policies/list-keys.js +1 -1
  60. package/dist/lib/iam/policies/list.js +1 -1
  61. package/dist/lib/iam/policies/select-policy.js +1 -1
  62. package/dist/lib/iam/policies/unlink-key.js +1 -1
  63. package/dist/lib/iam/teams/create.js +1 -1
  64. package/dist/lib/iam/teams/edit.js +1 -1
  65. package/dist/lib/iam/teams/list.js +1 -1
  66. package/dist/lib/iam/teams/shared.js +1 -1
  67. package/dist/lib/iam/users/invite.js +1 -1
  68. package/dist/lib/iam/users/list.js +1 -1
  69. package/dist/lib/iam/users/remove.js +1 -1
  70. package/dist/lib/iam/users/revoke-invitation.js +1 -1
  71. package/dist/lib/iam/users/update-role.js +1 -1
  72. package/dist/lib/init/index.js +1 -1
  73. package/dist/lib/init/interactive.js +1 -1
  74. package/dist/lib/login/credentials.js +1 -1
  75. package/dist/lib/login/oauth.js +1 -1
  76. package/dist/lib/login/select.js +1 -1
  77. package/dist/lib/logout.js +1 -1
  78. package/dist/lib/ls.js +1 -1
  79. package/dist/lib/mk.js +1 -1
  80. package/dist/lib/mv.js +1 -1
  81. package/dist/lib/objects/delete.js +1 -1
  82. package/dist/lib/objects/get.js +1 -1
  83. package/dist/lib/objects/info.js +1 -1
  84. package/dist/lib/objects/list-versions.js +1 -1
  85. package/dist/lib/objects/list.js +1 -1
  86. package/dist/lib/objects/put.js +1 -1
  87. package/dist/lib/objects/restore-info.js +1 -1
  88. package/dist/lib/objects/restore.js +1 -1
  89. package/dist/lib/objects/set-access.js +1 -1
  90. package/dist/lib/objects/set.js +1 -1
  91. package/dist/lib/organizations/create.js +1 -1
  92. package/dist/lib/organizations/list.js +1 -1
  93. package/dist/lib/organizations/select.js +1 -1
  94. package/dist/lib/presign.js +1 -1
  95. package/dist/lib/rm.js +1 -1
  96. package/dist/lib/snapshots/list.js +1 -1
  97. package/dist/lib/snapshots/take.js +1 -1
  98. package/dist/lib/stat.js +1 -1
  99. package/dist/lib/touch.js +1 -1
  100. package/dist/lib/update.js +1 -1
  101. package/dist/lib/whoami.js +1 -1
  102. package/dist/specs.yaml +13 -1
  103. package/dist/utils/exit.js +1 -1
  104. package/dist/utils/telemetry.js +1 -1
  105. package/dist/utils/update-check.js +1 -1
  106. package/package.json +3 -3
  107. package/dist/chunk-BLUJHGMR.js +0 -1
  108. package/dist/chunk-VNUR4TRP.js +0 -1
  109. package/dist/chunk-WJLB362D.js +0 -5
@@ -1 +1 @@
1
- import{a,b,c}from"../chunk-VNUR4TRP.js";import"../chunk-F4AGJWCK.js";export{b as TigrisAuthClient,a as getAuth0Config,c as getAuthClient};
1
+ import{a,b,c}from"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";export{b as TigrisAuthClient,a as getAuth0Config,c as getAuthClient};
package/dist/auth/iam.js CHANGED
@@ -1 +1 @@
1
- import{a as b,b as c}from"../chunk-BLWMGKCV.js";import"../chunk-WJLB362D.js";import"../chunk-GWPU2O5X.js";import"../chunk-AWVF3WSN.js";import"../chunk-BLUJHGMR.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-VNUR4TRP.js";import{a}from"../chunk-KJBSIIND.js";import"../chunk-F4AGJWCK.js";export{c as getIAMConfig,b as getOAuthIAMConfig,a as isFlyOrganization};
1
+ import{a as b,b as c}from"../chunk-2FH2T67P.js";import"../chunk-AWTU3DRX.js";import"../chunk-4W44TSLI.js";import"../chunk-AWUW4BD3.js";import"../chunk-IHMIXWMY.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-J3MAV7JB.js";import{a}from"../chunk-KJBSIIND.js";import"../chunk-F4AGJWCK.js";export{c as getIAMConfig,b as getOAuthIAMConfig,a as isFlyOrganization};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f}from"../chunk-WJLB362D.js";import"../chunk-6ZZ54RU7.js";import"../chunk-VNUR4TRP.js";import"../chunk-F4AGJWCK.js";export{b as getEnvCredentials,d as getStorageConfig,e as getStorageConfigWithOrg,a as getTigrisConfig,f as requireOAuthLogin,c as resolveAuthMethod};
1
+ import{a,b,c,d,e,f,g}from"../chunk-AWTU3DRX.js";import"../chunk-6ZZ54RU7.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";export{c as getEnvCredentials,b as getEnvForcePathStyle,e as getStorageConfig,f as getStorageConfigWithOrg,a as getTigrisConfig,g as requireOAuthLogin,d as resolveAuthMethod};
@@ -1,2 +1,2 @@
1
- import{a as o,c as a}from"./chunk-WJLB362D.js";import{b as i}from"./chunk-GWPU2O5X.js";import{c as r}from"./chunk-VNUR4TRP.js";import{i as n,p as s}from"./chunk-F4AGJWCK.js";async function d(e){s()!=="oauth"&&i(e,`This operation requires OAuth login.
1
+ import{a as o,d as a}from"./chunk-AWTU3DRX.js";import{b as i}from"./chunk-4W44TSLI.js";import{c as r}from"./chunk-J3MAV7JB.js";import{i as n,p as s}from"./chunk-F4AGJWCK.js";async function d(e){s()!=="oauth"&&i(e,`This operation requires OAuth login.
2
2
  Run "tigris login oauth" first.`);let t=r();await t.isAuthenticated()||i(e,'Not authenticated. Run "tigris login oauth" first.');let c=n(),{iamEndpoint:g,mgmtEndpoint:u}=o();return{sessionToken:await t.getAccessToken(),organizationId:c??void 0,iamEndpoint:g,mgmtEndpoint:u}}async function A(e){let t=await a();switch(t.type){case"oauth":return d(e);case"aws-profile":case"credentials":case"environment":case"configured":return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,organizationId:n()??void 0,iamEndpoint:o().iamEndpoint};case"none":i(e,'Not authenticated. Run "tigris login" or "tigris configure" first.')}}export{d as a,A as b};
@@ -1,4 +1,4 @@
1
- import{a as E}from"./chunk-GWPU2O5X.js";import{e as v,f as b,g as k}from"./chunk-AWVF3WSN.js";import{b as x}from"./chunk-DV3LCXRH.js";import{h as C}from"./chunk-D7WXNA2O.js";import{Command as M,Option as V}from"commander";function y(n,t,e,a,o){let r=n[n.length-1],s=typeof r=="object"&&r!==null&&"args"in r?r.args:n.filter(m=>typeof m=="string");if(s.length===0)return s;let l=s[0],d=(t.commands??[]).filter(m=>g(m,[...e,m.name],o));if(!new Set(d.flatMap(m=>[m.name,...Array.isArray(m.alias)?m.alias:m.alias?[m.alias]:[]])).has(l)){let m=d.map(u=>u.name),p=e.length>0?`'${l}' for '${e.join(" ")}'`:`'${l}'`;console.error(`Unknown command ${p}.`),m.length>0&&console.error(`Available commands: ${m.join(", ")}`);let f=e.length>0?`${a.name} ${e.join(" ")} help`:`${a.name} help`;console.error(`
1
+ import{a as E}from"./chunk-4W44TSLI.js";import{e as v,f as b,g as k}from"./chunk-AWUW4BD3.js";import{b as x}from"./chunk-DV3LCXRH.js";import{h as C}from"./chunk-D7WXNA2O.js";import{Command as M,Option as V}from"commander";function y(n,t,e,a,o){let r=n[n.length-1],s=typeof r=="object"&&r!==null&&"args"in r?r.args:n.filter(m=>typeof m=="string");if(s.length===0)return s;let l=s[0],d=(t.commands??[]).filter(m=>g(m,[...e,m.name],o));if(!new Set(d.flatMap(m=>[m.name,...Array.isArray(m.alias)?m.alias:m.alias?[m.alias]:[]])).has(l)){let m=d.map(u=>u.name),p=e.length>0?`'${l}' for '${e.join(" ")}'`:`'${l}'`;console.error(`Unknown command ${p}.`),m.length>0&&console.error(`Available commands: ${m.join(", ")}`);let f=e.length>0?`${a.name} ${e.join(" ")} help`:`${a.name} help`;console.error(`
2
2
  Run "${f}" for usage.`),process.exit(1)}return s}function F(){v();let n=!1,t=async e=>{n&&process.exit(1),n=!0,b(e,{crash:!0,exitCode:x(e).exitCode}),await k(),E(e,void 0,{skipCapture:!0})};process.on("unhandledRejection",e=>{(e===""||e===void 0)&&(console.error(`
3
3
  Operation cancelled`),process.exit(1)),t(e)}),process.on("uncaughtException",e=>{t(e)})}function H(n){return/^[a-zA-Z0-9_-]+$/.test(n)}function T(n){let t;n.type==="positional"?t=` ${n.name}`:(t=` --${n.name}`,n.alias&&typeof n.alias=="string"&&(t+=n.alias.length===1?`, -${n.alias}`:`, --${n.alias}`));let e=26,a=t.length>=e?`${t} `:t.padEnd(e),o=n.description;return n.options&&(Array.isArray(n.options)&&typeof n.options[0]=="string"?o+=` (options: ${n.options.join(", ")})`:o+=` (options: ${n.options.map(r=>r.value).join(", ")})`),n.default&&(o+=` [default: ${n.default}]`),n.required&&(o+=" [required]"),n.deprecated&&(o+=n.replaced_by?` [deprecated: use ${n.replaced_by}]`:" [deprecated]"),n["required-when"]&&(o+=` [required when: ${n["required-when"]}]`),n.multiple&&(o+=" [multiple values: comma-separated]"),n.type==="positional"&&(o+=" [positional argument]"),n.examples&&n.examples.length>0&&(o+=` (examples: ${n.examples.join(", ")})`),`${a}${o}`}function g(n,t,e){return n.removed||e(t)?!0:n.commands?n.commands.some(a=>g(a,[...t,a.name],e)):!1}function U(n,t){let e=t?` Use ${t} instead.`:" See the changelog for migration guidance.";console.error(`${n} was removed in this version.${e}`),process.exit(1)}function S(n,t){if(n)for(let e of n){if(!e.removed)continue;h(t,e.name,n)!==void 0&&U(`--${e.name}`,e.replaced_by)}}function j(n,t,e,a){let o=e.join(" ");if(console.log(`
4
4
  ${n.name} ${o} - ${t.description??""}
@@ -1,4 +1,4 @@
1
- import{f as m}from"./chunk-AWVF3WSN.js";import{b as i}from"./chunk-DV3LCXRH.js";import{a as r,d as a}from"./chunk-D7WXNA2O.js";import{c}from"./chunk-NI4EYBQH.js";function p(){return globalThis.__TIGRIS_JSON_MODE===!0}function g(){return process.stderr.isTTY===!0}function f(){return process.stdout.isTTY===!0}function u(t,o,n){let e=i(t);if(p()){let s={error:{message:e.message,code:e.exitCode,category:e.category}};e.nextActions.length>0&&(s.nextActions=e.nextActions),console.error(JSON.stringify(s))}else if(o||console.error(`
1
+ import{f as m}from"./chunk-AWUW4BD3.js";import{b as i}from"./chunk-DV3LCXRH.js";import{a as r,d as a}from"./chunk-D7WXNA2O.js";import{c}from"./chunk-NI4EYBQH.js";function p(){return globalThis.__TIGRIS_JSON_MODE===!0}function g(){return process.stderr.isTTY===!0}function f(){return process.stdout.isTTY===!0}function u(t,o,n){let e=i(t);if(p()){let s={error:{message:e.message,code:e.exitCode,category:e.category}};e.nextActions.length>0&&(s.nextActions=e.nextActions),console.error(JSON.stringify(s))}else if(o||console.error(`
2
2
  Error: ${e.message}`),g()&&e.nextActions.length>0){console.error(`
3
3
  Next steps:`);for(let s of e.nextActions)console.error(` \u2192 ${s.command} ${s.description}`)}n?.skipCapture||m(t,{category:e.category,command:o?.command,exitCode:e.exitCode}),process.exit(e.exitCode)}function M(t,o){let n=o instanceof Error?o.message:String(o);a(t,n),u(o,t)}function x(t,o){let n=c(t.command,t.operation);return n?.messages?.nextActions?n.messages.nextActions.map(e=>({command:r(e.command,o),description:r(e.description,o)})):[]}function T(t,o){if(!f()||p())return;let n=x(t,o);if(n.length!==0){console.log(`
4
4
  Next steps:`);for(let e of n)console.log(` \u2192 ${e.command} ${e.description}`)}}export{u as a,M as b,x as c,T as d};
@@ -1,4 +1,4 @@
1
- import{b as d}from"./chunk-S6KFKBMY.js";import{a as f,d as e}from"./chunk-GWPU2O5X.js";import{b as s,c as r,d as g,g as c,j as l}from"./chunk-D7WXNA2O.js";import{c as u}from"./chunk-VNUR4TRP.js";import{h as m,r as p}from"./chunk-F4AGJWCK.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(`
1
+ import{b as d}from"./chunk-S6KFKBMY.js";import{a as f,d as e}from"./chunk-4W44TSLI.js";import{b as s,c as r,d as g,g as c,j as l}from"./chunk-D7WXNA2O.js";import{c as u}from"./chunk-J3MAV7JB.js";import{h as m,r as p}from"./chunk-F4AGJWCK.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
2
  Your confirmation code: ${i}
3
3
  `),console.log(`If browser doesn't open, visit: ${w}`)},onWaiting:()=>console.log(`
4
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};
@@ -1 +1 @@
1
- import{b as n}from"./chunk-GWPU2O5X.js";function o(s,e){if(e===void 0)return;let t=(Array.isArray(e)?e:[e]).map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0);return t.length===0&&n(s,"--members requires at least one email address"),t}export{o as a};
1
+ import{b as n}from"./chunk-4W44TSLI.js";function o(s,e){if(e===void 0)return;let t=(Array.isArray(e)?e:[e]).map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0);return t.length===0&&n(s,"--members requires at least one email address"),t}export{o as a};
@@ -1 +1 @@
1
- import{e as l}from"./chunk-V2CQF2CL.js";import{a as m,k as s}from"./chunk-I4WIVMFA.js";import{a as i}from"./chunk-BLUJHGMR.js";import{b as t}from"./chunk-NI4EYBQH.js";import{existsSync as c}from"fs";import{dirname as u,join as a}from"path";import{fileURLToPath as f}from"url";m();var j=f(import.meta.url),d=u(j),h=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=s({specs:h,version:i,loadModule:b,hasImplementation:y});x.parse();l();
1
+ import{e as l}from"./chunk-MW4NG7JY.js";import{a as m,k as s}from"./chunk-4J4ZJAMQ.js";import{a as i}from"./chunk-IHMIXWMY.js";import{b as t}from"./chunk-NI4EYBQH.js";import{existsSync as c}from"fs";import{dirname as u,join as a}from"path";import{fileURLToPath as f}from"url";m();var j=f(import.meta.url),d=u(j),h=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=s({specs:h,version:i,loadModule:b,hasImplementation:y});x.parse();l();
@@ -0,0 +1,5 @@
1
+ import{a as o,b as a,c as g}from"./chunk-6ZZ54RU7.js";import{a as A,c as I}from"./chunk-J3MAV7JB.js";import{i as c,j as l,k as y,l as i,p as d}from"./chunk-F4AGJWCK.js";import{fromIni as S}from"@aws-sdk/credential-providers";function _(){return process.env.AWS_ENDPOINT_URL_S3||process.env.AWS_ENDPOINT_URL_IAM?{endpoint:process.env.AWS_ENDPOINT_URL_S3||o,iamEndpoint:process.env.AWS_ENDPOINT_URL_IAM||a,mgmtEndpoint:process.env.AWS_ENDPOINT_URL_MGMT||g}:{endpoint:process.env.TIGRIS_STORAGE_ENDPOINT||o,iamEndpoint:process.env.TIGRIS_IAM_ENDPOINT||a,mgmtEndpoint:process.env.TIGRIS_MGMT_ENDPOINT||g}}function K(){let e=process.env.TIGRIS_FORCE_PATH_STYLE?.trim().toLowerCase();return e==="1"||e==="true"||e==="yes"||e==="on"}var r=_(),T=A();function p(){if(process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY){let e=process.env.AWS_ENDPOINT_URL_S3||o;return{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,endpoint:e,source:"aws"}}if(process.env.TIGRIS_STORAGE_ACCESS_KEY_ID&&process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY){let e=process.env.TIGRIS_STORAGE_ENDPOINT||o;return{accessKeyId:process.env.TIGRIS_STORAGE_ACCESS_KEY_ID,secretAccessKey:process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY,endpoint:e,source:"tigris"}}return null}var f=!1;async function C(){if(f||!process.stdin.isTTY)return!1;f=!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 h(){if(l()){let s=process.env.AWS_PROFILE||"default",u=await S({profile:s})();return{type:"aws-profile",profile:s,accessKeyId:u.accessKeyId,secretAccessKey:u.secretAccessKey}}let e=p();if(e)return{type:"environment",accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,source:e.source};let t=d();if(t==="oauth")return{type:"oauth"};if(t==="credentials"){let s=i();if(s)return{type:"credentials",accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey}}let n=i();return n?{type:"configured",accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey}:{type:"none"}}async function m(e){let t=await E(e);return K()?{...t,forcePathStyle:!0}:t}async function E(e){let t=await h();switch(t.type){case"aws-profile":{let n=await y(t.profile);return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:n.endpoint||r.endpoint||o,iamEndpoint:n.iamEndpoint||r.iamEndpoint}}case"oauth":{let n=I(),s=c();if(!s)throw new Error('No organization selected. Please run "tigris orgs select" first.');return{sessionToken:await n.getAccessToken(),accessKeyId:"",secretAccessKey:"",...e?.withCredentialProvider&&{credentialProvider:async()=>({accessKeyId:"",secretAccessKey:"",sessionToken:await n.getAccessToken(),expiration:new Date(Date.now()+600*1e3)})},endpoint:r.endpoint,organizationId:s,iamEndpoint:r.iamEndpoint,authDomain:T.domain}}case"credentials":{let n=c();return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:i()?.endpoint||o,organizationId:n??void 0,iamEndpoint:r.iamEndpoint}}case"environment":return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:p()?.endpoint||o};case"configured":{let n=c();return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:i()?.endpoint||o,organizationId:n??void 0,iamEndpoint:r.iamEndpoint}}case"none":{if(await C())return E(e);throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}}}async function O(){let e=await m(),t=c();return{...e,...t&&!e.organizationId?{organizationId:t}:{}}}function R(e){return d()==="oauth"?!1:(p()||i()?console.log(`You are using access key credentials, which belong to a single organization.
3
+ ${e} is only available with OAuth login.
4
+
5
+ Run "tigris login" to login with your Tigris account.`):console.log('Not authenticated. Please run "tigris login" to login with your Tigris account.'),!0)}export{_ as a,K as b,p as c,h as d,m as e,O as f,R as g};
@@ -1 +1 @@
1
- import{a as d}from"./chunk-BLUJHGMR.js";import{g as l}from"./chunk-6ZZ54RU7.js";import*as s from"@sentry/node";var p=new Set(["general","network"]),m=!1,c=!1;function y(){return process.env.TIGRIS_SENTRY_DSN?.trim()||l}function S(){return process.env.TIGRIS_NO_TELEMETRY==="1"||process.env.DO_NOT_TRACK==="1"||process.env.NODE_ENV==="test"||process.env.TIGRIS_ENV==="development"}var E=process.env.TIGRIS_ENV==="development"?"development":"production",h=[/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,/\bt(?:id|sec)_[A-Za-z0-9]+/gi,/eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{4,}/g,/Bearer\s+[A-Za-z0-9._-]+/gi,/AKIA[0-9A-Z]{16}/g,/((?:secret[-_ ]?access[-_ ]?key|secret|password|token|authorization)["']?\s*[:=]\s*["']?)([^\s"',]+)/gi];function u(e){let t=e;for(let r of h)t=t.replace(r,(n,o)=>typeof o=="string"?`${o}[redacted]`:"[redacted]");return t}var _=/secret|password|token|credential|auth|user(name)?|e-?mail|owner|name|key$/i,T=new Set(["-t"]);function g(e){return _.test(e)||T.has(e)}function R(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],o=n.indexOf("=");if(n.startsWith("-")&&o!==-1){let i=n.slice(0,o);t.push(g(i)?`${i}=[redacted]`:`${i}=${u(n.slice(o+1))}`);continue}if(n.startsWith("-")&&g(n)&&r+1<e.length&&!e[r+1].startsWith("-")){t.push(n,"[redacted]"),r++;continue}t.push(u(n))}return t}function A(e){let t=e[0];return t&&!t.startsWith("-")?t:void 0}var I=new Set(["OnUncaughtException","OnUnhandledRejection","LocalVariables","LocalVariablesAsync","Console","ChildProcess"]);function f(e){if(typeof e=="string")return u(e);if(Array.isArray(e))return e.map(f);if(e!==null&&typeof e=="object"){let t=e;for(let r of Object.keys(t))t[r]=f(t[r]);return t}return e}function b(e){return e.server_name=void 0,f(e)}function N(){if(m)return;m=!0;let e=y();if(!(!e||S()))try{s.init({dsn:e,release:`@tigrisdata/cli@${d}`,environment:E,tracesSampleRate:0,sendDefaultPii:!1,integrations:n=>n.filter(o=>!I.has(o.name)),beforeSend:b}),s.setContext("cli",{version:d,node:process.version,platform:process.platform,arch:process.arch});let t=process.argv.slice(2);s.setContext("invocation",{command:R(t).join(" ")});let r=A(t);r&&s.setTag("command",r),c=!0}catch{c=!1}}function C(e,t={}){if(!c)return;let{category:r,command:n,crash:o,exitCode:i}=t;if(!(!o&&r&&!p.has(r)))try{s.captureException(e,a=>(a.setTag("crash",o===!0),r&&a.setTag("error.category",r),n&&a.setTag("command",n),i!==void 0&&a.setTag("exit_code",i),a))}catch{}}async function w(e=2e3){if(c)try{await s.flush(e)}catch{}}export{u as a,R as b,A as c,b as d,N as e,C as f,w as g};
1
+ import{a as d}from"./chunk-IHMIXWMY.js";import{g as l}from"./chunk-6ZZ54RU7.js";import*as s from"@sentry/node";var p=new Set(["general","network"]),m=!1,c=!1;function y(){return process.env.TIGRIS_SENTRY_DSN?.trim()||l}function S(){return process.env.TIGRIS_NO_TELEMETRY==="1"||process.env.DO_NOT_TRACK==="1"||process.env.NODE_ENV==="test"||process.env.TIGRIS_ENV==="development"}var E=process.env.TIGRIS_ENV==="development"?"development":"production",h=[/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,/\bt(?:id|sec)_[A-Za-z0-9]+/gi,/eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{4,}/g,/Bearer\s+[A-Za-z0-9._-]+/gi,/AKIA[0-9A-Z]{16}/g,/((?:secret[-_ ]?access[-_ ]?key|secret|password|token|authorization)["']?\s*[:=]\s*["']?)([^\s"',]+)/gi];function u(e){let t=e;for(let r of h)t=t.replace(r,(n,o)=>typeof o=="string"?`${o}[redacted]`:"[redacted]");return t}var _=/secret|password|token|credential|auth|user(name)?|e-?mail|owner|name|key$/i,T=new Set(["-t"]);function g(e){return _.test(e)||T.has(e)}function R(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],o=n.indexOf("=");if(n.startsWith("-")&&o!==-1){let i=n.slice(0,o);t.push(g(i)?`${i}=[redacted]`:`${i}=${u(n.slice(o+1))}`);continue}if(n.startsWith("-")&&g(n)&&r+1<e.length&&!e[r+1].startsWith("-")){t.push(n,"[redacted]"),r++;continue}t.push(u(n))}return t}function A(e){let t=e[0];return t&&!t.startsWith("-")?t:void 0}var I=new Set(["OnUncaughtException","OnUnhandledRejection","LocalVariables","LocalVariablesAsync","Console","ChildProcess"]);function f(e){if(typeof e=="string")return u(e);if(Array.isArray(e))return e.map(f);if(e!==null&&typeof e=="object"){let t=e;for(let r of Object.keys(t))t[r]=f(t[r]);return t}return e}function b(e){return e.server_name=void 0,f(e)}function N(){if(m)return;m=!0;let e=y();if(!(!e||S()))try{s.init({dsn:e,release:`@tigrisdata/cli@${d}`,environment:E,tracesSampleRate:0,sendDefaultPii:!1,integrations:n=>n.filter(o=>!I.has(o.name)),beforeSend:b}),s.setContext("cli",{version:d,node:process.version,platform:process.platform,arch:process.arch});let t=process.argv.slice(2);s.setContext("invocation",{command:R(t).join(" ")});let r=A(t);r&&s.setTag("command",r),c=!0}catch{c=!1}}function C(e,t={}){if(!c)return;let{category:r,command:n,crash:o,exitCode:i}=t;if(!(!o&&r&&!p.has(r)))try{s.captureException(e,a=>(a.setTag("crash",o===!0),r&&a.setTag("error.category",r),n&&a.setTag("command",n),i!==void 0&&a.setTag("exit_code",i),a))}catch{}}async function w(e=2e3){if(c)try{await s.flush(e)}catch{}}export{u as a,R as b,A as c,b as d,N as e,C as f,w as g};
@@ -0,0 +1 @@
1
+ var e="3.6.1";export{e as a};
@@ -0,0 +1 @@
1
+ import{c as d,d as s,e as g,f,g as p,o as k}from"./chunk-F4AGJWCK.js";import{createRemoteJWKSet as w,jwtVerify as T}from"jose";import _ from"open";function y(){let a=process.env.TIGRIS_ENV==="development",e=a?process.env.TIGRIS_AUTH0_DOMAIN??"auth-storage.tigris.dev":process.env.TIGRIS_AUTH0_DOMAIN??"auth.storage.tigrisdata.io",t=a?process.env.TIGRIS_AUTH0_CLIENT_ID??"JdJVYIyw0O1uHi5L5OJH903qaWBgd3gF":process.env.TIGRIS_AUTH0_CLIENT_ID??"DMejqeM3CQ4IqTjEcd3oA9eEiT40hn8D",n=a?process.env.TIGRIS_AUTH0_AUDIENCE??"https://tigris-api-dev":process.env.TIGRIS_AUTH0_AUDIENCE??"https://tigris-os-api",i=process.env.TIGRIS_CLAIMS_NAMESPACE??"https://tigris";return{domain:e,clientId:t,audience:n,claimsNamespace:i}}var u=class{config;baseUrl;jwks=null;constructor(){this.config=y(),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 _(n.verification_uri_complete)}catch{}e?.onWaiting?.();let i=await this.pollForToken(n.device_code,n.interval||5);await d(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 l=await r.text().then(JSON.parse).catch(()=>({}));if(l.error==="authorization_pending"){await this.sleep(t*1e3);continue}if(l.error==="slow_down"){t+=5,await this.sleep(t*1e3);continue}throw new Error(l.error_description||"Authentication failed")}let 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 d(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?.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 S(){return h||(h=new u),h}export{y as a,u as b,S as c};
@@ -1 +1 @@
1
- import{a as d,b as o}from"./chunk-JNSFDQGG.js";import{a}from"./chunk-S6KFKBMY.js";import{b as i}from"./chunk-GWPU2O5X.js";import{getBucketInfo as l,setBucketLifecycle as g}from"@tigrisdata/storage";var f=["STANDARD_IA","GLACIER","GLACIER_IR"];function c(e){return f.includes(e)}function u(e){return/^\d{4}-\d{2}-\d{2}/.test(e)&&!Number.isNaN(new Date(e).getTime())}function C(e){return{prefix:a(e,["prefix"]),storageClass:a(e,["storage-class","storageClass"]),days:a(e,["days"]),date:a(e,["date"]),expireDays:a(e,["expire-days","expireDays"]),expireDate:a(e,["expire-date","expireDate"]),enable:a(e,["enable"]),disable:a(e,["disable"])}}function p(e,{requireStorageClassForTiming:r=!0}={}){if(e.enable&&e.disable)return"Cannot use both --enable and --disable";if(r&&(e.days!==void 0||e.date!==void 0)&&!e.storageClass)return"--storage-class is required when setting --days or --date";if(e.storageClass&&!c(e.storageClass))return`--storage-class must be one of: ${f.join(", ")} (STANDARD is not a valid transition target)`;if(e.days!==void 0&&e.date!==void 0)return"Cannot specify both --days and --date";if(e.days!==void 0&&(Number.isNaN(Number(e.days))||Number(e.days)<=0))return"--days must be a positive number";if(e.date!==void 0&&!u(e.date))return"--date must be a valid ISO-8601 date (e.g. 2026-06-01)";if(e.expireDays!==void 0&&e.expireDate!==void 0)return"Cannot specify both --expire-days and --expire-date";if(e.expireDays!==void 0&&(Number.isNaN(Number(e.expireDays))||Number(e.expireDays)<=0))return"--expire-days must be a positive number";if(e.expireDate!==void 0&&!u(e.expireDate))return"--expire-date must be a valid ISO-8601 date (e.g. 2026-06-01)";if(e.prefix!==void 0&&e.prefix==="")return"--prefix cannot be empty"}function D(e){let r={};return e.storageClass&&(r.storageClass=e.storageClass),e.days!==void 0?(r.days=Number(e.days),r.date=void 0):e.date!==void 0&&(r.date=e.date,r.days=void 0),r}function R(e){if(e.expireDays!==void 0)return{days:Number(e.expireDays),date:void 0};if(e.expireDate!==void 0)return{date:e.expireDate,days:void 0}}function I(e){if(e.enable)return!0;if(e.disable)return!1}async function N(e,r,n){let{data:t,error:s}=await l(r,{config:n});return s&&i(e,s),t?.settings.lifecycleRules??[]}async function T(e,r,n,t){let{error:s}=await g(r,{lifecycleRules:n,config:t});s&&i(e,s)}function S(e){return d(e)??"-"}function A(e){return o(e)??"-"}export{C as a,p as b,D as c,R as d,I as e,N as f,T as g,S as h,A as i};
1
+ import{a as d,b as o}from"./chunk-JNSFDQGG.js";import{a}from"./chunk-S6KFKBMY.js";import{b as i}from"./chunk-4W44TSLI.js";import{getBucketInfo as l,setBucketLifecycle as g}from"@tigrisdata/storage";var f=["STANDARD_IA","GLACIER","GLACIER_IR"];function c(e){return f.includes(e)}function u(e){return/^\d{4}-\d{2}-\d{2}/.test(e)&&!Number.isNaN(new Date(e).getTime())}function C(e){return{prefix:a(e,["prefix"]),storageClass:a(e,["storage-class","storageClass"]),days:a(e,["days"]),date:a(e,["date"]),expireDays:a(e,["expire-days","expireDays"]),expireDate:a(e,["expire-date","expireDate"]),enable:a(e,["enable"]),disable:a(e,["disable"])}}function p(e,{requireStorageClassForTiming:r=!0}={}){if(e.enable&&e.disable)return"Cannot use both --enable and --disable";if(r&&(e.days!==void 0||e.date!==void 0)&&!e.storageClass)return"--storage-class is required when setting --days or --date";if(e.storageClass&&!c(e.storageClass))return`--storage-class must be one of: ${f.join(", ")} (STANDARD is not a valid transition target)`;if(e.days!==void 0&&e.date!==void 0)return"Cannot specify both --days and --date";if(e.days!==void 0&&(Number.isNaN(Number(e.days))||Number(e.days)<=0))return"--days must be a positive number";if(e.date!==void 0&&!u(e.date))return"--date must be a valid ISO-8601 date (e.g. 2026-06-01)";if(e.expireDays!==void 0&&e.expireDate!==void 0)return"Cannot specify both --expire-days and --expire-date";if(e.expireDays!==void 0&&(Number.isNaN(Number(e.expireDays))||Number(e.expireDays)<=0))return"--expire-days must be a positive number";if(e.expireDate!==void 0&&!u(e.expireDate))return"--expire-date must be a valid ISO-8601 date (e.g. 2026-06-01)";if(e.prefix!==void 0&&e.prefix==="")return"--prefix cannot be empty"}function D(e){let r={};return e.storageClass&&(r.storageClass=e.storageClass),e.days!==void 0?(r.days=Number(e.days),r.date=void 0):e.date!==void 0&&(r.date=e.date,r.days=void 0),r}function R(e){if(e.expireDays!==void 0)return{days:Number(e.expireDays),date:void 0};if(e.expireDate!==void 0)return{date:e.expireDate,days:void 0}}function I(e){if(e.enable)return!0;if(e.disable)return!1}async function N(e,r,n){let{data:t,error:s}=await l(r,{config:n});return s&&i(e,s),t?.settings.lifecycleRules??[]}async function T(e,r,n,t){let{error:s}=await g(r,{lifecycleRules:n,config:t});s&&i(e,s)}function S(e){return d(e)??"-"}function A(e){return o(e)??"-"}export{C as a,p as b,D as c,R as d,I as e,N as f,T as g,S as h,A as i};
@@ -1,4 +1,4 @@
1
- import{a as p}from"./chunk-BLUJHGMR.js";import{d as f,e as m,f as d}from"./chunk-6ZZ54RU7.js";import{mkdirSync as I,readFileSync as b,realpathSync as T,writeFileSync as w}from"fs";import y from"https";import{homedir as h}from"os";import{join as g}from"path";var _=g(h(),".tigris","update-check.json");function C(){try{let e=b(_,"utf-8"),i=JSON.parse(e);return typeof i.latestVersion=="string"&&typeof i.lastChecked=="number"?i:null}catch{return null}}function N(e){try{I(g(h(),".tigris"),{recursive:!0}),w(_,JSON.stringify(e),"utf-8")}catch{}}function E(e,i){let o=s=>{let n=s.startsWith("v")?s.slice(1):s,c=null,a=n.indexOf("-");a!==-1&&(c=n.slice(a+1),n=n.slice(0,a));let l=n.split(".");if(l.length!==3)return null;let u=l.map(Number);return u.some(Number.isNaN)?null:{major:u[0],minor:u[1],patch:u[2],prerelease:c}},r=o(e),t=o(i);return!r||!t?!1:t.major>r.major?!0:t.major<r.major?!1:t.minor>r.minor?!0:t.minor<r.minor?!1:t.patch>r.patch?!0:t.patch<r.patch?!1:r.prerelease&&!t.prerelease?!0:(!r.prerelease&&t.prerelease,!1)}function S(){if(process.platform==="win32")return!1;try{let e=T(process.execPath);return e.includes("/Cellar/")||e.includes("/Caskroom/")}catch{return!1}}function P(){return globalThis.__TIGRIS_BINARY===!0?S()?"brew upgrade tigris":process.platform==="win32"?"irm https://raw.githubusercontent.com/tigrisdata/storage/main/packages/cli/scripts/install.ps1 | iex":"curl -fsSL https://raw.githubusercontent.com/tigrisdata/storage/main/packages/cli/scripts/install.sh | sh":"npm install -g @tigrisdata/cli"}function k(e={}){return new Promise((i,o)=>{let r=y.get(f,{timeout:1e4},t=>{let s="";t.on("data",n=>{s+=n}),t.on("end",()=>{try{let n=JSON.parse(s);typeof n.version=="string"?(N({...C(),latestVersion:n.version,lastChecked:Date.now()}),i(n.version)):o(new Error("Unexpected registry response"))}catch{o(new Error("Failed to parse registry response"))}})});r.on("error",t=>{o(t)}),r.on("timeout",()=>{r.destroy(),o(new Error("Request timed out"))}),e.unref&&r.on("socket",t=>{t.unref()}),r.end()})}function R(){k({unref:!0}).catch(()=>{})}function D(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let e=C(),i=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||36e5;if(e&&E(p,e.latestVersion)&&(!e.lastNotified||Date.now()-e.lastNotified>i)){let r=`Update available: ${p} \u2192 ${e.latestVersion}`,t='Run "tigris update" to upgrade.',s=Math.max(r.length,t.length)+4,n=`\u250C${"\u2500".repeat(s-2)}\u2510`,c=`\u2514${"\u2500".repeat(s-2)}\u2518`,a=l=>`\u2502 ${l.padEnd(s-4)} \u2502`;console.log(`
1
+ import{a as p}from"./chunk-IHMIXWMY.js";import{d as f,e as m,f as d}from"./chunk-6ZZ54RU7.js";import{mkdirSync as I,readFileSync as b,realpathSync as T,writeFileSync as w}from"fs";import y from"https";import{homedir as h}from"os";import{join as g}from"path";var _=g(h(),".tigris","update-check.json");function C(){try{let e=b(_,"utf-8"),i=JSON.parse(e);return typeof i.latestVersion=="string"&&typeof i.lastChecked=="number"?i:null}catch{return null}}function N(e){try{I(g(h(),".tigris"),{recursive:!0}),w(_,JSON.stringify(e),"utf-8")}catch{}}function E(e,i){let o=s=>{let n=s.startsWith("v")?s.slice(1):s,c=null,a=n.indexOf("-");a!==-1&&(c=n.slice(a+1),n=n.slice(0,a));let l=n.split(".");if(l.length!==3)return null;let u=l.map(Number);return u.some(Number.isNaN)?null:{major:u[0],minor:u[1],patch:u[2],prerelease:c}},r=o(e),t=o(i);return!r||!t?!1:t.major>r.major?!0:t.major<r.major?!1:t.minor>r.minor?!0:t.minor<r.minor?!1:t.patch>r.patch?!0:t.patch<r.patch?!1:r.prerelease&&!t.prerelease?!0:(!r.prerelease&&t.prerelease,!1)}function S(){if(process.platform==="win32")return!1;try{let e=T(process.execPath);return e.includes("/Cellar/")||e.includes("/Caskroom/")}catch{return!1}}function P(){return globalThis.__TIGRIS_BINARY===!0?S()?"brew upgrade tigris":process.platform==="win32"?"irm https://raw.githubusercontent.com/tigrisdata/storage/main/packages/cli/scripts/install.ps1 | iex":"curl -fsSL https://raw.githubusercontent.com/tigrisdata/storage/main/packages/cli/scripts/install.sh | sh":"npm install -g @tigrisdata/cli"}function k(e={}){return new Promise((i,o)=>{let r=y.get(f,{timeout:1e4},t=>{let s="";t.on("data",n=>{s+=n}),t.on("end",()=>{try{let n=JSON.parse(s);typeof n.version=="string"?(N({...C(),latestVersion:n.version,lastChecked:Date.now()}),i(n.version)):o(new Error("Unexpected registry response"))}catch{o(new Error("Failed to parse registry response"))}})});r.on("error",t=>{o(t)}),r.on("timeout",()=>{r.destroy(),o(new Error("Request timed out"))}),e.unref&&r.on("socket",t=>{t.unref()}),r.end()})}function R(){k({unref:!0}).catch(()=>{})}function D(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let e=C(),i=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||36e5;if(e&&E(p,e.latestVersion)&&(!e.lastNotified||Date.now()-e.lastNotified>i)){let r=`Update available: ${p} \u2192 ${e.latestVersion}`,t='Run "tigris update" to upgrade.',s=Math.max(r.length,t.length)+4,n=`\u250C${"\u2500".repeat(s-2)}\u2510`,c=`\u2514${"\u2500".repeat(s-2)}\u2518`,a=l=>`\u2502 ${l.padEnd(s-4)} \u2502`;console.log(`
2
2
  ${n}
3
3
  ${a("")}
4
4
  ${a(r)}
@@ -1 +1 @@
1
- import{a as n}from"./chunk-S77OAN6Y.js";import{b as s}from"./chunk-GWPU2O5X.js";import{e as o}from"./chunk-D7WXNA2O.js";import m from"enquirer";import{listPolicies as f}from"@tigrisdata/iam";var{prompt:p}=m;async function h(a,t,c="Select a policy:"){let{data:e,error:r}=await f({config:a});if(r&&s(t,r),!e.policies||e.policies.length===0){o(t);return}n("Provide the policy ARN as a positional argument");let{selected:l}=await p({type:"select",name:"selected",message:c,choices:e.policies.map(i=>({name:i.resource,message:`${i.name} (${i.resource})`}))});return l}export{h as a};
1
+ import{a as n}from"./chunk-S77OAN6Y.js";import{b as s}from"./chunk-4W44TSLI.js";import{e as o}from"./chunk-D7WXNA2O.js";import m from"enquirer";import{listPolicies as f}from"@tigrisdata/iam";var{prompt:p}=m;async function h(a,t,c="Select a policy:"){let{data:e,error:r}=await f({config:a});if(r&&s(t,r),!e.policies||e.policies.length===0){o(t);return}n("Provide the policy ARN as a positional argument");let{selected:l}=await p({type:"select",name:"selected",message:c,choices:e.policies.map(i=>({name:i.resource,message:`${i.name} (${i.resource})`}))});return l}export{h as a};
@@ -1,4 +1,4 @@
1
- import{a as w,c as T,d as S,e as y,f as $,g as L,h as j,j as f,k as R}from"./chunk-OWYZCGWM.js";import{b as C,d as P}from"./chunk-V2CQF2CL.js";import{spawnSync as V}from"child_process";import{existsSync as g,mkdirSync as F,readFileSync as W,writeFileSync as G}from"fs";import{homedir as O}from"os";import{dirname as x}from"path";import*as e from"@clack/prompts";async function Q(){process.stdin.isTTY||(console.error("Run `tigris init` in an interactive terminal."),process.exit(1));let t=process.cwd(),i=O();e.intro("Connect Tigris to your AI coding agent");let n=j({env:process.env,cwd:t,home:i,fileExists:g}),l=await e.multiselect({message:"Which editor(s) should use Tigris?",options:y.map(r=>({value:r.id,label:r.label})),initialValues:n,required:!0});if(e.isCancel(l))return d();let s=y.filter(r=>l.includes(r.id)),c=await e.select({message:"What would you like to install?",options:[{value:"defaults",label:"Defaults",hint:"CLI - Global, MCP - Global, Skills - Project"},{value:"custom",label:"Customize installation"}],initialValue:"defaults"});if(e.isCancel(c))return d();let o="global",a="project";c==="custom"&&(o=await A("MCP server:","global"),a=await A("Agent skills:","project"));let p=f.map(r=>r.id);if(c==="custom"&&a!=="skip"){let r=await e.multiselect({message:"Which skills should your agent get? (space to toggle)",options:f.map(u=>({value:u.id,label:u.label})),initialValues:f.filter(u=>u.recommended).map(u=>u.id),required:!1});if(e.isCancel(r))return d();p=r}let m=await U();if(o==="skip")e.log.info("MCP server: skipped");else for(let r of s)_(r,o,t,i);if(a==="skip"||p.length===0)e.log.info("Agent skills: skipped");else{let r=s.map(k=>k.skillsAgent),u=R(p,r,a==="global"),b=v("npx",u,`Installing ${p.length} Tigris skill(s) (${a})`);if(b.ok)for(let k of $(s,a,t))e.log.success(`Skills \u2192 ${h(k,i)}`);else b.output&&e.log.error(b.output.split(`
1
+ import{a as w,c as T,d as S,e as y,f as $,g as L,h as j,j as f,k as R}from"./chunk-OWYZCGWM.js";import{b as C,d as P}from"./chunk-MW4NG7JY.js";import{spawnSync as V}from"child_process";import{existsSync as g,mkdirSync as F,readFileSync as W,writeFileSync as G}from"fs";import{homedir as O}from"os";import{dirname as x}from"path";import*as e from"@clack/prompts";async function Q(){process.stdin.isTTY||(console.error("Run `tigris init` in an interactive terminal."),process.exit(1));let t=process.cwd(),i=O();e.intro("Connect Tigris to your AI coding agent");let n=j({env:process.env,cwd:t,home:i,fileExists:g}),l=await e.multiselect({message:"Which editor(s) should use Tigris?",options:y.map(r=>({value:r.id,label:r.label})),initialValues:n,required:!0});if(e.isCancel(l))return d();let s=y.filter(r=>l.includes(r.id)),c=await e.select({message:"What would you like to install?",options:[{value:"defaults",label:"Defaults",hint:"CLI - Global, MCP - Global, Skills - Project"},{value:"custom",label:"Customize installation"}],initialValue:"defaults"});if(e.isCancel(c))return d();let o="global",a="project";c==="custom"&&(o=await A("MCP server:","global"),a=await A("Agent skills:","project"));let p=f.map(r=>r.id);if(c==="custom"&&a!=="skip"){let r=await e.multiselect({message:"Which skills should your agent get? (space to toggle)",options:f.map(u=>({value:u.id,label:u.label})),initialValues:f.filter(u=>u.recommended).map(u=>u.id),required:!1});if(e.isCancel(r))return d();p=r}let m=await U();if(o==="skip")e.log.info("MCP server: skipped");else for(let r of s)_(r,o,t,i);if(a==="skip"||p.length===0)e.log.info("Agent skills: skipped");else{let r=s.map(k=>k.skillsAgent),u=R(p,r,a==="global"),b=v("npx",u,`Installing ${p.length} Tigris skill(s) (${a})`);if(b.ok)for(let k of $(s,a,t))e.log.success(`Skills \u2192 ${h(k,i)}`);else b.output&&e.log.error(b.output.split(`
2
2
  `).slice(-6).join(`
3
3
  `))}e.note(m?"tigris init --agent":"npx @tigrisdata/cli init --agent","Paste this to your AI coding agent to finish setup"),e.outro("Your agent will authenticate with Tigris in-browser on first use.")}async function A(t,i){let n=await e.select({message:t,options:[{value:"global",label:"Global (available in all projects)"},{value:"project",label:"Project-level (this project only)"},{value:"skip",label:"Skip"}],initialValue:i});return e.isCancel(n)&&d(),n}function d(){e.cancel("Setup cancelled."),process.exit(1)}function h(t,i){return t.startsWith(i)?`~${t.slice(i.length)}`:t}function _(t,i,n,l){let s=t.mcp,c=L(t,i,n);if(!s||!c){e.log.warn(`${t.label}: no writable MCP config \u2014 skipped.`);return}let o=c.path;!g(o)&&o.endsWith(".json")&&g(`${o}c`)&&(o=`${o}c`);let a=x(o);if(s.createDirs===!1&&!g(x(a))){e.log.warn(`${t.label}: not installed \u2014 skipped.`);return}try{let p=g(o)?W(o,"utf8"):null,m=s.format==="toml"?S(p,s.key,w,N(s.entry)):T(p,s.key,w,s.entry);F(a,{recursive:!0}),G(o,m.content);let I=c.scope===i?"":` (${c.scope}-only)`;e.log.success(`${t.label}: MCP \u2192 ${h(o,l)}${I}`)}catch{e.log.error(`${t.label}: could not update ${h(o,l)} (incompatible or unwritable) \u2014 skipped.`)}}function N(t){let i={};for(let[n,l]of Object.entries(t))typeof l=="string"&&(i[n]=l);return i}function E(){let t=V("tigris",["--version"],D());if(t.error||t.status!==0||!t.stdout)return null;let i=t.stdout.trim().split(`
4
4
  `)[0].trim();return/^\d+\.\d+\.\d+/.test(i)?i:null}async function U(){let t=E(),i=await Y(3e3);if(!t){let n=v("npm",["install","-g","@tigrisdata/cli","--ignore-scripts"],"Installing Tigris CLI (global)");return M(n)?E()===null?(e.log.warn("Tigris CLI installed but not on PATH \u2014 the agent handoff will use npx."),!1):!0:!1}return i&&C(t,i)?M(v("tigris",["update"],`Updating Tigris CLI ${t} \u2192 ${i}`)):!0}async function Y(t){let i;try{return await Promise.race([P({unref:!0}).catch(()=>null),new Promise(n=>{i=setTimeout(()=>n(null),t)})])}finally{i&&clearTimeout(i)}}function D(){return{encoding:"utf8",...process.platform==="win32"?{shell:!0}:{}}}function v(t,i,n){let l=e.spinner();l.start(n);let s=V(t,i,D());return s.status===0?(l.stop(`${n} \u2014 done`),{ok:!0}):(l.stop(`${n} \u2014 failed`),{ok:!1,output:(s.stderr||s.stdout||s.error?.message||"").trim()})}function M(t){return!t.ok&&t.output&&e.log.error(t.output.split(`
@@ -1 +1 @@
1
- import{a as K}from"./chunk-S77OAN6Y.js";import{a as w}from"./chunk-WJLB362D.js";import{b as S}from"./chunk-S6KFKBMY.js";import{b as m,d as g}from"./chunk-GWPU2O5X.js";import{b as i,c as n,j as o}from"./chunk-D7WXNA2O.js";import{a as d}from"./chunk-6ZZ54RU7.js";import{l as f,n as y,o as p,q as u,s as l}from"./chunk-F4AGJWCK.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)&&m(a,"Access key and secret are required");let h=f()?.endpoint||d;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),g(a)}export{q as a};
1
+ import{a as K}from"./chunk-S77OAN6Y.js";import{a as w}from"./chunk-AWTU3DRX.js";import{b as S}from"./chunk-S6KFKBMY.js";import{b as m,d as g}from"./chunk-4W44TSLI.js";import{b as i,c as n,j as o}from"./chunk-D7WXNA2O.js";import{a as d}from"./chunk-6ZZ54RU7.js";import{l as f,n as y,o as p,q as u,s as l}from"./chunk-F4AGJWCK.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)&&m(a,"Access key and secret are required");let h=f()?.endpoint||d;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),g(a)}export{q as a};
package/dist/cli-core.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-I4WIVMFA.js";import"./chunk-GWPU2O5X.js";import"./chunk-AWVF3WSN.js";import"./chunk-BLUJHGMR.js";import"./chunk-DV3LCXRH.js";import"./chunk-D7WXNA2O.js";import"./chunk-NI4EYBQH.js";import"./chunk-6ZZ54RU7.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-4J4ZJAMQ.js";import"./chunk-4W44TSLI.js";import"./chunk-AWUW4BD3.js";import"./chunk-IHMIXWMY.js";import"./chunk-DV3LCXRH.js";import"./chunk-D7WXNA2O.js";import"./chunk-NI4EYBQH.js";import"./chunk-6ZZ54RU7.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-75CEDNCH.js";import"./chunk-V2CQF2CL.js";import"./chunk-I4WIVMFA.js";import"./chunk-GWPU2O5X.js";import"./chunk-AWVF3WSN.js";import"./chunk-BLUJHGMR.js";import"./chunk-DV3LCXRH.js";import"./chunk-D7WXNA2O.js";import"./chunk-NI4EYBQH.js";import"./chunk-6ZZ54RU7.js";
2
+ import"./chunk-7Z6ZHS7Y.js";import"./chunk-MW4NG7JY.js";import"./chunk-4J4ZJAMQ.js";import"./chunk-4W44TSLI.js";import"./chunk-AWUW4BD3.js";import"./chunk-IHMIXWMY.js";import"./chunk-DV3LCXRH.js";import"./chunk-D7WXNA2O.js";import"./chunk-NI4EYBQH.js";import"./chunk-6ZZ54RU7.js";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import"./chunk-75CEDNCH.js";import"./chunk-V2CQF2CL.js";import"./chunk-I4WIVMFA.js";import"./chunk-GWPU2O5X.js";import"./chunk-AWVF3WSN.js";import"./chunk-BLUJHGMR.js";import"./chunk-DV3LCXRH.js";import"./chunk-D7WXNA2O.js";import"./chunk-NI4EYBQH.js";import"./chunk-6ZZ54RU7.js";
1
+ import"./chunk-7Z6ZHS7Y.js";import"./chunk-MW4NG7JY.js";import"./chunk-4J4ZJAMQ.js";import"./chunk-4W44TSLI.js";import"./chunk-AWUW4BD3.js";import"./chunk-IHMIXWMY.js";import"./chunk-DV3LCXRH.js";import"./chunk-D7WXNA2O.js";import"./chunk-NI4EYBQH.js";import"./chunk-6ZZ54RU7.js";
@@ -1 +1 @@
1
- import{b as y}from"../../chunk-BLWMGKCV.js";import"../../chunk-WJLB362D.js";import{a as s,b as h}from"../../chunk-S6KFKBMY.js";import{b as n,c as b,d as p}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as A,c as f,j as R}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.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-2FH2T67P.js";import"../../chunk-AWTU3DRX.js";import{a as s,b as h}from"../../chunk-S6KFKBMY.js";import{b as n,c as b,d as p}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as A,c as f,j as R}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.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-BLWMGKCV.js";import{a as d}from"../../chunk-S77OAN6Y.js";import"../../chunk-WJLB362D.js";import{a as l,b as h}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as y,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import S from"enquirer";import{attachPolicyToAccessKey as N,listPolicies as R,listPoliciesForAccessKey as q}from"@tigrisdata/iam";var{prompt:k}=S,e=g("access-keys","attach-policy");async function v(s){p(e);let A=h(s),o=l(s,["id"]),r=l(s,["policyArn","policy-arn"]);o||t(e,"Access key ID is required");let c=await u(e);if(!r){d("Use --policy-arn to specify the policy ARN");let[a,n]=await Promise.all([R({config:c}),q(o,{config:c})]);a.error&&t(e,a.error),n.error&&t(e,n.error);let w=new Set(n.data.policies),f=a.data.policies.filter(i=>!w.has(i.name));f.length===0&&t(e,"No unassigned policies available. All policies are already attached to this access key.");let{selected:P}=await k({type:"select",name:"selected",message:"Select a policy to attach:",choices:f.map(i=>({name:i.resource,message:`${i.name} (${i.resource})`}))});r=P}let{error:m}=await N(o,r,{config:c});m&&t(e,m),A==="json"&&console.log(JSON.stringify({action:"attached",id:o,policyArn:r})),y(e)}export{v as default};
1
+ import{b as u}from"../../chunk-2FH2T67P.js";import{a as d}from"../../chunk-S77OAN6Y.js";import"../../chunk-AWTU3DRX.js";import{a as l,b as h}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as y,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import S from"enquirer";import{attachPolicyToAccessKey as N,listPolicies as R,listPoliciesForAccessKey as q}from"@tigrisdata/iam";var{prompt:k}=S,e=g("access-keys","attach-policy");async function v(s){p(e);let A=h(s),o=l(s,["id"]),r=l(s,["policyArn","policy-arn"]);o||t(e,"Access key ID is required");let c=await u(e);if(!r){d("Use --policy-arn to specify the policy ARN");let[a,n]=await Promise.all([R({config:c}),q(o,{config:c})]);a.error&&t(e,a.error),n.error&&t(e,n.error);let w=new Set(n.data.policies),f=a.data.policies.filter(i=>!w.has(i.name));f.length===0&&t(e,"No unassigned policies available. All policies are already attached to this access key.");let{selected:P}=await k({type:"select",name:"selected",message:"Select a policy to attach:",choices:f.map(i=>({name:i.resource,message:`${i.name} (${i.resource})`}))});r=P}let{error:m}=await N(o,r,{config:c});m&&t(e,m),A==="json"&&console.log(JSON.stringify({action:"attached",id:o,policyArn:r})),y(e)}export{v as default};
@@ -1 +1 @@
1
- import{b as u}from"../../chunk-BLWMGKCV.js";import"../../chunk-WJLB362D.js";import{a as d,b as p}from"../../chunk-S6KFKBMY.js";import{b as o,c as g,d as f}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as m,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{createAccessKey as w}from"@tigrisdata/iam";var t=l("access-keys","create");async function x(n){a(t);let A=p(n),c=d(n,["name"]);c||o(t,"Access key name is required");let y=await u(t),{data:e,error:s}=await w(c,{config:y});if(s&&o(t,s),A==="json"){let r=g(t,{name:e.name,id:e.id}),i={action:"created",name:e.name,id:e.id,secret:e.secret};r.length>0&&(i.nextActions=r),console.log(JSON.stringify(i))}else console.log(` Name: ${e.name}`),console.log(` Access Key ID: ${e.id}`),console.log(` Secret Access Key: ${e.secret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again.");m(t),f(t,{name:e.name,id:e.id})}export{x as default};
1
+ import{b as u}from"../../chunk-2FH2T67P.js";import"../../chunk-AWTU3DRX.js";import{a as d,b as p}from"../../chunk-S6KFKBMY.js";import{b as o,c as g,d as f}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as m,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{createAccessKey as w}from"@tigrisdata/iam";var t=l("access-keys","create");async function x(n){a(t);let A=p(n),c=d(n,["name"]);c||o(t,"Access key name is required");let y=await u(t),{data:e,error:s}=await w(c,{config:y});if(s&&o(t,s),A==="json"){let r=g(t,{name:e.name,id:e.id}),i={action:"created",name:e.name,id:e.id,secret:e.secret};r.length>0&&(i.nextActions=r),console.log(JSON.stringify(i))}else console.log(` Name: ${e.name}`),console.log(` Access Key ID: ${e.id}`),console.log(` Secret Access Key: ${e.secret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again.");m(t),f(t,{name:e.name,id:e.id})}export{x as default};
@@ -1 +1 @@
1
- import{b as g}from"../../chunk-BLWMGKCV.js";import{a as m,b as a}from"../../chunk-S77OAN6Y.js";import"../../chunk-WJLB362D.js";import{a as i,b as d}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as n,c as s,j as f}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{removeAccessKey as u}from"@tigrisdata/iam";var e=f("access-keys","delete");async function k(r){n(e);let l=d(r),o=i(r,["id"]),p=i(r,["yes","y","force"]);if(o||t(e,"Access key ID is required"),!p&&(m("Use --yes to skip confirmation"),!await a(`Delete access key '${o}'?`))){console.log("Aborted");return}let y=await g(e),{error:c}=await u(o,{config:y});c&&t(e,c),l==="json"&&console.log(JSON.stringify({action:"deleted",id:o})),s(e)}export{k as default};
1
+ import{b as g}from"../../chunk-2FH2T67P.js";import{a as m,b as a}from"../../chunk-S77OAN6Y.js";import"../../chunk-AWTU3DRX.js";import{a as i,b as d}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as n,c as s,j as f}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{removeAccessKey as u}from"@tigrisdata/iam";var e=f("access-keys","delete");async function k(r){n(e);let l=d(r),o=i(r,["id"]),p=i(r,["yes","y","force"]);if(o||t(e,"Access key ID is required"),!p&&(m("Use --yes to skip confirmation"),!await a(`Delete access key '${o}'?`))){console.log("Aborted");return}let y=await g(e),{error:c}=await u(o,{config:y});c&&t(e,c),l==="json"&&console.log(JSON.stringify({action:"deleted",id:o})),s(e)}export{k as default};
@@ -1 +1 @@
1
- import{b as A}from"../../chunk-BLWMGKCV.js";import{a as m,b as h}from"../../chunk-S77OAN6Y.js";import"../../chunk-WJLB362D.js";import{a,b as u}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as y,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import N from"enquirer";import{detachPolicyFromAccessKey as $,listPolicies as q,listPoliciesForAccessKey as F}from"@tigrisdata/iam";var{prompt:R}=N,e=g("access-keys","detach-policy");async function I(c){p(e);let w=u(c),t=a(c,["id"]),i=a(c,["policyArn","policy-arn"]),k=a(c,["yes","y","force"]);t||o(e,"Access key ID is required");let n=await A(e);if(!i){m("Use --policy-arn to specify the policy ARN");let[s,l]=await Promise.all([F(t,{config:n}),q({config:n})]);s.error&&o(e,s.error),l.error&&o(e,l.error);let P=new Set(s.data.policies),d=l.data.policies.filter(r=>P.has(r.name));d.length===0&&o(e,"No policies are attached to this access key.");let{selected:S}=await R({type:"select",name:"selected",message:"Select a policy to detach:",choices:d.map(r=>({name:r.resource,message:`${r.name} (${r.resource})`}))});i=S}if(!k&&(m("Use --yes to skip confirmation"),!await h(`Detach policy '${i}' from access key '${t}'?`))){console.log("Aborted");return}let{error:f}=await $(t,i,{config:n});f&&o(e,f),w==="json"&&console.log(JSON.stringify({action:"detached",id:t,policyArn:i})),y(e)}export{I as default};
1
+ import{b as A}from"../../chunk-2FH2T67P.js";import{a as m,b as h}from"../../chunk-S77OAN6Y.js";import"../../chunk-AWTU3DRX.js";import{a,b as u}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as y,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import N from"enquirer";import{detachPolicyFromAccessKey as $,listPolicies as q,listPoliciesForAccessKey as F}from"@tigrisdata/iam";var{prompt:R}=N,e=g("access-keys","detach-policy");async function I(c){p(e);let w=u(c),t=a(c,["id"]),i=a(c,["policyArn","policy-arn"]),k=a(c,["yes","y","force"]);t||o(e,"Access key ID is required");let n=await A(e);if(!i){m("Use --policy-arn to specify the policy ARN");let[s,l]=await Promise.all([F(t,{config:n}),q({config:n})]);s.error&&o(e,s.error),l.error&&o(e,l.error);let P=new Set(s.data.policies),d=l.data.policies.filter(r=>P.has(r.name));d.length===0&&o(e,"No policies are attached to this access key.");let{selected:S}=await R({type:"select",name:"selected",message:"Select a policy to detach:",choices:d.map(r=>({name:r.resource,message:`${r.name} (${r.resource})`}))});i=S}if(!k&&(m("Use --yes to skip confirmation"),!await h(`Detach policy '${i}' from access key '${t}'?`))){console.log("Aborted");return}let{error:f}=await $(t,i,{config:n});f&&o(e,f),w==="json"&&console.log(JSON.stringify({action:"detached",id:t,policyArn:i})),y(e)}export{I as default};
@@ -1 +1 @@
1
- import{b as m}from"../../chunk-BLWMGKCV.js";import"../../chunk-WJLB362D.js";import{a,b as f}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{getAccessKey as u}from"@tigrisdata/iam";var e=g("access-keys","get");async function $(s){c(e);let d=f(s),r=a(s,["id"]);r||t(e,"Access key ID is required");let p=await m(e),{data:o,error:n}=await u(r,{config:p});if(n&&t(e,n),d==="json")console.log(JSON.stringify(o));else if(console.log(` Name: ${o.name}`),console.log(` ID: ${o.id}`),console.log(` Status: ${o.status}`),console.log(` Created: ${o.createdAt}`),console.log(` Organization: ${o.organizationId}`),o.roles&&o.roles.length>0){console.log(" Roles:");for(let i of o.roles)console.log(` - ${i.bucket}: ${i.role}`)}else console.log(" Roles: None");l(e)}export{$ as default};
1
+ import{b as m}from"../../chunk-2FH2T67P.js";import"../../chunk-AWTU3DRX.js";import{a,b as f}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{getAccessKey as u}from"@tigrisdata/iam";var e=g("access-keys","get");async function $(s){c(e);let d=f(s),r=a(s,["id"]);r||t(e,"Access key ID is required");let p=await m(e),{data:o,error:n}=await u(r,{config:p});if(n&&t(e,n),d==="json")console.log(JSON.stringify(o));else if(console.log(` Name: ${o.name}`),console.log(` ID: ${o.id}`),console.log(` Status: ${o.status}`),console.log(` Created: ${o.createdAt}`),console.log(` Organization: ${o.organizationId}`),o.roles&&o.roles.length>0){console.log(" Roles:");for(let i of o.roles)console.log(` - ${i.bucket}: ${i.role}`)}else console.log(" Roles: None");l(e)}export{$ as default};
@@ -1 +1 @@
1
- import{b as P}from"../../chunk-BLWMGKCV.js";import{g as A}from"../../chunk-AFM3TY2D.js";import"../../chunk-WJLB362D.js";import{a as y,b as k,c as h}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as m,c as g,e as f,i as d,j as u}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{listPoliciesForAccessKey as E}from"@tigrisdata/iam";var i=u("access-keys","list-policies");async function F(o){m(i);let n=k(o),{limit:s,pageToken:r}=h(o),a=y(o,["id"]);a||c(i,"Access key ID is required");let T=await P(i),{data:t,error:p}=await E(a,{...s!==void 0?{limit:s}:{},...r?{paginationToken:r}:{},config:T});if(p&&c(i,p),!t.policies||t.policies.length===0){f(i);return}let e=t.policies.map(O=>({policy:O})),x=[{key:"policy",header:e.length>1?"Attached Policies":"Attached Policy"}],l=t.paginationToken||void 0,w=A(e,n,"policies","policy",x,{paginationToken:l});console.log(w),n!=="json"&&n!=="xml"&&d(l),g(i,{count:e.length})}export{F as default};
1
+ import{b as P}from"../../chunk-2FH2T67P.js";import{g as A}from"../../chunk-AFM3TY2D.js";import"../../chunk-AWTU3DRX.js";import{a as y,b as k,c as h}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as m,c as g,e as f,i as d,j as u}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{listPoliciesForAccessKey as E}from"@tigrisdata/iam";var i=u("access-keys","list-policies");async function F(o){m(i);let n=k(o),{limit:s,pageToken:r}=h(o),a=y(o,["id"]);a||c(i,"Access key ID is required");let T=await P(i),{data:t,error:p}=await E(a,{...s!==void 0?{limit:s}:{},...r?{paginationToken:r}:{},config:T});if(p&&c(i,p),!t.policies||t.policies.length===0){f(i);return}let e=t.policies.map(O=>({policy:O})),x=[{key:"policy",header:e.length>1?"Attached Policies":"Attached Policy"}],l=t.paginationToken||void 0,w=A(e,n,"policies","policy",x,{paginationToken:l});console.log(w),n!=="json"&&n!=="xml"&&d(l),g(i,{count:e.length})}export{F as default};
@@ -1 +1 @@
1
- import{b as h}from"../../chunk-BLWMGKCV.js";import{g as T}from"../../chunk-AFM3TY2D.js";import"../../chunk-WJLB362D.js";import{b as k,c as y}from"../../chunk-S6KFKBMY.js";import{b as l}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as d,c as p,e as f,i as g,j as u}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{listAccessKeys as A}from"@tigrisdata/iam";var t=u("access-keys","list");async function P(a){d(t);let o=k(a),{limit:s,pageToken:i}=y(a),x=await h(t),{data:e,error:r}=await A({...s!==void 0?{limit:s}:{},...i?{paginationToken:i}:{},config:x});if(r&&l(t,r),!e.accessKeys||e.accessKeys.length===0){f(t);return}let c=e.accessKeys.map(n=>({name:n.name,id:n.id,status:n.status,created:n.createdAt})),K=[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}],m=e.paginationToken||void 0,w=T(c,o,"keys","key",K,{paginationToken:m});console.log(w),o!=="json"&&o!=="xml"&&g(m),p(t,{count:c.length})}export{P as default};
1
+ import{b as h}from"../../chunk-2FH2T67P.js";import{g as T}from"../../chunk-AFM3TY2D.js";import"../../chunk-AWTU3DRX.js";import{b as k,c as y}from"../../chunk-S6KFKBMY.js";import{b as l}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as d,c as p,e as f,i as g,j as u}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{listAccessKeys as A}from"@tigrisdata/iam";var t=u("access-keys","list");async function P(a){d(t);let o=k(a),{limit:s,pageToken:i}=y(a),x=await h(t),{data:e,error:r}=await A({...s!==void 0?{limit:s}:{},...i?{paginationToken:i}:{},config:x});if(r&&l(t,r),!e.accessKeys||e.accessKeys.length===0){f(t);return}let c=e.accessKeys.map(n=>({name:n.name,id:n.id,status:n.status,created:n.createdAt})),K=[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}],m=e.paginationToken||void 0,w=T(c,o,"keys","key",K,{paginationToken:m});console.log(w),o!=="json"&&o!=="xml"&&g(m),p(t,{count:c.length})}export{P as default};
@@ -1 +1 @@
1
- import{b as w}from"../../chunk-BLWMGKCV.js";import{a as u,b as y}from"../../chunk-S77OAN6Y.js";import"../../chunk-WJLB362D.js";import{a as i,b as p}from"../../chunk-S6KFKBMY.js";import{b as n,c as g,d as m}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as l,j as d}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{rotateAccessKey as k}from"@tigrisdata/iam";var e=d("access-keys","rotate");async function x(o){f(e);let A=p(o),r=i(o,["id"]),S=i(o,["yes","y","force"]);if(r||n(e,"Access key ID is required"),!S&&(u("Use --yes to skip confirmation"),!await y(`Rotate access key '${r}'? The current secret will be invalidated.`))){console.log("Aborted");return}let h=await w(e),{data:t,error:s}=await k(r,{config:h});if(s&&n(e,s),A==="json"){let c=g(e,{id:t.id}),a={action:"rotated",id:t.id,secret:t.newSecret};c.length>0&&(a.nextActions=c),console.log(JSON.stringify(a))}else console.log(` Access Key ID: ${t.id}`),console.log(` New Secret Access Key: ${t.newSecret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again.");l(e),m(e,{id:t.id})}export{x as default};
1
+ import{b as w}from"../../chunk-2FH2T67P.js";import{a as u,b as y}from"../../chunk-S77OAN6Y.js";import"../../chunk-AWTU3DRX.js";import{a as i,b as p}from"../../chunk-S6KFKBMY.js";import{b as n,c as g,d as m}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as l,j as d}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{rotateAccessKey as k}from"@tigrisdata/iam";var e=d("access-keys","rotate");async function x(o){f(e);let A=p(o),r=i(o,["id"]),S=i(o,["yes","y","force"]);if(r||n(e,"Access key ID is required"),!S&&(u("Use --yes to skip confirmation"),!await y(`Rotate access key '${r}'? The current secret will be invalidated.`))){console.log("Aborted");return}let h=await w(e),{data:t,error:s}=await k(r,{config:h});if(s&&n(e,s),A==="json"){let c=g(e,{id:t.id}),a={action:"rotated",id:t.id,secret:t.newSecret};c.length>0&&(a.nextActions=c),console.log(JSON.stringify(a))}else console.log(` Access Key ID: ${t.id}`),console.log(` New Secret Access Key: ${t.newSecret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again.");l(e),m(e,{id:t.id})}export{x as default};
@@ -1 +1 @@
1
- import{a as C,c as j}from"../../chunk-N3Y6RFSK.js";import{a as B}from"../../chunk-S77OAN6Y.js";import{d as T}from"../../chunk-WJLB362D.js";import{a as t,b as O}from"../../chunk-S6KFKBMY.js";import{b as i,c as x,d as D}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as w,c as v,j as L}from"../../chunk-D7WXNA2O.js";import{d as p,e as g}from"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{createBucket as E}from"@tigrisdata/storage";import F from"enquirer";var{prompt:J}=F,a=L("buckets","create");async function W(e){w(a);let q=O(e),s=t(e,["name"]),b=t(e,["public"])?"public":t(e,["access","a","A"]),d=t(e,["enable-snapshots","enableSnapshots","s","S"]),N=t(e,["allow-object-acl","allowObjectAcl"]),P=t(e,["enable-directory-listing","enableDirectoryListing"]),h=t(e,["default-tier","t","T"]),I=t(e,["locations","l","L"]),o=t(e,["fork-of","forkOf","fork"]),u=t(e,["source-snapshot","sourceSnapshot","source-snap"]),R=!s,S;if(R){B("Provide --name to skip interactive mode");let c=p("buckets","access","create"),n=g(c),f=n?.findIndex(r=>r.value===c?.default),y=p("buckets","default-tier","create"),A=g(y),m=A?.findIndex(r=>r.value===y?.default),l=await J([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:n||[],initial:f!==void 0&&f>=0?f:0},{type:"select",name:"defaultTier",message:"Default storage tier:",choices:A||[],initial:m!==void 0&&m>=0?m:0},{type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}]);s=l.name,b=l.access,h=l.defaultTier,d=l.enableSnapshots;try{S=await C()}catch(r){i(a,r)}}s||i(a,"Bucket name is required"),u&&!o&&i(a,"--source-snapshot requires --fork-of");let{error:k}=await E(s,{defaultTier:h??"STANDARD",enableSnapshot:d===!0,allowObjectAcl:N===!0,enableDirectoryListing:P===!0,access:b??"private",locations:S??j(I??"global"),...o?{sourceBucketName:o}:{},...u?{sourceBucketSnapshot:u}:{},config:await T()});if(k&&i(a,k),q==="json"){let c=x(a,{name:s}),n={action:"created",name:s,...o?{forkOf:o}:{}};c.length>0&&(n.nextActions=c),console.log(JSON.stringify(n))}v(a,{name:s}),D(a,{name:s})}export{W as default};
1
+ import{a as C,c as j}from"../../chunk-N3Y6RFSK.js";import{a as B}from"../../chunk-S77OAN6Y.js";import{e as T}from"../../chunk-AWTU3DRX.js";import{a as t,b as O}from"../../chunk-S6KFKBMY.js";import{b as i,c as x,d as D}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as w,c as v,j as L}from"../../chunk-D7WXNA2O.js";import{d as p,e as g}from"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{createBucket as E}from"@tigrisdata/storage";import F from"enquirer";var{prompt:J}=F,a=L("buckets","create");async function W(e){w(a);let q=O(e),s=t(e,["name"]),b=t(e,["public"])?"public":t(e,["access","a","A"]),d=t(e,["enable-snapshots","enableSnapshots","s","S"]),N=t(e,["allow-object-acl","allowObjectAcl"]),P=t(e,["enable-directory-listing","enableDirectoryListing"]),h=t(e,["default-tier","t","T"]),I=t(e,["locations","l","L"]),o=t(e,["fork-of","forkOf","fork"]),u=t(e,["source-snapshot","sourceSnapshot","source-snap"]),R=!s,S;if(R){B("Provide --name to skip interactive mode");let c=p("buckets","access","create"),n=g(c),f=n?.findIndex(r=>r.value===c?.default),y=p("buckets","default-tier","create"),A=g(y),m=A?.findIndex(r=>r.value===y?.default),l=await J([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:n||[],initial:f!==void 0&&f>=0?f:0},{type:"select",name:"defaultTier",message:"Default storage tier:",choices:A||[],initial:m!==void 0&&m>=0?m:0},{type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}]);s=l.name,b=l.access,h=l.defaultTier,d=l.enableSnapshots;try{S=await C()}catch(r){i(a,r)}}s||i(a,"Bucket name is required"),u&&!o&&i(a,"--source-snapshot requires --fork-of");let{error:k}=await E(s,{defaultTier:h??"STANDARD",enableSnapshot:d===!0,allowObjectAcl:N===!0,enableDirectoryListing:P===!0,access:b??"private",locations:S??j(I??"global"),...o?{sourceBucketName:o}:{},...u?{sourceBucketSnapshot:u}:{},config:await T()});if(k&&i(a,k),q==="json"){let c=x(a,{name:s}),n={action:"created",name:s,...o?{forkOf:o}:{}};c.length>0&&(n.nextActions=c),console.log(JSON.stringify(n))}v(a,{name:s}),D(a,{name:s})}export{W as default};
@@ -1 +1 @@
1
- import{a as x,b as y}from"../../chunk-S77OAN6Y.js";import{d as b}from"../../chunk-WJLB362D.js";import{a as s,b as A}from"../../chunk-S6KFKBMY.js";import{a as p,b as d,c as k,d as h}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as g,d as u,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{removeBucket as N}from"@tigrisdata/storage";var e=l("buckets","delete");async function B(i){f(e);let w=A(i),o=s(i,["name"]),c=s(i,["yes","y","force"]);o||d(e,"Bucket name is required");let a=Array.isArray(o)?o:[o],S=await b();if(!c&&(x("Use --yes to skip confirmation"),!await y(`Delete ${a.length} bucket(s)?`))){console.log("Aborted");return}let m=[],n=[];for(let t of a){let{error:r}=await N(t,{config:S,force:c});r?(u(e,r.message,{name:t}),n.push({name:t,error:r.message})):(m.push(t),g(e,{name:t}))}if(w==="json"){let t=k(e),r={action:"deleted",names:m,errors:n};t.length>0&&(r.nextActions=t),console.log(JSON.stringify(r))}n.length>0&&p(n[0].error,e),h(e)}export{B as default};
1
+ import{a as x,b as y}from"../../chunk-S77OAN6Y.js";import{e as b}from"../../chunk-AWTU3DRX.js";import{a as s,b as A}from"../../chunk-S6KFKBMY.js";import{a as p,b as d,c as k,d as h}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as g,d as u,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{removeBucket as N}from"@tigrisdata/storage";var e=l("buckets","delete");async function B(i){f(e);let w=A(i),o=s(i,["name"]),c=s(i,["yes","y","force"]);o||d(e,"Bucket name is required");let a=Array.isArray(o)?o:[o],S=await b();if(!c&&(x("Use --yes to skip confirmation"),!await y(`Delete ${a.length} bucket(s)?`))){console.log("Aborted");return}let m=[],n=[];for(let t of a){let{error:r}=await N(t,{config:S,force:c});r?(u(e,r.message,{name:t}),n.push({name:t,error:r.message})):(m.push(t),g(e,{name:t}))}if(w==="json"){let t=k(e),r={action:"deleted",names:m,errors:n};t.length>0&&(r.nextActions=t),console.log(JSON.stringify(r))}n.length>0&&p(n[0].error,e),h(e)}export{B as default};
@@ -1 +1 @@
1
- import{e as m}from"../../chunk-WJLB362D.js";import{a as f,b as c}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as s,c as a,j as e}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{disableSnapshot as l}from"@tigrisdata/storage";var o=e("buckets","disable-snapshots");async function d(n){s(o);let g=c(n),t=f(n,["name"]);t||i(o,"Bucket name is required");let p=await m(),{error:r}=await l(t,{config:p});r&&i(o,r),g==="json"&&console.log(JSON.stringify({action:"snapshots-disabled",name:t})),a(o,{name:t})}export{d as default};
1
+ import{f as m}from"../../chunk-AWTU3DRX.js";import{a as f,b as c}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as s,c as a,j as e}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{disableSnapshot as l}from"@tigrisdata/storage";var o=e("buckets","disable-snapshots");async function d(n){s(o);let g=c(n),t=f(n,["name"]);t||i(o,"Bucket name is required");let p=await m(),{error:r}=await l(t,{config:p});r&&i(o,r),g==="json"&&console.log(JSON.stringify({action:"snapshots-disabled",name:t})),a(o,{name:t})}export{d as default};
@@ -1 +1 @@
1
- import{e as m}from"../../chunk-WJLB362D.js";import{a as f,b as c}from"../../chunk-S6KFKBMY.js";import{b as n}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as e,c as a,j as s}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{enableSnapshot as l}from"@tigrisdata/storage";var o=s("buckets","enable-snapshots");async function u(r){e(o);let g=c(r),t=f(r,["name"]);t||n(o,"Bucket name is required");let p=await m(),{error:i}=await l(t,{config:p});i&&n(o,i),g==="json"&&console.log(JSON.stringify({action:"snapshots-enabled",name:t})),a(o,{name:t})}export{u as default};
1
+ import{f as m}from"../../chunk-AWTU3DRX.js";import{a as f,b as c}from"../../chunk-S6KFKBMY.js";import{b as n}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as e,c as a,j as s}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{enableSnapshot as l}from"@tigrisdata/storage";var o=s("buckets","enable-snapshots");async function u(r){e(o);let g=c(r),t=f(r,["name"]);t||n(o,"Bucket name is required");let p=await m(),{error:i}=await l(t,{config:p});i&&n(o,i),g==="json"&&console.log(JSON.stringify({action:"snapshots-enabled",name:t})),a(o,{name:t})}export{u as default};
@@ -1 +1 @@
1
- import{c as s}from"../../chunk-JNSFDQGG.js";import{f as u}from"../../chunk-AFM3TY2D.js";import"../../chunk-N3Y6RFSK.js";import"../../chunk-S77OAN6Y.js";import{d as f}from"../../chunk-WJLB362D.js";import{a as p,b as c}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as i,j as m}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{getBucketInfo as h}from"@tigrisdata/storage";var t=m("buckets","get");async function w(e){a(t);let r=p(e,["name"]),g=c(e);r||o(t,"Bucket name is required");let{data:k,error:n}=await h(r,{config:await f()});n&&o(t,n);let l=[{property:"Name",value:r},...s(k).map(({label:d,value:b})=>({property:d,value:b}))],y=u(l,g,"bucket","property",[{key:"property",header:"Property"},{key:"value",header:"Value"}]);console.log(y),i(t)}export{w as default};
1
+ import{c as s}from"../../chunk-JNSFDQGG.js";import{f as u}from"../../chunk-AFM3TY2D.js";import"../../chunk-N3Y6RFSK.js";import"../../chunk-S77OAN6Y.js";import{e as f}from"../../chunk-AWTU3DRX.js";import{a as p,b as c}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as i,j as m}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{getBucketInfo as h}from"@tigrisdata/storage";var t=m("buckets","get");async function w(e){a(t);let r=p(e,["name"]),g=c(e);r||o(t,"Bucket name is required");let{data:k,error:n}=await h(r,{config:await f()});n&&o(t,n);let l=[{property:"Name",value:r},...s(k).map(({label:d,value:b})=>({property:d,value:b}))],y=u(l,g,"bucket","property",[{key:"property",header:"Property"},{key:"value",header:"Value"}]);console.log(y),i(t)}export{w as default};
@@ -1 +1 @@
1
- import{a as R,b as k,c as b,d as F,e as I,f as c,g as h}from"../../../chunk-BK5P4FHM.js";import"../../../chunk-JNSFDQGG.js";import"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{e as y}from"../../../chunk-WJLB362D.js";import{a as x,b as w}from"../../../chunk-S6KFKBMY.js";import{b as n}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as m,c as p,j as g}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-F4AGJWCK.js";var t=g("buckets lifecycle","create");async function O(r){m(t);let C=w(r),i=x(r,["name"]);i||n(t,"Bucket name is required");let e=R(r),d=k(e);d&&n(t,d);let a=b(e),o=F(e);!a.storageClass&&!o&&n(t,"A new rule must include a transition (--storage-class with --days or --date) and/or an expiration (--expire-days or --expire-date)"),a.storageClass&&e.days===void 0&&e.date===void 0&&n(t,"--storage-class requires --days or --date for a new transition rule");let f=I(e),s=await y(),u=await c(t,i,s),S={...a,...o?{expiration:o}:{},...e.prefix!==void 0?{filter:{prefix:e.prefix}}:{},...f!==void 0?{enabled:f}:{}};await h(t,i,[...u,S],s);let l=(await c(t,i,s)).find(B=>!u.some(E=>E.id===B.id))?.id??"(unknown)";C==="json"&&console.log(JSON.stringify({action:"created",bucket:i,id:l})),p(t,{name:i,id:l})}export{O as default};
1
+ import{a as R,b as k,c as b,d as F,e as I,f as c,g as h}from"../../../chunk-KPEAQ6DK.js";import"../../../chunk-JNSFDQGG.js";import"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{f as y}from"../../../chunk-AWTU3DRX.js";import{a as x,b as w}from"../../../chunk-S6KFKBMY.js";import{b as n}from"../../../chunk-4W44TSLI.js";import"../../../chunk-AWUW4BD3.js";import"../../../chunk-IHMIXWMY.js";import"../../../chunk-DV3LCXRH.js";import{b as m,c as p,j as g}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-F4AGJWCK.js";var t=g("buckets lifecycle","create");async function O(r){m(t);let C=w(r),i=x(r,["name"]);i||n(t,"Bucket name is required");let e=R(r),d=k(e);d&&n(t,d);let a=b(e),o=F(e);!a.storageClass&&!o&&n(t,"A new rule must include a transition (--storage-class with --days or --date) and/or an expiration (--expire-days or --expire-date)"),a.storageClass&&e.days===void 0&&e.date===void 0&&n(t,"--storage-class requires --days or --date for a new transition rule");let f=I(e),s=await y(),u=await c(t,i,s),S={...a,...o?{expiration:o}:{},...e.prefix!==void 0?{filter:{prefix:e.prefix}}:{},...f!==void 0?{enabled:f}:{}};await h(t,i,[...u,S],s);let l=(await c(t,i,s)).find(B=>!u.some(E=>E.id===B.id))?.id??"(unknown)";C==="json"&&console.log(JSON.stringify({action:"created",bucket:i,id:l})),p(t,{name:i,id:l})}export{O as default};
@@ -1 +1 @@
1
- import{a as C,b as R,c as k,d as F,e as S,f as q,g as w}from"../../../chunk-BK5P4FHM.js";import"../../../chunk-JNSFDQGG.js";import"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{e as b}from"../../../chunk-WJLB362D.js";import{a as c,b as x}from"../../../chunk-S6KFKBMY.js";import{b as t}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as p,c as y,j as h}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-F4AGJWCK.js";var i=h("buckets lifecycle","edit");async function E(o){p(i);let T=x(o),n=c(o,["name"]),s=c(o,["id"]);n||t(i,"Bucket name is required"),s||t(i,"Rule id is required");let e=C(o),l=R(e,{requireStorageClassForTiming:!1});l&&t(i,l);let d=k(e),f=F(e),u=S(e);d.storageClass!==void 0||d.days!==void 0||d.date!==void 0||f!==void 0||u!==void 0||e.prefix!==void 0||t(i,"Provide at least one field to change (--storage-class, --days, --date, --expire-days, --expire-date, --prefix, --enable, --disable)");let g=await b(),m=await q(i,n,g),r=m.find(a=>a.id===s);if(r||t(i,`No lifecycle rule with id "${s}" found. Run \`tigris buckets lifecycle list ${n}\` to see ids.`),e.storageClass!==void 0||e.days!==void 0||e.date!==void 0){let a=d.storageClass??r.storageClass,B=e.days!==void 0?Number(e.days):e.date!==void 0?void 0:r.days,D=e.date!==void 0?e.date:e.days!==void 0?void 0:r.date;a||t(i,"--storage-class is required (this rule has no existing transition target)"),B===void 0&&D===void 0&&t(i,"--days or --date is required (this rule has no existing transition timing)")}let I={...r,...d,...f?{expiration:f}:{},...e.prefix!==void 0?{filter:{prefix:e.prefix}}:{},...u!==void 0?{enabled:u}:{}},v=m.map(a=>a.id===s?I:a);await w(i,n,v,g),T==="json"&&console.log(JSON.stringify({action:"updated",bucket:n,id:s})),y(i,{name:n,id:s})}export{E as default};
1
+ import{a as C,b as R,c as k,d as F,e as S,f as q,g as w}from"../../../chunk-KPEAQ6DK.js";import"../../../chunk-JNSFDQGG.js";import"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{f as b}from"../../../chunk-AWTU3DRX.js";import{a as c,b as x}from"../../../chunk-S6KFKBMY.js";import{b as t}from"../../../chunk-4W44TSLI.js";import"../../../chunk-AWUW4BD3.js";import"../../../chunk-IHMIXWMY.js";import"../../../chunk-DV3LCXRH.js";import{b as p,c as y,j as h}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-F4AGJWCK.js";var i=h("buckets lifecycle","edit");async function E(o){p(i);let T=x(o),n=c(o,["name"]),s=c(o,["id"]);n||t(i,"Bucket name is required"),s||t(i,"Rule id is required");let e=C(o),l=R(e,{requireStorageClassForTiming:!1});l&&t(i,l);let d=k(e),f=F(e),u=S(e);d.storageClass!==void 0||d.days!==void 0||d.date!==void 0||f!==void 0||u!==void 0||e.prefix!==void 0||t(i,"Provide at least one field to change (--storage-class, --days, --date, --expire-days, --expire-date, --prefix, --enable, --disable)");let g=await b(),m=await q(i,n,g),r=m.find(a=>a.id===s);if(r||t(i,`No lifecycle rule with id "${s}" found. Run \`tigris buckets lifecycle list ${n}\` to see ids.`),e.storageClass!==void 0||e.days!==void 0||e.date!==void 0){let a=d.storageClass??r.storageClass,B=e.days!==void 0?Number(e.days):e.date!==void 0?void 0:r.days,D=e.date!==void 0?e.date:e.days!==void 0?void 0:r.date;a||t(i,"--storage-class is required (this rule has no existing transition target)"),B===void 0&&D===void 0&&t(i,"--days or --date is required (this rule has no existing transition timing)")}let I={...r,...d,...f?{expiration:f}:{},...e.prefix!==void 0?{filter:{prefix:e.prefix}}:{},...u!==void 0?{enabled:u}:{}},v=m.map(a=>a.id===s?I:a);await w(i,n,v,g),T==="json"&&console.log(JSON.stringify({action:"updated",bucket:n,id:s})),y(i,{name:n,id:s})}export{E as default};
@@ -1 +1 @@
1
- import{h,i as b}from"../../../chunk-BK5P4FHM.js";import"../../../chunk-JNSFDQGG.js";import{b as x,d as y,e as k}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{d as g}from"../../../chunk-WJLB362D.js";import{a as u,b as d}from"../../../chunk-S6KFKBMY.js";import{b as r}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as m,e as c,j as p}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-F4AGJWCK.js";import{getBucketInfo as T}from"@tigrisdata/storage";var e=p("buckets lifecycle","list");async function w(n){f(e);let a=u(n,["name"]),s=d(n);a||r(e,"Bucket name is required");let{data:C,error:l}=await T(a,{config:await g()});l&&r(e,l);let o=C?.settings.lifecycleRules??[];if(o.length===0){c(e);return}let i=o.map(t=>({id:t.id??"-",prefix:t.filter?.prefix??"-",transition:h(t),expiration:b(t),status:t.enabled===!1?"disabled":"enabled"}));console.log(s==="json"?x(i):s==="xml"?y(i,"lifecycleRules","rule"):k(i,[{key:"id",header:"ID"},{key:"prefix",header:"Prefix"},{key:"transition",header:"Transition"},{key:"expiration",header:"Expiration"},{key:"status",header:"Status"}])),m(e,{count:o.length})}export{w as default};
1
+ import{h,i as b}from"../../../chunk-KPEAQ6DK.js";import"../../../chunk-JNSFDQGG.js";import{b as x,d as y,e as k}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{e as g}from"../../../chunk-AWTU3DRX.js";import{a as u,b as d}from"../../../chunk-S6KFKBMY.js";import{b as r}from"../../../chunk-4W44TSLI.js";import"../../../chunk-AWUW4BD3.js";import"../../../chunk-IHMIXWMY.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as m,e as c,j as p}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-F4AGJWCK.js";import{getBucketInfo as T}from"@tigrisdata/storage";var e=p("buckets lifecycle","list");async function w(n){f(e);let a=u(n,["name"]),s=d(n);a||r(e,"Bucket name is required");let{data:C,error:l}=await T(a,{config:await g()});l&&r(e,l);let o=C?.settings.lifecycleRules??[];if(o.length===0){c(e);return}let i=o.map(t=>({id:t.id??"-",prefix:t.filter?.prefix??"-",transition:h(t),expiration:b(t),status:t.enabled===!1?"disabled":"enabled"}));console.log(s==="json"?x(i):s==="xml"?y(i,"lifecycleRules","rule"):k(i,[{key:"id",header:"ID"},{key:"prefix",header:"Prefix"},{key:"transition",header:"Transition"},{key:"expiration",header:"Expiration"},{key:"status",header:"Status"}])),m(e,{count:o.length})}export{w as default};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i}from"../../../chunk-BK5P4FHM.js";import"../../../chunk-JNSFDQGG.js";import"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-S6KFKBMY.js";import"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";export{e as enabledFromInput,d as expirationFromInput,f as fetchExistingRules,i as formatExpirationCell,h as formatTransitionCell,a as readRuleInput,g as submitRules,c as transitionDeltaFromInput,b as validateRuleFieldCombinations};
1
+ import{a,b,c,d,e,f,g,h,i}from"../../../chunk-KPEAQ6DK.js";import"../../../chunk-JNSFDQGG.js";import"../../../chunk-AFM3TY2D.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-S6KFKBMY.js";import"../../../chunk-4W44TSLI.js";import"../../../chunk-AWUW4BD3.js";import"../../../chunk-IHMIXWMY.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";export{e as enabledFromInput,d as expirationFromInput,f as fetchExistingRules,i as formatExpirationCell,h as formatTransitionCell,a as readRuleInput,g as submitRules,c as transitionDeltaFromInput,b as validateRuleFieldCombinations};
@@ -1 +1 @@
1
- import{g as l}from"../../chunk-AFM3TY2D.js";import{d as j}from"../../chunk-WJLB362D.js";import{a as g,b as P,c as S}from"../../chunk-S6KFKBMY.js";import{b as m}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as D,c as d,e as k,i as u,j as E}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{listBuckets as A,listForks as B}from"@tigrisdata/storage";var e=E("buckets","list");async function H(o){D(e);let n=P(o),s=g(o,["forks-of","forksOf"]),c=g(o,["deleted"]),{limit:r,pageToken:i}=S(o),p=await j();s&&c&&console.warn("\u26A0 --deleted is ignored when --forks-of is used; use --deleted on its own to list soft-deleted buckets");let b=[{key:"name",header:"Name"},{key:"created",header:"Created"}];if(s){let{data:t,error:x}=await B(s,{...r!==void 0?{limit:r}:{},...i?{paginationToken:i}:{},config:p});if(x&&m(e,x),!t.forks||t.forks.length===0){k(e);return}let f=[];for(let O of t.forks)f.push({name:O.name,created:O.creationDate});let y=t.paginationToken||void 0,F=l(f,n,"forks","fork",b,{paginationToken:y});console.log(F),n!=="json"&&n!=="xml"&&u(y),d(e,{count:f.length});return}let{data:a,error:h}=await A({...r!==void 0?{limit:r}:{},...i?{paginationToken:i}:{},...c?{deleted:c}:{},config:p});if(h&&m(e,h),!a.buckets||a.buckets.length===0){k(e);return}let T=a.buckets.map(t=>({name:t.name,created:t.creationDate})),w=a.paginationToken||void 0,C=l(T,n,"buckets","bucket",b,{paginationToken:w});console.log(C),n!=="json"&&n!=="xml"&&u(w),d(e,{count:T.length})}export{H as default};
1
+ import{g as l}from"../../chunk-AFM3TY2D.js";import{e as j}from"../../chunk-AWTU3DRX.js";import{a as g,b as P,c as S}from"../../chunk-S6KFKBMY.js";import{b as m}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as D,c as d,e as k,i as u,j as E}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{listBuckets as A,listForks as B}from"@tigrisdata/storage";var e=E("buckets","list");async function H(o){D(e);let n=P(o),s=g(o,["forks-of","forksOf"]),c=g(o,["deleted"]),{limit:r,pageToken:i}=S(o),p=await j();s&&c&&console.warn("\u26A0 --deleted is ignored when --forks-of is used; use --deleted on its own to list soft-deleted buckets");let b=[{key:"name",header:"Name"},{key:"created",header:"Created"}];if(s){let{data:t,error:x}=await B(s,{...r!==void 0?{limit:r}:{},...i?{paginationToken:i}:{},config:p});if(x&&m(e,x),!t.forks||t.forks.length===0){k(e);return}let f=[];for(let O of t.forks)f.push({name:O.name,created:O.creationDate});let y=t.paginationToken||void 0,F=l(f,n,"forks","fork",b,{paginationToken:y});console.log(F),n!=="json"&&n!=="xml"&&u(y),d(e,{count:f.length});return}let{data:a,error:h}=await A({...r!==void 0?{limit:r}:{},...i?{paginationToken:i}:{},...c?{deleted:c}:{},config:p});if(h&&m(e,h),!a.buckets||a.buckets.length===0){k(e);return}let T=a.buckets.map(t=>({name:t.name,created:t.creationDate})),w=a.paginationToken||void 0,C=l(T,n,"buckets","bucket",b,{paginationToken:w});console.log(C),n!=="json"&&n!=="xml"&&u(w),d(e,{count:T.length})}export{H as default};
@@ -1 +1 @@
1
- import{a as b,b as S}from"../../chunk-S77OAN6Y.js";import{d as x}from"../../chunk-WJLB362D.js";import{a as c,b as w}from"../../chunk-S6KFKBMY.js";import{b as s,c as h,d as l}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as k,c as p,j as d}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{getBucketInfo as $,mergeFork as F}from"@tigrisdata/storage";var r=d("buckets","merge");async function I(n){k(r);let y=w(n),o=c(n,["fork"]),t=c(n,["into","source"]),f=c(n,["from-snapshot","fromSnapshot","from-snap"]),A=c(n,["yes","y"]);o||s(r,"Fork bucket name is required");let a=await x();if(!t){let{data:e,error:i}=await $(o,{config:a});i&&s(r,i);let u=e?.forkInfo?.parents?.[0]?.bucketName;u||s(r,`'${o}' is not a fork or its source bucket could not be determined. Pass --into <source-bucket>.`),t=u}if(!A&&(b("Use --yes to skip confirmation"),!await S(`Merge fork '${o}' into source '${t}'? This writes the fork's changes into '${t}'.`))){console.log("Aborted");return}let{data:N,error:m}=await F(o,t,{...f?{forkSnapshot:f}:{},config:a});m&&s(r,m);let g=N?.snapshotVersion??"";if(y==="json"){let e=h(r,{fork:o,into:t}),i={action:"merged",fork:o,into:t,snapshotVersion:g};e.length>0&&(i.nextActions=e),console.log(JSON.stringify(i))}p(r,{fork:o,into:t,snapshotVersion:g}),l(r,{fork:o,into:t})}export{I as default};
1
+ import{a as b,b as S}from"../../chunk-S77OAN6Y.js";import{e as x}from"../../chunk-AWTU3DRX.js";import{a as c,b as w}from"../../chunk-S6KFKBMY.js";import{b as s,c as h,d as l}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as k,c as p,j as d}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{getBucketInfo as $,mergeFork as F}from"@tigrisdata/storage";var r=d("buckets","merge");async function I(n){k(r);let y=w(n),o=c(n,["fork"]),t=c(n,["into","source"]),f=c(n,["from-snapshot","fromSnapshot","from-snap"]),A=c(n,["yes","y"]);o||s(r,"Fork bucket name is required");let a=await x();if(!t){let{data:e,error:i}=await $(o,{config:a});i&&s(r,i);let u=e?.forkInfo?.parents?.[0]?.bucketName;u||s(r,`'${o}' is not a fork or its source bucket could not be determined. Pass --into <source-bucket>.`),t=u}if(!A&&(b("Use --yes to skip confirmation"),!await S(`Merge fork '${o}' into source '${t}'? This writes the fork's changes into '${t}'.`))){console.log("Aborted");return}let{data:N,error:m}=await F(o,t,{...f?{forkSnapshot:f}:{},config:a});m&&s(r,m);let g=N?.snapshotVersion??"";if(y==="json"){let e=h(r,{fork:o,into:t}),i={action:"merged",fork:o,into:t,snapshotVersion:g};e.length>0&&(i.nextActions=e),console.log(JSON.stringify(i))}p(r,{fork:o,into:t,snapshotVersion:g}),l(r,{fork:o,into:t})}export{I as default};
@@ -1,6 +1,6 @@
1
- import{a as F}from"../../chunk-SAAGVLRE.js";import{a as m}from"../../chunk-AFM3TY2D.js";import{e as O}from"../../chunk-7ZCVOA6A.js";import{d as E}from"../../chunk-WJLB362D.js";import{a as B}from"../../chunk-S6KFKBMY.js";import{b as M}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{d as v,j as x}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{isMigrated as J,list as G,migrate as H}from"@tigrisdata/storage";var S=x("buckets","migrate"),z=10*1024*1024*1024,C=1e3,y=50,D=5e3,Y=3e4,j=50,R=3,A=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],K=250;function X(e){return e.sort((r,t)=>r.size-t.size),e}function U(e,r){return e.inFlight.length>=C?!0:e.inFlightBytes+r>z&&e.inFlight.length>0}function V(e,r,t,a){return r===0?!1:r>=j||e.inFlight.length+r>=C||e.inFlightBytes+t+a>z}function q(e){let r=null;for(let t of e)(r===null||t.scheduledAt<r.scheduledAt)&&(r=t);return r}function W(e,r,t=40){return e?`migrating ${e.name.length>t?`\u2026${e.name.slice(-Math.max(1,t-1))}`:e.name} (${m(e.size)}, waiting ${$(r-e.scheduledAt)})`:"waiting\u2026"}var _=class{constructor(r,t,a,i){this.bucket=r;this.source=t;this.prefix=a;this.config=i}bucket;source;prefix;config;buffer=[];index=0;token;_done=!1;get done(){return this._done&&this.index>=this.buffer.length}async current(){return this.index<this.buffer.length?this.buffer[this.index]:this._done?null:(await this.fetchPage(),this.index<this.buffer.length?this.buffer[this.index]:null)}advance(){this.index++}async fetchPage(){if(this._done)return;let{data:r,error:t}=await G({prefix:this.prefix,source:this.source,...this.token?{paginationToken:this.token}:{},config:{...this.config,bucket:this.bucket}});if(t)throw t;this.buffer=r.items??[],this.index=0,this.token=r.paginationToken,!r.paginationToken&&!r.hasMore&&(this._done=!0)}};async function Z(e,r,t,a){let i=new _(e,"shadow",r,t),n=new _(e,"tigris",r,t),c=[],s=await i.current(),l=await n.current();for(;s!==null&&!a?.aborted;){if(l===null){c.push({name:s.name,size:s.size}),i.advance(),s=await i.current();continue}s.name<l.name?(c.push({name:s.name,size:s.size}),i.advance(),s=await i.current()):s.name>l.name?(n.advance(),l=await n.current()):(i.advance(),n.advance(),s=await i.current(),l=await n.current())}return c}function Q(e,r){return new Promise(t=>{if(r?.aborted){t();return}let a=setTimeout(()=>{r?.removeEventListener("abort",i),t()},e);function i(){clearTimeout(a),t()}r?.addEventListener("abort",i,{once:!0})})}function $(e){let r=Math.floor(e/1e3),t=Math.floor(r/60),a=r%60;return t===0?`${a}s`:`${t}m ${a}s`}function ee(e,r){let t=Date.now();e.spinnerFrame=(e.spinnerFrame+1)%A.length;let a=A[e.spinnerFrame],i=e.total>0?Math.floor(e.confirmed/e.total*100):0,n=e.totalBytes>0?Math.floor(e.confirmedBytes/e.totalBytes*100):0,c=$(t-e.startTime),s=q(e.inFlight),l=process.stderr.columns??80;return[`${a} Migrating ${r} \xB7 ${c} elapsed`,` ${e.confirmed.toLocaleString()} / ${e.total.toLocaleString()} files (${i}%) \xB7 ${m(e.confirmedBytes)} / ${m(e.totalBytes)} (${n}%)`,` ${W(s,t,Math.max(20,l-45))} \xB7 in-flight ${e.inFlight.length.toLocaleString()} (${m(e.inFlightBytes)})`]}var h=0;function re(e,r){if(!process.stderr.isTTY||globalThis.__TIGRIS_JSON_MODE)return;let t=process.stderr.columns??80,a=ee(e,r).map(n=>n.length>t?`${n.slice(0,Math.max(1,t-1))}\u2026`:n),i="";h>0&&(i+=`\x1B[${h}A`),i+="\x1B[0J",i+=`${a.join(`
1
+ import{a as x}from"../../chunk-SAAGVLRE.js";import{a as u}from"../../chunk-AFM3TY2D.js";import{e as L}from"../../chunk-7ZCVOA6A.js";import{e as O}from"../../chunk-AWTU3DRX.js";import{a as B}from"../../chunk-S6KFKBMY.js";import{b as S}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{d as v,j as E}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{isMigrated as P,list as H,migrate as Y}from"@tigrisdata/storage";var M=E("buckets","migrate"),D=10*1024*1024*1024,G=1e3,$=50,J=5e3,j=3e4,q=50,R=3,K=10,A=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],U=250;function X(e){return e.sort((r,t)=>r.size-t.size),e}function V(e,r){return e.inFlight.length>=G?!0:e.inFlightBytes+r>D&&e.inFlight.length>0}function W(e,r,t,s){return r===0?!1:r>=q||e.inFlight.length+r>=G||e.inFlightBytes+t+s>D}function Z(e){return[...e].sort((r,t)=>r.scheduledAt-t.scheduledAt||(r.name<t.name?-1:r.name>t.name?1:0))}function Q(e,r){let t=Z(e),s=Math.min(K,Math.max(1,r));if(t.length<=s)return{shown:t,hidden:[]};let n=Math.max(0,s-1);return{shown:t.slice(0,n),hidden:t.slice(n)}}var N=9,ee=15;function te(e,r,t){let s=Math.max(8,t-4-2-N-2-ee),n=e.name.length>s?`\u2026${e.name.slice(-Math.max(1,s-1))}`:e.name.padEnd(s),i=u(e.size).padStart(N),a=`queued ${k(r-e.scheduledAt)}`;return` ${n} ${i} ${a}`}var _=class{constructor(r,t,s,n){this.bucket=r;this.source=t;this.prefix=s;this.config=n}bucket;source;prefix;config;buffer=[];index=0;token;_done=!1;get done(){return this._done&&this.index>=this.buffer.length}async current(){return this.index<this.buffer.length?this.buffer[this.index]:this._done?null:(await this.fetchPage(),this.index<this.buffer.length?this.buffer[this.index]:null)}advance(){this.index++}async fetchPage(){if(this._done)return;let{data:r,error:t}=await H({prefix:this.prefix,source:this.source,...this.token?{paginationToken:this.token}:{},config:{...this.config,bucket:this.bucket}});if(t)throw t;this.buffer=r.items??[],this.index=0,this.token=r.paginationToken,!r.paginationToken&&!r.hasMore&&(this._done=!0)}};async function re(e,r,t,s){let n=new _(e,"shadow",r,t),i=new _(e,"tigris",r,t),a=[],c=await n.current(),l=await i.current();for(;c!==null&&!s?.aborted;){if(l===null){a.push({name:c.name,size:c.size}),n.advance(),c=await n.current();continue}c.name<l.name?(a.push({name:c.name,size:c.size}),n.advance(),c=await n.current()):c.name>l.name?(i.advance(),l=await i.current()):(n.advance(),i.advance(),c=await n.current(),l=await i.current())}return a}function ne(e,r){return new Promise(t=>{if(r?.aborted){t();return}let s=setTimeout(()=>{r?.removeEventListener("abort",n),t()},e);function n(){clearTimeout(s),t()}r?.addEventListener("abort",n,{once:!0})})}function k(e){let r=Math.floor(e/1e3),t=Math.floor(r/60),s=r%60;return t===0?`${s}s`:`${t}m ${s}s`}function ie(e,r){let t=Date.now();e.spinnerFrame=(e.spinnerFrame+1)%A.length;let s=A[e.spinnerFrame],n=k(t-e.startTime),i=process.stderr.columns??80,a=[`${s} Migrating ${r} \xB7 ${n} elapsed`,` ${e.confirmed.toLocaleString()} / ${e.total.toLocaleString()} files done \xB7 ${e.failed.toLocaleString()} failed \xB7 ${u(e.confirmedBytes)} confirmed, ${u(e.inFlightBytes)} in flight`],c=e.inFlight.length;if(c===0)return a.push(" 0 in flight"),a;let l=Math.max(1,(process.stderr.rows??24)-1-3),{shown:f,hidden:g}=Q(e.inFlight,l);a.push(g.length===0?` ${c.toLocaleString()} in flight:`:` ${c.toLocaleString()} in flight (showing ${f.length} longest-queued):`);for(let d of f)a.push(te(d,t,i));if(g.length>0){let d=g.reduce((b,T)=>b+T.size,0);a.push(` + ${g.length.toLocaleString()} more in flight (${u(d)})`)}return a}var p=0;function oe(e,r){if(!process.stderr.isTTY||globalThis.__TIGRIS_JSON_MODE)return;let t=process.stderr.columns??80,s=ie(e,r).map(i=>i.length>t?`${i.slice(0,Math.max(1,t-1))}\u2026`:i),n="";p>0&&(n+=`\x1B[${p}A`),n+="\x1B[0J",n+=`${s.join(`
2
2
  `)}
3
- `,h=a.length,process.stderr.write(i)}function b(){if(!(!process.stderr.isTTY||globalThis.__TIGRIS_JSON_MODE)){if(h>0){process.stderr.write(`\x1B[${h}A\x1B[0J`),h=0;return}process.stderr.write("\r\x1B[K")}}async function L(e,r,t,a){let i=await F(e.map(n=>()=>H(n.name,{config:{...t,bucket:a}})),y);for(let n=0;n<i.length;n++){let c=i[n],s=e[n];c.error?(r.failed++,r.errors.push({name:s.name,error:c.error.message})):(r.inFlight.push({...s,checkFailures:0,scheduledAt:Date.now()}),r.inFlightBytes+=s.size,r.scheduled++)}}async function N(e,r,t,a){let i=e.inFlight.length;if(i===0)return;let n=e.drainOffset%i,c=[];for(let d=0;d<Math.min(y,i);d++)c.push(e.inFlight[(n+d)%i]);e.drainOffset=n+c.length;let s=await F(c.map(d=>()=>J(d.name,{config:{...r,bucket:t}})),y),l=new Set;for(let d=0;d<s.length;d++){let p=s[d],f=c[d];p.error?(f.checkFailures++,f.checkFailures>=R&&(l.add(f.name),e.failed++,e.inFlightBytes-=f.size,e.errors.push({name:f.name,error:`Failed to verify migration status after ${R} attempts`}))):p.data&&(l.add(f.name),e.confirmed++,e.confirmedBytes+=f.size,e.inFlightBytes-=f.size)}if(l.size>0){e.inFlight=e.inFlight.filter(d=>!l.has(d.name)),e.drainSweepMisses=0,e.checkBackoffMs=D;return}e.drainSweepMisses+=c.length,e.drainSweepMisses>=i&&(e.drainSweepMisses=0,await Q(e.checkBackoffMs,a),e.checkBackoffMs=Math.min(e.checkBackoffMs*2,Y))}async function te(e){let r=B(e,["path"]);r||M(S,"Bucket name or path is required");let{bucket:t,path:a}=O(r);t||M(S,"Invalid path");let i=await E(),n=!1,c,s=new AbortController,l=()=>{c&&(clearInterval(c),c=void 0)},d=()=>{n&&process.exit(130),n=!0,s.abort(),l(),b()};process.on("SIGINT",d);let p=()=>{b()};process.stderr.on("resize",p);try{process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&process.stderr.write("Discovering objects to migrate...");let f;try{f=await Z(t,a,i,s.signal)}catch(g){b(),M(S,g)}if(b(),n&&(console.error(`
4
- Cancelled.`),process.exit(1)),f.length===0){process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&console.error("All objects are already migrated."),globalThis.__TIGRIS_JSON_MODE&&console.log(JSON.stringify({action:"migrate",bucket:t,toMigrate:0,confirmed:0,failed:0}));return}let k=f.reduce((g,I)=>g+I.size,0);process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&console.error(`Found ${f.length.toLocaleString()} objects to migrate (${m(k)})`),X(f);let P=Date.now(),o={total:f.length,totalBytes:k,scheduled:0,confirmed:0,confirmedBytes:0,failed:0,inFlight:[],inFlightBytes:0,drainOffset:0,drainSweepMisses:0,checkBackoffMs:D,spinnerFrame:0,errors:[],startTime:P};process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&(c=setInterval(()=>re(o,t),K),c.unref?.());let u=[],w=0;for(let g of f){if(n)break;for(V(o,u.length,w,g.size)&&(await L(u,o,i,t),u=[],w=0);U(o,g.size)&&!n;)await N(o,i,t,s.signal);if(n)break;u.push(g),w+=g.size}for(u.length>0&&!n&&await L(u,o,i,t);o.inFlight.length>0&&!n;)await N(o,i,t,s.signal);l(),b();let T=$(Date.now()-o.startTime);if(globalThis.__TIGRIS_JSON_MODE&&console.log(JSON.stringify({action:"migrate",bucket:t,toMigrate:o.total,scheduled:o.scheduled,confirmed:o.confirmed,failed:o.failed,elapsed:T,...o.errors.length>0?{errors:o.errors.slice(0,20)}:{}})),n&&(console.error(`
5
- Cancelled \u2014 ${o.confirmed.toLocaleString()} confirmed, ${o.inFlight.length.toLocaleString()} queued for migration, ${(o.total-o.scheduled).toLocaleString()} not scheduled. Re-run migrate to resume.`),process.exit(1)),o.failed>0){if(v(S,`${o.failed} object(s) failed to migrate. ${o.confirmed} migrated successfully in ${T}.`),process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&o.errors.length>0){let g=o.errors.slice(0,10);for(let I of g)console.error(` ${I.name}: ${I.error}`);o.errors.length>10&&console.error(` ... and ${o.errors.length-10} more`)}process.exit(1)}console.error(`
6
- Migration complete: ${o.confirmed.toLocaleString()} object(s) migrated (${m(o.confirmedBytes)}) in ${T}`)}finally{l(),process.removeListener("SIGINT",d),process.stderr.removeListener("resize",p)}}export{W as activityLabel,U as atCapacity,te as default,N as drainCompleted,q as oldestInFlight,X as orderForMigration,V as shouldFlushBatch};
3
+ `,p=s.length,process.stderr.write(n)}function I(){if(!(!process.stderr.isTTY||globalThis.__TIGRIS_JSON_MODE)){if(p>0){process.stderr.write(`\x1B[${p}A\x1B[0J`),p=0;return}process.stderr.write("\r\x1B[K")}}async function z(e,r,t,s){let n=await x(e.map(i=>async()=>({result:await Y(i.name,{config:{...t,bucket:s}}),scheduledAt:Date.now()})),$);for(let i=0;i<n.length;i++){let{result:a,scheduledAt:c}=n[i],l=e[i];a.error?(r.failed++,r.errors.push({name:l.name,error:a.error.message})):(r.inFlight.push({...l,checkFailures:0,scheduledAt:c}),r.inFlightBytes+=l.size,r.scheduled++)}}async function C(e,r,t,s){let n=e.inFlight.length;if(n===0)return;let i=e.drainOffset%n,a=[];for(let f=0;f<Math.min($,n);f++)a.push(e.inFlight[(i+f)%n]);e.drainOffset=i+a.length;let c=await x(a.map(f=>()=>P(f.name,{config:{...r,bucket:t}})),$),l=new Set;for(let f=0;f<c.length;f++){let g=c[f],d=a[f];g.error?(d.checkFailures++,d.checkFailures>=R&&(l.add(d.name),e.failed++,e.inFlightBytes-=d.size,e.errors.push({name:d.name,error:`Failed to verify migration status after ${R} attempts`}))):g.data&&(l.add(d.name),e.confirmed++,e.confirmedBytes+=d.size,e.inFlightBytes-=d.size)}if(l.size>0){e.inFlight=e.inFlight.filter(f=>!l.has(f.name)),e.drainSweepMisses=0,e.checkBackoffMs=J;return}e.drainSweepMisses+=a.length,e.drainSweepMisses>=n&&(e.drainSweepMisses=0,await ne(e.checkBackoffMs,s),e.checkBackoffMs=Math.min(e.checkBackoffMs*2,j))}async function se(e){let r=B(e,["path"]);r||S(M,"Bucket name or path is required");let{bucket:t,path:s}=L(r);t||S(M,"Invalid path");let n=await O(),i=!1,a,c=new AbortController,l=()=>{a&&(clearInterval(a),a=void 0)},f=()=>{i&&process.exit(130),i=!0,c.abort(),l(),I()};process.on("SIGINT",f);let g=()=>{I()};process.stderr.on("resize",g);try{process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&process.stderr.write("Discovering objects to migrate...");let d;try{d=await re(t,s,n,c.signal)}catch(h){I(),S(M,h)}if(I(),i&&(console.error(`
4
+ Cancelled.`),process.exit(1)),d.length===0){process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&console.error("All objects are already migrated."),globalThis.__TIGRIS_JSON_MODE&&console.log(JSON.stringify({action:"migrate",bucket:t,toMigrate:0,confirmed:0,failed:0}));return}let b=d.reduce((h,w)=>h+w.size,0);process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&console.error(`Found ${d.length.toLocaleString()} objects to migrate (${u(b)})`),X(d);let T=Date.now(),o={total:d.length,totalBytes:b,scheduled:0,confirmed:0,confirmedBytes:0,failed:0,inFlight:[],inFlightBytes:0,drainOffset:0,drainSweepMisses:0,checkBackoffMs:J,spinnerFrame:0,errors:[],startTime:T};process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&(a=setInterval(()=>oe(o,t),U),a.unref?.());let m=[],F=0;for(let h of d){if(i)break;for(W(o,m.length,F,h.size)&&(await z(m,o,n,t),m=[],F=0);V(o,h.size)&&!i;)await C(o,n,t,c.signal);if(i)break;m.push(h),F+=h.size}for(m.length>0&&!i&&await z(m,o,n,t);o.inFlight.length>0&&!i;)await C(o,n,t,c.signal);l(),I();let y=k(Date.now()-o.startTime);if(globalThis.__TIGRIS_JSON_MODE&&console.log(JSON.stringify({action:"migrate",bucket:t,toMigrate:o.total,scheduled:o.scheduled,confirmed:o.confirmed,failed:o.failed,elapsed:y,...o.errors.length>0?{errors:o.errors.slice(0,20)}:{}})),i&&(console.error(`
5
+ Cancelled \u2014 ${o.confirmed.toLocaleString()} confirmed, ${o.inFlight.length.toLocaleString()} queued for migration, ${(o.total-o.scheduled).toLocaleString()} not scheduled. Re-run migrate to resume.`),process.exit(1)),o.failed>0){if(v(M,`${o.failed} object(s) failed to migrate. ${o.confirmed} migrated successfully in ${y}.`),process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&o.errors.length>0){let h=o.errors.slice(0,10);for(let w of h)console.error(` ${w.name}: ${w.error}`);o.errors.length>10&&console.error(` ... and ${o.errors.length-10} more`)}process.exit(1)}console.error(`
6
+ Migration complete: ${o.confirmed.toLocaleString()} object(s) migrated (${u(o.confirmedBytes)}) in ${y}`)}finally{l(),process.removeListener("SIGINT",f),process.stderr.removeListener("resize",g)}}export{V as atCapacity,se as default,C as drainCompleted,z as flushScheduleBatch,te as formatInFlightRow,Q as inFlightView,Z as orderForDisplay,X as orderForMigration,W as shouldFlushBatch};
@@ -1 +1 @@
1
- import{a as k,b}from"../../chunk-S77OAN6Y.js";import{d as l}from"../../chunk-WJLB362D.js";import{a as s,b as d}from"../../chunk-S6KFKBMY.js";import{b as n,c as g,d as p}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as m,j as u}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{rebaseFork as A}from"@tigrisdata/storage";var o=u("buckets","rebase");async function S(r){f(o);let h=d(r),t=s(r,["fork"]),x=s(r,["yes","y"]);t||n(o,"Fork bucket name is required");let w=await l();if(!x&&(k("Use --yes to skip confirmation"),!await b(`Rebase fork '${t}' onto the latest state of its source bucket? This updates '${t}'.`))){console.log("Aborted");return}let{data:y,error:i}=await A(t,{config:w});i&&n(o,i);let c=y?.snapshotVersion??"";if(h==="json"){let e=g(o,{fork:t}),a={action:"rebased",fork:t,snapshotVersion:c};e.length>0&&(a.nextActions=e),console.log(JSON.stringify(a))}m(o,{fork:t,snapshotVersion:c}),p(o,{fork:t})}export{S as default};
1
+ import{a as k,b}from"../../chunk-S77OAN6Y.js";import{e as l}from"../../chunk-AWTU3DRX.js";import{a as s,b as d}from"../../chunk-S6KFKBMY.js";import{b as n,c as g,d as p}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as m,j as u}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{rebaseFork as A}from"@tigrisdata/storage";var o=u("buckets","rebase");async function S(r){f(o);let h=d(r),t=s(r,["fork"]),x=s(r,["yes","y"]);t||n(o,"Fork bucket name is required");let w=await l();if(!x&&(k("Use --yes to skip confirmation"),!await b(`Rebase fork '${t}' onto the latest state of its source bucket? This updates '${t}'.`))){console.log("Aborted");return}let{data:y,error:i}=await A(t,{config:w});i&&n(o,i);let c=y?.snapshotVersion??"";if(h==="json"){let e=g(o,{fork:t}),a={action:"rebased",fork:t,snapshotVersion:c};e.length>0&&(a.nextActions=e),console.log(JSON.stringify(a))}m(o,{fork:t,snapshotVersion:c}),p(o,{fork:t})}export{S as default};
@@ -1 +1 @@
1
- import{d as x}from"../../chunk-WJLB362D.js";import{a as d,b as l}from"../../chunk-S6KFKBMY.js";import{a as i,b as g,c as u,d as p}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as m,d as n,j as f}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{restoreBucket as w}from"@tigrisdata/storage";var t=f("buckets","restore");async function A(s){a(t);let k=l(s),o=d(s,["name"]);o||g(t,"Bucket name is required");let{data:S,error:e}=await w(o,{config:await x()});if(e&&(n(t,e.message,{name:o}),i(e,t)),!S.restored){let r="Bucket could not be restored";n(t,r,{name:o}),i(r,t)}if(k==="json"){let r=u(t,{name:o}),c={action:"restored",name:o};r.length>0&&(c.nextActions=r),console.log(JSON.stringify(c))}m(t,{name:o}),p(t,{name:o})}export{A as default};
1
+ import{e as x}from"../../chunk-AWTU3DRX.js";import{a as d,b as l}from"../../chunk-S6KFKBMY.js";import{a as i,b as g,c as u,d as p}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as m,d as n,j as f}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{restoreBucket as w}from"@tigrisdata/storage";var t=f("buckets","restore");async function A(s){a(t);let k=l(s),o=d(s,["name"]);o||g(t,"Bucket name is required");let{data:S,error:e}=await w(o,{config:await x()});if(e&&(n(t,e.message,{name:o}),i(e,t)),!S.restored){let r="Bucket could not be restored";n(t,r,{name:o}),i(r,t)}if(k==="json"){let r=u(t,{name:o}),c={action:"restored",name:o};r.length>0&&(c.nextActions=r),console.log(JSON.stringify(c))}m(t,{name:o}),p(t,{name:o})}export{A as default};
@@ -1 +1 @@
1
- import{e as x}from"../../chunk-WJLB362D.js";import{a as r,b as h}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,j as b}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{setBucketCors as N}from"@tigrisdata/storage";var n=b("buckets","set-cors");async function k(e){c(n);let p=h(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"]),u=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||u)&&i(n,"Cannot use --reset with other options"),!m&&!s&&i(n,"Provide --origins or --reset"),t!==void 0&&(Number.isNaN(Number(t))||Number(t)<=0)&&i(n,"--max-age must be a positive number");let w=await x(),{error:g}=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:u??!1,config:w});g&&i(n,g),p==="json"&&console.log(JSON.stringify({action:"updated",bucket:o})),l(n,{name:o})}export{k as default};
1
+ import{f as x}from"../../chunk-AWTU3DRX.js";import{a as r,b as h}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-4W44TSLI.js";import"../../chunk-AWUW4BD3.js";import"../../chunk-IHMIXWMY.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,j as b}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{setBucketCors as N}from"@tigrisdata/storage";var n=b("buckets","set-cors");async function k(e){c(n);let p=h(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"]),u=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||u)&&i(n,"Cannot use --reset with other options"),!m&&!s&&i(n,"Provide --origins or --reset"),t!==void 0&&(Number.isNaN(Number(t))||Number(t)<=0)&&i(n,"--max-age must be a positive number");let w=await x(),{error:g}=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:u??!1,config:w});g&&i(n,g),p==="json"&&console.log(JSON.stringify({action:"updated",bucket:o})),l(n,{name:o})}export{k as default};