Skip to content

Commit

Permalink
chore: Release candidate v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mgtitimoli committed Dec 13, 2018
1 parent 88a8322 commit a1797c5
Show file tree
Hide file tree
Showing 76 changed files with 7,110 additions and 2,949 deletions.
13 changes: 9 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"plugins": ["transform-runtime"],
"plugins": [
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-class-properties"
],
"presets": [
["env", {"modules": false, "spec": true, "useBuiltIns": true}],
"stage-0",
"flow"
[
"@babel/preset-env",
{"modules": false, "spec": true, "useBuiltIns": "usage"}
],
"@babel/preset-flow",
]
}
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ rules:
no-shadow: off
no-underscore-dangle: off
no-unused-expressions: [error, {allowShortCircuit: true}]
no-use-before-define: warn
no-useless-concat: off
prefer-template: warn
flowtype-errors/enforce-min-coverage: [warn, 80]
Expand Down
6 changes: 6 additions & 0 deletions .huskyrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"hooks": {
"commit-msg": "commitlint -e",
"pre-commit": "lint-staged"
}
}
8 changes: 7 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
module.exports = {
extends: ["@commitlint/config-angular", "@commitlint/config-lerna-scopes"]
extends: [
"@commitlint/config-conventional",
"@commitlint/config-lerna-scopes"
],
rules: {
"subject-case": [2, "always", "sentence-case"]
}
};
2 changes: 1 addition & 1 deletion flow-typed/npm/phoenix_vx.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ declare module "phoenix" {
off(event: string, ref: number): void,
onClose(callback: Function): void,
onError(callback: (reason: string) => any): number,
onMessage(string: event, payload: mixed, ref: number): mixed,
onMessage(event: string, payload: mixed, ref: number): mixed,
push(event: string, payload: mixed): Push,
leave(timeout: number): Push
}
Expand Down
17 changes: 8 additions & 9 deletions package-scripts.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// prettier-ignore
module.exports = {
scripts: {
"build:clean": "rm -rfv dist compat",
"build:flow": "nps 'flow-copy-source dist' 'flow-copy-source compat/cjs'",
"build:index": "create-index --banner '// @flow' src/ && sed -f indexIgnore.sed -i src/index.js && nps 'lint --fix src/index.js'",
"build:readme": "pkg-to-readme --template ./readmeTemplate.ejs --force && documentation readme src/** --section API && doctoc README.md",
"build:src": "rollup -c ../../rollup.config.js",
"flow-copy-source": "flow-copy-source -v src",
"lint": "eslint --rule 'flowtype-errors/show-errors: error'",
"prepublish": "not-in-install && nps 'build:clean' 'build:src' 'build:flow'",
"version": "nps 'build:index' 'build:readme' && git add README.md src/index.js",
"build:readme": "pkg-to-readme --template ./readmeTemplate.ejs --force && documentation readme src/** --markdown-toc=false --section API && doctoc README.md",
"build:flow:copy-source": "flow-copy-source -v src",
"build:flow": "nps 'build:flow:copy-source dist' 'build:flow:copy-source compat/cjs'",
"build:src:bundle": "rollup -c ../../rollup.config.js",
"build:src:clean": "rm -rfv dist compat",
"build:src": "nps 'build:src:clean' 'build:src:bundle' 'build:src:flow'",
"prepack": "nps 'build:src'",
"version": "nps 'build:readme' && git add README.md",
}
};
79 changes: 40 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,48 @@
"packages/*"
],
"scripts": {
"precommit": "lint-staged",
"commit": "commit",
"commitmsg": "commitlint -e"
"lint": "eslint --rule 'flowtype-errors/show-errors: error'"
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
]
},
"lint-staged": {},
"devDependencies": {
"@commitlint/cli": "4.3.0",
"@commitlint/config-angular": "4.3.0",
"@commitlint/config-lerna-scopes": "4.3.0",
"@commitlint/prompt-cli": "4.3.0",
"babel-eslint": "8.0.2",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-env": "1.6.1",
"babel-preset-flow": "6.23.0",
"babel-preset-stage-0": "6.24.1",
"create-index": "2.2.0",
"doctoc": "1.3.0",
"documentation": "5.3.3",
"eslint": "4.10.0",
"eslint-config-airbnb-base": "12.1.0",
"eslint-config-prettier": "2.7.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-flowtype-errors": "3.3.5",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-prettier": "2.3.1",
"flow-bin": "0.59.0",
"flow-copy-source": "1.2.1",
"flow-typed": "2.2.3",
"globby": "6.1.0",
"husky": "0.14.3",
"in-publish": "2.0.0",
"lerna": "2.5.1",
"lint-staged": "4.3.0",
"@babel/core": "7.2.0",
"@babel/plugin-proposal-class-properties": "7.2.1",
"@babel/plugin-transform-runtime": "7.2.0",
"@babel/preset-env": "7.2.0",
"@babel/preset-flow": "7.0.0",
"@commitlint/cli": "7.2.1",
"@commitlint/config-conventional": "7.1.2",
"@commitlint/config-lerna-scopes": "7.2.1",
"@commitlint/prompt-cli": "7.2.1",
"babel-eslint": "10.0.1",
"doctoc": "1.4.0",
"documentation": "9.0.0",
"eslint": "5.10.0",
"eslint-config-airbnb-base": "13.1.0",
"eslint-config-prettier": "3.3.0",
"eslint-plugin-flowtype": "3.2.0",
"eslint-plugin-flowtype-errors": "3.6.0",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-prettier": "3.0.0",
"flow-bin": "0.89.0",
"flow-copy-source": "2.0.2",
"flow-typed": "2.5.1",
"globby": "8.0.1",
"husky": "1.2.0",
"lerna": "3.6.0",
"lint-staged": "8.1.0",
"pascal-case": "2.0.1",
"pkg-to-readme": "1.1.0",
"prettier": "1.8.2",
"rollup": "0.53.3",
"rollup-plugin-babel": "3.0.3",
"rollup-plugin-commonjs": "8.2.6",
"rollup-plugin-node-resolve": "3.0.0",
"rollup-plugin-uglify": "2.0.1",
"uglify-es": "3.3.4"
}
"prettier": "1.15.3",
"rollup": "0.67.4",
"rollup-plugin-babel": "4.1.0",
"rollup-plugin-commonjs": "9.2.0",
"rollup-plugin-node-resolve": "4.0.0"
},
"dependencies": {}
}
1 change: 0 additions & 1 deletion packages/socket-apollo-link/.npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.*
indexIgnore.sed
readmeTemplate.ejs
yarn.lock
yarn-error.log
11 changes: 6 additions & 5 deletions packages/socket-apollo-link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Examples](#examples)
- [API](#api)
- [createAbsintheSocketLink](#createabsinthesocketlink)
- [Parameters](#parameters)
- [References](#references)
- [License](#license)

Expand Down Expand Up @@ -66,15 +67,15 @@ const client = new ApolloClient({
// @flow

import ApolloClient from "apollo-client";
import {ApolloLink} from "apollo-link";
import {createHttpLink} from "apollo-link-http";
import {hasSubscription} from "@jumpn/utils-graphql";
import {InMemoryCache} from "apollo-cache-inmemory";
import {split} from "apollo-link";

// see example 1
import absintheSocketLink from "./absinthe-socket-link";

const link = new ApolloLink.split(
const link = split(
operation => hasSubscription(operation.query),
absintheSocketLink,
createHttpLink({uri: "/graphql"})
Expand All @@ -95,11 +96,11 @@ const client = new ApolloClient({
Creates a terminating ApolloLink to request operations using given
AbsintheSocket instance

**Parameters**
#### Parameters

- `absintheSocket` **AbsintheSocket**
- `onError` **$PropertyType<Observer<any>, `"onError"`>**
- `onStart` **$PropertyType<Observer<any>, `"onStart"`>**
- `onError` **$ElementType<Observer<Result, Variables>, `"onError"`>**
- `onStart` **$ElementType<Observer<Result, Variables>, `"onStart"`>**

## References

Expand Down
13 changes: 7 additions & 6 deletions packages/socket-apollo-link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"react-native": "src/index",
"scripts": {
"version": "nps version",
"prepublish": "nps prepublish"
"prepack": "nps prepack"
},
"repository": {
"type": "git",
Expand All @@ -33,13 +33,14 @@
],
"dependencies": {
"@absinthe/socket": "0.1.10",
"apollo-link": "1.0.0",
"babel-runtime": "6.26.0",
"@babel/runtime": "7.2.0",
"apollo-link": "1.2.5",
"core-js": "2.6.0",
"flow-static-land": "0.2.8",
"graphql": "0.11.7",
"zen-observable": "0.6.0"
"graphql": "14.0.2",
"zen-observable": "0.8.11"
},
"devDependencies": {
"nps": "5.7.1"
"nps": "5.9.3"
}
}
4 changes: 2 additions & 2 deletions packages/socket-apollo-link/readmeTemplate.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ const client = new ApolloClient({
// @flow

import ApolloClient from "apollo-client";
import {ApolloLink} from "apollo-link";
import {createHttpLink} from "apollo-link-http";
import {hasSubscription} from "@jumpn/utils-graphql";
import {InMemoryCache} from "apollo-cache-inmemory";
import {split} from "apollo-link";

// see example 1
import absintheSocketLink from "./absinthe-socket-link";

const link = new ApolloLink.split(
const link = split(
operation => hasSubscription(operation.query),
absintheSocketLink,
createHttpLink({uri: "/graphql"})
Expand Down
56 changes: 20 additions & 36 deletions packages/socket-apollo-link/src/createAbsintheSocketLink.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
// @flow

import {ApolloLink} from "apollo-link";
import {cancel, send, toObservable} from "@absinthe/socket";
import {send, toObservable, unobserveOrCancel} from "@absinthe/socket";
import {compose} from "flow-static-land/lib/Fun";
import {print} from "graphql/language/printer";
import {print} from "graphql";

import type {
AbsintheSocket,
GqlRequest,
Observer
} from "@absinthe/socket/compat/cjs/types";
import type {AbsintheSocket, GqlRequest, Observer} from "@absinthe/socket";
import type {DocumentNode} from "graphql/language/ast";

type ApolloOperation<Variables> = {
type ApolloOperation<Variables> = {|
query: DocumentNode,
variables: Variables
|};

const unobserveOrCancelIfNeeded = (absintheSocket, notifier, observer) => {
if (notifier && observer) {
unobserveOrCancel(absintheSocket, notifier, observer);
}
};

const notifierToObservable = (absintheSocket, onError, onStart) => notifier =>
toObservable(absintheSocket, notifier, {
onError,
onStart,
unsubscribe: unobserveOrCancelIfNeeded
});

const getRequest = <Variables: Object>({
query,
variables
Expand All @@ -25,39 +34,14 @@ const getRequest = <Variables: Object>({
variables
});

const notifierToObservable = (absintheSocket, onError, onStart) => notifier => {
let notifierStarted;
let unsubscribed = false;

return toObservable(absintheSocket, notifier, {
onError,
onStart: notifierLatest => {
notifierStarted = notifierLatest;

if (unsubscribed) {
cancel(absintheSocket, notifierStarted);
}

onStart && onStart(notifierLatest);
},
unsubscribe: () => {
unsubscribed = true;

if (notifierStarted) {
cancel(absintheSocket, notifierStarted);
}
}
});
};

/**
* Creates a terminating ApolloLink to request operations using given
* AbsintheSocket instance
*/
const createAbsintheSocketLink = (
const createAbsintheSocketLink = <Result, Variables: void | Object>(
absintheSocket: AbsintheSocket,
onError?: $PropertyType<Observer<*>, "onError">,
onStart?: $PropertyType<Observer<*>, "onStart">
onError?: $ElementType<Observer<Result, Variables>, "onError">,
onStart?: $ElementType<Observer<Result, Variables>, "onStart">
) =>
new ApolloLink(
compose(
Expand Down
6 changes: 1 addition & 5 deletions packages/socket-apollo-link/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// @flow

// @create-index

export {
default as createAbsintheSocketLink
} from "./createAbsintheSocketLink.js";
export {default as createAbsintheSocketLink} from "./createAbsintheSocketLink";
1 change: 0 additions & 1 deletion packages/socket-graphiql/.npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.*
indexIgnore.sed
readmeTemplate.ejs
yarn.lock
yarn-error.log
7 changes: 4 additions & 3 deletions packages/socket-graphiql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [Using yarn](#using-yarn)
- [API](#api)
- [createFetcher](#createfetcher)
- [Parameters](#parameters)
- [License](#license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Expand All @@ -33,11 +34,11 @@

Creates a Fetcher using the given arguments

**Parameters**
#### Parameters

- `apiUrl` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
- `apiUrl` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
- `subscriptionsClient` **SubscriptionClient**
- `subscriptionSentMessage` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
- `subscriptionSentMessage` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**

## License

Expand Down
Loading

0 comments on commit a1797c5

Please sign in to comment.