@zuplo/runtime 5.1796.0 → 5.1797.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.