@graphiql/toolkit
Advanced tools
Comparing version 0.1.1 to 0.2.0
# @graphiql/toolkit | ||
## 0.2.0 | ||
### Minor Changes | ||
- [`dd9397e4`](https://github.com/graphql/graphiql/commit/dd9397e4c693b5ceadbd26d6fa92aa6246aac9c3) [#1819](https://github.com/graphql/graphiql/pull/1819) Thanks [@acao](https://github.com/acao)! - `GraphiQL.createClient()` accepts custom `legacyClient`, exports typescript types, fixes #1800. | ||
`createGraphiQLFetcher` now only attempts an `graphql-ws` connection when only `subscriptionUrl` is provided. In order to use `graphql-transport-ws`, you'll need to provide the `legacyClient` option only, and no `subscriptionUrl` or `wsClient` option. | ||
### Patch Changes | ||
- [`6869ce77`](https://github.com/graphql/graphiql/commit/6869ce7767050787db5f1017abf82fa5a52fc97a) [#1816](https://github.com/graphql/graphiql/pull/1816) Thanks [@acao](https://github.com/acao)! - improve peer resolutions for graphql 14 & 15. `14.5.0` minimum is for built-in typescript types, and another method only available in `14.4.0` | ||
## 0.1.1 | ||
@@ -4,0 +16,0 @@ |
@@ -1,3 +0,2 @@ | ||
export * from './types'; | ||
export { createGraphiQLFetcher } from './createFetcher'; | ||
export * from './create-fetcher'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -13,6 +13,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createGraphiQLFetcher = void 0; | ||
__exportStar(require("./types"), exports); | ||
var createFetcher_1 = require("./createFetcher"); | ||
Object.defineProperty(exports, "createGraphiQLFetcher", { enumerable: true, get: function () { return createFetcher_1.createGraphiQLFetcher; } }); | ||
__exportStar(require("./create-fetcher"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -82,3 +82,3 @@ ## Create Fetcher | ||
This generates a `graphql-ws` client. | ||
This generates a `graphql-ws` client using the provided url. Note that a server must be compatible with the new `graphql-ws` subscriptions spec for this to work. | ||
@@ -89,2 +89,6 @@ #### `wsClient` | ||
#### `legacyClient` | ||
provide a legacy subscriptions client. bypasses `subscriptionUrl`. In theory, this could be any client using any transport, as long as it matches `subscriptions-transport-ws` `Client` signature. | ||
#### `headers` | ||
@@ -102,3 +106,3 @@ | ||
Just by providing the `subscriptionUrl` | ||
Just by providing the `wsClient` | ||
@@ -129,2 +133,27 @@ ```ts | ||
#### Custom `legacyClient` Example | ||
By providing the `legacyClient` you can support a `subscriptions-transport-ws` client implementation, or equivalent | ||
```ts | ||
import * as React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { GraphiQL } from 'graphiql'; | ||
import { SubscriptionClient } from 'subscriptions-transport-ws'; | ||
import { createGraphiQLFetcher } from '@graphiql/toolkit'; | ||
const url = 'https://myschema.com/graphql'; | ||
const subscriptionUrl = 'wss://myschema.com/graphql'; | ||
const fetcher = createGraphiQLFetcher({ | ||
url, | ||
legacyClient: new SubscriptionsClient(subscriptionUrl), | ||
}); | ||
export const App = () => <GraphiQL fetcher={fetcher} />; | ||
ReactDOM.render(document.getElementByID('graphiql'), <App />); | ||
``` | ||
#### Custom `fetcher` Example | ||
@@ -155,2 +184,2 @@ | ||
This is inspired from `graphql-subscriptions-fetcher` and thanks to @Urigo | ||
This is originally inspired by `graphql-subscriptions-fetcher` created by @Urigo |
@@ -1,3 +0,2 @@ | ||
export * from './types'; | ||
export { createGraphiQLFetcher } from './createFetcher'; | ||
export * from './create-fetcher'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,2 @@ | ||
export * from './types'; | ||
export { createGraphiQLFetcher } from './createFetcher'; | ||
export * from './create-fetcher'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@graphiql/toolkit", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Utility to build a fetcher for GraphiQL", | ||
@@ -20,14 +20,20 @@ "contributors": [ | ||
"module": "esm/index.js", | ||
"types": "dist/index.d.ts", | ||
"typings": "dist/index.d.ts", | ||
"scripts": {}, | ||
"dependencies": { | ||
"graphql-ws": "^4.1.0", | ||
"subscriptions-transport-ws": "^0.9.18", | ||
"meros": "^1.1.2", | ||
"@n1ru4l/push-pull-async-iterable-iterator": "^2.0.1" | ||
"@n1ru4l/push-pull-async-iterable-iterator": "^2.0.1", | ||
"graphql-ws": "^4.3.2", | ||
"meros": "^1.1.4" | ||
}, | ||
"devDependencies": { | ||
"isomorphic-fetch": "^3.0.0", | ||
"graphql": "experimental-stream-defer" | ||
"graphql": "experimental-stream-defer", | ||
"subscriptions-transport-ws": "^0.9.18" | ||
}, | ||
"optionalDependencies": { | ||
"subscriptions-transport-ws": "^0.9.18" | ||
}, | ||
"peerDependencies": { | ||
"graphql": ">= v14.5.0 <= 15.5.0" | ||
}, | ||
"keywords": [ | ||
@@ -34,0 +40,0 @@ "graphql", |
@@ -5,12 +5,14 @@ # `@graphiql/toolkit` | ||
The goal is to make this and related packages a set of general purpose tools used to build an end implementation like GraphiQL | ||
Part of the GraphiQL 2.0.0 initiative. | ||
It also allows us to share utilities, libraries and components that can be used by | ||
## Docs | ||
- **`createFetcher` [(Docs)](./docs/create-fetcher.md)** : a utility for creating a `fetcher` prop implementation for HTTP GET, POST including multipart, websockets fetcher | ||
- more to come! | ||
## Todo | ||
- [x] Begin porting common type definitions used by GraphiQL and it's dependencies | ||
- [ ] Port over the GraphiQL components library created by @walaura and designed by @orta | ||
- [ ] `createFetcher` utility for an easier `fetcher` | ||
- [ ] Migrate over general purpose `graphiql/src/utilities` | ||
- [ ] Frontend framework agnostic state implementation | ||
- [ ] React components and hooks? Or should react specifics live seperately? | ||
- [ ] Utility to generate json schema spec from `getQueryFacts` for monaco, vscode, etc |
@@ -1,4 +0,2 @@ | ||
export * from './types'; | ||
export { createGraphiQLFetcher } from './createFetcher'; | ||
export * from './create-fetcher'; | ||
// TODO: move the most useful utilities from graphiql to here |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
393704
56
1145
18
5
3
+ Addedgraphql@15.5.0(transitive)
- Removedsubscriptions-transport-ws@^0.9.18
- Removedgraphql@15.9.0(transitive)
Updatedgraphql-ws@^4.3.2
Updatedmeros@^1.1.4