UNPKG

@graphql-hive/cli

Version:

A CLI util to manage and control your GraphQL Hive

63 lines 3.18 kB
import { z } from 'zod'; declare const ConfigModel: z.ZodObject<{ registry: z.ZodOptional<z.ZodObject<{ endpoint: z.ZodOptional<z.ZodString>; accessToken: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { endpoint?: string | undefined; accessToken?: string | undefined; }, { endpoint?: string | undefined; accessToken?: string | undefined; }>>; cdn: z.ZodOptional<z.ZodObject<{ endpoint: z.ZodOptional<z.ZodString>; accessToken: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { endpoint?: string | undefined; accessToken?: string | undefined; }, { endpoint?: string | undefined; accessToken?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { registry?: { endpoint?: string | undefined; accessToken?: string | undefined; } | undefined; cdn?: { endpoint?: string | undefined; accessToken?: string | undefined; } | undefined; }, { registry?: { endpoint?: string | undefined; accessToken?: string | undefined; } | undefined; cdn?: { endpoint?: string | undefined; accessToken?: string | undefined; } | undefined; }>; export type ConfigModelType = z.TypeOf<typeof ConfigModel>; type BuildPropertyPath<TObject extends z.ZodObject<any>> = `.${GetConfigurationKeys<TObject>}`; type GetConfigurationKeys<T extends z.ZodObject<{ [key: string]: z.ZodType<any, any>; }>> = T extends z.ZodObject<infer TObjectShape> ? TObjectShape extends Record<infer TKey, infer TObjectPropertyType> ? TKey extends string ? `${TKey}${TObjectPropertyType extends z.ZodObject<any> ? BuildPropertyPath<TObjectPropertyType> : TObjectPropertyType extends z.ZodOptional<infer TOptionalInnerObjectPropertyType> ? TOptionalInnerObjectPropertyType extends z.ZodObject<any> ? BuildPropertyPath<TOptionalInnerObjectPropertyType> : '' : ''}` : never : never : never; type GetZodValueType<TString extends string, ConfigurationModelType extends z.ZodObject<any>> = TString extends `${infer TKey}.${infer TNextKey}` ? ConfigurationModelType extends z.ZodObject<infer InnerType> ? InnerType[TKey] extends z.ZodObject<any> ? GetZodValueType<TNextKey, InnerType[TKey]> : InnerType[TKey] extends z.ZodOptional<infer OptionalInner> ? OptionalInner extends z.ZodObject<any> ? GetZodValueType<TNextKey, OptionalInner> : never : never : never : ConfigurationModelType extends z.ZodObject<infer InnerType> ? z.TypeOf<InnerType[TString]> : never; export type GetConfigurationValueType<TString extends string> = GetZodValueType<TString, typeof ConfigModel>; export type ValidConfigurationKeys = GetConfigurationKeys<typeof ConfigModel>; export declare const graphqlEndpoint = "https://app.graphql-hive.com/graphql"; export declare class Config { private cache?; private filepath; constructor({ filepath, rootDir }: { filepath?: string; rootDir: string; }); get<TKey extends ValidConfigurationKeys>(key: TKey): GetZodValueType<TKey, typeof ConfigModel> | null; private readSpace; private read; } export {}; //# sourceMappingURL=config.d.ts.map