diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c76888a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,29 @@ +version: 2 +updates: + - package-ecosystem: npm + directory: "/" + schedule: + interval: weekly + groups: + npm: + patterns: + - "*" + ignore: + - dependency-name: node-fetch + versions: + - ">=3.0.0" + - dependency-name: "@types/node" + versions: + - ">=22.0.0" + commit-message: + prefix: "chore(deps)" + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + groups: + github-actions: + patterns: + - "*" + commit-message: + prefix: "chore(deps)" diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..7a9dcdb --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,22 @@ +changelog: + exclude: + labels: + - ignore-for-release + - github-actions + authors: + - octocat + - renovate[bot] + categories: + - title: Breaking Changes 🛠 + labels: + - breaking-change + - title: Exciting New Features 🎉 + labels: + - enhancement + - feature + - title: Bug fixes 🐛 + labels: + - bug + - title: Other Changes 🔄 + labels: + - "*" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 35acd65..f85d3e2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,14 +1,20 @@ -name: Main +name: main -on: [pull_request, push] +on: + push: + pull_request: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - # https://github.com/actions/checkout - - name: Checkout - uses: actions/checkout@v2 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 + with: + node-version-file: ".tool-versions" + cache: "npm" + - name: Install run: npm ci - name: Build @@ -23,4 +29,4 @@ jobs: # git diff --exit-code --stat -- . ':!node_modules' \ # || (echo "##[error] found changed files after build. please 'npm run build && npm run fmt'" \ # "and check in all changes" \ - # && exit 1) \ No newline at end of file + # && exit 1) diff --git a/.gitignore b/.gitignore index 8856f55..6982a78 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ __tests__/runner/* # actions requires a node_modules dir https://github.com/actions/toolkit/blob/master/docs/javascript-action.md#publish-a-releasesv1-action # but its recommended not to check these in https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations node_modules +coverage diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ceb484e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,16 @@ +# Build outputs +dist/ +lib/ +coverage/ + +# Dependencies +node_modules/ + +# Misc +.github/ +*.log +.DS_Store +__tests__/release.txt + +# Package files +package-lock.json diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..d27b0d2 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,11 @@ +/** + * @type {import('prettier').Config} + */ +module.exports = { + trailingComma: 'all', + tabWidth: 2, + semi: true, + singleQuote: true, + printWidth: 100, + bracketSpacing: true, +}; diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..f07031b --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 24.2.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index f437df6..f77a15c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,186 @@ +## 2.3.2 + +* fix: revert fs `readableWebStream` change + +## 2.3.1 + +### Bug fixes 🐛 + +* fix: fix file closing issue by @WailGree in https://github.com/softprops/action-gh-release/pull/629 + +## 2.3.0 + +* Migrate from jest to vitest +* Replace `mime` with `mime-types` +* Bump to use node 24 +* Dependency updates + +## 2.2.2 + +## What's Changed + +### Bug fixes 🐛 + +* fix: updating release draft status from true to false by @galargh in https://github.com/softprops/action-gh-release/pull/316 + +### Other Changes 🔄 + +* chore: simplify ref_type test by @steinybot in https://github.com/softprops/action-gh-release/pull/598 +* fix(docs): clarify the default for tag_name by @muzimuzhi in https://github.com/softprops/action-gh-release/pull/599 +* test(release): add unit tests when searching for a release by @rwaskiewicz in https://github.com/softprops/action-gh-release/pull/603 +* dependency updates + +## 2.2.1 + +## What's Changed + +### Bug fixes 🐛 + +* fix: big file uploads by @xen0n in https://github.com/softprops/action-gh-release/pull/562 + +### Other Changes 🔄 +* chore(deps): bump @types/node from 22.10.1 to 22.10.2 by @dependabot in https://github.com/softprops/action-gh-release/pull/559 +* chore(deps): bump @types/node from 22.10.2 to 22.10.5 by @dependabot in https://github.com/softprops/action-gh-release/pull/569 +* chore: update error and warning messages for not matching files in files field by @ytimocin in https://github.com/softprops/action-gh-release/pull/568 + +## 2.2.0 + +## What's Changed + +### Exciting New Features 🎉 + +* feat: read the release assets asynchronously by @xen0n in https://github.com/softprops/action-gh-release/pull/552 + +### Bug fixes 🐛 + +* fix(docs): clarify the default for tag_name by @alexeagle in https://github.com/softprops/action-gh-release/pull/544 + +### Other Changes 🔄 + +* chore(deps): bump typescript from 5.6.3 to 5.7.2 by @dependabot in https://github.com/softprops/action-gh-release/pull/548 +* chore(deps): bump @types/node from 22.9.0 to 22.9.4 by @dependabot in https://github.com/softprops/action-gh-release/pull/547 +* chore(deps): bump cross-spawn from 7.0.3 to 7.0.6 by @dependabot in https://github.com/softprops/action-gh-release/pull/545 +* chore(deps): bump @vercel/ncc from 0.38.2 to 0.38.3 by @dependabot in https://github.com/softprops/action-gh-release/pull/543 +* chore(deps): bump prettier from 3.3.3 to 3.4.1 by @dependabot in https://github.com/softprops/action-gh-release/pull/550 +* chore(deps): bump @types/node from 22.9.4 to 22.10.1 by @dependabot in https://github.com/softprops/action-gh-release/pull/551 +* chore(deps): bump prettier from 3.4.1 to 3.4.2 by @dependabot in https://github.com/softprops/action-gh-release/pull/554 + +## 2.1.0 + +## What's Changed + +### Exciting New Features 🎉 +* feat: add support for release assets with multiple spaces within the name by @dukhine in https://github.com/softprops/action-gh-release/pull/518 +* feat: preserve upload order by @richarddd in https://github.com/softprops/action-gh-release/pull/500 + +### Other Changes 🔄 +* chore(deps): bump @types/node from 22.8.2 to 22.8.7 by @dependabot in https://github.com/softprops/action-gh-release/pull/539 + +## 2.0.9 + +- maintenance release with updated dependencies + +## 2.0.8 + +### Other Changes 🔄 +* chore(deps): bump prettier from 2.8.0 to 3.3.3 by @dependabot in https://github.com/softprops/action-gh-release/pull/480 +* chore(deps): bump @types/node from 20.14.9 to 20.14.11 by @dependabot in https://github.com/softprops/action-gh-release/pull/483 +* chore(deps): bump @octokit/plugin-throttling from 9.3.0 to 9.3.1 by @dependabot in https://github.com/softprops/action-gh-release/pull/484 +* chore(deps): bump glob from 10.4.2 to 11.0.0 by @dependabot in https://github.com/softprops/action-gh-release/pull/477 +* refactor: write jest config in ts by @chenrui333 in https://github.com/softprops/action-gh-release/pull/485 +* chore(deps): bump @actions/github from 5.1.1 to 6.0.0 by @dependabot in https://github.com/softprops/action-gh-release/pull/470 + +## 2.0.7 + +### Bug fixes 🐛 + +* Fix missing update release body by @FirelightFlagboy in https://github.com/softprops/action-gh-release/pull/365 + +### Other Changes 🔄 + +* Bump @octokit/plugin-retry from 4.0.3 to 7.1.1 by @dependabot in https://github.com/softprops/action-gh-release/pull/443 +* Bump typescript from 4.9.5 to 5.5.2 by @dependabot in https://github.com/softprops/action-gh-release/pull/467 +* Bump @types/node from 20.14.6 to 20.14.8 by @dependabot in https://github.com/softprops/action-gh-release/pull/469 +* Bump @types/node from 20.14.8 to 20.14.9 by @dependabot in https://github.com/softprops/action-gh-release/pull/473 +* Bump typescript from 5.5.2 to 5.5.3 by @dependabot in https://github.com/softprops/action-gh-release/pull/472 +* Bump ts-jest from 29.1.5 to 29.2.2 by @dependabot in https://github.com/softprops/action-gh-release/pull/479 +* docs: document that existing releases are updated by @jvanbruegge in https://github.com/softprops/action-gh-release/pull/474 + +## 2.0.6 + +- maintenance release with updated dependencies + +## 2.0.5 + +- Factor in file names with spaces when upserting files [#446](https://github.com/softprops/action-gh-release/pull/446) via [@MystiPanda](https://github.com/MystiPanda) +- Improvements to error handling [#449](https://github.com/softprops/action-gh-release/pull/449) via [@till](https://github.com/till) + +## 2.0.4 + +- Minor follow up to [#417](https://github.com/softprops/action-gh-release/pull/417). [#425](https://github.com/softprops/action-gh-release/pull/425) + +## 2.0.3 + +- Declare `make_latest` as an input field in `action.yml` [#419](https://github.com/softprops/action-gh-release/pull/419) + +## 2.0.2 + +- Revisit approach to [#384](https://github.com/softprops/action-gh-release/pull/384) making unresolved pattern failures opt-in [#417](https://github.com/softprops/action-gh-release/pull/417) + +## 2.0.1 + +- Add support for make_latest property [#304](https://github.com/softprops/action-gh-release/pull/304) via [@samueljseay](https://github.com/samueljseay) +- Fail run if files setting contains invalid patterns [#384](https://github.com/softprops/action-gh-release/pull/384) via [@rpdelaney](https://github.com/rpdelaney) +- Add support for proxy env variables (don't use node-fetch) [#386](https://github.com/softprops/action-gh-release/pull/386/) via [@timor-raiman](https://github.com/timor-raiman) +- Suppress confusing warning when input_files is empty [#389](https://github.com/softprops/action-gh-release/pull/389) via [@Drowze](https://github.com/Drowze) + +## 2.0.0 + +- `2.0.0`!? this release corrects a disjunction between git tag versions used in the marketplace and versions list this file. Previous versions should have really been 1.\*. Going forward this should be better aligned. +- Upgrade action.yml declaration to node20 to address deprecations + +## 0.1.15 + +- Upgrade to action.yml declaration to node16 to address deprecations +- Upgrade dependencies +- Add `asset` output as a JSON array containing information about the uploaded assets + +## 0.1.14 + +- provides an new workflow input option `generate_release_notes` which when set to true will automatically generate release notes for you based on GitHub activity [#179](https://github.com/softprops/action-gh-release/pull/179). Please see the [GitHub docs for this feature](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes) for more information + +## 0.1.13 + +- fix issue with multiple runs concatenating release bodies [#145](https://github.com/softprops/action-gh-release/pull/145) + +## 0.1.12 + +- fix bug leading to empty strings subsituted for inputs users don't provide breaking api calls [#144](https://github.com/softprops/action-gh-release/pull/144) + +## 0.1.11 + +- better error message on release create failed [#143](https://github.com/softprops/action-gh-release/pull/143) + +## 0.1.10 + +- fixed error message formatting for file uploads + +## 0.1.9 + +- add support for linking release to GitHub discussion [#136](https://github.com/softprops/action-gh-release/pull/136) + +## 0.1.8 + +- address recent warnings in assert upload api as well as introduce asset upload overrides, allowing for multiple runs for the same release with the same named asserts [#134](https://github.com/softprops/action-gh-release/pull/134) +- fix backwards compatibility with `GITHUB_TOKEN` resolution. `GITHUB_TOKEN` is no resolved first from an env varibale and then from and input [#133](https://github.com/softprops/action-gh-release/pull/133) +- trim white space in provided `tag_name` [#130](https://github.com/softprops/action-gh-release/pull/130) + +## 0.1.7 + +- allow creating draft releases without a tag [#95](https://github.com/softprops/action-gh-release/pull/95) +- Set default token for simpler setup [#83](https://github.com/softprops/action-gh-release/pull/83) +- fix regression with action yml [#126](https://github.com/softprops/action-gh-release/pull/126) + ## 0.1.6 This is a release catch up have a hiatus. Future releases will happen more frequently diff --git a/LICENSE b/LICENSE index ba32e73..2c072b8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2019 Doug Tangren +Copyright (c) 2019-current Doug Tangren Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/README.md b/README.md index 2090444..f889896 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -
i){return null}var r=t.loose?o[x]:o[_];if(!r.test(e)){return null}try{return new SemVer(e,t)}catch(e){return null}}t.valid=valid;function valid(e,t){var r=parse(e,t);return r?r.version:null}t.clean=clean;function clean(e,t){var r=parse(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}t.SemVer=SemVer;function SemVer(e,t){if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof SemVer){if(e.loose===t.loose){return e}else{e=e.version}}else if(typeof e!=="string"){throw new TypeError("Invalid Version: "+e)}if(e.length>i){throw new TypeError("version is longer than "+i+" characters")}if(!(this instanceof SemVer)){return new SemVer(e,t)}r("SemVer",e,t);this.options=t;this.loose=!!t.loose;var s=e.trim().match(t.loose?o[x]:o[_]);if(!s){throw new TypeError("Invalid Version: "+e)}this.raw=e;this.major=+s[1];this.minor=+s[2];this.patch=+s[3];if(this.major>n||this.major<0){throw new TypeError("Invalid major version")}if(this.minor>n||this.minor<0){throw new TypeError("Invalid minor version")}if(this.patch>n||this.patch<0){throw new TypeError("Invalid patch version")}if(!s[4]){this.prerelease=[]}else{this.prerelease=s[4].split(".").map(function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t{"use strict";const i=s(6197);const A=s(992);const o=s(8707);const r=s(5076);const n=s(1093);const a=s(9965);const c=s(3440);const{InvalidArgumentError:l}=o;const u=s(6615);const p=s(9136);const g=s(7365);const h=s(7501);const d=s(4004);const E=s(2429);const Q=s(2720);const C=s(3573);const{getGlobalDispatcher:B,setGlobalDispatcher:I}=s(2581);const b=s(8840);const y=s(8299);const w=s(4415);let v;try{s(6982);v=true}catch{v=false}Object.assign(A.prototype,u);e.exports.Dispatcher=A;e.exports.Client=i;e.exports.Pool=r;e.exports.BalancedPool=n;e.exports.Agent=a;e.exports.ProxyAgent=Q;e.exports.RetryHandler=C;e.exports.DecoratorHandler=b;e.exports.RedirectHandler=y;e.exports.createRedirectInterceptor=w;e.exports.buildConnector=p;e.exports.errors=o;function makeDispatcher(e){return(t,s,i)=>{if(typeof s==="function"){i=s;s=null}if(!t||typeof t!=="string"&&typeof t!=="object"&&!(t instanceof URL)){throw new l("invalid url")}if(s!=null&&typeof s!=="object"){throw new l("invalid opts")}if(s&&s.path!=null){if(typeof s.path!=="string"){throw new l("invalid opts.path")}let e=s.path;if(!s.path.startsWith("/")){e=`/${e}`}t=new URL(c.parseOrigin(t).origin+e)}else{if(!s){s=typeof t==="object"?t:{}}t=c.parseURL(t)}const{agent:A,dispatcher:o=B()}=s;if(A){throw new l("unsupported opts.agent. Did you mean opts.client?")}return e.call(o,{...s,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:s.method||(s.body?"PUT":"GET")},i)}}e.exports.setGlobalDispatcher=I;e.exports.getGlobalDispatcher=B;if(c.nodeMajor>16||c.nodeMajor===16&&c.nodeMinor>=8){let t=null;e.exports.fetch=async function fetch(e){if(!t){t=s(2315).fetch}try{return await t(...arguments)}catch(e){if(typeof e==="object"){Error.captureStackTrace(e,this)}throw e}};e.exports.Headers=s(6349).Headers;e.exports.Response=s(8676).Response;e.exports.Request=s(5194).Request;e.exports.FormData=s(3073).FormData;e.exports.File=s(3041).File;e.exports.FileReader=s(2160).FileReader;const{setGlobalOrigin:i,getGlobalOrigin:A}=s(5628);e.exports.setGlobalOrigin=i;e.exports.getGlobalOrigin=A;const{CacheStorage:o}=s(4738);const{kConstruct:r}=s(296);e.exports.caches=new o(r)}if(c.nodeMajor>=16){const{deleteCookie:t,getCookies:i,getSetCookies:A,setCookie:o}=s(3168);e.exports.deleteCookie=t;e.exports.getCookies=i;e.exports.getSetCookies=A;e.exports.setCookie=o;const{parseMIMEType:r,serializeAMimeType:n}=s(4322);e.exports.parseMIMEType=r;e.exports.serializeAMimeType=n}if(c.nodeMajor>=18&&v){const{WebSocket:t}=s(5171);e.exports.WebSocket=t}e.exports.request=makeDispatcher(u.request);e.exports.stream=makeDispatcher(u.stream);e.exports.pipeline=makeDispatcher(u.pipeline);e.exports.connect=makeDispatcher(u.connect);e.exports.upgrade=makeDispatcher(u.upgrade);e.exports.MockClient=g;e.exports.MockPool=d;e.exports.MockAgent=h;e.exports.mockErrors=E},9965:(e,t,s)=>{"use strict";const{InvalidArgumentError:i}=s(8707);const{kClients:A,kRunning:o,kClose:r,kDestroy:n,kDispatch:a,kInterceptors:c}=s(6443);const l=s(1);const u=s(5076);const p=s(6197);const g=s(3440);const h=s(4415);const{WeakRef:d,FinalizationRegistry:E}=s(3194)();const Q=Symbol("onConnect");const C=Symbol("onDisconnect");const B=Symbol("onConnectionError");const I=Symbol("maxRedirections");const b=Symbol("onDrain");const y=Symbol("factory");const w=Symbol("finalizer");const v=Symbol("options");function defaultFactory(e,t){return t&&t.connections===1?new p(e,t):new u(e,t)}class Agent extends l{constructor({factory:e=defaultFactory,maxRedirections:t=0,connect:s,...o}={}){super();if(typeof e!=="function"){throw new i("factory must be a function.")}if(s!=null&&typeof s!=="function"&&typeof s!=="object"){throw new i("connect must be a function or an object")}if(!Number.isInteger(t)||t<0){throw new i("maxRedirections must be a positive number")}if(s&&typeof s!=="function"){s={...s}}this[c]=o.interceptors&&o.interceptors.Agent&&Array.isArray(o.interceptors.Agent)?o.interceptors.Agent:[h({maxRedirections:t})];this[v]={...g.deepClone(o),connect:s};this[v].interceptors=o.interceptors?{...o.interceptors}:undefined;this[I]=t;this[y]=e;this[A]=new Map;this[w]=new E((e=>{const t=this[A].get(e);if(t!==undefined&&t.deref()===undefined){this[A].delete(e)}}));const r=this;this[b]=(e,t)=>{r.emit("drain",e,[r,...t])};this[Q]=(e,t)=>{r.emit("connect",e,[r,...t])};this[C]=(e,t,s)=>{r.emit("disconnect",e,[r,...t],s)};this[B]=(e,t,s)=>{r.emit("connectionError",e,[r,...t],s)}}get[o](){let e=0;for(const t of this[A].values()){const s=t.deref();if(s){e+=s[o]}}return e}[a](e,t){let s;if(e.origin&&(typeof e.origin==="string"||e.origin instanceof URL)){s=String(e.origin)}else{throw new i("opts.origin must be a non-empty string or URL.")}const o=this[A].get(s);let r=o?o.deref():null;if(!r){r=this[y](e.origin,this[v]).on("drain",this[b]).on("connect",this[Q]).on("disconnect",this[C]).on("connectionError",this[B]);this[A].set(s,new d(r));this[w].register(r,s)}return r.dispatch(e,t)}async[r](){const e=[];for(const t of this[A].values()){const s=t.deref();if(s){e.push(s.close())}}await Promise.all(e)}async[n](e){const t=[];for(const s of this[A].values()){const i=s.deref();if(i){t.push(i.destroy(e))}}await Promise.all(t)}}e.exports=Agent},158:(e,t,s)=>{const{addAbortListener:i}=s(3440);const{RequestAbortedError:A}=s(8707);const o=Symbol("kListener");const r=Symbol("kSignal");function abort(e){if(e.abort){e.abort()}else{e.onError(new A)}}function addSignal(e,t){e[r]=null;e[o]=null;if(!t){return}if(t.aborted){abort(e);return}e[r]=t;e[o]=()=>{abort(e)};i(e[r],e[o])}function removeSignal(e){if(!e[r]){return}if("removeEventListener"in e[r]){e[r].removeEventListener("abort",e[o])}else{e[r].removeListener("abort",e[o])}e[r]=null;e[o]=null}e.exports={addSignal:addSignal,removeSignal:removeSignal}},4660:(e,t,s)=>{"use strict";const{AsyncResource:i}=s(290);const{InvalidArgumentError:A,RequestAbortedError:o,SocketError:r}=s(8707);const n=s(3440);const{addSignal:a,removeSignal:c}=s(158);class ConnectHandler extends i{constructor(e,t){if(!e||typeof e!=="object"){throw new A("invalid opts")}if(typeof t!=="function"){throw new A("invalid callback")}const{signal:s,opaque:i,responseHeaders:o}=e;if(s&&typeof s.on!=="function"&&typeof s.addEventListener!=="function"){throw new A("signal must be an EventEmitter or EventTarget")}super("UNDICI_CONNECT");this.opaque=i||null;this.responseHeaders=o||null;this.callback=t;this.abort=null;a(this,s)}onConnect(e,t){if(!this.callback){throw new o}this.abort=e;this.context=t}onHeaders(){throw new r("bad connect",null)}onUpgrade(e,t,s){const{callback:i,opaque:A,context:o}=this;c(this);this.callback=null;let r=t;if(r!=null){r=this.responseHeaders==="raw"?n.parseRawHeaders(t):n.parseHeaders(t)}this.runInAsyncScope(i,null,null,{statusCode:e,headers:r,socket:s,opaque:A,context:o})}onError(e){const{callback:t,opaque:s}=this;c(this);if(t){this.callback=null;queueMicrotask((()=>{this.runInAsyncScope(t,null,e,{opaque:s})}))}}}function connect(e,t){if(t===undefined){return new Promise(((t,s)=>{connect.call(this,e,((e,i)=>e?s(e):t(i)))}))}try{const s=new ConnectHandler(e,t);this.dispatch({...e,method:"CONNECT"},s)}catch(s){if(typeof t!=="function"){throw s}const i=e&&e.opaque;queueMicrotask((()=>t(s,{opaque:i})))}}e.exports=connect},6862:(e,t,s)=>{"use strict";const{Readable:i,Duplex:A,PassThrough:o}=s(2203);const{InvalidArgumentError:r,InvalidReturnValueError:n,RequestAbortedError:a}=s(8707);const c=s(3440);const{AsyncResource:l}=s(290);const{addSignal:u,removeSignal:p}=s(158);const g=s(2613);const h=Symbol("resume");class PipelineRequest extends i{constructor(){super({autoDestroy:true});this[h]=null}_read(){const{[h]:e}=this;if(e){this[h]=null;e()}}_destroy(e,t){this._read();t(e)}}class PipelineResponse extends i{constructor(e){super({autoDestroy:true});this[h]=e}_read(){this[h]()}_destroy(e,t){if(!e&&!this._readableState.endEmitted){e=new a}t(e)}}class PipelineHandler extends l{constructor(e,t){if(!e||typeof e!=="object"){throw new r("invalid opts")}if(typeof t!=="function"){throw new r("invalid handler")}const{signal:s,method:i,opaque:o,onInfo:n,responseHeaders:l}=e;if(s&&typeof s.on!=="function"&&typeof s.addEventListener!=="function"){throw new r("signal must be an EventEmitter or EventTarget")}if(i==="CONNECT"){throw new r("invalid method")}if(n&&typeof n!=="function"){throw new r("invalid onInfo callback")}super("UNDICI_PIPELINE");this.opaque=o||null;this.responseHeaders=l||null;this.handler=t;this.abort=null;this.context=null;this.onInfo=n||null;this.req=(new PipelineRequest).on("error",c.nop);this.ret=new A({readableObjectMode:e.objectMode,autoDestroy:true,read:()=>{const{body:e}=this;if(e&&e.resume){e.resume()}},write:(e,t,s)=>{const{req:i}=this;if(i.push(e,t)||i._readableState.destroyed){s()}else{i[h]=s}},destroy:(e,t)=>{const{body:s,req:i,res:A,ret:o,abort:r}=this;if(!e&&!o._readableState.endEmitted){e=new a}if(r&&e){r()}c.destroy(s,e);c.destroy(i,e);c.destroy(A,e);p(this);t(e)}}).on("prefinish",(()=>{const{req:e}=this;e.push(null)}));this.res=null;u(this,s)}onConnect(e,t){const{ret:s,res:i}=this;g(!i,"pipeline cannot be retried");if(s.destroyed){throw new a}this.abort=e;this.context=t}onHeaders(e,t,s){const{opaque:i,handler:A,context:o}=this;if(e<200){if(this.onInfo){const s=this.responseHeaders==="raw"?c.parseRawHeaders(t):c.parseHeaders(t);this.onInfo({statusCode:e,headers:s})}return}this.res=new PipelineResponse(s);let r;try{this.handler=null;const s=this.responseHeaders==="raw"?c.parseRawHeaders(t):c.parseHeaders(t);r=this.runInAsyncScope(A,null,{statusCode:e,headers:s,opaque:i,body:this.res,context:o})}catch(e){this.res.on("error",c.nop);throw e}if(!r||typeof r.on!=="function"){throw new n("expected Readable")}r.on("data",(e=>{const{ret:t,body:s}=this;if(!t.push(e)&&s.pause){s.pause()}})).on("error",(e=>{const{ret:t}=this;c.destroy(t,e)})).on("end",(()=>{const{ret:e}=this;e.push(null)})).on("close",(()=>{const{ret:e}=this;if(!e._readableState.ended){c.destroy(e,new a)}}));this.body=r}onData(e){const{res:t}=this;return t.push(e)}onComplete(e){const{res:t}=this;t.push(null)}onError(e){const{ret:t}=this;this.handler=null;c.destroy(t,e)}}function pipeline(e,t){try{const s=new PipelineHandler(e,t);this.dispatch({...e,body:s.req},s);return s.ret}catch(e){return(new o).destroy(e)}}e.exports=pipeline},4043:(e,t,s)=>{"use strict";const i=s(9927);const{InvalidArgumentError:A,RequestAbortedError:o}=s(8707);const r=s(3440);const{getResolveErrorBodyCallback:n}=s(7655);const{AsyncResource:a}=s(290);const{addSignal:c,removeSignal:l}=s(158);class RequestHandler extends a{constructor(e,t){if(!e||typeof e!=="object"){throw new A("invalid opts")}const{signal:s,method:i,opaque:o,body:n,onInfo:a,responseHeaders:l,throwOnError:u,highWaterMark:p}=e;try{if(typeof t!=="function"){throw new A("invalid callback")}if(p&&(typeof p!=="number"||p<0)){throw new A("invalid highWaterMark")}if(s&&typeof s.on!=="function"&&typeof s.addEventListener!=="function"){throw new A("signal must be an EventEmitter or EventTarget")}if(i==="CONNECT"){throw new A("invalid method")}if(a&&typeof a!=="function"){throw new A("invalid onInfo callback")}super("UNDICI_REQUEST")}catch(e){if(r.isStream(n)){r.destroy(n.on("error",r.nop),e)}throw e}this.responseHeaders=l||null;this.opaque=o||null;this.callback=t;this.res=null;this.abort=null;this.body=n;this.trailers={};this.context=null;this.onInfo=a||null;this.throwOnError=u;this.highWaterMark=p;if(r.isStream(n)){n.on("error",(e=>{this.onError(e)}))}c(this,s)}onConnect(e,t){if(!this.callback){throw new o}this.abort=e;this.context=t}onHeaders(e,t,s,A){const{callback:o,opaque:a,abort:c,context:l,responseHeaders:u,highWaterMark:p}=this;const g=u==="raw"?r.parseRawHeaders(t):r.parseHeaders(t);if(e<200){if(this.onInfo){this.onInfo({statusCode:e,headers:g})}return}const h=u==="raw"?r.parseHeaders(t):g;const d=h["content-type"];const E=new i({resume:s,abort:c,contentType:d,highWaterMark:p});this.callback=null;this.res=E;if(o!==null){if(this.throwOnError&&e>=400){this.runInAsyncScope(n,null,{callback:o,body:E,contentType:d,statusCode:e,statusMessage:A,headers:g})}else{this.runInAsyncScope(o,null,null,{statusCode:e,headers:g,trailers:this.trailers,opaque:a,body:E,context:l})}}}onData(e){const{res:t}=this;return t.push(e)}onComplete(e){const{res:t}=this;l(this);r.parseHeaders(e,this.trailers);t.push(null)}onError(e){const{res:t,callback:s,body:i,opaque:A}=this;l(this);if(s){this.callback=null;queueMicrotask((()=>{this.runInAsyncScope(s,null,e,{opaque:A})}))}if(t){this.res=null;queueMicrotask((()=>{r.destroy(t,e)}))}if(i){this.body=null;r.destroy(i,e)}}}function request(e,t){if(t===undefined){return new Promise(((t,s)=>{request.call(this,e,((e,i)=>e?s(e):t(i)))}))}try{this.dispatch(e,new RequestHandler(e,t))}catch(s){if(typeof t!=="function"){throw s}const i=e&&e.opaque;queueMicrotask((()=>t(s,{opaque:i})))}}e.exports=request;e.exports.RequestHandler=RequestHandler},3560:(e,t,s)=>{"use strict";const{finished:i,PassThrough:A}=s(2203);const{InvalidArgumentError:o,InvalidReturnValueError:r,RequestAbortedError:n}=s(8707);const a=s(3440);const{getResolveErrorBodyCallback:c}=s(7655);const{AsyncResource:l}=s(290);const{addSignal:u,removeSignal:p}=s(158);class StreamHandler extends l{constructor(e,t,s){if(!e||typeof e!=="object"){throw new o("invalid opts")}const{signal:i,method:A,opaque:r,body:n,onInfo:c,responseHeaders:l,throwOnError:p}=e;try{if(typeof s!=="function"){throw new o("invalid callback")}if(typeof t!=="function"){throw new o("invalid factory")}if(i&&typeof i.on!=="function"&&typeof i.addEventListener!=="function"){throw new o("signal must be an EventEmitter or EventTarget")}if(A==="CONNECT"){throw new o("invalid method")}if(c&&typeof c!=="function"){throw new o("invalid onInfo callback")}super("UNDICI_STREAM")}catch(e){if(a.isStream(n)){a.destroy(n.on("error",a.nop),e)}throw e}this.responseHeaders=l||null;this.opaque=r||null;this.factory=t;this.callback=s;this.res=null;this.abort=null;this.context=null;this.trailers=null;this.body=n;this.onInfo=c||null;this.throwOnError=p||false;if(a.isStream(n)){n.on("error",(e=>{this.onError(e)}))}u(this,i)}onConnect(e,t){if(!this.callback){throw new n}this.abort=e;this.context=t}onHeaders(e,t,s,o){const{factory:n,opaque:l,context:u,callback:p,responseHeaders:g}=this;const h=g==="raw"?a.parseRawHeaders(t):a.parseHeaders(t);if(e<200){if(this.onInfo){this.onInfo({statusCode:e,headers:h})}return}this.factory=null;let d;if(this.throwOnError&&e>=400){const s=g==="raw"?a.parseHeaders(t):h;const i=s["content-type"];d=new A;this.callback=null;this.runInAsyncScope(c,null,{callback:p,body:d,contentType:i,statusCode:e,statusMessage:o,headers:h})}else{if(n===null){return}d=this.runInAsyncScope(n,null,{statusCode:e,headers:h,opaque:l,context:u});if(!d||typeof d.write!=="function"||typeof d.end!=="function"||typeof d.on!=="function"){throw new r("expected Writable")}i(d,{readable:false},(e=>{const{callback:t,res:s,opaque:i,trailers:A,abort:o}=this;this.res=null;if(e||!s.readable){a.destroy(s,e)}this.callback=null;this.runInAsyncScope(t,null,e||null,{opaque:i,trailers:A});if(e){o()}}))}d.on("drain",s);this.res=d;const E=d.writableNeedDrain!==undefined?d.writableNeedDrain:d._writableState&&d._writableState.needDrain;return E!==true}onData(e){const{res:t}=this;return t?t.write(e):true}onComplete(e){const{res:t}=this;p(this);if(!t){return}this.trailers=a.parseHeaders(e);t.end()}onError(e){const{res:t,callback:s,opaque:i,body:A}=this;p(this);this.factory=null;if(t){this.res=null;a.destroy(t,e)}else if(s){this.callback=null;queueMicrotask((()=>{this.runInAsyncScope(s,null,e,{opaque:i})}))}if(A){this.body=null;a.destroy(A,e)}}}function stream(e,t,s){if(s===undefined){return new Promise(((s,i)=>{stream.call(this,e,t,((e,t)=>e?i(e):s(t)))}))}try{this.dispatch(e,new StreamHandler(e,t,s))}catch(t){if(typeof s!=="function"){throw t}const i=e&&e.opaque;queueMicrotask((()=>s(t,{opaque:i})))}}e.exports=stream},1882:(e,t,s)=>{"use strict";const{InvalidArgumentError:i,RequestAbortedError:A,SocketError:o}=s(8707);const{AsyncResource:r}=s(290);const n=s(3440);const{addSignal:a,removeSignal:c}=s(158);const l=s(2613);class UpgradeHandler extends r{constructor(e,t){if(!e||typeof e!=="object"){throw new i("invalid opts")}if(typeof t!=="function"){throw new i("invalid callback")}const{signal:s,opaque:A,responseHeaders:o}=e;if(s&&typeof s.on!=="function"&&typeof s.addEventListener!=="function"){throw new i("signal must be an EventEmitter or EventTarget")}super("UNDICI_UPGRADE");this.responseHeaders=o||null;this.opaque=A||null;this.callback=t;this.abort=null;this.context=null;a(this,s)}onConnect(e,t){if(!this.callback){throw new A}this.abort=e;this.context=null}onHeaders(){throw new o("bad upgrade",null)}onUpgrade(e,t,s){const{callback:i,opaque:A,context:o}=this;l.strictEqual(e,101);c(this);this.callback=null;const r=this.responseHeaders==="raw"?n.parseRawHeaders(t):n.parseHeaders(t);this.runInAsyncScope(i,null,null,{headers:r,socket:s,opaque:A,context:o})}onError(e){const{callback:t,opaque:s}=this;c(this);if(t){this.callback=null;queueMicrotask((()=>{this.runInAsyncScope(t,null,e,{opaque:s})}))}}}function upgrade(e,t){if(t===undefined){return new Promise(((t,s)=>{upgrade.call(this,e,((e,i)=>e?s(e):t(i)))}))}try{const s=new UpgradeHandler(e,t);this.dispatch({...e,method:e.method||"GET",upgrade:e.protocol||"Websocket"},s)}catch(s){if(typeof t!=="function"){throw s}const i=e&&e.opaque;queueMicrotask((()=>t(s,{opaque:i})))}}e.exports=upgrade},6615:(e,t,s)=>{"use strict";e.exports.request=s(4043);e.exports.stream=s(3560);e.exports.pipeline=s(6862);e.exports.upgrade=s(1882);e.exports.connect=s(4660)},9927:(e,t,s)=>{"use strict";const i=s(2613);const{Readable:A}=s(2203);const{RequestAbortedError:o,NotSupportedError:r,InvalidArgumentError:n}=s(8707);const a=s(3440);const{ReadableStreamFrom:c,toUSVString:l}=s(3440);let u;const p=Symbol("kConsume");const g=Symbol("kReading");const h=Symbol("kBody");const d=Symbol("abort");const E=Symbol("kContentType");const noop=()=>{};e.exports=class BodyReadable extends A{constructor({resume:e,abort:t,contentType:s="",highWaterMark:i=64*1024}){super({autoDestroy:true,read:e,highWaterMark:i});this._readableState.dataEmitted=false;this[d]=t;this[p]=null;this[h]=null;this[E]=s;this[g]=false}destroy(e){if(this.destroyed){return this}if(!e&&!this._readableState.endEmitted){e=new o}if(e){this[d]()}return super.destroy(e)}emit(e,...t){if(e==="data"){this._readableState.dataEmitted=true}else if(e==="error"){this._readableState.errorEmitted=true}return super.emit(e,...t)}on(e,...t){if(e==="data"||e==="readable"){this[g]=true}return super.on(e,...t)}addListener(e,...t){return this.on(e,...t)}off(e,...t){const s=super.off(e,...t);if(e==="data"||e==="readable"){this[g]=this.listenerCount("data")>0||this.listenerCount("readable")>0}return s}removeListener(e,...t){return this.off(e,...t)}push(e){if(this[p]&&e!==null&&this.readableLength===0){consumePush(this[p],e);return this[g]?super.push(e):true}return super.push(e)}async text(){return consume(this,"text")}async json(){return consume(this,"json")}async blob(){return consume(this,"blob")}async arrayBuffer(){return consume(this,"arrayBuffer")}async formData(){throw new r}get bodyUsed(){return a.isDisturbed(this)}get body(){if(!this[h]){this[h]=c(this);if(this[p]){this[h].getReader();i(this[h].locked)}}return this[h]}dump(e){let t=e&&Number.isFinite(e.limit)?e.limit:262144;const s=e&&e.signal;if(s){try{if(typeof s!=="object"||!("aborted"in s)){throw new n("signal must be an AbortSignal")}a.throwIfAborted(s)}catch(e){return Promise.reject(e)}}if(this.closed){return Promise.resolve(null)}return new Promise(((e,i)=>{const A=s?a.addAbortListener(s,(()=>{this.destroy()})):noop;this.on("close",(function(){A();if(s&&s.aborted){i(s.reason||Object.assign(new Error("The operation was aborted"),{name:"AbortError"}))}else{e(null)}})).on("error",noop).on("data",(function(e){t-=e.length;if(t<=0){this.destroy()}})).resume()}))}};function isLocked(e){return e[h]&&e[h].locked===true||e[p]}function isUnusable(e){return a.isDisturbed(e)||isLocked(e)}async function consume(e,t){if(isUnusable(e)){throw new TypeError("unusable")}i(!e[p]);return new Promise(((s,i)=>{e[p]={type:t,stream:e,resolve:s,reject:i,length:0,body:[]};e.on("error",(function(e){consumeFinish(this[p],e)})).on("close",(function(){if(this[p].body!==null){consumeFinish(this[p],new o)}}));process.nextTick(consumeStart,e[p])}))}function consumeStart(e){if(e.body===null){return}const{_readableState:t}=e.stream;for(const s of t.buffer){consumePush(e,s)}if(t.endEmitted){consumeEnd(this[p])}else{e.stream.on("end",(function(){consumeEnd(this[p])}))}e.stream.resume();while(e.stream.read()!=null){}}function consumeEnd(e){const{type:t,body:i,resolve:A,stream:o,length:r}=e;try{if(t==="text"){A(l(Buffer.concat(i)))}else if(t==="json"){A(JSON.parse(Buffer.concat(i)))}else if(t==="arrayBuffer"){const e=new Uint8Array(r);let t=0;for(const s of i){e.set(s,t);t+=s.byteLength}A(e.buffer)}else if(t==="blob"){if(!u){u=s(181).Blob}A(new u(i,{type:o[E]}))}consumeFinish(e)}catch(e){o.destroy(e)}}function consumePush(e,t){e.length+=t.length;e.body.push(t)}function consumeFinish(e,t){if(e.body===null){return}if(t){e.reject(t)}else{e.resolve()}e.type=null;e.stream=null;e.resolve=null;e.reject=null;e.length=0;e.body=null}},7655:(e,t,s)=>{const i=s(2613);const{ResponseStatusCodeError:A}=s(8707);const{toUSVString:o}=s(3440);async function getResolveErrorBodyCallback({callback:e,body:t,contentType:s,statusCode:r,statusMessage:n,headers:a}){i(t);let c=[];let l=0;for await(const e of t){c.push(e);l+=e.length;if(l>128*1024){c=null;break}}if(r===204||!s||!c){process.nextTick(e,new A(`Response status code ${r}${n?`: ${n}`:""}`,r,a));return}try{if(s.startsWith("application/json")){const t=JSON.parse(o(Buffer.concat(c)));process.nextTick(e,new A(`Response status code ${r}${n?`: ${n}`:""}`,r,a,t));return}if(s.startsWith("text/")){const t=o(Buffer.concat(c));process.nextTick(e,new A(`Response status code ${r}${n?`: ${n}`:""}`,r,a,t));return}}catch(e){}process.nextTick(e,new A(`Response status code ${r}${n?`: ${n}`:""}`,r,a))}e.exports={getResolveErrorBodyCallback:getResolveErrorBodyCallback}},1093:(e,t,s)=>{"use strict";const{BalancedPoolMissingUpstreamError:i,InvalidArgumentError:A}=s(8707);const{PoolBase:o,kClients:r,kNeedDrain:n,kAddClient:a,kRemoveClient:c,kGetDispatcher:l}=s(8640);const u=s(5076);const{kUrl:p,kInterceptors:g}=s(6443);const{parseOrigin:h}=s(3440);const d=Symbol("factory");const E=Symbol("options");const Q=Symbol("kGreatestCommonDivisor");const C=Symbol("kCurrentWeight");const B=Symbol("kIndex");const I=Symbol("kWeight");const b=Symbol("kMaxWeightPerServer");const y=Symbol("kErrorPenalty");function getGreatestCommonDivisor(e,t){if(t===0)return e;return getGreatestCommonDivisor(t,e%t)}function defaultFactory(e,t){return new u(e,t)}class BalancedPool extends o{constructor(e=[],{factory:t=defaultFactory,...s}={}){super();this[E]=s;this[B]=-1;this[C]=0;this[b]=this[E].maxWeightPerServer||100;this[y]=this[E].errorPenalty||15;if(!Array.isArray(e)){e=[e]}if(typeof t!=="function"){throw new A("factory must be a function.")}this[g]=s.interceptors&&s.interceptors.BalancedPool&&Array.isArray(s.interceptors.BalancedPool)?s.interceptors.BalancedPool:[];this[d]=t;for(const t of e){this.addUpstream(t)}this._updateBalancedPoolStats()}addUpstream(e){const t=h(e).origin;if(this[r].find((e=>e[p].origin===t&&e.closed!==true&&e.destroyed!==true))){return this}const s=this[d](t,Object.assign({},this[E]));this[a](s);s.on("connect",(()=>{s[I]=Math.min(this[b],s[I]+this[y])}));s.on("connectionError",(()=>{s[I]=Math.max(1,s[I]-this[y]);this._updateBalancedPoolStats()}));s.on("disconnect",((...e)=>{const t=e[2];if(t&&t.code==="UND_ERR_SOCKET"){s[I]=Math.max(1,s[I]-this[y]);this._updateBalancedPoolStats()}}));for(const e of this[r]){e[I]=this[b]}this._updateBalancedPoolStats();return this}_updateBalancedPoolStats(){this[Q]=this[r].map((e=>e[I])).reduce(getGreatestCommonDivisor,0)}removeUpstream(e){const t=h(e).origin;const s=this[r].find((e=>e[p].origin===t&&e.closed!==true&&e.destroyed!==true));if(s){this[c](s)}return this}get upstreams(){return this[r].filter((e=>e.closed!==true&&e.destroyed!==true)).map((e=>e[p].origin))}[l](){if(this[r].length===0){throw new i}const e=this[r].find((e=>!e[n]&&e.closed!==true&&e.destroyed!==true));if(!e){return}const t=this[r].map((e=>e[n])).reduce(((e,t)=>e&&t),true);if(t){return}let s=0;let A=this[r].findIndex((e=>!e[n]));while(s++