@tigrisdata/cli 2.6.2 → 2.8.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.
Files changed (77) hide show
  1. package/README.md +242 -80
  2. package/dist/auth/client.js +1 -1
  3. package/dist/auth/config.js +1 -1
  4. package/dist/auth/s3-client.js +1 -1
  5. package/dist/auth/storage.js +1 -1
  6. package/dist/chunk-2BGB3HM3.js +2 -0
  7. package/dist/chunk-2HJMXAYU.js +8 -0
  8. package/dist/{chunk-HE7E7ZMA.js → chunk-4CKYRXYB.js} +1 -1
  9. package/dist/{chunk-6U4U4JM6.js → chunk-7F4WI32C.js} +1 -1
  10. package/dist/chunk-BP52O7NB.js +1 -0
  11. package/dist/chunk-CQCBYE3X.js +6 -0
  12. package/dist/{chunk-QZXBLNMQ.js → chunk-DC3ZKGQV.js} +1 -1
  13. package/dist/{chunk-A3TXP5Y2.js → chunk-I52LJ637.js} +1 -1
  14. package/dist/{chunk-DJIPPZGR.js → chunk-KBDSESA4.js} +1 -1
  15. package/dist/chunk-LY55GPPO.js +1 -0
  16. package/dist/chunk-TF2BX3PY.js +10 -0
  17. package/dist/{chunk-JVB3Y42V.js → chunk-UUITLEOI.js} +1 -1
  18. package/dist/chunk-Y7MJZRR4.js +1 -0
  19. package/dist/cli.js +1 -1
  20. package/dist/constants.js +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/lib/access-keys/assign.js +2 -2
  23. package/dist/lib/access-keys/create.js +2 -2
  24. package/dist/lib/access-keys/delete.js +2 -2
  25. package/dist/lib/access-keys/get.js +2 -2
  26. package/dist/lib/access-keys/list.js +2 -2
  27. package/dist/lib/buckets/create.js +1 -1
  28. package/dist/lib/buckets/delete.js +1 -1
  29. package/dist/lib/buckets/get.js +1 -1
  30. package/dist/lib/buckets/list.js +1 -1
  31. package/dist/lib/buckets/set.js +1 -1
  32. package/dist/lib/configure/index.js +1 -1
  33. package/dist/lib/cp.js +1 -1
  34. package/dist/lib/credentials/test.js +1 -1
  35. package/dist/lib/forks/create.js +1 -1
  36. package/dist/lib/forks/list.js +1 -1
  37. package/dist/lib/iam/policies/create.js +2 -0
  38. package/dist/lib/iam/policies/delete.js +2 -0
  39. package/dist/lib/iam/policies/edit.js +2 -0
  40. package/dist/lib/iam/policies/get.js +2 -0
  41. package/dist/lib/iam/policies/list.js +2 -0
  42. package/dist/lib/iam/policies/utils.js +1 -0
  43. package/dist/lib/login/credentials.js +1 -1
  44. package/dist/lib/login/oauth.js +1 -1
  45. package/dist/lib/login/select.js +1 -1
  46. package/dist/lib/logout.js +1 -1
  47. package/dist/lib/ls.js +1 -1
  48. package/dist/lib/mk.js +1 -1
  49. package/dist/lib/mv.js +1 -1
  50. package/dist/lib/objects/delete.js +1 -1
  51. package/dist/lib/objects/get.js +1 -1
  52. package/dist/lib/objects/list.js +1 -1
  53. package/dist/lib/objects/put.js +1 -1
  54. package/dist/lib/objects/set.js +1 -0
  55. package/dist/lib/organizations/create.js +2 -2
  56. package/dist/lib/organizations/list.js +2 -2
  57. package/dist/lib/organizations/select.js +3 -3
  58. package/dist/lib/rm.js +1 -1
  59. package/dist/lib/snapshots/list.js +1 -1
  60. package/dist/lib/snapshots/take.js +1 -1
  61. package/dist/lib/stat.js +1 -0
  62. package/dist/lib/touch.js +1 -1
  63. package/dist/lib/whoami.js +1 -1
  64. package/dist/specs.yaml +386 -76
  65. package/dist/utils/format.js +1 -1
  66. package/dist/utils/messages.js +1 -1
  67. package/dist/utils/specs.js +1 -1
  68. package/dist/utils/update-check.js +1 -1
  69. package/package.json +5 -3
  70. package/postinstall.cjs +32 -0
  71. package/dist/chunk-4LGKN5DA.js +0 -1
  72. package/dist/chunk-D63SZLT5.js +0 -1
  73. package/dist/chunk-ESJWTUFN.js +0 -1
  74. package/dist/chunk-HGIJOGCZ.js +0 -6
  75. package/dist/chunk-TPUZYSCZ.js +0 -12
  76. package/dist/chunk-TUJTXB5G.js +0 -8
  77. package/dist/lib/_stat.js +0 -1
@@ -1 +1 @@
1
- import{a,b,c,d,e,f}from"../chunk-HGIJOGCZ.js";export{b as formatJson,f as formatOutput,a as formatSize,e as formatTable,d as formatXml,c as formatXmlObject};
1
+ import{a,b,c,d,e,f}from"../chunk-CQCBYE3X.js";export{b as formatJson,f as formatOutput,a as formatSize,e as formatTable,d as formatXml,c as formatXmlObject};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g}from"../chunk-A3TXP5Y2.js";import"../chunk-4LGKN5DA.js";export{g as msg,e as printAlreadyDone,d as printEmpty,c as printFailure,f as printHint,a as printStart,b as printSuccess};
1
+ import{a,b,c,d,e,f,g}from"../chunk-I52LJ637.js";import"../chunk-LY55GPPO.js";export{g as msg,e as printAlreadyDone,d as printEmpty,c as printFailure,f as printHint,a as printStart,b as printSuccess};
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunk-4LGKN5DA.js";export{d as buildPromptChoices,c as getArgumentSpec,b as getCommandSpec,a as loadSpecs};
1
+ import{a,b,c,d}from"../chunk-LY55GPPO.js";export{d as buildPromptChoices,c as getArgumentSpec,b as getCommandSpec,a as loadSpecs};
@@ -1 +1 @@
1
- import{b as a,c as b}from"../chunk-TUJTXB5G.js";import"../chunk-D63SZLT5.js";export{b as checkForUpdates,a as isNewerVersion};
1
+ import{b as a,c as b}from"../chunk-2HJMXAYU.js";import"../chunk-BP52O7NB.js";export{b as checkForUpdates,a as isNewerVersion};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tigrisdata/cli",
3
- "version": "2.6.2",
3
+ "version": "2.8.0",
4
4
  "description": "Command line interface for Tigris object storage",
5
5
  "type": "module",
6
6
  "exports": {
@@ -14,6 +14,7 @@
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
+ "postinstall.cjs",
17
18
  "README.md"
18
19
  ],
19
20
  "publishConfig": {
@@ -33,6 +34,7 @@
33
34
  "test:integration": "vitest run test/cli.test.ts",
34
35
  "publint": "publint",
35
36
  "updatedocs": "tsx scripts/update-docs.ts",
37
+ "postinstall": "node postinstall.cjs",
36
38
  "prepublishOnly": "npm run build",
37
39
  "clean": "rm -rf dist",
38
40
  "semantic-release": "semantic-release",
@@ -80,8 +82,8 @@
80
82
  "@aws-sdk/client-s3": "^3.908.0",
81
83
  "@aws-sdk/credential-providers": "^3.981.0",
82
84
  "@smithy/shared-ini-file-loader": "^4.4.3",
83
- "@tigrisdata/iam": "^1.1.0",
84
- "@tigrisdata/storage": "^2.12.2",
85
+ "@tigrisdata/iam": "^1.2.0",
86
+ "@tigrisdata/storage": "^2.13.0",
85
87
  "axios": "^1.12.2",
86
88
  "commander": "^11.0.0",
87
89
  "enquirer": "^2.4.1",
@@ -0,0 +1,32 @@
1
+ const { openSync, writeSync, closeSync } = require('fs');
2
+
3
+ try {
4
+ const tty = openSync('/dev/tty', 'w');
5
+
6
+ const banner = `
7
+ ┌───────────────────────────────────────────────────────────────────┐
8
+ │ │
9
+ │ _____ ___ ___ ___ ___ ___ ___ _ ___ │
10
+ │ |_ _|_ _/ __| _ \\_ _/ __| / __| | |_ _| │
11
+ │ | | | | (_ | /| |\\__ \\ | (__| |__ | | │
12
+ │ |_| |___\\___|_|_\\___|___/ \\___|____|___| │
13
+ │ │
14
+ │ To get started: │
15
+ │ $ tigris login │
16
+ │ │
17
+ │ For help: │
18
+ │ $ tigris help │
19
+ │ │
20
+ │ Tip - You can use 't3' as a shorthand for 'tigris': │
21
+ │ $ t3 login │
22
+ │ │
23
+ │ Docs: https://www.tigrisdata.com/docs/cli/ │
24
+ │ │
25
+ └───────────────────────────────────────────────────────────────────┘
26
+ `;
27
+
28
+ writeSync(tty, banner);
29
+ closeSync(tty);
30
+ } catch (e) {
31
+ // No TTY available (CI, Docker, non-interactive) — skip silently
32
+ }
@@ -1 +0,0 @@
1
- import{readFileSync as p}from"fs";import{join as a,dirname as c}from"path";import{fileURLToPath as m}from"url";import*as o from"yaml";var l=m(import.meta.url),u=c(l),s=null,f=a(u,"specs.yaml");function d(){if(!s){let n=p(f,"utf8");s=o.parse(n,{schema:"core"})}return s}function g(n,e){let r=d().commands.find(t=>t.name===n);return r?e&&r.operations?r.operations.find(t=>t.name===e)||null:r:null}function C(n,e,i){let r=g(n,i);return!r||!r.arguments?null:r.arguments.find(t=>t.name===e)||null}function h(n){return n.options?Array.isArray(n.options)&&typeof n.options[0]=="string"?n.options.map(e=>({name:e,message:e.charAt(0).toUpperCase()+e.slice(1),value:e})):Array.isArray(n.options)&&typeof n.options[0]=="object"?n.options.map(e=>({name:e.value,message:e.description?`${e.name} - ${e.description}`:e.name,value:e.value})):null:null}export{d as a,g as b,C as c,h as d};
@@ -1 +0,0 @@
1
- var t="https://t3.storage.dev",s="https://iam.storageapi.dev",o="https://registry.npmjs.org/@tigrisdata/cli/latest",e=864e5;export{t as a,s as b,o as c,e as d};
@@ -1 +0,0 @@
1
- import{b as f}from"./chunk-QZXBLNMQ.js";import{a as A,c as w}from"./chunk-6U4U4JM6.js";import{g as d,h as g,i as l,j as p,l as o,s as h}from"./chunk-JVB3Y42V.js";import{a as u}from"./chunk-D63SZLT5.js";import{S3Client as a}from"@aws-sdk/client-s3";import{fromIni as C}from"@aws-sdk/credential-providers";var r=w(),T=A();async function y(){return h()}async function O(){if(l()){let e=process.env.AWS_PROFILE||"default",s=await p(e),i=await C({profile:e})();return{accessKeyId:i.accessKeyId,secretAccessKey:i.secretAccessKey,endpoint:s.endpoint||r.endpoint||u,iamEndpoint:s.iamEndpoint||r.iamEndpoint}}let c=await y();if(c==="oauth"){let s=await f().getAccessToken();if(!d())throw new Error('No organization selected. Please run "tigris orgs select" first.');return{sessionToken:s,accessKeyId:"",secretAccessKey:"",endpoint:r.endpoint,organizationId:d()??void 0,iamEndpoint:r.iamEndpoint,authDomain:T.domain}}if(c==="credentials"){let e=o();if(e)return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,endpoint:e.endpoint}}let t=g();if(t)return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,endpoint:t.endpoint};let n=o();if(n)return{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey,endpoint:n.endpoint};throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}async function v(){if(l()){let e=process.env.AWS_PROFILE||"default",s=await p(e);return new a({region:"auto",endpoint:s.endpoint||r.endpoint||u,credentials:C({profile:e})})}let c=await y();if(c==="oauth"){let s=await f().getAccessToken(),i=d();if(!i)throw new Error('No organization selected. Please run "tigris orgs select" first.');let K=new a({region:"auto",endpoint:r.endpoint,credentials:{sessionToken:s,accessKeyId:"",secretAccessKey:""}});return K.middlewareStack.add(I=>async m=>{let E=m.request;return E.headers["x-Tigris-Namespace"]=i,await I(m)},{name:"x-Tigris-Namespace-Middleware",step:"build",override:!0}),K}if(c==="credentials"){let e=o();if(e)return new a({region:"auto",endpoint:e.endpoint,credentials:{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey}})}let t=g();if(t)return new a({region:"auto",endpoint:t.endpoint,credentials:{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey}});let n=o();if(n)return new a({region:"auto",endpoint:n.endpoint,credentials:{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey}});throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}async function z(){return l()||await y()!==null||g()!==null||o()!==null}export{y as a,O as b,v as c,z as d};
@@ -1,6 +0,0 @@
1
- function k(n){if(n===0)return"0 B";let e=["B","KB","MB","GB","TB"],t=Math.floor(Math.log(n)/Math.log(1024));return`${(n/Math.pow(1024,t)).toFixed(t>0?1:0)} ${e[t]}`}function l(n){return JSON.stringify(n,null,2)}function m(n){return String(n).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function w(n,e=" "){return Object.entries(n).map(([t,r])=>`${e}<${t}>${m(r)}</${t}>`).join(`
2
- `)}function T(n,e,t){let r=[`<${e}>`];return n.forEach(i=>{r.push(` <${t}>`),r.push(w(i," ")),r.push(` </${t}>`)}),r.push(`</${e}>`),r.join(`
3
- `)}function f(n){if(n==null)return"";if(n instanceof Date)return h(n);if(typeof n=="string"){let e=new Date(n);if(!isNaN(e.getTime())&&n.includes("T"))return h(e)}return String(n)}function h(n){return new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)}function x(n,e){return e.map(t=>{if(t.width)return t.width;let r=t.header.length,i=n.reduce((a,u)=>{let s=f(u[t.key]);return Math.max(a,s.length)},0);return Math.max(r,i)})}function j(n,e){let t=[],r=x(n,e),i="\u250C"+r.map(o=>"\u2500".repeat(o+2)).join("\u252C")+"\u2510",a="\u251C"+r.map(o=>"\u2500".repeat(o+2)).join("\u253C")+"\u2524",u="\u2514"+r.map(o=>"\u2500".repeat(o+2)).join("\u2534")+"\u2518";t.push(`
4
- `+i);let s="\u2502 "+e.map((o,c)=>o.header.padEnd(r[c])).join(" \u2502 ")+" \u2502";return t.push(s),t.push(a),n.forEach(o=>{let c=e.map((g,d)=>{let p=f(o[g.key]);return g.align==="right"?p.padStart(r[d]):p.padEnd(r[d])});t.push("\u2502 "+c.join(" \u2502 ")+" \u2502")}),t.push(u+`
5
- `),t.join(`
6
- `)}function $(n,e,t,r,i){switch(e){case"json":return l(n);case"xml":return T(n,t,r);default:return j(n,i)}}export{k as a,l as b,w as c,T as d,j as e,$ as f};
@@ -1,12 +0,0 @@
1
- import{a as C,c as A}from"./chunk-TUJTXB5G.js";import{a as w}from"./chunk-4LGKN5DA.js";import{Command as v}from"commander";import{existsSync as q}from"fs";import{join as c,dirname as k}from"path";import{fileURLToPath as R}from"url";process.on("unhandledRejection",e=>{(e===""||e===void 0)&&(console.error(`
2
- Operation cancelled`),process.exit(1)),console.error(`
3
- Error:`,e instanceof Error?e.message:e),process.exit(1)});process.on("uncaughtException",e=>{console.error(`
4
- Error:`,e.message),process.exit(1)});var P=R(import.meta.url),d=k(P),l=w();function y(e,t){return(t?[c(d,"lib",e,`${t}.js`),c(d,"lib",e,t,"index.js")]:[c(d,"lib",`${e}.js`),c(d,"lib",e,"index.js")]).some(o=>q(o))}function E(e){let t;e.type==="positional"?t=` ${e.name}`:(t=` --${e.name}`,e.alias&&e.alias.length===1&&(t+=`, -${e.alias}`));let n=26,o=t.length>=n?t+" ":t.padEnd(n),s=e.description;return e.options&&(Array.isArray(e.options)&&typeof e.options[0]=="string"?s+=` (options: ${e.options.join(", ")})`:s+=` (options: ${e.options.map(i=>i.value).join(", ")})`),e.default&&(s+=` [default: ${e.default}]`),e.required&&(s+=" [required]"),e["required-when"]&&(s+=` [required when: ${e["required-when"]}]`),e.multiple&&(s+=" [multiple values: comma-separated]"),e.type==="positional"&&(s+=" [positional argument]"),e.examples&&e.examples.length>0&&(s+=` (examples: ${e.examples.join(", ")})`),`${o}${s}`}function b(e){if(console.log(`
5
- ${l.name} ${e.name} - ${e.description}
6
- `),e.operations&&e.operations.length>0){let t=e.operations.filter(n=>y(e.name,n.name));t.length>0&&(console.log("Operations:"),t.forEach(n=>{let o=` ${n.name}`;if(n.alias){let i=Array.isArray(n.alias)?n.alias:[n.alias];o+=` (${i.join(", ")})`}let s=o.padEnd(24);console.log(`${s}${n.description}`)}),console.log())}e.arguments&&e.arguments.length>0&&(console.log("Arguments:"),e.arguments.forEach(t=>{console.log(E(t))}),console.log()),console.log(`Use "${l.name} ${e.name} <operation> help" for more information about an operation.`)}function U(e,t){console.log(`
7
- ${l.name} ${e.name} ${t.name} - ${t.description}
8
- `),t.arguments&&t.arguments.length>0&&(console.log("Arguments:"),t.arguments.forEach(n=>{console.log(E(n))}),console.log())}function V(e){return y(e.name)?!0:e.operations?e.operations.some(t=>y(e.name,t.name)):!1}function x(){console.log(`Tigris CLI Version: ${C}
9
- `),console.log(`Usage: tigris [command] [options]
10
- `),console.log("Commands:"),l.commands.filter(V).forEach(t=>{let n=` ${t.name}`;t.alias&&(n+=` (${t.alias})`);let o=n.padEnd(24);console.log(`${o}${t.description}`)}),console.log(`
11
- Use "${l.name} <command> help" for more information about a command.`)}function m(e,t=[]){t.forEach(n=>{if(n.type==="positional"){let o=n.required?`<${n.name}>`:`[${n.name}]`;e.argument(o,n.description)}else{let s=n.alias&&n.alias.length===1?`-${n.alias}, --${n.name}`:`--${n.name}`;n.type==="flag"||(n.type==="boolean"?s+=" [value]":n.options?s+=" <value>":s+=n.required||n["required-when"]?" <value>":" [value]"),e.option(s,n.description,n.default)}})}function g(e,t){for(let n of e){if(n["required-when"]){let[o,s]=n["required-when"].split("="),i=h(t,o,e),r=h(t,n.name,e);if(i===s&&!r)return console.error(`--${n.name} is required when --${o} is ${s}`),!1}if(n.required&&!h(t,n.name,e))return console.error(`--${n.name} is required`),!1}return!0}function h(e,t,n){if(n){let s=n.find(i=>i.name===t);if(s&&s.alias){let i=s.alias.charAt(0).toUpperCase()+s.alias.slice(1);if(e[i]!==void 0)return e[i]}}let o=[t,t.replace(/-/g,""),t.replace(/-/g,"").toLowerCase(),t.charAt(0).toUpperCase(),_(t)];for(let s of o)if(e[s]!==void 0)return e[s]}function _(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}async function D(e,t){let n=t?[`./lib/${e}/${t}.js`,`./lib/${e}/${t}/index.js`]:[`./lib/${e}.js`,`./lib/${e}/index.js`];for(let s of n){let i=await import(s).catch(()=>null);if(i)return{module:i,error:null}}return{module:null,error:`Command not found: ${t?`${e} ${t}`:e}`}}async function $(e,t,n=[],o={},s){if(s){let j=s.replace(/\\n/g,`
12
- `);console.log(j)}let{module:i,error:r}=await D(e,t);(r||!i)&&(console.error(r),process.exit(1));let a=t||e,p=i.default||i[a];typeof p!="function"&&(console.error(`Command not implemented: ${a}`),process.exit(1)),await p({...o,_positional:n})}var f=new v;f.name(l.name).description(l.description).version(l.version);function u(e,t,n){let o;"optsWithGlobals"in n&&typeof n.optsWithGlobals=="function"?o=n.optsWithGlobals():"opts"in n&&typeof n.opts=="function"?o=n.opts():o=n;let s={...o};return e.filter(r=>r.type==="positional").forEach((r,a)=>{t[a]!==void 0&&(r.multiple?s[r.name]=t[a].split(",").map(p=>p.trim()):s[r.name]=t[a])}),e.forEach(r=>{r.multiple&&r.type!=="positional"&&s[r.name]&&typeof s[r.name]=="string"&&(s[r.name]=s[r.name].split(",").map(a=>a.trim()))}),s}l.commands.forEach(e=>{let t=f.command(e.name).description(e.description);if(e.alias&&t.alias(e.alias),e.operations&&e.operations.length>0)if(e.operations.forEach(n=>{let o=t.command(n.name).description(n.description);n.alias&&(Array.isArray(n.alias)?n.alias:[n.alias]).forEach(i=>o.alias(i)),m(o,n.arguments),o.action(async(...s)=>{let i=s.pop(),r=s;n.arguments&&!g(n.arguments,u(n.arguments,r,i))||await $(e.name,n.name,r,u(n.arguments||[],r,i),n.message)}),o.command("help").description("Show help for this operation").action(()=>{U(e,n)})}),e.default){let n=e.operations?.find(o=>o.name===e.default);if(n){m(t,e.arguments),m(t,n.arguments);let o=[...e.arguments||[],...n.arguments||[]];t.action(async(...s)=>{let i=s.pop(),r=s;o.length>0&&!g(o,u(o,r,i))||await $(e.name,n.name,r,u(o,r,i),e.message||n.message)})}}else t.action(()=>{b(e)});else m(t,e.arguments),t.action(async(...n)=>{let o=n.pop(),s=n;e.arguments&&!g(e.arguments,u(e.arguments,s,o))||await $(e.name,void 0,s,u(e.arguments||[],s,o),e.message)});t.command("help").description("Show help for this command").action(()=>{b(e)})});f.command("help").description("Show general help").action(()=>{x()});f.action(()=>{x()});f.parse();A();
@@ -1,8 +0,0 @@
1
- import{c as p,d as u}from"./chunk-D63SZLT5.js";import{readFileSync as h,writeFileSync as y,mkdirSync as v}from"fs";import{join as d}from"path";import{homedir as m}from"os";import b from"https";var c="2.6.2";var f=d(m(),".tigris","update-check.json");function C(){try{let e=h(f,"utf-8"),i=JSON.parse(e);return typeof i.latestVersion=="string"&&typeof i.lastChecked=="number"?i:null}catch{return null}}function k(e){try{v(d(m(),".tigris"),{recursive:!0}),y(f,JSON.stringify(e),"utf-8")}catch{}}function x(e,i){let n=t=>{let a=(t.startsWith("v")?t.slice(1):t).split(".");if(a.length!==3)return null;let o=a.map(Number);return o.some(isNaN)?null:o},s=n(e),r=n(i);if(!s||!r)return!1;for(let t=0;t<3;t++){if(r[t]>s[t])return!0;if(r[t]<s[t])return!1}return!1}function T(){try{let e=b.get(p,{timeout:5e3},i=>{let n="";i.on("data",s=>{n+=s}),i.on("end",()=>{try{let s=JSON.parse(n);typeof s.version=="string"&&k({latestVersion:s.version,lastChecked:Date.now()})}catch{}})});e.on("error",()=>{}),e.on("timeout",()=>{e.destroy()}),e.end(),e.unref()}catch{}}function V(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let e=C();if(e&&x(c,e.latestVersion)){let n=`Update available: ${c} \u2192 ${e.latestVersion}`,s="Run `npm install -g @tigrisdata/cli` to upgrade.",r=Math.max(n.length,s.length)+4,t="\u250C"+"\u2500".repeat(r-2)+"\u2510",l="\u2514"+"\u2500".repeat(r-2)+"\u2518",a=o=>"\u2502 "+o.padEnd(r-4)+" \u2502";console.log(`
2
- ${t}
3
- ${a("")}
4
- ${a(n)}
5
- ${a(s)}
6
- ${a("")}
7
- ${l}
8
- `)}let i=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||864e5;(!e||Date.now()-e.lastChecked>i)&&T()}export{c as a,x as b,V as c};
package/dist/lib/_stat.js DELETED
@@ -1 +0,0 @@
1
- import{f as o}from"../chunk-LCWHZUZZ.js";async function s(t){let e=t.path||t._positional?.[0];e||(console.error("path argument is required"),process.exit(1));let{bucket:r}=o(e);r||(console.error("Invalid path"),process.exit(1)),console.error("stat command not yet implemented"),process.exit(1)}export{s as default};