@zuplo/core 6.51.52 → 6.51.53
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/package.json +5 -4
- package/zeno.js +29 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/core",
|
|
3
|
-
"version": "6.51.
|
|
3
|
+
"version": "6.51.53",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"customer.cli.minified.js",
|
|
29
|
+
"zeno.js",
|
|
29
30
|
"index.d.ts",
|
|
30
31
|
"index.minified.js",
|
|
31
32
|
"index.minified.js.LEGAL.txt",
|
|
@@ -40,9 +41,9 @@
|
|
|
40
41
|
"prettier": "^3.5.3"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
|
-
"@zuplo/graphql": "^6.51.
|
|
44
|
-
"@zuplo/otel": "^6.51.
|
|
45
|
-
"@zuplo/runtime": "^6.51.
|
|
44
|
+
"@zuplo/graphql": "^6.51.53",
|
|
45
|
+
"@zuplo/otel": "^6.51.53",
|
|
46
|
+
"@zuplo/runtime": "^6.51.53",
|
|
46
47
|
"deno": "2.3.1"
|
|
47
48
|
}
|
|
48
49
|
}
|
package/zeno.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Zuplo, Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This software and associated documentation files (the "Software") is intended to be used
|
|
6
|
+
* only by Zuplo customers solely to develop and test applications that will be deployed
|
|
7
|
+
* to Zuplo hosted services. You and others in your organization may use these files on your
|
|
8
|
+
* Development Devices solely for the above stated purpose.
|
|
9
|
+
*
|
|
10
|
+
* Outside of uses stated above, no license is granted for any other purpose including
|
|
11
|
+
* without limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
12
|
+
* sublicense, host, and/or sell copies of the Software.
|
|
13
|
+
*
|
|
14
|
+
* The software may include third party components with separate legal notices or governed by
|
|
15
|
+
* other agreements, as described in licenses either embedded in or accompanying the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
18
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
19
|
+
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
|
20
|
+
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
21
|
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
22
|
+
* DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*--------------------------------------------------------------------------------------------*/
|
|
24
|
+
|
|
25
|
+
var ge=Object.defineProperty;var o=(r,e)=>ge(r,"name",{value:e,configurable:!0});import{scheduler as he}from"node:timers/promises";Object.defineProperty(globalThis,"scheduler",{value:he,writable:!1,enumerable:!0,configurable:!1});function G(r){let e=0;for(let i of r)e+=i.length;let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}o(G,"concat");var L=new TextEncoder,Z=new TextDecoder,Ae=42,xe=124,Ce=40,ye=33,Re=35,Ee=36,be=44,we=45,Pe=58,_e=37,Se=95,Oe=62,Te=126,ve=43,ke=61,U=L.encode(`\r
|
|
26
|
+
`),Le=L.encode("*"),Ne=L.encode("$");function V(r){let e=[Le,L.encode(r.length.toString()),U];for(let t of r){let n=t instanceof Uint8Array?t:L.encode(t.toString());e.push(Ne,L.encode(n.byteLength.toString()),U,n,U)}return G(e)}o(V,"createRequest");async function*De(r){let e=new Uint8Array;for await(let t of r){e=G([e,t]);let n;for(;(n=e.indexOf(U[0]))!==-1&&e[n+1]===U[1];)yield e.subarray(0,n),e=e.subarray(n+2)}}o(De,"readLines");function D(r,e,t=!1){return Array.fromAsync({length:e},()=>H(r,t))}o(D,"readNReplies");function C(r){return Z.decode(r.slice(1))}o(C,"parseLine");function Ue(r){let e=[];for(let t=0;t<r.length;t+=2)e.push(r.slice(t,t+2));return e}o(Ue,"chunk");async function H(r,e=!1){let{value:t}=await r.next();switch(t[0]){case Ae:case Oe:{let n=Number(C(t));return n===-1?null:await D(r,n)}case xe:{let n=Number(C(t))*2;return await D(r,n),H(r,e)}case Ce:return BigInt(C(t));case ye:{let{value:n}=await r.next();return Promise.reject(Z.decode(n))}case Re:return C(t)==="t";case Ee:case ke:return C(t)==="-1"?null:H(r,e);case be:case Pe:switch(C(t)){case"inf":return 1/0;case"-inf":return-1/0;default:return Number(C(t))}case we:return Promise.reject(C(t));case _e:{let n=Number(C(t))*2,i=await D(r,n);return Object.fromEntries(Ue(i))}case Se:return null;case Te:return new Set(await D(r,Number(C(t)),e));case ve:return C(t);default:return e?t:Z.decode(t)}}o(H,"readReply");var W=class{static{o(this,"RedisClient")}#t;#r;#e=Promise.resolve();constructor(e){this.#t=e.writable.getWriter(),this.#r=De(e.readable)}#o(e){return this.#e=this.#e.then(e),this.#e}sendCommand(e,t=!1){return this.#o(()=>(this.#t.write(V(e)),H(this.#r,t)))}writeCommand(e){return this.#o(()=>this.#t.write(V(e)))}async*readReplies(e=!1){for(;;)yield H(this.#r,e)}pipelineCommands(e,t=!1){return this.#o(()=>{let n=G(e.map(V));return this.#t.write(n),D(this.#r,e.length,t)})}};var He=/^\s*(?:export\s+)?(?<key>[^\s=#]+?)\s*=[\ \t]*('\r?\n?(?<notInterpolated>(.|\r\n|\n)*?)\r?\n?'|"\r?\n?(?<interpolated>(.|\r\n|\n)*?)\r?\n?"|(?<unquoted>[^\r\n#]*)) *#*.*$/gm,Ie=/^[a-zA-Z_][a-zA-Z0-9_]*$/,ne=/(\${(?<inBrackets>.+?)(\:-(?<inBracketsDefault>.+))?}|(?<!\\)\$(?<notInBrackets>\w+)(\:-(?<notInBracketsDefault>.+))?)/g;function Fe(r){let e={"\\n":`
|
|
27
|
+
`,"\\r":"\r","\\t":" "};return r.replace(/\\([nrt])/g,t=>e[t]??"")}o(Fe,"expandCharacters");function X(r,e){return ne.test(r)?X(r.replace(ne,function(...t){let{inBrackets:n,inBracketsDefault:i,notInBrackets:a,notInBracketsDefault:c}=t[t.length-1],l=n||a,f=i||c,s=e[l];return s===void 0&&(s=Deno.env.get(l)),s===void 0?X(f,e):s}),e):r}o(X,"expand");function ie(r){let e={},t,n=[];for(;(t=He.exec(r))!==null;){let{key:a,interpolated:c,notInterpolated:l,unquoted:f}=t?.groups;if(!Ie.test(a)){console.warn(`Ignored the key "${a}" as it is not a valid identifier: The key need to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.`);continue}f&&n.push(a),e[a]=typeof l=="string"?l:typeof c=="string"?Fe(c):f.trim()}let i={...e};return n.forEach(a=>{e[a]=X(e[a],i)}),e}o(ie,"parse");async function K(r={}){let{envPath:e=".env",export:t=!1}=r,n=e?await $e(e):{};if(t)for(let[i,a]of Object.entries(n))Deno.env.get(i)===void 0&&Deno.env.set(i,a);return n}o(K,"load");async function $e(r){try{return ie(await Deno.readTextFile(r))}catch(e){if(e instanceof Deno.errors.NotFound)return{};throw e}}o($e,"parseFile");var d=globalThis.Deno?.build.os==="windows"||globalThis.navigator?.platform?.startsWith("Win")||globalThis.process?.platform?.startsWith("win")||!1;function m(r){if(typeof r!="string")throw new TypeError(`Path must be a string, received "${JSON.stringify(r)}"`)}o(m,"assertPath");function y(r){return r===47}o(y,"isPosixPathSeparator");function u(r){return r===47||r===92}o(u,"isPathSeparator");function _(r){return r>=97&&r<=122||r>=65&&r<=90}o(_,"isWindowsDeviceRoot");function j(r){if(m(r),r.length===0)return"."}o(j,"assertArg");function N(r,e,t,n){let i="",a=0,c=-1,l=0,f;for(let s=0;s<=r.length;++s){if(s<r.length)f=r.charCodeAt(s);else{if(n(f))break;f=47}if(n(f)){if(!(c===s-1||l===1))if(c!==s-1&&l===2){if(i.length<2||a!==2||i.charCodeAt(i.length-1)!==46||i.charCodeAt(i.length-2)!==46){if(i.length>2){let p=i.lastIndexOf(t);p===-1?(i="",a=0):(i=i.slice(0,p),a=i.length-1-i.lastIndexOf(t)),c=s,l=0;continue}else if(i.length===2||i.length===1){i="",a=0,c=s,l=0;continue}}e&&(i.length>0?i+=`${t}..`:i="..",a=2)}else i.length>0?i+=t+r.slice(c+1,s):i=r.slice(c+1,s),a=s-c-1;c=s,l=0}else f===46&&l!==-1?++l:l=-1}return i}o(N,"normalizeString");function M(r){j(r);let e=y(r.charCodeAt(0)),t=y(r.charCodeAt(r.length-1));return r=N(r,!e,"/",y),r.length===0&&!e&&(r="."),r.length>0&&t&&(r+="/"),e?`/${r}`:r}o(M,"normalize");function Y(...r){if(r.length===0)return".";r.forEach(t=>m(t));let e=r.filter(t=>t.length>0).join("/");return e===""?".":M(e)}o(Y,"join");function z(r){j(r);let e=r.length,t=0,n,i=!1,a=r.charCodeAt(0);if(e>1)if(u(a))if(i=!0,u(r.charCodeAt(1))){let l=2,f=l;for(;l<e&&!u(r.charCodeAt(l));++l);if(l<e&&l!==f){let s=r.slice(f,l);for(f=l;l<e&&u(r.charCodeAt(l));++l);if(l<e&&l!==f){for(f=l;l<e&&!u(r.charCodeAt(l));++l);if(l===e)return`\\\\${s}\\${r.slice(f)}\\`;l!==f&&(n=`\\\\${s}\\${r.slice(f,l)}`,t=l)}}}else t=1;else _(a)&&r.charCodeAt(1)===58&&(n=r.slice(0,2),t=2,e>2&&u(r.charCodeAt(2))&&(i=!0,t=3));else if(u(a))return"\\";let c;return t<e?c=N(r.slice(t),!i,"\\",u):c="",c.length===0&&!i&&(c="."),c.length>0&&u(r.charCodeAt(e-1))&&(c+="\\"),n===void 0?i?c.length>0?`\\${c}`:"\\":c:i?c.length>0?`${n}\\${c}`:`${n}\\`:n+c}o(z,"normalize");function Q(...r){if(r.forEach(a=>m(a)),r=r.filter(a=>a.length>0),r.length===0)return".";let e=!0,t=0,n=r[0];if(u(n.charCodeAt(0))){++t;let a=n.length;a>1&&u(n.charCodeAt(1))&&(++t,a>2&&(u(n.charCodeAt(2))?++t:e=!1))}let i=r.join("\\");if(e){for(;t<i.length&&u(i.charCodeAt(t));++t);t>=2&&(i=`\\${i.slice(t)}`)}return z(i)}o(Q,"join");function k(...r){return d?Q(...r):Y(...r)}o(k,"join");function it(r){if(r.length>=255)throw new TypeError("Alphabet too long");let e=new Uint8Array(256);for(let s=0;s<e.length;s++)e[s]=255;for(let s=0;s<r.length;s++){let p=r.charAt(s),g=p.charCodeAt(0);if(e[g]!==255)throw new TypeError(p+" is ambiguous");e[g]=s}let t=r.length,n=r.charAt(0),i=Math.log(t)/Math.log(256),a=Math.log(256)/Math.log(t);function c(s){if(s instanceof Uint8Array||(ArrayBuffer.isView(s)?s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength):Array.isArray(s)&&(s=Uint8Array.from(s))),!(s instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(s.length===0)return"";let p=0,g=0,h=0,E=s.length;for(;h!==E&&s[h]===0;)h++,p++;let b=(E-h)*a+1>>>0,A=new Uint8Array(b);for(;h!==E;){let P=s[h],x=0;for(let S=b-1;(P!==0||x<g)&&S!==-1;S--,x++)P+=256*A[S]>>>0,A[S]=P%t>>>0,P=P/t>>>0;if(P!==0)throw new Error("Non-zero carry");g=x,h++}let w=b-g;for(;w!==b&&A[w]===0;)w++;let F=n.repeat(p);for(;w<b;++w)F+=r.charAt(A[w]);return F}o(c,"encode");function l(s){if(typeof s!="string")throw new TypeError("Expected String");if(s.length===0)return new Uint8Array;let p=0,g=0,h=0;for(;s[p]===n;)g++,p++;let E=(s.length-p)*i+1>>>0,b=new Uint8Array(E);for(;p<s.length;){let P=s.charCodeAt(p);if(P>255)return;let x=e[P];if(x===255)return;let S=0;for(let $=E-1;(x!==0||S<h)&&$!==-1;$--,S++)x+=t*b[$]>>>0,b[$]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");h=S,p++}let A=E-h;for(;A!==E&&b[A]===0;)A++;let w=new Uint8Array(g+(E-A)),F=g;for(;A!==E;)w[F++]=b[A++];return w}o(l,"decodeUnsafe");function f(s){let p=l(s);if(p)return p;throw new Error("Non-base"+t+" character")}return o(f,"decode"),{encode:c,decodeUnsafe:l,decode:f}}o(it,"base");var ae=it;var st="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",le=ae(st);var ee=class{static{o(this,"ZenoLogger")}prefix="[ZENO]:";logLevel;constructor(e="info"){this.logLevel=e}debug(...e){this.shouldLog("debug")&&console.debug(this.prefix,"[DEBUG]",...e)}info(...e){this.shouldLog("info")&&console.info(this.prefix,"[INFO]",...e)}warn(...e){this.shouldLog("warn")&&console.warn(this.prefix,"[WARN]",...e)}error(...e){this.shouldLog("error")&&console.error(this.prefix,"[ERROR]",...e)}shouldLog(e){let t=["debug","info","warn","error"],n=t.indexOf(this.logLevel);return t.indexOf(e)>=n}setLogLevel(e){this.logLevel=e}},R=new ee;async function ce(r){let e={};for(let[t,n]of Object.entries(Deno.env.toObject()))n!==void 0&&(e[t]=n);try{let t=k(r,".env.zuplo"),n=await K({envPath:t,export:!0});for(let[i,a]of Object.entries(n))if(e[i]=a,i==="ZUPLO_SYSTEM_CONFIGURATIONS")try{let c=new TextDecoder().decode(le.decode(a)),l=JSON.parse(c);for(let[f,s]of Object.entries(l))e[f]=String(s)}catch(c){R.error("Failed to parse ZUPLO_SYSTEM_CONFIGURATIONS from .env.zuplo:",c)}}catch(t){R.error("Error loading .env.zuplo:",t)}try{let t=k(r,".env"),n=await K({envPath:t,export:!0});for(let[i,a]of Object.entries(n))e[i]=a}catch(t){console.error("Error loading .env:",t)}for(let[t,n]of Object.entries(e))n===void 0&&delete e[t];return e}o(ce,"loadEnvironment");function fe(r){return r?["true","1","yes","y"].includes(r.toLowerCase()):!1}o(fe,"parseEnvBool");var te=class{static{o(this,"CacheStorage")}#t;constructor(){this.#t=new Map}async open(e){let t=this.#t.get(e);return t||(t=new re,this.#t.set(e,t)),t}async has(e){return this.#t.has(e)}async delete(e){throw new Error("caches.delete is not supported")}};async function at(){let r=Deno.env.get("ZUPLO_CACHE_REDIS_HOSTNAME");if(r===void 0)throw new Error("ZUPLO_CACHE_REDIS_HOSTNAME is not set");let e=parseInt(Deno.env.get("ZUPLO_CACHE_REDIS_PORT")||"6379"),t=await Deno.connect({hostname:r,port:e});return new W(t)}o(at,"getRedisClient");function lt(r){let e={};return r&&r.split(",").forEach(n=>{let[i,a]=n.trim().split("=");e[i.toLowerCase()]=a?a.trim():!0}),e}o(lt,"parseHeaderValue");function ct(r){let e={};for(let[t,n]of r.entries())e[t]=n;return e}o(ct,"objectifyHeaders");async function ft(r){let e=await r.arrayBuffer(),t=new Uint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return btoa(n)}o(ft,"serializeResponseBody");function pt(r){let e=atob(r),t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return n}o(pt,"deserializeResponseBody");var re=class{static{o(this,"Cache")}#t;#r;#e;constructor(e="default",t={}){this.#t=e;let n=Deno.env.get("ZUPLO_CACHE_REDIS_HOSTNAME")&&Deno.env.get("ZUPLO_CACHE_REDIS_PORT");this.#r=!n||!fe(Deno.env.get("USE_ZENO_ZONE_CACHE")),this.#e=t.getRedisClient||at}#o(e){return`${this.#t}:${e.url}`}async match(e,t){if(this.#r)return;let n=this.#o(e),i=await this.#e();await i.sendCommand(["HELLO",3]);let a=await i.sendCommand(["TTL",n]);if(a!==-2){if(a<2)return;{let c=await i.sendCommand(["HGETALL",n]),l=c.status,f=c.status,s=new Headers(JSON.parse(c.headers));return new Response(pt(c.body),{status:l,statusText:f,headers:s})}}}async put(e,t){if(this.#r)return;let n=1*60*60,i=lt(t.headers.get("cache-control")),a=parseInt(i["s-maxage"]),c=parseInt(i["max-age"]),l=i["no-store"],f=i["no-cache"],s=a||c||0;if(s===0&&!l&&!f&&(s=n,t.headers.append("cache-control",`s-maxage=${n}`)),s>0){let p=this.#o(e),g=await this.#e();await g.sendCommand(["HELLO",3]),await g.sendCommand(["HSET",p,"maxage",s,"status",t.status,"statusText",t.statusText,"headers",JSON.stringify(ct(t.headers)),"body",await ft(t)]),await g.sendCommand(["EXPIRE",p,s])}}async delete(e){if(this.#r)return;let t=this.#o(e);if(await(await this.#e()).sendCommand(["DEL",t])!==1)throw new Error("Failed to delete cache entry")}},ut=new te;Object.defineProperty(globalThis,"caches",{value:ut,writable:!1,enumerable:!0,configurable:!1});var J=class{static{o(this,"WorkerServer")}#t;#r;#e=o(()=>({waitUntil:o(e=>{e.catch(t=>{console.error("Error in waitUntil:",t)})},"waitUntil")}),"#createContext");constructor(e){this.#r=e}async start(){let{port:e,workerModule:t,env:n}=this.#r;this.#t=Deno.serve({port:e,onListen:o(()=>{R.debug(`Server running at http://localhost:${e}`)},"onListen")},async i=>{try{return await t.default.fetch(i,n,this.#e())}catch(a){return R.error("Error handling request:",a),new Response("Internal Server Error",{status:500})}}),await this.#t.finished}async stop(){await this.#t?.shutdown()}};var dt="./dist/worker.js";function mt(){if(Deno.build.standalone)return"../dist/worker.js";let r=Deno.cwd();return k(r,dt)}o(mt,"getDefaultWorkerPath");var gt=mt();function ht(r){return typeof r=="object"&&r!==null&&"default"in r&&typeof r.default=="object"&&"fetch"in r.default&&typeof r.default.fetch=="function"}o(ht,"isWorkerModule");async function pe(r=gt){R.debug("Loading worker module from: ",r);let e=await import(r);if(!ht(e))throw new Error("Invalid worker module");return e}o(pe,"importWorkerModule");function ue(){console.log("Enabling fetch host override.");let r=globalThis.fetch,e=Deno.createHttpClient({allowHost:!0,http2:!1});return globalThis.fetch=async(t,n={})=>await r(t,{...n,client:e}),e}o(ue,"setFetchHostOverride");function de(r){if(new.target)throw new TypeError("Cannot create an instance: parse is not a constructor");return new oe(r).parse()}o(de,"parse");var oe=class{static{o(this,"JsoncParser")}#t=new Set(` \r
|
|
28
|
+
`);#r=new Set([..."[]{}:,/",...this.#t]);#e;#o;#i;constructor(e){this.#e=`${e}`,this.#o=this.#e.length,this.#i=this.#l()}parse(){let e=this.#n(),t=this.#s(e),{done:n,value:i}=this.#i.next();if(!n)throw new SyntaxError(v(i));return t}#n(){let{done:e,value:t}=this.#i.next();if(e)throw new SyntaxError("Cannot parse JSONC: unexpected end of JSONC input");return t}*#l(){for(let e=0;e<this.#o;e++)if(!this.#t.has(this.#e[e])){if(this.#e[e]==="/"&&this.#e[e+1]==="*"){e+=2;let t=!1;for(;e<this.#o;e++)if(this.#e[e]==="*"&&this.#e[e+1]==="/"){t=!0;break}if(!t)throw new SyntaxError("Cannot parse JSONC: unexpected end of JSONC input");e++;continue}if(this.#e[e]==="/"&&this.#e[e+1]==="/"){for(e+=2;e<this.#o&&!(this.#e[e]===`
|
|
29
|
+
`||this.#e[e]==="\r");e++);continue}switch(this.#e[e]){case"{":yield{type:"BeginObject",position:e};break;case"}":yield{type:"EndObject",position:e};break;case"[":yield{type:"BeginArray",position:e};break;case"]":yield{type:"EndArray",position:e};break;case":":yield{type:"NameSeparator",position:e};break;case",":yield{type:"ValueSeparator",position:e};break;case'"':{let t=e,n=!1;for(e++;e<this.#o&&!(this.#e[e]==='"'&&!n);e++)n=this.#e[e]==="\\"&&!n;yield{type:"String",sourceText:this.#e.substring(t,e+1),position:t};break}default:{let t=e;for(;e<this.#o&&!this.#r.has(this.#e[e]);e++);e--,yield{type:"NullOrTrueOrFalseOrNumber",sourceText:this.#e.substring(t,e+1),position:t}}}}}#s(e){switch(e.type){case"BeginObject":return this.#c();case"BeginArray":return this.#f();case"NullOrTrueOrFalseOrNumber":return this.#p(e);case"String":return this.#a(e);default:throw new SyntaxError(v(e))}}#c(){let e={};for(;;){let t=this.#n();if(t.type==="EndObject")return e;if(t.type!=="String")throw new SyntaxError(v(t));let n=this.#a(t),i=this.#n();if(i.type!=="NameSeparator")throw new SyntaxError(v(i));let a=this.#n();Object.defineProperty(e,n,{value:this.#s(a),writable:!0,enumerable:!0,configurable:!0});let c=this.#n();if(c.type==="EndObject")return e;if(c.type!=="ValueSeparator")throw new SyntaxError(v(c))}}#f(){let e=[];for(;;){let t=this.#n();if(t.type==="EndArray")return e;e.push(this.#s(t));let n=this.#n();if(n.type==="EndArray")return e;if(n.type!=="ValueSeparator")throw new SyntaxError(v(n))}}#a(e){let t;try{t=JSON.parse(e.sourceText)}catch{throw new SyntaxError(v(e))}if(typeof t!="string")throw new TypeError(`Parsed value is not a string: ${t}`);return t}#p(e){if(e.sourceText==="null")return null;if(e.sourceText==="true")return!0;if(e.sourceText==="false")return!1;let t;try{t=JSON.parse(e.sourceText)}catch{throw new SyntaxError(v(e))}if(typeof t!="number")throw new TypeError(`Parsed value is not a number: ${t}`);return t}};function v({type:r,sourceText:e,position:t}){let n="";switch(r){case"BeginObject":n="{";break;case"EndObject":n="}";break;case"BeginArray":n="[";break;case"EndArray":n="]";break;case"NameSeparator":n=":";break;case"ValueSeparator":n=",";break;case"NullOrTrueOrFalseOrNumber":case"String":n=30<e.length?`${e.slice(0,30)}...`:e;break}return`Cannot parse JSONC: unexpected token "${n}" in JSONC at position ${t}`}o(v,"buildErrorMessage");var At="zuplo.jsonc";function me(r){let e=k(r,At),t=Deno.readTextFileSync(e),n=de(t);if(n!==null&&typeof n=="object"&&"managedDedicatedFlags"in n)return n.managedDedicatedFlags}o(me,"getManagedDedicatedSettings");async function xt(){let r;R.debug("Starting Zeno server...");try{let e=await pe(),t=await ce(Deno.cwd());me(Deno.cwd())?.allowFetchHostHeaderOverride&&(r=ue()),await new J({port:9e3,workerModule:e,env:t}).start()}catch(e){R.error("Failed to start server:",e)}finally{r&&r.close()}}o(xt,"main");import.meta.main&&await xt();export{xt as main};
|