@tigrisdata/cli 3.1.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-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();
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();
@@ -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.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.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
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";
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-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
+ 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";
@@ -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{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};
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};
@@ -1 +1 @@
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};
1
+ import{a}from"../../../chunk-TUDALPGD.js";import{a as J}from"../../../chunk-S7EO4QWK.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};
@@ -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};
@@ -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-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};
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
@@ -870,6 +873,38 @@ commands:
870
873
  - name: enable-additional-headers
871
874
  description: Enable additional HTTP headers (X-Content-Type-Options nosniff)
872
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
873
908
  # set-ttl
874
909
  - name: set-ttl
875
910
  removed: true
@@ -1 +1 @@
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};
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.1.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.12.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",