@tigrisdata/cli 2.14.0-beta.1 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/s3-client.js +1 -1
- package/dist/chunk-2JHVFROL.js +2 -0
- package/dist/chunk-3B5GQHGD.js +8 -0
- package/dist/chunk-DV3LCXRH.js +1 -0
- package/dist/{chunk-UKNEQJZX.js → chunk-GHJJSJR6.js} +1 -1
- package/dist/chunk-IFEXFA2T.js +1 -0
- package/dist/chunk-LQ4BU234.js +4 -0
- package/dist/chunk-RJGUZ3B2.js +7 -0
- package/dist/chunk-SW6SNHOL.js +4 -0
- package/dist/cli-core.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/access-keys/assign.js +3 -2
- package/dist/lib/access-keys/create.js +3 -2
- package/dist/lib/access-keys/delete.js +3 -2
- package/dist/lib/access-keys/get.js +3 -2
- package/dist/lib/access-keys/list.js +3 -2
- package/dist/lib/buckets/create.js +1 -1
- package/dist/lib/buckets/delete.js +1 -1
- package/dist/lib/buckets/get.js +1 -1
- package/dist/lib/buckets/list.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-transition.js +1 -1
- package/dist/lib/buckets/set-ttl.js +1 -1
- package/dist/lib/buckets/set.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/forks/create.js +1 -1
- package/dist/lib/forks/list.js +1 -1
- package/dist/lib/iam/policies/create.js +3 -2
- package/dist/lib/iam/policies/delete.js +3 -2
- package/dist/lib/iam/policies/edit.js +3 -2
- package/dist/lib/iam/policies/get.js +3 -2
- package/dist/lib/iam/policies/list.js +3 -2
- package/dist/lib/iam/users/invite.js +4 -3
- package/dist/lib/iam/users/list.js +8 -7
- package/dist/lib/iam/users/remove.js +4 -3
- package/dist/lib/iam/users/revoke-invitation.js +4 -3
- package/dist/lib/iam/users/update-role.js +4 -3
- package/dist/lib/login/credentials.js +1 -1
- package/dist/lib/login/oauth.js +1 -1
- package/dist/lib/login/select.js +1 -1
- package/dist/lib/logout.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/list.js +1 -1
- package/dist/lib/objects/put.js +1 -1
- package/dist/lib/objects/set.js +1 -1
- package/dist/lib/organizations/create.js +3 -3
- package/dist/lib/organizations/list.js +2 -2
- package/dist/lib/organizations/select.js +4 -4
- 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/whoami.js +2 -2
- package/dist/specs.yaml +41 -0
- package/dist/utils/errors.js +1 -0
- package/dist/utils/exit.js +1 -0
- package/dist/utils/messages.js +1 -1
- package/dist/utils/update-check.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2F6KRYMD.js +0 -4
- package/dist/chunk-2HWTMFLS.js +0 -8
- package/dist/chunk-CQDWZKYG.js +0 -2
- package/dist/chunk-PUTZ24A6.js +0 -1
- package/dist/chunk-S7W2ICW6.js +0 -9
- /package/dist/{chunk-BQX7MWWL.js → chunk-SAPK5MRQ.js} +0 -0
package/dist/auth/s3-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-SAPK5MRQ.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";export{a as getLoginMethod,c as getS3Client,b as getStorageConfig,d as isAuthenticated};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as p}from"./chunk-BETAO4PB.js";var c={success:"\u2714",failure:"\u2716",hint:"\u2192"};function t(){return process.stdout.isTTY===!0}function i(){return globalThis.__TIGRIS_JSON_MODE===!0}function o(n){let s=p(n.command,n.operation);if(s)return s.messages}function r(n,s){let e=n;return e=e.replace(/\\n/g,`
|
|
2
|
+
`),s&&(e=e.replace(/\{\{(\w+)\}\}/g,(a,g)=>{let u=s[g];return u!==void 0?String(u):`{{${g}}}`})),e}function f(n,s){if(!t()||i())return;let e=o(n);e?.onStart&&console.log(r(e.onStart,s))}function d(n,s){if(!t()||i())return;let e=o(n);e?.onSuccess&&console.log(`${c.success} ${r(e.onSuccess,s)}`)}function m(n,s,e){if(globalThis.__TIGRIS_JSON_MODE===!0)return;let a=o(n);a?.onFailure&&console.error(`${c.failure} ${r(a.onFailure,e)}`),s&&console.error(` ${s}`)}function M(n,s){if(!t()||i())return;let e=o(n);e?.onEmpty&&console.log(r(e.onEmpty,s))}function x(n,s){if(!t()||i())return;let e=o(n);e?.onAlreadyDone&&console.log(r(e.onAlreadyDone,s))}function S(n,s){if(!t()||i())return;let e=o(n);e?.hint&&console.log(`${c.hint} ${r(e.hint,s)}`)}function b(n){t()&&console.warn(`\u26A0 Deprecated: ${n}`)}function C(n,s){return{command:n,operation:s}}export{r as a,f as b,d as c,m as d,M as e,x as f,S as g,b as h,C as i};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{d as m,e as d,f}from"./chunk-2XAO2OYD.js";import{readFileSync as I,writeFileSync as T,mkdirSync as N}from"fs";import{join as g}from"path";import{homedir as h}from"os";import j from"https";var u="2.14.0";var b=g(h(),".tigris","update-check.json");function y(){try{let t=I(b,"utf-8"),i=JSON.parse(t);return typeof i.latestVersion=="string"&&typeof i.lastChecked=="number"?i:null}catch{return null}}function v(t){try{N(g(h(),".tigris"),{recursive:!0}),T(b,JSON.stringify(t),"utf-8")}catch{}}function E(t,i){let a=o=>{let r=o.startsWith("v")?o.slice(1):o,c=null,l=r.indexOf("-");l!==-1&&(c=r.slice(l+1),r=r.slice(0,l));let p=r.split(".");if(p.length!==3)return null;let n=p.map(Number);return n.some(isNaN)?null:{major:n[0],minor:n[1],patch:n[2],prerelease:c}},e=a(t),s=a(i);return!e||!s?!1:s.major>e.major?!0:s.major<e.major?!1:s.minor>e.minor?!0:s.minor<e.minor?!1:s.patch>e.patch?!0:s.patch<e.patch?!1:e.prerelease&&!s.prerelease?!0:(!e.prerelease&&s.prerelease,!1)}function w(){try{let t=j.get(m,{timeout:5e3},i=>{let a="";i.on("data",e=>{a+=e}),i.on("end",()=>{try{let e=JSON.parse(a);if(typeof e.version=="string"){let s=y();v({...s,latestVersion:e.version,lastChecked:Date.now()})}}catch{}})});t.on("error",()=>{}),t.on("timeout",()=>{t.destroy()}),t.end(),t.on("socket",i=>{i.unref()})}catch{}}function V(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let t=y(),i=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||216e5;if(t&&E(u,t.latestVersion)&&(!t.lastNotified||Date.now()-t.lastNotified>i)){let e=globalThis.__TIGRIS_BINARY===!0,s=process.platform==="win32",o=`Update available: ${u} \u2192 ${t.latestVersion}`,r;e?s?r="Run `irm https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.ps1 | iex`":r="Run `curl -fsSL https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.sh | sh`":r="Run `npm install -g @tigrisdata/cli` to upgrade.";let c=Math.max(o.length,r.length)+4,l="\u250C"+"\u2500".repeat(c-2)+"\u2510",p="\u2514"+"\u2500".repeat(c-2)+"\u2518",n=_=>"\u2502 "+_.padEnd(c-4)+" \u2502";console.log(`
|
|
2
|
+
${l}
|
|
3
|
+
${n("")}
|
|
4
|
+
${n(o)}
|
|
5
|
+
${n(r)}
|
|
6
|
+
${n("")}
|
|
7
|
+
${p}
|
|
8
|
+
`),v({...t,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||864e5;(!t||Date.now()-t.lastChecked>a)&&w()}export{u as a,E as b,V as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=(n=>(n[n.Success=0]="Success",n[n.GeneralError=1]="GeneralError",n[n.AuthFailure=2]="AuthFailure",n[n.NotFound=3]="NotFound",n[n.RateLimit=4]="RateLimit",n[n.NetworkError=5]="NetworkError",n))(s||{}),r=[/not authenticated/i,/no organization selected/i,/token refresh failed/i,/please run "tigris login/i,/logged in via OAuth/i],c=[/access denied/i,/forbidden/i],a=[/NoSuchBucket/,/NoSuchKey/,/bucket not found/i,/object not found/i,/resource .+ does not exist/i,/the specified key does not exist/i],u=[/rate limit/i,/too many requests/i,/throttl/i,/SlowDown/],g=[/ECONNREFUSED/,/ENOTFOUND/,/ETIMEDOUT/,/ECONNRESET/,/socket hang up/i,/fetch failed/i];function i(t,e){return e.some(o=>o.test(t))}function d(){return[{command:"tigris login",description:"Authenticate via OAuth"},{command:"tigris configure",description:"Set up access key credentials"}]}function f(){return[{command:"tigris access-keys list",description:"Check your access key permissions"},{command:"tigris login",description:"Re-authenticate if needed"}]}function l(){return[{command:"tigris ls",description:"List available buckets"}]}function m(){return[]}function N(){return[{command:"tigris credentials test",description:"Test connectivity and credentials"}]}function x(t){return typeof t=="object"&&t!==null&&"message"in t&&typeof t.message=="string"}function A(t){return t instanceof Error||x(t)?t.message:typeof t=="string"?t:t==null?"Unknown error":String(t)}function p(t){let e=A(t);return i(e,r)?{exitCode:2,category:"auth",message:e,nextActions:d()}:i(e,c)?{exitCode:2,category:"permission",message:e,nextActions:f()}:i(e,a)?{exitCode:3,category:"not_found",message:e,nextActions:l()}:i(e,u)?{exitCode:4,category:"rate_limit",message:e,nextActions:m()}:i(e,g)?{exitCode:5,category:"network",message:e,nextActions:N()}:{exitCode:1,category:"general",message:e,nextActions:[]}}export{s as a,p as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,c as l}from"./chunk-
|
|
1
|
+
import{a as s,c as l}from"./chunk-3B5GQHGD.js";import{a as i,k as m}from"./chunk-RJGUZ3B2.js";import{b as t}from"./chunk-BETAO4PB.js";import{existsSync as c}from"fs";import{join as a,dirname as u}from"path";import{fileURLToPath as f}from"url";i();var j=f(import.meta.url),d=u(j),h=t(),y=o=>{if(o.length===0)return!1;let e=a(d,"lib",...o)+".js";if(c(e))return!0;let r=a(d,"lib",...o,"index.js");return!!c(r)},b=async o=>{let e=[`./lib/${o.join("/")}.js`,`./lib/${o.join("/")}/index.js`];for(let p of e){let n=await import(p).catch(()=>null);if(n)return{module:n,error:null}}return{module:null,error:`Command not found: ${o.join(" ")}`}},x=m({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S}from"./chunk-S77OAN6Y.js";import{a as y,c as m}from"./chunk-LQ4BU234.js";import{b as i,c as n,d,i as o}from"./chunk-2JHVFROL.js";import{m as f,o as p,r as g}from"./chunk-DOUR5YEY.js";import{a as u}from"./chunk-2XAO2OYD.js";import K from"enquirer";var{prompt:A}=K,r=o("login","credentials");async function k(e){i(r);let s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,c=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(!s||!c){let t=[];s||t.push({type:"input",name:"accessKey",message:"Access Key ID:",required:!0}),c||t.push({type:"password",name:"accessSecret",message:"Secret Access Key:",required:!0}),S("Provide --access-key and --access-secret");let a=await A(t);s=s||a.accessKey,c=c||a.accessSecret}(!s||!c)&&(d(r,"Access key and secret are required"),y("Access key and secret are required",r));let l=f()?.endpoint||u;await p({accessKeyId:s,secretAccessKey:c,endpoint:l}),await g("credentials"),n(r),m(r)}export{k as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{b as i}from"./chunk-DV3LCXRH.js";import{a as n}from"./chunk-2JHVFROL.js";import{c as r}from"./chunk-BETAO4PB.js";function c(){return globalThis.__TIGRIS_JSON_MODE===!0}function a(){return process.stderr.isTTY===!0}function m(){return process.stdout.isTTY===!0}function u(t,s){let e=i(t);if(c()){let o={error:{message:e.message,code:e.exitCode,category:e.category}};e.nextActions.length>0&&(o.nextActions=e.nextActions),console.error(JSON.stringify(o))}else if(s||console.error(`
|
|
2
|
+
Error: ${e.message}`),a()&&e.nextActions.length>0){console.error(`
|
|
3
|
+
Next steps:`);for(let o of e.nextActions)console.error(` \u2192 ${o.command} ${o.description}`)}process.exit(e.exitCode)}function p(t,s){let e=r(t.command,t.operation);return e?.messages?.nextActions?e.messages.nextActions.map(o=>({command:n(o.command,s),description:n(o.description,s)})):[]}function l(t,s){if(!m()||c())return;let e=p(t,s);if(e.length!==0){console.log(`
|
|
4
|
+
Next steps:`);for(let o of e)console.log(` \u2192 ${o.command} ${o.description}`)}}export{u as a,p as b,l as c};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as C}from"./chunk-LQ4BU234.js";import{h as g}from"./chunk-2JHVFROL.js";import{Command as S}from"commander";function D(){process.on("unhandledRejection",e=>{(e===""||e===void 0)&&(console.error(`
|
|
2
|
+
Operation cancelled`),process.exit(1)),C(e)}),process.on("uncaughtException",e=>{C(e)})}function I(e){return/^[a-zA-Z0-9_-]+$/.test(e)}function b(e){let t;e.type==="positional"?t=` ${e.name}`:(t=` --${e.name}`,e.alias&&typeof e.alias=="string"&&(t+=e.alias.length===1?`, -${e.alias}`:`, --${e.alias}`));let n=26,a=t.length>=n?t+" ":t.padEnd(n),o=e.description;return e.options&&(Array.isArray(e.options)&&typeof e.options[0]=="string"?o+=` (options: ${e.options.join(", ")})`:o+=` (options: ${e.options.map(r=>r.value).join(", ")})`),e.default&&(o+=` [default: ${e.default}]`),e.required&&(o+=" [required]"),e["required-when"]&&(o+=` [required when: ${e["required-when"]}]`),e.multiple&&(o+=" [multiple values: comma-separated]"),e.type==="positional"&&(o+=" [positional argument]"),e.examples&&e.examples.length>0&&(o+=` (examples: ${e.examples.join(", ")})`),`${a}${o}`}function f(e,t,n){return n(t)?!0:e.commands?e.commands.some(a=>f(a,[...t,a.name],n)):!1}function w(e,t,n,a){let o=n.join(" ");if(console.log(`
|
|
3
|
+
${e.name} ${o} - ${t.description}
|
|
4
|
+
`),t.commands&&t.commands.length>0){let r=t.commands.filter(s=>f(s,[...n,s.name],a));r.length>0&&(console.log("Commands:"),r.forEach(s=>{let i=` ${s.name}`;if(s.alias){let l=Array.isArray(s.alias)?s.alias:[s.alias];i+=` (${l.join(", ")})`}let p=i.padEnd(24);console.log(`${p}${s.description}`)}),console.log())}t.arguments&&t.arguments.length>0&&(console.log("Arguments:"),t.arguments.forEach(r=>{console.log(b(r))}),console.log()),t.examples&&t.examples.length>0&&(console.log("Examples:"),t.examples.forEach(r=>{console.log(` ${r}`)}),console.log()),t.commands&&t.commands.length>0&&console.log(`Use "${e.name} ${o} <command> help" for more information about a command.`)}function x(e,t,n){console.log(`Tigris CLI Version: ${t}
|
|
5
|
+
`),console.log(`Usage: tigris [command] [options]
|
|
6
|
+
`),console.log("Commands:"),e.commands.filter(o=>f(o,[o.name],n)).forEach(o=>{let r=` ${o.name}`;if(o.alias){let i=Array.isArray(o.alias)?o.alias:[o.alias];r+=` (${i.join(", ")})`}let s=r.padEnd(24);console.log(`${s}${o.description}`)}),console.log(`
|
|
7
|
+
Use "${e.name} <command> help" for more information about a command.`)}function $(e,t=[]){t.forEach(n=>{if(n.type==="positional"){let a=n.required?`<${n.name}>`:`[${n.name}]`;e.argument(a,n.description)}else{let a=n.alias&&typeof n.alias=="string"&&n.alias.length===1,o=n.alias&&typeof n.alias=="string"&&n.alias.length>1,r=a?`-${n.alias}, --${n.name}`:o?`--${n.alias}, --${n.name}`:`--${n.name}`;n.type==="flag"||(n.type==="boolean"?r+=" [value]":n.options?r+=" <value>":r+=n.required||n["required-when"]?" <value>":" [value]"),e.option(r,n.description,n.default)}})}function q(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function y(e,t,n){if(n){let o=n.find(r=>r.name===t);if(o&&o.alias&&typeof o.alias=="string"){let r=o.alias.charAt(0).toUpperCase()+o.alias.slice(1);if(e[r]!==void 0)return e[r]}}let a=[t,t.replace(/-/g,""),t.replace(/-/g,"").toLowerCase(),t.charAt(0).toUpperCase(),q(t)];for(let o of a)if(e[o]!==void 0)return e[o]}function E(e,t){for(let n of e){if(n["required-when"]){let[a,o]=n["required-when"].split("="),r=y(t,a,e),s=y(t,n.name,e);if(r===o&&!s)return console.error(`--${n.name} is required when --${a} is ${o}`),!1}if(n.required&&!y(t,n.name,e))return console.error(`--${n.name} is required`),!1}return!0}function u(e,t,n){let a;"optsWithGlobals"in n&&typeof n.optsWithGlobals=="function"?a=n.optsWithGlobals():"opts"in n&&typeof n.opts=="function"?a=n.opts():a=n;let o={...a};return e.filter(s=>s.type==="positional").forEach((s,i)=>{t[i]!==void 0&&(s.multiple?o[s.name]=t[i].split(",").map(p=>p.trim()):o[s.name]=t[i])}),e.forEach(s=>{s.multiple&&s.type!=="positional"&&o[s.name]&&typeof o[s.name]=="string"&&(o[s.name]=o[s.name].split(",").map(i=>i.trim()))}),o}async function k(e,t,n=[],a={}){(a.json||a.format==="json")&&(globalThis.__TIGRIS_JSON_MODE=!0);let{module:o,error:r}=await e(t);(r||!o)&&(console.error(r),process.exit(1));let s=t[t.length-1],i=o.default||o[s];typeof i!="function"&&(console.error(`Command not implemented: ${t.join(" ")}`),process.exit(1)),await i({...a,_positional:n})}function v(e,t,n,a=[]){let{specs:o,loadModule:r,hasImplementation:s}=e;for(let i of n){I(i.name)||(console.error(`Invalid command name "${i.name}": only alphanumeric, hyphens, and underscores allowed`),process.exit(1));let p=[...a,i.name];if(!f(i,p,s))continue;let l=t.command(i.name).description(i.description);if(i.alias&&(Array.isArray(i.alias)?i.alias:[i.alias]).forEach(c=>l.alias(c)),i.commands&&i.commands.length>0)if(v(e,l,i.commands,p),i.default){let m=i.commands.find(c=>c.name===i.default);if(m){$(l,i.arguments),$(l,m.arguments);let c=[...i.arguments||[],...m.arguments||[]];l.action(async(...d)=>{let A=d.pop(),h=d;c.length>0&&!E(c,u(c,h,A))||(m.deprecated&&m.messages?.onDeprecated&&g(m.messages.onDeprecated),await k(r,[...p,m.name],h,u(c,h,A)))})}}else l.action(()=>{w(o,i,p,s)});else $(l,i.arguments),l.action(async(...m)=>{let c=m.pop(),d=m;i.arguments&&!E(i.arguments,u(i.arguments,d,c))||(i.deprecated&&i.messages?.onDeprecated&&g(i.messages.onDeprecated),await k(r,p,d,u(i.arguments||[],d,c)))});l.command("help").description("Show help for this command").action(()=>{w(o,i,p,s)})}}function P(e){let{specs:t,version:n,hasImplementation:a}=e,o=new S;return o.name(t.name).description(t.description).version(n),o.option("-y, --yes","Skip all confirmation prompts"),v(e,o,t.commands),o.command("help").description("Show general help").action(()=>{x(t,n,a)}),o.command("version").description("Show the CLI version").action(()=>{console.log(n)}),o.action(()=>{x(t,n,a)}),o}export{D as a,I as b,b as c,f as d,w as e,x as f,$ as g,E as h,u as i,v as j,P as k};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as u,c as r}from"./chunk-LQ4BU234.js";import{b as a,c as e,d as s,f as c,g,i as l}from"./chunk-2JHVFROL.js";import{b as f}from"./chunk-E4MLGABW.js";import{f as p}from"./chunk-DOUR5YEY.js";var t=l("login","oauth");async function m(){a(t);try{let o=f();if(await o.isAuthenticated()){c(t);return}await o.login({onDeviceCode:(i,h)=>{console.log(`
|
|
2
|
+
Your confirmation code: ${i}
|
|
3
|
+
`),console.log(`If browser doesn't open, visit: ${h}`)},onWaiting:()=>console.log(`
|
|
4
|
+
Waiting for authentication...`)});let n=await o.getOrganizations();if(n.length>0){let i=n[0];await p(i.id),e(t,{org:i.displayName||i.name}),r(t),n.length>1&&g(t,{count:n.length})}else e(t,{org:"none"}),r(t)}catch(o){s(t),u(o,t)}}var v=m;export{m as a,v as b};
|
package/dist/cli-core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-RJGUZ3B2.js";import"./chunk-LQ4BU234.js";import"./chunk-DV3LCXRH.js";import"./chunk-2JHVFROL.js";import"./chunk-BETAO4PB.js";export{g as addArgumentsToCommand,d as commandHasAnyImplementation,k as createProgram,i as extractArgumentValues,c as formatArgumentHelp,b as isValidCommandName,j as registerCommands,a as setupErrorHandlers,e as showCommandHelp,f as showMainHelp,h as validateRequiredWhen};
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-GHJJSJR6.js";import"./chunk-3B5GQHGD.js";import"./chunk-RJGUZ3B2.js";import"./chunk-LQ4BU234.js";import"./chunk-DV3LCXRH.js";import"./chunk-2JHVFROL.js";import"./chunk-BETAO4PB.js";import"./chunk-2XAO2OYD.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-GHJJSJR6.js";import"./chunk-3B5GQHGD.js";import"./chunk-RJGUZ3B2.js";import"./chunk-LQ4BU234.js";import"./chunk-DV3LCXRH.js";import"./chunk-2JHVFROL.js";import"./chunk-BETAO4PB.js";import"./chunk-2XAO2OYD.js";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
Run "tigris login oauth" first.`),
|
|
1
|
+
import{a as s}from"../../chunk-JRALYIRA.js";import{a as T}from"../../chunk-SAPK5MRQ.js";import{a as i,b as y,c as v}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as R,c as d,d as n,i as p}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import{b as O}from"../../chunk-E4MLGABW.js";import{g as w}from"../../chunk-DOUR5YEY.js";import{c as N}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{assignBucketRoles as C,revokeAllBucketRoles as S}from"@tigrisdata/iam";var e=p("access-keys","assign"),m=["Editor","ReadOnly","NamespaceAdmin"];function j(t){return t?Array.isArray(t)?t:[t]:[]}async function E(t){R(e);let f=s(t,["json"])?"json":s(t,["format","f","F"],"table"),l=s(t,["id"]),h=s(t,["admin"]),k=s(t,["revokeRoles","revoke-roles"]),a=j(s(t,["bucket","b"])),r=j(s(t,["role","r"]));l||(n(e,"Access key ID is required"),i("Access key ID is required",e)),h&&k&&(n(e,"Cannot use --admin and --revoke-roles together"),i("Cannot use --admin and --revoke-roles together",e)),await T()!=="oauth"&&(n(e,`Bucket roles can only be managed when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),i(`Bucket roles can only be managed when logged in via OAuth.
|
|
3
|
+
Run "tigris login oauth" first.`,e));let A=O();await A.isAuthenticated()||(n(e,'Not authenticated. Run "tigris login oauth" first.'),i('Not authenticated. Run "tigris login oauth" first.',e));let $=await A.getAccessToken(),x=w(),q=N(),b={sessionToken:$,organizationId:x??void 0,iamEndpoint:q.iamEndpoint};if(k){let{error:o}=await S(l,{config:b});o&&(n(e,o.message),i(o,e)),f==="json"&&console.log(JSON.stringify({action:"revoked",id:l})),d(e);return}let c;if(h)c=[{bucket:"*",role:"NamespaceAdmin"}];else{a.length===0&&(n(e,"At least one bucket name is required (or use --admin or --revoke-roles)"),i("At least one bucket name is required (or use --admin or --revoke-roles)",e)),r.length===0&&(n(e,"At least one role is required (or use --admin or --revoke-roles)"),i("At least one role is required (or use --admin or --revoke-roles)",e));for(let o of r)m.includes(o)||(n(e,`Invalid role "${o}". Valid roles are: ${m.join(", ")}`),i(`Invalid role "${o}". Valid roles are: ${m.join(", ")}`,e));r.length===1?c=a.map(o=>({bucket:o,role:r[0]})):r.length===a.length?c=a.map((o,g)=>({bucket:o,role:r[g]})):(n(e,`Number of roles (${r.length}) must be 1 or match number of buckets (${a.length})`),i(`Number of roles (${r.length}) must be 1 or match number of buckets (${a.length})`,e))}let{error:u}=await C(l,c,{config:b});if(u&&(n(e,u.message),i(u,e)),f==="json"){let o=y(e),g={action:"assigned",id:l,assignments:c};o.length>0&&(g.nextActions=o),console.log(JSON.stringify(g))}d(e),v(e)}export{E as default};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
Run "tigris login oauth" first.`),
|
|
1
|
+
import{a as i}from"../../chunk-JRALYIRA.js";import{a as k}from"../../chunk-SAPK5MRQ.js";import{a as o,b as f,c as h}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as d,c as m,d as n,i as u}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import{b as y}from"../../chunk-E4MLGABW.js";import{g as p}from"../../chunk-DOUR5YEY.js";import{c as A}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createAccessKey as O}from"@tigrisdata/iam";var e=u("access-keys","create");async function R(s){d(e);let w=i(s,["json"])?"json":i(s,["format","f","F"],"table"),r=i(s,["name"]);r||(n(e,"Access key name is required"),o("Access key name is required",e)),await k()!=="oauth"&&(n(e,`Access keys can only be created when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),o(`Access keys can only be created when logged in via OAuth.
|
|
3
|
+
Run "tigris login oauth" first.`,e));let a=y();await a.isAuthenticated()||(n(e,'Not authenticated. Run "tigris login oauth" first.'),o('Not authenticated. Run "tigris login oauth" first.',e));let x=await a.getAccessToken(),S=p(),N=A(),{data:t,error:c}=await O(r,{config:{sessionToken:x,organizationId:S??void 0,iamEndpoint:N.iamEndpoint}});if(c&&(n(e,c.message),o(c,e)),w==="json"){let g=f(e,{name:t.name,id:t.id}),l={action:"created",name:t.name,id:t.id,secret:t.secret};g.length>0&&(l.nextActions=g),console.log(JSON.stringify(l))}else console.log(` Name: ${t.name}`),console.log(` Access Key ID: ${t.id}`),console.log(` Secret Access Key: ${t.secret}`),console.log(""),console.log(" Save these credentials securely. The secret will not be shown again.");m(e),h(e,{name:t.name,id:t.id})}export{R as default};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
Run "tigris login oauth" first.`),
|
|
1
|
+
import{a as u,b as h}from"../../chunk-S77OAN6Y.js";import{a as o}from"../../chunk-JRALYIRA.js";import{a as p}from"../../chunk-SAPK5MRQ.js";import{a as i}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as g,d as e,i as f}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import{b as l}from"../../chunk-E4MLGABW.js";import{g as m}from"../../chunk-DOUR5YEY.js";import{c as d}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeAccessKey as O}from"@tigrisdata/iam";var t=f("access-keys","delete");async function j(n){a(t);let y=o(n,["json"])?"json":o(n,["format","f","F"],"table"),s=o(n,["id"]),A=o(n,["force","yes","y"]);s||(e(t,"Access key ID is required"),i("Access key ID is required",t)),await p()!=="oauth"&&(e(t,`Access keys can only be deleted when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),i(`Access keys can only be deleted when logged in via OAuth.
|
|
3
|
+
Run "tigris login oauth" first.`,t));let c=l();if(await c.isAuthenticated()||(e(t,'Not authenticated. Run "tigris login oauth" first.'),i('Not authenticated. Run "tigris login oauth" first.',t)),!A&&(u("Use --yes to skip confirmation"),!await h(`Delete access key '${s}'?`))){console.log("Aborted");return}let k=await c.getAccessToken(),w=m(),b=d(),{error:r}=await O(s,{config:{sessionToken:k,organizationId:w??void 0,iamEndpoint:b.iamEndpoint}});r&&(e(t,r.message),i(r,t)),y==="json"&&console.log(JSON.stringify({action:"deleted",id:s})),g(t)}export{j as default};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{a as n}from"../../chunk-JRALYIRA.js";import{a as p}from"../../chunk-
|
|
2
|
-
Run "tigris login oauth" first.`),
|
|
1
|
+
import{a as n}from"../../chunk-JRALYIRA.js";import{a as p}from"../../chunk-SAPK5MRQ.js";import{a as i}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as d,d as e,i as f}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import{b as h}from"../../chunk-E4MLGABW.js";import{g as m}from"../../chunk-DOUR5YEY.js";import{c as u}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getAccessKey as O}from"@tigrisdata/iam";var o=f("access-keys","get");async function R(s){l(o);let A=n(s,["json"])?"json":n(s,["format","f","F"],"table"),c=n(s,["id"]);c||(e(o,"Access key ID is required"),i("Access key ID is required",o)),await p()!=="oauth"&&(e(o,`Access keys can only be retrieved when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),i(`Access keys can only be retrieved when logged in via OAuth.
|
|
3
|
+
Run "tigris login oauth" first.`,o));let a=h();await a.isAuthenticated()||(e(o,'Not authenticated. Run "tigris login oauth" first.'),i('Not authenticated. Run "tigris login oauth" first.',o));let k=await a.getAccessToken(),y=m(),w=u(),{data:t,error:r}=await O(c,{config:{sessionToken:k,organizationId:y??void 0,iamEndpoint:w.iamEndpoint}});if(r&&(e(o,r.message),i(r,o)),A==="json")console.log(JSON.stringify(t));else if(console.log(` Name: ${t.name}`),console.log(` ID: ${t.id}`),console.log(` Status: ${t.status}`),console.log(` Created: ${t.createdAt}`),console.log(` Organization: ${t.organizationId}`),t.roles&&t.roles.length>0){console.log(" Roles:");for(let g of t.roles)console.log(` - ${g.bucket}: ${g.role}`)}else console.log(" Roles: None");d(o)}export{R as default};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{f as
|
|
2
|
-
Run "tigris login oauth" first.`),
|
|
1
|
+
import{f as k}from"../../chunk-CQCBYE3X.js";import{a}from"../../chunk-JRALYIRA.js";import{a as y}from"../../chunk-SAPK5MRQ.js";import{a as n}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as d,d as i,e as m,i as f}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import{b as p}from"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import{c as l}from"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listAccessKeys as b}from"@tigrisdata/iam";var t=f("access-keys","list");async function j(r){u(t);let A=a(r,["json"])?"json":a(r,["format","f","F"],"table");await y()!=="oauth"&&(i(t,`Access keys can only be listed when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),n(`Access keys can only be listed when logged in via OAuth.
|
|
3
|
+
Run "tigris login oauth" first.`,t));let c=p();await c.isAuthenticated()||(i(t,'Not authenticated. Run "tigris login oauth" first.'),n('Not authenticated. Run "tigris login oauth" first.',t));let w=await c.getAccessToken(),O=h(),C=l(),{data:o,error:s}=await b({config:{sessionToken:w,organizationId:O??void 0,iamEndpoint:C.iamEndpoint}});if(s&&(i(t,s.message),n(s,t)),!o.accessKeys||o.accessKeys.length===0){m(t);return}let g=o.accessKeys.map(e=>({name:e.name,id:e.id,status:e.status,created:e.createdAt})),R=k(g,A,"keys","key",[{key:"name",header:"Name"},{key:"id",header:"ID"},{key:"status",header:"Status"},{key:"created",header:"Created"}]);console.log(R),d(t,{count:g.length})}export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as N,b as R}from"../../chunk-TD2HGNDY.js";import{a as j}from"../../chunk-S77OAN6Y.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as D}from"../../chunk-SAPK5MRQ.js";import{a as u,b as T,c as L}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as B,c as C,d as i,i as q}from"../../chunk-2JHVFROL.js";import{d as b,e as h}from"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import I from"enquirer";import{createBucket as W}from"@tigrisdata/storage";var{prompt:F}=I,s=q("buckets","create");async function J(t){B(s);let O=e(t,["json"])?"json":e(t,["format","f","F"],"table"),n=e(t,["name"]),k=e(t,["public"])?"public":e(t,["access","a","A"]),S=e(t,["enable-snapshots","s","S"]),w=e(t,["default-tier","t","T"]),f=e(t,["locations","l","L"]),o=e(t,["fork-of","forkOf","fork"]),d=e(t,["source-snapshot","sourceSnapshot","source-snap"]),y=e(t,["region","r","R"]),P=e(t,["consistency","c","C"]);y!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),f===void 0&&(f=y)),P!==void 0&&console.warn("Warning: --consistency is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/");let E=!n,v;if(E){j("Provide --name to skip interactive mode");let r=b("buckets","access","create"),c=h(r),p=c?.findIndex(a=>a.value===r?.default),x=b("buckets","default-tier","create"),A=h(x),g=A?.findIndex(a=>a.value===x?.default),l=await F([{type:"input",name:"name",message:"Bucket name:",required:!0},{type:"select",name:"access",message:"Access level:",choices:c||[],initial:p!==void 0&&p>=0?p:0},{type:"select",name:"defaultTier",message:"Default storage tier:",choices:A||[],initial:g!==void 0&&g>=0?g:0},{type:"confirm",name:"enableSnapshots",message:"Enable snapshots?",initial:!0}]);n=l.name,k=l.access,w=l.defaultTier,S=l.enableSnapshots;try{v=await N()}catch(a){i(s,a.message),u(a,s)}}n||(i(s,"Bucket name is required"),u("Bucket name is required",s)),d&&!o&&(i(s,"--source-snapshot requires --fork-of"),u("--source-snapshot requires --fork-of",s));let{error:m}=await W(n,{defaultTier:w??"STANDARD",enableSnapshot:S===!0,access:k??"private",locations:v??R(f??"global"),...o?{sourceBucketName:o}:{},...d?{sourceBucketSnapshot:d}:{},config:await D()});if(m&&(i(s,m.message),u(m,s)),O==="json"){let r=T(s,{name:n}),c={action:"created",name:n,...o?{forkOf:o}:{}};r.length>0&&(c.nextActions=r),console.log(JSON.stringify(c))}C(s,{name:n}),L(s,{name:n})}export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as k,b}from"../../chunk-S77OAN6Y.js";import{a as o}from"../../chunk-JRALYIRA.js";import{b as x}from"../../chunk-SAPK5MRQ.js";import{a,b as d,c as p}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as g,c as u,d as c,i as l}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{removeBucket as j}from"@tigrisdata/storage";var t=l("buckets","delete");async function w(n){g(t);let y=o(n,["json"])?"json":o(n,["format","f","F"],"table"),s=o(n,["name"]),A=o(n,["force","yes","y"]);s||(c(t,"Bucket name is required"),a("Bucket name is required",t));let m=Array.isArray(s)?s:[s],h=await x();if(!A&&(k("Use --yes to skip confirmation"),!await b(`Delete ${m.length} bucket(s)?`))){console.log("Aborted");return}let f=[],i=[];for(let e of m){let{error:r}=await j(e,{config:h});r?(c(t,r.message,{name:e}),i.push({name:e,error:r.message})):(f.push(e),u(t,{name:e}))}if(y==="json"){let e=d(t),r={action:"deleted",names:f,errors:i};e.length>0&&(r.nextActions=e),console.log(JSON.stringify(r))}i.length>0&&a(i[0].error,t),p(t)}export{w as default};
|
package/dist/lib/buckets/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"../../chunk-WIOXQDND.js";import{f as
|
|
1
|
+
import{a as f}from"../../chunk-WIOXQDND.js";import{f as u}from"../../chunk-CQCBYE3X.js";import{a as r}from"../../chunk-JRALYIRA.js";import{b as c}from"../../chunk-SAPK5MRQ.js";import{a as i}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as m,c as p,d as a,i as s}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{getBucketInfo as j}from"@tigrisdata/storage";var t=s("buckets","get");async function B(o){m(t);let e=r(o,["name"]),g=r(o,["json"])?"json":r(o,["format","f","F"])||"table";e||(a(t,"Bucket name is required"),i("Bucket name is required",t));let{data:l,error:n}=await j(e,{config:await c()});n&&(a(t,n.message),i(n,t));let k=[{property:"Name",value:e},...f(l).map(({label:y,value:b})=>({property:y,value:b}))],d=u(k,g,"bucket","property",[{key:"property",header:"Property"},{key:"value",header:"Value"}]);console.log(d),p(t)}export{B as default};
|
package/dist/lib/buckets/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as p}from"../../chunk-CQCBYE3X.js";import{a as u}from"../../chunk-JRALYIRA.js";import{b as j}from"../../chunk-SAPK5MRQ.js";import{a as f}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as y,c as l,d as e,e as i,i as w}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as C,getBucketInfo as E}from"@tigrisdata/storage";var t=w("buckets","list");async function D(m){y(t);try{let h=u(m,["json"])?"json":u(m,["format","f","F"],"table"),o=u(m,["forks-of","forksOf"]),k=await j(),{data:n,error:g}=await C({config:k});if(g&&(e(t,g.message),f(g,t)),!n.buckets||n.buckets.length===0){i(t);return}if(o){let{data:a,error:d}=await E(o,{config:k});if(d&&(e(t,d.message),f(d,t)),!a.hasForks){i(t);return}let s=[];for(let c of n.buckets){if(c.name===o)continue;let{data:B}=await E(c.name,{config:k});B?.sourceBucketName===o&&s.push({name:c.name,created:c.creationDate})}if(s.length===0){i(t);return}let x=p(s,h,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(x),l(t,{count:s.length});return}let b=n.buckets.map(a=>({name:a.name,created:a.creationDate})),O=p(b,h,"buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(O),l(t,{count:b.length})}catch(r){r instanceof Error?e(t,r.message):e(t,"An unknown error occurred"),f(r,t)}}export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as r}from"../../chunk-JRALYIRA.js";import{b as v}from"../../chunk-SAPK5MRQ.js";import{a as o}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as h,c as p,d as i,i as b}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as w}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketCors as k}from"@tigrisdata/storage";var e=b("buckets","set-cors");async function N(n){h(e);let s=r(n,["name"]),a=r(n,["origins"]),d=r(n,["methods"]),m=r(n,["headers"]),g=r(n,["expose-headers","exposeHeaders"]),t=r(n,["max-age","maxAge"]),c=r(n,["override"]),u=r(n,["reset"]);s||(i(e,"Bucket name is required"),o("Bucket name is required",e)),u&&(a!==void 0||d!==void 0||m!==void 0||g!==void 0||t!==void 0||c)&&(i(e,"Cannot use --reset with other options"),o("Cannot use --reset with other options",e)),!u&&!a&&(i(e,"Provide --origins or --reset"),o("Provide --origins or --reset",e)),t!==void 0&&(isNaN(Number(t))||Number(t)<=0)&&(i(e,"--max-age must be a positive number"),o("--max-age must be a positive number",e));let l=await v(),x=w(),C={...l,...x&&!l.organizationId?{organizationId:x}:{}},{error:f}=await k(s,{rules:u?[]:[{allowedOrigins:a,...d!==void 0?{allowedMethods:d}:{},...m!==void 0?{allowedHeaders:m}:{},...g!==void 0?{exposeHeaders:g}:{},maxAge:t!==void 0?Number(t):3600}],override:c??!1,config:C});f&&(i(e,f.message),o(f,e)),p(e,{name:s})}export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as B,b as w}from"../../chunk-TD2HGNDY.js";import{a as k}from"../../chunk-S77OAN6Y.js";import{a}from"../../chunk-JRALYIRA.js";import{b as L}from"../../chunk-SAPK5MRQ.js";import{a as r}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as u,d as o,i as d}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as l}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{updateBucket as q}from"@tigrisdata/storage";var t=d("buckets","set-locations");async function x(s){p(t);let i=a(s,["name"]),c=a(s,["locations"]);i||(o(t,"Bucket name is required"),r("Bucket name is required",t));let e;if(c!==void 0)e=w(c);else{k("Provide --locations flag");try{e=await B()}catch(f){o(t,f.message),r(f,t)}}let m=await L(),g=l(),S={...m,...g&&!m.organizationId?{organizationId:g}:{}},{error:n}=await q(i,{locations:e,config:S});n&&(o(t,n.message),r(n,t)),u(t,{name:i})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as t}from"../../chunk-JRALYIRA.js";import{b as C}from"../../chunk-SAPK5MRQ.js";import{a as r}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as m,d as i,i as w}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as q}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketMigration as K}from"@tigrisdata/storage";var e=w("buckets","set-migration");async function M(n){p(e);let o=t(n,["name"]),s=t(n,["bucket"]),a=t(n,["endpoint"]),c=t(n,["region"]),g=t(n,["access-key","accessKey"]),d=t(n,["secret-key","secretKey"]),k=t(n,["write-through","writeThrough"]),l=t(n,["disable"]);o||(i(e,"Bucket name is required"),r("Bucket name is required",e)),l&&(s!==void 0||a!==void 0||c!==void 0||g!==void 0||d!==void 0||k!==void 0)&&(i(e,"Cannot use --disable with other migration options"),r("Cannot use --disable with other migration options",e));let b=await C(),h=q(),y={...b,...h&&!b.organizationId?{organizationId:h}:{}};if(l){let{error:f}=await K(o,{dataMigration:{enabled:!1},config:y});f&&(i(e,f.message),r(f,e)),m(e,{name:o});return}(!s||!a||!c||!g||!d)&&(i(e,"Required: --bucket, --endpoint, --region, --access-key, --secret-key"),r("Required: --bucket, --endpoint, --region, --access-key, --secret-key",e));let{error:u}=await K(o,{dataMigration:{enabled:!0,accessKey:g,secretKey:d,region:c,name:s,endpoint:a,writeThrough:k??!1},config:y});u&&(i(e,u.message),r(u,e)),m(e,{name:o})}export{M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as n}from"../../chunk-JRALYIRA.js";import{b as O}from"../../chunk-SAPK5MRQ.js";import{a as o}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as w,c as k,d as i,i as C}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as B}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketNotifications as y}from"@tigrisdata/storage";var e=C("buckets","set-notifications");async function N(t){w(e);let l=n(t,["name"]),f=n(t,["url"]),u=n(t,["filter"]),d=n(t,["token"]),r=n(t,["username"]),a=n(t,["password"]),m=n(t,["enable"]),g=n(t,["disable"]),c=n(t,["reset"]);l||(i(e,"Bucket name is required"),o("Bucket name is required",e)),[m,g,c].filter(Boolean).length>1&&(i(e,"Only one of --enable, --disable, or --reset can be used"),o("Only one of --enable, --disable, or --reset can be used",e)),c&&(f!==void 0||u!==void 0||d!==void 0||r!==void 0||a!==void 0)&&(i(e,"Cannot use --reset with other options"),o("Cannot use --reset with other options",e)),!m&&!g&&!c&&f===void 0&&u===void 0&&d===void 0&&r===void 0&&a===void 0&&(i(e,"Provide at least one option"),o("Provide at least one option",e)),d&&(r!==void 0||a!==void 0)&&(i(e,"Cannot use --token with --username/--password. Choose one auth method"),o("Cannot use --token with --username/--password. Choose one auth method",e)),(r!==void 0&&a===void 0||r===void 0&&a!==void 0)&&(i(e,"Both --username and --password are required"),o("Both --username and --password are required",e));let b=await O(),p=B(),q={...b,...p&&!b.organizationId?{organizationId:p}:{}},s;c?s={}:(s={...m?{enabled:!0}:{},...g?{enabled:!1}:{},...f!==void 0?{url:f}:{},...u!==void 0?{filter:u}:{}},d?s={...s,auth:{token:d}}:r&&a&&(s={...s,auth:{username:r,password:a}}));let{error:h}=await y(l,{notificationConfig:s,config:q});h&&(i(e,h.message),o(h,e)),k(e,{name:l})}export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as i}from"../../chunk-JRALYIRA.js";import{b as A}from"../../chunk-SAPK5MRQ.js";import{a}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as m,c as y,d as t,i as C}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as S}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketLifecycle as I}from"@tigrisdata/storage";var e=C("buckets","set-transition"),f=["STANDARD_IA","GLACIER","GLACIER_IR"];async function p(d){m(e);let l=i(d,["name"]),o=i(d,["storage-class","storageClass"]),n=i(d,["days"]),s=i(d,["date"]),u=i(d,["enable"]),r=i(d,["disable"]);l||(t(e,"Bucket name is required"),a("Bucket name is required",e)),u&&r&&(t(e,"Cannot use both --enable and --disable"),a("Cannot use both --enable and --disable",e)),r&&(n!==void 0||s!==void 0||o!==void 0)&&(t(e,"Cannot use --disable with --days, --date, or --storage-class"),a("Cannot use --disable with --days, --date, or --storage-class",e)),!u&&!r&&n===void 0&&s===void 0&&(t(e,"Provide --days, --date, --enable, or --disable"),a("Provide --days, --date, --enable, or --disable",e)),(n!==void 0||s!==void 0)&&!o&&(t(e,"--storage-class is required when setting --days or --date"),a("--storage-class is required when setting --days or --date",e)),o&&!f.includes(o)&&(t(e,`--storage-class must be one of: ${f.join(", ")} (STANDARD is not a valid transition target)`),a(`--storage-class must be one of: ${f.join(", ")} (STANDARD is not a valid transition target)`,e)),n!==void 0&&(isNaN(Number(n))||Number(n)<=0)&&(t(e,"--days must be a positive number"),a("--days must be a positive number",e)),s!==void 0&&(typeof s!="string"||!/^\d{4}-\d{2}-\d{2}/.test(s)||isNaN(new Date(s).getTime()))&&(t(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)"),a("--date must be a valid ISO-8601 date (e.g. 2026-06-01)",e));let g=await A(),b=S(),N={...g,...b&&!g.organizationId?{organizationId:b}:{}},R={...u?{enabled:!0}:{},...r?{enabled:!1}:{},...o?{storageClass:o}:{},...n!==void 0?{days:Number(n)}:{},...s!==void 0?{date:s}:{}},{error:c}=await I(l,{lifecycleRules:[R],config:N});c&&(t(e,c.message),a(c,e)),y(e,{name:l})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as d}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-SAPK5MRQ.js";import{a}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as m,c,d as n,i as g}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as y}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{setBucketTtl as v}from"@tigrisdata/storage";var e=g("buckets","set-ttl");async function w(s){m(e);let r=d(s,["name"]),i=d(s,["days"]),t=d(s,["date"]),u=d(s,["enable"]),o=d(s,["disable"]);r||(n(e,"Bucket name is required"),a("Bucket name is required",e)),u&&o&&(n(e,"Cannot use both --enable and --disable"),a("Cannot use both --enable and --disable",e)),o&&(i!==void 0||t!==void 0)&&(n(e,"Cannot use --disable with --days or --date"),a("Cannot use --disable with --days or --date",e)),!u&&!o&&i===void 0&&t===void 0&&(n(e,"Provide --days, --date, --enable, or --disable"),a("Provide --days, --date, --enable, or --disable",e)),i!==void 0&&(isNaN(Number(i))||Number(i)<=0)&&(n(e,"--days must be a positive number"),a("--days must be a positive number",e)),t!==void 0&&(typeof t!="string"||!/^\d{4}-\d{2}-\d{2}/.test(t)||isNaN(new Date(t).getTime()))&&(n(e,"--date must be a valid ISO-8601 date (e.g. 2026-06-01)"),a("--date must be a valid ISO-8601 date (e.g. 2026-06-01)",e));let b=await p(),l=y(),C={...b,...l&&!b.organizationId?{organizationId:l}:{}},N={...u?{enabled:!0}:{},...o?{enabled:!1}:{},...i!==void 0?{days:Number(i)}:{},...t!==void 0?{date:t}:{}},{error:f}=await v(r,{ttlConfig:N,config:C});f&&(n(e,f.message),a(f,e)),c(e,{name:r})}export{w as default};
|
package/dist/lib/buckets/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as B}from"../../chunk-TD2HGNDY.js";import"../../chunk-S77OAN6Y.js";import{a as e,b as a}from"../../chunk-JRALYIRA.js";import{b as y}from"../../chunk-SAPK5MRQ.js";import{a as c}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as D,c as k,d as s,i as A}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as h}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{updateBucket as q}from"@tigrisdata/storage";var i=A("buckets","set");async function L(n){D(i);let S=e(n,["json"])?"json":e(n,["format"],"table"),r=e(n,["name"]),d=e(n,["access"]),o=e(n,["locations"]),w=e(n,["region"]);w!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),o===void 0&&(o=w));let l=e(n,["allow-object-acl","allowObjectAcl"]),f=e(n,["disable-directory-listing","disableDirectoryListing"]),u=e(n,["cache-control","cacheControl"]),g=e(n,["custom-domain","customDomain"]),m=e(n,["enable-delete-protection","enableDeleteProtection"]),b=e(n,["enable-additional-headers","enableAdditionalHeaders"]);r||(s(i,"Bucket name is required"),c("Bucket name is required",i)),d===void 0&&o===void 0&&l===void 0&&f===void 0&&u===void 0&&g===void 0&&m===void 0&&b===void 0&&(s(i,"At least one setting is required"),c("At least one setting is required",i));let O=await y(),t={};d!==void 0&&(t.access=d),o!==void 0&&(t.locations=B(o)),l!==void 0&&(t.allowObjectAcl=a(l)),f!==void 0&&(t.disableDirectoryListing=a(f)),u!==void 0&&(t.cacheControl=u),g!==void 0&&(t.customDomain=g),m!==void 0&&(t.enableDeleteProtection=a(m)),b!==void 0&&(t.enableAdditionalHeaders=a(b));let j=h(),C={...O,...j&&!O.organizationId?{organizationId:j}:{}},{error:p}=await q(r,{...t,config:C});p&&(s(i,p.message),c(p,i)),S==="json"&&console.log(JSON.stringify({action:"updated",name:r})),k(i,{name:r})}export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as f}from"../../chunk-S77OAN6Y.js";import{a as d,c as p}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as m,d as n,i as o}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import{n as g,r as l}from"../../chunk-DOUR5YEY.js";import{a as y}from"../../chunk-2XAO2OYD.js";import K from"enquirer";var{prompt:S}=K,r=o("configure");async function q(e){u(r);let s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,c=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret,t=e.endpoint||e.e||e.E||e.Endpoint;if(!s||!c||!t){let i=[];s||i.push({type:"input",name:"accessKey",message:"Tigris Access Key ID:",required:!0}),c||i.push({type:"password",name:"accessSecret",message:"Tigris Secret Access Key:",required:!0}),t||i.push({type:"input",name:"endpoint",message:"Tigris Endpoint:",required:!0,initial:y}),f("Provide --access-key, --access-secret, and --endpoint");let a=await S(i);s=s||a.accessKey,c=c||a.accessSecret,t=t||a.endpoint}(!s||!c||!t)&&(n(r,"All credentials are required"),d("All credentials are required",r));try{await g({accessKeyId:s,secretAccessKey:c,endpoint:t}),await l("credentials"),m(r),p(r)}catch(i){n(r,"Failed to save credentials"),d(i,r)}}export{q as default};
|
package/dist/lib/cp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as B}from"../chunk-EKW6XTGL.js";import{a as j}from"../chunk-SAAGVLRE.js";import{a as w}from"../chunk-CQCBYE3X.js";import{a as O,b as T,d as D,g as x,h as U,i as J}from"../chunk-LCWHZUZZ.js";import{a as N}from"../chunk-JRALYIRA.js";import{b as q}from"../chunk-SAPK5MRQ.js";import{a as f}from"../chunk-LQ4BU234.js";import"../chunk-DV3LCXRH.js";import"../chunk-2JHVFROL.js";import"../chunk-BETAO4PB.js";import"../chunk-E4MLGABW.js";import"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{createReadStream as P,createWriteStream as tt,statSync as L,readdirSync as E,mkdirSync as et,existsSync as Q}from"fs";import{resolve as G,dirname as K,basename as z,join as v,relative as _}from"path";import{homedir as ot}from"os";import{Readable as V}from"stream";import{pipeline as it}from"stream/promises";import{get as X,put as M,list as nt,head as Y}from"@tigrisdata/storage";var h=!1;function rt(i,t){let e=O(i),l=O(t);return!e&&!l&&f("At least one path must be a remote Tigris path (t3:// or tigris://)"),e&&l?"remote-to-remote":e?"remote-to-local":"local-to-remote"}function Z(i){return i==="~"||i.startsWith("~/")?G(ot(),i.slice(2)):G(i)}function at(i){return E(i,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>{let l=e.parentPath??e.path;return v(l,e.name)})}function lt(i,t){let e=K(i),l=z(i),s=x(l);return Q(e)?t?E(e,{recursive:!0,withFileTypes:!0}).filter(a=>a.isFile()&&s.test(a.name)).map(a=>{let n=a.parentPath??a.path;return v(n,a.name)}):E(e,{withFileTypes:!0}).filter(n=>n.isFile()&&s.test(n.name)).map(n=>v(e,n.name)):[]}async function I(i,t,e,l,s=!1){let u;try{u=L(i).size}catch{return{error:`File not found: ${i}`}}let a=P(i),n=V.toWeb(a),{error:o}=await M(e,n,{...B(u),onUploadProgress:s?({loaded:r})=>{if(u!==void 0&&u>0){let c=Math.round(r/u*100);process.stdout.write(`\rUploading: ${w(r)} / ${w(u)} (${c}%)`)}else process.stdout.write(`\rUploading: ${w(r)}`)}:void 0,config:{...l,bucket:t}});return s&&process.stdout.write("\r"+" ".repeat(60)+"\r"),o?{error:o.message}:{}}async function H(i,t,e,l,s=!1){let u;if(s){let{data:p}=await Y(t,{config:{...l,bucket:i}});u=p?.size}let{data:a,error:n}=await X(t,"stream",{config:{...l,bucket:i}});if(n)return{error:n.message};let o=K(e);Q(o)||et(o,{recursive:!0});let r=tt(e),c=V.fromWeb(a);if(s&&u!==void 0&&u>0){let p=0;c.on("data",m=>{p+=m.length;let g=Math.round(p/u*100);process.stdout.write(`\rDownloading: ${w(p)} / ${w(u)} (${g}%)`)})}return await it(c,r),s&&process.stdout.write("\r"+" ".repeat(60)+"\r"),{}}async function A(i,t,e,l,s,u=!1){if(e.endsWith("/")){let{error:c}=await M(s,"",{config:{...i,bucket:l}});return c?{error:c.message}:{}}let a;if(u){let{data:c}=await Y(e,{config:{...i,bucket:t}});a=c?.size}let{data:n,error:o}=await X(e,"stream",{config:{...i,bucket:t}});if(o)return{error:o.message};let{error:r}=await M(s,n,{...B(a),onUploadProgress:u?({loaded:c})=>{if(a!==void 0&&a>0){let p=Math.round(c/a*100);process.stdout.write(`\rCopying: ${w(c)} / ${w(a)} (${p}%)`)}else process.stdout.write(`\rCopying: ${w(c)}`)}:void 0,config:{...i,bucket:l}});return u&&process.stdout.write("\r"+" ".repeat(60)+"\r"),r?{error:r.message}:{}}async function ct(i,t,e,l){let s=Z(i);if(i.includes("*")){let n=lt(s,l);if(n.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files matching pattern");return}let o=K(s),r=n.map(m=>async()=>{let g=_(o,m),k=t.path?`${t.path.replace(/\/$/,"")}/${g}`:g,$=await I(m,t.bucket,k,e);return $.error?(console.error(`Failed to upload ${m}: ${$.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${k}`),!0)}),p=(await j(r,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:p}):`Uploaded ${p} file(s)`);return}let a;try{a=L(s)}catch{f(`Source not found: ${i}`)}if(a.isDirectory()){l||f(`${i} is a directory (not copied). Use -r to copy recursively.`);let n=at(s);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("/")?"":z(s),r=n.map(m=>async()=>{let g=_(s,m),$=[t.path?.replace(/\/$/,""),o,g].filter(Boolean).join("/"),R=await I(m,t.bucket,$,e);return R.error?(console.error(`Failed to upload ${m}: ${R.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${$}`),!0)}),p=(await j(r,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:p}):`Uploaded ${p} file(s)`)}else{let n=z(s),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 r=await I(s,t.bucket,o,e,!h);r.error&&f(r.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 st(i,t,e,l,s){let u=i.endsWith("/");!t.path&&!u&&f("Cannot copy a bucket. Provide a path within the bucket.");let a=Z(e),n=t.path.includes("*"),o=t.path.endsWith("/")||!t.path&&u;if(!n&&!o&&(o=await D(t.bucket,t.path,l)),o&&!n&&!s&&f("Source is a remote folder (not copied). Use -r to copy recursively."),n||o){let r=n?U(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",c=!n&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",{items:p,error:m}=await J(t.bucket,r||void 0,l);m&&f(m);let g=p.filter(y=>!y.name.endsWith("/"));if(n){let y=t.path.split("/").pop(),b=x(y);g=g.filter(S=>{let d=r?S.name.slice(r.length):S.name;return!s&&d.includes("/")?!1:b.test(d.split("/").pop())})}if(g.length===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:0}):"No objects to download");return}let k=g.map(y=>async()=>{let b=r?y.name.slice(r.length):y.name,S=c?v(a,c,b):v(a,b),d=await H(t.bucket,y.name,S,l);return d.error?(console.error(`Failed to download ${y.name}: ${d.error}`),!1):(h||console.log(`Downloaded t3://${t.bucket}/${y.name} -> ${S}`),!0)}),R=(await j(k,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:R}):`Downloaded ${R} file(s)`)}else{let r=t.path.split("/").pop(),c,p=!1;try{p=L(a).isDirectory()}catch{}p||e.endsWith("/")?c=v(a,r):c=a;let m=await H(t.bucket,t.path,c,l,!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:c}):`Downloaded t3://${t.bucket}/${t.path} -> ${c}`)}}async function pt(i,t,e,l,s){let u=i.endsWith("/");!t.path&&!u&&f("Cannot copy a bucket. Provide a path within the bucket.");let a=i.includes("*"),n=t.path.endsWith("/")||!t.path&&u;if(!a&&!n&&t.path&&(n=await D(t.bucket,t.path,l)),n&&!a&&!s&&f("Source is a remote folder (not copied). Use -r to copy recursively."),a||n){let o=a?U(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",r=!a&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",p=[e.path?.replace(/\/$/,"")||"",r].filter(Boolean).join("/"),m=p?`${p}/`:"";t.bucket===e.bucket&&o===m&&f("Source and destination are the same");let{items:g,error:k}=await J(t.bucket,o||void 0,l);k&&f(k);let $=g.filter(d=>d.name!==o);if(a){let d=t.path.split("/").pop(),F=x(d);$=$.filter(W=>{let C=o?W.name.slice(o.length):W.name;return!s&&C.includes("/")?!1:F.test(C.split("/").pop())})}let R=$.map(d=>async()=>{let F=o?d.name.slice(o.length):d.name,W=p?`${p}/${F}`:F,C=await A(l,t.bucket,d.name,e.bucket,W);return C.error?(console.error(`Failed to copy ${d.name}: ${C.error}`),!1):(h||console.log(`Copied t3://${t.bucket}/${d.name} -> t3://${e.bucket}/${W}`),!0)}),b=(await j(R,8)).filter(Boolean).length,S=!1;if(p&&o){let{data:d}=await nt({prefix:o,limit:1,config:{...l,bucket:t.bucket}});if(d?.items?.some(F=>F.name===o)){let F=`${p}/`,W=await A(l,t.bucket,o,e.bucket,F);W.error?console.error(`Failed to copy folder marker: ${W.error}`):S=!0}}if(b===0&&S&&(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 o=t.path.split("/").pop(),r;e.path?e.path.endsWith("/")?r=`${e.path}${o}`:await D(e.bucket,e.path,l)?r=`${e.path}/${o}`:r=e.path:r=o,t.bucket===e.bucket&&t.path===r&&f("Source and destination are the same");let c=await A(l,t.bucket,t.path,e.bucket,r,!h);c.error&&f(c.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:1,src:`t3://${t.bucket}/${t.path}`,dest:`t3://${e.bucket}/${r}`}):`Copied t3://${t.bucket}/${t.path} -> t3://${e.bucket}/${r}`)}}async function ut(i){let t=N(i,["src"]),e=N(i,["dest"]);(!t||!e)&&f("Both src and dest arguments are required");let l=!!N(i,["recursive","r"]);h=(N(i,["json"])?"json":N(i,["format"],"table"))==="json";let a=rt(t,e),n=await q({withCredentialProvider:!0});switch(a){case"local-to-remote":{let o=T(e);o.bucket||f("Invalid destination path"),await ct(t,o,n,l);break}case"remote-to-local":{let o=T(t);o.bucket||f("Invalid source path"),await st(t,o,e,n,l);break}case"remote-to-remote":{let o=T(t),r=T(e);o.bucket||f("Invalid source path"),r.bucket||f("Invalid destination path"),await pt(t,o,r,n,l);break}}process.exit(0)}export{ut as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-JRALYIRA.js";import{b
|
|
1
|
+
import{a as c}from"../../chunk-JRALYIRA.js";import{b}from"../../chunk-SAPK5MRQ.js";import{a as s}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as d,d as r,i as m}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as k}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as p,getBucketInfo as N}from"@tigrisdata/storage";var e=m("credentials","test");async function B(a){l(e);let f=c(a,["json"])?"json":c(a,["format","f","F"],"table"),t=c(a,["bucket","b"]),i=await b();!i.accessKeyId&&!i.sessionToken&&(r(e,'No credentials found. Run "tigris configure" or "tigris login" first.'),s('No credentials found. Run "tigris configure" or "tigris login" first.',e));let g=k(),u={...i,...g&&!i.organizationId?{organizationId:g}:{}};if(t){let{data:o,error:n}=await N(t,{config:u});n&&(r(e,`Current credentials don't have access to bucket "${t}"`),s(n,e)),f==="json"?console.log(JSON.stringify({valid:!0,bucket:t,...o.sourceBucketName?{forkOf:o.sourceBucketName}:{}})):(console.log(` Bucket: ${t}`),console.log(" Access verified."),o.sourceBucketName&&console.log(` Fork of: ${o.sourceBucketName}`))}else{let{data:o,error:n}=await p({config:u});n&&(r(e,"Current credentials don't have sufficient access"),s(n,e)),console.log(f==="json"?JSON.stringify({valid:!0,bucketCount:o.buckets.length}):` Access verified. Found ${o.buckets.length} bucket(s).`)}d(e)}export{B as default};
|
package/dist/lib/forks/create.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as o}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-SAPK5MRQ.js";import{a as t}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as m,d as e,i as u}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createBucket as g}from"@tigrisdata/storage";var r=u("forks","create");async function p(i){c(r);let n=o(i,["name"]),a=o(i,["fork-name","forkName"]),k=o(i,["snapshot","s","S"]);n||(e(r,"Source bucket name is required"),t("Source bucket name is required",r)),a||(e(r,"Fork name is required"),t("Fork name is required",r));let{error:s}=await g(a,{sourceBucketName:n,sourceBucketSnapshot:k,config:await f()});s&&(e(r,s.message),t(s,r)),m(r,{name:n,forkName:a})}export{p as default};
|
package/dist/lib/forks/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as l}from"../../chunk-CQCBYE3X.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as d}from"../../chunk-SAPK5MRQ.js";import{a}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as g,c as k,d as n,e as u,i as p}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listBuckets as x,getBucketInfo as b}from"@tigrisdata/storage";var t=p("forks","list");async function B(s){g(t);let e=i(s,["name"]),h=i(s,["json"])?"json":i(s,["format","f","F"],"table");e||(n(t,"Source bucket name is required"),a("Source bucket name is required",t));let c=await d(),{data:w,error:f}=await b(e,{config:c});if(f&&(n(t,f.message),a(f,t)),!w.hasForks){u(t);return}let{data:y,error:m}=await x({config:c});m&&(n(t,m.message),a(m,t));let r=[];for(let o of y.buckets){if(o.name===e)continue;let{data:j}=await b(o.name,{config:c});j?.sourceBucketName===e&&r.push({name:o.name,created:o.creationDate})}if(r.length===0){u(t);return}let S=l(r,h,"forks","fork",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(S),k(t,{count:r.length})}export{B as default};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
Run "tigris login oauth" first.`),
|
|
1
|
+
import{a as v,b as w}from"../../../chunk-Y7MJZRR4.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as P}from"../../../chunk-SAPK5MRQ.js";import{a as e}from"../../../chunk-LQ4BU234.js";import"../../../chunk-DV3LCXRH.js";import{b as u,c as g,d as t,i as p}from"../../../chunk-2JHVFROL.js";import"../../../chunk-BETAO4PB.js";import{b as y}from"../../../chunk-E4MLGABW.js";import{g as h}from"../../../chunk-DOUR5YEY.js";import{c as f}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as T,readFileSync as C}from"fs";import{addPolicy as I}from"@tigrisdata/iam";var i=p("iam policies","create");async function k(a){u(i);let c=r(a,["name"]),n=r(a,["document","d"]),A=r(a,["description"])??"";c||(t(i,"Policy name is required"),e("Policy name is required",i)),/^[a-zA-Z0-9=,.@_-]+$/.test(c)||(t(i,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed."),e("Invalid policy name. Only alphanumeric characters and =,.@_- are allowed.",i)),await P()!=="oauth"&&(t(i,`Policies can only be created when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),e(`Policies can only be created when logged in via OAuth.
|
|
3
|
+
Run "tigris login oauth" first.`,i));let d=y();await d.isAuthenticated()||(t(i,'Not authenticated. Run "tigris login oauth" first.'),e('Not authenticated. Run "tigris login oauth" first.',i));let O=await d.getAccessToken(),S=h(),N=f(),R={sessionToken:O,organizationId:S??void 0,iamEndpoint:N.iamEndpoint},o;n?T(n)?o=C(n,"utf-8"):o=n:process.stdin.isTTY?(t(i,"Policy document is required. Provide via --document or pipe to stdin."),e("Policy document is required. Provide via --document or pipe to stdin.",i)):o=await v();let l;try{l=w(o)}catch{t(i,"Invalid JSON in policy document"),e("Invalid JSON in policy document",i)}let{data:m,error:s}=await I(c,{document:l,description:A,config:R});s&&(t(i,s.message),e(s,i)),g(i,{name:m.name}),console.log(`Resource: ${m.resource}`)}export{k as default};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{a
|
|
2
|
-
Run "tigris login oauth" first.`),
|
|
1
|
+
import{a,b as R}from"../../../chunk-S77OAN6Y.js";import{a as l}from"../../../chunk-JRALYIRA.js";import{a as k}from"../../../chunk-SAPK5MRQ.js";import{a as o}from"../../../chunk-LQ4BU234.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as u,d as i,e as p,i as h}from"../../../chunk-2JHVFROL.js";import"../../../chunk-BETAO4PB.js";import{b as A}from"../../../chunk-E4MLGABW.js";import{g as w}from"../../../chunk-DOUR5YEY.js";import{c as y}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import v from"enquirer";import{deletePolicy as T,listPolicies as x}from"@tigrisdata/iam";var{prompt:S}=v,e=h("iam policies","delete");async function M(g){d(e);let t=l(g,["resource"]),C=l(g,["force","yes","y"]);await k()!=="oauth"&&(i(e,`Policies can only be deleted when logged in via OAuth.
|
|
2
|
+
Run "tigris login oauth" first.`),o(`Policies can only be deleted when logged in via OAuth.
|
|
3
|
+
Run "tigris login oauth" first.`,e));let m=A();await m.isAuthenticated()||(i(e,'Not authenticated. Run "tigris login oauth" first.'),o('Not authenticated. Run "tigris login oauth" first.',e));let E=await m.getAccessToken(),O=w(),P=y(),f={sessionToken:E,organizationId:O??void 0,iamEndpoint:P.iamEndpoint};if(!t){let{data:n,error:s}=await x({config:f});if(s&&(i(e,s.message),o(s,e)),!n.policies||n.policies.length===0){p(e);return}a("Provide the policy ARN as a positional argument");let{selected:b}=await S({type:"select",name:"selected",message:"Select a policy to delete:",choices:n.policies.map(c=>({name:c.resource,message:`${c.name} (${c.resource})`}))});t=b}if(!C&&(a("Use --yes to skip confirmation"),!await R(`Delete policy '${t}'?`))){console.log("Aborted");return}let{error:r}=await T(t,{config:f});r&&(i(e,r.message),o(r,e)),u(e,{resource:t})}export{M as default};
|