graphlit-client 1.0.20250611015 → 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 +3 -2
- package/dist/client.js +8 -7
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
import
|
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:
|
9
|
+
client: ApolloClient<NormalizedCacheObject> | undefined;
|
9
10
|
token: string | undefined;
|
10
11
|
private apiUri;
|
11
12
|
private organizationId;
|
package/dist/client.js
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import jwt from "jsonwebtoken";
|
2
|
-
// Apollo core (React-free)
|
3
|
-
import {
|
4
|
-
const require = createRequire(import.meta.url);
|
5
|
-
const { ApolloClient, InMemoryCache, createHttpLink, ApolloLink, ApolloError, } = require("@apollo/client/core/core.cjs");
|
2
|
+
// Apollo core (React-free) - ESM import
|
3
|
+
import { ApolloClient, InMemoryCache, createHttpLink, ApolloLink, ApolloError, } from "@apollo/client/core/index.js";
|
6
4
|
import * as Types from "./generated/graphql-types.js";
|
7
5
|
import * as Documents from "./generated/graphql-documents.js";
|
8
6
|
import * as dotenv from "dotenv";
|
@@ -12,24 +10,27 @@ import { formatMessagesForOpenAI, formatMessagesForAnthropic, formatMessagesForG
|
|
12
10
|
import { streamWithOpenAI, streamWithAnthropic, streamWithGoogle, } from "./streaming/providers.js";
|
13
11
|
// Optional imports for streaming LLM clients
|
14
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);
|
15
16
|
let OpenAI;
|
16
17
|
let Anthropic;
|
17
18
|
let GoogleGenerativeAI;
|
18
19
|
try {
|
19
|
-
OpenAI =
|
20
|
+
OpenAI = optionalRequire("openai").default || optionalRequire("openai");
|
20
21
|
}
|
21
22
|
catch (e) {
|
22
23
|
// OpenAI not installed
|
23
24
|
}
|
24
25
|
try {
|
25
26
|
Anthropic =
|
26
|
-
|
27
|
+
optionalRequire("@anthropic-ai/sdk").default || optionalRequire("@anthropic-ai/sdk");
|
27
28
|
}
|
28
29
|
catch (e) {
|
29
30
|
// Anthropic SDK not installed
|
30
31
|
}
|
31
32
|
try {
|
32
|
-
GoogleGenerativeAI =
|
33
|
+
GoogleGenerativeAI = optionalRequire("@google/generative-ai").GoogleGenerativeAI;
|
33
34
|
}
|
34
35
|
catch (e) {
|
35
36
|
// Google Generative AI not installed
|