@cran/gql.jm
Version:
Cran/GraphQL Join Monster Utilities
25 lines (24 loc) • 808 B
JavaScript
import { extendJunction } from "./junction";
import { Executable, MapperKind, createDirective } from "@cran/gql.core";
export function withSqlJunctionBatch(name = "sqlJunctionBatch") {
return createDirective(name, {
name: "text!",
key: "[text!]!",
this: "text!",
parent: "text!",
join: "text!",
where: "text",
order: "text",
}, {
[MapperKind.COMPOSITE_FIELD]([directive,], field) {
Object.assign(extendJunction(field, directive), {
uniqueKey: directive.key,
sqlBatch: {
thisKey: directive.this,
parentKey: directive.parent,
sqlJoin: new Executable("sqlJoin", directive.join),
},
});
},
});
}