@zuplo/runtime 6.66.12 → 6.66.13
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 +37 -37
- package/out/esm/index.js.map +1 -1
- package/out/types/index.d.ts +56 -1
- package/package.json +1 -1
package/out/types/index.d.ts
CHANGED
|
@@ -2994,6 +2994,41 @@ declare interface HeaderCredentialsConfig {
|
|
|
2994
2994
|
headerName: string;
|
|
2995
2995
|
}
|
|
2996
2996
|
|
|
2997
|
+
/**
|
|
2998
|
+
* Sets HTTP deprecation headers on the outgoing response following the IETF
|
|
2999
|
+
* HTTP Deprecation Header standard. Supports the Deprecation, Sunset, and Link
|
|
3000
|
+
* headers.
|
|
3001
|
+
*
|
|
3002
|
+
* @title HTTP Deprecation
|
|
3003
|
+
* @public
|
|
3004
|
+
* @param response - The Response
|
|
3005
|
+
* @param request - The ZuploRequest
|
|
3006
|
+
* @param context - The ZuploContext
|
|
3007
|
+
* @param options - The policy options set in policies.json
|
|
3008
|
+
* @param policyName - The name of the policy as set in policies.json
|
|
3009
|
+
* @returns A Response with deprecation headers
|
|
3010
|
+
*/
|
|
3011
|
+
export declare const HttpDeprecationOutboundPolicy: OutboundPolicyHandler<HttpDeprecationOutboundPolicyOptions>;
|
|
3012
|
+
|
|
3013
|
+
/**
|
|
3014
|
+
* The options for the HTTP Deprecation outbound policy.
|
|
3015
|
+
* @public
|
|
3016
|
+
*/
|
|
3017
|
+
export declare interface HttpDeprecationOutboundPolicyOptions {
|
|
3018
|
+
/**
|
|
3019
|
+
* The deprecation value. Use `true` for already deprecated, an ISO 8601 date string for a specific date, or a Unix timestamp number.
|
|
3020
|
+
*/
|
|
3021
|
+
deprecation: true | string | number;
|
|
3022
|
+
/**
|
|
3023
|
+
* An ISO 8601 date string indicating when the endpoint will be removed. Sets the Sunset header.
|
|
3024
|
+
*/
|
|
3025
|
+
sunset?: string;
|
|
3026
|
+
/**
|
|
3027
|
+
* A URL to documentation about the deprecation or migration guide. Sets the Link header.
|
|
3028
|
+
*/
|
|
3029
|
+
link?: string;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
2997
3032
|
/**
|
|
2998
3033
|
* @public
|
|
2999
3034
|
*/
|
|
@@ -7377,7 +7412,9 @@ declare type RateLimitFunction<T extends CustomRateLimitDetailsBase> = (
|
|
|
7377
7412
|
policyName: string
|
|
7378
7413
|
) =>
|
|
7379
7414
|
| (Partial<T> & CustomRateLimitDetailsBase)
|
|
7380
|
-
|
|
|
7415
|
+
| undefined
|
|
7416
|
+
| null
|
|
7417
|
+
| Promise<(Partial<T> & CustomRateLimitDetailsBase) | undefined | null>;
|
|
7381
7418
|
|
|
7382
7419
|
/**
|
|
7383
7420
|
* Adds the retry-after header.
|
|
@@ -7476,6 +7513,24 @@ declare type RateLimitHeaderMode_2 = "none" | "retry-after";
|
|
|
7476
7513
|
* }
|
|
7477
7514
|
* };
|
|
7478
7515
|
* ```
|
|
7516
|
+
*
|
|
7517
|
+
* @example
|
|
7518
|
+
* ```typescript
|
|
7519
|
+
* // Skip rate limiting for specific conditions (return undefined)
|
|
7520
|
+
* import { CustomRateLimitFunction, CustomRateLimitDetails } from "@zuplo/runtime";
|
|
7521
|
+
*
|
|
7522
|
+
* export const customRateLimitWithSkip: CustomRateLimitFunction = async (
|
|
7523
|
+
* request,
|
|
7524
|
+
* context
|
|
7525
|
+
* ): Promise<CustomRateLimitDetails | undefined> => {
|
|
7526
|
+
* // Skip rate limiting for whitelisted IPs or internal services
|
|
7527
|
+
* const clientIp = request.headers.get("cf-connecting-ip");
|
|
7528
|
+
* if (isWhitelisted(clientIp)) {
|
|
7529
|
+
* return undefined; // Skip rate limiting entirely - no Redis call
|
|
7530
|
+
* }
|
|
7531
|
+
* return { key: `user-${request.user?.sub}` };
|
|
7532
|
+
* };
|
|
7533
|
+
* ```
|
|
7479
7534
|
*/
|
|
7480
7535
|
declare const RateLimitInboundPolicy: InboundPolicyHandler<RateLimitInboundPolicyOptions>;
|
|
7481
7536
|
export { RateLimitInboundPolicy as BasicRateLimitInboundPolicy };
|