khoros-aurora-sdk 25.3.0 → 25.3.1
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.
- package/build-hash.txt +1 -1
- package/package.json +2 -2
- package/scripts/buildPluginCli.js +6 -6
- package/scripts/formatPluginCli.js +5 -5
- package/scripts/generateCli.js +5 -5
- package/scripts/initPluginCli.js +4 -4
- package/scripts/pluginLoggerCli.js +4 -4
- package/scripts/pluginPreviewCli.js +4 -4
- package/scripts/validatePluginCli.js +4 -4
- package/types/graphql-schema-types.ts +1467 -96
- package/types/mf/index.d.ts +1296 -90
- package/types/pkg/index.d.ts +1296 -90
package/build-hash.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
8440039
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "khoros-aurora-sdk",
|
|
3
|
-
"version": "25.3.
|
|
3
|
+
"version": "25.3.1",
|
|
4
4
|
"author": "Khoros, LLC",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Khoros_Aurora_SDK",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@graphql-codegen/typescript-document-nodes": "~4.0.0",
|
|
44
44
|
"@graphql-codegen/typescript-graphql-files-modules": "~3.0.0",
|
|
45
45
|
"@graphql-codegen/typescript-operations": "~4.0.0",
|
|
46
|
-
"@module-federation/nextjs-mf": "
|
|
46
|
+
"@module-federation/nextjs-mf": "8.8.11",
|
|
47
47
|
"@types/express-serve-static-core": "~4.19.5",
|
|
48
48
|
"@types/qs": "^6.9.15",
|
|
49
49
|
"@types/range-parser": "^1.2.7",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var ro=Object.create;var ut=Object.defineProperty;var no=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,io=Object.prototype.hasOwnProperty;var Z=(e,t)=>()=>(e&&(t=e(e=0)),t);var B=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ka=(e,t)=>{for(var a in t)ut(e,a,{get:t[a],enumerable:!0})},qa=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of oo(t))!io.call(e,n)&&n!==a&&ut(e,n,{get:()=>t[n],enumerable:!(r=no(t,n))||r.enumerable});return e};var m=(e,t,a)=>(a=e!=null?ro(so(e)):{},qa(t||!e||!e.__esModule?ut(a,"default",{value:e,enumerable:!0}):a,e)),Ga=e=>qa(ut({},"__esModule",{value:!0}),e);var er,Le=Z(()=>{"use strict";er=require("exenv");if(process.env.NODE_ENV!=="test"&&er.canUseDOM)throw new Error("This code should never be exposed in the client bundle")});var tr=Z(()=>{"use strict"});var ar=B(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.isAlsSupported=pe.getNodeVersion=pe.nodeVersionString=void 0;pe.nodeVersionString=process.versions.node;function mo(e){let[t,a,r]=e.split(".");return{majorVersion:Number.parseInt(t),minorVersion:Number.parseInt(a),patchVersion:Number.parseInt(r)}}pe.getNodeVersion=mo;function Co(e){let{majorVersion:t,minorVersion:a}=e;return t>13?!0:t<12?!1:t===12?a>=17:t===13?a>=10:!1}pe.isAlsSupported=Co});var rr=B(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.als=void 0;var Ao=require("async_hooks"),zt=new Ao.AsyncLocalStorage;me.als={storageImplementation:"AsyncLocalStorage",get:e=>{let t=zt.getStore();return t?.get(e)},set:(e,t)=>{let a=zt.getStore();a?.set(e,t)},runWith:(e,t)=>{let a=t?new Map(Object.entries(t)):new Map;zt.run(a,()=>{e()})}};me.default=me.als});var Cr=B((M,mr)=>{M=mr.exports=b;var P;typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?P=function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:P=function(){};M.SEMVER_SPEC_VERSION="2.0.0";var Jt=256,ct=Number.MAX_SAFE_INTEGER||9007199254740991,Yt=16,f=M.re=[],l=M.src=[],I=0,Ce=I++;l[Ce]="0|[1-9]\\d*";var Ae=I++;l[Ae]="[0-9]+";var ea=I++;l[ea]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var or=I++;l[or]="("+l[Ce]+")\\.("+l[Ce]+")\\.("+l[Ce]+")";var sr=I++;l[sr]="("+l[Ae]+")\\.("+l[Ae]+")\\.("+l[Ae]+")";var $t=I++;l[$t]="(?:"+l[Ce]+"|"+l[ea]+")";var Xt=I++;l[Xt]="(?:"+l[Ae]+"|"+l[ea]+")";var ta=I++;l[ta]="(?:-("+l[$t]+"(?:\\."+l[$t]+")*))";var aa=I++;l[aa]="(?:-?("+l[Xt]+"(?:\\."+l[Xt]+")*))";var Zt=I++;l[Zt]="[0-9A-Za-z-]+";var Ve=I++;l[Ve]="(?:\\+("+l[Zt]+"(?:\\."+l[Zt]+")*))";var ra=I++,ir="v?"+l[or]+l[ta]+"?"+l[Ve]+"?";l[ra]="^"+ir+"$";var na="[v=\\s]*"+l[sr]+l[aa]+"?"+l[Ve]+"?",oa=I++;l[oa]="^"+na+"$";var Re=I++;l[Re]="((?:<|>)?=?)";var St=I++;l[St]=l[Ae]+"|x|X|\\*";var dt=I++;l[dt]=l[Ce]+"|x|X|\\*";var de=I++;l[de]="[v=\\s]*("+l[dt]+")(?:\\.("+l[dt]+")(?:\\.("+l[dt]+")(?:"+l[ta]+")?"+l[Ve]+"?)?)?";var Pe=I++;l[Pe]="[v=\\s]*("+l[St]+")(?:\\.("+l[St]+")(?:\\.("+l[St]+")(?:"+l[aa]+")?"+l[Ve]+"?)?)?";var pr=I++;l[pr]="^"+l[Re]+"\\s*"+l[de]+"$";var ur=I++;l[ur]="^"+l[Re]+"\\s*"+l[Pe]+"$";var lr=I++;l[lr]="(?:^|[^\\d])(\\d{1,"+Yt+"})(?:\\.(\\d{1,"+Yt+"}))?(?:\\.(\\d{1,"+Yt+"}))?(?:$|[^\\d])";var Ct=I++;l[Ct]="(?:~>?)";var gt=I++;l[gt]="(\\s*)"+l[Ct]+"\\s+";f[gt]=new RegExp(l[gt],"g");var Eo="$1~",yr=I++;l[yr]="^"+l[Ct]+l[de]+"$";var cr=I++;l[cr]="^"+l[Ct]+l[Pe]+"$";var At=I++;l[At]="(?:\\^)";var Mt=I++;l[Mt]="(\\s*)"+l[At]+"\\s+";f[Mt]=new RegExp(l[Mt],"g");var Po="$1^",Sr=I++;l[Sr]="^"+l[At]+l[de]+"$";var dr=I++;l[dr]="^"+l[At]+l[Pe]+"$";var sa=I++;l[sa]="^"+l[Re]+"\\s*("+na+")$|^$";var ia=I++;l[ia]="^"+l[Re]+"\\s*("+ir+")$|^$";var Oe=I++;l[Oe]="(\\s*)"+l[Re]+"\\s*("+na+"|"+l[de]+")";f[Oe]=new RegExp(l[Oe],"g");var Ro="$1$2$3",gr=I++;l[gr]="^\\s*("+l[de]+")\\s+-\\s+("+l[de]+")\\s*$";var Mr=I++;l[Mr]="^\\s*("+l[Pe]+")\\s+-\\s+("+l[Pe]+")\\s*$";var Ir=I++;l[Ir]="(<|>)?=?\\s*\\*";for(ue=0;ue<I;ue++)P(ue,l[ue]),f[ue]||(f[ue]=new RegExp(l[ue]));var ue;M.parse=ge;function ge(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof b)return e;if(typeof e!="string"||e.length>Jt)return null;var a=t.loose?f[oa]:f[ra];if(!a.test(e))return null;try{return new b(e,t)}catch{return null}}M.valid=To;function To(e,t){var a=ge(e,t);return a?a.version:null}M.clean=fo;function fo(e,t){var a=ge(e.trim().replace(/^[=v]+/,""),t);return a?a.version:null}M.SemVer=b;function b(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof b){if(e.loose===t.loose)return e;e=e.version}else if(typeof e!="string")throw new TypeError("Invalid Version: "+e);if(e.length>Jt)throw new TypeError("version is longer than "+Jt+" characters");if(!(this instanceof b))return new b(e,t);P("SemVer",e,t),this.options=t,this.loose=!!t.loose;var a=e.trim().match(t.loose?f[oa]:f[ra]);if(!a)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+a[1],this.minor=+a[2],this.patch=+a[3],this.major>ct||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ct||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ct||this.patch<0)throw new TypeError("Invalid patch version");a[4]?this.prerelease=a[4].split(".").map(function(r){if(/^[0-9]+$/.test(r)){var n=+r;if(n>=0&&n<ct)return n}return r}):this.prerelease=[],this.build=a[5]?a[5].split("."):[],this.format()}b.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version};b.prototype.toString=function(){return this.version};b.prototype.compare=function(e){return P("SemVer.compare",this.version,this.options,e),e instanceof b||(e=new b(e,this.options)),this.compareMain(e)||this.comparePre(e)};b.prototype.compareMain=function(e){return e instanceof b||(e=new b(e,this.options)),Ee(this.major,e.major)||Ee(this.minor,e.minor)||Ee(this.patch,e.patch)};b.prototype.comparePre=function(e){if(e instanceof b||(e=new b(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var t=0;do{var a=this.prerelease[t],r=e.prerelease[t];if(P("prerelease compare",t,a,r),a===void 0&&r===void 0)return 0;if(r===void 0)return 1;if(a===void 0)return-1;if(a===r)continue;return Ee(a,r)}while(++t)};b.prototype.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t),this.inc("pre",t);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{for(var a=this.prerelease.length;--a>=0;)typeof this.prerelease[a]=="number"&&(this.prerelease[a]++,a=-2);a===-1&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this};M.inc=vo;function vo(e,t,a,r){typeof a=="string"&&(r=a,a=void 0);try{return new b(e,a).inc(t,r).version}catch{return null}}M.diff=xo;function xo(e,t){if(pa(e,t))return null;var a=ge(e),r=ge(t),n="";if(a.prerelease.length||r.prerelease.length){n="pre";var o="prerelease"}for(var s in a)if((s==="major"||s==="minor"||s==="patch")&&a[s]!==r[s])return n+s;return o}M.compareIdentifiers=Ee;var nr=/^[0-9]+$/;function Ee(e,t){var a=nr.test(e),r=nr.test(t);return a&&r&&(e=+e,t=+t),e===t?0:a&&!r?-1:r&&!a?1:e<t?-1:1}M.rcompareIdentifiers=ho;function ho(e,t){return Ee(t,e)}M.major=Fo;function Fo(e,t){return new b(e,t).major}M.minor=_o;function _o(e,t){return new b(e,t).minor}M.patch=No;function No(e,t){return new b(e,t).patch}M.compare=re;function re(e,t,a){return new b(e,a).compare(new b(t,a))}M.compareLoose=Do;function Do(e,t){return re(e,t,!0)}M.rcompare=Bo;function Bo(e,t,a){return re(t,e,a)}M.sort=Lo;function Lo(e,t){return e.sort(function(a,r){return M.compare(a,r,t)})}M.rsort=Oo;function Oo(e,t){return e.sort(function(a,r){return M.rcompare(a,r,t)})}M.gt=Ue;function Ue(e,t,a){return re(e,t,a)>0}M.lt=It;function It(e,t,a){return re(e,t,a)<0}M.eq=pa;function pa(e,t,a){return re(e,t,a)===0}M.neq=br;function br(e,t,a){return re(e,t,a)!==0}M.gte=ua;function ua(e,t,a){return re(e,t,a)>=0}M.lte=la;function la(e,t,a){return re(e,t,a)<=0}M.cmp=bt;function bt(e,t,a,r){switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof a=="object"&&(a=a.version),e===a;case"!==":return typeof e=="object"&&(e=e.version),typeof a=="object"&&(a=a.version),e!==a;case"":case"=":case"==":return pa(e,a,r);case"!=":return br(e,a,r);case">":return Ue(e,a,r);case">=":return ua(e,a,r);case"<":return It(e,a,r);case"<=":return la(e,a,r);default:throw new TypeError("Invalid operator: "+t)}}M.Comparator=J;function J(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof J){if(e.loose===!!t.loose)return e;e=e.value}if(!(this instanceof J))return new J(e,t);P("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===we?this.value="":this.value=this.operator+this.semver.version,P("comp",this)}var we={};J.prototype.parse=function(e){var t=this.options.loose?f[sa]:f[ia],a=e.match(t);if(!a)throw new TypeError("Invalid comparator: "+e);this.operator=a[1],this.operator==="="&&(this.operator=""),a[2]?this.semver=new b(a[2],this.options.loose):this.semver=we};J.prototype.toString=function(){return this.value};J.prototype.test=function(e){return P("Comparator.test",e,this.options.loose),this.semver===we?!0:(typeof e=="string"&&(e=new b(e,this.options)),bt(e,this.operator,this.semver,this.options))};J.prototype.intersects=function(e,t){if(!(e instanceof J))throw new TypeError("a Comparator is required");(!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1});var a;if(this.operator==="")return a=new N(e.value,t),mt(this.value,a,t);if(e.operator==="")return a=new N(this.value,t),mt(e.semver,a,t);var r=(this.operator===">="||this.operator===">")&&(e.operator===">="||e.operator===">"),n=(this.operator==="<="||this.operator==="<")&&(e.operator==="<="||e.operator==="<"),o=this.semver.version===e.semver.version,s=(this.operator===">="||this.operator==="<=")&&(e.operator===">="||e.operator==="<="),i=bt(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),p=bt(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return r||n||o&&s||i||p};M.Range=N;function N(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof N)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new N(e.raw,t);if(e instanceof J)return new N(e.value,t);if(!(this instanceof N))return new N(e,t);if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(function(a){return this.parseRange(a.trim())},this).filter(function(a){return a.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+e);this.format()}N.prototype.format=function(){return this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim(),this.range};N.prototype.toString=function(){return this.range};N.prototype.parseRange=function(e){var t=this.options.loose;e=e.trim();var a=t?f[Mr]:f[gr];e=e.replace(a,Ko),P("hyphen replace",e),e=e.replace(f[Oe],Ro),P("comparator trim",e,f[Oe]),e=e.replace(f[gt],Eo),e=e.replace(f[Mt],Po),e=e.split(/\s+/).join(" ");var r=t?f[sa]:f[ia],n=e.split(" ").map(function(o){return Vo(o,this.options)},this).join(" ").split(/\s+/);return this.options.loose&&(n=n.filter(function(o){return!!o.match(r)})),n=n.map(function(o){return new J(o,this.options)},this),n};N.prototype.intersects=function(e,t){if(!(e instanceof N))throw new TypeError("a Range is required");return this.set.some(function(a){return a.every(function(r){return e.set.some(function(n){return n.every(function(o){return r.intersects(o,t)})})})})};M.toComparators=Uo;function Uo(e,t){return new N(e,t).set.map(function(a){return a.map(function(r){return r.value}).join(" ").trim().split(" ")})}function Vo(e,t){return P("comp",e,t),e=qo(e,t),P("caret",e),e=wo(e,t),P("tildes",e),e=Ho(e,t),P("xrange",e),e=Wo(e,t),P("stars",e),e}function Q(e){return!e||e.toLowerCase()==="x"||e==="*"}function wo(e,t){return e.trim().split(/\s+/).map(function(a){return ko(a,t)}).join(" ")}function ko(e,t){var a=t.loose?f[cr]:f[yr];return e.replace(a,function(r,n,o,s,i){P("tilde",e,r,n,o,s,i);var p;return Q(n)?p="":Q(o)?p=">="+n+".0.0 <"+(+n+1)+".0.0":Q(s)?p=">="+n+"."+o+".0 <"+n+"."+(+o+1)+".0":i?(P("replaceTilde pr",i),p=">="+n+"."+o+"."+s+"-"+i+" <"+n+"."+(+o+1)+".0"):p=">="+n+"."+o+"."+s+" <"+n+"."+(+o+1)+".0",P("tilde return",p),p})}function qo(e,t){return e.trim().split(/\s+/).map(function(a){return Go(a,t)}).join(" ")}function Go(e,t){P("caret",e,t);var a=t.loose?f[dr]:f[Sr];return e.replace(a,function(r,n,o,s,i){P("caret",e,r,n,o,s,i);var p;return Q(n)?p="":Q(o)?p=">="+n+".0.0 <"+(+n+1)+".0.0":Q(s)?n==="0"?p=">="+n+"."+o+".0 <"+n+"."+(+o+1)+".0":p=">="+n+"."+o+".0 <"+(+n+1)+".0.0":i?(P("replaceCaret pr",i),n==="0"?o==="0"?p=">="+n+"."+o+"."+s+"-"+i+" <"+n+"."+o+"."+(+s+1):p=">="+n+"."+o+"."+s+"-"+i+" <"+n+"."+(+o+1)+".0":p=">="+n+"."+o+"."+s+"-"+i+" <"+(+n+1)+".0.0"):(P("no pr"),n==="0"?o==="0"?p=">="+n+"."+o+"."+s+" <"+n+"."+o+"."+(+s+1):p=">="+n+"."+o+"."+s+" <"+n+"."+(+o+1)+".0":p=">="+n+"."+o+"."+s+" <"+(+n+1)+".0.0"),P("caret return",p),p})}function Ho(e,t){return P("replaceXRanges",e,t),e.split(/\s+/).map(function(a){return Qo(a,t)}).join(" ")}function Qo(e,t){e=e.trim();var a=t.loose?f[ur]:f[pr];return e.replace(a,function(r,n,o,s,i,p){P("xRange",e,r,n,o,s,i,p);var u=Q(o),y=u||Q(s),c=y||Q(i),S=c;return n==="="&&S&&(n=""),u?n===">"||n==="<"?r="<0.0.0":r="*":n&&S?(y&&(s=0),i=0,n===">"?(n=">=",y?(o=+o+1,s=0,i=0):(s=+s+1,i=0)):n==="<="&&(n="<",y?o=+o+1:s=+s+1),r=n+o+"."+s+"."+i):y?r=">="+o+".0.0 <"+(+o+1)+".0.0":c&&(r=">="+o+"."+s+".0 <"+o+"."+(+s+1)+".0"),P("xRange return",r),r})}function Wo(e,t){return P("replaceStars",e,t),e.trim().replace(f[Ir],"")}function Ko(e,t,a,r,n,o,s,i,p,u,y,c,S){return Q(a)?t="":Q(r)?t=">="+a+".0.0":Q(n)?t=">="+a+"."+r+".0":t=">="+t,Q(p)?i="":Q(u)?i="<"+(+p+1)+".0.0":Q(y)?i="<"+p+"."+(+u+1)+".0":c?i="<="+p+"."+u+"."+y+"-"+c:i="<="+i,(t+" "+i).trim()}N.prototype.test=function(e){if(!e)return!1;typeof e=="string"&&(e=new b(e,this.options));for(var t=0;t<this.set.length;t++)if(jo(this.set[t],e,this.options))return!0;return!1};function jo(e,t,a){for(var r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!a.includePrerelease){for(r=0;r<e.length;r++)if(P(e[r].semver),e[r].semver!==we&&e[r].semver.prerelease.length>0){var n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}M.satisfies=mt;function mt(e,t,a){try{t=new N(t,a)}catch{return!1}return t.test(e)}M.maxSatisfying=zo;function zo(e,t,a){var r=null,n=null;try{var o=new N(t,a)}catch{return null}return e.forEach(function(s){o.test(s)&&(!r||n.compare(s)===-1)&&(r=s,n=new b(r,a))}),r}M.minSatisfying=Yo;function Yo(e,t,a){var r=null,n=null;try{var o=new N(t,a)}catch{return null}return e.forEach(function(s){o.test(s)&&(!r||n.compare(s)===1)&&(r=s,n=new b(r,a))}),r}M.minVersion=Jo;function Jo(e,t){e=new N(e,t);var a=new b("0.0.0");if(e.test(a)||(a=new b("0.0.0-0"),e.test(a)))return a;a=null;for(var r=0;r<e.set.length;++r){var n=e.set[r];n.forEach(function(o){var s=new b(o.semver.version);switch(o.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!a||Ue(a,s))&&(a=s);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+o.operator)}})}return a&&e.test(a)?a:null}M.validRange=$o;function $o(e,t){try{return new N(e,t).range||"*"}catch{return null}}M.ltr=Xo;function Xo(e,t,a){return ya(e,t,"<",a)}M.gtr=Zo;function Zo(e,t,a){return ya(e,t,">",a)}M.outside=ya;function ya(e,t,a,r){e=new b(e,r),t=new N(t,r);var n,o,s,i,p;switch(a){case">":n=Ue,o=la,s=It,i=">",p=">=";break;case"<":n=It,o=ua,s=Ue,i="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(mt(e,t,r))return!1;for(var u=0;u<t.set.length;++u){var y=t.set[u],c=null,S=null;if(y.forEach(function(g){g.semver===we&&(g=new J(">=0.0.0")),c=c||g,S=S||g,n(g.semver,c.semver,r)?c=g:s(g.semver,S.semver,r)&&(S=g)}),c.operator===i||c.operator===p||(!S.operator||S.operator===i)&&o(e,S.semver))return!1;if(S.operator===p&&s(e,S.semver))return!1}return!0}M.prerelease=es;function es(e,t){var a=ge(e,t);return a&&a.prerelease.length?a.prerelease:null}M.intersects=ts;function ts(e,t,a){return e=new N(e,a),t=new N(t,a),e.intersects(t)}M.coerce=as;function as(e){if(e instanceof b)return e;if(typeof e!="string")return null;var t=e.match(f[lr]);return t==null?null:ge(t[1]+"."+(t[2]||"0")+"."+(t[3]||"0"))}});var Rr=B((Vi,Pr)=>{"use strict";function ca(e){return typeof e=="function"}var W=console.error.bind(console);function ke(e,t,a){var r=!!e[t]&&e.propertyIsEnumerable(t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:a})}function qe(e){e&&e.logger&&(ca(e.logger)?W=e.logger:W("new logger isn't a function, not replacing"))}function Ar(e,t,a){if(!e||!e[t]){W("no original function "+t+" to wrap");return}if(!a){W("no wrapper function"),W(new Error().stack);return}if(!ca(e[t])||!ca(a)){W("original object and wrapper must be functions");return}var r=e[t],n=a(r,t);return ke(n,"__original",r),ke(n,"__unwrap",function(){e[t]===n&&ke(e,t,r)}),ke(n,"__wrapped",!0),ke(e,t,n),n}function rs(e,t,a){if(e)Array.isArray(e)||(e=[e]);else{W("must provide one or more modules to patch"),W(new Error().stack);return}if(!(t&&Array.isArray(t))){W("must provide one or more functions to wrap on modules");return}e.forEach(function(r){t.forEach(function(n){Ar(r,n,a)})})}function Er(e,t){if(!e||!e[t]){W("no function to unwrap."),W(new Error().stack);return}if(!e[t].__unwrap)W("no original to unwrap to -- has "+t+" already been unwrapped?");else return e[t].__unwrap()}function ns(e,t){if(e)Array.isArray(e)||(e=[e]);else{W("must provide one or more modules to patch"),W(new Error().stack);return}if(!(t&&Array.isArray(t))){W("must provide one or more functions to unwrap on modules");return}e.forEach(function(a){t.forEach(function(r){Er(a,r)})})}qe.wrap=Ar;qe.massWrap=rs;qe.unwrap=Er;qe.massUnwrap=ns;Pr.exports=qe});var Sa=B((wi,xr)=>{"use strict";var fr=Rr(),Te=fr.wrap,Et=fr.unwrap,ne="wrap@before";function Pt(e,t,a){var r=!!e[t]&&e.propertyIsEnumerable(t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:a})}function os(e,t){for(var a=t.length,r=0;r<a;r++){var n=t[r],o=e[ne];if(typeof o=="function")o(n);else if(Array.isArray(o))for(var s=o.length,i=0;i<s;i++)o[i](n)}}function vr(e,t){var a;return a=e._events&&e._events[t],Array.isArray(a)||(a?a=[a]:a=[]),a}function ss(e,t,a){var r=vr(e,t),n=r.filter(function(o){return a.indexOf(o)===-1});n.length>0&&os(e,n)}function Tr(e,t){if(e){var a=e;if(typeof e=="function")a=t(e);else if(Array.isArray(e)){a=[];for(var r=0;r<e.length;r++)a[r]=t(e[r])}return a}}xr.exports=function(t,a,r){if(!t||!t.on||!t.addListener||!t.removeListener||!t.emit)throw new Error("can only wrap real EEs");if(!a)throw new Error("must have function to run on listener addition");if(!r)throw new Error("must have function to wrap listeners when emitting");function n(s){return function(p,u){var y=vr(this,p).slice();try{var c=s.call(this,p,u);return ss(this,p,y),c}finally{this.on.__wrapped||Te(this,"on",n),this.addListener.__wrapped||Te(this,"addListener",n)}}}function o(s){return function(p){if(!this._events||!this._events[p])return s.apply(this,arguments);var u=this._events[p];function y(c){return function(){this._events[p]=u;try{return c.apply(this,arguments)}finally{u=this._events[p],this._events[p]=Tr(u,r)}}}Te(this,"removeListener",y);try{return this._events[p]=Tr(u,r),s.apply(this,arguments)}finally{Et(this,"removeListener"),this._events[p]=u}}}t[ne]?typeof t[ne]=="function"?Pt(t,ne,[t[ne],a]):Array.isArray(t[ne])&&t[ne].push(a):Pt(t,ne,a),t.__wrapped||(Te(t,"addListener",n),Te(t,"on",n),Te(t,"emit",o),Pt(t,"__unwrap",function(){Et(t,"addListener"),Et(t,"on"),Et(t,"emit"),delete t[ne],delete t.__wrapped}),Pt(t,"__wrapped",!0))}});var Nr=B((ki,_r)=>{"use strict";var E=require("util"),oe=require("assert"),is=Sa(),v=require("async_hooks"),Ge="cls@contexts",He="error@context",D=process.env.DEBUG_CLS_HOOKED,A=-1;_r.exports={getNamespace:hr,createNamespace:ps,destroyNamespace:Fr,reset:us,ERROR_SYMBOL:He};function $(e){this.name=e,this.active=null,this._set=[],this.id=null,this._contexts=new Map,this._indent=0}$.prototype.set=function(t,a){if(!this.active)throw new Error("No context available. ns.run() or ns.bind() must be called first.");if(this.active[t]=a,D){let r=" ".repeat(this._indent<0?0:this._indent);x(r+"CONTEXT-SET KEY:"+t+"="+a+" in ns:"+this.name+" currentUid:"+A+" active:"+E.inspect(this.active,{showHidden:!0,depth:2,colors:!0}))}return a};$.prototype.get=function(t){if(!this.active){if(D){let a=v.currentId(),r=v.triggerAsyncId(),n=" ".repeat(this._indent<0?0:this._indent);x(`${n}CONTEXT-GETTING KEY NO ACTIVE NS: (${this.name}) ${t}=undefined currentUid:${A} asyncHooksCurrentId:${a} triggerId:${r} len:${this._set.length}`)}return}if(D){let a=v.executionAsyncId(),r=v.triggerAsyncId(),n=" ".repeat(this._indent<0?0:this._indent);x(n+"CONTEXT-GETTING KEY:"+t+"="+this.active[t]+" ("+this.name+") currentUid:"+A+" active:"+E.inspect(this.active,{showHidden:!0,depth:2,colors:!0})),x(`${n}CONTEXT-GETTING KEY: (${this.name}) ${t}=${this.active[t]} currentUid:${A} asyncHooksCurrentId:${a} triggerId:${r} len:${this._set.length} active:${E.inspect(this.active)}`)}return this.active[t]};$.prototype.createContext=function(){let t=Object.create(this.active?this.active:Object.prototype);if(t._ns_name=this.name,t.id=A,D){let a=v.executionAsyncId(),r=v.triggerAsyncId(),n=" ".repeat(this._indent<0?0:this._indent);x(`${n}CONTEXT-CREATED Context: (${this.name}) currentUid:${A} asyncHooksCurrentId:${a} triggerId:${r} len:${this._set.length} context:${E.inspect(t,{showHidden:!0,depth:2,colors:!0})}`)}return t};$.prototype.run=function(t){let a=this.createContext();this.enter(a);try{if(D){let r=v.triggerAsyncId(),n=v.executionAsyncId(),o=" ".repeat(this._indent<0?0:this._indent);x(`${o}CONTEXT-RUN BEGIN: (${this.name}) currentUid:${A} triggerId:${r} asyncHooksCurrentId:${n} len:${this._set.length} context:${E.inspect(a)}`)}return t(a),a}catch(r){throw r&&(r[He]=a),r}finally{if(D){let r=v.triggerAsyncId(),n=v.executionAsyncId(),o=" ".repeat(this._indent<0?0:this._indent);x(`${o}CONTEXT-RUN END: (${this.name}) currentUid:${A} triggerId:${r} asyncHooksCurrentId:${n} len:${this._set.length} ${E.inspect(a)}`)}this.exit(a)}};$.prototype.runAndReturn=function(t){let a;return this.run(function(r){a=t(r)}),a};$.prototype.runPromise=function(t){let a=this.createContext();this.enter(a);let r=t(a);if(!r||!r.then||!r.catch)throw new Error("fn must return a promise.");return D&&x("CONTEXT-runPromise BEFORE: ("+this.name+") currentUid:"+A+" len:"+this._set.length+" "+E.inspect(a)),r.then(n=>(D&&x("CONTEXT-runPromise AFTER then: ("+this.name+") currentUid:"+A+" len:"+this._set.length+" "+E.inspect(a)),this.exit(a),n)).catch(n=>{throw n[He]=a,D&&x("CONTEXT-runPromise AFTER catch: ("+this.name+") currentUid:"+A+" len:"+this._set.length+" "+E.inspect(a)),this.exit(a),n})};$.prototype.bind=function(t,a){a||(this.active?a=this.active:a=this.createContext());let r=this;return function(){r.enter(a);try{return t.apply(this,arguments)}catch(o){throw o&&(o[He]=a),o}finally{r.exit(a)}}};$.prototype.enter=function(t){if(oe.ok(t,"context must be provided for entering"),D){let a=v.executionAsyncId(),r=v.triggerAsyncId(),n=" ".repeat(this._indent<0?0:this._indent);x(`${n}CONTEXT-ENTER: (${this.name}) currentUid:${A} triggerId:${r} asyncHooksCurrentId:${a} len:${this._set.length} ${E.inspect(t)}`)}this._set.push(this.active),this.active=t};$.prototype.exit=function(t){if(oe.ok(t,"context must be provided for exiting"),D){let r=v.executionAsyncId(),n=v.triggerAsyncId(),o=" ".repeat(this._indent<0?0:this._indent);x(`${o}CONTEXT-EXIT: (${this.name}) currentUid:${A} triggerId:${n} asyncHooksCurrentId:${r} len:${this._set.length} ${E.inspect(t)}`)}if(this.active===t){oe.ok(this._set.length,"can't remove top context"),this.active=this._set.pop();return}let a=this._set.lastIndexOf(t);a<0?(D&&x("??ERROR?? context exiting but not entered - ignoring: "+E.inspect(t)),oe.ok(a>=0,`context not currently entered; can't exit.
|
|
1
|
+
"use strict";var ro=Object.create;var ut=Object.defineProperty;var no=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,io=Object.prototype.hasOwnProperty;var Z=(e,t)=>()=>(e&&(t=e(e=0)),t);var B=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ka=(e,t)=>{for(var a in t)ut(e,a,{get:t[a],enumerable:!0})},qa=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of oo(t))!io.call(e,n)&&n!==a&&ut(e,n,{get:()=>t[n],enumerable:!(r=no(t,n))||r.enumerable});return e};var m=(e,t,a)=>(a=e!=null?ro(so(e)):{},qa(t||!e||!e.__esModule?ut(a,"default",{value:e,enumerable:!0}):a,e)),Ga=e=>qa(ut({},"__esModule",{value:!0}),e);var er,Le=Z(()=>{"use strict";er=require("exenv");if(process.env.NODE_ENV!=="test"&&er.canUseDOM)throw new Error("This code should never be exposed in the client bundle")});var tr=Z(()=>{"use strict"});var ar=B(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.isAlsSupported=pe.getNodeVersion=pe.nodeVersionString=void 0;pe.nodeVersionString=process.versions.node;function mo(e){let[t,a,r]=e.split(".");return{majorVersion:Number.parseInt(t),minorVersion:Number.parseInt(a),patchVersion:Number.parseInt(r)}}pe.getNodeVersion=mo;function Co(e){let{majorVersion:t,minorVersion:a}=e;return t>13?!0:t<12?!1:t===12?a>=17:t===13?a>=10:!1}pe.isAlsSupported=Co});var rr=B(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.als=void 0;var Ao=require("async_hooks"),zt=new Ao.AsyncLocalStorage;me.als={storageImplementation:"AsyncLocalStorage",get:e=>{let t=zt.getStore();return t?.get(e)},set:(e,t)=>{let a=zt.getStore();a?.set(e,t)},runWith:(e,t)=>{let a=t?new Map(Object.entries(t)):new Map;zt.run(a,()=>{e()})}};me.default=me.als});var Cr=B((M,mr)=>{M=mr.exports=b;var P;typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?P=function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:P=function(){};M.SEMVER_SPEC_VERSION="2.0.0";var Jt=256,ct=Number.MAX_SAFE_INTEGER||9007199254740991,Yt=16,v=M.re=[],l=M.src=[],I=0,Ce=I++;l[Ce]="0|[1-9]\\d*";var Ae=I++;l[Ae]="[0-9]+";var ea=I++;l[ea]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var or=I++;l[or]="("+l[Ce]+")\\.("+l[Ce]+")\\.("+l[Ce]+")";var sr=I++;l[sr]="("+l[Ae]+")\\.("+l[Ae]+")\\.("+l[Ae]+")";var $t=I++;l[$t]="(?:"+l[Ce]+"|"+l[ea]+")";var Xt=I++;l[Xt]="(?:"+l[Ae]+"|"+l[ea]+")";var ta=I++;l[ta]="(?:-("+l[$t]+"(?:\\."+l[$t]+")*))";var aa=I++;l[aa]="(?:-?("+l[Xt]+"(?:\\."+l[Xt]+")*))";var Zt=I++;l[Zt]="[0-9A-Za-z-]+";var Ve=I++;l[Ve]="(?:\\+("+l[Zt]+"(?:\\."+l[Zt]+")*))";var ra=I++,ir="v?"+l[or]+l[ta]+"?"+l[Ve]+"?";l[ra]="^"+ir+"$";var na="[v=\\s]*"+l[sr]+l[aa]+"?"+l[Ve]+"?",oa=I++;l[oa]="^"+na+"$";var Re=I++;l[Re]="((?:<|>)?=?)";var St=I++;l[St]=l[Ae]+"|x|X|\\*";var dt=I++;l[dt]=l[Ce]+"|x|X|\\*";var de=I++;l[de]="[v=\\s]*("+l[dt]+")(?:\\.("+l[dt]+")(?:\\.("+l[dt]+")(?:"+l[ta]+")?"+l[Ve]+"?)?)?";var Pe=I++;l[Pe]="[v=\\s]*("+l[St]+")(?:\\.("+l[St]+")(?:\\.("+l[St]+")(?:"+l[aa]+")?"+l[Ve]+"?)?)?";var pr=I++;l[pr]="^"+l[Re]+"\\s*"+l[de]+"$";var ur=I++;l[ur]="^"+l[Re]+"\\s*"+l[Pe]+"$";var lr=I++;l[lr]="(?:^|[^\\d])(\\d{1,"+Yt+"})(?:\\.(\\d{1,"+Yt+"}))?(?:\\.(\\d{1,"+Yt+"}))?(?:$|[^\\d])";var Ct=I++;l[Ct]="(?:~>?)";var gt=I++;l[gt]="(\\s*)"+l[Ct]+"\\s+";v[gt]=new RegExp(l[gt],"g");var Eo="$1~",yr=I++;l[yr]="^"+l[Ct]+l[de]+"$";var cr=I++;l[cr]="^"+l[Ct]+l[Pe]+"$";var At=I++;l[At]="(?:\\^)";var Mt=I++;l[Mt]="(\\s*)"+l[At]+"\\s+";v[Mt]=new RegExp(l[Mt],"g");var Po="$1^",Sr=I++;l[Sr]="^"+l[At]+l[de]+"$";var dr=I++;l[dr]="^"+l[At]+l[Pe]+"$";var sa=I++;l[sa]="^"+l[Re]+"\\s*("+na+")$|^$";var ia=I++;l[ia]="^"+l[Re]+"\\s*("+ir+")$|^$";var Oe=I++;l[Oe]="(\\s*)"+l[Re]+"\\s*("+na+"|"+l[de]+")";v[Oe]=new RegExp(l[Oe],"g");var Ro="$1$2$3",gr=I++;l[gr]="^\\s*("+l[de]+")\\s+-\\s+("+l[de]+")\\s*$";var Mr=I++;l[Mr]="^\\s*("+l[Pe]+")\\s+-\\s+("+l[Pe]+")\\s*$";var Ir=I++;l[Ir]="(<|>)?=?\\s*\\*";for(ue=0;ue<I;ue++)P(ue,l[ue]),v[ue]||(v[ue]=new RegExp(l[ue]));var ue;M.parse=ge;function ge(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof b)return e;if(typeof e!="string"||e.length>Jt)return null;var a=t.loose?v[oa]:v[ra];if(!a.test(e))return null;try{return new b(e,t)}catch{return null}}M.valid=To;function To(e,t){var a=ge(e,t);return a?a.version:null}M.clean=vo;function vo(e,t){var a=ge(e.trim().replace(/^[=v]+/,""),t);return a?a.version:null}M.SemVer=b;function b(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof b){if(e.loose===t.loose)return e;e=e.version}else if(typeof e!="string")throw new TypeError("Invalid Version: "+e);if(e.length>Jt)throw new TypeError("version is longer than "+Jt+" characters");if(!(this instanceof b))return new b(e,t);P("SemVer",e,t),this.options=t,this.loose=!!t.loose;var a=e.trim().match(t.loose?v[oa]:v[ra]);if(!a)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+a[1],this.minor=+a[2],this.patch=+a[3],this.major>ct||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ct||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ct||this.patch<0)throw new TypeError("Invalid patch version");a[4]?this.prerelease=a[4].split(".").map(function(r){if(/^[0-9]+$/.test(r)){var n=+r;if(n>=0&&n<ct)return n}return r}):this.prerelease=[],this.build=a[5]?a[5].split("."):[],this.format()}b.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version};b.prototype.toString=function(){return this.version};b.prototype.compare=function(e){return P("SemVer.compare",this.version,this.options,e),e instanceof b||(e=new b(e,this.options)),this.compareMain(e)||this.comparePre(e)};b.prototype.compareMain=function(e){return e instanceof b||(e=new b(e,this.options)),Ee(this.major,e.major)||Ee(this.minor,e.minor)||Ee(this.patch,e.patch)};b.prototype.comparePre=function(e){if(e instanceof b||(e=new b(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var t=0;do{var a=this.prerelease[t],r=e.prerelease[t];if(P("prerelease compare",t,a,r),a===void 0&&r===void 0)return 0;if(r===void 0)return 1;if(a===void 0)return-1;if(a===r)continue;return Ee(a,r)}while(++t)};b.prototype.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t),this.inc("pre",t);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{for(var a=this.prerelease.length;--a>=0;)typeof this.prerelease[a]=="number"&&(this.prerelease[a]++,a=-2);a===-1&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this};M.inc=fo;function fo(e,t,a,r){typeof a=="string"&&(r=a,a=void 0);try{return new b(e,a).inc(t,r).version}catch{return null}}M.diff=xo;function xo(e,t){if(pa(e,t))return null;var a=ge(e),r=ge(t),n="";if(a.prerelease.length||r.prerelease.length){n="pre";var o="prerelease"}for(var s in a)if((s==="major"||s==="minor"||s==="patch")&&a[s]!==r[s])return n+s;return o}M.compareIdentifiers=Ee;var nr=/^[0-9]+$/;function Ee(e,t){var a=nr.test(e),r=nr.test(t);return a&&r&&(e=+e,t=+t),e===t?0:a&&!r?-1:r&&!a?1:e<t?-1:1}M.rcompareIdentifiers=ho;function ho(e,t){return Ee(t,e)}M.major=Fo;function Fo(e,t){return new b(e,t).major}M.minor=_o;function _o(e,t){return new b(e,t).minor}M.patch=No;function No(e,t){return new b(e,t).patch}M.compare=re;function re(e,t,a){return new b(e,a).compare(new b(t,a))}M.compareLoose=Do;function Do(e,t){return re(e,t,!0)}M.rcompare=Bo;function Bo(e,t,a){return re(t,e,a)}M.sort=Lo;function Lo(e,t){return e.sort(function(a,r){return M.compare(a,r,t)})}M.rsort=Oo;function Oo(e,t){return e.sort(function(a,r){return M.rcompare(a,r,t)})}M.gt=Ue;function Ue(e,t,a){return re(e,t,a)>0}M.lt=It;function It(e,t,a){return re(e,t,a)<0}M.eq=pa;function pa(e,t,a){return re(e,t,a)===0}M.neq=br;function br(e,t,a){return re(e,t,a)!==0}M.gte=ua;function ua(e,t,a){return re(e,t,a)>=0}M.lte=la;function la(e,t,a){return re(e,t,a)<=0}M.cmp=bt;function bt(e,t,a,r){switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof a=="object"&&(a=a.version),e===a;case"!==":return typeof e=="object"&&(e=e.version),typeof a=="object"&&(a=a.version),e!==a;case"":case"=":case"==":return pa(e,a,r);case"!=":return br(e,a,r);case">":return Ue(e,a,r);case">=":return ua(e,a,r);case"<":return It(e,a,r);case"<=":return la(e,a,r);default:throw new TypeError("Invalid operator: "+t)}}M.Comparator=J;function J(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof J){if(e.loose===!!t.loose)return e;e=e.value}if(!(this instanceof J))return new J(e,t);P("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===we?this.value="":this.value=this.operator+this.semver.version,P("comp",this)}var we={};J.prototype.parse=function(e){var t=this.options.loose?v[sa]:v[ia],a=e.match(t);if(!a)throw new TypeError("Invalid comparator: "+e);this.operator=a[1],this.operator==="="&&(this.operator=""),a[2]?this.semver=new b(a[2],this.options.loose):this.semver=we};J.prototype.toString=function(){return this.value};J.prototype.test=function(e){return P("Comparator.test",e,this.options.loose),this.semver===we?!0:(typeof e=="string"&&(e=new b(e,this.options)),bt(e,this.operator,this.semver,this.options))};J.prototype.intersects=function(e,t){if(!(e instanceof J))throw new TypeError("a Comparator is required");(!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1});var a;if(this.operator==="")return a=new N(e.value,t),mt(this.value,a,t);if(e.operator==="")return a=new N(this.value,t),mt(e.semver,a,t);var r=(this.operator===">="||this.operator===">")&&(e.operator===">="||e.operator===">"),n=(this.operator==="<="||this.operator==="<")&&(e.operator==="<="||e.operator==="<"),o=this.semver.version===e.semver.version,s=(this.operator===">="||this.operator==="<=")&&(e.operator===">="||e.operator==="<="),i=bt(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),p=bt(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return r||n||o&&s||i||p};M.Range=N;function N(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof N)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new N(e.raw,t);if(e instanceof J)return new N(e.value,t);if(!(this instanceof N))return new N(e,t);if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(function(a){return this.parseRange(a.trim())},this).filter(function(a){return a.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+e);this.format()}N.prototype.format=function(){return this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim(),this.range};N.prototype.toString=function(){return this.range};N.prototype.parseRange=function(e){var t=this.options.loose;e=e.trim();var a=t?v[Mr]:v[gr];e=e.replace(a,Ko),P("hyphen replace",e),e=e.replace(v[Oe],Ro),P("comparator trim",e,v[Oe]),e=e.replace(v[gt],Eo),e=e.replace(v[Mt],Po),e=e.split(/\s+/).join(" ");var r=t?v[sa]:v[ia],n=e.split(" ").map(function(o){return Vo(o,this.options)},this).join(" ").split(/\s+/);return this.options.loose&&(n=n.filter(function(o){return!!o.match(r)})),n=n.map(function(o){return new J(o,this.options)},this),n};N.prototype.intersects=function(e,t){if(!(e instanceof N))throw new TypeError("a Range is required");return this.set.some(function(a){return a.every(function(r){return e.set.some(function(n){return n.every(function(o){return r.intersects(o,t)})})})})};M.toComparators=Uo;function Uo(e,t){return new N(e,t).set.map(function(a){return a.map(function(r){return r.value}).join(" ").trim().split(" ")})}function Vo(e,t){return P("comp",e,t),e=qo(e,t),P("caret",e),e=wo(e,t),P("tildes",e),e=Wo(e,t),P("xrange",e),e=Qo(e,t),P("stars",e),e}function H(e){return!e||e.toLowerCase()==="x"||e==="*"}function wo(e,t){return e.trim().split(/\s+/).map(function(a){return ko(a,t)}).join(" ")}function ko(e,t){var a=t.loose?v[cr]:v[yr];return e.replace(a,function(r,n,o,s,i){P("tilde",e,r,n,o,s,i);var p;return H(n)?p="":H(o)?p=">="+n+".0.0 <"+(+n+1)+".0.0":H(s)?p=">="+n+"."+o+".0 <"+n+"."+(+o+1)+".0":i?(P("replaceTilde pr",i),p=">="+n+"."+o+"."+s+"-"+i+" <"+n+"."+(+o+1)+".0"):p=">="+n+"."+o+"."+s+" <"+n+"."+(+o+1)+".0",P("tilde return",p),p})}function qo(e,t){return e.trim().split(/\s+/).map(function(a){return Go(a,t)}).join(" ")}function Go(e,t){P("caret",e,t);var a=t.loose?v[dr]:v[Sr];return e.replace(a,function(r,n,o,s,i){P("caret",e,r,n,o,s,i);var p;return H(n)?p="":H(o)?p=">="+n+".0.0 <"+(+n+1)+".0.0":H(s)?n==="0"?p=">="+n+"."+o+".0 <"+n+"."+(+o+1)+".0":p=">="+n+"."+o+".0 <"+(+n+1)+".0.0":i?(P("replaceCaret pr",i),n==="0"?o==="0"?p=">="+n+"."+o+"."+s+"-"+i+" <"+n+"."+o+"."+(+s+1):p=">="+n+"."+o+"."+s+"-"+i+" <"+n+"."+(+o+1)+".0":p=">="+n+"."+o+"."+s+"-"+i+" <"+(+n+1)+".0.0"):(P("no pr"),n==="0"?o==="0"?p=">="+n+"."+o+"."+s+" <"+n+"."+o+"."+(+s+1):p=">="+n+"."+o+"."+s+" <"+n+"."+(+o+1)+".0":p=">="+n+"."+o+"."+s+" <"+(+n+1)+".0.0"),P("caret return",p),p})}function Wo(e,t){return P("replaceXRanges",e,t),e.split(/\s+/).map(function(a){return Ho(a,t)}).join(" ")}function Ho(e,t){e=e.trim();var a=t.loose?v[ur]:v[pr];return e.replace(a,function(r,n,o,s,i,p){P("xRange",e,r,n,o,s,i,p);var u=H(o),y=u||H(s),c=y||H(i),S=c;return n==="="&&S&&(n=""),u?n===">"||n==="<"?r="<0.0.0":r="*":n&&S?(y&&(s=0),i=0,n===">"?(n=">=",y?(o=+o+1,s=0,i=0):(s=+s+1,i=0)):n==="<="&&(n="<",y?o=+o+1:s=+s+1),r=n+o+"."+s+"."+i):y?r=">="+o+".0.0 <"+(+o+1)+".0.0":c&&(r=">="+o+"."+s+".0 <"+o+"."+(+s+1)+".0"),P("xRange return",r),r})}function Qo(e,t){return P("replaceStars",e,t),e.trim().replace(v[Ir],"")}function Ko(e,t,a,r,n,o,s,i,p,u,y,c,S){return H(a)?t="":H(r)?t=">="+a+".0.0":H(n)?t=">="+a+"."+r+".0":t=">="+t,H(p)?i="":H(u)?i="<"+(+p+1)+".0.0":H(y)?i="<"+p+"."+(+u+1)+".0":c?i="<="+p+"."+u+"."+y+"-"+c:i="<="+i,(t+" "+i).trim()}N.prototype.test=function(e){if(!e)return!1;typeof e=="string"&&(e=new b(e,this.options));for(var t=0;t<this.set.length;t++)if(jo(this.set[t],e,this.options))return!0;return!1};function jo(e,t,a){for(var r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!a.includePrerelease){for(r=0;r<e.length;r++)if(P(e[r].semver),e[r].semver!==we&&e[r].semver.prerelease.length>0){var n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}M.satisfies=mt;function mt(e,t,a){try{t=new N(t,a)}catch{return!1}return t.test(e)}M.maxSatisfying=zo;function zo(e,t,a){var r=null,n=null;try{var o=new N(t,a)}catch{return null}return e.forEach(function(s){o.test(s)&&(!r||n.compare(s)===-1)&&(r=s,n=new b(r,a))}),r}M.minSatisfying=Yo;function Yo(e,t,a){var r=null,n=null;try{var o=new N(t,a)}catch{return null}return e.forEach(function(s){o.test(s)&&(!r||n.compare(s)===1)&&(r=s,n=new b(r,a))}),r}M.minVersion=Jo;function Jo(e,t){e=new N(e,t);var a=new b("0.0.0");if(e.test(a)||(a=new b("0.0.0-0"),e.test(a)))return a;a=null;for(var r=0;r<e.set.length;++r){var n=e.set[r];n.forEach(function(o){var s=new b(o.semver.version);switch(o.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!a||Ue(a,s))&&(a=s);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+o.operator)}})}return a&&e.test(a)?a:null}M.validRange=$o;function $o(e,t){try{return new N(e,t).range||"*"}catch{return null}}M.ltr=Xo;function Xo(e,t,a){return ya(e,t,"<",a)}M.gtr=Zo;function Zo(e,t,a){return ya(e,t,">",a)}M.outside=ya;function ya(e,t,a,r){e=new b(e,r),t=new N(t,r);var n,o,s,i,p;switch(a){case">":n=Ue,o=la,s=It,i=">",p=">=";break;case"<":n=It,o=ua,s=Ue,i="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(mt(e,t,r))return!1;for(var u=0;u<t.set.length;++u){var y=t.set[u],c=null,S=null;if(y.forEach(function(g){g.semver===we&&(g=new J(">=0.0.0")),c=c||g,S=S||g,n(g.semver,c.semver,r)?c=g:s(g.semver,S.semver,r)&&(S=g)}),c.operator===i||c.operator===p||(!S.operator||S.operator===i)&&o(e,S.semver))return!1;if(S.operator===p&&s(e,S.semver))return!1}return!0}M.prerelease=es;function es(e,t){var a=ge(e,t);return a&&a.prerelease.length?a.prerelease:null}M.intersects=ts;function ts(e,t,a){return e=new N(e,a),t=new N(t,a),e.intersects(t)}M.coerce=as;function as(e){if(e instanceof b)return e;if(typeof e!="string")return null;var t=e.match(v[lr]);return t==null?null:ge(t[1]+"."+(t[2]||"0")+"."+(t[3]||"0"))}});var Rr=B((Vi,Pr)=>{"use strict";function ca(e){return typeof e=="function"}var Q=console.error.bind(console);function ke(e,t,a){var r=!!e[t]&&e.propertyIsEnumerable(t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:a})}function qe(e){e&&e.logger&&(ca(e.logger)?Q=e.logger:Q("new logger isn't a function, not replacing"))}function Ar(e,t,a){if(!e||!e[t]){Q("no original function "+t+" to wrap");return}if(!a){Q("no wrapper function"),Q(new Error().stack);return}if(!ca(e[t])||!ca(a)){Q("original object and wrapper must be functions");return}var r=e[t],n=a(r,t);return ke(n,"__original",r),ke(n,"__unwrap",function(){e[t]===n&&ke(e,t,r)}),ke(n,"__wrapped",!0),ke(e,t,n),n}function rs(e,t,a){if(e)Array.isArray(e)||(e=[e]);else{Q("must provide one or more modules to patch"),Q(new Error().stack);return}if(!(t&&Array.isArray(t))){Q("must provide one or more functions to wrap on modules");return}e.forEach(function(r){t.forEach(function(n){Ar(r,n,a)})})}function Er(e,t){if(!e||!e[t]){Q("no function to unwrap."),Q(new Error().stack);return}if(!e[t].__unwrap)Q("no original to unwrap to -- has "+t+" already been unwrapped?");else return e[t].__unwrap()}function ns(e,t){if(e)Array.isArray(e)||(e=[e]);else{Q("must provide one or more modules to patch"),Q(new Error().stack);return}if(!(t&&Array.isArray(t))){Q("must provide one or more functions to unwrap on modules");return}e.forEach(function(a){t.forEach(function(r){Er(a,r)})})}qe.wrap=Ar;qe.massWrap=rs;qe.unwrap=Er;qe.massUnwrap=ns;Pr.exports=qe});var Sa=B((wi,xr)=>{"use strict";var vr=Rr(),Te=vr.wrap,Et=vr.unwrap,ne="wrap@before";function Pt(e,t,a){var r=!!e[t]&&e.propertyIsEnumerable(t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:a})}function os(e,t){for(var a=t.length,r=0;r<a;r++){var n=t[r],o=e[ne];if(typeof o=="function")o(n);else if(Array.isArray(o))for(var s=o.length,i=0;i<s;i++)o[i](n)}}function fr(e,t){var a;return a=e._events&&e._events[t],Array.isArray(a)||(a?a=[a]:a=[]),a}function ss(e,t,a){var r=fr(e,t),n=r.filter(function(o){return a.indexOf(o)===-1});n.length>0&&os(e,n)}function Tr(e,t){if(e){var a=e;if(typeof e=="function")a=t(e);else if(Array.isArray(e)){a=[];for(var r=0;r<e.length;r++)a[r]=t(e[r])}return a}}xr.exports=function(t,a,r){if(!t||!t.on||!t.addListener||!t.removeListener||!t.emit)throw new Error("can only wrap real EEs");if(!a)throw new Error("must have function to run on listener addition");if(!r)throw new Error("must have function to wrap listeners when emitting");function n(s){return function(p,u){var y=fr(this,p).slice();try{var c=s.call(this,p,u);return ss(this,p,y),c}finally{this.on.__wrapped||Te(this,"on",n),this.addListener.__wrapped||Te(this,"addListener",n)}}}function o(s){return function(p){if(!this._events||!this._events[p])return s.apply(this,arguments);var u=this._events[p];function y(c){return function(){this._events[p]=u;try{return c.apply(this,arguments)}finally{u=this._events[p],this._events[p]=Tr(u,r)}}}Te(this,"removeListener",y);try{return this._events[p]=Tr(u,r),s.apply(this,arguments)}finally{Et(this,"removeListener"),this._events[p]=u}}}t[ne]?typeof t[ne]=="function"?Pt(t,ne,[t[ne],a]):Array.isArray(t[ne])&&t[ne].push(a):Pt(t,ne,a),t.__wrapped||(Te(t,"addListener",n),Te(t,"on",n),Te(t,"emit",o),Pt(t,"__unwrap",function(){Et(t,"addListener"),Et(t,"on"),Et(t,"emit"),delete t[ne],delete t.__wrapped}),Pt(t,"__wrapped",!0))}});var Nr=B((ki,_r)=>{"use strict";var E=require("util"),oe=require("assert"),is=Sa(),f=require("async_hooks"),Ge="cls@contexts",We="error@context",D=process.env.DEBUG_CLS_HOOKED,A=-1;_r.exports={getNamespace:hr,createNamespace:ps,destroyNamespace:Fr,reset:us,ERROR_SYMBOL:We};function $(e){this.name=e,this.active=null,this._set=[],this.id=null,this._contexts=new Map,this._indent=0}$.prototype.set=function(t,a){if(!this.active)throw new Error("No context available. ns.run() or ns.bind() must be called first.");if(this.active[t]=a,D){let r=" ".repeat(this._indent<0?0:this._indent);x(r+"CONTEXT-SET KEY:"+t+"="+a+" in ns:"+this.name+" currentUid:"+A+" active:"+E.inspect(this.active,{showHidden:!0,depth:2,colors:!0}))}return a};$.prototype.get=function(t){if(!this.active){if(D){let a=f.currentId(),r=f.triggerAsyncId(),n=" ".repeat(this._indent<0?0:this._indent);x(`${n}CONTEXT-GETTING KEY NO ACTIVE NS: (${this.name}) ${t}=undefined currentUid:${A} asyncHooksCurrentId:${a} triggerId:${r} len:${this._set.length}`)}return}if(D){let a=f.executionAsyncId(),r=f.triggerAsyncId(),n=" ".repeat(this._indent<0?0:this._indent);x(n+"CONTEXT-GETTING KEY:"+t+"="+this.active[t]+" ("+this.name+") currentUid:"+A+" active:"+E.inspect(this.active,{showHidden:!0,depth:2,colors:!0})),x(`${n}CONTEXT-GETTING KEY: (${this.name}) ${t}=${this.active[t]} currentUid:${A} asyncHooksCurrentId:${a} triggerId:${r} len:${this._set.length} active:${E.inspect(this.active)}`)}return this.active[t]};$.prototype.createContext=function(){let t=Object.create(this.active?this.active:Object.prototype);if(t._ns_name=this.name,t.id=A,D){let a=f.executionAsyncId(),r=f.triggerAsyncId(),n=" ".repeat(this._indent<0?0:this._indent);x(`${n}CONTEXT-CREATED Context: (${this.name}) currentUid:${A} asyncHooksCurrentId:${a} triggerId:${r} len:${this._set.length} context:${E.inspect(t,{showHidden:!0,depth:2,colors:!0})}`)}return t};$.prototype.run=function(t){let a=this.createContext();this.enter(a);try{if(D){let r=f.triggerAsyncId(),n=f.executionAsyncId(),o=" ".repeat(this._indent<0?0:this._indent);x(`${o}CONTEXT-RUN BEGIN: (${this.name}) currentUid:${A} triggerId:${r} asyncHooksCurrentId:${n} len:${this._set.length} context:${E.inspect(a)}`)}return t(a),a}catch(r){throw r&&(r[We]=a),r}finally{if(D){let r=f.triggerAsyncId(),n=f.executionAsyncId(),o=" ".repeat(this._indent<0?0:this._indent);x(`${o}CONTEXT-RUN END: (${this.name}) currentUid:${A} triggerId:${r} asyncHooksCurrentId:${n} len:${this._set.length} ${E.inspect(a)}`)}this.exit(a)}};$.prototype.runAndReturn=function(t){let a;return this.run(function(r){a=t(r)}),a};$.prototype.runPromise=function(t){let a=this.createContext();this.enter(a);let r=t(a);if(!r||!r.then||!r.catch)throw new Error("fn must return a promise.");return D&&x("CONTEXT-runPromise BEFORE: ("+this.name+") currentUid:"+A+" len:"+this._set.length+" "+E.inspect(a)),r.then(n=>(D&&x("CONTEXT-runPromise AFTER then: ("+this.name+") currentUid:"+A+" len:"+this._set.length+" "+E.inspect(a)),this.exit(a),n)).catch(n=>{throw n[We]=a,D&&x("CONTEXT-runPromise AFTER catch: ("+this.name+") currentUid:"+A+" len:"+this._set.length+" "+E.inspect(a)),this.exit(a),n})};$.prototype.bind=function(t,a){a||(this.active?a=this.active:a=this.createContext());let r=this;return function(){r.enter(a);try{return t.apply(this,arguments)}catch(o){throw o&&(o[We]=a),o}finally{r.exit(a)}}};$.prototype.enter=function(t){if(oe.ok(t,"context must be provided for entering"),D){let a=f.executionAsyncId(),r=f.triggerAsyncId(),n=" ".repeat(this._indent<0?0:this._indent);x(`${n}CONTEXT-ENTER: (${this.name}) currentUid:${A} triggerId:${r} asyncHooksCurrentId:${a} len:${this._set.length} ${E.inspect(t)}`)}this._set.push(this.active),this.active=t};$.prototype.exit=function(t){if(oe.ok(t,"context must be provided for exiting"),D){let r=f.executionAsyncId(),n=f.triggerAsyncId(),o=" ".repeat(this._indent<0?0:this._indent);x(`${o}CONTEXT-EXIT: (${this.name}) currentUid:${A} triggerId:${n} asyncHooksCurrentId:${r} len:${this._set.length} ${E.inspect(t)}`)}if(this.active===t){oe.ok(this._set.length,"can't remove top context"),this.active=this._set.pop();return}let a=this._set.lastIndexOf(t);a<0?(D&&x("??ERROR?? context exiting but not entered - ignoring: "+E.inspect(t)),oe.ok(a>=0,`context not currently entered; can't exit.
|
|
2
2
|
`+E.inspect(this)+`
|
|
3
|
-
`+E.inspect(t))):(oe.ok(a,"can't remove top context"),this._set.splice(a,1))};$.prototype.bindEmitter=function(t){oe.ok(t.on&&t.addListener&&t.emit,"can only bind real EEs");let a=this,r="context@"+this.name;function n(s){s&&(s[Ge]||(s[Ge]=Object.create(null)),s[Ge][r]={namespace:a,context:a.active})}function o(s){if(!(s&&s[Ge]))return s;let i=s,p=s[Ge];return Object.keys(p).forEach(function(u){let y=p[u];i=y.namespace.bind(i,y.context)}),i}is(t,n,o)};$.prototype.fromException=function(t){return t[
|
|
4
|
-
`)}});var jr=B((zi,Kr)=>{var Tt=
|
|
3
|
+
`+E.inspect(t))):(oe.ok(a,"can't remove top context"),this._set.splice(a,1))};$.prototype.bindEmitter=function(t){oe.ok(t.on&&t.addListener&&t.emit,"can only bind real EEs");let a=this,r="context@"+this.name;function n(s){s&&(s[Ge]||(s[Ge]=Object.create(null)),s[Ge][r]={namespace:a,context:a.active})}function o(s){if(!(s&&s[Ge]))return s;let i=s,p=s[Ge];return Object.keys(p).forEach(function(u){let y=p[u];i=y.namespace.bind(i,y.context)}),i}is(t,n,o)};$.prototype.fromException=function(t){return t[We]};function hr(e){return process.namespaces[e]}function ps(e){oe.ok(e,"namespace must be given a name."),D&&x(`NS-CREATING NAMESPACE (${e})`);let t=new $(e);return t.id=A,f.createHook({init(r,n,o,s){if(A=f.executionAsyncId(),t.active){if(t._contexts.set(r,t.active),D){let i=" ".repeat(t._indent<0?0:t._indent);x(`${i}INIT [${n}] (${e}) asyncId:${r} currentUid:${A} triggerId:${o} active:${E.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${s}`)}}else if(A===0){let i=f.triggerAsyncId(),p=t._contexts.get(i);if(p){if(t._contexts.set(r,p),D){let u=" ".repeat(t._indent<0?0:t._indent);x(`${u}INIT USING CONTEXT FROM TRIGGERID [${n}] (${e}) asyncId:${r} currentUid:${A} triggerId:${i} active:${E.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${s}`)}}else if(D){let u=" ".repeat(t._indent<0?0:t._indent);x(`${u}INIT MISSING CONTEXT [${n}] (${e}) asyncId:${r} currentUid:${A} triggerId:${i} active:${E.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${s}`)}}if(D&&n==="PROMISE"){x(E.inspect(s,{showHidden:!0}));let i=s.parentId,p=" ".repeat(t._indent<0?0:t._indent);x(`${p}INIT RESOURCE-PROMISE [${n}] (${e}) parentId:${i} asyncId:${r} currentUid:${A} triggerId:${o} active:${E.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} resource:${s}`)}},before(r){A=f.executionAsyncId();let n;if(n=t._contexts.get(r)||t._contexts.get(A),n){if(D){let o=f.triggerAsyncId(),s=" ".repeat(t._indent<0?0:t._indent);x(`${s}BEFORE (${e}) asyncId:${r} currentUid:${A} triggerId:${o} active:${E.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${E.inspect(n)}`),t._indent+=2}t.enter(n)}else if(D){let o=f.triggerAsyncId(),s=" ".repeat(t._indent<0?0:t._indent);x(`${s}BEFORE MISSING CONTEXT (${e}) asyncId:${r} currentUid:${A} triggerId:${o} active:${E.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} namespace._contexts:${E.inspect(t._contexts,{showHidden:!0,depth:2,colors:!0})}`),t._indent+=2}},after(r){A=f.executionAsyncId();let n;if(n=t._contexts.get(r)||t._contexts.get(A),n){if(D){let o=f.triggerAsyncId();t._indent-=2;let s=" ".repeat(t._indent<0?0:t._indent);x(`${s}AFTER (${e}) asyncId:${r} currentUid:${A} triggerId:${o} active:${E.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${E.inspect(n)}`)}t.exit(n)}else if(D){let o=f.triggerAsyncId();t._indent-=2;let s=" ".repeat(t._indent<0?0:t._indent);x(`${s}AFTER MISSING CONTEXT (${e}) asyncId:${r} currentUid:${A} triggerId:${o} active:${E.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${E.inspect(n)}`)}},destroy(r){if(A=f.executionAsyncId(),D){let n=f.triggerAsyncId(),o=" ".repeat(t._indent<0?0:t._indent);x(`${o}DESTROY (${e}) currentUid:${A} asyncId:${r} triggerId:${n} active:${E.inspect(t.active,{showHidden:!0,depth:2,colors:!0})} context:${E.inspect(t._contexts.get(A))}`)}t._contexts.delete(r)}}).enable(),process.namespaces[e]=t,t}function Fr(e){let t=hr(e);oe.ok(t,`can't delete nonexistent namespace! "`+e+'"'),oe.ok(t.id,"don't assign to process.namespaces directly! "+E.inspect(t)),process.namespaces[e]=null}function us(){process.namespaces&&Object.keys(process.namespaces).forEach(function(e){Fr(e)}),process.namespaces=Object.create(null)}process.namespaces={};function x(...e){D&&process._rawDebug(`${E.format(...e)}`)}});var Br=B((qi,Dr)=>{"use strict";function ls(){}Dr.exports=function(){let t=this._hooks,a=this._state,r=process.nextTick;process.nextTick=function(){if(!a.enabled)return r.apply(process,arguments);let n=new Array(arguments.length);for(let p=0;p<arguments.length;p++)n[p]=arguments[p];let o=n[0];if(typeof o!="function")throw new TypeError("callback is not a function");let s=new ls,i=--a.counter;return t.init.call(s,i,0,null,null),n[0]=function(){t.pre.call(s,i);let p=!0;try{o.apply(this,arguments),p=!1}finally{p&&process.listenerCount("uncaughtException")>0&&process.once("uncaughtException",function(){t.post.call(s,i,!0),t.destroy.call(null,i)})}t.post.call(s,i,!1),t.destroy.call(null,i)},r.apply(process,n)}}});var Or=B((Gi,Lr)=>{"use strict";function ys(){}Lr.exports=function(){let t=this._hooks,a=this._state,r=global.Promise,n=r.prototype.then;r.prototype.then=p;function o(u,y,c,S){return typeof u!="function"?S?s(c):i(c):function(){t.pre.call(y,c);try{return u.apply(this,arguments)}finally{t.post.call(y,c,!1),t.destroy.call(null,c)}}}function s(u){return function(c){return t.destroy.call(null,u),c}}function i(u){return function(c){throw t.destroy.call(null,u),c}}function p(u,y){if(!a.enabled)return n.call(this,u,y);let c=new ys,S=--a.counter;return t.init.call(c,S,0,null,null),n.call(this,o(u,c,S,!0),o(y,c,S,!1))}}});var Vr=B((Wi,Ur)=>{"use strict";var z=require("timers");function cs(){}function Ss(){}function ds(){}var gs=new Map,Ms=new Map,Is=new Map,da=null,ga=!1;Ur.exports=function(){Ma(this._hooks,this._state,"setTimeout","clearTimeout",cs,gs,!0),Ma(this._hooks,this._state,"setInterval","clearInterval",Ss,Ms,!1),Ma(this._hooks,this._state,"setImmediate","clearImmediate",ds,Is,!0),global.setTimeout=z.setTimeout,global.setInterval=z.setInterval,global.setImmediate=z.setImmediate,global.clearTimeout=z.clearTimeout,global.clearInterval=z.clearInterval,global.clearImmediate=z.clearImmediate};function Ma(e,t,a,r,n,o,s){let i=z[a],p=z[r];z[a]=function(){if(!t.enabled)return i.apply(z,arguments);let u=new Array(arguments.length);for(let h=0;h<arguments.length;h++)u[h]=arguments[h];let y=u[0];if(typeof y!="function")throw new TypeError('"callback" argument must be a function');let c=new n,S=--t.counter,g;return e.init.call(c,S,0,null,null),u[0]=function(){da=g,e.pre.call(c,S);let h=!0;try{y.apply(this,arguments),h=!1}finally{h&&process.listenerCount("uncaughtException")>0&&process.once("uncaughtException",function(){e.post.call(c,S,!0),o.delete(g),e.destroy.call(null,S)})}e.post.call(c,S,!1),da=null,(s||ga)&&(ga=!1,o.delete(g),e.destroy.call(null,S))},g=i.apply(z,u),o.set(g,S),g},z[r]=function(u){if(da===u&&u!==null)ga=!0;else if(o.has(u)){let y=o.get(u);o.delete(u),e.destroy.call(null,y)}p.apply(z,arguments)}}});var Ia=B((Hi,bs)=>{bs.exports={name:"async-hook-jl",description:"Inspect the life of handle objects in node",version:"1.7.6",author:"Andreas Madsen <amwebdk@gmail.com>",main:"./index.js",scripts:{test:"node ./test/runner.js && eslint ."},repository:{type:"git",url:"git://github.com/jeff-lewis/async-hook-jl.git"},keywords:["async","async hooks","inspect","async wrap"],license:"MIT",dependencies:{"stack-chain":"^1.3.7"},devDependencies:{async:"1.5.x","cli-color":"1.1.x",eslint:"^3.4.0",endpoint:"0.4.x"},engines:{node:"^4.7 || >=6.9 || >=7.3"}}});var qr=B((Qi,kr)=>{"use strict";var Qe=process.binding("async_wrap"),ms=Qe.Providers.TIMERWRAP,wr={nextTick:Br(),promise:Or(),timers:Vr()},He=new Set;function Cs(){this.enabled=!1,this.counter=0}function ba(){let e=this.initFns=[],t=this.preFns=[],a=this.postFns=[],r=this.destroyFns=[];this.init=function(n,o,s,i){if(o===ms){He.add(n);return}for(let p of e)p(n,this,o,s,i)},this.pre=function(n){if(!He.has(n))for(let o of t)o(n,this)},this.post=function(n,o){if(!He.has(n))for(let s of a)s(n,this,o)},this.destroy=function(n){if(He.has(n)){He.delete(n);return}for(let o of r)o(n)}}ba.prototype.add=function(e){e.init&&this.initFns.push(e.init),e.pre&&this.preFns.push(e.pre),e.post&&this.postFns.push(e.post),e.destroy&&this.destroyFns.push(e.destroy)};function Rt(e,t){let a=e.indexOf(t);a!==-1&&e.splice(a,1)}ba.prototype.remove=function(e){e.init&&Rt(this.initFns,e.init),e.pre&&Rt(this.preFns,e.pre),e.post&&Rt(this.postFns,e.post),e.destroy&&Rt(this.destroyFns,e.destroy)};function Ke(){this._state=new Cs,this._hooks=new ba,this.version=Ia().version,this.providers=Qe.Providers;for(let e of Object.keys(wr))wr[e].call(this);process.env.hasOwnProperty("NODE_ASYNC_HOOK_WARNING")&&console.warn("warning: you are using async-hook-jl which is unstable."),Qe.setupHooks({init:this._hooks.init,pre:this._hooks.pre,post:this._hooks.post,destroy:this._hooks.destroy})}kr.exports=Ke;Ke.prototype.addHooks=function(e){this._hooks.add(e)};Ke.prototype.removeHooks=function(e){this._hooks.remove(e)};Ke.prototype.enable=function(){this._state.enabled=!0,Qe.enable()};Ke.prototype.disable=function(){this._state.enabled=!1,Qe.disable()}});var ma=B((Ki,As)=>{As.exports={name:"stack-chain",description:"API for combining call site modifiers",version:"1.3.7",author:"Andreas Madsen <amwebdk@gmail.com>",scripts:{test:"tap ./test/simple"},repository:{type:"git",url:"git://github.com/AndreasMadsen/stack-chain.git"},keywords:["stack","chain","trace","call site","concat","format"],devDependencies:{tap:"2.x.x","uglify-js":"2.5.x"},license:"MIT"}});var Wr=B((ji,Gr)=>{function Es(e){try{return Error.prototype.toString.call(e)}catch(t){try{return"<error: "+t+">"}catch{return"<error>"}}}Gr.exports=function(t,a){var r=[];r.push(Es(t));for(var n=0;n<a.length;n++){var o=a[n],s;try{s=o.toString()}catch(i){try{s="<error: "+i+">"}catch{s="<error>"}}r.push(" at "+s)}return r.join(`
|
|
4
|
+
`)}});var jr=B((zi,Kr)=>{var Tt=Wr();function Qr(){this.extend=new je,this.filter=new je,this.format=new ze,this.version=ma().version}var Aa=!1;Qr.prototype.callSite=function e(t){t||(t={}),Aa=!0;var a={};Error.captureStackTrace(a,e);var r=a.stack;return Aa=!1,r=r.slice(t.slice||0),t.extend&&(r=this.extend._modify(a,r)),t.filter&&(r=this.filter._modify(a,r)),r};var le=new Qr;function je(){this._modifiers=[]}je.prototype._modify=function(e,t){for(var a=0,r=this._modifiers.length;a<r;a++)t=this._modifiers[a](e,t);return t};je.prototype.attach=function(e){this._modifiers.push(e)};je.prototype.deattach=function(e){var t=this._modifiers.indexOf(e);return t===-1?!1:(this._modifiers.splice(t,1),!0)};function ze(){this._formater=Tt,this._previous=void 0}ze.prototype.replace=function(e){e?this._formater=e:this.restore()};ze.prototype.restore=function(){this._formater=Tt,this._previous=void 0};ze.prototype._backup=function(){this._previous=this._formater};ze.prototype._roolback=function(){this._previous===Tt?this.replace(void 0):this.replace(this._previous),this._previous=void 0};Error.prepareStackTrace&&le.format.replace(Error.prepareStackTrace);var Ca=!1;function Hr(e,t){if(Aa)return t;if(Ca)return Tt(e,t);var a=t.concat();a=le.extend._modify(e,a),a=le.filter._modify(e,a),a=a.slice(0,Error.stackTraceLimit),Object.isExtensible(e)&&Object.getOwnPropertyDescriptor(e,"callSite")===void 0&&(e.callSite={original:t,mutated:a}),Ca=!0;var r=le.format._formater(e,a);return Ca=!1,r}Object.defineProperty(Error,"prepareStackTrace",{get:function(){return Hr},set:function(e){e===Hr?le.format._roolback():(le.format._backup(),le.format.replace(e))}});function Ps(){return this.stack,this.callSite}Object.defineProperty(Error.prototype,"callSite",{get:Ps,set:function(e){Object.defineProperty(this,"callSite",{value:e,writable:!0,configurable:!0})},configurable:!0});Kr.exports=le});var Pa=B((Yi,Ea)=>{if(global._stackChain)if(global._stackChain.version===ma().version)Ea.exports=global._stackChain;else throw new Error("Conflicting version of stack-chain found");else Ea.exports=global._stackChain=jr()});var zr=B((Ji,Ra)=>{"use strict";var Rs=qr();if(global._asyncHook)if(global._asyncHook.version===Ia().version)Ra.exports=global._asyncHook;else throw new Error("Conflicting version of async-hook-jl found");else Pa().filter.attach(function(t,a){return a.filter(function(r){let n=r.getFileName();return!(n&&n.slice(0,__dirname.length)===__dirname)})}),Ra.exports=global._asyncHook=new Rs});var en=B(($i,Zr)=>{"use strict";var V=require("util"),se=require("assert"),Ts=Sa(),ve=zr(),Ye="cls@contexts",Je="error@context",Jr=[];for(let e in ve.providers)Jr[ve.providers[e]]=e;var L=process.env.DEBUG_CLS_HOOKED,w=-1;Zr.exports={getNamespace:$r,createNamespace:vs,destroyNamespace:Xr,reset:fs,ERROR_SYMBOL:Je};function X(e){this.name=e,this.active=null,this._set=[],this.id=null,this._contexts=new Map}X.prototype.set=function(t,a){if(!this.active)throw new Error("No context available. ns.run() or ns.bind() must be called first.");return L&&U(" SETTING KEY:"+t+"="+a+" in ns:"+this.name+" uid:"+w+" active:"+V.inspect(this.active,!0)),this.active[t]=a,a};X.prototype.get=function(t){if(!this.active){L&&U(" GETTING KEY:"+t+"=undefined "+this.name+" uid:"+w+" active:"+V.inspect(this.active,!0));return}return L&&U(" GETTING KEY:"+t+"="+this.active[t]+" "+this.name+" uid:"+w+" active:"+V.inspect(this.active,!0)),this.active[t]};X.prototype.createContext=function(){L&&U(" CREATING Context: "+this.name+" uid:"+w+" len:"+this._set.length+" active:"+V.inspect(this.active,!0,2,!0));let t=Object.create(this.active?this.active:Object.prototype);return t._ns_name=this.name,t.id=w,L&&U(" CREATED Context: "+this.name+" uid:"+w+" len:"+this._set.length+" context:"+V.inspect(t,!0,2,!0)),t};X.prototype.run=function(t){let a=this.createContext();this.enter(a);try{return L&&U(" BEFORE RUN: "+this.name+" uid:"+w+" len:"+this._set.length+" "+V.inspect(a)),t(a),a}catch(r){throw r&&(r[Je]=a),r}finally{L&&U(" AFTER RUN: "+this.name+" uid:"+w+" len:"+this._set.length+" "+V.inspect(a)),this.exit(a)}};X.prototype.runAndReturn=function(t){var a;return this.run(function(r){a=t(r)}),a};X.prototype.runPromise=function(t){let a=this.createContext();this.enter(a);let r=t(a);if(!r||!r.then||!r.catch)throw new Error("fn must return a promise.");return L&&U(" BEFORE runPromise: "+this.name+" uid:"+w+" len:"+this._set.length+" "+V.inspect(a)),r.then(n=>(L&&U(" AFTER runPromise: "+this.name+" uid:"+w+" len:"+this._set.length+" "+V.inspect(a)),this.exit(a),n)).catch(n=>{throw n[Je]=a,L&&U(" AFTER runPromise: "+this.name+" uid:"+w+" len:"+this._set.length+" "+V.inspect(a)),this.exit(a),n})};X.prototype.bind=function(t,a){a||(this.active?a=this.active:a=this.createContext());let r=this;return function(){r.enter(a);try{return t.apply(this,arguments)}catch(o){throw o&&(o[Je]=a),o}finally{r.exit(a)}}};X.prototype.enter=function(t){se.ok(t,"context must be provided for entering"),L&&U(" ENTER "+this.name+" uid:"+w+" len:"+this._set.length+" context: "+V.inspect(t)),this._set.push(this.active),this.active=t};X.prototype.exit=function(t){if(se.ok(t,"context must be provided for exiting"),L&&U(" EXIT "+this.name+" uid:"+w+" len:"+this._set.length+" context: "+V.inspect(t)),this.active===t){se.ok(this._set.length,"can't remove top context"),this.active=this._set.pop();return}let a=this._set.lastIndexOf(t);a<0?(L&&U("??ERROR?? context exiting but not entered - ignoring: "+V.inspect(t)),se.ok(a>=0,`context not currently entered; can't exit.
|
|
5
5
|
`+V.inspect(this)+`
|
|
6
|
-
`+V.inspect(t))):(se.ok(a,"can't remove top context"),this._set.splice(a,1))};X.prototype.bindEmitter=function(t){se.ok(t.on&&t.addListener&&t.emit,"can only bind real EEs");let a=this,r="context@"+this.name;function n(s){s&&(s[Ye]||(s[Ye]=Object.create(null)),s[Ye][r]={namespace:a,context:a.active})}function o(s){if(!(s&&s[Ye]))return s;let i=s,p=s[Ye];return Object.keys(p).forEach(function(u){let y=p[u];i=y.namespace.bind(i,y.context)}),i}Ts(t,n,o)};X.prototype.fromException=function(t){return t[Je]};function $r(e){return process.namespaces[e]}function fs(e){se.ok(e,"namespace must be given a name."),L&&U("CREATING NAMESPACE "+e);let t=new X(e);return t.id=w,fe.addHooks({init(a,r,n,o,s){w=a,o?(t._contexts.set(a,t._contexts.get(o)),L&&U("PARENTID: "+e+" uid:"+a+" parent:"+o+" provider:"+n)):t._contexts.set(w,t.active),L&&U("INIT "+e+" uid:"+a+" parent:"+o+" provider:"+Jr[n]+" active:"+V.inspect(t.active,!0))},pre(a,r){w=a;let n=t._contexts.get(a);n?(L&&U(" PRE "+e+" uid:"+a+" handle:"+ft(r)+" context:"+V.inspect(n)),t.enter(n)):L&&U(" PRE MISSING CONTEXT "+e+" uid:"+a+" handle:"+ft(r))},post(a,r){w=a;let n=t._contexts.get(a);n?(L&&U(" POST "+e+" uid:"+a+" handle:"+ft(r)+" context:"+V.inspect(n)),t.exit(n)):L&&U(" POST MISSING CONTEXT "+e+" uid:"+a+" handle:"+ft(r))},destroy(a){w=a,L&&U("DESTROY "+e+" uid:"+a+" context:"+V.inspect(t._contexts.get(w))+" active:"+V.inspect(t.active,!0)),t._contexts.delete(a)}}),process.namespaces[e]=t,t}function Xr(e){let t=$r(e);se.ok(t,`can't delete nonexistent namespace! "`+e+'"'),se.ok(t.id,"don't assign to process.namespaces directly! "+V.inspect(t)),process.namespaces[e]=null}function vs(){process.namespaces&&Object.keys(process.namespaces).forEach(function(e){Xr(e)}),process.namespaces=Object.create(null)}process.namespaces={};fe._state&&!fe._state.enabled&&fe.enable();function U(e){process.env.DEBUG&&process._rawDebug(e)}function ft(e){if(!e)return e;if(typeof e=="function")return e.name?e.name:(e.toString().trim().match(/^function\s*([^\s(]+)/)||[])[1];if(e.constructor&&e.constructor.name)return e.constructor.name}if(L){Ta=Pa();for(Yr in Ta.filter._modifiers)Ta.filter.deattach(Yr)}var Ta,Yr});var tn=B((Xi,fa)=>{"use strict";var xs=Cr();process&&xs.gte(process.versions.node,"8.0.0")?fa.exports=Nr():fa.exports=en()});var an=B(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.cls=void 0;var hs=tn(),ve=hs.createNamespace("@kibertoad/als");xe.cls={storageImplementation:"cls-hooked",get:e=>{if(ve.active)return ve.get(e)},set:(e,t)=>{ve.active&&ve.set(e,t)},runWith:(e,t)=>{ve.run(()=>{if(t){let a=Object.keys(t);for(let r=0;r<a.length;r++)ve.set(a[r],t[a[r]])}e()})}};xe.default=xe.cls});var rn=B(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.als=void 0;var{getNodeVersion:Fs,isAlsSupported:_s,nodeVersionString:Ns}=ar();he.als=_s(Fs(Ns))?rr().als:an().cls;he.default=he.als});var nn,va,ye,xa=Z(()=>{"use strict";nn=m(require("pino")),va=class{static getLogName(t){return(typeof t=="string"?t:t.id).replaceAll(/\.(tsx?|jsx?)/gi,"").split("/").filter(n=>n!==".").at(-1)}static validateLogLevel(t,a){if(t&&a){let r=a.toLowerCase(),{values:n}=nn.default.levels;if(n[r]===void 0)global.appLog?.warn("Unable to set %s log level to %s as it is an invalid value. Valid values are: %s",t,a,Object.keys(n));else return r}return null}},ye=va});function Ds(e,t=!1){$e?.debug("[log] Using file transport for log %s",e);let a=process.env.LOG_DIR;if(!a){$e?.debug("[log] No process.env.LOG_DIR value found for log %s. Disabling file logging.",e);return}let r=process.env.USE_LOG_FILE_SERVICE_ID_PREFIX==="true",n=process.env.SERVICE_ID;if(r&&!n){$e?.error("[log] No process.env.SERVICE_ID value found. Unable to set log file for log: "+e);return}let o=on.default.resolve(a),s=r?`${n}-${e}`:e;try{let i=`${o}/${s}.log`,p={target:"pino/file",options:{destination:i,mkdir:!0,sync:t,append:!0}};return $e?.info('[log] Log "%s" destination is file: %s',e,i),p}catch(i){$e?.error("[log] Unable to set up log destination: %s for log: %s",o,e,i)}}var on,$e,sn,pn=Z(()=>{"use strict";on=m(require("node:path"));Le();$e=process.env.NODE_ENV==="production"?console:void 0;sn=Ds});function Bs(){return{target:"pino-pretty",options:{colorize:!0,singleLine:!0,translateTime:"SYS:HH:MM:ss.l"}}}var vt,ha=Z(()=>{"use strict";vt=Bs});function Ls(e,t={}){if(xt.has(e))return xt.get(e);let a=sn(e,t?.sync);if(a)return xt.set(e,a),a;if(t?.prettyPrint){let r=vt();return xt.set(e,r),r}}var xt,un,ln=Z(()=>{"use strict";pn();ha();Le();xt=new Map;un=Ls});var yn,cn,Fa,ht,Sn=Z(()=>{"use strict";Le();yn=m(require("node:os")),cn=m(require("pino"));ln();Fa=class e{static getBase(){return{pid:process.pid,hostname:yn.default.hostname()}}static buildLogger(t,a,r={}){let{hideLogName:n,mixin:o,transport:s}=r;return(0,cn.default)({name:n?void 0:t,level:a,base:e.getBase(),mixin:o,transport:s??un(t,r)})}static prettyPrintEnabled(){return process.env.NEXT_PUBLIC_LOG_PRETTY_PRINT_ENABLED==="true"}},ht=Fa});function Os(e){return e?.split(/[\s,]+/)?.map(t=>t.trim())?.filter(t=>t?.length>0)}function Ft(e){return e?Os(e)?.map(a=>a.split("=")?.filter(r=>r?.trim()!==""))?.reduce((a,r)=>{let[n,o]=r;return a[n]=o,a},{}):{}}var cp,Sp,_a=Z(()=>{"use strict";cp=new RegExp(/^[\w!#$%&'*-/=?^`{|}~]+\S@[\w!#$%&'*-/=?^`{|}~]+\.[\w!#$%&'*-/=?^`{|}~]+$/);Sp=new RegExp(/^[\w.\-]+$/)});var dn={};ka(dn,{default:()=>Us});var _t,Na,Us,gn=Z(()=>{"use strict";Le();tr();_t=m(rn());xa();Sn();_a();Na=class e{constructor(){this.useTraceInfo=process.env.LOG_USE_TRACE_INFO==="true",this.logLevelApp=ye.validateLogLevel("app",process.env.NEXT_PUBLIC_LOG_LEVEL)??"silent",this.appLogOverrides=Ft(process.env.APP_LOG_LEVEL_OVERRIDES??""),this.prettyPrint=ht.prettyPrintEnabled();let t=this.useTraceInfo?()=>e.getTraceInfo():void 0;this.appLog=ht.buildLogger("app",this.logLevelApp,{mixin:t,prettyPrint:this.prettyPrint,hideLogName:!0}),this.syncLog=ht.buildLogger("app",this.logLevelApp,{mixin:t,prettyPrint:this.prettyPrint,hideLogName:!0,sync:!0})}getAppLog(t,a){let r=ye.getLogName(t),n=ye.validateLogLevel(r,this.appLogOverrides[r]);return n&&this.appLog.warn("Setting log level to %s for: %s ",n,r),this.appLog.child({name:r},{...a,level:n??this.logLevelApp})}getSyncLog(t,a){let r=ye.getLogName(t);return this.syncLog.child({name:r},a)}static setForwardedForHeader(t){this.xForwardedForHeader=t}static buildTraceInfo(t,a){let r={},n=t.get("x-li-cid")||t.get("x-lithium-community-id")||a.locals.tenant?.id;n&&(r.cid=n);let o=t.get("x-li-tx")||t.get("x-lithium-tx-id")||`${process.hrtime.bigint()}`;o&&(r.tx=o);let s=t.get("x-li-frame")||t.get("x-lithium-activity-frame");if(s)try{let p=JSON.parse(s),{id:u,time:y}=p;r.frameId=u,r.frameTime=y}catch(p){console.error('Unable to get frame information from "x-lithium-community-id" header',p)}let i=a.locals.uid;if(i!=null&&(r.uid=i),process.env.TRACE_INFO_ADD_IP==="true"){let p=e.xForwardedForHeader?t.get(e.xForwardedForHeader)??t.ip:t.ip;p&&(r.ip=p)}if(process.env.TRACE_INFO_ADD_URL==="true"){let p=t.originalUrl;p&&(r.url=p)}if(process.env.TRACE_INFO_ADD_AUTH_TOKEN==="true"){let p=a.locals.authToken;p&&(r.authToken=`${p.providerName}:${p.token}`)}return r}static setTraceInfo(t,a){_t.als&&_t.als.set("traceInfo",e.buildTraceInfo(t,a))}static getTraceInfo(){return _t.als?.get("traceInfo")??{}}},Us=Na});var In=B((Da,Mn)=>{"use strict";function Fe(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Fe=function(a){return typeof a}:Fe=function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Fe(e)}(function(e){var t=arguments,a=function(){var p=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,u=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,y=/[^-+\dA-Z]/g;return function(c,S,g,h){if(t.length===1&&i(c)==="string"&&!/\d/.test(c)&&(S=c,c=void 0),c=c||c===0?c:new Date,c instanceof Date||(c=new Date(c)),isNaN(c))throw TypeError("Invalid date");S=String(a.masks[S]||S||a.masks.default);var G=S.slice(0,4);(G==="UTC:"||G==="GMT:")&&(S=S.slice(4),g=!0,G==="GMT:"&&(h=!0));var F=function(){return g?"getUTC":"get"},O=function(){return c[F()+"Date"]()},K=function(){return c[F()+"Day"]()},H=function(){return c[F()+"Month"]()},ae=function(){return c[F()+"FullYear"]()},Y=function(){return c[F()+"Hours"]()},nt=function(){return c[F()+"Minutes"]()},ot=function(){return c[F()+"Seconds"]()},st=function(){return c[F()+"Milliseconds"]()},ie=function(){return g?0:c.getTimezoneOffset()},it=function(){return o(c)},qt=function(){return s(c)},pt={d:function(){return O()},dd:function(){return r(O())},ddd:function(){return a.i18n.dayNames[K()]},DDD:function(){return n({y:ae(),m:H(),d:O(),_:F(),dayName:a.i18n.dayNames[K()],short:!0})},dddd:function(){return a.i18n.dayNames[K()+7]},DDDD:function(){return n({y:ae(),m:H(),d:O(),_:F(),dayName:a.i18n.dayNames[K()+7]})},m:function(){return H()+1},mm:function(){return r(H()+1)},mmm:function(){return a.i18n.monthNames[H()]},mmmm:function(){return a.i18n.monthNames[H()+12]},yy:function(){return String(ae()).slice(2)},yyyy:function(){return r(ae(),4)},h:function(){return Y()%12||12},hh:function(){return r(Y()%12||12)},H:function(){return Y()},HH:function(){return r(Y())},M:function(){return nt()},MM:function(){return r(nt())},s:function(){return ot()},ss:function(){return r(ot())},l:function(){return r(st(),3)},L:function(){return r(Math.floor(st()/10))},t:function(){return Y()<12?a.i18n.timeNames[0]:a.i18n.timeNames[1]},tt:function(){return Y()<12?a.i18n.timeNames[2]:a.i18n.timeNames[3]},T:function(){return Y()<12?a.i18n.timeNames[4]:a.i18n.timeNames[5]},TT:function(){return Y()<12?a.i18n.timeNames[6]:a.i18n.timeNames[7]},Z:function(){return h?"GMT":g?"UTC":(String(c).match(u)||[""]).pop().replace(y,"").replace(/GMT\+0000/g,"UTC")},o:function(){return(ie()>0?"-":"+")+r(Math.floor(Math.abs(ie())/60)*100+Math.abs(ie())%60,4)},p:function(){return(ie()>0?"-":"+")+r(Math.floor(Math.abs(ie())/60),2)+":"+r(Math.floor(Math.abs(ie())%60),2)},S:function(){return["th","st","nd","rd"][O()%10>3?0:(O()%100-O()%10!=10)*O()%10]},W:function(){return it()},WW:function(){return r(it())},N:function(){return qt()}};return S.replace(p,function(d){return d in pt?pt[d]():d.slice(1,d.length-1)})}}();a.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},a.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]};var r=function(u,y){for(u=String(u),y=y||2;u.length<y;)u="0"+u;return u},n=function(u){var y=u.y,c=u.m,S=u.d,g=u._,h=u.dayName,G=u.short,F=G===void 0?!1:G,O=new Date,K=new Date;K.setDate(K[g+"Date"]()-1);var H=new Date;H.setDate(H[g+"Date"]()+1);var ae=function(){return O[g+"Date"]()},Y=function(){return O[g+"Month"]()},nt=function(){return O[g+"FullYear"]()},ot=function(){return K[g+"Date"]()},st=function(){return K[g+"Month"]()},ie=function(){return K[g+"FullYear"]()},it=function(){return H[g+"Date"]()},qt=function(){return H[g+"Month"]()},pt=function(){return H[g+"FullYear"]()};return nt()===y&&Y()===c&&ae()===S?F?"Tdy":"Today":ie()===y&&st()===c&&ot()===S?F?"Ysd":"Yesterday":pt()===y&&qt()===c&&it()===S?F?"Tmw":"Tomorrow":h},o=function(u){var y=new Date(u.getFullYear(),u.getMonth(),u.getDate());y.setDate(y.getDate()-(y.getDay()+6)%7+3);var c=new Date(y.getFullYear(),0,4);c.setDate(c.getDate()-(c.getDay()+6)%7+3);var S=y.getTimezoneOffset()-c.getTimezoneOffset();y.setHours(y.getHours()-S);var g=(y-c)/(864e5*7);return 1+Math.floor(g)},s=function(u){var y=u.getDay();return y===0&&(y=7),y},i=function(u){return u===null?"null":u===void 0?"undefined":Fe(u)!=="object"?Fe(u):Array.isArray(u)?"array":{}.toString.call(u).slice(8,-1).toLowerCase()};typeof define=="function"&&define.amd?define(function(){return a}):(typeof Da>"u"?"undefined":Fe(Da))==="object"?Mn.exports=a:e.dateFormat=a})(void 0)});function Vs(e,t,a,r){return[e,`background-color: ${t}; padding: 2px 3px; border-radius: 3px; color: white; ${a}`,"color: graytext","color: canvastext",...r??[]]}function ws(e,t,a,r){let{name:n,msg:o}=e,s=o?.replace(bn,"%O")??"",i=o?.match(bn)?.map(u=>{try{return JSON.parse(u)}catch{return u}})??[],p=(0,mn.default)(Date.now(),"HH:MM:ss.l");return Vs(`[${p}] %c${t}%c (${n}): %c${s}`,a,r,i)}function _e(e,t,a,r,n){return function(s){let i=a==="fatal"?"error":a;try{e[i](...t(s,a.toUpperCase(),r,n))}catch(p){e.error(p)}}}function ks(e,t){return{trace:_e(e,t,"trace","magenta"),debug:_e(e,t,"debug","blue"),info:_e(e,t,"info","green"),warn:_e(e,t,"warn","orange"),error:_e(e,t,"error","red"),fatal:_e(e,t,"fatal","red","font-weight: bold")}}function Cn(e){return ks(e,ws)}var mn,bn,An=Z(()=>{"use strict";mn=m(In()),bn=new RegExp(/{(?:[^{}]|({(?:[^{}]|({(?:[^{}]|())*}))*}))*}/g)});var Rn={};ka(Rn,{default:()=>qs});var En,Pn,Ba,qs,Tn=Z(()=>{"use strict";En=m(require("next/config")),Pn=m(require("pino"));An();xa();_a();ha();Ba=class{constructor(){let t=(0,En.default)();this.logLevelApp=t?.publicRuntimeConfig?.logLevelApp??"silent";let a=t?.publicRuntimeConfig?.prettyPrint==="true";this.appLogOverrides=Ft(t?.publicRuntimeConfig?.logLevelAppOverrides),this.rootLog=(0,Pn.default)({level:this.logLevelApp,browser:{asObject:!a,write:a?Cn(console):void 0},transport:a?vt():void 0})}getAppLog(t,a){let r=ye.getLogName(t),n=ye.validateLogLevel(r,this.appLogOverrides[r]);return n&&this.rootLog.warn("Setting log level to %s for: %s ",n,r),this.rootLog.child({name:r},{...a,level:n??this.logLevelApp})}},qs=Ba});var Vn=B((nu,Un)=>{"use strict";var Ys=require("brotli"),ce=require("node:fs"),Js=require("node:zlib"),$s=require("node:path"),Oa=require("node:util"),Bn={extension:"br",skipLarger:!0,mode:0,quality:11,lgwin:22},Xs={dirs:[],threshold:0,minRatio:1,brotliSettings:Bn,onProcessed:null,onBrotliProcessed:null,onGzipProcessed:null},Zs=Oa.promisify(ce.writeFile),Ua=Oa.promisify(ce.stat),ei=Oa.promisify(ce.readFile),Ln=function(e,t){let a=[];return ce.readdir(e,(r,n)=>{if(r)return t(r);let o=n.length;if(!o)return t(null,a);n.forEach(s=>{s=$s.resolve(e,s),ce.stat(s,(i,p)=>{p&&p.isDirectory()?Ln(s,(u,y)=>{a=a.concat(y),--o||t(null,a)}):(a.push(s),--o||t(null,a))})})})},Dn=e=>e/1e3,ti=async(e,t,a)=>new Promise(async r=>{let n=Ys.compress(await ei(e),Bn);if(n===null)return r(Nt(`${e}.br`,"result",t));let o=n.length/t,s=!1;try{await Ua(`${e}.br`),s=!1}catch{s=!0}return o>a.minRatio&&s===!0?r(Nt(`${e}.br`,"ratio",t,n.length)):(await Zs(`${e}.br`,n),r(On(`${e}.br`,t,n.length)))}),ai=(e,t,a)=>new Promise(r=>{let n=ce.createReadStream(e),o=ce.createWriteStream(`${e}.gz`),s=Js.createGzip({level:9});n.pipe(s).on("error",i=>console.error(i)).pipe(o).on("finish",async()=>{let i=await Ua(`${e}.gz`);if(i.size/t>a.minRatio){let u=Nt(`${e}.gz`,"ratio",t,i.size);ce.unlink(`${e}.gz`,()=>{}),r(u)}else{let u=On(`${e}.gz`,t,i.size);r(u)}}).on("error",i=>console.error(i))}),ri=async(e,t)=>{if(e.endsWith(".js")||e.endsWith(".css")||e.endsWith(".html")||e.endsWith(".svg")||e.endsWith("jpg")){let a=await Ua(e),{size:r}=a;if(r<t.threshold)return Nt(e,"size",r),{filePath:e,skipped:!0,brotli:null,gzip:null};let n=await ai(e,r,t);t.onGzipProcessed&&t.onGzipProcessed(n);let o=await ti(e,r,t);return t.onBrotliProcessed&&t.onBrotliProcessed(o),{filePath:e,skipped:!1,brotli:o,gzip:n}}return{filePath:e,skipped:!0,brotli:null,gzip:null}};function On(e,t,a,r){let n=a/t,s=`${n*100}% == ${Dn(t)}kB -> ${Dn(a)}kB`;return console.log(`[done] ${e}: ${s}`),{filePath:e,initialSize:t,compressedSize:a,type:r,ratio:n}}var Nt=(e,t,a,r)=>{let n=r/a,o=n*100;return{filePath:e,initialSize:a,compressedSize:r||null,ratio:n||null,ratioPercent:o||null}},ni=async e=>{e={...Xs,...e};let t=[];return e.dirs.forEach(a=>{Ln(a,(r,n)=>{if(!n)console.debug("No results found at",a);else{let o=n.map(async s=>{let i=await ri(s,e);return typeof e.onProcessed=="function"&&e.onProcessed(i),i});t.concat(o)}})}),t};Un.exports=function(e){return ni(e)}});var to=require("fs-extra"),ao=require("rimraf");var Ha=m(require("pino")),po=(0,Ha.default)({transport:{target:"pino-pretty",options:{sync:!0}},level:process.env.LOG_LEVEL??"info"});function C(e,t){return po.child({name:e??"sdk"},t)}var lt=require("fs-extra"),Ie=m(require("node:path")),Wa=m(require("shelljs"));var uo=m(require("fs-extra")),Gt=m(require("node:path"));var Qa=require("glob");var Ci=C("filePathHelper");function ee(e,t){return(0,Qa.glob)(e?.replaceAll(Gt.default.sep,Gt.default.posix.sep),t)}var De=C("graphql-types");async function lo(e,t,a){De.info("Building graphql types for plugin directory: %s",e);let r=t&&a?"**":t?"components":"endpoints",n=await ee(Ie.default.join(e,"src",r,"**","package.json"));return(await Promise.all(n.map(async s=>{let i=Ie.default.dirname(s),p=await ee(Ie.default.join(i,"**","*.graphql"));if(p.length>0){De.debug("Building types types for graphql files: %s",p);let u=Ie.default.join(i,"types","codegen.json");try{await(0,lt.copy)(Ie.default.join(__dirname,"..","types","codegen.json"),u);let y="graphql-codegen --config ./types/codegen.json ";De.debug(y);let c=Wa.default.exec(y,{fatal:!0,silent:!0,cwd:i});return c.code>0?De.error("Building graphql types failed for module at %s: %s",i,c.stderr):De.info("Building graphql types complete for module at %s",i),c.code}finally{await(0,lt.rm)(u)}}}))).find(s=>s>0)??0}var Ka=lo;var ja="build-time.txt",Ht="@khoros/endpoints",Qt="1.0.0",yo=Ht.slice(1).replaceAll("/","-"),Ti=`${yo}-${Qt}.tgz`;var k=require("fs-extra"),_=m(require("node:path")),yt=m(require("shelljs"));var za=require("node:fs/promises"),j=C("buildModules");function Wt(e,t,a){return`babel ${e} --ignore 'types/*.ts' --copy-files --config-file ${t} --out-dir ${a} --extensions ".ts"`}async function co(e,t,a){let r=null,n=Date.now(),o=_.default.join(e,"src"),s=_.default.join(o,"endpoints");if(await(0,k.pathExists)(s)){j.info("Building plugin modules at %s",_.default.resolve(__dirname,e));let i=_.default.join(e,"tsconfig.server.json"),p=_.default.join(e,"babelModules.config.json");if(await(0,k.pathExists)(p)&&await(0,k.pathExists)(i)){let u=_.default.isAbsolute(t)?t:_.default.join(e,t);j.debug(`Output directory is ${u}`);let y=_.default.join(u,"pkg");await(0,k.emptyDir)(y);let c=_.default.join(y,"endpoints"),S=[`tsc -p ${i} --noEmit`],g=_.default.join(o,"shared");if(await(0,k.pathExists)(g)){let F=await(0,za.readdir)(g);for(let O of F)j.info("Compiling shared package %s...",O),S.push(Wt(_.default.join(g,O),p,_.default.join(y,"shared",O)))}if(a&&a.size>0)for(let F of a)j.info("Compiling endpoint %s...",F),S.push(Wt(_.default.join(s,F),p,_.default.join(c,F)));else j.info("Compiling all modules..."),S.push(Wt(s,p,c));let h=S.join(" && "),G=yt.default.exec(h,{fatal:!0,cwd:e});if(G.code>0)return j.error("Error building modules: %s",G.stderr),{code:G.code};{let F=_.default.join(e,"package.json");if(await(0,k.pathExists)(F)){let O=await(0,k.readJSON)(F);O.workspaces=["endpoints/**/*","shared/**/*"],O.name=Ht,O.version=Qt,await(0,k.writeJSON)(_.default.join(y,"package.json"),O);let K=_.default.join(e,"package-lock.json"),H=_.default.join(e,"src","shared");await(0,k.pathExists)(H)&&(j.info("Copying /src/shared directory into output bundle"),await(0,k.copy)(H,_.default.join(y,"shared"),{overwrite:!0})),await(0,k.pathExists)(K)&&await(0,k.copy)(K,_.default.join(y,"package-lock.json"),{errorOnExist:!1}),j.debug(`Creating a tarball in ${y}`);let ae=yt.default.exec(`npm pack ${y} --pack-destination ${y}`);if(ae.stdout){r=_.default.join(y,ae.stdout.trim()),j.info("Created a tarball at %s",r);let Y=[`rm -rf ${y}/package.json`,`rm -rf ${y}/package-lock.json`,`rm -rf ${y}/endpoints`];yt.default.exec(Y.join(";"),{cwd:y})}}else j.warn("Missing package.json file in %s",o);await(0,k.writeFile)(_.default.join(y,ja),`${Date.now()}`),j.info("Module build complete in %d ms",Date.now()-n)}}else j.warn("No tsconfig.server.json file found. Please run init first.")}else j.info("No plugin modules to build");return{code:0,path:r}}var Ya=co;var be=m(require("fs-extra")),Se=m(require("node:path")),Kt=m(require("shelljs"));var Be=C("buildNext"),So=async e=>{let t=await ee(Se.default.join(e,"src","**","*.component.json"));return Promise.all(t.map(async a=>({path:a,descriptor:await be.default.readJson(a)})))},go=async(e,t)=>{let a={};return await Promise.all(t.map(async r=>{let{descriptor:n,path:o}=r,s=`./${n.id}`,i=Se.default.dirname(o),p=Se.default.join(i,"Component.tsx");await(0,be.pathExists)(p)||(p=Se.default.join(i,`${s}.tsx`)),await(0,be.pathExists)(p)?(Be.debug(`React component found at path ${p} for descriptor at path ${o}`),Object.assign(a,{[s]:`./${Se.default.relative(e,p)}`})):Be.error("No React component found at path %s for descriptor at path %s",p,o)})),a};async function Ja(e,t){let a=await So(e),r=await go(e,a);return Be.info("Federation config is %O",r),await be.default.writeJSON(Se.default.join(e,"federation.config.json"),{name:"auroraComponents"+(t?"Local":""),exposes:r,extraOptions:{debug:!1}}),a}async function Mo(e){Kt.default.env.NEXT_PRIVATE_LOCAL_WEBPACK="true";let t=`next build ${e}`;try{let a=Kt.default.exec(t,{async:!1,fatal:!0,cwd:e});return a.code>0&&Be.error("Error in NextJS build"),{code:a.code}}catch(a){return Be.error("Error running next command: %s",t,a?.message),{code:1}}}var $a=Mo;var jt=m(require("node:path"));var Xa=C("changeSet");function Io(){let e=process.env.CHANGE_SET;return e?.length>0?e.split(/[\s,]/):null}function bo(e){let t=e??Io();if(t?.length>0){Xa.info("Parsing changeset: %O",t);let a=!1;t.some(o=>o.includes(jt.default.join("src","components")))&&(a=!0);let r=!1;t.some(o=>o.includes(jt.default.join("src","endpoints")))&&(r=!0),t.some(o=>o=="package.json"||o.startsWith(".github"))&&(a=!0,r=!0);let n={buildComponents:a,buildEndpoints:r};return Xa.info("Changeset result: %O",n),n}return null}var Za=bo;function Gs(){if(typeof window>"u"){let e=(gn(),Ga(dn)).default;return new e}else{let e=(Tn(),Ga(Rn)).default;return new e}}var Hs=Gs();function fn(e,t){return Hs.getAppLog(e,t)}var xp=fn(module);var xn=m(require("dotenv-flow")),hn=m(require("findup-sync")),La=m(require("node:path")),Fn=m(require("yargs")),_n=require("yargs/helpers");var Op=require("graphql-import-node"),vn=require("@urql/core");var wp=C("GraphqlClient");var zp=C("versionCheck");var Xe=C("cli");function Ks(){if(!global.sdkConfigLoaded){let e=(0,hn.default)(".env*");if(e){Xe.debug("Loading config from .env files: $s",e);let{error:t,parsed:a}=xn.default.config({path:La.default.dirname(e)});t?(Xe.error(t,"Error reading config file"),process.exit(1)):Xe.info("Using config values: %O",a)}}global.sdkConfigLoaded=!0}function js(e){let t=e.indexOf("node_modules");return t===1?e:e.slice(0,t-1)}function zs(e,t,a,r,n){Ks(),(0,Fn.default)((0,_n.hideBin)(process.argv)).scriptName(e).options(r??{}).env("PLUGIN").usage("$0 [repoPath]").command("$0 [repoPath]",t,o=>{let s=js(process.cwd());return o.positional("repoPath",{describe:"The full path to plugin root directory.",default:s,type:"string"})},async o=>{await a(o)}).check(async o=>{let{repoPath:s}=o;if(!s)throw new Error("No plugin repository path found. Please either pass it as an argument to this process or specify it in your .env file as PLUGIN_REPO_PATH. ");if(!La.default.isAbsolute(s))throw new Error("The plugin repository path must be a full (not relative) path.");return n?await n(o):!0}).help().showHelpOnFail(!1).fail((o,s)=>{s?Xe.error(s.message):Xe.error(o),process.exit(1)}).parse()}var Nn=zs;var wn=m(Vn()),kn=require("fs-extra"),Bt=m(require("node:path"));var Dt=C("compress");async function oi(e,t){let a=Bt.default.isAbsolute(t)?t:Bt.default.join(e,t),r=Bt.default.join(a,"mf");if(await(0,kn.pathExists)(r)){Dt.info("Compressing assets in %s",r);try{await(0,wn.default)({dirs:[r]}),Dt.info("Compressing assets complete")}catch(n){Dt.error(n,"Error compressing assets")}}else Dt.info("No mf assets to compress")}var qn=oi;var Ze=m(require("node:path")),Gn=m(require("shelljs"));var Lt=C("format");function si(e,t){Lt.info("Formatting plugin directory: %s",t);let a=e==="format:fix"?"--write":"--check",r=`prettier --config ${Ze.default.join(t,".prettierrc.js")} --ignore-path ${Ze.default.join(t,".prettierignore")} ${a} ${Ze.default.join(t,"res")} ${Ze.default.join(t,"src")} `;Lt.debug(r);let n=Gn.default.exec(r,{cwd:t});return n.code>0?Lt.warn("Formatting errors found for plugin at %s",t):Lt.info("Formatting complete for plugin at %s",t),n.code}var Hn=si;var T=require("fs-extra"),R=m(require("node:path"));var et=C("setup"),ii={hooks:{"pre-commit":"npm run precommit","post-commit":"git update-index --again"}},pi={"**/*.{js,jsx,ts,tsx,css,scss,pcss,json}":["prettier --write"],"**/*.{js,ts,tsx}":["eslint --fix --ignore-pattern '!.eslintrc.js' --ignore-pattern '!.prettierrc.js'"]},te=R.default.resolve(__dirname,R.default.join("..")),ui=R.default.join(te,"templates");async function Qn(e){return(await(0,T.readFile)(e)).toString().split(`
|
|
7
|
-
`).map(a=>a.trim())}async function li(e,t){let a=R.default.join(e,"package.json");if(await(0,T.pathExists)(a)){let r=await(0,T.readJson)(a,"utf8"),o=(await(0,T.readJson)(R.default.join(te,"package.json"))).name;if(t&&!r.devDependencies[o]&&!r.dependencies[o])et.warn("SDK not found as a dependency of package.json file at %s. Skipping init step.",a);else{et.info("Initializing plugin directory %s",e),await(0,T.remove)(R.default.join(e,"app")),await(0,T.ensureDir)(R.default.join(e,"pages")),await(0,T.ensureDir)(R.default.join(e,"src"));async function s(p,u=!0){let y=R.default.join(ui,p),c=p.replaceAll(".tmpl",""),S=R.default.join(e,c);if(et.debug(`Copying ${y} to ${S}`),await(0,T.copy)(y,S,{overwrite:u}),!u&&c.startsWith(".")&&c.endsWith("ignore")&&await(0,T.pathExists)(S)){let g=await
|
|
8
|
-
`))}}let i={".env.local.tmpl":!1,".eslintignore.tmpl":!1,".eslintrc.tmpl.js":!1,".gitignore.tmpl":!1,".npmrc.tmpl":!0,".nvmrc.tmpl":!0,".prettierignore.tmpl":!1,".prettierrc.tmpl.js":!1,"tsconfig.server.tmpl.json":!0,"tsconfig.tmpl.json":!0,"babelModules.config.tmpl.json":!1};et.info(`Copying template files to the plugin at ${e}`),await Promise.all(Object.keys(i).map(async p=>{await s(p,i[p])})),r.workspaces=["src/**/*"],r.engines={node:">=18"},r.scripts||(r.scripts={}),r.scripts.start=`npm explore ${o} -- npm run start`,r.scripts["start:logger"]=`npm explore ${o} -- npm run start:logger`,r.scripts.dev=`npm explore ${o} -- npm run dev:plugin`,r.scripts.build=`npm explore ${o} -- npm run build:plugin`,r.scripts["build:graphql"]=`npm explore ${o} -- npm run build:graphql`,r.scripts.lint=`npm explore ${o} -- npm run lint:plugin`,r.scripts["lint:fix"]=`npm explore ${o} -- npm run lint:plugin:fix`,r.scripts.format=`npm explore ${o} -- npm run format:plugin`,r.scripts["format:fix"]=`npm explore ${o} -- npm run format:plugin:fix`,r.scripts.init=`npm explore ${o} -- npm run init:plugin`,r.scripts.validate=`npm explore ${o} -- npm run validate:plugin`,r.scripts.gen=`npm explore ${o} -- npm run gen`,r.scripts.precommit="lint-staged",r.husky=ii,r["lint-staged"]=pi,await(0,T.writeJson)(a,r,{spaces:" "}),await(0,T.copy)(R.default.join(te,"README.md"),R.default.join(e,"SDK.md"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"next.config.js"),R.default.join(e,"next.config.js"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"next.overrides.js"),R.default.join(e,"next.overrides.js"),{overwrite:!1}),await(0,T.copy)(R.default.join(te,"postcss.config.js"),R.default.join(e,"postcss.config.js"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"types","mf","index.d.ts"),R.default.join(e,"types","mf","aurora.d.ts"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"types","pkg","index.d.ts"),R.default.join(e,"types","pkg","aurora.d.ts"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"types","graphql.d.ts"),R.default.join(e,"types","graphql.d.ts"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"templates","pcss.d.ts.tmpl"),R.default.join(e,"types","pcss.d.ts"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"types","graphql-schema-types.ts"),R.default.join(e,"types","graphql-schema-types.ts"),{overwrite:!0})}}else et.warn("No package.json file found at %s. Skipping init step.",a)}var Wn=li;var Va=m(require("node:path")),Kn=m(require("shelljs"));var jn=require("fs-extra"),Ot=C("lintPlugin");async function yi(e,t){let a=Va.default.join(t,"src");if(await(0,jn.pathExists)(a)){Ot.info("Linting plugin directory: %s",t);let r=e==="lint:fix"?"--fix --max-warnings=0":"",n=`eslint --ext .js --ext .jsx --ext .tsx --ext .ts --cache --config ${Va.default.join(t,".eslintrc.js")} --no-error-on-unmatched-pattern --ignore-pattern '**/types/*' ${r} ${a}`;Ot.debug(n);let o=Kn.default.exec(n,{fatal:!0,cwd:t});return o.code>0?Ot.error("Linting failed for plugin at %s",t):Ot.info("Linting complete for plugin at %s",t),o.code}return 0}var zn=yi;var tt=(o=>(o.Freemarker="FREEMARKER",o.Handlebars="HANDLEBARS",o.Html="HTML",o.Javascript="JAVASCRIPT",o.React="REACT",o))(tt||{});var Ut=(i=>(i.Delete="DELETE",i.Get="GET",i.Head="HEAD",i.Options="OPTIONS",i.Patch="PATCH",i.Post="POST",i.Put="PUT",i))(Ut||{});var at=(o=>(o.Content="CONTENT",o.Custom="CUSTOM",o.People="PEOPLE",o.Places="PLACES",o.Texthtml="TEXTHTML",o))(at||{});var rt=require("fs-extra"),q=m(require("node:path"));var Vt=(o=>(o.Json="JSON",o.Multipart="MULTIPART",o.MultipartFiles="MULTIPART_FILES",o.None="NONE",o.UrlEncoded="URL_ENCODED",o))(Vt||{});var Yn=m(require("fs-extra"));var Iu=C("fileUtils");function ci(e){return Promise.all(e.map(async t=>({path:t,descriptor:await Yn.default.readJson(t)})))}async function wt(e){let t=await ee(e);return ci(t)}var wa=require("fs-extra"),$n=require("glob"),Xn=require("minimatch"),Ne=m(require("node:path"));var Jn={ReactComponent:["@fluentui/react-*","@coveo/atomic-react","@coveo/atomic","@coveo/headless-react","@coveo/headless","@tanstack/react-query","@tanstack/react-table","clone-deep","dateformat","dayjs","file-saver","isomorphic-dompurify","js-base64","lil-uri","moment-timezone","path-to-regexp","react","react-beautiful-dnd","react-bootstrap","react-hook-form","react-quill","react-select","react-uid","react-use","react-dropzone","sanitize-html","tabbable","tiny-lru","universal-cookie"],Endpoint:["brotli","clone-deep","cookie","dateformat","js-base64","jsonwebtoken","lil-uri","path-to-regexp","tiny-lru","universal-cookie"]};var gi={async validatePackageDependencies(e,t,a=""){let{path:r}=e,n=Ne.default.dirname(r),o=Ne.default.join(n,"package.json"),s=[],i={allowedDependencies:[],disallowedDependencies:[]};if(t==="Endpoint"||t==="ReactComponent"){s=Jn[t];let p=await(0,$n.glob)("**/package.json",{cwd:Ne.default.join(a,"src"),ignore:[Ne.default.join(a,"src","endpoints","**","node_modules","**"),Ne.default.join(a,"src","components","**","node_modules","**")],absolute:!0}),u=await Promise.all(p.map(async y=>(await(0,wa.readJSON)(y)).name));await(0,wa.readJSON)(o).then(y=>(y.dependencies&&(i.allowedDependencies=[...s,...u],i.disallowedDependencies=Object.keys(y.dependencies).filter(c=>!i.allowedDependencies.some(S=>(0,Xn.minimatch)(c,S)))),null))}return i}},Zn=gi;var Me=C("validationUtils"),Mi={validateCustomComponentDescriptor(e,t=[]){return e.id||t.push("Component id is missing or empty for descriptor: "+JSON.stringify(e)),e.markupLanguage?Object.values(tt).includes(e.markupLanguage)||t.push("Component markupLanguage value is invalid for descriptor: "+JSON.stringify(e)+". Valid markupLanguage values are: "+JSON.stringify(Object.values(tt))):t.push("Component markupLanguage field is missing for descriptor: "+JSON.stringify(e)+". Valid markupLanguage values are: "+JSON.stringify(Object.values(tt))),e.grouping?Object.values(at).includes(e.grouping)||t.push("Component grouping value is invalid for descriptor: "+JSON.stringify(e)+". Valid grouping values are: "+JSON.stringify(Object.values(at))):t.push("Component grouping field is missing for descriptor: "+JSON.stringify(e)+". Valid grouping values are: "+JSON.stringify(Object.values(at))),!e.components||e.components.length===0?t.push('Missing "components" field for descriptor: '+JSON.stringify(e)):e.components.some(a=>`custom.widget.${e.id}`===a.id)||t.push(`Invalid "components" field for descriptor. Components field id should be "custom.widget.${e.id}": Descriptor is ${JSON.stringify(e)}`),t},validateReactComponentDescriptor(e,t=[]){return this.validateCustomComponentDescriptor(e,t),e.markupLanguage!="REACT"&&t.push('Component descriptor markup language must be "REACT" for descriptor: '+JSON.stringify(e)),t},validateEndpointDescriptor(e,t=[]){return e.id||t.push("Endpoint id field is missing or empty for descriptor: "+JSON.stringify(e)),e.bodyType&&!Object.values(Vt).includes(e.bodyType)&&t.push("Endpoint body type field is invalid for descriptor: "+JSON.stringify(e)+". Valid body types are: "+JSON.stringify(Object.values(Vt))),e.httpMethods&&e.httpMethods.some(a=>!Object.values(Ut).includes(a))&&t.push("Endpoint httpMethods field is invalid for descriptor: "+JSON.stringify(e)+". Valid httpMethods are: "+JSON.stringify(Object.values(Ut))),t},validateModule(e,t=[]){let{descriptor:a,path:r}=e,n=/\.(\w+)\.json/,o=q.default.basename(r).replace(n,""),s=n.exec(r);if(s.length<2)t.push("No descriptor type found");else{let[,i]=s,p=q.default.dirname(r),u=q.default.basename(p);u===i&&t.push(`A descriptor needs to go into its own directory under ${i}s at ${r}.`),o!=u?t.push(`Descriptor filename prefix (${o}) must match descriptor directory name (${u}) at ${r}`):a.id!=u&&t.push(`Descriptor id (${a.id}) must match descriptor directory name (${u}) at ${r}`)}return t},async validatePackageDescriptor(e,t,a="",r=!1,n=[]){let{path:o}=e,s=q.default.dirname(o),i=q.default.join(s,"package.json");if(!await(0,rt.pathExists)(i))n.push(`No package descriptor (package.json) found in ${s}`);else{let p=await Zn.validatePackageDependencies(e,t,a);if(p.disallowedDependencies.length>0){let u=`Disallowed dependencies found in ${s}/package.json: ${p.disallowedDependencies.join(", ")}. Only the following dependencies are allowed: ${p.allowedDependencies.sort().join(", ")}`;r?Me.warn(u):n.push(u)}}return n},async validateReactComponent(e,t,a=!1,r=[]){let{descriptor:n,path:o}=e;this.validateReactComponentDescriptor(n,r),this.validateModule(e,r),await this.validatePackageDescriptor(e,"ReactComponent",t,a,r);let s=q.default.dirname(o),i=q.default.join(s,"Component.tsx"),p=`${n.id}.tsx`;return await(0,rt.pathExists)(i)||(i=q.default.join(s,p)),await(0,rt.pathExists)(i)||r.push(`No valid React component (${p}) found in ${s}`),r},async validateEndpoint(e,t,a=!1,r=[]){let{descriptor:n,path:o}=e;this.validateEndpointDescriptor(n,r),this.validateModule(e,r),await this.validatePackageDescriptor(e,"Endpoint",t,a,r);let s=q.default.dirname(o),i=q.default.join(s,"index.ts");return await(0,rt.pathExists)(i)||r.push(`No valid endpoint (index.ts) found in ${s}`),r},async validatePlugin(e,t=!1,a=!1,r=!1){Me.info("Validating plugin files at %s...",e);let n=[];if(t){Me.info("Validating component descriptors...");let o=await ee(q.default.join(e,"res","components","*"));for await(let s of o){let i=await wt(q.default.join(s,"*.component.json"));if(i.length===0)Me.warn(`No component descriptor (<ComponentName>.component.json) found in ${s}`);else for(let p of i)this.validateCustomComponentDescriptor(p.descriptor,n),this.validateModule(p,n)}}if(a){Me.info("Validating React components...");let o=await ee(q.default.join(e,"src","components","*"));for await(let s of o){let i=await wt(q.default.join(s,"*.component.json"));if(i.length===0)n.push(`No component descriptor (<ComponentName>.component.json) found in ${s}`);else for await(let p of i)await this.validateReactComponent(p,e,!1,n)}}if(r){Me.info("Validating endpoints...");let o=await ee(q.default.join(e,"src","endpoints","*"));for await(let s of o){let i=await wt(q.default.join(s,"*.endpoint.json"));if(i.length===0)n.push(`No endpoint descriptor (<EndpointName>.endpoint.json) found in ${s}`);else for await(let p of i)await this.validateEndpoint(p,e,!1,n)}}return Me.info(`Plugin files are validated. ${n.length===0?"No":n.length} error(s) found.`),n}},eo=Mi;var kt=C("build");Nn("build:modules","Build the plugin modules",async({repoPath:e,outputDirectory:t,init:a,lint:r,format:n,changeSet:o,mf:s,pkg:i})=>{let p=Date.now();if(await(0,to.pathExists)(t))try{kt.info("Cleaning output directory at %s",t),await(0,ao.rimraf)(t)}catch(h){kt.error(h,"Error cleaning output directory at %s",t)}a===!0&&await Wn(e,!0);let u=Za(o),y=u?.buildComponents??s===!0,c=u?.buildEndpoints??i===!0,S=await eo.validatePlugin(e,!(s===!1||i===!1),y,c);if(S.length>0){for(let h of S)kt.error("Validation Error: %s",h);throw new Error("Terminating build due to validation errors")}if(r===!0&&await zn("lint",e)>0)throw new Error("Terminating build due to lint failure");if(n===!0&&Hn("format",e),await Ka(e,y,y||c)>0)throw new Error("Terminating build due to failure in building graphql types");if(y)if(await Ja(e,!1),(await $a(e)).code==0)await qn(e,t);else throw new Error("Terminating build due to component build failure");if(c&&(await Ya(e,t)).code>0)throw new Error("Terminating build due to module build failure");kt.info("Plugin build complete in "+(Date.now()-p)+"ms")},{b:{alias:"branchName",demandOption:!1,default:"main",describe:'The branch to build. If not specified, "main" is assumed. This does not control the checked out files but adds an additional branch segment to the S3 file key',type:"string"},c:{alias:"changeSet",demandOption:!1,describe:"A set of changed files. If not specified, all components and middlewares in the plugin will be built. If specified, only components and middlewares with changed files will be built.",type:"array"},o:{alias:"outputDirectory",demandOption:!1,default:"dist",describe:'The output directory. If not specified, "dist" is assumed. This is where the build artifacts will be placed.',type:"string"},i:{alias:"init",demandOption:!1,default:!1,describe:"Whether to init the plugin as part of the build process",type:"boolean"},l:{alias:"lint",demandOption:!1,default:!0,describe:"Whether to run lint as part of the build process.",type:"boolean"},f:{alias:"format",demandOption:!1,default:!1,describe:"Whether to run format as part of the build process.",type:"boolean"},m:{alias:"mf",demandOption:!1,default:!0,describe:"Whether to build the module federation (mf) artifacts.",type:"boolean"},p:{alias:"pkg",demandOption:!1,default:!0,describe:"Whether to build the module (pkg) artifacts.",type:"boolean"}});
|
|
6
|
+
`+V.inspect(t))):(se.ok(a,"can't remove top context"),this._set.splice(a,1))};X.prototype.bindEmitter=function(t){se.ok(t.on&&t.addListener&&t.emit,"can only bind real EEs");let a=this,r="context@"+this.name;function n(s){s&&(s[Ye]||(s[Ye]=Object.create(null)),s[Ye][r]={namespace:a,context:a.active})}function o(s){if(!(s&&s[Ye]))return s;let i=s,p=s[Ye];return Object.keys(p).forEach(function(u){let y=p[u];i=y.namespace.bind(i,y.context)}),i}Ts(t,n,o)};X.prototype.fromException=function(t){return t[Je]};function $r(e){return process.namespaces[e]}function vs(e){se.ok(e,"namespace must be given a name."),L&&U("CREATING NAMESPACE "+e);let t=new X(e);return t.id=w,ve.addHooks({init(a,r,n,o,s){w=a,o?(t._contexts.set(a,t._contexts.get(o)),L&&U("PARENTID: "+e+" uid:"+a+" parent:"+o+" provider:"+n)):t._contexts.set(w,t.active),L&&U("INIT "+e+" uid:"+a+" parent:"+o+" provider:"+Jr[n]+" active:"+V.inspect(t.active,!0))},pre(a,r){w=a;let n=t._contexts.get(a);n?(L&&U(" PRE "+e+" uid:"+a+" handle:"+vt(r)+" context:"+V.inspect(n)),t.enter(n)):L&&U(" PRE MISSING CONTEXT "+e+" uid:"+a+" handle:"+vt(r))},post(a,r){w=a;let n=t._contexts.get(a);n?(L&&U(" POST "+e+" uid:"+a+" handle:"+vt(r)+" context:"+V.inspect(n)),t.exit(n)):L&&U(" POST MISSING CONTEXT "+e+" uid:"+a+" handle:"+vt(r))},destroy(a){w=a,L&&U("DESTROY "+e+" uid:"+a+" context:"+V.inspect(t._contexts.get(w))+" active:"+V.inspect(t.active,!0)),t._contexts.delete(a)}}),process.namespaces[e]=t,t}function Xr(e){let t=$r(e);se.ok(t,`can't delete nonexistent namespace! "`+e+'"'),se.ok(t.id,"don't assign to process.namespaces directly! "+V.inspect(t)),process.namespaces[e]=null}function fs(){process.namespaces&&Object.keys(process.namespaces).forEach(function(e){Xr(e)}),process.namespaces=Object.create(null)}process.namespaces={};ve._state&&!ve._state.enabled&&ve.enable();function U(e){process.env.DEBUG&&process._rawDebug(e)}function vt(e){if(!e)return e;if(typeof e=="function")return e.name?e.name:(e.toString().trim().match(/^function\s*([^\s(]+)/)||[])[1];if(e.constructor&&e.constructor.name)return e.constructor.name}if(L){Ta=Pa();for(Yr in Ta.filter._modifiers)Ta.filter.deattach(Yr)}var Ta,Yr});var tn=B((Xi,va)=>{"use strict";var xs=Cr();process&&xs.gte(process.versions.node,"8.0.0")?va.exports=Nr():va.exports=en()});var an=B(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.cls=void 0;var hs=tn(),fe=hs.createNamespace("@kibertoad/als");xe.cls={storageImplementation:"cls-hooked",get:e=>{if(fe.active)return fe.get(e)},set:(e,t)=>{fe.active&&fe.set(e,t)},runWith:(e,t)=>{fe.run(()=>{if(t){let a=Object.keys(t);for(let r=0;r<a.length;r++)fe.set(a[r],t[a[r]])}e()})}};xe.default=xe.cls});var rn=B(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.als=void 0;var{getNodeVersion:Fs,isAlsSupported:_s,nodeVersionString:Ns}=ar();he.als=_s(Fs(Ns))?rr().als:an().cls;he.default=he.als});var nn,fa,ye,xa=Z(()=>{"use strict";nn=m(require("pino")),fa=class{static getLogName(t){return(typeof t=="string"?t:t.id).replaceAll(/\.(tsx?|jsx?)/gi,"").split("/").filter(n=>n!==".").at(-1)}static validateLogLevel(t,a){if(t&&a){let r=a.toLowerCase(),{values:n}=nn.default.levels;if(n[r]===void 0)global.appLog?.warn("Unable to set %s log level to %s as it is an invalid value. Valid values are: %s",t,a,Object.keys(n));else return r}return null}},ye=fa});function Ds(e,t=!1){$e?.debug("[log] Using file transport for log %s",e);let a=process.env.LOG_DIR;if(!a){$e?.debug("[log] No process.env.LOG_DIR value found for log %s. Disabling file logging.",e);return}let r=process.env.USE_LOG_FILE_SERVICE_ID_PREFIX==="true",n=process.env.SERVICE_ID;if(r&&!n){$e?.error("[log] No process.env.SERVICE_ID value found. Unable to set log file for log: "+e);return}let o=on.default.resolve(a),s=r?`${n}-${e}`:e;try{let i=`${o}/${s}.log`,p={target:"pino/file",options:{destination:i,mkdir:!0,sync:t,append:!0}};return $e?.info('[log] Log "%s" destination is file: %s',e,i),p}catch(i){$e?.error("[log] Unable to set up log destination: %s for log: %s",o,e,i)}}var on,$e,sn,pn=Z(()=>{"use strict";on=m(require("node:path"));Le();$e=process.env.NODE_ENV==="production"?console:void 0;sn=Ds});function Bs(){return{target:"pino-pretty",options:{colorize:!0,singleLine:!0,translateTime:"SYS:HH:MM:ss.l"}}}var ft,ha=Z(()=>{"use strict";ft=Bs});function Ls(e,t={}){if(xt.has(e))return xt.get(e);let a=sn(e,t?.sync);if(a)return xt.set(e,a),a;if(t?.prettyPrint){let r=ft();return xt.set(e,r),r}}var xt,un,ln=Z(()=>{"use strict";pn();ha();Le();xt=new Map;un=Ls});var yn,cn,Fa,ht,Sn=Z(()=>{"use strict";Le();yn=m(require("node:os")),cn=m(require("pino"));ln();Fa=class e{static getBase(){return{pid:process.pid,hostname:yn.default.hostname()}}static buildLogger(t,a,r={}){let{hideLogName:n,mixin:o,transport:s}=r;return(0,cn.default)({name:n?void 0:t,level:a,base:e.getBase(),mixin:o,transport:s??un(t,r)})}static prettyPrintEnabled(){return process.env.NEXT_PUBLIC_LOG_PRETTY_PRINT_ENABLED==="true"}},ht=Fa});function Os(e){return e?.split(/[\s,]+/)?.map(t=>t.trim())?.filter(t=>t?.length>0)}function Ft(e){return e?Os(e)?.map(a=>a.split("=")?.filter(r=>r?.trim()!==""))?.reduce((a,r)=>{let[n,o]=r;return a[n]=o,a},{}):{}}var cp,Sp,_a=Z(()=>{"use strict";cp=new RegExp(/^[\w!#$%&'*-/=?^`{|}~]+\S@[\w!#$%&'*-/=?^`{|}~]+\.[\w!#$%&'*-/=?^`{|}~]+$/);Sp=new RegExp(/^[\w.\-]+$/)});var dn={};ka(dn,{default:()=>Us});var _t,Na,Us,gn=Z(()=>{"use strict";Le();tr();_t=m(rn());xa();Sn();_a();Na=class e{constructor(){this.useTraceInfo=process.env.LOG_USE_TRACE_INFO==="true",this.logLevelApp=ye.validateLogLevel("app",process.env.NEXT_PUBLIC_LOG_LEVEL)??"silent",this.appLogOverrides=Ft(process.env.APP_LOG_LEVEL_OVERRIDES??""),this.prettyPrint=ht.prettyPrintEnabled();let t=this.useTraceInfo?()=>e.getTraceInfo():void 0;this.appLog=ht.buildLogger("app",this.logLevelApp,{mixin:t,prettyPrint:this.prettyPrint,hideLogName:!0}),this.syncLog=ht.buildLogger("app",this.logLevelApp,{mixin:t,prettyPrint:this.prettyPrint,hideLogName:!0,sync:!0})}getAppLog(t,a){let r=ye.getLogName(t),n=ye.validateLogLevel(r,this.appLogOverrides[r]);return n&&this.appLog.warn("Setting log level to %s for: %s ",n,r),this.appLog.child({name:r},{...a,level:n??this.logLevelApp})}getSyncLog(t,a){let r=ye.getLogName(t);return this.syncLog.child({name:r},a)}static setForwardedForHeader(t){this.xForwardedForHeader=t}static buildTraceInfo(t,a){let r={},n=t.get("x-li-cid")||t.get("x-lithium-community-id")||a.locals.tenant?.id;n&&(r.cid=n);let o=t.get("x-li-tx")||t.get("x-lithium-tx-id")||`${process.hrtime.bigint()}`;o&&(r.tx=o);let s=t.get("x-li-frame")||t.get("x-lithium-activity-frame");if(s)try{let p=JSON.parse(s),{id:u,time:y}=p;r.frameId=u,r.frameTime=y}catch(p){console.error('Unable to get frame information from "x-lithium-community-id" header',p)}let i=a.locals.uid;if(i!=null&&(r.uid=i),process.env.TRACE_INFO_ADD_IP==="true"){let p=e.xForwardedForHeader?t.get(e.xForwardedForHeader)??t.ip:t.ip;p&&(r.ip=p)}if(process.env.TRACE_INFO_ADD_URL==="true"){let p=t.originalUrl;p&&(r.url=p)}if(process.env.TRACE_INFO_ADD_AUTH_TOKEN==="true"){let p=a.locals.authToken;p&&(r.authToken=`${p.providerName}:${p.token}`)}return r}static setTraceInfo(t,a){_t.als&&_t.als.set("traceInfo",e.buildTraceInfo(t,a))}static getTraceInfo(){return _t.als?.get("traceInfo")??{}}},Us=Na});var In=B((Da,Mn)=>{"use strict";function Fe(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Fe=function(a){return typeof a}:Fe=function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Fe(e)}(function(e){var t=arguments,a=function(){var p=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,u=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,y=/[^-+\dA-Z]/g;return function(c,S,g,h){if(t.length===1&&i(c)==="string"&&!/\d/.test(c)&&(S=c,c=void 0),c=c||c===0?c:new Date,c instanceof Date||(c=new Date(c)),isNaN(c))throw TypeError("Invalid date");S=String(a.masks[S]||S||a.masks.default);var G=S.slice(0,4);(G==="UTC:"||G==="GMT:")&&(S=S.slice(4),g=!0,G==="GMT:"&&(h=!0));var F=function(){return g?"getUTC":"get"},O=function(){return c[F()+"Date"]()},K=function(){return c[F()+"Day"]()},W=function(){return c[F()+"Month"]()},ae=function(){return c[F()+"FullYear"]()},Y=function(){return c[F()+"Hours"]()},nt=function(){return c[F()+"Minutes"]()},ot=function(){return c[F()+"Seconds"]()},st=function(){return c[F()+"Milliseconds"]()},ie=function(){return g?0:c.getTimezoneOffset()},it=function(){return o(c)},qt=function(){return s(c)},pt={d:function(){return O()},dd:function(){return r(O())},ddd:function(){return a.i18n.dayNames[K()]},DDD:function(){return n({y:ae(),m:W(),d:O(),_:F(),dayName:a.i18n.dayNames[K()],short:!0})},dddd:function(){return a.i18n.dayNames[K()+7]},DDDD:function(){return n({y:ae(),m:W(),d:O(),_:F(),dayName:a.i18n.dayNames[K()+7]})},m:function(){return W()+1},mm:function(){return r(W()+1)},mmm:function(){return a.i18n.monthNames[W()]},mmmm:function(){return a.i18n.monthNames[W()+12]},yy:function(){return String(ae()).slice(2)},yyyy:function(){return r(ae(),4)},h:function(){return Y()%12||12},hh:function(){return r(Y()%12||12)},H:function(){return Y()},HH:function(){return r(Y())},M:function(){return nt()},MM:function(){return r(nt())},s:function(){return ot()},ss:function(){return r(ot())},l:function(){return r(st(),3)},L:function(){return r(Math.floor(st()/10))},t:function(){return Y()<12?a.i18n.timeNames[0]:a.i18n.timeNames[1]},tt:function(){return Y()<12?a.i18n.timeNames[2]:a.i18n.timeNames[3]},T:function(){return Y()<12?a.i18n.timeNames[4]:a.i18n.timeNames[5]},TT:function(){return Y()<12?a.i18n.timeNames[6]:a.i18n.timeNames[7]},Z:function(){return h?"GMT":g?"UTC":(String(c).match(u)||[""]).pop().replace(y,"").replace(/GMT\+0000/g,"UTC")},o:function(){return(ie()>0?"-":"+")+r(Math.floor(Math.abs(ie())/60)*100+Math.abs(ie())%60,4)},p:function(){return(ie()>0?"-":"+")+r(Math.floor(Math.abs(ie())/60),2)+":"+r(Math.floor(Math.abs(ie())%60),2)},S:function(){return["th","st","nd","rd"][O()%10>3?0:(O()%100-O()%10!=10)*O()%10]},W:function(){return it()},WW:function(){return r(it())},N:function(){return qt()}};return S.replace(p,function(d){return d in pt?pt[d]():d.slice(1,d.length-1)})}}();a.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},a.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]};var r=function(u,y){for(u=String(u),y=y||2;u.length<y;)u="0"+u;return u},n=function(u){var y=u.y,c=u.m,S=u.d,g=u._,h=u.dayName,G=u.short,F=G===void 0?!1:G,O=new Date,K=new Date;K.setDate(K[g+"Date"]()-1);var W=new Date;W.setDate(W[g+"Date"]()+1);var ae=function(){return O[g+"Date"]()},Y=function(){return O[g+"Month"]()},nt=function(){return O[g+"FullYear"]()},ot=function(){return K[g+"Date"]()},st=function(){return K[g+"Month"]()},ie=function(){return K[g+"FullYear"]()},it=function(){return W[g+"Date"]()},qt=function(){return W[g+"Month"]()},pt=function(){return W[g+"FullYear"]()};return nt()===y&&Y()===c&&ae()===S?F?"Tdy":"Today":ie()===y&&st()===c&&ot()===S?F?"Ysd":"Yesterday":pt()===y&&qt()===c&&it()===S?F?"Tmw":"Tomorrow":h},o=function(u){var y=new Date(u.getFullYear(),u.getMonth(),u.getDate());y.setDate(y.getDate()-(y.getDay()+6)%7+3);var c=new Date(y.getFullYear(),0,4);c.setDate(c.getDate()-(c.getDay()+6)%7+3);var S=y.getTimezoneOffset()-c.getTimezoneOffset();y.setHours(y.getHours()-S);var g=(y-c)/(864e5*7);return 1+Math.floor(g)},s=function(u){var y=u.getDay();return y===0&&(y=7),y},i=function(u){return u===null?"null":u===void 0?"undefined":Fe(u)!=="object"?Fe(u):Array.isArray(u)?"array":{}.toString.call(u).slice(8,-1).toLowerCase()};typeof define=="function"&&define.amd?define(function(){return a}):(typeof Da>"u"?"undefined":Fe(Da))==="object"?Mn.exports=a:e.dateFormat=a})(void 0)});function Vs(e,t,a,r){return[e,`background-color: ${t}; padding: 2px 3px; border-radius: 3px; color: white; ${a}`,"color: graytext","color: canvastext",...r??[]]}function ws(e,t,a,r){let{name:n,msg:o}=e,s=o?.replace(bn,"%O")??"",i=o?.match(bn)?.map(u=>{try{return JSON.parse(u)}catch{return u}})??[],p=(0,mn.default)(Date.now(),"HH:MM:ss.l");return Vs(`[${p}] %c${t}%c (${n}): %c${s}`,a,r,i)}function _e(e,t,a,r,n){return function(s){let i=a==="fatal"?"error":a;try{e[i](...t(s,a.toUpperCase(),r,n))}catch(p){e.error(p)}}}function ks(e,t){return{trace:_e(e,t,"trace","magenta"),debug:_e(e,t,"debug","blue"),info:_e(e,t,"info","green"),warn:_e(e,t,"warn","orange"),error:_e(e,t,"error","red"),fatal:_e(e,t,"fatal","red","font-weight: bold")}}function Cn(e){return ks(e,ws)}var mn,bn,An=Z(()=>{"use strict";mn=m(In()),bn=new RegExp(/{(?:[^{}]|({(?:[^{}]|({(?:[^{}]|())*}))*}))*}/g)});var Rn={};ka(Rn,{default:()=>qs});var En,Pn,Ba,qs,Tn=Z(()=>{"use strict";En=m(require("next/config")),Pn=m(require("pino"));An();xa();_a();ha();Ba=class{constructor(){let t=(0,En.default)();this.logLevelApp=t?.publicRuntimeConfig?.logLevelApp??"silent";let a=t?.publicRuntimeConfig?.prettyPrint==="true";this.appLogOverrides=Ft(t?.publicRuntimeConfig?.logLevelAppOverrides),this.rootLog=(0,Pn.default)({level:this.logLevelApp,browser:{asObject:!a,write:a?Cn(console):void 0},transport:a?ft():void 0})}getAppLog(t,a){let r=ye.getLogName(t),n=ye.validateLogLevel(r,this.appLogOverrides[r]);return n&&this.rootLog.warn("Setting log level to %s for: %s ",n,r),this.rootLog.child({name:r},{...a,level:n??this.logLevelApp})}},qs=Ba});var Vn=B((nu,Un)=>{"use strict";var Ys=require("brotli"),ce=require("node:fs"),Js=require("node:zlib"),$s=require("node:path"),Oa=require("node:util"),Bn={extension:"br",skipLarger:!0,mode:0,quality:11,lgwin:22},Xs={dirs:[],threshold:0,minRatio:1,brotliSettings:Bn,onProcessed:null,onBrotliProcessed:null,onGzipProcessed:null},Zs=Oa.promisify(ce.writeFile),Ua=Oa.promisify(ce.stat),ei=Oa.promisify(ce.readFile),Ln=function(e,t){let a=[];return ce.readdir(e,(r,n)=>{if(r)return t(r);let o=n.length;if(!o)return t(null,a);n.forEach(s=>{s=$s.resolve(e,s),ce.stat(s,(i,p)=>{p&&p.isDirectory()?Ln(s,(u,y)=>{a=a.concat(y),--o||t(null,a)}):(a.push(s),--o||t(null,a))})})})},Dn=e=>e/1e3,ti=async(e,t,a)=>new Promise(async r=>{let n=Ys.compress(await ei(e),Bn);if(n===null)return r(Nt(`${e}.br`,"result",t));let o=n.length/t,s=!1;try{await Ua(`${e}.br`),s=!1}catch{s=!0}return o>a.minRatio&&s===!0?r(Nt(`${e}.br`,"ratio",t,n.length)):(await Zs(`${e}.br`,n),r(On(`${e}.br`,t,n.length)))}),ai=(e,t,a)=>new Promise(r=>{let n=ce.createReadStream(e),o=ce.createWriteStream(`${e}.gz`),s=Js.createGzip({level:9});n.pipe(s).on("error",i=>console.error(i)).pipe(o).on("finish",async()=>{let i=await Ua(`${e}.gz`);if(i.size/t>a.minRatio){let u=Nt(`${e}.gz`,"ratio",t,i.size);ce.unlink(`${e}.gz`,()=>{}),r(u)}else{let u=On(`${e}.gz`,t,i.size);r(u)}}).on("error",i=>console.error(i))}),ri=async(e,t)=>{if(e.endsWith(".js")||e.endsWith(".css")||e.endsWith(".html")||e.endsWith(".svg")||e.endsWith("jpg")){let a=await Ua(e),{size:r}=a;if(r<t.threshold)return Nt(e,"size",r),{filePath:e,skipped:!0,brotli:null,gzip:null};let n=await ai(e,r,t);t.onGzipProcessed&&t.onGzipProcessed(n);let o=await ti(e,r,t);return t.onBrotliProcessed&&t.onBrotliProcessed(o),{filePath:e,skipped:!1,brotli:o,gzip:n}}return{filePath:e,skipped:!0,brotli:null,gzip:null}};function On(e,t,a,r){let n=a/t,s=`${n*100}% == ${Dn(t)}kB -> ${Dn(a)}kB`;return console.log(`[done] ${e}: ${s}`),{filePath:e,initialSize:t,compressedSize:a,type:r,ratio:n}}var Nt=(e,t,a,r)=>{let n=r/a,o=n*100;return{filePath:e,initialSize:a,compressedSize:r||null,ratio:n||null,ratioPercent:o||null}},ni=async e=>{e={...Xs,...e};let t=[];return e.dirs.forEach(a=>{Ln(a,(r,n)=>{if(!n)console.debug("No results found at",a);else{let o=n.map(async s=>{let i=await ri(s,e);return typeof e.onProcessed=="function"&&e.onProcessed(i),i});t.concat(o)}})}),t};Un.exports=function(e){return ni(e)}});var to=require("fs-extra"),ao=require("rimraf");var Wa=m(require("pino")),po=(0,Wa.default)({transport:{target:"pino-pretty",options:{sync:!0}},level:process.env.LOG_LEVEL??"info"});function C(e,t){return po.child({name:e??"sdk"},t)}var lt=require("fs-extra"),Ie=m(require("node:path")),Qa=m(require("shelljs"));var uo=m(require("fs-extra")),Gt=m(require("node:path"));var Ha=require("glob");var Ci=C("filePathHelper");function ee(e,t){return(0,Ha.glob)(e?.replaceAll(Gt.default.sep,Gt.default.posix.sep),t)}var De=C("graphql-types");async function lo(e,t,a){De.info("Building graphql types for plugin directory: %s",e);let r=t&&a?"**":t?"components":"endpoints",n=await ee(Ie.default.join(e,"src",r,"**","package.json"));return(await Promise.all(n.map(async s=>{let i=Ie.default.dirname(s),p=await ee(Ie.default.join(i,"**","*.graphql"));if(p.length>0){De.debug("Building types types for graphql files: %s",p);let u=Ie.default.join(i,"types","codegen.json");try{await(0,lt.copy)(Ie.default.join(__dirname,"..","types","codegen.json"),u);let y="graphql-codegen --config ./types/codegen.json ";De.debug(y);let c=Qa.default.exec(y,{fatal:!0,silent:!0,cwd:i});return c.code>0?De.error("Building graphql types failed for module at %s: %s",i,c.stderr):De.info("Building graphql types complete for module at %s",i),c.code}finally{await(0,lt.rm)(u)}}}))).find(s=>s>0)??0}var Ka=lo;var ja="build-time.txt",Wt="@khoros/endpoints",Ht="1.0.0",yo=Wt.slice(1).replaceAll("/","-"),Ti=`${yo}-${Ht}.tgz`;var k=require("fs-extra"),_=m(require("node:path")),yt=m(require("shelljs"));var za=require("node:fs/promises"),j=C("buildModules");function Qt(e,t,a){return`babel ${e} --ignore 'types/*.ts' --copy-files --config-file ${t} --out-dir ${a} --extensions ".ts"`}async function co(e,t,a){let r=null,n=Date.now(),o=_.default.join(e,"src"),s=_.default.join(o,"endpoints");if(await(0,k.pathExists)(s)){j.info("Building plugin modules at %s",_.default.resolve(__dirname,e));let i=_.default.join(e,"tsconfig.server.json"),p=_.default.join(e,"babelModules.config.json");if(await(0,k.pathExists)(p)&&await(0,k.pathExists)(i)){let u=_.default.isAbsolute(t)?t:_.default.join(e,t);j.debug(`Output directory is ${u}`);let y=_.default.join(u,"pkg");await(0,k.emptyDir)(y);let c=_.default.join(y,"endpoints"),S=[`tsc -p ${i} --noEmit`],g=_.default.join(o,"shared");if(await(0,k.pathExists)(g)){let F=await(0,za.readdir)(g);for(let O of F)j.info("Compiling shared package %s...",O),S.push(Qt(_.default.join(g,O),p,_.default.join(y,"shared",O)))}if(a&&a.size>0)for(let F of a)j.info("Compiling endpoint %s...",F),S.push(Qt(_.default.join(s,F),p,_.default.join(c,F)));else j.info("Compiling all modules..."),S.push(Qt(s,p,c));let h=S.join(" && "),G=yt.default.exec(h,{fatal:!0,cwd:e});if(G.code>0)return j.error("Error building modules: %s",G.stderr),{code:G.code};{let F=_.default.join(e,"package.json");if(await(0,k.pathExists)(F)){let O=await(0,k.readJSON)(F);O.workspaces=["endpoints/**/*","shared/**/*"],O.name=Wt,O.version=Ht,await(0,k.writeJSON)(_.default.join(y,"package.json"),O);let K=_.default.join(e,"package-lock.json"),W=_.default.join(e,"src","shared");await(0,k.pathExists)(W)&&(j.info("Copying /src/shared directory into output bundle"),await(0,k.copy)(W,_.default.join(y,"shared"),{overwrite:!0})),await(0,k.pathExists)(K)&&await(0,k.copy)(K,_.default.join(y,"package-lock.json"),{errorOnExist:!1}),j.debug(`Creating a tarball in ${y}`);let ae=yt.default.exec(`npm pack ${y} --pack-destination ${y}`);if(ae.stdout){r=_.default.join(y,ae.stdout.trim()),j.info("Created a tarball at %s",r);let Y=[`rm -rf ${y}/package.json`,`rm -rf ${y}/package-lock.json`,`rm -rf ${y}/endpoints`];yt.default.exec(Y.join(";"),{cwd:y})}}else j.warn("Missing package.json file in %s",o);await(0,k.writeFile)(_.default.join(y,ja),`${Date.now()}`),j.info("Module build complete in %d ms",Date.now()-n)}}else j.warn("No tsconfig.server.json file found. Please run init first.")}else j.info("No plugin modules to build");return{code:0,path:r}}var Ya=co;var be=m(require("fs-extra")),Se=m(require("node:path")),Kt=m(require("shelljs"));var Be=C("buildNext"),So=async e=>{let t=await ee(Se.default.join(e,"src","**","*.component.json"));return Promise.all(t.map(async a=>({path:a,descriptor:await be.default.readJson(a)})))},go=async(e,t)=>{let a={};return await Promise.all(t.map(async r=>{let{descriptor:n,path:o}=r,s=`./${n.id}`,i=Se.default.dirname(o),p=Se.default.join(i,"Component.tsx");await(0,be.pathExists)(p)||(p=Se.default.join(i,`${s}.tsx`)),await(0,be.pathExists)(p)?(Be.debug(`React component found at path ${p} for descriptor at path ${o}`),Object.assign(a,{[s]:`./${Se.default.relative(e,p)}`})):Be.error("No React component found at path %s for descriptor at path %s",p,o)})),a};async function Ja(e,t){let a=await So(e),r=await go(e,a);return Be.info("Federation config is %O",r),await be.default.writeJSON(Se.default.join(e,"federation.config.json"),{name:"auroraComponents"+(t?"Local":""),exposes:r,extraOptions:{debug:!1}}),a}async function Mo(e){Kt.default.env.NEXT_PRIVATE_LOCAL_WEBPACK="true";let t=`next build ${e}`;try{let a=Kt.default.exec(t,{async:!1,fatal:!0,cwd:e});return a.code>0&&Be.error("Error in NextJS build"),{code:a.code}}catch(a){return Be.error("Error running next command: %s",t,a?.message),{code:1}}}var $a=Mo;var jt=m(require("node:path"));var Xa=C("changeSet");function Io(){let e=process.env.CHANGE_SET;return e?.length>0?e.split(/[\s,]/):null}function bo(e){let t=e??Io();if(t?.length>0){Xa.info("Parsing changeset: %O",t);let a=!1;t.some(o=>o.includes(jt.default.join("src","components")))&&(a=!0);let r=!1;t.some(o=>o.includes(jt.default.join("src","endpoints")))&&(r=!0),t.some(o=>o=="package.json"||o.startsWith(".github"))&&(a=!0,r=!0);let n={buildComponents:a,buildEndpoints:r};return Xa.info("Changeset result: %O",n),n}return null}var Za=bo;function Gs(){if(typeof window>"u"){let e=(gn(),Ga(dn)).default;return new e}else{let e=(Tn(),Ga(Rn)).default;return new e}}var Ws=Gs();function vn(e,t){return Ws.getAppLog(e,t)}var xp=vn(module);var xn=m(require("dotenv-flow")),hn=m(require("findup-sync")),La=m(require("node:path")),Fn=m(require("yargs")),_n=require("yargs/helpers");var Op=require("graphql-import-node"),fn=require("@urql/core");var wp=C("GraphqlClient");var zp=C("versionCheck");var Xe=C("cli");function Ks(){if(!global.sdkConfigLoaded){let e=(0,hn.default)(".env*");if(e){Xe.debug("Loading config from .env files: $s",e);let{error:t,parsed:a}=xn.default.config({path:La.default.dirname(e)});t?(Xe.error(t,"Error reading config file"),process.exit(1)):Xe.info("Using config values: %O",a)}}global.sdkConfigLoaded=!0}function js(e){let t=e.indexOf("node_modules");return t===1?e:e.slice(0,t-1)}function zs(e,t,a,r,n){Ks(),(0,Fn.default)((0,_n.hideBin)(process.argv)).scriptName(e).options(r??{}).env("PLUGIN").usage("$0 [repoPath]").command("$0 [repoPath]",t,o=>{let s=js(process.cwd());return o.positional("repoPath",{describe:"The full path to plugin root directory.",default:s,type:"string"})},async o=>{await a(o)}).check(async o=>{let{repoPath:s}=o;if(!s)throw new Error("No plugin repository path found. Please either pass it as an argument to this process or specify it in your .env file as PLUGIN_REPO_PATH. ");if(!La.default.isAbsolute(s))throw new Error("The plugin repository path must be a full (not relative) path.");return n?await n(o):!0}).help().showHelpOnFail(!1).fail((o,s)=>{s?Xe.error(s.message):Xe.error(o),process.exit(1)}).parse()}var Nn=zs;var wn=m(Vn()),kn=require("fs-extra"),Bt=m(require("node:path"));var Dt=C("compress");async function oi(e,t){let a=Bt.default.isAbsolute(t)?t:Bt.default.join(e,t),r=Bt.default.join(a,"mf");if(await(0,kn.pathExists)(r)){Dt.info("Compressing assets in %s",r);try{await(0,wn.default)({dirs:[r]}),Dt.info("Compressing assets complete")}catch(n){Dt.error(n,"Error compressing assets")}}else Dt.info("No mf assets to compress")}var qn=oi;var Ze=m(require("node:path")),Gn=m(require("shelljs"));var Lt=C("format");function si(e,t){Lt.info("Formatting plugin directory: %s",t);let a=e==="format:fix"?"--write":"--check",r=`prettier --config ${Ze.default.join(t,".prettierrc.js")} --ignore-path ${Ze.default.join(t,".prettierignore")} ${a} ${Ze.default.join(t,"res")} ${Ze.default.join(t,"src")} `;Lt.debug(r);let n=Gn.default.exec(r,{cwd:t});return n.code>0?Lt.warn("Formatting errors found for plugin at %s",t):Lt.info("Formatting complete for plugin at %s",t),n.code}var Wn=si;var T=require("fs-extra"),R=m(require("node:path"));var et=C("setup"),ii={hooks:{"pre-commit":"npm run precommit","post-commit":"git update-index --again"}},pi={"**/*.{js,jsx,ts,tsx,css,scss,pcss,json}":["prettier --write"],"**/*.{js,ts,tsx}":["eslint --fix --ignore-pattern '!.eslintrc.js' --ignore-pattern '!.prettierrc.js'"]},te=R.default.resolve(__dirname,R.default.join("..")),ui=R.default.join(te,"templates");async function Hn(e){return(await(0,T.readFile)(e)).toString().split(`
|
|
7
|
+
`).map(a=>a.trim())}async function li(e,t){let a=R.default.join(e,"package.json");if(await(0,T.pathExists)(a)){let r=await(0,T.readJson)(a,"utf8"),o=(await(0,T.readJson)(R.default.join(te,"package.json"))).name;if(t&&!r.devDependencies[o]&&!r.dependencies[o])et.warn("SDK not found as a dependency of package.json file at %s. Skipping init step.",a);else{et.info("Initializing plugin directory %s",e),await(0,T.remove)(R.default.join(e,"app")),await(0,T.ensureDir)(R.default.join(e,"pages")),await(0,T.ensureDir)(R.default.join(e,"src"));async function s(p,u=!0){let y=R.default.join(ui,p),c=p.replaceAll(".tmpl",""),S=R.default.join(e,c);if(et.debug(`Copying ${y} to ${S}`),await(0,T.copy)(y,S,{overwrite:u}),!u&&c.startsWith(".")&&c.endsWith("ignore")&&await(0,T.pathExists)(S)){let g=await Hn(S),h=await Hn(y);for(let G of h)g.includes(G)||g.push(G);await(0,T.writeFile)(S,g.filter(G=>!!G).join(`
|
|
8
|
+
`))}}let i={".env.local.tmpl":!1,".eslintignore.tmpl":!1,".eslintrc.tmpl.js":!1,".gitignore.tmpl":!1,".npmrc.tmpl":!0,".nvmrc.tmpl":!0,".prettierignore.tmpl":!1,".prettierrc.tmpl.js":!1,"tsconfig.server.tmpl.json":!0,"tsconfig.tmpl.json":!0,"babelModules.config.tmpl.json":!1};et.info(`Copying template files to the plugin at ${e}`),await Promise.all(Object.keys(i).map(async p=>{await s(p,i[p])})),r.workspaces=["src/**/*"],r.engines={node:">=18"},r.scripts||(r.scripts={}),r.scripts.start=`npm explore ${o} -- npm run start`,r.scripts["start:logger"]=`npm explore ${o} -- npm run start:logger`,r.scripts.dev=`npm explore ${o} -- npm run dev:plugin`,r.scripts.build=`npm explore ${o} -- npm run build:plugin`,r.scripts["build:graphql"]=`npm explore ${o} -- npm run build:graphql`,r.scripts.lint=`npm explore ${o} -- npm run lint:plugin`,r.scripts["lint:fix"]=`npm explore ${o} -- npm run lint:plugin:fix`,r.scripts.format=`npm explore ${o} -- npm run format:plugin`,r.scripts["format:fix"]=`npm explore ${o} -- npm run format:plugin:fix`,r.scripts.init=`npm explore ${o} -- npm run init:plugin`,r.scripts.validate=`npm explore ${o} -- npm run validate:plugin`,r.scripts.gen=`npm explore ${o} -- npm run gen`,r.scripts.precommit="lint-staged",r.husky=ii,r["lint-staged"]=pi,await(0,T.writeJson)(a,r,{spaces:" "}),await(0,T.copy)(R.default.join(te,"README.md"),R.default.join(e,"SDK.md"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"next.config.js"),R.default.join(e,"next.config.js"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"next.overrides.js"),R.default.join(e,"next.overrides.js"),{overwrite:!1}),await(0,T.copy)(R.default.join(te,"postcss.config.js"),R.default.join(e,"postcss.config.js"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"types","mf","index.d.ts"),R.default.join(e,"types","mf","aurora.d.ts"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"types","pkg","index.d.ts"),R.default.join(e,"types","pkg","aurora.d.ts"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"types","graphql.d.ts"),R.default.join(e,"types","graphql.d.ts"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"templates","pcss.d.ts.tmpl"),R.default.join(e,"types","pcss.d.ts"),{overwrite:!0}),await(0,T.copy)(R.default.join(te,"types","graphql-schema-types.ts"),R.default.join(e,"types","graphql-schema-types.ts"),{overwrite:!0})}}else et.warn("No package.json file found at %s. Skipping init step.",a)}var Qn=li;var Va=m(require("node:path")),Kn=m(require("shelljs"));var jn=require("fs-extra"),Ot=C("lintPlugin");async function yi(e,t){let a=Va.default.join(t,"src");if(await(0,jn.pathExists)(a)){Ot.info("Linting plugin directory: %s",t);let r=e==="lint:fix"?"--fix --max-warnings=0":"",n=`eslint --ext .js --ext .jsx --ext .tsx --ext .ts --cache --config ${Va.default.join(t,".eslintrc.js")} --no-error-on-unmatched-pattern --ignore-pattern '**/types/*' ${r} ${a}`;Ot.debug(n);let o=Kn.default.exec(n,{fatal:!0,cwd:t});return o.code>0?Ot.error("Linting failed for plugin at %s",t):Ot.info("Linting complete for plugin at %s",t),o.code}return 0}var zn=yi;var tt=(o=>(o.Freemarker="FREEMARKER",o.Handlebars="HANDLEBARS",o.Html="HTML",o.Javascript="JAVASCRIPT",o.React="REACT",o))(tt||{});var Ut=(i=>(i.Delete="DELETE",i.Get="GET",i.Head="HEAD",i.Options="OPTIONS",i.Patch="PATCH",i.Post="POST",i.Put="PUT",i))(Ut||{});var at=(o=>(o.Content="CONTENT",o.Custom="CUSTOM",o.People="PEOPLE",o.Places="PLACES",o.Texthtml="TEXTHTML",o))(at||{});var rt=require("fs-extra"),q=m(require("node:path"));var Vt=(o=>(o.Json="JSON",o.Multipart="MULTIPART",o.MultipartFiles="MULTIPART_FILES",o.None="NONE",o.UrlEncoded="URL_ENCODED",o))(Vt||{});var Yn=m(require("fs-extra"));var Iu=C("fileUtils");function ci(e){return Promise.all(e.map(async t=>({path:t,descriptor:await Yn.default.readJson(t)})))}async function wt(e){let t=await ee(e);return ci(t)}var wa=require("fs-extra"),$n=require("glob"),Xn=require("minimatch"),Ne=m(require("node:path"));var Jn={ReactComponent:["@fluentui/react-*","@coveo/atomic-react","@coveo/atomic","@coveo/headless-react","@coveo/headless","@tanstack/react-query","@tanstack/react-table","clone-deep","dateformat","dayjs","file-saver","isomorphic-dompurify","js-base64","lil-uri","moment-timezone","path-to-regexp","react","react-beautiful-dnd","react-bootstrap","react-hook-form","react-quill","react-select","react-uid","react-use","react-dropzone","sanitize-html","tabbable","tiny-lru","universal-cookie"],Endpoint:["brotli","clone-deep","cookie","dateformat","js-base64","jsonwebtoken","lil-uri","path-to-regexp","tiny-lru","universal-cookie"]};var gi={async validatePackageDependencies(e,t,a=""){let{path:r}=e,n=Ne.default.dirname(r),o=Ne.default.join(n,"package.json"),s=[],i={allowedDependencies:[],disallowedDependencies:[]};if(t==="Endpoint"||t==="ReactComponent"){s=Jn[t];let p=await(0,$n.glob)("**/package.json",{cwd:Ne.default.join(a,"src"),ignore:[Ne.default.join(a,"src","endpoints","**","node_modules","**"),Ne.default.join(a,"src","components","**","node_modules","**")],absolute:!0}),u=await Promise.all(p.map(async y=>(await(0,wa.readJSON)(y)).name));await(0,wa.readJSON)(o).then(y=>(y.dependencies&&(i.allowedDependencies=[...s,...u],i.disallowedDependencies=Object.keys(y.dependencies).filter(c=>!i.allowedDependencies.some(S=>(0,Xn.minimatch)(c,S)))),null))}return i}},Zn=gi;var Me=C("validationUtils"),Mi={validateCustomComponentDescriptor(e,t=[]){return e.id||t.push("Component id is missing or empty for descriptor: "+JSON.stringify(e)),e.markupLanguage?Object.values(tt).includes(e.markupLanguage)||t.push("Component markupLanguage value is invalid for descriptor: "+JSON.stringify(e)+". Valid markupLanguage values are: "+JSON.stringify(Object.values(tt))):t.push("Component markupLanguage field is missing for descriptor: "+JSON.stringify(e)+". Valid markupLanguage values are: "+JSON.stringify(Object.values(tt))),e.grouping?Object.values(at).includes(e.grouping)||t.push("Component grouping value is invalid for descriptor: "+JSON.stringify(e)+". Valid grouping values are: "+JSON.stringify(Object.values(at))):t.push("Component grouping field is missing for descriptor: "+JSON.stringify(e)+". Valid grouping values are: "+JSON.stringify(Object.values(at))),!e.components||e.components.length===0?t.push('Missing "components" field for descriptor: '+JSON.stringify(e)):e.components.some(a=>`custom.widget.${e.id}`===a.id)||t.push(`Invalid "components" field for descriptor. Components field id should be "custom.widget.${e.id}": Descriptor is ${JSON.stringify(e)}`),t},validateReactComponentDescriptor(e,t=[]){return this.validateCustomComponentDescriptor(e,t),e.markupLanguage!="REACT"&&t.push('Component descriptor markup language must be "REACT" for descriptor: '+JSON.stringify(e)),t},validateEndpointDescriptor(e,t=[]){return e.id||t.push("Endpoint id field is missing or empty for descriptor: "+JSON.stringify(e)),e.bodyType&&!Object.values(Vt).includes(e.bodyType)&&t.push("Endpoint body type field is invalid for descriptor: "+JSON.stringify(e)+". Valid body types are: "+JSON.stringify(Object.values(Vt))),e.httpMethods&&e.httpMethods.some(a=>!Object.values(Ut).includes(a))&&t.push("Endpoint httpMethods field is invalid for descriptor: "+JSON.stringify(e)+". Valid httpMethods are: "+JSON.stringify(Object.values(Ut))),t},validateModule(e,t=[]){let{descriptor:a,path:r}=e,n=/\.(\w+)\.json/,o=q.default.basename(r).replace(n,""),s=n.exec(r);if(s.length<2)t.push("No descriptor type found");else{let[,i]=s,p=q.default.dirname(r),u=q.default.basename(p);u===i&&t.push(`A descriptor needs to go into its own directory under ${i}s at ${r}.`),o!=u?t.push(`Descriptor filename prefix (${o}) must match descriptor directory name (${u}) at ${r}`):a.id!=u&&t.push(`Descriptor id (${a.id}) must match descriptor directory name (${u}) at ${r}`)}return t},async validatePackageDescriptor(e,t,a="",r=!1,n=[]){let{path:o}=e,s=q.default.dirname(o),i=q.default.join(s,"package.json");if(!await(0,rt.pathExists)(i))n.push(`No package descriptor (package.json) found in ${s}`);else{let p=await Zn.validatePackageDependencies(e,t,a);if(p.disallowedDependencies.length>0){let u=`Disallowed dependencies found in ${s}/package.json: ${p.disallowedDependencies.join(", ")}. Only the following dependencies are allowed: ${p.allowedDependencies.sort().join(", ")}`;r?Me.warn(u):n.push(u)}}return n},async validateReactComponent(e,t,a=!1,r=[]){let{descriptor:n,path:o}=e;this.validateReactComponentDescriptor(n,r),this.validateModule(e,r),await this.validatePackageDescriptor(e,"ReactComponent",t,a,r);let s=q.default.dirname(o),i=q.default.join(s,"Component.tsx"),p=`${n.id}.tsx`;return await(0,rt.pathExists)(i)||(i=q.default.join(s,p)),await(0,rt.pathExists)(i)||r.push(`No valid React component (${p}) found in ${s}`),r},async validateEndpoint(e,t,a=!1,r=[]){let{descriptor:n,path:o}=e;this.validateEndpointDescriptor(n,r),this.validateModule(e,r),await this.validatePackageDescriptor(e,"Endpoint",t,a,r);let s=q.default.dirname(o),i=q.default.join(s,"index.ts");return await(0,rt.pathExists)(i)||r.push(`No valid endpoint (index.ts) found in ${s}`),r},async validatePlugin(e,t=!1,a=!1,r=!1){Me.info("Validating plugin files at %s...",e);let n=[];if(t){Me.info("Validating component descriptors...");let o=await ee(q.default.join(e,"res","components","*"));for await(let s of o){let i=await wt(q.default.join(s,"*.component.json"));if(i.length===0)Me.warn(`No component descriptor (<ComponentName>.component.json) found in ${s}`);else for(let p of i)this.validateCustomComponentDescriptor(p.descriptor,n),this.validateModule(p,n)}}if(a){Me.info("Validating React components...");let o=await ee(q.default.join(e,"src","components","*"));for await(let s of o){let i=await wt(q.default.join(s,"*.component.json"));if(i.length===0)n.push(`No component descriptor (<ComponentName>.component.json) found in ${s}`);else for await(let p of i)await this.validateReactComponent(p,e,!1,n)}}if(r){Me.info("Validating endpoints...");let o=await ee(q.default.join(e,"src","endpoints","*"));for await(let s of o){let i=await wt(q.default.join(s,"*.endpoint.json"));if(i.length===0)n.push(`No endpoint descriptor (<EndpointName>.endpoint.json) found in ${s}`);else for await(let p of i)await this.validateEndpoint(p,e,!1,n)}}return Me.info(`Plugin files are validated. ${n.length===0?"No":n.length} error(s) found.`),n}},eo=Mi;var kt=C("build");Nn("build:modules","Build the plugin modules",async({repoPath:e,outputDirectory:t,init:a,lint:r,format:n,changeSet:o,mf:s,pkg:i})=>{let p=Date.now();if(await(0,to.pathExists)(t))try{kt.info("Cleaning output directory at %s",t),await(0,ao.rimraf)(t)}catch(h){kt.error(h,"Error cleaning output directory at %s",t)}a===!0&&await Qn(e,!0);let u=Za(o),y=u?.buildComponents??s===!0,c=u?.buildEndpoints??i===!0,S=await eo.validatePlugin(e,!(s===!1||i===!1),y,c);if(S.length>0){for(let h of S)kt.error("Validation Error: %s",h);throw new Error("Terminating build due to validation errors")}if(r===!0&&await zn("lint",e)>0)throw new Error("Terminating build due to lint failure");if(n===!0&&Wn("format",e),await Ka(e,y,y||c)>0)throw new Error("Terminating build due to failure in building graphql types");if(y)if(await Ja(e,!1),(await $a(e)).code==0)await qn(e,t);else throw new Error("Terminating build due to component build failure");if(c&&(await Ya(e,t)).code>0)throw new Error("Terminating build due to module build failure");kt.info("Plugin build complete in "+(Date.now()-p)+"ms")},{b:{alias:"branchName",demandOption:!1,default:"main",describe:'The branch to build. If not specified, "main" is assumed. This does not control the checked out files but adds an additional branch segment to the S3 file key',type:"string"},c:{alias:"changeSet",demandOption:!1,describe:"A set of changed files. If not specified, all components and middlewares in the plugin will be built. If specified, only components and middlewares with changed files will be built.",type:"array"},o:{alias:"outputDirectory",demandOption:!1,default:"dist",describe:'The output directory. If not specified, "dist" is assumed. This is where the build artifacts will be placed.',type:"string"},i:{alias:"init",demandOption:!1,default:!1,describe:"Whether to init the plugin as part of the build process",type:"boolean"},l:{alias:"lint",demandOption:!1,default:!0,describe:"Whether to run lint as part of the build process.",type:"boolean"},f:{alias:"format",demandOption:!1,default:!1,describe:"Whether to run format as part of the build process.",type:"boolean"},m:{alias:"mf",demandOption:!1,default:!0,describe:"Whether to build the module federation (mf) artifacts.",type:"boolean"},p:{alias:"pkg",demandOption:!1,default:!0,describe:"Whether to build the module (pkg) artifacts.",type:"boolean"}});
|