@zuplo/cli 7.14.8 → 7.15.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.
Files changed (40) hide show
  1. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/decrypt.js +3 -2
  2. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  3. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jws/general/verify.js +2 -8
  4. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +11 -8
  5. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key_management.js +0 -1
  6. package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
  7. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/decrypt.js +3 -2
  8. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  9. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jws/general/verify.js +2 -8
  10. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +11 -8
  11. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key_management.js +0 -1
  12. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
  13. package/node_modules/@zuplo/core/package.json +1 -1
  14. package/node_modules/@zuplo/core/zeno.js +1 -1
  15. package/node_modules/@zuplo/graphql/package.json +1 -1
  16. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  17. package/node_modules/@zuplo/otel/package.json +1 -1
  18. package/node_modules/@zuplo/runtime/out/esm/{chunk-DB6LKZ36.js → chunk-F4G3YEN2.js} +3 -3
  19. package/node_modules/@zuplo/runtime/out/esm/{chunk-PY52EHDX.js → chunk-GWGCD6Z7.js} +2 -2
  20. package/node_modules/@zuplo/runtime/out/esm/{chunk-SNTU476S.js → chunk-HTXNM72E.js} +2 -2
  21. package/node_modules/@zuplo/runtime/out/esm/chunk-M4IZPJP6.js +37 -0
  22. package/node_modules/@zuplo/runtime/out/esm/{chunk-2HVCLUM4.js.map → chunk-M4IZPJP6.js.map} +1 -1
  23. package/node_modules/@zuplo/runtime/out/esm/{chunk-6R2COTV6.js → chunk-SX6JF7A6.js} +2 -2
  24. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  25. package/node_modules/@zuplo/runtime/out/esm/mcp/messages/index.js +1 -1
  26. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  27. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  28. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
  29. package/node_modules/@zuplo/runtime/package.json +1 -1
  30. package/node_modules/ansi-regex/index.js +22 -17
  31. package/node_modules/ansi-regex/package.json +1 -1
  32. package/node_modules/ansi-regex/readme.md +8 -0
  33. package/package.json +11 -11
  34. package/node_modules/@zuplo/runtime/out/esm/chunk-2HVCLUM4.js +0 -37
  35. /package/node_modules/@zuplo/runtime/out/esm/{chunk-DB6LKZ36.js.LEGAL.txt → chunk-F4G3YEN2.js.LEGAL.txt} +0 -0
  36. /package/node_modules/@zuplo/runtime/out/esm/{chunk-DB6LKZ36.js.map → chunk-F4G3YEN2.js.map} +0 -0
  37. /package/node_modules/@zuplo/runtime/out/esm/{chunk-PY52EHDX.js.map → chunk-GWGCD6Z7.js.map} +0 -0
  38. /package/node_modules/@zuplo/runtime/out/esm/{chunk-SNTU476S.js.map → chunk-HTXNM72E.js.map} +0 -0
  39. /package/node_modules/@zuplo/runtime/out/esm/{chunk-2HVCLUM4.js.LEGAL.txt → chunk-M4IZPJP6.js.LEGAL.txt} +0 -0
  40. /package/node_modules/@zuplo/runtime/out/esm/{chunk-6R2COTV6.js.map → chunk-SX6JF7A6.js.map} +0 -0
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{G as p,M as c,Q as u}from"../chunk-DB6LKZ36.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-PY52EHDX.js";import"../chunk-A3QGJZO7.js";import"../chunk-6R2COTV6.js";import"../chunk-UKQQD2JN.js";import{aa as i}from"../chunk-2HVCLUM4.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
25
+ import{G as p,M as c,Q as u}from"../chunk-F4G3YEN2.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-GWGCD6Z7.js";import"../chunk-A3QGJZO7.js";import"../chunk-SX6JF7A6.js";import"../chunk-UKQQD2JN.js";import{aa as i}from"../chunk-M4IZPJP6.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
26
26
  //# sourceMappingURL=index.js.map
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-6R2COTV6.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-2HVCLUM4.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
25
+ import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-SX6JF7A6.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-M4IZPJP6.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
26
26
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.14.8",
4
+ "version": "7.15.0",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -1,24 +1,29 @@
1
- export default function ansiRegex({onlyFirst = false} = {}) {
2
- // Valid string terminator sequences are BEL, ESC\, and 0x9c
3
- const ST = String.raw`(?:\u0007|\u001B\u005C|\u009C)`;
1
+ // Valid string terminator sequences are ESC\ and 0x9c; OSC also accepts BEL.
2
+ const ST = String.raw`(?:\u001B\u005C|\u009C)`;
3
+
4
+ // OSC sequences only: ESC ] ... BEL/ST (or the C1 introducer 0x9d ... BEL/ST).
5
+ // Payloads stop at terminators, cancellations, and C1 controls. An unterminated string cannot swallow the next sequence or repeatedly scan its payload from later introducers. Terminals likewise abort a control string on an unexpected ESC.
6
+ const stringControls = String.raw`\u0018\u001A\u001B\u0080-\u009F`;
7
+ const osc = String.raw`(?:\u001B\]|\u009D)[^\u0007${stringControls}]*(?:\u0007|${ST})`;
4
8
 
5
- // OSC sequences only: ESC ] ... ST (or the C1 introducer 0x9d ... ST)
6
- // The payload stops at the first terminator character rather than scanning ahead for one, so an unterminated `ESC ]` cannot rescan the rest of the input. Terminals likewise abort a control string on an unexpected ESC. The payload also stops at 0x9d so an unterminated C1 OSC cannot swallow the next one.
7
- const osc = String.raw`(?:(?:\u001B\]|\u009D)[^\u0007\u001B\u009C\u009D]*${ST})`;
9
+ // DCS, SOS, PM, APC, and screen window titles have opaque payloads terminated by ST. Nested ESC payloads, such as tmux passthrough, require a parser.
10
+ const controlString = String.raw`(?:\u001B[PX^_k]|[\u0090\u0098\u009E\u009F])[^${stringControls}]*${ST}`;
8
11
 
9
- // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
10
- // The final byte class is deliberately narrow, so that ESC followed by an arbitrary character is not read as a sequence. It must
11
- // not include the parameter digits though: when the real final byte is outside the class the engine backtracks and takes the last
12
- // parameter digit as the final byte instead, leaving the real one behind as visible text. `ESC [ 5 d` stripped to a bare `d`.
13
- const csi = String.raw`[\u001B\u009B][[\]()#;?]*(?:\d{1,4}(?:[;:]\d{0,4})*)?[A-PR-TZcf-nq-uy=><~]`;
12
+ // Linux console palette controls have fixed lengths and no string terminator; iTerm2 terminates its palette assignments. Consume an immediately adjacent OSC terminator, but match these controls before OSC so a later BEL cannot consume visible text.
13
+ const linuxPalette = String.raw`\u001B\](?:P[\dA-Fa-f]{7}|R)(?:\u0007|${ST})?`;
14
14
 
15
- // `= < >` are final bytes in the two byte VT52 escapes (`ESC >`) but parameter bytes in a CSI
16
- // (`ESC [ > 0 ; 276 ; 0 c`, the device attributes reply). Matching them as a final byte always
17
- // wins and leaves the rest of the reply behind as visible text, so the private parameter form is
18
- // matched first, where the `[` makes the two unambiguous.
19
- const csiPrivate = String.raw`(?:\u001B\[|\u009B)[<=>][0-9;:]*[A-PR-TZcf-nq-uy~]`;
15
+ // CSI: ESC [ or C1 CSI, parameter bytes (0x30–0x3f), intermediate bytes (0x20–0x2f), then a final byte (0x40–0x7e).
16
+ // `= < >` are final bytes in two-byte VT52 escapes (`ESC >`) but parameter bytes in a CSI (`ESC [ > 0 ; 276 ; 0 c`, the device attributes reply). Match CSI first to consume the whole sequence, where its introducer makes the two unambiguous.
17
+ const csi = String.raw`(?:\u001B\[|\u009B)[\u0030-\u003F]*[\u0020-\u002F]*[\u0040-\u007E]`;
20
18
 
21
- const pattern = `${osc}|${csiPrivate}|${csi}`;
19
+ // Related escapes: ESC, intermediate bytes (0x20–0x2f), then a final byte (0x30–0x7e), or a supported two-byte escape.
20
+ // The two-byte final class stays narrow so that ESC followed by an arbitrary character is not read as a sequence. CSI parameters belong only to the CSI form, preventing partial matches and avoiding a second scan with nested repetition.
21
+ // Escapes whose final byte is a digit include `ESC 7` and `ESC 8` (save and restore cursor), `ESC ( 0` (line drawing character set), and `ESC # 8` (screen alignment).
22
+ // A digit is never a CSI final byte. These escapes end immediately at their final byte, so `ESC 7 l` is read as the escape followed by text rather than a sequence with parameter 7 and final byte `l`.
23
+ const escape = String.raw`\u001B(?:[\u0020-\u002F]+[\u0030-\u007E]|[\dA-PR-TZcf-oq-uy=><~|}])`;
22
24
 
25
+ const pattern = `${linuxPalette}|${osc}|${controlString}|${csi}|${escape}`;
26
+
27
+ export default function ansiRegex({onlyFirst = false} = {}) {
23
28
  return new RegExp(pattern, onlyFirst ? undefined : 'g');
24
29
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ansi-regex",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "Regular expression for matching ANSI escape codes",
5
5
  "license": "MIT",
6
6
  "repository": "chalk/ansi-regex",
@@ -54,6 +54,14 @@ If you run the regex against untrusted user input in a server context, you shoul
54
54
 
55
55
  ## FAQ
56
56
 
57
+ ### Which sequences are supported?
58
+
59
+ The regex matches complete CSI sequences, OSC strings, ST-terminated DCS/SOS/PM/APC strings, screen window-title strings, character-set and encoding selections, and common two-byte ESC controls. Both seven-bit escape sequences and their C1 equivalents are supported where applicable. Linux console palette controls are also supported.
60
+
61
+ Control-string payloads are opaque, so this includes terminal hyperlinks, shell integration, clipboard commands, editor queries, sixel images, and Kitty graphics without needing a list of individual commands. ESC, CAN, SUB, and C1 control characters delimit or interrupt a control string.
62
+
63
+ This is a matcher for contiguous terminal output sequences, not a terminal emulator. It does not reconstruct screen contents, decode terminal keyboard/mouse input, or handle nested escape payloads such as tmux passthrough. Incomplete or cancelled sequences are handled on a best-effort basis. Standalone control characters, including tabs, newlines, and BEL, are preserved.
64
+
57
65
  ### Why do you test for codes not in the ECMA 48 standard?
58
66
 
59
67
  Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "7.14.8",
3
+ "version": "7.15.0",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "type": "module",
@@ -31,10 +31,10 @@
31
31
  "@opentelemetry/api": "1.9.0",
32
32
  "@opentelemetry/api-logs": "0.220.0",
33
33
  "@swc/core": "1.10.18",
34
- "@zuplo/core": "7.14.8",
34
+ "@zuplo/core": "7.15.0",
35
35
  "@zuplo/editor": "1.0.39603386871",
36
- "@zuplo/openapi-tools": "7.14.8",
37
- "@zuplo/runtime": "7.14.8",
36
+ "@zuplo/openapi-tools": "7.15.0",
37
+ "@zuplo/runtime": "7.15.0",
38
38
  "chalk": "5.4.1",
39
39
  "chokidar": "3.5.3",
40
40
  "cookie": "1.0.2",
@@ -65,15 +65,15 @@
65
65
  "workerd": "1.20261002.1",
66
66
  "yargs": "17.7.2",
67
67
  "zod": "4.6.7",
68
- "@zuplo/graphql": "7.14.8",
69
- "@zuplo/otel": "7.14.8"
68
+ "@zuplo/graphql": "7.15.0",
69
+ "@zuplo/otel": "7.15.0"
70
70
  },
71
71
  "optionalDependencies": {
72
- "@zuplo/lint-darwin-arm64": "7.14.8",
73
- "@zuplo/lint-darwin-x64": "7.14.8",
74
- "@zuplo/lint-linux-x64": "7.14.8",
75
- "@zuplo/lint-linux-arm64": "7.14.8",
76
- "@zuplo/lint-win32-x64": "7.14.8"
72
+ "@zuplo/lint-darwin-arm64": "7.15.0",
73
+ "@zuplo/lint-darwin-x64": "7.15.0",
74
+ "@zuplo/lint-linux-x64": "7.15.0",
75
+ "@zuplo/lint-linux-arm64": "7.15.0",
76
+ "@zuplo/lint-win32-x64": "7.15.0"
77
77
  },
78
78
  "bundleDependencies": [
79
79
  "@inquirer/prompts",
@@ -1,37 +0,0 @@
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
- import{a as r}from"./chunk-TYV53J3B.js";var w=class extends Error{static{r(this,"SystemError")}constructor(t,n){super(t,n),this.name="InternalError"}},N=class extends TypeError{static{r(this,"NetworkError")}cause;constructor(t){super("The upstream request failed due to a network error.",{cause:t}),this.name="TypeError",this.cause=t}},A=class extends Error{static{r(this,"RuntimeError")}extensionMembers;constructor(t,n){typeof t=="string"?super(t,n):(super(t.message,n),this.extensionMembers=t.extensionMembers),this.name="RuntimeError"}},K=class extends A{static{r(this,"ConfigurationError")}constructor(t,n){super(t,n),this.name="ConfigurationError"}};var ht="zuplo-request-id",Ee="zp-rid",he="zp-body-removed",Re="cf-ray",Rt="x-forwarded-scheme",Ot="x-forwarded-proto",yt="x-scheme",Oe="cf-ipcity",ye="cf-ipcontinent",Ae="cf-ipcountry",Se="cf-iplongitude",Te="cf-iplatitude",At="cf-region",St="cf-region-code",Tt="cf-metro-code",bt="cf-postal-code",Pt="cf-timezone",Lt="zp-ipcity",Ct="zp-ipcontinent",xt="zp-ipcountry",It="zp-iplongitude",Ut="zp-iplatitude",X="x-real-ip",v="true-client-ip";var be="zp-client-cert",Pe="zp-mtls-status",Le="zp-mtls-failure-reason",Ce="zp-mtls-cert-fingerprint-sha256",xe="zp-mtls-cert-not-before",Ie="zp-mtls-cert-not-after",Ue="zp-mtls-cert-issuer-dn",we="zp-mtls-cert-subject-dn",Ne="zp-asn",Me="zp-asorg",De="zp-colo",ve="zp-postalcode",He="zp-metrocode",ze="zp-region",Fe="zp-regioncode",Ze="zp-timezone",wt="zp-http-protocol",H="zp-local-service",Ve="zp-gateway-api-key",ke="x-akamai-edgescape",Nt=[be,Pe,Le,Ce,xe,Ie,Ue,we,ke,H],Mt=[Oe,ye,Ae,Se,Te,Ne,Me,De,ve,He,ze,Fe,Ze],Dt=["zp-","cf-"],vt=[Ee,Re,he,Ve];var Ht="system-logger";var Be=!1;function P(e,t){return{open:`\x1B[${e.join(";")}m`,close:`\x1B[${t}m`,regexp:new RegExp(`\\x1b\\[${t}m`,"g")}}r(P,"code");function L(e,t){return Be?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}r(L,"run");function Ge(e){return L(e,P([31],39))}r(Ge,"red");function $e(e){return L(e,P([32],39))}r($e,"green");function je(e){return L(e,P([33],39))}r(je,"yellow");function Ye(e){return L(e,P([34],39))}r(Ye,"blue");function qe(e){return L(e,P([35],39))}r(qe,"magenta");function We(e){return L(e,P([36],39))}r(We,"cyan");var Ft=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 Q=[Ge,$e,je,Ye,qe,We];function Je(e){let t=0,n=e.length,i=0;if(n>0)for(;i<n;)t=(t<<5)-t+e.charCodeAt(i++)|0;return t}r(Je,"hashCode");function ee(e){let t=Math.abs(Je(e));return Q[t%Q.length]}r(ee,"generateColor");function te(e,t,...n){let i=0,o=n.length,c=String(t).replace(/%[sdjoO%]/g,s=>{if(s==="%%")return"%";if(i>=o)return s;switch(s){case"%s":return String(n[i++]);case"%d":return Number(n[i++]).toString();case"%o":return e(n[i++]).split(`
26
- `).map(l=>l.trim()).join(" ");case"%O":return e(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch{return"[Circular]"}default:return s}});for(let s of n.splice(i))s===null||!(typeof s=="object"&&s!==null)?c+=" "+s:c+=" "+e(s);return c}r(te,"format");function T(e,t,n,i){let o={seen:[],stylize:Ke,showHidden:t??!1,depth:n??2,colors:i??!1,customInspect:!0};return o.colors&&(o.stylize=Qe),M(o,e,o.depth)}r(T,"inspect");T.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};T.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function Ke(e,t){return e}r(Ke,"stylizeNoColor");function Xe(e){return typeof e=="boolean"}r(Xe,"isBoolean");function re(e){return e===void 0}r(re,"isUndefined");function Qe(e,t){let n=T.styles[t];return n?"\x1B["+T.colors[n][0]+"m"+e+"\x1B["+T.colors[n][1]+"m":e}r(Qe,"stylizeWithColor");function z(e){return typeof e=="function"}r(z,"isFunction");function oe(e){return typeof e=="string"}r(oe,"isString");function et(e){return typeof e=="number"}r(et,"isNumber");function ie(e){return e===null}r(ie,"isNull");function se(e,t){return Object.hasOwn(e,t)}r(se,"hasOwn");function F(e){return B(e)&&G(e)==="[object RegExp]"}r(F,"isRegExp");function B(e){return typeof e=="object"&&e!==null}r(B,"isObject");function Z(e){return B(e)&&(G(e)==="[object Error]"||e instanceof Error)}r(Z,"isError");function ne(e){return B(e)&&G(e)==="[object Date]"}r(ne,"isDate");function G(e){return Object.prototype.toString.call(e)}r(G,"objectToString");function tt(e){let t={};return e.forEach(function(n,i){t[n]=!0}),t}r(tt,"arrayToHash");function nt(e,t,n,i,o){let c=[];for(let s=0,l=t.length;s<l;++s)se(t,String(s))?c.push(k(e,t,n,i,String(s),!0)):c.push("");return o.forEach(function(s){s.match(/^\d+$/)||c.push(k(e,t,n,i,s,!0))}),c}r(nt,"formatArray");function V(e){return"["+Error.prototype.toString.call(e)+"]"}r(V,"formatError");function M(e,t,n){if(e.customInspect&&t&&z(t.inspect)&&t.inspect!==T&&!(t.constructor&&t.constructor.prototype===t)){let u=t.inspect(n,e);return oe(u)||(u=M(e,u,n)),u}let i=rt(e,t);if(i)return i;let o=Object.keys(t),c=tt(o);try{e.showHidden&&Object.getOwnPropertyNames&&(o=Object.getOwnPropertyNames(t))}catch{}if(Z(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return V(t);if(o.length===0){if(z(t)){let u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(F(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(ne(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Z(t))return V(t)}let s="",l=!1,p=["{","}"];if(Array.isArray(t)&&(l=!0,p=["[","]"]),z(t)&&(s=" [Function"+(t.name?": "+t.name:"")+"]"),F(t)&&(s=" "+RegExp.prototype.toString.call(t)),ne(t)&&(s=" "+Date.prototype.toUTCString.call(t)),Z(t)&&(s=" "+V(t)),o.length===0&&(!l||t.length==0))return p[0]+s+p[1];if(n<0)return F(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);let a;return l?a=nt(e,t,n,c,o):a=o.map(function(u){return k(e,t,n,c,u,l)}),e.seen.pop(),ot(a,s,p)}r(M,"formatValue");function k(e,t,n,i,o,c){let s,l,p;p={value:void 0};try{p.value=t[o]}catch{}try{Object.getOwnPropertyDescriptor&&(p=Object.getOwnPropertyDescriptor(t,o)||p)}catch{}if(p.get?p.set?l=e.stylize("[Getter/Setter]","special"):l=e.stylize("[Getter]","special"):p.set&&(l=e.stylize("[Setter]","special")),se(i,o)||(s="["+o+"]"),l||(e.seen.indexOf(p.value)<0?(ie(n)?l=M(e,p.value,null):l=M(e,p.value,n-1),l.indexOf(`
27
- `)>-1&&(c?l=l.split(`
28
- `).map(function(a){return" "+a}).join(`
29
- `).substr(2):l=`
30
- `+l.split(`
31
- `).map(function(a){return" "+a}).join(`
32
- `))):l=e.stylize("[Circular]","special")),re(s)){if(c&&o.match(/^\d+$/))return l;s=JSON.stringify(""+o),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+l}r(k,"formatProperty");function rt(e,t){if(re(t))return e.stylize("undefined","undefined");if(oe(t)){let n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(et(t))return e.stylize(""+t,"number");if(Xe(t))return e.stylize(""+t,"boolean");if(ie(t))return e.stylize("null","null")}r(rt,"formatPrimitive");function ot(e,t,n){let i=0;return e.reduce(function(c,s){return i++,s.indexOf(`
33
- `)>=0&&i++,c+s.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?n[0]+(t===""?"":t+`
34
- `)+" "+e.join(`,
35
- `)+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}r(ot,"reduceToSingleString");var ae=r((e,...t)=>te(T,e,t),"format");var $=class{static{r(this,"Debugger")}manager;ns;color;last;enabled;constructor(t,n){this.manager=t,this.ns=n,this.color=ee(n),this.last=0,this.enabled=t.enabled.some(i=>i.test(n))}log(...t){if(!this.enabled)return;let n,i=t[0];typeof i=="function"?n=i():n=String(i);let o=Date.now()-(this.last||Date.now());n=ae(n,...t);let c=`${this.color(this.ns)} ${n} ${this.color(`+${o}ms`)}`;console.log(c),this.last=Date.now()}},j=class{static{r(this,"DebugManager")}debuggers;enabled;constructor(t){this.debuggers=new Map,this.enabled=t??[]}};function it(e){return!e||e.length===0?[]:(e=e.replace(/\s/g,"").replace(/\*/g,".+"),e.split(",").map(t=>new RegExp(`^${t}$`)))}r(it,"extract");var D;function ce(e){let t=globalThis.DEBUG;D||(D=new j(it(t)));let n=new $(D,e);return D.debuggers.set(e,n),Object.assign(n.log.bind(n),{self:n})}r(ce,"debug");function st(e){if(e.length>=255)throw new TypeError("Alphabet too long");let t=new Uint8Array(256);for(let a=0;a<t.length;a++)t[a]=255;for(let a=0;a<e.length;a++){let u=e.charAt(a),E=u.charCodeAt(0);if(t[E]!==255)throw new TypeError(u+" is ambiguous");t[E]=a}let n=e.length,i=e.charAt(0),o=Math.log(n)/Math.log(256),c=Math.log(256)/Math.log(n);function s(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";let u=0,E=0,g=0,d=a.length;for(;g!==d&&a[g]===0;)g++,u++;let R=(d-g)*c+1>>>0,m=new Uint8Array(R);for(;g!==d;){let O=a[g],h=0;for(let S=R-1;(O!==0||h<E)&&S!==-1;S--,h++)O+=256*m[S]>>>0,m[S]=O%n>>>0,O=O/n>>>0;if(O!==0)throw new Error("Non-zero carry");E=h,g++}let f=R-E;for(;f!==R&&m[f]===0;)f++;let y=i.repeat(u);for(;f<R;++f)y+=e.charAt(m[f]);return y}r(s,"encode");function l(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;let u=0,E=0,g=0;for(;a[u]===i;)E++,u++;let d=(a.length-u)*o+1>>>0,R=new Uint8Array(d);for(;u<a.length;){let O=a.charCodeAt(u);if(O>255)return;let h=t[O];if(h===255)return;let S=0;for(let U=d-1;(h!==0||S<g)&&U!==-1;U--,S++)h+=n*R[U]>>>0,R[U]=h%256>>>0,h=h/256>>>0;if(h!==0)throw new Error("Non-zero carry");g=S,u++}let m=d-g;for(;m!==d&&R[m]===0;)m++;let f=new Uint8Array(E+(d-m)),y=E;for(;m!==d;)f[y++]=R[m++];return f}r(l,"decodeUnsafe");function p(a){let u=l(a);if(u)return u;throw new Error("Non-base"+n+" character")}return r(p,"decode"),{encode:s,decodeUnsafe:l,decode:p}}r(st,"base");var le=st;var at="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",ue=le(at);var ct=/: client error \((?:Connect|SendRequest)\):/;function lt(e){return e instanceof TypeError&&e.message.startsWith("error sending request ")&&ct.test(e.message)}r(lt,"isDenoClientError");function C(e,t){return t?e.catch(n=>{throw lt(n)?new N(n):n}):e}r(C,"wrapDenoNetworkErrors");var b=ce("zuplo:runtime:external-service");function ut(){let e,{__ZUPLO_EXTERNAL_SERVICE_TOKEN:t}=_.instance.runtime;if(t&&t!=="undefined")try{let n=atob(t);e=JSON.parse(n)}catch{}return e}r(ut,"getServiceAuth");async function pe(e,t){let n=".proxy",i=".tunnel";if(typeof e=="string"){let o=new URL(e),c=o.hostname;if(c.endsWith(n)){let f=c.slice(0,-n.length),y=new URL(`http://${f}${o.pathname}${o.search}`);b(`Routing to proxy: ${y.toString()}`);let O=t??{};return x(y.toString(),O)}let s=c.endsWith(i),l=c.indexOf(".")===-1;if(!(s||l))throw new A(`Invalid service hostname suffix: ${c}. Use .proxy for proxy routing, .tunnel for explicit tunnel routing, or no suffix for default tunnel routing.`);let a=s?c.slice(0,-i.length):c,u=ut();if(!u)throw b("There is no external service auth configured for this zup."),new A("There are no external services configured for this zup.");b(`Using external service auth. ClientId: ${u.clientId})`);let E=t??{},g=new Headers(E.headers||{});g.set("CF-Access-Client-Id",u.clientId),g.set("CF-Access-Client-Secret",u.clientSecret),E.headers=g;let d;if(u.customServiceMapping?.[a])d=`https://${u.customServiceMapping[a]}`;else if(_.instance.useLegacyServiceRouting)d=`https://${a}.zuptunnel.com`;else{b("Using sha256 service routing");let f=_.instance.build;if(f.ACCOUNT_NAME&&f.PROJECT_NAME&&f.ENVIRONMENT_TYPE){let y=await pt(a,f.ACCOUNT_NAME,f.PROJECT_NAME,f.ENVIRONMENT_TYPE),O=de(f.ENVIRONMENT_TYPE),h=await Y(`${f.ACCOUNT_NAME}-${f.PROJECT_NAME}-${O}`);h==="40d7ad502f5d743997999594c177184a00161a77865423511f3a1ea21eb5a5e"||h==="d05bffe8fa91a300187d2cf43e8aa4a56bd809c442ae10d1ee49af7d29a5a11"?d=`https://${y}.zuptunnel.com`:d=`https://${y}.t.zuplo.app`}else throw b("Cannot use sha256 service routing, missing build variables"),new A("Failed to generate fully qualified tunnel url.")}let R=new URL(`${d}${o.pathname}${o.search}`);b(`Calling external service: ${R.toString()}`);let m=await x(R.toString(),E);if(m.status===403&&m.headers.get("cf-access-domain")!==null)throw I.console.error("403 Forbidden when calling external service.",{clientId:u.clientId,tunnelHost:d}),new A("Could not connect to secure tunnel.");return m}else throw b("Cannot call external service with Request object"),new A("Currently, we only support fetch(<some_string>, ...).")}r(pe,"externalServiceHandler");async function fe(e,t){if(typeof e=="string"){let n=new URL(e),i=n.hostname,o=t??{},c=`http://${i}.zuplo.svc.cluster.local:9000`,s=new URL(`${c}${n.pathname}${n.search}`),l=new Headers(o.headers||{});return l.set(H,i),o.headers=l,await x(s.toString(),o)}else throw new A("Currently, we only support fetch(<some_string>, ...).")}r(fe,"clusterServiceHandler");async function pt(e,t,n,i){let o=e.toLowerCase(),c=t.toLowerCase(),s=n.toLowerCase(),l=de(i);b(`Hashing service name: ${c}-${o}.${c}-${s}-${l}`);let p=await Y(`${c}-${o}`),a=await Y(`${c}-${s}-${l}`);return`${p}.${a}`}r(pt,"hashServiceName");async function Y(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(c=>c.toString(16).padStart(2,"0")).join("").slice(0,-1)}r(Y,"hashSegment");function de(e){let t=e.toLowerCase();switch(t){case"production":case"preview":return t;default:return"working-copy"}}r(de,"sanitizeEnvironmentType");var q=new Map;q.set("service:",pe);q.set("local:",fe);var x=globalThis.fetch;function W(e,t){let{transformedInit:n,mtlsCertificate:i}=ft(t);if(typeof e=="string"){let o=new URL(e),c=q.get(o.protocol);return c?C(c(e,n),_.instance.isDeno):ge(e,n,i)}else return ge(e,n,i)}r(W,"internalFetch");globalThis.fetch=W;function ge(e,t,n){if(!n)return C(x(e,t),_.instance.isDeno);if(_.instance.isCloudflare){let o=_.instance.runtime[n];if(!o)throw new Error(`mTLS certificate binding '${n}' not found. Ensure the certificate is uploaded and properly configured.`);if(typeof o!="object"||typeof o.fetch!="function")throw new Error(`mTLS certificate binding '${n}' is not a valid mTLS certificate binding. Make sure it's configured as an mTLS certificate, not an environment variable.`);return C(o.fetch(e,t),_.instance.isDeno)}else if(_.instance.isDeno){let i=globalThis.managedDedicatedMtlsBindings?.[n];if(!i)throw new Error(`mTLS certificate binding '${n}' not found. Ensure the certificate is uploaded and properly configured.`);if(typeof i.fetch!="function")throw new Error(`mTLS certificate binding '${n}' is not a valid mTLS certificate binding.`);return C(i.fetch(e,t),!0)}else throw new Error("mTLS client certificates are not supported in this runtime environment")}r(ge,"performFetch");var ft=r(e=>{if(!e||e instanceof Request)return{transformedInit:e,mtlsCertificate:void 0};let t=e;if(!t.zuplo)return{transformedInit:e,mtlsCertificate:void 0};let n=t.zuplo.mtlsCertificate,i=e;return i.cf={cacheEverything:t.zuplo?.cacheEverything,cacheTtl:t.zuplo?.cacheTtlSeconds},delete e.zuplo,{transformedInit:e,mtlsCertificate:n}},"transformInit");var dt={console:{log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),debug:console.debug.bind(console),assert:console.assert.bind(console),clear:console.clear.bind(console),count:console.count.bind(console),countReset:console.countReset.bind(console),dir:console.dir.bind(console),dirxml:console.dirxml.bind(console),group:console.group.bind(console),groupCollapsed:console.groupCollapsed.bind(console),groupEnd:console.groupEnd.bind(console),table:console.table.bind(console),time:console.time.bind(console),timeEnd:console.timeEnd.bind(console),timeLog:console.timeLog.bind(console),timeStamp:console.timeStamp.bind(console),trace:console.trace.bind(console),profile:console.profile.bind(console),profileEnd:console.profileEnd.bind(console)},fetch:W},I=dt;var J="2025-02-06",me=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,escapeOpenApiPathCharacters:!1,delimitOpenApiPathParameters:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1,improvedSchemaValidation:!1,serializeMcpParametersByStyle:!1,sanitizeMcpToolNames:!1,omitMcpFieldsNewerThanNegotiatedVersion:!1,treatBlankOptionalStringOptionsAsUnset:!1,mcpProtocolVersion20260728:!1,failMcpResourceReadsOnErrorStatus:!1,rejectInvalidMcpResourceUris:!1,mcpGatewaySpecCompliance:!1,mcpServerSpecCompliance:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,escapeOpenApiPathCharacters:!1,delimitOpenApiPathParameters:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1,improvedSchemaValidation:!1,serializeMcpParametersByStyle:!1,sanitizeMcpToolNames:!1,omitMcpFieldsNewerThanNegotiatedVersion:!1,treatBlankOptionalStringOptionsAsUnset:!1,mcpProtocolVersion20260728:!1,failMcpResourceReadsOnErrorStatus:!1,rejectInvalidMcpResourceUris:!1,mcpGatewaySpecCompliance:!1,mcpServerSpecCompliance:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,escapeOpenApiPathCharacters:!1,delimitOpenApiPathParameters:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1,improvedSchemaValidation:!1,serializeMcpParametersByStyle:!1,sanitizeMcpToolNames:!1,omitMcpFieldsNewerThanNegotiatedVersion:!1,treatBlankOptionalStringOptionsAsUnset:!1,mcpProtocolVersion20260728:!1,failMcpResourceReadsOnErrorStatus:!1,rejectInvalidMcpResourceUris:!1,mcpGatewaySpecCompliance:!1,mcpServerSpecCompliance:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,escapeOpenApiPathCharacters:!1,delimitOpenApiPathParameters:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1,improvedSchemaValidation:!1,serializeMcpParametersByStyle:!1,sanitizeMcpToolNames:!1,omitMcpFieldsNewerThanNegotiatedVersion:!1,treatBlankOptionalStringOptionsAsUnset:!1,mcpProtocolVersion20260728:!1,failMcpResourceReadsOnErrorStatus:!1,rejectInvalidMcpResourceUris:!1,mcpGatewaySpecCompliance:!1,mcpServerSpecCompliance:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1,escapeOpenApiPathCharacters:!1,delimitOpenApiPathParameters:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1,improvedSchemaValidation:!1,serializeMcpParametersByStyle:!1,sanitizeMcpToolNames:!1,omitMcpFieldsNewerThanNegotiatedVersion:!1,treatBlankOptionalStringOptionsAsUnset:!1,mcpProtocolVersion20260728:!1,failMcpResourceReadsOnErrorStatus:!1,rejectInvalidMcpResourceUris:!1,mcpGatewaySpecCompliance:!1,mcpServerSpecCompliance:!1},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,escapeOpenApiPathCharacters:!0,delimitOpenApiPathParameters:!1,chainResponseSendingHooks:!1,return501ForUnsupportedHttpMethods:!1,improvedSchemaValidation:!1,serializeMcpParametersByStyle:!1,sanitizeMcpToolNames:!1,omitMcpFieldsNewerThanNegotiatedVersion:!1,treatBlankOptionalStringOptionsAsUnset:!1,mcpProtocolVersion20260728:!1,failMcpResourceReadsOnErrorStatus:!1,rejectInvalidMcpResourceUris:!1,mcpGatewaySpecCompliance:!1,mcpServerSpecCompliance:!1},"2026-03-01":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,escapeOpenApiPathCharacters:!0,delimitOpenApiPathParameters:!1,chainResponseSendingHooks:!0,return501ForUnsupportedHttpMethods:!0,improvedSchemaValidation:!1,serializeMcpParametersByStyle:!1,sanitizeMcpToolNames:!1,omitMcpFieldsNewerThanNegotiatedVersion:!1,treatBlankOptionalStringOptionsAsUnset:!1,mcpProtocolVersion20260728:!1,failMcpResourceReadsOnErrorStatus:!1,rejectInvalidMcpResourceUris:!1,mcpGatewaySpecCompliance:!1,mcpServerSpecCompliance:!1},"2026-11-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0,escapeOpenApiPathCharacters:!0,delimitOpenApiPathParameters:!0,chainResponseSendingHooks:!0,return501ForUnsupportedHttpMethods:!0,improvedSchemaValidation:!0,serializeMcpParametersByStyle:!0,sanitizeMcpToolNames:!0,omitMcpFieldsNewerThanNegotiatedVersion:!0,treatBlankOptionalStringOptionsAsUnset:!0,mcpProtocolVersion20260728:!0,failMcpResourceReadsOnErrorStatus:!0,rejectInvalidMcpResourceUris:!0,mcpGatewaySpecCompliance:!0,mcpServerSpecCompliance:!0}});function _e(e={}){let{runtime:t="cloudflare"}=e;return new _({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:J,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:me[J]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:t,__ZUPLO_AUTH_API_JWT:"",ZUPLO_SERVICE_BUCKET_ID:"bckt_mock"}})}r(_e,"getMockEnvironment");var gt=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function mt(e,t){let n=e.__ZUPLO_TRUSTED_IP_HEADER?.trim();if(!n)return t?v:X;if(!gt.test(n))throw new w(`__ZUPLO_TRUSTED_IP_HEADER is set to '${n}', which is not a valid HTTP header name. Header names may only contain the RFC 9110 token characters (letters, digits, and !#$%&'*+-.^_\`|~) - spaces, colons and tabs are not allowed. Set it to a valid header name such as '${v}' or 'cf-connecting-ip'.`);return n.toLowerCase()}r(mt,"resolveTrustedIpHeader");var _=class e{static{r(this,"Environment")}config;#n;static#e;static#t=!1;static initialize(t){e.#e||(e.#e=new e(t),e.#t=!0)}static get instance(){return e.#t||(I.console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),e.#e??=_e(),e.#t=!0),e.#e}constructor({build:t,runtime:n}){let i;try{if(n.ZUPLO_SYSTEM_CONFIGURATIONS){let o=new TextDecoder().decode(ue.decode(n.ZUPLO_SYSTEM_CONFIGURATIONS)),c=JSON.parse(o);for(let s of Object.keys(c))n[s]||(n[s]=c[s])}if(n.__ZUPLO_CONFIG){let o=atob(n.__ZUPLO_CONFIG);i=JSON.parse(o)}}catch(o){I.console.error("Failed to parse runtime configuration",o)}this.config=i??{},this.build=t,this.runtime=n,this.instanceId=crypto.randomUUID(),this.#n=mt(n,this.isCloudflare)}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get accountName(){return this.build.ACCOUNT_NAME??this.runtime.ZUPLO_ACCOUNT_NAME??void 0}get projectName(){return this.build.PROJECT_NAME??this.runtime.ZUPLO_PROJECT_NAME??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.runtime.__ZUPLO_EDGE_API_URL??this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.config.auth_client_id??this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.config.auth_client_secret??this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get authPublicKey(){return this.config.auth_public_key??this.runtime.__ZUPLO_AUTH_PUBLIC_KEY}get authPrivateKey(){return this.config.auth_private_key??this.runtime.__ZUPLO_AUTH_PRIVATE_KEY}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isManagedDedicated(){return this.runtime.__ZUPLO_IS_MANAGED_DEDICATED==="true"}get trustedIpHeader(){return this.#n}get isDeno(){if(this.runtime.__ZUPLO_RUNTIME_TYPE)return this.runtime.__ZUPLO_RUNTIME_TYPE==="deno";if(this.config.runtime_type)return this.config.runtime_type==="deno";{let t=globalThis.Deno?.version?.deno;return typeof WebSocketPair!="function"&&t}}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get budgetRulesCaptureDisabled(){return this.runtime.__ZUPLO_BUDGET_RULES_CAPTURE==="off"}get budgetDimensionLogValuesEnabled(){return this.runtime.__ZUPLO_BUDGET_DIMENSION_LOG_VALUES==="on"}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}get rateLimitServiceTimeoutMs(){let t=this.runtime.__ZUPLO_RATE_LIMIT_TIMEOUT_MS,n=this.config.rate_limit_service_timeout_ms,i=t??n;if(!i)return 500;let o=Number(i);return Number.isFinite(o)&&o>0?o:500}};export{w as a,N as b,A as c,K as d,ce as e,ht as f,Ee as g,he as h,Re as i,Rt as j,Ot as k,yt as l,Oe as m,ye as n,Ae as o,Se as p,Te as q,At as r,St as s,Tt as t,bt as u,Pt as v,Lt as w,Ct as x,xt as y,It as z,Ut as A,X as B,be as C,Pe as D,Le as E,Ce as F,xe as G,Ie as H,Ue as I,we as J,Ne as K,Me as L,De as M,ve as N,He as O,ze as P,Fe as Q,Ze as R,wt as S,H as T,Ve as U,ke as V,Nt as W,Mt as X,Dt as Y,vt as Z,Ht as _,_ as $,I as aa};
36
- /*! For license information please see chunk-2HVCLUM4.js.LEGAL.txt */
37
- //# sourceMappingURL=chunk-2HVCLUM4.js.map