@langchain/langgraph 0.0.25 → 0.0.26
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/checkpoint/id.cjs +2 -34
- package/dist/checkpoint/id.d.ts +0 -1
- package/dist/checkpoint/id.js +2 -33
- package/dist/tests/checkpoints.test.js +6 -19
- package/dist/web.d.ts +2 -1
- package/package.json +3 -3
package/dist/checkpoint/id.cjs
CHANGED
|
@@ -1,40 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.uuid6 = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
|
-
/**
|
|
6
|
-
* Returns an unsigned `x`-bit random integer.
|
|
7
|
-
* @param x - An unsigned integer ranging from 0 to 53, inclusive.
|
|
8
|
-
* @returns An unsigned `x`-bit random integer (`0 <= f(x) < 2^x`).
|
|
9
|
-
*/
|
|
10
|
-
function getRandomInt(x) {
|
|
11
|
-
if (x < 0 || x > 53) {
|
|
12
|
-
return NaN;
|
|
13
|
-
}
|
|
14
|
-
const n = 0 | (Math.random() * 0x40000000); // 1 << 30
|
|
15
|
-
return x > 30
|
|
16
|
-
? n + (0 | (Math.random() * (1 << (x - 30)))) * 0x40000000
|
|
17
|
-
: n >>> (30 - x);
|
|
18
|
-
}
|
|
19
5
|
function uuid6(clockseq) {
|
|
20
|
-
|
|
21
|
-
? crypto.getRandomValues(new Uint8Array(6))
|
|
22
|
-
: [
|
|
23
|
-
getRandomInt(8),
|
|
24
|
-
getRandomInt(8),
|
|
25
|
-
getRandomInt(8),
|
|
26
|
-
getRandomInt(8),
|
|
27
|
-
getRandomInt(8),
|
|
28
|
-
getRandomInt(8),
|
|
29
|
-
];
|
|
30
|
-
const uuid1 = (0, uuid_1.v1)({ node, clockseq });
|
|
31
|
-
return convert1to6(uuid1);
|
|
6
|
+
return (0, uuid_1.v6)({ clockseq });
|
|
32
7
|
}
|
|
33
8
|
exports.uuid6 = uuid6;
|
|
34
|
-
function convert1to6(uuid1) {
|
|
35
|
-
// https://github.com/oittaa/uuid6-python/blob/main/src/uuid6/__init__.py#L81
|
|
36
|
-
const hex = uuid1.replace(/-/g, "");
|
|
37
|
-
const v6 = `${hex.slice(13, 16)}${hex.slice(8, 12)}${hex.slice(0, 1)}-${hex.slice(1, 5)}-6${hex.slice(5, 8)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
38
|
-
return v6;
|
|
39
|
-
}
|
|
40
|
-
exports.convert1to6 = convert1to6;
|
package/dist/checkpoint/id.d.ts
CHANGED
package/dist/checkpoint/id.js
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* Returns an unsigned `x`-bit random integer.
|
|
4
|
-
* @param x - An unsigned integer ranging from 0 to 53, inclusive.
|
|
5
|
-
* @returns An unsigned `x`-bit random integer (`0 <= f(x) < 2^x`).
|
|
6
|
-
*/
|
|
7
|
-
function getRandomInt(x) {
|
|
8
|
-
if (x < 0 || x > 53) {
|
|
9
|
-
return NaN;
|
|
10
|
-
}
|
|
11
|
-
const n = 0 | (Math.random() * 0x40000000); // 1 << 30
|
|
12
|
-
return x > 30
|
|
13
|
-
? n + (0 | (Math.random() * (1 << (x - 30)))) * 0x40000000
|
|
14
|
-
: n >>> (30 - x);
|
|
15
|
-
}
|
|
1
|
+
import { v6 } from "uuid";
|
|
16
2
|
export function uuid6(clockseq) {
|
|
17
|
-
|
|
18
|
-
? crypto.getRandomValues(new Uint8Array(6))
|
|
19
|
-
: [
|
|
20
|
-
getRandomInt(8),
|
|
21
|
-
getRandomInt(8),
|
|
22
|
-
getRandomInt(8),
|
|
23
|
-
getRandomInt(8),
|
|
24
|
-
getRandomInt(8),
|
|
25
|
-
getRandomInt(8),
|
|
26
|
-
];
|
|
27
|
-
const uuid1 = v1({ node, clockseq });
|
|
28
|
-
return convert1to6(uuid1);
|
|
29
|
-
}
|
|
30
|
-
export function convert1to6(uuid1) {
|
|
31
|
-
// https://github.com/oittaa/uuid6-python/blob/main/src/uuid6/__init__.py#L81
|
|
32
|
-
const hex = uuid1.replace(/-/g, "");
|
|
33
|
-
const v6 = `${hex.slice(13, 16)}${hex.slice(8, 12)}${hex.slice(0, 1)}-${hex.slice(1, 5)}-6${hex.slice(5, 8)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
34
|
-
return v6;
|
|
3
|
+
return v6({ clockseq });
|
|
35
4
|
}
|
|
@@ -2,7 +2,7 @@ import { describe, it, expect } from "@jest/globals";
|
|
|
2
2
|
import { deepCopy } from "../checkpoint/base.js";
|
|
3
3
|
import { MemorySaver } from "../checkpoint/memory.js";
|
|
4
4
|
import { SqliteSaver } from "../checkpoint/sqlite.js";
|
|
5
|
-
import {
|
|
5
|
+
import { uuid6 } from "../checkpoint/id.js";
|
|
6
6
|
const checkpoint1 = {
|
|
7
7
|
v: 1,
|
|
8
8
|
id: uuid6(-1),
|
|
@@ -169,23 +169,10 @@ describe("SqliteSaver", () => {
|
|
|
169
169
|
});
|
|
170
170
|
});
|
|
171
171
|
describe("id", () => {
|
|
172
|
-
it("should
|
|
173
|
-
const regex = /^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
"5714f720-1268-11e7-a24b-96d95aa38c32",
|
|
178
|
-
"1e712685-714f-6720-a24b-96d95aa38c32",
|
|
179
|
-
],
|
|
180
|
-
[
|
|
181
|
-
"68f820c0-1268-11e7-a24b-671acd892c6a",
|
|
182
|
-
"1e712686-8f82-60c0-a24b-671acd892c6a",
|
|
183
|
-
],
|
|
184
|
-
];
|
|
185
|
-
cases.forEach(([v1, v6]) => {
|
|
186
|
-
const converted = convert1to6(v1);
|
|
187
|
-
expect(converted).toBe(v6);
|
|
188
|
-
expect(converted).toMatch(regex);
|
|
189
|
-
});
|
|
172
|
+
it("should accept clockseq -1", () => {
|
|
173
|
+
const regex = /^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
174
|
+
const uuid = uuid6(-1);
|
|
175
|
+
expect(uuid).toMatch(regex);
|
|
176
|
+
expect(uuid.includes("u")).toBe(false);
|
|
190
177
|
});
|
|
191
178
|
});
|
package/dist/web.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { END, Graph, type StateGraphArgs, START, StateGraph, type CompiledStateGraph, MessageGraph, } from "./graph/index.js";
|
|
2
2
|
export { MemorySaver } from "./checkpoint/memory.js";
|
|
3
|
-
export { type Checkpoint, type CheckpointMetadata, copyCheckpoint, emptyCheckpoint, BaseCheckpointSaver, } from "./checkpoint/base.js";
|
|
3
|
+
export { type Checkpoint, type CheckpointMetadata, type CheckpointTuple, copyCheckpoint, emptyCheckpoint, BaseCheckpointSaver, } from "./checkpoint/base.js";
|
|
4
4
|
export { GraphRecursionError, GraphValueError, InvalidUpdateError, EmptyChannelError, } from "./errors.js";
|
|
5
|
+
export { type SerializerProtocol } from "./serde/base.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "LangGraph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@langchain/core": ">0.1.61 <0.3.0",
|
|
41
|
-
"uuid": "^
|
|
41
|
+
"uuid": "^10.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@jest/globals": "^29.5.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@swc/jest": "^0.2.29",
|
|
51
51
|
"@tsconfig/recommended": "^1.0.3",
|
|
52
52
|
"@types/better-sqlite3": "^7.6.9",
|
|
53
|
-
"@types/uuid": "^
|
|
53
|
+
"@types/uuid": "^10",
|
|
54
54
|
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
55
55
|
"@typescript-eslint/parser": "^6.12.0",
|
|
56
56
|
"@xenova/transformers": "^2.17.2",
|