UNPKG

altair-graphql-core

Version:

Several of the core logic for altair graphql client

28 lines 1 kB
import { literal, object, string } from 'zod/v4'; import { AuthorizationProvider, baseAuthorizationProviderInputSchema, } from '../authorization-provider'; export const apiKeyAuthorizationProviderInputSchema = baseAuthorizationProviderInputSchema.extend({ type: literal('api-key'), data: object({ headerName: string().meta({ description: 'Name of the header to set the API key in', }), headerValue: string().meta({ description: 'Value of the API key to set in the header', }), }), }); export default class ApiKeyAuthorizationProvider extends AuthorizationProvider { async execute(options) { if (!options.data?.headerName || !options.data?.headerValue) { return { headers: {}, }; } return { headers: { [options.data.headerName]: this.hydrate(options.data.headerValue), }, }; } } //# sourceMappingURL=api-key.js.map