@tigrisdata/cli 2.14.0-beta.2 → 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-ZK3HJDIZ.js → chunk-GHJJSJR6.js} +1 -1
- package/dist/{chunk-XLRVNE6T.js → chunk-IFEXFA2T.js} +1 -1
- package/dist/{chunk-GHTFMDGV.js → chunk-LQ4BU234.js} +1 -1
- package/dist/{chunk-S5P27E6L.js → chunk-RJGUZ3B2.js} +4 -4
- package/dist/{chunk-DHUR7FTP.js → chunk-SW6SNHOL.js} +1 -1
- 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 +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/get.js +1 -1
- package/dist/lib/access-keys/list.js +1 -1
- 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 +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/list.js +1 -1
- 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/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 +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/whoami.js +1 -1
- package/dist/utils/exit.js +1 -1
- package/dist/utils/messages.js +1 -1
- package/dist/utils/update-check.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5LRGY6RN.js +0 -2
- package/dist/chunk-FP2FMNEE.js +0 -8
- /package/dist/{chunk-IJYKPR4W.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};
|
|
@@ -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();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S}from"./chunk-S77OAN6Y.js";import{a as y,c as m}from"./chunk-
|
|
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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as i}from"./chunk-DV3LCXRH.js";import{a as n}from"./chunk-
|
|
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
2
|
Error: ${e.message}`),a()&&e.nextActions.length>0){console.error(`
|
|
3
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
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};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as C}from"./chunk-
|
|
2
|
-
Operation cancelled`),process.exit(1)),C(e)}),process.on("uncaughtException",e=>{C(e)})}function
|
|
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
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(
|
|
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
5
|
`),console.log(`Usage: tigris [command] [options]
|
|
6
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
|
|
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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as u,c as r}from"./chunk-
|
|
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
2
|
Your confirmation code: ${i}
|
|
3
3
|
`),console.log(`If browser doesn't open, visit: ${h}`)},onWaiting:()=>console.log(`
|
|
4
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,3 +1,3 @@
|
|
|
1
|
-
import{a as s}from"../../chunk-JRALYIRA.js";import{a as T}from"../../chunk-
|
|
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
2
|
Run "tigris login oauth" first.`),i(`Bucket roles can only be managed when logged in via OAuth.
|
|
3
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,3 +1,3 @@
|
|
|
1
|
-
import{a as i}from"../../chunk-JRALYIRA.js";import{a as k}from"../../chunk-
|
|
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
2
|
Run "tigris login oauth" first.`),o(`Access keys can only be created when logged in via OAuth.
|
|
3
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,3 +1,3 @@
|
|
|
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-
|
|
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
2
|
Run "tigris login oauth" first.`),i(`Access keys can only be deleted when logged in via OAuth.
|
|
3
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,3 +1,3 @@
|
|
|
1
|
-
import{a as n}from"../../chunk-JRALYIRA.js";import{a as p}from"../../chunk-
|
|
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
2
|
Run "tigris login oauth" first.`),i(`Access keys can only be retrieved when logged in via OAuth.
|
|
3
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,3 +1,3 @@
|
|
|
1
|
-
import{f as k}from"../../chunk-CQCBYE3X.js";import{a}from"../../chunk-JRALYIRA.js";import{a as y}from"../../chunk-
|
|
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
2
|
Run "tigris login oauth" first.`),n(`Access keys can only be listed when logged in via OAuth.
|
|
3
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 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-
|
|
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 k,b}from"../../chunk-S77OAN6Y.js";import{a as o}from"../../chunk-JRALYIRA.js";import{b as x}from"../../chunk-
|
|
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 u}from"../../chunk-CQCBYE3X.js";import{a as r}from"../../chunk-JRALYIRA.js";import{b as c}from"../../chunk-
|
|
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 p}from"../../chunk-CQCBYE3X.js";import{a as u}from"../../chunk-JRALYIRA.js";import{b as j}from"../../chunk-
|
|
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 r}from"../../chunk-JRALYIRA.js";import{b as v}from"../../chunk-
|
|
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 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-
|
|
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 t}from"../../chunk-JRALYIRA.js";import{b as C}from"../../chunk-
|
|
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 n}from"../../chunk-JRALYIRA.js";import{b as O}from"../../chunk-
|
|
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 i}from"../../chunk-JRALYIRA.js";import{b as A}from"../../chunk-
|
|
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 d}from"../../chunk-JRALYIRA.js";import{b as p}from"../../chunk-
|
|
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 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-
|
|
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 f}from"../../chunk-S77OAN6Y.js";import{a as d,c as p}from"../../chunk-
|
|
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 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-
|
|
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}from"../../chunk-
|
|
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 o}from"../../chunk-JRALYIRA.js";import{b as f}from"../../chunk-
|
|
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 l}from"../../chunk-CQCBYE3X.js";import{a as i}from"../../chunk-JRALYIRA.js";import{b as d}from"../../chunk-
|
|
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,3 +1,3 @@
|
|
|
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-
|
|
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
2
|
Run "tigris login oauth" first.`),e(`Policies can only be created when logged in via OAuth.
|
|
3
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,3 +1,3 @@
|
|
|
1
|
-
import{a,b as R}from"../../../chunk-S77OAN6Y.js";import{a as l}from"../../../chunk-JRALYIRA.js";import{a as k}from"../../../chunk-
|
|
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
2
|
Run "tigris login oauth" first.`),o(`Policies can only be deleted when logged in via OAuth.
|
|
3
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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as T,b as f}from"../../../chunk-Y7MJZRR4.js";import{a as E}from"../../../chunk-S77OAN6Y.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as R}from"../../../chunk-
|
|
1
|
+
import{a as T,b as f}from"../../../chunk-Y7MJZRR4.js";import{a as E}from"../../../chunk-S77OAN6Y.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as R}from"../../../chunk-SAPK5MRQ.js";import{a as e}from"../../../chunk-LQ4BU234.js";import"../../../chunk-DV3LCXRH.js";import{b as w,c as A,d as t,e as P,i as S}from"../../../chunk-2JHVFROL.js";import"../../../chunk-BETAO4PB.js";import{b as O}from"../../../chunk-E4MLGABW.js";import{g as N}from"../../../chunk-DOUR5YEY.js";import{c as v}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{existsSync as D,readFileSync as k}from"fs";import M from"enquirer";import{editPolicy as z,getPolicy as F,listPolicies as Y}from"@tigrisdata/iam";var{prompt:b}=M,i=S("iam policies","edit");async function $(a){w(i);let n=c(a,["resource"]),r=c(a,["document","d"]),d=c(a,["description"]);await R()!=="oauth"&&(t(i,`Policies can only be edited when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),e(`Policies can only be edited when logged in via OAuth.
|
|
3
3
|
Run "tigris login oauth" first.`,i));let h=O();await h.isAuthenticated()||(t(i,'Not authenticated. Run "tigris login oauth" first.'),e('Not authenticated. Run "tigris login oauth" first.',i));let q=await h.getAccessToken(),I=N(),J=v(),m={sessionToken:q,organizationId:I??void 0,iamEndpoint:J.iamEndpoint};if(!n){process.stdin.isTTY||(t(i,"Policy ARN is required when piping document via stdin."),e("Policy ARN is required when piping document via stdin.",i));let{data:o,error:g}=await Y({config:m});if(g&&(t(i,g.message),e(g,i)),!o.policies||o.policies.length===0){P(i);return}E("Provide the policy ARN as a positional argument");let{selected:C}=await b({type:"select",name:"selected",message:"Select a policy to edit:",choices:o.policies.map(p=>({name:p.resource,message:`${p.name} (${p.resource})`}))});n=C}let s;if(r){let o;D(r)?o=k(r,"utf-8"):o=r;try{s=f(o)}catch{t(i,"Invalid JSON in policy document"),e("Invalid JSON in policy document",i)}}else if(!process.stdin.isTTY&&!d){let o=await T();try{s=f(o)}catch{t(i,"Invalid JSON in policy document"),e("Invalid JSON in policy document",i)}}!s&&!d&&(t(i,"Either --document or --description is required."),e("Either --document or --description is required.",i));let{data:y,error:u}=await F(n,{config:m});u&&(t(i,u.message),e(u,i));let{data:x,error:l}=await z(n,{document:s??y.document,description:d??y.description,config:m});l&&(t(i,l.message),e(l,i)),A(i,{resource:x.resource})}export{$ as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{f as w}from"../../../chunk-CQCBYE3X.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as O}from"../../../chunk-
|
|
1
|
+
import{f as w}from"../../../chunk-CQCBYE3X.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as O}from"../../../chunk-SAPK5MRQ.js";import{a as n}from"../../../chunk-LQ4BU234.js";import"../../../chunk-DV3LCXRH.js";import{b as p,c as g,d as i,e as h,i as y}from"../../../chunk-2JHVFROL.js";import"../../../chunk-BETAO4PB.js";import{b as S}from"../../../chunk-E4MLGABW.js";import{g as A}from"../../../chunk-DOUR5YEY.js";import{c as v}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import E from"enquirer";import{getPolicy as I,listPolicies as b}from"@tigrisdata/iam";var{prompt:P}=E,o=y("iam policies","get");async function N(s){p(o);let a=r(s,["resource"]),f=r(s,["json"])?"json":r(s,["format","f","F"],"table");await O()!=="oauth"&&(i(o,`Policies can only be retrieved when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),n(`Policies can only be retrieved when logged in via OAuth.
|
|
3
3
|
Run "tigris login oauth" first.`,o));let d=S();await d.isAuthenticated()||(i(o,'Not authenticated. Run "tigris login oauth" first.'),n('Not authenticated. Run "tigris login oauth" first.',o));let j=await d.getAccessToken(),C=A(),R=v(),m={sessionToken:j,organizationId:C??void 0,iamEndpoint:R.iamEndpoint};if(!a){let{data:t,error:l}=await b({config:m});if(l&&(i(o,l.message),n(l,o)),!t.policies||t.policies.length===0){h(o);return}let{selected:D}=await P({type:"select",name:"selected",message:"Select a policy:",choices:t.policies.map(u=>({name:u.resource,message:`${u.name} (${u.resource})`}))});a=D}let{data:e,error:c}=await I(a,{config:m});if(c&&(i(o,c.message),n(c,o)),f==="json"){console.log(JSON.stringify(e,null,2)),g(o);return}let $=[{field:"Name",value:e.name},{field:"ID",value:e.id},{field:"Resource",value:e.resource},{field:"Description",value:e.description||"-"},{field:"Path",value:e.path},{field:"Version",value:e.defaultVersionId},{field:"Attachments",value:String(e.attachmentCount)},{field:"Created",value:e.createDate.toISOString()},{field:"Updated",value:e.updateDate.toISOString()}],k=w($,f,"policy","field",[{key:"field",header:"Field"},{key:"value",header:"Value"}]);if(console.log(k),e.users&&e.users.length>0){console.log("Attached Users:");for(let t of e.users)console.log(` - ${t}`);console.log()}console.log("Policy Document:"),console.log(` Version: ${e.document.version}`),console.log(" Statements:");for(let t of e.document.statements)console.log(` - Effect: ${t.effect}`),console.log(` Action: ${Array.isArray(t.action)?t.action.join(", "):t.action}`),console.log(` Resource: ${Array.isArray(t.resource)?t.resource.join(", "):t.resource}`);g(o)}export{N as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{f as A}from"../../../chunk-CQCBYE3X.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as k}from"../../../chunk-
|
|
1
|
+
import{f as A}from"../../../chunk-CQCBYE3X.js";import{a as r}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 u,c as g,d as i,e as m,i as h}from"../../../chunk-2JHVFROL.js";import"../../../chunk-BETAO4PB.js";import{b as f}from"../../../chunk-E4MLGABW.js";import{g as p}from"../../../chunk-DOUR5YEY.js";import{c as l}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{listPolicies as b}from"@tigrisdata/iam";var t=h("iam policies","list");async function j(s){u(t);let w=r(s,["json"])?"json":r(s,["format","f","F"],"table");await k()!=="oauth"&&(i(t,`Policies can only be listed when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),o(`Policies can only be listed when logged in via OAuth.
|
|
3
3
|
Run "tigris login oauth" first.`,t));let c=f();await c.isAuthenticated()||(i(t,'Not authenticated. Run "tigris login oauth" first.'),o('Not authenticated. Run "tigris login oauth" first.',t));let y=await c.getAccessToken(),C=p(),O=l(),{data:n,error:a}=await b({config:{sessionToken:y,organizationId:C??void 0,iamEndpoint:O.iamEndpoint}});if(a&&(i(t,a.message),o(a,t)),!n.policies||n.policies.length===0){m(t);return}let d=n.policies.map(e=>({name:e.name,id:e.id,resource:e.resource,description:e.description||"-",attachments:e.attachmentCount,created:e.createDate,updated:e.updateDate})),R=A(d,w,"policies","policy",[{key:"id",header:"ID"},{key:"resource",header:"Resource"},{key:"name",header:"Name"},{key:"description",header:"Description"},{key:"attachments",header:"Attachments"},{key:"created",header:"Created"},{key:"updated",header:"Updated"}]);console.log(R),g(t,{count:d.length})}export{j as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R}from"../../../chunk-GZ7JBHFT.js";import{a as l}from"../../../chunk-JRALYIRA.js";import{a as b}from"../../../chunk-
|
|
1
|
+
import{a as R}from"../../../chunk-GZ7JBHFT.js";import{a as l}from"../../../chunk-JRALYIRA.js";import{a as b}from"../../../chunk-SAPK5MRQ.js";import{a as n}from"../../../chunk-LQ4BU234.js";import"../../../chunk-DV3LCXRH.js";import{b as c,c as f,d as t,i as h}from"../../../chunk-2JHVFROL.js";import"../../../chunk-BETAO4PB.js";import{b as y}from"../../../chunk-E4MLGABW.js";import{g as v}from"../../../chunk-DOUR5YEY.js";import{c as p}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{inviteUser as M}from"@tigrisdata/iam";var i=h("iam users","invite");async function U(m){c(i),await b()!=="oauth"&&(t(i,`Users can only be invited when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),n(`Users can only be invited when logged in via OAuth.
|
|
3
3
|
Run "tigris login oauth" first.`,i));let g=v();if(R(g??void 0)){console.log(`User management is not available for Fly.io organizations.
|
|
4
4
|
Your users are managed through Fly.io.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as v}from"../../../chunk-GZ7JBHFT.js";import{b as T,d as l,e as m}from"../../../chunk-CQCBYE3X.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as E}from"../../../chunk-
|
|
1
|
+
import{a as v}from"../../../chunk-GZ7JBHFT.js";import{b as T,d as l,e as m}from"../../../chunk-CQCBYE3X.js";import{a as r}from"../../../chunk-JRALYIRA.js";import{a as E}from"../../../chunk-SAPK5MRQ.js";import{a}from"../../../chunk-LQ4BU234.js";import"../../../chunk-DV3LCXRH.js";import{b as p,c as y,d as i,e as k,i as b}from"../../../chunk-2JHVFROL.js";import"../../../chunk-BETAO4PB.js";import{b as C}from"../../../chunk-E4MLGABW.js";import{g as w}from"../../../chunk-DOUR5YEY.js";import{c as U}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import{listUsers as j}from"@tigrisdata/iam";var e=b("iam users","list");async function z(g){p(e);let u=r(g,["json"])?"json":r(g,["format","f","F"],"table");await E()!=="oauth"&&(i(e,`Users can only be listed when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),a(`Users can only be listed when logged in via OAuth.
|
|
3
3
|
Run "tigris login oauth" first.`,e));let c=w();if(v(c??void 0)){console.log(`User management is not available for Fly.io organizations.
|
|
4
4
|
Your users are managed through Fly.io.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as E}from"../../../chunk-GZ7JBHFT.js";import{a as c,b}from"../../../chunk-S77OAN6Y.js";import{a as g}from"../../../chunk-JRALYIRA.js";import{a as R}from"../../../chunk-
|
|
1
|
+
import{a as E}from"../../../chunk-GZ7JBHFT.js";import{a as c,b}from"../../../chunk-S77OAN6Y.js";import{a as g}from"../../../chunk-JRALYIRA.js";import{a as R}from"../../../chunk-SAPK5MRQ.js";import{a as o}from"../../../chunk-LQ4BU234.js";import"../../../chunk-DV3LCXRH.js";import{b as h,c as y,d as t,e as v,i as w}from"../../../chunk-2JHVFROL.js";import"../../../chunk-BETAO4PB.js";import{b as U}from"../../../chunk-E4MLGABW.js";import{g as O}from"../../../chunk-DOUR5YEY.js";import{c as A}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import z from"enquirer";import{removeUser as S,listUsers as T}from"@tigrisdata/iam";var{prompt:I}=z,e=w("iam users","remove");async function x(l){h(e);let i=g(l,["resource"]),k=g(l,["force","yes","y"]);await R()!=="oauth"&&(t(e,`Users can only be removed when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),o(`Users can only be removed when logged in via OAuth.
|
|
3
3
|
Run "tigris login oauth" first.`,e));let u=O();if(E(u??void 0)){console.log(`User management is not available for Fly.io organizations.
|
|
4
4
|
Your users are managed through Fly.io.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as E}from"../../../chunk-GZ7JBHFT.js";import{a as g,b}from"../../../chunk-S77OAN6Y.js";import{a as m}from"../../../chunk-JRALYIRA.js";import{a as O}from"../../../chunk-
|
|
1
|
+
import{a as E}from"../../../chunk-GZ7JBHFT.js";import{a as g,b}from"../../../chunk-S77OAN6Y.js";import{a as m}from"../../../chunk-JRALYIRA.js";import{a as O}from"../../../chunk-SAPK5MRQ.js";import{a as e}from"../../../chunk-LQ4BU234.js";import"../../../chunk-DV3LCXRH.js";import{b as h,c as v,d as i,e as y,i as k}from"../../../chunk-2JHVFROL.js";import"../../../chunk-BETAO4PB.js";import{b as I}from"../../../chunk-E4MLGABW.js";import{g as A}from"../../../chunk-DOUR5YEY.js";import{c as w}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import F from"enquirer";import{revokeInvitation as T,listUsers as U}from"@tigrisdata/iam";var{prompt:S}=F,t=k("iam users","revoke-invitation");async function $(l){h(t);let o=m(l,["resource"]),R=m(l,["force","yes","y"]);await O()!=="oauth"&&(i(t,`Invitations can only be revoked when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),e(`Invitations can only be revoked when logged in via OAuth.
|
|
3
3
|
Run "tigris login oauth" first.`,t));let f=A();if(E(f??void 0)){console.log(`User management is not available for Fly.io organizations.
|
|
4
4
|
Your users are managed through Fly.io.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as U}from"../../../chunk-GZ7JBHFT.js";import{a as E}from"../../../chunk-S77OAN6Y.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as I}from"../../../chunk-
|
|
1
|
+
import{a as U}from"../../../chunk-GZ7JBHFT.js";import{a as E}from"../../../chunk-S77OAN6Y.js";import{a as c}from"../../../chunk-JRALYIRA.js";import{a as I}from"../../../chunk-SAPK5MRQ.js";import{a as i}from"../../../chunk-LQ4BU234.js";import"../../../chunk-DV3LCXRH.js";import{b,c as R,d as r,e as v,i as w}from"../../../chunk-2JHVFROL.js";import"../../../chunk-BETAO4PB.js";import{b as O}from"../../../chunk-E4MLGABW.js";import{g as $}from"../../../chunk-DOUR5YEY.js";import{c as A}from"../../../chunk-KH63ANUX.js";import"../../../chunk-2XAO2OYD.js";import q from"enquirer";import{updateUserRole as F,listUsers as N}from"@tigrisdata/iam";var{prompt:z}=q,e=w("iam users","update-role");async function S(d){b(e),await I()!=="oauth"&&(r(e,`User roles can only be updated when logged in via OAuth.
|
|
2
2
|
Run "tigris login oauth" first.`),i(`User roles can only be updated when logged in via OAuth.
|
|
3
3
|
Run "tigris login oauth" first.`,e));let f=$();if(U(f??void 0)){console.log(`User management is not available for Fly.io organizations.
|
|
4
4
|
Your users are managed through Fly.io.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-IFEXFA2T.js";import"../../chunk-S77OAN6Y.js";import"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-DOUR5YEY.js";import"../../chunk-2XAO2OYD.js";export{a as default};
|
package/dist/lib/login/oauth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../../chunk-
|
|
1
|
+
import{a,b}from"../../chunk-SW6SNHOL.js";import"../../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";export{b as default,a as oauth};
|
package/dist/lib/login/select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"../../chunk-
|
|
1
|
+
import{a as r}from"../../chunk-SW6SNHOL.js";import{a as c}from"../../chunk-IFEXFA2T.js";import{a as s}from"../../chunk-S77OAN6Y.js";import"../../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 i from"enquirer";var{prompt:n}=i;async function u(e){let a=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,t=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(a||t){await c(e);return}s('Use "tigris login oauth" or "tigris login credentials --access-key ... --access-secret ..."');let{method:m}=await n({type:"select",name:"method",message:"Choose login method:",choices:[{name:"user",message:"As a user (OAuth2 flow)"},{name:"machine",message:"As a machine (Access Key & Secret)"}]});m==="user"?await r():await c(e)}export{u as default};
|
package/dist/lib/logout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../chunk-
|
|
1
|
+
import{a as c}from"../chunk-LQ4BU234.js";import"../chunk-DV3LCXRH.js";import{b as i,c as e,d as o,i as a}from"../chunk-2JHVFROL.js";import"../chunk-BETAO4PB.js";import{t as n}from"../chunk-DOUR5YEY.js";import"../chunk-2XAO2OYD.js";var r=a("logout");async function s(){i(r);try{await n(),e(r)}catch(t){t instanceof Error?o(r,t.message):o(r),c(t,r)}}export{s as default};
|
package/dist/lib/ls.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,f as m}from"../chunk-CQCBYE3X.js";import{f as y}from"../chunk-LCWHZUZZ.js";import{a as s}from"../chunk-JRALYIRA.js";import{b as d}from"../chunk-
|
|
1
|
+
import{a as b,f as m}from"../chunk-CQCBYE3X.js";import{f as y}from"../chunk-LCWHZUZZ.js";import{a as s}from"../chunk-JRALYIRA.js";import{b as d}from"../chunk-SAPK5MRQ.js";import{a as i}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{list as S,listBuckets as O}from"@tigrisdata/storage";async function W(a){let p=s(a,["path"]),h=s(a,["snapshot-version","snapshotVersion","snapshot"]),l=s(a,["json"])?"json":s(a,["format","f","F"],"table");if(!p){let e=await d(),{data:t,error:o}=await O({config:e});o&&i(o);let n=(t.buckets||[]).map(g=>({name:g.name,created:g.creationDate})),f=m(n,l,"buckets","bucket",[{key:"name",header:"Name"},{key:"created",header:"Created"}]);console.log(f);return}let{bucket:u,path:r}=y(p);u||i("Invalid path");let j=await d(),c=r?r.endsWith("/")?r:`${r}/`:void 0,{data:w,error:k}=await S({prefix:c,...h?{snapshotVersion:h}:{},config:{...j,bucket:u}});k&&i(k);let x=(w.items||[]).map(e=>{let t=c?e.name.slice(c.length):e.name,o=t.indexOf("/"),n=o===-1?t:t.slice(0,o+1),f=n.endsWith("/");return{key:n,size:f?"-":b(e.size),modified:e.lastModified}}).filter((e,t,o)=>e.key!==""&&o.findIndex(n=>n.key===e.key)===t),z=m(x,l,"objects","object",[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}]);console.log(z)}export{W as default};
|
package/dist/lib/mk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b}from"../chunk-TD2HGNDY.js";import"../chunk-S77OAN6Y.js";import{f as m}from"../chunk-LCWHZUZZ.js";import{a as e}from"../chunk-JRALYIRA.js";import{b as h}from"../chunk-
|
|
1
|
+
import{b}from"../chunk-TD2HGNDY.js";import"../chunk-S77OAN6Y.js";import{f as m}from"../chunk-LCWHZUZZ.js";import{a as e}from"../chunk-JRALYIRA.js";import{b as h}from"../chunk-SAPK5MRQ.js";import{a as o}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{createBucket as y,put as j}from"@tigrisdata/storage";async function C(t){let f=e(t,["path"]);f||o("path argument is required");let{bucket:s,path:n}=m(f);s||o("Invalid path");let u=await h(),d=e(t,["json"])?"json":e(t,["format","f","F"],"table");if(n){let r=n.endsWith("/")?n:`${n}/`,{error:a}=await j(r,"",{config:{...u,bucket:s}});a&&o(a),console.log(d==="json"?JSON.stringify({action:"created",type:"folder",bucket:s,path:r}):`Folder '${s}/${r}' created`),process.exit(0)}else{let a=e(t,["public"])?"public":e(t,["access","a","A"]),S=e(t,["enableSnapshots","enable-snapshots","s","S"]),k=e(t,["defaultTier","default-tier","t","T"]),c=e(t,["locations","l","L"]),i=e(t,["fork-of","forkOf","fork"]),l=e(t,["source-snapshot","sourceSnapshot","source-snap"]),g=e(t,["region","r","R"]),w=e(t,["consistency","c","C"]);g!==void 0&&(console.warn("Warning: --region is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),c===void 0&&(c=g)),w!==void 0&&console.warn("Warning: --consistency is deprecated, use --locations instead. See https://www.tigrisdata.com/docs/buckets/locations/"),l&&!i&&o("--source-snapshot requires --fork-of");let{error:p}=await y(s,{defaultTier:k??"STANDARD",enableSnapshot:S===!0,access:a??"private",locations:b(c??"global"),...i?{sourceBucketName:i}:{},...l?{sourceBucketSnapshot:l}:{},config:u});p&&o(p),console.log(d==="json"?JSON.stringify({action:"created",type:"bucket",name:s}):`Bucket '${s}' created`),process.exit(0)}}export{C as default};
|
package/dist/lib/mv.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as J}from"../chunk-EKW6XTGL.js";import{a as y}from"../chunk-CQCBYE3X.js";import{a as W,b as x}from"../chunk-S77OAN6Y.js";import{a as E,b as R,d as A,g as U,h as D,i as z}from"../chunk-LCWHZUZZ.js";import{a as h}from"../chunk-JRALYIRA.js";import{b as T}from"../chunk-
|
|
1
|
+
import{a as J}from"../chunk-EKW6XTGL.js";import{a as y}from"../chunk-CQCBYE3X.js";import{a as W,b as x}from"../chunk-S77OAN6Y.js";import{a as E,b as R,d as A,g as U,h as D,i as z}from"../chunk-LCWHZUZZ.js";import{a as h}from"../chunk-JRALYIRA.js";import{b as T}from"../chunk-SAPK5MRQ.js";import{a as n}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{get as L,put as q,remove as I,list as Q,head as V}from"@tigrisdata/storage";var m=!1;async function X(s){let l=h(s,["src"]),f=h(s,["dest"]),g=h(s,["force","f","F","yes","y"]),b=!!h(s,["recursive","r"]);m=(h(s,["json"])?"json":h(s,["format"],"table"))==="json",(!l||!f)&&n("both src and dest arguments are required"),(!E(l)||!E(f))&&n("Both src and dest must be remote Tigris paths (t3:// or tigris://)");let e=R(l),o=R(f);e.bucket||n("Invalid source path"),o.bucket||n("Invalid destination path");let k=l.endsWith("/");!e.path&&!k&&n("Cannot move a bucket. Provide a path within the bucket.");let i=await T({withCredentialProvider:!0}),u=e.path.includes("*"),a=e.path.endsWith("/")||!e.path&&k;if(!u&&!a&&e.path&&(a=await A(e.bucket,e.path,i)),a&&!u&&!b&&n("Source is a remote folder (not moved). Use -r to move recursively."),u||a){let t=u?D(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",c=!u&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",d=[o.path?.replace(/\/$/,"")||"",c].filter(Boolean).join("/"),B=d?`${d}/`:"";e.bucket===o.bucket&&t===B&&n("Source and destination are the same");let{items:_,error:O}=await z(e.bucket,t||void 0,i);O&&n(O);let v=_.filter(r=>r.name!==t);if(u){let r=e.path.split("/").pop(),p=U(r);v=v.filter(w=>{let P=t?w.name.slice(t.length):w.name;return!b&&P.includes("/")?!1:p.test(P.split("/").pop())})}let{data:G}=await Q({prefix:t,limit:1,config:{...i,bucket:e.bucket}}),S=t?G?.items?.some(r=>r.name===t):!1;if(v.length===0&&!S){console.log(m?JSON.stringify({action:"moved",count:0}):"No objects to move");return}let H=v.length+(S?1:0);if(!g&&(W("Use --yes to skip confirmation"),!await x(`Are you sure you want to move ${H} object(s)?`))){m||console.log("Aborted");return}let $=0;for(let r of v){let p=t?r.name.slice(t.length):r.name,w=d?`${d}/${p}`:p,P=await C(i,e.bucket,r.name,o.bucket,w);P.error?console.error(`Failed to move ${r.name}: ${P.error}`):(m||console.log(`Moved t3://${e.bucket}/${r.name} -> t3://${o.bucket}/${w}`),$++)}let j=!1;if(S)if(d){let r=`${d}/`,p=await C(i,e.bucket,t,o.bucket,r);p.error?console.error(`Failed to move folder marker: ${p.error}`):j=!0}else{let{error:r}=await I(t,{config:{...i,bucket:e.bucket}});r?console.error(`Failed to remove source folder marker: ${r.message}`):j=!0}$===0&&j&&($=1),console.log(m?JSON.stringify({action:"moved",count:$}):`Moved ${$} object(s)`)}else{let t=e.path.split("/").pop(),c;if(o.path?o.path.endsWith("/")?c=`${o.path}${t}`:await A(o.bucket,o.path,i)?c=`${o.path}/${t}`:c=o.path:c=t,e.bucket===o.bucket&&e.path===c&&n("Source and destination are the same"),!g&&(W("Use --yes to skip confirmation"),!await x(`Are you sure you want to move 't3://${e.bucket}/${e.path}'?`))){m||console.log("Aborted");return}let M=await C(i,e.bucket,e.path,o.bucket,c,!m);M.error&&n(M.error),console.log(m?JSON.stringify({action:"moved",count:1,src:`t3://${e.bucket}/${e.path}`,dest:`t3://${o.bucket}/${c}`}):`Moved t3://${e.bucket}/${e.path} -> t3://${o.bucket}/${c}`)}process.exit(0)}async function C(s,l,f,g,b,F=!1){if(f.endsWith("/")){let{error:a}=await q(b,"",{config:{...s,bucket:g}});if(a)return{error:a.message};let{error:t}=await I(f,{config:{...s,bucket:l}});return t?{error:`Copied but failed to delete source: ${t.message}`}:{}}let{data:N}=await V(f,{config:{...s,bucket:l}}),e=N?.size,{data:o,error:k}=await L(f,"stream",{config:{...s,bucket:l}});if(k)return{error:k.message};let{error:i}=await q(b,o,{...J(e),onUploadProgress:F?({loaded:a})=>{if(e!==void 0&&e>0){let t=Math.round(a/e*100);process.stdout.write(`\rMoving: ${y(a)} / ${y(e)} (${t}%)`)}else process.stdout.write(`\rMoving: ${y(a)}`)}:void 0,config:{...s,bucket:g}});if(F&&process.stdout.write("\r"+" ".repeat(60)+"\r"),i)return{error:i.message};let{error:u}=await I(f,{config:{...s,bucket:l}});return u?{error:`Copied but failed to delete source: ${u.message}`}:{}}export{X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p,b}from"../../chunk-S77OAN6Y.js";import{a as n}from"../../chunk-JRALYIRA.js";import{b as j}from"../../chunk-
|
|
1
|
+
import{a as p,b}from"../../chunk-S77OAN6Y.js";import{a as n}from"../../chunk-JRALYIRA.js";import{b as j}from"../../chunk-SAPK5MRQ.js";import{a,b as k,c as y}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as l,d as f,i as d}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{remove as O}from"@tigrisdata/storage";var e=d("objects","delete");async function q(s){u(e);let x=n(s,["json"])?"json":n(s,["format","f","F"],"table"),r=n(s,["bucket"]),i=n(s,["key"]),A=n(s,["force","yes","y"]);r||(f(e,"Bucket name is required"),a("Bucket name is required",e)),i||(f(e,"Object key is required"),a("Object key is required",e));let h=await j(),g=Array.isArray(i)?i:[i];if(!A&&(p("Use --yes to skip confirmation"),!await b(`Delete ${g.length} object(s) from '${r}'?`))){console.log("Aborted");return}let m=[],c=[];for(let t of g){let{error:o}=await O(t,{config:{...h,bucket:r}});o?(f(e,o.message,{key:t}),c.push({key:t,error:o.message})):(m.push(t),l(e,{key:t}))}if(x==="json"){let t=k(e,{bucket:r}),o={action:"deleted",bucket:r,keys:m,errors:c};t.length>0&&(o.nextActions=t),console.log(JSON.stringify(o))}c.length>0&&a(c[0].error,e),y(e,{bucket:r})}export{q as default};
|
package/dist/lib/objects/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"../../chunk-JRALYIRA.js";import{b as j}from"../../chunk-
|
|
1
|
+
import{a as r}from"../../chunk-JRALYIRA.js";import{b as j}from"../../chunk-SAPK5MRQ.js";import{a as g}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as u,c,d as m,i as h}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{createWriteStream as y,writeFileSync as O}from"fs";import{Readable as b}from"stream";import{pipeline as k}from"stream/promises";import{extname as q}from"path";import{get as w}from"@tigrisdata/storage";var t=h("objects","get"),v=new Set([".js",".ts",".jsx",".tsx",".mjs",".cjs",".py",".rb",".php",".java",".go",".rs",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".scala",".clj",".ex",".exs",".erl",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".json",".yaml",".yml",".toml",".ini",".cfg",".conf",".xml",".plist",".env",".properties",".html",".htm",".css",".scss",".sass",".less",".styl",".md",".markdown",".mdx",".rst",".txt",".text",".csv",".tsv",".log",".ejs",".hbs",".pug",".jade",".njk",".twig",".liquid",".svg",".gitignore",".dockerignore",".editorconfig"]);function F(e,p){let i=q(p||e).toLowerCase();return v.has(i)?"string":"stream"}async function T(e){u(t);let l=r(e,["json"])?"json":r(e,["format","f","F"],"table"),i=r(e,["bucket"]),o=r(e,["key"]),s=r(e,["output","o","O"]),x=r(e,["mode","m","M"]),f=r(e,["snapshot-version","snapshotVersion","snapshot"]);i||(m(t,"Bucket name is required"),g("Bucket name is required",t)),o||(m(t,"Object key is required"),g("Object key is required",t));let d=await j();if((x||F(o,s))==="stream"){let{data:a,error:n}=await w(o,"stream",{...f?{snapshotVersion:f}:{},config:{...d,bucket:i}});if(n&&(m(t,n.message),g(n,t)),s){let S=y(s);await k(b.fromWeb(a),S),c(t,{key:o,output:s}),l==="json"&&console.log(JSON.stringify({action:"downloaded",bucket:i,key:o,output:s}))}else await k(b.fromWeb(a),process.stdout),c(t)}else{let{data:a,error:n}=await w(o,"string",{...f?{snapshotVersion:f}:{},config:{...d,bucket:i}});n&&(m(t,n.message),g(n,t)),s?(O(s,a),c(t,{key:o,output:s}),l==="json"&&console.log(JSON.stringify({action:"downloaded",bucket:i,key:o,output:s}))):(console.log(a),c(t))}}export{T as default};
|
package/dist/lib/objects/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h,f as k}from"../../chunk-CQCBYE3X.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-
|
|
1
|
+
import{a as h,f as k}from"../../chunk-CQCBYE3X.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-SAPK5MRQ.js";import{a}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as d,d as n,e as u,i as g}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{list as z}from"@tigrisdata/storage";var t=g("objects","list");async function S(o){p(t);let c=e(o,["bucket"]),b=e(o,["prefix","p","P"]),j=e(o,["json"])?"json":e(o,["format","f","F"],"table"),f=e(o,["snapshot-version","snapshotVersion","snapshot"]);c||(n(t,"Bucket name is required"),a("Bucket name is required",t));let y=await l(),{data:i,error:r}=await z({prefix:b||void 0,...f?{snapshotVersion:f}:{},config:{...y,bucket:c}});if(r&&(n(t,r.message),a(r,t)),!i.items||i.items.length===0){u(t);return}let m=i.items.map(s=>({key:s.name,size:h(s.size),modified:s.lastModified})),x=k(m,j,"objects","object",[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}]);console.log(x),d(t,{count:m.length})}export{S as default};
|
package/dist/lib/objects/put.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as j}from"../../chunk-EKW6XTGL.js";import{a as n,f as k}from"../../chunk-CQCBYE3X.js";import{a as t}from"../../chunk-JRALYIRA.js";import{b as h}from"../../chunk-
|
|
1
|
+
import{a as j}from"../../chunk-EKW6XTGL.js";import{a as n,f as k}from"../../chunk-CQCBYE3X.js";import{a as t}from"../../chunk-JRALYIRA.js";import{b as h}from"../../chunk-SAPK5MRQ.js";import{a,c as S}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b,c as g,d as s,i as y}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{createReadStream as P,statSync as x}from"fs";import{Readable as z}from"stream";import{put as U}from"@tigrisdata/storage";var e=y("objects","put");async function C(r){b(e);let c=t(r,["bucket"]),d=t(r,["key"]),i=t(r,["file"]),T=t(r,["access","a","A"],"private"),q=t(r,["content-type","contentType","t","T"]),w=t(r,["json"])?"json":t(r,["format","f","F"],"table");c||(s(e,"Bucket name is required"),a("Bucket name is required",e)),d||(s(e,"Object key is required"),a("Object key is required",e));let F=!process.stdin.isTTY;!i&&!F&&(s(e,"File path is required (or pipe data via stdin)"),a("File path is required (or pipe data via stdin)",e));let m,o;if(i){try{o=x(i).size}catch{s(e,`File not found: ${i}`),a(`File not found: ${i}`,e)}let u=P(i);m=z.toWeb(u)}else m=z.toWeb(process.stdin);let R=await h({withCredentialProvider:!0}),$=i?j(o):{multipart:!0,partSize:5*1024*1024,queueSize:8},{data:p,error:f}=await U(d,m,{access:T==="public"?"public":"private",contentType:q,...$,onUploadProgress:({loaded:u,percentage:l})=>{o!==void 0&&o>0?process.stdout.write(`\rUploading: ${n(u)} / ${n(o)} (${l}%)`):process.stdout.write(`\rUploading: ${n(u)}`)},config:{...R,bucket:c}});process.stdout.write("\r"+" ".repeat(60)+"\r"),f&&(s(e,f.message),a(f,e));let v=[{path:p.path,size:n(p.size??o??0),contentType:p.contentType||"-",modified:p.modified}],O=k(v,w,"objects","object",[{key:"path",header:"Path"},{key:"size",header:"Size"},{key:"contentType",header:"Content-Type"},{key:"modified",header:"Modified"}]);console.log(O),g(e,{key:d,bucket:c}),S(e,{key:d,bucket:c})}export{C as default};
|
package/dist/lib/objects/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-
|
|
1
|
+
import{a as t}from"../../chunk-JRALYIRA.js";import{b as l}from"../../chunk-SAPK5MRQ.js";import{a as i}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as g,d as c,i as m}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{updateObject as d}from"@tigrisdata/storage";var e=m("objects","set");async function k(r){f(e);let p=t(r,["json"])?"json":t(r,["format","f","F"],"table"),s=t(r,["bucket"]),n=t(r,["key"]),a=t(r,["access","a","A"]),o=t(r,["new-key","n","newKey"]);s||(c(e,"Bucket name is required"),i("Bucket name is required",e)),n||(c(e,"Object key is required"),i("Object key is required",e)),a||(c(e,"Access level is required (--access public|private)"),i("Access level is required (--access public|private)",e));let b=await l(),{error:u}=await d(n,{access:a==="public"?"public":"private",...o&&{key:o},config:{...b,bucket:s}});u&&(c(e,u.message),i(u,e)),p==="json"&&console.log(JSON.stringify({action:"updated",bucket:s,key:n,access:a,...o?{newKey:o}:{}})),g(e,{key:n,bucket:s})}export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f}from"../../chunk-GZ7JBHFT.js";import{a as h}from"../../chunk-JRALYIRA.js";import{b as d}from"../../chunk-
|
|
1
|
+
import{a as f}from"../../chunk-GZ7JBHFT.js";import{a as h}from"../../chunk-JRALYIRA.js";import{b as d}from"../../chunk-SAPK5MRQ.js";import{a as r,c}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as e,c as a,d as n,g as s,i as g}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{g as l,k as u,s as m}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{createOrganization as x}from"@tigrisdata/iam";var i=g("organizations","create");async function F(p){if(e(i),m()!=="oauth"){u()?console.log(`You are using access key credentials, which belong to a single organization.
|
|
2
2
|
Organization creation is only available with OAuth login.
|
|
3
3
|
|
|
4
4
|
Run "tigris login" to login with your Tigris account.`):console.log('Not authenticated. Please run "tigris login" to login with your Tigris account.');return}let y=l();if(f(y??void 0)){console.log(`Organization creation is not available for Fly.io users.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as I,b}from"../../chunk-GZ7JBHFT.js";import{f as T}from"../../chunk-CQCBYE3X.js";import{a as x}from"../../chunk-S77OAN6Y.js";import{a as c}from"../../chunk-JRALYIRA.js";import{b as F}from"../../chunk-
|
|
1
|
+
import{a as I,b}from"../../chunk-GZ7JBHFT.js";import{f as T}from"../../chunk-CQCBYE3X.js";import{a as x}from"../../chunk-S77OAN6Y.js";import{a as c}from"../../chunk-JRALYIRA.js";import{b as F}from"../../chunk-SAPK5MRQ.js";import{a as y}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as h,c as r,d as p,e as z,i as w}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import{b as C}from"../../chunk-E4MLGABW.js";import{f as O,g as k,k as S,s as j}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listOrganizations as $}from"@tigrisdata/iam";import q from"enquirer";var i=w("organizations","list");async function v(l){if(h(i),j()!=="oauth"){S()?console.log(`You are using access key credentials, which belong to a single organization.
|
|
2
2
|
Organization listing and selection is only available with OAuth login.
|
|
3
3
|
|
|
4
4
|
Run "tigris login" to login with your Tigris account.`):console.log('Not authenticated. Please run "tigris login" to login with your Tigris account.');return}let g=c(l,["json"])?"json":c(l,["format","f","F"],"select"),U=await C().getAccessToken(),s=await b(U),A=s?.some(t=>I(t.id))??!1,n;if(A&&s)n=s.map(t=>({id:t.id,name:t.name,slug:t.name}));else{let t=await F(),{data:d,error:a}=await $({config:t});a&&(p(i,a.message),y(a,i)),n=d?.organizations??[]}if(n.length===0){z(i);return}let o=k();if(g==="select"){let t=n.map(e=>({name:e.id,message:`${e.name} (${e.id})`,hint:e.id===o?"currently selected":void 0}));x("Use --format table or --format json");let u=(await q.prompt({type:"select",name:"organization",message:"Select an organization:",choices:t.map(e=>e.message),initial:o?n.findIndex(e=>e.id===o):0})).organization.match(/\(([^)]+)\)$/),f=u?u[1]:n[0].id;await O(f);let M=n.find(e=>e.id===f);r(i,{name:M?.name});return}let m=n.map(t=>({id:t.id,name:t.name,slug:t.slug,selected:t.id===o?"*":""})),E=T(m,g,"organizations","organization",[{key:"selected",header:" ",width:1},{key:"id",header:"ID"},{key:"name",header:"Name"},{key:"slug",header:"Slug"}]);console.log(E),r(i,{count:m.length})}export{v as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as z}from"../../chunk-JRALYIRA.js";import{b as h}from"../../chunk-
|
|
1
|
+
import{a as z}from"../../chunk-JRALYIRA.js";import{b as h}from"../../chunk-SAPK5MRQ.js";import{a as e,c as u}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as c,c as l,d as a,i as m}from"../../chunk-2JHVFROL.js";import"../../chunk-BETAO4PB.js";import"../../chunk-E4MLGABW.js";import{f as d,k as f,s as p}from"../../chunk-DOUR5YEY.js";import"../../chunk-KH63ANUX.js";import"../../chunk-2XAO2OYD.js";import{listOrganizations as $}from"@tigrisdata/iam";var n=m("organizations","select");async function b(O){if(c(n),p()!=="oauth"){f()?console.log(`You are using access key credentials, which belong to a single organization.
|
|
2
2
|
Organization selection is only available with OAuth login.
|
|
3
3
|
|
|
4
4
|
Run "tigris login" to login with your Tigris account.`):console.log('Not authenticated. Please run "tigris login" to login with your Tigris account.');return}let i=z(O,["name","N"]);i||(a(n,"Organization name or ID is required"),e("Organization name or ID is required",n));let w=await h(),{data:y,error:r}=await $({config:w});r&&(a(n,r.message),e(r,n));let s=y?.organizations??[],o=s.find(t=>t.id===i||t.name===i);if(!o){let t=s.map(g=>` - ${g.name} (${g.id})`).join(`
|
package/dist/lib/presign.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as I}from"../chunk-CQCBYE3X.js";import{f as w}from"../chunk-LCWHZUZZ.js";import{a as n}from"../chunk-JRALYIRA.js";import{a as k,b as K}from"../chunk-
|
|
1
|
+
import{b as I}from"../chunk-CQCBYE3X.js";import{f as w}from"../chunk-LCWHZUZZ.js";import{a as n}from"../chunk-JRALYIRA.js";import{a as k,b as K}from"../chunk-SAPK5MRQ.js";import{a as s}from"../chunk-LQ4BU234.js";import"../chunk-DV3LCXRH.js";import"../chunk-2JHVFROL.js";import"../chunk-BETAO4PB.js";import{b as h}from"../chunk-E4MLGABW.js";import{g as u}from"../chunk-DOUR5YEY.js";import{c as p}from"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{getPresignedUrl as A}from"@tigrisdata/storage";import{listAccessKeys as x}from"@tigrisdata/iam";import P from"enquirer";var{prompt:v}=P;async function C(i){let m=n(i,["path"]);m||s("path argument is required");let{bucket:r,path:a}=w(m);r||s("Invalid path"),a||s("Object key is required");let f=n(i,["method","m"])??"get",o=parseInt(n(i,["expires-in","expiresIn","e"])??"3600",10),l=n(i,["json"])?"json":n(i,["format","f"])??"url",t=n(i,["access-key","accessKey"]),g=await K(),e;t?e=t:g.accessKeyId?e=g.accessKeyId:(await k()!=="oauth"&&s("Presigning requires an access key. Pass --access-key or configure credentials."),e=await b(r)),e||s("Presigning requires an access key. Pass --access-key or configure credentials.");let{data:c,error:y}=await A(a,{method:f,expiresIn:o,accessKeyId:e,config:{...g,bucket:r}});y&&s(y),console.log(l==="json"?I({url:c.url,expiresIn:c.expiresIn,method:f,bucket:r,key:a}):c.url),process.exit(0)}async function b(i){process.stdin.isTTY||s("Presigning requires an access key. Pass --access-key tid_...");let r=await h().getAccessToken(),a=u(),f=p(),{data:o,error:d}=await x({config:{sessionToken:r,organizationId:a??void 0,iamEndpoint:f.iamEndpoint}});d&&s(d),(!o.accessKeys||o.accessKeys.length===0)&&s('No access keys found. Create one with "tigris access-keys create <name>"');let l=o.accessKeys.filter(e=>e.status==="active"&&e.roles?.some(c=>c.bucket===i||c.bucket==="*")),t;if(l.length>0)t=l;else{let e=o.accessKeys.filter(c=>c.status==="active");e.length===0&&s('No active access keys found. Create one with "tigris access-keys create <name>"'),console.error(`No access keys with explicit access to bucket "${i}" found. Showing all active keys.`),t=e}if(t.length===1)return console.error(`Using access key: ${t[0].name} (${t[0].id})`),t[0].id;let{selectedKey:g}=await v({type:"select",name:"selectedKey",message:"Select an access key for presigning:",choices:t.map(e=>({name:e.id,message:`${e.name} (${e.id})`}))});return g}export{C as default};
|
package/dist/lib/rm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v,b as h}from"../chunk-S77OAN6Y.js";import{a as P,b as W,d as I,g as N,h as O,i as E}from"../chunk-LCWHZUZZ.js";import{a as f}from"../chunk-JRALYIRA.js";import{b as A}from"../chunk-
|
|
1
|
+
import{a as v,b as h}from"../chunk-S77OAN6Y.js";import{a as P,b as W,d as I,g as N,h as O,i as E}from"../chunk-LCWHZUZZ.js";import{a as f}from"../chunk-JRALYIRA.js";import{b as A}from"../chunk-SAPK5MRQ.js";import{a as s}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{remove as b,removeBucket as M,list as U}from"@tigrisdata/storage";var i=!1;async function T(m){let g=f(m,["path"]),$=f(m,["force","f","F","yes","y"]),k=!!f(m,["recursive","r"]);i=(f(m,["json"])?"json":f(m,["format"],"table"))==="json",g||s("path argument is required"),P(g)||s("Path must be a remote Tigris path (t3:// or tigris://)");let{bucket:e,path:o}=W(g);e||s("Invalid path");let n=await A(),R=g.endsWith("/");if(!o&&!R){if(!$&&(v("Use --yes to skip confirmation"),!await h(`Are you sure you want to delete bucket '${e}'?`))){i||console.log("Aborted");return}let{error:r}=await M(e,{config:n});r&&s(r),console.log(i?JSON.stringify({action:"removed",bucket:e}):`Removed bucket '${e}'`);return}let a=o.includes("*"),u=o.endsWith("/")||!o&&R;if(!a&&!u&&(u=await I(e,o,n)),u&&!a&&!k&&s("Source is a remote folder (not removed). Use -r to remove recursively."),a||u){let r=a?O(o):o?o.endsWith("/")?o:`${o}/`:"",{items:w,error:j}=await E(e,r||void 0,n);j&&s(j);let d=w;if(a){let t=o.split("/").pop(),l=N(t);d=d.filter(S=>{let x=r?S.name.slice(r.length):S.name;return!k&&x.includes("/")?!1:l.test(x.split("/").pop())})}let c=r,J=d.some(t=>t.name===c),y=!1;if(!J&&!a){let{data:t}=await U({prefix:c,limit:1,config:{...n,bucket:e}});y=t?.items?.some(l=>l.name===c)||!1}let F=d.length+(y?1:0);if(F===0){console.log(i?JSON.stringify({action:"removed",count:0}):"No objects to remove");return}if(!$&&(v("Use --yes to skip confirmation"),!await h(`Are you sure you want to delete ${F} object(s)?`))){i||console.log("Aborted");return}let p=0;for(let t of d){let{error:l}=await b(t.name,{config:{...n,bucket:e}});l?console.error(`Failed to remove ${t.name}: ${l.message}`):(i||console.log(`Removed t3://${e}/${t.name}`),p++)}if(y){let{error:t}=await b(c,{config:{...n,bucket:e}});t?console.error(`Failed to remove ${c}: ${t.message}`):(i||console.log(`Removed t3://${e}/${c}`),p++)}console.log(i?JSON.stringify({action:"removed",count:p}):`Removed ${p} object(s)`)}else{if(!$&&(v("Use --yes to skip confirmation"),!await h(`Are you sure you want to delete 't3://${e}/${o}'?`))){i||console.log("Aborted");return}let{error:r}=await b(o,{config:{...n,bucket:e}});r&&s(r),console.log(i?JSON.stringify({action:"removed",count:1,path:`t3://${e}/${o}`}):`Removed t3://${e}/${o}`)}process.exit(0)}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as l}from"../../chunk-CQCBYE3X.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as d}from"../../chunk-
|
|
1
|
+
import{f as l}from"../../chunk-CQCBYE3X.js";import{a as e}from"../../chunk-JRALYIRA.js";import{b as d}from"../../chunk-SAPK5MRQ.js";import{a as i}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as p,d as a,e as u,i as g}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{listBucketSnapshots as j}from"@tigrisdata/storage";var t=g("snapshots","list");async function S(r){f(t);let m=e(r,["name"]),h=e(r,["json"])?"json":e(r,["format","f","F"],"table");m||(a(t,"Bucket name is required"),i("Bucket name is required",t));let k=await d(),{data:o,error:n}=await j(m,{config:k});if(n&&(a(t,n.message),i(n,t)),!o||o.length===0){u(t);return}let c=o.map(s=>({name:s.name||"",version:s.version||"",created:s.creationDate})),y=l(c,h,"snapshots","snapshot",[{key:"name",header:"Name"},{key:"version",header:"Version"},{key:"created",header:"Created"}]);console.log(y),p(t,{count:c.length})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../../chunk-JRALYIRA.js";import{b as g}from"../../chunk-
|
|
1
|
+
import{a as s}from"../../chunk-JRALYIRA.js";import{b as g}from"../../chunk-SAPK5MRQ.js";import{a as r}from"../../chunk-LQ4BU234.js";import"../../chunk-DV3LCXRH.js";import{b as p,c,d as o,i as f}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{createBucketSnapshot as h}from"@tigrisdata/storage";var t=f("snapshots","take");async function k(a){p(t);let n=s(a,["name"]),i=s(a,["snapshot-name","snapshotName"]);n||(o(t,"Bucket name is required"),r("Bucket name is required",t));let u=await g(),{data:m,error:e}=await h(n,{name:i,config:u});e&&(o(t,e.message),r(e,t)),c(t,{name:n,snapshotName:i||m?.snapshotVersion,version:m?.snapshotVersion})}export{k as default};
|
package/dist/lib/stat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x}from"../chunk-WIOXQDND.js";import{a as v,f}from"../chunk-CQCBYE3X.js";import{f as O}from"../chunk-LCWHZUZZ.js";import{a as n}from"../chunk-JRALYIRA.js";import{b as y}from"../chunk-
|
|
1
|
+
import{a as x}from"../chunk-WIOXQDND.js";import{a as v,f}from"../chunk-CQCBYE3X.js";import{f as O}from"../chunk-LCWHZUZZ.js";import{a as n}from"../chunk-JRALYIRA.js";import{b as y}from"../chunk-SAPK5MRQ.js";import{a as r}from"../chunk-LQ4BU234.js";import"../chunk-DV3LCXRH.js";import{b,c as u,d as i,i as j}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{getStats as V,getBucketInfo as A,head as M}from"@tigrisdata/storage";var t=j("stat");async function z(c){b(t);let S=n(c,["path"]),l=n(c,["json"])?"json":n(c,["format","f","F"],"table"),k=n(c,["snapshot-version","snapshotVersion","snapshot"]),p=await y();if(!S){let{data:a,error:e}=await V({config:p});e&&(i(t,e.message),r(e,t));let d=[{metric:"Active Buckets",value:String(a.stats.activeBuckets)},{metric:"Total Objects",value:String(a.stats.totalObjects)},{metric:"Total Unique Objects",value:String(a.stats.totalUniqueObjects)},{metric:"Total Storage",value:v(a.stats.totalStorageBytes)}],h=f(d,l,"stats","stat",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(h),u(t),process.exit(0)}let{bucket:s,path:m}=O(S);if(s||(i(t,"Invalid path"),r("Invalid path",t)),!m||m==="/"){let{data:a,error:e}=await A(s,{config:p});e&&(i(t,e.message),r(e,t));let d=x(a).map(({label:I,value:T})=>({metric:I,value:T})),h=f(d,l,"bucket-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(h),u(t,{bucket:s}),process.exit(0)}let{data:o,error:g}=await M(m,{...k?{snapshotVersion:k}:{},config:{...p,bucket:s}});g&&(i(t,g.message),r(g,t)),o||(i(t,"Object not found"),r("Object not found",t));let w=[{metric:"Path",value:o.path},{metric:"Size",value:v(o.size)},{metric:"Content-Type",value:o.contentType||"N/A"},{metric:"Content-Disposition",value:o.contentDisposition||"N/A"},{metric:"Modified",value:o.modified.toISOString()}],B=f(w,l,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(B),u(t,{bucket:s,path:m}),process.exit(0)}export{z as default};
|
package/dist/lib/touch.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as c}from"../chunk-LCWHZUZZ.js";import{a as e}from"../chunk-JRALYIRA.js";import{b as s}from"../chunk-
|
|
1
|
+
import{f as c}from"../chunk-LCWHZUZZ.js";import{a as e}from"../chunk-JRALYIRA.js";import{b as s}from"../chunk-SAPK5MRQ.js";import{a as t}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{put as m}from"@tigrisdata/storage";async function p(n){let i=e(n,["path"]);i||t("path argument is required");let{bucket:o,path:r}=c(i);o||t("Invalid path"),r||t("Object key is required (use mk to create buckets)");let f=e(n,["json"])?"json":e(n,["format","f","F"],"table"),g=await s(),{error:a}=await m(r,"",{config:{...g,bucket:o}});a&&t(a),console.log(f==="json"?JSON.stringify({action:"created",bucket:o,path:r}):`Created '${o}/${r}'`),process.exit(0)}export{p as default};
|
package/dist/lib/whoami.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h}from"../chunk-JRALYIRA.js";import{b as C}from"../chunk-
|
|
1
|
+
import{a as h}from"../chunk-JRALYIRA.js";import{b as C}from"../chunk-SAPK5MRQ.js";import{a as m}from"../chunk-LQ4BU234.js";import"../chunk-DV3LCXRH.js";import{d as u,f,i as z}from"../chunk-2JHVFROL.js";import"../chunk-BETAO4PB.js";import{b as y}from"../chunk-E4MLGABW.js";import{g as w,k as $,s as j}from"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{listOrganizations as k}from"@tigrisdata/iam";var o=z("whoami");async function E(p={}){try{let I=h(p,["json"])?"json":h(p,["format","f","F"],"table"),l=j(),A=$(),d,g;if(l==="oauth"){let t=y();if(!await t.isAuthenticated()){f(o);return}let n=await t.getIdTokenClaims();d=n.email,g=n.sub}else if(A)d=void 0,g=A.accessKeyId;else{f(o);return}let e=[];e.push(""),e.push("User Information:"),e.push(` Email: ${d||"N/A"}`),e.push(` User ID: ${g||"N/A"}`);let s=[],r;if(l==="oauth"){let t=await C();r=w();let{data:i,error:n}=await k({config:t});if(n&&(u(o,n.message),m(n,o)),s=i?.organizations??[],s.length>0){if(e.push(""),e.push(`Organizations (${s.length}):`),s.forEach(a=>{let S=a.id===r?">":" ";e.push(` ${S} ${a.name} (${a.id})`)}),r){let a=s.find(O=>O.id===r);a&&(e.push(""),e.push(`Active: ${a.name}`))}}else e.push(""),e.push("Organizations: None")}else e.push(""),e.push("Login method: Access Key Credentials"),e.push(" (Organization listing requires OAuth login: tigris login)");if(I==="json"){let t={email:d,userId:g,loginMethod:l};if(l==="oauth"&&(t.organizations=s.map(i=>({id:i.id,name:i.name})),r)){let i=s.find(n=>n.id===r);i&&(t.activeOrganization=i.name)}console.log(JSON.stringify(t));return}e.push(""),console.log(e.join(`
|
|
2
2
|
`))}catch(c){c instanceof Error?u(o,c.message):u(o),m(c,o)}}export{E as default};
|
package/dist/utils/exit.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"../chunk-
|
|
1
|
+
import{a,b,c}from"../chunk-LQ4BU234.js";import"../chunk-DV3LCXRH.js";import"../chunk-2JHVFROL.js";import"../chunk-BETAO4PB.js";export{a as exitWithError,b as getSuccessNextActions,c as printNextActions};
|
package/dist/utils/messages.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i}from"../chunk-2JHVFROL.js";import"../chunk-BETAO4PB.js";export{a as interpolate,i as msg,f as printAlreadyDone,h as printDeprecated,e as printEmpty,d as printFailure,g as printHint,b as printStart,c as printSuccess};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c as b}from"../chunk-
|
|
1
|
+
import{b as a,c as b}from"../chunk-3B5GQHGD.js";import"../chunk-2XAO2OYD.js";export{b as checkForUpdates,a as isNewerVersion};
|
package/package.json
CHANGED
package/dist/chunk-5LRGY6RN.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as u}from"./chunk-BETAO4PB.js";var a={success:"\u2714",failure:"\u2716",hint:"\u2192"};function t(){return process.stdout.isTTY===!0}function o(s){let n=u(s.command,s.operation);if(n)return n.messages}function r(s,n){let e=s;return e=e.replace(/\\n/g,`
|
|
2
|
-
`),n&&(e=e.replace(/\{\{(\w+)\}\}/g,(i,c)=>{let g=n[c];return g!==void 0?String(g):`{{${c}}}`})),e}function l(s,n){if(!t())return;let e=o(s);e?.onStart&&console.log(r(e.onStart,n))}function f(s,n){if(!t())return;let e=o(s);e?.onSuccess&&console.log(`${a.success} ${r(e.onSuccess,n)}`)}function d(s,n,e){if(globalThis.__TIGRIS_JSON_MODE===!0)return;let i=o(s);i?.onFailure&&console.error(`${a.failure} ${r(i.onFailure,e)}`),n&&console.error(` ${n}`)}function m(s,n){if(!t())return;let e=o(s);e?.onEmpty&&console.log(r(e.onEmpty,n))}function M(s,n){if(!t())return;let e=o(s);e?.onAlreadyDone&&console.log(r(e.onAlreadyDone,n))}function x(s,n){if(!t())return;let e=o(s);e?.hint&&console.log(`${a.hint} ${r(e.hint,n)}`)}function S(s){t()&&console.warn(`\u26A0 Deprecated: ${s}`)}function C(s,n){return{command:s,operation:n}}export{r as a,l as b,f as c,d,m as e,M as f,x as g,S as h,C as i};
|
package/dist/chunk-FP2FMNEE.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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-beta.2";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};
|
|
File without changes
|