How to get file image url in graphql for a Metaobject

I am using StoreFront API call to get Metaobject entries. One of the fields is of a type file (image). When I call the GRAPHQL with below call. I am getting all the fields but getting image as gid reference. I wan actual cdn url which I am not able to find anywhere in the shopify documentation. Below is the query which I have tried.

What I want to achieve is to get image/file url but it is returning gid reference.

POST: https://alg-demo-store.myshopify.com/api/unstable/graphql.json

Code I tried:

query {
  metaobjects(type: "where_to_buy" first: 10) { 
      
      nodes{
          id
          handle
          country: field(key: "country") { value }            
          file: field(key: "company_logo") { reference {
        ... on MediaImage {
           previewImage {
            originalSrc
            url
            id
          }
        }
      }
    }
    }
  }
}

hey @dushyantjoshia

If you haven’t figured this one out, I just worked it out myself.

You can do a reference in side of the fields object

export const getMetaData = /* GraphQL */ `
  query getMetafields($type: String!) {
    metaobjects(first: 10, type: $type) {
      edges {
        node {
          id
          handle
          fields {
            reference {
              ... on MediaImage {
                image {
                  url
                }
              }
            }
            value
            key
          }
        }
      }
    }
  }
`;

Did you figure this one out?