Files
klz-cables.com/.pnpm-store/v10/files/26/a246b1cea0f4f1b69b9164ec7a9e6a8c72ec0b20ea86c256803c73e1146704bbd2c7cc8e3895d17e2e6da5df6bf35b54b4dce5ccb2d3d26a2303aa934a61b1
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

35 lines
1.0 KiB
Plaintext

import { GraphQLError } from '../../error/GraphQLError.mjs';
import { Kind } from '../../language/kinds.mjs';
import { isExecutableDefinitionNode } from '../../language/predicates.mjs';
/**
* Executable definitions
*
* A GraphQL document is only valid for execution if all definitions are either
* operation or fragment definitions.
*
* See https://spec.graphql.org/draft/#sec-Executable-Definitions
*/
export function ExecutableDefinitionsRule(context) {
return {
Document(node) {
for (const definition of node.definitions) {
if (!isExecutableDefinitionNode(definition)) {
const defName =
definition.kind === Kind.SCHEMA_DEFINITION ||
definition.kind === Kind.SCHEMA_EXTENSION
? 'schema'
: '"' + definition.name.value + '"';
context.reportError(
new GraphQLError(`The ${defName} definition is not executable.`, {
nodes: definition,
}),
);
}
}
return false;
},
};
}