Socket
Socket
Sign inDemoInstall

@graphiql/toolkit

Package Overview
Dependencies
Maintainers
5
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphiql/toolkit - npm Package Compare versions

Comparing version 0.11.0 to 0.12.0-canary-fea44159.0

dist/cjs/create-fetcher/create-sse-fetcher.js

6

CHANGELOG.md
# @graphiql/toolkit
## 0.12.0-canary-fea44159.0
### Minor Changes
- [#3750](https://github.com/graphql/graphiql/pull/3750) [`c35884d`](https://github.com/graphql/graphiql/commit/c35884dd99613b0a43a5bf081be2ecb30d89e5ff) Thanks [@dimaMachina](https://github.com/dimaMachina)! - support graphql SSE for `options.subscriptionUrl`
## 0.11.0

@@ -4,0 +10,0 @@

6

dist/cjs/create-fetcher/createFetcher.js

@@ -21,3 +21,3 @@ "use strict";

module.exports = __toCommonJS(createFetcher_exports);
var import_lib = require("./lib");
var import_lib = require("./lib"), import_create_sse_fetcher = require("./create-sse-fetcher");
function createGraphiQLFetcher(options) {

@@ -39,2 +39,6 @@ const httpFetch = options.fetch || typeof window != "undefined" && window.fetch;

) : !1) {
if (options.subscriptionUrl && !options.subscriptionUrl.startsWith("ws"))
return (await (0, import_create_sse_fetcher.createSseFetcher)({
url: options.subscriptionUrl
}))(graphQLParams);
const wsFetcher = await (0, import_lib.getWsFetcher)(options, fetcherOpts);

@@ -41,0 +45,0 @@ if (!wsFetcher)

@@ -8,2 +8,3 @@ import "../chunk-LMOQIXV4.js";

} from "./lib";
import { createSseFetcher } from "./create-sse-fetcher";
function createGraphiQLFetcher(options) {

@@ -25,2 +26,6 @@ const httpFetch = options.fetch || typeof window != "undefined" && window.fetch;

) : !1) {
if (options.subscriptionUrl && !options.subscriptionUrl.startsWith("ws"))
return (await createSseFetcher({
url: options.subscriptionUrl
}))(graphQLParams);
const wsFetcher = await getWsFetcher(options, fetcherOpts);

@@ -27,0 +32,0 @@ if (!wsFetcher)

9

package.json
{
"name": "@graphiql/toolkit",
"version": "0.11.0",
"version": "0.12.0-canary-fea44159.0",
"description": "Utility to build a fetcher for GraphiQL",

@@ -35,2 +35,3 @@ "contributors": [

"graphql-ws": "^5.5.5",
"graphql-sse": "^2.5.3",
"isomorphic-fetch": "^3.0.0",

@@ -42,3 +43,4 @@ "subscriptions-transport-ws": "0.11.0",

"graphql": "^15.5.0 || ^16.0.0 || ^17.0.0-alpha.2",
"graphql-ws": ">= 4.5.0"
"graphql-ws": ">= 4.5.0",
"graphql-sse": "^2"
},

@@ -48,2 +50,5 @@ "peerDependenciesMeta": {

"optional": true
},
"graphql-sse": {
"optional": true
}

@@ -50,0 +55,0 @@ },

@@ -9,7 +9,8 @@ import type { Fetcher, CreateFetcherOptions } from './types';

} from './lib';
import { createSseFetcher } from './create-sse-fetcher';
/**
* build a GraphiQL fetcher that is:
* Build a GraphiQL fetcher that is:
* - backwards compatible
* - optionally supports graphql-ws or `
* - optionally supports graphql-ws or graphql-sse
*/

@@ -44,3 +45,14 @@ export function createGraphiQLFetcher(options: CreateFetcherOptions): Fetcher {

: false;
if (isSubscription) {
if (
options.subscriptionUrl &&
!options.subscriptionUrl.startsWith('ws')
) {
const sseFetcher = await createSseFetcher({
url: options.subscriptionUrl,
});
return sseFetcher(graphQLParams);
}
const wsFetcher = await getWsFetcher(options, fetcherOpts);

@@ -47,0 +59,0 @@

@@ -84,3 +84,3 @@ import type { DocumentNode, IntrospectionQuery } from 'graphql';

/**
* url for websocket subscription requests
* url for websocket subscription requests or SSE
*/

@@ -87,0 +87,0 @@ subscriptionUrl?: string;

@@ -7,3 +7,2 @@ import { defineConfig, Options } from 'tsup';

clean: true,
dts: true,
minifySyntax: true,

@@ -21,2 +20,3 @@ };

},
dts: true,
},

@@ -23,0 +23,0 @@ {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc