feat(modules-sdk): remote query retrieve (#6849)
What: Remote Joiner options to check if keys exist on entry points or relations
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
ModuleExports,
|
||||
ModuleJoinerConfig,
|
||||
ModuleServiceInitializeOptions,
|
||||
RemoteJoinerOptions,
|
||||
RemoteJoinerQuery,
|
||||
RemoteQueryFunction,
|
||||
} from "@medusajs/types"
|
||||
@@ -241,7 +242,8 @@ async function MedusaApp_({
|
||||
link: RemoteLink | undefined
|
||||
query: (
|
||||
query: string | RemoteJoinerQuery | object,
|
||||
variables?: Record<string, unknown>
|
||||
variables?: Record<string, unknown>,
|
||||
options?: RemoteJoinerOptions
|
||||
) => Promise<any>
|
||||
entitiesMap?: Record<string, any>
|
||||
notFound?: Record<string, Record<string, string>>
|
||||
@@ -345,9 +347,10 @@ async function MedusaApp_({
|
||||
|
||||
const query = async (
|
||||
query: string | RemoteJoinerQuery | object,
|
||||
variables?: Record<string, unknown>
|
||||
variables?: Record<string, unknown>,
|
||||
options?: RemoteJoinerOptions
|
||||
) => {
|
||||
return await remoteQuery.query(query, variables)
|
||||
return await remoteQuery.query(query, variables, options)
|
||||
}
|
||||
|
||||
const runMigrations: RunMigrationFn = async (
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
} from "@medusajs/types"
|
||||
import { isString, toPascalCase } from "@medusajs/utils"
|
||||
|
||||
import { RemoteJoinerOptions } from "@medusajs/types"
|
||||
import { MedusaModule } from "./medusa-module"
|
||||
|
||||
export class RemoteQuery {
|
||||
@@ -230,7 +231,8 @@ export class RemoteQuery {
|
||||
|
||||
public async query(
|
||||
query: string | RemoteJoinerQuery | object,
|
||||
variables?: Record<string, unknown>
|
||||
variables?: Record<string, unknown>,
|
||||
options?: RemoteJoinerOptions
|
||||
): Promise<any> {
|
||||
let finalQuery: RemoteJoinerQuery = query as RemoteJoinerQuery
|
||||
|
||||
@@ -240,6 +242,6 @@ export class RemoteQuery {
|
||||
finalQuery = toRemoteJoinerQuery(query, variables)
|
||||
}
|
||||
|
||||
return await this.remoteJoiner.query(finalQuery)
|
||||
return await this.remoteJoiner.query(finalQuery, options)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user