Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(modules-sdk,orchestration): to remote joiner query #4974

Merged
merged 18 commits into from
Sep 10, 2023

Conversation

carlos-r-l-rodrigues
Copy link
Contributor

Helper function to transform js/json object into RemoteJoinerQuery format.

toRemoteJoinerQuery({
  product: {
    fields: ["id", "title"],
    __args: {
      skip: 0,
    },
    variants: {
      fields: ["id", "title", "handle", "sku"],
      shipping_profile: {
        profile: {
          fields: ["id", "name"],
        },
      },
    },
    collections: {
      fields: ["id", "title"],
    },
  },
})

outputs:

{
  alias: "product",
  fields: ["id", "title"],
  expands: [
    {
      property: "product.variants",
      fields: ["id", "title", "handle", "sku"],
    },
    {
      property: "product.variants.shipping_profile",
    },
    {
      property: "product.variants.shipping_profile.profile",
      fields: ["id", "name"],
    },
    {
      property: "product.collections",
      fields: ["id", "title"],
    },
  ],
  args: [
    {
      name: "skip",
      value: 0,
    },
  ],
};

@carlos-r-l-rodrigues carlos-r-l-rodrigues requested a review from a team as a code owner September 6, 2023 19:00
@changeset-bot
Copy link

changeset-bot bot commented Sep 6, 2023

🦋 Changeset detected

Latest commit: 821c4e5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@medusajs/orchestration Minor
@medusajs/modules-sdk Minor
@medusajs/medusa Patch
@medusajs/workflows Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Sep 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 10, 2023 1:06pm
medusa-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 10, 2023 1:06pm

Copy link
Member

@adrien2p adrien2p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, maybe just adding a unit test would be nice

packages/orchestration/src/joiner/helpers.ts Outdated Show resolved Hide resolved
packages/orchestration/src/joiner/helpers.ts Show resolved Hide resolved
packages/orchestration/src/joiner/helpers.ts Outdated Show resolved Hide resolved
packages/orchestration/src/joiner/helpers.ts Show resolved Hide resolved
@olivermrbl
Copy link
Contributor

olivermrbl commented Sep 7, 2023

@adrien2p @carlos-r-l-rodrigues – I don't think I have fully understood the purpose of this helper.

Can you add some more detail to it and perhaps provide a couple of examples scenarios?

@adrien2p
Copy link
Member

adrien2p commented Sep 7, 2023

At the moment, when you use the remote query, you can pass a RemoteJoinerQuery or a strong (gql). The RemoteJoinerQuery is not that simple to use and contains some properties that can be auto populated. This util aims to simplify the object to pass and take care of building the appropriate RemoteJoinerQuery

@olivermrbl
Copy link
Contributor

At the moment, when you use the remote query, you can pass a RemoteJoinerQuery or a strong (gql). The RemoteJoinerQuery is not that simple to use and contains some properties that can be auto populated. This util aims to simplify the object to pass and take care of building the appropriate RemoteJoinerQuery

This helps, thanks. Will we need to use this anywhere now?

@adrien2p
Copy link
Member

adrien2p commented Sep 7, 2023

At the moment, when you use the remote query, you can pass a RemoteJoinerQuery or a strong (gql). The RemoteJoinerQuery is not that simple to use and contains some properties that can be auto populated. This util aims to simplify the object to pass and take care of building the appropriate RemoteJoinerQuery

This helps, thanks. Will we need to use this anywhere now?

We will need to see, but might be easier to build an object with filters etc than a gql string. specially with complex filters and special filters

@vercel vercel bot temporarily deployed to Preview – api-reference September 10, 2023 12:59 Inactive
@vercel vercel bot temporarily deployed to Preview – medusa-docs September 10, 2023 13:06 Inactive
@kodiakhq kodiakhq bot merged commit d8649ba into develop Sep 10, 2023
@kodiakhq kodiakhq bot deleted the chore/to-remote-joiner-query branch September 10, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants