@zuplo/runtime 6.66.12 → 6.66.14
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 +44 -44
- package/out/esm/index.js.map +1 -1
- package/out/types/index.d.ts +108 -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
|
*/
|
|
@@ -5744,6 +5779,25 @@ export declare interface MoesifInboundPolicyOptions {
|
|
|
5744
5779
|
*/
|
|
5745
5780
|
export declare class MonetizationInboundPolicy extends InboundPolicy<MonetizationInboundPolicyOptions> {
|
|
5746
5781
|
#private;
|
|
5782
|
+
/**
|
|
5783
|
+
* Set the monetization subscription data for the current request.
|
|
5784
|
+
*
|
|
5785
|
+
* @param context - The ZuploContext
|
|
5786
|
+
* @param subscription - The subscription to set.
|
|
5787
|
+
*/
|
|
5788
|
+
static setSubscriptionData(
|
|
5789
|
+
context: ZuploContext,
|
|
5790
|
+
subscription: MonetizationSubscription
|
|
5791
|
+
): void;
|
|
5792
|
+
/**
|
|
5793
|
+
* Get the monetization subscription data for the current request.
|
|
5794
|
+
*
|
|
5795
|
+
* @param context - The ZuploContext
|
|
5796
|
+
* @returns The subscription data or undefined
|
|
5797
|
+
*/
|
|
5798
|
+
static getSubscriptionData(
|
|
5799
|
+
context: ZuploContext
|
|
5800
|
+
): MonetizationSubscription | undefined;
|
|
5747
5801
|
constructor(options: MonetizationInboundPolicyOptions, policyName: string);
|
|
5748
5802
|
handler(
|
|
5749
5803
|
request: ZuploRequest,
|
|
@@ -5784,6 +5838,39 @@ export declare interface MonetizationInboundPolicyOptions {
|
|
|
5784
5838
|
meterOnStatusCodes?: string | number[];
|
|
5785
5839
|
}
|
|
5786
5840
|
|
|
5841
|
+
export declare interface MonetizationSubscription {
|
|
5842
|
+
paymentStatus?: {
|
|
5843
|
+
isFirstPayment: boolean;
|
|
5844
|
+
lastPaymentFailedAt?: string;
|
|
5845
|
+
lastPaymentSucceededAt?: string;
|
|
5846
|
+
status: "paid" | "not_required" | "pending" | "failed" | "uncollectible";
|
|
5847
|
+
};
|
|
5848
|
+
id: string;
|
|
5849
|
+
customerId: string;
|
|
5850
|
+
name: string;
|
|
5851
|
+
status: string;
|
|
5852
|
+
currency: string;
|
|
5853
|
+
billingCadence: string;
|
|
5854
|
+
activeFrom: string;
|
|
5855
|
+
activeTo?: string;
|
|
5856
|
+
plan: {
|
|
5857
|
+
id: string;
|
|
5858
|
+
name: string;
|
|
5859
|
+
description?: string;
|
|
5860
|
+
};
|
|
5861
|
+
entitlements: Record<
|
|
5862
|
+
string,
|
|
5863
|
+
{
|
|
5864
|
+
balance: number;
|
|
5865
|
+
hasAccess: boolean;
|
|
5866
|
+
overage: number;
|
|
5867
|
+
usage: number;
|
|
5868
|
+
}
|
|
5869
|
+
>;
|
|
5870
|
+
createdAt: string;
|
|
5871
|
+
updatedAt: string;
|
|
5872
|
+
}
|
|
5873
|
+
|
|
5787
5874
|
declare interface MultiRequests {
|
|
5788
5875
|
RequestReference: RequestReference;
|
|
5789
5876
|
}
|
|
@@ -7377,7 +7464,9 @@ declare type RateLimitFunction<T extends CustomRateLimitDetailsBase> = (
|
|
|
7377
7464
|
policyName: string
|
|
7378
7465
|
) =>
|
|
7379
7466
|
| (Partial<T> & CustomRateLimitDetailsBase)
|
|
7380
|
-
|
|
|
7467
|
+
| undefined
|
|
7468
|
+
| null
|
|
7469
|
+
| Promise<(Partial<T> & CustomRateLimitDetailsBase) | undefined | null>;
|
|
7381
7470
|
|
|
7382
7471
|
/**
|
|
7383
7472
|
* Adds the retry-after header.
|
|
@@ -7476,6 +7565,24 @@ declare type RateLimitHeaderMode_2 = "none" | "retry-after";
|
|
|
7476
7565
|
* }
|
|
7477
7566
|
* };
|
|
7478
7567
|
* ```
|
|
7568
|
+
*
|
|
7569
|
+
* @example
|
|
7570
|
+
* ```typescript
|
|
7571
|
+
* // Skip rate limiting for specific conditions (return undefined)
|
|
7572
|
+
* import { CustomRateLimitFunction, CustomRateLimitDetails } from "@zuplo/runtime";
|
|
7573
|
+
*
|
|
7574
|
+
* export const customRateLimitWithSkip: CustomRateLimitFunction = async (
|
|
7575
|
+
* request,
|
|
7576
|
+
* context
|
|
7577
|
+
* ): Promise<CustomRateLimitDetails | undefined> => {
|
|
7578
|
+
* // Skip rate limiting for whitelisted IPs or internal services
|
|
7579
|
+
* const clientIp = request.headers.get("cf-connecting-ip");
|
|
7580
|
+
* if (isWhitelisted(clientIp)) {
|
|
7581
|
+
* return undefined; // Skip rate limiting entirely - no Redis call
|
|
7582
|
+
* }
|
|
7583
|
+
* return { key: `user-${request.user?.sub}` };
|
|
7584
|
+
* };
|
|
7585
|
+
* ```
|
|
7479
7586
|
*/
|
|
7480
7587
|
declare const RateLimitInboundPolicy: InboundPolicyHandler<RateLimitInboundPolicyOptions>;
|
|
7481
7588
|
export { RateLimitInboundPolicy as BasicRateLimitInboundPolicy };
|