@langchain/langgraph-checkpoint 0.0.10 → 0.0.11
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/memory.cjs +6 -2
- package/dist/memory.js +6 -2
- package/package.json +1 -1
package/dist/memory.cjs
CHANGED
|
@@ -125,13 +125,13 @@ class MemorySaver extends base_js_1.BaseCheckpointSaver {
|
|
|
125
125
|
}
|
|
126
126
|
async *list(config, options) {
|
|
127
127
|
// eslint-disable-next-line prefer-const
|
|
128
|
-
let { before, limit } = options ?? {};
|
|
128
|
+
let { before, limit, filter } = options ?? {};
|
|
129
129
|
const threadIds = config.configurable?.thread_id
|
|
130
130
|
? [config.configurable?.thread_id]
|
|
131
131
|
: Object.keys(this.storage);
|
|
132
132
|
const configCheckpointNamespace = config.configurable?.checkpoint_ns;
|
|
133
133
|
for (const threadId of threadIds) {
|
|
134
|
-
for (const checkpointNamespace of Object.keys(this.storage[threadId])) {
|
|
134
|
+
for (const checkpointNamespace of Object.keys(this.storage[threadId] ?? {})) {
|
|
135
135
|
if (configCheckpointNamespace !== undefined &&
|
|
136
136
|
checkpointNamespace !== configCheckpointNamespace) {
|
|
137
137
|
continue;
|
|
@@ -147,6 +147,10 @@ class MemorySaver extends base_js_1.BaseCheckpointSaver {
|
|
|
147
147
|
}
|
|
148
148
|
// Parse metadata
|
|
149
149
|
const metadata = (await this.serde.loadsTyped("json", metadataStr));
|
|
150
|
+
if (filter &&
|
|
151
|
+
!Object.entries(filter).every(([key, value]) => metadata[key] === value)) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
150
154
|
// Limit search results
|
|
151
155
|
if (limit !== undefined) {
|
|
152
156
|
if (limit <= 0)
|
package/dist/memory.js
CHANGED
|
@@ -122,13 +122,13 @@ export class MemorySaver extends BaseCheckpointSaver {
|
|
|
122
122
|
}
|
|
123
123
|
async *list(config, options) {
|
|
124
124
|
// eslint-disable-next-line prefer-const
|
|
125
|
-
let { before, limit } = options ?? {};
|
|
125
|
+
let { before, limit, filter } = options ?? {};
|
|
126
126
|
const threadIds = config.configurable?.thread_id
|
|
127
127
|
? [config.configurable?.thread_id]
|
|
128
128
|
: Object.keys(this.storage);
|
|
129
129
|
const configCheckpointNamespace = config.configurable?.checkpoint_ns;
|
|
130
130
|
for (const threadId of threadIds) {
|
|
131
|
-
for (const checkpointNamespace of Object.keys(this.storage[threadId])) {
|
|
131
|
+
for (const checkpointNamespace of Object.keys(this.storage[threadId] ?? {})) {
|
|
132
132
|
if (configCheckpointNamespace !== undefined &&
|
|
133
133
|
checkpointNamespace !== configCheckpointNamespace) {
|
|
134
134
|
continue;
|
|
@@ -144,6 +144,10 @@ export class MemorySaver extends BaseCheckpointSaver {
|
|
|
144
144
|
}
|
|
145
145
|
// Parse metadata
|
|
146
146
|
const metadata = (await this.serde.loadsTyped("json", metadataStr));
|
|
147
|
+
if (filter &&
|
|
148
|
+
!Object.entries(filter).every(([key, value]) => metadata[key] === value)) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
147
151
|
// Limit search results
|
|
148
152
|
if (limit !== undefined) {
|
|
149
153
|
if (limit <= 0)
|