@tigrisdata/cli 3.4.3 → 3.6.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/client.js +1 -1
- package/dist/auth/iam.js +1 -1
- package/dist/auth/provider.js +1 -1
- package/dist/chunk-2XSEQJGZ.js +1 -0
- package/dist/chunk-5UQUUFCL.js +5 -0
- package/dist/{chunk-CL4GEWT2.js → chunk-5Z3OHUTR.js} +1 -1
- package/dist/chunk-6ZZ54RU7.js +1 -0
- package/dist/chunk-B7CB3ST5.js +4 -0
- package/dist/{chunk-Z2LVZ3ZF.js → chunk-CB3HWEP5.js} +5 -5
- package/dist/chunk-DLK3GTAJ.js +8 -0
- package/dist/{chunk-W52B2I2N.js → chunk-EH56YEO2.js} +1 -1
- package/dist/chunk-FB54QSI7.js +35 -0
- package/dist/chunk-HLAGKEX3.js +1 -0
- package/dist/{chunk-Q6UVMHAZ.js → chunk-HUWHOK4M.js} +1 -1
- package/dist/chunk-HWAEADX7.js +1 -0
- package/dist/chunk-J3MAV7JB.js +1 -0
- package/dist/chunk-OWYZCGWM.js +8 -0
- package/dist/{chunk-76L56E5U.js → chunk-QFMXV3BK.js} +1 -1
- package/dist/{chunk-JLNCN27M.js → chunk-S3HKXM3M.js} +1 -1
- package/dist/{chunk-KJA757WE.js → chunk-XWIL5QBS.js} +1 -1
- package/dist/chunk-ZP7AWQAS.js +6 -0
- package/dist/cli-core.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/access-keys/assign.js +1 -1
- package/dist/lib/access-keys/attach-policy.js +1 -1
- package/dist/lib/access-keys/create.js +1 -1
- package/dist/lib/access-keys/delete.js +1 -1
- package/dist/lib/access-keys/detach-policy.js +1 -1
- package/dist/lib/access-keys/get.js +1 -1
- package/dist/lib/access-keys/list-policies.js +1 -1
- package/dist/lib/access-keys/list.js +1 -1
- package/dist/lib/access-keys/rotate.js +1 -1
- package/dist/lib/buckets/create.js +1 -1
- package/dist/lib/buckets/delete.js +1 -1
- package/dist/lib/buckets/disable-snapshots.js +1 -1
- package/dist/lib/buckets/enable-snapshots.js +1 -1
- package/dist/lib/buckets/get.js +1 -1
- package/dist/lib/buckets/lifecycle/create.js +1 -1
- package/dist/lib/buckets/lifecycle/edit.js +1 -1
- package/dist/lib/buckets/lifecycle/list.js +1 -1
- package/dist/lib/buckets/lifecycle/shared.js +1 -1
- package/dist/lib/buckets/list.js +1 -1
- package/dist/lib/buckets/merge.js +1 -1
- package/dist/lib/buckets/migrate.js +6 -3
- package/dist/lib/buckets/rebase.js +1 -1
- package/dist/lib/buckets/restore.js +1 -1
- package/dist/lib/buckets/set-cors.js +1 -1
- package/dist/lib/buckets/set-locations.js +1 -1
- package/dist/lib/buckets/set-migration.js +1 -1
- package/dist/lib/buckets/set-notifications.js +1 -1
- package/dist/lib/buckets/set.js +1 -1
- package/dist/lib/bundle.js +1 -1
- package/dist/lib/configure/index.js +1 -1
- package/dist/lib/cp.js +1 -1
- package/dist/lib/credentials/test.js +1 -1
- package/dist/lib/iam/policies/create.js +1 -1
- package/dist/lib/iam/policies/delete.js +1 -1
- package/dist/lib/iam/policies/edit.js +1 -1
- package/dist/lib/iam/policies/get.js +1 -1
- package/dist/lib/iam/policies/link-key.js +1 -1
- package/dist/lib/iam/policies/list-keys.js +1 -1
- package/dist/lib/iam/policies/list.js +1 -1
- package/dist/lib/iam/policies/select-policy.js +1 -1
- package/dist/lib/iam/policies/unlink-key.js +1 -1
- package/dist/lib/iam/teams/create.js +1 -1
- package/dist/lib/iam/teams/edit.js +1 -1
- package/dist/lib/iam/teams/list.js +1 -1
- package/dist/lib/iam/teams/shared.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/init/index.js +1 -0
- package/dist/lib/init/interactive.js +1 -0
- package/dist/lib/init/plan.js +1 -0
- package/dist/lib/init/shared.js +1 -0
- 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/info.js +1 -1
- package/dist/lib/objects/list-versions.js +1 -1
- package/dist/lib/objects/list.js +1 -1
- package/dist/lib/objects/put.js +1 -1
- package/dist/lib/objects/restore-info.js +1 -1
- package/dist/lib/objects/restore.js +1 -1
- package/dist/lib/objects/set-access.js +1 -1
- package/dist/lib/objects/set.js +1 -1
- package/dist/lib/organizations/create.js +1 -1
- package/dist/lib/organizations/list.js +1 -1
- package/dist/lib/organizations/select.js +1 -1
- package/dist/lib/presign.js +1 -1
- package/dist/lib/rm.js +1 -1
- package/dist/lib/snapshots/list.js +1 -1
- package/dist/lib/snapshots/take.js +1 -1
- package/dist/lib/stat.js +1 -1
- package/dist/lib/touch.js +1 -1
- package/dist/lib/update.js +1 -1
- package/dist/lib/whoami.js +1 -1
- package/dist/specs.yaml +33 -1
- package/dist/utils/exit.js +1 -1
- package/dist/utils/telemetry.js +1 -0
- package/dist/utils/update-check.js +1 -1
- package/package.json +7 -4
- package/dist/chunk-2Q2EKNAN.js +0 -8
- package/dist/chunk-3QCSRNXC.js +0 -5
- package/dist/chunk-7O7LNYMA.js +0 -1
- package/dist/chunk-ATBINUDP.js +0 -1
- package/dist/chunk-SE5TRZWU.js +0 -4
- package/dist/chunk-VNUR4TRP.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as V,b as N}from"../../chunk-S77OAN6Y.js";import{h as C}from"../../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{a as V,b as N}from"../../chunk-S77OAN6Y.js";import{h as C}from"../../chunk-7ZCVOA6A.js";import{e as q}from"../../chunk-5UQUUFCL.js";import{a as d,b as T}from"../../chunk-S6KFKBMY.js";import{a as w,b as o,c as O,d as S}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as A,c as $,d as j,j as M}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{listVersions as H,remove as R}from"@tigrisdata/storage";var r=M("objects","delete");async function W(c){A(r);let K=T(c),b=d(c,["bucket"]),E=d(c,["key"]),F=d(c,["yes","y","force"]),a=d(c,["version-id","versionId"]),u=!!d(c,["all-versions","allVersions"]);b||o(r,"Bucket name or path is required"),a&&u&&o(r,"Cannot use --version-id with --all-versions");let h=C(b),s=h.bucket,m=E||h.key||void 0;m||o(r,"Object key is required");let I={...await q(),bucket:s},n=Array.isArray(m)?m:[m];a&&n.length>1&&o(r,"--version-id targets a single object; pass exactly one key");let f=[];if(u)for(let e of n){let t=0,g,v,p=!1;for(;;){let{data:l,error:x}=await H({prefix:e,...g?{keyMarker:g}:{},...v?{versionIdMarker:v}:{},config:I});x&&o(r,x);for(let i of l.versions)i.name===e?(f.push({key:e,versionId:i.versionId}),t++):i.name>e&&(p=!0);for(let i of l.deleteMarkers)i.name===e?(f.push({key:e,versionId:i.versionId}),t++):i.name>e&&(p=!0);if(p||!l.hasMore)break;l.nextKeyMarker||o(r,`listVersions reported more pages but no nextKeyMarker for key '${e}'`),g=l.nextKeyMarker,v=l.nextVersionIdMarker}t===0&&o(r,`No versions or delete markers found for key '${e}'`)}else if(a)f.push({key:n[0],versionId:a});else for(let e of n)f.push({key:e});if(!F){V("Use --yes to skip confirmation");let e=u?`Hard-delete ${f.length} version(s) and delete marker(s) for ${n.length} object(s) from '${s}'?`:a?`Hard-delete version '${a}' of '${n[0]}' from '${s}'?`:`Delete ${n.length} object(s) from '${s}'?`;if(!await N(e)){console.log("Aborted");return}}let y=[],k=[];for(let e of f){let{error:t}=await R(e.key,{...e.versionId?{versionId:e.versionId}:{},config:I});t?(j(r,t.message,e),k.push({...e,error:t.message})):(y.push(e),$(r,e))}if(K==="json"){let e=O(r,{bucket:s}),t={action:"deleted",bucket:s,keys:y.map(g=>g.key),deleted:y,errors:k};e.length>0&&(t.nextActions=e),console.log(JSON.stringify(t))}k.length>0&&w(k[0].error,r),S(r,{bucket:s})}export{W as default};
|
package/dist/lib/objects/get.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as w}from"../../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{h as w}from"../../chunk-7ZCVOA6A.js";import{e as k}from"../../chunk-5UQUUFCL.js";import{a as r,b as j}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as a,j as b}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{createWriteStream as q,writeFileSync as T}from"fs";import{extname as C}from"path";import{Readable as S}from"stream";import{pipeline as x}from"stream/promises";import{get as y}from"@tigrisdata/storage";var e=b("objects","get"),E=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(t,m){let d=C(m||t).toLowerCase();return E.has(d)?"string":"stream"}async function N(t){u(e);let m=j(t),p=r(t,["bucket"]),d=r(t,["key"]),s=r(t,["output","o","O"]),v=r(t,["mode","m","M"]),g=r(t,["snapshot-version","snapshotVersion","snapshot"]),f=r(t,["version-id","versionId"]);p||c(e,"Bucket name or path is required");let{bucket:l,key:o}=w(p,d);o||c(e,"Object key is required");let h=await k();if((v||F(o,s))==="stream"){let{data:i,error:n}=await y(o,"stream",{...g?{snapshotVersion:g}:{},...f?{versionId:f}:{},config:{...h,bucket:l}});if(n&&c(e,n),s){let O=q(s);await x(S.fromWeb(i),O),a(e,{key:o,output:s}),m==="json"&&console.log(JSON.stringify({action:"downloaded",bucket:l,key:o,output:s}))}else await x(S.fromWeb(i),process.stdout),a(e)}else{let{data:i,error:n}=await y(o,"string",{...g?{snapshotVersion:g}:{},...f?{versionId:f}:{},config:{...h,bucket:l}});n&&c(e,n),s?(T(s,i),a(e,{key:o,output:s}),m==="json"&&console.log(JSON.stringify({action:"downloaded",bucket:l,key:o,output:s}))):(console.log(i),a(e))}}export{N as default};
|
package/dist/lib/objects/info.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h,f as k}from"../../chunk-AFM3TY2D.js";import{h as v}from"../../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{a as h,f as k}from"../../chunk-AFM3TY2D.js";import{h as v}from"../../chunk-7ZCVOA6A.js";import{e as l}from"../../chunk-5UQUUFCL.js";import{a as i,b as d}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as p,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{head as A}from"@tigrisdata/storage";var e=g("objects","info");async function I(o){u(e);let b=d(o),s=i(o,["bucket"]),y=i(o,["key"]),c=i(o,["snapshot-version","snapshotVersion","snapshot"]),a=i(o,["version-id","versionId"]);s||r(e,"Bucket name or path is required");let{bucket:f,key:n}=v(s,y);n||r(e,"Object key is required");let S=await l(),{data:t,error:m}=await A(n,{...c?{snapshotVersion:c}:{},...a?{versionId:a}:{},config:{...S,bucket:f}});m&&r(e,m),t||r(e,"Object not found");let j=[{metric:"Path",value:t.path},{metric:"Size",value:h(t.size)},{metric:"Content-Type",value:t.contentType||"N/A"},{metric:"Content-Disposition",value:t.contentDisposition||"N/A"},{metric:"Modified",value:t.modified.toISOString()},{metric:"URL",value:t.url}],O=k(j,b,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(O),p(e,{bucket:f,key:n})}export{I as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as K,b as w,d as l,e as d}from"../../chunk-AFM3TY2D.js";import{e as C}from"../../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{a as K,b as w,d as l,e as d}from"../../chunk-AFM3TY2D.js";import{e as C}from"../../chunk-7ZCVOA6A.js";import{e as b}from"../../chunk-5UQUUFCL.js";import{a as o,b as I,c as V}from"../../chunk-S6KFKBMY.js";import{b as a}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as u,e as x,j as v}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{listVersions as D}from"@tigrisdata/storage";var i=v("objects","list-versions");async function O(s){p(i);let k=o(s,["bucket"]),z=o(s,["prefix","p","P"]),m=o(s,["delimiter","d"]),c=o(s,["key-marker","keyMarker"]),f=o(s,["version-id-marker","versionIdMarker"]),g=I(s),{limit:y}=V(s);k||a(i,"Bucket name is required");let M=C(k),P=M.bucket,S=z||M.path||void 0,j=await b(),{data:r,error:h}=await D({prefix:S,...m?{delimiter:m}:{},...y!==void 0?{limit:y}:{},...c?{keyMarker:c}:{},...f?{versionIdMarker:f}:{},config:{...j,bucket:P}});h&&a(i,h);let t=r.versions.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",size:K(e.size),modified:e.lastModified})),n=r.deleteMarkers.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",modified:e.lastModified})),L=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],T=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"modified",header:"Modified"}];if(g==="json")console.log(w({versions:r.versions,deleteMarkers:r.deleteMarkers,commonPrefixes:r.commonPrefixes,nextKeyMarker:r.nextKeyMarker,nextVersionIdMarker:r.nextVersionIdMarker,hasMore:r.hasMore}));else if(g==="xml"){let e=["<listVersions>"];e.push(" "+l(t,"versions","version").replace(/\n/g,`
|
|
2
2
|
`)),e.push(" "+l(n,"deleteMarkers","deleteMarker").replace(/\n/g,`
|
|
3
3
|
`)),e.push("</listVersions>"),console.log(e.join(`
|
|
4
4
|
`))}else{if(t.length===0&&n.length===0){x(i);return}if(t.length>0&&(console.log(`
|
package/dist/lib/objects/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as T,g as w}from"../../chunk-AFM3TY2D.js";import{e as S}from"../../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{a as T,g as w}from"../../chunk-AFM3TY2D.js";import{e as S}from"../../chunk-7ZCVOA6A.js";import{e as P}from"../../chunk-5UQUUFCL.js";import{a as e,b as j,c as z}from"../../chunk-S6KFKBMY.js";import{b as s}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as h,e as b,i as y,j as x}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{list as q}from"@tigrisdata/storage";var n=x("objects","list");async function v(t){l(n);let a=e(t,["bucket"]),O=e(t,["prefix","p","P"]),i=j(t),c=e(t,["snapshot-version","snapshotVersion","snapshot"]),f=e(t,["source"]),{limit:m,pageToken:p}=z(t);a||s(n,"Bucket name is required");let g=S(a),A=g.bucket,E=O||g.path||void 0,F=await P(),{data:o,error:d}=await q({prefix:E,...c?{snapshotVersion:c}:{},...f?{source:f}:{},...m!==void 0?{limit:m}:{},...p?{paginationToken:p}:{},config:{...F,bucket:A}});if(d&&s(n,d),!o.items||o.items.length===0){b(n);return}let u=o.items.map(r=>({key:r.name,size:T(r.size),modified:r.lastModified})),M=[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],k=o.paginationToken||void 0,V=w(u,i,"objects","object",M,{paginationToken:k});console.log(V),i!=="json"&&i!=="xml"&&y(k),h(n,{count:u.length})}export{v as default};
|
package/dist/lib/objects/put.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R}from"../../chunk-EKW6XTGL.js";import{a as A}from"../../chunk-HPICBIXL.js";import{a as s,f as v}from"../../chunk-AFM3TY2D.js";import{h as j}from"../../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{a as R}from"../../chunk-EKW6XTGL.js";import{a as A}from"../../chunk-HPICBIXL.js";import{a as s,f as v}from"../../chunk-AFM3TY2D.js";import{h as j}from"../../chunk-7ZCVOA6A.js";import{e as w}from"../../chunk-5UQUUFCL.js";import{a as n,b as z}from"../../chunk-S6KFKBMY.js";import{b as i,d as T}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as k,c as S,j as h}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{createReadStream as E,statSync as M}from"fs";import{Readable as $}from"stream";import{put as N}from"@tigrisdata/storage";var t=h("objects","put");async function Y(r){k(t);let u=n(r,["bucket"]),l=n(r,["key"]),y=n(r,["file"]),C=n(r,["access","a","A"],"private"),O=n(r,["content-type","contentType","t","T"]),P=z(r);u||i(t,"Bucket name or path is required");let d=j(u),m=d.bucket,a=d.key||l,e=d.key&&l||y;a||i(t,"Object key is required");let q=!process.stdin.isTTY;!e&&!q&&i(t,"File path is required (or pipe data via stdin)");let f,o;if(e){try{o=M(e).size}catch{i(t,`File not found: ${e}`)}let p=E(e);f=$.toWeb(p)}else f=$.toWeb(process.stdin);let U=await w({withCredentialProvider:!0}),x=e?R(o):{multipart:!0,partSize:5*1024*1024,queueSize:8},F=O??(e?A(e):void 0),{data:c,error:g}=await N(a,f,{access:C==="public"?"public":"private",contentType:F,...x,onUploadProgress:({loaded:p,percentage:b})=>{o!==void 0&&o>0?process.stdout.write(`\rUploading: ${s(p)} / ${s(o)} (${b}%)`):process.stdout.write(`\rUploading: ${s(p)}`)},config:{...U,bucket:m}});process.stdout.write(`\r${" ".repeat(60)}\r`),g&&i(t,g);let W=[{path:c.path,size:s(c.size??o??0),contentType:c.contentType||"-",modified:c.modified}],B=v(W,P,"objects","object",[{key:"path",header:"Path"},{key:"size",header:"Size"},{key:"contentType",header:"Content-Type"},{key:"modified",header:"Modified"}]);console.log(B),S(t,{key:a,bucket:m}),T(t,{key:a,bucket:m})}export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as y}from"../../chunk-AFM3TY2D.js";import{h as v}from"../../chunk-7ZCVOA6A.js";import{e as h}from"../../chunk-5UQUUFCL.js";import{a as e,b as d}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as g,c as p,e as l,j as k}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{getRestoreInfo as A}from"@tigrisdata/storage";var t=k("objects","restore-info");async function I(r){g(t);let n=d(r),c=e(r,["bucket"]),S=e(r,["key"]),a=e(r,["version-id","versionId"]),f=e(r,["snapshot-version","snapshotVersion","snapshot"]);c||i(t,"Bucket name or path is required");let{bucket:m,key:o}=v(c,S);o||i(t,"Object key is required");let b=await h(),{data:s,error:u}=await A(o,{...a?{versionId:a}:{},...f?{snapshotVersion:f}:{},config:{...b,bucket:m}});if(u&&i(t,u),!s){n==="json"?console.log(JSON.stringify({status:null})):l(t);return}let O=[{metric:"Path",value:o},{metric:"Status",value:s.status},...s.expiresAt?[{metric:"Expires",value:s.expiresAt.toISOString()}]:[]],x=y(O,n,"restore-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(x),p(t,{bucket:m,key:o})}export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as k}from"../../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{h as k}from"../../chunk-7ZCVOA6A.js";import{e as y}from"../../chunk-5UQUUFCL.js";import{a as t,b as p}from"../../chunk-S6KFKBMY.js";import{b as n}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as d,c as u,j as b}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{restoreObject as j}from"@tigrisdata/storage";var s=b("objects","restore");async function O(e){d(s);let h=p(e),c=t(e,["bucket"]),l=t(e,["key"]),a=t(e,["version-id","versionId"]),f=t(e,["snapshot-version","snapshotVersion","snapshot"]),g=t(e,["days","d"]);c||n(s,"Bucket name or path is required");let{bucket:i,key:o}=k(c,l);o||n(s,"Object key is required");let r;g!==void 0&&(r=Number(g),(!Number.isInteger(r)||r<1)&&n(s,"--days must be a positive integer"));let v=await y(),{error:m}=await j(o,{...r!==void 0?{days:r}:{},...a?{versionId:a}:{},...f?{snapshotVersion:f}:{},config:{...v,bucket:i}});m&&n(s,m),h==="json"&&console.log(JSON.stringify({action:"restore-requested",bucket:i,key:o,days:r??1})),u(s,{key:o,bucket:i})}export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as l}from"../../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{h as l}from"../../chunk-7ZCVOA6A.js";import{e as k}from"../../chunk-5UQUUFCL.js";import{a as o,b}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as m,c as u,j as p}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{setObjectAccess as v}from"@tigrisdata/storage";var e=p("objects","set-access");async function j(r){m(e);let d=b(r),a=o(r,["bucket"]),f=o(r,["key"]),y=o(r,["access"]);a||c(e,"Bucket name or path is required");let i=l(a),n=i.bucket,s=i.key||f,t=i.key?f:y;s||c(e,"Object key is required"),t||c(e,"Access level is required (public or private)"),t!=="public"&&t!=="private"&&c(e,'Access level must be either "public" or "private"');let A=await k(),{error:g}=await v(s,{access:t,config:{...A,bucket:n}});g&&c(e,g),d==="json"&&console.log(JSON.stringify({action:"updated",bucket:n,key:s,access:t})),u(e,{key:s,bucket:n,access:t})}export{j as default};
|
package/dist/lib/objects/set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as d}from"../../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{h as d}from"../../chunk-7ZCVOA6A.js";import{e as b}from"../../chunk-5UQUUFCL.js";import{a as i,b as y}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as k,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{move as v,setObjectAccess as A}from"@tigrisdata/storage";var e=l("objects","set");async function O(r){p(e);let w=y(r),f=i(r,["bucket"]),j=i(r,["key"]),s=i(r,["access","a","A"]),c=i(r,["new-key","n","newKey"]);f||t(e,"Bucket name or path is required");let{bucket:n,key:a}=d(f,j);a||t(e,"Object key is required"),s||t(e,"Access level is required (--access public|private)");let g={...await b(),bucket:n},o=a;if(c){let{error:u}=await v(a,c,{config:g});u&&t(e,u),o=c}let{error:m}=await A(o,{access:s==="public"?"public":"private",config:g});m&&t(e,m),w==="json"&&console.log(JSON.stringify({action:"updated",bucket:n,key:o,access:s,...c?{newKey:c}:{}})),k(e,{key:o,bucket:n})}export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as O,g as d}from"../../chunk-5UQUUFCL.js";import{a as p,b as u}from"../../chunk-S6KFKBMY.js";import{b as i,d as m}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as e,c,g as f,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import{a as s}from"../../chunk-KJBSIIND.js";import"../../chunk-F4AGJWCK.js";import{createOrganization as w}from"@tigrisdata/iam";var r=g("organizations","create");async function x(n){if(e(r),d("Organization creation")||s("Organization creation"))return;let t=p(n,["name","N"]);t||i(r,"Organization name is required");let z=await O(),l=u(n),{data:S,error:o}=await w(t,{config:z});o&&i(r,o);let a=S.id;l==="json"&&console.log(JSON.stringify({action:"created",name:t,id:a})),c(r,{name:t,id:a}),f(r,{name:t}),m(r,{name:t})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as q}from"../../chunk-AFM3TY2D.js";import{a as y}from"../../chunk-S77OAN6Y.js";import{
|
|
1
|
+
import{f as q}from"../../chunk-AFM3TY2D.js";import{a as y}from"../../chunk-S77OAN6Y.js";import{e as k,g as I}from"../../chunk-5UQUUFCL.js";import{b as S}from"../../chunk-S6KFKBMY.js";import{b as h}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as r,e as p,j as u}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import{c as w}from"../../chunk-J3MAV7JB.js";import{h as z,i as O}from"../../chunk-F4AGJWCK.js";import{listOrganizations as F}from"@tigrisdata/iam";import U from"enquirer";var i=u("organizations","list");async function $(x){if(f(i),I("Organization listing and selection"))return;let s=S(x,"select"),c=w(),e;if(await c.isFlyUser())e=await c.fetchOrganizationsFromUserInfo()??[];else{let n=await k(),{data:g,error:a}=await F({config:n});a&&h(i,a),e=g?.organizations??[]}if(e.length===0){p(i);return}let o=O();if(s==="select"){let n=e.map(t=>({name:t.id,message:`${t.name} (${t.id})`,hint:t.id===o?"currently selected":void 0}));y("Use --format table or --format json");let l=(await U.prompt({type:"select",name:"organization",message:"Select an organization:",choices:n.map(t=>t.message),initial:o?e.findIndex(t=>t.id===o):0})).organization.match(/\(([^)]+)\)$/),d=l?l[1]:e[0].id;await z(d);let E=e.find(t=>t.id===d);r(i,{name:E?.name});return}let m=e.map(n=>({id:n.id,name:n.name,slug:n.slug,selected:n.id===o?"*":""})),C=q(m,s,"organizations","organization",[{key:"selected",header:" ",width:1},{key:"id",header:"ID"},{key:"name",header:"Name"},{key:"slug",header:"Slug"}]);console.log(C),r(i,{count:m.length})}export{$ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as S,g as $}from"../../chunk-5UQUUFCL.js";import{a as z,b as O}from"../../chunk-S6KFKBMY.js";import{a as d,b as r,d as p}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as g,c,d as f,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import{h as u}from"../../chunk-F4AGJWCK.js";import{listOrganizations as A}from"@tigrisdata/iam";var n=l("organizations","select");async function N(a){if(g(n),$("Organization selection"))return;let w=O(a),i=z(a,["name","N"]);i||r(n,"Organization name or ID is required");let x=await S(),{data:h,error:e}=await A({config:x});e&&r(n,e);let s=h?.organizations??[],t=s.find(o=>o.id===i||o.name===i);if(!t){let o=s.map(m=>` - ${m.name} (${m.id})`).join(`
|
|
2
2
|
`);f(n,`Organization "${i}" not found
|
|
3
3
|
|
|
4
4
|
Available organizations:
|
package/dist/lib/presign.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as A}from"../chunk-AFM3TY2D.js";import{e as v}from"../chunk-7ZCVOA6A.js";import{a as K,
|
|
1
|
+
import{b as A}from"../chunk-AFM3TY2D.js";import{e as v}from"../chunk-7ZCVOA6A.js";import{a as K,e as w}from"../chunk-5UQUUFCL.js";import{a,b as k}from"../chunk-S6KFKBMY.js";import{a as n}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import{c as h}from"../chunk-J3MAV7JB.js";import{i as m,p}from"../chunk-F4AGJWCK.js";import{listAccessKeys as P}from"@tigrisdata/iam";import{getPresignedUrl as T}from"@tigrisdata/storage";import $ from"enquirer";var{prompt:b}=$;async function q(s){let r=a(s,["path"]);r||n("path argument is required");let{bucket:o,path:e}=v(r);o||n("Invalid path"),e||n("Object key is required");let t=a(s,["method","m"])??"get",i=parseInt(a(s,["expires-in","expiresIn","e"])??"3600",10),l=k(s,"url"),c=a(s,["access-key","accessKey"]),C=a(s,["select"]),f=a(s,["snapshot-version","snapshotVersion","snapshot"]);f&&t!=="get"&&n("Snapshot version is only supported for GET requests");let d=await w(),g;c?g=c:d.accessKeyId?g=d.accessKeyId:(p()!=="oauth"&&n("Presigning requires an access key. Pass --access-key or configure credentials."),C?g=await O(o,t):g=await E(o,t)),g||n("Presigning requires an access key. Pass --access-key or configure credentials.");let{data:u,error:y}=await T(e,{method:t,expiresIn:i,accessKeyId:g,...f?{snapshotVersion:f}:{},config:{...d,bucket:o}});y&&n(y),console.log(l==="json"?A({url:u.url,expiresIn:u.expiresIn,method:t,bucket:o,key:e}):u.url),process.exit(0)}async function I(){let r=await h().getAccessToken(),o=m(),e=K(),{data:t,error:i}=await P({config:{sessionToken:r,organizationId:o??void 0,iamEndpoint:e.iamEndpoint}});return i&&n(i),(!t.accessKeys||t.accessKeys.length===0)&&n('No access keys found. Create one with "tigris access-keys create <name>"'),t.accessKeys}function x(s,r,o){return s.roles?s.roles.some(e=>e.role==="NamespaceAdmin"?!0:e.bucket!==r&&e.bucket!=="*"?!1:o==="put"?e.role==="Editor":e.role==="Editor"||e.role==="ReadOnly"):!1}async function E(s,r){let e=(await I()).filter(i=>i.status==="active");e.length===0&&n('No active access keys found. Create one with "tigris access-keys create <name>"');let t=e.find(i=>x(i,s,r));return t||n(`No access key with ${r==="put"?"Editor":"Editor or ReadOnly"} access to bucket "${s}" found.
|
|
2
2
|
Create one: tigris access-keys create <name>
|
|
3
3
|
Then assign: tigris access-keys assign <id> --bucket ${s} --role Editor`),console.error(`Using access key: ${t.name} (${t.id})`),t.id}async function O(s,r){process.stdin.isTTY||n("Interactive selection requires a TTY. Omit --select to auto-resolve, or pass --access-key tid_...");let e=(await I()).filter(c=>c.status==="active");e.length===0&&n('No active access keys found. Create one with "tigris access-keys create <name>"');let t=e.filter(c=>x(c,s,r)),i;if(t.length>0?i=t:(console.error(`No access keys with explicit access to bucket "${s}" found. Showing all active keys.`),i=e),i.length===1)return console.error(`Using access key: ${i[0].name} (${i[0].id})`),i[0].id;let{selectedKey:l}=await b({type:"select",name:"selectedKey",message:"Select an access key for presigning:",choices:i.map(c=>({name:c.id,message:`${c.name} (${c.id})`}))});return l}export{q as default,x as keyMatchesOperation};
|
package/dist/lib/rm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v,b as h}from"../chunk-S77OAN6Y.js";import{a as j,b as I,d as N,f as O,g as E,i as J}from"../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{a as v,b as h}from"../chunk-S77OAN6Y.js";import{a as j,b as I,d as N,f as O,g as E,i as J}from"../chunk-7ZCVOA6A.js";import{e as W}from"../chunk-5UQUUFCL.js";import{a as $,b as P}from"../chunk-S6KFKBMY.js";import{a as s}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{list as U,remove as b,removeBucket as T}from"@tigrisdata/storage";var i=!1;async function q(m){let d=$(m,["path"]),g=$(m,["yes","y","force","f"]),k=!!$(m,["recursive","r"]);i=P(m)==="json",d||s("path argument is required"),j(d)||s("Path must be a remote Tigris path (t3:// or tigris://)");let{bucket:e,path:o}=I(d);e||s("Invalid path");let n=await W(),R=d.endsWith("/");if(!o&&!R){if(!g&&(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 T(e,{config:n,force:g});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 N(e,o,n)),u&&!a&&!k&&s("Source is a remote folder (not removed). Use -r to remove recursively."),a||u){let r=a?E(o):o?o.endsWith("/")?o:`${o}/`:"",{items:w,error:S}=await J(e,r||void 0,n);S&&s(S);let f=w;if(a){let t=o.split("/").pop(),l=O(t);f=f.filter(A=>{let F=r?A.name.slice(r.length):A.name;return!k&&F.includes("/")?!1:l.test(F.split("/").pop())})}let c=r,M=f.some(t=>t.name===c),y=!1;if(!M&&!a){let{data:t}=await U({prefix:c,limit:1,config:{...n,bucket:e}});y=t?.items?.some(l=>l.name===c)||!1}let x=f.length+(y?1:0);if(x===0){console.log(i?JSON.stringify({action:"removed",count:0}):"No objects to remove");return}if(!g&&(v("Use --yes to skip confirmation"),!await h(`Are you sure you want to delete ${x} object(s)?`))){i||console.log("Aborted");return}let p=0;for(let t of f){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(!g&&(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{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as S}from"../../chunk-AFM3TY2D.js";import{
|
|
1
|
+
import{g as S}from"../../chunk-AFM3TY2D.js";import{e as x}from"../../chunk-5UQUUFCL.js";import{a as k,b as y,c as T}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as f,c as u,e as d,i as h,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{listBucketSnapshots as P}from"@tigrisdata/storage";var t=l("snapshots","list");async function B(o){f(t);let r=k(o,["name"]),e=y(o),{limit:s,pageToken:m}=T(o);r||i(t,"Bucket name is required");let v=await x(),{data:n,error:c}=await P(r,{...s!==void 0?{limit:s}:{},...m?{paginationToken:m}:{},config:v});if(c&&i(t,c),!n.snapshots||n.snapshots.length===0){d(t);return}let p=n.snapshots.map(a=>({name:a.name||"",version:a.version||"",created:a.creationDate})),w=[{key:"name",header:"Name"},{key:"version",header:"Version"},{key:"created",header:"Created"}],g=n.paginationToken||void 0,O=S(p,e,"snapshots","snapshot",w,{paginationToken:g});console.log(O),e!=="json"&&e!=="xml"&&h(g),u(t,{count:p.length})}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as g}from"../../chunk-5UQUUFCL.js";import{a,b as f}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as m,c,j as p}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{createBucketSnapshot as k}from"@tigrisdata/storage";var o=p("snapshots","take");async function S(n){m(o);let h=f(n),t=a(n,["name"]),e=a(n,["snapshot-name","snapshotName"]);t||r(o,"Bucket name is required");let u=await g(),{data:s,error:i}=await k(t,{name:e,config:u});i&&r(o,i),h==="json"&&console.log(JSON.stringify({action:"taken",bucket:t,version:s?.snapshotVersion})),c(o,{name:t,snapshotName:e||s?.snapshotVersion,version:s?.snapshotVersion})}export{S as default};
|
package/dist/lib/stat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as w}from"../chunk-JNSFDQGG.js";import{a as d,f as m}from"../chunk-AFM3TY2D.js";import"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";import{e as I}from"../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{c as w}from"../chunk-JNSFDQGG.js";import{a as d,f as m}from"../chunk-AFM3TY2D.js";import"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";import{e as I}from"../chunk-7ZCVOA6A.js";import{e as j}from"../chunk-5UQUUFCL.js";import{a as u,b as O}from"../chunk-S6KFKBMY.js";import{b as i}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import{b as y,c,j as b}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{getBucketInfo as A,getStats as M,head as z}from"@tigrisdata/storage";var t=b("stat");async function C(s){y(t);let h=u(s,["path"]),f=O(s),v=u(s,["snapshot-version","snapshotVersion","snapshot"]),S=u(s,["version-id","versionId"]),l=await j();if(!h){let{data:o,error:a}=await M({config:l});a&&i(t,a);let p=[{metric:"Active Buckets",value:String(o.stats.activeBuckets)},{metric:"Total Objects",value:String(o.stats.totalObjects)},{metric:"Total Unique Objects",value:String(o.stats.totalUniqueObjects)},{metric:"Total Storage",value:d(o.stats.totalStorageBytes)}],g=m(p,f,"stats","stat",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(g),c(t),process.exit(0)}let{bucket:r,path:n}=I(h);if(r||i(t,"Invalid path"),!n||n==="/"){let{data:o,error:a}=await A(r,{config:l});a&&i(t,a);let p=w(o).map(({label:T,value:V})=>({metric:T,value:V})),g=m(p,f,"bucket-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(g),c(t,{bucket:r}),process.exit(0)}let{data:e,error:k}=await z(n,{...v?{snapshotVersion:v}:{},...S?{versionId:S}:{},config:{...l,bucket:r}});k&&i(t,k),e||i(t,"Object not found");let x=[{metric:"Path",value:e.path},{metric:"Size",value:d(e.size)},{metric:"Content-Type",value:e.contentType||"N/A"},{metric:"Content-Disposition",value:e.contentDisposition||"N/A"},{metric:"Modified",value:e.modified.toISOString()}],B=m(x,f,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(B),c(t,{bucket:r,path:n}),process.exit(0)}export{C as default};
|
package/dist/lib/touch.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as f}from"../chunk-7ZCVOA6A.js";import{
|
|
1
|
+
import{e as f}from"../chunk-7ZCVOA6A.js";import{e as s}from"../chunk-5UQUUFCL.js";import{a,b as c}from"../chunk-S6KFKBMY.js";import{a as t}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{put as p}from"@tigrisdata/storage";async function u(e){let i=a(e,["path"]);i||t("path argument is required");let{bucket:o,path:r}=f(i);o||t("Invalid path"),r||t("Object key is required (use mk to create buckets)");let g=c(e),m=await s(),{error:n}=await p(r,"",{config:{...m,bucket:o}});n&&t(n),console.log(g==="json"?JSON.stringify({action:"created",bucket:o,path:r}):`Created '${o}/${r}'`),process.exit(0)}export{u as default};
|
package/dist/lib/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as d}from"../chunk-S6KFKBMY.js";import{
|
|
1
|
+
import{b as d}from"../chunk-S6KFKBMY.js";import{b as l,c as p,d as f}from"../chunk-DLK3GTAJ.js";import{b as m}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import{a as t}from"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import{b as s,c as i,f as a,j as c}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import{execSync as h}from"child_process";var r=c("update");async function v(u={}){let g=d(u);s(r);try{let o=await f(),e=l(t,o),n=p();if(g==="json"){console.log(JSON.stringify({currentVersion:t,latestVersion:o,updateAvailable:e,updateCommand:n}));return}console.log(`Current version: ${t}`),e?(console.log(`Latest version: ${o}`),console.log("Updating..."),h(n,{stdio:"inherit",...process.platform==="win32"?{shell:"powershell.exe"}:{}}),i(r,{latestVersion:o})):a(r,{currentVersion:t})}catch(o){m(r,o)}}export{v as default};
|
package/dist/lib/whoami.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as $,
|
|
1
|
+
import{a as $,d as b}from"../chunk-5UQUUFCL.js";import{b as w}from"../chunk-S6KFKBMY.js";import{b as A}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import{f as g,j as I}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import{c as z}from"../chunk-J3MAV7JB.js";import{i as y}from"../chunk-F4AGJWCK.js";import{whoami as k}from"@tigrisdata/iam";var f=I("whoami"),v={"aws-profile":"AWS Profile",oauth:"OAuth",credentials:"Access Key Credentials",environment:"Environment Variables",configured:"Configured Credentials"};async function l(h,u){try{let t=$(),{data:c}=await k({config:{accessKeyId:h,secretAccessKey:u,iamEndpoint:t.iamEndpoint}});return{userId:c?.userId,organizationId:c?.organizationId}}catch{return{userId:void 0,organizationId:void 0}}}async function K(h={}){try{let u=w(h),t=await b();if(t.type==="none"){g(f);return}let c,r,o,n,d,e=[""],m=v[t.type]??t.type;switch(t.type){case"aws-profile":{e.push(`Auth method: ${m} (${t.profile})`);let i=await l(t.accessKeyId,t.secretAccessKey);r=i.userId,o=i.organizationId;break}case"oauth":{e.push(`Auth method: ${m}`);let i=z();if(!await i.isAuthenticated()){g(f);return}let a=await i.getIdTokenClaims();c=a.email,r=a.sub,d=y(),n=await i.getOrganizations();break}case"credentials":{e.push(`Auth method: ${m}`);let i=await l(t.accessKeyId,t.secretAccessKey);r=i.userId,o=i.organizationId;break}case"environment":{let i=t.source==="tigris"?"TIGRIS_STORAGE_*":"AWS_*";e.push(`Auth method: ${m} (${i})`);let s=await l(t.accessKeyId,t.secretAccessKey);r=s.userId,o=s.organizationId;break}case"configured":{e.push(`Auth method: ${m}`);let i=await l(t.accessKeyId,t.secretAccessKey);r=i.userId,o=i.organizationId;break}}if(e.push(""),e.push("User Information:"),e.push(` Email: ${c||"N/A"}`),e.push(` User ID: ${r||"N/A"}`),n)if(n.length>0){let s=n.slice(0,5);if(e.push(""),e.push(`Organizations (${n.length}):`),s.forEach(a=>{let O=a.id===d?">":" ";e.push(` ${O} ${a.name} (${a.id})`)}),n.length>5&&e.push(` ... and ${n.length-5} more. Run "tigris organizations list" to see all.`),d){let a=n.find(p=>p.id===d);a&&(e.push(""),e.push(`Active: ${a.name}`))}}else e.push(""),e.push("Organizations: None");else o&&e.push(` Organization: ${o}`);if(u==="json"){let i={authMethod:t.type,email:c,userId:r};if(n&&(i.organizations=n.map(s=>({id:s.id,name:s.name})),d)){let s=n.find(a=>a.id===d);s&&(i.activeOrganization=s.name)}o&&(i.organizationId=o),console.log(JSON.stringify(i));return}e.push(""),console.log(e.join(`
|
|
2
2
|
`))}catch(u){A(f,u)}}export{K as default};
|
package/dist/specs.yaml
CHANGED
|
@@ -90,6 +90,26 @@ definitions:
|
|
|
90
90
|
alias: "y"
|
|
91
91
|
|
|
92
92
|
commands:
|
|
93
|
+
#########################
|
|
94
|
+
# Onboarding
|
|
95
|
+
#########################
|
|
96
|
+
# init
|
|
97
|
+
- name: init
|
|
98
|
+
alias: start
|
|
99
|
+
description: Connect Tigris to your AI coding agent — MCP server config and agent skills
|
|
100
|
+
examples:
|
|
101
|
+
- "tigris init"
|
|
102
|
+
- "npx @tigrisdata/cli init"
|
|
103
|
+
- "tigris init --agent"
|
|
104
|
+
messages:
|
|
105
|
+
onStart: ''
|
|
106
|
+
onSuccess: ''
|
|
107
|
+
onFailure: 'Setup failed'
|
|
108
|
+
arguments:
|
|
109
|
+
- name: agent
|
|
110
|
+
description: Print a setup recipe for an AI coding agent to follow instead of running the interactive wizard
|
|
111
|
+
type: flag
|
|
112
|
+
|
|
93
113
|
#########################
|
|
94
114
|
# Authentication
|
|
95
115
|
#########################
|
|
@@ -894,10 +914,11 @@ commands:
|
|
|
894
914
|
- my-bucket
|
|
895
915
|
# set
|
|
896
916
|
- name: set
|
|
897
|
-
description: Update settings on an existing bucket such as access level, location, caching, or custom domain
|
|
917
|
+
description: Update settings on an existing bucket such as access level, default tier, location, caching, or custom domain
|
|
898
918
|
alias: s
|
|
899
919
|
examples:
|
|
900
920
|
- "tigris buckets set my-bucket --access public"
|
|
921
|
+
- "tigris buckets set my-bucket --default-tier GLACIER"
|
|
901
922
|
- "tigris buckets set my-bucket --locations iad,fra --cache-control 'max-age=3600'"
|
|
902
923
|
- "tigris buckets set my-bucket --custom-domain assets.example.com"
|
|
903
924
|
- "tigris buckets set my-bucket --soft-delete enable --retention-days 30"
|
|
@@ -916,6 +937,9 @@ commands:
|
|
|
916
937
|
- name: access
|
|
917
938
|
description: Bucket access level
|
|
918
939
|
options: *access_options
|
|
940
|
+
- name: default-tier
|
|
941
|
+
description: Change the default storage tier for objects uploaded to the bucket
|
|
942
|
+
options: *tier_options
|
|
919
943
|
- name: region
|
|
920
944
|
removed: true
|
|
921
945
|
replaced_by: --locations
|
|
@@ -1646,6 +1670,7 @@ commands:
|
|
|
1646
1670
|
- "tigris objects restore my-bucket archived.bin"
|
|
1647
1671
|
- "tigris objects restore my-bucket archived.bin --days 3"
|
|
1648
1672
|
- "tigris objects restore t3://my-bucket/archived.bin --days 7"
|
|
1673
|
+
- "tigris objects restore my-bucket archived.bin --snapshot-version 1765889000501544464"
|
|
1649
1674
|
messages:
|
|
1650
1675
|
onStart: 'Requesting restore...'
|
|
1651
1676
|
onSuccess: "Restore requested for '{{key}}'"
|
|
@@ -1664,6 +1689,9 @@ commands:
|
|
|
1664
1689
|
default: 1
|
|
1665
1690
|
- name: version-id
|
|
1666
1691
|
description: Restore a specific object version (requires bucket versioning). Omit to restore the current version
|
|
1692
|
+
- name: snapshot-version
|
|
1693
|
+
description: Restore the object as of a specific bucket snapshot. Accepts a snapshot version string or any UNIX nanosecond-precision timestamp (e.g. 1765889000501544464)
|
|
1694
|
+
alias: snapshot
|
|
1667
1695
|
- name: format
|
|
1668
1696
|
description: Output format
|
|
1669
1697
|
options: [json, table, xml]
|
|
@@ -1675,6 +1703,7 @@ commands:
|
|
|
1675
1703
|
examples:
|
|
1676
1704
|
- "tigris objects restore-info my-bucket archived.bin"
|
|
1677
1705
|
- "tigris objects restore-info t3://my-bucket/archived.bin --format json"
|
|
1706
|
+
- "tigris objects restore-info my-bucket archived.bin --snapshot-version 1765889000501544464"
|
|
1678
1707
|
messages:
|
|
1679
1708
|
onStart: ''
|
|
1680
1709
|
onSuccess: ''
|
|
@@ -1690,6 +1719,9 @@ commands:
|
|
|
1690
1719
|
description: Key of the object (omit if bucket contains the full path)
|
|
1691
1720
|
- name: version-id
|
|
1692
1721
|
description: Inspect a specific object version (requires bucket versioning). Omit to read the current version
|
|
1722
|
+
- name: snapshot-version
|
|
1723
|
+
description: Inspect the object as of a specific bucket snapshot. Accepts a snapshot version string or any UNIX nanosecond-precision timestamp (e.g. 1765889000501544464)
|
|
1724
|
+
alias: snapshot
|
|
1693
1725
|
- name: format
|
|
1694
1726
|
description: Output format
|
|
1695
1727
|
options: [json, table, xml]
|
package/dist/utils/exit.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";export{a as exitWithError,b as failWithError,c as getSuccessNextActions,d as printNextActions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g}from"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-6ZZ54RU7.js";export{d as beforeSend,f as captureError,g as flushTelemetry,e as initTelemetry,c as invocationCommand,a as redactSecrets,b as scrubArgv};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a,b,c,d,e}from"../chunk-DLK3GTAJ.js";import"../chunk-HWAEADX7.js";import"../chunk-6ZZ54RU7.js";export{e as checkForUpdates,d as fetchLatestVersion,c as getUpdateCommand,b as isNewerVersion,a as readUpdateCache};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tigrisdata/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Command line interface for Tigris object storage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -37,14 +37,17 @@
|
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@aws-sdk/credential-providers": "^3.1038.0",
|
|
40
|
+
"@clack/prompts": "^1.7.0",
|
|
41
|
+
"@sentry/node": "^10.66.0",
|
|
40
42
|
"@smithy/shared-ini-file-loader": "^4.4.9",
|
|
41
|
-
"commander": "^
|
|
43
|
+
"commander": "^15.0.0",
|
|
42
44
|
"enquirer": "^2.4.1",
|
|
43
45
|
"jose": "^6.2.3",
|
|
46
|
+
"jsonc-parser": "^3.3.1",
|
|
44
47
|
"open": "^11.0.0",
|
|
45
48
|
"yaml": "^2.8.3",
|
|
46
|
-
"@tigrisdata/iam": "^2.2.
|
|
47
|
-
"@tigrisdata/storage": "^3.
|
|
49
|
+
"@tigrisdata/iam": "^2.2.2",
|
|
50
|
+
"@tigrisdata/storage": "^3.18.0"
|
|
48
51
|
},
|
|
49
52
|
"devDependencies": {
|
|
50
53
|
"tsx": "^4.21.0"
|
package/dist/chunk-2Q2EKNAN.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{d,e as m,f}from"./chunk-ATBINUDP.js";import{mkdirSync as C,readFileSync as k,realpathSync as _,writeFileSync as E}from"fs";import I from"https";import{homedir as g}from"os";import{join as h}from"path";var p="3.4.3";var b=h(g(),".tigris","update-check.json");function y(){try{let e=k(b,"utf-8"),n=JSON.parse(e);return typeof n.latestVersion=="string"&&typeof n.lastChecked=="number"?n:null}catch{return null}}function w(e){try{C(h(g(),".tigris"),{recursive:!0}),E(b,JSON.stringify(e),"utf-8")}catch{}}function N(e,n){let o=s=>{let i=s.startsWith("v")?s.slice(1):s,c=null,a=i.indexOf("-");a!==-1&&(c=i.slice(a+1),i=i.slice(0,a));let l=i.split(".");if(l.length!==3)return null;let u=l.map(Number);return u.some(Number.isNaN)?null:{major:u[0],minor:u[1],patch:u[2],prerelease:c}},r=o(e),t=o(n);return!r||!t?!1:t.major>r.major?!0:t.major<r.major?!1:t.minor>r.minor?!0:t.minor<r.minor?!1:t.patch>r.patch?!0:t.patch<r.patch?!1:r.prerelease&&!t.prerelease?!0:(!r.prerelease&&t.prerelease,!1)}function T(){if(process.platform==="win32")return!1;try{let e=_(process.execPath);return e.includes("/Cellar/")||e.includes("/Caskroom/")}catch{return!1}}function L(){return globalThis.__TIGRIS_BINARY===!0?T()?"brew upgrade tigris":process.platform==="win32"?"irm https://raw.githubusercontent.com/tigrisdata/storage/main/packages/cli/scripts/install.ps1 | iex":"curl -fsSL https://raw.githubusercontent.com/tigrisdata/storage/main/packages/cli/scripts/install.sh | sh":"npm install -g @tigrisdata/cli"}function x(e={}){return new Promise((n,o)=>{let r=I.get(d,{timeout:1e4},t=>{let s="";t.on("data",i=>{s+=i}),t.on("end",()=>{try{let i=JSON.parse(s);typeof i.version=="string"?(w({...y(),latestVersion:i.version,lastChecked:Date.now()}),n(i.version)):o(new Error("Unexpected registry response"))}catch{o(new Error("Failed to parse registry response"))}})});r.on("error",t=>{o(t)}),r.on("timeout",()=>{r.destroy(),o(new Error("Request timed out"))}),e.unref&&r.on("socket",t=>{t.unref()}),r.end()})}function S(){x({unref:!0}).catch(()=>{})}function M(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let e=y(),n=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||36e5;if(e&&N(p,e.latestVersion)&&(!e.lastNotified||Date.now()-e.lastNotified>n)){let r=`Update available: ${p} \u2192 ${e.latestVersion}`,t='Run "tigris update" to upgrade.',s=Math.max(r.length,t.length)+4,i=`\u250C${"\u2500".repeat(s-2)}\u2510`,c=`\u2514${"\u2500".repeat(s-2)}\u2518`,a=l=>`\u2502 ${l.padEnd(s-4)} \u2502`;console.log(`
|
|
2
|
-
${i}
|
|
3
|
-
${a("")}
|
|
4
|
-
${a(r)}
|
|
5
|
-
${a(t)}
|
|
6
|
-
${a("")}
|
|
7
|
-
${c}
|
|
8
|
-
`),w({...e,lastNotified:Date.now()})}let o=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||216e5;(!e||Date.now()-e.lastChecked>o)&&S()}export{p as a,y as b,N as c,L as d,x as e,M as f};
|
package/dist/chunk-3QCSRNXC.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as i,b as a,c as g}from"./chunk-ATBINUDP.js";import{a as A,c as I}from"./chunk-VNUR4TRP.js";import{i as c,j as y,k as l,l as o,p as d}from"./chunk-F4AGJWCK.js";import{fromIni as _}from"@aws-sdk/credential-providers";function K(){return process.env.AWS_ENDPOINT_URL_S3||process.env.AWS_ENDPOINT_URL_IAM?{endpoint:process.env.AWS_ENDPOINT_URL_S3||i,iamEndpoint:process.env.AWS_ENDPOINT_URL_IAM||a,mgmtEndpoint:process.env.AWS_ENDPOINT_URL_MGMT||g}:{endpoint:process.env.TIGRIS_STORAGE_ENDPOINT||i,iamEndpoint:process.env.TIGRIS_IAM_ENDPOINT||a,mgmtEndpoint:process.env.TIGRIS_MGMT_ENDPOINT||g}}var r=K(),S=A();function p(){if(process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY){let e=process.env.AWS_ENDPOINT_URL_S3||i;return{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,endpoint:e,source:"aws"}}if(process.env.TIGRIS_STORAGE_ACCESS_KEY_ID&&process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY){let e=process.env.TIGRIS_STORAGE_ENDPOINT||i;return{accessKeyId:process.env.TIGRIS_STORAGE_ACCESS_KEY_ID,secretAccessKey:process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY,endpoint:e,source:"tigris"}}return null}var E=!1;async function T(){if(E||!process.stdin.isTTY)return!1;E=!0,console.log(`Not authenticated. Starting login...
|
|
2
|
-
`);let{default:e}=await import("./lib/login/select.js");return await e({}),console.log(),!0}async function C(){if(y()){let n=process.env.AWS_PROFILE||"default",u=await _({profile:n})();return{type:"aws-profile",profile:n,accessKeyId:u.accessKeyId,secretAccessKey:u.secretAccessKey}}let e=p();if(e)return{type:"environment",accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,source:e.source};let s=d();if(s==="oauth")return{type:"oauth"};if(s==="credentials"){let n=o();if(n)return{type:"credentials",accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey}}let t=o();return t?{type:"configured",accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey}:{type:"none"}}async function f(e){let s=await C();switch(s.type){case"aws-profile":{let t=await l(s.profile);return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,endpoint:t.endpoint||r.endpoint||i,iamEndpoint:t.iamEndpoint||r.iamEndpoint}}case"oauth":{let t=I(),n=c();if(!n)throw new Error('No organization selected. Please run "tigris orgs select" first.');return{sessionToken:await t.getAccessToken(),accessKeyId:"",secretAccessKey:"",...e?.withCredentialProvider&&{credentialProvider:async()=>({accessKeyId:"",secretAccessKey:"",sessionToken:await t.getAccessToken(),expiration:new Date(Date.now()+600*1e3)})},endpoint:r.endpoint,organizationId:n,iamEndpoint:r.iamEndpoint,authDomain:S.domain}}case"credentials":{let t=c();return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,endpoint:o()?.endpoint||i,organizationId:t??void 0,iamEndpoint:r.iamEndpoint}}case"environment":return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,endpoint:p()?.endpoint||i};case"configured":{let t=c();return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,endpoint:o()?.endpoint||i,organizationId:t??void 0,iamEndpoint:r.iamEndpoint}}case"none":{if(await T())return f(e);throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}}}async function N(){let e=await f(),s=c();return{...e,...s&&!e.organizationId?{organizationId:s}:{}}}function O(e){return d()==="oauth"?!1:(p()||o()?console.log(`You are using access key credentials, which belong to a single organization.
|
|
3
|
-
${e} is only available with OAuth login.
|
|
4
|
-
|
|
5
|
-
Run "tigris login" to login with your Tigris account.`):console.log('Not authenticated. Please run "tigris login" to login with your Tigris account.'),!0)}export{K as a,p as b,C as c,f as d,N as e,O as f};
|
package/dist/chunk-7O7LNYMA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as s,f as l}from"./chunk-2Q2EKNAN.js";import{a as i,k as m}from"./chunk-Z2LVZ3ZF.js";import{b as t}from"./chunk-NI4EYBQH.js";import{existsSync as c}from"fs";import{dirname as u,join as a}from"path";import{fileURLToPath as f}from"url";i();var j=f(import.meta.url),d=u(j),h=t(),y=o=>{if(o.length===0)return!1;let e=`${a(d,"lib",...o)}.js`;if(c(e))return!0;let r=a(d,"lib",...o,"index.js");return!!c(r)},b=async o=>{let e=[`./lib/${o.join("/")}.js`,`./lib/${o.join("/")}/index.js`];for(let p of e){let n=await import(p).catch(()=>null);if(n)return{module:n,error:null}}return{module:null,error:`Command not found: ${o.join(" ")}`}},x=m({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
|
package/dist/chunk-ATBINUDP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t="https://t3.storage.dev",s="https://iam.storageapi.dev",o="https://mgmt.storageapi.dev",e="https://registry.npmjs.org/@tigrisdata/cli/latest",T=216e5,_=36e5;export{t as a,s as b,o as c,e as d,T as e,_ as f};
|
package/dist/chunk-SE5TRZWU.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{b as r}from"./chunk-DV3LCXRH.js";import{a as s,d as c}from"./chunk-D7WXNA2O.js";import{c as i}from"./chunk-NI4EYBQH.js";function a(){return globalThis.__TIGRIS_JSON_MODE===!0}function m(){return process.stderr.isTTY===!0}function g(){return process.stdout.isTTY===!0}function p(n,o){let e=r(n);if(a()){let t={error:{message:e.message,code:e.exitCode,category:e.category}};e.nextActions.length>0&&(t.nextActions=e.nextActions),console.error(JSON.stringify(t))}else if(o||console.error(`
|
|
2
|
-
Error: ${e.message}`),m()&&e.nextActions.length>0){console.error(`
|
|
3
|
-
Next steps:`);for(let t of e.nextActions)console.error(` \u2192 ${t.command} ${t.description}`)}process.exit(e.exitCode)}function d(n,o){let e=o instanceof Error?o.message:String(o);c(n,e),p(o,n)}function f(n,o){let e=i(n.command,n.operation);return e?.messages?.nextActions?e.messages.nextActions.map(t=>({command:s(t.command,o),description:s(t.description,o)})):[]}function A(n,o){if(!g()||a())return;let e=f(n,o);if(e.length!==0){console.log(`
|
|
4
|
-
Next steps:`);for(let t of e)console.log(` \u2192 ${t.command} ${t.description}`)}}export{p as a,d as b,f as c,A as d};
|
package/dist/chunk-VNUR4TRP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as d,d as s,e as g,f,g as p,o as k}from"./chunk-F4AGJWCK.js";import{createRemoteJWKSet as w,jwtVerify as T}from"jose";import _ from"open";function y(){let a=process.env.TIGRIS_ENV==="development",e=a?process.env.AUTH0_DOMAIN??"auth-storage.tigris.dev":process.env.AUTH0_DOMAIN??"auth.storage.tigrisdata.io",t=a?process.env.AUTH0_CLIENT_ID??"JdJVYIyw0O1uHi5L5OJH903qaWBgd3gF":process.env.AUTH0_CLIENT_ID??"DMejqeM3CQ4IqTjEcd3oA9eEiT40hn8D",n=a?process.env.AUTH0_AUDIENCE??"https://tigris-api-dev":process.env.AUTH0_AUDIENCE??"https://tigris-os-api",i=process.env.TIGRIS_CLAIMS_NAMESPACE??"https://tigris";return{domain:e,clientId:t,audience:n,claimsNamespace:i}}var u=class{config;baseUrl;jwks=null;constructor(){this.config=y(),this.baseUrl=`https://${this.config.domain}`}getJWKS(){return this.jwks||(this.jwks=w(new URL(`${this.baseUrl}/.well-known/jwks.json`))),this.jwks}async verifyIdToken(e){let{payload:t}=await T(e,this.getJWKS(),{issuer:`${this.baseUrl}/`,audience:this.config.clientId});return t}async login(e){let t=await fetch(`${this.baseUrl}/oauth/device/code`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:this.config.clientId,audience:this.config.audience,scope:"openid profile email offline_access"})});if(!t.ok)throw new Error(`Device authorization failed: ${t.statusText}`);let n=JSON.parse(await t.text());e?.onDeviceCode?.(n.user_code,n.verification_uri),await this.sleep(2e3);try{await _(n.verification_uri_complete)}catch{}e?.onWaiting?.();let i=await this.pollForToken(n.device_code,n.interval||5);await d(i),k("oauth"),await this.extractAndStoreOrganizations()}async pollForToken(e,t){let i=0;for(;i<60;){i++;let r=await fetch(`${this.baseUrl}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:this.config.clientId,device_code:e,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(!r.ok){let l=await r.text().then(JSON.parse).catch(()=>({}));if(l.error==="authorization_pending"){await this.sleep(t*1e3);continue}if(l.error==="slow_down"){t+=5,await this.sleep(t*1e3);continue}throw new Error(l.error_description||"Authentication failed")}let o=JSON.parse(await r.text());if(!o.id_token)throw new Error("No ID token found. Please try again.");if((await this.verifyIdToken(o.id_token)).email_verified===!1)throw console.log("Email not verified. Please verify your email and try again."),new Error("Email not verified. Please verify your email and try again.");let m=Date.now()+(o.expires_in||3600)*1e3;return{accessToken:o.access_token,refreshToken:o.refresh_token,idToken:o.id_token,expiresAt:m}}throw new Error("Authentication timed out. Please try again.")}async getAccessToken(){let e=await s();if(!e)throw new Error('Not authenticated. Please run "tigris login" to authenticate.');let t=300*1e3;return Date.now()+t>=e.expiresAt&&(e=await this.refreshAccessToken(e)),e.accessToken}async refreshAccessToken(e){let t;if(e?.refreshToken?t=e:t=await s(),!t?.refreshToken)throw new Error('No refresh token available. Please run "tigris login" to re-authenticate.');try{let n=await fetch(`${this.baseUrl}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:this.config.clientId,grant_type:"refresh_token",refresh_token:t.refreshToken,scope:"openid profile email offline_access"})});if(!n.ok)throw new Error("Token refresh failed");let i=JSON.parse(await n.text()),r={accessToken:i.access_token,refreshToken:i.refresh_token||t.refreshToken,idToken:i.id_token||t.idToken,expiresAt:Date.now()+(i.expires_in||3600)*1e3};return await d(r),r}catch{throw await g(),new Error('Token refresh failed. Please run "tigris login" to re-authenticate.')}}async getIdTokenClaims(){let e=await s();if(!e?.idToken)throw new Error('Not authenticated. Please run "tigris login" to authenticate.');try{return await this.verifyIdToken(e.idToken)}catch{throw new Error('ID token verification failed. Please run "tigris login" to re-authenticate.')}}async extractAndStoreOrganizations(){try{let e=await this.fetchOrganizationsFromUserInfo();e&&f(e)}catch{}}async fetchOrganizationsFromUserInfo(){try{let{domain:e,claimsNamespace:t}=this.config,n=await this.getAccessToken(),i=await fetch(`https://${e}/userinfo`,{headers:{Authorization:`Bearer ${n}`}});if(!i.ok)return null;let o=JSON.parse(await i.text())[t]?.ns;return Array.isArray(o)?o.map(c=>({id:c.id,name:c.name,slug:c.name})):null}catch{return null}}async getOrganizations(){return await this.getAccessToken(),p()}async isFlyUser(){return(await this.getIdTokenClaims()).sub.includes("fly-sso")}async logout(){await g()}async isAuthenticated(){return await s()!==null}sleep(e){return new Promise(t=>setTimeout(t,e))}},h=null;function C(){return h||(h=new u),h}export{y as a,u as b,C as c};
|