graphlit-client 1.0.20250611014 → 1.0.20250611016

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
@@ -1,11 +1,12 @@
1
- import type { ApolloClient as ApolloClientType, NormalizedCacheObject } from "@apollo/client";
1
+ import { ApolloClient } from "@apollo/client/core/index.js";
2
+ import type { NormalizedCacheObject } from "@apollo/client/core/index.js";
2
3
  import * as Types from "./generated/graphql-types.js";
3
4
  import { AgentOptions, AgentResult, StreamAgentOptions, ToolHandler } from "./types/agent.js";
4
5
  import { AgentStreamEvent } from "./types/ui-events.js";
5
6
  export type { AgentOptions, AgentResult, StreamAgentOptions, ToolCallResult, UsageInfo, AgentError, } from "./types/agent.js";
6
7
  export type { AgentStreamEvent } from "./types/ui-events.js";
7
8
  declare class Graphlit {
8
- client: ApolloClientType<NormalizedCacheObject> | undefined;
9
+ client: ApolloClient<NormalizedCacheObject> | undefined;
9
10
  token: string | undefined;
10
11
  private apiUri;
11
12
  private organizationId;
package/dist/client.js CHANGED
@@ -1,9 +1,6 @@
1
- // jwt v9 – use named export
2
- import { sign } from "jsonwebtoken";
3
- // Apollo core (React-free) via createRequire
4
- import { createRequire } from "node:module";
5
- const require = createRequire(import.meta.url);
6
- const { ApolloClient, InMemoryCache, createHttpLink, ApolloLink, ApolloError, } = require("@apollo/client/core/core.cjs");
1
+ import jwt from "jsonwebtoken";
2
+ // Apollo core (React-free) - ESM import
3
+ import { ApolloClient, InMemoryCache, createHttpLink, ApolloLink, ApolloError, } from "@apollo/client/core/index.js";
7
4
  import * as Types from "./generated/graphql-types.js";
8
5
  import * as Documents from "./generated/graphql-documents.js";
9
6
  import * as dotenv from "dotenv";
@@ -13,24 +10,27 @@ import { formatMessagesForOpenAI, formatMessagesForAnthropic, formatMessagesForG
13
10
  import { streamWithOpenAI, streamWithAnthropic, streamWithGoogle, } from "./streaming/providers.js";
14
11
  // Optional imports for streaming LLM clients
15
12
  // These are peer dependencies and may not be installed
13
+ // We need to use createRequire for optional dependencies to avoid build errors
14
+ import { createRequire } from "node:module";
15
+ const optionalRequire = createRequire(import.meta.url);
16
16
  let OpenAI;
17
17
  let Anthropic;
18
18
  let GoogleGenerativeAI;
19
19
  try {
20
- OpenAI = require("openai").default || require("openai");
20
+ OpenAI = optionalRequire("openai").default || optionalRequire("openai");
21
21
  }
22
22
  catch (e) {
23
23
  // OpenAI not installed
24
24
  }
25
25
  try {
26
26
  Anthropic =
27
- require("@anthropic-ai/sdk").default || require("@anthropic-ai/sdk");
27
+ optionalRequire("@anthropic-ai/sdk").default || optionalRequire("@anthropic-ai/sdk");
28
28
  }
29
29
  catch (e) {
30
30
  // Anthropic SDK not installed
31
31
  }
32
32
  try {
33
- GoogleGenerativeAI = require("@google/generative-ai").GoogleGenerativeAI;
33
+ GoogleGenerativeAI = optionalRequire("@google/generative-ai").GoogleGenerativeAI;
34
34
  }
35
35
  catch (e) {
36
36
  // Google Generative AI not installed
@@ -183,7 +183,7 @@ class Graphlit {
183
183
  iss: "graphlit",
184
184
  aud: "https://portal.graphlit.io",
185
185
  };
186
- this.token = sign(payload, this.jwtSecret, { algorithm: "HS256" });
186
+ this.token = jwt.sign(payload, this.jwtSecret, { algorithm: "HS256" });
187
187
  }
188
188
  async getProject() {
189
189
  return this.queryAndCheckError(Documents.GetProject, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20250611014",
3
+ "version": "1.0.20250611016",
4
4
  "description": "Graphlit API Client for TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/client.js",