How to use the auto-relay.augmentedConnection function in auto-relay

To help you get started, we’ve selected a few auto-relay 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 wemaintain / auto-relay / packages / type-orm / src / type-orm-connection.ts View on Github external
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
      }
    }
  }

auto-relay

Relay made simple in code-first GraphQL typescript applications

Apache-2.0
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis