UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

82 lines (75 loc) 2.58 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../lib/schemas.js"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export const FlagsSDKKeyWithSecretsType = { Client: "client", Mobile: "mobile", Server: "server", } as const; export type FlagsSDKKeyWithSecretsType = ClosedEnum< typeof FlagsSDKKeyWithSecretsType >; /** * Representation of a Flags SDK key returned by CREATE. Includes cleartext secrets (`keyValue`, `tokenValue`, `connectionString`) which are only ever disclosed once, on creation. */ export type FlagsSDKKeyWithSecrets = { hashKey: string; projectId: string; type: FlagsSDKKeyWithSecretsType; environment: string; createdBy: string; createdAt: number; updatedAt: number; label?: string | undefined; deletedAt?: number | undefined; /** * Partially-masked representation of the SDK key value, safe to display in UIs. The value is the `vf_<type>_` prefix followed by the first 3 characters of the secret portion and a fixed 8-character `*` mask (e.g. `vf_server_abc********`). */ partialKeyValue: string; /** * Cleartext value of the SDK key. */ keyValue: string; /** * Cleartext value of the Global Config token, when the project has a Global Config connection. */ tokenValue?: string | undefined; }; /** @internal */ export const FlagsSDKKeyWithSecretsType$inboundSchema: z.ZodNativeEnum< typeof FlagsSDKKeyWithSecretsType > = z.nativeEnum(FlagsSDKKeyWithSecretsType); /** @internal */ export const FlagsSDKKeyWithSecrets$inboundSchema: z.ZodType< FlagsSDKKeyWithSecrets, z.ZodTypeDef, unknown > = z.object({ hashKey: types.string(), projectId: types.string(), type: FlagsSDKKeyWithSecretsType$inboundSchema, environment: types.string(), createdBy: types.string(), createdAt: types.number(), updatedAt: types.number(), label: types.optional(types.string()), deletedAt: types.optional(types.number()), partialKeyValue: types.string(), keyValue: types.string(), tokenValue: types.optional(types.string()), }); export function flagsSDKKeyWithSecretsFromJSON( jsonString: string, ): SafeParseResult<FlagsSDKKeyWithSecrets, SDKValidationError> { return safeParse( jsonString, (x) => FlagsSDKKeyWithSecrets$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FlagsSDKKeyWithSecrets' from JSON`, ); }