Graphql resolver - .find() deep filter on relations two+ levels deep

System Information
  • Strapi Version: 3.6.6
  • Operating System: strapi/strapi:3.6.8 Docker image in Windows WSL2 VM
  • Database: mariadb 10.3
  • Node Version: 14.16.0
  • NPM Version: 7.20.5
  • Yarn Version: 1.22.10

I have created a few custom resolvers on the GraphQL “me” query endpoint that will get a user’s own related content. One of them will return the user’s [PerformanceVideo]. The following code is in extensions/users-permissions/config/schema.graphql.js

module.exports = {
  definition: `
    extend type UsersPermissionsMe {
      performanceVideos(sort: String, start: Int, limit: Int, where: JSON): [PerformanceVideo]
    }
  `,
  resolver: {
    UsersPermissionsMe: {
      performanceVideos: async (obj, options, { context }) => {
        if (obj.id) {
          'user.id': obj.id,
          return await strapi.services['performance-video'].find({
            'user.id': obj.id,
            // _where: options.where || {},     // option 1
            // ...options.where                       // option 2 
            // "card_fronts": {                             // aside 1
            //   "cardClaimRequests": {             //
            //     "status": "Pending Review"     //
            //   }                                                //
            // }                                                  //
            // 'card_fronts.cardClaimRequests.status': 'Pending Review',  // aside 2
          });
        } else return;
      },
    },
  }
}

Please note that “performanceVideo”, “cardFront” and “cardClaimRequest” are each content types and are related as user <=> performanceVideo <=> cardFront <=> cardClaimRequest
The query on the client side is as follows

query getMyIndividualCardClaim{
                        me{
                            performanceVideos(
                                where: {
                                    card_fronts:{
                                        cardClaimRequests:{
                                            status: "Pending Review"
                                        }
                                    }
                                }
                            ){
                                card_fronts{
                                    cardClaimRequests{
                                        ...fields
                                    }
                                }
                            }
                        }
                    }

Option 1: put the where object into the .find()'s _where.
Result: ERROR:
"select distinct performance_videos.* from performance_videosleft joinconservatory.card_frontsascard_fronts_1oncard_fronts_1.video=performance_videos.idwherecard_fronts_1.idis not null andcard_fronts_1.id = {"cardClaimRequests":{"status":"Pending Review"}} limit 100 - val.toString is not a function"

Option 2: Spread the options.where into the .find()'s first argument object
Result: ERROR
"select distinct performance_videos.* from performance_videosleft joinconservatory.card_frontsascard_fronts_1oncard_fronts_1.video=performance_videos.idwherecard_fronts_1.idis not null andcard_fronts_1.id = {"cardClaimRequests":{"status":"Pending Review"}} limit 100 - val.toString is not a function"

Aside 1:
This is the result of the above GraphQL query being spread into the first argument of find(), the same as option 2 essentially. However, the result is not the same error.
Result: ERROR:
"select distinct performance_videos.* from performance_videosleft joinconservatory.card_frontsascard_fronts_1oncard_fronts_1.video=performance_videos.idwherecard_fronts_1.id = {"cardClaimRequests":{"status":"Pending Review"}} limit 100 - ER_BAD_FIELD_ERROR: Unknown column 'cardClaimRequests' in 'where clause'"

Aside 2:
Dot-izing the nested object works reliably, however I’m not sure if it’s possible to write the client side GraphQL query with this type of notation. Manually writing resolvers for each is not a feasible solution.

Questions:

  1. Is this a bug and is there a known fix?
  2. Is there a dot-ize library or some other object stringification method that is recommended by strapi in this kind of situation? Such as dot-object - npm dot.dot() function. I don’t want to implement something myself if it already exists.