@cran/gql.jm
Version:
Cran/GraphQL Join Monster Utilities
29 lines (28 loc) • 993 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.withSqlJunctionBatch = void 0;
const junction_1 = require("./junction");
const gql_core_1 = require("@cran/gql.core");
function withSqlJunctionBatch(name = "sqlJunctionBatch") {
return (0, gql_core_1.createDirective)(name, {
name: "text!",
key: "[text!]!",
this: "text!",
parent: "text!",
join: "text!",
where: "text",
order: "text",
}, {
[gql_core_1.MapperKind.COMPOSITE_FIELD]([directive,], field) {
Object.assign((0, junction_1.extendJunction)(field, directive), {
uniqueKey: directive.key,
sqlBatch: {
thisKey: directive.this,
parentKey: directive.parent,
sqlJoin: new gql_core_1.Executable("sqlJoin", directive.join),
},
});
},
});
}
exports.withSqlJunctionBatch = withSqlJunctionBatch;