graphlit-client 1.0.20240417002 → 1.0.20240418001
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/LICENSE +21 -21
- package/README.md +53 -53
- package/dist/client.js +2 -2
- package/package.json +1 -1
package/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2024 Unstruk Data Inc.
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Unstruk Data Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
@@ -1,53 +1,53 @@
|
|
1
|
-
# TypeScript Client for Graphlit Platform
|
2
|
-
## Overview
|
3
|
-
|
4
|
-
The Graphlit Client for Node.js 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
|
-
|
6
|
-
## Prerequisites
|
7
|
-
|
8
|
-
Before you begin, ensure you have the following:
|
9
|
-
|
10
|
-
- Node.js installed on your system (recommended version 20.x or higher).
|
11
|
-
- An active account on the [Graphlit Platform](https://portal.graphlit.dev) with access to the API settings dashboard.
|
12
|
-
|
13
|
-
## Installation
|
14
|
-
|
15
|
-
To install the Graphlit Client, use npm or yarn:
|
16
|
-
|
17
|
-
```bash
|
18
|
-
npm install graphlit-client
|
19
|
-
```
|
20
|
-
or
|
21
|
-
```bash
|
22
|
-
yarn add graphlit-client
|
23
|
-
```
|
24
|
-
|
25
|
-
## Configuration
|
26
|
-
|
27
|
-
The Graphlit Client supports environment variables to be set for authentication and configuration:
|
28
|
-
|
29
|
-
- `GRAPHLIT_ENVIRONMENT_ID`: Your environment ID.
|
30
|
-
- `GRAPHLIT_ORGANIZATION_ID`: Your organization ID.
|
31
|
-
- `GRAPHLIT_JWT_SECRET`: Your JWT secret for signing the JWT token.
|
32
|
-
|
33
|
-
Alternately, you can pass these values with the constructor of the Graphlit client.
|
34
|
-
|
35
|
-
You can find these values in the API settings dashboard on the [Graphlit Platform](https://portal.graphlit.dev).
|
36
|
-
|
37
|
-
### Setting Environment Variables
|
38
|
-
|
39
|
-
To set these environment variables on your system, you can place them in a `.env` file at the root of your project:
|
40
|
-
|
41
|
-
```env
|
42
|
-
GRAPHLIT_ENVIRONMENT_ID=your_environment_id_value
|
43
|
-
GRAPHLIT_ORGANIZATION_ID=your_organization_id_value
|
44
|
-
GRAPHLIT_JWT_SECRET=your_jwt_secret_value
|
45
|
-
```
|
46
|
-
|
47
|
-
## Support
|
48
|
-
|
49
|
-
Please refer to the [Graphlit API Documentation](https://docs.graphlit.dev/).
|
50
|
-
|
51
|
-
For support with the Graphlit Client, please submit a [GitHub Issue](https://github.com/graphlit/graphlit-client-typescript/issues).
|
52
|
-
|
53
|
-
For further support with the Graphlit Platform, please join our [Discord](https://discord.gg/ygFmfjy3Qx) community.
|
1
|
+
# TypeScript Client for Graphlit Platform
|
2
|
+
## Overview
|
3
|
+
|
4
|
+
The Graphlit Client for Node.js 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
|
+
|
6
|
+
## Prerequisites
|
7
|
+
|
8
|
+
Before you begin, ensure you have the following:
|
9
|
+
|
10
|
+
- Node.js installed on your system (recommended version 20.x or higher).
|
11
|
+
- An active account on the [Graphlit Platform](https://portal.graphlit.dev) with access to the API settings dashboard.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
To install the Graphlit Client, use npm or yarn:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
npm install graphlit-client
|
19
|
+
```
|
20
|
+
or
|
21
|
+
```bash
|
22
|
+
yarn add graphlit-client
|
23
|
+
```
|
24
|
+
|
25
|
+
## Configuration
|
26
|
+
|
27
|
+
The Graphlit Client supports environment variables to be set for authentication and configuration:
|
28
|
+
|
29
|
+
- `GRAPHLIT_ENVIRONMENT_ID`: Your environment ID.
|
30
|
+
- `GRAPHLIT_ORGANIZATION_ID`: Your organization ID.
|
31
|
+
- `GRAPHLIT_JWT_SECRET`: Your JWT secret for signing the JWT token.
|
32
|
+
|
33
|
+
Alternately, you can pass these values with the constructor of the Graphlit client.
|
34
|
+
|
35
|
+
You can find these values in the API settings dashboard on the [Graphlit Platform](https://portal.graphlit.dev).
|
36
|
+
|
37
|
+
### Setting Environment Variables
|
38
|
+
|
39
|
+
To set these environment variables on your system, you can place them in a `.env` file at the root of your project:
|
40
|
+
|
41
|
+
```env
|
42
|
+
GRAPHLIT_ENVIRONMENT_ID=your_environment_id_value
|
43
|
+
GRAPHLIT_ORGANIZATION_ID=your_organization_id_value
|
44
|
+
GRAPHLIT_JWT_SECRET=your_jwt_secret_value
|
45
|
+
```
|
46
|
+
|
47
|
+
## Support
|
48
|
+
|
49
|
+
Please refer to the [Graphlit API Documentation](https://docs.graphlit.dev/).
|
50
|
+
|
51
|
+
For support with the Graphlit Client, please submit a [GitHub Issue](https://github.com/graphlit/graphlit-client-typescript/issues).
|
52
|
+
|
53
|
+
For further support with the Graphlit Platform, please join our [Discord](https://discord.gg/ygFmfjy3Qx) community.
|
package/dist/client.js
CHANGED
@@ -41,10 +41,10 @@ const dotenv = __importStar(require("dotenv"));
|
|
41
41
|
dotenv.config();
|
42
42
|
// Define the Graphlit class
|
43
43
|
class Graphlit {
|
44
|
-
constructor(
|
44
|
+
constructor(organizationId, environmentId, jwtSecret, ownerId, apiUri, correlationId) {
|
45
45
|
this.apiUri = apiUri || "https://data-scus.graphlit.io/api/v1";
|
46
|
-
this.environmentId = environmentId || process.env.GRAPHLIT_ENVIRONMENT_ID;
|
47
46
|
this.organizationId = organizationId || process.env.GRAPHLIT_ORGANIZATION_ID;
|
47
|
+
this.environmentId = environmentId || process.env.GRAPHLIT_ENVIRONMENT_ID;
|
48
48
|
this.jwtSecret = jwtSecret || process.env.GRAPHLIT_JWT_SECRET;
|
49
49
|
// optional: for multi-tenant support
|
50
50
|
this.ownerId = ownerId || process.env.GRAPHLIT_OWNER_ID;
|