UNPKG

@google-cloud/recaptcha-edge

Version:

A reCAPTCHA Enterprise Typescript library for Edge Compute Platforms.

62 lines (61 loc) 2.5 kB
/** * 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 Schema and types representing reCAPTCHA FirewallPolicy actions. */ export interface AllowAction { allow: object; } export interface BlockAction { block: object; } export interface SetHeaderAction { setHeader: { key?: string; value?: string; }; } export interface RedirectAction { redirect: object; } export interface SubstituteAction { substitute: { path: string; }; } export interface InjectJsAction { injectjs: object; } export type Action = AllowAction | BlockAction | SetHeaderAction | RedirectAction | SubstituteAction | InjectJsAction; /** Helper function to create an AllowAction */ export declare function createAllowAction(): AllowAction; export declare function isAllowAction(o: object): o is AllowAction; /** Helper function to create a BlockAction */ export declare function createBlockAction(): BlockAction; export declare function isBlockAction(o: object): o is BlockAction; /** Helper function to create a Redirect */ export declare function createRedirectAction(): RedirectAction; export declare function isRedirectAction(o: object): o is RedirectAction; /** Helper function to create a InjectJs */ export declare function createInjectJsAction(): InjectJsAction; export declare function isInjectJsAction(o: object): o is InjectJsAction; export declare function isSubstituteAction(o: object): o is SubstituteAction; export declare function isSetHeaderAction(o: object): o is SetHeaderAction; export declare function isTerminalAction(o: object): o is AllowAction | BlockAction | RedirectAction; export type RequestNonTerminalAction = SetHeaderAction | SubstituteAction; export type ResponseNonTerminalAction = InjectJsAction; export declare function isRequestNonTerminalAction(o: object): o is SetHeaderAction | SubstituteAction; export declare function isResponseNonTerminalAction(o: object): o is InjectJsAction;