graphlit-client 1.0.20240417002 → 1.0.20240418002
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.d.ts +88 -0
- package/dist/client.js +2 -2
- package/dist/generated/graphql-documents.d.ts +72 -0
- package/dist/generated/graphql-types.d.ts +10292 -0
- 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.d.ts
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
|
2
|
+
import * as Types from './generated/graphql-types';
|
3
|
+
declare class Graphlit {
|
4
|
+
client: ApolloClient<NormalizedCacheObject>;
|
5
|
+
private apiUri;
|
6
|
+
private environmentId;
|
7
|
+
private organizationId;
|
8
|
+
private ownerId;
|
9
|
+
private jwtSecret;
|
10
|
+
private correlationId;
|
11
|
+
private token;
|
12
|
+
constructor(organizationId?: string, environmentId?: string, jwtSecret?: string, ownerId?: string, apiUri?: string, correlationId?: string);
|
13
|
+
alert(): {
|
14
|
+
create: (alert: Types.AlertInput) => Promise<any>;
|
15
|
+
update: (alert: Types.AlertUpdateInput) => Promise<any>;
|
16
|
+
delete: (id: string) => Promise<any>;
|
17
|
+
deleteAll: (mutation?: any) => Promise<any>;
|
18
|
+
enable: (id: string) => Promise<any>;
|
19
|
+
disable: (id: string) => Promise<any>;
|
20
|
+
get: (id: string) => Promise<any>;
|
21
|
+
query: (filter: Types.AlertFilter) => Promise<any>;
|
22
|
+
};
|
23
|
+
collection(): {
|
24
|
+
create: (collection: Types.CollectionInput) => Promise<any>;
|
25
|
+
update: (collection: Types.CollectionUpdateInput) => Promise<any>;
|
26
|
+
delete: (id: string) => Promise<any>;
|
27
|
+
add: (contents: Types.EntityReferenceInput[], collections: Types.EntityReferenceInput[]) => Promise<any>;
|
28
|
+
remove: (contents: Types.EntityReferenceInput[], collection: Types.EntityReferenceInput) => Promise<any>;
|
29
|
+
get: (id: string) => Promise<any>;
|
30
|
+
query: (filter: Types.CollectionFilter) => Promise<any>;
|
31
|
+
};
|
32
|
+
content(): {
|
33
|
+
ingestUri: (uri: string, name?: string, id?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput) => Promise<any>;
|
34
|
+
ingestText: (name: string, text: string, textType?: Types.TextTypes, uri?: string, id?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput) => Promise<any>;
|
35
|
+
ingestEncodedFile: (name: string, data: string, mimeType: string, id?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput) => Promise<any>;
|
36
|
+
update: (content: Types.ContentUpdateInput) => Promise<any>;
|
37
|
+
delete: (id: string) => Promise<any>;
|
38
|
+
deleteAll: (mutation?: any) => Promise<any>;
|
39
|
+
summarize: (summarizations: [Types.SummarizationStrategyInput], filter?: Types.ContentFilter) => Promise<any>;
|
40
|
+
extract: (prompt: string, filter?: Types.ContentFilter, specification?: Types.EntityReferenceInput) => Promise<any>;
|
41
|
+
publish: (summaryPrompt: string, summarySpecification: Types.EntityReferenceInput, connector: Types.ContentPublishingConnectorInput, publishPrompt?: string, publishSpecification?: Types.EntityReferenceInput, name?: string, filter?: Types.ContentFilter, workflow?: Types.EntityReferenceInput) => Promise<any>;
|
42
|
+
get: (id: string) => Promise<any>;
|
43
|
+
query: (filter: Types.ContentFilter) => Promise<any>;
|
44
|
+
};
|
45
|
+
conversation(): {
|
46
|
+
create: (conversation: Types.ConversationInput) => Promise<any>;
|
47
|
+
update: (conversation: Types.ConversationUpdateInput) => Promise<any>;
|
48
|
+
delete: (id: string) => Promise<any>;
|
49
|
+
deleteAll: (mutation?: any) => Promise<any>;
|
50
|
+
clear: (id: string) => Promise<any>;
|
51
|
+
close: (id: string) => Promise<any>;
|
52
|
+
prompt: (prompt: string, id?: string) => Promise<any>;
|
53
|
+
publish: (id: string, connector: Types.ContentPublishingConnectorInput, name?: string, workflow?: Types.EntityReferenceInput) => Promise<any>;
|
54
|
+
suggest: (id: string, count?: number) => Promise<any>;
|
55
|
+
get: (id: string) => Promise<any>;
|
56
|
+
query: (filter: Types.ConversationFilter) => Promise<any>;
|
57
|
+
};
|
58
|
+
feed(): {
|
59
|
+
create: (feed: Types.FeedInput) => Promise<any>;
|
60
|
+
update: (feed: Types.FeedUpdateInput) => Promise<any>;
|
61
|
+
delete: (id: string) => Promise<any>;
|
62
|
+
deleteAll: (mutation?: any) => Promise<any>;
|
63
|
+
enable: (id: string) => Promise<any>;
|
64
|
+
disable: (id: string) => Promise<any>;
|
65
|
+
get: (id: string) => Promise<any>;
|
66
|
+
query: (filter: Types.FeedFilter) => Promise<any>;
|
67
|
+
};
|
68
|
+
project(): void;
|
69
|
+
specification(): {
|
70
|
+
create: (specification: Types.SpecificationInput) => Promise<any>;
|
71
|
+
update: (specification: Types.SpecificationUpdateInput) => Promise<any>;
|
72
|
+
delete: (id: string) => Promise<any>;
|
73
|
+
prompt: (prompt: string, ids: [string]) => Promise<any>;
|
74
|
+
get: (id: string) => Promise<any>;
|
75
|
+
query: (filter: Types.SpecificationFilter) => Promise<any>;
|
76
|
+
};
|
77
|
+
workflow(): {
|
78
|
+
create: (workflow: Types.WorkflowInput) => Promise<any>;
|
79
|
+
update: (workflow: Types.WorkflowUpdateInput) => Promise<any>;
|
80
|
+
delete: (id: string) => Promise<any>;
|
81
|
+
deleteAll: (mutation?: any) => Promise<any>;
|
82
|
+
get: (id: string) => Promise<any>;
|
83
|
+
query: (filter: Types.WorkflowFilter) => Promise<any>;
|
84
|
+
};
|
85
|
+
private mutateAndCheckError;
|
86
|
+
private queryAndCheckError;
|
87
|
+
}
|
88
|
+
export { Graphlit };
|
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;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
export declare const CreateAlert: import("graphql").DocumentNode;
|
2
|
+
export declare const DeleteAlert: import("graphql").DocumentNode;
|
3
|
+
export declare const DeleteAlerts: import("graphql").DocumentNode;
|
4
|
+
export declare const DeleteAllAlerts: import("graphql").DocumentNode;
|
5
|
+
export declare const DisableAlert: import("graphql").DocumentNode;
|
6
|
+
export declare const EnableAlert: import("graphql").DocumentNode;
|
7
|
+
export declare const GetAlert: import("graphql").DocumentNode;
|
8
|
+
export declare const QueryAlerts: import("graphql").DocumentNode;
|
9
|
+
export declare const UpdateAlert: import("graphql").DocumentNode;
|
10
|
+
export declare const AddContentsToCollections: import("graphql").DocumentNode;
|
11
|
+
export declare const CreateCollection: import("graphql").DocumentNode;
|
12
|
+
export declare const DeleteCollection: import("graphql").DocumentNode;
|
13
|
+
export declare const DeleteCollections: import("graphql").DocumentNode;
|
14
|
+
export declare const GetCollection: import("graphql").DocumentNode;
|
15
|
+
export declare const QueryCollections: import("graphql").DocumentNode;
|
16
|
+
export declare const RemoveContentsFromCollection: import("graphql").DocumentNode;
|
17
|
+
export declare const UpdateCollection: import("graphql").DocumentNode;
|
18
|
+
export declare const DeleteAllContents: import("graphql").DocumentNode;
|
19
|
+
export declare const DeleteContent: import("graphql").DocumentNode;
|
20
|
+
export declare const DeleteContents: import("graphql").DocumentNode;
|
21
|
+
export declare const ExtractContents: import("graphql").DocumentNode;
|
22
|
+
export declare const GetContent: import("graphql").DocumentNode;
|
23
|
+
export declare const IngestEncodedFile: import("graphql").DocumentNode;
|
24
|
+
export declare const IngestText: import("graphql").DocumentNode;
|
25
|
+
export declare const IngestUri: import("graphql").DocumentNode;
|
26
|
+
export declare const IsContentDone: import("graphql").DocumentNode;
|
27
|
+
export declare const PublishContents: import("graphql").DocumentNode;
|
28
|
+
export declare const QueryContentFacets: import("graphql").DocumentNode;
|
29
|
+
export declare const QueryContents: import("graphql").DocumentNode;
|
30
|
+
export declare const SummarizeContents: import("graphql").DocumentNode;
|
31
|
+
export declare const UpdateContent: import("graphql").DocumentNode;
|
32
|
+
export declare const ClearConversation: import("graphql").DocumentNode;
|
33
|
+
export declare const CloseConversation: import("graphql").DocumentNode;
|
34
|
+
export declare const CreateConversation: import("graphql").DocumentNode;
|
35
|
+
export declare const DeleteAllConversations: import("graphql").DocumentNode;
|
36
|
+
export declare const DeleteConversation: import("graphql").DocumentNode;
|
37
|
+
export declare const DeleteConversations: import("graphql").DocumentNode;
|
38
|
+
export declare const GetConversation: import("graphql").DocumentNode;
|
39
|
+
export declare const PromptConversation: import("graphql").DocumentNode;
|
40
|
+
export declare const PublishConversation: import("graphql").DocumentNode;
|
41
|
+
export declare const QueryConversations: import("graphql").DocumentNode;
|
42
|
+
export declare const SuggestConversation: import("graphql").DocumentNode;
|
43
|
+
export declare const UpdateConversation: import("graphql").DocumentNode;
|
44
|
+
export declare const CreateFeed: import("graphql").DocumentNode;
|
45
|
+
export declare const DeleteAllFeeds: import("graphql").DocumentNode;
|
46
|
+
export declare const DeleteFeed: import("graphql").DocumentNode;
|
47
|
+
export declare const DeleteFeeds: import("graphql").DocumentNode;
|
48
|
+
export declare const DisableFeed: import("graphql").DocumentNode;
|
49
|
+
export declare const EnableFeed: import("graphql").DocumentNode;
|
50
|
+
export declare const GetFeed: import("graphql").DocumentNode;
|
51
|
+
export declare const IsFeedDone: import("graphql").DocumentNode;
|
52
|
+
export declare const QueryFeeds: import("graphql").DocumentNode;
|
53
|
+
export declare const UpdateFeed: import("graphql").DocumentNode;
|
54
|
+
export declare const Credits: import("graphql").DocumentNode;
|
55
|
+
export declare const LookupCredits: import("graphql").DocumentNode;
|
56
|
+
export declare const LookupUsage: import("graphql").DocumentNode;
|
57
|
+
export declare const Project: import("graphql").DocumentNode;
|
58
|
+
export declare const UpdateProject: import("graphql").DocumentNode;
|
59
|
+
export declare const Usage: import("graphql").DocumentNode;
|
60
|
+
export declare const CreateSpecification: import("graphql").DocumentNode;
|
61
|
+
export declare const DeleteSpecification: import("graphql").DocumentNode;
|
62
|
+
export declare const GetSpecification: import("graphql").DocumentNode;
|
63
|
+
export declare const PromptSpecifications: import("graphql").DocumentNode;
|
64
|
+
export declare const QuerySpecifications: import("graphql").DocumentNode;
|
65
|
+
export declare const UpdateSpecification: import("graphql").DocumentNode;
|
66
|
+
export declare const CreateWorkflow: import("graphql").DocumentNode;
|
67
|
+
export declare const DeleteAllWorkflows: import("graphql").DocumentNode;
|
68
|
+
export declare const DeleteWorkflow: import("graphql").DocumentNode;
|
69
|
+
export declare const DeleteWorkflows: import("graphql").DocumentNode;
|
70
|
+
export declare const GetWorkflow: import("graphql").DocumentNode;
|
71
|
+
export declare const QueryWorkflows: import("graphql").DocumentNode;
|
72
|
+
export declare const UpdateWorkflow: import("graphql").DocumentNode;
|