@zuplo/runtime 5.1796.0 → 5.1800.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/index.d.ts CHANGED
@@ -2166,6 +2166,34 @@ declare type HttpStatusCodeRangeDefinition = "1XX" | "2XX" | "3XX" | "4XX" | "5X
2166
2166
 
2167
2167
  /**
2168
2168
  * @beta
2169
+ * A policy that can modify the incoming HTTP request before it is sent to
2170
+ * the handler. If a response is returned, the request is short-circuited and
2171
+ * the response is returned to the client. If a Request is returned, policies
2172
+ * or a handler that follow are executed.
2173
+ */
2174
+ export declare abstract class InboundPolicy<TOptions = any> extends PolicyBase<TOptions> {
2175
+ /**
2176
+ * The handler that is called each time this policy is invoked
2177
+ *
2178
+ * @param request - The incoming Request
2179
+ * @param context - The current context of the Request
2180
+ * @returns A Response or Request object
2181
+ */
2182
+ abstract handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest | Response>;
2183
+ }
2184
+
2185
+ /**
2186
+ * @public
2187
+ * A policy that can modify the incoming HTTP request before it is sent to
2188
+ * the handler. If a response is returned, the request is short-circuited and
2189
+ * the response is returned to the client. If a Request is returned, policies
2190
+ * or a handler that follow are executed.
2191
+ *
2192
+ * @param request - The incoming Request
2193
+ * @param context - The current context of the Request
2194
+ * @param options - The configuration options for the policy
2195
+ * @param policyName - The name set on the policy in the configuration
2196
+ * @returns A Response or Request object
2169
2197
  */
2170
2198
  export declare interface InboundPolicyHandler<TOptions = any> {
2171
2199
  (request: ZuploRequest, context: ZuploContext, options: TOptions, policyName: string): Promise<ZuploRequest | Response>;
@@ -2689,6 +2717,34 @@ export declare interface OpenIdJwtInboundPolicyOptions {
2689
2717
 
2690
2718
  export declare const originalFetch: typeof fetch;
2691
2719
 
2720
+ /**
2721
+ * @beta
2722
+ * A policy that can modify the outgoing HTTP response before it is returned
2723
+ * to the client.
2724
+ */
2725
+ export declare abstract class OutboundPolicy<TOptions = any> extends PolicyBase<TOptions> {
2726
+ /**
2727
+ * The handler that is called each time this policy is invoked
2728
+ *
2729
+ * @param response - The outgoing Response
2730
+ * @param request - The incoming Request
2731
+ * @param context - The current context of the Request
2732
+ */
2733
+ abstract handler(response: Response, request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest | Response>;
2734
+ }
2735
+
2736
+ /**
2737
+ * @public
2738
+ * A policy that can modify the outgoing HTTP response before it is returned
2739
+ * to the client.
2740
+ *
2741
+ * @param response - The outgoing Response
2742
+ * @param request - The incoming Request
2743
+ * @param context - The current context of the Request
2744
+ * @param options - The configuration options for the policy
2745
+ * @param policyName - The name set on the policy in the configuration
2746
+ * @returns A Response object
2747
+ */
2692
2748
  export declare interface OutboundPolicyHandler<TOptions = any> {
2693
2749
  (response: Response, request: ZuploRequest, context: ZuploContext, options: TOptions, policyName: string): Promise<Response>;
2694
2750
  }
@@ -2727,6 +2783,8 @@ declare interface ParsedRouteData extends Omit<RouteData, "corsPolicies"> {
2727
2783
  corsPolicies: ParsedCorsPolicyConfiguration[];
2728
2784
  }
2729
2785
 
2786
+ /* Excluded from this release type: PolicyBase */
2787
+
2730
2788
  export declare interface PolicyConfiguration {
2731
2789
  name: string;
2732
2790
  policyType: string;
@@ -3624,7 +3682,9 @@ export declare interface SleepInboundPolicyOptions {
3624
3682
  * @param policyName - The name of the policy as set in policies.json
3625
3683
  * @returns A Request or a Response
3626
3684
  */
3627
- export declare const StripeWebhookVerificationInboundPolicy: InboundPolicyHandler<StripeWebhookVerificationInboundPolicyOptions>;
3685
+ export declare class StripeWebhookVerificationInboundPolicy extends InboundPolicy<StripeWebhookVerificationInboundPolicyOptions> {
3686
+ handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest<RequestGeneric> | Response>;
3687
+ }
3628
3688
 
3629
3689
  /**
3630
3690
  * The options for this policy.
@@ -4072,6 +4132,10 @@ export declare class VMWareLogInsightLoggingPlugin extends LogPlugin {
4072
4132
  /* Excluded from this release type: getTransport */
4073
4133
  }
4074
4134
 
4135
+ declare interface WaitUntilFunc {
4136
+ (promise: Promise<any>): void;
4137
+ }
4138
+
4075
4139
  /**
4076
4140
  * Handle websocket requests to a different url
4077
4141
  * @param request - The ZuploRequest
@@ -4127,7 +4191,7 @@ export declare interface ZuploContext extends EventTarget {
4127
4191
  readonly custom: Record<string, any>;
4128
4192
  readonly incomingRequestProperties: IncomingRequestProperties;
4129
4193
  readonly invokeInboundPolicy: (policyName: string, request: ZuploRequest) => Promise<Response | ZuploRequest>;
4130
- readonly waitUntil: (promise: Promise<any>) => void;
4194
+ readonly waitUntil: WaitUntilFunc;
4131
4195
  /**
4132
4196
  * Fires just before the response is sent. Response can be modified.
4133
4197
  */
@@ -4159,6 +4223,10 @@ export declare interface ZuploContext extends EventTarget {
4159
4223
  removeEventListener<Type extends keyof Record<string, Event>>(type: Type, handler: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
4160
4224
  }
4161
4225
 
4226
+ declare interface ZuploEventContext {
4227
+ waitUntil: WaitUntilFunc;
4228
+ }
4229
+
4162
4230
  /**
4163
4231
  * ZuploRequest includes various parsed objects from the
4164
4232
  * incoming Request. This object inherits from the web