Files
klz-cables.com/.pnpm-store/v10/files/e3/8d0641b28b19b02fd92db04d61d76906a89b28844bb2ec82fb9423719b03b79b7cffa8f0b6f8e7d68876b1f2258bd4cff553c0f45ef06195f04880efaf4d54
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

43 lines
1.1 KiB
Plaintext

'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
exports.LoneAnonymousOperationRule = LoneAnonymousOperationRule;
var _GraphQLError = require('../../error/GraphQLError.js');
var _kinds = require('../../language/kinds.js');
/**
* Lone anonymous operation
*
* A GraphQL document is only valid if when it contains an anonymous operation
* (the query short-hand) that it contains only that one operation definition.
*
* See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation
*/
function LoneAnonymousOperationRule(context) {
let operationCount = 0;
return {
Document(node) {
operationCount = node.definitions.filter(
(definition) => definition.kind === _kinds.Kind.OPERATION_DEFINITION,
).length;
},
OperationDefinition(node) {
if (!node.name && operationCount > 1) {
context.reportError(
new _GraphQLError.GraphQLError(
'This anonymous operation must be the only defined operation.',
{
nodes: node,
},
),
);
}
},
};
}