@tigrisdata/cli 3.0.0 → 3.2.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/README.md CHANGED
@@ -287,6 +287,7 @@ tigris presign <path> [flags]
287
287
  | `--access-key` | Access key ID to use for signing. If not provided, resolved from credentials or auto-selected |
288
288
  | `--select` | Interactively select an access key (OAuth only) |
289
289
  | `--format` | Output format (default: url) |
290
+ | `-snapshot, --snapshot-version` | Read from a specific bucket snapshot. Accepts a snapshot version string or any UNIX nanosecond-precision timestamp (e.g. 1765889000501544464). Only supported for GET requests. |
290
291
 
291
292
  **Examples:**
292
293
  ```bash
@@ -445,7 +446,10 @@ Create, inspect, update, and delete buckets. Buckets are top-level containers th
445
446
  | `tigris buckets create` (c) | Create a new bucket with optional access, tier, and location settings |
446
447
  | `tigris buckets get` (g) | Show details for a bucket including access level, region, tier, and custom domain |
447
448
  | `tigris buckets delete` (d) | Delete one or more buckets by name. The bucket must be empty or delete-protection must be off |
449
+ | `tigris buckets restore` | Restore a soft-deleted bucket within its retention window. List recoverable buckets with "tigris buckets list --deleted" |
448
450
  | `tigris buckets set` (s) | Update settings on an existing bucket such as access level, location, caching, or custom domain |
451
+ | `tigris buckets enable-snapshots` | Enable snapshots on an existing bucket, converting it to a snapshot bucket |
452
+ | `tigris buckets disable-snapshots` | Disable snapshots on an existing bucket, converting it back to a regular bucket. Rejected while the bucket has dependent forks |
449
453
  | `tigris buckets set-locations` | Set the data locations for a bucket |
450
454
  | `tigris buckets set-migration` | Configure data migration from an external S3-compatible source bucket. Tigris will pull objects on demand from the source |
451
455
  | `tigris buckets migrate` | Actively migrate all objects from a shadow bucket to Tigris by scheduling server-side migration for unmigrated objects |
@@ -465,6 +469,7 @@ tigris buckets list [flags]
465
469
  |------|-------------|
466
470
  | `--format` | Output format (default: table) |
467
471
  | `--forks-of` | Only list buckets that are forks of the named source bucket |
472
+ | `--deleted` | Only list soft-deleted buckets |
468
473
  | `--limit` | Maximum number of items to return per page |
469
474
  | `-pt, --page-token` | Pagination token from a previous request to fetch the next page |
470
475
 
@@ -473,6 +478,7 @@ tigris buckets list [flags]
473
478
  tigris buckets list
474
479
  tigris buckets list --format json
475
480
  tigris buckets list --forks-of my-bucket
481
+ tigris buckets list --deleted
476
482
  ```
477
483
 
478
484
  #### `tigris buckets create` (c)
@@ -537,6 +543,19 @@ tigris buckets delete my-bucket --yes
537
543
  tigris buckets delete bucket-a,bucket-b --yes
538
544
  ```
539
545
 
546
+ #### `tigris buckets restore`
547
+
548
+ Restore a soft-deleted bucket within its retention window. List recoverable buckets with "tigris buckets list --deleted"
549
+
550
+ ```
551
+ tigris buckets restore <name>
552
+ ```
553
+
554
+ **Examples:**
555
+ ```bash
556
+ tigris buckets restore my-bucket
557
+ ```
558
+
540
559
  #### `tigris buckets set` (s)
541
560
 
542
561
  Update settings on an existing bucket such as access level, location, caching, or custom domain
@@ -554,6 +573,8 @@ tigris buckets set <name> [flags]
554
573
  | `--cache-control` | Default cache-control header value |
555
574
  | `--custom-domain` | Custom domain for the bucket |
556
575
  | `--enable-delete-protection` | Enable delete protection |
576
+ | `--soft-delete` | Enable or disable soft delete (recoverable deletes). Requires --retention-days when enabling |
577
+ | `--retention-days` | Number of days to retain soft-deleted objects (required when enabling --soft-delete) |
557
578
  | `--enable-additional-headers` | Enable additional HTTP headers (X-Content-Type-Options nosniff) |
558
579
 
559
580
  **Examples:**
@@ -561,6 +582,34 @@ tigris buckets set <name> [flags]
561
582
  tigris buckets set my-bucket --access public
562
583
  tigris buckets set my-bucket --locations iad,fra --cache-control 'max-age=3600'
563
584
  tigris buckets set my-bucket --custom-domain assets.example.com
585
+ tigris buckets set my-bucket --soft-delete enable --retention-days 30
586
+ tigris buckets set my-bucket --soft-delete disable
587
+ ```
588
+
589
+ #### `tigris buckets enable-snapshots`
590
+
591
+ Enable snapshots on an existing bucket, converting it to a snapshot bucket
592
+
593
+ ```
594
+ tigris buckets enable-snapshots <name>
595
+ ```
596
+
597
+ **Examples:**
598
+ ```bash
599
+ tigris buckets enable-snapshots my-bucket
600
+ ```
601
+
602
+ #### `tigris buckets disable-snapshots`
603
+
604
+ Disable snapshots on an existing bucket, converting it back to a regular bucket. Rejected while the bucket has dependent forks
605
+
606
+ ```
607
+ tigris buckets disable-snapshots <name>
608
+ ```
609
+
610
+ **Examples:**
611
+ ```bash
612
+ tigris buckets disable-snapshots my-bucket
564
613
  ```
565
614
 
566
615
  #### `tigris buckets set-locations`
@@ -1 +1 @@
1
- import{a as s,f as l}from"./chunk-GNWZ7PX2.js";import{a as i,k as m}from"./chunk-QWZ6FK7E.js";import{b as t}from"./chunk-PPNBQWSR.js";import{existsSync as c}from"fs";import{dirname as u,join as a}from"path";import{fileURLToPath as f}from"url";i();var j=f(import.meta.url),d=u(j),h=t(),y=o=>{if(o.length===0)return!1;let e=a(d,"lib",...o)+".js";if(c(e))return!0;let r=a(d,"lib",...o,"index.js");return!!c(r)},b=async o=>{let e=[`./lib/${o.join("/")}.js`,`./lib/${o.join("/")}/index.js`];for(let p of e){let n=await import(p).catch(()=>null);if(n)return{module:n,error:null}}return{module:null,error:`Command not found: ${o.join(" ")}`}},x=m({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
1
+ import{a as s,f as l}from"./chunk-YWSU7MW7.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();
@@ -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};
@@ -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-HWX63Y3P.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
+ 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,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.0.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(`
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.2.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)}
package/dist/cli-core.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-QWZ6FK7E.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};
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-7EHCU6PH.js";import"./chunk-GNWZ7PX2.js";import"./chunk-QWZ6FK7E.js";import"./chunk-UBANDLB4.js";import"./chunk-DV3LCXRH.js";import"./chunk-7ZUCJBD5.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
2
+ import"./chunk-2OQSVS4G.js";import"./chunk-YWSU7MW7.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-7EHCU6PH.js";import"./chunk-GNWZ7PX2.js";import"./chunk-QWZ6FK7E.js";import"./chunk-UBANDLB4.js";import"./chunk-DV3LCXRH.js";import"./chunk-7ZUCJBD5.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
1
+ import"./chunk-2OQSVS4G.js";import"./chunk-YWSU7MW7.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,b as N}from"../../chunk-TD2HGNDY.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};
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};
@@ -0,0 +1 @@
1
+ import{e as m}from"../../chunk-YN2TKPPT.js";import{a as f,b as c}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as s,c as a,j as e}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{disableSnapshot as l}from"@tigrisdata/storage";var o=e("buckets","disable-snapshots");async function d(n){s(o);let g=c(n),t=f(n,["name"]);t||i(o,"Bucket name is required");let p=await m(),{error:r}=await l(t,{config:p});r&&i(o,r),g==="json"&&console.log(JSON.stringify({action:"snapshots-disabled",name:t})),a(o,{name:t})}export{d as default};
@@ -0,0 +1 @@
1
+ import{e as m}from"../../chunk-YN2TKPPT.js";import{a as f,b as c}from"../../chunk-S6KFKBMY.js";import{b as n}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as e,c as a,j as s}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{enableSnapshot as l}from"@tigrisdata/storage";var o=s("buckets","enable-snapshots");async function u(r){e(o);let g=c(r),t=f(r,["name"]);t||n(o,"Bucket name is required");let p=await m(),{error:i}=await l(t,{config:p});i&&n(o,i),g==="json"&&console.log(JSON.stringify({action:"snapshots-enabled",name:t})),a(o,{name:t})}export{u as default};
@@ -1 +1 @@
1
- import{c as s}from"../../chunk-HWX63Y3P.js";import{f as u}from"../../chunk-IRDNZN7R.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
+ 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-EBWDZEHM.js";import"../../../chunk-HWX63Y3P.js";import"../../../chunk-IRDNZN7R.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
+ 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-EBWDZEHM.js";import"../../../chunk-HWX63Y3P.js";import"../../../chunk-IRDNZN7R.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
+ 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-EBWDZEHM.js";import"../../../chunk-HWX63Y3P.js";import{b as x,d as y,e as k}from"../../../chunk-IRDNZN7R.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
+ 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-EBWDZEHM.js";import"../../../chunk-HWX63Y3P.js";import"../../../chunk-IRDNZN7R.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};
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};
@@ -1 +1 @@
1
- import{f as x,g as I}from"../../chunk-IRDNZN7R.js";import{d as T}from"../../chunk-YN2TKPPT.js";import{a as y,b as C,c as P}from"../../chunk-S6KFKBMY.js";import{b as m}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b,c as u,e as s,i as O,j as w}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{getBucketInfo as D,listBuckets as F}from"@tigrisdata/storage";var t=w("buckets","list");async function H(f){b(t);let o=C(f),e=y(f,["forks-of","forksOf"]),{limit:k,pageToken:g,isPaginated:E}=P(f),c=await T();e&&E&&console.warn("\u26A0 Pagination flags are ignored when --forks-of is used (all buckets are fetched for filtering)");let{data:n,error:d}=await F({...e?{}:{...k!==void 0?{limit:k}:{},...g?{paginationToken:g}:{}},config:c});if(d&&m(t,d),!n.buckets||n.buckets.length===0){s(t);return}if(e){let{data:r,error:h}=await D(e,{config:c});if(h&&m(t,h),!r.forkInfo?.hasChildren){s(t);return}let a=[];for(let i of n.buckets){if(i.name===e)continue;let{data:j}=await D(i.name,{config:c});j?.forkInfo?.parents?.some(A=>A.bucketName===e)&&a.push({name:i.name,created:i.creationDate})}if(a.length===0){s(t);return}let B=x(a,o,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(B),u(t,{count:a.length});return}let l=n.buckets.map(r=>({name:r.name,created:r.creationDate})),N=[{key:"name",header:"Name"},{key:"created",header:"Created"}],p=n.paginationToken||void 0,S=I(l,o,"buckets","bucket",N,{paginationToken:p});console.log(S),o!=="json"&&o!=="xml"&&O(p),u(t,{count:l.length})}export{H as default};
1
+ import{g as l}from"../../chunk-IRDNZN7R.js";import{d as j}from"../../chunk-YN2TKPPT.js";import{a as g,b as P,c as S}from"../../chunk-S6KFKBMY.js";import{b as m}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as D,c as d,e as k,i as u,j as E}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 e=E("buckets","list");async function H(o){D(e);let n=P(o),s=g(o,["forks-of","forksOf"]),c=g(o,["deleted"]),{limit:r,pageToken:i}=S(o),p=await j();s&&c&&console.warn("\u26A0 --deleted is ignored when --forks-of is used; use --deleted on its own to list soft-deleted buckets");let b=[{key:"name",header:"Name"},{key:"created",header:"Created"}];if(s){let{data:t,error:x}=await B(s,{...r!==void 0?{limit:r}:{},...i?{paginationToken:i}:{},config:p});if(x&&m(e,x),!t.forks||t.forks.length===0){k(e);return}let f=[];for(let O of t.forks)f.push({name:O.name,created:O.creationDate});let y=t.paginationToken||void 0,F=l(f,n,"forks","fork",b,{paginationToken:y});console.log(F),n!=="json"&&n!=="xml"&&u(y),d(e,{count:f.length});return}let{data:a,error:h}=await A({...r!==void 0?{limit:r}:{},...i?{paginationToken:i}:{},...c?{deleted:c}:{},config:p});if(h&&m(e,h),!a.buckets||a.buckets.length===0){k(e);return}let T=a.buckets.map(t=>({name:t.name,created:t.creationDate})),w=a.paginationToken||void 0,C=l(T,n,"buckets","bucket",b,{paginationToken:w});console.log(C),n!=="json"&&n!=="xml"&&u(w),d(e,{count:T.length})}export{H as default};
@@ -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,b as d}from"../../chunk-TD2HGNDY.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};
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};
@@ -1 +1 @@
1
- import{b as y}from"../../chunk-TD2HGNDY.js";import"../../chunk-S77OAN6Y.js";import{e as w}from"../../chunk-YN2TKPPT.js";import{a as n,b as h,d as i}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as D,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 j}from"@tigrisdata/storage";var o=O("buckets","set");async function B(e){p(o);let A=h(e),a=n(e,["name"]),r=n(e,["access"]),s=n(e,["locations"]),d=n(e,["allow-object-acl","allowObjectAcl"]),l=n(e,["disable-directory-listing","disableDirectoryListing"]),f=n(e,["cache-control","cacheControl"]),u=n(e,["custom-domain","customDomain"]),g=n(e,["enable-delete-protection","enableDeleteProtection"]),m=n(e,["enable-additional-headers","enableAdditionalHeaders"]);a||c(o,"Bucket name is required"),r===void 0&&s===void 0&&d===void 0&&l===void 0&&f===void 0&&u===void 0&&g===void 0&&m===void 0&&c(o,"At least one setting is required");let t={};r!==void 0&&(t.access=r),s!==void 0&&(t.locations=y(s)),d!==void 0&&(t.allowObjectAcl=i(d)),l!==void 0&&(t.disableDirectoryListing=i(l)),f!==void 0&&(t.cacheControl=f),u!==void 0&&(t.customDomain=u),g!==void 0&&(t.enableDeleteProtection=i(g)),m!==void 0&&(t.enableAdditionalHeaders=i(m));let k=await w(),{error:b}=await j(a,{...t,config:k});b&&c(o,b),A==="json"&&console.log(JSON.stringify({action:"updated",name:a})),D(o,{name:a})}export{B as default};
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};
package/dist/lib/mk.js CHANGED
@@ -1 +1 @@
1
- import{b as d}from"../chunk-TD2HGNDY.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};
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};
@@ -1,3 +1,3 @@
1
- import{b as A}from"../chunk-IRDNZN7R.js";import{e as w}from"../chunk-RXNG56FL.js";import{a as k,d as K}from"../chunk-YN2TKPPT.js";import{a as g,b as h}from"../chunk-S6KFKBMY.js";import{a as n}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import{c as p}from"../chunk-3EAZ2L6H.js";import{i as y,p as u}from"../chunk-OHGCOC5Q.js";import{listAccessKeys as C}from"@tigrisdata/iam";import{getPresignedUrl as P}from"@tigrisdata/storage";import $ from"enquirer";var{prompt:b}=$;async function T(s){let r=g(s,["path"]);r||n("path argument is required");let{bucket:c,path:e}=w(r);c||n("Invalid path"),e||n("Object key is required");let i=g(s,["method","m"])??"get",t=parseInt(g(s,["expires-in","expiresIn","e"])??"3600",10),l=h(s,"url"),o=g(s,["access-key","accessKey"]),x=g(s,["select"]),f=await K(),a;o?a=o:f.accessKeyId?a=f.accessKeyId:(u()!=="oauth"&&n("Presigning requires an access key. Pass --access-key or configure credentials."),x?a=await E(c,i):a=await q(c,i)),a||n("Presigning requires an access key. Pass --access-key or configure credentials.");let{data:d,error:m}=await P(e,{method:i,expiresIn:t,accessKeyId:a,config:{...f,bucket:c}});m&&n(m),console.log(l==="json"?A({url:d.url,expiresIn:d.expiresIn,method:i,bucket:c,key:e}):d.url),process.exit(0)}async function v(){let r=await p().getAccessToken(),c=y(),e=k(),{data:i,error:t}=await C({config:{sessionToken:r,organizationId:c??void 0,iamEndpoint:e.iamEndpoint}});return t&&n(t),(!i.accessKeys||i.accessKeys.length===0)&&n('No access keys found. Create one with "tigris access-keys create <name>"'),i.accessKeys}function I(s,r,c){return s.roles?s.roles.some(e=>e.role==="NamespaceAdmin"?!0:e.bucket!==r&&e.bucket!=="*"?!1:c==="put"?e.role==="Editor":e.role==="Editor"||e.role==="ReadOnly"):!1}async function q(s,r){let e=(await v()).filter(t=>t.status==="active");e.length===0&&n('No active access keys found. Create one with "tigris access-keys create <name>"');let i=e.find(t=>I(t,s,r));return i||n(`No access key with ${r==="put"?"Editor":"Editor or ReadOnly"} access to bucket "${s}" found.
1
+ import{b as A}from"../chunk-IRDNZN7R.js";import{e as v}from"../chunk-RXNG56FL.js";import{a as K,d as w}from"../chunk-YN2TKPPT.js";import{a,b as k}from"../chunk-S6KFKBMY.js";import{a as n}from"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import{c as h}from"../chunk-3EAZ2L6H.js";import{i as m,p}from"../chunk-OHGCOC5Q.js";import{listAccessKeys as P}from"@tigrisdata/iam";import{getPresignedUrl as T}from"@tigrisdata/storage";import $ from"enquirer";var{prompt:b}=$;async function q(s){let r=a(s,["path"]);r||n("path argument is required");let{bucket:o,path:e}=v(r);o||n("Invalid path"),e||n("Object key is required");let t=a(s,["method","m"])??"get",i=parseInt(a(s,["expires-in","expiresIn","e"])??"3600",10),l=k(s,"url"),c=a(s,["access-key","accessKey"]),C=a(s,["select"]),f=a(s,["snapshot-version","snapshotVersion","snapshot"]);f&&t!=="get"&&n("Snapshot version is only supported for GET requests");let d=await w(),g;c?g=c:d.accessKeyId?g=d.accessKeyId:(p()!=="oauth"&&n("Presigning requires an access key. Pass --access-key or configure credentials."),C?g=await O(o,t):g=await E(o,t)),g||n("Presigning requires an access key. Pass --access-key or configure credentials.");let{data:u,error:y}=await T(e,{method:t,expiresIn:i,accessKeyId:g,...f?{snapshotVersion:f}:{},config:{...d,bucket:o}});y&&n(y),console.log(l==="json"?A({url:u.url,expiresIn:u.expiresIn,method:t,bucket:o,key:e}):u.url),process.exit(0)}async function I(){let r=await h().getAccessToken(),o=m(),e=K(),{data:t,error:i}=await P({config:{sessionToken:r,organizationId:o??void 0,iamEndpoint:e.iamEndpoint}});return i&&n(i),(!t.accessKeys||t.accessKeys.length===0)&&n('No access keys found. Create one with "tigris access-keys create <name>"'),t.accessKeys}function x(s,r,o){return s.roles?s.roles.some(e=>e.role==="NamespaceAdmin"?!0:e.bucket!==r&&e.bucket!=="*"?!1:o==="put"?e.role==="Editor":e.role==="Editor"||e.role==="ReadOnly"):!1}async function E(s,r){let e=(await I()).filter(i=>i.status==="active");e.length===0&&n('No active access keys found. Create one with "tigris access-keys create <name>"');let t=e.find(i=>x(i,s,r));return t||n(`No access key with ${r==="put"?"Editor":"Editor or ReadOnly"} access to bucket "${s}" found.
2
2
  Create one: tigris access-keys create <name>
3
- Then assign: tigris access-keys assign <id> --bucket ${s} --role Editor`),console.error(`Using access key: ${i.name} (${i.id})`),i.id}async function E(s,r){process.stdin.isTTY||n("Interactive selection requires a TTY. Omit --select to auto-resolve, or pass --access-key tid_...");let e=(await v()).filter(o=>o.status==="active");e.length===0&&n('No active access keys found. Create one with "tigris access-keys create <name>"');let i=e.filter(o=>I(o,s,r)),t;if(i.length>0?t=i:(console.error(`No access keys with explicit access to bucket "${s}" found. Showing all active keys.`),t=e),t.length===1)return console.error(`Using access key: ${t[0].name} (${t[0].id})`),t[0].id;let{selectedKey:l}=await b({type:"select",name:"selectedKey",message:"Select an access key for presigning:",choices:t.map(o=>({name:o.id,message:`${o.name} (${o.id})`}))});return l}export{T as default,I as keyMatchesOperation};
3
+ Then assign: tigris access-keys assign <id> --bucket ${s} --role Editor`),console.error(`Using access key: ${t.name} (${t.id})`),t.id}async function O(s,r){process.stdin.isTTY||n("Interactive selection requires a TTY. Omit --select to auto-resolve, or pass --access-key tid_...");let e=(await I()).filter(c=>c.status==="active");e.length===0&&n('No active access keys found. Create one with "tigris access-keys create <name>"');let t=e.filter(c=>x(c,s,r)),i;if(t.length>0?i=t:(console.error(`No access keys with explicit access to bucket "${s}" found. Showing all active keys.`),i=e),i.length===1)return console.error(`Using access key: ${i[0].name} (${i[0].id})`),i[0].id;let{selectedKey:l}=await b({type:"select",name:"selectedKey",message:"Select an access key for presigning:",choices:i.map(c=>({name:c.id,message:`${c.name} (${c.id})`}))});return l}export{q as default,x as keyMatchesOperation};
package/dist/lib/stat.js CHANGED
@@ -1 +1 @@
1
- import{c as w}from"../chunk-HWX63Y3P.js";import{a as d,f as m}from"../chunk-IRDNZN7R.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};
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};
@@ -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-GNWZ7PX2.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};
1
+ import{b as d}from"../chunk-S6KFKBMY.js";import{a as t,c as l,d as p,e as f}from"../chunk-YWSU7MW7.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
@@ -437,6 +437,9 @@ commands:
437
437
  description: Output format
438
438
  options: [url, json]
439
439
  default: url
440
+ - name: snapshot-version
441
+ description: Read from a specific bucket snapshot. Accepts a snapshot version string or any UNIX nanosecond-precision timestamp (e.g. 1765889000501544464). Only supported for GET requests.
442
+ alias: snapshot
440
443
 
441
444
  # cp
442
445
  - name: cp
@@ -667,6 +670,7 @@ commands:
667
670
  - "tigris buckets list"
668
671
  - "tigris buckets list --format json"
669
672
  - "tigris buckets list --forks-of my-bucket"
673
+ - "tigris buckets list --deleted"
670
674
  messages:
671
675
  onStart: 'Listing buckets...'
672
676
  onSuccess: 'Found {{count}} bucket(s)'
@@ -679,6 +683,9 @@ commands:
679
683
  default: table
680
684
  - name: forks-of
681
685
  description: Only list buckets that are forks of the named source bucket
686
+ - name: deleted
687
+ description: Only list soft-deleted buckets
688
+ type: flag
682
689
  - name: limit
683
690
  description: Maximum number of items to return per page
684
691
  - name: page-token
@@ -793,6 +800,25 @@ commands:
793
800
  - name: force
794
801
  type: flag
795
802
  description: Skip confirmation prompts (alias for --yes)
803
+ # restore
804
+ - name: restore
805
+ description: Restore a soft-deleted bucket within its retention window. List recoverable buckets with "tigris buckets list --deleted"
806
+ examples:
807
+ - "tigris buckets restore my-bucket"
808
+ messages:
809
+ onStart: 'Restoring bucket...'
810
+ onSuccess: "Bucket '{{name}}' restored successfully"
811
+ onFailure: "Failed to restore bucket '{{name}}'"
812
+ nextActions:
813
+ - command: 'tigris buckets get {{name}}'
814
+ description: 'Inspect the restored bucket'
815
+ arguments:
816
+ - name: name
817
+ description: Name of the soft-deleted bucket to restore
818
+ type: positional
819
+ required: true
820
+ examples:
821
+ - my-bucket
796
822
  # set
797
823
  - name: set
798
824
  description: Update settings on an existing bucket such as access level, location, caching, or custom domain
@@ -801,6 +827,8 @@ commands:
801
827
  - "tigris buckets set my-bucket --access public"
802
828
  - "tigris buckets set my-bucket --locations iad,fra --cache-control 'max-age=3600'"
803
829
  - "tigris buckets set my-bucket --custom-domain assets.example.com"
830
+ - "tigris buckets set my-bucket --soft-delete enable --retention-days 30"
831
+ - "tigris buckets set my-bucket --soft-delete disable"
804
832
  messages:
805
833
  onStart: 'Updating bucket...'
806
834
  onSuccess: 'Bucket {{name}} updated successfully'
@@ -835,9 +863,48 @@ commands:
835
863
  - name: enable-delete-protection
836
864
  description: Enable delete protection
837
865
  type: boolean
866
+ deprecated: true
867
+ replaced_by: --soft-delete
868
+ - name: soft-delete
869
+ description: Enable or disable soft delete (recoverable deletes). Requires --retention-days when enabling
870
+ options: [enable, disable]
871
+ - name: retention-days
872
+ description: Number of days to retain soft-deleted objects (required when enabling --soft-delete)
838
873
  - name: enable-additional-headers
839
874
  description: Enable additional HTTP headers (X-Content-Type-Options nosniff)
840
875
  type: boolean
876
+ # enable-snapshots
877
+ - name: enable-snapshots
878
+ description: Enable snapshots on an existing bucket, converting it to a snapshot bucket
879
+ examples:
880
+ - "tigris buckets enable-snapshots my-bucket"
881
+ messages:
882
+ onStart: 'Enabling snapshots...'
883
+ onSuccess: 'Snapshots enabled for bucket {{name}}'
884
+ onFailure: 'Failed to enable snapshots'
885
+ arguments:
886
+ - name: name
887
+ description: Name of the bucket
888
+ type: positional
889
+ required: true
890
+ examples:
891
+ - my-bucket
892
+ # disable-snapshots
893
+ - name: disable-snapshots
894
+ description: Disable snapshots on an existing bucket, converting it back to a regular bucket. Rejected while the bucket has dependent forks
895
+ examples:
896
+ - "tigris buckets disable-snapshots my-bucket"
897
+ messages:
898
+ onStart: 'Disabling snapshots...'
899
+ onSuccess: 'Snapshots disabled for bucket {{name}}'
900
+ onFailure: 'Failed to disable snapshots'
901
+ arguments:
902
+ - name: name
903
+ description: Name of the bucket
904
+ type: positional
905
+ required: true
906
+ examples:
907
+ - my-bucket
841
908
  # set-ttl
842
909
  - name: set-ttl
843
910
  removed: true
@@ -1 +1 @@
1
- import{a,b,c}from"../chunk-HWX63Y3P.js";import"../chunk-IRDNZN7R.js";export{c as buildBucketInfo,b as describeExpiration,a as describeTransition};
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};
@@ -1 +1 @@
1
- import{a,b}from"../chunk-TD2HGNDY.js";import"../chunk-S77OAN6Y.js";export{b as parseLocations,a as promptLocations};
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-GNWZ7PX2.js";import"../chunk-ATBINUDP.js";export{e as checkForUpdates,d as fetchLatestVersion,c as getUpdateCommand,b as isNewerVersion,a as readUpdateCache};
1
+ import{b as a,c as b,d as c,e as d,f as e}from"../chunk-YWSU7MW7.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.0.0",
3
+ "version": "3.2.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.6.0",
106
+ "@tigrisdata/storage": "^3.15.0",
107
107
  "commander": "^14.0.3",
108
108
  "enquirer": "^2.4.1",
109
109
  "jose": "^6.2.3",
@@ -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};
@@ -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};
@@ -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};