@tigrisdata/cli 3.2.0 → 3.4.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 +122 -0
- package/dist/auth/iam.js +1 -1
- package/dist/auth/provider.js +1 -1
- package/dist/{chunk-D3UQD6W2.js → chunk-2GLKQBPM.js} +1 -1
- package/dist/chunk-2ITYREA5.js +1 -0
- package/dist/{chunk-2OQSVS4G.js → chunk-HHDQ3ISR.js} +1 -1
- package/dist/{chunk-YWSU7MW7.js → chunk-NOD4ZVXO.js} +3 -3
- package/dist/{chunk-EFPPY2JQ.js → chunk-VQDOL2GU.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/access-keys/assign.js +1 -1
- package/dist/lib/access-keys/attach-policy.js +1 -1
- package/dist/lib/access-keys/create.js +1 -1
- package/dist/lib/access-keys/delete.js +1 -1
- package/dist/lib/access-keys/detach-policy.js +1 -1
- package/dist/lib/access-keys/get.js +1 -1
- package/dist/lib/access-keys/list-policies.js +1 -1
- package/dist/lib/access-keys/list.js +1 -1
- package/dist/lib/access-keys/rotate.js +1 -1
- package/dist/lib/buckets/create.js +1 -1
- package/dist/lib/buckets/delete.js +1 -1
- package/dist/lib/buckets/disable-snapshots.js +1 -1
- package/dist/lib/buckets/enable-snapshots.js +1 -1
- package/dist/lib/buckets/get.js +1 -1
- package/dist/lib/buckets/lifecycle/create.js +1 -1
- package/dist/lib/buckets/lifecycle/edit.js +1 -1
- package/dist/lib/buckets/lifecycle/list.js +1 -1
- package/dist/lib/buckets/list.js +1 -1
- package/dist/lib/buckets/merge.js +1 -0
- package/dist/lib/buckets/migrate.js +1 -1
- package/dist/lib/buckets/rebase.js +1 -0
- package/dist/lib/buckets/restore.js +1 -1
- package/dist/lib/buckets/set-cors.js +1 -1
- package/dist/lib/buckets/set-locations.js +1 -1
- package/dist/lib/buckets/set-migration.js +1 -1
- package/dist/lib/buckets/set-notifications.js +1 -1
- package/dist/lib/buckets/set.js +1 -1
- package/dist/lib/bundle.js +1 -1
- package/dist/lib/configure/index.js +1 -1
- package/dist/lib/cp.js +1 -1
- package/dist/lib/credentials/test.js +1 -1
- package/dist/lib/iam/policies/create.js +1 -1
- package/dist/lib/iam/policies/delete.js +1 -1
- package/dist/lib/iam/policies/edit.js +1 -1
- package/dist/lib/iam/policies/get.js +1 -1
- package/dist/lib/iam/policies/link-key.js +1 -1
- package/dist/lib/iam/policies/list-keys.js +1 -1
- package/dist/lib/iam/policies/list.js +1 -1
- package/dist/lib/iam/policies/unlink-key.js +1 -1
- package/dist/lib/iam/teams/create.js +1 -0
- package/dist/lib/iam/teams/edit.js +1 -0
- package/dist/lib/iam/teams/list.js +1 -0
- package/dist/lib/iam/teams/shared.js +1 -0
- package/dist/lib/iam/users/invite.js +1 -1
- package/dist/lib/iam/users/list.js +1 -1
- package/dist/lib/iam/users/remove.js +1 -1
- package/dist/lib/iam/users/revoke-invitation.js +1 -1
- package/dist/lib/iam/users/update-role.js +1 -1
- package/dist/lib/login/credentials.js +1 -1
- package/dist/lib/login/select.js +1 -1
- package/dist/lib/ls.js +1 -1
- package/dist/lib/mk.js +1 -1
- package/dist/lib/mv.js +1 -1
- package/dist/lib/objects/delete.js +1 -1
- package/dist/lib/objects/get.js +1 -1
- package/dist/lib/objects/info.js +1 -1
- package/dist/lib/objects/list-versions.js +1 -1
- package/dist/lib/objects/list.js +1 -1
- package/dist/lib/objects/put.js +1 -1
- package/dist/lib/objects/restore-info.js +1 -0
- package/dist/lib/objects/restore.js +1 -0
- package/dist/lib/objects/set-access.js +1 -1
- package/dist/lib/objects/set.js +1 -1
- package/dist/lib/organizations/create.js +1 -1
- package/dist/lib/organizations/list.js +1 -1
- package/dist/lib/organizations/select.js +1 -1
- package/dist/lib/presign.js +1 -1
- package/dist/lib/rm.js +1 -1
- package/dist/lib/snapshots/list.js +1 -1
- package/dist/lib/snapshots/take.js +1 -1
- package/dist/lib/stat.js +1 -1
- package/dist/lib/touch.js +1 -1
- package/dist/lib/update.js +1 -1
- package/dist/lib/whoami.js +1 -1
- package/dist/specs.yaml +208 -2
- package/dist/utils/update-check.js +1 -1
- package/package.json +9 -50
- /package/dist/{chunk-YN2TKPPT.js → chunk-RS4HZYP3.js} +0 -0
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
|
package/dist/auth/iam.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,b as c}from"../chunk-
|
|
1
|
+
import{a as b,b as c}from"../chunk-VQDOL2GU.js";import"../chunk-RS4HZYP3.js";import"../chunk-UBANDLB4.js";import"../chunk-DV3LCXRH.js";import"../chunk-7ZUCJBD5.js";import"../chunk-PPNBQWSR.js";import"../chunk-ATBINUDP.js";import"../chunk-3EAZ2L6H.js";import{a}from"../chunk-GAWFFIPC.js";import"../chunk-OHGCOC5Q.js";export{c as getIAMConfig,b as getOAuthIAMConfig,a as isFlyOrganization};
|
package/dist/auth/provider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f}from"../chunk-RS4HZYP3.js";import"../chunk-ATBINUDP.js";import"../chunk-3EAZ2L6H.js";import"../chunk-OHGCOC5Q.js";export{b as getEnvCredentials,d as getStorageConfig,e as getStorageConfigWithOrg,a as getTigrisConfig,f as requireOAuthLogin,c as resolveAuthMethod};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as K}from"./chunk-S77OAN6Y.js";import{a as w}from"./chunk-
|
|
1
|
+
import{a as K}from"./chunk-S77OAN6Y.js";import{a as w}from"./chunk-RS4HZYP3.js";import{b as S}from"./chunk-S6KFKBMY.js";import{b as d,d as m}from"./chunk-UBANDLB4.js";import{b as i,c as n,j as o}from"./chunk-7ZUCJBD5.js";import{a as g}from"./chunk-ATBINUDP.js";import{l as f,n as y,o as p,q as u,s as l}from"./chunk-OHGCOC5Q.js";import C from"enquirer";import{whoami as k}from"@tigrisdata/iam";var{prompt:I}=C,a=o("login","credentials");async function q(e){i(a);let A=S(e),s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,r=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(!s||!r){let t=[];s||t.push({type:"input",name:"accessKey",message:"Access Key ID:",required:!0}),r||t.push({type:"password",name:"accessSecret",message:"Secret Access Key:",required:!0}),K("Provide --access-key and --access-secret");let c=await I(t);s=s||c.accessKey,r=r||c.accessSecret}(!s||!r)&&d(a,"Access key and secret are required");let h=f()?.endpoint||g;await y({accessKeyId:s,secretAccessKey:r,endpoint:h}),await p("credentials"),await l();try{let t=w(),{data:c}=await k({config:{accessKeyId:s,secretAccessKey:r,iamEndpoint:t.iamEndpoint}});c?.organizationId&&await u(c.organizationId,"temporary")}catch{}A==="json"&&console.log(JSON.stringify({action:"logged_in"})),n(a),m(a)}export{q as a};
|
|
@@ -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 +1 @@
|
|
|
1
|
-
import{a as s,f as l}from"./chunk-
|
|
1
|
+
import{a as s,f as l}from"./chunk-NOD4ZVXO.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,8 +1,8 @@
|
|
|
1
|
-
import{d as
|
|
1
|
+
import{d,e as f,f as m}from"./chunk-ATBINUDP.js";import{mkdirSync as w,readFileSync as _,realpathSync as E,writeFileSync as I}from"fs";import T from"https";import{homedir as g}from"os";import{join as h}from"path";var u="3.4.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 x(e,n){let a=i=>{let s=i.startsWith("v")?i.slice(1):i,c=null,o=s.indexOf("-");o!==-1&&(c=s.slice(o+1),s=s.slice(0,o));let l=s.split(".");if(l.length!==3)return null;let p=l.map(Number);return p.some(isNaN)?null:{major:p[0],minor:p[1],patch:p[2],prerelease:c}},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=T.get(d,{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&&x(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",c="\u2514"+"\u2500".repeat(i-2)+"\u2518",o=l=>"\u2502 "+l.padEnd(i-4)+" \u2502";console.log(`
|
|
2
2
|
${s}
|
|
3
3
|
${o("")}
|
|
4
4
|
${o(r)}
|
|
5
5
|
${o(t)}
|
|
6
6
|
${o("")}
|
|
7
|
-
${
|
|
8
|
-
`),v({...e,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||216e5;(!e||Date.now()-e.lastChecked>a)&&j()}export{u as a,y as b,
|
|
7
|
+
${c}
|
|
8
|
+
`),v({...e,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||216e5;(!e||Date.now()-e.lastChecked>a)&&j()}export{u as a,y as b,x as c,M as d,k as e,O as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,c as a}from"./chunk-
|
|
1
|
+
import{a as o,c as a}from"./chunk-RS4HZYP3.js";import{b as i}from"./chunk-UBANDLB4.js";import{c as r}from"./chunk-3EAZ2L6H.js";import{i as n,p as s}from"./chunk-OHGCOC5Q.js";async function d(e){s()!=="oauth"&&i(e,`This operation requires OAuth login.
|
|
2
2
|
Run "tigris login oauth" first.`);let t=r();await t.isAuthenticated()||i(e,'Not authenticated. Run "tigris login oauth" first.');let c=n(),{iamEndpoint:g,mgmtEndpoint:u}=o();return{sessionToken:await t.getAccessToken(),organizationId:c??void 0,iamEndpoint:g,mgmtEndpoint:u}}async function A(e){let t=await a();switch(t.type){case"oauth":return d(e);case"aws-profile":case"credentials":case"environment":case"configured":return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,organizationId:n()??void 0,iamEndpoint:o().iamEndpoint};case"none":i(e,'Not authenticated. Run "tigris login" or "tigris configure" first.')}}export{d as a,A as b};
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-HHDQ3ISR.js";import"./chunk-NOD4ZVXO.js";import"./chunk-G4DHMSCQ.js";import"./chunk-UBANDLB4.js";import"./chunk-DV3LCXRH.js";import"./chunk-7ZUCJBD5.js";import"./chunk-PPNBQWSR.js";import"./chunk-ATBINUDP.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-HHDQ3ISR.js";import"./chunk-NOD4ZVXO.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{b as y}from"../../chunk-
|
|
1
|
+
import{b as y}from"../../chunk-VQDOL2GU.js";import"../../chunk-RS4HZYP3.js";import{a as s,b as h}from"../../chunk-S6KFKBMY.js";import{b as n,c as b,d as p}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as A,c as f,j as R}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{assignBucketRoles as x,revokeAllBucketRoles as w}from"@tigrisdata/iam";var e=R("access-keys","assign"),N=["Editor","ReadOnly","NamespaceAdmin"];function v(r){return r?Array.isArray(r)?r:[r]:[]}async function O(r){A(e);let g=h(r),i=s(r,["id"]),m=s(r,["admin"]),d=s(r,["revokeRoles","revoke-roles"]),l=v(s(r,["bucket","b"])),t=v(s(r,["role","r"]));i||n(e,"Access key ID is required"),m&&d&&n(e,"Cannot use --admin and --revoke-roles together");let u=await y(e);if(d){let{error:o}=await w(i,{config:u});o&&n(e,o),g==="json"&&console.log(JSON.stringify({action:"revoked",id:i})),f(e);return}let a;if(m)a=[{bucket:"*",role:"NamespaceAdmin"}];else{l.length===0&&n(e,"At least one bucket name is required (or use --admin or --revoke-roles)"),t.length===0&&n(e,"At least one role is required (or use --admin or --revoke-roles)");for(let o of t)N.includes(o)||n(e,`Invalid role "${o}". Valid roles are: ${N.join(", ")}`);t.length===1?a=l.map(o=>({bucket:o,role:t[0]})):t.length===l.length?a=l.map((o,c)=>({bucket:o,role:t[c]})):n(e,`Number of roles (${t.length}) must be 1 or match number of buckets (${l.length})`)}let{error:k}=await x(i,a,{config:u});if(k&&n(e,k),g==="json"){let o=b(e),c={action:"assigned",id:i,assignments:a};o.length>0&&(c.nextActions=o),console.log(JSON.stringify(c))}f(e),p(e)}export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u}from"../../chunk-
|
|
1
|
+
import{b as u}from"../../chunk-VQDOL2GU.js";import{a as d}from"../../chunk-S77OAN6Y.js";import"../../chunk-RS4HZYP3.js";import{a as l,b as h}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 g}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 S from"enquirer";import{attachPolicyToAccessKey as N,listPolicies as R,listPoliciesForAccessKey as q}from"@tigrisdata/iam";var{prompt:k}=S,e=g("access-keys","attach-policy");async function v(s){p(e);let A=h(s),o=l(s,["id"]),r=l(s,["policyArn","policy-arn"]);o||t(e,"Access key ID is required");let c=await u(e);if(!r){d("Use --policy-arn to specify the policy ARN");let[a,n]=await Promise.all([R({config:c}),q(o,{config:c})]);a.error&&t(e,a.error),n.error&&t(e,n.error);let w=new Set(n.data.policies),f=a.data.policies.filter(i=>!w.has(i.name));f.length===0&&t(e,"No unassigned policies available. All policies are already attached to this access key.");let{selected:P}=await k({type:"select",name:"selected",message:"Select a policy to attach:",choices:f.map(i=>({name:i.resource,message:`${i.name} (${i.resource})`}))});r=P}let{error:m}=await N(o,r,{config:c});m&&t(e,m),A==="json"&&console.log(JSON.stringify({action:"attached",id:o,policyArn:r})),y(e)}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u}from"../../chunk-
|
|
1
|
+
import{b as u}from"../../chunk-VQDOL2GU.js";import"../../chunk-RS4HZYP3.js";import{a as d,b as p}from"../../chunk-S6KFKBMY.js";import{b as o,c as g,d as f}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as m,j as l}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{createAccessKey as w}from"@tigrisdata/iam";var t=l("access-keys","create");async function x(n){a(t);let A=p(n),c=d(n,["name"]);c||o(t,"Access key name is required");let y=await u(t),{data:e,error:s}=await w(c,{config:y});if(s&&o(t,s),A==="json"){let r=g(t,{name:e.name,id:e.id}),i={action:"created",name:e.name,id:e.id,secret:e.secret};r.length>0&&(i.nextActions=r),console.log(JSON.stringify(i))}else console.log(` Name: ${e.name}`),console.log(` Access Key ID: ${e.id}`),console.log(` Secret Access Key: ${e.secret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again.");m(t),f(t,{name:e.name,id:e.id})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as g}from"../../chunk-
|
|
1
|
+
import{b as g}from"../../chunk-VQDOL2GU.js";import{a as m,b as a}from"../../chunk-S77OAN6Y.js";import"../../chunk-RS4HZYP3.js";import{a as i,b as d}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as n,c as s,j as f}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{removeAccessKey as u}from"@tigrisdata/iam";var e=f("access-keys","delete");async function k(r){n(e);let l=d(r),o=i(r,["id"]),p=i(r,["yes","y","force"]);if(o||t(e,"Access key ID is required"),!p&&(m("Use --yes to skip confirmation"),!await a(`Delete access key '${o}'?`))){console.log("Aborted");return}let y=await g(e),{error:c}=await u(o,{config:y});c&&t(e,c),l==="json"&&console.log(JSON.stringify({action:"deleted",id:o})),s(e)}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as A}from"../../chunk-
|
|
1
|
+
import{b as A}from"../../chunk-VQDOL2GU.js";import{a as m,b as h}from"../../chunk-S77OAN6Y.js";import"../../chunk-RS4HZYP3.js";import{a,b as u}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as y,j as g}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 N from"enquirer";import{detachPolicyFromAccessKey as $,listPolicies as q,listPoliciesForAccessKey as F}from"@tigrisdata/iam";var{prompt:R}=N,e=g("access-keys","detach-policy");async function I(c){p(e);let w=u(c),t=a(c,["id"]),i=a(c,["policyArn","policy-arn"]),k=a(c,["yes","y","force"]);t||o(e,"Access key ID is required");let n=await A(e);if(!i){m("Use --policy-arn to specify the policy ARN");let[s,l]=await Promise.all([F(t,{config:n}),q({config:n})]);s.error&&o(e,s.error),l.error&&o(e,l.error);let P=new Set(s.data.policies),d=l.data.policies.filter(r=>P.has(r.name));d.length===0&&o(e,"No policies are attached to this access key.");let{selected:S}=await R({type:"select",name:"selected",message:"Select a policy to detach:",choices:d.map(r=>({name:r.resource,message:`${r.name} (${r.resource})`}))});i=S}if(!k&&(m("Use --yes to skip confirmation"),!await h(`Detach policy '${i}' from access key '${t}'?`))){console.log("Aborted");return}let{error:f}=await $(t,i,{config:n});f&&o(e,f),w==="json"&&console.log(JSON.stringify({action:"detached",id:t,policyArn:i})),y(e)}export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as m}from"../../chunk-
|
|
1
|
+
import{b as m}from"../../chunk-VQDOL2GU.js";import"../../chunk-RS4HZYP3.js";import{a,b as f}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,j as g}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{getAccessKey as u}from"@tigrisdata/iam";var e=g("access-keys","get");async function $(s){c(e);let d=f(s),r=a(s,["id"]);r||t(e,"Access key ID is required");let p=await m(e),{data:o,error:n}=await u(r,{config:p});if(n&&t(e,n),d==="json")console.log(JSON.stringify(o));else if(console.log(` Name: ${o.name}`),console.log(` ID: ${o.id}`),console.log(` Status: ${o.status}`),console.log(` Created: ${o.createdAt}`),console.log(` Organization: ${o.organizationId}`),o.roles&&o.roles.length>0){console.log(" Roles:");for(let i of o.roles)console.log(` - ${i.bucket}: ${i.role}`)}else console.log(" Roles: None");l(e)}export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as P}from"../../chunk-
|
|
1
|
+
import{b as P}from"../../chunk-VQDOL2GU.js";import{g as A}from"../../chunk-IRDNZN7R.js";import"../../chunk-RS4HZYP3.js";import{a as y,b as k,c as h}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as m,c as f,e as g,i as d,j as u}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{listPoliciesForAccessKey as E}from"@tigrisdata/iam";var i=u("access-keys","list-policies");async function F(o){m(i);let n=k(o),{limit:r,pageToken:s}=h(o),a=y(o,["id"]);a||c(i,"Access key ID is required");let T=await P(i),{data:t,error:p}=await E(a,{...r!==void 0?{limit:r}:{},...s?{paginationToken:s}:{},config:T});if(p&&c(i,p),!t.policies||t.policies.length===0){g(i);return}let e=t.policies.map(O=>({policy:O})),x=[{key:"policy",header:e.length>1?"Attached Policies":"Attached Policy"}],l=t.paginationToken||void 0,w=A(e,n,"policies","policy",x,{paginationToken:l});console.log(w),n!=="json"&&n!=="xml"&&d(l),f(i,{count:e.length})}export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as h}from"../../chunk-
|
|
1
|
+
import{b as h}from"../../chunk-VQDOL2GU.js";import{g as T}from"../../chunk-IRDNZN7R.js";import"../../chunk-RS4HZYP3.js";import{b as k,c as y}from"../../chunk-S6KFKBMY.js";import{b as l}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as d,c as p,e as f,i as g,j as u}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{listAccessKeys as A}from"@tigrisdata/iam";var t=u("access-keys","list");async function P(a){d(t);let o=k(a),{limit:s,pageToken:i}=y(a),x=await h(t),{data:e,error:r}=await A({...s!==void 0?{limit:s}:{},...i?{paginationToken:i}:{},config:x});if(r&&l(t,r),!e.accessKeys||e.accessKeys.length===0){f(t);return}let c=e.accessKeys.map(n=>({name:n.name,id:n.id,status:n.status,created:n.createdAt})),K=[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}],m=e.paginationToken||void 0,w=T(c,o,"keys","key",K,{paginationToken:m});console.log(w),o!=="json"&&o!=="xml"&&g(m),p(t,{count:c.length})}export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as w}from"../../chunk-
|
|
1
|
+
import{b as w}from"../../chunk-VQDOL2GU.js";import{a as u,b as y}from"../../chunk-S77OAN6Y.js";import"../../chunk-RS4HZYP3.js";import{a as i,b as p}from"../../chunk-S6KFKBMY.js";import{b as n,c as g,d as m}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as l,j as d}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{rotateAccessKey as k}from"@tigrisdata/iam";var e=d("access-keys","rotate");async function x(o){f(e);let A=p(o),r=i(o,["id"]),S=i(o,["yes","y","force"]);if(r||n(e,"Access key ID is required"),!S&&(u("Use --yes to skip confirmation"),!await y(`Rotate access key '${r}'? The current secret will be invalidated.`))){console.log("Aborted");return}let h=await w(e),{data:t,error:s}=await k(r,{config:h});if(s&&n(e,s),A==="json"){let c=g(e,{id:t.id}),a={action:"rotated",id:t.id,secret:t.newSecret};c.length>0&&(a.nextActions=c),console.log(JSON.stringify(a))}else console.log(` Access Key ID: ${t.id}`),console.log(` New Secret Access Key: ${t.newSecret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again.");l(e),m(e,{id:t.id})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
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-RS4HZYP3.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"]),b=t(e,["public"])?"public":t(e,["access","a","A"]),d=t(e,["enable-snapshots","enableSnapshots","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"]),o=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 c=p("buckets","access","create"),n=g(c),f=n?.findIndex(r=>r.value===c?.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,b=l.access,h=l.defaultTier,d=l.enableSnapshots;try{S=await C()}catch(r){i(a,r)}}s||i(a,"Bucket name is required"),u&&!o&&i(a,"--source-snapshot requires --fork-of");let{error:k}=await E(s,{defaultTier:h??"STANDARD",enableSnapshot:d===!0,allowObjectAcl:N===!0,enableDirectoryListing:P===!0,access:b??"private",locations:S??j(I??"global"),...o?{sourceBucketName:o}:{},...u?{sourceBucketSnapshot:u}:{},config:await T()});if(k&&i(a,k),q==="json"){let c=x(a,{name:s}),n={action:"created",name:s,...o?{forkOf:o}:{}};c.length>0&&(n.nextActions=c),console.log(JSON.stringify(n))}v(a,{name:s}),D(a,{name:s})}export{W as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x,b as y}from"../../chunk-S77OAN6Y.js";import{d as b}from"../../chunk-
|
|
1
|
+
import{a as x,b as y}from"../../chunk-S77OAN6Y.js";import{d as b}from"../../chunk-RS4HZYP3.js";import{a as s,b as A}from"../../chunk-S6KFKBMY.js";import{a as p,b as d,c as k,d as h}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as g,d as u,j as l}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{removeBucket as N}from"@tigrisdata/storage";var e=l("buckets","delete");async function B(i){f(e);let w=A(i),o=s(i,["name"]),c=s(i,["yes","y","force"]);o||d(e,"Bucket name is required");let a=Array.isArray(o)?o:[o],S=await b();if(!c&&(x("Use --yes to skip confirmation"),!await y(`Delete ${a.length} bucket(s)?`))){console.log("Aborted");return}let m=[],n=[];for(let t of a){let{error:r}=await N(t,{config:S,force:c});r?(u(e,r.message,{name:t}),n.push({name:t,error:r.message})):(m.push(t),g(e,{name:t}))}if(w==="json"){let t=k(e),r={action:"deleted",names:m,errors:n};t.length>0&&(r.nextActions=t),console.log(JSON.stringify(r))}n.length>0&&p(n[0].error,e),h(e)}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as m}from"../../chunk-
|
|
1
|
+
import{e as m}from"../../chunk-RS4HZYP3.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as m}from"../../chunk-
|
|
1
|
+
import{e as m}from"../../chunk-RS4HZYP3.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};
|
package/dist/lib/buckets/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-RS4HZYP3.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-RZPBM4CD.js";import"../../../chunk-LAB2KJTN.js";import"../../../chunk-IRDNZN7R.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{e as y}from"../../../chunk-
|
|
1
|
+
import{a as R,b as k,c as b,d as F,e as I,f as c,g as h}from"../../../chunk-RZPBM4CD.js";import"../../../chunk-LAB2KJTN.js";import"../../../chunk-IRDNZN7R.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{e as y}from"../../../chunk-RS4HZYP3.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-RZPBM4CD.js";import"../../../chunk-LAB2KJTN.js";import"../../../chunk-IRDNZN7R.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{e as b}from"../../../chunk-
|
|
1
|
+
import{a as C,b as R,c as k,d as F,e as S,f as q,g as w}from"../../../chunk-RZPBM4CD.js";import"../../../chunk-LAB2KJTN.js";import"../../../chunk-IRDNZN7R.js";import"../../../chunk-N3Y6RFSK.js";import"../../../chunk-S77OAN6Y.js";import{e as b}from"../../../chunk-RS4HZYP3.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-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-
|
|
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-RS4HZYP3.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};
|
package/dist/lib/buckets/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as l}from"../../chunk-IRDNZN7R.js";import{d as j}from"../../chunk-
|
|
1
|
+
import{g as l}from"../../chunk-IRDNZN7R.js";import{d as j}from"../../chunk-RS4HZYP3.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{a as b,b as S}from"../../chunk-S77OAN6Y.js";import{d as x}from"../../chunk-RS4HZYP3.js";import{a as c,b as w}from"../../chunk-S6KFKBMY.js";import{b as s,c as h,d as l}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as k,c as p,j as d}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{getBucketInfo as $,mergeFork as F}from"@tigrisdata/storage";var r=d("buckets","merge");async function I(n){k(r);let y=w(n),o=c(n,["fork"]),t=c(n,["into","source"]),f=c(n,["from-snapshot","fromSnapshot","from-snap"]),A=c(n,["yes","y"]);o||s(r,"Fork bucket name is required");let a=await x();if(!t){let{data:e,error:i}=await $(o,{config:a});i&&s(r,i);let u=e?.forkInfo?.parents?.[0]?.bucketName;u||s(r,`'${o}' is not a fork or its source bucket could not be determined. Pass --into <source-bucket>.`),t=u}if(!A&&(b("Use --yes to skip confirmation"),!await S(`Merge fork '${o}' into source '${t}'? This writes the fork's changes into '${t}'.`))){console.log("Aborted");return}let{data:N,error:m}=await F(o,t,{...f?{forkSnapshot:f}:{},config:a});m&&s(r,m);let g=N?.snapshotVersion??"";if(y==="json"){let e=h(r,{fork:o,into:t}),i={action:"merged",fork:o,into:t,snapshotVersion:g};e.length>0&&(i.nextActions=e),console.log(JSON.stringify(i))}p(r,{fork:o,into:t,snapshotVersion:g}),l(r,{fork:o,into:t})}export{I as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as w}from"../../chunk-SAAGVLRE.js";import{a as h}from"../../chunk-IRDNZN7R.js";import{e as F}from"../../chunk-RXNG56FL.js";import{d as v}from"../../chunk-
|
|
1
|
+
import{a as w}from"../../chunk-SAAGVLRE.js";import{a as h}from"../../chunk-IRDNZN7R.js";import{e as F}from"../../chunk-RXNG56FL.js";import{d as v}from"../../chunk-RS4HZYP3.js";import{a as M}from"../../chunk-S6KFKBMY.js";import{b as m}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{d as S,j as y}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{isMigrated as x,list as B,migrate as R}from"@tigrisdata/storage";var u=y("buckets","migrate"),N=10*1024*1024*1024,b=50,z=5e3,D=50,k=3,_=class{constructor(r,i,s,c){this.bucket=r;this.source=i;this.prefix=s;this.config=c}bucket;source;prefix;config;buffer=[];index=0;token;_done=!1;get done(){return this._done&&this.index>=this.buffer.length}async current(){return this.index<this.buffer.length?this.buffer[this.index]:this._done?null:(await this.fetchPage(),this.index<this.buffer.length?this.buffer[this.index]:null)}advance(){this.index++}async fetchPage(){if(this._done)return;let{data:r,error:i}=await B({prefix:this.prefix,source:this.source,...this.token?{paginationToken:this.token}:{},config:{...this.config,bucket:this.bucket}});if(i)throw i;this.buffer=r.items??[],this.index=0,this.token=r.paginationToken,!r.paginationToken&&!r.hasMore&&(this._done=!0)}};async function C(t,r,i){let s=new _(t,"shadow",r,i),c=new _(t,"tigris",r,i),o=[],n=await s.current(),a=await c.current();for(;n!==null;){if(a===null){o.push({name:n.name,size:n.size}),s.advance(),n=await s.current();continue}n.name<a.name?(o.push({name:n.name,size:n.size}),s.advance(),n=await s.current()):n.name>a.name?(c.advance(),a=await c.current()):(s.advance(),c.advance(),n=await s.current(),a=await c.current())}return o}function L(t){return new Promise(r=>setTimeout(r,t))}function E(t){let r=Math.floor(t/1e3),i=Math.floor(r/60),s=r%60;return i===0?`${s}s`:`${i}m ${s}s`}function p(t,r){if(!process.stderr.isTTY||globalThis.__TIGRIS_JSON_MODE)return;let i=E(Date.now()-t.startTime),s=`\rMigrating ${r}: ${t.confirmed.toLocaleString()} / ${t.total.toLocaleString()} objects | In-flight: ${h(t.inFlightBytes)} | ${i}`;process.stderr.write(s+" ".repeat(Math.max(0,100-s.length)))}function T(){!process.stderr.isTTY||globalThis.__TIGRIS_JSON_MODE||process.stderr.write("\r"+" ".repeat(100)+"\r")}async function $(t,r,i,s){let c=await w(t.map(o=>()=>R(o.name,{config:{...i,bucket:s}})),b);for(let o=0;o<c.length;o++){let n=c[o],a=t[o];n.error?(r.failed++,r.errors.push({name:a.name,error:n.error.message})):(r.inFlight.push({...a,checkFailures:0}),r.inFlightBytes+=a.size,r.scheduled++)}}async function O(t,r,i){if(t.inFlight.length===0)return;let s=t.inFlight.slice(0,b),c=await w(s.map(n=>()=>x(n.name,{config:{...r,bucket:i}})),b),o=new Set;for(let n=0;n<c.length;n++){let a=c[n],l=s[n];a.error?(l.checkFailures++,l.checkFailures>=k&&(o.add(l.name),t.failed++,t.inFlightBytes-=l.size,t.errors.push({name:l.name,error:`Failed to verify migration status after ${k} attempts`}))):a.data&&(o.add(l.name),t.confirmed++,t.confirmedBytes+=l.size,t.inFlightBytes-=l.size)}o.size>0&&(t.inFlight=t.inFlight.filter(n=>!o.has(n.name))),o.size===0&&await L(z)}async function P(t){let r=M(t,["path"]);r||m(u,"Bucket name or path is required");let{bucket:i,path:s}=F(r);i||m(u,"Invalid path");let c=await v(),o=!1,n=()=>{o=!0};process.on("SIGINT",n);try{process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&process.stderr.write("Discovering objects to migrate...");let a;try{a=await C(i,s,c)}catch(f){T(),m(u,f)}if(T(),a.length===0){process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&console.error("All objects are already migrated."),globalThis.__TIGRIS_JSON_MODE&&console.log(JSON.stringify({action:"migrate",bucket:i,toMigrate:0,confirmed:0,failed:0}));return}let l=a.reduce((f,d)=>f+d.size,0);process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&console.error(`Found ${a.length.toLocaleString()} objects to migrate (${h(l)})`);let e={total:a.length,totalBytes:l,scheduled:0,confirmed:0,confirmedBytes:0,failed:0,inFlight:[],inFlightBytes:0,errors:[],startTime:Date.now()},g=[];for(let f of a){if(o)break;for(;e.inFlightBytes+f.size>N&&e.inFlight.length>0&&!o;)await O(e,c,i),p(e,i);if(o)break;g.push(f),g.length>=D&&(await $(g,e,c,i),g=[],p(e,i))}for(g.length>0&&!o&&(await $(g,e,c,i),p(e,i));e.inFlight.length>0&&!o;)await O(e,c,i),p(e,i);T();let I=E(Date.now()-e.startTime);if(globalThis.__TIGRIS_JSON_MODE&&console.log(JSON.stringify({action:"migrate",bucket:i,toMigrate:e.total,scheduled:e.scheduled,confirmed:e.confirmed,failed:e.failed,elapsed:I,...e.errors.length>0?{errors:e.errors.slice(0,20)}:{}})),o&&(console.error(`
|
|
2
2
|
Interrupted. ${e.confirmed} confirmed, ${e.inFlight.length} still in-flight, ${e.total-e.scheduled} not yet scheduled.`),process.exit(1)),e.failed>0){if(S(u,`${e.failed} object(s) failed to migrate. ${e.confirmed} migrated successfully in ${I}.`),process.stderr.isTTY&&!globalThis.__TIGRIS_JSON_MODE&&e.errors.length>0){let f=e.errors.slice(0,10);for(let d of f)console.error(` ${d.name}: ${d.error}`);e.errors.length>10&&console.error(` ... and ${e.errors.length-10} more`)}process.exit(1)}console.error(`
|
|
3
3
|
Migration complete: ${e.confirmed.toLocaleString()} object(s) migrated (${h(e.confirmedBytes)}) in ${I}`)}finally{process.removeListener("SIGINT",n)}}export{P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k,b}from"../../chunk-S77OAN6Y.js";import{d as l}from"../../chunk-RS4HZYP3.js";import{a as s,b as d}from"../../chunk-S6KFKBMY.js";import{b as n,c as g,d as p}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as m,j as u}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{rebaseFork as A}from"@tigrisdata/storage";var o=u("buckets","rebase");async function S(r){f(o);let h=d(r),t=s(r,["fork"]),x=s(r,["yes","y"]);t||n(o,"Fork bucket name is required");let w=await l();if(!x&&(k("Use --yes to skip confirmation"),!await b(`Rebase fork '${t}' onto the latest state of its source bucket? This updates '${t}'.`))){console.log("Aborted");return}let{data:y,error:i}=await A(t,{config:w});i&&n(o,i);let c=y?.snapshotVersion??"";if(h==="json"){let e=g(o,{fork:t}),a={action:"rebased",fork:t,snapshotVersion:c};e.length>0&&(a.nextActions=e),console.log(JSON.stringify(a))}m(o,{fork:t,snapshotVersion:c}),p(o,{fork:t})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as x}from"../../chunk-
|
|
1
|
+
import{d as x}from"../../chunk-RS4HZYP3.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{e as b}from"../../chunk-
|
|
1
|
+
import{e as b}from"../../chunk-RS4HZYP3.js";import{a as r,b as x}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,j as h}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{setBucketCors as N}from"@tigrisdata/storage";var n=h("buckets","set-cors");async function k(e){c(n);let p=x(e),o=r(e,["name"]),s=r(e,["origins"]),d=r(e,["methods"]),a=r(e,["headers"]),f=r(e,["expose-headers","exposeHeaders"]),t=r(e,["max-age","maxAge"]),g=r(e,["override"]),m=r(e,["reset"]);o||i(n,"Bucket name is required"),m&&(s!==void 0||d!==void 0||a!==void 0||f!==void 0||t!==void 0||g)&&i(n,"Cannot use --reset with other options"),!m&&!s&&i(n,"Provide --origins or --reset"),t!==void 0&&(isNaN(Number(t))||Number(t)<=0)&&i(n,"--max-age must be a positive number");let w=await b(),{error:u}=await N(o,{rules:m?[]:[{allowedOrigins:s,...d!==void 0?{allowedMethods:d}:{},...a!==void 0?{allowedHeaders:a}:{},...f!==void 0?{exposeHeaders:f}:{},maxAge:t!==void 0?Number(t):3600}],override:g??!1,config:w});u&&i(n,u),p==="json"&&console.log(JSON.stringify({action:"updated",bucket:o})),l(n,{name:o})}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-RS4HZYP3.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{e as p}from"../../chunk-
|
|
1
|
+
import{e as p}from"../../chunk-RS4HZYP3.js";import{a as t,b as w}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b as h,c as f,j as y}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{setBucketMigration as S}from"@tigrisdata/storage";var n=y("buckets","set-migration");async function K(e){h(n);let d=w(e),i=t(e,["name"]),o=t(e,["bucket"]),a=t(e,["endpoint"]),s=t(e,["region"]),c=t(e,["access-key","accessKey"]),g=t(e,["secret-key","secretKey"]),u=t(e,["write-through","writeThrough"]),m=t(e,["disable"]);i||r(n,"Bucket name is required"),m&&(o!==void 0||a!==void 0||s!==void 0||c!==void 0||g!==void 0||u!==void 0)&&r(n,"Cannot use --disable with other migration options");let l=await p();if(m){let{error:k}=await S(i,{dataMigration:{enabled:!1},config:l});k&&r(n,k),d==="json"&&console.log(JSON.stringify({action:"updated",bucket:i})),f(n,{name:i});return}(!o||!a||!s||!c||!g)&&r(n,"Required: --bucket, --endpoint, --region, --access-key, --secret-key");let{error:b}=await S(i,{dataMigration:{enabled:!0,accessKey:c,secretKey:g,region:s,name:o,endpoint:a,writeThrough:u??!1},config:l});b&&r(n,b),d==="json"&&console.log(JSON.stringify({action:"updated",bucket:i})),f(n,{name:i})}export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as p}from"../../chunk-
|
|
1
|
+
import{e as p}from"../../chunk-RS4HZYP3.js";import{a as n,b as w}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-UBANDLB4.js";import"../../chunk-DV3LCXRH.js";import{b,c as h,j as k}from"../../chunk-7ZUCJBD5.js";import"../../chunk-PPNBQWSR.js";import"../../chunk-ATBINUDP.js";import"../../chunk-3EAZ2L6H.js";import"../../chunk-OHGCOC5Q.js";import{setBucketNotifications as N}from"@tigrisdata/storage";var t=k("buckets","set-notifications");async function y(e){b(t);let C=w(e),d=n(e,["name"]),s=n(e,["url"]),u=n(e,["filter"]),a=n(e,["token"]),o=n(e,["username"]),r=n(e,["password"]),l=n(e,["enable"]),g=n(e,["disable"]),c=n(e,["reset"]);d||i(t,"Bucket name is required"),[l,g,c].filter(Boolean).length>1&&i(t,"Only one of --enable, --disable, or --reset can be used"),c&&(s!==void 0||u!==void 0||a!==void 0||o!==void 0||r!==void 0)&&i(t,"Cannot use --reset with other options"),!l&&!g&&!c&&s===void 0&&u===void 0&&a===void 0&&o===void 0&&r===void 0&&i(t,"Provide at least one option"),a&&(o!==void 0||r!==void 0)&&i(t,"Cannot use --token with --username/--password. Choose one auth method"),(o!==void 0&&r===void 0||o===void 0&&r!==void 0)&&i(t,"Both --username and --password are required");let B=await p(),f;c?f={}:(f={...l?{enabled:!0}:{},...g?{enabled:!1}:{},...s!==void 0?{url:s}:{},...u!==void 0?{filter:u}:{}},a?f={...f,auth:{token:a}}:o&&r&&(f={...f,auth:{username:o,password:r}}));let{error:m}=await N(d,{notificationConfig:f,config:B});m&&i(t,m),C==="json"&&console.log(JSON.stringify({action:"updated",bucket:d})),h(t,{name:d})}export{y as default};
|
package/dist/lib/buckets/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as j}from"../../chunk-N3Y6RFSK.js";import"../../chunk-S77OAN6Y.js";import{e as k}from"../../chunk-
|
|
1
|
+
import{c as j}from"../../chunk-N3Y6RFSK.js";import"../../chunk-S77OAN6Y.js";import{e as k}from"../../chunk-RS4HZYP3.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};
|