@langchain/langgraph-checkpoint 0.0.8 → 0.0.9-rc.0
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/store/base.cjs +9 -9
- package/dist/store/base.d.ts +9 -9
- package/dist/store/base.js +9 -9
- package/dist/store/batch.cjs +6 -6
- package/dist/store/batch.d.ts +3 -3
- package/dist/store/batch.js +6 -6
- package/dist/store/memory.cjs +7 -7
- package/dist/store/memory.js +7 -7
- package/package.json +1 -1
package/dist/store/base.cjs
CHANGED
|
@@ -10,11 +10,11 @@ class BaseStore {
|
|
|
10
10
|
/**
|
|
11
11
|
* Retrieve a single item.
|
|
12
12
|
* @param namespace Hierarchical path for the item.
|
|
13
|
-
* @param
|
|
13
|
+
* @param key Unique identifier within the namespace.
|
|
14
14
|
* @returns A promise that resolves to the retrieved item or null if not found.
|
|
15
15
|
*/
|
|
16
|
-
async get(namespace,
|
|
17
|
-
const batchResult = await this.batch([{ namespace,
|
|
16
|
+
async get(namespace, key) {
|
|
17
|
+
const batchResult = await this.batch([{ namespace, key }]);
|
|
18
18
|
return batchResult[0];
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
@@ -40,19 +40,19 @@ class BaseStore {
|
|
|
40
40
|
/**
|
|
41
41
|
* Store or update an item.
|
|
42
42
|
* @param namespace Hierarchical path for the item.
|
|
43
|
-
* @param
|
|
43
|
+
* @param key Unique identifier within the namespace.
|
|
44
44
|
* @param value Object containing the item's data.
|
|
45
45
|
*/
|
|
46
|
-
async put(namespace,
|
|
47
|
-
await this.batch([{ namespace,
|
|
46
|
+
async put(namespace, key, value) {
|
|
47
|
+
await this.batch([{ namespace, key, value }]);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Delete an item.
|
|
51
51
|
* @param namespace Hierarchical path for the item.
|
|
52
|
-
* @param
|
|
52
|
+
* @param key Unique identifier within the namespace.
|
|
53
53
|
*/
|
|
54
|
-
async delete(namespace,
|
|
55
|
-
await this.batch([{ namespace,
|
|
54
|
+
async delete(namespace, key) {
|
|
55
|
+
await this.batch([{ namespace, key, value: null }]);
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* List and filter namespaces in the store.
|
package/dist/store/base.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface Item {
|
|
|
9
9
|
/**
|
|
10
10
|
* Unique identifier within the namespace.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
key: string;
|
|
13
13
|
/**
|
|
14
14
|
* Hierarchical path defining the collection in which this document resides.
|
|
15
15
|
* Represented as an array of strings, allowing for nested categorization.
|
|
@@ -36,7 +36,7 @@ export interface GetOperation {
|
|
|
36
36
|
/**
|
|
37
37
|
* Unique identifier within the namespace.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
key: string;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Operation to search for items within a namespace prefix.
|
|
@@ -75,7 +75,7 @@ export interface PutOperation {
|
|
|
75
75
|
* Unique identifier for the document.
|
|
76
76
|
* Should be distinct within its namespace.
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
key: string;
|
|
79
79
|
/**
|
|
80
80
|
* Data to be stored, or None to delete the item.
|
|
81
81
|
* Schema:
|
|
@@ -115,10 +115,10 @@ export declare abstract class BaseStore {
|
|
|
115
115
|
/**
|
|
116
116
|
* Retrieve a single item.
|
|
117
117
|
* @param namespace Hierarchical path for the item.
|
|
118
|
-
* @param
|
|
118
|
+
* @param key Unique identifier within the namespace.
|
|
119
119
|
* @returns A promise that resolves to the retrieved item or null if not found.
|
|
120
120
|
*/
|
|
121
|
-
get(namespace: string[],
|
|
121
|
+
get(namespace: string[], key: string): Promise<Item | null>;
|
|
122
122
|
/**
|
|
123
123
|
* Search for items within a namespace prefix.
|
|
124
124
|
* @param namespacePrefix Hierarchical path prefix to search within.
|
|
@@ -136,16 +136,16 @@ export declare abstract class BaseStore {
|
|
|
136
136
|
/**
|
|
137
137
|
* Store or update an item.
|
|
138
138
|
* @param namespace Hierarchical path for the item.
|
|
139
|
-
* @param
|
|
139
|
+
* @param key Unique identifier within the namespace.
|
|
140
140
|
* @param value Object containing the item's data.
|
|
141
141
|
*/
|
|
142
|
-
put(namespace: string[],
|
|
142
|
+
put(namespace: string[], key: string, value: Record<string, any>): Promise<void>;
|
|
143
143
|
/**
|
|
144
144
|
* Delete an item.
|
|
145
145
|
* @param namespace Hierarchical path for the item.
|
|
146
|
-
* @param
|
|
146
|
+
* @param key Unique identifier within the namespace.
|
|
147
147
|
*/
|
|
148
|
-
delete(namespace: string[],
|
|
148
|
+
delete(namespace: string[], key: string): Promise<void>;
|
|
149
149
|
/**
|
|
150
150
|
* List and filter namespaces in the store.
|
|
151
151
|
* @param options Options for listing namespaces.
|
package/dist/store/base.js
CHANGED
|
@@ -7,11 +7,11 @@ export class BaseStore {
|
|
|
7
7
|
/**
|
|
8
8
|
* Retrieve a single item.
|
|
9
9
|
* @param namespace Hierarchical path for the item.
|
|
10
|
-
* @param
|
|
10
|
+
* @param key Unique identifier within the namespace.
|
|
11
11
|
* @returns A promise that resolves to the retrieved item or null if not found.
|
|
12
12
|
*/
|
|
13
|
-
async get(namespace,
|
|
14
|
-
const batchResult = await this.batch([{ namespace,
|
|
13
|
+
async get(namespace, key) {
|
|
14
|
+
const batchResult = await this.batch([{ namespace, key }]);
|
|
15
15
|
return batchResult[0];
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -37,19 +37,19 @@ export class BaseStore {
|
|
|
37
37
|
/**
|
|
38
38
|
* Store or update an item.
|
|
39
39
|
* @param namespace Hierarchical path for the item.
|
|
40
|
-
* @param
|
|
40
|
+
* @param key Unique identifier within the namespace.
|
|
41
41
|
* @param value Object containing the item's data.
|
|
42
42
|
*/
|
|
43
|
-
async put(namespace,
|
|
44
|
-
await this.batch([{ namespace,
|
|
43
|
+
async put(namespace, key, value) {
|
|
44
|
+
await this.batch([{ namespace, key, value }]);
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Delete an item.
|
|
48
48
|
* @param namespace Hierarchical path for the item.
|
|
49
|
-
* @param
|
|
49
|
+
* @param key Unique identifier within the namespace.
|
|
50
50
|
*/
|
|
51
|
-
async delete(namespace,
|
|
52
|
-
await this.batch([{ namespace,
|
|
51
|
+
async delete(namespace, key) {
|
|
52
|
+
await this.batch([{ namespace, key, value: null }]);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* List and filter namespaces in the store.
|
package/dist/store/batch.cjs
CHANGED
|
@@ -52,8 +52,8 @@ class AsyncBatchedStore extends base_js_1.BaseStore {
|
|
|
52
52
|
"\n Instead, it calls the `batch` method on the wrapped store." +
|
|
53
53
|
"\n If you are seeing this error, something is wrong.");
|
|
54
54
|
}
|
|
55
|
-
async get(namespace,
|
|
56
|
-
return this.enqueueOperation({ namespace,
|
|
55
|
+
async get(namespace, key) {
|
|
56
|
+
return this.enqueueOperation({ namespace, key });
|
|
57
57
|
}
|
|
58
58
|
async search(namespacePrefix, options) {
|
|
59
59
|
const { filter, limit = 10, offset = 0 } = options || {};
|
|
@@ -64,13 +64,13 @@ class AsyncBatchedStore extends base_js_1.BaseStore {
|
|
|
64
64
|
offset,
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
async put(namespace,
|
|
68
|
-
return this.enqueueOperation({ namespace,
|
|
67
|
+
async put(namespace, key, value) {
|
|
68
|
+
return this.enqueueOperation({ namespace, key, value });
|
|
69
69
|
}
|
|
70
|
-
async delete(namespace,
|
|
70
|
+
async delete(namespace, key) {
|
|
71
71
|
return this.enqueueOperation({
|
|
72
72
|
namespace,
|
|
73
|
-
|
|
73
|
+
key,
|
|
74
74
|
value: null,
|
|
75
75
|
});
|
|
76
76
|
}
|
package/dist/store/batch.d.ts
CHANGED
|
@@ -14,14 +14,14 @@ export declare class AsyncBatchedStore extends BaseStore {
|
|
|
14
14
|
* the convenience methods (get, search, put, delete).
|
|
15
15
|
*/
|
|
16
16
|
batch<Op extends Operation[]>(_operations: Op): Promise<OperationResults<Op>>;
|
|
17
|
-
get(namespace: string[],
|
|
17
|
+
get(namespace: string[], key: string): Promise<Item | null>;
|
|
18
18
|
search(namespacePrefix: string[], options?: {
|
|
19
19
|
filter?: Record<string, any>;
|
|
20
20
|
limit?: number;
|
|
21
21
|
offset?: number;
|
|
22
22
|
}): Promise<Item[]>;
|
|
23
|
-
put(namespace: string[],
|
|
24
|
-
delete(namespace: string[],
|
|
23
|
+
put(namespace: string[], key: string, value: Record<string, any>): Promise<void>;
|
|
24
|
+
delete(namespace: string[], key: string): Promise<void>;
|
|
25
25
|
start(): void;
|
|
26
26
|
stop(): Promise<void>;
|
|
27
27
|
private enqueueOperation;
|
package/dist/store/batch.js
CHANGED
|
@@ -49,8 +49,8 @@ export class AsyncBatchedStore extends BaseStore {
|
|
|
49
49
|
"\n Instead, it calls the `batch` method on the wrapped store." +
|
|
50
50
|
"\n If you are seeing this error, something is wrong.");
|
|
51
51
|
}
|
|
52
|
-
async get(namespace,
|
|
53
|
-
return this.enqueueOperation({ namespace,
|
|
52
|
+
async get(namespace, key) {
|
|
53
|
+
return this.enqueueOperation({ namespace, key });
|
|
54
54
|
}
|
|
55
55
|
async search(namespacePrefix, options) {
|
|
56
56
|
const { filter, limit = 10, offset = 0 } = options || {};
|
|
@@ -61,13 +61,13 @@ export class AsyncBatchedStore extends BaseStore {
|
|
|
61
61
|
offset,
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
async put(namespace,
|
|
65
|
-
return this.enqueueOperation({ namespace,
|
|
64
|
+
async put(namespace, key, value) {
|
|
65
|
+
return this.enqueueOperation({ namespace, key, value });
|
|
66
66
|
}
|
|
67
|
-
async delete(namespace,
|
|
67
|
+
async delete(namespace, key) {
|
|
68
68
|
return this.enqueueOperation({
|
|
69
69
|
namespace,
|
|
70
|
-
|
|
70
|
+
key,
|
|
71
71
|
value: null,
|
|
72
72
|
});
|
|
73
73
|
}
|
package/dist/store/memory.cjs
CHANGED
|
@@ -15,7 +15,7 @@ class MemoryStore extends base_js_1.BaseStore {
|
|
|
15
15
|
async batch(operations) {
|
|
16
16
|
const results = [];
|
|
17
17
|
for (const op of operations) {
|
|
18
|
-
if ("
|
|
18
|
+
if ("key" in op && "namespace" in op && !("value" in op)) {
|
|
19
19
|
// GetOperation
|
|
20
20
|
results.push(this.getOperation(op));
|
|
21
21
|
}
|
|
@@ -36,7 +36,7 @@ class MemoryStore extends base_js_1.BaseStore {
|
|
|
36
36
|
}
|
|
37
37
|
getOperation(op) {
|
|
38
38
|
const namespaceKey = op.namespace.join(":");
|
|
39
|
-
const item = this.data.get(namespaceKey)?.get(op.
|
|
39
|
+
const item = this.data.get(namespaceKey)?.get(op.key);
|
|
40
40
|
return item || null;
|
|
41
41
|
}
|
|
42
42
|
searchOperation(op) {
|
|
@@ -60,19 +60,19 @@ class MemoryStore extends base_js_1.BaseStore {
|
|
|
60
60
|
}
|
|
61
61
|
const namespaceMap = this.data.get(namespaceKey);
|
|
62
62
|
if (op.value === null) {
|
|
63
|
-
namespaceMap.delete(op.
|
|
63
|
+
namespaceMap.delete(op.key);
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
66
|
const now = new Date();
|
|
67
|
-
if (namespaceMap.has(op.
|
|
68
|
-
const item = namespaceMap.get(op.
|
|
67
|
+
if (namespaceMap.has(op.key)) {
|
|
68
|
+
const item = namespaceMap.get(op.key);
|
|
69
69
|
item.value = op.value;
|
|
70
70
|
item.updatedAt = now;
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
|
-
namespaceMap.set(op.
|
|
73
|
+
namespaceMap.set(op.key, {
|
|
74
74
|
value: op.value,
|
|
75
|
-
|
|
75
|
+
key: op.key,
|
|
76
76
|
namespace: op.namespace,
|
|
77
77
|
createdAt: now,
|
|
78
78
|
updatedAt: now,
|
package/dist/store/memory.js
CHANGED
|
@@ -12,7 +12,7 @@ export class MemoryStore extends BaseStore {
|
|
|
12
12
|
async batch(operations) {
|
|
13
13
|
const results = [];
|
|
14
14
|
for (const op of operations) {
|
|
15
|
-
if ("
|
|
15
|
+
if ("key" in op && "namespace" in op && !("value" in op)) {
|
|
16
16
|
// GetOperation
|
|
17
17
|
results.push(this.getOperation(op));
|
|
18
18
|
}
|
|
@@ -33,7 +33,7 @@ export class MemoryStore extends BaseStore {
|
|
|
33
33
|
}
|
|
34
34
|
getOperation(op) {
|
|
35
35
|
const namespaceKey = op.namespace.join(":");
|
|
36
|
-
const item = this.data.get(namespaceKey)?.get(op.
|
|
36
|
+
const item = this.data.get(namespaceKey)?.get(op.key);
|
|
37
37
|
return item || null;
|
|
38
38
|
}
|
|
39
39
|
searchOperation(op) {
|
|
@@ -57,19 +57,19 @@ export class MemoryStore extends BaseStore {
|
|
|
57
57
|
}
|
|
58
58
|
const namespaceMap = this.data.get(namespaceKey);
|
|
59
59
|
if (op.value === null) {
|
|
60
|
-
namespaceMap.delete(op.
|
|
60
|
+
namespaceMap.delete(op.key);
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
63
|
const now = new Date();
|
|
64
|
-
if (namespaceMap.has(op.
|
|
65
|
-
const item = namespaceMap.get(op.
|
|
64
|
+
if (namespaceMap.has(op.key)) {
|
|
65
|
+
const item = namespaceMap.get(op.key);
|
|
66
66
|
item.value = op.value;
|
|
67
67
|
item.updatedAt = now;
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
70
|
-
namespaceMap.set(op.
|
|
70
|
+
namespaceMap.set(op.key, {
|
|
71
71
|
value: op.value,
|
|
72
|
-
|
|
72
|
+
key: op.key,
|
|
73
73
|
namespace: op.namespace,
|
|
74
74
|
createdAt: now,
|
|
75
75
|
updatedAt: now,
|