graphlit-client 1.0.20250129001 → 1.0.20250130002

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
@@ -257,6 +257,7 @@ declare class Graphlit {
257
257
  createObservation(observation: Types.ObservationInput): Promise<Types.CreateObservationMutation>;
258
258
  updateObservation(observation: Types.ObservationUpdateInput): Promise<Types.UpdateObservationMutation>;
259
259
  deleteObservation(id: string): Promise<Types.DeleteObservationMutation>;
260
+ private prettyPrintGraphQLError;
260
261
  private mutateAndCheckError;
261
262
  private queryAndCheckError;
262
263
  }
package/dist/client.js CHANGED
@@ -1344,6 +1344,22 @@ class Graphlit {
1344
1344
  });
1345
1345
  }
1346
1346
  // helper functions
1347
+ prettyPrintGraphQLError(err) {
1348
+ if (!err)
1349
+ return 'Unknown error';
1350
+ const parts = [];
1351
+ // Add the base error message
1352
+ parts.push(err.message);
1353
+ // Add location info if available
1354
+ if (err.locations && err.locations.length > 0) {
1355
+ parts.push(`at line ${err.locations[0].line}, column ${err.locations[0].column}`);
1356
+ }
1357
+ // Add path info if available
1358
+ if (err.path) {
1359
+ parts.push(`\n- Path: ${err.path.join('.')}`);
1360
+ }
1361
+ return parts.join(' ');
1362
+ }
1347
1363
  mutateAndCheckError(mutation, variables) {
1348
1364
  return __awaiter(this, void 0, void 0, function* () {
1349
1365
  if (this.client === undefined)
@@ -1354,7 +1370,7 @@ class Graphlit {
1354
1370
  variables: variables || {}
1355
1371
  });
1356
1372
  if (result.errors) {
1357
- const errorMessage = result.errors.map(err => err.message).join("\n");
1373
+ const errorMessage = result.errors.map(err => this.prettyPrintGraphQLError(err)).join("\n");
1358
1374
  throw new Error(errorMessage);
1359
1375
  }
1360
1376
  if (!result.data) {
@@ -1364,7 +1380,7 @@ class Graphlit {
1364
1380
  }
1365
1381
  catch (error) {
1366
1382
  if (error instanceof core_1.ApolloError && error.graphQLErrors.length > 0) {
1367
- const errorMessage = error.graphQLErrors.map(err => err.message).join("\n");
1383
+ const errorMessage = error.graphQLErrors.map(err => this.prettyPrintGraphQLError(err)).join("\n");
1368
1384
  console.error(errorMessage);
1369
1385
  throw new Error(errorMessage);
1370
1386
  }
@@ -1388,7 +1404,7 @@ class Graphlit {
1388
1404
  variables: variables || {}
1389
1405
  });
1390
1406
  if (result.errors) {
1391
- const errorMessage = result.errors.map(err => err.message).join("\n");
1407
+ const errorMessage = result.errors.map(err => this.prettyPrintGraphQLError(err)).join("\n");
1392
1408
  throw new Error(errorMessage);
1393
1409
  }
1394
1410
  if (!result.data) {
@@ -1398,7 +1414,7 @@ class Graphlit {
1398
1414
  }
1399
1415
  catch (error) {
1400
1416
  if (error instanceof core_1.ApolloError && error.graphQLErrors.length > 0) {
1401
- const errorMessage = error.graphQLErrors.map(err => err.message).join("\n");
1417
+ const errorMessage = error.graphQLErrors.map(err => this.prettyPrintGraphQLError(err)).join("\n");
1402
1418
  console.error(errorMessage);
1403
1419
  throw new Error(errorMessage);
1404
1420
  }
@@ -3753,7 +3753,7 @@ exports.GetConversation = (0, graphql_tag_1.default) `
3753
3753
  }
3754
3754
  `;
3755
3755
  exports.Prompt = (0, graphql_tag_1.default) `
3756
- mutation Prompt($prompt: String!, $mimeType: String, $data: String, $specification: EntityReferenceInput, $messages: [ConversationMessageInput!], $correlationId: String) {
3756
+ mutation Prompt($prompt: String, $mimeType: String, $data: String, $specification: EntityReferenceInput, $messages: [ConversationMessageInput!], $correlationId: String) {
3757
3757
  prompt(
3758
3758
  prompt: $prompt
3759
3759
  mimeType: $mimeType
@@ -17137,7 +17137,7 @@ export type GetConversationQuery = {
17137
17137
  } | null;
17138
17138
  };
17139
17139
  export type PromptMutationVariables = Exact<{
17140
- prompt: Scalars['String']['input'];
17140
+ prompt?: InputMaybe<Scalars['String']['input']>;
17141
17141
  mimeType?: InputMaybe<Scalars['String']['input']>;
17142
17142
  data?: InputMaybe<Scalars['String']['input']>;
17143
17143
  specification?: InputMaybe<EntityReferenceInput>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20250129001",
3
+ "version": "1.0.20250130002",
4
4
  "description": "Graphlit API TypeScript Client",
5
5
  "main": "dist/client.js",
6
6
  "types": "dist/client.d.ts",