code: function resolvePrimaryKey(row, context) {
      const resAttrNode = context.resourceAttrNode;
      const indexKey = resAttrNode.resolvedPrimaryKey[resAttrNode.primaryDataSource];
  
      function dereferenceKeyAttr(keyAttr) {
          const keyVal = row[keyAttr];
          if (keyVal === undefined) {
              const attrPath = context.attrPath.length > 0 ? context.attrPath.join('.') : '{root}';
              throw new DataError(
                  `Result-row of "${attrPath}" (DataSource "${
                      resAttrNode.primaryDataSource
                  }") misses primary key attribute "${keyAttr}"`
              );
          }
          return keyVal;
      }
  
      if (indexKey.length === 1) {
          context.primaryKey = '' + dereferenceKeyAttr(indexKey[0]);
      } else {
          context.primaryKey = indexKey.map(dereferenceKeyAttr).join(keySeparator);
      }
  
      // link rows from secondary DataSources by primary key:
      // row from joinVia-DataSource is passed via context here
      context.secondaryRows = context.secondaryRows || {};
  
      Object.keys(resAttrNode.dataSources).forEach(dataSourceName => {
          if (dataSourceName === resAttrNode.primaryDataSource) return;
          if (resAttrNode.joinVia && dataSourceName === resAttrNode.joinVia) return;
          if (!('resultId' in resAttrNode.dataSources[dataSourceName])) return;
  
          const secondaryResult = context.rawResults[resAttrNode.dataSources[dataSourceName].resultId];
          if (typeof secondaryResult.indexedData[context.primaryKey] === 'undefined') {
              context.api.log.debug(
                  new DataError(
                      `Secondary DataSource "${dataSourceName}" of "` +
                          (context.attrPath.length > 0 ? context.attrPath.join('.') : '{root}') +
                          `": row with key "${context.primaryKey}" not found`
                  )
              );
              context.secondaryRows[dataSourceName] = null;
          } else {
              context.secondaryRows[dataSourceName] = secondaryResult.indexedData[context.primaryKey];
          }
      });
  }
docs: Determine current primary key (from primary DataSource).
  
  @private