@apollo/client 3.5.9 → 3.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  // consult the @apollo/client/invariantErrorCodes.js file specific to
6
6
  // your @apollo/client version. This file is not meant to be imported.
7
7
  {
8
- "@apollo/client version": "3.5.9",
8
+ "@apollo/client version": "3.5.10",
9
9
 
10
10
  1: {
11
11
  file: "@apollo/client/cache/inmemory/entityStore.js",
@@ -0,0 +1,9 @@
1
+ import type { Client } from "graphql-ws";
2
+ import { ApolloLink, Operation, FetchResult } from "../core";
3
+ import { Observable } from "../../utilities";
4
+ export declare class GraphQLWsLink extends ApolloLink {
5
+ readonly client: Client;
6
+ constructor(client: Client);
7
+ request(operation: Operation): Observable<FetchResult>;
8
+ }
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/link/subscriptions/index.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAmB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAe9D,qBAAa,aAAc,SAAQ,UAAU;aACf,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM;IAInC,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC;CA+B9D"}
@@ -0,0 +1,39 @@
1
+ import { __assign, __extends } from "tslib";
2
+ import { print } from "graphql";
3
+ import { ApolloLink } from "../core/index.js";
4
+ import { isNonNullObject, Observable } from "../../utilities/index.js";
5
+ import { ApolloError } from "../../errors/index.js";
6
+ function isLikeCloseEvent(val) {
7
+ return isNonNullObject(val) && 'code' in val && 'reason' in val;
8
+ }
9
+ var GraphQLWsLink = (function (_super) {
10
+ __extends(GraphQLWsLink, _super);
11
+ function GraphQLWsLink(client) {
12
+ var _this = _super.call(this) || this;
13
+ _this.client = client;
14
+ return _this;
15
+ }
16
+ GraphQLWsLink.prototype.request = function (operation) {
17
+ var _this = this;
18
+ return new Observable(function (observer) {
19
+ return _this.client.subscribe(__assign(__assign({}, operation), { query: print(operation.query) }), {
20
+ next: observer.next.bind(observer),
21
+ complete: observer.complete.bind(observer),
22
+ error: function (err) {
23
+ if (err instanceof Error) {
24
+ return observer.error(err);
25
+ }
26
+ if (isLikeCloseEvent(err)) {
27
+ return observer.error(new Error("Socket closed with event ".concat(err.code, " ").concat(err.reason || "")));
28
+ }
29
+ return observer.error(new ApolloError({
30
+ graphQLErrors: Array.isArray(err) ? err : [err],
31
+ }));
32
+ },
33
+ });
34
+ });
35
+ };
36
+ return GraphQLWsLink;
37
+ }(ApolloLink));
38
+ export { GraphQLWsLink };
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/subscriptions/index.ts"],"names":[],"mappings":";AA8BA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,UAAU,EAA0B,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAS3C,SAAS,gBAAgB,CAAC,GAAY;IACpC,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,CAAC;AAClE,CAAC;AAGD;IAAmC,iCAAU;IAC3C,uBAA4B,MAAc;QAA1C,YACE,iBAAO,SACR;QAF2B,YAAM,GAAN,MAAM,CAAQ;;IAE1C,CAAC;IAEM,+BAAO,GAAd,UAAe,SAAoB;QAAnC,iBA8BC;QA7BC,OAAO,IAAI,UAAU,CAAC,UAAC,QAAQ;YAC7B,OAAO,KAAI,CAAC,MAAM,CAAC,SAAS,uBACrB,SAAS,KAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAC7C;gBACE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAClC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAC1C,KAAK,EAAE,UAAC,GAAG;oBACT,IAAI,GAAG,YAAY,KAAK,EAAE;wBACxB,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;qBAC5B;oBAED,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE;wBACzB,OAAO,QAAQ,CAAC,KAAK,CAEnB,IAAI,KAAK,CACP,mCAA4B,GAAG,CAAC,IAAI,cAAI,GAAG,CAAC,MAAM,IAAI,EAAE,CAAE,CAC3D,CACF,CAAC;qBACH;oBAED,OAAO,QAAQ,CAAC,KAAK,CACnB,IAAI,WAAW,CAAC;wBACd,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;qBAChD,CAAC,CACH,CAAC;gBACJ,CAAC;aACF,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACH,oBAAC;AAAD,CAAC,AApCD,CAAmC,UAAU,GAoC5C","sourcesContent":["// This file is adapted from the graphql-ws npm package:\n// https://github.com/enisdenjo/graphql-ws\n//\n// Most of the file comes from that package's README; some other parts (such as\n// isLikeCloseEvent) come from its source.\n//\n// Here's the license of the original code:\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2020-2021 Denis Badurina\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport { print } from \"graphql\";\nimport type { Client } from \"graphql-ws\";\n\nimport { ApolloLink, Operation, FetchResult } from \"../core\";\nimport { isNonNullObject, Observable } from \"../../utilities\";\nimport { ApolloError } from \"../../errors\";\n\ninterface LikeCloseEvent {\n /** Returns the WebSocket connection close code provided by the server. */\n readonly code: number;\n /** Returns the WebSocket connection close reason provided by the server. */\n readonly reason: string;\n}\n\nfunction isLikeCloseEvent(val: unknown): val is LikeCloseEvent {\n return isNonNullObject(val) && 'code' in val && 'reason' in val;\n}\n\n\nexport class GraphQLWsLink extends ApolloLink {\n constructor(public readonly client: Client) {\n super();\n }\n\n public request(operation: Operation): Observable<FetchResult> {\n return new Observable((observer) => {\n return this.client.subscribe<FetchResult>(\n { ...operation, query: print(operation.query) },\n {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: (err) => {\n if (err instanceof Error) {\n return observer.error(err);\n }\n\n if (isLikeCloseEvent(err)) {\n return observer.error(\n // reason will be available on clean closes\n new Error(\n `Socket closed with event ${err.code} ${err.reason || \"\"}`\n )\n );\n }\n\n return observer.error(\n new ApolloError({\n graphQLErrors: Array.isArray(err) ? err : [err],\n })\n );\n },\n }\n );\n });\n }\n}\n"]}
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@apollo/client/link/subscriptions",
3
+ "type": "module",
4
+ "main": "subscriptions.cjs",
5
+ "module": "index.js",
6
+ "types": "index.d.ts",
7
+ "sideEffects": false
8
+ }
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var graphql = require('graphql');
7
+ var core = require('../core');
8
+ var utilities = require('../../utilities');
9
+ var errors = require('../../errors');
10
+
11
+ function isLikeCloseEvent(val) {
12
+ return utilities.isNonNullObject(val) && 'code' in val && 'reason' in val;
13
+ }
14
+ var GraphQLWsLink = (function (_super) {
15
+ tslib.__extends(GraphQLWsLink, _super);
16
+ function GraphQLWsLink(client) {
17
+ var _this = _super.call(this) || this;
18
+ _this.client = client;
19
+ return _this;
20
+ }
21
+ GraphQLWsLink.prototype.request = function (operation) {
22
+ var _this = this;
23
+ return new utilities.Observable(function (observer) {
24
+ return _this.client.subscribe(tslib.__assign(tslib.__assign({}, operation), { query: graphql.print(operation.query) }), {
25
+ next: observer.next.bind(observer),
26
+ complete: observer.complete.bind(observer),
27
+ error: function (err) {
28
+ if (err instanceof Error) {
29
+ return observer.error(err);
30
+ }
31
+ if (isLikeCloseEvent(err)) {
32
+ return observer.error(new Error("Socket closed with event ".concat(err.code, " ").concat(err.reason || "")));
33
+ }
34
+ return observer.error(new errors.ApolloError({
35
+ graphQLErrors: Array.isArray(err) ? err : [err],
36
+ }));
37
+ },
38
+ });
39
+ });
40
+ };
41
+ return GraphQLWsLink;
42
+ }(core.ApolloLink));
43
+
44
+ exports.GraphQLWsLink = GraphQLWsLink;
45
+ //# sourceMappingURL=subscriptions.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.cjs","sources":["index.js"],"sourcesContent":["import { __assign, __extends } from \"tslib\";\nimport { print } from \"graphql\";\nimport { ApolloLink } from \"../core\";\nimport { isNonNullObject, Observable } from \"../../utilities\";\nimport { ApolloError } from \"../../errors\";\nfunction isLikeCloseEvent(val) {\n return isNonNullObject(val) && 'code' in val && 'reason' in val;\n}\nvar GraphQLWsLink = (function (_super) {\n __extends(GraphQLWsLink, _super);\n function GraphQLWsLink(client) {\n var _this = _super.call(this) || this;\n _this.client = client;\n return _this;\n }\n GraphQLWsLink.prototype.request = function (operation) {\n var _this = this;\n return new Observable(function (observer) {\n return _this.client.subscribe(__assign(__assign({}, operation), { query: print(operation.query) }), {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: function (err) {\n if (err instanceof Error) {\n return observer.error(err);\n }\n if (isLikeCloseEvent(err)) {\n return observer.error(new Error(\"Socket closed with event \".concat(err.code, \" \").concat(err.reason || \"\")));\n }\n return observer.error(new ApolloError({\n graphQLErrors: Array.isArray(err) ? err : [err],\n }));\n },\n });\n });\n };\n return GraphQLWsLink;\n}(ApolloLink));\nexport { GraphQLWsLink };\n//# sourceMappingURL=index.js.map"],"names":["isNonNullObject","__extends","Observable","__assign","print","ApolloError","ApolloLink"],"mappings":";;;;;;;;;;AAKA,SAAS,gBAAgB,CAAC,GAAG,EAAE;AAC/B,IAAI,OAAOA,yBAAe,CAAC,GAAG,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,CAAC;AACpE,CAAC;AACE,IAAC,aAAa,IAAI,UAAU,MAAM,EAAE;AACvC,IAAIC,eAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACrC,IAAI,SAAS,aAAa,CAAC,MAAM,EAAE;AACnC,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC9C,QAAQ,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;AAC9B,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,aAAa,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE;AAC3D,QAAQ,IAAI,KAAK,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1
  {
2
2
  "name": "@apollo/client",
3
- "version": "3.5.9",
3
+ "version": "3.5.10",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -30,10 +30,14 @@
30
30
  "homepage": "https://www.apollographql.com/docs/react/",
31
31
  "peerDependencies": {
32
32
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0",
33
+ "graphql-ws": "^5.5.5",
33
34
  "react": "^16.8.0 || ^17.0.0",
34
35
  "subscriptions-transport-ws": "^0.9.0 || ^0.11.0"
35
36
  },
36
37
  "peerDependenciesMeta": {
38
+ "graphql-ws": {
39
+ "optional": true
40
+ },
37
41
  "react": {
38
42
  "optional": true
39
43
  },
@@ -56,10 +60,10 @@
56
60
  "zen-observable-ts": "^1.2.0"
57
61
  },
58
62
  "devDependencies": {
59
- "@babel/parser": "7.17.0",
63
+ "@babel/parser": "7.17.3",
60
64
  "@graphql-tools/schema": "8.3.1",
61
65
  "@rollup/plugin-node-resolve": "11.2.1",
62
- "@testing-library/react": "12.1.2",
66
+ "@testing-library/react": "12.1.3",
63
67
  "@testing-library/react-hooks": "7.0.2",
64
68
  "@types/fast-json-stable-stringify": "2.0.0",
65
69
  "@types/fetch-mock": "7.3.5",
@@ -67,7 +71,7 @@
67
71
  "@types/hoist-non-react-statics": "3.3.1",
68
72
  "@types/jest": "27.4.0",
69
73
  "@types/lodash": "4.14.178",
70
- "@types/node": "16.11.24",
74
+ "@types/node": "16.11.25",
71
75
  "@types/react": "17.0.34",
72
76
  "@types/react-dom": "17.0.2",
73
77
  "bundlesize": "0.18.1",
@@ -76,6 +80,7 @@
76
80
  "fetch-mock": "9.11.0",
77
81
  "glob": "7.2.0",
78
82
  "graphql": "16.0.1",
83
+ "graphql-ws": "5.6.2",
79
84
  "jest": "27.5.1",
80
85
  "jest-fetch-mock": "3.0.3",
81
86
  "jest-junit": "13.0.0",
@@ -85,7 +90,7 @@
85
90
  "recast": "0.21.0",
86
91
  "resolve": "1.22.0",
87
92
  "rimraf": "3.0.2",
88
- "rollup": "2.67.2",
93
+ "rollup": "2.67.3",
89
94
  "rollup-plugin-terser": "7.0.2",
90
95
  "rxjs": "6.6.7",
91
96
  "subscriptions-transport-ws": "0.11.0",
package/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export var version = '3.5.9';
1
+ export var version = '3.5.10';
2
2
  //# sourceMappingURL=version.js.map