Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: apollographql/graphql-subscriptions
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.0
Choose a base ref
...
head repository: apollographql/graphql-subscriptions
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.2.0
Choose a head ref
  • 7 commits
  • 6 files changed
  • 3 contributors

Commits on Jul 19, 2019

  1. doc: update demo code

    Not a big thing. Based on above context, `listenToNewMessages` is a better fit.
    hongbo-miao authored and grantwwu committed Jul 19, 2019
    Copy the full SHA
    9ea2d87 View commit details

Commits on Jul 16, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    2f77a9e View commit details
  2. Bump to latest deps

    hwillson committed Jul 16, 2020
    2
    Copy the full SHA
    fc28a58 View commit details
  3. Copy the full SHA
    e0304e7 View commit details
  4. Merge pull request #229 from apollographql/dep-updates

    Dep, type and CI updates
    hwillson authored Jul 16, 2020
    Copy the full SHA
    2baf18a View commit details

Commits on Feb 6, 2021

  1. Update CHANGELOG for v1.2.0

    glasser committed Feb 6, 2021
    Copy the full SHA
    561bd88 View commit details
  2. 1.2.0

    glasser committed Feb 6, 2021
    Copy the full SHA
    82d0e4c View commit details
Showing with 29 additions and 23 deletions.
  1. +1 −3 .travis.yml
  2. +4 −0 CHANGELOG.md
  3. +1 −1 README.md
  4. +17 −17 package.json
  5. +1 −1 src/test/asyncIteratorSubscription.ts
  6. +5 −1 src/with-filter.ts
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: node_js
node_js:
- "10"
- "8"
- "6"
- "12"

install:
- npm install -g coveralls
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 1.2.0

- Add `graphql@15` to `peerDependencies`.

### 1.1.0

- Fix [#132](https://github.com/apollographql/graphql-subscriptions/issues/132) - withFilter was previously always passing undefined as its first argument to the filterFn
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ import asyncify from 'callback-to-async-iterator';
export const resolvers = {
Subscription: {
somethingChanged: {
subscribe: () => asyncify(listenToChanges),
subscribe: () => asyncify(listenToNewMessages),
},
},
}
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "graphql-subscriptions",
"version": "1.1.0",
"version": "1.2.0",
"description": "GraphQL subscriptions for node.js",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "https://github.com/apollostack/graphql-subscriptions.git"
},
"dependencies": {
"iterall": "^1.2.1"
"iterall": "^1.3.0"
},
"peerDependencies": {
"graphql": "^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 || ^14.0.0"
"graphql": "^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0"
},
"scripts": {
"clean": "rimraf dist coverage",
@@ -27,23 +27,23 @@
"prepublishOnly": "npm run clean && npm run compile"
},
"devDependencies": {
"@types/chai-as-promised": "^7.1.0",
"@types/graphql": "^14.0.0",
"@types/mocha": "^2.2.39",
"@types/node": "^8.0.28",
"@types/sinon": "5.0.2",
"@types/sinon-chai": "^3.2.0",
"chai": "^4.1.2",
"@types/chai-as-promised": "^7.1.3",
"@types/graphql": "^14.5.0",
"@types/mocha": "^8.0.0",
"@types/node": "^14.0.23",
"@types/sinon": "9.0.4",
"@types/sinon-chai": "^3.2.4",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"graphql": "^14.0.0",
"istanbul": "^1.0.0-alpha.2",
"mocha": "^5.2.0",
"remap-istanbul": "^0.9.1",
"rimraf": "^2.6.2",
"sinon": "^6.1.4",
"sinon-chai": "^3.2.0",
"tslint": "^5.11.0",
"typescript": "^2.3.2"
"mocha": "^8.0.1",
"remap-istanbul": "^0.13.0",
"rimraf": "^3.0.2",
"sinon": "^9.0.2",
"sinon-chai": "^3.5.0",
"tslint": "^6.1.2",
"typescript": "^3.9.6"
},
"typings": "dist/index.d.ts",
"typescript": {
2 changes: 1 addition & 1 deletion src/test/asyncIteratorSubscription.ts
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ describe('GraphQL-JS asyncIterator', () => {

const schema = buildSchema(origIterator, filterFn);

Promise.resolve(subscribe(schema, query)).then((results: AsyncIterator<ExecutionResult>) => {
Promise.resolve(subscribe(schema, query)).then((results: AsyncIterableIterator<ExecutionResult>) => {
expect(isAsyncIterable(results)).to.be.true;

results.next();
6 changes: 5 additions & 1 deletion src/with-filter.ts
Original file line number Diff line number Diff line change
@@ -3,8 +3,12 @@ import { $$asyncIterator } from 'iterall';
export type FilterFn = (rootValue?: any, args?: any, context?: any, info?: any) => boolean | Promise<boolean>;
export type ResolverFn = (rootValue?: any, args?: any, context?: any, info?: any) => AsyncIterator<any>;

interface IterallAsyncIterator<T> extends AsyncIterator<T> {
[$$asyncIterator](): IterallAsyncIterator<T>;
}

export const withFilter = (asyncIteratorFn: ResolverFn, filterFn: FilterFn): ResolverFn => {
return (rootValue: any, args: any, context: any, info: any): AsyncIterator<any> => {
return (rootValue: any, args: any, context: any, info: any): IterallAsyncIterator<any> => {
const asyncIterator = asyncIteratorFn(rootValue, args, context, info);

const getNextPromise = () => {