@langchain/langgraph-sdk 0.0.92 → 0.0.94

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @langchain/langgraph-sdk
2
2
 
3
+ ## 0.0.94
4
+
5
+ ### Patch Changes
6
+
7
+ - 11e95e0: Add isStudioUser for custom auth
8
+
9
+ ## 0.0.93
10
+
11
+ ### Patch Changes
12
+
13
+ - d53c891: Fix useStream race condition when flushing messages
14
+
3
15
  ## 0.0.92
4
16
 
5
17
  ### Patch Changes
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HTTPException = exports.Auth = void 0;
4
+ exports.isStudioUser = isStudioUser;
4
5
  class Auth {
5
6
  constructor() {
6
7
  /**
@@ -28,5 +29,17 @@ class Auth {
28
29
  }
29
30
  }
30
31
  exports.Auth = Auth;
32
+ /**
33
+ * Check if the provided user was provided by LangGraph Studio.
34
+ *
35
+ * By default, if you add custom authorization on your resources, this will also apply to interactions made from the Studio.
36
+ * If you want, you can handle logged-in Studio users in a special way.
37
+ *
38
+ * @param user - The user to check
39
+ * @returns True if the user is a studio user, false otherwise
40
+ */
41
+ function isStudioUser(user) {
42
+ return user.identity === "langgraph-studio-user";
43
+ }
31
44
  var error_js_1 = require("./error.cjs");
32
45
  Object.defineProperty(exports, "HTTPException", { enumerable: true, get: function () { return error_js_1.HTTPException; } });
@@ -12,5 +12,15 @@ TAuthReturn extends BaseAuthReturn = BaseAuthReturn, TUser extends BaseUser = To
12
12
  authenticate<T extends BaseAuthReturn>(cb: AuthenticateCallback<T>): Auth<TExtra, T>;
13
13
  on<T extends CallbackEvent>(event: T, callback: OnCallback<T, TUser>): this;
14
14
  }
15
+ /**
16
+ * Check if the provided user was provided by LangGraph Studio.
17
+ *
18
+ * By default, if you add custom authorization on your resources, this will also apply to interactions made from the Studio.
19
+ * If you want, you can handle logged-in Studio users in a special way.
20
+ *
21
+ * @param user - The user to check
22
+ * @returns True if the user is a studio user, false otherwise
23
+ */
24
+ export declare function isStudioUser(user: BaseUser): boolean;
15
25
  export type { Filters as AuthFilters, EventValueMap as AuthEventValueMap, } from "./types.js";
16
26
  export { HTTPException } from "./error.js";
@@ -24,4 +24,16 @@ export class Auth {
24
24
  return this;
25
25
  }
26
26
  }
27
+ /**
28
+ * Check if the provided user was provided by LangGraph Studio.
29
+ *
30
+ * By default, if you add custom authorization on your resources, this will also apply to interactions made from the Studio.
31
+ * If you want, you can handle logged-in Studio users in a special way.
32
+ *
33
+ * @param user - The user to check
34
+ * @returns True if the user is a studio user, false otherwise
35
+ */
36
+ export function isStudioUser(user) {
37
+ return user.identity === "langgraph-studio-user";
38
+ }
27
39
  export { HTTPException } from "./error.js";
@@ -329,6 +329,7 @@ function useStream(options) {
329
329
  clearCallbackRef.current = () => {
330
330
  setStreamError(undefined);
331
331
  setStreamValues(null);
332
+ messageManagerRef.current.clear();
332
333
  };
333
334
  const historyLimit = typeof fetchStateHistory === "object" && fetchStateHistory != null
334
335
  ? fetchStateHistory.limit ?? true
@@ -476,8 +477,6 @@ function useStream(options) {
476
477
  }
477
478
  finally {
478
479
  setIsLoading(false);
479
- // Assumption: messages are already handled, we can clear the manager
480
- messageManagerRef.current.clear();
481
480
  submittingRef.current = false;
482
481
  abortRef.current = null;
483
482
  }
@@ -325,6 +325,7 @@ export function useStream(options) {
325
325
  clearCallbackRef.current = () => {
326
326
  setStreamError(undefined);
327
327
  setStreamValues(null);
328
+ messageManagerRef.current.clear();
328
329
  };
329
330
  const historyLimit = typeof fetchStateHistory === "object" && fetchStateHistory != null
330
331
  ? fetchStateHistory.limit ?? true
@@ -472,8 +473,6 @@ export function useStream(options) {
472
473
  }
473
474
  finally {
474
475
  setIsLoading(false);
475
- // Assumption: messages are already handled, we can clear the manager
476
- messageManagerRef.current.clear();
477
476
  submittingRef.current = false;
478
477
  abortRef.current = null;
479
478
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "description": "Client library for interacting with the LangGraph API",
5
5
  "type": "module",
6
6
  "scripts": {