@langchain/langgraph-sdk 0.0.36 → 0.0.37
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.cjs +3 -4
- package/dist/client.js +3 -4
- package/dist/index.cjs +1 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +1 -1
- package/dist/singletons/fetch.cjs +0 -27
- package/dist/singletons/fetch.d.ts +0 -11
- package/dist/singletons/fetch.js +0 -22
package/dist/client.cjs
CHANGED
|
@@ -6,7 +6,6 @@ const index_js_1 = require("./utils/eventsource-parser/index.cjs");
|
|
|
6
6
|
const stream_js_1 = require("./utils/stream.cjs");
|
|
7
7
|
const signals_js_1 = require("./utils/signals.cjs");
|
|
8
8
|
const env_js_1 = require("./utils/env.cjs");
|
|
9
|
-
const fetch_js_1 = require("./singletons/fetch.cjs");
|
|
10
9
|
/**
|
|
11
10
|
* Get the API key from the environment.
|
|
12
11
|
* Precedence:
|
|
@@ -113,7 +112,7 @@ class BaseClient {
|
|
|
113
112
|
return [targetUrl, mutatedOptions];
|
|
114
113
|
}
|
|
115
114
|
async fetch(path, options) {
|
|
116
|
-
const response = await this.asyncCaller.
|
|
115
|
+
const response = await this.asyncCaller.fetch(...this.prepareFetchOptions(path, options));
|
|
117
116
|
if (response.status === 202 || response.status === 204) {
|
|
118
117
|
return undefined;
|
|
119
118
|
}
|
|
@@ -519,7 +518,7 @@ class RunsClient extends BaseClient {
|
|
|
519
518
|
if_not_exists: payload?.ifNotExists,
|
|
520
519
|
};
|
|
521
520
|
const endpoint = threadId == null ? `/runs/stream` : `/threads/${threadId}/runs/stream`;
|
|
522
|
-
const response = await this.asyncCaller.
|
|
521
|
+
const response = await this.asyncCaller.fetch(...this.prepareFetchOptions(endpoint, {
|
|
523
522
|
method: "POST",
|
|
524
523
|
json,
|
|
525
524
|
timeoutMs: null,
|
|
@@ -723,7 +722,7 @@ class RunsClient extends BaseClient {
|
|
|
723
722
|
options instanceof AbortSignal
|
|
724
723
|
? { signal: options }
|
|
725
724
|
: options;
|
|
726
|
-
const response = await this.asyncCaller.
|
|
725
|
+
const response = await this.asyncCaller.fetch(...this.prepareFetchOptions(`/threads/${threadId}/runs/${runId}/stream`, {
|
|
727
726
|
method: "GET",
|
|
728
727
|
timeoutMs: null,
|
|
729
728
|
signal: opts?.signal,
|
package/dist/client.js
CHANGED
|
@@ -3,7 +3,6 @@ import { createParser, } from "./utils/eventsource-parser/index.js";
|
|
|
3
3
|
import { IterableReadableStream } from "./utils/stream.js";
|
|
4
4
|
import { mergeSignals } from "./utils/signals.js";
|
|
5
5
|
import { getEnvironmentVariable } from "./utils/env.js";
|
|
6
|
-
import { _getFetchImplementation } from "./singletons/fetch.js";
|
|
7
6
|
/**
|
|
8
7
|
* Get the API key from the environment.
|
|
9
8
|
* Precedence:
|
|
@@ -109,7 +108,7 @@ class BaseClient {
|
|
|
109
108
|
return [targetUrl, mutatedOptions];
|
|
110
109
|
}
|
|
111
110
|
async fetch(path, options) {
|
|
112
|
-
const response = await this.asyncCaller.
|
|
111
|
+
const response = await this.asyncCaller.fetch(...this.prepareFetchOptions(path, options));
|
|
113
112
|
if (response.status === 202 || response.status === 204) {
|
|
114
113
|
return undefined;
|
|
115
114
|
}
|
|
@@ -512,7 +511,7 @@ export class RunsClient extends BaseClient {
|
|
|
512
511
|
if_not_exists: payload?.ifNotExists,
|
|
513
512
|
};
|
|
514
513
|
const endpoint = threadId == null ? `/runs/stream` : `/threads/${threadId}/runs/stream`;
|
|
515
|
-
const response = await this.asyncCaller.
|
|
514
|
+
const response = await this.asyncCaller.fetch(...this.prepareFetchOptions(endpoint, {
|
|
516
515
|
method: "POST",
|
|
517
516
|
json,
|
|
518
517
|
timeoutMs: null,
|
|
@@ -716,7 +715,7 @@ export class RunsClient extends BaseClient {
|
|
|
716
715
|
options instanceof AbortSignal
|
|
717
716
|
? { signal: options }
|
|
718
717
|
: options;
|
|
719
|
-
const response = await this.asyncCaller.
|
|
718
|
+
const response = await this.asyncCaller.fetch(...this.prepareFetchOptions(`/threads/${threadId}/runs/${runId}/stream`, {
|
|
720
719
|
method: "GET",
|
|
721
720
|
timeoutMs: null,
|
|
722
721
|
signal: opts?.signal,
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Client = void 0;
|
|
4
4
|
var client_js_1 = require("./client.cjs");
|
|
5
5
|
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_js_1.Client; } });
|
|
6
|
-
var fetch_js_1 = require("./singletons/fetch.cjs");
|
|
7
|
-
Object.defineProperty(exports, "overrideFetchImplementation", { enumerable: true, get: function () { return fetch_js_1.overrideFetchImplementation; } });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { Client } from "./client.js";
|
|
2
2
|
export type { Assistant, AssistantVersion, AssistantGraph, Config, DefaultValues, GraphSchema, Metadata, Run, Thread, ThreadTask, ThreadState, ThreadStatus, Cron, Checkpoint, Interrupt, } from "./schema.js";
|
|
3
|
-
export { overrideFetchImplementation } from "./singletons/fetch.js";
|
|
4
3
|
export type { OnConflictBehavior, Command } from "./types.js";
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._getFetchImplementation = exports.overrideFetchImplementation = void 0;
|
|
4
|
-
// Wrap the default fetch call due to issues with illegal invocations
|
|
5
|
-
// in some environments:
|
|
6
|
-
// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err
|
|
7
|
-
// @ts-expect-error Broad typing to support a range of fetch implementations
|
|
8
|
-
const DEFAULT_FETCH_IMPLEMENTATION = (...args) => fetch(...args);
|
|
9
|
-
const LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for("lg:fetch_implementation");
|
|
10
|
-
/**
|
|
11
|
-
* Overrides the fetch implementation used for LangSmith calls.
|
|
12
|
-
* You should use this if you need to use an implementation of fetch
|
|
13
|
-
* other than the default global (e.g. for dealing with proxies).
|
|
14
|
-
* @param fetch The new fetch function to use.
|
|
15
|
-
*/
|
|
16
|
-
const overrideFetchImplementation = (fetch) => {
|
|
17
|
-
globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;
|
|
18
|
-
};
|
|
19
|
-
exports.overrideFetchImplementation = overrideFetchImplementation;
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
const _getFetchImplementation = () => {
|
|
24
|
-
return (globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??
|
|
25
|
-
DEFAULT_FETCH_IMPLEMENTATION);
|
|
26
|
-
};
|
|
27
|
-
exports._getFetchImplementation = _getFetchImplementation;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Overrides the fetch implementation used for LangSmith calls.
|
|
3
|
-
* You should use this if you need to use an implementation of fetch
|
|
4
|
-
* other than the default global (e.g. for dealing with proxies).
|
|
5
|
-
* @param fetch The new fetch function to use.
|
|
6
|
-
*/
|
|
7
|
-
export declare const overrideFetchImplementation: (fetch: (...args: any[]) => any) => void;
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export declare const _getFetchImplementation: () => (...args: any[]) => any;
|
package/dist/singletons/fetch.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Wrap the default fetch call due to issues with illegal invocations
|
|
2
|
-
// in some environments:
|
|
3
|
-
// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err
|
|
4
|
-
// @ts-expect-error Broad typing to support a range of fetch implementations
|
|
5
|
-
const DEFAULT_FETCH_IMPLEMENTATION = (...args) => fetch(...args);
|
|
6
|
-
const LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for("lg:fetch_implementation");
|
|
7
|
-
/**
|
|
8
|
-
* Overrides the fetch implementation used for LangSmith calls.
|
|
9
|
-
* You should use this if you need to use an implementation of fetch
|
|
10
|
-
* other than the default global (e.g. for dealing with proxies).
|
|
11
|
-
* @param fetch The new fetch function to use.
|
|
12
|
-
*/
|
|
13
|
-
export const overrideFetchImplementation = (fetch) => {
|
|
14
|
-
globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
export const _getFetchImplementation = () => {
|
|
20
|
-
return (globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??
|
|
21
|
-
DEFAULT_FETCH_IMPLEMENTATION);
|
|
22
|
-
};
|