@redocly/cli 2.53.2 → 2.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +1 -1
  2. package/lib/chunks/{T376AHHQ.js → 23QBFBKB.js} +1 -1
  3. package/lib/chunks/{IMWIJK4I.js → 2MBZI3W3.js} +2 -1
  4. package/lib/chunks/2TLIBL23.js +8 -0
  5. package/lib/chunks/{Q3LFOSXJ.js → 3BQA72CL.js} +1 -1
  6. package/lib/chunks/{FKRGYVXD.js → 3JLKV64R.js} +1 -1
  7. package/lib/chunks/3RDMQ5CQ.js +13 -0
  8. package/lib/chunks/{4BCUUE3J.js → 4563NK6K.js} +1 -1
  9. package/lib/chunks/{7GYVSRCX.js → 5U5KA4QB.js} +1 -1
  10. package/lib/chunks/7IULUVWX.js +13 -0
  11. package/lib/chunks/AHGQ4BNI.js +30 -0
  12. package/lib/chunks/ALXOGCUM.js +8 -0
  13. package/lib/chunks/AM6FT7EB.js +9 -0
  14. package/lib/chunks/{53VK4LV5.js → B2NEPS53.js} +485 -473
  15. package/lib/chunks/{HY6IF56V.js → BV3FDR6T.js} +1 -1
  16. package/lib/chunks/{LGWICMQK.js → C22B72S6.js} +1 -1
  17. package/lib/chunks/{6ER74AF4.js → CI4NGJ3I.js} +3 -3
  18. package/lib/chunks/{JA4LTWW3.js → CR75HYUP.js} +1 -1
  19. package/lib/chunks/{BVF3GEBD.js → DZ3BIL7B.js} +1 -1
  20. package/lib/chunks/{EFVXVP5M.js → ELMWD5XU.js} +1 -1
  21. package/lib/chunks/{NU76FSGR.js → EQF3XONE.js} +1 -1
  22. package/lib/chunks/{RGJTOYYC.js → EVZXABWY.js} +1 -1
  23. package/lib/chunks/{R2EWSE4Z.js → FFUSN7JK.js} +1 -1
  24. package/lib/chunks/FOLQQTQP.js +19 -0
  25. package/lib/chunks/{CXNOQVEB.js → FTDJMTRX.js} +1 -1
  26. package/lib/chunks/{HE2DJR6Y.js → FTTM5CU5.js} +1 -1
  27. package/lib/chunks/{BNWXU2OA.js → FUCJM4CG.js} +1 -1
  28. package/lib/chunks/{Z57CXIHX.js → G2C7YJ5D.js} +1 -1
  29. package/lib/chunks/{YLZS72LY.js → G6ES3GTP.js} +1 -1
  30. package/lib/chunks/{RD64AQAZ.js → GV5K7EMH.js} +1 -1
  31. package/lib/chunks/H4XURXR7.js +47 -0
  32. package/lib/chunks/{GM5FQCWY.js → IW2J6X26.js} +4 -4
  33. package/lib/chunks/{RI6WFA4F.js → KEF4233Y.js} +6 -6
  34. package/lib/chunks/{LUCPX66E.js → KIVK5WD5.js} +1 -1
  35. package/lib/chunks/{NPD4SXEI.js → L24E6ZRY.js} +4 -4
  36. package/lib/chunks/LLGJ3YMR.js +85 -0
  37. package/lib/chunks/{UZQGV3C7.js → MLHMLZ6D.js} +2 -2
  38. package/lib/chunks/QZBHV7SD.js +7 -0
  39. package/lib/chunks/{UWKKXZOE.js → RW2ESAIF.js} +80 -80
  40. package/lib/chunks/{QJ4W6N5P.js → RZ4WANMS.js} +1 -1
  41. package/lib/chunks/{3BIPHQGZ.js → SGZ5GYE3.js} +1 -1
  42. package/lib/chunks/{KQUR5LDF.js → SK6F5TET.js} +1 -1
  43. package/lib/chunks/{ZBW2UTL4.js → T5U6O5KC.js} +1 -1
  44. package/lib/chunks/TZMWTSOQ.js +7 -0
  45. package/lib/chunks/{WEAET3FR.js → UIQNT772.js} +1 -1
  46. package/lib/chunks/{DQLEE5LL.js → VFDSXLTV.js} +1 -1
  47. package/lib/chunks/VTKYS75A.js +13 -0
  48. package/lib/chunks/XRZ5NMQ5.js +13 -0
  49. package/lib/chunks/Y6E4JAM3.js +16 -0
  50. package/lib/chunks/{GJKYTFLY.js → YDSFHQXH.js} +3 -3
  51. package/lib/chunks/{I4EFNEXU.js → YZIILRDN.js} +1 -1
  52. package/lib/chunks/{BSAURQIG.js → ZBHEZTGU.js} +1 -1
  53. package/lib/chunks/ZBK7SJHM.js +7 -0
  54. package/lib/chunks/ZDQDZTQ7.js +7 -0
  55. package/lib/chunks/{FPOO3NKZ.js → ZLOWCBYN.js} +1 -1
  56. package/lib/eject-assets/generators/cli/docs.ts +1 -1
  57. package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
  58. package/lib/eject-assets/generators/cli/index.ts +2 -2
  59. package/lib/eject-assets/generators/cli/render.ts +1 -1
  60. package/lib/eject-assets/generators/go/client.ts +1 -1
  61. package/lib/eject-assets/generators/go/descriptor.ts +1 -1
  62. package/lib/eject-assets/generators/go/index.ts +2 -2
  63. package/lib/eject-assets/generators/go/models.ts +1 -1
  64. package/lib/eject-assets/generators/go/naming.ts +1 -1
  65. package/lib/eject-assets/generators/go/operations.ts +1 -1
  66. package/lib/eject-assets/generators/go/pagination.ts +1 -1
  67. package/lib/eject-assets/generators/go/types.ts +1 -1
  68. package/lib/eject-assets/generators/mock/faker.ts +1 -1
  69. package/lib/eject-assets/generators/mock/index.ts +2 -2
  70. package/lib/eject-assets/generators/mock/render.ts +1 -1
  71. package/lib/eject-assets/generators/mock/sample.ts +1 -1
  72. package/lib/eject-assets/generators/mock/values.ts +1 -1
  73. package/lib/eject-assets/generators/php/client.ts +1 -1
  74. package/lib/eject-assets/generators/php/descriptor.ts +1 -1
  75. package/lib/eject-assets/generators/php/index.ts +2 -2
  76. package/lib/eject-assets/generators/php/models.ts +1 -1
  77. package/lib/eject-assets/generators/php/naming.ts +1 -1
  78. package/lib/eject-assets/generators/php/operations.ts +1 -1
  79. package/lib/eject-assets/generators/php/pagination.ts +1 -1
  80. package/lib/eject-assets/generators/php/types.ts +1 -1
  81. package/lib/eject-assets/generators/python/client.ts +1 -1
  82. package/lib/eject-assets/generators/python/descriptor.ts +1 -1
  83. package/lib/eject-assets/generators/python/index.ts +2 -2
  84. package/lib/eject-assets/generators/python/models.ts +1 -1
  85. package/lib/eject-assets/generators/python/naming.ts +1 -1
  86. package/lib/eject-assets/generators/python/operations.ts +1 -1
  87. package/lib/eject-assets/generators/python/pagination.ts +1 -1
  88. package/lib/eject-assets/generators/python/types.ts +1 -1
  89. package/lib/eject-assets/generators/swr/index.ts +2 -2
  90. package/lib/eject-assets/generators/swr/render.ts +1 -1
  91. package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
  92. package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
  93. package/lib/eject-assets/generators/transformers/index.ts +2 -2
  94. package/lib/eject-assets/generators/transformers/render.ts +1 -1
  95. package/lib/eject-assets/generators/typescript/banner.ts +1 -1
  96. package/lib/eject-assets/generators/typescript/client.ts +1 -1
  97. package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
  98. package/lib/eject-assets/generators/typescript/index.ts +2 -2
  99. package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
  100. package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
  101. package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
  102. package/lib/eject-assets/generators/typescript/operations.ts +1 -1
  103. package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
  104. package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
  105. package/lib/eject-assets/generators/typescript/types.ts +1 -1
  106. package/lib/eject-assets/generators/zod/index.ts +2 -2
  107. package/lib/eject-assets/generators/zod/schemas.ts +1 -1
  108. package/lib/index.js +157 -276
  109. package/package.json +1 -1
  110. package/lib/chunks/32XCOMOR.js +0 -7
  111. package/lib/chunks/6LHYZTIP.js +0 -48
  112. package/lib/chunks/KXHIHQWX.js +0 -13
  113. package/lib/chunks/OFAMJNQ6.js +0 -7
  114. package/lib/chunks/P26PQ2RU.js +0 -7
  115. package/lib/chunks/R6Q6FO6R.js +0 -14
  116. package/lib/chunks/RS5PUOTT.js +0 -18
  117. package/lib/chunks/SCWHIBJL.js +0 -22
  118. package/lib/chunks/SP5G6SN2.js +0 -7
  119. package/lib/chunks/T226COGJ.js +0 -19
  120. package/lib/chunks/WV7XOOFD.js +0 -7
@@ -1,14 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __pathDirname } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- var __filename = __fileURLToPath(import.meta.url);
6
- var __dirname = __pathDirname(__filename);
7
- import{W as d,ja as I}from"./UWKKXZOE.js";function O(e){let t=e.trim(),o=t.match(/^```(?:ya?ml|json)?\s*\n([\s\S]*?)\n```$/);return o?o[1]:t}async function M(e,t){let r=(await I({source:e,config:t})).filter(n=>n.severity==="error");if(r.length>0){let n=r.slice(0,5).map(s=>`${s.ruleId}: ${s.message}`).join("; ");throw new Error(`the result has ${r.length} validation problem(s): ${n}`)}}import{spawn as C}from"node:child_process";import{mkdtemp as S}from"node:fs/promises";import{tmpdir as R}from"node:os";import N from"node:path";var $=3e5,m=class extends Error{},v;function b(){return v??=S(N.join(R(),"redocly-ai-")),v}async function w(e,t,o,r){let n=await b();return new Promise((s,a)=>{let i=C(e,t,{stdio:["pipe","pipe","pipe"],cwd:n,env:{...process.env,...r}}),u="",h="",g=!1,l=setTimeout(()=>{g=!0,i.kill("SIGKILL")},$);i.stdout.on("data",c=>{u+=c.toString()}),i.stderr.on("data",c=>{h+=c.toString()}),i.on("error",c=>{if(clearTimeout(l),c.code==="ENOENT"){a(new m(`Could not find the "${e}" CLI on PATH. Is it installed?`));return}a(c)}),i.on("close",c=>{if(clearTimeout(l),g){a(new Error(`The "${e}" CLI did not respond within ${$/1e3} seconds.`));return}s({stdout:u,stderr:h,code:c})}),i.stdin.on("error",()=>{}),i.stdin.end(o)})}async function A(e){let t=["-p","--output-format","text","--tools","","--strict-mcp-config","--setting-sources","","--no-session-persistence","--append-system-prompt",e.system];e.model&&t.push("--model",e.model);let{stdout:o,stderr:r,code:n}=await w("claude",t,e.user,{CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:"1"});if(n!==0)throw new Error(`claude CLI exited with code ${n}: ${r.trim()||o.trim()}`);if(!o.trim())throw new Error("claude CLI returned no output.");return{text:o}}async function F(e){let t=["exec","--skip-git-repo-check","--sandbox","read-only","-c","mcp_servers={}","-c","project_doc_max_bytes=0"];e.model&&t.push("--model",e.model),t.push("-");let o=`${e.system}
8
-
9
- ${e.user}`,{stdout:r,stderr:n,code:s}=await w("codex",t,o);if(s!==0)throw new Error(`codex CLI exited with code ${s}: ${n.trim()||r.trim()}`);if(!r.trim())throw new Error("codex CLI returned no output.");return{text:r}}async function _(e){let t=["-p","--output-format","text","--trust"];e.model&&t.push("--model",e.model);let o=`${e.system}
10
-
11
- ${e.user}`,r;try{r=await w("cursor-agent",t,o)}catch(i){if(!(i instanceof m))throw i;try{r=await w("agent",t,o)}catch(u){throw u instanceof m?new m('Could not find the Cursor CLI ("cursor-agent" or "agent") on PATH. Is it installed?'):u}}let{stdout:n,stderr:s,code:a}=r;if(a!==0)throw new Error(`cursor CLI exited with code ${a}: ${s.trim()||n.trim()}`);if(!n.trim())throw new Error("cursor CLI returned no output.");return{text:n}}async function W(e,t){switch(e){case"claude":return A(t);case"codex":return F(t);case"cursor":return _(t);default:throw new Error(`Unknown AI provider: ${e}`)}}import*as x from"node:process";var L=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],y=class{frames;currentFrame;intervalId;message;constructor(){this.frames=L,this.currentFrame=0,this.intervalId=null,this.message=""}showFrame(){d.info("\r"+this.frames[this.currentFrame]+" "+this.message),this.currentFrame=(this.currentFrame+1)%this.frames.length}start(t){if(this.message!==t){if(this.message=t,!x.stderr.isTTY){d.info(`${t}...
12
- `);return}this.intervalId===null&&(this.intervalId=setInterval(()=>{this.showFrame()},100))}}stop(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null,d.info("\r")),this.message=""}};function P(e){e.stop(),x.stderr.isTTY&&d.info("\x1B[2K")}function E(e,t){let[o]=t.inFlight;if(!o)return;let r=t.inFlight.size>1?` (+${t.inFlight.size-1} more)`:"";e.start(`[${t.position}/${t.total}] ${t.action} ${o}${r}`)}async function V(e){let{items:t}=e,o=new Array(t.length).fill(null),r=new y,n=new Set,s=0,a=0,i=!1,u=()=>E(r,{action:e.action,inFlight:n,position:s+1,total:t.length}),h=async()=>{for(;!i&&a<t.length;){let l=a++,c=t[l],p=e.label(c),T=Date.now();n.add(p),u();try{o[l]=await e.run(c,l),s+=1,n.delete(p),P(r),d.info(`[${s}/${t.length}] ${p} \u2014 ${e.successNote} (${Math.round((Date.now()-T)/1e3)}s)
13
- `)}catch(f){if(s+=1,n.delete(p),P(r),f instanceof m)throw i=!0,f;d.warn(`[${s}/${t.length}] ${p} \u2014 ${e.failureNote}: ${f instanceof Error?f.message:String(f)}
14
- `)}u()}},g=Math.max(1,Math.min(e.concurrency,t.length));for(let l of await Promise.allSettled(Array.from({length:g},h)))if(l.status==="rejected")throw l.reason;return o}var Z=["get","put","post","delete","options","head","patch","trace","query"],q=["schemas","responses","parameters","examples","headers","requestBodies","links","callbacks","securitySchemes"];export{O as a,M as b,W as c,y as d,P as e,V as f,Z as g,q as h};
@@ -1,18 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __pathDirname } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- var __filename = __fileURLToPath(import.meta.url);
6
- var __dirname = __pathDirname(__filename);
7
- import{a as ye}from"./32XCOMOR.js";import{a as m,c as O}from"./RFWIIJFG.js";var V=O((ot,Q)=>{var M=1e3,N=M*60,q=N*60,A=q*24,ge=A*7,be=A*365.25;Q.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return me(e);if(t==="number"&&isFinite(e))return r.long?_e(e):ve(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function me(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var t=parseFloat(r[1]),n=(r[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*be;case"weeks":case"week":case"w":return t*ge;case"days":case"day":case"d":return t*A;case"hours":case"hour":case"hrs":case"hr":case"h":return t*q;case"minutes":case"minute":case"mins":case"min":case"m":return t*N;case"seconds":case"second":case"secs":case"sec":case"s":return t*M;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function ve(e){var r=Math.abs(e);return r>=A?Math.round(e/A)+"d":r>=q?Math.round(e/q)+"h":r>=N?Math.round(e/N)+"m":r>=M?Math.round(e/M)+"s":e+"ms"}function _e(e){var r=Math.abs(e);return r>=A?$(e,r,A,"day"):r>=q?$(e,r,q,"hour"):r>=N?$(e,r,N,"minute"):r>=M?$(e,r,M,"second"):e+" ms"}function $(e,r,t,n){var s=r>=t*1.5;return Math.round(e/t)+" "+n+(s?"s":"")}});var G=O((it,X)=>{function we(e){t.debug=t,t.default=t,t.coerce=S,t.disable=C,t.enable=s,t.enabled=y,t.humanize=V(),t.destroy=x,Object.keys(e).forEach(o=>{t[o]=e[o]}),t.names=[],t.skips=[],t.formatters={};function r(o){let i=0;for(let c=0;c<o.length;c++)i=(i<<5)-i+o.charCodeAt(c),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=r;function t(o){let i,c=null,a,v;function l(...d){if(!l.enabled)return;let F=l,_=Number(new Date),j=_-(i||_);F.diff=j,F.prev=i,F.curr=_,i=_,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let P=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(E,I)=>{if(E==="%%")return"%";P++;let K=t.formatters[I];if(typeof K=="function"){let Ce=d[P];E=K.call(F,Ce),d.splice(P,1),P--}return E}),t.formatArgs.call(F,d),(F.log||t.log).apply(F,d)}return l.namespace=o,l.useColors=t.useColors(),l.color=t.selectColor(o),l.extend=n,l.destroy=t.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>c!==null?c:(a!==t.namespaces&&(a=t.namespaces,v=t.enabled(o)),v),set:d=>{c=d}}),typeof t.init=="function"&&t.init(l),l}function n(o,i){let c=t(this.namespace+(typeof i>"u"?":":i)+o);return c.log=this.log,c}function s(o){t.save(o),t.namespaces=o,t.names=[],t.skips=[];let i=(typeof o=="string"?o:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let c of i)c[0]==="-"?t.skips.push(c.slice(1)):t.names.push(c)}function u(o,i){let c=0,a=0,v=-1,l=0;for(;c<o.length;)if(a<i.length&&(i[a]===o[c]||i[a]==="*"))i[a]==="*"?(v=a,l=c,a++):(c++,a++);else if(v!==-1)a=v+1,l++,c=l;else return!1;for(;a<i.length&&i[a]==="*";)a++;return a===i.length}function C(){let o=[...t.names,...t.skips.map(i=>"-"+i)].join(",");return t.enable(""),o}function y(o){for(let i of t.skips)if(u(o,i))return!1;for(let i of t.names)if(u(o,i))return!0;return!1}function S(o){return o instanceof Error?o.stack||o.message:o}function x(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}X.exports=we});var Y=O((p,L)=>{p.formatArgs=Oe;p.save=Se;p.load=Pe;p.useColors=Fe;p.storage=xe();p.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();p.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Fe(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Oe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+L.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(n=t))}),e.splice(n,0,r)}p.log=console.debug||console.log||(()=>{});function Se(e){try{e?p.storage.setItem("debug",e):p.storage.removeItem("debug")}catch{}}function Pe(){let e;try{e=p.storage.getItem("debug")||p.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function xe(){try{return localStorage}catch{}}L.exports=G()(p);var{formatters:je}=L.exports;je.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var te=O((f,H)=>{var Ee=m("tty"),T=m("util");f.init=De;f.log=Ne;f.formatArgs=Ie;f.save=qe;f.load=Be;f.useColors=Ae;f.destroy=T.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");f.colors=[6,2,3,4,5,1];try{let e=ye();e&&(e.stderr||e).level>=2&&(f.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}f.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,r)=>{let t=r.substring(6).toLowerCase().replace(/_([a-z])/g,(s,u)=>u.toUpperCase()),n=process.env[r];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[t]=n,e},{});function Ae(){return"colors"in f.inspectOpts?!!f.inspectOpts.colors:Ee.isatty(process.stderr.fd)}function Ie(e){let{namespace:r,useColors:t}=this;if(t){let n=this.color,s="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${s};1m${r} \x1B[0m`;e[0]=u+e[0].split(`
8
- `).join(`
9
- `+u),e.push(s+"m+"+H.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Me()+r+" "+e[0]}function Me(){return f.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ne(...e){return process.stderr.write(T.formatWithOptions(f.inspectOpts,...e)+`
10
- `)}function qe(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function Be(){return process.env.DEBUG}function De(e){e.inspectOpts={};let r=Object.keys(f.inspectOpts);for(let t=0;t<r.length;t++)e.inspectOpts[r[t]]=f.inspectOpts[r[t]]}H.exports=G()(f);var{formatters:ee}=H.exports;ee.o=function(e){return this.inspectOpts.colors=this.useColors,T.inspect(e,this.inspectOpts).split(`
11
- `).map(r=>r.trim()).join(" ")};ee.O=function(e){return this.inspectOpts.colors=this.useColors,T.inspect(e,this.inspectOpts)}});var W=O((ct,J)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?J.exports=Y():J.exports=te()});var se=O(h=>{"use strict";var ke=h&&h.__createBinding||(Object.create?(function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}):(function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]})),$e=h&&h.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}):function(e,r){e.default=r}),re=h&&h.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&ke(r,e,t);return $e(r,e),r};Object.defineProperty(h,"__esModule",{value:!0});h.req=h.json=h.toBuffer=void 0;var Le=re(m("http")),Te=re(m("https"));async function ne(e){let r=0,t=[];for await(let n of e)r+=n.length,t.push(n);return Buffer.concat(t,r)}h.toBuffer=ne;async function He(e){let t=(await ne(e)).toString("utf8");try{return JSON.parse(t)}catch(n){let s=n;throw s.message+=` (input: ${t})`,s}}h.json=He;function Re(e,r={}){let n=((typeof e=="string"?e:e.href).startsWith("https:")?Te:Le).request(e,r),s=new Promise((u,C)=>{n.once("response",u).once("error",C).end()});return n.then=s.then.bind(s),n}h.req=Re});var ue=O(g=>{"use strict";var ie=g&&g.__createBinding||(Object.create?(function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}):(function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]})),Ue=g&&g.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}):function(e,r){e.default=r}),ce=g&&g.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&ie(r,e,t);return Ue(r,e),r},ze=g&&g.__exportStar||function(e,r){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t)&&ie(r,e,t)};Object.defineProperty(g,"__esModule",{value:!0});g.Agent=void 0;var Ge=ce(m("net")),oe=ce(m("http")),Je=m("https");ze(se(),g);var w=Symbol("AgentBaseInternalState"),Z=class extends oe.Agent{constructor(r){super(r),this[w]={}}isSecureEndpoint(r){if(r){if(typeof r.secureEndpoint=="boolean")return r.secureEndpoint;if(typeof r.protocol=="string")return r.protocol==="https:"}let{stack:t}=new Error;return typeof t!="string"?!1:t.split(`
12
- `).some(n=>n.indexOf("(https.js:")!==-1||n.indexOf("node:https:")!==-1)}incrementSockets(r){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[r]||(this.sockets[r]=[]);let t=new Ge.Socket({writable:!1});return this.sockets[r].push(t),this.totalSocketCount++,t}decrementSockets(r,t){if(!this.sockets[r]||t===null)return;let n=this.sockets[r],s=n.indexOf(t);s!==-1&&(n.splice(s,1),this.totalSocketCount--,n.length===0&&delete this.sockets[r])}getName(r){return this.isSecureEndpoint(r)?Je.Agent.prototype.getName.call(this,r):super.getName(r)}createSocket(r,t,n){let s={...t,secureEndpoint:this.isSecureEndpoint(t)},u=this.getName(s),C=this.incrementSockets(u);Promise.resolve().then(()=>this.connect(r,s)).then(y=>{if(this.decrementSockets(u,C),y instanceof oe.Agent)try{return y.addRequest(r,s)}catch(S){return n(S)}this[w].currentSocket=y,super.createSocket(r,t,n)},y=>{this.decrementSockets(u,C),n(y)})}createConnection(){let r=this[w].currentSocket;if(this[w].currentSocket=void 0,!r)throw new Error("No socket was returned in the `connect()` function");return r}get defaultPort(){return this[w].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(r){this[w]&&(this[w].defaultPort=r)}get protocol(){return this[w].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(r){this[w]&&(this[w].protocol=r)}};g.Agent=Z});var ae=O(B=>{"use strict";var We=B&&B.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(B,"__esModule",{value:!0});B.parseProxyResponse=void 0;var Ze=We(W()),R=(0,Ze.default)("https-proxy-agent:parse-proxy-response");function Ke(e){return new Promise((r,t)=>{let n=0,s=[];function u(){let o=e.read();o?x(o):e.once("readable",u)}function C(){e.removeListener("end",y),e.removeListener("error",S),e.removeListener("readable",u)}function y(){C(),R("onend"),t(new Error("Proxy connection ended before receiving CONNECT response"))}function S(o){C(),R("onerror %o",o),t(o)}function x(o){s.push(o),n+=o.length;let i=Buffer.concat(s,n),c=i.indexOf(`\r
13
- \r
14
- `);if(c===-1){R("have not received end of HTTP headers yet..."),u();return}let a=i.slice(0,c).toString("ascii").split(`\r
15
- `),v=a.shift();if(!v)return e.destroy(),t(new Error("No header received from proxy CONNECT response"));let l=v.split(" "),d=+l[1],F=l.slice(2).join(" "),_={};for(let j of a){if(!j)continue;let P=j.indexOf(":");if(P===-1)return e.destroy(),t(new Error(`Invalid header from proxy CONNECT response: "${j}"`));let k=j.slice(0,P).toLowerCase(),E=j.slice(P+1).trimStart(),I=_[k];typeof I=="string"?_[k]=[I,E]:Array.isArray(I)?I.push(E):_[k]=E}R("got proxy server response: %o %o",v,_),C(),r({connect:{statusCode:d,statusText:F,headers:_},buffered:i})}e.on("error",S),e.on("end",y),u()})}B.parseProxyResponse=Ke});var st=O(b=>{"use strict";var Qe=b&&b.__createBinding||(Object.create?(function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}):(function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]})),Ve=b&&b.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}):function(e,r){e.default=r}),pe=b&&b.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&Qe(r,e,t);return Ve(r,e),r},he=b&&b.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(b,"__esModule",{value:!0});b.HttpsProxyAgent=void 0;var U=pe(m("net")),fe=pe(m("tls")),Xe=he(m("assert")),Ye=he(W()),et=ue(),tt=m("url"),rt=ae(),D=(0,Ye.default)("https-proxy-agent"),le=e=>e.servername===void 0&&e.host&&!U.isIP(e.host)?{...e,servername:e.host}:e,z=class extends et.Agent{constructor(r,t){super(t),this.options={path:void 0},this.proxy=typeof r=="string"?new tt.URL(r):r,this.proxyHeaders=t?.headers??{},D("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),s=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...t?de(t,"headers"):null,host:n,port:s}}async connect(r,t){let{proxy:n}=this;if(!t.host)throw new TypeError('No "host" provided');let s;n.protocol==="https:"?(D("Creating `tls.Socket`: %o",this.connectOpts),s=fe.connect(le(this.connectOpts))):(D("Creating `net.Socket`: %o",this.connectOpts),s=U.connect(this.connectOpts));let u=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},C=U.isIPv6(t.host)?`[${t.host}]`:t.host,y=`CONNECT ${C}:${t.port} HTTP/1.1\r
16
- `;if(n.username||n.password){let c=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;u["Proxy-Authorization"]=`Basic ${Buffer.from(c).toString("base64")}`}u.Host=`${C}:${t.port}`,u["Proxy-Connection"]||(u["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let c of Object.keys(u))y+=`${c}: ${u[c]}\r
17
- `;let S=(0,rt.parseProxyResponse)(s);s.write(`${y}\r
18
- `);let{connect:x,buffered:o}=await S;if(r.emit("proxyConnect",x),this.emit("proxyConnect",x,r),x.statusCode===200)return r.once("socket",nt),t.secureEndpoint?(D("Upgrading socket connection to TLS"),fe.connect({...de(le(t),"host","path","port"),socket:s})):s;s.destroy();let i=new U.Socket({writable:!1});return i.readable=!0,r.once("socket",c=>{D("Replaying proxy buffer for failed request"),(0,Xe.default)(c.listenerCount("data")>0),c.push(o),c.push(null)}),i}};z.protocols=["http","https"];b.HttpsProxyAgent=z;function nt(e){e.resume()}function de(e,...r){let t={},n;for(n in e)r.includes(n)||(t[n]=e[n]);return t}});export{st as a};
@@ -1,22 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __pathDirname } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- var __filename = __fileURLToPath(import.meta.url);
6
- var __dirname = __pathDirname(__filename);
7
- import{a as O}from"./RS5PUOTT.js";import{a as I}from"./BXI4SF2U.js";import{c as p}from"./P26PQ2RU.js";import{a as R}from"./LUCPX66E.js";import{O as T,Q as w,W as a}from"./UWKKXZOE.js";import{e as C}from"./RFWIIJFG.js";import{Buffer as P}from"node:buffer";import y from"node:crypto";import{mkdirSync as j,existsSync as F,writeFileSync as q,readFileSync as z,rmSync as M}from"node:fs";import{homedir as H}from"node:os";import B from"node:path";var l={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function G(){return process.env.REDOCLY_DOMAIN||l.us}var U=D((o,e)=>{try{let t=e||o?.resolvedConfig.residency;return W(t)?l[t]:t?new URL(t).origin:o?.resolvedConfig.scorecard?.fromProjectUrl?new URL(o.resolvedConfig.scorecard.fromProjectUrl).origin:l.us}catch{throw new f}});function x(o){try{U(void 0,o)}catch{return!1}return!0}function D(o){return(...e)=>{let t=o(...e);if(!t.startsWith("https://"))throw new f;return t}}var f=class extends Error{constructor(){super("Invalid Reunite URL")}};function W(o){return typeof o=="string"&&o in l}import*as k from"node:child_process";var g=C(I(),1);var N=C(O(),1);function b(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function S(o){let e=process.env.NO_PROXY||process.env.no_proxy;if(!e)return!1;let t=e.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);if(t.length===0)return!1;let r;try{r=new URL(o).hostname.toLowerCase()}catch{return!1}return t.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var _=async(o,{timeout:e,...t}={})=>{let r=b(),s=r&&!S(o),n,i=e?{connect:{timeout:e}}:{};return s?n=new g.ProxyAgent({uri:r,...i}):e&&(n=new g.Agent(i)),await fetch(o,{signal:e?AbortSignal.timeout(e):void 0,...t,dispatcher:n})};var c=class extends Error{constructor(t,r){super(t);this.status=r}status},h=class{constructor(e){this.command=e}command;sunsetWarnings=[];async request(e,t){let r={...t.headers,"user-agent":`redocly-cli/${R} ${this.command}`};try{let s=await _(e,{...t,headers:r});return this.collectSunsetWarning(s),s}catch(s){let n="Failed to fetch.";throw s.cause&&(n+=` Caused by ${s.cause.message||s.cause.name}.`),(s.code||s.cause?.code)&&(n+=` Code: ${s.code||s.cause?.code}`),new Error(n)}}collectSunsetWarning(e){let t=this.getSunsetDate(e);if(!t)return;let r=new Date(t);t>Date.now()?this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!1}):this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!0})}getSunsetDate(e){let{headers:t}=e;if(!t)return;let r=t.get("sunset")||t.get("Sunset");if(r)return Date.parse(r)}},v=class{constructor(e,t,r){this.client=e;this.domain=t;this.apiKey=r}client;domain;apiKey;async getParsedResponse(e){let t=await e.json();if(e.ok)return t;throw new c(`${t.title||e.statusText||"Unknown error"}.`,e.status)}async getDefaultBranch(e,t){try{let r=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/source`,{timeout:p,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return(await this.getParsedResponse(r)).branchName}catch(r){let s=`Failed to fetch default branch. ${r.message}`;throw r instanceof c?new c(s,r.status):new Error(s)}}async upsert(e,t,r){try{let s=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/remotes`,{timeout:p,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let n=`Failed to upsert remote. ${s.message}`;throw s instanceof c?new c(n,s.status):new Error(n)}}async push(e,t,r,s){let n=new globalThis.FormData;n.append("remoteId",r.remoteId),n.append("commit[message]",r.commit.message),n.append("commit[author][name]",r.commit.author.name),n.append("commit[author][email]",r.commit.author.email),n.append("commit[branchName]",r.commit.branchName),r.commit.url&&n.append("commit[url]",r.commit.url),r.commit.namespace&&n.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&n.append("commit[sha]",r.commit.sha),r.commit.repository&&n.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&n.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let u=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await L(i.stream)]);n.append(`files[${i.path}]`,u,i.path)}r.isMainBranch&&n.append("isMainBranch","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/pushes`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:n});return await this.getParsedResponse(i)}catch(i){let u=`Failed to push. ${i.message}`;throw i instanceof c?new c(u,i.status):new Error(u)}}async getRemotesList({organizationId:e,projectId:t,mountPath:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/remotes?filter=mountPath:/${r}/`,{timeout:p,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get remote list. ${s.message}`;throw s instanceof c?new c(n,s.status):new Error(n)}}async getPush({organizationId:e,projectId:t,pushId:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${e}/projects/${t}/pushes/${r}`,{timeout:p,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get push status. ${s.message}`;throw s instanceof c?new c(n,s.status):new Error(n)}}},$=class{apiClient;command;remotes;constructor({domain:e,apiKey:t,command:r}){this.command=r,this.apiClient=new h(this.command),this.remotes=new v(this.apiClient,e,t)}reportSunsetWarnings(){let e=this.apiClient.sunsetWarnings;if(e.length){let[{isSunsetExpired:t,sunsetDate:r}]=e.sort((n,i)=>n.isSunsetExpired!==i.isSunsetExpired?n.isSunsetExpired?-1:1:n.sunsetDate>i.sunsetDate?1:-1),s='Update to the latest version by running "npm install @redocly/cli@latest".';t?a.error(`The "${this.command}" command is not compatible with your version of Redocly CLI. ${s}
8
-
9
- `):a.warn(`The "${this.command}" command will be incompatible with your version of Redocly CLI after ${r.toLocaleString()}. ${s}
10
-
11
- `)}}};async function L(o){let e=[];for await(let t of o)e.push(t);return Buffer.concat(e)}var d=class{constructor(e){this.baseUrl=e;this.apiClient=new h("login")}baseUrl;apiClient;clientName="redocly-cli";async run(){let e=await this.getDeviceCode();a.output(`Attempting to automatically open the SSO authorization page in your default browser.
12
- `),a.output(`If the browser does not open or you wish to use a different device to authorize this request, open the following URL:
13
-
14
- `),a.output(w(e.verificationUri)),a.output(`
15
-
16
- `),a.output(`Then enter the code:
17
-
18
- `),a.output(w(e.userCode)),a.output(`
19
-
20
- `),this.openBrowser(e.verificationUriComplete);let t=await this.pollingAccessToken(e.deviceCode,e.interval,e.expiresIn);return a.output(T(`\u2705 Logged in
21
-
22
- `)),this.withResidency(t)}openBrowser(e){try{let t=process.platform==="win32"?`start ${e}`:process.platform==="darwin"?`open ${e}`:`xdg-open ${e}`;k.execSync(t)}catch{}}async verifyToken(e){try{return!!(await this.sendRequest("/session","GET",void 0,{Cookie:`accessToken=${e};`})).user}catch{return!1}}async verifyApiKey(e){try{return!!(await this.sendRequest("/api-keys-verify","POST",{apiKey:e})).success}catch{return!1}}async refreshToken(e){let t=await this.sendRequest("/device-rotate-token","POST",{grant_type:"refresh_token",client_name:this.clientName,refresh_token:e});if(!t.access_token)throw new Error("Failed to refresh token");return this.withResidency({access_token:t.access_token,refresh_token:t.refresh_token,expires_in:t.expires_in})}async pollingAccessToken(e,t,r){return new Promise((s,n)=>{let i=setInterval(async()=>{let m=await this.getAccessToken(e);m.access_token&&(clearInterval(i),clearTimeout(u),s(m)),m.error&&m.error!=="authorization_pending"&&(clearInterval(i),clearTimeout(u),n(m.error_description))},t*1e3),u=setTimeout(async()=>{clearInterval(i),clearTimeout(u),n("Authorization has expired. Please try again.")},r*1e3)})}async getAccessToken(e){return await this.sendRequest("/device-token","POST",{client_name:this.clientName,device_code:e,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})}async getDeviceCode(){let{device_code:e,user_code:t,verification_uri:r,verification_uri_complete:s,interval:n=10,expires_in:i=300}=await this.sendRequest("/device-authorize","POST",{client_name:this.clientName});return{deviceCode:e,userCode:t,verificationUri:r,verificationUriComplete:s,interval:n,expiresIn:i}}async sendRequest(e,t="GET",r=void 0,s={}){let n=`${this.baseUrl}/api${e}`,i=await this.apiClient.request(n,{body:r&&JSON.stringify(r),method:t,headers:{"Content-Type":"application/json",...s},timeout:p});return i.status===204?{success:!0}:await i.json()}withResidency(e){return{...e,residency:this.baseUrl}}};var K="4618dbc9-8aed-4e27-aaf0-225f4603e5a4",A="aes-256-cbc",E=class{credentialsFolderPath;credentialsFilePath;credentialsFileName;key;iv;constructor(){let e=H();this.credentialsFolderPath=B.join(e,".redocly"),this.credentialsFileName="credentials",this.credentialsFilePath=B.join(this.credentialsFolderPath,this.credentialsFileName),this.key=y.createHash("sha256").update(`${this.credentialsFolderPath}${K}`).digest(),this.iv=y.createHash("md5").update(this.credentialsFolderPath).digest(),j(this.credentialsFolderPath,{recursive:!0})}async login(e){let r=await new d(e).run();if(!r)throw new Error("Failed to login. No credentials received.");this.saveCredentials(r)}async logout(){try{this.removeCredentials()}catch{}}async isAuthorized(e,t){return t?new d(e).verifyApiKey(t):!!await this.getAccessToken(e)}getAccessToken=async e=>{let t=new d(e),r=await this.readCredentials();if(!r||!x(e)||r.residency&&r.residency!==e)return null;if(await t.verifyToken(r.access_token))return r.access_token;try{let n=await t.refreshToken(r.refresh_token);return await this.saveCredentials(n),n.access_token}catch{return null}};async saveCredentials(e){try{let t=this.encryptCredentials(e);q(this.credentialsFilePath,t,"utf8")}catch(t){a.error(`Failed to save credentials: ${t.message}`)}}async readCredentials(){if(!F(this.credentialsFilePath))return null;try{let e=z(this.credentialsFilePath,"utf8");return this.decryptCredentials(e)}catch{return null}}async removeCredentials(){F(this.credentialsFilePath)&&M(this.credentialsFilePath)}encryptCredentials(e){let t=y.createCipheriv(A,this.key,this.iv);return P.concat([t.update(JSON.stringify(e),"utf8"),t.final()]).toString("hex")}decryptCredentials(e){let t=y.createDecipheriv(A,this.key,this.iv),r=P.concat([t.update(P.from(e,"hex")),t.final()]);return JSON.parse(r.toString("utf8"))}};export{G as a,U as b,b as c,S as d,_ as e,c as f,$ as g,E as h};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __pathDirname } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- var __filename = __fileURLToPath(import.meta.url);
6
- var __dirname = __pathDirname(__filename);
7
- import{h as a}from"./SCWHIBJL.js";import"./RS5PUOTT.js";import"./BXI4SF2U.js";import"./32XCOMOR.js";import"./P26PQ2RU.js";import"./LUCPX66E.js";import"./UWKKXZOE.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as RedoclyOAuthClient};