@@ -183,7 +183,7 @@ const transformQueryConstraintInputToParse = (
183
183
} ) ;
184
184
} ;
185
185
186
- const transformQueryInputToParse = ( constraints , fields ) => {
186
+ const transformQueryInputToParse = ( constraints , fields , className ) => {
187
187
if ( ! constraints || typeof constraints !== 'object' ) {
188
188
return ;
189
189
}
@@ -198,9 +198,30 @@ const transformQueryInputToParse = (constraints, fields) => {
198
198
199
199
if ( fieldName !== 'objectId' ) {
200
200
fieldValue . forEach ( fieldValueItem => {
201
- transformQueryInputToParse ( fieldValueItem , fields ) ;
201
+ transformQueryInputToParse ( fieldValueItem , fields , className ) ;
202
202
} ) ;
203
203
return ;
204
+ } else if ( className ) {
205
+ Object . keys ( fieldValue ) . forEach ( constraintName => {
206
+ const constraintValue = fieldValue [ constraintName ] ;
207
+ if ( typeof constraintValue === 'string' ) {
208
+ const globalIdObject = fromGlobalId ( constraintValue ) ;
209
+
210
+ if ( globalIdObject . type === className ) {
211
+ fieldValue [ constraintName ] = globalIdObject . id ;
212
+ }
213
+ } else if ( Array . isArray ( constraintValue ) ) {
214
+ fieldValue [ constraintName ] = constraintValue . map ( value => {
215
+ const globalIdObject = fromGlobalId ( value ) ;
216
+
217
+ if ( globalIdObject . type === className ) {
218
+ return globalIdObject . id ;
219
+ }
220
+
221
+ return value ;
222
+ } ) ;
223
+ }
224
+ } ) ;
204
225
}
205
226
}
206
227
0 commit comments