Comparing version 0.51.0 to 0.52.0
@@ -40,3 +40,3 @@ "use strict"; | ||
exports.GraphQLClient = void 0; | ||
var ws = require("ws"); | ||
var isomorphic_ws_1 = require("isomorphic-ws"); | ||
var graphql_ws_1 = require("graphql-ws"); | ||
@@ -135,7 +135,6 @@ var errors_1 = require("../errors"); | ||
var connectionParams = auth ? (_a = {}, _a[auth[0]] = auth[1], _a) : {}; | ||
var webSocketImpl = typeof window === "undefined" ? ws : window.WebSocket; | ||
return _this.createClient({ | ||
url: _this.subscriptionEndpoint, | ||
connectionParams: connectionParams, | ||
webSocketImpl: webSocketImpl, | ||
webSocketImpl: isomorphic_ws_1.WebSocket, | ||
}); | ||
@@ -142,0 +141,0 @@ }; |
{ | ||
"name": "kontist", | ||
"version": "0.51.0", | ||
"version": "0.52.0", | ||
"description": "Kontist client SDK", | ||
@@ -26,5 +26,6 @@ "main": "dist/lib/index.js", | ||
"graphql-ws": "^5.5.5", | ||
"isomorphic-ws": "^5.0.0", | ||
"js-sha256": "^0.9.0", | ||
"querystring-es3": "^0.2.1", | ||
"ws": "^8.4.2" | ||
"ws": "^8.16.0" | ||
}, | ||
@@ -31,0 +32,0 @@ "overrides": { |
import * as sinon from "sinon"; | ||
import * as ws from "ws"; | ||
import { WebSocket } from "isomorphic-ws"; | ||
@@ -543,35 +543,12 @@ import { GraphQLError, UserUnauthorizedError } from "../../lib/errors"; | ||
expect(createClientStub.callCount).to.equal(1); | ||
const {url, connectionParams} = createClientStub.getCall( | ||
0, | ||
).args[0]; | ||
const { url, connectionParams, webSocketImpl } = | ||
createClientStub.getCall(0).args[0]; | ||
expect(url).to.equal( | ||
`${KONTIST_SUBSCRIPTION_API_BASE_URL}/api/graphql`, | ||
); | ||
expect(url).to.equal(`${KONTIST_SUBSCRIPTION_API_BASE_URL}/api/graphql`); | ||
expect(connectionParams).to.deep.equal({ | ||
Authorization: "Bearer dummy-token", | ||
}); | ||
expect(webSocketImpl).to.equal(WebSocket); | ||
expect(subscriptionClient).to.equal(fakeGraphqlWsClient); | ||
}); | ||
describe("when executing in a browser environment", () => { | ||
before(() => { | ||
(global as any).window = { | ||
WebSocket: {...ws, fake: true}, | ||
}; | ||
}); | ||
after(() => { | ||
(global as any).window = undefined; | ||
}); | ||
it("should use the native browser WebSocket implementation", () => { | ||
createClientStub.resetHistory(); | ||
client.graphQL.createSubscriptionClient(); | ||
expect(createClientStub.callCount).to.equal(1); | ||
expect(createClientStub.getCall(0).args[0].webSocketImpl.fake).to.equal(true); | ||
}); | ||
}); | ||
}); | ||
@@ -578,0 +555,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1283972
12
20297
+ Addedisomorphic-ws@^5.0.0
+ Addedisomorphic-ws@5.0.0(transitive)
Updatedws@^8.16.0