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

34 lines
1.1 KiB
Plaintext

import { GraphQLScalarType, Kind } from 'graphql';
import { createGraphQLError } from '../error.js';
export const GraphQLURL = /*#__PURE__*/ new GraphQLScalarType({
name: 'URL',
description: 'A field whose value conforms to the standard URL format as specified in RFC3986: https://www.ietf.org/rfc/rfc3986.txt.',
serialize(value) {
if (value === null) {
return value;
}
return new URL(value.toString()).toString();
},
parseValue: value => (value === null ? value : new URL(value.toString())),
parseLiteral(ast) {
if (ast.kind !== Kind.STRING) {
throw createGraphQLError(`Can only validate strings as URLs but got a: ${ast.kind}`, {
nodes: ast,
});
}
if (ast.value === null) {
return ast.value;
}
else {
return new URL(ast.value.toString());
}
},
extensions: {
codegenScalarType: 'URL | string',
jsonSchema: {
type: 'string',
format: 'uri',
},
},
});