get_inbound_self_relation_opts = async (source, viewname) => {
  const fields = await Field.find(
    {
      reftable_name: source.name,
      is_unique: true,
    },
    { cached: true }
  );
  const result = [];
  const targetFields = source.getForeignKeys();
  for (const field of fields) {
    const refTable = Table.findOne({ id: field.table_id });
    const fromTargetToRef = targetFields.filter(
      (field) => field.reftable_name === refTable.name
    );
    if (fromTargetToRef.length > 0) {
      const views = await View.find_table_views_where(
        source,
        ({ state_fields, viewrow }) =>
          viewrow.name !== viewname &&
          state_fields.some((sf) => sf.name === "id")
      );
      for (const toRef of fromTargetToRef) {
        result.push({
          path: `.${source.name}.${toRef.name}.${field.name}`,
          views,
        });
      }
    }
  }
  return result;
}
Get all relation options where source has a key to another table (refTable)
and refTable has a key to source.
Otherwise one could use a OneToOneShow from refTable.
@param {Table} source
@param {string} viewname name of the topview
@returns viewnames mapped to arrays of Inbound options