@tigrisdata/cli 3.10.0 → 3.11.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 (120) hide show
  1. package/README.md +35 -3
  2. package/dist/auth/iam.js +1 -1
  3. package/dist/auth/provider.js +1 -1
  4. package/dist/{chunk-R3KHIAWP.js → chunk-5AGM4LUA.js} +1 -1
  5. package/dist/{chunk-HAYPV4J6.js → chunk-5QNWWNPL.js} +1 -1
  6. package/dist/{chunk-IIF5VLQ7.js → chunk-6TTEDYLD.js} +1 -1
  7. package/dist/{chunk-ZTZF3OHU.js → chunk-7BUC7A7V.js} +1 -1
  8. package/dist/{chunk-RDJQLQQY.js → chunk-7Q44GQ2Y.js} +1 -1
  9. package/dist/{chunk-4FAKNMI5.js → chunk-GMZ3URGL.js} +1 -1
  10. package/dist/{chunk-UZIIZW33.js → chunk-GZMEHP36.js} +1 -1
  11. package/dist/{chunk-JUOJKZRI.js → chunk-IEFUKJDE.js} +1 -1
  12. package/dist/chunk-IUIKP2LU.js +1 -0
  13. package/dist/chunk-KJXUEGXY.js +8 -0
  14. package/dist/{chunk-TFXO4OXM.js → chunk-PUHRE62R.js} +1 -1
  15. package/dist/chunk-QPUL2AAI.js +1 -0
  16. package/dist/{chunk-CEEDWOY2.js → chunk-TVH7NCXE.js} +1 -1
  17. package/dist/{chunk-MQEI5KKF.js → chunk-VPELL4UB.js} +1 -1
  18. package/dist/chunk-Z54TMLIH.js +1 -0
  19. package/dist/{chunk-PNRZDYCK.js → chunk-Z5DYQHN2.js} +1 -1
  20. package/dist/cli-core.js +1 -1
  21. package/dist/cli.js +1 -1
  22. package/dist/constants.js +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/lib/access-keys/assign.js +1 -1
  25. package/dist/lib/access-keys/attach-policy.js +1 -1
  26. package/dist/lib/access-keys/create.js +1 -1
  27. package/dist/lib/access-keys/delete.js +1 -1
  28. package/dist/lib/access-keys/detach-policy.js +1 -1
  29. package/dist/lib/access-keys/get.js +1 -1
  30. package/dist/lib/access-keys/list-policies.js +1 -1
  31. package/dist/lib/access-keys/list.js +1 -1
  32. package/dist/lib/access-keys/rotate.js +1 -1
  33. package/dist/lib/buckets/create.js +1 -1
  34. package/dist/lib/buckets/delete.js +1 -1
  35. package/dist/lib/buckets/disable-snapshots.js +1 -1
  36. package/dist/lib/buckets/enable-snapshots.js +1 -1
  37. package/dist/lib/buckets/get.js +1 -1
  38. package/dist/lib/buckets/lifecycle/create.js +1 -1
  39. package/dist/lib/buckets/lifecycle/edit.js +1 -1
  40. package/dist/lib/buckets/lifecycle/list.js +1 -1
  41. package/dist/lib/buckets/lifecycle/shared.js +1 -1
  42. package/dist/lib/buckets/list.js +1 -1
  43. package/dist/lib/buckets/merge.js +1 -1
  44. package/dist/lib/buckets/migrate.js +1 -1
  45. package/dist/lib/buckets/rebase.js +1 -1
  46. package/dist/lib/buckets/restore.js +1 -1
  47. package/dist/lib/buckets/set-cors.js +1 -1
  48. package/dist/lib/buckets/set-locations.js +1 -1
  49. package/dist/lib/buckets/set-migration.js +1 -1
  50. package/dist/lib/buckets/set-notifications.js +1 -1
  51. package/dist/lib/buckets/set.js +1 -1
  52. package/dist/lib/buckets/share.js +1 -0
  53. package/dist/lib/bundle.js +1 -1
  54. package/dist/lib/configure/index.js +1 -1
  55. package/dist/lib/cp.js +1 -1
  56. package/dist/lib/credentials/test.js +1 -1
  57. package/dist/lib/iam/policies/create.js +1 -1
  58. package/dist/lib/iam/policies/delete.js +1 -1
  59. package/dist/lib/iam/policies/edit.js +1 -1
  60. package/dist/lib/iam/policies/get.js +1 -1
  61. package/dist/lib/iam/policies/link-key.js +1 -1
  62. package/dist/lib/iam/policies/list-keys.js +1 -1
  63. package/dist/lib/iam/policies/list.js +1 -1
  64. package/dist/lib/iam/policies/select-policy.js +1 -1
  65. package/dist/lib/iam/policies/unlink-key.js +1 -1
  66. package/dist/lib/iam/teams/create.js +1 -1
  67. package/dist/lib/iam/teams/edit.js +1 -1
  68. package/dist/lib/iam/teams/list.js +1 -1
  69. package/dist/lib/iam/teams/shared.js +1 -1
  70. package/dist/lib/iam/users/invite.js +1 -1
  71. package/dist/lib/iam/users/list.js +1 -1
  72. package/dist/lib/iam/users/remove.js +1 -1
  73. package/dist/lib/iam/users/revoke-invitation.js +1 -1
  74. package/dist/lib/iam/users/update-role.js +1 -1
  75. package/dist/lib/init/index.js +1 -1
  76. package/dist/lib/login/credentials.js +1 -1
  77. package/dist/lib/login/oauth.js +1 -1
  78. package/dist/lib/login/select.js +1 -1
  79. package/dist/lib/logout.js +1 -1
  80. package/dist/lib/ls.js +1 -1
  81. package/dist/lib/mk.js +1 -1
  82. package/dist/lib/mv.js +1 -1
  83. package/dist/lib/objects/delete.js +1 -1
  84. package/dist/lib/objects/get.js +1 -1
  85. package/dist/lib/objects/info.js +1 -1
  86. package/dist/lib/objects/list-versions.js +1 -1
  87. package/dist/lib/objects/list.js +1 -1
  88. package/dist/lib/objects/purge.js +1 -1
  89. package/dist/lib/objects/put.js +1 -1
  90. package/dist/lib/objects/restore-deleted.js +1 -1
  91. package/dist/lib/objects/restore-info.js +1 -1
  92. package/dist/lib/objects/restore.js +1 -1
  93. package/dist/lib/objects/set-access.js +1 -1
  94. package/dist/lib/objects/set.js +1 -1
  95. package/dist/lib/organizations/create.js +1 -1
  96. package/dist/lib/organizations/list.js +1 -1
  97. package/dist/lib/organizations/select.js +1 -1
  98. package/dist/lib/presign.js +2 -2
  99. package/dist/lib/rm.js +1 -1
  100. package/dist/lib/snapshots/delete.js +1 -1
  101. package/dist/lib/snapshots/list.js +1 -1
  102. package/dist/lib/snapshots/take.js +1 -1
  103. package/dist/lib/stat.js +1 -1
  104. package/dist/lib/telemetry/disable.js +1 -1
  105. package/dist/lib/telemetry/enable.js +1 -1
  106. package/dist/lib/telemetry/status.js +1 -1
  107. package/dist/lib/touch.js +1 -1
  108. package/dist/lib/update.js +1 -1
  109. package/dist/lib/whoami.js +1 -1
  110. package/dist/specs.yaml +57 -2
  111. package/dist/utils/analytics.js +1 -1
  112. package/dist/utils/bucket-info.js +1 -1
  113. package/dist/utils/exit.js +1 -1
  114. package/dist/utils/telemetry.js +1 -1
  115. package/dist/utils/update-check.js +1 -1
  116. package/package.json +3 -3
  117. package/dist/chunk-76VFN2EJ.js +0 -8
  118. package/dist/chunk-JNSFDQGG.js +0 -1
  119. package/dist/chunk-RH6Z22EN.js +0 -1
  120. package/dist/chunk-V6JZFDRE.js +0 -1
package/dist/lib/mv.js CHANGED
@@ -1 +1 @@
1
- import{a as S,b as W}from"../chunk-S77OAN6Y.js";import{a as x,b as j,d as E,f as J,g as U,i as q,j as R,k as _}from"../chunk-KIT6R3V2.js";import{e as D}from"../chunk-R3KHIAWP.js";import{a as $,b as T}from"../chunk-S6KFKBMY.js";import{a as s}from"../chunk-IIF5VLQ7.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-RDJQLQQY.js";import"../chunk-DV3LCXRH.js";import"../chunk-RH6Z22EN.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-V6JZFDRE.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{copy as L,list as Q,move as V,put as X,remove as C}from"@tigrisdata/storage";var p=!1;async function Y(i){let a=$(i,["src"]),c=$(i,["dest"]),u=$(i,["yes","y","force","f"]),h=!!$(i,["recursive","r"]);p=T(i)==="json",(!a||!c)&&s("both src and dest arguments are required"),(!x(a)||!x(c))&&s("Both src and dest must be remote Tigris paths (t3:// or tigris://)");let e=j(a),t=j(c);e.bucket||s("Invalid source path"),t.bucket||s("Invalid destination path");let g=a.endsWith("/");!e.path&&!g&&s("Cannot move a bucket. Provide a path within the bucket.");let f=await D({withCredentialProvider:!0}),d=e.path.includes("*"),w=e.path.endsWith("/")||!e.path&&g;if(!d&&!w&&e.path&&(w=await E(e.bucket,e.path,f)),w&&!d&&!h&&s("Source is a remote folder (not moved). Use -r to move recursively."),d||w){let r=d?U(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",n=!d&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",m=[t.path?.replace(/\/$/,"")||"",n].filter(Boolean).join("/"),z=m?`${m}/`:"";e.bucket===t.bucket&&r===z&&s("Source and destination are the same");let{items:G,error:I}=await _(e.bucket,r||void 0,f);I&&s(I);let b=G.filter(o=>o.name!==r);if(d){let o=e.path.split("/").pop(),l=J(o);b=b.filter(v=>{let k=r?v.name.slice(r.length):v.name;return!h&&k.includes("/")?!1:l.test(k.split("/").pop())})}let y=!1;if(r&&!d){let{data:o}=await Q({prefix:r,limit:1,config:{...f,bucket:e.bucket}});y=!!o?.items?.some(l=>l.name===r)}if(b.length===0&&!y){console.log(p?JSON.stringify({action:"moved",count:0}):"No objects to move");return}let N=[...b.map(o=>o.name),...y?[r]:[]],H=R(N);if(!u&&(S("Use --yes to skip confirmation"),!await W(`Are you sure you want to move ${H} object(s)?`))){p||console.log("Aborted");return}let P=[];for(let o of b){let l=r?o.name.slice(r.length):o.name,v=m?`${m}/${l}`:l,k=await A(f,e.bucket,o.name,t.bucket,v);k.error?console.error(`Failed to move ${o.name}: ${k.error}`):(!p&&!q(o.name)&&console.log(`Moved t3://${e.bucket}/${o.name} -> t3://${t.bucket}/${v}`),P.push(o.name))}if(y)if(m){let o=`${m}/`,l=await A(f,e.bucket,r,t.bucket,o);l.error?console.error(`Failed to move folder marker: ${l.error}`):P.push(r)}else{let{error:o}=await C(r,{config:{...f,bucket:e.bucket}});o?console.error(`Failed to remove source folder marker: ${o.message}`):P.push(r)}let O=R(N,P);console.log(p?JSON.stringify({action:"moved",count:O}):`Moved ${O} object(s)`)}else{let r=e.path.split("/").pop(),n;if(t.path?t.path.endsWith("/")?n=`${t.path}${r}`:await E(t.bucket,t.path,f)?n=`${t.path}/${r}`:n=t.path:n=r,e.bucket===t.bucket&&e.path===n&&s("Source and destination are the same"),!u&&(S("Use --yes to skip confirmation"),!await W(`Are you sure you want to move 't3://${e.bucket}/${e.path}'?`))){p||console.log("Aborted");return}let M=await A(f,e.bucket,e.path,t.bucket,n);M.error&&s(M.error),console.log(p?JSON.stringify({action:"moved",count:1,src:`t3://${e.bucket}/${e.path}`,dest:`t3://${t.bucket}/${n}`}):`Moved t3://${e.bucket}/${e.path} -> t3://${t.bucket}/${n}`)}process.exit(0)}async function A(i,a,c,u,h){if(c.endsWith("/")){let{error:t}=await X(h,"",{config:{...i,bucket:u}});if(t)return{error:t.message};let{error:g}=await C(c,{config:{...i,bucket:a}});return g?{error:`Copied but failed to delete source: ${g.message}`}:{}}if(a===u){let{error:t}=await V(c,h,{config:{...i,bucket:a}});return t?{error:t.message}:{}}let{error:F}=await L(c,h,{srcBucket:a,destBucket:u,config:{...i,bucket:u}});if(F)return{error:F.message};let{error:e}=await C(c,{config:{...i,bucket:a}});return e?{error:`Copied but failed to delete source: ${e.message}`}:{}}export{Y as default};
1
+ import{a as S,b as W}from"../chunk-S77OAN6Y.js";import{a as x,b as j,d as E,f as J,g as U,i as q,j as R,k as _}from"../chunk-KIT6R3V2.js";import{e as D}from"../chunk-5AGM4LUA.js";import{a as $,b as T}from"../chunk-S6KFKBMY.js";import{a as s}from"../chunk-6TTEDYLD.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-7Q44GQ2Y.js";import"../chunk-DV3LCXRH.js";import"../chunk-Z54TMLIH.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-QPUL2AAI.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{copy as L,list as Q,move as V,put as X,remove as C}from"@tigrisdata/storage";var p=!1;async function Y(i){let a=$(i,["src"]),c=$(i,["dest"]),u=$(i,["yes","y","force","f"]),h=!!$(i,["recursive","r"]);p=T(i)==="json",(!a||!c)&&s("both src and dest arguments are required"),(!x(a)||!x(c))&&s("Both src and dest must be remote Tigris paths (t3:// or tigris://)");let e=j(a),t=j(c);e.bucket||s("Invalid source path"),t.bucket||s("Invalid destination path");let g=a.endsWith("/");!e.path&&!g&&s("Cannot move a bucket. Provide a path within the bucket.");let f=await D({withCredentialProvider:!0}),d=e.path.includes("*"),w=e.path.endsWith("/")||!e.path&&g;if(!d&&!w&&e.path&&(w=await E(e.bucket,e.path,f)),w&&!d&&!h&&s("Source is a remote folder (not moved). Use -r to move recursively."),d||w){let r=d?U(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",n=!d&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",m=[t.path?.replace(/\/$/,"")||"",n].filter(Boolean).join("/"),z=m?`${m}/`:"";e.bucket===t.bucket&&r===z&&s("Source and destination are the same");let{items:G,error:I}=await _(e.bucket,r||void 0,f);I&&s(I);let b=G.filter(o=>o.name!==r);if(d){let o=e.path.split("/").pop(),l=J(o);b=b.filter(v=>{let k=r?v.name.slice(r.length):v.name;return!h&&k.includes("/")?!1:l.test(k.split("/").pop())})}let y=!1;if(r&&!d){let{data:o}=await Q({prefix:r,limit:1,config:{...f,bucket:e.bucket}});y=!!o?.items?.some(l=>l.name===r)}if(b.length===0&&!y){console.log(p?JSON.stringify({action:"moved",count:0}):"No objects to move");return}let N=[...b.map(o=>o.name),...y?[r]:[]],H=R(N);if(!u&&(S("Use --yes to skip confirmation"),!await W(`Are you sure you want to move ${H} object(s)?`))){p||console.log("Aborted");return}let P=[];for(let o of b){let l=r?o.name.slice(r.length):o.name,v=m?`${m}/${l}`:l,k=await A(f,e.bucket,o.name,t.bucket,v);k.error?console.error(`Failed to move ${o.name}: ${k.error}`):(!p&&!q(o.name)&&console.log(`Moved t3://${e.bucket}/${o.name} -> t3://${t.bucket}/${v}`),P.push(o.name))}if(y)if(m){let o=`${m}/`,l=await A(f,e.bucket,r,t.bucket,o);l.error?console.error(`Failed to move folder marker: ${l.error}`):P.push(r)}else{let{error:o}=await C(r,{config:{...f,bucket:e.bucket}});o?console.error(`Failed to remove source folder marker: ${o.message}`):P.push(r)}let O=R(N,P);console.log(p?JSON.stringify({action:"moved",count:O}):`Moved ${O} object(s)`)}else{let r=e.path.split("/").pop(),n;if(t.path?t.path.endsWith("/")?n=`${t.path}${r}`:await E(t.bucket,t.path,f)?n=`${t.path}/${r}`:n=t.path:n=r,e.bucket===t.bucket&&e.path===n&&s("Source and destination are the same"),!u&&(S("Use --yes to skip confirmation"),!await W(`Are you sure you want to move 't3://${e.bucket}/${e.path}'?`))){p||console.log("Aborted");return}let M=await A(f,e.bucket,e.path,t.bucket,n);M.error&&s(M.error),console.log(p?JSON.stringify({action:"moved",count:1,src:`t3://${e.bucket}/${e.path}`,dest:`t3://${t.bucket}/${n}`}):`Moved t3://${e.bucket}/${e.path} -> t3://${t.bucket}/${n}`)}process.exit(0)}async function A(i,a,c,u,h){if(c.endsWith("/")){let{error:t}=await X(h,"",{config:{...i,bucket:u}});if(t)return{error:t.message};let{error:g}=await C(c,{config:{...i,bucket:a}});return g?{error:`Copied but failed to delete source: ${g.message}`}:{}}if(a===u){let{error:t}=await V(c,h,{config:{...i,bucket:a}});return t?{error:t.message}:{}}let{error:F}=await L(c,h,{srcBucket:a,destBucket:u,config:{...i,bucket:u}});if(F)return{error:F.message};let{error:e}=await C(c,{config:{...i,bucket:a}});return e?{error:`Copied but failed to delete source: ${e.message}`}:{}}export{Y as default};
@@ -1 +1 @@
1
- import{a as V,b as N}from"../../chunk-S77OAN6Y.js";import{h as C}from"../../chunk-KIT6R3V2.js";import{e as q}from"../../chunk-R3KHIAWP.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-IIF5VLQ7.js";import{b as A,c as $,d as j,j as M}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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};
1
+ import{a as V,b as N}from"../../chunk-S77OAN6Y.js";import{h as C}from"../../chunk-KIT6R3V2.js";import{e as q}from"../../chunk-5AGM4LUA.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-6TTEDYLD.js";import{b as A,c as $,d as j,j as M}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.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};
@@ -1 +1 @@
1
- import{h as w}from"../../chunk-KIT6R3V2.js";import{e as k}from"../../chunk-R3KHIAWP.js";import{a as r,b as j}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-IIF5VLQ7.js";import{b as u,c as a,j as b}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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};
1
+ import{h as w}from"../../chunk-KIT6R3V2.js";import{e as k}from"../../chunk-5AGM4LUA.js";import{a as r,b as j}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-6TTEDYLD.js";import{b as u,c as a,j as b}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.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};
@@ -1 +1 @@
1
- import{a as h,f as k}from"../../chunk-AFM3TY2D.js";import{h as v}from"../../chunk-KIT6R3V2.js";import{e as l}from"../../chunk-R3KHIAWP.js";import{a as i,b as d}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-IIF5VLQ7.js";import{b as u,c as p,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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
+ import{a as h,f as k}from"../../chunk-AFM3TY2D.js";import{h as v}from"../../chunk-KIT6R3V2.js";import{e as l}from"../../chunk-5AGM4LUA.js";import{a as i,b as d}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-6TTEDYLD.js";import{b as u,c as p,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.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 w,b as z,d as l,e as d}from"../../chunk-AFM3TY2D.js";import{e as K}from"../../chunk-KIT6R3V2.js";import{e as C}from"../../chunk-R3KHIAWP.js";import{a as t,b,c as V}from"../../chunk-S6KFKBMY.js";import{b as a}from"../../chunk-IIF5VLQ7.js";import{b as u,c as x,e as v,j as I}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{listVersions as O}from"@tigrisdata/storage";var i=I("objects","list-versions");async function R(s){u(i);let k=t(s,["bucket"]),P=t(s,["prefix","p","P"]),m=t(s,["delimiter","d"]),c=t(s,["key-marker","keyMarker"]),f=t(s,["version-id-marker","versionIdMarker"]),g=b(s),y=!!t(s,["deleted"]),{limit:M}=V(s);k||a(i,"Bucket name is required");let h=K(k),S=h.bucket,j=P||h.path||void 0,L=await C(),{data:r,error:p}=await O({prefix:j,...m?{delimiter:m}:{},...y?{deleted:y}:{},...M!==void 0?{limit:M}:{},...c?{keyMarker:c}:{},...f?{versionIdMarker:f}:{},config:{...L,bucket:S}});p&&a(i,p);let o=r.versions.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",size:w(e.size),modified:e.lastModified})),n=r.deleteMarkers.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",modified:e.lastModified})),T=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],D=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"modified",header:"Modified"}];if(g==="json")console.log(z({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(o,"versions","version").replace(/\n/g,`
1
+ import{a as w,b as z,d as l,e as d}from"../../chunk-AFM3TY2D.js";import{e as K}from"../../chunk-KIT6R3V2.js";import{e as C}from"../../chunk-5AGM4LUA.js";import{a as t,b,c as V}from"../../chunk-S6KFKBMY.js";import{b as a}from"../../chunk-6TTEDYLD.js";import{b as u,c as x,e as v,j as I}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{listVersions as O}from"@tigrisdata/storage";var i=I("objects","list-versions");async function R(s){u(i);let k=t(s,["bucket"]),P=t(s,["prefix","p","P"]),m=t(s,["delimiter","d"]),c=t(s,["key-marker","keyMarker"]),f=t(s,["version-id-marker","versionIdMarker"]),g=b(s),y=!!t(s,["deleted"]),{limit:M}=V(s);k||a(i,"Bucket name is required");let h=K(k),S=h.bucket,j=P||h.path||void 0,L=await C(),{data:r,error:p}=await O({prefix:j,...m?{delimiter:m}:{},...y?{deleted:y}:{},...M!==void 0?{limit:M}:{},...c?{keyMarker:c}:{},...f?{versionIdMarker:f}:{},config:{...L,bucket:S}});p&&a(i,p);let o=r.versions.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",size:w(e.size),modified:e.lastModified})),n=r.deleteMarkers.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",modified:e.lastModified})),T=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],D=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"modified",header:"Modified"}];if(g==="json")console.log(z({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(o,"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(o.length===0&&n.length===0){v(i);return}if(o.length>0&&(console.log(`
@@ -1 +1 @@
1
- import{a as w,g as O}from"../../chunk-AFM3TY2D.js";import{e as T}from"../../chunk-KIT6R3V2.js";import{e as S}from"../../chunk-R3KHIAWP.js";import{a as e,b as z,c as P}from"../../chunk-S6KFKBMY.js";import{b as s}from"../../chunk-IIF5VLQ7.js";import{b as h,c as b,e as y,i as x,j}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{list as v}from"@tigrisdata/storage";var n=j("objects","list");async function B(t){h(n);let a=e(t,["bucket"]),A=e(t,["prefix","p","P"]),i=z(t),c=e(t,["snapshot-version","snapshotVersion","snapshot"]),f=e(t,["source"]),m=!!e(t,["deleted"]),{limit:d,pageToken:p}=P(t);a||s(n,"Bucket name is required");let g=T(a),E=g.bucket,F=A||g.path||void 0,M=await S(),{data:o,error:u}=await v({prefix:F,...c?{snapshotVersion:c}:{},...f?{source:f}:{},...m?{deleted:m}:{},...d!==void 0?{limit:d}:{},...p?{paginationToken:p}:{},config:{...M,bucket:E}});if(u&&s(n,u),!o.items||o.items.length===0){y(n);return}let l=o.items.map(r=>({key:r.name,size:w(r.size),modified:r.lastModified})),V=[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],k=o.paginationToken||void 0,q=O(l,i,"objects","object",V,{paginationToken:k});console.log(q),i!=="json"&&i!=="xml"&&x(k),b(n,{count:l.length})}export{B as default};
1
+ import{a as w,g as O}from"../../chunk-AFM3TY2D.js";import{e as T}from"../../chunk-KIT6R3V2.js";import{e as S}from"../../chunk-5AGM4LUA.js";import{a as e,b as z,c as P}from"../../chunk-S6KFKBMY.js";import{b as s}from"../../chunk-6TTEDYLD.js";import{b as h,c as b,e as y,i as x,j}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{list as v}from"@tigrisdata/storage";var n=j("objects","list");async function B(t){h(n);let a=e(t,["bucket"]),A=e(t,["prefix","p","P"]),i=z(t),c=e(t,["snapshot-version","snapshotVersion","snapshot"]),f=e(t,["source"]),m=!!e(t,["deleted"]),{limit:d,pageToken:p}=P(t);a||s(n,"Bucket name is required");let g=T(a),E=g.bucket,F=A||g.path||void 0,M=await S(),{data:o,error:u}=await v({prefix:F,...c?{snapshotVersion:c}:{},...f?{source:f}:{},...m?{deleted:m}:{},...d!==void 0?{limit:d}:{},...p?{paginationToken:p}:{},config:{...M,bucket:E}});if(u&&s(n,u),!o.items||o.items.length===0){y(n);return}let l=o.items.map(r=>({key:r.name,size:w(r.size),modified:r.lastModified})),V=[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],k=o.paginationToken||void 0,q=O(l,i,"objects","object",V,{paginationToken:k});console.log(q),i!=="json"&&i!=="xml"&&x(k),b(n,{count:l.length})}export{B as default};
@@ -1 +1 @@
1
- import{a as u,b as d}from"../../chunk-S77OAN6Y.js";import{h as y}from"../../chunk-KIT6R3V2.js";import{e as l}from"../../chunk-R3KHIAWP.js";import{a as n,b as p}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-IIF5VLQ7.js";import{b as g,c as m,j as a}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{purgeDeletedObject as O}from"@tigrisdata/storage";var r=a("objects","purge");async function q(e){g(r);let b=p(e),s=n(e,["bucket"]),k=n(e,["key"]),o=n(e,["version-id","versionId"]),v=n(e,["yes","y","force"]);s||i(r,"Bucket name or path is required");let{bucket:c,key:t}=y(s,k);if(t||i(r,"Object key is required"),o||i(r,"--version-id is required"),!v&&(u("Use --yes to skip confirmation"),!await d(`Permanently destroy version '${o}' of '${t}' in '${c}'? It can no longer be restored.`))){console.log("Aborted");return}let j=await l(),{error:f}=await O(t,o,{config:{...j,bucket:c}});f&&i(r,f),b==="json"&&console.log(JSON.stringify({action:"purged",bucket:c,key:t,versionId:o})),m(r,{key:t,bucket:c,versionId:o})}export{q as default};
1
+ import{a as u,b as d}from"../../chunk-S77OAN6Y.js";import{h as y}from"../../chunk-KIT6R3V2.js";import{e as l}from"../../chunk-5AGM4LUA.js";import{a as n,b as p}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-6TTEDYLD.js";import{b as g,c as m,j as a}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{purgeDeletedObject as O}from"@tigrisdata/storage";var r=a("objects","purge");async function q(e){g(r);let b=p(e),s=n(e,["bucket"]),k=n(e,["key"]),o=n(e,["version-id","versionId"]),v=n(e,["yes","y","force"]);s||i(r,"Bucket name or path is required");let{bucket:c,key:t}=y(s,k);if(t||i(r,"Object key is required"),o||i(r,"--version-id is required"),!v&&(u("Use --yes to skip confirmation"),!await d(`Permanently destroy version '${o}' of '${t}' in '${c}'? It can no longer be restored.`))){console.log("Aborted");return}let j=await l(),{error:f}=await O(t,o,{config:{...j,bucket:c}});f&&i(r,f),b==="json"&&console.log(JSON.stringify({action:"purged",bucket:c,key:t,versionId:o})),m(r,{key:t,bucket:c,versionId:o})}export{q as default};
@@ -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-KIT6R3V2.js";import{e as w}from"../../chunk-R3KHIAWP.js";import{a as n,b as z}from"../../chunk-S6KFKBMY.js";import{b as i,d as T}from"../../chunk-IIF5VLQ7.js";import{b as k,c as S,j as h}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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
+ import{a as A}from"../../chunk-EKW6XTGL.js";import{a as v}from"../../chunk-HPICBIXL.js";import{a,f as j}from"../../chunk-AFM3TY2D.js";import{h as w}from"../../chunk-KIT6R3V2.js";import{e as z}from"../../chunk-5AGM4LUA.js";import{a as r,b as T}from"../../chunk-S6KFKBMY.js";import{b as n,d as C}from"../../chunk-6TTEDYLD.js";import{b,c as k,j as S}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{createReadStream as M,statSync as N}from"fs";import{Readable as R}from"stream";import{put as Y}from"@tigrisdata/storage";var t=S("objects","put");async function D(o){b(t);let l=r(o,["bucket"]),u=r(o,["key"]),y=r(o,["file"]),$=r(o,["access","a","A"],"private"),O=r(o,["content-type","contentType","t","T"]),P=r(o,["cache-control","cacheControl"]),q=T(o);l||n(t,"Bucket name or path is required");let d=w(l),m=d.bucket,s=d.key||u,e=d.key&&u||y;s||n(t,"Object key is required");let U=!process.stdin.isTTY;!e&&!U&&n(t,"File path is required (or pipe data via stdin)");let f,i;if(e){try{i=N(e).size}catch{n(t,`File not found: ${e}`)}let p=M(e);f=R.toWeb(p)}else f=R.toWeb(process.stdin);let x=await z({withCredentialProvider:!0}),F=e?A(i):{multipart:!0,partSize:5*1024*1024,queueSize:8},W=O??(e?v(e):void 0),{data:c,error:g}=await Y(s,f,{access:$==="public"?"public":"private",contentType:W,cacheControl:P,...F,onUploadProgress:({loaded:p,percentage:h})=>{i!==void 0&&i>0?process.stdout.write(`\rUploading: ${a(p)} / ${a(i)} (${h}%)`):process.stdout.write(`\rUploading: ${a(p)}`)},config:{...x,bucket:m}});process.stdout.write(`\r${" ".repeat(60)}\r`),g&&n(t,g);let B=[{path:c.path,size:a(c.size??i??0),contentType:c.contentType||"-",cacheControl:c.cacheControl||"-",modified:c.modified}],E=j(B,q,"objects","object",[{key:"path",header:"Path"},{key:"size",header:"Size"},{key:"contentType",header:"Content-Type"},{key:"cacheControl",header:"Cache-Control"},{key:"modified",header:"Modified"}]);console.log(E),k(t,{key:s,bucket:m}),C(t,{key:s,bucket:m})}export{D as default};
@@ -1 +1 @@
1
- import{h as p}from"../../chunk-KIT6R3V2.js";import{e as k}from"../../chunk-R3KHIAWP.js";import{a as n,b as u}from"../../chunk-S6KFKBMY.js";import{b as t,d}from"../../chunk-IIF5VLQ7.js";import{b as g,c as m,j as a}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{restoreDeletedObject as j}from"@tigrisdata/storage";var r=a("objects","restore-deleted");async function v(e){g(r);let l=u(e),c=n(e,["bucket"]),b=n(e,["key"]),s=n(e,["version-id","versionId"]);c||t(r,"Bucket name or path is required");let{bucket:o,key:i}=p(c,b);i||t(r,"Object key is required"),s||t(r,"--version-id is required");let y=await k(),{error:f}=await j(i,s,{config:{...y,bucket:o}});f&&t(r,f),l==="json"&&console.log(JSON.stringify({action:"restored",bucket:o,key:i,versionId:s})),m(r,{key:i,bucket:o}),d(r,{bucket:o})}export{v as default};
1
+ import{h as p}from"../../chunk-KIT6R3V2.js";import{e as k}from"../../chunk-5AGM4LUA.js";import{a as n,b as u}from"../../chunk-S6KFKBMY.js";import{b as t,d}from"../../chunk-6TTEDYLD.js";import{b as g,c as m,j as a}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{restoreDeletedObject as j}from"@tigrisdata/storage";var r=a("objects","restore-deleted");async function v(e){g(r);let l=u(e),c=n(e,["bucket"]),b=n(e,["key"]),s=n(e,["version-id","versionId"]);c||t(r,"Bucket name or path is required");let{bucket:o,key:i}=p(c,b);i||t(r,"Object key is required"),s||t(r,"--version-id is required");let y=await k(),{error:f}=await j(i,s,{config:{...y,bucket:o}});f&&t(r,f),l==="json"&&console.log(JSON.stringify({action:"restored",bucket:o,key:i,versionId:s})),m(r,{key:i,bucket:o}),d(r,{bucket:o})}export{v as default};
@@ -1 +1 @@
1
- import{f as y}from"../../chunk-AFM3TY2D.js";import{h as v}from"../../chunk-KIT6R3V2.js";import{e as h}from"../../chunk-R3KHIAWP.js";import{a as e,b as d}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-IIF5VLQ7.js";import{b as g,c as p,e as l,j as k}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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
+ import{f as y}from"../../chunk-AFM3TY2D.js";import{h as v}from"../../chunk-KIT6R3V2.js";import{e as h}from"../../chunk-5AGM4LUA.js";import{a as e,b as d}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-6TTEDYLD.js";import{b as g,c as p,e as l,j as k}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.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-KIT6R3V2.js";import{e as y}from"../../chunk-R3KHIAWP.js";import{a as t,b as p}from"../../chunk-S6KFKBMY.js";import{b as n}from"../../chunk-IIF5VLQ7.js";import{b as d,c as u,j as b}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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
+ import{h as k}from"../../chunk-KIT6R3V2.js";import{e as y}from"../../chunk-5AGM4LUA.js";import{a as t,b as p}from"../../chunk-S6KFKBMY.js";import{b as n}from"../../chunk-6TTEDYLD.js";import{b as d,c as u,j as b}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.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-KIT6R3V2.js";import{e as k}from"../../chunk-R3KHIAWP.js";import{a as o,b}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-IIF5VLQ7.js";import{b as m,c as u,j as p}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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};
1
+ import{h as l}from"../../chunk-KIT6R3V2.js";import{e as k}from"../../chunk-5AGM4LUA.js";import{a as o,b}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-6TTEDYLD.js";import{b as m,c as u,j as p}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.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};
@@ -1 +1 @@
1
- import{h as d}from"../../chunk-KIT6R3V2.js";import{e as b}from"../../chunk-R3KHIAWP.js";import{a as i,b as y}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-IIF5VLQ7.js";import{b as p,c as k,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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
+ import{h as d}from"../../chunk-KIT6R3V2.js";import{e as b}from"../../chunk-5AGM4LUA.js";import{a as i,b as y}from"../../chunk-S6KFKBMY.js";import{b as t}from"../../chunk-6TTEDYLD.js";import{b as p,c as k,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.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{e as O,g as d}from"../../chunk-R3KHIAWP.js";import{a as p,b as u}from"../../chunk-S6KFKBMY.js";import{b as i,d as m}from"../../chunk-IIF5VLQ7.js";import{b as e,c,g as f,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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
+ import{e as O,g as d}from"../../chunk-5AGM4LUA.js";import{a as p,b as u}from"../../chunk-S6KFKBMY.js";import{b as i,d as m}from"../../chunk-6TTEDYLD.js";import{b as e,c,g as f,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.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{e as k,g as I}from"../../chunk-R3KHIAWP.js";import{b as S}from"../../chunk-S6KFKBMY.js";import{b as O}from"../../chunk-IIF5VLQ7.js";import{b as u,c as r,e as h,j as z}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.js";import{c as w}from"../../chunk-J3MAV7JB.js";import{h as f,i as p}from"../../chunk-F4AGJWCK.js";import{listOrganizations as F}from"@tigrisdata/iam";import U from"enquirer";var i=z("organizations","list");async function $(x){if(u(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&&O(i,a),e=g?.organizations??[]}if(e.length===0){h(i);return}let o=p();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 f(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
+ 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-5AGM4LUA.js";import{b as S}from"../../chunk-S6KFKBMY.js";import{b as O}from"../../chunk-6TTEDYLD.js";import{b as u,c as r,e as h,j as z}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import{c as w}from"../../chunk-J3MAV7JB.js";import{h as f,i as p}from"../../chunk-F4AGJWCK.js";import{listOrganizations as F}from"@tigrisdata/iam";import U from"enquirer";var i=z("organizations","list");async function $(x){if(u(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&&O(i,a),e=g?.organizations??[]}if(e.length===0){h(i);return}let o=p();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 f(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{e as S,g as $}from"../../chunk-R3KHIAWP.js";import{a as z,b as O}from"../../chunk-S6KFKBMY.js";import{a as p,b as r,d as u}from"../../chunk-IIF5VLQ7.js";import{b as c,c as f,d as l,j as d}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.js";import"../../chunk-J3MAV7JB.js";import{h as g}from"../../chunk-F4AGJWCK.js";import{listOrganizations as A}from"@tigrisdata/iam";var n=d("organizations","select");async function N(a){if(c(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(`
1
+ import{e as S,g as $}from"../../chunk-5AGM4LUA.js";import{a as z,b as O}from"../../chunk-S6KFKBMY.js";import{a as p,b as r,d as u}from"../../chunk-6TTEDYLD.js";import{b as c,c as f,d as l,j as d}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-J3MAV7JB.js";import{h as g}from"../../chunk-F4AGJWCK.js";import{listOrganizations as A}from"@tigrisdata/iam";var n=d("organizations","select");async function N(a){if(c(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
  `);l(n,`Organization "${i}" not found
3
3
 
4
4
  Available organizations:
@@ -1,3 +1,3 @@
1
- import{b as A}from"../chunk-AFM3TY2D.js";import{e as v}from"../chunk-KIT6R3V2.js";import{a as K,e as w}from"../chunk-R3KHIAWP.js";import{a,b as k}from"../chunk-S6KFKBMY.js";import{a as n}from"../chunk-IIF5VLQ7.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-RDJQLQQY.js";import"../chunk-DV3LCXRH.js";import"../chunk-RH6Z22EN.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-V6JZFDRE.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.
1
+ import{b as A}from"../chunk-AFM3TY2D.js";import{e as v}from"../chunk-KIT6R3V2.js";import{a as K,e as w}from"../chunk-5AGM4LUA.js";import{a,b as k}from"../chunk-S6KFKBMY.js";import{a as r}from"../chunk-6TTEDYLD.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-7Q44GQ2Y.js";import"../chunk-DV3LCXRH.js";import"../chunk-Z54TMLIH.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-QPUL2AAI.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 n=a(s,["path"]);n||r("path argument is required");let{bucket:o,path:e}=v(n);o||r("Invalid path"),e||r("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"&&r("Snapshot version is only supported for GET requests");let d=await w(),g;c?g=c:d.accessKeyId?g=d.accessKeyId:(p()!=="oauth"&&r("Presigning requires an access key. Pass --access-key or configure credentials."),C?g=await R(o,t):g=await E(o,t)),g||r("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&&r(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 n=await h().getAccessToken(),o=m(),e=K(),{data:t,error:i}=await P({config:{sessionToken:n,organizationId:o??void 0,iamEndpoint:e.iamEndpoint}});return i&&r(i),(!t.accessKeys||t.accessKeys.length===0)&&r('No access keys found. Create one with "tigris access-keys create <name>"'),t.accessKeys}function x(s,n,o){return s.roles?s.roles.some(e=>e.role==="NamespaceAdmin"?!0:e.bucket!==n&&e.bucket!=="*"?!1:o==="put"?e.role==="Editor"||e.role==="ReadWrite":e.role==="Editor"||e.role==="ReadWrite"||e.role==="ReadOnly"):!1}async function E(s,n){let e=(await I()).filter(i=>i.status==="active");e.length===0&&r('No active access keys found. Create one with "tigris access-keys create <name>"');let t=e.find(i=>x(i,s,n));return t||r(`No access key with ${n==="put"?"Editor or ReadWrite":"Editor, ReadWrite, or ReadOnly"} access to bucket "${s}" found.
2
2
  Create one: tigris access-keys create <name>
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};
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 R(s,n){process.stdin.isTTY||r("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&&r('No active access keys found. Create one with "tigris access-keys create <name>"');let t=e.filter(c=>x(c,s,n)),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 p,b as v}from"../chunk-S77OAN6Y.js";import{a as I,b as M,d as N,f as E,g as J,i as T,j as R,k as U}from"../chunk-KIT6R3V2.js";import{e as W}from"../chunk-R3KHIAWP.js";import{a as h,b as P}from"../chunk-S6KFKBMY.js";import{a as s}from"../chunk-IIF5VLQ7.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-RDJQLQQY.js";import"../chunk-DV3LCXRH.js";import"../chunk-RH6Z22EN.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-V6JZFDRE.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{list as C,remove as S,removeBucket as D}from"@tigrisdata/storage";var i=!1;async function K(m){let d=h(m,["path"]),u=h(m,["yes","y","force","f"]),x=!!h(m,["recursive","r"]);i=P(m)==="json",d||s("path argument is required"),I(d)||s("Path must be a remote Tigris path (t3:// or tigris://)");let{bucket:o,path:t}=M(d);o||s("Invalid path");let n=await W(),F=d.endsWith("/");if(!t&&!F){if(!u&&(p("Use --yes to skip confirmation"),!await v(`Are you sure you want to delete bucket '${o}'?`))){i||console.log("Aborted");return}let{error:r}=await D(o,{config:n,force:u});r&&s(r),console.log(i?JSON.stringify({action:"removed",bucket:o}):`Removed bucket '${o}'`);return}let c=t.includes("*"),g=t.endsWith("/")||!t&&F;if(!c&&!g&&(g=await N(o,t,n)),g&&!c&&!x&&s("Source is a remote folder (not removed). Use -r to remove recursively."),c||g){let r=c?J(t):t?t.endsWith("/")?t:`${t}/`:"",{items:y,error:A}=await U(o,r||void 0,n);A&&s(A);let l=y;if(c){let e=t.split("/").pop(),f=E(e);l=l.filter(k=>{if(k.name===r)return!1;let O=r?k.name.slice(r.length):k.name;return!x&&O.includes("/")?!1:f.test(O.split("/").pop())})}let a=r,q=l.some(e=>e.name===a),w=!1;if(!q&&!c){let{data:e}=await C({prefix:a,limit:1,config:{...n,bucket:o}});w=e?.items?.some(f=>f.name===a)||!1}let $=[...l.map(e=>e.name),...w?[a]:[]];if($.length===0){console.log(i?JSON.stringify({action:"removed",count:0}):"No objects to remove");return}let B=R($);if(!u&&(p("Use --yes to skip confirmation"),!await v(`Are you sure you want to delete ${B} object(s)?`))){i||console.log("Aborted");return}let b=[];for(let e of l){let{error:f}=await S(e.name,{config:{...n,bucket:o}});f?console.error(`Failed to remove ${e.name}: ${f.message}`):(!i&&!T(e.name)&&console.log(`Removed t3://${o}/${e.name}`),b.push(e.name))}if(w){let{error:e}=await S(a,{config:{...n,bucket:o}});e?console.error(`Failed to remove ${a}: ${e.message}`):b.push(a)}let j=R($,b);console.log(i?JSON.stringify({action:"removed",count:j}):`Removed ${j} object(s)`)}else{if(!u&&(p("Use --yes to skip confirmation"),!await v(`Are you sure you want to delete 't3://${o}/${t}'?`))){i||console.log("Aborted");return}let{error:r}=await S(t,{config:{...n,bucket:o}});r&&s(r),console.log(i?JSON.stringify({action:"removed",count:1,path:`t3://${o}/${t}`}):`Removed t3://${o}/${t}`)}process.exit(0)}export{K as default};
1
+ import{a as p,b as v}from"../chunk-S77OAN6Y.js";import{a as I,b as M,d as N,f as E,g as J,i as T,j as R,k as U}from"../chunk-KIT6R3V2.js";import{e as W}from"../chunk-5AGM4LUA.js";import{a as h,b as P}from"../chunk-S6KFKBMY.js";import{a as s}from"../chunk-6TTEDYLD.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-7Q44GQ2Y.js";import"../chunk-DV3LCXRH.js";import"../chunk-Z54TMLIH.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-QPUL2AAI.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{list as C,remove as S,removeBucket as D}from"@tigrisdata/storage";var i=!1;async function K(m){let d=h(m,["path"]),u=h(m,["yes","y","force","f"]),x=!!h(m,["recursive","r"]);i=P(m)==="json",d||s("path argument is required"),I(d)||s("Path must be a remote Tigris path (t3:// or tigris://)");let{bucket:o,path:t}=M(d);o||s("Invalid path");let n=await W(),F=d.endsWith("/");if(!t&&!F){if(!u&&(p("Use --yes to skip confirmation"),!await v(`Are you sure you want to delete bucket '${o}'?`))){i||console.log("Aborted");return}let{error:r}=await D(o,{config:n,force:u});r&&s(r),console.log(i?JSON.stringify({action:"removed",bucket:o}):`Removed bucket '${o}'`);return}let c=t.includes("*"),g=t.endsWith("/")||!t&&F;if(!c&&!g&&(g=await N(o,t,n)),g&&!c&&!x&&s("Source is a remote folder (not removed). Use -r to remove recursively."),c||g){let r=c?J(t):t?t.endsWith("/")?t:`${t}/`:"",{items:y,error:A}=await U(o,r||void 0,n);A&&s(A);let l=y;if(c){let e=t.split("/").pop(),f=E(e);l=l.filter(k=>{if(k.name===r)return!1;let O=r?k.name.slice(r.length):k.name;return!x&&O.includes("/")?!1:f.test(O.split("/").pop())})}let a=r,q=l.some(e=>e.name===a),w=!1;if(!q&&!c){let{data:e}=await C({prefix:a,limit:1,config:{...n,bucket:o}});w=e?.items?.some(f=>f.name===a)||!1}let $=[...l.map(e=>e.name),...w?[a]:[]];if($.length===0){console.log(i?JSON.stringify({action:"removed",count:0}):"No objects to remove");return}let B=R($);if(!u&&(p("Use --yes to skip confirmation"),!await v(`Are you sure you want to delete ${B} object(s)?`))){i||console.log("Aborted");return}let b=[];for(let e of l){let{error:f}=await S(e.name,{config:{...n,bucket:o}});f?console.error(`Failed to remove ${e.name}: ${f.message}`):(!i&&!T(e.name)&&console.log(`Removed t3://${o}/${e.name}`),b.push(e.name))}if(w){let{error:e}=await S(a,{config:{...n,bucket:o}});e?console.error(`Failed to remove ${a}: ${e.message}`):b.push(a)}let j=R($,b);console.log(i?JSON.stringify({action:"removed",count:j}):`Removed ${j} object(s)`)}else{if(!u&&(p("Use --yes to skip confirmation"),!await v(`Are you sure you want to delete 't3://${o}/${t}'?`))){i||console.log("Aborted");return}let{error:r}=await S(t,{config:{...n,bucket:o}});r&&s(r),console.log(i?JSON.stringify({action:"removed",count:1,path:`t3://${o}/${t}`}):`Removed t3://${o}/${t}`)}process.exit(0)}export{K as default};
@@ -1 +1 @@
1
- import{a as S,b as x}from"../../chunk-S77OAN6Y.js";import{e as A}from"../../chunk-R3KHIAWP.js";import{a,b as y}from"../../chunk-S6KFKBMY.js";import{a as d,b as c,c as h,d as v}from"../../chunk-IIF5VLQ7.js";import{b as m,c as l,d as u,j as p}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{deleteBucketSnapshot as q}from"@tigrisdata/storage";var t=p("snapshots","delete");async function N(n){m(t);let k=y(n),r=a(n,["name"]),s=a(n,["version"]),w=a(n,["yes","y","force"]);r||c(t,"Bucket name is required"),s||c(t,"Snapshot version is required");let f=(Array.isArray(s)?s:[s]).filter(e=>e.length>0);f.length===0&&c(t,"Snapshot version is required");let b=await A();if(!w&&(S("Use --yes to skip confirmation"),!await x(`Delete ${f.length} snapshot(s) from '${r}'? This cannot be undone.`))){console.log("Aborted");return}let g=[],i=[];for(let e of f){let{error:o}=await q(r,e,{config:b});o?(u(t,o.message,{name:r,version:e}),i.push({version:e,error:o.message})):(g.push(e),l(t,{name:r,version:e}))}if(k==="json"){let e=h(t,{name:r}),o={action:"deleted",bucket:r,versions:g,errors:i};e.length>0&&(o.nextActions=e),console.log(JSON.stringify(o))}i.length>0&&d(i[0].error,t),v(t,{name:r})}export{N as default};
1
+ import{a as S,b as x}from"../../chunk-S77OAN6Y.js";import{e as A}from"../../chunk-5AGM4LUA.js";import{a,b as y}from"../../chunk-S6KFKBMY.js";import{a as d,b as c,c as h,d as v}from"../../chunk-6TTEDYLD.js";import{b as m,c as l,d as u,j as p}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{deleteBucketSnapshot as q}from"@tigrisdata/storage";var t=p("snapshots","delete");async function N(n){m(t);let k=y(n),r=a(n,["name"]),s=a(n,["version"]),w=a(n,["yes","y","force"]);r||c(t,"Bucket name is required"),s||c(t,"Snapshot version is required");let f=(Array.isArray(s)?s:[s]).filter(e=>e.length>0);f.length===0&&c(t,"Snapshot version is required");let b=await A();if(!w&&(S("Use --yes to skip confirmation"),!await x(`Delete ${f.length} snapshot(s) from '${r}'? This cannot be undone.`))){console.log("Aborted");return}let g=[],i=[];for(let e of f){let{error:o}=await q(r,e,{config:b});o?(u(t,o.message,{name:r,version:e}),i.push({version:e,error:o.message})):(g.push(e),l(t,{name:r,version:e}))}if(k==="json"){let e=h(t,{name:r}),o={action:"deleted",bucket:r,versions:g,errors:i};e.length>0&&(o.nextActions=e),console.log(JSON.stringify(o))}i.length>0&&d(i[0].error,t),v(t,{name:r})}export{N as default};
@@ -1 +1 @@
1
- import{g as S}from"../../chunk-AFM3TY2D.js";import{e as x}from"../../chunk-R3KHIAWP.js";import{a as k,b as y,c as T}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-IIF5VLQ7.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-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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
+ import{g as S}from"../../chunk-AFM3TY2D.js";import{e as x}from"../../chunk-5AGM4LUA.js";import{a as k,b as y,c as T}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-6TTEDYLD.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-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.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{e as g}from"../../chunk-R3KHIAWP.js";import{a,b as f}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-IIF5VLQ7.js";import{b as m,c,j as p}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.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};
1
+ import{e as g}from"../../chunk-5AGM4LUA.js";import{a,b as f}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-6TTEDYLD.js";import{b as m,c,j as p}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.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-KIT6R3V2.js";import{e as j}from"../chunk-R3KHIAWP.js";import{a as u,b as O}from"../chunk-S6KFKBMY.js";import{b as i}from"../chunk-IIF5VLQ7.js";import{b as y,c,j as b}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-RDJQLQQY.js";import"../chunk-DV3LCXRH.js";import"../chunk-RH6Z22EN.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-V6JZFDRE.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};
1
+ import{c as I}from"../chunk-IUIKP2LU.js";import{a as d,f as m}from"../chunk-AFM3TY2D.js";import"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";import{e as C}from"../chunk-KIT6R3V2.js";import{e as j}from"../chunk-5AGM4LUA.js";import{a as u,b as O}from"../chunk-S6KFKBMY.js";import{b as i}from"../chunk-6TTEDYLD.js";import{b as y,c,j as b}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-7Q44GQ2Y.js";import"../chunk-DV3LCXRH.js";import"../chunk-Z54TMLIH.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-QPUL2AAI.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{getBucketInfo as T,getStats as V,head as M}from"@tigrisdata/storage";var t=b("stat");async function z(n){y(t);let h=u(n,["path"]),f=O(n),v=u(n,["snapshot-version","snapshotVersion","snapshot"]),S=u(n,["version-id","versionId"]),l=await j();if(!h){let{data:o,error:a}=await V({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:s}=C(h);if(r||i(t,"Invalid path"),!s||s==="/"){let{data:o,error:a}=await T(r,{config:l});a&&i(t,a);let p=I(o).map(({label:A,value:B})=>({metric:A,value:B})),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 M(s,{...v?{snapshotVersion:v}:{},...S?{versionId:S}:{},config:{...l,bucket:r}});k&&i(t,k),e||i(t,"Object not found");let w=[{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:"Cache-Control",value:e.cacheControl||"N/A"},{metric:"Modified",value:e.modified.toISOString()}],x=m(w,f,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(x),c(t,{bucket:r,path:s}),process.exit(0)}export{z as default};
@@ -1 +1 @@
1
- import{b as m}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-IIF5VLQ7.js";import{c as i,j as s}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import{a as o,g as n}from"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.js";var t=s("telemetry","disable");async function l(a={}){try{let e=m(a);if(n(!0)||r(t,new Error(`Could not save your preference to ${o}. Set TIGRIS_NO_TELEMETRY=1 in your environment to disable telemetry instead.`)),e==="json"){console.log(JSON.stringify({enabled:!1,action:"disabled"}));return}i(t)}catch(e){r(t,e)}}export{l as default};
1
+ import{b as m}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-6TTEDYLD.js";import{c as i,j as s}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import{a as o,g as n}from"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";var t=s("telemetry","disable");async function l(a={}){try{let e=m(a);if(n(!0)||r(t,new Error(`Could not save your preference to ${o}. Set TIGRIS_NO_TELEMETRY=1 in your environment to disable telemetry instead.`)),e==="json"){console.log(JSON.stringify({enabled:!1,action:"disabled"}));return}i(t)}catch(e){r(t,e)}}export{l as default};
@@ -1,3 +1,3 @@
1
- import{b as c}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-IIF5VLQ7.js";import{c as l,j as a}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import{a as r,d as i,g as s}from"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.js";var n=a("telemetry","enable");async function m(f={}){try{let t=c(f);s(!1)||o(n,new Error(`Could not save your preference to ${r}. Check the permissions on that file and its directory.`));let e=i();if(t==="json"){console.log(JSON.stringify({enabled:e===null,action:"enabled",...e?{stillDisabledBy:e}:{}}));return}l(n),(e==="TIGRIS_NO_TELEMETRY"||e==="DO_NOT_TRACK")&&console.log(`
1
+ import{b as c}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-6TTEDYLD.js";import{c as l,j as a}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import{a as r,d as i,g as s}from"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";var n=a("telemetry","enable");async function m(f={}){try{let t=c(f);s(!1)||o(n,new Error(`Could not save your preference to ${r}. Check the permissions on that file and its directory.`));let e=i();if(t==="json"){console.log(JSON.stringify({enabled:e===null,action:"enabled",...e?{stillDisabledBy:e}:{}}));return}l(n),(e==="TIGRIS_NO_TELEMETRY"||e==="DO_NOT_TRACK")&&console.log(`
2
2
  Note: ${e} is set in this environment, which still turns telemetry off.
3
3
  Unset it to let this setting take effect.`)}catch(t){o(n,t)}}export{m as default};
@@ -1,2 +1,2 @@
1
- import{b as m}from"../../chunk-S6KFKBMY.js";import{b as l}from"../../chunk-IIF5VLQ7.js";import{j as a}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-RDJQLQQY.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-RH6Z22EN.js";import"../../chunk-BMWWPXMU.js";import{a as r,d as i}from"../../chunk-APJUJ6TW.js";import"../../chunk-V6JZFDRE.js";import{homedir as d}from"os";var c=a("telemetry","status"),h={TIGRIS_NO_TELEMETRY:"the TIGRIS_NO_TELEMETRY environment variable is set",DO_NOT_TRACK:"the DO_NOT_TRACK environment variable is set","opt-out":"you disabled it on this machine",development:"this is a development build",test:"this is a test environment"};function u(n){let t=d();return n.startsWith(t)?`~${n.slice(t.length)}`:n}async function T(n={}){try{let t=m(n),e=i(),o=e===null;if(t==="json"){console.log(JSON.stringify({enabled:o,disabledReason:e,settingsFile:r}));return}let s=["",`Telemetry: ${o?"enabled":"disabled"}`];o||s.push(` Reason: ${h[e]}`),s.push("","What is collected:"," Usage analytics which commands you run and their arguments, CLI"," version, OS, install method, and whether you are in CI"," Error reports crashes and unexpected failures","","Never collected:"," credentials of any kind \u2014 access keys, secrets, tokens, passwords \u2014"," or your hostname. Both are stripped before anything is sent.","",`Settings file: ${u(r)}`,""),e==="TIGRIS_NO_TELEMETRY"||e==="DO_NOT_TRACK"?s.push(`Unset ${e} to re-enable, then run "tigris telemetry enable".`,""):o?s.push("To disable: tigris telemetry disable",""):e==="opt-out"&&s.push("To re-enable: tigris telemetry enable",""),console.log(s.join(`
1
+ import{b as m}from"../../chunk-S6KFKBMY.js";import{b as l}from"../../chunk-6TTEDYLD.js";import{j as a}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-7Q44GQ2Y.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-Z54TMLIH.js";import"../../chunk-BMWWPXMU.js";import{a as r,d as i}from"../../chunk-APJUJ6TW.js";import"../../chunk-QPUL2AAI.js";import{homedir as d}from"os";var c=a("telemetry","status"),h={TIGRIS_NO_TELEMETRY:"the TIGRIS_NO_TELEMETRY environment variable is set",DO_NOT_TRACK:"the DO_NOT_TRACK environment variable is set","opt-out":"you disabled it on this machine",development:"this is a development build",test:"this is a test environment"};function u(n){let t=d();return n.startsWith(t)?`~${n.slice(t.length)}`:n}async function T(n={}){try{let t=m(n),e=i(),o=e===null;if(t==="json"){console.log(JSON.stringify({enabled:o,disabledReason:e,settingsFile:r}));return}let s=["",`Telemetry: ${o?"enabled":"disabled"}`];o||s.push(` Reason: ${h[e]}`),s.push("","What is collected:"," Usage analytics which commands you run and their arguments, CLI"," version, OS, install method, and whether you are in CI"," Error reports crashes and unexpected failures","","Never collected:"," credentials of any kind \u2014 access keys, secrets, tokens, passwords \u2014"," or your hostname. Both are stripped before anything is sent.","",`Settings file: ${u(r)}`,""),e==="TIGRIS_NO_TELEMETRY"||e==="DO_NOT_TRACK"?s.push(`Unset ${e} to re-enable, then run "tigris telemetry enable".`,""):o?s.push("To disable: tigris telemetry disable",""):e==="opt-out"&&s.push("To re-enable: tigris telemetry enable",""),console.log(s.join(`
2
2
  `))}catch(t){l(c,t)}}export{T as default};
package/dist/lib/touch.js CHANGED
@@ -1 +1 @@
1
- import{e as f}from"../chunk-KIT6R3V2.js";import{e as s}from"../chunk-R3KHIAWP.js";import{a,b as c}from"../chunk-S6KFKBMY.js";import{a as t}from"../chunk-IIF5VLQ7.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-RDJQLQQY.js";import"../chunk-DV3LCXRH.js";import"../chunk-RH6Z22EN.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-V6JZFDRE.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};
1
+ import{e as f}from"../chunk-KIT6R3V2.js";import{e as s}from"../chunk-5AGM4LUA.js";import{a,b as c}from"../chunk-S6KFKBMY.js";import{a as t}from"../chunk-6TTEDYLD.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-7Q44GQ2Y.js";import"../chunk-DV3LCXRH.js";import"../chunk-Z54TMLIH.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-QPUL2AAI.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};
@@ -1 +1 @@
1
- import{b as u}from"../chunk-S6KFKBMY.js";import{b as l,c as f,d}from"../chunk-76VFN2EJ.js";import"../chunk-G4OJTPSI.js";import{b as p}from"../chunk-IIF5VLQ7.js";import{b as i,c as a,f as c,j as m}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-RDJQLQQY.js";import"../chunk-DV3LCXRH.js";import{a as r}from"../chunk-RH6Z22EN.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import{g as s}from"../chunk-V6JZFDRE.js";import{execSync as h}from"child_process";var e=m("update");async function N(g={}){let v=u(g);i(e);try{let o=await d(),t=l(r,o),n=f();if(v==="json"){console.log(JSON.stringify({currentVersion:r,latestVersion:o,updateAvailable:t,updateCommand:n}));return}console.log(`Current version: ${r}`),t?(console.log(`Latest version: ${o}`),console.log("Updating..."),h(n,{stdio:"inherit",env:{...process.env,[s]:"1"},...process.platform==="win32"?{shell:"powershell.exe"}:{}}),a(e,{latestVersion:o})):c(e,{currentVersion:r})}catch(o){p(e,o)}}export{N as default};
1
+ import{b as u}from"../chunk-S6KFKBMY.js";import{b as l,c as f,d}from"../chunk-KJXUEGXY.js";import"../chunk-G4OJTPSI.js";import{b as p}from"../chunk-6TTEDYLD.js";import{b as i,c as a,f as c,j as m}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-7Q44GQ2Y.js";import"../chunk-DV3LCXRH.js";import{a as r}from"../chunk-Z54TMLIH.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import{h as s}from"../chunk-QPUL2AAI.js";import{execSync as h}from"child_process";var e=m("update");async function N(g={}){let v=u(g);i(e);try{let o=await d(),t=l(r,o),n=f();if(v==="json"){console.log(JSON.stringify({currentVersion:r,latestVersion:o,updateAvailable:t,updateCommand:n}));return}console.log(`Current version: ${r}`),t?(console.log(`Latest version: ${o}`),console.log("Updating..."),h(n,{stdio:"inherit",env:{...process.env,[s]:"1"},...process.platform==="win32"?{shell:"powershell.exe"}:{}}),a(e,{latestVersion:o})):c(e,{currentVersion:r})}catch(o){p(e,o)}}export{N as default};
@@ -1,2 +1,2 @@
1
- import{a as $,d as b}from"../chunk-R3KHIAWP.js";import{b as w}from"../chunk-S6KFKBMY.js";import{b as y}from"../chunk-IIF5VLQ7.js";import{f as g,j as A}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-RDJQLQQY.js";import"../chunk-DV3LCXRH.js";import"../chunk-RH6Z22EN.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-V6JZFDRE.js";import{c as z}from"../chunk-J3MAV7JB.js";import{i as I}from"../chunk-F4AGJWCK.js";import{whoami as k}from"@tigrisdata/iam";var f=A("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=I(),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(`
1
+ import{a as $,d as b}from"../chunk-5AGM4LUA.js";import{b as w}from"../chunk-S6KFKBMY.js";import{b as y}from"../chunk-6TTEDYLD.js";import{f as g,j as A}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-7Q44GQ2Y.js";import"../chunk-DV3LCXRH.js";import"../chunk-Z54TMLIH.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-QPUL2AAI.js";import{c as z}from"../chunk-J3MAV7JB.js";import{i as I}from"../chunk-F4AGJWCK.js";import{whoami as k}from"@tigrisdata/iam";var f=A("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=I(),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){y(f,u)}}export{K as default};
package/dist/specs.yaml CHANGED
@@ -516,6 +516,7 @@ commands:
516
516
  examples:
517
517
  - "tigris cp ./file.txt t3://my-bucket/file.txt"
518
518
  - "tigris cp ./logo.png t3://my-bucket/logo.png --access public"
519
+ - "tigris cp ./dist/ t3://my-bucket/assets/ -r --cache-control 'public, max-age=31536000, immutable'"
519
520
  - "tigris cp t3://my-bucket/file.txt ./local-copy.txt"
520
521
  - "tigris cp t3://my-bucket/src/ t3://my-bucket/dest/ -r"
521
522
  - "tigris cp ./images/ t3://my-bucket/images/ -r"
@@ -549,6 +550,8 @@ commands:
549
550
  description: Access level for uploaded objects (only applies to local-to-remote uploads)
550
551
  alias: a
551
552
  options: *access_options
553
+ - name: cache-control
554
+ description: Cache-Control header stored with uploaded objects (only applies to local-to-remote uploads)
552
555
 
553
556
  # mv
554
557
  - name: mv
@@ -1330,6 +1333,54 @@ commands:
1330
1333
  description: Clear all CORS rules on the bucket
1331
1334
  type: flag
1332
1335
 
1336
+ # share
1337
+ - name: share
1338
+ description: Share a bucket with your whole organization, specific teams, or specific users. Existing shares are kept unless --override or --reset is used
1339
+ examples:
1340
+ - "tigris buckets share my-bucket --organization --role ReadOnly"
1341
+ - "tigris buckets share my-bucket --team tmid_MQQUhV --role Editor"
1342
+ - "tigris buckets share my-bucket --user uid_MQQUhV --role ReadOnly"
1343
+ - "tigris buckets share my-bucket --team tmid_A,tmid_B --role Editor,ReadOnly"
1344
+ - "tigris buckets share my-bucket --team tmid_MQQUhV --role Editor --override"
1345
+ - "tigris buckets share my-bucket --reset"
1346
+ messages:
1347
+ onStart: 'Updating bucket shares...'
1348
+ onSuccess: 'Shares updated for bucket {{name}}'
1349
+ onFailure: 'Failed to update bucket shares'
1350
+ arguments:
1351
+ - name: name
1352
+ description: Name of the bucket
1353
+ type: positional
1354
+ required: true
1355
+ examples:
1356
+ - my-bucket
1357
+ - name: organization
1358
+ alias: org
1359
+ description: Give access to everyone in your organization. Takes exactly one --role and cannot be combined with --team or --user
1360
+ type: flag
1361
+ - name: team
1362
+ alias: t
1363
+ description: Team ID to share with (can specify multiple, comma-separated). Each team is paired positionally with a --role value
1364
+ multiple: true
1365
+ - name: user
1366
+ alias: u
1367
+ description: User ID to share with (can specify multiple, comma-separated). Each user is paired positionally with a --role value
1368
+ multiple: true
1369
+ - name: role
1370
+ alias: r
1371
+ description: Role to grant (can specify multiple, comma-separated). A single role applies to every target; otherwise each role pairs with the corresponding --team or --user value
1372
+ multiple: true
1373
+ options:
1374
+ - ReadOnly
1375
+ - ReadWrite
1376
+ - Editor
1377
+ - name: override
1378
+ description: Replace all existing shares instead of merging with them
1379
+ type: flag
1380
+ - name: reset
1381
+ description: Remove all shares from the bucket
1382
+ type: flag
1383
+
1333
1384
  #########################
1334
1385
  # Manage forks (removed)
1335
1386
  #########################
@@ -1492,7 +1543,7 @@ commands:
1492
1543
  description: List objects from a specific storage source on buckets with shadow migration enabled
1493
1544
  options: [tigris, shadow]
1494
1545
  - name: deleted
1495
- description: List soft-deleted objects instead of live ones. Requires soft delete on the bucket. Not the recovery path for snapshot buckets use "tigris objects list-versions" for those
1546
+ description: List soft-deleted objects instead of live ones. Requires soft delete on the bucket. On a snapshot bucket a plain delete records a delete marker instead, so use "tigris objects list-versions" for those
1496
1547
  type: flag
1497
1548
  # list-versions
1498
1549
  - name: list-versions
@@ -1581,6 +1632,7 @@ commands:
1581
1632
  - "tigris objects put my-bucket report.pdf ./report.pdf"
1582
1633
  - "tigris objects put t3://my-bucket/report.pdf ./report.pdf"
1583
1634
  - "tigris objects put my-bucket logo.png ./logo.png --access public --content-type image/png"
1635
+ - "tigris objects put my-bucket app.js ./app.js --cache-control 'public, max-age=31536000, immutable'"
1584
1636
  - "echo 'hello' | tigris objects put t3://my-bucket/hello.txt"
1585
1637
  - "cat report.pdf | tigris objects put my-bucket report.pdf --content-type application/pdf"
1586
1638
  messages:
@@ -1616,6 +1668,8 @@ commands:
1616
1668
  - name: content-type
1617
1669
  description: Content type (auto-detected from extension if omitted)
1618
1670
  alias: t
1671
+ - name: cache-control
1672
+ description: Cache-Control header stored with the object and returned on every read (e.g. "public, max-age=31536000, immutable")
1619
1673
  - name: format
1620
1674
  description: Output format
1621
1675
  options: [json, table, xml]
@@ -1965,7 +2019,7 @@ commands:
1965
2019
  examples:
1966
2020
  - tid_AaBbCcDdEeFf
1967
2021
  - name: assign
1968
- description: Assign per-bucket roles to an access key. Pair each --bucket with a --role (Editor or ReadOnly), or use --admin for org-wide access
2022
+ description: Assign per-bucket roles to an access key. Pair each --bucket with a --role (Editor, ReadWrite, or ReadOnly), or use --admin for org-wide access
1969
2023
  alias: a
1970
2024
  examples:
1971
2025
  - "tigris access-keys assign tid_AaBb --bucket my-bucket --role Editor"
@@ -1996,6 +2050,7 @@ commands:
1996
2050
  multiple: true
1997
2051
  options:
1998
2052
  - Editor
2053
+ - ReadWrite
1999
2054
  - ReadOnly
2000
2055
  - name: admin
2001
2056
  description: Grant admin access to all buckets in the organization
@@ -1 +1 @@
1
- import{a,b,c,d,e,f}from"../chunk-ZTZF3OHU.js";import"../chunk-G4OJTPSI.js";import"../chunk-RH6Z22EN.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-V6JZFDRE.js";export{d as captureCommand,c as decodeTokenEmail,f as identifyOnLogin,a as isCI,e as trackCommand,b as usedFlags};
1
+ import{a,b,c,d,e,f}from"../chunk-7BUC7A7V.js";import"../chunk-G4OJTPSI.js";import"../chunk-Z54TMLIH.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-QPUL2AAI.js";export{d as captureCommand,c as decodeTokenEmail,f as identifyOnLogin,a as isCI,e as trackCommand,b as usedFlags};
@@ -1 +1 @@
1
- import{a,b,c}from"../chunk-JNSFDQGG.js";import"../chunk-AFM3TY2D.js";import"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";export{c as buildBucketInfo,b as describeExpiration,a as describeTransition};
1
+ import{a,b,c}from"../chunk-IUIKP2LU.js";import"../chunk-AFM3TY2D.js";import"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";export{c as buildBucketInfo,b as describeExpiration,a as describeTransition};
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunk-IIF5VLQ7.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-RDJQLQQY.js";import"../chunk-DV3LCXRH.js";import"../chunk-RH6Z22EN.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-V6JZFDRE.js";export{a as exitWithError,b as failWithError,c as getSuccessNextActions,d as printNextActions};
1
+ import{a,b,c,d}from"../chunk-6TTEDYLD.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-7Q44GQ2Y.js";import"../chunk-DV3LCXRH.js";import"../chunk-Z54TMLIH.js";import"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-QPUL2AAI.js";export{a as exitWithError,b as failWithError,c as getSuccessNextActions,d as printNextActions};
@@ -1 +1 @@
1
- import{a as c,b as d,c as e,d as f,e as g}from"../chunk-RDJQLQQY.js";import"../chunk-RH6Z22EN.js";import{a,b}from"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-V6JZFDRE.js";export{d as beforeSend,f as captureError,g as flushTelemetry,e as initTelemetry,c as invocationCommand,a as redactSecrets,b as scrubArgv};
1
+ import{a as c,b as d,c as e,d as f,e as g}from"../chunk-7Q44GQ2Y.js";import"../chunk-Z54TMLIH.js";import{a,b}from"../chunk-BMWWPXMU.js";import"../chunk-APJUJ6TW.js";import"../chunk-QPUL2AAI.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{a,b,c,d,e}from"../chunk-76VFN2EJ.js";import"../chunk-G4OJTPSI.js";import"../chunk-RH6Z22EN.js";import"../chunk-V6JZFDRE.js";export{e as checkForUpdates,d as fetchLatestVersion,c as getUpdateCommand,b as isNewerVersion,a as readUpdateCache};
1
+ import{a,b,c,d,e}from"../chunk-KJXUEGXY.js";import"../chunk-G4OJTPSI.js";import"../chunk-Z54TMLIH.js";import"../chunk-QPUL2AAI.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.10.0",
3
+ "version": "3.11.0",
4
4
  "description": "Command line interface for Tigris object storage",
5
5
  "type": "module",
6
6
  "exports": {
@@ -46,8 +46,8 @@
46
46
  "jsonc-parser": "^3.3.1",
47
47
  "open": "^11.0.0",
48
48
  "yaml": "^2.8.3",
49
- "@tigrisdata/iam": "^2.4.0",
50
- "@tigrisdata/storage": "^3.20.0"
49
+ "@tigrisdata/iam": "^2.5.0",
50
+ "@tigrisdata/storage": "^3.21.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "tsx": "^4.21.0"