@cloudsnorkel/cdk-github-runners 0.7.5 → 0.7.6

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Setup GitHub Runners</title>
7
7
  <script type="module" crossorigin>
8
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const p of n)if(p.type==="childList")for(const c of p.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function o(n){const p={};return n.integrity&&(p.integrity=n.integrity),n.referrerpolicy&&(p.referrerPolicy=n.referrerpolicy),n.crossorigin==="use-credentials"?p.credentials="include":n.crossorigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function i(n){if(n.ep)return;n.ep=!0;const p=o(n);fetch(n.href,p)}})();function Y(){}function Le(e){return e()}function Ce(){return Object.create(null)}function j(e){e.forEach(Le)}function Ue(e){return typeof e=="function"}function Be(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function De(e){return Object.keys(e).length===0}function l(e,t){e.appendChild(t)}function H(e,t,o){e.insertBefore(t,o||null)}function T(e){e.parentNode&&e.parentNode.removeChild(e)}function r(e){return document.createElement(e)}function I(e){return document.createTextNode(e)}function b(){return I(" ")}function Me(){return I("")}function $(e,t,o,i){return e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i)}function s(e,t,o){o==null?e.removeAttribute(t):e.getAttribute(t)!==o&&e.setAttribute(t,o)}function $e(e){return e===""?null:+e}function je(e){return Array.from(e.childNodes)}function ce(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function M(e,t){e.value=t==null?"":t}let ke;function ee(e){ke=e}const x=[],Se=[],ae=[],Te=[],qe=Promise.resolve();let be=!1;function Je(){be||(be=!0,qe.then(ze))}function ve(e){ae.push(e)}const he=new Set;let ue=0;function ze(){const e=ke;do{for(;ue<x.length;){const t=x[ue];ue++,ee(t),Ke(t.$$)}for(ee(null),x.length=0,ue=0;Se.length;)Se.pop()();for(let t=0;t<ae.length;t+=1){const o=ae[t];he.has(o)||(he.add(o),o())}ae.length=0}while(x.length);for(;Te.length;)Te.pop()();be=!1,he.clear(),ee(e)}function Ke(e){if(e.fragment!==null){e.update(),j(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ve)}}const We=new Set;function Fe(e,t){e&&e.i&&(We.delete(e),e.i(t))}function Ye(e,t,o,i){const{fragment:n,after_update:p}=e.$$;n&&n.m(t,o),i||ve(()=>{const c=e.$$.on_mount.map(Le).filter(Ue);e.$$.on_destroy?e.$$.on_destroy.push(...c):j(c),e.$$.on_mount=[]}),p.forEach(ve)}function Ze(e,t){const o=e.$$;o.fragment!==null&&(j(o.on_destroy),o.fragment&&o.fragment.d(t),o.on_destroy=o.fragment=null,o.ctx=[])}function Qe(e,t){e.$$.dirty[0]===-1&&(x.push(e),Je(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Ve(e,t,o,i,n,p,c,u=[-1]){const v=ke;ee(e);const a=e.$$={fragment:null,ctx:[],props:p,update:Y,not_equal:n,bound:Ce(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(v?v.$$.context:[])),callbacks:Ce(),dirty:u,skip_bound:!1,root:t.target||v.$$.root};c&&c(a.root);let h=!1;if(a.ctx=o?o(e,t.props||{},(g,f,...O)=>{const k=O.length?O[0]:f;return a.ctx&&n(a.ctx[g],a.ctx[g]=k)&&(!a.skip_bound&&a.bound[g]&&a.bound[g](k),h&&Qe(e,g)),f}):[],a.update(),h=!0,j(a.before_update),a.fragment=i?i(a.ctx):!1,t.target){if(t.hydrate){const g=je(t.target);a.fragment&&a.fragment.l(g),g.forEach(T)}else a.fragment&&a.fragment.c();t.intro&&Fe(e.$$.fragment),Ye(e,t.target,t.anchor,t.customElement),ze()}ee(v)}class Xe{$destroy(){Ze(this,1),this.$destroy=Y}$on(t,o){if(!Ue(o))return Y;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(o),()=>{const n=i.indexOf(o);n!==-1&&i.splice(n,1)}}$set(t){this.$$set&&!De(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Oe(e){let t,o,i,n,p,c,u,v;return{c(){t=r("h3"),t.textContent="GitHub Enterprise Server Domain",o=b(),i=r("div"),n=r("p"),n.innerHTML=`Where is GitHub Enterprise Server hosted? Type in the domain without <code>https://</code>
8
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const p of n)if(p.type==="childList")for(const c of p.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function o(n){const p={};return n.integrity&&(p.integrity=n.integrity),n.referrerpolicy&&(p.referrerPolicy=n.referrerpolicy),n.crossorigin==="use-credentials"?p.credentials="include":n.crossorigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function i(n){if(n.ep)return;n.ep=!0;const p=o(n);fetch(n.href,p)}})();function Q(){}function Le(e){return e()}function Ce(){return Object.create(null)}function j(e){e.forEach(Le)}function Ue(e){return typeof e=="function"}function Be(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function De(e){return Object.keys(e).length===0}function l(e,t){e.appendChild(t)}function H(e,t,o){e.insertBefore(t,o||null)}function T(e){e.parentNode&&e.parentNode.removeChild(e)}function r(e){return document.createElement(e)}function I(e){return document.createTextNode(e)}function b(){return I(" ")}function Me(){return I("")}function $(e,t,o,i){return e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i)}function s(e,t,o){o==null?e.removeAttribute(t):e.getAttribute(t)!==o&&e.setAttribute(t,o)}function $e(e){return e===""?null:+e}function je(e){return Array.from(e.childNodes)}function ce(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function M(e,t){e.value=t==null?"":t}let ke;function te(e){ke=e}const Z=[],Se=[],ae=[],Te=[],qe=Promise.resolve();let be=!1;function Je(){be||(be=!0,qe.then(ze))}function ve(e){ae.push(e)}const he=new Set;let Y=0;function ze(){if(Y!==0)return;const e=ke;do{try{for(;Y<Z.length;){const t=Z[Y];Y++,te(t),Ke(t.$$)}}catch(t){throw Z.length=0,Y=0,t}for(te(null),Z.length=0,Y=0;Se.length;)Se.pop()();for(let t=0;t<ae.length;t+=1){const o=ae[t];he.has(o)||(he.add(o),o())}ae.length=0}while(Z.length);for(;Te.length;)Te.pop()();be=!1,he.clear(),te(e)}function Ke(e){if(e.fragment!==null){e.update(),j(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ve)}}const We=new Set;function Fe(e,t){e&&e.i&&(We.delete(e),e.i(t))}function Ye(e,t,o,i){const{fragment:n,after_update:p}=e.$$;n&&n.m(t,o),i||ve(()=>{const c=e.$$.on_mount.map(Le).filter(Ue);e.$$.on_destroy?e.$$.on_destroy.push(...c):j(c),e.$$.on_mount=[]}),p.forEach(ve)}function Ze(e,t){const o=e.$$;o.fragment!==null&&(j(o.on_destroy),o.fragment&&o.fragment.d(t),o.on_destroy=o.fragment=null,o.ctx=[])}function Qe(e,t){e.$$.dirty[0]===-1&&(Z.push(e),Je(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Ve(e,t,o,i,n,p,c,u=[-1]){const v=ke;te(e);const a=e.$$={fragment:null,ctx:[],props:p,update:Q,not_equal:n,bound:Ce(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(v?v.$$.context:[])),callbacks:Ce(),dirty:u,skip_bound:!1,root:t.target||v.$$.root};c&&c(a.root);let h=!1;if(a.ctx=o?o(e,t.props||{},(g,f,...O)=>{const k=O.length?O[0]:f;return a.ctx&&n(a.ctx[g],a.ctx[g]=k)&&(!a.skip_bound&&a.bound[g]&&a.bound[g](k),h&&Qe(e,g)),f}):[],a.update(),h=!0,j(a.before_update),a.fragment=i?i(a.ctx):!1,t.target){if(t.hydrate){const g=je(t.target);a.fragment&&a.fragment.l(g),g.forEach(T)}else a.fragment&&a.fragment.c();t.intro&&Fe(e.$$.fragment),Ye(e,t.target,t.anchor,t.customElement),ze()}te(v)}class Xe{$destroy(){Ze(this,1),this.$destroy=Q}$on(t,o){if(!Ue(o))return Q;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(o),()=>{const n=i.indexOf(o);n!==-1&&i.splice(n,1)}}$set(t){this.$$set&&!De(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Oe(e){let t,o,i,n,p,c,u,v;return{c(){t=r("h3"),t.textContent="GitHub Enterprise Server Domain",o=b(),i=r("div"),n=r("p"),n.innerHTML=`Where is GitHub Enterprise Server hosted? Type in the domain without <code>https://</code>
9
9
  and without any path. It should look something like <code>github.mycompany.com</code>.`,p=b(),c=r("input"),s(c,"class","form-control"),s(i,"class","px-3 py-3")},m(a,h){H(a,t,h),H(a,o,h),H(a,i,h),l(i,n),l(i,p),l(i,c),M(c,e[1]),u||(v=$(c,"input",e[15]),u=!0)},p(a,h){h&2&&c.value!==a[1]&&M(c,a[1])},d(a){a&&T(t),a&&T(o),a&&T(i),u=!1,v()}}}function He(e){let t,o,i,n,p,c,u,v,a,h,g,f,O,k,S,C,d,_,A,E,N;return{c(){t=r("h3"),t.textContent="Authentication Type",o=b(),i=r("div"),n=r("p"),n.textContent=`You can choose between creating a new app that will provide authentication for specific
10
10
  repositories, or a personal access token that will provide access to all repositories
11
11
  available to you. Apps are easier to set up and provide more fine-grained access control. If
@@ -16,13 +16,13 @@
16
16
  for repositories under that organization.`,p=b(),c=r("div"),u=r("input"),v=b(),a=r("label"),a.textContent="User app",h=b(),g=r("div"),f=r("input"),O=b(),k=r("label"),k.textContent="Organization app",S=b(),E&&E.c(),C=b(),N&&N.c(),d=Me(),s(u,"class","form-check-input"),s(u,"type","radio"),u.__value="user",u.value=u.__value,s(u,"id","userScope"),e[13][2].push(u),s(a,"class","form-check-label"),s(a,"for","userScope"),s(c,"class","form-check"),s(f,"class","form-check-input"),s(f,"type","radio"),f.__value="org",f.value=f.__value,s(f,"id","orgScope"),e[13][2].push(f),s(k,"class","form-check-label"),s(k,"for","orgScope"),s(g,"class","form-check"),s(i,"class","px-3 py-3")},m(m,w){H(m,t,w),H(m,o,w),H(m,i,w),l(i,n),l(i,p),l(i,c),l(c,u),u.checked=u.__value===e[3],l(c,v),l(c,a),l(i,h),l(i,g),l(g,f),f.checked=f.__value===e[3],l(g,O),l(g,k),l(i,S),E&&E.m(i,null),H(m,C,w),N&&N.m(m,w),H(m,d,w),_||(A=[$(u,"change",e[19]),$(f,"change",e[20])],_=!0)},p(m,w){w&8&&(u.checked=u.__value===m[3]),w&8&&(f.checked=f.__value===m[3]),m[0]==="ghes"?E?E.p(m,w):(E=Ne(m),E.c(),E.m(i,null)):E&&(E.d(1),E=null),m[3]==="org"?N?N.p(m,w):(N=Ie(m),N.c(),N.m(d.parentNode,d)):N&&(N.d(1),N=null)},d(m){m&&T(t),m&&T(o),m&&T(i),e[13][2].splice(e[13][2].indexOf(u),1),e[13][2].splice(e[13][2].indexOf(f),1),E&&E.d(),m&&T(C),N&&N.d(m),m&&T(d),_=!1,j(A)}}}function Ne(e){let t,o,i,n,p,c,u,v;return{c(){t=r("p"),t.textContent=`If multiple organizations under the same GitHub Enterprise Server need to use the runners,
17
17
  you can make the app public.`,o=b(),i=r("div"),n=r("input"),p=b(),c=r("label"),c.textContent="Public app",s(t,"class","pt-2"),s(n,"class","form-check-input"),s(n,"type","checkbox"),s(n,"id","public"),s(c,"class","form-check-label"),s(c,"for","public"),s(i,"class","form-check")},m(a,h){H(a,t,h),H(a,o,h),H(a,i,h),l(i,n),n.checked=e[10].public,l(i,p),l(i,c),u||(v=$(n,"change",e[21]),u=!0)},p(a,h){h&1024&&(n.checked=a[10].public)},d(a){a&&T(t),a&&T(o),a&&T(i),u=!1,v()}}}function Ie(e){let t,o,i,n,p,c,u,v,a,h,g,f,O,k,S,C;return{c(){t=r("h3"),t.textContent="Organization name",o=b(),i=r("div"),n=r("p"),p=I(`What is the slug for your organization? If your repositories have a URL like
18
18
  `),c=r("code"),u=I("https://"),v=I(e[1]),a=I("/MyOrg/my-repo"),h=I(`
19
- then your organization slug is `),g=r("code"),g.textContent="MyOrg",f=I("."),O=b(),k=r("input"),s(k,"class","form-control"),s(i,"class","px-3 py-3")},m(d,_){H(d,t,_),H(d,o,_),H(d,i,_),l(i,n),l(n,p),l(n,c),l(c,u),l(c,v),l(c,a),l(n,h),l(n,g),l(n,f),l(i,O),l(i,k),M(k,e[4]),S||(C=$(k,"input",e[22]),S=!0)},p(d,_){_&2&&ce(v,d[1]),_&16&&k.value!==d[4]&&M(k,d[4])},d(d){d&&T(t),d&&T(o),d&&T(i),S=!1,C()}}}function nt(e){let t,o,i;return{c(){t=r("div"),o=I(e[9]),s(t,"class",i="alert alert-"+(e[8]?"success":"danger")),s(t,"role","alert")},m(n,p){H(n,t,p),l(t,o)},p(n,p){p&512&&ce(o,n[9]),p&256&&i!==(i="alert alert-"+(n[8]?"success":"danger"))&&s(t,"class",i)},d(n){n&&T(t)}}}function lt(e){let t;return{c(){t=r("p"),t.textContent="This button will be enabled once all the questions above are answered."},m(o,i){H(o,t,i)},p:Y,d(o){o&&T(t)}}}function Ge(e){let t,o,i,n,p,c;return{c(){t=r("p"),o=r("b"),o.textContent="WARNING:",i=I(" using a public app means anyone with access to "),n=r("code"),p=I(e[1]),c=I(`
19
+ then your organization slug is `),g=r("code"),g.textContent="MyOrg",f=I("."),O=b(),k=r("input"),s(k,"class","form-control"),s(i,"class","px-3 py-3")},m(d,_){H(d,t,_),H(d,o,_),H(d,i,_),l(i,n),l(n,p),l(n,c),l(c,u),l(c,v),l(c,a),l(n,h),l(n,g),l(n,f),l(i,O),l(i,k),M(k,e[4]),S||(C=$(k,"input",e[22]),S=!0)},p(d,_){_&2&&ce(v,d[1]),_&16&&k.value!==d[4]&&M(k,d[4])},d(d){d&&T(t),d&&T(o),d&&T(i),S=!1,C()}}}function nt(e){let t,o,i;return{c(){t=r("div"),o=I(e[9]),s(t,"class",i="alert alert-"+(e[8]?"success":"danger")),s(t,"role","alert")},m(n,p){H(n,t,p),l(t,o)},p(n,p){p&512&&ce(o,n[9]),p&256&&i!==(i="alert alert-"+(n[8]?"success":"danger"))&&s(t,"class",i)},d(n){n&&T(t)}}}function lt(e){let t;return{c(){t=r("p"),t.textContent="This button will be enabled once all the questions above are answered."},m(o,i){H(o,t,i)},p:Q,d(o){o&&T(t)}}}function Ge(e){let t,o,i,n,p,c;return{c(){t=r("p"),o=r("b"),o.textContent="WARNING:",i=I(" using a public app means anyone with access to "),n=r("code"),p=I(e[1]),c=I(`
20
20
  can use the runners you're setting up now. Anyone can create a workflow that will run on those runners,
21
21
  have access to their instance profile, and be part of their security group. Consider the security
22
- implications before continuing.`),s(o,"class","text-danger")},m(u,v){H(u,t,v),l(t,o),l(t,i),l(t,n),l(n,p),l(t,c)},p(u,v){v&2&&ce(p,u[1])},d(u){u&&T(t)}}}function it(e){let t,o,i,n,p,c,u,v,a,h,g,f,O,k,S,C,d,_,A,E,N,m,w,te,q,ne,Z,Q,V,X,B,z,pe,fe,J,le=Pe(e[2])+"",de,ie,ye,K,W,oe,se,_e,we,R=e[0]==="ghes"&&Oe(e),P=e[0]&&He(e);function Ee(y,G){if(y[2]==="newApp")return tt;if(y[2]==="existingApp")return et;if(y[2]==="pat")return xe}let F=Ee(e),L=F&&F(e);function Ae(y,G){return y[9]===void 0?lt:nt}let re=Ae(e),D=re(e),U=e[10].public&&e[2]==="newApp"&&Ge(e);return{c(){t=r("main"),o=r("div"),i=r("div"),n=r("form"),p=r("h1"),p.textContent="Setup GitHub Runners",c=b(),u=r("p"),v=I(`Answer all the questions on this page to automatically configure GitHub integration and get the
22
+ implications before continuing.`),s(o,"class","text-danger")},m(u,v){H(u,t,v),l(t,o),l(t,i),l(t,n),l(n,p),l(t,c)},p(u,v){v&2&&ce(p,u[1])},d(u){u&&T(t)}}}function it(e){let t,o,i,n,p,c,u,v,a,h,g,f,O,k,S,C,d,_,A,E,N,m,w,ne,q,le,V,X,x,ee,B,z,pe,fe,J,ie=Pe(e[2])+"",de,oe,ye,K,W,se,re,_e,we,R=e[0]==="ghes"&&Oe(e),P=e[0]&&He(e);function Ee(y,G){if(y[2]==="newApp")return tt;if(y[2]==="existingApp")return et;if(y[2]==="pat")return xe}let F=Ee(e),L=F&&F(e);function Ae(y,G){return y[9]===void 0?lt:nt}let ue=Ae(e),D=ue(e),U=e[10].public&&e[2]==="newApp"&&Ge(e);return{c(){t=r("main"),o=r("div"),i=r("div"),n=r("form"),p=r("h1"),p.textContent="Setup GitHub Runners",c=b(),u=r("p"),v=I(`Answer all the questions on this page to automatically configure GitHub integration and get the
23
23
  runners working. This page will not be accessible once you complete this operation. If you ever want
24
24
  to access it again, edit `),a=r("code"),a.textContent=`${ot}`,h=I(" and run the status function again."),g=b(),f=r("h3"),f.textContent="Choose GitHub Instance",O=b(),k=r("div"),S=r("p"),S.textContent=`Are your repositories hosted on GitHub.com or are you using an on-premise installation of GitHub
25
- Enterprise Server?`,C=b(),d=r("div"),_=r("input"),A=b(),E=r("label"),E.textContent="GitHub.com",N=b(),m=r("div"),w=r("input"),te=b(),q=r("label"),q.textContent="GitHub Enterprise Server",ne=b(),R&&R.c(),Z=b(),P&&P.c(),Q=b(),L&&L.c(),V=b(),X=r("h2"),X.textContent="Finish Setup",B=b(),z=r("div"),D.c(),pe=b(),U&&U.c(),fe=b(),J=r("button"),de=I(le),ye=b(),K=r("form"),W=r("input"),s(_,"class","form-check-input"),s(_,"type","radio"),_.__value="github.com",_.value=_.__value,s(_,"id","github.com"),e[13][0].push(_),s(E,"class","form-check-label"),s(E,"for","github.com"),s(d,"class","form-check"),s(w,"class","form-check-input"),s(w,"type","radio"),w.__value="ghes",w.value=w.__value,s(w,"id","ghes"),e[13][0].push(w),s(q,"class","form-check-label"),s(q,"for","ghes"),s(m,"class","form-check"),s(k,"class","px-3 py-3"),s(J,"type","submit"),s(J,"class","btn btn-success"),J.disabled=ie=Re(e[0],e[2],e[5],e[6],e[7],e[8]),s(z,"class","px-3 py-3"),s(n,"class","col"),s(i,"class","row"),s(o,"class","container py-3 px-2"),s(W,"type","hidden"),s(W,"name","manifest"),W.value=oe=JSON.stringify(e[10]),s(K,"action",se="https://"+e[1]+"/"+(e[3]==="org"?`organizations/${e[4]}/`:"")+"settings/apps/new?state="+ge),s(K,"method","post"),s(K,"id","appform")},m(y,G){H(y,t,G),l(t,o),l(o,i),l(i,n),l(n,p),l(n,c),l(n,u),l(u,v),l(u,a),l(u,h),l(n,g),l(n,f),l(n,O),l(n,k),l(k,S),l(k,C),l(k,d),l(d,_),_.checked=_.__value===e[0],l(d,A),l(d,E),l(k,N),l(k,m),l(m,w),w.checked=w.__value===e[0],l(m,te),l(m,q),l(n,ne),R&&R.m(n,null),l(n,Z),P&&P.m(n,null),l(n,Q),L&&L.m(n,null),l(n,V),l(n,X),l(n,B),l(n,z),D.m(z,null),l(z,pe),U&&U.m(z,null),l(z,fe),l(z,J),l(J,de),l(t,ye),l(t,K),l(K,W),_e||(we=[$(_,"change",e[12]),$(w,"change",e[14]),$(n,"submit",e[11])],_e=!0)},p(y,[G]){G&1&&(_.checked=_.__value===y[0]),G&1&&(w.checked=w.__value===y[0]),y[0]==="ghes"?R?R.p(y,G):(R=Oe(y),R.c(),R.m(n,Z)):R&&(R.d(1),R=null),y[0]?P?P.p(y,G):(P=He(y),P.c(),P.m(n,Q)):P&&(P.d(1),P=null),F===(F=Ee(y))&&L?L.p(y,G):(L&&L.d(1),L=F&&F(y),L&&(L.c(),L.m(n,V))),re===(re=Ae(y))&&D?D.p(y,G):(D.d(1),D=re(y),D&&(D.c(),D.m(z,pe))),y[10].public&&y[2]==="newApp"?U?U.p(y,G):(U=Ge(y),U.c(),U.m(z,fe)):U&&(U.d(1),U=null),G&4&&le!==(le=Pe(y[2])+"")&&ce(de,le),G&485&&ie!==(ie=Re(y[0],y[2],y[5],y[6],y[7],y[8]))&&(J.disabled=ie),G&1024&&oe!==(oe=JSON.stringify(y[10]))&&(W.value=oe),G&26&&se!==(se="https://"+y[1]+"/"+(y[3]==="org"?`organizations/${y[4]}/`:"")+"settings/apps/new?state="+ge)&&s(K,"action",se)},i:Y,o:Y,d(y){y&&T(t),e[13][0].splice(e[13][0].indexOf(_),1),e[13][0].splice(e[13][0].indexOf(w),1),R&&R.d(),P&&P.d(),L&&L.d(),D.d(),U&&U.d(),_e=!1,j(we)}}}const ot="INSERT_SECRET_ARN_HERE",ge="INSERT_TOKEN_HERE";function Re(e,t,o,i,n,p){return p||e===void 0||t===void 0?!0:t==="newApp"?!1:t==="existingApp"?o===""||i==="":t==="pat"?n==="":(console.error("Something is broken",e,t,o),!0)}function Pe(e){return e==="newApp"?"Create GitHub App":"Setup"}function me(e,t){return new Promise((o,i)=>{fetch(`${e}?token=${ge}`,{method:"POST",mode:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),redirect:"error"}).then(n=>{n.ok?n.text().then(o).catch(i):n.text().then(p=>{i(new Error(`${p} [${n.status}]`))}).catch(i)}).catch(i)})}function st(e,t,o){let i,n="INSERT_DOMAIN_HERE",p,c="user",u="ORGANIZATION",v="",a="",h="",g,f;const O={url:"https://github.com/CloudSnorkel/cdk-github-runners",hook_attributes:{url:"INSERT_WEBHOOK_URL_HERE"},redirect_url:"INSERT_BASE_URL_HERE/complete-new-app",public:!1,default_permissions:{actions:"write",administration:"write"},default_events:["workflow_job"]};function k(V){V.preventDefault();function X(){const B=i==="ghes"?n:"github.com";switch(p){case"newApp":return me("domain",{domain:B}).then(z=>(document.getElementById("appform").submit(),Promise.resolve("Redirecting to GitHub...")));case"existingApp":return me("app",{appid:v,pk:a,domain:B});case"pat":return me("pat",{pat:h,domain:B})}}X().then(B=>{o(9,f=B),o(8,g=!0)}).catch(B=>{o(9,f=`${B}`),o(8,g=!1)})}const S=[[],[],[]];function C(){i=this.__value,o(0,i)}function d(){i=this.__value,o(0,i)}function _(){n=this.value,o(1,n)}function A(){p=this.__value,o(2,p)}function E(){p=this.__value,o(2,p)}function N(){p=this.__value,o(2,p)}function m(){c=this.__value,o(3,c)}function w(){c=this.__value,o(3,c)}function te(){O.public=this.checked,o(10,O)}function q(){u=this.value,o(4,u)}function ne(){v=$e(this.value),o(5,v)}function Z(){a=this.value,o(6,a)}function Q(){h=this.value,o(7,h)}return[i,n,p,c,u,v,a,h,g,f,O,k,C,S,d,_,A,E,N,m,w,te,q,ne,Z,Q]}class rt extends Xe{constructor(t){super(),Ve(this,t,st,it,Be,{})}}new rt({target:document.getElementById("app")});
25
+ Enterprise Server?`,C=b(),d=r("div"),_=r("input"),A=b(),E=r("label"),E.textContent="GitHub.com",N=b(),m=r("div"),w=r("input"),ne=b(),q=r("label"),q.textContent="GitHub Enterprise Server",le=b(),R&&R.c(),V=b(),P&&P.c(),X=b(),L&&L.c(),x=b(),ee=r("h2"),ee.textContent="Finish Setup",B=b(),z=r("div"),D.c(),pe=b(),U&&U.c(),fe=b(),J=r("button"),de=I(ie),ye=b(),K=r("form"),W=r("input"),s(_,"class","form-check-input"),s(_,"type","radio"),_.__value="github.com",_.value=_.__value,s(_,"id","github.com"),e[13][0].push(_),s(E,"class","form-check-label"),s(E,"for","github.com"),s(d,"class","form-check"),s(w,"class","form-check-input"),s(w,"type","radio"),w.__value="ghes",w.value=w.__value,s(w,"id","ghes"),e[13][0].push(w),s(q,"class","form-check-label"),s(q,"for","ghes"),s(m,"class","form-check"),s(k,"class","px-3 py-3"),s(J,"type","submit"),s(J,"class","btn btn-success"),J.disabled=oe=Re(e[0],e[2],e[5],e[6],e[7],e[8]),s(z,"class","px-3 py-3"),s(n,"class","col"),s(i,"class","row"),s(o,"class","container py-3 px-2"),s(W,"type","hidden"),s(W,"name","manifest"),W.value=se=JSON.stringify(e[10]),s(K,"action",re="https://"+e[1]+"/"+(e[3]==="org"?`organizations/${e[4]}/`:"")+"settings/apps/new?state="+ge),s(K,"method","post"),s(K,"id","appform")},m(y,G){H(y,t,G),l(t,o),l(o,i),l(i,n),l(n,p),l(n,c),l(n,u),l(u,v),l(u,a),l(u,h),l(n,g),l(n,f),l(n,O),l(n,k),l(k,S),l(k,C),l(k,d),l(d,_),_.checked=_.__value===e[0],l(d,A),l(d,E),l(k,N),l(k,m),l(m,w),w.checked=w.__value===e[0],l(m,ne),l(m,q),l(n,le),R&&R.m(n,null),l(n,V),P&&P.m(n,null),l(n,X),L&&L.m(n,null),l(n,x),l(n,ee),l(n,B),l(n,z),D.m(z,null),l(z,pe),U&&U.m(z,null),l(z,fe),l(z,J),l(J,de),l(t,ye),l(t,K),l(K,W),_e||(we=[$(_,"change",e[12]),$(w,"change",e[14]),$(n,"submit",e[11])],_e=!0)},p(y,[G]){G&1&&(_.checked=_.__value===y[0]),G&1&&(w.checked=w.__value===y[0]),y[0]==="ghes"?R?R.p(y,G):(R=Oe(y),R.c(),R.m(n,V)):R&&(R.d(1),R=null),y[0]?P?P.p(y,G):(P=He(y),P.c(),P.m(n,X)):P&&(P.d(1),P=null),F===(F=Ee(y))&&L?L.p(y,G):(L&&L.d(1),L=F&&F(y),L&&(L.c(),L.m(n,x))),ue===(ue=Ae(y))&&D?D.p(y,G):(D.d(1),D=ue(y),D&&(D.c(),D.m(z,pe))),y[10].public&&y[2]==="newApp"?U?U.p(y,G):(U=Ge(y),U.c(),U.m(z,fe)):U&&(U.d(1),U=null),G&4&&ie!==(ie=Pe(y[2])+"")&&ce(de,ie),G&485&&oe!==(oe=Re(y[0],y[2],y[5],y[6],y[7],y[8]))&&(J.disabled=oe),G&1024&&se!==(se=JSON.stringify(y[10]))&&(W.value=se),G&26&&re!==(re="https://"+y[1]+"/"+(y[3]==="org"?`organizations/${y[4]}/`:"")+"settings/apps/new?state="+ge)&&s(K,"action",re)},i:Q,o:Q,d(y){y&&T(t),e[13][0].splice(e[13][0].indexOf(_),1),e[13][0].splice(e[13][0].indexOf(w),1),R&&R.d(),P&&P.d(),L&&L.d(),D.d(),U&&U.d(),_e=!1,j(we)}}}const ot="INSERT_SECRET_ARN_HERE",ge="INSERT_TOKEN_HERE";function Re(e,t,o,i,n,p){return p||e===void 0||t===void 0?!0:t==="newApp"?!1:t==="existingApp"?o===""||i==="":t==="pat"?n==="":(console.error("Something is broken",e,t,o),!0)}function Pe(e){return e==="newApp"?"Create GitHub App":"Setup"}function me(e,t){return new Promise((o,i)=>{fetch(`${e}?token=${ge}`,{method:"POST",mode:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),redirect:"error"}).then(n=>{n.ok?n.text().then(o).catch(i):n.text().then(p=>{i(new Error(`${p} [${n.status}]`))}).catch(i)}).catch(i)})}function st(e,t,o){let i,n="INSERT_DOMAIN_HERE",p,c="user",u="ORGANIZATION",v="",a="",h="",g,f;const O={url:"https://github.com/CloudSnorkel/cdk-github-runners",hook_attributes:{url:"INSERT_WEBHOOK_URL_HERE"},redirect_url:"INSERT_BASE_URL_HERE/complete-new-app",public:!1,default_permissions:{actions:"write",administration:"write"},default_events:["workflow_job"]};function k(x){x.preventDefault();function ee(){const B=i==="ghes"?n:"github.com";switch(p){case"newApp":return me("domain",{domain:B}).then(z=>(document.getElementById("appform").submit(),Promise.resolve("Redirecting to GitHub...")));case"existingApp":return me("app",{appid:v,pk:a,domain:B});case"pat":return me("pat",{pat:h,domain:B})}}ee().then(B=>{o(9,f=B),o(8,g=!0)}).catch(B=>{o(9,f=`${B}`),o(8,g=!1)})}const S=[[],[],[]];function C(){i=this.__value,o(0,i)}function d(){i=this.__value,o(0,i)}function _(){n=this.value,o(1,n)}function A(){p=this.__value,o(2,p)}function E(){p=this.__value,o(2,p)}function N(){p=this.__value,o(2,p)}function m(){c=this.__value,o(3,c)}function w(){c=this.__value,o(3,c)}function ne(){O.public=this.checked,o(10,O)}function q(){u=this.value,o(4,u)}function le(){v=$e(this.value),o(5,v)}function V(){a=this.value,o(6,a)}function X(){h=this.value,o(7,h)}return[i,n,p,c,u,v,a,h,g,f,O,k,C,S,d,_,A,E,N,m,w,ne,q,le,V,X]}class rt extends Xe{constructor(t){super(),Ve(this,t,st,it,Be,{})}}new rt({target:document.getElementById("app")});
26
26
 
27
27
  </script>
28
28
  <style type="text/css">
@@ -6992,6 +6992,11 @@ var require_lib3 = __commonJS({
6992
6992
  const dest = new URL$1(destination).hostname;
6993
6993
  return orig === dest || orig[orig.length - dest.length - 1] === "." && orig.endsWith(dest);
6994
6994
  };
6995
+ var isSameProtocol = function isSameProtocol2(destination, original) {
6996
+ const orig = new URL$1(original).protocol;
6997
+ const dest = new URL$1(destination).protocol;
6998
+ return orig === dest;
6999
+ };
6995
7000
  function fetch(url, opts) {
6996
7001
  if (!fetch.Promise) {
6997
7002
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
@@ -7007,7 +7012,7 @@ var require_lib3 = __commonJS({
7007
7012
  let error = new AbortError("The user aborted a request.");
7008
7013
  reject(error);
7009
7014
  if (request.body && request.body instanceof Stream.Readable) {
7010
- request.body.destroy(error);
7015
+ destroyStream(request.body, error);
7011
7016
  }
7012
7017
  if (!response2 || !response2.body)
7013
7018
  return;
@@ -7042,8 +7047,29 @@ var require_lib3 = __commonJS({
7042
7047
  }
7043
7048
  req.on("error", function(err) {
7044
7049
  reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, "system", err));
7050
+ if (response2 && response2.body) {
7051
+ destroyStream(response2.body, err);
7052
+ }
7045
7053
  finalize();
7046
7054
  });
7055
+ fixResponseChunkedTransferBadEnding(req, function(err) {
7056
+ if (signal && signal.aborted) {
7057
+ return;
7058
+ }
7059
+ destroyStream(response2.body, err);
7060
+ });
7061
+ if (parseInt(process.version.substring(1)) < 14) {
7062
+ req.on("socket", function(s) {
7063
+ s.addListener("close", function(hadError) {
7064
+ const hasDataListener = s.listenerCount("data") > 0;
7065
+ if (response2 && hasDataListener && !hadError && !(signal && signal.aborted)) {
7066
+ const err = new Error("Premature close");
7067
+ err.code = "ERR_STREAM_PREMATURE_CLOSE";
7068
+ response2.body.emit("error", err);
7069
+ }
7070
+ });
7071
+ });
7072
+ }
7047
7073
  req.on("response", function(res) {
7048
7074
  clearTimeout(reqTimeout);
7049
7075
  const headers = createHeadersLenient(res.headers);
@@ -7094,7 +7120,7 @@ var require_lib3 = __commonJS({
7094
7120
  timeout: request.timeout,
7095
7121
  size: request.size
7096
7122
  };
7097
- if (!isDomainOrSubdomain(request.url, locationURL)) {
7123
+ if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
7098
7124
  for (const name of ["authorization", "www-authenticate", "cookie", "cookie2"]) {
7099
7125
  requestOpts.headers.delete(name);
7100
7126
  }
@@ -7155,6 +7181,12 @@ var require_lib3 = __commonJS({
7155
7181
  response2 = new Response(body, response_options);
7156
7182
  resolve(response2);
7157
7183
  });
7184
+ raw.on("end", function() {
7185
+ if (!response2) {
7186
+ response2 = new Response(body, response_options);
7187
+ resolve(response2);
7188
+ }
7189
+ });
7158
7190
  return;
7159
7191
  }
7160
7192
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
@@ -7169,6 +7201,33 @@ var require_lib3 = __commonJS({
7169
7201
  writeToStream(req, request);
7170
7202
  });
7171
7203
  }
7204
+ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
7205
+ let socket;
7206
+ request.on("socket", function(s) {
7207
+ socket = s;
7208
+ });
7209
+ request.on("response", function(response2) {
7210
+ const headers = response2.headers;
7211
+ if (headers["transfer-encoding"] === "chunked" && !headers["content-length"]) {
7212
+ response2.once("close", function(hadError) {
7213
+ const hasDataListener = socket.listenerCount("data") > 0;
7214
+ if (hasDataListener && !hadError) {
7215
+ const err = new Error("Premature close");
7216
+ err.code = "ERR_STREAM_PREMATURE_CLOSE";
7217
+ errorCallback(err);
7218
+ }
7219
+ });
7220
+ }
7221
+ });
7222
+ }
7223
+ function destroyStream(stream, err) {
7224
+ if (stream.destroy) {
7225
+ stream.destroy(err);
7226
+ } else {
7227
+ stream.emit("error", err);
7228
+ stream.end();
7229
+ }
7230
+ }
7172
7231
  fetch.isRedirect = function(code) {
7173
7232
  return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
7174
7233
  };
@@ -6849,6 +6849,11 @@ var require_lib3 = __commonJS({
6849
6849
  const dest = new URL$1(destination).hostname;
6850
6850
  return orig === dest || orig[orig.length - dest.length - 1] === "." && orig.endsWith(dest);
6851
6851
  };
6852
+ var isSameProtocol = function isSameProtocol2(destination, original) {
6853
+ const orig = new URL$1(original).protocol;
6854
+ const dest = new URL$1(destination).protocol;
6855
+ return orig === dest;
6856
+ };
6852
6857
  function fetch(url, opts) {
6853
6858
  if (!fetch.Promise) {
6854
6859
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
@@ -6864,7 +6869,7 @@ var require_lib3 = __commonJS({
6864
6869
  let error = new AbortError("The user aborted a request.");
6865
6870
  reject(error);
6866
6871
  if (request.body && request.body instanceof Stream.Readable) {
6867
- request.body.destroy(error);
6872
+ destroyStream(request.body, error);
6868
6873
  }
6869
6874
  if (!response || !response.body)
6870
6875
  return;
@@ -6899,8 +6904,29 @@ var require_lib3 = __commonJS({
6899
6904
  }
6900
6905
  req.on("error", function(err) {
6901
6906
  reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, "system", err));
6907
+ if (response && response.body) {
6908
+ destroyStream(response.body, err);
6909
+ }
6902
6910
  finalize();
6903
6911
  });
6912
+ fixResponseChunkedTransferBadEnding(req, function(err) {
6913
+ if (signal && signal.aborted) {
6914
+ return;
6915
+ }
6916
+ destroyStream(response.body, err);
6917
+ });
6918
+ if (parseInt(process.version.substring(1)) < 14) {
6919
+ req.on("socket", function(s) {
6920
+ s.addListener("close", function(hadError) {
6921
+ const hasDataListener = s.listenerCount("data") > 0;
6922
+ if (response && hasDataListener && !hadError && !(signal && signal.aborted)) {
6923
+ const err = new Error("Premature close");
6924
+ err.code = "ERR_STREAM_PREMATURE_CLOSE";
6925
+ response.body.emit("error", err);
6926
+ }
6927
+ });
6928
+ });
6929
+ }
6904
6930
  req.on("response", function(res) {
6905
6931
  clearTimeout(reqTimeout);
6906
6932
  const headers = createHeadersLenient(res.headers);
@@ -6951,7 +6977,7 @@ var require_lib3 = __commonJS({
6951
6977
  timeout: request.timeout,
6952
6978
  size: request.size
6953
6979
  };
6954
- if (!isDomainOrSubdomain(request.url, locationURL)) {
6980
+ if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
6955
6981
  for (const name of ["authorization", "www-authenticate", "cookie", "cookie2"]) {
6956
6982
  requestOpts.headers.delete(name);
6957
6983
  }
@@ -7012,6 +7038,12 @@ var require_lib3 = __commonJS({
7012
7038
  response = new Response(body, response_options);
7013
7039
  resolve(response);
7014
7040
  });
7041
+ raw.on("end", function() {
7042
+ if (!response) {
7043
+ response = new Response(body, response_options);
7044
+ resolve(response);
7045
+ }
7046
+ });
7015
7047
  return;
7016
7048
  }
7017
7049
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
@@ -7026,6 +7058,33 @@ var require_lib3 = __commonJS({
7026
7058
  writeToStream(req, request);
7027
7059
  });
7028
7060
  }
7061
+ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
7062
+ let socket;
7063
+ request.on("socket", function(s) {
7064
+ socket = s;
7065
+ });
7066
+ request.on("response", function(response) {
7067
+ const headers = response.headers;
7068
+ if (headers["transfer-encoding"] === "chunked" && !headers["content-length"]) {
7069
+ response.once("close", function(hadError) {
7070
+ const hasDataListener = socket.listenerCount("data") > 0;
7071
+ if (hasDataListener && !hadError) {
7072
+ const err = new Error("Premature close");
7073
+ err.code = "ERR_STREAM_PREMATURE_CLOSE";
7074
+ errorCallback(err);
7075
+ }
7076
+ });
7077
+ }
7078
+ });
7079
+ }
7080
+ function destroyStream(stream, err) {
7081
+ if (stream.destroy) {
7082
+ stream.destroy(err);
7083
+ } else {
7084
+ stream.emit("error", err);
7085
+ stream.end();
7086
+ }
7087
+ }
7029
7088
  fetch.isRedirect = function(code) {
7030
7089
  return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
7031
7090
  };
@@ -8785,7 +8844,7 @@ var require_dist_node14 = __commonJS({
8785
8844
  var authOauthDevice = require_dist_node13();
8786
8845
  var oauthMethods = require_dist_node12();
8787
8846
  var btoa = _interopDefault(require_btoa_node());
8788
- var VERSION = "2.0.4";
8847
+ var VERSION = "2.1.0";
8789
8848
  async function getAuthentication(state) {
8790
8849
  if ("code" in state.strategyOptions) {
8791
8850
  const {
@@ -8794,6 +8853,7 @@ var require_dist_node14 = __commonJS({
8794
8853
  clientId: state.clientId,
8795
8854
  clientSecret: state.clientSecret,
8796
8855
  clientType: state.clientType,
8856
+ onTokenCreated: state.onTokenCreated,
8797
8857
  ...state.strategyOptions,
8798
8858
  request: state.request
8799
8859
  });
@@ -8807,6 +8867,7 @@ var require_dist_node14 = __commonJS({
8807
8867
  const deviceAuth = authOauthDevice.createOAuthDeviceAuth({
8808
8868
  clientType: state.clientType,
8809
8869
  clientId: state.clientId,
8870
+ onTokenCreated: state.onTokenCreated,
8810
8871
  ...state.strategyOptions,
8811
8872
  request: state.request
8812
8873
  });
@@ -8825,6 +8886,7 @@ var require_dist_node14 = __commonJS({
8825
8886
  clientId: state.clientId,
8826
8887
  clientSecret: state.clientSecret,
8827
8888
  clientType: state.clientType,
8889
+ onTokenCreated: state.onTokenCreated,
8828
8890
  ...state.strategyOptions
8829
8891
  };
8830
8892
  }
@@ -8857,12 +8919,16 @@ var require_dist_node14 = __commonJS({
8857
8919
  }
8858
8920
  }
8859
8921
  if (options.type === "refresh") {
8922
+ var _state$onTokenCreated;
8860
8923
  if (state.clientType === "oauth-app") {
8861
8924
  throw new Error("[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens");
8862
8925
  }
8863
8926
  if (!currentAuthentication.hasOwnProperty("expiresAt")) {
8864
8927
  throw new Error("[@octokit/auth-oauth-user] Refresh token missing");
8865
8928
  }
8929
+ await ((_state$onTokenCreated = state.onTokenCreated) === null || _state$onTokenCreated === void 0 ? void 0 : _state$onTokenCreated.call(state, state.authentication, {
8930
+ type: options.type
8931
+ }));
8866
8932
  }
8867
8933
  if (options.type === "check" || options.type === "reset") {
8868
8934
  const method = options.type === "check" ? oauthMethods.checkToken : oauthMethods.resetToken;
@@ -8883,6 +8949,12 @@ var require_dist_node14 = __commonJS({
8883
8949
  // @ts-expect-error TBD
8884
8950
  ...authentication
8885
8951
  };
8952
+ if (options.type === "reset") {
8953
+ var _state$onTokenCreated2;
8954
+ await ((_state$onTokenCreated2 = state.onTokenCreated) === null || _state$onTokenCreated2 === void 0 ? void 0 : _state$onTokenCreated2.call(state, state.authentication, {
8955
+ type: options.type
8956
+ }));
8957
+ }
8886
8958
  return state.authentication;
8887
8959
  } catch (error) {
8888
8960
  if (error.status === 404) {
@@ -8947,12 +9019,14 @@ var require_dist_node14 = __commonJS({
8947
9019
  "user-agent": `octokit-auth-oauth-app.js/${VERSION} ${universalUserAgent.getUserAgent()}`
8948
9020
  }
8949
9021
  }),
9022
+ onTokenCreated,
8950
9023
  ...strategyOptions
8951
9024
  }) {
8952
9025
  const state = Object.assign({
8953
9026
  clientType,
8954
9027
  clientId,
8955
9028
  clientSecret,
9029
+ onTokenCreated,
8956
9030
  strategyOptions,
8957
9031
  request: request$1
8958
9032
  });
@@ -13796,7 +13870,9 @@ var require_lodash = __commonJS({
13796
13870
  var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
13797
13871
  for (var key in value) {
13798
13872
  if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
13799
- (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
13873
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
13874
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
13875
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
13800
13876
  isIndex(key, length)))) {
13801
13877
  result2.push(key);
13802
13878
  }
@@ -6849,6 +6849,11 @@ var require_lib3 = __commonJS({
6849
6849
  const dest = new URL$1(destination).hostname;
6850
6850
  return orig === dest || orig[orig.length - dest.length - 1] === "." && orig.endsWith(dest);
6851
6851
  };
6852
+ var isSameProtocol = function isSameProtocol2(destination, original) {
6853
+ const orig = new URL$1(original).protocol;
6854
+ const dest = new URL$1(destination).protocol;
6855
+ return orig === dest;
6856
+ };
6852
6857
  function fetch(url, opts) {
6853
6858
  if (!fetch.Promise) {
6854
6859
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
@@ -6864,7 +6869,7 @@ var require_lib3 = __commonJS({
6864
6869
  let error = new AbortError("The user aborted a request.");
6865
6870
  reject(error);
6866
6871
  if (request.body && request.body instanceof Stream.Readable) {
6867
- request.body.destroy(error);
6872
+ destroyStream(request.body, error);
6868
6873
  }
6869
6874
  if (!response || !response.body)
6870
6875
  return;
@@ -6899,8 +6904,29 @@ var require_lib3 = __commonJS({
6899
6904
  }
6900
6905
  req.on("error", function(err) {
6901
6906
  reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, "system", err));
6907
+ if (response && response.body) {
6908
+ destroyStream(response.body, err);
6909
+ }
6902
6910
  finalize();
6903
6911
  });
6912
+ fixResponseChunkedTransferBadEnding(req, function(err) {
6913
+ if (signal && signal.aborted) {
6914
+ return;
6915
+ }
6916
+ destroyStream(response.body, err);
6917
+ });
6918
+ if (parseInt(process.version.substring(1)) < 14) {
6919
+ req.on("socket", function(s) {
6920
+ s.addListener("close", function(hadError) {
6921
+ const hasDataListener = s.listenerCount("data") > 0;
6922
+ if (response && hasDataListener && !hadError && !(signal && signal.aborted)) {
6923
+ const err = new Error("Premature close");
6924
+ err.code = "ERR_STREAM_PREMATURE_CLOSE";
6925
+ response.body.emit("error", err);
6926
+ }
6927
+ });
6928
+ });
6929
+ }
6904
6930
  req.on("response", function(res) {
6905
6931
  clearTimeout(reqTimeout);
6906
6932
  const headers = createHeadersLenient(res.headers);
@@ -6951,7 +6977,7 @@ var require_lib3 = __commonJS({
6951
6977
  timeout: request.timeout,
6952
6978
  size: request.size
6953
6979
  };
6954
- if (!isDomainOrSubdomain(request.url, locationURL)) {
6980
+ if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
6955
6981
  for (const name of ["authorization", "www-authenticate", "cookie", "cookie2"]) {
6956
6982
  requestOpts.headers.delete(name);
6957
6983
  }
@@ -7012,6 +7038,12 @@ var require_lib3 = __commonJS({
7012
7038
  response = new Response(body, response_options);
7013
7039
  resolve(response);
7014
7040
  });
7041
+ raw.on("end", function() {
7042
+ if (!response) {
7043
+ response = new Response(body, response_options);
7044
+ resolve(response);
7045
+ }
7046
+ });
7015
7047
  return;
7016
7048
  }
7017
7049
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
@@ -7026,6 +7058,33 @@ var require_lib3 = __commonJS({
7026
7058
  writeToStream(req, request);
7027
7059
  });
7028
7060
  }
7061
+ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
7062
+ let socket;
7063
+ request.on("socket", function(s) {
7064
+ socket = s;
7065
+ });
7066
+ request.on("response", function(response) {
7067
+ const headers = response.headers;
7068
+ if (headers["transfer-encoding"] === "chunked" && !headers["content-length"]) {
7069
+ response.once("close", function(hadError) {
7070
+ const hasDataListener = socket.listenerCount("data") > 0;
7071
+ if (hasDataListener && !hadError) {
7072
+ const err = new Error("Premature close");
7073
+ err.code = "ERR_STREAM_PREMATURE_CLOSE";
7074
+ errorCallback(err);
7075
+ }
7076
+ });
7077
+ }
7078
+ });
7079
+ }
7080
+ function destroyStream(stream, err) {
7081
+ if (stream.destroy) {
7082
+ stream.destroy(err);
7083
+ } else {
7084
+ stream.emit("error", err);
7085
+ stream.end();
7086
+ }
7087
+ }
7029
7088
  fetch.isRedirect = function(code) {
7030
7089
  return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
7031
7090
  };
@@ -8785,7 +8844,7 @@ var require_dist_node14 = __commonJS({
8785
8844
  var authOauthDevice = require_dist_node13();
8786
8845
  var oauthMethods = require_dist_node12();
8787
8846
  var btoa = _interopDefault(require_btoa_node());
8788
- var VERSION = "2.0.4";
8847
+ var VERSION = "2.1.0";
8789
8848
  async function getAuthentication(state) {
8790
8849
  if ("code" in state.strategyOptions) {
8791
8850
  const {
@@ -8794,6 +8853,7 @@ var require_dist_node14 = __commonJS({
8794
8853
  clientId: state.clientId,
8795
8854
  clientSecret: state.clientSecret,
8796
8855
  clientType: state.clientType,
8856
+ onTokenCreated: state.onTokenCreated,
8797
8857
  ...state.strategyOptions,
8798
8858
  request: state.request
8799
8859
  });
@@ -8807,6 +8867,7 @@ var require_dist_node14 = __commonJS({
8807
8867
  const deviceAuth = authOauthDevice.createOAuthDeviceAuth({
8808
8868
  clientType: state.clientType,
8809
8869
  clientId: state.clientId,
8870
+ onTokenCreated: state.onTokenCreated,
8810
8871
  ...state.strategyOptions,
8811
8872
  request: state.request
8812
8873
  });
@@ -8825,6 +8886,7 @@ var require_dist_node14 = __commonJS({
8825
8886
  clientId: state.clientId,
8826
8887
  clientSecret: state.clientSecret,
8827
8888
  clientType: state.clientType,
8889
+ onTokenCreated: state.onTokenCreated,
8828
8890
  ...state.strategyOptions
8829
8891
  };
8830
8892
  }
@@ -8857,12 +8919,16 @@ var require_dist_node14 = __commonJS({
8857
8919
  }
8858
8920
  }
8859
8921
  if (options.type === "refresh") {
8922
+ var _state$onTokenCreated;
8860
8923
  if (state.clientType === "oauth-app") {
8861
8924
  throw new Error("[@octokit/auth-oauth-user] OAuth Apps do not support expiring tokens");
8862
8925
  }
8863
8926
  if (!currentAuthentication.hasOwnProperty("expiresAt")) {
8864
8927
  throw new Error("[@octokit/auth-oauth-user] Refresh token missing");
8865
8928
  }
8929
+ await ((_state$onTokenCreated = state.onTokenCreated) === null || _state$onTokenCreated === void 0 ? void 0 : _state$onTokenCreated.call(state, state.authentication, {
8930
+ type: options.type
8931
+ }));
8866
8932
  }
8867
8933
  if (options.type === "check" || options.type === "reset") {
8868
8934
  const method = options.type === "check" ? oauthMethods.checkToken : oauthMethods.resetToken;
@@ -8883,6 +8949,12 @@ var require_dist_node14 = __commonJS({
8883
8949
  // @ts-expect-error TBD
8884
8950
  ...authentication
8885
8951
  };
8952
+ if (options.type === "reset") {
8953
+ var _state$onTokenCreated2;
8954
+ await ((_state$onTokenCreated2 = state.onTokenCreated) === null || _state$onTokenCreated2 === void 0 ? void 0 : _state$onTokenCreated2.call(state, state.authentication, {
8955
+ type: options.type
8956
+ }));
8957
+ }
8886
8958
  return state.authentication;
8887
8959
  } catch (error) {
8888
8960
  if (error.status === 404) {
@@ -8947,12 +9019,14 @@ var require_dist_node14 = __commonJS({
8947
9019
  "user-agent": `octokit-auth-oauth-app.js/${VERSION} ${universalUserAgent.getUserAgent()}`
8948
9020
  }
8949
9021
  }),
9022
+ onTokenCreated,
8950
9023
  ...strategyOptions
8951
9024
  }) {
8952
9025
  const state = Object.assign({
8953
9026
  clientType,
8954
9027
  clientId,
8955
9028
  clientSecret,
9029
+ onTokenCreated,
8956
9030
  strategyOptions,
8957
9031
  request: request$1
8958
9032
  });
@@ -13796,7 +13870,9 @@ var require_lodash = __commonJS({
13796
13870
  var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
13797
13871
  for (var key in value) {
13798
13872
  if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
13799
- (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
13873
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
13874
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
13875
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
13800
13876
  isIndex(key, length)))) {
13801
13877
  result2.push(key);
13802
13878
  }