code: function buildConnectionEdge(
    store: RecordSourceProxy,
    connection: RecordProxy,
    edge: ?RecordProxy,
  ): ?RecordProxy {
    if (edge == null) {
      return edge;
    }
    const {EDGES} = RelayConnectionInterface.get();
  
    const edgeIndex = connection.getValue(NEXT_EDGE_INDEX);
    invariant(
      typeof edgeIndex === 'number',
      'RelayConnectionHandler: Expected %s to be a number, got `%s`.',
      NEXT_EDGE_INDEX,
      edgeIndex,
    );
    const edgeID = generateClientID(connection.getDataID(), EDGES, edgeIndex);
    const connectionEdge = store.create(edgeID, edge.getType());
    connectionEdge.copyFieldsFrom(edge);
    connection.setValue(edgeIndex + 1, NEXT_EDGE_INDEX);
    return connectionEdge;
  }
docs: @internal
  
  Creates a copy of an edge with a unique ID based on per-connection-instance
  incrementing edge index. This is necessary to avoid collisions between edges,
  which can occur because (edge) client IDs are assigned deterministically
  based on the path from the nearest node with an id.
  
  Example: if the first N edges of the same connection are refetched, the edges
  from the second fetch will be assigned the same IDs as the first fetch, even
  though the nodes they point to may be different (or the same and in different
  order).