Files
klz-cables.com/.pnpm-store/v10/files/c0/acf8d2a4dddd273c3f5ac31ada3bb5c109b6bca653467c4198668bf6df07d14b8f36cf7a10a0791d9a38675ca9d0e3441eb3c363f0b036bcf1a5abee11e717
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

55 lines
1.2 KiB
Plaintext

import { GraphQLError } from '../error/GraphQLError.mjs';
/**
* Extracts the root type of the operation from the schema.
*
* @deprecated Please use `GraphQLSchema.getRootType` instead. Will be removed in v17
*/
export function getOperationRootType(schema, operation) {
if (operation.operation === 'query') {
const queryType = schema.getQueryType();
if (!queryType) {
throw new GraphQLError(
'Schema does not define the required query root type.',
{
nodes: operation,
},
);
}
return queryType;
}
if (operation.operation === 'mutation') {
const mutationType = schema.getMutationType();
if (!mutationType) {
throw new GraphQLError('Schema is not configured for mutations.', {
nodes: operation,
});
}
return mutationType;
}
if (operation.operation === 'subscription') {
const subscriptionType = schema.getSubscriptionType();
if (!subscriptionType) {
throw new GraphQLError('Schema is not configured for subscriptions.', {
nodes: operation,
});
}
return subscriptionType;
}
throw new GraphQLError(
'Can only have query, mutation and subscription operations.',
{
nodes: operation,
},
);
}