@tigrisdata/cli 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/auth/client.js +1 -1
  2. package/dist/auth/iam.js +1 -1
  3. package/dist/auth/provider.js +1 -1
  4. package/dist/{chunk-AWVF3WSN.js → chunk-2XSEQJGZ.js} +1 -1
  5. package/dist/chunk-5UQUUFCL.js +5 -0
  6. package/dist/{chunk-BLWMGKCV.js → chunk-5Z3OHUTR.js} +1 -1
  7. package/dist/{chunk-GWPU2O5X.js → chunk-B7CB3ST5.js} +1 -1
  8. package/dist/{chunk-I4WIVMFA.js → chunk-CB3HWEP5.js} +1 -1
  9. package/dist/{chunk-V2CQF2CL.js → chunk-DLK3GTAJ.js} +1 -1
  10. package/dist/{chunk-WEKHQFXD.js → chunk-EH56YEO2.js} +1 -1
  11. package/dist/{chunk-75CEDNCH.js → chunk-HLAGKEX3.js} +1 -1
  12. package/dist/{chunk-BK5P4FHM.js → chunk-HUWHOK4M.js} +1 -1
  13. package/dist/chunk-HWAEADX7.js +1 -0
  14. package/dist/chunk-J3MAV7JB.js +1 -0
  15. package/dist/{chunk-R4FFJVZL.js → chunk-QFMXV3BK.js} +1 -1
  16. package/dist/{chunk-VTZW32DG.js → chunk-S3HKXM3M.js} +1 -1
  17. package/dist/{chunk-DWOWKOKO.js → chunk-XWIL5QBS.js} +1 -1
  18. package/dist/{chunk-3LZL7JNZ.js → chunk-ZP7AWQAS.js} +1 -1
  19. package/dist/cli-core.js +1 -1
  20. package/dist/cli.js +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/lib/access-keys/assign.js +1 -1
  23. package/dist/lib/access-keys/attach-policy.js +1 -1
  24. package/dist/lib/access-keys/create.js +1 -1
  25. package/dist/lib/access-keys/delete.js +1 -1
  26. package/dist/lib/access-keys/detach-policy.js +1 -1
  27. package/dist/lib/access-keys/get.js +1 -1
  28. package/dist/lib/access-keys/list-policies.js +1 -1
  29. package/dist/lib/access-keys/list.js +1 -1
  30. package/dist/lib/access-keys/rotate.js +1 -1
  31. package/dist/lib/buckets/create.js +1 -1
  32. package/dist/lib/buckets/delete.js +1 -1
  33. package/dist/lib/buckets/disable-snapshots.js +1 -1
  34. package/dist/lib/buckets/enable-snapshots.js +1 -1
  35. package/dist/lib/buckets/get.js +1 -1
  36. package/dist/lib/buckets/lifecycle/create.js +1 -1
  37. package/dist/lib/buckets/lifecycle/edit.js +1 -1
  38. package/dist/lib/buckets/lifecycle/list.js +1 -1
  39. package/dist/lib/buckets/lifecycle/shared.js +1 -1
  40. package/dist/lib/buckets/list.js +1 -1
  41. package/dist/lib/buckets/merge.js +1 -1
  42. package/dist/lib/buckets/migrate.js +1 -1
  43. package/dist/lib/buckets/rebase.js +1 -1
  44. package/dist/lib/buckets/restore.js +1 -1
  45. package/dist/lib/buckets/set-cors.js +1 -1
  46. package/dist/lib/buckets/set-locations.js +1 -1
  47. package/dist/lib/buckets/set-migration.js +1 -1
  48. package/dist/lib/buckets/set-notifications.js +1 -1
  49. package/dist/lib/buckets/set.js +1 -1
  50. package/dist/lib/bundle.js +1 -1
  51. package/dist/lib/configure/index.js +1 -1
  52. package/dist/lib/cp.js +1 -1
  53. package/dist/lib/credentials/test.js +1 -1
  54. package/dist/lib/iam/policies/create.js +1 -1
  55. package/dist/lib/iam/policies/delete.js +1 -1
  56. package/dist/lib/iam/policies/edit.js +1 -1
  57. package/dist/lib/iam/policies/get.js +1 -1
  58. package/dist/lib/iam/policies/link-key.js +1 -1
  59. package/dist/lib/iam/policies/list-keys.js +1 -1
  60. package/dist/lib/iam/policies/list.js +1 -1
  61. package/dist/lib/iam/policies/select-policy.js +1 -1
  62. package/dist/lib/iam/policies/unlink-key.js +1 -1
  63. package/dist/lib/iam/teams/create.js +1 -1
  64. package/dist/lib/iam/teams/edit.js +1 -1
  65. package/dist/lib/iam/teams/list.js +1 -1
  66. package/dist/lib/iam/teams/shared.js +1 -1
  67. package/dist/lib/iam/users/invite.js +1 -1
  68. package/dist/lib/iam/users/list.js +1 -1
  69. package/dist/lib/iam/users/remove.js +1 -1
  70. package/dist/lib/iam/users/revoke-invitation.js +1 -1
  71. package/dist/lib/iam/users/update-role.js +1 -1
  72. package/dist/lib/init/index.js +1 -1
  73. package/dist/lib/init/interactive.js +1 -1
  74. package/dist/lib/login/credentials.js +1 -1
  75. package/dist/lib/login/oauth.js +1 -1
  76. package/dist/lib/login/select.js +1 -1
  77. package/dist/lib/logout.js +1 -1
  78. package/dist/lib/ls.js +1 -1
  79. package/dist/lib/mk.js +1 -1
  80. package/dist/lib/mv.js +1 -1
  81. package/dist/lib/objects/delete.js +1 -1
  82. package/dist/lib/objects/get.js +1 -1
  83. package/dist/lib/objects/info.js +1 -1
  84. package/dist/lib/objects/list-versions.js +1 -1
  85. package/dist/lib/objects/list.js +1 -1
  86. package/dist/lib/objects/put.js +1 -1
  87. package/dist/lib/objects/restore-info.js +1 -1
  88. package/dist/lib/objects/restore.js +1 -1
  89. package/dist/lib/objects/set-access.js +1 -1
  90. package/dist/lib/objects/set.js +1 -1
  91. package/dist/lib/organizations/create.js +1 -1
  92. package/dist/lib/organizations/list.js +1 -1
  93. package/dist/lib/organizations/select.js +1 -1
  94. package/dist/lib/presign.js +1 -1
  95. package/dist/lib/rm.js +1 -1
  96. package/dist/lib/snapshots/list.js +1 -1
  97. package/dist/lib/snapshots/take.js +1 -1
  98. package/dist/lib/stat.js +1 -1
  99. package/dist/lib/touch.js +1 -1
  100. package/dist/lib/update.js +1 -1
  101. package/dist/lib/whoami.js +1 -1
  102. package/dist/specs.yaml +13 -1
  103. package/dist/utils/exit.js +1 -1
  104. package/dist/utils/telemetry.js +1 -1
  105. package/dist/utils/update-check.js +1 -1
  106. package/package.json +3 -3
  107. package/dist/chunk-BLUJHGMR.js +0 -1
  108. package/dist/chunk-VNUR4TRP.js +0 -1
  109. package/dist/chunk-WJLB362D.js +0 -5
@@ -1 +1 @@
1
- import{e as p}from"../../chunk-WJLB362D.js";import{a as n,b as w}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b,c as h,j as k}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{setBucketNotifications as N}from"@tigrisdata/storage";var t=k("buckets","set-notifications");async function y(e){b(t);let C=w(e),d=n(e,["name"]),s=n(e,["url"]),u=n(e,["filter"]),a=n(e,["token"]),o=n(e,["username"]),r=n(e,["password"]),l=n(e,["enable"]),g=n(e,["disable"]),c=n(e,["reset"]);d||i(t,"Bucket name is required"),[l,g,c].filter(Boolean).length>1&&i(t,"Only one of --enable, --disable, or --reset can be used"),c&&(s!==void 0||u!==void 0||a!==void 0||o!==void 0||r!==void 0)&&i(t,"Cannot use --reset with other options"),!l&&!g&&!c&&s===void 0&&u===void 0&&a===void 0&&o===void 0&&r===void 0&&i(t,"Provide at least one option"),a&&(o!==void 0||r!==void 0)&&i(t,"Cannot use --token with --username/--password. Choose one auth method"),(o!==void 0&&r===void 0||o===void 0&&r!==void 0)&&i(t,"Both --username and --password are required");let B=await p(),f;c?f={}:(f={...l?{enabled:!0}:{},...g?{enabled:!1}:{},...s!==void 0?{url:s}:{},...u!==void 0?{filter:u}:{}},a?f={...f,auth:{token:a}}:o&&r&&(f={...f,auth:{username:o,password:r}}));let{error:m}=await N(d,{notificationConfig:f,config:B});m&&i(t,m),C==="json"&&console.log(JSON.stringify({action:"updated",bucket:d})),h(t,{name:d})}export{y as default};
1
+ import{f as p}from"../../chunk-5UQUUFCL.js";import{a as n,b as w}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b,c as h,j as k}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{setBucketNotifications as N}from"@tigrisdata/storage";var t=k("buckets","set-notifications");async function y(e){b(t);let C=w(e),d=n(e,["name"]),s=n(e,["url"]),u=n(e,["filter"]),a=n(e,["token"]),o=n(e,["username"]),r=n(e,["password"]),l=n(e,["enable"]),g=n(e,["disable"]),c=n(e,["reset"]);d||i(t,"Bucket name is required"),[l,g,c].filter(Boolean).length>1&&i(t,"Only one of --enable, --disable, or --reset can be used"),c&&(s!==void 0||u!==void 0||a!==void 0||o!==void 0||r!==void 0)&&i(t,"Cannot use --reset with other options"),!l&&!g&&!c&&s===void 0&&u===void 0&&a===void 0&&o===void 0&&r===void 0&&i(t,"Provide at least one option"),a&&(o!==void 0||r!==void 0)&&i(t,"Cannot use --token with --username/--password. Choose one auth method"),(o!==void 0&&r===void 0||o===void 0&&r!==void 0)&&i(t,"Both --username and --password are required");let B=await p(),f;c?f={}:(f={...l?{enabled:!0}:{},...g?{enabled:!1}:{},...s!==void 0?{url:s}:{},...u!==void 0?{filter:u}:{}},a?f={...f,auth:{token:a}}:o&&r&&(f={...f,auth:{username:o,password:r}}));let{error:m}=await N(d,{notificationConfig:f,config:B});m&&i(t,m),C==="json"&&console.log(JSON.stringify({action:"updated",bucket:d})),h(t,{name:d})}export{y as default};
@@ -1 +1 @@
1
- import{c as j}from"../../chunk-N3Y6RFSK.js";import"../../chunk-S77OAN6Y.js";import{e as k}from"../../chunk-WJLB362D.js";import{a as n,b as A,d as s}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as h,c as w,j as O}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{updateBucket as L}from"@tigrisdata/storage";var i=O("buckets","set");async function S(e){h(i);let B=A(e),d=n(e,["name"]),r=n(e,["access"]),l=n(e,["locations"]),c=n(e,["allow-object-acl","allowObjectAcl"]),f=n(e,["disable-directory-listing","disableDirectoryListing"]),u=n(e,["cache-control","cacheControl"]),b=n(e,["custom-domain","customDomain"]),g=n(e,["enable-delete-protection","enableDeleteProtection"]),a=n(e,["soft-delete","softDelete"]),m=n(e,["retention-days","retentionDays"]),y=n(e,["enable-additional-headers","enableAdditionalHeaders"]);d||o(i,"Bucket name is required"),r===void 0&&l===void 0&&c===void 0&&f===void 0&&u===void 0&&b===void 0&&g===void 0&&a===void 0&&y===void 0&&o(i,"At least one setting is required");let t={};if(r!==void 0&&(t.access=r),l!==void 0&&(t.locations=j(l)),c!==void 0&&(t.allowObjectAcl=s(c)),f!==void 0&&(t.disableDirectoryListing=s(f)),u!==void 0&&(t.cacheControl=u),b!==void 0&&(t.customDomain=b),g!==void 0&&(t.enableDeleteProtection=s(g)),a!==void 0&&a!=="enable"&&a!=="disable"&&o(i,'--soft-delete must be "enable" or "disable"'),m!==void 0&&a!=="enable"&&o(i,"--retention-days can only be used with --soft-delete enable"),a==="enable"){m===void 0&&o(i,"--retention-days is required when enabling soft delete");let D=Number(m);(!Number.isInteger(D)||D<=0)&&o(i,"--retention-days must be a positive integer"),t.softDelete={enabled:!0,retentionDays:D}}else a==="disable"&&(t.softDelete={enabled:!1});y!==void 0&&(t.enableAdditionalHeaders=s(y));let C=await k(),{error:p}=await L(d,{...t,config:C});p&&o(i,p),B==="json"&&console.log(JSON.stringify({action:"updated",name:d})),w(i,{name:d})}export{S as default};
1
+ import{c as S}from"../../chunk-N3Y6RFSK.js";import"../../chunk-S77OAN6Y.js";import{f as k}from"../../chunk-5UQUUFCL.js";import{a as n,b as C,d as s}from"../../chunk-S6KFKBMY.js";import{b as o}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as w,c as O,j as A}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{updateBucket as L}from"@tigrisdata/storage";var i=A("buckets","set");async function q(e){w(i);let j=C(e),d=n(e,["name"]),r=n(e,["access"]),l=n(e,["default-tier","defaultTier"]),c=n(e,["locations"]),f=n(e,["allow-object-acl","allowObjectAcl"]),u=n(e,["disable-directory-listing","disableDirectoryListing"]),b=n(e,["cache-control","cacheControl"]),g=n(e,["custom-domain","customDomain"]),m=n(e,["enable-delete-protection","enableDeleteProtection"]),a=n(e,["soft-delete","softDelete"]),y=n(e,["retention-days","retentionDays"]),D=n(e,["enable-additional-headers","enableAdditionalHeaders"]);d||o(i,"Bucket name is required"),r===void 0&&l===void 0&&c===void 0&&f===void 0&&u===void 0&&b===void 0&&g===void 0&&m===void 0&&a===void 0&&D===void 0&&o(i,"At least one setting is required");let t={};if(r!==void 0&&(t.access=r),l!==void 0&&(t.defaultTier=l),c!==void 0&&(t.locations=S(c)),f!==void 0&&(t.allowObjectAcl=s(f)),u!==void 0&&(t.disableDirectoryListing=s(u)),b!==void 0&&(t.cacheControl=b),g!==void 0&&(t.customDomain=g),m!==void 0&&(t.enableDeleteProtection=s(m)),a!==void 0&&a!=="enable"&&a!=="disable"&&o(i,'--soft-delete must be "enable" or "disable"'),y!==void 0&&a!=="enable"&&o(i,"--retention-days can only be used with --soft-delete enable"),a==="enable"){y===void 0&&o(i,"--retention-days is required when enabling soft delete");let p=Number(y);(!Number.isInteger(p)||p<=0)&&o(i,"--retention-days must be a positive integer"),t.softDelete={enabled:!0,retentionDays:p}}else a==="disable"&&(t.softDelete={enabled:!1});D!==void 0&&(t.enableAdditionalHeaders=s(D));let B=await k(),{error:h}=await L(d,{...t,config:B});h&&o(i,h),j==="json"&&console.log(JSON.stringify({action:"updated",name:d})),O(i,{name:d})}export{q as default};
@@ -1,3 +1,3 @@
1
- import{e as k}from"../chunk-7ZCVOA6A.js";import{d as h}from"../chunk-WJLB362D.js";import{a,b as p,e as y}from"../chunk-S6KFKBMY.js";import{a as o}from"../chunk-GWPU2O5X.js";import"../chunk-AWVF3WSN.js";import"../chunk-BLUJHGMR.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-VNUR4TRP.js";import"../chunk-F4AGJWCK.js";import{createWriteStream as E,existsSync as j,readFileSync as v}from"fs";import{Readable as B}from"stream";import{pipeline as b}from"stream/promises";import{bundle as C}from"@tigrisdata/storage";var z=5e3;function S(t){return t.split(`
1
+ import{e as k}from"../chunk-7ZCVOA6A.js";import{e as h}from"../chunk-5UQUUFCL.js";import{a,b as p,e as y}from"../chunk-S6KFKBMY.js";import{a as o}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{createWriteStream as E,existsSync as j,readFileSync as v}from"fs";import{Readable as B}from"stream";import{pipeline as b}from"stream/promises";import{bundle as C}from"@tigrisdata/storage";var z=5e3;function S(t){return t.split(`
2
2
  `).map(n=>n.trim()).filter(n=>n.length>0&&!n.startsWith("#"))}function K(t){if(t.endsWith(".tar.gz")||t.endsWith(".tgz"))return"gzip";if(t.endsWith(".tar.zst"))return"zstd";if(t.endsWith(".tar"))return"none"}async function N(t){let n=a(t,["bucket"]),s=a(t,["keys","k"]),i=a(t,["output","o"]),g=a(t,["compression"]),w=a(t,["on-error","onError"],"skip"),l=p(t)==="json",W=!i;n||o("Bucket is required");let{bucket:d,path:c}=k(n);d||o("Invalid bucket");let e;if(s)s.includes(",")?e=s.split(",").map(r=>r.trim()).filter(r=>r.length>0):j(s)?e=S(v(s,"utf-8")):e=[s.trim()];else if(process.stdin.isTTY)o("Keys are required. Provide via --keys or pipe to stdin.");else{let r=await y();e=S(r)}if(c){let r=c.endsWith("/")?c:`${c}/`;e=e.map(A=>`${r}${A}`)}e.length===0&&o("No keys found"),e.length>z&&o(`Too many keys (max ${z}). Got ${e.length}`);let f="none";g?f=g:i&&(f=K(i)??"none"),!W&&!l&&process.stderr.write(`Bundling ${e.length} object(s)...
3
3
  `);let $=await h({withCredentialProvider:!0}),{data:x,error:m}=await C(e,{config:{...$,bucket:d},compression:f,onError:w});m&&o(m);let u=B.fromWeb(x.body);if(i){let r=E(i);await b(u,r),console.log(l?JSON.stringify({action:"bundled",bucket:d,keys:e.length,compression:f,output:i}):`Bundled ${e.length} object(s) from '${d}' to ${i}`)}else await b(u,process.stdout),l&&console.error(JSON.stringify({action:"bundled",bucket:d,keys:e.length,compression:f,output:"stdout"}));process.exit(0)}export{N as default};
@@ -1 +1 @@
1
- import{a as K}from"../../chunk-S77OAN6Y.js";import{a as E}from"../../chunk-WJLB362D.js";import{b as S}from"../../chunk-S6KFKBMY.js";import{a as f,b as p,d as u}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as n,c as o,d,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import{a as m}from"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import{m as y,q as l}from"../../chunk-F4AGJWCK.js";import A from"enquirer";import{whoami as w}from"@tigrisdata/iam";var{prompt:q}=A,a=g("configure");async function I(e){n(a);let h=S(e),s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,t=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret,c=e.endpoint||e.e||e.E||e.Endpoint;if(!s||!t||!c){let r=[];s||r.push({type:"input",name:"accessKey",message:"Tigris Access Key ID:",required:!0}),t||r.push({type:"password",name:"accessSecret",message:"Tigris Secret Access Key:",required:!0}),c||r.push({type:"input",name:"endpoint",message:"Tigris Endpoint:",required:!0,initial:m}),K("Provide --access-key, --access-secret, and --endpoint");let i=await q(r);s=s||i.accessKey,t=t||i.accessSecret,c=c||i.endpoint}(!s||!t||!c)&&p(a,"All credentials are required");try{await y({accessKeyId:s,secretAccessKey:t,endpoint:c});try{let r=E(),{data:i}=await w({config:{accessKeyId:s,secretAccessKey:t,iamEndpoint:r.iamEndpoint}});i?.organizationId&&await l(i.organizationId,"saved")}catch{}h==="json"&&console.log(JSON.stringify({action:"configured"})),o(a),u(a)}catch(r){d(a,"Failed to save credentials"),f(r,a)}}export{I as default};
1
+ import{a as K}from"../../chunk-S77OAN6Y.js";import{a as E}from"../../chunk-5UQUUFCL.js";import{b as S}from"../../chunk-S6KFKBMY.js";import{a as f,b as p,d as u}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as n,c as o,d,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import{a as m}from"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import{m as y,q as l}from"../../chunk-F4AGJWCK.js";import A from"enquirer";import{whoami as w}from"@tigrisdata/iam";var{prompt:q}=A,a=g("configure");async function I(e){n(a);let h=S(e),s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,t=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret,c=e.endpoint||e.e||e.E||e.Endpoint;if(!s||!t||!c){let r=[];s||r.push({type:"input",name:"accessKey",message:"Tigris Access Key ID:",required:!0}),t||r.push({type:"password",name:"accessSecret",message:"Tigris Secret Access Key:",required:!0}),c||r.push({type:"input",name:"endpoint",message:"Tigris Endpoint:",required:!0,initial:m}),K("Provide --access-key, --access-secret, and --endpoint");let i=await q(r);s=s||i.accessKey,t=t||i.accessSecret,c=c||i.endpoint}(!s||!t||!c)&&p(a,"All credentials are required");try{await y({accessKeyId:s,secretAccessKey:t,endpoint:c});try{let r=E(),{data:i}=await w({config:{accessKeyId:s,secretAccessKey:t,iamEndpoint:r.iamEndpoint}});i?.organizationId&&await l(i.organizationId,"saved")}catch{}h==="json"&&console.log(JSON.stringify({action:"configured"})),o(a),u(a)}catch(r){d(a,"Failed to save credentials"),f(r,a)}}export{I as default};
package/dist/lib/cp.js CHANGED
@@ -1 +1 @@
1
- import{a as G}from"../chunk-EKW6XTGL.js";import{a as x}from"../chunk-SAAGVLRE.js";import{a as q}from"../chunk-HPICBIXL.js";import{a as R}from"../chunk-AFM3TY2D.js";import{a as U,b as C,d as D,f as O,g as j,i as A}from"../chunk-7ZCVOA6A.js";import{d as K}from"../chunk-WJLB362D.js";import{a as N,b as M}from"../chunk-S6KFKBMY.js";import{a as f}from"../chunk-GWPU2O5X.js";import"../chunk-AWVF3WSN.js";import"../chunk-BLUJHGMR.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-VNUR4TRP.js";import"../chunk-F4AGJWCK.js";import{createReadStream as P,createWriteStream as tt,existsSync as V,mkdirSync as et,readdirSync as I,statSync as z}from"fs";import{homedir as ot}from"os";import{basename as E,dirname as L,join as v,relative as _,resolve as H}from"path";import{Readable as X}from"stream";import{pipeline as it}from"stream/promises";import{copy as nt,get as rt,head as at,list as lt,put as Y}from"@tigrisdata/storage";var h=!1;function ct(i,t){let e=U(i),a=U(t);return!e&&!a&&f("At least one path must be a remote Tigris path (t3:// or tigris://)"),e&&a?"remote-to-remote":e?"remote-to-local":"local-to-remote"}function Z(i){return i==="~"||i.startsWith("~/")?H(ot(),i.slice(2)):H(i)}function st(i){return I(i,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>{let a=e.parentPath??e.path;return v(a,e.name)})}function pt(i,t){let e=L(i),a=E(i),p=O(a);return V(e)?t?I(e,{recursive:!0,withFileTypes:!0}).filter(r=>r.isFile()&&p.test(r.name)).map(r=>{let l=r.parentPath??r.path;return v(l,r.name)}):I(e,{withFileTypes:!0}).filter(l=>l.isFile()&&p.test(l.name)).map(l=>v(e,l.name)):[]}async function J(i,t,e,a,p=!1,c){let r;try{r=z(i).size}catch{return{error:`File not found: ${i}`}}let l=P(i),n=X.toWeb(l),o=q(i),{error:s}=await Y(e,n,{...G(r),...o?{contentType:o}:{},...c?{access:c}:{},onUploadProgress:p?({loaded:u})=>{if(r!==void 0&&r>0){let d=Math.round(u/r*100);process.stdout.write(`\rUploading: ${R(u)} / ${R(r)} (${d}%)`)}else process.stdout.write(`\rUploading: ${R(u)}`)}:void 0,config:{...a,bucket:t}});return p&&process.stdout.write(`\r${" ".repeat(60)}\r`),s?{error:s.message}:{}}async function Q(i,t,e,a,p=!1){let c;if(p){let{data:u}=await at(t,{config:{...a,bucket:i}});c=u?.size}let{data:r,error:l}=await rt(t,"stream",{config:{...a,bucket:i}});if(l)return{error:l.message};let n=L(e);V(n)||et(n,{recursive:!0});let o=tt(e),s=X.fromWeb(r);if(p&&c!==void 0&&c>0){let u=0;s.on("data",d=>{u+=d.length;let m=Math.round(u/c*100);process.stdout.write(`\rDownloading: ${R(u)} / ${R(c)} (${m}%)`)})}return await it(s,o),p&&process.stdout.write(`\r${" ".repeat(60)}\r`),{}}async function B(i,t,e,a,p){if(e.endsWith("/")){let{error:r}=await Y(p,"",{config:{...i,bucket:a}});return r?{error:r.message}:{}}let{error:c}=await nt(e,p,{srcBucket:t,destBucket:a,config:{...i,bucket:a}});return c?{error:c.message}:{}}async function ut(i,t,e,a,p){let c=Z(i);if(i.includes("*")){let n=pt(c,a);if(n.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files matching pattern");return}let o=L(c),s=n.map(m=>async()=>{let w=_(o,m),k=t.path?`${t.path.replace(/\/$/,"")}/${w}`:w,b=await J(m,t.bucket,k,e,!1,p);return b.error?(console.error(`Failed to upload ${m}: ${b.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${k}`),!0)}),d=(await x(s,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:d}):`Uploaded ${d} file(s)`);return}let l;try{l=z(c)}catch{f(`Source not found: ${i}`)}if(l.isDirectory()){a||f(`${i} is a directory (not copied). Use -r to copy recursively.`);let n=st(c);if(n.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files to upload");return}let o=i.endsWith("/")?"":E(c),s=n.map(m=>async()=>{let w=_(c,m),b=[t.path?.replace(/\/$/,""),o,w].filter(Boolean).join("/"),y=await J(m,t.bucket,b,e,!1,p);return y.error?(console.error(`Failed to upload ${m}: ${y.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${b}`),!0)}),d=(await x(s,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:d}):`Uploaded ${d} file(s)`)}else{let n=E(c),o;t.path?i.endsWith("/")||t.path.endsWith("/")?o=`${t.path.replace(/\/$/,"")}/${n}`:await D(t.bucket,t.path,e)?o=`${t.path}/${n}`:o=t.path:o=n;let s=await J(c,t.bucket,o,e,!h,p);s.error&&f(s.error),console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:1,src:i,dest:`t3://${t.bucket}/${o}`}):`Uploaded ${i} -> t3://${t.bucket}/${o}`)}}async function ft(i,t,e,a,p){let c=i.endsWith("/");!t.path&&!c&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=Z(e),l=t.path.includes("*"),n=t.path.endsWith("/")||!t.path&&c;if(!l&&!n&&(n=await D(t.bucket,t.path,a)),n&&!l&&!p&&f("Source is a remote folder (not copied). Use -r to copy recursively."),l||n){let o=l?j(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",s=!l&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",{items:u,error:d}=await A(t.bucket,o||void 0,a);d&&f(d);let m=u.filter(y=>!y.name.endsWith("/"));if(l){let y=t.path.split("/").pop(),$=O(y);m=m.filter(S=>{let g=o?S.name.slice(o.length):S.name;return!p&&g.includes("/")?!1:$.test(g.split("/").pop())})}if(m.length===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:0}):"No objects to download");return}let w=m.map(y=>async()=>{let $=o?y.name.slice(o.length):y.name,S=s?v(r,s,$):v(r,$),g=await Q(t.bucket,y.name,S,a);return g.error?(console.error(`Failed to download ${y.name}: ${g.error}`),!1):(h||console.log(`Downloaded t3://${t.bucket}/${y.name} -> ${S}`),!0)}),b=(await x(w,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:b}):`Downloaded ${b} file(s)`)}else{let o=t.path.split("/").pop(),s,u=!1;try{u=z(r).isDirectory()}catch{}u||e.endsWith("/")?s=v(r,o):s=r;let d=await Q(t.bucket,t.path,s,a,!h);d.error&&f(d.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:1,src:`t3://${t.bucket}/${t.path}`,dest:s}):`Downloaded t3://${t.bucket}/${t.path} -> ${s}`)}}async function mt(i,t,e,a,p){let c=i.endsWith("/");!t.path&&!c&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=i.includes("*"),l=t.path.endsWith("/")||!t.path&&c;if(!r&&!l&&t.path&&(l=await D(t.bucket,t.path,a)),l&&!r&&!p&&f("Source is a remote folder (not copied). Use -r to copy recursively."),r||l){let n=r?j(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",o=!r&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",u=[e.path?.replace(/\/$/,"")||"",o].filter(Boolean).join("/"),d=u?`${u}/`:"";t.bucket===e.bucket&&n===d&&f("Source and destination are the same");let{items:m,error:w}=await A(t.bucket,n||void 0,a);w&&f(w);let k=m.filter(g=>g.name!==n);if(r){let g=t.path.split("/").pop(),W=O(g);k=k.filter(F=>{let T=n?F.name.slice(n.length):F.name;return!p&&T.includes("/")?!1:W.test(T.split("/").pop())})}let b=k.map(g=>async()=>{let W=n?g.name.slice(n.length):g.name,F=u?`${u}/${W}`:W,T=await B(a,t.bucket,g.name,e.bucket,F);return T.error?(console.error(`Failed to copy ${g.name}: ${T.error}`),!1):(h||console.log(`Copied t3://${t.bucket}/${g.name} -> t3://${e.bucket}/${F}`),!0)}),$=(await x(b,8)).filter(Boolean).length,S=!1;if(u&&n){let{data:g}=await lt({prefix:n,limit:1,config:{...a,bucket:t.bucket}});if(g?.items?.some(W=>W.name===n)){let W=`${u}/`,F=await B(a,t.bucket,n,e.bucket,W);F.error?console.error(`Failed to copy folder marker: ${F.error}`):S=!0}}if($===0&&S&&($=1),$===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:0}):"No objects to copy");return}console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:$}):`Copied ${$} object(s)`)}else{let n=t.path.split("/").pop(),o;e.path?e.path.endsWith("/")?o=`${e.path}${n}`:await D(e.bucket,e.path,a)?o=`${e.path}/${n}`:o=e.path:o=n,t.bucket===e.bucket&&t.path===o&&f("Source and destination are the same");let s=await B(a,t.bucket,t.path,e.bucket,o);s.error&&f(s.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:1,src:`t3://${t.bucket}/${t.path}`,dest:`t3://${e.bucket}/${o}`}):`Copied t3://${t.bucket}/${t.path} -> t3://${e.bucket}/${o}`)}}async function ht(i){let t=N(i,["src"]),e=N(i,["dest"]);(!t||!e)&&f("Both src and dest arguments are required");let a=!!N(i,["recursive","r"]),p=N(i,["access","a","A"]);h=M(i)==="json";let r;p===void 0?r=void 0:p==="public"||p==="private"?r=p:f('Access level must be either "public" or "private"');let l=ct(t,e);r!==void 0&&l!=="local-to-remote"&&f('--access only applies to local-to-remote uploads. Use "tigris objects set-access" to change access on existing objects.');let n=await K({withCredentialProvider:!0});switch(l){case"local-to-remote":{let o=C(e);o.bucket||f("Invalid destination path"),await ut(t,o,n,a,r);break}case"remote-to-local":{let o=C(t);o.bucket||f("Invalid source path"),await ft(t,o,e,n,a);break}case"remote-to-remote":{let o=C(t),s=C(e);o.bucket||f("Invalid source path"),s.bucket||f("Invalid destination path"),await mt(t,o,s,n,a);break}}process.exit(0)}export{ht as default};
1
+ import{a as G}from"../chunk-EKW6XTGL.js";import{a as x}from"../chunk-SAAGVLRE.js";import{a as q}from"../chunk-HPICBIXL.js";import{a as R}from"../chunk-AFM3TY2D.js";import{a as U,b as C,d as D,f as O,g as j,i as A}from"../chunk-7ZCVOA6A.js";import{e as K}from"../chunk-5UQUUFCL.js";import{a as N,b as M}from"../chunk-S6KFKBMY.js";import{a as f}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{createReadStream as P,createWriteStream as tt,existsSync as V,mkdirSync as et,readdirSync as I,statSync as z}from"fs";import{homedir as ot}from"os";import{basename as E,dirname as L,join as v,relative as _,resolve as H}from"path";import{Readable as X}from"stream";import{pipeline as it}from"stream/promises";import{copy as nt,get as rt,head as at,list as lt,put as Y}from"@tigrisdata/storage";var h=!1;function ct(i,t){let e=U(i),a=U(t);return!e&&!a&&f("At least one path must be a remote Tigris path (t3:// or tigris://)"),e&&a?"remote-to-remote":e?"remote-to-local":"local-to-remote"}function Z(i){return i==="~"||i.startsWith("~/")?H(ot(),i.slice(2)):H(i)}function st(i){return I(i,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>{let a=e.parentPath??e.path;return v(a,e.name)})}function pt(i,t){let e=L(i),a=E(i),p=O(a);return V(e)?t?I(e,{recursive:!0,withFileTypes:!0}).filter(r=>r.isFile()&&p.test(r.name)).map(r=>{let l=r.parentPath??r.path;return v(l,r.name)}):I(e,{withFileTypes:!0}).filter(l=>l.isFile()&&p.test(l.name)).map(l=>v(e,l.name)):[]}async function J(i,t,e,a,p=!1,c){let r;try{r=z(i).size}catch{return{error:`File not found: ${i}`}}let l=P(i),n=X.toWeb(l),o=q(i),{error:s}=await Y(e,n,{...G(r),...o?{contentType:o}:{},...c?{access:c}:{},onUploadProgress:p?({loaded:u})=>{if(r!==void 0&&r>0){let d=Math.round(u/r*100);process.stdout.write(`\rUploading: ${R(u)} / ${R(r)} (${d}%)`)}else process.stdout.write(`\rUploading: ${R(u)}`)}:void 0,config:{...a,bucket:t}});return p&&process.stdout.write(`\r${" ".repeat(60)}\r`),s?{error:s.message}:{}}async function Q(i,t,e,a,p=!1){let c;if(p){let{data:u}=await at(t,{config:{...a,bucket:i}});c=u?.size}let{data:r,error:l}=await rt(t,"stream",{config:{...a,bucket:i}});if(l)return{error:l.message};let n=L(e);V(n)||et(n,{recursive:!0});let o=tt(e),s=X.fromWeb(r);if(p&&c!==void 0&&c>0){let u=0;s.on("data",d=>{u+=d.length;let m=Math.round(u/c*100);process.stdout.write(`\rDownloading: ${R(u)} / ${R(c)} (${m}%)`)})}return await it(s,o),p&&process.stdout.write(`\r${" ".repeat(60)}\r`),{}}async function B(i,t,e,a,p){if(e.endsWith("/")){let{error:r}=await Y(p,"",{config:{...i,bucket:a}});return r?{error:r.message}:{}}let{error:c}=await nt(e,p,{srcBucket:t,destBucket:a,config:{...i,bucket:a}});return c?{error:c.message}:{}}async function ut(i,t,e,a,p){let c=Z(i);if(i.includes("*")){let n=pt(c,a);if(n.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files matching pattern");return}let o=L(c),s=n.map(m=>async()=>{let w=_(o,m),k=t.path?`${t.path.replace(/\/$/,"")}/${w}`:w,b=await J(m,t.bucket,k,e,!1,p);return b.error?(console.error(`Failed to upload ${m}: ${b.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${k}`),!0)}),d=(await x(s,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:d}):`Uploaded ${d} file(s)`);return}let l;try{l=z(c)}catch{f(`Source not found: ${i}`)}if(l.isDirectory()){a||f(`${i} is a directory (not copied). Use -r to copy recursively.`);let n=st(c);if(n.length===0){console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:0}):"No files to upload");return}let o=i.endsWith("/")?"":E(c),s=n.map(m=>async()=>{let w=_(c,m),b=[t.path?.replace(/\/$/,""),o,w].filter(Boolean).join("/"),y=await J(m,t.bucket,b,e,!1,p);return y.error?(console.error(`Failed to upload ${m}: ${y.error}`),!1):(h||console.log(`Uploaded ${m} -> t3://${t.bucket}/${b}`),!0)}),d=(await x(s,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:d}):`Uploaded ${d} file(s)`)}else{let n=E(c),o;t.path?i.endsWith("/")||t.path.endsWith("/")?o=`${t.path.replace(/\/$/,"")}/${n}`:await D(t.bucket,t.path,e)?o=`${t.path}/${n}`:o=t.path:o=n;let s=await J(c,t.bucket,o,e,!h,p);s.error&&f(s.error),console.log(h?JSON.stringify({action:"copied",direction:"local-to-remote",count:1,src:i,dest:`t3://${t.bucket}/${o}`}):`Uploaded ${i} -> t3://${t.bucket}/${o}`)}}async function ft(i,t,e,a,p){let c=i.endsWith("/");!t.path&&!c&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=Z(e),l=t.path.includes("*"),n=t.path.endsWith("/")||!t.path&&c;if(!l&&!n&&(n=await D(t.bucket,t.path,a)),n&&!l&&!p&&f("Source is a remote folder (not copied). Use -r to copy recursively."),l||n){let o=l?j(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",s=!l&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",{items:u,error:d}=await A(t.bucket,o||void 0,a);d&&f(d);let m=u.filter(y=>!y.name.endsWith("/"));if(l){let y=t.path.split("/").pop(),$=O(y);m=m.filter(S=>{let g=o?S.name.slice(o.length):S.name;return!p&&g.includes("/")?!1:$.test(g.split("/").pop())})}if(m.length===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:0}):"No objects to download");return}let w=m.map(y=>async()=>{let $=o?y.name.slice(o.length):y.name,S=s?v(r,s,$):v(r,$),g=await Q(t.bucket,y.name,S,a);return g.error?(console.error(`Failed to download ${y.name}: ${g.error}`),!1):(h||console.log(`Downloaded t3://${t.bucket}/${y.name} -> ${S}`),!0)}),b=(await x(w,8)).filter(Boolean).length;console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:b}):`Downloaded ${b} file(s)`)}else{let o=t.path.split("/").pop(),s,u=!1;try{u=z(r).isDirectory()}catch{}u||e.endsWith("/")?s=v(r,o):s=r;let d=await Q(t.bucket,t.path,s,a,!h);d.error&&f(d.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-local",count:1,src:`t3://${t.bucket}/${t.path}`,dest:s}):`Downloaded t3://${t.bucket}/${t.path} -> ${s}`)}}async function mt(i,t,e,a,p){let c=i.endsWith("/");!t.path&&!c&&f("Cannot copy a bucket. Provide a path within the bucket.");let r=i.includes("*"),l=t.path.endsWith("/")||!t.path&&c;if(!r&&!l&&t.path&&(l=await D(t.bucket,t.path,a)),l&&!r&&!p&&f("Source is a remote folder (not copied). Use -r to copy recursively."),r||l){let n=r?j(t.path):t.path?t.path.endsWith("/")?t.path:`${t.path}/`:"",o=!r&&t.path&&!t.path.endsWith("/")?t.path.split("/").filter(Boolean).pop()??"":"",u=[e.path?.replace(/\/$/,"")||"",o].filter(Boolean).join("/"),d=u?`${u}/`:"";t.bucket===e.bucket&&n===d&&f("Source and destination are the same");let{items:m,error:w}=await A(t.bucket,n||void 0,a);w&&f(w);let k=m.filter(g=>g.name!==n);if(r){let g=t.path.split("/").pop(),W=O(g);k=k.filter(F=>{let T=n?F.name.slice(n.length):F.name;return!p&&T.includes("/")?!1:W.test(T.split("/").pop())})}let b=k.map(g=>async()=>{let W=n?g.name.slice(n.length):g.name,F=u?`${u}/${W}`:W,T=await B(a,t.bucket,g.name,e.bucket,F);return T.error?(console.error(`Failed to copy ${g.name}: ${T.error}`),!1):(h||console.log(`Copied t3://${t.bucket}/${g.name} -> t3://${e.bucket}/${F}`),!0)}),$=(await x(b,8)).filter(Boolean).length,S=!1;if(u&&n){let{data:g}=await lt({prefix:n,limit:1,config:{...a,bucket:t.bucket}});if(g?.items?.some(W=>W.name===n)){let W=`${u}/`,F=await B(a,t.bucket,n,e.bucket,W);F.error?console.error(`Failed to copy folder marker: ${F.error}`):S=!0}}if($===0&&S&&($=1),$===0){console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:0}):"No objects to copy");return}console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:$}):`Copied ${$} object(s)`)}else{let n=t.path.split("/").pop(),o;e.path?e.path.endsWith("/")?o=`${e.path}${n}`:await D(e.bucket,e.path,a)?o=`${e.path}/${n}`:o=e.path:o=n,t.bucket===e.bucket&&t.path===o&&f("Source and destination are the same");let s=await B(a,t.bucket,t.path,e.bucket,o);s.error&&f(s.error),console.log(h?JSON.stringify({action:"copied",direction:"remote-to-remote",count:1,src:`t3://${t.bucket}/${t.path}`,dest:`t3://${e.bucket}/${o}`}):`Copied t3://${t.bucket}/${t.path} -> t3://${e.bucket}/${o}`)}}async function ht(i){let t=N(i,["src"]),e=N(i,["dest"]);(!t||!e)&&f("Both src and dest arguments are required");let a=!!N(i,["recursive","r"]),p=N(i,["access","a","A"]);h=M(i)==="json";let r;p===void 0?r=void 0:p==="public"||p==="private"?r=p:f('Access level must be either "public" or "private"');let l=ct(t,e);r!==void 0&&l!=="local-to-remote"&&f('--access only applies to local-to-remote uploads. Use "tigris objects set-access" to change access on existing objects.');let n=await K({withCredentialProvider:!0});switch(l){case"local-to-remote":{let o=C(e);o.bucket||f("Invalid destination path"),await ut(t,o,n,a,r);break}case"remote-to-local":{let o=C(t);o.bucket||f("Invalid source path"),await ft(t,o,e,n,a);break}case"remote-to-remote":{let o=C(t),s=C(e);o.bucket||f("Invalid source path"),s.bucket||f("Invalid destination path"),await mt(t,o,s,n,a);break}}process.exit(0)}export{ht as default};
@@ -1 +1 @@
1
- import{e as k}from"../../chunk-WJLB362D.js";import{a as d,b as m}from"../../chunk-S6KFKBMY.js";import{a as s,b as u}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as f,d as r,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{list as p,listBuckets as b}from"@tigrisdata/storage";var t=g("credentials","test");async function h(n){a(t);let c=m(n),e=d(n,["bucket","b"]),i=await k();if(!i.accessKeyId&&!i.sessionToken&&u(t,'No credentials found. Run "tigris configure" or "tigris login" first.'),e){let{error:o}=await p({config:{...i,bucket:e},limit:1});o&&(r(t,`Current credentials don't have access to bucket "${e}"`),s(o,t)),c==="json"?console.log(JSON.stringify({valid:!0,bucket:e})):(console.log(` Bucket: ${e}`),console.log(" Access verified."))}else{let{data:o,error:l}=await b({config:i});l&&(r(t,"Current credentials don't have sufficient access"),s(l,t)),console.log(c==="json"?JSON.stringify({valid:!0,bucketCount:o.buckets.length}):` Access verified. Found ${o.buckets.length} bucket(s).`)}f(t)}export{h as default};
1
+ import{f as k}from"../../chunk-5UQUUFCL.js";import{a as d,b as m}from"../../chunk-S6KFKBMY.js";import{a as s,b as u}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as a,c as f,d as r,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{list as p,listBuckets as b}from"@tigrisdata/storage";var t=g("credentials","test");async function h(n){a(t);let c=m(n),e=d(n,["bucket","b"]),i=await k();if(!i.accessKeyId&&!i.sessionToken&&u(t,'No credentials found. Run "tigris configure" or "tigris login" first.'),e){let{error:o}=await p({config:{...i,bucket:e},limit:1});o&&(r(t,`Current credentials don't have access to bucket "${e}"`),s(o,t)),c==="json"?console.log(JSON.stringify({valid:!0,bucket:e})):(console.log(` Bucket: ${e}`),console.log(" Access verified."))}else{let{data:o,error:l}=await b({config:i});l&&(r(t,"Current credentials don't have sufficient access"),s(l,t)),console.log(c==="json"?JSON.stringify({valid:!0,bucketCount:o.buckets.length}):` Access verified. Found ${o.buckets.length} bucket(s).`)}f(t)}export{h as default};
@@ -1 +1 @@
1
- import{a as y}from"../../../chunk-TUDALPGD.js";import{a as g}from"../../../chunk-BLWMGKCV.js";import"../../../chunk-WJLB362D.js";import{a as c,b as u,e as p}from"../../../chunk-S6KFKBMY.js";import{b as t}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as l,j as f}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{existsSync as h,readFileSync as w}from"fs";import{addPolicy as O}from"@tigrisdata/iam";var e=f("iam policies","create");async function A(o){d(e);let P=u(o),a=c(o,["name"]),i=c(o,["document","d"]),S=c(o,["description"])??"";a||t(e,"Policy name is required"),/^[a-zA-Z0-9=,.@_-]+$/.test(a)||t(e,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed.");let v=await g(e),n;i?h(i)?n=w(i,"utf-8"):n=i:process.stdin.isTTY?t(e,"Policy document is required. Provide via --document or pipe to stdin."):n=await p();let m;try{m=y(n)}catch{t(e,"Invalid JSON in policy document")}let{data:r,error:s}=await O(a,{document:m,description:S,config:v});s&&t(e,s),P==="json"&&console.log(JSON.stringify({action:"created",name:r.name,arn:r.resource})),l(e,{name:r.name}),console.log(`Resource: ${r.resource}`)}export{A as default};
1
+ import{a as y}from"../../../chunk-TUDALPGD.js";import{a as g}from"../../../chunk-5Z3OHUTR.js";import"../../../chunk-5UQUUFCL.js";import{a as c,b as u,e as p}from"../../../chunk-S6KFKBMY.js";import{b as t}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as l,j as f}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{existsSync as h,readFileSync as w}from"fs";import{addPolicy as O}from"@tigrisdata/iam";var e=f("iam policies","create");async function A(o){d(e);let P=u(o),a=c(o,["name"]),i=c(o,["document","d"]),S=c(o,["description"])??"";a||t(e,"Policy name is required"),/^[a-zA-Z0-9=,.@_-]+$/.test(a)||t(e,"Invalid policy name. Only alphanumeric characters and =,.@_- are allowed.");let v=await g(e),n;i?h(i)?n=w(i,"utf-8"):n=i:process.stdin.isTTY?t(e,"Policy document is required. Provide via --document or pipe to stdin."):n=await p();let m;try{m=y(n)}catch{t(e,"Invalid JSON in policy document")}let{data:r,error:s}=await O(a,{document:m,description:S,config:v});s&&t(e,s),P==="json"&&console.log(JSON.stringify({action:"created",name:r.name,arn:r.resource})),l(e,{name:r.name}),console.log(`Resource: ${r.resource}`)}export{A as default};
@@ -1 +1 @@
1
- import{a as u}from"../../../chunk-VTZW32DG.js";import{a as g}from"../../../chunk-BLWMGKCV.js";import{a as l,b as p}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-WJLB362D.js";import{a as i,b as d}from"../../../chunk-S6KFKBMY.js";import{b as a}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as s,j as m}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{deletePolicy as S}from"@tigrisdata/iam";var e=m("iam policies","delete");async function A(t){f(e);let y=d(t),o=i(t,["resource"]),w=i(t,["yes","y","force"]),n=await g(e);if(!o){let r=await u(n,e,"Select a policy to delete:");if(!r)return;o=r}if(!w&&(l("Use --yes to skip confirmation"),!await p(`Delete policy '${o}'?`))){console.log("Aborted");return}let{error:c}=await S(o,{config:n});c&&a(e,c),y==="json"&&console.log(JSON.stringify({action:"deleted",arn:o})),s(e,{resource:o})}export{A as default};
1
+ import{a as u}from"../../../chunk-S3HKXM3M.js";import{a as g}from"../../../chunk-5Z3OHUTR.js";import{a as l,b as p}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-5UQUUFCL.js";import{a as i,b as d}from"../../../chunk-S6KFKBMY.js";import{b as a}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as s,j as m}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{deletePolicy as S}from"@tigrisdata/iam";var e=m("iam policies","delete");async function A(t){f(e);let y=d(t),o=i(t,["resource"]),w=i(t,["yes","y","force"]),n=await g(e);if(!o){let r=await u(n,e,"Select a policy to delete:");if(!r)return;o=r}if(!w&&(l("Use --yes to skip confirmation"),!await p(`Delete policy '${o}'?`))){console.log("Aborted");return}let{error:c}=await S(o,{config:n});c&&a(e,c),y==="json"&&console.log(JSON.stringify({action:"deleted",arn:o})),s(e,{resource:o})}export{A as default};
@@ -1 +1 @@
1
- import{a}from"../../../chunk-TUDALPGD.js";import{a as J}from"../../../chunk-VTZW32DG.js";import{a as h}from"../../../chunk-BLWMGKCV.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-WJLB362D.js";import{a as s,b as w,e as P}from"../../../chunk-S6KFKBMY.js";import{b as e}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as g,c as y,j as S}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{existsSync as x,readFileSync as A}from"fs";import{editPolicy as D,getPolicy as N}from"@tigrisdata/iam";var t=S("iam policies","edit");async function T(o){g(t);let O=w(o),r=s(o,["resource"]),n=s(o,["document","d"]),d=s(o,["description"]),m=await h(t);if(!r){process.stdin.isTTY||e(t,"Policy ARN is required when piping document via stdin.");let i=await J(m,t,"Select a policy to edit:");if(!i)return;r=i}let c;if(n){let i;x(n)?i=A(n,"utf-8"):i=n;try{c=a(i)}catch{e(t,"Invalid JSON in policy document")}}else if(!process.stdin.isTTY&&!d){let i=await P();try{c=a(i)}catch{e(t,"Invalid JSON in policy document")}}!c&&!d&&e(t,"Either --document or --description is required.");let{data:u,error:f}=await N(r,{config:m});f&&e(t,f);let{data:l,error:p}=await D(r,{document:c??u.document,description:d??u.description,config:m});p&&e(t,p),O==="json"&&console.log(JSON.stringify({action:"updated",arn:l.resource})),y(t,{resource:l.resource})}export{T as default};
1
+ import{a}from"../../../chunk-TUDALPGD.js";import{a as J}from"../../../chunk-S3HKXM3M.js";import{a as h}from"../../../chunk-5Z3OHUTR.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-5UQUUFCL.js";import{a as s,b as w,e as P}from"../../../chunk-S6KFKBMY.js";import{b as e}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as g,c as y,j as S}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{existsSync as x,readFileSync as A}from"fs";import{editPolicy as D,getPolicy as N}from"@tigrisdata/iam";var t=S("iam policies","edit");async function T(o){g(t);let O=w(o),r=s(o,["resource"]),n=s(o,["document","d"]),d=s(o,["description"]),m=await h(t);if(!r){process.stdin.isTTY||e(t,"Policy ARN is required when piping document via stdin.");let i=await J(m,t,"Select a policy to edit:");if(!i)return;r=i}let c;if(n){let i;x(n)?i=A(n,"utf-8"):i=n;try{c=a(i)}catch{e(t,"Invalid JSON in policy document")}}else if(!process.stdin.isTTY&&!d){let i=await P();try{c=a(i)}catch{e(t,"Invalid JSON in policy document")}}!c&&!d&&e(t,"Either --document or --description is required.");let{data:u,error:f}=await N(r,{config:m});f&&e(t,f);let{data:l,error:p}=await D(r,{document:c??u.document,description:d??u.description,config:m});p&&e(t,p),O==="json"&&console.log(JSON.stringify({action:"updated",arn:l.resource})),y(t,{resource:l.resource})}export{T as default};
@@ -1 +1 @@
1
- import{a as y}from"../../../chunk-VTZW32DG.js";import{a as g}from"../../../chunk-BLWMGKCV.js";import{f as p}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-WJLB362D.js";import{a as m,b as d}from"../../../chunk-S6KFKBMY.js";import{b as u}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as a,c as i,j as f}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{getPolicy as A}from"@tigrisdata/iam";var t=f("iam policies","get");async function S(n){a(t);let r=m(n,["resource"]),s=d(n),l=await g(t);if(!r){let o=await y(l,t);if(!o)return;r=o}let{data:e,error:c}=await A(r,{config:l});if(c&&u(t,c),s==="json"){console.log(JSON.stringify(e,null,2)),i(t);return}let v=[{field:"Name",value:e.name},{field:"ID",value:e.id},{field:"Resource",value:e.resource},{field:"Description",value:e.description||"-"},{field:"Path",value:e.path},{field:"Version",value:e.defaultVersionId},{field:"Attachments",value:String(e.attachmentCount)},{field:"Created",value:e.createDate.toISOString()},{field:"Updated",value:e.updateDate.toISOString()}],h=p(v,s,"policy","field",[{key:"field",header:"Field"},{key:"value",header:"Value"}]);if(console.log(h),e.users&&e.users.length>0){console.log("Attached Users:");for(let o of e.users)console.log(` - ${o.name} (${o.id})`);console.log()}console.log("Policy Document:"),console.log(` Version: ${e.document.version}`),console.log(" Statements:");for(let o of e.document.statements)console.log(` - Effect: ${o.effect}`),console.log(` Action: ${Array.isArray(o.action)?o.action.join(", "):o.action}`),console.log(` Resource: ${Array.isArray(o.resource)?o.resource.join(", "):o.resource}`);i(t)}export{S as default};
1
+ import{a as y}from"../../../chunk-S3HKXM3M.js";import{a as g}from"../../../chunk-5Z3OHUTR.js";import{f as p}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-5UQUUFCL.js";import{a as m,b as d}from"../../../chunk-S6KFKBMY.js";import{b as u}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as a,c as i,j as f}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{getPolicy as A}from"@tigrisdata/iam";var t=f("iam policies","get");async function S(n){a(t);let r=m(n,["resource"]),s=d(n),l=await g(t);if(!r){let o=await y(l,t);if(!o)return;r=o}let{data:e,error:c}=await A(r,{config:l});if(c&&u(t,c),s==="json"){console.log(JSON.stringify(e,null,2)),i(t);return}let v=[{field:"Name",value:e.name},{field:"ID",value:e.id},{field:"Resource",value:e.resource},{field:"Description",value:e.description||"-"},{field:"Path",value:e.path},{field:"Version",value:e.defaultVersionId},{field:"Attachments",value:String(e.attachmentCount)},{field:"Created",value:e.createDate.toISOString()},{field:"Updated",value:e.updateDate.toISOString()}],h=p(v,s,"policy","field",[{key:"field",header:"Field"},{key:"value",header:"Value"}]);if(console.log(h),e.users&&e.users.length>0){console.log("Attached Users:");for(let o of e.users)console.log(` - ${o.name} (${o.id})`);console.log()}console.log("Policy Document:"),console.log(` Version: ${e.document.version}`),console.log(" Statements:");for(let o of e.document.statements)console.log(` - Effect: ${o.effect}`),console.log(` Action: ${Array.isArray(o.action)?o.action.join(", "):o.action}`),console.log(` Resource: ${Array.isArray(o.resource)?o.resource.join(", "):o.resource}`);i(t)}export{S as default};
@@ -1 +1 @@
1
- import{a as h}from"../../../chunk-VTZW32DG.js";import{a as k}from"../../../chunk-BLWMGKCV.js";import{a as g}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-WJLB362D.js";import{a as l,b as u}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as y,j as p}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import I from"enquirer";import{attachPolicyToAccessKey as P,getPolicy as v,listAccessKeys as O}from"@tigrisdata/iam";var{prompt:K}=I,e=p("iam policies","link-key");async function R(a){d(e);let w=u(a),r=l(a,["resource"]),s=l(a,["id"]),c=await k(e);if(!r){let i=await h(c,e);if(!i)return;r=i}if(!s){g("Use --id to specify the access key ID");let[i,n]=await Promise.all([O({config:c}),v(r,{config:c})]);i.error&&o(e,i.error),n.error&&o(e,n.error);let A=new Set((n.data.users??[]).map(t=>t.id)),f=i.data.accessKeys.filter(t=>!A.has(t.id));f.length===0&&o(e,"No unlinked access keys available. All access keys are already linked to this policy.");let{selected:S}=await K({type:"select",name:"selected",message:"Select an access key to link:",choices:f.map(t=>({name:t.id,message:`${t.name} (${t.id})`}))});s=S}let{error:m}=await P(s,r,{config:c});m&&o(e,m),w==="json"&&console.log(JSON.stringify({action:"linked",policyArn:r,id:s})),y(e)}export{R as default};
1
+ import{a as h}from"../../../chunk-S3HKXM3M.js";import{a as k}from"../../../chunk-5Z3OHUTR.js";import{a as g}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-5UQUUFCL.js";import{a as l,b as u}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as y,j as p}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import I from"enquirer";import{attachPolicyToAccessKey as P,getPolicy as v,listAccessKeys as O}from"@tigrisdata/iam";var{prompt:K}=I,e=p("iam policies","link-key");async function R(a){d(e);let w=u(a),r=l(a,["resource"]),s=l(a,["id"]),c=await k(e);if(!r){let i=await h(c,e);if(!i)return;r=i}if(!s){g("Use --id to specify the access key ID");let[i,n]=await Promise.all([O({config:c}),v(r,{config:c})]);i.error&&o(e,i.error),n.error&&o(e,n.error);let A=new Set((n.data.users??[]).map(t=>t.id)),f=i.data.accessKeys.filter(t=>!A.has(t.id));f.length===0&&o(e,"No unlinked access keys available. All access keys are already linked to this policy.");let{selected:S}=await K({type:"select",name:"selected",message:"Select an access key to link:",choices:f.map(t=>({name:t.id,message:`${t.name} (${t.id})`}))});s=S}let{error:m}=await P(s,r,{config:c});m&&o(e,m),w==="json"&&console.log(JSON.stringify({action:"linked",policyArn:r,id:s})),y(e)}export{R as default};
@@ -1 +1 @@
1
- import{a as k}from"../../../chunk-VTZW32DG.js";import{a as y}from"../../../chunk-BLWMGKCV.js";import{f as d}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-WJLB362D.js";import{a as p,b as g}from"../../../chunk-S6KFKBMY.js";import{b as l}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as c,c as a,e as f,j as u}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{getPolicy as O}from"@tigrisdata/iam";var t=u("iam policies","list-keys");async function x(i){c(t);let h=g(i),e=p(i,["resource"]),n=await y(t);if(!e){let o=await k(n,t);if(!o)return;e=o}let{data:r,error:s}=await O(e,{config:n});if(s&&l(t,s),!r.users||r.users.length===0){f(t);return}let m=r.users.map(o=>({name:o.name,id:o.id})),w=d(m,h,"keys","key",[{key:"name",header:"Name"},{key:"id",header:"ID"}]);console.log(w),a(t,{count:m.length})}export{x as default};
1
+ import{a as k}from"../../../chunk-S3HKXM3M.js";import{a as y}from"../../../chunk-5Z3OHUTR.js";import{f as d}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-5UQUUFCL.js";import{a as p,b as g}from"../../../chunk-S6KFKBMY.js";import{b as l}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as c,c as a,e as f,j as u}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{getPolicy as O}from"@tigrisdata/iam";var t=u("iam policies","list-keys");async function x(i){c(t);let h=g(i),e=p(i,["resource"]),n=await y(t);if(!e){let o=await k(n,t);if(!o)return;e=o}let{data:r,error:s}=await O(e,{config:n});if(s&&l(t,s),!r.users||r.users.length===0){f(t);return}let m=r.users.map(o=>({name:o.name,id:o.id})),w=d(m,h,"keys","key",[{key:"name",header:"Name"},{key:"id",header:"ID"}]);console.log(w),a(t,{count:m.length})}export{x as default};
@@ -1 +1 @@
1
- import{a as x}from"../../../chunk-BLWMGKCV.js";import{g as y}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-WJLB362D.js";import{b as l,c as T}from"../../../chunk-S6KFKBMY.js";import{b as k}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as p,c as u,e as g,i as f,j as h}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{listPolicies as E}from"@tigrisdata/iam";var t=h("iam policies","list");async function I(a){p(t);let i=l(a),{limit:r,pageToken:s}=T(a),o=await x(t),{data:n,error:c}=await E({...r!==void 0?{limit:r}:{},...s?{paginationToken:s}:{},config:{sessionToken:o.sessionToken,organizationId:o.organizationId,iamEndpoint:o.iamEndpoint}});if(c&&k(t,c),!n.policies||n.policies.length===0){g(t);return}let d=n.policies.map(e=>({name:e.name,id:e.id,resource:e.resource,description:e.description||"-",attachments:e.attachmentCount,created:e.createDate,updated:e.updateDate})),C=[{key:"id",header:"ID"},{key:"resource",header:"Resource"},{key:"name",header:"Name"},{key:"description",header:"Description"},{key:"attachments",header:"Attachments"},{key:"created",header:"Created"},{key:"updated",header:"Updated"}],m=n.paginationToken||void 0,D=y(d,i,"policies","policy",C,{paginationToken:m});console.log(D),i!=="json"&&i!=="xml"&&f(m),u(t,{count:d.length})}export{I as default};
1
+ import{a as x}from"../../../chunk-5Z3OHUTR.js";import{g as y}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-5UQUUFCL.js";import{b as l,c as T}from"../../../chunk-S6KFKBMY.js";import{b as k}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as p,c as u,e as g,i as f,j as h}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{listPolicies as E}from"@tigrisdata/iam";var t=h("iam policies","list");async function I(a){p(t);let i=l(a),{limit:r,pageToken:s}=T(a),o=await x(t),{data:n,error:c}=await E({...r!==void 0?{limit:r}:{},...s?{paginationToken:s}:{},config:{sessionToken:o.sessionToken,organizationId:o.organizationId,iamEndpoint:o.iamEndpoint}});if(c&&k(t,c),!n.policies||n.policies.length===0){g(t);return}let d=n.policies.map(e=>({name:e.name,id:e.id,resource:e.resource,description:e.description||"-",attachments:e.attachmentCount,created:e.createDate,updated:e.updateDate})),C=[{key:"id",header:"ID"},{key:"resource",header:"Resource"},{key:"name",header:"Name"},{key:"description",header:"Description"},{key:"attachments",header:"Attachments"},{key:"created",header:"Created"},{key:"updated",header:"Updated"}],m=n.paginationToken||void 0,D=y(d,i,"policies","policy",C,{paginationToken:m});console.log(D),i!=="json"&&i!=="xml"&&f(m),u(t,{count:d.length})}export{I as default};
@@ -1 +1 @@
1
- import{a}from"../../../chunk-VTZW32DG.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";export{a as selectPolicy};
1
+ import{a}from"../../../chunk-S3HKXM3M.js";import"../../../chunk-S77OAN6Y.js";import"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";export{a as selectPolicy};
@@ -1 +1 @@
1
- import{a as h}from"../../../chunk-VTZW32DG.js";import{a as k}from"../../../chunk-BLWMGKCV.js";import{a as f,b as d}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-WJLB362D.js";import{a as n,b as u}from"../../../chunk-S6KFKBMY.js";import{b as c}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as y,c as p,j as g}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import $ from"enquirer";import{detachPolicyFromAccessKey as O,getPolicy as P}from"@tigrisdata/iam";var{prompt:I}=$,o=g("iam policies","unlink-key");async function U(r){y(o);let w=u(r),i=n(r,["resource"]),t=n(r,["id"]),A=n(r,["yes","y","force"]),s=await k(o);if(!i){let e=await h(s,o);if(!e)return;i=e}if(!t){f("Use --id to specify the access key ID");let{data:e,error:l}=await P(i,{config:s});l&&c(o,l),(!e.users||e.users.length===0)&&c(o,"No access keys are linked to this policy.");let{selected:S}=await I({type:"select",name:"selected",message:"Select an access key to unlink:",choices:e.users.map(a=>({name:a.id,message:`${a.name} (${a.id})`}))});t=S}if(!A&&(f("Use --yes to skip confirmation"),!await d(`Unlink access key '${t}' from policy '${i}'?`))){console.log("Aborted");return}let{error:m}=await O(t,i,{config:s});m&&c(o,m),w==="json"&&console.log(JSON.stringify({action:"unlinked",policyArn:i,id:t})),p(o)}export{U as default};
1
+ import{a as h}from"../../../chunk-S3HKXM3M.js";import{a as k}from"../../../chunk-5Z3OHUTR.js";import{a as f,b as d}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-5UQUUFCL.js";import{a as n,b as u}from"../../../chunk-S6KFKBMY.js";import{b as c}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as y,c as p,j as g}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import $ from"enquirer";import{detachPolicyFromAccessKey as O,getPolicy as P}from"@tigrisdata/iam";var{prompt:I}=$,o=g("iam policies","unlink-key");async function U(r){y(o);let w=u(r),i=n(r,["resource"]),t=n(r,["id"]),A=n(r,["yes","y","force"]),s=await k(o);if(!i){let e=await h(s,o);if(!e)return;i=e}if(!t){f("Use --id to specify the access key ID");let{data:e,error:l}=await P(i,{config:s});l&&c(o,l),(!e.users||e.users.length===0)&&c(o,"No access keys are linked to this policy.");let{selected:S}=await I({type:"select",name:"selected",message:"Select an access key to unlink:",choices:e.users.map(a=>({name:a.id,message:`${a.name} (${a.id})`}))});t=S}if(!A&&(f("Use --yes to skip confirmation"),!await d(`Unlink access key '${t}' from policy '${i}'?`))){console.log("Aborted");return}let{error:m}=await O(t,i,{config:s});m&&c(o,m),w==="json"&&console.log(JSON.stringify({action:"unlinked",policyArn:i,id:t})),p(o)}export{U as default};
@@ -1 +1 @@
1
- import{a as b}from"../../../chunk-DWOWKOKO.js";import{a as l}from"../../../chunk-BLWMGKCV.js";import"../../../chunk-WJLB362D.js";import{a as n,b as u}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as g,j as d}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import{a as p}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{createTeam as y}from"@tigrisdata/iam";var t=d("iam teams","create");async function O(e){f(t);let I=u(e);if(p("Team management"))return;let r=n(e,["name"]),i=n(e,["description","d"]),a=typeof i=="string"?i:void 0,m=b(t,n(e,["members","m"]));r||o(t,"Team name is required");let w=await l(t),{data:s,error:c}=await y({name:r,...a!==void 0?{description:a}:{},...m?{members:m}:{}},{config:w});if(c&&o(t,c),I==="json"){console.log(JSON.stringify({action:"created",teamId:s.teamId,name:r}));return}g(t,{name:r}),console.log(`Team ID: ${s.teamId}`)}export{O as default};
1
+ import{a as b}from"../../../chunk-XWIL5QBS.js";import{a as l}from"../../../chunk-5Z3OHUTR.js";import"../../../chunk-5UQUUFCL.js";import{a as n,b as u}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as f,c as g,j as d}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import{a as p}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{createTeam as y}from"@tigrisdata/iam";var t=d("iam teams","create");async function O(e){f(t);let I=u(e);if(p("Team management"))return;let r=n(e,["name"]),i=n(e,["description","d"]),a=typeof i=="string"?i:void 0,m=b(t,n(e,["members","m"]));r||o(t,"Team name is required");let w=await l(t),{data:s,error:c}=await y({name:r,...a!==void 0?{description:a}:{},...m?{members:m}:{}},{config:w});if(c&&o(t,c),I==="json"){console.log(JSON.stringify({action:"created",teamId:s.teamId,name:r}));return}g(t,{name:r}),console.log(`Team ID: ${s.teamId}`)}export{O as default};
@@ -1 +1 @@
1
- import{a as w}from"../../../chunk-DWOWKOKO.js";import{a as b}from"../../../chunk-BLWMGKCV.js";import"../../../chunk-WJLB362D.js";import{a as t,b as l}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as c,c as g,j as u}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import{a as p}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{editTeam as I}from"@tigrisdata/iam";var e=u("iam teams","edit");async function R(n){c(e);let y=l(n);if(p("Team management"))return;let i=t(n,["id"]);i||o(e,"Team ID is required");let s=t(n,["name","n"]),r=typeof s=="string"?s:void 0,d=t(n,["description","d"]),a=typeof d=="string"?d:void 0,m=w(e,t(n,["members","m"]));r===void 0&&a===void 0&&m===void 0&&o(e,"Provide at least one of --name, --description, or --members to update");let O=await b(e),{error:f}=await I(i,{...r!==void 0?{name:r}:{},...a!==void 0?{description:a}:{},...m?{members:m}:{}},{config:O});f&&o(e,f),y==="json"&&console.log(JSON.stringify({action:"updated",teamId:i})),g(e,{id:i})}export{R as default};
1
+ import{a as w}from"../../../chunk-XWIL5QBS.js";import{a as b}from"../../../chunk-5Z3OHUTR.js";import"../../../chunk-5UQUUFCL.js";import{a as t,b as l}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as c,c as g,j as u}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import{a as p}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{editTeam as I}from"@tigrisdata/iam";var e=u("iam teams","edit");async function R(n){c(e);let y=l(n);if(p("Team management"))return;let i=t(n,["id"]);i||o(e,"Team ID is required");let s=t(n,["name","n"]),r=typeof s=="string"?s:void 0,d=t(n,["description","d"]),a=typeof d=="string"?d:void 0,m=w(e,t(n,["members","m"]));r===void 0&&a===void 0&&m===void 0&&o(e,"Provide at least one of --name, --description, or --members to update");let O=await b(e),{error:f}=await I(i,{...r!==void 0?{name:r}:{},...a!==void 0?{description:a}:{},...m?{members:m}:{}},{config:O});f&&o(e,f),y==="json"&&console.log(JSON.stringify({action:"updated",teamId:i})),g(e,{id:i})}export{R as default};
@@ -1 +1 @@
1
- import{a as p}from"../../../chunk-BLWMGKCV.js";import{b as g,d as u,e as h}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-WJLB362D.js";import{b as d}from"../../../chunk-S6KFKBMY.js";import{b as l}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as a,c as i,e as s,j as c}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import{a as f}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{listTeams as k}from"@tigrisdata/iam";var t=c("iam teams","list");async function C(y){a(t);let r=d(y);if(f("Team management"))return;let b=await p(t),{data:o,error:m}=await k({config:b});if(m&&l(t,m),o.teams.length===0){s(t);return}let n=o.teams.map(e=>({id:e.id,name:e.name,description:e.description||"-",members:e.members.length,created:e.createdAt}));console.log(r==="json"?g({teams:o.teams}):r==="xml"?u(n,"teams","team"):h(n,[{key:"id",header:"ID"},{key:"name",header:"Name"},{key:"description",header:"Description"},{key:"members",header:"Members"},{key:"created",header:"Created"}])),i(t,{count:o.teams.length})}export{C as default};
1
+ import{a as p}from"../../../chunk-5Z3OHUTR.js";import{b as g,d as u,e as h}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-5UQUUFCL.js";import{b as d}from"../../../chunk-S6KFKBMY.js";import{b as l}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as a,c as i,e as s,j as c}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import{a as f}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{listTeams as k}from"@tigrisdata/iam";var t=c("iam teams","list");async function C(y){a(t);let r=d(y);if(f("Team management"))return;let b=await p(t),{data:o,error:m}=await k({config:b});if(m&&l(t,m),o.teams.length===0){s(t);return}let n=o.teams.map(e=>({id:e.id,name:e.name,description:e.description||"-",members:e.members.length,created:e.createdAt}));console.log(r==="json"?g({teams:o.teams}):r==="xml"?u(n,"teams","team"):h(n,[{key:"id",header:"ID"},{key:"name",header:"Name"},{key:"description",header:"Description"},{key:"members",header:"Members"},{key:"created",header:"Created"}])),i(t,{count:o.teams.length})}export{C as default};
@@ -1 +1 @@
1
- import{a}from"../../../chunk-DWOWKOKO.js";import"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";export{a as parseMembers};
1
+ import{a}from"../../../chunk-XWIL5QBS.js";import"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";export{a as parseMembers};
@@ -1 +1 @@
1
- import{a as u}from"../../../chunk-BLWMGKCV.js";import"../../../chunk-WJLB362D.js";import{a as s,b as p}from"../../../chunk-S6KFKBMY.js";import{b as n}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as l,c,j as f}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import{a as g}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{inviteUser as b}from"@tigrisdata/iam";var i=f("iam users","invite");async function j(e){l(i);let d=p(e);if(g("User management"))return;let o=s(e,["email"]),r=s(e,["role","r"])??"member",t=Array.isArray(o)?o:o?[o]:[];t.length===0&&n(i,"Email address is required");let a=["admin","member"];a.includes(r)||n(i,`Invalid role "${r}". Must be one of: ${a.join(", ")}`);let v=r,y=await u(i),R=t.map(O=>({email:O,role:v})),{error:m}=await b(R,{config:y});m&&n(i,m),d==="json"&&console.log(JSON.stringify({action:"invited",email:t.join(", ")})),c(i,{email:t.join(", ")})}export{j as default};
1
+ import{a as u}from"../../../chunk-5Z3OHUTR.js";import"../../../chunk-5UQUUFCL.js";import{a as s,b as p}from"../../../chunk-S6KFKBMY.js";import{b as n}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as l,c,j as f}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import{a as g}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{inviteUser as b}from"@tigrisdata/iam";var i=f("iam users","invite");async function j(e){l(i);let d=p(e);if(g("User management"))return;let o=s(e,["email"]),r=s(e,["role","r"])??"member",t=Array.isArray(o)?o:o?[o]:[];t.length===0&&n(i,"Email address is required");let a=["admin","member"];a.includes(r)||n(i,`Invalid role "${r}". Must be one of: ${a.join(", ")}`);let v=r,y=await u(i),R=t.map(O=>({email:O,role:v})),{error:m}=await b(R,{config:y});m&&n(i,m),d==="json"&&console.log(JSON.stringify({action:"invited",email:t.join(", ")})),c(i,{email:t.join(", ")})}export{j as default};
@@ -1,4 +1,4 @@
1
- import{a as p}from"../../../chunk-BLWMGKCV.js";import{b as y,d as i,e as a}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-WJLB362D.js";import{b as h}from"../../../chunk-S6KFKBMY.js";import{b as d}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as m,c as g,e as c,j as u}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import{a as f}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{listUsers as v}from"@tigrisdata/iam";var n=u("iam users","list");async function w(k){m(n);let r=h(k);if(f("User management"))return;let C=await p(n),{data:l,error:s}=await v({config:C});s&&d(n,s);let o=l.users.map(e=>({email:e.email,name:e.userName||"-",role:e.isOrgOwner?"owner":e.role,userId:e.userId})),t=l.invitations.map(e=>({id:e.id,email:e.email,role:e.role,status:e.status,validUntil:e.validUntil.toLocaleDateString()}));if(o.length===0&&t.length===0){c(n);return}let I=[{key:"email",header:"Email"},{key:"name",header:"Name"},{key:"role",header:"Role"},{key:"userId",header:"User ID"}],U=[{key:"id",header:"ID"},{key:"email",header:"Email"},{key:"role",header:"Role"},{key:"status",header:"Status"},{key:"validUntil",header:"Valid Until"}];if(r==="json")console.log(y({users:o,invitations:t}));else if(r==="xml"){let e=["<organization>"];e.push(` ${i(o,"users","user").replace(/\n/g,`
1
+ import{a as p}from"../../../chunk-5Z3OHUTR.js";import{b as y,d as i,e as a}from"../../../chunk-AFM3TY2D.js";import"../../../chunk-5UQUUFCL.js";import{b as h}from"../../../chunk-S6KFKBMY.js";import{b as d}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as m,c as g,e as c,j as u}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import{a as f}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import{listUsers as v}from"@tigrisdata/iam";var n=u("iam users","list");async function w(k){m(n);let r=h(k);if(f("User management"))return;let C=await p(n),{data:l,error:s}=await v({config:C});s&&d(n,s);let o=l.users.map(e=>({email:e.email,name:e.userName||"-",role:e.isOrgOwner?"owner":e.role,userId:e.userId})),t=l.invitations.map(e=>({id:e.id,email:e.email,role:e.role,status:e.status,validUntil:e.validUntil.toLocaleDateString()}));if(o.length===0&&t.length===0){c(n);return}let I=[{key:"email",header:"Email"},{key:"name",header:"Name"},{key:"role",header:"Role"},{key:"userId",header:"User ID"}],U=[{key:"id",header:"ID"},{key:"email",header:"Email"},{key:"role",header:"Role"},{key:"status",header:"Status"},{key:"validUntil",header:"Valid Until"}];if(r==="json")console.log(y({users:o,invitations:t}));else if(r==="xml"){let e=["<organization>"];e.push(` ${i(o,"users","user").replace(/\n/g,`
2
2
  `)}`),e.push(" "+i(t,"invitations","invitation").replace(/\n/g,`
3
3
  `)),e.push("</organization>"),console.log(e.join(`
4
4
  `))}else o.length>0&&(console.log(`
@@ -1 +1 @@
1
- import{a as O}from"../../../chunk-BLWMGKCV.js";import{a,b as v}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-WJLB362D.js";import{a as m,b as w}from"../../../chunk-S6KFKBMY.js";import{b as n}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as l,c as u,e as p,j as d}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import{a as y}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import I from"enquirer";import{listUsers as E,removeUser as F}from"@tigrisdata/iam";var{prompt:S}=I,e=d("iam users","remove");async function $(s){l(e);let h=w(s),t=m(s,["resource"]),U=m(s,["yes","y","force"]);if(y("User management"))return;let c=await O(e),r=Array.isArray(t)?t:t?[t]:[];if(r.length===0){let{data:i,error:g}=await E({config:c});if(g&&n(e,g),i.users.length===0){p(e);return}a("Provide user ID(s) as a positional argument");let{selected:A}=await S({type:"multiselect",name:"selected",message:"Select user(s) to remove (space to select, enter to confirm):",choices:i.users.map(o=>({name:o.userId,message:`${o.email} (${o.isOrgOwner?"owner":o.role})`}))});r=A}if(!U&&(a("Use --yes to skip confirmation"),!await v(`Remove ${r.length} user(s)?`))){console.log("Aborted");return}let{error:f}=await F(r,{config:c});f&&n(e,f),h==="json"&&console.log(JSON.stringify({action:"removed",users:r})),u(e)}export{$ as default};
1
+ import{a as O}from"../../../chunk-5Z3OHUTR.js";import{a,b as v}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-5UQUUFCL.js";import{a as m,b as w}from"../../../chunk-S6KFKBMY.js";import{b as n}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as l,c as u,e as p,j as d}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import{a as y}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import I from"enquirer";import{listUsers as E,removeUser as F}from"@tigrisdata/iam";var{prompt:S}=I,e=d("iam users","remove");async function $(s){l(e);let h=w(s),t=m(s,["resource"]),U=m(s,["yes","y","force"]);if(y("User management"))return;let c=await O(e),r=Array.isArray(t)?t:t?[t]:[];if(r.length===0){let{data:i,error:g}=await E({config:c});if(g&&n(e,g),i.users.length===0){p(e);return}a("Provide user ID(s) as a positional argument");let{selected:A}=await S({type:"multiselect",name:"selected",message:"Select user(s) to remove (space to select, enter to confirm):",choices:i.users.map(o=>({name:o.userId,message:`${o.email} (${o.isOrgOwner?"owner":o.role})`}))});r=A}if(!U&&(a("Use --yes to skip confirmation"),!await v(`Remove ${r.length} user(s)?`))){console.log("Aborted");return}let{error:f}=await F(r,{config:c});f&&n(e,f),h==="json"&&console.log(JSON.stringify({action:"removed",users:r})),u(e)}export{$ as default};
@@ -1 +1 @@
1
- import{a as h}from"../../../chunk-BLWMGKCV.js";import{a,b as y}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-WJLB362D.js";import{a as c,b as k}from"../../../chunk-S6KFKBMY.js";import{b as s}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as g,c as p,e as u,j as v}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import{a as d}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import O from"enquirer";import{listUsers as $,revokeInvitation as E}from"@tigrisdata/iam";var{prompt:S}=O,t=v("iam users","revoke-invitation");async function U(r){g(t);let w=k(r),o=c(r,["resource"]),I=c(r,["yes","y","force"]);if(d("User management"))return;let m=await h(t),e=Array.isArray(o)?o:o?[o]:[];if(e.length===0){let{data:n,error:l}=await $({config:m});if(l&&s(t,l),n.invitations.length===0){u(t);return}a("Provide invitation ID(s) as a positional argument");let{selected:A}=await S({type:"multiselect",name:"selected",message:"Select invitation(s) to revoke (space to select, enter to confirm):",choices:n.invitations.map(i=>({name:i.id,message:`${i.email} (${i.role} - ${i.status})`}))});e=A}if(!I&&(a("Use --yes to skip confirmation"),!await y(`Revoke ${e.length} invitation(s)?`))){console.log("Aborted");return}let{error:f}=await E(e,{config:m});f&&s(t,f),w==="json"&&console.log(JSON.stringify({action:"revoked",invitations:e})),p(t)}export{U as default};
1
+ import{a as h}from"../../../chunk-5Z3OHUTR.js";import{a,b as y}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-5UQUUFCL.js";import{a as c,b as k}from"../../../chunk-S6KFKBMY.js";import{b as s}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as g,c as p,e as u,j as v}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import{a as d}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import O from"enquirer";import{listUsers as $,revokeInvitation as E}from"@tigrisdata/iam";var{prompt:S}=O,t=v("iam users","revoke-invitation");async function U(r){g(t);let w=k(r),o=c(r,["resource"]),I=c(r,["yes","y","force"]);if(d("User management"))return;let m=await h(t),e=Array.isArray(o)?o:o?[o]:[];if(e.length===0){let{data:n,error:l}=await $({config:m});if(l&&s(t,l),n.invitations.length===0){u(t);return}a("Provide invitation ID(s) as a positional argument");let{selected:A}=await S({type:"multiselect",name:"selected",message:"Select invitation(s) to revoke (space to select, enter to confirm):",choices:n.invitations.map(i=>({name:i.id,message:`${i.email} (${i.role} - ${i.status})`}))});e=A}if(!I&&(a("Use --yes to skip confirmation"),!await y(`Revoke ${e.length} invitation(s)?`))){console.log("Aborted");return}let{error:f}=await E(e,{config:m});f&&s(t,f),w==="json"&&console.log(JSON.stringify({action:"revoked",invitations:e})),p(t)}export{U as default};
@@ -1 +1 @@
1
- import{a as v}from"../../../chunk-BLWMGKCV.js";import{a as w}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-WJLB362D.js";import{a as c,b}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-GWPU2O5X.js";import"../../../chunk-AWVF3WSN.js";import"../../../chunk-BLUJHGMR.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as h,e as y,j as R}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-VNUR4TRP.js";import{a as O}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import I from"enquirer";import{listUsers as S,updateUserRole as q}from"@tigrisdata/iam";var{prompt:U}=I,e=R("iam users","update-role");async function E(m){d(e);let A=b(m);if(O("User management"))return;let f=["admin","member"],i=c(m,["role","r"]);i||o(e,"Role is required. Use --role admin or --role member");let r=Array.isArray(i)?i:[i];for(let t of r)f.includes(t)||o(e,`Invalid role "${t}". Must be one of: ${f.join(", ")}`);let n=c(m,["resource"]),s=Array.isArray(n)?n:n?[n]:[],u=await v(e);if(s.length===0){let{data:t,error:a}=await S({config:u});if(a&&o(e,a),t.users.length===0){y(e);return}w("Provide user ID(s) as a positional argument");let{selected:$}=await U({type:"multiselect",name:"selected",message:"Select user(s) to update (space to select, enter to confirm):",choices:t.users.map(l=>({name:l.userId,message:`${l.email} (${l.isOrgOwner?"owner":l.role})`}))});s=$}r.length>1&&r.length!==s.length&&o(e,`Number of roles (${r.length}) must match number of users (${s.length}), or provide a single role for all users`);let g=s.map((t,a)=>({userId:t,role:r.length===1?r[0]:r[a]})),{error:p}=await q(g,{config:u});p&&o(e,p),A==="json"&&console.log(JSON.stringify({action:"updated",users:g})),h(e)}export{E as default};
1
+ import{a as v}from"../../../chunk-5Z3OHUTR.js";import{a as w}from"../../../chunk-S77OAN6Y.js";import"../../../chunk-5UQUUFCL.js";import{a as c,b}from"../../../chunk-S6KFKBMY.js";import{b as o}from"../../../chunk-B7CB3ST5.js";import"../../../chunk-2XSEQJGZ.js";import"../../../chunk-HWAEADX7.js";import"../../../chunk-DV3LCXRH.js";import{b as d,c as h,e as y,j as R}from"../../../chunk-D7WXNA2O.js";import"../../../chunk-NI4EYBQH.js";import"../../../chunk-6ZZ54RU7.js";import"../../../chunk-J3MAV7JB.js";import{a as O}from"../../../chunk-KJBSIIND.js";import"../../../chunk-F4AGJWCK.js";import I from"enquirer";import{listUsers as S,updateUserRole as q}from"@tigrisdata/iam";var{prompt:U}=I,e=R("iam users","update-role");async function E(m){d(e);let A=b(m);if(O("User management"))return;let f=["admin","member"],i=c(m,["role","r"]);i||o(e,"Role is required. Use --role admin or --role member");let r=Array.isArray(i)?i:[i];for(let t of r)f.includes(t)||o(e,`Invalid role "${t}". Must be one of: ${f.join(", ")}`);let n=c(m,["resource"]),s=Array.isArray(n)?n:n?[n]:[],u=await v(e);if(s.length===0){let{data:t,error:a}=await S({config:u});if(a&&o(e,a),t.users.length===0){y(e);return}w("Provide user ID(s) as a positional argument");let{selected:$}=await U({type:"multiselect",name:"selected",message:"Select user(s) to update (space to select, enter to confirm):",choices:t.users.map(l=>({name:l.userId,message:`${l.email} (${l.isOrgOwner?"owner":l.role})`}))});s=$}r.length>1&&r.length!==s.length&&o(e,`Number of roles (${r.length}) must match number of users (${s.length}), or provide a single role for all users`);let g=s.map((t,a)=>({userId:t,role:r.length===1?r[0]:r[a]})),{error:p}=await q(g,{config:u});p&&o(e,p),A==="json"&&console.log(JSON.stringify({action:"updated",users:g})),h(e)}export{E as default};
@@ -1 +1 @@
1
- import{a as n}from"../../chunk-3LZL7JNZ.js";import{a as t}from"../../chunk-FB54QSI7.js";import"../../chunk-OWYZCGWM.js";import{a as o}from"../../chunk-S6KFKBMY.js";import"../../chunk-V2CQF2CL.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-6ZZ54RU7.js";async function i(e){let r=o(e,["agent"]);if(process.env.TIGRIS_NO_UPDATE_CHECK="1",!r){await n();return}console.log(t)}export{i as default};
1
+ import{a as n}from"../../chunk-ZP7AWQAS.js";import{a as t}from"../../chunk-FB54QSI7.js";import"../../chunk-OWYZCGWM.js";import{a as o}from"../../chunk-S6KFKBMY.js";import"../../chunk-DLK3GTAJ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-6ZZ54RU7.js";async function i(e){let r=o(e,["agent"]);if(process.env.TIGRIS_NO_UPDATE_CHECK="1",!r){await n();return}console.log(t)}export{i as default};
@@ -1 +1 @@
1
- import{a}from"../../chunk-3LZL7JNZ.js";import"../../chunk-OWYZCGWM.js";import"../../chunk-V2CQF2CL.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-6ZZ54RU7.js";export{a as runInteractive};
1
+ import{a}from"../../chunk-ZP7AWQAS.js";import"../../chunk-OWYZCGWM.js";import"../../chunk-DLK3GTAJ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-6ZZ54RU7.js";export{a as runInteractive};
@@ -1 +1 @@
1
- import{a}from"../../chunk-WEKHQFXD.js";import"../../chunk-S77OAN6Y.js";import"../../chunk-WJLB362D.js";import"../../chunk-S6KFKBMY.js";import"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";export{a as default};
1
+ import{a}from"../../chunk-EH56YEO2.js";import"../../chunk-S77OAN6Y.js";import"../../chunk-5UQUUFCL.js";import"../../chunk-S6KFKBMY.js";import"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";export{a as default};
@@ -1 +1 @@
1
- import{a,b}from"../../chunk-R4FFJVZL.js";import"../../chunk-S6KFKBMY.js";import"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";export{b as default,a as oauth};
1
+ import{a,b}from"../../chunk-QFMXV3BK.js";import"../../chunk-S6KFKBMY.js";import"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";export{b as default,a as oauth};
@@ -1 +1 @@
1
- import{a as c}from"../../chunk-WEKHQFXD.js";import{a as r}from"../../chunk-R4FFJVZL.js";import{a as s}from"../../chunk-S77OAN6Y.js";import"../../chunk-WJLB362D.js";import"../../chunk-S6KFKBMY.js";import"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import i from"enquirer";var{prompt:n}=i;async function u(e){let a=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,t=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(a||t){await c(e);return}s('Use "tigris login oauth" or "tigris login credentials --access-key ... --access-secret ..."');let{method:m}=await n({type:"select",name:"method",message:"Choose login method:",choices:[{name:"user",message:"As a user (OAuth2 flow)"},{name:"machine",message:"As a machine (Access Key & Secret)"}]});m==="user"?await r():await c(e)}export{u as default};
1
+ import{a as c}from"../../chunk-EH56YEO2.js";import{a as r}from"../../chunk-QFMXV3BK.js";import{a as s}from"../../chunk-S77OAN6Y.js";import"../../chunk-5UQUUFCL.js";import"../../chunk-S6KFKBMY.js";import"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import i from"enquirer";var{prompt:n}=i;async function u(e){let a=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,t=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(a||t){await c(e);return}s('Use "tigris login oauth" or "tigris login credentials --access-key ... --access-secret ..."');let{method:m}=await n({type:"select",name:"method",message:"Choose login method:",choices:[{name:"user",message:"As a user (OAuth2 flow)"},{name:"machine",message:"As a machine (Access Key & Secret)"}]});m==="user"?await r():await c(e)}export{u as default};
@@ -1 +1 @@
1
- import{b as c}from"../chunk-S6KFKBMY.js";import{b as n}from"../chunk-GWPU2O5X.js";import"../chunk-AWVF3WSN.js";import"../chunk-BLUJHGMR.js";import"../chunk-DV3LCXRH.js";import{b as t,c as r,j as i}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import{t as a}from"../chunk-F4AGJWCK.js";var o=i("logout");async function f(m={}){t(o);let e=c(m);try{await a(),e==="json"&&console.log(JSON.stringify({action:"logged_out"})),r(o)}catch(s){n(o,s)}}export{f as default};
1
+ import{b as c}from"../chunk-S6KFKBMY.js";import{b as n}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import{b as t,c as r,j as i}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import{t as a}from"../chunk-F4AGJWCK.js";var o=i("logout");async function f(m={}){t(o);let e=c(m);try{await a(),e==="json"&&console.log(JSON.stringify({action:"logged_out"})),r(o)}catch(s){n(o,s)}}export{f as default};
package/dist/lib/ls.js CHANGED
@@ -1 +1 @@
1
- import{a as P,g}from"../chunk-AFM3TY2D.js";import{e as N}from"../chunk-7ZCVOA6A.js";import{d as p}from"../chunk-WJLB362D.js";import{a as d,b as z,c as j}from"../chunk-S6KFKBMY.js";import{a as c}from"../chunk-GWPU2O5X.js";import"../chunk-AWVF3WSN.js";import"../chunk-BLUJHGMR.js";import"../chunk-DV3LCXRH.js";import{i as f}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-VNUR4TRP.js";import"../chunk-F4AGJWCK.js";import{list as D,listBuckets as E}from"@tigrisdata/storage";async function F(n){let l=d(n,["path"]),u=d(n,["snapshot-version","snapshotVersion","snapshot"]),t=z(n),k=d(n,["source"]),{limit:i,pageToken:a}=j(n);if(!l){let e=await p(),{data:r,error:x}=await E({...i!==void 0?{limit:i}:{},...a?{paginationToken:a}:{},config:e});x&&c(x);let W=(r.buckets||[]).map(w=>({name:w.name,created:w.creationDate})),A=[{key:"name",header:"Name"},{key:"created",header:"Created"}],b=r.paginationToken||void 0,B=g(W,t,"buckets","bucket",A,{paginationToken:b});console.log(B),t!=="json"&&t!=="xml"&&f(b);return}let{bucket:h,path:s}=N(l);h||c("Invalid path");let S=await p(),o=s?s.endsWith("/")?s:`${s}/`:void 0,{data:m,error:y}=await D({prefix:o,delimiter:"/",...u?{snapshotVersion:u}:{},...k?{source:k}:{},...i!==void 0?{limit:i}:{},...a?{paginationToken:a}:{},config:{...S,bucket:h}});y&&c(y);let O=(m.commonPrefixes||[]).map(e=>({key:o?e.slice(o.length):e,size:"-",modified:""})),v=(m.items||[]).map(e=>({key:o?e.name.slice(o.length):e.name,size:P(e.size),modified:e.lastModified})).filter(e=>e.key!==""),C=[...O,...v],M=[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],T=m.paginationToken||void 0,V=g(C,t,"objects","object",M,{paginationToken:T});console.log(V),t!=="json"&&t!=="xml"&&f(T)}export{F as default};
1
+ import{a as P,g}from"../chunk-AFM3TY2D.js";import{e as N}from"../chunk-7ZCVOA6A.js";import{e as p}from"../chunk-5UQUUFCL.js";import{a as d,b as z,c as j}from"../chunk-S6KFKBMY.js";import{a as c}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import{i as f}from"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{list as D,listBuckets as E}from"@tigrisdata/storage";async function F(n){let l=d(n,["path"]),u=d(n,["snapshot-version","snapshotVersion","snapshot"]),t=z(n),k=d(n,["source"]),{limit:i,pageToken:a}=j(n);if(!l){let e=await p(),{data:r,error:x}=await E({...i!==void 0?{limit:i}:{},...a?{paginationToken:a}:{},config:e});x&&c(x);let W=(r.buckets||[]).map(w=>({name:w.name,created:w.creationDate})),A=[{key:"name",header:"Name"},{key:"created",header:"Created"}],b=r.paginationToken||void 0,B=g(W,t,"buckets","bucket",A,{paginationToken:b});console.log(B),t!=="json"&&t!=="xml"&&f(b);return}let{bucket:h,path:s}=N(l);h||c("Invalid path");let S=await p(),o=s?s.endsWith("/")?s:`${s}/`:void 0,{data:m,error:y}=await D({prefix:o,delimiter:"/",...u?{snapshotVersion:u}:{},...k?{source:k}:{},...i!==void 0?{limit:i}:{},...a?{paginationToken:a}:{},config:{...S,bucket:h}});y&&c(y);let O=(m.commonPrefixes||[]).map(e=>({key:o?e.slice(o.length):e,size:"-",modified:""})),v=(m.items||[]).map(e=>({key:o?e.name.slice(o.length):e.name,size:P(e.size),modified:e.lastModified})).filter(e=>e.key!==""),C=[...O,...v],M=[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],T=m.paginationToken||void 0,V=g(C,t,"objects","object",M,{paginationToken:T});console.log(V),t!=="json"&&t!=="xml"&&f(T)}export{F as default};
package/dist/lib/mk.js CHANGED
@@ -1 +1 @@
1
- import{c as m}from"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";import{e as h}from"../chunk-7ZCVOA6A.js";import{d as b}from"../chunk-WJLB362D.js";import{a as t,b as p}from"../chunk-S6KFKBMY.js";import{a as r}from"../chunk-GWPU2O5X.js";import"../chunk-AWVF3WSN.js";import"../chunk-BLUJHGMR.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-VNUR4TRP.js";import"../chunk-F4AGJWCK.js";import{createBucket as O,put as A}from"@tigrisdata/storage";async function j(e){let l=t(e,["path"]);l||r("path argument is required");let{bucket:o,path:a}=h(l);o||r("Invalid path");let f=await b(),u=p(e);if(a){let s=a.endsWith("/")?a:`${a}/`,{error:c}=await A(s,"",{config:{...f,bucket:o}});c&&r(c),console.log(u==="json"?JSON.stringify({action:"created",type:"folder",bucket:o,path:s}):`Folder '${o}/${s}' created`),process.exit(0)}else{let c=t(e,["public"])?"public":t(e,["access","a","A"]),d=t(e,["enableSnapshots","enable-snapshots","s","S"]),S=t(e,["allow-object-acl","allowObjectAcl"]),k=t(e,["enable-directory-listing","enableDirectoryListing"]),y=t(e,["defaultTier","default-tier","t","T"]),w=t(e,["locations","l","L"]),n=t(e,["fork-of","forkOf","fork"]),i=t(e,["source-snapshot","sourceSnapshot","source-snap"]);i&&!n&&r("--source-snapshot requires --fork-of");let{error:g}=await O(o,{defaultTier:y??"STANDARD",enableSnapshot:d===!0,allowObjectAcl:S===!0,enableDirectoryListing:k===!0,access:c??"private",locations:m(w??"global"),...n?{sourceBucketName:n}:{},...i?{sourceBucketSnapshot:i}:{},config:f});g&&r(g),console.log(u==="json"?JSON.stringify({action:"created",type:"bucket",name:o}):`Bucket '${o}' created`),process.exit(0)}}export{j as default};
1
+ import{c as m}from"../chunk-N3Y6RFSK.js";import"../chunk-S77OAN6Y.js";import{e as h}from"../chunk-7ZCVOA6A.js";import{e as b}from"../chunk-5UQUUFCL.js";import{a as t,b as p}from"../chunk-S6KFKBMY.js";import{a as r}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{createBucket as O,put as A}from"@tigrisdata/storage";async function j(e){let l=t(e,["path"]);l||r("path argument is required");let{bucket:o,path:a}=h(l);o||r("Invalid path");let f=await b(),u=p(e);if(a){let s=a.endsWith("/")?a:`${a}/`,{error:c}=await A(s,"",{config:{...f,bucket:o}});c&&r(c),console.log(u==="json"?JSON.stringify({action:"created",type:"folder",bucket:o,path:s}):`Folder '${o}/${s}' created`),process.exit(0)}else{let c=t(e,["public"])?"public":t(e,["access","a","A"]),d=t(e,["enableSnapshots","enable-snapshots","s","S"]),S=t(e,["allow-object-acl","allowObjectAcl"]),k=t(e,["enable-directory-listing","enableDirectoryListing"]),y=t(e,["defaultTier","default-tier","t","T"]),w=t(e,["locations","l","L"]),n=t(e,["fork-of","forkOf","fork"]),i=t(e,["source-snapshot","sourceSnapshot","source-snap"]);i&&!n&&r("--source-snapshot requires --fork-of");let{error:g}=await O(o,{defaultTier:y??"STANDARD",enableSnapshot:d===!0,allowObjectAcl:S===!0,enableDirectoryListing:k===!0,access:c??"private",locations:m(w??"global"),...n?{sourceBucketName:n}:{},...i?{sourceBucketSnapshot:i}:{},config:f});g&&r(g),console.log(u==="json"?JSON.stringify({action:"created",type:"bucket",name:o}):`Bucket '${o}' created`),process.exit(0)}}export{j as default};
package/dist/lib/mv.js CHANGED
@@ -1 +1 @@
1
- import{a as x,b as M}from"../chunk-S77OAN6Y.js";import{a as E,b as j,d as R,f as T,g as D,i as J}from"../chunk-7ZCVOA6A.js";import{d as O}from"../chunk-WJLB362D.js";import{a as w,b as N}from"../chunk-S6KFKBMY.js";import{a as s}from"../chunk-GWPU2O5X.js";import"../chunk-AWVF3WSN.js";import"../chunk-BLUJHGMR.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-VNUR4TRP.js";import"../chunk-F4AGJWCK.js";import{copy as G,list as H,move as L,put as Q,remove as C}from"@tigrisdata/storage";var d=!1;async function V(i){let a=w(i,["src"]),c=w(i,["dest"]),m=w(i,["yes","y","force","f"]),p=!!w(i,["recursive","r"]);d=N(i)==="json",(!a||!c)&&s("both src and dest arguments are required"),(!E(a)||!E(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 l=await O({withCredentialProvider:!0}),h=e.path.includes("*"),y=e.path.endsWith("/")||!e.path&&g;if(!h&&!y&&e.path&&(y=await R(e.bucket,e.path,l)),y&&!h&&!p&&s("Source is a remote folder (not moved). Use -r to move recursively."),h||y){let r=h?D(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",n=!h&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",f=[t.path?.replace(/\/$/,"")||"",n].filter(Boolean).join("/"),U=f?`${f}/`:"";e.bucket===t.bucket&&r===U&&s("Source and destination are the same");let{items:q,error:I}=await J(e.bucket,r||void 0,l);I&&s(I);let b=q.filter(o=>o.name!==r);if(h){let o=e.path.split("/").pop(),u=T(o);b=b.filter(k=>{let $=r?k.name.slice(r.length):k.name;return!p&&$.includes("/")?!1:u.test($.split("/").pop())})}let{data:_}=await H({prefix:r,limit:1,config:{...l,bucket:e.bucket}}),S=r?_?.items?.some(o=>o.name===r):!1;if(b.length===0&&!S){console.log(d?JSON.stringify({action:"moved",count:0}):"No objects to move");return}let z=b.length+(S?1:0);if(!m&&(x("Use --yes to skip confirmation"),!await M(`Are you sure you want to move ${z} object(s)?`))){d||console.log("Aborted");return}let v=0;for(let o of b){let u=r?o.name.slice(r.length):o.name,k=f?`${f}/${u}`:u,$=await A(l,e.bucket,o.name,t.bucket,k);$.error?console.error(`Failed to move ${o.name}: ${$.error}`):(d||console.log(`Moved t3://${e.bucket}/${o.name} -> t3://${t.bucket}/${k}`),v++)}let W=!1;if(S)if(f){let o=`${f}/`,u=await A(l,e.bucket,r,t.bucket,o);u.error?console.error(`Failed to move folder marker: ${u.error}`):W=!0}else{let{error:o}=await C(r,{config:{...l,bucket:e.bucket}});o?console.error(`Failed to remove source folder marker: ${o.message}`):W=!0}v===0&&W&&(v=1),console.log(d?JSON.stringify({action:"moved",count:v}):`Moved ${v} object(s)`)}else{let r=e.path.split("/").pop(),n;if(t.path?t.path.endsWith("/")?n=`${t.path}${r}`:await R(t.bucket,t.path,l)?n=`${t.path}/${r}`:n=t.path:n=r,e.bucket===t.bucket&&e.path===n&&s("Source and destination are the same"),!m&&(x("Use --yes to skip confirmation"),!await M(`Are you sure you want to move 't3://${e.bucket}/${e.path}'?`))){d||console.log("Aborted");return}let F=await A(l,e.bucket,e.path,t.bucket,n);F.error&&s(F.error),console.log(d?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,m,p){if(c.endsWith("/")){let{error:t}=await Q(p,"",{config:{...i,bucket:m}});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===m){let{error:t}=await L(c,p,{config:{...i,bucket:a}});return t?{error:t.message}:{}}let{error:P}=await G(c,p,{srcBucket:a,destBucket:m,config:{...i,bucket:m}});if(P)return{error:P.message};let{error:e}=await C(c,{config:{...i,bucket:a}});return e?{error:`Copied but failed to delete source: ${e.message}`}:{}}export{V as default};
1
+ import{a as x,b as M}from"../chunk-S77OAN6Y.js";import{a as E,b as j,d as R,f as T,g as D,i as J}from"../chunk-7ZCVOA6A.js";import{e as O}from"../chunk-5UQUUFCL.js";import{a as w,b as N}from"../chunk-S6KFKBMY.js";import{a as s}from"../chunk-B7CB3ST5.js";import"../chunk-2XSEQJGZ.js";import"../chunk-HWAEADX7.js";import"../chunk-DV3LCXRH.js";import"../chunk-D7WXNA2O.js";import"../chunk-NI4EYBQH.js";import"../chunk-6ZZ54RU7.js";import"../chunk-J3MAV7JB.js";import"../chunk-F4AGJWCK.js";import{copy as G,list as H,move as L,put as Q,remove as C}from"@tigrisdata/storage";var d=!1;async function V(i){let a=w(i,["src"]),c=w(i,["dest"]),m=w(i,["yes","y","force","f"]),p=!!w(i,["recursive","r"]);d=N(i)==="json",(!a||!c)&&s("both src and dest arguments are required"),(!E(a)||!E(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 l=await O({withCredentialProvider:!0}),h=e.path.includes("*"),y=e.path.endsWith("/")||!e.path&&g;if(!h&&!y&&e.path&&(y=await R(e.bucket,e.path,l)),y&&!h&&!p&&s("Source is a remote folder (not moved). Use -r to move recursively."),h||y){let r=h?D(e.path):e.path?e.path.endsWith("/")?e.path:`${e.path}/`:"",n=!h&&e.path&&!e.path.endsWith("/")?e.path.split("/").filter(Boolean).pop()??"":"",f=[t.path?.replace(/\/$/,"")||"",n].filter(Boolean).join("/"),U=f?`${f}/`:"";e.bucket===t.bucket&&r===U&&s("Source and destination are the same");let{items:q,error:I}=await J(e.bucket,r||void 0,l);I&&s(I);let b=q.filter(o=>o.name!==r);if(h){let o=e.path.split("/").pop(),u=T(o);b=b.filter(k=>{let $=r?k.name.slice(r.length):k.name;return!p&&$.includes("/")?!1:u.test($.split("/").pop())})}let{data:_}=await H({prefix:r,limit:1,config:{...l,bucket:e.bucket}}),S=r?_?.items?.some(o=>o.name===r):!1;if(b.length===0&&!S){console.log(d?JSON.stringify({action:"moved",count:0}):"No objects to move");return}let z=b.length+(S?1:0);if(!m&&(x("Use --yes to skip confirmation"),!await M(`Are you sure you want to move ${z} object(s)?`))){d||console.log("Aborted");return}let v=0;for(let o of b){let u=r?o.name.slice(r.length):o.name,k=f?`${f}/${u}`:u,$=await A(l,e.bucket,o.name,t.bucket,k);$.error?console.error(`Failed to move ${o.name}: ${$.error}`):(d||console.log(`Moved t3://${e.bucket}/${o.name} -> t3://${t.bucket}/${k}`),v++)}let W=!1;if(S)if(f){let o=`${f}/`,u=await A(l,e.bucket,r,t.bucket,o);u.error?console.error(`Failed to move folder marker: ${u.error}`):W=!0}else{let{error:o}=await C(r,{config:{...l,bucket:e.bucket}});o?console.error(`Failed to remove source folder marker: ${o.message}`):W=!0}v===0&&W&&(v=1),console.log(d?JSON.stringify({action:"moved",count:v}):`Moved ${v} object(s)`)}else{let r=e.path.split("/").pop(),n;if(t.path?t.path.endsWith("/")?n=`${t.path}${r}`:await R(t.bucket,t.path,l)?n=`${t.path}/${r}`:n=t.path:n=r,e.bucket===t.bucket&&e.path===n&&s("Source and destination are the same"),!m&&(x("Use --yes to skip confirmation"),!await M(`Are you sure you want to move 't3://${e.bucket}/${e.path}'?`))){d||console.log("Aborted");return}let F=await A(l,e.bucket,e.path,t.bucket,n);F.error&&s(F.error),console.log(d?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,m,p){if(c.endsWith("/")){let{error:t}=await Q(p,"",{config:{...i,bucket:m}});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===m){let{error:t}=await L(c,p,{config:{...i,bucket:a}});return t?{error:t.message}:{}}let{error:P}=await G(c,p,{srcBucket:a,destBucket:m,config:{...i,bucket:m}});if(P)return{error:P.message};let{error:e}=await C(c,{config:{...i,bucket:a}});return e?{error:`Copied but failed to delete source: ${e.message}`}:{}}export{V as default};
@@ -1 +1 @@
1
- import{a as V,b as N}from"../../chunk-S77OAN6Y.js";import{h as C}from"../../chunk-7ZCVOA6A.js";import{d as q}from"../../chunk-WJLB362D.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-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as A,c as $,d as j,j as M}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.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-7ZCVOA6A.js";import{e as q}from"../../chunk-5UQUUFCL.js";import{a as d,b as T}from"../../chunk-S6KFKBMY.js";import{a as w,b as o,c as O,d as S}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as A,c as $,d as j,j as M}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{listVersions as H,remove as R}from"@tigrisdata/storage";var r=M("objects","delete");async function W(c){A(r);let K=T(c),b=d(c,["bucket"]),E=d(c,["key"]),F=d(c,["yes","y","force"]),a=d(c,["version-id","versionId"]),u=!!d(c,["all-versions","allVersions"]);b||o(r,"Bucket name or path is required"),a&&u&&o(r,"Cannot use --version-id with --all-versions");let h=C(b),s=h.bucket,m=E||h.key||void 0;m||o(r,"Object key is required");let I={...await q(),bucket:s},n=Array.isArray(m)?m:[m];a&&n.length>1&&o(r,"--version-id targets a single object; pass exactly one key");let f=[];if(u)for(let e of n){let t=0,g,v,p=!1;for(;;){let{data:l,error:x}=await H({prefix:e,...g?{keyMarker:g}:{},...v?{versionIdMarker:v}:{},config:I});x&&o(r,x);for(let i of l.versions)i.name===e?(f.push({key:e,versionId:i.versionId}),t++):i.name>e&&(p=!0);for(let i of l.deleteMarkers)i.name===e?(f.push({key:e,versionId:i.versionId}),t++):i.name>e&&(p=!0);if(p||!l.hasMore)break;l.nextKeyMarker||o(r,`listVersions reported more pages but no nextKeyMarker for key '${e}'`),g=l.nextKeyMarker,v=l.nextVersionIdMarker}t===0&&o(r,`No versions or delete markers found for key '${e}'`)}else if(a)f.push({key:n[0],versionId:a});else for(let e of n)f.push({key:e});if(!F){V("Use --yes to skip confirmation");let e=u?`Hard-delete ${f.length} version(s) and delete marker(s) for ${n.length} object(s) from '${s}'?`:a?`Hard-delete version '${a}' of '${n[0]}' from '${s}'?`:`Delete ${n.length} object(s) from '${s}'?`;if(!await N(e)){console.log("Aborted");return}}let y=[],k=[];for(let e of f){let{error:t}=await R(e.key,{...e.versionId?{versionId:e.versionId}:{},config:I});t?(j(r,t.message,e),k.push({...e,error:t.message})):(y.push(e),$(r,e))}if(K==="json"){let e=O(r,{bucket:s}),t={action:"deleted",bucket:s,keys:y.map(g=>g.key),deleted:y,errors:k};e.length>0&&(t.nextActions=e),console.log(JSON.stringify(t))}k.length>0&&w(k[0].error,r),S(r,{bucket:s})}export{W as default};
@@ -1 +1 @@
1
- import{h as w}from"../../chunk-7ZCVOA6A.js";import{d as k}from"../../chunk-WJLB362D.js";import{a as r,b as j}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as a,j as b}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.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-7ZCVOA6A.js";import{e as k}from"../../chunk-5UQUUFCL.js";import{a as r,b as j}from"../../chunk-S6KFKBMY.js";import{b as c}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as a,j as b}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{createWriteStream as q,writeFileSync as T}from"fs";import{extname as C}from"path";import{Readable as S}from"stream";import{pipeline as x}from"stream/promises";import{get as y}from"@tigrisdata/storage";var e=b("objects","get"),E=new Set([".js",".ts",".jsx",".tsx",".mjs",".cjs",".py",".rb",".php",".java",".go",".rs",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".scala",".clj",".ex",".exs",".erl",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".json",".yaml",".yml",".toml",".ini",".cfg",".conf",".xml",".plist",".env",".properties",".html",".htm",".css",".scss",".sass",".less",".styl",".md",".markdown",".mdx",".rst",".txt",".text",".csv",".tsv",".log",".ejs",".hbs",".pug",".jade",".njk",".twig",".liquid",".svg",".gitignore",".dockerignore",".editorconfig"]);function F(t,m){let d=C(m||t).toLowerCase();return E.has(d)?"string":"stream"}async function N(t){u(e);let m=j(t),p=r(t,["bucket"]),d=r(t,["key"]),s=r(t,["output","o","O"]),v=r(t,["mode","m","M"]),g=r(t,["snapshot-version","snapshotVersion","snapshot"]),f=r(t,["version-id","versionId"]);p||c(e,"Bucket name or path is required");let{bucket:l,key:o}=w(p,d);o||c(e,"Object key is required");let h=await k();if((v||F(o,s))==="stream"){let{data:i,error:n}=await y(o,"stream",{...g?{snapshotVersion:g}:{},...f?{versionId:f}:{},config:{...h,bucket:l}});if(n&&c(e,n),s){let O=q(s);await x(S.fromWeb(i),O),a(e,{key:o,output:s}),m==="json"&&console.log(JSON.stringify({action:"downloaded",bucket:l,key:o,output:s}))}else await x(S.fromWeb(i),process.stdout),a(e)}else{let{data:i,error:n}=await y(o,"string",{...g?{snapshotVersion:g}:{},...f?{versionId:f}:{},config:{...h,bucket:l}});n&&c(e,n),s?(T(s,i),a(e,{key:o,output:s}),m==="json"&&console.log(JSON.stringify({action:"downloaded",bucket:l,key:o,output:s}))):(console.log(i),a(e))}}export{N as default};
@@ -1 +1 @@
1
- import{a as h,f as k}from"../../chunk-AFM3TY2D.js";import{h as v}from"../../chunk-7ZCVOA6A.js";import{d as l}from"../../chunk-WJLB362D.js";import{a as i,b as d}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as p,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.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-7ZCVOA6A.js";import{e as l}from"../../chunk-5UQUUFCL.js";import{a as i,b as d}from"../../chunk-S6KFKBMY.js";import{b as r}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as p,j as g}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{head as A}from"@tigrisdata/storage";var e=g("objects","info");async function I(o){u(e);let b=d(o),s=i(o,["bucket"]),y=i(o,["key"]),c=i(o,["snapshot-version","snapshotVersion","snapshot"]),a=i(o,["version-id","versionId"]);s||r(e,"Bucket name or path is required");let{bucket:f,key:n}=v(s,y);n||r(e,"Object key is required");let S=await l(),{data:t,error:m}=await A(n,{...c?{snapshotVersion:c}:{},...a?{versionId:a}:{},config:{...S,bucket:f}});m&&r(e,m),t||r(e,"Object not found");let j=[{metric:"Path",value:t.path},{metric:"Size",value:h(t.size)},{metric:"Content-Type",value:t.contentType||"N/A"},{metric:"Content-Disposition",value:t.contentDisposition||"N/A"},{metric:"Modified",value:t.modified.toISOString()},{metric:"URL",value:t.url}],O=k(j,b,"object-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(O),p(e,{bucket:f,key:n})}export{I as default};
@@ -1,4 +1,4 @@
1
- import{a as K,b as w,d as l,e as d}from"../../chunk-AFM3TY2D.js";import{e as C}from"../../chunk-7ZCVOA6A.js";import{d as b}from"../../chunk-WJLB362D.js";import{a as o,b as I,c as V}from"../../chunk-S6KFKBMY.js";import{b as a}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as u,e as x,j as v}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{listVersions as D}from"@tigrisdata/storage";var i=v("objects","list-versions");async function O(s){p(i);let k=o(s,["bucket"]),z=o(s,["prefix","p","P"]),m=o(s,["delimiter","d"]),c=o(s,["key-marker","keyMarker"]),f=o(s,["version-id-marker","versionIdMarker"]),g=I(s),{limit:y}=V(s);k||a(i,"Bucket name is required");let M=C(k),P=M.bucket,S=z||M.path||void 0,j=await b(),{data:r,error:h}=await D({prefix:S,...m?{delimiter:m}:{},...y!==void 0?{limit:y}:{},...c?{keyMarker:c}:{},...f?{versionIdMarker:f}:{},config:{...j,bucket:P}});h&&a(i,h);let t=r.versions.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",size:K(e.size),modified:e.lastModified})),n=r.deleteMarkers.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",modified:e.lastModified})),L=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],T=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"modified",header:"Modified"}];if(g==="json")console.log(w({versions:r.versions,deleteMarkers:r.deleteMarkers,commonPrefixes:r.commonPrefixes,nextKeyMarker:r.nextKeyMarker,nextVersionIdMarker:r.nextVersionIdMarker,hasMore:r.hasMore}));else if(g==="xml"){let e=["<listVersions>"];e.push(" "+l(t,"versions","version").replace(/\n/g,`
1
+ import{a as K,b as w,d as l,e as d}from"../../chunk-AFM3TY2D.js";import{e as C}from"../../chunk-7ZCVOA6A.js";import{e as b}from"../../chunk-5UQUUFCL.js";import{a as o,b as I,c as V}from"../../chunk-S6KFKBMY.js";import{b as a}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as p,c as u,e as x,j as v}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{listVersions as D}from"@tigrisdata/storage";var i=v("objects","list-versions");async function O(s){p(i);let k=o(s,["bucket"]),z=o(s,["prefix","p","P"]),m=o(s,["delimiter","d"]),c=o(s,["key-marker","keyMarker"]),f=o(s,["version-id-marker","versionIdMarker"]),g=I(s),{limit:y}=V(s);k||a(i,"Bucket name is required");let M=C(k),P=M.bucket,S=z||M.path||void 0,j=await b(),{data:r,error:h}=await D({prefix:S,...m?{delimiter:m}:{},...y!==void 0?{limit:y}:{},...c?{keyMarker:c}:{},...f?{versionIdMarker:f}:{},config:{...j,bucket:P}});h&&a(i,h);let t=r.versions.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",size:K(e.size),modified:e.lastModified})),n=r.deleteMarkers.map(e=>({key:e.name,versionId:e.versionId,latest:e.isLatest?"yes":"",modified:e.lastModified})),L=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],T=[{key:"key",header:"Key"},{key:"versionId",header:"Version ID"},{key:"latest",header:"Latest"},{key:"modified",header:"Modified"}];if(g==="json")console.log(w({versions:r.versions,deleteMarkers:r.deleteMarkers,commonPrefixes:r.commonPrefixes,nextKeyMarker:r.nextKeyMarker,nextVersionIdMarker:r.nextVersionIdMarker,hasMore:r.hasMore}));else if(g==="xml"){let e=["<listVersions>"];e.push(" "+l(t,"versions","version").replace(/\n/g,`
2
2
  `)),e.push(" "+l(n,"deleteMarkers","deleteMarker").replace(/\n/g,`
3
3
  `)),e.push("</listVersions>"),console.log(e.join(`
4
4
  `))}else{if(t.length===0&&n.length===0){x(i);return}if(t.length>0&&(console.log(`
@@ -1 +1 @@
1
- import{a as T,g as w}from"../../chunk-AFM3TY2D.js";import{e as S}from"../../chunk-7ZCVOA6A.js";import{d as P}from"../../chunk-WJLB362D.js";import{a as e,b as j,c as z}from"../../chunk-S6KFKBMY.js";import{b as s}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as h,e as b,i as y,j as x}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{list as q}from"@tigrisdata/storage";var n=x("objects","list");async function v(t){l(n);let a=e(t,["bucket"]),O=e(t,["prefix","p","P"]),i=j(t),c=e(t,["snapshot-version","snapshotVersion","snapshot"]),f=e(t,["source"]),{limit:m,pageToken:p}=z(t);a||s(n,"Bucket name is required");let g=S(a),A=g.bucket,E=O||g.path||void 0,F=await P(),{data:o,error:d}=await q({prefix:E,...c?{snapshotVersion:c}:{},...f?{source:f}:{},...m!==void 0?{limit:m}:{},...p?{paginationToken:p}:{},config:{...F,bucket:A}});if(d&&s(n,d),!o.items||o.items.length===0){b(n);return}let u=o.items.map(r=>({key:r.name,size:T(r.size),modified:r.lastModified})),M=[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],k=o.paginationToken||void 0,V=w(u,i,"objects","object",M,{paginationToken:k});console.log(V),i!=="json"&&i!=="xml"&&y(k),h(n,{count:u.length})}export{v as default};
1
+ import{a as T,g as w}from"../../chunk-AFM3TY2D.js";import{e as S}from"../../chunk-7ZCVOA6A.js";import{e as P}from"../../chunk-5UQUUFCL.js";import{a as e,b as j,c as z}from"../../chunk-S6KFKBMY.js";import{b as s}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as l,c as h,e as b,i as y,j as x}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{list as q}from"@tigrisdata/storage";var n=x("objects","list");async function v(t){l(n);let a=e(t,["bucket"]),O=e(t,["prefix","p","P"]),i=j(t),c=e(t,["snapshot-version","snapshotVersion","snapshot"]),f=e(t,["source"]),{limit:m,pageToken:p}=z(t);a||s(n,"Bucket name is required");let g=S(a),A=g.bucket,E=O||g.path||void 0,F=await P(),{data:o,error:d}=await q({prefix:E,...c?{snapshotVersion:c}:{},...f?{source:f}:{},...m!==void 0?{limit:m}:{},...p?{paginationToken:p}:{},config:{...F,bucket:A}});if(d&&s(n,d),!o.items||o.items.length===0){b(n);return}let u=o.items.map(r=>({key:r.name,size:T(r.size),modified:r.lastModified})),M=[{key:"key",header:"Key"},{key:"size",header:"Size"},{key:"modified",header:"Modified"}],k=o.paginationToken||void 0,V=w(u,i,"objects","object",M,{paginationToken:k});console.log(V),i!=="json"&&i!=="xml"&&y(k),h(n,{count:u.length})}export{v as default};
@@ -1 +1 @@
1
- import{a as R}from"../../chunk-EKW6XTGL.js";import{a as A}from"../../chunk-HPICBIXL.js";import{a as s,f as v}from"../../chunk-AFM3TY2D.js";import{h as j}from"../../chunk-7ZCVOA6A.js";import{d as w}from"../../chunk-WJLB362D.js";import{a as n,b as z}from"../../chunk-S6KFKBMY.js";import{b as i,d as T}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as k,c as S,j as h}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.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 R}from"../../chunk-EKW6XTGL.js";import{a as A}from"../../chunk-HPICBIXL.js";import{a as s,f as v}from"../../chunk-AFM3TY2D.js";import{h as j}from"../../chunk-7ZCVOA6A.js";import{e as w}from"../../chunk-5UQUUFCL.js";import{a as n,b as z}from"../../chunk-S6KFKBMY.js";import{b as i,d as T}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as k,c as S,j as h}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{createReadStream as E,statSync as M}from"fs";import{Readable as $}from"stream";import{put as N}from"@tigrisdata/storage";var t=h("objects","put");async function Y(r){k(t);let u=n(r,["bucket"]),l=n(r,["key"]),y=n(r,["file"]),C=n(r,["access","a","A"],"private"),O=n(r,["content-type","contentType","t","T"]),P=z(r);u||i(t,"Bucket name or path is required");let d=j(u),m=d.bucket,a=d.key||l,e=d.key&&l||y;a||i(t,"Object key is required");let q=!process.stdin.isTTY;!e&&!q&&i(t,"File path is required (or pipe data via stdin)");let f,o;if(e){try{o=M(e).size}catch{i(t,`File not found: ${e}`)}let p=E(e);f=$.toWeb(p)}else f=$.toWeb(process.stdin);let U=await w({withCredentialProvider:!0}),x=e?R(o):{multipart:!0,partSize:5*1024*1024,queueSize:8},F=O??(e?A(e):void 0),{data:c,error:g}=await N(a,f,{access:C==="public"?"public":"private",contentType:F,...x,onUploadProgress:({loaded:p,percentage:b})=>{o!==void 0&&o>0?process.stdout.write(`\rUploading: ${s(p)} / ${s(o)} (${b}%)`):process.stdout.write(`\rUploading: ${s(p)}`)},config:{...U,bucket:m}});process.stdout.write(`\r${" ".repeat(60)}\r`),g&&i(t,g);let W=[{path:c.path,size:s(c.size??o??0),contentType:c.contentType||"-",modified:c.modified}],B=v(W,P,"objects","object",[{key:"path",header:"Path"},{key:"size",header:"Size"},{key:"contentType",header:"Content-Type"},{key:"modified",header:"Modified"}]);console.log(B),S(t,{key:a,bucket:m}),T(t,{key:a,bucket:m})}export{Y as default};
@@ -1 +1 @@
1
- import{f as v}from"../../chunk-AFM3TY2D.js";import{h as y}from"../../chunk-7ZCVOA6A.js";import{d}from"../../chunk-WJLB362D.js";import{a as n,b as k}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-GWPU2O5X.js";import"../../chunk-AWVF3WSN.js";import"../../chunk-BLUJHGMR.js";import"../../chunk-DV3LCXRH.js";import{b as u,c as g,e as p,j as l}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-VNUR4TRP.js";import"../../chunk-F4AGJWCK.js";import{getRestoreInfo as x}from"@tigrisdata/storage";var t=l("objects","restore-info");async function A(r){u(t);let s=k(r),c=n(r,["bucket"]),S=n(r,["key"]),a=n(r,["version-id","versionId"]);c||i(t,"Bucket name or path is required");let{bucket:f,key:e}=y(c,S);e||i(t,"Object key is required");let b=await d(),{data:o,error:m}=await x(e,{...a?{versionId:a}:{},config:{...b,bucket:f}});if(m&&i(t,m),!o){s==="json"?console.log(JSON.stringify({status:null})):p(t);return}let O=[{metric:"Path",value:e},{metric:"Status",value:o.status},...o.expiresAt?[{metric:"Expires",value:o.expiresAt.toISOString()}]:[]],h=v(O,s,"restore-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(h),g(t,{bucket:f,key:e})}export{A as default};
1
+ import{f as y}from"../../chunk-AFM3TY2D.js";import{h as v}from"../../chunk-7ZCVOA6A.js";import{e as h}from"../../chunk-5UQUUFCL.js";import{a as e,b as d}from"../../chunk-S6KFKBMY.js";import{b as i}from"../../chunk-B7CB3ST5.js";import"../../chunk-2XSEQJGZ.js";import"../../chunk-HWAEADX7.js";import"../../chunk-DV3LCXRH.js";import{b as g,c as p,e as l,j as k}from"../../chunk-D7WXNA2O.js";import"../../chunk-NI4EYBQH.js";import"../../chunk-6ZZ54RU7.js";import"../../chunk-J3MAV7JB.js";import"../../chunk-F4AGJWCK.js";import{getRestoreInfo as A}from"@tigrisdata/storage";var t=k("objects","restore-info");async function I(r){g(t);let n=d(r),c=e(r,["bucket"]),S=e(r,["key"]),a=e(r,["version-id","versionId"]),f=e(r,["snapshot-version","snapshotVersion","snapshot"]);c||i(t,"Bucket name or path is required");let{bucket:m,key:o}=v(c,S);o||i(t,"Object key is required");let b=await h(),{data:s,error:u}=await A(o,{...a?{versionId:a}:{},...f?{snapshotVersion:f}:{},config:{...b,bucket:m}});if(u&&i(t,u),!s){n==="json"?console.log(JSON.stringify({status:null})):l(t);return}let O=[{metric:"Path",value:o},{metric:"Status",value:s.status},...s.expiresAt?[{metric:"Expires",value:s.expiresAt.toISOString()}]:[]],x=y(O,n,"restore-info","info",[{key:"metric",header:"Metric"},{key:"value",header:"Value"}]);console.log(x),p(t,{bucket:m,key:o})}export{I as default};