@tigrisdata/cli 2.13.1 → 2.14.0-beta.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 (79) hide show
  1. package/dist/auth/s3-client.js +1 -1
  2. package/dist/chunk-2F6KRYMD.js +4 -0
  3. package/dist/chunk-2HWTMFLS.js +8 -0
  4. package/dist/chunk-CQDWZKYG.js +2 -0
  5. package/dist/chunk-PUTZ24A6.js +1 -0
  6. package/dist/chunk-S77OAN6Y.js +1 -0
  7. package/dist/chunk-S7W2ICW6.js +9 -0
  8. package/dist/chunk-TD2HGNDY.js +1 -0
  9. package/dist/chunk-UKNEQJZX.js +1 -0
  10. package/dist/cli-core.js +1 -1
  11. package/dist/cli.js +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/lib/access-keys/assign.js +2 -2
  14. package/dist/lib/access-keys/create.js +2 -2
  15. package/dist/lib/access-keys/delete.js +2 -2
  16. package/dist/lib/access-keys/get.js +2 -2
  17. package/dist/lib/access-keys/list.js +2 -2
  18. package/dist/lib/buckets/create.js +1 -1
  19. package/dist/lib/buckets/delete.js +1 -1
  20. package/dist/lib/buckets/get.js +1 -1
  21. package/dist/lib/buckets/list.js +1 -1
  22. package/dist/lib/buckets/set-cors.js +1 -1
  23. package/dist/lib/buckets/set-locations.js +1 -0
  24. package/dist/lib/buckets/set-migration.js +1 -1
  25. package/dist/lib/buckets/set-notifications.js +1 -1
  26. package/dist/lib/buckets/set-transition.js +1 -1
  27. package/dist/lib/buckets/set-ttl.js +1 -1
  28. package/dist/lib/buckets/set.js +1 -1
  29. package/dist/lib/configure/index.js +1 -1
  30. package/dist/lib/cp.js +1 -1
  31. package/dist/lib/credentials/test.js +1 -1
  32. package/dist/lib/forks/create.js +1 -1
  33. package/dist/lib/forks/list.js +1 -1
  34. package/dist/lib/iam/policies/create.js +2 -2
  35. package/dist/lib/iam/policies/delete.js +2 -2
  36. package/dist/lib/iam/policies/edit.js +2 -2
  37. package/dist/lib/iam/policies/get.js +2 -2
  38. package/dist/lib/iam/policies/list.js +2 -2
  39. package/dist/lib/iam/users/invite.js +3 -3
  40. package/dist/lib/iam/users/list.js +5 -5
  41. package/dist/lib/iam/users/remove.js +3 -3
  42. package/dist/lib/iam/users/revoke-invitation.js +3 -3
  43. package/dist/lib/iam/users/update-role.js +3 -3
  44. package/dist/lib/login/credentials.js +1 -1
  45. package/dist/lib/login/oauth.js +1 -1
  46. package/dist/lib/login/select.js +1 -1
  47. package/dist/lib/logout.js +1 -1
  48. package/dist/lib/ls.js +1 -1
  49. package/dist/lib/mk.js +1 -1
  50. package/dist/lib/mv.js +1 -1
  51. package/dist/lib/objects/delete.js +1 -1
  52. package/dist/lib/objects/get.js +1 -1
  53. package/dist/lib/objects/list.js +1 -1
  54. package/dist/lib/objects/put.js +1 -1
  55. package/dist/lib/objects/set.js +1 -1
  56. package/dist/lib/organizations/create.js +3 -3
  57. package/dist/lib/organizations/list.js +2 -2
  58. package/dist/lib/organizations/select.js +2 -2
  59. package/dist/lib/presign.js +1 -1
  60. package/dist/lib/rm.js +1 -1
  61. package/dist/lib/snapshots/list.js +1 -1
  62. package/dist/lib/snapshots/take.js +1 -1
  63. package/dist/lib/stat.js +1 -1
  64. package/dist/lib/touch.js +1 -1
  65. package/dist/lib/whoami.js +2 -2
  66. package/dist/specs.yaml +283 -15
  67. package/dist/utils/interactive.js +1 -0
  68. package/dist/utils/locations.js +1 -1
  69. package/dist/utils/messages.js +1 -1
  70. package/dist/utils/update-check.js +1 -1
  71. package/package.json +5 -4
  72. package/dist/chunk-47THEW77.js +0 -8
  73. package/dist/chunk-4V35SYMM.js +0 -9
  74. package/dist/chunk-F2VBJEK7.js +0 -1
  75. package/dist/chunk-Q4KOY3VK.js +0 -1
  76. package/dist/chunk-SYGTCM6P.js +0 -2
  77. package/dist/chunk-TNOMT3EP.js +0 -4
  78. package/dist/chunk-YERF43U2.js +0 -1
  79. /package/dist/{chunk-VOQSWXBS.js → chunk-BQX7MWWL.js} +0 -0
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunk-VOQSWXBS.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";export{a as getLoginMethod,c as getS3Client,b as getStorageConfig,d as isAuthenticated};
1
+ import{a,b,c,d}from"../chunk-BQX7MWWL.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";export{a as getLoginMethod,c as getS3Client,b as getStorageConfig,d as isAuthenticated};
@@ -0,0 +1,4 @@
1
+ import{a as r,b as e,c as a,e as s,f as c,h as g}from"./chunk-CQDWZKYG.js";import{b as u}from"./chunk-E4MLGABW.js";import{f as l}from"./chunk-DOUR5YEY.js";var t=g("login","oauth");async function f(){r(t);try{let i=u();if(await i.isAuthenticated()){s(t);return}await i.login({onDeviceCode:(o,p)=>{console.log(`
2
+ Your confirmation code: ${o}
3
+ `),console.log(`If browser doesn't open, visit: ${p}`)},onWaiting:()=>console.log(`
4
+ Waiting for authentication...`)});let n=await i.getOrganizations();if(n.length>0){let o=n[0];await l(o.id),e(t,{org:o.displayName||o.name}),n.length>1&&c(t,{count:n.length})}else e(t,{org:"none"})}catch{a(t),process.exit(1)}}var A=f;export{f as a,A as b};
@@ -0,0 +1,8 @@
1
+ import{d as m,e as d,f}from"./chunk-2XAO2OYD.js";import{readFileSync as I,writeFileSync as T,mkdirSync as N}from"fs";import{join as g}from"path";import{homedir as h}from"os";import j from"https";var u="2.14.0-beta.1";var b=g(h(),".tigris","update-check.json");function y(){try{let t=I(b,"utf-8"),i=JSON.parse(t);return typeof i.latestVersion=="string"&&typeof i.lastChecked=="number"?i:null}catch{return null}}function v(t){try{N(g(h(),".tigris"),{recursive:!0}),T(b,JSON.stringify(t),"utf-8")}catch{}}function E(t,i){let a=o=>{let r=o.startsWith("v")?o.slice(1):o,c=null,l=r.indexOf("-");l!==-1&&(c=r.slice(l+1),r=r.slice(0,l));let p=r.split(".");if(p.length!==3)return null;let n=p.map(Number);return n.some(isNaN)?null:{major:n[0],minor:n[1],patch:n[2],prerelease:c}},e=a(t),s=a(i);return!e||!s?!1:s.major>e.major?!0:s.major<e.major?!1:s.minor>e.minor?!0:s.minor<e.minor?!1:s.patch>e.patch?!0:s.patch<e.patch?!1:e.prerelease&&!s.prerelease?!0:(!e.prerelease&&s.prerelease,!1)}function w(){try{let t=j.get(m,{timeout:5e3},i=>{let a="";i.on("data",e=>{a+=e}),i.on("end",()=>{try{let e=JSON.parse(a);if(typeof e.version=="string"){let s=y();v({...s,latestVersion:e.version,lastChecked:Date.now()})}}catch{}})});t.on("error",()=>{}),t.on("timeout",()=>{t.destroy()}),t.end(),t.on("socket",i=>{i.unref()})}catch{}}function V(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let t=y(),i=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||216e5;if(t&&E(u,t.latestVersion)&&(!t.lastNotified||Date.now()-t.lastNotified>i)){let e=globalThis.__TIGRIS_BINARY===!0,s=process.platform==="win32",o=`Update available: ${u} \u2192 ${t.latestVersion}`,r;e?s?r="Run `irm https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.ps1 | iex`":r="Run `curl -fsSL https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.sh | sh`":r="Run `npm install -g @tigrisdata/cli` to upgrade.";let c=Math.max(o.length,r.length)+4,l="\u250C"+"\u2500".repeat(c-2)+"\u2510",p="\u2514"+"\u2500".repeat(c-2)+"\u2518",n=_=>"\u2502 "+_.padEnd(c-4)+" \u2502";console.log(`
2
+ ${l}
3
+ ${n("")}
4
+ ${n(o)}
5
+ ${n(r)}
6
+ ${n("")}
7
+ ${p}
8
+ `),v({...t,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||864e5;(!t||Date.now()-t.lastChecked>a)&&w()}export{u as a,E as b,V as c};
@@ -0,0 +1,2 @@
1
+ import{c as u}from"./chunk-BETAO4PB.js";var a={success:"\u2714",failure:"\u2716",hint:"\u2192"};function t(){return process.stdout.isTTY===!0}function o(s){let n=u(s.command,s.operation);if(n)return n.messages}function r(s,n){let e=s;return e=e.replace(/\\n/g,`
2
+ `),n&&(e=e.replace(/\{\{(\w+)\}\}/g,(i,c)=>{let g=n[c];return g!==void 0?String(g):`{{${c}}}`})),e}function l(s,n){if(!t())return;let e=o(s);e?.onStart&&console.log(r(e.onStart,n))}function f(s,n){if(!t())return;let e=o(s);e?.onSuccess&&console.log(`${a.success} ${r(e.onSuccess,n)}`)}function d(s,n,e){let i=o(s);i?.onFailure&&console.error(`${a.failure} ${r(i.onFailure,e)}`),n&&console.error(` ${n}`)}function m(s,n){if(!t())return;let e=o(s);e?.onEmpty&&console.log(r(e.onEmpty,n))}function M(s,n){if(!t())return;let e=o(s);e?.onAlreadyDone&&console.log(r(e.onAlreadyDone,n))}function x(s,n){if(!t())return;let e=o(s);e?.hint&&console.log(`${a.hint} ${r(e.hint,n)}`)}function C(s){t()&&console.warn(`\u26A0 Deprecated: ${s}`)}function S(s,n){return{command:s,operation:n}}export{l as a,f as b,d as c,m as d,M as e,x as f,C as g,S as h};
@@ -0,0 +1 @@
1
+ import{a as g}from"./chunk-S77OAN6Y.js";import{a as i,b as n,c as d,h as o}from"./chunk-CQDWZKYG.js";import{m as u,o as m,r as f}from"./chunk-DOUR5YEY.js";import{a as y}from"./chunk-2XAO2OYD.js";import S from"enquirer";var{prompt:l}=S,t=o("login","credentials");async function K(e){i(t);let s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,c=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(!s||!c){let r=[];s||r.push({type:"input",name:"accessKey",message:"Access Key ID:",required:!0}),c||r.push({type:"password",name:"accessSecret",message:"Secret Access Key:",required:!0}),g("Provide --access-key and --access-secret");let a=await l(r);s=s||a.accessKey,c=c||a.accessSecret}(!s||!c)&&(d(t,"Access key and secret are required"),process.exit(1));let p=u()?.endpoint||y;await m({accessKeyId:s,secretAccessKey:c,endpoint:p}),await f("credentials"),n(t)}export{K as a};
@@ -0,0 +1 @@
1
+ import*as o from"readline";function n(e){process.stdin.isTTY||(console.error("Error: this command requires interactive input (not available in piped/scripted mode)"),console.error(`Hint: ${e}`),process.exit(1))}async function s(e){let r=o.createInterface({input:process.stdin,output:process.stdout});return new Promise(t=>{r.question(`${e} (y/N): `,i=>{r.close(),t(i.toLowerCase()==="y")})})}export{n as a,s as b};
@@ -0,0 +1,9 @@
1
+ import{g}from"./chunk-CQDWZKYG.js";import{Command as v}from"commander";function j(){process.on("unhandledRejection",e=>{(e===""||e===void 0)&&(console.error(`
2
+ Operation cancelled`),process.exit(1)),console.error(`
3
+ Error:`,e instanceof Error?e.message:e),process.exit(1)}),process.on("uncaughtException",e=>{console.error(`
4
+ Error:`,e.message),process.exit(1)})}function b(e){return/^[a-zA-Z0-9_-]+$/.test(e)}function q(e){let t;e.type==="positional"?t=` ${e.name}`:(t=` --${e.name}`,e.alias&&typeof e.alias=="string"&&(t+=e.alias.length===1?`, -${e.alias}`:`, --${e.alias}`));let n=26,r=t.length>=n?t+" ":t.padEnd(n),o=e.description;return e.options&&(Array.isArray(e.options)&&typeof e.options[0]=="string"?o+=` (options: ${e.options.join(", ")})`:o+=` (options: ${e.options.map(a=>a.value).join(", ")})`),e.default&&(o+=` [default: ${e.default}]`),e.required&&(o+=" [required]"),e["required-when"]&&(o+=` [required when: ${e["required-when"]}]`),e.multiple&&(o+=" [multiple values: comma-separated]"),e.type==="positional"&&(o+=" [positional argument]"),e.examples&&e.examples.length>0&&(o+=` (examples: ${e.examples.join(", ")})`),`${r}${o}`}function f(e,t,n){return n(t)?!0:e.commands?e.commands.some(r=>f(r,[...t,r.name],n)):!1}function x(e,t,n,r){let o=n.join(" ");if(console.log(`
5
+ ${e.name} ${o} - ${t.description}
6
+ `),t.commands&&t.commands.length>0){let a=t.commands.filter(i=>f(i,[...n,i.name],r));a.length>0&&(console.log("Commands:"),a.forEach(i=>{let s=` ${i.name}`;if(i.alias){let l=Array.isArray(i.alias)?i.alias:[i.alias];s+=` (${l.join(", ")})`}let p=s.padEnd(24);console.log(`${p}${i.description}`)}),console.log())}t.arguments&&t.arguments.length>0&&(console.log("Arguments:"),t.arguments.forEach(a=>{console.log(q(a))}),console.log()),t.examples&&t.examples.length>0&&(console.log("Examples:"),t.examples.forEach(a=>{console.log(` ${a}`)}),console.log()),t.commands&&t.commands.length>0&&console.log(`Use "${e.name} ${o} <command> help" for more information about a command.`)}function A(e,t,n){console.log(`Tigris CLI Version: ${t}
7
+ `),console.log(`Usage: tigris [command] [options]
8
+ `),console.log("Commands:"),e.commands.filter(o=>f(o,[o.name],n)).forEach(o=>{let a=` ${o.name}`;if(o.alias){let s=Array.isArray(o.alias)?o.alias:[o.alias];a+=` (${s.join(", ")})`}let i=a.padEnd(24);console.log(`${i}${o.description}`)}),console.log(`
9
+ Use "${e.name} <command> help" for more information about a command.`)}function C(e,t=[]){t.forEach(n=>{if(n.type==="positional"){let r=n.required?`<${n.name}>`:`[${n.name}]`;e.argument(r,n.description)}else{let r=n.alias&&typeof n.alias=="string"&&n.alias.length===1,o=n.alias&&typeof n.alias=="string"&&n.alias.length>1,a=r?`-${n.alias}, --${n.name}`:o?`--${n.alias}, --${n.name}`:`--${n.name}`;n.type==="flag"||(n.type==="boolean"?a+=" [value]":n.options?a+=" <value>":a+=n.required||n["required-when"]?" <value>":" [value]"),e.option(a,n.description,n.default)}})}function S(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function $(e,t,n){if(n){let o=n.find(a=>a.name===t);if(o&&o.alias&&typeof o.alias=="string"){let a=o.alias.charAt(0).toUpperCase()+o.alias.slice(1);if(e[a]!==void 0)return e[a]}}let r=[t,t.replace(/-/g,""),t.replace(/-/g,"").toLowerCase(),t.charAt(0).toUpperCase(),S(t)];for(let o of r)if(e[o]!==void 0)return e[o]}function w(e,t){for(let n of e){if(n["required-when"]){let[r,o]=n["required-when"].split("="),a=$(t,r,e),i=$(t,n.name,e);if(a===o&&!i)return console.error(`--${n.name} is required when --${r} is ${o}`),!1}if(n.required&&!$(t,n.name,e))return console.error(`--${n.name} is required`),!1}return!0}function u(e,t,n){let r;"optsWithGlobals"in n&&typeof n.optsWithGlobals=="function"?r=n.optsWithGlobals():"opts"in n&&typeof n.opts=="function"?r=n.opts():r=n;let o={...r};return e.filter(i=>i.type==="positional").forEach((i,s)=>{t[s]!==void 0&&(i.multiple?o[i.name]=t[s].split(",").map(p=>p.trim()):o[i.name]=t[s])}),e.forEach(i=>{i.multiple&&i.type!=="positional"&&o[i.name]&&typeof o[i.name]=="string"&&(o[i.name]=o[i.name].split(",").map(s=>s.trim()))}),o}async function E(e,t,n=[],r={}){let{module:o,error:a}=await e(t);(a||!o)&&(console.error(a),process.exit(1));let i=t[t.length-1],s=o.default||o[i];typeof s!="function"&&(console.error(`Command not implemented: ${t.join(" ")}`),process.exit(1)),await s({...r,_positional:n})}function k(e,t,n,r=[]){let{specs:o,loadModule:a,hasImplementation:i}=e;for(let s of n){b(s.name)||(console.error(`Invalid command name "${s.name}": only alphanumeric, hyphens, and underscores allowed`),process.exit(1));let p=[...r,s.name];if(!f(s,p,i))continue;let l=t.command(s.name).description(s.description);if(s.alias&&(Array.isArray(s.alias)?s.alias:[s.alias]).forEach(c=>l.alias(c)),s.commands&&s.commands.length>0)if(k(e,l,s.commands,p),s.default){let m=s.commands.find(c=>c.name===s.default);if(m){C(l,s.arguments),C(l,m.arguments);let c=[...s.arguments||[],...m.arguments||[]];l.action(async(...d)=>{let y=d.pop(),h=d;c.length>0&&!w(c,u(c,h,y))||(m.deprecated&&m.messages?.onDeprecated&&g(m.messages.onDeprecated),await E(a,[...p,m.name],h,u(c,h,y)))})}}else l.action(()=>{x(o,s,p,i)});else C(l,s.arguments),l.action(async(...m)=>{let c=m.pop(),d=m;s.arguments&&!w(s.arguments,u(s.arguments,d,c))||(s.deprecated&&s.messages?.onDeprecated&&g(s.messages.onDeprecated),await E(a,p,d,u(s.arguments||[],d,c)))});l.command("help").description("Show help for this command").action(()=>{x(o,s,p,i)})}}function L(e){let{specs:t,version:n,hasImplementation:r}=e,o=new v;return o.name(t.name).description(t.description).version(n),o.option("-y, --yes","Skip all confirmation prompts"),k(e,o,t.commands),o.command("help").description("Show general help").action(()=>{A(t,n,r)}),o.action(()=>{A(t,n,r)}),o}export{j as a,b,q as c,f as d,x as e,A as f,C as g,w as h,u as i,k as j,L as k};
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-S77OAN6Y.js";import l from"enquirer";var{prompt:r}=l,u=["usa","eur"],m=[{name:"USA",value:"usa"},{name:"Europe",value:"eur"}],s=[{name:"Amsterdam, Netherlands (AMS)",value:"ams"},{name:"Frankfurt, Germany (FRA)",value:"fra"},{name:"Sao Paulo, Brazil (GRU)",value:"gru"},{name:"Ashburn, Virginia (IAD)",value:"iad"},{name:"Johannesburg, South Africa (JNB)",value:"jnb"},{name:"London, United Kingdom (LHR)",value:"lhr"},{name:"Tokyo, Japan (NRT)",value:"nrt"},{name:"Chicago, Illinois (ORD)",value:"ord"},{name:"Singapore, Singapore (SIN)",value:"sin"},{name:"San Jose, California (SJC)",value:"sjc"},{name:"Sydney, Australia (SYD)",value:"syd"}];async function g(t){try{if(t==="multi"){let{region:e}=await r({type:"select",name:"region",message:"Multi-region:",choices:m.map(n=>({name:n.value,message:n.name}))});return o(e)}if(t==="single"){let{region:e}=await r({type:"select",name:"region",message:"Region:",choices:s.map(n=>({name:n.value,message:n.name}))});return o(e)}let{regions:a}=await r({type:"multiselect",name:"regions",message:"Press space key to select regions (multiple supported) and enter to confirm:",choices:s.map(e=>({name:e.value,message:e.name}))});if(a.length<2)throw new Error("Dual region requires at least two regions");return o(a)}catch(a){if(a==="")return null;throw a}}async function c(){i("Provide --locations flag");let t;try{({locationType:t}=await r({type:"select",name:"locationType",message:"Location type:",choices:[{name:"global",message:"Global"},{name:"multi",message:"Multi-region (USA or Europe)"},{name:"dual",message:"Dual region"},{name:"single",message:"Single region"}]}))}catch{throw new Error("Location selection cancelled")}return t==="global"?{type:"global"}:await g(t)??c()}function o(t){let a=(Array.isArray(t)?t:[t]).flatMap(e=>e.split(",")).map(e=>e.trim()).filter(e=>e.length>0);if(a.length===0||a.length===1&&a[0]==="global")return{type:"global"};if(a.length===1){let e=a[0];return u.includes(e)?{type:"multi",values:e}:{type:"single",values:e}}return{type:"dual",values:a}}export{c as a,o as b};
@@ -0,0 +1 @@
1
+ import{a as s,c as l}from"./chunk-2HWTMFLS.js";import{a as i,k as m}from"./chunk-S7W2ICW6.js";import{b as t}from"./chunk-BETAO4PB.js";import{existsSync as c}from"fs";import{join as a,dirname as u}from"path";import{fileURLToPath as f}from"url";i();var j=f(import.meta.url),d=u(j),h=t(),y=o=>{if(o.length===0)return!1;let e=a(d,"lib",...o)+".js";if(c(e))return!0;let r=a(d,"lib",...o,"index.js");return!!c(r)},b=async o=>{let e=[`./lib/${o.join("/")}.js`,`./lib/${o.join("/")}/index.js`];for(let p of e){let n=await import(p).catch(()=>null);if(n)return{module:n,error:null}}return{module:null,error:`Command not found: ${o.join(" ")}`}},x=m({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
package/dist/cli-core.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-4V35SYMM.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-S7W2ICW6.js";import"./chunk-CQDWZKYG.js";import"./chunk-BETAO4PB.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-YERF43U2.js";import"./chunk-47THEW77.js";import"./chunk-BETAO4PB.js";import"./chunk-4V35SYMM.js";import"./chunk-2XAO2OYD.js";
2
+ import"./chunk-UKNEQJZX.js";import"./chunk-2HWTMFLS.js";import"./chunk-S7W2ICW6.js";import"./chunk-CQDWZKYG.js";import"./chunk-BETAO4PB.js";import"./chunk-2XAO2OYD.js";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import"./chunk-YERF43U2.js";import"./chunk-47THEW77.js";import"./chunk-BETAO4PB.js";import"./chunk-4V35SYMM.js";import"./chunk-2XAO2OYD.js";
1
+ import"./chunk-UKNEQJZX.js";import"./chunk-2HWTMFLS.js";import"./chunk-S7W2ICW6.js";import"./chunk-CQDWZKYG.js";import"./chunk-BETAO4PB.js";import"./chunk-2XAO2OYD.js";
@@ -1,2 +1,2 @@
1
- import{a as A,b as l,c as t,g as R}from"../../chunk-SYGTCM6P.js";import{a as n}from"../../chunk-JRALYIRA.js";import{a as b}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as k}from"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import{c as p}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{assignBucketRoles as C,revokeAllBucketRoles as N}from"@tigrisdata/iam";var e=R("access-keys","assign"),x=["Editor","ReadOnly","NamespaceAdmin"];function y(o){return o?Array.isArray(o)?o:[o]:[]}async function E(o){A(e);let c=n(o,["id"]),g=n(o,["admin"]),d=n(o,["revokeRoles","revoke-roles"]),r=y(n(o,["bucket","b"])),s=y(n(o,["role","r"]));c||(t(e,"Access key ID is required"),process.exit(1)),g&&d&&(t(e,"Cannot use --admin and --revoke-roles together"),process.exit(1)),await b()!=="oauth"&&(t(e,`Bucket roles can only be managed when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let m=k();await m.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let T=await m.getAccessToken(),v=h(),w=p(),u={sessionToken:T,organizationId:v??void 0,iamEndpoint:w.iamEndpoint};if(d){let{error:i}=await N(c,{config:u});i&&(t(e,i.message),process.exit(1)),l(e);return}let a;if(g)a=[{bucket:"*",role:"NamespaceAdmin"}];else{r.length===0&&(t(e,"At least one bucket name is required (or use --admin or --revoke-roles)"),process.exit(1)),s.length===0&&(t(e,"At least one role is required (or use --admin or --revoke-roles)"),process.exit(1));for(let i of s)x.includes(i)||(t(e,`Invalid role "${i}". Valid roles are: ${x.join(", ")}`),process.exit(1));s.length===1?a=r.map(i=>({bucket:i,role:s[0]})):s.length===r.length?a=r.map((i,O)=>({bucket:i,role:s[O]})):(t(e,`Number of roles (${s.length}) must be 1 or match number of buckets (${r.length})`),process.exit(1))}let{error:f}=await C(c,a,{config:u});f&&(t(e,f.message),process.exit(1)),l(e)}export{E as default};
1
+ import{a as n}from"../../chunk-JRALYIRA.js";import{a as x}from"../../chunk-BQX7MWWL.js";import{a as h,b as l,c as t,h as k}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import{b}from"../../chunk-E4MLGABW.js";import{g as R}from"../../chunk-DOUR5YEY.js";import{c as A}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{assignBucketRoles as N,revokeAllBucketRoles as C}from"@tigrisdata/iam";var e=k("access-keys","assign"),y=["Editor","ReadOnly","NamespaceAdmin"];function T(o){return o?Array.isArray(o)?o:[o]:[]}async function S(o){h(e);let g=n(o,["json"])?"json":n(o,["format","f","F"],"table"),r=n(o,["id"]),d=n(o,["admin"]),f=n(o,["revokeRoles","revoke-roles"]),a=T(n(o,["bucket","b"])),i=T(n(o,["role","r"]));r||(t(e,"Access key ID is required"),process.exit(1)),d&&f&&(t(e,"Cannot use --admin and --revoke-roles together"),process.exit(1)),await x()!=="oauth"&&(t(e,`Bucket roles can only be managed when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let m=b();await m.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let v=await m.getAccessToken(),O=R(),j=A(),u={sessionToken:v,organizationId:O??void 0,iamEndpoint:j.iamEndpoint};if(f){let{error:s}=await C(r,{config:u});s&&(t(e,s.message),process.exit(1)),g==="json"&&console.log(JSON.stringify({action:"revoked",id:r})),l(e);return}let c;if(d)c=[{bucket:"*",role:"NamespaceAdmin"}];else{a.length===0&&(t(e,"At least one bucket name is required (or use --admin or --revoke-roles)"),process.exit(1)),i.length===0&&(t(e,"At least one role is required (or use --admin or --revoke-roles)"),process.exit(1));for(let s of i)y.includes(s)||(t(e,`Invalid role "${s}". Valid roles are: ${y.join(", ")}`),process.exit(1));i.length===1?c=a.map(s=>({bucket:s,role:i[0]})):i.length===a.length?c=a.map((s,w)=>({bucket:s,role:i[w]})):(t(e,`Number of roles (${i.length}) must be 1 or match number of buckets (${a.length})`),process.exit(1))}let{error:p}=await N(r,c,{config:u});p&&(t(e,p.message),process.exit(1)),g==="json"&&console.log(JSON.stringify({action:"assigned",id:r,assignments:c})),l(e)}export{S as default};
@@ -1,2 +1,2 @@
1
- import{a as g,b as l,c as t,g as m}from"../../chunk-SYGTCM6P.js";import{a as u}from"../../chunk-JRALYIRA.js";import{a as d}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as a}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createAccessKey as y}from"@tigrisdata/iam";var e=m("access-keys","create");async function w(f){g(e);let i=u(f,["name"]);i||(t(e,"Access key name is required"),process.exit(1)),await d()!=="oauth"&&(t(e,`Access keys can only be created when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let n=a();await n.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let p=await n.getAccessToken(),h=r(),A=c(),{data:o,error:s}=await y(i,{config:{sessionToken:p,organizationId:h??void 0,iamEndpoint:A.iamEndpoint}});s&&(t(e,s.message),process.exit(1)),console.log(` Name: ${o.name}`),console.log(` Access Key ID: ${o.id}`),console.log(` Secret Access Key: ${o.secret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again."),l(e)}export{w as default};
1
+ import{a as n}from"../../chunk-JRALYIRA.js";import{a as u}from"../../chunk-BQX7MWWL.js";import{a,b as g,c as o,h as l}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import{b as f}from"../../chunk-E4MLGABW.js";import{g as d}from"../../chunk-DOUR5YEY.js";import{c as m}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createAccessKey as w}from"@tigrisdata/iam";var t=l("access-keys","create");async function k(s){a(t);let h=n(s,["json"])?"json":n(s,["format","f","F"],"table"),i=n(s,["name"]);i||(o(t,"Access key name is required"),process.exit(1)),await u()!=="oauth"&&(o(t,`Access keys can only be created when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let c=f();await c.isAuthenticated()||(o(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let p=await c.getAccessToken(),A=d(),y=m(),{data:e,error:r}=await w(i,{config:{sessionToken:p,organizationId:A??void 0,iamEndpoint:y.iamEndpoint}});r&&(o(t,r.message),process.exit(1)),h==="json"?console.log(JSON.stringify({action:"created",name:e.name,id:e.id,secret:e.secret})):(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.")),g(t)}export{k as default};
@@ -1,2 +1,2 @@
1
- import{a,b as g,c as e,g as d}from"../../chunk-SYGTCM6P.js";import{a as f}from"../../chunk-JRALYIRA.js";import{a as m}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as c}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c as s}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeAccessKey as A}from"@tigrisdata/iam";var t=d("access-keys","delete");async function k(u){a(t);let i=f(u,["id"]);i||(e(t,"Access key ID is required"),process.exit(1)),await m()!=="oauth"&&(e(t,`Access keys can only be deleted when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let o=c();await o.isAuthenticated()||(e(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let p=await o.getAccessToken(),h=r(),l=s(),{error:n}=await A(i,{config:{sessionToken:p,organizationId:h??void 0,iamEndpoint:l.iamEndpoint}});n&&(e(t,n.message),process.exit(1)),g(t)}export{k as default};
1
+ import{a as l,b as u}from"../../chunk-S77OAN6Y.js";import{a as o}from"../../chunk-JRALYIRA.js";import{a as p}from"../../chunk-BQX7MWWL.js";import{a as c,b as a,c as t,h as f}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import{b as m}from"../../chunk-E4MLGABW.js";import{g as d}from"../../chunk-DOUR5YEY.js";import{c as g}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeAccessKey as x}from"@tigrisdata/iam";var e=f("access-keys","delete");async function b(i){c(e);let h=o(i,["json"])?"json":o(i,["format","f","F"],"table"),n=o(i,["id"]),y=o(i,["force","yes","y"]);n||(t(e,"Access key ID is required"),process.exit(1)),await p()!=="oauth"&&(t(e,`Access keys can only be deleted when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let s=m();if(await s.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1)),!y&&(l("Use --yes to skip confirmation"),!await u(`Delete access key '${n}'?`))){console.log("Aborted");return}let A=await s.getAccessToken(),k=d(),w=g(),{error:r}=await x(n,{config:{sessionToken:A,organizationId:k??void 0,iamEndpoint:w.iamEndpoint}});r&&(t(e,r.message),process.exit(1)),h==="json"&&console.log(JSON.stringify({action:"deleted",id:n})),a(e)}export{b as default};
@@ -1,2 +1,2 @@
1
- import{a as l,b as d,c as t,g as f}from"../../chunk-SYGTCM6P.js";import{a as m}from"../../chunk-JRALYIRA.js";import{a as u}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as g}from"../../chunk-E4MLGABW.js";import{g as a}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getAccessKey as $}from"@tigrisdata/iam";var e=f("access-keys","get");async function w(p){l(e);let i=m(p,["id"]);i||(t(e,"Access key ID is required"),process.exit(1)),await u()!=="oauth"&&(t(e,`Access keys can only be retrieved when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let n=g();await n.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let h=await n.getAccessToken(),A=a(),k=c(),{data:o,error:s}=await $(i,{config:{sessionToken:h,organizationId:A??void 0,iamEndpoint:k.iamEndpoint}});if(s&&(t(e,s.message),process.exit(1)),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 r of o.roles)console.log(` - ${r.bucket}: ${r.role}`)}else console.log(" Roles: None");d(e)}export{w as default};
1
+ import{a as n}from"../../chunk-JRALYIRA.js";import{a as p}from"../../chunk-BQX7MWWL.js";import{a as g,b as l,c as t,h as f}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import{b as u}from"../../chunk-E4MLGABW.js";import{g as m}from"../../chunk-DOUR5YEY.js";import{c as d}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getAccessKey as $}from"@tigrisdata/iam";var e=f("access-keys","get");async function w(s){g(e);let h=n(s,["json"])?"json":n(s,["format","f","F"],"table"),i=n(s,["id"]);i||(t(e,"Access key ID is required"),process.exit(1)),await p()!=="oauth"&&(t(e,`Access keys can only be retrieved when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let r=u();await r.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let A=await r.getAccessToken(),k=m(),y=d(),{data:o,error:c}=await $(i,{config:{sessionToken:A,organizationId:k??void 0,iamEndpoint:y.iamEndpoint}});if(c&&(t(e,c.message),process.exit(1)),h==="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 a of o.roles)console.log(` - ${a.bucket}: ${a.role}`)}else console.log(" Roles: None");l(e)}export{w as default};
@@ -1,2 +1,2 @@
1
- import{a as g,b as u,c as s,d as m,g as l}from"../../chunk-SYGTCM6P.js";import{f}from"../../chunk-CQCBYE3X.js";import{a as p}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import{b as d}from"../../chunk-E4MLGABW.js";import{g as r}from"../../chunk-DOUR5YEY.js";import{c}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listAccessKeys as w}from"@tigrisdata/iam";var t=l("access-keys","list");async function x(){g(t),await p()!=="oauth"&&(s(t,`Access keys can only be listed when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let o=d();await o.isAuthenticated()||(s(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let h=await o.getAccessToken(),y=r(),k=c(),{data:i,error:n}=await w({config:{sessionToken:h,organizationId:y??void 0,iamEndpoint:k.iamEndpoint}});if(n&&(s(t,n.message),process.exit(1)),!i.accessKeys||i.accessKeys.length===0){m(t);return}let a=i.accessKeys.map(e=>({name:e.name,id:e.id,status:e.status,created:e.createdAt})),A=f(a,"table","keys","key",[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}]);console.log(A),u(t,{count:a.length})}export{x as default};
1
+ import{f as y}from"../../chunk-CQCBYE3X.js";import{a as i}from"../../chunk-JRALYIRA.js";import{a as h}from"../../chunk-BQX7MWWL.js";import{a as d,b as g,c as s,d as m,h as u}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import{b as p}from"../../chunk-E4MLGABW.js";import{g as l}from"../../chunk-DOUR5YEY.js";import{c as f}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listAccessKeys as O}from"@tigrisdata/iam";var t=u("access-keys","list");async function j(n){d(t);let k=i(n,["json"])?"json":i(n,["format","f","F"],"table");await h()!=="oauth"&&(s(t,`Access keys can only be listed when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let a=p();await a.isAuthenticated()||(s(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let A=await a.getAccessToken(),w=l(),x=f(),{data:o,error:r}=await O({config:{sessionToken:A,organizationId:w??void 0,iamEndpoint:x.iamEndpoint}});if(r&&(s(t,r.message),process.exit(1)),!o.accessKeys||o.accessKeys.length===0){m(t);return}let c=o.accessKeys.map(e=>({name:e.name,id:e.id,status:e.status,created:e.createdAt})),C=y(c,k,"keys","key",[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}]);console.log(C),g(t,{count:c.length})}export{j as default};
@@ -1 +1 @@
1
- import{a as R,b as A,c as g,g as L}from"../../chunk-SYGTCM6P.js";import{a as P,b as h,c as o}from"../../chunk-Q4KOY3VK.js";import{a as s}from"../../chunk-JRALYIRA.js";import{b as B}from"../../chunk-VOQSWXBS.js";import{d as f,e as b}from"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import I from"enquirer";import{createBucket as M}from"@tigrisdata/storage";var{prompt:c}=I,r=L("buckets","create");async function W(t){R(r);let n=s(t,["name"]),y=s(t,["public"])?"public":s(t,["access","a","A"]),S=s(t,["enable-snapshots","s","S"]),w=s(t,["default-tier","t","T"]),m=s(t,["locations","l","L"]),k=s(t,["region","r","R"]),q=s(t,["consistency","c","C"]);k!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),m===void 0&&(m=k)),q!==void 0&&console.warn("Warning: --consistency is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/");let E=!n,i;if(E){let T=f("buckets","access","create"),v=b(T),u=v?.findIndex(e=>e.value===T?.default),x=f("buckets","default-tier","create"),D=b(x),p=D?.findIndex(e=>e.value===x?.default),l=await c([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:v||[],initial:u!==void 0&&u>=0?u:0},{type:"select",name:"defaultTier",message:"Default storage tier:",choices:D||[],initial:p!==void 0&&p>=0?p:0},{type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}]);n=l.name,y=l.access,w=l.defaultTier,S=l.enableSnapshots;let{locationType:d}=await c({type:"select",name:"locationType",message:"Location type:",choices:[{name:"global",message:"Global"},{name:"multi",message:"Multi-region (USA or Europe)"},{name:"dual",message:"Dual region"},{name:"single",message:"Single region"}]});if(d==="global")i={type:"global"};else if(d==="multi"){let{region:e}=await c({type:"select",name:"region",message:"Multi-region:",choices:P.map(a=>({name:a.value,message:a.name}))});i=o(e)}else if(d==="single"){let{region:e}=await c({type:"select",name:"region",message:"Region:",choices:h.map(a=>({name:a.value,message:a.name}))});i=o(e)}else{let{regions:e}=await c({type:"multiselect",name:"regions",message:"Press space key to select regions (multiple supported) and enter to confirm:",choices:h.map(a=>({name:a.value,message:a.name}))});e.length<2&&(g(r,"Dual region requires at least two regions"),process.exit(1)),i=o(e)}}n||(g(r,"Bucket name is required"),process.exit(1));let{error:C}=await M(n,{defaultTier:w??"STANDARD",enableSnapshot:S===!0,access:y??"private",locations:i??o(m??"global"),config:await B()});C&&(g(r,C.message),process.exit(1)),A(r,{name:n})}export{W as default};
1
+ import{a as q,b as A}from"../../chunk-TD2HGNDY.js";import{a as L}from"../../chunk-S77OAN6Y.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as j}from"../../chunk-BQX7MWWL.js";import{a as C,b as B,c,h as T}from"../../chunk-CQDWZKYG.js";import{d,e as p}from"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import R from"enquirer";import{createBucket as I}from"@tigrisdata/storage";var{prompt:N}=R,a=T("buckets","create");async function E(t){C(a);let D=e(t,["json"])?"json":e(t,["format","f","F"],"table"),s=e(t,["name"]),m=e(t,["public"])?"public":e(t,["access","a","A"]),g=e(t,["enable-snapshots","s","S"]),b=e(t,["default-tier","t","T"]),i=e(t,["locations","l","L"]),n=e(t,["fork-of","forkOf","fork"]),l=e(t,["source-snapshot","sourceSnapshot","source-snap"]),S=e(t,["region","r","R"]),O=e(t,["consistency","c","C"]);S!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),i===void 0&&(i=S)),O!==void 0&&console.warn("Warning: --consistency is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/");let P=!s,h;if(P){L("Provide --name to skip interactive mode");let w=d("buckets","access","create"),y=p(w),u=y?.findIndex(o=>o.value===w?.default),v=d("buckets","default-tier","create"),x=p(v),f=x?.findIndex(o=>o.value===v?.default),r=await N([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:y||[],initial:u!==void 0&&u>=0?u:0},{type:"select",name:"defaultTier",message:"Default storage tier:",choices:x||[],initial:f!==void 0&&f>=0?f:0},{type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}]);s=r.name,m=r.access,b=r.defaultTier,g=r.enableSnapshots;try{h=await q()}catch(o){c(a,o.message),process.exit(1)}}s||(c(a,"Bucket name is required"),process.exit(1)),l&&!n&&(c(a,"--source-snapshot requires --fork-of"),process.exit(1));let{error:k}=await I(s,{defaultTier:b??"STANDARD",enableSnapshot:g===!0,access:m??"private",locations:h??A(i??"global"),...n?{sourceBucketName:n}:{},...l?{sourceBucketSnapshot:l}:{},config:await j()});k&&(c(a,k.message),process.exit(1)),D==="json"&&console.log(JSON.stringify({action:"created",name:s,...n?{forkOf:n}:{}})),B(a,{name:s})}export{E as default};
@@ -1 +1 @@
1
- import{a as i,b as s,c as o,g as c}from"../../chunk-SYGTCM6P.js";import{a as m}from"../../chunk-JRALYIRA.js";import{b as a}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeBucket as g}from"@tigrisdata/storage";var e=c("buckets","delete");async function k(f){i(e);let t=m(f,["name"]);t||(o(e,"Bucket name is required"),process.exit(1));let p=Array.isArray(t)?t:[t],u=await a();for(let r of p){let{error:n}=await g(r,{config:u});n&&(o(e,n.message,{name:r}),process.exit(1)),s(e,{name:r})}}export{k as default};
1
+ import{a as u,b as d}from"../../chunk-S77OAN6Y.js";import{a as t}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-BQX7MWWL.js";import{a as m,b as g,c,h as l}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeBucket as j}from"@tigrisdata/storage";var n=l("buckets","delete");async function h(r){m(n);let k=t(r,["json"])?"json":t(r,["format","f","F"],"table"),o=t(r,["name"]),b=t(r,["force","yes","y"]);o||(c(n,"Bucket name is required"),process.exit(1));let a=Array.isArray(o)?o:[o],y=await p();if(!b&&(u("Use --yes to skip confirmation"),!await d(`Delete ${a.length} bucket(s)?`))){console.log("Aborted");return}let f=[],s=[];for(let e of a){let{error:i}=await j(e,{config:y});i?(c(n,i.message,{name:e}),s.push({name:e,error:i.message})):(f.push(e),g(n,{name:e}))}k==="json"&&console.log(JSON.stringify({action:"deleted",names:f,errors:s})),s.length>0&&process.exit(1)}export{h as default};
@@ -1 +1 @@
1
- import{a as u}from"../../chunk-WIOXQDND.js";import{a as i,b as p,c as r,g as m}from"../../chunk-SYGTCM6P.js";import{f as s}from"../../chunk-CQCBYE3X.js";import{a as o}from"../../chunk-JRALYIRA.js";import{b as c}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getBucketInfo as b}from"@tigrisdata/storage";var t=m("buckets","get");async function x(n){i(t);let e=o(n,["name"]),f=o(n,["format"])||"table";e||(r(t,"Bucket name is required"),process.exit(1));let{data:g,error:a}=await b(e,{config:await c()});a&&(r(t,a.message),process.exit(1));let l=[{property:"Name",value:e},...u(g).map(({label:y,value:d})=>({property:y,value:d}))],k=s(l,f,"bucket","property",[{key:"property",header:"Property"},{key:"value",header:"Value"}]);console.log(k),p(t)}export{x as default};
1
+ import{a as f}from"../../chunk-WIOXQDND.js";import{f as m}from"../../chunk-CQCBYE3X.js";import{a as t}from"../../chunk-JRALYIRA.js";import{b as c}from"../../chunk-BQX7MWWL.js";import{a as i,b as s,c as n,h as p}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getBucketInfo as b}from"@tigrisdata/storage";var o=p("buckets","get");async function j(e){i(o);let r=t(e,["name"]),u=t(e,["json"])?"json":t(e,["format","f","F"])||"table";r||(n(o,"Bucket name is required"),process.exit(1));let{data:g,error:a}=await b(r,{config:await c()});a&&(n(o,a.message),process.exit(1));let l=[{property:"Name",value:r},...f(g).map(({label:y,value:d})=>({property:y,value:d}))],k=m(l,u,"bucket","property",[{key:"property",header:"Property"},{key:"value",header:"Value"}]);console.log(k),s(o)}export{j as default};
@@ -1 +1 @@
1
- import{a as c,b as i,c as r,d as m,g as u}from"../../chunk-SYGTCM6P.js";import{f as g}from"../../chunk-CQCBYE3X.js";import{a as f}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as d}from"@tigrisdata/storage";var t=u("buckets","list");async function b(k){c(t);try{let e=f(k,["format","F"],"table"),{data:o,error:n}=await d({config:await p()});if(n&&(r(t,n.message),process.exit(1)),!o.buckets||o.buckets.length===0){m(t);return}let s=o.buckets.map(a=>({name:a.name,created:a.creationDate})),l=g(s,e,"buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(l),i(t,{count:s.length})}catch(e){e instanceof Error?r(t,e.message):r(t,"An unknown error occurred"),process.exit(1)}}export{b as default};
1
+ import{f as g}from"../../chunk-CQCBYE3X.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as w}from"../../chunk-BQX7MWWL.js";import{a as h,b as k,c as t,d as c,h as y}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as C,getBucketInfo as x}from"@tigrisdata/storage";var e=y("buckets","list");async function D(f){h(e);try{let p=i(f,["json"])?"json":i(f,["format","f","F"],"table"),r=i(f,["forks-of","forksOf"]),m=await w(),{data:o,error:d}=await C({config:m});if(d&&(t(e,d.message),process.exit(1)),!o.buckets||o.buckets.length===0){c(e);return}if(r){let{data:n,error:b}=await x(r,{config:m});if(b&&(t(e,b.message),process.exit(1)),!n.hasForks){c(e);return}let a=[];for(let s of o.buckets){if(s.name===r)continue;let{data:B}=await x(s.name,{config:m});B?.sourceBucketName===r&&a.push({name:s.name,created:s.creationDate})}if(a.length===0){c(e);return}let O=g(a,p,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(O),k(e,{count:a.length});return}let l=o.buckets.map(n=>({name:n.name,created:n.creationDate})),j=g(l,p,"buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(j),k(e,{count:l.length})}catch(u){u instanceof Error?t(e,u.message):t(e,"An unknown error occurred"),process.exit(1)}}export{D as default};
@@ -1 +1 @@
1
- import{a as p,b,c as t,g as h}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as w}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as x}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketCors as C}from"@tigrisdata/storage";var n=h("buckets","set-cors");async function N(r){p(n);let i=e(r,["name"]),o=e(r,["origins"]),d=e(r,["methods"]),a=e(r,["headers"]),c=e(r,["expose-headers","exposeHeaders"]),s=e(r,["max-age","maxAge"]),f=e(r,["override"]),g=e(r,["reset"]);i||(t(n,"Bucket name is required"),process.exit(1)),g&&(o!==void 0||d!==void 0||a!==void 0||c!==void 0||s!==void 0||f)&&(t(n,"Cannot use --reset with other options"),process.exit(1)),!g&&!o&&(t(n,"Provide --origins or --reset"),process.exit(1)),s!==void 0&&(isNaN(Number(s))||Number(s)<=0)&&(t(n,"--max-age must be a positive number"),process.exit(1));let m=await w(),u=x(),v={...m,...u&&!m.organizationId?{organizationId:u}:{}},{error:l}=await C(i,{rules:g?[]:[{allowedOrigins:o,...d!==void 0?{allowedMethods:d}:{},...a!==void 0?{allowedHeaders:a}:{},...c!==void 0?{exposeHeaders:c}:{},maxAge:s!==void 0?Number(s):3600}],override:f??!1,config:v});l&&(t(n,l.message),process.exit(1)),b(n,{name:i})}export{N as default};
1
+ import{a as e}from"../../chunk-JRALYIRA.js";import{b as w}from"../../chunk-BQX7MWWL.js";import{a as x,b as p,c as t,h as b}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketCors as C}from"@tigrisdata/storage";var n=b("buckets","set-cors");async function N(r){x(n);let i=e(r,["name"]),o=e(r,["origins"]),d=e(r,["methods"]),a=e(r,["headers"]),c=e(r,["expose-headers","exposeHeaders"]),s=e(r,["max-age","maxAge"]),f=e(r,["override"]),g=e(r,["reset"]);i||(t(n,"Bucket name is required"),process.exit(1)),g&&(o!==void 0||d!==void 0||a!==void 0||c!==void 0||s!==void 0||f)&&(t(n,"Cannot use --reset with other options"),process.exit(1)),!g&&!o&&(t(n,"Provide --origins or --reset"),process.exit(1)),s!==void 0&&(isNaN(Number(s))||Number(s)<=0)&&(t(n,"--max-age must be a positive number"),process.exit(1));let m=await w(),u=h(),v={...m,...u&&!m.organizationId?{organizationId:u}:{}},{error:l}=await C(i,{rules:g?[]:[{allowedOrigins:o,...d!==void 0?{allowedMethods:d}:{},...a!==void 0?{allowedHeaders:a}:{},...c!==void 0?{exposeHeaders:c}:{},maxAge:s!==void 0?Number(s):3600}],override:f??!1,config:v});l&&(t(n,l.message),process.exit(1)),p(n,{name:i})}export{N as default};
@@ -0,0 +1 @@
1
+ import{a as k,b as L}from"../../chunk-TD2HGNDY.js";import{a as d}from"../../chunk-S77OAN6Y.js";import{a as r}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-BQX7MWWL.js";import{a as g,b as p,c as o,h as f}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as u}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{updateBucket as B}from"@tigrisdata/storage";var t=f("buckets","set-locations");async function S(n){g(t);let i=r(n,["name"]),s=r(n,["locations"]);i||(o(t,"Bucket name is required"),process.exit(1));let e;if(s!==void 0)e=L(s);else{d("Provide --locations flag");try{e=await k()}catch(w){o(t,w.message),process.exit(1)}}let a=await l(),c=u(),x={...a,...c&&!a.organizationId?{organizationId:c}:{}},{error:m}=await B(i,{locations:e,config:x});m&&(o(t,m.message),process.exit(1)),p(t,{name:i})}export{S as default};
@@ -1 +1 @@
1
- import{a as w,b as d,c as i,g as y}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as x}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketMigration as K}from"@tigrisdata/storage";var n=y("buckets","set-migration");async function M(t){w(n);let r=e(t,["name"]),o=e(t,["bucket"]),s=e(t,["endpoint"]),a=e(t,["region"]),c=e(t,["access-key","accessKey"]),g=e(t,["secret-key","secretKey"]),f=e(t,["write-through","writeThrough"]),u=e(t,["disable"]);r||(i(n,"Bucket name is required"),process.exit(1)),u&&(o!==void 0||s!==void 0||a!==void 0||c!==void 0||g!==void 0||f!==void 0)&&(i(n,"Cannot use --disable with other migration options"),process.exit(1));let m=await x(),l=h(),p={...m,...l&&!m.organizationId?{organizationId:l}:{}};if(u){let{error:k}=await K(r,{dataMigration:{enabled:!1},config:p});k&&(i(n,k.message),process.exit(1)),d(n,{name:r});return}(!o||!s||!a||!c||!g)&&(i(n,"Required: --bucket, --endpoint, --region, --access-key, --secret-key"),process.exit(1));let{error:b}=await K(r,{dataMigration:{enabled:!0,accessKey:c,secretKey:g,region:a,name:o,endpoint:s,writeThrough:f??!1},config:p});b&&(i(n,b.message),process.exit(1)),d(n,{name:r})}export{M as default};
1
+ import{a as e}from"../../chunk-JRALYIRA.js";import{b as x}from"../../chunk-BQX7MWWL.js";import{a as h,b as d,c as i,h as w}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as y}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketMigration as K}from"@tigrisdata/storage";var n=w("buckets","set-migration");async function M(t){h(n);let r=e(t,["name"]),o=e(t,["bucket"]),s=e(t,["endpoint"]),a=e(t,["region"]),c=e(t,["access-key","accessKey"]),g=e(t,["secret-key","secretKey"]),f=e(t,["write-through","writeThrough"]),u=e(t,["disable"]);r||(i(n,"Bucket name is required"),process.exit(1)),u&&(o!==void 0||s!==void 0||a!==void 0||c!==void 0||g!==void 0||f!==void 0)&&(i(n,"Cannot use --disable with other migration options"),process.exit(1));let m=await x(),l=y(),p={...m,...l&&!m.organizationId?{organizationId:l}:{}};if(u){let{error:k}=await K(r,{dataMigration:{enabled:!1},config:p});k&&(i(n,k.message),process.exit(1)),d(n,{name:r});return}(!o||!s||!a||!c||!g)&&(i(n,"Required: --bucket, --endpoint, --region, --access-key, --secret-key"),process.exit(1));let{error:b}=await K(r,{dataMigration:{enabled:!0,accessKey:c,secretKey:g,region:a,name:o,endpoint:s,writeThrough:f??!1},config:p});b&&(i(n,b.message),process.exit(1)),d(n,{name:r})}export{M as default};
@@ -1 +1 @@
1
- import{a as k,b as w,c as i,g as x}from"../../chunk-SYGTCM6P.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as C}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketNotifications as N}from"@tigrisdata/storage";var t=x("buckets","set-notifications");async function O(n){k(t);let c=e(n,["name"]),d=e(n,["url"]),f=e(n,["filter"]),a=e(n,["token"]),o=e(n,["username"]),s=e(n,["password"]),l=e(n,["enable"]),g=e(n,["disable"]),u=e(n,["reset"]);c||(i(t,"Bucket name is required"),process.exit(1)),[l,g,u].filter(Boolean).length>1&&(i(t,"Only one of --enable, --disable, or --reset can be used"),process.exit(1)),u&&(d!==void 0||f!==void 0||a!==void 0||o!==void 0||s!==void 0)&&(i(t,"Cannot use --reset with other options"),process.exit(1)),!l&&!g&&!u&&d===void 0&&f===void 0&&a===void 0&&o===void 0&&s===void 0&&(i(t,"Provide at least one option"),process.exit(1)),a&&(o!==void 0||s!==void 0)&&(i(t,"Cannot use --token with --username/--password. Choose one auth method"),process.exit(1)),(o!==void 0&&s===void 0||o===void 0&&s!==void 0)&&(i(t,"Both --username and --password are required"),process.exit(1));let m=await C(),p=h(),B={...m,...p&&!m.organizationId?{organizationId:p}:{}},r;u?r={}:(r={...l?{enabled:!0}:{},...g?{enabled:!1}:{},...d!==void 0?{url:d}:{},...f!==void 0?{filter:f}:{}},a?r={...r,auth:{token:a}}:o&&s&&(r={...r,auth:{username:o,password:s}}));let{error:b}=await N(c,{notificationConfig:r,config:B});b&&(i(t,b.message),process.exit(1)),w(t,{name:c})}export{O as default};
1
+ import{a as e}from"../../chunk-JRALYIRA.js";import{b as C}from"../../chunk-BQX7MWWL.js";import{a as h,b as k,c as i,h as w}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as x}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketNotifications as N}from"@tigrisdata/storage";var t=w("buckets","set-notifications");async function O(n){h(t);let c=e(n,["name"]),d=e(n,["url"]),f=e(n,["filter"]),a=e(n,["token"]),o=e(n,["username"]),s=e(n,["password"]),l=e(n,["enable"]),g=e(n,["disable"]),u=e(n,["reset"]);c||(i(t,"Bucket name is required"),process.exit(1)),[l,g,u].filter(Boolean).length>1&&(i(t,"Only one of --enable, --disable, or --reset can be used"),process.exit(1)),u&&(d!==void 0||f!==void 0||a!==void 0||o!==void 0||s!==void 0)&&(i(t,"Cannot use --reset with other options"),process.exit(1)),!l&&!g&&!u&&d===void 0&&f===void 0&&a===void 0&&o===void 0&&s===void 0&&(i(t,"Provide at least one option"),process.exit(1)),a&&(o!==void 0||s!==void 0)&&(i(t,"Cannot use --token with --username/--password. Choose one auth method"),process.exit(1)),(o!==void 0&&s===void 0||o===void 0&&s!==void 0)&&(i(t,"Both --username and --password are required"),process.exit(1));let m=await C(),p=x(),B={...m,...p&&!m.organizationId?{organizationId:p}:{}},r;u?r={}:(r={...l?{enabled:!0}:{},...g?{enabled:!1}:{},...d!==void 0?{url:d}:{},...f!==void 0?{filter:f}:{}},a?r={...r,auth:{token:a}}:o&&s&&(r={...r,auth:{username:o,password:s}}));let{error:b}=await N(c,{notificationConfig:r,config:B});b&&(i(t,b.message),process.exit(1)),k(t,{name:c})}export{O as default};
@@ -1 +1 @@
1
- import{a as m,b,c as s,g as p}from"../../chunk-SYGTCM6P.js";import{a as n}from"../../chunk-JRALYIRA.js";import{b as y}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketLifecycle as R}from"@tigrisdata/storage";var e=p("buckets","set-transition"),x=["STANDARD_IA","GLACIER","GLACIER_IR"];async function S(a){m(e);let d=n(a,["name"]),o=n(a,["storage-class","storageClass"]),i=n(a,["days"]),t=n(a,["date"]),c=n(a,["enable"]),r=n(a,["disable"]);d||(s(e,"Bucket name is required"),process.exit(1)),c&&r&&(s(e,"Cannot use both --enable and --disable"),process.exit(1)),r&&(i!==void 0||t!==void 0||o!==void 0)&&(s(e,"Cannot use --disable with --days, --date, or --storage-class"),process.exit(1)),!c&&!r&&i===void 0&&t===void 0&&(s(e,"Provide --days, --date, --enable, or --disable"),process.exit(1)),(i!==void 0||t!==void 0)&&!o&&(s(e,"--storage-class is required when setting --days or --date"),process.exit(1)),o&&!x.includes(o)&&(s(e,`--storage-class must be one of: ${x.join(", ")} (STANDARD is not a valid transition target)`),process.exit(1)),i!==void 0&&(isNaN(Number(i))||Number(i)<=0)&&(s(e,"--days must be a positive number"),process.exit(1)),t!==void 0&&(typeof t!="string"||!/^\d{4}-\d{2}-\d{2}/.test(t)||isNaN(new Date(t).getTime()))&&(s(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)"),process.exit(1));let f=await y(),l=g(),C={...f,...l&&!f.organizationId?{organizationId:l}:{}},N={...c?{enabled:!0}:{},...r?{enabled:!1}:{},...o?{storageClass:o}:{},...i!==void 0?{days:Number(i)}:{},...t!==void 0?{date:t}:{}},{error:u}=await R(d,{lifecycleRules:[N],config:C});u&&(s(e,u.message),process.exit(1)),b(e,{name:d})}export{S as default};
1
+ import{a as n}from"../../chunk-JRALYIRA.js";import{b as y}from"../../chunk-BQX7MWWL.js";import{a as g,b as m,c as s,h as b}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as p}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketLifecycle as R}from"@tigrisdata/storage";var e=b("buckets","set-transition"),x=["STANDARD_IA","GLACIER","GLACIER_IR"];async function S(a){g(e);let d=n(a,["name"]),o=n(a,["storage-class","storageClass"]),i=n(a,["days"]),t=n(a,["date"]),c=n(a,["enable"]),r=n(a,["disable"]);d||(s(e,"Bucket name is required"),process.exit(1)),c&&r&&(s(e,"Cannot use both --enable and --disable"),process.exit(1)),r&&(i!==void 0||t!==void 0||o!==void 0)&&(s(e,"Cannot use --disable with --days, --date, or --storage-class"),process.exit(1)),!c&&!r&&i===void 0&&t===void 0&&(s(e,"Provide --days, --date, --enable, or --disable"),process.exit(1)),(i!==void 0||t!==void 0)&&!o&&(s(e,"--storage-class is required when setting --days or --date"),process.exit(1)),o&&!x.includes(o)&&(s(e,`--storage-class must be one of: ${x.join(", ")} (STANDARD is not a valid transition target)`),process.exit(1)),i!==void 0&&(isNaN(Number(i))||Number(i)<=0)&&(s(e,"--days must be a positive number"),process.exit(1)),t!==void 0&&(typeof t!="string"||!/^\d{4}-\d{2}-\d{2}/.test(t)||isNaN(new Date(t).getTime()))&&(s(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)"),process.exit(1));let f=await y(),l=p(),C={...f,...l&&!f.organizationId?{organizationId:l}:{}},N={...c?{enabled:!0}:{},...r?{enabled:!1}:{},...o?{storageClass:o}:{},...i!==void 0?{days:Number(i)}:{},...t!==void 0?{date:t}:{}},{error:u}=await R(d,{lifecycleRules:[N],config:C});u&&(s(e,u.message),process.exit(1)),m(e,{name:d})}export{S as default};
@@ -1 +1 @@
1
- import{a as g,b as m,c as n,g as b}from"../../chunk-SYGTCM6P.js";import{a as s}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as l}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketTtl as N}from"@tigrisdata/storage";var e=b("buckets","set-ttl");async function w(a){g(e);let d=s(a,["name"]),i=s(a,["days"]),t=s(a,["date"]),r=s(a,["enable"]),o=s(a,["disable"]);d||(n(e,"Bucket name is required"),process.exit(1)),r&&o&&(n(e,"Cannot use both --enable and --disable"),process.exit(1)),o&&(i!==void 0||t!==void 0)&&(n(e,"Cannot use --disable with --days or --date"),process.exit(1)),!r&&!o&&i===void 0&&t===void 0&&(n(e,"Provide --days, --date, --enable, or --disable"),process.exit(1)),i!==void 0&&(isNaN(Number(i))||Number(i)<=0)&&(n(e,"--days must be a positive number"),process.exit(1)),t!==void 0&&(typeof t!="string"||!/^\d{4}-\d{2}-\d{2}/.test(t)||isNaN(new Date(t).getTime()))&&(n(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)"),process.exit(1));let c=await p(),f=l(),x={...c,...f&&!c.organizationId?{organizationId:f}:{}},y={...r?{enabled:!0}:{},...o?{enabled:!1}:{},...i!==void 0?{days:Number(i)}:{},...t!==void 0?{date:t}:{}},{error:u}=await N(d,{ttlConfig:y,config:x});u&&(n(e,u.message),process.exit(1)),m(e,{name:d})}export{w as default};
1
+ import{a as s}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-BQX7MWWL.js";import{a as l,b as g,c as n,h as m}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as b}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketTtl as N}from"@tigrisdata/storage";var e=m("buckets","set-ttl");async function w(a){l(e);let d=s(a,["name"]),i=s(a,["days"]),t=s(a,["date"]),r=s(a,["enable"]),o=s(a,["disable"]);d||(n(e,"Bucket name is required"),process.exit(1)),r&&o&&(n(e,"Cannot use both --enable and --disable"),process.exit(1)),o&&(i!==void 0||t!==void 0)&&(n(e,"Cannot use --disable with --days or --date"),process.exit(1)),!r&&!o&&i===void 0&&t===void 0&&(n(e,"Provide --days, --date, --enable, or --disable"),process.exit(1)),i!==void 0&&(isNaN(Number(i))||Number(i)<=0)&&(n(e,"--days must be a positive number"),process.exit(1)),t!==void 0&&(typeof t!="string"||!/^\d{4}-\d{2}-\d{2}/.test(t)||isNaN(new Date(t).getTime()))&&(n(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)"),process.exit(1));let c=await p(),f=b(),x={...c,...f&&!c.organizationId?{organizationId:f}:{}},y={...r?{enabled:!0}:{},...o?{enabled:!1}:{},...i!==void 0?{days:Number(i)}:{},...t!==void 0?{date:t}:{}},{error:u}=await N(d,{ttlConfig:y,config:x});u&&(n(e,u.message),process.exit(1)),g(e,{name:d})}export{w as default};
@@ -1 +1 @@
1
- import{a as k,b as A,c,g as h}from"../../chunk-SYGTCM6P.js";import{c as x}from"../../chunk-Q4KOY3VK.js";import{a as e,b as o}from"../../chunk-JRALYIRA.js";import{b as y}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as O}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{updateBucket as C}from"@tigrisdata/storage";var a=h("buckets","set");async function S(n){k(a);let s=e(n,["name"]),r=e(n,["access"]),i=e(n,["locations"]),b=e(n,["region"]);b!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),i===void 0&&(i=b));let d=e(n,["allow-object-acl","allowObjectAcl"]),l=e(n,["disable-directory-listing","disableDirectoryListing"]),f=e(n,["cache-control","cacheControl"]),u=e(n,["custom-domain","customDomain"]),g=e(n,["enable-delete-protection","enableDeleteProtection"]),m=e(n,["enable-additional-headers","enableAdditionalHeaders"]);s||(c(a,"Bucket name is required"),process.exit(1)),r===void 0&&i===void 0&&d===void 0&&l===void 0&&f===void 0&&u===void 0&&g===void 0&&m===void 0&&(c(a,"At least one setting is required"),process.exit(1));let p=await y(),t={};r!==void 0&&(t.access=r),i!==void 0&&(t.locations=x(i)),d!==void 0&&(t.allowObjectAcl=o(d)),l!==void 0&&(t.disableDirectoryListing=o(l)),f!==void 0&&(t.cacheControl=f),u!==void 0&&(t.customDomain=u),g!==void 0&&(t.enableDeleteProtection=o(g)),m!==void 0&&(t.enableAdditionalHeaders=o(m));let w=O(),B={...p,...w&&!p.organizationId?{organizationId:w}:{}},{error:D}=await C(s,{...t,config:B});D&&(c(a,D.message),process.exit(1)),A(a,{name:s})}export{S as default};
1
+ import{b as h}from"../../chunk-TD2HGNDY.js";import"../../chunk-S77OAN6Y.js";import{a as e,b as o}from"../../chunk-JRALYIRA.js";import{b as A}from"../../chunk-BQX7MWWL.js";import{a as j,b as D,c,h as k}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as y}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{updateBucket as B}from"@tigrisdata/storage";var a=k("buckets","set");async function C(n){j(a);let S=e(n,["json"])?"json":e(n,["format"],"table"),s=e(n,["name"]),r=e(n,["access"]),i=e(n,["locations"]),b=e(n,["region"]);b!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),i===void 0&&(i=b));let d=e(n,["allow-object-acl","allowObjectAcl"]),l=e(n,["disable-directory-listing","disableDirectoryListing"]),f=e(n,["cache-control","cacheControl"]),g=e(n,["custom-domain","customDomain"]),u=e(n,["enable-delete-protection","enableDeleteProtection"]),m=e(n,["enable-additional-headers","enableAdditionalHeaders"]);s||(c(a,"Bucket name is required"),process.exit(1)),r===void 0&&i===void 0&&d===void 0&&l===void 0&&f===void 0&&g===void 0&&u===void 0&&m===void 0&&(c(a,"At least one setting is required"),process.exit(1));let p=await A(),t={};r!==void 0&&(t.access=r),i!==void 0&&(t.locations=h(i)),d!==void 0&&(t.allowObjectAcl=o(d)),l!==void 0&&(t.disableDirectoryListing=o(l)),f!==void 0&&(t.cacheControl=f),g!==void 0&&(t.customDomain=g),u!==void 0&&(t.enableDeleteProtection=o(u)),m!==void 0&&(t.enableAdditionalHeaders=o(m));let w=y(),x={...p,...w&&!p.organizationId?{organizationId:w}:{}},{error:O}=await B(s,{...t,config:x});O&&(c(a,O.message),process.exit(1)),S==="json"&&console.log(JSON.stringify({action:"updated",name:s})),D(a,{name:s})}export{C as default};
@@ -1 +1 @@
1
- import{a as g,b as p,c as n,g as m}from"../../chunk-SYGTCM6P.js";import"../../chunk-BETAO4PB.js";import{n as u,r as y}from"../../chunk-DOUR5YEY.js";import{a as d}from"../../chunk-2XAO2OYD.js";import f from"enquirer";var{prompt:l}=f,i=m("configure");async function o(e){g(i);let s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,c=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret,r=e.endpoint||e.e||e.E||e.Endpoint;if(!s||!c||!r){let t=[];s||t.push({type:"input",name:"accessKey",message:"Tigris Access Key ID:",required:!0}),c||t.push({type:"password",name:"accessSecret",message:"Tigris Secret Access Key:",required:!0}),r||t.push({type:"input",name:"endpoint",message:"Tigris Endpoint:",required:!0,initial:d});let a=await l(t);s=s||a.accessKey,c=c||a.accessSecret,r=r||a.endpoint}(!s||!c||!r)&&(n(i,"All credentials are required"),process.exit(1));try{await u({accessKeyId:s,secretAccessKey:c,endpoint:r}),await y("credentials"),p(i)}catch{n(i,"Failed to save credentials"),process.exit(1)}}export{o as default};
1
+ import{a as o}from"../../chunk-S77OAN6Y.js";import{a as d,b as u,c as n,h as p}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import{n as m,r as g}from"../../chunk-DOUR5YEY.js";import{a as y}from"../../chunk-2XAO2OYD.js";import f from"enquirer";var{prompt:l}=f,i=p("configure");async function K(e){d(i);let s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,c=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret,r=e.endpoint||e.e||e.E||e.Endpoint;if(!s||!c||!r){let t=[];s||t.push({type:"input",name:"accessKey",message:"Tigris Access Key ID:",required:!0}),c||t.push({type:"password",name:"accessSecret",message:"Tigris Secret Access Key:",required:!0}),r||t.push({type:"input",name:"endpoint",message:"Tigris Endpoint:",required:!0,initial:y}),o("Provide --access-key, --access-secret, and --endpoint");let a=await l(t);s=s||a.accessKey,c=c||a.accessSecret,r=r||a.endpoint}(!s||!c||!r)&&(n(i,"All credentials are required"),process.exit(1));try{await m({accessKeyId:s,secretAccessKey:c,endpoint:r}),await g("credentials"),u(i)}catch{n(i,"Failed to save credentials"),process.exit(1)}}export{K as default};
package/dist/lib/cp.js CHANGED
@@ -1 +1 @@
1
- import{a as N}from"../chunk-EKW6XTGL.js";import{a as C}from"../chunk-SAAGVLRE.js";import{a as b}from"../chunk-CQCBYE3X.js";import{a as D}from"../chunk-JRALYIRA.js";import{a as U,b as S,d as v,g as T,h as B,i as I}from"../chunk-LCWHZUZZ.js";import{b as O}from"../chunk-VOQSWXBS.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{createReadStream as Z,createWriteStream as _,statSync as M,readdirSync as z,mkdirSync as P,existsSync as J}from"fs";import{resolve as q,dirname as K,basename as E,join as F,relative as G}from"path";import{homedir as ee}from"os";import{Readable as Q}from"stream";import{pipeline as te}from"stream/promises";import{get as V,put as L,list as oe,head as X}from"@tigrisdata/storage";function re(r,e){let t=U(r),a=U(e);return!t&&!a&&(console.error("At least one path must be a remote Tigris path (t3:// or tigris://)"),process.exit(1)),t&&a?"remote-to-remote":t?"remote-to-local":"local-to-remote"}function Y(r){return r==="~"||r.startsWith("~/")?q(ee(),r.slice(2)):q(r)}function ne(r){return z(r,{recursive:!0,withFileTypes:!0}).filter(t=>t.isFile()).map(t=>{let a=t.parentPath??t.path;return F(a,t.name)})}function ie(r,e){let t=K(r),a=E(r),l=T(a);return J(t)?e?z(t,{recursive:!0,withFileTypes:!0}).filter(o=>o.isFile()&&l.test(o.name)).map(o=>{let i=o.parentPath??o.path;return F(i,o.name)}):z(t,{withFileTypes:!0}).filter(i=>i.isFile()&&l.test(i.name)).map(i=>F(t,i.name)):[]}async function j(r,e,t,a,l=!1){let c;try{c=M(r).size}catch{return{error:`File not found: ${r}`}}let o=Z(r),i=Q.toWeb(o),{error:n}=await L(t,i,{...N(c),onUploadProgress:l?({loaded:s})=>{if(c!==void 0&&c>0){let p=Math.round(s/c*100);process.stdout.write(`\rUploading: ${b(s)} / ${b(c)} (${p}%)`)}else process.stdout.write(`\rUploading: ${b(s)}`)}:void 0,config:{...a,bucket:e}});return l&&process.stdout.write("\r"+" ".repeat(60)+"\r"),n?{error:n.message}:{}}async function H(r,e,t,a,l=!1){let c;if(l){let{data:u}=await X(e,{config:{...a,bucket:r}});c=u?.size}let{data:o,error:i}=await V(e,"stream",{config:{...a,bucket:r}});if(i)return{error:i.message};let n=K(t);J(n)||P(n,{recursive:!0});let s=_(t),p=Q.fromWeb(o);if(l&&c!==void 0&&c>0){let u=0;p.on("data",f=>{u+=f.length;let m=Math.round(u/c*100);process.stdout.write(`\rDownloading: ${b(u)} / ${b(c)} (${m}%)`)})}return await te(p,s),l&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function A(r,e,t,a,l,c=!1){if(t.endsWith("/")){let{error:p}=await L(l,"",{config:{...r,bucket:a}});return p?{error:p.message}:{}}let o;if(c){let{data:p}=await X(t,{config:{...r,bucket:e}});o=p?.size}let{data:i,error:n}=await V(t,"stream",{config:{...r,bucket:e}});if(n)return{error:n.message};let{error:s}=await L(l,i,{...N(o),onUploadProgress:c?({loaded:p})=>{if(o!==void 0&&o>0){let u=Math.round(p/o*100);process.stdout.write(`\rCopying: ${b(p)} / ${b(o)} (${u}%)`)}else process.stdout.write(`\rCopying: ${b(p)}`)}:void 0,config:{...r,bucket:a}});return c&&process.stdout.write("\r"+" ".repeat(60)+"\r"),s?{error:s.message}:{}}async function ae(r,e,t,a){let l=Y(r);if(r.includes("*")){let i=ie(l,a);if(i.length===0){console.log("No files matching pattern");return}let n=K(l),s=i.map(f=>async()=>{let m=G(n,f),w=e.path?`${e.path.replace(/\/$/,"")}/${m}`:m,d=await j(f,e.bucket,w,t);return d.error?(console.error(`Failed to upload ${f}: ${d.error}`),!1):(console.log(`Uploaded ${f} -> t3://${e.bucket}/${w}`),!0)}),u=(await C(s,8)).filter(Boolean).length;console.log(`Uploaded ${u} file(s)`);return}let o;try{o=M(l)}catch{console.error(`Source not found: ${r}`),process.exit(1)}if(o.isDirectory()){a||(console.error(`${r} is a directory (not copied). Use -r to copy recursively.`),process.exit(1));let i=ne(l);if(i.length===0){console.log("No files to upload");return}let n=r.endsWith("/")?"":E(l),s=i.map(f=>async()=>{let m=G(l,f),d=[e.path?.replace(/\/$/,""),n,m].filter(Boolean).join("/"),W=await j(f,e.bucket,d,t);return W.error?(console.error(`Failed to upload ${f}: ${W.error}`),!1):(console.log(`Uploaded ${f} -> t3://${e.bucket}/${d}`),!0)}),u=(await C(s,8)).filter(Boolean).length;console.log(`Uploaded ${u} file(s)`)}else{let i=E(l),n;e.path?r.endsWith("/")||e.path.endsWith("/")?n=`${e.path.replace(/\/$/,"")}/${i}`:await v(e.bucket,e.path,t)?n=`${e.path}/${i}`:n=e.path:n=i;let s=await j(l,e.bucket,n,t,!0);s.error&&(console.error(s.error),process.exit(1)),console.log(`Uploaded ${r} -> t3://${e.bucket}/${n}`)}}async function se(r,e,t,a,l){let c=r.endsWith("/");!e.path&&!c&&(console.error("Cannot copy a bucket. Provide a path within the bucket."),process.exit(1));let o=Y(t),i=e.path.includes("*"),n=e.path.endsWith("/")||!e.path&&c;if(!i&&!n&&(n=await v(e.bucket,e.path,a)),n&&!i&&!l&&(console.error("Source is a remote folder (not copied). Use -r to copy recursively."),process.exit(1)),i||n){let s=i?B(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",p=!i&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",{items:u,error:f}=await I(e.bucket,s||void 0,a);f&&(console.error(f.message),process.exit(1));let m=u.filter(g=>!g.name.endsWith("/"));if(i){let g=e.path.split("/").pop(),$=T(g);m=m.filter(y=>{let h=s?y.name.slice(s.length):y.name;return!l&&h.includes("/")?!1:$.test(h.split("/").pop())})}if(m.length===0){console.log("No objects to download");return}let w=m.map(g=>async()=>{let $=s?g.name.slice(s.length):g.name,y=p?F(o,p,$):F(o,$),h=await H(e.bucket,g.name,y,a);return h.error?(console.error(`Failed to download ${g.name}: ${h.error}`),!1):(console.log(`Downloaded t3://${e.bucket}/${g.name} -> ${y}`),!0)}),W=(await C(w,8)).filter(Boolean).length;console.log(`Downloaded ${W} file(s)`)}else{let s=e.path.split("/").pop(),p,u=!1;try{u=M(o).isDirectory()}catch{}u||t.endsWith("/")?p=F(o,s):p=o;let f=await H(e.bucket,e.path,p,a,!0);f.error&&(console.error(f.error),process.exit(1)),console.log(`Downloaded t3://${e.bucket}/${e.path} -> ${p}`)}}async function le(r,e,t,a,l){let c=r.endsWith("/");!e.path&&!c&&(console.error("Cannot copy a bucket. Provide a path within the bucket."),process.exit(1));let o=r.includes("*"),i=e.path.endsWith("/")||!e.path&&c;if(!o&&!i&&e.path&&(i=await v(e.bucket,e.path,a)),i&&!o&&!l&&(console.error("Source is a remote folder (not copied). Use -r to copy recursively."),process.exit(1)),o||i){let n=o?B(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",s=!o&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",u=[t.path?.replace(/\/$/,"")||"",s].filter(Boolean).join("/"),f=u?`${u}/`:"";e.bucket===t.bucket&&n===f&&(console.error("Source and destination are the same"),process.exit(1));let{items:m,error:w}=await I(e.bucket,n||void 0,a);w&&(console.error(w.message),process.exit(1));let d=m.filter(h=>h.name!==n);if(o){let h=e.path.split("/").pop(),k=T(h);d=d.filter(x=>{let R=n?x.name.slice(n.length):x.name;return!l&&R.includes("/")?!1:k.test(R.split("/").pop())})}let W=d.map(h=>async()=>{let k=n?h.name.slice(n.length):h.name,x=u?`${u}/${k}`:k,R=await A(a,e.bucket,h.name,t.bucket,x);return R.error?(console.error(`Failed to copy ${h.name}: ${R.error}`),!1):(console.log(`Copied t3://${e.bucket}/${h.name} -> t3://${t.bucket}/${x}`),!0)}),$=(await C(W,8)).filter(Boolean).length,y=!1;if(u&&n){let{data:h}=await oe({prefix:n,limit:1,config:{...a,bucket:e.bucket}});if(h?.items?.some(k=>k.name===n)){let k=`${u}/`,x=await A(a,e.bucket,n,t.bucket,k);x.error?console.error(`Failed to copy folder marker: ${x.error}`):y=!0}}if($===0&&y&&($=1),$===0){console.log("No objects to copy");return}console.log(`Copied ${$} object(s)`)}else{let n=e.path.split("/").pop(),s;t.path?t.path.endsWith("/")?s=`${t.path}${n}`:await v(t.bucket,t.path,a)?s=`${t.path}/${n}`:s=t.path:s=n,e.bucket===t.bucket&&e.path===s&&(console.error("Source and destination are the same"),process.exit(1));let p=await A(a,e.bucket,e.path,t.bucket,s,!0);p.error&&(console.error(p.error),process.exit(1)),console.log(`Copied t3://${e.bucket}/${e.path} -> t3://${t.bucket}/${s}`)}}async function ce(r){let e=D(r,["src"]),t=D(r,["dest"]);(!e||!t)&&(console.error("Both src and dest arguments are required"),process.exit(1));let a=!!D(r,["recursive","r"]),l=re(e,t),c=await O({withCredentialProvider:!0});switch(l){case"local-to-remote":{let o=S(t);o.bucket||(console.error("Invalid destination path"),process.exit(1)),await ae(e,o,c,a);break}case"remote-to-local":{let o=S(e);o.bucket||(console.error("Invalid source path"),process.exit(1)),await se(e,o,t,c,a);break}case"remote-to-remote":{let o=S(e),i=S(t);o.bucket||(console.error("Invalid source path"),process.exit(1)),i.bucket||(console.error("Invalid destination path"),process.exit(1)),await le(e,o,i,c,a);break}}process.exit(0)}export{ce as default};
1
+ import{a as J}from"../chunk-EKW6XTGL.js";import{a as T}from"../chunk-SAAGVLRE.js";import{a as b}from"../chunk-CQCBYE3X.js";import{a as j,b as v,d as C,g as D,h as O,i as U}from"../chunk-LCWHZUZZ.js";import{a as W}from"../chunk-JRALYIRA.js";import{b as K}from"../chunk-BQX7MWWL.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{createReadStream as Z,createWriteStream as P,statSync as M,readdirSync as A,mkdirSync as ee,existsSync as H}from"fs";import{resolve as q,dirname as L,basename as z,join as R,relative as G}from"path";import{homedir as te}from"os";import{Readable as Q}from"stream";import{pipeline as oe}from"stream/promises";import{get as V,put as E,list as re,head as X}from"@tigrisdata/storage";var m=!1;function ie(r,e){let t=j(r),s=j(e);return!t&&!s&&(console.error("At least one path must be a remote Tigris path (t3:// or tigris://)"),process.exit(1)),t&&s?"remote-to-remote":t?"remote-to-local":"local-to-remote"}function Y(r){return r==="~"||r.startsWith("~/")?q(te(),r.slice(2)):q(r)}function ne(r){return A(r,{recursive:!0,withFileTypes:!0}).filter(t=>t.isFile()).map(t=>{let s=t.parentPath??t.path;return R(s,t.name)})}function ae(r,e){let t=L(r),s=z(r),c=D(s);return H(t)?e?A(t,{recursive:!0,withFileTypes:!0}).filter(a=>a.isFile()&&c.test(a.name)).map(a=>{let i=a.parentPath??a.path;return R(i,a.name)}):A(t,{withFileTypes:!0}).filter(i=>i.isFile()&&c.test(i.name)).map(i=>R(t,i.name)):[]}async function B(r,e,t,s,c=!1){let u;try{u=M(r).size}catch{return{error:`File not found: ${r}`}}let a=Z(r),i=Q.toWeb(a),{error:o}=await E(t,i,{...J(u),onUploadProgress:c?({loaded:n})=>{if(u!==void 0&&u>0){let l=Math.round(n/u*100);process.stdout.write(`\rUploading: ${b(n)} / ${b(u)} (${l}%)`)}else process.stdout.write(`\rUploading: ${b(n)}`)}:void 0,config:{...s,bucket:e}});return c&&process.stdout.write("\r"+" ".repeat(60)+"\r"),o?{error:o.message}:{}}async function _(r,e,t,s,c=!1){let u;if(c){let{data:p}=await X(e,{config:{...s,bucket:r}});u=p?.size}let{data:a,error:i}=await V(e,"stream",{config:{...s,bucket:r}});if(i)return{error:i.message};let o=L(t);H(o)||ee(o,{recursive:!0});let n=P(t),l=Q.fromWeb(a);if(c&&u!==void 0&&u>0){let p=0;l.on("data",f=>{p+=f.length;let d=Math.round(p/u*100);process.stdout.write(`\rDownloading: ${b(p)} / ${b(u)} (${d}%)`)})}return await oe(l,n),c&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function I(r,e,t,s,c,u=!1){if(t.endsWith("/")){let{error:l}=await E(c,"",{config:{...r,bucket:s}});return l?{error:l.message}:{}}let a;if(u){let{data:l}=await X(t,{config:{...r,bucket:e}});a=l?.size}let{data:i,error:o}=await V(t,"stream",{config:{...r,bucket:e}});if(o)return{error:o.message};let{error:n}=await E(c,i,{...J(a),onUploadProgress:u?({loaded:l})=>{if(a!==void 0&&a>0){let p=Math.round(l/a*100);process.stdout.write(`\rCopying: ${b(l)} / ${b(a)} (${p}%)`)}else process.stdout.write(`\rCopying: ${b(l)}`)}:void 0,config:{...r,bucket:s}});return u&&process.stdout.write("\r"+" ".repeat(60)+"\r"),n?{error:n.message}:{}}async function se(r,e,t,s){let c=Y(r);if(r.includes("*")){let i=ae(c,s);if(i.length===0){console.log(m?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files matching pattern");return}let o=L(c),n=i.map(f=>async()=>{let d=G(o,f),w=e.path?`${e.path.replace(/\/$/,"")}/${d}`:d,g=await B(f,e.bucket,w,t);return g.error?(console.error(`Failed to upload ${f}: ${g.error}`),!1):(m||console.log(`Uploaded ${f} -> t3://${e.bucket}/${w}`),!0)}),p=(await T(n,8)).filter(Boolean).length;console.log(m?JSON.stringify({action:"copied",direction:"local-to-remote",count:p}):`Uploaded ${p} file(s)`);return}let a;try{a=M(c)}catch{console.error(`Source not found: ${r}`),process.exit(1)}if(a.isDirectory()){s||(console.error(`${r} is a directory (not copied). Use -r to copy recursively.`),process.exit(1));let i=ne(c);if(i.length===0){console.log(m?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files to upload");return}let o=r.endsWith("/")?"":z(c),n=i.map(f=>async()=>{let d=G(c,f),g=[e.path?.replace(/\/$/,""),o,d].filter(Boolean).join("/"),F=await B(f,e.bucket,g,t);return F.error?(console.error(`Failed to upload ${f}: ${F.error}`),!1):(m||console.log(`Uploaded ${f} -> t3://${e.bucket}/${g}`),!0)}),p=(await T(n,8)).filter(Boolean).length;console.log(m?JSON.stringify({action:"copied",direction:"local-to-remote",count:p}):`Uploaded ${p} file(s)`)}else{let i=z(c),o;e.path?r.endsWith("/")||e.path.endsWith("/")?o=`${e.path.replace(/\/$/,"")}/${i}`:await C(e.bucket,e.path,t)?o=`${e.path}/${i}`:o=e.path:o=i;let n=await B(c,e.bucket,o,t,!m);n.error&&(console.error(n.error),process.exit(1)),console.log(m?JSON.stringify({action:"copied",direction:"local-to-remote",count:1,src:r,dest:`t3://${e.bucket}/${o}`}):`Uploaded ${r} -> t3://${e.bucket}/${o}`)}}async function le(r,e,t,s,c){let u=r.endsWith("/");!e.path&&!u&&(console.error("Cannot copy a bucket. Provide a path within the bucket."),process.exit(1));let a=Y(t),i=e.path.includes("*"),o=e.path.endsWith("/")||!e.path&&u;if(!i&&!o&&(o=await C(e.bucket,e.path,s)),o&&!i&&!c&&(console.error("Source is a remote folder (not copied). Use -r to copy recursively."),process.exit(1)),i||o){let n=i?O(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",l=!i&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",{items:p,error:f}=await U(e.bucket,n||void 0,s);f&&(console.error(f.message),process.exit(1));let d=p.filter($=>!$.name.endsWith("/"));if(i){let $=e.path.split("/").pop(),y=D($);d=d.filter(k=>{let h=n?k.name.slice(n.length):k.name;return!c&&h.includes("/")?!1:y.test(h.split("/").pop())})}if(d.length===0){console.log(m?JSON.stringify({action:"copied",direction:"remote-to-local",count:0}):"No objects to download");return}let w=d.map($=>async()=>{let y=n?$.name.slice(n.length):$.name,k=l?R(a,l,y):R(a,y),h=await _(e.bucket,$.name,k,s);return h.error?(console.error(`Failed to download ${$.name}: ${h.error}`),!1):(m||console.log(`Downloaded t3://${e.bucket}/${$.name} -> ${k}`),!0)}),F=(await T(w,8)).filter(Boolean).length;console.log(m?JSON.stringify({action:"copied",direction:"remote-to-local",count:F}):`Downloaded ${F} file(s)`)}else{let n=e.path.split("/").pop(),l,p=!1;try{p=M(a).isDirectory()}catch{}p||t.endsWith("/")?l=R(a,n):l=a;let f=await _(e.bucket,e.path,l,s,!m);f.error&&(console.error(f.error),process.exit(1)),console.log(m?JSON.stringify({action:"copied",direction:"remote-to-local",count:1,src:`t3://${e.bucket}/${e.path}`,dest:l}):`Downloaded t3://${e.bucket}/${e.path} -> ${l}`)}}async function ce(r,e,t,s,c){let u=r.endsWith("/");!e.path&&!u&&(console.error("Cannot copy a bucket. Provide a path within the bucket."),process.exit(1));let a=r.includes("*"),i=e.path.endsWith("/")||!e.path&&u;if(!a&&!i&&e.path&&(i=await C(e.bucket,e.path,s)),i&&!a&&!c&&(console.error("Source is a remote folder (not copied). Use -r to copy recursively."),process.exit(1)),a||i){let o=a?O(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",n=!a&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",p=[t.path?.replace(/\/$/,"")||"",n].filter(Boolean).join("/"),f=p?`${p}/`:"";e.bucket===t.bucket&&o===f&&(console.error("Source and destination are the same"),process.exit(1));let{items:d,error:w}=await U(e.bucket,o||void 0,s);w&&(console.error(w.message),process.exit(1));let g=d.filter(h=>h.name!==o);if(a){let h=e.path.split("/").pop(),S=D(h);g=g.filter(x=>{let N=o?x.name.slice(o.length):x.name;return!c&&N.includes("/")?!1:S.test(N.split("/").pop())})}let F=g.map(h=>async()=>{let S=o?h.name.slice(o.length):h.name,x=p?`${p}/${S}`:S,N=await I(s,e.bucket,h.name,t.bucket,x);return N.error?(console.error(`Failed to copy ${h.name}: ${N.error}`),!1):(m||console.log(`Copied t3://${e.bucket}/${h.name} -> t3://${t.bucket}/${x}`),!0)}),y=(await T(F,8)).filter(Boolean).length,k=!1;if(p&&o){let{data:h}=await re({prefix:o,limit:1,config:{...s,bucket:e.bucket}});if(h?.items?.some(S=>S.name===o)){let S=`${p}/`,x=await I(s,e.bucket,o,t.bucket,S);x.error?console.error(`Failed to copy folder marker: ${x.error}`):k=!0}}if(y===0&&k&&(y=1),y===0){console.log(m?JSON.stringify({action:"copied",direction:"remote-to-remote",count:0}):"No objects to copy");return}console.log(m?JSON.stringify({action:"copied",direction:"remote-to-remote",count:y}):`Copied ${y} object(s)`)}else{let o=e.path.split("/").pop(),n;t.path?t.path.endsWith("/")?n=`${t.path}${o}`:await C(t.bucket,t.path,s)?n=`${t.path}/${o}`:n=t.path:n=o,e.bucket===t.bucket&&e.path===n&&(console.error("Source and destination are the same"),process.exit(1));let l=await I(s,e.bucket,e.path,t.bucket,n,!m);l.error&&(console.error(l.error),process.exit(1)),console.log(m?JSON.stringify({action:"copied",direction:"remote-to-remote",count:1,src:`t3://${e.bucket}/${e.path}`,dest:`t3://${t.bucket}/${n}`}):`Copied t3://${e.bucket}/${e.path} -> t3://${t.bucket}/${n}`)}}async function pe(r){let e=W(r,["src"]),t=W(r,["dest"]);(!e||!t)&&(console.error("Both src and dest arguments are required"),process.exit(1));let s=!!W(r,["recursive","r"]);m=(W(r,["json"])?"json":W(r,["format"],"table"))==="json";let a=ie(e,t),i=await K({withCredentialProvider:!0});switch(a){case"local-to-remote":{let o=v(t);o.bucket||(console.error("Invalid destination path"),process.exit(1)),await se(e,o,i,s);break}case"remote-to-local":{let o=v(e);o.bucket||(console.error("Invalid source path"),process.exit(1)),await le(e,o,t,i,s);break}case"remote-to-remote":{let o=v(e),n=v(t);o.bucket||(console.error("Invalid source path"),process.exit(1)),n.bucket||(console.error("Invalid destination path"),process.exit(1)),await ce(e,o,n,i,s);break}}process.exit(0)}export{pe as default};
@@ -1 +1 @@
1
- import{a as f,b as g,c as n,g as u}from"../../chunk-SYGTCM6P.js";import{a as d}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as a}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as m,getBucketInfo as p}from"@tigrisdata/storage";var e=u("credentials","test");async function b(k){f(e);let t=d(k,["bucket","b"]),o=await l();!o.accessKeyId&&!o.sessionToken&&(n(e,'No credentials found. Run "tigris configure" or "tigris login" first.'),process.exit(1));let c=a(),r={...o,...c&&!o.organizationId?{organizationId:c}:{}};if(t){let{data:i,error:s}=await p(t,{config:r});s&&(n(e,`Current credentials don't have access to bucket "${t}"`),process.exit(1)),console.log(` Bucket: ${t}`),console.log(" Access verified."),i.sourceBucketName&&console.log(` Fork of: ${i.sourceBucketName}`)}else{let{data:i,error:s}=await m({config:r});s&&(n(e,"Current credentials don't have sufficient access"),process.exit(1)),console.log(` Access verified. Found ${i.buckets.length} bucket(s).`)}g(e)}export{b as default};
1
+ import{a as c}from"../../chunk-JRALYIRA.js";import{b as m}from"../../chunk-BQX7MWWL.js";import{a as g,b as l,c as n,h as d}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as k}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as p,getBucketInfo as b}from"@tigrisdata/storage";var o=d("credentials","test");async function B(i){g(o);let a=c(i,["json"])?"json":c(i,["format","f","F"],"table"),t=c(i,["bucket","b"]),s=await m();!s.accessKeyId&&!s.sessionToken&&(n(o,'No credentials found. Run "tigris configure" or "tigris login" first.'),process.exit(1));let f=k(),u={...s,...f&&!s.organizationId?{organizationId:f}:{}};if(t){let{data:e,error:r}=await b(t,{config:u});r&&(n(o,`Current credentials don't have access to bucket "${t}"`),process.exit(1)),a==="json"?console.log(JSON.stringify({valid:!0,bucket:t,...e.sourceBucketName?{forkOf:e.sourceBucketName}:{}})):(console.log(` Bucket: ${t}`),console.log(" Access verified."),e.sourceBucketName&&console.log(` Fork of: ${e.sourceBucketName}`))}else{let{data:e,error:r}=await p({config:u});r&&(n(o,"Current credentials don't have sufficient access"),process.exit(1)),console.log(a==="json"?JSON.stringify({valid:!0,bucketCount:e.buckets.length}):` Access verified. Found ${e.buckets.length} bucket(s).`)}l(o)}export{B as default};
@@ -1 +1 @@
1
- import{a as c,b as a,c as r,g as m}from"../../chunk-SYGTCM6P.js";import{a as t}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createBucket as p}from"@tigrisdata/storage";var e=m("forks","create");async function g(o){c(e);let s=t(o,["name"]),n=t(o,["fork-name","forkName"]),u=t(o,["snapshot","s","S"]);s||(r(e,"Source bucket name is required"),process.exit(1)),n||(r(e,"Fork name is required"),process.exit(1));let{error:i}=await p(n,{sourceBucketName:s,sourceBucketSnapshot:u,config:await f()});i&&(r(e,i.message),process.exit(1)),a(e,{name:s,forkName:n})}export{g as default};
1
+ import{a as t}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-BQX7MWWL.js";import{a as c,b as a,c as r,h as m}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createBucket as p}from"@tigrisdata/storage";var e=m("forks","create");async function g(o){c(e);let s=t(o,["name"]),n=t(o,["fork-name","forkName"]),u=t(o,["snapshot","s","S"]);s||(r(e,"Source bucket name is required"),process.exit(1)),n||(r(e,"Fork name is required"),process.exit(1));let{error:i}=await p(n,{sourceBucketName:s,sourceBucketSnapshot:u,config:await f()});i&&(r(e,i.message),process.exit(1)),a(e,{name:s,forkName:n})}export{g as default};
@@ -1 +1 @@
1
- import{a as u,b as p,c as n,d as s,g}from"../../chunk-SYGTCM6P.js";import{f as d}from"../../chunk-CQCBYE3X.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as k}from"../../chunk-VOQSWXBS.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as S,getBucketInfo as l}from"@tigrisdata/storage";var t=g("forks","list");async function B(c){u(t);let e=i(c,["name"]),h=i(c,["format","f","F"],"table");e||(n(t,"Source bucket name is required"),process.exit(1));let a=await k(),{data:b,error:f}=await l(e,{config:a});if(f&&(n(t,f.message),process.exit(1)),!b.hasForks){s(t);return}let{data:w,error:m}=await S({config:a});m&&(n(t,m.message),process.exit(1));let r=[];for(let o of w.buckets){if(o.name===e)continue;let{data:y}=await l(o.name,{config:a});y?.sourceBucketName===e&&r.push({name:o.name,created:o.creationDate})}if(r.length===0){s(t);return}let x=d(r,h,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(x),p(t,{count:r.length})}export{B as default};
1
+ import{f as d}from"../../chunk-CQCBYE3X.js";import{a}from"../../chunk-JRALYIRA.js";import{b as k}from"../../chunk-BQX7MWWL.js";import{a as u,b as g,c as n,d as c,h as p}from"../../chunk-CQDWZKYG.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as j,getBucketInfo as l}from"@tigrisdata/storage";var t=p("forks","list");async function S(s){u(t);let e=a(s,["name"]),b=a(s,["json"])?"json":a(s,["format","f","F"],"table");e||(n(t,"Source bucket name is required"),process.exit(1));let i=await k(),{data:h,error:f}=await l(e,{config:i});if(f&&(n(t,f.message),process.exit(1)),!h.hasForks){c(t);return}let{data:w,error:m}=await j({config:i});m&&(n(t,m.message),process.exit(1));let o=[];for(let r of w.buckets){if(r.name===e)continue;let{data:y}=await l(r.name,{config:i});y?.sourceBucketName===e&&o.push({name:r.name,created:r.creationDate})}if(o.length===0){c(t);return}let x=d(o,b,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(x),g(t,{count:o.length})}export{S as default};
@@ -1,2 +1,2 @@
1
- import{a as x,b as P}from"../../../chunk-Y7MJZRR4.js";import{a as p,b as f,c as e,g as h}from"../../../chunk-SYGTCM6P.js";import{a as n}from"../../../chunk-JRALYIRA.js";import{a as y}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as g}from"../../../chunk-E4MLGABW.js";import{g as u}from"../../../chunk-DOUR5YEY.js";import{c as l}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as T,readFileSync as C}from"fs";import{addPolicy as k}from"@tigrisdata/iam";var t=h("iam policies","create");async function N(s){p(t);let r=n(s,["name"]),i=n(s,["document","d"]),w=n(s,["description"])??"";r||(e(t,"Policy name is required"),process.exit(1)),/^[a-zA-Z0-9=,.@_-]+$/.test(r)||(e(t,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed."),process.exit(1)),await y()!=="oauth"&&(e(t,`Policies can only be created when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let c=g();await c.isAuthenticated()||(e(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let A=await c.getAccessToken(),v=u(),S=l(),O={sessionToken:A,organizationId:v??void 0,iamEndpoint:S.iamEndpoint},o;i?T(i)?o=C(i,"utf-8"):o=i:process.stdin.isTTY?(e(t,"Policy document is required. Provide via --document or pipe to stdin."),process.exit(1)):o=await x();let a;try{a=P(o)}catch{e(t,"Invalid JSON in policy document"),process.exit(1)}let{data:d,error:m}=await k(r,{document:a,description:w,config:O});m&&(e(t,m.message),process.exit(1)),f(t,{name:d.name}),console.log(`Resource: ${d.resource}`)}export{N as default};
1
+ import{a as x,b as P}from"../../../chunk-Y7MJZRR4.js";import{a as n}from"../../../chunk-JRALYIRA.js";import{a as y}from"../../../chunk-BQX7MWWL.js";import{a as l,b as u,c as e,h as g}from"../../../chunk-CQDWZKYG.js";import"../../../chunk-BETAO4PB.js";import{b as h}from"../../../chunk-E4MLGABW.js";import{g as f}from"../../../chunk-DOUR5YEY.js";import{c as p}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as T,readFileSync as C}from"fs";import{addPolicy as k}from"@tigrisdata/iam";var t=g("iam policies","create");async function N(s){l(t);let r=n(s,["name"]),i=n(s,["document","d"]),w=n(s,["description"])??"";r||(e(t,"Policy name is required"),process.exit(1)),/^[a-zA-Z0-9=,.@_-]+$/.test(r)||(e(t,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed."),process.exit(1)),await y()!=="oauth"&&(e(t,`Policies can only be created when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let c=h();await c.isAuthenticated()||(e(t,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let A=await c.getAccessToken(),v=f(),S=p(),O={sessionToken:A,organizationId:v??void 0,iamEndpoint:S.iamEndpoint},o;i?T(i)?o=C(i,"utf-8"):o=i:process.stdin.isTTY?(e(t,"Policy document is required. Provide via --document or pipe to stdin."),process.exit(1)):o=await x();let a;try{a=P(o)}catch{e(t,"Invalid JSON in policy document"),process.exit(1)}let{data:d,error:m}=await k(r,{document:a,description:w,config:O});m&&(e(t,m.message),process.exit(1)),u(t,{name:d.name}),console.log(`Resource: ${d.resource}`)}export{N as default};
@@ -1,2 +1,2 @@
1
- import{a as p,b as d,c as t,d as f,g as u}from"../../../chunk-SYGTCM6P.js";import{a as w}from"../../../chunk-JRALYIRA.js";import{a as h}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as m}from"../../../chunk-E4MLGABW.js";import{g}from"../../../chunk-DOUR5YEY.js";import{c as l}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import E from"enquirer";import{deletePolicy as S,listPolicies as T}from"@tigrisdata/iam";var{prompt:O}=E,e=u("iam policies","delete");async function M(x){p(e);let i=w(x,["resource"]);await h()!=="oauth"&&(t(e,`Policies can only be deleted when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let s=m();await s.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let y=await s.getAccessToken(),A=g(),C=l(),r={sessionToken:y,organizationId:A??void 0,iamEndpoint:C.iamEndpoint};if(!i){let{data:o,error:a}=await T({config:r});if(a&&(t(e,a.message),process.exit(1)),!o.policies||o.policies.length===0){f(e);return}let{selected:k}=await O({type:"select",name:"selected",message:"Select a policy to delete:",choices:o.policies.map(n=>({name:n.resource,message:`${n.name} (${n.resource})`}))});i=k}let{error:c}=await S(i,{config:r});c&&(t(e,c.message),process.exit(1)),d(e,{resource:i})}export{M as default};
1
+ import{a as r,b as A}from"../../../chunk-S77OAN6Y.js";import{a as s}from"../../../chunk-JRALYIRA.js";import{a as x}from"../../../chunk-BQX7MWWL.js";import{a as f,b as p,c as i,d,h as u}from"../../../chunk-CQDWZKYG.js";import"../../../chunk-BETAO4PB.js";import{b as w}from"../../../chunk-E4MLGABW.js";import{g as y}from"../../../chunk-DOUR5YEY.js";import{c as h}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import R from"enquirer";import{deletePolicy as T,listPolicies as b}from"@tigrisdata/iam";var{prompt:S}=R,e=u("iam policies","delete");async function v(c){f(e);let t=s(c,["resource"]),k=s(c,["force","yes","y"]);await x()!=="oauth"&&(i(e,`Policies can only be deleted when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let a=w();await a.isAuthenticated()||(i(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let C=await a.getAccessToken(),E=y(),O=h(),l={sessionToken:C,organizationId:E??void 0,iamEndpoint:O.iamEndpoint};if(!t){let{data:o,error:g}=await b({config:l});if(g&&(i(e,g.message),process.exit(1)),!o.policies||o.policies.length===0){d(e);return}r("Provide the policy ARN as a positional argument");let{selected:P}=await S({type:"select",name:"selected",message:"Select a policy to delete:",choices:o.policies.map(n=>({name:n.resource,message:`${n.name} (${n.resource})`}))});t=P}if(!k&&(r("Use --yes to skip confirmation"),!await A(`Delete policy '${t}'?`))){console.log("Aborted");return}let{error:m}=await T(t,{config:l});m&&(i(e,m.message),process.exit(1)),p(e,{resource:t})}export{v as default};
@@ -1,2 +1,2 @@
1
- import{a as O,b as p}from"../../../chunk-Y7MJZRR4.js";import{a as S,b as A,c as t,d as P,g as T}from"../../../chunk-SYGTCM6P.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as E}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as w}from"../../../chunk-E4MLGABW.js";import{g as x}from"../../../chunk-DOUR5YEY.js";import{c as y}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as N,readFileSync as R}from"fs";import q from"enquirer";import{editPolicy as M,getPolicy as z,listPolicies as F}from"@tigrisdata/iam";var{prompt:I}=q,e=T("iam policies","edit");async function Y(c){S(e);let o=r(c,["resource"]),n=r(c,["document","d"]),a=r(c,["description"]);await E()!=="oauth"&&(t(e,`Policies can only be edited when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let g=w();await g.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let C=await g.getAccessToken(),D=x(),k=y(),d={sessionToken:C,organizationId:D??void 0,iamEndpoint:k.iamEndpoint};if(!o){process.stdin.isTTY||(t(e,"Policy ARN is required when piping document via stdin."),process.exit(1));let{data:i,error:h}=await F({config:d});if(h&&(t(e,h.message),process.exit(1)),!i.policies||i.policies.length===0){P(e);return}let{selected:J}=await I({type:"select",name:"selected",message:"Select a policy to edit:",choices:i.policies.map(m=>({name:m.resource,message:`${m.name} (${m.resource})`}))});o=J}let s;if(n){let i;N(n)?i=R(n,"utf-8"):i=n;try{s=p(i)}catch{t(e,"Invalid JSON in policy document"),process.exit(1)}}else if(!process.stdin.isTTY&&!a){let i=await O();try{s=p(i)}catch{t(e,"Invalid JSON in policy document"),process.exit(1)}}!s&&!a&&(t(e,"Either --document or --description is required."),process.exit(1));let{data:l,error:u}=await z(o,{config:d});u&&(t(e,u.message),process.exit(1));let{data:v,error:f}=await M(o,{document:s??l.document,description:a??l.description,config:d});f&&(t(e,f.message),process.exit(1)),A(e,{resource:v.resource})}export{Y as default};
1
+ import{a as O,b as p}from"../../../chunk-Y7MJZRR4.js";import{a as v}from"../../../chunk-S77OAN6Y.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as E}from"../../../chunk-BQX7MWWL.js";import{a as y,b as x,c as t,d as w,h as A}from"../../../chunk-CQDWZKYG.js";import"../../../chunk-BETAO4PB.js";import{b as T}from"../../../chunk-E4MLGABW.js";import{g as S}from"../../../chunk-DOUR5YEY.js";import{c as P}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as q,readFileSync as I}from"fs";import J from"enquirer";import{editPolicy as z,getPolicy as F,listPolicies as Y}from"@tigrisdata/iam";var{prompt:M}=J,e=A("iam policies","edit");async function $(c){y(e);let o=r(c,["resource"]),n=r(c,["document","d"]),a=r(c,["description"]);await E()!=="oauth"&&(t(e,`Policies can only be edited when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let l=T();await l.isAuthenticated()||(t(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let C=await l.getAccessToken(),D=S(),N=P(),d={sessionToken:C,organizationId:D??void 0,iamEndpoint:N.iamEndpoint};if(!o){process.stdin.isTTY||(t(e,"Policy ARN is required when piping document via stdin."),process.exit(1));let{data:i,error:h}=await Y({config:d});if(h&&(t(e,h.message),process.exit(1)),!i.policies||i.policies.length===0){w(e);return}v("Provide the policy ARN as a positional argument");let{selected:k}=await M({type:"select",name:"selected",message:"Select a policy to edit:",choices:i.policies.map(m=>({name:m.resource,message:`${m.name} (${m.resource})`}))});o=k}let s;if(n){let i;q(n)?i=I(n,"utf-8"):i=n;try{s=p(i)}catch{t(e,"Invalid JSON in policy document"),process.exit(1)}}else if(!process.stdin.isTTY&&!a){let i=await O();try{s=p(i)}catch{t(e,"Invalid JSON in policy document"),process.exit(1)}}!s&&!a&&(t(e,"Either --document or --description is required."),process.exit(1));let{data:u,error:g}=await F(o,{config:d});g&&(t(e,g.message),process.exit(1));let{data:R,error:f}=await z(o,{document:s??u.document,description:a??u.description,config:d});f&&(t(e,f.message),process.exit(1)),x(e,{resource:R.resource})}export{$ as default};
@@ -1,2 +1,2 @@
1
- import{a as y,b as r,c as i,d as v,g as A}from"../../../chunk-SYGTCM6P.js";import{f as O}from"../../../chunk-CQCBYE3X.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as S}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as h}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{c as m}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import E from"enquirer";import{getPolicy as P,listPolicies as R}from"@tigrisdata/iam";var{prompt:I}=E,o=A("iam policies","get");async function T(a){y(o);let n=c(a,["resource"]),l=c(a,["format","f","F"],"table");await S()!=="oauth"&&(i(o,`Policies can only be retrieved when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let u=h();await u.isAuthenticated()||(i(o,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let w=await u.getAccessToken(),C=p(),$=m(),f={sessionToken:w,organizationId:C??void 0,iamEndpoint:$.iamEndpoint};if(!n){let{data:t,error:d}=await R({config:f});if(d&&(i(o,d.message),process.exit(1)),!t.policies||t.policies.length===0){v(o);return}let{selected:D}=await I({type:"select",name:"selected",message:"Select a policy:",choices:t.policies.map(s=>({name:s.resource,message:`${s.name} (${s.resource})`}))});n=D}let{data:e,error:g}=await P(n,{config:f});if(g&&(i(o,g.message),process.exit(1)),l==="json"){console.log(JSON.stringify(e,null,2)),r(o);return}let k=[{field:"Name",value:e.name},{field:"ID",value:e.id},{field:"Resource",value:e.resource},{field:"Description",value:e.description||"-"},{field:"Path",value:e.path},{field:"Version",value:e.defaultVersionId},{field:"Attachments",value:String(e.attachmentCount)},{field:"Created",value:e.createDate.toISOString()},{field:"Updated",value:e.updateDate.toISOString()}],x=O(k,l,"policy","field",[{key:"field",header:"Field"},{key:"value",header:"Value"}]);if(console.log(x),e.users&&e.users.length>0){console.log("Attached Users:");for(let t of e.users)console.log(` - ${t}`);console.log()}console.log("Policy Document:"),console.log(` Version: ${e.document.version}`),console.log(" Statements:");for(let t of e.document.statements)console.log(` - Effect: ${t.effect}`),console.log(` Action: ${Array.isArray(t.action)?t.action.join(", "):t.action}`),console.log(` Resource: ${Array.isArray(t.resource)?t.resource.join(", "):t.resource}`);r(o)}export{T as default};
1
+ import{f as O}from"../../../chunk-CQCBYE3X.js";import{a as n}from"../../../chunk-JRALYIRA.js";import{a as S}from"../../../chunk-BQX7MWWL.js";import{a as m,b as a,c as i,d as p,h}from"../../../chunk-CQDWZKYG.js";import"../../../chunk-BETAO4PB.js";import{b as A}from"../../../chunk-E4MLGABW.js";import{g as v}from"../../../chunk-DOUR5YEY.js";import{c as y}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import D from"enquirer";import{getPolicy as I,listPolicies as P}from"@tigrisdata/iam";var{prompt:E}=D,o=h("iam policies","get");async function R(s){m(o);let r=n(s,["resource"]),l=n(s,["json"])?"json":n(s,["format","f","F"],"table");await S()!=="oauth"&&(i(o,`Policies can only be retrieved when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let u=A();await u.isAuthenticated()||(i(o,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let w=await u.getAccessToken(),j=v(),C=y(),f={sessionToken:w,organizationId:j??void 0,iamEndpoint:C.iamEndpoint};if(!r){let{data:t,error:d}=await P({config:f});if(d&&(i(o,d.message),process.exit(1)),!t.policies||t.policies.length===0){p(o);return}let{selected:x}=await E({type:"select",name:"selected",message:"Select a policy:",choices:t.policies.map(c=>({name:c.resource,message:`${c.name} (${c.resource})`}))});r=x}let{data:e,error:g}=await I(r,{config:f});if(g&&(i(o,g.message),process.exit(1)),l==="json"){console.log(JSON.stringify(e,null,2)),a(o);return}let $=[{field:"Name",value:e.name},{field:"ID",value:e.id},{field:"Resource",value:e.resource},{field:"Description",value:e.description||"-"},{field:"Path",value:e.path},{field:"Version",value:e.defaultVersionId},{field:"Attachments",value:String(e.attachmentCount)},{field:"Created",value:e.createDate.toISOString()},{field:"Updated",value:e.updateDate.toISOString()}],k=O($,l,"policy","field",[{key:"field",header:"Field"},{key:"value",header:"Value"}]);if(console.log(k),e.users&&e.users.length>0){console.log("Attached Users:");for(let t of e.users)console.log(` - ${t}`);console.log()}console.log("Policy Document:"),console.log(` Version: ${e.document.version}`),console.log(" Statements:");for(let t of e.document.statements)console.log(` - Effect: ${t.effect}`),console.log(` Action: ${Array.isArray(t.action)?t.action.join(", "):t.action}`),console.log(` Resource: ${Array.isArray(t.resource)?t.resource.join(", "):t.resource}`);a(o)}export{R as default};
@@ -1,2 +1,2 @@
1
- import{a as m,b as p,c as i,d as u,g}from"../../../chunk-SYGTCM6P.js";import{f as l}from"../../../chunk-CQCBYE3X.js";import{a as f}from"../../../chunk-JRALYIRA.js";import{a as h}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as d}from"../../../chunk-E4MLGABW.js";import{g as c}from"../../../chunk-DOUR5YEY.js";import{c as s}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{listPolicies as O}from"@tigrisdata/iam";var e=g("iam policies","list");async function D(k){m(e);let A=f(k,["format","f","F"],"table");await h()!=="oauth"&&(i(e,`Policies can only be listed when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let n=d();await n.isAuthenticated()||(i(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let w=await n.getAccessToken(),C=c(),x=s(),{data:o,error:r}=await O({config:{sessionToken:w,organizationId:C??void 0,iamEndpoint:x.iamEndpoint}});if(r&&(i(e,r.message),process.exit(1)),!o.policies||o.policies.length===0){u(e);return}let a=o.policies.map(t=>({name:t.name,id:t.id,resource:t.resource,description:t.description||"-",attachments:t.attachmentCount,created:t.createDate,updated:t.updateDate})),y=l(a,A,"policies","policy",[{key:"id",header:"ID"},{key:"resource",header:"Resource"},{key:"name",header:"Name"},{key:"description",header:"Description"},{key:"attachments",header:"Attachments"},{key:"created",header:"Created"},{key:"updated",header:"Updated"}]);console.log(y),p(e,{count:a.length})}export{D as default};
1
+ import{f as k}from"../../../chunk-CQCBYE3X.js";import{a as n}from"../../../chunk-JRALYIRA.js";import{a as f}from"../../../chunk-BQX7MWWL.js";import{a as d,b as m,c as i,d as u,h as p}from"../../../chunk-CQDWZKYG.js";import"../../../chunk-BETAO4PB.js";import{b as l}from"../../../chunk-E4MLGABW.js";import{g as h}from"../../../chunk-DOUR5YEY.js";import{c as g}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{listPolicies as O}from"@tigrisdata/iam";var e=p("iam policies","list");async function j(s){d(e);let A=n(s,["json"])?"json":n(s,["format","f","F"],"table");await f()!=="oauth"&&(i(e,`Policies can only be listed when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let a=l();await a.isAuthenticated()||(i(e,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let w=await a.getAccessToken(),C=h(),x=g(),{data:o,error:r}=await O({config:{sessionToken:w,organizationId:C??void 0,iamEndpoint:x.iamEndpoint}});if(r&&(i(e,r.message),process.exit(1)),!o.policies||o.policies.length===0){u(e);return}let c=o.policies.map(t=>({name:t.name,id:t.id,resource:t.resource,description:t.description||"-",attachments:t.attachmentCount,created:t.createDate,updated:t.updateDate})),y=k(c,A,"policies","policy",[{key:"id",header:"ID"},{key:"resource",header:"Resource"},{key:"name",header:"Name"},{key:"description",header:"Description"},{key:"attachments",header:"Attachments"},{key:"created",header:"Created"},{key:"updated",header:"Updated"}]);console.log(y),m(e,{count:c.length})}export{j as default};
@@ -1,5 +1,5 @@
1
- import{a as p}from"../../../chunk-GZ7JBHFT.js";import{a as h,b as y,c as t,g as v}from"../../../chunk-SYGTCM6P.js";import{a as s}from"../../../chunk-JRALYIRA.js";import{a as R}from"../../../chunk-VOQSWXBS.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as u}from"../../../chunk-DOUR5YEY.js";import{c as d}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{inviteUser as E}from"@tigrisdata/iam";var i=v("iam users","invite");async function O(r){h(i),await R()!=="oauth"&&(t(i,`Users can only be invited when logged in via OAuth.
2
- Run "tigris login oauth" first.`),process.exit(1));let a=u();if(p(a??void 0)){console.log(`User management is not available for Fly.io organizations.
1
+ import{a as v}from"../../../chunk-GZ7JBHFT.js";import{a as s}from"../../../chunk-JRALYIRA.js";import{a as R}from"../../../chunk-BQX7MWWL.js";import{a as d,b as u,c as t,h as f}from"../../../chunk-CQDWZKYG.js";import"../../../chunk-BETAO4PB.js";import{b as y}from"../../../chunk-E4MLGABW.js";import{g as h}from"../../../chunk-DOUR5YEY.js";import{c as p}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{inviteUser as E}from"@tigrisdata/iam";var i=f("iam users","invite");async function O(r){d(i),await R()!=="oauth"&&(t(i,`Users can only be invited when logged in via OAuth.
2
+ Run "tigris login oauth" first.`),process.exit(1));let a=h();if(v(a??void 0)){console.log(`User management is not available for Fly.io organizations.
3
3
  Your users are managed through Fly.io.
4
4
 
5
- Visit https://fly.io to manage your organization members.`);return}let e=s(r,["email"]),o=s(r,["role","r"])??"member",n=Array.isArray(e)?e:e?[e]:[];n.length===0&&(t(i,"Email address is required"),process.exit(1));let m=["admin","member"];m.includes(o)||(t(i,`Invalid role "${o}". Must be one of: ${m.join(", ")}`),process.exit(1));let A=o,c=f();await c.isAuthenticated()||(t(i,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let b=await c.getAccessToken(),l=d(),x=n.map(w=>({email:w,role:A})),{error:g}=await E(x,{config:{sessionToken:b,organizationId:a??void 0,iamEndpoint:l.iamEndpoint,mgmtEndpoint:l.mgmtEndpoint}});g&&(t(i,g.message),process.exit(1)),y(i,{email:n.join(", ")})}export{O as default};
5
+ Visit https://fly.io to manage your organization members.`);return}let e=s(r,["email"]),o=s(r,["role","r"])??"member",n=Array.isArray(e)?e:e?[e]:[];n.length===0&&(t(i,"Email address is required"),process.exit(1));let m=["admin","member"];m.includes(o)||(t(i,`Invalid role "${o}". Must be one of: ${m.join(", ")}`),process.exit(1));let A=o,c=y();await c.isAuthenticated()||(t(i,'Not authenticated. Run "tigris login oauth" first.'),process.exit(1));let b=await c.getAccessToken(),l=p(),x=n.map(w=>({email:w,role:A})),{error:g}=await E(x,{config:{sessionToken:b,organizationId:a??void 0,iamEndpoint:l.iamEndpoint,mgmtEndpoint:l.mgmtEndpoint}});g&&(t(i,g.message),process.exit(1)),u(i,{email:n.join(", ")})}export{O as default};