Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fieldArg.type.name as any,
typeToFieldOpts(fieldArg.type),
)
return acc
},
{},
)
return {
args: gqliteralArgs,
typesToExport,
}
}
const PageInfo = objectType('PageInfo', t => {
t.boolean('hasSomething')
})
// function relayConnection(field: string) {
// const Edge = objectType(`${field}Edge`, t => {
// t.id('id')
// t.field('node', field)
// })
// const Connection = objectType(`${field}Connection`, t => {
// t.field('edges', `${field}Edge`)
// })
// return [PageInfo, Edge, Connection]
// }
function exportRelayConnectionTypes(
aliasesMap: AliasMap,
) {
const connectionType = typesMap.types[connectionTypeName]
const edgeTypeName = connectionType.fields.find(f => f.name === 'edges')!.type
.name
const aggregateTypeName = connectionType.fields.find(
f => f.name === 'aggregate',
)!.type.name
module.exports['PageInfo'] = PageInfo
module.exports[edgeTypeName] = objectType(edgeTypeName, t => {
addFieldsTo(t, typesMap, aliasesMap, getFields(undefined, t.name, typesMap))
})
module.exports[aggregateTypeName] = objectType(aggregateTypeName, t => {
addFieldsTo(t, typesMap, aliasesMap, getFields(undefined, t.name, typesMap))
})
}
function exportRelayConnectionTypes(
connectionTypeName: string,
typesMap: TypesMap,
aliasesMap: AliasMap,
) {
const connectionType = typesMap.types[connectionTypeName]
const edgeTypeName = connectionType.fields.find(f => f.name === 'edges')!.type
.name
const aggregateTypeName = connectionType.fields.find(
f => f.name === 'aggregate',
)!.type.name
module.exports['PageInfo'] = PageInfo
module.exports[edgeTypeName] = objectType(edgeTypeName, t => {
addFieldsTo(t, typesMap, aliasesMap, getFields(undefined, t.name, typesMap))
})
module.exports[aggregateTypeName] = objectType(aggregateTypeName, t => {
addFieldsTo(t, typesMap, aliasesMap, getFields(undefined, t.name, typesMap))
})
}