@aws-amplify/graphql-model-transformer
Version:
Amplify graphql @model transformer
18 lines • 1.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateSubscriptionResponseTemplate = exports.generateSubscriptionRequestTemplate = void 0;
const graphql_mapping_template_1 = require("graphql-mapping-template");
const generateSubscriptionRequestTemplate = () => {
const statements = [(0, graphql_mapping_template_1.toJson)((0, graphql_mapping_template_1.obj)({ version: (0, graphql_mapping_template_1.str)('2018-05-29'), payload: (0, graphql_mapping_template_1.obj)({}) }))];
return (0, graphql_mapping_template_1.printBlock)('Subscription Request template')((0, graphql_mapping_template_1.compoundExpression)(statements));
};
exports.generateSubscriptionRequestTemplate = generateSubscriptionRequestTemplate;
const generateSubscriptionResponseTemplate = () => {
const statements = [
(0, graphql_mapping_template_1.iff)((0, graphql_mapping_template_1.not)((0, graphql_mapping_template_1.isNullOrEmpty)((0, graphql_mapping_template_1.ref)('ctx.args.filter'))), (0, graphql_mapping_template_1.ref)('extensions.setSubscriptionFilter($util.transform.toSubscriptionFilter($ctx.args.filter))')),
(0, graphql_mapping_template_1.toJson)((0, graphql_mapping_template_1.nul)()),
];
return (0, graphql_mapping_template_1.printBlock)('Subscription Response template')((0, graphql_mapping_template_1.compoundExpression)(statements));
};
exports.generateSubscriptionResponseTemplate = generateSubscriptionResponseTemplate;
//# sourceMappingURL=subscriptions.js.map