graphlit-client 1.0.20240418012 → 1.0.20240418014
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/README.md +2 -3
- package/dist/client.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# JavaScript Client for Graphlit Platform
|
2
2
|
## Overview
|
3
3
|
|
4
|
-
The Graphlit Client for
|
4
|
+
The Graphlit Client for JavaScript enables straightforward interactions with the Graphlit API, allowing developers to execute GraphQL queries and mutations against the Graphlit service. This document outlines the setup process and provides a basic example of using the client.
|
5
5
|
|
6
6
|
## Prerequisites
|
7
7
|
|
8
8
|
Before you begin, ensure you have the following:
|
9
9
|
|
10
|
-
- Node.js installed on your system (recommended version 20.x or higher).
|
11
10
|
- An active account on the [Graphlit Platform](https://portal.graphlit.dev) with access to the API settings dashboard.
|
12
11
|
|
13
12
|
## Installation
|
package/dist/client.js
CHANGED
@@ -68,6 +68,7 @@ class Graphlit {
|
|
68
68
|
throw new Error("Graphlit environment JWT secret is required.");
|
69
69
|
}
|
70
70
|
this.initializeJWT().then(() => {
|
71
|
+
console.log(this.token);
|
71
72
|
const httpLink = (0, core_1.createHttpLink)({
|
72
73
|
uri: this.apiUri,
|
73
74
|
});
|
@@ -83,6 +84,7 @@ class Graphlit {
|
|
83
84
|
link: authLink.concat(httpLink),
|
84
85
|
cache: new core_1.InMemoryCache(),
|
85
86
|
});
|
87
|
+
console.log("Apollo client has been initialized.");
|
86
88
|
});
|
87
89
|
}
|
88
90
|
initializeJWT() {
|
@@ -421,7 +423,7 @@ class Graphlit {
|
|
421
423
|
// helper functions
|
422
424
|
mutateAndCheckError(mutation, variables) {
|
423
425
|
return __awaiter(this, void 0, void 0, function* () {
|
424
|
-
if (
|
426
|
+
if (this.client === undefined)
|
425
427
|
throw new Error("Apollo Client not configured.");
|
426
428
|
try {
|
427
429
|
const result = yield this.client.mutate({
|
@@ -446,7 +448,7 @@ class Graphlit {
|
|
446
448
|
}
|
447
449
|
queryAndCheckError(query, variables) {
|
448
450
|
return __awaiter(this, void 0, void 0, function* () {
|
449
|
-
if (
|
451
|
+
if (this.client === undefined)
|
450
452
|
throw new Error("Apollo Client not configured.");
|
451
453
|
try {
|
452
454
|
const result = yield this.client.query({
|