@zuplo/runtime 5.2462.0 → 5.2464.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/esm/index.js +17 -17
- package/out/esm/mocks/index.js +1 -1
- package/out/types/index.d.ts +2 -1
- package/out/types/mocks/index.d.ts +2 -0
- package/package.json +1 -1
package/out/esm/mocks/index.js
CHANGED
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{a as n}from"../chunk-OQPRFCK5.js";function
|
|
25
|
+
import{a as n}from"../chunk-OQPRFCK5.js";function a(s={request:new Request("https://api.example.com")}){let e=[];function o(t){e.push(Promise.resolve(t))}return n(o,"waitUntil"),{context:new i({event:{waitUntil:o},route:s.route}),invokeResponse:n(async()=>{await Promise.all(e)},"invokeResponse")}}n(a,"createMockContext");var l={path:"/",methods:["GET"],handler:{module:{},export:"default"},version:"none",raw:n(()=>({}),"raw")},i=class extends EventTarget{static{n(this,"MockZuploContext")}#e;requestId;log;route;custom;incomingRequestProperties;constructor({event:e,route:o=l}){super(),this.requestId=crypto.randomUUID(),this.log={info:console.info,log:console.log,debug:console.debug,warn:console.warn,error:console.error},this.custom={},this.route=o,this.incomingRequestProperties={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},this.#e=e}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,o){throw new Error("Not implemented")}invokeOutboundPolicy(e,o,r){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addEventListener(e,o,r){let u=n(t=>{try{typeof o=="function"?o(t):o.handleEvent(t)}catch(d){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),d}},"wrapped");super.addEventListener(e,u,r)}};export{i as MockZuploContext,a as createMockContext};
|
|
26
26
|
/*! For license information please see index.js.LEGAL.txt */
|
package/out/types/index.d.ts
CHANGED
|
@@ -3800,7 +3800,7 @@ export declare abstract class OutboundPolicy<TOptions = any> extends PolicyBase<
|
|
|
3800
3800
|
* @param request - The incoming Request
|
|
3801
3801
|
* @param context - The current context of the Request
|
|
3802
3802
|
*/
|
|
3803
|
-
abstract handler(response: Response, request: ZuploRequest, context: ZuploContext): Promise<
|
|
3803
|
+
abstract handler(response: Response, request: ZuploRequest, context: ZuploContext): Promise<Response>;
|
|
3804
3804
|
}
|
|
3805
3805
|
|
|
3806
3806
|
/**
|
|
@@ -5526,6 +5526,7 @@ export declare interface ZuploContext extends EventTarget {
|
|
|
5526
5526
|
readonly custom: Record<string, any>;
|
|
5527
5527
|
readonly incomingRequestProperties: IncomingRequestProperties;
|
|
5528
5528
|
readonly invokeInboundPolicy: (policyName: string, request: ZuploRequest) => Promise<Response | ZuploRequest>;
|
|
5529
|
+
readonly invokeOutboundPolicy: (policyName: string, response: Response, request: ZuploRequest) => Promise<Response>;
|
|
5529
5530
|
readonly waitUntil: WaitUntilFunc;
|
|
5530
5531
|
/**
|
|
5531
5532
|
* Fires just before the response is sent. Response can be modified.
|
|
@@ -478,6 +478,7 @@ export declare class MockZuploContext extends EventTarget implements ZuploContex
|
|
|
478
478
|
});
|
|
479
479
|
waitUntil(promise: Promise<any>): void;
|
|
480
480
|
invokeInboundPolicy(policyName: string, request: ZuploRequest): Promise<ZuploRequest | Response>;
|
|
481
|
+
invokeOutboundPolicy(policyName: string, response: Response, request: ZuploRequest): Promise<Response>;
|
|
481
482
|
/**
|
|
482
483
|
* Fires just before the response is sent. Response can be modified.
|
|
483
484
|
*/
|
|
@@ -1079,6 +1080,7 @@ declare interface ZuploContext extends EventTarget {
|
|
|
1079
1080
|
readonly custom: Record<string, any>;
|
|
1080
1081
|
readonly incomingRequestProperties: IncomingRequestProperties;
|
|
1081
1082
|
readonly invokeInboundPolicy: (policyName: string, request: ZuploRequest) => Promise<Response | ZuploRequest>;
|
|
1083
|
+
readonly invokeOutboundPolicy: (policyName: string, response: Response, request: ZuploRequest) => Promise<Response>;
|
|
1082
1084
|
readonly waitUntil: WaitUntilFunc;
|
|
1083
1085
|
/**
|
|
1084
1086
|
* Fires just before the response is sent. Response can be modified.
|