UNPKG

@genkit-ai/core

Version:

Genkit AI framework core libraries.

60 lines (56 loc) 1.97 kB
import * as z from 'zod'; /** * 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. */ /** * Enumeration of response status codes. */ declare enum StatusCodes { OK = 0, CANCELLED = 1, UNKNOWN = 2, INVALID_ARGUMENT = 3, DEADLINE_EXCEEDED = 4, NOT_FOUND = 5, ALREADY_EXISTS = 6, PERMISSION_DENIED = 7, UNAUTHENTICATED = 16, RESOURCE_EXHAUSTED = 8, FAILED_PRECONDITION = 9, ABORTED = 10, OUT_OF_RANGE = 11, UNIMPLEMENTED = 12, INTERNAL = 13, UNAVAILABLE = 14, DATA_LOSS = 15 } declare const StatusNameSchema: z.ZodEnum<["OK", "CANCELLED", "UNKNOWN", "INVALID_ARGUMENT", "DEADLINE_EXCEEDED", "NOT_FOUND", "ALREADY_EXISTS", "PERMISSION_DENIED", "UNAUTHENTICATED", "RESOURCE_EXHAUSTED", "FAILED_PRECONDITION", "ABORTED", "OUT_OF_RANGE", "UNIMPLEMENTED", "INTERNAL", "UNAVAILABLE", "DATA_LOSS"]>; type StatusName = z.infer<typeof StatusNameSchema>; declare function httpStatusCode(status: StatusName): number; declare const StatusSchema: z.ZodObject<{ code: z.ZodNativeEnum<typeof StatusCodes>; message: z.ZodString; details: z.ZodOptional<z.ZodAny>; }, "strip", z.ZodTypeAny, { code: StatusCodes; message: string; details?: any; }, { code: StatusCodes; message: string; details?: any; }>; type Status = z.infer<typeof StatusSchema>; export { type Status, StatusCodes, type StatusName, StatusNameSchema, StatusSchema, httpStatusCode };