@zuplo/core 6.39.34 → 6.39.36
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/customer.cli.minified.js +1 -1
- package/index.minified.js +1 -1
- package/package.json +4 -4
package/customer.cli.minified.js
CHANGED
|
@@ -636,7 +636,7 @@ Did you specify these with the most recent transformation maps first?`);let d=g5
|
|
|
636
636
|
Following IDs are available: ${c.join(", ")}`})},"refine"),xEr=Gbt.partial(),DEr=xEr.superRefine(Qbt);function AEr(a){let s=DEr.safeParse(a);s.success||(console.log("Validation errors:"),console.log(Xpe(s.error).toString()))}t(AEr,"validateCommonConfig");var kEr=Vr.object({UNSAFE_slotlets:Vr.record(Vr.string(),Vr.custom()),mdx:Vr.object({components:Vr.custom()}).partial(),customPages:Vr.array(Vr.object({path:Vr.string(),element:Vr.custom().optional(),render:Vr.custom().optional(),prose:Vr.boolean().optional()})),plugins:Vr.array(Vr.custom()),build:Vr.custom()}),wEr=Gbt.merge(kEr).partial().superRefine(Qbt);function PEr(a){let s=wEr.safeParse(a);s.success||(console.log("Validation errors:"),console.log(Xpe(s.error).toString()))}t(PEr,"validateConfig");var NEr=["zudoku.config.js","zudoku.config.jsx","zudoku.config.ts","zudoku.config.tsx","zudoku.config.mjs"],IEr="dev-portal.json",N5e=t(a=>ZCr(a).then(()=>!0).catch(()=>!1),"fileExists"),A6,YN;async function O5e(a){if(A6&&YN&&await N5e(A6))return{configPath:A6,configType:YN};let s=jbt.join(a,IEr);if(await N5e(s))return A6=s,YN="dev-portal",{configPath:A6,configType:YN};for(let c of NEr){let f=jbt.join(a,c);if(await N5e(f))return A6=f,YN="zudoku",{configPath:A6,configType:YN}}return A6=void 0,YN=void 0,{configPath:A6,configType:YN}}t(O5e,"findConfigFilePath");async function OEr(a){let s=await O5e(a);if(s.configType)return s;throw new Error("No zudoku config file found in project root.")}t(OEr,"getConfigFilePath");async function FEr(a,s,c){let f=Bbt(s).href,d=[],v=await Tbt(f,{parentURL:import.meta.url,onImport:t(E=>{let A=eEr(E.startsWith("file://")?E:Bbt(E).href);A.startsWith(a)&&d.push(A)},"onImport")}).then(E=>E.default);if(!v)throw new Error(`Failed to load config file: ${s}`);return{dependencies:d,config:v}}t(FEr,"loadZudokuCodeConfig");async function LEr(a,s){let c=await XCr(a,"utf-8"),f;try{f=JSON.parse(c)}catch{throw new Error("Failed to parse dev-portal.json. Check that the file is valid JSON.")}return AEr(f),f=I5e(f,s),f=iEr(f),f}t(LEr,"loadDevPortalConfig");function I5e(a,s){if(typeof a=="string"){let c=a.match(/^\$env\(([^)]+)\)$/);if(c){let f=c[1];return s[f]}return a}else{if(Array.isArray(a))return a.map(c=>I5e(c,s));if(typeof a=="object"&&a!==null){let c={};for(let f in a)Object.hasOwn(a,f)&&(c[f]=I5e(a[f],s));return c}}return a}t(I5e,"replaceEnvVariables");async function Kbt(a,s,c){let{configPath:f,configType:d}=await OEr(a),v,E;return d==="dev-portal"?(v=await LEr(f,s),E=[]):({config:v,dependencies:E}=await(c?.loadZudokuCodeConfig??FEr)(a,f,s),PEr(v)),{...v,__meta:{dependencies:E,path:f,registerDependency:t((...O)=>E.push(...O),"registerDependency")}}}t(Kbt,"tryLoadZudokuConfig");import Zbt from"fs/promises";import U7 from"path";import{performance as Vx}from"perf_hooks";var dY=[];async function REr(a,s){let c=Vx.now();try{return await s()}finally{let f=Vx.now()-c;dY.push({name:a,duration:f})}}t(REr,"timeFn");var MEr={mark:t(a=>{Vx.mark(a)},"mark"),measure:t((a,s,c)=>{try{Vx.measure(a,s,c)}finally{Vx.clearMarks(s),Vx.clearMarks(c),Vx.clearMeasures(a)}},"measure"),timeFn:REr,report:t(()=>{if(dY.length>0){let a=dY.reduce((s,{name:c,duration:f})=>(s[c]=`${f.toFixed(0)}ms`,s),{});console.table(a),dY.length=0}},"report"),getDuration:t(a=>{let s=Vx.getEntriesByName(a);if(s.length===0)return 0;let c=s[0].duration;return Vx.clearMeasures(a),c},"getDuration"),clear:t(()=>{dY.length=0,Vx.clearMarks(),Vx.clearMeasures()},"clear")},cf=MEr;import{writeFile as jEr}from"fs/promises";async function hk(a,s){await du.mkdirForFilePathIfNotExits(a);let c=await import("prettier"),f=s;try{f=await c.format(s,{parser:"babel"})}catch{}await jEr(a,f,"utf-8")}t(hk,"writeDebugSourceFile");import{readFile as BEr}from"fs/promises";import F5e from"path";async function Ybt(a){let s=`${a}/config/dev-portal.json`,c=!0;if(await du.fileExists(s)){try{let d=await BEr(s,"utf-8");JSON.parse(d).enabled===!1&&(c=!1)}catch{}return{enabled:c,type:"dev-portal"}}return(await O5e(F5e.join(a,"docs")))?.configType?{enabled:!0,type:"zudoku"}:{enabled:!1,type:void 0}}t(Ybt,"getDevPortalConfig");function gU(a,s){let c=F5e.relative(process.cwd(),F5e.join(a,Gj));return Object.keys(s?.outputs??{}).map(d=>`.${d.replace(c,"")}`)}t(gU,"getBuildModules");var Xbt="/docs",$Er="/__zuplo/dev-portal";function JEr(a){let s=a.trim().toLowerCase();return s.endsWith("/")&&(s=s.slice(0,-1)),s}t(JEr,"normalizePathname");function zEr(a){let s={sitePathname:a?.sitePathname===$Er?Xbt:a?.sitePathname?JEr(a.sitePathname):Xbt,enabled:a?a.enabled??!0:!1,version:a?.version??"legacy"};return`const devPortal = ${JSON.stringify(s)};
|
|
637
637
|
export default devPortal;`}t(zEr,"generateSource");function e2t(a){return{name:"dev-portal-config",setup(s){s.onResolve({filter:/dev-portal.json$/},c=>({namespace:"dev-portal-json",path:U7.isAbsolute(c.path)?c.path:U7.join(c.resolveDir,c.path),pluginName:"dev-portal"})),s.onLoad({filter:/.*/,namespace:"dev-portal-json"},async c=>cf.timeFn("Generating dev-portal.json data",async()=>{let f,d,v=[],E=await Ybt(a.sourceDirectory);if(E.type==="zudoku")try{let O=U7.join(U7.resolve(U7.dirname(c.path),".."),Ylt),R=await Kbt(O,{},{loadZudokuCodeConfig:qEr(a.sourceDirectory,a.logger)});f={version:"zudoku",enabled:typeof R.basePath=="string"&&R.basePath.length>0,sitePathname:R.basePath}}catch(O){a.logger.error(O,"Failed to load developer portal configuration"),v.push({id:"dev-portal-build-error",text:"Could not load developer portal configuration.",location:{file:"docs/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:O.message,pluginName:"dev-portal",notes:[]})}else if(E.type==="dev-portal"){d=await Zbt.readFile(c.path,"utf-8");try{f=JSON.parse(d)}catch(O){v.push({id:"dev-portal-build-error",text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:{file:"config/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}}let A;try{if(A=zEr(f),Mh.DEBUG_BUILD_MODE&&A){let O=U7.join(a.sourceDirectory,".zuplo","dev-portal.js");await hk(O,A)}}catch(O){v.push({id:"dev-portal-build-error",text:O.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:O.message,location:null}]})}return{contents:A,errors:v,pluginName:"dev-portal",loader:"js",resolveDir:U7.dirname(c.path),watchFiles:[c.path]}}))}}}t(e2t,"devPortalConfigPlugin");function qEr(a,s){return t(async function(f,d,v){let E;try{E=du.safePath(a).resolve(d)}catch(K){throw s.error(`Error resolving path ${d} inside ${a}`),K}let A=await Zbt.readFile(E,"utf-8"),O=await UEr(A,{target:"esnext",syntax:"typescript",tsx:!0}),R=VEr(O);return{dependencies:[],config:{basePath:R??"/docs"}}},"loadZudokuCodeConfig")}t(qEr,"createLoadDevPortalConfigFunction");function VEr(a){let s;return a.body.forEach(c=>{if(c.type==="VariableDeclaration"){let f=c.declarations[0];f.id.type==="Identifier"&&f.id.value==="config"&&f.init&&f.init.type==="ObjectExpression"&&f.init.properties.forEach(v=>{v.type==="KeyValueProperty"&&(v.key.type==="Identifier"&&v.key.value==="basePath"||v.key.type==="StringLiteral"&&v.key.value==="basePath")&&v.value.type==="StringLiteral"&&(s=v.value.value)})}}),s}t(VEr,"getBasePathFromConfig");import t2t from"path";var r2t="legacy-environment",n2t="legacy-environment",WEr=`import { environment } from "@zuplo/runtime";
|
|
638
638
|
export default environment;`;function i2t(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:n2t,pluginName:r2t,path:t2t.join(a.sourceDirectory,gN,"environment.js")})),s.onLoad({filter:/.*/,namespace:n2t},async c=>({contents:WEr,loader:"ts",resolveDir:t2t.dirname(c.path),pluginName:r2t}))}}}t(i2t,"environmentPlugin");var mCt=jp(CLe(),1),hCt=jp(MTt(),1),gCt=jp(GLe(),1),yCt=jp(QLe(),1);import V6r from"fs/promises";import FS from"path";var Ck="schemas",Lde="json-schema";function vCt(a){return{name:Ck,async setup(s){let c=new gCt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0}),f=FS.join(a.sourceDirectory,uQ),d=[],v=[],E;await cf.timeFn("Initializing schema validation",async()=>{if((0,hCt.default)(c,{mode:"fast"}),c.opts.code.formats=mCt._`require("ajv-formats/dist/formats").fastFormats`,await du.dirExists(f)&&(c.addKeyword("faker"),E=await du.listFolderContents(f,uQ),await Promise.all(E.map(async A=>{try{let O=du.safePath(a.sourceDirectory).resolve(f,A);if(!O.startsWith(f))throw new Error("All schemas must be in the schemas directory");let R=await V6r.readFile(O,"utf-8");if(R===""||R===void 0)throw new Error(`Schema 'schemas/${A}' is empty and will be ignored.`);let W=JSON.parse(R);if(W.$schema&&W.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${A}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(c.addSchema(W,A),c.errors?.length){let $=c.errors[0];d.push({id:"json-schema-validation-error",pluginName:Ck,text:`Error: ${$.message}`,location:{file:FS.join(uQ,A)},detail:{params:$.params,propertyName:$.propertyName,schemaPath:$.schemaPath,data:$.data}})}}catch(O){if(O.message.endsWith("is empty and will be ignored.")){v.push({id:"empty-json-schema-file",pluginName:Ck,text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let R=await E7e(A,a.sourceDirectory,O.message);d.push({id:"json-schema-add-error",pluginName:Ck,text:`Error: ${O.message}`,location:R,detail:"InvalidAddSchemaError",notes:[{text:O.message}]})}})),await Promise.all(E.map(async A=>{try{let O=c.getSchema(A);O&&c.compile(O.schema).errors?.forEach(W=>{d.push({text:`Failed to compile ${A}: ${W.message}`})})}catch(O){let R=await E7e(A,a.sourceDirectory,O.message);d.push({id:"json-schema-compile-error",pluginName:Ck,text:`The schema file '${A}' is not valid. Error: ${O.message}`,location:R,detail:"InvalidSchemaError",notes:[{text:O.message}]})}})),Mh.DEBUG_BUILD_MODE)){let A=FS.resolve(a.outputDirectory,uQ);await du.mkdirIfNotExists(A)}}),s.onStart(async()=>{if(E)return{errors:d,warnings:v}}),s.onResolve({filter:/schemas\/.*\.json$/},async A=>cf.timeFn("Generating JSON schemas...",async()=>{let O=FS.isAbsolute(A.path)?A.path:FS.join(A.resolveDir,A.path);if(A.importer&&A.importer!==FS.join(a.sourceDirectory,"config/routes.json"))return{path:O};if(!await du.fileExists(O)){let R="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${A.path}' from ${R}`,location:{file:FS.join(A.resolveDir,R),namespace:Lde,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${R}`,suggestion:""},detail:"RouteReferenceError",pluginName:Ck,notes:[{text:`Unable to resolve reference to '${A.path}' from ${R}`,location:null}]}],namespace:Lde,path:O,pluginName:Ck}}return{path:O,namespace:Lde,pluginName:Ck}})),s.onLoad({filter:/.*/,namespace:Lde},async A=>cf.timeFn(`Generating json schema data: ${FS.basename(A.path)}`,async()=>{let O=[],R;try{let W=FS.relative(f,A.path),$=c.getSchema(W);if(!$)throw new Error(`Could not load schema at ${A.path}`);R=$.source?.validateCode;let K=c.compile($.schema);R=(0,yCt.default)(c,K)}catch(W){O.push({pluginName:Ck,text:`Cannot parse project's schemas/${FS.basename(A.path)} file. Error: ${W.message}`,location:null,notes:[{text:W.message,location:null}],detail:W})}if(Mh.DEBUG_BUILD_MODE&&R){let W=FS.relative(f,A.path),$=FS.join(a.sourceDirectory,".zuplo",`${W}.js`);await hk($,R)}return{contents:R,errors:O,pluginName:Ck,resolveDir:FS.dirname(A.path),watchFiles:[A.path]}}))}}}t(vCt,"jsonSchemaPlugin");import{relative as W6r}from"path";var bCt=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],H6r="nodejs-compat-plugin";function SCt({sourceDirectory:a}){return{name:H6r,setup(s){let c=new Set;s.onStart(()=>{c.clear()}),s.onResolve({filter:/node:.*/},async({path:f,kind:d,resolveDir:v,...E})=>{let A=`${f}:${d}:${v}:${E.importer}`;if(c.has(A))return;c.add(A);let O=await s.resolve(f,{kind:d,resolveDir:v,importer:E.importer});return O.errors.length>0?bCt.includes(f)||f.includes("/")&&bCt.includes(f.split("/")[0])?{external:!0}:{external:!0,warnings:O.errors.map(W=>({...W,location:{file:W6r(a,E.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${f}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:O})}}}t(SCt,"nodejsCompatPlugin");import TCt from"fs/promises";import Xx from"path";var BU="open-api-routes-plugin",Rde="open-api-routes-json";function CCt(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/routes.json$/},c=>({watchFiles:[...KLe(Xx.join(a.sourceDirectory,DS),[".oas.json"],!0),Xx.join(a.sourceDirectory,DS,Jue)],namespace:Rde,path:Xx.isAbsolute(c.path)?c.path:Xx.join(c.resolveDir,c.path),pluginName:BU})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:Rde},async c=>cf.timeFn("Generating route data...",async()=>{let f=Xx.join(c.resolveDir,`${c.path}.ts`);if(!await du.fileExists(f)){let d=`$import(.${c.path.replace(/^../,"")})`,v=Xx.resolve(a.sourceDirectory,"config"),E=await GF(v),A=await Pft(E,d,"Update your route configuration to use code from the 'modules' folder");return{errors:[{id:"route-build-error",text:`Invalid handler reference in routes.json. Unable to resolve reference to '${d}' from routes.json`,location:A,detail:"RouteReferenceError",pluginName:BU}],namespace:Rde,path:c.path,pluginName:BU}}})),s.onLoad({filter:/.*/,namespace:Rde},async c=>cf.timeFn("Generating route.json data",async()=>{let f=Xx.resolve(a.sourceDirectory,"config"),d=await GF(f),v=await Promise.all(d.map(async R=>({content:await TCt.readFile(R,"utf-8"),fileName:R}))),E=Xx.resolve(f,"policies.json");if(!await du.fileExists(E))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:BU,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:BU};let A={content:await TCt.readFile(E,"utf-8"),fileName:E},O;try{O=await b7e({sourceDirectory:a.sourceDirectory,oasContent:v,policiesContent:A})}catch(R){throw new Error("Error compiling routes: "+R.message)}if(Mh.DEBUG_BUILD_MODE&&O.content){let R=Xx.join(a.sourceDirectory,".zuplo"),W=Xx.resolve(R,"routes.js");await hk(W,O.content)}return{contents:O.content,errors:O.errors,pluginName:BU,resolveDir:Xx.dirname(c.path),watchFiles:[c.path]}}))}}}t(CCt,"openApiRoutesPlugin");import Mde from"path";var HY="raw-route-plugin",ECt="raw-route";function xCt(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/raw.json$/},c=>({namespace:ECt,path:c.path,pluginName:HY})),s.onLoad({filter:/.*/,namespace:ECt},async c=>cf.timeFn("Building route data",async()=>{let f=Mde.resolve(a.sourceDirectory,DS);if(!await du.dirExists(f))return{loader:"js",resolveDir:Mde.dirname(c.path),pluginName:HY};let d=await GF(f);try{let v=await C7e({oasFiles:d,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Mh.DEBUG_BUILD_MODE&&v){let E=Mde.join(a.sourceDirectory,".zuplo","raw-routes.js");await hk(E,v)}return{contents:v,loader:"js",resolveDir:Mde.dirname(c.path),pluginName:HY}}catch(v){if(v instanceof Tv)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:v.issue.text,location:v.issue.location,detail:v.issue.detail,pluginName:HY}],pluginName:HY};throw v}}))}}}t(xCt,"rawRoutePlugin");import G6r from"fs/promises";import YLe from"path";var jde="runtime-config",DCt="runtime-config-plugin";function ACt(){return{name:jde,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:DCt,path:YLe.isAbsolute(s.path)?s.path:YLe.join(s.resolveDir,s.path),pluginName:jde})),a.onLoad({filter:/.*/,namespace:DCt},async s=>cf.timeFn("Generating zuplo.runtime.ts data",async()=>{let c="export const runtimeInit = undefined;",f=[];return await du.fileExists(s.path)?(c=await G6r.readFile(s.path,"utf-8"),{contents:c,loader:"ts",resolveDir:YLe.dirname(s.path),errors:f,pluginName:jde,watchFiles:[s.path]}):{contents:c,loader:"ts",errors:f,pluginName:jde}}))}}}t(ACt,"runtimeConfigPlugin");var wCt=jp(GLe(),1),PCt=jp(QLe(),1);import eRe from"fs/promises";import X7 from"path";var XLe="schema-validation-plugin",kCt="schema-validation",Q6r="module.exports = {}";function NCt(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/ajv-schema.json$/},c=>({namespace:kCt,path:c.path,pluginName:XLe})),s.onLoad({filter:/.*/,namespace:kCt},async c=>cf.timeFn("Validating schemas",async()=>{let f=X7.resolve(a.sourceDirectory,DS,"policies.json");if(!await du.fileExists(f))return{contents:Q6r,loader:"js",resolveDir:X7.dirname(c.path),pluginName:XLe};let d=await Y6r(a.sourceDirectory),v=X7.resolve(a.sourceDirectory,DS),E=await GF(v),A=await t4r(E,d),O=await K6r({oasFiles:E,routesWithSchemaValidation:A,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Mh.DEBUG_BUILD_MODE&&O){let R=X7.join(a.sourceDirectory,".zuplo","schema-validation.js");await hk(R,O)}return{contents:O,loader:"js",resolveDir:X7.dirname(c.path),pluginName:XLe}}))}}}t(NCt,"schemaValidationPlugin");async function K6r({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:c,logger:f}){let d="",v=new PN(c,f);if(s.length===0)return d;let E=new wCt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let A of a){let O=await eRe.readFile(A,"utf-8"),R=X7.basename(A,".oas.json"),W=s.filter(Se=>Se.fileName===R),$=await v.resolve(A),K=JSON.parse(O),Ne=[],De=new Map;W.forEach(Se=>{let Ct=K.paths[Se.path][Se.method];if(Ct.requestBody){let Tt;if(Ct.requestBody.$ref){let br=Ct.requestBody.$ref;Tt=$.get(br)?.content}else Ct.requestBody.content&&(Tt=Ct.requestBody.content);if(Tt)for(let br in Tt){let Cr=Tt[br].schema,Lr=n8e(Se.path,Se.method,br);Cr.$id=Lr,E.addSchema(Cr),ZLe(Cr,A,R,E,$,Ne,De)}}if(Ct.parameters)for(let Tt of Ct.parameters){let br=Tt.$ref?$.get(Tt.$ref):Tt,Cr=br.schema.$ref?$.get(br.schema.$ref):br.schema,Lr=r8e(Se.path,Se.method,br.in,br.name);Cr.$id=Lr,E.addSchema(Cr),ZLe(br,A,R,E,$,Ne,De)}});for(let Se of Ne){let Ct=$.get(Se),Tt=ZQ(R,Se);E.addSchema(Ct,Tt)}}return d=(0,PCt.default)(E),d}t(K6r,"schemaValidationSource");function ZLe(a,s,c,f,d,v,E){for(let A in a){let O=a[A];if(A==="$ref"){let R=ZQ(c,SN(s,O));a[A]=R,FQ(s,c,SN(s,O),d,v,E,(W,$)=>ZQ(W,SN(s,$)))}else typeof O=="object"&&ZLe(O,s,c,f,d,v,E)}}t(ZLe,"addRefsToSchema");async function Y6r(a){let s=new Set(["RequestValidationInboundPolicy"]),c=await eRe.readFile(`${a}/config/policies.json`,"utf-8"),f=JSON.parse(c);return X6r(f,s)}t(Y6r,"getPolicyNamesUsingSchemaValidationPolicies");function X6r(a,s){let c=new Set;a.policies?.forEach(d=>{d.handler?.export&&s.has(d.handler.export)&&d.handler.module==="$import(@zuplo/runtime)"&&c.add(d.name)});let f=Z6r(a,c);return new Set([...c,...f])}t(X6r,"getPolicyNamesReferencingPolicyHandlers");function Z6r(a,s){let c=new Set;return a.policies?.forEach(f=>{f.handler?.export==="CompositeInboundPolicy"&&f.handler?.options?.policies?.forEach(d=>{s.has(d)&&c.add(f.name)})}),c}t(Z6r,"getCompositePoliciesContainingPolicy");function e4r(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let c=a["x-zuplo-route"].policies.inbound;if(c){for(let d of c)if(s.has(d))return!0}let f=a["x-zuplo-route"].policies.outbound;if(f){for(let d of f)if(s.has(d))return!0}return!1}t(e4r,"isPolicyPresentInOperation");async function t4r(a,s){let c=[];for(let f of a){let d=await eRe.readFile(f,"utf-8"),E=JSON.parse(d).paths;for(let A in E){let O=E[A];for(let R in O){let W=O[R];e4r(W,s)&&c.push({fileName:X7.basename(f,".oas.json"),path:A,method:R})}}}return c}t(t4r,"getRoutesContainingPolicies");import{mkdirSync as r4r,writeFileSync as n4r}from"fs";import i4r from"path";function ICt(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async c=>{if(c){let f=gU(a.sourceDirectory,c.metafile);r4r(a.outputDirectory,{recursive:!0}),n4r(i4r.join(a.outputDirectory,"modules.json"),JSON.stringify(f,null,2))}})}}}t(ICt,"writeModulesPlugin");var s4r=_1t("zuplo:core:build"),a4r=["workerd","worker","browser"],LCt=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],tRe.resolve(OCt(FCt(import.meta.url)),"..","..","..","node_modules"),tRe.resolve(OCt(FCt(import.meta.url)),"..","..","..","..","..","node_modules")];async function GY({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,logger:d,minify:v=!0,command:E,flags:A}){let O=tRe.join(a,que);s4r(`Building with node paths: ${LCt.join(", ")}`);let R=v&&E!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},W=Object.freeze({sourceDirectory:c,outputDirectory:s,cacheDirectory:f,logger:d,debugMode:Mh.DEBUG_BUILD_MODE,flags:A});return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:LCt,entryPoints:[O],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...R,external:[],logLevel:"silent",conditions:a4r,plugins:[i2t(W),p1t(W),CCt(W),xCt(W),NCt(W),ACt(),e2t(W),vCt(W),SCt(W),ICt(W)]}}t(GY,"getBaseESBuildConfig");var Z7="run-esbuild",MCt=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,buildId:d,logger:v,config:E,command:A,minify:O},{data:R}){v.debug("Running esbuild");let W=await GY({command:A,minify:O,systemDirectory:a,outputDirectory:s,cacheDirectory:f,sourceDirectory:c,logger:v,flags:E.flags}),$;try{if(!await sB(c))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");$=await RCt.build(W),R.set("metafile",$.metafile)}catch(De){if(v.error(De),De.errors||De.warnings)$=De;else if(De.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))$={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:Z7,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw De}$.errors.length>0&&$.errors.length>1&&($.errors.length=1);let{errors:K,warnings:Ne}=rRe({buildId:d,result:$});return{errors:K,warnings:Ne}},"runEsbuild");function rRe({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(f=>f.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:Mue,pluginName:f.pluginName||Z7}:{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:Mue,pluginName:f.pluginName||Z7}),errors:s.errors.map(f=>({location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:q3e,pluginName:f.pluginName||Z7})),metafile:s.metafile}}t(rRe,"esbuildResultToBuildResult");var o4r=t((a,s)=>{let c=s;if(s.includes(a)){let f=new RegExp(`.*(${a})`,"g");c=s.replace(f,"")}return c.match(/^(\/)?(\.\.(\/)?)+/)&&(c=c.replace(/^(\/)?(\.\.(\/)?)+/,"/")),c},"removePrefixFromString"),c4r=t((a,s)=>{let c=s;if(c.includes(a)){let f=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");c=c.replace(f,"")}return c},"cleanFilePathsInMessage"),jCt=t((a,s,c)=>{if(!a||a.length<=0)return a;let f=a.filter(d=>d.message!=='Could not resolve "@zuplo/runtime"');return f&&f.length>0&&f.forEach(d=>{try{d.location&&d.location.file&&(d.location.file=o4r(s,d.location.file)),d.location&&d.location.lineText&&d.location.lineText.includes("@zuplo/core/index.minified.js")&&(d.location.lineText=d.location.lineText.substring(0,200)+"...<Truncated>"),d.message=c4r(s,d.message),d.notes&&d.notes.length>0&&delete d.notes,d.text&&delete d.text,d.pluginName===""&&(d.pluginName=c)}catch{}}),f},"cleanDataOnBuildIssue");function BCt(a,s){let c=nRe.basename(s);a.errors&&(a.errors=jCt(a.errors,c,Z7)),a.warnings&&(a.warnings=jCt(a.warnings,c,Z7))}t(BCt,"formatBuildResult");var l4r=t(a=>nRe.basename(a).startsWith("."),"isHiddenOnUnix"),u4r=t((a,s=[])=>s.map(c=>c.startsWith(".")?c:`.${c}`).some(c=>a.endsWith(c)),"hasMatchingExtname");function KLe(a,s=[],c=!1){let f=[],d;if(!Bde.existsSync(a)){let v;if(PQ.hasMagic(a))v=a;else{let E=s.map(A=>A.startsWith(".")?A:`.${A}`).join("|");v=`${a}+(${E})`}if(f.push(...PQ.sync(v,{nodir:!0})),!f.length)throw Error(`Cannot find any files matching pattern "${a}"`);return f}try{if(d=Bde.statSync(a),d.isFile())return[a]}catch{return[]}return Bde.readdirSync(a).forEach(v=>{let E=nRe.join(a,v),A;try{if(A=Bde.statSync(E),A.isDirectory()){c&&f.push(...KLe(E,s,c));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!A.isFile()||!u4r(E,s)||l4r(E)||f.push(E)}),f}t(KLe,"lookupFiles");var e5=new Uue({level:process.env.FORCE_BUILD_COLORS?2:void 0}),aI=` ${e5.gray("|")} `;function iRe({output:a,buildId:s,runtimeVersion:c,compatibilityDate:f}){let d=["Building Zuplo API...",`${aI}Build ID: ${s}`,`${aI}Runtime Version: ${c}`];f&&d.push(`${aI}Compatibility Date: ${f}`),a.info(d.join(`
|
|
639
|
-
`))}t(iRe,"outputApiBuildStart");async function Ude(a,s,c){BCt(c,a),await Promise.all(c.warnings.map(async
|
|
639
|
+
`))}t(iRe,"outputApiBuildStart");async function Ude(a,s,c){BCt(c,a),await Promise.all(c.warnings.map(async d=>UCt(a,s,d))),await Promise.all(c.errors.map(async d=>UCt(a,s,d)));let f=process.env.CODEBUILD_BUILD_ID?new Date(new Date().getTime()+1):new Date;c.status==="Good"?s.info(e5.green("Build succeeded"),{timestamp:f}):c.status==="Warnings"?s.warn(e5.yellow("Build succeeded with warnings"),{timestamp:f}):c.status==="Failed"&&s.error(e5.red("Build failed."),{timestamp:f})}t(Ude,"outputBuildResult");async function UCt(a,s,c){let f=[],d=c.severity??"error",v=d==="error"?e5.red:e5.yellow,E=v(`${d.toUpperCase()}: ${c.message}${c.detail?`
|
|
640
640
|
${aI}${c.detail.toString().split(`
|
|
641
641
|
`).join(`
|
|
642
642
|
${aI}`)}`:""}`);f.push(E);let A=p4r(c.location??void 0);if(A&&f.push(`${aI}${v(`The error was found in the file: ${A}`)}`),c.location&&c.location.file&&c.location.column!==0&&c.location.line!==0)try{let O=_4r.join(a,c.location.file),R=await f4r(O,"utf-8"),W=(0,$Ct.codeFrameColumns)(R,{start:{line:c.location.line,column:c.location.column}},{highlightCode:!0,forceColor:!!process.env.FORCE_BUILD_COLORS,message:c.message,linesAbove:3,linesBelow:3});f.push(aI),f.push(W)}catch{}else c.location&&c.location.file&&f.push(e5.red(`${aI}File: ${c.location.file}:${c.location.line}:${c.location.column}`));f.push(""),c.severity==="warning"?s.warn(f.join(`
|
package/index.minified.js
CHANGED
|
@@ -641,7 +641,7 @@ ${jC.red(s)}`)}t(SZr,"outputCritical");function TZr(a,s,c){let f=c.sort((E,A)=>{
|
|
|
641
641
|
`;v+=O>1024?jC.red(L):O>300?jC.yellow(L):L}),a.info(v)}t(TZr,"outputFileTree");function CZr(a,s){if(s.length===0)return"";let c=Object.keys(s[0]).length,f=Array.from({length:c},(E,A)=>Math.max(...s.map(O=>String(Object.values(O)[A]).length))),v=s.map(E=>Object.values(E).map((A,O)=>String(A).padEnd(f[O])).join(" ")).join(`
|
|
642
642
|
`);a.info(v)}t(CZr,"outputTable");function fRe({output:a,buildId:s,runtimeVersion:c,compatibilityDate:f}){let d=["Building Zuplo API...",`${xk}Build ID: ${s}`,`${xk}Runtime Version: ${c}`];f&&d.push(`${xk}Compatibility Date: ${f}`),a.info(d.join(`
|
|
643
643
|
`))}t(fRe,"outputApiBuildStart");function EZr({output:a,buildId:s,compatibilityDate:c}){let f=["Building Developer Portal...",`${xk}Build ID: ${s}`];c&&f.push(`${xk}Compatibility Date: ${c}`),a.info(f.join(`
|
|
644
|
-
`))}t(EZr,"outputDevPortalBuildStart");async function $de(a,s,c){qCt(c,a),await Promise.all(c.warnings.map(async
|
|
644
|
+
`))}t(EZr,"outputDevPortalBuildStart");async function $de(a,s,c){qCt(c,a),await Promise.all(c.warnings.map(async d=>VCt(a,s,d))),await Promise.all(c.errors.map(async d=>VCt(a,s,d)));let f=process.env.CODEBUILD_BUILD_ID?new Date(new Date().getTime()+1):new Date;c.status==="Good"?s.info(jC.green("Build succeeded"),{timestamp:f}):c.status==="Warnings"?s.warn(jC.yellow("Build succeeded with warnings"),{timestamp:f}):c.status==="Failed"&&s.error(jC.red("Build failed."),{timestamp:f})}t($de,"outputBuildResult");async function VCt(a,s,c){let f=[],d=c.severity??"error",v=d==="error"?jC.red:jC.yellow,E=v(`${d.toUpperCase()}: ${c.message}${c.detail?`
|
|
645
645
|
${xk}${c.detail.toString().split(`
|
|
646
646
|
`).join(`
|
|
647
647
|
${xk}`)}`:""}`);f.push(E);let A=j4r(c.location??void 0);if(A&&f.push(`${xk}${v(`The error was found in the file: ${A}`)}`),c.location&&c.location.file&&c.location.column!==0&&c.location.line!==0)try{let O=M4r.join(a,c.location.file),L=await R4r(O,"utf-8"),W=(0,WCt.codeFrameColumns)(L,{start:{line:c.location.line,column:c.location.column}},{highlightCode:!0,forceColor:!!process.env.FORCE_BUILD_COLORS,message:c.message,linesAbove:3,linesBelow:3});f.push(xk),f.push(W)}catch{}else c.location&&c.location.file&&f.push(jC.red(`${xk}File: ${c.location.file}:${c.location.line}:${c.location.column}`));f.push(""),c.severity==="warning"?s.warn(f.join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/core",
|
|
3
|
-
"version": "6.39.
|
|
3
|
+
"version": "6.39.36",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"prettier": "^3.3.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@zuplo/graphql": "^6.39.
|
|
44
|
-
"@zuplo/otel": "^6.39.
|
|
45
|
-
"@zuplo/runtime": "^6.39.
|
|
43
|
+
"@zuplo/graphql": "^6.39.36",
|
|
44
|
+
"@zuplo/otel": "^6.39.36",
|
|
45
|
+
"@zuplo/runtime": "^6.39.36"
|
|
46
46
|
}
|
|
47
47
|
}
|