@tigrisdata/cli 3.2.0 → 3.3.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
@@ -222,6 +222,8 @@ tigris mk <path> [flags]
222
222
  | `-a, --access` | Access level (only applies when creating a bucket) (default: private) |
223
223
  | `--public` | Shorthand for --access public (only applies when creating a bucket) |
224
224
  | `-s, --enable-snapshots` | Enable snapshots for the bucket (only applies when creating a bucket) (default: false) |
225
+ | `--allow-object-acl` | Allow per-object ACLs on the bucket (only applies when creating a bucket) (default: false) |
226
+ | `--enable-directory-listing` | Enable directory listing, relevant for public buckets (only applies when creating a bucket) (default: false) |
225
227
  | `-t, --default-tier` | Default storage tier (only applies when creating a bucket) (default: STANDARD) |
226
228
  | `-l, --locations` | Location for the bucket (only applies when creating a bucket) (default: global) |
227
229
  | `-fork, --fork-of` | Create this bucket as a fork (copy-on-write clone) of the named source bucket |
@@ -231,6 +233,8 @@ tigris mk <path> [flags]
231
233
  ```bash
232
234
  tigris mk my-bucket
233
235
  tigris mk my-bucket --access public --region iad
236
+ tigris mk my-bucket --allow-object-acl
237
+ tigris mk my-bucket --public --enable-directory-listing
234
238
  tigris mk my-bucket/images/
235
239
  tigris mk t3://my-bucket
236
240
  tigris mk my-fork --fork-of my-bucket
@@ -308,10 +312,12 @@ tigris cp <src> <dest> [flags]
308
312
  | Flag | Description |
309
313
  |------|-------------|
310
314
  | `-r, --recursive` | Copy directories recursively |
315
+ | `-a, --access` | Access level for uploaded objects (only applies to local-to-remote uploads) |
311
316
 
312
317
  **Examples:**
313
318
  ```bash
314
319
  tigris cp ./file.txt t3://my-bucket/file.txt
320
+ tigris cp ./logo.png t3://my-bucket/logo.png --access public
315
321
  tigris cp t3://my-bucket/file.txt ./local-copy.txt
316
322
  tigris cp t3://my-bucket/src/ t3://my-bucket/dest/ -r
317
323
  tigris cp ./images/ t3://my-bucket/images/ -r
@@ -494,6 +500,8 @@ tigris buckets create [name] [flags]
494
500
  | `-a, --access` | Access level (default: private) |
495
501
  | `--public` | Shorthand for --access public |
496
502
  | `-s, --enable-snapshots` | Enable snapshots for the bucket (default: false) |
503
+ | `--allow-object-acl` | Allow per-object ACLs on the bucket (default: false) |
504
+ | `--enable-directory-listing` | Enable directory listing, relevant for public buckets (default: false) |
497
505
  | `-t, --default-tier` | Choose the default tier for the bucket (default: STANDARD) |
498
506
  | `-l, --locations` | Location for the bucket (default: global) |
499
507
  | `-fork, --fork-of` | Create this bucket as a fork (copy-on-write clone) of the named source bucket |
@@ -504,6 +512,8 @@ tigris buckets create [name] [flags]
504
512
  tigris buckets create my-bucket
505
513
  tigris buckets create my-bucket --access public --locations iad
506
514
  tigris buckets create my-bucket --enable-snapshots --default-tier STANDARD_IA
515
+ tigris buckets create my-bucket --allow-object-acl
516
+ tigris buckets create my-bucket --public --enable-directory-listing
507
517
  tigris buckets create my-fork --fork-of my-bucket
508
518
  tigris buckets create my-fork --fork-of my-bucket --source-snapshot 1765889000501544464
509
519
  ```
@@ -864,6 +874,8 @@ Low-level object operations for listing, downloading, uploading, and deleting in
864
874
  | `tigris objects set` (s) | (Deprecated) Update settings on an existing object such as access level. Use `tigris objects set-access` for ACL changes and `tigris mv` to rename |
865
875
  | `tigris objects set-access` (sa) | Set the access level (public or private) on an existing object |
866
876
  | `tigris objects info` (i) | Show metadata for an object (content type, size, modified date) |
877
+ | `tigris objects restore` (rs) | Restore an archived object (e.g. one in the GLACIER tier) into an actively-readable copy for a number of days |
878
+ | `tigris objects restore-info` (ri) | Show the restore state of an archived object (archived, in-progress, or restored) |
867
879
 
868
880
  #### `tigris objects list` (l)
869
881
 
@@ -1042,6 +1054,46 @@ tigris objects info my-bucket report.pdf --format json
1042
1054
  tigris objects info my-bucket report.pdf --version-id abc123
1043
1055
  ```
1044
1056
 
1057
+ #### `tigris objects restore` (rs)
1058
+
1059
+ Restore an archived object (e.g. one in the GLACIER tier) into an actively-readable copy for a number of days
1060
+
1061
+ ```
1062
+ tigris objects restore <bucket> [key] [flags]
1063
+ ```
1064
+
1065
+ | Flag | Description |
1066
+ |------|-------------|
1067
+ | `-d, --days` | How many days the restored copy stays available before reverting to its archived tier (default: 1) |
1068
+ | `--version-id` | Restore a specific object version (requires bucket versioning). Omit to restore the current version |
1069
+ | `--format` | Output format (default: table) |
1070
+
1071
+ **Examples:**
1072
+ ```bash
1073
+ tigris objects restore my-bucket archived.bin
1074
+ tigris objects restore my-bucket archived.bin --days 3
1075
+ tigris objects restore t3://my-bucket/archived.bin --days 7
1076
+ ```
1077
+
1078
+ #### `tigris objects restore-info` (ri)
1079
+
1080
+ Show the restore state of an archived object (archived, in-progress, or restored)
1081
+
1082
+ ```
1083
+ tigris objects restore-info <bucket> [key] [flags]
1084
+ ```
1085
+
1086
+ | Flag | Description |
1087
+ |------|-------------|
1088
+ | `--version-id` | Inspect a specific object version (requires bucket versioning). Omit to read the current version |
1089
+ | `--format` | Output format (default: table) |
1090
+
1091
+ **Examples:**
1092
+ ```bash
1093
+ tigris objects restore-info my-bucket archived.bin
1094
+ tigris objects restore-info t3://my-bucket/archived.bin --format json
1095
+ ```
1096
+
1045
1097
  ### `tigris access-keys` (keys)
1046
1098
 
1047
1099
  Create, list, inspect, delete, and assign roles to access keys. Access keys are credentials used for programmatic API access
@@ -1224,6 +1276,7 @@ Identity and Access Management - manage policies, users, and permissions
1224
1276
  |---------|-------------|
1225
1277
  | `tigris iam policies` (p) | Manage IAM policies. Policies define permissions for access keys |
1226
1278
  | `tigris iam users` (u) | Manage organization users and invitations |
1279
+ | `tigris iam teams` (t) | Manage organization teams |
1227
1280
 
1228
1281
  #### `tigris iam policies` (p)
1229
1282
 
@@ -1497,6 +1550,75 @@ tigris iam users remove user@example.com --yes
1497
1550
  tigris iam users remove user@example.com,user@example.net --yes
1498
1551
  ```
1499
1552
 
1553
+ #### `tigris iam teams` (t)
1554
+
1555
+ Manage organization teams
1556
+
1557
+ | Command | Description |
1558
+ |---------|-------------|
1559
+ | `tigris iam teams list` (l) | List all teams in the organization |
1560
+ | `tigris iam teams create` (c) | Create a new team in the organization |
1561
+ | `tigris iam teams edit` (e) | Update a team's name, description, or members. Members are replaced with the provided list |
1562
+
1563
+ ##### `tigris iam teams list` (l)
1564
+
1565
+ List all teams in the organization
1566
+
1567
+ ```
1568
+ tigris iam teams list [flags]
1569
+ ```
1570
+
1571
+ | Flag | Description |
1572
+ |------|-------------|
1573
+ | `--format` | Output format (default: table) |
1574
+
1575
+ **Examples:**
1576
+ ```bash
1577
+ tigris iam teams list
1578
+ tigris iam teams list --format json
1579
+ ```
1580
+
1581
+ ##### `tigris iam teams create` (c)
1582
+
1583
+ Create a new team in the organization
1584
+
1585
+ ```
1586
+ tigris iam teams create <name> [flags]
1587
+ ```
1588
+
1589
+ | Flag | Description |
1590
+ |------|-------------|
1591
+ | `-d, --description` | Description for the team |
1592
+ | `-m, --members` | Member email address(es) to add (comma-separated for multiple) |
1593
+
1594
+ **Examples:**
1595
+ ```bash
1596
+ tigris iam teams create engineering
1597
+ tigris iam teams create engineering --description 'Engineering team'
1598
+ tigris iam teams create engineering --members a@example.com,b@example.com
1599
+ ```
1600
+
1601
+ ##### `tigris iam teams edit` (e)
1602
+
1603
+ Update a team's name, description, or members. Members are replaced with the provided list
1604
+
1605
+ ```
1606
+ tigris iam teams edit <id> [flags]
1607
+ ```
1608
+
1609
+ | Flag | Description |
1610
+ |------|-------------|
1611
+ | `-n, --name` | New name for the team |
1612
+ | `-d, --description` | New description for the team |
1613
+ | `-m, --members` | Replace the team's members with these email address(es) (comma-separated for multiple) |
1614
+
1615
+ **Examples:**
1616
+ ```bash
1617
+ tigris iam teams edit team_id --name platform
1618
+ tigris iam teams edit team_id --description 'Platform team'
1619
+ tigris iam teams edit team_id --members a@example.com,b@example.com
1620
+ ```
1621
+
1500
1622
  ## License
1501
1623
 
1502
1624
  MIT
@@ -0,0 +1 @@
1
+ import{b as n}from"./chunk-UBANDLB4.js";function o(s,e){if(e===void 0)return;let t=(Array.isArray(e)?e:[e]).map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0);return t.length===0&&n(s,"--members requires at least one email address"),t}export{o as a};
@@ -1,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.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(`
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.3.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)}
@@ -1 +1 @@
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
+ import{a as s,f as l}from"./chunk-BVSVEXGE.js";import{a as i,k as m}from"./chunk-G4DHMSCQ.js";import{b as t}from"./chunk-PPNBQWSR.js";import{existsSync as c}from"fs";import{dirname as u,join as a}from"path";import{fileURLToPath as f}from"url";i();var j=f(import.meta.url),d=u(j),h=t(),y=o=>{if(o.length===0)return!1;let e=a(d,"lib",...o)+".js";if(c(e))return!0;let r=a(d,"lib",...o,"index.js");return!!c(r)},b=async o=>{let e=[`./lib/${o.join("/")}.js`,`./lib/${o.join("/")}/index.js`];for(let p of e){let n=await import(p).catch(()=>null);if(n)return{module:n,error:null}}return{module:null,error:`Command not found: ${o.join(" ")}`}},x=m({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
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";
2
+ import"./chunk-JW6HI5E4.js";import"./chunk-BVSVEXGE.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-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
+ import"./chunk-JW6HI5E4.js";import"./chunk-BVSVEXGE.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,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};
1
+ import{a as C,c as j}from"../../chunk-N3Y6RFSK.js";import{a as B}from"../../chunk-S77OAN6Y.js";import{d as T}from"../../chunk-YN2TKPPT.js";import{a as t,b as O}from"../../chunk-S6KFKBMY.js";import{b as i,c as x,d as D}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as w,c as v,j as L}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 E}from"@tigrisdata/storage";import F from"enquirer";var{prompt:J}=F,a=L("buckets","create");async function W(e){w(a);let q=O(e),s=t(e,["name"]),d=t(e,["public"])?"public":t(e,["access","a","A"]),b=t(e,["enable-snapshots","s","S"]),N=t(e,["allow-object-acl","allowObjectAcl"]),P=t(e,["enable-directory-listing","enableDirectoryListing"]),h=t(e,["default-tier","t","T"]),I=t(e,["locations","l","L"]),c=t(e,["fork-of","forkOf","fork"]),u=t(e,["source-snapshot","sourceSnapshot","source-snap"]),R=!s,S;if(R){B("Provide --name to skip interactive mode");let o=p("buckets","access","create"),n=g(o),f=n?.findIndex(r=>r.value===o?.default),y=p("buckets","default-tier","create"),A=g(y),m=A?.findIndex(r=>r.value===y?.default),l=await J([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:n||[],initial:f!==void 0&&f>=0?f:0},{type:"select",name:"defaultTier",message:"Default storage tier:",choices:A||[],initial:m!==void 0&&m>=0?m:0},{type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}]);s=l.name,d=l.access,h=l.defaultTier,b=l.enableSnapshots;try{S=await C()}catch(r){i(a,r)}}s||i(a,"Bucket name is required"),u&&!c&&i(a,"--source-snapshot requires --fork-of");let{error:k}=await E(s,{defaultTier:h??"STANDARD",enableSnapshot:b===!0,allowObjectAcl:N===!0,enableDirectoryListing:P===!0,access:d??"private",locations:S??j(I??"global"),...c?{sourceBucketName:c}:{},...u?{sourceBucketSnapshot:u}:{},config:await T()});if(k&&i(a,k),q==="json"){let o=x(a,{name:s}),n={action:"created",name:s,...c?{forkOf:c}:{}};o.length>0&&(n.nextActions=o),console.log(JSON.stringify(n))}v(a,{name:s}),D(a,{name:s})}export{W as default};
package/dist/lib/cp.js CHANGED
@@ -1 +1 @@
1
- import{a as G}from"../chunk-EKW6XTGL.js";import{a as D}from"../chunk-SAAGVLRE.js";import{a as q}from"../chunk-HPICBIXL.js";import{a as R}from"../chunk-IRDNZN7R.js";import{a as U,b as v,d as C,f as O,g as J,i as j}from"../chunk-RXNG56FL.js";import{d as K}from"../chunk-YN2TKPPT.js";import{a as x,b as M}from"../chunk-S6KFKBMY.js";import{a as f}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{copy as P,get as tt,head as et,list as ot,put as V}from"@tigrisdata/storage";import{createReadStream as it,createWriteStream as nt,existsSync as X,mkdirSync as rt,readdirSync as A,statSync as z}from"fs";import{homedir as at}from"os";import{basename as E,dirname as L,join as N,relative as _,resolve as H}from"path";import{Readable as Y}from"stream";import{pipeline as lt}from"stream/promises";var h=!1;function ct(i,t){let e=U(i),r=U(t);return!e&&!r&&f("At least one path must be a remote Tigris path (t3:// or tigris://)"),e&&r?"remote-to-remote":e?"remote-to-local":"local-to-remote"}function Z(i){return i==="~"||i.startsWith("~/")?H(at(),i.slice(2)):H(i)}function st(i){return A(i,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>{let r=e.parentPath??e.path;return N(r,e.name)})}function pt(i,t){let e=L(i),r=E(i),c=O(r);return X(e)?t?A(e,{recursive:!0,withFileTypes:!0}).filter(a=>a.isFile()&&c.test(a.name)).map(a=>{let o=a.parentPath??a.path;return N(o,a.name)}):A(e,{withFileTypes:!0}).filter(o=>o.isFile()&&c.test(o.name)).map(o=>N(e,o.name)):[]}async function B(i,t,e,r,c=!1){let p;try{p=z(i).size}catch{return{error:`File not found: ${i}`}}let a=it(i),o=Y.toWeb(a),n=q(i),{error:l}=await V(e,o,{...G(p),...n?{contentType:n}:{},onUploadProgress:c?({loaded:u})=>{if(p!==void 0&&p>0){let s=Math.round(u/p*100);process.stdout.write(`\rUploading: ${R(u)} / ${R(p)} (${s}%)`)}else process.stdout.write(`\rUploading: ${R(u)}`)}:void 0,config:{...r,bucket:t}});return c&&process.stdout.write("\r"+" ".repeat(60)+"\r"),l?{error:l.message}:{}}async function Q(i,t,e,r,c=!1){let p;if(c){let{data:s}=await et(t,{config:{...r,bucket:i}});p=s?.size}let{data:a,error:o}=await tt(t,"stream",{config:{...r,bucket:i}});if(o)return{error:o.message};let n=L(e);X(n)||rt(n,{recursive:!0});let l=nt(e),u=Y.fromWeb(a);if(c&&p!==void 0&&p>0){let s=0;u.on("data",m=>{s+=m.length;let d=Math.round(s/p*100);process.stdout.write(`\rDownloading: ${R(s)} / ${R(p)} (${d}%)`)})}return await lt(u,l),c&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function I(i,t,e,r,c){if(e.endsWith("/")){let{error:a}=await V(c,"",{config:{...i,bucket:r}});return a?{error:a.message}:{}}let{error:p}=await P(e,c,{srcBucket:t,destBucket:r,config:{...i,bucket:r}});return p?{error:p.message}:{}}async function ut(i,t,e,r){let c=Z(i);if(i.includes("*")){let o=pt(c,r);if(o.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files matching pattern");return}let n=L(c),l=o.map(m=>async()=>{let d=_(n,m),w=t.path?`${t.path.replace(/\/$/,"")}/${d}`:d,y=await B(m,t.bucket,w,e);return y.error?(console.error(`Failed to upload ${m}: ${y.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${w}`),!0)}),s=(await D(l,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:s}):`Uploaded ${s} file(s)`);return}let a;try{a=z(c)}catch{f(`Source not found: ${i}`)}if(a.isDirectory()){r||f(`${i} is a directory (not copied). Use -r to copy recursively.`);let o=st(c);if(o.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files to upload");return}let n=i.endsWith("/")?"":E(c),l=o.map(m=>async()=>{let d=_(c,m),y=[t.path?.replace(/\/$/,""),n,d].filter(Boolean).join("/"),F=await B(m,t.bucket,y,e);return F.error?(console.error(`Failed to upload ${m}: ${F.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${y}`),!0)}),s=(await D(l,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:s}):`Uploaded ${s} file(s)`)}else{let o=E(c),n;t.path?i.endsWith("/")||t.path.endsWith("/")?n=`${t.path.replace(/\/$/,"")}/${o}`:await C(t.bucket,t.path,e)?n=`${t.path}/${o}`:n=t.path:n=o;let l=await B(c,t.bucket,n,e,!h);l.error&&f(l.error),console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:1,src:i,dest:`t3://${t.bucket}/${n}`}):`Uploaded ${i} -> t3://${t.bucket}/${n}`)}}async function ft(i,t,e,r,c){let p=i.endsWith("/");!t.path&&!p&&f("Cannot copy a bucket. Provide a path within the bucket.");let a=Z(e),o=t.path.includes("*"),n=t.path.endsWith("/")||!t.path&&p;if(!o&&!n&&(n=await C(t.bucket,t.path,r)),n&&!o&&!c&&f("Source is a remote folder (not copied). Use -r to copy recursively."),o||n){let l=o?J(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",u=!o&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",{items:s,error:m}=await j(t.bucket,l||void 0,r);m&&f(m);let d=s.filter($=>!$.name.endsWith("/"));if(o){let $=t.path.split("/").pop(),b=O($);d=d.filter(k=>{let g=l?k.name.slice(l.length):k.name;return!c&&g.includes("/")?!1:b.test(g.split("/").pop())})}if(d.length===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:0}):"No objects to download");return}let w=d.map($=>async()=>{let b=l?$.name.slice(l.length):$.name,k=u?N(a,u,b):N(a,b),g=await Q(t.bucket,$.name,k,r);return g.error?(console.error(`Failed to download ${$.name}: ${g.error}`),!1):(h||console.log(`Downloaded t3://${t.bucket}/${$.name} -> ${k}`),!0)}),F=(await D(w,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:F}):`Downloaded ${F} file(s)`)}else{let l=t.path.split("/").pop(),u,s=!1;try{s=z(a).isDirectory()}catch{}s||e.endsWith("/")?u=N(a,l):u=a;let m=await Q(t.bucket,t.path,u,r,!h);m.error&&f(m.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:1,src:`t3://${t.bucket}/${t.path}`,dest:u}):`Downloaded t3://${t.bucket}/${t.path} -> ${u}`)}}async function mt(i,t,e,r,c){let p=i.endsWith("/");!t.path&&!p&&f("Cannot copy a bucket. Provide a path within the bucket.");let a=i.includes("*"),o=t.path.endsWith("/")||!t.path&&p;if(!a&&!o&&t.path&&(o=await C(t.bucket,t.path,r)),o&&!a&&!c&&f("Source is a remote folder (not copied). Use -r to copy recursively."),a||o){let n=a?J(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",l=!a&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",s=[e.path?.replace(/\/$/,"")||"",l].filter(Boolean).join("/"),m=s?`${s}/`:"";t.bucket===e.bucket&&n===m&&f("Source and destination are the same");let{items:d,error:w}=await j(t.bucket,n||void 0,r);w&&f(w);let y=d.filter(g=>g.name!==n);if(a){let g=t.path.split("/").pop(),S=O(g);y=y.filter(W=>{let T=n?W.name.slice(n.length):W.name;return!c&&T.includes("/")?!1:S.test(T.split("/").pop())})}let F=y.map(g=>async()=>{let S=n?g.name.slice(n.length):g.name,W=s?`${s}/${S}`:S,T=await I(r,t.bucket,g.name,e.bucket,W);return T.error?(console.error(`Failed to copy ${g.name}: ${T.error}`),!1):(h||console.log(`Copied t3://${t.bucket}/${g.name} -> t3://${e.bucket}/${W}`),!0)}),b=(await D(F,8)).filter(Boolean).length,k=!1;if(s&&n){let{data:g}=await ot({prefix:n,limit:1,config:{...r,bucket:t.bucket}});if(g?.items?.some(S=>S.name===n)){let S=`${s}/`,W=await I(r,t.bucket,n,e.bucket,S);W.error?console.error(`Failed to copy folder marker: ${W.error}`):k=!0}}if(b===0&&k&&(b=1),b===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:0}):"No objects to copy");return}console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:b}):`Copied ${b} object(s)`)}else{let n=t.path.split("/").pop(),l;e.path?e.path.endsWith("/")?l=`${e.path}${n}`:await C(e.bucket,e.path,r)?l=`${e.path}/${n}`:l=e.path:l=n,t.bucket===e.bucket&&t.path===l&&f("Source and destination are the same");let u=await I(r,t.bucket,t.path,e.bucket,l);u.error&&f(u.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:1,src:`t3://${t.bucket}/${t.path}`,dest:`t3://${e.bucket}/${l}`}):`Copied t3://${t.bucket}/${t.path} -> t3://${e.bucket}/${l}`)}}async function ht(i){let t=x(i,["src"]),e=x(i,["dest"]);(!t||!e)&&f("Both src and dest arguments are required");let r=!!x(i,["recursive","r"]);h=M(i)==="json";let p=ct(t,e),a=await K({withCredentialProvider:!0});switch(p){case"local-to-remote":{let o=v(e);o.bucket||f("Invalid destination path"),await ut(t,o,a,r);break}case"remote-to-local":{let o=v(t);o.bucket||f("Invalid source path"),await ft(t,o,e,a,r);break}case"remote-to-remote":{let o=v(t),n=v(e);o.bucket||f("Invalid source path"),n.bucket||f("Invalid destination path"),await mt(t,o,n,a,r);break}}process.exit(0)}export{ht as default};
1
+ import{a as G}from"../chunk-EKW6XTGL.js";import{a as x}from"../chunk-SAAGVLRE.js";import{a as q}from"../chunk-HPICBIXL.js";import{a as R}from"../chunk-IRDNZN7R.js";import{a as U,b as C,d as D,f as O,g as j,i as A}from"../chunk-RXNG56FL.js";import{d as K}from"../chunk-YN2TKPPT.js";import{a as T,b as M}from"../chunk-S6KFKBMY.js";import{a as f}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{copy as P,get as tt,head as et,list as ot,put as V}from"@tigrisdata/storage";import{createReadStream as it,createWriteStream as nt,existsSync as X,mkdirSync as rt,readdirSync as I,statSync as z}from"fs";import{homedir as at}from"os";import{basename as E,dirname as L,join as v,relative as _,resolve as H}from"path";import{Readable as Y}from"stream";import{pipeline as lt}from"stream/promises";var h=!1;function ct(i,t){let e=U(i),a=U(t);return!e&&!a&&f("At least one path must be a remote Tigris path (t3:// or tigris://)"),e&&a?"remote-to-remote":e?"remote-to-local":"local-to-remote"}function Z(i){return i==="~"||i.startsWith("~/")?H(at(),i.slice(2)):H(i)}function st(i){return I(i,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>{let a=e.parentPath??e.path;return v(a,e.name)})}function pt(i,t){let e=L(i),a=E(i),p=O(a);return X(e)?t?I(e,{recursive:!0,withFileTypes:!0}).filter(r=>r.isFile()&&p.test(r.name)).map(r=>{let l=r.parentPath??r.path;return v(l,r.name)}):I(e,{withFileTypes:!0}).filter(l=>l.isFile()&&p.test(l.name)).map(l=>v(e,l.name)):[]}async function J(i,t,e,a,p=!1,c){let r;try{r=z(i).size}catch{return{error:`File not found: ${i}`}}let l=it(i),n=Y.toWeb(l),o=q(i),{error:s}=await V(e,n,{...G(r),...o?{contentType:o}:{},...c?{access:c}:{},onUploadProgress:p?({loaded:u})=>{if(r!==void 0&&r>0){let d=Math.round(u/r*100);process.stdout.write(`\rUploading: ${R(u)} / ${R(r)} (${d}%)`)}else process.stdout.write(`\rUploading: ${R(u)}`)}:void 0,config:{...a,bucket:t}});return p&&process.stdout.write("\r"+" ".repeat(60)+"\r"),s?{error:s.message}:{}}async function Q(i,t,e,a,p=!1){let c;if(p){let{data:u}=await et(t,{config:{...a,bucket:i}});c=u?.size}let{data:r,error:l}=await tt(t,"stream",{config:{...a,bucket:i}});if(l)return{error:l.message};let n=L(e);X(n)||rt(n,{recursive:!0});let o=nt(e),s=Y.fromWeb(r);if(p&&c!==void 0&&c>0){let u=0;s.on("data",d=>{u+=d.length;let m=Math.round(u/c*100);process.stdout.write(`\rDownloading: ${R(u)} / ${R(c)} (${m}%)`)})}return await lt(s,o),p&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function B(i,t,e,a,p){if(e.endsWith("/")){let{error:r}=await V(p,"",{config:{...i,bucket:a}});return r?{error:r.message}:{}}let{error:c}=await P(e,p,{srcBucket:t,destBucket:a,config:{...i,bucket:a}});return c?{error:c.message}:{}}async function ut(i,t,e,a,p){let c=Z(i);if(i.includes("*")){let n=pt(c,a);if(n.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files matching pattern");return}let o=L(c),s=n.map(m=>async()=>{let w=_(o,m),k=t.path?`${t.path.replace(/\/$/,"")}/${w}`:w,b=await J(m,t.bucket,k,e,!1,p);return b.error?(console.error(`Failed to upload ${m}: ${b.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${k}`),!0)}),d=(await x(s,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:d}):`Uploaded ${d} file(s)`);return}let l;try{l=z(c)}catch{f(`Source not found: ${i}`)}if(l.isDirectory()){a||f(`${i} is a directory (not copied). Use -r to copy recursively.`);let n=st(c);if(n.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files to upload");return}let o=i.endsWith("/")?"":E(c),s=n.map(m=>async()=>{let w=_(c,m),b=[t.path?.replace(/\/$/,""),o,w].filter(Boolean).join("/"),y=await J(m,t.bucket,b,e,!1,p);return y.error?(console.error(`Failed to upload ${m}: ${y.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${b}`),!0)}),d=(await x(s,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:d}):`Uploaded ${d} file(s)`)}else{let n=E(c),o;t.path?i.endsWith("/")||t.path.endsWith("/")?o=`${t.path.replace(/\/$/,"")}/${n}`:await D(t.bucket,t.path,e)?o=`${t.path}/${n}`:o=t.path:o=n;let s=await J(c,t.bucket,o,e,!h,p);s.error&&f(s.error),console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:1,src:i,dest:`t3://${t.bucket}/${o}`}):`Uploaded ${i} -> t3://${t.bucket}/${o}`)}}async function ft(i,t,e,a,p){let c=i.endsWith("/");!t.path&&!c&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=Z(e),l=t.path.includes("*"),n=t.path.endsWith("/")||!t.path&&c;if(!l&&!n&&(n=await D(t.bucket,t.path,a)),n&&!l&&!p&&f("Source is a remote folder (not copied). Use -r to copy recursively."),l||n){let o=l?j(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",s=!l&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",{items:u,error:d}=await A(t.bucket,o||void 0,a);d&&f(d);let m=u.filter(y=>!y.name.endsWith("/"));if(l){let y=t.path.split("/").pop(),$=O(y);m=m.filter(S=>{let g=o?S.name.slice(o.length):S.name;return!p&&g.includes("/")?!1:$.test(g.split("/").pop())})}if(m.length===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:0}):"No objects to download");return}let w=m.map(y=>async()=>{let $=o?y.name.slice(o.length):y.name,S=s?v(r,s,$):v(r,$),g=await Q(t.bucket,y.name,S,a);return g.error?(console.error(`Failed to download ${y.name}: ${g.error}`),!1):(h||console.log(`Downloaded t3://${t.bucket}/${y.name} -> ${S}`),!0)}),b=(await x(w,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:b}):`Downloaded ${b} file(s)`)}else{let o=t.path.split("/").pop(),s,u=!1;try{u=z(r).isDirectory()}catch{}u||e.endsWith("/")?s=v(r,o):s=r;let d=await Q(t.bucket,t.path,s,a,!h);d.error&&f(d.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:1,src:`t3://${t.bucket}/${t.path}`,dest:s}):`Downloaded t3://${t.bucket}/${t.path} -> ${s}`)}}async function mt(i,t,e,a,p){let c=i.endsWith("/");!t.path&&!c&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=i.includes("*"),l=t.path.endsWith("/")||!t.path&&c;if(!r&&!l&&t.path&&(l=await D(t.bucket,t.path,a)),l&&!r&&!p&&f("Source is a remote folder (not copied). Use -r to copy recursively."),r||l){let n=r?j(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",o=!r&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",u=[e.path?.replace(/\/$/,"")||"",o].filter(Boolean).join("/"),d=u?`${u}/`:"";t.bucket===e.bucket&&n===d&&f("Source and destination are the same");let{items:m,error:w}=await A(t.bucket,n||void 0,a);w&&f(w);let k=m.filter(g=>g.name!==n);if(r){let g=t.path.split("/").pop(),W=O(g);k=k.filter(F=>{let N=n?F.name.slice(n.length):F.name;return!p&&N.includes("/")?!1:W.test(N.split("/").pop())})}let b=k.map(g=>async()=>{let W=n?g.name.slice(n.length):g.name,F=u?`${u}/${W}`:W,N=await B(a,t.bucket,g.name,e.bucket,F);return N.error?(console.error(`Failed to copy ${g.name}: ${N.error}`),!1):(h||console.log(`Copied t3://${t.bucket}/${g.name} -> t3://${e.bucket}/${F}`),!0)}),$=(await x(b,8)).filter(Boolean).length,S=!1;if(u&&n){let{data:g}=await ot({prefix:n,limit:1,config:{...a,bucket:t.bucket}});if(g?.items?.some(W=>W.name===n)){let W=`${u}/`,F=await B(a,t.bucket,n,e.bucket,W);F.error?console.error(`Failed to copy folder marker: ${F.error}`):S=!0}}if($===0&&S&&($=1),$===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:0}):"No objects to copy");return}console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:$}):`Copied ${$} object(s)`)}else{let n=t.path.split("/").pop(),o;e.path?e.path.endsWith("/")?o=`${e.path}${n}`:await D(e.bucket,e.path,a)?o=`${e.path}/${n}`:o=e.path:o=n,t.bucket===e.bucket&&t.path===o&&f("Source and destination are the same");let s=await B(a,t.bucket,t.path,e.bucket,o);s.error&&f(s.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:1,src:`t3://${t.bucket}/${t.path}`,dest:`t3://${e.bucket}/${o}`}):`Copied t3://${t.bucket}/${t.path} -> t3://${e.bucket}/${o}`)}}async function ht(i){let t=T(i,["src"]),e=T(i,["dest"]);(!t||!e)&&f("Both src and dest arguments are required");let a=!!T(i,["recursive","r"]),p=T(i,["access","a","A"]);h=M(i)==="json";let r;p===void 0?r=void 0:p==="public"||p==="private"?r=p:f('Access level must be either "public" or "private"');let l=ct(t,e);r!==void 0&&l!=="local-to-remote"&&f('--access only applies to local-to-remote uploads. Use "tigris objects set-access" to change access on existing objects.');let n=await K({withCredentialProvider:!0});switch(l){case"local-to-remote":{let o=C(e);o.bucket||f("Invalid destination path"),await ut(t,o,n,a,r);break}case"remote-to-local":{let o=C(t);o.bucket||f("Invalid source path"),await ft(t,o,e,n,a);break}case"remote-to-remote":{let o=C(t),s=C(e);o.bucket||f("Invalid source path"),s.bucket||f("Invalid destination path"),await mt(t,o,s,n,a);break}}process.exit(0)}export{ht as default};
@@ -0,0 +1 @@
1
+ import{a as b}from"../../../chunk-2ITYREA5.js";import{a as l}from"../../../chunk-EFPPY2JQ.js";import"../../../chunk-YN2TKPPT.js";import{a as n,b as u}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as g,j as d}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import{a as p}from"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{createTeam as y}from"@tigrisdata/iam";var t=d("iam teams","create");async function O(e){f(t);let I=u(e);if(p("Team management"))return;let r=n(e,["name"]),i=n(e,["description","d"]),a=typeof i=="string"?i:void 0,m=b(t,n(e,["members","m"]));r||o(t,"Team name is required");let w=await l(t),{data:s,error:c}=await y({name:r,...a!==void 0?{description:a}:{},...m?{members:m}:{}},{config:w});if(c&&o(t,c),I==="json"){console.log(JSON.stringify({action:"created",teamId:s.teamId,name:r}));return}g(t,{name:r}),console.log(`Team ID: ${s.teamId}`)}export{O as default};
@@ -0,0 +1 @@
1
+ import{a as w}from"../../../chunk-2ITYREA5.js";import{a as b}from"../../../chunk-EFPPY2JQ.js";import"../../../chunk-YN2TKPPT.js";import{a as t,b as l}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as c,c as g,j as u}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import{a as p}from"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{editTeam as I}from"@tigrisdata/iam";var e=u("iam teams","edit");async function R(n){c(e);let y=l(n);if(p("Team management"))return;let i=t(n,["id"]);i||o(e,"Team ID is required");let s=t(n,["name","n"]),r=typeof s=="string"?s:void 0,d=t(n,["description","d"]),a=typeof d=="string"?d:void 0,m=w(e,t(n,["members","m"]));r===void 0&&a===void 0&&m===void 0&&o(e,"Provide at least one of --name, --description, or --members to update");let O=await b(e),{error:f}=await I(i,{...r!==void 0?{name:r}:{},...a!==void 0?{description:a}:{},...m?{members:m}:{}},{config:O});f&&o(e,f),y==="json"&&console.log(JSON.stringify({action:"updated",teamId:i})),g(e,{id:i})}export{R as default};
@@ -0,0 +1 @@
1
+ import{a as p}from"../../../chunk-EFPPY2JQ.js";import{b as g,d as u,e as h}from"../../../chunk-IRDNZN7R.js";import"../../../chunk-YN2TKPPT.js";import{b as d}from"../../../chunk-S6KFKBMY.js";import{b as l}from"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import{b as a,c as i,e as s,j as c}from"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";import"../../../chunk-ATBINUDP.js";import"../../../chunk-3EAZ2L6H.js";import{a as f}from"../../../chunk-GAWFFIPC.js";import"../../../chunk-OHGCOC5Q.js";import{listTeams as k}from"@tigrisdata/iam";var t=c("iam teams","list");async function C(y){a(t);let r=d(y);if(f("Team management"))return;let b=await p(t),{data:o,error:m}=await k({config:b});if(m&&l(t,m),o.teams.length===0){s(t);return}let n=o.teams.map(e=>({id:e.id,name:e.name,description:e.description||"-",members:e.members.length,created:e.createdAt}));console.log(r==="json"?g({teams:o.teams}):r==="xml"?u(n,"teams","team"):h(n,[{key:"id",header:"ID"},{key:"name",header:"Name"},{key:"description",header:"Description"},{key:"members",header:"Members"},{key:"created",header:"Created"}])),i(t,{count:o.teams.length})}export{C as default};
@@ -0,0 +1 @@
1
+ import{a}from"../../../chunk-2ITYREA5.js";import"../../../chunk-UBANDLB4.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-7ZUCJBD5.js";import"../../../chunk-PPNBQWSR.js";export{a as parseMembers};
package/dist/lib/mk.js CHANGED
@@ -1 +1 @@
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
+ import{c as m}from"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";import{e as h}from"../chunk-RXNG56FL.js";import{d as b}from"../chunk-YN2TKPPT.js";import{a as t,b as p}from"../chunk-S6KFKBMY.js";import{a as r}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 O,put as A}from"@tigrisdata/storage";async function j(e){let l=t(e,["path"]);l||r("path argument is required");let{bucket:o,path:a}=h(l);o||r("Invalid path");let f=await b(),u=p(e);if(a){let s=a.endsWith("/")?a:`${a}/`,{error:c}=await A(s,"",{config:{...f,bucket:o}});c&&r(c),console.log(u==="json"?JSON.stringify({action:"created",type:"folder",bucket:o,path:s}):`Folder '${o}/${s}' created`),process.exit(0)}else{let c=t(e,["public"])?"public":t(e,["access","a","A"]),d=t(e,["enableSnapshots","enable-snapshots","s","S"]),S=t(e,["allow-object-acl","allowObjectAcl"]),k=t(e,["enable-directory-listing","enableDirectoryListing"]),y=t(e,["defaultTier","default-tier","t","T"]),w=t(e,["locations","l","L"]),n=t(e,["fork-of","forkOf","fork"]),i=t(e,["source-snapshot","sourceSnapshot","source-snap"]);i&&!n&&r("--source-snapshot requires --fork-of");let{error:g}=await O(o,{defaultTier:y??"STANDARD",enableSnapshot:d===!0,allowObjectAcl:S===!0,enableDirectoryListing:k===!0,access:c??"private",locations:m(w??"global"),...n?{sourceBucketName:n}:{},...i?{sourceBucketSnapshot:i}:{},config:f});g&&r(g),console.log(u==="json"?JSON.stringify({action:"created",type:"bucket",name:o}):`Bucket '${o}' created`),process.exit(0)}}export{j as default};
@@ -0,0 +1 @@
1
+ import{f as v}from"../../chunk-IRDNZN7R.js";import{h as y}from"../../chunk-RXNG56FL.js";import{d}from"../../chunk-YN2TKPPT.js";import{a as n,b as k}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as g,e as p,j as l}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{getRestoreInfo as x}from"@tigrisdata/storage";var t=l("objects","restore-info");async function A(r){u(t);let s=k(r),c=n(r,["bucket"]),S=n(r,["key"]),a=n(r,["version-id","versionId"]);c||i(t,"Bucket name or path is required");let{bucket:f,key:e}=y(c,S);e||i(t,"Object key is required");let b=await d(),{data:o,error:m}=await x(e,{...a?{versionId:a}:{},config:{...b,bucket:f}});if(m&&i(t,m),!o){s==="json"?console.log(JSON.stringify({status:null})):p(t);return}let O=[{metric:"Path",value:e},{metric:"Status",value:o.status},...o.expiresAt?[{metric:"Expires",value:o.expiresAt.toISOString()}]:[]],h=v(O,s,"restore-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(h),g(t,{bucket:f,key:e})}export{A as default};
@@ -0,0 +1 @@
1
+ import{h as k}from"../../chunk-RXNG56FL.js";import{d as y}from"../../chunk-YN2TKPPT.js";import{a as i,b}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as d,j as u}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{restoreObject as v}from"@tigrisdata/storage";var r=u("objects","restore");async function O(t){a(r);let p=b(t),c=i(t,["bucket"]),l=i(t,["key"]),f=i(t,["version-id","versionId"]),g=i(t,["days","d"]);c||o(r,"Bucket name or path is required");let{bucket:s,key:n}=k(c,l);n||o(r,"Object key is required");let e;g!==void 0&&(e=Number(g),(!Number.isInteger(e)||e<1)&&o(r,"--days must be a positive integer"));let j=await y(),{error:m}=await v(n,{...e!==void 0?{days:e}:{},...f?{versionId:f}:{},config:{...j,bucket:s}});m&&o(r,m),p==="json"&&console.log(JSON.stringify({action:"restore-requested",bucket:s,key:n,days:e??1})),d(r,{key:n,bucket:s})}export{O 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-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};
1
+ import{b as d}from"../chunk-S6KFKBMY.js";import{a as t,c as l,d as p,e as f}from"../chunk-BVSVEXGE.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
@@ -298,6 +298,8 @@ commands:
298
298
  examples:
299
299
  - "tigris mk my-bucket"
300
300
  - "tigris mk my-bucket --access public --region iad"
301
+ - "tigris mk my-bucket --allow-object-acl"
302
+ - "tigris mk my-bucket --public --enable-directory-listing"
301
303
  - "tigris mk my-bucket/images/"
302
304
  - "tigris mk t3://my-bucket"
303
305
  - "tigris mk my-fork --fork-of my-bucket"
@@ -327,6 +329,14 @@ commands:
327
329
  alias: s
328
330
  type: flag
329
331
  default: false
332
+ - name: allow-object-acl
333
+ description: Allow per-object ACLs on the bucket (only applies when creating a bucket)
334
+ type: flag
335
+ default: false
336
+ - name: enable-directory-listing
337
+ description: Enable directory listing, relevant for public buckets (only applies when creating a bucket)
338
+ type: flag
339
+ default: false
330
340
  - name: default-tier
331
341
  description: Default storage tier (only applies when creating a bucket)
332
342
  alias: t
@@ -447,6 +457,7 @@ commands:
447
457
  alias: copy
448
458
  examples:
449
459
  - "tigris cp ./file.txt t3://my-bucket/file.txt"
460
+ - "tigris cp ./logo.png t3://my-bucket/logo.png --access public"
450
461
  - "tigris cp t3://my-bucket/file.txt ./local-copy.txt"
451
462
  - "tigris cp t3://my-bucket/src/ t3://my-bucket/dest/ -r"
452
463
  - "tigris cp ./images/ t3://my-bucket/images/ -r"
@@ -476,6 +487,10 @@ commands:
476
487
  type: flag
477
488
  alias: r
478
489
  description: Copy directories recursively
490
+ - name: access
491
+ description: Access level for uploaded objects (only applies to local-to-remote uploads)
492
+ alias: a
493
+ options: *access_options
479
494
 
480
495
  # mv
481
496
  - name: mv
@@ -699,6 +714,8 @@ commands:
699
714
  - "tigris buckets create my-bucket"
700
715
  - "tigris buckets create my-bucket --access public --locations iad"
701
716
  - "tigris buckets create my-bucket --enable-snapshots --default-tier STANDARD_IA"
717
+ - "tigris buckets create my-bucket --allow-object-acl"
718
+ - "tigris buckets create my-bucket --public --enable-directory-listing"
702
719
  - "tigris buckets create my-fork --fork-of my-bucket"
703
720
  - "tigris buckets create my-fork --fork-of my-bucket --source-snapshot 1765889000501544464"
704
721
  messages:
@@ -730,6 +747,14 @@ commands:
730
747
  alias: s
731
748
  type: flag
732
749
  default: false
750
+ - name: allow-object-acl
751
+ description: Allow per-object ACLs on the bucket
752
+ type: flag
753
+ default: false
754
+ - name: enable-directory-listing
755
+ description: Enable directory listing, relevant for public buckets
756
+ type: flag
757
+ default: false
733
758
  - name: default-tier
734
759
  description: Choose the default tier for the bucket
735
760
  alias: t
@@ -1563,6 +1588,62 @@ commands:
1563
1588
  alias: snapshot
1564
1589
  - name: version-id
1565
1590
  description: Object version id (requires bucket versioning). Omit to read the latest version
1591
+ # restore
1592
+ - name: restore
1593
+ description: Restore an archived object (e.g. one in the GLACIER tier) into an actively-readable copy for a number of days
1594
+ alias: rs
1595
+ examples:
1596
+ - "tigris objects restore my-bucket archived.bin"
1597
+ - "tigris objects restore my-bucket archived.bin --days 3"
1598
+ - "tigris objects restore t3://my-bucket/archived.bin --days 7"
1599
+ messages:
1600
+ onStart: 'Requesting restore...'
1601
+ onSuccess: "Restore requested for '{{key}}'"
1602
+ onFailure: 'Failed to restore object'
1603
+ arguments:
1604
+ - name: bucket
1605
+ type: positional
1606
+ required: true
1607
+ description: Name of the bucket, or a full path (t3://bucket/key)
1608
+ - name: key
1609
+ type: positional
1610
+ description: Key of the object (omit if bucket contains the full path)
1611
+ - name: days
1612
+ description: How many days the restored copy stays available before reverting to its archived tier
1613
+ alias: d
1614
+ default: 1
1615
+ - name: version-id
1616
+ description: Restore a specific object version (requires bucket versioning). Omit to restore the current version
1617
+ - name: format
1618
+ description: Output format
1619
+ options: [json, table, xml]
1620
+ default: table
1621
+ # restore-info
1622
+ - name: restore-info
1623
+ description: Show the restore state of an archived object (archived, in-progress, or restored)
1624
+ alias: ri
1625
+ examples:
1626
+ - "tigris objects restore-info my-bucket archived.bin"
1627
+ - "tigris objects restore-info t3://my-bucket/archived.bin --format json"
1628
+ messages:
1629
+ onStart: ''
1630
+ onSuccess: ''
1631
+ onFailure: 'Failed to get restore info'
1632
+ onEmpty: 'No restore information for this object (it is not archived)'
1633
+ arguments:
1634
+ - name: bucket
1635
+ type: positional
1636
+ required: true
1637
+ description: Name of the bucket, or a full path (t3://bucket/key)
1638
+ - name: key
1639
+ type: positional
1640
+ description: Key of the object (omit if bucket contains the full path)
1641
+ - name: version-id
1642
+ description: Inspect a specific object version (requires bucket versioning). Omit to read the current version
1643
+ - name: format
1644
+ description: Output format
1645
+ options: [json, table, xml]
1646
+ default: table
1566
1647
 
1567
1648
  #########################
1568
1649
  # Manage access keys
@@ -2099,3 +2180,78 @@ commands:
2099
2180
  - name: force
2100
2181
  type: flag
2101
2182
  description: Skip confirmation prompts (alias for --yes)
2183
+ - name: teams
2184
+ description: Manage organization teams
2185
+ alias: t
2186
+ examples:
2187
+ - "tigris iam teams list"
2188
+ - "tigris iam teams create engineering --members user@example.com"
2189
+ - "tigris iam teams edit team_id --name platform"
2190
+ commands:
2191
+ - name: list
2192
+ description: List all teams in the organization
2193
+ alias: l
2194
+ examples:
2195
+ - "tigris iam teams list"
2196
+ - "tigris iam teams list --format json"
2197
+ messages:
2198
+ onStart: ''
2199
+ onSuccess: ''
2200
+ onFailure: 'Failed to list teams'
2201
+ onEmpty: 'No teams found in this organization'
2202
+ arguments:
2203
+ - name: format
2204
+ description: Output format
2205
+ options: [json, table, xml]
2206
+ default: table
2207
+ - name: create
2208
+ description: Create a new team in the organization
2209
+ alias: c
2210
+ examples:
2211
+ - "tigris iam teams create engineering"
2212
+ - "tigris iam teams create engineering --description 'Engineering team'"
2213
+ - "tigris iam teams create engineering --members a@example.com,b@example.com"
2214
+ messages:
2215
+ onStart: 'Creating team...'
2216
+ onSuccess: "Team '{{name}}' created"
2217
+ onFailure: 'Failed to create team'
2218
+ arguments:
2219
+ - name: name
2220
+ description: Name of the team
2221
+ type: positional
2222
+ required: true
2223
+ examples:
2224
+ - engineering
2225
+ - name: description
2226
+ description: Description for the team
2227
+ alias: d
2228
+ - name: members
2229
+ description: Member email address(es) to add (comma-separated for multiple)
2230
+ alias: m
2231
+ multiple: true
2232
+ - name: edit
2233
+ description: Update a team's name, description, or members. Members are replaced with the provided list
2234
+ alias: e
2235
+ examples:
2236
+ - "tigris iam teams edit team_id --name platform"
2237
+ - "tigris iam teams edit team_id --description 'Platform team'"
2238
+ - "tigris iam teams edit team_id --members a@example.com,b@example.com"
2239
+ messages:
2240
+ onStart: 'Updating team...'
2241
+ onSuccess: "Team updated"
2242
+ onFailure: 'Failed to update team'
2243
+ arguments:
2244
+ - name: id
2245
+ description: ID of the team to edit
2246
+ type: positional
2247
+ required: true
2248
+ - name: name
2249
+ description: New name for the team
2250
+ alias: n
2251
+ - name: description
2252
+ description: New description for the team
2253
+ alias: d
2254
+ - name: members
2255
+ description: Replace the team's members with these email address(es) (comma-separated for multiple)
2256
+ alias: m
2257
+ multiple: true
@@ -1 +1 @@
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};
1
+ import{b as a,c as b,d as c,e as d,f as e}from"../chunk-BVSVEXGE.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.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "Command line interface for Tigris object storage",
5
5
  "type": "module",
6
6
  "exports": {
@@ -102,8 +102,8 @@
102
102
  "dependencies": {
103
103
  "@aws-sdk/credential-providers": "^3.1038.0",
104
104
  "@smithy/shared-ini-file-loader": "^4.4.9",
105
- "@tigrisdata/iam": "^2.1.1",
106
- "@tigrisdata/storage": "^3.15.0",
105
+ "@tigrisdata/iam": "^2.2.0",
106
+ "@tigrisdata/storage": "^3.16.0",
107
107
  "commander": "^14.0.3",
108
108
  "enquirer": "^2.4.1",
109
109
  "jose": "^6.2.3",