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

127 lines
4.9 KiB
Plaintext

import { GraphQLEnumType, GraphQLInputObjectType } from 'graphql';
import { GraphQLJSON } from '../packages/graphql-type-json/index.js';
import { combineParentName } from '../utilities/combineParentName.js';
import { formatName } from '../utilities/formatName.js';
import { recursivelyBuildNestedPaths } from './recursivelyBuildNestedPaths.js';
import { withOperators } from './withOperators.js';
export const fieldToSchemaMap = ({ nestedFieldName, parentName })=>({
array: (field)=>recursivelyBuildNestedPaths({
field,
nestedFieldName2: nestedFieldName,
parentName
}),
checkbox: (field)=>({
type: withOperators(field, parentName)
}),
code: (field)=>({
type: withOperators(field, parentName)
}),
collapsible: (field)=>recursivelyBuildNestedPaths({
field,
nestedFieldName2: nestedFieldName,
parentName
}),
date: (field)=>({
type: withOperators(field, parentName)
}),
email: (field)=>({
type: withOperators(field, parentName)
}),
group: (field)=>recursivelyBuildNestedPaths({
field,
nestedFieldName2: nestedFieldName,
parentName
}),
json: (field)=>({
type: withOperators(field, parentName)
}),
number: (field)=>({
type: withOperators(field, parentName)
}),
point: (field)=>({
type: withOperators(field, parentName)
}),
radio: (field)=>({
type: withOperators(field, parentName)
}),
relationship: (field)=>{
if (Array.isArray(field.relationTo)) {
return {
type: new GraphQLInputObjectType({
name: `${combineParentName(parentName, field.name)}_Relation`,
fields: {
relationTo: {
type: new GraphQLEnumType({
name: `${combineParentName(parentName, field.name)}_Relation_RelationTo`,
values: field.relationTo.reduce((values, relation)=>({
...values,
[formatName(relation)]: {
value: relation
}
}), {})
})
},
value: {
type: GraphQLJSON
}
}
})
};
}
return {
type: withOperators(field, parentName)
};
},
richText: (field)=>({
type: withOperators(field, parentName)
}),
row: (field)=>recursivelyBuildNestedPaths({
field,
nestedFieldName2: nestedFieldName,
parentName
}),
select: (field)=>({
type: withOperators(field, parentName)
}),
tabs: (field)=>recursivelyBuildNestedPaths({
field,
nestedFieldName2: nestedFieldName,
parentName
}),
text: (field)=>({
type: withOperators(field, parentName)
}),
textarea: (field)=>({
type: withOperators(field, parentName)
}),
upload: (field)=>{
if (Array.isArray(field.relationTo)) {
return {
type: new GraphQLInputObjectType({
name: `${combineParentName(parentName, field.name)}_Relation`,
fields: {
relationTo: {
type: new GraphQLEnumType({
name: `${combineParentName(parentName, field.name)}_Relation_RelationTo`,
values: field.relationTo.reduce((values, relation)=>({
...values,
[formatName(relation)]: {
value: relation
}
}), {})
})
},
value: {
type: GraphQLJSON
}
}
})
};
}
return {
type: withOperators(field, parentName)
};
}
});
//# sourceMappingURL=fieldToWhereInputSchemaMap.js.map