graphql-subscriptions
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -10,2 +10,3 @@ # Changelog | ||
- Deprecate `SubscriptionManager` [PR #60](https://github.com/apollographql/graphql-subscriptions/pull/60) | ||
- Fixed `withFilter` issue caused multiple subscribers to execute with the same AsyncIterator [PR #69](https://github.com/apollographql/graphql-subscriptions/pull/69) | ||
@@ -12,0 +13,0 @@ ### 0.3.1 |
@@ -412,4 +412,3 @@ "use strict"; | ||
try { | ||
expect(payload).to.be.undefined; | ||
expect(err.message).to.equals('Variable "$uga" of required type "Boolean!" was not provided.'); | ||
expect(payload).to.be.defined; | ||
} | ||
@@ -416,0 +415,0 @@ catch (e) { |
export declare type FilterFn = (rootValue?: any, args?: any, context?: any, info?: any) => boolean; | ||
export declare type ResolverFn = (rootValue?: any, args?: any, context?: any, info?: any) => AsyncIterator<any>; | ||
export declare const withFilter: (asyncIterator: AsyncIterator<any>, filterFn: FilterFn) => Function; | ||
export declare const withFilter: (asyncIteratorFn: () => AsyncIterator<any>, filterFn: FilterFn) => Function; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var iterall_1 = require("iterall"); | ||
exports.withFilter = function (asyncIterator, filterFn) { | ||
exports.withFilter = function (asyncIteratorFn, filterFn) { | ||
return function (rootValue, args, context, info) { | ||
var asyncIterator = asyncIteratorFn(); | ||
var getNextPromise = function () { | ||
@@ -7,0 +8,0 @@ return asyncIterator |
{ | ||
"name": "graphql-subscriptions", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "GraphQL subscriptions for node.js", | ||
@@ -16,3 +16,3 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"graphql": "^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0" | ||
"graphql": "^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.1" | ||
}, | ||
@@ -19,0 +19,0 @@ "scripts": { |
@@ -78,3 +78,3 @@ [![npm version](https://badge.fury.io/js/graphql-subscriptions.svg)](https://badge.fury.io/js/graphql-subscriptions) [![GitHub license](https://img.shields.io/github/license/apollostack/graphql-subscriptions.svg)](https://github.com/apollostack/graphql-subscriptions/blob/license/LICENSE) | ||
`withFilter` API: | ||
- `asyncIterator: AsyncIterator<any>` : Async iterator you got from your `pubsub.asyncIterator`. | ||
- `asyncIteratorFn: () => AsyncIterator<any>` : A function that returns `AsyncIterator` you got from your `pubsub.asyncIterator`. | ||
- `filterFn: (payload, variables, context, info) => boolean | Promise<boolean>` - A filter function, executed with the payload (the published value), variables, context and operation info, must return `boolean` or `Promise<boolean>` indicating if the payload should pass to the subscriber. | ||
@@ -92,3 +92,3 @@ | ||
somethingChanged: { | ||
subscribe: withFilter(pubsub.asyncIterator(SOMETHING_CHANGED_TOPIC), (payload, variables) => { | ||
subscribe: withFilter(() => pubsub.asyncIterator(SOMETHING_CHANGED_TOPIC), (payload, variables) => { | ||
return payload.somethingChanged.id === variables.relevantId; | ||
@@ -95,0 +95,0 @@ }), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127933