Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 2bd9ff0

Browse files
Daniel SchmidtGeorgiSTodorov
Daniel Schmidt
authored andcommitted
chore(dependencies): update to rxjs >= 6
BREAKING CHANGE: The RxJS versions has a breaking change, so all clients need to adopt RxJS version 6 or above
1 parent 6c70818 commit 2bd9ff0

9 files changed

+173
-174
lines changed

.vscode/bookmarks.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"path": "$ROOTPATH$/src/index.ts",
4+
"bookmarks": [
5+
{
6+
"line": 268,
7+
"column": 67,
8+
"label": ""
9+
}
10+
]
11+
}
12+
]

README.md

+29-21
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,20 @@ import graphql from "reactive-graphql";
1313

1414
import { makeExecutableSchema } from "graphql-tools";
1515
import gql from "graphql-tag";
16-
import { Observable } from "rxjs";
16+
import { from, interval, of } from "rxjs";
17+
import { map, merge, scan, combineLatest } from "rxjs/operators";
1718
import { componentFromStream } from "@dcos/data-service";
1819

1920
// mocked API clients that return Observables
20-
const oldPosts = Observable.from(["my first post", "a second post"]);
21-
const newPosts = Observable.interval(3000).map(v => `Blog Post #${v + 1}`);
21+
const oldPosts = from(["my first post", "a second post"]);
22+
const newPosts = interval(3000).pipe(map(v => `Blog Post #${v + 1}`));
2223
const fetchPosts = () =>
23-
oldPosts.merge(newPosts).scan((acc, item) => [...acc, item], []);
24+
oldPosts.pipe(
25+
merge(newPosts),
26+
scan((acc, item) => [...acc, item], [])
27+
);
2428
const votesStore = {};
25-
const fetchVotesForPost = name => Observable.of(votesStore[name] || 0);
29+
const fetchVotesForPost = name => of(votesStore[name] || 0);
2630

2731
const schema = makeExecutableSchema({
2832
typeDefs: `
@@ -47,8 +51,10 @@ const schema = makeExecutableSchema({
4751
resolvers: {
4852
Query: {
4953
posts(parent, args, context) {
50-
return fetchPosts().map(emittedValue =>
51-
emittedValue.map((value, index) => ({ id: index, title: value }))
54+
return fetchPosts().pipe(
55+
map(emittedValue =>
56+
emittedValue.map((value, index) => ({ id: index, title: value }))
57+
)
5258
);
5359
}
5460
},
@@ -71,17 +77,19 @@ const query = gql`
7177

7278
const postStream = graphql(query, schema);
7379
const PostsList = componentFromStream(propsStream =>
74-
propsStream.combineLatest(postStream, (props, result) => {
75-
const {
76-
data: { posts }
77-
} = result;
78-
79-
return posts.map(post => (
80-
<div>
81-
<h3>{post.title}</h3>
82-
</div>
83-
));
84-
})
80+
propsStream.pipe(
81+
combineLatest(postStream, (props, result) => {
82+
const {
83+
data: { posts }
84+
} = result;
85+
86+
return posts.map(post => (
87+
<div>
88+
<h3>{post.title}</h3>
89+
</div>
90+
));
91+
})
92+
)
8593
);
8694

8795
function App() {
@@ -103,11 +111,11 @@ ReactDOM.render(<App />, rootElement);
103111

104112
## API
105113

106-
The first argument you pass into `reactive-graphql` is an executable schema, the second one a parsed GraphQL query. You can pass in the root context as an object as a third parameter.
114+
The first argument you pass into `reactive-graphql` is an executable schema, the second one a parsed GraphQL query. You can pass in the root context as an object as a third parameter.
107115

108-
The implementation will always return an Observable.
116+
The implementation will always return an Observable.
109117
If any of the resolvers returns an error the implementation will emit the error on the stream.
110-
Otherwise the data will be wrapped in a `{ data }` object, like most implementations handle this.
118+
Otherwise the data will be wrapped in a `{ data }` object, like most implementations handle this.
111119

112120
## License
113121

jest.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
preset: "ts-jest",
33
testEnvironment: "node",
4-
testMatch: ["**/__tests__/**/*-test.js?(x)", "**/__tests__/**/*-test.ts?(x)"]
4+
testMatch: ["**/__tests__/**/*-test.js?(x)", "**/__tests__/**/*-test.ts?(x)"],
5+
testPathIgnorePatterns: ["/node_modules/", "<rootDir>/dist/"]
56
};

package-lock.json

+20-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"build": "tsc -p tsconfig.dist.json"
1616
},
1717
"dependencies": {
18-
"graphql": "14.0.2"
18+
"graphql": "^14.0.2"
1919
},
2020
"peerDependencies": {
21-
"rxjs": "5.5.10"
21+
"rxjs": "^6.0.0"
2222
},
2323
"devDependencies": {
2424
"@types/graphql": "14.0.2",
@@ -28,8 +28,8 @@
2828
"graphql-tools": "4.0.3",
2929
"jest": "23.6.0",
3030
"rimraf": "2.6.2",
31-
"rxjs": "5.5.10",
32-
"rxjs-marbles": "2.3.1",
31+
"rxjs": "6.3.3",
32+
"rxjs-marbles": "5.0.0",
3333
"semantic-release": "15.12.4",
3434
"ts-jest": "23.10.5",
3535
"typescript": "3.2.1"

0 commit comments

Comments
 (0)