@notadd/graphql
Version:
notadd core none dependence
81 lines (80 loc) • 2.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Directive = exports.DirectiveMetadataKey = exports.Scalar = exports.ScalarMetadataKey = exports.Subscription = exports.SubscriptionMetadataKey = exports.Mutation = exports.MutationMetadataKey = exports.Query = exports.QueryMetadataKey = void 0;
const core_1 = require("@notadd/core");
exports.QueryMetadataKey = `@notadd/graphql QueryMetadataKey`;
exports.Query = core_1.createDecorator(exports.QueryMetadataKey, (it) => {
let options = it.options;
if (typeof options === 'string') {
options = {
path: options
};
}
if (it instanceof core_1.IClassDecorator) {
if (!options) {
options = {
path: it.type.name
};
}
}
else if (it instanceof core_1.IMethodDecorator) {
if (!options) {
options = {
path: it.property
};
}
}
it.options = options;
});
exports.MutationMetadataKey = `@notadd/graphql MutationMetadataKey`;
exports.Mutation = core_1.createDecorator(exports.MutationMetadataKey, (it) => {
let options = it.options;
if (typeof options === 'string') {
options = {
path: options
};
}
if (it instanceof core_1.IClassDecorator) {
if (!options) {
options = {
path: it.type.name
};
}
}
else if (it instanceof core_1.IMethodDecorator) {
if (!options) {
options = {
path: it.property
};
}
}
it.options = options;
});
exports.SubscriptionMetadataKey = `@notadd/graphql SubscriptionMetadataKey`;
exports.Subscription = core_1.createDecorator(exports.SubscriptionMetadataKey, (it) => {
let options = it.options;
if (typeof options === 'string') {
options = {
path: options
};
}
if (it instanceof core_1.IClassDecorator) {
if (!options) {
options = {
path: it.type.name
};
}
}
else if (it instanceof core_1.IMethodDecorator) {
if (!options) {
options = {
path: it.property
};
}
}
it.options = options;
});
exports.ScalarMetadataKey = `@notadd/graphql ScalarMetadataKey`;
exports.Scalar = core_1.createDecorator(exports.ScalarMetadataKey);
exports.DirectiveMetadataKey = `@notadd/graphql DirectiveMetadataKey`;
exports.Directive = core_1.createDecorator(exports.DirectiveMetadataKey);