@google-cloud/recaptcha-edge
Version:
A reCAPTCHA Enterprise Typescript library for Edge Compute Platforms.
257 lines (256 loc) • 7.99 kB
TypeScript
/**
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Helper functions and types related to the ListFirewallPolicies RPC.
*/
import { z } from "zod";
import { RecaptchaContext } from "./index";
/** Zod Schema for ListFirewallPoliciesResponse */
export declare const ListFirewallPoliciesResponseSchema: z.ZodObject<{
firewallPolicies: z.ZodArray<z.ZodObject<{
name: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
path: z.ZodOptional<z.ZodString>;
condition: z.ZodOptional<z.ZodString>;
actions: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
allow: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
type: z.ZodDefault<z.ZodLiteral<"allow">>;
}, "strip", z.ZodTypeAny, {
type: "allow";
allow: {};
}, {
allow: {};
type?: "allow" | undefined;
}>, z.ZodObject<{
block: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
type: z.ZodDefault<z.ZodLiteral<"block">>;
}, "strip", z.ZodTypeAny, {
type: "block";
block: {};
}, {
block: {};
type?: "block" | undefined;
}>]>, z.ZodObject<{
challengepage: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
type: z.ZodDefault<z.ZodLiteral<"challengepage">>;
}, "strip", z.ZodTypeAny, {
type: "challengepage";
challengepage: {};
}, {
challengepage: {};
type?: "challengepage" | undefined;
}>]>, z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
setHeader: z.ZodObject<{
key: z.ZodString;
value: z.ZodString;
}, "strip", z.ZodTypeAny, {
value: string;
key: string;
}, {
value: string;
key: string;
}>;
type: z.ZodDefault<z.ZodLiteral<"setHeader">>;
}, "strip", z.ZodTypeAny, {
type: "setHeader";
setHeader: {
value: string;
key: string;
};
}, {
setHeader: {
value: string;
key: string;
};
type?: "setHeader" | undefined;
}>, z.ZodObject<{
redirect: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
type: z.ZodDefault<z.ZodLiteral<"redirect">>;
}, "strip", z.ZodTypeAny, {
type: "redirect";
redirect: {};
}, {
redirect: {};
type?: "redirect" | undefined;
}>]>, z.ZodObject<{
substitute: z.ZodObject<{
path: z.ZodString;
}, "strip", z.ZodTypeAny, {
path: string;
}, {
path: string;
}>;
type: z.ZodDefault<z.ZodLiteral<"substitute">>;
}, "strip", z.ZodTypeAny, {
type: "substitute";
substitute: {
path: string;
};
}, {
substitute: {
path: string;
};
type?: "substitute" | undefined;
}>]>]>, z.ZodObject<{
injectjs: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
type: z.ZodDefault<z.ZodLiteral<"injectjs">>;
}, "strip", z.ZodTypeAny, {
type: "injectjs";
injectjs: {};
}, {
injectjs: {};
type?: "injectjs" | undefined;
}>]>, "many">>;
}, "strip", z.ZodTypeAny, {
path?: string | undefined;
name?: string | undefined;
description?: string | undefined;
condition?: string | undefined;
actions?: ({
type: "allow";
allow: {};
} | {
type: "block";
block: {};
} | {
type: "challengepage";
challengepage: {};
} | {
type: "setHeader";
setHeader: {
value: string;
key: string;
};
} | {
type: "redirect";
redirect: {};
} | {
type: "substitute";
substitute: {
path: string;
};
} | {
type: "injectjs";
injectjs: {};
})[] | undefined;
}, {
path?: string | undefined;
name?: string | undefined;
description?: string | undefined;
condition?: string | undefined;
actions?: ({
allow: {};
type?: "allow" | undefined;
} | {
block: {};
type?: "block" | undefined;
} | {
challengepage: {};
type?: "challengepage" | undefined;
} | {
setHeader: {
value: string;
key: string;
};
type?: "setHeader" | undefined;
} | {
redirect: {};
type?: "redirect" | undefined;
} | {
substitute: {
path: string;
};
type?: "substitute" | undefined;
} | {
injectjs: {};
type?: "injectjs" | undefined;
})[] | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
firewallPolicies: {
path?: string | undefined;
name?: string | undefined;
description?: string | undefined;
condition?: string | undefined;
actions?: ({
type: "allow";
allow: {};
} | {
type: "block";
block: {};
} | {
type: "challengepage";
challengepage: {};
} | {
type: "setHeader";
setHeader: {
value: string;
key: string;
};
} | {
type: "redirect";
redirect: {};
} | {
type: "substitute";
substitute: {
path: string;
};
} | {
type: "injectjs";
injectjs: {};
})[] | undefined;
}[];
}, {
firewallPolicies: {
path?: string | undefined;
name?: string | undefined;
description?: string | undefined;
condition?: string | undefined;
actions?: ({
allow: {};
type?: "allow" | undefined;
} | {
block: {};
type?: "block" | undefined;
} | {
challengepage: {};
type?: "challengepage" | undefined;
} | {
setHeader: {
value: string;
key: string;
};
type?: "setHeader" | undefined;
} | {
redirect: {};
type?: "redirect" | undefined;
} | {
substitute: {
path: string;
};
type?: "substitute" | undefined;
} | {
injectjs: {};
type?: "injectjs" | undefined;
})[] | undefined;
}[];
}>;
/** Response type from ListFirewallPolicies RPC */
export type ListFirewallPoliciesResponse = z.infer<typeof ListFirewallPoliciesResponseSchema>;
/**
* Call the reCAPTCHA API to list firewall policies.
*/
export declare function callListFirewallPolicies(context: RecaptchaContext): Promise<ListFirewallPoliciesResponse>;