@zuplo/core 5.2430.0 → 5.2432.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.minified.js CHANGED
@@ -693,7 +693,7 @@ export default {
693
693
  return handler.requestHandler(request, env, ctx)
694
694
  },
695
695
  };
696
- `,nlt=t(async function({systemDirectory:s,logger:a,config:u}){return Fu.timeFn("Generating Worker shim",async()=>{a.debug("Generating Worker shim");let p=u?.flags?.esmWorker?snr:inr,g=nnr.join(s,tce);try{await rnr.writeFile(g,p.trimStart(),"utf-8")}catch(b){a.error(b);let k={message:`Error creating file at ${g}`,pluginName:"generate-worker-entry",severity:"error"};return{warnings:[],errors:[k]}}return{warnings:[],errors:[]}})},"generateWorker");import{readFile as anr}from"fs/promises";import ilt from"path";var onr="validate-dev-portal-json",dH="dev-portal-enabled",alt=t(async function({logger:s,sourceDirectory:a},u){return Fu.timeFn("Validate dev-portal.json file",async()=>{s.debug("Validate dev-portal.json file");let p=ilt.join(a,Kp),g=ilt.join(p,pO);if(!await pc.fileExists(g))return s.debug("Project is missing a dev-portal.json file. Skipping validate-dev-portal-json plugin."),u.set(dH,!1),new Yp;let b=[],k=await anr(g,"utf-8"),N=JSON.parse(k);if(N.enabled===!1)return s.debug("Project has set dev-portal.json to disabled. Skipping validate-dev-portal-json plugin."),u.set(dH,!1),new Yp;if(N.enableAuthentication&&N.authentication){let{provider:M}=N.authentication;if(M&&M!=="auth0"&&M!=="okta"&&M!=="azure-ad"&&M!=="clerk"&&M!=="oidc"&&M!=="external"&&b.push({message:"The authentication setting 'provider' is not set or invalid. Valid values are 'auth0', 'okta', 'azure-ad', 'clerk', 'oidc', or 'external'.",pluginName:"validate-dev-portal-json",severity:"warning"}),M==="external"){let{loginUrl:U,logoutUrl:Q}=N.authentication;mE(U)?U.startsWith("$env(")&&!U.startsWith("$env(ZUPLO_PUBLIC_")&&b.push({message:"'loginUrl' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The authentication setting for 'loginUrl' is not set or is an empty string.",pluginName:"validate-dev-portal-json",severity:"warning"}),mE(Q)?Q.startsWith("$env(")&&!Q.startsWith("$env(ZUPLO_PUBLIC_")&&b.push({message:"'logoutUrl' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The authentication setting for 'logoutUrl' is not set or is an empty string.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if("authority"in N.authentication){let{authority:U}=N.authentication;if(!N.authentication.devPortalClient)b.push({message:"The authentication setting for 'devPortalClient' is not set. This property is required when 'authority' is also set.",pluginName:"validate-dev-portal-json",severity:"warning"});else{let{clientId:Q,audience:te}=N.authentication.devPortalClient;mE(U)?U.startsWith("$env(")&&!U.startsWith("$env(ZUPLO_PUBLIC_")&&b.push({message:"'authority' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The authentication setting for 'authority' is not set or is an empty string.",pluginName:"validate-dev-portal-json",severity:"warning"}),b.push(...slt({audience:te,clientId:Q}))}}else if("issuer"in N.authentication){let{issuer:U,clientId:Q,clientSecret:te,audience:z}=N.authentication;mE(U)?U.startsWith("$env(")&&!U.startsWith("$env(ZUPLO_PUBLIC_")&&b.push({message:"'issuer' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The authentication setting for 'issuer' is not set or is an empty string.",pluginName:"validate-dev-portal-json",severity:"warning"}),b.push(...slt({audience:z,clientId:Q,clientSecret:te}))}else throw new xS({message:"The dev-portal.json is not valid. The 'authentication' section does not have required fields.",severity:"error"},onr)}if(N.enableMonetization&&N.monetization){let{provider:M}=N.monetization;if((!mE(M)||M!=="stripe")&&b.push({message:"The monetization setting 'provider' is not set or an empty string. Valid values are 'stripe'.",pluginName:"validate-dev-portal-json",severity:"warning"}),M==="stripe"){let{pricingTableId:U,publishableKey:Q,secretKey:te}=N.monetization;mE(U)?U.startsWith("$env(")?U.startsWith("$env(ZUPLO_PUBLIC_")||b.push({message:"'Pricing Table Id' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}):U.startsWith("prctbl_")||b.push({message:"'Pricing Table Id' field must start with prctbl_. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The monetization setting for 'Pricing Table Id' is not set or is an empty string. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}),mE(Q)?Q.startsWith("$env(")?Q.startsWith("$env(ZUPLO_PUBLIC_")||b.push({message:"'Publishable Key' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}):Q.startsWith("pk_")||b.push({message:"'Publishable Key' field must start with pk_. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The monetization setting for 'Publishable Key' is not set or is an empty string. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}),mE(te)?te.startsWith("$env(")||b.push({message:"The monetization setting for 'Secret Key' must be an environment variable. Field monetization.secretKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The monetization setting for 'Secret Key' is not set or is an empty string. Field monetization.secretKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}}else N.enableMonetization&&!N.monetization&&b.push({message:"Monetization was enabled but no monetization configuration was provider in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"});return{errors:[],warnings:b}})},"validateDevPortalJSON");function slt({audience:s,clientId:a,clientSecret:u}){let p=[];return s&&s.startsWith("$env(")&&!s.startsWith("$env(ZUPLO_PUBLIC_")&&p.push({message:"'audience' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}),mE(a)?a.startsWith("$env(")&&!a.startsWith("$env(ZUPLO_PUBLIC_")&&p.push({message:"'clientId' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}):p.push({message:"The authentication setting for 'clientId' is not set or is an empty string.",pluginName:"validate-dev-portal-json",severity:"warning"}),mE(u)&&!u.startsWith("$env(")&&(u.startsWith("$env(ZUPLO_PUBLIC")&&p.push({message:"The authorization setting for 'Client Secret' should not be a public environment variable. ",pluginName:"validate-dev-portal-json",severity:"warning"}),p.push({message:"The authorization setting for 'Client Secret' must be an environment variable. Field authentication.devPortalClient.secretKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})),p}t(slt,"validateCommonAuth");import{readFile as cnr,readdir as lnr}from"fs/promises";import olt from"path";var Fce="validate-open-api-files",clt=t(async function({sourceDirectory:s,logger:a}){return Fu.timeFn("Building OpenAPI files to build output",async()=>{a.debug("Building OpenAPI files to build output");let u=olt.join(s,Kp),p=[];try{if(!await JR(s))return new Yp({message:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:Fce,severity:"error"});let k=(await lnr(u)).filter(N=>N.endsWith(".oas.json"));for(let N of k){let M=olt.join(u,N);try{N==="zp.oas.json"&&p.push({message:"Open API files cannot be named 'zp.oas.json' since 'zp' is a reserved prefix. Update the file name to solve this build issue.",pluginName:Fce,severity:"error"});let U=await cnr(M,"utf-8"),Q=JSON.parse(U);if(Q&&Q.paths){let te=Object.entries(Q.paths).filter(z=>z[0]==="zp"||z[0]==="/zp");if(te.length>0){let z=te.length===1?"includes one route path":`includes '${te.length}' routes`;p.push({message:`Open API file '${N}' ${z} that's named '/zp' which is a reserved route name. Updating the route to something other than '/zp' will solve this build issue.`,pluginName:Fce,severity:"error"})}}}catch(U){a.error(U)}}}catch(g){return a.error(g),p.length>0?{errors:p,warnings:[]}:new Yp({message:"Failed while validating the open api files in the project",pluginName:Fce,severity:"warning"})}return{errors:p,warnings:[]}})},"validateOpenAPIFiles");var cM=sm(QNe(),1);import{parse as Gnr}from"jsonc-parser";import{readFile as Knr,writeFile as ZNe}from"fs/promises";import Ynr from"path";import Xnr from"prettier";var oM=sm(QNe(),1);var Ylt=t(()=>({include:["modules/**/*",".zuplo/**/*","tests/**/*"],exclude:["./node_modules","./dist"],compilerOptions:{baseUrl:".",module:oM.ModuleKind.ESNext,target:oM.ScriptTarget.ESNext,moduleResolution:oM.ModuleResolutionKind.Bundler,lib:["ESNext","WebWorker","Webworker.Iterable"],preserveConstEnums:!0,useUnknownInCatchVariables:!1,forceConsistentCasingInFileNames:!0,importHelpers:!0,removeComments:!0,esModuleInterop:!0,strictNullChecks:!0,experimentalDecorators:!0,noEmit:!0,paths:{"@app/*":[".zuplo/*"]}}}),"getZuploTsConfigTemplate");var wO="validate-tsconfig",Xlt=t(async function({sourceDirectory:s,logger:a,command:u,environmentType:p}){return Fu.timeFn("Validate TSConfig",async()=>{a.debug("Validate TSConfig");let g=p==="WORKING_COPY"||u==="dev";try{let b=Ylt(),k=Ynr.join(s,"tsconfig.json");if(!await pc.fileExists(k))return g?(await ZNe(k,JSON.stringify(b,null,2)),{warnings:[{message:"This project does not have a tsconfig.json file. The file has been created for you.",severity:"warning",pluginName:wO,helpUrl:"https://zuplo.com/docs/articles/tsconfig"}],errors:[]}):{warnings:[],errors:[{message:"This project does not have a tsconfig.json file.",severity:"error",pluginName:wO,helpUrl:"https://zuplo.com/docs/articles/tsconfig"}]};let N=await Knr(k,"utf-8"),M=Gnr(N);if(!(M&&typeof M=="object"&&"compilerOptions"in M))return g?(await ZNe(k,JSON.stringify(b,null,2)),{warnings:[{message:"This project's tsconfig.json file was invalid. A valid file has been written for you.",severity:"warning",pluginName:wO,helpUrl:"https://zuplo.com/docs/articles/tsconfig"}],errors:[]}):{warnings:[],errors:[{message:"This project's tsconfig.json file is invalid. It must have a compilerOptions.",severity:"error",pluginName:wO,helpUrl:"https://zuplo.com/docs/articles/tsconfig"}]};let U=cM.default.convertCompilerOptionsFromJson(M.compilerOptions,s);if(U.errors.length>0)return{warnings:[],errors:U.errors.map(fn=>({severity:"error",pluginName:wO,message:fn.messageText.toString(),detail:"You will need to modify your tsconfig.json file to build this project.",helpUrl:"https://zuplo.com/docs/articles/tsconfig",location:fn.file?{line:fn.file.getLineStarts()[0],length:fn.file.getWidth(),file:fn.file.fileName,column:fn.file.getStart(),lineText:"",namespace:"",suggestion:""}:void 0}))};if(!M||typeof M!="object")throw new TypeError("The userConfigRaw is not an object, this should not happen.");if(!("compilerOptions"in M)||M.compilerOptions===null||M.compilerOptions===void 0||typeof M.compilerOptions!="object")throw new TypeError("The userConfigRaw.compilerOptions property is not an object, this should not happen.");let Q=t((fn,mr,tr)=>`The compiler option '${fn}' should ${mr===void 0?"not be set":`be set to '${typeof mr=="string"?mr:JSON.stringify(mr)}'`}, it was ${tr===void 0?"not set":`set to '${typeof tr=="string"?tr:JSON.stringify(tr)}'`}`,"getMessage"),te=!1,z="ESNext",Se=cM.ModuleKind.ESNext,Me=[];U.options.module!==Se&&(g&&(te=!0,M.compilerOptions.module=z),Me.push(Q("module",z,M.compilerOptions.module)));let xe="ES2022",Le=cM.default.ScriptTarget.ES2022;U.options.target!==Le&&(Me.push(Q("target",xe,M.compilerOptions.target)),g&&(te=!0,M.compilerOptions.target=xe));let kt="Bundler",Bt=cM.default.ModuleResolutionKind.Bundler;U.options.moduleResolution!==Bt&&(Me.push(Q("moduleResolution",kt,M.compilerOptions.moduleResolution)),g&&(te=!0,M.compilerOptions.moduleResolution=kt));let ur=["ESNext","WebWorker","Webworker.Iterable"];if(t(fn=>{let mr=ur.map(kr=>kr.toLowerCase()),tr=fn.map(kr=>kr.toLowerCase());return mr.every(kr=>tr.includes(kr))},"includesAllLibs")(M.compilerOptions.lib??[])||(Me.push(Q("lib",ur,M.compilerOptions.lib)),g&&(te=!0,M.compilerOptions.lib=ur)),U.options.baseUrl&&(Me.push(Q("baseUrl",void 0,M.compilerOptions.baseUrl)),g)){te=!0,M.compilerOptions.baseUrl=void 0;let fn=M.compilerOptions.paths??{};fn["@app/*"]&&Array.isArray(fn["@app/*"])&&fn["@app/*"].includes(".zuplo/*")&&(fn["@app/*"]=["./.zuplo/*"],M.compilerOptions.paths=fn)}let er=[];if(Me.length>0&&er.push({message:g&&te?"This project's tsconfig.json was updated to the recommended configuration. This may cause your build to break if you used custom settings.":"This project's tsconfig.json does not match the recommended configuration. You should update this file to ensure your project builds correctly.",severity:"warning",detail:Me.join(`
696
+ `,nlt=t(async function({systemDirectory:s,logger:a,config:u}){return Fu.timeFn("Generating Worker shim",async()=>{a.debug("Generating Worker shim");let p=u?.flags?.esmWorker?snr:inr,g=nnr.join(s,tce);try{await rnr.writeFile(g,p.trimStart(),"utf-8")}catch(b){a.error(b);let k={message:`Error creating file at ${g}`,pluginName:"generate-worker-entry",severity:"error"};return{warnings:[],errors:[k]}}return{warnings:[],errors:[]}})},"generateWorker");import{readFile as anr}from"fs/promises";import ilt from"path";var onr="validate-dev-portal-json",dH="dev-portal-enabled",alt=t(async function({logger:s,sourceDirectory:a},u){return Fu.timeFn("Validate dev-portal.json file",async()=>{s.debug("Validate dev-portal.json file");let p=ilt.join(a,Kp),g=ilt.join(p,pO);if(!await pc.fileExists(g))return s.debug("Project is missing a dev-portal.json file. Skipping validate-dev-portal-json plugin."),u.set(dH,!1),new Yp;let b=[],k=await anr(g,"utf-8"),N=JSON.parse(k);if(N.enabled===!1)return s.debug("Project has set dev-portal.json to disabled. Skipping validate-dev-portal-json plugin."),u.set(dH,!1),new Yp;if(N.enableAuthentication&&N.authentication){let{provider:M}=N.authentication;if(M&&M!=="auth0"&&M!=="okta"&&M!=="azure-ad"&&M!=="clerk"&&M!=="oidc"&&M!=="external"&&b.push({message:"The authentication setting 'provider' is not set or invalid. Valid values are 'auth0', 'okta', 'azure-ad', 'clerk', 'oidc', or 'external'.",pluginName:"validate-dev-portal-json",severity:"warning"}),M==="external"){let{loginUrl:U,logoutUrl:Q}=N.authentication;mE(U)?U.startsWith("$env(")&&!U.startsWith("$env(ZUPLO_PUBLIC_")&&b.push({message:"'loginUrl' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The authentication setting for 'loginUrl' is not set or is an empty string.",pluginName:"validate-dev-portal-json",severity:"warning"}),mE(Q)?Q.startsWith("$env(")&&!Q.startsWith("$env(ZUPLO_PUBLIC_")&&b.push({message:"'logoutUrl' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The authentication setting for 'logoutUrl' is not set or is an empty string.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if("authority"in N.authentication){let{authority:U}=N.authentication;if(!N.authentication.devPortalClient)b.push({message:"The authentication setting for 'devPortalClient' is not set. This property is required when 'authority' is also set.",pluginName:"validate-dev-portal-json",severity:"warning"});else{let{clientId:Q,audience:te}=N.authentication.devPortalClient;mE(U)?U.startsWith("$env(")&&!U.startsWith("$env(ZUPLO_PUBLIC_")&&b.push({message:"'authority' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The authentication setting for 'authority' is not set or is an empty string.",pluginName:"validate-dev-portal-json",severity:"warning"}),b.push(...slt({audience:te,clientId:Q}))}}else if("issuer"in N.authentication){let{issuer:U,clientId:Q,clientSecret:te,audience:z}=N.authentication;mE(U)?U.startsWith("$env(")&&!U.startsWith("$env(ZUPLO_PUBLIC_")&&b.push({message:"'issuer' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The authentication setting for 'issuer' is not set or is an empty string.",pluginName:"validate-dev-portal-json",severity:"warning"}),b.push(...slt({audience:z,clientId:Q,clientSecret:te}))}else throw new xS({message:"The dev-portal.json is not valid. The 'authentication' section does not have required fields.",severity:"error"},onr)}if(N.enableMonetization&&N.monetization){let{provider:M}=N.monetization;if((!mE(M)||M!=="stripe")&&b.push({message:"The monetization setting 'provider' is not set or an empty string. Valid values are 'stripe'.",pluginName:"validate-dev-portal-json",severity:"warning"}),M==="stripe"){let{pricingTableId:U,publishableKey:Q,secretKey:te}=N.monetization;mE(U)?U.startsWith("$env(")?U.startsWith("$env(ZUPLO_PUBLIC_")||b.push({message:"'Pricing Table Id' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}):U.startsWith("prctbl_")||b.push({message:"'Pricing Table Id' field must start with prctbl_. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The monetization setting for 'Pricing Table Id' is not set or is an empty string. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}),mE(Q)?Q.startsWith("$env(")?Q.startsWith("$env(ZUPLO_PUBLIC_")||b.push({message:"'Publishable Key' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}):Q.startsWith("pk_")||b.push({message:"'Publishable Key' field must start with pk_. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The monetization setting for 'Publishable Key' is not set or is an empty string. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}),mE(te)?te.startsWith("$env(")||b.push({message:"The monetization setting for 'Secret Key' must be an environment variable. Field monetization.secretKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"}):b.push({message:"The monetization setting for 'Secret Key' is not set or is an empty string. Field monetization.secretKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}}else N.enableMonetization&&!N.monetization&&b.push({message:"Monetization was enabled but no monetization configuration was provider in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"});return{errors:[],warnings:b}})},"validateDevPortalJSON");function slt({audience:s,clientId:a,clientSecret:u}){let p=[];return s&&s.startsWith("$env(")&&!s.startsWith("$env(ZUPLO_PUBLIC_")&&p.push({message:"'audience' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}),mE(a)?a.startsWith("$env(")&&!a.startsWith("$env(ZUPLO_PUBLIC_")&&p.push({message:"'clientId' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"}):p.push({message:"The authentication setting for 'clientId' is not set or is an empty string.",pluginName:"validate-dev-portal-json",severity:"warning"}),mE(u)&&!u.startsWith("$env(")&&(u.startsWith("$env(ZUPLO_PUBLIC")&&p.push({message:"The authorization setting for 'Client Secret' should not be a public environment variable. ",pluginName:"validate-dev-portal-json",severity:"warning"}),p.push({message:"The authorization setting for 'Client Secret' must be an environment variable. Field authentication.devPortalClient.secretKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})),p}t(slt,"validateCommonAuth");import{readFile as cnr,readdir as lnr}from"fs/promises";import olt from"path";var Fce="validate-open-api-files",clt=t(async function({sourceDirectory:s,logger:a}){return Fu.timeFn("Building OpenAPI files to build output",async()=>{a.debug("Building OpenAPI files to build output");let u=olt.join(s,Kp),p=[];try{if(!await JR(s))return new Yp({message:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:Fce,severity:"error"});let k=(await lnr(u)).filter(N=>N.endsWith(".oas.json"));for(let N of k){let M=olt.join(u,N);try{N==="zp.oas.json"&&p.push({message:"Open API files cannot be named 'zp.oas.json' since 'zp' is a reserved prefix. Update the file name to solve this build issue.",pluginName:Fce,severity:"error"});let U=await cnr(M,"utf-8"),Q=JSON.parse(U);if(Q&&Q.paths){let te=Object.entries(Q.paths).filter(z=>z[0]==="zp"||z[0]==="/zp");if(te.length>0){let z=te.length===1?"includes one route path":`includes '${te.length}' routes`;p.push({message:`Open API file '${N}' ${z} that's named '/zp' which is a reserved route name. Updating the route to something other than '/zp' will solve this build issue.`,pluginName:Fce,severity:"error"})}}}catch(U){a.error(U)}}}catch(g){return a.error(g),p.length>0?{errors:p,warnings:[]}:new Yp({message:"Failed while validating the open api files in the project",pluginName:Fce,severity:"warning"})}return{errors:p,warnings:[]}})},"validateOpenAPIFiles");var cM=sm(QNe(),1);import{parse as Gnr}from"jsonc-parser";import{readFile as Knr,writeFile as ZNe}from"fs/promises";import Ynr from"path";import Xnr from"prettier";var oM=sm(QNe(),1);var Ylt=t(()=>({include:["modules/**/*",".zuplo/**/*","tests/**/*"],exclude:["./node_modules","./dist"],compilerOptions:{baseUrl:".",module:oM.ModuleKind.ESNext,target:oM.ScriptTarget.ESNext,moduleResolution:oM.ModuleResolutionKind.Bundler,lib:["ESNext","WebWorker","Webworker.Iterable"],preserveConstEnums:!0,useUnknownInCatchVariables:!1,forceConsistentCasingInFileNames:!0,importHelpers:!0,removeComments:!0,esModuleInterop:!0,strictNullChecks:!0,experimentalDecorators:!0,noEmit:!0,paths:{"@app/*":[".zuplo/*"]}}}),"getZuploTsConfigTemplate");var wO="validate-tsconfig",Xlt=t(async function({sourceDirectory:s,logger:a,command:u,environmentType:p}){return Fu.timeFn("Validate TSConfig",async()=>{a.debug("Validate TSConfig");let g=p==="WORKING_COPY"||u==="dev";try{let b=Ylt(),k=Ynr.join(s,"tsconfig.json");if(!await pc.fileExists(k))return g?(await ZNe(k,JSON.stringify(b,null,2)),{warnings:[{message:"This project does not have a tsconfig.json file. The file has been created for you.",severity:"warning",pluginName:wO,helpUrl:"https://zuplo.com/docs/articles/tsconfig"}],errors:[]}):{warnings:[],errors:[{message:"This project does not have a tsconfig.json file.",severity:"error",pluginName:wO,helpUrl:"https://zuplo.com/docs/articles/tsconfig"}]};let N=await Knr(k,"utf-8"),M=Gnr(N);if(!(M&&typeof M=="object"&&"compilerOptions"in M))return g?(await ZNe(k,JSON.stringify(b,null,2)),{warnings:[{message:"This project's tsconfig.json file was invalid. A valid file has been written for you.",severity:"warning",pluginName:wO,helpUrl:"https://zuplo.com/docs/articles/tsconfig"}],errors:[]}):{warnings:[],errors:[{message:"This project's tsconfig.json file is invalid. It must have a compilerOptions.",severity:"error",pluginName:wO,helpUrl:"https://zuplo.com/docs/articles/tsconfig"}]};let U=cM.default.convertCompilerOptionsFromJson(M.compilerOptions,s);if(U.errors.length>0)return{warnings:[],errors:U.errors.map(fn=>({severity:"error",pluginName:wO,message:fn.messageText.toString(),detail:"You will need to modify your tsconfig.json file to build this project.",helpUrl:"https://zuplo.com/docs/articles/tsconfig",location:fn.file?{line:fn.file.getLineStarts()[0],length:fn.file.getWidth(),file:fn.file.fileName,column:fn.file.getStart(),lineText:"",namespace:"",suggestion:""}:void 0}))};if(!M||typeof M!="object")throw new TypeError("The userConfigRaw is not an object, this should not happen.");if(!("compilerOptions"in M)||M.compilerOptions===null||M.compilerOptions===void 0||typeof M.compilerOptions!="object")throw new TypeError("The userConfigRaw.compilerOptions property is not an object, this should not happen.");let Q=t((fn,mr,tr)=>`The compiler option '${fn}' should ${mr===void 0?"not be set":`be set to '${typeof mr=="string"?mr:JSON.stringify(mr)}'`}, it was ${tr===void 0?"not set":`set to '${typeof tr=="string"?tr:JSON.stringify(tr)}'`}`,"getMessage"),te=!1,z="ESNext",Se=cM.ModuleKind.ESNext,Me=[];U.options.module!==Se&&(g&&(te=!0,M.compilerOptions.module=z),Me.push(Q("module",z,M.compilerOptions.module)));let xe="ES2022",Le=cM.default.ScriptTarget.ES2022;U.options.target!==Le&&(Me.push(Q("target",xe,M.compilerOptions.target)),g&&(te=!0,M.compilerOptions.target=xe));let kt="Bundler",Bt=cM.default.ModuleResolutionKind.Bundler;U.options.moduleResolution!==Bt&&(Me.push(Q("moduleResolution",kt,M.compilerOptions.moduleResolution)),g&&(te=!0,M.compilerOptions.moduleResolution=kt));let ur=["ESNext","WebWorker","Webworker.Iterable"];if(t(fn=>{let mr=ur.map(kr=>kr.toLowerCase()),tr=fn.map(kr=>kr.toLowerCase());return mr.every(kr=>tr.includes(kr))},"includesAllLibs")(M.compilerOptions.lib??[])||(Me.push(Q("lib",ur,M.compilerOptions.lib)),g&&(te=!0,M.compilerOptions.lib=ur)),U.options.baseUrl&&(Me.push(Q("baseUrl",void 0,M.compilerOptions.baseUrl)),g)){te=!0,M.compilerOptions.baseUrl=void 0;let fn=M.compilerOptions.paths??{};fn["@app/*"]&&Array.isArray(fn["@app/*"])&&fn["@app/*"].includes(".zuplo/*")&&(fn["@app/*"]=["./.zuplo/*"],M.compilerOptions.paths=fn)}let er=[];if(Me.length>0&&er.push({message:g&&te?"This project's tsconfig.json was updated to the recommended configuration. Custom settings may cause build issues. For guidance on how to adjust your settings, please visit: https://zuplo.com/docs/articles/tsconfig":"This project's tsconfig.json does not match the recommended configuration. You should update this file to the recommended settings to ensure your project builds correctly. For guidance on how to adjust your settings, please visit: https://zuplo.com/docs/articles/tsconfig",severity:"warning",detail:Me.join(`
697
697
  `),pluginName:wO,helpUrl:"https://zuplo.com/docs/articles/tsconfig"}),g&&te){let fn=await Xnr.format(JSON.stringify(M,null,2),{parser:"json"});await ZNe(k,fn)}return{warnings:er,errors:[]}}catch(b){a.error(b);let k={message:`Error validating tsconfig.json : ${b.message}`,severity:"error",pluginName:wO};return{warnings:[],errors:[k]}}})},"validateTSConfig");import{parse as Znr}from"@swc/core";import Qnr from"vm";var{hasOwnProperty:Kv}=Object.prototype;function DO(s,a){return s=s.slice(),s.push(a),s}t(DO,"push");function e4e(s,a){return a=a.slice(),a.unshift(s),a}t(e4e,"unshift");var t4e=class extends Error{static{t(this,"NewError")}constructor(a){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=a,this.name="NewError"}};function o_(s,a,u,p,g){if(!(this instanceof o_))try{return new o_(s,a,u,p,g)}catch(k){if(!k.avoidNew)throw k;return k.value}typeof s=="string"&&(g=p,p=u,u=a,a=s,s=null);let b=s&&typeof s=="object";if(s=s||{},this.json=s.json||u,this.path=s.path||a,this.resultType=s.resultType||"value",this.flatten=s.flatten||!1,this.wrap=Kv.call(s,"wrap")?s.wrap:!0,this.sandbox=s.sandbox||{},this.preventEval=s.preventEval||!1,this.parent=s.parent||null,this.parentProperty=s.parentProperty||null,this.callback=s.callback||p||null,this.otherTypeCallback=s.otherTypeCallback||g||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},s.autostart!==!1){let k={path:b?s.path:a};b?"json"in s&&(k.json=s.json):k.json=u;let N=this.evaluate(k);if(!N||typeof N!="object")throw new t4e(N);return N}}t(o_,"JSONPath");o_.prototype.evaluate=function(s,a,u,p){let g=this.parent,b=this.parentProperty,{flatten:k,wrap:N}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,u=u||this.callback,this.currOtherTypeCallback=p||this.otherTypeCallback,a=a||this.json,s=s||this.path,s&&typeof s=="object"&&!Array.isArray(s)){if(!s.path&&s.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Kv.call(s,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:a}=s),k=Kv.call(s,"flatten")?s.flatten:k,this.currResultType=Kv.call(s,"resultType")?s.resultType:this.currResultType,this.currSandbox=Kv.call(s,"sandbox")?s.sandbox:this.currSandbox,N=Kv.call(s,"wrap")?s.wrap:N,this.currPreventEval=Kv.call(s,"preventEval")?s.preventEval:this.currPreventEval,u=Kv.call(s,"callback")?s.callback:u,this.currOtherTypeCallback=Kv.call(s,"otherTypeCallback")?s.otherTypeCallback:this.currOtherTypeCallback,g=Kv.call(s,"parent")?s.parent:g,b=Kv.call(s,"parentProperty")?s.parentProperty:b,s=s.path}if(g=g||null,b=b||null,Array.isArray(s)&&(s=o_.toPathString(s)),!s&&s!==""||!a)return;let M=o_.toPathArray(s);M[0]==="$"&&M.length>1&&M.shift(),this._hasParentSelector=null;let U=this._trace(M,a,["$"],g,b,u).filter(function(Q){return Q&&!Q.isParentSelector});return U.length?!N&&U.length===1&&!U[0].hasArrExpr?this._getPreferredOutput(U[0]):U.reduce((Q,te)=>{let z=this._getPreferredOutput(te);return k&&Array.isArray(z)?Q=Q.concat(z):Q.push(z),Q},[]):N?[]:void 0};o_.prototype._getPreferredOutput=function(s){let a=this.currResultType;switch(a){case"all":{let u=Array.isArray(s.path)?s.path:o_.toPathArray(s.path);return s.pointer=o_.toPointer(u),s.path=typeof s.path=="string"?s.path:o_.toPathString(s.path),s}case"value":case"parent":case"parentProperty":return s[a];case"path":return o_.toPathString(s[a]);case"pointer":return o_.toPointer(s.path);default:throw new TypeError("Unknown result type")}};o_.prototype._handleCallback=function(s,a,u){if(a){let p=this._getPreferredOutput(s);s.path=typeof s.path=="string"?s.path:o_.toPathString(s.path),a(p,u,s)}};o_.prototype._trace=function(s,a,u,p,g,b,k,N){let M;if(!s.length)return M={path:u,value:a,parent:p,parentProperty:g,hasArrExpr:k},this._handleCallback(M,b,"value"),M;let U=s[0],Q=s.slice(1),te=[];function z(Se){Array.isArray(Se)?Se.forEach(Me=>{te.push(Me)}):te.push(Se)}if(t(z,"addRet"),(typeof U!="string"||N)&&a&&Kv.call(a,U))z(this._trace(Q,a[U],DO(u,U),a,U,b,k));else if(U==="*")this._walk(a,Se=>{z(this._trace(Q,a[Se],DO(u,Se),a,Se,b,!0,!0))});else if(U==="..")z(this._trace(Q,a,u,p,g,b,k)),this._walk(a,Se=>{typeof a[Se]=="object"&&z(this._trace(s.slice(),a[Se],DO(u,Se),a,Se,b,!0))});else{if(U==="^")return this._hasParentSelector=!0,{path:u.slice(0,-1),expr:Q,isParentSelector:!0};if(U==="~")return M={path:DO(u,U),value:g,parent:p,parentProperty:null},this._handleCallback(M,b,"property"),M;if(U==="$")z(this._trace(Q,a,u,null,null,b,k));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(U))z(this._slice(U,Q,a,u,p,g,b));else if(U.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let Se=U.replace(/^\?\((.*?)\)$/u,"$1");this._walk(a,Me=>{this._eval(Se,a[Me],Me,u,p,g)&&z(this._trace(Q,a[Me],DO(u,Me),a,Me,b,!0))})}else if(U[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");z(this._trace(e4e(this._eval(U,a,u[u.length-1],u.slice(0,-1),p,g),Q),a,u,p,g,b,k))}else if(U[0]==="@"){let Se=!1,Me=U.slice(1,-2);switch(Me){case"scalar":(!a||!["object","function"].includes(typeof a))&&(Se=!0);break;case"boolean":case"string":case"undefined":case"function":typeof a===Me&&(Se=!0);break;case"integer":Number.isFinite(a)&&!(a%1)&&(Se=!0);break;case"number":Number.isFinite(a)&&(Se=!0);break;case"nonFinite":typeof a=="number"&&!Number.isFinite(a)&&(Se=!0);break;case"object":a&&typeof a===Me&&(Se=!0);break;case"array":Array.isArray(a)&&(Se=!0);break;case"other":Se=this.currOtherTypeCallback(a,u,p,g);break;case"null":a===null&&(Se=!0);break;default:throw new TypeError("Unknown value type "+Me)}if(Se)return M={path:u,value:a,parent:p,parentProperty:g},this._handleCallback(M,b,"value"),M}else if(U[0]==="`"&&a&&Kv.call(a,U.slice(1))){let Se=U.slice(1);z(this._trace(Q,a[Se],DO(u,Se),a,Se,b,k,!0))}else if(U.includes(",")){let Se=U.split(",");for(let Me of Se)z(this._trace(e4e(Me,Q),a,u,p,g,b,!0))}else!N&&a&&Kv.call(a,U)&&z(this._trace(Q,a[U],DO(u,U),a,U,b,k,!0))}if(this._hasParentSelector)for(let Se=0;Se<te.length;Se++){let Me=te[Se];if(Me&&Me.isParentSelector){let xe=this._trace(Me.expr,a,Me.path,p,g,b,k);if(Array.isArray(xe)){te[Se]=xe[0];let Le=xe.length;for(let kt=1;kt<Le;kt++)Se++,te.splice(Se,0,xe[kt])}else te[Se]=xe}}return te};o_.prototype._walk=function(s,a){if(Array.isArray(s)){let u=s.length;for(let p=0;p<u;p++)a(p)}else s&&typeof s=="object"&&Object.keys(s).forEach(u=>{a(u)})};o_.prototype._slice=function(s,a,u,p,g,b,k){if(!Array.isArray(u))return;let N=u.length,M=s.split(":"),U=M[2]&&Number.parseInt(M[2])||1,Q=M[0]&&Number.parseInt(M[0])||0,te=M[1]&&Number.parseInt(M[1])||N;Q=Q<0?Math.max(0,Q+N):Math.min(N,Q),te=te<0?Math.max(0,te+N):Math.min(N,te);let z=[];for(let Se=Q;Se<te;Se+=U)this._trace(e4e(Se,a),u,p,g,b,k,!0).forEach(xe=>{z.push(xe)});return z};o_.prototype._eval=function(s,a,u,p,g,b){this.currSandbox._$_parentProperty=b,this.currSandbox._$_parent=g,this.currSandbox._$_property=u,this.currSandbox._$_root=this.json,this.currSandbox._$_v=a;let k=s.includes("@path");k&&(this.currSandbox._$_path=o_.toPathString(p.concat([u])));let N="script:"+s;if(!o_.cache[N]){let M=s.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");k&&(M=M.replace(/@path/gu,"_$_path")),o_.cache[N]=new this.vm.Script(M)}try{return o_.cache[N].runInNewContext(this.currSandbox)}catch(M){throw new Error("jsonPath: "+M.message+": "+s)}};o_.cache={};o_.toPathString=function(s){let a=s,u=a.length,p="$";for(let g=1;g<u;g++)/^(~|\^|@.*?\(\))$/u.test(a[g])||(p+=/^[0-9*]+$/u.test(a[g])?"["+a[g]+"]":"['"+a[g]+"']");return p};o_.toPointer=function(s){let a=s,u=a.length,p="";for(let g=1;g<u;g++)/^(~|\^|@.*?\(\))$/u.test(a[g])||(p+="/"+a[g].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return p};o_.toPathArray=function(s){let{cache:a}=o_;if(a[s])return a[s].concat();let u=[],g=s.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(b,k){return"[#"+(u.push(k)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(b,k){return"['"+k.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(b,k){return";"+k.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(b){let k=b.match(/#(\d+)/u);return!k||!k[1]?b:u[k[1]]});return a[s]=g,a[s].concat()};o_.prototype.vm=Qnr;import eir from"fs/promises";import tir from"path";var Qlt=t(async function({outputDirectory:s,logger:a}){return Fu.timeFn("Verify Worker output",async()=>{a.debug("Verify Worker output");let u=tir.join(s,"worker.js");try{if(await pc.fileExists(u)){let p=await eir.readFile(u,"utf-8"),g=await Znr(p,{syntax:"ecmascript"}),b=o_({path:"$..callee[?(@property === 'value' && (@ === 'Function'|| @ === 'eval'))]^",json:g.body});if(b&&b.length>0)return{warnings:[{message:"We do not support the use of 'eval' or 'new Function(...)'",severity:"warning",pluginName:"verify-worker-output"}],errors:[]}}}catch(p){a.error(p);let g={message:`Error validating build output : ${p.message}`,severity:"error",pluginName:"verify-worker-output"};return{warnings:[],errors:[g]}}return{warnings:[],errors:[]}})},"verifyWorkerOutput");import*as Zvt from"esbuild";import{randomUUID as rir}from"crypto";var KN=class{static{t(this,"CompilerResult")}buildId;buildTime;buildTimeMs;errors;warnings;status;assets;metafile;constructor(a,u){this.buildId=u?.buildId??rir(),this.buildTime=u?.startBuildTime.toISOString(),this.buildTimeMs=u?.endBuildTime.getTime()-u?.startBuildTime.getTime(),this.errors=a.errors.map(p=>({message:p.text,severity:qW,...p})),this.warnings=a.warnings.map(p=>({message:p.text,severity:zW,...p})),a.metafile&&(this.metafile=a.metafile),this.status=_O,this.warnings&&this.warnings.length>0&&(this.status=jR),this.errors&&this.errors.length>0&&(this.status=Wv)}};var nir=!1;function lM(s,a){return{open:`\x1B[${s.join(";")}m`,close:`\x1B[${a}m`,regexp:new RegExp(`\\x1b\\[${a}m`,"g")}}t(lM,"code");function uM(s,a){return nir?`${a.open}${s.replace(a.regexp,a.open)}${a.close}`:s}t(uM,"run");function iir(s){return uM(s,lM([31],39))}t(iir,"red");function sir(s){return uM(s,lM([32],39))}t(sir,"green");function air(s){return uM(s,lM([33],39))}t(air,"yellow");function oir(s){return uM(s,lM([34],39))}t(oir,"blue");function cir(s){return uM(s,lM([35],39))}t(cir,"magenta");function lir(s){return uM(s,lM([36],39))}t(lir,"cyan");var xFr=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");var Zlt=[iir,sir,air,oir,cir,lir];function uir(s){let a=0,u=s.length,p=0;if(u>0)for(;p<u;)a=(a<<5)-a+s.charCodeAt(p++)|0;return a}t(uir,"hashCode");function eut(s){let a=Math.abs(uir(s));return Zlt[a%Zlt.length]}t(eut,"generateColor");import{inspect as fir}from"util";function tut(s,a,...u){let p=0,g=u.length,b=String(a).replace(/%[sdjoO%]/g,k=>{if(k==="%%")return"%";if(p>=g)return k;switch(k){case"%s":return String(u[p++]);case"%d":return Number(u[p++]).toString();case"%o":return s(u[p++]).split(`
698
698
  `).map(N=>N.trim()).join(" ");case"%O":return s(u[p++]);case"%j":try{return JSON.stringify(u[p++])}catch{return"[Circular]"}default:return k}});for(let k of u.splice(p))k===null||!(typeof k=="object"&&k!==null)?b+=" "+k:b+=" "+s(k);return b}t(tut,"format");var rut=t((s,...a)=>tut(fir,s,a),"format");var r4e=class{static{t(this,"Debugger")}manager;ns;color;last;enabled;constructor(a,u){this.manager=a,this.ns=u,this.color=eut(u),this.last=0,this.enabled=a.enabled.some(p=>p.test(u))}log(...a){if(!this.enabled)return;let u,p=a[0];typeof p=="function"?u=p():u=String(p);let g=Date.now()-(this.last||Date.now());u=rut(u,...a);let b=`${this.color(this.ns)} ${u} ${this.color(`+${g}ms`)}`;console.log(b),this.last=Date.now()}},n4e=class{static{t(this,"DebugManager")}debuggers;enabled;constructor(a){this.debuggers=new Map,this.enabled=a??[]}};function _ir(s){return!s||s.length===0?[]:(s=s.replace(/\s/g,"").replace(/\*/g,".+"),s.split(",").map(a=>new RegExp(`^${a}$`)))}t(_ir,"extract");var qce;function nut(s){qce||(qce=new n4e(_ir(process.env.DEBUG)));let a=new r4e(qce,s);return qce.debuggers.set(s,a),Object.assign(a.log.bind(a),{self:a})}t(nut,"debug");import Nfe,{dirname as Kvt}from"path";import{fileURLToPath as Yvt}from"url";var i4e="no-remote-module";function iut({logger:s}){return{name:i4e,async setup(a){a.onResolve({filter:/^https?:\/\//},u=>(s.error(u,"User attempted to load a remote module"),{errors:[{text:`Remote modules are not supported. Attempted to load module ${u.path}`,detail:"InvalidRemoteModule",pluginName:i4e,location:{line:0,column:0,file:""}}],pluginName:i4e}))}}}t(iut,"blockRemoteModulePlugin");import sut from"fs/promises";import zce from"path";import pir from"prettier";var aut="/docs",dir="/__zuplo/dev-portal";function mir(s){let a=s.trim().toLowerCase();return a.endsWith("/")&&(a=a.slice(0,-1)),a}t(mir,"normalizePathname");function hir(s){let a={sitePathname:s?.sitePathname===dir?aut:s?.sitePathname?mir(s.sitePathname):aut,enabled:s?s.enabled??!0:!1};return`const devPortal = ${JSON.stringify(a)};
699
699
  export default devPortal;`}t(hir,"generateSource");function out(s){return{name:"dev-portal-config",setup(a){a.onResolve({filter:/dev-portal.json$/},u=>({namespace:"dev-portal-json",path:zce.isAbsolute(u.path)?u.path:zce.join(u.resolveDir,u.path),pluginName:"dev-portal"})),a.onLoad({filter:/.*/,namespace:"dev-portal-json"},async u=>Fu.timeFn("Generating dev-portal.json data",async()=>{let p,g,b=[];if(await pc.fileExists(u.path)){g=await sut.readFile(u.path,"utf-8");try{p=JSON.parse(g)}catch{b.push({id:"dev-portal-build-error",text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:null}]})}}if(b&&b.length>0)throw b;let k;try{if(k=hir(p),Lm.DEBUG_BUILD_MODE&&k&&await pc.dirExists(s.sourceDirectory)){let N=await pir.format(k,{parser:"babel"});await sut.writeFile(zce.join(s.sourceDirectory,NN,"dev-portal.js"),N)}if(b&&b.length>0)throw b}catch(N){N.length>0?N.forEach(M=>{let U={id:"dev-portal-build-error",text:M.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:M.message,location:null}]};b.push(U)}):b.push({id:"dev-portal-build-error",text:N.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:N.message,location:null}]})}return{contents:k,errors:b,pluginName:"dev-portal",loader:"js",resolveDir:zce.dirname(u.path),watchFiles:[u.path]}}))}}}t(out,"devPortalConfigPlugin");import cut from"path";var lut="legacy-environment",uut="legacy-environment",gir=`import { environment } from "@zuplo/runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/core",
3
- "version": "5.2430.0",
3
+ "version": "5.2432.0",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "exports": {
@@ -35,15 +35,15 @@
35
35
  "dependencies": {
36
36
  "@swc/core": "^1.7.6",
37
37
  "@swc/helpers": "^0.5.12",
38
- "@zuplo/runtime": "5.2430.0",
38
+ "@zuplo/runtime": "5.2432.0",
39
39
  "chokidar": "^3.5.3",
40
40
  "esbuild": "0.23.0",
41
41
  "jsonc-parser": "^3.2.0",
42
42
  "prettier": "^3.3.3"
43
43
  },
44
44
  "peerDependencies": {
45
- "@zuplo/graphql": "5.2430.0",
46
- "@zuplo/otel": "5.2430.0",
47
- "@zuplo/runtime": "5.2430.0"
45
+ "@zuplo/graphql": "5.2432.0",
46
+ "@zuplo/otel": "5.2432.0",
47
+ "@zuplo/runtime": "5.2432.0"
48
48
  }
49
49
  }