Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const ThroughEntity = through ? through() as Function : undefined
const throughKey = typeOrmConnection._findPropertyNameBetweenEntityAndThrough(Entity, ThroughEntity)
const findOptions = typeOrmConnection._findOptionsForEntity(field, Entity, self, this, pagination, throughKey, ThroughEntity as Function, options)
const [entities, count] = await getConnection()
.manager
.findAndCount(ThroughEntity || Entity, findOptions as FindManyOptions)
const relayConnection = Relay.connectionFromArraySlice(
entities,
{ after, first, before, last },
{ arrayLength: count, sliceStart: pagination.offset || 0 },
)
if (ThroughEntity) {
return augmentedConnection(relayConnection as Relay.Connection, throughKey)
} else {
return relayConnection as AugmentedConnection
}
}
}