@tigrisdata/cli 2.6.1 → 2.7.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 (62) hide show
  1. package/README.md +248 -77
  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-NYAHHQ3A.js → chunk-7F4WI32C.js} +1 -1
  7. package/dist/chunk-BP52O7NB.js +1 -0
  8. package/dist/{chunk-WE6NZ2ZK.js → chunk-DC3ZKGQV.js} +1 -1
  9. package/dist/chunk-EXTBL5CE.js +12 -0
  10. package/dist/{chunk-IACJQZUD.js → chunk-HCOG24E2.js} +1 -1
  11. package/dist/chunk-LCWHZUZZ.js +1 -0
  12. package/dist/chunk-NYQG3EX3.js +8 -0
  13. package/dist/chunk-PRJKBTQP.js +2 -0
  14. package/dist/{chunk-PKWQDQLT.js → chunk-UUITLEOI.js} +1 -1
  15. package/dist/{chunk-DYTBLGO7.js → chunk-VT3KZHZZ.js} +1 -1
  16. package/dist/cli.js +1 -1
  17. package/dist/constants.js +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/lib/_stat.js +1 -1
  20. package/dist/lib/access-keys/assign.js +2 -2
  21. package/dist/lib/access-keys/create.js +2 -2
  22. package/dist/lib/access-keys/delete.js +2 -2
  23. package/dist/lib/access-keys/get.js +2 -2
  24. package/dist/lib/access-keys/list.js +2 -2
  25. package/dist/lib/buckets/create.js +1 -1
  26. package/dist/lib/buckets/delete.js +1 -1
  27. package/dist/lib/buckets/get.js +1 -1
  28. package/dist/lib/buckets/list.js +1 -1
  29. package/dist/lib/buckets/set.js +1 -1
  30. package/dist/lib/configure/index.js +1 -1
  31. package/dist/lib/cp.js +1 -1
  32. package/dist/lib/credentials/test.js +1 -1
  33. package/dist/lib/forks/create.js +1 -1
  34. package/dist/lib/forks/list.js +1 -1
  35. package/dist/lib/login/credentials.js +1 -1
  36. package/dist/lib/login/oauth.js +1 -1
  37. package/dist/lib/login/select.js +1 -1
  38. package/dist/lib/logout.js +1 -1
  39. package/dist/lib/ls.js +1 -1
  40. package/dist/lib/mk.js +1 -1
  41. package/dist/lib/mv.js +1 -1
  42. package/dist/lib/objects/delete.js +1 -1
  43. package/dist/lib/objects/get.js +1 -1
  44. package/dist/lib/objects/list.js +1 -1
  45. package/dist/lib/objects/put.js +1 -1
  46. package/dist/lib/organizations/create.js +2 -2
  47. package/dist/lib/organizations/list.js +2 -2
  48. package/dist/lib/organizations/select.js +3 -3
  49. package/dist/lib/rm.js +1 -1
  50. package/dist/lib/snapshots/list.js +1 -1
  51. package/dist/lib/snapshots/take.js +1 -1
  52. package/dist/lib/touch.js +1 -1
  53. package/dist/lib/whoami.js +1 -1
  54. package/dist/specs.yaml +244 -77
  55. package/dist/utils/path.js +1 -1
  56. package/dist/utils/update-check.js +1 -0
  57. package/package.json +3 -1
  58. package/postinstall.cjs +32 -0
  59. package/dist/chunk-4BZ377KV.js +0 -1
  60. package/dist/chunk-I3FOSZPG.js +0 -1
  61. package/dist/chunk-IY46B353.js +0 -12
  62. package/dist/chunk-TQWT7ROJ.js +0 -1
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunk-I3FOSZPG.js";export{b as isPathFolder,d as listAllItems,a as parsePath,c as parsePaths};
1
+ import{a,b,c,d,e,f,g,h,i}from"../chunk-LCWHZUZZ.js";export{g as globToRegex,d as isPathFolder,a as isRemotePath,i as listAllItems,f as parseAnyPath,c as parsePath,e as parsePaths,b as parseRemotePath,h as wildcardPrefix};
@@ -0,0 +1 @@
1
+ import{b as a,c as b}from"../chunk-NYQG3EX3.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.1",
3
+ "version": "2.7.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",
@@ -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
- var t="https://t3.storage.dev",e="https://iam.storageapi.dev";export{t as a,e as b};
@@ -1 +0,0 @@
1
- import{list as g}from"@tigrisdata/storage";function a(i){let t=i.split("/");return{bucket:t[0],path:t.slice(1).join("/")}}async function p(i,t,s){let{data:e}=await g({prefix:`${t}/`,limit:1,config:{...s,bucket:i}});return!!(e?.items&&e.items.length>0)}function f(i,t){return{source:a(i),destination:a(t)}}async function d(i,t,s){let e=[],n;do{let{data:r,error:o}=await g({prefix:t,paginationToken:n,config:{...s,bucket:i}});if(o)return{items:e,error:o};r?.items&&e.push(...r.items),n=r?.hasMore?r.paginationToken:void 0}while(n);return{items:e}}export{a,p as b,f as c,d};
@@ -1,12 +0,0 @@
1
- import{a as b}from"./chunk-4LGKN5DA.js";import{Command as E}from"commander";import{existsSync as k}from"fs";import{join as f,dirname as q}from"path";import{fileURLToPath as R}from"url";var w="2.6.1";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=q(P),l=b();function y(e,t){return(t?[f(d,"lib",e,`${t}.js`),f(d,"lib",e,t,"index.js")]:[f(d,"lib",`${e}.js`),f(d,"lib",e,"index.js")]).some(s=>k(s))}function C(e){let t;e.type==="positional"?t=` ${e.name}`:(t=` --${e.name}`,e.alias&&e.alias.length===1&&(t+=`, -${e.alias}`));let n=26,s=t.length>=n?t+" ":t.padEnd(n),i=e.description;return e.options&&(Array.isArray(e.options)&&typeof e.options[0]=="string"?i+=` (options: ${e.options.join(", ")})`:i+=` (options: ${e.options.map(o=>o.value).join(", ")})`),e.default&&(i+=` [default: ${e.default}]`),e.required&&(i+=" [required]"),e["required-when"]&&(i+=` [required when: ${e["required-when"]}]`),e.multiple&&(i+=" [multiple values: comma-separated]"),e.type==="positional"&&(i+=" [positional argument]"),e.examples&&e.examples.length>0&&(i+=` (examples: ${e.examples.join(", ")})`),`${s}${i}`}function v(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 s=` ${n.name}`;if(n.alias){let o=Array.isArray(n.alias)?n.alias:[n.alias];s+=` (${o.join(", ")})`}let i=s.padEnd(24);console.log(`${i}${n.description}`)}),console.log())}e.arguments&&e.arguments.length>0&&(console.log("Arguments:"),e.arguments.forEach(t=>{console.log(C(t))}),console.log()),console.log(`Use "${l.name} ${e.name} <operation> help" for more information about an operation.`)}function D(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(C(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: ${w}
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 s=n.padEnd(24);console.log(`${s}${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 s=n.required?`<${n.name}>`:`[${n.name}]`;e.argument(s,n.description)}else{let i=n.alias&&n.alias.length===1?`-${n.alias}, --${n.name}`:`--${n.name}`;n.type==="flag"||(n.type==="boolean"?i+=" [value]":n.options?i+=" <value>":i+=n.required||n["required-when"]?" <value>":" [value]"),e.option(i,n.description,n.default)}})}function g(e,t){for(let n of e){if(n["required-when"]){let[s,i]=n["required-when"].split("="),o=h(t,s,e),r=h(t,n.name,e);if(o===i&&!r)return console.error(`--${n.name} is required when --${s} is ${i}`),!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 i=n.find(o=>o.name===t);if(i&&i.alias){let o=i.alias.charAt(0).toUpperCase()+i.alias.slice(1);if(e[o]!==void 0)return e[o]}}let s=[t,t.replace(/-/g,""),t.replace(/-/g,"").toLowerCase(),t.charAt(0).toUpperCase(),U(t)];for(let i of s)if(e[i]!==void 0)return e[i]}function U(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}async function T(e,t){let n=t?[`./lib/${e}/${t}.js`,`./lib/${e}/${t}/index.js`]:[`./lib/${e}.js`,`./lib/${e}/index.js`];for(let i of n){let o=await import(i).catch(()=>null);if(o)return{module:o,error:null}}return{module:null,error:`Command not found: ${t?`${e} ${t}`:e}`}}async function $(e,t,n=[],s={},i){if(i){let A=i.replace(/\\n/g,`
12
- `);console.log(A)}let{module:o,error:r}=await T(e,t);(r||!o)&&(console.error(r),process.exit(1));let a=t||e,p=o.default||o[a];typeof p!="function"&&(console.error(`Command not implemented: ${a}`),process.exit(1)),await p({...s,_positional:n})}var u=new E;u.name(l.name).description(l.description).version(l.version);function c(e,t,n){let s;"optsWithGlobals"in n&&typeof n.optsWithGlobals=="function"?s=n.optsWithGlobals():"opts"in n&&typeof n.opts=="function"?s=n.opts():s=n;let i={...s};return e.filter(r=>r.type==="positional").forEach((r,a)=>{t[a]!==void 0&&(r.multiple?i[r.name]=t[a].split(",").map(p=>p.trim()):i[r.name]=t[a])}),e.forEach(r=>{r.multiple&&r.type!=="positional"&&i[r.name]&&typeof i[r.name]=="string"&&(i[r.name]=i[r.name].split(",").map(a=>a.trim()))}),i}l.commands.forEach(e=>{let t=u.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 s=t.command(n.name).description(n.description);n.alias&&(Array.isArray(n.alias)?n.alias:[n.alias]).forEach(o=>s.alias(o)),m(s,n.arguments),s.action(async(...i)=>{let o=i.pop(),r=i;n.arguments&&!g(n.arguments,c(n.arguments,r,o))||await $(e.name,n.name,r,c(n.arguments||[],r,o),n.message)}),s.command("help").description("Show help for this operation").action(()=>{D(e,n)})}),e.default){let n=e.operations?.find(s=>s.name===e.default);if(n){m(t,e.arguments),m(t,n.arguments);let s=[...e.arguments||[],...n.arguments||[]];t.action(async(...i)=>{let o=i.pop(),r=i;s.length>0&&!g(s,c(s,r,o))||await $(e.name,n.name,r,c(s,r,o),e.message||n.message)})}}else t.action(()=>{v(e)});else m(t,e.arguments),t.action(async(...n)=>{let s=n.pop(),i=n;e.arguments&&!g(e.arguments,c(e.arguments,i,s))||await $(e.name,void 0,i,c(e.arguments||[],i,s),e.message)});t.command("help").description("Show help for this command").action(()=>{v(e)})});u.command("help").description("Show general help").action(()=>{x()});u.action(()=>{x()});u.parse();
@@ -1 +0,0 @@
1
- import{b as f}from"./chunk-WE6NZ2ZK.js";import{a as A,c as w}from"./chunk-NYAHHQ3A.js";import{g as d,h as g,i as l,j as p,l as o,s as h}from"./chunk-PKWQDQLT.js";import{a as u}from"./chunk-4BZ377KV.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};