graphlit-client 1.0.20240418021 → 1.0.20240418023

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
@@ -10,63 +10,63 @@ declare class Graphlit {
10
10
  private ownerId;
11
11
  private jwtSecret;
12
12
  constructor(organizationId?: string, environmentId?: string, jwtSecret?: string, ownerId?: string, apiUri?: string, correlationId?: string);
13
- createAlert(alert: Types.AlertInput): Promise<Types.Alert>;
14
- updateAlert(alert: Types.AlertUpdateInput): Promise<Types.Alert>;
15
- deleteAlert(id: string): Promise<Types.Alert>;
16
- deleteAllAlerts(): Promise<void>;
17
- enableAlert(id: string): Promise<Types.Alert>;
18
- disableAlert(id: string): Promise<Types.Alert>;
19
- getAlert(id: string): Promise<Types.Alert>;
20
- queryAlerts(filter: Types.AlertFilter): Promise<Types.AlertResults>;
21
- createCollection(Collection: Types.CollectionInput): Promise<Types.Collection>;
22
- updateCollection(Collection: Types.CollectionUpdateInput): Promise<Types.Collection>;
23
- deleteCollection(id: string): Promise<Types.Collection>;
24
- addContentsToCollections(contents: Types.EntityReferenceInput[], collections: Types.EntityReferenceInput[]): Promise<Types.Collection[]>;
25
- removeContentsFromCollection(contents: Types.EntityReferenceInput[], collection: Types.EntityReferenceInput): Promise<Types.Collection>;
26
- getCollection(id: string): Promise<Types.Collection>;
27
- queryCollections(filter: Types.CollectionFilter): Promise<Types.CollectionResults>;
28
- ingestUri(uri: string, name?: string, id?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput): Promise<Types.Content>;
29
- ingestText(name: string, text: string, textType?: Types.TextTypes, uri?: string, id?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput): Promise<Types.Content>;
30
- ingestEncodedFile(name: string, data: string, mimeType: string, id?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput): Promise<Types.Content>;
31
- updateContent(content: Types.ContentUpdateInput): Promise<Types.Content>;
32
- deleteContent(id: string): Promise<Types.Content>;
33
- deleteAllContents(): Promise<void>;
34
- summarizeContents(summarizations: [Types.SummarizationStrategyInput], filter?: Types.ContentFilter): Promise<Types.PromptSummarization[]>;
35
- extractContents(prompt: string, filter?: Types.ContentFilter, specification?: Types.EntityReferenceInput): Promise<Types.ExtractCompletion[]>;
36
- publishContents(summaryPrompt: string, summarySpecification: Types.EntityReferenceInput, connector: Types.ContentPublishingConnectorInput, publishPrompt?: string, publishSpecification?: Types.EntityReferenceInput, name?: string, filter?: Types.ContentFilter, workflow?: Types.EntityReferenceInput): Promise<Types.Content>;
37
- getContent(id: string): Promise<Types.Content>;
38
- queryContents(filter: Types.ContentFilter): Promise<Types.ContentResults>;
39
- createConversation(conversation: Types.ConversationInput): Promise<Types.Conversation>;
40
- updateConversation(conversation: Types.ConversationUpdateInput): Promise<Types.Conversation>;
41
- deleteConversation(id: string): Promise<Types.Conversation>;
42
- deleteAllConversations(): Promise<void>;
43
- clearConversation(id: string): Promise<Types.Conversation>;
44
- closeConversation(id: string): Promise<Types.Conversation>;
45
- getConversation(id: string): Promise<Types.Conversation>;
46
- queryConversations(filter: Types.ConversationFilter): Promise<Types.ConversationResults>;
47
- promptConversation(prompt: string, id?: string): Promise<Types.PromptConversation>;
48
- publishConversation(id: string, connector: Types.ContentPublishingConnectorInput, name?: string, workflow?: Types.EntityReferenceInput): Promise<Types.Content>;
49
- suggestConversation(id: string, count?: number): Promise<Types.PromptSuggestion>;
50
- createFeed(feed: Types.FeedInput): Promise<Types.Feed>;
51
- updateFeed(feed: Types.FeedUpdateInput): Promise<Types.Feed>;
52
- deleteFeed(id: string): Promise<Types.Feed>;
53
- deleteAllFeeds(): Promise<void>;
54
- enableFeed(id: string): Promise<Types.Feed>;
55
- disableFeed(id: string): Promise<Types.Feed>;
56
- getFeed(id: string): Promise<Types.Feed>;
57
- queryFeeds(filter: Types.FeedFilter): Promise<Types.FeedResults>;
58
- promptSpecifications(prompt: string, ids: [string]): Promise<Types.PromptCompletion[]>;
59
- createSpecification(specification: Types.SpecificationInput): Promise<Types.Specification>;
60
- updateSpecification(specification: Types.SpecificationUpdateInput): Promise<Types.Specification>;
61
- deleteSpecification(id: string): Promise<Types.Specification>;
62
- getSpecification(id: string): Promise<Types.Specification>;
63
- querySpecifications(filter: Types.SpecificationFilter): Promise<Types.SpecificationResults>;
64
- createWorkflow(workflow: Types.WorkflowInput): Promise<Types.Workflow>;
65
- updateWorkflow(workflow: Types.WorkflowUpdateInput): Promise<Types.Workflow>;
66
- deleteWorkflow(id: string): Promise<Types.Workflow>;
67
- deleteAllWorkflows(): Promise<void>;
68
- getWorkflow(id: string): Promise<Types.Workflow>;
69
- queryWorkflows(filter: Types.WorkflowFilter): Promise<Types.WorkflowResults>;
13
+ createAlert(alert: Types.AlertInput): Promise<Types.CreateAlertMutation>;
14
+ updateAlert(alert: Types.AlertUpdateInput): Promise<Types.UpdateAlertMutation>;
15
+ deleteAlert(id: string): Promise<Types.DeleteAlertMutation>;
16
+ deleteAllAlerts(): Promise<Types.DeleteAllAlertsMutation>;
17
+ enableAlert(id: string): Promise<Types.EnableAlertMutation>;
18
+ disableAlert(id: string): Promise<Types.DisableAlertMutation>;
19
+ getAlert(id: string): Promise<Types.GetAlertQuery>;
20
+ queryAlerts(filter?: Types.AlertFilter): Promise<Types.QueryAlertsQuery>;
21
+ createCollection(Collection: Types.CollectionInput): Promise<Types.CreateCollectionMutation>;
22
+ updateCollection(Collection: Types.CollectionUpdateInput): Promise<Types.UpdateCollectionMutation>;
23
+ deleteCollection(id: string): Promise<Types.DeleteCollectionMutation>;
24
+ addContentsToCollections(contents: Types.EntityReferenceInput[], collections: Types.EntityReferenceInput[]): Promise<Types.AddContentsToCollectionsMutation>;
25
+ removeContentsFromCollection(contents: Types.EntityReferenceInput[], collection: Types.EntityReferenceInput): Promise<Types.RemoveContentsFromCollectionMutation>;
26
+ getCollection(id: string): Promise<Types.GetCollectionQuery>;
27
+ queryCollections(filter?: Types.CollectionFilter): Promise<Types.QueryCollectionsQuery>;
28
+ ingestUri(uri: string, name?: string, id?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput): Promise<Types.IngestUriMutation>;
29
+ ingestText(name: string, text: string, textType?: Types.TextTypes, uri?: string, id?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput): Promise<Types.IngestTextMutation>;
30
+ ingestEncodedFile(name: string, data: string, mimeType: string, id?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput): Promise<Types.IngestEncodedFileMutation>;
31
+ updateContent(content: Types.ContentUpdateInput): Promise<Types.UpdateContentMutation>;
32
+ deleteContent(id: string): Promise<Types.DeleteContentMutation>;
33
+ deleteAllContents(): Promise<Types.DeleteAllContentsMutation>;
34
+ summarizeContents(summarizations: [Types.SummarizationStrategyInput], filter?: Types.ContentFilter): Promise<Types.SummarizeContentsMutation>;
35
+ extractContents(prompt: string, filter?: Types.ContentFilter, specification?: Types.EntityReferenceInput): Promise<Types.ExtractContentsMutation>;
36
+ publishContents(summaryPrompt: string, summarySpecification: Types.EntityReferenceInput, connector: Types.ContentPublishingConnectorInput, publishPrompt?: string, publishSpecification?: Types.EntityReferenceInput, name?: string, filter?: Types.ContentFilter, workflow?: Types.EntityReferenceInput): Promise<Types.PublishContentsMutation>;
37
+ getContent(id: string): Promise<Types.GetContentQuery>;
38
+ queryContents(filter?: Types.ContentFilter): Promise<Types.QueryContentsQuery>;
39
+ createConversation(conversation: Types.ConversationInput): Promise<Types.CreateConversationMutation>;
40
+ updateConversation(conversation: Types.ConversationUpdateInput): Promise<Types.UpdateConversationMutation>;
41
+ deleteConversation(id: string): Promise<Types.DeleteConversationMutation>;
42
+ deleteAllConversations(): Promise<Types.DeleteAllConversationsMutation>;
43
+ clearConversation(id: string): Promise<Types.ClearConversationMutation>;
44
+ closeConversation(id: string): Promise<Types.CloseConversationMutation>;
45
+ getConversation(id: string): Promise<Types.GetConversationQuery>;
46
+ queryConversations(filter?: Types.ConversationFilter): Promise<Types.QueryConversationsQuery>;
47
+ promptConversation(prompt: string, id?: string): Promise<Types.PromptConversationMutation>;
48
+ publishConversation(id: string, connector: Types.ContentPublishingConnectorInput, name?: string, workflow?: Types.EntityReferenceInput): Promise<Types.PublishConversationMutation>;
49
+ suggestConversation(id: string, count?: number): Promise<Types.SuggestConversationMutation>;
50
+ createFeed(feed: Types.FeedInput): Promise<Types.CreateFeedMutation>;
51
+ updateFeed(feed: Types.FeedUpdateInput): Promise<Types.UpdateFeedMutation>;
52
+ deleteFeed(id: string): Promise<Types.DeleteFeedMutation>;
53
+ deleteAllFeeds(): Promise<Types.DeleteAllFeedsMutation>;
54
+ enableFeed(id: string): Promise<Types.EnableFeedMutation>;
55
+ disableFeed(id: string): Promise<Types.DeleteFeedMutation>;
56
+ getFeed(id: string): Promise<Types.GetFeedQuery>;
57
+ queryFeeds(filter?: Types.FeedFilter): Promise<Types.QueryFeedsQuery>;
58
+ promptSpecifications(prompt: string, ids: [string]): Promise<Types.PromptSpecificationsMutation>;
59
+ createSpecification(specification: Types.SpecificationInput): Promise<Types.CreateSpecificationMutation>;
60
+ updateSpecification(specification: Types.SpecificationUpdateInput): Promise<Types.UpdateSpecificationMutation>;
61
+ deleteSpecification(id: string): Promise<Types.DeleteSpecificationMutation>;
62
+ getSpecification(id: string): Promise<Types.GetSpecificationQuery>;
63
+ querySpecifications(filter?: Types.SpecificationFilter): Promise<Types.QuerySpecificationsQuery>;
64
+ createWorkflow(workflow: Types.WorkflowInput): Promise<Types.CreateWorkflowMutation>;
65
+ updateWorkflow(workflow: Types.WorkflowUpdateInput): Promise<Types.UpdateWorkflowMutation>;
66
+ deleteWorkflow(id: string): Promise<Types.DeleteWorkflowMutation>;
67
+ deleteAllWorkflows(): Promise<Types.DeleteAllWorkflowsMutation>;
68
+ getWorkflow(id: string): Promise<Types.GetWorkflowQuery>;
69
+ queryWorkflows(filter?: Types.WorkflowFilter): Promise<Types.QueryWorkflowsQuery>;
70
70
  private mutateAndCheckError;
71
71
  private queryAndCheckError;
72
72
  }
package/dist/client.js CHANGED
@@ -89,6 +89,19 @@ class Graphlit {
89
89
  this.client = new core_1.ApolloClient({
90
90
  link: authLink.concat(httpLink),
91
91
  cache: new core_1.InMemoryCache(),
92
+ defaultOptions: {
93
+ watchQuery: {
94
+ fetchPolicy: 'cache-and-network',
95
+ errorPolicy: 'ignore',
96
+ },
97
+ query: {
98
+ fetchPolicy: 'network-only',
99
+ errorPolicy: 'all',
100
+ },
101
+ mutate: {
102
+ errorPolicy: 'all',
103
+ }
104
+ }
92
105
  });
93
106
  }
94
107
  createAlert(alert) {
@@ -147,8 +160,8 @@ class Graphlit {
147
160
  });
148
161
  }
149
162
  /*
150
- public async deleteAllCollections(): Promise<void> {
151
- return this.mutateAndCheckError<void>(
163
+ public async deleteAllCollections(): Promise<Types.DeleteAllCollectionsMutation> {
164
+ return this.mutateAndCheckError<Types.DeleteAllCollectionsMutation>(
152
165
  Documents.DeleteAllCollections
153
166
  );
154
167
  }
@@ -345,8 +358,8 @@ class Graphlit {
345
358
  });
346
359
  }
347
360
  /*
348
- public async deleteAllSpecifications(): Promise<void> {
349
- return this.mutateAndCheckError<void>(
361
+ public async deleteAllSpecifications(): Promise<Types.DeleteAllSpecificationsMutation> {
362
+ return this.mutateAndCheckError<Types.DeleteAllSpecificationsMutation>(
350
363
  Documents.DeleteAllSpecifications
351
364
  );
352
365
  }
@@ -401,6 +414,10 @@ class Graphlit {
401
414
  mutation,
402
415
  variables: variables || {}
403
416
  });
417
+ if (result.errors) {
418
+ const errorMessage = result.errors.map(err => err.message).join("\n");
419
+ throw new Error(errorMessage);
420
+ }
404
421
  if (!result.data) {
405
422
  throw new Error('No data returned from mutation.');
406
423
  }
@@ -419,6 +436,7 @@ class Graphlit {
419
436
  }
420
437
  queryAndCheckError(query, variables) {
421
438
  return __awaiter(this, void 0, void 0, function* () {
439
+ var _a, _b;
422
440
  if (this.client === undefined)
423
441
  throw new Error("Apollo Client not configured.");
424
442
  try {
@@ -426,6 +444,14 @@ class Graphlit {
426
444
  query,
427
445
  variables: variables || {}
428
446
  });
447
+ if ((_a = result.error) === null || _a === void 0 ? void 0 : _a.graphQLErrors) {
448
+ const errorMessage = result.error.graphQLErrors.map(err => err.message).join("\n");
449
+ throw new Error(errorMessage);
450
+ }
451
+ if ((_b = result.error) === null || _b === void 0 ? void 0 : _b.clientErrors) {
452
+ const errorMessage = result.error.clientErrors.map(err => err.message).join("\n");
453
+ throw new Error(errorMessage);
454
+ }
429
455
  if (!result.data) {
430
456
  throw new Error('No data returned from query');
431
457
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20240418021",
3
+ "version": "1.0.20240418023",
4
4
  "description": "Graphlit API TypeScript Client",
5
5
  "main": "dist/client.js",
6
6
  "types": "dist/client.d.ts",