@tigrisdata/cli 3.13.0 → 3.15.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 (131) hide show
  1. package/README.md +49 -2
  2. package/dist/auth/fly.js +1 -1
  3. package/dist/auth/iam.js +1 -1
  4. package/dist/auth/provider.js +1 -1
  5. package/dist/browser/index.d.ts +2 -0
  6. package/dist/browser/index.js +236 -168
  7. package/dist/{chunk-453SVRXR.js → chunk-5PRP4WIP.js} +1 -1
  8. package/dist/{chunk-IA7SF576.js → chunk-63ICBOUH.js} +1 -1
  9. package/dist/chunk-ABDWDZNK.js +4 -0
  10. package/dist/{chunk-VSUYES3O.js → chunk-ADAR26VB.js} +1 -1
  11. package/dist/{chunk-EOCLTUJ4.js → chunk-APVIWSSE.js} +1 -1
  12. package/dist/{chunk-VFRTC4TW.js → chunk-DRJKJJTI.js} +1 -1
  13. package/dist/{chunk-Y4FIJDZ4.js → chunk-IPX5O5QV.js} +1 -1
  14. package/dist/chunk-JAMXQOFK.js +5 -0
  15. package/dist/chunk-MFL7AQSM.js +1 -0
  16. package/dist/{chunk-KKSYGHZK.js → chunk-N4JKUGYV.js} +1 -1
  17. package/dist/chunk-PG24JJVL.js +3 -0
  18. package/dist/chunk-Q4FK2FUN.js +7 -0
  19. package/dist/chunk-QVE2LNUP.js +4 -0
  20. package/dist/{chunk-DBLI36XY.js → chunk-RG2RS6I2.js} +1 -1
  21. package/dist/{chunk-IOTP5CCJ.js → chunk-WLVPRZUS.js} +1 -1
  22. package/dist/{chunk-PHN3GNLG.js → chunk-XHWJQENK.js} +1 -1
  23. package/dist/{chunk-FVHGLZAE.js → chunk-YUDS5YFV.js} +1 -1
  24. package/dist/{chunk-P2MUSPB4.js → chunk-YYAHTLYM.js} +1 -1
  25. package/dist/{chunk-TZ7BKFW5.js → chunk-ZVFVCCLB.js} +1 -1
  26. package/dist/cli-core.js +1 -1
  27. package/dist/cli.js +1 -1
  28. package/dist/help.js +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/lib/access-keys/assign.js +1 -1
  31. package/dist/lib/access-keys/attach-policy.js +1 -1
  32. package/dist/lib/access-keys/create.js +1 -1
  33. package/dist/lib/access-keys/delete.js +1 -1
  34. package/dist/lib/access-keys/detach-policy.js +1 -1
  35. package/dist/lib/access-keys/get.js +1 -1
  36. package/dist/lib/access-keys/list-policies.js +1 -1
  37. package/dist/lib/access-keys/list.js +1 -1
  38. package/dist/lib/access-keys/roles.js +1 -1
  39. package/dist/lib/access-keys/rotate.js +1 -1
  40. package/dist/lib/buckets/create.js +1 -1
  41. package/dist/lib/buckets/delete.js +1 -1
  42. package/dist/lib/buckets/disable-snapshots.js +1 -1
  43. package/dist/lib/buckets/enable-snapshots.js +1 -1
  44. package/dist/lib/buckets/get.js +1 -1
  45. package/dist/lib/buckets/lifecycle/create.js +1 -1
  46. package/dist/lib/buckets/lifecycle/edit.js +1 -1
  47. package/dist/lib/buckets/lifecycle/list.js +1 -1
  48. package/dist/lib/buckets/lifecycle/shared.js +1 -1
  49. package/dist/lib/buckets/list.js +1 -1
  50. package/dist/lib/buckets/merge.js +1 -1
  51. package/dist/lib/buckets/migrate.js +1 -1
  52. package/dist/lib/buckets/rebase.js +1 -1
  53. package/dist/lib/buckets/restore.js +1 -1
  54. package/dist/lib/buckets/set-cors.js +1 -1
  55. package/dist/lib/buckets/set-locations.js +1 -1
  56. package/dist/lib/buckets/set-migration.js +1 -1
  57. package/dist/lib/buckets/set-notifications.js +1 -1
  58. package/dist/lib/buckets/set.js +1 -1
  59. package/dist/lib/buckets/share.js +1 -1
  60. package/dist/lib/bundle.js +1 -1
  61. package/dist/lib/configure/index.js +1 -1
  62. package/dist/lib/cp.js +1 -1
  63. package/dist/lib/credentials/test.js +1 -1
  64. package/dist/lib/iam/policies/create.js +1 -1
  65. package/dist/lib/iam/policies/delete.js +1 -1
  66. package/dist/lib/iam/policies/edit.js +1 -1
  67. package/dist/lib/iam/policies/get.js +1 -1
  68. package/dist/lib/iam/policies/link-key.js +1 -1
  69. package/dist/lib/iam/policies/list-keys.js +1 -1
  70. package/dist/lib/iam/policies/list.js +1 -1
  71. package/dist/lib/iam/policies/select-policy.js +1 -1
  72. package/dist/lib/iam/policies/unlink-key.js +1 -1
  73. package/dist/lib/iam/teams/create.js +1 -1
  74. package/dist/lib/iam/teams/edit.js +1 -1
  75. package/dist/lib/iam/teams/list.js +1 -1
  76. package/dist/lib/iam/teams/shared.js +1 -1
  77. package/dist/lib/iam/users/invite.js +1 -1
  78. package/dist/lib/iam/users/list.js +1 -1
  79. package/dist/lib/iam/users/remove.js +1 -1
  80. package/dist/lib/iam/users/revoke-invitation.js +1 -1
  81. package/dist/lib/iam/users/update-role.js +1 -1
  82. package/dist/lib/login/credentials.js +1 -1
  83. package/dist/lib/login/oauth.js +1 -1
  84. package/dist/lib/login/select.js +1 -1
  85. package/dist/lib/logout.js +1 -1
  86. package/dist/lib/ls.js +1 -1
  87. package/dist/lib/mk.js +1 -1
  88. package/dist/lib/mv.js +1 -1
  89. package/dist/lib/objects/delete.js +1 -1
  90. package/dist/lib/objects/get.js +1 -1
  91. package/dist/lib/objects/info.js +1 -1
  92. package/dist/lib/objects/list-versions.js +1 -1
  93. package/dist/lib/objects/list.js +1 -1
  94. package/dist/lib/objects/purge.js +1 -1
  95. package/dist/lib/objects/put.js +1 -1
  96. package/dist/lib/objects/restore-deleted.js +1 -1
  97. package/dist/lib/objects/restore-info.js +1 -1
  98. package/dist/lib/objects/restore.js +1 -1
  99. package/dist/lib/objects/set-access.js +1 -1
  100. package/dist/lib/objects/set.js +1 -1
  101. package/dist/lib/organizations/create.js +1 -1
  102. package/dist/lib/organizations/delete.js +5 -0
  103. package/dist/lib/organizations/list.js +1 -1
  104. package/dist/lib/organizations/select.js +1 -1
  105. package/dist/lib/presign.js +1 -1
  106. package/dist/lib/rm.js +1 -1
  107. package/dist/lib/snapshots/delete.js +1 -1
  108. package/dist/lib/snapshots/list.js +1 -1
  109. package/dist/lib/snapshots/take.js +1 -1
  110. package/dist/lib/stat.js +1 -1
  111. package/dist/lib/telemetry/disable.js +1 -1
  112. package/dist/lib/telemetry/enable.js +1 -1
  113. package/dist/lib/telemetry/status.js +1 -1
  114. package/dist/lib/touch.js +1 -1
  115. package/dist/lib/update.js +1 -1
  116. package/dist/lib/usage.js +3 -0
  117. package/dist/lib/whoami.js +1 -1
  118. package/dist/specs.yaml +67 -5
  119. package/dist/utils/analytics.js +1 -1
  120. package/dist/utils/bucket-info.js +1 -1
  121. package/dist/utils/exit.js +1 -1
  122. package/dist/utils/format.js +1 -1
  123. package/dist/utils/telemetry.js +1 -1
  124. package/dist/utils/update-check.js +1 -1
  125. package/package.json +3 -3
  126. package/dist/chunk-AFM3TY2D.js +0 -7
  127. package/dist/chunk-JF2D6OZD.js +0 -4
  128. package/dist/chunk-KJBSIIND.js +0 -4
  129. package/dist/chunk-QCASVW5M.js +0 -3
  130. package/dist/chunk-RZMWZYTK.js +0 -1
  131. package/dist/chunk-ZC272QWP.js +0 -5
@@ -1,4 +0,0 @@
1
- var T="Usage: ",I="Options:",C="Global Options:",h="Commands:",d=t=>`\x1B[1m${t}\x1B[22m`,W=t=>`\x1B[2m${t}\x1B[22m`,A=new WeakMap;function H(t,n){A.set(t,n)}function x(t){return`${t}:`}function D(t,n){let s=i=>{let e=n.indexOf(i);return e===-1?n.length:e};return[...t].sort(([i],[e])=>s(i)-s(e))}function M(t){let n=t.helpText??t.description??"";if(t.deprecated){let i=t.replaced_by?` Use ${t.replaced_by} instead.`:"";n=`(deprecated) ${n}${i}`}let s=[];if(t.required&&t.type!=="positional"&&s.push("required"),t.options&&t.options.length>0){let i=t.options.map(e=>typeof e=="string"?e:e.value);s.push(`options: ${i.join(", ")}`)}return t.default!==void 0&&t.type!=="flag"&&s.push(`default: ${t.default}`),s.length===0?n:n?`${n} [${s.join("; ")}]`:`[${s.join("; ")}]`}function _(t){let n=[];for(let s=t;s;s=s.parent)n.unshift(s.name());return n.join(" ")}function $(t,n){return t.replace(/\n/g,`
2
- ${" ".repeat(n)}`)}var S={minWidthToWrap:20,subcommandTerm(t){return t.name()},optionTerm(t){return t.flags.startsWith("--")?` ${t.flags}`:t.flags},styleTitle:d,styleSubcommandTerm:d,styleOptionTerm:d,styleArgumentTerm:d,styleDescriptionText(t){return t.replace(/ \[(?:required|options: |default: )[^\]]*\]$/,n=>W(n))},optionDescription(t){return t.description},argumentDescription(t){return t.description},commandUsage(t){let n=[_(t)];this.visibleOptions(t).length>0&&n.push("[options]"),this.visibleCommands(t).length>0&&n.push("[command]");for(let s of t.registeredArguments){let i=`${s.name()}${s.variadic?"...":""}`;n.push(s.required?`<${i}>`:`[${i}]`)}return n.join(" ")},formatItem(t,n,s,i){let e=" ".repeat(2);if(!s)return`${e}${t}`;let m=i.helpWidth??80,a=2+n+2,p=m-a<28,c=p?10:a,u=$(i.boxWrap(s,Math.max(m-c,20)),c);if(p||i.displayWidth(t)>n)return`${e}${t}
3
- ${" ".repeat(c)}${u}`;let g=" ".repeat(n-i.displayWidth(t)+2);return`${e}${t}${g}${u}`},formatHelp(t,n){let s=n.helpWidth??80,i=A.get(t)??{},e=[],m=o=>Math.min(Math.max(0,...o.map(([r])=>n.displayWidth(r))),30),a=(o,r,O=m(r))=>{r.length!==0&&e.push(n.styleTitle(o),...r.map(([b,y])=>n.formatItem(b,O,y,n)),"")},p=o=>[n.styleSubcommandTerm(n.subcommandTerm(o)),n.styleSubcommandDescription(n.subcommandDescription(o))],c=o=>[n.styleOptionTerm(n.optionTerm(o)),n.styleOptionDescription(n.optionDescription(o))];e.push(`${n.styleTitle(T.trimEnd())} ${$(n.boxWrap(n.commandUsage(t),s-T.length),T.length)}`,"");let u=n.commandDescription(t);u&&e.push(n.boxWrap(u,s),"");let g=t.aliases();g.length>0&&e.push(n.styleTitle("Aliases:"),`${" ".repeat(2)}${[t.name(),...g].join(", ")}`,"");let l=n.visibleCommands(t),N=m(l.map(p)),E=this.groupItems(t.commands,l,o=>o.helpGroup()||h);for(let[o,r]of D(E,(i.groups??[]).map(x)))a(o,r.map(p),N);a("Arguments:",n.visibleArguments(t).map(o=>[n.styleArgumentTerm(n.argumentTerm(o)),n.styleArgumentDescription(n.argumentDescription(o))]));let f=this.groupItems(t.options,n.visibleOptions(t),o=>o.helpGroupHeading??I);i.globalOptions&&f.set(C,i.globalOptions);for(let[o,r]of D(f,[I]))a(o,r.map(c));return i.examples&&i.examples.length>0&&e.push(n.styleTitle("Examples:"),...i.examples.map(o=>`${" ".repeat(2)}${o}`),""),l.length>0&&e.push(n.boxWrap(`Use "${_(t)} [command] --help" for more information about a command.`,s),""),e.join(`
4
- `)}};export{I as a,C as b,H as c,x as d,M as e,S as f};
@@ -1,4 +0,0 @@
1
- import{i as o}from"./chunk-F4AGJWCK.js";function i(t){return o()?.startsWith("flyio_")?(console.log(`${t} is not available for Fly.io organizations.
2
- Your resources are managed through Fly.io.
3
-
4
- Visit https://fly.io to manage your organization.`),!0):!1}export{i as a};
@@ -1,3 +0,0 @@
1
- import{e as b}from"./chunk-VFRTC4TW.js";import{a as _}from"./chunk-DBLI36XY.js";import{c as S,d as I,e as R}from"./chunk-453SVRXR.js";import{h as A}from"./chunk-D7WXNA2O.js";import{b as E}from"./chunk-DV3LCXRH.js";import{a as H,b as L,c as x,d as g,e as h,f as D}from"./chunk-JF2D6OZD.js";import{Command as z,Option as V}from"commander";function y(e,o,n,a,i){let s=e[e.length-1],t=typeof s=="object"&&s!==null&&"args"in s?s.args:e.filter(l=>typeof l=="string");if(t.length===0)return t;let m=t[0],u=(o.commands??[]).filter(l=>v(l,[...n,l.name],i));if(!new Set(u.flatMap(l=>[l.name,...Array.isArray(l.alias)?l.alias:l.alias?[l.alias]:[]])).has(m)){let l=u.map(p=>p.name),d=n.length>0?`'${m}' for '${n.join(" ")}'`:`'${m}'`;console.error(`Unknown command ${d}.`),l.length>0&&console.error(`Available commands: ${l.join(", ")}`);let f=n.length>0?`${a.name} ${n.join(" ")} help`:`${a.name} help`;console.error(`
2
- Run "${f}" for usage.`),process.exit(1)}return t}function P(){S();let e=!1,o=async n=>{e&&process.exit(1),e=!0,I(n,{crash:!0,exitCode:E(n).exitCode}),await R(),_(n,void 0,{skipCapture:!0})};process.on("unhandledRejection",n=>{(n===""||n===void 0)&&(console.error(`
3
- Operation cancelled`),process.exit(1)),o(n)}),process.on("uncaughtException",n=>{o(n)})}function F(e){return/^[a-zA-Z0-9_-]+$/.test(e)}function v(e,o,n){return e.removed||n(o)?!0:e.commands?e.commands.some(a=>v(a,[...o,a.name],n)):!1}function N(e,o){let n=o?` Use ${o} instead.`:" See the changelog for migration guidance.";console.error(`${e} was removed in this version.${n}`),process.exit(1)}function G(e,o){if(e)for(let n of e){if(!n.removed)continue;C(o,n.name,e)!==void 0&&N(`--${n.name}`,n.replaced_by)}}function j(e,o){let n=o??[],a=new Set(n.map(t=>t.name)),i=new Set(n.filter(t=>t.alias).map(t=>t.alias)),s=e.filter(t=>!a.has(t.name)&&!(t.alias&&i.has(t.alias)));return[...n,...s]}function $(e){let o=e.alias&&typeof e.alias=="string"&&e.alias.length===1,n=e.alias&&typeof e.alias=="string"&&e.alias.length>1,a=o?`-${e.alias}, --${e.name}`:n?`--${e.alias}, --${e.name}`:`--${e.name}`;return e.type==="flag"?a:e.type==="boolean"?`${a} [value]`:e.options?`${a} <value>`:e.required||e["required-when"]?`${a} <value>`:`${a} [value]`}function q(e,o=[],n=[]){let a=s=>n.findIndex(t=>t.name===s.name);[...o.filter(s=>a(s)===-1),...o.filter(s=>a(s)!==-1).sort((s,t)=>a(s)-a(t))].forEach(s=>{if(s.type==="positional"){let t=s.required?`<${s.name}>`:`[${s.name}]`;e.argument(t,h(s))}else s.removed||s.hidden?e.addOption(new V($(s),s.description??"").hideHelp()):(n.length>0&&e.optionsGroup(a(s)===-1?H:L),e.option($(s),h(s),s.default))})}function K(e){return e.replace(/-([a-z])/g,(o,n)=>n.toUpperCase())}function C(e,o,n){if(n){let i=n.find(s=>s.name===o);if(i?.alias&&typeof i.alias=="string"){let s=i.alias.charAt(0).toUpperCase()+i.alias.slice(1);if(e[s]!==void 0)return e[s]}}let a=[o,o.replace(/-/g,""),o.replace(/-/g,"").toLowerCase(),o.charAt(0).toUpperCase(),K(o)];for(let i of a)if(e[i]!==void 0)return e[i]}function T(e,o){for(let n of e){if(n["required-when"]){let[a,i]=n["required-when"].split("="),s=C(o,a,e),t=C(o,n.name,e);if(s===i&&!t)return console.error(`--${n.name} is required when --${a} is ${i}`),!1}if(n.required&&!C(o,n.name,e))return console.error(`--${n.name} is required`),n.description&&console.error(` ${n.description}`),!1}return!0}function M(e,o,n){let a;"optsWithGlobals"in n&&typeof n.optsWithGlobals=="function"?a=n.optsWithGlobals():"opts"in n&&typeof n.opts=="function"?a=n.opts():a=n;let i={...a};return e.filter(t=>t.type==="positional").forEach((t,m)=>{o[m]!==void 0&&(t.multiple?i[t.name]=o[m].split(",").map(r=>r.trim()):i[t.name]=o[m])}),e.forEach(t=>{t.multiple&&t.type!=="positional"&&i[t.name]&&typeof i[t.name]=="string"&&(i[t.name]=i[t.name].split(",").map(m=>m.trim()))}),i}async function U(e,o,n=[],a={}){(a.json||a.format==="json")&&(globalThis.__TIGRIS_JSON_MODE=!0);let{module:i,error:s}=await e(o);(s||!i)&&(console.error(s),process.exit(1));let t=o[o.length-1],m=i.default||i[t];typeof m!="function"&&(console.error(`Command not implemented: ${o.join(" ")}`),process.exit(1)),b(o),await m({...a,_positional:n})}function W(e,o,n,a=[]){let{specs:i,loadModule:s,hasImplementation:t}=e,m=i.definitions?.global_arguments??[];for(let r of n){F(r.name)||(console.error(`Invalid command name "${r.name}": only alphanumeric, hyphens, and underscores allowed`),process.exit(1));let u=[...a,r.name];if(!v(r,u,t))continue;let c=o.command(r.name,r.removed?{hidden:!0}:void 0).description(r.description??"").summary(r.helpText??"");if(r.group&&c.helpGroup(g(r.group)),x(c,{examples:r.examples,groups:r.groups}),r.alias&&(Array.isArray(r.alias)?r.alias:[r.alias]).forEach(d=>{c.alias(d)}),r.removed){c.allowUnknownOption(!0),c.allowExcessArguments(!0),c.action(()=>{N(`${i.name} ${u.join(" ")}`,r.replaced_by)});continue}if(r.commands&&r.commands.length>0)if(W(e,c,r.commands,u),r.default){let l=r.commands.find(d=>d.name===r.default);if(l){let d=j(m,[...r.arguments||[],...l.arguments||[]]);q(c,d,m),c.allowExcessArguments(!0),c.action(async(...f)=>{let p=f.pop(),k=y([p],r,u,i,t),w=M(d,k,p);d.length>0&&!T(d,w)&&process.exit(1),G(d,w),l.deprecated&&l.messages?.onDeprecated&&A(l.messages.onDeprecated),await U(s,[...u,l.name],k,w)})}}else c.allowExcessArguments(!0),c.action((...l)=>{y(l,r,u,i,t),c.outputHelp()});else q(c,j(m,r.arguments),m),c.action(async(...l)=>{let d=l.pop(),f=l,p=M(r.arguments||[],f,d);r.arguments&&!T(r.arguments,p)&&process.exit(1),G(r.arguments,p),r.deprecated&&r.messages?.onDeprecated&&A(r.messages.onDeprecated),await U(s,u,f,p)});c.command("help",{hidden:!0}).action(()=>{c.outputHelp()})}}function ee(e){let{specs:o,version:n,hasImplementation:a}=e,i=new z;i.name(o.name).description(o.description).version(n,"-V, --version","Show the CLI version").helpOption("-h, --help","Show help").configureHelp(D),W(e,i,o.commands);let s=(o.definitions?.global_arguments??[]).filter(u=>!u.removed).map(u=>new V($(u),h(u)));x(i,{groups:o.groups,globalOptions:s});let t=o.groups?.[o.groups.length-1],m=i.command("help").description("Show general help").action(()=>{i.outputHelp()}),r=i.command("version").description("Show the CLI version").action(()=>{console.log(n)});return t&&(m.helpGroup(g(t)),r.helpGroup(g(t))),i.allowExcessArguments(!0),i.action((...u)=>{y(u,{commands:o.commands},[],o,a),i.outputHelp()}),i}export{P as a,F as b,v as c,q as d,T as e,M as f,W as g,ee as h};
@@ -1 +0,0 @@
1
- var s="3.13.0";export{s as a};
@@ -1,5 +0,0 @@
1
- import{a as s,b as d,c as g}from"./chunk-QPUL2AAI.js";import{a as E,d as A}from"./chunk-HBEO4D3T.js";import{i as c,j as f,k as p,l as i,p as u}from"./chunk-F4AGJWCK.js";import{fromIni as _}from"@aws-sdk/credential-providers";function r(){return process.env.AWS_ENDPOINT_URL_S3||process.env.AWS_ENDPOINT_URL_IAM?{endpoint:process.env.AWS_ENDPOINT_URL_S3||s,iamEndpoint:process.env.AWS_ENDPOINT_URL_IAM||d,mgmtEndpoint:process.env.AWS_ENDPOINT_URL_MGMT||g}:{endpoint:process.env.TIGRIS_STORAGE_ENDPOINT||s,iamEndpoint:process.env.TIGRIS_IAM_ENDPOINT||d,mgmtEndpoint:process.env.TIGRIS_MGMT_ENDPOINT||g}}function K(){let e=process.env.TIGRIS_FORCE_PATH_STYLE?.trim().toLowerCase();return e==="1"||e==="true"||e==="yes"||e==="on"}function a(){if(process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY){let e=process.env.AWS_ENDPOINT_URL_S3||s;return{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,endpoint:e,source:"aws"}}if(process.env.TIGRIS_STORAGE_ACCESS_KEY_ID&&process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY){let e=process.env.TIGRIS_STORAGE_ENDPOINT||s;return{accessKeyId:process.env.TIGRIS_STORAGE_ACCESS_KEY_ID,secretAccessKey:process.env.TIGRIS_STORAGE_SECRET_ACCESS_KEY,endpoint:e,source:"tigris"}}return null}var l=!1;function P(){l=!1}async function T(){if(l||!process.stdin.isTTY)return!1;l=!0,console.log(`Not authenticated. Starting login...
2
- `);let{default:e}=await import("./lib/login/select.js");return await e({}),console.log(),!0}async function I(){if(f()){let o=process.env.AWS_PROFILE||"default",y=await _({profile:o})();return{type:"aws-profile",profile:o,accessKeyId:y.accessKeyId,secretAccessKey:y.secretAccessKey}}let e=a();if(e)return{type:"environment",accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,source:e.source};let n=u();if(n==="oauth")return{type:"oauth"};if(n==="credentials"){let o=i();if(o)return{type:"credentials",accessKeyId:o.accessKeyId,secretAccessKey:o.secretAccessKey}}let t=i();return t?{type:"configured",accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey}:{type:"none"}}async function m(e){let n=await S(e);return K()?{...n,forcePathStyle:!0}:n}async function N(){let e=await I(),n=r();switch(e.type){case"aws-profile":{let t=await p(e.profile);return{storage:t.endpoint||n.endpoint||s,iam:t.iamEndpoint||n.iamEndpoint}}case"credentials":case"configured":return{storage:i()?.endpoint||s,iam:n.iamEndpoint};case"environment":return{storage:a()?.endpoint||s,iam:n.iamEndpoint};default:return{storage:n.endpoint,iam:n.iamEndpoint}}}async function S(e){let n=await I();switch(n.type){case"aws-profile":{let t=await p(n.profile);return{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey,endpoint:t.endpoint||r().endpoint||s,iamEndpoint:t.iamEndpoint||r().iamEndpoint}}case"oauth":{let t=A(),o=c();if(!o)throw new Error('No organization selected. Please run "tigris orgs select" first.');return{sessionToken:await t.getAccessToken(),accessKeyId:"",secretAccessKey:"",...e?.withCredentialProvider&&{credentialProvider:async()=>({accessKeyId:"",secretAccessKey:"",sessionToken:await t.getAccessToken(),expiration:new Date(Date.now()+600*1e3)})},endpoint:r().endpoint,organizationId:o,iamEndpoint:r().iamEndpoint,authDomain:E().domain}}case"credentials":{let t=c();return{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey,endpoint:i()?.endpoint||s,organizationId:t??void 0,iamEndpoint:r().iamEndpoint}}case"environment":return{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey,endpoint:a()?.endpoint||s};case"configured":{let t=c();return{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey,endpoint:i()?.endpoint||s,organizationId:t??void 0,iamEndpoint:r().iamEndpoint}}case"none":{if(await T())return S(e);throw new Error('Not authenticated. Please run "tigris login" or "tigris configure" first.')}}}async function O(){let e=await m(),n=c();return{...e,...n&&!e.organizationId?{organizationId:n}:{}}}function R(e){return u()==="oauth"?!1:(a()||i()?console.log(`You are using access key credentials, which belong to a single organization.
3
- ${e} is only available with OAuth login.
4
-
5
- Run "tigris login" to login with your Tigris account.`):console.log('Not authenticated. Please run "tigris login" to login with your Tigris account.'),!0)}export{r as a,K as b,a as c,P as d,I as e,m as f,N as g,O as h,R as i};