UNPKG

@zuu/owl

Version:

Zuu's Experimental GraphQL Implementation

19 lines 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const getMetadataStorage_1 = require("../metadata/getMetadataStorage"); const handlers_1 = require("../helpers/handlers"); const decorators_1 = require("../helpers/decorators"); const errors_1 = require("../errors"); function Subscription(returnTypeFuncOrOptions, maybeOptions) { const { options, returnTypeFunc } = decorators_1.getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions); const topics = [].concat(options.topics || []); return (prototype, methodName) => { const handler = handlers_1.getHandlerInfo(prototype, methodName, returnTypeFunc, options); if (topics.length === 0) { throw new errors_1.MissingSubscriptionTopicsError(handler.target, handler.methodName); } getMetadataStorage_1.getMetadataStorage().collectSubscriptionHandlerMetadata(Object.assign({}, handler, { topics, filter: options.filter })); }; } exports.Subscription = Subscription; //# sourceMappingURL=Subscription.js.map