@zuplo/runtime 5.2361.0 → 5.2363.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/cjs/index.js +19 -18
- package/out/esm/index.js +17 -16
- package/out/types/index.d.ts +81 -0
- package/package.json +1 -1
package/out/types/index.d.ts
CHANGED
|
@@ -1433,6 +1433,18 @@ export declare function getIdForRefSchema(oasFileName: string, ref: string): str
|
|
|
1433
1433
|
|
|
1434
1434
|
export declare function getIdForRequestBodySchema(path: string, operation: string, contentType: string): string;
|
|
1435
1435
|
|
|
1436
|
+
/**
|
|
1437
|
+
* The function to get the anchor date for the quota.
|
|
1438
|
+
* @public
|
|
1439
|
+
*/
|
|
1440
|
+
export declare type GetQuotaAnchorDateFunction = (request: ZuploRequest, context: ZuploContext, policyName: string) => Promise<Date | undefined>;
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* The function to get the quota details for the quota.
|
|
1444
|
+
* @public
|
|
1445
|
+
*/
|
|
1446
|
+
export declare type GetQuotaDetailFunction = (request: ZuploRequest, context: ZuploContext, policyName: string) => Promise<QuotaDetail>;
|
|
1447
|
+
|
|
1436
1448
|
export declare function getRawOperationDataIdentifierName(oasFileName: string, path: string, operation: string): string;
|
|
1437
1449
|
|
|
1438
1450
|
declare interface GoogleCloudLoggingOptions {
|
|
@@ -3969,6 +3981,75 @@ export declare interface PropelAuthJwtInboundPolicyOptions {
|
|
|
3969
3981
|
verifierKey: string;
|
|
3970
3982
|
}
|
|
3971
3983
|
|
|
3984
|
+
export declare interface QuotaDetail {
|
|
3985
|
+
key: string;
|
|
3986
|
+
allowances: {
|
|
3987
|
+
[k: string]: number;
|
|
3988
|
+
};
|
|
3989
|
+
}
|
|
3990
|
+
|
|
3991
|
+
/**
|
|
3992
|
+
* The Quota policy enables you to set monthly, weekly, daily or hourly quotas on your API.
|
|
3993
|
+
*
|
|
3994
|
+
* @title Quota
|
|
3995
|
+
* @beta
|
|
3996
|
+
* @param request - The ZuploRequest
|
|
3997
|
+
* @param context - The ZuploContext
|
|
3998
|
+
* @param options - The policy options set in policies.json
|
|
3999
|
+
* @param policyName - The name of the policy as set in policies.json
|
|
4000
|
+
* @returns A Request or a Response
|
|
4001
|
+
*/
|
|
4002
|
+
export declare class QuotaInboundPolicy extends InboundPolicy<QuotaInboundPolicyOptions> {
|
|
4003
|
+
constructor(options: QuotaInboundPolicyOptions, policyName: string);
|
|
4004
|
+
handler(request: ZuploRequest<RequestGeneric>, context: ZuploContext): Promise<ZuploRequest<RequestGeneric> | Response>;
|
|
4005
|
+
static setMeters(context: ZuploContext, meters: Record<string, number>): void;
|
|
4006
|
+
}
|
|
4007
|
+
|
|
4008
|
+
/**
|
|
4009
|
+
* The options for this policy.
|
|
4010
|
+
*/
|
|
4011
|
+
export declare interface QuotaInboundPolicyOptions {
|
|
4012
|
+
/**
|
|
4013
|
+
* The period of the quota.
|
|
4014
|
+
*/
|
|
4015
|
+
period: "hourly" | "daily" | "weekly" | "monthly";
|
|
4016
|
+
/**
|
|
4017
|
+
* The quota by.
|
|
4018
|
+
*/
|
|
4019
|
+
quotaBy: "user" | "function";
|
|
4020
|
+
/**
|
|
4021
|
+
* How the policy determines the anchor date for ongoing quota cycles - defaults to `first-api-call` which uses the first API call for this key.
|
|
4022
|
+
*/
|
|
4023
|
+
quotaAnchorMode?: "first-api-call" | "function";
|
|
4024
|
+
/**
|
|
4025
|
+
* The allowances for the quota.
|
|
4026
|
+
*/
|
|
4027
|
+
allowances?: {
|
|
4028
|
+
[k: string]: number;
|
|
4029
|
+
};
|
|
4030
|
+
/**
|
|
4031
|
+
* A list of successful status codes and ranges "200-299, 304" that should trigger a quota increment.
|
|
4032
|
+
*/
|
|
4033
|
+
quotaOnStatusCodes?: string | number[];
|
|
4034
|
+
/**
|
|
4035
|
+
* The module and functions to dynamically set the anchor date and/or the key/allowances for this request.
|
|
4036
|
+
*/
|
|
4037
|
+
identifier?: {
|
|
4038
|
+
/**
|
|
4039
|
+
* Specifies the module to load your custom functions, in the format `$import(./modules/my-module)`.
|
|
4040
|
+
*/
|
|
4041
|
+
module: string;
|
|
4042
|
+
/**
|
|
4043
|
+
* used when quotaAnchorMode is `function`. Specifies the export to load your custom function to get the anchor date.
|
|
4044
|
+
*/
|
|
4045
|
+
getAnchorDateExport?: string;
|
|
4046
|
+
/**
|
|
4047
|
+
* used when quotaBy is `function`. Specifies the export to load your custom function to get the quota detail.
|
|
4048
|
+
*/
|
|
4049
|
+
getQuotaDetailExport?: string;
|
|
4050
|
+
};
|
|
4051
|
+
}
|
|
4052
|
+
|
|
3972
4053
|
/**
|
|
3973
4054
|
* The identifying element of the request that enforces distinct rate limits. For example, you can limit by `user`, `ip`, `function` or `all` - function allows you to specify a simple function to create a string identifier to create a rate-limit group.
|
|
3974
4055
|
*/
|