Files
klz-cables.com/.pnpm-store/v10/files/37/48560159225cd4c1c2d8b7deec5e5e8bc06e13db7e95631bcec7c4a187cc56dbbb2572a985651cb971ca784930b2029debe10e40cf020aec7c20e20b2b94d3
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.8 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GraphQLTimeZone = void 0;
const graphql_1 = require("graphql");
const error_js_1 = require("../error.js");
const validateTimeZone = (str, ast) => {
if (!(Intl === null || Intl === void 0 ? void 0 : Intl.DateTimeFormat().resolvedOptions().timeZone)) {
throw (0, error_js_1.createGraphQLError)('Time zones are not available in this environment', ast
? {
nodes: ast,
}
: undefined);
}
try {
Intl.DateTimeFormat(undefined, { timeZone: str });
return str;
}
catch (ex) {
if (ex instanceof RangeError) {
throw (0, error_js_1.createGraphQLError)(`Value is not a valid IANA time zone: ${str}`, ast
? {
nodes: ast,
}
: undefined);
}
else {
throw (0, error_js_1.createGraphQLError)('Could not validate time zone.', ast
? {
nodes: ast,
}
: undefined);
}
}
};
exports.GraphQLTimeZone = new graphql_1.GraphQLScalarType({
name: 'TimeZone',
description: 'A field whose value exists in the standard IANA Time Zone Database: https://www.iana.org/time-zones',
serialize: validateTimeZone,
parseValue: validateTimeZone,
parseLiteral(ast) {
if (ast.kind !== graphql_1.Kind.STRING) {
throw (0, error_js_1.createGraphQLError)(`Can only sanitize time zone strings, but got: ${ast.kind}`);
}
return validateTimeZone(ast.value);
},
extensions: {
codegenScalarType: 'string',
jsonSchema: {
title: 'TimeZone',
type: 'string',
pattern: '^(?:[A-Za-z0-9_]|(?:%[0-9A-Fa-f]{2}))+',
},
},
});