@tigrisdata/cli 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-G4DHMSCQ.js +8 -0
- package/dist/{chunk-GNWZ7PX2.js → chunk-GLKOUVFH.js} +1 -1
- package/dist/chunk-LAB2KJTN.js +1 -0
- package/dist/chunk-N3Y6RFSK.js +1 -0
- package/dist/{chunk-EBWDZEHM.js → chunk-RZPBM4CD.js} +1 -1
- package/dist/{chunk-7EHCU6PH.js → chunk-WE7KHYIP.js} +1 -1
- package/dist/cli-core.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/buckets/create.js +1 -1
- package/dist/lib/buckets/get.js +1 -1
- package/dist/lib/buckets/lifecycle/create.js +1 -1
- package/dist/lib/buckets/lifecycle/edit.js +1 -1
- package/dist/lib/buckets/lifecycle/list.js +1 -1
- package/dist/lib/buckets/lifecycle/shared.js +1 -1
- package/dist/lib/buckets/list.js +1 -1
- package/dist/lib/buckets/restore.js +1 -0
- package/dist/lib/buckets/set-locations.js +1 -1
- package/dist/lib/buckets/set.js +1 -1
- package/dist/lib/iam/policies/edit.js +1 -1
- package/dist/lib/mk.js +1 -1
- package/dist/lib/stat.js +1 -1
- package/dist/lib/update.js +1 -1
- package/dist/specs.yaml +32 -0
- package/dist/utils/bucket-info.js +1 -1
- package/dist/utils/locations.js +1 -1
- package/dist/utils/update-check.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-HWX63Y3P.js +0 -1
- package/dist/chunk-QWZ6FK7E.js +0 -8
- package/dist/chunk-TD2HGNDY.js +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{a as w}from"./chunk-UBANDLB4.js";import{h as C}from"./chunk-7ZUCJBD5.js";import{Command as q,Option as L}from"commander";function A(n,t,e,a,o){let r=n[n.length-1],s=typeof r=="object"&&r!==null&&"args"in r?r.args:n.filter(m=>typeof m=="string");if(s.length===0)return s;let l=s[0],d=(t.commands??[]).filter(m=>g(m,[...e,m.name],o));if(!new Set(d.flatMap(m=>[m.name,...Array.isArray(m.alias)?m.alias:m.alias?[m.alias]:[]])).has(l)){let m=d.map(u=>u.name),p=e.length>0?`'${l}' for '${e.join(" ")}'`:`'${l}'`;console.error(`Unknown command ${p}.`),m.length>0&&console.error(`Available commands: ${m.join(", ")}`);let f=e.length>0?`${a.name} ${e.join(" ")} help`:`${a.name} help`;console.error(`
|
|
2
|
+
Run "${f}" for usage.`),process.exit(1)}return s}function G(){process.on("unhandledRejection",n=>{(n===""||n===void 0)&&(console.error(`
|
|
3
|
+
Operation cancelled`),process.exit(1)),w(n)}),process.on("uncaughtException",n=>{w(n)})}function U(n){return/^[a-zA-Z0-9_-]+$/.test(n)}function D(n){let t;n.type==="positional"?t=` ${n.name}`:(t=` --${n.name}`,n.alias&&typeof n.alias=="string"&&(t+=n.alias.length===1?`, -${n.alias}`:`, --${n.alias}`));let e=26,a=t.length>=e?t+" ":t.padEnd(e),o=n.description;return n.options&&(Array.isArray(n.options)&&typeof n.options[0]=="string"?o+=` (options: ${n.options.join(", ")})`:o+=` (options: ${n.options.map(r=>r.value).join(", ")})`),n.default&&(o+=` [default: ${n.default}]`),n.required&&(o+=" [required]"),n.deprecated&&(o+=n.replaced_by?` [deprecated: use ${n.replaced_by}]`:" [deprecated]"),n["required-when"]&&(o+=` [required when: ${n["required-when"]}]`),n.multiple&&(o+=" [multiple values: comma-separated]"),n.type==="positional"&&(o+=" [positional argument]"),n.examples&&n.examples.length>0&&(o+=` (examples: ${n.examples.join(", ")})`),`${a}${o}`}function g(n,t,e){return n.removed||e(t)?!0:n.commands?n.commands.some(a=>g(a,[...t,a.name],e)):!1}function R(n,t){let e=t?` Use ${t} instead.`:" See the changelog for migration guidance.";console.error(`${n} was removed in this version.${e}`),process.exit(1)}function v(n,t){if(n)for(let e of n){if(!e.removed)continue;h(t,e.name,n)!==void 0&&R(`--${e.name}`,e.replaced_by)}}function b(n,t,e,a){let o=e.join(" ");if(console.log(`
|
|
4
|
+
${n.name} ${o} - ${t.description??""}
|
|
5
|
+
`),t.commands&&t.commands.length>0){let l=t.commands.filter(i=>!i.removed&&g(i,[...e,i.name],a));l.length>0&&(console.log("Commands:"),l.forEach(i=>{let d=` ${i.name}`;if(i.alias){let m=Array.isArray(i.alias)?i.alias:[i.alias];d+=` (${m.join(", ")})`}let c=d.padEnd(24);console.log(`${c}${i.description??""}`)}),console.log())}let r=n.definitions?.global_arguments??[],s=y(r,t.arguments).filter(l=>!l.removed);s.length>0&&(console.log("Arguments:"),s.forEach(l=>{console.log(D(l))}),console.log()),t.examples&&t.examples.length>0&&(console.log("Examples:"),t.examples.forEach(l=>{console.log(` ${l}`)}),console.log()),t.commands&&t.commands.length>0&&console.log(`Use "${n.name} ${o} <command> help" for more information about a command.`)}function k(n,t,e){console.log(`Tigris CLI Version: ${t}
|
|
6
|
+
`),console.log(`Usage: tigris [command] [options]
|
|
7
|
+
`),console.log("Commands:"),n.commands.filter(o=>!o.removed&&g(o,[o.name],e)).forEach(o=>{let r=` ${o.name}`;if(o.alias){let l=Array.isArray(o.alias)?o.alias:[o.alias];r+=` (${l.join(", ")})`}let s=r.padEnd(24);console.log(`${s}${o.description??""}`)}),console.log(`
|
|
8
|
+
Use "${n.name} <command> help" for more information about a command.`)}function y(n,t){let e=t??[],a=new Set(e.map(s=>s.name)),o=new Set(e.filter(s=>s.alias).map(s=>s.alias)),r=n.filter(s=>!a.has(s.name)&&!(s.alias&&o.has(s.alias)));return[...e,...r]}function E(n,t=[]){t.forEach(e=>{if(e.type==="positional"){let a=e.required?`<${e.name}>`:`[${e.name}]`;n.argument(a,e.description)}else{let a=e.alias&&typeof e.alias=="string"&&e.alias.length===1,o=e.alias&&typeof e.alias=="string"&&e.alias.length>1,r=a?`-${e.alias}, --${e.name}`:o?`--${e.alias}, --${e.name}`:`--${e.name}`;if(e.type==="flag"||(e.type==="boolean"?r+=" [value]":e.options?r+=" <value>":r+=e.required||e["required-when"]?" <value>":" [value]"),e.removed)n.addOption(new L(r,e.description??"").hideHelp());else{let s=e.description??"";if(e.deprecated){let l=e.replaced_by?` Use ${e.replaced_by} instead.`:"";s=`(deprecated) ${s}${l}`}n.option(r,s,e.default)}}})}function M(n){return n.replace(/-([a-z])/g,(t,e)=>e.toUpperCase())}function h(n,t,e){if(e){let o=e.find(r=>r.name===t);if(o&&o.alias&&typeof o.alias=="string"){let r=o.alias.charAt(0).toUpperCase()+o.alias.slice(1);if(n[r]!==void 0)return n[r]}}let a=[t,t.replace(/-/g,""),t.replace(/-/g,"").toLowerCase(),t.charAt(0).toUpperCase(),M(t)];for(let o of a)if(n[o]!==void 0)return n[o]}function S(n,t){for(let e of n){if(e["required-when"]){let[a,o]=e["required-when"].split("="),r=h(t,a,n),s=h(t,e.name,n);if(r===o&&!s)return console.error(`--${e.name} is required when --${a} is ${o}`),!1}if(e.required&&!h(t,e.name,n))return console.error(`--${e.name} is required`),!1}return!0}function j(n,t,e){let a;"optsWithGlobals"in e&&typeof e.optsWithGlobals=="function"?a=e.optsWithGlobals():"opts"in e&&typeof e.opts=="function"?a=e.opts():a=e;let o={...a};return n.filter(s=>s.type==="positional").forEach((s,l)=>{t[l]!==void 0&&(s.multiple?o[s.name]=t[l].split(",").map(i=>i.trim()):o[s.name]=t[l])}),n.forEach(s=>{s.multiple&&s.type!=="positional"&&o[s.name]&&typeof o[s.name]=="string"&&(o[s.name]=o[s.name].split(",").map(l=>l.trim()))}),o}async function I(n,t,e=[],a={}){(a.json||a.format==="json")&&(globalThis.__TIGRIS_JSON_MODE=!0);let{module:o,error:r}=await n(t);(r||!o)&&(console.error(r),process.exit(1));let s=t[t.length-1],l=o.default||o[s];typeof l!="function"&&(console.error(`Command not implemented: ${t.join(" ")}`),process.exit(1)),await l({...a,_positional:e})}function _(n,t,e,a=[]){let{specs:o,loadModule:r,hasImplementation:s}=n,l=o.definitions?.global_arguments??[];for(let i of e){U(i.name)||(console.error(`Invalid command name "${i.name}": only alphanumeric, hyphens, and underscores allowed`),process.exit(1));let d=[...a,i.name];if(!g(i,d,s))continue;let c=t.command(i.name,i.removed?{hidden:!0}:void 0).description(i.description??"");if(i.alias&&(Array.isArray(i.alias)?i.alias:[i.alias]).forEach(p=>c.alias(p)),i.removed){c.allowUnknownOption(!0),c.allowExcessArguments(!0),c.action(()=>{R(`${o.name} ${d.join(" ")}`,i.replaced_by)});continue}if(i.commands&&i.commands.length>0)if(_(n,c,i.commands,d),i.default){let m=i.commands.find(p=>p.name===i.default);if(m){let p=y(l,[...i.arguments||[],...m.arguments||[]]);E(c,p),c.allowExcessArguments(!0),c.action(async(...f)=>{let u=f.pop(),x=A([u],i,d,o,s),$=j(p,x,u);p.length>0&&!S(p,$)||(v(p,$),m.deprecated&&m.messages?.onDeprecated&&C(m.messages.onDeprecated),await I(r,[...d,m.name],x,$))})}}else c.allowExcessArguments(!0),c.action((...m)=>{A(m,i,d,o,s),b(o,i,d,s)});else E(c,y(l,i.arguments)),c.action(async(...m)=>{let p=m.pop(),f=m,u=j(i.arguments||[],f,p);i.arguments&&!S(i.arguments,u)||(v(i.arguments,u),i.deprecated&&i.messages?.onDeprecated&&C(i.messages.onDeprecated),await I(r,d,f,u))});c.command("help").description("Show help for this command").action(()=>{b(o,i,d,s)})}}function P(n){let{specs:t,version:e,hasImplementation:a}=n,o=new q;return o.name(t.name).description(t.description).version(e),_(n,o,t.commands),o.command("help").description("Show general help").action(()=>{k(t,e,a)}),o.command("version").description("Show the CLI version").action(()=>{console.log(e)}),o.allowExcessArguments(!0),o.action((...r)=>{A(r,{commands:t.commands},[],t,a),k(t,e,a)}),o}export{G as a,U as b,D as c,g as d,b as e,k as f,E as g,S as h,j as i,_ as j,P as k};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as m,e as d,f}from"./chunk-ATBINUDP.js";import{mkdirSync as w,readFileSync as _,realpathSync as E,writeFileSync as I}from"fs";import x from"https";import{homedir as g}from"os";import{join as h}from"path";var u="3.
|
|
1
|
+
import{d as m,e as d,f}from"./chunk-ATBINUDP.js";import{mkdirSync as w,readFileSync as _,realpathSync as E,writeFileSync as I}from"fs";import x from"https";import{homedir as g}from"os";import{join as h}from"path";var u="3.1.0";var b=h(g(),".tigris","update-check.json");function y(){try{let e=_(b,"utf-8"),n=JSON.parse(e);return typeof n.latestVersion=="string"&&typeof n.lastChecked=="number"?n:null}catch{return null}}function v(e){try{w(h(g(),".tigris"),{recursive:!0}),I(b,JSON.stringify(e),"utf-8")}catch{}}function T(e,n){let a=i=>{let s=i.startsWith("v")?i.slice(1):i,l=null,o=s.indexOf("-");o!==-1&&(l=s.slice(o+1),s=s.slice(0,o));let c=s.split(".");if(c.length!==3)return null;let p=c.map(Number);return p.some(isNaN)?null:{major:p[0],minor:p[1],patch:p[2],prerelease:l}},r=a(e),t=a(n);return!r||!t?!1:t.major>r.major?!0:t.major<r.major?!1:t.minor>r.minor?!0:t.minor<r.minor?!1:t.patch>r.patch?!0:t.patch<r.patch?!1:r.prerelease&&!t.prerelease?!0:(!r.prerelease&&t.prerelease,!1)}function N(){if(process.platform==="win32")return!1;try{let e=E(process.execPath);return e.includes("/Cellar/")||e.includes("/Caskroom/")}catch{return!1}}function M(){return globalThis.__TIGRIS_BINARY===!0?N()?"brew upgrade tigris":process.platform==="win32"?"irm https://github.com/tigrisdata/cli/releases/latest/download/install.ps1 | iex":"curl -fsSL https://github.com/tigrisdata/cli/releases/latest/download/install.sh | sh":"npm install -g @tigrisdata/cli"}function k(e={}){return new Promise((n,a)=>{let r=x.get(m,{timeout:1e4},t=>{let i="";t.on("data",s=>{i+=s}),t.on("end",()=>{try{let s=JSON.parse(i);typeof s.version=="string"?(v({...y(),latestVersion:s.version,lastChecked:Date.now()}),n(s.version)):a(new Error("Unexpected registry response"))}catch{a(new Error("Failed to parse registry response"))}})});r.on("error",t=>{a(t)}),r.on("timeout",()=>{r.destroy(),a(new Error("Request timed out"))}),e.unref&&r.on("socket",t=>{t.unref()}),r.end()})}function j(){k({unref:!0}).catch(()=>{})}function O(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let e=y(),n=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||36e5;if(e&&T(u,e.latestVersion)&&(!e.lastNotified||Date.now()-e.lastNotified>n)){let r=`Update available: ${u} \u2192 ${e.latestVersion}`,t='Run "tigris update" to upgrade.',i=Math.max(r.length,t.length)+4,s="\u250C"+"\u2500".repeat(i-2)+"\u2510",l="\u2514"+"\u2500".repeat(i-2)+"\u2518",o=c=>"\u2502 "+c.padEnd(i-4)+" \u2502";console.log(`
|
|
2
2
|
${s}
|
|
3
3
|
${o("")}
|
|
4
4
|
${o(r)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as l}from"./chunk-IRDNZN7R.js";import{b as r}from"./chunk-N3Y6RFSK.js";function a(e){if(e.storageClass)return e.days!==void 0?`${e.storageClass} after ${e.days}d`:e.date!==void 0?`${e.storageClass} on ${e.date}`:e.storageClass}function f(e){if(e.expiration){if(e.expiration.days!==void 0)return`${e.expiration.days}d`;if(e.expiration.date!==void 0)return e.expiration.date}}function u(e){let n=[],i=a(e);i&&n.push(i);let t=f(e);t&&n.push(e.expiration?.days!==void 0?`expire after ${t}`:`expire on ${t}`);let s=[];e.filter?.prefix&&s.push(`prefix=${e.filter.prefix}`),e.enabled===!1&&s.push("disabled");let o=n.join(", ");return s.length>0?`${o} (${s.join(", ")})`:o}function p(e){let n=[{label:"Number of Objects",value:e.sizeInfo.numberOfObjects?.toString()??"N/A"},{label:"Total Size",value:e.sizeInfo.size!==void 0?l(e.sizeInfo.size):"N/A"},{label:"All Versions Count",value:e.sizeInfo.numberOfObjectsAllVersions?.toString()??"N/A"},{label:"Default Tier",value:e.settings.defaultTier},{label:"Locations",value:r(e.locations)},{label:"Snapshots Enabled",value:e.isSnapshotEnabled?"Yes":"No"},{label:"Delete Protection",value:e.settings.deleteProtection?"Yes":"No"},{label:"Soft Delete",value:e.settings.softDelete.enabled?`Enabled (${e.settings.softDelete.retentionDays} day retention)`:"Disabled"},{label:"Allow Object ACL",value:e.settings.allowObjectAcl?"Yes":"No"},{label:"Custom Domain",value:e.settings.customDomain??"None"},{label:"Has Forks",value:e.forkInfo?.hasChildren?"Yes":"No"}];return e.forkInfo?.parents?.length&&(n.push({label:"Forked From",value:e.forkInfo.parents[0].bucketName}),n.push({label:"Fork Snapshot",value:e.forkInfo.parents[0].snapshot})),e.settings.lifecycleRules?.length&&n.push({label:"Lifecycle Rules",value:e.settings.lifecycleRules.map(i=>u(i)).join(", ")}),e.settings.additionalHeaders&&n.push({label:"Additional Headers",value:Object.entries(e.settings.additionalHeaders).map(([i,t])=>`${i}: ${t}`).join(", ")}),e.settings.corsRules.length&&n.push({label:"CORS Rules",value:`${e.settings.corsRules.length} rule(s)`}),e.settings.notifications&&n.push({label:"Notifications",value:e.settings.notifications.enabled!==!1?"Enabled":"Disabled"}),e.settings.dataMigration&&n.push({label:"Data Migration",value:e.settings.dataMigration.endpoint?`${e.settings.dataMigration.name??"N/A"} (${e.settings.dataMigration.endpoint})`:e.settings.dataMigration.name??"Configured"}),n}export{a,f as b,p as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s}from"./chunk-S77OAN6Y.js";import l from"enquirer";var{prompt:r}=l,u=["usa","eur"],g=[{name:"USA",value:"usa"},{name:"Europe",value:"eur"}],o=[{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 m(e){try{if(e==="multi"){let{region:a}=await r({type:"select",name:"region",message:"Multi-region:",choices:g.map(n=>({name:n.value,message:n.name}))});return i(a)}if(e==="single"){let{region:a}=await r({type:"select",name:"region",message:"Region:",choices:o.map(n=>({name:n.value,message:n.name}))});return i(a)}let{regions:t}=await r({type:"multiselect",name:"regions",message:"Press space key to select regions (multiple supported) and enter to confirm:",choices:o.map(a=>({name:a.value,message:a.name}))});if(t.length<2)throw new Error("Dual region requires at least two regions");return i(t)}catch(t){if(t==="")return null;throw t}}async function c(){s("Provide --locations flag");let e;try{({locationType:e}=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 e==="global"?{type:"global"}:await m(e)??c()}function v(e){switch(e.type){case"global":return"Global";case"multi":return`Multi-region (${e.values})`;case"single":return e.values;case"dual":return`Dual region (${Array.isArray(e.values)?e.values.join(", "):e.values})`}}function i(e){let t=(Array.isArray(e)?e:[e]).flatMap(a=>a.split(",")).map(a=>a.trim()).filter(a=>a.length>0);if(t.length===0||t.length===1&&t[0]==="global")return{type:"global"};if(t.length===1){let a=t[0];return u.includes(a)?{type:"multi",values:a}:{type:"single",values:a}}return{type:"dual",values:t}}export{c as a,v as b,i as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as o}from"./chunk-
|
|
1
|
+
import{a as d,b as o}from"./chunk-LAB2KJTN.js";import{a}from"./chunk-S6KFKBMY.js";import{b as i}from"./chunk-UBANDLB4.js";import{getBucketInfo as l,setBucketLifecycle as g}from"@tigrisdata/storage";var f=["STANDARD_IA","GLACIER","GLACIER_IR"];function c(e){return f.includes(e)}function u(e){return/^\d{4}-\d{2}-\d{2}/.test(e)&&!isNaN(new Date(e).getTime())}function C(e){return{prefix:a(e,["prefix"]),storageClass:a(e,["storage-class","storageClass"]),days:a(e,["days"]),date:a(e,["date"]),expireDays:a(e,["expire-days","expireDays"]),expireDate:a(e,["expire-date","expireDate"]),enable:a(e,["enable"]),disable:a(e,["disable"])}}function p(e,{requireStorageClassForTiming:r=!0}={}){if(e.enable&&e.disable)return"Cannot use both --enable and --disable";if(r&&(e.days!==void 0||e.date!==void 0)&&!e.storageClass)return"--storage-class is required when setting --days or --date";if(e.storageClass&&!c(e.storageClass))return`--storage-class must be one of: ${f.join(", ")} (STANDARD is not a valid transition target)`;if(e.days!==void 0&&e.date!==void 0)return"Cannot specify both --days and --date";if(e.days!==void 0&&(isNaN(Number(e.days))||Number(e.days)<=0))return"--days must be a positive number";if(e.date!==void 0&&!u(e.date))return"--date must be a valid ISO-8601 date (e.g. 2026-06-01)";if(e.expireDays!==void 0&&e.expireDate!==void 0)return"Cannot specify both --expire-days and --expire-date";if(e.expireDays!==void 0&&(isNaN(Number(e.expireDays))||Number(e.expireDays)<=0))return"--expire-days must be a positive number";if(e.expireDate!==void 0&&!u(e.expireDate))return"--expire-date must be a valid ISO-8601 date (e.g. 2026-06-01)";if(e.prefix!==void 0&&e.prefix==="")return"--prefix cannot be empty"}function D(e){let r={};return e.storageClass&&(r.storageClass=e.storageClass),e.days!==void 0?(r.days=Number(e.days),r.date=void 0):e.date!==void 0&&(r.date=e.date,r.days=void 0),r}function R(e){if(e.expireDays!==void 0)return{days:Number(e.expireDays),date:void 0};if(e.expireDate!==void 0)return{date:e.expireDate,days:void 0}}function I(e){if(e.enable)return!0;if(e.disable)return!1}async function T(e,r,t){let{data:s,error:n}=await l(r,{config:t});return n&&i(e,n),s?.settings.lifecycleRules??[]}async function N(e,r,t,s){let{error:n}=await g(r,{lifecycleRules:t,config:s});n&&i(e,n)}function S(e){return d(e)??"-"}function A(e){return o(e)??"-"}export{C as a,p as b,D as c,R as d,I as e,T as f,N as g,S as h,A as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,f as l}from"./chunk-
|
|
1
|
+
import{a as s,f as l}from"./chunk-GLKOUVFH.js";import{a as i,k as m}from"./chunk-G4DHMSCQ.js";import{b as t}from"./chunk-PPNBQWSR.js";import{existsSync as c}from"fs";import{dirname as u,join as a}from"path";import{fileURLToPath as f}from"url";i();var j=f(import.meta.url),d=u(j),h=t(),y=o=>{if(o.length===0)return!1;let e=a(d,"lib",...o)+".js";if(c(e))return!0;let r=a(d,"lib",...o,"index.js");return!!c(r)},b=async o=>{let e=[`./lib/${o.join("/")}.js`,`./lib/${o.join("/")}/index.js`];for(let p of e){let n=await import(p).catch(()=>null);if(n)return{module:n,error:null}}return{module:null,error:`Command not found: ${o.join(" ")}`}},x=m({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
|
package/dist/cli-core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-G4DHMSCQ.js";import"./chunk-UBANDLB4.js";import"./chunk-DV3LCXRH.js";import"./chunk-7ZUCJBD5.js";import"./chunk-PPNBQWSR.js";export{g as addArgumentsToCommand,d as commandHasAnyImplementation,k as createProgram,i as extractArgumentValues,c as formatArgumentHelp,b as isValidCommandName,j as registerCommands,a as setupErrorHandlers,e as showCommandHelp,f as showMainHelp,h as validateRequiredWhen};
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-WE7KHYIP.js";import"./chunk-GLKOUVFH.js";import"./chunk-G4DHMSCQ.js";import"./chunk-UBANDLB4.js";import"./chunk-DV3LCXRH.js";import"./chunk-7ZUCJBD5.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-WE7KHYIP.js";import"./chunk-GLKOUVFH.js";import"./chunk-G4DHMSCQ.js";import"./chunk-UBANDLB4.js";import"./chunk-DV3LCXRH.js";import"./chunk-7ZUCJBD5.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D,
|
|
1
|
+
import{a as D,c as N}from"../../chunk-N3Y6RFSK.js";import{a as C}from"../../chunk-S77OAN6Y.js";import{d as q}from"../../chunk-YN2TKPPT.js";import{a as t,b as L}from"../../chunk-S6KFKBMY.js";import{b as i,c as T,d as w}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as x,c as y,j as B}from"../../chunk-7ZUCJBD5.js";import{d as p,e as g}from"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{createBucket as R}from"@tigrisdata/storage";import E from"enquirer";var{prompt:j}=E,a=B("buckets","create");async function F(e){x(a);let O=L(e),s=t(e,["name"]),d=t(e,["public"])?"public":t(e,["access","a","A"]),b=t(e,["enable-snapshots","s","S"]),h=t(e,["default-tier","t","T"]),P=t(e,["locations","l","L"]),o=t(e,["fork-of","forkOf","fork"]),l=t(e,["source-snapshot","sourceSnapshot","source-snap"]),I=!s,S;if(I){C("Provide --name to skip interactive mode");let n=p("buckets","access","create"),r=g(n),f=r?.findIndex(c=>c.value===n?.default),v=p("buckets","default-tier","create"),A=g(v),m=A?.findIndex(c=>c.value===v?.default),u=await j([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:r||[],initial:f!==void 0&&f>=0?f:0},{type:"select",name:"defaultTier",message:"Default storage tier:",choices:A||[],initial:m!==void 0&&m>=0?m:0},{type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}]);s=u.name,d=u.access,h=u.defaultTier,b=u.enableSnapshots;try{S=await D()}catch(c){i(a,c)}}s||i(a,"Bucket name is required"),l&&!o&&i(a,"--source-snapshot requires --fork-of");let{error:k}=await R(s,{defaultTier:h??"STANDARD",enableSnapshot:b===!0,access:d??"private",locations:S??N(P??"global"),...o?{sourceBucketName:o}:{},...l?{sourceBucketSnapshot:l}:{},config:await q()});if(k&&i(a,k),O==="json"){let n=T(a,{name:s}),r={action:"created",name:s,...o?{forkOf:o}:{}};n.length>0&&(r.nextActions=n),console.log(JSON.stringify(r))}y(a,{name:s}),w(a,{name:s})}export{F as default};
|
package/dist/lib/buckets/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as s}from"../../chunk-
|
|
1
|
+
import{c as s}from"../../chunk-LAB2KJTN.js";import{f as u}from"../../chunk-IRDNZN7R.js";import"../../chunk-N3Y6RFSK.js";import"../../chunk-S77OAN6Y.js";import{d as f}from"../../chunk-YN2TKPPT.js";import{a as p,b as c}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as i,j as m}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{getBucketInfo as h}from"@tigrisdata/storage";var t=m("buckets","get");async function w(e){a(t);let r=p(e,["name"]),g=c(e);r||o(t,"Bucket name is required");let{data:k,error:n}=await h(r,{config:await f()});n&&o(t,n);let l=[{property:"Name",value:r},...s(k).map(({label:d,value:b})=>({property:d,value:b}))],y=u(l,g,"bucket","property",[{key:"property",header:"Property"},{key:"value",header:"Value"}]);console.log(y),i(t)}export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R,b as k,c as b,d as F,e as I,f as c,g as h}from"../../../chunk-
|
|
1
|
+
import{a as R,b as k,c as b,d as F,e as I,f as c,g as h}from"../../../chunk-RZPBM4CD.js";import"../../../chunk-LAB2KJTN.js";import"../../../chunk-IRDNZN7R.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{e as y}from"../../../chunk-YN2TKPPT.js";import{a as x,b as w}from"../../../chunk-S6KFKBMY.js";import{b as n}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as m,c as p,j as g}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-OHGCOC5Q.js";var t=g("buckets lifecycle","create");async function O(r){m(t);let C=w(r),i=x(r,["name"]);i||n(t,"Bucket name is required");let e=R(r),d=k(e);d&&n(t,d);let a=b(e),o=F(e);!a.storageClass&&!o&&n(t,"A new rule must include a transition (--storage-class with --days or --date) and/or an expiration (--expire-days or --expire-date)"),a.storageClass&&e.days===void 0&&e.date===void 0&&n(t,"--storage-class requires --days or --date for a new transition rule");let f=I(e),s=await y(),u=await c(t,i,s),S={...a,...o?{expiration:o}:{},...e.prefix!==void 0?{filter:{prefix:e.prefix}}:{},...f!==void 0?{enabled:f}:{}};await h(t,i,[...u,S],s);let l=(await c(t,i,s)).find(B=>!u.some(E=>E.id===B.id))?.id??"(unknown)";C==="json"&&console.log(JSON.stringify({action:"created",bucket:i,id:l})),p(t,{name:i,id:l})}export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,b as R,c as k,d as F,e as S,f as q,g as w}from"../../../chunk-
|
|
1
|
+
import{a as C,b as R,c as k,d as F,e as S,f as q,g as w}from"../../../chunk-RZPBM4CD.js";import"../../../chunk-LAB2KJTN.js";import"../../../chunk-IRDNZN7R.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{e as b}from"../../../chunk-YN2TKPPT.js";import{a as c,b as x}from"../../../chunk-S6KFKBMY.js";import{b as t}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as p,c as y,j as h}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-OHGCOC5Q.js";var i=h("buckets lifecycle","edit");async function E(o){p(i);let T=x(o),n=c(o,["name"]),s=c(o,["id"]);n||t(i,"Bucket name is required"),s||t(i,"Rule id is required");let e=C(o),l=R(e,{requireStorageClassForTiming:!1});l&&t(i,l);let d=k(e),f=F(e),u=S(e);d.storageClass!==void 0||d.days!==void 0||d.date!==void 0||f!==void 0||u!==void 0||e.prefix!==void 0||t(i,"Provide at least one field to change (--storage-class, --days, --date, --expire-days, --expire-date, --prefix, --enable, --disable)");let g=await b(),m=await q(i,n,g),r=m.find(a=>a.id===s);if(r||t(i,`No lifecycle rule with id "${s}" found. Run \`tigris buckets lifecycle list ${n}\` to see ids.`),e.storageClass!==void 0||e.days!==void 0||e.date!==void 0){let a=d.storageClass??r.storageClass,B=e.days!==void 0?Number(e.days):e.date!==void 0?void 0:r.days,D=e.date!==void 0?e.date:e.days!==void 0?void 0:r.date;a||t(i,"--storage-class is required (this rule has no existing transition target)"),B===void 0&&D===void 0&&t(i,"--days or --date is required (this rule has no existing transition timing)")}let I={...r,...d,...f?{expiration:f}:{},...e.prefix!==void 0?{filter:{prefix:e.prefix}}:{},...u!==void 0?{enabled:u}:{}},v=m.map(a=>a.id===s?I:a);await w(i,n,v,g),T==="json"&&console.log(JSON.stringify({action:"updated",bucket:n,id:s})),y(i,{name:n,id:s})}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h,i as b}from"../../../chunk-
|
|
1
|
+
import{h,i as b}from"../../../chunk-RZPBM4CD.js";import"../../../chunk-LAB2KJTN.js";import{b as x,d as y,e as k}from"../../../chunk-IRDNZN7R.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{d as g}from"../../../chunk-YN2TKPPT.js";import{a as u,b as d}from"../../../chunk-S6KFKBMY.js";import{b as r}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as m,e as c,j as p}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-OHGCOC5Q.js";import{getBucketInfo as T}from"@tigrisdata/storage";var e=p("buckets lifecycle","list");async function w(n){f(e);let a=u(n,["name"]),s=d(n);a||r(e,"Bucket name is required");let{data:C,error:l}=await T(a,{config:await g()});l&&r(e,l);let o=C?.settings.lifecycleRules??[];if(o.length===0){c(e);return}let i=o.map(t=>({id:t.id??"-",prefix:t.filter?.prefix??"-",transition:h(t),expiration:b(t),status:t.enabled===!1?"disabled":"enabled"}));console.log(s==="json"?x(i):s==="xml"?y(i,"lifecycleRules","rule"):k(i,[{key:"id",header:"ID"},{key:"prefix",header:"Prefix"},{key:"transition",header:"Transition"},{key:"expiration",header:"Expiration"},{key:"status",header:"Status"}])),m(e,{count:o.length})}export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"../../../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i}from"../../../chunk-RZPBM4CD.js";import"../../../chunk-LAB2KJTN.js";import"../../../chunk-IRDNZN7R.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-S6KFKBMY.js";import"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";export{e as enabledFromInput,d as expirationFromInput,f as fetchExistingRules,i as formatExpirationCell,h as formatTransitionCell,a as readRuleInput,g as submitRules,c as transitionDeltaFromInput,b as validateRuleFieldCombinations};
|
package/dist/lib/buckets/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as D,g as E}from"../../chunk-IRDNZN7R.js";import{d as C}from"../../chunk-YN2TKPPT.js";import{a as u,b as T,c as x}from"../../chunk-S6KFKBMY.js";import{b as d}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as y,c as f,e as c,i as O,j as P}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{listBuckets as A,listForks as B}from"@tigrisdata/storage";var t=P("buckets","list");async function H(o){y(t);let n=T(o),r=u(o,["forks-of","forksOf"]),i=u(o,["deleted"]),{limit:k,pageToken:m,isPaginated:S}=x(o),g=await C();if(r&&S&&console.warn("\u26A0 Pagination flags are ignored when --forks-of is used (all buckets are fetched for filtering)"),r&&i&&console.warn("\u26A0 --deleted is ignored when --forks-of is used; use --deleted on its own to list soft-deleted buckets"),r){let{data:e,error:b}=await B(r,{config:g});if(b&&d(t,b),!e.forks||e.forks.length===0){c(t);return}let s=[];for(let w of e.forks)s.push({name:w.name,created:w.creationDate});let j=D(s,n,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(j),f(t,{count:s.length});return}let{data:a,error:l}=await A({...k!==void 0?{limit:k}:{},...m?{paginationToken:m}:{},...i?{deleted:i}:{},config:g});if(l&&d(t,l),!a.buckets||a.buckets.length===0){c(t);return}let p=a.buckets.map(e=>({name:e.name,created:e.creationDate})),F=[{key:"name",header:"Name"},{key:"created",header:"Created"}],h=a.paginationToken||void 0,N=E(p,n,"buckets","bucket",F,{paginationToken:h});console.log(N),n!=="json"&&n!=="xml"&&O(h),f(t,{count:p.length})}export{H as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as x}from"../../chunk-YN2TKPPT.js";import{a as d,b as l}from"../../chunk-S6KFKBMY.js";import{a as i,b as g,c as u,d as p}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as m,d as n,j as f}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{restoreBucket as w}from"@tigrisdata/storage";var t=f("buckets","restore");async function A(s){a(t);let k=l(s),o=d(s,["name"]);o||g(t,"Bucket name is required");let{data:S,error:e}=await w(o,{config:await x()});if(e&&(n(t,e.message,{name:o}),i(e,t)),!S.restored){let r="Bucket could not be restored";n(t,r,{name:o}),i(r,t)}if(k==="json"){let r=u(t,{name:o}),c={action:"restored",name:o};r.length>0&&(c.nextActions=r),console.log(JSON.stringify(c))}m(t,{name:o}),p(t,{name:o})}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,
|
|
1
|
+
import{a as l,c as d}from"../../chunk-N3Y6RFSK.js";import{a as g}from"../../chunk-S77OAN6Y.js";import{e as u}from"../../chunk-YN2TKPPT.js";import{a as e,b as p}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as s,c as f,j as m}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{updateBucket as y}from"@tigrisdata/storage";var t=m("buckets","set-locations");async function B(r){s(t);let k=p(r),o=e(r,["name"]),a=e(r,["locations"]);o||i(t,"Bucket name is required");let n;if(a!==void 0)n=d(a);else{g("Provide --locations flag");try{n=await l()}catch(w){i(t,w)}}let L=await u(),{error:c}=await y(o,{locations:n,config:L});c&&i(t,c),k==="json"&&console.log(JSON.stringify({action:"updated",bucket:o})),f(t,{name:o})}export{B as default};
|
package/dist/lib/buckets/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as j}from"../../chunk-N3Y6RFSK.js";import"../../chunk-S77OAN6Y.js";import{e as k}from"../../chunk-YN2TKPPT.js";import{a as n,b as A,d as s}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as h,c as w,j as O}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{updateBucket as L}from"@tigrisdata/storage";var i=O("buckets","set");async function S(e){h(i);let B=A(e),d=n(e,["name"]),r=n(e,["access"]),l=n(e,["locations"]),c=n(e,["allow-object-acl","allowObjectAcl"]),f=n(e,["disable-directory-listing","disableDirectoryListing"]),u=n(e,["cache-control","cacheControl"]),b=n(e,["custom-domain","customDomain"]),g=n(e,["enable-delete-protection","enableDeleteProtection"]),a=n(e,["soft-delete","softDelete"]),m=n(e,["retention-days","retentionDays"]),y=n(e,["enable-additional-headers","enableAdditionalHeaders"]);d||o(i,"Bucket name is required"),r===void 0&&l===void 0&&c===void 0&&f===void 0&&u===void 0&&b===void 0&&g===void 0&&a===void 0&&y===void 0&&o(i,"At least one setting is required");let t={};if(r!==void 0&&(t.access=r),l!==void 0&&(t.locations=j(l)),c!==void 0&&(t.allowObjectAcl=s(c)),f!==void 0&&(t.disableDirectoryListing=s(f)),u!==void 0&&(t.cacheControl=u),b!==void 0&&(t.customDomain=b),g!==void 0&&(t.enableDeleteProtection=s(g)),a!==void 0&&a!=="enable"&&a!=="disable"&&o(i,'--soft-delete must be "enable" or "disable"'),m!==void 0&&a!=="enable"&&o(i,"--retention-days can only be used with --soft-delete enable"),a==="enable"){m===void 0&&o(i,"--retention-days is required when enabling soft delete");let D=Number(m);(!Number.isInteger(D)||D<=0)&&o(i,"--retention-days must be a positive integer"),t.softDelete={enabled:!0,retentionDays:D}}else a==="disable"&&(t.softDelete={enabled:!1});y!==void 0&&(t.enableAdditionalHeaders=s(y));let C=await k(),{error:p}=await L(d,{...t,config:C});p&&o(i,p),B==="json"&&console.log(JSON.stringify({action:"updated",name:d})),w(i,{name:d})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../../chunk-
|
|
1
|
+
import{a as J}from"../../../chunk-S7EO4QWK.js";import{a}from"../../../chunk-TUDALPGD.js";import{a as h}from"../../../chunk-EFPPY2JQ.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-YN2TKPPT.js";import{a as s,b as w,e as P}from"../../../chunk-S6KFKBMY.js";import{b as e}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as g,c as y,j as S}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{existsSync as x,readFileSync as A}from"fs";import{editPolicy as D,getPolicy as N}from"@tigrisdata/iam";var t=S("iam policies","edit");async function T(o){g(t);let O=w(o),r=s(o,["resource"]),n=s(o,["document","d"]),d=s(o,["description"]),m=await h(t);if(!r){process.stdin.isTTY||e(t,"Policy ARN is required when piping document via stdin.");let i=await J(m,t,"Select a policy to edit:");if(!i)return;r=i}let c;if(n){let i;x(n)?i=A(n,"utf-8"):i=n;try{c=a(i)}catch{e(t,"Invalid JSON in policy document")}}else if(!process.stdin.isTTY&&!d){let i=await P();try{c=a(i)}catch{e(t,"Invalid JSON in policy document")}}!c&&!d&&e(t,"Either --document or --description is required.");let{data:u,error:f}=await N(r,{config:m});f&&e(t,f);let{data:l,error:p}=await D(r,{document:c??u.document,description:d??u.description,config:m});p&&e(t,p),O==="json"&&console.log(JSON.stringify({action:"updated",arn:l.resource})),y(t,{resource:l.resource})}export{T as default};
|
package/dist/lib/mk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as d}from"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";import{e as m}from"../chunk-RXNG56FL.js";import{d as h}from"../chunk-YN2TKPPT.js";import{a as e,b as g}from"../chunk-S6KFKBMY.js";import{a as s}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import"../chunk-3EAZ2L6H.js";import"../chunk-OHGCOC5Q.js";import{createBucket as y,put as O}from"@tigrisdata/storage";async function T(t){let l=e(t,["path"]);l||s("path argument is required");let{bucket:o,path:r}=m(l);o||s("Invalid path");let f=await h(),u=g(t);if(r){let a=r.endsWith("/")?r:`${r}/`,{error:c}=await O(a,"",{config:{...f,bucket:o}});c&&s(c),console.log(u==="json"?JSON.stringify({action:"created",type:"folder",bucket:o,path:a}):`Folder '${o}/${a}' created`),process.exit(0)}else{let c=e(t,["public"])?"public":e(t,["access","a","A"]),b=e(t,["enableSnapshots","enable-snapshots","s","S"]),S=e(t,["defaultTier","default-tier","t","T"]),k=e(t,["locations","l","L"]),n=e(t,["fork-of","forkOf","fork"]),i=e(t,["source-snapshot","sourceSnapshot","source-snap"]);i&&!n&&s("--source-snapshot requires --fork-of");let{error:p}=await y(o,{defaultTier:S??"STANDARD",enableSnapshot:b===!0,access:c??"private",locations:d(k??"global"),...n?{sourceBucketName:n}:{},...i?{sourceBucketSnapshot:i}:{},config:f});p&&s(p),console.log(u==="json"?JSON.stringify({action:"created",type:"bucket",name:o}):`Bucket '${o}' created`),process.exit(0)}}export{T as default};
|
package/dist/lib/stat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as w}from"../chunk-
|
|
1
|
+
import{c as w}from"../chunk-LAB2KJTN.js";import{a as d,f as m}from"../chunk-IRDNZN7R.js";import"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";import{e as I}from"../chunk-RXNG56FL.js";import{d as j}from"../chunk-YN2TKPPT.js";import{a as u,b as O}from"../chunk-S6KFKBMY.js";import{b as i}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import{b as y,c,j as b}from"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import"../chunk-3EAZ2L6H.js";import"../chunk-OHGCOC5Q.js";import{getBucketInfo as A,getStats as M,head as z}from"@tigrisdata/storage";var t=b("stat");async function C(s){y(t);let h=u(s,["path"]),f=O(s),v=u(s,["snapshot-version","snapshotVersion","snapshot"]),S=u(s,["version-id","versionId"]),l=await j();if(!h){let{data:o,error:a}=await M({config:l});a&&i(t,a);let p=[{metric:"Active Buckets",value:String(o.stats.activeBuckets)},{metric:"Total Objects",value:String(o.stats.totalObjects)},{metric:"Total Unique Objects",value:String(o.stats.totalUniqueObjects)},{metric:"Total Storage",value:d(o.stats.totalStorageBytes)}],g=m(p,f,"stats","stat",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(g),c(t),process.exit(0)}let{bucket:r,path:n}=I(h);if(r||i(t,"Invalid path"),!n||n==="/"){let{data:o,error:a}=await A(r,{config:l});a&&i(t,a);let p=w(o).map(({label:T,value:V})=>({metric:T,value:V})),g=m(p,f,"bucket-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(g),c(t,{bucket:r}),process.exit(0)}let{data:e,error:k}=await z(n,{...v?{snapshotVersion:v}:{},...S?{versionId:S}:{},config:{...l,bucket:r}});k&&i(t,k),e||i(t,"Object not found");let x=[{metric:"Path",value:e.path},{metric:"Size",value:d(e.size)},{metric:"Content-Type",value:e.contentType||"N/A"},{metric:"Content-Disposition",value:e.contentDisposition||"N/A"},{metric:"Modified",value:e.modified.toISOString()}],B=m(x,f,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(B),c(t,{bucket:r,path:n}),process.exit(0)}export{C as default};
|
package/dist/lib/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as d}from"../chunk-S6KFKBMY.js";import{a as t,c as l,d as p,e as f}from"../chunk-
|
|
1
|
+
import{b as d}from"../chunk-S6KFKBMY.js";import{a as t,c as l,d as p,e as f}from"../chunk-GLKOUVFH.js";import{b as m}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import{b as s,c as i,f as a,j as c}from"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import{execSync as h}from"child_process";var r=c("update");async function v(u={}){let g=d(u);s(r);try{let o=await f(),e=l(t,o),n=p();if(g==="json"){console.log(JSON.stringify({currentVersion:t,latestVersion:o,updateAvailable:e,updateCommand:n}));return}console.log(`Current version: ${t}`),e?(console.log(`Latest version: ${o}`),console.log("Updating..."),h(n,{stdio:"inherit",...process.platform==="win32"?{shell:"powershell.exe"}:{}}),i(r,{latestVersion:o})):a(r,{currentVersion:t})}catch(o){m(r,o)}}export{v as default};
|
package/dist/specs.yaml
CHANGED
|
@@ -667,6 +667,7 @@ commands:
|
|
|
667
667
|
- "tigris buckets list"
|
|
668
668
|
- "tigris buckets list --format json"
|
|
669
669
|
- "tigris buckets list --forks-of my-bucket"
|
|
670
|
+
- "tigris buckets list --deleted"
|
|
670
671
|
messages:
|
|
671
672
|
onStart: 'Listing buckets...'
|
|
672
673
|
onSuccess: 'Found {{count}} bucket(s)'
|
|
@@ -679,6 +680,9 @@ commands:
|
|
|
679
680
|
default: table
|
|
680
681
|
- name: forks-of
|
|
681
682
|
description: Only list buckets that are forks of the named source bucket
|
|
683
|
+
- name: deleted
|
|
684
|
+
description: Only list soft-deleted buckets
|
|
685
|
+
type: flag
|
|
682
686
|
- name: limit
|
|
683
687
|
description: Maximum number of items to return per page
|
|
684
688
|
- name: page-token
|
|
@@ -793,6 +797,25 @@ commands:
|
|
|
793
797
|
- name: force
|
|
794
798
|
type: flag
|
|
795
799
|
description: Skip confirmation prompts (alias for --yes)
|
|
800
|
+
# restore
|
|
801
|
+
- name: restore
|
|
802
|
+
description: Restore a soft-deleted bucket within its retention window. List recoverable buckets with "tigris buckets list --deleted"
|
|
803
|
+
examples:
|
|
804
|
+
- "tigris buckets restore my-bucket"
|
|
805
|
+
messages:
|
|
806
|
+
onStart: 'Restoring bucket...'
|
|
807
|
+
onSuccess: "Bucket '{{name}}' restored successfully"
|
|
808
|
+
onFailure: "Failed to restore bucket '{{name}}'"
|
|
809
|
+
nextActions:
|
|
810
|
+
- command: 'tigris buckets get {{name}}'
|
|
811
|
+
description: 'Inspect the restored bucket'
|
|
812
|
+
arguments:
|
|
813
|
+
- name: name
|
|
814
|
+
description: Name of the soft-deleted bucket to restore
|
|
815
|
+
type: positional
|
|
816
|
+
required: true
|
|
817
|
+
examples:
|
|
818
|
+
- my-bucket
|
|
796
819
|
# set
|
|
797
820
|
- name: set
|
|
798
821
|
description: Update settings on an existing bucket such as access level, location, caching, or custom domain
|
|
@@ -801,6 +824,8 @@ commands:
|
|
|
801
824
|
- "tigris buckets set my-bucket --access public"
|
|
802
825
|
- "tigris buckets set my-bucket --locations iad,fra --cache-control 'max-age=3600'"
|
|
803
826
|
- "tigris buckets set my-bucket --custom-domain assets.example.com"
|
|
827
|
+
- "tigris buckets set my-bucket --soft-delete enable --retention-days 30"
|
|
828
|
+
- "tigris buckets set my-bucket --soft-delete disable"
|
|
804
829
|
messages:
|
|
805
830
|
onStart: 'Updating bucket...'
|
|
806
831
|
onSuccess: 'Bucket {{name}} updated successfully'
|
|
@@ -835,6 +860,13 @@ commands:
|
|
|
835
860
|
- name: enable-delete-protection
|
|
836
861
|
description: Enable delete protection
|
|
837
862
|
type: boolean
|
|
863
|
+
deprecated: true
|
|
864
|
+
replaced_by: --soft-delete
|
|
865
|
+
- name: soft-delete
|
|
866
|
+
description: Enable or disable soft delete (recoverable deletes). Requires --retention-days when enabling
|
|
867
|
+
options: [enable, disable]
|
|
868
|
+
- name: retention-days
|
|
869
|
+
description: Number of days to retain soft-deleted objects (required when enabling --soft-delete)
|
|
838
870
|
- name: enable-additional-headers
|
|
839
871
|
description: Enable additional HTTP headers (X-Content-Type-Options nosniff)
|
|
840
872
|
type: boolean
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"../chunk-
|
|
1
|
+
import{a,b,c}from"../chunk-LAB2KJTN.js";import"../chunk-IRDNZN7R.js";import"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";export{c as buildBucketInfo,b as describeExpiration,a as describeTransition};
|
package/dist/utils/locations.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b,c}from"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";export{b as formatLocations,c as parseLocations,a as promptLocations};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c as b,d as c,e as d,f as e}from"../chunk-
|
|
1
|
+
import{b as a,c as b,d as c,e as d,f as e}from"../chunk-GLKOUVFH.js";import"../chunk-ATBINUDP.js";export{e as checkForUpdates,d as fetchLatestVersion,c as getUpdateCommand,b as isNewerVersion,a as readUpdateCache};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tigrisdata/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Command line interface for Tigris object storage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"@aws-sdk/credential-providers": "^3.1038.0",
|
|
104
104
|
"@smithy/shared-ini-file-loader": "^4.4.9",
|
|
105
105
|
"@tigrisdata/iam": "^2.1.1",
|
|
106
|
-
"@tigrisdata/storage": "^3.
|
|
106
|
+
"@tigrisdata/storage": "^3.12.0",
|
|
107
107
|
"commander": "^14.0.3",
|
|
108
108
|
"enquirer": "^2.4.1",
|
|
109
109
|
"jose": "^6.2.3",
|
package/dist/chunk-HWX63Y3P.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as l}from"./chunk-IRDNZN7R.js";function r(e){if(e.storageClass)return e.days!==void 0?`${e.storageClass} after ${e.days}d`:e.date!==void 0?`${e.storageClass} on ${e.date}`:e.storageClass}function f(e){if(e.expiration){if(e.expiration.days!==void 0)return`${e.expiration.days}d`;if(e.expiration.date!==void 0)return e.expiration.date}}function a(e){let n=[],i=r(e);i&&n.push(i);let s=f(e);s&&n.push(e.expiration?.days!==void 0?`expire after ${s}`:`expire on ${s}`);let t=[];e.filter?.prefix&&t.push(`prefix=${e.filter.prefix}`),e.enabled===!1&&t.push("disabled");let o=n.join(", ");return t.length>0?`${o} (${t.join(", ")})`:o}function c(e){let n=[{label:"Number of Objects",value:e.sizeInfo.numberOfObjects?.toString()??"N/A"},{label:"Total Size",value:e.sizeInfo.size!==void 0?l(e.sizeInfo.size):"N/A"},{label:"All Versions Count",value:e.sizeInfo.numberOfObjectsAllVersions?.toString()??"N/A"},{label:"Default Tier",value:e.settings.defaultTier},{label:"Snapshots Enabled",value:e.isSnapshotEnabled?"Yes":"No"},{label:"Delete Protection",value:e.settings.deleteProtection?"Yes":"No"},{label:"Allow Object ACL",value:e.settings.allowObjectAcl?"Yes":"No"},{label:"Custom Domain",value:e.settings.customDomain??"None"},{label:"Has Forks",value:e.forkInfo?.hasChildren?"Yes":"No"}];return e.forkInfo?.parents?.length&&(n.push({label:"Forked From",value:e.forkInfo.parents[0].bucketName}),n.push({label:"Fork Snapshot",value:e.forkInfo.parents[0].snapshot})),e.settings.lifecycleRules?.length&&n.push({label:"Lifecycle Rules",value:e.settings.lifecycleRules.map(i=>a(i)).join(", ")}),e.settings.corsRules.length&&n.push({label:"CORS Rules",value:`${e.settings.corsRules.length} rule(s)`}),e.settings.notifications&&n.push({label:"Notifications",value:e.settings.notifications.enabled!==!1?"Enabled":"Disabled"}),e.settings.dataMigration&&n.push({label:"Data Migration",value:e.settings.dataMigration.endpoint?`${e.settings.dataMigration.name??"N/A"} (${e.settings.dataMigration.endpoint})`:e.settings.dataMigration.name??"Configured"}),n}export{r as a,f as b,c};
|
package/dist/chunk-QWZ6FK7E.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{a as w}from"./chunk-UBANDLB4.js";import{h as C}from"./chunk-7ZUCJBD5.js";import{Command as L,Option as _}from"commander";function A(n,t,e,a,o){let r=n[n.length-1],i=typeof r=="object"&&r!==null&&"args"in r?r.args:n.filter(l=>typeof l=="string");if(i.length===0)return i;let m=i[0],d=(t.commands??[]).filter(l=>g(l,[...e,l.name],o));if(!new Set(d.flatMap(l=>[l.name,...Array.isArray(l.alias)?l.alias:l.alias?[l.alias]:[]])).has(m)){let l=d.map(u=>u.name),p=e.length>0?`'${m}' for '${e.join(" ")}'`:`'${m}'`;console.error(`Unknown command ${p}.`),l.length>0&&console.error(`Available commands: ${l.join(", ")}`);let f=e.length>0?`${a.name} ${e.join(" ")} help`:`${a.name} help`;console.error(`
|
|
2
|
-
Run "${f}" for usage.`),process.exit(1)}return i}function G(){process.on("unhandledRejection",n=>{(n===""||n===void 0)&&(console.error(`
|
|
3
|
-
Operation cancelled`),process.exit(1)),w(n)}),process.on("uncaughtException",n=>{w(n)})}function U(n){return/^[a-zA-Z0-9_-]+$/.test(n)}function D(n){let t;n.type==="positional"?t=` ${n.name}`:(t=` --${n.name}`,n.alias&&typeof n.alias=="string"&&(t+=n.alias.length===1?`, -${n.alias}`:`, --${n.alias}`));let e=26,a=t.length>=e?t+" ":t.padEnd(e),o=n.description;return n.options&&(Array.isArray(n.options)&&typeof n.options[0]=="string"?o+=` (options: ${n.options.join(", ")})`:o+=` (options: ${n.options.map(r=>r.value).join(", ")})`),n.default&&(o+=` [default: ${n.default}]`),n.required&&(o+=" [required]"),n["required-when"]&&(o+=` [required when: ${n["required-when"]}]`),n.multiple&&(o+=" [multiple values: comma-separated]"),n.type==="positional"&&(o+=" [positional argument]"),n.examples&&n.examples.length>0&&(o+=` (examples: ${n.examples.join(", ")})`),`${a}${o}`}function g(n,t,e){return n.removed||e(t)?!0:n.commands?n.commands.some(a=>g(a,[...t,a.name],e)):!1}function R(n,t){let e=t?` Use ${t} instead.`:" See the changelog for migration guidance.";console.error(`${n} was removed in this version.${e}`),process.exit(1)}function v(n,t){if(n)for(let e of n){if(!e.removed)continue;h(t,e.name,n)!==void 0&&R(`--${e.name}`,e.replaced_by)}}function b(n,t,e,a){let o=e.join(" ");if(console.log(`
|
|
4
|
-
${n.name} ${o} - ${t.description??""}
|
|
5
|
-
`),t.commands&&t.commands.length>0){let m=t.commands.filter(s=>!s.removed&&g(s,[...e,s.name],a));m.length>0&&(console.log("Commands:"),m.forEach(s=>{let d=` ${s.name}`;if(s.alias){let l=Array.isArray(s.alias)?s.alias:[s.alias];d+=` (${l.join(", ")})`}let c=d.padEnd(24);console.log(`${c}${s.description??""}`)}),console.log())}let r=n.definitions?.global_arguments??[],i=y(r,t.arguments).filter(m=>!m.removed);i.length>0&&(console.log("Arguments:"),i.forEach(m=>{console.log(D(m))}),console.log()),t.examples&&t.examples.length>0&&(console.log("Examples:"),t.examples.forEach(m=>{console.log(` ${m}`)}),console.log()),t.commands&&t.commands.length>0&&console.log(`Use "${n.name} ${o} <command> help" for more information about a command.`)}function k(n,t,e){console.log(`Tigris CLI Version: ${t}
|
|
6
|
-
`),console.log(`Usage: tigris [command] [options]
|
|
7
|
-
`),console.log("Commands:"),n.commands.filter(o=>!o.removed&&g(o,[o.name],e)).forEach(o=>{let r=` ${o.name}`;if(o.alias){let m=Array.isArray(o.alias)?o.alias:[o.alias];r+=` (${m.join(", ")})`}let i=r.padEnd(24);console.log(`${i}${o.description??""}`)}),console.log(`
|
|
8
|
-
Use "${n.name} <command> help" for more information about a command.`)}function y(n,t){let e=t??[],a=new Set(e.map(i=>i.name)),o=new Set(e.filter(i=>i.alias).map(i=>i.alias)),r=n.filter(i=>!a.has(i.name)&&!(i.alias&&o.has(i.alias)));return[...e,...r]}function E(n,t=[]){t.forEach(e=>{if(e.type==="positional"){let a=e.required?`<${e.name}>`:`[${e.name}]`;n.argument(a,e.description)}else{let a=e.alias&&typeof e.alias=="string"&&e.alias.length===1,o=e.alias&&typeof e.alias=="string"&&e.alias.length>1,r=a?`-${e.alias}, --${e.name}`:o?`--${e.alias}, --${e.name}`:`--${e.name}`;e.type==="flag"||(e.type==="boolean"?r+=" [value]":e.options?r+=" <value>":r+=e.required||e["required-when"]?" <value>":" [value]"),e.removed?n.addOption(new _(r,e.description??"").hideHelp()):n.option(r,e.description??"",e.default)}})}function M(n){return n.replace(/-([a-z])/g,(t,e)=>e.toUpperCase())}function h(n,t,e){if(e){let o=e.find(r=>r.name===t);if(o&&o.alias&&typeof o.alias=="string"){let r=o.alias.charAt(0).toUpperCase()+o.alias.slice(1);if(n[r]!==void 0)return n[r]}}let a=[t,t.replace(/-/g,""),t.replace(/-/g,"").toLowerCase(),t.charAt(0).toUpperCase(),M(t)];for(let o of a)if(n[o]!==void 0)return n[o]}function S(n,t){for(let e of n){if(e["required-when"]){let[a,o]=e["required-when"].split("="),r=h(t,a,n),i=h(t,e.name,n);if(r===o&&!i)return console.error(`--${e.name} is required when --${a} is ${o}`),!1}if(e.required&&!h(t,e.name,n))return console.error(`--${e.name} is required`),!1}return!0}function j(n,t,e){let a;"optsWithGlobals"in e&&typeof e.optsWithGlobals=="function"?a=e.optsWithGlobals():"opts"in e&&typeof e.opts=="function"?a=e.opts():a=e;let o={...a};return n.filter(i=>i.type==="positional").forEach((i,m)=>{t[m]!==void 0&&(i.multiple?o[i.name]=t[m].split(",").map(s=>s.trim()):o[i.name]=t[m])}),n.forEach(i=>{i.multiple&&i.type!=="positional"&&o[i.name]&&typeof o[i.name]=="string"&&(o[i.name]=o[i.name].split(",").map(m=>m.trim()))}),o}async function I(n,t,e=[],a={}){(a.json||a.format==="json")&&(globalThis.__TIGRIS_JSON_MODE=!0);let{module:o,error:r}=await n(t);(r||!o)&&(console.error(r),process.exit(1));let i=t[t.length-1],m=o.default||o[i];typeof m!="function"&&(console.error(`Command not implemented: ${t.join(" ")}`),process.exit(1)),await m({...a,_positional:e})}function q(n,t,e,a=[]){let{specs:o,loadModule:r,hasImplementation:i}=n,m=o.definitions?.global_arguments??[];for(let s of e){U(s.name)||(console.error(`Invalid command name "${s.name}": only alphanumeric, hyphens, and underscores allowed`),process.exit(1));let d=[...a,s.name];if(!g(s,d,i))continue;let c=t.command(s.name,s.removed?{hidden:!0}:void 0).description(s.description??"");if(s.alias&&(Array.isArray(s.alias)?s.alias:[s.alias]).forEach(p=>c.alias(p)),s.removed){c.allowUnknownOption(!0),c.allowExcessArguments(!0),c.action(()=>{R(`${o.name} ${d.join(" ")}`,s.replaced_by)});continue}if(s.commands&&s.commands.length>0)if(q(n,c,s.commands,d),s.default){let l=s.commands.find(p=>p.name===s.default);if(l){let p=y(m,[...s.arguments||[],...l.arguments||[]]);E(c,p),c.allowExcessArguments(!0),c.action(async(...f)=>{let u=f.pop(),x=A([u],s,d,o,i),$=j(p,x,u);p.length>0&&!S(p,$)||(v(p,$),l.deprecated&&l.messages?.onDeprecated&&C(l.messages.onDeprecated),await I(r,[...d,l.name],x,$))})}}else c.allowExcessArguments(!0),c.action((...l)=>{A(l,s,d,o,i),b(o,s,d,i)});else E(c,y(m,s.arguments)),c.action(async(...l)=>{let p=l.pop(),f=l,u=j(s.arguments||[],f,p);s.arguments&&!S(s.arguments,u)||(v(s.arguments,u),s.deprecated&&s.messages?.onDeprecated&&C(s.messages.onDeprecated),await I(r,d,f,u))});c.command("help").description("Show help for this command").action(()=>{b(o,s,d,i)})}}function P(n){let{specs:t,version:e,hasImplementation:a}=n,o=new L;return o.name(t.name).description(t.description).version(e),q(n,o,t.commands),o.command("help").description("Show general help").action(()=>{k(t,e,a)}),o.command("version").description("Show the CLI version").action(()=>{console.log(e)}),o.allowExcessArguments(!0),o.action((...r)=>{A(r,{commands:t.commands},[],t,a),k(t,e,a)}),o}export{G as a,U as b,D as c,g as d,b as e,k as f,E as g,S as h,j as i,q as j,P as k};
|
package/dist/chunk-TD2HGNDY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|