altair-graphql-core
Version:
Several of the core logic for altair graphql client
32 lines • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.apiKeyAuthorizationProviderInputSchema = void 0;
const v4_1 = require("zod/v4");
const authorization_provider_1 = require("../authorization-provider");
exports.apiKeyAuthorizationProviderInputSchema = authorization_provider_1.baseAuthorizationProviderInputSchema.extend({
type: (0, v4_1.literal)('api-key'),
data: (0, v4_1.object)({
headerName: (0, v4_1.string)().meta({
description: 'Name of the header to set the API key in',
}),
headerValue: (0, v4_1.string)().meta({
description: 'Value of the API key to set in the header',
}),
}),
});
class ApiKeyAuthorizationProvider extends authorization_provider_1.AuthorizationProvider {
async execute(options) {
if (!options.data?.headerName || !options.data?.headerValue) {
return {
headers: {},
};
}
return {
headers: {
[options.data.headerName]: this.hydrate(options.data.headerValue),
},
};
}
}
exports.default = ApiKeyAuthorizationProvider;
//# sourceMappingURL=api-key.js.map