feat: Remote Joiner (#4098)

This commit is contained in:
Carlos R. L. Rodrigues
2023-06-29 15:29:01 +02:00
committed by GitHub
parent 9dcdc0041a
commit 499c3478c9
20 changed files with 2227 additions and 5 deletions
+1
View File
@@ -3,6 +3,7 @@ export * from "./cache"
export * from "./common"
export * from "./event-bus"
export * from "./inventory"
export * from "./joiner"
export * from "./modules-sdk"
export * from "./product"
export * from "./product-category"
+51
View File
@@ -0,0 +1,51 @@
export type JoinerRelationship = {
alias: string
foreignKey: string
primaryKey: string
serviceName: string
inverse?: boolean // In an inverted relationship the foreign key is on the other service and the primary key is on the current service
}
export interface JoinerServiceConfig {
serviceName: string
primaryKeys: string[]
relationships?: JoinerRelationship[]
extends?: {
serviceName: string
resolve: JoinerRelationship
}[]
}
export interface JoinerArgument {
name: string
value?: any
field?: string
}
export interface RemoteJoinerQuery {
service: string
expands?: Array<{
property: string
fields: string[]
args?: JoinerArgument[]
relationships?: JoinerRelationship[]
}>
fields: string[]
args?: JoinerArgument[]
}
export interface RemoteNestedExpands {
[key: string]: {
fields: string[]
args?: JoinerArgument[]
expands?: RemoteNestedExpands
}
}
export interface RemoteExpandProperty {
property: string
serviceConfig: JoinerServiceConfig
fields: string[]
args?: JoinerArgument[]
expands?: RemoteNestedExpands
}