graphlit-client 1.0.20240418006 → 1.0.20240418008

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.
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
1
+ import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
2
  import * as Types from './generated/graphql-types';
3
3
  declare class Graphlit {
4
4
  client: ApolloClient<NormalizedCacheObject>;
package/dist/client.js CHANGED
@@ -33,7 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.Types = exports.Graphlit = void 0;
36
- const client_1 = require("@apollo/client");
36
+ const core_1 = require("@apollo/client/core");
37
37
  const Documents = __importStar(require("./generated/graphql-documents"));
38
38
  const jwt = __importStar(require("jsonwebtoken"));
39
39
  const dotenv = __importStar(require("dotenv"));
@@ -62,10 +62,10 @@ class Graphlit {
62
62
  throw new Error("JWT secret is required.");
63
63
  }
64
64
  this.token = jwt.sign(payload, this.jwtSecret, { algorithm: 'HS256' });
65
- const httpLink = (0, client_1.createHttpLink)({
65
+ const httpLink = (0, core_1.createHttpLink)({
66
66
  uri: this.apiUri,
67
67
  });
68
- const authLink = new client_1.ApolloLink((operation, forward) => {
68
+ const authLink = new core_1.ApolloLink((operation, forward) => {
69
69
  operation.setContext({
70
70
  headers: {
71
71
  Authorization: this.token ? `Bearer ${this.token}` : "",
@@ -73,9 +73,9 @@ class Graphlit {
73
73
  });
74
74
  return forward(operation);
75
75
  });
76
- this.client = new client_1.ApolloClient({
76
+ this.client = new core_1.ApolloClient({
77
77
  link: authLink.concat(httpLink),
78
- cache: new client_1.InMemoryCache(),
78
+ cache: new core_1.InMemoryCache(),
79
79
  });
80
80
  }
81
81
  createAlert(alert) {
@@ -392,7 +392,7 @@ class Graphlit {
392
392
  return result.data;
393
393
  }
394
394
  catch (error) {
395
- if (error instanceof client_1.ApolloError && error.graphQLErrors.length > 0) {
395
+ if (error instanceof core_1.ApolloError && error.graphQLErrors.length > 0) {
396
396
  const errorMessage = error.graphQLErrors.map(err => err.message).join("\n");
397
397
  throw new Error(errorMessage);
398
398
  }
@@ -415,7 +415,7 @@ class Graphlit {
415
415
  return result.data;
416
416
  }
417
417
  catch (error) {
418
- if (error instanceof client_1.ApolloError && error.graphQLErrors.length > 0) {
418
+ if (error instanceof core_1.ApolloError && error.graphQLErrors.length > 0) {
419
419
  const errorMessage = error.graphQLErrors.map(err => err.message).join("\n");
420
420
  throw new Error(errorMessage);
421
421
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20240418006",
3
+ "version": "1.0.20240418008",
4
4
  "description": "Graphlit API TypeScript Client",
5
5
  "main": "dist/client.js",
6
6
  "types": "dist/client.d.ts",
@@ -26,7 +26,6 @@
26
26
  "@graphql-codegen/cli": "^5.0.2",
27
27
  "@graphql-codegen/typescript": "^4.0.6",
28
28
  "@graphql-codegen/typescript-operations": "^4.2.0",
29
- "@graphql-codegen/typescript-react-apollo": "^4.3.0",
30
29
  "graphql": "^16.8.1",
31
30
  "jsonwebtoken": "^9.0.2"
32
31
  },