How to use the gqliteral.objectType function in gqliteral

To help you get started, we’ve selected a few gqliteral examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github prisma-labs / nexus-prisma / plugin / prisma.ts View on Github external
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(
github prisma-labs / nexus-prisma / plugin / prisma.ts View on Github external
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))
  })
}
github prisma-labs / nexus-prisma / plugin / prisma.ts View on Github external
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))
  })
}

gqliteral

Scalable, strongly typed GraphQL schema development

MIT
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis

Similar packages