@cran/gql.jm
Version:
Cran/GraphQL Join Monster Utilities
24 lines (23 loc) • 838 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.withSqlJunction = void 0;
const junction_1 = require("./junction");
const gql_core_1 = require("@cran/gql.core");
function withSqlJunction(name = "sqlJunction") {
return (0, gql_core_1.createDirective)(name, {
name: "text!",
joins: "[text!]!",
where: "text",
order: "text",
}, {
[gql_core_1.MapperKind.COMPOSITE_FIELD]([directive,], field) {
Object.assign((0, junction_1.extendJunction)(field, directive), {
sqlJoins: [
new gql_core_1.Executable("sqlJoin1", directive.joins[0]),
new gql_core_1.Executable("sqlJoin2", directive.joins[1]),
],
});
},
});
}
exports.withSqlJunction = withSqlJunction;