@zuplo/cli 7.7.0 → 7.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/node_modules/@posthog/types/dist/capture.d.ts +12 -1
  2. package/node_modules/@posthog/types/dist/capture.d.ts.map +1 -1
  3. package/node_modules/@posthog/types/package.json +1 -1
  4. package/node_modules/@posthog/types/src/capture.ts +12 -1
  5. package/node_modules/@zuplo/core/package.json +1 -1
  6. package/node_modules/@zuplo/graphql/package.json +1 -1
  7. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  8. package/node_modules/@zuplo/otel/package.json +1 -1
  9. package/node_modules/@zuplo/runtime/out/esm/chunk-2DGFONEJ.js +26 -0
  10. package/node_modules/@zuplo/runtime/out/esm/{chunk-CUK3VROF.js.map → chunk-2DGFONEJ.js.map} +1 -1
  11. package/node_modules/@zuplo/runtime/out/esm/chunk-RGPFHTQB.js +410 -0
  12. package/node_modules/@zuplo/runtime/out/esm/chunk-RGPFHTQB.js.map +1 -0
  13. package/node_modules/@zuplo/runtime/out/esm/{chunk-K4TBJG47.js → chunk-WSCWEMBW.js} +2 -2
  14. package/node_modules/@zuplo/runtime/out/esm/{chunk-K4TBJG47.js.map → chunk-WSCWEMBW.js.map} +1 -1
  15. package/node_modules/@zuplo/runtime/out/esm/chunk-Z352SHBA.js +37 -0
  16. package/node_modules/@zuplo/runtime/out/esm/chunk-Z352SHBA.js.map +1 -0
  17. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  18. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  19. package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
  20. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  21. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  22. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  23. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js.map +1 -1
  24. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
  25. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js.map +1 -1
  26. package/node_modules/@zuplo/runtime/out/types/index.d.ts +70 -0
  27. package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +70 -0
  28. package/node_modules/@zuplo/runtime/out/types/mcp/messages/index.d.ts +70 -0
  29. package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +70 -0
  30. package/node_modules/@zuplo/runtime/out/types/mocks/index.d.ts +107 -0
  31. package/node_modules/@zuplo/runtime/out/types/sdks/aws/index.d.ts +70 -0
  32. package/node_modules/@zuplo/runtime/package.json +1 -1
  33. package/package.json +11 -11
  34. package/node_modules/@zuplo/runtime/out/esm/chunk-CUK3VROF.js +0 -26
  35. package/node_modules/@zuplo/runtime/out/esm/chunk-R4PTES5B.js +0 -410
  36. package/node_modules/@zuplo/runtime/out/esm/chunk-R4PTES5B.js.map +0 -1
  37. package/node_modules/@zuplo/runtime/out/esm/chunk-S4EBLGSU.js +0 -26
  38. package/node_modules/@zuplo/runtime/out/esm/chunk-S4EBLGSU.js.map +0 -1
  39. package/node_modules/@zuplo/runtime/out/esm/chunk-UKQQD2JN.js +0 -26
  40. package/node_modules/@zuplo/runtime/out/esm/chunk-UKQQD2JN.js.map +0 -1
  41. package/node_modules/@zuplo/runtime/out/esm/chunk-XF3IIUDX.js +0 -37
  42. package/node_modules/@zuplo/runtime/out/esm/chunk-XF3IIUDX.js.map +0 -1
  43. /package/node_modules/@zuplo/runtime/out/esm/{chunk-R4PTES5B.js.LEGAL.txt → chunk-RGPFHTQB.js.LEGAL.txt} +0 -0
  44. /package/node_modules/@zuplo/runtime/out/esm/{chunk-XF3IIUDX.js.LEGAL.txt → chunk-Z352SHBA.js.LEGAL.txt} +0 -0
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{b as l}from"../chunk-S4EBLGSU.js";import{_ as n}from"../chunk-XF3IIUDX.js";import{a as o}from"../chunk-TYV53J3B.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function t(r){e.push(Promise.resolve(r))}return o(t,"waitUntil"),{context:new s({event:{waitUntil:t},route:u.route}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(g,"createMockContext");var a={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},s=class extends EventTarget{static{o(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=a,parentContext:i}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:n.console.info,log:n.console.log,debug:n.console.debug,warn:n.console.warn,error:n.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=i,this.#e=e,this.analyticsContext=new l(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,i){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")}addEventListener(e,t,i){let d=o(r=>{try{typeof t=="function"?t(r):t.handleEvent(r)}catch(p){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),p}},"wrapped");super.addEventListener(e,d,i)}};export{s as MockZuploContext,g as createMockContext};
25
+ import{E as p,J as c,M as u}from"../chunk-RGPFHTQB.js";import"../chunk-2DGFONEJ.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import"../chunk-WSCWEMBW.js";import{_ as i}from"../chunk-Z352SHBA.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
@@ -1 +1 @@
1
- {"version":3,"sources":["@zuplo/runtime/mocks/context.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;2HA4BO,SAASA,EACdC,EAA6D,CAC3D,QAAS,IAAI,QAAQ,yBAAyB,CAChD,EACA,CACA,IAAMC,EAAwC,CAAC,EAG/C,SAASC,EAAUC,EAA6B,CAC9CF,EAAkB,KAAK,QAAQ,QAAQE,CAAO,CAAC,CACjD,CAFS,OAAAC,EAAAF,EAAA,aAaF,CAAE,QATO,IAAIG,EAAiB,CACnC,MAAO,CAAE,UAAAH,CAAU,EACnB,MAAOF,EAAQ,KACjB,CAAC,EAMiB,eAJKI,EAAA,SAAY,CACjC,MAAM,QAAQ,IAAIH,CAAiB,CACrC,EAFuB,iBAIU,CACnC,CAtBgBG,EAAAL,EAAA,qBAwBhB,IAAMO,EAA2C,CAC/C,KAAM,IACN,QAAS,CAAC,KAAK,EACf,QAAS,CACP,OAAQ,CAAC,EACT,OAAQ,SACV,EACA,IAAKF,EAAA,KAAU,CAAC,GAAX,MACP,EAMaC,EAAN,cAA+B,WAAoC,CAlE1E,MAkE0E,CAAAD,EAAA,yBAC/DG,GACA,UACA,UACA,IACA,MAEA,OACA,0BACA,cACA,iBAET,YAAY,CACV,MAAAC,EACA,MAAAC,EAAQH,EACR,cAAAI,CACF,EAIG,CACD,MAAM,EACN,KAAK,UAAY,OAAO,WAAW,EACnC,KAAK,UAAY,OAAO,WAAW,EAEnC,KAAK,IAAM,CACT,KAAMC,EAAU,QAAQ,KACxB,IAAKA,EAAU,QAAQ,IACvB,MAAOA,EAAU,QAAQ,MACzB,KAAMA,EAAU,QAAQ,KACxB,MAAOA,EAAU,QAAQ,MACzB,iBAAkBP,EAAA,IAAM,CAAC,EAAP,mBACpB,EACA,KAAK,OAAS,CAAC,EACf,KAAK,MAAQK,EACb,KAAK,0BAA4B,CAC/B,GAAI,cACJ,IAAK,KACL,eAAgB,eAChB,KAAM,UACN,OAAQ,aACR,WAAY,KACZ,KAAM,MACN,UAAW,KACX,QAAS,KACT,WAAY,QACZ,UAAW,MACX,SAAU,OACV,UAAW,OACX,SAAU,OACV,aAAc,OACd,WAAY,OACZ,6BAA8B,OAC9B,6BAA8B,OAC9B,4BAA6B,OAC7B,oBAAqB,OACrB,mBAAoB,OACpB,mBAAoB,OACpB,oBAAqB,MACvB,EACA,KAAK,cAAgBC,EACrB,KAAKH,GAASC,EACd,KAAK,iBAAmB,IAAII,EAA6B,KAAK,SAAS,CACzE,CAGA,UAAUT,EAAuB,CAC/B,KAAKI,GAAO,UAAUJ,CAAO,CAC/B,CAEA,oBACEU,EACAC,EACkC,CAClC,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAEA,qBACED,EACAE,EACAD,EACmB,CACnB,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAEA,YACEE,EACAC,EACmB,CACnB,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAKA,uBAAuBC,EAAmC,CACxD,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAKA,4BAA4BA,EAAwC,CAClE,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAES,iBACPC,EACAC,EACApB,EACM,CACN,IAAMqB,EAA8CjB,EAACkB,GAAM,CACzD,GAAI,CACF,OAAOF,GAAY,WAAaA,EAAQE,CAAC,EAAIF,EAAQ,YAAYE,CAAC,CACpE,OAASC,EAAK,CACZ,WAAK,IAAI,MACP,wBAAwBJ,CAAI,mCAC9B,EACMI,CACR,CACF,EAToD,WAUpD,MAAM,iBAAiBJ,EAAME,EAASrB,CAAO,CAC/C,CACF","names":["createMockContext","options","waitUntilPromises","waitUntil","promise","__name","MockZuploContext","DEFAULT_ROUTE_CONFIG","#event","event","route","parentContext","internals_default","ZuploGatewayAnalyticsContext","policyName","request","response","input","init","hook","type","handler","wrapped","e","err"]}
1
+ {"version":3,"sources":["@zuplo/runtime/mocks/context.ts"],"mappings":"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","names":["createMockContext","options","waitUntilPromises","waitUntil","promise","__name","MockZuploContext","DEFAULT_ROUTE_CONFIG","#event","#originalRequest","event","route","parentContext","originalRequest","internals_default","ZuploGatewayAnalyticsContext","policyName","request","response","input","init","hook","handler","ext","ZuploContextExtensions","ZuploRequest","registerPreRequestHandler","entry","type","wrapped","e","err"]}
@@ -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-K4TBJG47.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-XF3IIUDX.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-WSCWEMBW.js";import"../../chunk-Z352SHBA.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 +1 @@
1
- {"version":3,"sources":["@zuplo/runtime/sdks/aws/sign.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;kMAiDA,eAAsBA,EACpBC,EACAC,EACkB,CAClB,IAAMC,EACJ,OAAOD,EAAQ,aAAgB,WAC3B,MAAMA,EAAQ,YAAY,EAC1BA,EAAQ,YAERE,EAASH,EAAQ,OAEjBI,EADUD,IAAW,OAASA,IAAW,QAAUH,EAAQ,MAAQ,KAClD,MAAMA,EAAQ,YAAY,EAAI,KAe/CK,EAAS,MAbA,IAAIC,EAAY,CAC7B,OAAAH,EACA,IAAKH,EAAQ,IACb,QAASA,EAAQ,QACjB,KAAAI,EACA,YAAaF,EAAY,YACzB,gBAAiBA,EAAY,gBAC7B,aAAcA,EAAY,aAC1B,QAASD,EAAQ,QACjB,OAAQA,EAAQ,OAChB,UAAWA,EAAQ,SACrB,CAAC,EAE2B,KAAK,EAEjC,OAAO,IAAI,QAAQI,EAAO,IAAI,SAAS,EAAG,CACxC,OAAQA,EAAO,OACf,QAASA,EAAO,QAChB,KAAMA,EAAO,IACf,CAAC,CACH,CAjCsBE,EAAAR,EAAA","names":["signRequest","request","options","credentials","method","body","signed","AwsV4Signer","__name"]}
1
+ {"version":3,"sources":["@zuplo/runtime/sdks/aws/sign.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;kKAiDA,eAAsBA,EACpBC,EACAC,EACkB,CAClB,IAAMC,EACJ,OAAOD,EAAQ,aAAgB,WAC3B,MAAMA,EAAQ,YAAY,EAC1BA,EAAQ,YAERE,EAASH,EAAQ,OAEjBI,EADUD,IAAW,OAASA,IAAW,QAAUH,EAAQ,MAAQ,KAClD,MAAMA,EAAQ,YAAY,EAAI,KAe/CK,EAAS,MAbA,IAAIC,EAAY,CAC7B,OAAAH,EACA,IAAKH,EAAQ,IACb,QAASA,EAAQ,QACjB,KAAAI,EACA,YAAaF,EAAY,YACzB,gBAAiBA,EAAY,gBAC7B,aAAcA,EAAY,aAC1B,QAASD,EAAQ,QACjB,OAAQA,EAAQ,OAChB,UAAWA,EAAQ,SACrB,CAAC,EAE2B,KAAK,EAEjC,OAAO,IAAI,QAAQI,EAAO,IAAI,SAAS,EAAG,CACxC,OAAQA,EAAO,OACf,QAASA,EAAO,QAChB,KAAMA,EAAO,IACf,CAAC,CACH,CAjCsBE,EAAAR,EAAA","names":["signRequest","request","options","credentials","method","body","signed","AwsV4Signer","__name"]}
@@ -12327,6 +12327,48 @@ export declare interface PolicyConfiguration {
12327
12327
  */
12328
12328
  declare type PolicyDirection = "inbound" | "outbound";
12329
12329
 
12330
+ /**
12331
+ * Runs only if its handler's verdict wins, after the inbound chain has
12332
+ * stopped — the one place a pre-request handler may touch shared context
12333
+ * state. Resolve a `Response` to serve it, or `undefined` to withdraw the
12334
+ * verdict and let the pipeline proceed.
12335
+ * @beta
12336
+ */
12337
+ export declare interface PreRequestCommit {
12338
+ (): Promise<Response | undefined>;
12339
+ }
12340
+
12341
+ /**
12342
+ * Work started by an inbound policy that runs concurrently with the rest of
12343
+ * the inbound policy chain. Registered with
12344
+ * {@link ZuploContext.addPreRequestHandler}, started immediately.
12345
+ *
12346
+ * Resolve `undefined` to let the request proceed, a `Response` to
12347
+ * short-circuit the pipeline with it, or a {@link PreRequestCommit} for a
12348
+ * verdict that needs exclusive serve-time work.
12349
+ *
12350
+ * Handlers run out of order relative to the policies they overlap, so they
12351
+ * must never mutate or consume the live request — capture what they need
12352
+ * (for example via `request.clone()`) before registering.
12353
+ * @beta
12354
+ */
12355
+ export declare interface PreRequestHandler {
12356
+ (api: PreRequestHandlerApi): Promise<Response | PreRequestCommit | undefined>;
12357
+ }
12358
+
12359
+ /**
12360
+ * The API handed to a {@link PreRequestHandler} when it starts.
12361
+ * @beta
12362
+ */
12363
+ export declare interface PreRequestHandlerApi {
12364
+ /**
12365
+ * Aborted when this handler's verdict can no longer win — another verdict
12366
+ * was served, or the pipeline resolved with the chain's own response or an
12367
+ * error. Pass it to `fetch()` so the external call is actually cancelled.
12368
+ */
12369
+ readonly signal: AbortSignal;
12370
+ }
12371
+
12330
12372
  /**
12331
12373
  * @public
12332
12374
  */
@@ -15939,6 +15981,34 @@ export declare interface ZuploContext extends EventTarget {
15939
15981
  readonly addResponseSendingFinalHook: (
15940
15982
  hook: OnResponseSendingFinalHook
15941
15983
  ) => void;
15984
+ /**
15985
+ * Registers a pre-request handler: work started immediately that runs
15986
+ * concurrently with the remaining inbound policy chain.
15987
+ *
15988
+ * The runtime checks the handler after each subsequent policy completes and
15989
+ * serves its `Response` verdict if one has resolved (skipping the remaining
15990
+ * policies, the route handler, and outbound policies). All outstanding
15991
+ * handlers are awaited at a barrier just before the route handler dispatches
15992
+ * upstream — the only point in the pipeline that blocks on a handler. A
15993
+ * response produced by the policy chain itself (for example an
15994
+ * authentication policy's 401) is served immediately: already-resolved
15995
+ * verdicts from earlier-registered handlers still win, but a pending
15996
+ * handler never delays it and is aborted instead.
15997
+ *
15998
+ * Handlers run out of order relative to the policies they overlap, so they
15999
+ * must observe and veto, never transform: do not mutate or consume the live
16000
+ * request from a handler. A handler that rejects fails the request closed
16001
+ * (500); catch inside the handler and resolve `undefined` to fail open.
16002
+ *
16003
+ * May only be called during the inbound policy phase.
16004
+ * @beta
16005
+ */
16006
+ readonly addPreRequestHandler: (
16007
+ handler: PreRequestHandler,
16008
+ options?: {
16009
+ name?: string;
16010
+ }
16011
+ ) => void;
15942
16012
  /**
15943
16013
  * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
15944
16014
  *
@@ -1594,6 +1594,48 @@ declare interface PolicyConfiguration {
1594
1594
  options?: unknown;
1595
1595
  }
1596
1596
 
1597
+ /**
1598
+ * Runs only if its handler's verdict wins, after the inbound chain has
1599
+ * stopped — the one place a pre-request handler may touch shared context
1600
+ * state. Resolve a `Response` to serve it, or `undefined` to withdraw the
1601
+ * verdict and let the pipeline proceed.
1602
+ * @beta
1603
+ */
1604
+ declare interface PreRequestCommit {
1605
+ (): Promise<Response | undefined>;
1606
+ }
1607
+
1608
+ /**
1609
+ * Work started by an inbound policy that runs concurrently with the rest of
1610
+ * the inbound policy chain. Registered with
1611
+ * {@link ZuploContext.addPreRequestHandler}, started immediately.
1612
+ *
1613
+ * Resolve `undefined` to let the request proceed, a `Response` to
1614
+ * short-circuit the pipeline with it, or a {@link PreRequestCommit} for a
1615
+ * verdict that needs exclusive serve-time work.
1616
+ *
1617
+ * Handlers run out of order relative to the policies they overlap, so they
1618
+ * must never mutate or consume the live request — capture what they need
1619
+ * (for example via `request.clone()`) before registering.
1620
+ * @beta
1621
+ */
1622
+ declare interface PreRequestHandler {
1623
+ (api: PreRequestHandlerApi): Promise<Response | PreRequestCommit | undefined>;
1624
+ }
1625
+
1626
+ /**
1627
+ * The API handed to a {@link PreRequestHandler} when it starts.
1628
+ * @beta
1629
+ */
1630
+ declare interface PreRequestHandlerApi {
1631
+ /**
1632
+ * Aborted when this handler's verdict can no longer win — another verdict
1633
+ * was served, or the pipeline resolved with the chain's own response or an
1634
+ * error. Pass it to `fetch()` so the external call is actually cancelled.
1635
+ */
1636
+ readonly signal: AbortSignal;
1637
+ }
1638
+
1597
1639
  /**
1598
1640
  * Generic type parameters for a request.
1599
1641
  * Extends RequestInitGeneric and adds query parameter typing.
@@ -1827,6 +1869,34 @@ declare interface ZuploContext extends EventTarget {
1827
1869
  readonly addResponseSendingFinalHook: (
1828
1870
  hook: OnResponseSendingFinalHook
1829
1871
  ) => void;
1872
+ /**
1873
+ * Registers a pre-request handler: work started immediately that runs
1874
+ * concurrently with the remaining inbound policy chain.
1875
+ *
1876
+ * The runtime checks the handler after each subsequent policy completes and
1877
+ * serves its `Response` verdict if one has resolved (skipping the remaining
1878
+ * policies, the route handler, and outbound policies). All outstanding
1879
+ * handlers are awaited at a barrier just before the route handler dispatches
1880
+ * upstream — the only point in the pipeline that blocks on a handler. A
1881
+ * response produced by the policy chain itself (for example an
1882
+ * authentication policy's 401) is served immediately: already-resolved
1883
+ * verdicts from earlier-registered handlers still win, but a pending
1884
+ * handler never delays it and is aborted instead.
1885
+ *
1886
+ * Handlers run out of order relative to the policies they overlap, so they
1887
+ * must observe and veto, never transform: do not mutate or consume the live
1888
+ * request from a handler. A handler that rejects fails the request closed
1889
+ * (500); catch inside the handler and resolve `undefined` to fail open.
1890
+ *
1891
+ * May only be called during the inbound policy phase.
1892
+ * @beta
1893
+ */
1894
+ readonly addPreRequestHandler: (
1895
+ handler: PreRequestHandler,
1896
+ options?: {
1897
+ name?: string;
1898
+ }
1899
+ ) => void;
1830
1900
  /**
1831
1901
  * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
1832
1902
  *
@@ -2064,6 +2064,48 @@ declare interface ParameterDefinition extends ParameterBaseObject {
2064
2064
  in: string;
2065
2065
  }
2066
2066
 
2067
+ /**
2068
+ * Runs only if its handler's verdict wins, after the inbound chain has
2069
+ * stopped — the one place a pre-request handler may touch shared context
2070
+ * state. Resolve a `Response` to serve it, or `undefined` to withdraw the
2071
+ * verdict and let the pipeline proceed.
2072
+ * @beta
2073
+ */
2074
+ declare interface PreRequestCommit {
2075
+ (): Promise<Response | undefined>;
2076
+ }
2077
+
2078
+ /**
2079
+ * Work started by an inbound policy that runs concurrently with the rest of
2080
+ * the inbound policy chain. Registered with
2081
+ * {@link ZuploContext.addPreRequestHandler}, started immediately.
2082
+ *
2083
+ * Resolve `undefined` to let the request proceed, a `Response` to
2084
+ * short-circuit the pipeline with it, or a {@link PreRequestCommit} for a
2085
+ * verdict that needs exclusive serve-time work.
2086
+ *
2087
+ * Handlers run out of order relative to the policies they overlap, so they
2088
+ * must never mutate or consume the live request — capture what they need
2089
+ * (for example via `request.clone()`) before registering.
2090
+ * @beta
2091
+ */
2092
+ declare interface PreRequestHandler {
2093
+ (api: PreRequestHandlerApi): Promise<Response | PreRequestCommit | undefined>;
2094
+ }
2095
+
2096
+ /**
2097
+ * The API handed to a {@link PreRequestHandler} when it starts.
2098
+ * @beta
2099
+ */
2100
+ declare interface PreRequestHandlerApi {
2101
+ /**
2102
+ * Aborted when this handler's verdict can no longer win — another verdict
2103
+ * was served, or the pipeline resolved with the chain's own response or an
2104
+ * error. Pass it to `fetch()` so the external call is actually cancelled.
2105
+ */
2106
+ readonly signal: AbortSignal;
2107
+ }
2108
+
2067
2109
  /**
2068
2110
  * Build an inbound policy handler that runs per-message MCP logic while the
2069
2111
  * runtime owns the batch mechanics.
@@ -2300,6 +2342,34 @@ declare interface ZuploContext extends EventTarget {
2300
2342
  readonly addResponseSendingFinalHook: (
2301
2343
  hook: OnResponseSendingFinalHook
2302
2344
  ) => void;
2345
+ /**
2346
+ * Registers a pre-request handler: work started immediately that runs
2347
+ * concurrently with the remaining inbound policy chain.
2348
+ *
2349
+ * The runtime checks the handler after each subsequent policy completes and
2350
+ * serves its `Response` verdict if one has resolved (skipping the remaining
2351
+ * policies, the route handler, and outbound policies). All outstanding
2352
+ * handlers are awaited at a barrier just before the route handler dispatches
2353
+ * upstream — the only point in the pipeline that blocks on a handler. A
2354
+ * response produced by the policy chain itself (for example an
2355
+ * authentication policy's 401) is served immediately: already-resolved
2356
+ * verdicts from earlier-registered handlers still win, but a pending
2357
+ * handler never delays it and is aborted instead.
2358
+ *
2359
+ * Handlers run out of order relative to the policies they overlap, so they
2360
+ * must observe and veto, never transform: do not mutate or consume the live
2361
+ * request from a handler. A handler that rejects fails the request closed
2362
+ * (500); catch inside the handler and resolve `undefined` to fail open.
2363
+ *
2364
+ * May only be called during the inbound policy phase.
2365
+ * @beta
2366
+ */
2367
+ readonly addPreRequestHandler: (
2368
+ handler: PreRequestHandler,
2369
+ options?: {
2370
+ name?: string;
2371
+ }
2372
+ ) => void;
2303
2373
  /**
2304
2374
  * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
2305
2375
  *
@@ -3819,6 +3819,48 @@ declare interface PolicyConfiguration {
3819
3819
  */
3820
3820
  declare type PolicyDirection = "inbound" | "outbound";
3821
3821
 
3822
+ /**
3823
+ * Runs only if its handler's verdict wins, after the inbound chain has
3824
+ * stopped — the one place a pre-request handler may touch shared context
3825
+ * state. Resolve a `Response` to serve it, or `undefined` to withdraw the
3826
+ * verdict and let the pipeline proceed.
3827
+ * @beta
3828
+ */
3829
+ declare interface PreRequestCommit {
3830
+ (): Promise<Response | undefined>;
3831
+ }
3832
+
3833
+ /**
3834
+ * Work started by an inbound policy that runs concurrently with the rest of
3835
+ * the inbound policy chain. Registered with
3836
+ * {@link ZuploContext.addPreRequestHandler}, started immediately.
3837
+ *
3838
+ * Resolve `undefined` to let the request proceed, a `Response` to
3839
+ * short-circuit the pipeline with it, or a {@link PreRequestCommit} for a
3840
+ * verdict that needs exclusive serve-time work.
3841
+ *
3842
+ * Handlers run out of order relative to the policies they overlap, so they
3843
+ * must never mutate or consume the live request — capture what they need
3844
+ * (for example via `request.clone()`) before registering.
3845
+ * @beta
3846
+ */
3847
+ declare interface PreRequestHandler {
3848
+ (api: PreRequestHandlerApi): Promise<Response | PreRequestCommit | undefined>;
3849
+ }
3850
+
3851
+ /**
3852
+ * The API handed to a {@link PreRequestHandler} when it starts.
3853
+ * @beta
3854
+ */
3855
+ declare interface PreRequestHandlerApi {
3856
+ /**
3857
+ * Aborted when this handler's verdict can no longer win — another verdict
3858
+ * was served, or the pipeline resolved with the chain's own response or an
3859
+ * error. Pass it to `fetch()` so the external call is actually cancelled.
3860
+ */
3861
+ readonly signal: AbortSignal;
3862
+ }
3863
+
3822
3864
  /**
3823
3865
  * @public
3824
3866
  */
@@ -4437,6 +4479,34 @@ declare interface ZuploContext extends EventTarget {
4437
4479
  readonly addResponseSendingFinalHook: (
4438
4480
  hook: OnResponseSendingFinalHook
4439
4481
  ) => void;
4482
+ /**
4483
+ * Registers a pre-request handler: work started immediately that runs
4484
+ * concurrently with the remaining inbound policy chain.
4485
+ *
4486
+ * The runtime checks the handler after each subsequent policy completes and
4487
+ * serves its `Response` verdict if one has resolved (skipping the remaining
4488
+ * policies, the route handler, and outbound policies). All outstanding
4489
+ * handlers are awaited at a barrier just before the route handler dispatches
4490
+ * upstream — the only point in the pipeline that blocks on a handler. A
4491
+ * response produced by the policy chain itself (for example an
4492
+ * authentication policy's 401) is served immediately: already-resolved
4493
+ * verdicts from earlier-registered handlers still win, but a pending
4494
+ * handler never delays it and is aborted instead.
4495
+ *
4496
+ * Handlers run out of order relative to the policies they overlap, so they
4497
+ * must observe and veto, never transform: do not mutate or consume the live
4498
+ * request from a handler. A handler that rejects fails the request closed
4499
+ * (500); catch inside the handler and resolve `undefined` to fail open.
4500
+ *
4501
+ * May only be called during the inbound policy phase.
4502
+ * @beta
4503
+ */
4504
+ readonly addPreRequestHandler: (
4505
+ handler: PreRequestHandler,
4506
+ options?: {
4507
+ name?: string;
4508
+ }
4509
+ ) => void;
4440
4510
  /**
4441
4511
  * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
4442
4512
  *
@@ -916,10 +916,17 @@ export declare class MockZuploContext
916
916
  event,
917
917
  route,
918
918
  parentContext,
919
+ originalRequest,
919
920
  }: {
920
921
  event: ZuploEventContext;
921
922
  route?: RouteConfiguration;
922
923
  parentContext?: ZuploContext | undefined;
924
+ /**
925
+ * The request this context belongs to. Used to initialize the per-request
926
+ * state that hooks such as `addPreRequestHandler` write to, so a policy
927
+ * under test can register one without any additional setup.
928
+ */
929
+ originalRequest?: Request;
923
930
  });
924
931
  waitUntil(promise: Promise<any>): void;
925
932
  invokeInboundPolicy(
@@ -943,6 +950,36 @@ export declare class MockZuploContext
943
950
  * Fires immediately after the response is sent. Response cannot be modified.
944
951
  */
945
952
  addResponseSendingFinalHook(hook: OnResponseSendingFinalHook): void;
953
+ /**
954
+ * Registers a pre-request handler on the real per-context extensions so
955
+ * tests exercise the same registration, checkpoint, and barrier machinery
956
+ * as the runtime. Requires `ZuploContextExtensions.initialize(context,
957
+ * request)` to have been called first.
958
+ */
959
+ addPreRequestHandler(
960
+ handler: PreRequestHandler,
961
+ options?: {
962
+ name?: string;
963
+ }
964
+ ): void;
965
+ /**
966
+ * The pre-request handlers registered on this context, oldest first, for
967
+ * asserting what a policy under test registered. Reading this does not run,
968
+ * await, or cancel anything.
969
+ *
970
+ * @example
971
+ * ```typescript
972
+ * const { context } = createMockContext();
973
+ * await myPolicy(request, context, options, "my-policy");
974
+ * assert.deepEqual(context.preRequestHandlers, [
975
+ * { policyName: "my-policy", name: "detect-input" },
976
+ * ]);
977
+ * ```
978
+ */
979
+ get preRequestHandlers(): {
980
+ policyName: string;
981
+ name: string | undefined;
982
+ }[];
946
983
  addEventListener<Type extends keyof Record<string, Event>>(
947
984
  type: Type,
948
985
  handler: EventListenerOrEventListenerObject,
@@ -1532,6 +1569,48 @@ declare interface ParameterDefinition extends ParameterBaseObject {
1532
1569
  in: string;
1533
1570
  }
1534
1571
 
1572
+ /**
1573
+ * Runs only if its handler's verdict wins, after the inbound chain has
1574
+ * stopped — the one place a pre-request handler may touch shared context
1575
+ * state. Resolve a `Response` to serve it, or `undefined` to withdraw the
1576
+ * verdict and let the pipeline proceed.
1577
+ * @beta
1578
+ */
1579
+ declare interface PreRequestCommit {
1580
+ (): Promise<Response | undefined>;
1581
+ }
1582
+
1583
+ /**
1584
+ * Work started by an inbound policy that runs concurrently with the rest of
1585
+ * the inbound policy chain. Registered with
1586
+ * {@link ZuploContext.addPreRequestHandler}, started immediately.
1587
+ *
1588
+ * Resolve `undefined` to let the request proceed, a `Response` to
1589
+ * short-circuit the pipeline with it, or a {@link PreRequestCommit} for a
1590
+ * verdict that needs exclusive serve-time work.
1591
+ *
1592
+ * Handlers run out of order relative to the policies they overlap, so they
1593
+ * must never mutate or consume the live request — capture what they need
1594
+ * (for example via `request.clone()`) before registering.
1595
+ * @beta
1596
+ */
1597
+ declare interface PreRequestHandler {
1598
+ (api: PreRequestHandlerApi): Promise<Response | PreRequestCommit | undefined>;
1599
+ }
1600
+
1601
+ /**
1602
+ * The API handed to a {@link PreRequestHandler} when it starts.
1603
+ * @beta
1604
+ */
1605
+ declare interface PreRequestHandlerApi {
1606
+ /**
1607
+ * Aborted when this handler's verdict can no longer win — another verdict
1608
+ * was served, or the pipeline resolved with the chain's own response or an
1609
+ * error. Pass it to `fetch()` so the external call is actually cancelled.
1610
+ */
1611
+ readonly signal: AbortSignal;
1612
+ }
1613
+
1535
1614
  /**
1536
1615
  * Generic type parameters for a request.
1537
1616
  * Extends RequestInitGeneric and adds query parameter typing.
@@ -1737,6 +1816,34 @@ declare interface ZuploContext extends EventTarget {
1737
1816
  readonly addResponseSendingFinalHook: (
1738
1817
  hook: OnResponseSendingFinalHook
1739
1818
  ) => void;
1819
+ /**
1820
+ * Registers a pre-request handler: work started immediately that runs
1821
+ * concurrently with the remaining inbound policy chain.
1822
+ *
1823
+ * The runtime checks the handler after each subsequent policy completes and
1824
+ * serves its `Response` verdict if one has resolved (skipping the remaining
1825
+ * policies, the route handler, and outbound policies). All outstanding
1826
+ * handlers are awaited at a barrier just before the route handler dispatches
1827
+ * upstream — the only point in the pipeline that blocks on a handler. A
1828
+ * response produced by the policy chain itself (for example an
1829
+ * authentication policy's 401) is served immediately: already-resolved
1830
+ * verdicts from earlier-registered handlers still win, but a pending
1831
+ * handler never delays it and is aborted instead.
1832
+ *
1833
+ * Handlers run out of order relative to the policies they overlap, so they
1834
+ * must observe and veto, never transform: do not mutate or consume the live
1835
+ * request from a handler. A handler that rejects fails the request closed
1836
+ * (500); catch inside the handler and resolve `undefined` to fail open.
1837
+ *
1838
+ * May only be called during the inbound policy phase.
1839
+ * @beta
1840
+ */
1841
+ readonly addPreRequestHandler: (
1842
+ handler: PreRequestHandler,
1843
+ options?: {
1844
+ name?: string;
1845
+ }
1846
+ ) => void;
1740
1847
  /**
1741
1848
  * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
1742
1849
  *
@@ -1854,6 +1854,48 @@ declare interface ParameterDefinition extends ParameterBaseObject {
1854
1854
  in: string;
1855
1855
  }
1856
1856
 
1857
+ /**
1858
+ * Runs only if its handler's verdict wins, after the inbound chain has
1859
+ * stopped — the one place a pre-request handler may touch shared context
1860
+ * state. Resolve a `Response` to serve it, or `undefined` to withdraw the
1861
+ * verdict and let the pipeline proceed.
1862
+ * @beta
1863
+ */
1864
+ declare interface PreRequestCommit {
1865
+ (): Promise<Response | undefined>;
1866
+ }
1867
+
1868
+ /**
1869
+ * Work started by an inbound policy that runs concurrently with the rest of
1870
+ * the inbound policy chain. Registered with
1871
+ * {@link ZuploContext.addPreRequestHandler}, started immediately.
1872
+ *
1873
+ * Resolve `undefined` to let the request proceed, a `Response` to
1874
+ * short-circuit the pipeline with it, or a {@link PreRequestCommit} for a
1875
+ * verdict that needs exclusive serve-time work.
1876
+ *
1877
+ * Handlers run out of order relative to the policies they overlap, so they
1878
+ * must never mutate or consume the live request — capture what they need
1879
+ * (for example via `request.clone()`) before registering.
1880
+ * @beta
1881
+ */
1882
+ declare interface PreRequestHandler {
1883
+ (api: PreRequestHandlerApi): Promise<Response | PreRequestCommit | undefined>;
1884
+ }
1885
+
1886
+ /**
1887
+ * The API handed to a {@link PreRequestHandler} when it starts.
1888
+ * @beta
1889
+ */
1890
+ declare interface PreRequestHandlerApi {
1891
+ /**
1892
+ * Aborted when this handler's verdict can no longer win — another verdict
1893
+ * was served, or the pipeline resolved with the chain's own response or an
1894
+ * error. Pass it to `fetch()` so the external call is actually cancelled.
1895
+ */
1896
+ readonly signal: AbortSignal;
1897
+ }
1898
+
1857
1899
  /**
1858
1900
  * Generic type parameters for a request.
1859
1901
  * Extends RequestInitGeneric and adds query parameter typing.
@@ -2143,6 +2185,34 @@ declare interface ZuploContext extends EventTarget {
2143
2185
  readonly addResponseSendingFinalHook: (
2144
2186
  hook: OnResponseSendingFinalHook
2145
2187
  ) => void;
2188
+ /**
2189
+ * Registers a pre-request handler: work started immediately that runs
2190
+ * concurrently with the remaining inbound policy chain.
2191
+ *
2192
+ * The runtime checks the handler after each subsequent policy completes and
2193
+ * serves its `Response` verdict if one has resolved (skipping the remaining
2194
+ * policies, the route handler, and outbound policies). All outstanding
2195
+ * handlers are awaited at a barrier just before the route handler dispatches
2196
+ * upstream — the only point in the pipeline that blocks on a handler. A
2197
+ * response produced by the policy chain itself (for example an
2198
+ * authentication policy's 401) is served immediately: already-resolved
2199
+ * verdicts from earlier-registered handlers still win, but a pending
2200
+ * handler never delays it and is aborted instead.
2201
+ *
2202
+ * Handlers run out of order relative to the policies they overlap, so they
2203
+ * must observe and veto, never transform: do not mutate or consume the live
2204
+ * request from a handler. A handler that rejects fails the request closed
2205
+ * (500); catch inside the handler and resolve `undefined` to fail open.
2206
+ *
2207
+ * May only be called during the inbound policy phase.
2208
+ * @beta
2209
+ */
2210
+ readonly addPreRequestHandler: (
2211
+ handler: PreRequestHandler,
2212
+ options?: {
2213
+ name?: string;
2214
+ }
2215
+ ) => void;
2146
2216
  /**
2147
2217
  * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
2148
2218
  *
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.7.0",
4
+ "version": "7.7.1",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "7.7.0",
3
+ "version": "7.7.1",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "type": "module",
@@ -28,10 +28,10 @@
28
28
  "@opentelemetry/api": "1.9.0",
29
29
  "@opentelemetry/api-logs": "0.220.0",
30
30
  "@swc/core": "1.10.18",
31
- "@zuplo/core": "7.7.0",
31
+ "@zuplo/core": "7.7.1",
32
32
  "@zuplo/editor": "1.0.33162667821",
33
- "@zuplo/openapi-tools": "7.7.0",
34
- "@zuplo/runtime": "7.7.0",
33
+ "@zuplo/openapi-tools": "7.7.1",
34
+ "@zuplo/runtime": "7.7.1",
35
35
  "chalk": "5.4.1",
36
36
  "chokidar": "3.5.3",
37
37
  "cookie": "1.0.2",
@@ -62,15 +62,15 @@
62
62
  "workerd": "1.20241230.0",
63
63
  "yargs": "17.7.2",
64
64
  "zod": "4.4.3",
65
- "@zuplo/graphql": "7.7.0",
66
- "@zuplo/otel": "7.7.0"
65
+ "@zuplo/graphql": "7.7.1",
66
+ "@zuplo/otel": "7.7.1"
67
67
  },
68
68
  "optionalDependencies": {
69
- "@zuplo/lint-darwin-arm64": "7.7.0",
70
- "@zuplo/lint-darwin-x64": "7.7.0",
71
- "@zuplo/lint-linux-x64": "7.7.0",
72
- "@zuplo/lint-linux-arm64": "7.7.0",
73
- "@zuplo/lint-win32-x64": "7.7.0"
69
+ "@zuplo/lint-darwin-arm64": "7.7.1",
70
+ "@zuplo/lint-darwin-x64": "7.7.1",
71
+ "@zuplo/lint-linux-x64": "7.7.1",
72
+ "@zuplo/lint-linux-arm64": "7.7.1",
73
+ "@zuplo/lint-win32-x64": "7.7.1"
74
74
  },
75
75
  "bundleDependencies": [
76
76
  "@inquirer/prompts",